@adyen/kyc-components 2.26.1 → 2.26.3
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.
|
@@ -6137,6 +6137,7 @@ const nonInputs = (str, options) => Array.from(str).map((char) => ({
|
|
|
6137
6137
|
includeInValue: (options == null ? void 0 : options.includeInValue) ?? false,
|
|
6138
6138
|
displayEagerly: (options == null ? void 0 : options.displayEagerly) ?? true
|
|
6139
6139
|
}));
|
|
6140
|
+
const spacer = nonInputs(" ")[0];
|
|
6140
6141
|
const alphaInputs = (length, optional = false) => makeArrayOfRepeatedObjects(length, {
|
|
6141
6142
|
type: "input",
|
|
6142
6143
|
allow: /[A-Za-z]/,
|
|
@@ -6324,7 +6325,15 @@ const businessRegistrationNumberMasks = {
|
|
|
6324
6325
|
default: {
|
|
6325
6326
|
mask: makeMask(...nonInputs("FL", {
|
|
6326
6327
|
includeInValue: true
|
|
6327
|
-
}),
|
|
6328
|
+
}), spacer, ...nonInputs("-", {
|
|
6329
|
+
includeInValue: true
|
|
6330
|
+
}), spacer, ...numericInputs(4), spacer, ...nonInputs(".", {
|
|
6331
|
+
includeInValue: true
|
|
6332
|
+
}), spacer, ...numericInputs(3), spacer, ...nonInputs(".", {
|
|
6333
|
+
includeInValue: true
|
|
6334
|
+
}), spacer, ...numericInputs(3), spacer, ...nonInputs("-", {
|
|
6335
|
+
includeInValue: true
|
|
6336
|
+
}), spacer, ...numericInputs(1))
|
|
6328
6337
|
}
|
|
6329
6338
|
},
|
|
6330
6339
|
[CountryCodes.Lithuania]: {
|
|
@@ -6388,7 +6397,11 @@ const businessRegistrationNumberMasks = {
|
|
|
6388
6397
|
},
|
|
6389
6398
|
[CountryCodes.Romania]: {
|
|
6390
6399
|
default: {
|
|
6391
|
-
mask: makeMask(...alphaInputs(1), ...numericInputs(2),
|
|
6400
|
+
mask: makeMask(...alphaInputs(1), ...numericInputs(2), spacer, ...nonInputs("/", {
|
|
6401
|
+
includeInValue: true
|
|
6402
|
+
}), spacer, ...numericInputs(1), ...numericInputs(8, true), spacer, ...nonInputs("/", {
|
|
6403
|
+
includeInValue: true
|
|
6404
|
+
}), spacer, ...numericInputs(4)),
|
|
6392
6405
|
transformOnType: uppercase
|
|
6393
6406
|
}
|
|
6394
6407
|
},
|
|
@@ -6478,7 +6491,7 @@ const businessRegistrationNumberPatterns = {
|
|
|
6478
6491
|
soleProprietorship: /^\d{8}$/
|
|
6479
6492
|
},
|
|
6480
6493
|
[CountryCodes.Cyprus]: {
|
|
6481
|
-
default: /^[
|
|
6494
|
+
default: /^[A-Z]{1,2}\d{1,8}$/
|
|
6482
6495
|
},
|
|
6483
6496
|
[CountryCodes.CzechRepublic]: {
|
|
6484
6497
|
default: /^\d{8,10}$/
|
|
@@ -6585,7 +6598,7 @@ const businessRegistrationNumberPatterns = {
|
|
|
6585
6598
|
default: /^\d{9}$/
|
|
6586
6599
|
},
|
|
6587
6600
|
[CountryCodes.Romania]: {
|
|
6588
|
-
default: /^
|
|
6601
|
+
default: /^[A-Z]\d{2}\/\d{1,9}\/\d{4}$/
|
|
6589
6602
|
},
|
|
6590
6603
|
[CountryCodes.Singapore]: {
|
|
6591
6604
|
default: /^[a-zA-Z0-9]{9,10}$/
|
|
@@ -6760,7 +6773,7 @@ const defaultFieldConfig = {
|
|
|
6760
6773
|
helperText: {
|
|
6761
6774
|
key: "enterAMaximumOfNCharactersWithAMixForExample",
|
|
6762
6775
|
values: {
|
|
6763
|
-
|
|
6776
|
+
maxChars: "9",
|
|
6764
6777
|
example: "T1001a, FN89060n"
|
|
6765
6778
|
}
|
|
6766
6779
|
}
|
|
@@ -7260,7 +7273,7 @@ const defaultFieldConfig = {
|
|
|
7260
7273
|
helperText: {
|
|
7261
7274
|
key: "enterAMaximumOfNMoreDigitsForExample",
|
|
7262
7275
|
values: {
|
|
7263
|
-
|
|
7276
|
+
maxDigits: "15",
|
|
7264
7277
|
example: "J40/8302/1997"
|
|
7265
7278
|
}
|
|
7266
7279
|
}
|
|
@@ -7272,8 +7285,8 @@ const defaultFieldConfig = {
|
|
|
7272
7285
|
helperText: {
|
|
7273
7286
|
key: "enterXToYCharactersWithAMixForExample",
|
|
7274
7287
|
values: {
|
|
7275
|
-
|
|
7276
|
-
|
|
7288
|
+
minChars: "9",
|
|
7289
|
+
maxChars: "10",
|
|
7277
7290
|
example: "200312345A"
|
|
7278
7291
|
}
|
|
7279
7292
|
}
|
|
@@ -7918,6 +7931,24 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
7918
7931
|
})
|
|
7919
7932
|
});
|
|
7920
7933
|
}
|
|
7934
|
+
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7935
|
+
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7936
|
+
const metadataFn = defaultFieldConfig[country2];
|
|
7937
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7938
|
+
return void 0;
|
|
7939
|
+
for (const option of optionsForCountry) {
|
|
7940
|
+
const fieldMetadata = metadataFn({
|
|
7941
|
+
companyType: companyType2,
|
|
7942
|
+
registrationNumberType: option.id
|
|
7943
|
+
});
|
|
7944
|
+
if (!fieldMetadata.validators)
|
|
7945
|
+
continue;
|
|
7946
|
+
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
7947
|
+
if (validators.every((validator) => validator.validate(registrationNumber2))) {
|
|
7948
|
+
return option.id;
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7951
|
+
};
|
|
7921
7952
|
function TaxIdNumberTypeSelector({
|
|
7922
7953
|
country: country2,
|
|
7923
7954
|
selected,
|
|
@@ -8934,14 +8965,14 @@ const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [{
|
|
|
8934
8965
|
}];
|
|
8935
8966
|
const companyRegistrationDetailsFields = ["tradingName", "sameNameAsLegalName", ...businessRegistrationNumberFields, "stockExchangeMIC", "stockISIN", ...vatNumberFields, ...taxIdFields, "dateOfIncorporation"];
|
|
8936
8967
|
function CompanyRegistrationDetailsComponent(props) {
|
|
8937
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
8968
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8938
8969
|
const {
|
|
8939
8970
|
i18n
|
|
8940
8971
|
} = useI18nContext();
|
|
8941
8972
|
const {
|
|
8942
8973
|
isExperimentEnabled
|
|
8943
8974
|
} = useExperimentsContext();
|
|
8944
|
-
const
|
|
8975
|
+
const isTypeSelectorEnabled = isExperimentEnabled(ExperimentNames.EnableIdentityFieldTypeSelector);
|
|
8945
8976
|
const hideOptionalRegistrationNumberField = FLOWS_THAT_HIDE_REGISTRATION_NUMBER.some((f) => f.country === props.country && f.companyType.includes(props.companyType));
|
|
8946
8977
|
const stateRef = useRef({
|
|
8947
8978
|
setState: null
|
|
@@ -8974,8 +9005,8 @@ function CompanyRegistrationDetailsComponent(props) {
|
|
|
8974
9005
|
rules: companyRegistrationDetailsValidationRules,
|
|
8975
9006
|
fieldProblems: props == null ? void 0 : props.fieldValidationErrors
|
|
8976
9007
|
});
|
|
8977
|
-
const defaultRegistrationNumberType =
|
|
8978
|
-
const defaultVatNumberType = ((
|
|
9008
|
+
const defaultRegistrationNumberType = props.data.registrationNumber ? inferCompanyRegistrationNumberType(props.data.registrationNumber, props.country, props.companyType) : (_e = companyRegistrationNumberOptions[companyCountry2]) == null ? void 0 : _e[0].id;
|
|
9009
|
+
const defaultVatNumberType = ((_f = taxIdNumberOptions[companyCountry2]) == null ? void 0 : _f[0].id) ?? ((_g = props.labels) == null ? void 0 : _g.vatNumber);
|
|
8979
9010
|
const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
|
|
8980
9011
|
const [vatNumberType, setVatNumberType] = useState(defaultVatNumberType);
|
|
8981
9012
|
useEffect(() => {
|
|
@@ -9143,7 +9174,7 @@ function CompanyRegistrationDetailsComponent(props) {
|
|
|
9143
9174
|
"aria-label": formUtils.getLabel("stockISIN"),
|
|
9144
9175
|
"aria-invalid": !valid.stockISIN
|
|
9145
9176
|
})
|
|
9146
|
-
}),
|
|
9177
|
+
}), isTypeSelectorEnabled && formUtils.isRequiredField("registrationNumber") && jsx(CompanyRegistrationNumberTypeSelector, {
|
|
9147
9178
|
companyType: props.companyType,
|
|
9148
9179
|
country: props.country,
|
|
9149
9180
|
setSelected: setRegistrationNumberType,
|
|
@@ -9155,7 +9186,7 @@ function CompanyRegistrationDetailsComponent(props) {
|
|
|
9155
9186
|
dataStoreId: COMPANY_REGISTRATION_DETAILS,
|
|
9156
9187
|
labels: registrationNumberCustomLabel,
|
|
9157
9188
|
registrationNumberType
|
|
9158
|
-
}),
|
|
9189
|
+
}), isTypeSelectorEnabled && formUtils.isRequiredField("vatNumber") && jsx(TaxIdNumberTypeSelector, {
|
|
9159
9190
|
country: props.country,
|
|
9160
9191
|
setSelected: setVatNumberType,
|
|
9161
9192
|
selected: vatNumberType
|
package/dist/types/components/internal/IdFieldTypeSelector/inferCompanyRegistrationNumberType.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CompanyTypesValue } from '../../../core/models/api/company-types-value';
|
|
2
|
+
import { CountryCode } from '../../../core/models/country-code';
|
|
3
|
+
import { CompanyRegistrationNumberType } from './countryIdNumberTypes';
|
|
4
|
+
/**
|
|
5
|
+
* For existing data, we need to infer the company registration number type from the existing data.
|
|
6
|
+
* Otherwise, the incorrect mask will be applied.
|
|
7
|
+
* We don't store this choice in the API.
|
|
8
|
+
* @param registrationNumber the existing company registration number
|
|
9
|
+
* @param country the country of the LE
|
|
10
|
+
* @param companyType the company type, e.g. `nonProfit`
|
|
11
|
+
*/
|
|
12
|
+
export declare const inferCompanyRegistrationNumberType: (registrationNumber: string, country: CountryCode, companyType: CompanyTypesValue) => CompanyRegistrationNumberType | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InputToken, Mask, MaskToken, NonInputToken } from './maskTypes';
|
|
2
2
|
export declare const nonInputs: (str: string, options?: Partial<NonInputToken>) => NonInputToken[];
|
|
3
|
+
export declare const spacer: NonInputToken;
|
|
3
4
|
export declare const alphaInputs: (length: number, optional?: boolean) => InputToken[];
|
|
4
5
|
export declare const numericInputs: (length: number, optional?: boolean) => InputToken[];
|
|
5
6
|
export declare const alphanumericInputs: (length: number, optional?: boolean) => InputToken[];
|