From 0fbeabf7a675af174f0bf8165c5a489d80301f03 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 13:45:32 +0100 Subject: [PATCH 01/32] Extract constants for autofill into separate file --- src/services/autofill.service.ts | 163 ++---------- src/services/autofillConstants.ts | 420 ++++++++++++++++++++++++++++++ 2 files changed, 447 insertions(+), 136 deletions(-) create mode 100644 src/services/autofillConstants.ts diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 32f820bd06..da0037db81 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -21,116 +21,7 @@ import AutofillScript from '../models/autofillScript'; import { BrowserApi } from '../browser/browserApi'; -const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag', - 'placeholder', 'label-left', 'label-top', 'data-recurly']; - -const CardAttributesExtended: string[] = [...CardAttributes, 'label-right']; - -const IdentityAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag', - 'placeholder', 'label-left', 'label-top', 'data-recurly']; - -const UsernameFieldNames: string[] = [ - // English - 'username', 'user name', 'email', 'email address', 'e-mail', 'e-mail address', 'userid', 'user id', - 'customer id', 'login id', - // German - 'benutzername', 'benutzer name', 'email adresse', 'e-mail adresse', 'benutzerid', 'benutzer id']; - -const FirstnameFieldNames: string[] = [ - // English - 'f-name', 'first-name', 'given-name', 'first-n', - // German - 'vorname', -]; - -const LastnameFieldNames: string[] = [ - // English - 'l-name', 'last-name', 's-name', 'surname', 'family-name', 'family-n', 'last-n', - // German - 'nachname', 'familienname', -]; - -const ExcludedAutofillTypes: string[] = ['radio', 'checkbox', 'hidden', 'file', 'button', 'image', 'reset', 'search']; - -// Each index represents a language. These three arrays should all be the same length. -// 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese -const MonthAbbr = ['mm', 'mm', 'mm', 'mm', 'mm', 'mm']; -const YearAbbrShort = ['yy', 'åå', 'jj', 'aa', 'гг', 'rr']; -const YearAbbrLong = ['yyyy', 'åååå', 'jjjj', 'aa', 'гггг', 'rrrr']; - -const OperationDelays = new Map([ - ['buzzsprout.com', 100], -]); - -/* tslint:disable */ -const IsoCountries: { [id: string]: string; } = { - afghanistan: "AF", "aland islands": "AX", albania: "AL", algeria: "DZ", "american samoa": "AS", andorra: "AD", - angola: "AO", anguilla: "AI", antarctica: "AQ", "antigua and barbuda": "AG", argentina: "AR", armenia: "AM", - aruba: "AW", australia: "AU", austria: "AT", azerbaijan: "AZ", bahamas: "BS", bahrain: "BH", bangladesh: "BD", - barbados: "BB", belarus: "BY", belgium: "BE", belize: "BZ", benin: "BJ", bermuda: "BM", bhutan: "BT", - bolivia: "BO", "bosnia and herzegovina": "BA", botswana: "BW", "bouvet island": "BV", brazil: "BR", - "british indian ocean territory": "IO", "brunei darussalam": "BN", bulgaria: "BG", "burkina faso": "BF", - burundi: "BI", cambodia: "KH", cameroon: "CM", canada: "CA", "cape verde": "CV", "cayman islands": "KY", - "central african republic": "CF", chad: "TD", chile: "CL", china: "CN", "christmas island": "CX", - "cocos (keeling) islands": "CC", colombia: "CO", comoros: "KM", congo: "CG", "congo, democratic republic": "CD", - "cook islands": "CK", "costa rica": "CR", "cote d'ivoire": "CI", croatia: "HR", cuba: "CU", cyprus: "CY", - "czech republic": "CZ", denmark: "DK", djibouti: "DJ", dominica: "DM", "dominican republic": "DO", ecuador: "EC", - egypt: "EG", "el salvador": "SV", "equatorial guinea": "GQ", eritrea: "ER", estonia: "EE", ethiopia: "ET", - "falkland islands": "FK", "faroe islands": "FO", fiji: "FJ", finland: "FI", france: "FR", "french guiana": "GF", - "french polynesia": "PF", "french southern territories": "TF", gabon: "GA", gambia: "GM", georgia: "GE", - germany: "DE", ghana: "GH", gibraltar: "GI", greece: "GR", greenland: "GL", grenada: "GD", guadeloupe: "GP", - guam: "GU", guatemala: "GT", guernsey: "GG", guinea: "GN", "guinea-bissau": "GW", guyana: "GY", haiti: "HT", - "heard island & mcdonald islands": "HM", "holy see (vatican city state)": "VA", honduras: "HN", "hong kong": "HK", - hungary: "HU", iceland: "IS", india: "IN", indonesia: "ID", "iran, islamic republic of": "IR", iraq: "IQ", - ireland: "IE", "isle of man": "IM", israel: "IL", italy: "IT", jamaica: "JM", japan: "JP", jersey: "JE", - jordan: "JO", kazakhstan: "KZ", kenya: "KE", kiribati: "KI", "republic of korea": "KR", "south korea": "KR", - "democratic people's republic of korea": "KP", "north korea": "KP", kuwait: "KW", kyrgyzstan: "KG", - "lao people's democratic republic": "LA", latvia: "LV", lebanon: "LB", lesotho: "LS", liberia: "LR", - "libyan arab jamahiriya": "LY", liechtenstein: "LI", lithuania: "LT", luxembourg: "LU", macao: "MO", - macedonia: "MK", madagascar: "MG", malawi: "MW", malaysia: "MY", maldives: "MV", mali: "ML", malta: "MT", - "marshall islands": "MH", martinique: "MQ", mauritania: "MR", mauritius: "MU", mayotte: "YT", mexico: "MX", - "micronesia, federated states of": "FM", moldova: "MD", monaco: "MC", mongolia: "MN", montenegro: "ME", - montserrat: "MS", morocco: "MA", mozambique: "MZ", myanmar: "MM", namibia: "NA", nauru: "NR", nepal: "NP", - netherlands: "NL", "netherlands antilles": "AN", "new caledonia": "NC", "new zealand": "NZ", nicaragua: "NI", - niger: "NE", nigeria: "NG", niue: "NU", "norfolk island": "NF", "northern mariana islands": "MP", norway: "NO", - oman: "OM", pakistan: "PK", palau: "PW", "palestinian territory, occupied": "PS", panama: "PA", - "papua new guinea": "PG", paraguay: "PY", peru: "PE", philippines: "PH", pitcairn: "PN", poland: "PL", - portugal: "PT", "puerto rico": "PR", qatar: "QA", reunion: "RE", romania: "RO", "russian federation": "RU", - rwanda: "RW", "saint barthelemy": "BL", "saint helena": "SH", "saint kitts and nevis": "KN", "saint lucia": "LC", - "saint martin": "MF", "saint pierre and miquelon": "PM", "saint vincent and grenadines": "VC", samoa: "WS", - "san marino": "SM", "sao tome and principe": "ST", "saudi arabia": "SA", senegal: "SN", serbia: "RS", - seychelles: "SC", "sierra leone": "SL", singapore: "SG", slovakia: "SK", slovenia: "SI", "solomon islands": "SB", - somalia: "SO", "south africa": "ZA", "south georgia and sandwich isl.": "GS", spain: "ES", "sri lanka": "LK", - sudan: "SD", suriname: "SR", "svalbard and jan mayen": "SJ", swaziland: "SZ", sweden: "SE", switzerland: "CH", - "syrian arab republic": "SY", taiwan: "TW", tajikistan: "TJ", tanzania: "TZ", thailand: "TH", "timor-leste": "TL", - togo: "TG", tokelau: "TK", tonga: "TO", "trinidad and tobago": "TT", tunisia: "TN", turkey: "TR", - turkmenistan: "TM", "turks and caicos islands": "TC", tuvalu: "TV", uganda: "UG", ukraine: "UA", - "united arab emirates": "AE", "united kingdom": "GB", "united states": "US", - "united states outlying islands": "UM", uruguay: "UY", uzbekistan: "UZ", vanuatu: "VU", venezuela: "VE", - vietnam: "VN", "virgin islands, british": "VG", "virgin islands, u.s.": "VI", "wallis and futuna": "WF", - "western sahara": "EH", yemen: "YE", zambia: "ZM", zimbabwe: "ZW", -}; - -const IsoStates: { [id: string]: string; } = { - alabama: 'AL', alaska: 'AK', 'american samoa': 'AS', arizona: 'AZ', arkansas: 'AR', california: 'CA', - colorado: 'CO', connecticut: 'CT', delaware: 'DE', 'district of columbia': 'DC', - 'federated states of micronesia': 'FM', florida: 'FL', georgia: 'GA', guam: 'GU', hawaii: 'HI', idaho: 'ID', - illinois: 'IL', indiana: 'IN', iowa: 'IA', kansas: 'KS', kentucky: 'KY', louisiana: 'LA', maine: 'ME', - 'marshall islands': 'MH', maryland: 'MD', massachusetts: 'MA', michigan: 'MI', minnesota: 'MN', mississippi: 'MS', - missouri: 'MO', montana: 'MT', nebraska: 'NE', nevada: 'NV', 'new hampshire': 'NH', 'new jersey': 'NJ', - 'new mexico': 'NM', 'new york': 'NY', 'north carolina': 'NC', 'north dakota': 'ND', - 'northern mariana islands': 'MP', ohio: 'OH', oklahoma: 'OK', oregon: 'OR', palau: 'PW', pennsylvania: 'PA', - 'puerto rico': 'PR', 'rhode island': 'RI', 'south carolina': 'SC', 'south dakota': 'SD', tennessee: 'TN', - texas: 'TX', utah: 'UT', vermont: 'VT', 'virgin islands': 'VI', virginia: 'VA', washington: 'WA', - 'west virginia': 'WV', wisconsin: 'WI', wyoming: 'WY', -}; - -var IsoProvinces: { [id: string]: string; } = { - alberta: 'AB', 'british columbia': 'BC', manitoba: 'MB', 'new brunswick': 'NB', 'newfoundland and labrador': 'NL', - 'nova scotia': 'NS', ontario: 'ON', 'prince edward island': 'PE', quebec: 'QC', saskatchewan: 'SK', -}; -// /* tslint:enable */ - +import { AutoFillConstants } from './autofillConstants'; export default class AutofillService implements AutofillServiceInterface { constructor(private cipherService: CipherService, private userService: UserService, @@ -437,7 +328,7 @@ export default class AutofillService implements AutofillServiceInterface { // No password fields on this page. Let's try to just fuzzy fill the username. pageDetails.fields.forEach((f: any) => { if (f.viewable && (f.type === 'text' || f.type === 'email' || f.type === 'tel') && - this.fieldIsFuzzyMatch(f, UsernameFieldNames)) { + this.fieldIsFuzzyMatch(f, AutoFillConstants.UsernameFieldNames)) { usernames.push(f); } }); @@ -478,12 +369,12 @@ export default class AutofillService implements AutofillServiceInterface { return; } - if (this.isExcludedType(f.type, ExcludedAutofillTypes)) { + if (this.isExcludedType(f.type, AutoFillConstants.ExcludedAutofillTypes)) { return; } - for (let i = 0; i < CardAttributes.length; i++) { - const attr = CardAttributes[i]; + for (let i = 0; i < AutoFillConstants.CardAttributes.length; i++) { + const attr = AutoFillConstants.CardAttributes[i]; if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) { continue; } @@ -634,36 +525,36 @@ export default class AutofillService implements AutofillServiceInterface { } let exp: string = null; - for (let i = 0; i < MonthAbbr.length; i++) { - if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '/' + YearAbbrShort[i]) && + for (let i = 0; i < AutoFillConstants.MonthAbbr.length; i++) { + if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + '/' + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '/' + YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + '/' + fullYear; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + '/' + MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '/' + AutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + '/' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + '/' + MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '/' + AutoFillConstants.MonthAbbr[i])) { exp = fullYear + '/' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '-' + YearAbbrShort[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + '-' + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '-' + YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + '-' + fullYear; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + '-' + MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '-' + AutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + '-' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + '-' + MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '-' + AutoFillConstants.MonthAbbr[i])) { exp = fullYear + '-' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + AutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + AutoFillConstants.MonthAbbr[i])) { exp = fullYear + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + YearAbbrShort[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + fullYear; } @@ -688,7 +579,7 @@ export default class AutofillService implements AutofillServiceInterface { } let doesContain = false; - CardAttributesExtended.forEach(attr => { + AutoFillConstants.CardAttributesExtended.forEach(attr => { if (doesContain || !field.hasOwnProperty(attr) || !field[attr]) { return; } @@ -714,12 +605,12 @@ export default class AutofillService implements AutofillServiceInterface { return; } - if (this.isExcludedType(f.type, ExcludedAutofillTypes)) { + if (this.isExcludedType(f.type, AutoFillConstants.ExcludedAutofillTypes)) { return; } - for (let i = 0; i < IdentityAttributes.length; i++) { - const attr = IdentityAttributes[i]; + for (let i = 0; i < AutoFillConstants.IdentityAttributes.length; i++) { + const attr = AutoFillConstants.IdentityAttributes[i]; if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) { continue; } @@ -731,7 +622,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.name = f; break; } else if (!fillFields.firstName && this.isFieldMatch(f[attr], - FirstnameFieldNames)) { + AutoFillConstants.FirstnameFieldNames)) { fillFields.firstName = f; break; } else if (!fillFields.middleName && this.isFieldMatch(f[attr], @@ -739,7 +630,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.middleName = f; break; } else if (!fillFields.lastName && this.isFieldMatch(f[attr], - LastnameFieldNames)) { + AutoFillConstants.LastnameFieldNames)) { fillFields.lastName = f; break; } else if (!fillFields.title && this.isFieldMatch(f[attr], @@ -820,7 +711,7 @@ export default class AutofillService implements AutofillServiceInterface { let filledState = false; if (fillFields.state && identity.state && identity.state.length > 2) { const stateLower = identity.state.toLowerCase(); - const isoState = IsoStates[stateLower] || IsoProvinces[stateLower]; + const isoState = AutoFillConstants.IsoStates[stateLower] || AutoFillConstants.IsoProvinces[stateLower]; if (isoState) { filledState = true; this.makeScriptActionWithValue(fillScript, isoState, fillFields.state, filledFields); @@ -834,7 +725,7 @@ export default class AutofillService implements AutofillServiceInterface { let filledCountry = false; if (fillFields.country && identity.country && identity.country.length > 2) { const countryLower = identity.country.toLowerCase(); - const isoCountry = IsoCountries[countryLower]; + const isoCountry = AutoFillConstants.IsoCountries[countryLower]; if (isoCountry) { filledCountry = true; this.makeScriptActionWithValue(fillScript, isoCountry, fillFields.country, filledFields); @@ -1016,7 +907,7 @@ export default class AutofillService implements AutofillServiceInterface { (f.type === 'text' || f.type === 'email' || f.type === 'tel')) { usernameField = f; - if (this.findMatchingFieldIndex(f, UsernameFieldNames) > -1) { + if (this.findMatchingFieldIndex(f, AutoFillConstants.UsernameFieldNames) > -1) { // We found an exact match. No need to keep looking. break; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts new file mode 100644 index 0000000000..5e63d772f3 --- /dev/null +++ b/src/services/autofillConstants.ts @@ -0,0 +1,420 @@ +export class AutoFillConstants { + static readonly CardAttributes: string[] = [ + "autoCompleteType", + "data-stripe", + "htmlName", + "htmlID", + "label-tag", + "placeholder", + "label-left", + "label-top", + "data-recurly", + ]; + + static readonly CardAttributesExtended: string[] = [ + ...AutoFillConstants.CardAttributes, + "label-right", + ]; + + static readonly IdentityAttributes: string[] = [ + "autoCompleteType", + "data-stripe", + "htmlName", + "htmlID", + "label-tag", + "placeholder", + "label-left", + "label-top", + "data-recurly", + ]; + + static readonly UsernameFieldNames: string[] = [ + // English + "username", + "user name", + "email", + "email address", + "e-mail", + "e-mail address", + "userid", + "user id", + "customer id", + "login id", + // German + "benutzername", + "benutzer name", + "email adresse", + "e-mail adresse", + "benutzerid", + "benutzer id", + ]; + + static readonly FirstnameFieldNames: string[] = [ + // English + "f-name", + "first-name", + "given-name", + "first-n", + // German + "vorname", + ]; + + static readonly LastnameFieldNames: string[] = [ + // English + "l-name", + "last-name", + "s-name", + "surname", + "family-name", + "family-n", + "last-n", + // German + "nachname", + "familienname", + ]; + + static readonly ExcludedAutofillTypes: string[] = [ + "radio", + "checkbox", + "hidden", + "file", + "button", + "image", + "reset", + "search", + ]; + + // Each index represents a language. These three arrays should all be the same length. + // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese + static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; + static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"]; + static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"]; + + static readonly OperationDelays = new Map([["buzzsprout.com", 100]]); + + static readonly IsoCountries: { [id: string]: string } = { + afghanistan: "AF", + "aland islands": "AX", + albania: "AL", + algeria: "DZ", + "american samoa": "AS", + andorra: "AD", + angola: "AO", + anguilla: "AI", + antarctica: "AQ", + "antigua and barbuda": "AG", + argentina: "AR", + armenia: "AM", + aruba: "AW", + australia: "AU", + austria: "AT", + azerbaijan: "AZ", + bahamas: "BS", + bahrain: "BH", + bangladesh: "BD", + barbados: "BB", + belarus: "BY", + belgium: "BE", + belize: "BZ", + benin: "BJ", + bermuda: "BM", + bhutan: "BT", + bolivia: "BO", + "bosnia and herzegovina": "BA", + botswana: "BW", + "bouvet island": "BV", + brazil: "BR", + "british indian ocean territory": "IO", + "brunei darussalam": "BN", + bulgaria: "BG", + "burkina faso": "BF", + burundi: "BI", + cambodia: "KH", + cameroon: "CM", + canada: "CA", + "cape verde": "CV", + "cayman islands": "KY", + "central african republic": "CF", + chad: "TD", + chile: "CL", + china: "CN", + "christmas island": "CX", + "cocos (keeling) islands": "CC", + colombia: "CO", + comoros: "KM", + congo: "CG", + "congo, democratic republic": "CD", + "cook islands": "CK", + "costa rica": "CR", + "cote d'ivoire": "CI", + croatia: "HR", + cuba: "CU", + cyprus: "CY", + "czech republic": "CZ", + denmark: "DK", + djibouti: "DJ", + dominica: "DM", + "dominican republic": "DO", + ecuador: "EC", + egypt: "EG", + "el salvador": "SV", + "equatorial guinea": "GQ", + eritrea: "ER", + estonia: "EE", + ethiopia: "ET", + "falkland islands": "FK", + "faroe islands": "FO", + fiji: "FJ", + finland: "FI", + france: "FR", + "french guiana": "GF", + "french polynesia": "PF", + "french southern territories": "TF", + gabon: "GA", + gambia: "GM", + georgia: "GE", + germany: "DE", + ghana: "GH", + gibraltar: "GI", + greece: "GR", + greenland: "GL", + grenada: "GD", + guadeloupe: "GP", + guam: "GU", + guatemala: "GT", + guernsey: "GG", + guinea: "GN", + "guinea-bissau": "GW", + guyana: "GY", + haiti: "HT", + "heard island & mcdonald islands": "HM", + "holy see (vatican city state)": "VA", + honduras: "HN", + "hong kong": "HK", + hungary: "HU", + iceland: "IS", + india: "IN", + indonesia: "ID", + "iran, islamic republic of": "IR", + iraq: "IQ", + ireland: "IE", + "isle of man": "IM", + israel: "IL", + italy: "IT", + jamaica: "JM", + japan: "JP", + jersey: "JE", + jordan: "JO", + kazakhstan: "KZ", + kenya: "KE", + kiribati: "KI", + "republic of korea": "KR", + "south korea": "KR", + "democratic people's republic of korea": "KP", + "north korea": "KP", + kuwait: "KW", + kyrgyzstan: "KG", + "lao people's democratic republic": "LA", + latvia: "LV", + lebanon: "LB", + lesotho: "LS", + liberia: "LR", + "libyan arab jamahiriya": "LY", + liechtenstein: "LI", + lithuania: "LT", + luxembourg: "LU", + macao: "MO", + macedonia: "MK", + madagascar: "MG", + malawi: "MW", + malaysia: "MY", + maldives: "MV", + mali: "ML", + malta: "MT", + "marshall islands": "MH", + martinique: "MQ", + mauritania: "MR", + mauritius: "MU", + mayotte: "YT", + mexico: "MX", + "micronesia, federated states of": "FM", + moldova: "MD", + monaco: "MC", + mongolia: "MN", + montenegro: "ME", + montserrat: "MS", + morocco: "MA", + mozambique: "MZ", + myanmar: "MM", + namibia: "NA", + nauru: "NR", + nepal: "NP", + netherlands: "NL", + "netherlands antilles": "AN", + "new caledonia": "NC", + "new zealand": "NZ", + nicaragua: "NI", + niger: "NE", + nigeria: "NG", + niue: "NU", + "norfolk island": "NF", + "northern mariana islands": "MP", + norway: "NO", + oman: "OM", + pakistan: "PK", + palau: "PW", + "palestinian territory, occupied": "PS", + panama: "PA", + "papua new guinea": "PG", + paraguay: "PY", + peru: "PE", + philippines: "PH", + pitcairn: "PN", + poland: "PL", + portugal: "PT", + "puerto rico": "PR", + qatar: "QA", + reunion: "RE", + romania: "RO", + "russian federation": "RU", + rwanda: "RW", + "saint barthelemy": "BL", + "saint helena": "SH", + "saint kitts and nevis": "KN", + "saint lucia": "LC", + "saint martin": "MF", + "saint pierre and miquelon": "PM", + "saint vincent and grenadines": "VC", + samoa: "WS", + "san marino": "SM", + "sao tome and principe": "ST", + "saudi arabia": "SA", + senegal: "SN", + serbia: "RS", + seychelles: "SC", + "sierra leone": "SL", + singapore: "SG", + slovakia: "SK", + slovenia: "SI", + "solomon islands": "SB", + somalia: "SO", + "south africa": "ZA", + "south georgia and sandwich isl.": "GS", + spain: "ES", + "sri lanka": "LK", + sudan: "SD", + suriname: "SR", + "svalbard and jan mayen": "SJ", + swaziland: "SZ", + sweden: "SE", + switzerland: "CH", + "syrian arab republic": "SY", + taiwan: "TW", + tajikistan: "TJ", + tanzania: "TZ", + thailand: "TH", + "timor-leste": "TL", + togo: "TG", + tokelau: "TK", + tonga: "TO", + "trinidad and tobago": "TT", + tunisia: "TN", + turkey: "TR", + turkmenistan: "TM", + "turks and caicos islands": "TC", + tuvalu: "TV", + uganda: "UG", + ukraine: "UA", + "united arab emirates": "AE", + "united kingdom": "GB", + "united states": "US", + "united states outlying islands": "UM", + uruguay: "UY", + uzbekistan: "UZ", + vanuatu: "VU", + venezuela: "VE", + vietnam: "VN", + "virgin islands, british": "VG", + "virgin islands, u.s.": "VI", + "wallis and futuna": "WF", + "western sahara": "EH", + yemen: "YE", + zambia: "ZM", + zimbabwe: "ZW", + }; + + static readonly IsoStates: { [id: string]: string } = { + alabama: "AL", + alaska: "AK", + "american samoa": "AS", + arizona: "AZ", + arkansas: "AR", + california: "CA", + colorado: "CO", + connecticut: "CT", + delaware: "DE", + "district of columbia": "DC", + "federated states of micronesia": "FM", + florida: "FL", + georgia: "GA", + guam: "GU", + hawaii: "HI", + idaho: "ID", + illinois: "IL", + indiana: "IN", + iowa: "IA", + kansas: "KS", + kentucky: "KY", + louisiana: "LA", + maine: "ME", + "marshall islands": "MH", + maryland: "MD", + massachusetts: "MA", + michigan: "MI", + minnesota: "MN", + mississippi: "MS", + missouri: "MO", + montana: "MT", + nebraska: "NE", + nevada: "NV", + "new hampshire": "NH", + "new jersey": "NJ", + "new mexico": "NM", + "new york": "NY", + "north carolina": "NC", + "north dakota": "ND", + "northern mariana islands": "MP", + ohio: "OH", + oklahoma: "OK", + oregon: "OR", + palau: "PW", + pennsylvania: "PA", + "puerto rico": "PR", + "rhode island": "RI", + "south carolina": "SC", + "south dakota": "SD", + tennessee: "TN", + texas: "TX", + utah: "UT", + vermont: "VT", + "virgin islands": "VI", + virginia: "VA", + washington: "WA", + "west virginia": "WV", + wisconsin: "WI", + wyoming: "WY", + }; + + static readonly IsoProvinces: { [id: string]: string } = { + alberta: "AB", + "british columbia": "BC", + manitoba: "MB", + "new brunswick": "NB", + "newfoundland and labrador": "NL", + "nova scotia": "NS", + ontario: "ON", + "prince edward island": "PE", + quebec: "QC", + saskatchewan: "SK", + }; +} From 47b40e00495c3063961203178fc1be682334be4f Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 13:56:42 +0100 Subject: [PATCH 02/32] Separate CreditCard constants into its own class --- src/services/autofill.service.ts | 34 +++++++++++----------- src/services/autofillConstants.ts | 48 ++++++++++++++++--------------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index da0037db81..f415677cde 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -21,7 +21,7 @@ import AutofillScript from '../models/autofillScript'; import { BrowserApi } from '../browser/browserApi'; -import { AutoFillConstants } from './autofillConstants'; +import { AutoFillConstants, CreditCardAutoFillConstants } from './autofillConstants'; export default class AutofillService implements AutofillServiceInterface { constructor(private cipherService: CipherService, private userService: UserService, @@ -373,8 +373,8 @@ export default class AutofillService implements AutofillServiceInterface { return; } - for (let i = 0; i < AutoFillConstants.CardAttributes.length; i++) { - const attr = AutoFillConstants.CardAttributes[i]; + for (let i = 0; i < CreditCardAutoFillConstants.CardAttributes.length; i++) { + const attr = CreditCardAutoFillConstants.CardAttributes[i]; if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) { continue; } @@ -525,36 +525,36 @@ export default class AutofillService implements AutofillServiceInterface { } let exp: string = null; - for (let i = 0; i < AutoFillConstants.MonthAbbr.length; i++) { - if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrShort[i]) && + for (let i = 0; i < CreditCardAutoFillConstants.MonthAbbr.length; i++) { + if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + '/' + CreditCardAutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + '/' + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + '/' + CreditCardAutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + '/' + fullYear; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '/' + AutoFillConstants.MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrShort[i] + '/' + CreditCardAutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + '/' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '/' + AutoFillConstants.MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrLong[i] + '/' + CreditCardAutoFillConstants.MonthAbbr[i])) { exp = fullYear + '/' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrShort[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + '-' + CreditCardAutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + '-' + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + '-' + CreditCardAutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + '-' + fullYear; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '-' + AutoFillConstants.MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrShort[i] + '-' + CreditCardAutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + '-' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '-' + AutoFillConstants.MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrLong[i] + '-' + CreditCardAutoFillConstants.MonthAbbr[i])) { exp = fullYear + '-' + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + AutoFillConstants.MonthAbbr[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrShort[i] + CreditCardAutoFillConstants.MonthAbbr[i]) && partYear != null) { exp = partYear + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + AutoFillConstants.MonthAbbr[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.YearAbbrLong[i] + CreditCardAutoFillConstants.MonthAbbr[i])) { exp = fullYear + fullMonth; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrShort[i]) && + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + CreditCardAutoFillConstants.YearAbbrShort[i]) && partYear != null) { exp = fullMonth + partYear; - } else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrLong[i])) { + } else if (this.fieldAttrsContain(fillFields.exp, CreditCardAutoFillConstants.MonthAbbr[i] + CreditCardAutoFillConstants.YearAbbrLong[i])) { exp = fullMonth + fullYear; } @@ -579,7 +579,7 @@ export default class AutofillService implements AutofillServiceInterface { } let doesContain = false; - AutoFillConstants.CardAttributesExtended.forEach(attr => { + CreditCardAutoFillConstants.CardAttributesExtended.forEach(attr => { if (doesContain || !field.hasOwnProperty(attr) || !field[attr]) { return; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 5e63d772f3..5cb7e40686 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -1,21 +1,4 @@ export class AutoFillConstants { - static readonly CardAttributes: string[] = [ - "autoCompleteType", - "data-stripe", - "htmlName", - "htmlID", - "label-tag", - "placeholder", - "label-left", - "label-top", - "data-recurly", - ]; - - static readonly CardAttributesExtended: string[] = [ - ...AutoFillConstants.CardAttributes, - "label-right", - ]; - static readonly IdentityAttributes: string[] = [ "autoCompleteType", "data-stripe", @@ -84,12 +67,6 @@ export class AutoFillConstants { "search", ]; - // Each index represents a language. These three arrays should all be the same length. - // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese - static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; - static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"]; - static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"]; - static readonly OperationDelays = new Map([["buzzsprout.com", 100]]); static readonly IsoCountries: { [id: string]: string } = { @@ -418,3 +395,28 @@ export class AutoFillConstants { saskatchewan: "SK", }; } + +export class CreditCardAutoFillConstants { + static readonly CardAttributes: string[] = [ + "autoCompleteType", + "data-stripe", + "htmlName", + "htmlID", + "label-tag", + "placeholder", + "label-left", + "label-top", + "data-recurly", + ]; + + static readonly CardAttributesExtended: string[] = [ + ...CreditCardAutoFillConstants.CardAttributes, + "label-right", + ]; + + // Each index represents a language. These three arrays should all be the same length. + // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese + static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; + static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"]; + static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"]; +} From 5fb9d0ee7f95c96cc20eaf0d9bcf95b4edffd71a Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:01:26 +0100 Subject: [PATCH 03/32] Separate Identity constants into its own class --- src/services/autofill.service.ts | 14 ++-- src/services/autofillConstants.ts | 102 +++++++++++++++--------------- 2 files changed, 59 insertions(+), 57 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index f415677cde..8ec9983d71 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -21,7 +21,7 @@ import AutofillScript from '../models/autofillScript'; import { BrowserApi } from '../browser/browserApi'; -import { AutoFillConstants, CreditCardAutoFillConstants } from './autofillConstants'; +import { AutoFillConstants, CreditCardAutoFillConstants, IdentityAutoFillConstants } from './autofillConstants'; export default class AutofillService implements AutofillServiceInterface { constructor(private cipherService: CipherService, private userService: UserService, @@ -609,8 +609,8 @@ export default class AutofillService implements AutofillServiceInterface { return; } - for (let i = 0; i < AutoFillConstants.IdentityAttributes.length; i++) { - const attr = AutoFillConstants.IdentityAttributes[i]; + for (let i = 0; i < IdentityAutoFillConstants.IdentityAttributes.length; i++) { + const attr = IdentityAutoFillConstants.IdentityAttributes[i]; if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) { continue; } @@ -622,7 +622,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.name = f; break; } else if (!fillFields.firstName && this.isFieldMatch(f[attr], - AutoFillConstants.FirstnameFieldNames)) { + IdentityAutoFillConstants.FirstnameFieldNames)) { fillFields.firstName = f; break; } else if (!fillFields.middleName && this.isFieldMatch(f[attr], @@ -630,7 +630,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.middleName = f; break; } else if (!fillFields.lastName && this.isFieldMatch(f[attr], - AutoFillConstants.LastnameFieldNames)) { + IdentityAutoFillConstants.LastnameFieldNames)) { fillFields.lastName = f; break; } else if (!fillFields.title && this.isFieldMatch(f[attr], @@ -711,7 +711,7 @@ export default class AutofillService implements AutofillServiceInterface { let filledState = false; if (fillFields.state && identity.state && identity.state.length > 2) { const stateLower = identity.state.toLowerCase(); - const isoState = AutoFillConstants.IsoStates[stateLower] || AutoFillConstants.IsoProvinces[stateLower]; + const isoState = IdentityAutoFillConstants.IsoStates[stateLower] || IdentityAutoFillConstants.IsoProvinces[stateLower]; if (isoState) { filledState = true; this.makeScriptActionWithValue(fillScript, isoState, fillFields.state, filledFields); @@ -725,7 +725,7 @@ export default class AutofillService implements AutofillServiceInterface { let filledCountry = false; if (fillFields.country && identity.country && identity.country.length > 2) { const countryLower = identity.country.toLowerCase(); - const isoCountry = AutoFillConstants.IsoCountries[countryLower]; + const isoCountry = IdentityAutoFillConstants.IsoCountries[countryLower]; if (isoCountry) { filledCountry = true; this.makeScriptActionWithValue(fillScript, isoCountry, fillFields.country, filledFields); diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 5cb7e40686..5d2f171f4b 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -1,16 +1,4 @@ export class AutoFillConstants { - static readonly IdentityAttributes: string[] = [ - "autoCompleteType", - "data-stripe", - "htmlName", - "htmlID", - "label-tag", - "placeholder", - "label-left", - "label-top", - "data-recurly", - ]; - static readonly UsernameFieldNames: string[] = [ // English "username", @@ -32,6 +20,58 @@ export class AutoFillConstants { "benutzer id", ]; + static readonly ExcludedAutofillTypes: string[] = [ + "radio", + "checkbox", + "hidden", + "file", + "button", + "image", + "reset", + "search", + ]; + + static readonly OperationDelays = new Map([["buzzsprout.com", 100]]); +} + +export class CreditCardAutoFillConstants { + static readonly CardAttributes: string[] = [ + "autoCompleteType", + "data-stripe", + "htmlName", + "htmlID", + "label-tag", + "placeholder", + "label-left", + "label-top", + "data-recurly", + ]; + + static readonly CardAttributesExtended: string[] = [ + ...CreditCardAutoFillConstants.CardAttributes, + "label-right", + ]; + + // Each index represents a language. These three arrays should all be the same length. + // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese + static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; + static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"]; + static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"]; +} + +export class IdentityAutoFillConstants { + static readonly IdentityAttributes: string[] = [ + "autoCompleteType", + "data-stripe", + "htmlName", + "htmlID", + "label-tag", + "placeholder", + "label-left", + "label-top", + "data-recurly", + ]; + static readonly FirstnameFieldNames: string[] = [ // English "f-name", @@ -56,19 +96,6 @@ export class AutoFillConstants { "familienname", ]; - static readonly ExcludedAutofillTypes: string[] = [ - "radio", - "checkbox", - "hidden", - "file", - "button", - "image", - "reset", - "search", - ]; - - static readonly OperationDelays = new Map([["buzzsprout.com", 100]]); - static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", @@ -395,28 +422,3 @@ export class AutoFillConstants { saskatchewan: "SK", }; } - -export class CreditCardAutoFillConstants { - static readonly CardAttributes: string[] = [ - "autoCompleteType", - "data-stripe", - "htmlName", - "htmlID", - "label-tag", - "placeholder", - "label-left", - "label-top", - "data-recurly", - ]; - - static readonly CardAttributesExtended: string[] = [ - ...CreditCardAutoFillConstants.CardAttributes, - "label-right", - ]; - - // Each index represents a language. These three arrays should all be the same length. - // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese - static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; - static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"]; - static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"]; -} From 768f4b676cb564ffcd191c0b2c0ec8dbc31725ea Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:02:11 +0100 Subject: [PATCH 04/32] Removed unused OperationDelays constant --- src/services/autofillConstants.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 5d2f171f4b..c765b1a0fa 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -30,8 +30,6 @@ export class AutoFillConstants { "reset", "search", ]; - - static readonly OperationDelays = new Map([["buzzsprout.com", 100]]); } export class CreditCardAutoFillConstants { From 8992f348d2657059d3b69537f0d29c60e4339ddb Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:10:16 +0100 Subject: [PATCH 05/32] Move ExpiryMonth fieldnames to CC constants --- src/services/autofill.service.ts | 9 +------ src/services/autofillConstants.ts | 42 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 8ec9983d71..134c105635 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -403,14 +403,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.exp = f; break; } else if (!fillFields.expMonth && this.isFieldMatch(f[attr], - ['exp-month', 'cc-exp-month', 'cc-month', 'card-month', 'cc-mo', 'card-mo', 'exp-mo', - 'card-exp-mo', 'cc-exp-mo', 'card-expiration-month', 'expiration-month', - 'cc-mm', 'cc-m', 'card-mm', 'card-m', 'card-exp-mm', 'cc-exp-mm', 'exp-mm', 'exp-m', - 'expire-month', 'expire-mo', 'expiry-month', 'expiry-mo', 'card-expire-month', - 'card-expire-mo', 'card-expiry-month', 'card-expiry-mo', 'mois-validite', - 'mois-expiration', 'm-validite', 'm-expiration', 'expiry-date-field-month', - 'expiration-date-month', 'expiration-date-mm', 'exp-mon', 'validity-mo', - 'exp-date-mo', 'cb-date-mois', 'date-m'])) { + CreditCardAutoFillConstants.ExpiryMonthFieldNames)) { fillFields.expMonth = f; break; } else if (!fillFields.expYear && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index c765b1a0fa..996ab0f654 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -50,6 +50,48 @@ export class CreditCardAutoFillConstants { "label-right", ]; + static readonly ExpiryMonthFieldNames: string[] = [ + "exp-month", + "cc-exp-month", + "cc-month", + "card-month", + "cc-mo", + "card-mo", + "exp-mo", + "card-exp-mo", + "cc-exp-mo", + "card-expiration-month", + "expiration-month", + "cc-mm", + "cc-m", + "card-mm", + "card-m", + "card-exp-mm", + "cc-exp-mm", + "exp-mm", + "exp-m", + "expire-month", + "expire-mo", + "expiry-month", + "expiry-mo", + "card-expire-month", + "card-expire-mo", + "card-expiry-month", + "card-expiry-mo", + "mois-validite", + "mois-expiration", + "m-validite", + "m-expiration", + "expiry-date-field-month", + "expiration-date-month", + "expiration-date-mm", + "exp-mon", + "validity-mo", + "exp-date-mo", + "cb-date-mois", + "date-m", + ]; + // Each index represents a language. These three arrays should all be the same length. // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; From bb294ac792660c3d53defa2234d8a28bd97a622a Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:12:56 +0100 Subject: [PATCH 06/32] Move ExpiryYear fieldnames to CC constants --- src/services/autofill.service.ts | 9 +----- src/services/autofillConstants.ts | 46 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 134c105635..708b5f71c2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -407,14 +407,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.expMonth = f; break; } else if (!fillFields.expYear && this.isFieldMatch(f[attr], - ['exp-year', 'cc-exp-year', 'cc-year', 'card-year', 'cc-yr', 'card-yr', 'exp-yr', - 'card-exp-yr', 'cc-exp-yr', 'card-expiration-year', 'expiration-year', - 'cc-yy', 'cc-y', 'card-yy', 'card-y', 'card-exp-yy', 'cc-exp-yy', 'exp-yy', 'exp-y', - 'cc-yyyy', 'card-yyyy', 'card-exp-yyyy', 'cc-exp-yyyy', 'expire-year', 'expire-yr', - 'expiry-year', 'expiry-yr', 'card-expire-year', 'card-expire-yr', 'card-expiry-year', - 'card-expiry-yr', 'an-validite', 'an-expiration', 'annee-validite', - 'annee-expiration', 'expiry-date-field-year', 'expiration-date-year', 'cb-date-ann', - 'expiration-date-yy', 'expiration-date-yyyy', 'validity-year', 'exp-date-year', 'date-y'])) { + CreditCardAutoFillConstants.ExpiryYearFieldNames)) { fillFields.expYear = f; break; } else if (!fillFields.code && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 996ab0f654..88a6f2fe04 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -92,6 +92,52 @@ export class CreditCardAutoFillConstants { "date-m", ]; + static readonly ExpiryYearFieldNames: string[] = [ + "exp-year", + "cc-exp-year", + "cc-year", + "card-year", + "cc-yr", + "card-yr", + "exp-yr", + "card-exp-yr", + "cc-exp-yr", + "card-expiration-year", + "expiration-year", + "cc-yy", + "cc-y", + "card-yy", + "card-y", + "card-exp-yy", + "cc-exp-yy", + "exp-yy", + "exp-y", + "cc-yyyy", + "card-yyyy", + "card-exp-yyyy", + "cc-exp-yyyy", + "expire-year", + "expire-yr", + "expiry-year", + "expiry-yr", + "card-expire-year", + "card-expire-yr", + "card-expiry-year", + "card-expiry-yr", + "an-validite", + "an-expiration", + "annee-validite", + "annee-expiration", + "expiry-date-field-year", + "expiration-date-year", + "cb-date-ann", + "expiration-date-yy", + "expiration-date-yyyy", + "validity-year", + "exp-date-year", + "date-y", + ]; + // Each index represents a language. These three arrays should all be the same length. // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; From 7e5b50a6cbe31cfee5a914b949f42f4ead49ea19 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:16:27 +0100 Subject: [PATCH 07/32] Move CVV fieldnames to CC constants --- src/services/autofill.service.ts | 4 +--- src/services/autofillConstants.ts | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 708b5f71c2..1b2869b907 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -411,9 +411,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.expYear = f; break; } else if (!fillFields.code && this.isFieldMatch(f[attr], - ['cvv', 'cvc', 'cvv2', 'cc-csc', 'cc-cvv', 'card-csc', 'card-cvv', 'cvd', 'cid', 'cvc2', - 'cnv', 'cvn2', 'cc-code', 'card-code', 'code-securite', 'security-code', 'crypto', - 'card-verif', 'verification-code', 'csc', 'ccv'])) { + CreditCardAutoFillConstants.CVVFieldNames)) { fillFields.code = f; break; } else if (!fillFields.brand && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 88a6f2fe04..57dffded81 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -138,6 +138,30 @@ export class CreditCardAutoFillConstants { "date-y", ]; + static readonly CVVFieldNames: string[] = [ + "cvv", + "cvc", + "cvv2", + "cc-csc", + "cc-cvv", + "card-csc", + "card-cvv", + "cvd", + "cid", + "cvc2", + "cnv", + "cvn2", + "cc-code", + "card-code", + "code-securite", + "security-code", + "crypto", + "card-verif", + "verification-code", + "csc", + "ccv", + ]; + // Each index represents a language. These three arrays should all be the same length. // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; From 5c66dade4ad803eae04e2557e37f26aca32903e6 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:18:17 +0100 Subject: [PATCH 08/32] Move card brand fieldnames to CC constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 1b2869b907..92163308e2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -415,7 +415,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.code = f; break; } else if (!fillFields.brand && this.isFieldMatch(f[attr], - ['cc-type', 'card-type', 'card-brand', 'cc-brand', 'cb-type'])) { + CreditCardAutoFillConstants.CardBrandFieldNames)) { fillFields.brand = f; break; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 57dffded81..891ce79b36 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -162,6 +162,14 @@ export class CreditCardAutoFillConstants { "ccv", ]; + static readonly CardBrandFieldNames: string[] = [ + "cc-type", + "card-type", + "card-brand", + "cc-brand", + "cb-type", + ]; + // Each index represents a language. These three arrays should all be the same length. // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"]; From 729150d404e1783ae88e7e8539aed6ec8f7bb3d3 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:37:57 +0100 Subject: [PATCH 09/32] Move middle name fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 92163308e2..ce3797b94b 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -610,7 +610,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.firstName = f; break; } else if (!fillFields.middleName && this.isFieldMatch(f[attr], - ['m-name', 'middle-name', 'additional-name', 'middle-initial', 'middle-n', 'middle-i'])) { + IdentityAutoFillConstants.MiddlenameFieldNames)) { fillFields.middleName = f; break; } else if (!fillFields.lastName && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 891ce79b36..2aa3781b3b 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -200,6 +200,15 @@ export class IdentityAutoFillConstants { "vorname", ]; + static readonly MiddlenameFieldNames: string[] = [ + "m-name", + "middle-name", + "additional-name", + "middle-initial", + "middle-n", + "middle-i", + ]; + static readonly LastnameFieldNames: string[] = [ // English "l-name", From c45d1f8f7eb2c19bb17ac25f889d21c309dddac4 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:40:10 +0100 Subject: [PATCH 10/32] Move title fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index ce3797b94b..04697f22ec 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -618,7 +618,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.lastName = f; break; } else if (!fillFields.title && this.isFieldMatch(f[attr], - ['honorific-prefix', 'prefix', 'title'])) { + IdentityAutoFillConstants.TitleFieldNames)) { fillFields.title = f; break; } else if (!fillFields.email && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 2aa3781b3b..aa5d5ba0b4 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -190,6 +190,8 @@ export class IdentityAutoFillConstants { "data-recurly", ]; + static readonly TitleFieldNames: string[] = ["honorific-prefix", "prefix", "title"]; + static readonly FirstnameFieldNames: string[] = [ // English "f-name", From d25d5321840c1debe0a18b6b27c3f0f63418ac01 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:41:50 +0100 Subject: [PATCH 11/32] Move email fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 04697f22ec..80a53f80ad 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -622,7 +622,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.title = f; break; } else if (!fillFields.email && this.isFieldMatch(f[attr], - ['e-mail', 'email-address'])) { + IdentityAutoFillConstants.EmailFieldNames)) { fillFields.email = f; break; } else if (!fillFields.address && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index aa5d5ba0b4..7f5428cf9e 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -225,6 +225,8 @@ export class IdentityAutoFillConstants { "familienname", ]; + static readonly EmailFieldNames: string[] = ["e-mail", "email-address"]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From b2a3cd7feb9df22337f24b0e9c125d5102a7ca1e Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:43:46 +0100 Subject: [PATCH 12/32] Move address1 fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 80a53f80ad..0e59cc8c22 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -631,7 +631,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.address = f; break; } else if (!fillFields.address1 && this.isFieldMatch(f[attr], - ['address-1', 'address-line-1', 'addr-1', 'street-1'])) { + IdentityAutoFillConstants.Address1FieldNames)) { fillFields.address1 = f; break; } else if (!fillFields.address2 && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 7f5428cf9e..995aa0ca37 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -227,6 +227,13 @@ export class IdentityAutoFillConstants { static readonly EmailFieldNames: string[] = ["e-mail", "email-address"]; + static readonly Address1FieldNames: string[] = [ + "address-1", + "address-line-1", + "addr-1", + "street-1", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From e12b9ffa67d77ed8be02066bd6b7889bc479f8d9 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:46:54 +0100 Subject: [PATCH 13/32] Move address2 fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 0e59cc8c22..13435a2660 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -635,7 +635,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.address1 = f; break; } else if (!fillFields.address2 && this.isFieldMatch(f[attr], - ['address-2', 'address-line-2', 'addr-2', 'street-2'])) { + IdentityAutoFillConstants.Address2FieldNames)) { fillFields.address2 = f; break; } else if (!fillFields.address3 && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 995aa0ca37..cd1b30e20f 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -234,6 +234,13 @@ export class IdentityAutoFillConstants { "street-1", ]; + static readonly Address2FieldNames: string[] = [ + "address-2", + "address-line-2", + "addr-2", + "street-2", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From a880cf32e664e69675c8443ab60b45b06ab61692 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:47:12 +0100 Subject: [PATCH 14/32] Move address3 fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 13435a2660..2e734b53ff 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -639,7 +639,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.address2 = f; break; } else if (!fillFields.address3 && this.isFieldMatch(f[attr], - ['address-3', 'address-line-3', 'addr-3', 'street-3'])) { + IdentityAutoFillConstants.Address3FieldNames)) { fillFields.address3 = f; break; } else if (!fillFields.postalCode && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index cd1b30e20f..d541fc287f 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -241,6 +241,13 @@ export class IdentityAutoFillConstants { "street-2", ]; + static readonly Address3FieldNames: string[] = [ + "address-3", + "address-line-3", + "addr-3", + "street-3", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 6304964ad457631cd4f2df054b961d54f51a8414 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:49:10 +0100 Subject: [PATCH 15/32] Move postalCode fieldnames to Identity constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 2e734b53ff..10fe31f953 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -643,8 +643,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.address3 = f; break; } else if (!fillFields.postalCode && this.isFieldMatch(f[attr], - ['postal', 'zip', 'zip2', 'zip-code', 'postal-code', 'post-code', 'address-zip', - 'address-postal', 'address-code', 'address-postal-code', 'address-zip-code'])) { + IdentityAutoFillConstants.PostalCodeFieldNames)) { fillFields.postalCode = f; break; } else if (!fillFields.city && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index d541fc287f..811654cb5b 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -248,6 +248,20 @@ export class IdentityAutoFillConstants { "street-3", ]; + static readonly PostalCodeFieldNames: string[] = [ + "postal", + "zip", + "zip2", + "zip-code", + "postal-code", + "post-code", + "address-zip", + "address-postal", + "address-code", + "address-postal-code", + "address-zip-code", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 61dbe5421f8eee0183f1fdc32d82b4cabba37985 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:50:26 +0100 Subject: [PATCH 16/32] Move city fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 10fe31f953..1f27c782c1 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -647,7 +647,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.postalCode = f; break; } else if (!fillFields.city && this.isFieldMatch(f[attr], - ['city', 'town', 'address-level-2', 'address-city', 'address-town'])) { + IdentityAutoFillConstants.CityFieldNames)) { fillFields.city = f; break; } else if (!fillFields.state && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 811654cb5b..989ab02597 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -262,6 +262,14 @@ export class IdentityAutoFillConstants { "address-zip-code", ]; + static readonly CityFieldNames: string[] = [ + "city", + "town", + "address-level-2", + "address-city", + "address-town", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 4390989a880c617312b10701c6240897dce26224 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:51:34 +0100 Subject: [PATCH 17/32] Move state fieldnames to Identity constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 1f27c782c1..54b55f6746 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -651,8 +651,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.city = f; break; } else if (!fillFields.state && this.isFieldMatch(f[attr], - ['state', 'province', 'provence', 'address-level-1', 'address-state', - 'address-province'])) { + IdentityAutoFillConstants.StateFieldNames)) { fillFields.state = f; break; } else if (!fillFields.country && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 989ab02597..de2f00fa32 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -270,6 +270,15 @@ export class IdentityAutoFillConstants { "address-town", ]; + static readonly StateFieldNames: string[] = [ + "state", + "province", + "provence", + "address-level-1", + "address-state", + "address-province", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 423ef40aa1073861448aa1278e751a265588c423 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:52:52 +0100 Subject: [PATCH 18/32] Move country fieldnames to Identity constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 54b55f6746..17db08fce2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -655,8 +655,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.state = f; break; } else if (!fillFields.country && this.isFieldMatch(f[attr], - ['country', 'country-code', 'country-name', 'address-country', 'address-country-name', - 'address-country-code'])) { + IdentityAutoFillConstants.CountryFieldNames)) { fillFields.country = f; break; } else if (!fillFields.phone && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index de2f00fa32..c65cf7ffb1 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -279,6 +279,15 @@ export class IdentityAutoFillConstants { "address-province", ]; + static readonly CountryFieldNames: string[] = [ + "country", + "country-code", + "country-name", + "address-country", + "address-country-name", + "address-country-code", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From aeeb44e8c9ef2f8aae7057d721438c75590dade6 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:54:31 +0100 Subject: [PATCH 19/32] Move phone fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 17db08fce2..4439e87f02 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -659,7 +659,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.country = f; break; } else if (!fillFields.phone && this.isFieldMatch(f[attr], - ['phone', 'mobile', 'mobile-phone', 'tel', 'telephone', 'phone-number'])) { + IdentityAutoFillConstants.PhoneFieldNames)) { fillFields.phone = f; break; } else if (!fillFields.username && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index c65cf7ffb1..875a462b4f 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -288,6 +288,15 @@ export class IdentityAutoFillConstants { "address-country-code", ]; + static readonly PhoneFieldNames: string[] = [ + "phone", + "mobile", + "mobile-phone", + "tel", + "telephone", + "phone-number", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 0a1b0f5eb9e8cecfd45eba460d7335acc0b252b2 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:56:01 +0100 Subject: [PATCH 20/32] Move username fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 4439e87f02..20096a0bd7 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -663,7 +663,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.phone = f; break; } else if (!fillFields.username && this.isFieldMatch(f[attr], - ['user-name', 'user-id', 'screen-name'])) { + IdentityAutoFillConstants.UserNameFieldNames)) { fillFields.username = f; break; } else if (!fillFields.company && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 875a462b4f..6b6c387936 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -297,6 +297,8 @@ export class IdentityAutoFillConstants { "phone-number", ]; + static readonly UserNameFieldNames: string[] = ["user-name", "user-id", "screen-name"]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 8f889310c2b53a84a640be5f4539d6d10698a8a1 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:57:12 +0100 Subject: [PATCH 21/32] Move company fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 20096a0bd7..a03562f75a 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -667,7 +667,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.username = f; break; } else if (!fillFields.company && this.isFieldMatch(f[attr], - ['company', 'company-name', 'organization', 'organization-name'])) { + IdentityAutoFillConstants.CompanyFieldNames)) { fillFields.company = f; break; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 6b6c387936..c586dfeafe 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -299,6 +299,13 @@ export class IdentityAutoFillConstants { static readonly UserNameFieldNames: string[] = ["user-name", "user-id", "screen-name"]; + static readonly CompanyFieldNames: string[] = [ + "company", + "company-name", + "organization", + "organization-name", + ]; + static readonly IsoCountries: { [id: string]: string } = { afghanistan: "AF", "aland islands": "AX", From 9e350e25ce988d523b5e39fb3dce8f9a3ed5c085 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:41:52 +0100 Subject: [PATCH 22/32] Move fullname fieldnames to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index a03562f75a..be65fbdcd2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -602,7 +602,7 @@ export default class AutofillService implements AutofillServiceInterface { // ref https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill // ref https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ if (!fillFields.name && this.isFieldMatch(f[attr], - ['name', 'full-name', 'your-name'], ['full-name', 'your-name'])) { + IdentityAutoFillConstants.FullNameFieldNames, ['full-name', 'your-name'])) { fillFields.name = f; break; } else if (!fillFields.firstName && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index c586dfeafe..0ef5295be9 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -190,6 +190,8 @@ export class IdentityAutoFillConstants { "data-recurly", ]; + static readonly FullNameFieldNames: string[] = ["name", "full-name", "your-name"]; + static readonly TitleFieldNames: string[] = ["honorific-prefix", "prefix", "title"]; static readonly FirstnameFieldNames: string[] = [ From ff6e63a335de27452478304f26f7789f55e6467d Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:42:39 +0100 Subject: [PATCH 23/32] Move address fieldnames to Identity constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index be65fbdcd2..778ee443e5 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -626,8 +626,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.email = f; break; } else if (!fillFields.address && this.isFieldMatch(f[attr], - ['address', 'street-address', 'addr', 'street', 'mailing-addr', 'billing-addr', - 'mail-addr', 'bill-addr'], ['mailing-addr', 'billing-addr', 'mail-addr', 'bill-addr'])) { + IdentityAutoFillConstants.AddressFieldNames, ['mailing-addr', 'billing-addr', 'mail-addr', 'bill-addr'])) { fillFields.address = f; break; } else if (!fillFields.address1 && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 0ef5295be9..b8a1a26d50 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -229,6 +229,17 @@ export class IdentityAutoFillConstants { static readonly EmailFieldNames: string[] = ["e-mail", "email-address"]; + static readonly AddressFieldNames: string[] = [ + "address", + "street-address", + "addr", + "street", + "mailing-addr", + "billing-addr", + "mail-addr", + "bill-addr", + ]; + static readonly Address1FieldNames: string[] = [ "address-1", "address-line-1", From 37948db8998aeefe02240f6a3d18ae08475ee453 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:43:29 +0100 Subject: [PATCH 24/32] Move cardholder fieldnames to CC constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 778ee443e5..fc925e9cde 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -382,7 +382,7 @@ export default class AutofillService implements AutofillServiceInterface { // ref https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill // ref https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ if (!fillFields.cardholderName && this.isFieldMatch(f[attr], - ['cc-name', 'card-name', 'cardholder-name', 'cardholder', 'name', 'nom'], + CreditCardAutoFillConstants.CardHolderFieldNames, ['cc-name', 'card-name', 'cardholder-name', 'cardholder', 'tbName'])) { fillFields.cardholderName = f; break; diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index b8a1a26d50..75d0b5d8a6 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -50,6 +50,15 @@ export class CreditCardAutoFillConstants { "label-right", ]; + static readonly CardHolderFieldNames: string[] = [ + "cc-name", + "card-name", + "cardholder-name", + "cardholder", + "name", + "nom", + ]; + static readonly ExpiryMonthFieldNames: string[] = [ "exp-month", "cc-exp-month", From ec60979ee219cd8bafcb3a8375f15daec65abaf4 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:44:19 +0100 Subject: [PATCH 25/32] Move cardNumber fieldnames to CC constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index fc925e9cde..a49a06f137 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -387,8 +387,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.cardholderName = f; break; } else if (!fillFields.number && this.isFieldMatch(f[attr], - ['cc-number', 'cc-num', 'card-number', 'card-num', 'number', 'cc', 'cc-no', 'card-no', - 'credit-card', 'numero-carte', 'carte', 'carte-credit', 'num-carte', 'cb-num'], + CreditCardAutoFillConstants.CardNumberFieldNames, ['cc-number', 'cc-num', 'card-number', 'card-num', 'cc-no', 'card-no', 'numero-carte', 'num-carte', 'cb-num'])) { fillFields.number = f; diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 75d0b5d8a6..7940f2e080 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -59,6 +59,23 @@ export class CreditCardAutoFillConstants { "nom", ]; + static readonly CardNumberFieldNames: string[] = [ + "cc-number", + "cc-num", + "card-number", + "card-num", + "number", + "cc", + "cc-no", + "card-no", + "credit-card", + "numero-carte", + "carte", + "carte-credit", + "num-carte", + "cb-num", + ]; + static readonly ExpiryMonthFieldNames: string[] = [ "exp-month", "cc-exp-month", From 4e274c2f4414eb6f96385b133476431af9699cb1 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:44:57 +0100 Subject: [PATCH 26/32] Move card expiry fieldnames to CC constants --- src/services/autofill.service.ts | 5 +---- src/services/autofillConstants.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index a49a06f137..b893e3ceec 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -393,10 +393,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.number = f; break; } else if (!fillFields.exp && this.isFieldMatch(f[attr], - ['cc-exp', 'card-exp', 'cc-expiration', 'card-expiration', 'cc-ex', 'card-ex', - 'card-expire', 'card-expiry', 'validite', 'expiration', 'expiry', 'mm-yy', - 'mm-yyyy', 'yy-mm', 'yyyy-mm', 'expiration-date', 'payment-card-expiration', - 'payment-cc-date'], + CreditCardAutoFillConstants.CardExpiryFieldNames, ['mm-yy', 'mm-yyyy', 'yy-mm', 'yyyy-mm', 'expiration-date', 'payment-card-expiration'])) { fillFields.exp = f; diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 7940f2e080..6e1f87b4b7 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -76,6 +76,27 @@ export class CreditCardAutoFillConstants { "cb-num", ]; + static readonly CardExpiryFieldNames: string[] = [ + "cc-exp", + "card-exp", + "cc-expiration", + "card-expiration", + "cc-ex", + "card-ex", + "card-expire", + "card-expiry", + "validite", + "expiration", + "expiry", + "mm-yy", + "mm-yyyy", + "yy-mm", + "yyyy-mm", + "expiration-date", + "payment-card-expiration", + "payment-cc-date", + ]; + static readonly ExpiryMonthFieldNames: string[] = [ "exp-month", "cc-exp-month", From 643fc171513f060746d7ba9560e2f3dca70449a8 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:49:37 +0100 Subject: [PATCH 27/32] Move pasword field ignore list to AutoFillConstants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index b893e3ceec..8e897403df 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -834,8 +834,7 @@ export default class AutofillService implements AutofillServiceInterface { return false; } - const ignoreList = ['onetimepassword', 'captcha', 'findanything', 'forgot']; - if (ignoreList.some(i => cleanedValue.indexOf(i) > -1)) { + if (AutoFillConstants.PasswordFieldIgnoreList.some(i => cleanedValue.indexOf(i) > -1)) { return false; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 6e1f87b4b7..f474f4e71d 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -20,6 +20,13 @@ export class AutoFillConstants { "benutzer id", ]; + static readonly PasswordFieldIgnoreList: string[] = [ + "onetimepassword", + "captcha", + "findanything", + "forgot", + ]; + static readonly ExcludedAutofillTypes: string[] = [ "radio", "checkbox", From 3bfddd004345b28eea74298cb1d562c0d87367a0 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 16:09:28 +0100 Subject: [PATCH 28/32] Move cardholder containsOptions to CC constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 8e897403df..65fbf217a9 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -383,7 +383,7 @@ export default class AutofillService implements AutofillServiceInterface { // ref https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ if (!fillFields.cardholderName && this.isFieldMatch(f[attr], CreditCardAutoFillConstants.CardHolderFieldNames, - ['cc-name', 'card-name', 'cardholder-name', 'cardholder', 'tbName'])) { + CreditCardAutoFillConstants.CardHolderFieldNameValues)) { fillFields.cardholderName = f; break; } else if (!fillFields.number && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index f474f4e71d..1fdbf69807 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -66,6 +66,14 @@ export class CreditCardAutoFillConstants { "nom", ]; + static readonly CardHolderFieldNameValues: string[] = [ + "cc-name", + "card-name", + "cardholder-name", + "cardholder", + "tbName", + ]; + static readonly CardNumberFieldNames: string[] = [ "cc-number", "cc-num", From c0134e27766cfcb15150e6cec37625625fc30cbe Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 16:13:04 +0100 Subject: [PATCH 29/32] Move cardnumber containsOptions to CC constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 65fbf217a9..1e7e529091 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -388,8 +388,7 @@ export default class AutofillService implements AutofillServiceInterface { break; } else if (!fillFields.number && this.isFieldMatch(f[attr], CreditCardAutoFillConstants.CardNumberFieldNames, - ['cc-number', 'cc-num', 'card-number', 'card-num', 'cc-no', 'card-no', 'numero-carte', - 'num-carte', 'cb-num'])) { + CreditCardAutoFillConstants.CardNumberFieldNameValues)) { fillFields.number = f; break; } else if (!fillFields.exp && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 1fdbf69807..a969c1e8d0 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -91,6 +91,18 @@ export class CreditCardAutoFillConstants { "cb-num", ]; + static readonly CardNumberFieldNameValues: string[] = [ + "cc-number", + "cc-num", + "card-number", + "card-num", + "cc-no", + "card-no", + "numero-carte", + "num-carte", + "cb-num", + ]; + static readonly CardExpiryFieldNames: string[] = [ "cc-exp", "card-exp", From 306b7e38c3a846922c8f42236dfc3665321071ea Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 16:13:32 +0100 Subject: [PATCH 30/32] Move cardExpiry containsOptions to CC constants --- src/services/autofill.service.ts | 3 +-- src/services/autofillConstants.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 1e7e529091..6962322eba 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -393,8 +393,7 @@ export default class AutofillService implements AutofillServiceInterface { break; } else if (!fillFields.exp && this.isFieldMatch(f[attr], CreditCardAutoFillConstants.CardExpiryFieldNames, - ['mm-yy', 'mm-yyyy', 'yy-mm', 'yyyy-mm', 'expiration-date', - 'payment-card-expiration'])) { + CreditCardAutoFillConstants.CardExpiryFieldNameValues)) { fillFields.exp = f; break; } else if (!fillFields.expMonth && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index a969c1e8d0..2627affaad 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -124,6 +124,15 @@ export class CreditCardAutoFillConstants { "payment-cc-date", ]; + static readonly CardExpiryFieldNameValues: string[] = [ + "mm-yy", + "mm-yyyy", + "yy-mm", + "yyyy-mm", + "expiration-date", + "payment-card-expiration", + ]; + static readonly ExpiryMonthFieldNames: string[] = [ "exp-month", "cc-exp-month", From 30f7e297731ee5f1c555ad00609e8589f518292d Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 16:15:52 +0100 Subject: [PATCH 31/32] Move fullname containsOptions to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 6962322eba..5ae0cf95c1 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -596,7 +596,7 @@ export default class AutofillService implements AutofillServiceInterface { // ref https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill // ref https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ if (!fillFields.name && this.isFieldMatch(f[attr], - IdentityAutoFillConstants.FullNameFieldNames, ['full-name', 'your-name'])) { + IdentityAutoFillConstants.FullNameFieldNames, IdentityAutoFillConstants.FullNameFieldNameValues)) { fillFields.name = f; break; } else if (!fillFields.firstName && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 2627affaad..b24c2c46f8 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -275,6 +275,8 @@ export class IdentityAutoFillConstants { static readonly FullNameFieldNames: string[] = ["name", "full-name", "your-name"]; + static readonly FullNameFieldNameValues: string[] = ["full-name", "your-name"]; + static readonly TitleFieldNames: string[] = ["honorific-prefix", "prefix", "title"]; static readonly FirstnameFieldNames: string[] = [ From bc3de6e11501bd3605fefba3bed2af00b0a3207b Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 16:16:10 +0100 Subject: [PATCH 32/32] Move address containsOptions to Identity constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 5ae0cf95c1..b9642ebdef 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -620,7 +620,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.email = f; break; } else if (!fillFields.address && this.isFieldMatch(f[attr], - IdentityAutoFillConstants.AddressFieldNames, ['mailing-addr', 'billing-addr', 'mail-addr', 'bill-addr'])) { + IdentityAutoFillConstants.AddressFieldNames, IdentityAutoFillConstants.AddressFieldNameValues)) { fillFields.address = f; break; } else if (!fillFields.address1 && this.isFieldMatch(f[attr], diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index b24c2c46f8..94b54a7150 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -325,6 +325,13 @@ export class IdentityAutoFillConstants { "bill-addr", ]; + static readonly AddressFieldNameValues: string[] = [ + "mailing-addr", + "billing-addr", + "mail-addr", + "bill-addr", + ]; + static readonly Address1FieldNames: string[] = [ "address-1", "address-line-1",