@adyen/kyc-components 2.4.0 → 2.4.1
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.
- package/dist/es/adyen-kyc-components.es.js +389 -175
- package/dist/types/components/IdentityHK/additionalIdentityInfoSchema.d.ts +8 -0
- package/dist/types/components/IdentityHK/component/DriversLicense.d.ts +14 -0
- package/dist/types/components/IdentityHK/component/IdentityHKComponent.d.ts +2 -0
- package/dist/types/components/IdentityHK/component/PassportNumber.d.ts +9 -0
- package/dist/types/components/IdentityHK/component/ProofOfIdentityCard.d.ts +10 -0
- package/dist/types/components/IdentityHK/component/TypeOfIdentity.d.ts +12 -0
- package/dist/types/components/IdentityHK/types.d.ts +10 -0
- package/dist/types/components/IdentityHK/validate.d.ts +7 -0
- package/dist/types/components/internal/Address/utils.d.ts +1 -1
- package/dist/types/components/internal/Address/validate.d.ts +2 -1
- package/dist/types/language/config.d.ts +10 -0
- package/dist/types/utils/decision-maker-roles.d.ts +1 -1
- package/dist/types/utils/entity-status-util.d.ts +2 -2
- package/dist/types/utils/regex/hkIdentityTypePatterns.d.ts +3 -0
- package/dist/types/utils/trust-util.d.ts +1 -1
- package/package.json +1 -1
|
@@ -307,6 +307,9 @@ const invalidFormatForAuPassportNumber = "This isn't a valid Australian passport
|
|
|
307
307
|
const invalidFormatForAuDriversLicenseNumber = "This isn't a valid Australian driver's license number. Expected format: 6-11 alphanumeric characters.";
|
|
308
308
|
const invalidFormatForAuDriversLicenseCardNumber = "This isn't a valid Australian driver's license card number. Expected format: 6-10 alphanumeric characters.";
|
|
309
309
|
const invalidFormatForAuProofOfIdentityCardNumber = "This isn't a valid Australian proof of identity card number. Expected format: 6-10 alphanumeric characters.";
|
|
310
|
+
const invalidFormatForHKPassportNumber = "Not valid for HK. Format should be: 9-character alphanumeric. For example: K12345599";
|
|
311
|
+
const invalidFormatForHKDriversLicenseNumber = "Not valid for HK. Format should be: 8-character alphanumeric. For example: A1234567";
|
|
312
|
+
const invalidFormatForHKIdentityCardNumber = "Not valid for HK. Format should be: 8 or 9-character alphanumeric. For example: C668668A";
|
|
310
313
|
const invalidFormatIdentityNumberBR = "Please use the CFP format: XXX.XXX.XXX-XX";
|
|
311
314
|
const invalidFormatIdentityNumberDK = "Please use the CPR format: XXXXXX-XXXX";
|
|
312
315
|
const invalidFormatIdentityNumberCA = "Please use the SIN format: XXXXXXXXX";
|
|
@@ -318,6 +321,7 @@ const invalidFormatIdentityNumberSE = "Please use the Personnummer format: YYYYM
|
|
|
318
321
|
const invalidFormatIdentityNumberUS = "Please provide last 4 digits";
|
|
319
322
|
const invalidFormatIdentityNumberUS9 = "Please use the SSN format: XXXXXXXXX";
|
|
320
323
|
const invalidFormatIdentityNumberSG = "Please use the NRIC format: S1234567A";
|
|
324
|
+
const invalidFormatIdentityNumberHK = "Not valid for HK. Format should be: 8 or 9-character alphanumeric. For example: C668668E";
|
|
321
325
|
const invalidFormatBankStatementDescription = "Please ensure your input contains solely letters, digits, currency codes, and the specified special characters: -._,:;'*!@#%()+?¿/「」";
|
|
322
326
|
const residencyCountry = "Country of residence";
|
|
323
327
|
const stateOrProvince = "State or province";
|
|
@@ -334,6 +338,7 @@ const id = "ID";
|
|
|
334
338
|
const driversLicense = "Driver's license";
|
|
335
339
|
const issuerState = "Issuing state";
|
|
336
340
|
const licenseNumber = "Driver license number";
|
|
341
|
+
const driverLicense = "Driver License";
|
|
337
342
|
const licenseCardNumber = "Card number";
|
|
338
343
|
const documents = "Documents";
|
|
339
344
|
const idDocument$1 = "ID Document";
|
|
@@ -410,6 +415,7 @@ const validationPleaseEnterAValidVatNumberWithFormat = "Please enter a valid Tax
|
|
|
410
415
|
const validationPleaseEnterAValidTaxIdNumberWithFormat = "Please enter a valid Tax id number. Expected format: %{format}";
|
|
411
416
|
const aValidAbnShouldBe11Digits = "A valid ABN should be 11 digits.";
|
|
412
417
|
const aValidUenOrGstShouldBe9To10Characters = "A valid UEN/GST should be 9 to 10 characters.";
|
|
418
|
+
const aValidBrnShouldBe8Digits = "A valid BRN should be 8 digits.";
|
|
413
419
|
const validationPleaseEnterAValidUen = "Please enter a valid UEN";
|
|
414
420
|
const validationPleaseEnterAValidIban = "Please enter a valid IBAN";
|
|
415
421
|
const yourIbanShouldBeginWith_ = "Your IBAN should begin with %{countryCode}.";
|
|
@@ -445,6 +451,7 @@ const legalCompanyNameHelper = "Enter the name exactly as it is on your Chamber
|
|
|
445
451
|
const legalCompanyNameHelper__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC)";
|
|
446
452
|
const legalCompanyNameHelper__US = "Enter the name exactly as it appears on your Secretary of State Registration.";
|
|
447
453
|
const legalCompanyNameHelper__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile";
|
|
454
|
+
const legalCompanyNameHelper__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation";
|
|
448
455
|
const accountDetailsDescription = "Provide a few details about you to start accepting live payments.";
|
|
449
456
|
const provideDetails = "Provide details";
|
|
450
457
|
const payoutAccountsDescription = "To set up your account, let us know where to send your payouts.";
|
|
@@ -654,6 +661,7 @@ const numerodeIVA = "Número de IVA";
|
|
|
654
661
|
const NIF = "NIF (Número de Identificación Fiscal)";
|
|
655
662
|
const uen = "Unique Entity Number (UEN)";
|
|
656
663
|
const nric = "National Registration Identity Card (NRIC)";
|
|
664
|
+
const hkid = "HKID Number";
|
|
657
665
|
const NIFdeIVA = "Número de Identificación a efectos de IVA";
|
|
658
666
|
const partitaIVA = "Partita IVA";
|
|
659
667
|
const organisationsnummer = "Organisationsnummer";
|
|
@@ -673,6 +681,7 @@ const cancel = "Cancel";
|
|
|
673
681
|
const leave = "Leave";
|
|
674
682
|
const taxIdNumber = "Tax Identification Number";
|
|
675
683
|
const companyRegistrationNumber = "Company registration number";
|
|
684
|
+
const companyRegistrationNumber__HK = "Company Registration number (CRN)";
|
|
676
685
|
const euVatNumber = "EU VAT number";
|
|
677
686
|
const vatNumber = "VAT number";
|
|
678
687
|
const regonKrsNumber = "REGON / KRS number";
|
|
@@ -924,6 +933,7 @@ const instantVerification = "Instant verification";
|
|
|
924
933
|
const xCharactersLeft = "%{charactersLeft} characters left";
|
|
925
934
|
const goBack = "Go back";
|
|
926
935
|
const businessRegistrationNumber = "Business registration number";
|
|
936
|
+
const businessRegistrationNumber__HK = "Business Registration number (BRN)";
|
|
927
937
|
const doNotHaveBusinessNumber = "I do not have a Business number";
|
|
928
938
|
const enterNameExactlyAsAppearInID = "Enter your first name(s) exactly as it appears on your identity document";
|
|
929
939
|
const enterLastNameExactlyAsAppearInID = "Enter your last name(s) exactly as it appears on your identity document";
|
|
@@ -1266,6 +1276,9 @@ const defaultTrans = {
|
|
|
1266
1276
|
invalidFormatForAuDriversLicenseNumber,
|
|
1267
1277
|
invalidFormatForAuDriversLicenseCardNumber,
|
|
1268
1278
|
invalidFormatForAuProofOfIdentityCardNumber,
|
|
1279
|
+
invalidFormatForHKPassportNumber,
|
|
1280
|
+
invalidFormatForHKDriversLicenseNumber,
|
|
1281
|
+
invalidFormatForHKIdentityCardNumber,
|
|
1269
1282
|
invalidFormatIdentityNumberBR,
|
|
1270
1283
|
invalidFormatIdentityNumberDK,
|
|
1271
1284
|
invalidFormatIdentityNumberCA,
|
|
@@ -1277,6 +1290,7 @@ const defaultTrans = {
|
|
|
1277
1290
|
invalidFormatIdentityNumberUS,
|
|
1278
1291
|
invalidFormatIdentityNumberUS9,
|
|
1279
1292
|
invalidFormatIdentityNumberSG,
|
|
1293
|
+
invalidFormatIdentityNumberHK,
|
|
1280
1294
|
invalidFormatBankStatementDescription,
|
|
1281
1295
|
residencyCountry,
|
|
1282
1296
|
stateOrProvince,
|
|
@@ -1293,6 +1307,7 @@ const defaultTrans = {
|
|
|
1293
1307
|
driversLicense,
|
|
1294
1308
|
issuerState,
|
|
1295
1309
|
licenseNumber,
|
|
1310
|
+
driverLicense,
|
|
1296
1311
|
licenseCardNumber,
|
|
1297
1312
|
documents,
|
|
1298
1313
|
idDocument: idDocument$1,
|
|
@@ -1369,6 +1384,7 @@ const defaultTrans = {
|
|
|
1369
1384
|
validationPleaseEnterAValidTaxIdNumberWithFormat,
|
|
1370
1385
|
aValidAbnShouldBe11Digits,
|
|
1371
1386
|
aValidUenOrGstShouldBe9To10Characters,
|
|
1387
|
+
aValidBrnShouldBe8Digits,
|
|
1372
1388
|
validationPleaseEnterAValidUen,
|
|
1373
1389
|
validationPleaseEnterAValidIban,
|
|
1374
1390
|
yourIbanShouldBeginWith_,
|
|
@@ -1404,6 +1420,7 @@ const defaultTrans = {
|
|
|
1404
1420
|
legalCompanyNameHelper__AU,
|
|
1405
1421
|
legalCompanyNameHelper__US,
|
|
1406
1422
|
legalCompanyNameHelper__SG,
|
|
1423
|
+
legalCompanyNameHelper__HK,
|
|
1407
1424
|
accountDetailsDescription,
|
|
1408
1425
|
provideDetails,
|
|
1409
1426
|
payoutAccountsDescription,
|
|
@@ -1613,6 +1630,7 @@ const defaultTrans = {
|
|
|
1613
1630
|
NIF,
|
|
1614
1631
|
uen,
|
|
1615
1632
|
nric,
|
|
1633
|
+
hkid,
|
|
1616
1634
|
NIFdeIVA,
|
|
1617
1635
|
partitaIVA,
|
|
1618
1636
|
organisationsnummer,
|
|
@@ -1635,6 +1653,7 @@ const defaultTrans = {
|
|
|
1635
1653
|
leave,
|
|
1636
1654
|
taxIdNumber,
|
|
1637
1655
|
companyRegistrationNumber,
|
|
1656
|
+
companyRegistrationNumber__HK,
|
|
1638
1657
|
euVatNumber,
|
|
1639
1658
|
vatNumber,
|
|
1640
1659
|
regonKrsNumber,
|
|
@@ -1897,6 +1916,7 @@ const defaultTrans = {
|
|
|
1897
1916
|
xCharactersLeft,
|
|
1898
1917
|
goBack,
|
|
1899
1918
|
businessRegistrationNumber,
|
|
1919
|
+
businessRegistrationNumber__HK,
|
|
1900
1920
|
doNotHaveBusinessNumber,
|
|
1901
1921
|
"UEN/GST": "Unique Entity Number (UEN)/Goods and Services Tax (GST)",
|
|
1902
1922
|
"IRD/GST": "Inland Revenue Department Number (IRD No)/Goods and Services Tax (GST)",
|
|
@@ -3606,6 +3626,17 @@ const useStaticValidator = (rules2) => {
|
|
|
3606
3626
|
triggerStaticValidation
|
|
3607
3627
|
};
|
|
3608
3628
|
};
|
|
3629
|
+
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
|
|
3630
|
+
if (!schema.length)
|
|
3631
|
+
return staticValidationErrors;
|
|
3632
|
+
return schema.reduce((acc, field) => {
|
|
3633
|
+
var _a;
|
|
3634
|
+
return {
|
|
3635
|
+
...acc,
|
|
3636
|
+
[field]: staticValidationErrors[field] ?? ((_a = asyncValidationErrors[field]) == null ? void 0 : _a.getError()) ?? null
|
|
3637
|
+
};
|
|
3638
|
+
}, {});
|
|
3639
|
+
};
|
|
3609
3640
|
function useForm({
|
|
3610
3641
|
schema,
|
|
3611
3642
|
defaultData,
|
|
@@ -3639,21 +3670,9 @@ function useForm({
|
|
|
3639
3670
|
asyncValidate: triggerAsyncValidation
|
|
3640
3671
|
}), [defaultData, fieldProblems, maskedFields, formatters, getRequiredFields, triggerStaticValidation, triggerAsyncValidation]);
|
|
3641
3672
|
const [state2, dispatch] = s(getReducer(), getInitialData(), init);
|
|
3642
|
-
const [formErrors, setFormErrors] = h(state2.errors);
|
|
3643
|
-
const mergeAsyncErrorsState = T$1((staticValidationErrors, asyncValidationErrors) => {
|
|
3644
|
-
if (!state2.schema.length)
|
|
3645
|
-
return staticValidationErrors;
|
|
3646
|
-
return state2.schema.reduce((acc, field) => {
|
|
3647
|
-
var _a;
|
|
3648
|
-
return {
|
|
3649
|
-
...acc,
|
|
3650
|
-
[field]: staticValidationErrors[field] ?? ((_a = asyncValidationErrors[field]) == null ? void 0 : _a.getError()) ?? null
|
|
3651
|
-
};
|
|
3652
|
-
}, {});
|
|
3653
|
-
}, [state2.schema]);
|
|
3654
3673
|
const isValid = F$1(() => {
|
|
3655
3674
|
var _a;
|
|
3656
|
-
return (_a = state2.schema) == null ? void 0 : _a.
|
|
3675
|
+
return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
|
|
3657
3676
|
}, [state2.schema, state2.valid]);
|
|
3658
3677
|
const getTargetValue = T$1((key, e2) => {
|
|
3659
3678
|
if (!(e2 == null ? void 0 : e2.target))
|
|
@@ -3726,9 +3745,7 @@ function useForm({
|
|
|
3726
3745
|
setFieldProblems(fieldProblems);
|
|
3727
3746
|
}
|
|
3728
3747
|
}, [JSON.stringify(fieldProblems), setFieldProblems]);
|
|
3729
|
-
|
|
3730
|
-
setFormErrors(mergeAsyncErrorsState(state2.errors, asyncValidationResults));
|
|
3731
|
-
}, [mergeAsyncErrorsState, asyncValidationResults, state2.errors]);
|
|
3748
|
+
const formErrors = F$1(() => mergeStaticAndAsyncErrorsState(state2.errors, asyncValidationResults, state2.schema), [asyncValidationResults, state2.errors]);
|
|
3732
3749
|
return {
|
|
3733
3750
|
mergeForm,
|
|
3734
3751
|
setData,
|
|
@@ -5734,6 +5751,13 @@ const countryBasedValidatorRules$1 = {
|
|
|
5734
5751
|
validate: (taxId2) => validateTaxId(taxId2, "SG"),
|
|
5735
5752
|
errorMessage: "aValidUenOrGstShouldBe9To10Characters"
|
|
5736
5753
|
}]
|
|
5754
|
+
},
|
|
5755
|
+
HK: {
|
|
5756
|
+
taxId: [{
|
|
5757
|
+
modes: ["blur"],
|
|
5758
|
+
validate: (taxId2) => validateTaxId(taxId2, "HK"),
|
|
5759
|
+
errorMessage: "aValidBrnShouldBe8Digits"
|
|
5760
|
+
}]
|
|
5737
5761
|
}
|
|
5738
5762
|
};
|
|
5739
5763
|
const taxIdFields = ["taxId", "exemptedFromTax"];
|
|
@@ -7668,7 +7692,7 @@ function CompanyDetailsComponent(props) {
|
|
|
7668
7692
|
...taxIdProps,
|
|
7669
7693
|
dataStoreId: COMPANY_DETAILS,
|
|
7670
7694
|
country: props.country
|
|
7671
|
-
}),
|
|
7695
|
+
}), formUtils.isRequiredField("dateOfIncorporation") && o(Field, {
|
|
7672
7696
|
name: "dateOfIncorporation",
|
|
7673
7697
|
label: formUtils.getLabel("dateOfIncorporation"),
|
|
7674
7698
|
classNameModifiers: ["dateOfIncorporation"],
|
|
@@ -8451,10 +8475,10 @@ const countryConfig$4 = {
|
|
|
8451
8475
|
label: "businessName"
|
|
8452
8476
|
},
|
|
8453
8477
|
registrationNumber: {
|
|
8454
|
-
label: "
|
|
8478
|
+
label: "companyRegistrationNumber__HK"
|
|
8455
8479
|
},
|
|
8456
8480
|
taxId: {
|
|
8457
|
-
label: "
|
|
8481
|
+
label: "businessRegistrationNumber__HK"
|
|
8458
8482
|
}
|
|
8459
8483
|
},
|
|
8460
8484
|
[CountryCodes.Hungary]: {
|
|
@@ -8948,7 +8972,7 @@ var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
|
|
|
8948
8972
|
const SOLE_PROP_COUNTRIES = [CountryCodes.Austria, CountryCodes.Australia, CountryCodes.Belgium, CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.Cyprus, CountryCodes.CzechRepublic, CountryCodes.Denmark, CountryCodes.Estonia, CountryCodes.Finland, CountryCodes.France, CountryCodes.Germany, CountryCodes.Gibraltar, CountryCodes.Greece, CountryCodes.Guernsey, CountryCodes.Hungary, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Italy, CountryCodes.Jersey, CountryCodes.Latvia, CountryCodes.Liechtenstein, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Malta, CountryCodes.Monaco, CountryCodes.Netherlands, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Portugal, CountryCodes.PuertoRico, CountryCodes.Romania, CountryCodes.Singapore, CountryCodes.Slovakia, CountryCodes.Slovenia, CountryCodes.Spain, CountryCodes.Sweden, CountryCodes.Switzerland, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
|
|
8949
8973
|
const ID_NUMBER_EXEMPT_COUNTRIES = [CountryCodes.Canada, CountryCodes.UnitedStates];
|
|
8950
8974
|
const ID_NUMBER_VERIFICATION_COUNTRIES = [CountryCodes.UnitedStates];
|
|
8951
|
-
const COUNTRIES_WHICH_USE_MULTIPLE_IDENTITY_TYPES = [CountryCodes.Australia];
|
|
8975
|
+
const COUNTRIES_WHICH_USE_MULTIPLE_IDENTITY_TYPES = [CountryCodes.HongKong, CountryCodes.Australia];
|
|
8952
8976
|
const ID_NUMBER_REQUIRED_FOR_DIRECTOR_COUNTRIES = [CountryCodes.Singapore];
|
|
8953
8977
|
const NATIONALITY_REQUIRED_FOR_COUNTRIES = [CountryCodes.Singapore];
|
|
8954
8978
|
const rules$2 = ({
|
|
@@ -10010,6 +10034,7 @@ const ADDRESS_SCHEMAS = {
|
|
|
10010
10034
|
[CountryCodes.Canada]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, POSTAL_CODE, STATE],
|
|
10011
10035
|
[CountryCodes.UnitedKingdom]: [COUNTRY, HOUSE_NUMBER, STREET, CITY, POSTAL_CODE, STATE],
|
|
10012
10036
|
[CountryCodes.UnitedStates]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, STATE, POSTAL_CODE],
|
|
10037
|
+
[CountryCodes.HongKong]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, STATE],
|
|
10013
10038
|
default: [COUNTRY, STREET, HOUSE_NUMBER, POSTAL_CODE, CITY, STATE]
|
|
10014
10039
|
};
|
|
10015
10040
|
const LABELS = {
|
|
@@ -10615,156 +10640,103 @@ const countrySpecificFormatters = {
|
|
|
10615
10640
|
postalCode: createFormatByDigits(5)
|
|
10616
10641
|
}
|
|
10617
10642
|
};
|
|
10618
|
-
const createPatternByDigits = (digits) => ({
|
|
10619
|
-
pattern: new RegExp(`\\d{${digits}}`)
|
|
10620
|
-
});
|
|
10643
|
+
const createPatternByDigits = (digits) => new RegExp(`\\d{${digits}}`);
|
|
10621
10644
|
const postalCodePatterns = {
|
|
10622
10645
|
[CountryCodes.Australia]: createPatternByDigits(4),
|
|
10623
10646
|
[CountryCodes.Austria]: createPatternByDigits(4),
|
|
10624
|
-
[CountryCodes.Belgium]: {
|
|
10625
|
-
pattern: /(?:(?:[1-9])(?:\d{3}))/
|
|
10626
|
-
},
|
|
10647
|
+
[CountryCodes.Belgium]: /[1-9]\d{3}/,
|
|
10627
10648
|
[CountryCodes.Brazil]: createPatternByDigits(8),
|
|
10628
10649
|
[CountryCodes.Bulgaria]: createPatternByDigits(4),
|
|
10629
|
-
[CountryCodes.Canada]:
|
|
10630
|
-
|
|
10631
|
-
},
|
|
10632
|
-
[CountryCodes.Croatia]: {
|
|
10633
|
-
pattern: /^([1-5])[0-9]{4}$/
|
|
10634
|
-
},
|
|
10650
|
+
[CountryCodes.Canada]: /[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d/,
|
|
10651
|
+
[CountryCodes.Croatia]: /^([1-5])[0-9]{4}$/,
|
|
10635
10652
|
[CountryCodes.Cyprus]: createPatternByDigits(4),
|
|
10636
|
-
[CountryCodes.CzechRepublic]: {
|
|
10637
|
-
|
|
10638
|
-
},
|
|
10639
|
-
[CountryCodes.Denmark]: {
|
|
10640
|
-
pattern: /^(DK-)?[0-9]{4}$/
|
|
10641
|
-
},
|
|
10653
|
+
[CountryCodes.CzechRepublic]: /\d{3}\s?\d{2}/,
|
|
10654
|
+
[CountryCodes.Denmark]: /^(DK-)?[0-9]{4}$/,
|
|
10642
10655
|
[CountryCodes.Estonia]: createPatternByDigits(5),
|
|
10643
10656
|
[CountryCodes.Finland]: createPatternByDigits(5),
|
|
10644
10657
|
[CountryCodes.France]: createPatternByDigits(5),
|
|
10645
10658
|
[CountryCodes.Georgia]: createPatternByDigits(4),
|
|
10646
10659
|
[CountryCodes.Germany]: createPatternByDigits(5),
|
|
10647
|
-
[CountryCodes.Gibraltar]:
|
|
10648
|
-
|
|
10649
|
-
},
|
|
10650
|
-
[CountryCodes.Greece]: {
|
|
10651
|
-
pattern: /^\d{3}\s{0,1}\d{2}$/
|
|
10652
|
-
},
|
|
10660
|
+
[CountryCodes.Gibraltar]: /^GX11[ -]?1AA$/,
|
|
10661
|
+
[CountryCodes.Greece]: /^\d{3}\s?\d{2}$/,
|
|
10653
10662
|
[CountryCodes.Hungary]: createPatternByDigits(4),
|
|
10654
10663
|
[CountryCodes.Iceland]: createPatternByDigits(3),
|
|
10655
|
-
[CountryCodes.Ireland]: {
|
|
10656
|
-
pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/
|
|
10657
|
-
},
|
|
10664
|
+
[CountryCodes.Ireland]: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/,
|
|
10658
10665
|
[CountryCodes.Italy]: createPatternByDigits(5),
|
|
10659
|
-
[CountryCodes.Japan]: {
|
|
10660
|
-
|
|
10661
|
-
},
|
|
10662
|
-
[CountryCodes.Latvia]: {
|
|
10663
|
-
pattern: /^(LV-)?[0-9]{4}$/
|
|
10664
|
-
},
|
|
10666
|
+
[CountryCodes.Japan]: /^\d{3}-\d{4}$/,
|
|
10667
|
+
[CountryCodes.Latvia]: /^(LV-)?[0-9]{4}$/,
|
|
10665
10668
|
[CountryCodes.Liechtenstein]: createPatternByDigits(4),
|
|
10666
|
-
[CountryCodes.Lithuania]: {
|
|
10667
|
-
pattern: /^(LT-)?[0-9]{4,5}$/
|
|
10668
|
-
},
|
|
10669
|
+
[CountryCodes.Lithuania]: /^(LT-)?[0-9]{4,5}$/,
|
|
10669
10670
|
[CountryCodes.Luxembourg]: createPatternByDigits(4),
|
|
10670
10671
|
[CountryCodes.Malaysia]: createPatternByDigits(5),
|
|
10671
|
-
[CountryCodes.Malta]: {
|
|
10672
|
-
|
|
10673
|
-
}
|
|
10674
|
-
[CountryCodes.Monaco]: {
|
|
10675
|
-
pattern: /^980\d{2}$/
|
|
10676
|
-
},
|
|
10677
|
-
[CountryCodes.Netherlands]: {
|
|
10678
|
-
pattern: /(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/
|
|
10679
|
-
},
|
|
10672
|
+
[CountryCodes.Malta]: /^[A-Za-z]{2,3} ?\d{2}(?:\d{2})?$/,
|
|
10673
|
+
[CountryCodes.Monaco]: /^980\d{2}$/,
|
|
10674
|
+
[CountryCodes.Netherlands]: /(?:NL-)?[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ])/,
|
|
10680
10675
|
[CountryCodes.NewZealand]: createPatternByDigits(4),
|
|
10681
10676
|
[CountryCodes.Norway]: createPatternByDigits(4),
|
|
10682
|
-
[CountryCodes.Poland]: {
|
|
10683
|
-
|
|
10684
|
-
},
|
|
10685
|
-
[CountryCodes.Portugal]: {
|
|
10686
|
-
pattern: /^([1-9]\d{3})([- ]?(\d{3})? *)$/
|
|
10687
|
-
},
|
|
10677
|
+
[CountryCodes.Poland]: /^\d{2}-\d{3}$/,
|
|
10678
|
+
[CountryCodes.Portugal]: /^([1-9]\d{3})([- ]?(\d{3})? *)$/,
|
|
10688
10679
|
[CountryCodes.PuertoRico]: createPatternByDigits(5),
|
|
10689
10680
|
[CountryCodes.Romania]: createPatternByDigits(6),
|
|
10690
|
-
[CountryCodes.Slovakia]: {
|
|
10691
|
-
|
|
10692
|
-
},
|
|
10693
|
-
[CountryCodes.Slovenia]: {
|
|
10694
|
-
pattern: /^(SI-)?[0-9]{4}$/
|
|
10695
|
-
},
|
|
10681
|
+
[CountryCodes.Slovakia]: /^(SK-)?[0-9]{5}$/,
|
|
10682
|
+
[CountryCodes.Slovenia]: /^(SI-)?[0-9]{4}$/,
|
|
10696
10683
|
[CountryCodes.Singapore]: createPatternByDigits(6),
|
|
10697
|
-
[CountryCodes.Spain]: {
|
|
10698
|
-
pattern: /(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/
|
|
10699
|
-
},
|
|
10684
|
+
[CountryCodes.Spain]: /(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/,
|
|
10700
10685
|
[CountryCodes.Sweden]: createPatternByDigits(5),
|
|
10701
|
-
[CountryCodes.Switzerland]: {
|
|
10702
|
-
|
|
10703
|
-
}
|
|
10704
|
-
[CountryCodes.UnitedKingdom]: {
|
|
10705
|
-
pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/
|
|
10706
|
-
},
|
|
10707
|
-
[CountryCodes.UnitedStates]: {
|
|
10708
|
-
pattern: /^(\d{5})([-]?(\d{4})? *)$/
|
|
10709
|
-
}
|
|
10686
|
+
[CountryCodes.Switzerland]: /[1-9]\d{3}/,
|
|
10687
|
+
[CountryCodes.UnitedKingdom]: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/,
|
|
10688
|
+
[CountryCodes.UnitedStates]: /^(\d{5})(-?(\d{4})? *)$/
|
|
10710
10689
|
};
|
|
10711
|
-
const addressValidationRules = {
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
validate: (val, context) => {
|
|
10720
|
-
const {
|
|
10721
|
-
country: country2
|
|
10722
|
-
} = context.state.data;
|
|
10723
|
-
if (country2 && COUNTRIES_WITH_OPTIONAL_HOUSE_NUMBER.includes(country2)) {
|
|
10724
|
-
return true;
|
|
10725
|
-
}
|
|
10726
|
-
return hasText(val);
|
|
10690
|
+
const addressValidationRules = (country2) => {
|
|
10691
|
+
var _a, _b;
|
|
10692
|
+
const postalCodeFormat = (_b = (_a = countrySpecificFormatters[country2]) == null ? void 0 : _a.postalCode) == null ? void 0 : _b.format;
|
|
10693
|
+
return {
|
|
10694
|
+
street: {
|
|
10695
|
+
modes: ["blur"],
|
|
10696
|
+
validate: (val) => hasText(val),
|
|
10697
|
+
errorMessage: "fieldIsRequired"
|
|
10727
10698
|
},
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10699
|
+
houseNumberOrName: {
|
|
10700
|
+
modes: ["blur"],
|
|
10701
|
+
validate: (val) => {
|
|
10702
|
+
if (country2 && COUNTRIES_WITH_OPTIONAL_HOUSE_NUMBER.includes(country2)) {
|
|
10703
|
+
return true;
|
|
10704
|
+
}
|
|
10705
|
+
return hasText(val);
|
|
10706
|
+
},
|
|
10707
|
+
errorMessage: "fieldIsRequired"
|
|
10708
|
+
},
|
|
10709
|
+
postalCode: {
|
|
10710
|
+
modes: ["blur"],
|
|
10711
|
+
validate: (val) => {
|
|
10712
|
+
const pattern = postalCodePatterns[country2];
|
|
10713
|
+
return pattern ? !!val && pattern.test(val) : !!val;
|
|
10714
|
+
},
|
|
10715
|
+
errorMessage: postalCodeFormat ? {
|
|
10716
|
+
translationKey: "invalidFormatExpects",
|
|
10717
|
+
translationObject: {
|
|
10718
|
+
values: {
|
|
10719
|
+
format: postalCodeFormat
|
|
10744
10720
|
}
|
|
10745
|
-
}
|
|
10746
|
-
|
|
10747
|
-
return pattern ? pattern.test(val) : !!val;
|
|
10748
|
-
}
|
|
10749
|
-
return !!val;
|
|
10721
|
+
}
|
|
10722
|
+
} : "invalidFormat"
|
|
10750
10723
|
},
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
}
|
|
10724
|
+
city: {
|
|
10725
|
+
modes: ["blur"],
|
|
10726
|
+
validate: hasText,
|
|
10727
|
+
errorMessage: "fieldIsRequired"
|
|
10728
|
+
},
|
|
10729
|
+
stateOrProvince: {
|
|
10730
|
+
modes: ["blur"],
|
|
10731
|
+
validate: (val) => !!val,
|
|
10732
|
+
errorMessage: "fieldIsRequired"
|
|
10733
|
+
},
|
|
10734
|
+
country: {
|
|
10735
|
+
modes: ["blur"],
|
|
10736
|
+
validate: (val) => !!val,
|
|
10737
|
+
errorMessage: "fieldIsRequired"
|
|
10738
|
+
}
|
|
10739
|
+
};
|
|
10768
10740
|
};
|
|
10769
10741
|
function Address(props) {
|
|
10770
10742
|
const {
|
|
@@ -10795,6 +10767,7 @@ function Address(props) {
|
|
|
10795
10767
|
const addressFields = ADDRESS_SCHEMAS[dataProp == null ? void 0 : dataProp.country] ?? ADDRESS_SCHEMAS.default;
|
|
10796
10768
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
10797
10769
|
const requiredFields = (requiredFieldsProp == null ? void 0 : requiredFieldsProp.includes("stateOrProvince")) || dataProp.country && COUNTRIES_WITH_STATES_DATASET.includes(dataProp.country) ? addressFields : addressFields.filter((ad) => ad !== "stateOrProvince");
|
|
10770
|
+
const rules2 = F$1(() => addressValidationRules(dataProp.country), [dataProp.country]);
|
|
10798
10771
|
const {
|
|
10799
10772
|
data,
|
|
10800
10773
|
errors,
|
|
@@ -10809,7 +10782,7 @@ function Address(props) {
|
|
|
10809
10782
|
schema: requiredFields,
|
|
10810
10783
|
defaultData: dataProp,
|
|
10811
10784
|
formatters: addressFormatters,
|
|
10812
|
-
rules:
|
|
10785
|
+
rules: rules2,
|
|
10813
10786
|
fieldProblems: fieldValidationErrorsProp,
|
|
10814
10787
|
maskedFields: []
|
|
10815
10788
|
});
|
|
@@ -10836,11 +10809,6 @@ function Address(props) {
|
|
|
10836
10809
|
setShowAddAddressButton(false);
|
|
10837
10810
|
}
|
|
10838
10811
|
}, []);
|
|
10839
|
-
p(() => {
|
|
10840
|
-
if (data.postalCode) {
|
|
10841
|
-
handleChangeFor("postalCode", "blur")(data.postalCode);
|
|
10842
|
-
}
|
|
10843
|
-
}, [data.country]);
|
|
10844
10812
|
p(() => {
|
|
10845
10813
|
const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {
|
|
10846
10814
|
if (!formUtils.isRequiredField(cur)) {
|
|
@@ -11555,7 +11523,7 @@ const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_SOLE_PROPS = [
|
|
|
11555
11523
|
CountryCodes.Canada,
|
|
11556
11524
|
CountryCodes.UnitedStates
|
|
11557
11525
|
];
|
|
11558
|
-
const COUNTRIES_THAT_REQUIRE_DATE_OF_INCORPORATION = [CountryCodes.Singapore];
|
|
11526
|
+
const COUNTRIES_THAT_REQUIRE_DATE_OF_INCORPORATION = [CountryCodes.HongKong, CountryCodes.Singapore];
|
|
11559
11527
|
const rules$1 = ({
|
|
11560
11528
|
data,
|
|
11561
11529
|
country: country2,
|
|
@@ -14226,7 +14194,7 @@ ContactDetailsComponent.defaultProps = {
|
|
|
14226
14194
|
data: {}
|
|
14227
14195
|
};
|
|
14228
14196
|
const additionalIdentityInfoFields = ["typeOfIdentity", "licenseCardNumber", "issuerState"];
|
|
14229
|
-
const identityTypes = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
|
|
14197
|
+
const identityTypes$1 = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
|
|
14230
14198
|
function useGlobalData() {
|
|
14231
14199
|
const {
|
|
14232
14200
|
getData
|
|
@@ -14265,25 +14233,25 @@ function useResetGlobalData(caller) {
|
|
|
14265
14233
|
}
|
|
14266
14234
|
}), [dispatch, caller]);
|
|
14267
14235
|
}
|
|
14268
|
-
const isTruthyValidator = {
|
|
14236
|
+
const isTruthyValidator$1 = {
|
|
14269
14237
|
validate: (value) => !!value,
|
|
14270
14238
|
modes: ["blur"],
|
|
14271
14239
|
errorMessage: "fieldIsRequired"
|
|
14272
14240
|
};
|
|
14273
|
-
const PASSPORT_NUMBER_PATTERN = /^[A-Z]{1,2}\d{7}$/;
|
|
14274
|
-
const DRIVERS_LICENSE_NUMBER_PATTERN = /^[A-Za-z\d]{6,11}$/;
|
|
14275
|
-
const PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN = /^[A-Za-z\d]{6,10}$/;
|
|
14241
|
+
const PASSPORT_NUMBER_PATTERN$1 = /^[A-Z]{1,2}\d{7}$/;
|
|
14242
|
+
const DRIVERS_LICENSE_NUMBER_PATTERN$1 = /^[A-Za-z\d]{6,11}$/;
|
|
14243
|
+
const PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN$1 = /^[A-Za-z\d]{6,10}$/;
|
|
14276
14244
|
const auIdentityValidationRules = {
|
|
14277
|
-
typeOfIdentity: [isTruthyValidator],
|
|
14245
|
+
typeOfIdentity: [isTruthyValidator$1],
|
|
14278
14246
|
idNumber: [{
|
|
14279
14247
|
validate: (value, context) => {
|
|
14280
14248
|
switch (context.state.data.typeOfIdentity) {
|
|
14281
14249
|
case "passport":
|
|
14282
|
-
return PASSPORT_NUMBER_PATTERN.test(value);
|
|
14250
|
+
return PASSPORT_NUMBER_PATTERN$1.test(value);
|
|
14283
14251
|
case "driversLicense":
|
|
14284
|
-
return DRIVERS_LICENSE_NUMBER_PATTERN.test(value);
|
|
14252
|
+
return DRIVERS_LICENSE_NUMBER_PATTERN$1.test(value);
|
|
14285
14253
|
case "proofOfIdentityCard":
|
|
14286
|
-
return PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN.test(value);
|
|
14254
|
+
return PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN$1.test(value);
|
|
14287
14255
|
}
|
|
14288
14256
|
},
|
|
14289
14257
|
errorMessage: (value, context) => {
|
|
@@ -14299,13 +14267,13 @@ const auIdentityValidationRules = {
|
|
|
14299
14267
|
modes: ["blur"]
|
|
14300
14268
|
}],
|
|
14301
14269
|
licenseCardNumber: [{
|
|
14302
|
-
validate: (value) => DRIVERS_LICENSE_NUMBER_PATTERN.test(value),
|
|
14270
|
+
validate: (value) => DRIVERS_LICENSE_NUMBER_PATTERN$1.test(value),
|
|
14303
14271
|
errorMessage: "invalidFormatForAuDriversLicenseCardNumber",
|
|
14304
14272
|
modes: ["blur"]
|
|
14305
14273
|
}],
|
|
14306
|
-
issuerState: [isTruthyValidator]
|
|
14274
|
+
issuerState: [isTruthyValidator$1]
|
|
14307
14275
|
};
|
|
14308
|
-
const DriversLicense = ({
|
|
14276
|
+
const DriversLicense$1 = ({
|
|
14309
14277
|
driversLicense: driversLicense2,
|
|
14310
14278
|
onIssuerStateChange,
|
|
14311
14279
|
onLicenseNumberInput,
|
|
@@ -14383,7 +14351,7 @@ const DriversLicense = ({
|
|
|
14383
14351
|
})]
|
|
14384
14352
|
});
|
|
14385
14353
|
};
|
|
14386
|
-
const PassportNumber = ({
|
|
14354
|
+
const PassportNumber$1 = ({
|
|
14387
14355
|
passportNumber: passportNumber2,
|
|
14388
14356
|
onInput,
|
|
14389
14357
|
onBlur,
|
|
@@ -14406,7 +14374,7 @@ const PassportNumber = ({
|
|
|
14406
14374
|
placeholder: ""
|
|
14407
14375
|
})
|
|
14408
14376
|
});
|
|
14409
|
-
const ProofOfIdentityCard = ({
|
|
14377
|
+
const ProofOfIdentityCard$1 = ({
|
|
14410
14378
|
cardNumber,
|
|
14411
14379
|
onInput,
|
|
14412
14380
|
onBlur,
|
|
@@ -14429,11 +14397,11 @@ const ProofOfIdentityCard = ({
|
|
|
14429
14397
|
placeholder: ""
|
|
14430
14398
|
})
|
|
14431
14399
|
});
|
|
14432
|
-
const mapIdentityTypeToItem = (type, label) => ({
|
|
14400
|
+
const mapIdentityTypeToItem$1 = (type, label) => ({
|
|
14433
14401
|
id: type,
|
|
14434
14402
|
name: label
|
|
14435
14403
|
});
|
|
14436
|
-
const TypeOfIdentity = ({
|
|
14404
|
+
const TypeOfIdentity$1 = ({
|
|
14437
14405
|
availableIdentityTypes,
|
|
14438
14406
|
selectedIdentityType,
|
|
14439
14407
|
setSelectedIdentityType,
|
|
@@ -14455,7 +14423,7 @@ const TypeOfIdentity = ({
|
|
|
14455
14423
|
children: (childProps) => o(Select, {
|
|
14456
14424
|
...childProps,
|
|
14457
14425
|
isInvalid: false,
|
|
14458
|
-
items: availableIdentityTypes.map((type) => mapIdentityTypeToItem(type, i18n.get(type))),
|
|
14426
|
+
items: availableIdentityTypes.map((type) => mapIdentityTypeToItem$1(type, i18n.get(type))),
|
|
14459
14427
|
placeholder: i18n.get("id"),
|
|
14460
14428
|
selected: selectedIdentityType,
|
|
14461
14429
|
onChange: (event) => setSelectedIdentityType(event.target.value)
|
|
@@ -14483,7 +14451,6 @@ function IdentityAuComponent(props) {
|
|
|
14483
14451
|
maskedFields: props.maskedFields
|
|
14484
14452
|
});
|
|
14485
14453
|
p(() => {
|
|
14486
|
-
console.log("triggerValidation");
|
|
14487
14454
|
if (data.typeOfIdentity)
|
|
14488
14455
|
triggerValidation(["idNumber"]);
|
|
14489
14456
|
}, [data.typeOfIdentity]);
|
|
@@ -14505,28 +14472,28 @@ function IdentityAuComponent(props) {
|
|
|
14505
14472
|
} = useCoreContext();
|
|
14506
14473
|
const formUtils = formUtilities(props, i18n);
|
|
14507
14474
|
return o(Fragment, {
|
|
14508
|
-
children: [o(TypeOfIdentity, {
|
|
14509
|
-
availableIdentityTypes: identityTypes.filter((type) => type !== "nationalIdNumber"),
|
|
14475
|
+
children: [o(TypeOfIdentity$1, {
|
|
14476
|
+
availableIdentityTypes: identityTypes$1.filter((type) => type !== "nationalIdNumber"),
|
|
14510
14477
|
selectedIdentityType: data.typeOfIdentity,
|
|
14511
14478
|
setSelectedIdentityType: handleChangeFor("typeOfIdentity"),
|
|
14512
14479
|
formUtils,
|
|
14513
14480
|
isValid: valid.typeOfIdentity,
|
|
14514
14481
|
errorMessage: formUtils.getErrorMessage("typeOfIdentity", errors, fieldProblems)
|
|
14515
|
-
}), data.typeOfIdentity === "passport" ? o(PassportNumber, {
|
|
14482
|
+
}), data.typeOfIdentity === "passport" ? o(PassportNumber$1, {
|
|
14516
14483
|
passportNumber: data.idNumber,
|
|
14517
14484
|
onInput: handleChangeFor("idNumber", "input"),
|
|
14518
14485
|
onBlur: handleChangeFor("idNumber", "blur"),
|
|
14519
14486
|
formUtils,
|
|
14520
14487
|
isValid: valid.idNumber,
|
|
14521
14488
|
errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
|
|
14522
|
-
}) : data.typeOfIdentity === "proofOfIdentityCard" ? o(ProofOfIdentityCard, {
|
|
14489
|
+
}) : data.typeOfIdentity === "proofOfIdentityCard" ? o(ProofOfIdentityCard$1, {
|
|
14523
14490
|
cardNumber: data.idNumber,
|
|
14524
14491
|
onInput: handleChangeFor("idNumber", "input"),
|
|
14525
14492
|
onBlur: handleChangeFor("idNumber", "blur"),
|
|
14526
14493
|
formUtils,
|
|
14527
14494
|
isValid: valid.idNumber,
|
|
14528
14495
|
errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
|
|
14529
|
-
}) : data.typeOfIdentity === "driversLicense" ? o(DriversLicense, {
|
|
14496
|
+
}) : data.typeOfIdentity === "driversLicense" ? o(DriversLicense$1, {
|
|
14530
14497
|
driversLicense: data,
|
|
14531
14498
|
onIssuerStateChange: handleChangeFor("issuerState"),
|
|
14532
14499
|
onLicenseNumberInput: handleChangeFor("idNumber", "input"),
|
|
@@ -14548,6 +14515,250 @@ function IdentityAuComponent(props) {
|
|
|
14548
14515
|
});
|
|
14549
14516
|
}
|
|
14550
14517
|
const auIdentityFields = [...additionalIdentityInfoFields, "idNumber"];
|
|
14518
|
+
const identityTypes = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
|
|
14519
|
+
const PASSPORT_NUMBER_PATTERN = /^(?=.{9}$)[A-Z]{1,2}\d{6}[A-Z0-9]{1,2}$/;
|
|
14520
|
+
const DRIVERS_LICENSE_NUMBER_PATTERN = /^[A-Z]{1}[A-Z0-9]{7}$/;
|
|
14521
|
+
const PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN = /^[A-Z]{1,2}[0-9]{6}[0-9A]$/;
|
|
14522
|
+
const isValidatePassportNumber = (value) => PASSPORT_NUMBER_PATTERN.test(value);
|
|
14523
|
+
const isTruthyValidator = {
|
|
14524
|
+
validate: (value) => !!value,
|
|
14525
|
+
modes: ["blur"],
|
|
14526
|
+
errorMessage: "fieldIsRequired"
|
|
14527
|
+
};
|
|
14528
|
+
const identityValidationRules = {
|
|
14529
|
+
typeOfIdentity: [isTruthyValidator],
|
|
14530
|
+
idNumber: [{
|
|
14531
|
+
validate: (val, context) => {
|
|
14532
|
+
const value = val ?? "";
|
|
14533
|
+
switch (context == null ? void 0 : context.state.data.typeOfIdentity) {
|
|
14534
|
+
case "passport":
|
|
14535
|
+
return isValidatePassportNumber(value);
|
|
14536
|
+
case "driversLicense":
|
|
14537
|
+
return DRIVERS_LICENSE_NUMBER_PATTERN.test(value);
|
|
14538
|
+
case "proofOfIdentityCard":
|
|
14539
|
+
return PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN.test(value);
|
|
14540
|
+
default:
|
|
14541
|
+
return false;
|
|
14542
|
+
}
|
|
14543
|
+
},
|
|
14544
|
+
errorMessage: (_2, context) => {
|
|
14545
|
+
switch (context == null ? void 0 : context.state.data.typeOfIdentity) {
|
|
14546
|
+
case "passport":
|
|
14547
|
+
return "invalidFormatForHKPassportNumber";
|
|
14548
|
+
case "driversLicense":
|
|
14549
|
+
return "invalidFormatForHKDriversLicenseNumber";
|
|
14550
|
+
case "proofOfIdentityCard":
|
|
14551
|
+
return "invalidFormatForHKIdentityCardNumber";
|
|
14552
|
+
}
|
|
14553
|
+
},
|
|
14554
|
+
modes: ["blur"]
|
|
14555
|
+
}],
|
|
14556
|
+
licenseCardNumber: [{
|
|
14557
|
+
validate: (value) => DRIVERS_LICENSE_NUMBER_PATTERN.test(value ?? ""),
|
|
14558
|
+
errorMessage: "invalidFormatForHKDriversLicenseNumber",
|
|
14559
|
+
modes: ["blur"]
|
|
14560
|
+
}],
|
|
14561
|
+
issuerState: [isTruthyValidator]
|
|
14562
|
+
};
|
|
14563
|
+
const DriversLicense = ({
|
|
14564
|
+
driversLicense: driversLicense2,
|
|
14565
|
+
onLicenseNumberInput,
|
|
14566
|
+
onLicenseNumberBlur,
|
|
14567
|
+
isValid,
|
|
14568
|
+
errorMessages,
|
|
14569
|
+
label
|
|
14570
|
+
}) => {
|
|
14571
|
+
const {
|
|
14572
|
+
i18n
|
|
14573
|
+
} = useCoreContext();
|
|
14574
|
+
return o(Fragment, {
|
|
14575
|
+
children: [o("div", {
|
|
14576
|
+
className: "adyen-kyc-field-wrapper",
|
|
14577
|
+
children: o(Field, {
|
|
14578
|
+
name: "licenseNumber",
|
|
14579
|
+
label,
|
|
14580
|
+
isValid: isValid.idNumber,
|
|
14581
|
+
errorMessage: errorMessages.idNumber,
|
|
14582
|
+
children: (childProps) => o(InputText, {
|
|
14583
|
+
...childProps,
|
|
14584
|
+
name: "licenseNumber",
|
|
14585
|
+
value: driversLicense2.idNumber,
|
|
14586
|
+
onInput: onLicenseNumberInput,
|
|
14587
|
+
onBlur: onLicenseNumberBlur,
|
|
14588
|
+
placeholder: ""
|
|
14589
|
+
})
|
|
14590
|
+
})
|
|
14591
|
+
}), o(ContextGuidance, {
|
|
14592
|
+
page: "Personal details",
|
|
14593
|
+
title: i18n.get("whereCanIFindTheseNumbersOnMyDriversLicense"),
|
|
14594
|
+
content: o(Fragment, {
|
|
14595
|
+
children: [i18n.get("whereToFindNumbersOnDriversLicense"), " ", o("a", {
|
|
14596
|
+
href: "https://www.usi.gov.au/about/forms-id/drivers-licence",
|
|
14597
|
+
target: "_blank",
|
|
14598
|
+
rel: "noreferrer",
|
|
14599
|
+
children: i18n.get("iStillCantFindIt")
|
|
14600
|
+
})]
|
|
14601
|
+
}),
|
|
14602
|
+
titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
|
|
14603
|
+
contentId: "whereToFindNumbersOnDriversLicense"
|
|
14604
|
+
})]
|
|
14605
|
+
});
|
|
14606
|
+
};
|
|
14607
|
+
const PassportNumber = ({
|
|
14608
|
+
passportNumber: passportNumber2,
|
|
14609
|
+
onInput,
|
|
14610
|
+
onBlur,
|
|
14611
|
+
errorMessage,
|
|
14612
|
+
isValid,
|
|
14613
|
+
label
|
|
14614
|
+
}) => o(Field, {
|
|
14615
|
+
name: "passportNumber",
|
|
14616
|
+
label,
|
|
14617
|
+
errorMessage,
|
|
14618
|
+
isValid,
|
|
14619
|
+
children: (childProps) => o(InputText, {
|
|
14620
|
+
...childProps,
|
|
14621
|
+
name: "passportNumber",
|
|
14622
|
+
value: passportNumber2,
|
|
14623
|
+
onInput,
|
|
14624
|
+
onBlur,
|
|
14625
|
+
placeholder: ""
|
|
14626
|
+
})
|
|
14627
|
+
});
|
|
14628
|
+
const ProofOfIdentityCard = ({
|
|
14629
|
+
cardNumber,
|
|
14630
|
+
onInput,
|
|
14631
|
+
onBlur,
|
|
14632
|
+
label,
|
|
14633
|
+
errorMessage,
|
|
14634
|
+
isValid
|
|
14635
|
+
}) => o(Field, {
|
|
14636
|
+
name: "cardNumber",
|
|
14637
|
+
label,
|
|
14638
|
+
errorMessage,
|
|
14639
|
+
isValid,
|
|
14640
|
+
children: (childProps) => o(InputText, {
|
|
14641
|
+
...childProps,
|
|
14642
|
+
name: "cardNumber",
|
|
14643
|
+
value: cardNumber,
|
|
14644
|
+
onInput,
|
|
14645
|
+
onBlur,
|
|
14646
|
+
placeholder: ""
|
|
14647
|
+
})
|
|
14648
|
+
});
|
|
14649
|
+
const mapIdentityTypeToItem = (type, label) => ({
|
|
14650
|
+
id: type,
|
|
14651
|
+
name: label
|
|
14652
|
+
});
|
|
14653
|
+
const TypeOfIdentity = ({
|
|
14654
|
+
availableIdentityTypes,
|
|
14655
|
+
selectedIdentityType,
|
|
14656
|
+
setSelectedIdentityType,
|
|
14657
|
+
formUtils: {
|
|
14658
|
+
getLabel
|
|
14659
|
+
},
|
|
14660
|
+
errorMessage,
|
|
14661
|
+
isValid
|
|
14662
|
+
}) => {
|
|
14663
|
+
const {
|
|
14664
|
+
i18n
|
|
14665
|
+
} = useCoreContext();
|
|
14666
|
+
return o(Field, {
|
|
14667
|
+
name: "typeOfIdentity",
|
|
14668
|
+
label: getLabel("typeOfIdentity"),
|
|
14669
|
+
errorMessage,
|
|
14670
|
+
isValid,
|
|
14671
|
+
helper: i18n.get("typeOfIdentitySubtitle"),
|
|
14672
|
+
children: (childProps) => o(Select, {
|
|
14673
|
+
...childProps,
|
|
14674
|
+
isInvalid: false,
|
|
14675
|
+
items: availableIdentityTypes.map((type) => mapIdentityTypeToItem(type, i18n.get(type))),
|
|
14676
|
+
placeholder: i18n.get("id"),
|
|
14677
|
+
selected: selectedIdentityType,
|
|
14678
|
+
onChange: (event) => setSelectedIdentityType(event.target.value)
|
|
14679
|
+
})
|
|
14680
|
+
});
|
|
14681
|
+
};
|
|
14682
|
+
function IdentityHKComponent(props) {
|
|
14683
|
+
var _a;
|
|
14684
|
+
if (((_a = props.data) == null ? void 0 : _a.typeOfIdentity) === "nationalIdNumber") {
|
|
14685
|
+
props.data.typeOfIdentity = void 0;
|
|
14686
|
+
}
|
|
14687
|
+
const {
|
|
14688
|
+
handleChangeFor,
|
|
14689
|
+
triggerValidation,
|
|
14690
|
+
data,
|
|
14691
|
+
errors,
|
|
14692
|
+
fieldProblems,
|
|
14693
|
+
valid
|
|
14694
|
+
} = useForm({
|
|
14695
|
+
...props,
|
|
14696
|
+
schema: props.requiredFields ?? [],
|
|
14697
|
+
defaultData: props.data,
|
|
14698
|
+
fieldProblems: props.fieldValidationErrors,
|
|
14699
|
+
rules: identityValidationRules,
|
|
14700
|
+
maskedFields: props.maskedFields
|
|
14701
|
+
});
|
|
14702
|
+
p(() => {
|
|
14703
|
+
if (data.typeOfIdentity) {
|
|
14704
|
+
triggerValidation(["idNumber"]);
|
|
14705
|
+
}
|
|
14706
|
+
}, [data.typeOfIdentity]);
|
|
14707
|
+
const {
|
|
14708
|
+
sliceData,
|
|
14709
|
+
updateStateSlice
|
|
14710
|
+
} = useGlobalDataSlice("personalDetails");
|
|
14711
|
+
p(() => {
|
|
14712
|
+
updateStateSlice({
|
|
14713
|
+
data: {
|
|
14714
|
+
...sliceData,
|
|
14715
|
+
...data
|
|
14716
|
+
},
|
|
14717
|
+
errors,
|
|
14718
|
+
valid,
|
|
14719
|
+
fieldProblems
|
|
14720
|
+
});
|
|
14721
|
+
}, [data, errors, valid, fieldProblems]);
|
|
14722
|
+
const {
|
|
14723
|
+
i18n
|
|
14724
|
+
} = useCoreContext();
|
|
14725
|
+
const formUtils = formUtilities(props, i18n);
|
|
14726
|
+
return o(Fragment, {
|
|
14727
|
+
children: [o(TypeOfIdentity, {
|
|
14728
|
+
availableIdentityTypes: identityTypes.filter((type) => type !== "nationalIdNumber"),
|
|
14729
|
+
selectedIdentityType: data.typeOfIdentity,
|
|
14730
|
+
setSelectedIdentityType: handleChangeFor("typeOfIdentity"),
|
|
14731
|
+
formUtils,
|
|
14732
|
+
isValid: valid.typeOfIdentity,
|
|
14733
|
+
errorMessage: formUtils.getErrorMessage("typeOfIdentity", errors, fieldProblems)
|
|
14734
|
+
}), data.typeOfIdentity === "passport" ? o(PassportNumber, {
|
|
14735
|
+
passportNumber: data.idNumber ?? "",
|
|
14736
|
+
onInput: handleChangeFor("idNumber", "input"),
|
|
14737
|
+
onBlur: handleChangeFor("idNumber", "blur"),
|
|
14738
|
+
isValid: valid.idNumber,
|
|
14739
|
+
label: formUtils.getLabel("idNumber", "passportNumber"),
|
|
14740
|
+
errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
|
|
14741
|
+
}) : data.typeOfIdentity === "proofOfIdentityCard" ? o(ProofOfIdentityCard, {
|
|
14742
|
+
cardNumber: data.idNumber ?? "",
|
|
14743
|
+
onInput: handleChangeFor("idNumber", "input"),
|
|
14744
|
+
onBlur: handleChangeFor("idNumber", "blur"),
|
|
14745
|
+
isValid: valid.idNumber,
|
|
14746
|
+
label: formUtils.getLabel("idNumber", "hkid"),
|
|
14747
|
+
errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
|
|
14748
|
+
}) : data.typeOfIdentity === "driversLicense" ? o(DriversLicense, {
|
|
14749
|
+
driversLicense: data,
|
|
14750
|
+
onLicenseNumberInput: handleChangeFor("idNumber", "input"),
|
|
14751
|
+
onLicenseNumberBlur: handleChangeFor("idNumber", "blur"),
|
|
14752
|
+
label: formUtils.getLabel("idNumber", "driverLicense"),
|
|
14753
|
+
isValid: {
|
|
14754
|
+
idNumber: valid.idNumber
|
|
14755
|
+
},
|
|
14756
|
+
errorMessages: {
|
|
14757
|
+
idNumber: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
|
|
14758
|
+
}
|
|
14759
|
+
}) : void 0]
|
|
14760
|
+
});
|
|
14761
|
+
}
|
|
14551
14762
|
const IdentityNumber$1 = "";
|
|
14552
14763
|
function validCheckCharacter(input, calculationInput) {
|
|
14553
14764
|
if (!/^[A-Z]$/.test(input)) {
|
|
@@ -15425,7 +15636,10 @@ function PersonalDetailsComponent(props) {
|
|
|
15425
15636
|
onDropdownChange: handleChangeFor("residencyCountry", "input"),
|
|
15426
15637
|
value: data.residencyCountry,
|
|
15427
15638
|
readOnly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask
|
|
15428
|
-
}), hasRequiredFields(identityProps) && (data.residencyCountry === "
|
|
15639
|
+
}), hasRequiredFields(identityProps) && (data.residencyCountry === "HK" ? o(IdentityHKComponent, {
|
|
15640
|
+
...identityAuProps,
|
|
15641
|
+
dataStoreId: PERSONAL_DETAILS
|
|
15642
|
+
}) : data.residencyCountry === "AU" ? o(IdentityAuComponent, {
|
|
15429
15643
|
...identityAuProps,
|
|
15430
15644
|
dataStoreId: PERSONAL_DETAILS
|
|
15431
15645
|
}) : data.residencyCountry === "US" ? o(IdentityUSComponent, {
|
|
@@ -15439,7 +15653,7 @@ function PersonalDetailsComponent(props) {
|
|
|
15439
15653
|
errors: externalErrors,
|
|
15440
15654
|
country: data.residencyCountry,
|
|
15441
15655
|
dataStoreId: PERSONAL_DETAILS
|
|
15442
|
-
})), data.residencyCountry === "SG" && formUtils.isRequiredField("nationality") && o(CountryField, {
|
|
15656
|
+
})), (data.residencyCountry === "SG" || data.residencyCountry === "HK") && formUtils.isRequiredField("nationality") && o(CountryField, {
|
|
15443
15657
|
label: formUtils.getLabel("nationality"),
|
|
15444
15658
|
classNameModifiers: ["nationality"],
|
|
15445
15659
|
errorMessage: formUtils.getErrorMessage("nationality", errors, fieldProblems),
|