@adyen/kyc-components 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1050 -1040
  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/PayoutAccount/types.d.ts +3 -2
  14. package/dist/types/components/TaskList/component/PayoutAccountTaskListItem.d.ts +2 -2
  15. package/dist/types/components/Trust/types.d.ts +2 -2
  16. package/dist/types/components/internal/Accordion/types.d.ts +1 -1
  17. package/dist/types/components/internal/AccountHolder/types.d.ts +1 -1
  18. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  19. package/dist/types/components/internal/BusinessRegistrationNumber/validate.d.ts +5 -4
  20. package/dist/types/components/internal/ContractViewer/types.d.ts +24 -17
  21. package/dist/types/components/internal/ErrorPanel/components/NavigateToFieldLink.d.ts +5 -4
  22. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +1 -1
  23. package/dist/types/components/internal/FormFields/InputDate/utils.d.ts +1 -1
  24. package/dist/types/components/internal/FormFields/InputEmail.d.ts +2 -1
  25. package/dist/types/components/internal/FormFields/InputTelephone.d.ts +2 -1
  26. package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +1 -8
  27. package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts +2 -1
  28. package/dist/types/components/internal/FormFields/utils.d.ts +6 -1
  29. package/dist/types/components/internal/Name/Name.d.ts +13 -1
  30. package/dist/types/core/Context/StateContext/StateProvider.d.ts +8 -4
  31. package/dist/types/core/errorMapping.d.ts +1 -1
  32. package/dist/types/core/hooks/useBusinessSetup.d.ts +6 -0
  33. package/dist/types/core/hooks/useExemptSettlor.d.ts +1 -1
  34. package/dist/types/core/models/decision-maker.d.ts +1 -1
  35. package/dist/types/core/models/identity.d.ts +3 -1
  36. package/dist/types/core/user-events.d.ts +7 -6
  37. package/dist/types/language/config.d.ts +9 -2
  38. package/dist/types/utils/decision-maker-roles.d.ts +10 -19
  39. package/dist/types/utils/entity-association-util.d.ts +23 -17
  40. package/dist/types/utils/entity-status-util.d.ts +1 -3
  41. package/dist/types/utils/entriesOf.d.ts +1 -0
  42. package/dist/types/utils/file.d.ts +3 -3
  43. package/dist/types/utils/genUtils.d.ts +11 -9
  44. package/dist/types/utils/get-name.d.ts +2 -2
  45. package/dist/types/utils/get-task-status.d.ts +2 -2
  46. package/dist/types/utils/makeSelectItemForRole.d.ts +4 -0
  47. package/dist/types/utils/regex/types.d.ts +1 -1
  48. package/dist/types/utils/remove-object-empty-values.d.ts +1 -1
  49. package/dist/types/utils/roleMetadata.d.ts +13 -0
  50. package/dist/types/utils/scroll.d.ts +1 -1
  51. package/dist/types/utils/trust-util.d.ts +4 -25
  52. package/package.json +1 -1
@@ -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";
@@ -644,7 +650,8 @@ const addAndVerifyYourBankDetails = "Add and verify your bank account details";
644
650
  const failedToFetchSoleProp = "Failed to fetch the sole propietor";
645
651
  const uniqueIdentificationCode = "Unique identification code (ЕИК/UIC)";
646
652
  const identifikacionenNomerDDS = "VAT number (ДДС)";
647
- const MBO = "Matični broj subjekta trgovačkog suda (MBO)";
653
+ const MBS = "Matični broj subjekta trgovačkog suda (MBS)";
654
+ const MBO = "MBO";
648
655
  const PDVIdBrojOIB = "PDV Id. Broj OIB";
649
656
  const cyRegistrationNumber = "Αριθμός Εγγραφής";
650
657
  const arithmosEngraphes = "Αριθμός Εγγραφής Φ.Π.Α.";
@@ -1261,13 +1268,18 @@ const defaultTrans = {
1261
1268
  privateCompanyDescription,
1262
1269
  publicCompanyTitle,
1263
1270
  publicCompanyDescription,
1271
+ partnershipIncorporated,
1272
+ partnershipUnincorporated,
1273
+ associationIncorporated,
1264
1274
  incorporatedPartnership,
1265
1275
  unincorporatedPartnership,
1266
1276
  incorporatedPartnershipTitle,
1277
+ partnershipIncorporatedDescription,
1278
+ partnershipUnincorporatedDescription,
1279
+ partnershipIncorporatedNewEntryFlowDescription,
1280
+ partnershipUnincorporatedNewEntryFlowDescription,
1267
1281
  incorporatedPartnershipDescription,
1268
- incorporatedPartnershipNewEntryFlowDescription,
1269
1282
  unincorporatedPartnershipDescription,
1270
- unincorporatedPartnershipNewEntryFlowDescription,
1271
1283
  nonProfitOrCharitableOrgTitle,
1272
1284
  nonProfitOrCharitableOrgDescription,
1273
1285
  governmentalOrganizationTitle,
@@ -1388,6 +1400,7 @@ const defaultTrans = {
1388
1400
  paymentProcessingTerms,
1389
1401
  accountHolderTerms,
1390
1402
  capitalUserTerms,
1403
+ pccr,
1391
1404
  businessAccountTerms,
1392
1405
  cardUserTerms,
1393
1406
  franchiseesTAndCs,
@@ -1771,6 +1784,7 @@ const defaultTrans = {
1771
1784
  failedToFetchSoleProp,
1772
1785
  uniqueIdentificationCode,
1773
1786
  identifikacionenNomerDDS,
1787
+ MBS,
1774
1788
  MBO,
1775
1789
  PDVIdBrojOIB,
1776
1790
  cyRegistrationNumber,
@@ -2386,43 +2400,30 @@ class Language {
2386
2400
  });
2387
2401
  }
2388
2402
  }
2389
- function isArray(prop) {
2390
- return typeof prop === "object" && prop !== null && Object.prototype.toString.call(prop) === "[object Array]";
2391
- }
2392
- function pick(...args) {
2393
- const myArgs = isArray(args[0]) ? args[0] : args;
2394
- return {
2395
- from: (obj) => (
2396
- // eslint-disable-line
2397
- myArgs.map((k) => k in obj ? {
2398
- [k]: obj[k]
2399
- } : {}).reduce((res, o) => ({
2400
- ...res,
2401
- ...o
2402
- }), {})
2403
- )
2404
- };
2405
- }
2406
- function drop(...args) {
2407
- const myArgs = isArray(args[0]) ? args[0] : args;
2408
- return {
2409
- from: (obj) => {
2410
- const vkeys = Object.keys(obj).filter((k) => !myArgs.includes(k));
2411
- return pick(...vkeys).from(obj);
2412
- }
2413
- };
2414
- }
2415
- function doArraysMatch(arr1, arr2) {
2416
- return arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2417
- }
2403
+ const entriesOf = (object) => Object.entries(object);
2404
+ const keysOf = (object) => Object.keys(object);
2405
+ const keyIsInObject = (key, obj) => key in obj;
2406
+ const pick = (...propertiesToKeep) => ({
2407
+ from: (obj) => propertiesToKeep.map((k) => keyIsInObject(k, obj) ? {
2408
+ [k]: obj[k]
2409
+ } : {}).reduce((res, o) => ({
2410
+ ...res,
2411
+ ...o
2412
+ }), {})
2413
+ });
2414
+ const drop = (...propertiesToDrop) => ({
2415
+ from: (obj) => {
2416
+ const remainingProperties = keysOf(obj).filter((k) => !propertiesToDrop.includes(k));
2417
+ return pick(...remainingProperties).from(obj);
2418
+ }
2419
+ });
2420
+ const doArraysMatch = (arr1, arr2) => arr1.length === arr2.length && arr1.every((element) => arr2.includes(element));
2418
2421
  const objectsDeepEqual = (x, y) => {
2419
- const xType = typeof x;
2420
- const yType = typeof y;
2421
- if (x && y && xType === "object" && xType === yType) {
2422
+ if (x && y && typeof x === "object" && typeof y === "object") {
2422
2423
  if (Object.keys(x).length !== Object.keys(y).length) {
2423
2424
  return false;
2424
2425
  }
2425
- return Object.keys(x).every((key) => objectsDeepEqual(x[key], y[key]));
2426
+ return keysOf(x).every((key) => objectsDeepEqual(x[key], y[key]));
2426
2427
  }
2427
2428
  return x === y;
2428
2429
  };
@@ -2463,7 +2464,6 @@ function useSettingsContext() {
2463
2464
  }
2464
2465
  return context;
2465
2466
  }
2466
- const entriesOf = (object) => Object.entries(object);
2467
2467
  const hasDataChanged = (initialData, currentData) => entriesOf(currentData ?? {}).some(([key, value]) => {
2468
2468
  if (typeof value === "object") {
2469
2469
  return !objectsDeepEqual(value, initialData == null ? void 0 : initialData[key]);
@@ -3053,12 +3053,11 @@ const NavigateToFieldLink = ({
3053
3053
  const {
3054
3054
  goToFormByFieldName
3055
3055
  } = useFormRouterContext();
3056
- const onClick = (e) => {
3057
- e.preventDefault();
3058
- goToFormByFieldName(fieldName);
3059
- };
3060
3056
  return jsx(Link, {
3061
- onClick,
3057
+ onClick: (e) => {
3058
+ e.preventDefault();
3059
+ goToFormByFieldName(fieldName);
3060
+ },
3062
3061
  href: "to-field-link",
3063
3062
  children: label
3064
3063
  });
@@ -3944,7 +3943,7 @@ const Field = ({
3944
3943
  errorMessage,
3945
3944
  filled,
3946
3945
  focused,
3947
- helper: helper2,
3946
+ helper,
3948
3947
  inputWrapperModifiers = [],
3949
3948
  isLoading,
3950
3949
  isValid,
@@ -3989,9 +3988,9 @@ const Field = ({
3989
3988
  "adyen-kyc-label__text--error": !!errorMessage
3990
3989
  }),
3991
3990
  children: label
3992
- }), helper2 && jsx("span", {
3991
+ }), helper && jsx("span", {
3993
3992
  className: "adyen-kyc-helper-text",
3994
- children: helper2
3993
+ children: helper
3995
3994
  }), jsxs("div", {
3996
3995
  className: cx("adyen-kyc-input-wrapper", ...inputWrapperModifiers.map((m) => `adyen-kyc-input-wrapper--${m}`)),
3997
3996
  children: [children({
@@ -4042,16 +4041,14 @@ const Field = ({
4042
4041
  };
4043
4042
  const Select$1 = "";
4044
4043
  const getScrollParent = (node) => {
4044
+ if (!node)
4045
+ return null;
4045
4046
  const isElement = node instanceof HTMLElement;
4046
4047
  const overflowY = isElement && window.getComputedStyle(node).overflowY;
4047
4048
  const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
4048
- if (!node) {
4049
- return -1;
4050
- }
4051
- if (isScrollable) {
4049
+ if (isElement && isScrollable)
4052
4050
  return node;
4053
- }
4054
- return getScrollParent(node.parentNode) || document.body;
4051
+ return getScrollParent(node.parentNode) ?? document.body;
4055
4052
  };
4056
4053
  function uuidv4() {
4057
4054
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -4577,13 +4574,13 @@ function SelectButton({
4577
4574
  "adyen-kyc-dropdown-button-search": isSearch
4578
4575
  }),
4579
4576
  filterable,
4580
- onClick: !readonly ? toggleList : null,
4581
- onKeyDown: !readonly ? onButtonKeyDown : null,
4582
- role: filterable || isMulti ? "button" : null,
4583
- tabIndex: "0",
4577
+ onClick: !readonly ? toggleList : void 0,
4578
+ onKeyDown: !readonly ? onButtonKeyDown : void 0,
4579
+ role: filterable || isMulti ? "button" : void 0,
4580
+ tabIndex: 0,
4584
4581
  title,
4585
4582
  toggleButtonRef,
4586
- type: !filterable && !isMulti ? "button" : null,
4583
+ type: !filterable && !isMulti ? "button" : void 0,
4587
4584
  "aria-describedby": ariaDescribedBy,
4588
4585
  isMulti,
4589
4586
  id: id2,
@@ -4677,7 +4674,7 @@ function Checkbox({
4677
4674
  label,
4678
4675
  isInvalid,
4679
4676
  onChange,
4680
- helper: helper2,
4677
+ helper,
4681
4678
  checked,
4682
4679
  disabled,
4683
4680
  ...props
@@ -4699,9 +4696,9 @@ function Checkbox({
4699
4696
  }), jsx("span", {
4700
4697
  className: "adyen-kyc-checkbox__label",
4701
4698
  children: label
4702
- }), helper2 && jsx("span", {
4699
+ }), helper && jsx("span", {
4703
4700
  className: "adyen-kyc-checkbox__helper-text",
4704
- children: helper2
4701
+ children: helper
4705
4702
  })]
4706
4703
  });
4707
4704
  }
@@ -6364,9 +6361,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6364
6361
  return {
6365
6362
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6366
6363
  translationMessage: {
6367
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6368
- format: null,
6369
- values: null
6364
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6370
6365
  }
6371
6366
  };
6372
6367
  }
@@ -6382,9 +6377,7 @@ const validateBusinessRegistrationNumber = (input, fallbackCountry = null, compa
6382
6377
  return {
6383
6378
  isValid: CHARACTER_PATTERNS.noHtml.test(input),
6384
6379
  translationMessage: {
6385
- translationKey: "validationPleaseEnterAValidRegistrationNumber",
6386
- format: null,
6387
- values: null
6380
+ translationKey: "validationPleaseEnterAValidRegistrationNumber"
6388
6381
  }
6389
6382
  };
6390
6383
  };
@@ -6394,20 +6387,32 @@ const getValidationRulesPerCountryAndType = (country2, companyType2, trustType2,
6394
6387
  if (!registrationNumber2)
6395
6388
  return false;
6396
6389
  const {
6397
- isValid,
6398
- translationMessage
6390
+ isValid
6391
+ } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6392
+ return isValid;
6393
+ },
6394
+ errorMessage: (registrationNumber2) => {
6395
+ if (!registrationNumber2)
6396
+ return;
6397
+ const {
6398
+ translationMessage: {
6399
+ translationKey,
6400
+ format,
6401
+ values
6402
+ }
6399
6403
  } = validateBusinessRegistrationNumber(registrationNumber2, country2, companyType2, trustType2);
6400
- this.errorMessage = {
6401
- translationKey: translationMessage.translationKey,
6404
+ if (!format)
6405
+ return translationKey;
6406
+ return {
6407
+ translationKey,
6402
6408
  translationObject: {
6403
6409
  values: {
6404
- format: translationMessage.values ? i18n.get(translationMessage.format, {
6405
- values: translationMessage.values
6406
- }) : i18n.get(translationMessage.format)
6410
+ format: values ? i18n.get(format, {
6411
+ values
6412
+ }) : i18n.get(format)
6407
6413
  }
6408
6414
  }
6409
6415
  };
6410
- return isValid;
6411
6416
  }
6412
6417
  });
6413
6418
  const defaultValidationRules = {
@@ -6427,6 +6432,7 @@ const getRegistrationNumberValidationRules = (country2, companyType2, trustType2
6427
6432
  };
6428
6433
  const businessRegistrationNumberFields = ["registrationNumber", "exemptedFromRegistrationNumber"];
6429
6434
  function BusinessRegistrationNumber(props) {
6435
+ var _a;
6430
6436
  const {
6431
6437
  i18n
6432
6438
  } = useI18nContext();
@@ -6439,7 +6445,7 @@ function BusinessRegistrationNumber(props) {
6439
6445
  country: country2,
6440
6446
  trustType: trustType2
6441
6447
  } = props;
6442
- const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, i18n]);
6448
+ const validationRules = useMemo(() => getRegistrationNumberValidationRules(country2, companyType2, trustType2, i18n), [country2, companyType2, trustType2, i18n]);
6443
6449
  const registrationNumberFormatters = getRegistrationNumberFormatters(props.country);
6444
6450
  const {
6445
6451
  handleChangeFor,
@@ -6455,13 +6461,14 @@ function BusinessRegistrationNumber(props) {
6455
6461
  formatters: registrationNumberFormatters,
6456
6462
  defaultData: {
6457
6463
  ...props.data,
6458
- exemptedFromRegistrationNumber: !!props.data.exemptedFromRegistrationNumber
6464
+ exemptedFromRegistrationNumber: !!((_a = props.data) == null ? void 0 : _a.exemptedFromRegistrationNumber)
6459
6465
  },
6460
6466
  // exemptedFromRegistrationNumber should be a boolean
6461
6467
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
6462
6468
  });
6463
6469
  useEffect(() => {
6464
- stateRef.current.setState({
6470
+ var _a2, _b;
6471
+ (_b = (_a2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
6465
6472
  type: "addToState",
6466
6473
  value: {
6467
6474
  data,
@@ -6511,7 +6518,7 @@ function BusinessRegistrationNumber(props) {
6511
6518
  value: "exemptedFromRegistrationNumber",
6512
6519
  readonly: formUtils.isReadOnly("exemptedFromRegistrationNumber"),
6513
6520
  classNameModifiers: ["exempted-from-registration"],
6514
- checked: data.exemptedFromRegistrationNumber,
6521
+ checked: data.exemptedFromRegistrationNumber ?? false,
6515
6522
  onChange: handleChangeFor("exemptedFromRegistrationNumber"),
6516
6523
  "aria-required": formUtils.isRequiredField("exemptedFromRegistrationNumber"),
6517
6524
  "aria-label": formUtils.getLabel("exemptedFromRegistrationNumber"),
@@ -7701,7 +7708,7 @@ const companyRegistrationDetailsValidationRules = {
7701
7708
  },
7702
7709
  stockExchangeMIC: {
7703
7710
  modes: ["blur"],
7704
- validate: (input) => /^[A-Z0-9]{4}$/.test(input),
7711
+ validate: (input) => !isEmpty(input) && /^[A-Z0-9]{4}$/.test(input),
7705
7712
  errorMessage: "validationPleaseEnterAValidMarketIdentifier"
7706
7713
  },
7707
7714
  stockISIN: [{
@@ -7719,7 +7726,7 @@ const companyRegistrationDetailsValidationRules = {
7719
7726
  errorMessage: "fieldIsRequired"
7720
7727
  }, {
7721
7728
  modes: ["blur"],
7722
- validate: (dateOfIncorporation2) => dateOfIncorporation2 && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7729
+ validate: (dateOfIncorporation2) => !isEmpty(dateOfIncorporation2) && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7723
7730
  errorMessage: "invalidDateOfIncorporation"
7724
7731
  }]
7725
7732
  };
@@ -8177,7 +8184,7 @@ const countryConfig$4 = {
8177
8184
  },
8178
8185
  [CountryCodes.Croatia]: {
8179
8186
  registrationNumber: {
8180
- label: "MBO"
8187
+ label: "MBS"
8181
8188
  },
8182
8189
  exemptedFromVat: {
8183
8190
  label: "vatNumberExempted"
@@ -9387,16 +9394,13 @@ function DropzoneFile(props) {
9387
9394
  i18n
9388
9395
  } = useI18nContext();
9389
9396
  const formatSize = (bytes) => {
9390
- if (bytes) {
9391
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9392
- if (bytes === 0)
9393
- return "n/a";
9394
- const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9395
- if (i === 0)
9396
- return `${bytes} ${sizes[i]}`;
9397
- return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9398
- }
9399
- return null;
9397
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
9398
+ if (!bytes || bytes === 0)
9399
+ return "n/a";
9400
+ const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
9401
+ if (i === 0)
9402
+ return `${bytes} ${sizes[i]}`;
9403
+ return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
9400
9404
  };
9401
9405
  return jsxs("div", {
9402
9406
  className: "adyen-kyc-dropzone-file",
@@ -9543,10 +9547,10 @@ function Dropzone(props) {
9543
9547
  const isRequired = ((_a = errors == null ? void 0 : errors[name]) == null ? void 0 : _a.errorMessage) === "fieldIsRequired";
9544
9548
  const allowedFiletypes = allowedFileTypes.join(", ");
9545
9549
  useEffect(() => {
9546
- var _a2;
9550
+ var _a2, _b2, _c;
9547
9551
  const hasMaxNumberOfFiles = ((_a2 = data == null ? void 0 : data[name]) == null ? void 0 : _a2.length) >= maxNumberOfFiles;
9548
9552
  setShowDropzone(!hasMaxNumberOfFiles);
9549
- stateRef.current.setState({
9553
+ (_c = (_b2 = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _b2.setState) == null ? void 0 : _c.call(_b2, {
9550
9554
  type: "addToState",
9551
9555
  value: {
9552
9556
  data,
@@ -10854,10 +10858,10 @@ Address.defaultProps = {
10854
10858
  };
10855
10859
  const RadioGroup$1 = "";
10856
10860
  function RadioGroup({
10857
- items,
10861
+ items = [],
10858
10862
  i18n,
10859
10863
  name,
10860
- onChange,
10864
+ onChange = noop,
10861
10865
  value,
10862
10866
  isInvalid,
10863
10867
  uniqueId: uniqueId2,
@@ -10892,11 +10896,6 @@ function RadioGroup({
10892
10896
  })
10893
10897
  });
10894
10898
  }
10895
- RadioGroup.defaultProps = {
10896
- onChange: () => {
10897
- },
10898
- items: []
10899
- };
10900
10899
  var operationalAddressIsSameIds = /* @__PURE__ */ ((operationalAddressIsSameIds2) => {
10901
10900
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_SAME"] = "OperationAddressAnswerYes";
10902
10901
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_NOT_SAME"] = "OperationAddressAnswerNo";
@@ -11494,494 +11493,77 @@ const getMaskedAccountNumber = ({
11494
11493
  accountIdentifier,
11495
11494
  realLastFour
11496
11495
  }) => realLastFour ? `*******${realLastFour}` : accountIdentifier;
11497
- const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
11498
- roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
11499
- min: 1,
11500
- max: Infinity
11501
- }, {
11502
- roleTypes: [DecisionMakerType.OWNER],
11503
- min: 0,
11504
- max: 4
11505
- }, {
11506
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11507
- min: 0,
11508
- max: Infinity
11509
- }, {
11510
- roleTypes: [DecisionMakerType.SIGNATORY],
11511
- min: 1,
11512
- max: Infinity
11513
- }];
11514
- const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
11515
- US: [{
11516
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11517
- min: 1,
11518
- max: Infinity
11519
- }, {
11520
- roleTypes: [DecisionMakerType.OWNER],
11521
- min: 0,
11522
- max: 4
11523
- }, {
11524
- roleTypes: [DecisionMakerType.SIGNATORY],
11525
- min: 1,
11526
- max: Infinity
11527
- }],
11528
- BR: [{
11529
- roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
11530
- min: 1,
11531
- max: Infinity
11532
- }, {
11533
- roleTypes: [DecisionMakerType.OWNER],
11534
- min: 0,
11535
- max: 4
11536
- }, {
11537
- roleTypes: [DecisionMakerType.SIGNATORY],
11538
- min: 1,
11539
- max: Infinity
11540
- }],
11541
- AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11542
- roleTypes: [DecisionMakerType.DIRECTOR],
11543
- min: 3,
11544
- max: Infinity
11545
- }],
11546
- CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11547
- roleTypes: [DecisionMakerType.DIRECTOR],
11548
- min: 1,
11549
- max: Infinity
11550
- }],
11551
- HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11552
- roleTypes: [DecisionMakerType.DIRECTOR],
11553
- min: 1,
11554
- max: Infinity
11555
- }],
11556
- IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11557
- roleTypes: [DecisionMakerType.DIRECTOR],
11558
- min: 3,
11559
- max: 15
11560
- }],
11561
- NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11562
- roleTypes: [DecisionMakerType.DIRECTOR],
11563
- min: 1,
11564
- max: Infinity
11565
- }],
11566
- SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
11567
- roleTypes: [DecisionMakerType.DIRECTOR],
11568
- min: 1,
11569
- max: Infinity
11570
- }]
11571
- };
11572
- const getDecisionMakerRequirements = (country2) => PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] || DEFAULT_DECISION_MAKER_REQUIREMENTS;
11573
- function getAvailableDecisionMakerRoleTypes(country2) {
11574
- const requirements2 = getDecisionMakerRequirements(country2);
11575
- return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
11576
- roleType: req.roleTypes[0],
11577
- min: req.min,
11578
- max: req.max
11579
- }));
11580
- }
11581
- const DEFAULT_DESCRIPTIONS_MAP = {
11582
- [DecisionMakerType.OWNER]: "provideAllOwners",
11583
- [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
11584
- [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
11585
- [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
11586
- };
11587
- const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
11588
- US: {
11589
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11590
- },
11591
- BR: {
11592
- [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
11593
- }
11594
- };
11595
- const getDecisionMakerDescriptionMap = (country2) => ({
11596
- ...DEFAULT_DESCRIPTIONS_MAP,
11597
- ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
11598
- });
11599
- const decisionMakerRoles = {
11600
- [DecisionMakerType.CONTROLLING_PERSON]: {
11601
- id: DecisionMakerType.CONTROLLING_PERSON,
11602
- name: "controllingPerson",
11603
- description: "controllingPersonDescription",
11604
- className: "adl-tag--teal"
11605
- },
11606
- [DecisionMakerType.OWNER]: {
11607
- id: DecisionMakerType.OWNER,
11608
- name: "owner",
11609
- description: "ownerDescription",
11610
- className: "adl-tag--purple"
11611
- },
11612
- [DecisionMakerType.SIGNATORY]: {
11613
- id: DecisionMakerType.SIGNATORY,
11614
- name: "signatory",
11615
- description: "signatoryDescription",
11616
- className: "adl-tag--light-blue"
11617
- },
11618
- [DecisionMakerType.DIRECTOR]: {
11619
- id: DecisionMakerType.DIRECTOR,
11620
- name: "director",
11621
- description: "directorDescription",
11622
- className: "adl-tag--orange"
11623
- }
11496
+ const getDirectEntityAssociations = (rootLE, legalEntityId) => {
11497
+ var _a;
11498
+ return ((_a = rootLE == null ? void 0 : rootLE.entityAssociations) == null ? void 0 : _a.filter((association2) => association2.associatorId === legalEntityId)) ?? [];
11624
11499
  };
11625
- 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) => ({
11626
- ...decisionMakerRole,
11627
- id: decisionMakerRole.id,
11628
- name: i18n.get(decisionMakerRole.name),
11629
- description: i18n.get(decisionMakerRole.description)
11630
- }));
11631
- const getOwnDecisionMakers = (legalEntity) => {
11632
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
11633
- const decisionMakerTypes = Object.values(DecisionMakerType);
11634
- return legalEntity.entityAssociations.filter((entityAssociation) => decisionMakerTypes.includes(entityAssociation.type) && entityAssociation.associatorId === legalEntity.id);
11635
- }
11636
- return [];
11500
+ const getOwnEntityAssociations = (legalEntity) => getDirectEntityAssociations(legalEntity, legalEntity.id);
11501
+ const getOwnSoleProprietorshipIdArray = (legalEntity) => {
11502
+ const ownAssociations = getOwnEntityAssociations(legalEntity);
11503
+ return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11637
11504
  };
11638
- const getOwnSignatories = (legalEntity) => getOwnDecisionMakers(legalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
11639
- const getOwnDecisionMakersLegalEntityIds = (legalEntity) => {
11505
+ const hasSolePropInLegalEntity = (rootLegalEntity) => {
11640
11506
  var _a;
11641
- return (_a = getOwnDecisionMakers(legalEntity)) == null ? void 0 : _a.map((ea) => ea.legalEntityId);
11507
+ return ((_a = rootLegalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === rootLegalEntity.id)) ?? false;
11642
11508
  };
11643
- const getDecisionMakerCount = (legalEntityResponse) => {
11644
- const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
11645
- return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
11646
- decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
11647
- return decisionMakerCount;
11648
- }, {});
11509
+ const getOwnSolePropProblems = (rootLegalEntity, capabilityProblems) => {
11510
+ var _a;
11511
+ const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
11512
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
11649
11513
  };
11650
- const getAllowedDecisionMakerRoles = (legalEntityResponse, taskType) => {
11651
- var _a, _b;
11652
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
11653
- return [DecisionMakerType.OWNER];
11514
+ const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => (entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId)) ?? false;
11515
+ const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
11516
+ const isRootLegalEntity = (legalEntity, taskType) => legalEntity.type === LegalEntityType.INDIVIDUAL && taskType === TaskTypes.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION && taskType === TaskTypes.COMPANY;
11517
+ const filterOutUnwantedAssociationsIfRootLE = (taskType, legalEntity, accountHolder2) => {
11518
+ if (!(legalEntity == null ? void 0 : legalEntity.entityAssociations)) {
11519
+ return void 0;
11654
11520
  }
11655
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11656
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11657
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11658
- const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
11659
- const {
11660
- roleTypes,
11661
- max
11662
- } = requirements2;
11663
- if (roleTypes.length === 1) {
11664
- const role2 = roleTypes[0];
11665
- const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
11666
- if (isBelowMaxRange) {
11667
- acc.push(role2);
11668
- }
11669
- }
11670
- return acc;
11671
- }, []);
11672
- const uniqueAllowedRoles = [...new Set(allowedRoles)];
11673
- return uniqueAllowedRoles;
11521
+ let entityAssociations = getOwnEntityAssociations(legalEntity);
11522
+ if (!isRootLegalEntity(legalEntity, taskType)) {
11523
+ return entityAssociations;
11524
+ }
11525
+ if (accountHolder2 !== "mySoleProprietorName" && hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id)) {
11526
+ entityAssociations = removeEntityAssociationByType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id);
11527
+ }
11528
+ if (accountHolder2 !== "aTrust" && hasOwnEntityAssociationOfType(LegalEntityType.TRUST, entityAssociations, legalEntity.id)) {
11529
+ entityAssociations = removeEntityAssociationByType(LegalEntityType.TRUST, entityAssociations, legalEntity.id);
11530
+ }
11531
+ return entityAssociations;
11674
11532
  };
11675
- const hasMinRequiredDecisionMakerCount = (legalEntityResponse) => {
11676
- var _a, _b;
11677
- const existingDecisionMakerCount = getDecisionMakerCount(legalEntityResponse);
11678
- const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
11679
- const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
11680
- return decisionMakerCountRange.every((requirements2) => {
11681
- const {
11682
- roleTypes,
11683
- min
11684
- } = requirements2;
11685
- return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
11533
+ var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
11534
+ VerificationStatus2["VALID"] = "valid";
11535
+ VerificationStatus2["PENDING"] = "pending";
11536
+ VerificationStatus2["INVALID"] = "invalid";
11537
+ VerificationStatus2["REJECTED"] = "rejected";
11538
+ return VerificationStatus2;
11539
+ })(VerificationStatus || {});
11540
+ function getNestedPropertyKeys(obj, includeUndefined = false) {
11541
+ const fieldNames = [];
11542
+ Object.entries(obj).forEach(([key, value]) => {
11543
+ if (typeof value === "object" && value !== null) {
11544
+ const nested = getNestedPropertyKeys(value).map((name) => `${key}.${name}`);
11545
+ fieldNames.push(...nested);
11546
+ return;
11547
+ }
11548
+ if (value !== void 0 || includeUndefined) {
11549
+ fieldNames.push(key);
11550
+ }
11686
11551
  });
11687
- };
11688
- var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
11689
- TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
11690
- TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
11691
- TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
11692
- TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
11693
- TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
11694
- TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
11695
- TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
11696
- TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
11697
- TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
11698
- TrustTypes2["FAMILY_TRUST"] = "familyTrust";
11699
- TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
11700
- TrustTypes2["FIXED_TRUST"] = "fixedTrust";
11701
- TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
11702
- TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
11703
- TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
11704
- TrustTypes2["OTHER_TRUST"] = "otherTrust";
11705
- TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
11706
- TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
11707
- TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
11708
- return TrustTypes2;
11709
- })(TrustTypes || {});
11710
- const trustTypeOptions = [{
11711
- id: TrustTypes.BUSINESS_TRUST,
11712
- name: "businessTrust"
11713
- }, {
11714
- id: TrustTypes.CASH_MANAGEMENT_TRUST,
11715
- name: "cashManagementTrust"
11716
- }, {
11717
- id: TrustTypes.CHARITABLE_TRUST,
11718
- name: "charitableTrust"
11719
- }, {
11720
- id: TrustTypes.CORPORATE_UNIT_TRUST,
11721
- name: "corporateUnitTrust"
11722
- }, {
11723
- id: TrustTypes.DECEASED_ESTATE,
11724
- name: "deceasedEstate"
11725
- }, {
11726
- id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
11727
- name: "discretionaryInvestmentTrust"
11728
- }, {
11729
- id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
11730
- name: "discretionaryServicesManagementTrust"
11731
- }, {
11732
- id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
11733
- name: "discretionaryTradingTrust"
11734
- }, {
11735
- id: TrustTypes.DISCRETIONARY_TRUST,
11736
- name: "discretionaryTrust"
11737
- }, {
11738
- id: TrustTypes.FAMILY_TRUST,
11739
- name: "familyTrust"
11740
- }, {
11741
- id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
11742
- name: "firstHomeSaverAccountsTrust"
11743
- }, {
11744
- id: TrustTypes.FIXED_TRUST,
11745
- name: "fixedTrust"
11746
- }, {
11747
- id: TrustTypes.FIXED_UNIT_TRUST,
11748
- name: "fixedUnitTrust"
11749
- }, {
11750
- id: TrustTypes.HYBRID_TRUST,
11751
- name: "hybridTrust"
11752
- }, {
11753
- id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
11754
- name: "listedPublicUnitTrust"
11755
- }, {
11756
- id: TrustTypes.OTHER_TRUST,
11757
- name: "otherTrust"
11758
- }, {
11759
- id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
11760
- name: "pooledSuperannuationTrust"
11761
- }, {
11762
- id: TrustTypes.PUBLIC_TRADING_TRUST,
11763
- name: "publicTradingTrust"
11764
- }, {
11765
- id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
11766
- name: "unlistedPublicUnitTrust"
11767
- }];
11768
- const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
11769
- 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];
11770
- const countryToTrustTypes = {
11771
- [CountryCodes.Australia]: auSpecificTrustTypes,
11772
- [CountryCodes.NewZealand]: nzSpecificTrustTypes
11773
- };
11774
- const TRUST_MEMBER_COUNT_RANGE = {
11775
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11776
- min: 1
11777
- },
11778
- [TrustMemberTypes.SETTLOR]: {
11779
- min: 1
11780
- }
11781
- };
11782
- const isPartOfTrustFromLegalEntity = (legalEntity) => {
11783
- var _a;
11784
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
11785
- };
11786
- const getRootTrusteeLegalEntityId = (trustEntity) => {
11787
- var _a;
11788
- if (!trustEntity.entityAssociations)
11789
- return "";
11790
- return (_a = trustEntity.entityAssociations.filter((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)[0]) == null ? void 0 : _a.legalEntityId;
11791
- };
11792
- const getOwnTrustMembers = (trustEntity) => {
11793
- if (!trustEntity.entityAssociations)
11794
- return [];
11795
- const rootTrusteeLegalEntityId = getRootTrusteeLegalEntityId(trustEntity);
11796
- return trustEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && rootTrusteeLegalEntityId === (entityAssociation == null ? void 0 : entityAssociation.associatorId));
11797
- };
11798
- const getOwnTrustMembersLegalEntityIds = (legalEntity) => getOwnTrustMembers(legalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
11799
- const getOwnTrustLegalEntityId = (legalEntity) => {
11800
- var _a, _b;
11801
- 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;
11802
- };
11803
- const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
11804
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11805
- return trustLegalEntityId ? [trustLegalEntityId] : [];
11806
- };
11807
- const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
11808
- var _a;
11809
- const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
11810
- if (trustLegalEntityId) {
11811
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
11812
- }
11813
- };
11814
- const getTrustMemberCount = (legalEntity) => {
11815
- const trustMembers2 = getOwnTrustMembers(legalEntity);
11816
- return trustMembers2.reduce((trustMemberCount, trustMember) => {
11817
- trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
11818
- return trustMemberCount;
11819
- }, {});
11820
- };
11821
- const hasMinRequiredTrustMemberCount = (legalEntity) => {
11822
- const existingTrustMemberCount = getTrustMemberCount(legalEntity);
11823
- const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
11824
- return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
11825
- };
11826
- const makeSelectItemForTrustRole = (role2, i18n) => ({
11827
- ...trustMemberRoles[role2],
11828
- name: i18n.get(trustMemberRoles[role2].name),
11829
- description: i18n.get(trustMemberRoles[role2].description)
11830
- });
11831
- const getTrustMemberName = (trustMemberType) => trustMemberRoles[trustMemberType].name;
11832
- const trustMemberRoles = {
11833
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
11834
- id: TrustMemberTypes.DEFINED_BENEFICIARY,
11835
- name: "definedBeneficiary",
11836
- description: "definedBeneficiaryDescription",
11837
- className: "adl-tag--orange"
11838
- },
11839
- [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
11840
- id: TrustMemberTypes.UNDEFINED_BENEFICIARY,
11841
- name: "undefinedBeneficiary",
11842
- description: "undefinedBeneficiaryDescription",
11843
- className: "adl-tag--orange"
11844
- },
11845
- [TrustMemberTypes.PROTECTOR]: {
11846
- id: TrustMemberTypes.PROTECTOR,
11847
- name: "protector",
11848
- description: "personAppointmentUnderTrustInstrument",
11849
- className: "adl-tag--orange"
11850
- },
11851
- [TrustMemberTypes.TRUSTEE]: {
11852
- id: TrustMemberTypes.TRUSTEE,
11853
- name: "trustee",
11854
- description: "legalOwnerOfProperty",
11855
- className: "adl-tag--light-blue"
11856
- },
11857
- [TrustMemberTypes.SETTLOR]: {
11858
- id: TrustMemberTypes.SETTLOR,
11859
- name: "settlor",
11860
- description: "entityEstablishingTrust",
11861
- className: "adl-tag--orange"
11862
- }
11863
- };
11864
- const trustMemberGuidanceRoles = {
11865
- [TrustMemberGuidanceLabel.BENEFICIARY]: {
11866
- id: TrustMemberGuidanceLabel.BENEFICIARY,
11867
- name: TrustMemberGuidanceLabel.BENEFICIARY,
11868
- className: "adl-tag--orange"
11869
- },
11870
- [TrustMemberGuidanceLabel.PROTECTOR]: {
11871
- id: TrustMemberGuidanceLabel.PROTECTOR,
11872
- name: TrustMemberGuidanceLabel.PROTECTOR,
11873
- className: "adl-tag--orange"
11874
- },
11875
- [TrustMemberGuidanceLabel.TRUSTEE]: {
11876
- id: TrustMemberGuidanceLabel.TRUSTEE,
11877
- name: TrustMemberGuidanceLabel.TRUSTEE,
11878
- className: "adl-tag--light-blue"
11879
- },
11880
- [TrustMemberGuidanceLabel.SETTLOR]: {
11881
- id: TrustMemberGuidanceLabel.SETTLOR,
11882
- name: TrustMemberGuidanceLabel.SETTLOR,
11883
- className: "adl-tag--orange"
11884
- }
11885
- };
11886
- const getCountrySpecificTrustTypeOptions = (country2) => {
11887
- const countrySpecificTrustTypes = countryToTrustTypes[country2];
11888
- if (!countrySpecificTrustTypes) {
11889
- return [];
11890
- }
11891
- return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
11892
- const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
11893
- if (!countrySpecificTrustTypeOption) {
11894
- throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
11895
- }
11896
- return countrySpecificTrustTypeOption;
11897
- });
11898
- };
11899
- const entityAssociationRoles = {
11900
- ...trustMemberRoles,
11901
- ...decisionMakerRoles
11902
- };
11903
- const getEntityAssociationTagColor = (entityAssociationType) => {
11904
- var _a;
11905
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.className;
11906
- };
11907
- const getEntityAssociationName = (entityAssociationType) => {
11908
- var _a;
11909
- return (_a = entityAssociationRoles[entityAssociationType]) == null ? void 0 : _a.name;
11910
- };
11911
- const getOwnEntityAssociations = (legalEntity) => {
11912
- if (legalEntity == null ? void 0 : legalEntity.entityAssociations) {
11913
- return legalEntity.entityAssociations.filter((entityAssociation) => entityAssociation.associatorId === legalEntity.id);
11914
- }
11915
- return [];
11916
- };
11917
- const getOwnSoleProprietorshipIdArray = (legalEntity) => {
11918
- const ownAssociations = getOwnEntityAssociations(legalEntity);
11919
- return ownAssociations.filter((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP).map((ea) => ea.legalEntityId);
11920
- };
11921
- const hasSolePropInLegalEntity = (legalEntity) => {
11922
- var _a;
11923
- return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.SOLE_PROPRIETORSHIP && ea.associatorId === legalEntity.id);
11924
- };
11925
- const getOwnSolePropProblems = (legalEntity, capabilityProblems) => {
11926
- var _a;
11927
- const solePropLegalEntityId = getOwnSoleProprietorshipIdArray(legalEntity)[0];
11928
- if (solePropLegalEntityId) {
11929
- return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[solePropLegalEntityId];
11930
- }
11931
- };
11932
- const hasOwnEntityAssociationOfType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.some((ea) => ea.type === type && ea.associatorId === legalEntityId);
11933
- const removeEntityAssociationByType = (type, entityAssociations, legalEntityId) => entityAssociations == null ? void 0 : entityAssociations.filter((ea) => ea.type !== type || ea.associatorId !== legalEntityId);
11934
- const isRootLegalEntity = (legalEntity, taskType) => legalEntity.type === LegalEntityType.INDIVIDUAL && taskType === TaskTypes.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION && taskType === TaskTypes.COMPANY;
11935
- const filterOutUnwantedAssociationsIfRootLE = (taskType, legalEntity, accountHolder2) => {
11936
- if (!(legalEntity == null ? void 0 : legalEntity.entityAssociations)) {
11937
- return void 0;
11938
- }
11939
- let entityAssociations = getOwnEntityAssociations(legalEntity);
11940
- if (!isRootLegalEntity(legalEntity, taskType)) {
11941
- return entityAssociations;
11942
- }
11943
- if (accountHolder2 !== "mySoleProprietorName" && hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id)) {
11944
- entityAssociations = removeEntityAssociationByType(LegalEntityType.SOLE_PROPRIETORSHIP, entityAssociations, legalEntity.id);
11945
- }
11946
- if (accountHolder2 !== "aTrust" && hasOwnEntityAssociationOfType(LegalEntityType.TRUST, entityAssociations, legalEntity.id)) {
11947
- entityAssociations = removeEntityAssociationByType(LegalEntityType.TRUST, entityAssociations, legalEntity.id);
11948
- }
11949
- return entityAssociations;
11950
- };
11951
- var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
11952
- VerificationStatus2["VALID"] = "valid";
11953
- VerificationStatus2["PENDING"] = "pending";
11954
- VerificationStatus2["INVALID"] = "invalid";
11955
- VerificationStatus2["REJECTED"] = "rejected";
11956
- return VerificationStatus2;
11957
- })(VerificationStatus || {});
11958
- function getNestedPropertyKeys(obj, includeUndefined = false) {
11959
- const fieldNames = [];
11960
- Object.entries(obj).forEach(([key, value]) => {
11961
- if (typeof value === "object" && value !== null) {
11962
- const nested = getNestedPropertyKeys(value).map((name) => `${key}.${name}`);
11963
- fieldNames.push(...nested);
11964
- return;
11965
- }
11966
- if (value !== void 0 || includeUndefined) {
11967
- fieldNames.push(key);
11968
- }
11969
- });
11970
- return fieldNames;
11971
- }
11972
- const getTaskStatus = (type, capabilityProblems, legalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
11973
- if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(legalEntity.id) && isEmptyEntity(legalEntity))
11974
- return TaskStatus.EMPTY;
11975
- const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
11976
- if (importantCapabilityStatus)
11977
- return importantCapabilityStatus;
11978
- if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(legalEntity))
11979
- return TaskStatus.PROCESSING;
11980
- return TaskStatus.FINISHED;
11552
+ return fieldNames;
11553
+ }
11554
+ const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
11555
+ if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
11556
+ return TaskStatus.EMPTY;
11557
+ const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
11558
+ if (importantCapabilityStatus)
11559
+ return importantCapabilityStatus;
11560
+ if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
11561
+ return TaskStatus.PROCESSING;
11562
+ return TaskStatus.FINISHED;
11981
11563
  };
11982
11564
  const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
11983
11565
  function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
11984
- if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]))
11566
+ if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
11985
11567
  return;
11986
11568
  const importantStatuses = Object.entries(capabilityProblems[type]).filter(([key]) => entityIds.includes(key)).map(([, value]) => value.status).filter((status) => IMPORTANT_STATUSES.includes(status));
11987
11569
  if (!importantStatuses.length)
@@ -12009,7 +11591,10 @@ function isEmptyEntity(legalEntity) {
12009
11591
  if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
12010
11592
  return false;
12011
11593
  const minimumFields = emptyFieldsByEntityType[type];
12012
- const fieldsOnEntity = getNestedPropertyKeys(legalEntity[type]);
11594
+ const typeSpecificSection = legalEntity[type];
11595
+ if (!typeSpecificSection)
11596
+ return true;
11597
+ const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
12013
11598
  return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
12014
11599
  }
12015
11600
  const entityTypeToCorrespondingAccountHolderOption = {
@@ -14264,7 +13849,8 @@ function ContactDetailsComponent(props) {
14264
13849
  setState: null
14265
13850
  });
14266
13851
  useEffect(() => {
14267
- stateRef.current.setState({
13852
+ var _a, _b;
13853
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14268
13854
  type: "addToState",
14269
13855
  value: {
14270
13856
  data,
@@ -14322,86 +13908,86 @@ ContactDetailsComponent.defaultProps = {
14322
13908
  data: {}
14323
13909
  };
14324
13910
  const IdentityNumber$1 = "";
13911
+ const CHECKCHARACTER_ODD_VALUE = {
13912
+ 0: 1,
13913
+ 1: 0,
13914
+ 2: 5,
13915
+ 3: 7,
13916
+ 4: 9,
13917
+ 5: 13,
13918
+ 6: 15,
13919
+ 7: 17,
13920
+ 8: 19,
13921
+ 9: 21,
13922
+ A: 1,
13923
+ B: 0,
13924
+ C: 5,
13925
+ D: 7,
13926
+ E: 9,
13927
+ F: 13,
13928
+ G: 15,
13929
+ H: 17,
13930
+ I: 19,
13931
+ J: 21,
13932
+ K: 2,
13933
+ L: 4,
13934
+ M: 18,
13935
+ N: 20,
13936
+ O: 11,
13937
+ P: 3,
13938
+ Q: 6,
13939
+ R: 8,
13940
+ S: 12,
13941
+ T: 14,
13942
+ U: 16,
13943
+ V: 10,
13944
+ W: 22,
13945
+ X: 25,
13946
+ Y: 24,
13947
+ Z: 23
13948
+ };
13949
+ const CHECKCHARACTER_EVEN_VALUE = {
13950
+ 0: 0,
13951
+ 1: 1,
13952
+ 2: 2,
13953
+ 3: 3,
13954
+ 4: 4,
13955
+ 5: 5,
13956
+ 6: 6,
13957
+ 7: 7,
13958
+ 8: 8,
13959
+ 9: 9,
13960
+ A: 0,
13961
+ B: 1,
13962
+ C: 2,
13963
+ D: 3,
13964
+ E: 4,
13965
+ F: 5,
13966
+ G: 6,
13967
+ H: 7,
13968
+ I: 8,
13969
+ J: 9,
13970
+ K: 10,
13971
+ L: 11,
13972
+ M: 12,
13973
+ N: 13,
13974
+ O: 14,
13975
+ P: 15,
13976
+ Q: 16,
13977
+ R: 17,
13978
+ S: 18,
13979
+ T: 19,
13980
+ U: 20,
13981
+ V: 21,
13982
+ W: 22,
13983
+ X: 23,
13984
+ Y: 24,
13985
+ Z: 25
13986
+ };
14325
13987
  function validCheckCharacter(input, calculationInput) {
14326
13988
  if (!/^[A-Z]$/.test(input)) {
14327
13989
  return false;
14328
13990
  }
14329
- const CHECKCHARACTER_ODD_VALUE = {
14330
- 0: 1,
14331
- 9: 21,
14332
- I: 19,
14333
- R: 8,
14334
- 1: 0,
14335
- A: 1,
14336
- J: 21,
14337
- S: 12,
14338
- 2: 5,
14339
- B: 0,
14340
- K: 2,
14341
- T: 14,
14342
- 3: 7,
14343
- C: 5,
14344
- L: 4,
14345
- U: 16,
14346
- 4: 9,
14347
- D: 7,
14348
- M: 18,
14349
- V: 10,
14350
- 5: 13,
14351
- E: 9,
14352
- N: 20,
14353
- W: 22,
14354
- 6: 15,
14355
- F: 13,
14356
- O: 11,
14357
- X: 25,
14358
- 7: 17,
14359
- G: 15,
14360
- P: 3,
14361
- Y: 24,
14362
- 8: 19,
14363
- H: 17,
14364
- Q: 6,
14365
- Z: 23
14366
- };
14367
- const CHECKCHARACTER_EVEN_VALUE = {
14368
- 0: 0,
14369
- 9: 9,
14370
- I: 8,
14371
- R: 17,
14372
- 1: 1,
14373
- A: 0,
14374
- J: 9,
14375
- S: 18,
14376
- 2: 2,
14377
- B: 1,
14378
- K: 10,
14379
- T: 19,
14380
- 3: 3,
14381
- C: 2,
14382
- L: 11,
14383
- U: 20,
14384
- 4: 4,
14385
- D: 3,
14386
- M: 12,
14387
- V: 21,
14388
- 5: 5,
14389
- E: 4,
14390
- N: 13,
14391
- W: 22,
14392
- 6: 6,
14393
- F: 5,
14394
- O: 14,
14395
- X: 23,
14396
- 7: 7,
14397
- G: 6,
14398
- P: 15,
14399
- Y: 24,
14400
- 8: 8,
14401
- H: 7,
14402
- Q: 16,
14403
- Z: 25
14404
- };
14405
13991
  let total = 0;
14406
13992
  for (let i = 0; i < 15; i += 1) {
14407
13993
  const set = i % 2 === 1 ? CHECKCHARACTER_EVEN_VALUE : CHECKCHARACTER_ODD_VALUE;
@@ -14412,14 +13998,8 @@ function validCheckCharacter(input, calculationInput) {
14412
13998
  }
14413
13999
  total = (total + value) % 26;
14414
14000
  }
14415
- if (total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input) {
14416
- return true;
14417
- }
14418
- return false;
14001
+ return total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input;
14419
14002
  }
14420
- const helper = {
14421
- validCheckCharacter
14422
- };
14423
14003
  const countryIdNumberFormatters = {
14424
14004
  [CountryCodes.Brazil]: {
14425
14005
  idNumber: {
@@ -14481,7 +14061,7 @@ const countryIdNumberValidationRules = {
14481
14061
  },
14482
14062
  [CountryCodes.Italy]: {
14483
14063
  idNumber: [{
14484
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && helper.validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14064
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14485
14065
  modes: ["blur"],
14486
14066
  errorMessage: "invalidFormatIdentityNumberIT"
14487
14067
  }]
@@ -14545,7 +14125,7 @@ function IdentityNumber(props) {
14545
14125
  dataStoreId,
14546
14126
  country: country2,
14547
14127
  errors: propErrors,
14548
- data: propData,
14128
+ data: propData = {},
14549
14129
  requiredFields,
14550
14130
  fieldValidationErrors,
14551
14131
  maskedFields,
@@ -14689,17 +14269,91 @@ function IdentityNumber(props) {
14689
14269
  });
14690
14270
  }
14691
14271
  const IdentityNumberComponent = memo(IdentityNumber, (prevProps, nextProps) => prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.errors, nextProps.errors) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14692
- IdentityNumberComponent.defaultProps = {
14693
- data: {},
14694
- onChange: () => {
14695
- }
14696
- };
14697
- const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14698
- if (propagationMode === "stop")
14699
- event.stopPropagation();
14700
- if (keys.includes(event.key)) {
14701
- if (propagationMode === "stopIfMatches")
14702
- event.stopPropagation();
14272
+ const roleMetadata = {
14273
+ [DecisionMakerType.CONTROLLING_PERSON]: {
14274
+ name: "controllingPerson",
14275
+ description: "controllingPersonDescription",
14276
+ className: "adl-tag--teal"
14277
+ },
14278
+ [DecisionMakerType.OWNER]: {
14279
+ name: "owner",
14280
+ description: "ownerDescription",
14281
+ className: "adl-tag--purple"
14282
+ },
14283
+ [DecisionMakerType.SIGNATORY]: {
14284
+ name: "signatory",
14285
+ description: "signatoryDescription",
14286
+ className: "adl-tag--light-blue"
14287
+ },
14288
+ [DecisionMakerType.DIRECTOR]: {
14289
+ name: "director",
14290
+ description: "directorDescription",
14291
+ className: "adl-tag--orange"
14292
+ },
14293
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
14294
+ name: "definedBeneficiary",
14295
+ description: "definedBeneficiaryDescription",
14296
+ className: "adl-tag--orange"
14297
+ },
14298
+ [TrustMemberTypes.UNDEFINED_BENEFICIARY]: {
14299
+ name: "undefinedBeneficiary",
14300
+ description: "undefinedBeneficiaryDescription",
14301
+ className: "adl-tag--orange"
14302
+ },
14303
+ [TrustMemberTypes.PROTECTOR]: {
14304
+ name: "protector",
14305
+ description: "personAppointmentUnderTrustInstrument",
14306
+ className: "adl-tag--orange"
14307
+ },
14308
+ [TrustMemberTypes.TRUSTEE]: {
14309
+ name: "trustee",
14310
+ description: "legalOwnerOfProperty",
14311
+ className: "adl-tag--light-blue"
14312
+ },
14313
+ [TrustMemberTypes.SETTLOR]: {
14314
+ name: "settlor",
14315
+ description: "entityEstablishingTrust",
14316
+ className: "adl-tag--orange"
14317
+ },
14318
+ [TrustMemberGuidanceLabel.BENEFICIARY]: {
14319
+ name: TrustMemberGuidanceLabel.BENEFICIARY,
14320
+ className: "adl-tag--orange"
14321
+ },
14322
+ [TrustMemberGuidanceLabel.TRUSTEE]: {
14323
+ name: TrustMemberGuidanceLabel.TRUSTEE,
14324
+ className: "adl-tag--light-blue"
14325
+ }
14326
+ };
14327
+ const getRoleTagColor = (role2) => {
14328
+ var _a;
14329
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.className) ?? "adl-tag--blue";
14330
+ };
14331
+ const getRoleName = (role2) => {
14332
+ var _a;
14333
+ return ((_a = roleMetadata[role2]) == null ? void 0 : _a.name) ?? role2;
14334
+ };
14335
+ const makeSelectItemForRole = (role2, i18n) => {
14336
+ const metadata = roleMetadata[role2];
14337
+ if (!metadata)
14338
+ throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
14339
+ const {
14340
+ name,
14341
+ description: description2,
14342
+ className
14343
+ } = metadata;
14344
+ return {
14345
+ id: role2,
14346
+ name: i18n.get(name),
14347
+ description: description2 ? i18n.get(description2) : void 0,
14348
+ className
14349
+ };
14350
+ };
14351
+ const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14352
+ if (propagationMode === "stop")
14353
+ event.stopPropagation();
14354
+ if (keys.includes(event.key)) {
14355
+ if (propagationMode === "stopIfMatches")
14356
+ event.stopPropagation();
14703
14357
  callback();
14704
14358
  }
14705
14359
  };
@@ -14769,19 +14423,10 @@ const DecisionMakerRoleComponent = (props) => {
14769
14423
  defaultData: dataProp,
14770
14424
  fieldProblems: fieldValidationErrors
14771
14425
  });
14772
- const [decisionMakerRoles2, setDecisionMakerRoles] = useState([]);
14773
14426
  const stateRef = useRef({
14774
14427
  setState: null
14775
14428
  });
14776
14429
  const formUtils = formUtilities(props, i18n);
14777
- const allowedRolesString = allowedRoles == null ? void 0 : allowedRoles.toString();
14778
- const makeSelectItemForDecisionMakerRole = (role2) => {
14779
- const validRole = decisionMakerRoles2.find((item) => item.id === role2);
14780
- return {
14781
- ...validRole,
14782
- disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(validRole == null ? void 0 : validRole.id))
14783
- };
14784
- };
14785
14430
  const changeRoles = (roles) => {
14786
14431
  handleChangeFor("role", "input")(roles);
14787
14432
  };
@@ -14799,9 +14444,6 @@ const DecisionMakerRoleComponent = (props) => {
14799
14444
  }
14800
14445
  });
14801
14446
  }, [data, valid, errors, isValid, dataStoreId, fieldProblems]);
14802
- useEffect(() => {
14803
- setDecisionMakerRoles(getTranslatedDecisionMakerRoles(i18n, allowedRoles));
14804
- }, [allowedRoles, allowedRolesString, i18n, i18n.languageCode, i18n.locale]);
14805
14447
  return jsxs("div", {
14806
14448
  className: "adyen-kyc-field__role",
14807
14449
  children: [jsx(StateContextSetter, {
@@ -14818,7 +14460,10 @@ const DecisionMakerRoleComponent = (props) => {
14818
14460
  options: allowedRoles ?? [],
14819
14461
  selected: data.role ?? [],
14820
14462
  onSelect: changeRoles,
14821
- mapToSelectItem: makeSelectItemForDecisionMakerRole
14463
+ mapToSelectItem: (role2) => ({
14464
+ ...makeSelectItemForRole(role2, i18n),
14465
+ disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(role2))
14466
+ })
14822
14467
  })
14823
14468
  })]
14824
14469
  });
@@ -14961,7 +14606,7 @@ const personalDetailsValidationRules = {
14961
14606
  errorMessage: "fieldIsRequired"
14962
14607
  }, {
14963
14608
  modes: ["blur"],
14964
- validate: (birthDate2) => birthDate2 && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14609
+ validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14965
14610
  errorMessage: "invalidDateOfBirth"
14966
14611
  }],
14967
14612
  residencyCountry: {
@@ -16460,13 +16105,9 @@ const refreshSession = async () => {
16460
16105
  };
16461
16106
  const addAnimationStartListener = (element, listener) => {
16462
16107
  element.addEventListener("animationstart", listener, false);
16463
- element.addEventListener("MSAnimationStart", listener, false);
16464
- element.addEventListener("webkitAnimationStart", listener, false);
16465
16108
  };
16466
16109
  const removeAnimationStartListener = (element, listener) => {
16467
16110
  element.removeEventListener("animationstart", listener, false);
16468
- element.removeEventListener("MSAnimationStart", listener, false);
16469
- element.removeEventListener("webkitAnimationStart", listener, false);
16470
16111
  };
16471
16112
  const logger$e = createLogger("Fetch");
16472
16113
  const getRequestObject = (options, data) => {
@@ -16596,6 +16237,8 @@ const httpPost = async (options, data) => http({
16596
16237
  }, data);
16597
16238
  const removeElementSiblings = (element) => {
16598
16239
  const parent = element.parentNode;
16240
+ if (!parent)
16241
+ return;
16599
16242
  let child = parent.firstChild;
16600
16243
  while (child) {
16601
16244
  if (child !== element)
@@ -17274,7 +16917,8 @@ function BankAccountNumber(props) {
17274
16917
  maskedFields: props.maskedFields
17275
16918
  });
17276
16919
  useEffect(() => {
17277
- stateRef.current.setState({
16920
+ var _a, _b;
16921
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17278
16922
  type: "addToState",
17279
16923
  value: {
17280
16924
  data,
@@ -17338,7 +16982,8 @@ function BankCity(props) {
17338
16982
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17339
16983
  });
17340
16984
  useEffect(() => {
17341
- stateRef.current.setState({
16985
+ var _a, _b;
16986
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17342
16987
  type: "addToState",
17343
16988
  value: {
17344
16989
  data,
@@ -17401,7 +17046,8 @@ function BankCode(props) {
17401
17046
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17402
17047
  });
17403
17048
  useEffect(() => {
17404
- stateRef.current.setState({
17049
+ var _a, _b;
17050
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17405
17051
  type: "addToState",
17406
17052
  value: {
17407
17053
  data,
@@ -17464,7 +17110,8 @@ function BankName(props) {
17464
17110
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17465
17111
  });
17466
17112
  useEffect(() => {
17467
- stateRef.current.setState({
17113
+ var _a, _b;
17114
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17468
17115
  type: "addToState",
17469
17116
  value: {
17470
17117
  data,
@@ -17527,7 +17174,8 @@ function BranchCode(props) {
17527
17174
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17528
17175
  });
17529
17176
  useEffect(() => {
17530
- stateRef.current.setState({
17177
+ var _a, _b;
17178
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17531
17179
  type: "addToState",
17532
17180
  value: {
17533
17181
  data,
@@ -17781,7 +17429,8 @@ function SwiftCode(props) {
17781
17429
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
17782
17430
  });
17783
17431
  useEffect(() => {
17784
- stateRef.current.setState({
17432
+ var _a, _b;
17433
+ (_b = (_a = stateRef == null ? void 0 : stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
17785
17434
  type: "addToState",
17786
17435
  value: {
17787
17436
  data,
@@ -18858,93 +18507,414 @@ const solePropForms = {
18858
18507
  fields: ["constitutionalDocument"]
18859
18508
  }
18860
18509
  };
18861
- const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
18862
- const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
18863
- const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
18864
- const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
18865
- function SolePropComponent(props) {
18866
- const {
18867
- i18n
18868
- } = useI18nContext();
18869
- const {
18870
- isExperimentEnabled
18871
- } = useExperimentsContext();
18872
- const [tradingName2, setTradingName] = useState();
18873
- const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18874
- const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
18875
- const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
18876
- const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
18877
- const handleStateChange = ({
18878
- currentState
18879
- }) => {
18880
- var _a, _b, _c;
18881
- const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18882
- setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18883
- };
18884
- const renderActiveForm = (activeForm) => {
18885
- var _a;
18886
- return jsxs(Fragment, {
18887
- children: [jsx(StateContextWatcher, {
18888
- owner: "SolePropComponent",
18889
- onChange: handleStateChange
18890
- }), jsx("div", {
18891
- className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18892
- children: jsx(CompanyNameAndCountryComponent, {
18893
- ...solePropNameAndCountryFormProps,
18894
- data: {
18895
- ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18896
- country: props == null ? void 0 : props.country,
18897
- legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18898
- },
18899
- labels: {
18900
- country: "countryOfEstablishment",
18901
- legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18902
- },
18903
- heading: i18n.get("nameAndCountry"),
18904
- id: solePropNameAndCountryFormId,
18905
- disableCountry: true,
18906
- isTopLevelEntity: false
18907
- })
18908
- }), jsx("div", {
18909
- className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18910
- children: jsx(CompanyRegistrationDetailsComponent, {
18911
- ...solePropsRegistrationDetailsFormProps,
18912
- data: {
18913
- ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18914
- tradingName: tradingName2
18915
- },
18916
- heading: i18n.get("registrationDetails"),
18917
- id: solePropRegistrationDetailsFormId,
18918
- companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18919
- country: props.country
18920
- })
18921
- }), jsx("div", {
18922
- className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18923
- children: jsx(RegistrationAddressComponent, {
18924
- ...solePropRegistrationAddressFormProps,
18925
- heading: i18n.get("registeredAddress"),
18926
- id: solePropRegistrationAddressFormId,
18927
- country: props.country,
18928
- problems: props == null ? void 0 : props.problems,
18929
- handleAddressSearch: props.handleAddressSearch,
18930
- handleFindAddress: props.handleFindAddress
18931
- })
18932
- }), jsx("div", {
18933
- className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18934
- children: jsx(ConstitutionalDocumentUpload, {
18935
- ...solePropDocumentsFormProps,
18936
- id: solePropDocumentFormId,
18937
- legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18938
- })
18939
- })]
18940
- });
18941
- };
18942
- return jsx("div", {
18943
- className: "adyen-kyc-sol-prop",
18944
- children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18510
+ const solePropNameAndCountryFormId = solePropForms.solePropNameAndCountry.formId;
18511
+ const solePropRegistrationAddressFormId = solePropForms.solePropRegistrationAddress.formId;
18512
+ const solePropRegistrationDetailsFormId = solePropForms.solePropRegistrationDetails.formId;
18513
+ const solePropDocumentFormId = solePropForms.solePropConstitutionalDocument.formId;
18514
+ function SolePropComponent(props) {
18515
+ const {
18516
+ i18n
18517
+ } = useI18nContext();
18518
+ const {
18519
+ isExperimentEnabled
18520
+ } = useExperimentsContext();
18521
+ const [tradingName2, setTradingName] = useState();
18522
+ const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18523
+ const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
18524
+ const solePropRegistrationAddressFormProps = getFormProps(props, solePropRegistrationAddressFormId);
18525
+ const solePropDocumentsFormProps = getFormProps(props, solePropDocumentFormId);
18526
+ const handleStateChange = ({
18527
+ currentState
18528
+ }) => {
18529
+ var _a, _b, _c;
18530
+ const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18531
+ setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18532
+ };
18533
+ const renderActiveForm = (activeForm) => {
18534
+ var _a;
18535
+ return jsxs(Fragment, {
18536
+ children: [jsx(StateContextWatcher, {
18537
+ owner: "SolePropComponent",
18538
+ onChange: handleStateChange
18539
+ }), jsx("div", {
18540
+ className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18541
+ children: jsx(CompanyNameAndCountryComponent, {
18542
+ ...solePropNameAndCountryFormProps,
18543
+ data: {
18544
+ ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18545
+ country: props == null ? void 0 : props.country,
18546
+ legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18547
+ },
18548
+ labels: {
18549
+ country: "countryOfEstablishment",
18550
+ legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18551
+ },
18552
+ heading: i18n.get("nameAndCountry"),
18553
+ id: solePropNameAndCountryFormId,
18554
+ disableCountry: true,
18555
+ isTopLevelEntity: false
18556
+ })
18557
+ }), jsx("div", {
18558
+ className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18559
+ children: jsx(CompanyRegistrationDetailsComponent, {
18560
+ ...solePropsRegistrationDetailsFormProps,
18561
+ data: {
18562
+ ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18563
+ tradingName: tradingName2
18564
+ },
18565
+ heading: i18n.get("registrationDetails"),
18566
+ id: solePropRegistrationDetailsFormId,
18567
+ companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18568
+ country: props.country
18569
+ })
18570
+ }), jsx("div", {
18571
+ className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18572
+ children: jsx(RegistrationAddressComponent, {
18573
+ ...solePropRegistrationAddressFormProps,
18574
+ heading: i18n.get("registeredAddress"),
18575
+ id: solePropRegistrationAddressFormId,
18576
+ country: props.country,
18577
+ problems: props == null ? void 0 : props.problems,
18578
+ handleAddressSearch: props.handleAddressSearch,
18579
+ handleFindAddress: props.handleFindAddress
18580
+ })
18581
+ }), jsx("div", {
18582
+ className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18583
+ children: jsx(ConstitutionalDocumentUpload, {
18584
+ ...solePropDocumentsFormProps,
18585
+ id: solePropDocumentFormId,
18586
+ legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18587
+ })
18588
+ })]
18589
+ });
18590
+ };
18591
+ return jsx("div", {
18592
+ className: "adyen-kyc-sol-prop",
18593
+ children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
18594
+ });
18595
+ }
18596
+ const Trust = "";
18597
+ var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18598
+ TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
18599
+ TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
18600
+ TrustTypes2["CHARITABLE_TRUST"] = "charitableTrust";
18601
+ TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
18602
+ TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
18603
+ TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
18604
+ TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
18605
+ TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
18606
+ TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
18607
+ TrustTypes2["FAMILY_TRUST"] = "familyTrust";
18608
+ TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
18609
+ TrustTypes2["FIXED_TRUST"] = "fixedTrust";
18610
+ TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
18611
+ TrustTypes2["HYBRID_TRUST"] = "hybridTrust";
18612
+ TrustTypes2["LISTED_PUBLIC_UNIT_TRUST"] = "listedPublicUnitTrust";
18613
+ TrustTypes2["OTHER_TRUST"] = "otherTrust";
18614
+ TrustTypes2["POOLED_SUPERANNUATION_TRUST"] = "pooledSuperannuationTrust";
18615
+ TrustTypes2["PUBLIC_TRADING_TRUST"] = "publicTradingTrust";
18616
+ TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
18617
+ return TrustTypes2;
18618
+ })(TrustTypes || {});
18619
+ const trustTypeOptions = [{
18620
+ id: TrustTypes.BUSINESS_TRUST,
18621
+ name: "businessTrust"
18622
+ }, {
18623
+ id: TrustTypes.CASH_MANAGEMENT_TRUST,
18624
+ name: "cashManagementTrust"
18625
+ }, {
18626
+ id: TrustTypes.CHARITABLE_TRUST,
18627
+ name: "charitableTrust"
18628
+ }, {
18629
+ id: TrustTypes.CORPORATE_UNIT_TRUST,
18630
+ name: "corporateUnitTrust"
18631
+ }, {
18632
+ id: TrustTypes.DECEASED_ESTATE,
18633
+ name: "deceasedEstate"
18634
+ }, {
18635
+ id: TrustTypes.DISCRETIONARY_INVESTMENT_TRUST,
18636
+ name: "discretionaryInvestmentTrust"
18637
+ }, {
18638
+ id: TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST,
18639
+ name: "discretionaryServicesManagementTrust"
18640
+ }, {
18641
+ id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
18642
+ name: "discretionaryTradingTrust"
18643
+ }, {
18644
+ id: TrustTypes.DISCRETIONARY_TRUST,
18645
+ name: "discretionaryTrust"
18646
+ }, {
18647
+ id: TrustTypes.FAMILY_TRUST,
18648
+ name: "familyTrust"
18649
+ }, {
18650
+ id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
18651
+ name: "firstHomeSaverAccountsTrust"
18652
+ }, {
18653
+ id: TrustTypes.FIXED_TRUST,
18654
+ name: "fixedTrust"
18655
+ }, {
18656
+ id: TrustTypes.FIXED_UNIT_TRUST,
18657
+ name: "fixedUnitTrust"
18658
+ }, {
18659
+ id: TrustTypes.HYBRID_TRUST,
18660
+ name: "hybridTrust"
18661
+ }, {
18662
+ id: TrustTypes.LISTED_PUBLIC_UNIT_TRUST,
18663
+ name: "listedPublicUnitTrust"
18664
+ }, {
18665
+ id: TrustTypes.OTHER_TRUST,
18666
+ name: "otherTrust"
18667
+ }, {
18668
+ id: TrustTypes.POOLED_SUPERANNUATION_TRUST,
18669
+ name: "pooledSuperannuationTrust"
18670
+ }, {
18671
+ id: TrustTypes.PUBLIC_TRADING_TRUST,
18672
+ name: "publicTradingTrust"
18673
+ }, {
18674
+ id: TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST,
18675
+ name: "unlistedPublicUnitTrust"
18676
+ }];
18677
+ const nzSpecificTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARITABLE_TRUST, TrustTypes.BUSINESS_TRUST, TrustTypes.OTHER_TRUST];
18678
+ const auSpecificTrustTypes = [TrustTypes.CASH_MANAGEMENT_TRUST, TrustTypes.CORPORATE_UNIT_TRUST, TrustTypes.DECEASED_ESTATE, TrustTypes.DISCRETIONARY_INVESTMENT_TRUST, TrustTypes.DISCRETIONARY_SERVICES_MANAGEMENT_TRUST, TrustTypes.DISCRETIONARY_TRADING_TRUST, TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST, TrustTypes.FIXED_TRUST, TrustTypes.FIXED_UNIT_TRUST, TrustTypes.HYBRID_TRUST, TrustTypes.LISTED_PUBLIC_UNIT_TRUST, TrustTypes.OTHER_TRUST, TrustTypes.POOLED_SUPERANNUATION_TRUST, TrustTypes.PUBLIC_TRADING_TRUST, TrustTypes.UNLISTED_PUBLIC_UNIT_TRUST];
18679
+ const countryToTrustTypes = {
18680
+ [CountryCodes.Australia]: auSpecificTrustTypes,
18681
+ [CountryCodes.NewZealand]: nzSpecificTrustTypes
18682
+ };
18683
+ const DEFAULT_DECISION_MAKER_REQUIREMENTS = [{
18684
+ roleTypes: [DecisionMakerType.OWNER, DecisionMakerType.CONTROLLING_PERSON],
18685
+ min: 1,
18686
+ max: Infinity
18687
+ }, {
18688
+ roleTypes: [DecisionMakerType.OWNER],
18689
+ min: 0,
18690
+ max: 4
18691
+ }, {
18692
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18693
+ min: 0,
18694
+ max: Infinity
18695
+ }, {
18696
+ roleTypes: [DecisionMakerType.SIGNATORY],
18697
+ min: 1,
18698
+ max: Infinity
18699
+ }];
18700
+ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
18701
+ US: [{
18702
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18703
+ min: 1,
18704
+ max: Infinity
18705
+ }, {
18706
+ roleTypes: [DecisionMakerType.OWNER],
18707
+ min: 0,
18708
+ max: 4
18709
+ }, {
18710
+ roleTypes: [DecisionMakerType.SIGNATORY],
18711
+ min: 1,
18712
+ max: Infinity
18713
+ }],
18714
+ BR: [{
18715
+ roleTypes: [DecisionMakerType.CONTROLLING_PERSON],
18716
+ min: 1,
18717
+ max: Infinity
18718
+ }, {
18719
+ roleTypes: [DecisionMakerType.OWNER],
18720
+ min: 0,
18721
+ max: 4
18722
+ }, {
18723
+ roleTypes: [DecisionMakerType.SIGNATORY],
18724
+ min: 1,
18725
+ max: Infinity
18726
+ }],
18727
+ AU: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18728
+ roleTypes: [DecisionMakerType.DIRECTOR],
18729
+ min: 3,
18730
+ max: Infinity
18731
+ }],
18732
+ CA: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18733
+ roleTypes: [DecisionMakerType.DIRECTOR],
18734
+ min: 1,
18735
+ max: Infinity
18736
+ }],
18737
+ HK: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18738
+ roleTypes: [DecisionMakerType.DIRECTOR],
18739
+ min: 1,
18740
+ max: Infinity
18741
+ }],
18742
+ IN: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18743
+ roleTypes: [DecisionMakerType.DIRECTOR],
18744
+ min: 3,
18745
+ max: 15
18746
+ }],
18747
+ NZ: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18748
+ roleTypes: [DecisionMakerType.DIRECTOR],
18749
+ min: 1,
18750
+ max: Infinity
18751
+ }],
18752
+ SG: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
18753
+ roleTypes: [DecisionMakerType.DIRECTOR],
18754
+ min: 1,
18755
+ max: Infinity
18756
+ }]
18757
+ };
18758
+ const getDecisionMakerRequirements = (country2) => {
18759
+ if (!country2)
18760
+ return DEFAULT_DECISION_MAKER_REQUIREMENTS;
18761
+ return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
18762
+ };
18763
+ function getAvailableDecisionMakerRoleTypes(country2) {
18764
+ const requirements2 = getDecisionMakerRequirements(country2);
18765
+ return requirements2.filter((req) => req.roleTypes.length === 1).map((req) => ({
18766
+ roleType: req.roleTypes[0],
18767
+ min: req.min,
18768
+ max: req.max
18769
+ }));
18770
+ }
18771
+ const DEFAULT_DESCRIPTIONS_MAP = {
18772
+ [DecisionMakerType.OWNER]: "provideAllOwners",
18773
+ [DecisionMakerType.CONTROLLING_PERSON]: "ifNoOwnersSpecifyControllingPersons",
18774
+ [DecisionMakerType.DIRECTOR]: "provideAllDirectors",
18775
+ [DecisionMakerType.SIGNATORY]: "provideAtLeastOneSignatory"
18776
+ };
18777
+ const PER_COUNTRY_DESCRIPTION_OVERRIDES = {
18778
+ US: {
18779
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
18780
+ },
18781
+ BR: {
18782
+ [DecisionMakerType.CONTROLLING_PERSON]: "provideOneControllingPerson"
18783
+ }
18784
+ };
18785
+ const getDecisionMakerDescriptionMap = (country2) => ({
18786
+ ...DEFAULT_DESCRIPTIONS_MAP,
18787
+ ...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
18788
+ });
18789
+ const getOwnDecisionMakers = (rootLegalEntity) => {
18790
+ if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
18791
+ return [];
18792
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
18793
+ };
18794
+ const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
18795
+ const getOwnSignatories = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).filter((decisionMaker2) => decisionMaker2.type === DecisionMakerType.SIGNATORY);
18796
+ const getOwnDecisionMakersLegalEntityIds = (rootLegalEntity) => getOwnDecisionMakers(rootLegalEntity).map((ea) => ea.legalEntityId).filter((id2) => id2 !== void 0);
18797
+ const getDecisionMakerCount = (rootLegalEntity) => {
18798
+ const decisionMakers2 = getOwnDecisionMakers(rootLegalEntity);
18799
+ return decisionMakers2.reduce((decisionMakerCount, decisionMaker2) => {
18800
+ decisionMakerCount[decisionMaker2.type] = (decisionMakerCount[decisionMaker2.type] ?? 0) + 1;
18801
+ return decisionMakerCount;
18802
+ }, {});
18803
+ };
18804
+ const getAllowedDecisionMakerRoles = (rootLegalEntity, taskType) => {
18805
+ var _a, _b;
18806
+ if (taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER) {
18807
+ return [DecisionMakerType.OWNER];
18808
+ }
18809
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
18810
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
18811
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
18812
+ const allowedRoles = decisionMakerCountRange.reduce((acc, requirements2) => {
18813
+ const {
18814
+ roleTypes,
18815
+ max
18816
+ } = requirements2;
18817
+ if (roleTypes.length === 1) {
18818
+ const role2 = roleTypes[0];
18819
+ const isBelowMaxRange = ((existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? 0) < max;
18820
+ if (isBelowMaxRange) {
18821
+ acc.push(role2);
18822
+ }
18823
+ }
18824
+ return acc;
18825
+ }, []);
18826
+ const uniqueAllowedRoles = [...new Set(allowedRoles)];
18827
+ return uniqueAllowedRoles;
18828
+ };
18829
+ const hasMinRequiredDecisionMakerCount = (rootLegalEntity) => {
18830
+ var _a, _b;
18831
+ const existingDecisionMakerCount = getDecisionMakerCount(rootLegalEntity);
18832
+ const registeredCountry = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
18833
+ const decisionMakerCountRange = getDecisionMakerRequirements(registeredCountry);
18834
+ return decisionMakerCountRange.every((requirements2) => {
18835
+ const {
18836
+ roleTypes,
18837
+ min
18838
+ } = requirements2;
18839
+ return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
18840
+ });
18841
+ };
18842
+ const TRUST_MEMBER_COUNT_RANGE = {
18843
+ [TrustMemberTypes.DEFINED_BENEFICIARY]: {
18844
+ min: 1
18845
+ },
18846
+ [TrustMemberTypes.SETTLOR]: {
18847
+ min: 1
18848
+ }
18849
+ };
18850
+ const isPartOfTrustFromLegalEntity = (legalEntity) => {
18851
+ var _a;
18852
+ return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
18853
+ };
18854
+ const getTrustLegalEntityId = (rootLegalEntity) => {
18855
+ var _a;
18856
+ if (!rootLegalEntity.entityAssociations)
18857
+ return void 0;
18858
+ return (_a = rootLegalEntity.entityAssociations.find((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)) == null ? void 0 : _a.legalEntityId;
18859
+ };
18860
+ const getOwnTrustMembers = (rootLegalEntity) => {
18861
+ const trustLegalEntityId = getTrustLegalEntityId(rootLegalEntity);
18862
+ if (!trustLegalEntityId || !rootLegalEntity.entityAssociations)
18863
+ return [];
18864
+ return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && trustLegalEntityId === entityAssociation.associatorId);
18865
+ };
18866
+ const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
18867
+ const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
18868
+ if (!trustLegalEntityId)
18869
+ return [];
18870
+ const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
18871
+ const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
18872
+ return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
18873
+ };
18874
+ const getTrustMemberCompanyDecisionMakerIds = (rootLegalEntity, trustMemberCompanyId) => {
18875
+ const decisionMakerAssociations = getDecisionMakers(rootLegalEntity, trustMemberCompanyId);
18876
+ return decisionMakerAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
18877
+ };
18878
+ const getOwnTrustLegalEntityId = (legalEntity) => {
18879
+ var _a, _b;
18880
+ return (_b = (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.find((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id)) == null ? void 0 : _b.legalEntityId;
18881
+ };
18882
+ const getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
18883
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
18884
+ return trustLegalEntityId ? [trustLegalEntityId] : [];
18885
+ };
18886
+ const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
18887
+ var _a;
18888
+ const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
18889
+ if (trustLegalEntityId) {
18890
+ return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
18891
+ }
18892
+ };
18893
+ const getTrustMemberCount = (rootLegalEntity) => {
18894
+ const trustMembers2 = getOwnTrustMembers(rootLegalEntity);
18895
+ return trustMembers2.reduce((trustMemberCount, trustMember) => {
18896
+ trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
18897
+ return trustMemberCount;
18898
+ }, {});
18899
+ };
18900
+ const hasMinRequiredTrustMemberCount = (rootLegalEntity) => {
18901
+ const existingTrustMemberCount = getTrustMemberCount(rootLegalEntity);
18902
+ const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
18903
+ return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
18904
+ };
18905
+ const getCountrySpecificTrustTypeOptions = (country2) => {
18906
+ const countrySpecificTrustTypes = countryToTrustTypes[country2];
18907
+ if (!countrySpecificTrustTypes) {
18908
+ return [];
18909
+ }
18910
+ return countrySpecificTrustTypes.map((countrySpecificTrustType) => {
18911
+ const countrySpecificTrustTypeOption = trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === countrySpecificTrustType);
18912
+ if (!countrySpecificTrustTypeOption) {
18913
+ throw new Error("getCountrySpecificTrustTypeOptions(): unknown trust type");
18914
+ }
18915
+ return countrySpecificTrustTypeOption;
18945
18916
  });
18946
- }
18947
- const Trust = "";
18917
+ };
18948
18918
  const ContextHelper$1 = "";
18949
18919
  const ContextHelper = ({
18950
18920
  content
@@ -19210,7 +19180,7 @@ function TrustComponent(props) {
19210
19180
  children: renderActiveForm(props.activeForm || trustForms.trustRegistrationDetails)
19211
19181
  });
19212
19182
  }
19213
- const remediationActionMappings = {
19183
+ const invalidInputRemediationActionMappings = {
19214
19184
  "1_100": [],
19215
19185
  "1_101": [],
19216
19186
  "1_102": [{
@@ -19347,6 +19317,7 @@ const remediationActionMappings = {
19347
19317
  }]
19348
19318
  };
19349
19319
  const dataMissingRemediationsToFieldsMap = {
19320
+ "1_501": [DocumentType.REGISTRATION_DOCUMENT],
19350
19321
  "2_158": ["vatNumber", "exemptedFromVat", "vatAbsenceReason"]
19351
19322
  };
19352
19323
  const DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING = {
@@ -19453,7 +19424,7 @@ function setInvalidInputError(parentVerificationError, entityProblems) {
19453
19424
  remediatingActions
19454
19425
  }) => {
19455
19426
  const mappedRemActions = remediatingActions == null ? void 0 : remediatingActions.reduce((acc2, remediatingAction) => {
19456
- const remMapping = remediationActionMappings[remediatingAction.code];
19427
+ const remMapping = invalidInputRemediationActionMappings[remediatingAction.code];
19457
19428
  if (remMapping) {
19458
19429
  const {
19459
19430
  entityType: entityType2
@@ -20362,7 +20333,7 @@ const nationality = {
20362
20333
  }
20363
20334
  };
20364
20335
  const fieldsPerScenario$1 = {
20365
- L0: drop(["address", "birthDate"]).from(identityBase),
20336
+ L0: drop("address", "birthDate").from(identityBase),
20366
20337
  L1: identityBase,
20367
20338
  L1_ID: {
20368
20339
  ...identityBase,
@@ -20525,6 +20496,12 @@ const countryConfig = {
20525
20496
  registrationNumber: {
20526
20497
  label: "NZBN"
20527
20498
  }
20499
+ },
20500
+ [CountryCodes.Croatia]: {
20501
+ ...countryConfig$4[CountryCodes.Croatia],
20502
+ registrationNumber: {
20503
+ label: "MBO"
20504
+ }
20528
20505
  }
20529
20506
  };
20530
20507
  function parseIndividualScenarios(scenario, country2) {
@@ -21256,7 +21233,7 @@ function CompanyDropinComponent({
21256
21233
  });
21257
21234
  onChange == null ? void 0 : onChange(currentState);
21258
21235
  }, [currentState]);
21259
- const isSkippingCompanyStructure = useEnableNewEntryFlow() && accountHolder2 === "incorporatedPartnership";
21236
+ const isSkippingCompanyStructure = useEnableNewEntryFlow() && accountHolder2 === "partnershipIncorporated";
21260
21237
  const forms = useMemo(() => {
21261
21238
  const requiredForms = getRequiredForms(companyForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
21262
21239
  const validityAddedForms = addValidityToForms(requiredForms, formValidity, problems);
@@ -21666,6 +21643,8 @@ const useExemptSettlor = ({
21666
21643
  setExemptSettlor(exemptSettlorLE);
21667
21644
  }, [handleGetLegalEntity]);
21668
21645
  useEffect(() => {
21646
+ if (!trust2)
21647
+ return;
21669
21648
  updateExemptSettlor(trust2).catch(logger$8.error);
21670
21649
  }, [trust2, updateExemptSettlor]);
21671
21650
  return exemptSettlor;
@@ -21706,7 +21685,7 @@ const base64ToBlob = (base64, mimeType = "application/octet-stream") => {
21706
21685
  });
21707
21686
  };
21708
21687
  const saveBlobAsFile = (fileData, filename) => {
21709
- if (typeof window.navigator.msSaveBlob !== "undefined") {
21688
+ if ("msSaveBlob" in window.navigator && typeof window.navigator.msSaveBlob === "function") {
21710
21689
  window.navigator.msSaveBlob(fileData, filename);
21711
21690
  } else {
21712
21691
  const blobUrl = window.URL.createObjectURL(fileData);
@@ -22157,6 +22136,53 @@ function Toast({
22157
22136
  })]
22158
22137
  });
22159
22138
  }
22139
+ const getBusinessType = (businessTypeItems, accountHolder2, legalEntityType, companyTypesValue) => {
22140
+ const legalArrangementSuboptions = ["partnershipIncorporated"];
22141
+ const findBusinessType = (id2) => businessTypes.find((bt) => bt.id === id2);
22142
+ if (legalArrangementSuboptions.includes(companyTypesValue ?? "")) {
22143
+ return findBusinessType("legalArrangement");
22144
+ }
22145
+ if (accountHolder2) {
22146
+ if (["aTrust", "partnershipUnincorporated", "anAssociation"].includes(accountHolder2)) {
22147
+ return findBusinessType("legalArrangement");
22148
+ }
22149
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22150
+ }
22151
+ switch (legalEntityType) {
22152
+ case LegalEntityType.ORGANIZATION:
22153
+ return findBusinessType("company");
22154
+ case LegalEntityType.INDIVIDUAL:
22155
+ return findBusinessType("individual");
22156
+ }
22157
+ };
22158
+ const mapLegalArrangementOptionToCompanyTypesValue = (legalArrangement) => {
22159
+ switch (legalArrangement) {
22160
+ case "partnershipIncorporated":
22161
+ return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
22162
+ default:
22163
+ return "";
22164
+ }
22165
+ };
22166
+ const mapCompanyTypesValueToLegalArrangementOption = (companyTypesValue) => {
22167
+ switch (companyTypesValue) {
22168
+ case CompanyTypesValue.INCORPORATED_PARTNERSHIP:
22169
+ return "partnershipIncorporated";
22170
+ default:
22171
+ return void 0;
22172
+ }
22173
+ };
22174
+ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22175
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22176
+ return LegalEntityType.ORGANIZATION;
22177
+ }
22178
+ if (businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22179
+ return LegalEntityType.INDIVIDUAL;
22180
+ }
22181
+ if (legalArrangement === "partnershipIncorporated") {
22182
+ return LegalEntityType.ORGANIZATION;
22183
+ }
22184
+ return currentLegalEntityType;
22185
+ };
22160
22186
  const businessTypes = [{
22161
22187
  id: "individual",
22162
22188
  accountHolder: "myName",
@@ -22183,18 +22209,18 @@ const legalArrangementItems = [{
22183
22209
  name: "trust",
22184
22210
  description: "youAreTrusteeManagingTheTrustForBeneficiaries"
22185
22211
  }, {
22186
- id: "incorporatedPartnership",
22187
- accountHolder: "incorporatedPartnership",
22212
+ id: "partnershipIncorporated",
22213
+ accountHolder: "theCompanyIWorkFor",
22188
22214
  name: "incorporatedPartnership",
22189
- description: "incorporatedPartnershipNewEntryFlowDescription"
22215
+ description: "partnershipIncorporatedNewEntryFlowDescription"
22190
22216
  }, {
22191
- id: "unincorporatedPartnership",
22192
- accountHolder: "unincorporatedPartnership",
22217
+ id: "partnershipUnincorporated",
22218
+ accountHolder: "theCompanyIWorkFor",
22193
22219
  name: "unincorporatedPartnership",
22194
- description: "unincorporatedPartnershipNewEntryFlowDescription"
22220
+ description: "partnershipUnincorporatedNewEntryFlowDescription"
22195
22221
  }, {
22196
- id: "anAssociation",
22197
- accountHolder: "anAssociation",
22222
+ id: "associationIncorporated",
22223
+ accountHolder: "associationIncorporated",
22198
22224
  name: "associationIncorporatedTitle",
22199
22225
  description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
22200
22226
  }];
@@ -22256,20 +22282,6 @@ const businessTypeSelectionStepTitles = {
22256
22282
  /* CONFIRM_BUSINESS_SETUP_CHANGE */
22257
22283
  ]: "changeYourBusinessSetup"
22258
22284
  };
22259
- const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22260
- const isIndividual = currentLegalEntityType === LegalEntityType.INDIVIDUAL;
22261
- const isOrganization = currentLegalEntityType === LegalEntityType.ORGANIZATION;
22262
- if (isIndividual && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22263
- return LegalEntityType.ORGANIZATION;
22264
- }
22265
- if (isOrganization && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22266
- return LegalEntityType.INDIVIDUAL;
22267
- }
22268
- if (legalArrangement === "incorporatedPartnership") {
22269
- return LegalEntityType.ORGANIZATION;
22270
- }
22271
- return currentLegalEntityType;
22272
- };
22273
22285
  const BusinessTypeSelection = ({
22274
22286
  legalEntityResponse,
22275
22287
  accountHolder: accountHolder2,
@@ -22278,7 +22290,7 @@ const BusinessTypeSelection = ({
22278
22290
  onAccountHolderSelect,
22279
22291
  handleUpdateLegalEntity
22280
22292
  }) => {
22281
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
22293
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
22282
22294
  const {
22283
22295
  i18n
22284
22296
  } = useI18nContext();
@@ -22297,21 +22309,11 @@ const BusinessTypeSelection = ({
22297
22309
  /* WE_CANNOT_SET_UP_ACCOUNT */
22298
22310
  ].includes(currentStep);
22299
22311
  const businessTypeItems = getBusinessTypes(showTrustOption, showSolePropOption);
22300
- const getDefaultBusinessType = () => {
22301
- if (accountHolder2) {
22302
- if (["aTrust", "incorporatedPartnership", "unincorporatedPartnership", "anAssociation"].includes(accountHolder2)) {
22303
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "legalArrangement");
22304
- }
22305
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22306
- }
22307
- switch (legalEntityResponse.type) {
22308
- case LegalEntityType.ORGANIZATION:
22309
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "company");
22310
- case LegalEntityType.INDIVIDUAL:
22311
- return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "individual");
22312
- }
22313
- };
22314
- const getDefaultLegalArrangementType = () => accountHolder2 && legalArrangementItems.find((item) => item.accountHolder === accountHolder2);
22312
+ const currentLegalEntityType = legalEntityResponse == null ? void 0 : legalEntityResponse.type;
22313
+ const currentCompanyTypesValue = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
22314
+ const defaultBusinessType = getBusinessType(businessTypeItems, accountHolder2, legalEntityResponse == null ? void 0 : legalEntityResponse.type, (_b = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _b.type);
22315
+ const getDefaultLegalArrangementType = () => legalArrangementItems.find((item) => item.id === mapCompanyTypesValueToLegalArrangementOption(currentCompanyTypesValue));
22316
+ const defaultLegalArrangementType = getDefaultLegalArrangementType();
22315
22317
  const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
22316
22318
  const {
22317
22319
  handleChangeFor,
@@ -22323,20 +22325,23 @@ const BusinessTypeSelection = ({
22323
22325
  } = useForm({
22324
22326
  schema: formSchema,
22325
22327
  defaultData: {
22326
- businessType: getDefaultBusinessType(),
22327
- legalArrangement: getDefaultLegalArrangementType(),
22328
+ businessType: defaultBusinessType,
22329
+ legalArrangement: defaultLegalArrangementType,
22328
22330
  trusteeType: defaultTrusteeType
22329
22331
  },
22330
22332
  rules: businessTypeSelectionValidationRules
22331
22333
  });
22332
- const newAccountHolder = ((_a = data.businessType) == null ? void 0 : _a.accountHolder) || ((_b = data.legalArrangement) == null ? void 0 : _b.accountHolder);
22333
- const targetLegalEntityType = getTargetLegalEntityType((_c = data.businessType) == null ? void 0 : _c.id, (_d = data.legalArrangement) == null ? void 0 : _d.id, (_e = data.trusteeType) == null ? void 0 : _e.id, legalEntityResponse == null ? void 0 : legalEntityResponse.type);
22334
+ const newAccountHolder = ((_c = data.businessType) == null ? void 0 : _c.accountHolder) || ((_d = data.legalArrangement) == null ? void 0 : _d.accountHolder);
22335
+ const targetLegalArrangement = (_e = data.legalArrangement) == null ? void 0 : _e.id;
22336
+ const targetLegalEntityType = getTargetLegalEntityType((_f = data.businessType) == null ? void 0 : _f.id, (_g = data.legalArrangement) == null ? void 0 : _g.id, (_h = data.trusteeType) == null ? void 0 : _h.id, legalEntityResponse == null ? void 0 : legalEntityResponse.type);
22337
+ const isLegalEntityTypeChanging = currentLegalEntityType !== targetLegalEntityType;
22338
+ const isLegalArrangementChanging = currentCompanyTypesValue !== targetLegalArrangement;
22334
22339
  useEffect(() => {
22335
22340
  var _a2, _b2;
22336
22341
  setFormSchema(getFormSchema(((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement" && !!data.legalArrangement || currentStep === 1, ((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aTrust"));
22337
22342
  }, [data.businessType, data.legalArrangement, currentStep]);
22338
22343
  const handleNextClick = async () => {
22339
- var _a2, _b2;
22344
+ var _a2;
22340
22345
  if (loadingStatus === "loading")
22341
22346
  return;
22342
22347
  triggerValidation();
@@ -22349,8 +22354,7 @@ const BusinessTypeSelection = ({
22349
22354
  );
22350
22355
  return;
22351
22356
  }
22352
- const legalArrangementId = (_b2 = data.legalArrangement) == null ? void 0 : _b2.id;
22353
- if (legalArrangementId === "anAssociation" || legalArrangementId === "unincorporatedPartnership") {
22357
+ if (targetLegalArrangement === "associationIncorporated" || targetLegalArrangement === "partnershipUnincorporated") {
22354
22358
  setCurrentStep(
22355
22359
  2
22356
22360
  /* WE_CANNOT_SET_UP_ACCOUNT */
@@ -22358,49 +22362,46 @@ const BusinessTypeSelection = ({
22358
22362
  return;
22359
22363
  }
22360
22364
  }
22361
- }
22362
- if (newAccountHolder !== accountHolder2 || targetLegalEntityType !== legalEntityResponse.type) {
22363
- if (accountHolder2) {
22364
- setCurrentStep(
22365
- 3
22366
- /* CONFIRM_BUSINESS_SETUP_CHANGE */
22367
- );
22365
+ if (newAccountHolder !== accountHolder2 || isLegalEntityTypeChanging) {
22366
+ if (accountHolder2) {
22367
+ setCurrentStep(
22368
+ 3
22369
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22370
+ );
22371
+ return;
22372
+ }
22373
+ await updateLegalEntityAndSelectAccountHolder();
22368
22374
  } else {
22375
+ onAccountHolderSelect(newAccountHolder);
22376
+ }
22377
+ if (isLegalArrangementChanging) {
22369
22378
  await updateLegalEntityAndSelectAccountHolder();
22370
22379
  }
22371
- } else {
22372
- onAccountHolderSelect(newAccountHolder);
22373
22380
  }
22374
22381
  };
22375
22382
  const updateLegalEntityAndSelectAccountHolder = async () => {
22376
- var _a2;
22377
- const selectedLegalArrangement = (_a2 = data.legalArrangement) == null ? void 0 : _a2.id;
22378
22383
  try {
22379
- if (legalEntityResponse.type !== targetLegalEntityType) {
22384
+ if (isLegalEntityTypeChanging) {
22380
22385
  setLoadingStatus("loading");
22381
22386
  const updateLegalEntityPayload = {
22382
22387
  type: targetLegalEntityType
22383
22388
  };
22384
22389
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22385
- if (selectedLegalArrangement === "incorporatedPartnership") {
22386
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22387
- type: LegalEntityType.ORGANIZATION
22388
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22389
- await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22390
- organization: {
22391
- type: CompanyTypesValue.INCORPORATED_PARTNERSHIP
22392
- }
22393
- }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22394
- }
22395
- } else if (newAccountHolder !== accountHolder2) {
22396
- if (newAccountHolder === "theCompanyIWorkFor") {
22390
+ if (targetLegalEntityType === LegalEntityType.ORGANIZATION && targetLegalEntityType) {
22397
22391
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22398
22392
  organization: {
22399
- type: ""
22393
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22400
22394
  }
22401
22395
  }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22402
22396
  }
22403
22397
  }
22398
+ if (isLegalArrangementChanging) {
22399
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22400
+ organization: {
22401
+ type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
22402
+ }
22403
+ }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22404
+ }
22404
22405
  } catch (e) {
22405
22406
  showToast({
22406
22407
  label: i18n.get("failedToUpdateDetails"),
@@ -22432,15 +22433,19 @@ const BusinessTypeSelection = ({
22432
22433
  showSpinner: false,
22433
22434
  children: jsxs("div", {
22434
22435
  className: "adyen-kyc-business-type-selection",
22435
- children: [jsx("header", {
22436
- children: jsx(Heading, {
22436
+ children: [jsxs("header", {
22437
+ className: "adl-u-margin-bottom-32",
22438
+ children: [jsx(Heading, {
22437
22439
  level: 1,
22438
22440
  children: i18n.get(businessTypeSelectionStepTitles[currentStep])
22439
- })
22441
+ }), currentStep === 3 && jsx(Heading, {
22442
+ level: "sub",
22443
+ children: i18n.get("someInformationWillNotBeSaved")
22444
+ })]
22440
22445
  }), currentStep === 0 && jsx(Field, {
22441
22446
  name: "businessType",
22442
22447
  useLabelElement: false,
22443
- errorMessage: i18n.get((_f = errors.businessType) == null ? void 0 : _f.errorMessage),
22448
+ errorMessage: i18n.get((_i = errors.businessType) == null ? void 0 : _i.errorMessage),
22444
22449
  showErrorIconBottom: true,
22445
22450
  isValid: valid.businessType,
22446
22451
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22457,7 +22462,7 @@ const BusinessTypeSelection = ({
22457
22462
  children: [jsx(Field, {
22458
22463
  name: "legalArrangement",
22459
22464
  useLabelElement: false,
22460
- errorMessage: i18n.get((_g = errors.legalArrangement) == null ? void 0 : _g.errorMessage),
22465
+ errorMessage: i18n.get((_j = errors.legalArrangement) == null ? void 0 : _j.errorMessage),
22461
22466
  showErrorIconBottom: true,
22462
22467
  isValid: valid.legalArrangement,
22463
22468
  children: (childProps) => jsx(RadioGroupCard, {
@@ -22470,18 +22475,17 @@ const BusinessTypeSelection = ({
22470
22475
  }),
22471
22476
  onSelect: (item) => handleChangeFor("legalArrangement")(item)
22472
22477
  })
22473
- }), ((_h = data.legalArrangement) == null ? void 0 : _h.id) === "aTrust" && jsx(Field, {
22478
+ }), ((_k = data.legalArrangement) == null ? void 0 : _k.id) === "aTrust" && jsx(Field, {
22474
22479
  name: "trusteeType",
22475
22480
  label: i18n.get("whatTypeOfTrusteeAreYou"),
22476
22481
  className: "adl-u-margin-top-32",
22477
22482
  useLabelElement: false,
22478
- errorMessage: i18n.get((_i = errors.trusteeType) == null ? void 0 : _i.errorMessage),
22483
+ errorMessage: i18n.get((_l = errors.trusteeType) == null ? void 0 : _l.errorMessage),
22479
22484
  showErrorIconBottom: true,
22480
22485
  isValid: valid.trusteeType,
22481
22486
  children: (childProps) => jsx(RadioGroupCard, {
22482
- className: "adyen-kyc-trustee-type-radio-group-card",
22483
- itemLabelClassName: () => "adl-u-width-full",
22484
22487
  ...childProps,
22488
+ className: "adyen-kyc-trustee-type-radio-group-card",
22485
22489
  name: "trusteeType",
22486
22490
  items: trusteeTypeItems,
22487
22491
  selected: trusteeTypeItems.find((type) => {
@@ -22498,24 +22502,20 @@ const BusinessTypeSelection = ({
22498
22502
  className: "u-margin-top-32",
22499
22503
  children: i18n.get("needHelpYouCanAlwaysReachOutToCustomerSupport")
22500
22504
  })]
22501
- }), currentStep === 3 ? jsxs(Fragment, {
22502
- children: [jsx("p", {
22503
- children: i18n.get("someInformationWillNotBeSaved")
22504
- }), jsxs("div", {
22505
- className: "adyen-kyc-business-type-selection__confirm",
22506
- children: [jsx(Button, {
22507
- label: i18n.get("cancel"),
22508
- secondary: true,
22509
- onClick: () => setCurrentStep(
22510
- 0
22511
- /* BUSINESS_TYPE_SELECTION */
22512
- ),
22513
- type: "button"
22514
- }), jsx(Button, {
22515
- label: i18n.get("yesChange"),
22516
- onClick: () => updateLegalEntityAndSelectAccountHolder(),
22517
- type: "button"
22518
- })]
22505
+ }), currentStep === 3 ? jsxs("div", {
22506
+ className: "adyen-kyc-business-type-selection__confirm",
22507
+ children: [jsx(Button, {
22508
+ label: i18n.get("cancel"),
22509
+ secondary: true,
22510
+ onClick: () => setCurrentStep(
22511
+ 0
22512
+ /* BUSINESS_TYPE_SELECTION */
22513
+ ),
22514
+ type: "button"
22515
+ }), jsx(Button, {
22516
+ label: i18n.get("yesChange"),
22517
+ onClick: () => updateLegalEntityAndSelectAccountHolder(),
22518
+ type: "button"
22519
22519
  })]
22520
22520
  }) : jsxs("div", {
22521
22521
  className: "adyen-kyc-business-type-selection__nav",
@@ -22580,18 +22580,6 @@ const iconStatus = (current, min, max) => {
22580
22580
  }
22581
22581
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22582
22582
  };
22583
- const entityStatusRoles = {
22584
- ...decisionMakerRoles,
22585
- ...trustMemberGuidanceRoles
22586
- };
22587
- const getEntityStatusTagColor = (entityLabel) => {
22588
- var _a;
22589
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22590
- };
22591
- const getEntityStatusName = (entityLabel) => {
22592
- var _a;
22593
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22594
- };
22595
22583
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22596
22584
  const _cardGroup_component = "";
22597
22585
  function CardGroup({
@@ -23000,9 +22988,9 @@ const EntityAssociation = ({
23000
22988
  })]
23001
22989
  }), jsx("div", {
23002
22990
  children: types.map((type) => jsx(Tag, {
23003
- className: `adl-entity-association__tag ${getEntityAssociationTagColor(type)}`,
22991
+ className: `adl-entity-association__tag ${getRoleTagColor(type)}`,
23004
22992
  isBasic: true,
23005
- children: i18n.get(getEntityAssociationName(type))
22993
+ children: i18n.get(getRoleName(type))
23006
22994
  }, type))
23007
22995
  }), status === TaskStatus.ERROR && jsx(VerificationErrorAlert, {
23008
22996
  className: "adl-entity-association-alert",
@@ -23090,9 +23078,9 @@ const EntityGuidanceStatus = ({
23090
23078
  children: [jsx(EntityStatusIcon, {
23091
23079
  status
23092
23080
  }), jsx(Tag, {
23093
- className: `adl-entity-status__tag ${getEntityStatusTagColor(entityLabel)}`,
23081
+ className: `adl-entity-status__tag ${getRoleTagColor(entityLabel)}`,
23094
23082
  isBasic: true,
23095
- children: i18n.get(getEntityStatusName(entityLabel))
23083
+ children: i18n.get(getRoleName(entityLabel))
23096
23084
  }, entityLabel), jsx("span", {
23097
23085
  className: "adl-entity-status--text",
23098
23086
  "data-testid": `${entityLabel}-rule--description`,
@@ -23484,7 +23472,7 @@ function LegalEntityTypeSwitcher({
23484
23472
  const {
23485
23473
  i18n
23486
23474
  } = useI18nContext();
23487
- const [loadingStatus, setLoadingStatus] = useState(null);
23475
+ const [loadingStatus, setLoadingStatus] = useState();
23488
23476
  const {
23489
23477
  showToast
23490
23478
  } = useToastContext();
@@ -23535,7 +23523,7 @@ function LegalEntityTypeSwitcher({
23535
23523
  })]
23536
23524
  });
23537
23525
  default:
23538
- jsx("p", {
23526
+ return jsx("p", {
23539
23527
  children: "Change not supported"
23540
23528
  });
23541
23529
  }
@@ -23636,15 +23624,27 @@ const businessTypeMapping = {
23636
23624
  /* COMPANY_TRUSTEE */
23637
23625
  }
23638
23626
  };
23627
+ const companyTypesMapping = {
23628
+ [CompanyTypesValue.INCORPORATED_PARTNERSHIP]: "incorporatedPartnership",
23629
+ [CompanyTypesValue.PUBLIC_COMPANY]: "company",
23630
+ [CompanyTypesValue.PRIVATE_COMPANY]: "company",
23631
+ [CompanyTypesValue.UNLISTED_PUBLIC_COMPANY]: "company",
23632
+ [CompanyTypesValue.INCORPORATED_ASSOCIATION]: "company",
23633
+ [CompanyTypesValue.GOVERNMENTAL_ORGANIZATION]: "company",
23634
+ [CompanyTypesValue.NON_PROFIT_OR_CHARITABLE]: "company",
23635
+ [CompanyTypesValue.SOLE_PROPRIETORSHIP]: "soleProprietorship"
23636
+ /* SOLE_PROPRIETORSHIP */
23637
+ };
23639
23638
  const useBusinessSetup = (legalEntityResponse) => {
23640
- var _a;
23639
+ var _a, _b;
23641
23640
  const {
23642
23641
  accountHolder: accountHolder2
23643
23642
  } = useCoreContext();
23644
23643
  const accountHolderType = accountHolder2 || getDefaultAccountHolderType(legalEntityResponse);
23645
- const businessSetup = (_a = businessTypeMapping[accountHolderType]) == null ? void 0 : _a[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23644
+ const organizationType = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.type;
23645
+ const businessSetup = accountHolderType === "theCompanyIWorkFor" && organizationType ? companyTypesMapping[organizationType] : (_b = businessTypeMapping[accountHolderType]) == null ? void 0 : _b[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23646
23646
  return {
23647
- businessSetup: businessSetup || accountHolder2
23647
+ businessSetup
23648
23648
  };
23649
23649
  };
23650
23650
  const hasPayoutAccount = (legalEntityResponse) => {
@@ -24562,11 +24562,12 @@ function IndividualDropinComponent({
24562
24562
  };
24563
24563
  const attachAssociationToParentLegalEntity = async ({
24564
24564
  legalEntity,
24565
+ parentLE,
24565
24566
  dataSubmitted
24566
24567
  }) => {
24567
24568
  var _a2;
24568
24569
  const newRoles = taskType === TaskTypes.DECISION_MAKER || taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? (_a2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _a2.role : taskType === TaskTypes.TRUST_MEMBER_INDIVIDUAL ? trustMember == null ? void 0 : trustMember.roles : null;
24569
- const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
24570
+ const existingEntityAssociations = getOwnEntityAssociations(parentLE);
24570
24571
  if (newRoles && hasRolesChanged(legalEntity, existingEntityAssociations, newRoles)) {
24571
24572
  const updatedParentLegalEntity = {
24572
24573
  entityAssociations: [...newRoles.map((role2) => {
@@ -24578,7 +24579,7 @@ function IndividualDropinComponent({
24578
24579
  };
24579
24580
  }) || [], ...existingEntityAssociations.filter((ea) => ea.legalEntityId !== legalEntity.id) || []]
24580
24581
  };
24581
- await handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
24582
+ await handleUpdateLegalEntity(updatedParentLegalEntity, parentLE.id);
24582
24583
  }
24583
24584
  };
24584
24585
  const onSubmit = async () => {
@@ -24611,10 +24612,13 @@ function IndividualDropinComponent({
24611
24612
  legalEntity: createdLegalEntity,
24612
24613
  dataSubmitted
24613
24614
  });
24614
- await attachAssociationToParentLegalEntity({
24615
- legalEntity: createdLegalEntity,
24616
- dataSubmitted
24617
- });
24615
+ if (parentLegalEntity) {
24616
+ await attachAssociationToParentLegalEntity({
24617
+ legalEntity: createdLegalEntity,
24618
+ parentLE: parentLegalEntity,
24619
+ dataSubmitted
24620
+ });
24621
+ }
24618
24622
  if (taskType === TaskTypes.INDIVIDUAL) {
24619
24623
  setAccountHolder((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.accountHolder);
24620
24624
  }
@@ -25365,7 +25369,7 @@ function InternalReference({
25365
25369
  const label = displayText ? displayText.content : referencedLabel;
25366
25370
  const scrollIntoView = () => {
25367
25371
  const scrollParent = getScrollParent(document.getElementById(referencedLabel));
25368
- const element = scrollParent !== -1 && scrollParent.querySelector(`#${referencedLabel}`);
25372
+ const element = scrollParent == null ? void 0 : scrollParent.querySelector(`#${referencedLabel}`);
25369
25373
  element == null ? void 0 : element.scrollIntoView({
25370
25374
  behavior: "smooth"
25371
25375
  });
@@ -25496,78 +25500,82 @@ const Weblink = ({
25496
25500
  ...displayText
25497
25501
  }) : url
25498
25502
  });
25503
+ const components = {
25504
+ chapter: Chapter,
25505
+ section: Section,
25506
+ paragraph: Paragraph,
25507
+ text: Text,
25508
+ weblink: Weblink,
25509
+ list: ListElement,
25510
+ table: Table,
25511
+ internalReference: InternalReference,
25512
+ breakline: "br"
25513
+ };
25514
+ const getKey = (type) => `key-${type}-${getUniqueId()}`;
25515
+ const getProps = (element, isTopLevel) => {
25516
+ if (!("type" in element))
25517
+ return null;
25518
+ switch (element.type) {
25519
+ case ElementTypes.Chapter:
25520
+ return {
25521
+ title: element.title,
25522
+ contentElements: element.contentElements
25523
+ };
25524
+ case ElementTypes.Section:
25525
+ return {
25526
+ isTopLevel,
25527
+ title: element.title,
25528
+ label: element.label,
25529
+ contentElements: element.contentElements
25530
+ };
25531
+ case ElementTypes.Paragraph:
25532
+ return {
25533
+ isTopLevel,
25534
+ contentElements: element.contentElements
25535
+ };
25536
+ case ElementTypes.Text:
25537
+ return {
25538
+ content: element.content,
25539
+ styles: element.styles
25540
+ };
25541
+ case ElementTypes.Weblink:
25542
+ return {
25543
+ url: element.url,
25544
+ displayText: element.displayText
25545
+ };
25546
+ case ElementTypes.List:
25547
+ return {
25548
+ items: element.items,
25549
+ style: element.style
25550
+ };
25551
+ case ElementTypes.Table:
25552
+ return {
25553
+ rows: element.rows,
25554
+ label: element.label,
25555
+ captions: element.captions,
25556
+ titlePrefix: element.titlePrefix,
25557
+ title: element.title
25558
+ };
25559
+ case ElementTypes.InternalReference:
25560
+ return {
25561
+ referencedLabel: element.referencedLabel,
25562
+ displayText: element.displayText
25563
+ };
25564
+ default:
25565
+ return null;
25566
+ }
25567
+ };
25499
25568
  function ContentElements({
25500
25569
  contentElements,
25501
25570
  isTopLevel = false,
25502
25571
  onExpandSection
25503
25572
  }) {
25504
- const components = {
25505
- chapter: Chapter,
25506
- section: Section,
25507
- paragraph: Paragraph,
25508
- text: Text,
25509
- weblink: Weblink,
25510
- list: ListElement,
25511
- table: Table,
25512
- internalReference: InternalReference,
25513
- breakline: "br"
25514
- };
25515
- const getKey = (type) => `key-${type}-${getUniqueId()}`;
25516
- const getProps = (element) => {
25517
- switch (element.type) {
25518
- case ElementTypes.Chapter:
25519
- return {
25520
- title: element.title,
25521
- contentElements: element.contentElements
25522
- };
25523
- case ElementTypes.Section:
25524
- return {
25525
- isTopLevel,
25526
- title: element.title,
25527
- label: element.label,
25528
- contentElements: element.contentElements
25529
- };
25530
- case ElementTypes.Paragraph:
25531
- return {
25532
- isTopLevel,
25533
- contentElements: element.contentElements
25534
- };
25535
- case ElementTypes.Text:
25536
- return {
25537
- content: element.content,
25538
- styles: element.styles
25539
- };
25540
- case ElementTypes.Weblink:
25541
- return {
25542
- url: element.url,
25543
- displayText: element.displayText
25544
- };
25545
- case ElementTypes.List:
25546
- return {
25547
- items: element.items,
25548
- style: element.style
25549
- };
25550
- case ElementTypes.Table:
25551
- return {
25552
- rows: element.rows,
25553
- label: element.label,
25554
- captions: element.captions,
25555
- titlePrefix: element.titlePrefix,
25556
- title: element.title
25557
- };
25558
- case ElementTypes.InternalReference:
25559
- return {
25560
- referencedLabel: element.referencedLabel,
25561
- displayText: element.displayText
25562
- };
25563
- default:
25564
- return null;
25565
- }
25566
- };
25567
25573
  const elements = contentElements.map((contentElement) => {
25574
+ if (!("type" in contentElement))
25575
+ return null;
25568
25576
  const Component = components[contentElement.type];
25569
25577
  return jsx(Component, {
25570
- ...getProps(contentElement)
25578
+ ...getProps(contentElement, isTopLevel)
25571
25579
  }, getKey(contentElement.type));
25572
25580
  });
25573
25581
  return isTopLevel ? jsx(Accordion, {
@@ -25602,7 +25610,7 @@ function ContractViewer({
25602
25610
  const pciValidationRules = {
25603
25611
  signer: {
25604
25612
  modes: ["blur"],
25605
- validate: (signer2) => !!signer2,
25613
+ validate: (signer2) => !isEmpty(signer2),
25606
25614
  errorMessage: "fieldIsRequired"
25607
25615
  },
25608
25616
  acceptPci: {
@@ -25617,7 +25625,7 @@ function PciDropinComponent({
25617
25625
  pciTemplateResponse,
25618
25626
  handleHomeClick,
25619
25627
  handleSign,
25620
- taskType,
25628
+ taskType = TaskTypes.PCI_DSS,
25621
25629
  eventEmitter,
25622
25630
  trackingConfig
25623
25631
  }) {
@@ -25634,7 +25642,7 @@ function PciDropinComponent({
25634
25642
  legalEntity: legalEntityResponse,
25635
25643
  task: taskType
25636
25644
  });
25637
- const [loadingStatus, setLoadingStatus] = useState(null);
25645
+ const [loadingStatus, setLoadingStatus] = useState();
25638
25646
  const {
25639
25647
  handleChangeFor,
25640
25648
  triggerValidation,
@@ -25651,15 +25659,15 @@ function PciDropinComponent({
25651
25659
  } = pciTemplateResponse;
25652
25660
  const pciQuestionnaire = JSON.parse(decodeURIComponent(escape(window.atob(pciTemplateResponse.content))));
25653
25661
  const uniqueEntityAssociations = [...new Map(getOwnDecisionMakers(legalEntityResponse).map((entityAssociation) => [entityAssociation.legalEntityId, entityAssociation])).values()];
25654
- const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.map(({
25662
+ const signers = legalEntityResponse.type === LegalEntityType.ORGANIZATION ? uniqueEntityAssociations.filter((ea) => Boolean(ea.legalEntityId && ea.name)).map(({
25655
25663
  legalEntityId: id2,
25656
25664
  name
25657
25665
  }) => ({
25658
25666
  id: id2,
25659
25667
  name
25660
25668
  })) : [{
25661
- id: legalEntityResponse == null ? void 0 : legalEntityResponse.id,
25662
- name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
25669
+ id: legalEntityResponse.id,
25670
+ name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
25663
25671
  }];
25664
25672
  const handleSignClick = async () => {
25665
25673
  if (loadingStatus === "loading")
@@ -25777,7 +25785,7 @@ function PciDropinComponent({
25777
25785
  children: (childProps) => jsx(Checkbox, {
25778
25786
  ...childProps,
25779
25787
  label: acceptPciLabel,
25780
- checked: data.acceptPci,
25788
+ checked: data.acceptPci ?? false,
25781
25789
  name: "acceptPci",
25782
25790
  onChange: handleChangeFor("acceptPci")
25783
25791
  })
@@ -26121,7 +26129,7 @@ const TrustRoleAndEntityType = (props) => {
26121
26129
  selected: data.role ?? [],
26122
26130
  onSelect: changeRoles,
26123
26131
  mapToSelectItem: (role2) => ({
26124
- ...makeSelectItemForTrustRole(role2, i18n),
26132
+ ...makeSelectItemForRole(role2, i18n),
26125
26133
  disabled: !availableRoles.includes(role2)
26126
26134
  })
26127
26135
  })
@@ -26200,7 +26208,7 @@ const TrustRoleAndEntityType = (props) => {
26200
26208
  labels: formUtils.getFieldLabels(COUNTRY_FIELD),
26201
26209
  readonly: false,
26202
26210
  classNameModifiers: COUNTRY_FIELD,
26203
- allowedCountries: [],
26211
+ allowedCountries: void 0,
26204
26212
  handleChangeFor
26205
26213
  }), jsx(LegalCompanyNameField, {
26206
26214
  data: formUtils.getFieldData(data, LEGAL_COMPANY_NAME_FIELD),
@@ -26349,7 +26357,7 @@ function RoleAndTypeDropinComponent({
26349
26357
  });
26350
26358
  const [activeForm, setActiveForm] = useState(regularForms.roleAndEntityType);
26351
26359
  const isSummaryStep = activeForm.formId === summaryStep.formId;
26352
- const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getTrustMemberName(role2))).join(", ");
26360
+ const formatRolesForSummary = (roles) => roles.map((role2) => i18n.get(getRoleName(role2))).join(", ");
26353
26361
  const formatSettlorExemptionReasonsForSummary = (reasons) => reasons.map((reason) => i18n.get(reason)).join(", ");
26354
26362
  const summaryData = trustMember === "incomplete" ? {} : {
26355
26363
  roleAndEntityType: {
@@ -26523,7 +26531,8 @@ const serviceAgreementTypesTranslationMapping = {
26523
26531
  adyenCapital: "capitalUserTerms",
26524
26532
  adyenAccount: "businessAccountTerms",
26525
26533
  adyenCard: "cardUserTerms",
26526
- adyenFranchisee: "franchiseesTAndCs"
26534
+ adyenFranchisee: "franchiseesTAndCs",
26535
+ adyenPccr: "pccr"
26527
26536
  };
26528
26537
  function ServiceAgreementDropinComponent({
26529
26538
  legalEntityResponse,
@@ -26751,7 +26760,7 @@ function ServiceAgreementDropinComponent({
26751
26760
  });
26752
26761
  }
26753
26762
  function removeObjectPropsWithEmptyValues(obj) {
26754
- Object.keys(obj).forEach((key) => {
26763
+ keysOf(obj).forEach((key) => {
26755
26764
  if (obj[key] === null || isEmpty(obj[key]))
26756
26765
  delete obj[key];
26757
26766
  });
@@ -27902,7 +27911,7 @@ function DropinComposerComponent({
27902
27911
  return TaskTypes.TASKS_OVERVIEW;
27903
27912
  }, [showBusinessTypeSelection, showIntroduction]);
27904
27913
  const [taskHistory, setTaskHistory] = useState([initialTask]);
27905
- const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
27914
+ const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
27906
27915
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
27907
27916
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
27908
27917
  const [legalEntityType, setLegalEntityType] = useState(null);
@@ -27920,9 +27929,9 @@ function DropinComposerComponent({
27920
27929
  const [transferInstrument, setTransferInstrument] = useState(null);
27921
27930
  const [capabilityProblems, setCapabilityProblems] = useState(getCapabilityProblems(legalEntityResponse));
27922
27931
  const [bankVerificationVendors, setBankVerificationVendors] = useState();
27923
- const rootLegalEntityCountry = legalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = legalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = legalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
27932
+ const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? (_a = rootLegalEntity.individual.residentialAddress) == null ? void 0 : _a.country : (_b = rootLegalEntity.organization.registeredAddress) == null ? void 0 : _b.country;
27924
27933
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
27925
- const reviewRequired = (legalEntity == null ? void 0 : legalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[legalEntity.id]) == null ? void 0 : _d.isReviewRequired);
27934
+ const reviewRequired = (rootLegalEntity == null ? void 0 : rootLegalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[rootLegalEntity.id]) == null ? void 0 : _d.isReviewRequired);
27926
27935
  const additionalSalesChannels = useSalesChannelsSettings();
27927
27936
  const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
27928
27937
  const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
@@ -27935,12 +27944,12 @@ function DropinComposerComponent({
27935
27944
  };
27936
27945
  const getPciStatus = async () => {
27937
27946
  var _a2, _b2;
27938
- if (legalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
27947
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetPciStatus)) {
27939
27948
  try {
27940
- const response = await args.handleGetPciStatus(legalEntity.id, {
27949
+ const response = await args.handleGetPciStatus(rootLegalEntity.id, {
27941
27950
  additionalSalesChannels
27942
27951
  });
27943
- response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
27952
+ response.hasDocuments = ((_b2 = (_a2 = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id))) == null ? void 0 : _a2.data) == null ? void 0 : _b2.length) > 0;
27944
27953
  setPciStatus(response);
27945
27954
  return response;
27946
27955
  } catch (e) {
@@ -27951,7 +27960,7 @@ function DropinComposerComponent({
27951
27960
  };
27952
27961
  const getPciTemplate = useCallback(async () => {
27953
27962
  const requestPciTemplate = async (language) => {
27954
- const response = await args.handleGetPciTemplate(legalEntity.id, {
27963
+ const response = await args.handleGetPciTemplate(rootLegalEntity.id, {
27955
27964
  language,
27956
27965
  additionalSalesChannels
27957
27966
  });
@@ -27969,16 +27978,16 @@ function DropinComposerComponent({
27969
27978
  await requestPciTemplate(fallbackLanguageCode);
27970
27979
  }
27971
27980
  }
27972
- }, [additionalSalesChannels, i18n, legalEntity.id, args.handleGetPciTemplate]);
27981
+ }, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
27973
27982
  useEffect(() => {
27974
27983
  if (!tasks.includes(TaskTypes.PCI_DSS))
27975
27984
  return;
27976
27985
  getPciTemplate().catch(logger$6.error);
27977
27986
  }, [getPciTemplate, tasks]);
27978
27987
  const getServiceAgreementAcceptanceInfos = async () => {
27979
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
27988
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
27980
27989
  try {
27981
- const response = await args.handleGetServiceAgreementAcceptanceInfos(legalEntity.id);
27990
+ const response = await args.handleGetServiceAgreementAcceptanceInfos(rootLegalEntity.id);
27982
27991
  setServiceAgreementAcceptanceInfos(response.data);
27983
27992
  } catch (e) {
27984
27993
  logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -27986,9 +27995,9 @@ function DropinComposerComponent({
27986
27995
  }
27987
27996
  };
27988
27997
  const getServiceAgreementStatus = async () => {
27989
- if (legalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
27998
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementStatus)) {
27990
27999
  try {
27991
- const response = await args.handleGetServiceAgreementStatus(legalEntity.id);
28000
+ const response = await args.handleGetServiceAgreementStatus(rootLegalEntity.id);
27992
28001
  setServiceAgreementTypes(response.termsOfServiceTypes);
27993
28002
  } catch (e) {
27994
28003
  logger$6.warn(i18n.get("failedToGetServiceAgreementStatus"));
@@ -27996,7 +28005,7 @@ function DropinComposerComponent({
27996
28005
  }
27997
28006
  };
27998
28007
  const getSolePropietor = async () => {
27999
- const id2 = getOwnSoleProprietorshipIdArray(legalEntity)[0];
28008
+ const id2 = getOwnSoleProprietorshipIdArray(rootLegalEntity)[0];
28000
28009
  if (id2) {
28001
28010
  try {
28002
28011
  const response = await (args == null ? void 0 : args.handleGetLegalEntity(id2));
@@ -28023,10 +28032,10 @@ function DropinComposerComponent({
28023
28032
  }
28024
28033
  };
28025
28034
  const refreshLegalEntity = async () => {
28026
- if (legalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28035
+ if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
28027
28036
  try {
28028
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(legalEntity.id));
28029
- setLegalEntity(response);
28037
+ const response = await (args == null ? void 0 : args.handleGetLegalEntity(rootLegalEntity.id));
28038
+ setRootLegalEntity(response);
28030
28039
  setCapabilityProblems(getCapabilityProblems(response));
28031
28040
  return response;
28032
28041
  } catch (e) {
@@ -28182,11 +28191,11 @@ function DropinComposerComponent({
28182
28191
  onNavigate(task);
28183
28192
  };
28184
28193
  const onNavigateToDecisionMakerIndividual = async (task, id2, parentId) => {
28185
- if (parentId && parentId !== legalEntity.id) {
28194
+ if (parentId && parentId !== rootLegalEntity.id) {
28186
28195
  const parentLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(parentId));
28187
28196
  setAssociatedLegalEntityParent(parentLegalEntity);
28188
28197
  } else {
28189
- setAssociatedLegalEntityParent(legalEntity);
28198
+ setAssociatedLegalEntityParent(rootLegalEntity);
28190
28199
  }
28191
28200
  if (id2 && (args == null ? void 0 : args.handleGetLegalEntity)) {
28192
28201
  try {
@@ -28208,7 +28217,7 @@ function DropinComposerComponent({
28208
28217
  if (id2) {
28209
28218
  try {
28210
28219
  await getTransferInstrument2(id2);
28211
- if (hasSolePropInLegalEntity(legalEntity) && !solePropietor) {
28220
+ if (hasSolePropInLegalEntity(rootLegalEntity) && !solePropietor) {
28212
28221
  await getSolePropietor();
28213
28222
  }
28214
28223
  } finally {
@@ -28239,7 +28248,7 @@ function DropinComposerComponent({
28239
28248
  };
28240
28249
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
28241
28250
  var _a2, _b2;
28242
- const trustId = (_b2 = (_a2 = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a2.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
28251
+ const trustId = (_b2 = (_a2 = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a2.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
28243
28252
  if (trustId) {
28244
28253
  try {
28245
28254
  const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
@@ -28347,13 +28356,13 @@ function DropinComposerComponent({
28347
28356
  trackingConfig: {
28348
28357
  topLevelLegalEntity: legalEntityResponse
28349
28358
  },
28350
- legalEntity,
28359
+ legalEntity: rootLegalEntity,
28351
28360
  task: TaskTypes.PCI_DSS
28352
28361
  });
28353
28362
  try {
28354
- const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(legalEntity.id));
28363
+ const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
28355
28364
  await Promise.all(response.data.map(async (pciQuestionnaireInfo) => {
28356
- const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(legalEntity.id, pciQuestionnaireInfo.id));
28365
+ const pciQuestionnaire = await (args == null ? void 0 : args.handleDownloadPci(rootLegalEntity.id, pciQuestionnaireInfo.id));
28357
28366
  await downloadFile(pciQuestionnaire.content, `${pciQuestionnaire.id}.pdf`);
28358
28367
  }));
28359
28368
  } catch (e) {
@@ -28378,7 +28387,7 @@ function DropinComposerComponent({
28378
28387
  const data = await getConfiguration2({
28379
28388
  country: contextCountry,
28380
28389
  capabilities,
28381
- legalEntityType: legalEntity.type
28390
+ legalEntityType: rootLegalEntity.type
28382
28391
  });
28383
28392
  if (data == null ? void 0 : data.bankVerificationProviders) {
28384
28393
  setBankVerificationVendors(data.bankVerificationProviders);
@@ -28397,21 +28406,21 @@ function DropinComposerComponent({
28397
28406
  setIsLoadingConfiguration(false);
28398
28407
  onLoad();
28399
28408
  });
28400
- }, [legalEntity.type, contextCountry]);
28409
+ }, [rootLegalEntity.type, contextCountry]);
28401
28410
  useEffect(() => {
28402
- if (hasRejectedCapabilities(legalEntity)) {
28411
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28403
28412
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28404
28413
  }
28405
- }, [legalEntity]);
28414
+ }, [rootLegalEntity]);
28406
28415
  useEffect(() => {
28407
28416
  if (PAGES_WITH_STATUS.includes(taskHistory[taskHistory.length - 1])) {
28408
28417
  if (!pollingId) {
28409
28418
  const pollingInterval = setInterval(async () => {
28410
- if (hasRejectedCapabilities(legalEntity)) {
28419
+ if (hasRejectedCapabilities(rootLegalEntity)) {
28411
28420
  setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
28412
28421
  clearInterval(pollingId);
28413
28422
  setPollingId(null);
28414
- } else if (hasResolvedCapabilities(legalEntity)) {
28423
+ } else if (hasResolvedCapabilities(rootLegalEntity)) {
28415
28424
  clearInterval(pollingId);
28416
28425
  setPollingId(null);
28417
28426
  } else {
@@ -28436,7 +28445,7 @@ function DropinComposerComponent({
28436
28445
  case TaskTypes.BUSINESS_TYPE_SELECTION:
28437
28446
  return jsx(BusinessTypeSelection, {
28438
28447
  ...args,
28439
- legalEntityResponse: legalEntity,
28448
+ legalEntityResponse: rootLegalEntity,
28440
28449
  accountHolder: accountHolder2,
28441
28450
  showTrustOption: isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(rootLegalEntityCountry),
28442
28451
  showSolePropOption: SOLE_PROP_COUNTRIES.includes(rootLegalEntityCountry),
@@ -28448,7 +28457,7 @@ function DropinComposerComponent({
28448
28457
  });
28449
28458
  case TaskTypes.INTRODUCTION:
28450
28459
  return jsx(Introduction, {
28451
- legalEntity,
28460
+ legalEntity: rootLegalEntity,
28452
28461
  onExitIntroduction: () => {
28453
28462
  setHasSeenIntroduction(true);
28454
28463
  onNavigateTo(TaskTypes.TASKS_OVERVIEW);
@@ -28461,7 +28470,7 @@ function DropinComposerComponent({
28461
28470
  return jsx(TaskListComponent, {
28462
28471
  onNavigateToTask: navigateTo,
28463
28472
  tasks,
28464
- legalEntityResponse: legalEntity,
28473
+ legalEntityResponse: rootLegalEntity,
28465
28474
  capabilityProblems,
28466
28475
  onPciDownload,
28467
28476
  pciStatus,
@@ -28477,7 +28486,7 @@ function DropinComposerComponent({
28477
28486
  topLevelLegalEntity: legalEntityResponse
28478
28487
  },
28479
28488
  parentLegalEntity: associatedLegalEntityParent,
28480
- legalEntityResponse: legalEntity,
28489
+ legalEntityResponse: rootLegalEntity,
28481
28490
  onNavigateToIndividual: (legalEntityId) => onNavigateToDecisionMakerIndividual(TaskTypes.DECISION_MAKER, legalEntityId),
28482
28491
  handleUpdateLegalEntity: args == null ? void 0 : args.handleUpdateLegalEntity,
28483
28492
  navigateBackToTaskList: navigateBack,
@@ -28493,8 +28502,8 @@ function DropinComposerComponent({
28493
28502
  taskType: TaskTypes.INDIVIDUAL,
28494
28503
  taskName: hasTrust ? "individualTrusteeDetails" : "individualDetails",
28495
28504
  parentLegalEntity: null,
28496
- legalEntityResponse: legalEntity,
28497
- problems: getLegalEntityProblems(legalEntity),
28505
+ legalEntityResponse: rootLegalEntity,
28506
+ problems: getLegalEntityProblems(rootLegalEntity),
28498
28507
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28499
28508
  onChange: componentOnChange,
28500
28509
  eventEmitter,
@@ -28514,7 +28523,7 @@ function DropinComposerComponent({
28514
28523
  });
28515
28524
  case TaskTypes.REVIEW:
28516
28525
  return jsx(ReviewComponent, {
28517
- legalEntityId: legalEntity.id,
28526
+ legalEntityId: rootLegalEntity.id,
28518
28527
  handleReviewConfirm: args.handleReviewConfirm,
28519
28528
  handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW)
28520
28529
  });
@@ -28591,9 +28600,9 @@ function DropinComposerComponent({
28591
28600
  },
28592
28601
  taskType: TaskTypes.COMPANY,
28593
28602
  taskName: hasTrust ? "companyTrusteeDetails" : "companyDetails",
28594
- legalEntityResponse: legalEntity,
28603
+ legalEntityResponse: rootLegalEntity,
28595
28604
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28596
- problems: getLegalEntityProblems(legalEntity),
28605
+ problems: getLegalEntityProblems(rootLegalEntity),
28597
28606
  onChange: componentOnChange,
28598
28607
  eventEmitter,
28599
28608
  onSubmit: async (data) => {
@@ -28619,7 +28628,7 @@ function DropinComposerComponent({
28619
28628
  parentLegalEntity: trust2,
28620
28629
  legalEntityResponse: associatedLegalEntity,
28621
28630
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28622
- problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[legalEntity.id],
28631
+ problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[rootLegalEntity.id],
28623
28632
  onChange: componentOnChange,
28624
28633
  eventEmitter,
28625
28634
  onSubmit: (data) => refreshTrustAndRunOnSubmit(data, 2),
@@ -28642,9 +28651,9 @@ function DropinComposerComponent({
28642
28651
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _f[transferInstrument == null ? void 0 : transferInstrument.id],
28643
28652
  transferInstrument,
28644
28653
  setTransferInstrument,
28645
- legalEntityResponse: legalEntity,
28654
+ legalEntityResponse: rootLegalEntity,
28646
28655
  refreshLegalEntity,
28647
- accountHolder: getPayoutAccountHolderName(legalEntity, i18n),
28656
+ accountHolder: getPayoutAccountHolderName(rootLegalEntity, i18n),
28648
28657
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28649
28658
  onChange: componentOnChange,
28650
28659
  eventEmitter,
@@ -28662,7 +28671,7 @@ function DropinComposerComponent({
28662
28671
  },
28663
28672
  taskType: TaskTypes.TRUST,
28664
28673
  problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust2 == null ? void 0 : trust2.id],
28665
- parentLegalEntity: legalEntity,
28674
+ parentLegalEntity: rootLegalEntity,
28666
28675
  legalEntityResponse: trust2,
28667
28676
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28668
28677
  onChange: componentOnChange,
@@ -28676,8 +28685,8 @@ function DropinComposerComponent({
28676
28685
  });
28677
28686
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
28678
28687
  return jsx(TrustMembersOverview, {
28679
- trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, legalEntity, exemptSettlor) : getTrustMembers(trust2, legalEntity, exemptSettlor),
28680
- getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
28688
+ trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, rootLegalEntity, exemptSettlor) : getTrustMembers(trust2, rootLegalEntity, exemptSettlor),
28689
+ getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, rootLegalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId, ...getDirectEntityAssociations(rootLegalEntity, member.legalEntityId).map((association2) => association2.legalEntityId)]),
28681
28690
  navigateBackToTaskList: navigateBack,
28682
28691
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
28683
28692
  navigateToEditTrustMemberOwner: (trustMemberOwnerId, trustMemberId) => onNavigateToDecisionMakerIndividual(TaskTypes.TRUST_MEMBER_COMPANY_OWNER, trustMemberOwnerId, trustMemberId),
@@ -28697,7 +28706,7 @@ function DropinComposerComponent({
28697
28706
  });
28698
28707
  case TaskTypes.PCI_DSS:
28699
28708
  return jsx(PciDropinComponent, {
28700
- legalEntityResponse: legalEntity,
28709
+ legalEntityResponse: rootLegalEntity,
28701
28710
  pciTemplateResponse,
28702
28711
  trackingConfig: {
28703
28712
  topLevelLegalEntity: legalEntityResponse
@@ -28714,7 +28723,7 @@ function DropinComposerComponent({
28714
28723
  return jsx(SolePropDropinComponent, {
28715
28724
  ...args,
28716
28725
  taskType: TaskTypes.SOLE_PROPRIETOR_COMPANY,
28717
- parentLegalEntity: legalEntity,
28726
+ parentLegalEntity: rootLegalEntity,
28718
28727
  legalEntityResponse: solePropietor,
28719
28728
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28720
28729
  problems: (_j = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _j[solePropietor == null ? void 0 : solePropietor.id],
@@ -28723,13 +28732,13 @@ function DropinComposerComponent({
28723
28732
  onSubmit: componentOnSubmit,
28724
28733
  handleHomeClick: navigateBack,
28725
28734
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
28726
- country: (_l = (_k = legalEntity == null ? void 0 : legalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
28735
+ country: (_l = (_k = rootLegalEntity == null ? void 0 : rootLegalEntity.individual) == null ? void 0 : _k.residentialAddress) == null ? void 0 : _l.country,
28727
28736
  handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
28728
28737
  handleFindAddress: args == null ? void 0 : args.handleFindAddress
28729
28738
  });
28730
28739
  case TaskTypes.SERVICE_AGREEMENT:
28731
28740
  return jsx(ServiceAgreementDropinComponent, {
28732
- legalEntityResponse: legalEntity,
28741
+ legalEntityResponse: rootLegalEntity,
28733
28742
  trackingConfig: {
28734
28743
  topLevelLegalEntity: legalEntityResponse
28735
28744
  },
@@ -28748,6 +28757,7 @@ function DropinComposerComponent({
28748
28757
  case TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER:
28749
28758
  return jsx(LegalEntityTypeSwitcher, {
28750
28759
  ...args,
28760
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity,
28751
28761
  targetLegalEntityType: legalEntityType,
28752
28762
  legalEntityResponse,
28753
28763
  handleHomeClick: navigateBack,