Skip to content

Commit

Permalink
feat: Open contact inline menu when id card number field
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Jul 22, 2024
1 parent 0c93819 commit 214755b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ export interface InlineMenuFieldQualificationService {
isFieldForIdentityPhone(field: AutofillField): boolean;
isFieldForIdentityEmail(field: AutofillField): boolean;
isFieldForIdentityUsername(field: AutofillField): boolean;
// Cozy customization
isFieldForPaperIdentityCardNumber(field: AutofillField): boolean;
// Cozy customization end
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
this.inlineMenuFieldQualificationService.isFieldForIdentityEmail,
[AutofillFieldQualifier.identityUsername]:
this.inlineMenuFieldQualificationService.isFieldForIdentityUsername,
// Cozy customization
[AutofillFieldQualifier.paperIdentityCardNumber]:
this.inlineMenuFieldQualificationService.isFieldForPaperIdentityCardNumber,
// Cozy customization end
};

constructor(private inlineMenuFieldQualificationService: InlineMenuFieldQualificationService) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
AutoFillConstants,
CreditCardAutoFillConstants,
IdentityAutoFillConstants,
PaperAutoFillConstants,
} from "./autofill-constants";

export class InlineMenuFieldQualificationService
Expand Down Expand Up @@ -137,6 +138,9 @@ export class InlineMenuFieldQualificationService
...IdentityAutoFillConstants.PhoneFieldNames,
...IdentityAutoFillConstants.EmailFieldNames,
...IdentityAutoFillConstants.UserNameFieldNames,
// Cozy customization
...PaperAutoFillConstants.IdentityCardNumberFieldNames,
// Cozy customization end
]),
];
private inlineMenuFieldQualificationFlagSet = false;
Expand Down Expand Up @@ -825,6 +829,26 @@ export class InlineMenuFieldQualificationService
);
};

// Cozy customization

/**
* Validates the provided field as an identity username field.
*
* @param field - The field to validate
*/
isFieldForPaperIdentityCardNumber = (field: AutofillField): boolean => {
return (
!this.fieldContainsAutocompleteValues(field, this.autocompleteDisabledValues) &&
this.keywordsFoundInFieldData(
field,
PaperAutoFillConstants.IdentityCardNumberFieldNames,
false,
)
);
};

// Cozy customization end

/**
* Validates the provided field as a username field.
*
Expand Down

0 comments on commit 214755b

Please sign in to comment.