@adyen/kyc-components 2.14.0 → 2.16.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 (46) hide show
  1. package/dist/es/adyen-kyc-components.es.js +687 -480
  2. package/dist/types/components/DocumentUpload/types.d.ts +2 -1
  3. package/dist/types/components/Dropins/RoleAndTypeDropin/components/RoleAndTypeDropinComponent.d.ts +1 -1
  4. package/dist/types/components/Dropins/RoleAndTypeDropin/types.d.ts +3 -0
  5. package/dist/types/components/IdDocumentUpload/types.d.ts +4 -3
  6. package/dist/types/components/PayoutBankStatement/types.d.ts +2 -1
  7. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/ProofOfIdentityCard.d.ts +1 -1
  8. package/dist/types/components/TrustMembers/types.d.ts +6 -2
  9. package/dist/types/components/TrustRoleAndEntityType/types.d.ts +9 -0
  10. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  11. package/dist/types/components/internal/Button/types.d.ts +2 -2
  12. package/dist/types/components/internal/CountryField/CountryField.d.ts +2 -2
  13. package/dist/types/components/internal/FormFields/Dropzone/FilePicker.d.ts +3 -2
  14. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +2 -6
  15. package/dist/types/components/internal/FormFields/Dropzone/validate.d.ts +2 -1
  16. package/dist/types/components/internal/LegalCompanyNameField/LegalCompanyNameField.d.ts +2 -3
  17. package/dist/types/components/internal/Remove/Remove.d.ts +1 -1
  18. package/dist/types/components/internal/Remove/types.d.ts +6 -4
  19. package/dist/types/components/internal/StateField/StateField.d.ts +2 -2
  20. package/dist/types/core/Context/AuthContext/AuthContext.d.ts +0 -1
  21. package/dist/types/core/Context/AuthContext/AuthProvider.d.ts +5 -2
  22. package/dist/types/core/Context/ConfigurationApiContext/getEmbeddedApi.d.ts +1 -2
  23. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  24. package/dist/types/core/Context/StateContext/types.d.ts +1 -0
  25. package/dist/types/core/Services/session.d.ts +5 -0
  26. package/dist/types/core/Services/types.d.ts +1 -2
  27. package/dist/types/core/Services/utils.d.ts +1 -0
  28. package/dist/types/core/core.d.ts +1 -0
  29. package/dist/types/core/hooks/useForm/types.d.ts +23 -8
  30. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  31. package/dist/types/core/hooks/useForm/utils.d.ts +12 -1
  32. package/dist/types/core/models/file.d.ts +8 -0
  33. package/dist/types/core/types.d.ts +2 -1
  34. package/dist/types/language/config.d.ts +17 -15
  35. package/dist/types/utils/api/documentUtils.d.ts +3 -2
  36. package/dist/types/utils/company-util.d.ts +2 -1
  37. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  38. package/dist/types/utils/entity-status-util.d.ts +2 -2
  39. package/dist/types/utils/formUtils.d.ts +11 -3
  40. package/dist/types/utils/mapping/mapping.d.ts +2 -0
  41. package/dist/types/utils/trust-util.d.ts +1 -1
  42. package/dist/types/utils/trustMembers/handlers/createExemptSettlor.d.ts +4 -0
  43. package/dist/types/utils/trustMembers/handlers/updateExemptSettlorName.d.ts +4 -0
  44. package/package.json +1 -1
  45. package/dist/types/core/Services/auth/refresh-sdkToken.d.ts +0 -6
  46. package/dist/types/core/hooks/useSdkToken.d.ts +0 -5
@@ -62,6 +62,7 @@ const uploadDocument = "Upload Document";
62
62
  const individualDetails = "Individual details";
63
63
  const socialSecurityNumber = "Last 4 digits of Social Security Number (SSN)";
64
64
  const socialSecurityNumber9Digits = "Social Security Number (SSN)";
65
+ const socialInsuranceNumber = "Social Insurance Number (SIN)";
65
66
  const codiceFiscale = "Codice fiscale";
66
67
  const personnummer = "Personnummer";
67
68
  const dni = "DNI";
@@ -121,6 +122,8 @@ const nationality$1 = "Nationality";
121
122
  const dateOfIncorporation = "Date of incorporation";
122
123
  const passportExpiryDate = "Passport expiry date";
123
124
  const proofOfNationality = "Proof of nationality";
125
+ const identityNumberExempt__US = "I don't have an SSN";
126
+ const identityNumberExempt__CA = "I don't have an SIN";
124
127
  const uploadDocumentForSsn = "Upload an ID document instead of SSN";
125
128
  const uploadDocumentForNric = "Upload an ID document instead of NRIC";
126
129
  const operationalAddressHeader = "Additional address";
@@ -224,13 +227,6 @@ const pleaseNote = "Please note:";
224
227
  const byClickingSubmitReview = "By clicking 'Submit review', you confirm that all of your information has been reviewed, and that all newly provided or already existing data is accurate and up-to-date.";
225
228
  const nameAndCountry = "Name and country";
226
229
  const companyCountry = "Where is your business located?";
227
- const legalCompanyName = "Legal name of the company";
228
- const legalCompanyNameHelper = "Enter the name exactly as it is on your company's official registration documents.";
229
- const legalCompanyNameHelper__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC)";
230
- const legalCompanyNameHelper__NL = "Enter the name exactly as it is on your Chamber of Commerce registration.";
231
- const legalCompanyNameHelper__US = "Enter the name exactly as it is on on your Secretary of State registration.";
232
- const legalCompanyNameHelper__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile";
233
- const legalCompanyNameHelper__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation";
234
230
  const accountDetailsDescription = "Provide a few details about you to start accepting live payments.";
235
231
  const provideDetails = "Provide details";
236
232
  const payoutAccountsDescription = "To set up your account, let us know where to send your payouts.";
@@ -457,7 +453,7 @@ const ICO = "IČO (Identifikační číslo)";
457
453
  const handelsregisternummer = "Handelsregisternummer";
458
454
  const NumeroDeTVA = "Numéro de TVA";
459
455
  const organisasjonsnummer = "Organisasjonsnummer";
460
- const skattenummer = "Skattenummer";
456
+ const mvanummer = "MVA nummer";
461
457
  const verificationErrorMessage = "Some information couldn’t be verified. Click to see what needs to be adjusted.";
462
458
  const remediationFormErrorMessage = "Some information couldn’t be verified. Information in this form may need to be adjusted.";
463
459
  const youHaveUnsavedChanges = "You have unsaved changes";
@@ -676,12 +672,12 @@ const documentIssuedWithinLastYear = "Note! The document needs to be issued with
676
672
  const learnMore = "Learn more";
677
673
  const doingBusinessAsNameFiling = "Doing business as-name filling";
678
674
  const taxFiling = "Tax-filling";
679
- const continueAsCompany = "Continue as a company?";
680
- const continueAsIndividual = "Continue as an individual?";
681
- const indicatedPayoutToCompany = "You indicated that you want to be paid out to a bank account that is owned by a company, such as a private company, public company, partnership, or non-profit organization. This means that we need to collect some information about your company too.";
682
- const continueSigningUpAsCompany = "Do you want to continue signing up with your company information?";
683
- const indicatedPayoutToPersonalAccount = "You indicated that you want to be paid out to a bank account that is owned by you personally. This means you will continue as an individual, not a company. However, if you operate as a private company, public company, partnership, or non-profit organization, then you cannot continue as an individual.";
684
- const continueSigningUpAsIndividual = "Do you want to continue signing up as an individual?";
675
+ const areYouACompany = "Are you a company?";
676
+ const singingUpAsIndividualButLooksLikeYouAreACompany = "You’re now signing up as an individual. But it looks like you’re a company that uses a company bank account to receive payouts.";
677
+ const wouldYouLikeToSignUpAsCompanyInstead = "Would you like to sign up as a company instead? (You’ll have to re-enter some information from before.)";
678
+ const areYouAnIndividual = "Are you an individual?";
679
+ const singingUpAsCompanyButLooksLikeYouAreAnIndividual = "You’re now signing up as an company. But it looks like you’re an individual who uses your personal bank account to receive payouts.";
680
+ const wouldYouLikeToSignUpAsIndividualInstead = "Would you like to sign up as an individual instead? (You’ll have to re-enter some information from before.)";
685
681
  const noGoBack = "No, go back";
686
682
  const continueCompany = "Continue as company";
687
683
  const continueIndividual = "Continue as individual";
@@ -692,7 +688,6 @@ const addresses = "Addresses";
692
688
  const loading = "Loading";
693
689
  const businessIncorporationNumber = "Business incorporation number";
694
690
  const doNotHaveBusinessIncorporationNumber = "I do not have a Business incorporation number";
695
- const socialInsuranceNumber = "Social insurance number";
696
691
  const verificationMethod = "Verification method";
697
692
  const verifyViaMobileBankAppOrBankWebsite = "Verify the account via mobile bank app or bank website";
698
693
  const provideAccountDetailsAndUploadBankStatement = "Provide account details and upload a scan of a bank statement";
@@ -761,6 +756,13 @@ const passportPhotoPage = "Passport photo page";
761
756
  const residencePermitBack = "Residence permit (back)";
762
757
  const residencePermitFront = "Residence permit (front)";
763
758
  const manualUpload = "Manual upload";
759
+ const legalCompanyName = "Legal name of the company";
760
+ const legalCompanyName__helperText = "Enter the name exactly as it is on your company's official registration documents.";
761
+ const legalCompanyName__helperText__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC).";
762
+ const legalCompanyName__helperText__NL = "Enter the name exactly as it is on your Chamber of Commerce registration.";
763
+ const legalCompanyName__helperText__US = "Enter the name exactly as it appears on your Secretary of State Registration.";
764
+ const legalCompanyName__helperText__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile.";
765
+ const legalCompanyName__helperText__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation.";
764
766
  const errorMessage_1_10 = "Information couldn’t be verified";
765
767
  const errorMessage_1_11 = "Document didn’t meet requirements";
766
768
  const errorMessage_1_12 = "Legal entity declined";
@@ -1119,6 +1121,7 @@ const defaultTrans = {
1119
1121
  individualDetails,
1120
1122
  socialSecurityNumber,
1121
1123
  socialSecurityNumber9Digits,
1124
+ socialInsuranceNumber,
1122
1125
  codiceFiscale,
1123
1126
  personnummer,
1124
1127
  dni,
@@ -1178,6 +1181,8 @@ const defaultTrans = {
1178
1181
  dateOfIncorporation,
1179
1182
  passportExpiryDate,
1180
1183
  proofOfNationality,
1184
+ identityNumberExempt__US,
1185
+ identityNumberExempt__CA,
1181
1186
  uploadDocumentForSsn,
1182
1187
  uploadDocumentForNric,
1183
1188
  operationalAddressHeader,
@@ -1281,13 +1286,6 @@ const defaultTrans = {
1281
1286
  byClickingSubmitReview,
1282
1287
  nameAndCountry,
1283
1288
  companyCountry,
1284
- legalCompanyName,
1285
- legalCompanyNameHelper,
1286
- legalCompanyNameHelper__AU,
1287
- legalCompanyNameHelper__NL,
1288
- legalCompanyNameHelper__US,
1289
- legalCompanyNameHelper__SG,
1290
- legalCompanyNameHelper__HK,
1291
1289
  accountDetailsDescription,
1292
1290
  provideDetails,
1293
1291
  payoutAccountsDescription,
@@ -1517,7 +1515,7 @@ const defaultTrans = {
1517
1515
  handelsregisternummer,
1518
1516
  NumeroDeTVA,
1519
1517
  organisasjonsnummer,
1520
- skattenummer,
1518
+ mvanummer,
1521
1519
  verificationErrorMessage,
1522
1520
  remediationFormErrorMessage,
1523
1521
  youHaveUnsavedChanges,
@@ -1747,12 +1745,12 @@ const defaultTrans = {
1747
1745
  learnMore,
1748
1746
  doingBusinessAsNameFiling,
1749
1747
  taxFiling,
1750
- continueAsCompany,
1751
- continueAsIndividual,
1752
- indicatedPayoutToCompany,
1753
- continueSigningUpAsCompany,
1754
- indicatedPayoutToPersonalAccount,
1755
- continueSigningUpAsIndividual,
1748
+ areYouACompany,
1749
+ singingUpAsIndividualButLooksLikeYouAreACompany,
1750
+ wouldYouLikeToSignUpAsCompanyInstead,
1751
+ areYouAnIndividual,
1752
+ singingUpAsCompanyButLooksLikeYouAreAnIndividual,
1753
+ wouldYouLikeToSignUpAsIndividualInstead,
1756
1754
  "continue": "Continue",
1757
1755
  noGoBack,
1758
1756
  continueCompany,
@@ -1764,7 +1762,6 @@ const defaultTrans = {
1764
1762
  loading,
1765
1763
  businessIncorporationNumber,
1766
1764
  doNotHaveBusinessIncorporationNumber,
1767
- socialInsuranceNumber,
1768
1765
  verificationMethod,
1769
1766
  verifyViaMobileBankAppOrBankWebsite,
1770
1767
  provideAccountDetailsAndUploadBankStatement,
@@ -1835,6 +1832,13 @@ const defaultTrans = {
1835
1832
  residencePermitBack,
1836
1833
  residencePermitFront,
1837
1834
  manualUpload,
1835
+ legalCompanyName,
1836
+ legalCompanyName__helperText,
1837
+ legalCompanyName__helperText__AU,
1838
+ legalCompanyName__helperText__NL,
1839
+ legalCompanyName__helperText__US,
1840
+ legalCompanyName__helperText__SG,
1841
+ legalCompanyName__helperText__HK,
1838
1842
  errorMessage_1_10,
1839
1843
  errorMessage_1_11,
1840
1844
  errorMessage_1_12,
@@ -2363,12 +2367,26 @@ const useCoreContext = () => {
2363
2367
  return context;
2364
2368
  };
2365
2369
  const Summary$1 = "";
2370
+ const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
2371
+ a[c] = obj[c];
2372
+ return a;
2373
+ }, {});
2374
+ const addKeys = (obj, add2, initialValue, defaultData, pendingData) => add2.reduce((a, c) => ({
2375
+ ...a,
2376
+ [c]: a[c] ?? (pendingData == null ? void 0 : pendingData[c]) ?? (defaultData == null ? void 0 : defaultData[c]) ?? initialValue
2377
+ }), obj);
2378
+ function getDataByFields(formData, fieldKeys) {
2379
+ return entriesOf(formData).reduce((acc, [key, val]) => {
2380
+ if (fieldKeys.includes(key)) {
2381
+ return {
2382
+ ...acc,
2383
+ [key]: val
2384
+ };
2385
+ }
2386
+ return acc;
2387
+ }, {});
2388
+ }
2366
2389
  const formUtilities = (props, i18n) => ({
2367
- getPlaceholder: (field, fallbackPlaceholderKey) => {
2368
- var _a, _b;
2369
- const translationKey = fallbackPlaceholderKey ? ((_a = props.placeholders) == null ? void 0 : _a[field]) ?? fallbackPlaceholderKey : (_b = props.placeholders) == null ? void 0 : _b[field];
2370
- return translationKey ? i18n.get(translationKey) : "";
2371
- },
2372
2390
  getLabel: (field, fallbackLabelKey) => {
2373
2391
  var _a, _b;
2374
2392
  let translationKey = ((_a = props.labels) == null ? void 0 : _a[field]) ?? fallbackLabelKey ?? field;
@@ -2384,6 +2402,11 @@ const formUtilities = (props, i18n) => ({
2384
2402
  }
2385
2403
  return i18n.get(translationKey);
2386
2404
  },
2405
+ getPlaceholder: (field, fallbackPlaceholderKey) => {
2406
+ var _a, _b;
2407
+ const translationKey = fallbackPlaceholderKey ? ((_a = props.placeholders) == null ? void 0 : _a[field]) ?? fallbackPlaceholderKey : (_b = props.placeholders) == null ? void 0 : _b[field];
2408
+ return translationKey ? i18n.get(translationKey) : "";
2409
+ },
2387
2410
  getHelperText: (field, fallbackHelperTextKey) => {
2388
2411
  var _a, _b;
2389
2412
  const translationKey = fallbackHelperTextKey ? ((_a = props.helperText) == null ? void 0 : _a[field]) ?? fallbackHelperTextKey : (_b = props.helperText) == null ? void 0 : _b[field];
@@ -2423,7 +2446,70 @@ const formUtilities = (props, i18n) => ({
2423
2446
  return i18n.get(translationKey, translationObject);
2424
2447
  }
2425
2448
  return errorMessage ? i18n.get(errorMessage) : Boolean(fieldProblems == null ? void 0 : fieldProblems[field]);
2426
- }
2449
+ },
2450
+ getFieldData: (formData, fieldKeys) => getDataByFields(formData, fieldKeys),
2451
+ getFieldValid: (formValid, fieldKeys) => entriesOf(formValid).reduce((acc, [key, val]) => fieldKeys.includes(key) ? {
2452
+ ...acc,
2453
+ [key]: val
2454
+ } : acc, {}),
2455
+ getFieldErrors: (formErrors, fieldProblems, fieldKeys) => Object.keys(formErrors).reduce((acc, key) => {
2456
+ var _a;
2457
+ if (fieldKeys.includes(key)) {
2458
+ const error = (_a = formErrors == null ? void 0 : formErrors[key]) == null ? void 0 : _a.errorMessage;
2459
+ if (typeof error === "object") {
2460
+ const {
2461
+ translationKey,
2462
+ translationObject
2463
+ } = error;
2464
+ return {
2465
+ ...acc,
2466
+ [key]: i18n.get(translationKey, translationObject)
2467
+ };
2468
+ }
2469
+ return error ? {
2470
+ ...acc,
2471
+ [key]: i18n.get(error)
2472
+ } : {
2473
+ ...acc,
2474
+ [key]: Boolean(fieldProblems == null ? void 0 : fieldProblems[key])
2475
+ };
2476
+ }
2477
+ return acc;
2478
+ }, {}),
2479
+ getFieldLabels: (fieldKeys, fallbackLabelKeys) => fieldKeys.reduce((acc, field) => {
2480
+ var _a, _b;
2481
+ let translationKey = ((_a = props.labels) == null ? void 0 : _a[field]) ?? (fallbackLabelKeys == null ? void 0 : fallbackLabelKeys[field]) ?? field;
2482
+ if (props.labels && !((_b = props.labels) == null ? void 0 : _b[field]) && Object.keys(props.labels).length) {
2483
+ const parentKey = Object.keys(props.labels).find((fieldKey) => {
2484
+ var _a2;
2485
+ return typeof ((_a2 = props.labels) == null ? void 0 : _a2[fieldKey]) === "object";
2486
+ });
2487
+ if (parentKey) {
2488
+ const nestedLabel = props.labels[parentKey][field];
2489
+ translationKey = nestedLabel ?? translationKey;
2490
+ }
2491
+ }
2492
+ return {
2493
+ ...acc,
2494
+ [field]: i18n.get(translationKey)
2495
+ };
2496
+ }, {}),
2497
+ getFieldPlaceholders: (fieldKeys, fallbackPlaceholderKeys) => fieldKeys.reduce((acc, field) => {
2498
+ var _a, _b;
2499
+ const translationKey = (fallbackPlaceholderKeys == null ? void 0 : fallbackPlaceholderKeys[field]) ? ((_a = props.placeholders) == null ? void 0 : _a[field]) ?? (fallbackPlaceholderKeys == null ? void 0 : fallbackPlaceholderKeys[field]) : (_b = props.placeholders) == null ? void 0 : _b[field];
2500
+ return translationKey ? {
2501
+ ...acc,
2502
+ [field]: i18n.get(translationKey)
2503
+ } : acc;
2504
+ }, {}),
2505
+ getFieldHelperText: (fieldKeys, fallbackHelperTextKeys) => fieldKeys.reduce((acc, field) => {
2506
+ var _a, _b;
2507
+ const translationKey = (fallbackHelperTextKeys == null ? void 0 : fallbackHelperTextKeys[field]) ? ((_a = props.helperText) == null ? void 0 : _a[field]) ?? (fallbackHelperTextKeys == null ? void 0 : fallbackHelperTextKeys[field]) : (_b = props.helperText) == null ? void 0 : _b[field];
2508
+ return translationKey ? {
2509
+ ...acc,
2510
+ [field]: i18n.get(translationKey)
2511
+ } : acc;
2512
+ }, {})
2427
2513
  });
2428
2514
  const MAX_LENGTH = 30;
2429
2515
  const getMaxLengthByFormatRuleset = (formattingRules, field) => {
@@ -3041,14 +3127,6 @@ function useResetGlobalData(caller) {
3041
3127
  }
3042
3128
  }), [dispatch, caller]);
3043
3129
  }
3044
- const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
3045
- a[c] = obj[c];
3046
- return a;
3047
- }, {});
3048
- const addKeys = (obj, add2, initialValue, defaultData, pendingData) => add2.reduce((a, c) => ({
3049
- ...a,
3050
- [c]: a[c] ?? (pendingData == null ? void 0 : pendingData[c]) ?? (defaultData == null ? void 0 : defaultData[c]) ?? initialValue
3051
- }), obj);
3052
3130
  const processField = ({
3053
3131
  key,
3054
3132
  value = null,
@@ -3463,6 +3541,7 @@ function useForm({
3463
3541
  asyncRules,
3464
3542
  fieldProblems,
3465
3543
  maskedFields,
3544
+ optionalFields,
3466
3545
  formatters,
3467
3546
  shouldValidate = false
3468
3547
  }) {
@@ -3474,20 +3553,26 @@ function useForm({
3474
3553
  asyncValidationResults
3475
3554
  } = useAsyncValidator(asyncRules);
3476
3555
  const getRequiredFields = useMemo(() => typeof schema === "function" ? schema : () => schema, [schema]);
3556
+ const getSchema = useMemo(() => {
3557
+ if (optionalFields) {
3558
+ return defaultData ? [...getRequiredFields(defaultData), ...optionalFields] : [];
3559
+ }
3560
+ return defaultData ? getRequiredFields(defaultData) : [];
3561
+ }, [optionalFields, defaultData, getRequiredFields]);
3477
3562
  const getReducer = useCallback(() => reducer({
3478
3563
  staticValidate: triggerStaticValidation,
3479
3564
  asyncValidate: triggerAsyncValidation,
3480
3565
  formatters
3481
3566
  }), [triggerStaticValidation, triggerAsyncValidation, formatters]);
3482
3567
  const getInitialData = useCallback(() => ({
3483
- schema: defaultData ? getRequiredFields(defaultData) : [],
3568
+ schema: getSchema,
3484
3569
  defaultData,
3485
3570
  fieldProblems,
3486
3571
  maskedFields,
3487
3572
  formatters,
3488
3573
  staticValidate: triggerStaticValidation,
3489
3574
  asyncValidate: triggerAsyncValidation
3490
- }), [defaultData, fieldProblems, maskedFields, formatters, getRequiredFields, triggerStaticValidation, triggerAsyncValidation]);
3575
+ }), [getSchema, defaultData, fieldProblems, maskedFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
3491
3576
  const [state2, dispatch] = useReducer(getReducer(), getInitialData(), init);
3492
3577
  const isValid = useMemo(() => {
3493
3578
  var _a;
@@ -4822,12 +4907,12 @@ const Select = ({
4822
4907
  });
4823
4908
  };
4824
4909
  const logger$k = createLogger("CountryField");
4825
- const COUNTRY_FIELD = "country";
4910
+ const COUNTRY_FIELD = ["country"];
4826
4911
  function CountryField({
4827
4912
  data,
4828
4913
  valid,
4829
- error,
4830
- label,
4914
+ errors,
4915
+ labels: labels2,
4831
4916
  readonly,
4832
4917
  handleChangeFor,
4833
4918
  helperText,
@@ -4850,27 +4935,21 @@ function CountryField({
4850
4935
  ...item,
4851
4936
  sprite: `#adl-flag-${item.id.toLowerCase()}`
4852
4937
  }));
4853
- const handleCompanyChangeFor = useCallback((e) => {
4854
- const {
4855
- value
4856
- } = e.target;
4857
- handleChangeFor(COUNTRY_FIELD)(value);
4858
- }, [handleChangeFor]);
4859
4938
  return jsx(Field, {
4860
- name: COUNTRY_FIELD,
4861
- label: label || i18n.get(COUNTRY_FIELD),
4862
- errorMessage: error,
4939
+ name: "country",
4940
+ label: (labels2 == null ? void 0 : labels2.country) || i18n.get("country"),
4941
+ errorMessage: errors.country,
4863
4942
  classNameModifiers,
4864
- isValid: valid,
4865
- helper: helperText,
4943
+ isValid: valid.country,
4944
+ helper: helperText == null ? void 0 : helperText.country,
4866
4945
  children: (childProps) => jsx(Select, {
4867
4946
  ...childProps,
4868
- name: COUNTRY_FIELD,
4947
+ name: "country",
4869
4948
  placeholder: i18n.get("selectCountry"),
4870
- selected: data,
4949
+ selected: data.country,
4871
4950
  items: countries,
4872
4951
  readonly: (countries.length === 1 || readonly) && !!data,
4873
- onChange: handleCompanyChangeFor
4952
+ onChange: handleChangeFor("country")
4874
4953
  })
4875
4954
  });
4876
4955
  }
@@ -5002,46 +5081,34 @@ const InputText = forwardRef(({
5002
5081
  );
5003
5082
  });
5004
5083
  InputText.displayName = "InputText";
5005
- const LEGAL_COMPANY_NAME_FIELD = "legalCompanyName";
5084
+ const LEGAL_COMPANY_NAME_FIELD = ["legalCompanyName"];
5006
5085
  function LegalCompanyNameField({
5007
5086
  data,
5008
5087
  valid,
5009
- error,
5010
- label,
5088
+ errors,
5089
+ labels: labels2,
5011
5090
  helperText,
5012
5091
  readonly,
5013
5092
  handleChangeFor
5014
5093
  }) {
5015
- const handleLegalCompanyNameInput = useCallback((e) => {
5016
- const {
5017
- value
5018
- } = e.target;
5019
- handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "input")(value);
5020
- }, [handleChangeFor]);
5021
- const handleLegalCompanyNameBlur = useCallback((e) => {
5022
- const {
5023
- value
5024
- } = e.target;
5025
- handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "blur")(value);
5026
- }, [handleChangeFor]);
5027
5094
  return jsx(Field, {
5028
- name: LEGAL_COMPANY_NAME_FIELD,
5029
- label,
5030
- helper: helperText,
5031
- classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
5032
- errorMessage: error,
5033
- isValid: valid,
5095
+ name: "legalCompanyName",
5096
+ label: labels2.legalCompanyName,
5097
+ helper: helperText == null ? void 0 : helperText.legalCompanyName,
5098
+ errorMessage: errors.legalCompanyName,
5099
+ isValid: valid.legalCompanyName,
5100
+ classNameModifiers: ["legalCompanyName"],
5034
5101
  children: (childProps) => jsx(InputText, {
5035
5102
  ...childProps,
5036
5103
  "aria-required": true,
5037
- "aria-label": label,
5038
- "aria-invalid": !valid,
5039
- name: LEGAL_COMPANY_NAME_FIELD,
5040
- value: data,
5104
+ "aria-label": labels2.legalCompanyName,
5105
+ "aria-invalid": !valid.legalCompanyName,
5106
+ name: "legalCompanyName",
5107
+ value: data.legalCompanyName,
5041
5108
  readonly,
5042
- classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
5043
- onInput: handleLegalCompanyNameInput,
5044
- onBlur: handleLegalCompanyNameBlur
5109
+ classNameModifiers: ["legalCompanyName"],
5110
+ onInput: handleChangeFor("legalCompanyName", "input"),
5111
+ onBlur: handleChangeFor("legalCompanyName", "blur")
5045
5112
  })
5046
5113
  });
5047
5114
  }
@@ -5084,7 +5151,7 @@ const companyCountryValidationRules = {
5084
5151
  errorMessage: "fieldIsRequired"
5085
5152
  }
5086
5153
  };
5087
- const companyNameAndCountryFields = [LEGAL_COMPANY_NAME_FIELD, COUNTRY_FIELD];
5154
+ const companyNameAndCountryFields = [...LEGAL_COMPANY_NAME_FIELD, ...COUNTRY_FIELD];
5088
5155
  function CompanyNameAndCountry(props) {
5089
5156
  const {
5090
5157
  i18n
@@ -5133,22 +5200,24 @@ function CompanyNameAndCountry(props) {
5133
5200
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
5134
5201
  formUtils,
5135
5202
  id: "ariaErrorField"
5136
- }), formData.country === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
5137
- data: formData.country,
5138
- valid: formValid.country,
5139
- error: formUtils.getErrorMessage(COUNTRY_FIELD, formErrors, formFieldProblems),
5140
- label: formUtils.getLabel(COUNTRY_FIELD),
5203
+ }), formData.country === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField("country") && jsx(CountryField, {
5204
+ data: formUtils.getFieldData(formData, COUNTRY_FIELD),
5205
+ valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
5206
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
5207
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD),
5141
5208
  readonly: !isAllowedEditPrefilledCountry || Boolean(props == null ? void 0 : props.disableCountry),
5142
- classNameModifiers: [COUNTRY_FIELD],
5209
+ classNameModifiers: ["country"],
5143
5210
  allowedCountries: [],
5144
5211
  handleChangeFor
5145
- }), formUtils.isRequiredField(LEGAL_COMPANY_NAME_FIELD) && jsx(LegalCompanyNameField, {
5146
- data: formData.legalCompanyName,
5147
- valid: formValid.legalCompanyName,
5148
- error: formUtils.getErrorMessage(LEGAL_COMPANY_NAME_FIELD, formErrors, formFieldProblems),
5149
- label: formUtils.getLabel(LEGAL_COMPANY_NAME_FIELD),
5150
- helperText: formUtils.getHelperText(LEGAL_COMPANY_NAME_FIELD, "legalCompanyNameHelper"),
5151
- readonly: formUtils.isReadOnly(LEGAL_COMPANY_NAME_FIELD),
5212
+ }), formUtils.isRequiredField("legalCompanyName") && jsx(LegalCompanyNameField, {
5213
+ data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
5214
+ valid: formUtils.getFieldValid(formValid, LEGAL_COMPANY_NAME_FIELD),
5215
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, LEGAL_COMPANY_NAME_FIELD),
5216
+ labels: formUtils.getFieldLabels(LEGAL_COMPANY_NAME_FIELD),
5217
+ helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
5218
+ legalCompanyName: "legalCompanyName__helperText"
5219
+ }),
5220
+ readonly: formUtils.isReadOnly("legalCompanyName"),
5152
5221
  handleChangeFor
5153
5222
  })]
5154
5223
  });
@@ -7860,7 +7929,7 @@ const fieldsPerScenario$3 = {
7860
7929
  const countryConfig$4 = {
7861
7930
  [CountryCodes.Australia]: {
7862
7931
  legalCompanyName: {
7863
- helperText: "legalCompanyNameHelper__AU"
7932
+ helperText: "legalCompanyName__helperText__AU"
7864
7933
  },
7865
7934
  legalEntityType: {
7866
7935
  label: "companyType"
@@ -8056,7 +8125,7 @@ const countryConfig$4 = {
8056
8125
  },
8057
8126
  [CountryCodes.HongKong]: {
8058
8127
  legalCompanyName: {
8059
- helperText: "legalCompanyNameHelper__HK"
8128
+ helperText: "legalCompanyName__helperText__HK"
8060
8129
  },
8061
8130
  legalEntityType: {
8062
8131
  label: "typeOfCompany"
@@ -8215,7 +8284,7 @@ const countryConfig$4 = {
8215
8284
  label: "chamberOfCommerceRegistrationNumber"
8216
8285
  },
8217
8286
  legalCompanyName: {
8218
- helperText: "legalCompanyNameHelper__NL"
8287
+ helperText: "legalCompanyName__helperText__NL"
8219
8288
  },
8220
8289
  exemptedFromVat: {
8221
8290
  label: "vatNumberExempted"
@@ -8255,7 +8324,7 @@ const countryConfig$4 = {
8255
8324
  label: "vatNumberAbsenceReason"
8256
8325
  },
8257
8326
  vatNumber: {
8258
- label: "skattenummer"
8327
+ label: "mvanummer"
8259
8328
  }
8260
8329
  },
8261
8330
  [CountryCodes.Poland]: {
@@ -8346,7 +8415,7 @@ const countryConfig$4 = {
8346
8415
  label: "uen"
8347
8416
  },
8348
8417
  legalCompanyName: {
8349
- helperText: "legalCompanyNameHelper__SG"
8418
+ helperText: "legalCompanyName__helperText__SG"
8350
8419
  },
8351
8420
  legalEntityType: {
8352
8421
  label: "companyType"
@@ -8402,7 +8471,7 @@ const countryConfig$4 = {
8402
8471
  },
8403
8472
  [CountryCodes.UnitedStates]: {
8404
8473
  legalCompanyName: {
8405
- helperText: "legalCompanyNameHelper__US"
8474
+ helperText: "legalCompanyName__helperText__US"
8406
8475
  },
8407
8476
  tradingName: {
8408
8477
  label: "doingBusinessAs"
@@ -8619,14 +8688,14 @@ const rules$3 = ({
8619
8688
  }
8620
8689
  },
8621
8690
  isProofOfResidenceRequired: () => {
8622
- var _a;
8623
- if ((_a = data.proofOfResidence) == null ? void 0 : _a.proofOfResidence) {
8691
+ var _a, _b;
8692
+ if ((_b = (_a = data.proofOfResidence) == null ? void 0 : _a.proofOfResidence) == null ? void 0 : _b.length) {
8624
8693
  return REQUIRED;
8625
8694
  }
8626
8695
  },
8627
8696
  isProofOfNationalIdRequired: () => {
8628
- var _a;
8629
- if ((_a = data.proofOfNationalId) == null ? void 0 : _a.proofOfNationalId) {
8697
+ var _a, _b;
8698
+ if ((_b = (_a = data.proofOfNationalId) == null ? void 0 : _a.proofOfNationalId) == null ? void 0 : _b.length) {
8630
8699
  return REQUIRED;
8631
8700
  }
8632
8701
  },
@@ -9127,6 +9196,8 @@ function bytesToSize(bytes) {
9127
9196
  return `${(bytes / 1024 ** i).toFixed()} ${sizes[i]}`;
9128
9197
  }
9129
9198
  const DropzoneFile$1 = "";
9199
+ const isExistingFile = (file) => "existing" in file && file.existing;
9200
+ const isNewlyUploadedFile = (file) => !isExistingFile(file);
9130
9201
  function DropzoneFile(props) {
9131
9202
  const {
9132
9203
  file,
@@ -9176,7 +9247,7 @@ function DropzoneFile(props) {
9176
9247
  className: "adyen-kyc-dropzone-file__size",
9177
9248
  children: [jsxs("span", {
9178
9249
  children: [i18n.get("complete"), " "]
9179
- }), formatSize(file.size)]
9250
+ }), isNewlyUploadedFile(file) ? formatSize(file.size) : void 0]
9180
9251
  })]
9181
9252
  }), jsx("button", {
9182
9253
  type: "button",
@@ -9196,6 +9267,7 @@ const defaultFileValidationOptions = {
9196
9267
  // 4MB by default
9197
9268
  isOptional: false
9198
9269
  };
9270
+ const filterOnlyNewlyUploadedFiles = (files) => files.filter(isNewlyUploadedFile);
9199
9271
  const fileValidationRules = ({
9200
9272
  allowedFileTypes,
9201
9273
  maxNumberOfFiles,
@@ -9229,7 +9301,7 @@ const fileValidationRules = ({
9229
9301
  validate: (files) => {
9230
9302
  if (!files)
9231
9303
  return true;
9232
- return files.every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
9304
+ return filterOnlyNewlyUploadedFiles(files).every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
9233
9305
  },
9234
9306
  errorMessage: "unsupportedFiletype",
9235
9307
  modes: ["blur", "input"]
@@ -9237,7 +9309,7 @@ const fileValidationRules = ({
9237
9309
  validate: (files) => {
9238
9310
  if (!files)
9239
9311
  return true;
9240
- return files.every((file) => !file.size || file.size < maxSize);
9312
+ return filterOnlyNewlyUploadedFiles(files).every((file) => !file.size || file.size < maxSize);
9241
9313
  },
9242
9314
  errorMessage: "maximumFileSizeExceeded",
9243
9315
  modes: ["blur", "input"]
@@ -9734,12 +9806,11 @@ const mapAddressLabels = (data, datasetUtils) => {
9734
9806
  }
9735
9807
  return data;
9736
9808
  };
9737
- const STATE_FIELD = "stateOrProvince";
9738
9809
  function StateField({
9739
9810
  data,
9740
9811
  valid,
9741
- error,
9742
- label,
9812
+ errors,
9813
+ labels: labels2,
9743
9814
  readonly,
9744
9815
  handleChangeFor,
9745
9816
  selectedCountry,
@@ -9752,30 +9823,24 @@ function StateField({
9752
9823
  dataset: states,
9753
9824
  loaded
9754
9825
  } = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
9755
- const handleStateChangeFor = useCallback((e) => {
9756
- const {
9757
- value
9758
- } = e.target;
9759
- handleChangeFor(STATE_FIELD)(value);
9760
- }, [handleChangeFor]);
9761
- const labelKey = getKeyForField(STATE_FIELD, selectedCountry);
9826
+ const labelKey = getKeyForField("stateOrProvince", selectedCountry);
9762
9827
  const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
9763
9828
  if (!loaded || !states.length)
9764
9829
  return null;
9765
9830
  return jsx(Field, {
9766
- name: STATE_FIELD,
9767
- label: label || i18n.get(labelKey),
9831
+ name: "stateOrProvince",
9832
+ label: (labels2 == null ? void 0 : labels2.stateOrProvince) || i18n.get(labelKey),
9768
9833
  classNameModifiers,
9769
- errorMessage: error,
9770
- isValid: valid,
9834
+ errorMessage: errors.stateOrProvince,
9835
+ isValid: valid.stateOrProvince,
9771
9836
  children: (childProps) => jsx(Select, {
9772
9837
  ...childProps,
9773
- name: STATE_FIELD,
9774
- selected: data,
9838
+ name: "stateOrProvince",
9839
+ selected: data.stateOrProvince,
9775
9840
  placeholder: i18n.get(placeholderKey),
9776
9841
  items: states,
9777
- readonly: readonly && !!data,
9778
- onChange: handleStateChangeFor
9842
+ readonly: readonly && !!data.stateOrProvince,
9843
+ onChange: handleChangeFor("stateOrProvince")
9779
9844
  })
9780
9845
  });
9781
9846
  }
@@ -9804,10 +9869,18 @@ function FieldContainer(props) {
9804
9869
  switch (field) {
9805
9870
  case "country":
9806
9871
  return jsx(CountryField, {
9807
- data: value,
9808
- valid: valid == null ? void 0 : valid.country,
9809
- error: errorMessage,
9810
- label: formUtils.getLabel(field),
9872
+ data: {
9873
+ country: value
9874
+ },
9875
+ valid: {
9876
+ country: valid == null ? void 0 : valid.country
9877
+ },
9878
+ errors: {
9879
+ country: errorMessage
9880
+ },
9881
+ labels: {
9882
+ country: formUtils.getLabel(field)
9883
+ },
9811
9884
  readonly: formUtils.isReadOnly(field),
9812
9885
  classNameModifiers,
9813
9886
  allowedCountries,
@@ -9816,10 +9889,18 @@ function FieldContainer(props) {
9816
9889
  });
9817
9890
  case "stateOrProvince":
9818
9891
  return jsx(StateField, {
9819
- data: value,
9820
- valid: valid == null ? void 0 : valid.stateOrProvince,
9821
- error: errorMessage,
9822
- label: formUtils.getLabel(field),
9892
+ data: {
9893
+ stateOrProvince: value
9894
+ },
9895
+ valid: {
9896
+ stateOrProvince: valid == null ? void 0 : valid.stateOrProvince
9897
+ },
9898
+ errors: {
9899
+ stateOrProvince: errorMessage
9900
+ },
9901
+ labels: {
9902
+ stateOrProvince: formUtils.getLabel(field)
9903
+ },
9823
9904
  readonly: formUtils.isReadOnly(field),
9824
9905
  classNameModifiers,
9825
9906
  selectedCountry: data.country,
@@ -10689,7 +10770,8 @@ function RegistrationAddressComponent(props) {
10689
10770
  heading,
10690
10771
  description: description2,
10691
10772
  handleAddressSearch,
10692
- handleFindAddress
10773
+ handleFindAddress,
10774
+ optionalFields
10693
10775
  } = props;
10694
10776
  const {
10695
10777
  data: formData,
@@ -10702,7 +10784,8 @@ function RegistrationAddressComponent(props) {
10702
10784
  schema: ["operationalAddressIsSame"],
10703
10785
  defaultData: data,
10704
10786
  rules: validators || registrationAddressValidationRules,
10705
- maskedFields: []
10787
+ maskedFields: [],
10788
+ optionalFields
10706
10789
  });
10707
10790
  const formUtils = formUtilities(props, i18n);
10708
10791
  const stateRef = useRef({
@@ -11079,9 +11162,10 @@ const createDocumentRequest = async ({
11079
11162
  description: description2,
11080
11163
  existingDocument
11081
11164
  }) => {
11082
- const promises = [fileToBase64(page1), fileToBase64(page2)].filter(Boolean);
11083
- const [encodedFront, encodedBack] = await Promise.all(promises);
11084
- if (!encodedFront) {
11165
+ const pagesToUpload = [page1, page2].filter((page) => page !== void 0 && isNewlyUploadedFile(page));
11166
+ const [page1ToUpload, page2ToUpload] = pagesToUpload;
11167
+ const [encodedPage1, encodedPage2] = await Promise.all(pagesToUpload.map(fileToBase64));
11168
+ if (!encodedPage1) {
11085
11169
  if (existingDocument && existingDocument.description !== description2) {
11086
11170
  return {
11087
11171
  owner: {
@@ -11101,7 +11185,7 @@ const createDocumentRequest = async ({
11101
11185
  },
11102
11186
  type: documentType2,
11103
11187
  description: description2 || `Document type: ${documentType2}`,
11104
- attachments: [...page1 && page2 && encodedFront && encodedBack ? [createAttachment(encodedFront, page1.name, "front"), createAttachment(encodedBack, page2.name, "back")] : [createAttachment(encodedFront, page1.name)]]
11188
+ attachments: [...page1ToUpload && page2ToUpload && encodedPage1 && encodedPage2 ? [createAttachment(encodedPage1, page1ToUpload.name, "front"), createAttachment(encodedPage2, page2ToUpload.name, "back")] : [createAttachment(encodedPage1, page1ToUpload.name)]]
11105
11189
  };
11106
11190
  };
11107
11191
  const createAttachment = (content, pageName, pageType) => ({
@@ -11122,15 +11206,10 @@ const hasDocumentChanged = (newDocument, entityId) => {
11122
11206
  return true;
11123
11207
  };
11124
11208
  const fileToBase64 = (file) => new Promise((resolve, reject) => {
11125
- if (!file || !(file instanceof Blob)) {
11126
- resolve();
11127
- return;
11128
- }
11129
11209
  const reader = new FileReader();
11130
11210
  reader.readAsDataURL(file);
11131
11211
  reader.onload = () => {
11132
- var _a;
11133
- const base64String = (_a = reader.result) == null ? void 0 : _a.toString().split(";base64,")[1];
11212
+ const base64String = reader.result.toString().split(";base64,")[1];
11134
11213
  resolve(base64String);
11135
11214
  };
11136
11215
  reader.onerror = (error) => reject(error);
@@ -11529,10 +11608,17 @@ const isPartOfTrustFromLegalEntity = (legalEntity) => {
11529
11608
  var _a;
11530
11609
  return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
11531
11610
  };
11611
+ const getRootTrusteeLegalEntityId = (trustEntity) => {
11612
+ var _a;
11613
+ if (!trustEntity.entityAssociations)
11614
+ return "";
11615
+ return (_a = trustEntity.entityAssociations.filter((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)[0]) == null ? void 0 : _a.legalEntityId;
11616
+ };
11532
11617
  const getOwnTrustMembers = (trustEntity) => {
11533
11618
  if (!trustEntity.entityAssociations)
11534
11619
  return [];
11535
- return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && entityAssociation.associatorId === trustEntity.id);
11620
+ const rootTrusteeLegalEntityId = getRootTrusteeLegalEntityId(trustEntity);
11621
+ return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && rootTrusteeLegalEntityId === (entityAssociation == null ? void 0 : entityAssociation.associatorId));
11536
11622
  };
11537
11623
  const getOwnTrustMembersLegalEntityIds = (legalEntity) => getOwnTrustMembers(legalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11538
11624
  const getOwnTrustLegalEntityId = (legalEntity) => {
@@ -12390,6 +12476,10 @@ const mapIndividualDocumentToApiDocument = async (data, entityId) => {
12390
12476
  return documents2.filter(Boolean);
12391
12477
  }
12392
12478
  };
12479
+ const mapExistingFile = (name) => ({
12480
+ name,
12481
+ existing: true
12482
+ });
12393
12483
  const mapApiIdDocumentToSchema = (idDocument2) => {
12394
12484
  const {
12395
12485
  hasBackPage
@@ -12400,14 +12490,10 @@ const mapApiIdDocumentToSchema = (idDocument2) => {
12400
12490
  const backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12401
12491
  return {
12402
12492
  ...frontPage2 ? {
12403
- idFrontPage: [{
12404
- name: frontPage2.pageName
12405
- }]
12493
+ idFrontPage: [mapExistingFile(frontPage2.pageName)]
12406
12494
  } : {},
12407
12495
  ...backPage2 ? {
12408
- idBackPage: [{
12409
- name: backPage2.pageName
12410
- }]
12496
+ idBackPage: [mapExistingFile(backPage2.pageName)]
12411
12497
  } : {},
12412
12498
  idDocumentType: idDocument2.type
12413
12499
  };
@@ -12418,12 +12504,12 @@ const mapApiDocumentToIndividualDocuments = (entityId) => {
12418
12504
  const proofOfNationalId2 = getDocument$1(entityId, DocumentType.PROOF_OF_NATIONAL_ID_NUMBER) || null;
12419
12505
  return {
12420
12506
  idDocument: idDocument2 ? mapApiIdDocumentToSchema(idDocument2) : null,
12421
- proofOfResidence: proofOfResidence2 ? [{
12422
- name: getPageName(proofOfResidence2)
12423
- }] : null,
12424
- proofOfNationalId: proofOfNationalId2 ? [{
12425
- name: getPageName(proofOfNationalId2)
12426
- }] : null
12507
+ proofOfResidence: proofOfResidence2 ? {
12508
+ proofOfResidence: [mapExistingFile(getPageName(proofOfResidence2))]
12509
+ } : null,
12510
+ proofOfNationalId: proofOfNationalId2 ? {
12511
+ proofOfNationalId: [mapExistingFile(getPageName(proofOfNationalId2))]
12512
+ } : null
12427
12513
  };
12428
12514
  };
12429
12515
  const mapCompanyDocumentToApiDocument = async (data, entityId) => {
@@ -12460,14 +12546,10 @@ const mapApiDocumentToCompanyDocuments = (entityId) => {
12460
12546
  const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
12461
12547
  return {
12462
12548
  companyRegistrationDocument: registrationDocument2 ? {
12463
- registrationDocument: [{
12464
- name: getPageName(registrationDocument2)
12465
- }]
12549
+ registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
12466
12550
  } : null,
12467
12551
  companyTaxDocument: taxDocument2 ? {
12468
- taxDocument: [{
12469
- name: getPageName(taxDocument2)
12470
- }]
12552
+ taxDocument: [mapExistingFile(getPageName(taxDocument2))]
12471
12553
  } : null
12472
12554
  };
12473
12555
  };
@@ -12487,9 +12569,7 @@ const mapApiDocumentToTrustDocument = (entityId) => {
12487
12569
  const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12488
12570
  return {
12489
12571
  trustConstitutionalDocument: constitutionalDocument2 ? {
12490
- constitutionalDocument: [{
12491
- name: getPageName(constitutionalDocument2)
12492
- }]
12572
+ constitutionalDocument: [mapExistingFile(getPageName(constitutionalDocument2))]
12493
12573
  } : null
12494
12574
  };
12495
12575
  };
@@ -12509,9 +12589,7 @@ const mapApiDocumentToSolePropDocuments = (entityId) => {
12509
12589
  const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12510
12590
  return {
12511
12591
  solePropConstitutionalDocument: constitutionalDocument2 ? {
12512
- constitutionalDocument: [{
12513
- name: getPageName(constitutionalDocument2)
12514
- }]
12592
+ constitutionalDocument: [mapExistingFile(getPageName(constitutionalDocument2))]
12515
12593
  } : null
12516
12594
  };
12517
12595
  };
@@ -12538,9 +12616,7 @@ const mapPayoutDocumentsToApiDocuments = async (data, entityId) => {
12538
12616
  const mapApiDocumentToPayoutDocuments = (entityId) => {
12539
12617
  const bankStatement2 = getDocument$1(entityId, DocumentType.BANK_STATEMENT) || null;
12540
12618
  return {
12541
- bankStatementDocument: bankStatement2 ? [{
12542
- name: getPageName(bankStatement2)
12543
- }] : null,
12619
+ bankStatementDocument: bankStatement2 ? [mapExistingFile(getPageName(bankStatement2))] : null,
12544
12620
  description: bankStatement2.description
12545
12621
  };
12546
12622
  };
@@ -12633,27 +12709,21 @@ function IdDocumentManualUploadComponent(props) {
12633
12709
  const document2 = idDocumentType ? getDocument$1(props.legalEntityId, idDocumentType) : void 0;
12634
12710
  if (!document2) {
12635
12711
  setIdFrontPage({
12636
- idFrontPage: null
12712
+ idFrontPage: void 0
12637
12713
  });
12638
12714
  setIdBackPage({
12639
- idBackPage: null
12715
+ idBackPage: void 0
12640
12716
  });
12641
12717
  } else if (hasBackPage(idDocumentType)) {
12642
12718
  setIdFrontPage({
12643
- idFrontPage: [{
12644
- name: getPageName(document2, "front")
12645
- }]
12719
+ idFrontPage: [mapExistingFile(getPageName(document2, "front"))]
12646
12720
  });
12647
12721
  setIdBackPage({
12648
- idBackPage: [{
12649
- name: getPageName(document2, "back")
12650
- }]
12722
+ idBackPage: [mapExistingFile(getPageName(document2, "back"))]
12651
12723
  });
12652
12724
  } else {
12653
12725
  setIdFrontPage({
12654
- idFrontPage: [{
12655
- name: getPageName(document2)
12656
- }]
12726
+ idFrontPage: [mapExistingFile(getPageName(document2))]
12657
12727
  });
12658
12728
  }
12659
12729
  }
@@ -12755,7 +12825,7 @@ const useIdVerificationToken = ({
12755
12825
  lastName: lastName2,
12756
12826
  residencyCountry: residencyCountry2
12757
12827
  } = userDetails;
12758
- const [sdkToken, setSdkToken] = useState();
12828
+ const [sdkToken2, setSdkToken2] = useState();
12759
12829
  const [loadingStatus, setLoadingStatus] = useState();
12760
12830
  const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
12761
12831
  useEffect(() => {
@@ -12781,9 +12851,9 @@ const useIdVerificationToken = ({
12781
12851
  // Do not include legalEntityId if we don't know yet. Eg.: decision-makers flow the associated legalEntityId.
12782
12852
  };
12783
12853
  const {
12784
- sdkToken: sdkToken2
12854
+ sdkToken: sdkToken22
12785
12855
  } = await handleGetIdVerificationToken("", data);
12786
- setSdkToken(sdkToken2);
12856
+ setSdkToken2(sdkToken22);
12787
12857
  } catch (e) {
12788
12858
  onIdVerificationError == null ? void 0 : onIdVerificationError(e);
12789
12859
  } finally {
@@ -12792,7 +12862,7 @@ const useIdVerificationToken = ({
12792
12862
  })().catch(console.error);
12793
12863
  }, [firstName2, lastName2, residencyCountry2, hasAllUserDetails]);
12794
12864
  return {
12795
- sdkToken,
12865
+ sdkToken: sdkToken2,
12796
12866
  loadingStatus
12797
12867
  };
12798
12868
  };
@@ -13336,7 +13406,7 @@ function IdVerificationComponent({
13336
13406
  i18n
13337
13407
  } = useI18nContext();
13338
13408
  const {
13339
- sdkToken,
13409
+ sdkToken: sdkToken2,
13340
13410
  loadingStatus
13341
13411
  } = useIdVerificationToken({
13342
13412
  userDetails,
@@ -13347,10 +13417,10 @@ function IdVerificationComponent({
13347
13417
  const onfidoSdk = useRef();
13348
13418
  useEffect(() => {
13349
13419
  (async () => {
13350
- if (!sdkToken)
13420
+ if (!sdkToken2)
13351
13421
  return;
13352
13422
  onfidoSdk.current = await initOnfido({
13353
- token: sdkToken,
13423
+ token: sdkToken2,
13354
13424
  i18n,
13355
13425
  onIdVerificationClose,
13356
13426
  onIdVerificationError,
@@ -13361,7 +13431,7 @@ function IdVerificationComponent({
13361
13431
  if (onfidoSdk.current)
13362
13432
  onfidoSdk.current.tearDown();
13363
13433
  };
13364
- }, [sdkToken]);
13434
+ }, [sdkToken2]);
13365
13435
  useEffect(() => {
13366
13436
  if (!onfidoSdk.current)
13367
13437
  return;
@@ -15652,10 +15722,18 @@ function PersonalDetailsComponent(props) {
15652
15722
  max: formatDateObj(/* @__PURE__ */ new Date())
15653
15723
  })
15654
15724
  }), formUtils.isRequiredField("residencyCountry") && jsx(CountryField, {
15655
- data: data.residencyCountry,
15656
- valid: valid == null ? void 0 : valid.residencyCountry,
15657
- error: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems),
15658
- label: formUtils.getLabel("residencyCountry"),
15725
+ data: {
15726
+ country: data.residencyCountry
15727
+ },
15728
+ valid: {
15729
+ country: valid.residencyCountry
15730
+ },
15731
+ errors: {
15732
+ country: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems)
15733
+ },
15734
+ labels: {
15735
+ country: formUtils.getLabel("residencyCountry")
15736
+ },
15659
15737
  readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask,
15660
15738
  allowedCountries: [],
15661
15739
  classNameModifiers: ["country"],
@@ -15665,10 +15743,18 @@ function PersonalDetailsComponent(props) {
15665
15743
  country: data.residencyCountry,
15666
15744
  errors: externalErrors
15667
15745
  }), (data.residencyCountry === "SG" || data.residencyCountry === "HK") && formUtils.isRequiredField("nationality") && jsx(CountryField, {
15668
- data: data.nationality,
15669
- valid: valid == null ? void 0 : valid.nationality,
15670
- error: formUtils.getErrorMessage("nationality", errors, fieldProblems),
15671
- label: formUtils.getLabel("nationality"),
15746
+ data: {
15747
+ country: data.nationality
15748
+ },
15749
+ valid: {
15750
+ country: valid.nationality
15751
+ },
15752
+ errors: {
15753
+ country: formUtils.getErrorMessage("nationality", errors, fieldProblems)
15754
+ },
15755
+ labels: {
15756
+ country: formUtils.getLabel("nationality")
15757
+ },
15672
15758
  readonly: formUtils.isReadOnly("nationality"),
15673
15759
  classNameModifiers: ["nationality"],
15674
15760
  handleChangeFor: () => handleChangeFor("nationality", "input")
@@ -16162,6 +16248,29 @@ class AdyenKycSdkError extends Error {
16162
16248
  this.stack = stack.join("\n");
16163
16249
  }
16164
16250
  }
16251
+ let sdkToken;
16252
+ let fetchSdkToken;
16253
+ const logger$e = createLogger("Session");
16254
+ const setSdkToken = (token) => {
16255
+ sdkToken = token;
16256
+ };
16257
+ const setSdkTokenHandler = (handler) => {
16258
+ fetchSdkToken = handler;
16259
+ };
16260
+ const getSdkToken = () => sdkToken;
16261
+ const refreshSession = async () => {
16262
+ if (!fetchSdkToken) {
16263
+ throw Error("Not able to extend session, fetch handler not provided ");
16264
+ }
16265
+ try {
16266
+ const {
16267
+ token
16268
+ } = await fetchSdkToken();
16269
+ setSdkToken(token);
16270
+ } catch (e) {
16271
+ logger$e.error("Failed to fetch sdk token", e);
16272
+ }
16273
+ };
16165
16274
  const OpenBankingSDKStyles = "";
16166
16275
  const WIDGET_IFRAME_CLASS$1 = "adyen-open-banking-sdk-widget";
16167
16276
  const WIDGET_CONTAINER_CLASS$1 = `${WIDGET_IFRAME_CLASS$1}-container`;
@@ -16227,17 +16336,18 @@ const removeAnimationStartListener = (element, listener) => {
16227
16336
  element.removeEventListener("MSAnimationStart", listener, false);
16228
16337
  element.removeEventListener("webkitAnimationStart", listener, false);
16229
16338
  };
16230
- const logger$e = createLogger("Fetch");
16339
+ const logger$d = createLogger("Fetch");
16231
16340
  const getRequestObject = (options, data) => {
16232
16341
  const {
16233
16342
  headers = [],
16234
16343
  method = "GET",
16235
- sdkToken
16344
+ authentication
16236
16345
  } = options;
16237
16346
  let authHeaders;
16238
- if (options.sdkToken) {
16347
+ if (authentication === "jwt") {
16348
+ const sdkToken2 = getSdkToken();
16239
16349
  authHeaders = {
16240
- Authorization: `Bearer ${sdkToken}`,
16350
+ Authorization: `Bearer ${sdkToken2}`,
16241
16351
  Origin: window.location.origin
16242
16352
  };
16243
16353
  }
@@ -16273,10 +16383,10 @@ const logFetchError = (message, level) => {
16273
16383
  case "info":
16274
16384
  case "warn":
16275
16385
  case "error":
16276
- logger$e[level](message);
16386
+ logger$d[level](message);
16277
16387
  break;
16278
16388
  default:
16279
- logger$e.error(message);
16389
+ logger$d.error(message);
16280
16390
  }
16281
16391
  };
16282
16392
  const handleFetchResponse = async (response, responseType) => {
@@ -16292,6 +16402,7 @@ const handleFetchResponse = async (response, responseType) => {
16292
16402
  }
16293
16403
  };
16294
16404
  const isValidationErrorResponse = (response) => (response == null ? void 0 : response.status) === 422;
16405
+ const isSessionExpiredResponse = (response) => (response == null ? void 0 : response.status) === 401;
16295
16406
  const processValidationErrors$1 = async (response) => {
16296
16407
  const responseData = await response.json();
16297
16408
  throw new ValidationError(responseData.errorCode, responseData);
@@ -16313,6 +16424,7 @@ const http = async (options, data, responseType = "json") => {
16313
16424
  } = options;
16314
16425
  const request = getRequestObject(options, data);
16315
16426
  const url = getRequestUrl(loadingContext, path, clientKey);
16427
+ const needsAuthGuard = options.authentication === "jwt";
16316
16428
  let response;
16317
16429
  try {
16318
16430
  response = await fetch(url, request);
@@ -16335,6 +16447,10 @@ const http = async (options, data, responseType = "json") => {
16335
16447
  if (isValidationErrorResponse(response)) {
16336
16448
  return processValidationErrors$1(response);
16337
16449
  }
16450
+ if (needsAuthGuard && isSessionExpiredResponse(response)) {
16451
+ await refreshSession();
16452
+ return http(options, data, responseType);
16453
+ }
16338
16454
  logFetchError(errorMessage, errorLevel);
16339
16455
  throw new Error(errorMessage);
16340
16456
  };
@@ -16359,7 +16475,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
16359
16475
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
16360
16476
  const MOUNT_TIMEOUT = 10 * 1e3;
16361
16477
  const TINK_VENDOR = "Tink";
16362
- const logger$d = createLogger("iframeWidget");
16478
+ const logger$c = createLogger("iframeWidget");
16363
16479
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
16364
16480
  const isTerminalMessageData = (data) => Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
16365
16481
  const parseMessageJson = (message) => {
@@ -16378,7 +16494,7 @@ const callbackErrorHandler = async (response) => {
16378
16494
  try {
16379
16495
  await response;
16380
16496
  } catch (ex) {
16381
- logger$d.error(ex);
16497
+ logger$c.error(ex);
16382
16498
  }
16383
16499
  return {
16384
16500
  error: "UNKNOWN_ERROR",
@@ -16387,7 +16503,7 @@ const callbackErrorHandler = async (response) => {
16387
16503
  };
16388
16504
  let activeWidget;
16389
16505
  class IFrameWidget {
16390
- constructor(iframeElement, url, vendor, sdkToken) {
16506
+ constructor(iframeElement, url, vendor, sdkToken2) {
16391
16507
  this.mountInProgress = false;
16392
16508
  this.waitForResponse = async () => new Promise((resolve, reject) => {
16393
16509
  this.listener = async (message) => {
@@ -16410,7 +16526,7 @@ class IFrameWidget {
16410
16526
  this.iframeElement = iframeElement;
16411
16527
  this.iframeWindow = iframeElement.contentWindow;
16412
16528
  this.vendor = vendor;
16413
- this.sdkToken = sdkToken;
16529
+ this.sdkToken = sdkToken2;
16414
16530
  }
16415
16531
  removeMessageEventListener() {
16416
16532
  if (!this.listener)
@@ -16484,7 +16600,7 @@ class IFrameWidget {
16484
16600
  message = responseData.errorMessage;
16485
16601
  }
16486
16602
  } catch (ex) {
16487
- logger$d.error(ex);
16603
+ logger$c.error(ex);
16488
16604
  }
16489
16605
  throw new AdyenKycSdkError(reason, jsonData.error);
16490
16606
  }
@@ -16570,7 +16686,7 @@ function BankVerificationWidget({
16570
16686
  const {
16571
16687
  isEmbeddedDropin
16572
16688
  } = context;
16573
- const sdkToken = isEmbeddedDropin ? context.sdkToken : void 0;
16689
+ const sdkToken2 = isEmbeddedDropin ? getSdkToken() : void 0;
16574
16690
  useEffect(
16575
16691
  () => {
16576
16692
  const container = widgetContainerRef.current;
@@ -16613,7 +16729,7 @@ function BankVerificationWidget({
16613
16729
  requestAnimationFrame(async () => {
16614
16730
  var _a, _b;
16615
16731
  try {
16616
- iFrameWidget = new IFrameWidget(iFrame, url, vendor, sdkToken);
16732
+ iFrameWidget = new IFrameWidget(iFrame, url, vendor, sdkToken2);
16617
16733
  const result = await iFrameWidget.mountAndWaitForResponse();
16618
16734
  widgetCallback({
16619
16735
  action: "verification_success",
@@ -16670,7 +16786,7 @@ function BankVerificationWidget({
16670
16786
  ref: widgetContainerRef
16671
16787
  });
16672
16788
  }
16673
- const logger$c = createLogger("BankVerification");
16789
+ const logger$b = createLogger("BankVerification");
16674
16790
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
16675
16791
  const InstantVerificationErrorContext = createContext(null);
16676
16792
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -16704,7 +16820,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
16704
16820
  const preferredVendor2 = vendors[0];
16705
16821
  setPreferredVendor(preferredVendor2.name ? preferredVendor2 : null);
16706
16822
  };
16707
- getPreferredVendor().catch(logger$c.error);
16823
+ getPreferredVendor().catch(logger$b.error);
16708
16824
  }, [country2, getBankVerificationVendors]);
16709
16825
  return preferredVendor;
16710
16826
  };
@@ -16980,6 +17096,7 @@ function BankAccountFormat(props) {
16980
17096
  var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
16981
17097
  ExperimentNames2["EnableTrustFlow"] = "EnableTrustFlow";
16982
17098
  ExperimentNames2["OnlyAllowAlphanumericBankAccountNumbers"] = "OnlyAllowAlphanumericBankAccountNumbers";
17099
+ ExperimentNames2["OrganizationSettlorWithExemptionReason"] = "OrganizationSettlorWithExemptionReason";
16983
17100
  return ExperimentNames2;
16984
17101
  })(ExperimentNames || {});
16985
17102
  const stripNonAlphanumeric = (value) => value.replaceAll(/[^0-9a-zA-Z]/g, "");
@@ -18278,15 +18395,25 @@ function PayoutVerificationMethod(props) {
18278
18395
  }
18279
18396
  })]
18280
18397
  }), jsx(CountryField, {
18281
- data: data.bankCountry,
18282
- valid: valid == null ? void 0 : valid.bankCountry,
18283
- error: formUtils.getErrorMessage("bankCountry", errors, fieldProblems),
18284
- label: formUtils.getLabel("bankCountry", "bankAccountCountry"),
18398
+ data: {
18399
+ country: data.bankCountry
18400
+ },
18401
+ valid: {
18402
+ country: valid == null ? void 0 : valid.bankCountry
18403
+ },
18404
+ errors: {
18405
+ country: formUtils.getErrorMessage("bankCountry", errors, fieldProblems)
18406
+ },
18407
+ labels: {
18408
+ country: formUtils.getLabel("bankCountry", "bankAccountCountry")
18409
+ },
18285
18410
  readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
18286
18411
  allowedCountries: allowedBankCountries,
18287
18412
  classNameModifiers: ["country"],
18288
18413
  handleChangeFor: () => handleChangeFor("bankCountry", "input"),
18289
- helperText: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18414
+ helperText: {
18415
+ country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18416
+ }
18290
18417
  }), jsx(Field, {
18291
18418
  name: "verificationMethods",
18292
18419
  label: formUtils.getLabel("payoutVerificationMethod", "verificationMethod"),
@@ -18783,14 +18910,16 @@ function TrustRegistrationDetailsComponent(props) {
18783
18910
  id: "ariaErrorField"
18784
18911
  }), jsx(ContextHelper, {
18785
18912
  content: i18n.get("makeSureToHaveYourTrustDeed")
18786
- }), formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
18787
- data: country2,
18788
- valid: valid == null ? void 0 : valid.country,
18789
- error: formUtils.getErrorMessage(COUNTRY_FIELD, errors, fieldProblems),
18790
- label: formUtils.getLabel(COUNTRY_FIELD, "countryOfEstablishment"),
18791
- readonly: formUtils.isReadOnly(COUNTRY_FIELD),
18913
+ }), formUtils.isRequiredField("country") && jsx(CountryField, {
18914
+ data: formUtils.getFieldData(data, COUNTRY_FIELD),
18915
+ valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
18916
+ errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
18917
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
18918
+ country: "countryOfEstablishment"
18919
+ }),
18920
+ readonly: formUtils.isReadOnly("country"),
18792
18921
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
18793
- classNameModifiers: [COUNTRY_FIELD],
18922
+ classNameModifiers: ["country"],
18794
18923
  handleChangeFor: () => (e) => {
18795
18924
  handleChangeFor("country", "input")(e);
18796
18925
  if (onCountryChange)
@@ -19891,7 +20020,7 @@ const defaultPayoutAccountFormat = {
19891
20020
  [CountryCodes.Sweden]: "local",
19892
20021
  [CountryCodes.UnitedKingdom]: "local"
19893
20022
  };
19894
- const logger$b = createLogger("useScenarioConfiguration");
20023
+ const logger$a = createLogger("useScenarioConfiguration");
19895
20024
  const useScenarioConfiguration = ({
19896
20025
  getConfigurationData,
19897
20026
  getPayoutAccountFormatData,
@@ -19913,12 +20042,12 @@ const useScenarioConfiguration = ({
19913
20042
  const response = await getConfigurationData();
19914
20043
  setConfigurationResponse(response);
19915
20044
  } catch (err) {
19916
- logger$b.warn("WARNING: Configuration request failed - error:", err);
20045
+ logger$a.warn("WARNING: Configuration request failed - error:", err);
19917
20046
  } finally {
19918
20047
  setLoadingStatus("success");
19919
20048
  }
19920
20049
  };
19921
- makeConfigCallAndSave().catch(logger$b.error);
20050
+ makeConfigCallAndSave().catch(logger$a.error);
19922
20051
  }, [getConfigurationData, setLoadingStatus]);
19923
20052
  useEffect(() => {
19924
20053
  setLoadingStatus("loading");
@@ -19934,12 +20063,12 @@ const useScenarioConfiguration = ({
19934
20063
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
19935
20064
  setAccountFormat(defaultAccountFormat);
19936
20065
  } catch (err) {
19937
- logger$b.warn("WARNING: Payout format request failed - error:", err);
20066
+ logger$a.warn("WARNING: Payout format request failed - error:", err);
19938
20067
  } finally {
19939
20068
  setLoadingStatus("success");
19940
20069
  }
19941
20070
  };
19942
- makePayoutFormatCallAndSave().catch(logger$b.error);
20071
+ makePayoutFormatCallAndSave().catch(logger$a.error);
19943
20072
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus]);
19944
20073
  const {
19945
20074
  fieldConfigurations,
@@ -20106,7 +20235,7 @@ const countryConfig$1 = {
20106
20235
  placeholder: "SSNFormatUS"
20107
20236
  },
20108
20237
  idNumberExempt: {
20109
- label: "uploadDocumentForSsn"
20238
+ label: "identityNumberExempt__US"
20110
20239
  }
20111
20240
  },
20112
20241
  CA: {
@@ -20115,7 +20244,7 @@ const countryConfig$1 = {
20115
20244
  placeholder: "SINFormatCA"
20116
20245
  },
20117
20246
  idNumberExempt: {
20118
- label: "uploadDocumentForSsn"
20247
+ label: "identityNumberExempt__CA"
20119
20248
  }
20120
20249
  },
20121
20250
  IT: {
@@ -20595,7 +20724,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
20595
20724
  return ToastType2;
20596
20725
  })(ToastType || {});
20597
20726
  const FormComposer = "";
20598
- const logger$a = createLogger("FormRouterContextProvider");
20727
+ const logger$9 = createLogger("FormRouterContextProvider");
20599
20728
  function FormRouterContextProvider({
20600
20729
  children,
20601
20730
  forms,
@@ -20615,7 +20744,7 @@ function FormRouterContextProvider({
20615
20744
  if (formIndex > -1) {
20616
20745
  setFormIndex(formIndex);
20617
20746
  } else {
20618
- logger$a.error("No form was found to have that field so form navigation failed.");
20747
+ logger$9.error("No form was found to have that field so form navigation failed.");
20619
20748
  }
20620
20749
  }
20621
20750
  }), [forms, handleGetIdVerificationToken, setFormIndex]);
@@ -20859,16 +20988,18 @@ const canSubmit = (data) => mandatoryApiFields.ORGANIZATION.every((detail) => {
20859
20988
  });
20860
20989
  const isDocumentsRequired = (forms) => forms.some((form) => [companyForms.companyRegistrationDocument.formId, companyForms.companyTaxDocument.formId].includes(form.formId));
20861
20990
  const formatFileSummaryData = (companyRegistrationDocument2, companyTaxDocument) => {
20862
- var _a, _b, _c, _d;
20991
+ var _a, _b;
20992
+ const registrationDocument2 = (_a = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0];
20993
+ const taxDocument2 = (_b = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _b[0];
20863
20994
  return {
20864
- ...(companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) && {
20995
+ ...registrationDocument2 && {
20865
20996
  companyRegistrationDocument: {
20866
- fileName: (_b = (_a = companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
20997
+ fileName: registrationDocument2.name
20867
20998
  }
20868
20999
  },
20869
- ...(companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) && {
21000
+ ...taxDocument2 && {
20870
21001
  companyTaxDocument: {
20871
- fileName: (_d = (_c = companyTaxDocument.taxDocument) == null ? void 0 : _c[0]) == null ? void 0 : _d.name
21002
+ fileName: taxDocument2.name
20872
21003
  }
20873
21004
  }
20874
21005
  };
@@ -21212,7 +21343,7 @@ function CompanyDropinComponent({
21212
21343
  })
21213
21344
  });
21214
21345
  }
21215
- const logger$9 = createLogger("useLocalStorage");
21346
+ const logger$8 = createLogger("useLocalStorage");
21216
21347
  function useLocalStorage(key, defaultValue, options) {
21217
21348
  const {
21218
21349
  serializer,
@@ -21233,7 +21364,7 @@ function useLocalStorage(key, defaultValue, options) {
21233
21364
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
21234
21365
  return res;
21235
21366
  } catch (err) {
21236
- logger$9.error(err);
21367
+ logger$8.error(err);
21237
21368
  return defaultValue;
21238
21369
  }
21239
21370
  });
@@ -21265,7 +21396,7 @@ function useLocalStorage(key, defaultValue, options) {
21265
21396
  try {
21266
21397
  updateLocalStorage();
21267
21398
  } catch (err) {
21268
- logger$9.error(err);
21399
+ logger$8.error(err);
21269
21400
  }
21270
21401
  }, [value]);
21271
21402
  useEffect(() => {
@@ -21280,7 +21411,7 @@ function useLocalStorage(key, defaultValue, options) {
21280
21411
  setValue(event.newValue ? parser(event.newValue) : void 0);
21281
21412
  }
21282
21413
  } catch (err) {
21283
- logger$9.error(err);
21414
+ logger$8.error(err);
21284
21415
  }
21285
21416
  };
21286
21417
  if (typeof window === "undefined")
@@ -21316,7 +21447,7 @@ const useShouldShowIntro = (legalEntity) => {
21316
21447
  } = useHasSeenIntro(legalEntity.id);
21317
21448
  return canSeeIntro && !hasSeenIntro;
21318
21449
  };
21319
- const logger$8 = createLogger("useExemptSettlor");
21450
+ const logger$7 = createLogger("useExemptSettlor");
21320
21451
  const useExemptSettlor = ({
21321
21452
  trust,
21322
21453
  handleGetLegalEntity
@@ -21328,7 +21459,7 @@ const useExemptSettlor = ({
21328
21459
  setExemptSettlor(exemptSettlorLE);
21329
21460
  }, [handleGetLegalEntity]);
21330
21461
  useEffect(() => {
21331
- updateExemptSettlor(trust).catch(logger$8.error);
21462
+ updateExemptSettlor(trust).catch(logger$7.error);
21332
21463
  }, [trust, updateExemptSettlor]);
21333
21464
  return exemptSettlor;
21334
21465
  };
@@ -21435,15 +21566,17 @@ const getFallbackName = (exemptSettlorAssociation) => {
21435
21566
  };
21436
21567
  const convertEntityAssociationIntoTrustMember = (association, associations, exemptSettlorLE) => {
21437
21568
  var _a;
21438
- if (association.settlorExemptionReason)
21569
+ if (association.settlorExemptionReason) {
21439
21570
  return {
21440
21571
  trustMemberType: "exemptSettlor",
21441
21572
  roles: [TrustMemberTypes.SETTLOR],
21442
- legalEntityType: LegalEntityType.INDIVIDUAL,
21573
+ legalEntityType: association.entityType,
21443
21574
  legalEntityId: association.legalEntityId,
21444
21575
  settlorExemptionReason: association.settlorExemptionReason,
21445
- exemptSettlorName: ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association)
21576
+ exemptSettlorName: association.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association) : void 0,
21577
+ name: association.name
21446
21578
  };
21579
+ }
21447
21580
  if (association.entityType === LegalEntityType.ORGANIZATION)
21448
21581
  return {
21449
21582
  trustMemberType: "company",
@@ -21499,6 +21632,7 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
21499
21632
  return [mapRootLegalEntityToTrustMember(rootLegalEntity), ...mapEntityAssociationsToTrustMembers(trustLE.id, trustLE.entityAssociations ?? [], exemptSettlorLE), ...mapUndefinedBeneficiaryInfoToTrustMembers(((_a = trustLE.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [])];
21500
21633
  };
21501
21634
  const mapTrustMemberToEntityAssociations = (trustMember) => {
21635
+ var _a, _b;
21502
21636
  if (trustMember.legalEntityId === isNewEntity) {
21503
21637
  throw Error("Cannot map a new trust member, you must create it first");
21504
21638
  }
@@ -21508,7 +21642,7 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
21508
21642
  entityType: trustMember.legalEntityType,
21509
21643
  type: TrustMemberTypes.SETTLOR,
21510
21644
  settlorExemptionReason: trustMember.settlorExemptionReason,
21511
- name: `${trustMember.exemptSettlorName.firstName} ${trustMember.exemptSettlorName.lastName}`
21645
+ name: trustMember.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName}` : trustMember.name ?? ""
21512
21646
  }];
21513
21647
  return trustMember.roles.map((role2) => ({
21514
21648
  legalEntityId: trustMember.legalEntityId,
@@ -21551,12 +21685,13 @@ const createExemptSettlor = async ({
21551
21685
  trust,
21552
21686
  handleCreateLegalEntity
21553
21687
  }) => {
21688
+ var _a, _b;
21554
21689
  const exemptSettlorLE = {
21555
21690
  type: LegalEntityType.INDIVIDUAL,
21556
21691
  individual: {
21557
21692
  name: {
21558
- firstName: exemptSettlor.exemptSettlorName.firstName,
21559
- lastName: exemptSettlor.exemptSettlorName.lastName
21693
+ firstName: ((_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName) ?? "",
21694
+ lastName: ((_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName) ?? ""
21560
21695
  },
21561
21696
  residentialAddress: {
21562
21697
  country: trust.trust.registeredAddress.country
@@ -21565,6 +21700,21 @@ const createExemptSettlor = async ({
21565
21700
  };
21566
21701
  return handleCreateLegalEntity(exemptSettlorLE);
21567
21702
  };
21703
+ const createOrganizationExemptSettlor = async ({
21704
+ exemptSettlor,
21705
+ handleCreateLegalEntity
21706
+ }) => {
21707
+ const exemptSettlorLE = {
21708
+ type: LegalEntityType.ORGANIZATION,
21709
+ organization: {
21710
+ legalName: exemptSettlor.name ?? "",
21711
+ registeredAddress: {
21712
+ country: exemptSettlor.country
21713
+ }
21714
+ }
21715
+ };
21716
+ return handleCreateLegalEntity(exemptSettlorLE);
21717
+ };
21568
21718
  const deleteAssociatedTrustMember = async ({
21569
21719
  associatedTrustMember,
21570
21720
  trust,
@@ -21595,11 +21745,26 @@ const updateExemptSettlorName = async ({
21595
21745
  exemptSettlor,
21596
21746
  handleUpdateLegalEntity
21597
21747
  }) => {
21748
+ var _a, _b;
21598
21749
  const exemptSettlorPatch = {
21599
21750
  individual: {
21600
21751
  name: {
21601
- firstName: exemptSettlor.exemptSettlorName.firstName,
21602
- lastName: exemptSettlor.exemptSettlorName.lastName
21752
+ firstName: (_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName,
21753
+ lastName: (_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName
21754
+ }
21755
+ }
21756
+ };
21757
+ return handleUpdateLegalEntity(exemptSettlorPatch, exemptSettlor.legalEntityId);
21758
+ };
21759
+ const updateOrganizationExemptSettlorName = async ({
21760
+ exemptSettlor,
21761
+ handleUpdateLegalEntity
21762
+ }) => {
21763
+ const exemptSettlorPatch = {
21764
+ organization: {
21765
+ legalName: exemptSettlor.name,
21766
+ registeredAddress: {
21767
+ country: exemptSettlor.country
21603
21768
  }
21604
21769
  }
21605
21770
  };
@@ -21962,14 +22127,16 @@ const ActionsMenu = ({
21962
22127
  const Remove = ({
21963
22128
  onRemove,
21964
22129
  onRemoveStatusChange,
21965
- isRemoveDisabled,
21966
- handleIsRemoveDisabled
22130
+ isRemoveDisabled = false,
22131
+ handleIsRemoveDisabled,
22132
+ label
21967
22133
  }) => {
21968
22134
  const {
21969
22135
  i18n
21970
22136
  } = useI18nContext();
21971
22137
  const [undoTimer, setUndoTimer] = useState(5);
21972
22138
  const [isRemoving, setIsRemoving] = useState(false);
22139
+ const hasLabel = Boolean(label);
21973
22140
  useEffect(() => {
21974
22141
  let undoInterval;
21975
22142
  if (isRemoving && undoTimer > 0) {
@@ -21986,27 +22153,30 @@ const Remove = ({
21986
22153
  event.preventDefault();
21987
22154
  if (!isRemoving) {
21988
22155
  setIsRemoving(true);
21989
- onRemoveStatusChange(true);
21990
- handleIsRemoveDisabled(true);
22156
+ onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(true);
22157
+ handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(true);
21991
22158
  } else {
21992
22159
  setUndoTimer(5);
21993
22160
  setIsRemoving(false);
21994
- onRemoveStatusChange(false);
21995
- handleIsRemoveDisabled(false);
22161
+ onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22162
+ handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
21996
22163
  }
21997
22164
  };
21998
22165
  useEffect(() => {
21999
22166
  if (undoTimer === 0 && isRemoving) {
22000
- setIsRemoving(false);
22001
- onRemoveStatusChange(false);
22002
- handleIsRemoveDisabled(false);
22003
- onRemove();
22167
+ (async () => {
22168
+ setIsRemoving(false);
22169
+ await onRemove();
22170
+ onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22171
+ handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
22172
+ })();
22004
22173
  }
22005
22174
  }, [undoTimer, isRemoving, onRemoveStatusChange, handleIsRemoveDisabled, onRemove]);
22006
22175
  return isRemoving ? jsx(Button, {
22007
- showAsLink: isRemoving,
22176
+ showAsLink: !hasLabel && isRemoving,
22008
22177
  type: "button",
22009
- ghost: true,
22178
+ ghost: !hasLabel,
22179
+ secondary: hasLabel,
22010
22180
  onClick: onClickHandler,
22011
22181
  onKeyDown: handleKeys(["Enter"], noop),
22012
22182
  label: i18n.get("undoWithTimer", {
@@ -22016,11 +22186,14 @@ const Remove = ({
22016
22186
  })
22017
22187
  }) : jsx(Button, {
22018
22188
  type: "button",
22019
- icon: "bin",
22020
- ghost: true,
22189
+ icon: !hasLabel ? "bin" : "",
22190
+ ghost: !hasLabel,
22191
+ secondary: hasLabel,
22192
+ negative: hasLabel,
22021
22193
  onClick: onClickHandler,
22022
22194
  onKeyDown: handleKeys(["Enter"], noop),
22023
- disabled: isRemoveDisabled
22195
+ disabled: isRemoveDisabled,
22196
+ label: label ? i18n.get(label) : ""
22024
22197
  });
22025
22198
  };
22026
22199
  const EntityAssociation = ({
@@ -22410,11 +22583,11 @@ function LegalEntityTypeSwitcher({
22410
22583
  children: [jsx("h2", {
22411
22584
  className: "adyen-kyc-form-header__heading",
22412
22585
  "data-testid": LegalEntityType.ORGANIZATION,
22413
- children: i18n.get("continueAsCompany")
22586
+ children: i18n.get("areYouACompany")
22414
22587
  }), jsx("span", {
22415
- children: i18n.get("indicatedPayoutToCompany")
22588
+ children: i18n.get("singingUpAsIndividualButLooksLikeYouAreACompany")
22416
22589
  }), jsx("p", {
22417
- children: i18n.get("continueSigningUpAsCompany")
22590
+ children: i18n.get("wouldYouLikeToSignUpAsCompanyInstead")
22418
22591
  })]
22419
22592
  });
22420
22593
  case LegalEntityType.INDIVIDUAL:
@@ -22422,11 +22595,11 @@ function LegalEntityTypeSwitcher({
22422
22595
  children: [jsx("h2", {
22423
22596
  className: "adyen-kyc-form-header__heading",
22424
22597
  "data-testid": LegalEntityType.INDIVIDUAL,
22425
- children: i18n.get("continueAsIndividual")
22598
+ children: i18n.get("areYouAnIndividual")
22426
22599
  }), jsx("span", {
22427
- children: i18n.get("indicatedPayoutToPersonalAccount")
22600
+ children: i18n.get("singingUpAsCompanyButLooksLikeYouAreAnIndividual")
22428
22601
  }), jsx("p", {
22429
- children: i18n.get("continueSigningUpAsIndividual")
22602
+ children: i18n.get("wouldYouLikeToSignUpAsIndividualInstead")
22430
22603
  })]
22431
22604
  });
22432
22605
  default:
@@ -23044,10 +23217,11 @@ const ExemptSettlorTaskItem = ({
23044
23217
  onEdit,
23045
23218
  onDelete
23046
23219
  }) => {
23220
+ var _a, _b;
23047
23221
  const {
23048
23222
  i18n
23049
23223
  } = useI18nContext();
23050
- const settlorName = `${exemptSettlor.exemptSettlorName.firstName} ${exemptSettlor.exemptSettlorName.lastName}`;
23224
+ const settlorName = exemptSettlor.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName}` : exemptSettlor.name ?? "";
23051
23225
  const actions = [{
23052
23226
  icon: "edit",
23053
23227
  onSelect: onEdit,
@@ -23671,42 +23845,50 @@ function IndividualDropinComponent({
23671
23845
  };
23672
23846
  const datasetUtils = datasetUtilities(i18n.locale);
23673
23847
  const formatIdDocument = (idDocument2) => {
23674
- var _a2, _b2, _c2, _d2, _e, _f;
23675
- if (idDocument2) {
23676
- const documentType2 = hasInstantIdVerification({
23677
- idDocument: idDocument2
23678
- }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
23679
- id: id2
23680
- }) => (idDocument2 == null ? void 0 : idDocument2.idDocumentType) === id2);
23681
- return {
23682
- documentType: i18n.get(documentType2 == null ? void 0 : documentType2.name),
23683
- ...(documentType2 == null ? void 0 : documentType2.hasBackPage) ? {
23684
- frontPage: (_b2 = (_a2 = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name,
23685
- backPage: (_d2 = (_c2 = idDocument2 == null ? void 0 : idDocument2.idBackPage) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
23686
- } : {
23687
- fileName: (_f = (_e = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _e[0]) == null ? void 0 : _f.name
23688
- }
23689
- };
23690
- }
23848
+ var _a2, _b2;
23849
+ if (!idDocument2)
23850
+ return void 0;
23851
+ const documentType2 = hasInstantIdVerification({
23852
+ idDocument: idDocument2
23853
+ }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
23854
+ id: id2
23855
+ }) => idDocument2.idDocumentType === id2);
23856
+ if (!documentType2)
23857
+ return void 0;
23858
+ const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
23859
+ const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
23860
+ if (!frontPage2)
23861
+ return void 0;
23862
+ return {
23863
+ documentType: i18n.get(documentType2.name),
23864
+ ...backPage2 && documentType2.hasBackPage ? {
23865
+ frontPage: frontPage2.name,
23866
+ backPage: backPage2.name
23867
+ } : {
23868
+ fileName: frontPage2.name
23869
+ }
23870
+ };
23691
23871
  };
23692
23872
  const formatFileSummaryData2 = ({
23693
23873
  idDocument: idDocument2,
23694
23874
  proofOfNationalId: proofOfNationalId2,
23695
23875
  proofOfResidence: proofOfResidence2
23696
23876
  }) => {
23697
- var _a2, _b2, _c2, _d2;
23877
+ var _a2, _b2;
23878
+ const proofOfNationalIdFile = (_a2 = proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0];
23879
+ const proofOfResidenceFile = (_b2 = proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) == null ? void 0 : _b2[0];
23698
23880
  return {
23699
23881
  ...((idDocument2 == null ? void 0 : idDocument2.idDocumentType) || (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData)) && {
23700
23882
  idDocument: formatIdDocument(idDocument2)
23701
23883
  },
23702
- ...(proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) && {
23884
+ ...proofOfNationalIdFile && {
23703
23885
  proofOfNationalId: {
23704
- fileName: (_b2 = (_a2 = proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
23886
+ fileName: proofOfNationalIdFile.name
23705
23887
  }
23706
23888
  },
23707
- ...(proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) && {
23889
+ ...proofOfResidenceFile && {
23708
23890
  proofOfResidence: {
23709
- fileName: (_d2 = (_c2 = proofOfResidence2.proofOfResidence) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
23891
+ fileName: proofOfResidenceFile.name
23710
23892
  }
23711
23893
  }
23712
23894
  };
@@ -24197,11 +24379,12 @@ function PayoutDetailsDropinComponent({
24197
24379
  };
24198
24380
  const isDocumentsRequired2 = (forms2) => forms2.some((form) => form.formId === payoutDetailsSteps.payoutAccountDocuments.formId);
24199
24381
  const formatFileSummaryData2 = (documents22) => {
24200
- var _a2, _b2;
24382
+ var _a2;
24383
+ const bankStatementDocument2 = (_a2 = documents22 == null ? void 0 : documents22.bankStatementDocument) == null ? void 0 : _a2[0];
24201
24384
  return {
24202
- ...(documents22 == null ? void 0 : documents22.bankStatementDocument) && {
24385
+ ...bankStatementDocument2 && {
24203
24386
  bankStatementDocument: {
24204
- fileName: (_b2 = (_a2 = documents22.bankStatementDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
24387
+ fileName: bankStatementDocument2.name
24205
24388
  }
24206
24389
  }
24207
24390
  };
@@ -24793,6 +24976,7 @@ const convertExistingSettlorExemptionReasons = (existingReasons) => {
24793
24976
  return existingReasons;
24794
24977
  };
24795
24978
  const convertExistingTrustMember = (trustMember) => {
24979
+ var _a, _b;
24796
24980
  switch (trustMember.trustMemberType) {
24797
24981
  case "undefinedBeneficiary":
24798
24982
  return {
@@ -24802,6 +24986,13 @@ const convertExistingTrustMember = (trustMember) => {
24802
24986
  };
24803
24987
  case "regular":
24804
24988
  case "company":
24989
+ return {
24990
+ entityType: trustMember.legalEntityType,
24991
+ role: trustMember.roles,
24992
+ settlorExemptionReason: ["noneOfTheAbove"],
24993
+ country: trustMember.trustMemberType === "company" ? trustMember.country : void 0,
24994
+ legalCompanyName: trustMember.trustMemberType === "company" ? trustMember.name : void 0
24995
+ };
24805
24996
  case "rootTrustee":
24806
24997
  return {
24807
24998
  entityType: trustMember.legalEntityType,
@@ -24810,11 +25001,13 @@ const convertExistingTrustMember = (trustMember) => {
24810
25001
  };
24811
25002
  case "exemptSettlor":
24812
25003
  return {
24813
- entityType: LegalEntityType.INDIVIDUAL,
25004
+ entityType: trustMember.legalEntityType,
24814
25005
  role: ["settlor"],
24815
25006
  settlorExemptionReason: convertExistingSettlorExemptionReasons(trustMember.settlorExemptionReason),
24816
- firstName: trustMember.exemptSettlorName.firstName,
24817
- lastName: trustMember.exemptSettlorName.lastName
25007
+ firstName: (_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName,
25008
+ lastName: (_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName,
25009
+ legalCompanyName: trustMember.name,
25010
+ country: trustMember.country
24818
25011
  };
24819
25012
  }
24820
25013
  };
@@ -24838,6 +25031,10 @@ const isExemptSettlor = (data) => {
24838
25031
  var _a;
24839
25032
  return ((_a = data.settlorExemptionReason) == null ? void 0 : _a.some((reason) => reason !== "noneOfTheAbove")) ?? false;
24840
25033
  };
25034
+ const isOrganizationAndSettlor = (data) => {
25035
+ var _a;
25036
+ return data.entityType === LegalEntityType.ORGANIZATION && ((_a = data.role) == null ? void 0 : _a.length) === 1 && data.role[0] === "settlor";
25037
+ };
24841
25038
  const roleAndTypeValidationRules = {
24842
25039
  entityType: {
24843
25040
  modes: ["blur"],
@@ -24858,6 +25055,16 @@ const roleAndTypeValidationRules = {
24858
25055
  modes: ["blur"],
24859
25056
  validate: (reasons) => Boolean(reasons == null ? void 0 : reasons.length),
24860
25057
  errorMessage: "fieldIsRequired"
25058
+ },
25059
+ country: {
25060
+ modes: ["blur"],
25061
+ validate: (country2) => !!country2,
25062
+ errorMessage: "fieldIsRequired"
25063
+ },
25064
+ legalCompanyName: {
25065
+ modes: ["blur"],
25066
+ validate: (name) => !!name,
25067
+ errorMessage: "fieldIsRequired"
24861
25068
  }
24862
25069
  };
24863
25070
  const CHARACTERS_LIMIT = 256;
@@ -24873,29 +25080,34 @@ const leTypeCardDetails = {
24873
25080
  description: "businessEntityDescription"
24874
25081
  }
24875
25082
  };
24876
- const decideFields = (data) => {
24877
- var _a, _b;
24878
- if ((_a = data.role) == null ? void 0 : _a.includes("undefinedBeneficiary")) {
24879
- return ["role", "descriptionUndefinedBeneficiary"];
24880
- }
24881
- if ((_b = data.role) == null ? void 0 : _b.length) {
24882
- if (couldBeExemptSettlor(data)) {
24883
- return isExemptSettlor(data) ? ["role", "entityType", "settlorExemptionReason", "firstName", "lastName"] : ["role", "entityType", "settlorExemptionReason"];
24884
- }
24885
- return ["role", "entityType"];
24886
- }
24887
- return ["role"];
24888
- };
24889
25083
  const TrustRoleAndEntityType = (props) => {
24890
25084
  const {
24891
25085
  existingTrustMember,
24892
- id: id2
25086
+ id: id2,
25087
+ getLegalEntityHandler,
25088
+ isOrganizationSettlorWithExemptionEnabled
24893
25089
  } = props;
24894
25090
  const {
24895
25091
  i18n
24896
25092
  } = useI18nContext();
24897
25093
  const defaultData = existingTrustMember ? convertExistingTrustMember(existingTrustMember) : {};
24898
25094
  const formUtils = formUtilities(props, i18n);
25095
+ const decideFields = (data2) => {
25096
+ var _a, _b;
25097
+ if ((_a = data2.role) == null ? void 0 : _a.includes("undefinedBeneficiary")) {
25098
+ return ["role", "descriptionUndefinedBeneficiary"];
25099
+ }
25100
+ if ((_b = data2.role) == null ? void 0 : _b.length) {
25101
+ if (isOrganizationSettlorWithExemptionEnabled && isOrganizationAndSettlor(data2)) {
25102
+ return ["role", "entityType", "settlorExemptionReason", "country", "legalCompanyName"];
25103
+ }
25104
+ if (couldBeExemptSettlor(data2)) {
25105
+ return isExemptSettlor(data2) ? ["role", "entityType", "settlorExemptionReason", "firstName", "lastName"] : ["role", "entityType", "settlorExemptionReason"];
25106
+ }
25107
+ return ["role", "entityType"];
25108
+ }
25109
+ return ["role"];
25110
+ };
24899
25111
  const {
24900
25112
  data,
24901
25113
  valid,
@@ -24915,6 +25127,18 @@ const TrustRoleAndEntityType = (props) => {
24915
25127
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
24916
25128
  });
24917
25129
  const availableRoles = getAvailableRoles(data.role);
25130
+ useEffect(() => {
25131
+ (async () => {
25132
+ var _a;
25133
+ if (isOrganizationSettlorWithExemptionEnabled && existingTrustMember && existingTrustMember.trustMemberType === "exemptSettlor" && existingTrustMember.legalEntityId !== "isNewEntry" && existingTrustMember.roles !== void 0 && existingTrustMember.roles.length === 1 && existingTrustMember.roles[0] === "settlor" && getLegalEntityHandler) {
25134
+ const response = await getLegalEntityHandler(existingTrustMember.legalEntityId);
25135
+ const country2 = (_a = response == null ? void 0 : response.organization) == null ? void 0 : _a.registeredAddress.country;
25136
+ if (response && response.organization) {
25137
+ handleChangeFor("country")(country2);
25138
+ }
25139
+ }
25140
+ })();
25141
+ }, []);
24918
25142
  useEffect(() => {
24919
25143
  var _a;
24920
25144
  (_a = props.onChange) == null ? void 0 : _a.call(props, {
@@ -24962,6 +25186,13 @@ const TrustRoleAndEntityType = (props) => {
24962
25186
  setValid("lastName", valid2.lastName);
24963
25187
  setErrors("lastName", errors2.lastName);
24964
25188
  };
25189
+ const onEntityTypeChange = (value) => {
25190
+ var _a;
25191
+ if (isOrganizationSettlorWithExemptionEnabled && value === LegalEntityType.ORGANIZATION && ((_a = data.role) == null ? void 0 : _a.length) === 1 && data.role[0] === "settlor") {
25192
+ changeSettlorExemptionReasons(["professionalServiceProvider"]);
25193
+ }
25194
+ handleChangeFor("entityType")(value);
25195
+ };
24965
25196
  return jsxs("form", {
24966
25197
  className: "adyen-kyc-trust__role-and-entity-type adl-u-width-full",
24967
25198
  children: [jsx(FormHeader, {
@@ -24999,7 +25230,7 @@ const TrustRoleAndEntityType = (props) => {
24999
25230
  children: (childProps) => jsx(RadioCardSelect, {
25000
25231
  ...childProps,
25001
25232
  options: trustMemberLegalEntityTypes,
25002
- onSelect: handleChangeFor("entityType"),
25233
+ onSelect: onEntityTypeChange,
25003
25234
  selected: data.entityType,
25004
25235
  optionId: (option) => leTypeCardDetails[option].id,
25005
25236
  optionName: (option) => leTypeCardDetails[option].name,
@@ -25025,7 +25256,7 @@ const TrustRoleAndEntityType = (props) => {
25025
25256
  "aria-label": formUtils.getLabel("descriptionUndefinedBeneficiary"),
25026
25257
  "aria-invalid": !valid.descriptionUndefinedBeneficiary
25027
25258
  })
25028
- }), (schema == null ? void 0 : schema.includes("settlorExemptionReason")) && jsx(Field, {
25259
+ }), (schema == null ? void 0 : schema.includes("settlorExemptionReason")) && !isOrganizationAndSettlor(data) && jsx(Field, {
25029
25260
  name: "settlorExemptionReason",
25030
25261
  label: formUtils.getLabel("settlorExemptionReason", "whichOfTheseApplyToTheSettlor"),
25031
25262
  isValid: valid.settlorExemptionReason,
@@ -25056,6 +25287,27 @@ const TrustRoleAndEntityType = (props) => {
25056
25287
  },
25057
25288
  onChange: onNameChange,
25058
25289
  dataStoreId: id2
25290
+ }) : void 0, isOrganizationSettlorWithExemptionEnabled && (schema == null ? void 0 : schema.includes("country")) && (schema == null ? void 0 : schema.includes("legalCompanyName")) ? jsxs(Fragment, {
25291
+ children: [jsx(CountryField, {
25292
+ data: formUtils.getFieldData(data, COUNTRY_FIELD),
25293
+ valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
25294
+ errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
25295
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD),
25296
+ readonly: false,
25297
+ classNameModifiers: COUNTRY_FIELD,
25298
+ allowedCountries: [],
25299
+ handleChangeFor
25300
+ }), jsx(LegalCompanyNameField, {
25301
+ data: formUtils.getFieldData(data, LEGAL_COMPANY_NAME_FIELD),
25302
+ valid: formUtils.getFieldValid(valid, LEGAL_COMPANY_NAME_FIELD),
25303
+ errors: formUtils.getFieldErrors(errors, fieldProblems, LEGAL_COMPANY_NAME_FIELD),
25304
+ labels: formUtils.getFieldLabels(LEGAL_COMPANY_NAME_FIELD),
25305
+ helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
25306
+ legalCompanyName: "legalCompanyName__helperText"
25307
+ }),
25308
+ readonly: false,
25309
+ handleChangeFor
25310
+ })]
25059
25311
  }) : void 0]
25060
25312
  });
25061
25313
  };
@@ -25105,11 +25357,22 @@ const decideForms = (trustMember) => {
25105
25357
  return regularForms;
25106
25358
  }
25107
25359
  };
25108
- const convertDataToTrustMember = (data, existingTrustMember) => {
25360
+ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettlorWithExemptionReasonEnabled2 = false) => {
25109
25361
  var _a;
25110
25362
  const existingId = existingTrustMember ? existingTrustMember.trustMemberType === "undefinedBeneficiary" ? existingTrustMember.reference : existingTrustMember.legalEntityId : void 0;
25111
25363
  if ((_a = data.role) == null ? void 0 : _a.length) {
25112
- if (isExemptSettlor(data))
25364
+ if (isExemptSettlor(data)) {
25365
+ if (isOrganizationSettlorWithExemptionReasonEnabled2 && data.entityType === LegalEntityType.ORGANIZATION) {
25366
+ return {
25367
+ trustMemberType: "exemptSettlor",
25368
+ roles: [TrustMemberTypes.SETTLOR],
25369
+ legalEntityType: LegalEntityType.ORGANIZATION,
25370
+ legalEntityId: existingId ?? isNewEntity,
25371
+ name: data.legalCompanyName ?? "",
25372
+ settlorExemptionReason: ["professionalServiceProvider"],
25373
+ country: data.country
25374
+ };
25375
+ }
25113
25376
  return {
25114
25377
  trustMemberType: "exemptSettlor",
25115
25378
  roles: [TrustMemberTypes.SETTLOR],
@@ -25121,6 +25384,7 @@ const convertDataToTrustMember = (data, existingTrustMember) => {
25121
25384
  },
25122
25385
  legalEntityId: existingId ?? isNewEntity
25123
25386
  };
25387
+ }
25124
25388
  if (data.role.includes("undefinedBeneficiary"))
25125
25389
  return {
25126
25390
  trustMemberType: "undefinedBeneficiary",
@@ -25128,14 +25392,16 @@ const convertDataToTrustMember = (data, existingTrustMember) => {
25128
25392
  description: data.descriptionUndefinedBeneficiary ?? "",
25129
25393
  reference: existingId ?? isNewEntity
25130
25394
  };
25131
- if (data.entityType === LegalEntityType.ORGANIZATION)
25395
+ if (data.entityType === LegalEntityType.ORGANIZATION) {
25132
25396
  return {
25133
25397
  trustMemberType: "company",
25134
25398
  roles: data.role,
25135
25399
  legalEntityType: LegalEntityType.ORGANIZATION,
25136
25400
  legalEntityId: existingId ?? isNewEntity,
25137
- name: ""
25401
+ name: data.legalCompanyName ?? "",
25402
+ country: data.country
25138
25403
  };
25404
+ }
25139
25405
  if (data.entityType === LegalEntityType.INDIVIDUAL)
25140
25406
  return {
25141
25407
  trustMemberType: "regular",
@@ -25151,8 +25417,11 @@ function RoleAndTypeDropinComponent({
25151
25417
  existingTrustMember,
25152
25418
  navigateToFullDropinFor,
25153
25419
  navigateBack,
25154
- addOrUpdateTrustMember
25420
+ addOrUpdateTrustMember,
25421
+ getLegalEntityHandler,
25422
+ isOrganizationSettlorWithExemptionEnabled
25155
25423
  }) {
25424
+ var _a, _b;
25156
25425
  const {
25157
25426
  i18n
25158
25427
  } = useI18nContext();
@@ -25173,8 +25442,10 @@ function RoleAndTypeDropinComponent({
25173
25442
  entityType: trustMember.trustMemberType !== "undefinedBeneficiary" ? i18n.get(trustMember.legalEntityType) : void 0,
25174
25443
  descriptionUndefinedBeneficiary: trustMember.trustMemberType === "undefinedBeneficiary" ? trustMember.description : void 0,
25175
25444
  otherInformation: trustMember.trustMemberType === "exemptSettlor" ? formatSettlorExemptionReasonsForSummary(trustMember.settlorExemptionReason ?? []) : void 0,
25176
- firstName: trustMember.trustMemberType === "exemptSettlor" ? trustMember.exemptSettlorName.firstName : void 0,
25177
- lastName: trustMember.trustMemberType === "exemptSettlor" ? trustMember.exemptSettlorName.lastName : void 0
25445
+ firstName: trustMember.trustMemberType === "exemptSettlor" ? (_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName : void 0,
25446
+ lastName: trustMember.trustMemberType === "exemptSettlor" ? (_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName : void 0,
25447
+ country: isOrganizationSettlorWithExemptionEnabled && trustMember.trustMemberType === "exemptSettlor" ? trustMember.country : void 0,
25448
+ legalCompanyName: isOrganizationSettlorWithExemptionEnabled && trustMember.trustMemberType === "exemptSettlor" ? trustMember.name : void 0
25178
25449
  }
25179
25450
  };
25180
25451
  const onNavigateToNextStep = () => {
@@ -25195,7 +25466,7 @@ function RoleAndTypeDropinComponent({
25195
25466
  [dataStoreId]: isValid
25196
25467
  });
25197
25468
  }
25198
- setTrustMember(convertDataToTrustMember(data, existingTrustMember));
25469
+ setTrustMember(convertDataToTrustMember(data, existingTrustMember, isOrganizationSettlorWithExemptionEnabled));
25199
25470
  };
25200
25471
  const saveRolesAndNavigate = async () => {
25201
25472
  if (trustMember === "incomplete")
@@ -25241,7 +25512,9 @@ function RoleAndTypeDropinComponent({
25241
25512
  id: "roleAndEntityType",
25242
25513
  existingTrustMember,
25243
25514
  onChange: onTrustMemberChange,
25244
- shouldValidate
25515
+ shouldValidate,
25516
+ getLegalEntityHandler,
25517
+ isOrganizationSettlorWithExemptionEnabled
25245
25518
  })
25246
25519
  }), isSummaryStep && jsx("div", {
25247
25520
  className: "adyen-kyc-form-wrapper",
@@ -25274,7 +25547,7 @@ const serviceAgreementValidationRules = {
25274
25547
  errorMessage: "fieldIsRequired"
25275
25548
  }
25276
25549
  };
25277
- const logger$7 = createLogger("useServiceAgreement");
25550
+ const logger$6 = createLogger("useServiceAgreement");
25278
25551
  const FALLBACK_LANGUAGE_CODE = "en";
25279
25552
  const useServiceAgreement = ({
25280
25553
  handleGetServiceAgreement,
@@ -25303,7 +25576,7 @@ const useServiceAgreement = ({
25303
25576
  language: agreementLanguage
25304
25577
  });
25305
25578
  if (!document2) {
25306
- logger$7.log('"document" field was missing in response');
25579
+ logger$6.log('"document" field was missing in response');
25307
25580
  return;
25308
25581
  }
25309
25582
  const contract = JSON.parse(decodeURIComponent(escape(window.atob(document2))));
@@ -25321,7 +25594,7 @@ const useServiceAgreement = ({
25321
25594
  throw err;
25322
25595
  }
25323
25596
  };
25324
- requestServiceAgreement().catch(logger$7.error);
25597
+ requestServiceAgreement().catch(logger$6.error);
25325
25598
  }, [handleGetServiceAgreement, handleServiceAgreementIsNotAvailableInThatLanguage, agreementLanguage, legalEntityId, serviceAgreementType]);
25326
25599
  return {
25327
25600
  loading: loading2,
@@ -26403,11 +26676,12 @@ function SolePropDropinComponent({
26403
26676
  return summaryData;
26404
26677
  };
26405
26678
  const formatFileSummaryData2 = (solePropConstitutionalDocument) => {
26406
- var _a2, _b;
26679
+ var _a2;
26680
+ const constitutionalDocument2 = (_a2 = solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0];
26407
26681
  return {
26408
- ...(solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) && {
26682
+ ...constitutionalDocument2 && {
26409
26683
  solePropConstitutionalDocument: {
26410
- fileName: (_b = (_a2 = solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b.name
26684
+ fileName: constitutionalDocument2.name
26411
26685
  }
26412
26686
  }
26413
26687
  };
@@ -26617,11 +26891,12 @@ function TrustDropinComponent(props) {
26617
26891
  return summaryData;
26618
26892
  };
26619
26893
  const formatFileSummaryData2 = (trustConstitutionalDocument) => {
26620
- var _a, _b;
26894
+ var _a;
26895
+ const constitutionalDocument2 = (_a = trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0];
26621
26896
  return {
26622
- ...(trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) && {
26897
+ ...constitutionalDocument2 && {
26623
26898
  trustConstitutionalDocument: {
26624
- fileName: (_b = (_a = trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
26899
+ fileName: constitutionalDocument2.name
26625
26900
  }
26626
26901
  }
26627
26902
  };
@@ -26657,7 +26932,8 @@ function TrustDropinComponent(props) {
26657
26932
  }
26658
26933
  const PAGES_WITH_STATUS = [TaskTypes.DECISION_MAKER_OVERVIEW, TaskTypes.TASKS_OVERVIEW];
26659
26934
  const POLLING_INTERVAL = 3e3;
26660
- const logger$6 = createLogger("DropinComposerComponent");
26935
+ const logger$5 = createLogger("DropinComposerComponent");
26936
+ const isOrganizationSettlorWithExemptionReasonEnabled = (enabled, country2) => country2 === CountryCodes.Australia && enabled;
26661
26937
  function DropinComposerComponent({
26662
26938
  capabilities,
26663
26939
  legalEntityResponse,
@@ -26716,6 +26992,7 @@ function DropinComposerComponent({
26716
26992
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
26717
26993
  const reviewRequired = (legalEntity == null ? void 0 : legalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[legalEntity.id]) == null ? void 0 : _d.isReviewRequired);
26718
26994
  const additionalSalesChannels = useSalesChannelsSettings();
26995
+ const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("OrganizationSettlorWithExemptionReason"), trust == null ? void 0 : trust.trust.countryOfGoverningLaw);
26719
26996
  const getLegalEntityProblems = (le) => {
26720
26997
  var _a2;
26721
26998
  if (le == null ? void 0 : le.id) {
@@ -26734,7 +27011,7 @@ function DropinComposerComponent({
26734
27011
  setPciStatus(response);
26735
27012
  return response;
26736
27013
  } catch (e) {
26737
- logger$6.warn(i18n.get("failedToGetPciStatus"));
27014
+ logger$5.warn(i18n.get("failedToGetPciStatus"));
26738
27015
  }
26739
27016
  }
26740
27017
  return void 0;
@@ -26763,7 +27040,7 @@ function DropinComposerComponent({
26763
27040
  useEffect(() => {
26764
27041
  if (!tasks.includes(TaskTypes.PCI_DSS))
26765
27042
  return;
26766
- getPciTemplate().catch(logger$6.error);
27043
+ getPciTemplate().catch(logger$5.error);
26767
27044
  }, [getPciTemplate, tasks]);
26768
27045
  const getServiceAgreementAcceptanceInfos = async () => {
26769
27046
  if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
@@ -26771,7 +27048,7 @@ function DropinComposerComponent({
26771
27048
  const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
26772
27049
  setServiceAgreementAcceptanceInfos(response.data);
26773
27050
  } catch (e) {
26774
- logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
27051
+ logger$5.warn(i18n.get("failedToGetServiceAgreementStatus"));
26775
27052
  }
26776
27053
  }
26777
27054
  };
@@ -26781,7 +27058,7 @@ function DropinComposerComponent({
26781
27058
  const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
26782
27059
  setServiceAgreementTypes(response.termsOfServiceTypes);
26783
27060
  } catch (e) {
26784
- logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
27061
+ logger$5.warn(i18n.get("failedToGetServiceAgreementStatus"));
26785
27062
  }
26786
27063
  }
26787
27064
  };
@@ -26820,7 +27097,7 @@ function DropinComposerComponent({
26820
27097
  setCapabilityProblems(getCapabilityProblems(response));
26821
27098
  return response;
26822
27099
  } catch (e) {
26823
- logger$6.warn(i18n.get("failedToFetchLegalEntityDetails"));
27100
+ logger$5.warn(i18n.get("failedToFetchLegalEntityDetails"));
26824
27101
  }
26825
27102
  }
26826
27103
  return void 0;
@@ -26832,7 +27109,7 @@ function DropinComposerComponent({
26832
27109
  setTrust(response);
26833
27110
  return response;
26834
27111
  } catch (e) {
26835
- logger$6.warn(i18n.get("failedToFetchTrustDetails"));
27112
+ logger$5.warn(i18n.get("failedToFetchTrustDetails"));
26836
27113
  }
26837
27114
  }
26838
27115
  return void 0;
@@ -26882,7 +27159,7 @@ function DropinComposerComponent({
26882
27159
  label: i18n.get("successFullyRemovedTrustMember")
26883
27160
  });
26884
27161
  } catch (err) {
26885
- logger$6.error(`Failed to delete trust member`, err);
27162
+ logger$5.error(`Failed to delete trust member`, err);
26886
27163
  showToast({
26887
27164
  type: ToastType.ERROR,
26888
27165
  label: i18n.get("failedToRemoveTrustMember")
@@ -26905,7 +27182,10 @@ function DropinComposerComponent({
26905
27182
  break;
26906
27183
  case "exemptSettlor":
26907
27184
  if (!existing) {
26908
- const newSettlorLE = await createExemptSettlor({
27185
+ const newSettlorLE = isOrganizationSettlorWithExemptionEnabled && updated.legalEntityType === "organization" ? await createOrganizationExemptSettlor({
27186
+ exemptSettlor: updated,
27187
+ handleCreateLegalEntity: args.handleCreateLegalEntity
27188
+ }) : await createExemptSettlor({
26909
27189
  exemptSettlor: updated,
26910
27190
  trust,
26911
27191
  handleCreateLegalEntity: args.handleCreateLegalEntity
@@ -26918,6 +27198,12 @@ function DropinComposerComponent({
26918
27198
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
26919
27199
  });
26920
27200
  }
27201
+ if (existing && isOrganizationSettlorWithExemptionEnabled && updated.legalEntityType === "organization") {
27202
+ await updateOrganizationExemptSettlorName({
27203
+ exemptSettlor: updated,
27204
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity
27205
+ });
27206
+ }
26921
27207
  await addOrUpdateAssociatedTrustMember({
26922
27208
  newOrUpdated: updated,
26923
27209
  trust,
@@ -26934,7 +27220,7 @@ function DropinComposerComponent({
26934
27220
  break;
26935
27221
  case "rootTrustee":
26936
27222
  default:
26937
- logger$6.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27223
+ logger$5.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
26938
27224
  }
26939
27225
  showToast({
26940
27226
  label: i18n.get("successfullyUpdatedDetails"),
@@ -26942,7 +27228,7 @@ function DropinComposerComponent({
26942
27228
  });
26943
27229
  await refreshTrustAndRunOnSubmit(trust, 1);
26944
27230
  } catch (err) {
26945
- logger$6.error(err);
27231
+ logger$5.error(err);
26946
27232
  showToast({
26947
27233
  label: i18n.get("failedToUpdateDetails"),
26948
27234
  type: ToastType.ERROR
@@ -27165,7 +27451,7 @@ function DropinComposerComponent({
27165
27451
  }
27166
27452
  };
27167
27453
  setIsLoadingConfiguration(true);
27168
- fetchConfiguration().catch(logger$6.error).finally(() => {
27454
+ fetchConfiguration().catch(logger$5.error).finally(() => {
27169
27455
  setIsLoadingConfiguration(false);
27170
27456
  onLoad();
27171
27457
  });
@@ -27450,7 +27736,9 @@ function DropinComposerComponent({
27450
27736
  navigateBack();
27451
27737
  },
27452
27738
  existingTrustMember: trustMember,
27453
- addOrUpdateTrustMember: (newOrUpdated) => addOrUpdateTrustMember(newOrUpdated, trustMember)
27739
+ addOrUpdateTrustMember: (newOrUpdated) => addOrUpdateTrustMember(newOrUpdated, trustMember),
27740
+ getLegalEntityHandler: args == null ? void 0 : args.handleGetLegalEntity,
27741
+ isOrganizationSettlorWithExemptionEnabled
27454
27742
  });
27455
27743
  case TaskTypes.PCI_DSS:
27456
27744
  return jsx(PciDropinComponent, {
@@ -27521,7 +27809,6 @@ function DropinComposerComponent({
27521
27809
  const createDocument = async (context, document2, ownerId) => {
27522
27810
  const {
27523
27811
  loadingContext,
27524
- sdkToken,
27525
27812
  legalEntityId
27526
27813
  } = context;
27527
27814
  return httpPost({
@@ -27529,7 +27816,7 @@ const createDocument = async (context, document2, ownerId) => {
27529
27816
  errorLevel: "warn",
27530
27817
  errorMessage: `Failed to create document`,
27531
27818
  path: `${legalEntityId}/documents/${ownerId}`,
27532
- sdkToken,
27819
+ authentication: "jwt",
27533
27820
  headers: {
27534
27821
  "Content-Type": "application/json"
27535
27822
  }
@@ -27538,7 +27825,6 @@ const createDocument = async (context, document2, ownerId) => {
27538
27825
  const createTransferInstrument = async (context, transferInstrument) => {
27539
27826
  const {
27540
27827
  loadingContext,
27541
- sdkToken,
27542
27828
  legalEntityId
27543
27829
  } = context;
27544
27830
  return httpPost({
@@ -27546,7 +27832,7 @@ const createTransferInstrument = async (context, transferInstrument) => {
27546
27832
  errorLevel: "warn",
27547
27833
  errorMessage: `Failed to create transferInstrument`,
27548
27834
  path: `${legalEntityId}/transferInstruments`,
27549
- sdkToken,
27835
+ authentication: "jwt",
27550
27836
  headers: {
27551
27837
  "Content-Type": "application/json"
27552
27838
  }
@@ -27555,7 +27841,6 @@ const createTransferInstrument = async (context, transferInstrument) => {
27555
27841
  const getBankVerificationVendor = async (context, country2) => {
27556
27842
  const {
27557
27843
  loadingContext,
27558
- sdkToken,
27559
27844
  legalEntityId
27560
27845
  } = context;
27561
27846
  return httpGet({
@@ -27563,7 +27848,7 @@ const getBankVerificationVendor = async (context, country2) => {
27563
27848
  errorLevel: "warn",
27564
27849
  errorMessage: `Bank verification vendor not available`,
27565
27850
  path: `${legalEntityId}/transferInstruments/trusted/providers?country=${country2}`,
27566
- sdkToken,
27851
+ authentication: "jwt",
27567
27852
  headers: {
27568
27853
  "Content-Type": "application/json"
27569
27854
  }
@@ -27571,8 +27856,7 @@ const getBankVerificationVendor = async (context, country2) => {
27571
27856
  };
27572
27857
  const getDataset$1 = async (context, name, locale) => {
27573
27858
  const {
27574
- loadingContext,
27575
- sdkToken
27859
+ loadingContext
27576
27860
  } = context;
27577
27861
  const datasetUtils = datasetUtilities(locale);
27578
27862
  const dataset = datasetUtils.getDataset(name);
@@ -27587,7 +27871,7 @@ const getDataset$1 = async (context, name, locale) => {
27587
27871
  errorLevel: "warn",
27588
27872
  errorMessage: `Dataset ${name} is not available`,
27589
27873
  path,
27590
- sdkToken,
27874
+ authentication: "jwt",
27591
27875
  headers: {
27592
27876
  "Content-Type": "application/json"
27593
27877
  }
@@ -27599,7 +27883,6 @@ const getDataset$1 = async (context, name, locale) => {
27599
27883
  const getDocument = async (context, documentId) => {
27600
27884
  const {
27601
27885
  loadingContext,
27602
- sdkToken,
27603
27886
  legalEntityId
27604
27887
  } = context;
27605
27888
  return httpGet({
@@ -27607,7 +27890,7 @@ const getDocument = async (context, documentId) => {
27607
27890
  errorLevel: "warn",
27608
27891
  errorMessage: `Failed to fetch document`,
27609
27892
  path: `${legalEntityId}/documents/${documentId}`,
27610
- sdkToken,
27893
+ authentication: "jwt",
27611
27894
  headers: {
27612
27895
  "Content-Type": "application/json"
27613
27896
  }
@@ -27616,7 +27899,6 @@ const getDocument = async (context, documentId) => {
27616
27899
  const getLegalEntity = async (context) => {
27617
27900
  const {
27618
27901
  loadingContext,
27619
- sdkToken,
27620
27902
  legalEntityId
27621
27903
  } = context;
27622
27904
  return httpGet({
@@ -27624,7 +27906,7 @@ const getLegalEntity = async (context) => {
27624
27906
  errorLevel: "warn",
27625
27907
  errorMessage: `LegalEntity not available`,
27626
27908
  path: `${legalEntityId}`,
27627
- sdkToken,
27909
+ authentication: "jwt",
27628
27910
  headers: {
27629
27911
  "Content-Type": "application/json"
27630
27912
  }
@@ -27633,7 +27915,6 @@ const getLegalEntity = async (context) => {
27633
27915
  const getScenarios = async (context) => {
27634
27916
  const {
27635
27917
  loadingContext,
27636
- sdkToken,
27637
27918
  legalEntityId
27638
27919
  } = context;
27639
27920
  return httpGet({
@@ -27641,7 +27922,7 @@ const getScenarios = async (context) => {
27641
27922
  errorLevel: "warn",
27642
27923
  errorMessage: `Scenarios not available`,
27643
27924
  path: `${legalEntityId}/configurations/scenarios`,
27644
- sdkToken,
27925
+ authentication: "jwt",
27645
27926
  headers: {
27646
27927
  "Content-Type": "application/json"
27647
27928
  }
@@ -27650,7 +27931,6 @@ const getScenarios = async (context) => {
27650
27931
  const getTasks = async (context) => {
27651
27932
  const {
27652
27933
  loadingContext,
27653
- sdkToken,
27654
27934
  legalEntityId
27655
27935
  } = context;
27656
27936
  return httpGet({
@@ -27658,7 +27938,7 @@ const getTasks = async (context) => {
27658
27938
  errorLevel: "warn",
27659
27939
  errorMessage: `Tasks not available`,
27660
27940
  path: `${legalEntityId}/configurations/tasks`,
27661
- sdkToken,
27941
+ authentication: "jwt",
27662
27942
  headers: {
27663
27943
  "Content-Type": "application/json"
27664
27944
  }
@@ -27667,7 +27947,6 @@ const getTasks = async (context) => {
27667
27947
  const getTransferInstrument = async (context, transferInstrumentId) => {
27668
27948
  const {
27669
27949
  loadingContext,
27670
- sdkToken,
27671
27950
  legalEntityId
27672
27951
  } = context;
27673
27952
  return httpGet({
@@ -27675,9 +27954,8 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27675
27954
  errorLevel: "warn",
27676
27955
  errorMessage: `TransferInstrument not available`,
27677
27956
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27957
+ authentication: "jwt",
27678
27958
  headers: {
27679
- Authorization: `Bearer ${sdkToken}`,
27680
- Origin: window.location.origin,
27681
27959
  "Content-Type": "application/json"
27682
27960
  }
27683
27961
  });
@@ -27685,7 +27963,6 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27685
27963
  const updateDocument = async (context, document2, documentId, ownerId) => {
27686
27964
  const {
27687
27965
  loadingContext,
27688
- sdkToken,
27689
27966
  legalEntityId
27690
27967
  } = context;
27691
27968
  return httpPost({
@@ -27693,7 +27970,7 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27693
27970
  errorLevel: "warn",
27694
27971
  errorMessage: `Failed to update document`,
27695
27972
  path: `${legalEntityId}/documents/${documentId}/${ownerId}`,
27696
- sdkToken,
27973
+ authentication: "jwt",
27697
27974
  headers: {
27698
27975
  "Content-Type": "application/json"
27699
27976
  }
@@ -27702,7 +27979,6 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27702
27979
  const updateTransferInstrument = async (context, transferInstrument, transferInstrumentId) => {
27703
27980
  const {
27704
27981
  loadingContext,
27705
- sdkToken,
27706
27982
  legalEntityId
27707
27983
  } = context;
27708
27984
  return httpPost({
@@ -27710,7 +27986,7 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27710
27986
  errorLevel: "warn",
27711
27987
  errorMessage: `Failed to update transferInstrument`,
27712
27988
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27713
- sdkToken,
27989
+ authentication: "jwt",
27714
27990
  headers: {
27715
27991
  "Content-Type": "application/json"
27716
27992
  }
@@ -27719,7 +27995,6 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27719
27995
  const createTrustedTransferInstrument = async (context, code2, state2) => {
27720
27996
  const {
27721
27997
  loadingContext,
27722
- sdkToken,
27723
27998
  legalEntityId
27724
27999
  } = context;
27725
28000
  const path = `${legalEntityId}/transferInstruments/trusted`;
@@ -27728,7 +28003,7 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27728
28003
  errorLevel: "warn",
27729
28004
  errorMessage: `Failed to create trusted transferInstrument`,
27730
28005
  path,
27731
- sdkToken,
28006
+ authentication: "jwt",
27732
28007
  headers: {
27733
28008
  "Content-Type": "application/json"
27734
28009
  }
@@ -27740,7 +28015,6 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27740
28015
  const handleBankVerificationError = async (context, errorCode, errorMessage, state2, metadata) => {
27741
28016
  const {
27742
28017
  loadingContext,
27743
- sdkToken,
27744
28018
  legalEntityId
27745
28019
  } = context;
27746
28020
  const path = `${legalEntityId}/transferInstruments/trusted/error`;
@@ -27749,7 +28023,7 @@ const handleBankVerificationError = async (context, errorCode, errorMessage, sta
27749
28023
  errorLevel: "warn",
27750
28024
  errorMessage: `Failed to create trusted transferInstrument`,
27751
28025
  path,
27752
- sdkToken,
28026
+ authentication: "jwt",
27753
28027
  headers: {
27754
28028
  "Content-Type": "application/json"
27755
28029
  }
@@ -27767,7 +28041,6 @@ const useComponentApi = (rootLegalEntityId) => {
27767
28041
  throw new Error("Cannot use component API outside an embedded dropin");
27768
28042
  }
27769
28043
  const {
27770
- sdkToken,
27771
28044
  loadingContext: base
27772
28045
  } = authContext;
27773
28046
  return useMemo(() => {
@@ -27775,8 +28048,7 @@ const useComponentApi = (rootLegalEntityId) => {
27775
28048
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
27776
28049
  const baseRequestContext = {
27777
28050
  loadingContext: loadingContextWithRootLEAuth,
27778
- legalEntityId: rootLegalEntityId,
27779
- sdkToken
28051
+ legalEntityId: rootLegalEntityId
27780
28052
  };
27781
28053
  return {
27782
28054
  getLegalEntity: async (legalEntityId) => getLegalEntity({
@@ -27793,7 +28065,7 @@ const useComponentApi = (rootLegalEntityId) => {
27793
28065
  createTrustedTransferInstrument: async (code2, state2) => createTrustedTransferInstrument(baseRequestContext, code2, state2),
27794
28066
  handleBankVerificationError: async (errorCode, errorMessage, state2, metadata) => handleBankVerificationError(baseRequestContext, errorCode, errorMessage, state2, metadata)
27795
28067
  };
27796
- }, [base, rootLegalEntityId, sdkToken]);
28068
+ }, [base, rootLegalEntityId]);
27797
28069
  };
27798
28070
  class EventEmitter {
27799
28071
  constructor() {
@@ -27814,7 +28086,7 @@ class EventEmitter {
27814
28086
  };
27815
28087
  }
27816
28088
  }
27817
- const logger$5 = createLogger("TransferInstrumentComponent");
28089
+ const logger$4 = createLogger("TransferInstrumentComponent");
27818
28090
  function TransferInstrumentComponent({
27819
28091
  legalEntityId,
27820
28092
  transferInstrumentId,
@@ -27849,8 +28121,8 @@ function TransferInstrumentComponent({
27849
28121
  const ti = await getTransferInstrument2(transferInstrumentId);
27850
28122
  setTransferInstrument(ti);
27851
28123
  }
27852
- })().catch(logger$5.error);
27853
- }, [transferInstrumentId]);
28124
+ })().catch(logger$4.error);
28125
+ }, [transferInstrumentId, fetchLegalEntity]);
27854
28126
  return legalEntity ? jsx(PayoutDetailsDropinComponent, {
27855
28127
  eventEmitter: eventEmitter ?? new EventEmitter(),
27856
28128
  transferInstrument,
@@ -27882,85 +28154,17 @@ const componentsMap = {
27882
28154
  pci: PciDropinComponent,
27883
28155
  transferInstrumentComponent: TransferInstrumentComponent
27884
28156
  };
27885
- const refreshSdkToken = async (context, refreshToken) => {
27886
- const {
27887
- loadingContext,
27888
- sdkToken
27889
- } = context;
27890
- return httpPost({
27891
- loadingContext,
27892
- errorLevel: "warn",
27893
- errorMessage: `Failed to refresh token`,
27894
- path: `sessions/refresh`,
27895
- sdkToken,
27896
- headers: {
27897
- "Content-Type": "application/json"
27898
- }
27899
- }, {
27900
- refreshToken
27901
- });
27902
- };
27903
- const SDK_TOKEN_TTL = 6e4;
27904
- const REFRESH_INTERVAL = SDK_TOKEN_TTL - 5e3;
27905
- const RETRY_LIMIT = 2;
27906
- const logger$4 = createLogger("useSdkToken");
27907
- const useSdkToken = ({
27908
- initialSdkToken,
27909
- refreshToken,
27910
- autheBase
27911
- }) => {
27912
- const [sdkToken, setSdkToken] = useState(initialSdkToken);
27913
- const doRefresh = async (sdkToken2, refreshToken2, retries) => {
27914
- try {
27915
- const {
27916
- token: newSdkToken
27917
- } = await refreshSdkToken({
27918
- loadingContext: autheBase,
27919
- sdkToken: sdkToken2
27920
- }, refreshToken2);
27921
- setSdkToken(newSdkToken);
27922
- } catch (e) {
27923
- if (!retries) {
27924
- throw new Error("Unable to refresh token after retries", e);
27925
- }
27926
- logger$4.warn("Failed to refresh token. Retrying..", e);
27927
- await doRefresh(sdkToken2, refreshToken2, retries - 1);
27928
- }
27929
- };
27930
- useEffect(() => {
27931
- if (!sdkToken || !refreshToken) {
27932
- return;
27933
- }
27934
- const refreshHandler = setInterval(() => {
27935
- doRefresh(sdkToken, refreshToken, RETRY_LIMIT).catch(() => {
27936
- clearInterval(refreshHandler);
27937
- });
27938
- }, REFRESH_INTERVAL);
27939
- return () => {
27940
- clearInterval(refreshHandler);
27941
- };
27942
- }, [sdkToken]);
27943
- return sdkToken;
27944
- };
27945
- const AUTHE_API_VERSION = "v1";
27946
28157
  const AuthProvider = ({
27947
28158
  children,
27948
- sdkToken: initialSdkToken,
27949
- refreshToken,
28159
+ sdkToken: sdkToken2,
28160
+ getSdkToken: getSdkToken2,
27950
28161
  clientKey,
27951
28162
  loadingContext
27952
28163
  }) => {
27953
- const autheBase = `${loadingContext}authe/api/${AUTHE_API_VERSION}/`;
27954
- const sdkToken = useSdkToken({
27955
- initialSdkToken,
27956
- refreshToken,
27957
- autheBase
27958
- });
27959
28164
  const contextValue = useMemo(() => {
27960
- if (sdkToken && refreshToken) {
28165
+ if (sdkToken2 && getSdkToken2) {
27961
28166
  return {
27962
28167
  isEmbeddedDropin: true,
27963
- sdkToken,
27964
28168
  loadingContext: `${loadingContext}onboardingcomponents/`
27965
28169
  };
27966
28170
  }
@@ -27971,8 +28175,8 @@ const AuthProvider = ({
27971
28175
  loadingContext
27972
28176
  };
27973
28177
  }
27974
- throw new Error("Must provide either `sdkToken` and `refreshToken` or `clientKey`");
27975
- }, [sdkToken, clientKey]);
28178
+ throw new Error("Must provide either `sdkToken` and `getSdkToken` or `clientKey`");
28179
+ }, [sdkToken2, clientKey]);
27976
28180
  return jsx(AuthContext.Provider, {
27977
28181
  value: contextValue,
27978
28182
  children
@@ -27990,7 +28194,6 @@ const getPayoutAccountFormat = async (country2) => getAccountFormatsForCountry(c
27990
28194
  const getAllowedLocales$1 = async (context) => {
27991
28195
  const {
27992
28196
  loadingContext,
27993
- sdkToken,
27994
28197
  legalEntityId
27995
28198
  } = context;
27996
28199
  return httpGet({
@@ -27998,7 +28201,7 @@ const getAllowedLocales$1 = async (context) => {
27998
28201
  errorLevel: "warn",
27999
28202
  errorMessage: `Supported locales not available`,
28000
28203
  path: `${legalEntityId}/configurations/supportedLocales`,
28001
- sdkToken,
28204
+ authentication: "jwt",
28002
28205
  headers: {
28003
28206
  "Content-Type": "application/json"
28004
28207
  }
@@ -28006,15 +28209,13 @@ const getAllowedLocales$1 = async (context) => {
28006
28209
  };
28007
28210
  const getEmbeddedApi = ({
28008
28211
  base,
28009
- sdkToken,
28010
28212
  rootLegalEntityId
28011
28213
  }) => {
28012
28214
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
28013
28215
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
28014
28216
  const baseRequestContext = {
28015
28217
  loadingContext: loadingContextWithRootLEAuth,
28016
- legalEntityId: rootLegalEntityId,
28017
- sdkToken
28218
+ legalEntityId: rootLegalEntityId
28018
28219
  };
28019
28220
  return {
28020
28221
  getConfiguration: async ({
@@ -28337,7 +28538,6 @@ const ConfigurationApiProvider = ({
28337
28538
  const authContext = useAuthContext();
28338
28539
  const contextValue = useMemo(() => authContext.isEmbeddedDropin ? getEmbeddedApi({
28339
28540
  base: authContext.loadingContext,
28340
- sdkToken: authContext.sdkToken,
28341
28541
  rootLegalEntityId
28342
28542
  }) : getKycExternalApi({
28343
28543
  loadingContext: authContext.loadingContext,
@@ -28621,7 +28821,7 @@ class UIElement extends BaseElement {
28621
28821
  const Component = this.props.component;
28622
28822
  return jsx(AuthProvider, {
28623
28823
  sdkToken: this.props.sdkToken,
28624
- refreshToken: this.props.refreshToken,
28824
+ getSdkToken: this.props.getSdkToken,
28625
28825
  clientKey: this.props.clientKey,
28626
28826
  loadingContext: this.props.loadingContext,
28627
28827
  children: jsx(ConfigurationApiProvider, {
@@ -29188,10 +29388,10 @@ const validateComponentName = (componentName) => {
29188
29388
  const validateCoreOptions = (coreOptions) => {
29189
29389
  const requiredOptions = ["locale", "environment", "country"];
29190
29390
  const missing = requiredOptions.filter((option) => !coreOptions[option]);
29191
- if (!(coreOptions.sdkToken && coreOptions.refreshToken) && !coreOptions.clientKey) {
29391
+ if (!(coreOptions.sdkToken && coreOptions.getSdkToken) && !coreOptions.clientKey) {
29192
29392
  throw new Error(`
29193
29393
 
29194
- Please specify either sdkToken and a refreshToken or a clientKey for the SDK to initialize!
29394
+ Please specify either sdkToken and getSdkToken handler or a clientKey for the SDK to initialize!
29195
29395
 
29196
29396
 
29197
29397
  - For more information please check: https://github.com/Adyen/adyen-kyc-components#configuration.`);
@@ -29328,7 +29528,14 @@ class Core {
29328
29528
  newOptions.locale = FALLBACK_LOCALE;
29329
29529
  return newOptions;
29330
29530
  };
29531
+ this.initializeSession = () => {
29532
+ if (this.options.sdkToken && this.options.getSdkToken) {
29533
+ setSdkToken(this.options.sdkToken);
29534
+ setSdkTokenHandler(this.options.getSdkToken);
29535
+ }
29536
+ };
29331
29537
  this.options = this.getUpdatedOptions(coreOptions);
29538
+ this.initializeSession();
29332
29539
  }
29333
29540
  }
29334
29541
  export {