@adyen/kyc-components 3.0.0-beta.13 → 3.0.0-beta.15

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 (64) hide show
  1. package/dist/es/adyen-kyc-components.es.js +827 -493
  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/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverviewItem/ManageTransferInstrumentOverviewItem.d.ts +1 -1
  6. package/dist/types/components/IdDocumentUpload/types.d.ts +4 -3
  7. package/dist/types/components/PayoutAccount/helpers/mapPayoutAccountSchemaToApiBankAccount.d.ts +2 -0
  8. package/dist/types/components/PayoutAccount/types.d.ts +2 -0
  9. package/dist/types/components/PayoutBankStatement/types.d.ts +2 -1
  10. package/dist/types/components/PayoutDetails/types.d.ts +1 -0
  11. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/ProofOfIdentityCard.d.ts +1 -1
  12. package/dist/types/components/TrustMembers/types.d.ts +6 -2
  13. package/dist/types/components/TrustRoleAndEntityType/types.d.ts +9 -0
  14. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  15. package/dist/types/components/internal/Button/types.d.ts +2 -2
  16. package/dist/types/components/internal/CountryField/CountryField.d.ts +2 -2
  17. package/dist/types/components/internal/FormFields/Dropzone/FilePicker.d.ts +3 -2
  18. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +2 -6
  19. package/dist/types/components/internal/FormFields/Dropzone/validate.d.ts +2 -1
  20. package/dist/types/components/internal/LegalCompanyNameField/LegalCompanyNameField.d.ts +2 -3
  21. package/dist/types/components/internal/Remove/types.d.ts +1 -1
  22. package/dist/types/components/internal/StateField/StateField.d.ts +2 -2
  23. package/dist/types/core/Context/AuthContext/AuthContext.d.ts +0 -1
  24. package/dist/types/core/Context/AuthContext/AuthProvider.d.ts +5 -2
  25. package/dist/types/core/Context/ConfigurationApiContext/ConfigurationApiContext.d.ts +3 -1
  26. package/dist/types/core/Context/ConfigurationApiContext/getEmbeddedApi.d.ts +1 -2
  27. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  28. package/dist/types/core/Context/StateContext/types.d.ts +1 -0
  29. package/dist/types/core/Services/kycExternalApi/account-identification.d.ts +4 -0
  30. package/dist/types/core/Services/kycExternalApi/company-deep-search.d.ts +2 -4
  31. package/dist/types/core/Services/kycExternalApi/company-index-search.d.ts +2 -4
  32. package/dist/types/core/Services/kycExternalApi/get-company-data.d.ts +2 -4
  33. package/dist/types/core/Services/kycExternalApi/index.d.ts +1 -0
  34. package/dist/types/core/Services/kycExternalApi/refresh-company-data.d.ts +2 -4
  35. package/dist/types/core/Services/kycExternalApi/verify-tin.d.ts +2 -4
  36. package/dist/types/core/Services/session.d.ts +5 -0
  37. package/dist/types/core/Services/types.d.ts +1 -2
  38. package/dist/types/core/Services/utils.d.ts +3 -0
  39. package/dist/types/core/core.d.ts +1 -0
  40. package/dist/types/core/hooks/useAsyncAccountDetailsValidationRules.d.ts +3 -0
  41. package/dist/types/core/hooks/useForm/types.d.ts +23 -8
  42. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  43. package/dist/types/core/hooks/useForm/utils.d.ts +12 -1
  44. package/dist/types/core/models/api/company-search.d.ts +18 -22
  45. package/dist/types/core/models/api/organization.d.ts +6 -6
  46. package/dist/types/core/models/country-code.d.ts +1 -1
  47. package/dist/types/core/models/errors/validation-error.d.ts +4 -0
  48. package/dist/types/core/models/file.d.ts +8 -0
  49. package/dist/types/core/models/state-code.d.ts +32 -1
  50. package/dist/types/core/types.d.ts +2 -1
  51. package/dist/types/language/config.d.ts +23 -15
  52. package/dist/types/utils/api/documentUtils.d.ts +3 -2
  53. package/dist/types/utils/company-util.d.ts +2 -1
  54. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  55. package/dist/types/utils/entity-status-util.d.ts +2 -2
  56. package/dist/types/utils/formUtils.d.ts +11 -3
  57. package/dist/types/utils/mapping/mapping.d.ts +2 -0
  58. package/dist/types/utils/trust-util.d.ts +1 -1
  59. package/dist/types/utils/trustMembers/handlers/createExemptSettlor.d.ts +4 -0
  60. package/dist/types/utils/trustMembers/handlers/updateExemptSettlorName.d.ts +4 -0
  61. package/dist/types/utils/validatorUtils.d.ts +5 -0
  62. package/package.json +1 -1
  63. package/dist/types/core/Services/auth/refresh-sdkToken.d.ts +0 -6
  64. 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.";
@@ -303,6 +299,10 @@ const bankCityTown = "Bank city/town";
303
299
  const clearingCode = "Clearing code";
304
300
  const bankCode = "Bank code";
305
301
  const bankName = "Bank name";
302
+ const accountNumber = "Account number";
303
+ const bsbCode = "Bank State Branch (BSB) code";
304
+ const branchNumber = "Branch Number";
305
+ const clearingNumber = "Clearing Number";
306
306
  const achRoutingNumber = "ACH routing number";
307
307
  const decisionMaker = "Decision-makers";
308
308
  const decisionMakerDescription = "Provide the information of the owners, controlling persons, and signatories in your company. Keep in mind that one person may hold multiple roles. The requirements are as follows:";
@@ -457,7 +457,7 @@ const ICO = "IČO (Identifikační číslo)";
457
457
  const handelsregisternummer = "Handelsregisternummer";
458
458
  const NumeroDeTVA = "Numéro de TVA";
459
459
  const organisasjonsnummer = "Organisasjonsnummer";
460
- const skattenummer = "Skattenummer";
460
+ const mvanummer = "MVA nummer";
461
461
  const verificationErrorMessage = "Some information couldn’t be verified. Click to see what needs to be adjusted.";
462
462
  const remediationFormErrorMessage = "Some information couldn’t be verified. Information in this form may need to be adjusted.";
463
463
  const youHaveUnsavedChanges = "You have unsaved changes";
@@ -591,6 +591,8 @@ const solePropDetails = "Sole proprietor details";
591
591
  const soleProprietorDetails = "Sole proprietor details";
592
592
  const selectAccountHolder = "Select account holder";
593
593
  const nameOfBankAccountHolder = "We need to know about the bank account where you want to receive your payouts. What is the name of the account holder of that bank account?";
594
+ const enterValidAccountDetails = "Please enter valid account details";
595
+ const enterValid_ = "Please enter valid: %{fieldNames}";
594
596
  const myName = "My name";
595
597
  const myNameDescription = "It’s a personal bank account held in my own name";
596
598
  const mySoleProprietorName = "My sole proprietor name";
@@ -676,12 +678,12 @@ const documentIssuedWithinLastYear = "Note! The document needs to be issued with
676
678
  const learnMore = "Learn more";
677
679
  const doingBusinessAsNameFiling = "Doing business as-name filling";
678
680
  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?";
681
+ const areYouACompany = "Are you a company?";
682
+ 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.";
683
+ const wouldYouLikeToSignUpAsCompanyInstead = "Would you like to sign up as a company instead? (You’ll have to re-enter some information from before.)";
684
+ const areYouAnIndividual = "Are you an individual?";
685
+ 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.";
686
+ const wouldYouLikeToSignUpAsIndividualInstead = "Would you like to sign up as an individual instead? (You’ll have to re-enter some information from before.)";
685
687
  const noGoBack = "No, go back";
686
688
  const continueCompany = "Continue as company";
687
689
  const continueIndividual = "Continue as individual";
@@ -692,7 +694,6 @@ const addresses = "Addresses";
692
694
  const loading = "Loading";
693
695
  const businessIncorporationNumber = "Business incorporation number";
694
696
  const doNotHaveBusinessIncorporationNumber = "I do not have a Business incorporation number";
695
- const socialInsuranceNumber = "Social insurance number";
696
697
  const verificationMethod = "Verification method";
697
698
  const verifyViaMobileBankAppOrBankWebsite = "Verify the account via mobile bank app or bank website";
698
699
  const provideAccountDetailsAndUploadBankStatement = "Provide account details and upload a scan of a bank statement";
@@ -761,6 +762,13 @@ const passportPhotoPage = "Passport photo page";
761
762
  const residencePermitBack = "Residence permit (back)";
762
763
  const residencePermitFront = "Residence permit (front)";
763
764
  const manualUpload = "Manual upload";
765
+ const legalCompanyName = "Legal name of the company";
766
+ const legalCompanyName__helperText = "Enter the name exactly as it is on your company's official registration documents.";
767
+ const legalCompanyName__helperText__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC).";
768
+ const legalCompanyName__helperText__NL = "Enter the name exactly as it is on your Chamber of Commerce registration.";
769
+ const legalCompanyName__helperText__US = "Enter the name exactly as it appears on your Secretary of State Registration.";
770
+ const legalCompanyName__helperText__SG = "Enter the name exactly as it is on your Accounting and Corporate Regulatory Authority (ACRA) BizFile.";
771
+ const legalCompanyName__helperText__HK = "Enter the name exactly as it is on your Hong Kong Companies Registry's Certificate of Incorporation.";
764
772
  const errorMessage_1_10 = "Information couldn’t be verified";
765
773
  const errorMessage_1_11 = "Document didn’t meet requirements";
766
774
  const errorMessage_1_12 = "Legal entity declined";
@@ -1133,6 +1141,7 @@ const defaultTrans = {
1133
1141
  individualDetails,
1134
1142
  socialSecurityNumber,
1135
1143
  socialSecurityNumber9Digits,
1144
+ socialInsuranceNumber,
1136
1145
  codiceFiscale,
1137
1146
  personnummer,
1138
1147
  dni,
@@ -1192,6 +1201,8 @@ const defaultTrans = {
1192
1201
  dateOfIncorporation,
1193
1202
  passportExpiryDate,
1194
1203
  proofOfNationality,
1204
+ identityNumberExempt__US,
1205
+ identityNumberExempt__CA,
1195
1206
  uploadDocumentForSsn,
1196
1207
  uploadDocumentForNric,
1197
1208
  operationalAddressHeader,
@@ -1295,13 +1306,6 @@ const defaultTrans = {
1295
1306
  byClickingSubmitReview,
1296
1307
  nameAndCountry,
1297
1308
  companyCountry,
1298
- legalCompanyName,
1299
- legalCompanyNameHelper,
1300
- legalCompanyNameHelper__AU,
1301
- legalCompanyNameHelper__NL,
1302
- legalCompanyNameHelper__US,
1303
- legalCompanyNameHelper__SG,
1304
- legalCompanyNameHelper__HK,
1305
1309
  accountDetailsDescription,
1306
1310
  provideDetails,
1307
1311
  payoutAccountsDescription,
@@ -1374,6 +1378,10 @@ const defaultTrans = {
1374
1378
  clearingCode,
1375
1379
  bankCode,
1376
1380
  bankName,
1381
+ accountNumber,
1382
+ bsbCode,
1383
+ branchNumber,
1384
+ clearingNumber,
1377
1385
  achRoutingNumber,
1378
1386
  decisionMaker,
1379
1387
  decisionMakerDescription,
@@ -1531,7 +1539,7 @@ const defaultTrans = {
1531
1539
  handelsregisternummer,
1532
1540
  NumeroDeTVA,
1533
1541
  organisasjonsnummer,
1534
- skattenummer,
1542
+ mvanummer,
1535
1543
  verificationErrorMessage,
1536
1544
  remediationFormErrorMessage,
1537
1545
  youHaveUnsavedChanges,
@@ -1667,6 +1675,8 @@ const defaultTrans = {
1667
1675
  soleProprietorDetails,
1668
1676
  selectAccountHolder,
1669
1677
  nameOfBankAccountHolder,
1678
+ enterValidAccountDetails,
1679
+ enterValid_,
1670
1680
  myName,
1671
1681
  myNameDescription,
1672
1682
  mySoleProprietorName,
@@ -1761,12 +1771,12 @@ const defaultTrans = {
1761
1771
  learnMore,
1762
1772
  doingBusinessAsNameFiling,
1763
1773
  taxFiling,
1764
- continueAsCompany,
1765
- continueAsIndividual,
1766
- indicatedPayoutToCompany,
1767
- continueSigningUpAsCompany,
1768
- indicatedPayoutToPersonalAccount,
1769
- continueSigningUpAsIndividual,
1774
+ areYouACompany,
1775
+ singingUpAsIndividualButLooksLikeYouAreACompany,
1776
+ wouldYouLikeToSignUpAsCompanyInstead,
1777
+ areYouAnIndividual,
1778
+ singingUpAsCompanyButLooksLikeYouAreAnIndividual,
1779
+ wouldYouLikeToSignUpAsIndividualInstead,
1770
1780
  "continue": "Continue",
1771
1781
  noGoBack,
1772
1782
  continueCompany,
@@ -1778,7 +1788,6 @@ const defaultTrans = {
1778
1788
  loading,
1779
1789
  businessIncorporationNumber,
1780
1790
  doNotHaveBusinessIncorporationNumber,
1781
- socialInsuranceNumber,
1782
1791
  verificationMethod,
1783
1792
  verifyViaMobileBankAppOrBankWebsite,
1784
1793
  provideAccountDetailsAndUploadBankStatement,
@@ -1849,6 +1858,13 @@ const defaultTrans = {
1849
1858
  residencePermitBack,
1850
1859
  residencePermitFront,
1851
1860
  manualUpload,
1861
+ legalCompanyName,
1862
+ legalCompanyName__helperText,
1863
+ legalCompanyName__helperText__AU,
1864
+ legalCompanyName__helperText__NL,
1865
+ legalCompanyName__helperText__US,
1866
+ legalCompanyName__helperText__SG,
1867
+ legalCompanyName__helperText__HK,
1852
1868
  errorMessage_1_10,
1853
1869
  errorMessage_1_11,
1854
1870
  errorMessage_1_12,
@@ -2391,12 +2407,26 @@ const useCoreContext = () => {
2391
2407
  return context;
2392
2408
  };
2393
2409
  const Summary$1 = "";
2410
+ const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
2411
+ a[c] = obj[c];
2412
+ return a;
2413
+ }, {});
2414
+ const addKeys = (obj, add2, initialValue, defaultData, pendingData) => add2.reduce((a, c) => ({
2415
+ ...a,
2416
+ [c]: a[c] ?? (pendingData == null ? void 0 : pendingData[c]) ?? (defaultData == null ? void 0 : defaultData[c]) ?? initialValue
2417
+ }), obj);
2418
+ function getDataByFields(formData, fieldKeys) {
2419
+ return entriesOf(formData).reduce((acc, [key, val]) => {
2420
+ if (fieldKeys.includes(key)) {
2421
+ return {
2422
+ ...acc,
2423
+ [key]: val
2424
+ };
2425
+ }
2426
+ return acc;
2427
+ }, {});
2428
+ }
2394
2429
  const formUtilities = (props, i18n) => ({
2395
- getPlaceholder: (field, fallbackPlaceholderKey) => {
2396
- var _a, _b;
2397
- const translationKey = fallbackPlaceholderKey ? ((_a = props.placeholders) == null ? void 0 : _a[field]) ?? fallbackPlaceholderKey : (_b = props.placeholders) == null ? void 0 : _b[field];
2398
- return translationKey ? i18n.get(translationKey) : "";
2399
- },
2400
2430
  getLabel: (field, fallbackLabelKey) => {
2401
2431
  var _a, _b;
2402
2432
  let translationKey = ((_a = props.labels) == null ? void 0 : _a[field]) ?? fallbackLabelKey ?? field;
@@ -2412,6 +2442,11 @@ const formUtilities = (props, i18n) => ({
2412
2442
  }
2413
2443
  return i18n.get(translationKey);
2414
2444
  },
2445
+ getPlaceholder: (field, fallbackPlaceholderKey) => {
2446
+ var _a, _b;
2447
+ const translationKey = fallbackPlaceholderKey ? ((_a = props.placeholders) == null ? void 0 : _a[field]) ?? fallbackPlaceholderKey : (_b = props.placeholders) == null ? void 0 : _b[field];
2448
+ return translationKey ? i18n.get(translationKey) : "";
2449
+ },
2415
2450
  getHelperText: (field, fallbackHelperTextKey) => {
2416
2451
  var _a, _b;
2417
2452
  const translationKey = fallbackHelperTextKey ? ((_a = props.helperText) == null ? void 0 : _a[field]) ?? fallbackHelperTextKey : (_b = props.helperText) == null ? void 0 : _b[field];
@@ -2451,7 +2486,70 @@ const formUtilities = (props, i18n) => ({
2451
2486
  return i18n.get(translationKey, translationObject);
2452
2487
  }
2453
2488
  return errorMessage ? i18n.get(errorMessage) : Boolean(fieldProblems == null ? void 0 : fieldProblems[field]);
2454
- }
2489
+ },
2490
+ getFieldData: (formData, fieldKeys) => getDataByFields(formData, fieldKeys),
2491
+ getFieldValid: (formValid, fieldKeys) => entriesOf(formValid).reduce((acc, [key, val]) => fieldKeys.includes(key) ? {
2492
+ ...acc,
2493
+ [key]: val
2494
+ } : acc, {}),
2495
+ getFieldErrors: (formErrors, fieldProblems, fieldKeys) => Object.keys(formErrors).reduce((acc, key) => {
2496
+ var _a;
2497
+ if (fieldKeys.includes(key)) {
2498
+ const error = (_a = formErrors == null ? void 0 : formErrors[key]) == null ? void 0 : _a.errorMessage;
2499
+ if (typeof error === "object") {
2500
+ const {
2501
+ translationKey,
2502
+ translationObject
2503
+ } = error;
2504
+ return {
2505
+ ...acc,
2506
+ [key]: i18n.get(translationKey, translationObject)
2507
+ };
2508
+ }
2509
+ return error ? {
2510
+ ...acc,
2511
+ [key]: i18n.get(error)
2512
+ } : {
2513
+ ...acc,
2514
+ [key]: Boolean(fieldProblems == null ? void 0 : fieldProblems[key])
2515
+ };
2516
+ }
2517
+ return acc;
2518
+ }, {}),
2519
+ getFieldLabels: (fieldKeys, fallbackLabelKeys) => fieldKeys.reduce((acc, field) => {
2520
+ var _a, _b;
2521
+ let translationKey = ((_a = props.labels) == null ? void 0 : _a[field]) ?? (fallbackLabelKeys == null ? void 0 : fallbackLabelKeys[field]) ?? field;
2522
+ if (props.labels && !((_b = props.labels) == null ? void 0 : _b[field]) && Object.keys(props.labels).length) {
2523
+ const parentKey = Object.keys(props.labels).find((fieldKey) => {
2524
+ var _a2;
2525
+ return typeof ((_a2 = props.labels) == null ? void 0 : _a2[fieldKey]) === "object";
2526
+ });
2527
+ if (parentKey) {
2528
+ const nestedLabel = props.labels[parentKey][field];
2529
+ translationKey = nestedLabel ?? translationKey;
2530
+ }
2531
+ }
2532
+ return {
2533
+ ...acc,
2534
+ [field]: i18n.get(translationKey)
2535
+ };
2536
+ }, {}),
2537
+ getFieldPlaceholders: (fieldKeys, fallbackPlaceholderKeys) => fieldKeys.reduce((acc, field) => {
2538
+ var _a, _b;
2539
+ 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];
2540
+ return translationKey ? {
2541
+ ...acc,
2542
+ [field]: i18n.get(translationKey)
2543
+ } : acc;
2544
+ }, {}),
2545
+ getFieldHelperText: (fieldKeys, fallbackHelperTextKeys) => fieldKeys.reduce((acc, field) => {
2546
+ var _a, _b;
2547
+ 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];
2548
+ return translationKey ? {
2549
+ ...acc,
2550
+ [field]: i18n.get(translationKey)
2551
+ } : acc;
2552
+ }, {})
2455
2553
  });
2456
2554
  const MAX_LENGTH = 30;
2457
2555
  const getMaxLengthByFormatRuleset = (formattingRules, field) => {
@@ -2524,6 +2622,14 @@ function mergeCountryBasedRulesets(defaultRuleset, countryBasedRuleset, country2
2524
2622
  }
2525
2623
  const isUndefinedOrNull = (input) => !!(input === void 0 || input === null);
2526
2624
  const isEmpty = (input) => !!(isUndefinedOrNull(input) || typeof input === "object" && Object.keys(input).length === 0 || typeof input === "string" && /^[\s]*$/.test(input));
2625
+ const hasEmptyFields = (input) => input && (Object.keys(input).length === 0 || Object.values(input).some((value) => value === void 0 || value === null || value === ""));
2626
+ const extractFieldName = (inputString) => {
2627
+ const fieldNames = inputString == null ? void 0 : inputString.split(".");
2628
+ const fieldName = (fieldNames == null ? void 0 : fieldNames.length) > 0 ? fieldNames[fieldNames.length - 1] : "";
2629
+ return fieldName;
2630
+ };
2631
+ const mapKeyToFieldName = (i18n, key) => i18n == null ? void 0 : i18n.get(key);
2632
+ const concatenateFieldNames = (fieldNames) => fieldNames == null ? void 0 : fieldNames.join(", ");
2527
2633
  const isString = (input) => typeof input === "string" || input instanceof String;
2528
2634
  const hasText = (input) => isString(input) && !isEmpty(input);
2529
2635
  const SPECIAL_CHARS = "?\\-\\+_=!@#$%^&*(){}~<>\\[\\]\\/\\\\";
@@ -3069,14 +3175,6 @@ function useResetGlobalData(caller) {
3069
3175
  }
3070
3176
  }), [dispatch, caller]);
3071
3177
  }
3072
- const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
3073
- a[c] = obj[c];
3074
- return a;
3075
- }, {});
3076
- const addKeys = (obj, add2, initialValue, defaultData, pendingData) => add2.reduce((a, c) => ({
3077
- ...a,
3078
- [c]: a[c] ?? (pendingData == null ? void 0 : pendingData[c]) ?? (defaultData == null ? void 0 : defaultData[c]) ?? initialValue
3079
- }), obj);
3080
3178
  const processField = ({
3081
3179
  key,
3082
3180
  value = null,
@@ -3491,6 +3589,7 @@ function useForm({
3491
3589
  asyncRules,
3492
3590
  fieldProblems,
3493
3591
  maskedFields,
3592
+ optionalFields,
3494
3593
  formatters,
3495
3594
  shouldValidate = false
3496
3595
  }) {
@@ -3502,20 +3601,26 @@ function useForm({
3502
3601
  asyncValidationResults
3503
3602
  } = useAsyncValidator(asyncRules);
3504
3603
  const getRequiredFields = useMemo(() => typeof schema === "function" ? schema : () => schema, [schema]);
3604
+ const getSchema = useMemo(() => {
3605
+ if (optionalFields) {
3606
+ return defaultData ? [...getRequiredFields(defaultData), ...optionalFields] : [];
3607
+ }
3608
+ return defaultData ? getRequiredFields(defaultData) : [];
3609
+ }, [optionalFields, defaultData, getRequiredFields]);
3505
3610
  const getReducer = useCallback(() => reducer({
3506
3611
  staticValidate: triggerStaticValidation,
3507
3612
  asyncValidate: triggerAsyncValidation,
3508
3613
  formatters
3509
3614
  }), [triggerStaticValidation, triggerAsyncValidation, formatters]);
3510
3615
  const getInitialData = useCallback(() => ({
3511
- schema: defaultData ? getRequiredFields(defaultData) : [],
3616
+ schema: getSchema,
3512
3617
  defaultData,
3513
3618
  fieldProblems,
3514
3619
  maskedFields,
3515
3620
  formatters,
3516
3621
  staticValidate: triggerStaticValidation,
3517
3622
  asyncValidate: triggerAsyncValidation
3518
- }), [defaultData, fieldProblems, maskedFields, formatters, getRequiredFields, triggerStaticValidation, triggerAsyncValidation]);
3623
+ }), [getSchema, defaultData, fieldProblems, maskedFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
3519
3624
  const [state2, dispatch] = useReducer(getReducer(), getInitialData(), init);
3520
3625
  const isValid = useMemo(() => {
3521
3626
  var _a;
@@ -4850,12 +4955,12 @@ const Select = ({
4850
4955
  });
4851
4956
  };
4852
4957
  const logger$m = createLogger("CountryField");
4853
- const COUNTRY_FIELD = "country";
4958
+ const COUNTRY_FIELD = ["country"];
4854
4959
  function CountryField({
4855
4960
  data,
4856
4961
  valid,
4857
- error,
4858
- label,
4962
+ errors,
4963
+ labels: labels2,
4859
4964
  readonly,
4860
4965
  handleChangeFor,
4861
4966
  helperText,
@@ -4878,27 +4983,21 @@ function CountryField({
4878
4983
  ...item,
4879
4984
  sprite: `#adl-flag-${item.id.toLowerCase()}`
4880
4985
  }));
4881
- const handleCompanyChangeFor = useCallback((e) => {
4882
- const {
4883
- value
4884
- } = e.target;
4885
- handleChangeFor(COUNTRY_FIELD)(value);
4886
- }, [handleChangeFor]);
4887
4986
  return jsx(Field, {
4888
- name: COUNTRY_FIELD,
4889
- label: label || i18n.get(COUNTRY_FIELD),
4890
- errorMessage: error,
4987
+ name: "country",
4988
+ label: (labels2 == null ? void 0 : labels2.country) || i18n.get("country"),
4989
+ errorMessage: errors.country,
4891
4990
  classNameModifiers,
4892
- isValid: valid,
4893
- helper: helperText,
4991
+ isValid: valid.country,
4992
+ helper: helperText == null ? void 0 : helperText.country,
4894
4993
  children: (childProps) => jsx(Select, {
4895
4994
  ...childProps,
4896
- name: COUNTRY_FIELD,
4995
+ name: "country",
4897
4996
  placeholder: i18n.get("selectCountry"),
4898
- selected: data,
4997
+ selected: data.country,
4899
4998
  items: countries,
4900
4999
  readonly: (countries.length === 1 || readonly) && !!data,
4901
- onChange: handleCompanyChangeFor
5000
+ onChange: handleChangeFor("country")
4902
5001
  })
4903
5002
  });
4904
5003
  }
@@ -5030,46 +5129,34 @@ const InputText = forwardRef(({
5030
5129
  );
5031
5130
  });
5032
5131
  InputText.displayName = "InputText";
5033
- const LEGAL_COMPANY_NAME_FIELD = "legalCompanyName";
5132
+ const LEGAL_COMPANY_NAME_FIELD = ["legalCompanyName"];
5034
5133
  function LegalCompanyNameField({
5035
5134
  data,
5036
5135
  valid,
5037
- error,
5038
- label,
5136
+ errors,
5137
+ labels: labels2,
5039
5138
  helperText,
5040
5139
  readonly,
5041
5140
  handleChangeFor
5042
5141
  }) {
5043
- const handleLegalCompanyNameInput = useCallback((e) => {
5044
- const {
5045
- value
5046
- } = e.target;
5047
- handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "input")(value);
5048
- }, [handleChangeFor]);
5049
- const handleLegalCompanyNameBlur = useCallback((e) => {
5050
- const {
5051
- value
5052
- } = e.target;
5053
- handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "blur")(value);
5054
- }, [handleChangeFor]);
5055
5142
  return jsx(Field, {
5056
- name: LEGAL_COMPANY_NAME_FIELD,
5057
- label,
5058
- helper: helperText,
5059
- classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
5060
- errorMessage: error,
5061
- isValid: valid,
5143
+ name: "legalCompanyName",
5144
+ label: labels2.legalCompanyName,
5145
+ helper: helperText == null ? void 0 : helperText.legalCompanyName,
5146
+ errorMessage: errors.legalCompanyName,
5147
+ isValid: valid.legalCompanyName,
5148
+ classNameModifiers: ["legalCompanyName"],
5062
5149
  children: (childProps) => jsx(InputText, {
5063
5150
  ...childProps,
5064
5151
  "aria-required": true,
5065
- "aria-label": label,
5066
- "aria-invalid": !valid,
5067
- name: LEGAL_COMPANY_NAME_FIELD,
5068
- value: data,
5152
+ "aria-label": labels2.legalCompanyName,
5153
+ "aria-invalid": !valid.legalCompanyName,
5154
+ name: "legalCompanyName",
5155
+ value: data.legalCompanyName,
5069
5156
  readonly,
5070
- classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
5071
- onInput: handleLegalCompanyNameInput,
5072
- onBlur: handleLegalCompanyNameBlur
5157
+ classNameModifiers: ["legalCompanyName"],
5158
+ onInput: handleChangeFor("legalCompanyName", "input"),
5159
+ onBlur: handleChangeFor("legalCompanyName", "blur")
5073
5160
  })
5074
5161
  });
5075
5162
  }
@@ -5112,7 +5199,7 @@ const companyCountryValidationRules = {
5112
5199
  errorMessage: "fieldIsRequired"
5113
5200
  }
5114
5201
  };
5115
- const companyNameAndCountryFields = [LEGAL_COMPANY_NAME_FIELD, COUNTRY_FIELD];
5202
+ const companyNameAndCountryFields = [...LEGAL_COMPANY_NAME_FIELD, ...COUNTRY_FIELD];
5116
5203
  function CompanyNameAndCountry(props) {
5117
5204
  const {
5118
5205
  i18n
@@ -5161,22 +5248,24 @@ function CompanyNameAndCountry(props) {
5161
5248
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
5162
5249
  formUtils,
5163
5250
  id: "ariaErrorField"
5164
- }), formData.country === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
5165
- data: formData.country,
5166
- valid: formValid.country,
5167
- error: formUtils.getErrorMessage(COUNTRY_FIELD, formErrors, formFieldProblems),
5168
- label: formUtils.getLabel(COUNTRY_FIELD),
5251
+ }), formData.country === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField("country") && jsx(CountryField, {
5252
+ data: formUtils.getFieldData(formData, COUNTRY_FIELD),
5253
+ valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
5254
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
5255
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD),
5169
5256
  readonly: !isAllowedEditPrefilledCountry || Boolean(props == null ? void 0 : props.disableCountry),
5170
- classNameModifiers: [COUNTRY_FIELD],
5257
+ classNameModifiers: ["country"],
5171
5258
  allowedCountries: [],
5172
5259
  handleChangeFor
5173
- }), formUtils.isRequiredField(LEGAL_COMPANY_NAME_FIELD) && jsx(LegalCompanyNameField, {
5174
- data: formData.legalCompanyName,
5175
- valid: formValid.legalCompanyName,
5176
- error: formUtils.getErrorMessage(LEGAL_COMPANY_NAME_FIELD, formErrors, formFieldProblems),
5177
- label: formUtils.getLabel(LEGAL_COMPANY_NAME_FIELD),
5178
- helperText: formUtils.getHelperText(LEGAL_COMPANY_NAME_FIELD, "legalCompanyNameHelper"),
5179
- readonly: formUtils.isReadOnly(LEGAL_COMPANY_NAME_FIELD),
5260
+ }), formUtils.isRequiredField("legalCompanyName") && jsx(LegalCompanyNameField, {
5261
+ data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
5262
+ valid: formUtils.getFieldValid(formValid, LEGAL_COMPANY_NAME_FIELD),
5263
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, LEGAL_COMPANY_NAME_FIELD),
5264
+ labels: formUtils.getFieldLabels(LEGAL_COMPANY_NAME_FIELD),
5265
+ helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
5266
+ legalCompanyName: "legalCompanyName__helperText"
5267
+ }),
5268
+ readonly: formUtils.isReadOnly("legalCompanyName"),
5180
5269
  handleChangeFor
5181
5270
  })]
5182
5271
  });
@@ -7896,7 +7985,7 @@ const fieldsPerScenario$3 = {
7896
7985
  const countryConfig$4 = {
7897
7986
  [CountryCodes.Australia]: {
7898
7987
  legalCompanyName: {
7899
- helperText: "legalCompanyNameHelper__AU"
7988
+ helperText: "legalCompanyName__helperText__AU"
7900
7989
  },
7901
7990
  legalEntityType: {
7902
7991
  label: "companyType"
@@ -8092,7 +8181,7 @@ const countryConfig$4 = {
8092
8181
  },
8093
8182
  [CountryCodes.HongKong]: {
8094
8183
  legalCompanyName: {
8095
- helperText: "legalCompanyNameHelper__HK"
8184
+ helperText: "legalCompanyName__helperText__HK"
8096
8185
  },
8097
8186
  legalEntityType: {
8098
8187
  label: "typeOfCompany"
@@ -8251,7 +8340,7 @@ const countryConfig$4 = {
8251
8340
  label: "chamberOfCommerceRegistrationNumber"
8252
8341
  },
8253
8342
  legalCompanyName: {
8254
- helperText: "legalCompanyNameHelper__NL"
8343
+ helperText: "legalCompanyName__helperText__NL"
8255
8344
  },
8256
8345
  exemptedFromVat: {
8257
8346
  label: "vatNumberExempted"
@@ -8291,7 +8380,7 @@ const countryConfig$4 = {
8291
8380
  label: "vatNumberAbsenceReason"
8292
8381
  },
8293
8382
  vatNumber: {
8294
- label: "skattenummer"
8383
+ label: "mvanummer"
8295
8384
  }
8296
8385
  },
8297
8386
  [CountryCodes.Poland]: {
@@ -8382,7 +8471,7 @@ const countryConfig$4 = {
8382
8471
  label: "uen"
8383
8472
  },
8384
8473
  legalCompanyName: {
8385
- helperText: "legalCompanyNameHelper__SG"
8474
+ helperText: "legalCompanyName__helperText__SG"
8386
8475
  },
8387
8476
  legalEntityType: {
8388
8477
  label: "companyType"
@@ -8438,7 +8527,7 @@ const countryConfig$4 = {
8438
8527
  },
8439
8528
  [CountryCodes.UnitedStates]: {
8440
8529
  legalCompanyName: {
8441
- helperText: "legalCompanyNameHelper__US"
8530
+ helperText: "legalCompanyName__helperText__US"
8442
8531
  },
8443
8532
  tradingName: {
8444
8533
  label: "doingBusinessAs"
@@ -8655,14 +8744,14 @@ const rules$3 = ({
8655
8744
  }
8656
8745
  },
8657
8746
  isProofOfResidenceRequired: () => {
8658
- var _a;
8659
- if ((_a = data.proofOfResidence) == null ? void 0 : _a.proofOfResidence) {
8747
+ var _a, _b;
8748
+ if ((_b = (_a = data.proofOfResidence) == null ? void 0 : _a.proofOfResidence) == null ? void 0 : _b.length) {
8660
8749
  return REQUIRED;
8661
8750
  }
8662
8751
  },
8663
8752
  isProofOfNationalIdRequired: () => {
8664
- var _a;
8665
- if ((_a = data.proofOfNationalId) == null ? void 0 : _a.proofOfNationalId) {
8753
+ var _a, _b;
8754
+ if ((_b = (_a = data.proofOfNationalId) == null ? void 0 : _a.proofOfNationalId) == null ? void 0 : _b.length) {
8666
8755
  return REQUIRED;
8667
8756
  }
8668
8757
  },
@@ -9163,6 +9252,8 @@ function bytesToSize(bytes) {
9163
9252
  return `${(bytes / 1024 ** i).toFixed()} ${sizes[i]}`;
9164
9253
  }
9165
9254
  const DropzoneFile$1 = "";
9255
+ const isExistingFile = (file) => "existing" in file && file.existing;
9256
+ const isNewlyUploadedFile = (file) => !isExistingFile(file);
9166
9257
  function DropzoneFile(props) {
9167
9258
  const {
9168
9259
  file,
@@ -9212,7 +9303,7 @@ function DropzoneFile(props) {
9212
9303
  className: "adyen-kyc-dropzone-file__size",
9213
9304
  children: [jsxs("span", {
9214
9305
  children: [i18n.get("complete"), " "]
9215
- }), formatSize(file.size)]
9306
+ }), isNewlyUploadedFile(file) ? formatSize(file.size) : void 0]
9216
9307
  })]
9217
9308
  }), jsx("button", {
9218
9309
  type: "button",
@@ -9232,6 +9323,7 @@ const defaultFileValidationOptions = {
9232
9323
  // 4MB by default
9233
9324
  isOptional: false
9234
9325
  };
9326
+ const filterOnlyNewlyUploadedFiles = (files) => files.filter(isNewlyUploadedFile);
9235
9327
  const fileValidationRules = ({
9236
9328
  allowedFileTypes,
9237
9329
  maxNumberOfFiles,
@@ -9265,7 +9357,7 @@ const fileValidationRules = ({
9265
9357
  validate: (files) => {
9266
9358
  if (!files)
9267
9359
  return true;
9268
- return files.every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
9360
+ return filterOnlyNewlyUploadedFiles(files).every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
9269
9361
  },
9270
9362
  errorMessage: "unsupportedFiletype",
9271
9363
  modes: ["blur", "input"]
@@ -9273,7 +9365,7 @@ const fileValidationRules = ({
9273
9365
  validate: (files) => {
9274
9366
  if (!files)
9275
9367
  return true;
9276
- return files.every((file) => !file.size || file.size < maxSize);
9368
+ return filterOnlyNewlyUploadedFiles(files).every((file) => !file.size || file.size < maxSize);
9277
9369
  },
9278
9370
  errorMessage: "maximumFileSizeExceeded",
9279
9371
  modes: ["blur", "input"]
@@ -9770,12 +9862,11 @@ const mapAddressLabels = (data, datasetUtils) => {
9770
9862
  }
9771
9863
  return data;
9772
9864
  };
9773
- const STATE_FIELD = "stateOrProvince";
9774
9865
  function StateField({
9775
9866
  data,
9776
9867
  valid,
9777
- error,
9778
- label,
9868
+ errors,
9869
+ labels: labels2,
9779
9870
  readonly,
9780
9871
  handleChangeFor,
9781
9872
  selectedCountry,
@@ -9788,30 +9879,24 @@ function StateField({
9788
9879
  dataset: states,
9789
9880
  loaded
9790
9881
  } = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
9791
- const handleStateChangeFor = useCallback((e) => {
9792
- const {
9793
- value
9794
- } = e.target;
9795
- handleChangeFor(STATE_FIELD)(value);
9796
- }, [handleChangeFor]);
9797
- const labelKey = getKeyForField(STATE_FIELD, selectedCountry);
9882
+ const labelKey = getKeyForField("stateOrProvince", selectedCountry);
9798
9883
  const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
9799
9884
  if (!loaded || !states.length)
9800
9885
  return null;
9801
9886
  return jsx(Field, {
9802
- name: STATE_FIELD,
9803
- label: label || i18n.get(labelKey),
9887
+ name: "stateOrProvince",
9888
+ label: (labels2 == null ? void 0 : labels2.stateOrProvince) || i18n.get(labelKey),
9804
9889
  classNameModifiers,
9805
- errorMessage: error,
9806
- isValid: valid,
9890
+ errorMessage: errors.stateOrProvince,
9891
+ isValid: valid.stateOrProvince,
9807
9892
  children: (childProps) => jsx(Select, {
9808
9893
  ...childProps,
9809
- name: STATE_FIELD,
9810
- selected: data,
9894
+ name: "stateOrProvince",
9895
+ selected: data.stateOrProvince,
9811
9896
  placeholder: i18n.get(placeholderKey),
9812
9897
  items: states,
9813
- readonly: readonly && !!data,
9814
- onChange: handleStateChangeFor
9898
+ readonly: readonly && !!data.stateOrProvince,
9899
+ onChange: handleChangeFor("stateOrProvince")
9815
9900
  })
9816
9901
  });
9817
9902
  }
@@ -9840,10 +9925,18 @@ function FieldContainer(props) {
9840
9925
  switch (field) {
9841
9926
  case "country":
9842
9927
  return jsx(CountryField, {
9843
- data: value,
9844
- valid: valid == null ? void 0 : valid.country,
9845
- error: errorMessage,
9846
- label: formUtils.getLabel(field),
9928
+ data: {
9929
+ country: value
9930
+ },
9931
+ valid: {
9932
+ country: valid == null ? void 0 : valid.country
9933
+ },
9934
+ errors: {
9935
+ country: errorMessage
9936
+ },
9937
+ labels: {
9938
+ country: formUtils.getLabel(field)
9939
+ },
9847
9940
  readonly: formUtils.isReadOnly(field),
9848
9941
  classNameModifiers,
9849
9942
  allowedCountries,
@@ -9852,10 +9945,18 @@ function FieldContainer(props) {
9852
9945
  });
9853
9946
  case "stateOrProvince":
9854
9947
  return jsx(StateField, {
9855
- data: value,
9856
- valid: valid == null ? void 0 : valid.stateOrProvince,
9857
- error: errorMessage,
9858
- label: formUtils.getLabel(field),
9948
+ data: {
9949
+ stateOrProvince: value
9950
+ },
9951
+ valid: {
9952
+ stateOrProvince: valid == null ? void 0 : valid.stateOrProvince
9953
+ },
9954
+ errors: {
9955
+ stateOrProvince: errorMessage
9956
+ },
9957
+ labels: {
9958
+ stateOrProvince: formUtils.getLabel(field)
9959
+ },
9859
9960
  readonly: formUtils.isReadOnly(field),
9860
9961
  classNameModifiers,
9861
9962
  selectedCountry: data.country,
@@ -10725,7 +10826,8 @@ function RegistrationAddressComponent(props) {
10725
10826
  heading,
10726
10827
  description: description2,
10727
10828
  handleAddressSearch,
10728
- handleFindAddress
10829
+ handleFindAddress,
10830
+ optionalFields
10729
10831
  } = props;
10730
10832
  const {
10731
10833
  data: formData,
@@ -10738,7 +10840,8 @@ function RegistrationAddressComponent(props) {
10738
10840
  schema: ["operationalAddressIsSame"],
10739
10841
  defaultData: data,
10740
10842
  rules: validators || registrationAddressValidationRules,
10741
- maskedFields: []
10843
+ maskedFields: [],
10844
+ optionalFields
10742
10845
  });
10743
10846
  const formUtils = formUtilities(props, i18n);
10744
10847
  const stateRef = useRef({
@@ -11115,9 +11218,10 @@ const createDocumentRequest = async ({
11115
11218
  description: description2,
11116
11219
  existingDocument
11117
11220
  }) => {
11118
- const promises = [fileToBase64(page1), fileToBase64(page2)].filter(Boolean);
11119
- const [encodedFront, encodedBack] = await Promise.all(promises);
11120
- if (!encodedFront) {
11221
+ const pagesToUpload = [page1, page2].filter((page) => page !== void 0 && isNewlyUploadedFile(page));
11222
+ const [page1ToUpload, page2ToUpload] = pagesToUpload;
11223
+ const [encodedPage1, encodedPage2] = await Promise.all(pagesToUpload.map(fileToBase64));
11224
+ if (!encodedPage1) {
11121
11225
  if (existingDocument && existingDocument.description !== description2) {
11122
11226
  return {
11123
11227
  owner: {
@@ -11137,7 +11241,7 @@ const createDocumentRequest = async ({
11137
11241
  },
11138
11242
  type: documentType2,
11139
11243
  description: description2 || `Document type: ${documentType2}`,
11140
- attachments: [...page1 && page2 && encodedFront && encodedBack ? [createAttachment(encodedFront, page1.name, "front"), createAttachment(encodedBack, page2.name, "back")] : [createAttachment(encodedFront, page1.name)]]
11244
+ attachments: [...page1ToUpload && page2ToUpload && encodedPage1 && encodedPage2 ? [createAttachment(encodedPage1, page1ToUpload.name, "front"), createAttachment(encodedPage2, page2ToUpload.name, "back")] : [createAttachment(encodedPage1, page1ToUpload.name)]]
11141
11245
  };
11142
11246
  };
11143
11247
  const createAttachment = (content, pageName, pageType) => ({
@@ -11158,15 +11262,10 @@ const hasDocumentChanged = (newDocument, entityId) => {
11158
11262
  return true;
11159
11263
  };
11160
11264
  const fileToBase64 = (file) => new Promise((resolve, reject) => {
11161
- if (!file || !(file instanceof Blob)) {
11162
- resolve();
11163
- return;
11164
- }
11165
11265
  const reader = new FileReader();
11166
11266
  reader.readAsDataURL(file);
11167
11267
  reader.onload = () => {
11168
- var _a;
11169
- const base64String = (_a = reader.result) == null ? void 0 : _a.toString().split(";base64,")[1];
11268
+ const base64String = reader.result.toString().split(";base64,")[1];
11170
11269
  resolve(base64String);
11171
11270
  };
11172
11271
  reader.onerror = (error) => reject(error);
@@ -11645,10 +11744,17 @@ const isPartOfTrustFromLegalEntity = (legalEntity) => {
11645
11744
  var _a;
11646
11745
  return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
11647
11746
  };
11747
+ const getRootTrusteeLegalEntityId = (trustEntity) => {
11748
+ var _a;
11749
+ if (!trustEntity.entityAssociations)
11750
+ return "";
11751
+ return (_a = trustEntity.entityAssociations.filter((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)[0]) == null ? void 0 : _a.legalEntityId;
11752
+ };
11648
11753
  const getOwnTrustMembers = (trustEntity) => {
11649
11754
  if (!trustEntity.entityAssociations)
11650
11755
  return [];
11651
- return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && entityAssociation.associatorId === trustEntity.id);
11756
+ const rootTrusteeLegalEntityId = getRootTrusteeLegalEntityId(trustEntity);
11757
+ return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && rootTrusteeLegalEntityId === (entityAssociation == null ? void 0 : entityAssociation.associatorId));
11652
11758
  };
11653
11759
  const getOwnTrustMembersLegalEntityIds = (legalEntity) => getOwnTrustMembers(legalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11654
11760
  const getOwnTrustLegalEntityId = (legalEntity) => {
@@ -12502,6 +12608,10 @@ const mapIndividualDocumentToApiDocument = async (data, entityId) => {
12502
12608
  return documents2.filter(Boolean);
12503
12609
  }
12504
12610
  };
12611
+ const mapExistingFile = (name) => ({
12612
+ name,
12613
+ existing: true
12614
+ });
12505
12615
  const mapApiIdDocumentToSchema = (idDocument2) => {
12506
12616
  const {
12507
12617
  hasBackPage
@@ -12512,14 +12622,10 @@ const mapApiIdDocumentToSchema = (idDocument2) => {
12512
12622
  const backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12513
12623
  return {
12514
12624
  ...frontPage2 ? {
12515
- idFrontPage: [{
12516
- name: frontPage2.pageName
12517
- }]
12625
+ idFrontPage: [mapExistingFile(frontPage2.pageName)]
12518
12626
  } : {},
12519
12627
  ...backPage2 ? {
12520
- idBackPage: [{
12521
- name: backPage2.pageName
12522
- }]
12628
+ idBackPage: [mapExistingFile(backPage2.pageName)]
12523
12629
  } : {},
12524
12630
  idDocumentType: idDocument2.type
12525
12631
  };
@@ -12530,12 +12636,12 @@ const mapApiDocumentToIndividualDocuments = (entityId) => {
12530
12636
  const proofOfNationalId2 = getDocument$1(entityId, DocumentType.PROOF_OF_NATIONAL_ID_NUMBER) || null;
12531
12637
  return {
12532
12638
  idDocument: idDocument2 ? mapApiIdDocumentToSchema(idDocument2) : null,
12533
- proofOfResidence: proofOfResidence2 ? [{
12534
- name: getPageName(proofOfResidence2)
12535
- }] : null,
12536
- proofOfNationalId: proofOfNationalId2 ? [{
12537
- name: getPageName(proofOfNationalId2)
12538
- }] : null
12639
+ proofOfResidence: proofOfResidence2 ? {
12640
+ proofOfResidence: [mapExistingFile(getPageName(proofOfResidence2))]
12641
+ } : null,
12642
+ proofOfNationalId: proofOfNationalId2 ? {
12643
+ proofOfNationalId: [mapExistingFile(getPageName(proofOfNationalId2))]
12644
+ } : null
12539
12645
  };
12540
12646
  };
12541
12647
  const mapCompanyDocumentToApiDocument = async (data, entityId) => {
@@ -12572,14 +12678,10 @@ const mapApiDocumentToCompanyDocuments = (entityId) => {
12572
12678
  const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
12573
12679
  return {
12574
12680
  companyRegistrationDocument: registrationDocument2 ? {
12575
- registrationDocument: [{
12576
- name: getPageName(registrationDocument2)
12577
- }]
12681
+ registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
12578
12682
  } : null,
12579
12683
  companyTaxDocument: taxDocument2 ? {
12580
- taxDocument: [{
12581
- name: getPageName(taxDocument2)
12582
- }]
12684
+ taxDocument: [mapExistingFile(getPageName(taxDocument2))]
12583
12685
  } : null
12584
12686
  };
12585
12687
  };
@@ -12599,9 +12701,7 @@ const mapApiDocumentToTrustDocument = (entityId) => {
12599
12701
  const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12600
12702
  return {
12601
12703
  trustConstitutionalDocument: constitutionalDocument2 ? {
12602
- constitutionalDocument: [{
12603
- name: getPageName(constitutionalDocument2)
12604
- }]
12704
+ constitutionalDocument: [mapExistingFile(getPageName(constitutionalDocument2))]
12605
12705
  } : null
12606
12706
  };
12607
12707
  };
@@ -12621,9 +12721,7 @@ const mapApiDocumentToSolePropDocuments = (entityId) => {
12621
12721
  const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12622
12722
  return {
12623
12723
  solePropConstitutionalDocument: constitutionalDocument2 ? {
12624
- constitutionalDocument: [{
12625
- name: getPageName(constitutionalDocument2)
12626
- }]
12724
+ constitutionalDocument: [mapExistingFile(getPageName(constitutionalDocument2))]
12627
12725
  } : null
12628
12726
  };
12629
12727
  };
@@ -12650,9 +12748,7 @@ const mapPayoutDocumentsToApiDocuments = async (data, entityId) => {
12650
12748
  const mapApiDocumentToPayoutDocuments = (entityId) => {
12651
12749
  const bankStatement2 = getDocument$1(entityId, DocumentType.BANK_STATEMENT) || null;
12652
12750
  return {
12653
- bankStatementDocument: bankStatement2 ? [{
12654
- name: getPageName(bankStatement2)
12655
- }] : null,
12751
+ bankStatementDocument: bankStatement2 ? [mapExistingFile(getPageName(bankStatement2))] : null,
12656
12752
  description: bankStatement2.description
12657
12753
  };
12658
12754
  };
@@ -12755,27 +12851,21 @@ function IdDocumentManualUploadComponent(props) {
12755
12851
  const document2 = idDocumentType ? getDocument$1(props.legalEntityId, idDocumentType) : void 0;
12756
12852
  if (!document2) {
12757
12853
  setIdFrontPage({
12758
- idFrontPage: null
12854
+ idFrontPage: void 0
12759
12855
  });
12760
12856
  setIdBackPage({
12761
- idBackPage: null
12857
+ idBackPage: void 0
12762
12858
  });
12763
12859
  } else if (hasBackPage(idDocumentType)) {
12764
12860
  setIdFrontPage({
12765
- idFrontPage: [{
12766
- name: getPageName(document2, "front")
12767
- }]
12861
+ idFrontPage: [mapExistingFile(getPageName(document2, "front"))]
12768
12862
  });
12769
12863
  setIdBackPage({
12770
- idBackPage: [{
12771
- name: getPageName(document2, "back")
12772
- }]
12864
+ idBackPage: [mapExistingFile(getPageName(document2, "back"))]
12773
12865
  });
12774
12866
  } else {
12775
12867
  setIdFrontPage({
12776
- idFrontPage: [{
12777
- name: getPageName(document2)
12778
- }]
12868
+ idFrontPage: [mapExistingFile(getPageName(document2))]
12779
12869
  });
12780
12870
  }
12781
12871
  }
@@ -12877,7 +12967,7 @@ const useIdVerificationToken = ({
12877
12967
  lastName: lastName2,
12878
12968
  residencyCountry: residencyCountry2
12879
12969
  } = userDetails;
12880
- const [sdkToken, setSdkToken] = useState();
12970
+ const [sdkToken2, setSdkToken2] = useState();
12881
12971
  const [loadingStatus, setLoadingStatus] = useState();
12882
12972
  const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
12883
12973
  useEffect(() => {
@@ -12903,9 +12993,9 @@ const useIdVerificationToken = ({
12903
12993
  // Do not include legalEntityId if we don't know yet. Eg.: decision-makers flow the associated legalEntityId.
12904
12994
  };
12905
12995
  const {
12906
- sdkToken: sdkToken2
12996
+ sdkToken: sdkToken22
12907
12997
  } = await handleGetIdVerificationToken("", data);
12908
- setSdkToken(sdkToken2);
12998
+ setSdkToken2(sdkToken22);
12909
12999
  } catch (e) {
12910
13000
  onIdVerificationError == null ? void 0 : onIdVerificationError(e);
12911
13001
  } finally {
@@ -12914,7 +13004,7 @@ const useIdVerificationToken = ({
12914
13004
  })().catch(console.error);
12915
13005
  }, [firstName2, lastName2, residencyCountry2, hasAllUserDetails]);
12916
13006
  return {
12917
- sdkToken,
13007
+ sdkToken: sdkToken2,
12918
13008
  loadingStatus
12919
13009
  };
12920
13010
  };
@@ -13458,7 +13548,7 @@ function IdVerificationComponent({
13458
13548
  i18n
13459
13549
  } = useI18nContext();
13460
13550
  const {
13461
- sdkToken,
13551
+ sdkToken: sdkToken2,
13462
13552
  loadingStatus
13463
13553
  } = useIdVerificationToken({
13464
13554
  userDetails,
@@ -13469,10 +13559,10 @@ function IdVerificationComponent({
13469
13559
  const onfidoSdk = useRef();
13470
13560
  useEffect(() => {
13471
13561
  (async () => {
13472
- if (!sdkToken)
13562
+ if (!sdkToken2)
13473
13563
  return;
13474
13564
  onfidoSdk.current = await initOnfido({
13475
- token: sdkToken,
13565
+ token: sdkToken2,
13476
13566
  i18n,
13477
13567
  onIdVerificationClose,
13478
13568
  onIdVerificationError,
@@ -13483,7 +13573,7 @@ function IdVerificationComponent({
13483
13573
  if (onfidoSdk.current)
13484
13574
  onfidoSdk.current.tearDown();
13485
13575
  };
13486
- }, [sdkToken]);
13576
+ }, [sdkToken2]);
13487
13577
  useEffect(() => {
13488
13578
  if (!onfidoSdk.current)
13489
13579
  return;
@@ -15774,10 +15864,18 @@ function PersonalDetailsComponent(props) {
15774
15864
  max: formatDateObj(/* @__PURE__ */ new Date())
15775
15865
  })
15776
15866
  }), formUtils.isRequiredField("residencyCountry") && jsx(CountryField, {
15777
- data: data.residencyCountry,
15778
- valid: valid == null ? void 0 : valid.residencyCountry,
15779
- error: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems),
15780
- label: formUtils.getLabel("residencyCountry"),
15867
+ data: {
15868
+ country: data.residencyCountry
15869
+ },
15870
+ valid: {
15871
+ country: valid.residencyCountry
15872
+ },
15873
+ errors: {
15874
+ country: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems)
15875
+ },
15876
+ labels: {
15877
+ country: formUtils.getLabel("residencyCountry")
15878
+ },
15781
15879
  readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask,
15782
15880
  allowedCountries: [],
15783
15881
  classNameModifiers: ["country"],
@@ -15787,10 +15885,18 @@ function PersonalDetailsComponent(props) {
15787
15885
  country: data.residencyCountry,
15788
15886
  errors: externalErrors
15789
15887
  }), (data.residencyCountry === "SG" || data.residencyCountry === "HK") && formUtils.isRequiredField("nationality") && jsx(CountryField, {
15790
- data: data.nationality,
15791
- valid: valid == null ? void 0 : valid.nationality,
15792
- error: formUtils.getErrorMessage("nationality", errors, fieldProblems),
15793
- label: formUtils.getLabel("nationality"),
15888
+ data: {
15889
+ country: data.nationality
15890
+ },
15891
+ valid: {
15892
+ country: valid.nationality
15893
+ },
15894
+ errors: {
15895
+ country: formUtils.getErrorMessage("nationality", errors, fieldProblems)
15896
+ },
15897
+ labels: {
15898
+ country: formUtils.getLabel("nationality")
15899
+ },
15794
15900
  readonly: formUtils.isReadOnly("nationality"),
15795
15901
  classNameModifiers: ["nationality"],
15796
15902
  handleChangeFor: () => handleChangeFor("nationality", "input")
@@ -16123,6 +16229,29 @@ function IndividualComponent(props) {
16123
16229
  });
16124
16230
  }
16125
16231
  const PayoutDetails = "";
16232
+ const useAsyncAccountDetailsValidationRules = (payload, hasEmptyFields2) => {
16233
+ const {
16234
+ accountIdentification: accountIdentification2
16235
+ } = useConfigurationApi();
16236
+ const [accountValidationData, setAccountValidationData] = useState({
16237
+ invalidFields: [],
16238
+ valid: false
16239
+ });
16240
+ useEffect(() => {
16241
+ const fetchAccountDetails = async () => {
16242
+ try {
16243
+ const accountIdentificationResponse = await accountIdentification2(payload);
16244
+ setAccountValidationData(accountIdentificationResponse);
16245
+ } catch (error) {
16246
+ console.error("Error fetching account details:", error);
16247
+ }
16248
+ };
16249
+ if (payload && !hasEmptyFields2) {
16250
+ fetchAccountDetails();
16251
+ }
16252
+ }, [accountIdentification2, hasEmptyFields2, payload]);
16253
+ return accountValidationData;
16254
+ };
16126
16255
  const BankVerification$2 = "";
16127
16256
  const _actionBar_component = "";
16128
16257
  const ActionBar = ({
@@ -16284,6 +16413,29 @@ class AdyenKycSdkError extends Error {
16284
16413
  this.stack = stack.join("\n");
16285
16414
  }
16286
16415
  }
16416
+ let sdkToken;
16417
+ let fetchSdkToken;
16418
+ const logger$g = createLogger("Session");
16419
+ const setSdkToken = (token) => {
16420
+ sdkToken = token;
16421
+ };
16422
+ const setSdkTokenHandler = (handler) => {
16423
+ fetchSdkToken = handler;
16424
+ };
16425
+ const getSdkToken = () => sdkToken;
16426
+ const refreshSession = async () => {
16427
+ if (!fetchSdkToken) {
16428
+ throw Error("Not able to extend session, fetch handler not provided ");
16429
+ }
16430
+ try {
16431
+ const {
16432
+ token
16433
+ } = await fetchSdkToken();
16434
+ setSdkToken(token);
16435
+ } catch (e) {
16436
+ logger$g.error("Failed to fetch sdk token", e);
16437
+ }
16438
+ };
16287
16439
  const OpenBankingSDKStyles = "";
16288
16440
  const WIDGET_IFRAME_CLASS$1 = "adyen-open-banking-sdk-widget";
16289
16441
  const WIDGET_CONTAINER_CLASS$1 = `${WIDGET_IFRAME_CLASS$1}-container`;
@@ -16349,17 +16501,18 @@ const removeAnimationStartListener = (element, listener) => {
16349
16501
  element.removeEventListener("MSAnimationStart", listener, false);
16350
16502
  element.removeEventListener("webkitAnimationStart", listener, false);
16351
16503
  };
16352
- const logger$g = createLogger("Fetch");
16504
+ const logger$f = createLogger("Fetch");
16353
16505
  const getRequestObject = (options, data) => {
16354
16506
  const {
16355
16507
  headers = [],
16356
16508
  method = "GET",
16357
- sdkToken
16509
+ authentication
16358
16510
  } = options;
16359
16511
  let authHeaders;
16360
- if (options.sdkToken) {
16512
+ if (authentication === "jwt") {
16513
+ const sdkToken2 = getSdkToken();
16361
16514
  authHeaders = {
16362
- Authorization: `Bearer ${sdkToken}`,
16515
+ Authorization: `Bearer ${sdkToken2}`,
16363
16516
  Origin: window.location.origin
16364
16517
  };
16365
16518
  }
@@ -16395,10 +16548,10 @@ const logFetchError = (message, level) => {
16395
16548
  case "info":
16396
16549
  case "warn":
16397
16550
  case "error":
16398
- logger$g[level](message);
16551
+ logger$f[level](message);
16399
16552
  break;
16400
16553
  default:
16401
- logger$g.error(message);
16554
+ logger$f.error(message);
16402
16555
  }
16403
16556
  };
16404
16557
  const handleFetchResponse = async (response, responseType) => {
@@ -16417,11 +16570,17 @@ const handleFetchResponse = async (response, responseType) => {
16417
16570
  }
16418
16571
  };
16419
16572
  const isValidationErrorResponse = (response) => (response == null ? void 0 : response.status) === 422;
16573
+ const isSessionExpiredResponse = (response) => (response == null ? void 0 : response.status) === 401;
16574
+ const processValidationErrors$1 = async (response) => {
16575
+ const responseData = await response.json();
16576
+ throw new ValidationError(responseData.errorCode, responseData);
16577
+ };
16420
16578
  class ValidationError extends Error {
16421
16579
  constructor(message, validationDetails) {
16422
16580
  super(message);
16423
16581
  this.invalidFields = validationDetails == null ? void 0 : validationDetails.invalidFields;
16424
16582
  this.errorCode = validationDetails == null ? void 0 : validationDetails.errorCode;
16583
+ this.sourceError = validationDetails;
16425
16584
  }
16426
16585
  }
16427
16586
  const http = async (options, data, responseType = "json") => {
@@ -16433,6 +16592,7 @@ const http = async (options, data, responseType = "json") => {
16433
16592
  } = options;
16434
16593
  const request = getRequestObject(options, data);
16435
16594
  const url = getRequestUrl(loadingContext, path, clientKey);
16595
+ const needsAuthGuard = options.authentication === "jwt";
16436
16596
  let response;
16437
16597
  try {
16438
16598
  response = await fetch(url, request);
@@ -16453,8 +16613,11 @@ const http = async (options, data, responseType = "json") => {
16453
16613
  return options.errorHandler(handleFetchResponse(response, responseType));
16454
16614
  }
16455
16615
  if (isValidationErrorResponse(response)) {
16456
- const responseData = await response.json();
16457
- throw new ValidationError(responseData.errorCode, responseData);
16616
+ return processValidationErrors$1(response);
16617
+ }
16618
+ if (needsAuthGuard && isSessionExpiredResponse(response)) {
16619
+ await refreshSession();
16620
+ return http(options, data, responseType);
16458
16621
  }
16459
16622
  logFetchError(errorMessage, errorLevel);
16460
16623
  throw new Error(errorMessage);
@@ -16484,7 +16647,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
16484
16647
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
16485
16648
  const MOUNT_TIMEOUT = 10 * 1e3;
16486
16649
  const TINK_VENDOR = "Tink";
16487
- const logger$f = createLogger("iframeWidget");
16650
+ const logger$e = createLogger("iframeWidget");
16488
16651
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
16489
16652
  const isTerminalMessageData = (data) => Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
16490
16653
  const parseMessageJson = (message) => {
@@ -16503,7 +16666,7 @@ const callbackErrorHandler = async (response) => {
16503
16666
  try {
16504
16667
  await response;
16505
16668
  } catch (ex) {
16506
- logger$f.error(ex);
16669
+ logger$e.error(ex);
16507
16670
  }
16508
16671
  return {
16509
16672
  error: "UNKNOWN_ERROR",
@@ -16512,7 +16675,7 @@ const callbackErrorHandler = async (response) => {
16512
16675
  };
16513
16676
  let activeWidget;
16514
16677
  class IFrameWidget {
16515
- constructor(iframeElement, url, vendor, sdkToken) {
16678
+ constructor(iframeElement, url, vendor, sdkToken2) {
16516
16679
  this.mountInProgress = false;
16517
16680
  this.waitForResponse = async () => new Promise((resolve, reject) => {
16518
16681
  this.listener = async (message) => {
@@ -16535,7 +16698,7 @@ class IFrameWidget {
16535
16698
  this.iframeElement = iframeElement;
16536
16699
  this.iframeWindow = iframeElement.contentWindow;
16537
16700
  this.vendor = vendor;
16538
- this.sdkToken = sdkToken;
16701
+ this.sdkToken = sdkToken2;
16539
16702
  }
16540
16703
  removeMessageEventListener() {
16541
16704
  if (!this.listener)
@@ -16609,7 +16772,7 @@ class IFrameWidget {
16609
16772
  message = responseData.errorMessage;
16610
16773
  }
16611
16774
  } catch (ex) {
16612
- logger$f.error(ex);
16775
+ logger$e.error(ex);
16613
16776
  }
16614
16777
  throw new AdyenKycSdkError(reason, jsonData.error);
16615
16778
  }
@@ -16695,7 +16858,7 @@ function BankVerificationWidget({
16695
16858
  const {
16696
16859
  isEmbeddedDropin
16697
16860
  } = context;
16698
- const sdkToken = isEmbeddedDropin ? context.sdkToken : void 0;
16861
+ const sdkToken2 = isEmbeddedDropin ? getSdkToken() : void 0;
16699
16862
  useEffect(
16700
16863
  () => {
16701
16864
  const container = widgetContainerRef.current;
@@ -16738,7 +16901,7 @@ function BankVerificationWidget({
16738
16901
  requestAnimationFrame(async () => {
16739
16902
  var _a, _b;
16740
16903
  try {
16741
- iFrameWidget = new IFrameWidget(iFrame, url, vendor, sdkToken);
16904
+ iFrameWidget = new IFrameWidget(iFrame, url, vendor, sdkToken2);
16742
16905
  const result = await iFrameWidget.mountAndWaitForResponse();
16743
16906
  widgetCallback({
16744
16907
  action: "verification_success",
@@ -16795,7 +16958,7 @@ function BankVerificationWidget({
16795
16958
  ref: widgetContainerRef
16796
16959
  });
16797
16960
  }
16798
- const logger$e = createLogger("BankVerification");
16961
+ const logger$d = createLogger("BankVerification");
16799
16962
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
16800
16963
  const InstantVerificationErrorContext = createContext(null);
16801
16964
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -16829,7 +16992,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
16829
16992
  const preferredVendor2 = vendors[0];
16830
16993
  setPreferredVendor(preferredVendor2.name ? preferredVendor2 : null);
16831
16994
  };
16832
- getPreferredVendor().catch(logger$e.error);
16995
+ getPreferredVendor().catch(logger$d.error);
16833
16996
  }, [country2, getBankVerificationVendors]);
16834
16997
  return preferredVendor;
16835
16998
  };
@@ -17130,6 +17293,7 @@ function BankAccountFormat(props) {
17130
17293
  var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
17131
17294
  ExperimentNames2["EnableTrustFlow"] = "EnableTrustFlow";
17132
17295
  ExperimentNames2["OnlyAllowAlphanumericBankAccountNumbers"] = "OnlyAllowAlphanumericBankAccountNumbers";
17296
+ ExperimentNames2["OrganizationSettlorWithExemptionReason"] = "OrganizationSettlorWithExemptionReason";
17133
17297
  return ExperimentNames2;
17134
17298
  })(ExperimentNames || {});
17135
17299
  const stripNonAlphanumeric = (value) => value.replaceAll(/[^0-9a-zA-Z]/g, "");
@@ -17736,7 +17900,9 @@ function PayoutAccountComponent(props) {
17736
17900
  country: country2,
17737
17901
  id: id2,
17738
17902
  legalEntityResponse,
17739
- requiredFields
17903
+ requiredFields,
17904
+ arePayoutAccountDetailsInvalid,
17905
+ invalidFieldNames
17740
17906
  } = props;
17741
17907
  const stateRef = useRef({
17742
17908
  setState: null
@@ -17850,10 +18016,19 @@ function PayoutAccountComponent(props) {
17850
18016
  hasCloseButton: false,
17851
18017
  type: AlertTypes.BASIC,
17852
18018
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
18019
+ }), arePayoutAccountDetailsInvalid && jsx(Alert, {
18020
+ hasCloseButton: false,
18021
+ className: "adl-u-margin-top-16",
18022
+ type: AlertTypes.ERROR,
18023
+ title: invalidFieldNames ? i18n.get("enterValid_", {
18024
+ values: {
18025
+ fieldNames: invalidFieldNames
18026
+ }
18027
+ }) : i18n.get("enterValidAccountDetails")
17853
18028
  })]
17854
18029
  });
17855
18030
  }
17856
- const PayoutAccount = memo(PayoutAccountComponent, (prevProps, nextProps) => objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.optionalFields, nextProps.optionalFields) && objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate);
18031
+ const PayoutAccount = memo(PayoutAccountComponent, (prevProps, nextProps) => objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.optionalFields, nextProps.optionalFields) && objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.arePayoutAccountDetailsInvalid === nextProps.arePayoutAccountDetailsInvalid && prevProps.invalidFieldNames === nextProps.invalidFieldNames);
17857
18032
  const PayoutBankStatement$1 = "";
17858
18033
  function FilePicker({
17859
18034
  files,
@@ -18431,15 +18606,25 @@ function PayoutVerificationMethod(props) {
18431
18606
  }
18432
18607
  })]
18433
18608
  }), jsx(CountryField, {
18434
- data: data.bankCountry,
18435
- valid: valid == null ? void 0 : valid.bankCountry,
18436
- error: formUtils.getErrorMessage("bankCountry", errors, fieldProblems),
18437
- label: formUtils.getLabel("bankCountry", "bankAccountCountry"),
18609
+ data: {
18610
+ country: data.bankCountry
18611
+ },
18612
+ valid: {
18613
+ country: valid == null ? void 0 : valid.bankCountry
18614
+ },
18615
+ errors: {
18616
+ country: formUtils.getErrorMessage("bankCountry", errors, fieldProblems)
18617
+ },
18618
+ labels: {
18619
+ country: formUtils.getLabel("bankCountry", "bankAccountCountry")
18620
+ },
18438
18621
  readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
18439
18622
  allowedCountries: allowedBankCountries,
18440
18623
  classNameModifiers: ["country"],
18441
18624
  handleChangeFor: () => handleChangeFor("bankCountry", "input"),
18442
- helperText: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18625
+ helperText: {
18626
+ country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18627
+ }
18443
18628
  }), jsx(Field, {
18444
18629
  name: "verificationMethods",
18445
18630
  label: formUtils.getLabel("payoutVerificationMethod", "verificationMethod"),
@@ -18573,7 +18758,8 @@ function PayoutDetailsComponent(props) {
18573
18758
  setHideBackButton,
18574
18759
  setSubmitButtonLabel,
18575
18760
  createTrustedTransferInstrument: createTrustedTransferInstrument2,
18576
- handleBankVerificationError: handleBankVerificationError2
18761
+ handleBankVerificationError: handleBankVerificationError2,
18762
+ accountDetailsFromInput
18577
18763
  } = props;
18578
18764
  const [instantVerificationError, setInstantVerificationError] = useInstantVerificationErrorNotification(1e4);
18579
18765
  const verificationMethodFormProps = getFormProps(props, payoutSteps.payoutVerificationMethod.formId);
@@ -18597,6 +18783,26 @@ function PayoutDetailsComponent(props) {
18597
18783
  }
18598
18784
  }, [activeForm]);
18599
18785
  const [bankInfoValidated, setBankInfoValidated] = useState(false);
18786
+ const [arePayoutAccountDetailsInvalid, setArePayoutAccountDetailsInvalid] = useState(false);
18787
+ const [invalidFieldNames, setInvalidFieldNames] = useState("");
18788
+ const debouncedGetAccountIdentificationFromPayoutAccountSchema = useCallback(debounce(getAccountIdentificationFromPayoutAccountSchema, 500), [getAccountIdentificationFromPayoutAccountSchema]);
18789
+ const payload = useMemo(() => bankCountry2 ? debouncedGetAccountIdentificationFromPayoutAccountSchema(accountDetailsFromInput, bankCountry2) : {}, [accountDetailsFromInput, bankCountry2, debouncedGetAccountIdentificationFromPayoutAccountSchema]);
18790
+ const validateAccountDetails = useAsyncAccountDetailsValidationRules(payload, hasEmptyFields(payload));
18791
+ const resetInvalidFieldState = () => {
18792
+ setInvalidFieldNames("");
18793
+ setArePayoutAccountDetailsInvalid(false);
18794
+ };
18795
+ useEffect(() => {
18796
+ var _a2;
18797
+ if (validateAccountDetails && ((_a2 = validateAccountDetails.invalidFields) == null ? void 0 : _a2.length) > 0) {
18798
+ const fieldNames = validateAccountDetails.invalidFields.map((field) => extractFieldName(field == null ? void 0 : field.name)).map((key) => mapKeyToFieldName(i18n, key));
18799
+ const invalidFieldsString = concatenateFieldNames(fieldNames);
18800
+ setInvalidFieldNames(invalidFieldsString);
18801
+ setArePayoutAccountDetailsInvalid(true);
18802
+ } else {
18803
+ resetInvalidFieldState();
18804
+ }
18805
+ }, [i18n, validateAccountDetails]);
18600
18806
  return jsxs("div", {
18601
18807
  className: "adyen-kyc-payout",
18602
18808
  children: [jsx("div", {
@@ -18641,7 +18847,9 @@ function PayoutDetailsComponent(props) {
18641
18847
  heading: taskHeading,
18642
18848
  id: payoutSteps.payoutAccountDetails(taskType).formId,
18643
18849
  country: bankCountry2,
18644
- legalEntityResponse
18850
+ legalEntityResponse,
18851
+ arePayoutAccountDetailsInvalid,
18852
+ invalidFieldNames
18645
18853
  })
18646
18854
  }), !verifyInstantly && jsx("div", {
18647
18855
  className: activeForm.formId !== payoutSteps.payoutAccountDocuments.formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -18936,14 +19144,16 @@ function TrustRegistrationDetailsComponent(props) {
18936
19144
  id: "ariaErrorField"
18937
19145
  }), jsx(ContextHelper, {
18938
19146
  content: i18n.get("makeSureToHaveYourTrustDeed")
18939
- }), formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
18940
- data: country2,
18941
- valid: valid == null ? void 0 : valid.country,
18942
- error: formUtils.getErrorMessage(COUNTRY_FIELD, errors, fieldProblems),
18943
- label: formUtils.getLabel(COUNTRY_FIELD, "countryOfEstablishment"),
18944
- readonly: formUtils.isReadOnly(COUNTRY_FIELD),
19147
+ }), formUtils.isRequiredField("country") && jsx(CountryField, {
19148
+ data: formUtils.getFieldData(data, COUNTRY_FIELD),
19149
+ valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
19150
+ errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
19151
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
19152
+ country: "countryOfEstablishment"
19153
+ }),
19154
+ readonly: formUtils.isReadOnly("country"),
18945
19155
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
18946
- classNameModifiers: [COUNTRY_FIELD],
19156
+ classNameModifiers: ["country"],
18947
19157
  handleChangeFor: () => (e) => {
18948
19158
  handleChangeFor("country", "input")(e);
18949
19159
  if (onCountryChange)
@@ -20093,7 +20303,7 @@ const defaultPayoutAccountFormat = {
20093
20303
  [CountryCodes.Sweden]: "local",
20094
20304
  [CountryCodes.UnitedKingdom]: "local"
20095
20305
  };
20096
- const logger$d = createLogger("useScenarioConfiguration");
20306
+ const logger$c = createLogger("useScenarioConfiguration");
20097
20307
  const useScenarioConfiguration = ({
20098
20308
  getConfigurationData,
20099
20309
  getPayoutAccountFormatData,
@@ -20115,12 +20325,12 @@ const useScenarioConfiguration = ({
20115
20325
  const response = await getConfigurationData();
20116
20326
  setConfigurationResponse(response);
20117
20327
  } catch (err) {
20118
- logger$d.warn("WARNING: Configuration request failed - error:", err);
20328
+ logger$c.warn("WARNING: Configuration request failed - error:", err);
20119
20329
  } finally {
20120
20330
  setLoadingStatus("success");
20121
20331
  }
20122
20332
  };
20123
- makeConfigCallAndSave().catch(logger$d.error);
20333
+ makeConfigCallAndSave().catch(logger$c.error);
20124
20334
  }, [getConfigurationData, setLoadingStatus]);
20125
20335
  useEffect(() => {
20126
20336
  setLoadingStatus("loading");
@@ -20136,12 +20346,12 @@ const useScenarioConfiguration = ({
20136
20346
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
20137
20347
  setAccountFormat(defaultAccountFormat);
20138
20348
  } catch (err) {
20139
- logger$d.warn("WARNING: Payout format request failed - error:", err);
20349
+ logger$c.warn("WARNING: Payout format request failed - error:", err);
20140
20350
  } finally {
20141
20351
  setLoadingStatus("success");
20142
20352
  }
20143
20353
  };
20144
- makePayoutFormatCallAndSave().catch(logger$d.error);
20354
+ makePayoutFormatCallAndSave().catch(logger$c.error);
20145
20355
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus]);
20146
20356
  const {
20147
20357
  fieldConfigurations,
@@ -20308,7 +20518,7 @@ const countryConfig$1 = {
20308
20518
  placeholder: "SSNFormatUS"
20309
20519
  },
20310
20520
  idNumberExempt: {
20311
- label: "uploadDocumentForSsn"
20521
+ label: "identityNumberExempt__US"
20312
20522
  }
20313
20523
  },
20314
20524
  CA: {
@@ -20317,7 +20527,7 @@ const countryConfig$1 = {
20317
20527
  placeholder: "SINFormatCA"
20318
20528
  },
20319
20529
  idNumberExempt: {
20320
- label: "uploadDocumentForSsn"
20530
+ label: "identityNumberExempt__CA"
20321
20531
  }
20322
20532
  },
20323
20533
  IT: {
@@ -20797,7 +21007,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
20797
21007
  return ToastType2;
20798
21008
  })(ToastType || {});
20799
21009
  const FormComposer = "";
20800
- const logger$c = createLogger("FormRouterContextProvider");
21010
+ const logger$b = createLogger("FormRouterContextProvider");
20801
21011
  function FormRouterContextProvider({
20802
21012
  children,
20803
21013
  forms,
@@ -20817,7 +21027,7 @@ function FormRouterContextProvider({
20817
21027
  if (formIndex > -1) {
20818
21028
  setFormIndex(formIndex);
20819
21029
  } else {
20820
- logger$c.error("No form was found to have that field so form navigation failed.");
21030
+ logger$b.error("No form was found to have that field so form navigation failed.");
20821
21031
  }
20822
21032
  }
20823
21033
  }), [forms, handleGetIdVerificationToken, setFormIndex]);
@@ -21061,16 +21271,18 @@ const canSubmit = (data) => mandatoryApiFields.ORGANIZATION.every((detail) => {
21061
21271
  });
21062
21272
  const isDocumentsRequired = (forms) => forms.some((form) => [companyForms.companyRegistrationDocument.formId, companyForms.companyTaxDocument.formId].includes(form.formId));
21063
21273
  const formatFileSummaryData = (companyRegistrationDocument2, companyTaxDocument) => {
21064
- var _a, _b, _c, _d;
21274
+ var _a, _b;
21275
+ const registrationDocument2 = (_a = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0];
21276
+ const taxDocument2 = (_b = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _b[0];
21065
21277
  return {
21066
- ...(companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) && {
21278
+ ...registrationDocument2 && {
21067
21279
  companyRegistrationDocument: {
21068
- fileName: (_b = (_a = companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
21280
+ fileName: registrationDocument2.name
21069
21281
  }
21070
21282
  },
21071
- ...(companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) && {
21283
+ ...taxDocument2 && {
21072
21284
  companyTaxDocument: {
21073
- fileName: (_d = (_c = companyTaxDocument.taxDocument) == null ? void 0 : _c[0]) == null ? void 0 : _d.name
21285
+ fileName: taxDocument2.name
21074
21286
  }
21075
21287
  }
21076
21288
  };
@@ -21414,7 +21626,7 @@ function CompanyDropinComponent({
21414
21626
  })
21415
21627
  });
21416
21628
  }
21417
- const logger$b = createLogger("useLocalStorage");
21629
+ const logger$a = createLogger("useLocalStorage");
21418
21630
  function useLocalStorage(key, defaultValue, options) {
21419
21631
  const {
21420
21632
  serializer,
@@ -21435,7 +21647,7 @@ function useLocalStorage(key, defaultValue, options) {
21435
21647
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
21436
21648
  return res;
21437
21649
  } catch (err) {
21438
- logger$b.error(err);
21650
+ logger$a.error(err);
21439
21651
  return defaultValue;
21440
21652
  }
21441
21653
  });
@@ -21467,7 +21679,7 @@ function useLocalStorage(key, defaultValue, options) {
21467
21679
  try {
21468
21680
  updateLocalStorage();
21469
21681
  } catch (err) {
21470
- logger$b.error(err);
21682
+ logger$a.error(err);
21471
21683
  }
21472
21684
  }, [value]);
21473
21685
  useEffect(() => {
@@ -21482,7 +21694,7 @@ function useLocalStorage(key, defaultValue, options) {
21482
21694
  setValue(event.newValue ? parser(event.newValue) : void 0);
21483
21695
  }
21484
21696
  } catch (err) {
21485
- logger$b.error(err);
21697
+ logger$a.error(err);
21486
21698
  }
21487
21699
  };
21488
21700
  if (typeof window === "undefined")
@@ -21518,7 +21730,7 @@ const useShouldShowIntro = (legalEntity) => {
21518
21730
  } = useHasSeenIntro(legalEntity.id);
21519
21731
  return canSeeIntro && !hasSeenIntro;
21520
21732
  };
21521
- const logger$a = createLogger("useExemptSettlor");
21733
+ const logger$9 = createLogger("useExemptSettlor");
21522
21734
  const useExemptSettlor = ({
21523
21735
  trust,
21524
21736
  handleGetLegalEntity
@@ -21530,7 +21742,7 @@ const useExemptSettlor = ({
21530
21742
  setExemptSettlor(exemptSettlorLE);
21531
21743
  }, [handleGetLegalEntity]);
21532
21744
  useEffect(() => {
21533
- updateExemptSettlor(trust).catch(logger$a.error);
21745
+ updateExemptSettlor(trust).catch(logger$9.error);
21534
21746
  }, [trust, updateExemptSettlor]);
21535
21747
  return exemptSettlor;
21536
21748
  };
@@ -21637,15 +21849,17 @@ const getFallbackName = (exemptSettlorAssociation) => {
21637
21849
  };
21638
21850
  const convertEntityAssociationIntoTrustMember = (association, associations, exemptSettlorLE) => {
21639
21851
  var _a;
21640
- if (association.settlorExemptionReason)
21852
+ if (association.settlorExemptionReason) {
21641
21853
  return {
21642
21854
  trustMemberType: "exemptSettlor",
21643
21855
  roles: [TrustMemberTypes.SETTLOR],
21644
- legalEntityType: LegalEntityType.INDIVIDUAL,
21856
+ legalEntityType: association.entityType,
21645
21857
  legalEntityId: association.legalEntityId,
21646
21858
  settlorExemptionReason: association.settlorExemptionReason,
21647
- exemptSettlorName: ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association)
21859
+ exemptSettlorName: association.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association) : void 0,
21860
+ name: association.name
21648
21861
  };
21862
+ }
21649
21863
  if (association.entityType === LegalEntityType.ORGANIZATION)
21650
21864
  return {
21651
21865
  trustMemberType: "company",
@@ -21701,6 +21915,7 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
21701
21915
  return [mapRootLegalEntityToTrustMember(rootLegalEntity), ...mapEntityAssociationsToTrustMembers(trustLE.id, trustLE.entityAssociations ?? [], exemptSettlorLE), ...mapUndefinedBeneficiaryInfoToTrustMembers(((_a = trustLE.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [])];
21702
21916
  };
21703
21917
  const mapTrustMemberToEntityAssociations = (trustMember) => {
21918
+ var _a, _b;
21704
21919
  if (trustMember.legalEntityId === isNewEntity) {
21705
21920
  throw Error("Cannot map a new trust member, you must create it first");
21706
21921
  }
@@ -21710,7 +21925,7 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
21710
21925
  entityType: trustMember.legalEntityType,
21711
21926
  type: TrustMemberTypes.SETTLOR,
21712
21927
  settlorExemptionReason: trustMember.settlorExemptionReason,
21713
- name: `${trustMember.exemptSettlorName.firstName} ${trustMember.exemptSettlorName.lastName}`
21928
+ name: trustMember.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName}` : trustMember.name ?? ""
21714
21929
  }];
21715
21930
  return trustMember.roles.map((role2) => ({
21716
21931
  legalEntityId: trustMember.legalEntityId,
@@ -21753,12 +21968,13 @@ const createExemptSettlor = async ({
21753
21968
  trust,
21754
21969
  handleCreateLegalEntity
21755
21970
  }) => {
21971
+ var _a, _b;
21756
21972
  const exemptSettlorLE = {
21757
21973
  type: LegalEntityType.INDIVIDUAL,
21758
21974
  individual: {
21759
21975
  name: {
21760
- firstName: exemptSettlor.exemptSettlorName.firstName,
21761
- lastName: exemptSettlor.exemptSettlorName.lastName
21976
+ firstName: ((_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName) ?? "",
21977
+ lastName: ((_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName) ?? ""
21762
21978
  },
21763
21979
  residentialAddress: {
21764
21980
  country: trust.trust.registeredAddress.country
@@ -21767,6 +21983,21 @@ const createExemptSettlor = async ({
21767
21983
  };
21768
21984
  return handleCreateLegalEntity(exemptSettlorLE);
21769
21985
  };
21986
+ const createOrganizationExemptSettlor = async ({
21987
+ exemptSettlor,
21988
+ handleCreateLegalEntity
21989
+ }) => {
21990
+ const exemptSettlorLE = {
21991
+ type: LegalEntityType.ORGANIZATION,
21992
+ organization: {
21993
+ legalName: exemptSettlor.name ?? "",
21994
+ registeredAddress: {
21995
+ country: exemptSettlor.country
21996
+ }
21997
+ }
21998
+ };
21999
+ return handleCreateLegalEntity(exemptSettlorLE);
22000
+ };
21770
22001
  const deleteAssociatedTrustMember = async ({
21771
22002
  associatedTrustMember,
21772
22003
  trust,
@@ -21797,11 +22028,26 @@ const updateExemptSettlorName = async ({
21797
22028
  exemptSettlor,
21798
22029
  handleUpdateLegalEntity
21799
22030
  }) => {
22031
+ var _a, _b;
21800
22032
  const exemptSettlorPatch = {
21801
22033
  individual: {
21802
22034
  name: {
21803
- firstName: exemptSettlor.exemptSettlorName.firstName,
21804
- lastName: exemptSettlor.exemptSettlorName.lastName
22035
+ firstName: (_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName,
22036
+ lastName: (_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName
22037
+ }
22038
+ }
22039
+ };
22040
+ return handleUpdateLegalEntity(exemptSettlorPatch, exemptSettlor.legalEntityId);
22041
+ };
22042
+ const updateOrganizationExemptSettlorName = async ({
22043
+ exemptSettlor,
22044
+ handleUpdateLegalEntity
22045
+ }) => {
22046
+ const exemptSettlorPatch = {
22047
+ organization: {
22048
+ legalName: exemptSettlor.name,
22049
+ registeredAddress: {
22050
+ country: exemptSettlor.country
21805
22051
  }
21806
22052
  }
21807
22053
  };
@@ -22221,10 +22467,12 @@ const Remove = ({
22221
22467
  };
22222
22468
  useEffect(() => {
22223
22469
  if (undoTimer === 0 && isRemoving) {
22224
- onRemove();
22225
- setIsRemoving(false);
22226
- onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22227
- handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
22470
+ (async () => {
22471
+ setIsRemoving(false);
22472
+ await onRemove();
22473
+ onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22474
+ handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
22475
+ })();
22228
22476
  }
22229
22477
  }, [undoTimer, isRemoving, onRemoveStatusChange, handleIsRemoveDisabled, onRemove]);
22230
22478
  return isRemoving ? jsx(Button, {
@@ -22638,11 +22886,11 @@ function LegalEntityTypeSwitcher({
22638
22886
  children: [jsx("h2", {
22639
22887
  className: "adyen-kyc-form-header__heading",
22640
22888
  "data-testid": LegalEntityType.ORGANIZATION,
22641
- children: i18n.get("continueAsCompany")
22889
+ children: i18n.get("areYouACompany")
22642
22890
  }), jsx("span", {
22643
- children: i18n.get("indicatedPayoutToCompany")
22891
+ children: i18n.get("singingUpAsIndividualButLooksLikeYouAreACompany")
22644
22892
  }), jsx("p", {
22645
- children: i18n.get("continueSigningUpAsCompany")
22893
+ children: i18n.get("wouldYouLikeToSignUpAsCompanyInstead")
22646
22894
  })]
22647
22895
  });
22648
22896
  case LegalEntityType.INDIVIDUAL:
@@ -22650,11 +22898,11 @@ function LegalEntityTypeSwitcher({
22650
22898
  children: [jsx("h2", {
22651
22899
  className: "adyen-kyc-form-header__heading",
22652
22900
  "data-testid": LegalEntityType.INDIVIDUAL,
22653
- children: i18n.get("continueAsIndividual")
22901
+ children: i18n.get("areYouAnIndividual")
22654
22902
  }), jsx("span", {
22655
- children: i18n.get("indicatedPayoutToPersonalAccount")
22903
+ children: i18n.get("singingUpAsCompanyButLooksLikeYouAreAnIndividual")
22656
22904
  }), jsx("p", {
22657
- children: i18n.get("continueSigningUpAsIndividual")
22905
+ children: i18n.get("wouldYouLikeToSignUpAsIndividualInstead")
22658
22906
  })]
22659
22907
  });
22660
22908
  default:
@@ -23272,10 +23520,11 @@ const ExemptSettlorTaskItem = ({
23272
23520
  onEdit,
23273
23521
  onDelete
23274
23522
  }) => {
23523
+ var _a, _b;
23275
23524
  const {
23276
23525
  i18n
23277
23526
  } = useI18nContext();
23278
- const settlorName = `${exemptSettlor.exemptSettlorName.firstName} ${exemptSettlor.exemptSettlorName.lastName}`;
23527
+ const settlorName = exemptSettlor.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = exemptSettlor.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName}` : exemptSettlor.name ?? "";
23279
23528
  const actions = [{
23280
23529
  icon: "edit",
23281
23530
  onSelect: onEdit,
@@ -23899,42 +24148,50 @@ function IndividualDropinComponent({
23899
24148
  };
23900
24149
  const datasetUtils = datasetUtilities(i18n.locale);
23901
24150
  const formatIdDocument = (idDocument2) => {
23902
- var _a2, _b2, _c2, _d2, _e, _f;
23903
- if (idDocument2) {
23904
- const documentType2 = hasInstantIdVerification({
23905
- idDocument: idDocument2
23906
- }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
23907
- id: id2
23908
- }) => (idDocument2 == null ? void 0 : idDocument2.idDocumentType) === id2);
23909
- return {
23910
- documentType: i18n.get(documentType2 == null ? void 0 : documentType2.name),
23911
- ...(documentType2 == null ? void 0 : documentType2.hasBackPage) ? {
23912
- frontPage: (_b2 = (_a2 = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name,
23913
- backPage: (_d2 = (_c2 = idDocument2 == null ? void 0 : idDocument2.idBackPage) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
23914
- } : {
23915
- fileName: (_f = (_e = idDocument2 == null ? void 0 : idDocument2.idFrontPage) == null ? void 0 : _e[0]) == null ? void 0 : _f.name
23916
- }
23917
- };
23918
- }
24151
+ var _a2, _b2;
24152
+ if (!idDocument2)
24153
+ return void 0;
24154
+ const documentType2 = hasInstantIdVerification({
24155
+ idDocument: idDocument2
24156
+ }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
24157
+ id: id2
24158
+ }) => idDocument2.idDocumentType === id2);
24159
+ if (!documentType2)
24160
+ return void 0;
24161
+ const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
24162
+ const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
24163
+ if (!frontPage2)
24164
+ return void 0;
24165
+ return {
24166
+ documentType: i18n.get(documentType2.name),
24167
+ ...backPage2 && documentType2.hasBackPage ? {
24168
+ frontPage: frontPage2.name,
24169
+ backPage: backPage2.name
24170
+ } : {
24171
+ fileName: frontPage2.name
24172
+ }
24173
+ };
23919
24174
  };
23920
24175
  const formatFileSummaryData2 = ({
23921
24176
  idDocument: idDocument2,
23922
24177
  proofOfNationalId: proofOfNationalId2,
23923
24178
  proofOfResidence: proofOfResidence2
23924
24179
  }) => {
23925
- var _a2, _b2, _c2, _d2;
24180
+ var _a2, _b2;
24181
+ const proofOfNationalIdFile = (_a2 = proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0];
24182
+ const proofOfResidenceFile = (_b2 = proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) == null ? void 0 : _b2[0];
23926
24183
  return {
23927
24184
  ...((idDocument2 == null ? void 0 : idDocument2.idDocumentType) || (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData)) && {
23928
24185
  idDocument: formatIdDocument(idDocument2)
23929
24186
  },
23930
- ...(proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) && {
24187
+ ...proofOfNationalIdFile && {
23931
24188
  proofOfNationalId: {
23932
- fileName: (_b2 = (_a2 = proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
24189
+ fileName: proofOfNationalIdFile.name
23933
24190
  }
23934
24191
  },
23935
- ...(proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) && {
24192
+ ...proofOfResidenceFile && {
23936
24193
  proofOfResidence: {
23937
- fileName: (_d2 = (_c2 = proofOfResidence2.proofOfResidence) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
24194
+ fileName: proofOfResidenceFile.name
23938
24195
  }
23939
24196
  }
23940
24197
  };
@@ -24218,6 +24475,7 @@ function PayoutDetailsDropinComponent({
24218
24475
  const [loadingStatus, setLoadingStatus] = useState("success");
24219
24476
  const [data, setData] = useState(prefilledData);
24220
24477
  const [problems, setProblems] = useState(propProblems || ((_c = (_b = getCapabilityProblems(legalEntityResponse)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument == null ? void 0 : transferInstrument.id]));
24478
+ const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(prefilledData.payoutAccountDetails);
24221
24479
  const baseTrackingPayload = getBaseTrackingPayload({
24222
24480
  trackingConfig,
24223
24481
  task: taskType
@@ -24342,6 +24600,11 @@ function PayoutDetailsDropinComponent({
24342
24600
  }
24343
24601
  }
24344
24602
  };
24603
+ useEffect(() => {
24604
+ var _a2;
24605
+ const payoutAccountData = (_a2 = cloneObject(data)) == null ? void 0 : _a2.payoutAccountDetails;
24606
+ setAccountDetailsFromInput(payoutAccountData);
24607
+ }, [data]);
24345
24608
  const onSubmit = async () => {
24346
24609
  setLoadingStatus("loading");
24347
24610
  const dataSubmitted = cloneObject(data);
@@ -24417,11 +24680,12 @@ function PayoutDetailsDropinComponent({
24417
24680
  };
24418
24681
  const isDocumentsRequired2 = (forms2) => forms2.some((form) => form.formId === payoutDetailsSteps.payoutAccountDocuments.formId);
24419
24682
  const formatFileSummaryData2 = (documents22) => {
24420
- var _a2, _b2;
24683
+ var _a2;
24684
+ const bankStatementDocument2 = (_a2 = documents22 == null ? void 0 : documents22.bankStatementDocument) == null ? void 0 : _a2[0];
24421
24685
  return {
24422
- ...(documents22 == null ? void 0 : documents22.bankStatementDocument) && {
24686
+ ...bankStatementDocument2 && {
24423
24687
  bankStatementDocument: {
24424
- fileName: (_b2 = (_a2 = documents22.bankStatementDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
24688
+ fileName: bankStatementDocument2.name
24425
24689
  }
24426
24690
  }
24427
24691
  };
@@ -24518,7 +24782,8 @@ function PayoutDetailsDropinComponent({
24518
24782
  shouldValidate,
24519
24783
  bankVerificationVendors,
24520
24784
  createTrustedTransferInstrument: createTrustedTransferInstrument2,
24521
- handleBankVerificationError: handleBankVerificationError2
24785
+ handleBankVerificationError: handleBankVerificationError2,
24786
+ accountDetailsFromInput
24522
24787
  })
24523
24788
  });
24524
24789
  }
@@ -25014,6 +25279,7 @@ const convertExistingSettlorExemptionReasons = (existingReasons) => {
25014
25279
  return existingReasons;
25015
25280
  };
25016
25281
  const convertExistingTrustMember = (trustMember) => {
25282
+ var _a, _b;
25017
25283
  switch (trustMember.trustMemberType) {
25018
25284
  case "undefinedBeneficiary":
25019
25285
  return {
@@ -25023,6 +25289,13 @@ const convertExistingTrustMember = (trustMember) => {
25023
25289
  };
25024
25290
  case "regular":
25025
25291
  case "company":
25292
+ return {
25293
+ entityType: trustMember.legalEntityType,
25294
+ role: trustMember.roles,
25295
+ settlorExemptionReason: ["noneOfTheAbove"],
25296
+ country: trustMember.trustMemberType === "company" ? trustMember.country : void 0,
25297
+ legalCompanyName: trustMember.trustMemberType === "company" ? trustMember.name : void 0
25298
+ };
25026
25299
  case "rootTrustee":
25027
25300
  return {
25028
25301
  entityType: trustMember.legalEntityType,
@@ -25031,11 +25304,13 @@ const convertExistingTrustMember = (trustMember) => {
25031
25304
  };
25032
25305
  case "exemptSettlor":
25033
25306
  return {
25034
- entityType: LegalEntityType.INDIVIDUAL,
25307
+ entityType: trustMember.legalEntityType,
25035
25308
  role: ["settlor"],
25036
25309
  settlorExemptionReason: convertExistingSettlorExemptionReasons(trustMember.settlorExemptionReason),
25037
- firstName: trustMember.exemptSettlorName.firstName,
25038
- lastName: trustMember.exemptSettlorName.lastName
25310
+ firstName: (_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName,
25311
+ lastName: (_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName,
25312
+ legalCompanyName: trustMember.name,
25313
+ country: trustMember.country
25039
25314
  };
25040
25315
  }
25041
25316
  };
@@ -25059,6 +25334,10 @@ const isExemptSettlor = (data) => {
25059
25334
  var _a;
25060
25335
  return ((_a = data.settlorExemptionReason) == null ? void 0 : _a.some((reason) => reason !== "noneOfTheAbove")) ?? false;
25061
25336
  };
25337
+ const isOrganizationAndSettlor = (data) => {
25338
+ var _a;
25339
+ return data.entityType === LegalEntityType.ORGANIZATION && ((_a = data.role) == null ? void 0 : _a.length) === 1 && data.role[0] === "settlor";
25340
+ };
25062
25341
  const roleAndTypeValidationRules = {
25063
25342
  entityType: {
25064
25343
  modes: ["blur"],
@@ -25079,6 +25358,16 @@ const roleAndTypeValidationRules = {
25079
25358
  modes: ["blur"],
25080
25359
  validate: (reasons) => Boolean(reasons == null ? void 0 : reasons.length),
25081
25360
  errorMessage: "fieldIsRequired"
25361
+ },
25362
+ country: {
25363
+ modes: ["blur"],
25364
+ validate: (country2) => !!country2,
25365
+ errorMessage: "fieldIsRequired"
25366
+ },
25367
+ legalCompanyName: {
25368
+ modes: ["blur"],
25369
+ validate: (name) => !!name,
25370
+ errorMessage: "fieldIsRequired"
25082
25371
  }
25083
25372
  };
25084
25373
  const CHARACTERS_LIMIT = 256;
@@ -25094,29 +25383,34 @@ const leTypeCardDetails = {
25094
25383
  description: "businessEntityDescription"
25095
25384
  }
25096
25385
  };
25097
- const decideFields = (data) => {
25098
- var _a, _b;
25099
- if ((_a = data.role) == null ? void 0 : _a.includes("undefinedBeneficiary")) {
25100
- return ["role", "descriptionUndefinedBeneficiary"];
25101
- }
25102
- if ((_b = data.role) == null ? void 0 : _b.length) {
25103
- if (couldBeExemptSettlor(data)) {
25104
- return isExemptSettlor(data) ? ["role", "entityType", "settlorExemptionReason", "firstName", "lastName"] : ["role", "entityType", "settlorExemptionReason"];
25105
- }
25106
- return ["role", "entityType"];
25107
- }
25108
- return ["role"];
25109
- };
25110
25386
  const TrustRoleAndEntityType = (props) => {
25111
25387
  const {
25112
25388
  existingTrustMember,
25113
- id: id2
25389
+ id: id2,
25390
+ getLegalEntityHandler,
25391
+ isOrganizationSettlorWithExemptionEnabled
25114
25392
  } = props;
25115
25393
  const {
25116
25394
  i18n
25117
25395
  } = useI18nContext();
25118
25396
  const defaultData = existingTrustMember ? convertExistingTrustMember(existingTrustMember) : {};
25119
25397
  const formUtils = formUtilities(props, i18n);
25398
+ const decideFields = (data2) => {
25399
+ var _a, _b;
25400
+ if ((_a = data2.role) == null ? void 0 : _a.includes("undefinedBeneficiary")) {
25401
+ return ["role", "descriptionUndefinedBeneficiary"];
25402
+ }
25403
+ if ((_b = data2.role) == null ? void 0 : _b.length) {
25404
+ if (isOrganizationSettlorWithExemptionEnabled && isOrganizationAndSettlor(data2)) {
25405
+ return ["role", "entityType", "settlorExemptionReason", "country", "legalCompanyName"];
25406
+ }
25407
+ if (couldBeExemptSettlor(data2)) {
25408
+ return isExemptSettlor(data2) ? ["role", "entityType", "settlorExemptionReason", "firstName", "lastName"] : ["role", "entityType", "settlorExemptionReason"];
25409
+ }
25410
+ return ["role", "entityType"];
25411
+ }
25412
+ return ["role"];
25413
+ };
25120
25414
  const {
25121
25415
  data,
25122
25416
  valid,
@@ -25136,6 +25430,18 @@ const TrustRoleAndEntityType = (props) => {
25136
25430
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
25137
25431
  });
25138
25432
  const availableRoles = getAvailableRoles(data.role);
25433
+ useEffect(() => {
25434
+ (async () => {
25435
+ var _a;
25436
+ if (isOrganizationSettlorWithExemptionEnabled && existingTrustMember && existingTrustMember.trustMemberType === "exemptSettlor" && existingTrustMember.legalEntityId !== "isNewEntry" && existingTrustMember.roles !== void 0 && existingTrustMember.roles.length === 1 && existingTrustMember.roles[0] === "settlor" && getLegalEntityHandler) {
25437
+ const response = await getLegalEntityHandler(existingTrustMember.legalEntityId);
25438
+ const country2 = (_a = response == null ? void 0 : response.organization) == null ? void 0 : _a.registeredAddress.country;
25439
+ if (response && response.organization) {
25440
+ handleChangeFor("country")(country2);
25441
+ }
25442
+ }
25443
+ })();
25444
+ }, []);
25139
25445
  useEffect(() => {
25140
25446
  var _a;
25141
25447
  (_a = props.onChange) == null ? void 0 : _a.call(props, {
@@ -25183,6 +25489,13 @@ const TrustRoleAndEntityType = (props) => {
25183
25489
  setValid("lastName", valid2.lastName);
25184
25490
  setErrors("lastName", errors2.lastName);
25185
25491
  };
25492
+ const onEntityTypeChange = (value) => {
25493
+ var _a;
25494
+ if (isOrganizationSettlorWithExemptionEnabled && value === LegalEntityType.ORGANIZATION && ((_a = data.role) == null ? void 0 : _a.length) === 1 && data.role[0] === "settlor") {
25495
+ changeSettlorExemptionReasons(["professionalServiceProvider"]);
25496
+ }
25497
+ handleChangeFor("entityType")(value);
25498
+ };
25186
25499
  return jsxs("form", {
25187
25500
  className: "adyen-kyc-trust__role-and-entity-type adl-u-width-full",
25188
25501
  children: [jsx(FormHeader, {
@@ -25220,7 +25533,7 @@ const TrustRoleAndEntityType = (props) => {
25220
25533
  children: (childProps) => jsx(RadioCardSelect, {
25221
25534
  ...childProps,
25222
25535
  options: trustMemberLegalEntityTypes,
25223
- onSelect: handleChangeFor("entityType"),
25536
+ onSelect: onEntityTypeChange,
25224
25537
  selected: data.entityType,
25225
25538
  optionId: (option) => leTypeCardDetails[option].id,
25226
25539
  optionName: (option) => leTypeCardDetails[option].name,
@@ -25246,7 +25559,7 @@ const TrustRoleAndEntityType = (props) => {
25246
25559
  "aria-label": formUtils.getLabel("descriptionUndefinedBeneficiary"),
25247
25560
  "aria-invalid": !valid.descriptionUndefinedBeneficiary
25248
25561
  })
25249
- }), (schema == null ? void 0 : schema.includes("settlorExemptionReason")) && jsx(Field, {
25562
+ }), (schema == null ? void 0 : schema.includes("settlorExemptionReason")) && !isOrganizationAndSettlor(data) && jsx(Field, {
25250
25563
  name: "settlorExemptionReason",
25251
25564
  label: formUtils.getLabel("settlorExemptionReason", "whichOfTheseApplyToTheSettlor"),
25252
25565
  isValid: valid.settlorExemptionReason,
@@ -25277,6 +25590,27 @@ const TrustRoleAndEntityType = (props) => {
25277
25590
  },
25278
25591
  onChange: onNameChange,
25279
25592
  dataStoreId: id2
25593
+ }) : void 0, isOrganizationSettlorWithExemptionEnabled && (schema == null ? void 0 : schema.includes("country")) && (schema == null ? void 0 : schema.includes("legalCompanyName")) ? jsxs(Fragment, {
25594
+ children: [jsx(CountryField, {
25595
+ data: formUtils.getFieldData(data, COUNTRY_FIELD),
25596
+ valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
25597
+ errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
25598
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD),
25599
+ readonly: false,
25600
+ classNameModifiers: COUNTRY_FIELD,
25601
+ allowedCountries: [],
25602
+ handleChangeFor
25603
+ }), jsx(LegalCompanyNameField, {
25604
+ data: formUtils.getFieldData(data, LEGAL_COMPANY_NAME_FIELD),
25605
+ valid: formUtils.getFieldValid(valid, LEGAL_COMPANY_NAME_FIELD),
25606
+ errors: formUtils.getFieldErrors(errors, fieldProblems, LEGAL_COMPANY_NAME_FIELD),
25607
+ labels: formUtils.getFieldLabels(LEGAL_COMPANY_NAME_FIELD),
25608
+ helperText: formUtils.getFieldHelperText(LEGAL_COMPANY_NAME_FIELD, {
25609
+ legalCompanyName: "legalCompanyName__helperText"
25610
+ }),
25611
+ readonly: false,
25612
+ handleChangeFor
25613
+ })]
25280
25614
  }) : void 0]
25281
25615
  });
25282
25616
  };
@@ -25326,11 +25660,22 @@ const decideForms = (trustMember) => {
25326
25660
  return regularForms;
25327
25661
  }
25328
25662
  };
25329
- const convertDataToTrustMember = (data, existingTrustMember) => {
25663
+ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettlorWithExemptionReasonEnabled2 = false) => {
25330
25664
  var _a;
25331
25665
  const existingId = existingTrustMember ? existingTrustMember.trustMemberType === "undefinedBeneficiary" ? existingTrustMember.reference : existingTrustMember.legalEntityId : void 0;
25332
25666
  if ((_a = data.role) == null ? void 0 : _a.length) {
25333
- if (isExemptSettlor(data))
25667
+ if (isExemptSettlor(data)) {
25668
+ if (isOrganizationSettlorWithExemptionReasonEnabled2 && data.entityType === LegalEntityType.ORGANIZATION) {
25669
+ return {
25670
+ trustMemberType: "exemptSettlor",
25671
+ roles: [TrustMemberTypes.SETTLOR],
25672
+ legalEntityType: LegalEntityType.ORGANIZATION,
25673
+ legalEntityId: existingId ?? isNewEntity,
25674
+ name: data.legalCompanyName ?? "",
25675
+ settlorExemptionReason: ["professionalServiceProvider"],
25676
+ country: data.country
25677
+ };
25678
+ }
25334
25679
  return {
25335
25680
  trustMemberType: "exemptSettlor",
25336
25681
  roles: [TrustMemberTypes.SETTLOR],
@@ -25342,6 +25687,7 @@ const convertDataToTrustMember = (data, existingTrustMember) => {
25342
25687
  },
25343
25688
  legalEntityId: existingId ?? isNewEntity
25344
25689
  };
25690
+ }
25345
25691
  if (data.role.includes("undefinedBeneficiary"))
25346
25692
  return {
25347
25693
  trustMemberType: "undefinedBeneficiary",
@@ -25349,14 +25695,16 @@ const convertDataToTrustMember = (data, existingTrustMember) => {
25349
25695
  description: data.descriptionUndefinedBeneficiary ?? "",
25350
25696
  reference: existingId ?? isNewEntity
25351
25697
  };
25352
- if (data.entityType === LegalEntityType.ORGANIZATION)
25698
+ if (data.entityType === LegalEntityType.ORGANIZATION) {
25353
25699
  return {
25354
25700
  trustMemberType: "company",
25355
25701
  roles: data.role,
25356
25702
  legalEntityType: LegalEntityType.ORGANIZATION,
25357
25703
  legalEntityId: existingId ?? isNewEntity,
25358
- name: ""
25704
+ name: data.legalCompanyName ?? "",
25705
+ country: data.country
25359
25706
  };
25707
+ }
25360
25708
  if (data.entityType === LegalEntityType.INDIVIDUAL)
25361
25709
  return {
25362
25710
  trustMemberType: "regular",
@@ -25372,8 +25720,11 @@ function RoleAndTypeDropinComponent({
25372
25720
  existingTrustMember,
25373
25721
  navigateToFullDropinFor,
25374
25722
  navigateBack,
25375
- addOrUpdateTrustMember
25723
+ addOrUpdateTrustMember,
25724
+ getLegalEntityHandler,
25725
+ isOrganizationSettlorWithExemptionEnabled
25376
25726
  }) {
25727
+ var _a, _b;
25377
25728
  const {
25378
25729
  i18n
25379
25730
  } = useI18nContext();
@@ -25394,8 +25745,10 @@ function RoleAndTypeDropinComponent({
25394
25745
  entityType: trustMember.trustMemberType !== "undefinedBeneficiary" ? i18n.get(trustMember.legalEntityType) : void 0,
25395
25746
  descriptionUndefinedBeneficiary: trustMember.trustMemberType === "undefinedBeneficiary" ? trustMember.description : void 0,
25396
25747
  otherInformation: trustMember.trustMemberType === "exemptSettlor" ? formatSettlorExemptionReasonsForSummary(trustMember.settlorExemptionReason ?? []) : void 0,
25397
- firstName: trustMember.trustMemberType === "exemptSettlor" ? trustMember.exemptSettlorName.firstName : void 0,
25398
- lastName: trustMember.trustMemberType === "exemptSettlor" ? trustMember.exemptSettlorName.lastName : void 0
25748
+ firstName: trustMember.trustMemberType === "exemptSettlor" ? (_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName : void 0,
25749
+ lastName: trustMember.trustMemberType === "exemptSettlor" ? (_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName : void 0,
25750
+ country: isOrganizationSettlorWithExemptionEnabled && trustMember.trustMemberType === "exemptSettlor" ? trustMember.country : void 0,
25751
+ legalCompanyName: isOrganizationSettlorWithExemptionEnabled && trustMember.trustMemberType === "exemptSettlor" ? trustMember.name : void 0
25399
25752
  }
25400
25753
  };
25401
25754
  const onNavigateToNextStep = () => {
@@ -25416,7 +25769,7 @@ function RoleAndTypeDropinComponent({
25416
25769
  [dataStoreId]: isValid
25417
25770
  });
25418
25771
  }
25419
- setTrustMember(convertDataToTrustMember(data, existingTrustMember));
25772
+ setTrustMember(convertDataToTrustMember(data, existingTrustMember, isOrganizationSettlorWithExemptionEnabled));
25420
25773
  };
25421
25774
  const saveRolesAndNavigate = async () => {
25422
25775
  if (trustMember === "incomplete")
@@ -25462,7 +25815,9 @@ function RoleAndTypeDropinComponent({
25462
25815
  id: "roleAndEntityType",
25463
25816
  existingTrustMember,
25464
25817
  onChange: onTrustMemberChange,
25465
- shouldValidate
25818
+ shouldValidate,
25819
+ getLegalEntityHandler,
25820
+ isOrganizationSettlorWithExemptionEnabled
25466
25821
  })
25467
25822
  }), isSummaryStep && jsx("div", {
25468
25823
  className: "adyen-kyc-form-wrapper",
@@ -25495,7 +25850,7 @@ const serviceAgreementValidationRules = {
25495
25850
  errorMessage: "fieldIsRequired"
25496
25851
  }
25497
25852
  };
25498
- const logger$9 = createLogger("useServiceAgreement");
25853
+ const logger$8 = createLogger("useServiceAgreement");
25499
25854
  const FALLBACK_LANGUAGE_CODE = "en";
25500
25855
  const useServiceAgreement = ({
25501
25856
  handleGetServiceAgreement,
@@ -25524,7 +25879,7 @@ const useServiceAgreement = ({
25524
25879
  language: agreementLanguage
25525
25880
  });
25526
25881
  if (!document2) {
25527
- logger$9.log('"document" field was missing in response');
25882
+ logger$8.log('"document" field was missing in response');
25528
25883
  return;
25529
25884
  }
25530
25885
  const contract = JSON.parse(decodeURIComponent(escape(window.atob(document2))));
@@ -25542,7 +25897,7 @@ const useServiceAgreement = ({
25542
25897
  throw err;
25543
25898
  }
25544
25899
  };
25545
- requestServiceAgreement().catch(logger$9.error);
25900
+ requestServiceAgreement().catch(logger$8.error);
25546
25901
  }, [handleGetServiceAgreement, handleServiceAgreementIsNotAvailableInThatLanguage, agreementLanguage, legalEntityId, serviceAgreementType]);
25547
25902
  return {
25548
25903
  loading: loading2,
@@ -26624,11 +26979,12 @@ function SolePropDropinComponent({
26624
26979
  return summaryData;
26625
26980
  };
26626
26981
  const formatFileSummaryData2 = (solePropConstitutionalDocument) => {
26627
- var _a2, _b;
26982
+ var _a2;
26983
+ const constitutionalDocument2 = (_a2 = solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0];
26628
26984
  return {
26629
- ...(solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) && {
26985
+ ...constitutionalDocument2 && {
26630
26986
  solePropConstitutionalDocument: {
26631
- fileName: (_b = (_a2 = solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b.name
26987
+ fileName: constitutionalDocument2.name
26632
26988
  }
26633
26989
  }
26634
26990
  };
@@ -26838,11 +27194,12 @@ function TrustDropinComponent(props) {
26838
27194
  return summaryData;
26839
27195
  };
26840
27196
  const formatFileSummaryData2 = (trustConstitutionalDocument) => {
26841
- var _a, _b;
27197
+ var _a;
27198
+ const constitutionalDocument2 = (_a = trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0];
26842
27199
  return {
26843
- ...(trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) && {
27200
+ ...constitutionalDocument2 && {
26844
27201
  trustConstitutionalDocument: {
26845
- fileName: (_b = (_a = trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
27202
+ fileName: constitutionalDocument2.name
26846
27203
  }
26847
27204
  }
26848
27205
  };
@@ -26878,7 +27235,8 @@ function TrustDropinComponent(props) {
26878
27235
  }
26879
27236
  const PAGES_WITH_STATUS = [TaskTypes.DECISION_MAKER_OVERVIEW, TaskTypes.TASKS_OVERVIEW];
26880
27237
  const POLLING_INTERVAL = 3e3;
26881
- const logger$8 = createLogger("DropinComposerComponent");
27238
+ const logger$7 = createLogger("DropinComposerComponent");
27239
+ const isOrganizationSettlorWithExemptionReasonEnabled = (enabled, country2) => country2 === CountryCodes.Australia && enabled;
26882
27240
  function DropinComposerComponent({
26883
27241
  capabilities,
26884
27242
  legalEntityResponse,
@@ -26937,6 +27295,7 @@ function DropinComposerComponent({
26937
27295
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
26938
27296
  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);
26939
27297
  const additionalSalesChannels = useSalesChannelsSettings();
27298
+ const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("OrganizationSettlorWithExemptionReason"), trust == null ? void 0 : trust.trust.countryOfGoverningLaw);
26940
27299
  const getLegalEntityProblems = (le) => {
26941
27300
  var _a2;
26942
27301
  if (le == null ? void 0 : le.id) {
@@ -26955,7 +27314,7 @@ function DropinComposerComponent({
26955
27314
  setPciStatus(response);
26956
27315
  return response;
26957
27316
  } catch (e) {
26958
- logger$8.warn(i18n.get("failedToGetPciStatus"));
27317
+ logger$7.warn(i18n.get("failedToGetPciStatus"));
26959
27318
  }
26960
27319
  }
26961
27320
  return void 0;
@@ -26984,7 +27343,7 @@ function DropinComposerComponent({
26984
27343
  useEffect(() => {
26985
27344
  if (!tasks.includes(TaskTypes.PCI_DSS))
26986
27345
  return;
26987
- getPciTemplate().catch(logger$8.error);
27346
+ getPciTemplate().catch(logger$7.error);
26988
27347
  }, [getPciTemplate, tasks]);
26989
27348
  const getServiceAgreementAcceptanceInfos = async () => {
26990
27349
  if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
@@ -26992,7 +27351,7 @@ function DropinComposerComponent({
26992
27351
  const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
26993
27352
  setServiceAgreementAcceptanceInfos(response.data);
26994
27353
  } catch (e) {
26995
- logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
27354
+ logger$7.warn(i18n.get("failedToGetServiceAgreementStatus"));
26996
27355
  }
26997
27356
  }
26998
27357
  };
@@ -27002,7 +27361,7 @@ function DropinComposerComponent({
27002
27361
  const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
27003
27362
  setServiceAgreementTypes(response.termsOfServiceTypes);
27004
27363
  } catch (e) {
27005
- logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
27364
+ logger$7.warn(i18n.get("failedToGetServiceAgreementStatus"));
27006
27365
  }
27007
27366
  }
27008
27367
  };
@@ -27041,7 +27400,7 @@ function DropinComposerComponent({
27041
27400
  setCapabilityProblems(getCapabilityProblems(response));
27042
27401
  return response;
27043
27402
  } catch (e) {
27044
- logger$8.warn(i18n.get("failedToFetchLegalEntityDetails"));
27403
+ logger$7.warn(i18n.get("failedToFetchLegalEntityDetails"));
27045
27404
  }
27046
27405
  }
27047
27406
  return void 0;
@@ -27053,7 +27412,7 @@ function DropinComposerComponent({
27053
27412
  setTrust(response);
27054
27413
  return response;
27055
27414
  } catch (e) {
27056
- logger$8.warn(i18n.get("failedToFetchTrustDetails"));
27415
+ logger$7.warn(i18n.get("failedToFetchTrustDetails"));
27057
27416
  }
27058
27417
  }
27059
27418
  return void 0;
@@ -27103,7 +27462,7 @@ function DropinComposerComponent({
27103
27462
  label: i18n.get("successFullyRemovedTrustMember")
27104
27463
  });
27105
27464
  } catch (err) {
27106
- logger$8.error(`Failed to delete trust member`, err);
27465
+ logger$7.error(`Failed to delete trust member`, err);
27107
27466
  showToast({
27108
27467
  type: ToastType.ERROR,
27109
27468
  label: i18n.get("failedToRemoveTrustMember")
@@ -27126,7 +27485,10 @@ function DropinComposerComponent({
27126
27485
  break;
27127
27486
  case "exemptSettlor":
27128
27487
  if (!existing) {
27129
- const newSettlorLE = await createExemptSettlor({
27488
+ const newSettlorLE = isOrganizationSettlorWithExemptionEnabled && updated.legalEntityType === "organization" ? await createOrganizationExemptSettlor({
27489
+ exemptSettlor: updated,
27490
+ handleCreateLegalEntity: args.handleCreateLegalEntity
27491
+ }) : await createExemptSettlor({
27130
27492
  exemptSettlor: updated,
27131
27493
  trust,
27132
27494
  handleCreateLegalEntity: args.handleCreateLegalEntity
@@ -27139,6 +27501,12 @@ function DropinComposerComponent({
27139
27501
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27140
27502
  });
27141
27503
  }
27504
+ if (existing && isOrganizationSettlorWithExemptionEnabled && updated.legalEntityType === "organization") {
27505
+ await updateOrganizationExemptSettlorName({
27506
+ exemptSettlor: updated,
27507
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity
27508
+ });
27509
+ }
27142
27510
  await addOrUpdateAssociatedTrustMember({
27143
27511
  newOrUpdated: updated,
27144
27512
  trust,
@@ -27155,7 +27523,7 @@ function DropinComposerComponent({
27155
27523
  break;
27156
27524
  case "rootTrustee":
27157
27525
  default:
27158
- logger$8.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27526
+ logger$7.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27159
27527
  }
27160
27528
  showToast({
27161
27529
  label: i18n.get("successfullyUpdatedDetails"),
@@ -27163,7 +27531,7 @@ function DropinComposerComponent({
27163
27531
  });
27164
27532
  await refreshTrustAndRunOnSubmit(trust, 1);
27165
27533
  } catch (err) {
27166
- logger$8.error(err);
27534
+ logger$7.error(err);
27167
27535
  showToast({
27168
27536
  label: i18n.get("failedToUpdateDetails"),
27169
27537
  type: ToastType.ERROR
@@ -27386,7 +27754,7 @@ function DropinComposerComponent({
27386
27754
  }
27387
27755
  };
27388
27756
  setIsLoadingConfiguration(true);
27389
- fetchConfiguration().catch(logger$8.error).finally(() => {
27757
+ fetchConfiguration().catch(logger$7.error).finally(() => {
27390
27758
  setIsLoadingConfiguration(false);
27391
27759
  onLoad();
27392
27760
  });
@@ -27671,7 +28039,9 @@ function DropinComposerComponent({
27671
28039
  navigateBack();
27672
28040
  },
27673
28041
  existingTrustMember: trustMember,
27674
- addOrUpdateTrustMember: (newOrUpdated) => addOrUpdateTrustMember(newOrUpdated, trustMember)
28042
+ addOrUpdateTrustMember: (newOrUpdated) => addOrUpdateTrustMember(newOrUpdated, trustMember),
28043
+ getLegalEntityHandler: args == null ? void 0 : args.handleGetLegalEntity,
28044
+ isOrganizationSettlorWithExemptionEnabled
27675
28045
  });
27676
28046
  case TaskTypes.PCI_DSS:
27677
28047
  return jsx(PciDropinComponent, {
@@ -27743,7 +28113,6 @@ const ManageTransferInstrumentComponent$1 = "";
27743
28113
  const createDocument = async (context, document2, ownerId) => {
27744
28114
  const {
27745
28115
  loadingContext,
27746
- sdkToken,
27747
28116
  legalEntityId
27748
28117
  } = context;
27749
28118
  return httpPost({
@@ -27751,7 +28120,7 @@ const createDocument = async (context, document2, ownerId) => {
27751
28120
  errorLevel: "warn",
27752
28121
  errorMessage: `Failed to create document`,
27753
28122
  path: `${legalEntityId}/documents/${ownerId}`,
27754
- sdkToken,
28123
+ authentication: "jwt",
27755
28124
  headers: {
27756
28125
  "Content-Type": "application/json"
27757
28126
  }
@@ -27760,7 +28129,6 @@ const createDocument = async (context, document2, ownerId) => {
27760
28129
  const createTransferInstrument = async (context, transferInstrument) => {
27761
28130
  const {
27762
28131
  loadingContext,
27763
- sdkToken,
27764
28132
  legalEntityId
27765
28133
  } = context;
27766
28134
  return httpPost({
@@ -27768,7 +28136,7 @@ const createTransferInstrument = async (context, transferInstrument) => {
27768
28136
  errorLevel: "warn",
27769
28137
  errorMessage: `Failed to create transferInstrument`,
27770
28138
  path: `${legalEntityId}/transferInstruments`,
27771
- sdkToken,
28139
+ authentication: "jwt",
27772
28140
  headers: {
27773
28141
  "Content-Type": "application/json"
27774
28142
  }
@@ -27777,7 +28145,6 @@ const createTransferInstrument = async (context, transferInstrument) => {
27777
28145
  const getBankVerificationVendor = async (context, country2) => {
27778
28146
  const {
27779
28147
  loadingContext,
27780
- sdkToken,
27781
28148
  legalEntityId
27782
28149
  } = context;
27783
28150
  return httpGet({
@@ -27785,7 +28152,7 @@ const getBankVerificationVendor = async (context, country2) => {
27785
28152
  errorLevel: "warn",
27786
28153
  errorMessage: `Bank verification vendor not available`,
27787
28154
  path: `${legalEntityId}/transferInstruments/trusted/providers?country=${country2}`,
27788
- sdkToken,
28155
+ authentication: "jwt",
27789
28156
  headers: {
27790
28157
  "Content-Type": "application/json"
27791
28158
  }
@@ -27793,8 +28160,7 @@ const getBankVerificationVendor = async (context, country2) => {
27793
28160
  };
27794
28161
  const getDataset$1 = async (context, name, locale) => {
27795
28162
  const {
27796
- loadingContext,
27797
- sdkToken
28163
+ loadingContext
27798
28164
  } = context;
27799
28165
  const datasetUtils = datasetUtilities(locale);
27800
28166
  const dataset = datasetUtils.getDataset(name);
@@ -27809,7 +28175,7 @@ const getDataset$1 = async (context, name, locale) => {
27809
28175
  errorLevel: "warn",
27810
28176
  errorMessage: `Dataset ${name} is not available`,
27811
28177
  path,
27812
- sdkToken,
28178
+ authentication: "jwt",
27813
28179
  headers: {
27814
28180
  "Content-Type": "application/json"
27815
28181
  }
@@ -27821,7 +28187,6 @@ const getDataset$1 = async (context, name, locale) => {
27821
28187
  const getDocument = async (context, documentId) => {
27822
28188
  const {
27823
28189
  loadingContext,
27824
- sdkToken,
27825
28190
  legalEntityId
27826
28191
  } = context;
27827
28192
  return httpGet({
@@ -27829,7 +28194,7 @@ const getDocument = async (context, documentId) => {
27829
28194
  errorLevel: "warn",
27830
28195
  errorMessage: `Failed to fetch document`,
27831
28196
  path: `${legalEntityId}/documents/${documentId}`,
27832
- sdkToken,
28197
+ authentication: "jwt",
27833
28198
  headers: {
27834
28199
  "Content-Type": "application/json"
27835
28200
  }
@@ -27838,7 +28203,6 @@ const getDocument = async (context, documentId) => {
27838
28203
  const getLegalEntity = async (context) => {
27839
28204
  const {
27840
28205
  loadingContext,
27841
- sdkToken,
27842
28206
  legalEntityId
27843
28207
  } = context;
27844
28208
  return httpGet({
@@ -27846,7 +28210,7 @@ const getLegalEntity = async (context) => {
27846
28210
  errorLevel: "warn",
27847
28211
  errorMessage: `LegalEntity not available`,
27848
28212
  path: `${legalEntityId}`,
27849
- sdkToken,
28213
+ authentication: "jwt",
27850
28214
  headers: {
27851
28215
  "Content-Type": "application/json"
27852
28216
  }
@@ -27855,7 +28219,6 @@ const getLegalEntity = async (context) => {
27855
28219
  const getScenarios = async (context) => {
27856
28220
  const {
27857
28221
  loadingContext,
27858
- sdkToken,
27859
28222
  legalEntityId
27860
28223
  } = context;
27861
28224
  return httpGet({
@@ -27863,7 +28226,7 @@ const getScenarios = async (context) => {
27863
28226
  errorLevel: "warn",
27864
28227
  errorMessage: `Scenarios not available`,
27865
28228
  path: `${legalEntityId}/configurations/scenarios`,
27866
- sdkToken,
28229
+ authentication: "jwt",
27867
28230
  headers: {
27868
28231
  "Content-Type": "application/json"
27869
28232
  }
@@ -27872,7 +28235,6 @@ const getScenarios = async (context) => {
27872
28235
  const getTasks = async (context) => {
27873
28236
  const {
27874
28237
  loadingContext,
27875
- sdkToken,
27876
28238
  legalEntityId
27877
28239
  } = context;
27878
28240
  return httpGet({
@@ -27880,7 +28242,7 @@ const getTasks = async (context) => {
27880
28242
  errorLevel: "warn",
27881
28243
  errorMessage: `Tasks not available`,
27882
28244
  path: `${legalEntityId}/configurations/tasks`,
27883
- sdkToken,
28245
+ authentication: "jwt",
27884
28246
  headers: {
27885
28247
  "Content-Type": "application/json"
27886
28248
  }
@@ -27889,7 +28251,6 @@ const getTasks = async (context) => {
27889
28251
  const getTransferInstrument = async (context, transferInstrumentId) => {
27890
28252
  const {
27891
28253
  loadingContext,
27892
- sdkToken,
27893
28254
  legalEntityId
27894
28255
  } = context;
27895
28256
  return httpGet({
@@ -27897,7 +28258,7 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27897
28258
  errorLevel: "warn",
27898
28259
  errorMessage: `TransferInstrument not available`,
27899
28260
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27900
- sdkToken,
28261
+ authentication: "jwt",
27901
28262
  headers: {
27902
28263
  "Content-Type": "application/json"
27903
28264
  }
@@ -27906,7 +28267,6 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27906
28267
  const getTransferInstruments = async (context) => {
27907
28268
  const {
27908
28269
  loadingContext,
27909
- sdkToken,
27910
28270
  legalEntityId
27911
28271
  } = context;
27912
28272
  return httpGet({
@@ -27914,7 +28274,7 @@ const getTransferInstruments = async (context) => {
27914
28274
  errorLevel: "warn",
27915
28275
  errorMessage: `TransferInstrument not available`,
27916
28276
  path: `${legalEntityId}/transferInstruments`,
27917
- sdkToken,
28277
+ authentication: "jwt",
27918
28278
  headers: {
27919
28279
  "Content-Type": "application/json"
27920
28280
  }
@@ -27923,7 +28283,6 @@ const getTransferInstruments = async (context) => {
27923
28283
  const updateDocument = async (context, document2, documentId, ownerId) => {
27924
28284
  const {
27925
28285
  loadingContext,
27926
- sdkToken,
27927
28286
  legalEntityId
27928
28287
  } = context;
27929
28288
  return httpPost({
@@ -27931,7 +28290,7 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27931
28290
  errorLevel: "warn",
27932
28291
  errorMessage: `Failed to update document`,
27933
28292
  path: `${legalEntityId}/documents/${documentId}/${ownerId}`,
27934
- sdkToken,
28293
+ authentication: "jwt",
27935
28294
  headers: {
27936
28295
  "Content-Type": "application/json"
27937
28296
  }
@@ -27940,7 +28299,6 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27940
28299
  const updateTransferInstrument = async (context, transferInstrument, transferInstrumentId) => {
27941
28300
  const {
27942
28301
  loadingContext,
27943
- sdkToken,
27944
28302
  legalEntityId
27945
28303
  } = context;
27946
28304
  return httpPost({
@@ -27948,7 +28306,7 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27948
28306
  errorLevel: "warn",
27949
28307
  errorMessage: `Failed to update transferInstrument`,
27950
28308
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27951
- sdkToken,
28309
+ authentication: "jwt",
27952
28310
  headers: {
27953
28311
  "Content-Type": "application/json"
27954
28312
  }
@@ -27957,7 +28315,6 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27957
28315
  const createTrustedTransferInstrument = async (context, code2, state2) => {
27958
28316
  const {
27959
28317
  loadingContext,
27960
- sdkToken,
27961
28318
  legalEntityId
27962
28319
  } = context;
27963
28320
  const path = `${legalEntityId}/transferInstruments/trusted`;
@@ -27966,7 +28323,7 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27966
28323
  errorLevel: "warn",
27967
28324
  errorMessage: `Failed to create trusted transferInstrument`,
27968
28325
  path,
27969
- sdkToken,
28326
+ authentication: "jwt",
27970
28327
  headers: {
27971
28328
  "Content-Type": "application/json"
27972
28329
  }
@@ -27978,7 +28335,6 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27978
28335
  const deleteTransferInstrument = async (context, transferInstrumentId) => {
27979
28336
  const {
27980
28337
  loadingContext,
27981
- sdkToken,
27982
28338
  legalEntityId
27983
28339
  } = context;
27984
28340
  return httpDelete({
@@ -27986,7 +28342,7 @@ const deleteTransferInstrument = async (context, transferInstrumentId) => {
27986
28342
  errorLevel: "warn",
27987
28343
  errorMessage: `Failed to create transferInstrument`,
27988
28344
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27989
- sdkToken,
28345
+ authentication: "jwt",
27990
28346
  headers: {
27991
28347
  "Content-Type": "application/json"
27992
28348
  }
@@ -27995,7 +28351,6 @@ const deleteTransferInstrument = async (context, transferInstrumentId) => {
27995
28351
  const handleBankVerificationError = async (context, errorCode, errorMessage, state2, metadata) => {
27996
28352
  const {
27997
28353
  loadingContext,
27998
- sdkToken,
27999
28354
  legalEntityId
28000
28355
  } = context;
28001
28356
  const path = `${legalEntityId}/transferInstruments/trusted/error`;
@@ -28004,7 +28359,7 @@ const handleBankVerificationError = async (context, errorCode, errorMessage, sta
28004
28359
  errorLevel: "warn",
28005
28360
  errorMessage: `Failed to create trusted transferInstrument`,
28006
28361
  path,
28007
- sdkToken,
28362
+ authentication: "jwt",
28008
28363
  headers: {
28009
28364
  "Content-Type": "application/json"
28010
28365
  }
@@ -28022,7 +28377,6 @@ const useComponentApi = (rootLegalEntityId) => {
28022
28377
  throw new Error("Cannot use component API outside an embedded dropin");
28023
28378
  }
28024
28379
  const {
28025
- sdkToken,
28026
28380
  loadingContext: base
28027
28381
  } = authContext;
28028
28382
  return useMemo(() => {
@@ -28030,8 +28384,7 @@ const useComponentApi = (rootLegalEntityId) => {
28030
28384
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
28031
28385
  const baseRequestContext = {
28032
28386
  loadingContext: loadingContextWithRootLEAuth,
28033
- legalEntityId: rootLegalEntityId,
28034
- sdkToken
28387
+ legalEntityId: rootLegalEntityId
28035
28388
  };
28036
28389
  return {
28037
28390
  getLegalEntity: async (legalEntityId) => getLegalEntity({
@@ -28050,7 +28403,7 @@ const useComponentApi = (rootLegalEntityId) => {
28050
28403
  handleBankVerificationError: async (errorCode, errorMessage, state2, metadata) => handleBankVerificationError(baseRequestContext, errorCode, errorMessage, state2, metadata),
28051
28404
  getTransferInstruments: async () => getTransferInstruments(baseRequestContext)
28052
28405
  };
28053
- }, [base, rootLegalEntityId, sdkToken]);
28406
+ }, [base, rootLegalEntityId]);
28054
28407
  };
28055
28408
  const DEFAULT_POLLING_INTERVAL = 3e3;
28056
28409
  const DEFAULT_POLLING_INTERVAL_RETRY_COUNT = 3;
@@ -28177,6 +28530,7 @@ function ManageTransferInstrumentOverviewItem({
28177
28530
  } = useI18nContext();
28178
28531
  const description2 = statusDescription[transferInstrumentReference.status];
28179
28532
  const needMoreDetails = transferInstrumentReference.status === "DETAILS_REQUIRED";
28533
+ const [isRemoving, setIsRemoving] = useState(false);
28180
28534
  const status = !needMoreDetails ? jsx(TaskItemStatus, {
28181
28535
  status: TaskStatus[transferInstrumentReference.status],
28182
28536
  size: "large",
@@ -28218,12 +28572,13 @@ function ManageTransferInstrumentOverviewItem({
28218
28572
  accountHolderName,
28219
28573
  onEdit: () => onEdit(transferInstrument.id)
28220
28574
  }), jsx(Remove, {
28221
- label: "removeThisBankAccount",
28222
- onRemove: () => onRemove(transferInstrumentReference.transferInstrument.id)
28575
+ label: isRemoving ? "removing" : "removeThisBankAccount",
28576
+ onRemove: async () => onRemove(transferInstrumentReference.transferInstrument.id),
28577
+ onRemoveStatusChange: setIsRemoving
28223
28578
  })]
28224
28579
  }, transferInstrumentReference.transferInstrument.id);
28225
28580
  }
28226
- const logger$7 = createLogger("ManageTransferInstrumentOverview");
28581
+ const logger$6 = createLogger("ManageTransferInstrumentOverview");
28227
28582
  function ManageTransferInstrumentOverview({
28228
28583
  transferInstrumentReferences,
28229
28584
  onAdd,
@@ -28248,7 +28603,7 @@ function ManageTransferInstrumentOverview({
28248
28603
  ...transferInstrumentsMap
28249
28604
  });
28250
28605
  } catch (e) {
28251
- logger$7.error(e);
28606
+ logger$6.error(e);
28252
28607
  }
28253
28608
  };
28254
28609
  const onRemoveTransferinstrument = async (transferInstrumentId) => {
@@ -28256,7 +28611,7 @@ function ManageTransferInstrumentOverview({
28256
28611
  await deleteTransferInstrument2(transferInstrumentId);
28257
28612
  onRemove(transferInstrumentId);
28258
28613
  } catch (e) {
28259
- logger$7.error(e);
28614
+ logger$6.error(e);
28260
28615
  }
28261
28616
  };
28262
28617
  const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef, PAYOUT) => jsx(ManageTransferInstrumentOverviewItem, {
@@ -28282,7 +28637,7 @@ function ManageTransferInstrumentOverview({
28282
28637
  })]
28283
28638
  });
28284
28639
  }
28285
- const logger$6 = createLogger("ManageTransferInstrumentComponent");
28640
+ const logger$5 = createLogger("ManageTransferInstrumentComponent");
28286
28641
  function ManageTransferInstrumentComponent({
28287
28642
  legalEntityId,
28288
28643
  onAdd,
@@ -28310,20 +28665,20 @@ function ManageTransferInstrumentComponent({
28310
28665
  status
28311
28666
  }) => status !== "FINISHED");
28312
28667
  useInterval(refreshTransferInstruments, hasUnverifiedTransferInstruments);
28313
- const init2 = async () => {
28668
+ const init2 = useCallback(async () => {
28314
28669
  const [transferInstrumentRefs, legalEntity] = await Promise.all([getTransferInstruments2(), getLegalEntity2(legalEntityId)]);
28315
- const accountHolderName2 = getPayoutAccountHolderName(legalEntity, i18n);
28316
- setAccountHolderName(accountHolderName2);
28670
+ const accountHolder2 = getPayoutAccountHolderName(legalEntity, i18n);
28671
+ setAccountHolderName(accountHolder2);
28317
28672
  setTransferInstruments(transferInstrumentRefs);
28318
- };
28673
+ }, [getTransferInstruments2, getLegalEntity2, i18n, legalEntityId]);
28319
28674
  useEffect(() => {
28320
28675
  eventEmitter == null ? void 0 : eventEmitter.on("updateLocale", (locale) => setLocale(locale));
28321
- init2().catch(logger$6.error).finally(() => {
28676
+ init2().catch(logger$5.error).finally(() => {
28322
28677
  setLoadingStatus("success");
28323
28678
  });
28324
- }, []);
28325
- const onRemove = async (transferInsrumentId) => {
28326
- await refreshTransferInstruments();
28679
+ }, [init2, setLocale, eventEmitter]);
28680
+ const onRemove = (transferInsrumentId) => {
28681
+ refreshTransferInstruments().catch(logger$5.error);
28327
28682
  onRemoveSuccess == null ? void 0 : onRemoveSuccess(transferInsrumentId, legalEntityId);
28328
28683
  };
28329
28684
  const render2 = () => {
@@ -28370,7 +28725,7 @@ class EventEmitter {
28370
28725
  };
28371
28726
  }
28372
28727
  }
28373
- const logger$5 = createLogger("TransferInstrumentComponent");
28728
+ const logger$4 = createLogger("TransferInstrumentComponent");
28374
28729
  function TransferInstrumentComponent({
28375
28730
  legalEntityId,
28376
28731
  transferInstrumentId,
@@ -28405,8 +28760,8 @@ function TransferInstrumentComponent({
28405
28760
  const ti = await getTransferInstrument2(transferInstrumentId);
28406
28761
  setTransferInstrument(ti);
28407
28762
  }
28408
- })().catch(logger$5.error);
28409
- }, [transferInstrumentId]);
28763
+ })().catch(logger$4.error);
28764
+ }, [transferInstrumentId, fetchLegalEntity]);
28410
28765
  return legalEntity ? jsx(PayoutDetailsDropinComponent, {
28411
28766
  eventEmitter: eventEmitter ?? new EventEmitter(),
28412
28767
  transferInstrument,
@@ -28440,85 +28795,17 @@ const componentsMap = {
28440
28795
  transferInstrumentComponent: TransferInstrumentComponent,
28441
28796
  manageTransferInstrumentComponent: ManageTransferInstrumentComponent
28442
28797
  };
28443
- const refreshSdkToken = async (context, refreshToken) => {
28444
- const {
28445
- loadingContext,
28446
- sdkToken
28447
- } = context;
28448
- return httpPost({
28449
- loadingContext,
28450
- errorLevel: "warn",
28451
- errorMessage: `Failed to refresh token`,
28452
- path: `sessions/refresh`,
28453
- sdkToken,
28454
- headers: {
28455
- "Content-Type": "application/json"
28456
- }
28457
- }, {
28458
- refreshToken
28459
- });
28460
- };
28461
- const SDK_TOKEN_TTL = 6e4;
28462
- const REFRESH_INTERVAL = SDK_TOKEN_TTL - 5e3;
28463
- const RETRY_LIMIT = 2;
28464
- const logger$4 = createLogger("useSdkToken");
28465
- const useSdkToken = ({
28466
- initialSdkToken,
28467
- refreshToken,
28468
- autheBase
28469
- }) => {
28470
- const [sdkToken, setSdkToken] = useState(initialSdkToken);
28471
- const doRefresh = async (sdkToken2, refreshToken2, retries) => {
28472
- try {
28473
- const {
28474
- token: newSdkToken
28475
- } = await refreshSdkToken({
28476
- loadingContext: autheBase,
28477
- sdkToken: sdkToken2
28478
- }, refreshToken2);
28479
- setSdkToken(newSdkToken);
28480
- } catch (e) {
28481
- if (!retries) {
28482
- throw new Error("Unable to refresh token after retries", e);
28483
- }
28484
- logger$4.warn("Failed to refresh token. Retrying..", e);
28485
- await doRefresh(sdkToken2, refreshToken2, retries - 1);
28486
- }
28487
- };
28488
- useEffect(() => {
28489
- if (!sdkToken || !refreshToken) {
28490
- return;
28491
- }
28492
- const refreshHandler = setInterval(() => {
28493
- doRefresh(sdkToken, refreshToken, RETRY_LIMIT).catch(() => {
28494
- clearInterval(refreshHandler);
28495
- });
28496
- }, REFRESH_INTERVAL);
28497
- return () => {
28498
- clearInterval(refreshHandler);
28499
- };
28500
- }, [sdkToken]);
28501
- return sdkToken;
28502
- };
28503
- const AUTHE_API_VERSION = "v1";
28504
28798
  const AuthProvider = ({
28505
28799
  children,
28506
- sdkToken: initialSdkToken,
28507
- refreshToken,
28800
+ sdkToken: sdkToken2,
28801
+ getSdkToken: getSdkToken2,
28508
28802
  clientKey,
28509
28803
  loadingContext
28510
28804
  }) => {
28511
- const autheBase = `${loadingContext}authe/api/${AUTHE_API_VERSION}/`;
28512
- const sdkToken = useSdkToken({
28513
- initialSdkToken,
28514
- refreshToken,
28515
- autheBase
28516
- });
28517
28805
  const contextValue = useMemo(() => {
28518
- if (sdkToken && refreshToken) {
28806
+ if (sdkToken2 && getSdkToken2) {
28519
28807
  return {
28520
28808
  isEmbeddedDropin: true,
28521
- sdkToken,
28522
28809
  loadingContext: `${loadingContext}onboardingcomponents/`
28523
28810
  };
28524
28811
  }
@@ -28529,8 +28816,8 @@ const AuthProvider = ({
28529
28816
  loadingContext
28530
28817
  };
28531
28818
  }
28532
- throw new Error("Must provide either `sdkToken` and `refreshToken` or `clientKey`");
28533
- }, [sdkToken, clientKey]);
28819
+ throw new Error("Must provide either `sdkToken` and `getSdkToken` or `clientKey`");
28820
+ }, [sdkToken2, clientKey]);
28534
28821
  return jsx(AuthContext.Provider, {
28535
28822
  value: contextValue,
28536
28823
  children
@@ -28548,7 +28835,6 @@ const getPayoutAccountFormat = async (country2) => getAccountFormatsForCountry(c
28548
28835
  const getAllowedLocales$1 = async (context) => {
28549
28836
  const {
28550
28837
  loadingContext,
28551
- sdkToken,
28552
28838
  legalEntityId
28553
28839
  } = context;
28554
28840
  return httpGet({
@@ -28556,7 +28842,7 @@ const getAllowedLocales$1 = async (context) => {
28556
28842
  errorLevel: "warn",
28557
28843
  errorMessage: `Supported locales not available`,
28558
28844
  path: `${legalEntityId}/configurations/supportedLocales`,
28559
- sdkToken,
28845
+ authentication: "jwt",
28560
28846
  headers: {
28561
28847
  "Content-Type": "application/json"
28562
28848
  }
@@ -28564,17 +28850,18 @@ const getAllowedLocales$1 = async (context) => {
28564
28850
  };
28565
28851
  const getEmbeddedApi = ({
28566
28852
  base,
28567
- sdkToken,
28568
28853
  rootLegalEntityId
28569
28854
  }) => {
28570
28855
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
28571
28856
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
28572
28857
  const baseRequestContext = {
28573
28858
  loadingContext: loadingContextWithRootLEAuth,
28574
- legalEntityId: rootLegalEntityId,
28575
- sdkToken
28859
+ legalEntityId: rootLegalEntityId
28576
28860
  };
28577
28861
  return {
28862
+ accountIdentification: () => {
28863
+ throw new Error("accountIdentification: Not implemented in onboarding component api");
28864
+ },
28578
28865
  getConfiguration: async ({
28579
28866
  legalEntityType
28580
28867
  }) => {
@@ -28621,6 +28908,23 @@ const getEmbeddedApi = ({
28621
28908
  }
28622
28909
  };
28623
28910
  };
28911
+ const accountIdentification = async (context, payoutAccountDetails) => {
28912
+ const {
28913
+ loadingContext,
28914
+ clientKey
28915
+ } = context;
28916
+ return httpPost({
28917
+ loadingContext,
28918
+ clientKey,
28919
+ errorLevel: "warn",
28920
+ errorMessage: "Account Identification is not available",
28921
+ path: "v1/validations/accountidentification"
28922
+ }, {
28923
+ accountIdentification: {
28924
+ ...payoutAccountDetails
28925
+ }
28926
+ });
28927
+ };
28624
28928
  const companyDeepSearch = async (context, data) => {
28625
28929
  const {
28626
28930
  loadingContext,
@@ -28631,6 +28935,10 @@ const companyDeepSearch = async (context, data) => {
28631
28935
  clientKey,
28632
28936
  errorLevel: "warn",
28633
28937
  errorMessage: "Failed to use companyDeepSearch",
28938
+ errorHandler: async (response) => {
28939
+ const error = await response;
28940
+ throw new AdyenKycSdkError(error.message, error);
28941
+ },
28634
28942
  path: "v1/companyIndex/deepSearch",
28635
28943
  headers: {
28636
28944
  "Content-Type": "application/json"
@@ -28647,6 +28955,10 @@ const companyIndexSearch = async (context, data) => {
28647
28955
  clientKey,
28648
28956
  errorLevel: "warn",
28649
28957
  errorMessage: "Failed to use companyIndexSearch",
28958
+ errorHandler: async (response) => {
28959
+ const error = await response;
28960
+ throw new AdyenKycSdkError(error.message, error);
28961
+ },
28650
28962
  path: "v1/companyIndex/indexSearch",
28651
28963
  headers: {
28652
28964
  "Content-Type": "application/json"
@@ -28689,6 +29001,10 @@ const getCompanyData = async (context, data) => {
28689
29001
  clientKey,
28690
29002
  errorLevel: "warn",
28691
29003
  errorMessage: "Failed to use getCompanyData",
29004
+ errorHandler: async (response) => {
29005
+ const error = await response;
29006
+ throw new AdyenKycSdkError(error.message, error);
29007
+ },
28692
29008
  path: "v1/companyData/fullDataset",
28693
29009
  headers: {
28694
29010
  "Content-Type": "application/json"
@@ -28742,6 +29058,10 @@ const refreshCompanyData = async (context, data) => {
28742
29058
  clientKey,
28743
29059
  errorLevel: "warn",
28744
29060
  errorMessage: "Failed to use refreshCompanyData",
29061
+ errorHandler: async (response) => {
29062
+ const error = await response;
29063
+ throw new AdyenKycSdkError(error.message, error);
29064
+ },
28745
29065
  path: "v1/companyData/refreshDataset",
28746
29066
  headers: {
28747
29067
  "Content-Type": "application/json"
@@ -28809,6 +29129,10 @@ const verifyTin = async (context, data) => {
28809
29129
  clientKey,
28810
29130
  errorLevel: "warn",
28811
29131
  errorMessage: "Failed to use verifyTin",
29132
+ errorHandler: async (response) => {
29133
+ const error = await response;
29134
+ throw new AdyenKycSdkError(error.message, error);
29135
+ },
28812
29136
  path: "v1/tinVerification/verifyTin",
28813
29137
  headers: {
28814
29138
  "Content-Type": "application/json"
@@ -28819,6 +29143,10 @@ const getKycExternalApi = ({
28819
29143
  loadingContext,
28820
29144
  clientKey
28821
29145
  }) => ({
29146
+ accountIdentification: async (accountIdentificationDetails) => accountIdentification({
29147
+ loadingContext,
29148
+ clientKey
29149
+ }, accountIdentificationDetails),
28822
29150
  getConfiguration: async (request) => getConfiguration({
28823
29151
  loadingContext,
28824
29152
  clientKey
@@ -28875,7 +29203,6 @@ const ConfigurationApiProvider = ({
28875
29203
  const authContext = useAuthContext();
28876
29204
  const contextValue = useMemo(() => authContext.isEmbeddedDropin ? getEmbeddedApi({
28877
29205
  base: authContext.loadingContext,
28878
- sdkToken: authContext.sdkToken,
28879
29206
  rootLegalEntityId
28880
29207
  }) : getKycExternalApi({
28881
29208
  loadingContext: authContext.loadingContext,
@@ -29159,7 +29486,7 @@ class UIElement extends BaseElement {
29159
29486
  const Component = this.props.component;
29160
29487
  return jsx(AuthProvider, {
29161
29488
  sdkToken: this.props.sdkToken,
29162
- refreshToken: this.props.refreshToken,
29489
+ getSdkToken: this.props.getSdkToken,
29163
29490
  clientKey: this.props.clientKey,
29164
29491
  loadingContext: this.props.loadingContext,
29165
29492
  children: jsx(ConfigurationApiProvider, {
@@ -29733,10 +30060,10 @@ const validateComponentName = (componentName) => {
29733
30060
  const validateCoreOptions = (coreOptions) => {
29734
30061
  const requiredOptions = ["locale", "environment", "country"];
29735
30062
  const missing = requiredOptions.filter((option) => !coreOptions[option]);
29736
- if (!(coreOptions.sdkToken && coreOptions.refreshToken) && !coreOptions.clientKey) {
30063
+ if (!(coreOptions.sdkToken && coreOptions.getSdkToken) && !coreOptions.clientKey) {
29737
30064
  throw new Error(`
29738
30065
 
29739
- Please specify either sdkToken and a refreshToken or a clientKey for the SDK to initialize!
30066
+ Please specify either sdkToken and getSdkToken handler or a clientKey for the SDK to initialize!
29740
30067
 
29741
30068
 
29742
30069
  - For more information please check: https://github.com/Adyen/adyen-kyc-components#configuration.`);
@@ -29873,7 +30200,14 @@ class Core {
29873
30200
  newOptions.locale = FALLBACK_LOCALE;
29874
30201
  return newOptions;
29875
30202
  };
30203
+ this.initializeSession = () => {
30204
+ if (this.options.sdkToken && this.options.getSdkToken) {
30205
+ setSdkToken(this.options.sdkToken);
30206
+ setSdkTokenHandler(this.options.getSdkToken);
30207
+ }
30208
+ };
29876
30209
  this.options = this.getUpdatedOptions(coreOptions);
30210
+ this.initializeSession();
29877
30211
  }
29878
30212
  }
29879
30213
  export {