@adyen/kyc-components 3.0.0-beta.21 → 3.0.0-beta.23

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 (50) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1046 -1038
  2. package/dist/style.css +10 -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/Trust/types.d.ts +2 -2
  14. package/dist/types/components/internal/Accordion/types.d.ts +1 -1
  15. package/dist/types/components/internal/AccountHolder/types.d.ts +1 -1
  16. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  17. package/dist/types/components/internal/BankAccountNumber/types.d.ts +1 -1
  18. package/dist/types/components/internal/BusinessRegistrationNumber/validate.d.ts +5 -4
  19. package/dist/types/components/internal/ContractViewer/types.d.ts +24 -17
  20. package/dist/types/components/internal/ErrorPanel/components/NavigateToFieldLink.d.ts +5 -4
  21. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +1 -1
  22. package/dist/types/components/internal/FormFields/InputDate/utils.d.ts +1 -1
  23. package/dist/types/components/internal/FormFields/InputEmail.d.ts +2 -1
  24. package/dist/types/components/internal/FormFields/InputTelephone.d.ts +2 -1
  25. package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +1 -8
  26. package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts +2 -1
  27. package/dist/types/components/internal/FormFields/utils.d.ts +6 -1
  28. package/dist/types/components/internal/Name/Name.d.ts +13 -1
  29. package/dist/types/core/Context/StateContext/StateProvider.d.ts +8 -4
  30. package/dist/types/core/hooks/useBusinessSetup.d.ts +6 -0
  31. package/dist/types/core/hooks/useExemptSettlor.d.ts +1 -1
  32. package/dist/types/core/models/decision-maker.d.ts +1 -1
  33. package/dist/types/core/models/identity.d.ts +3 -1
  34. package/dist/types/core/user-events.d.ts +7 -6
  35. package/dist/types/language/config.d.ts +9 -2
  36. package/dist/types/utils/decision-maker-roles.d.ts +10 -19
  37. package/dist/types/utils/entity-association-util.d.ts +23 -17
  38. package/dist/types/utils/entity-status-util.d.ts +1 -3
  39. package/dist/types/utils/entriesOf.d.ts +1 -0
  40. package/dist/types/utils/file.d.ts +3 -3
  41. package/dist/types/utils/genUtils.d.ts +11 -9
  42. package/dist/types/utils/get-name.d.ts +2 -2
  43. package/dist/types/utils/get-task-status.d.ts +1 -1
  44. package/dist/types/utils/makeSelectItemForRole.d.ts +4 -0
  45. package/dist/types/utils/regex/types.d.ts +1 -1
  46. package/dist/types/utils/remove-object-empty-values.d.ts +1 -1
  47. package/dist/types/utils/roleMetadata.d.ts +13 -0
  48. package/dist/types/utils/scroll.d.ts +1 -1
  49. package/dist/types/utils/trust-util.d.ts +4 -25
  50. 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";
@@ -650,7 +656,8 @@ const addAndVerifyYourBankDetails = "Add and verify your bank account details";
650
656
  const failedToFetchSoleProp = "Failed to fetch the sole propietor";
651
657
  const uniqueIdentificationCode = "Unique identification code (ЕИК/UIC)";
652
658
  const identifikacionenNomerDDS = "VAT number (ДДС)";
653
- const MBO = "Matični broj subjekta trgovačkog suda (MBO)";
659
+ const MBS = "Matični broj subjekta trgovačkog suda (MBS)";
660
+ const MBO = "MBO";
654
661
  const PDVIdBrojOIB = "PDV Id. Broj OIB";
655
662
  const cyRegistrationNumber = "Αριθμός Εγγραφής";
656
663
  const arithmosEngraphes = "Αριθμός Εγγραφής Φ.Π.Α.";
@@ -1280,13 +1287,18 @@ const defaultTrans = {
1280
1287
  privateCompanyDescription,
1281
1288
  publicCompanyTitle,
1282
1289
  publicCompanyDescription,
1290
+ partnershipIncorporated,
1291
+ partnershipUnincorporated,
1292
+ associationIncorporated,
1283
1293
  incorporatedPartnership,
1284
1294
  unincorporatedPartnership,
1285
1295
  incorporatedPartnershipTitle,
1296
+ partnershipIncorporatedDescription,
1297
+ partnershipUnincorporatedDescription,
1298
+ partnershipIncorporatedNewEntryFlowDescription,
1299
+ partnershipUnincorporatedNewEntryFlowDescription,
1286
1300
  incorporatedPartnershipDescription,
1287
- incorporatedPartnershipNewEntryFlowDescription,
1288
1301
  unincorporatedPartnershipDescription,
1289
- unincorporatedPartnershipNewEntryFlowDescription,
1290
1302
  nonProfitOrCharitableOrgTitle,
1291
1303
  nonProfitOrCharitableOrgDescription,
1292
1304
  governmentalOrganizationTitle,
@@ -1407,6 +1419,7 @@ const defaultTrans = {
1407
1419
  paymentProcessingTerms,
1408
1420
  accountHolderTerms,
1409
1421
  capitalUserTerms,
1422
+ pccr,
1410
1423
  businessAccountTerms,
1411
1424
  cardUserTerms,
1412
1425
  franchiseesTAndCs,
@@ -1796,6 +1809,7 @@ const defaultTrans = {
1796
1809
  failedToFetchSoleProp,
1797
1810
  uniqueIdentificationCode,
1798
1811
  identifikacionenNomerDDS,
1812
+ MBS,
1799
1813
  MBO,
1800
1814
  PDVIdBrojOIB,
1801
1815
  cyRegistrationNumber,
@@ -2424,43 +2438,30 @@ class Language {
2424
2438
  });
2425
2439
  }
2426
2440
  }
2427
- function isArray(prop) {
2428
- return typeof prop === "object" && prop !== null && Object.prototype.toString.call(prop) === "[object Array]";
2429
- }
2430
- function pick(...args) {
2431
- const myArgs = isArray(args[0]) ? args[0] : args;
2432
- return {
2433
- from: (obj) => (
2434
- // eslint-disable-line
2435
- myArgs.map((k) => k in obj ? {
2436
- [k]: obj[k]
2437
- } : {}).reduce((res, o) => ({
2438
- ...res,
2439
- ...o
2440
- }), {})
2441
- )
2442
- };
2443
- }
2444
- function drop(...args) {
2445
- const myArgs = isArray(args[0]) ? args[0] : args;
2446
- return {
2447
- from: (obj) => {
2448
- const vkeys = Object.keys(obj).filter((k) => !myArgs.includes(k));
2449
- return pick(...vkeys).from(obj);
2450
- }
2451
- };
2452
- }
2453
- function doArraysMatch(arr1, arr2) {
2454
- return arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2455
- }
2441
+ const entriesOf = (object) => Object.entries(object);
2442
+ const keysOf = (object) => Object.keys(object);
2443
+ const keyIsInObject = (key, obj) => key in obj;
2444
+ const pick = (...propertiesToKeep) => ({
2445
+ from: (obj) => propertiesToKeep.map((k) => keyIsInObject(k, obj) ? {
2446
+ [k]: obj[k]
2447
+ } : {}).reduce((res, o) => ({
2448
+ ...res,
2449
+ ...o
2450
+ }), {})
2451
+ });
2452
+ const drop = (...propertiesToDrop) => ({
2453
+ from: (obj) => {
2454
+ const remainingProperties = keysOf(obj).filter((k) => !propertiesToDrop.includes(k));
2455
+ return pick(...remainingProperties).from(obj);
2456
+ }
2457
+ });
2458
+ const doArraysMatch = (arr1, arr2) => arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2456
2459
  const objectsDeepEqual = (x, y) => {
2457
- const xType = typeof x;
2458
- const yType = typeof y;
2459
- if (x && y && xType === "object" && xType === yType) {
2460
+ if (x && y && typeof x === "object" && typeof y === "object") {
2460
2461
  if (Object.keys(x).length !== Object.keys(y).length) {
2461
2462
  return false;
2462
2463
  }
2463
- return Object.keys(x).every((key) => objectsDeepEqual(x[key], y[key]));
2464
+ return keysOf(x).every((key) => objectsDeepEqual(x[key], y[key]));
2464
2465
  }
2465
2466
  return x === y;
2466
2467
  };
@@ -2501,7 +2502,6 @@ function useSettingsContext() {
2501
2502
  }
2502
2503
  return context;
2503
2504
  }
2504
- const entriesOf = (object) => Object.entries(object);
2505
2505
  const hasDataChanged = (initialData, currentData) => entriesOf(currentData ?? {}).some(([key, value]) => {
2506
2506
  if (typeof value === "object") {
2507
2507
  return !objectsDeepEqual(value, initialData == null ? void 0 : initialData[key]);
@@ -3099,12 +3099,11 @@ const NavigateToFieldLink = ({
3099
3099
  const {
3100
3100
  goToFormByFieldName
3101
3101
  } = useFormRouterContext();
3102
- const onClick = (e) => {
3103
- e.preventDefault();
3104
- goToFormByFieldName(fieldName);
3105
- };
3106
3102
  return jsx(Link, {
3107
- onClick,
3103
+ onClick: (e) => {
3104
+ e.preventDefault();
3105
+ goToFormByFieldName(fieldName);
3106
+ },
3108
3107
  href: "to-field-link",
3109
3108
  children: label
3110
3109
  });
@@ -3990,7 +3989,7 @@ const Field = ({
3990
3989
  errorMessage,
3991
3990
  filled,
3992
3991
  focused,
3993
- helper: helper2,
3992
+ helper,
3994
3993
  inputWrapperModifiers = [],
3995
3994
  isLoading,
3996
3995
  isValid,
@@ -4035,9 +4034,9 @@ const Field = ({
4035
4034
  "adyen-kyc-label__text--error": !!errorMessage
4036
4035
  }),
4037
4036
  children: label
4038
- }), helper2 && jsx("span", {
4037
+ }), helper && jsx("span", {
4039
4038
  className: "adyen-kyc-helper-text",
4040
- children: helper2
4039
+ children: helper
4041
4040
  }), jsxs("div", {
4042
4041
  className: cx("adyen-kyc-input-wrapper", ...inputWrapperModifiers.map((m) => `adyen-kyc-input-wrapper--${m}`)),
4043
4042
  children: [children({
@@ -4088,16 +4087,14 @@ const Field = ({
4088
4087
  };
4089
4088
  const Select$1 = "";
4090
4089
  const getScrollParent = (node) => {
4090
+ if (!node)
4091
+ return null;
4091
4092
  const isElement = node instanceof HTMLElement;
4092
4093
  const overflowY = isElement && window.getComputedStyle(node).overflowY;
4093
4094
  const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
4094
- if (!node) {
4095
- return -1;
4096
- }
4097
- if (isScrollable) {
4095
+ if (isElement && isScrollable)
4098
4096
  return node;
4099
- }
4100
- return getScrollParent(node.parentNode) || document.body;
4097
+ return getScrollParent(node.parentNode) ?? document.body;
4101
4098
  };
4102
4099
  function uuidv4() {
4103
4100
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -4623,13 +4620,13 @@ function SelectButton({
4623
4620
  "adyen-kyc-dropdown-button-search": isSearch
4624
4621
  }),
4625
4622
  filterable,
4626
- onClick: !readonly ? toggleList : null,
4627
- onKeyDown: !readonly ? onButtonKeyDown : null,
4628
- role: filterable || isMulti ? "button" : null,
4629
- tabIndex: "0",
4623
+ onClick: !readonly ? toggleList : void 0,
4624
+ onKeyDown: !readonly ? onButtonKeyDown : void 0,
4625
+ role: filterable || isMulti ? "button" : void 0,
4626
+ tabIndex: 0,
4630
4627
  title,
4631
4628
  toggleButtonRef,
4632
- type: !filterable && !isMulti ? "button" : null,
4629
+ type: !filterable && !isMulti ? "button" : void 0,
4633
4630
  "aria-describedby": ariaDescribedBy,
4634
4631
  isMulti,
4635
4632
  id: id2,
@@ -4723,7 +4720,7 @@ function Checkbox({
4723
4720
  label,
4724
4721
  isInvalid,
4725
4722
  onChange,
4726
- helper: helper2,
4723
+ helper,
4727
4724
  checked,
4728
4725
  disabled,
4729
4726
  ...props
@@ -4745,9 +4742,9 @@ function Checkbox({
4745
4742
  }), jsx("span", {
4746
4743
  className: "adyen-kyc-checkbox__label",
4747
4744
  children: label
4748
- }), helper2 && jsx("span", {
4745
+ }), helper && jsx("span", {
4749
4746
  className: "adyen-kyc-checkbox__helper-text",
4750
- children: helper2
4747
+ children: helper
4751
4748
  })]
4752
4749
  });
4753
4750
  }
@@ -6410,9 +6407,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6410
6407
  return {
6411
6408
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6412
6409
  translationMessage: {
6413
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6414
- format: null,
6415
- values: null
6410
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6416
6411
  }
6417
6412
  };
6418
6413
  }
@@ -6428,9 +6423,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6428
6423
  return {
6429
6424
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6430
6425
  translationMessage: {
6431
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6432
- format: null,
6433
- values: null
6426
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6434
6427
  }
6435
6428
  };
6436
6429
  };
@@ -6440,20 +6433,32 @@ const getValidationRulesPerCountryAndType = (country2, companyType2, trustType2,
6440
6433
  if (!registrationNumber2)
6441
6434
  return false;
6442
6435
  const {
6443
- isValid,
6444
- translationMessage
6436
+ isValid
6437
+ } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6438
+ return isValid;
6439
+ },
6440
+ errorMessage: (registrationNumber2) => {
6441
+ if (!registrationNumber2)
6442
+ return;
6443
+ const {
6444
+ translationMessage: {
6445
+ translationKey,
6446
+ format,
6447
+ values
6448
+ }
6445
6449
  } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6446
- this.errorMessage = {
6447
- translationKey: translationMessage.translationKey,
6450
+ if (!format)
6451
+ return translationKey;
6452
+ return {
6453
+ translationKey,
6448
6454
  translationObject: {
6449
6455
  values: {
6450
- format: translationMessage.values ? i18n.get(translationMessage.format, {
6451
- values: translationMessage.values
6452
- }) : i18n.get(translationMessage.format)
6456
+ format: values ? i18n.get(format, {
6457
+ values
6458
+ }) : i18n.get(format)
6453
6459
  }
6454
6460
  }
6455
6461
  };
6456
- return isValid;
6457
6462
  }
6458
6463
  });
6459
6464
  const defaultValidationRules = {
@@ -6473,6 +6478,7 @@ const getRegistrationNumberValidationRules = (country2, companyType2, trustType2
6473
6478
  };
6474
6479
  const businessRegistrationNumberFields = ["registrationNumber", "exemptedFromRegistrationNumber"];
6475
6480
  function BusinessRegistrationNumber(props) {
6481
+ var _a;
6476
6482
  const {
6477
6483
  i18n
6478
6484
  } = useI18nContext();
@@ -6485,7 +6491,7 @@ function BusinessRegistrationNumber(props) {
6485
6491
  country: country2,
6486
6492
  trustType: trustType2
6487
6493
  } = props;
6488
- const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, i18n]);
6494
+ const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, trustType2, i18n]);
6489
6495
  const registrationNumberFormatters = getRegistrationNumberFormatters(props.country);
6490
6496
  const {
6491
6497
  handleChangeFor,
@@ -6501,13 +6507,14 @@ function BusinessRegistrationNumber(props) {
6501
6507
  formatters: registrationNumberFormatters,
6502
6508
  defaultData: {
6503
6509
  ...props.data,
6504
- exemptedFromRegistrationNumber: !!props.data.exemptedFromRegistrationNumber
6510
+ exemptedFromRegistrationNumber: !!((_a = props.data) == null ? void 0 : _a.exemptedFromRegistrationNumber)
6505
6511
  },
6506
6512
  // exemptedFromRegistrationNumber should be a boolean
6507
6513
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
6508
6514
  });
6509
6515
  useEffect(() => {
6510
- stateRef.current.setState({
6516
+ var _a2, _b;
6517
+ (_b = (_a2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
6511
6518
  type: "addToState",
6512
6519
  value: {
6513
6520
  data,
@@ -6557,7 +6564,7 @@ function BusinessRegistrationNumber(props) {
6557
6564
  value: "exemptedFromRegistrationNumber",
6558
6565
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
6559
6566
  classNameModifiers: ["exempted-from-registration"],
6560
- checked: data.exemptedFromRegistrationNumber,
6567
+ checked: data.exemptedFromRegistrationNumber ?? false,
6561
6568
  onChange: handleChangeFor("exemptedFromRegistrationNumber"),
6562
6569
  "aria-required": formUtils.isRequiredField("exemptedFromRegistrationNumber"),
6563
6570
  "aria-label": formUtils.getLabel("exemptedFromRegistrationNumber"),
@@ -7755,7 +7762,7 @@ const companyRegistrationDetailsValidationRules = {
7755
7762
  },
7756
7763
  stockExchangeMIC: {
7757
7764
  modes: ["blur"],
7758
- validate: (input) => /^[A-Z0-9]{4}$/.test(input),
7765
+ validate: (input) => !isEmpty(input) && /^[A-Z0-9]{4}$/.test(input),
7759
7766
  errorMessage: "validationPleaseEnterAValidMarketIdentifier"
7760
7767
  },
7761
7768
  stockISIN: [{
@@ -7773,7 +7780,7 @@ const companyRegistrationDetailsValidationRules = {
7773
7780
  errorMessage: "fieldIsRequired"
7774
7781
  }, {
7775
7782
  modes: ["blur"],
7776
- validate: (dateOfIncorporation2) => dateOfIncorporation2 && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7783
+ validate: (dateOfIncorporation2) => !isEmpty(dateOfIncorporation2) && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7777
7784
  errorMessage: "invalidDateOfIncorporation"
7778
7785
  }]
7779
7786
  };
@@ -8231,7 +8238,7 @@ const countryConfig$4 = {
8231
8238
  },
8232
8239
  [CountryCodes.Croatia]: {
8233
8240
  registrationNumber: {
8234
- label: "MBO"
8241
+ label: "MBS"
8235
8242
  },
8236
8243
  exemptedFromVat: {
8237
8244
  label: "vatNumberExempted"
@@ -9441,16 +9448,13 @@ function DropzoneFile(props) {
9441
9448
  i18n
9442
9449
  } = useI18nContext();
9443
9450
  const formatSize = (bytes) => {
9444
- if (bytes) {
9445
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9446
- if (bytes === 0)
9447
- return "n/a";
9448
- const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9449
- if (i === 0)
9450
- return `${bytes} ${sizes[i]}`;
9451
- return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9452
- }
9453
- return null;
9451
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9452
+ if (!bytes || bytes === 0)
9453
+ return "n/a";
9454
+ const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9455
+ if (i === 0)
9456
+ return `${bytes} ${sizes[i]}`;
9457
+ return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9454
9458
  };
9455
9459
  return jsxs("div", {
9456
9460
  className: "adyen-kyc-dropzone-file",
@@ -9597,10 +9601,10 @@ function Dropzone(props) {
9597
9601
  const isRequired = ((_a = errors == null ? void 0 : errors[name]) == null ? void 0 : _a.errorMessage) === "fieldIsRequired";
9598
9602
  const allowedFiletypes = allowedFileTypes.join(", ");
9599
9603
  useEffect(() => {
9600
- var _a2;
9604
+ var _a2, _b2, _c;
9601
9605
  const hasMaxNumberOfFiles = ((_a2 = data == null ? void 0 : data[name]) == null ? void 0 : _a2.length) >= maxNumberOfFiles;
9602
9606
  setShowDropzone(!hasMaxNumberOfFiles);
9603
- stateRef.current.setState({
9607
+ (_c = (_b2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _b2.setState) == null ? void 0 : _c.call(_b2, {
9604
9608
  type: "addToState",
9605
9609
  value: {
9606
9610
  data,
@@ -10908,10 +10912,10 @@ Address.defaultProps = {
10908
10912
  };
10909
10913
  const RadioGroup$1 = "";
10910
10914
  function RadioGroup({
10911
- items,
10915
+ items = [],
10912
10916
  i18n,
10913
10917
  name,
10914
- onChange,
10918
+ onChange = noop,
10915
10919
  value,
10916
10920
  isInvalid,
10917
10921
  uniqueId: uniqueId2,
@@ -10946,11 +10950,6 @@ function RadioGroup({
10946
10950
  })
10947
10951
  });
10948
10952
  }
10949
- RadioGroup.defaultProps = {
10950
- onChange: () => {
10951
- },
10952
- items: []
10953
- };
10954
10953
  var operationalAddressIsSameIds = /* @__PURE__ */ ((operationalAddressIsSameIds2) => {
10955
10954
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_SAME"] = "OperationAddressAnswerYes";
10956
10955
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_NOT_SAME"] = "OperationAddressAnswerNo";
@@ -11628,496 +11627,78 @@ const getMaskedAccountNumber = ({
11628
11627
  accountIdentifier,
11629
11628
  realLastFour
11630
11629
  }) => realLastFour ? `*******${realLastFour}` : accountIdentifier;
11631
- const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
11632
- roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
11633
- min: 1,
11634
- max: Infinity
11635
- }, {
11636
- roleTypes: [DecisionMakerType.OWNER],
11637
- min: 0,
11638
- max: 4
11639
- }, {
11640
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11641
- min: 0,
11642
- max: Infinity
11643
- }, {
11644
- roleTypes: [DecisionMakerType.SIGNATORY],
11645
- min: 1,
11646
- max: Infinity
11647
- }];
11648
- const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
11649
- US: [{
11650
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11651
- min: 1,
11652
- max: Infinity
11653
- }, {
11654
- roleTypes: [DecisionMakerType.OWNER],
11655
- min: 0,
11656
- max: 4
11657
- }, {
11658
- roleTypes: [DecisionMakerType.SIGNATORY],
11659
- min: 1,
11660
- max: Infinity
11661
- }],
11662
- BR: [{
11663
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11664
- min: 1,
11665
- max: Infinity
11666
- }, {
11667
- roleTypes: [DecisionMakerType.OWNER],
11668
- min: 0,
11669
- max: 4
11670
- }, {
11671
- roleTypes: [DecisionMakerType.SIGNATORY],
11672
- min: 1,
11673
- max: Infinity
11674
- }],
11675
- AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11676
- roleTypes: [DecisionMakerType.DIRECTOR],
11677
- min: 3,
11678
- max: Infinity
11679
- }],
11680
- CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11681
- roleTypes: [DecisionMakerType.DIRECTOR],
11682
- min: 1,
11683
- max: Infinity
11684
- }],
11685
- HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11686
- roleTypes: [DecisionMakerType.DIRECTOR],
11687
- min: 1,
11688
- max: Infinity
11689
- }],
11690
- IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11691
- roleTypes: [DecisionMakerType.DIRECTOR],
11692
- min: 3,
11693
- max: 15
11694
- }],
11695
- NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11696
- roleTypes: [DecisionMakerType.DIRECTOR],
11697
- min: 1,
11698
- max: Infinity
11699
- }],
11700
- SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11701
- roleTypes: [DecisionMakerType.DIRECTOR],
11702
- min: 1,
11703
- max: Infinity
11704
- }]
11705
- };
11706
- const getDecisionMakerRequirements = (country2) => PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] || DEFAULT_DECISION_MAKER_REQUIREMENTS;
11707
- function getAvailableDecisionMakerRoleTypes(country2) {
11708
- const requirements2 = getDecisionMakerRequirements(country2);
11709
- return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
11710
- roleType: req.roleTypes[0],
11711
- min: req.min,
11712
- max: req.max
11713
- }));
11714
- }
11715
- const DEFAULT_DESCRIPTIONS_MAP = {
11716
- [DecisionMakerType.OWNER]: "provideAllOwners",
11717
- [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
11718
- [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
11719
- [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
11720
- };
11721
- const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
11722
- US: {
11723
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11724
- },
11725
- BR: {
11726
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11727
- }
11728
- };
11729
- const getDecisionMakerDescriptionMap = (country2) => ({
11730
- ...DEFAULT_DESCRIPTIONS_MAP,
11731
- ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
11732
- });
11733
- const decisionMakerRoles = {
11734
- [DecisionMakerType.CONTROLLING_PERSON]: {
11735
- id: DecisionMakerType.CONTROLLING_PERSON,
11736
- name: "controllingPerson",
11737
- description: "controllingPersonDescription",
11738
- className: "adl-tag--teal"
11739
- },
11740
- [DecisionMakerType.OWNER]: {
11741
- id: DecisionMakerType.OWNER,
11742
- name: "owner",
11743
- description: "ownerDescription",
11744
- className: "adl-tag--purple"
11745
- },
11746
- [DecisionMakerType.SIGNATORY]: {
11747
- id: DecisionMakerType.SIGNATORY,
11748
- name: "signatory",
11749
- description: "signatoryDescription",
11750
- className: "adl-tag--light-blue"
11751
- },
11752
- [DecisionMakerType.DIRECTOR]: {
11753
- id: DecisionMakerType.DIRECTOR,
11754
- name: "director",
11755
- description: "directorDescription",
11756
- className: "adl-tag--orange"
11757
- }
11630
+ const getDirectEntityAssociations = (rootLE, legalEntityId) => {
11631
+ var _a;
11632
+ return ((_a = rootLE == null ? void 0 : rootLE.entityAssociations) == null ? void 0 : _a.filter((association2) => association2.associatorId === legalEntityId)) ?? [];
11758
11633
  };
11759
- 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) => ({
11760
- ...decisionMakerRole,
11761
- id: decisionMakerRole.id,
11762
- name: i18n.get(decisionMakerRole.name),
11763
- description: i18n.get(decisionMakerRole.description)
11764
- }));
11765
- const getOwnDecisionMakers = (legalEntity) => {
11766
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
11767
- const decisionMakerTypes = Object.values(DecisionMakerType);
11768
- return legalEntity.entityAssociations.filter((entityAssociation) => decisionMakerTypes.includes(entityAssociation.type) && entityAssociation.associatorId === legalEntity.id);
11769
- }
11770
- return [];
11634
+ const getOwnEntityAssociations = (legalEntity) => getDirectEntityAssociations(legalEntity, legalEntity.id);
11635
+ const getOwnSoleProprietorshipIdArray = (legalEntity) => {
11636
+ const ownAssociations = getOwnEntityAssociations(legalEntity);
11637
+ return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11771
11638
  };
11772
- const getOwnSignatories = (legalEntity) => getOwnDecisionMakers(legalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
11773
- const getOwnDecisionMakersLegalEntityIds = (legalEntity) => {
11639
+ const hasSolePropInLegalEntity = (rootLegalEntity) => {
11774
11640
  var _a;
11775
- return (_a = getOwnDecisionMakers(legalEntity)) == null ? void 0 : _a.map((ea) => ea.legalEntityId);
11641
+ return ((_a = rootLegalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === rootLegalEntity.id)) ?? false;
11776
11642
  };
11777
- const getDecisionMakerCount = (legalEntityResponse) => {
11778
- const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
11779
- return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
11780
- decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
11781
- return decisionMakerCount;
11782
- }, {});
11643
+ const getOwnSolePropProblems = (rootLegalEntity, capabilityProblems) => {
11644
+ var _a;
11645
+ const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
11646
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
11783
11647
  };
11784
- const getAllowedDecisionMakerRoles = (legalEntityResponse, taskType) => {
11785
- var _a, _b;
11786
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
11787
- return [DecisionMakerType.OWNER];
11648
+ const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => (entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId)) ?? false;
11649
+ const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
11650
+ const isRootLegalEntity = (legalEntity, taskType) => legalEntity.type === LegalEntityType.INDIVIDUAL && taskType === TaskTypes.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION && taskType === TaskTypes.COMPANY;
11651
+ const filterOutUnwantedAssociationsIfRootLE = (taskType, legalEntity, accountHolder2) => {
11652
+ if (!(legalEntity == null ? void 0 : legalEntity.entityAssociations)) {
11653
+ return void 0;
11788
11654
  }
11789
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11790
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11791
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11792
- const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
11793
- const {
11794
- roleTypes,
11795
- max
11796
- } = requirements2;
11797
- if (roleTypes.length === 1) {
11798
- const role2 = roleTypes[0];
11799
- const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
11800
- if (isBelowMaxRange) {
11801
- acc.push(role2);
11802
- }
11803
- }
11804
- return acc;
11805
- }, []);
11806
- const uniqueAllowedRoles = [...new Set(allowedRoles)];
11807
- return uniqueAllowedRoles;
11655
+ let entityAssociations = getOwnEntityAssociations(legalEntity);
11656
+ if (!isRootLegalEntity(legalEntity, taskType)) {
11657
+ return entityAssociations;
11658
+ }
11659
+ if (accountHolder2 !== "mySoleProprietorName" && hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id)) {
11660
+ entityAssociations = removeEntityAssociationByType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id);
11661
+ }
11662
+ if (accountHolder2 !== "aTrust" && hasOwnEntityAssociationOfType(LegalEntityType.TRUST, entityAssociations, legalEntity.id)) {
11663
+ entityAssociations = removeEntityAssociationByType(LegalEntityType.TRUST, entityAssociations, legalEntity.id);
11664
+ }
11665
+ return entityAssociations;
11808
11666
  };
11809
- const hasMinRequiredDecisionMakerCount = (legalEntityResponse) => {
11810
- var _a, _b;
11811
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11812
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11813
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11814
- return decisionMakerCountRange.every((requirements2) => {
11815
- const {
11816
- roleTypes,
11817
- min
11818
- } = requirements2;
11819
- return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
11667
+ var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
11668
+ VerificationStatus2["VALID"] = "valid";
11669
+ VerificationStatus2["PENDING"] = "pending";
11670
+ VerificationStatus2["INVALID"] = "invalid";
11671
+ VerificationStatus2["REJECTED"] = "rejected";
11672
+ return VerificationStatus2;
11673
+ })(VerificationStatus || {});
11674
+ function getNestedPropertyKeys(obj, includeUndefined = false) {
11675
+ const fieldNames = [];
11676
+ Object.entries(obj).forEach(([key, value]) => {
11677
+ if (typeof value === "object" && value !== null) {
11678
+ const nested = getNestedPropertyKeys(value).map((name) => `${key}.${name}`);
11679
+ fieldNames.push(...nested);
11680
+ return;
11681
+ }
11682
+ if (value !== void 0 || includeUndefined) {
11683
+ fieldNames.push(key);
11684
+ }
11820
11685
  });
11821
- };
11822
- var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
11823
- TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
11824
- TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
11825
- TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
11826
- TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
11827
- TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
11828
- TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
11829
- TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
11830
- TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
11831
- TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
11832
- TrustTypes2["FAMILY_TRUST"] = "familyTrust";
11833
- TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
11834
- TrustTypes2["FIXED_TRUST"] = "fixedTrust";
11835
- TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
11836
- TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
11837
- TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
11838
- TrustTypes2["OTHER_TRUST"] = "otherTrust";
11839
- TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
11840
- TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
11841
- TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
11842
- return TrustTypes2;
11843
- })(TrustTypes || {});
11844
- const trustTypeOptions = [{
11845
- id: TrustTypes.BUSINESS_TRUST,
11846
- name: "businessTrust"
11847
- }, {
11848
- id: TrustTypes.CASH_MANAGEMENT_TRUST,
11849
- name: "cashManagementTrust"
11850
- }, {
11851
- id: TrustTypes.CHARITABLE_TRUST,
11852
- name: "charitableTrust"
11853
- }, {
11854
- id: TrustTypes.CORPORATE_UNIT_TRUST,
11855
- name: "corporateUnitTrust"
11856
- }, {
11857
- id: TrustTypes.DECEASED_ESTATE,
11858
- name: "deceasedEstate"
11859
- }, {
11860
- id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
11861
- name: "discretionaryInvestmentTrust"
11862
- }, {
11863
- id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
11864
- name: "discretionaryServicesManagementTrust"
11865
- }, {
11866
- id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
11867
- name: "discretionaryTradingTrust"
11868
- }, {
11869
- id: TrustTypes.DISCRETIONARY_TRUST,
11870
- name: "discretionaryTrust"
11871
- }, {
11872
- id: TrustTypes.FAMILY_TRUST,
11873
- name: "familyTrust"
11874
- }, {
11875
- id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
11876
- name: "firstHomeSaverAccountsTrust"
11877
- }, {
11878
- id: TrustTypes.FIXED_TRUST,
11879
- name: "fixedTrust"
11880
- }, {
11881
- id: TrustTypes.FIXED_UNIT_TRUST,
11882
- name: "fixedUnitTrust"
11883
- }, {
11884
- id: TrustTypes.HYBRID_TRUST,
11885
- name: "hybridTrust"
11886
- }, {
11887
- id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
11888
- name: "listedPublicUnitTrust"
11889
- }, {
11890
- id: TrustTypes.OTHER_TRUST,
11891
- name: "otherTrust"
11892
- }, {
11893
- id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
11894
- name: "pooledSuperannuationTrust"
11895
- }, {
11896
- id: TrustTypes.PUBLIC_TRADING_TRUST,
11897
- name: "publicTradingTrust"
11898
- }, {
11899
- id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
11900
- name: "unlistedPublicUnitTrust"
11901
- }];
11902
- const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
11903
- 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];
11904
- const countryToTrustTypes = {
11905
- [CountryCodes.Australia]: auSpecificTrustTypes,
11906
- [CountryCodes.NewZealand]: nzSpecificTrustTypes
11907
- };
11908
- const TRUST_MEMBER_COUNT_RANGE = {
11909
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11910
- min: 1
11911
- },
11912
- [TrustMemberTypes.SETTLOR]: {
11913
- min: 1
11914
- }
11915
- };
11916
- const isPartOfTrustFromLegalEntity = (legalEntity) => {
11917
- var _a;
11918
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
11919
- };
11920
- const getRootTrusteeLegalEntityId = (trustEntity) => {
11921
- var _a;
11922
- if (!trustEntity.entityAssociations)
11923
- return "";
11924
- return (_a = trustEntity.entityAssociations.filter((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)[0]) == null ? void 0 : _a.legalEntityId;
11925
- };
11926
- const getOwnTrustMembers = (trustEntity) => {
11927
- if (!trustEntity.entityAssociations)
11928
- return [];
11929
- const rootTrusteeLegalEntityId = getRootTrusteeLegalEntityId(trustEntity);
11930
- return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && rootTrusteeLegalEntityId === (entityAssociation == null ? void 0 : entityAssociation.associatorId));
11931
- };
11932
- const getOwnTrustMembersLegalEntityIds = (legalEntity) => getOwnTrustMembers(legalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11933
- const getOwnTrustLegalEntityId = (legalEntity) => {
11934
- var _a, _b;
11935
- 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;
11936
- };
11937
- const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
11938
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11939
- return trustLegalEntityId ? [trustLegalEntityId] : [];
11940
- };
11941
- const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
11942
- var _a;
11943
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11944
- if (trustLegalEntityId) {
11945
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
11946
- }
11947
- };
11948
- const getTrustMemberCount = (legalEntity) => {
11949
- const trustMembers2 = getOwnTrustMembers(legalEntity);
11950
- return trustMembers2.reduce((trustMemberCount, trustMember) => {
11951
- trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
11952
- return trustMemberCount;
11953
- }, {});
11954
- };
11955
- const hasMinRequiredTrustMemberCount = (legalEntity) => {
11956
- const existingTrustMemberCount = getTrustMemberCount(legalEntity);
11957
- const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
11958
- return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
11959
- };
11960
- const makeSelectItemForTrustRole = (role2, i18n) => ({
11961
- ...trustMemberRoles[role2],
11962
- name: i18n.get(trustMemberRoles[role2].name),
11963
- description: i18n.get(trustMemberRoles[role2].description)
11964
- });
11965
- const getTrustMemberName = (trustMemberType) => trustMemberRoles[trustMemberType].name;
11966
- const trustMemberRoles = {
11967
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11968
- id: TrustMemberTypes.DEFINED_BENEFICIARY,
11969
- name: "definedBeneficiary",
11970
- description: "definedBeneficiaryDescription",
11971
- className: "adl-tag--orange"
11972
- },
11973
- [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
11974
- id: TrustMemberTypes.UNDEFINED_BENEFICIARY,
11975
- name: "undefinedBeneficiary",
11976
- description: "undefinedBeneficiaryDescription",
11977
- className: "adl-tag--orange"
11978
- },
11979
- [TrustMemberTypes.PROTECTOR]: {
11980
- id: TrustMemberTypes.PROTECTOR,
11981
- name: "protector",
11982
- description: "personAppointmentUnderTrustInstrument",
11983
- className: "adl-tag--orange"
11984
- },
11985
- [TrustMemberTypes.TRUSTEE]: {
11986
- id: TrustMemberTypes.TRUSTEE,
11987
- name: "trustee",
11988
- description: "legalOwnerOfProperty",
11989
- className: "adl-tag--light-blue"
11990
- },
11991
- [TrustMemberTypes.SETTLOR]: {
11992
- id: TrustMemberTypes.SETTLOR,
11993
- name: "settlor",
11994
- description: "entityEstablishingTrust",
11995
- className: "adl-tag--orange"
11996
- }
11997
- };
11998
- const trustMemberGuidanceRoles = {
11999
- [TrustMemberGuidanceLabel.BENEFICIARY]: {
12000
- id: TrustMemberGuidanceLabel.BENEFICIARY,
12001
- name: TrustMemberGuidanceLabel.BENEFICIARY,
12002
- className: "adl-tag--orange"
12003
- },
12004
- [TrustMemberGuidanceLabel.PROTECTOR]: {
12005
- id: TrustMemberGuidanceLabel.PROTECTOR,
12006
- name: TrustMemberGuidanceLabel.PROTECTOR,
12007
- className: "adl-tag--orange"
12008
- },
12009
- [TrustMemberGuidanceLabel.TRUSTEE]: {
12010
- id: TrustMemberGuidanceLabel.TRUSTEE,
12011
- name: TrustMemberGuidanceLabel.TRUSTEE,
12012
- className: "adl-tag--light-blue"
12013
- },
12014
- [TrustMemberGuidanceLabel.SETTLOR]: {
12015
- id: TrustMemberGuidanceLabel.SETTLOR,
12016
- name: TrustMemberGuidanceLabel.SETTLOR,
12017
- className: "adl-tag--orange"
12018
- }
12019
- };
12020
- const getCountrySpecificTrustTypeOptions = (country2) => {
12021
- const countrySpecificTrustTypes = countryToTrustTypes[country2];
12022
- if (!countrySpecificTrustTypes) {
12023
- return [];
12024
- }
12025
- return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
12026
- const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
12027
- if (!countrySpecificTrustTypeOption) {
12028
- throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
12029
- }
12030
- return countrySpecificTrustTypeOption;
12031
- });
12032
- };
12033
- const entityAssociationRoles = {
12034
- ...trustMemberRoles,
12035
- ...decisionMakerRoles
12036
- };
12037
- const getEntityAssociationTagColor = (entityAssociationType) => {
12038
- var _a;
12039
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.className;
12040
- };
12041
- const getEntityAssociationName = (entityAssociationType) => {
12042
- var _a;
12043
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.name;
12044
- };
12045
- const getOwnEntityAssociations = (legalEntity) => {
12046
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
12047
- return legalEntity.entityAssociations.filter((entityAssociation) => entityAssociation.associatorId === legalEntity.id);
12048
- }
12049
- return [];
12050
- };
12051
- const getOwnSoleProprietorshipIdArray = (legalEntity) => {
12052
- const ownAssociations = getOwnEntityAssociations(legalEntity);
12053
- return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId);
12054
- };
12055
- const hasSolePropInLegalEntity = (legalEntity) => {
12056
- var _a;
12057
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === legalEntity.id);
12058
- };
12059
- const getOwnSolePropProblems = (legalEntity, capabilityProblems) => {
12060
- var _a;
12061
- const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(legalEntity)[0];
12062
- if (solePropLegalEntityId) {
12063
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
12064
- }
12065
- };
12066
- const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId);
12067
- const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
12068
- const isRootLegalEntity = (legalEntity, taskType) => legalEntity.type === LegalEntityType.INDIVIDUAL && taskType === TaskTypes.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION && taskType === TaskTypes.COMPANY;
12069
- const filterOutUnwantedAssociationsIfRootLE = (taskType, legalEntity, accountHolder2) => {
12070
- if (!(legalEntity == null ? void 0 : legalEntity.entityAssociations)) {
12071
- return void 0;
12072
- }
12073
- let entityAssociations = getOwnEntityAssociations(legalEntity);
12074
- if (!isRootLegalEntity(legalEntity, taskType)) {
12075
- return entityAssociations;
12076
- }
12077
- if (accountHolder2 !== "mySoleProprietorName" && hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id)) {
12078
- entityAssociations = removeEntityAssociationByType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id);
12079
- }
12080
- if (accountHolder2 !== "aTrust" && hasOwnEntityAssociationOfType(LegalEntityType.TRUST, entityAssociations, legalEntity.id)) {
12081
- entityAssociations = removeEntityAssociationByType(LegalEntityType.TRUST, entityAssociations, legalEntity.id);
12082
- }
12083
- return entityAssociations;
12084
- };
12085
- var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
12086
- VerificationStatus2["VALID"] = "valid";
12087
- VerificationStatus2["PENDING"] = "pending";
12088
- VerificationStatus2["INVALID"] = "invalid";
12089
- VerificationStatus2["REJECTED"] = "rejected";
12090
- return VerificationStatus2;
12091
- })(VerificationStatus || {});
12092
- function getNestedPropertyKeys(obj, includeUndefined = false) {
12093
- const fieldNames = [];
12094
- Object.entries(obj).forEach(([key, value]) => {
12095
- if (typeof value === "object" && value !== null) {
12096
- const nested = getNestedPropertyKeys(value).map((name) => `${key}.${name}`);
12097
- fieldNames.push(...nested);
12098
- return;
12099
- }
12100
- if (value !== void 0 || includeUndefined) {
12101
- fieldNames.push(key);
12102
- }
12103
- });
12104
- return fieldNames;
12105
- }
12106
- const getTaskStatus = (type, capabilityProblems, legalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
12107
- if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(legalEntity.id) && isEmptyEntity(legalEntity))
12108
- return TaskStatus.EMPTY;
12109
- const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
12110
- if (importantCapabilityStatus)
12111
- return importantCapabilityStatus;
12112
- if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(legalEntity))
12113
- return TaskStatus.PROCESSING;
12114
- return TaskStatus.FINISHED;
11686
+ return fieldNames;
11687
+ }
11688
+ const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
11689
+ if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
11690
+ return TaskStatus.EMPTY;
11691
+ const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
11692
+ if (importantCapabilityStatus)
11693
+ return importantCapabilityStatus;
11694
+ if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
11695
+ return TaskStatus.PROCESSING;
11696
+ return TaskStatus.FINISHED;
12115
11697
  };
12116
11698
  const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
12117
11699
  function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
12118
- if (!(capabilityProblems == null ? void 0 : capabilityProblems[type])) {
11700
+ if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
12119
11701
  return;
12120
- }
12121
11702
  const importantStatuses = Object.entries(capabilityProblems[type] ?? {}).filter(([key]) => entityIds == null ? void 0 : entityIds.includes(key)).map(([, value]) => value.status).filter((status) => IMPORTANT_STATUSES.includes(status));
12122
11703
  if (!importantStatuses.length)
12123
11704
  return;
@@ -12144,7 +11725,10 @@ function isEmptyEntity(legalEntity) {
12144
11725
  if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
12145
11726
  return false;
12146
11727
  const minimumFields = emptyFieldsByEntityType[type];
12147
- const fieldsOnEntity = getNestedPropertyKeys(legalEntity[type] ?? {});
11728
+ const typeSpecificSection = legalEntity[type];
11729
+ if (!typeSpecificSection)
11730
+ return true;
11731
+ const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
12148
11732
  return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
12149
11733
  }
12150
11734
  const entityTypeToCorrespondingAccountHolderOption = {
@@ -14404,7 +13988,8 @@ function ContactDetailsComponent(props) {
14404
13988
  setState: null
14405
13989
  });
14406
13990
  useEffect(() => {
14407
- stateRef.current.setState({
13991
+ var _a, _b;
13992
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14408
13993
  type: "addToState",
14409
13994
  value: {
14410
13995
  data,
@@ -14462,86 +14047,86 @@ ContactDetailsComponent.defaultProps = {
14462
14047
  data: {}
14463
14048
  };
14464
14049
  const IdentityNumber$1 = "";
14050
+ const CHECKCHARACTER_ODD_VALUE = {
14051
+ 0: 1,
14052
+ 1: 0,
14053
+ 2: 5,
14054
+ 3: 7,
14055
+ 4: 9,
14056
+ 5: 13,
14057
+ 6: 15,
14058
+ 7: 17,
14059
+ 8: 19,
14060
+ 9: 21,
14061
+ A: 1,
14062
+ B: 0,
14063
+ C: 5,
14064
+ D: 7,
14065
+ E: 9,
14066
+ F: 13,
14067
+ G: 15,
14068
+ H: 17,
14069
+ I: 19,
14070
+ J: 21,
14071
+ K: 2,
14072
+ L: 4,
14073
+ M: 18,
14074
+ N: 20,
14075
+ O: 11,
14076
+ P: 3,
14077
+ Q: 6,
14078
+ R: 8,
14079
+ S: 12,
14080
+ T: 14,
14081
+ U: 16,
14082
+ V: 10,
14083
+ W: 22,
14084
+ X: 25,
14085
+ Y: 24,
14086
+ Z: 23
14087
+ };
14088
+ const CHECKCHARACTER_EVEN_VALUE = {
14089
+ 0: 0,
14090
+ 1: 1,
14091
+ 2: 2,
14092
+ 3: 3,
14093
+ 4: 4,
14094
+ 5: 5,
14095
+ 6: 6,
14096
+ 7: 7,
14097
+ 8: 8,
14098
+ 9: 9,
14099
+ A: 0,
14100
+ B: 1,
14101
+ C: 2,
14102
+ D: 3,
14103
+ E: 4,
14104
+ F: 5,
14105
+ G: 6,
14106
+ H: 7,
14107
+ I: 8,
14108
+ J: 9,
14109
+ K: 10,
14110
+ L: 11,
14111
+ M: 12,
14112
+ N: 13,
14113
+ O: 14,
14114
+ P: 15,
14115
+ Q: 16,
14116
+ R: 17,
14117
+ S: 18,
14118
+ T: 19,
14119
+ U: 20,
14120
+ V: 21,
14121
+ W: 22,
14122
+ X: 23,
14123
+ Y: 24,
14124
+ Z: 25
14125
+ };
14465
14126
  function validCheckCharacter(input, calculationInput) {
14466
14127
  if (!/^[A-Z]$/.test(input)) {
14467
14128
  return false;
14468
14129
  }
14469
- const CHECKCHARACTER_ODD_VALUE = {
14470
- 0: 1,
14471
- 9: 21,
14472
- I: 19,
14473
- R: 8,
14474
- 1: 0,
14475
- A: 1,
14476
- J: 21,
14477
- S: 12,
14478
- 2: 5,
14479
- B: 0,
14480
- K: 2,
14481
- T: 14,
14482
- 3: 7,
14483
- C: 5,
14484
- L: 4,
14485
- U: 16,
14486
- 4: 9,
14487
- D: 7,
14488
- M: 18,
14489
- V: 10,
14490
- 5: 13,
14491
- E: 9,
14492
- N: 20,
14493
- W: 22,
14494
- 6: 15,
14495
- F: 13,
14496
- O: 11,
14497
- X: 25,
14498
- 7: 17,
14499
- G: 15,
14500
- P: 3,
14501
- Y: 24,
14502
- 8: 19,
14503
- H: 17,
14504
- Q: 6,
14505
- Z: 23
14506
- };
14507
- const CHECKCHARACTER_EVEN_VALUE = {
14508
- 0: 0,
14509
- 9: 9,
14510
- I: 8,
14511
- R: 17,
14512
- 1: 1,
14513
- A: 0,
14514
- J: 9,
14515
- S: 18,
14516
- 2: 2,
14517
- B: 1,
14518
- K: 10,
14519
- T: 19,
14520
- 3: 3,
14521
- C: 2,
14522
- L: 11,
14523
- U: 20,
14524
- 4: 4,
14525
- D: 3,
14526
- M: 12,
14527
- V: 21,
14528
- 5: 5,
14529
- E: 4,
14530
- N: 13,
14531
- W: 22,
14532
- 6: 6,
14533
- F: 5,
14534
- O: 14,
14535
- X: 23,
14536
- 7: 7,
14537
- G: 6,
14538
- P: 15,
14539
- Y: 24,
14540
- 8: 8,
14541
- H: 7,
14542
- Q: 16,
14543
- Z: 25
14544
- };
14545
14130
  let total = 0;
14546
14131
  for (let i = 0; i < 15; i += 1) {
14547
14132
  const set = i % 2 === 1 ? CHECKCHARACTER_EVEN_VALUE : CHECKCHARACTER_ODD_VALUE;
@@ -14552,14 +14137,8 @@ function validCheckCharacter(input, calculationInput) {
14552
14137
  }
14553
14138
  total = (total + value) % 26;
14554
14139
  }
14555
- if (total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input) {
14556
- return true;
14557
- }
14558
- return false;
14140
+ return total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input;
14559
14141
  }
14560
- const helper = {
14561
- validCheckCharacter
14562
- };
14563
14142
  const countryIdNumberFormatters = {
14564
14143
  [CountryCodes.Brazil]: {
14565
14144
  idNumber: {
@@ -14621,7 +14200,7 @@ const countryIdNumberValidationRules = {
14621
14200
  },
14622
14201
  [CountryCodes.Italy]: {
14623
14202
  idNumber: [{
14624
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && helper.validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14203
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14625
14204
  modes: ["blur"],
14626
14205
  errorMessage: "invalidFormatIdentityNumberIT"
14627
14206
  }]
@@ -14685,7 +14264,7 @@ function IdentityNumber(props) {
14685
14264
  dataStoreId,
14686
14265
  country: country2,
14687
14266
  errors: propErrors,
14688
- data: propData,
14267
+ data: propData = {},
14689
14268
  requiredFields,
14690
14269
  fieldValidationErrors,
14691
14270
  maskedFields,
@@ -14829,16 +14408,90 @@ function IdentityNumber(props) {
14829
14408
  });
14830
14409
  }
14831
14410
  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));
14832
- IdentityNumberComponent.defaultProps = {
14833
- data: {},
14834
- onChange: () => {
14835
- }
14836
- };
14837
- const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14838
- if (propagationMode === "stop")
14839
- event.stopPropagation();
14840
- if (keys.includes(event.key)) {
14841
- if (propagationMode === "stopIfMatches")
14411
+ const roleMetadata = {
14412
+ [DecisionMakerType.CONTROLLING_PERSON]: {
14413
+ name: "controllingPerson",
14414
+ description: "controllingPersonDescription",
14415
+ className: "adl-tag--teal"
14416
+ },
14417
+ [DecisionMakerType.OWNER]: {
14418
+ name: "owner",
14419
+ description: "ownerDescription",
14420
+ className: "adl-tag--purple"
14421
+ },
14422
+ [DecisionMakerType.SIGNATORY]: {
14423
+ name: "signatory",
14424
+ description: "signatoryDescription",
14425
+ className: "adl-tag--light-blue"
14426
+ },
14427
+ [DecisionMakerType.DIRECTOR]: {
14428
+ name: "director",
14429
+ description: "directorDescription",
14430
+ className: "adl-tag--orange"
14431
+ },
14432
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
14433
+ name: "definedBeneficiary",
14434
+ description: "definedBeneficiaryDescription",
14435
+ className: "adl-tag--orange"
14436
+ },
14437
+ [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
14438
+ name: "undefinedBeneficiary",
14439
+ description: "undefinedBeneficiaryDescription",
14440
+ className: "adl-tag--orange"
14441
+ },
14442
+ [TrustMemberTypes.PROTECTOR]: {
14443
+ name: "protector",
14444
+ description: "personAppointmentUnderTrustInstrument",
14445
+ className: "adl-tag--orange"
14446
+ },
14447
+ [TrustMemberTypes.TRUSTEE]: {
14448
+ name: "trustee",
14449
+ description: "legalOwnerOfProperty",
14450
+ className: "adl-tag--light-blue"
14451
+ },
14452
+ [TrustMemberTypes.SETTLOR]: {
14453
+ name: "settlor",
14454
+ description: "entityEstablishingTrust",
14455
+ className: "adl-tag--orange"
14456
+ },
14457
+ [TrustMemberGuidanceLabel.BENEFICIARY]: {
14458
+ name: TrustMemberGuidanceLabel.BENEFICIARY,
14459
+ className: "adl-tag--orange"
14460
+ },
14461
+ [TrustMemberGuidanceLabel.TRUSTEE]: {
14462
+ name: TrustMemberGuidanceLabel.TRUSTEE,
14463
+ className: "adl-tag--light-blue"
14464
+ }
14465
+ };
14466
+ const getRoleTagColor = (role2) => {
14467
+ var _a;
14468
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.className) ?? "adl-tag--blue";
14469
+ };
14470
+ const getRoleName = (role2) => {
14471
+ var _a;
14472
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.name) ?? role2;
14473
+ };
14474
+ const makeSelectItemForRole = (role2, i18n) => {
14475
+ const metadata = roleMetadata[role2];
14476
+ if (!metadata)
14477
+ throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
14478
+ const {
14479
+ name,
14480
+ description: description2,
14481
+ className
14482
+ } = metadata;
14483
+ return {
14484
+ id: role2,
14485
+ name: i18n.get(name),
14486
+ description: description2 ? i18n.get(description2) : void 0,
14487
+ className
14488
+ };
14489
+ };
14490
+ const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14491
+ if (propagationMode === "stop")
14492
+ event.stopPropagation();
14493
+ if (keys.includes(event.key)) {
14494
+ if (propagationMode === "stopIfMatches")
14842
14495
  event.stopPropagation();
14843
14496
  callback();
14844
14497
  }
@@ -14909,19 +14562,10 @@ const DecisionMakerRoleComponent = (props) => {
14909
14562
  defaultData: dataProp,
14910
14563
  fieldProblems: fieldValidationErrors
14911
14564
  });
14912
- const [decisionMakerRoles2, setDecisionMakerRoles] = useState([]);
14913
14565
  const stateRef = useRef({
14914
14566
  setState: null
14915
14567
  });
14916
14568
  const formUtils = formUtilities(props, i18n);
14917
- const allowedRolesString = allowedRoles == null ? void 0 : allowedRoles.toString();
14918
- const makeSelectItemForDecisionMakerRole = (role2) => {
14919
- const validRole = decisionMakerRoles2.find((item) => item.id === role2);
14920
- return {
14921
- ...validRole,
14922
- disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(validRole == null ? void 0 : validRole.id))
14923
- };
14924
- };
14925
14569
  const changeRoles = (roles) => {
14926
14570
  handleChangeFor("role", "input")(roles);
14927
14571
  };
@@ -14939,9 +14583,6 @@ const DecisionMakerRoleComponent = (props) => {
14939
14583
  }
14940
14584
  });
14941
14585
  }, [data, valid, errors, isValid, dataStoreId, fieldProblems]);
14942
- useEffect(() => {
14943
- setDecisionMakerRoles(getTranslatedDecisionMakerRoles(i18n, allowedRoles));
14944
- }, [allowedRoles, allowedRolesString, i18n, i18n.languageCode, i18n.locale]);
14945
14586
  return jsxs("div", {
14946
14587
  className: "adyen-kyc-field__role",
14947
14588
  children: [jsx(StateContextSetter, {
@@ -14958,7 +14599,10 @@ const DecisionMakerRoleComponent = (props) => {
14958
14599
  options: allowedRoles ?? [],
14959
14600
  selected: data.role ?? [],
14960
14601
  onSelect: changeRoles,
14961
- mapToSelectItem: makeSelectItemForDecisionMakerRole
14602
+ mapToSelectItem: (role2) => ({
14603
+ ...makeSelectItemForRole(role2, i18n),
14604
+ disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(role2))
14605
+ })
14962
14606
  })
14963
14607
  })]
14964
14608
  });
@@ -15101,7 +14745,7 @@ const personalDetailsValidationRules = {
15101
14745
  errorMessage: "fieldIsRequired"
15102
14746
  }, {
15103
14747
  modes: ["blur"],
15104
- validate: (birthDate2) => birthDate2 && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14748
+ validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
15105
14749
  errorMessage: "invalidDateOfBirth"
15106
14750
  }],
15107
14751
  residencyCountry: {
@@ -16623,13 +16267,9 @@ const refreshSession = async () => {
16623
16267
  };
16624
16268
  const addAnimationStartListener = (element, listener) => {
16625
16269
  element.addEventListener("animationstart", listener, false);
16626
- element.addEventListener("MSAnimationStart", listener, false);
16627
- element.addEventListener("webkitAnimationStart", listener, false);
16628
16270
  };
16629
16271
  const removeAnimationStartListener = (element, listener) => {
16630
16272
  element.removeEventListener("animationstart", listener, false);
16631
- element.removeEventListener("MSAnimationStart", listener, false);
16632
- element.removeEventListener("webkitAnimationStart", listener, false);
16633
16273
  };
16634
16274
  const logger$g = createLogger("Fetch");
16635
16275
  const getRequestObject = (options, data) => {
@@ -16766,6 +16406,8 @@ const httpDelete = async (options, data) => http({
16766
16406
  }, data);
16767
16407
  const removeElementSiblings = (element) => {
16768
16408
  const parent = element.parentNode;
16409
+ if (!parent)
16410
+ return;
16769
16411
  let child = parent.firstChild;
16770
16412
  while (child) {
16771
16413
  if (child !== element)
@@ -17471,7 +17113,8 @@ function BankAccountNumber(props) {
17471
17113
  maskedFields: props.maskedFields
17472
17114
  });
17473
17115
  useEffect(() => {
17474
- stateRef.current.setState({
17116
+ var _a, _b;
17117
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17475
17118
  type: "addToState",
17476
17119
  value: {
17477
17120
  data,
@@ -17535,7 +17178,8 @@ function BankCity(props) {
17535
17178
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17536
17179
  });
17537
17180
  useEffect(() => {
17538
- stateRef.current.setState({
17181
+ var _a, _b;
17182
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17539
17183
  type: "addToState",
17540
17184
  value: {
17541
17185
  data,
@@ -17598,7 +17242,8 @@ function BankCode(props) {
17598
17242
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17599
17243
  });
17600
17244
  useEffect(() => {
17601
- stateRef.current.setState({
17245
+ var _a, _b;
17246
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17602
17247
  type: "addToState",
17603
17248
  value: {
17604
17249
  data,
@@ -17661,7 +17306,8 @@ function BankName(props) {
17661
17306
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17662
17307
  });
17663
17308
  useEffect(() => {
17664
- stateRef.current.setState({
17309
+ var _a, _b;
17310
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17665
17311
  type: "addToState",
17666
17312
  value: {
17667
17313
  data,
@@ -17724,7 +17370,8 @@ function BranchCode(props) {
17724
17370
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17725
17371
  });
17726
17372
  useEffect(() => {
17727
- stateRef.current.setState({
17373
+ var _a, _b;
17374
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17728
17375
  type: "addToState",
17729
17376
  value: {
17730
17377
  data,
@@ -17978,7 +17625,8 @@ function SwiftCode(props) {
17978
17625
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17979
17626
  });
17980
17627
  useEffect(() => {
17981
- stateRef.current.setState({
17628
+ var _a, _b;
17629
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17982
17630
  type: "addToState",
17983
17631
  value: {
17984
17632
  data,
@@ -19090,93 +18738,414 @@ const solePropForms = {
19090
18738
  fields: ["constitutionalDocument"]
19091
18739
  }
19092
18740
  };
19093
- const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
19094
- const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
19095
- const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
19096
- const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
19097
- function SolePropComponent(props) {
19098
- const {
19099
- i18n
19100
- } = useI18nContext();
19101
- const {
19102
- isExperimentEnabled
19103
- } = useExperimentsContext();
19104
- const [tradingName2, setTradingName] = useState();
19105
- const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
19106
- const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
19107
- const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
19108
- const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
19109
- const handleStateChange = ({
19110
- currentState
19111
- }) => {
19112
- var _a, _b, _c;
19113
- const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
19114
- setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
19115
- };
19116
- const renderActiveForm = (activeForm) => {
19117
- var _a;
19118
- return jsxs(Fragment, {
19119
- children: [jsx(StateContextWatcher, {
19120
- owner: "SolePropComponent",
19121
- onChange: handleStateChange
19122
- }), jsx("div", {
19123
- className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
19124
- children: jsx(CompanyNameAndCountryComponent, {
19125
- ...solePropNameAndCountryFormProps,
19126
- data: {
19127
- ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
19128
- country: props == null ? void 0 : props.country,
19129
- legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
19130
- },
19131
- labels: {
19132
- country: "countryOfEstablishment",
19133
- legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
19134
- },
19135
- heading: i18n.get("nameAndCountry"),
19136
- id: solePropNameAndCountryFormId,
19137
- disableCountry: true,
19138
- isTopLevelEntity: false
19139
- })
19140
- }), jsx("div", {
19141
- className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
19142
- children: jsx(CompanyRegistrationDetailsComponent, {
19143
- ...solePropsRegistrationDetailsFormProps,
19144
- data: {
19145
- ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
19146
- tradingName: tradingName2
19147
- },
19148
- heading: i18n.get("registrationDetails"),
19149
- id: solePropRegistrationDetailsFormId,
19150
- companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
19151
- country: props.country
19152
- })
19153
- }), jsx("div", {
19154
- className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
19155
- children: jsx(RegistrationAddressComponent, {
19156
- ...solePropRegistrationAddressFormProps,
19157
- heading: i18n.get("registeredAddress"),
19158
- id: solePropRegistrationAddressFormId,
19159
- country: props.country,
19160
- problems: props == null ? void 0 : props.problems,
19161
- handleAddressSearch: props.handleAddressSearch,
19162
- handleFindAddress: props.handleFindAddress
19163
- })
19164
- }), jsx("div", {
19165
- className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
19166
- children: jsx(ConstitutionalDocumentUpload, {
19167
- ...solePropDocumentsFormProps,
19168
- id: solePropDocumentFormId,
19169
- legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
19170
- })
19171
- })]
19172
- });
19173
- };
19174
- return jsx("div", {
19175
- className: "adyen-kyc-sol-prop",
19176
- children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18741
+ const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
18742
+ const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
18743
+ const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
18744
+ const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
18745
+ function SolePropComponent(props) {
18746
+ const {
18747
+ i18n
18748
+ } = useI18nContext();
18749
+ const {
18750
+ isExperimentEnabled
18751
+ } = useExperimentsContext();
18752
+ const [tradingName2, setTradingName] = useState();
18753
+ const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18754
+ const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
18755
+ const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
18756
+ const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
18757
+ const handleStateChange = ({
18758
+ currentState
18759
+ }) => {
18760
+ var _a, _b, _c;
18761
+ const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18762
+ setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18763
+ };
18764
+ const renderActiveForm = (activeForm) => {
18765
+ var _a;
18766
+ return jsxs(Fragment, {
18767
+ children: [jsx(StateContextWatcher, {
18768
+ owner: "SolePropComponent",
18769
+ onChange: handleStateChange
18770
+ }), jsx("div", {
18771
+ className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18772
+ children: jsx(CompanyNameAndCountryComponent, {
18773
+ ...solePropNameAndCountryFormProps,
18774
+ data: {
18775
+ ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18776
+ country: props == null ? void 0 : props.country,
18777
+ legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18778
+ },
18779
+ labels: {
18780
+ country: "countryOfEstablishment",
18781
+ legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18782
+ },
18783
+ heading: i18n.get("nameAndCountry"),
18784
+ id: solePropNameAndCountryFormId,
18785
+ disableCountry: true,
18786
+ isTopLevelEntity: false
18787
+ })
18788
+ }), jsx("div", {
18789
+ className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18790
+ children: jsx(CompanyRegistrationDetailsComponent, {
18791
+ ...solePropsRegistrationDetailsFormProps,
18792
+ data: {
18793
+ ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18794
+ tradingName: tradingName2
18795
+ },
18796
+ heading: i18n.get("registrationDetails"),
18797
+ id: solePropRegistrationDetailsFormId,
18798
+ companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18799
+ country: props.country
18800
+ })
18801
+ }), jsx("div", {
18802
+ className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18803
+ children: jsx(RegistrationAddressComponent, {
18804
+ ...solePropRegistrationAddressFormProps,
18805
+ heading: i18n.get("registeredAddress"),
18806
+ id: solePropRegistrationAddressFormId,
18807
+ country: props.country,
18808
+ problems: props == null ? void 0 : props.problems,
18809
+ handleAddressSearch: props.handleAddressSearch,
18810
+ handleFindAddress: props.handleFindAddress
18811
+ })
18812
+ }), jsx("div", {
18813
+ className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18814
+ children: jsx(ConstitutionalDocumentUpload, {
18815
+ ...solePropDocumentsFormProps,
18816
+ id: solePropDocumentFormId,
18817
+ legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18818
+ })
18819
+ })]
18820
+ });
18821
+ };
18822
+ return jsx("div", {
18823
+ className: "adyen-kyc-sol-prop",
18824
+ children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18825
+ });
18826
+ }
18827
+ const Trust = "";
18828
+ var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18829
+ TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
18830
+ TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
18831
+ TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
18832
+ TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
18833
+ TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
18834
+ TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
18835
+ TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
18836
+ TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
18837
+ TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
18838
+ TrustTypes2["FAMILY_TRUST"] = "familyTrust";
18839
+ TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
18840
+ TrustTypes2["FIXED_TRUST"] = "fixedTrust";
18841
+ TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
18842
+ TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
18843
+ TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
18844
+ TrustTypes2["OTHER_TRUST"] = "otherTrust";
18845
+ TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
18846
+ TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
18847
+ TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
18848
+ return TrustTypes2;
18849
+ })(TrustTypes || {});
18850
+ const trustTypeOptions = [{
18851
+ id: TrustTypes.BUSINESS_TRUST,
18852
+ name: "businessTrust"
18853
+ }, {
18854
+ id: TrustTypes.CASH_MANAGEMENT_TRUST,
18855
+ name: "cashManagementTrust"
18856
+ }, {
18857
+ id: TrustTypes.CHARITABLE_TRUST,
18858
+ name: "charitableTrust"
18859
+ }, {
18860
+ id: TrustTypes.CORPORATE_UNIT_TRUST,
18861
+ name: "corporateUnitTrust"
18862
+ }, {
18863
+ id: TrustTypes.DECEASED_ESTATE,
18864
+ name: "deceasedEstate"
18865
+ }, {
18866
+ id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
18867
+ name: "discretionaryInvestmentTrust"
18868
+ }, {
18869
+ id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
18870
+ name: "discretionaryServicesManagementTrust"
18871
+ }, {
18872
+ id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
18873
+ name: "discretionaryTradingTrust"
18874
+ }, {
18875
+ id: TrustTypes.DISCRETIONARY_TRUST,
18876
+ name: "discretionaryTrust"
18877
+ }, {
18878
+ id: TrustTypes.FAMILY_TRUST,
18879
+ name: "familyTrust"
18880
+ }, {
18881
+ id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
18882
+ name: "firstHomeSaverAccountsTrust"
18883
+ }, {
18884
+ id: TrustTypes.FIXED_TRUST,
18885
+ name: "fixedTrust"
18886
+ }, {
18887
+ id: TrustTypes.FIXED_UNIT_TRUST,
18888
+ name: "fixedUnitTrust"
18889
+ }, {
18890
+ id: TrustTypes.HYBRID_TRUST,
18891
+ name: "hybridTrust"
18892
+ }, {
18893
+ id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
18894
+ name: "listedPublicUnitTrust"
18895
+ }, {
18896
+ id: TrustTypes.OTHER_TRUST,
18897
+ name: "otherTrust"
18898
+ }, {
18899
+ id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
18900
+ name: "pooledSuperannuationTrust"
18901
+ }, {
18902
+ id: TrustTypes.PUBLIC_TRADING_TRUST,
18903
+ name: "publicTradingTrust"
18904
+ }, {
18905
+ id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
18906
+ name: "unlistedPublicUnitTrust"
18907
+ }];
18908
+ const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
18909
+ 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];
18910
+ const countryToTrustTypes = {
18911
+ [CountryCodes.Australia]: auSpecificTrustTypes,
18912
+ [CountryCodes.NewZealand]: nzSpecificTrustTypes
18913
+ };
18914
+ const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
18915
+ roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
18916
+ min: 1,
18917
+ max: Infinity
18918
+ }, {
18919
+ roleTypes: [DecisionMakerType.OWNER],
18920
+ min: 0,
18921
+ max: 4
18922
+ }, {
18923
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18924
+ min: 0,
18925
+ max: Infinity
18926
+ }, {
18927
+ roleTypes: [DecisionMakerType.SIGNATORY],
18928
+ min: 1,
18929
+ max: Infinity
18930
+ }];
18931
+ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
18932
+ US: [{
18933
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18934
+ min: 1,
18935
+ max: Infinity
18936
+ }, {
18937
+ roleTypes: [DecisionMakerType.OWNER],
18938
+ min: 0,
18939
+ max: 4
18940
+ }, {
18941
+ roleTypes: [DecisionMakerType.SIGNATORY],
18942
+ min: 1,
18943
+ max: Infinity
18944
+ }],
18945
+ BR: [{
18946
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18947
+ min: 1,
18948
+ max: Infinity
18949
+ }, {
18950
+ roleTypes: [DecisionMakerType.OWNER],
18951
+ min: 0,
18952
+ max: 4
18953
+ }, {
18954
+ roleTypes: [DecisionMakerType.SIGNATORY],
18955
+ min: 1,
18956
+ max: Infinity
18957
+ }],
18958
+ AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18959
+ roleTypes: [DecisionMakerType.DIRECTOR],
18960
+ min: 3,
18961
+ max: Infinity
18962
+ }],
18963
+ CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18964
+ roleTypes: [DecisionMakerType.DIRECTOR],
18965
+ min: 1,
18966
+ max: Infinity
18967
+ }],
18968
+ HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18969
+ roleTypes: [DecisionMakerType.DIRECTOR],
18970
+ min: 1,
18971
+ max: Infinity
18972
+ }],
18973
+ IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18974
+ roleTypes: [DecisionMakerType.DIRECTOR],
18975
+ min: 3,
18976
+ max: 15
18977
+ }],
18978
+ NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18979
+ roleTypes: [DecisionMakerType.DIRECTOR],
18980
+ min: 1,
18981
+ max: Infinity
18982
+ }],
18983
+ SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18984
+ roleTypes: [DecisionMakerType.DIRECTOR],
18985
+ min: 1,
18986
+ max: Infinity
18987
+ }]
18988
+ };
18989
+ const getDecisionMakerRequirements = (country2) => {
18990
+ if (!country2)
18991
+ return DEFAULT_DECISION_MAKER_REQUIREMENTS;
18992
+ return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
18993
+ };
18994
+ function getAvailableDecisionMakerRoleTypes(country2) {
18995
+ const requirements2 = getDecisionMakerRequirements(country2);
18996
+ return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
18997
+ roleType: req.roleTypes[0],
18998
+ min: req.min,
18999
+ max: req.max
19000
+ }));
19001
+ }
19002
+ const DEFAULT_DESCRIPTIONS_MAP = {
19003
+ [DecisionMakerType.OWNER]: "provideAllOwners",
19004
+ [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
19005
+ [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
19006
+ [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
19007
+ };
19008
+ const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
19009
+ US: {
19010
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
19011
+ },
19012
+ BR: {
19013
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
19014
+ }
19015
+ };
19016
+ const getDecisionMakerDescriptionMap = (country2) => ({
19017
+ ...DEFAULT_DESCRIPTIONS_MAP,
19018
+ ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
19019
+ });
19020
+ const getOwnDecisionMakers = (rootLegalEntity) => {
19021
+ if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
19022
+ return [];
19023
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
19024
+ };
19025
+ const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
19026
+ const getOwnSignatories = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
19027
+ const getOwnDecisionMakersLegalEntityIds = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
19028
+ const getDecisionMakerCount = (rootLegalEntity) => {
19029
+ const decisionMakers2 = getOwnDecisionMakers(rootLegalEntity);
19030
+ return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
19031
+ decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
19032
+ return decisionMakerCount;
19033
+ }, {});
19034
+ };
19035
+ const getAllowedDecisionMakerRoles = (rootLegalEntity, taskType) => {
19036
+ var _a, _b;
19037
+ if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
19038
+ return [DecisionMakerType.OWNER];
19039
+ }
19040
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
19041
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
19042
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
19043
+ const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
19044
+ const {
19045
+ roleTypes,
19046
+ max
19047
+ } = requirements2;
19048
+ if (roleTypes.length === 1) {
19049
+ const role2 = roleTypes[0];
19050
+ const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
19051
+ if (isBelowMaxRange) {
19052
+ acc.push(role2);
19053
+ }
19054
+ }
19055
+ return acc;
19056
+ }, []);
19057
+ const uniqueAllowedRoles = [...new Set(allowedRoles)];
19058
+ return uniqueAllowedRoles;
19059
+ };
19060
+ const hasMinRequiredDecisionMakerCount = (rootLegalEntity) => {
19061
+ var _a, _b;
19062
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
19063
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
19064
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
19065
+ return decisionMakerCountRange.every((requirements2) => {
19066
+ const {
19067
+ roleTypes,
19068
+ min
19069
+ } = requirements2;
19070
+ return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
19071
+ });
19072
+ };
19073
+ const TRUST_MEMBER_COUNT_RANGE = {
19074
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
19075
+ min: 1
19076
+ },
19077
+ [TrustMemberTypes.SETTLOR]: {
19078
+ min: 1
19079
+ }
19080
+ };
19081
+ const isPartOfTrustFromLegalEntity = (legalEntity) => {
19082
+ var _a;
19083
+ return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
19084
+ };
19085
+ const getTrustLegalEntityId = (rootLegalEntity) => {
19086
+ var _a;
19087
+ if (!rootLegalEntity.entityAssociations)
19088
+ return void 0;
19089
+ return (_a = rootLegalEntity.entityAssociations.find((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)) == null ? void 0 : _a.legalEntityId;
19090
+ };
19091
+ const getOwnTrustMembers = (rootLegalEntity) => {
19092
+ const trustLegalEntityId = getTrustLegalEntityId(rootLegalEntity);
19093
+ if (!trustLegalEntityId || !rootLegalEntity.entityAssociations)
19094
+ return [];
19095
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && trustLegalEntityId === entityAssociation.associatorId);
19096
+ };
19097
+ const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
19098
+ const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
19099
+ if (!trustLegalEntityId)
19100
+ return [];
19101
+ const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
19102
+ const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
19103
+ return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
19104
+ };
19105
+ const getTrustMemberCompanyDecisionMakerIds = (rootLegalEntity, trustMemberCompanyId) => {
19106
+ const decisionMakerAssociations = getDecisionMakers(rootLegalEntity, trustMemberCompanyId);
19107
+ return decisionMakerAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
19108
+ };
19109
+ const getOwnTrustLegalEntityId = (legalEntity) => {
19110
+ var _a, _b;
19111
+ 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;
19112
+ };
19113
+ const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
19114
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
19115
+ return trustLegalEntityId ? [trustLegalEntityId] : [];
19116
+ };
19117
+ const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
19118
+ var _a;
19119
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
19120
+ if (trustLegalEntityId) {
19121
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
19122
+ }
19123
+ };
19124
+ const getTrustMemberCount = (rootLegalEntity) => {
19125
+ const trustMembers2 = getOwnTrustMembers(rootLegalEntity);
19126
+ return trustMembers2.reduce((trustMemberCount, trustMember) => {
19127
+ trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
19128
+ return trustMemberCount;
19129
+ }, {});
19130
+ };
19131
+ const hasMinRequiredTrustMemberCount = (rootLegalEntity) => {
19132
+ const existingTrustMemberCount = getTrustMemberCount(rootLegalEntity);
19133
+ const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
19134
+ return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
19135
+ };
19136
+ const getCountrySpecificTrustTypeOptions = (country2) => {
19137
+ const countrySpecificTrustTypes = countryToTrustTypes[country2];
19138
+ if (!countrySpecificTrustTypes) {
19139
+ return [];
19140
+ }
19141
+ return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
19142
+ const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
19143
+ if (!countrySpecificTrustTypeOption) {
19144
+ throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
19145
+ }
19146
+ return countrySpecificTrustTypeOption;
19177
19147
  });
19178
- }
19179
- const Trust = "";
19148
+ };
19180
19149
  const ContextHelper$1 = "";
19181
19150
  const ContextHelper = ({
19182
19151
  content
@@ -20643,7 +20612,7 @@ const nationality = {
20643
20612
  }
20644
20613
  };
20645
20614
  const fieldsPerScenario$1 = {
20646
- L0: drop(["address", "birthDate"]).from(identityBase),
20615
+ L0: drop("address", "birthDate").from(identityBase),
20647
20616
  L1: identityBase,
20648
20617
  L1_ID: {
20649
20618
  ...identityBase,
@@ -20806,6 +20775,12 @@ const countryConfig = {
20806
20775
  registrationNumber: {
20807
20776
  label: "NZBN"
20808
20777
  }
20778
+ },
20779
+ [CountryCodes.Croatia]: {
20780
+ ...countryConfig$4[CountryCodes.Croatia],
20781
+ registrationNumber: {
20782
+ label: "MBO"
20783
+ }
20809
20784
  }
20810
20785
  };
20811
20786
  function parseIndividualScenarios(scenario, country2) {
@@ -21537,7 +21512,7 @@ function CompanyDropinComponent({
21537
21512
  });
21538
21513
  onChange == null ? void 0 : onChange(currentState);
21539
21514
  }, [currentState]);
21540
- const isSkippingCompanyStructure = useEnableNewEntryFlow() && accountHolder2 === "incorporatedPartnership";
21515
+ const isSkippingCompanyStructure = useEnableNewEntryFlow() && accountHolder2 === "partnershipIncorporated";
21541
21516
  const forms = useMemo(() => {
21542
21517
  const requiredForms = getRequiredForms(companyForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
21543
21518
  const validityAddedForms = addValidityToForms(requiredForms, formValidity, problems);
@@ -21947,6 +21922,8 @@ const useExemptSettlor = ({
21947
21922
  setExemptSettlor(exemptSettlorLE);
21948
21923
  }, [handleGetLegalEntity]);
21949
21924
  useEffect(() => {
21925
+ if (!trust2)
21926
+ return;
21950
21927
  updateExemptSettlor(trust2).catch(logger$a.error);
21951
21928
  }, [trust2, updateExemptSettlor]);
21952
21929
  return exemptSettlor;
@@ -21987,7 +21964,7 @@ const base64ToBlob = (base64, mimeType = "application/octet-stream") => {
21987
21964
  });
21988
21965
  };
21989
21966
  const saveBlobAsFile = (fileData, filename) => {
21990
- if (typeof window.navigator.msSaveBlob !== "undefined") {
21967
+ if ("msSaveBlob" in window.navigator && typeof window.navigator.msSaveBlob === "function") {
21991
21968
  window.navigator.msSaveBlob(fileData, filename);
21992
21969
  } else {
21993
21970
  const blobUrl = window.URL.createObjectURL(fileData);
@@ -22438,6 +22415,53 @@ function Toast({
22438
22415
  })]
22439
22416
  });
22440
22417
  }
22418
+ const getBusinessType = (businessTypeItems, accountHolder2, legalEntityType, companyTypesValue) => {
22419
+ const legalArrangementSuboptions = ["partnershipIncorporated"];
22420
+ const findBusinessType = (id2) => businessTypes.find((bt) => bt.id === id2);
22421
+ if (legalArrangementSuboptions.includes(companyTypesValue ?? "")) {
22422
+ return findBusinessType("legalArrangement");
22423
+ }
22424
+ if (accountHolder2) {
22425
+ if (["aTrust", "partnershipUnincorporated", "anAssociation"].includes(accountHolder2)) {
22426
+ return findBusinessType("legalArrangement");
22427
+ }
22428
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22429
+ }
22430
+ switch (legalEntityType) {
22431
+ case LegalEntityType.ORGANIZATION:
22432
+ return findBusinessType("company");
22433
+ case LegalEntityType.INDIVIDUAL:
22434
+ return findBusinessType("individual");
22435
+ }
22436
+ };
22437
+ const mapLegalArrangementOptionToCompanyTypesValue = (legalArrangement) => {
22438
+ switch (legalArrangement) {
22439
+ case "partnershipIncorporated":
22440
+ return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
22441
+ default:
22442
+ return "";
22443
+ }
22444
+ };
22445
+ const mapCompanyTypesValueToLegalArrangementOption = (companyTypesValue) => {
22446
+ switch (companyTypesValue) {
22447
+ case CompanyTypesValue.INCORPORATED_PARTNERSHIP:
22448
+ return "partnershipIncorporated";
22449
+ default:
22450
+ return void 0;
22451
+ }
22452
+ };
22453
+ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22454
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22455
+ return LegalEntityType.ORGANIZATION;
22456
+ }
22457
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22458
+ return LegalEntityType.INDIVIDUAL;
22459
+ }
22460
+ if (legalArrangement === "partnershipIncorporated") {
22461
+ return LegalEntityType.ORGANIZATION;
22462
+ }
22463
+ return currentLegalEntityType;
22464
+ };
22441
22465
  const businessTypes = [{
22442
22466
  id: "individual",
22443
22467
  accountHolder: "myName",
@@ -22464,18 +22488,18 @@ const legalArrangementItems = [{
22464
22488
  name: "trust",
22465
22489
  description: "youAreTrusteeManagingTheTrustForBeneficiaries"
22466
22490
  }, {
22467
- id: "incorporatedPartnership",
22468
- accountHolder: "incorporatedPartnership",
22491
+ id: "partnershipIncorporated",
22492
+ accountHolder: "theCompanyIWorkFor",
22469
22493
  name: "incorporatedPartnership",
22470
- description: "incorporatedPartnershipNewEntryFlowDescription"
22494
+ description: "partnershipIncorporatedNewEntryFlowDescription"
22471
22495
  }, {
22472
- id: "unincorporatedPartnership",
22473
- accountHolder: "unincorporatedPartnership",
22496
+ id: "partnershipUnincorporated",
22497
+ accountHolder: "theCompanyIWorkFor",
22474
22498
  name: "unincorporatedPartnership",
22475
- description: "unincorporatedPartnershipNewEntryFlowDescription"
22499
+ description: "partnershipUnincorporatedNewEntryFlowDescription"
22476
22500
  }, {
22477
- id: "anAssociation",
22478
- accountHolder: "anAssociation",
22501
+ id: "associationIncorporated",
22502
+ accountHolder: "associationIncorporated",
22479
22503
  name: "associationIncorporatedTitle",
22480
22504
  description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
22481
22505
  }];
@@ -22537,20 +22561,6 @@ const businessTypeSelectionStepTitles = {
22537
22561
  /* CONFIRM_BUSINESS_SETUP_CHANGE */
22538
22562
  ]: "changeYourBusinessSetup"
22539
22563
  };
22540
- const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22541
- const isIndividual = currentLegalEntityType === LegalEntityType.INDIVIDUAL;
22542
- const isOrganization = currentLegalEntityType === LegalEntityType.ORGANIZATION;
22543
- if (isIndividual && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22544
- return LegalEntityType.ORGANIZATION;
22545
- }
22546
- if (isOrganization && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22547
- return LegalEntityType.INDIVIDUAL;
22548
- }
22549
- if (legalArrangement === "incorporatedPartnership") {
22550
- return LegalEntityType.ORGANIZATION;
22551
- }
22552
- return currentLegalEntityType;
22553
- };
22554
22564
  const BusinessTypeSelection = ({
22555
22565
  legalEntityResponse,
22556
22566
  accountHolder: accountHolder2,
@@ -22559,7 +22569,7 @@ const BusinessTypeSelection = ({
22559
22569
  onAccountHolderSelect,
22560
22570
  handleUpdateLegalEntity
22561
22571
  }) => {
22562
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
22572
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
22563
22573
  const {
22564
22574
  i18n
22565
22575
  } = useI18nContext();
@@ -22578,21 +22588,11 @@ const BusinessTypeSelection = ({
22578
22588
  /* WE_CANNOT_SET_UP_ACCOUNT */
22579
22589
  ].includes(currentStep);
22580
22590
  const businessTypeItems = getBusinessTypes(showTrustOption, showSolePropOption);
22581
- const getDefaultBusinessType = () => {
22582
- if (accountHolder2) {
22583
- if (["aTrust", "incorporatedPartnership", "unincorporatedPartnership", "anAssociation"].includes(accountHolder2)) {
22584
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "legalArrangement");
22585
- }
22586
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22587
- }
22588
- switch (legalEntityResponse.type) {
22589
- case LegalEntityType.ORGANIZATION:
22590
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "company");
22591
- case LegalEntityType.INDIVIDUAL:
22592
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "individual");
22593
- }
22594
- };
22595
- const getDefaultLegalArrangementType = () => accountHolder2 && legalArrangementItems.find((item) => item.accountHolder === accountHolder2);
22591
+ const currentLegalEntityType = legalEntityResponse == null ? void 0 : legalEntityResponse.type;
22592
+ const currentCompanyTypesValue = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
22593
+ const defaultBusinessType = getBusinessType(businessTypeItems, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
22594
+ const getDefaultLegalArrangementType = () => legalArrangementItems.find((item) => item.id === mapCompanyTypesValueToLegalArrangementOption(currentCompanyTypesValue));
22595
+ const defaultLegalArrangementType = getDefaultLegalArrangementType();
22596
22596
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
22597
22597
  const {
22598
22598
  handleChangeFor,
@@ -22604,20 +22604,23 @@ const BusinessTypeSelection = ({
22604
22604
  } = useForm({
22605
22605
  schema: formSchema,
22606
22606
  defaultData: {
22607
- businessType: getDefaultBusinessType(),
22608
- legalArrangement: getDefaultLegalArrangementType(),
22607
+ businessType: defaultBusinessType,
22608
+ legalArrangement: defaultLegalArrangementType,
22609
22609
  trusteeType: defaultTrusteeType
22610
22610
  },
22611
22611
  rules: businessTypeSelectionValidationRules
22612
22612
  });
22613
- const newAccountHolder = ((_a = data.businessType) == null ? void 0 : _a.accountHolder) || ((_b = data.legalArrangement) == null ? void 0 : _b.accountHolder);
22614
- 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);
22613
+ const newAccountHolder = ((_c = data.businessType) == null ? void 0 : _c.accountHolder) || ((_d = data.legalArrangement) == null ? void 0 : _d.accountHolder);
22614
+ const targetLegalArrangement = (_e = data.legalArrangement) == null ? void 0 : _e.id;
22615
+ 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);
22616
+ const isLegalEntityTypeChanging = currentLegalEntityType !== targetLegalEntityType;
22617
+ const isLegalArrangementChanging = currentCompanyTypesValue !== targetLegalArrangement;
22615
22618
  useEffect(() => {
22616
22619
  var _a2, _b2;
22617
22620
  setFormSchema(getFormSchema(((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement" && !!data.legalArrangement || currentStep === 1, ((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aTrust"));
22618
22621
  }, [data.businessType, data.legalArrangement, currentStep]);
22619
22622
  const handleNextClick = async () => {
22620
- var _a2, _b2;
22623
+ var _a2;
22621
22624
  if (loadingStatus === "loading")
22622
22625
  return;
22623
22626
  triggerValidation();
@@ -22630,8 +22633,7 @@ const BusinessTypeSelection = ({
22630
22633
  );
22631
22634
  return;
22632
22635
  }
22633
- const legalArrangementId = (_b2 = data.legalArrangement) == null ? void 0 : _b2.id;
22634
- if (legalArrangementId === "anAssociation" || legalArrangementId === "unincorporatedPartnership") {
22636
+ if (targetLegalArrangement === "associationIncorporated" || targetLegalArrangement === "partnershipUnincorporated") {
22635
22637
  setCurrentStep(
22636
22638
  2
22637
22639
  /* WE_CANNOT_SET_UP_ACCOUNT */
@@ -22639,49 +22641,46 @@ const BusinessTypeSelection = ({
22639
22641
  return;
22640
22642
  }
22641
22643
  }
22642
- }
22643
- if (newAccountHolder !== accountHolder2 || targetLegalEntityType !== legalEntityResponse.type) {
22644
- if (accountHolder2) {
22645
- setCurrentStep(
22646
- 3
22647
- /* CONFIRM_BUSINESS_SETUP_CHANGE */
22648
- );
22644
+ if (newAccountHolder !== accountHolder2 || isLegalEntityTypeChanging) {
22645
+ if (accountHolder2) {
22646
+ setCurrentStep(
22647
+ 3
22648
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22649
+ );
22650
+ return;
22651
+ }
22652
+ await updateLegalEntityAndSelectAccountHolder();
22649
22653
  } else {
22654
+ onAccountHolderSelect(newAccountHolder);
22655
+ }
22656
+ if (isLegalArrangementChanging) {
22650
22657
  await updateLegalEntityAndSelectAccountHolder();
22651
22658
  }
22652
- } else {
22653
- onAccountHolderSelect(newAccountHolder);
22654
22659
  }
22655
22660
  };
22656
22661
  const updateLegalEntityAndSelectAccountHolder = async () => {
22657
- var _a2;
22658
- const selectedLegalArrangement = (_a2 = data.legalArrangement) == null ? void 0 : _a2.id;
22659
22662
  try {
22660
- if (legalEntityResponse.type !== targetLegalEntityType) {
22663
+ if (isLegalEntityTypeChanging) {
22661
22664
  setLoadingStatus("loading");
22662
22665
  const updateLegalEntityPayload = {
22663
22666
  type: targetLegalEntityType
22664
22667
  };
22665
22668
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22666
- if (selectedLegalArrangement === "incorporatedPartnership") {
22667
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22668
- type: LegalEntityType.ORGANIZATION
22669
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22670
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22671
- organization: {
22672
- type: CompanyTypesValue.INCORPORATED_PARTNERSHIP
22673
- }
22674
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22675
- }
22676
- } else if (newAccountHolder !== accountHolder2) {
22677
- if (newAccountHolder === "theCompanyIWorkFor") {
22669
+ if (targetLegalEntityType === LegalEntityType.ORGANIZATION && targetLegalEntityType) {
22678
22670
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22679
22671
  organization: {
22680
- type: ""
22672
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22681
22673
  }
22682
22674
  }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22683
22675
  }
22684
22676
  }
22677
+ if (isLegalArrangementChanging) {
22678
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22679
+ organization: {
22680
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22681
+ }
22682
+ }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22683
+ }
22685
22684
  } catch (e) {
22686
22685
  showToast({
22687
22686
  label: i18n.get("failedToUpdateDetails"),
@@ -22713,15 +22712,19 @@ const BusinessTypeSelection = ({
22713
22712
  showSpinner: false,
22714
22713
  children: jsxs("div", {
22715
22714
  className: "adyen-kyc-business-type-selection",
22716
- children: [jsx("header", {
22717
- children: jsx(Heading, {
22715
+ children: [jsxs("header", {
22716
+ className: "adl-u-margin-bottom-32",
22717
+ children: [jsx(Heading, {
22718
22718
  level: 1,
22719
22719
  children: i18n.get(businessTypeSelectionStepTitles[currentStep])
22720
- })
22720
+ }), currentStep === 3 && jsx(Heading, {
22721
+ level: "sub",
22722
+ children: i18n.get("someInformationWillNotBeSaved")
22723
+ })]
22721
22724
  }), currentStep === 0 && jsx(Field, {
22722
22725
  name: "businessType",
22723
22726
  useLabelElement: false,
22724
- errorMessage: i18n.get((_f = errors.businessType) == null ? void 0 : _f.errorMessage),
22727
+ errorMessage: i18n.get((_i = errors.businessType) == null ? void 0 : _i.errorMessage),
22725
22728
  showErrorIconBottom: true,
22726
22729
  isValid: valid.businessType,
22727
22730
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22738,7 +22741,7 @@ const BusinessTypeSelection = ({
22738
22741
  children: [jsx(Field, {
22739
22742
  name: "legalArrangement",
22740
22743
  useLabelElement: false,
22741
- errorMessage: i18n.get((_g = errors.legalArrangement) == null ? void 0 : _g.errorMessage),
22744
+ errorMessage: i18n.get((_j = errors.legalArrangement) == null ? void 0 : _j.errorMessage),
22742
22745
  showErrorIconBottom: true,
22743
22746
  isValid: valid.legalArrangement,
22744
22747
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22751,18 +22754,17 @@ const BusinessTypeSelection = ({
22751
22754
  }),
22752
22755
  onSelect: (item) => handleChangeFor("legalArrangement")(item)
22753
22756
  })
22754
- }), ((_h = data.legalArrangement) == null ? void 0 : _h.id) === "aTrust" && jsx(Field, {
22757
+ }), ((_k = data.legalArrangement) == null ? void 0 : _k.id) === "aTrust" && jsx(Field, {
22755
22758
  name: "trusteeType",
22756
22759
  label: i18n.get("whatTypeOfTrusteeAreYou"),
22757
22760
  className: "adl-u-margin-top-32",
22758
22761
  useLabelElement: false,
22759
- errorMessage: i18n.get((_i = errors.trusteeType) == null ? void 0 : _i.errorMessage),
22762
+ errorMessage: i18n.get((_l = errors.trusteeType) == null ? void 0 : _l.errorMessage),
22760
22763
  showErrorIconBottom: true,
22761
22764
  isValid: valid.trusteeType,
22762
22765
  children: (childProps) => jsx(RadioGroupCard, {
22763
- className: "adyen-kyc-trustee-type-radio-group-card",
22764
- itemLabelClassName: () => "adl-u-width-full",
22765
22766
  ...childProps,
22767
+ className: "adyen-kyc-trustee-type-radio-group-card",
22766
22768
  name: "trusteeType",
22767
22769
  items: trusteeTypeItems,
22768
22770
  selected: trusteeTypeItems.find((type) => {
@@ -22779,24 +22781,20 @@ const BusinessTypeSelection = ({
22779
22781
  className: "u-margin-top-32",
22780
22782
  children: i18n.get("needHelpYouCanAlwaysReachOutToCustomerSupport")
22781
22783
  })]
22782
- }), currentStep === 3 ? jsxs(Fragment, {
22783
- children: [jsx("p", {
22784
- children: i18n.get("someInformationWillNotBeSaved")
22785
- }), jsxs("div", {
22786
- className: "adyen-kyc-business-type-selection__confirm",
22787
- children: [jsx(Button, {
22788
- label: i18n.get("cancel"),
22789
- secondary: true,
22790
- onClick: () => setCurrentStep(
22791
- 0
22792
- /* BUSINESS_TYPE_SELECTION */
22793
- ),
22794
- type: "button"
22795
- }), jsx(Button, {
22796
- label: i18n.get("yesChange"),
22797
- onClick: () => updateLegalEntityAndSelectAccountHolder(),
22798
- type: "button"
22799
- })]
22784
+ }), currentStep === 3 ? jsxs("div", {
22785
+ className: "adyen-kyc-business-type-selection__confirm",
22786
+ children: [jsx(Button, {
22787
+ label: i18n.get("cancel"),
22788
+ secondary: true,
22789
+ onClick: () => setCurrentStep(
22790
+ 0
22791
+ /* BUSINESS_TYPE_SELECTION */
22792
+ ),
22793
+ type: "button"
22794
+ }), jsx(Button, {
22795
+ label: i18n.get("yesChange"),
22796
+ onClick: () => updateLegalEntityAndSelectAccountHolder(),
22797
+ type: "button"
22800
22798
  })]
22801
22799
  }) : jsxs("div", {
22802
22800
  className: "adyen-kyc-business-type-selection__nav",
@@ -22861,18 +22859,6 @@ const iconStatus = (current, min, max) => {
22861
22859
  }
22862
22860
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22863
22861
  };
22864
- const entityStatusRoles = {
22865
- ...decisionMakerRoles,
22866
- ...trustMemberGuidanceRoles
22867
- };
22868
- const getEntityStatusTagColor = (entityLabel) => {
22869
- var _a;
22870
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22871
- };
22872
- const getEntityStatusName = (entityLabel) => {
22873
- var _a;
22874
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22875
- };
22876
22862
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22877
22863
  const _cardGroup_component = "";
22878
22864
  function CardGroup({
@@ -23301,9 +23287,9 @@ const EntityAssociation = ({
23301
23287
  })]
23302
23288
  }), jsx("div", {
23303
23289
  children: types.map((type) => jsx(Tag, {
23304
- className: `adl-entity-association__tag ${getEntityAssociationTagColor(type)}`,
23290
+ className: `adl-entity-association__tag ${getRoleTagColor(type)}`,
23305
23291
  isBasic: true,
23306
- children: i18n.get(getEntityAssociationName(type))
23292
+ children: i18n.get(getRoleName(type))
23307
23293
  }, type))
23308
23294
  }), status === TaskStatus.ERROR && jsx(VerificationErrorAlert, {
23309
23295
  className: "adl-entity-association-alert",
@@ -23391,9 +23377,9 @@ const EntityGuidanceStatus = ({
23391
23377
  children: [jsx(EntityStatusIcon, {
23392
23378
  status
23393
23379
  }), jsx(Tag, {
23394
- className: `adl-entity-status__tag ${getEntityStatusTagColor(entityLabel)}`,
23380
+ className: `adl-entity-status__tag ${getRoleTagColor(entityLabel)}`,
23395
23381
  isBasic: true,
23396
- children: i18n.get(getEntityStatusName(entityLabel))
23382
+ children: i18n.get(getRoleName(entityLabel))
23397
23383
  }, entityLabel), jsx("span", {
23398
23384
  className: "adl-entity-status--text",
23399
23385
  "data-testid": `${entityLabel}-rule--description`,
@@ -23785,7 +23771,7 @@ function LegalEntityTypeSwitcher({
23785
23771
  const {
23786
23772
  i18n
23787
23773
  } = useI18nContext();
23788
- const [loadingStatus, setLoadingStatus] = useState(null);
23774
+ const [loadingStatus, setLoadingStatus] = useState();
23789
23775
  const {
23790
23776
  showToast
23791
23777
  } = useToastContext();
@@ -23836,7 +23822,7 @@ function LegalEntityTypeSwitcher({
23836
23822
  })]
23837
23823
  });
23838
23824
  default:
23839
- jsx("p", {
23825
+ return jsx("p", {
23840
23826
  children: "Change not supported"
23841
23827
  });
23842
23828
  }
@@ -23937,15 +23923,27 @@ const businessTypeMapping = {
23937
23923
  /* COMPANY_TRUSTEE */
23938
23924
  }
23939
23925
  };
23926
+ const companyTypesMapping = {
23927
+ [CompanyTypesValue.INCORPORATED_PARTNERSHIP]: "incorporatedPartnership",
23928
+ [CompanyTypesValue.PUBLIC_COMPANY]: "company",
23929
+ [CompanyTypesValue.PRIVATE_COMPANY]: "company",
23930
+ [CompanyTypesValue.UNLISTED_PUBLIC_COMPANY]: "company",
23931
+ [CompanyTypesValue.INCORPORATED_ASSOCIATION]: "company",
23932
+ [CompanyTypesValue.GOVERNMENTAL_ORGANIZATION]: "company",
23933
+ [CompanyTypesValue.NON_PROFIT_OR_CHARITABLE]: "company",
23934
+ [CompanyTypesValue.SOLE_PROPRIETORSHIP]: "soleProprietorship"
23935
+ /* SOLE_PROPRIETORSHIP */
23936
+ };
23940
23937
  const useBusinessSetup = (legalEntityResponse) => {
23941
- var _a;
23938
+ var _a, _b;
23942
23939
  const {
23943
23940
  accountHolder: accountHolder2
23944
23941
  } = useCoreContext();
23945
23942
  const accountHolderType = accountHolder2 || getDefaultAccountHolderType(legalEntityResponse);
23946
- const businessSetup = (_a = businessTypeMapping[accountHolderType]) == null ? void 0 : _a[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23943
+ const organizationType = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
23944
+ const businessSetup = accountHolderType === "theCompanyIWorkFor" && organizationType ? companyTypesMapping[organizationType] : (_b = businessTypeMapping[accountHolderType]) == null ? void 0 : _b[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23947
23945
  return {
23948
- businessSetup: businessSetup || accountHolder2
23946
+ businessSetup
23949
23947
  };
23950
23948
  };
23951
23949
  const hasPayoutAccount = (legalEntityResponse) => {
@@ -24863,11 +24861,12 @@ function IndividualDropinComponent({
24863
24861
  };
24864
24862
  const attachAssociationToParentLegalEntity = async ({
24865
24863
  legalEntity,
24864
+ parentLE,
24866
24865
  dataSubmitted
24867
24866
  }) => {
24868
24867
  var _a2;
24869
24868
  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;
24870
- const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
24869
+ const existingEntityAssociations = getOwnEntityAssociations(parentLE);
24871
24870
  if (newRoles && hasRolesChanged(legalEntity, existingEntityAssociations, newRoles)) {
24872
24871
  const updatedParentLegalEntity = {
24873
24872
  entityAssociations: [...newRoles.map((role2) => {
@@ -24879,7 +24878,7 @@ function IndividualDropinComponent({
24879
24878
  };
24880
24879
  }) || [], ...existingEntityAssociations.filter((ea) => ea.legalEntityId !== legalEntity.id) || []]
24881
24880
  };
24882
- await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
24881
+ await handleUpdateLegalEntity(updatedParentLegalEntity, parentLE.id);
24883
24882
  }
24884
24883
  };
24885
24884
  const onSubmit = async () => {
@@ -24912,10 +24911,13 @@ function IndividualDropinComponent({
24912
24911
  legalEntity: createdLegalEntity,
24913
24912
  dataSubmitted
24914
24913
  });
24915
- await attachAssociationToParentLegalEntity({
24916
- legalEntity: createdLegalEntity,
24917
- dataSubmitted
24918
- });
24914
+ if (parentLegalEntity) {
24915
+ await attachAssociationToParentLegalEntity({
24916
+ legalEntity: createdLegalEntity,
24917
+ parentLE: parentLegalEntity,
24918
+ dataSubmitted
24919
+ });
24920
+ }
24919
24921
  if (taskType === TaskTypes.INDIVIDUAL) {
24920
24922
  setAccountHolder((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.accountHolder);
24921
24923
  }
@@ -25666,7 +25668,7 @@ function InternalReference({
25666
25668
  const label = displayText ? displayText.content : referencedLabel;
25667
25669
  const scrollIntoView = () => {
25668
25670
  const scrollParent = getScrollParent(document.getElementById(referencedLabel));
25669
- const element = scrollParent !== -1 && scrollParent.querySelector(`#${referencedLabel}`);
25671
+ const element = scrollParent == null ? void 0 : scrollParent.querySelector(`#${referencedLabel}`);
25670
25672
  element == null ? void 0 : element.scrollIntoView({
25671
25673
  behavior: "smooth"
25672
25674
  });
@@ -25797,78 +25799,82 @@ const Weblink = ({
25797
25799
  ...displayText
25798
25800
  }) : url
25799
25801
  });
25802
+ const components = {
25803
+ chapter: Chapter,
25804
+ section: Section,
25805
+ paragraph: Paragraph,
25806
+ text: Text,
25807
+ weblink: Weblink,
25808
+ list: ListElement,
25809
+ table: Table,
25810
+ internalReference: InternalReference,
25811
+ breakline: "br"
25812
+ };
25813
+ const getKey = (type) => `key-${type}-${getUniqueId()}`;
25814
+ const getProps = (element, isTopLevel) => {
25815
+ if (!("type" in element))
25816
+ return null;
25817
+ switch (element.type) {
25818
+ case ElementTypes.Chapter:
25819
+ return {
25820
+ title: element.title,
25821
+ contentElements: element.contentElements
25822
+ };
25823
+ case ElementTypes.Section:
25824
+ return {
25825
+ isTopLevel,
25826
+ title: element.title,
25827
+ label: element.label,
25828
+ contentElements: element.contentElements
25829
+ };
25830
+ case ElementTypes.Paragraph:
25831
+ return {
25832
+ isTopLevel,
25833
+ contentElements: element.contentElements
25834
+ };
25835
+ case ElementTypes.Text:
25836
+ return {
25837
+ content: element.content,
25838
+ styles: element.styles
25839
+ };
25840
+ case ElementTypes.Weblink:
25841
+ return {
25842
+ url: element.url,
25843
+ displayText: element.displayText
25844
+ };
25845
+ case ElementTypes.List:
25846
+ return {
25847
+ items: element.items,
25848
+ style: element.style
25849
+ };
25850
+ case ElementTypes.Table:
25851
+ return {
25852
+ rows: element.rows,
25853
+ label: element.label,
25854
+ captions: element.captions,
25855
+ titlePrefix: element.titlePrefix,
25856
+ title: element.title
25857
+ };
25858
+ case ElementTypes.InternalReference:
25859
+ return {
25860
+ referencedLabel: element.referencedLabel,
25861
+ displayText: element.displayText
25862
+ };
25863
+ default:
25864
+ return null;
25865
+ }
25866
+ };
25800
25867
  function ContentElements({
25801
25868
  contentElements,
25802
25869
  isTopLevel = false,
25803
25870
  onExpandSection
25804
25871
  }) {
25805
- const components = {
25806
- chapter: Chapter,
25807
- section: Section,
25808
- paragraph: Paragraph,
25809
- text: Text,
25810
- weblink: Weblink,
25811
- list: ListElement,
25812
- table: Table,
25813
- internalReference: InternalReference,
25814
- breakline: "br"
25815
- };
25816
- const getKey = (type) => `key-${type}-${getUniqueId()}`;
25817
- const getProps = (element) => {
25818
- switch (element.type) {
25819
- case ElementTypes.Chapter:
25820
- return {
25821
- title: element.title,
25822
- contentElements: element.contentElements
25823
- };
25824
- case ElementTypes.Section:
25825
- return {
25826
- isTopLevel,
25827
- title: element.title,
25828
- label: element.label,
25829
- contentElements: element.contentElements
25830
- };
25831
- case ElementTypes.Paragraph:
25832
- return {
25833
- isTopLevel,
25834
- contentElements: element.contentElements
25835
- };
25836
- case ElementTypes.Text:
25837
- return {
25838
- content: element.content,
25839
- styles: element.styles
25840
- };
25841
- case ElementTypes.Weblink:
25842
- return {
25843
- url: element.url,
25844
- displayText: element.displayText
25845
- };
25846
- case ElementTypes.List:
25847
- return {
25848
- items: element.items,
25849
- style: element.style
25850
- };
25851
- case ElementTypes.Table:
25852
- return {
25853
- rows: element.rows,
25854
- label: element.label,
25855
- captions: element.captions,
25856
- titlePrefix: element.titlePrefix,
25857
- title: element.title
25858
- };
25859
- case ElementTypes.InternalReference:
25860
- return {
25861
- referencedLabel: element.referencedLabel,
25862
- displayText: element.displayText
25863
- };
25864
- default:
25865
- return null;
25866
- }
25867
- };
25868
25872
  const elements = contentElements.map((contentElement) => {
25873
+ if (!("type" in contentElement))
25874
+ return null;
25869
25875
  const Component = components[contentElement.type];
25870
25876
  return jsx(Component, {
25871
- ...getProps(contentElement)
25877
+ ...getProps(contentElement, isTopLevel)
25872
25878
  }, getKey(contentElement.type));
25873
25879
  });
25874
25880
  return isTopLevel ? jsx(Accordion, {
@@ -25903,7 +25909,7 @@ function ContractViewer({
25903
25909
  const pciValidationRules = {
25904
25910
  signer: {
25905
25911
  modes: ["blur"],
25906
- validate: (signer2) => !!signer2,
25912
+ validate: (signer2) => !isEmpty(signer2),
25907
25913
  errorMessage: "fieldIsRequired"
25908
25914
  },
25909
25915
  acceptPci: {
@@ -25918,7 +25924,7 @@ function PciDropinComponent({
25918
25924
  pciTemplateResponse,
25919
25925
  handleHomeClick,
25920
25926
  handleSign,
25921
- taskType,
25927
+ taskType = TaskTypes.PCI_DSS,
25922
25928
  eventEmitter,
25923
25929
  trackingConfig
25924
25930
  }) {
@@ -25935,7 +25941,7 @@ function PciDropinComponent({
25935
25941
  legalEntity: legalEntityResponse,
25936
25942
  task: taskType
25937
25943
  });
25938
- const [loadingStatus, setLoadingStatus] = useState(null);
25944
+ const [loadingStatus, setLoadingStatus] = useState();
25939
25945
  const {
25940
25946
  handleChangeFor,
25941
25947
  triggerValidation,
@@ -25952,15 +25958,15 @@ function PciDropinComponent({
25952
25958
  } = pciTemplateResponse;
25953
25959
  const pciQuestionnaire = JSON.parse(decodeURIComponent(escape(window.atob(pciTemplateResponse.content))));
25954
25960
  const uniqueEntityAssociations = [...new Map(getOwnDecisionMakers(legalEntityResponse).map((entityAssociation) => [entityAssociation.legalEntityId, entityAssociation])).values()];
25955
- const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.map(({
25961
+ const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.filter((ea) => Boolean(ea.legalEntityId && ea.name)).map(({
25956
25962
  legalEntityId: id2,
25957
25963
  name
25958
25964
  }) => ({
25959
25965
  id: id2,
25960
25966
  name
25961
25967
  })) : [{
25962
- id: legalEntityResponse == null ? void 0 : legalEntityResponse.id,
25963
- 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}`
25968
+ id: legalEntityResponse.id,
25969
+ name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
25964
25970
  }];
25965
25971
  const handleSignClick = async () => {
25966
25972
  if (loadingStatus === "loading")
@@ -26078,7 +26084,7 @@ function PciDropinComponent({
26078
26084
  children: (childProps) => jsx(Checkbox, {
26079
26085
  ...childProps,
26080
26086
  label: acceptPciLabel,
26081
- checked: data.acceptPci,
26087
+ checked: data.acceptPci ?? false,
26082
26088
  name: "acceptPci",
26083
26089
  onChange: handleChangeFor("acceptPci")
26084
26090
  })
@@ -26422,7 +26428,7 @@ const TrustRoleAndEntityType = (props) => {
26422
26428
  selected: data.role ?? [],
26423
26429
  onSelect: changeRoles,
26424
26430
  mapToSelectItem: (role2) => ({
26425
- ...makeSelectItemForTrustRole(role2, i18n),
26431
+ ...makeSelectItemForRole(role2, i18n),
26426
26432
  disabled: !availableRoles.includes(role2)
26427
26433
  })
26428
26434
  })
@@ -26501,7 +26507,7 @@ const TrustRoleAndEntityType = (props) => {
26501
26507
  labels: formUtils.getFieldLabels(COUNTRY_FIELD),
26502
26508
  readonly: false,
26503
26509
  classNameModifiers: COUNTRY_FIELD,
26504
- allowedCountries: [],
26510
+ allowedCountries: void 0,
26505
26511
  handleChangeFor
26506
26512
  }), jsx(LegalCompanyNameField, {
26507
26513
  data: formUtils.getFieldData(data, LEGAL_COMPANY_NAME_FIELD),
@@ -26650,7 +26656,7 @@ function RoleAndTypeDropinComponent({
26650
26656
  });
26651
26657
  const [activeForm, setActiveForm] = useState(regularForms.roleAndEntityType);
26652
26658
  const isSummaryStep = activeForm.formId === summaryStep.formId;
26653
- const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getTrustMemberName(role2))).join(", ");
26659
+ const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getRoleName(role2))).join(", ");
26654
26660
  const formatSettlorExemptionReasonsForSummary = (reasons) => reasons.map((reason) => i18n.get(reason)).join(", ");
26655
26661
  const summaryData = trustMember === "incomplete" ? {} : {
26656
26662
  roleAndEntityType: {
@@ -26824,7 +26830,8 @@ const serviceAgreementTypesTranslationMapping = {
26824
26830
  adyenCapital: "capitalUserTerms",
26825
26831
  adyenAccount: "businessAccountTerms",
26826
26832
  adyenCard: "cardUserTerms",
26827
- adyenFranchisee: "franchiseesTAndCs"
26833
+ adyenFranchisee: "franchiseesTAndCs",
26834
+ adyenPccr: "pccr"
26828
26835
  };
26829
26836
  function ServiceAgreementDropinComponent({
26830
26837
  legalEntityResponse,
@@ -27052,7 +27059,7 @@ function ServiceAgreementDropinComponent({
27052
27059
  });
27053
27060
  }
27054
27061
  function removeObjectPropsWithEmptyValues(obj) {
27055
- Object.keys(obj).forEach((key) => {
27062
+ keysOf(obj).forEach((key) => {
27056
27063
  if (obj[key] === null || isEmpty(obj[key]))
27057
27064
  delete obj[key];
27058
27065
  });
@@ -28203,7 +28210,7 @@ function DropinComposerComponent({
28203
28210
  return TaskTypes.TASKS_OVERVIEW;
28204
28211
  }, [showBusinessTypeSelection, showIntroduction]);
28205
28212
  const [taskHistory, setTaskHistory] = useState([initialTask]);
28206
- const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
28213
+ const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
28207
28214
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
28208
28215
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
28209
28216
  const [legalEntityType, setLegalEntityType] = useState(null);
@@ -28221,9 +28228,9 @@ function DropinComposerComponent({
28221
28228
  const [transferInstrument, setTransferInstrument] = useState(null);
28222
28229
  const [capabilityProblems, setCapabilityProblems] = useState(getCapabilityProblems(legalEntityResponse));
28223
28230
  const [bankVerificationVendors, setBankVerificationVendors] = useState();
28224
- const rootLegalEntityCountry = legalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = legalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = legalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
28231
+ const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = rootLegalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = rootLegalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
28225
28232
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
28226
- 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);
28233
+ 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);
28227
28234
  const additionalSalesChannels = useSalesChannelsSettings();
28228
28235
  const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
28229
28236
  const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
@@ -28236,12 +28243,12 @@ function DropinComposerComponent({
28236
28243
  };
28237
28244
  const getPciStatus = async () => {
28238
28245
  var _a2, _b2;
28239
- if (legalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
28246
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
28240
28247
  try {
28241
- const response = await args.handleGetPciStatus(legalEntity.id, {
28248
+ const response = await args.handleGetPciStatus(rootLegalEntity.id, {
28242
28249
  additionalSalesChannels
28243
28250
  });
28244
- response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
28251
+ response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
28245
28252
  setPciStatus(response);
28246
28253
  return response;
28247
28254
  } catch (e) {
@@ -28252,7 +28259,7 @@ function DropinComposerComponent({
28252
28259
  };
28253
28260
  const getPciTemplate = useCallback(async () => {
28254
28261
  const requestPciTemplate = async (language) => {
28255
- const response = await args.handleGetPciTemplate(legalEntity.id, {
28262
+ const response = await args.handleGetPciTemplate(rootLegalEntity.id, {
28256
28263
  language,
28257
28264
  additionalSalesChannels
28258
28265
  });
@@ -28270,16 +28277,16 @@ function DropinComposerComponent({
28270
28277
  await requestPciTemplate(fallbackLanguageCode);
28271
28278
  }
28272
28279
  }
28273
- }, [additionalSalesChannels, i18n, legalEntity.id, args.handleGetPciTemplate]);
28280
+ }, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
28274
28281
  useEffect(() => {
28275
28282
  if (!tasks.includes(TaskTypes.PCI_DSS))
28276
28283
  return;
28277
28284
  getPciTemplate().catch(logger$8.error);
28278
28285
  }, [getPciTemplate, tasks]);
28279
28286
  const getServiceAgreementAcceptanceInfos = async () => {
28280
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
28287
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
28281
28288
  try {
28282
- const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
28289
+ const response = await args.handleGetServiceAgreementAcceptanceInfos(rootLegalEntity.id);
28283
28290
  setServiceAgreementAcceptanceInfos(response.data);
28284
28291
  } catch (e) {
28285
28292
  logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -28287,9 +28294,9 @@ function DropinComposerComponent({
28287
28294
  }
28288
28295
  };
28289
28296
  const getServiceAgreementStatus = async () => {
28290
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
28297
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
28291
28298
  try {
28292
- const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
28299
+ const response = await args.handleGetServiceAgreementStatus(rootLegalEntity.id);
28293
28300
  setServiceAgreementTypes(response.termsOfServiceTypes);
28294
28301
  } catch (e) {
28295
28302
  logger$8.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -28297,7 +28304,7 @@ function DropinComposerComponent({
28297
28304
  }
28298
28305
  };
28299
28306
  const getSolePropietor = async () => {
28300
- const id2 = getOwnSoleProprietorshipIdArray(legalEntity)[0];
28307
+ const id2 = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
28301
28308
  if (id2) {
28302
28309
  try {
28303
28310
  const response = await (args == null ? void 0 : args.handleGetLegalEntity(id2));
@@ -28324,10 +28331,10 @@ function DropinComposerComponent({
28324
28331
  }
28325
28332
  };
28326
28333
  const refreshLegalEntity = async () => {
28327
- if (legalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28334
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28328
28335
  try {
28329
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(legalEntity.id));
28330
- setLegalEntity(response);
28336
+ const response = await (args == null ? void 0 : args.handleGetLegalEntity(rootLegalEntity.id));
28337
+ setRootLegalEntity(response);
28331
28338
  setCapabilityProblems(getCapabilityProblems(response));
28332
28339
  return response;
28333
28340
  } catch (e) {
@@ -28483,11 +28490,11 @@ function DropinComposerComponent({
28483
28490
  onNavigate(task);
28484
28491
  };
28485
28492
  const onNavigateToDecisionMakerIndividual = async (task, id2, parentId) => {
28486
- if (parentId && parentId !== legalEntity.id) {
28493
+ if (parentId && parentId !== rootLegalEntity.id) {
28487
28494
  const parentLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(parentId));
28488
28495
  setAssociatedLegalEntityParent(parentLegalEntity);
28489
28496
  } else {
28490
- setAssociatedLegalEntityParent(legalEntity);
28497
+ setAssociatedLegalEntityParent(rootLegalEntity);
28491
28498
  }
28492
28499
  if (id2 && (args == null ? void 0 : args.handleGetLegalEntity)) {
28493
28500
  try {
@@ -28509,7 +28516,7 @@ function DropinComposerComponent({
28509
28516
  if (id2) {
28510
28517
  try {
28511
28518
  await getTransferInstrument2(id2);
28512
- if (hasSolePropInLegalEntity(legalEntity) && !solePropietor) {
28519
+ if (hasSolePropInLegalEntity(rootLegalEntity) && !solePropietor) {
28513
28520
  await getSolePropietor();
28514
28521
  }
28515
28522
  } finally {
@@ -28540,7 +28547,7 @@ function DropinComposerComponent({
28540
28547
  };
28541
28548
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
28542
28549
  var _a2, _b2;
28543
- 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;
28550
+ 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;
28544
28551
  if (trustId) {
28545
28552
  try {
28546
28553
  const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
@@ -28648,13 +28655,13 @@ function DropinComposerComponent({
28648
28655
  trackingConfig: {
28649
28656
  topLevelLegalEntity: legalEntityResponse
28650
28657
  },
28651
- legalEntity,
28658
+ legalEntity: rootLegalEntity,
28652
28659
  task: TaskTypes.PCI_DSS
28653
28660
  });
28654
28661
  try {
28655
- const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id));
28662
+ const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
28656
28663
  await Promise.all(response.data.map(async (pciQuestionnaireInfo) => {
28657
- const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(legalEntity.id, pciQuestionnaireInfo.id));
28664
+ const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(rootLegalEntity.id, pciQuestionnaireInfo.id));
28658
28665
  await downloadFile(pciQuestionnaire.content, `${pciQuestionnaire.id}.pdf`);
28659
28666
  }));
28660
28667
  } catch (e) {
@@ -28679,7 +28686,7 @@ function DropinComposerComponent({
28679
28686
  const data = await getConfiguration2({
28680
28687
  country: contextCountry,
28681
28688
  capabilities,
28682
- legalEntityType: legalEntity.type
28689
+ legalEntityType: rootLegalEntity.type
28683
28690
  });
28684
28691
  if (data == null ? void 0 : data.bankVerificationProviders) {
28685
28692
  setBankVerificationVendors(data.bankVerificationProviders);
@@ -28698,21 +28705,21 @@ function DropinComposerComponent({
28698
28705
  setIsLoadingConfiguration(false);
28699
28706
  onLoad();
28700
28707
  });
28701
- }, [legalEntity.type, contextCountry]);
28708
+ }, [rootLegalEntity.type, contextCountry]);
28702
28709
  useEffect(() => {
28703
- if (hasRejectedCapabilities(legalEntity)) {
28710
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28704
28711
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28705
28712
  }
28706
- }, [legalEntity]);
28713
+ }, [rootLegalEntity]);
28707
28714
  useEffect(() => {
28708
28715
  if (PAGES_WITH_STATUS.includes(taskHistory[taskHistory.length - 1])) {
28709
28716
  if (!pollingId) {
28710
28717
  const pollingInterval = setInterval(async () => {
28711
- if (hasRejectedCapabilities(legalEntity)) {
28718
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28712
28719
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28713
28720
  clearInterval(pollingId);
28714
28721
  setPollingId(null);
28715
- } else if (hasResolvedCapabilities(legalEntity)) {
28722
+ } else if (hasResolvedCapabilities(rootLegalEntity)) {
28716
28723
  clearInterval(pollingId);
28717
28724
  setPollingId(null);
28718
28725
  } else {
@@ -28737,7 +28744,7 @@ function DropinComposerComponent({
28737
28744
  case TaskTypes.BUSINESS_TYPE_SELECTION:
28738
28745
  return jsx(BusinessTypeSelection, {
28739
28746
  ...args,
28740
- legalEntityResponse: legalEntity,
28747
+ legalEntityResponse: rootLegalEntity,
28741
28748
  accountHolder: accountHolder2,
28742
28749
  showTrustOption: isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(rootLegalEntityCountry),
28743
28750
  showSolePropOption: SOLE_PROP_COUNTRIES.includes(rootLegalEntityCountry),
@@ -28749,7 +28756,7 @@ function DropinComposerComponent({
28749
28756
  });
28750
28757
  case TaskTypes.INTRODUCTION:
28751
28758
  return jsx(Introduction, {
28752
- legalEntity,
28759
+ legalEntity: rootLegalEntity,
28753
28760
  onExitIntroduction: () => {
28754
28761
  setHasSeenIntroduction(true);
28755
28762
  onNavigateTo(TaskTypes.TASKS_OVERVIEW);
@@ -28762,7 +28769,7 @@ function DropinComposerComponent({
28762
28769
  return jsx(TaskListComponent, {
28763
28770
  onNavigateToTask: navigateTo,
28764
28771
  tasks,
28765
- legalEntityResponse: legalEntity,
28772
+ legalEntityResponse: rootLegalEntity,
28766
28773
  capabilityProblems,
28767
28774
  onPciDownload,
28768
28775
  pciStatus,
@@ -28778,7 +28785,7 @@ function DropinComposerComponent({
28778
28785
  topLevelLegalEntity: legalEntityResponse
28779
28786
  },
28780
28787
  parentLegalEntity: associatedLegalEntityParent,
28781
- legalEntityResponse: legalEntity,
28788
+ legalEntityResponse: rootLegalEntity,
28782
28789
  onNavigateToIndividual: (legalEntityId) => onNavigateToDecisionMakerIndividual(TaskTypes.DECISION_MAKER, legalEntityId),
28783
28790
  handleUpdateLegalEntity: args == null ? void 0 : args.handleUpdateLegalEntity,
28784
28791
  navigateBackToTaskList: navigateBack,
@@ -28794,8 +28801,8 @@ function DropinComposerComponent({
28794
28801
  taskType: TaskTypes.INDIVIDUAL,
28795
28802
  taskName: hasTrust ? "individualTrusteeDetails" : "individualDetails",
28796
28803
  parentLegalEntity: null,
28797
- legalEntityResponse: legalEntity,
28798
- problems: getLegalEntityProblems(legalEntity),
28804
+ legalEntityResponse: rootLegalEntity,
28805
+ problems: getLegalEntityProblems(rootLegalEntity),
28799
28806
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28800
28807
  onChange: componentOnChange,
28801
28808
  eventEmitter,
@@ -28815,7 +28822,7 @@ function DropinComposerComponent({
28815
28822
  });
28816
28823
  case TaskTypes.REVIEW:
28817
28824
  return jsx(ReviewComponent, {
28818
- legalEntityId: legalEntity.id,
28825
+ legalEntityId: rootLegalEntity.id,
28819
28826
  handleReviewConfirm: args.handleReviewConfirm,
28820
28827
  handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW)
28821
28828
  });
@@ -28892,9 +28899,9 @@ function DropinComposerComponent({
28892
28899
  },
28893
28900
  taskType: TaskTypes.COMPANY,
28894
28901
  taskName: hasTrust ? "companyTrusteeDetails" : "companyDetails",
28895
- legalEntityResponse: legalEntity,
28902
+ legalEntityResponse: rootLegalEntity,
28896
28903
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28897
- problems: getLegalEntityProblems(legalEntity),
28904
+ problems: getLegalEntityProblems(rootLegalEntity),
28898
28905
  onChange: componentOnChange,
28899
28906
  eventEmitter,
28900
28907
  onSubmit: async (data) => {
@@ -28920,7 +28927,7 @@ function DropinComposerComponent({
28920
28927
  parentLegalEntity: trust2,
28921
28928
  legalEntityResponse: associatedLegalEntity,
28922
28929
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28923
- problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[legalEntity.id],
28930
+ problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[rootLegalEntity.id],
28924
28931
  onChange: componentOnChange,
28925
28932
  eventEmitter,
28926
28933
  onSubmit: (data) => refreshTrustAndRunOnSubmit(data, 2),
@@ -28943,9 +28950,9 @@ function DropinComposerComponent({
28943
28950
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _f[transferInstrument == null ? void 0 : transferInstrument.id],
28944
28951
  transferInstrument,
28945
28952
  setTransferInstrument,
28946
- legalEntityResponse: legalEntity,
28953
+ legalEntityResponse: rootLegalEntity,
28947
28954
  refreshLegalEntity,
28948
- accountHolder: getPayoutAccountHolderName(legalEntity, i18n),
28955
+ accountHolder: getPayoutAccountHolderName(rootLegalEntity, i18n),
28949
28956
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28950
28957
  onChange: componentOnChange,
28951
28958
  eventEmitter,
@@ -28963,7 +28970,7 @@ function DropinComposerComponent({
28963
28970
  },
28964
28971
  taskType: TaskTypes.TRUST,
28965
28972
  problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust2 == null ? void 0 : trust2.id],
28966
- parentLegalEntity: legalEntity,
28973
+ parentLegalEntity: rootLegalEntity,
28967
28974
  legalEntityResponse: trust2,
28968
28975
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28969
28976
  onChange: componentOnChange,
@@ -28977,8 +28984,8 @@ function DropinComposerComponent({
28977
28984
  });
28978
28985
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
28979
28986
  return jsx(TrustMembersOverview, {
28980
- trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, legalEntity, exemptSettlor) : getTrustMembers(trust2, legalEntity, exemptSettlor),
28981
- getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
28987
+ trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, rootLegalEntity, exemptSettlor) : getTrustMembers(trust2, rootLegalEntity, exemptSettlor),
28988
+ getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, rootLegalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId, ...getDirectEntityAssociations(rootLegalEntity, member.legalEntityId).map((association2) => association2.legalEntityId)]),
28982
28989
  navigateBackToTaskList: navigateBack,
28983
28990
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
28984
28991
  navigateToEditTrustMemberOwner: (trustMemberOwnerId, trustMemberId) => onNavigateToDecisionMakerIndividual(TaskTypes.TRUST_MEMBER_COMPANY_OWNER, trustMemberOwnerId, trustMemberId),
@@ -28998,7 +29005,7 @@ function DropinComposerComponent({
28998
29005
  });
28999
29006
  case TaskTypes.PCI_DSS:
29000
29007
  return jsx(PciDropinComponent, {
29001
- legalEntityResponse: legalEntity,
29008
+ legalEntityResponse: rootLegalEntity,
29002
29009
  pciTemplateResponse,
29003
29010
  trackingConfig: {
29004
29011
  topLevelLegalEntity: legalEntityResponse
@@ -29015,7 +29022,7 @@ function DropinComposerComponent({
29015
29022
  return jsx(SolePropDropinComponent, {
29016
29023
  ...args,
29017
29024
  taskType: TaskTypes.SOLE_PROPRIETOR_COMPANY,
29018
- parentLegalEntity: legalEntity,
29025
+ parentLegalEntity: rootLegalEntity,
29019
29026
  legalEntityResponse: solePropietor,
29020
29027
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
29021
29028
  problems: (_j = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _j[solePropietor == null ? void 0 : solePropietor.id],
@@ -29024,13 +29031,13 @@ function DropinComposerComponent({
29024
29031
  onSubmit: componentOnSubmit,
29025
29032
  handleHomeClick: navigateBack,
29026
29033
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
29027
- country: (_l = (_k = legalEntity == null ? void 0 : legalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
29034
+ country: (_l = (_k = rootLegalEntity == null ? void 0 : rootLegalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
29028
29035
  handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
29029
29036
  handleFindAddress: args == null ? void 0 : args.handleFindAddress
29030
29037
  });
29031
29038
  case TaskTypes.SERVICE_AGREEMENT:
29032
29039
  return jsx(ServiceAgreementDropinComponent, {
29033
- legalEntityResponse: legalEntity,
29040
+ legalEntityResponse: rootLegalEntity,
29034
29041
  trackingConfig: {
29035
29042
  topLevelLegalEntity: legalEntityResponse
29036
29043
  },
@@ -29049,6 +29056,7 @@ function DropinComposerComponent({
29049
29056
  case TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER:
29050
29057
  return jsx(LegalEntityTypeSwitcher, {
29051
29058
  ...args,
29059
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity,
29052
29060
  targetLegalEntityType: legalEntityType,
29053
29061
  legalEntityResponse,
29054
29062
  handleHomeClick: navigateBack,