Skip to content

Commit

Permalink
reorder address field identification (#11824)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Bassler <[email protected]>
Co-authored-by: Matt Bishop <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2024
1 parent a415679 commit c1302a3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions apps/browser/src/autofill/services/autofill.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,16 +1597,6 @@ export default class AutofillService implements AutofillServiceInterface {
) {
fillFields.email = f;
break;
} else if (
!fillFields.address &&
AutofillService.isFieldMatch(
f[attr],
IdentityAutoFillConstants.AddressFieldNames,
IdentityAutoFillConstants.AddressFieldNameValues,
)
) {
fillFields.address = f;
break;
} else if (
!fillFields.address1 &&
AutofillService.isFieldMatch(f[attr], IdentityAutoFillConstants.Address1FieldNames)
Expand All @@ -1625,6 +1615,16 @@ export default class AutofillService implements AutofillServiceInterface {
) {
fillFields.address3 = f;
break;
} else if (
!fillFields.address &&
AutofillService.isFieldMatch(
f[attr],
IdentityAutoFillConstants.AddressFieldNames,
IdentityAutoFillConstants.AddressFieldNameValues,
)
) {
fillFields.address = f;
break;
} else if (
!fillFields.postalCode &&
AutofillService.isFieldMatch(f[attr], IdentityAutoFillConstants.PostalCodeFieldNames)
Expand Down Expand Up @@ -1818,11 +1818,6 @@ export default class AutofillService implements AutofillServiceInterface {
continue;
}

if (this.shouldMakeIdentityAddressFillScript(filledFields, keywordsList)) {
this.makeIdentityAddressFillScript(fillScript, filledFields, field, identity);
continue;
}

if (this.shouldMakeIdentityAddress1FillScript(filledFields, keywordsCombined)) {
this.makeScriptActionWithValue(fillScript, identity.address1, field, filledFields);
continue;
Expand All @@ -1838,6 +1833,11 @@ export default class AutofillService implements AutofillServiceInterface {
continue;
}

if (this.shouldMakeIdentityAddressFillScript(filledFields, keywordsList)) {
this.makeIdentityAddressFillScript(fillScript, filledFields, field, identity);
continue;
}

if (this.shouldMakeIdentityPostalCodeFillScript(filledFields, keywordsCombined)) {
this.makeScriptActionWithValue(fillScript, identity.postalCode, field, filledFields);
continue;
Expand Down

0 comments on commit c1302a3

Please sign in to comment.