Move state fieldnames to Identity constants

This commit is contained in:
Daniel James Smith 2022-01-02 14:51:34 +01:00
parent 61dbe5421f
commit 4390989a88
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726
2 changed files with 10 additions and 2 deletions

View File

@ -651,8 +651,7 @@ export default class AutofillService implements AutofillServiceInterface {
fillFields.city = f; fillFields.city = f;
break; break;
} else if (!fillFields.state && this.isFieldMatch(f[attr], } else if (!fillFields.state && this.isFieldMatch(f[attr],
['state', 'province', 'provence', 'address-level-1', 'address-state', IdentityAutoFillConstants.StateFieldNames)) {
'address-province'])) {
fillFields.state = f; fillFields.state = f;
break; break;
} else if (!fillFields.country && this.isFieldMatch(f[attr], } else if (!fillFields.country && this.isFieldMatch(f[attr],

View File

@ -270,6 +270,15 @@ export class IdentityAutoFillConstants {
"address-town", "address-town",
]; ];
static readonly StateFieldNames: string[] = [
"state",
"province",
"provence",
"address-level-1",
"address-state",
"address-province",
];
static readonly IsoCountries: { [id: string]: string } = { static readonly IsoCountries: { [id: string]: string } = {
afghanistan: "AF", afghanistan: "AF",
"aland islands": "AX", "aland islands": "AX",