@adyen/kyc-components 2.19.1 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1069 -1049
  2. package/dist/style.css +15 -0
  3. package/dist/types/components/BusinessTypeSelection/types.d.ts +1 -1
  4. package/dist/types/components/BusinessTypeSelection/utils.d.ts +24 -0
  5. package/dist/types/components/ContactDetails/component/ContactDetailsComponent.d.ts +7 -1
  6. package/dist/types/components/Dropins/CompanyDropin/types.d.ts +2 -2
  7. package/dist/types/components/Dropins/PciDropin/types.d.ts +1 -1
  8. package/dist/types/components/Dropins/ServiceAgreementDropinComponent/types.d.ts +1 -1
  9. package/dist/types/components/IdentityNumber/component/IdentityNumberComponent.d.ts +3 -1
  10. package/dist/types/components/IdentityNumber/validate.helper.d.ts +1 -5
  11. package/dist/types/components/Individual/types.d.ts +2 -2
  12. package/dist/types/components/LegalEntityTypeSwitcher/type.d.ts +5 -2
  13. package/dist/types/components/PayoutAccount/types.d.ts +3 -2
  14. package/dist/types/components/TaskList/component/PayoutAccountTaskListItem.d.ts +2 -2
  15. package/dist/types/components/Trust/types.d.ts +2 -2
  16. package/dist/types/components/internal/Accordion/types.d.ts +1 -1
  17. package/dist/types/components/internal/AccountHolder/types.d.ts +1 -1
  18. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  19. package/dist/types/components/internal/BusinessRegistrationNumber/validate.d.ts +5 -4
  20. package/dist/types/components/internal/ContractViewer/types.d.ts +24 -17
  21. package/dist/types/components/internal/ErrorPanel/components/NavigateToFieldLink.d.ts +5 -4
  22. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +1 -1
  23. package/dist/types/components/internal/FormFields/InputDate/utils.d.ts +1 -1
  24. package/dist/types/components/internal/FormFields/InputEmail.d.ts +2 -1
  25. package/dist/types/components/internal/FormFields/InputTelephone.d.ts +2 -1
  26. package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +1 -8
  27. package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts +2 -1
  28. package/dist/types/components/internal/FormFields/utils.d.ts +6 -1
  29. package/dist/types/components/internal/Name/Name.d.ts +13 -1
  30. package/dist/types/core/Context/StateContext/StateProvider.d.ts +8 -4
  31. package/dist/types/core/errorMapping.d.ts +1 -1
  32. package/dist/types/core/hooks/useBusinessSetup.d.ts +6 -0
  33. package/dist/types/core/hooks/useExemptSettlor.d.ts +1 -1
  34. package/dist/types/core/models/decision-maker.d.ts +1 -1
  35. package/dist/types/core/models/identity.d.ts +3 -1
  36. package/dist/types/core/user-events.d.ts +7 -6
  37. package/dist/types/language/config.d.ts +9 -2
  38. package/dist/types/utils/decision-maker-roles.d.ts +10 -19
  39. package/dist/types/utils/entity-association-util.d.ts +23 -17
  40. package/dist/types/utils/entity-status-util.d.ts +1 -3
  41. package/dist/types/utils/entriesOf.d.ts +1 -0
  42. package/dist/types/utils/file.d.ts +3 -3
  43. package/dist/types/utils/genUtils.d.ts +11 -9
  44. package/dist/types/utils/get-name.d.ts +2 -2
  45. package/dist/types/utils/get-task-status.d.ts +2 -2
  46. package/dist/types/utils/makeSelectItemForRole.d.ts +4 -0
  47. package/dist/types/utils/regex/types.d.ts +1 -1
  48. package/dist/types/utils/remove-object-empty-values.d.ts +1 -1
  49. package/dist/types/utils/roleMetadata.d.ts +13 -0
  50. package/dist/types/utils/scroll.d.ts +1 -1
  51. package/dist/types/utils/trust-util.d.ts +4 -25
  52. package/package.json +2 -2
@@ -139,13 +139,18 @@ const privateCompanyTitle = "Private company";
139
139
  const privateCompanyDescription = "Owned privately. The shareholders don’t necessarily trade on public exchanges (like the stock market).";
140
140
  const publicCompanyTitle = "Public company";
141
141
  const publicCompanyDescription = "Owned by public shareholders. They’re also required to disclose financial information to the public regularly.";
142
+ const partnershipIncorporated = "Incorporated partnership";
143
+ const partnershipUnincorporated = "Unincorporated partnership";
144
+ const associationIncorporated = "Incorporated association";
142
145
  const incorporatedPartnership = "Incorporated partnership";
143
146
  const unincorporatedPartnership = "Unincorporated partnership";
144
147
  const incorporatedPartnershipTitle = "Incorporated partnership";
148
+ const partnershipIncorporatedDescription = "An agreement between two or more people who run a business together.";
149
+ const partnershipUnincorporatedDescription = "You or your partners are personally liable for business debts.";
150
+ const partnershipIncorporatedNewEntryFlowDescription = "You and your partners have limited liability for business debts.";
151
+ const partnershipUnincorporatedNewEntryFlowDescription = "You or your partners are personally liable for business debts.";
145
152
  const incorporatedPartnershipDescription = "An agreement between two or more people who run a business together.";
146
- const incorporatedPartnershipNewEntryFlowDescription = "You and your partners have limited liability for business debts.";
147
153
  const unincorporatedPartnershipDescription = "You or your partners are personally liable for business debts.";
148
- const unincorporatedPartnershipNewEntryFlowDescription = "You or your partners are personally liable for business debts.";
149
154
  const nonProfitOrCharitableOrgTitle = "Non-profit or charitable organization";
150
155
  const nonProfitOrCharitableOrgDescription = "An organization that has an official status as not for profit or tax exempt, sometimes called an NGO.";
151
156
  const governmentalOrganizationTitle = "Governmental organization";
@@ -266,6 +271,7 @@ const signedDocuments = "Signed documents";
266
271
  const paymentProcessingTerms = "Payment Processing Terms";
267
272
  const accountHolderTerms = "Account Holder Terms";
268
273
  const capitalUserTerms = "Capital User Terms";
274
+ const pccr = "PCCR";
269
275
  const businessAccountTerms = "Business Account Terms";
270
276
  const cardUserTerms = "Card User Terms";
271
277
  const franchiseesTAndCs = "Franchisees T&C's";
@@ -645,6 +651,7 @@ const failedToFetchSoleProp = "Failed to fetch the sole propietor";
645
651
  const uniqueIdentificationCode = "Unique identification code (ЕИК/UIC)";
646
652
  const identifikacionenNomerDDS = "VAT number (ДДС)";
647
653
  const MBS = "Matični broj subjekta trgovačkog suda (MBS)";
654
+ const MBO = "MBO";
648
655
  const PDVIdBrojOIB = "PDV Id. Broj OIB";
649
656
  const cyRegistrationNumber = "Αριθμός Εγγραφής";
650
657
  const arithmosEngraphes = "Αριθμός Εγγραφής Φ.Π.Α.";
@@ -1261,13 +1268,18 @@ const defaultTrans = {
1261
1268
  privateCompanyDescription,
1262
1269
  publicCompanyTitle,
1263
1270
  publicCompanyDescription,
1271
+ partnershipIncorporated,
1272
+ partnershipUnincorporated,
1273
+ associationIncorporated,
1264
1274
  incorporatedPartnership,
1265
1275
  unincorporatedPartnership,
1266
1276
  incorporatedPartnershipTitle,
1277
+ partnershipIncorporatedDescription,
1278
+ partnershipUnincorporatedDescription,
1279
+ partnershipIncorporatedNewEntryFlowDescription,
1280
+ partnershipUnincorporatedNewEntryFlowDescription,
1267
1281
  incorporatedPartnershipDescription,
1268
- incorporatedPartnershipNewEntryFlowDescription,
1269
1282
  unincorporatedPartnershipDescription,
1270
- unincorporatedPartnershipNewEntryFlowDescription,
1271
1283
  nonProfitOrCharitableOrgTitle,
1272
1284
  nonProfitOrCharitableOrgDescription,
1273
1285
  governmentalOrganizationTitle,
@@ -1388,6 +1400,7 @@ const defaultTrans = {
1388
1400
  paymentProcessingTerms,
1389
1401
  accountHolderTerms,
1390
1402
  capitalUserTerms,
1403
+ pccr,
1391
1404
  businessAccountTerms,
1392
1405
  cardUserTerms,
1393
1406
  franchiseesTAndCs,
@@ -1772,6 +1785,7 @@ const defaultTrans = {
1772
1785
  uniqueIdentificationCode,
1773
1786
  identifikacionenNomerDDS,
1774
1787
  MBS,
1788
+ MBO,
1775
1789
  PDVIdBrojOIB,
1776
1790
  cyRegistrationNumber,
1777
1791
  arithmosEngraphes,
@@ -2386,43 +2400,30 @@ class Language {
2386
2400
  });
2387
2401
  }
2388
2402
  }
2389
- function isArray(prop) {
2390
- return typeof prop === "object" && prop !== null && Object.prototype.toString.call(prop) === "[object Array]";
2391
- }
2392
- function pick(...args) {
2393
- const myArgs = isArray(args[0]) ? args[0] : args;
2394
- return {
2395
- from: (obj) => (
2396
- // eslint-disable-line
2397
- myArgs.map((k) => k in obj ? {
2398
- [k]: obj[k]
2399
- } : {}).reduce((res, o) => ({
2400
- ...res,
2401
- ...o
2402
- }), {})
2403
- )
2404
- };
2405
- }
2406
- function drop(...args) {
2407
- const myArgs = isArray(args[0]) ? args[0] : args;
2408
- return {
2409
- from: (obj) => {
2410
- const vkeys = Object.keys(obj).filter((k) => !myArgs.includes(k));
2411
- return pick(...vkeys).from(obj);
2412
- }
2413
- };
2414
- }
2415
- function doArraysMatch(arr1, arr2) {
2416
- return arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2417
- }
2403
+ const entriesOf = (object) => Object.entries(object);
2404
+ const keysOf = (object) => Object.keys(object);
2405
+ const keyIsInObject = (key, obj) => key in obj;
2406
+ const pick = (...propertiesToKeep) => ({
2407
+ from: (obj) => propertiesToKeep.map((k) => keyIsInObject(k, obj) ? {
2408
+ [k]: obj[k]
2409
+ } : {}).reduce((res, o) => ({
2410
+ ...res,
2411
+ ...o
2412
+ }), {})
2413
+ });
2414
+ const drop = (...propertiesToDrop) => ({
2415
+ from: (obj) => {
2416
+ const remainingProperties = keysOf(obj).filter((k) => !propertiesToDrop.includes(k));
2417
+ return pick(...remainingProperties).from(obj);
2418
+ }
2419
+ });
2420
+ const doArraysMatch = (arr1, arr2) => arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2418
2421
  const objectsDeepEqual = (x, y) => {
2419
- const xType = typeof x;
2420
- const yType = typeof y;
2421
- if (x && y && xType === "object" && xType === yType) {
2422
+ if (x && y && typeof x === "object" && typeof y === "object") {
2422
2423
  if (Object.keys(x).length !== Object.keys(y).length) {
2423
2424
  return false;
2424
2425
  }
2425
- return Object.keys(x).every((key) => objectsDeepEqual(x[key], y[key]));
2426
+ return keysOf(x).every((key) => objectsDeepEqual(x[key], y[key]));
2426
2427
  }
2427
2428
  return x === y;
2428
2429
  };
@@ -2463,7 +2464,6 @@ function useSettingsContext() {
2463
2464
  }
2464
2465
  return context;
2465
2466
  }
2466
- const entriesOf = (object) => Object.entries(object);
2467
2467
  const hasDataChanged = (initialData, currentData) => entriesOf(currentData ?? {}).some(([key, value]) => {
2468
2468
  if (typeof value === "object") {
2469
2469
  return !objectsDeepEqual(value, initialData == null ? void 0 : initialData[key]);
@@ -2493,6 +2493,41 @@ const useCoreContext = () => {
2493
2493
  throw Error("You need a <CoreProvider> to use core context");
2494
2494
  return context;
2495
2495
  };
2496
+ const ExperimentsContext = createContext({
2497
+ isExperimentEnabled: () => false
2498
+ });
2499
+ function useExperimentsContext() {
2500
+ const context = useContext(ExperimentsContext);
2501
+ if (context === void 0) {
2502
+ throw new Error("useExperimentContext must be used within a ExperimentProvider");
2503
+ }
2504
+ return context;
2505
+ }
2506
+ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2507
+ SettingNames2["AllowBankAccountFormatSelection"] = "allowBankAccountFormatSelection";
2508
+ SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2509
+ SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2510
+ SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2511
+ SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2512
+ SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2513
+ SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
2514
+ SettingNames2["RequirePciSignPosMoto"] = "requirePciSignPosMoto";
2515
+ SettingNames2["HideOnboardingIntroductionIndividual"] = "hideOnboardingIntroductionIndividual";
2516
+ SettingNames2["HideOnboardingIntroductionOrganization"] = "hideOnboardingIntroductionOrganization";
2517
+ SettingNames2["HideOnboardingIntroductionTrust"] = "hideOnboardingIntroductionTrust";
2518
+ SettingNames2["HideOnboardingIntroductionSoleProprietor"] = "hideOnboardingIntroductionSoleProprietor";
2519
+ SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
2520
+ return SettingNames2;
2521
+ })(SettingNames || {});
2522
+ const useEnableNewEntryFlow = () => {
2523
+ const {
2524
+ isSettingEnabled
2525
+ } = useSettingsContext();
2526
+ const {
2527
+ isExperimentEnabled
2528
+ } = useExperimentsContext();
2529
+ return isSettingEnabled(SettingNames.AllowLegalEntityTypeChange) && isExperimentEnabled("EnableNewEntryFlow");
2530
+ };
2496
2531
  const Summary$1 = "";
2497
2532
  const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
2498
2533
  a[c] = obj[c];
@@ -3018,12 +3053,11 @@ const NavigateToFieldLink = ({
3018
3053
  const {
3019
3054
  goToFormByFieldName
3020
3055
  } = useFormRouterContext();
3021
- const onClick = (e) => {
3022
- e.preventDefault();
3023
- goToFormByFieldName(fieldName);
3024
- };
3025
3056
  return jsx(Link, {
3026
- onClick,
3057
+ onClick: (e) => {
3058
+ e.preventDefault();
3059
+ goToFormByFieldName(fieldName);
3060
+ },
3027
3061
  href: "to-field-link",
3028
3062
  children: label
3029
3063
  });
@@ -3195,22 +3229,6 @@ function getFieldProps(props, innerFormFields) {
3195
3229
  }
3196
3230
  return null;
3197
3231
  }
3198
- var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
3199
- SettingNames2["AllowBankAccountFormatSelection"] = "allowBankAccountFormatSelection";
3200
- SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
3201
- SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
3202
- SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
3203
- SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
3204
- SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
3205
- SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
3206
- SettingNames2["RequirePciSignPosMoto"] = "requirePciSignPosMoto";
3207
- SettingNames2["HideOnboardingIntroductionIndividual"] = "hideOnboardingIntroductionIndividual";
3208
- SettingNames2["HideOnboardingIntroductionOrganization"] = "hideOnboardingIntroductionOrganization";
3209
- SettingNames2["HideOnboardingIntroductionTrust"] = "hideOnboardingIntroductionTrust";
3210
- SettingNames2["HideOnboardingIntroductionSoleProprietor"] = "hideOnboardingIntroductionSoleProprietor";
3211
- SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
3212
- return SettingNames2;
3213
- })(SettingNames || {});
3214
3232
  const ON_CHANGE_DEBOUNCE_DURATION = 200;
3215
3233
  const KEYBOARD_KEYS = {
3216
3234
  arrowDown: "ArrowDown",
@@ -3925,7 +3943,7 @@ const Field = ({
3925
3943
  errorMessage,
3926
3944
  filled,
3927
3945
  focused,
3928
- helper: helper2,
3946
+ helper,
3929
3947
  inputWrapperModifiers = [],
3930
3948
  isLoading,
3931
3949
  isValid,
@@ -3970,9 +3988,9 @@ const Field = ({
3970
3988
  "adyen-kyc-label__text--error": !!errorMessage
3971
3989
  }),
3972
3990
  children: label
3973
- }), helper2 && jsx("span", {
3991
+ }), helper && jsx("span", {
3974
3992
  className: "adyen-kyc-helper-text",
3975
- children: helper2
3993
+ children: helper
3976
3994
  }), jsxs("div", {
3977
3995
  className: cx("adyen-kyc-input-wrapper", ...inputWrapperModifiers.map((m) => `adyen-kyc-input-wrapper--${m}`)),
3978
3996
  children: [children({
@@ -4023,16 +4041,14 @@ const Field = ({
4023
4041
  };
4024
4042
  const Select$1 = "";
4025
4043
  const getScrollParent = (node) => {
4044
+ if (!node)
4045
+ return null;
4026
4046
  const isElement = node instanceof HTMLElement;
4027
4047
  const overflowY = isElement && window.getComputedStyle(node).overflowY;
4028
4048
  const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
4029
- if (!node) {
4030
- return -1;
4031
- }
4032
- if (isScrollable) {
4049
+ if (isElement && isScrollable)
4033
4050
  return node;
4034
- }
4035
- return getScrollParent(node.parentNode) || document.body;
4051
+ return getScrollParent(node.parentNode) ?? document.body;
4036
4052
  };
4037
4053
  function uuidv4() {
4038
4054
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -4558,13 +4574,13 @@ function SelectButton({
4558
4574
  "adyen-kyc-dropdown-button-search": isSearch
4559
4575
  }),
4560
4576
  filterable,
4561
- onClick: !readonly ? toggleList : null,
4562
- onKeyDown: !readonly ? onButtonKeyDown : null,
4563
- role: filterable || isMulti ? "button" : null,
4564
- tabIndex: "0",
4577
+ onClick: !readonly ? toggleList : void 0,
4578
+ onKeyDown: !readonly ? onButtonKeyDown : void 0,
4579
+ role: filterable || isMulti ? "button" : void 0,
4580
+ tabIndex: 0,
4565
4581
  title,
4566
4582
  toggleButtonRef,
4567
- type: !filterable && !isMulti ? "button" : null,
4583
+ type: !filterable && !isMulti ? "button" : void 0,
4568
4584
  "aria-describedby": ariaDescribedBy,
4569
4585
  isMulti,
4570
4586
  id: id2,
@@ -4658,7 +4674,7 @@ function Checkbox({
4658
4674
  label,
4659
4675
  isInvalid,
4660
4676
  onChange,
4661
- helper: helper2,
4677
+ helper,
4662
4678
  checked,
4663
4679
  disabled,
4664
4680
  ...props
@@ -4680,9 +4696,9 @@ function Checkbox({
4680
4696
  }), jsx("span", {
4681
4697
  className: "adyen-kyc-checkbox__label",
4682
4698
  children: label
4683
- }), helper2 && jsx("span", {
4699
+ }), helper && jsx("span", {
4684
4700
  className: "adyen-kyc-checkbox__helper-text",
4685
- children: helper2
4701
+ children: helper
4686
4702
  })]
4687
4703
  });
4688
4704
  }
@@ -5781,6 +5797,13 @@ const businessRegistrationNumberPatterns = {
5781
5797
  values: {
5782
5798
  digits: 9
5783
5799
  }
5800
+ },
5801
+ [CompanyTypesValue.SOLE_PROPRIETORSHIP]: {
5802
+ regex: /^\d{8}$/,
5803
+ format: "Xdigits",
5804
+ values: {
5805
+ digits: 8
5806
+ }
5784
5807
  }
5785
5808
  },
5786
5809
  [CountryCodes.Cyprus]: {
@@ -6338,9 +6361,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6338
6361
  return {
6339
6362
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6340
6363
  translationMessage: {
6341
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6342
- format: null,
6343
- values: null
6364
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6344
6365
  }
6345
6366
  };
6346
6367
  }
@@ -6356,9 +6377,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6356
6377
  return {
6357
6378
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6358
6379
  translationMessage: {
6359
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6360
- format: null,
6361
- values: null
6380
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6362
6381
  }
6363
6382
  };
6364
6383
  };
@@ -6368,20 +6387,32 @@ const getValidationRulesPerCountryAndType = (country2, companyType2, trustType2,
6368
6387
  if (!registrationNumber2)
6369
6388
  return false;
6370
6389
  const {
6371
- isValid,
6372
- translationMessage
6390
+ isValid
6391
+ } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6392
+ return isValid;
6393
+ },
6394
+ errorMessage: (registrationNumber2) => {
6395
+ if (!registrationNumber2)
6396
+ return;
6397
+ const {
6398
+ translationMessage: {
6399
+ translationKey,
6400
+ format,
6401
+ values
6402
+ }
6373
6403
  } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6374
- this.errorMessage = {
6375
- translationKey: translationMessage.translationKey,
6404
+ if (!format)
6405
+ return translationKey;
6406
+ return {
6407
+ translationKey,
6376
6408
  translationObject: {
6377
6409
  values: {
6378
- format: translationMessage.values ? i18n.get(translationMessage.format, {
6379
- values: translationMessage.values
6380
- }) : i18n.get(translationMessage.format)
6410
+ format: values ? i18n.get(format, {
6411
+ values
6412
+ }) : i18n.get(format)
6381
6413
  }
6382
6414
  }
6383
6415
  };
6384
- return isValid;
6385
6416
  }
6386
6417
  });
6387
6418
  const defaultValidationRules = {
@@ -6401,6 +6432,7 @@ const getRegistrationNumberValidationRules = (country2, companyType2, trustType2
6401
6432
  };
6402
6433
  const businessRegistrationNumberFields = ["registrationNumber", "exemptedFromRegistrationNumber"];
6403
6434
  function BusinessRegistrationNumber(props) {
6435
+ var _a;
6404
6436
  const {
6405
6437
  i18n
6406
6438
  } = useI18nContext();
@@ -6413,7 +6445,7 @@ function BusinessRegistrationNumber(props) {
6413
6445
  country: country2,
6414
6446
  trustType: trustType2
6415
6447
  } = props;
6416
- const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, i18n]);
6448
+ const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, trustType2, i18n]);
6417
6449
  const registrationNumberFormatters = getRegistrationNumberFormatters(props.country);
6418
6450
  const {
6419
6451
  handleChangeFor,
@@ -6429,13 +6461,14 @@ function BusinessRegistrationNumber(props) {
6429
6461
  formatters: registrationNumberFormatters,
6430
6462
  defaultData: {
6431
6463
  ...props.data,
6432
- exemptedFromRegistrationNumber: !!props.data.exemptedFromRegistrationNumber
6464
+ exemptedFromRegistrationNumber: !!((_a = props.data) == null ? void 0 : _a.exemptedFromRegistrationNumber)
6433
6465
  },
6434
6466
  // exemptedFromRegistrationNumber should be a boolean
6435
6467
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
6436
6468
  });
6437
6469
  useEffect(() => {
6438
- stateRef.current.setState({
6470
+ var _a2, _b;
6471
+ (_b = (_a2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
6439
6472
  type: "addToState",
6440
6473
  value: {
6441
6474
  data,
@@ -6485,7 +6518,7 @@ function BusinessRegistrationNumber(props) {
6485
6518
  value: "exemptedFromRegistrationNumber",
6486
6519
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
6487
6520
  classNameModifiers: ["exempted-from-registration"],
6488
- checked: data.exemptedFromRegistrationNumber,
6521
+ checked: data.exemptedFromRegistrationNumber ?? false,
6489
6522
  onChange: handleChangeFor("exemptedFromRegistrationNumber"),
6490
6523
  "aria-required": formUtils.isRequiredField("exemptedFromRegistrationNumber"),
6491
6524
  "aria-label": formUtils.getLabel("exemptedFromRegistrationNumber"),
@@ -7675,7 +7708,7 @@ const companyRegistrationDetailsValidationRules = {
7675
7708
  },
7676
7709
  stockExchangeMIC: {
7677
7710
  modes: ["blur"],
7678
- validate: (input) => /^[A-Z0-9]{4}$/.test(input),
7711
+ validate: (input) => !isEmpty(input) && /^[A-Z0-9]{4}$/.test(input),
7679
7712
  errorMessage: "validationPleaseEnterAValidMarketIdentifier"
7680
7713
  },
7681
7714
  stockISIN: [{
@@ -7693,7 +7726,7 @@ const companyRegistrationDetailsValidationRules = {
7693
7726
  errorMessage: "fieldIsRequired"
7694
7727
  }, {
7695
7728
  modes: ["blur"],
7696
- validate: (dateOfIncorporation2) => dateOfIncorporation2 && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7729
+ validate: (dateOfIncorporation2) => !isEmpty(dateOfIncorporation2) && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7697
7730
  errorMessage: "invalidDateOfIncorporation"
7698
7731
  }]
7699
7732
  };
@@ -8628,16 +8661,6 @@ const countryConfig$4 = {
8628
8661
  }
8629
8662
  }
8630
8663
  };
8631
- const ExperimentsContext = createContext({
8632
- isExperimentEnabled: () => false
8633
- });
8634
- function useExperimentsContext() {
8635
- const context = useContext(ExperimentsContext);
8636
- if (context === void 0) {
8637
- throw new Error("useExperimentContext must be used within a ExperimentProvider");
8638
- }
8639
- return context;
8640
- }
8641
8664
  var TrustMemberTypes = /* @__PURE__ */ ((TrustMemberTypes2) => {
8642
8665
  TrustMemberTypes2["DEFINED_BENEFICIARY"] = "definedBeneficiary";
8643
8666
  TrustMemberTypes2["UNDEFINED_BENEFICIARY"] = "undefinedBeneficiary";
@@ -9371,16 +9394,13 @@ function DropzoneFile(props) {
9371
9394
  i18n
9372
9395
  } = useI18nContext();
9373
9396
  const formatSize = (bytes) => {
9374
- if (bytes) {
9375
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9376
- if (bytes === 0)
9377
- return "n/a";
9378
- const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9379
- if (i === 0)
9380
- return `${bytes} ${sizes[i]}`;
9381
- return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9382
- }
9383
- return null;
9397
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9398
+ if (!bytes || bytes === 0)
9399
+ return "n/a";
9400
+ const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9401
+ if (i === 0)
9402
+ return `${bytes} ${sizes[i]}`;
9403
+ return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9384
9404
  };
9385
9405
  return jsxs("div", {
9386
9406
  className: "adyen-kyc-dropzone-file",
@@ -9527,10 +9547,10 @@ function Dropzone(props) {
9527
9547
  const isRequired = ((_a = errors == null ? void 0 : errors[name]) == null ? void 0 : _a.errorMessage) === "fieldIsRequired";
9528
9548
  const allowedFiletypes = allowedFileTypes.join(", ");
9529
9549
  useEffect(() => {
9530
- var _a2;
9550
+ var _a2, _b2, _c;
9531
9551
  const hasMaxNumberOfFiles = ((_a2 = data == null ? void 0 : data[name]) == null ? void 0 : _a2.length) >= maxNumberOfFiles;
9532
9552
  setShowDropzone(!hasMaxNumberOfFiles);
9533
- stateRef.current.setState({
9553
+ (_c = (_b2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _b2.setState) == null ? void 0 : _c.call(_b2, {
9534
9554
  type: "addToState",
9535
9555
  value: {
9536
9556
  data,
@@ -10838,10 +10858,10 @@ Address.defaultProps = {
10838
10858
  };
10839
10859
  const RadioGroup$1 = "";
10840
10860
  function RadioGroup({
10841
- items,
10861
+ items = [],
10842
10862
  i18n,
10843
10863
  name,
10844
- onChange,
10864
+ onChange = noop,
10845
10865
  value,
10846
10866
  isInvalid,
10847
10867
  uniqueId: uniqueId2,
@@ -10876,11 +10896,6 @@ function RadioGroup({
10876
10896
  })
10877
10897
  });
10878
10898
  }
10879
- RadioGroup.defaultProps = {
10880
- onChange: () => {
10881
- },
10882
- items: []
10883
- };
10884
10899
  var operationalAddressIsSameIds = /* @__PURE__ */ ((operationalAddressIsSameIds2) => {
10885
10900
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_SAME"] = "OperationAddressAnswerYes";
10886
10901
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_NOT_SAME"] = "OperationAddressAnswerNo";
@@ -11478,443 +11493,26 @@ const getMaskedAccountNumber = ({
11478
11493
  accountIdentifier,
11479
11494
  realLastFour
11480
11495
  }) => realLastFour ? `*******${realLastFour}` : accountIdentifier;
11481
- const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
11482
- roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
11483
- min: 1,
11484
- max: Infinity
11485
- }, {
11486
- roleTypes: [DecisionMakerType.OWNER],
11487
- min: 0,
11488
- max: 4
11489
- }, {
11490
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11491
- min: 0,
11492
- max: Infinity
11493
- }, {
11494
- roleTypes: [DecisionMakerType.SIGNATORY],
11495
- min: 1,
11496
- max: Infinity
11497
- }];
11498
- const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
11499
- US: [{
11500
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11501
- min: 1,
11502
- max: Infinity
11503
- }, {
11504
- roleTypes: [DecisionMakerType.OWNER],
11505
- min: 0,
11506
- max: 4
11507
- }, {
11508
- roleTypes: [DecisionMakerType.SIGNATORY],
11509
- min: 1,
11510
- max: Infinity
11511
- }],
11512
- BR: [{
11513
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11514
- min: 1,
11515
- max: Infinity
11516
- }, {
11517
- roleTypes: [DecisionMakerType.OWNER],
11518
- min: 0,
11519
- max: 4
11520
- }, {
11521
- roleTypes: [DecisionMakerType.SIGNATORY],
11522
- min: 1,
11523
- max: Infinity
11524
- }],
11525
- AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11526
- roleTypes: [DecisionMakerType.DIRECTOR],
11527
- min: 3,
11528
- max: Infinity
11529
- }],
11530
- CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11531
- roleTypes: [DecisionMakerType.DIRECTOR],
11532
- min: 1,
11533
- max: Infinity
11534
- }],
11535
- HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11536
- roleTypes: [DecisionMakerType.DIRECTOR],
11537
- min: 1,
11538
- max: Infinity
11539
- }],
11540
- IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11541
- roleTypes: [DecisionMakerType.DIRECTOR],
11542
- min: 3,
11543
- max: 15
11544
- }],
11545
- NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11546
- roleTypes: [DecisionMakerType.DIRECTOR],
11547
- min: 1,
11548
- max: Infinity
11549
- }],
11550
- SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11551
- roleTypes: [DecisionMakerType.DIRECTOR],
11552
- min: 1,
11553
- max: Infinity
11554
- }]
11555
- };
11556
- const getDecisionMakerRequirements = (country2) => PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] || DEFAULT_DECISION_MAKER_REQUIREMENTS;
11557
- function getAvailableDecisionMakerRoleTypes(country2) {
11558
- const requirements2 = getDecisionMakerRequirements(country2);
11559
- return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
11560
- roleType: req.roleTypes[0],
11561
- min: req.min,
11562
- max: req.max
11563
- }));
11564
- }
11565
- const DEFAULT_DESCRIPTIONS_MAP = {
11566
- [DecisionMakerType.OWNER]: "provideAllOwners",
11567
- [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
11568
- [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
11569
- [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
11570
- };
11571
- const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
11572
- US: {
11573
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11574
- },
11575
- BR: {
11576
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11577
- }
11578
- };
11579
- const getDecisionMakerDescriptionMap = (country2) => ({
11580
- ...DEFAULT_DESCRIPTIONS_MAP,
11581
- ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
11582
- });
11583
- const decisionMakerRoles = {
11584
- [DecisionMakerType.CONTROLLING_PERSON]: {
11585
- id: DecisionMakerType.CONTROLLING_PERSON,
11586
- name: "controllingPerson",
11587
- description: "controllingPersonDescription",
11588
- className: "adl-tag--teal"
11589
- },
11590
- [DecisionMakerType.OWNER]: {
11591
- id: DecisionMakerType.OWNER,
11592
- name: "owner",
11593
- description: "ownerDescription",
11594
- className: "adl-tag--purple"
11595
- },
11596
- [DecisionMakerType.SIGNATORY]: {
11597
- id: DecisionMakerType.SIGNATORY,
11598
- name: "signatory",
11599
- description: "signatoryDescription",
11600
- className: "adl-tag--light-blue"
11601
- },
11602
- [DecisionMakerType.DIRECTOR]: {
11603
- id: DecisionMakerType.DIRECTOR,
11604
- name: "director",
11605
- description: "directorDescription",
11606
- className: "adl-tag--orange"
11607
- }
11496
+ const getDirectEntityAssociations = (rootLE, legalEntityId) => {
11497
+ var _a;
11498
+ return ((_a = rootLE == null ? void 0 : rootLE.entityAssociations) == null ? void 0 : _a.filter((association2) => association2.associatorId === legalEntityId)) ?? [];
11608
11499
  };
11609
- const getTranslatedDecisionMakerRoles = (i18n, allowedRoles) => Object.values(decisionMakerRoles).filter((decisionMakerRole) => (allowedRoles == null ? void 0 : allowedRoles.length) === 0 || (allowedRoles == null ? void 0 : allowedRoles.includes(decisionMakerRole.id))).map((decisionMakerRole) => ({
11610
- ...decisionMakerRole,
11611
- id: decisionMakerRole.id,
11612
- name: i18n.get(decisionMakerRole.name),
11613
- description: i18n.get(decisionMakerRole.description)
11614
- }));
11615
- const getOwnDecisionMakers = (legalEntity) => {
11616
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
11617
- const decisionMakerTypes = Object.values(DecisionMakerType);
11618
- return legalEntity.entityAssociations.filter((entityAssociation) => decisionMakerTypes.includes(entityAssociation.type) && entityAssociation.associatorId === legalEntity.id);
11619
- }
11620
- return [];
11500
+ const getOwnEntityAssociations = (legalEntity) => getDirectEntityAssociations(legalEntity, legalEntity.id);
11501
+ const getOwnSoleProprietorshipIdArray = (legalEntity) => {
11502
+ const ownAssociations = getOwnEntityAssociations(legalEntity);
11503
+ return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11621
11504
  };
11622
- const getOwnSignatories = (legalEntity) => getOwnDecisionMakers(legalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
11623
- const getOwnDecisionMakersLegalEntityIds = (legalEntity) => {
11505
+ const hasSolePropInLegalEntity = (rootLegalEntity) => {
11624
11506
  var _a;
11625
- return (_a = getOwnDecisionMakers(legalEntity)) == null ? void 0 : _a.map((ea) => ea.legalEntityId);
11507
+ return ((_a = rootLegalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === rootLegalEntity.id)) ?? false;
11626
11508
  };
11627
- const getDecisionMakerCount = (legalEntityResponse) => {
11628
- const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
11629
- return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
11630
- decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
11631
- return decisionMakerCount;
11632
- }, {});
11509
+ const getOwnSolePropProblems = (rootLegalEntity, capabilityProblems) => {
11510
+ var _a;
11511
+ const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
11512
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
11633
11513
  };
11634
- const getAllowedDecisionMakerRoles = (legalEntityResponse, taskType) => {
11635
- var _a, _b;
11636
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
11637
- return [DecisionMakerType.OWNER];
11638
- }
11639
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11640
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11641
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11642
- const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
11643
- const {
11644
- roleTypes,
11645
- max
11646
- } = requirements2;
11647
- if (roleTypes.length === 1) {
11648
- const role2 = roleTypes[0];
11649
- const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
11650
- if (isBelowMaxRange) {
11651
- acc.push(role2);
11652
- }
11653
- }
11654
- return acc;
11655
- }, []);
11656
- const uniqueAllowedRoles = [...new Set(allowedRoles)];
11657
- return uniqueAllowedRoles;
11658
- };
11659
- const hasMinRequiredDecisionMakerCount = (legalEntityResponse) => {
11660
- var _a, _b;
11661
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11662
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11663
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11664
- return decisionMakerCountRange.every((requirements2) => {
11665
- const {
11666
- roleTypes,
11667
- min
11668
- } = requirements2;
11669
- return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
11670
- });
11671
- };
11672
- var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
11673
- TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
11674
- TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
11675
- TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
11676
- TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
11677
- TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
11678
- TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
11679
- TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
11680
- TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
11681
- TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
11682
- TrustTypes2["FAMILY_TRUST"] = "familyTrust";
11683
- TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
11684
- TrustTypes2["FIXED_TRUST"] = "fixedTrust";
11685
- TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
11686
- TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
11687
- TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
11688
- TrustTypes2["OTHER_TRUST"] = "otherTrust";
11689
- TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
11690
- TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
11691
- TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
11692
- return TrustTypes2;
11693
- })(TrustTypes || {});
11694
- const trustTypeOptions = [{
11695
- id: TrustTypes.BUSINESS_TRUST,
11696
- name: "businessTrust"
11697
- }, {
11698
- id: TrustTypes.CASH_MANAGEMENT_TRUST,
11699
- name: "cashManagementTrust"
11700
- }, {
11701
- id: TrustTypes.CHARITABLE_TRUST,
11702
- name: "charitableTrust"
11703
- }, {
11704
- id: TrustTypes.CORPORATE_UNIT_TRUST,
11705
- name: "corporateUnitTrust"
11706
- }, {
11707
- id: TrustTypes.DECEASED_ESTATE,
11708
- name: "deceasedEstate"
11709
- }, {
11710
- id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
11711
- name: "discretionaryInvestmentTrust"
11712
- }, {
11713
- id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
11714
- name: "discretionaryServicesManagementTrust"
11715
- }, {
11716
- id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
11717
- name: "discretionaryTradingTrust"
11718
- }, {
11719
- id: TrustTypes.DISCRETIONARY_TRUST,
11720
- name: "discretionaryTrust"
11721
- }, {
11722
- id: TrustTypes.FAMILY_TRUST,
11723
- name: "familyTrust"
11724
- }, {
11725
- id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
11726
- name: "firstHomeSaverAccountsTrust"
11727
- }, {
11728
- id: TrustTypes.FIXED_TRUST,
11729
- name: "fixedTrust"
11730
- }, {
11731
- id: TrustTypes.FIXED_UNIT_TRUST,
11732
- name: "fixedUnitTrust"
11733
- }, {
11734
- id: TrustTypes.HYBRID_TRUST,
11735
- name: "hybridTrust"
11736
- }, {
11737
- id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
11738
- name: "listedPublicUnitTrust"
11739
- }, {
11740
- id: TrustTypes.OTHER_TRUST,
11741
- name: "otherTrust"
11742
- }, {
11743
- id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
11744
- name: "pooledSuperannuationTrust"
11745
- }, {
11746
- id: TrustTypes.PUBLIC_TRADING_TRUST,
11747
- name: "publicTradingTrust"
11748
- }, {
11749
- id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
11750
- name: "unlistedPublicUnitTrust"
11751
- }];
11752
- const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
11753
- const auSpecificTrustTypes = [TrustTypes.CASH_MANAGEMENT_TRUST, TrustTypes.CORPORATE_UNIT_TRUST, TrustTypes.DECEASED_ESTATE, TrustTypes.DISCRETIONARY_INVESTMENT_TRUST, TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST, TrustTypes.DISCRETIONARY_TRADING_TRUST, TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST, TrustTypes.FIXED_TRUST, TrustTypes.FIXED_UNIT_TRUST, TrustTypes.HYBRID_TRUST, TrustTypes.LISTED_PUBLIC_UNIT_TRUST, TrustTypes.OTHER_TRUST, TrustTypes.POOLED_SUPERANNUATION_TRUST, TrustTypes.PUBLIC_TRADING_TRUST, TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST];
11754
- const countryToTrustTypes = {
11755
- [CountryCodes.Australia]: auSpecificTrustTypes,
11756
- [CountryCodes.NewZealand]: nzSpecificTrustTypes
11757
- };
11758
- const TRUST_MEMBER_COUNT_RANGE = {
11759
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11760
- min: 1
11761
- },
11762
- [TrustMemberTypes.SETTLOR]: {
11763
- min: 1
11764
- }
11765
- };
11766
- const isPartOfTrustFromLegalEntity = (legalEntity) => {
11767
- var _a;
11768
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
11769
- };
11770
- const getRootTrusteeLegalEntityId = (trustEntity) => {
11771
- var _a;
11772
- if (!trustEntity.entityAssociations)
11773
- return "";
11774
- return (_a = trustEntity.entityAssociations.filter((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)[0]) == null ? void 0 : _a.legalEntityId;
11775
- };
11776
- const getOwnTrustMembers = (trustEntity) => {
11777
- if (!trustEntity.entityAssociations)
11778
- return [];
11779
- const rootTrusteeLegalEntityId = getRootTrusteeLegalEntityId(trustEntity);
11780
- return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && rootTrusteeLegalEntityId === (entityAssociation == null ? void 0 : entityAssociation.associatorId));
11781
- };
11782
- const getOwnTrustMembersLegalEntityIds = (legalEntity) => getOwnTrustMembers(legalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11783
- const getOwnTrustLegalEntityId = (legalEntity) => {
11784
- var _a, _b;
11785
- return (_b = (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.find((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id)) == null ? void 0 : _b.legalEntityId;
11786
- };
11787
- const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
11788
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11789
- return trustLegalEntityId ? [trustLegalEntityId] : [];
11790
- };
11791
- const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
11792
- var _a;
11793
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11794
- if (trustLegalEntityId) {
11795
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
11796
- }
11797
- };
11798
- const getTrustMemberCount = (legalEntity) => {
11799
- const trustMembers2 = getOwnTrustMembers(legalEntity);
11800
- return trustMembers2.reduce((trustMemberCount, trustMember) => {
11801
- trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
11802
- return trustMemberCount;
11803
- }, {});
11804
- };
11805
- const hasMinRequiredTrustMemberCount = (legalEntity) => {
11806
- const existingTrustMemberCount = getTrustMemberCount(legalEntity);
11807
- const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
11808
- return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
11809
- };
11810
- const makeSelectItemForTrustRole = (role2, i18n) => ({
11811
- ...trustMemberRoles[role2],
11812
- name: i18n.get(trustMemberRoles[role2].name),
11813
- description: i18n.get(trustMemberRoles[role2].description)
11814
- });
11815
- const getTrustMemberName = (trustMemberType) => trustMemberRoles[trustMemberType].name;
11816
- const trustMemberRoles = {
11817
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11818
- id: TrustMemberTypes.DEFINED_BENEFICIARY,
11819
- name: "definedBeneficiary",
11820
- description: "definedBeneficiaryDescription",
11821
- className: "adl-tag--orange"
11822
- },
11823
- [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
11824
- id: TrustMemberTypes.UNDEFINED_BENEFICIARY,
11825
- name: "undefinedBeneficiary",
11826
- description: "undefinedBeneficiaryDescription",
11827
- className: "adl-tag--orange"
11828
- },
11829
- [TrustMemberTypes.PROTECTOR]: {
11830
- id: TrustMemberTypes.PROTECTOR,
11831
- name: "protector",
11832
- description: "personAppointmentUnderTrustInstrument",
11833
- className: "adl-tag--orange"
11834
- },
11835
- [TrustMemberTypes.TRUSTEE]: {
11836
- id: TrustMemberTypes.TRUSTEE,
11837
- name: "trustee",
11838
- description: "legalOwnerOfProperty",
11839
- className: "adl-tag--light-blue"
11840
- },
11841
- [TrustMemberTypes.SETTLOR]: {
11842
- id: TrustMemberTypes.SETTLOR,
11843
- name: "settlor",
11844
- description: "entityEstablishingTrust",
11845
- className: "adl-tag--orange"
11846
- }
11847
- };
11848
- const trustMemberGuidanceRoles = {
11849
- [TrustMemberGuidanceLabel.BENEFICIARY]: {
11850
- id: TrustMemberGuidanceLabel.BENEFICIARY,
11851
- name: TrustMemberGuidanceLabel.BENEFICIARY,
11852
- className: "adl-tag--orange"
11853
- },
11854
- [TrustMemberGuidanceLabel.PROTECTOR]: {
11855
- id: TrustMemberGuidanceLabel.PROTECTOR,
11856
- name: TrustMemberGuidanceLabel.PROTECTOR,
11857
- className: "adl-tag--orange"
11858
- },
11859
- [TrustMemberGuidanceLabel.TRUSTEE]: {
11860
- id: TrustMemberGuidanceLabel.TRUSTEE,
11861
- name: TrustMemberGuidanceLabel.TRUSTEE,
11862
- className: "adl-tag--light-blue"
11863
- },
11864
- [TrustMemberGuidanceLabel.SETTLOR]: {
11865
- id: TrustMemberGuidanceLabel.SETTLOR,
11866
- name: TrustMemberGuidanceLabel.SETTLOR,
11867
- className: "adl-tag--orange"
11868
- }
11869
- };
11870
- const getCountrySpecificTrustTypeOptions = (country2) => {
11871
- const countrySpecificTrustTypes = countryToTrustTypes[country2];
11872
- if (!countrySpecificTrustTypes) {
11873
- return [];
11874
- }
11875
- return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
11876
- const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
11877
- if (!countrySpecificTrustTypeOption) {
11878
- throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
11879
- }
11880
- return countrySpecificTrustTypeOption;
11881
- });
11882
- };
11883
- const entityAssociationRoles = {
11884
- ...trustMemberRoles,
11885
- ...decisionMakerRoles
11886
- };
11887
- const getEntityAssociationTagColor = (entityAssociationType) => {
11888
- var _a;
11889
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.className;
11890
- };
11891
- const getEntityAssociationName = (entityAssociationType) => {
11892
- var _a;
11893
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.name;
11894
- };
11895
- const getOwnEntityAssociations = (legalEntity) => {
11896
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
11897
- return legalEntity.entityAssociations.filter((entityAssociation) => entityAssociation.associatorId === legalEntity.id);
11898
- }
11899
- return [];
11900
- };
11901
- const getOwnSoleProprietorshipIdArray = (legalEntity) => {
11902
- const ownAssociations = getOwnEntityAssociations(legalEntity);
11903
- return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId);
11904
- };
11905
- const hasSolePropInLegalEntity = (legalEntity) => {
11906
- var _a;
11907
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === legalEntity.id);
11908
- };
11909
- const getOwnSolePropProblems = (legalEntity, capabilityProblems) => {
11910
- var _a;
11911
- const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(legalEntity)[0];
11912
- if (solePropLegalEntityId) {
11913
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
11914
- }
11915
- };
11916
- const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId);
11917
- const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
11514
+ const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => (entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId)) ?? false;
11515
+ const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
11918
11516
  const isRootLegalEntity = (legalEntity, taskType) => legalEntity.type === LegalEntityType.INDIVIDUAL && taskType === TaskTypes.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION && taskType === TaskTypes.COMPANY;
11919
11517
  const filterOutUnwantedAssociationsIfRootLE = (taskType, legalEntity, accountHolder2) => {
11920
11518
  if (!(legalEntity == null ? void 0 : legalEntity.entityAssociations)) {
@@ -11953,19 +11551,19 @@ function getNestedPropertyKeys(obj, includeUndefined = false) {
11953
11551
  });
11954
11552
  return fieldNames;
11955
11553
  }
11956
- const getTaskStatus = (type, capabilityProblems, legalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
11957
- if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(legalEntity.id) && isEmptyEntity(legalEntity))
11554
+ const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
11555
+ if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
11958
11556
  return TaskStatus.EMPTY;
11959
11557
  const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
11960
11558
  if (importantCapabilityStatus)
11961
11559
  return importantCapabilityStatus;
11962
- if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(legalEntity))
11560
+ if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
11963
11561
  return TaskStatus.PROCESSING;
11964
11562
  return TaskStatus.FINISHED;
11965
11563
  };
11966
11564
  const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
11967
11565
  function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
11968
- if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]))
11566
+ if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
11969
11567
  return;
11970
11568
  const importantStatuses = Object.entries(capabilityProblems[type]).filter(([key]) => entityIds.includes(key)).map(([, value]) => value.status).filter((status) => IMPORTANT_STATUSES.includes(status));
11971
11569
  if (!importantStatuses.length)
@@ -11993,7 +11591,10 @@ function isEmptyEntity(legalEntity) {
11993
11591
  if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
11994
11592
  return false;
11995
11593
  const minimumFields = emptyFieldsByEntityType[type];
11996
- const fieldsOnEntity = getNestedPropertyKeys(legalEntity[type]);
11594
+ const typeSpecificSection = legalEntity[type];
11595
+ if (!typeSpecificSection)
11596
+ return true;
11597
+ const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
11997
11598
  return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
11998
11599
  }
11999
11600
  const entityTypeToCorrespondingAccountHolderOption = {
@@ -14248,7 +13849,8 @@ function ContactDetailsComponent(props) {
14248
13849
  setState: null
14249
13850
  });
14250
13851
  useEffect(() => {
14251
- stateRef.current.setState({
13852
+ var _a, _b;
13853
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14252
13854
  type: "addToState",
14253
13855
  value: {
14254
13856
  data,
@@ -14306,86 +13908,86 @@ ContactDetailsComponent.defaultProps = {
14306
13908
  data: {}
14307
13909
  };
14308
13910
  const IdentityNumber$1 = "";
13911
+ const CHECKCHARACTER_ODD_VALUE = {
13912
+ 0: 1,
13913
+ 1: 0,
13914
+ 2: 5,
13915
+ 3: 7,
13916
+ 4: 9,
13917
+ 5: 13,
13918
+ 6: 15,
13919
+ 7: 17,
13920
+ 8: 19,
13921
+ 9: 21,
13922
+ A: 1,
13923
+ B: 0,
13924
+ C: 5,
13925
+ D: 7,
13926
+ E: 9,
13927
+ F: 13,
13928
+ G: 15,
13929
+ H: 17,
13930
+ I: 19,
13931
+ J: 21,
13932
+ K: 2,
13933
+ L: 4,
13934
+ M: 18,
13935
+ N: 20,
13936
+ O: 11,
13937
+ P: 3,
13938
+ Q: 6,
13939
+ R: 8,
13940
+ S: 12,
13941
+ T: 14,
13942
+ U: 16,
13943
+ V: 10,
13944
+ W: 22,
13945
+ X: 25,
13946
+ Y: 24,
13947
+ Z: 23
13948
+ };
13949
+ const CHECKCHARACTER_EVEN_VALUE = {
13950
+ 0: 0,
13951
+ 1: 1,
13952
+ 2: 2,
13953
+ 3: 3,
13954
+ 4: 4,
13955
+ 5: 5,
13956
+ 6: 6,
13957
+ 7: 7,
13958
+ 8: 8,
13959
+ 9: 9,
13960
+ A: 0,
13961
+ B: 1,
13962
+ C: 2,
13963
+ D: 3,
13964
+ E: 4,
13965
+ F: 5,
13966
+ G: 6,
13967
+ H: 7,
13968
+ I: 8,
13969
+ J: 9,
13970
+ K: 10,
13971
+ L: 11,
13972
+ M: 12,
13973
+ N: 13,
13974
+ O: 14,
13975
+ P: 15,
13976
+ Q: 16,
13977
+ R: 17,
13978
+ S: 18,
13979
+ T: 19,
13980
+ U: 20,
13981
+ V: 21,
13982
+ W: 22,
13983
+ X: 23,
13984
+ Y: 24,
13985
+ Z: 25
13986
+ };
14309
13987
  function validCheckCharacter(input, calculationInput) {
14310
13988
  if (!/^[A-Z]$/.test(input)) {
14311
13989
  return false;
14312
13990
  }
14313
- const CHECKCHARACTER_ODD_VALUE = {
14314
- 0: 1,
14315
- 9: 21,
14316
- I: 19,
14317
- R: 8,
14318
- 1: 0,
14319
- A: 1,
14320
- J: 21,
14321
- S: 12,
14322
- 2: 5,
14323
- B: 0,
14324
- K: 2,
14325
- T: 14,
14326
- 3: 7,
14327
- C: 5,
14328
- L: 4,
14329
- U: 16,
14330
- 4: 9,
14331
- D: 7,
14332
- M: 18,
14333
- V: 10,
14334
- 5: 13,
14335
- E: 9,
14336
- N: 20,
14337
- W: 22,
14338
- 6: 15,
14339
- F: 13,
14340
- O: 11,
14341
- X: 25,
14342
- 7: 17,
14343
- G: 15,
14344
- P: 3,
14345
- Y: 24,
14346
- 8: 19,
14347
- H: 17,
14348
- Q: 6,
14349
- Z: 23
14350
- };
14351
- const CHECKCHARACTER_EVEN_VALUE = {
14352
- 0: 0,
14353
- 9: 9,
14354
- I: 8,
14355
- R: 17,
14356
- 1: 1,
14357
- A: 0,
14358
- J: 9,
14359
- S: 18,
14360
- 2: 2,
14361
- B: 1,
14362
- K: 10,
14363
- T: 19,
14364
- 3: 3,
14365
- C: 2,
14366
- L: 11,
14367
- U: 20,
14368
- 4: 4,
14369
- D: 3,
14370
- M: 12,
14371
- V: 21,
14372
- 5: 5,
14373
- E: 4,
14374
- N: 13,
14375
- W: 22,
14376
- 6: 6,
14377
- F: 5,
14378
- O: 14,
14379
- X: 23,
14380
- 7: 7,
14381
- G: 6,
14382
- P: 15,
14383
- Y: 24,
14384
- 8: 8,
14385
- H: 7,
14386
- Q: 16,
14387
- Z: 25
14388
- };
14389
13991
  let total = 0;
14390
13992
  for (let i = 0; i < 15; i += 1) {
14391
13993
  const set = i % 2 === 1 ? CHECKCHARACTER_EVEN_VALUE : CHECKCHARACTER_ODD_VALUE;
@@ -14396,14 +13998,8 @@ function validCheckCharacter(input, calculationInput) {
14396
13998
  }
14397
13999
  total = (total + value) % 26;
14398
14000
  }
14399
- if (total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input) {
14400
- return true;
14401
- }
14402
- return false;
14001
+ return total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input;
14403
14002
  }
14404
- const helper = {
14405
- validCheckCharacter
14406
- };
14407
14003
  const countryIdNumberFormatters = {
14408
14004
  [CountryCodes.Brazil]: {
14409
14005
  idNumber: {
@@ -14465,7 +14061,7 @@ const countryIdNumberValidationRules = {
14465
14061
  },
14466
14062
  [CountryCodes.Italy]: {
14467
14063
  idNumber: [{
14468
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && helper.validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14064
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14469
14065
  modes: ["blur"],
14470
14066
  errorMessage: "invalidFormatIdentityNumberIT"
14471
14067
  }]
@@ -14529,7 +14125,7 @@ function IdentityNumber(props) {
14529
14125
  dataStoreId,
14530
14126
  country: country2,
14531
14127
  errors: propErrors,
14532
- data: propData,
14128
+ data: propData = {},
14533
14129
  requiredFields,
14534
14130
  fieldValidationErrors,
14535
14131
  maskedFields,
@@ -14673,32 +14269,106 @@ function IdentityNumber(props) {
14673
14269
  });
14674
14270
  }
14675
14271
  const IdentityNumberComponent = memo(IdentityNumber, (prevProps, nextProps) => prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.errors, nextProps.errors) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14676
- IdentityNumberComponent.defaultProps = {
14677
- data: {},
14678
- onChange: () => {
14679
- }
14680
- };
14681
- const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14682
- if (propagationMode === "stop")
14683
- event.stopPropagation();
14684
- if (keys.includes(event.key)) {
14685
- if (propagationMode === "stopIfMatches")
14686
- event.stopPropagation();
14687
- callback();
14688
- }
14689
- };
14690
- const styles = {
14691
- "adyen-kyc-multi-select-list": "adyen-kyc-multi-select-list",
14692
- "adyen-kyc-multi-select-list-item": "adyen-kyc-multi-select-list-item",
14693
- "adyen-kyc-multi-select-list-item--with-description": "adyen-kyc-multi-select-list-item--with-description",
14694
- "adyen-kyc-checkbox__label": "adyen-kyc-checkbox__label"
14695
- };
14696
- const MultiSelectList = ({
14697
- options,
14698
- selected,
14699
- onSelect,
14700
- mapToSelectItem
14701
- }) => jsx("ul", {
14272
+ const roleMetadata = {
14273
+ [DecisionMakerType.CONTROLLING_PERSON]: {
14274
+ name: "controllingPerson",
14275
+ description: "controllingPersonDescription",
14276
+ className: "adl-tag--teal"
14277
+ },
14278
+ [DecisionMakerType.OWNER]: {
14279
+ name: "owner",
14280
+ description: "ownerDescription",
14281
+ className: "adl-tag--purple"
14282
+ },
14283
+ [DecisionMakerType.SIGNATORY]: {
14284
+ name: "signatory",
14285
+ description: "signatoryDescription",
14286
+ className: "adl-tag--light-blue"
14287
+ },
14288
+ [DecisionMakerType.DIRECTOR]: {
14289
+ name: "director",
14290
+ description: "directorDescription",
14291
+ className: "adl-tag--orange"
14292
+ },
14293
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
14294
+ name: "definedBeneficiary",
14295
+ description: "definedBeneficiaryDescription",
14296
+ className: "adl-tag--orange"
14297
+ },
14298
+ [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
14299
+ name: "undefinedBeneficiary",
14300
+ description: "undefinedBeneficiaryDescription",
14301
+ className: "adl-tag--orange"
14302
+ },
14303
+ [TrustMemberTypes.PROTECTOR]: {
14304
+ name: "protector",
14305
+ description: "personAppointmentUnderTrustInstrument",
14306
+ className: "adl-tag--orange"
14307
+ },
14308
+ [TrustMemberTypes.TRUSTEE]: {
14309
+ name: "trustee",
14310
+ description: "legalOwnerOfProperty",
14311
+ className: "adl-tag--light-blue"
14312
+ },
14313
+ [TrustMemberTypes.SETTLOR]: {
14314
+ name: "settlor",
14315
+ description: "entityEstablishingTrust",
14316
+ className: "adl-tag--orange"
14317
+ },
14318
+ [TrustMemberGuidanceLabel.BENEFICIARY]: {
14319
+ name: TrustMemberGuidanceLabel.BENEFICIARY,
14320
+ className: "adl-tag--orange"
14321
+ },
14322
+ [TrustMemberGuidanceLabel.TRUSTEE]: {
14323
+ name: TrustMemberGuidanceLabel.TRUSTEE,
14324
+ className: "adl-tag--light-blue"
14325
+ }
14326
+ };
14327
+ const getRoleTagColor = (role2) => {
14328
+ var _a;
14329
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.className) ?? "adl-tag--blue";
14330
+ };
14331
+ const getRoleName = (role2) => {
14332
+ var _a;
14333
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.name) ?? role2;
14334
+ };
14335
+ const makeSelectItemForRole = (role2, i18n) => {
14336
+ const metadata = roleMetadata[role2];
14337
+ if (!metadata)
14338
+ throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
14339
+ const {
14340
+ name,
14341
+ description: description2,
14342
+ className
14343
+ } = metadata;
14344
+ return {
14345
+ id: role2,
14346
+ name: i18n.get(name),
14347
+ description: description2 ? i18n.get(description2) : void 0,
14348
+ className
14349
+ };
14350
+ };
14351
+ const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14352
+ if (propagationMode === "stop")
14353
+ event.stopPropagation();
14354
+ if (keys.includes(event.key)) {
14355
+ if (propagationMode === "stopIfMatches")
14356
+ event.stopPropagation();
14357
+ callback();
14358
+ }
14359
+ };
14360
+ const styles = {
14361
+ "adyen-kyc-multi-select-list": "adyen-kyc-multi-select-list",
14362
+ "adyen-kyc-multi-select-list-item": "adyen-kyc-multi-select-list-item",
14363
+ "adyen-kyc-multi-select-list-item--with-description": "adyen-kyc-multi-select-list-item--with-description",
14364
+ "adyen-kyc-checkbox__label": "adyen-kyc-checkbox__label"
14365
+ };
14366
+ const MultiSelectList = ({
14367
+ options,
14368
+ selected,
14369
+ onSelect,
14370
+ mapToSelectItem
14371
+ }) => jsx("ul", {
14702
14372
  className: styles["adyen-kyc-multi-select-list"],
14703
14373
  children: options.map((option) => {
14704
14374
  const item = mapToSelectItem(option);
@@ -14753,19 +14423,10 @@ const DecisionMakerRoleComponent = (props) => {
14753
14423
  defaultData: dataProp,
14754
14424
  fieldProblems: fieldValidationErrors
14755
14425
  });
14756
- const [decisionMakerRoles2, setDecisionMakerRoles] = useState([]);
14757
14426
  const stateRef = useRef({
14758
14427
  setState: null
14759
14428
  });
14760
14429
  const formUtils = formUtilities(props, i18n);
14761
- const allowedRolesString = allowedRoles == null ? void 0 : allowedRoles.toString();
14762
- const makeSelectItemForDecisionMakerRole = (role2) => {
14763
- const validRole = decisionMakerRoles2.find((item) => item.id === role2);
14764
- return {
14765
- ...validRole,
14766
- disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(validRole == null ? void 0 : validRole.id))
14767
- };
14768
- };
14769
14430
  const changeRoles = (roles) => {
14770
14431
  handleChangeFor("role", "input")(roles);
14771
14432
  };
@@ -14783,9 +14444,6 @@ const DecisionMakerRoleComponent = (props) => {
14783
14444
  }
14784
14445
  });
14785
14446
  }, [data, valid, errors, isValid, dataStoreId, fieldProblems]);
14786
- useEffect(() => {
14787
- setDecisionMakerRoles(getTranslatedDecisionMakerRoles(i18n, allowedRoles));
14788
- }, [allowedRoles, allowedRolesString, i18n, i18n.languageCode, i18n.locale]);
14789
14447
  return jsxs("div", {
14790
14448
  className: "adyen-kyc-field__role",
14791
14449
  children: [jsx(StateContextSetter, {
@@ -14802,7 +14460,10 @@ const DecisionMakerRoleComponent = (props) => {
14802
14460
  options: allowedRoles ?? [],
14803
14461
  selected: data.role ?? [],
14804
14462
  onSelect: changeRoles,
14805
- mapToSelectItem: makeSelectItemForDecisionMakerRole
14463
+ mapToSelectItem: (role2) => ({
14464
+ ...makeSelectItemForRole(role2, i18n),
14465
+ disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(role2))
14466
+ })
14806
14467
  })
14807
14468
  })]
14808
14469
  });
@@ -14945,7 +14606,7 @@ const personalDetailsValidationRules = {
14945
14606
  errorMessage: "fieldIsRequired"
14946
14607
  }, {
14947
14608
  modes: ["blur"],
14948
- validate: (birthDate2) => birthDate2 && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14609
+ validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14949
14610
  errorMessage: "invalidDateOfBirth"
14950
14611
  }],
14951
14612
  residencyCountry: {
@@ -16444,13 +16105,9 @@ const refreshSession = async () => {
16444
16105
  };
16445
16106
  const addAnimationStartListener = (element, listener) => {
16446
16107
  element.addEventListener("animationstart", listener, false);
16447
- element.addEventListener("MSAnimationStart", listener, false);
16448
- element.addEventListener("webkitAnimationStart", listener, false);
16449
16108
  };
16450
16109
  const removeAnimationStartListener = (element, listener) => {
16451
16110
  element.removeEventListener("animationstart", listener, false);
16452
- element.removeEventListener("MSAnimationStart", listener, false);
16453
- element.removeEventListener("webkitAnimationStart", listener, false);
16454
16111
  };
16455
16112
  const logger$e = createLogger("Fetch");
16456
16113
  const getRequestObject = (options, data) => {
@@ -16580,6 +16237,8 @@ const httpPost = async (options, data) => http({
16580
16237
  }, data);
16581
16238
  const removeElementSiblings = (element) => {
16582
16239
  const parent = element.parentNode;
16240
+ if (!parent)
16241
+ return;
16583
16242
  let child = parent.firstChild;
16584
16243
  while (child) {
16585
16244
  if (child !== element)
@@ -17258,7 +16917,8 @@ function BankAccountNumber(props) {
17258
16917
  maskedFields: props.maskedFields
17259
16918
  });
17260
16919
  useEffect(() => {
17261
- stateRef.current.setState({
16920
+ var _a, _b;
16921
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17262
16922
  type: "addToState",
17263
16923
  value: {
17264
16924
  data,
@@ -17322,7 +16982,8 @@ function BankCity(props) {
17322
16982
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17323
16983
  });
17324
16984
  useEffect(() => {
17325
- stateRef.current.setState({
16985
+ var _a, _b;
16986
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17326
16987
  type: "addToState",
17327
16988
  value: {
17328
16989
  data,
@@ -17385,7 +17046,8 @@ function BankCode(props) {
17385
17046
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17386
17047
  });
17387
17048
  useEffect(() => {
17388
- stateRef.current.setState({
17049
+ var _a, _b;
17050
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17389
17051
  type: "addToState",
17390
17052
  value: {
17391
17053
  data,
@@ -17448,7 +17110,8 @@ function BankName(props) {
17448
17110
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17449
17111
  });
17450
17112
  useEffect(() => {
17451
- stateRef.current.setState({
17113
+ var _a, _b;
17114
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17452
17115
  type: "addToState",
17453
17116
  value: {
17454
17117
  data,
@@ -17511,7 +17174,8 @@ function BranchCode(props) {
17511
17174
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17512
17175
  });
17513
17176
  useEffect(() => {
17514
- stateRef.current.setState({
17177
+ var _a, _b;
17178
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17515
17179
  type: "addToState",
17516
17180
  value: {
17517
17181
  data,
@@ -17765,7 +17429,8 @@ function SwiftCode(props) {
17765
17429
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17766
17430
  });
17767
17431
  useEffect(() => {
17768
- stateRef.current.setState({
17432
+ var _a, _b;
17433
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17769
17434
  type: "addToState",
17770
17435
  value: {
17771
17436
  data,
@@ -18841,94 +18506,415 @@ const solePropForms = {
18841
18506
  formName: "constitutionalDocument",
18842
18507
  fields: ["constitutionalDocument"]
18843
18508
  }
18844
- };
18845
- const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
18846
- const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
18847
- const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
18848
- const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
18849
- function SolePropComponent(props) {
18850
- const {
18851
- i18n
18852
- } = useI18nContext();
18853
- const {
18854
- isExperimentEnabled
18855
- } = useExperimentsContext();
18856
- const [tradingName2, setTradingName] = useState();
18857
- const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18858
- const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
18859
- const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
18860
- const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
18861
- const handleStateChange = ({
18862
- currentState
18863
- }) => {
18864
- var _a, _b, _c;
18865
- const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18866
- setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18867
- };
18868
- const renderActiveForm = (activeForm) => {
18869
- var _a;
18870
- return jsxs(Fragment, {
18871
- children: [jsx(StateContextWatcher, {
18872
- owner: "SolePropComponent",
18873
- onChange: handleStateChange
18874
- }), jsx("div", {
18875
- className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18876
- children: jsx(CompanyNameAndCountryComponent, {
18877
- ...solePropNameAndCountryFormProps,
18878
- data: {
18879
- ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18880
- country: props == null ? void 0 : props.country,
18881
- legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18882
- },
18883
- labels: {
18884
- country: "countryOfEstablishment",
18885
- legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18886
- },
18887
- heading: i18n.get("nameAndCountry"),
18888
- id: solePropNameAndCountryFormId,
18889
- disableCountry: true,
18890
- isTopLevelEntity: false
18891
- })
18892
- }), jsx("div", {
18893
- className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18894
- children: jsx(CompanyRegistrationDetailsComponent, {
18895
- ...solePropsRegistrationDetailsFormProps,
18896
- data: {
18897
- ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18898
- tradingName: tradingName2
18899
- },
18900
- heading: i18n.get("registrationDetails"),
18901
- id: solePropRegistrationDetailsFormId,
18902
- companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18903
- country: props.country
18904
- })
18905
- }), jsx("div", {
18906
- className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18907
- children: jsx(RegistrationAddressComponent, {
18908
- ...solePropRegistrationAddressFormProps,
18909
- heading: i18n.get("registeredAddress"),
18910
- id: solePropRegistrationAddressFormId,
18911
- country: props.country,
18912
- problems: props == null ? void 0 : props.problems,
18913
- handleAddressSearch: props.handleAddressSearch,
18914
- handleFindAddress: props.handleFindAddress
18915
- })
18916
- }), jsx("div", {
18917
- className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18918
- children: jsx(ConstitutionalDocumentUpload, {
18919
- ...solePropDocumentsFormProps,
18920
- id: solePropDocumentFormId,
18921
- legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18922
- })
18923
- })]
18924
- });
18925
- };
18926
- return jsx("div", {
18927
- className: "adyen-kyc-sol-prop",
18928
- children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18509
+ };
18510
+ const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
18511
+ const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
18512
+ const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
18513
+ const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
18514
+ function SolePropComponent(props) {
18515
+ const {
18516
+ i18n
18517
+ } = useI18nContext();
18518
+ const {
18519
+ isExperimentEnabled
18520
+ } = useExperimentsContext();
18521
+ const [tradingName2, setTradingName] = useState();
18522
+ const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18523
+ const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
18524
+ const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
18525
+ const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
18526
+ const handleStateChange = ({
18527
+ currentState
18528
+ }) => {
18529
+ var _a, _b, _c;
18530
+ const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18531
+ setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18532
+ };
18533
+ const renderActiveForm = (activeForm) => {
18534
+ var _a;
18535
+ return jsxs(Fragment, {
18536
+ children: [jsx(StateContextWatcher, {
18537
+ owner: "SolePropComponent",
18538
+ onChange: handleStateChange
18539
+ }), jsx("div", {
18540
+ className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18541
+ children: jsx(CompanyNameAndCountryComponent, {
18542
+ ...solePropNameAndCountryFormProps,
18543
+ data: {
18544
+ ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18545
+ country: props == null ? void 0 : props.country,
18546
+ legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18547
+ },
18548
+ labels: {
18549
+ country: "countryOfEstablishment",
18550
+ legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18551
+ },
18552
+ heading: i18n.get("nameAndCountry"),
18553
+ id: solePropNameAndCountryFormId,
18554
+ disableCountry: true,
18555
+ isTopLevelEntity: false
18556
+ })
18557
+ }), jsx("div", {
18558
+ className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18559
+ children: jsx(CompanyRegistrationDetailsComponent, {
18560
+ ...solePropsRegistrationDetailsFormProps,
18561
+ data: {
18562
+ ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18563
+ tradingName: tradingName2
18564
+ },
18565
+ heading: i18n.get("registrationDetails"),
18566
+ id: solePropRegistrationDetailsFormId,
18567
+ companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18568
+ country: props.country
18569
+ })
18570
+ }), jsx("div", {
18571
+ className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18572
+ children: jsx(RegistrationAddressComponent, {
18573
+ ...solePropRegistrationAddressFormProps,
18574
+ heading: i18n.get("registeredAddress"),
18575
+ id: solePropRegistrationAddressFormId,
18576
+ country: props.country,
18577
+ problems: props == null ? void 0 : props.problems,
18578
+ handleAddressSearch: props.handleAddressSearch,
18579
+ handleFindAddress: props.handleFindAddress
18580
+ })
18581
+ }), jsx("div", {
18582
+ className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18583
+ children: jsx(ConstitutionalDocumentUpload, {
18584
+ ...solePropDocumentsFormProps,
18585
+ id: solePropDocumentFormId,
18586
+ legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18587
+ })
18588
+ })]
18589
+ });
18590
+ };
18591
+ return jsx("div", {
18592
+ className: "adyen-kyc-sol-prop",
18593
+ children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18594
+ });
18595
+ }
18596
+ const Trust = "";
18597
+ var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18598
+ TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
18599
+ TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
18600
+ TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
18601
+ TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
18602
+ TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
18603
+ TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
18604
+ TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
18605
+ TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
18606
+ TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
18607
+ TrustTypes2["FAMILY_TRUST"] = "familyTrust";
18608
+ TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
18609
+ TrustTypes2["FIXED_TRUST"] = "fixedTrust";
18610
+ TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
18611
+ TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
18612
+ TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
18613
+ TrustTypes2["OTHER_TRUST"] = "otherTrust";
18614
+ TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
18615
+ TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
18616
+ TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
18617
+ return TrustTypes2;
18618
+ })(TrustTypes || {});
18619
+ const trustTypeOptions = [{
18620
+ id: TrustTypes.BUSINESS_TRUST,
18621
+ name: "businessTrust"
18622
+ }, {
18623
+ id: TrustTypes.CASH_MANAGEMENT_TRUST,
18624
+ name: "cashManagementTrust"
18625
+ }, {
18626
+ id: TrustTypes.CHARITABLE_TRUST,
18627
+ name: "charitableTrust"
18628
+ }, {
18629
+ id: TrustTypes.CORPORATE_UNIT_TRUST,
18630
+ name: "corporateUnitTrust"
18631
+ }, {
18632
+ id: TrustTypes.DECEASED_ESTATE,
18633
+ name: "deceasedEstate"
18634
+ }, {
18635
+ id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
18636
+ name: "discretionaryInvestmentTrust"
18637
+ }, {
18638
+ id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
18639
+ name: "discretionaryServicesManagementTrust"
18640
+ }, {
18641
+ id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
18642
+ name: "discretionaryTradingTrust"
18643
+ }, {
18644
+ id: TrustTypes.DISCRETIONARY_TRUST,
18645
+ name: "discretionaryTrust"
18646
+ }, {
18647
+ id: TrustTypes.FAMILY_TRUST,
18648
+ name: "familyTrust"
18649
+ }, {
18650
+ id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
18651
+ name: "firstHomeSaverAccountsTrust"
18652
+ }, {
18653
+ id: TrustTypes.FIXED_TRUST,
18654
+ name: "fixedTrust"
18655
+ }, {
18656
+ id: TrustTypes.FIXED_UNIT_TRUST,
18657
+ name: "fixedUnitTrust"
18658
+ }, {
18659
+ id: TrustTypes.HYBRID_TRUST,
18660
+ name: "hybridTrust"
18661
+ }, {
18662
+ id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
18663
+ name: "listedPublicUnitTrust"
18664
+ }, {
18665
+ id: TrustTypes.OTHER_TRUST,
18666
+ name: "otherTrust"
18667
+ }, {
18668
+ id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
18669
+ name: "pooledSuperannuationTrust"
18670
+ }, {
18671
+ id: TrustTypes.PUBLIC_TRADING_TRUST,
18672
+ name: "publicTradingTrust"
18673
+ }, {
18674
+ id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
18675
+ name: "unlistedPublicUnitTrust"
18676
+ }];
18677
+ const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
18678
+ const auSpecificTrustTypes = [TrustTypes.CASH_MANAGEMENT_TRUST, TrustTypes.CORPORATE_UNIT_TRUST, TrustTypes.DECEASED_ESTATE, TrustTypes.DISCRETIONARY_INVESTMENT_TRUST, TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST, TrustTypes.DISCRETIONARY_TRADING_TRUST, TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST, TrustTypes.FIXED_TRUST, TrustTypes.FIXED_UNIT_TRUST, TrustTypes.HYBRID_TRUST, TrustTypes.LISTED_PUBLIC_UNIT_TRUST, TrustTypes.OTHER_TRUST, TrustTypes.POOLED_SUPERANNUATION_TRUST, TrustTypes.PUBLIC_TRADING_TRUST, TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST];
18679
+ const countryToTrustTypes = {
18680
+ [CountryCodes.Australia]: auSpecificTrustTypes,
18681
+ [CountryCodes.NewZealand]: nzSpecificTrustTypes
18682
+ };
18683
+ const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
18684
+ roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
18685
+ min: 1,
18686
+ max: Infinity
18687
+ }, {
18688
+ roleTypes: [DecisionMakerType.OWNER],
18689
+ min: 0,
18690
+ max: 4
18691
+ }, {
18692
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18693
+ min: 0,
18694
+ max: Infinity
18695
+ }, {
18696
+ roleTypes: [DecisionMakerType.SIGNATORY],
18697
+ min: 1,
18698
+ max: Infinity
18699
+ }];
18700
+ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
18701
+ US: [{
18702
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18703
+ min: 1,
18704
+ max: Infinity
18705
+ }, {
18706
+ roleTypes: [DecisionMakerType.OWNER],
18707
+ min: 0,
18708
+ max: 4
18709
+ }, {
18710
+ roleTypes: [DecisionMakerType.SIGNATORY],
18711
+ min: 1,
18712
+ max: Infinity
18713
+ }],
18714
+ BR: [{
18715
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18716
+ min: 1,
18717
+ max: Infinity
18718
+ }, {
18719
+ roleTypes: [DecisionMakerType.OWNER],
18720
+ min: 0,
18721
+ max: 4
18722
+ }, {
18723
+ roleTypes: [DecisionMakerType.SIGNATORY],
18724
+ min: 1,
18725
+ max: Infinity
18726
+ }],
18727
+ AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18728
+ roleTypes: [DecisionMakerType.DIRECTOR],
18729
+ min: 3,
18730
+ max: Infinity
18731
+ }],
18732
+ CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18733
+ roleTypes: [DecisionMakerType.DIRECTOR],
18734
+ min: 1,
18735
+ max: Infinity
18736
+ }],
18737
+ HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18738
+ roleTypes: [DecisionMakerType.DIRECTOR],
18739
+ min: 1,
18740
+ max: Infinity
18741
+ }],
18742
+ IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18743
+ roleTypes: [DecisionMakerType.DIRECTOR],
18744
+ min: 3,
18745
+ max: 15
18746
+ }],
18747
+ NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18748
+ roleTypes: [DecisionMakerType.DIRECTOR],
18749
+ min: 1,
18750
+ max: Infinity
18751
+ }],
18752
+ SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18753
+ roleTypes: [DecisionMakerType.DIRECTOR],
18754
+ min: 1,
18755
+ max: Infinity
18756
+ }]
18757
+ };
18758
+ const getDecisionMakerRequirements = (country2) => {
18759
+ if (!country2)
18760
+ return DEFAULT_DECISION_MAKER_REQUIREMENTS;
18761
+ return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
18762
+ };
18763
+ function getAvailableDecisionMakerRoleTypes(country2) {
18764
+ const requirements2 = getDecisionMakerRequirements(country2);
18765
+ return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
18766
+ roleType: req.roleTypes[0],
18767
+ min: req.min,
18768
+ max: req.max
18769
+ }));
18770
+ }
18771
+ const DEFAULT_DESCRIPTIONS_MAP = {
18772
+ [DecisionMakerType.OWNER]: "provideAllOwners",
18773
+ [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
18774
+ [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
18775
+ [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
18776
+ };
18777
+ const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
18778
+ US: {
18779
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
18780
+ },
18781
+ BR: {
18782
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
18783
+ }
18784
+ };
18785
+ const getDecisionMakerDescriptionMap = (country2) => ({
18786
+ ...DEFAULT_DESCRIPTIONS_MAP,
18787
+ ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
18788
+ });
18789
+ const getOwnDecisionMakers = (rootLegalEntity) => {
18790
+ if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
18791
+ return [];
18792
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
18793
+ };
18794
+ const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
18795
+ const getOwnSignatories = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
18796
+ const getOwnDecisionMakersLegalEntityIds = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
18797
+ const getDecisionMakerCount = (rootLegalEntity) => {
18798
+ const decisionMakers2 = getOwnDecisionMakers(rootLegalEntity);
18799
+ return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
18800
+ decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
18801
+ return decisionMakerCount;
18802
+ }, {});
18803
+ };
18804
+ const getAllowedDecisionMakerRoles = (rootLegalEntity, taskType) => {
18805
+ var _a, _b;
18806
+ if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
18807
+ return [DecisionMakerType.OWNER];
18808
+ }
18809
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
18810
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
18811
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
18812
+ const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
18813
+ const {
18814
+ roleTypes,
18815
+ max
18816
+ } = requirements2;
18817
+ if (roleTypes.length === 1) {
18818
+ const role2 = roleTypes[0];
18819
+ const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
18820
+ if (isBelowMaxRange) {
18821
+ acc.push(role2);
18822
+ }
18823
+ }
18824
+ return acc;
18825
+ }, []);
18826
+ const uniqueAllowedRoles = [...new Set(allowedRoles)];
18827
+ return uniqueAllowedRoles;
18828
+ };
18829
+ const hasMinRequiredDecisionMakerCount = (rootLegalEntity) => {
18830
+ var _a, _b;
18831
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
18832
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
18833
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
18834
+ return decisionMakerCountRange.every((requirements2) => {
18835
+ const {
18836
+ roleTypes,
18837
+ min
18838
+ } = requirements2;
18839
+ return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
18840
+ });
18841
+ };
18842
+ const TRUST_MEMBER_COUNT_RANGE = {
18843
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
18844
+ min: 1
18845
+ },
18846
+ [TrustMemberTypes.SETTLOR]: {
18847
+ min: 1
18848
+ }
18849
+ };
18850
+ const isPartOfTrustFromLegalEntity = (legalEntity) => {
18851
+ var _a;
18852
+ return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
18853
+ };
18854
+ const getTrustLegalEntityId = (rootLegalEntity) => {
18855
+ var _a;
18856
+ if (!rootLegalEntity.entityAssociations)
18857
+ return void 0;
18858
+ return (_a = rootLegalEntity.entityAssociations.find((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)) == null ? void 0 : _a.legalEntityId;
18859
+ };
18860
+ const getOwnTrustMembers = (rootLegalEntity) => {
18861
+ const trustLegalEntityId = getTrustLegalEntityId(rootLegalEntity);
18862
+ if (!trustLegalEntityId || !rootLegalEntity.entityAssociations)
18863
+ return [];
18864
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && trustLegalEntityId === entityAssociation.associatorId);
18865
+ };
18866
+ const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
18867
+ const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
18868
+ if (!trustLegalEntityId)
18869
+ return [];
18870
+ const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
18871
+ const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
18872
+ return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
18873
+ };
18874
+ const getTrustMemberCompanyDecisionMakerIds = (rootLegalEntity, trustMemberCompanyId) => {
18875
+ const decisionMakerAssociations = getDecisionMakers(rootLegalEntity, trustMemberCompanyId);
18876
+ return decisionMakerAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
18877
+ };
18878
+ const getOwnTrustLegalEntityId = (legalEntity) => {
18879
+ var _a, _b;
18880
+ return (_b = (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.find((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id)) == null ? void 0 : _b.legalEntityId;
18881
+ };
18882
+ const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
18883
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
18884
+ return trustLegalEntityId ? [trustLegalEntityId] : [];
18885
+ };
18886
+ const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
18887
+ var _a;
18888
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
18889
+ if (trustLegalEntityId) {
18890
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
18891
+ }
18892
+ };
18893
+ const getTrustMemberCount = (rootLegalEntity) => {
18894
+ const trustMembers2 = getOwnTrustMembers(rootLegalEntity);
18895
+ return trustMembers2.reduce((trustMemberCount, trustMember) => {
18896
+ trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
18897
+ return trustMemberCount;
18898
+ }, {});
18899
+ };
18900
+ const hasMinRequiredTrustMemberCount = (rootLegalEntity) => {
18901
+ const existingTrustMemberCount = getTrustMemberCount(rootLegalEntity);
18902
+ const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
18903
+ return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
18904
+ };
18905
+ const getCountrySpecificTrustTypeOptions = (country2) => {
18906
+ const countrySpecificTrustTypes = countryToTrustTypes[country2];
18907
+ if (!countrySpecificTrustTypes) {
18908
+ return [];
18909
+ }
18910
+ return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
18911
+ const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
18912
+ if (!countrySpecificTrustTypeOption) {
18913
+ throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
18914
+ }
18915
+ return countrySpecificTrustTypeOption;
18929
18916
  });
18930
- }
18931
- const Trust = "";
18917
+ };
18932
18918
  const ContextHelper$1 = "";
18933
18919
  const ContextHelper = ({
18934
18920
  content
@@ -19194,7 +19180,7 @@ function TrustComponent(props) {
19194
19180
  children: renderActiveForm(props.activeForm || trustForms.trustRegistrationDetails)
19195
19181
  });
19196
19182
  }
19197
- const remediationActionMappings = {
19183
+ const invalidInputRemediationActionMappings = {
19198
19184
  "1_100": [],
19199
19185
  "1_101": [],
19200
19186
  "1_102": [{
@@ -19331,6 +19317,7 @@ const remediationActionMappings = {
19331
19317
  }]
19332
19318
  };
19333
19319
  const dataMissingRemediationsToFieldsMap = {
19320
+ "1_501": [DocumentType.REGISTRATION_DOCUMENT],
19334
19321
  "2_158": ["vatNumber", "exemptedFromVat", "vatAbsenceReason"]
19335
19322
  };
19336
19323
  const DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING = {
@@ -19437,7 +19424,7 @@ function setInvalidInputError(parentVerificationError, entityProblems) {
19437
19424
  remediatingActions
19438
19425
  }) => {
19439
19426
  const mappedRemActions = remediatingActions == null ? void 0 : remediatingActions.reduce((acc2, remediatingAction) => {
19440
- const remMapping = remediationActionMappings[remediatingAction.code];
19427
+ const remMapping = invalidInputRemediationActionMappings[remediatingAction.code];
19441
19428
  if (remMapping) {
19442
19429
  const {
19443
19430
  entityType: entityType2
@@ -20346,7 +20333,7 @@ const nationality = {
20346
20333
  }
20347
20334
  };
20348
20335
  const fieldsPerScenario$1 = {
20349
- L0: drop(["address", "birthDate"]).from(identityBase),
20336
+ L0: drop("address", "birthDate").from(identityBase),
20350
20337
  L1: identityBase,
20351
20338
  L1_ID: {
20352
20339
  ...identityBase,
@@ -20509,6 +20496,12 @@ const countryConfig = {
20509
20496
  registrationNumber: {
20510
20497
  label: "NZBN"
20511
20498
  }
20499
+ },
20500
+ [CountryCodes.Croatia]: {
20501
+ ...countryConfig$4[CountryCodes.Croatia],
20502
+ registrationNumber: {
20503
+ label: "MBO"
20504
+ }
20512
20505
  }
20513
20506
  };
20514
20507
  function parseIndividualScenarios(scenario, country2) {
@@ -21178,6 +21171,7 @@ function CompanyDropinComponent({
21178
21171
  isSettingEnabled
21179
21172
  } = useSettingsContext();
21180
21173
  const {
21174
+ accountHolder: accountHolder2,
21181
21175
  setAccountHolder
21182
21176
  } = useCoreContext();
21183
21177
  const {
@@ -21239,10 +21233,12 @@ function CompanyDropinComponent({
21239
21233
  });
21240
21234
  onChange == null ? void 0 : onChange(currentState);
21241
21235
  }, [currentState]);
21236
+ const isSkippingCompanyStructure = useEnableNewEntryFlow() && accountHolder2 === "partnershipIncorporated";
21242
21237
  const forms = useMemo(() => {
21243
21238
  const requiredForms = getRequiredForms(companyForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
21244
- return addValidityToForms(requiredForms, formValidity, problems);
21245
- }, [derivedProps, formValidity, problems]);
21239
+ const validityAddedForms = addValidityToForms(requiredForms, formValidity, problems);
21240
+ return isSkippingCompanyStructure ? validityAddedForms.filter((f) => f.formName !== "companyStructure") : validityAddedForms;
21241
+ }, [derivedProps, formValidity, problems, isSkippingCompanyStructure]);
21246
21242
  const submitDocuments = async ({
21247
21243
  forms: forms2,
21248
21244
  legalEntity,
@@ -21647,6 +21643,8 @@ const useExemptSettlor = ({
21647
21643
  setExemptSettlor(exemptSettlorLE);
21648
21644
  }, [handleGetLegalEntity]);
21649
21645
  useEffect(() => {
21646
+ if (!trust2)
21647
+ return;
21650
21648
  updateExemptSettlor(trust2).catch(logger$8.error);
21651
21649
  }, [trust2, updateExemptSettlor]);
21652
21650
  return exemptSettlor;
@@ -21687,7 +21685,7 @@ const base64ToBlob = (base64, mimeType = "application/octet-stream") => {
21687
21685
  });
21688
21686
  };
21689
21687
  const saveBlobAsFile = (fileData, filename) => {
21690
- if (typeof window.navigator.msSaveBlob !== "undefined") {
21688
+ if ("msSaveBlob" in window.navigator && typeof window.navigator.msSaveBlob === "function") {
21691
21689
  window.navigator.msSaveBlob(fileData, filename);
21692
21690
  } else {
21693
21691
  const blobUrl = window.URL.createObjectURL(fileData);
@@ -22138,6 +22136,53 @@ function Toast({
22138
22136
  })]
22139
22137
  });
22140
22138
  }
22139
+ const getBusinessType = (businessTypeItems, accountHolder2, legalEntityType, companyTypesValue) => {
22140
+ const legalArrangementSuboptions = ["partnershipIncorporated"];
22141
+ const findBusinessType = (id2) => businessTypes.find((bt) => bt.id === id2);
22142
+ if (legalArrangementSuboptions.includes(companyTypesValue ?? "")) {
22143
+ return findBusinessType("legalArrangement");
22144
+ }
22145
+ if (accountHolder2) {
22146
+ if (["aTrust", "partnershipUnincorporated", "anAssociation"].includes(accountHolder2)) {
22147
+ return findBusinessType("legalArrangement");
22148
+ }
22149
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22150
+ }
22151
+ switch (legalEntityType) {
22152
+ case LegalEntityType.ORGANIZATION:
22153
+ return findBusinessType("company");
22154
+ case LegalEntityType.INDIVIDUAL:
22155
+ return findBusinessType("individual");
22156
+ }
22157
+ };
22158
+ const mapLegalArrangementOptionToCompanyTypesValue = (legalArrangement) => {
22159
+ switch (legalArrangement) {
22160
+ case "partnershipIncorporated":
22161
+ return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
22162
+ default:
22163
+ return "";
22164
+ }
22165
+ };
22166
+ const mapCompanyTypesValueToLegalArrangementOption = (companyTypesValue) => {
22167
+ switch (companyTypesValue) {
22168
+ case CompanyTypesValue.INCORPORATED_PARTNERSHIP:
22169
+ return "partnershipIncorporated";
22170
+ default:
22171
+ return void 0;
22172
+ }
22173
+ };
22174
+ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22175
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22176
+ return LegalEntityType.ORGANIZATION;
22177
+ }
22178
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22179
+ return LegalEntityType.INDIVIDUAL;
22180
+ }
22181
+ if (legalArrangement === "partnershipIncorporated") {
22182
+ return LegalEntityType.ORGANIZATION;
22183
+ }
22184
+ return currentLegalEntityType;
22185
+ };
22141
22186
  const businessTypes = [{
22142
22187
  id: "individual",
22143
22188
  accountHolder: "myName",
@@ -22164,18 +22209,18 @@ const legalArrangementItems = [{
22164
22209
  name: "trust",
22165
22210
  description: "youAreTrusteeManagingTheTrustForBeneficiaries"
22166
22211
  }, {
22167
- id: "incorporatedPartnership",
22168
- accountHolder: "incorporatedPartnership",
22212
+ id: "partnershipIncorporated",
22213
+ accountHolder: "theCompanyIWorkFor",
22169
22214
  name: "incorporatedPartnership",
22170
- description: "incorporatedPartnershipNewEntryFlowDescription"
22215
+ description: "partnershipIncorporatedNewEntryFlowDescription"
22171
22216
  }, {
22172
- id: "unincorporatedPartnership",
22173
- accountHolder: "unincorporatedPartnership",
22217
+ id: "partnershipUnincorporated",
22218
+ accountHolder: "theCompanyIWorkFor",
22174
22219
  name: "unincorporatedPartnership",
22175
- description: "unincorporatedPartnershipNewEntryFlowDescription"
22220
+ description: "partnershipUnincorporatedNewEntryFlowDescription"
22176
22221
  }, {
22177
- id: "anAssociation",
22178
- accountHolder: "anAssociation",
22222
+ id: "associationIncorporated",
22223
+ accountHolder: "associationIncorporated",
22179
22224
  name: "associationIncorporatedTitle",
22180
22225
  description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
22181
22226
  }];
@@ -22237,20 +22282,6 @@ const businessTypeSelectionStepTitles = {
22237
22282
  /* CONFIRM_BUSINESS_SETUP_CHANGE */
22238
22283
  ]: "changeYourBusinessSetup"
22239
22284
  };
22240
- const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22241
- const isIndividual = currentLegalEntityType === LegalEntityType.INDIVIDUAL;
22242
- const isOrganization = currentLegalEntityType === LegalEntityType.ORGANIZATION;
22243
- if (isIndividual && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22244
- return LegalEntityType.ORGANIZATION;
22245
- }
22246
- if (isOrganization && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22247
- return LegalEntityType.INDIVIDUAL;
22248
- }
22249
- if (legalArrangement === "incorporatedPartnership") {
22250
- return LegalEntityType.ORGANIZATION;
22251
- }
22252
- return currentLegalEntityType;
22253
- };
22254
22285
  const BusinessTypeSelection = ({
22255
22286
  legalEntityResponse,
22256
22287
  accountHolder: accountHolder2,
@@ -22259,7 +22290,7 @@ const BusinessTypeSelection = ({
22259
22290
  onAccountHolderSelect,
22260
22291
  handleUpdateLegalEntity
22261
22292
  }) => {
22262
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
22293
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
22263
22294
  const {
22264
22295
  i18n
22265
22296
  } = useI18nContext();
@@ -22278,21 +22309,11 @@ const BusinessTypeSelection = ({
22278
22309
  /* WE_CANNOT_SET_UP_ACCOUNT */
22279
22310
  ].includes(currentStep);
22280
22311
  const businessTypeItems = getBusinessTypes(showTrustOption, showSolePropOption);
22281
- const getDefaultBusinessType = () => {
22282
- if (accountHolder2) {
22283
- if (["aTrust", "incorporatedPartnership", "unincorporatedPartnership", "anAssociation"].includes(accountHolder2)) {
22284
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "legalArrangement");
22285
- }
22286
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22287
- }
22288
- switch (legalEntityResponse.type) {
22289
- case LegalEntityType.ORGANIZATION:
22290
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "company");
22291
- case LegalEntityType.INDIVIDUAL:
22292
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "individual");
22293
- }
22294
- };
22295
- const getDefaultLegalArrangementType = () => accountHolder2 && legalArrangementItems.find((item) => item.accountHolder === accountHolder2);
22312
+ const currentLegalEntityType = legalEntityResponse == null ? void 0 : legalEntityResponse.type;
22313
+ const currentCompanyTypesValue = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
22314
+ const defaultBusinessType = getBusinessType(businessTypeItems, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
22315
+ const getDefaultLegalArrangementType = () => legalArrangementItems.find((item) => item.id === mapCompanyTypesValueToLegalArrangementOption(currentCompanyTypesValue));
22316
+ const defaultLegalArrangementType = getDefaultLegalArrangementType();
22296
22317
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
22297
22318
  const {
22298
22319
  handleChangeFor,
@@ -22304,20 +22325,23 @@ const BusinessTypeSelection = ({
22304
22325
  } = useForm({
22305
22326
  schema: formSchema,
22306
22327
  defaultData: {
22307
- businessType: getDefaultBusinessType(),
22308
- legalArrangement: getDefaultLegalArrangementType(),
22328
+ businessType: defaultBusinessType,
22329
+ legalArrangement: defaultLegalArrangementType,
22309
22330
  trusteeType: defaultTrusteeType
22310
22331
  },
22311
22332
  rules: businessTypeSelectionValidationRules
22312
22333
  });
22313
- const newAccountHolder = ((_a = data.businessType) == null ? void 0 : _a.accountHolder) || ((_b = data.legalArrangement) == null ? void 0 : _b.accountHolder);
22314
- const targetLegalEntityType = getTargetLegalEntityType((_c = data.businessType) == null ? void 0 : _c.id, (_d = data.legalArrangement) == null ? void 0 : _d.id, (_e = data.trusteeType) == null ? void 0 : _e.id, legalEntityResponse == null ? void 0 : legalEntityResponse.type);
22334
+ const newAccountHolder = ((_c = data.businessType) == null ? void 0 : _c.accountHolder) || ((_d = data.legalArrangement) == null ? void 0 : _d.accountHolder);
22335
+ const targetLegalArrangement = (_e = data.legalArrangement) == null ? void 0 : _e.id;
22336
+ const targetLegalEntityType = getTargetLegalEntityType((_f = data.businessType) == null ? void 0 : _f.id, (_g = data.legalArrangement) == null ? void 0 : _g.id, (_h = data.trusteeType) == null ? void 0 : _h.id, legalEntityResponse == null ? void 0 : legalEntityResponse.type);
22337
+ const isLegalEntityTypeChanging = currentLegalEntityType !== targetLegalEntityType;
22338
+ const isLegalArrangementChanging = currentCompanyTypesValue !== targetLegalArrangement;
22315
22339
  useEffect(() => {
22316
22340
  var _a2, _b2;
22317
22341
  setFormSchema(getFormSchema(((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement" && !!data.legalArrangement || currentStep === 1, ((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aTrust"));
22318
22342
  }, [data.businessType, data.legalArrangement, currentStep]);
22319
22343
  const handleNextClick = async () => {
22320
- var _a2, _b2;
22344
+ var _a2;
22321
22345
  if (loadingStatus === "loading")
22322
22346
  return;
22323
22347
  triggerValidation();
@@ -22330,8 +22354,7 @@ const BusinessTypeSelection = ({
22330
22354
  );
22331
22355
  return;
22332
22356
  }
22333
- const legalArrangementId = (_b2 = data.legalArrangement) == null ? void 0 : _b2.id;
22334
- if (legalArrangementId === "anAssociation" || legalArrangementId === "unincorporatedPartnership") {
22357
+ if (targetLegalArrangement === "associationIncorporated" || targetLegalArrangement === "partnershipUnincorporated") {
22335
22358
  setCurrentStep(
22336
22359
  2
22337
22360
  /* WE_CANNOT_SET_UP_ACCOUNT */
@@ -22339,49 +22362,46 @@ const BusinessTypeSelection = ({
22339
22362
  return;
22340
22363
  }
22341
22364
  }
22342
- }
22343
- if (newAccountHolder !== accountHolder2 || targetLegalEntityType !== legalEntityResponse.type) {
22344
- if (accountHolder2) {
22345
- setCurrentStep(
22346
- 3
22347
- /* CONFIRM_BUSINESS_SETUP_CHANGE */
22348
- );
22365
+ if (newAccountHolder !== accountHolder2 || isLegalEntityTypeChanging) {
22366
+ if (accountHolder2) {
22367
+ setCurrentStep(
22368
+ 3
22369
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22370
+ );
22371
+ return;
22372
+ }
22373
+ await updateLegalEntityAndSelectAccountHolder();
22349
22374
  } else {
22375
+ onAccountHolderSelect(newAccountHolder);
22376
+ }
22377
+ if (isLegalArrangementChanging) {
22350
22378
  await updateLegalEntityAndSelectAccountHolder();
22351
22379
  }
22352
- } else {
22353
- onAccountHolderSelect(newAccountHolder);
22354
22380
  }
22355
22381
  };
22356
22382
  const updateLegalEntityAndSelectAccountHolder = async () => {
22357
- var _a2;
22358
- const selectedLegalArrangement = (_a2 = data.legalArrangement) == null ? void 0 : _a2.id;
22359
22383
  try {
22360
- if (legalEntityResponse.type !== targetLegalEntityType) {
22384
+ if (isLegalEntityTypeChanging) {
22361
22385
  setLoadingStatus("loading");
22362
22386
  const updateLegalEntityPayload = {
22363
22387
  type: targetLegalEntityType
22364
22388
  };
22365
22389
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22366
- if (selectedLegalArrangement === "incorporatedPartnership") {
22367
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22368
- type: LegalEntityType.ORGANIZATION
22369
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22390
+ if (targetLegalEntityType === LegalEntityType.ORGANIZATION && targetLegalEntityType) {
22370
22391
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22371
22392
  organization: {
22372
- type: CompanyTypesValue.INCORPORATED_PARTNERSHIP
22373
- }
22374
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22375
- }
22376
- } else if (newAccountHolder !== accountHolder2) {
22377
- if (newAccountHolder === "theCompanyIWorkFor") {
22378
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22379
- organization: {
22380
- type: ""
22393
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22381
22394
  }
22382
22395
  }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22383
22396
  }
22384
22397
  }
22398
+ if (isLegalArrangementChanging) {
22399
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22400
+ organization: {
22401
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22402
+ }
22403
+ }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22404
+ }
22385
22405
  } catch (e) {
22386
22406
  showToast({
22387
22407
  label: i18n.get("failedToUpdateDetails"),
@@ -22413,15 +22433,19 @@ const BusinessTypeSelection = ({
22413
22433
  showSpinner: false,
22414
22434
  children: jsxs("div", {
22415
22435
  className: "adyen-kyc-business-type-selection",
22416
- children: [jsx("header", {
22417
- children: jsx(Heading, {
22436
+ children: [jsxs("header", {
22437
+ className: "adl-u-margin-bottom-32",
22438
+ children: [jsx(Heading, {
22418
22439
  level: 1,
22419
22440
  children: i18n.get(businessTypeSelectionStepTitles[currentStep])
22420
- })
22441
+ }), currentStep === 3 && jsx(Heading, {
22442
+ level: "sub",
22443
+ children: i18n.get("someInformationWillNotBeSaved")
22444
+ })]
22421
22445
  }), currentStep === 0 && jsx(Field, {
22422
22446
  name: "businessType",
22423
22447
  useLabelElement: false,
22424
- errorMessage: i18n.get((_f = errors.businessType) == null ? void 0 : _f.errorMessage),
22448
+ errorMessage: i18n.get((_i = errors.businessType) == null ? void 0 : _i.errorMessage),
22425
22449
  showErrorIconBottom: true,
22426
22450
  isValid: valid.businessType,
22427
22451
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22438,7 +22462,7 @@ const BusinessTypeSelection = ({
22438
22462
  children: [jsx(Field, {
22439
22463
  name: "legalArrangement",
22440
22464
  useLabelElement: false,
22441
- errorMessage: i18n.get((_g = errors.legalArrangement) == null ? void 0 : _g.errorMessage),
22465
+ errorMessage: i18n.get((_j = errors.legalArrangement) == null ? void 0 : _j.errorMessage),
22442
22466
  showErrorIconBottom: true,
22443
22467
  isValid: valid.legalArrangement,
22444
22468
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22451,18 +22475,17 @@ const BusinessTypeSelection = ({
22451
22475
  }),
22452
22476
  onSelect: (item) => handleChangeFor("legalArrangement")(item)
22453
22477
  })
22454
- }), ((_h = data.legalArrangement) == null ? void 0 : _h.id) === "aTrust" && jsx(Field, {
22478
+ }), ((_k = data.legalArrangement) == null ? void 0 : _k.id) === "aTrust" && jsx(Field, {
22455
22479
  name: "trusteeType",
22456
22480
  label: i18n.get("whatTypeOfTrusteeAreYou"),
22457
22481
  className: "adl-u-margin-top-32",
22458
22482
  useLabelElement: false,
22459
- errorMessage: i18n.get((_i = errors.trusteeType) == null ? void 0 : _i.errorMessage),
22483
+ errorMessage: i18n.get((_l = errors.trusteeType) == null ? void 0 : _l.errorMessage),
22460
22484
  showErrorIconBottom: true,
22461
22485
  isValid: valid.trusteeType,
22462
22486
  children: (childProps) => jsx(RadioGroupCard, {
22463
- className: "adyen-kyc-trustee-type-radio-group-card",
22464
- itemLabelClassName: () => "adl-u-width-full",
22465
22487
  ...childProps,
22488
+ className: "adyen-kyc-trustee-type-radio-group-card",
22466
22489
  name: "trusteeType",
22467
22490
  items: trusteeTypeItems,
22468
22491
  selected: trusteeTypeItems.find((type) => {
@@ -22479,24 +22502,20 @@ const BusinessTypeSelection = ({
22479
22502
  className: "u-margin-top-32",
22480
22503
  children: i18n.get("needHelpYouCanAlwaysReachOutToCustomerSupport")
22481
22504
  })]
22482
- }), currentStep === 3 ? jsxs(Fragment, {
22483
- children: [jsx("p", {
22484
- children: i18n.get("someInformationWillNotBeSaved")
22485
- }), jsxs("div", {
22486
- className: "adyen-kyc-business-type-selection__confirm",
22487
- children: [jsx(Button, {
22488
- label: i18n.get("cancel"),
22489
- secondary: true,
22490
- onClick: () => setCurrentStep(
22491
- 0
22492
- /* BUSINESS_TYPE_SELECTION */
22493
- ),
22494
- type: "button"
22495
- }), jsx(Button, {
22496
- label: i18n.get("yesChange"),
22497
- onClick: () => updateLegalEntityAndSelectAccountHolder(),
22498
- type: "button"
22499
- })]
22505
+ }), currentStep === 3 ? jsxs("div", {
22506
+ className: "adyen-kyc-business-type-selection__confirm",
22507
+ children: [jsx(Button, {
22508
+ label: i18n.get("cancel"),
22509
+ secondary: true,
22510
+ onClick: () => setCurrentStep(
22511
+ 0
22512
+ /* BUSINESS_TYPE_SELECTION */
22513
+ ),
22514
+ type: "button"
22515
+ }), jsx(Button, {
22516
+ label: i18n.get("yesChange"),
22517
+ onClick: () => updateLegalEntityAndSelectAccountHolder(),
22518
+ type: "button"
22500
22519
  })]
22501
22520
  }) : jsxs("div", {
22502
22521
  className: "adyen-kyc-business-type-selection__nav",
@@ -22561,18 +22580,6 @@ const iconStatus = (current, min, max) => {
22561
22580
  }
22562
22581
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22563
22582
  };
22564
- const entityStatusRoles = {
22565
- ...decisionMakerRoles,
22566
- ...trustMemberGuidanceRoles
22567
- };
22568
- const getEntityStatusTagColor = (entityLabel) => {
22569
- var _a;
22570
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22571
- };
22572
- const getEntityStatusName = (entityLabel) => {
22573
- var _a;
22574
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22575
- };
22576
22583
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22577
22584
  const _cardGroup_component = "";
22578
22585
  function CardGroup({
@@ -22981,9 +22988,9 @@ const EntityAssociation = ({
22981
22988
  })]
22982
22989
  }), jsx("div", {
22983
22990
  children: types.map((type) => jsx(Tag, {
22984
- className: `adl-entity-association__tag ${getEntityAssociationTagColor(type)}`,
22991
+ className: `adl-entity-association__tag ${getRoleTagColor(type)}`,
22985
22992
  isBasic: true,
22986
- children: i18n.get(getEntityAssociationName(type))
22993
+ children: i18n.get(getRoleName(type))
22987
22994
  }, type))
22988
22995
  }), status === TaskStatus.ERROR && jsx(VerificationErrorAlert, {
22989
22996
  className: "adl-entity-association-alert",
@@ -23071,9 +23078,9 @@ const EntityGuidanceStatus = ({
23071
23078
  children: [jsx(EntityStatusIcon, {
23072
23079
  status
23073
23080
  }), jsx(Tag, {
23074
- className: `adl-entity-status__tag ${getEntityStatusTagColor(entityLabel)}`,
23081
+ className: `adl-entity-status__tag ${getRoleTagColor(entityLabel)}`,
23075
23082
  isBasic: true,
23076
- children: i18n.get(getEntityStatusName(entityLabel))
23083
+ children: i18n.get(getRoleName(entityLabel))
23077
23084
  }, entityLabel), jsx("span", {
23078
23085
  className: "adl-entity-status--text",
23079
23086
  "data-testid": `${entityLabel}-rule--description`,
@@ -23465,7 +23472,7 @@ function LegalEntityTypeSwitcher({
23465
23472
  const {
23466
23473
  i18n
23467
23474
  } = useI18nContext();
23468
- const [loadingStatus, setLoadingStatus] = useState(null);
23475
+ const [loadingStatus, setLoadingStatus] = useState();
23469
23476
  const {
23470
23477
  showToast
23471
23478
  } = useToastContext();
@@ -23516,7 +23523,7 @@ function LegalEntityTypeSwitcher({
23516
23523
  })]
23517
23524
  });
23518
23525
  default:
23519
- jsx("p", {
23526
+ return jsx("p", {
23520
23527
  children: "Change not supported"
23521
23528
  });
23522
23529
  }
@@ -23617,26 +23624,29 @@ const businessTypeMapping = {
23617
23624
  /* COMPANY_TRUSTEE */
23618
23625
  }
23619
23626
  };
23627
+ const companyTypesMapping = {
23628
+ [CompanyTypesValue.INCORPORATED_PARTNERSHIP]: "incorporatedPartnership",
23629
+ [CompanyTypesValue.PUBLIC_COMPANY]: "company",
23630
+ [CompanyTypesValue.PRIVATE_COMPANY]: "company",
23631
+ [CompanyTypesValue.UNLISTED_PUBLIC_COMPANY]: "company",
23632
+ [CompanyTypesValue.INCORPORATED_ASSOCIATION]: "company",
23633
+ [CompanyTypesValue.GOVERNMENTAL_ORGANIZATION]: "company",
23634
+ [CompanyTypesValue.NON_PROFIT_OR_CHARITABLE]: "company",
23635
+ [CompanyTypesValue.SOLE_PROPRIETORSHIP]: "soleProprietorship"
23636
+ /* SOLE_PROPRIETORSHIP */
23637
+ };
23620
23638
  const useBusinessSetup = (legalEntityResponse) => {
23621
- var _a;
23639
+ var _a, _b;
23622
23640
  const {
23623
23641
  accountHolder: accountHolder2
23624
23642
  } = useCoreContext();
23625
23643
  const accountHolderType = accountHolder2 || getDefaultAccountHolderType(legalEntityResponse);
23626
- const businessSetup = (_a = businessTypeMapping[accountHolderType]) == null ? void 0 : _a[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23644
+ const organizationType = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
23645
+ const businessSetup = accountHolderType === "theCompanyIWorkFor" && organizationType ? companyTypesMapping[organizationType] : (_b = businessTypeMapping[accountHolderType]) == null ? void 0 : _b[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23627
23646
  return {
23628
- businessSetup: businessSetup || accountHolder2
23647
+ businessSetup
23629
23648
  };
23630
23649
  };
23631
- const useEnableNewEntryFlow = () => {
23632
- const {
23633
- isSettingEnabled
23634
- } = useSettingsContext();
23635
- const {
23636
- isExperimentEnabled
23637
- } = useExperimentsContext();
23638
- return isSettingEnabled(SettingNames.AllowLegalEntityTypeChange) && isExperimentEnabled("EnableNewEntryFlow");
23639
- };
23640
23650
  const hasPayoutAccount = (legalEntityResponse) => {
23641
23651
  var _a;
23642
23652
  return Boolean((_a = legalEntityResponse.transferInstruments) == null ? void 0 : _a.length);
@@ -24552,11 +24562,12 @@ function IndividualDropinComponent({
24552
24562
  };
24553
24563
  const attachAssociationToParentLegalEntity = async ({
24554
24564
  legalEntity,
24565
+ parentLE,
24555
24566
  dataSubmitted
24556
24567
  }) => {
24557
24568
  var _a2;
24558
24569
  const newRoles = taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? (_a2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _a2.role : taskType === TaskTypes.TRUST_MEMBER_INDIVIDUAL ? trustMember == null ? void 0 : trustMember.roles : null;
24559
- const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
24570
+ const existingEntityAssociations = getOwnEntityAssociations(parentLE);
24560
24571
  if (newRoles && hasRolesChanged(legalEntity, existingEntityAssociations, newRoles)) {
24561
24572
  const updatedParentLegalEntity = {
24562
24573
  entityAssociations: [...newRoles.map((role2) => {
@@ -24568,7 +24579,7 @@ function IndividualDropinComponent({
24568
24579
  };
24569
24580
  }) || [], ...existingEntityAssociations.filter((ea) => ea.legalEntityId !== legalEntity.id) || []]
24570
24581
  };
24571
- await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
24582
+ await handleUpdateLegalEntity(updatedParentLegalEntity, parentLE.id);
24572
24583
  }
24573
24584
  };
24574
24585
  const onSubmit = async () => {
@@ -24601,10 +24612,13 @@ function IndividualDropinComponent({
24601
24612
  legalEntity: createdLegalEntity,
24602
24613
  dataSubmitted
24603
24614
  });
24604
- await attachAssociationToParentLegalEntity({
24605
- legalEntity: createdLegalEntity,
24606
- dataSubmitted
24607
- });
24615
+ if (parentLegalEntity) {
24616
+ await attachAssociationToParentLegalEntity({
24617
+ legalEntity: createdLegalEntity,
24618
+ parentLE: parentLegalEntity,
24619
+ dataSubmitted
24620
+ });
24621
+ }
24608
24622
  if (taskType === TaskTypes.INDIVIDUAL) {
24609
24623
  setAccountHolder((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.accountHolder);
24610
24624
  }
@@ -25355,7 +25369,7 @@ function InternalReference({
25355
25369
  const label = displayText ? displayText.content : referencedLabel;
25356
25370
  const scrollIntoView = () => {
25357
25371
  const scrollParent = getScrollParent(document.getElementById(referencedLabel));
25358
- const element = scrollParent !== -1 && scrollParent.querySelector(`#${referencedLabel}`);
25372
+ const element = scrollParent == null ? void 0 : scrollParent.querySelector(`#${referencedLabel}`);
25359
25373
  element == null ? void 0 : element.scrollIntoView({
25360
25374
  behavior: "smooth"
25361
25375
  });
@@ -25486,78 +25500,82 @@ const Weblink = ({
25486
25500
  ...displayText
25487
25501
  }) : url
25488
25502
  });
25503
+ const components = {
25504
+ chapter: Chapter,
25505
+ section: Section,
25506
+ paragraph: Paragraph,
25507
+ text: Text,
25508
+ weblink: Weblink,
25509
+ list: ListElement,
25510
+ table: Table,
25511
+ internalReference: InternalReference,
25512
+ breakline: "br"
25513
+ };
25514
+ const getKey = (type) => `key-${type}-${getUniqueId()}`;
25515
+ const getProps = (element, isTopLevel) => {
25516
+ if (!("type" in element))
25517
+ return null;
25518
+ switch (element.type) {
25519
+ case ElementTypes.Chapter:
25520
+ return {
25521
+ title: element.title,
25522
+ contentElements: element.contentElements
25523
+ };
25524
+ case ElementTypes.Section:
25525
+ return {
25526
+ isTopLevel,
25527
+ title: element.title,
25528
+ label: element.label,
25529
+ contentElements: element.contentElements
25530
+ };
25531
+ case ElementTypes.Paragraph:
25532
+ return {
25533
+ isTopLevel,
25534
+ contentElements: element.contentElements
25535
+ };
25536
+ case ElementTypes.Text:
25537
+ return {
25538
+ content: element.content,
25539
+ styles: element.styles
25540
+ };
25541
+ case ElementTypes.Weblink:
25542
+ return {
25543
+ url: element.url,
25544
+ displayText: element.displayText
25545
+ };
25546
+ case ElementTypes.List:
25547
+ return {
25548
+ items: element.items,
25549
+ style: element.style
25550
+ };
25551
+ case ElementTypes.Table:
25552
+ return {
25553
+ rows: element.rows,
25554
+ label: element.label,
25555
+ captions: element.captions,
25556
+ titlePrefix: element.titlePrefix,
25557
+ title: element.title
25558
+ };
25559
+ case ElementTypes.InternalReference:
25560
+ return {
25561
+ referencedLabel: element.referencedLabel,
25562
+ displayText: element.displayText
25563
+ };
25564
+ default:
25565
+ return null;
25566
+ }
25567
+ };
25489
25568
  function ContentElements({
25490
25569
  contentElements,
25491
25570
  isTopLevel = false,
25492
25571
  onExpandSection
25493
25572
  }) {
25494
- const components = {
25495
- chapter: Chapter,
25496
- section: Section,
25497
- paragraph: Paragraph,
25498
- text: Text,
25499
- weblink: Weblink,
25500
- list: ListElement,
25501
- table: Table,
25502
- internalReference: InternalReference,
25503
- breakline: "br"
25504
- };
25505
- const getKey = (type) => `key-${type}-${getUniqueId()}`;
25506
- const getProps = (element) => {
25507
- switch (element.type) {
25508
- case ElementTypes.Chapter:
25509
- return {
25510
- title: element.title,
25511
- contentElements: element.contentElements
25512
- };
25513
- case ElementTypes.Section:
25514
- return {
25515
- isTopLevel,
25516
- title: element.title,
25517
- label: element.label,
25518
- contentElements: element.contentElements
25519
- };
25520
- case ElementTypes.Paragraph:
25521
- return {
25522
- isTopLevel,
25523
- contentElements: element.contentElements
25524
- };
25525
- case ElementTypes.Text:
25526
- return {
25527
- content: element.content,
25528
- styles: element.styles
25529
- };
25530
- case ElementTypes.Weblink:
25531
- return {
25532
- url: element.url,
25533
- displayText: element.displayText
25534
- };
25535
- case ElementTypes.List:
25536
- return {
25537
- items: element.items,
25538
- style: element.style
25539
- };
25540
- case ElementTypes.Table:
25541
- return {
25542
- rows: element.rows,
25543
- label: element.label,
25544
- captions: element.captions,
25545
- titlePrefix: element.titlePrefix,
25546
- title: element.title
25547
- };
25548
- case ElementTypes.InternalReference:
25549
- return {
25550
- referencedLabel: element.referencedLabel,
25551
- displayText: element.displayText
25552
- };
25553
- default:
25554
- return null;
25555
- }
25556
- };
25557
25573
  const elements = contentElements.map((contentElement) => {
25574
+ if (!("type" in contentElement))
25575
+ return null;
25558
25576
  const Component = components[contentElement.type];
25559
25577
  return jsx(Component, {
25560
- ...getProps(contentElement)
25578
+ ...getProps(contentElement, isTopLevel)
25561
25579
  }, getKey(contentElement.type));
25562
25580
  });
25563
25581
  return isTopLevel ? jsx(Accordion, {
@@ -25592,7 +25610,7 @@ function ContractViewer({
25592
25610
  const pciValidationRules = {
25593
25611
  signer: {
25594
25612
  modes: ["blur"],
25595
- validate: (signer2) => !!signer2,
25613
+ validate: (signer2) => !isEmpty(signer2),
25596
25614
  errorMessage: "fieldIsRequired"
25597
25615
  },
25598
25616
  acceptPci: {
@@ -25607,7 +25625,7 @@ function PciDropinComponent({
25607
25625
  pciTemplateResponse,
25608
25626
  handleHomeClick,
25609
25627
  handleSign,
25610
- taskType,
25628
+ taskType = TaskTypes.PCI_DSS,
25611
25629
  eventEmitter,
25612
25630
  trackingConfig
25613
25631
  }) {
@@ -25624,7 +25642,7 @@ function PciDropinComponent({
25624
25642
  legalEntity: legalEntityResponse,
25625
25643
  task: taskType
25626
25644
  });
25627
- const [loadingStatus, setLoadingStatus] = useState(null);
25645
+ const [loadingStatus, setLoadingStatus] = useState();
25628
25646
  const {
25629
25647
  handleChangeFor,
25630
25648
  triggerValidation,
@@ -25641,15 +25659,15 @@ function PciDropinComponent({
25641
25659
  } = pciTemplateResponse;
25642
25660
  const pciQuestionnaire = JSON.parse(decodeURIComponent(escape(window.atob(pciTemplateResponse.content))));
25643
25661
  const uniqueEntityAssociations = [...new Map(getOwnDecisionMakers(legalEntityResponse).map((entityAssociation) => [entityAssociation.legalEntityId, entityAssociation])).values()];
25644
- const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.map(({
25662
+ const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.filter((ea) => Boolean(ea.legalEntityId && ea.name)).map(({
25645
25663
  legalEntityId: id2,
25646
25664
  name
25647
25665
  }) => ({
25648
25666
  id: id2,
25649
25667
  name
25650
25668
  })) : [{
25651
- id: legalEntityResponse == null ? void 0 : legalEntityResponse.id,
25652
- name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
25669
+ id: legalEntityResponse.id,
25670
+ name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
25653
25671
  }];
25654
25672
  const handleSignClick = async () => {
25655
25673
  if (loadingStatus === "loading")
@@ -25767,7 +25785,7 @@ function PciDropinComponent({
25767
25785
  children: (childProps) => jsx(Checkbox, {
25768
25786
  ...childProps,
25769
25787
  label: acceptPciLabel,
25770
- checked: data.acceptPci,
25788
+ checked: data.acceptPci ?? false,
25771
25789
  name: "acceptPci",
25772
25790
  onChange: handleChangeFor("acceptPci")
25773
25791
  })
@@ -26111,7 +26129,7 @@ const TrustRoleAndEntityType = (props) => {
26111
26129
  selected: data.role ?? [],
26112
26130
  onSelect: changeRoles,
26113
26131
  mapToSelectItem: (role2) => ({
26114
- ...makeSelectItemForTrustRole(role2, i18n),
26132
+ ...makeSelectItemForRole(role2, i18n),
26115
26133
  disabled: !availableRoles.includes(role2)
26116
26134
  })
26117
26135
  })
@@ -26190,7 +26208,7 @@ const TrustRoleAndEntityType = (props) => {
26190
26208
  labels: formUtils.getFieldLabels(COUNTRY_FIELD),
26191
26209
  readonly: false,
26192
26210
  classNameModifiers: COUNTRY_FIELD,
26193
- allowedCountries: [],
26211
+ allowedCountries: void 0,
26194
26212
  handleChangeFor
26195
26213
  }), jsx(LegalCompanyNameField, {
26196
26214
  data: formUtils.getFieldData(data, LEGAL_COMPANY_NAME_FIELD),
@@ -26339,7 +26357,7 @@ function RoleAndTypeDropinComponent({
26339
26357
  });
26340
26358
  const [activeForm, setActiveForm] = useState(regularForms.roleAndEntityType);
26341
26359
  const isSummaryStep = activeForm.formId === summaryStep.formId;
26342
- const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getTrustMemberName(role2))).join(", ");
26360
+ const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getRoleName(role2))).join(", ");
26343
26361
  const formatSettlorExemptionReasonsForSummary = (reasons) => reasons.map((reason) => i18n.get(reason)).join(", ");
26344
26362
  const summaryData = trustMember === "incomplete" ? {} : {
26345
26363
  roleAndEntityType: {
@@ -26513,7 +26531,8 @@ const serviceAgreementTypesTranslationMapping = {
26513
26531
  adyenCapital: "capitalUserTerms",
26514
26532
  adyenAccount: "businessAccountTerms",
26515
26533
  adyenCard: "cardUserTerms",
26516
- adyenFranchisee: "franchiseesTAndCs"
26534
+ adyenFranchisee: "franchiseesTAndCs",
26535
+ adyenPccr: "pccr"
26517
26536
  };
26518
26537
  function ServiceAgreementDropinComponent({
26519
26538
  legalEntityResponse,
@@ -26741,7 +26760,7 @@ function ServiceAgreementDropinComponent({
26741
26760
  });
26742
26761
  }
26743
26762
  function removeObjectPropsWithEmptyValues(obj) {
26744
- Object.keys(obj).forEach((key) => {
26763
+ keysOf(obj).forEach((key) => {
26745
26764
  if (obj[key] === null || isEmpty(obj[key]))
26746
26765
  delete obj[key];
26747
26766
  });
@@ -27892,7 +27911,7 @@ function DropinComposerComponent({
27892
27911
  return TaskTypes.TASKS_OVERVIEW;
27893
27912
  }, [showBusinessTypeSelection, showIntroduction]);
27894
27913
  const [taskHistory, setTaskHistory] = useState([initialTask]);
27895
- const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
27914
+ const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
27896
27915
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
27897
27916
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
27898
27917
  const [legalEntityType, setLegalEntityType] = useState(null);
@@ -27910,9 +27929,9 @@ function DropinComposerComponent({
27910
27929
  const [transferInstrument, setTransferInstrument] = useState(null);
27911
27930
  const [capabilityProblems, setCapabilityProblems] = useState(getCapabilityProblems(legalEntityResponse));
27912
27931
  const [bankVerificationVendors, setBankVerificationVendors] = useState();
27913
- const rootLegalEntityCountry = legalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = legalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = legalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
27932
+ const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = rootLegalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = rootLegalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
27914
27933
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
27915
- const reviewRequired = (legalEntity == null ? void 0 : legalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[legalEntity.id]) == null ? void 0 : _d.isReviewRequired);
27934
+ const reviewRequired = (rootLegalEntity == null ? void 0 : rootLegalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[rootLegalEntity.id]) == null ? void 0 : _d.isReviewRequired);
27916
27935
  const additionalSalesChannels = useSalesChannelsSettings();
27917
27936
  const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
27918
27937
  const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
@@ -27925,12 +27944,12 @@ function DropinComposerComponent({
27925
27944
  };
27926
27945
  const getPciStatus = async () => {
27927
27946
  var _a2, _b2;
27928
- if (legalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
27947
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
27929
27948
  try {
27930
- const response = await args.handleGetPciStatus(legalEntity.id, {
27949
+ const response = await args.handleGetPciStatus(rootLegalEntity.id, {
27931
27950
  additionalSalesChannels
27932
27951
  });
27933
- response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
27952
+ response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
27934
27953
  setPciStatus(response);
27935
27954
  return response;
27936
27955
  } catch (e) {
@@ -27941,7 +27960,7 @@ function DropinComposerComponent({
27941
27960
  };
27942
27961
  const getPciTemplate = useCallback(async () => {
27943
27962
  const requestPciTemplate = async (language) => {
27944
- const response = await args.handleGetPciTemplate(legalEntity.id, {
27963
+ const response = await args.handleGetPciTemplate(rootLegalEntity.id, {
27945
27964
  language,
27946
27965
  additionalSalesChannels
27947
27966
  });
@@ -27959,16 +27978,16 @@ function DropinComposerComponent({
27959
27978
  await requestPciTemplate(fallbackLanguageCode);
27960
27979
  }
27961
27980
  }
27962
- }, [additionalSalesChannels, i18n, legalEntity.id, args.handleGetPciTemplate]);
27981
+ }, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
27963
27982
  useEffect(() => {
27964
27983
  if (!tasks.includes(TaskTypes.PCI_DSS))
27965
27984
  return;
27966
27985
  getPciTemplate().catch(logger$6.error);
27967
27986
  }, [getPciTemplate, tasks]);
27968
27987
  const getServiceAgreementAcceptanceInfos = async () => {
27969
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
27988
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
27970
27989
  try {
27971
- const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
27990
+ const response = await args.handleGetServiceAgreementAcceptanceInfos(rootLegalEntity.id);
27972
27991
  setServiceAgreementAcceptanceInfos(response.data);
27973
27992
  } catch (e) {
27974
27993
  logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -27976,9 +27995,9 @@ function DropinComposerComponent({
27976
27995
  }
27977
27996
  };
27978
27997
  const getServiceAgreementStatus = async () => {
27979
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
27998
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
27980
27999
  try {
27981
- const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
28000
+ const response = await args.handleGetServiceAgreementStatus(rootLegalEntity.id);
27982
28001
  setServiceAgreementTypes(response.termsOfServiceTypes);
27983
28002
  } catch (e) {
27984
28003
  logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -27986,7 +28005,7 @@ function DropinComposerComponent({
27986
28005
  }
27987
28006
  };
27988
28007
  const getSolePropietor = async () => {
27989
- const id2 = getOwnSoleProprietorshipIdArray(legalEntity)[0];
28008
+ const id2 = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
27990
28009
  if (id2) {
27991
28010
  try {
27992
28011
  const response = await (args == null ? void 0 : args.handleGetLegalEntity(id2));
@@ -28013,10 +28032,10 @@ function DropinComposerComponent({
28013
28032
  }
28014
28033
  };
28015
28034
  const refreshLegalEntity = async () => {
28016
- if (legalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28035
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28017
28036
  try {
28018
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(legalEntity.id));
28019
- setLegalEntity(response);
28037
+ const response = await (args == null ? void 0 : args.handleGetLegalEntity(rootLegalEntity.id));
28038
+ setRootLegalEntity(response);
28020
28039
  setCapabilityProblems(getCapabilityProblems(response));
28021
28040
  return response;
28022
28041
  } catch (e) {
@@ -28172,11 +28191,11 @@ function DropinComposerComponent({
28172
28191
  onNavigate(task);
28173
28192
  };
28174
28193
  const onNavigateToDecisionMakerIndividual = async (task, id2, parentId) => {
28175
- if (parentId && parentId !== legalEntity.id) {
28194
+ if (parentId && parentId !== rootLegalEntity.id) {
28176
28195
  const parentLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(parentId));
28177
28196
  setAssociatedLegalEntityParent(parentLegalEntity);
28178
28197
  } else {
28179
- setAssociatedLegalEntityParent(legalEntity);
28198
+ setAssociatedLegalEntityParent(rootLegalEntity);
28180
28199
  }
28181
28200
  if (id2 && (args == null ? void 0 : args.handleGetLegalEntity)) {
28182
28201
  try {
@@ -28198,7 +28217,7 @@ function DropinComposerComponent({
28198
28217
  if (id2) {
28199
28218
  try {
28200
28219
  await getTransferInstrument2(id2);
28201
- if (hasSolePropInLegalEntity(legalEntity) && !solePropietor) {
28220
+ if (hasSolePropInLegalEntity(rootLegalEntity) && !solePropietor) {
28202
28221
  await getSolePropietor();
28203
28222
  }
28204
28223
  } finally {
@@ -28229,7 +28248,7 @@ function DropinComposerComponent({
28229
28248
  };
28230
28249
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
28231
28250
  var _a2, _b2;
28232
- const trustId = (_b2 = (_a2 = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a2.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
28251
+ const trustId = (_b2 = (_a2 = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a2.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
28233
28252
  if (trustId) {
28234
28253
  try {
28235
28254
  const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
@@ -28337,13 +28356,13 @@ function DropinComposerComponent({
28337
28356
  trackingConfig: {
28338
28357
  topLevelLegalEntity: legalEntityResponse
28339
28358
  },
28340
- legalEntity,
28359
+ legalEntity: rootLegalEntity,
28341
28360
  task: TaskTypes.PCI_DSS
28342
28361
  });
28343
28362
  try {
28344
- const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id));
28363
+ const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
28345
28364
  await Promise.all(response.data.map(async (pciQuestionnaireInfo) => {
28346
- const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(legalEntity.id, pciQuestionnaireInfo.id));
28365
+ const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(rootLegalEntity.id, pciQuestionnaireInfo.id));
28347
28366
  await downloadFile(pciQuestionnaire.content, `${pciQuestionnaire.id}.pdf`);
28348
28367
  }));
28349
28368
  } catch (e) {
@@ -28368,7 +28387,7 @@ function DropinComposerComponent({
28368
28387
  const data = await getConfiguration2({
28369
28388
  country: contextCountry,
28370
28389
  capabilities,
28371
- legalEntityType: legalEntity.type
28390
+ legalEntityType: rootLegalEntity.type
28372
28391
  });
28373
28392
  if (data == null ? void 0 : data.bankVerificationProviders) {
28374
28393
  setBankVerificationVendors(data.bankVerificationProviders);
@@ -28387,21 +28406,21 @@ function DropinComposerComponent({
28387
28406
  setIsLoadingConfiguration(false);
28388
28407
  onLoad();
28389
28408
  });
28390
- }, [legalEntity.type, contextCountry]);
28409
+ }, [rootLegalEntity.type, contextCountry]);
28391
28410
  useEffect(() => {
28392
- if (hasRejectedCapabilities(legalEntity)) {
28411
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28393
28412
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28394
28413
  }
28395
- }, [legalEntity]);
28414
+ }, [rootLegalEntity]);
28396
28415
  useEffect(() => {
28397
28416
  if (PAGES_WITH_STATUS.includes(taskHistory[taskHistory.length - 1])) {
28398
28417
  if (!pollingId) {
28399
28418
  const pollingInterval = setInterval(async () => {
28400
- if (hasRejectedCapabilities(legalEntity)) {
28419
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28401
28420
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28402
28421
  clearInterval(pollingId);
28403
28422
  setPollingId(null);
28404
- } else if (hasResolvedCapabilities(legalEntity)) {
28423
+ } else if (hasResolvedCapabilities(rootLegalEntity)) {
28405
28424
  clearInterval(pollingId);
28406
28425
  setPollingId(null);
28407
28426
  } else {
@@ -28426,7 +28445,7 @@ function DropinComposerComponent({
28426
28445
  case TaskTypes.BUSINESS_TYPE_SELECTION:
28427
28446
  return jsx(BusinessTypeSelection, {
28428
28447
  ...args,
28429
- legalEntityResponse: legalEntity,
28448
+ legalEntityResponse: rootLegalEntity,
28430
28449
  accountHolder: accountHolder2,
28431
28450
  showTrustOption: isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(rootLegalEntityCountry),
28432
28451
  showSolePropOption: SOLE_PROP_COUNTRIES.includes(rootLegalEntityCountry),
@@ -28438,7 +28457,7 @@ function DropinComposerComponent({
28438
28457
  });
28439
28458
  case TaskTypes.INTRODUCTION:
28440
28459
  return jsx(Introduction, {
28441
- legalEntity,
28460
+ legalEntity: rootLegalEntity,
28442
28461
  onExitIntroduction: () => {
28443
28462
  setHasSeenIntroduction(true);
28444
28463
  onNavigateTo(TaskTypes.TASKS_OVERVIEW);
@@ -28451,7 +28470,7 @@ function DropinComposerComponent({
28451
28470
  return jsx(TaskListComponent, {
28452
28471
  onNavigateToTask: navigateTo,
28453
28472
  tasks,
28454
- legalEntityResponse: legalEntity,
28473
+ legalEntityResponse: rootLegalEntity,
28455
28474
  capabilityProblems,
28456
28475
  onPciDownload,
28457
28476
  pciStatus,
@@ -28467,7 +28486,7 @@ function DropinComposerComponent({
28467
28486
  topLevelLegalEntity: legalEntityResponse
28468
28487
  },
28469
28488
  parentLegalEntity: associatedLegalEntityParent,
28470
- legalEntityResponse: legalEntity,
28489
+ legalEntityResponse: rootLegalEntity,
28471
28490
  onNavigateToIndividual: (legalEntityId) => onNavigateToDecisionMakerIndividual(TaskTypes.DECISION_MAKER, legalEntityId),
28472
28491
  handleUpdateLegalEntity: args == null ? void 0 : args.handleUpdateLegalEntity,
28473
28492
  navigateBackToTaskList: navigateBack,
@@ -28483,8 +28502,8 @@ function DropinComposerComponent({
28483
28502
  taskType: TaskTypes.INDIVIDUAL,
28484
28503
  taskName: hasTrust ? "individualTrusteeDetails" : "individualDetails",
28485
28504
  parentLegalEntity: null,
28486
- legalEntityResponse: legalEntity,
28487
- problems: getLegalEntityProblems(legalEntity),
28505
+ legalEntityResponse: rootLegalEntity,
28506
+ problems: getLegalEntityProblems(rootLegalEntity),
28488
28507
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28489
28508
  onChange: componentOnChange,
28490
28509
  eventEmitter,
@@ -28504,7 +28523,7 @@ function DropinComposerComponent({
28504
28523
  });
28505
28524
  case TaskTypes.REVIEW:
28506
28525
  return jsx(ReviewComponent, {
28507
- legalEntityId: legalEntity.id,
28526
+ legalEntityId: rootLegalEntity.id,
28508
28527
  handleReviewConfirm: args.handleReviewConfirm,
28509
28528
  handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW)
28510
28529
  });
@@ -28581,9 +28600,9 @@ function DropinComposerComponent({
28581
28600
  },
28582
28601
  taskType: TaskTypes.COMPANY,
28583
28602
  taskName: hasTrust ? "companyTrusteeDetails" : "companyDetails",
28584
- legalEntityResponse: legalEntity,
28603
+ legalEntityResponse: rootLegalEntity,
28585
28604
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28586
- problems: getLegalEntityProblems(legalEntity),
28605
+ problems: getLegalEntityProblems(rootLegalEntity),
28587
28606
  onChange: componentOnChange,
28588
28607
  eventEmitter,
28589
28608
  onSubmit: async (data) => {
@@ -28609,7 +28628,7 @@ function DropinComposerComponent({
28609
28628
  parentLegalEntity: trust2,
28610
28629
  legalEntityResponse: associatedLegalEntity,
28611
28630
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28612
- problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[legalEntity.id],
28631
+ problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[rootLegalEntity.id],
28613
28632
  onChange: componentOnChange,
28614
28633
  eventEmitter,
28615
28634
  onSubmit: (data) => refreshTrustAndRunOnSubmit(data, 2),
@@ -28632,9 +28651,9 @@ function DropinComposerComponent({
28632
28651
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _f[transferInstrument == null ? void 0 : transferInstrument.id],
28633
28652
  transferInstrument,
28634
28653
  setTransferInstrument,
28635
- legalEntityResponse: legalEntity,
28654
+ legalEntityResponse: rootLegalEntity,
28636
28655
  refreshLegalEntity,
28637
- accountHolder: getPayoutAccountHolderName(legalEntity, i18n),
28656
+ accountHolder: getPayoutAccountHolderName(rootLegalEntity, i18n),
28638
28657
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28639
28658
  onChange: componentOnChange,
28640
28659
  eventEmitter,
@@ -28652,7 +28671,7 @@ function DropinComposerComponent({
28652
28671
  },
28653
28672
  taskType: TaskTypes.TRUST,
28654
28673
  problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust2 == null ? void 0 : trust2.id],
28655
- parentLegalEntity: legalEntity,
28674
+ parentLegalEntity: rootLegalEntity,
28656
28675
  legalEntityResponse: trust2,
28657
28676
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28658
28677
  onChange: componentOnChange,
@@ -28666,8 +28685,8 @@ function DropinComposerComponent({
28666
28685
  });
28667
28686
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
28668
28687
  return jsx(TrustMembersOverview, {
28669
- trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, legalEntity, exemptSettlor) : getTrustMembers(trust2, legalEntity, exemptSettlor),
28670
- getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
28688
+ trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, rootLegalEntity, exemptSettlor) : getTrustMembers(trust2, rootLegalEntity, exemptSettlor),
28689
+ getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, rootLegalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId, ...getDirectEntityAssociations(rootLegalEntity, member.legalEntityId).map((association2) => association2.legalEntityId)]),
28671
28690
  navigateBackToTaskList: navigateBack,
28672
28691
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
28673
28692
  navigateToEditTrustMemberOwner: (trustMemberOwnerId, trustMemberId) => onNavigateToDecisionMakerIndividual(TaskTypes.TRUST_MEMBER_COMPANY_OWNER, trustMemberOwnerId, trustMemberId),
@@ -28687,7 +28706,7 @@ function DropinComposerComponent({
28687
28706
  });
28688
28707
  case TaskTypes.PCI_DSS:
28689
28708
  return jsx(PciDropinComponent, {
28690
- legalEntityResponse: legalEntity,
28709
+ legalEntityResponse: rootLegalEntity,
28691
28710
  pciTemplateResponse,
28692
28711
  trackingConfig: {
28693
28712
  topLevelLegalEntity: legalEntityResponse
@@ -28704,7 +28723,7 @@ function DropinComposerComponent({
28704
28723
  return jsx(SolePropDropinComponent, {
28705
28724
  ...args,
28706
28725
  taskType: TaskTypes.SOLE_PROPRIETOR_COMPANY,
28707
- parentLegalEntity: legalEntity,
28726
+ parentLegalEntity: rootLegalEntity,
28708
28727
  legalEntityResponse: solePropietor,
28709
28728
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28710
28729
  problems: (_j = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _j[solePropietor == null ? void 0 : solePropietor.id],
@@ -28713,13 +28732,13 @@ function DropinComposerComponent({
28713
28732
  onSubmit: componentOnSubmit,
28714
28733
  handleHomeClick: navigateBack,
28715
28734
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
28716
- country: (_l = (_k = legalEntity == null ? void 0 : legalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
28735
+ country: (_l = (_k = rootLegalEntity == null ? void 0 : rootLegalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
28717
28736
  handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
28718
28737
  handleFindAddress: args == null ? void 0 : args.handleFindAddress
28719
28738
  });
28720
28739
  case TaskTypes.SERVICE_AGREEMENT:
28721
28740
  return jsx(ServiceAgreementDropinComponent, {
28722
- legalEntityResponse: legalEntity,
28741
+ legalEntityResponse: rootLegalEntity,
28723
28742
  trackingConfig: {
28724
28743
  topLevelLegalEntity: legalEntityResponse
28725
28744
  },
@@ -28738,6 +28757,7 @@ function DropinComposerComponent({
28738
28757
  case TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER:
28739
28758
  return jsx(LegalEntityTypeSwitcher, {
28740
28759
  ...args,
28760
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity,
28741
28761
  targetLegalEntityType: legalEntityType,
28742
28762
  legalEntityResponse,
28743
28763
  handleHomeClick: navigateBack,