From 37948db8998aeefe02240f6a3d18ae08475ee453 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 15:43:29 +0100 Subject: [PATCH] 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",