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

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 (56) hide show
  1. package/dist/es/adyen-kyc-components.es.js +646 -451
  2. package/dist/types/components/DocumentUpload/types.d.ts +2 -1
  3. package/dist/types/components/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverviewItem/ManageTransferInstrumentOverviewItem.d.ts +1 -1
  4. package/dist/types/components/IdDocumentUpload/types.d.ts +4 -3
  5. package/dist/types/components/PayoutAccount/helpers/mapPayoutAccountSchemaToApiBankAccount.d.ts +2 -0
  6. package/dist/types/components/PayoutAccount/types.d.ts +2 -0
  7. package/dist/types/components/PayoutBankStatement/types.d.ts +2 -1
  8. package/dist/types/components/PayoutDetails/types.d.ts +1 -0
  9. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/ProofOfIdentityCard.d.ts +1 -1
  10. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  11. package/dist/types/components/internal/CountryField/CountryField.d.ts +2 -2
  12. package/dist/types/components/internal/FormFields/Dropzone/FilePicker.d.ts +3 -2
  13. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +2 -6
  14. package/dist/types/components/internal/FormFields/Dropzone/validate.d.ts +2 -1
  15. package/dist/types/components/internal/LegalCompanyNameField/LegalCompanyNameField.d.ts +2 -3
  16. package/dist/types/components/internal/Remove/types.d.ts +1 -1
  17. package/dist/types/components/internal/StateField/StateField.d.ts +2 -2
  18. package/dist/types/core/Context/AuthContext/AuthContext.d.ts +0 -1
  19. package/dist/types/core/Context/AuthContext/AuthProvider.d.ts +5 -2
  20. package/dist/types/core/Context/ConfigurationApiContext/ConfigurationApiContext.d.ts +3 -1
  21. package/dist/types/core/Context/ConfigurationApiContext/getEmbeddedApi.d.ts +1 -2
  22. package/dist/types/core/Context/StateContext/types.d.ts +1 -0
  23. package/dist/types/core/Services/kycExternalApi/account-identification.d.ts +4 -0
  24. package/dist/types/core/Services/kycExternalApi/company-deep-search.d.ts +2 -4
  25. package/dist/types/core/Services/kycExternalApi/company-index-search.d.ts +2 -4
  26. package/dist/types/core/Services/kycExternalApi/get-company-data.d.ts +2 -4
  27. package/dist/types/core/Services/kycExternalApi/index.d.ts +1 -0
  28. package/dist/types/core/Services/kycExternalApi/refresh-company-data.d.ts +2 -4
  29. package/dist/types/core/Services/kycExternalApi/verify-tin.d.ts +2 -4
  30. package/dist/types/core/Services/session.d.ts +5 -0
  31. package/dist/types/core/Services/types.d.ts +1 -2
  32. package/dist/types/core/Services/utils.d.ts +3 -0
  33. package/dist/types/core/core.d.ts +1 -0
  34. package/dist/types/core/hooks/useAsyncAccountDetailsValidationRules.d.ts +3 -0
  35. package/dist/types/core/hooks/useForm/types.d.ts +23 -8
  36. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  37. package/dist/types/core/hooks/useForm/utils.d.ts +12 -1
  38. package/dist/types/core/models/api/company-search.d.ts +18 -22
  39. package/dist/types/core/models/api/organization.d.ts +6 -6
  40. package/dist/types/core/models/country-code.d.ts +1 -1
  41. package/dist/types/core/models/errors/validation-error.d.ts +4 -0
  42. package/dist/types/core/models/file.d.ts +8 -0
  43. package/dist/types/core/models/state-code.d.ts +32 -1
  44. package/dist/types/core/types.d.ts +2 -1
  45. package/dist/types/language/config.d.ts +22 -14
  46. package/dist/types/utils/api/documentUtils.d.ts +3 -2
  47. package/dist/types/utils/company-util.d.ts +2 -1
  48. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  49. package/dist/types/utils/entity-status-util.d.ts +2 -2
  50. package/dist/types/utils/formUtils.d.ts +11 -3
  51. package/dist/types/utils/mapping/mapping.d.ts +2 -0
  52. package/dist/types/utils/trust-util.d.ts +1 -1
  53. package/dist/types/utils/validatorUtils.d.ts +5 -0
  54. package/package.json +1 -1
  55. package/dist/types/core/Services/auth/refresh-sdkToken.d.ts +0 -6
  56. 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:";
@@ -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,
@@ -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"
@@ -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
  };
@@ -17736,7 +17899,9 @@ function PayoutAccountComponent(props) {
17736
17899
  country: country2,
17737
17900
  id: id2,
17738
17901
  legalEntityResponse,
17739
- requiredFields
17902
+ requiredFields,
17903
+ arePayoutAccountDetailsInvalid,
17904
+ invalidFieldNames
17740
17905
  } = props;
17741
17906
  const stateRef = useRef({
17742
17907
  setState: null
@@ -17850,10 +18015,19 @@ function PayoutAccountComponent(props) {
17850
18015
  hasCloseButton: false,
17851
18016
  type: AlertTypes.BASIC,
17852
18017
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
18018
+ }), arePayoutAccountDetailsInvalid && jsx(Alert, {
18019
+ hasCloseButton: false,
18020
+ className: "adl-u-margin-top-16",
18021
+ type: AlertTypes.ERROR,
18022
+ title: invalidFieldNames ? i18n.get("enterValid_", {
18023
+ values: {
18024
+ fieldNames: invalidFieldNames
18025
+ }
18026
+ }) : i18n.get("enterValidAccountDetails")
17853
18027
  })]
17854
18028
  });
17855
18029
  }
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);
18030
+ 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
18031
  const PayoutBankStatement$1 = "";
17858
18032
  function FilePicker({
17859
18033
  files,
@@ -18431,15 +18605,25 @@ function PayoutVerificationMethod(props) {
18431
18605
  }
18432
18606
  })]
18433
18607
  }), 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"),
18608
+ data: {
18609
+ country: data.bankCountry
18610
+ },
18611
+ valid: {
18612
+ country: valid == null ? void 0 : valid.bankCountry
18613
+ },
18614
+ errors: {
18615
+ country: formUtils.getErrorMessage("bankCountry", errors, fieldProblems)
18616
+ },
18617
+ labels: {
18618
+ country: formUtils.getLabel("bankCountry", "bankAccountCountry")
18619
+ },
18438
18620
  readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
18439
18621
  allowedCountries: allowedBankCountries,
18440
18622
  classNameModifiers: ["country"],
18441
18623
  handleChangeFor: () => handleChangeFor("bankCountry", "input"),
18442
- helperText: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18624
+ helperText: {
18625
+ country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
18626
+ }
18443
18627
  }), jsx(Field, {
18444
18628
  name: "verificationMethods",
18445
18629
  label: formUtils.getLabel("payoutVerificationMethod", "verificationMethod"),
@@ -18573,7 +18757,8 @@ function PayoutDetailsComponent(props) {
18573
18757
  setHideBackButton,
18574
18758
  setSubmitButtonLabel,
18575
18759
  createTrustedTransferInstrument: createTrustedTransferInstrument2,
18576
- handleBankVerificationError: handleBankVerificationError2
18760
+ handleBankVerificationError: handleBankVerificationError2,
18761
+ accountDetailsFromInput
18577
18762
  } = props;
18578
18763
  const [instantVerificationError, setInstantVerificationError] = useInstantVerificationErrorNotification(1e4);
18579
18764
  const verificationMethodFormProps = getFormProps(props, payoutSteps.payoutVerificationMethod.formId);
@@ -18597,6 +18782,26 @@ function PayoutDetailsComponent(props) {
18597
18782
  }
18598
18783
  }, [activeForm]);
18599
18784
  const [bankInfoValidated, setBankInfoValidated] = useState(false);
18785
+ const [arePayoutAccountDetailsInvalid, setArePayoutAccountDetailsInvalid] = useState(false);
18786
+ const [invalidFieldNames, setInvalidFieldNames] = useState("");
18787
+ const debouncedGetAccountIdentificationFromPayoutAccountSchema = useCallback(debounce(getAccountIdentificationFromPayoutAccountSchema, 500), [getAccountIdentificationFromPayoutAccountSchema]);
18788
+ const payload = useMemo(() => bankCountry2 ? debouncedGetAccountIdentificationFromPayoutAccountSchema(accountDetailsFromInput, bankCountry2) : {}, [accountDetailsFromInput, bankCountry2, debouncedGetAccountIdentificationFromPayoutAccountSchema]);
18789
+ const validateAccountDetails = useAsyncAccountDetailsValidationRules(payload, hasEmptyFields(payload));
18790
+ const resetInvalidFieldState = () => {
18791
+ setInvalidFieldNames("");
18792
+ setArePayoutAccountDetailsInvalid(false);
18793
+ };
18794
+ useEffect(() => {
18795
+ var _a2;
18796
+ if (validateAccountDetails && ((_a2 = validateAccountDetails.invalidFields) == null ? void 0 : _a2.length) > 0) {
18797
+ const fieldNames = validateAccountDetails.invalidFields.map((field) => extractFieldName(field == null ? void 0 : field.name)).map((key) => mapKeyToFieldName(i18n, key));
18798
+ const invalidFieldsString = concatenateFieldNames(fieldNames);
18799
+ setInvalidFieldNames(invalidFieldsString);
18800
+ setArePayoutAccountDetailsInvalid(true);
18801
+ } else {
18802
+ resetInvalidFieldState();
18803
+ }
18804
+ }, [i18n, validateAccountDetails]);
18600
18805
  return jsxs("div", {
18601
18806
  className: "adyen-kyc-payout",
18602
18807
  children: [jsx("div", {
@@ -18641,7 +18846,9 @@ function PayoutDetailsComponent(props) {
18641
18846
  heading: taskHeading,
18642
18847
  id: payoutSteps.payoutAccountDetails(taskType).formId,
18643
18848
  country: bankCountry2,
18644
- legalEntityResponse
18849
+ legalEntityResponse,
18850
+ arePayoutAccountDetailsInvalid,
18851
+ invalidFieldNames
18645
18852
  })
18646
18853
  }), !verifyInstantly && jsx("div", {
18647
18854
  className: activeForm.formId !== payoutSteps.payoutAccountDocuments.formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -18936,14 +19143,16 @@ function TrustRegistrationDetailsComponent(props) {
18936
19143
  id: "ariaErrorField"
18937
19144
  }), jsx(ContextHelper, {
18938
19145
  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),
19146
+ }), formUtils.isRequiredField("country") && jsx(CountryField, {
19147
+ data: formUtils.getFieldData(data, COUNTRY_FIELD),
19148
+ valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
19149
+ errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
19150
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
19151
+ country: "countryOfEstablishment"
19152
+ }),
19153
+ readonly: formUtils.isReadOnly("country"),
18945
19154
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
18946
- classNameModifiers: [COUNTRY_FIELD],
19155
+ classNameModifiers: ["country"],
18947
19156
  handleChangeFor: () => (e) => {
18948
19157
  handleChangeFor("country", "input")(e);
18949
19158
  if (onCountryChange)
@@ -20093,7 +20302,7 @@ const defaultPayoutAccountFormat = {
20093
20302
  [CountryCodes.Sweden]: "local",
20094
20303
  [CountryCodes.UnitedKingdom]: "local"
20095
20304
  };
20096
- const logger$d = createLogger("useScenarioConfiguration");
20305
+ const logger$c = createLogger("useScenarioConfiguration");
20097
20306
  const useScenarioConfiguration = ({
20098
20307
  getConfigurationData,
20099
20308
  getPayoutAccountFormatData,
@@ -20115,12 +20324,12 @@ const useScenarioConfiguration = ({
20115
20324
  const response = await getConfigurationData();
20116
20325
  setConfigurationResponse(response);
20117
20326
  } catch (err) {
20118
- logger$d.warn("WARNING: Configuration request failed - error:", err);
20327
+ logger$c.warn("WARNING: Configuration request failed - error:", err);
20119
20328
  } finally {
20120
20329
  setLoadingStatus("success");
20121
20330
  }
20122
20331
  };
20123
- makeConfigCallAndSave().catch(logger$d.error);
20332
+ makeConfigCallAndSave().catch(logger$c.error);
20124
20333
  }, [getConfigurationData, setLoadingStatus]);
20125
20334
  useEffect(() => {
20126
20335
  setLoadingStatus("loading");
@@ -20136,12 +20345,12 @@ const useScenarioConfiguration = ({
20136
20345
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
20137
20346
  setAccountFormat(defaultAccountFormat);
20138
20347
  } catch (err) {
20139
- logger$d.warn("WARNING: Payout format request failed - error:", err);
20348
+ logger$c.warn("WARNING: Payout format request failed - error:", err);
20140
20349
  } finally {
20141
20350
  setLoadingStatus("success");
20142
20351
  }
20143
20352
  };
20144
- makePayoutFormatCallAndSave().catch(logger$d.error);
20353
+ makePayoutFormatCallAndSave().catch(logger$c.error);
20145
20354
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus]);
20146
20355
  const {
20147
20356
  fieldConfigurations,
@@ -20308,7 +20517,7 @@ const countryConfig$1 = {
20308
20517
  placeholder: "SSNFormatUS"
20309
20518
  },
20310
20519
  idNumberExempt: {
20311
- label: "uploadDocumentForSsn"
20520
+ label: "identityNumberExempt__US"
20312
20521
  }
20313
20522
  },
20314
20523
  CA: {
@@ -20317,7 +20526,7 @@ const countryConfig$1 = {
20317
20526
  placeholder: "SINFormatCA"
20318
20527
  },
20319
20528
  idNumberExempt: {
20320
- label: "uploadDocumentForSsn"
20529
+ label: "identityNumberExempt__CA"
20321
20530
  }
20322
20531
  },
20323
20532
  IT: {
@@ -20797,7 +21006,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
20797
21006
  return ToastType2;
20798
21007
  })(ToastType || {});
20799
21008
  const FormComposer = "";
20800
- const logger$c = createLogger("FormRouterContextProvider");
21009
+ const logger$b = createLogger("FormRouterContextProvider");
20801
21010
  function FormRouterContextProvider({
20802
21011
  children,
20803
21012
  forms,
@@ -20817,7 +21026,7 @@ function FormRouterContextProvider({
20817
21026
  if (formIndex > -1) {
20818
21027
  setFormIndex(formIndex);
20819
21028
  } else {
20820
- logger$c.error("No form was found to have that field so form navigation failed.");
21029
+ logger$b.error("No form was found to have that field so form navigation failed.");
20821
21030
  }
20822
21031
  }
20823
21032
  }), [forms, handleGetIdVerificationToken, setFormIndex]);
@@ -21061,16 +21270,18 @@ const canSubmit = (data) => mandatoryApiFields.ORGANIZATION.every((detail) => {
21061
21270
  });
21062
21271
  const isDocumentsRequired = (forms) => forms.some((form) => [companyForms.companyRegistrationDocument.formId, companyForms.companyTaxDocument.formId].includes(form.formId));
21063
21272
  const formatFileSummaryData = (companyRegistrationDocument2, companyTaxDocument) => {
21064
- var _a, _b, _c, _d;
21273
+ var _a, _b;
21274
+ const registrationDocument2 = (_a = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0];
21275
+ const taxDocument2 = (_b = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _b[0];
21065
21276
  return {
21066
- ...(companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) && {
21277
+ ...registrationDocument2 && {
21067
21278
  companyRegistrationDocument: {
21068
- fileName: (_b = (_a = companyRegistrationDocument2.registrationDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
21279
+ fileName: registrationDocument2.name
21069
21280
  }
21070
21281
  },
21071
- ...(companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) && {
21282
+ ...taxDocument2 && {
21072
21283
  companyTaxDocument: {
21073
- fileName: (_d = (_c = companyTaxDocument.taxDocument) == null ? void 0 : _c[0]) == null ? void 0 : _d.name
21284
+ fileName: taxDocument2.name
21074
21285
  }
21075
21286
  }
21076
21287
  };
@@ -21414,7 +21625,7 @@ function CompanyDropinComponent({
21414
21625
  })
21415
21626
  });
21416
21627
  }
21417
- const logger$b = createLogger("useLocalStorage");
21628
+ const logger$a = createLogger("useLocalStorage");
21418
21629
  function useLocalStorage(key, defaultValue, options) {
21419
21630
  const {
21420
21631
  serializer,
@@ -21435,7 +21646,7 @@ function useLocalStorage(key, defaultValue, options) {
21435
21646
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
21436
21647
  return res;
21437
21648
  } catch (err) {
21438
- logger$b.error(err);
21649
+ logger$a.error(err);
21439
21650
  return defaultValue;
21440
21651
  }
21441
21652
  });
@@ -21467,7 +21678,7 @@ function useLocalStorage(key, defaultValue, options) {
21467
21678
  try {
21468
21679
  updateLocalStorage();
21469
21680
  } catch (err) {
21470
- logger$b.error(err);
21681
+ logger$a.error(err);
21471
21682
  }
21472
21683
  }, [value]);
21473
21684
  useEffect(() => {
@@ -21482,7 +21693,7 @@ function useLocalStorage(key, defaultValue, options) {
21482
21693
  setValue(event.newValue ? parser(event.newValue) : void 0);
21483
21694
  }
21484
21695
  } catch (err) {
21485
- logger$b.error(err);
21696
+ logger$a.error(err);
21486
21697
  }
21487
21698
  };
21488
21699
  if (typeof window === "undefined")
@@ -21518,7 +21729,7 @@ const useShouldShowIntro = (legalEntity) => {
21518
21729
  } = useHasSeenIntro(legalEntity.id);
21519
21730
  return canSeeIntro && !hasSeenIntro;
21520
21731
  };
21521
- const logger$a = createLogger("useExemptSettlor");
21732
+ const logger$9 = createLogger("useExemptSettlor");
21522
21733
  const useExemptSettlor = ({
21523
21734
  trust,
21524
21735
  handleGetLegalEntity
@@ -21530,7 +21741,7 @@ const useExemptSettlor = ({
21530
21741
  setExemptSettlor(exemptSettlorLE);
21531
21742
  }, [handleGetLegalEntity]);
21532
21743
  useEffect(() => {
21533
- updateExemptSettlor(trust).catch(logger$a.error);
21744
+ updateExemptSettlor(trust).catch(logger$9.error);
21534
21745
  }, [trust, updateExemptSettlor]);
21535
21746
  return exemptSettlor;
21536
21747
  };
@@ -22221,10 +22432,12 @@ const Remove = ({
22221
22432
  };
22222
22433
  useEffect(() => {
22223
22434
  if (undoTimer === 0 && isRemoving) {
22224
- onRemove();
22225
- setIsRemoving(false);
22226
- onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22227
- handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
22435
+ (async () => {
22436
+ setIsRemoving(false);
22437
+ await onRemove();
22438
+ onRemoveStatusChange == null ? void 0 : onRemoveStatusChange(false);
22439
+ handleIsRemoveDisabled == null ? void 0 : handleIsRemoveDisabled(false);
22440
+ })();
22228
22441
  }
22229
22442
  }, [undoTimer, isRemoving, onRemoveStatusChange, handleIsRemoveDisabled, onRemove]);
22230
22443
  return isRemoving ? jsx(Button, {
@@ -22638,11 +22851,11 @@ function LegalEntityTypeSwitcher({
22638
22851
  children: [jsx("h2", {
22639
22852
  className: "adyen-kyc-form-header__heading",
22640
22853
  "data-testid": LegalEntityType.ORGANIZATION,
22641
- children: i18n.get("continueAsCompany")
22854
+ children: i18n.get("areYouACompany")
22642
22855
  }), jsx("span", {
22643
- children: i18n.get("indicatedPayoutToCompany")
22856
+ children: i18n.get("singingUpAsIndividualButLooksLikeYouAreACompany")
22644
22857
  }), jsx("p", {
22645
- children: i18n.get("continueSigningUpAsCompany")
22858
+ children: i18n.get("wouldYouLikeToSignUpAsCompanyInstead")
22646
22859
  })]
22647
22860
  });
22648
22861
  case LegalEntityType.INDIVIDUAL:
@@ -22650,11 +22863,11 @@ function LegalEntityTypeSwitcher({
22650
22863
  children: [jsx("h2", {
22651
22864
  className: "adyen-kyc-form-header__heading",
22652
22865
  "data-testid": LegalEntityType.INDIVIDUAL,
22653
- children: i18n.get("continueAsIndividual")
22866
+ children: i18n.get("areYouAnIndividual")
22654
22867
  }), jsx("span", {
22655
- children: i18n.get("indicatedPayoutToPersonalAccount")
22868
+ children: i18n.get("singingUpAsCompanyButLooksLikeYouAreAnIndividual")
22656
22869
  }), jsx("p", {
22657
- children: i18n.get("continueSigningUpAsIndividual")
22870
+ children: i18n.get("wouldYouLikeToSignUpAsIndividualInstead")
22658
22871
  })]
22659
22872
  });
22660
22873
  default:
@@ -23899,42 +24112,50 @@ function IndividualDropinComponent({
23899
24112
  };
23900
24113
  const datasetUtils = datasetUtilities(i18n.locale);
23901
24114
  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
- }
24115
+ var _a2, _b2;
24116
+ if (!idDocument2)
24117
+ return void 0;
24118
+ const documentType2 = hasInstantIdVerification({
24119
+ idDocument: idDocument2
24120
+ }) ? onfidoDocumentTypeMapping.find((document2) => idDocument2.instantIdVerificationData.document_front.type === document2.id) : idDocumentTypeOptions.find(({
24121
+ id: id2
24122
+ }) => idDocument2.idDocumentType === id2);
24123
+ if (!documentType2)
24124
+ return void 0;
24125
+ const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
24126
+ const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
24127
+ if (!frontPage2)
24128
+ return void 0;
24129
+ return {
24130
+ documentType: i18n.get(documentType2.name),
24131
+ ...backPage2 && documentType2.hasBackPage ? {
24132
+ frontPage: frontPage2.name,
24133
+ backPage: backPage2.name
24134
+ } : {
24135
+ fileName: frontPage2.name
24136
+ }
24137
+ };
23919
24138
  };
23920
24139
  const formatFileSummaryData2 = ({
23921
24140
  idDocument: idDocument2,
23922
24141
  proofOfNationalId: proofOfNationalId2,
23923
24142
  proofOfResidence: proofOfResidence2
23924
24143
  }) => {
23925
- var _a2, _b2, _c2, _d2;
24144
+ var _a2, _b2;
24145
+ const proofOfNationalIdFile = (_a2 = proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0];
24146
+ const proofOfResidenceFile = (_b2 = proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) == null ? void 0 : _b2[0];
23926
24147
  return {
23927
24148
  ...((idDocument2 == null ? void 0 : idDocument2.idDocumentType) || (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData)) && {
23928
24149
  idDocument: formatIdDocument(idDocument2)
23929
24150
  },
23930
- ...(proofOfNationalId2 == null ? void 0 : proofOfNationalId2.proofOfNationalId) && {
24151
+ ...proofOfNationalIdFile && {
23931
24152
  proofOfNationalId: {
23932
- fileName: (_b2 = (_a2 = proofOfNationalId2.proofOfNationalId) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
24153
+ fileName: proofOfNationalIdFile.name
23933
24154
  }
23934
24155
  },
23935
- ...(proofOfResidence2 == null ? void 0 : proofOfResidence2.proofOfResidence) && {
24156
+ ...proofOfResidenceFile && {
23936
24157
  proofOfResidence: {
23937
- fileName: (_d2 = (_c2 = proofOfResidence2.proofOfResidence) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.name
24158
+ fileName: proofOfResidenceFile.name
23938
24159
  }
23939
24160
  }
23940
24161
  };
@@ -24218,6 +24439,7 @@ function PayoutDetailsDropinComponent({
24218
24439
  const [loadingStatus, setLoadingStatus] = useState("success");
24219
24440
  const [data, setData] = useState(prefilledData);
24220
24441
  const [problems, setProblems] = useState(propProblems || ((_c = (_b = getCapabilityProblems(legalEntityResponse)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument == null ? void 0 : transferInstrument.id]));
24442
+ const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(prefilledData.payoutAccountDetails);
24221
24443
  const baseTrackingPayload = getBaseTrackingPayload({
24222
24444
  trackingConfig,
24223
24445
  task: taskType
@@ -24342,6 +24564,11 @@ function PayoutDetailsDropinComponent({
24342
24564
  }
24343
24565
  }
24344
24566
  };
24567
+ useEffect(() => {
24568
+ var _a2;
24569
+ const payoutAccountData = (_a2 = cloneObject(data)) == null ? void 0 : _a2.payoutAccountDetails;
24570
+ setAccountDetailsFromInput(payoutAccountData);
24571
+ }, [data]);
24345
24572
  const onSubmit = async () => {
24346
24573
  setLoadingStatus("loading");
24347
24574
  const dataSubmitted = cloneObject(data);
@@ -24417,11 +24644,12 @@ function PayoutDetailsDropinComponent({
24417
24644
  };
24418
24645
  const isDocumentsRequired2 = (forms2) => forms2.some((form) => form.formId === payoutDetailsSteps.payoutAccountDocuments.formId);
24419
24646
  const formatFileSummaryData2 = (documents22) => {
24420
- var _a2, _b2;
24647
+ var _a2;
24648
+ const bankStatementDocument2 = (_a2 = documents22 == null ? void 0 : documents22.bankStatementDocument) == null ? void 0 : _a2[0];
24421
24649
  return {
24422
- ...(documents22 == null ? void 0 : documents22.bankStatementDocument) && {
24650
+ ...bankStatementDocument2 && {
24423
24651
  bankStatementDocument: {
24424
- fileName: (_b2 = (_a2 = documents22.bankStatementDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name
24652
+ fileName: bankStatementDocument2.name
24425
24653
  }
24426
24654
  }
24427
24655
  };
@@ -24518,7 +24746,8 @@ function PayoutDetailsDropinComponent({
24518
24746
  shouldValidate,
24519
24747
  bankVerificationVendors,
24520
24748
  createTrustedTransferInstrument: createTrustedTransferInstrument2,
24521
- handleBankVerificationError: handleBankVerificationError2
24749
+ handleBankVerificationError: handleBankVerificationError2,
24750
+ accountDetailsFromInput
24522
24751
  })
24523
24752
  });
24524
24753
  }
@@ -25495,7 +25724,7 @@ const serviceAgreementValidationRules = {
25495
25724
  errorMessage: "fieldIsRequired"
25496
25725
  }
25497
25726
  };
25498
- const logger$9 = createLogger("useServiceAgreement");
25727
+ const logger$8 = createLogger("useServiceAgreement");
25499
25728
  const FALLBACK_LANGUAGE_CODE = "en";
25500
25729
  const useServiceAgreement = ({
25501
25730
  handleGetServiceAgreement,
@@ -25524,7 +25753,7 @@ const useServiceAgreement = ({
25524
25753
  language: agreementLanguage
25525
25754
  });
25526
25755
  if (!document2) {
25527
- logger$9.log('"document" field was missing in response');
25756
+ logger$8.log('"document" field was missing in response');
25528
25757
  return;
25529
25758
  }
25530
25759
  const contract = JSON.parse(decodeURIComponent(escape(window.atob(document2))));
@@ -25542,7 +25771,7 @@ const useServiceAgreement = ({
25542
25771
  throw err;
25543
25772
  }
25544
25773
  };
25545
- requestServiceAgreement().catch(logger$9.error);
25774
+ requestServiceAgreement().catch(logger$8.error);
25546
25775
  }, [handleGetServiceAgreement, handleServiceAgreementIsNotAvailableInThatLanguage, agreementLanguage, legalEntityId, serviceAgreementType]);
25547
25776
  return {
25548
25777
  loading: loading2,
@@ -26624,11 +26853,12 @@ function SolePropDropinComponent({
26624
26853
  return summaryData;
26625
26854
  };
26626
26855
  const formatFileSummaryData2 = (solePropConstitutionalDocument) => {
26627
- var _a2, _b;
26856
+ var _a2;
26857
+ const constitutionalDocument2 = (_a2 = solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0];
26628
26858
  return {
26629
- ...(solePropConstitutionalDocument == null ? void 0 : solePropConstitutionalDocument.constitutionalDocument) && {
26859
+ ...constitutionalDocument2 && {
26630
26860
  solePropConstitutionalDocument: {
26631
- fileName: (_b = (_a2 = solePropConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a2[0]) == null ? void 0 : _b.name
26861
+ fileName: constitutionalDocument2.name
26632
26862
  }
26633
26863
  }
26634
26864
  };
@@ -26838,11 +27068,12 @@ function TrustDropinComponent(props) {
26838
27068
  return summaryData;
26839
27069
  };
26840
27070
  const formatFileSummaryData2 = (trustConstitutionalDocument) => {
26841
- var _a, _b;
27071
+ var _a;
27072
+ const constitutionalDocument2 = (_a = trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0];
26842
27073
  return {
26843
- ...(trustConstitutionalDocument == null ? void 0 : trustConstitutionalDocument.constitutionalDocument) && {
27074
+ ...constitutionalDocument2 && {
26844
27075
  trustConstitutionalDocument: {
26845
- fileName: (_b = (_a = trustConstitutionalDocument.constitutionalDocument) == null ? void 0 : _a[0]) == null ? void 0 : _b.name
27076
+ fileName: constitutionalDocument2.name
26846
27077
  }
26847
27078
  }
26848
27079
  };
@@ -26878,7 +27109,7 @@ function TrustDropinComponent(props) {
26878
27109
  }
26879
27110
  const PAGES_WITH_STATUS = [TaskTypes.DECISION_MAKER_OVERVIEW, TaskTypes.TASKS_OVERVIEW];
26880
27111
  const POLLING_INTERVAL = 3e3;
26881
- const logger$8 = createLogger("DropinComposerComponent");
27112
+ const logger$7 = createLogger("DropinComposerComponent");
26882
27113
  function DropinComposerComponent({
26883
27114
  capabilities,
26884
27115
  legalEntityResponse,
@@ -26955,7 +27186,7 @@ function DropinComposerComponent({
26955
27186
  setPciStatus(response);
26956
27187
  return response;
26957
27188
  } catch (e) {
26958
- logger$8.warn(i18n.get("failedToGetPciStatus"));
27189
+ logger$7.warn(i18n.get("failedToGetPciStatus"));
26959
27190
  }
26960
27191
  }
26961
27192
  return void 0;
@@ -26984,7 +27215,7 @@ function DropinComposerComponent({
26984
27215
  useEffect(() => {
26985
27216
  if (!tasks.includes(TaskTypes.PCI_DSS))
26986
27217
  return;
26987
- getPciTemplate().catch(logger$8.error);
27218
+ getPciTemplate().catch(logger$7.error);
26988
27219
  }, [getPciTemplate, tasks]);
26989
27220
  const getServiceAgreementAcceptanceInfos = async () => {
26990
27221
  if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
@@ -26992,7 +27223,7 @@ function DropinComposerComponent({
26992
27223
  const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
26993
27224
  setServiceAgreementAcceptanceInfos(response.data);
26994
27225
  } catch (e) {
26995
- logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
27226
+ logger$7.warn(i18n.get("failedToGetServiceAgreementStatus"));
26996
27227
  }
26997
27228
  }
26998
27229
  };
@@ -27002,7 +27233,7 @@ function DropinComposerComponent({
27002
27233
  const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
27003
27234
  setServiceAgreementTypes(response.termsOfServiceTypes);
27004
27235
  } catch (e) {
27005
- logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
27236
+ logger$7.warn(i18n.get("failedToGetServiceAgreementStatus"));
27006
27237
  }
27007
27238
  }
27008
27239
  };
@@ -27041,7 +27272,7 @@ function DropinComposerComponent({
27041
27272
  setCapabilityProblems(getCapabilityProblems(response));
27042
27273
  return response;
27043
27274
  } catch (e) {
27044
- logger$8.warn(i18n.get("failedToFetchLegalEntityDetails"));
27275
+ logger$7.warn(i18n.get("failedToFetchLegalEntityDetails"));
27045
27276
  }
27046
27277
  }
27047
27278
  return void 0;
@@ -27053,7 +27284,7 @@ function DropinComposerComponent({
27053
27284
  setTrust(response);
27054
27285
  return response;
27055
27286
  } catch (e) {
27056
- logger$8.warn(i18n.get("failedToFetchTrustDetails"));
27287
+ logger$7.warn(i18n.get("failedToFetchTrustDetails"));
27057
27288
  }
27058
27289
  }
27059
27290
  return void 0;
@@ -27103,7 +27334,7 @@ function DropinComposerComponent({
27103
27334
  label: i18n.get("successFullyRemovedTrustMember")
27104
27335
  });
27105
27336
  } catch (err) {
27106
- logger$8.error(`Failed to delete trust member`, err);
27337
+ logger$7.error(`Failed to delete trust member`, err);
27107
27338
  showToast({
27108
27339
  type: ToastType.ERROR,
27109
27340
  label: i18n.get("failedToRemoveTrustMember")
@@ -27155,7 +27386,7 @@ function DropinComposerComponent({
27155
27386
  break;
27156
27387
  case "rootTrustee":
27157
27388
  default:
27158
- logger$8.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27389
+ logger$7.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27159
27390
  }
27160
27391
  showToast({
27161
27392
  label: i18n.get("successfullyUpdatedDetails"),
@@ -27163,7 +27394,7 @@ function DropinComposerComponent({
27163
27394
  });
27164
27395
  await refreshTrustAndRunOnSubmit(trust, 1);
27165
27396
  } catch (err) {
27166
- logger$8.error(err);
27397
+ logger$7.error(err);
27167
27398
  showToast({
27168
27399
  label: i18n.get("failedToUpdateDetails"),
27169
27400
  type: ToastType.ERROR
@@ -27386,7 +27617,7 @@ function DropinComposerComponent({
27386
27617
  }
27387
27618
  };
27388
27619
  setIsLoadingConfiguration(true);
27389
- fetchConfiguration().catch(logger$8.error).finally(() => {
27620
+ fetchConfiguration().catch(logger$7.error).finally(() => {
27390
27621
  setIsLoadingConfiguration(false);
27391
27622
  onLoad();
27392
27623
  });
@@ -27743,7 +27974,6 @@ const ManageTransferInstrumentComponent$1 = "";
27743
27974
  const createDocument = async (context, document2, ownerId) => {
27744
27975
  const {
27745
27976
  loadingContext,
27746
- sdkToken,
27747
27977
  legalEntityId
27748
27978
  } = context;
27749
27979
  return httpPost({
@@ -27751,7 +27981,7 @@ const createDocument = async (context, document2, ownerId) => {
27751
27981
  errorLevel: "warn",
27752
27982
  errorMessage: `Failed to create document`,
27753
27983
  path: `${legalEntityId}/documents/${ownerId}`,
27754
- sdkToken,
27984
+ authentication: "jwt",
27755
27985
  headers: {
27756
27986
  "Content-Type": "application/json"
27757
27987
  }
@@ -27760,7 +27990,6 @@ const createDocument = async (context, document2, ownerId) => {
27760
27990
  const createTransferInstrument = async (context, transferInstrument) => {
27761
27991
  const {
27762
27992
  loadingContext,
27763
- sdkToken,
27764
27993
  legalEntityId
27765
27994
  } = context;
27766
27995
  return httpPost({
@@ -27768,7 +27997,7 @@ const createTransferInstrument = async (context, transferInstrument) => {
27768
27997
  errorLevel: "warn",
27769
27998
  errorMessage: `Failed to create transferInstrument`,
27770
27999
  path: `${legalEntityId}/transferInstruments`,
27771
- sdkToken,
28000
+ authentication: "jwt",
27772
28001
  headers: {
27773
28002
  "Content-Type": "application/json"
27774
28003
  }
@@ -27777,7 +28006,6 @@ const createTransferInstrument = async (context, transferInstrument) => {
27777
28006
  const getBankVerificationVendor = async (context, country2) => {
27778
28007
  const {
27779
28008
  loadingContext,
27780
- sdkToken,
27781
28009
  legalEntityId
27782
28010
  } = context;
27783
28011
  return httpGet({
@@ -27785,7 +28013,7 @@ const getBankVerificationVendor = async (context, country2) => {
27785
28013
  errorLevel: "warn",
27786
28014
  errorMessage: `Bank verification vendor not available`,
27787
28015
  path: `${legalEntityId}/transferInstruments/trusted/providers?country=${country2}`,
27788
- sdkToken,
28016
+ authentication: "jwt",
27789
28017
  headers: {
27790
28018
  "Content-Type": "application/json"
27791
28019
  }
@@ -27793,8 +28021,7 @@ const getBankVerificationVendor = async (context, country2) => {
27793
28021
  };
27794
28022
  const getDataset$1 = async (context, name, locale) => {
27795
28023
  const {
27796
- loadingContext,
27797
- sdkToken
28024
+ loadingContext
27798
28025
  } = context;
27799
28026
  const datasetUtils = datasetUtilities(locale);
27800
28027
  const dataset = datasetUtils.getDataset(name);
@@ -27809,7 +28036,7 @@ const getDataset$1 = async (context, name, locale) => {
27809
28036
  errorLevel: "warn",
27810
28037
  errorMessage: `Dataset ${name} is not available`,
27811
28038
  path,
27812
- sdkToken,
28039
+ authentication: "jwt",
27813
28040
  headers: {
27814
28041
  "Content-Type": "application/json"
27815
28042
  }
@@ -27821,7 +28048,6 @@ const getDataset$1 = async (context, name, locale) => {
27821
28048
  const getDocument = async (context, documentId) => {
27822
28049
  const {
27823
28050
  loadingContext,
27824
- sdkToken,
27825
28051
  legalEntityId
27826
28052
  } = context;
27827
28053
  return httpGet({
@@ -27829,7 +28055,7 @@ const getDocument = async (context, documentId) => {
27829
28055
  errorLevel: "warn",
27830
28056
  errorMessage: `Failed to fetch document`,
27831
28057
  path: `${legalEntityId}/documents/${documentId}`,
27832
- sdkToken,
28058
+ authentication: "jwt",
27833
28059
  headers: {
27834
28060
  "Content-Type": "application/json"
27835
28061
  }
@@ -27838,7 +28064,6 @@ const getDocument = async (context, documentId) => {
27838
28064
  const getLegalEntity = async (context) => {
27839
28065
  const {
27840
28066
  loadingContext,
27841
- sdkToken,
27842
28067
  legalEntityId
27843
28068
  } = context;
27844
28069
  return httpGet({
@@ -27846,7 +28071,7 @@ const getLegalEntity = async (context) => {
27846
28071
  errorLevel: "warn",
27847
28072
  errorMessage: `LegalEntity not available`,
27848
28073
  path: `${legalEntityId}`,
27849
- sdkToken,
28074
+ authentication: "jwt",
27850
28075
  headers: {
27851
28076
  "Content-Type": "application/json"
27852
28077
  }
@@ -27855,7 +28080,6 @@ const getLegalEntity = async (context) => {
27855
28080
  const getScenarios = async (context) => {
27856
28081
  const {
27857
28082
  loadingContext,
27858
- sdkToken,
27859
28083
  legalEntityId
27860
28084
  } = context;
27861
28085
  return httpGet({
@@ -27863,7 +28087,7 @@ const getScenarios = async (context) => {
27863
28087
  errorLevel: "warn",
27864
28088
  errorMessage: `Scenarios not available`,
27865
28089
  path: `${legalEntityId}/configurations/scenarios`,
27866
- sdkToken,
28090
+ authentication: "jwt",
27867
28091
  headers: {
27868
28092
  "Content-Type": "application/json"
27869
28093
  }
@@ -27872,7 +28096,6 @@ const getScenarios = async (context) => {
27872
28096
  const getTasks = async (context) => {
27873
28097
  const {
27874
28098
  loadingContext,
27875
- sdkToken,
27876
28099
  legalEntityId
27877
28100
  } = context;
27878
28101
  return httpGet({
@@ -27880,7 +28103,7 @@ const getTasks = async (context) => {
27880
28103
  errorLevel: "warn",
27881
28104
  errorMessage: `Tasks not available`,
27882
28105
  path: `${legalEntityId}/configurations/tasks`,
27883
- sdkToken,
28106
+ authentication: "jwt",
27884
28107
  headers: {
27885
28108
  "Content-Type": "application/json"
27886
28109
  }
@@ -27889,7 +28112,6 @@ const getTasks = async (context) => {
27889
28112
  const getTransferInstrument = async (context, transferInstrumentId) => {
27890
28113
  const {
27891
28114
  loadingContext,
27892
- sdkToken,
27893
28115
  legalEntityId
27894
28116
  } = context;
27895
28117
  return httpGet({
@@ -27897,7 +28119,7 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27897
28119
  errorLevel: "warn",
27898
28120
  errorMessage: `TransferInstrument not available`,
27899
28121
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27900
- sdkToken,
28122
+ authentication: "jwt",
27901
28123
  headers: {
27902
28124
  "Content-Type": "application/json"
27903
28125
  }
@@ -27906,7 +28128,6 @@ const getTransferInstrument = async (context, transferInstrumentId) => {
27906
28128
  const getTransferInstruments = async (context) => {
27907
28129
  const {
27908
28130
  loadingContext,
27909
- sdkToken,
27910
28131
  legalEntityId
27911
28132
  } = context;
27912
28133
  return httpGet({
@@ -27914,7 +28135,7 @@ const getTransferInstruments = async (context) => {
27914
28135
  errorLevel: "warn",
27915
28136
  errorMessage: `TransferInstrument not available`,
27916
28137
  path: `${legalEntityId}/transferInstruments`,
27917
- sdkToken,
28138
+ authentication: "jwt",
27918
28139
  headers: {
27919
28140
  "Content-Type": "application/json"
27920
28141
  }
@@ -27923,7 +28144,6 @@ const getTransferInstruments = async (context) => {
27923
28144
  const updateDocument = async (context, document2, documentId, ownerId) => {
27924
28145
  const {
27925
28146
  loadingContext,
27926
- sdkToken,
27927
28147
  legalEntityId
27928
28148
  } = context;
27929
28149
  return httpPost({
@@ -27931,7 +28151,7 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27931
28151
  errorLevel: "warn",
27932
28152
  errorMessage: `Failed to update document`,
27933
28153
  path: `${legalEntityId}/documents/${documentId}/${ownerId}`,
27934
- sdkToken,
28154
+ authentication: "jwt",
27935
28155
  headers: {
27936
28156
  "Content-Type": "application/json"
27937
28157
  }
@@ -27940,7 +28160,6 @@ const updateDocument = async (context, document2, documentId, ownerId) => {
27940
28160
  const updateTransferInstrument = async (context, transferInstrument, transferInstrumentId) => {
27941
28161
  const {
27942
28162
  loadingContext,
27943
- sdkToken,
27944
28163
  legalEntityId
27945
28164
  } = context;
27946
28165
  return httpPost({
@@ -27948,7 +28167,7 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27948
28167
  errorLevel: "warn",
27949
28168
  errorMessage: `Failed to update transferInstrument`,
27950
28169
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27951
- sdkToken,
28170
+ authentication: "jwt",
27952
28171
  headers: {
27953
28172
  "Content-Type": "application/json"
27954
28173
  }
@@ -27957,7 +28176,6 @@ const updateTransferInstrument = async (context, transferInstrument, transferIns
27957
28176
  const createTrustedTransferInstrument = async (context, code2, state2) => {
27958
28177
  const {
27959
28178
  loadingContext,
27960
- sdkToken,
27961
28179
  legalEntityId
27962
28180
  } = context;
27963
28181
  const path = `${legalEntityId}/transferInstruments/trusted`;
@@ -27966,7 +28184,7 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27966
28184
  errorLevel: "warn",
27967
28185
  errorMessage: `Failed to create trusted transferInstrument`,
27968
28186
  path,
27969
- sdkToken,
28187
+ authentication: "jwt",
27970
28188
  headers: {
27971
28189
  "Content-Type": "application/json"
27972
28190
  }
@@ -27978,7 +28196,6 @@ const createTrustedTransferInstrument = async (context, code2, state2) => {
27978
28196
  const deleteTransferInstrument = async (context, transferInstrumentId) => {
27979
28197
  const {
27980
28198
  loadingContext,
27981
- sdkToken,
27982
28199
  legalEntityId
27983
28200
  } = context;
27984
28201
  return httpDelete({
@@ -27986,7 +28203,7 @@ const deleteTransferInstrument = async (context, transferInstrumentId) => {
27986
28203
  errorLevel: "warn",
27987
28204
  errorMessage: `Failed to create transferInstrument`,
27988
28205
  path: `${legalEntityId}/transferInstruments/${transferInstrumentId}`,
27989
- sdkToken,
28206
+ authentication: "jwt",
27990
28207
  headers: {
27991
28208
  "Content-Type": "application/json"
27992
28209
  }
@@ -27995,7 +28212,6 @@ const deleteTransferInstrument = async (context, transferInstrumentId) => {
27995
28212
  const handleBankVerificationError = async (context, errorCode, errorMessage, state2, metadata) => {
27996
28213
  const {
27997
28214
  loadingContext,
27998
- sdkToken,
27999
28215
  legalEntityId
28000
28216
  } = context;
28001
28217
  const path = `${legalEntityId}/transferInstruments/trusted/error`;
@@ -28004,7 +28220,7 @@ const handleBankVerificationError = async (context, errorCode, errorMessage, sta
28004
28220
  errorLevel: "warn",
28005
28221
  errorMessage: `Failed to create trusted transferInstrument`,
28006
28222
  path,
28007
- sdkToken,
28223
+ authentication: "jwt",
28008
28224
  headers: {
28009
28225
  "Content-Type": "application/json"
28010
28226
  }
@@ -28022,7 +28238,6 @@ const useComponentApi = (rootLegalEntityId) => {
28022
28238
  throw new Error("Cannot use component API outside an embedded dropin");
28023
28239
  }
28024
28240
  const {
28025
- sdkToken,
28026
28241
  loadingContext: base
28027
28242
  } = authContext;
28028
28243
  return useMemo(() => {
@@ -28030,8 +28245,7 @@ const useComponentApi = (rootLegalEntityId) => {
28030
28245
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
28031
28246
  const baseRequestContext = {
28032
28247
  loadingContext: loadingContextWithRootLEAuth,
28033
- legalEntityId: rootLegalEntityId,
28034
- sdkToken
28248
+ legalEntityId: rootLegalEntityId
28035
28249
  };
28036
28250
  return {
28037
28251
  getLegalEntity: async (legalEntityId) => getLegalEntity({
@@ -28050,7 +28264,7 @@ const useComponentApi = (rootLegalEntityId) => {
28050
28264
  handleBankVerificationError: async (errorCode, errorMessage, state2, metadata) => handleBankVerificationError(baseRequestContext, errorCode, errorMessage, state2, metadata),
28051
28265
  getTransferInstruments: async () => getTransferInstruments(baseRequestContext)
28052
28266
  };
28053
- }, [base, rootLegalEntityId, sdkToken]);
28267
+ }, [base, rootLegalEntityId]);
28054
28268
  };
28055
28269
  const DEFAULT_POLLING_INTERVAL = 3e3;
28056
28270
  const DEFAULT_POLLING_INTERVAL_RETRY_COUNT = 3;
@@ -28177,6 +28391,7 @@ function ManageTransferInstrumentOverviewItem({
28177
28391
  } = useI18nContext();
28178
28392
  const description2 = statusDescription[transferInstrumentReference.status];
28179
28393
  const needMoreDetails = transferInstrumentReference.status === "DETAILS_REQUIRED";
28394
+ const [isRemoving, setIsRemoving] = useState(false);
28180
28395
  const status = !needMoreDetails ? jsx(TaskItemStatus, {
28181
28396
  status: TaskStatus[transferInstrumentReference.status],
28182
28397
  size: "large",
@@ -28218,12 +28433,13 @@ function ManageTransferInstrumentOverviewItem({
28218
28433
  accountHolderName,
28219
28434
  onEdit: () => onEdit(transferInstrument.id)
28220
28435
  }), jsx(Remove, {
28221
- label: "removeThisBankAccount",
28222
- onRemove: () => onRemove(transferInstrumentReference.transferInstrument.id)
28436
+ label: isRemoving ? "removing" : "removeThisBankAccount",
28437
+ onRemove: async () => onRemove(transferInstrumentReference.transferInstrument.id),
28438
+ onRemoveStatusChange: setIsRemoving
28223
28439
  })]
28224
28440
  }, transferInstrumentReference.transferInstrument.id);
28225
28441
  }
28226
- const logger$7 = createLogger("ManageTransferInstrumentOverview");
28442
+ const logger$6 = createLogger("ManageTransferInstrumentOverview");
28227
28443
  function ManageTransferInstrumentOverview({
28228
28444
  transferInstrumentReferences,
28229
28445
  onAdd,
@@ -28248,7 +28464,7 @@ function ManageTransferInstrumentOverview({
28248
28464
  ...transferInstrumentsMap
28249
28465
  });
28250
28466
  } catch (e) {
28251
- logger$7.error(e);
28467
+ logger$6.error(e);
28252
28468
  }
28253
28469
  };
28254
28470
  const onRemoveTransferinstrument = async (transferInstrumentId) => {
@@ -28256,7 +28472,7 @@ function ManageTransferInstrumentOverview({
28256
28472
  await deleteTransferInstrument2(transferInstrumentId);
28257
28473
  onRemove(transferInstrumentId);
28258
28474
  } catch (e) {
28259
- logger$7.error(e);
28475
+ logger$6.error(e);
28260
28476
  }
28261
28477
  };
28262
28478
  const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef, PAYOUT) => jsx(ManageTransferInstrumentOverviewItem, {
@@ -28282,7 +28498,7 @@ function ManageTransferInstrumentOverview({
28282
28498
  })]
28283
28499
  });
28284
28500
  }
28285
- const logger$6 = createLogger("ManageTransferInstrumentComponent");
28501
+ const logger$5 = createLogger("ManageTransferInstrumentComponent");
28286
28502
  function ManageTransferInstrumentComponent({
28287
28503
  legalEntityId,
28288
28504
  onAdd,
@@ -28310,20 +28526,20 @@ function ManageTransferInstrumentComponent({
28310
28526
  status
28311
28527
  }) => status !== "FINISHED");
28312
28528
  useInterval(refreshTransferInstruments, hasUnverifiedTransferInstruments);
28313
- const init2 = async () => {
28529
+ const init2 = useCallback(async () => {
28314
28530
  const [transferInstrumentRefs, legalEntity] = await Promise.all([getTransferInstruments2(), getLegalEntity2(legalEntityId)]);
28315
- const accountHolderName2 = getPayoutAccountHolderName(legalEntity, i18n);
28316
- setAccountHolderName(accountHolderName2);
28531
+ const accountHolder2 = getPayoutAccountHolderName(legalEntity, i18n);
28532
+ setAccountHolderName(accountHolder2);
28317
28533
  setTransferInstruments(transferInstrumentRefs);
28318
- };
28534
+ }, [getTransferInstruments2, getLegalEntity2, i18n, legalEntityId]);
28319
28535
  useEffect(() => {
28320
28536
  eventEmitter == null ? void 0 : eventEmitter.on("updateLocale", (locale) => setLocale(locale));
28321
- init2().catch(logger$6.error).finally(() => {
28537
+ init2().catch(logger$5.error).finally(() => {
28322
28538
  setLoadingStatus("success");
28323
28539
  });
28324
- }, []);
28325
- const onRemove = async (transferInsrumentId) => {
28326
- await refreshTransferInstruments();
28540
+ }, [init2, setLocale, eventEmitter]);
28541
+ const onRemove = (transferInsrumentId) => {
28542
+ refreshTransferInstruments().catch(logger$5.error);
28327
28543
  onRemoveSuccess == null ? void 0 : onRemoveSuccess(transferInsrumentId, legalEntityId);
28328
28544
  };
28329
28545
  const render2 = () => {
@@ -28370,7 +28586,7 @@ class EventEmitter {
28370
28586
  };
28371
28587
  }
28372
28588
  }
28373
- const logger$5 = createLogger("TransferInstrumentComponent");
28589
+ const logger$4 = createLogger("TransferInstrumentComponent");
28374
28590
  function TransferInstrumentComponent({
28375
28591
  legalEntityId,
28376
28592
  transferInstrumentId,
@@ -28405,8 +28621,8 @@ function TransferInstrumentComponent({
28405
28621
  const ti = await getTransferInstrument2(transferInstrumentId);
28406
28622
  setTransferInstrument(ti);
28407
28623
  }
28408
- })().catch(logger$5.error);
28409
- }, [transferInstrumentId]);
28624
+ })().catch(logger$4.error);
28625
+ }, [transferInstrumentId, fetchLegalEntity]);
28410
28626
  return legalEntity ? jsx(PayoutDetailsDropinComponent, {
28411
28627
  eventEmitter: eventEmitter ?? new EventEmitter(),
28412
28628
  transferInstrument,
@@ -28440,85 +28656,17 @@ const componentsMap = {
28440
28656
  transferInstrumentComponent: TransferInstrumentComponent,
28441
28657
  manageTransferInstrumentComponent: ManageTransferInstrumentComponent
28442
28658
  };
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
28659
  const AuthProvider = ({
28505
28660
  children,
28506
- sdkToken: initialSdkToken,
28507
- refreshToken,
28661
+ sdkToken: sdkToken2,
28662
+ getSdkToken: getSdkToken2,
28508
28663
  clientKey,
28509
28664
  loadingContext
28510
28665
  }) => {
28511
- const autheBase = `${loadingContext}authe/api/${AUTHE_API_VERSION}/`;
28512
- const sdkToken = useSdkToken({
28513
- initialSdkToken,
28514
- refreshToken,
28515
- autheBase
28516
- });
28517
28666
  const contextValue = useMemo(() => {
28518
- if (sdkToken && refreshToken) {
28667
+ if (sdkToken2 && getSdkToken2) {
28519
28668
  return {
28520
28669
  isEmbeddedDropin: true,
28521
- sdkToken,
28522
28670
  loadingContext: `${loadingContext}onboardingcomponents/`
28523
28671
  };
28524
28672
  }
@@ -28529,8 +28677,8 @@ const AuthProvider = ({
28529
28677
  loadingContext
28530
28678
  };
28531
28679
  }
28532
- throw new Error("Must provide either `sdkToken` and `refreshToken` or `clientKey`");
28533
- }, [sdkToken, clientKey]);
28680
+ throw new Error("Must provide either `sdkToken` and `getSdkToken` or `clientKey`");
28681
+ }, [sdkToken2, clientKey]);
28534
28682
  return jsx(AuthContext.Provider, {
28535
28683
  value: contextValue,
28536
28684
  children
@@ -28548,7 +28696,6 @@ const getPayoutAccountFormat = async (country2) => getAccountFormatsForCountry(c
28548
28696
  const getAllowedLocales$1 = async (context) => {
28549
28697
  const {
28550
28698
  loadingContext,
28551
- sdkToken,
28552
28699
  legalEntityId
28553
28700
  } = context;
28554
28701
  return httpGet({
@@ -28556,7 +28703,7 @@ const getAllowedLocales$1 = async (context) => {
28556
28703
  errorLevel: "warn",
28557
28704
  errorMessage: `Supported locales not available`,
28558
28705
  path: `${legalEntityId}/configurations/supportedLocales`,
28559
- sdkToken,
28706
+ authentication: "jwt",
28560
28707
  headers: {
28561
28708
  "Content-Type": "application/json"
28562
28709
  }
@@ -28564,17 +28711,18 @@ const getAllowedLocales$1 = async (context) => {
28564
28711
  };
28565
28712
  const getEmbeddedApi = ({
28566
28713
  base,
28567
- sdkToken,
28568
28714
  rootLegalEntityId
28569
28715
  }) => {
28570
28716
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
28571
28717
  const loadingContextWithRootLEAuth = `${loadingContext}legalEntities/`;
28572
28718
  const baseRequestContext = {
28573
28719
  loadingContext: loadingContextWithRootLEAuth,
28574
- legalEntityId: rootLegalEntityId,
28575
- sdkToken
28720
+ legalEntityId: rootLegalEntityId
28576
28721
  };
28577
28722
  return {
28723
+ accountIdentification: () => {
28724
+ throw new Error("accountIdentification: Not implemented in onboarding component api");
28725
+ },
28578
28726
  getConfiguration: async ({
28579
28727
  legalEntityType
28580
28728
  }) => {
@@ -28621,6 +28769,23 @@ const getEmbeddedApi = ({
28621
28769
  }
28622
28770
  };
28623
28771
  };
28772
+ const accountIdentification = async (context, payoutAccountDetails) => {
28773
+ const {
28774
+ loadingContext,
28775
+ clientKey
28776
+ } = context;
28777
+ return httpPost({
28778
+ loadingContext,
28779
+ clientKey,
28780
+ errorLevel: "warn",
28781
+ errorMessage: "Account Identification is not available",
28782
+ path: "v1/validations/accountidentification"
28783
+ }, {
28784
+ accountIdentification: {
28785
+ ...payoutAccountDetails
28786
+ }
28787
+ });
28788
+ };
28624
28789
  const companyDeepSearch = async (context, data) => {
28625
28790
  const {
28626
28791
  loadingContext,
@@ -28631,6 +28796,10 @@ const companyDeepSearch = async (context, data) => {
28631
28796
  clientKey,
28632
28797
  errorLevel: "warn",
28633
28798
  errorMessage: "Failed to use companyDeepSearch",
28799
+ errorHandler: async (response) => {
28800
+ const error = await response;
28801
+ throw new AdyenKycSdkError(error.message, error);
28802
+ },
28634
28803
  path: "v1/companyIndex/deepSearch",
28635
28804
  headers: {
28636
28805
  "Content-Type": "application/json"
@@ -28647,6 +28816,10 @@ const companyIndexSearch = async (context, data) => {
28647
28816
  clientKey,
28648
28817
  errorLevel: "warn",
28649
28818
  errorMessage: "Failed to use companyIndexSearch",
28819
+ errorHandler: async (response) => {
28820
+ const error = await response;
28821
+ throw new AdyenKycSdkError(error.message, error);
28822
+ },
28650
28823
  path: "v1/companyIndex/indexSearch",
28651
28824
  headers: {
28652
28825
  "Content-Type": "application/json"
@@ -28689,6 +28862,10 @@ const getCompanyData = async (context, data) => {
28689
28862
  clientKey,
28690
28863
  errorLevel: "warn",
28691
28864
  errorMessage: "Failed to use getCompanyData",
28865
+ errorHandler: async (response) => {
28866
+ const error = await response;
28867
+ throw new AdyenKycSdkError(error.message, error);
28868
+ },
28692
28869
  path: "v1/companyData/fullDataset",
28693
28870
  headers: {
28694
28871
  "Content-Type": "application/json"
@@ -28742,6 +28919,10 @@ const refreshCompanyData = async (context, data) => {
28742
28919
  clientKey,
28743
28920
  errorLevel: "warn",
28744
28921
  errorMessage: "Failed to use refreshCompanyData",
28922
+ errorHandler: async (response) => {
28923
+ const error = await response;
28924
+ throw new AdyenKycSdkError(error.message, error);
28925
+ },
28745
28926
  path: "v1/companyData/refreshDataset",
28746
28927
  headers: {
28747
28928
  "Content-Type": "application/json"
@@ -28809,6 +28990,10 @@ const verifyTin = async (context, data) => {
28809
28990
  clientKey,
28810
28991
  errorLevel: "warn",
28811
28992
  errorMessage: "Failed to use verifyTin",
28993
+ errorHandler: async (response) => {
28994
+ const error = await response;
28995
+ throw new AdyenKycSdkError(error.message, error);
28996
+ },
28812
28997
  path: "v1/tinVerification/verifyTin",
28813
28998
  headers: {
28814
28999
  "Content-Type": "application/json"
@@ -28819,6 +29004,10 @@ const getKycExternalApi = ({
28819
29004
  loadingContext,
28820
29005
  clientKey
28821
29006
  }) => ({
29007
+ accountIdentification: async (accountIdentificationDetails) => accountIdentification({
29008
+ loadingContext,
29009
+ clientKey
29010
+ }, accountIdentificationDetails),
28822
29011
  getConfiguration: async (request) => getConfiguration({
28823
29012
  loadingContext,
28824
29013
  clientKey
@@ -28875,7 +29064,6 @@ const ConfigurationApiProvider = ({
28875
29064
  const authContext = useAuthContext();
28876
29065
  const contextValue = useMemo(() => authContext.isEmbeddedDropin ? getEmbeddedApi({
28877
29066
  base: authContext.loadingContext,
28878
- sdkToken: authContext.sdkToken,
28879
29067
  rootLegalEntityId
28880
29068
  }) : getKycExternalApi({
28881
29069
  loadingContext: authContext.loadingContext,
@@ -29159,7 +29347,7 @@ class UIElement extends BaseElement {
29159
29347
  const Component = this.props.component;
29160
29348
  return jsx(AuthProvider, {
29161
29349
  sdkToken: this.props.sdkToken,
29162
- refreshToken: this.props.refreshToken,
29350
+ getSdkToken: this.props.getSdkToken,
29163
29351
  clientKey: this.props.clientKey,
29164
29352
  loadingContext: this.props.loadingContext,
29165
29353
  children: jsx(ConfigurationApiProvider, {
@@ -29733,10 +29921,10 @@ const validateComponentName = (componentName) => {
29733
29921
  const validateCoreOptions = (coreOptions) => {
29734
29922
  const requiredOptions = ["locale", "environment", "country"];
29735
29923
  const missing = requiredOptions.filter((option) => !coreOptions[option]);
29736
- if (!(coreOptions.sdkToken && coreOptions.refreshToken) && !coreOptions.clientKey) {
29924
+ if (!(coreOptions.sdkToken && coreOptions.getSdkToken) && !coreOptions.clientKey) {
29737
29925
  throw new Error(`
29738
29926
 
29739
- Please specify either sdkToken and a refreshToken or a clientKey for the SDK to initialize!
29927
+ Please specify either sdkToken and getSdkToken handler or a clientKey for the SDK to initialize!
29740
29928
 
29741
29929
 
29742
29930
  - For more information please check: https://github.com/Adyen/adyen-kyc-components#configuration.`);
@@ -29873,7 +30061,14 @@ class Core {
29873
30061
  newOptions.locale = FALLBACK_LOCALE;
29874
30062
  return newOptions;
29875
30063
  };
30064
+ this.initializeSession = () => {
30065
+ if (this.options.sdkToken && this.options.getSdkToken) {
30066
+ setSdkToken(this.options.sdkToken);
30067
+ setSdkTokenHandler(this.options.getSdkToken);
30068
+ }
30069
+ };
29876
30070
  this.options = this.getUpdatedOptions(coreOptions);
30071
+ this.initializeSession();
29877
30072
  }
29878
30073
  }
29879
30074
  export {