@adyen/kyc-components 2.0.0 → 2.1.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 (58) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1413 -933
  2. package/dist/style.css +2 -1
  3. package/dist/types/components/DocumentUpload/types.d.ts +3 -3
  4. package/dist/types/components/Dropins/DropinLayout/ActionBar/ActionBar.d.ts +1 -1
  5. package/dist/types/components/Dropins/DropinLayout/ActionBar/type.d.ts +1 -0
  6. package/dist/types/components/Dropins/FormComposer/FormComposer.d.ts +1 -1
  7. package/dist/types/components/Dropins/FormComposer/components/FormNavigation/FormNavigationItem.d.ts +3 -0
  8. package/dist/types/components/Dropins/FormComposer/components/FormNavigation/types.d.ts +7 -11
  9. package/dist/types/components/Dropins/FormComposer/types.d.ts +2 -3
  10. package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +39 -0
  11. package/dist/types/components/Dropins/IndividualDropin/components/IndividualDropinComponent.d.ts +1 -1
  12. package/dist/types/components/Dropins/PayoutDetailsDropin/components/PayoutDetailsDropinComponent.d.ts +1 -1
  13. package/dist/types/components/Dropins/PciDropin/validate.d.ts +1 -1
  14. package/dist/types/components/IdentityNumber/component/IdentityNumberComponent.d.ts +1 -1
  15. package/dist/types/components/Individual/component/IndividualComponent.d.ts +2 -2
  16. package/dist/types/components/Individual/types.d.ts +5 -4
  17. package/dist/types/components/PayoutVerificationMethod/allowedBankCountriesPerCountry.d.ts +1 -1
  18. package/dist/types/components/TaskList/component/TaskListItem.d.ts +1 -1
  19. package/dist/types/components/TaskList/types.d.ts +3 -1
  20. package/dist/types/components/internal/Address/types.d.ts +4 -5
  21. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  22. package/dist/types/components/internal/Iban/ibanValidator.d.ts +1 -1
  23. package/dist/types/components/internal/PhoneInput/PhoneInput.d.ts +1 -1
  24. package/dist/types/components/internal/VatNumber/vatNumberValidation.d.ts +1 -1
  25. package/dist/types/core/Context/StateContext/hasDataChanged.d.ts +1 -0
  26. package/dist/types/core/Services/get-images.d.ts +1 -1
  27. package/dist/types/core/hooks/useAsyncValidator.d.ts +2 -2
  28. package/dist/types/core/hooks/useForm/reducer.d.ts +35 -3
  29. package/dist/types/core/hooks/useForm/types.d.ts +28 -73
  30. package/dist/types/core/hooks/useForm/useForm.d.ts +7 -7
  31. package/dist/types/core/hooks/useForm/utils.d.ts +2 -0
  32. package/dist/types/core/hooks/useFormComposer.d.ts +22 -0
  33. package/dist/types/core/hooks/useScenarioConfiguration.d.ts +5 -5
  34. package/dist/types/core/models/errors/entity-problems.d.ts +1 -1
  35. package/dist/types/core/models/form-rules.d.ts +2 -2
  36. package/dist/types/core/models/form.d.ts +5 -3
  37. package/dist/types/core/process-field-configurations.d.ts +11 -26
  38. package/dist/types/language/config.d.ts +5 -0
  39. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  40. package/dist/types/utils/dropin-utils.d.ts +18 -0
  41. package/dist/types/utils/entity-status-util.d.ts +2 -2
  42. package/dist/types/utils/entriesOf.d.ts +2 -0
  43. package/dist/types/utils/formUtils.d.ts +1 -1
  44. package/dist/types/utils/get-props.d.ts +2 -3
  45. package/dist/types/utils/getFieldsWithExistingData.d.ts +8 -0
  46. package/dist/types/utils/mapping/documentGuidanceMap.d.ts +1 -2
  47. package/dist/types/utils/mapping/mapping.d.ts +2 -1
  48. package/dist/types/utils/regex/countryIdNumberPatterns.d.ts +1 -1
  49. package/dist/types/utils/trackNavigation.d.ts +10 -0
  50. package/dist/types/utils/trust-util.d.ts +1 -1
  51. package/dist/types/utils/validation/ValidationResult.d.ts +1 -1
  52. package/dist/types/utils/validation/Validator.d.ts +4 -4
  53. package/dist/types/utils/validation/types.d.ts +19 -19
  54. package/dist/types/utils/validatorUtils.d.ts +2 -2
  55. package/package.json +1 -1
  56. package/dist/types/components/Dropins/FormComposer/components/FormNavigation/components/FormNavigationItem/FormNavigationItem.d.ts +0 -4
  57. package/dist/types/components/Dropins/FormComposer/components/FormNavigation/components/FormNavigationItem/index.d.ts +0 -1
  58. package/dist/types/core/models/errors/field-errors.d.ts +0 -4
@@ -310,6 +310,13 @@ function removeObjectPropsWithEmptyValues(obj) {
310
310
  });
311
311
  return obj;
312
312
  }
313
+ const entriesOf = (object) => Object.entries(object);
314
+ const hasDataChanged = (initialData, currentData) => entriesOf(currentData ?? {}).some(([key, value]) => {
315
+ if (typeof value === "object") {
316
+ return !objectsDeepEqual(value, initialData == null ? void 0 : initialData[key]);
317
+ }
318
+ return value !== (initialData == null ? void 0 : initialData[key]);
319
+ });
313
320
  const INITIAL_STATE = {
314
321
  data: {},
315
322
  allData: {},
@@ -325,13 +332,7 @@ function StateReducer() {
325
332
  const setCurrentForms = (forms) => {
326
333
  setActiveForms(forms);
327
334
  };
328
- const hasDataChanged = (initialData, currentData) => Object.entries(currentData ?? {}).some(([key, value]) => {
329
- if (typeof value === "object") {
330
- return !objectsDeepEqual(value, initialData == null ? void 0 : initialData[key]);
331
- }
332
- return value !== (initialData == null ? void 0 : initialData[key]);
333
- });
334
- function reducer({
335
+ function reducer2({
335
336
  currentState: currState
336
337
  }, action) {
337
338
  var _a, _b, _c, _d, _e;
@@ -456,7 +457,7 @@ function StateReducer() {
456
457
  }
457
458
  }
458
459
  return {
459
- reducer,
460
+ reducer: reducer2,
460
461
  setCurrentForms
461
462
  };
462
463
  }
@@ -661,6 +662,7 @@ const doNotHaveLtRegistrationNumber = "I do not have a Įmonės kodas";
661
662
  const doNotHaveLuRegistrationNumber = "I do not have a Numéro registre de commerce et des sociétés (RCS)";
662
663
  const doNotHaveChRegistrationNumber = "I do not have a Unternehmens-Identifikationsnummer (UID), Numéro d’identification des entreprises (IDE), Numero d’identificazione delle imprese (IDI), or CH-number";
663
664
  const doNotHaveHandelsregisternummer = "I do not have a Handelsregisternummer";
665
+ const doNotHaveRegonKrsNumber = "I do not have a REGON";
664
666
  const taxIdAbsenceReason = "Tax ID absence reason";
665
667
  const vatNumberExempted = "Exempted from VAT";
666
668
  const vatNumberAbsenceReason = "VAT number absence reason";
@@ -939,6 +941,7 @@ const regonKrsNumber = "REGON / KRS number";
939
941
  const registrationNumber = "Registration number";
940
942
  const registrationNumber__nonProfit__FR = "SIRET or RNA";
941
943
  const registrationNumber__FR = "SIRET";
944
+ const registrationNumber__PR = "EIN";
942
945
  const charityNumber = "Charity number";
943
946
  const firmenbuchnummer = "Firmenbuchnummer";
944
947
  const firmenbuchnummerOrZVR = "Firmenbuchnummer or ZVR number";
@@ -1103,6 +1106,7 @@ const Xcharacters = "%{x} characters";
1103
1106
  const XtoYcharacters = "%{x} to %{y} characters";
1104
1107
  const XdigitsAndYcharacters = "%{x} digits + %{y} characters";
1105
1108
  const Cchar5digits = "C99999";
1109
+ const characterPlusXToYDigitsWithOptionalSpace = "%{c} + optional space + %{x}-%{y} digits";
1106
1110
  const cop1to8digits = "C, O, or P, followed by a number from 1 up to 8 digits";
1107
1111
  const provideAllOwners = "Add <strong>all owners</strong> holding 25% or more of your company.";
1108
1112
  const ifNoOwnersSpecifyControllingPersons = "If you don’t have any owners holding 25% or more, then specify <strong>all controlling persons</strong>.";
@@ -1398,6 +1402,7 @@ const errorMessage_1_7019 = "The bank document wasn't issued in the past 12 mont
1398
1402
  const errorMessage_1_7020 = "The bank name didn't match the one on the bank document.";
1399
1403
  const errorMessage_1_7021 = "The bank document didn't show an official bank logo.";
1400
1404
  const errorMessage_1_7022 = "The bank document didn't show an official bank stamp.";
1405
+ const errorMessage_3_10 = "Review of data is required";
1401
1406
  const remediationMessage_1_100 = "No remediation possible";
1402
1407
  const remediationMessage_1_101 = "Contact Support";
1403
1408
  const remediationMessage_1_102 = "Upload a different document";
@@ -1434,6 +1439,7 @@ const remediationMessage_1_702 = "Use other means of bank account verification";
1434
1439
  const remediationMessage_1_703 = "Upload a bank statement";
1435
1440
  const remediationMessage_1_704 = "Upload a different bank statement";
1436
1441
  const remediationMessage_1_705 = "Upload an official bank statement";
1442
+ const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1437
1443
  const sameNameAsLegalName = "Same as legal name of the company";
1438
1444
  const whereCanIFindTheseNumbersOnMyDriversLicense = "Where can I find these numbers on my driver's license?";
1439
1445
  const whereToFindNumbersOnDriversLicense = "Depending on the issuing state the position of these numbers might differ, but the license number is always on the front side of the card and the card number is in most cases located on the back of the license.";
@@ -1599,6 +1605,7 @@ const defaultTrans = {
1599
1605
  doNotHaveLuRegistrationNumber,
1600
1606
  doNotHaveChRegistrationNumber,
1601
1607
  doNotHaveHandelsregisternummer,
1608
+ doNotHaveRegonKrsNumber,
1602
1609
  taxIdAbsenceReason,
1603
1610
  vatNumberExempted,
1604
1611
  vatNumberAbsenceReason,
@@ -1880,6 +1887,7 @@ const defaultTrans = {
1880
1887
  registrationNumber,
1881
1888
  registrationNumber__nonProfit__FR,
1882
1889
  registrationNumber__FR,
1890
+ registrationNumber__PR,
1883
1891
  charityNumber,
1884
1892
  firmenbuchnummer,
1885
1893
  firmenbuchnummerOrZVR,
@@ -2053,6 +2061,7 @@ const defaultTrans = {
2053
2061
  "7or8or12characters": "7, 8 or 12 digits or characters",
2054
2062
  "2digits1to3letters5digits": "2-digit number + 1 to 3 letters + 5-digit number",
2055
2063
  Cchar5digits,
2064
+ characterPlusXToYDigitsWithOptionalSpace,
2056
2065
  cop1to8digits,
2057
2066
  "8digitsOptional-": '8 digits; last digit can be preceded by an optional "-"',
2058
2067
  provideAllOwners,
@@ -2352,6 +2361,7 @@ const defaultTrans = {
2352
2361
  errorMessage_1_7020,
2353
2362
  errorMessage_1_7021,
2354
2363
  errorMessage_1_7022,
2364
+ errorMessage_3_10,
2355
2365
  remediationMessage_1_100,
2356
2366
  remediationMessage_1_101,
2357
2367
  remediationMessage_1_102,
@@ -2388,6 +2398,7 @@ const defaultTrans = {
2388
2398
  remediationMessage_1_703,
2389
2399
  remediationMessage_1_704,
2390
2400
  remediationMessage_1_705,
2401
+ remediationMessage_3_100,
2391
2402
  sameNameAsLegalName,
2392
2403
  whereCanIFindTheseNumbersOnMyDriversLicense,
2393
2404
  whereToFindNumbersOnDriversLicense,
@@ -2480,7 +2491,7 @@ const createLogger = (namespace) => {
2480
2491
  });
2481
2492
  return methods;
2482
2493
  };
2483
- const logger$h = createLogger("Fetch");
2494
+ const logger$i = createLogger("Fetch");
2484
2495
  const getRequestObject = (options2, data) => {
2485
2496
  const {
2486
2497
  headers = [],
@@ -2517,7 +2528,7 @@ const handleFetchError = (message, level) => {
2517
2528
  case "info":
2518
2529
  case "warn":
2519
2530
  case "error":
2520
- return logger$h[level](message);
2531
+ return logger$i[level](message);
2521
2532
  default:
2522
2533
  throw new Error(message);
2523
2534
  }
@@ -2600,7 +2611,7 @@ const escapeHtml = (unsafeInput, allowedTags = []) => sanitizeHtml(unsafeInput,
2600
2611
  allowedAttributes: determineAllowedAttributes(allowedTags),
2601
2612
  disallowedTagsMode: "escape"
2602
2613
  });
2603
- const logger$g = createLogger("language/utils");
2614
+ const logger$h = createLogger("language/utils");
2604
2615
  const toTwoLetterCode = (locale) => locale.toLowerCase().substring(0, 2);
2605
2616
  function matchLocale(locale, supportedLocales) {
2606
2617
  if (!locale || typeof locale !== "string")
@@ -2665,7 +2676,7 @@ const getTranslations = async ({
2665
2676
  clientKey
2666
2677
  }, datasetIdentifier.translations, locale);
2667
2678
  } catch (error) {
2668
- logger$g.error(error);
2679
+ logger$h.error(error);
2669
2680
  }
2670
2681
  return {
2671
2682
  ...defaultTranslation,
@@ -3348,6 +3359,11 @@ const countryConfig$4 = {
3348
3359
  label: "USt-IdNr"
3349
3360
  }
3350
3361
  },
3362
+ [CountryCodes.Gibraltar]: {
3363
+ registrationNumber: {
3364
+ label: "companyRegistrationNumber"
3365
+ }
3366
+ },
3351
3367
  [CountryCodes.Greece]: {
3352
3368
  registrationNumber: {
3353
3369
  label: "GEMI-number"
@@ -3572,6 +3588,9 @@ const countryConfig$4 = {
3572
3588
  }
3573
3589
  },
3574
3590
  [CountryCodes.Poland]: {
3591
+ exemptedFromRegistrationNumber: {
3592
+ label: "doNotHaveRegonKrsNumber"
3593
+ },
3575
3594
  registrationNumber: {
3576
3595
  label: "regonKrsNumber"
3577
3596
  },
@@ -3599,6 +3618,11 @@ const countryConfig$4 = {
3599
3618
  label: "numerodeIVA"
3600
3619
  }
3601
3620
  },
3621
+ [CountryCodes.PuertoRico]: {
3622
+ registrationNumber: {
3623
+ label: "registrationNumber__PR"
3624
+ }
3625
+ },
3602
3626
  [CountryCodes.Romania]: {
3603
3627
  registrationNumber: {
3604
3628
  label: "numarOrdineRegistrulComertului"
@@ -3758,57 +3782,32 @@ var DocumentType = /* @__PURE__ */ ((DocumentType2) => {
3758
3782
  return DocumentType2;
3759
3783
  })(DocumentType || {});
3760
3784
  function getFormProps(props, innerFormId) {
3761
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
3785
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
3762
3786
  if (innerFormId) {
3763
3787
  const nestedFormProps = {
3764
- placeholders: {},
3765
- labels: {},
3766
- data: {},
3767
- formVerificationErrors: {},
3768
- requiredFields: [],
3769
- optionalFields: [],
3770
- maskedFields: [],
3771
- // validators should be `null` and not `{}` by default
3772
- // to make it easier to short circuit it with predetermined validators
3773
- // for example `rules: props.validators || personalDetailsValidationRules`
3774
- validators: null
3775
- };
3776
- nestedFormProps.placeholders = {
3777
- ...(_a = props.placeholders) == null ? void 0 : _a[innerFormId]
3788
+ placeholders: ((_a = props.placeholders) == null ? void 0 : _a[innerFormId]) ?? {},
3789
+ labels: ((_b = props.labels) == null ? void 0 : _b[innerFormId]) ?? {},
3790
+ data: ((_c = props.data) == null ? void 0 : _c[innerFormId]) ?? {},
3791
+ readOnlyFields: ((_d = props.readOnlyFields) == null ? void 0 : _d[innerFormId]) ?? [],
3792
+ requiredFields: ((_e = props.requiredFields) == null ? void 0 : _e[innerFormId]) ?? [],
3793
+ optionalFields: ((_f = props.optionalFields) == null ? void 0 : _f[innerFormId]) ?? [],
3794
+ maskedFields: ((_g = props.maskedFields) == null ? void 0 : _g[innerFormId]) ?? [],
3795
+ verifyFields: ((_h = props.verifyFields) == null ? void 0 : _h[innerFormId]) ?? [],
3796
+ formVerificationErrors: ((_j = (_i = props.problems) == null ? void 0 : _i.verificationErrors) == null ? void 0 : _j[innerFormId]) ?? {},
3797
+ fieldValidationErrors: ((_l = (_k = props.problems) == null ? void 0 : _k.validationErrors) == null ? void 0 : _l[innerFormId]) ?? {},
3798
+ /*
3799
+ Validators should be `null` and not `{}` by default to make it easier to short circuit it with predetermined validators.
3800
+ For example `rules: props.validators || personalDetailsValidationRules`.
3801
+ */
3802
+ validators: ((_m = props.validators) == null ? void 0 : _m[innerFormId]) ? {
3803
+ ...(_n = props.validators) == null ? void 0 : _n[innerFormId]
3804
+ } : null,
3805
+ /*
3806
+ activeForm check is required for shouldValidate because of we render all forms in a multistep form.
3807
+ Should be changed once stateManagement is fixed and this is no longer the case
3808
+ */
3809
+ shouldValidate: ((_o = props.activeForm) == null ? void 0 : _o.formId) === innerFormId && props.shouldValidate
3778
3810
  };
3779
- nestedFormProps.labels = {
3780
- ...(_b = props.labels) == null ? void 0 : _b[innerFormId]
3781
- };
3782
- nestedFormProps.data = {
3783
- ...(_c = props.data) == null ? void 0 : _c[innerFormId]
3784
- };
3785
- if ((_d = props.readOnlyFields) == null ? void 0 : _d[innerFormId]) {
3786
- nestedFormProps.readOnlyFields = (_e = props.readOnlyFields) == null ? void 0 : _e[innerFormId];
3787
- }
3788
- if ((_f = props.requiredFields) == null ? void 0 : _f[innerFormId]) {
3789
- nestedFormProps.requiredFields = (_g = props.requiredFields) == null ? void 0 : _g[innerFormId];
3790
- }
3791
- if ((_h = props.optionalFields) == null ? void 0 : _h[innerFormId]) {
3792
- nestedFormProps.optionalFields = (_i = props.optionalFields) == null ? void 0 : _i[innerFormId];
3793
- }
3794
- if ((_j = props.validators) == null ? void 0 : _j[innerFormId]) {
3795
- nestedFormProps.validators = {
3796
- ...(_k = props.validators) == null ? void 0 : _k[innerFormId]
3797
- };
3798
- }
3799
- if ((_l = props.verifyFields) == null ? void 0 : _l[innerFormId]) {
3800
- nestedFormProps.verifyFields = (_m = props.verifyFields) == null ? void 0 : _m[innerFormId];
3801
- }
3802
- if ((_o = (_n = props.problems) == null ? void 0 : _n.verificationErrors) == null ? void 0 : _o[innerFormId]) {
3803
- nestedFormProps.formVerificationErrors = (_q = (_p = props.problems) == null ? void 0 : _p.verificationErrors) == null ? void 0 : _q[innerFormId];
3804
- }
3805
- if ((_s = (_r = props.problems) == null ? void 0 : _r.validationErrors) == null ? void 0 : _s[innerFormId]) {
3806
- nestedFormProps.fieldValidationErrors = (_u = (_t = props.problems) == null ? void 0 : _t.validationErrors) == null ? void 0 : _u[innerFormId];
3807
- }
3808
- if ((_v = props.maskedFields) == null ? void 0 : _v[innerFormId]) {
3809
- nestedFormProps.maskedFields = props.maskedFields[innerFormId];
3810
- }
3811
- nestedFormProps.shouldValidate = ((_w = props.activeForm) == null ? void 0 : _w.formId) === innerFormId && props.shouldValidate;
3812
3811
  return nestedFormProps;
3813
3812
  }
3814
3813
  return null;
@@ -3881,7 +3880,7 @@ function StateContextSetter({
3881
3880
  }
3882
3881
  function useStateContext() {
3883
3882
  const context = q$1(StateContext);
3884
- if (context === void 0) {
3883
+ if (!context) {
3885
3884
  throw new Error("useStateContext must be used within a StateProvider");
3886
3885
  }
3887
3886
  return context;
@@ -3894,98 +3893,134 @@ const addKeys = (obj, add2, initialValue, defaultData, pendingData) => add2.redu
3894
3893
  ...a2,
3895
3894
  [c2]: a2[c2] ?? (pendingData == null ? void 0 : pendingData[c2]) ?? (defaultData == null ? void 0 : defaultData[c2]) ?? initialValue
3896
3895
  }), obj);
3896
+ const processField = ({
3897
+ key,
3898
+ value = null,
3899
+ mode,
3900
+ defaultData,
3901
+ maskedFields,
3902
+ fieldContext,
3903
+ formatters,
3904
+ synchronusValidate,
3905
+ asynchronusValidate
3906
+ }) => {
3907
+ var _a, _b;
3908
+ const formatterFn = ((_a = formatters == null ? void 0 : formatters[key]) == null ? void 0 : _a.formatter) ? (_b = formatters[key]) == null ? void 0 : _b.formatter : formatters == null ? void 0 : formatters[key];
3909
+ const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
3910
+ const shouldValidateField = !((maskedFields == null ? void 0 : maskedFields.includes(key)) && (defaultData == null ? void 0 : defaultData[key]) === value && !!(defaultData == null ? void 0 : defaultData[key]));
3911
+ if (shouldValidateField && value) {
3912
+ asynchronusValidate(key, fieldContext.state, mode);
3913
+ }
3914
+ const validationResult = shouldValidateField ? synchronusValidate.validate({
3915
+ key,
3916
+ value: formattedValue,
3917
+ mode
3918
+ }, fieldContext) : {
3919
+ isValid: true,
3920
+ hasError: () => null,
3921
+ getError: () => null
3922
+ };
3923
+ return [formattedValue, validationResult];
3924
+ };
3897
3925
  function init({
3898
3926
  schema,
3899
3927
  defaultData,
3900
- processField,
3901
3928
  fieldProblems,
3902
- maskedFields
3929
+ maskedFields,
3930
+ formatters,
3931
+ synchronusValidate,
3932
+ asynchronusValidate
3903
3933
  }) {
3904
3934
  const getProcessedState = (fieldKey) => {
3905
3935
  const [formattedValue, validationResult] = processField({
3906
3936
  key: fieldKey,
3907
- value: defaultData[fieldKey],
3937
+ value: defaultData == null ? void 0 : defaultData[fieldKey],
3908
3938
  mode: "blur",
3939
+ formatters,
3909
3940
  defaultData,
3910
3941
  maskedFields,
3911
3942
  fieldContext: {
3912
3943
  state: {
3913
3944
  data: defaultData
3914
3945
  }
3915
- }
3946
+ },
3947
+ synchronusValidate,
3948
+ asynchronusValidate
3916
3949
  });
3917
- if (typeof defaultData[fieldKey] === "undefined") {
3950
+ if (typeof (defaultData == null ? void 0 : defaultData[fieldKey]) === "undefined") {
3918
3951
  return {
3919
3952
  valid: validationResult.isValid && !(fieldProblems == null ? void 0 : fieldProblems[fieldKey]) || false,
3920
3953
  errors: null,
3921
3954
  data: null,
3922
- fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? null
3955
+ fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? false
3923
3956
  };
3924
3957
  }
3925
3958
  return {
3926
3959
  valid: validationResult.isValid && !(fieldProblems == null ? void 0 : fieldProblems[fieldKey]) || false,
3927
- errors: validationResult.hasError() ? validationResult.getError() : null,
3960
+ errors: validationResult.getError() ?? null,
3928
3961
  data: formattedValue,
3929
- fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? null
3962
+ fieldProblems: (fieldProblems == null ? void 0 : fieldProblems[fieldKey]) ?? false
3930
3963
  };
3931
3964
  };
3932
- const formData = schema.reduce((acc, fieldKey) => {
3965
+ const formData = schema.reduce((acc, field) => {
3933
3966
  const {
3934
3967
  valid,
3935
3968
  errors,
3936
3969
  data,
3937
- fieldProblems: fieldProblems2
3938
- } = getProcessedState(fieldKey);
3970
+ fieldProblems: processedFieldProblems
3971
+ } = getProcessedState(field);
3939
3972
  return {
3973
+ ...acc,
3974
+ data: {
3975
+ ...acc.data,
3976
+ [field]: data
3977
+ },
3940
3978
  valid: {
3941
3979
  ...acc.valid,
3942
- [fieldKey]: valid
3980
+ [field]: valid
3943
3981
  },
3944
3982
  errors: {
3945
3983
  ...acc.errors,
3946
- [fieldKey]: errors
3947
- },
3948
- data: {
3949
- ...acc.data,
3950
- [fieldKey]: data
3984
+ [field]: errors
3951
3985
  },
3952
3986
  fieldProblems: {
3953
3987
  ...acc.fieldProblems,
3954
- [fieldKey]: fieldProblems2
3988
+ [field]: processedFieldProblems
3955
3989
  }
3956
3990
  };
3957
3991
  }, {
3992
+ schema,
3958
3993
  data: {},
3959
3994
  valid: {},
3960
3995
  errors: {},
3961
- fieldProblems: {}
3962
- });
3963
- return {
3964
- schema,
3965
- data: formData.data,
3966
- valid: formData.valid,
3967
- errors: formData.errors,
3968
- fieldProblems: formData.fieldProblems,
3996
+ fieldProblems: {},
3969
3997
  maskedFields
3970
- };
3998
+ });
3999
+ return formData;
3971
4000
  }
3972
- function getReducer(processField) {
3973
- return function reducer(state2, {
4001
+ function reducer({
4002
+ synchronusValidate,
4003
+ asynchronusValidate,
4004
+ formatters
4005
+ }) {
4006
+ return (state2, {
3974
4007
  type,
3975
4008
  key,
3976
- value,
3977
4009
  mode,
4010
+ value,
3978
4011
  schema,
3979
- defaultData,
3980
- formValue,
3981
4012
  selectedSchema,
4013
+ formValue,
3982
4014
  maskedFields,
3983
- fieldProblems
3984
- }) {
3985
- var _a, _b, _c, _d;
4015
+ fieldProblems,
4016
+ defaultData
4017
+ }) => {
4018
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3986
4019
  const validationSchema = selectedSchema || state2.schema;
3987
4020
  switch (type) {
3988
4021
  case "setData": {
4022
+ if (!key)
4023
+ return state2;
3989
4024
  return {
3990
4025
  ...state2,
3991
4026
  data: {
@@ -3995,6 +4030,8 @@ function getReducer(processField) {
3995
4030
  };
3996
4031
  }
3997
4032
  case "setValid": {
4033
+ if (!key)
4034
+ return state2;
3998
4035
  return {
3999
4036
  ...state2,
4000
4037
  valid: {
@@ -4004,6 +4041,8 @@ function getReducer(processField) {
4004
4041
  };
4005
4042
  }
4006
4043
  case "setErrors": {
4044
+ if (!key)
4045
+ return state2;
4007
4046
  return {
4008
4047
  ...state2,
4009
4048
  errors: {
@@ -4013,39 +4052,75 @@ function getReducer(processField) {
4013
4052
  };
4014
4053
  }
4015
4054
  case "setFieldProblems": {
4016
- return ((_a = state2 == null ? void 0 : state2.schema) == null ? void 0 : _a.reduce((acc, key2) => {
4055
+ return (_a = state2 == null ? void 0 : state2.schema) == null ? void 0 : _a.reduce((acc, field) => {
4017
4056
  var _a2;
4018
4057
  return {
4019
4058
  ...acc,
4020
4059
  fieldProblems: {
4021
4060
  ...state2.fieldProblems,
4022
- [key2]: (fieldProblems == null ? void 0 : fieldProblems[key2]) ?? null
4061
+ [field]: (fieldProblems == null ? void 0 : fieldProblems[field]) ?? false
4023
4062
  },
4024
4063
  valid: {
4025
4064
  ...state2.valid,
4026
- [key2]: ((_a2 = state2.valid) == null ? void 0 : _a2[key2]) && !fieldProblems[key2]
4065
+ [field]: ((_a2 = state2.valid) == null ? void 0 : _a2[field]) && !(fieldProblems == null ? void 0 : fieldProblems[field])
4027
4066
  }
4028
4067
  };
4029
- }, state2)) ?? state2;
4068
+ }, state2);
4069
+ }
4070
+ case "setSchema": {
4071
+ if (!schema)
4072
+ return state2;
4073
+ const defaultState = init({
4074
+ schema,
4075
+ defaultData,
4076
+ fieldProblems,
4077
+ maskedFields,
4078
+ synchronusValidate,
4079
+ asynchronusValidate
4080
+ });
4081
+ const removedSchemaFields = (_b = state2.schema) == null ? void 0 : _b.filter((field) => !schema.includes(field));
4082
+ const newSchemaFields = schema.filter((field) => {
4083
+ var _a2;
4084
+ return !((_a2 = state2.schema) == null ? void 0 : _a2.includes(field));
4085
+ });
4086
+ const local = {
4087
+ data: omitKeys(state2.data, newSchemaFields),
4088
+ errors: omitKeys(state2.errors, newSchemaFields),
4089
+ valid: omitKeys(state2.valid, newSchemaFields),
4090
+ fieldProblems: omitKeys(state2.fieldProblems, newSchemaFields)
4091
+ };
4092
+ const updatedData = addKeys(omitKeys(state2.data, removedSchemaFields), newSchemaFields, null, defaultState.data, (_c = state2.local) == null ? void 0 : _c.data);
4093
+ const updatedValid = addKeys(omitKeys(state2.valid, removedSchemaFields), newSchemaFields, false, defaultState.valid, (_d = state2.local) == null ? void 0 : _d.valid);
4094
+ const updatedErrors = addKeys(omitKeys(state2.errors, removedSchemaFields), newSchemaFields, null, defaultState.errors, (_e = state2.local) == null ? void 0 : _e.errors);
4095
+ const updatedFieldProblems = addKeys(omitKeys(state2.fieldProblems, removedSchemaFields), newSchemaFields, false, defaultState.fieldProblems, (_f = state2.local) == null ? void 0 : _f.fieldProblems);
4096
+ return {
4097
+ ...state2,
4098
+ schema,
4099
+ data: updatedData,
4100
+ valid: updatedValid,
4101
+ errors: updatedErrors,
4102
+ fieldProblems: updatedFieldProblems,
4103
+ local
4104
+ };
4030
4105
  }
4031
4106
  case "updateField": {
4107
+ if (!key || !mode)
4108
+ return state2;
4032
4109
  const [formattedValue, validation] = processField({
4033
4110
  key,
4034
4111
  value,
4035
4112
  mode,
4036
4113
  defaultData,
4037
4114
  maskedFields,
4115
+ formatters,
4038
4116
  fieldContext: {
4039
4117
  state: state2
4040
- }
4118
+ },
4119
+ synchronusValidate,
4120
+ asynchronusValidate
4041
4121
  });
4042
4122
  const oldValue = state2.data[key];
4043
- const fieldProblems2 = {
4044
- ...state2.fieldProblems
4045
- };
4046
- if (oldValue !== formattedValue) {
4047
- fieldProblems2[key] = null;
4048
- }
4123
+ const clearFieldProblems = oldValue !== formattedValue;
4049
4124
  return {
4050
4125
  ...state2,
4051
4126
  data: {
@@ -4054,13 +4129,16 @@ function getReducer(processField) {
4054
4129
  },
4055
4130
  errors: {
4056
4131
  ...state2.errors,
4057
- [key]: validation.hasError() ? validation.getError() : null
4132
+ [key]: validation.getError() ?? null
4058
4133
  },
4059
4134
  valid: {
4060
4135
  ...state2.valid,
4061
- [key]: validation.isValid && !fieldProblems2[key] || false
4136
+ [key]: validation.isValid && !((_g = state2.fieldProblems) == null ? void 0 : _g[key]) || false
4062
4137
  },
4063
- fieldProblems: fieldProblems2
4138
+ fieldProblems: {
4139
+ ...state2.fieldProblems,
4140
+ [key]: clearFieldProblems ? false : ((_h = state2.fieldProblems) == null ? void 0 : _h[key]) ?? false
4141
+ }
4064
4142
  };
4065
4143
  }
4066
4144
  case "mergeForm": {
@@ -4068,19 +4146,19 @@ function getReducer(processField) {
4068
4146
  ...state2,
4069
4147
  data: {
4070
4148
  ...state2.data,
4071
- ...formValue.data
4149
+ ...formValue == null ? void 0 : formValue.data
4072
4150
  },
4073
4151
  errors: {
4074
4152
  ...state2.errors,
4075
- ...formValue.errors
4153
+ ...formValue == null ? void 0 : formValue.errors
4076
4154
  },
4077
4155
  valid: {
4078
4156
  ...state2.valid,
4079
- ...formValue.valid
4157
+ ...formValue == null ? void 0 : formValue.valid
4080
4158
  },
4081
4159
  fieldProblems: {
4082
4160
  ...state2.fieldProblems,
4083
- ...formValue.fieldProblems
4161
+ ...formValue == null ? void 0 : formValue.fieldProblems
4084
4162
  }
4085
4163
  };
4086
4164
  if (mergedState.valid) {
@@ -4088,53 +4166,30 @@ function getReducer(processField) {
4088
4166
  }
4089
4167
  return mergedState;
4090
4168
  }
4091
- case "setSchema": {
4092
- const defaultState = init({
4093
- schema,
4094
- defaultData,
4095
- processField,
4096
- fieldProblems,
4097
- maskedFields
4098
- });
4099
- const removedSchemaFields = state2.schema.filter((field) => !schema.includes(field));
4100
- const newSchemaFields = schema.filter((field) => !state2.schema.includes(field));
4101
- const local = {
4102
- data: omitKeys(state2.data, newSchemaFields),
4103
- errors: omitKeys(state2.errors, newSchemaFields),
4104
- valid: omitKeys(state2.valid, newSchemaFields)
4105
- };
4106
- const data = addKeys(omitKeys(state2.data, removedSchemaFields), newSchemaFields, null, defaultState.data, (_b = state2.local) == null ? void 0 : _b.data);
4107
- const valid = addKeys(omitKeys(state2.valid, removedSchemaFields), newSchemaFields, false, defaultState.valid, (_c = state2.local) == null ? void 0 : _c.valid);
4108
- const errors = addKeys(omitKeys(state2.errors, removedSchemaFields), newSchemaFields, null, defaultState.errors, (_d = state2.local) == null ? void 0 : _d.errors);
4109
- return {
4110
- ...state2,
4111
- schema,
4112
- data,
4113
- valid,
4114
- errors,
4115
- local
4116
- };
4117
- }
4118
4169
  case "validateForm": {
4119
- const formValidation = validationSchema.reduce((acc, cur) => {
4170
+ const formValidation = validationSchema == null ? void 0 : validationSchema.reduce((acc, cur) => {
4171
+ var _a2;
4120
4172
  const [, validation] = processField({
4121
4173
  key: cur,
4122
4174
  value: state2.data[cur],
4123
4175
  mode: "blur",
4124
4176
  defaultData,
4125
4177
  maskedFields,
4178
+ formatters,
4126
4179
  fieldContext: {
4127
4180
  state: state2
4128
- }
4181
+ },
4182
+ synchronusValidate,
4183
+ asynchronusValidate
4129
4184
  });
4130
4185
  return {
4131
4186
  valid: {
4132
4187
  ...acc.valid,
4133
- [cur]: validation.isValid && !state2.fieldProblems[cur] || false
4188
+ [cur]: validation.isValid && !((_a2 = state2.fieldProblems) == null ? void 0 : _a2[cur]) || false
4134
4189
  },
4135
4190
  errors: {
4136
4191
  ...acc.errors,
4137
- [cur]: validation.hasError() ? validation.getError() : null
4192
+ [cur]: validation.getError() ?? null
4138
4193
  }
4139
4194
  };
4140
4195
  }, {
@@ -4143,8 +4198,8 @@ function getReducer(processField) {
4143
4198
  });
4144
4199
  return {
4145
4200
  ...state2,
4146
- valid: formValidation.valid,
4147
- errors: formValidation.errors
4201
+ valid: formValidation == null ? void 0 : formValidation.valid,
4202
+ errors: formValidation == null ? void 0 : formValidation.errors
4148
4203
  };
4149
4204
  }
4150
4205
  default:
@@ -4216,16 +4271,18 @@ class Validator {
4216
4271
  return new ValidationResult(validationRulesResult);
4217
4272
  }
4218
4273
  }
4219
- const logger$f = createLogger("useAsyncValidator");
4274
+ const logger$g = createLogger("useAsyncValidator");
4220
4275
  const useAsyncValidator = (asyncRules) => {
4221
4276
  const [asyncValidationResults, setAsyncValidationResults] = h({});
4222
4277
  const clearAsyncValidationResults = T$1(() => setAsyncValidationResults({}), []);
4223
4278
  const asyncValidate = T$1((field, formState, mode) => {
4279
+ if (!asyncRules)
4280
+ return clearAsyncValidationResults();
4224
4281
  const rule = asyncRules[field];
4225
4282
  if (!rule || !rule.modes.includes(mode))
4226
4283
  return clearAsyncValidationResults();
4227
4284
  const value = formState.data[field];
4228
- rule.asyncValidate(formState.data[field], {
4285
+ return rule.asyncValidate(formState.data[field], {
4229
4286
  state: formState
4230
4287
  }).then((isValid) => {
4231
4288
  setAsyncValidationResults({
@@ -4237,96 +4294,54 @@ const useAsyncValidator = (asyncRules) => {
4237
4294
  hasError: !isValid
4238
4295
  }])
4239
4296
  });
4240
- }).catch(logger$f.error);
4297
+ }).catch(logger$g.error);
4241
4298
  }, [asyncRules, clearAsyncValidationResults]);
4242
4299
  return {
4243
- asyncValidationResults,
4244
4300
  asyncValidate,
4301
+ asyncValidationResults,
4245
4302
  clearAsyncValidationResults
4246
4303
  };
4247
4304
  };
4248
4305
  function useForm({
4249
- rules: rules2 = {},
4250
- asyncRules = {},
4251
4306
  schema,
4307
+ defaultData,
4308
+ rules: rules2,
4309
+ asyncRules,
4310
+ fieldProblems,
4311
+ maskedFields,
4252
4312
  formatters,
4253
- defaultData: defaultDataProp = {},
4254
- fieldProblems: fieldProblemsProp,
4255
- maskedFields: maskedFieldProp,
4256
- shouldValidate
4313
+ shouldValidate = false
4257
4314
  }) {
4258
- const getRequiredFields = T$1(typeof schema === "function" ? schema : () => schema, [schema]);
4259
- const validator = F$1(() => new Validator(rules2), [rules2]);
4315
+ const syncValidator = F$1(() => new Validator(rules2), [rules2]);
4260
4316
  const {
4261
- asyncValidationResults,
4262
- asyncValidate
4317
+ asyncValidate,
4318
+ asyncValidationResults
4263
4319
  } = useAsyncValidator(asyncRules);
4264
- const processField = ({
4265
- key,
4266
- value,
4267
- mode,
4320
+ const getRequiredFields = T$1(typeof schema === "function" ? schema : () => schema, [schema]);
4321
+ const getReducer = T$1(() => reducer({
4322
+ synchronusValidate: syncValidator,
4323
+ asynchronusValidate: asyncValidate,
4324
+ formatters
4325
+ }), [syncValidator, asyncValidate, formatters]);
4326
+ const getInitialData = T$1(() => ({
4327
+ schema: defaultData ? getRequiredFields(defaultData) ?? [] : [],
4268
4328
  defaultData,
4329
+ fieldProblems,
4269
4330
  maskedFields,
4270
- fieldContext
4271
- }) => {
4272
- var _a, _b;
4273
- const formatterFn = ((_a = formatters == null ? void 0 : formatters[key]) == null ? void 0 : _a.formatter) ? (_b = formatters[key]) == null ? void 0 : _b.formatter : formatters == null ? void 0 : formatters[key];
4274
- const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
4275
- const shouldValidateField = !((maskedFields == null ? void 0 : maskedFields.includes(key)) && defaultData[key] === value && !!defaultData[key]);
4276
- if (shouldValidateField && value) {
4277
- asyncValidate(key, fieldContext.state, mode);
4278
- }
4279
- const validationResult = shouldValidateField ? validator.validate({
4280
- key,
4281
- value: formattedValue,
4282
- mode
4283
- }, fieldContext) : {
4284
- isValid: true,
4285
- hasError: () => null,
4286
- getError: () => null
4287
- };
4288
- return [formattedValue, validationResult];
4289
- };
4290
- const initialData = {
4291
- defaultData: defaultDataProp,
4292
- schema: getRequiredFields(defaultDataProp) ?? [],
4293
- processField,
4294
- fieldProblems: fieldProblemsProp,
4295
- maskedFields: maskedFieldProp,
4296
- formatters
4297
- };
4298
- const [state2, dispatch] = s(getReducer(processField), initialData, init);
4299
- const isValid = F$1(() => {
4300
- var _a;
4301
- return (_a = state2 == null ? void 0 : state2.schema) == null ? void 0 : _a.reduce((acc, val) => acc && (state2 == null ? void 0 : state2.valid[val]), true);
4302
- }, [state2 == null ? void 0 : state2.schema, state2 == null ? void 0 : state2.valid]);
4303
- const getTargetValue = (key, e2) => {
4331
+ formatters,
4332
+ synchronusValidate: syncValidator,
4333
+ asynchronusValidate: asyncValidate
4334
+ }), [defaultData, fieldProblems, maskedFields, formatters, getRequiredFields, syncValidator, asyncValidate]);
4335
+ const [state2, dispatch] = s(getReducer(), getInitialData(), init);
4336
+ const [formErrors, setFormErrors] = h(state2.errors);
4337
+ const getTargetValue = T$1((key, e2) => {
4304
4338
  if (!(e2 == null ? void 0 : e2.target))
4305
4339
  return e2;
4306
4340
  if (e2.target.type === "checkbox") {
4307
4341
  return !state2.data[key];
4308
4342
  }
4309
4343
  return e2.target.value;
4310
- };
4311
- const handleChangeFor = (key, mode = "blur") => (e2) => {
4312
- const value = getTargetValue(key, e2);
4313
- dispatch({
4314
- type: "updateField",
4315
- key,
4316
- value,
4317
- mode,
4318
- defaultData: defaultDataProp,
4319
- maskedFields: maskedFieldProp
4320
- });
4321
- };
4322
- const triggerValidation = T$1((selectedSchema) => {
4323
- dispatch({
4324
- type: "validateForm",
4325
- selectedSchema,
4326
- defaultData: defaultDataProp,
4327
- maskedFields: maskedFieldProp
4328
- });
4329
- }, [defaultDataProp, maskedFieldProp]);
4344
+ }, [state2.data]);
4330
4345
  const setErrors = T$1((key, value) => dispatch({
4331
4346
  type: "setErrors",
4332
4347
  key,
@@ -4342,30 +4357,53 @@ function useForm({
4342
4357
  key,
4343
4358
  value
4344
4359
  }), []);
4345
- const setSchema = T$1((schema2) => dispatch({
4360
+ const setSchema = T$1((newSchema) => dispatch({
4346
4361
  type: "setSchema",
4347
- schema: schema2,
4348
- defaultData: defaultDataProp
4349
- }), [defaultDataProp]);
4362
+ schema: newSchema,
4363
+ defaultData
4364
+ }), [defaultData]);
4365
+ const setFieldProblems = T$1((newFieldProblems) => dispatch({
4366
+ type: "setFieldProblems",
4367
+ fieldProblems: newFieldProblems
4368
+ }), []);
4350
4369
  const mergeForm = T$1((formValue) => dispatch({
4351
4370
  type: "mergeForm",
4352
4371
  formValue
4353
4372
  }), []);
4354
- const setFieldProblems = T$1((fieldProblems) => dispatch({
4355
- type: "setFieldProblems",
4356
- fieldProblems
4357
- }), []);
4358
- const mergeAsyncErrorsState = T$1((formSchema, syncValidationErrors, asyncValidationErrors) => {
4359
- if (!formSchema.length)
4373
+ const handleChangeFor = T$1((key, mode = "blur") => (e2) => {
4374
+ const value = getTargetValue(key, e2);
4375
+ dispatch({
4376
+ type: "updateField",
4377
+ key,
4378
+ value,
4379
+ mode,
4380
+ defaultData,
4381
+ maskedFields
4382
+ });
4383
+ }, [defaultData, maskedFields, getTargetValue]);
4384
+ const triggerValidation = T$1((selectedSchema) => {
4385
+ dispatch({
4386
+ type: "validateForm",
4387
+ selectedSchema,
4388
+ defaultData,
4389
+ maskedFields
4390
+ });
4391
+ }, [defaultData, maskedFields]);
4392
+ const mergeAsyncErrorsState = T$1((syncValidationErrors, asyncValidationErrors) => {
4393
+ if (!state2.schema.length)
4360
4394
  return syncValidationErrors;
4361
- return formSchema.reduce((acc, field) => {
4395
+ return state2.schema.reduce((acc, field) => {
4362
4396
  var _a;
4363
4397
  return {
4364
4398
  ...acc,
4365
4399
  [field]: syncValidationErrors[field] ?? ((_a = asyncValidationErrors[field]) == null ? void 0 : _a.getError()) ?? null
4366
4400
  };
4367
4401
  }, {});
4368
- }, []);
4402
+ }, [state2.schema]);
4403
+ const isValid = F$1(() => {
4404
+ var _a;
4405
+ return (_a = state2.schema) == null ? void 0 : _a.some((key) => !!state2.valid[key]);
4406
+ }, [state2.schema, state2.valid]);
4369
4407
  p(() => {
4370
4408
  const newSchema = getRequiredFields(state2.data);
4371
4409
  if (!doArraysMatch(state2.schema, newSchema)) {
@@ -4376,14 +4414,15 @@ function useForm({
4376
4414
  if (shouldValidate) {
4377
4415
  triggerValidation();
4378
4416
  }
4379
- }, [shouldValidate, state2.schema, validator]);
4417
+ }, [shouldValidate, state2.schema, triggerValidation]);
4380
4418
  p(() => {
4381
- setFieldProblems(fieldProblemsProp ?? {});
4382
- }, [JSON.stringify(fieldProblemsProp), setFieldProblems]);
4383
- const [formErrors, setFormErrors] = h(state2.errors);
4419
+ if (fieldProblems) {
4420
+ setFieldProblems(fieldProblems);
4421
+ }
4422
+ }, [JSON.stringify(fieldProblems), setFieldProblems]);
4384
4423
  p(() => {
4385
- setFormErrors(mergeAsyncErrorsState(state2.schema ?? [], state2.errors, asyncValidationResults));
4386
- }, [asyncValidationResults, state2.errors, state2.schema]);
4424
+ setFormErrors(mergeAsyncErrorsState(state2.errors, asyncValidationResults));
4425
+ }, [mergeAsyncErrorsState, asyncValidationResults, state2.errors]);
4387
4426
  return {
4388
4427
  handleChangeFor,
4389
4428
  triggerValidation,
@@ -4479,9 +4518,8 @@ function Checkbox({
4479
4518
  }, classNameModifiers.map((m2) => `adyen-kyc-input--${m2}`)]),
4480
4519
  type: "checkbox",
4481
4520
  onClick: (event) => {
4482
- onChange(!checked);
4483
- event.preventDefault();
4484
4521
  event.stopPropagation();
4522
+ onChange(!checked);
4485
4523
  }
4486
4524
  }), o("span", {
4487
4525
  className: "adyen-kyc-checkbox__label",
@@ -5114,6 +5152,12 @@ const businessRegistrationNumberPatterns = {
5114
5152
  format: '9 digits + optional "-" + 5 digits for SIRET, or W + 9 digits for RNA (W123456789)'
5115
5153
  }
5116
5154
  },
5155
+ [CountryCodes.Gibraltar]: {
5156
+ default: {
5157
+ regex: /^[a-zA-Z0-9]{1,8}$/,
5158
+ format: "Up to 8 alphanumeric characters"
5159
+ }
5160
+ },
5117
5161
  [CountryCodes.Germany]: {
5118
5162
  default: {
5119
5163
  regex: /^[a-zA-Z]{2,3}\d{1,6}[a-zA-Z]{0,5}(-[a-zA-Z]\d{4})?$/,
@@ -5274,8 +5318,13 @@ const businessRegistrationNumberPatterns = {
5274
5318
  },
5275
5319
  [CountryCodes.Malta]: {
5276
5320
  default: {
5277
- regex: /^(C)\d{5}$/,
5278
- format: "Cchar5digits"
5321
+ regex: /^(C)\s?\d{4,6}$/,
5322
+ format: "characterPlusXToYDigitsWithOptionalSpace",
5323
+ values: {
5324
+ c: "C",
5325
+ x: 4,
5326
+ y: 6
5327
+ }
5279
5328
  }
5280
5329
  },
5281
5330
  [CountryCodes.Monaco]: {
@@ -5334,6 +5383,15 @@ const businessRegistrationNumberPatterns = {
5334
5383
  }
5335
5384
  }
5336
5385
  },
5386
+ [CountryCodes.PuertoRico]: {
5387
+ default: {
5388
+ regex: /^\d{9}$/,
5389
+ format: "Xdigits",
5390
+ values: {
5391
+ digits: 9
5392
+ }
5393
+ }
5394
+ },
5337
5395
  [CountryCodes.Romania]: {
5338
5396
  default: {
5339
5397
  regex: /^[J]\d{2}\/\d{1,9}\/\d{4}$/,
@@ -5423,9 +5481,9 @@ const CountryIdNumberPatterns = {
5423
5481
  [CountryCodes.Italy]: /^[A-Z]{6}[0-9]{2}[ABCDEHLMPRST][0-9]{2}[A-Z][0-9]{3}[A-Z]$/,
5424
5482
  [CountryCodes.Poland]: /^\d{11}$/,
5425
5483
  [CountryCodes.Romania]: /^\d{13}$/,
5484
+ [CountryCodes.Singapore]: /^[a-zA-Z0-9]{9,10}$/,
5426
5485
  [CountryCodes.Spain]: /(^[KL]?\d{7,8}[A-Z]$)|(^[MXYZ]\d{7}[A-Z]$)/,
5427
5486
  [CountryCodes.Sweden]: /(^\d{6}-\d{4}$)|(^\d{8}-\d{4}$)/,
5428
- [CountryCodes.Singapore]: /^[a-zA-Z0-9]{9,10}$/,
5429
5487
  [CountryCodes.UnitedStates]: /^\d{4}$/,
5430
5488
  US9: /^\d{9}$/
5431
5489
  };
@@ -5582,6 +5640,8 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
5582
5640
  const getValidationRulesPerCountryAndType = (country2, companyType2, i18n) => ({
5583
5641
  modes: ["blur"],
5584
5642
  validate(registrationNumber2) {
5643
+ if (!registrationNumber2)
5644
+ return false;
5585
5645
  const {
5586
5646
  isValid,
5587
5647
  translationMessage
@@ -6077,7 +6137,7 @@ function useFormRouterContext() {
6077
6137
  }
6078
6138
  const _link_component = "";
6079
6139
  const _button_component = "";
6080
- const logger$e = createLogger("Link");
6140
+ const logger$f = createLogger("Link");
6081
6141
  const getIconClass = (icon, external) => {
6082
6142
  if (external) {
6083
6143
  return "adl-link__icon adyen-kyc-icon-external-link";
@@ -6089,7 +6149,7 @@ const getIconClass = (icon, external) => {
6089
6149
  };
6090
6150
  const isValidLink = (href) => {
6091
6151
  if (href === "#") {
6092
- logger$e.error('Links must include a valid href. If your href is "#", consider using a Button instead');
6152
+ logger$f.error('Links must include a valid href. If your href is "#", consider using a Button instead');
6093
6153
  return false;
6094
6154
  }
6095
6155
  return true;
@@ -7411,6 +7471,30 @@ const Select = ({
7411
7471
  if (toggleButtonRef.current)
7412
7472
  toggleButtonRef.current.focus();
7413
7473
  };
7474
+ const showList = () => {
7475
+ let sp = scrollParent;
7476
+ if (!sp) {
7477
+ sp = getScrollParent(toggleButtonRef.current);
7478
+ setScrollParent(sp);
7479
+ }
7480
+ if (sp !== -1) {
7481
+ const {
7482
+ bottom: scrollParentBottomPosition
7483
+ } = sp.getBoundingClientRect();
7484
+ const {
7485
+ bottom: toggleButtonBottomPosition
7486
+ } = toggleButtonRef.current.getBoundingClientRect();
7487
+ if (scrollParentBottomPosition - toggleButtonBottomPosition > SELECTLIST_MAX_HEIGHT) {
7488
+ setIsShowListAbove(false);
7489
+ } else {
7490
+ setIsShowListAbove(true);
7491
+ }
7492
+ }
7493
+ setIsShowList(true);
7494
+ };
7495
+ const hideList = () => {
7496
+ setIsShowList(false);
7497
+ };
7414
7498
  const handleSelect = (selectedItem) => {
7415
7499
  if (readonly)
7416
7500
  return;
@@ -7436,13 +7520,13 @@ const Select = ({
7436
7520
  const handleButtonKeyDown = (e2) => {
7437
7521
  var _a;
7438
7522
  if (e2.key === KEYBOARD_KEYS.enter && filterable && isShowList && textFilter) {
7439
- const {
7440
- value
7441
- } = e2.currentTarget;
7442
- const selectedItem = items.find((item) => item.id === e2.currentTarget.value);
7443
- if (isSearch && value.length > 2 || !isSearch) {
7523
+ const value = e2.currentTarget.value || e2.target.value;
7524
+ const selectedItem = items.find((item) => item.id === value);
7525
+ if (selectedItem && (isSearch && (value == null ? void 0 : value.length) > 2 || !isSearch)) {
7444
7526
  handleSelect(selectedItem);
7445
7527
  showList();
7528
+ } else {
7529
+ e2.preventDefault();
7446
7530
  }
7447
7531
  } else if (e2.key === KEYBOARD_KEYS.escape) {
7448
7532
  closeList();
@@ -7458,30 +7542,6 @@ const Select = ({
7458
7542
  closeList();
7459
7543
  }
7460
7544
  };
7461
- const showList = () => {
7462
- let sp = scrollParent;
7463
- if (!sp) {
7464
- sp = getScrollParent(toggleButtonRef.current);
7465
- setScrollParent(sp);
7466
- }
7467
- if (sp !== -1) {
7468
- const {
7469
- bottom: scrollParentBottomPosition
7470
- } = sp.getBoundingClientRect();
7471
- const {
7472
- bottom: toggleButtonBottomPosition
7473
- } = toggleButtonRef.current.getBoundingClientRect();
7474
- if (scrollParentBottomPosition - toggleButtonBottomPosition > SELECTLIST_MAX_HEIGHT) {
7475
- setIsShowListAbove(false);
7476
- } else {
7477
- setIsShowListAbove(true);
7478
- }
7479
- }
7480
- setIsShowList(true);
7481
- };
7482
- const hideList = () => {
7483
- setIsShowList(false);
7484
- };
7485
7545
  const handleClickOutside = (e2) => {
7486
7546
  if (!selectContainerRef.current.contains(e2.target)) {
7487
7547
  setIsShowList(false);
@@ -7689,7 +7749,7 @@ const countryBasedValidatorRules = {
7689
7749
  [CountryCodes.Austria]: {
7690
7750
  vatNumber: [{
7691
7751
  modes: ["blur"],
7692
- validate: (vatNumber2 = "") => {
7752
+ validate: (vatNumber2) => {
7693
7753
  const {
7694
7754
  isValid
7695
7755
  } = validateVatNumber(vatNumber2, CountryCodes.Austria);
@@ -7701,7 +7761,7 @@ const countryBasedValidatorRules = {
7701
7761
  [CountryCodes.Belgium]: {
7702
7762
  vatNumber: [{
7703
7763
  modes: ["blur"],
7704
- validate: (vatNumber2 = "") => {
7764
+ validate: (vatNumber2) => {
7705
7765
  const {
7706
7766
  isValid
7707
7767
  } = validateVatNumber(vatNumber2, CountryCodes.Belgium);
@@ -7713,7 +7773,7 @@ const countryBasedValidatorRules = {
7713
7773
  [CountryCodes.Bulgaria]: {
7714
7774
  vatNumber: [{
7715
7775
  modes: ["blur"],
7716
- validate: (vatNumber2 = "") => {
7776
+ validate: (vatNumber2) => {
7717
7777
  const {
7718
7778
  isValid
7719
7779
  } = validateVatNumber(vatNumber2, CountryCodes.Bulgaria);
@@ -7725,7 +7785,7 @@ const countryBasedValidatorRules = {
7725
7785
  [CountryCodes.Croatia]: {
7726
7786
  vatNumber: [{
7727
7787
  modes: ["blur"],
7728
- validate: (vatNumber2 = "") => {
7788
+ validate: (vatNumber2) => {
7729
7789
  const {
7730
7790
  isValid
7731
7791
  } = validateVatNumber(vatNumber2, CountryCodes.Croatia);
@@ -7737,7 +7797,7 @@ const countryBasedValidatorRules = {
7737
7797
  [CountryCodes.Cyprus]: {
7738
7798
  vatNumber: [{
7739
7799
  modes: ["blur"],
7740
- validate: (vatNumber2 = "") => {
7800
+ validate: (vatNumber2) => {
7741
7801
  const {
7742
7802
  isValid
7743
7803
  } = validateVatNumber(vatNumber2, CountryCodes.Cyprus);
@@ -7749,7 +7809,7 @@ const countryBasedValidatorRules = {
7749
7809
  [CountryCodes.CzechRepublic]: {
7750
7810
  vatNumber: [{
7751
7811
  modes: ["blur"],
7752
- validate: (vatNumber2 = "") => {
7812
+ validate: (vatNumber2) => {
7753
7813
  const {
7754
7814
  isValid
7755
7815
  } = validateVatNumber(vatNumber2, CountryCodes.CzechRepublic);
@@ -7761,7 +7821,7 @@ const countryBasedValidatorRules = {
7761
7821
  [CountryCodes.Denmark]: {
7762
7822
  vatNumber: [{
7763
7823
  modes: ["blur"],
7764
- validate: (vatNumber2 = "") => {
7824
+ validate: (vatNumber2) => {
7765
7825
  const {
7766
7826
  isValid
7767
7827
  } = validateVatNumber(vatNumber2, CountryCodes.Denmark);
@@ -7773,7 +7833,7 @@ const countryBasedValidatorRules = {
7773
7833
  [CountryCodes.Estonia]: {
7774
7834
  vatNumber: [{
7775
7835
  modes: ["blur"],
7776
- validate: (vatNumber2 = "") => {
7836
+ validate: (vatNumber2) => {
7777
7837
  const {
7778
7838
  isValid
7779
7839
  } = validateVatNumber(vatNumber2, CountryCodes.Estonia);
@@ -7785,7 +7845,7 @@ const countryBasedValidatorRules = {
7785
7845
  [CountryCodes.Finland]: {
7786
7846
  vatNumber: [{
7787
7847
  modes: ["blur"],
7788
- validate: (vatNumber2 = "") => {
7848
+ validate: (vatNumber2) => {
7789
7849
  const {
7790
7850
  isValid
7791
7851
  } = validateVatNumber(vatNumber2, CountryCodes.Finland);
@@ -7797,7 +7857,7 @@ const countryBasedValidatorRules = {
7797
7857
  [CountryCodes.France]: {
7798
7858
  vatNumber: [{
7799
7859
  modes: ["blur"],
7800
- validate: (vatNumber2 = "") => {
7860
+ validate: (vatNumber2) => {
7801
7861
  const {
7802
7862
  isValid
7803
7863
  } = validateVatNumber(vatNumber2, CountryCodes.France);
@@ -7809,7 +7869,7 @@ const countryBasedValidatorRules = {
7809
7869
  [CountryCodes.Germany]: {
7810
7870
  vatNumber: [{
7811
7871
  modes: ["blur"],
7812
- validate: (vatNumber2 = "") => {
7872
+ validate: (vatNumber2) => {
7813
7873
  const {
7814
7874
  isValid
7815
7875
  } = validateVatNumber(vatNumber2, CountryCodes.Germany);
@@ -7821,7 +7881,7 @@ const countryBasedValidatorRules = {
7821
7881
  [CountryCodes.Greece]: {
7822
7882
  vatNumber: [{
7823
7883
  modes: ["blur"],
7824
- validate: (vatNumber2 = "") => {
7884
+ validate: (vatNumber2) => {
7825
7885
  const {
7826
7886
  isValid
7827
7887
  } = validateVatNumber(vatNumber2, CountryCodes.Greece);
@@ -7833,7 +7893,7 @@ const countryBasedValidatorRules = {
7833
7893
  [CountryCodes.Hungary]: {
7834
7894
  vatNumber: [{
7835
7895
  modes: ["blur"],
7836
- validate: (vatNumber2 = "") => {
7896
+ validate: (vatNumber2) => {
7837
7897
  const {
7838
7898
  isValid
7839
7899
  } = validateVatNumber(vatNumber2, CountryCodes.Hungary);
@@ -7845,7 +7905,7 @@ const countryBasedValidatorRules = {
7845
7905
  [CountryCodes.Italy]: {
7846
7906
  vatNumber: [{
7847
7907
  modes: ["blur"],
7848
- validate: (vatNumber2 = "") => {
7908
+ validate: (vatNumber2) => {
7849
7909
  const {
7850
7910
  isValid
7851
7911
  } = validateVatNumber(vatNumber2, CountryCodes.Italy);
@@ -7857,7 +7917,7 @@ const countryBasedValidatorRules = {
7857
7917
  [CountryCodes.Ireland]: {
7858
7918
  vatNumber: [{
7859
7919
  modes: ["blur"],
7860
- validate: (vatNumber2 = "") => {
7920
+ validate: (vatNumber2) => {
7861
7921
  const {
7862
7922
  isValid
7863
7923
  } = validateVatNumber(vatNumber2, CountryCodes.Ireland);
@@ -7869,7 +7929,7 @@ const countryBasedValidatorRules = {
7869
7929
  [CountryCodes.Latvia]: {
7870
7930
  vatNumber: [{
7871
7931
  modes: ["blur"],
7872
- validate: (vatNumber2 = "") => {
7932
+ validate: (vatNumber2) => {
7873
7933
  const {
7874
7934
  isValid
7875
7935
  } = validateVatNumber(vatNumber2, CountryCodes.Latvia);
@@ -7881,7 +7941,7 @@ const countryBasedValidatorRules = {
7881
7941
  [CountryCodes.Liechtenstein]: {
7882
7942
  vatNumber: [{
7883
7943
  modes: ["blur"],
7884
- validate: (vatNumber2 = "") => {
7944
+ validate: (vatNumber2) => {
7885
7945
  const {
7886
7946
  isValid
7887
7947
  } = validateVatNumber(vatNumber2, CountryCodes.Liechtenstein);
@@ -7893,7 +7953,7 @@ const countryBasedValidatorRules = {
7893
7953
  [CountryCodes.Lithuania]: {
7894
7954
  vatNumber: [{
7895
7955
  modes: ["blur"],
7896
- validate: (vatNumber2 = "") => {
7956
+ validate: (vatNumber2) => {
7897
7957
  const {
7898
7958
  isValid
7899
7959
  } = validateVatNumber(vatNumber2, CountryCodes.Lithuania);
@@ -7905,7 +7965,7 @@ const countryBasedValidatorRules = {
7905
7965
  [CountryCodes.Luxembourg]: {
7906
7966
  vatNumber: [{
7907
7967
  modes: ["blur"],
7908
- validate: (vatNumber2 = "") => {
7968
+ validate: (vatNumber2) => {
7909
7969
  const {
7910
7970
  isValid
7911
7971
  } = validateVatNumber(vatNumber2, CountryCodes.Luxembourg);
@@ -7917,7 +7977,7 @@ const countryBasedValidatorRules = {
7917
7977
  [CountryCodes.Malta]: {
7918
7978
  vatNumber: [{
7919
7979
  modes: ["blur"],
7920
- validate: (vatNumber2 = "") => {
7980
+ validate: (vatNumber2) => {
7921
7981
  const {
7922
7982
  isValid
7923
7983
  } = validateVatNumber(vatNumber2, CountryCodes.Malta);
@@ -7929,7 +7989,7 @@ const countryBasedValidatorRules = {
7929
7989
  [CountryCodes.Monaco]: {
7930
7990
  vatNumber: [{
7931
7991
  modes: ["blur"],
7932
- validate: (vatNumber2 = "") => {
7992
+ validate: (vatNumber2) => {
7933
7993
  const {
7934
7994
  isValid
7935
7995
  } = validateVatNumber(vatNumber2, CountryCodes.Monaco);
@@ -7941,7 +8001,7 @@ const countryBasedValidatorRules = {
7941
8001
  [CountryCodes.Netherlands]: {
7942
8002
  vatNumber: [{
7943
8003
  modes: ["blur"],
7944
- validate: (vatNumber2 = "") => {
8004
+ validate: (vatNumber2) => {
7945
8005
  const {
7946
8006
  isValid
7947
8007
  } = validateVatNumber(vatNumber2, CountryCodes.Netherlands);
@@ -7953,7 +8013,7 @@ const countryBasedValidatorRules = {
7953
8013
  [CountryCodes.Norway]: {
7954
8014
  vatNumber: [{
7955
8015
  modes: ["blur"],
7956
- validate: (vatNumber2 = "") => {
8016
+ validate: (vatNumber2) => {
7957
8017
  const {
7958
8018
  isValid
7959
8019
  } = validateVatNumber(vatNumber2, CountryCodes.Norway);
@@ -7965,7 +8025,7 @@ const countryBasedValidatorRules = {
7965
8025
  [CountryCodes.Poland]: {
7966
8026
  vatNumber: [{
7967
8027
  modes: ["blur"],
7968
- validate: (vatNumber2 = "") => {
8028
+ validate: (vatNumber2) => {
7969
8029
  const {
7970
8030
  isValid
7971
8031
  } = validateVatNumber(vatNumber2, CountryCodes.Poland);
@@ -7977,7 +8037,7 @@ const countryBasedValidatorRules = {
7977
8037
  [CountryCodes.Portugal]: {
7978
8038
  vatNumber: [{
7979
8039
  modes: ["blur"],
7980
- validate: (vatNumber2 = "") => {
8040
+ validate: (vatNumber2) => {
7981
8041
  const {
7982
8042
  isValid
7983
8043
  } = validateVatNumber(vatNumber2, CountryCodes.Portugal);
@@ -7989,7 +8049,7 @@ const countryBasedValidatorRules = {
7989
8049
  [CountryCodes.Romania]: {
7990
8050
  vatNumber: [{
7991
8051
  modes: ["blur"],
7992
- validate: (vatNumber2 = "") => {
8052
+ validate: (vatNumber2) => {
7993
8053
  const {
7994
8054
  isValid
7995
8055
  } = validateVatNumber(vatNumber2, CountryCodes.Romania);
@@ -8001,7 +8061,7 @@ const countryBasedValidatorRules = {
8001
8061
  [CountryCodes.Slovakia]: {
8002
8062
  vatNumber: [{
8003
8063
  modes: ["blur"],
8004
- validate: (vatNumber2 = "") => {
8064
+ validate: (vatNumber2) => {
8005
8065
  const {
8006
8066
  isValid
8007
8067
  } = validateVatNumber(vatNumber2, CountryCodes.Slovakia);
@@ -8013,7 +8073,7 @@ const countryBasedValidatorRules = {
8013
8073
  [CountryCodes.Slovenia]: {
8014
8074
  vatNumber: [{
8015
8075
  modes: ["blur"],
8016
- validate: (vatNumber2 = "") => {
8076
+ validate: (vatNumber2) => {
8017
8077
  const {
8018
8078
  isValid
8019
8079
  } = validateVatNumber(vatNumber2, CountryCodes.Slovenia);
@@ -8025,7 +8085,7 @@ const countryBasedValidatorRules = {
8025
8085
  [CountryCodes.Spain]: {
8026
8086
  vatNumber: [{
8027
8087
  modes: ["blur"],
8028
- validate: (vatNumber2 = "") => {
8088
+ validate: (vatNumber2) => {
8029
8089
  const {
8030
8090
  isValid
8031
8091
  } = validateVatNumber(vatNumber2, CountryCodes.Spain);
@@ -8037,7 +8097,7 @@ const countryBasedValidatorRules = {
8037
8097
  [CountryCodes.Sweden]: {
8038
8098
  vatNumber: [{
8039
8099
  modes: ["blur"],
8040
- validate: (vatNumber2 = "") => {
8100
+ validate: (vatNumber2) => {
8041
8101
  const {
8042
8102
  isValid
8043
8103
  } = validateVatNumber(vatNumber2, CountryCodes.Sweden);
@@ -8049,7 +8109,7 @@ const countryBasedValidatorRules = {
8049
8109
  [CountryCodes.Switzerland]: {
8050
8110
  vatNumber: [{
8051
8111
  modes: ["blur"],
8052
- validate: (vatNumber2 = "") => {
8112
+ validate: (vatNumber2) => {
8053
8113
  const {
8054
8114
  isValid
8055
8115
  } = validateVatNumber(vatNumber2, CountryCodes.Switzerland);
@@ -8061,7 +8121,7 @@ const countryBasedValidatorRules = {
8061
8121
  [CountryCodes.UnitedKingdom]: {
8062
8122
  vatNumber: [{
8063
8123
  modes: ["blur"],
8064
- validate: (vatNumber2 = "") => {
8124
+ validate: (vatNumber2) => {
8065
8125
  const {
8066
8126
  isValid
8067
8127
  } = validateVatNumber(vatNumber2, CountryCodes.UnitedKingdom);
@@ -8073,7 +8133,7 @@ const countryBasedValidatorRules = {
8073
8133
  [CountryCodes.UnitedStates]: {
8074
8134
  vatNumber: [{
8075
8135
  modes: ["blur"],
8076
- validate: (vatNumber2 = "") => {
8136
+ validate: (vatNumber2) => {
8077
8137
  const {
8078
8138
  isValid
8079
8139
  } = validateVatNumber(vatNumber2, CountryCodes.UnitedStates);
@@ -8206,6 +8266,9 @@ const companyDetailsValidationRules = {
8206
8266
  }]
8207
8267
  };
8208
8268
  const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [{
8269
+ companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP],
8270
+ country: CountryCodes.Gibraltar
8271
+ }, {
8209
8272
  companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP],
8210
8273
  country: CountryCodes.Guernsey
8211
8274
  }, {
@@ -8217,6 +8280,9 @@ const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [{
8217
8280
  }, {
8218
8281
  companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP],
8219
8282
  country: CountryCodes.Malta
8283
+ }, {
8284
+ companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP],
8285
+ country: CountryCodes.PuertoRico
8220
8286
  }];
8221
8287
  const companyDetailFields = ["tradingName", "sameNameAsLegalName", ...businessRegistrationNumberFields, "stockExchangeMIC", "stockISIN", ...vatNumberFields, ...taxIdFields];
8222
8288
  function CompanyDetailsComponent(props) {
@@ -8468,10 +8534,186 @@ function useDataset(datasetIdentifier2, skip) {
8468
8534
  loaded
8469
8535
  };
8470
8536
  }
8471
- function CountryField({
8472
- allowedCountries = [],
8473
- classNameModifiers = [],
8474
- errorMessage,
8537
+ const getPayoutAccountFormat = async (context, country2) => {
8538
+ const {
8539
+ loadingContext,
8540
+ clientKey
8541
+ } = context;
8542
+ return httpGet({
8543
+ loadingContext,
8544
+ errorLevel: "warn",
8545
+ errorMessage: `Payout account format configuration is not available`,
8546
+ path: `v1/configuration/accountFormats/${country2}`,
8547
+ clientKey
8548
+ });
8549
+ };
8550
+ const getAllowedCountries = async (context) => {
8551
+ const {
8552
+ loadingContext,
8553
+ clientKey
8554
+ } = context;
8555
+ return httpGet({
8556
+ loadingContext,
8557
+ errorLevel: "warn",
8558
+ errorMessage: `Countries configuration is not available`,
8559
+ path: "v1/configuration/countries",
8560
+ clientKey
8561
+ });
8562
+ };
8563
+ const getAllowedLocales = async (context) => {
8564
+ const {
8565
+ loadingContext,
8566
+ clientKey
8567
+ } = context;
8568
+ return httpGet({
8569
+ loadingContext,
8570
+ errorLevel: "warn",
8571
+ errorMessage: `Locales configuration is not available`,
8572
+ path: "v1/configuration/locales",
8573
+ clientKey
8574
+ });
8575
+ };
8576
+ const getConfiguration = async (context, request) => {
8577
+ const {
8578
+ loadingContext,
8579
+ clientKey
8580
+ } = context;
8581
+ return httpPost({
8582
+ loadingContext,
8583
+ errorLevel: "warn",
8584
+ errorMessage: `Configuration is not available`,
8585
+ path: "v1/configuration",
8586
+ clientKey
8587
+ }, request);
8588
+ };
8589
+ let isFlagsLoaded = false;
8590
+ let isDocumentGuidanceLoaded = false;
8591
+ const getIconContainer = () => {
8592
+ const container = document.createElement("div");
8593
+ container.setAttribute("aria-hidden", "true");
8594
+ container.setAttribute("id", "adl-icon-container");
8595
+ container.style.height = "0";
8596
+ return container;
8597
+ };
8598
+ const buildSpriteDOMFromResponse = (responseData) => {
8599
+ const iconContainer = getIconContainer();
8600
+ iconContainer.innerHTML = responseData;
8601
+ return iconContainer;
8602
+ };
8603
+ const loadFlags = async (loadingContext) => {
8604
+ if (isFlagsLoaded)
8605
+ return;
8606
+ isFlagsLoaded = true;
8607
+ const responseData = await http({
8608
+ loadingContext,
8609
+ path: "static/images/country-flags.svg"
8610
+ }, null, "text");
8611
+ document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
8612
+ };
8613
+ const loadDocumentGuidance = async (loadingContext) => {
8614
+ if (isDocumentGuidanceLoaded)
8615
+ return;
8616
+ isDocumentGuidanceLoaded = true;
8617
+ const responseData = await http({
8618
+ loadingContext,
8619
+ path: "static/images/document-guidance.svg"
8620
+ }, null, "text");
8621
+ document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
8622
+ };
8623
+ const validatePhoneNumber = async (context, phoneNumber2) => {
8624
+ const {
8625
+ loadingContext,
8626
+ clientKey
8627
+ } = context;
8628
+ return httpPost({
8629
+ loadingContext,
8630
+ clientKey,
8631
+ errorLevel: "warn",
8632
+ errorMessage: "Phone validation is not available",
8633
+ path: "v1/validations/phonenumber"
8634
+ }, {
8635
+ number: phoneNumber2
8636
+ });
8637
+ };
8638
+ const logger$e = createLogger("verify-id-number");
8639
+ const verifyIdNumber = async (context, request) => {
8640
+ const {
8641
+ loadingContext,
8642
+ clientKey
8643
+ } = context;
8644
+ try {
8645
+ return await httpPost({
8646
+ loadingContext,
8647
+ errorLevel: "warn",
8648
+ errorMessage: `Id verification is not available`,
8649
+ // Handler for unhappy flows, i.e. status != 200, in the idNumber verification process
8650
+ errorHandler: async (response) => {
8651
+ const responseData = await response;
8652
+ if (responseData.status === 422) {
8653
+ return {
8654
+ status: 422,
8655
+ message: responseData.detail,
8656
+ errorCode: responseData.errorCode
8657
+ };
8658
+ }
8659
+ if (responseData.status === 500) {
8660
+ return {
8661
+ status: 500,
8662
+ message: "Service did not respond, do not block verification"
8663
+ };
8664
+ }
8665
+ return logger$e.warn(`Unexpected response status ${responseData.status}`);
8666
+ },
8667
+ path: "v1/verification/idNumber",
8668
+ clientKey
8669
+ }, request);
8670
+ } catch (e2) {
8671
+ logger$e.warn("WARNING: idNumber verification failed - error:", e2);
8672
+ }
8673
+ };
8674
+ const useKycExternalApi = () => {
8675
+ const {
8676
+ loadingContext,
8677
+ clientKey
8678
+ } = useCoreContext();
8679
+ return {
8680
+ getConfiguration: async (request) => getConfiguration({
8681
+ loadingContext,
8682
+ clientKey
8683
+ }, request),
8684
+ getPayoutAccountFormat: async (country2) => getPayoutAccountFormat({
8685
+ loadingContext,
8686
+ clientKey
8687
+ }, country2),
8688
+ getAllowedCountries: async () => getAllowedCountries({
8689
+ loadingContext,
8690
+ clientKey
8691
+ }),
8692
+ getAllowedLocales: async () => getAllowedLocales({
8693
+ loadingContext,
8694
+ clientKey
8695
+ }),
8696
+ getDataset: async (name, locale) => getDataset({
8697
+ loadingContext,
8698
+ clientKey
8699
+ }, name, locale),
8700
+ loadFlags: async () => loadFlags(loadingContext),
8701
+ loadDocumentGuidance: async () => loadDocumentGuidance(loadingContext),
8702
+ verifyIdNumber: async (request) => verifyIdNumber({
8703
+ loadingContext,
8704
+ clientKey
8705
+ }, request),
8706
+ validatePhoneNumber: async (phoneNumber2) => validatePhoneNumber({
8707
+ loadingContext,
8708
+ clientKey
8709
+ }, phoneNumber2)
8710
+ };
8711
+ };
8712
+ const logger$d = createLogger("CountryField");
8713
+ function CountryField({
8714
+ allowedCountries = [],
8715
+ classNameModifiers = [],
8716
+ errorMessage,
8475
8717
  onDropdownChange,
8476
8718
  value,
8477
8719
  readOnly,
@@ -8481,9 +8723,15 @@ function CountryField({
8481
8723
  const {
8482
8724
  i18n
8483
8725
  } = useCoreContext();
8726
+ const {
8727
+ loadFlags: loadFlags2
8728
+ } = useKycExternalApi();
8484
8729
  const {
8485
8730
  dataset: countriesFromApi
8486
8731
  } = useDataset(datasetIdentifier.country);
8732
+ p(() => {
8733
+ loadFlags2().catch(logger$d.error);
8734
+ }, [loadFlags2]);
8487
8735
  const countries = countriesFromApi.filter((country2) => allowedCountries.length ? allowedCountries.includes(country2.id) : true).map((item) => ({
8488
8736
  ...item,
8489
8737
  sprite: `#adl-flag-${item.id.toLowerCase()}`
@@ -8835,9 +9083,10 @@ var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
8835
9083
  TaskStatus2[TaskStatus2["DOWNLOAD"] = 5] = "DOWNLOAD";
8836
9084
  TaskStatus2[TaskStatus2["ERROR"] = 6] = "ERROR";
8837
9085
  TaskStatus2[TaskStatus2["SIGNED"] = 7] = "SIGNED";
9086
+ TaskStatus2[TaskStatus2["SUBMIT"] = 8] = "SUBMIT";
8838
9087
  return TaskStatus2;
8839
9088
  })(TaskStatus || {});
8840
- 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.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.Romania, CountryCodes.Singapore, CountryCodes.Slovakia, CountryCodes.Slovenia, CountryCodes.Spain, CountryCodes.Sweden, CountryCodes.Switzerland, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
9089
+ 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];
8841
9090
  const ID_NUMBER_EXEMPT_COUNTRIES = [CountryCodes.Canada, CountryCodes.UnitedStates];
8842
9091
  const ID_NUMBER_VERIFICATION_COUNTRIES = [CountryCodes.UnitedStates];
8843
9092
  const COUNTRIES_WHICH_USE_MULTIPLE_IDENTITY_TYPES = [CountryCodes.Australia];
@@ -8923,7 +9172,7 @@ const accountHolderValidationRules = {
8923
9172
  }
8924
9173
  };
8925
9174
  const accountHolderFields = ["accountHolder"];
8926
- const logger$d = createLogger("AccountHolder");
9175
+ const logger$c = createLogger("AccountHolder");
8927
9176
  function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntityTypeAllowed, isTrustFlowEnabled, isSoleProprietorshipAllowed, isChangeToMyNameAllowed) {
8928
9177
  switch (legalEntityType) {
8929
9178
  case LegalEntityType.ORGANIZATION: {
@@ -8933,7 +9182,7 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
8933
9182
  return [...isChangeToMyNameAllowed ? ["myName"] : [], ...isChangeOfLegalEntityTypeAllowed ? ["theCompanyIWorkFor"] : [], ...isTrustFlowEnabled ? ["aTrust"] : [], ...isSoleProprietorshipAllowed ? ["mySoleTraderName"] : []];
8934
9183
  }
8935
9184
  default:
8936
- logger$d.error(`No available account holder options for legal entity type '${legalEntityType}'`);
9185
+ logger$c.error(`No available account holder options for legal entity type '${legalEntityType}'`);
8937
9186
  return [];
8938
9187
  }
8939
9188
  }
@@ -9263,44 +9512,6 @@ const getDocumentGuidancePrefix = (documentType2, isIcon = false, isFront = true
9263
9512
  }
9264
9513
  };
9265
9514
  const _documentGuidance_component = "";
9266
- let isFlagsLoaded = false;
9267
- let isDocumentGuidanceLoaded = false;
9268
- const getIconContainer = () => {
9269
- const container = document.createElement("div");
9270
- container.setAttribute("aria-hidden", "true");
9271
- container.setAttribute("id", "adl-icon-container");
9272
- container.style.height = "0";
9273
- return container;
9274
- };
9275
- const buildSpriteDOMFromResponse = (responseData) => {
9276
- const iconContainer = getIconContainer();
9277
- iconContainer.innerHTML = responseData;
9278
- return iconContainer;
9279
- };
9280
- const loadFlags = async (loadingContext) => {
9281
- if (isFlagsLoaded)
9282
- return Promise.resolve();
9283
- const options2 = {
9284
- loadingContext,
9285
- path: "static/images/country-flags.svg"
9286
- };
9287
- return http(options2, null, "text").then((responseData) => {
9288
- document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
9289
- isFlagsLoaded = true;
9290
- });
9291
- };
9292
- const loadDocumentGuidance = async (loadingContext) => {
9293
- if (isDocumentGuidanceLoaded)
9294
- return Promise.resolve();
9295
- const options2 = {
9296
- loadingContext,
9297
- path: "static/images/document-guidance.svg"
9298
- };
9299
- return http(options2, null, "text").then((responseData) => {
9300
- document.body.insertBefore(buildSpriteDOMFromResponse(responseData), document.body.firstChild);
9301
- isDocumentGuidanceLoaded = true;
9302
- });
9303
- };
9304
9515
  function DocumentGuidance({
9305
9516
  type,
9306
9517
  className
@@ -9699,7 +9910,7 @@ function Dropzone(props) {
9699
9910
  })]
9700
9911
  });
9701
9912
  }
9702
- const logger$c = createLogger("TextArea");
9913
+ const logger$b = createLogger("TextArea");
9703
9914
  function TextArea(props) {
9704
9915
  const {
9705
9916
  classNameModifiers,
@@ -9720,7 +9931,7 @@ function TextArea(props) {
9720
9931
  } = useCoreContext();
9721
9932
  const [value, setValue] = h("");
9722
9933
  if (Object.prototype.hasOwnProperty.call(props, "onChange")) {
9723
- logger$c.error("Error: Form fields that rely on InputBase may not have an onChange property");
9934
+ logger$b.error("Error: Form fields that rely on InputBase may not have an onChange property");
9724
9935
  }
9725
9936
  const handleInput = (e2) => {
9726
9937
  var _a;
@@ -9827,9 +10038,10 @@ function DocumentUploadComponent({
9827
10038
  }, [data, valid, errors, fieldProblems]);
9828
10039
  p(() => {
9829
10040
  var _a2, _b;
9830
- setDocument({
9831
- [documentField]: (_a2 = props == null ? void 0 : props.data) == null ? void 0 : _a2[documentField]
9832
- });
10041
+ if (documentField)
10042
+ setDocument({
10043
+ [documentField]: (_a2 = props == null ? void 0 : props.data) == null ? void 0 : _a2[documentField]
10044
+ });
9833
10045
  setData("description", (_b = props.data) == null ? void 0 : _b.description);
9834
10046
  triggerValidation();
9835
10047
  }, [props.data]);
@@ -9845,7 +10057,7 @@ function DocumentUploadComponent({
9845
10057
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
9846
10058
  formUtils,
9847
10059
  id: "ariaErrorField"
9848
- }), formUtils.isRequiredField(documentField) && o(Fragment, {
10060
+ }), documentField && formUtils.isRequiredField(documentField) && o(Fragment, {
9849
10061
  children: [guidanceHeader, documentTypeSelect && o(Field, {
9850
10062
  name: "documentType",
9851
10063
  label: i18n.get("selectDocumentType"),
@@ -10173,7 +10385,7 @@ function FieldContainer(props) {
10173
10385
  }
10174
10386
  return renderField(fieldName);
10175
10387
  }
10176
- const logger$b = createLogger("SearchAddress");
10388
+ const logger$a = createLogger("SearchAddress");
10177
10389
  const SearchAddress = ({
10178
10390
  data,
10179
10391
  legalEntityId,
@@ -10199,7 +10411,7 @@ const SearchAddress = ({
10199
10411
  const response = await handleFindAddress(selectedAddressId);
10200
10412
  autocompleteAddressForm(response);
10201
10413
  } catch (e2) {
10202
- logger$b.error(e2);
10414
+ logger$a.error(e2);
10203
10415
  }
10204
10416
  };
10205
10417
  const onDrilldown = async (selectedAddress) => {
@@ -10211,7 +10423,7 @@ const SearchAddress = ({
10211
10423
  }, legalEntityId);
10212
10424
  setItems((response == null ? void 0 : response.results) || []);
10213
10425
  } catch (e2) {
10214
- logger$b.error(e2);
10426
+ logger$a.error(e2);
10215
10427
  }
10216
10428
  };
10217
10429
  const onChange = (e2) => {
@@ -10266,7 +10478,7 @@ const SearchAddress = ({
10266
10478
  setItems([]);
10267
10479
  }
10268
10480
  } catch (e2) {
10269
- logger$b.error(e2);
10481
+ logger$a.error(e2);
10270
10482
  }
10271
10483
  setLoading(false);
10272
10484
  }
@@ -10451,6 +10663,12 @@ const countrySpecificFormatters = {
10451
10663
  [CountryCodes.Germany]: {
10452
10664
  postalCode: createFormatByDigits(5)
10453
10665
  },
10666
+ [CountryCodes.Gibraltar]: {
10667
+ postalCode: {
10668
+ format: "GX11 1AA",
10669
+ maxlength: 8
10670
+ }
10671
+ },
10454
10672
  [CountryCodes.Greece]: {
10455
10673
  postalCode: {
10456
10674
  format: "999 99",
@@ -10549,6 +10767,9 @@ const countrySpecificFormatters = {
10549
10767
  maxlength: 8
10550
10768
  }
10551
10769
  },
10770
+ [CountryCodes.PuertoRico]: {
10771
+ postalCode: createFormatByDigits(5)
10772
+ },
10552
10773
  [CountryCodes.Romania]: {
10553
10774
  postalCode: createFormatByDigits(6)
10554
10775
  },
@@ -11515,10 +11736,10 @@ const fileToBase64 = (file) => new Promise((resolve, reject) => {
11515
11736
  reader.onerror = (error) => reject(error);
11516
11737
  });
11517
11738
  const getFileExtention = (fileName2) => fileName2.split(".").pop();
11518
- const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [CountryCodes.Australia, CountryCodes.Guernsey, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Jersey, CountryCodes.Malta, CountryCodes.Spain, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
11739
+ const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [CountryCodes.Australia, CountryCodes.Gibraltar, CountryCodes.Guernsey, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Jersey, CountryCodes.Malta, CountryCodes.PuertoRico, CountryCodes.Spain, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
11519
11740
  const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.UnitedStates];
11520
- const COUNTRIES_WITH_POSSIBLE_REGISTRATION_EXEMPTIONS_FOR_SOLE_PROPS = [CountryCodes.Austria, CountryCodes.Canada, CountryCodes.Finland, CountryCodes.Germany, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Sweden, CountryCodes.Switzerland];
11521
- const COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.HongKong, CountryCodes.NewZealand, CountryCodes.Singapore, CountryCodes.UnitedStates];
11741
+ const COUNTRIES_WITH_POSSIBLE_REGISTRATION_EXEMPTIONS_FOR_SOLE_PROPS = [CountryCodes.Austria, CountryCodes.Canada, CountryCodes.Finland, CountryCodes.Germany, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.Switzerland];
11742
+ const COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.Gibraltar, CountryCodes.HongKong, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.Singapore, CountryCodes.UnitedStates];
11522
11743
  const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_COMPANIES = [
11523
11744
  // strictly a subset of countries which use tax ID
11524
11745
  // right now in all countries companies must provide a tax ID - but maybe there will be exemptions in future?
@@ -12685,8 +12906,8 @@ const getPageName = (document2, pageIndex = 0) => {
12685
12906
  };
12686
12907
  function getProp(object, path) {
12687
12908
  const splitPath = path.split(".");
12688
- const reducer = (xs, x2) => xs && xs[x2] !== void 0 ? xs[x2] : void 0;
12689
- return splitPath.reduce(reducer, object);
12909
+ const reducer2 = (xs, x2) => xs && xs[x2] !== void 0 ? xs[x2] : void 0;
12910
+ return splitPath.reduce(reducer2, object);
12690
12911
  }
12691
12912
  const idDocumentUploadFields = ["idDocumentType", "idFrontPage", "idBackPage", "idDocument"];
12692
12913
  const documentTypeValidationRules$1 = {
@@ -13419,6 +13640,22 @@ const LoaderWrapper = ({
13419
13640
  });
13420
13641
  };
13421
13642
  const containerId = "adyen-kyc-id-verification";
13643
+ const getOnfidoLocaleConfig = (i18n) => {
13644
+ const language = i18n.locale.substring(0, 2);
13645
+ return language === "en" ? {
13646
+ locale: language,
13647
+ phrases: {
13648
+ "country_select.button_primary": i18n.get("continue"),
13649
+ "doc_submit.title_id_back": i18n.get("identityCardBack"),
13650
+ "doc_submit.title_id_front": i18n.get("identityCardFront"),
13651
+ "doc_submit.title_license_back": i18n.get("drivinglicenseBack"),
13652
+ "doc_submit.title_license_front": i18n.get("drivinglicenseFront"),
13653
+ "doc_submit.title_passport": i18n.get("passportPhotoPage"),
13654
+ "doc_submit.title_permit_back": i18n.get("residencePermitBack"),
13655
+ "doc_submit.title_permit_front": i18n.get("residencePermitFront")
13656
+ }
13657
+ } : language;
13658
+ };
13422
13659
  const initOnfido = async ({
13423
13660
  token,
13424
13661
  i18n,
@@ -13429,7 +13666,6 @@ const initOnfido = async ({
13429
13666
  const {
13430
13667
  init: init2
13431
13668
  } = await import("onfido-sdk-ui");
13432
- const language = i18n.locale.substring(0, 2);
13433
13669
  return init2({
13434
13670
  token,
13435
13671
  containerId,
@@ -13450,22 +13686,10 @@ const initOnfido = async ({
13450
13686
  }
13451
13687
  }
13452
13688
  }],
13453
- language: {
13454
- locale: language,
13455
- phrases: {
13456
- "country_select.button_primary": i18n.get("continue"),
13457
- "doc_submit.title_id_back": i18n.get("identityCardBack"),
13458
- "doc_submit.title_id_front": i18n.get("identityCardFront"),
13459
- "doc_submit.title_license_back": i18n.get("drivinglicenseBack"),
13460
- "doc_submit.title_license_front": i18n.get("drivinglicenseFront"),
13461
- "doc_submit.title_passport": i18n.get("passportPhotoPage"),
13462
- "doc_submit.title_permit_back": i18n.get("residencePermitBack"),
13463
- "doc_submit.title_permit_front": i18n.get("residencePermitFront")
13464
- }
13465
- }
13689
+ language: getOnfidoLocaleConfig(i18n)
13466
13690
  });
13467
13691
  };
13468
- const logger$a = createLogger("IdVerificationComponent");
13692
+ const logger$9 = createLogger("IdVerificationComponent");
13469
13693
  function IdVerificationComponent({
13470
13694
  userDetails,
13471
13695
  handleGetIdVerificationToken,
@@ -13484,24 +13708,31 @@ function IdVerificationComponent({
13484
13708
  handleGetIdVerificationToken,
13485
13709
  onIdVerificationError
13486
13710
  });
13711
+ const onfidoSdk = _$1();
13487
13712
  p(() => {
13488
- let onfido;
13489
13713
  (async () => {
13490
13714
  if (!sdkToken)
13491
13715
  return;
13492
- onfido = await initOnfido({
13716
+ onfidoSdk.current = await initOnfido({
13493
13717
  token: sdkToken,
13494
13718
  i18n,
13495
13719
  onIdVerificationClose,
13496
13720
  onIdVerificationError,
13497
13721
  onIdVerificationComplete
13498
13722
  });
13499
- })().catch(logger$a.error);
13723
+ })().catch(logger$9.error);
13500
13724
  return () => {
13501
- if (onfido)
13502
- onfido.tearDown();
13725
+ if (onfidoSdk.current)
13726
+ onfidoSdk.current.tearDown();
13503
13727
  };
13504
13728
  }, [sdkToken]);
13729
+ p(() => {
13730
+ if (!onfidoSdk.current)
13731
+ return;
13732
+ onfidoSdk.current.setOptions({
13733
+ language: getOnfidoLocaleConfig(i18n)
13734
+ });
13735
+ }, [i18n.locale]);
13505
13736
  return o(LoaderWrapper, {
13506
13737
  status: loadingStatus,
13507
13738
  children: o("div", {
@@ -13541,7 +13772,7 @@ function IdDocumentAlreadyUpload(props) {
13541
13772
  })]
13542
13773
  });
13543
13774
  }
13544
- const logger$9 = createLogger("IdDocumentInstantVerificationComponent");
13775
+ const logger$8 = createLogger("IdDocumentInstantVerificationComponent");
13545
13776
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
13546
13777
  const documentTypeValidationRules = {
13547
13778
  instantIdVerificationData: {
@@ -13622,7 +13853,7 @@ function IdDocumentInstantVerificationComponent(props) {
13622
13853
  handleGetIdVerificationToken: props.handleGetIdVerificationToken,
13623
13854
  userDetails: props.userDetails,
13624
13855
  onIdVerificationComplete: handleIdVerificationComplete,
13625
- onIdVerificationError: logger$9.error
13856
+ onIdVerificationError: logger$8.error
13626
13857
  }), o("div", {
13627
13858
  className: "adyen-kyc-document-upload__manual-upload",
13628
13859
  children: [i18n.get("canNotCompleteInstantVerification"), " ", o("button", {
@@ -13902,173 +14133,32 @@ function IdVerificationMethodComponent(props) {
13902
14133
  })]
13903
14134
  });
13904
14135
  }
13905
- const getPayoutAccountFormat = async (context, country2) => {
13906
- const {
13907
- loadingContext,
13908
- clientKey
13909
- } = context;
13910
- return httpGet({
13911
- loadingContext,
13912
- errorLevel: "warn",
13913
- errorMessage: `Payout account format configuration is not available`,
13914
- path: `v1/configuration/accountFormats/${country2}`,
13915
- clientKey
13916
- });
14136
+ const FIELD = "idNumber";
14137
+ const verifyIdNumberHelper = (idRtnData) => {
14138
+ if ((idRtnData == null ? void 0 : idRtnData.status) === 422 || (idRtnData == null ? void 0 : idRtnData.verified) === "false") {
14139
+ return {
14140
+ status: "error",
14141
+ data: idRtnData,
14142
+ fieldName: FIELD,
14143
+ translationKey: "unableToVerifyTheIdNumber"
14144
+ };
14145
+ }
14146
+ if ((idRtnData == null ? void 0 : idRtnData.status) === 500) {
14147
+ return {
14148
+ status: "verified",
14149
+ data: idRtnData,
14150
+ fieldName: FIELD
14151
+ };
14152
+ }
14153
+ if ((idRtnData == null ? void 0 : idRtnData.verified) === "true") {
14154
+ return {
14155
+ status: "verified",
14156
+ data: idRtnData,
14157
+ fieldName: FIELD
14158
+ };
14159
+ }
13917
14160
  };
13918
- const getAllowedCountries = async (context) => {
13919
- const {
13920
- loadingContext,
13921
- clientKey
13922
- } = context;
13923
- return httpGet({
13924
- loadingContext,
13925
- errorLevel: "warn",
13926
- errorMessage: `Countries configuration is not available`,
13927
- path: "v1/configuration/countries",
13928
- clientKey
13929
- });
13930
- };
13931
- const getAllowedLocales = async (context) => {
13932
- const {
13933
- loadingContext,
13934
- clientKey
13935
- } = context;
13936
- return httpGet({
13937
- loadingContext,
13938
- errorLevel: "warn",
13939
- errorMessage: `Locales configuration is not available`,
13940
- path: "v1/configuration/locales",
13941
- clientKey
13942
- });
13943
- };
13944
- const getConfiguration = async (context, request) => {
13945
- const {
13946
- loadingContext,
13947
- clientKey
13948
- } = context;
13949
- return httpPost({
13950
- loadingContext,
13951
- errorLevel: "warn",
13952
- errorMessage: `Configuration is not available`,
13953
- path: "v1/configuration",
13954
- clientKey
13955
- }, request);
13956
- };
13957
- const validatePhoneNumber = async (context, phoneNumber2) => {
13958
- const {
13959
- loadingContext,
13960
- clientKey
13961
- } = context;
13962
- return httpPost({
13963
- loadingContext,
13964
- clientKey,
13965
- errorLevel: "warn",
13966
- errorMessage: "Phone validation is not available",
13967
- path: "v1/validations/phonenumber"
13968
- }, {
13969
- number: phoneNumber2
13970
- });
13971
- };
13972
- const logger$8 = createLogger("verify-id-number");
13973
- const verifyIdNumber = async (context, request) => {
13974
- const {
13975
- loadingContext,
13976
- clientKey
13977
- } = context;
13978
- try {
13979
- return await httpPost({
13980
- loadingContext,
13981
- errorLevel: "warn",
13982
- errorMessage: `Id verification is not available`,
13983
- // Handler for unhappy flows, i.e. status != 200, in the idNumber verification process
13984
- errorHandler: async (response) => {
13985
- const responseData = await response;
13986
- if (responseData.status === 422) {
13987
- return {
13988
- status: 422,
13989
- message: responseData.detail,
13990
- errorCode: responseData.errorCode
13991
- };
13992
- }
13993
- if (responseData.status === 500) {
13994
- return {
13995
- status: 500,
13996
- message: "Service did not respond, do not block verification"
13997
- };
13998
- }
13999
- return logger$8.warn(`Unexpected response status ${responseData.status}`);
14000
- },
14001
- path: "v1/verification/idNumber",
14002
- clientKey
14003
- }, request);
14004
- } catch (e2) {
14005
- logger$8.warn("WARNING: idNumber verification failed - error:", e2);
14006
- }
14007
- };
14008
- const useKycExternalApi = () => {
14009
- const {
14010
- loadingContext,
14011
- clientKey
14012
- } = useCoreContext();
14013
- return {
14014
- getConfiguration: async (request) => getConfiguration({
14015
- loadingContext,
14016
- clientKey
14017
- }, request),
14018
- getPayoutAccountFormat: async (country2) => getPayoutAccountFormat({
14019
- loadingContext,
14020
- clientKey
14021
- }, country2),
14022
- getAllowedCountries: async () => getAllowedCountries({
14023
- loadingContext,
14024
- clientKey
14025
- }),
14026
- getAllowedLocales: async () => getAllowedLocales({
14027
- loadingContext,
14028
- clientKey
14029
- }),
14030
- getDataset: async (name, locale) => getDataset({
14031
- loadingContext,
14032
- clientKey
14033
- }, name, locale),
14034
- loadFlags: async () => loadFlags(loadingContext),
14035
- loadDocumentGuidance: async () => loadDocumentGuidance(loadingContext),
14036
- verifyIdNumber: async (request) => verifyIdNumber({
14037
- loadingContext,
14038
- clientKey
14039
- }, request),
14040
- validatePhoneNumber: async (phoneNumber2) => validatePhoneNumber({
14041
- loadingContext,
14042
- clientKey
14043
- }, phoneNumber2)
14044
- };
14045
- };
14046
- const FIELD = "idNumber";
14047
- const verifyIdNumberHelper = (idRtnData) => {
14048
- if ((idRtnData == null ? void 0 : idRtnData.status) === 422 || (idRtnData == null ? void 0 : idRtnData.verified) === "false") {
14049
- return {
14050
- status: "error",
14051
- data: idRtnData,
14052
- fieldName: FIELD,
14053
- translationKey: "unableToVerifyTheIdNumber"
14054
- };
14055
- }
14056
- if ((idRtnData == null ? void 0 : idRtnData.status) === 500) {
14057
- return {
14058
- status: "verified",
14059
- data: idRtnData,
14060
- fieldName: FIELD
14061
- };
14062
- }
14063
- if ((idRtnData == null ? void 0 : idRtnData.verified) === "true") {
14064
- return {
14065
- status: "verified",
14066
- data: idRtnData,
14067
- fieldName: FIELD
14068
- };
14069
- }
14070
- };
14071
- function useVerification(fieldsToVerify, country2) {
14161
+ function useVerification(fieldsToVerify, country2) {
14072
14162
  const {
14073
14163
  verifyIdNumber: verifyIdNumber2
14074
14164
  } = useKycExternalApi();
@@ -14156,10 +14246,14 @@ const phoneFormatters = {
14156
14246
  const phoneFields = ["phoneNumber"];
14157
14247
  const DEFAULT_PHONE_PREFIX = "+1";
14158
14248
  function PhoneInputComponent(props) {
14159
- var _a, _b;
14249
+ var _a;
14160
14250
  const {
14251
+ data: dataProp,
14161
14252
  dataStoreId,
14162
- country: country2
14253
+ country: country2,
14254
+ phonePrefixes,
14255
+ requiredFields,
14256
+ fieldValidationErrors
14163
14257
  } = props;
14164
14258
  const {
14165
14259
  i18n
@@ -14168,8 +14262,8 @@ function PhoneInputComponent(props) {
14168
14262
  setState: null
14169
14263
  });
14170
14264
  const formUtils = formUtilities(props, i18n);
14171
- const phonePrefix = ((_b = (_a = props.phonePrefixes) == null ? void 0 : _a.find((item) => item.id === country2)) == null ? void 0 : _b.name) ?? DEFAULT_PHONE_PREFIX;
14172
- const staticRules = staticPhoneValidationRules(props.phonePrefixes, phonePrefix);
14265
+ const phonePrefix = ((_a = phonePrefixes == null ? void 0 : phonePrefixes.find((item) => item.id === country2)) == null ? void 0 : _a.name) ?? DEFAULT_PHONE_PREFIX;
14266
+ const staticRules = F$1(() => staticPhoneValidationRules(phonePrefixes, phonePrefix), [phonePrefix, phonePrefixes]);
14173
14267
  const asyncRules = useAsyncPhoneValidationRules();
14174
14268
  const {
14175
14269
  handleChangeFor,
@@ -14182,16 +14276,16 @@ function PhoneInputComponent(props) {
14182
14276
  triggerValidation
14183
14277
  } = useForm({
14184
14278
  ...props,
14185
- schema: props.requiredFields,
14186
- defaultData: props.data,
14279
+ schema: requiredFields ?? phoneFields,
14280
+ defaultData: dataProp,
14187
14281
  formatters: phoneFormatters,
14188
14282
  rules: staticRules,
14189
14283
  asyncRules,
14190
- fieldProblems: props == null ? void 0 : props.fieldValidationErrors
14284
+ fieldProblems: fieldValidationErrors
14191
14285
  });
14192
14286
  p(() => {
14193
- var _a2, _b2;
14194
- (_b2 = (_a2 = stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b2.call(_a2, {
14287
+ var _a2, _b;
14288
+ (_b = (_a2 = stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
14195
14289
  type: "addToState",
14196
14290
  value: {
14197
14291
  data,
@@ -14242,8 +14336,7 @@ const PhoneInput = x(PhoneInputComponent, (prevProps, nextProps) => prevProps.co
14242
14336
  const contactDetailsValidationRules = {
14243
14337
  email: {
14244
14338
  modes: ["blur"],
14245
- // prettier-ignore
14246
- validate: (email2) => emailPattern.test(email2),
14339
+ validate: (email2) => email2 ? emailPattern.test(email2) : false,
14247
14340
  errorMessage: "invalidEmail"
14248
14341
  }
14249
14342
  };
@@ -14909,7 +15002,7 @@ function IdentityNumber(props) {
14909
15002
  triggerValidation
14910
15003
  } = useForm({
14911
15004
  ...props,
14912
- schema: requiredFields,
15005
+ schema: requiredFields ?? idNumberFields,
14913
15006
  formatters: formattingRules,
14914
15007
  rules: validationRules,
14915
15008
  defaultData: propData,
@@ -15735,16 +15828,6 @@ const idVerificationMethodFormID = individualForms.idVerificationMethod.formId;
15735
15828
  const proofOfResidencyFormID = individualForms.proofOfResidence.formId;
15736
15829
  const proofOfNationalIdFormID = individualForms.proofOfNationalId.formId;
15737
15830
  const individualDocumentForms = [idVerificationMethodFormID, idDocumentFormID, proofOfResidencyFormID, proofOfNationalIdFormID];
15738
- const hasIdNumberExemptChanged = (prevState, currentState) => {
15739
- var _a, _b, _c, _d;
15740
- const idNumberExemptPrev = (_b = (_a = prevState.data) == null ? void 0 : _a.personalDetails) == null ? void 0 : _b.idNumberExempt;
15741
- const idNumberExempt = (_d = (_c = currentState.data) == null ? void 0 : _c.personalDetails) == null ? void 0 : _d.idNumberExempt;
15742
- return idNumberExemptPrev != null && idNumberExempt != null && idNumberExempt !== idNumberExemptPrev;
15743
- };
15744
- const hasTypeOfIdentityChanged = (prevState, currentState) => {
15745
- var _a, _b, _c, _d;
15746
- return ((_b = (_a = prevState == null ? void 0 : prevState.data) == null ? void 0 : _a.personalDetails) == null ? void 0 : _b.typeOfIdentity) !== ((_d = (_c = currentState == null ? void 0 : currentState.data) == null ? void 0 : _c.personalDetails) == null ? void 0 : _d.typeOfIdentity);
15747
- };
15748
15831
  function IndividualComponent(props) {
15749
15832
  var _a, _b, _c, _d, _e, _f, _g, _h;
15750
15833
  const {
@@ -15788,9 +15871,6 @@ function IndividualComponent(props) {
15788
15871
  prevState
15789
15872
  }) => {
15790
15873
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j;
15791
- if (hasIdNumberExemptChanged(prevState, currentState) || hasTypeOfIdentityChanged(prevState, currentState) || hasRoleChanged(prevState, currentState)) {
15792
- props.evaluateConfiguration(currentState.allData);
15793
- }
15794
15874
  const residencyCountryPrev = (_b2 = (_a2 = prevState.data) == null ? void 0 : _a2.personalDetails) == null ? void 0 : _b2.residencyCountry;
15795
15875
  const residencyCountry2 = (_d2 = (_c2 = currentState.data) == null ? void 0 : _c2.personalDetails) == null ? void 0 : _d2.residencyCountry;
15796
15876
  if (residencyCountry2 != null && residencyCountry2 !== residencyCountryPrev) {
@@ -15812,10 +15892,6 @@ function IndividualComponent(props) {
15812
15892
  const isIdAlreadyUploaded = ((_a2 = data == null ? void 0 : data.idDocument) == null ? void 0 : _a2.instantIdVerificationData) || ((_c2 = (_b2 = props.data) == null ? void 0 : _b2.idDocument) == null ? void 0 : _c2.idDocumentType);
15813
15893
  props.setHideFooter(isIdDocumentFormActive && !isIdAlreadyUploaded && isInstantIdVerificationEnabled);
15814
15894
  }, [props.activeForm, idVerificationMethodSelected, props.handleGetIdVerificationToken, (_f = data == null ? void 0 : data.idDocument) == null ? void 0 : _f.instantIdVerificationData, (_h = (_g = props.data) == null ? void 0 : _g.idDocument) == null ? void 0 : _h.idDocumentType]);
15815
- const hasRoleChanged = (prevState, currentState) => {
15816
- var _a2, _b2, _c2, _d2;
15817
- return props.taskType === TaskTypes.DECISION_MAKER && !doArraysMatch(((_b2 = (_a2 = prevState.data) == null ? void 0 : _a2.personalDetails) == null ? void 0 : _b2.role) || [], ((_d2 = (_c2 = currentState.data) == null ? void 0 : _c2.personalDetails) == null ? void 0 : _d2.role) || []);
15818
- };
15819
15895
  const renderActiveForm = (activeForm) => {
15820
15896
  var _a2;
15821
15897
  return o(Fragment, {
@@ -15920,7 +15996,8 @@ const ActionBar = ({
15920
15996
  backButtonLabel,
15921
15997
  nextButtonLabel,
15922
15998
  hideOnHomeButton,
15923
- hideBackButton
15999
+ hideBackButton,
16000
+ nextButtonDisabled = false
15924
16001
  }) => o("div", {
15925
16002
  className: "adyen-action-bar",
15926
16003
  children: [(onBack || onNext) && o("div", {
@@ -15935,7 +16012,8 @@ const ActionBar = ({
15935
16012
  label: nextButtonLabel,
15936
16013
  className: "adyen-action-bar__button",
15937
16014
  onClick: onNext,
15938
- testId: "nextBtn"
16015
+ testId: "nextBtn",
16016
+ disabled: nextButtonDisabled
15939
16017
  })]
15940
16018
  }), onHome && homeButtonLabel && !hideOnHomeButton && o("div", {
15941
16019
  className: "adyen-action-bar__action",
@@ -15983,6 +16061,7 @@ const currencyByCountry = {
15983
16061
  [CountryCodes.Finland]: [Currency.EUR],
15984
16062
  [CountryCodes.France]: [Currency.EUR],
15985
16063
  [CountryCodes.Germany]: [Currency.EUR],
16064
+ [CountryCodes.Gibraltar]: [Currency.GBP],
15986
16065
  [CountryCodes.Greece]: [Currency.EUR],
15987
16066
  [CountryCodes.Guernsey]: [Currency.GBP],
15988
16067
  [CountryCodes.Hungary]: [Currency.HUF, Currency.EUR],
@@ -16000,6 +16079,7 @@ const currencyByCountry = {
16000
16079
  [CountryCodes.Norway]: [Currency.NOK, Currency.EUR],
16001
16080
  [CountryCodes.Poland]: [Currency.PLN, Currency.EUR],
16002
16081
  [CountryCodes.Portugal]: [Currency.EUR],
16082
+ [CountryCodes.PuertoRico]: [Currency.USD],
16003
16083
  [CountryCodes.Romania]: [Currency.RON, Currency.EUR],
16004
16084
  [CountryCodes.Singapore]: [Currency.SGD],
16005
16085
  [CountryCodes.Slovakia]: [Currency.EUR],
@@ -16555,7 +16635,7 @@ function Summary({
16555
16635
  gotoForm,
16556
16636
  labels: labels2,
16557
16637
  problems,
16558
- trackNavigation = noop,
16638
+ trackNavigation: trackNavigation2 = noop,
16559
16639
  omittedForms = []
16560
16640
  }) {
16561
16641
  var _a, _b;
@@ -16594,7 +16674,7 @@ function Summary({
16594
16674
  tertiary: true,
16595
16675
  icon: "edit",
16596
16676
  onClick: () => {
16597
- trackNavigation({
16677
+ trackNavigation2({
16598
16678
  fromForm: {
16599
16679
  formName: "summary",
16600
16680
  formId: "summary"
@@ -16703,6 +16783,13 @@ const getSupportedCurrencyGuidance = (i18n, country2, requiredFields) => {
16703
16783
  var _a;
16704
16784
  if (shouldShowPayoutAlert(country2)) {
16705
16785
  if (country2 === CountryCodes.Sweden) {
16786
+ if (requiredFields.includes("iban")) {
16787
+ return i18n.get("payoutInOnly_", {
16788
+ values: {
16789
+ currency: Currency.EUR
16790
+ }
16791
+ });
16792
+ }
16706
16793
  return i18n.get("payoutInOnly_", {
16707
16794
  values: {
16708
16795
  currency: Currency.SEK
@@ -18374,7 +18461,7 @@ function SolePropComponent(props) {
18374
18461
  children: o(CompanyNameAndCountryComponent, {
18375
18462
  ...solePropNameAndCountryFormProps,
18376
18463
  data: {
18377
- ...solePropNameAndCountryFormProps.data,
18464
+ ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18378
18465
  companyCountry: props.country
18379
18466
  },
18380
18467
  labels: {
@@ -18390,7 +18477,7 @@ function SolePropComponent(props) {
18390
18477
  children: o(CompanyDetailsComponent, {
18391
18478
  ...solePropsRegistrationDetailsFormProps,
18392
18479
  data: {
18393
- ...solePropsRegistrationDetailsFormProps.data,
18480
+ ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18394
18481
  tradingName: tradingName2
18395
18482
  },
18396
18483
  heading: i18n.get("registrationDetails"),
@@ -18911,7 +18998,7 @@ function setVerificationError(error, entityProblems) {
18911
18998
  break;
18912
18999
  }
18913
19000
  case VerificationErrorType.DATA_REVIEW:
18914
- entityProblems.isReviewRequired = true;
19001
+ setReviewRequiredError(error, entityProblems);
18915
19002
  break;
18916
19003
  case VerificationErrorType.PENDING_STATUS: {
18917
19004
  setPriorityStatus(entityProblems, TaskStatus.PROCESSING);
@@ -18923,6 +19010,14 @@ function setMissingDataError(verificationError, entityProblems) {
18923
19010
  entityProblems.missingData = entityProblems.missingData ? [...entityProblems.missingData, verificationError] : [verificationError];
18924
19011
  setPriorityStatus(entityProblems, TaskStatus.DETAILS_REQUIRED);
18925
19012
  }
19013
+ const setReviewRequiredError = (verificationError, entityProblems) => {
19014
+ entityProblems.isReviewRequired = true;
19015
+ entityProblems.verificationErrors.review = {
19016
+ ...entityProblems.verificationErrors.review ?? {},
19017
+ [verificationError.code]: verificationError.remediatingActions
19018
+ };
19019
+ setPriorityStatus(entityProblems, TaskStatus.SUBMIT);
19020
+ };
18926
19021
  function setInvalidInputError(parentVerificationError, entityProblems) {
18927
19022
  var _a, _b;
18928
19023
  const processedSubErrors = (_a = parentVerificationError == null ? void 0 : parentVerificationError.subErrors) == null ? void 0 : _a.reduce((acc, {
@@ -19227,17 +19322,6 @@ const countryConfig$1 = {
19227
19322
  label: "listitemVoidedChequeBankLetterBankStatementOnline"
19228
19323
  }
19229
19324
  },
19230
- [CountryCodes.UnitedKingdom]: {
19231
- branchCode: {
19232
- label: "sortCode"
19233
- },
19234
- bankCity: {
19235
- label: "bankCityTown"
19236
- },
19237
- bankStatementDocument: {
19238
- label: "listitemVoidedChequeBankLetterBankStatementOnline"
19239
- }
19240
- },
19241
19325
  [CountryCodes.HongKong]: {
19242
19326
  bankCode: {
19243
19327
  label: "clearingCode"
@@ -19270,6 +19354,17 @@ const countryConfig$1 = {
19270
19354
  label: "bic"
19271
19355
  }
19272
19356
  },
19357
+ [CountryCodes.UnitedKingdom]: {
19358
+ branchCode: {
19359
+ label: "sortCode"
19360
+ },
19361
+ bankCity: {
19362
+ label: "bankCityTown"
19363
+ },
19364
+ bankStatementDocument: {
19365
+ label: "listitemVoidedChequeBankLetterBankStatementOnline"
19366
+ }
19367
+ },
19273
19368
  [CountryCodes.UnitedStates]: {
19274
19369
  branchCode: {
19275
19370
  label: "achRoutingNumber"
@@ -19315,7 +19410,7 @@ const getValidatorRules = (validationRule) => {
19315
19410
  case "bic_either8or11":
19316
19411
  return {
19317
19412
  modes: ["blur", "input"],
19318
- validate: (value) => /^([a-zA-Z0-9]{8}|[a-zA-Z0-9]{11})$/.test(value),
19413
+ validate: (value) => /^([a-zA-Z0-9]{8}|[a-zA-Z0-9]{11})$/.test(value ?? ""),
19319
19414
  errorMessage: "validation8Or11Characters"
19320
19415
  };
19321
19416
  case "iban":
@@ -19365,13 +19460,13 @@ const getValidatorRules = (validationRule) => {
19365
19460
  }
19366
19461
  };
19367
19462
  const defaultPayoutAccountFormat = {
19368
- [CountryCodes.UnitedKingdom]: "local",
19369
19463
  [CountryCodes.CzechRepublic]: "iban",
19370
19464
  [CountryCodes.Denmark]: "local",
19371
19465
  [CountryCodes.Hungary]: "iban",
19372
19466
  [CountryCodes.Norway]: "local",
19373
19467
  [CountryCodes.Poland]: "local",
19374
- [CountryCodes.Sweden]: "local"
19468
+ [CountryCodes.Sweden]: "local",
19469
+ [CountryCodes.UnitedKingdom]: "local"
19375
19470
  };
19376
19471
  const solePropBase = {
19377
19472
  companyCountry: {
@@ -19565,7 +19660,7 @@ const isFieldRequired = (fieldConfigurations, customRules) => {
19565
19660
  }
19566
19661
  return fieldConfigurations && ((fieldConfigurations == null ? void 0 : fieldConfigurations.rule) === "REQUIRED" || (customRules == null ? void 0 : customRules[fieldConfigurations.rule]) && customRules[fieldConfigurations.rule]() === "REQUIRED");
19567
19662
  };
19568
- function getPropsFromConfigurations(scenarioConfiguration, forms, remediationActions, dataMissingErrors, customRules = {}, customLabels = {}) {
19663
+ function getPropsFromConfigurations(scenarioConfiguration, forms, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels = {}) {
19569
19664
  var _a;
19570
19665
  const requiredFields = {};
19571
19666
  const optionalFields = {};
@@ -19580,13 +19675,15 @@ function getPropsFromConfigurations(scenarioConfiguration, forms, remediationAct
19580
19675
  }
19581
19676
  (_a = Object.entries(forms)) == null ? void 0 : _a.forEach(([formId, formDetails]) => {
19582
19677
  var _a2;
19678
+ const formFieldsWithExistingData = fieldsWithExistingData.filter((field) => field.startsWith(formId)).map((field) => field.slice(field.lastIndexOf(".") + 1));
19583
19679
  (_a2 = formDetails == null ? void 0 : formDetails.fields) == null ? void 0 : _a2.forEach((field) => {
19584
19680
  var _a3;
19585
19681
  const fieldConfigurations = scenarioConfiguration[field];
19586
19682
  const isRequiredFromFieldConfig = isFieldRequired(fieldConfigurations, customRules);
19587
19683
  const isFieldRequiredByRemediationAction = showRemediationField(field, remediationActions);
19588
19684
  const isFieldNeededToRemediateDataMissingError = isFieldRequiredToRemediateDataMissingError(field, dataMissingErrors);
19589
- const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError;
19685
+ const fieldHasExistingData = formFieldsWithExistingData.includes(field);
19686
+ const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError || fieldHasExistingData;
19590
19687
  if (isRequired) {
19591
19688
  requiredFields[formId] = requiredFields[formId] ? [...requiredFields[formId], field] : [field];
19592
19689
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
@@ -19773,7 +19870,7 @@ const logger$4 = createLogger("useScenarioConfiguration");
19773
19870
  const useScenarioConfiguration = ({
19774
19871
  getConfigurationData,
19775
19872
  getPayoutAccountFormatData,
19776
- parseConfiguration,
19873
+ parseConfiguration: parseConfiguration2,
19777
19874
  country: country2,
19778
19875
  instantVerificationEnabled,
19779
19876
  setLoadingStatus
@@ -19800,6 +19897,8 @@ const useScenarioConfiguration = ({
19800
19897
  }, [getConfigurationData, setLoadingStatus]);
19801
19898
  p(() => {
19802
19899
  setLoadingStatus("loading");
19900
+ if (!getPayoutAccountFormatData)
19901
+ return;
19803
19902
  const makePayoutFormatCallAndSave = async () => {
19804
19903
  try {
19805
19904
  const accountFormatResponse2 = await getPayoutAccountFormatData();
@@ -19819,33 +19918,84 @@ const useScenarioConfiguration = ({
19819
19918
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus]);
19820
19919
  const {
19821
19920
  fieldConfigurations,
19822
- bankVerificationVendors
19921
+ bankVerificationVendors,
19922
+ requiredFields
19823
19923
  } = F$1(() => {
19824
- if (!configurationResponse || !accountFormatResponse || !accountFormat)
19924
+ if (!configurationResponse)
19825
19925
  return {};
19826
19926
  const {
19827
19927
  matchingScenario,
19828
19928
  bankVerificationProviders
19829
19929
  } = configurationResponse;
19830
- const scenarioConfig = parseConfiguration({
19831
- requiredFields: accountFormatResponse[accountFormat],
19930
+ const payoutRequiredFields = accountFormatResponse && accountFormat ? accountFormatResponse[accountFormat] : void 0;
19931
+ const scenarioConfig = parseConfiguration2(payoutRequiredFields ? {
19832
19932
  matchingScenario,
19833
19933
  country: country2,
19934
+ requiredFields: payoutRequiredFields,
19834
19935
  bankVerificationAvailable: instantVerificationEnabled && (bankVerificationProviders == null ? void 0 : bankVerificationProviders[country2]) !== void 0
19936
+ } : {
19937
+ matchingScenario,
19938
+ country: country2,
19939
+ requiredFields: void 0,
19940
+ bankVerificationAvailable: void 0
19835
19941
  });
19836
19942
  return {
19837
19943
  fieldConfigurations: scenarioConfig,
19838
- bankVerificationVendors: bankVerificationProviders
19944
+ bankVerificationVendors: bankVerificationProviders,
19945
+ requiredFields: payoutRequiredFields
19839
19946
  };
19840
- }, [accountFormatResponse, accountFormat, configurationResponse, country2, parseConfiguration, instantVerificationEnabled]);
19841
- if (!configurationResponse || !accountFormatResponse || !accountFormat)
19842
- return {};
19947
+ }, [accountFormatResponse, accountFormat, configurationResponse, country2, parseConfiguration2, instantVerificationEnabled]);
19843
19948
  return {
19844
- requiredFields: accountFormatResponse[accountFormat],
19949
+ requiredFields,
19845
19950
  fieldConfigurations,
19846
19951
  bankVerificationVendors
19847
19952
  };
19848
19953
  };
19954
+ const getRequiredForms = (forms, requiredFields, optionalFields) => {
19955
+ const requiredForms = Object.values(forms).filter(({
19956
+ formId
19957
+ }) => {
19958
+ if (requiredFields || optionalFields) {
19959
+ return Boolean(requiredFields[formId]) || Boolean(optionalFields[formId]);
19960
+ }
19961
+ return true;
19962
+ });
19963
+ return [...requiredForms, summaryStep];
19964
+ };
19965
+ const addValidityToForms = (forms, formValidity, problems) => forms.map(({
19966
+ formId,
19967
+ formName
19968
+ }) => {
19969
+ var _a;
19970
+ return {
19971
+ formId,
19972
+ formName,
19973
+ isValid: (formValidity == null ? void 0 : formValidity[formId]) ?? false,
19974
+ hasServerValidationErrors: Boolean((_a = problems == null ? void 0 : problems.validationErrors) == null ? void 0 : _a[formId])
19975
+ };
19976
+ });
19977
+ const convertApiFieldNameToSchemaFieldName = (apiField, legalEntityType) => {
19978
+ switch (legalEntityType) {
19979
+ case LegalEntityType.INDIVIDUAL:
19980
+ return individualApiKeyMapping[apiField];
19981
+ case LegalEntityType.ORGANIZATION:
19982
+ return companyApiKeyMapping[apiField];
19983
+ case LegalEntityType.SOLE_PROPRIETORSHIP:
19984
+ return solePropApiKeyMapping[apiField];
19985
+ case LegalEntityType.TRUST:
19986
+ return trustApiKeyMapping[apiField];
19987
+ default:
19988
+ throw Error("No valid legal entity type, cannot convert");
19989
+ }
19990
+ };
19991
+ const knownProblematicFields = ["personalDetails.typeOfIdentity", "personalDetails.issuerState"];
19992
+ const getFieldsWithExistingData = (legalEntity) => {
19993
+ const apiFieldsWithExistingData = getNestedPropertyKeys(legalEntity);
19994
+ const legalEntityType = legalEntity.type;
19995
+ if (!legalEntityType)
19996
+ return [];
19997
+ return apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
19998
+ };
19849
19999
  const DropinLayout$1 = "";
19850
20000
  const DropinLayout = (props) => {
19851
20001
  const {
@@ -19869,7 +20019,6 @@ const DropinLayout = (props) => {
19869
20019
  const FormNavigation$1 = "";
19870
20020
  const FormNavigationItem$1 = "";
19871
20021
  const FormNavigationItem = ({
19872
- trackNavigation,
19873
20022
  form,
19874
20023
  isActive,
19875
20024
  onClick,
@@ -19878,17 +20027,13 @@ const FormNavigationItem = ({
19878
20027
  const {
19879
20028
  i18n
19880
20029
  } = useCoreContext();
19881
- const navigate = () => {
19882
- trackNavigation();
19883
- onClick();
19884
- };
19885
20030
  return o("li", {
19886
20031
  className: cx("adyen-kyc-form-navigation__item", {
19887
20032
  "adyen-kyc-form-navigation__item--active": isActive,
19888
20033
  "adyen-kyc-form-navigation__item--valid": form.isValid,
19889
- "adyen-kyc-form-navigation__item--isnav": onClick
20034
+ "adyen-kyc-form-navigation__item--isnav": Boolean(onClick)
19890
20035
  }),
19891
- onClick: navigate,
20036
+ onClick,
19892
20037
  children: [i18n.get(form.formName), form.hasServerValidationErrors && o("span", {
19893
20038
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--error",
19894
20039
  children: o(AlertIcon, {
@@ -19909,35 +20054,31 @@ function FormNavigation({
19909
20054
  validateForm,
19910
20055
  className,
19911
20056
  taskName,
19912
- hasVerificationErrors,
19913
- trackNavigation = noop
20057
+ hasVerificationErrors = false,
20058
+ trackNavigation: trackNavigation2 = noop
19914
20059
  }) {
19915
20060
  const {
19916
20061
  i18n
19917
20062
  } = useCoreContext();
19918
- const getLinkedFormIndex = (linkedForm) => forms == null ? void 0 : forms.findIndex((form) => form.formId === linkedForm.formId);
19919
- const activeFormIndex = getLinkedFormIndex(activeForm) + 1;
19920
- const totalForms = forms == null ? void 0 : forms.length;
19921
- const onClick = (form, activeForm2) => () => {
19922
- if (form.formId !== activeForm2.formId) {
19923
- const linkedFormIndex = getLinkedFormIndex(form);
19924
- gotoForm(linkedFormIndex);
19925
- }
20063
+ const getFormIndex = (form) => forms.findIndex((f2) => f2.formId === form.formId);
20064
+ const goToForm = (form) => () => {
20065
+ if (form.formId === activeForm.formId)
20066
+ return;
20067
+ gotoForm(getFormIndex(form));
20068
+ trackNavigation2({
20069
+ fromForm: form,
20070
+ toForm: activeForm,
20071
+ component: "FormNavigation"
20072
+ });
19926
20073
  };
19927
- const canActAsNavigation = (form, activeForm2) => {
19928
- if (!validateForm) {
19929
- return onClick(form, activeForm2);
19930
- }
19931
- const linkedFormIndex = getLinkedFormIndex(form);
19932
- const formsSubset = [...forms];
19933
- formsSubset.length = linkedFormIndex;
19934
- const allValid = formsSubset.every((subForm) => subForm.isValid);
19935
- if (allValid) {
19936
- return onClick(form, activeForm2);
19937
- }
19938
- return activeForm2.isValid ? null : validateForm;
20074
+ const getNavigateHandler = (form, activeForm2) => {
20075
+ const priorForms = forms.slice(0, getFormIndex(form));
20076
+ const allPriorFormsValid = priorForms.every((subForm) => subForm.isValid);
20077
+ if (allPriorFormsValid || !validateForm) {
20078
+ return goToForm(form);
20079
+ }
20080
+ return activeForm2.isValid ? void 0 : validateForm;
19939
20081
  };
19940
- const taskNameTranslated = i18n.get(taskName);
19941
20082
  return o("div", {
19942
20083
  className: cx("adyen-kyc-form-navigation", className),
19943
20084
  children: [o("div", {
@@ -19951,27 +20092,22 @@ function FormNavigation({
19951
20092
  className: "adyen-kyc-form-navigation__step-count",
19952
20093
  children: i18n.get("stepsX/YofForm", {
19953
20094
  values: {
19954
- activeFormIndex,
19955
- totalForms,
19956
- taskNameTranslated
20095
+ activeFormIndex: getFormIndex(activeForm) + 1,
20096
+ totalForms: forms.length,
20097
+ taskNameTranslated: i18n.get(taskName)
19957
20098
  }
19958
20099
  })
19959
20100
  })
19960
- }), forms == null ? void 0 : forms.map((form) => o(FormNavigationItem, {
20101
+ }), forms.map((form) => o(FormNavigationItem, {
19961
20102
  form,
19962
20103
  isActive: form.formId === activeForm.formId,
19963
- onClick: canActAsNavigation(form, activeForm),
19964
- trackNavigation: () => trackNavigation({
19965
- fromForm: form,
19966
- toForm: activeForm,
19967
- component: "FormNavigation"
19968
- }),
20104
+ onClick: getNavigateHandler(form, activeForm),
19969
20105
  hasVerificationErrors
19970
20106
  }, form.formId))]
19971
20107
  })]
19972
20108
  });
19973
20109
  }
19974
- const getFirstStep = (forms, remediationActions) => {
20110
+ const getOpeningStep$1 = (forms, remediationActions) => {
19975
20111
  var _a;
19976
20112
  if (remediationActions && Object.keys(remediationActions).length > 0) {
19977
20113
  const allRemediationActions = Object.values(remediationActions).flat().filter((rem) => {
@@ -19992,7 +20128,7 @@ const getFirstStep = (forms, remediationActions) => {
19992
20128
  };
19993
20129
  function withFormComposer(WrappedComponent, {
19994
20130
  getComponentForms,
19995
- parseConfiguration,
20131
+ parseConfiguration: parseConfiguration2,
19996
20132
  rules: rules2,
19997
20133
  labels: labels2,
19998
20134
  defaultTaskName,
@@ -20040,7 +20176,6 @@ function withFormComposer(WrappedComponent, {
20040
20176
  } = useGlobalDataSlice("payoutVerificationMethod");
20041
20177
  const configCountry = (getConfigFor === "bankCountry" ? payoutMethodData == null ? void 0 : payoutMethodData.bankCountry : contextCountry) ?? contextCountry;
20042
20178
  p(() => {
20043
- loadFlags(loadingContext);
20044
20179
  loadDocumentGuidance(loadingContext);
20045
20180
  }, [loadingContext]);
20046
20181
  const getConfigurationData = T$1(() => getConfiguration({
@@ -20063,15 +20198,12 @@ function withFormComposer(WrappedComponent, {
20063
20198
  } = useScenarioConfiguration({
20064
20199
  getConfigurationData,
20065
20200
  getPayoutAccountFormatData,
20066
- parseConfiguration,
20201
+ parseConfiguration: parseConfiguration2,
20067
20202
  country: configCountry,
20068
20203
  instantVerificationEnabled: derivedProps.instantVerificationEnabled && derivedProps.handleGetBankVerificationVendors,
20069
20204
  setLoadingStatus
20070
20205
  });
20071
20206
  const isFormStepVisible = (formId) => {
20072
- if (formId === "idVerificationMethod" && !props.handleGetIdVerificationToken) {
20073
- return false;
20074
- }
20075
20207
  if (derivedProps.requiredFields || derivedProps.optionalFields) {
20076
20208
  return !!derivedProps.requiredFields[formId] || !!derivedProps.optionalFields[formId];
20077
20209
  }
@@ -20084,7 +20216,7 @@ function withFormComposer(WrappedComponent, {
20084
20216
  }, isSettingEnabled), [bankVerificationVendors, isSettingEnabled, props]);
20085
20217
  const componentFormsWithSummary = [...Object.values(componentForms), summaryStep];
20086
20218
  const allowedForms = componentFormsWithSummary.filter((form) => isFormStepVisible(form.formId) || isFormSummaryStep(form));
20087
- const [activeForm, setActiveForm] = h(getFirstStep(allowedForms, (_a = props == null ? void 0 : props.problems) == null ? void 0 : _a.remediationActions));
20219
+ const [activeForm, setActiveForm] = h(getOpeningStep$1(allowedForms, (_a = props == null ? void 0 : props.problems) == null ? void 0 : _a.remediationActions));
20088
20220
  const [hasAlreadyNavigatedForm, setHasAlreadyNavigatedForm] = h(false);
20089
20221
  const getFormIndex = (formId) => allowedForms.findIndex((form) => form.formId === formId);
20090
20222
  const isFinalStep = getFormIndex(activeForm.formId) === allowedForms.length - 1;
@@ -20093,9 +20225,9 @@ function withFormComposer(WrappedComponent, {
20093
20225
  var _a2;
20094
20226
  if (hasAlreadyNavigatedForm)
20095
20227
  return;
20096
- const firstStep = getFirstStep(allowedForms, (_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions);
20097
- if (activeForm !== firstStep) {
20098
- setActiveForm(firstStep);
20228
+ const openingStep = getOpeningStep$1(allowedForms, (_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions);
20229
+ if (activeForm !== openingStep) {
20230
+ setActiveForm(openingStep);
20099
20231
  }
20100
20232
  }, [activeForm, allowedForms, (_b = props == null ? void 0 : props.problems) == null ? void 0 : _b.remediationActions, hasAlreadyNavigatedForm]);
20101
20233
  const evaluateConfiguration = T$1((scenarioConfiguration, country2, formData, isSettingEnabled2, requiredFields2) => {
@@ -20108,7 +20240,7 @@ function withFormComposer(WrappedComponent, {
20108
20240
  requiredFields: requiredFields2
20109
20241
  }) : {};
20110
20242
  const fieldsFormCustomLabels = labels2 ? labels2(formData, country2) : {};
20111
- const scenarioProps = getPropsFromConfigurations(scenarioConfiguration, componentForms, ((_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions) ? Object.values((_b2 = props == null ? void 0 : props.problems) == null ? void 0 : _b2.remediationActions) : [], ((_c2 = props.problems) == null ? void 0 : _c2.missingData) ?? [], fieldsFromCustomRules, fieldsFormCustomLabels);
20243
+ const scenarioProps = getPropsFromConfigurations(scenarioConfiguration, componentForms, ((_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.remediationActions) ? Object.values((_b2 = props == null ? void 0 : props.problems) == null ? void 0 : _b2.remediationActions) : [], ((_c2 = props.problems) == null ? void 0 : _c2.missingData) ?? [], props.legalEntityResponse ? getFieldsWithExistingData(props.legalEntityResponse) : [], fieldsFromCustomRules, fieldsFormCustomLabels);
20112
20244
  setShouldValidate(false);
20113
20245
  setDerivedProps({
20114
20246
  ...props,
@@ -20121,7 +20253,7 @@ function withFormComposer(WrappedComponent, {
20121
20253
  return;
20122
20254
  evaluateConfiguration(fieldConfigurations, configCountry, getData(), isSettingEnabled, requiredFields);
20123
20255
  }, [fieldConfigurations, configCountry, evaluateConfiguration, getData, isSettingEnabled, requiredFields]);
20124
- const trackNavigation = ({
20256
+ const trackNavigation2 = ({
20125
20257
  fromForm,
20126
20258
  toForm,
20127
20259
  component
@@ -20199,7 +20331,7 @@ function withFormComposer(WrappedComponent, {
20199
20331
  const toFormIndex = allowedForms.findIndex((form) => form.formId === activeForm.formId) + 1;
20200
20332
  gotoFormByFormIndex(toFormIndex);
20201
20333
  const toForm = allowedForms[toFormIndex];
20202
- trackNavigation({
20334
+ trackNavigation2({
20203
20335
  fromForm: activeForm,
20204
20336
  toForm,
20205
20337
  component: "ActionBar"
@@ -20216,7 +20348,7 @@ function withFormComposer(WrappedComponent, {
20216
20348
  const toForm = allowedForms[currentFormIndex - 1];
20217
20349
  setActiveForm(toForm);
20218
20350
  setHasAlreadyNavigatedForm(true);
20219
- trackNavigation({
20351
+ trackNavigation2({
20220
20352
  fromForm,
20221
20353
  toForm,
20222
20354
  component: "ActionBar"
@@ -20259,8 +20391,8 @@ function withFormComposer(WrappedComponent, {
20259
20391
  const handleLeaveDropin = async () => {
20260
20392
  var _a2;
20261
20393
  const data = getData();
20262
- const hasDataChanged = getState().hasAnyDataChanged;
20263
- if (hasDataChanged && ((_a2 = props.canSubmit) == null ? void 0 : _a2.call(props, data))) {
20394
+ const hasDataChanged2 = getState().hasAnyDataChanged;
20395
+ if (hasDataChanged2 && ((_a2 = props.canSubmit) == null ? void 0 : _a2.call(props, data))) {
20264
20396
  setInitialContextCountry(contextCountry);
20265
20397
  const allFields = (derivedProps == null ? void 0 : derivedProps.allFields) || {};
20266
20398
  await props.onSubmit({
@@ -20323,7 +20455,7 @@ function withFormComposer(WrappedComponent, {
20323
20455
  }), activeForm.formId === summaryStep.formId && o("div", {
20324
20456
  className: "adyen-kyc-form-wrapper",
20325
20457
  children: o(Summary, {
20326
- trackNavigation,
20458
+ trackNavigation: trackNavigation2,
20327
20459
  data: formatDataForSummary ? formatDataForSummary(getData(), allowedForms) : getData(),
20328
20460
  omittedKeys: getSummaryOmittedKeys ? getSummaryOmittedKeys(getData()) : null,
20329
20461
  omittedForms,
@@ -20336,29 +20468,19 @@ function withFormComposer(WrappedComponent, {
20336
20468
  })
20337
20469
  })
20338
20470
  });
20471
+ const allowedFormsWithValidity = addValidityToForms(allowedForms, formValidity, props.problems);
20339
20472
  const sidebar = !hideDropinLayout && !hideNavigation && o(LoaderWrapper, {
20340
20473
  status: loadingStatus,
20341
20474
  formOpacityWhenLoading: 0.3,
20342
20475
  showSpinner: false,
20343
20476
  className: "adyen-kyc-dropin__sidebar-wrapper",
20344
20477
  children: o(FormNavigation, {
20345
- forms: allowedForms.map(({
20346
- formId,
20347
- formName
20348
- }) => {
20349
- var _a2, _b2;
20350
- return {
20351
- formId,
20352
- formName,
20353
- isValid: (formValidity == null ? void 0 : formValidity[formId]) ?? false,
20354
- hasServerValidationErrors: ((_b2 = (_a2 = props == null ? void 0 : props.problems) == null ? void 0 : _a2.validationErrors) == null ? void 0 : _b2[formId]) !== void 0
20355
- };
20356
- }),
20357
- activeForm,
20478
+ forms: allowedFormsWithValidity,
20479
+ activeForm: allowedFormsWithValidity.find((form) => form.formId === activeForm.formId),
20358
20480
  gotoForm: gotoFormByFormIndex,
20359
20481
  validateForm: validateCurrentForm,
20360
20482
  taskName,
20361
- trackNavigation,
20483
+ trackNavigation: trackNavigation2,
20362
20484
  hasVerificationErrors: ((_c = props == null ? void 0 : props.problems) == null ? void 0 : _c.verificationErrors) && ((_e = Object.keys((_d = props == null ? void 0 : props.problems) == null ? void 0 : _d.verificationErrors)) == null ? void 0 : _e.length) > 0
20363
20485
  })
20364
20486
  });
@@ -20651,6 +20773,7 @@ function CompanyDropinComponent(props) {
20651
20773
  handleBackClick: props.handleBackClick,
20652
20774
  onSubmit,
20653
20775
  legalEntityType: LegalEntityType.ORGANIZATION,
20776
+ legalEntityResponse,
20654
20777
  summary: {
20655
20778
  formatData: formatDataForSummary,
20656
20779
  getOmittedKeys
@@ -20727,16 +20850,16 @@ const getPayoutAccountHolderName = (legalEntity, i18n) => {
20727
20850
  };
20728
20851
  const DecisionMakers = "";
20729
20852
  const iconStatus = (current, min, max) => {
20730
- if (current === 0) {
20731
- return min >= 1 ? "obligatoryEmpty" : "conditionalEmpty";
20853
+ const isEmpty2 = current === 0;
20854
+ const isWithinObligatoryRange = current === max || min > 0 && current >= min;
20855
+ const isWithinConditionalRange = current >= min;
20856
+ if (isEmpty2) {
20857
+ return min > 0 ? "obligatoryEmpty" : "conditionalEmpty";
20732
20858
  }
20733
- if (current >= max) {
20859
+ if (isWithinObligatoryRange) {
20734
20860
  return "obligatoryFinished";
20735
20861
  }
20736
- if (current >= min) {
20737
- return "conditionalFinished";
20738
- }
20739
- return "conditionalEmpty";
20862
+ return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
20740
20863
  };
20741
20864
  const entityStatusRoles = {
20742
20865
  ...decisionMakerRoles,
@@ -20842,6 +20965,11 @@ const TaskItemStatus = ({
20842
20965
  className: "adl-task-status-sign",
20843
20966
  children: i18n.get("sign")
20844
20967
  });
20968
+ case TaskStatus.SUBMIT:
20969
+ return o("span", {
20970
+ className: "adl-task-status-submit",
20971
+ children: i18n.get("submit")
20972
+ });
20845
20973
  case TaskStatus.DETAILS_REQUIRED:
20846
20974
  case TaskStatus.EMPTY:
20847
20975
  default:
@@ -21518,7 +21646,8 @@ function ReviewComponent({
21518
21646
  onHome: handleHomeClick,
21519
21647
  homeButtonLabel: i18n.get("goToOverview"),
21520
21648
  onNext: onConfirmClick,
21521
- nextButtonLabel: i18n.get("submitReview")
21649
+ nextButtonLabel: i18n.get("submitReview"),
21650
+ nextButtonDisabled: !hasConfirmed
21522
21651
  });
21523
21652
  return o(DropinLayout, {
21524
21653
  content,
@@ -21542,13 +21671,15 @@ const TaskListItem = ({
21542
21671
  downloadHandler,
21543
21672
  actions,
21544
21673
  info,
21545
- loading: loading2 = false
21674
+ loading: loading2 = false,
21675
+ showErrorAlerts = "onErrorStatus"
21546
21676
  }) => {
21547
21677
  const [showingActions, setShowingActions] = h(false);
21548
21678
  const toggleShowActions = (event) => {
21549
21679
  event.stopPropagation();
21550
21680
  setShowingActions(!showingActions);
21551
21681
  };
21682
+ const shouldShowErrorAlert = showErrorAlerts === "always" || showErrorAlerts === "onErrorStatus" && status === TaskStatus.ERROR;
21552
21683
  return o(Card, {
21553
21684
  stateful: onNavigateToTask && !loading2 && !disabled,
21554
21685
  onClick: loading2 ? void 0 : onNavigateToTask,
@@ -21611,7 +21742,7 @@ const TaskListItem = ({
21611
21742
  name: "chevron-right"
21612
21743
  })]
21613
21744
  })]
21614
- }), status === TaskStatus.ERROR && o(VerificationErrorAlert, {
21745
+ }), shouldShowErrorAlert && o(VerificationErrorAlert, {
21615
21746
  className: "adyen-task-item-alert",
21616
21747
  problems
21617
21748
  })]
@@ -21694,7 +21825,7 @@ function TaskListComponent({
21694
21825
  serviceAgreementAcceptanceInfos,
21695
21826
  onTransferInstrumentDelete
21696
21827
  }) {
21697
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
21828
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
21698
21829
  const {
21699
21830
  i18n,
21700
21831
  accountHolder: accountHolder2
@@ -21827,7 +21958,9 @@ function TaskListComponent({
21827
21958
  onNavigateToTask: handleOnNavigateToTaskReview,
21828
21959
  icon: "ari",
21829
21960
  title: i18n.get("submitReviewOfYourData"),
21830
- status: TaskStatus.DETAILS_REQUIRED
21961
+ status: TaskStatus.SUBMIT,
21962
+ problems: (_l = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _l[legalEntityResponse.id],
21963
+ showErrorAlerts: "always"
21831
21964
  })
21832
21965
  })]
21833
21966
  })
@@ -22122,47 +22255,459 @@ const TrustMembersComponent = ({
22122
22255
  })
22123
22256
  });
22124
22257
  };
22125
- const IndividualWithComposer = withFormComposer(IndividualComponent, {
22126
- getComponentForms: () => individualForms,
22127
- parseConfiguration: (response) => {
22128
- var _a;
22129
- return parseIndividualScenarios((_a = response == null ? void 0 : response.matchingScenario) == null ? void 0 : _a[LegalEntityType.INDIVIDUAL], response == null ? void 0 : response.country);
22130
- },
22131
- rules: rules$2,
22132
- defaultTaskName: "individualDetails"
22133
- });
22134
- function IndividualDropinComponent(props) {
22135
- var _a, _b, _c, _d, _e, _f;
22136
- const {
22137
- i18n,
22138
- setLocale,
22139
- setAccountHolder
22140
- } = useCoreContext();
22141
- const {
22142
- showToast,
22143
- clearToasts
22144
- } = useToastContext();
22258
+ const trackNavigation = ({
22259
+ fromForm,
22260
+ toForm,
22261
+ component,
22262
+ baseTrackingPayload,
22263
+ i18n
22264
+ }) => {
22265
+ userEvents.addEvent("Navigated form", {
22266
+ segmentation: {
22267
+ ...baseTrackingPayload,
22268
+ component,
22269
+ from: fromForm.formId,
22270
+ fromLabel: i18n.get(fromForm.formName),
22271
+ to: toForm.formId,
22272
+ toLabel: i18n.get(toForm.formName)
22273
+ }
22274
+ });
22275
+ };
22276
+ const getOpeningStep = (forms, remediationActions) => {
22277
+ var _a;
22278
+ if (remediationActions && Object.keys(remediationActions).length > 0) {
22279
+ const allRemediationActions = Object.values(remediationActions).flat().filter((rem) => {
22280
+ var _a2;
22281
+ return ((_a2 = rem.forms) == null ? void 0 : _a2.length) > 0;
22282
+ });
22283
+ if (allRemediationActions.length === 1 && ((_a = allRemediationActions[0]) == null ? void 0 : _a.forms.length) === 1) {
22284
+ const form = forms.find((form2) => {
22285
+ var _a2;
22286
+ return (form2 == null ? void 0 : form2.formId) === ((_a2 = allRemediationActions[0]) == null ? void 0 : _a2.forms[0]);
22287
+ });
22288
+ if (form)
22289
+ return form;
22290
+ }
22291
+ return forms[forms.length - 1];
22292
+ }
22293
+ return forms[0];
22294
+ };
22295
+ const useFormComposer = ({
22296
+ problems,
22297
+ baseTrackingPayload,
22298
+ forms,
22299
+ formRef,
22300
+ submitButtonLabel,
22301
+ onSubmit
22302
+ }) => {
22145
22303
  const {
22146
- handleCreateDocument,
22147
- handleGetDocument,
22148
- handleUpdateDocument,
22149
- handleAddressSearch,
22150
- handleFindAddress,
22151
- handleGetIdVerificationToken,
22152
- handleGetIdVerificationStartCheck,
22304
+ i18n
22305
+ } = useCoreContext();
22306
+ const [shouldValidate, setShouldValidate] = h(false);
22307
+ const [activeForm, setActiveForm] = h(forms[0]);
22308
+ const isFormSummaryStep = (form) => form.formId === summaryStep.formId;
22309
+ const [hasAlreadyNavigatedForm, setHasAlreadyNavigatedForm] = h(false);
22310
+ const getFormIndex = (formId) => forms.findIndex((form) => form.formId === formId);
22311
+ const isFinalStep = getFormIndex(activeForm.formId) === forms.length - 1;
22312
+ p(() => {
22313
+ setActiveForm((activeForm2) => forms.find(({
22314
+ formId
22315
+ }) => formId === activeForm2.formId) ?? activeForm2);
22316
+ }, [forms]);
22317
+ p(() => {
22318
+ if (hasAlreadyNavigatedForm)
22319
+ return;
22320
+ const openingStep = getOpeningStep(forms, problems == null ? void 0 : problems.remediationActions);
22321
+ if (activeForm !== openingStep) {
22322
+ setActiveForm(openingStep);
22323
+ }
22324
+ }, [activeForm, forms, problems == null ? void 0 : problems.remediationActions, hasAlreadyNavigatedForm]);
22325
+ const trackSectionCompletion = (form) => {
22326
+ userEvents.addEvent("Completed form section", {
22327
+ segmentation: {
22328
+ ...baseTrackingPayload,
22329
+ sectionName: form.formId
22330
+ }
22331
+ });
22332
+ };
22333
+ const gotoFormByFormIndex = (nextFormIndex) => {
22334
+ if (formRef == null ? void 0 : formRef.current.verifyForm) {
22335
+ formRef.current.verifyForm(activeForm.formId).then((isVerified) => {
22336
+ if (isVerified) {
22337
+ setHasAlreadyNavigatedForm(true);
22338
+ setActiveForm(forms[nextFormIndex]);
22339
+ }
22340
+ });
22341
+ } else {
22342
+ setHasAlreadyNavigatedForm(true);
22343
+ setActiveForm(forms[nextFormIndex]);
22344
+ }
22345
+ };
22346
+ const validateCurrentForm = () => {
22347
+ setShouldValidate(true);
22348
+ };
22349
+ const handleNextClick = () => {
22350
+ var _a;
22351
+ if ((_a = formRef == null ? void 0 : formRef.current) == null ? void 0 : _a.customNavigationHandler) {
22352
+ formRef.current.customNavigationHandler();
22353
+ return;
22354
+ }
22355
+ if (isFormSummaryStep(activeForm)) {
22356
+ onSubmit();
22357
+ return;
22358
+ }
22359
+ if (!activeForm.isValid) {
22360
+ validateCurrentForm();
22361
+ return;
22362
+ }
22363
+ if (isFinalStep) {
22364
+ onSubmit();
22365
+ return;
22366
+ }
22367
+ setShouldValidate(false);
22368
+ const toFormIndex = forms.findIndex((form) => form.formId === activeForm.formId) + 1;
22369
+ gotoFormByFormIndex(toFormIndex);
22370
+ const toForm = forms[toFormIndex];
22371
+ trackNavigation({
22372
+ fromForm: activeForm,
22373
+ toForm,
22374
+ component: "ActionBar",
22375
+ baseTrackingPayload,
22376
+ i18n
22377
+ });
22378
+ trackSectionCompletion(activeForm);
22379
+ };
22380
+ const handleBackClick = () => {
22381
+ const currentFormIndex = forms.findIndex((form) => form.formId === activeForm.formId);
22382
+ if (currentFormIndex) {
22383
+ const fromForm = forms[currentFormIndex];
22384
+ const toForm = forms[currentFormIndex - 1];
22385
+ setActiveForm(toForm);
22386
+ setHasAlreadyNavigatedForm(true);
22387
+ trackNavigation({
22388
+ fromForm,
22389
+ toForm,
22390
+ component: "ActionBar",
22391
+ baseTrackingPayload,
22392
+ i18n
22393
+ });
22394
+ }
22395
+ };
22396
+ const nextButtonLabel = isFinalStep ? i18n.get(submitButtonLabel ?? "submit") : i18n.get("next");
22397
+ return {
22153
22398
  handleBackClick,
22154
- taskType,
22155
- trackingConfig,
22156
- parentLegalEntity,
22157
- legalEntityResponse
22158
- } = props;
22159
- let dataFromResponse = mapLegalEntityToIndividual(legalEntityResponse, props.isTargetLegalEntityType);
22399
+ handleNextClick,
22400
+ nextButtonLabel,
22401
+ gotoFormByFormIndex,
22402
+ activeForm,
22403
+ shouldValidate,
22404
+ setShouldValidate
22405
+ };
22406
+ };
22407
+ const _toast = "";
22408
+ function Toast({
22409
+ label,
22410
+ subLabel,
22411
+ actionLabel,
22412
+ type,
22413
+ duration = 3500,
22414
+ onToastHide,
22415
+ onToastAction
22416
+ }) {
22417
+ const toastRef = _$1(null);
22418
+ const loading2 = type === ToastType.LOADING;
22419
+ const successToast = type === ToastType.SUCCESS;
22420
+ const labelId = getUniqueId("toast");
22421
+ const handleShow = T$1(() => {
22422
+ var _a;
22423
+ return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
22424
+ }, []);
22425
+ const handleHide = T$1(() => {
22426
+ var _a;
22427
+ (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
22428
+ onToastHide();
22429
+ }, [onToastHide]);
22430
+ p(() => {
22431
+ handleShow();
22432
+ if (duration !== "indefinite") {
22433
+ setTimeout(() => handleHide(), duration);
22434
+ }
22435
+ }, [label, duration, handleHide, handleShow]);
22436
+ return o("div", {
22437
+ ref: toastRef,
22438
+ role: actionLabel ? "alertdialog" : "alert",
22439
+ className: "adl-toast",
22440
+ "aria-labelledby": labelId,
22441
+ children: [loading2 && o("div", {
22442
+ className: "adl-toast__loader",
22443
+ children: o("div", {
22444
+ className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
22445
+ })
22446
+ }), !loading2 && o("div", {
22447
+ className: cx("adl-toast__status", {
22448
+ "adl-toast__status--success": successToast,
22449
+ "adl-toast__status--error": !successToast
22450
+ }),
22451
+ children: [successToast && o(Icon, {
22452
+ className: "adl-toast__status-icon",
22453
+ name: "checkmark"
22454
+ }), !successToast && o(Icon, {
22455
+ className: "adl-toast__status-icon",
22456
+ name: "cross"
22457
+ })]
22458
+ }), o("div", {
22459
+ className: "adl-toast__message",
22460
+ children: [o("span", {
22461
+ id: labelId,
22462
+ className: "adl-toast__title",
22463
+ children: label
22464
+ }), actionLabel && o("button", {
22465
+ className: "adl-link adl-toast__action",
22466
+ title: "performAction",
22467
+ type: "button",
22468
+ onClick: onToastAction,
22469
+ children: actionLabel
22470
+ }), !loading2 && subLabel && o("span", {
22471
+ className: "adl-toast__subtitle",
22472
+ children: subLabel
22473
+ })]
22474
+ }), !loading2 && o("button", {
22475
+ className: "adl-toast__close",
22476
+ title: "close",
22477
+ type: "button",
22478
+ onClick: handleHide,
22479
+ children: o(Icon, {
22480
+ name: "cross"
22481
+ })
22482
+ })]
22483
+ });
22484
+ }
22485
+ const FormWrapper = ({
22486
+ summary: summary2,
22487
+ taskName,
22488
+ children,
22489
+ handleNextClick,
22490
+ handleBackClick,
22491
+ handleHomeClick,
22492
+ nextButtonLabel,
22493
+ homeButtonLabel,
22494
+ loadingStatus,
22495
+ gotoFormByFormIndex,
22496
+ forms,
22497
+ activeForm,
22498
+ handleGetIdVerificationToken,
22499
+ validateForm,
22500
+ baseTrackingPayload,
22501
+ hideDropinLayout,
22502
+ hideFooter,
22503
+ hideHomeButton,
22504
+ hideBackButton,
22505
+ hideNavigation,
22506
+ canSubmit,
22507
+ onSubmit,
22508
+ problems
22509
+ }) => {
22510
+ const {
22511
+ i18n
22512
+ } = useCoreContext();
22513
+ const {
22514
+ data: summaryData,
22515
+ omittedForms,
22516
+ omittedKeys,
22517
+ labels: labels2
22518
+ } = summary2 || {};
22519
+ const onHomeClick = () => {
22520
+ if (canSubmit) {
22521
+ onSubmit();
22522
+ } else {
22523
+ handleHomeClick();
22524
+ }
22525
+ };
22526
+ const summaryContent = o("div", {
22527
+ className: "adyen-kyc-form-wrapper",
22528
+ children: o(Summary, {
22529
+ trackNavigation: (payload) => trackNavigation({
22530
+ ...payload,
22531
+ i18n,
22532
+ baseTrackingPayload
22533
+ }),
22534
+ data: summaryData,
22535
+ omittedKeys,
22536
+ omittedForms,
22537
+ forms,
22538
+ gotoForm: gotoFormByFormIndex,
22539
+ labels: labels2,
22540
+ problems
22541
+ })
22542
+ });
22543
+ const formFooter = !hideDropinLayout && !hideFooter && o(ActionBar, {
22544
+ onNext: handleNextClick,
22545
+ onBack: handleBackClick,
22546
+ onHome: onHomeClick,
22547
+ backButtonLabel: i18n.get("back"),
22548
+ nextButtonLabel,
22549
+ homeButtonLabel,
22550
+ hideOnHomeButton: hideHomeButton,
22551
+ hideBackButton
22552
+ });
22553
+ const multiStepForm = o("div", {
22554
+ className: "adyen-kyc-form-container",
22555
+ children: o(LoaderWrapper, {
22556
+ status: loadingStatus,
22557
+ formOpacityWhenLoading: 0.3,
22558
+ loaderSize: "large",
22559
+ children: o(FormRouterContextProvider, {
22560
+ setFormIndex: gotoFormByFormIndex,
22561
+ forms,
22562
+ handleGetIdVerificationToken,
22563
+ children: [children, activeForm.formId === summaryStep.formId && summaryContent, formFooter]
22564
+ })
22565
+ })
22566
+ });
22567
+ const sidebar = !hideDropinLayout && !hideNavigation && o(LoaderWrapper, {
22568
+ status: loadingStatus,
22569
+ formOpacityWhenLoading: 0.3,
22570
+ showSpinner: false,
22571
+ className: "adyen-kyc-dropin__sidebar-wrapper",
22572
+ children: o(FormNavigation, {
22573
+ forms,
22574
+ activeForm,
22575
+ gotoForm: gotoFormByFormIndex,
22576
+ validateForm,
22577
+ taskName,
22578
+ trackNavigation: ({
22579
+ fromForm,
22580
+ toForm,
22581
+ component
22582
+ }) => trackNavigation({
22583
+ fromForm,
22584
+ toForm,
22585
+ component,
22586
+ baseTrackingPayload,
22587
+ i18n
22588
+ }),
22589
+ hasVerificationErrors: Object.keys((problems == null ? void 0 : problems.verificationErrors) ?? {}).length > 0
22590
+ })
22591
+ });
22592
+ if (hideDropinLayout) {
22593
+ return multiStepForm;
22594
+ }
22595
+ return o(DropinLayout, {
22596
+ content: o(Fragment, {
22597
+ children: [sidebar, multiStepForm]
22598
+ })
22599
+ });
22600
+ };
22601
+ const parseConfiguration = (response) => {
22602
+ var _a;
22603
+ return parseIndividualScenarios((_a = response == null ? void 0 : response.matchingScenario) == null ? void 0 : _a[LegalEntityType.INDIVIDUAL], response == null ? void 0 : response.country);
22604
+ };
22605
+ function IndividualDropinComponent({
22606
+ handleCreateDocument,
22607
+ handleGetDocument,
22608
+ handleUpdateDocument,
22609
+ handleAddressSearch,
22610
+ handleFindAddress,
22611
+ handleGetIdVerificationToken,
22612
+ handleGetIdVerificationStartCheck,
22613
+ taskType,
22614
+ trackingConfig,
22615
+ parentLegalEntity,
22616
+ legalEntityResponse,
22617
+ taskName,
22618
+ eventEmitter,
22619
+ handleHomeClick,
22620
+ homeButtonLabel,
22621
+ isTargetLegalEntityType,
22622
+ country: parentCountry,
22623
+ handleCreateLegalEntity,
22624
+ capabilities,
22625
+ onChange,
22626
+ problems: propProblems,
22627
+ handleUpdateLegalEntity,
22628
+ associationDetail,
22629
+ onSubmit: externalOnSubmit,
22630
+ onTypeSwitch
22631
+ }) {
22632
+ var _a, _b, _c, _d;
22633
+ const {
22634
+ i18n,
22635
+ setLocale,
22636
+ setAccountHolder
22637
+ } = useCoreContext();
22638
+ const {
22639
+ showToast,
22640
+ clearToasts
22641
+ } = useToastContext();
22642
+ const {
22643
+ getConfiguration: getConfiguration2
22644
+ } = useKycExternalApi();
22645
+ let dataFromResponse = mapLegalEntityToIndividual(legalEntityResponse, isTargetLegalEntityType);
22160
22646
  const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
22161
- const [newDecisionMaker, setNewDecisionMaker] = h(null);
22162
22647
  let roleTypes = [];
22163
- const [problems, setProblems] = h(props == null ? void 0 : props.problems);
22648
+ const [newDecisionMaker, setNewDecisionMaker] = h(null);
22649
+ const [problems, setProblems] = h(propProblems);
22650
+ const formRef = _$1(null);
22651
+ const [loadingStatus, setLoadingStatus] = h("success");
22652
+ const [data, setData] = h(dataFromResponse);
22653
+ const [documents2, setDocuments] = h();
22654
+ const [country2, setCountry] = h(((_a = data == null ? void 0 : data.personalDetails) == null ? void 0 : _a.residencyCountry) ?? parentCountry);
22655
+ const [hideFooter, setHideFooter] = h(false);
22656
+ const baseTrackingPayload = getBaseTrackingPayload({
22657
+ trackingConfig,
22658
+ parentLegalEntity,
22659
+ legalEntity: legalEntityResponse,
22660
+ task: taskType
22661
+ });
22662
+ p(() => {
22663
+ userEvents.addPageView("Individual dropin");
22664
+ userEvents.addEvent("Started individual task", {
22665
+ segmentation: {
22666
+ ...baseTrackingPayload
22667
+ }
22668
+ });
22669
+ }, []);
22670
+ const getConfigurationData = T$1(() => getConfiguration2({
22671
+ legalEntityType: LegalEntityType.INDIVIDUAL,
22672
+ capabilities,
22673
+ country: country2
22674
+ }), [country2, capabilities]);
22675
+ const {
22676
+ fieldConfigurations
22677
+ } = useScenarioConfiguration({
22678
+ parseConfiguration,
22679
+ getConfigurationData,
22680
+ setLoadingStatus,
22681
+ country: country2
22682
+ });
22683
+ const fieldsFromCustomRules = F$1(() => rules$2({
22684
+ data,
22685
+ country: country2,
22686
+ taskType
22687
+ }), [country2, data, taskType]);
22688
+ const derivedProps = F$1(() => getPropsFromConfigurations(fieldConfigurations, individualForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse) : [], fieldsFromCustomRules), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
22689
+ const {
22690
+ state: {
22691
+ currentState
22692
+ }
22693
+ } = useStateContext();
22694
+ const formValidity = currentState.validityByForm;
22695
+ p(() => {
22696
+ setData({
22697
+ ...currentState.data,
22698
+ ...documents2
22699
+ });
22700
+ onChange == null ? void 0 : onChange(currentState);
22701
+ }, [currentState, documents2, onChange]);
22702
+ const forms = F$1(() => {
22703
+ const requiredForms = getRequiredForms(individualForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields).filter(
22704
+ // TODO: this is a workaround to prevent showing the verification method step when onfido is not enabled
22705
+ (form) => form.formId !== "idVerificationMethod" || Boolean(handleGetIdVerificationToken)
22706
+ );
22707
+ return addValidityToForms(requiredForms, formValidity, problems);
22708
+ }, [derivedProps, formValidity, problems, handleGetIdVerificationToken]);
22164
22709
  if (taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
22165
- if ((_a = props == null ? void 0 : props.parentLegalEntity) == null ? void 0 : _a.entityAssociations) {
22710
+ if (parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) {
22166
22711
  const associations = (_b = parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) == null ? void 0 : _b.filter((ea) => ea.legalEntityId === (legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22167
22712
  if (associations && associations.length > 0) {
22168
22713
  const jobTitle2 = (_c = associations.find((association) => Boolean(association.jobTitle))) == null ? void 0 : _c.jobTitle;
@@ -22180,32 +22725,13 @@ function IndividualDropinComponent(props) {
22180
22725
  }
22181
22726
  roleTypes = getAllowedDecisionMakerRoles(parentLegalEntity, taskType);
22182
22727
  }
22183
- const [data, setData] = h(dataFromResponse || props.data);
22184
- const baseTrackingPayload = getBaseTrackingPayload({
22185
- trackingConfig,
22186
- parentLegalEntity,
22187
- legalEntity: legalEntityResponse,
22188
- task: taskType
22189
- });
22190
- p(() => {
22191
- userEvents.addPageView("Individual dropin");
22192
- userEvents.addEvent("Started individual task", {
22193
- segmentation: {
22194
- ...baseTrackingPayload
22195
- }
22196
- });
22197
- }, []);
22198
22728
  p(() => {
22199
22729
  var _a2;
22200
- props.eventEmitter.on("updateLocale", (locale) => setLocale(locale));
22730
+ eventEmitter.on("updateLocale", (locale) => setLocale(locale));
22201
22731
  const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
22202
22732
  if (documentIds.length) {
22203
22733
  documentUtils.fetchDocuments(documentIds, legalEntityResponse == null ? void 0 : legalEntityResponse.id).then(() => {
22204
- const mappedDocuments = mapApiDocumentToIndividualDocuments(legalEntityResponse == null ? void 0 : legalEntityResponse.id);
22205
- setData({
22206
- ...data,
22207
- ...mappedDocuments
22208
- });
22734
+ setDocuments(mapApiDocumentToIndividualDocuments(legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22209
22735
  }).catch(() => {
22210
22736
  showToast({
22211
22737
  label: i18n.get("failedToFetchRelevantDocuments"),
@@ -22221,7 +22747,7 @@ function IndividualDropinComponent(props) {
22221
22747
  }) => {
22222
22748
  let updatedLegalEntity;
22223
22749
  if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id) && !(newDecisionMaker == null ? void 0 : newDecisionMaker.id)) {
22224
- updatedLegalEntity = await props.handleCreateLegalEntity(legalEntity);
22750
+ updatedLegalEntity = await handleCreateLegalEntity(legalEntity);
22225
22751
  setNewDecisionMaker(legalEntity);
22226
22752
  userEvents.addEvent("Added decision maker", {
22227
22753
  segmentation: {
@@ -22233,7 +22759,7 @@ function IndividualDropinComponent(props) {
22233
22759
  }
22234
22760
  });
22235
22761
  } else {
22236
- updatedLegalEntity = await props.handleUpdateLegalEntity(drop("type").from(legalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newDecisionMaker == null ? void 0 : newDecisionMaker.id));
22762
+ updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(legalEntity), (legalEntityResponse == null ? void 0 : legalEntityResponse.id) || (newDecisionMaker == null ? void 0 : newDecisionMaker.id));
22237
22763
  }
22238
22764
  userEvents.addEvent("Saved individual details", {
22239
22765
  segmentation: {
@@ -22254,11 +22780,11 @@ function IndividualDropinComponent(props) {
22254
22780
  await handleGetIdVerificationStartCheck("", data2);
22255
22781
  };
22256
22782
  const submitDocuments = async ({
22257
- forms,
22783
+ forms: forms2,
22258
22784
  legalEntity,
22259
22785
  dataSubmitted
22260
22786
  }) => {
22261
- if (isDocumentsRequired(forms)) {
22787
+ if (isDocumentsRequired(forms2)) {
22262
22788
  if (hasInstantIdVerification(dataSubmitted)) {
22263
22789
  await handleInstantIdVerificationStartCheck(dataSubmitted.idDocument.instantIdVerificationData, legalEntity.id);
22264
22790
  } else {
@@ -22298,8 +22824,8 @@ function IndividualDropinComponent(props) {
22298
22824
  legalEntity,
22299
22825
  dataSubmitted
22300
22826
  }) => {
22301
- var _a2, _b2;
22302
- const newRoles = taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? (_a2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _a2.role : taskType === TaskTypes.TRUST_MEMBER_INDIVIDUAL ? (_b2 = props.associationDetail) == null ? void 0 : _b2.types : null;
22827
+ var _a2;
22828
+ const newRoles = taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? (_a2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _a2.role : taskType === TaskTypes.TRUST_MEMBER_INDIVIDUAL ? associationDetail == null ? void 0 : associationDetail.types : null;
22303
22829
  const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
22304
22830
  if (newRoles && hasRolesChanged(legalEntity, existingEntityAssociations, newRoles)) {
22305
22831
  const updatedParentLegalEntity = {
@@ -22312,16 +22838,13 @@ function IndividualDropinComponent(props) {
22312
22838
  };
22313
22839
  }) || [], ...existingEntityAssociations.filter((ea) => ea.legalEntityId !== legalEntity.id) || []]
22314
22840
  };
22315
- await props.handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
22841
+ await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
22316
22842
  }
22317
22843
  };
22318
- const onSubmit = async ({
22319
- data: dataSubmitted,
22320
- forms,
22321
- setLoadingStatus
22322
- }) => {
22844
+ const onSubmit = async () => {
22323
22845
  var _a2, _b2;
22324
22846
  setLoadingStatus("loading");
22847
+ const dataSubmitted = data;
22325
22848
  try {
22326
22849
  omitMaskedFieldsIfUnchanged(individualMaskedFields, dataSubmitted, dataFromResponse);
22327
22850
  let legalEntity = mapIndividualToLegalEntity(dataSubmitted);
@@ -22358,7 +22881,7 @@ function IndividualDropinComponent(props) {
22358
22881
  }
22359
22882
  setLoadingStatus("success");
22360
22883
  clearToasts();
22361
- props == null ? void 0 : props.onSubmit(dataSubmitted);
22884
+ externalOnSubmit == null ? void 0 : externalOnSubmit(dataSubmitted);
22362
22885
  } catch (e2) {
22363
22886
  if (isValidationError(e2)) {
22364
22887
  const validationErrors = processValidationErrors(e2, TaskTypes.INDIVIDUAL);
@@ -22390,37 +22913,35 @@ function IndividualDropinComponent(props) {
22390
22913
  });
22391
22914
  }
22392
22915
  };
22393
- const isDocumentsRequired = (forms) => forms.some((form) => individualDocumentForms.includes(form.formId));
22394
- const canSubmit = (data2) => {
22916
+ const isDocumentsRequired = (forms2) => forms2.some((form) => individualDocumentForms.includes(form.formId));
22917
+ const canSubmit = () => {
22395
22918
  var _a2, _b2;
22396
- const isDecisionMakerOwner = ((_b2 = (_a2 = data2 == null ? void 0 : data2.personalDetails) == null ? void 0 : _a2.role) == null ? void 0 : _b2.length) === 1 && data2.personalDetails.role[0] === DecisionMakerType.OWNER;
22397
- const mandatoryDetails = props.taskType === TaskTypes.DECISION_MAKER ? isDecisionMakerOwner ? mandatoryApiFields.DECISION_MAKER_OWNER : mandatoryApiFields.DECISIONMAKER : mandatoryApiFields.INDIVIDUAL;
22919
+ const isDecisionMakerOwner = ((_b2 = (_a2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _a2.role) == null ? void 0 : _b2.length) === 1 && data.personalDetails.role[0] === DecisionMakerType.OWNER;
22920
+ const mandatoryDetails = taskType === TaskTypes.DECISION_MAKER ? isDecisionMakerOwner ? mandatoryApiFields.DECISION_MAKER_OWNER : mandatoryApiFields.DECISIONMAKER : mandatoryApiFields.INDIVIDUAL;
22398
22921
  return mandatoryDetails.every((detail) => {
22399
- const value = getProp(data2, detail);
22922
+ const value = getProp(data, detail);
22400
22923
  return !isEmpty(value) || Array.isArray(detail) && detail.length > 0;
22401
22924
  });
22402
22925
  };
22403
22926
  const datasetUtils = datasetUtilities(i18n.locale);
22404
- const formatDataForSummary = (data2, forms) => {
22405
- var _a2, _b2;
22406
- let summaryData = cloneObject(data2);
22407
- if ((_a2 = summaryData.personalDetails) == null ? void 0 : _a2.residencyCountry) {
22408
- summaryData.personalDetails.residencyCountry = datasetUtils.getCountryName(summaryData.personalDetails.residencyCountry);
22409
- }
22410
- if (summaryData.address) {
22411
- summaryData.address = mapAddressLabels(summaryData.address, datasetUtils);
22412
- }
22413
- if (isDocumentsRequired(forms)) {
22414
- individualDocumentForms.forEach((formId) => delete summaryData[formId]);
22415
- summaryData = {
22416
- ...summaryData,
22417
- ...formatFileSummaryData(data2)
22927
+ const formatIdDocument = (idDocument2) => {
22928
+ var _a2, _b2, _c2, _d2, _e, _f;
22929
+ if (idDocument2) {
22930
+ const documentType2 = hasInstantIdVerification({
22931
+ idDocument: idDocument2
22932
+ }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
22933
+ id: id2
22934
+ }) => (idDocument2 == null ? void 0 : idDocument2.idDocumentType) === id2);
22935
+ return {
22936
+ documentType: i18n.get(documentType2 == null ? void 0 : documentType2.name),
22937
+ ...(documentType2 == null ? void 0 : documentType2.hasBackPage) ? {
22938
+ frontPage: (_b2 = (_a2 = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name,
22939
+ backPage: (_d2 = (_c2 = idDocument2 == null ? void 0 : idDocument2.idBackPage) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
22940
+ } : {
22941
+ fileName: (_f = (_e = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _e[0]) == null ? void 0 : _f.name
22942
+ }
22418
22943
  };
22419
22944
  }
22420
- if ((_b2 = summaryData == null ? void 0 : summaryData.personalDetails) == null ? void 0 : _b2.accountHolder) {
22421
- summaryData.personalDetails.accountHolder = i18n.get(summaryData.personalDetails.accountHolder);
22422
- }
22423
- return summaryData;
22424
22945
  };
22425
22946
  const formatFileSummaryData = ({
22426
22947
  idDocument: idDocument2,
@@ -22444,139 +22965,89 @@ function IndividualDropinComponent(props) {
22444
22965
  }
22445
22966
  };
22446
22967
  };
22447
- const formatIdDocument = (idDocument2) => {
22448
- var _a2, _b2, _c2, _d2, _e2, _f2;
22449
- if (idDocument2) {
22450
- const documentType2 = hasInstantIdVerification({
22451
- idDocument: idDocument2
22452
- }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
22453
- id: id2
22454
- }) => (idDocument2 == null ? void 0 : idDocument2.idDocumentType) === id2);
22455
- return {
22456
- documentType: i18n.get(documentType2 == null ? void 0 : documentType2.name),
22457
- ...(documentType2 == null ? void 0 : documentType2.hasBackPage) ? {
22458
- frontPage: (_b2 = (_a2 = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name,
22459
- backPage: (_d2 = (_c2 = idDocument2 == null ? void 0 : idDocument2.idBackPage) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
22460
- } : {
22461
- fileName: (_f2 = (_e2 = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _e2[0]) == null ? void 0 : _f2.name
22462
- }
22968
+ const formatDataForSummary = () => {
22969
+ var _a2, _b2;
22970
+ let summaryData = cloneObject(data);
22971
+ if ((_a2 = summaryData.personalDetails) == null ? void 0 : _a2.residencyCountry) {
22972
+ summaryData.personalDetails.residencyCountry = datasetUtils.getCountryName(summaryData.personalDetails.residencyCountry);
22973
+ }
22974
+ if (summaryData.address) {
22975
+ summaryData.address = mapAddressLabels(summaryData.address, datasetUtils);
22976
+ }
22977
+ if (isDocumentsRequired(forms)) {
22978
+ individualDocumentForms.forEach((formId) => delete summaryData[formId]);
22979
+ summaryData = {
22980
+ ...summaryData,
22981
+ ...formatFileSummaryData(data)
22463
22982
  };
22464
22983
  }
22984
+ if ((_b2 = summaryData == null ? void 0 : summaryData.personalDetails) == null ? void 0 : _b2.accountHolder) {
22985
+ summaryData.personalDetails.accountHolder = i18n.get(summaryData.personalDetails.accountHolder);
22986
+ }
22987
+ return summaryData;
22465
22988
  };
22466
- const getSummaryOmittedKeys = (data2) => {
22467
- var _a2;
22468
- return [props.taskType === TaskTypes.DECISION_MAKER ? "role" : null, ((_a2 = data2.personalDetails) == null ? void 0 : _a2.idNumberExempt) ? "idNumber" : null].filter(Boolean);
22469
- };
22470
- return o(StateProvider, {
22471
- defaultData: data,
22472
- children: o(IndividualWithComposer, {
22473
- baseTrackingPayload,
22989
+ const summaryOmittedKeys = [taskType === TaskTypes.DECISION_MAKER && "role", ((_d = data.personalDetails) == null ? void 0 : _d.idNumberExempt) && "idNumber"].filter(Boolean);
22990
+ const {
22991
+ handleNextClick,
22992
+ handleBackClick,
22993
+ activeForm,
22994
+ shouldValidate,
22995
+ setShouldValidate,
22996
+ gotoFormByFormIndex,
22997
+ nextButtonLabel
22998
+ } = useFormComposer({
22999
+ problems,
23000
+ baseTrackingPayload,
23001
+ forms,
23002
+ formRef,
23003
+ onSubmit
23004
+ });
23005
+ return o(FormWrapper, {
23006
+ taskName: taskName ?? "individualDetails",
23007
+ activeForm,
23008
+ summary: {
23009
+ data: formatDataForSummary(),
23010
+ omittedKeys: summaryOmittedKeys
23011
+ },
23012
+ handleBackClick,
23013
+ handleNextClick,
23014
+ handleHomeClick,
23015
+ hideFooter,
23016
+ loadingStatus,
23017
+ forms,
23018
+ onSubmit,
23019
+ baseTrackingPayload,
23020
+ handleGetIdVerificationToken,
23021
+ gotoFormByFormIndex,
23022
+ nextButtonLabel,
23023
+ homeButtonLabel,
23024
+ validateForm: () => setShouldValidate(true),
23025
+ canSubmit: canSubmit() && hasDataChanged(dataFromResponse, data),
23026
+ problems,
23027
+ children: o(IndividualComponent, {
23028
+ ...derivedProps,
22474
23029
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
22475
- data,
22476
- country: ((_d = data == null ? void 0 : data.personalDetails) == null ? void 0 : _d.residencyCountry) || ((_f = (_e = parentLegalEntity == null ? void 0 : parentLegalEntity.organization) == null ? void 0 : _e.registeredAddress) == null ? void 0 : _f.country),
22477
- taskType: props.taskType,
23030
+ data: dataFromResponse,
23031
+ country: country2,
23032
+ activeForm,
23033
+ forms,
23034
+ ref: formRef,
23035
+ taskType,
22478
23036
  problems,
22479
- eventEmitter: props.eventEmitter,
22480
- hideDropinLayout: props.hideDropinLayout,
22481
- onChange: props.onChange,
22482
- handleHomeClick: props.handleHomeClick,
22483
- homeButtonLabel: props.homeButtonLabel,
22484
- handleBackClick,
23037
+ onNext: handleNextClick,
23038
+ onBack: handleBackClick,
23039
+ setHideFooter,
22485
23040
  handleGetIdVerificationToken,
22486
- onSubmit,
22487
- summary: {
22488
- formatData: formatDataForSummary,
22489
- getOmittedKeys: getSummaryOmittedKeys
22490
- },
22491
- canSubmit,
22492
- legalEntityType: LegalEntityType.INDIVIDUAL,
22493
23041
  legalEntityId: legalEntityResponse == null ? void 0 : legalEntityResponse.id,
22494
23042
  allowedRoles: roleTypes,
22495
23043
  handleAddressSearch,
22496
23044
  handleFindAddress,
22497
- onTypeSwitch: props.onTypeSwitch,
22498
- taskName: props.taskName
23045
+ onTypeSwitch,
23046
+ onCountryChange: setCountry,
23047
+ shouldValidate
22499
23048
  })
22500
23049
  });
22501
23050
  }
22502
- const _toast = "";
22503
- function Toast({
22504
- label,
22505
- subLabel,
22506
- actionLabel,
22507
- type,
22508
- duration = 3500,
22509
- onToastHide,
22510
- onToastAction
22511
- }) {
22512
- const toastRef = _$1(null);
22513
- const loading2 = type === ToastType.LOADING;
22514
- const successToast = type === ToastType.SUCCESS;
22515
- const labelId = getUniqueId("toast");
22516
- const handleShow = T$1(() => {
22517
- var _a;
22518
- return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
22519
- }, []);
22520
- const handleHide = T$1(() => {
22521
- var _a;
22522
- (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
22523
- onToastHide();
22524
- }, [onToastHide]);
22525
- p(() => {
22526
- handleShow();
22527
- if (duration !== "indefinite") {
22528
- setTimeout(() => handleHide(), duration);
22529
- }
22530
- }, [label, duration, handleHide, handleShow]);
22531
- return o("div", {
22532
- ref: toastRef,
22533
- role: actionLabel ? "alertdialog" : "alert",
22534
- className: "adl-toast",
22535
- "aria-labelledby": labelId,
22536
- children: [loading2 && o("div", {
22537
- className: "adl-toast__loader",
22538
- children: o("div", {
22539
- className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
22540
- })
22541
- }), !loading2 && o("div", {
22542
- className: cx("adl-toast__status", {
22543
- "adl-toast__status--success": successToast,
22544
- "adl-toast__status--error": !successToast
22545
- }),
22546
- children: [successToast && o(Icon, {
22547
- className: "adl-toast__status-icon",
22548
- name: "checkmark"
22549
- }), !successToast && o(Icon, {
22550
- className: "adl-toast__status-icon",
22551
- name: "cross"
22552
- })]
22553
- }), o("div", {
22554
- className: "adl-toast__message",
22555
- children: [o("span", {
22556
- id: labelId,
22557
- className: "adl-toast__title",
22558
- children: label
22559
- }), actionLabel && o("button", {
22560
- className: "adl-link adl-toast__action",
22561
- title: "performAction",
22562
- type: "button",
22563
- onClick: onToastAction,
22564
- children: actionLabel
22565
- }), !loading2 && subLabel && o("span", {
22566
- className: "adl-toast__subtitle",
22567
- children: subLabel
22568
- })]
22569
- }), !loading2 && o("button", {
22570
- className: "adl-toast__close",
22571
- title: "close",
22572
- type: "button",
22573
- onClick: handleHide,
22574
- children: o(Icon, {
22575
- name: "cross"
22576
- })
22577
- })]
22578
- });
22579
- }
22580
23051
  const isInstantVerificationAvailable = ({
22581
23052
  country: country2,
22582
23053
  verificationVendorsCallback,
@@ -22788,6 +23259,9 @@ function PayoutDetailsDropinComponent(props) {
22788
23259
  var _a2, _b2;
22789
23260
  setLoadingStatus("loading");
22790
23261
  dataSubmitted.payoutAccountDetails.currency = dataSubmitted.payoutAccountDetails.currency ?? fallbackCurrency;
23262
+ if (defaultPayoutCountry === CountryCodes.Sweden && "iban" in dataSubmitted.payoutAccountDetails) {
23263
+ dataSubmitted.payoutAccountDetails.currency = Currency.EUR;
23264
+ }
22791
23265
  const event = {
22792
23266
  segmentation: {
22793
23267
  ...baseTrackingPayload,
@@ -23596,13 +24070,15 @@ function TrustRoleAndEntityTypeComponent(props) {
23596
24070
  p(() => {
23597
24071
  var _a;
23598
24072
  (_a = props.onChange) == null ? void 0 : _a.call(props, {
24073
+ schema,
23599
24074
  data,
23600
24075
  errors,
23601
24076
  valid,
23602
24077
  isValid,
23603
- dataStoreId: id2
24078
+ dataStoreId: id2,
24079
+ fieldProblems
23604
24080
  });
23605
- }, [data, isValid, i18n, errors, valid, id2]);
24081
+ }, [schema, data, isValid, i18n, errors, valid, id2, fieldProblems]);
23606
24082
  const onInputDescription = (e2) => {
23607
24083
  const {
23608
24084
  value
@@ -23842,27 +24318,21 @@ function RoleAndTypeDropinComponent(props) {
23842
24318
  props.navigateBack();
23843
24319
  };
23844
24320
  const hasRolesChanged = (newRoles = [], existingRoles = []) => newRoles.length !== existingRoles.length || !newRoles.every((newRole) => existingRoles.includes(newRole));
23845
- const getSidebar = () => Object.values(formList).map((form) => ({
24321
+ const formsWithValidity = Object.values(formList).map((form) => ({
23846
24322
  formId: form.formId,
23847
24323
  formName: form.formName,
23848
24324
  isValid: formValidity[form.formId]
23849
24325
  }));
23850
- const sidebar = o(FormNavigation, {
23851
- forms: getSidebar(),
23852
- activeForm,
23853
- taskName
23854
- });
23855
- const footer = o(ActionBar, {
23856
- onNext: onNavigateToNextStep,
23857
- onHome: saveRolesAndNavigate,
23858
- nextButtonLabel: isSummaryStep ? i18n.get("submit") : i18n.get("next"),
23859
- homeButtonLabel: i18n.get("saveAndGoToOverview")
23860
- });
23861
24326
  const gotoFormByFormIndex = (formIndex) => {
23862
24327
  setActiveForm(formList[formIndex]);
23863
24328
  };
23864
24329
  const content = o(Fragment, {
23865
- children: [sidebar, o("div", {
24330
+ children: [o(FormNavigation, {
24331
+ forms: formsWithValidity,
24332
+ activeForm: formsWithValidity.find((form) => form.formId === activeForm.formId),
24333
+ taskName,
24334
+ gotoForm: noop
24335
+ }), o("div", {
23866
24336
  className: "adyen-kyc-form-container",
23867
24337
  children: [o("div", {
23868
24338
  className: activeForm.formId !== "roleAndEntityType" ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -23879,7 +24349,12 @@ function RoleAndTypeDropinComponent(props) {
23879
24349
  forms: [undefinedBeneficiaryForms.roleAndEntityType],
23880
24350
  gotoForm: gotoFormByFormIndex
23881
24351
  })
23882
- }), footer]
24352
+ }), o(ActionBar, {
24353
+ onNext: onNavigateToNextStep,
24354
+ onHome: saveRolesAndNavigate,
24355
+ nextButtonLabel: isSummaryStep ? i18n.get("submit") : i18n.get("next"),
24356
+ homeButtonLabel: i18n.get("saveAndGoToOverview")
24357
+ })]
23883
24358
  })]
23884
24359
  });
23885
24360
  return o(DropinLayout, {
@@ -23986,7 +24461,8 @@ function ServiceAgreementDropinComponent({
23986
24461
  const [loadingStatus, setLoadingStatus] = h();
23987
24462
  const formsToBeSigned = serviceAgreementTypes.map((serviceAgreementType) => ({
23988
24463
  formId: serviceAgreementType,
23989
- formName: serviceAgreementTypesTranslationMapping[serviceAgreementType]
24464
+ formName: serviceAgreementTypesTranslationMapping[serviceAgreementType],
24465
+ isValid: false
23990
24466
  }));
23991
24467
  const signedForms = serviceAgreementAcceptanceInfos.map((serviceAgreementAcceptanceInfo) => ({
23992
24468
  formId: serviceAgreementAcceptanceInfo.type,
@@ -24409,6 +24885,7 @@ function SolePropDropinComponent(props) {
24409
24885
  homeButtonLabel: props.homeButtonLabel,
24410
24886
  onSubmit,
24411
24887
  legalEntityType: LegalEntityType.TRUST,
24888
+ legalEntityResponse,
24412
24889
  summary: {
24413
24890
  formatData: formatDataForSummary,
24414
24891
  getOmittedKeys
@@ -24597,6 +25074,7 @@ function TrustDropinComponent(props) {
24597
25074
  homeButtonLabel: props.homeButtonLabel,
24598
25075
  onSubmit,
24599
25076
  legalEntityType: LegalEntityType.TRUST,
25077
+ legalEntityResponse,
24600
25078
  summary: {
24601
25079
  formatData: formatDataForSummary,
24602
25080
  getOmittedKeys
@@ -25693,9 +26171,11 @@ class UIElement extends BaseElement {
25693
26171
  className: "adyen-kyc-dropin-container adl-u-position-relative",
25694
26172
  children: o(AutoResizer, {
25695
26173
  children: o(ToastContextProvider, {
25696
- children: o(Component2, {
25697
- ...this.props.componentProps,
25698
- eventEmitter: this.eventEmitter
26174
+ children: o(StateProvider, {
26175
+ children: o(Component2, {
26176
+ ...this.props.componentProps,
26177
+ eventEmitter: this.eventEmitter
26178
+ })
25699
26179
  })
25700
26180
  })
25701
26181
  })