@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,92 +1,6 @@
1
- export declare enum ElementTypes {
2
- Chapter = "chapter",
3
- Section = "section",
4
- Paragraph = "paragraph",
5
- Text = "text",
6
- Weblink = "weblink",
7
- List = "list",
8
- Table = "table",
9
- InternalReference = "internalReference"
10
- }
11
- export declare enum TextStyle {
12
- Bold = "BOLD",
13
- Italic = "ITALIC"
14
- }
15
- export interface ElementWithInnerContent {
16
- contentElements: Element[];
17
- }
18
- export interface TopLevelElement {
19
- isTopLevel?: boolean;
20
- }
21
- export type Contract = ElementWithInnerContent & {
22
- title: Text;
23
- };
24
- type Chapter = ElementWithInnerContent & {
25
- type: ElementTypes.Chapter;
26
- title: Text;
27
- };
28
- type Section = ElementWithInnerContent & {
29
- type: ElementTypes.Section;
30
- title: Text;
31
- label: string;
32
- };
33
- type Paragraph = ElementWithInnerContent & {
34
- type: ElementTypes.Paragraph;
35
- };
36
- type Text = {
37
- type: ElementTypes.Text;
38
- content: string;
39
- styles?: TextStyle[];
40
- };
41
- type Weblink = {
42
- type: ElementTypes.Weblink;
43
- url: string;
44
- displayText: Text;
45
- };
46
- type List = {
47
- type: ElementTypes.List;
48
- style: ListStyle;
49
- items: ListItem[];
50
- };
51
- type ListStyle = {
52
- ordered: boolean;
53
- };
54
- type ListItem = {
55
- content: Element[];
56
- subList: List;
57
- };
58
- type TableCell = {
59
- elements: Element[];
60
- };
61
- type TableRow = TableCell[];
62
- type Table = {
63
- type: ElementTypes.Table;
64
- rows: TableRow[];
65
- label: string;
66
- captions: Element[];
67
- titlePrefix: Text;
68
- title: Text;
69
- };
70
- type InternalReference = {
71
- type: ElementTypes.InternalReference;
72
- referencedLabel: string;
73
- displayText: Text;
74
- };
75
- type ContractViewerAnalytics = {
76
- onExpandSection?: (title: string) => void;
77
- };
78
- export type Element = Contract | Chapter | Section | Paragraph | Text | Weblink | List | ListStyle | ListItem | TableCell | TableRow | Table | InternalReference | ContractViewerAnalytics;
1
+ import type { Document } from '@adyen/adyen-document-viewer/dist/types';
79
2
  export type ContractViewerProps = {
80
- contract: Contract;
3
+ contract: Document;
81
4
  className?: string;
82
- } & ContractViewerAnalytics;
83
- export type ContentElementsProps = ElementWithInnerContent & TopLevelElement & ContractViewerAnalytics;
84
- export type ChapterProps = Omit<Chapter, 'type'>;
85
- export type SectionProps = Omit<Section & TopLevelElement, 'type'>;
86
- export type ParagraphProps = Omit<Paragraph & TopLevelElement, 'type'>;
87
- export type TextProps = Omit<Text, 'type'>;
88
- export type WeblinkProps = Omit<Weblink, 'type'>;
89
- export type ListProps = Omit<List, 'type'>;
90
- export type TableProps = Omit<Table, 'type'>;
91
- export type InternalReferenceProps = Omit<InternalReference, 'type'>;
92
- export {};
5
+ onExpandSection?: (title: string) => void;
6
+ };
@@ -19,7 +19,7 @@ export interface InputBaseProps extends ComponentProps<'input'> {
19
19
  onFocusHandler?: (event: JSX.TargetedFocusEvent<HTMLInputElement>) => void;
20
20
  onChange?: never;
21
21
  }
22
- declare const InputBase: import("preact").FunctionalComponent<Omit<InputBaseProps, "ref"> & {
22
+ declare const InputBase: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<InputBaseProps> & {
23
23
  ref?: import("preact").Ref<HTMLInputElement>;
24
24
  }>;
25
25
  export default InputBase;
@@ -2,7 +2,7 @@ import { InputBaseProps } from './InputBase';
2
2
  interface InputTextProps extends InputBaseProps {
3
3
  transformInput?: (input: string) => string;
4
4
  }
5
- declare const InputText: import("preact").FunctionalComponent<Omit<InputTextProps, "ref"> & {
5
+ declare const InputText: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<InputTextProps> & {
6
6
  ref?: import("preact").Ref<HTMLInputElement>;
7
7
  }>;
8
8
  export default InputText;
@@ -0,0 +1,22 @@
1
+ import './MaskedInputText.scss';
2
+ import { JSX } from 'preact';
3
+ import { MaskSettings } from '../../../../core/hooks/useForm';
4
+ import { MismatchResult } from '../../../../utils/masking/matchAgainstMask';
5
+ export interface MaskedInputTextProps extends MaskSettings {
6
+ value: string;
7
+ onInput: (value: string) => void;
8
+ onBlur?: (event: JSX.TargetedFocusEvent<HTMLInputElement>) => void;
9
+ onMismatch?: (mismatch: MismatchResult) => void;
10
+ isValid: boolean;
11
+ errorMessage?: string | boolean;
12
+ label: string;
13
+ name: string;
14
+ formatGuidance: string;
15
+ readonly?: boolean;
16
+ disabled?: boolean;
17
+ classNameModifiers?: {
18
+ field?: string[];
19
+ input?: string[];
20
+ };
21
+ }
22
+ export declare const MaskedInputText: ({ value, onInput, onBlur, onMismatch: onMismatchExternal, isValid: validationIsValid, errorMessage, mask, name, label, transformOnType, readonly, disabled, formatGuidance, classNameModifiers, }: MaskedInputTextProps) => JSX.Element;
@@ -8,7 +8,7 @@ interface RadioGroupItem {
8
8
  export interface RadioGroupProps {
9
9
  className?: string;
10
10
  isInvalid?: boolean;
11
- items: RadioGroupItem[];
11
+ items: readonly RadioGroupItem[];
12
12
  i18n: Language;
13
13
  name?: string;
14
14
  onChange: (e: TargetedEvent<HTMLInputElement>) => void;
@@ -0,0 +1,11 @@
1
+ import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
2
+ import { CountryCode } from '../../../core/models/country-code';
3
+ import { CompanyRegistrationNumberType } from './countryIdNumberTypes';
4
+ interface CompanyRegistrationNumberTypeSelectorProps {
5
+ country: CountryCode;
6
+ companyType: CompanyTypesValue;
7
+ selected: CompanyRegistrationNumberType;
8
+ setSelected: (type: CompanyRegistrationNumberType) => void;
9
+ }
10
+ export declare function CompanyRegistrationNumberTypeSelector({ country, companyType, selected, setSelected, }: CompanyRegistrationNumberTypeSelectorProps): import("preact").JSX.Element;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { CountryCode } from '../../../core/models/country-code';
2
+ import { IndividualIdNumberType } from './countryIdNumberTypes';
3
+ interface IndividualIdNumberTypeSelectorProps {
4
+ country: CountryCode;
5
+ selected: IndividualIdNumberType;
6
+ setSelected: (type: IndividualIdNumberType) => void;
7
+ }
8
+ export declare function IndividualIdNumberTypeSelector({ country, selected, setSelected, }: IndividualIdNumberTypeSelectorProps): import("preact").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { CountryCode } from '../../../core/models/country-code';
2
+ import { TaxIdNumberType } from './countryIdNumberTypes';
3
+ interface TaxIdNumberTypeSelectorProps {
4
+ country: CountryCode;
5
+ selected: TaxIdNumberType;
6
+ setSelected: (type: TaxIdNumberType) => void;
7
+ }
8
+ export declare function TaxIdNumberTypeSelector({ country, selected, setSelected, }: TaxIdNumberTypeSelectorProps): import("preact").JSX.Element;
9
+ export {};
@@ -1,5 +1,90 @@
1
- import { CountryCode } from '../../../core/models/country-code';
2
- import { CountryIdNumberTypes } from './types';
3
- export declare const companyRegistrationNumberTypesPerCountry: Partial<Record<CountryCode, CountryIdNumberTypes>>;
4
- export declare const individualIdNumberTypesPerCountry: Partial<Record<CountryCode, CountryIdNumberTypes>>;
5
- export declare const companyVatNumberTypesPerCountry: Partial<Record<CountryCode, CountryIdNumberTypes>>;
1
+ import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
2
+ import { TranslationKey } from '../../../language/types';
3
+ export interface CompanyRegistrationNumberOption {
4
+ id: string;
5
+ name: TranslationKey;
6
+ applicableOnlyFor?: readonly CompanyTypesValue[];
7
+ }
8
+ export interface IndividualIdNumberOption {
9
+ id: string;
10
+ name: TranslationKey;
11
+ }
12
+ export interface TaxIdNumberOption {
13
+ id: string;
14
+ name: TranslationKey;
15
+ }
16
+ export declare const companyRegistrationNumberOptions: {
17
+ readonly PL: readonly [{
18
+ readonly id: "regon";
19
+ readonly name: "regon";
20
+ }, {
21
+ readonly id: "krsNumber";
22
+ readonly name: "krsNumber";
23
+ }];
24
+ readonly IT: readonly [{
25
+ readonly id: "codiceFiscale";
26
+ readonly name: "codiceFiscale";
27
+ }, {
28
+ readonly id: "CCIAA";
29
+ readonly name: "CCIAA";
30
+ }];
31
+ readonly AT: readonly [{
32
+ readonly id: "firmenbuchnummer";
33
+ readonly name: "firmenbuchnummer";
34
+ }, {
35
+ readonly id: "ZVR";
36
+ readonly name: "zentralesVereinsregisterId";
37
+ readonly applicableOnlyFor: readonly [CompanyTypesValue.NON_PROFIT_OR_CHARITABLE];
38
+ }];
39
+ readonly FR: readonly [{
40
+ readonly id: "SIRET";
41
+ readonly name: "siret";
42
+ }, {
43
+ readonly id: "RNA";
44
+ readonly name: "rnaNumber";
45
+ readonly applicableOnlyFor: readonly [CompanyTypesValue.NON_PROFIT_OR_CHARITABLE];
46
+ }];
47
+ readonly NZ: readonly [{
48
+ readonly id: "NZBN";
49
+ readonly name: "NZBN";
50
+ }, {
51
+ readonly id: "companyNumberNZ";
52
+ readonly name: "companyNumberNZ";
53
+ readonly applicableOnlyFor: readonly [CompanyTypesValue.PRIVATE_COMPANY, CompanyTypesValue.PUBLIC_COMPANY, CompanyTypesValue.UNLISTED_PUBLIC_COMPANY];
54
+ }];
55
+ };
56
+ export type CompanyRegistrationNumberType = (typeof companyRegistrationNumberOptions)[keyof typeof companyRegistrationNumberOptions][number]['id'];
57
+ export declare const individualIdNumberOptions: {
58
+ readonly ES: readonly [{
59
+ readonly id: "dni";
60
+ readonly name: "dni";
61
+ }, {
62
+ readonly id: "nie";
63
+ readonly name: "nie";
64
+ }];
65
+ };
66
+ export type IndividualIdNumberType = (typeof individualIdNumberOptions)[keyof typeof individualIdNumberOptions][number]['id'];
67
+ export declare const taxIdNumberOptions: {
68
+ readonly DK: readonly [{
69
+ readonly id: "momsregistreringsnummerCVR";
70
+ readonly name: "momsregistreringsnummerCVR";
71
+ }, {
72
+ readonly id: "stamregister";
73
+ readonly name: "stamregister";
74
+ }];
75
+ readonly FR: readonly [{
76
+ readonly id: "numeroDIdentificationALATaxe";
77
+ readonly name: "numeroDIdentificationALATaxe";
78
+ }, {
79
+ readonly id: "NumeroDeTVA";
80
+ readonly name: "NumeroDeTVA";
81
+ }];
82
+ readonly SG: readonly [{
83
+ readonly id: "gst";
84
+ readonly name: "gst";
85
+ }, {
86
+ readonly id: "uen";
87
+ readonly name: "uen";
88
+ }];
89
+ };
90
+ export type TaxIdNumberType = (typeof taxIdNumberOptions)[keyof typeof taxIdNumberOptions][number]['id'];
@@ -1,7 +1,6 @@
1
1
  import type { BaseInnerFormProps } from '../../../core/hooks/useForm';
2
2
  import type { CountryCode } from '../../../core/models/country-code';
3
3
  import { TranslationKey } from '../../../language/types';
4
- import type { RegexValidationOptions } from '../../../utils/regex';
5
4
  export interface VatNumberSchema {
6
5
  vatNumber?: string;
7
6
  exemptedFromVat?: boolean;
@@ -11,11 +10,7 @@ export interface VatNumberProps extends BaseInnerFormProps<VatNumberSchema> {
11
10
  country: CountryCode;
12
11
  vatNumberType?: TranslationKey;
13
12
  }
14
- export interface RegexPatterns {
15
- [key: string]: RegExp[];
16
- }
17
13
  export type ValidateSpecsAgainstInput = {
18
- countryCode: CountryCode;
19
- specs: RegexValidationOptions | RegexValidationOptions[];
14
+ specs: RegExp | RegExp[] | undefined;
20
15
  input: string;
21
16
  };
@@ -1,10 +1,9 @@
1
1
  import type { CountryCode } from '../../../core/models/country-code';
2
- import { TranslationKey } from '../../../language/types';
2
+ import { TaxIdNumberType } from '../IdFieldTypeSelector/countryIdNumberTypes';
3
3
  export declare const validateVatNumber: (input: string | undefined | null, fallbackCountryCode?: CountryCode | null) => {
4
4
  isValid: boolean;
5
5
  message?: string;
6
6
  };
7
- export declare const validatePerVatNumberType: (input: string | undefined | null, vatNumberType: TranslationKey, fallbackCountryCode?: CountryCode | null) => {
7
+ export declare const validatePerVatNumberType: (input: string | undefined | null, vatNumberType: TaxIdNumberType, fallbackCountryCode?: CountryCode | null) => {
8
8
  isValid: boolean;
9
- message?: string;
10
9
  };
@@ -1,17 +1,12 @@
1
+ import type { AxiosError } from 'axios';
1
2
  import { CompanyBasicsSchema } from '../../../components/CompanyBasics/types';
2
3
  import { DropinAPIHandlers } from '../../../components/Dropins/types';
3
4
  import { ValidatorMode } from '../../../utils/validation/types';
4
- import { AdyenKycSdkError } from '../../error';
5
5
  import { CompanyDatasetResponse, CompanySearchResult } from '../../models/api/company-search';
6
6
  import { CountryCode } from '../../models/country-code';
7
7
  import { ProvinceCode } from '../../models/province-code';
8
8
  import { StateCode, StateCodeUS } from '../../models/state-code';
9
9
  import { HookStatus } from '../types';
10
- export interface CompanySearchError extends Error {
11
- status: number;
12
- errorCode: string;
13
- errorType: string;
14
- }
15
10
  export interface SearchCompaniesOptions {
16
11
  companyName: string;
17
12
  companyCountry: CountryCode;
@@ -39,7 +34,7 @@ export type UseCompanySearch = {
39
34
  results: readonly CompanySearchResult[];
40
35
  selectedCompanyId: string | undefined;
41
36
  status: HookStatus;
42
- error: AdyenKycSdkError | undefined;
37
+ error: AxiosError | undefined;
43
38
  verifiedCompany: CompanyDatasetResponse | undefined;
44
39
  retrySearch: () => Promise<void>;
45
40
  verify: (tin: string, company: CompanySearchResult) => Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { StateUpdater } from 'preact/hooks';
2
- import type { TranslationKey, TranslationObject } from '../../../language/types';
2
+ import type { Translatable, TranslationKey } from '../../../language/types';
3
3
  import { Mask } from '../../../utils/masking/maskTypes';
4
4
  import type { ValidationRuleResult, ValidatorMode, ValidatorRules } from '../../../utils/validation/types';
5
5
  import type { AnyFormIdOfTLDS } from '../../Context/StateContext/types';
@@ -19,9 +19,10 @@ export type FieldErrors<FieldSchema> = {
19
19
  export type FieldLabels<FieldSchema> = {
20
20
  [fieldLabel in keyof FieldSchema]?: string;
21
21
  };
22
- export interface MaskOptions {
22
+ export interface MaskSettings {
23
23
  mask?: Mask;
24
24
  transformOnType?: (val: string) => string;
25
+ guidanceText?: Translatable;
25
26
  }
26
27
  export interface BaseFormFieldProps<FieldSchema> {
27
28
  data: FieldData<FieldSchema>;
@@ -65,10 +66,10 @@ export interface BaseFormProps<FormSchema> {
65
66
  [Field in keyof FormSchema]: TranslationKey;
66
67
  };
67
68
  helperText?: {
68
- [Field in keyof FormSchema]: TranslationKey | TranslationObject;
69
+ [Field in keyof FormSchema]: Translatable;
69
70
  };
70
71
  masks?: {
71
- [Field in keyof FormSchema]: MaskOptions;
72
+ [Field in keyof FormSchema]: MaskSettings;
72
73
  };
73
74
  data?: FormSchema;
74
75
  validators?: ValidatorRules<FormSchema>;
@@ -1,12 +1,14 @@
1
1
  import { Translatable, TranslationKey } from '../../language/types';
2
- import { MaskOptions } from '../hooks/useForm';
2
+ import { ValidatorRule } from '../../utils/validation/types';
3
+ import { MaskSettings } from '../hooks/useForm';
3
4
  import { CountryCode } from './country-code';
4
- export type CountryConfig = Partial<Record<CountryCode, {
5
- [field: string]: CountryFieldConfig;
5
+ export type CountryConfig<Options = unknown> = Partial<Record<CountryCode, {
6
+ [field: string]: FieldMetadata<Record<string, string>, string> | ((options: Options) => FieldMetadata<Record<string, string>, string>);
6
7
  }>>;
7
- export interface CountryFieldConfig {
8
+ export interface FieldMetadata<FormSchema, FieldName extends keyof FormSchema> {
8
9
  label?: TranslationKey;
9
10
  placeholder?: TranslationKey;
10
11
  helperText?: Translatable;
11
- mask?: MaskOptions;
12
+ mask?: MaskSettings;
13
+ validators?: ValidatorRule<FormSchema[FieldName], FormSchema> | ValidatorRule<FormSchema[FieldName], FormSchema>[];
12
14
  }
@@ -1,8 +1,10 @@
1
- import { CountryFieldConfig } from './country-config';
1
+ import { PerCountry } from '../../utils/perCountry';
2
+ import { FieldMetadata } from './country-config';
2
3
  import { ScenarioFieldSettings } from './scenario-fields';
3
- interface FieldConfiguration<FieldType> extends ScenarioFieldSettings<FieldType>, CountryFieldConfig {
4
- }
4
+ type FieldConfiguration<FieldType> = ScenarioFieldSettings<FieldType>;
5
5
  export type FieldConfigurations<FormSchema> = {
6
6
  [key in keyof FormSchema]: FieldConfiguration<FormSchema[key]>;
7
7
  };
8
+ export type PerCountryFieldConfig<FormSchema, FieldName extends keyof FormSchema, Params extends object> = PerCountry<FieldMetadata<FormSchema, FieldName> | ((params: Params) => FieldMetadata<FormSchema, FieldName>)>;
9
+ export declare const resolveFieldMetadata: <FormSchema, FieldName extends keyof FormSchema, Params extends object>(countryEntry: FieldMetadata<FormSchema, FieldName> | ((params: Params) => FieldMetadata<FormSchema, FieldName>), params: Params, defaultMetadata: FieldMetadata<FormSchema, FieldName>) => FieldMetadata<FormSchema, FieldName>;
8
10
  export {};
@@ -285,6 +285,9 @@ export declare const defaultTranslation: {
285
285
  accountHolderDescriptionIndividual: string;
286
286
  accountHolderDescriptionSoleProp: string;
287
287
  bankAccountToHaveSameNameAsTrust: string;
288
+ bankAccountHasToBeInYourName: string;
289
+ orSoleProprietorshipName: string;
290
+ bankAccountHasToBeInYourCompanyName: string;
288
291
  bankCountry: string;
289
292
  bankAccountCountry: string;
290
293
  currency: string;
@@ -440,6 +443,7 @@ export declare const defaultTranslation: {
440
443
  australianBusinessNumberAcn: string;
441
444
  "NZBN/NCN": string;
442
445
  NZBN: string;
446
+ companyNumberNZ: string;
443
447
  enterpriseNumber: string;
444
448
  NIP: string;
445
449
  NIPC: string;
@@ -481,18 +485,20 @@ export declare const defaultTranslation: {
481
485
  regonKrsNumber: string;
482
486
  registrationNumber: string;
483
487
  identificationNumber: string;
484
- whichRegistrationNumber: string;
488
+ whichTypeOfRegistrationNumberDoYouHave: string;
489
+ whichTypeOfIdNumberDoYouHave: string;
490
+ whichTypeOfTaxIdNumberDoYouHave: string;
485
491
  regon: string;
486
492
  krsNumber: string;
487
493
  registrationNumber__nonProfit__FR: string;
488
- registrationNumber__FR: string;
489
- RNA: string;
490
- SIRET: string;
494
+ rnaNumber: string;
495
+ siret: string;
491
496
  registrationNumber__PR: string;
497
+ employerIdentificationNumber: string;
492
498
  charityNumber: string;
493
499
  firmenbuchnummer: string;
494
500
  firmenbuchnummerOrZVR: string;
495
- ZVR: string;
501
+ zentralesVereinsregisterId: string;
496
502
  "stepsX/YofForm": string;
497
503
  no: string;
498
504
  yes: string;
@@ -694,24 +700,22 @@ export declare const defaultTranslation: {
694
700
  mcRegistrationNumber: string;
695
701
  liRegistrationNumber: string;
696
702
  Mehrwertsteuernummer: string;
697
- Xdigits: string;
698
- upToXdigits: string;
699
- XtoYdigits: string;
700
- XorYdigits: string;
701
- Xcharacters: string;
702
- XtoYcharacters: string;
703
- XdigitsAndYcharacters: string;
704
- "1character5to7digits": string;
705
- "1char8digits": string;
706
- "1charXalphanumeric": string;
707
- "2characters6or7digits": string;
708
- "7or8or12characters": string;
709
- "2digits1to3letters5digits": string;
710
- Cchar5digits: string;
711
- characterPlusXToYDigitsWithOptionalSpace: string;
712
- cop1to8digits: string;
713
- "8digitsOptional-": string;
714
703
  enterNDigitsForExample: string;
704
+ enterNCharactersForExample: string;
705
+ enterXToYDigitsForExample: string;
706
+ enterXToYCharactersForExample: string;
707
+ enterXToYCharactersWithAMixForExample: string;
708
+ enterAMaximumOfNDigitsForExample: string;
709
+ enterAMaximumOfNMoreDigitsForExample: string;
710
+ enterAMaximumOfNCharactersForExample: string;
711
+ enterAMaximumOfNCharactersWithAMixForExample: string;
712
+ enterNDigitsAndThen1LetterForExample: string;
713
+ enter1LetterAndThenNDigitsForExample: string;
714
+ enter1LetterAndThenXToYDigitsForExample: string;
715
+ enterNLettersAndThenXToYDigitsForExample: string;
716
+ enterXToYLettersAndThenWToZDigitsForExample: string;
717
+ enterTheRemainingNDigitsForExample: string;
718
+ enterTheRemainingXToYDigitsForExample: string;
715
719
  provideAllOwners: string;
716
720
  ifNoOwnersSpecifyControllingPersons: string;
717
721
  provideAtLeastOneSignatory: string;
@@ -796,10 +800,6 @@ export declare const defaultTranslation: {
796
800
  xCharactersLeft: string;
797
801
  goBack: string;
798
802
  doNotHaveBusinessNumber: string;
799
- "UEN/GST": string;
800
- UEN: string;
801
- "IRD/GST": string;
802
- IRD: string;
803
803
  enterNameExactlyAsAppearInID: string;
804
804
  enterLastNameExactlyAsAppearInID: string;
805
805
  takePhotoOriginalDocumentWithPhone: string;
@@ -1152,6 +1152,7 @@ export declare const defaultTranslation: {
1152
1152
  patriotActDisclosureTextParagraph1: string;
1153
1153
  patriotActDisclosureTextParagraph2: string;
1154
1154
  trusteeAsTrusteeForTrust: string;
1155
+ trusteeAsTrusteeForTrustDoingBusinessAs: string;
1155
1156
  trustDeed: string;
1156
1157
  trustInstrument: string;
1157
1158
  makeSureToHaveYourTrustDeed: string;