mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
[PM-10550] Card inline menu not displayed on popup payment form (#10380)
* [PM-10550] Card inline menu not displayed on popup payment form * [PM-10550] Removing requirement for autocomplete to be "off" for identity fields when matching inline menu presentation
This commit is contained in:
parent
76351ce750
commit
032c013dd7
@ -209,10 +209,7 @@ export class InlineMenuFieldQualificationService
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, this.creditCardFieldKeywords)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, this.creditCardFieldKeywords);
|
||||
}
|
||||
|
||||
// If the field has a parent form, check the fields from that form exclusively
|
||||
@ -232,10 +229,7 @@ export class InlineMenuFieldQualificationService
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, [...this.creditCardFieldKeywords])
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, [...this.creditCardFieldKeywords]);
|
||||
}
|
||||
|
||||
/** Validates the provided field as a field for an account creation form.
|
||||
@ -264,10 +258,7 @@ export class InlineMenuFieldQualificationService
|
||||
|
||||
// If no password fields are found on the page, check for keywords that indicate the field is
|
||||
// part of an account creation form.
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, this.accountCreationFieldKeywords)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, this.accountCreationFieldKeywords);
|
||||
}
|
||||
|
||||
// If the field has a parent form, check the fields from that form exclusively
|
||||
@ -277,10 +268,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, this.accountCreationFieldKeywords)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, this.accountCreationFieldKeywords);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,10 +286,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, this.identityFieldKeywords)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, this.identityFieldKeywords);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,9 +465,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.CardHolderFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
CreditCardAutoFillConstants.CardHolderFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -496,9 +482,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.CardNumberFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
CreditCardAutoFillConstants.CardNumberFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -514,9 +501,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.CardExpiryFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
CreditCardAutoFillConstants.CardExpiryFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -532,9 +520,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.ExpiryMonthFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
CreditCardAutoFillConstants.ExpiryMonthFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -550,9 +539,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.ExpiryYearFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
CreditCardAutoFillConstants.ExpiryYearFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -566,10 +556,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.CVVFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, CreditCardAutoFillConstants.CVVFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -584,10 +571,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.TitleFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.TitleFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -600,9 +584,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.FirstnameFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.FirstnameFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -616,9 +601,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.MiddlenameFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.MiddlenameFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -632,9 +618,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.LastnameFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.LastnameFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -648,9 +635,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.FullNameFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.FullNameFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -664,16 +652,13 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(
|
||||
field,
|
||||
[
|
||||
...IdentityAutoFillConstants.AddressFieldNames,
|
||||
...IdentityAutoFillConstants.Address1FieldNames,
|
||||
],
|
||||
false,
|
||||
)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
[
|
||||
...IdentityAutoFillConstants.AddressFieldNames,
|
||||
...IdentityAutoFillConstants.Address1FieldNames,
|
||||
],
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -687,9 +672,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.Address2FieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.Address2FieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -703,9 +689,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.Address3FieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.Address3FieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -719,10 +706,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CityFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CityFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -735,10 +719,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.StateFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.StateFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -751,9 +732,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.PostalCodeFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.PostalCodeFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -767,10 +749,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CountryFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CountryFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -783,10 +762,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CompanyFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.CompanyFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -799,10 +775,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.PhoneFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.PhoneFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -818,10 +791,7 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.EmailFieldNames, false)
|
||||
);
|
||||
return this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.EmailFieldNames, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -834,9 +804,10 @@ export class InlineMenuFieldQualificationService
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
|
||||
this.keywordsFoundInFieldData(field, IdentityAutoFillConstants.UserNameFieldNames, false)
|
||||
return this.keywordsFoundInFieldData(
|
||||
field,
|
||||
IdentityAutoFillConstants.UserNameFieldNames,
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
@ -1039,11 +1010,13 @@ export class InlineMenuFieldQualificationService
|
||||
fuzzyMatchKeywords = true,
|
||||
) {
|
||||
const searchedValues = this.getAutofillFieldDataKeywords(autofillFieldData, fuzzyMatchKeywords);
|
||||
const parsedKeywords = keywords.map((keyword) => keyword.replace(/-/g, ""));
|
||||
|
||||
if (typeof searchedValues === "string") {
|
||||
return keywords.some((keyword) => searchedValues.indexOf(keyword) > -1);
|
||||
return parsedKeywords.some((keyword) => searchedValues.indexOf(keyword) > -1);
|
||||
}
|
||||
|
||||
return keywords.some((keyword) => searchedValues.has(keyword));
|
||||
return parsedKeywords.some((keyword) => searchedValues.has(keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1057,7 +1030,7 @@ export class InlineMenuFieldQualificationService
|
||||
returnStringValue: boolean,
|
||||
) {
|
||||
if (!this.autofillFieldKeywordsMap.has(autofillFieldData)) {
|
||||
const keywordsSet = new Set<string>([
|
||||
const keywords = [
|
||||
autofillFieldData.htmlID,
|
||||
autofillFieldData.htmlName,
|
||||
autofillFieldData.htmlClass,
|
||||
@ -1071,8 +1044,20 @@ export class InlineMenuFieldQualificationService
|
||||
autofillFieldData["label-right"],
|
||||
autofillFieldData["label-tag"],
|
||||
autofillFieldData["label-top"],
|
||||
]);
|
||||
const stringValue = Array.from(keywordsSet).join(",").toLowerCase();
|
||||
];
|
||||
const keywordsSet = new Set<string>();
|
||||
for (let i = 0; i < keywords.length; i++) {
|
||||
if (typeof keywords[i] === "string") {
|
||||
keywords[i]
|
||||
.toLowerCase()
|
||||
.replace(/-/g, "")
|
||||
.replace(/[^a-zA-Z0-9]+/g, "|")
|
||||
.split("|")
|
||||
.forEach((keyword) => keywordsSet.add(keyword));
|
||||
}
|
||||
}
|
||||
|
||||
const stringValue = Array.from(keywordsSet).join(",");
|
||||
this.autofillFieldKeywordsMap.set(autofillFieldData, { keywordsSet, stringValue });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user