@adyen/kyc-components 2.25.2 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/es/adyen-kyc-components.es.js +2230 -2040
  2. package/dist/style.css +446 -665
  3. package/dist/types/components/Company/rules.d.ts +0 -3
  4. package/dist/types/components/CompanyLookup/component/CompanyLookupComponent.d.ts +1 -1
  5. package/dist/types/components/CompanyOtherDetails/validate.d.ts +4 -3
  6. package/dist/types/components/Dropins/ServiceAgreementDropinComponent/components/useServiceAgreement.d.ts +2 -2
  7. package/dist/types/components/IdentityNumber/formats.d.ts +2 -2
  8. package/dist/types/components/Individual/rules.d.ts +0 -1
  9. package/dist/types/components/PayoutVerificationMethod/component/AccountHolderDescriptionFragment.d.ts +7 -0
  10. package/dist/types/components/PayoutVerificationMethod/types.d.ts +2 -2
  11. package/dist/types/components/PersonalDetails/component/IdentityComponent/identityUS/component/IdentityUSComponent.d.ts +1 -1
  12. package/dist/types/components/PersonalDetails/component/labels.d.ts +1 -1
  13. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  14. package/dist/types/components/internal/BusinessRegistrationNumber/fieldConfig.d.ts +12 -0
  15. package/dist/types/components/internal/BusinessRegistrationNumber/types.d.ts +5 -5
  16. package/dist/types/components/internal/ContractViewer/ContractViewer.d.ts +1 -0
  17. package/dist/types/components/internal/ContractViewer/types.d.ts +4 -90
  18. package/dist/types/components/internal/FormFields/InputBase.d.ts +1 -1
  19. package/dist/types/components/internal/FormFields/InputText.d.ts +1 -1
  20. package/dist/types/components/internal/FormFields/MaskedInputText/MaskedInputText.d.ts +22 -0
  21. package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts +1 -1
  22. package/dist/types/components/internal/IdFieldTypeSelector/CompanyRegistrationNumberTypeSelector.d.ts +11 -0
  23. package/dist/types/components/internal/IdFieldTypeSelector/IndividualIdNumberTypeSelector.d.ts +9 -0
  24. package/dist/types/components/internal/IdFieldTypeSelector/VatNumberTypeSelector.d.ts +9 -0
  25. package/dist/types/components/internal/IdFieldTypeSelector/countryIdNumberTypes.d.ts +90 -5
  26. package/dist/types/components/internal/VatNumber/types.d.ts +1 -6
  27. package/dist/types/components/internal/VatNumber/vatNumberValidation.d.ts +2 -3
  28. package/dist/types/core/hooks/useCompanySearch/types.d.ts +2 -7
  29. package/dist/types/core/hooks/useForm/types.d.ts +5 -4
  30. package/dist/types/core/models/country-config.d.ts +7 -5
  31. package/dist/types/core/models/field-configurations.d.ts +5 -3
  32. package/dist/types/language/config.d.ts +27 -26
  33. package/dist/types/utils/entity-status-util.d.ts +1 -1
  34. package/dist/types/utils/formUtils.d.ts +6 -7
  35. package/dist/types/utils/makeArrayOfRepeatedObjects.d.ts +1 -0
  36. package/dist/types/utils/mapping/documentGuidanceMap.d.ts +1 -1
  37. package/dist/types/utils/masking/displayValueToPureValue.d.ts +10 -0
  38. package/dist/types/utils/masking/maskHelpers.d.ts +6 -0
  39. package/dist/types/utils/masking/masks/businessRegistrationNumberMasks.d.ts +256 -0
  40. package/dist/types/utils/masking/masks/vatNumberMasks.d.ts +4 -0
  41. package/dist/types/utils/masking/matchAgainstMask.d.ts +28 -0
  42. package/dist/types/utils/masking/transformers/types.d.ts +1 -0
  43. package/dist/types/utils/masking/transformers/uppercase.d.ts +2 -0
  44. package/dist/types/utils/perCountry.d.ts +5 -0
  45. package/dist/types/utils/regex/basePatterns.d.ts +1 -2
  46. package/dist/types/utils/regex/businessRegistrationNumberPatterns.d.ts +160 -2
  47. package/dist/types/utils/regex/countryIdNumberPatterns.d.ts +3 -2
  48. package/dist/types/utils/regex/index.d.ts +0 -3
  49. package/dist/types/utils/regex/patternValidators.d.ts +3 -0
  50. package/dist/types/utils/regex/vatNumberPatterns.d.ts +5 -4
  51. package/dist/types/utils/sanitizeHtml.d.ts +3 -0
  52. package/package.json +6 -4
  53. package/dist/types/components/internal/BusinessRegistrationNumber/formatters.d.ts +0 -4
  54. package/dist/types/components/internal/BusinessRegistrationNumber/validate.d.ts +0 -21
  55. package/dist/types/components/internal/BusinessRegistrationNumberField/validate.d.ts +0 -21
  56. package/dist/types/components/internal/ContractViewer/ReferenceContext/ReferenceContext.d.ts +0 -10
  57. package/dist/types/components/internal/ContractViewer/ReferenceContext/ReferenceContextProvider.d.ts +0 -6
  58. package/dist/types/components/internal/ContractViewer/ReferenceContext/useReferenceContext.d.ts +0 -1
  59. package/dist/types/components/internal/ContractViewer/components/Chapter/Chapter.d.ts +0 -2
  60. package/dist/types/components/internal/ContractViewer/components/ContentElements/ContentElements.d.ts +0 -2
  61. package/dist/types/components/internal/ContractViewer/components/InternalReference/InternalReference.d.ts +0 -2
  62. package/dist/types/components/internal/ContractViewer/components/List/List.d.ts +0 -2
  63. package/dist/types/components/internal/ContractViewer/components/Paragraph/Paragraph.d.ts +0 -3
  64. package/dist/types/components/internal/ContractViewer/components/Section/Section.d.ts +0 -3
  65. package/dist/types/components/internal/ContractViewer/components/Table/Table.d.ts +0 -3
  66. package/dist/types/components/internal/ContractViewer/components/Text/Text.d.ts +0 -3
  67. package/dist/types/components/internal/ContractViewer/components/Weblink/Weblink.d.ts +0 -3
  68. package/dist/types/components/internal/ContractViewer/utils/format-id.d.ts +0 -1
  69. package/dist/types/components/internal/IdFieldTypeSelector/IdFieldTypeSelector.d.ts +0 -2
  70. package/dist/types/components/internal/IdFieldTypeSelector/types.d.ts +0 -20
  71. package/dist/types/utils/delay.d.ts +0 -1
  72. package/dist/types/utils/escapeHtml.d.ts +0 -3
  73. package/dist/types/utils/regex/customRegistrationNumberPatterns.d.ts +0 -2
  74. package/dist/types/utils/regex/trustRegistrationNumberPatterns.d.ts +0 -2
  75. package/dist/types/utils/regex/types.d.ts +0 -39
@@ -1,2 +1,160 @@
1
- import type { CountryAndCompanyRegexValidation } from './types';
2
- export declare const businessRegistrationNumberPatterns: CountryAndCompanyRegexValidation;
1
+ export declare const businessRegistrationNumberPatterns: {
2
+ AU: {
3
+ default: RegExp;
4
+ };
5
+ AT: {
6
+ firmenbuchnummer: RegExp;
7
+ ZVR: RegExp;
8
+ };
9
+ BE: {
10
+ default: RegExp;
11
+ };
12
+ BR: {
13
+ default: RegExp;
14
+ };
15
+ BG: {
16
+ default: RegExp;
17
+ };
18
+ CA: {
19
+ default: RegExp;
20
+ };
21
+ HR: {
22
+ default: RegExp;
23
+ soleProprietorship: RegExp;
24
+ };
25
+ CY: {
26
+ default: RegExp;
27
+ };
28
+ CZ: {
29
+ default: RegExp;
30
+ };
31
+ DK: {
32
+ default: RegExp;
33
+ };
34
+ EE: {
35
+ default: RegExp;
36
+ };
37
+ FI: {
38
+ default: RegExp;
39
+ };
40
+ FR: {
41
+ SIRET: RegExp;
42
+ RNA: RegExp;
43
+ };
44
+ GI: {
45
+ default: RegExp;
46
+ };
47
+ DE: {
48
+ default: RegExp;
49
+ };
50
+ GR: {
51
+ default: RegExp;
52
+ };
53
+ GG: {
54
+ default: RegExp;
55
+ };
56
+ HK: {
57
+ default: RegExp;
58
+ };
59
+ HU: {
60
+ default: RegExp;
61
+ };
62
+ IS: {
63
+ default: RegExp;
64
+ };
65
+ IN: {
66
+ default: RegExp;
67
+ };
68
+ ID: {
69
+ default: RegExp;
70
+ };
71
+ IE: {
72
+ default: RegExp;
73
+ };
74
+ IM: {
75
+ default: RegExp;
76
+ };
77
+ IT: {
78
+ codiceFiscale: RegExp;
79
+ CCIAA: RegExp;
80
+ };
81
+ JP: {
82
+ default: RegExp;
83
+ };
84
+ JE: {
85
+ default: RegExp;
86
+ };
87
+ KR: {
88
+ default: RegExp;
89
+ };
90
+ LV: {
91
+ default: RegExp;
92
+ };
93
+ LI: {
94
+ default: RegExp;
95
+ };
96
+ LT: {
97
+ default: RegExp;
98
+ };
99
+ LU: {
100
+ default: RegExp;
101
+ };
102
+ MY: {
103
+ default: RegExp;
104
+ };
105
+ MT: {
106
+ default: RegExp;
107
+ };
108
+ MC: {
109
+ default: RegExp;
110
+ soleProprietorship: RegExp;
111
+ };
112
+ NL: {
113
+ default: RegExp;
114
+ };
115
+ NZ: {
116
+ NZBN: RegExp;
117
+ companyNumberNZ: RegExp;
118
+ };
119
+ NO: {
120
+ default: RegExp;
121
+ };
122
+ PL: {
123
+ krsNumber: RegExp;
124
+ regon: RegExp;
125
+ };
126
+ PT: {
127
+ default: RegExp;
128
+ };
129
+ PR: {
130
+ default: RegExp;
131
+ };
132
+ RO: {
133
+ default: RegExp;
134
+ };
135
+ SG: {
136
+ default: RegExp;
137
+ };
138
+ SK: {
139
+ default: RegExp;
140
+ };
141
+ SI: {
142
+ default: RegExp;
143
+ };
144
+ ES: {
145
+ default: RegExp;
146
+ };
147
+ SE: {
148
+ default: RegExp;
149
+ };
150
+ CH: {
151
+ default: RegExp;
152
+ };
153
+ GB: {
154
+ default: RegExp;
155
+ nonProfit: RegExp;
156
+ };
157
+ US: {
158
+ default: RegExp;
159
+ };
160
+ };
@@ -1,4 +1,5 @@
1
- import { CountryCustomIdNumberValidation } from './types';
1
+ import { IndividualIdNumberType } from '../../components/internal/IdFieldTypeSelector/countryIdNumberTypes';
2
+ import { PerCountryAndOtherDiscriminant } from '../perCountry';
2
3
  export declare const CountryIdNumberPatterns: {
3
4
  BR: RegExp;
4
5
  CA: RegExp;
@@ -12,4 +13,4 @@ export declare const CountryIdNumberPatterns: {
12
13
  US: RegExp;
13
14
  US9: RegExp;
14
15
  };
15
- export declare const customPatternsPerIdNumberType: CountryCustomIdNumberValidation;
16
+ export declare const customPatternsPerIdNumberType: PerCountryAndOtherDiscriminant<RegExp, IndividualIdNumberType, false>;
@@ -1,11 +1,8 @@
1
1
  export * from './basePatterns';
2
2
  export * from './businessRegistrationNumberPatterns';
3
3
  export * from './countryIdNumberPatterns';
4
- export * from './customRegistrationNumberPatterns';
5
4
  export * from './driversLicenseCardNumberPatterns';
6
5
  export * from './driversLicenseNumberPatterns';
7
6
  export * from './passportNumberPatterns';
8
7
  export * from './proofOfIdentityCardPatterns';
9
- export * from './trustRegistrationNumberPatterns';
10
- export * from './types';
11
8
  export * from './vatNumberPatterns';
@@ -0,0 +1,3 @@
1
+ import { ValidatorRule } from '../validation/types';
2
+ export declare const validateNotEmptyOnBlur: ValidatorRule<string | undefined, object>;
3
+ export declare const validatePatternOnBlur: <ValueType extends string, FormSchema>(pattern: RegExp) => ValidatorRule<ValueType, FormSchema>;
@@ -1,11 +1,12 @@
1
- import type { CountryRegexValidation, CountryRegexValidationPerType } from './types';
1
+ import { TaxIdNumberType } from '../../components/internal/IdFieldTypeSelector/countryIdNumberTypes';
2
+ import { PerCountry, PerCountryAndOtherDiscriminant } from '../perCountry';
2
3
  /**
3
4
  * Countries which follow the [countryCode][something] format
4
5
  *
5
6
  * @example
6
7
  * France (FR) - FR12999999999
7
8
  */
8
- export declare const vatSpecsPerCountry: CountryRegexValidation;
9
+ export declare const vatSpecsPerCountry: PerCountry<RegExp>;
9
10
  /**
10
11
  * Countries which do not follow the VAT rules ie the [countryCode][something] rule,
11
12
  * and have their own system, or event a more complex setup
@@ -14,5 +15,5 @@ export declare const vatSpecsPerCountry: CountryRegexValidation;
14
15
  * Monaco (MC) - FR12345678912
15
16
  * Greece (GR or EL) - EL123456789
16
17
  */
17
- export declare const nonVatSpecsPerCountry: CountryRegexValidation;
18
- export declare const customSpecsPerVatNumberType: CountryRegexValidationPerType;
18
+ export declare const nonVatSpecsPerCountry: PerCountry<RegExp | RegExp[]>;
19
+ export declare const customSpecsPerVatNumberType: PerCountryAndOtherDiscriminant<RegExp, TaxIdNumberType, false>;
@@ -0,0 +1,3 @@
1
+ type AllowedTag = 'strong' | 'a';
2
+ export declare const sanitizeHtml: (unsafeInput: string, allowedTags?: AllowedTag[]) => string;
3
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.25.2",
3
+ "version": "2.26.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -67,12 +67,13 @@
67
67
  "types:watch": "tsc --watch --preserveWatchOutput"
68
68
  },
69
69
  "dependencies": {
70
+ "@adyen/openbankingsdk": "^0.1.2",
71
+ "@adyen/adyen-document-viewer": "^1.1.0",
70
72
  "classnames": "^2.3.2",
73
+ "isomorphic-dompurify": "^0.13.0",
71
74
  "lodash": "^4.17.21",
72
75
  "onfido-sdk-ui": "12.3.5",
73
- "preact": "^10.17.1",
74
- "sanitize-html": "^2.11.0",
75
- "@adyen/openbankingsdk": "^0.1.2"
76
+ "preact": "^10.17.1"
76
77
  },
77
78
  "devDependencies": {
78
79
  "@commitlint/cli": "^17.7.1",
@@ -89,6 +90,7 @@
89
90
  "@testing-library/jest-dom": "^5.17.0",
90
91
  "@testing-library/preact": "^3.2.3",
91
92
  "@testing-library/user-event": "^14.4.3",
93
+ "@types/dompurify": "^3.0.5",
92
94
  "@types/inquirer": "^9.0.3",
93
95
  "@types/sanitize-html": "^2.9.0",
94
96
  "@typescript-eslint/eslint-plugin": "^5.62.0",
@@ -1,4 +0,0 @@
1
- import { CountryCode } from '../../../core/models/country-code';
2
- import { FormatRules } from '../../../utils/validation/types';
3
- import { BusinessRegistrationNumberSchema } from './types';
4
- export declare const getRegistrationNumberFormatters: (country: CountryCode) => FormatRules<BusinessRegistrationNumberSchema>;
@@ -1,21 +0,0 @@
1
- import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
2
- import { TrustTypes } from '../../../core/models/api/trust-types-value';
3
- import { CountryCode } from '../../../core/models/country-code';
4
- import Language from '../../../language';
5
- import { TranslationKey } from '../../../language/types';
6
- import { CompanyTypeValidation, TrustTypeValidation } from '../../../utils/regex';
7
- import { ValidatorRule, ValidatorRules } from '../../../utils/validation/types';
8
- import { BusinessRegistrationNumberSchema } from './types';
9
- interface TranslationMessage {
10
- translationKey: TranslationKey;
11
- format?: TranslationKey | string | undefined;
12
- values?: Record<string, string | number> | undefined;
13
- }
14
- export declare const validateBusinessRegistrationNumber: (input: string, fallbackCountry?: CountryCode | null, companyType?: keyof CompanyTypeValidation, trustType?: keyof TrustTypeValidation, registrationNumberType?: TranslationKey) => {
15
- isValid: boolean;
16
- translationMessage: TranslationMessage;
17
- };
18
- export declare const getValidationRulesPerCountryAndType: (country: CountryCode, companyType: CompanyTypesValue | undefined, trustType: TrustTypes | undefined, i18n: Language, registrationNumberType?: TranslationKey) => ValidatorRule<string | undefined, BusinessRegistrationNumberSchema>;
19
- export declare const defaultValidationRule: ValidatorRule<string | undefined, BusinessRegistrationNumberSchema>;
20
- export declare const getRegistrationNumberValidationRules: (country: CountryCode, companyType: CompanyTypesValue | undefined, trustType: TrustTypes | undefined, i18n: Language, registrationNumberType?: TranslationKey) => ValidatorRules<BusinessRegistrationNumberSchema>;
21
- export {};
@@ -1,21 +0,0 @@
1
- import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
2
- import { TrustTypes } from '../../../core/models/api/trust-types-value';
3
- import { CountryCode } from '../../../core/models/country-code';
4
- import Language from '../../../language/Language';
5
- import { TranslationKey } from '../../../language/types';
6
- import { CompanyTypeValidation, TrustTypeValidation } from '../../../utils/regex';
7
- import { ValidatorRule, ValidatorRules } from '../../../utils/validation/types';
8
- import { BusinessRegistrationNumberFieldSchema } from './types';
9
- interface TranslationMessage {
10
- translationKey: TranslationKey;
11
- format?: TranslationKey | string | undefined;
12
- values?: Record<string, string | number> | undefined;
13
- }
14
- export declare const validateBusinessRegistrationNumber: (input: string, fallbackCountry?: CountryCode | null, companyType?: keyof CompanyTypeValidation, trustType?: keyof TrustTypeValidation, registrationNumberType?: TranslationKey) => {
15
- isValid: boolean;
16
- translationMessage: TranslationMessage;
17
- };
18
- export declare const getValidationRulesPerCountryAndType: (country: CountryCode, companyType: CompanyTypesValue | undefined, trustType: TrustTypes | undefined, i18n: Language, registrationNumberType?: TranslationKey) => ValidatorRule<string | undefined, BusinessRegistrationNumberFieldSchema>;
19
- export declare const defaultValidationRule: ValidatorRule<string | undefined, BusinessRegistrationNumberFieldSchema>;
20
- export declare const BusinessRegistrationNumberValidation: (country: CountryCode, i18n: Language, companyType?: CompanyTypesValue, trustType?: TrustTypes, registrationNumberType?: TranslationKey) => ValidatorRules<BusinessRegistrationNumberFieldSchema>;
21
- export {};
@@ -1,10 +0,0 @@
1
- export interface ReferenceContextValue {
2
- references: References;
3
- addReference: (references: References) => void;
4
- }
5
- export interface References {
6
- [label: string]: {
7
- openSection: () => void;
8
- };
9
- }
10
- export declare const ReferenceContext: import("preact").Context<ReferenceContextValue>;
@@ -1,6 +0,0 @@
1
- import { ComponentChildren } from 'preact';
2
- interface ReferenceProps {
3
- children?: ComponentChildren;
4
- }
5
- export declare function ReferenceContextProvider({ children }: ReferenceProps): import("preact").JSX.Element;
6
- export {};
@@ -1 +0,0 @@
1
- export declare function useReferenceContext(): import("./ReferenceContext").ReferenceContextValue;
@@ -1,2 +0,0 @@
1
- import { ChapterProps } from '../../types';
2
- export default function Chapter({ title, contentElements }: ChapterProps): import("preact").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { ContentElementsProps } from '../../types';
2
- export default function ContentElements({ contentElements, isTopLevel, onExpandSection, }: ContentElementsProps): import("preact").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { InternalReferenceProps } from '../../types';
2
- export default function InternalReference({ referencedLabel: originalReferencedLabel, displayText, }: InternalReferenceProps): import("preact").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { ListProps } from '../../types';
2
- export default function ListElement({ items, style }: ListProps): import("preact").JSX.Element;
@@ -1,3 +0,0 @@
1
- import './Paragraph.scss';
2
- import { ParagraphProps } from '../../types';
3
- export default function Paragraph({ isTopLevel, contentElements }: ParagraphProps): import("preact").JSX.Element;
@@ -1,3 +0,0 @@
1
- import './Section.scss';
2
- import { SectionProps } from '../../types';
3
- export default function Section({ title, label: originalLabel, isTopLevel, contentElements, }: SectionProps): import("preact").JSX.Element;
@@ -1,3 +0,0 @@
1
- import './_table.component.scss';
2
- import { TableProps } from '../../types';
3
- export default function Table({ rows, label: originalLabel, captions, titlePrefix, title, }: TableProps): import("preact").JSX.Element;
@@ -1,3 +0,0 @@
1
- import './Text.scss';
2
- import { TextProps } from '../../types';
3
- export default function Text({ content, styles }: TextProps): import("preact").JSX.Element;
@@ -1,3 +0,0 @@
1
- import { WeblinkProps } from '../../types';
2
- declare const Weblink: ({ url, displayText }: WeblinkProps) => import("preact").JSX.Element;
3
- export default Weblink;
@@ -1 +0,0 @@
1
- export declare const formatId: (id: string) => string;
@@ -1,2 +0,0 @@
1
- import { IdNumberTypeProps } from './types';
2
- export declare function IdFieldTypeSelector(props: IdNumberTypeProps): import("preact").JSX.Element;
@@ -1,20 +0,0 @@
1
- import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
2
- import { CountryCode } from '../../../core/models/country-code';
3
- import { TranslationKey } from '../../../language/types';
4
- import { TaskTypes } from '../../TaskList/types';
5
- export interface IdNumberTypes {
6
- id: TranslationKey;
7
- name: TranslationKey;
8
- }
9
- export type IdFieldType = 'registrationNumber' | 'vatNumber' | undefined;
10
- export interface CountryIdNumberTypes {
11
- idNumberTypes: IdNumberTypes[];
12
- }
13
- export interface IdNumberTypeProps {
14
- handleIdNumberTypeChange: (idNumberTypes: TranslationKey) => void;
15
- country: CountryCode;
16
- companyType?: CompanyTypesValue;
17
- fieldType?: 'registrationNumber' | 'vatNumber';
18
- idNumberType: TranslationKey;
19
- taskType?: TaskTypes;
20
- }
@@ -1 +0,0 @@
1
- export declare const delay: (time: number) => Promise<void>;
@@ -1,3 +0,0 @@
1
- type AllowedTag = 'strong' | 'a';
2
- export declare const escapeHtml: (unsafeInput: string, allowedTags?: AllowedTag[]) => string;
3
- export {};
@@ -1,2 +0,0 @@
1
- import { CountryAndCustomRegexValidation } from './types';
2
- export declare const customRegistrationNumberPatterns: CountryAndCustomRegexValidation;
@@ -1,2 +0,0 @@
1
- import type { CountryAndTrustTypesRegexValidation } from './types';
2
- export declare const trustRegistrationNumberPatterns: CountryAndTrustTypesRegexValidation;
@@ -1,39 +0,0 @@
1
- import { CompanyTypesValue } from '../../core/models/api/company-types-value';
2
- import type { TrustTypes } from '../../core/models/api/trust-types-value';
3
- import type { CountryCode } from '../../core/models/country-code';
4
- import { TranslationKey } from '../../language/types';
5
- /**
6
- * @property (regex)- The expression that will trigger the feedback message
7
- * @property (format) - The translation key associated to the regex, defaults to using the string entered in this field if no translation exists
8
- * @property (message) - The messagekey that will be triggered to the user
9
- * @property (replaceChars) - The chars to be removed/replaced if provided
10
- * @property (values) - A record of values provided for specific variable validation
11
- *
12
- * @example
13
- * // Example use of values field
14
- * { regex: /^[a-zA-Z0-9]{1,9}$/, format: 'XtoYcharacters', values: { x: 1, y: 9 } }
15
- */
16
- export interface RegexValidationOptions {
17
- format?: string;
18
- message?: string;
19
- regex: RegExp;
20
- replaceChars?: string;
21
- values?: Record<string, string | number>;
22
- }
23
- export type DefaultValidation = {
24
- default: RegexValidationOptions;
25
- };
26
- export type CustomValidation = Partial<Record<TranslationKey | 'default', RegexValidationOptions>>;
27
- export type CountryRegexValidation = Partial<Record<CountryCode, RegexValidationOptions | RegexValidationOptions[]>>;
28
- export type CountryRegexValidationPerType = Partial<Record<CountryCode, Partial<Record<TranslationKey, RegexValidationOptions | RegexValidationOptions[]>>>>;
29
- export type CompanyTypeValidation = Partial<Record<CompanyTypesValue, RegexValidationOptions | RegexValidationOptions[]>> & {
30
- default: RegexValidationOptions;
31
- };
32
- export type CustomCompanyTypeValidation = Partial<Record<CompanyTypesValue, CustomValidation>>;
33
- export type TrustTypeValidation = Partial<Record<TrustTypes, RegexValidationOptions | RegexValidationOptions[]>> & {
34
- default: RegexValidationOptions;
35
- };
36
- export type CountryAndCompanyRegexValidation = Partial<Record<CountryCode, CompanyTypeValidation>>;
37
- export type CountryAndTrustTypesRegexValidation = Partial<Record<CountryCode, TrustTypeValidation>>;
38
- export type CountryAndCustomRegexValidation = Partial<Record<CountryCode, CustomValidation & CustomCompanyTypeValidation>>;
39
- export type CountryCustomIdNumberValidation = Partial<Record<CountryCode, Partial<Record<TranslationKey, RegExp>>>>;