@adyen/kyc-components 2.16.0 → 2.17.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 (35) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1087 -459
  2. package/dist/style.css +303 -261
  3. package/dist/types/components/BusinessTypeSelection/BusinessTypeSelection.d.ts +16 -0
  4. package/dist/types/components/BusinessTypeSelection/types.d.ts +34 -0
  5. package/dist/types/components/Company/types.d.ts +1 -0
  6. package/dist/types/components/CompanyNameAndCountry/types.d.ts +1 -0
  7. package/dist/types/components/Dropins/CompanyDropin/types.d.ts +1 -1
  8. package/dist/types/components/PayoutDetails/component/PayoutDetailsComponent.d.ts +2 -2
  9. package/dist/types/components/TaskList/component/TaskListItem.d.ts +1 -1
  10. package/dist/types/components/TaskList/types.d.ts +2 -0
  11. package/dist/types/components/internal/AccountHolder/types.d.ts +2 -1
  12. package/dist/types/components/internal/Address/types.d.ts +0 -2
  13. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  14. package/dist/types/components/internal/Alert/Alert.d.ts +1 -3
  15. package/dist/types/components/internal/Alert/index.d.ts +1 -1
  16. package/dist/types/components/internal/Alert/types.d.ts +1 -0
  17. package/dist/types/components/internal/FormFields/RadioGroupCard/RadioCardSelect.d.ts +1 -1
  18. package/dist/types/components/internal/FormFields/RadioGroupCard/types.d.ts +2 -2
  19. package/dist/types/core/Context/CoreProvider.d.ts +2 -1
  20. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  21. package/dist/types/core/Services/componentApi/get-supported-countries.d.ts +3 -0
  22. package/dist/types/core/errorMapping.d.ts +2 -0
  23. package/dist/types/core/hooks/useAccountHolder.d.ts +2 -0
  24. package/dist/types/core/hooks/useAllowedCountries.d.ts +2 -0
  25. package/dist/types/core/hooks/useBusinessSetup.d.ts +16 -0
  26. package/dist/types/core/hooks/useBusinessTypeSelection.d.ts +2 -0
  27. package/dist/types/core/hooks/useDataMissingRemediations.d.ts +18 -0
  28. package/dist/types/core/hooks/useEnableNewEntryFlow.d.ts +1 -0
  29. package/dist/types/language/config.d.ts +43 -0
  30. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  31. package/dist/types/utils/entity-status-util.d.ts +2 -2
  32. package/dist/types/utils/trust-util.d.ts +1 -1
  33. package/package.json +3 -2
  34. package/dist/types/openbankingsdk/OpenBankingSDK.d.ts +0 -14
  35. package/dist/types/openbankingsdk/types.d.ts +0 -22
@@ -5,6 +5,7 @@ import cx from "classnames";
5
5
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
6
6
  import { useId, useRef as useRef$1, useMemo as useMemo$1, forwardRef, memo } from "preact/compat";
7
7
  import { debounce, range, uniqueId } from "lodash";
8
+ import OpenBankingSDK from "@adyen/openbankingsdk";
8
9
  const ConfigurationApiContext = createContext(void 0);
9
10
  const useConfigurationApi = () => {
10
11
  const configurationApi = useContext(ConfigurationApiContext);
@@ -187,7 +188,7 @@ const industryExemption = "Industry exemption";
187
188
  const validationPleaseEnterAValidRegistrationNumber = "Please enter a valid company registration number";
188
189
  const validationPleaseEnterAValidRegistrationNumberWithFormat = "Please enter a valid company registration number. Expected format: %{format}";
189
190
  const validationPleaseEnterAValidVatNumber = "Please enter a valid Tax id number";
190
- const validationPleaseEnterAValidVatNumberWithFormat = "Please enter a valid Tax id number. Expected format: %{format}";
191
+ const validationPleaseEnterAValidVatNumberWithFormat = "Please enter a valid VAT number. Expected format: %{format}";
191
192
  const validationPleaseEnterAValidTaxIdNumberWithFormat = "Please enter a valid Tax id number. Expected format: %{format}";
192
193
  const validationPleaseEnterAValidIRDNumber = "Please enter a valid IRD number. Expected format: 8 - 9 digits";
193
194
  const aValidAbnShouldBe11Digits = "A valid ABN should be 11 digits.";
@@ -228,6 +229,7 @@ const byClickingSubmitReview = "By clicking 'Submit review', you confirm that al
228
229
  const nameAndCountry = "Name and country";
229
230
  const companyCountry = "Where is your business located?";
230
231
  const accountDetailsDescription = "Provide a few details about you to start accepting live payments.";
232
+ const provideFewDetailsAboutYourself = "Provide a few details about yourself.";
231
233
  const provideDetails = "Provide details";
232
234
  const payoutAccountsDescription = "To set up your account, let us know where to send your payouts.";
233
235
  const payoutAccountsDescriptionReview = "In order to ensure that your payout data is accurate, please verify the following details.";
@@ -453,7 +455,7 @@ const ICO = "IČO (Identifikační číslo)";
453
455
  const handelsregisternummer = "Handelsregisternummer";
454
456
  const NumeroDeTVA = "Numéro de TVA";
455
457
  const organisasjonsnummer = "Organisasjonsnummer";
456
- const mvanummer = "MVA nummer";
458
+ const mvanummer = "MVA-nummer";
457
459
  const verificationErrorMessage = "Some information couldn’t be verified. Click to see what needs to be adjusted.";
458
460
  const remediationFormErrorMessage = "Some information couldn’t be verified. Information in this form may need to be adjusted.";
459
461
  const youHaveUnsavedChanges = "You have unsaved changes";
@@ -585,9 +587,36 @@ const providePageWithPhotoAndCode = "Provide the page with the photo, including
585
587
  const constitutionalDocument = "Constitutional document";
586
588
  const solePropDetails = "Sole proprietor details";
587
589
  const soleProprietorDetails = "Sole proprietor details";
590
+ const soleProprietorshipDetails = "Sole proprietorship details";
588
591
  const selectAccountHolder = "Select account holder";
589
592
  const nameOfBankAccountHolder = "We need to know about the bank account where you want to receive your payouts. What is the name of the account holder of that bank account?";
593
+ const whatBestDescribesYourBusinessSetup = "What best describes your business setup?";
594
+ const whichLegalArrangementDoesYourBusinessHave = "Which legal arrangement does your business have?";
595
+ const sorryWeCantSetUpAnAccountForYou = "Sorry, we can’t set up an account for you";
596
+ const changeYourBusinessSetup = "Change your business setup?";
597
+ const someInformationWillNotBeSaved = "Some information that you entered previously will not be saved. ";
598
+ const yesChange = "Yes, change";
599
+ const youAreNotSoleProprietorAndUseBankAccount = "You’re not a sole proprietor and you use a personal bank account.";
600
+ const soleProprietorship = "Sole proprietorship";
601
+ const youAreRegisteredSoleProprietorAndUseBankAccount = "You’re a registered sole proprietor and you use a bank account in your name or sole proprietorship’s name.";
602
+ const company = "Company";
603
+ const youUseCompanyBankAccount = "You use a company bank account.";
604
+ const trust = "Trust";
605
+ const trustPartnershipOrAssociation = "Trust, partnership, or association";
606
+ const whatTypeOfTrusteeAreYou = "What type of trustee are you?";
607
+ const youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation = "You’re an individual or company, and you use a bank account in the name of a trust, partnership, or association.";
608
+ const individualTrustee = "Individual trustee";
609
+ const companyTrustee = "Company trustee";
610
+ const association = "Association";
611
+ const partnership = "Partnership";
612
+ const youAreTrusteeManagingTheTrustForBeneficiaries = "You’re a trustee managing the trust for beneficiaries.";
613
+ const jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits = "A jointly owned business where two or more people operate and share profits.";
614
+ const groupOfPeopleActingTogetherForNonCommercialPurpose = "A group of people acting together for a non-commercial purpose.";
615
+ const ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations = "Our financial services aren’t available yet for partnerships and associations";
616
+ const needHelpYouCanAlwaysReachOutToCustomerSupport = "Need help? You can always reach out to customer support.";
590
617
  const myName = "My name";
618
+ const setUpYourAccount = "Set up your account";
619
+ const yourBusinessSetup = "Your business setup: %{businessSetup}";
591
620
  const myNameDescription = "It’s a personal bank account held in my own name";
592
621
  const mySoleProprietorName = "My sole proprietor name";
593
622
  const mySoleProprietorNameDescription = "The account is in my name, but I am registered as a sole proprietor, sole trader, or freelancer";
@@ -600,6 +629,12 @@ const aPartnershipDescription = "The account belongs to a jointly owned business
600
629
  const anAssociation = "An association";
601
630
  const anAssociationDescription = "The account belongs to a group of people acting together for a specific non-commercial purpose";
602
631
  const legalNameOfSoleProprietor = "Legal name of sole proprietor";
632
+ const legalNameOfSoleProprietorship = "Legal name of sole proprietorship";
633
+ const letUsKnowTheBankAccountToSendReceiveFunds = "Let us know the bank account you use to send or receive funds.";
634
+ const bankAccount = "Bank account";
635
+ const bankAccountDetails = "Bank account details";
636
+ const addExtraBankAccount = "Add extra bank account";
637
+ const addAndVerifyYourBankDetails = "Add and verify your bank account details";
603
638
  const failedToFetchSoleProp = "Failed to fetch the sole propietor";
604
639
  const uniqueIdentificationCode = "Unique identification code (ЕИК/UIC)";
605
640
  const identifikacionenNomerDDS = "VAT number (ДДС)";
@@ -756,6 +791,7 @@ const passportPhotoPage = "Passport photo page";
756
791
  const residencePermitBack = "Residence permit (back)";
757
792
  const residencePermitFront = "Residence permit (front)";
758
793
  const manualUpload = "Manual upload";
794
+ const missingMultipleDecisionMakers = "You haven't added all required decision-makers";
759
795
  const legalCompanyName = "Legal name of the company";
760
796
  const legalCompanyName__helperText = "Enter the name exactly as it is on your company's official registration documents.";
761
797
  const legalCompanyName__helperText__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC).";
@@ -979,6 +1015,10 @@ const errorMessage_1_7019 = "The bank document wasn't issued in the past 12 mont
979
1015
  const errorMessage_1_7020 = "The bank name didn't match the one on the bank document.";
980
1016
  const errorMessage_1_7021 = "The bank document didn't show an official bank logo.";
981
1017
  const errorMessage_1_7022 = "The bank document didn't show an official bank stamp.";
1018
+ const errorMessage_2_8064 = "UBO through ownership was missing.";
1019
+ const errorMessage_2_8067 = "Signatory was missing.";
1020
+ const errorMessage_2_8189 = "UBO through control was missing.";
1021
+ const errorMessage_2_8193 = "Director was missing.";
982
1022
  const errorMessage_3_10 = "Review of data is required";
983
1023
  const remediationMessage_1_100 = "No remediation possible";
984
1024
  const remediationMessage_1_101 = "Contact Support";
@@ -1017,6 +1057,10 @@ const remediationMessage_1_702 = "Use other means of bank account verification";
1017
1057
  const remediationMessage_1_703 = "Upload a bank statement";
1018
1058
  const remediationMessage_1_704 = "Upload a different bank statement";
1019
1059
  const remediationMessage_1_705 = "Upload an official bank statement";
1060
+ const remediationMessage_2_123 = "You haven't added an owner";
1061
+ const remediationMessage_2_124 = "You haven't added a signatory";
1062
+ const remediationMessage_2_151 = "You haven't added a controlling person";
1063
+ const remediationMessage_2_185 = "You haven't added your directors";
1020
1064
  const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1021
1065
  const sameNameAsLegalName = "Same as legal name of the company";
1022
1066
  const whereCanIFindTheseNumbersOnMyDriversLicense = "Where can I find these numbers on my driver's license?";
@@ -1287,6 +1331,7 @@ const defaultTrans = {
1287
1331
  nameAndCountry,
1288
1332
  companyCountry,
1289
1333
  accountDetailsDescription,
1334
+ provideFewDetailsAboutYourself,
1290
1335
  provideDetails,
1291
1336
  payoutAccountsDescription,
1292
1337
  payoutAccountsDescriptionReview,
@@ -1649,9 +1694,36 @@ const defaultTrans = {
1649
1694
  constitutionalDocument,
1650
1695
  solePropDetails,
1651
1696
  soleProprietorDetails,
1697
+ soleProprietorshipDetails,
1652
1698
  selectAccountHolder,
1653
1699
  nameOfBankAccountHolder,
1700
+ whatBestDescribesYourBusinessSetup,
1701
+ whichLegalArrangementDoesYourBusinessHave,
1702
+ sorryWeCantSetUpAnAccountForYou,
1703
+ changeYourBusinessSetup,
1704
+ someInformationWillNotBeSaved,
1705
+ yesChange,
1706
+ youAreNotSoleProprietorAndUseBankAccount,
1707
+ soleProprietorship,
1708
+ youAreRegisteredSoleProprietorAndUseBankAccount,
1709
+ company,
1710
+ youUseCompanyBankAccount,
1711
+ trust,
1712
+ trustPartnershipOrAssociation,
1713
+ whatTypeOfTrusteeAreYou,
1714
+ youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation,
1715
+ individualTrustee,
1716
+ companyTrustee,
1717
+ association,
1718
+ partnership,
1719
+ youAreTrusteeManagingTheTrustForBeneficiaries,
1720
+ jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits,
1721
+ groupOfPeopleActingTogetherForNonCommercialPurpose,
1722
+ ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations,
1723
+ needHelpYouCanAlwaysReachOutToCustomerSupport,
1654
1724
  myName,
1725
+ setUpYourAccount,
1726
+ yourBusinessSetup,
1655
1727
  myNameDescription,
1656
1728
  mySoleProprietorName,
1657
1729
  mySoleProprietorNameDescription,
@@ -1664,6 +1736,12 @@ const defaultTrans = {
1664
1736
  anAssociation,
1665
1737
  anAssociationDescription,
1666
1738
  legalNameOfSoleProprietor,
1739
+ legalNameOfSoleProprietorship,
1740
+ letUsKnowTheBankAccountToSendReceiveFunds,
1741
+ bankAccount,
1742
+ bankAccountDetails,
1743
+ addExtraBankAccount,
1744
+ addAndVerifyYourBankDetails,
1667
1745
  failedToFetchSoleProp,
1668
1746
  uniqueIdentificationCode,
1669
1747
  identifikacionenNomerDDS,
@@ -1832,6 +1910,7 @@ const defaultTrans = {
1832
1910
  residencePermitBack,
1833
1911
  residencePermitFront,
1834
1912
  manualUpload,
1913
+ missingMultipleDecisionMakers,
1835
1914
  legalCompanyName,
1836
1915
  legalCompanyName__helperText,
1837
1916
  legalCompanyName__helperText__AU,
@@ -2055,6 +2134,10 @@ const defaultTrans = {
2055
2134
  errorMessage_1_7020,
2056
2135
  errorMessage_1_7021,
2057
2136
  errorMessage_1_7022,
2137
+ errorMessage_2_8064,
2138
+ errorMessage_2_8067,
2139
+ errorMessage_2_8189,
2140
+ errorMessage_2_8193,
2058
2141
  errorMessage_3_10,
2059
2142
  remediationMessage_1_100,
2060
2143
  remediationMessage_1_101,
@@ -2093,6 +2176,10 @@ const defaultTrans = {
2093
2176
  remediationMessage_1_703,
2094
2177
  remediationMessage_1_704,
2095
2178
  remediationMessage_1_705,
2179
+ remediationMessage_2_123,
2180
+ remediationMessage_2_124,
2181
+ remediationMessage_2_151,
2182
+ remediationMessage_2_185,
2096
2183
  remediationMessage_3_100,
2097
2184
  sameNameAsLegalName,
2098
2185
  whereCanIFindTheseNumbersOnMyDriversLicense,
@@ -2722,11 +2809,11 @@ var AlertTypes = /* @__PURE__ */ ((AlertTypes2) => {
2722
2809
  return AlertTypes2;
2723
2810
  })(AlertTypes || {});
2724
2811
  const Alert = ({
2725
- className,
2726
2812
  title,
2727
2813
  type = AlertTypes.BASIC,
2728
- children,
2729
- hasCloseButton = true
2814
+ className,
2815
+ hasCloseButton = true,
2816
+ children
2730
2817
  }) => {
2731
2818
  const {
2732
2819
  i18n
@@ -2825,7 +2912,7 @@ const createLogger = (namespace) => {
2825
2912
  });
2826
2913
  return methods;
2827
2914
  };
2828
- const logger$m = createLogger("Link");
2915
+ const logger$n = createLogger("Link");
2829
2916
  const getIconClass = (icon, external) => {
2830
2917
  if (external) {
2831
2918
  return "adl-link__icon adyen-kyc-icon-external-link";
@@ -2837,7 +2924,7 @@ const getIconClass = (icon, external) => {
2837
2924
  };
2838
2925
  const isValidLink = (href) => {
2839
2926
  if (href === "#") {
2840
- logger$m.error('Links must include a valid href. If your href is "#", consider using a Button instead');
2927
+ logger$n.error('Links must include a valid href. If your href is "#", consider using a Button instead');
2841
2928
  return false;
2842
2929
  }
2843
2930
  return true;
@@ -3127,6 +3214,17 @@ function useResetGlobalData(caller) {
3127
3214
  }
3128
3215
  }), [dispatch, caller]);
3129
3216
  }
3217
+ const logger$m = createLogger("useAllowedCountries");
3218
+ const useAllowedCountries = () => {
3219
+ const {
3220
+ getAllowedCountries: getAllowedCountries2
3221
+ } = useConfigurationApi();
3222
+ const [allowedCountries, setAllowedCountries] = useState();
3223
+ useEffect(() => {
3224
+ getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$m.error);
3225
+ }, []);
3226
+ return allowedCountries;
3227
+ };
3130
3228
  const processField = ({
3131
3229
  key,
3132
3230
  value = null,
@@ -4916,7 +5014,7 @@ function CountryField({
4916
5014
  readonly,
4917
5015
  handleChangeFor,
4918
5016
  helperText,
4919
- allowedCountries = [],
5017
+ allowedCountries,
4920
5018
  classNameModifiers = []
4921
5019
  }) {
4922
5020
  const {
@@ -4931,7 +5029,7 @@ function CountryField({
4931
5029
  useEffect(() => {
4932
5030
  loadFlags2().catch(logger$k.error);
4933
5031
  }, [loadFlags2]);
4934
- const countries = countriesFromApi.filter((country2) => allowedCountries.length ? allowedCountries.includes(country2.id) : true).map((item) => ({
5032
+ const countries = countriesFromApi.filter((country2) => allowedCountries ? allowedCountries.includes(country2.id) : true).map((item) => ({
4935
5033
  ...item,
4936
5034
  sprite: `#adl-flag-${item.id.toLowerCase()}`
4937
5035
  }));
@@ -5160,8 +5258,10 @@ function CompanyNameAndCountry(props) {
5160
5258
  isSettingEnabled
5161
5259
  } = useSettingsContext();
5162
5260
  const {
5163
- id: id2
5261
+ id: id2,
5262
+ isTopLevelEntity
5164
5263
  } = props;
5264
+ const allowedCountries = useAllowedCountries();
5165
5265
  const {
5166
5266
  sliceData,
5167
5267
  updateStateSlice
@@ -5207,7 +5307,7 @@ function CompanyNameAndCountry(props) {
5207
5307
  labels: formUtils.getFieldLabels(COUNTRY_FIELD),
5208
5308
  readonly: !isAllowedEditPrefilledCountry || Boolean(props == null ? void 0 : props.disableCountry),
5209
5309
  classNameModifiers: ["country"],
5210
- allowedCountries: [],
5310
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
5211
5311
  handleChangeFor
5212
5312
  }), formUtils.isRequiredField("legalCompanyName") && jsx(LegalCompanyNameField, {
5213
5313
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -8613,6 +8713,7 @@ var DecisionMakerType = /* @__PURE__ */ ((DecisionMakerType2) => {
8613
8713
  return DecisionMakerType2;
8614
8714
  })(DecisionMakerType || {});
8615
8715
  var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
8716
+ TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
8616
8717
  TaskTypes2["INTRO"] = "INTRO";
8617
8718
  TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
8618
8719
  TaskTypes2["REVIEW"] = "REVIEW";
@@ -8784,12 +8885,19 @@ function AccountHolder(props) {
8784
8885
  dataStoreId,
8785
8886
  capabilities
8786
8887
  } = props;
8888
+ const {
8889
+ accountHolder: accountHolder2
8890
+ } = useCoreContext();
8787
8891
  const {
8788
8892
  isSettingEnabled
8789
8893
  } = useSettingsContext();
8790
8894
  const {
8791
8895
  isExperimentEnabled
8792
8896
  } = useExperimentsContext();
8897
+ const defaultData = cloneObject(props.data);
8898
+ if (isExperimentEnabled("EnableNewEntryFlow") && defaultData) {
8899
+ defaultData.accountHolder = accountHolder2 || defaultData.accountHolder;
8900
+ }
8793
8901
  const {
8794
8902
  handleChangeFor,
8795
8903
  data,
@@ -8799,7 +8907,7 @@ function AccountHolder(props) {
8799
8907
  } = useForm({
8800
8908
  ...props,
8801
8909
  schema: ["accountHolder"],
8802
- defaultData: props.data,
8910
+ defaultData,
8803
8911
  rules: props.validators || accountHolderValidationRules,
8804
8912
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
8805
8913
  });
@@ -8909,7 +9017,7 @@ const RadioCard = ({
8909
9017
  })]
8910
9018
  }), jsx("div", {
8911
9019
  className: "adl-radio-card__body adl-u-margin-bottom-16",
8912
- children: body ?? i18n.get(optionDescription)
9020
+ children: body ?? (optionDescription && i18n.get(optionDescription))
8913
9021
  }), footer && jsx("div", {
8914
9022
  className: "adl-u-margin-bottom-16",
8915
9023
  children: footer
@@ -8942,7 +9050,7 @@ function RadioCardSelect({
8942
9050
  children: options.map((option) => jsx(RadioCard, {
8943
9051
  optionId: optionId(option),
8944
9052
  optionName: optionName(option),
8945
- optionDescription: optionDescription(option),
9053
+ optionDescription: optionDescription == null ? void 0 : optionDescription(option),
8946
9054
  optionSubtitle: optionSubtitle == null ? void 0 : optionSubtitle(option),
8947
9055
  uniqueId: getUniqueId(uniqueIdBase),
8948
9056
  isInvalid,
@@ -9856,7 +9964,6 @@ function FieldContainer(props) {
9856
9964
  fieldProblems,
9857
9965
  fieldName,
9858
9966
  trimOnBlur,
9859
- allowedCountries,
9860
9967
  hideField,
9861
9968
  maxlength,
9862
9969
  handleChangeFor
@@ -9883,7 +9990,6 @@ function FieldContainer(props) {
9883
9990
  },
9884
9991
  readonly: formUtils.isReadOnly(field),
9885
9992
  classNameModifiers,
9886
- allowedCountries,
9887
9993
  className: hideField ? "adl-u-display-none" : "",
9888
9994
  handleChangeFor
9889
9995
  });
@@ -10465,7 +10571,6 @@ function Address(props) {
10465
10571
  shouldValidate,
10466
10572
  id: id2,
10467
10573
  hideCountry,
10468
- allowedCountries,
10469
10574
  heading
10470
10575
  } = props;
10471
10576
  const {
@@ -10584,7 +10689,6 @@ function Address(props) {
10584
10689
  return null;
10585
10690
  const hideField = fieldName === "country" && hideCountry;
10586
10691
  return jsx(FieldContainer, {
10587
- allowedCountries,
10588
10692
  classNameModifiers: [fieldName],
10589
10693
  data,
10590
10694
  valid,
@@ -10952,7 +11056,8 @@ function CompanyComponent(props) {
10952
11056
  country: props.country
10953
11057
  },
10954
11058
  heading: i18n.get("nameAndCountry"),
10955
- id: CompanyNameAndCountryFormID
11059
+ id: CompanyNameAndCountryFormID,
11060
+ isTopLevelEntity: props.isTopLevelEntity
10956
11061
  })
10957
11062
  }), jsx("div", {
10958
11063
  className: props.activeForm.formId !== CompanyTypeFormID ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -12481,13 +12586,23 @@ const mapExistingFile = (name) => ({
12481
12586
  existing: true
12482
12587
  });
12483
12588
  const mapApiIdDocumentToSchema = (idDocument2) => {
12589
+ const {
12590
+ type,
12591
+ attachments
12592
+ } = idDocument2;
12484
12593
  const {
12485
12594
  hasBackPage
12486
12595
  } = idDocumentTypeOptions.find(({
12487
12596
  id: id2
12488
- }) => id2 === idDocument2.type);
12489
- const frontPage2 = hasBackPage ? getPage(idDocument2, "front") : getPage(idDocument2);
12490
- const backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12597
+ }) => id2 === type);
12598
+ let frontPage2;
12599
+ let backPage2;
12600
+ if ((attachments == null ? void 0 : attachments.length) === 1) {
12601
+ frontPage2 = getPage(idDocument2);
12602
+ } else {
12603
+ frontPage2 = hasBackPage ? getPage(idDocument2, "front") : getPage(idDocument2);
12604
+ backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12605
+ }
12491
12606
  return {
12492
12607
  ...frontPage2 ? {
12493
12608
  idFrontPage: [mapExistingFile(frontPage2.pageName)]
@@ -12495,7 +12610,7 @@ const mapApiIdDocumentToSchema = (idDocument2) => {
12495
12610
  ...backPage2 ? {
12496
12611
  idBackPage: [mapExistingFile(backPage2.pageName)]
12497
12612
  } : {},
12498
- idDocumentType: idDocument2.type
12613
+ idDocumentType: type
12499
12614
  };
12500
12615
  };
12501
12616
  const mapApiDocumentToIndividualDocuments = (entityId) => {
@@ -15564,6 +15679,7 @@ function PersonalDetailsComponent(props) {
15564
15679
  const {
15565
15680
  isSettingEnabled
15566
15681
  } = useSettingsContext();
15682
+ const allowedCountries = useAllowedCountries();
15567
15683
  const PERSONAL_DETAILS = props.id;
15568
15684
  const [externalErrors, setExternalErrors] = useState(null);
15569
15685
  const [status, setStatus] = useState("success");
@@ -15572,6 +15688,7 @@ function PersonalDetailsComponent(props) {
15572
15688
  });
15573
15689
  const [personalDetailsData, setPersonalDetailsData] = useState(null);
15574
15690
  const isDecisionMakerTask = props.taskType === TaskTypes.DECISION_MAKER || props.taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER;
15691
+ const isTopLevelEntity = props.taskType === TaskTypes.INDIVIDUAL;
15575
15692
  const requiredFieldsByTask = (props.requiredFields || personalDetailsFields).filter((field) => field !== "role" || field === "role" && isDecisionMakerTask);
15576
15693
  const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
15577
15694
  const getDirectChildFields = () => requiredFieldsByTask.filter((field) => ["birthDate", "residencyCountry", "jobTitle", "nationality"].includes(field));
@@ -15688,7 +15805,7 @@ function PersonalDetailsComponent(props) {
15688
15805
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
15689
15806
  formUtils,
15690
15807
  id: "ariaErrorField"
15691
- }), data.residencyCountry === "US" && !isDecisionMakerTask ? jsx(PatriotActDisclosure, {}) : void 0, jsx(ContextGuidance, {
15808
+ }), data.residencyCountry === "US" && isTopLevelEntity ? jsx(PatriotActDisclosure, {}) : void 0, jsx(ContextGuidance, {
15692
15809
  page: "Personal details",
15693
15810
  title: i18n.get("whyDoINeedToFillInThisInformation"),
15694
15811
  content: i18n.get("reasonForFillingIndividualPersonalDetails"),
@@ -15735,7 +15852,7 @@ function PersonalDetailsComponent(props) {
15735
15852
  country: formUtils.getLabel("residencyCountry")
15736
15853
  },
15737
15854
  readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask,
15738
- allowedCountries: [],
15855
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
15739
15856
  classNameModifiers: ["country"],
15740
15857
  handleChangeFor: () => handleChangeFor("residencyCountry", "input")
15741
15858
  }), jsx(IdentityComponent, {
@@ -16271,61 +16388,6 @@ const refreshSession = async () => {
16271
16388
  logger$e.error("Failed to fetch sdk token", e);
16272
16389
  }
16273
16390
  };
16274
- const OpenBankingSDKStyles = "";
16275
- const WIDGET_IFRAME_CLASS$1 = "adyen-open-banking-sdk-widget";
16276
- const WIDGET_CONTAINER_CLASS$1 = `${WIDGET_IFRAME_CLASS$1}-container`;
16277
- class OpenBankingSDK {
16278
- constructor({
16279
- divElement,
16280
- link,
16281
- successHandler,
16282
- errorHandler
16283
- }) {
16284
- this.divElement = divElement;
16285
- this.link = link;
16286
- this.successHandler = successHandler;
16287
- this.errorHandler = errorHandler;
16288
- }
16289
- static create(parameters) {
16290
- return new OpenBankingSDK(parameters);
16291
- }
16292
- open() {
16293
- this.iframe = document.createElement("iframe");
16294
- this.iframe.setAttribute("allowFullscreen", "true");
16295
- this.iframe.classList.add(WIDGET_IFRAME_CLASS$1);
16296
- this.divElement.appendChild(this.iframe);
16297
- this.divElement.classList.add(WIDGET_CONTAINER_CLASS$1);
16298
- const iframeUrl = new URL(this.link);
16299
- const iframeWindow = this.iframe.contentWindow;
16300
- this.listener = ({
16301
- data,
16302
- origin,
16303
- source
16304
- }) => {
16305
- if (source !== iframeWindow || origin !== iframeUrl.origin)
16306
- return;
16307
- switch (data.type) {
16308
- case "account_verification_report":
16309
- this.successHandler(data.code, data.state);
16310
- break;
16311
- case "error":
16312
- this.errorHandler(data.error_code, data.error_message, data.state, data.metadata);
16313
- break;
16314
- }
16315
- };
16316
- window.addEventListener("message", this.listener);
16317
- this.iframe.setAttribute("src", iframeUrl.href);
16318
- }
16319
- destroy() {
16320
- if (this.listener) {
16321
- window.removeEventListener("message", this.listener);
16322
- }
16323
- if (this.iframe) {
16324
- this.divElement.removeChild(this.iframe);
16325
- this.iframe = void 0;
16326
- }
16327
- }
16328
- }
16329
16391
  const addAnimationStartListener = (element, listener) => {
16330
16392
  element.addEventListener("animationstart", listener, false);
16331
16393
  element.addEventListener("MSAnimationStart", listener, false);
@@ -17096,7 +17158,8 @@ function BankAccountFormat(props) {
17096
17158
  var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
17097
17159
  ExperimentNames2["EnableTrustFlow"] = "EnableTrustFlow";
17098
17160
  ExperimentNames2["OnlyAllowAlphanumericBankAccountNumbers"] = "OnlyAllowAlphanumericBankAccountNumbers";
17099
- ExperimentNames2["OrganizationSettlorWithExemptionReason"] = "OrganizationSettlorWithExemptionReason";
17161
+ ExperimentNames2["EnableNewEntryFlow"] = "EnableNewEntryFlow";
17162
+ ExperimentNames2["AllowOrganizationSettlorWithExemptionReason"] = "AllowOrganizationSettlorWithExemptionReason";
17100
17163
  return ExperimentNames2;
17101
17164
  })(ExperimentNames || {});
17102
17165
  const stripNonAlphanumeric = (value) => value.replaceAll(/[^0-9a-zA-Z]/g, "");
@@ -18500,9 +18563,13 @@ const payoutSteps = {
18500
18563
  formName: "verificationMethod",
18501
18564
  fields: payoutVerificationMethodFields
18502
18565
  },
18503
- payoutAccountDetails: (tasktype) => ({
18566
+ payoutAccountDetails: (tasktype, isNewEntryFlowExperimentEnabled) => ({
18504
18567
  formId: "payoutAccountDetails",
18505
- formName: tasktype === TaskTypes.PAYIN ? "payinAccount" : "payoutAccount",
18568
+ ...isNewEntryFlowExperimentEnabled ? {
18569
+ formName: "bankAccount"
18570
+ } : {
18571
+ formName: tasktype === TaskTypes.PAYIN ? "payinAccount" : "payoutAccount"
18572
+ },
18506
18573
  fields: payoutAccountFields
18507
18574
  }),
18508
18575
  payoutAccountDocuments: {
@@ -18516,9 +18583,9 @@ const payoutSteps = {
18516
18583
  fields: accountVerificationFields
18517
18584
  }
18518
18585
  };
18519
- const getAppropriatePayoutDetailsSteps = (currentTask, isEditing, instantVerificationAvailable, canChangeCountry) => {
18586
+ const getAppropriatePayoutDetailsSteps = (currentTask, isEditing, instantVerificationAvailable, canChangeCountry, isNewEntryFlowExperimentEnabled) => {
18520
18587
  const dependentSteps = {
18521
- payoutAccountDetails: payoutSteps.payoutAccountDetails(currentTask),
18588
+ payoutAccountDetails: payoutSteps.payoutAccountDetails(currentTask, isNewEntryFlowExperimentEnabled),
18522
18589
  payoutAccountDocuments: payoutSteps.payoutAccountDocuments,
18523
18590
  payoutAccountVerification: payoutSteps.payoutAccountVerification
18524
18591
  };
@@ -18536,6 +18603,9 @@ function PayoutDetailsComponent(props) {
18536
18603
  const {
18537
18604
  i18n
18538
18605
  } = useI18nContext();
18606
+ const {
18607
+ isExperimentEnabled
18608
+ } = useExperimentsContext();
18539
18609
  const {
18540
18610
  activeForm,
18541
18611
  taskType,
@@ -18552,9 +18622,9 @@ function PayoutDetailsComponent(props) {
18552
18622
  const [instantVerificationError, setInstantVerificationError] = useInstantVerificationErrorNotification(1e4);
18553
18623
  const verificationMethodFormProps = getFormProps(props, payoutSteps.payoutVerificationMethod.formId);
18554
18624
  const accountVerificationFormProps = getFormProps(props, payoutSteps.payoutAccountVerification.formId);
18555
- const payoutAccountFormProps = getFormProps(props, payoutSteps.payoutAccountDetails(taskType).formId);
18625
+ const payoutAccountFormProps = getFormProps(props, payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId);
18556
18626
  const payoutBankStatementFormProps = getFormProps(props, payoutSteps.payoutAccountDocuments.formId);
18557
- const taskHeading = i18n.get(taskHeadings[taskType]);
18627
+ const taskHeading = isExperimentEnabled("EnableNewEntryFlow") ? i18n.get("addAndVerifyYourBankDetails") : i18n.get(taskHeadings[taskType]);
18558
18628
  const isBankStatementDocumentOptional = formUtilities(payoutBankStatementFormProps, i18n).isOptionalField("bankStatementDocument");
18559
18629
  const globalData = useGlobalData();
18560
18630
  const data = isEmpty(globalData) ? props.data : globalData;
@@ -18609,11 +18679,11 @@ function PayoutDetailsComponent(props) {
18609
18679
  handleBankVerificationError: handleBankVerificationError2
18610
18680
  })
18611
18681
  }) : jsx("div", {
18612
- className: activeForm.formId !== payoutSteps.payoutAccountDetails(taskType).formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18682
+ className: activeForm.formId !== payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18613
18683
  children: jsx(PayoutAccount, {
18614
18684
  ...payoutAccountFormProps,
18615
18685
  heading: taskHeading,
18616
- id: payoutSteps.payoutAccountDetails(taskType).formId,
18686
+ id: payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId,
18617
18687
  country: bankCountry2,
18618
18688
  legalEntityResponse
18619
18689
  })
@@ -18725,6 +18795,9 @@ function SolePropComponent(props) {
18725
18795
  const {
18726
18796
  i18n
18727
18797
  } = useI18nContext();
18798
+ const {
18799
+ isExperimentEnabled
18800
+ } = useExperimentsContext();
18728
18801
  const [tradingName2, setTradingName] = useState();
18729
18802
  const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18730
18803
  const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
@@ -18754,11 +18827,12 @@ function SolePropComponent(props) {
18754
18827
  },
18755
18828
  labels: {
18756
18829
  country: "countryOfEstablishment",
18757
- legalCompanyName: "legalNameOfSoleProprietor"
18830
+ legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18758
18831
  },
18759
18832
  heading: i18n.get("nameAndCountry"),
18760
18833
  id: solePropNameAndCountryFormId,
18761
- disableCountry: true
18834
+ disableCountry: true,
18835
+ isTopLevelEntity: false
18762
18836
  })
18763
18837
  }), jsx("div", {
18764
18838
  className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -19204,6 +19278,16 @@ const remediationActionMappings = {
19204
19278
  const dataMissingRemediationsToFieldsMap = {
19205
19279
  "2_158": ["vatNumber", "exemptedFromVat", "vatAbsenceReason"]
19206
19280
  };
19281
+ const DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING = {
19282
+ "2_8064": "2_123",
19283
+ // Owner
19284
+ "2_8067": "2_124",
19285
+ // Signatory
19286
+ "2_8189": "2_151",
19287
+ // Controller
19288
+ "2_8193": "2_185"
19289
+ // Director
19290
+ };
19207
19291
  var EntityType = /* @__PURE__ */ ((EntityType2) => {
19208
19292
  EntityType2["BANK_ACCOUNT"] = "BankAccount";
19209
19293
  EntityType2["LEGAL_ENTITY"] = "LegalEntity";
@@ -19224,7 +19308,7 @@ const entityProblemInitialState = {
19224
19308
  // default status - if the entity is not listed in the problems array
19225
19309
  validationErrors: {}
19226
19310
  };
19227
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
19311
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036"];
19228
19312
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
19229
19313
  function getCapabilityProblems(response) {
19230
19314
  const capabilities = (response == null ? void 0 : response.capabilities) || {};
@@ -21011,7 +21095,7 @@ function CompanyDropinComponent({
21011
21095
  taskName,
21012
21096
  capabilities,
21013
21097
  homeButtonLabel,
21014
- taskType,
21098
+ taskType = TaskTypes.COMPANY,
21015
21099
  trackingConfig,
21016
21100
  associationDetail,
21017
21101
  parentLegalEntity,
@@ -21339,7 +21423,8 @@ function CompanyDropinComponent({
21339
21423
  onTypeSwitch,
21340
21424
  onCountryChange: setCountry,
21341
21425
  ref: formRef,
21342
- shouldValidate
21426
+ shouldValidate,
21427
+ isTopLevelEntity: taskType === TaskTypes.COMPANY
21343
21428
  })
21344
21429
  });
21345
21430
  }
@@ -21447,20 +21532,26 @@ const useShouldShowIntro = (legalEntity) => {
21447
21532
  } = useHasSeenIntro(legalEntity.id);
21448
21533
  return canSeeIntro && !hasSeenIntro;
21449
21534
  };
21535
+ const useShouldShowBusinessTypeSelection = (accountHolder2) => {
21536
+ const {
21537
+ isExperimentEnabled
21538
+ } = useExperimentsContext();
21539
+ return isExperimentEnabled("EnableNewEntryFlow") && !accountHolder2;
21540
+ };
21450
21541
  const logger$7 = createLogger("useExemptSettlor");
21451
21542
  const useExemptSettlor = ({
21452
- trust,
21543
+ trust: trust2,
21453
21544
  handleGetLegalEntity
21454
21545
  }) => {
21455
21546
  const [exemptSettlor, setExemptSettlor] = useState();
21456
21547
  const updateExemptSettlor = useCallback(async (trustLE) => {
21457
- const exemptSettlorAssociation = getOwnEntityAssociations(trustLE).find((association) => association.type === TrustMemberTypes.SETTLOR && Boolean(association.settlorExemptionReason));
21548
+ const exemptSettlorAssociation = getOwnEntityAssociations(trustLE).find((association2) => association2.type === TrustMemberTypes.SETTLOR && Boolean(association2.settlorExemptionReason));
21458
21549
  const exemptSettlorLE = (exemptSettlorAssociation == null ? void 0 : exemptSettlorAssociation.legalEntityId) ? await handleGetLegalEntity(exemptSettlorAssociation.legalEntityId) : void 0;
21459
21550
  setExemptSettlor(exemptSettlorLE);
21460
21551
  }, [handleGetLegalEntity]);
21461
21552
  useEffect(() => {
21462
- updateExemptSettlor(trust).catch(logger$7.error);
21463
- }, [trust, updateExemptSettlor]);
21553
+ updateExemptSettlor(trust2).catch(logger$7.error);
21554
+ }, [trust2, updateExemptSettlor]);
21464
21555
  return exemptSettlor;
21465
21556
  };
21466
21557
  function useSalesChannelsSettings() {
@@ -21555,7 +21646,7 @@ const splitAtFirstOccurrence = (str, separator) => {
21555
21646
  };
21556
21647
  const getTrustMemberOwnerId = (trustMemberId, entityAssociations) => {
21557
21648
  var _a;
21558
- return (_a = entityAssociations.find((association) => association.associatorId === trustMemberId && association.type === TrustMemberTypes.TRUSTEE)) == null ? void 0 : _a.legalEntityId;
21649
+ return (_a = entityAssociations.find((association2) => association2.associatorId === trustMemberId && association2.type === TrustMemberTypes.TRUSTEE)) == null ? void 0 : _a.legalEntityId;
21559
21650
  };
21560
21651
  const getFallbackName = (exemptSettlorAssociation) => {
21561
21652
  const [firstName2, lastName2] = splitAtFirstOccurrence(exemptSettlorAssociation.name ?? "", " ");
@@ -21564,37 +21655,37 @@ const getFallbackName = (exemptSettlorAssociation) => {
21564
21655
  lastName: lastName2
21565
21656
  };
21566
21657
  };
21567
- const convertEntityAssociationIntoTrustMember = (association, associations, exemptSettlorLE) => {
21658
+ const convertEntityAssociationIntoTrustMember = (association2, associations, exemptSettlorLE) => {
21568
21659
  var _a;
21569
- if (association.settlorExemptionReason) {
21660
+ if (association2.settlorExemptionReason) {
21570
21661
  return {
21571
21662
  trustMemberType: "exemptSettlor",
21572
21663
  roles: [TrustMemberTypes.SETTLOR],
21573
- legalEntityType: association.entityType,
21574
- legalEntityId: association.legalEntityId,
21575
- settlorExemptionReason: association.settlorExemptionReason,
21576
- exemptSettlorName: association.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association) : void 0,
21577
- name: association.name
21664
+ legalEntityType: association2.entityType,
21665
+ legalEntityId: association2.legalEntityId,
21666
+ settlorExemptionReason: association2.settlorExemptionReason,
21667
+ exemptSettlorName: association2.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association2) : void 0,
21668
+ name: association2.name
21578
21669
  };
21579
21670
  }
21580
- if (association.entityType === LegalEntityType.ORGANIZATION)
21671
+ if (association2.entityType === LegalEntityType.ORGANIZATION)
21581
21672
  return {
21582
21673
  trustMemberType: "company",
21583
21674
  roles: [],
21584
21675
  legalEntityType: LegalEntityType.ORGANIZATION,
21585
- legalEntityId: association.legalEntityId,
21586
- name: association.name,
21587
- ownerId: getTrustMemberOwnerId(association.legalEntityId, associations)
21676
+ legalEntityId: association2.legalEntityId,
21677
+ name: association2.name,
21678
+ ownerId: getTrustMemberOwnerId(association2.legalEntityId, associations)
21588
21679
  };
21589
- if (association.entityType === LegalEntityType.INDIVIDUAL)
21680
+ if (association2.entityType === LegalEntityType.INDIVIDUAL)
21590
21681
  return {
21591
21682
  trustMemberType: "regular",
21592
21683
  roles: [],
21593
21684
  legalEntityType: LegalEntityType.INDIVIDUAL,
21594
- legalEntityId: association.legalEntityId,
21595
- name: association.name
21685
+ legalEntityId: association2.legalEntityId,
21686
+ name: association2.name
21596
21687
  };
21597
- throw new Error(`Not a valid trust member: ${JSON.stringify(association)}`);
21688
+ throw new Error(`Not a valid trust member: ${JSON.stringify(association2)}`);
21598
21689
  };
21599
21690
  const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations, exemptSettlorLE) => {
21600
21691
  const mappedTrustMembers = entityAssociations.reduce((acc, entityAssociation) => {
@@ -21651,23 +21742,23 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
21651
21742
  };
21652
21743
  const addOrUpdateAssociatedTrustMember = async ({
21653
21744
  newOrUpdated,
21654
- trust,
21745
+ trust: trust2,
21655
21746
  handleUpdateLegalEntity
21656
21747
  }) => {
21657
- const otherAssociations = getOwnEntityAssociations(trust).filter((existingAssociation) => existingAssociation.legalEntityId !== newOrUpdated.legalEntityId);
21748
+ const otherAssociations = getOwnEntityAssociations(trust2).filter((existingAssociation) => existingAssociation.legalEntityId !== newOrUpdated.legalEntityId);
21658
21749
  const updatedAssociations = mapTrustMemberToEntityAssociations(newOrUpdated);
21659
21750
  const patchLE = {
21660
21751
  entityAssociations: [...otherAssociations, ...updatedAssociations]
21661
21752
  };
21662
- await handleUpdateLegalEntity(patchLE, trust.id);
21753
+ await handleUpdateLegalEntity(patchLE, trust2.id);
21663
21754
  };
21664
21755
  const addOrUpdateUndefinedBeneficiary = async ({
21665
21756
  newOrUpdated,
21666
- trust,
21757
+ trust: trust2,
21667
21758
  handleUpdateLegalEntity
21668
21759
  }) => {
21669
21760
  var _a, _b;
21670
- const otherUndefinedBeneficiaries = ((_b = (_a = trust.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) == null ? void 0 : _b.filter((ub) => ub.reference !== newOrUpdated.reference)) ?? [];
21761
+ const otherUndefinedBeneficiaries = ((_b = (_a = trust2.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) == null ? void 0 : _b.filter((ub) => ub.reference !== newOrUpdated.reference)) ?? [];
21671
21762
  const patchLE = {
21672
21763
  trust: {
21673
21764
  undefinedBeneficiaryInfo: [...otherUndefinedBeneficiaries, newOrUpdated.reference === isNewEntity ? {
@@ -21678,11 +21769,11 @@ const addOrUpdateUndefinedBeneficiary = async ({
21678
21769
  }]
21679
21770
  }
21680
21771
  };
21681
- await handleUpdateLegalEntity(patchLE, trust.id);
21772
+ await handleUpdateLegalEntity(patchLE, trust2.id);
21682
21773
  };
21683
21774
  const createExemptSettlor = async ({
21684
21775
  exemptSettlor,
21685
- trust,
21776
+ trust: trust2,
21686
21777
  handleCreateLegalEntity
21687
21778
  }) => {
21688
21779
  var _a, _b;
@@ -21694,7 +21785,7 @@ const createExemptSettlor = async ({
21694
21785
  lastName: ((_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName) ?? ""
21695
21786
  },
21696
21787
  residentialAddress: {
21697
- country: trust.trust.registeredAddress.country
21788
+ country: trust2.trust.registeredAddress.country
21698
21789
  }
21699
21790
  }
21700
21791
  };
@@ -21717,28 +21808,28 @@ const createOrganizationExemptSettlor = async ({
21717
21808
  };
21718
21809
  const deleteAssociatedTrustMember = async ({
21719
21810
  associatedTrustMember,
21720
- trust,
21811
+ trust: trust2,
21721
21812
  handleUpdateLegalEntity
21722
21813
  }) => {
21723
- const ownEntityAssociations = getOwnEntityAssociations(trust);
21814
+ const ownEntityAssociations = getOwnEntityAssociations(trust2);
21724
21815
  const updatedTrustAssociations = {
21725
21816
  entityAssociations: ownEntityAssociations.filter((entityAssociation) => entityAssociation.legalEntityId !== associatedTrustMember.legalEntityId)
21726
21817
  };
21727
- await handleUpdateLegalEntity(updatedTrustAssociations, trust.id);
21818
+ await handleUpdateLegalEntity(updatedTrustAssociations, trust2.id);
21728
21819
  };
21729
21820
  const deleteUndefinedBeneficiary = async ({
21730
21821
  undefinedBeneficiary: undefinedBeneficiary2,
21731
- trust,
21822
+ trust: trust2,
21732
21823
  handleUpdateLegalEntity
21733
21824
  }) => {
21734
21825
  var _a;
21735
- const existingUndefinedBeneficiaries = ((_a = trust.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [];
21826
+ const existingUndefinedBeneficiaries = ((_a = trust2.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [];
21736
21827
  const updatedTrust = {
21737
21828
  trust: {
21738
21829
  undefinedBeneficiaryInfo: existingUndefinedBeneficiaries.filter((ub) => ub.reference !== undefinedBeneficiary2.reference)
21739
21830
  }
21740
21831
  };
21741
- await handleUpdateLegalEntity(updatedTrust, trust.id);
21832
+ await handleUpdateLegalEntity(updatedTrust, trust2.id);
21742
21833
  };
21743
21834
  const exemptSettlorNamesTheSame = (existingSettlor, newSettlor) => JSON.stringify(existingSettlor.exemptSettlorName) === JSON.stringify(newSettlor.exemptSettlorName);
21744
21835
  const updateExemptSettlorName = async ({
@@ -21788,186 +21879,7 @@ function AccountSetupRejected() {
21788
21879
  content
21789
21880
  });
21790
21881
  }
21791
- const DecisionMakers = "";
21792
- const iconStatus = (current, min, max) => {
21793
- const isEmpty2 = current === 0;
21794
- const isWithinObligatoryRange = current === max || min > 0 && current >= min;
21795
- const isWithinConditionalRange = current >= min;
21796
- if (isEmpty2) {
21797
- return min > 0 ? "obligatoryEmpty" : "conditionalEmpty";
21798
- }
21799
- if (isWithinObligatoryRange) {
21800
- return "obligatoryFinished";
21801
- }
21802
- return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
21803
- };
21804
- const entityStatusRoles = {
21805
- ...decisionMakerRoles,
21806
- ...trustMemberGuidanceRoles
21807
- };
21808
- const getEntityStatusTagColor = (entityLabel) => {
21809
- var _a;
21810
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
21811
- };
21812
- const getEntityStatusName = (entityLabel) => {
21813
- var _a;
21814
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
21815
- };
21816
- const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
21817
- const _cardGroup_component = "";
21818
- function CardGroup({
21819
- className,
21820
- children
21821
- }) {
21822
- return jsx("section", {
21823
- className: cx("adl-card-group", className),
21824
- children
21825
- });
21826
- }
21827
- const _entityAssociation_component = "";
21828
- const Status$1 = "";
21829
- const Status = ({
21830
- text,
21831
- className,
21832
- iconStatusClass,
21833
- icon
21834
- }) => {
21835
- const containerClasses = cx("adl-status", className);
21836
- const iconClasses = cx("adl-status__icon", iconStatusClass);
21837
- return jsxs("div", {
21838
- className: containerClasses,
21839
- children: [jsx("span", {
21840
- className: iconClasses,
21841
- children: icon === "loading" ? jsx(Loader, {
21842
- size: "xsmall",
21843
- dot: true
21844
- }) : jsx(Icon, {
21845
- name: icon
21846
- })
21847
- }), jsx("span", {
21848
- className: "adl-status__text",
21849
- children: text
21850
- })]
21851
- });
21852
- };
21853
- const TaskItemStatus = ({
21854
- status,
21855
- downloadHandler
21856
- }) => {
21857
- const {
21858
- i18n
21859
- } = useI18nContext();
21860
- const handleDownloadClick = (e) => {
21861
- e.stopPropagation();
21862
- downloadHandler == null ? void 0 : downloadHandler();
21863
- };
21864
- switch (status) {
21865
- case TaskStatus.DOWNLOAD:
21866
- return jsxs("span", {
21867
- className: "adl-status--download",
21868
- role: "button",
21869
- tabIndex: 0,
21870
- icon: "download",
21871
- onClick: handleDownloadClick,
21872
- children: [i18n.get("download"), " "]
21873
- });
21874
- case TaskStatus.FINISHED:
21875
- return jsx(Status, {
21876
- className: "adl-status--finished",
21877
- iconStatusClass: "adl-status__icon--finished",
21878
- icon: "check",
21879
- text: i18n.get("verified")
21880
- });
21881
- case TaskStatus.SIGNED:
21882
- return jsx(Status, {
21883
- className: "adl-status--finished",
21884
- iconStatusClass: "adl-status__icon--finished",
21885
- icon: "check",
21886
- text: i18n.get("signed")
21887
- });
21888
- case TaskStatus.ERROR:
21889
- return jsx(Status, {
21890
- className: "adl-status--error",
21891
- iconStatusClass: "adl-status__icon--error",
21892
- icon: "info-circle",
21893
- text: i18n.get("unsuccessful")
21894
- });
21895
- case TaskStatus.PROCESSING:
21896
- return jsx(Status, {
21897
- className: "",
21898
- iconStatusClass: "",
21899
- icon: "loading",
21900
- text: i18n.get("inReview")
21901
- });
21902
- case TaskStatus.SIGN:
21903
- return jsx("span", {
21904
- className: "adl-task-status-sign",
21905
- children: i18n.get("sign")
21906
- });
21907
- case TaskStatus.SUBMIT:
21908
- return jsx("span", {
21909
- className: "adl-task-status-submit",
21910
- children: i18n.get("submit")
21911
- });
21912
- case TaskStatus.REMOVING:
21913
- return jsx(Status, {
21914
- className: "",
21915
- iconStatusClass: "",
21916
- icon: "loading",
21917
- text: i18n.get("removing")
21918
- });
21919
- case "review":
21920
- return jsx("span", {
21921
- className: "adl-task-status-details-required",
21922
- children: i18n.get("verify")
21923
- });
21924
- case TaskStatus.DETAILS_REQUIRED:
21925
- case TaskStatus.EMPTY:
21926
- default:
21927
- return jsx("span", {
21928
- className: "adl-task-status-details-required",
21929
- children: i18n.get("add")
21930
- });
21931
- }
21932
- };
21933
- const VerificationErrorAlert = ({
21934
- className,
21935
- problems
21936
- }) => {
21937
- const {
21938
- i18n
21939
- } = useI18nContext();
21940
- if ((problems == null ? void 0 : problems.verificationErrors) && Object.keys(problems.verificationErrors).length > 0) {
21941
- const childErrors = Object.values(problems.verificationErrors).reduce((acc, parentChildErrors) => {
21942
- acc = {
21943
- ...acc,
21944
- ...parentChildErrors
21945
- };
21946
- return acc;
21947
- }, {});
21948
- const childErrorCodes = Object.keys(childErrors);
21949
- if (childErrorCodes.length === 1) {
21950
- const remediationActions = Object.values(childErrors[childErrorCodes[0]]).flat();
21951
- if (remediationActions.length === 1) {
21952
- const childErrorMsg = i18n.get(`errorMessage_${childErrorCodes[0]}`);
21953
- const remediationActionMsg = i18n.get(`remediationMessage_${remediationActions[0].code}`);
21954
- return jsx(Alert, {
21955
- className,
21956
- hasCloseButton: false,
21957
- type: AlertTypes.ERROR,
21958
- title: `${childErrorMsg}. ${remediationActionMsg}`
21959
- });
21960
- }
21961
- }
21962
- }
21963
- return jsx(Alert, {
21964
- className,
21965
- hasCloseButton: false,
21966
- type: AlertTypes.ERROR,
21967
- title: i18n.get("verificationErrorMessage")
21968
- });
21969
- };
21970
- const _card_component = "";
21882
+ const _businessTypeSelection_component = "";
21971
21883
  const _heading_component = "";
21972
21884
  const headingTypes = {
21973
21885
  1: ({
@@ -22018,22 +21930,663 @@ function Heading({
22018
21930
  children
22019
21931
  });
22020
21932
  }
22021
- function Card({
22022
- className,
22023
- children,
22024
- stateful,
22025
- active,
22026
- disabled,
22027
- title,
22028
- subTitle,
22029
- onClick,
22030
- onKeyDown
22031
- }) {
22032
- const classNames = cx("adl-card", className, {
22033
- "adl-card--stateful": stateful,
22034
- "adl-card--active": stateful && active,
22035
- "adl-card--disabled": disabled
22036
- });
21933
+ const _toast = "";
21934
+ function Toast({
21935
+ label,
21936
+ subLabel,
21937
+ actionLabel,
21938
+ type,
21939
+ duration = 3500,
21940
+ onToastHide,
21941
+ onToastAction
21942
+ }) {
21943
+ const toastRef = useRef(null);
21944
+ const loading2 = type === ToastType.LOADING;
21945
+ const successToast = type === ToastType.SUCCESS;
21946
+ const labelId = getUniqueId("toast");
21947
+ const handleShow = useCallback(() => {
21948
+ var _a;
21949
+ return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
21950
+ }, []);
21951
+ const handleHide = useCallback(() => {
21952
+ var _a;
21953
+ (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
21954
+ onToastHide();
21955
+ }, [onToastHide]);
21956
+ useEffect(() => {
21957
+ handleShow();
21958
+ if (duration !== "indefinite") {
21959
+ setTimeout(() => handleHide(), duration);
21960
+ }
21961
+ }, [label, duration, handleHide, handleShow]);
21962
+ return jsxs("div", {
21963
+ ref: toastRef,
21964
+ role: actionLabel ? "alertdialog" : "alert",
21965
+ className: "adl-toast",
21966
+ "aria-labelledby": labelId,
21967
+ children: [loading2 && jsx("div", {
21968
+ className: "adl-toast__loader",
21969
+ children: jsx("div", {
21970
+ className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
21971
+ })
21972
+ }), !loading2 && jsxs("div", {
21973
+ className: cx("adl-toast__status", {
21974
+ "adl-toast__status--success": successToast,
21975
+ "adl-toast__status--error": !successToast
21976
+ }),
21977
+ children: [successToast && jsx(Icon, {
21978
+ className: "adl-toast__status-icon",
21979
+ name: "checkmark"
21980
+ }), !successToast && jsx(Icon, {
21981
+ className: "adl-toast__status-icon",
21982
+ name: "cross"
21983
+ })]
21984
+ }), jsxs("div", {
21985
+ className: "adl-toast__message",
21986
+ children: [jsx("span", {
21987
+ id: labelId,
21988
+ className: "adl-toast__title",
21989
+ children: label
21990
+ }), actionLabel && jsx("button", {
21991
+ className: "adl-link adl-toast__action",
21992
+ title: "performAction",
21993
+ type: "button",
21994
+ onClick: onToastAction,
21995
+ children: actionLabel
21996
+ }), !loading2 && subLabel && jsx("span", {
21997
+ className: "adl-toast__subtitle",
21998
+ children: subLabel
21999
+ })]
22000
+ }), !loading2 && jsx("button", {
22001
+ className: "adl-toast__close",
22002
+ title: "close",
22003
+ type: "button",
22004
+ onClick: handleHide,
22005
+ children: jsx(Icon, {
22006
+ name: "cross"
22007
+ })
22008
+ })]
22009
+ });
22010
+ }
22011
+ const businessTypes = [{
22012
+ id: "individual",
22013
+ accountHolder: "myName",
22014
+ name: "individual",
22015
+ description: "youAreNotSoleProprietorAndUseBankAccount"
22016
+ }, {
22017
+ id: "soleProprietorship",
22018
+ accountHolder: "mySoleProprietorName",
22019
+ name: "soleProprietorship",
22020
+ description: "youAreRegisteredSoleProprietorAndUseBankAccount"
22021
+ }, {
22022
+ id: "company",
22023
+ accountHolder: "theCompanyIWorkFor",
22024
+ name: "company",
22025
+ description: "youUseCompanyBankAccount"
22026
+ }, {
22027
+ id: "legalArrangement",
22028
+ name: "trustPartnershipOrAssociation",
22029
+ description: "youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation"
22030
+ }];
22031
+ const legalArrangementItems = [{
22032
+ id: "aTrust",
22033
+ accountHolder: "aTrust",
22034
+ name: "trust",
22035
+ description: "youAreTrusteeManagingTheTrustForBeneficiaries"
22036
+ }, {
22037
+ id: "aPartnership",
22038
+ accountHolder: "aPartnership",
22039
+ name: "partnership",
22040
+ description: "jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits"
22041
+ }, {
22042
+ id: "anAssociation",
22043
+ accountHolder: "anAssociation",
22044
+ name: "association",
22045
+ description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
22046
+ }];
22047
+ const trusteeTypeItems = [{
22048
+ id: "individual",
22049
+ name: "individual"
22050
+ }, {
22051
+ id: "company",
22052
+ name: "company"
22053
+ }];
22054
+ const getFormSchema = (isLegalArrangement, isTrust) => {
22055
+ const schema = ["businessType"];
22056
+ if (isLegalArrangement) {
22057
+ schema.push("legalArrangement");
22058
+ }
22059
+ if (isTrust) {
22060
+ schema.push("trusteeType");
22061
+ }
22062
+ return schema;
22063
+ };
22064
+ const getBusinessTypes = (includeTrust, includeSoleProp) => businessTypes.filter((businessType) => {
22065
+ if (businessType.id === "legalArrangement") {
22066
+ return includeTrust;
22067
+ }
22068
+ if (businessType.id === "soleProprietorship") {
22069
+ return includeSoleProp;
22070
+ }
22071
+ return true;
22072
+ });
22073
+ const businessTypeSelectionValidationRules = {
22074
+ businessType: {
22075
+ modes: ["blur"],
22076
+ validate: (businessType) => !!businessType,
22077
+ errorMessage: "fieldIsRequired"
22078
+ },
22079
+ legalArrangement: {
22080
+ modes: ["blur"],
22081
+ validate: (legalArrangement) => !!legalArrangement,
22082
+ errorMessage: "fieldIsRequired"
22083
+ },
22084
+ trusteeType: {
22085
+ modes: ["blur"],
22086
+ validate: (trusteeType) => !!trusteeType,
22087
+ errorMessage: "fieldIsRequired"
22088
+ }
22089
+ };
22090
+ const businessTypeSelectionStepTitles = {
22091
+ [
22092
+ 0
22093
+ /* BUSINESS_TYPE_SELECTION */
22094
+ ]: "whatBestDescribesYourBusinessSetup",
22095
+ [
22096
+ 1
22097
+ /* LEGAL_ARRANGEMENT_SELECTION */
22098
+ ]: "whichLegalArrangementDoesYourBusinessHave",
22099
+ [
22100
+ 2
22101
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22102
+ ]: "sorryWeCantSetUpAnAccountForYou",
22103
+ [
22104
+ 3
22105
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22106
+ ]: "changeYourBusinessSetup"
22107
+ };
22108
+ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22109
+ const isIndividual = currentLegalEntityType === LegalEntityType.INDIVIDUAL;
22110
+ const isOrganization = currentLegalEntityType === LegalEntityType.ORGANIZATION;
22111
+ if (isIndividual && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22112
+ return LegalEntityType.ORGANIZATION;
22113
+ }
22114
+ if (isOrganization && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22115
+ return LegalEntityType.INDIVIDUAL;
22116
+ }
22117
+ return currentLegalEntityType;
22118
+ };
22119
+ const BusinessTypeSelection = ({
22120
+ legalEntityResponse,
22121
+ accountHolder: accountHolder2,
22122
+ showTrustOption,
22123
+ showSolePropOption,
22124
+ onAccountHolderSelect,
22125
+ handleUpdateLegalEntity
22126
+ }) => {
22127
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
22128
+ const {
22129
+ i18n
22130
+ } = useI18nContext();
22131
+ const {
22132
+ showToast
22133
+ } = useToastContext();
22134
+ const [loadingStatus, setLoadingStatus] = useState();
22135
+ const [currentStep, setCurrentStep] = useState(
22136
+ 0
22137
+ /* BUSINESS_TYPE_SELECTION */
22138
+ );
22139
+ const [formSchema, setFormSchema] = useState(["businessType"]);
22140
+ const hasBackButton = [
22141
+ 1,
22142
+ 2
22143
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22144
+ ].includes(currentStep);
22145
+ const businessTypeItems = getBusinessTypes(showTrustOption, showSolePropOption);
22146
+ const getDefaultBusinessType = () => {
22147
+ if (accountHolder2) {
22148
+ if (["aTrust", "aPartnership", "anAssociation"].includes(accountHolder2)) {
22149
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "legalArrangement");
22150
+ }
22151
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22152
+ }
22153
+ switch (legalEntityResponse.type) {
22154
+ case LegalEntityType.ORGANIZATION:
22155
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "company");
22156
+ case LegalEntityType.INDIVIDUAL:
22157
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "individual");
22158
+ }
22159
+ };
22160
+ const getDefaultLegalArrangementType = () => accountHolder2 && legalArrangementItems.find((item) => item.accountHolder === accountHolder2);
22161
+ const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
22162
+ const {
22163
+ handleChangeFor,
22164
+ triggerValidation,
22165
+ data,
22166
+ valid,
22167
+ errors,
22168
+ isValid
22169
+ } = useForm({
22170
+ schema: formSchema,
22171
+ defaultData: {
22172
+ businessType: getDefaultBusinessType(),
22173
+ legalArrangement: getDefaultLegalArrangementType(),
22174
+ trusteeType: defaultTrusteeType
22175
+ },
22176
+ rules: businessTypeSelectionValidationRules
22177
+ });
22178
+ const newAccountHolder = ((_a = data.businessType) == null ? void 0 : _a.accountHolder) || ((_b = data.legalArrangement) == null ? void 0 : _b.accountHolder);
22179
+ 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);
22180
+ useEffect(() => {
22181
+ var _a2, _b2;
22182
+ setFormSchema(getFormSchema(((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement" && !!data.legalArrangement || currentStep === 1, ((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aTrust"));
22183
+ }, [data.businessType, data.legalArrangement, currentStep]);
22184
+ const handleNextClick = async () => {
22185
+ var _a2, _b2, _c2;
22186
+ if (loadingStatus === "loading")
22187
+ return;
22188
+ triggerValidation();
22189
+ if (isValid) {
22190
+ if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
22191
+ if (currentStep !== 1) {
22192
+ setCurrentStep(
22193
+ 1
22194
+ /* LEGAL_ARRANGEMENT_SELECTION */
22195
+ );
22196
+ return;
22197
+ }
22198
+ if (((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aPartnership" || ((_c2 = data.legalArrangement) == null ? void 0 : _c2.id) === "anAssociation") {
22199
+ setCurrentStep(
22200
+ 2
22201
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22202
+ );
22203
+ return;
22204
+ }
22205
+ }
22206
+ }
22207
+ if (newAccountHolder !== accountHolder2 || targetLegalEntityType !== legalEntityResponse.type) {
22208
+ if (accountHolder2) {
22209
+ setCurrentStep(
22210
+ 3
22211
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22212
+ );
22213
+ } else {
22214
+ await updateLegalEntityAndSelectAccountHolder();
22215
+ }
22216
+ } else {
22217
+ onAccountHolderSelect(newAccountHolder);
22218
+ }
22219
+ };
22220
+ const updateLegalEntityAndSelectAccountHolder = async () => {
22221
+ try {
22222
+ if (legalEntityResponse.type !== targetLegalEntityType) {
22223
+ setLoadingStatus("loading");
22224
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22225
+ type: targetLegalEntityType,
22226
+ entityAssociations: []
22227
+ }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22228
+ }
22229
+ } catch (e) {
22230
+ showToast({
22231
+ label: i18n.get("failedToUpdateDetails"),
22232
+ type: ToastType.ERROR
22233
+ });
22234
+ } finally {
22235
+ setLoadingStatus("success");
22236
+ onAccountHolderSelect(newAccountHolder);
22237
+ }
22238
+ };
22239
+ const handleBackClick = () => {
22240
+ if (currentStep === 2) {
22241
+ setCurrentStep(
22242
+ 1
22243
+ /* LEGAL_ARRANGEMENT_SELECTION */
22244
+ );
22245
+ }
22246
+ if (currentStep === 1) {
22247
+ setCurrentStep(
22248
+ 0
22249
+ /* BUSINESS_TYPE_SELECTION */
22250
+ );
22251
+ }
22252
+ };
22253
+ const isWeCannotSetUpAccountStep = currentStep === 2;
22254
+ return jsx(LoaderWrapper, {
22255
+ status: loadingStatus,
22256
+ formOpacityWhenLoading: 0.3,
22257
+ showSpinner: false,
22258
+ children: jsxs("div", {
22259
+ className: "adyen-kyc-business-type-selection",
22260
+ children: [jsx("header", {
22261
+ children: jsx(Heading, {
22262
+ level: 1,
22263
+ children: i18n.get(businessTypeSelectionStepTitles[currentStep])
22264
+ })
22265
+ }), currentStep === 0 && jsx(Field, {
22266
+ name: "businessType",
22267
+ useLabelElement: false,
22268
+ errorMessage: i18n.get((_f = errors.businessType) == null ? void 0 : _f.errorMessage),
22269
+ showErrorIconBottom: true,
22270
+ isValid: valid.businessType,
22271
+ children: (childProps) => jsx(RadioGroupCard, {
22272
+ ...childProps,
22273
+ name: "businessType",
22274
+ items: businessTypeItems,
22275
+ selected: businessTypeItems.find((type) => {
22276
+ var _a2;
22277
+ return type.id === ((_a2 = data.businessType) == null ? void 0 : _a2.id);
22278
+ }),
22279
+ onSelect: (item) => handleChangeFor("businessType")(item)
22280
+ })
22281
+ }), currentStep === 1 && jsxs(Fragment, {
22282
+ children: [jsx(Field, {
22283
+ name: "legalArrangement",
22284
+ useLabelElement: false,
22285
+ errorMessage: i18n.get((_g = errors.legalArrangement) == null ? void 0 : _g.errorMessage),
22286
+ showErrorIconBottom: true,
22287
+ isValid: valid.legalArrangement,
22288
+ children: (childProps) => jsx(RadioGroupCard, {
22289
+ ...childProps,
22290
+ name: "legalArrangement",
22291
+ items: legalArrangementItems,
22292
+ selected: legalArrangementItems.find((legalArrangementItem) => {
22293
+ var _a2;
22294
+ return legalArrangementItem.id === ((_a2 = data.legalArrangement) == null ? void 0 : _a2.id);
22295
+ }),
22296
+ onSelect: (item) => handleChangeFor("legalArrangement")(item)
22297
+ })
22298
+ }), ((_h = data.legalArrangement) == null ? void 0 : _h.id) === "aTrust" && jsx(Field, {
22299
+ name: "trusteeType",
22300
+ label: i18n.get("whatTypeOfTrusteeAreYou"),
22301
+ className: "adl-u-margin-top-32",
22302
+ useLabelElement: false,
22303
+ errorMessage: i18n.get((_i = errors.trusteeType) == null ? void 0 : _i.errorMessage),
22304
+ showErrorIconBottom: true,
22305
+ isValid: valid.trusteeType,
22306
+ children: (childProps) => jsx(RadioGroupCard, {
22307
+ className: "adyen-kyc-trustee-type-radio-group-card",
22308
+ itemLabelClassName: () => "adl-u-width-full",
22309
+ ...childProps,
22310
+ name: "trusteeType",
22311
+ items: trusteeTypeItems,
22312
+ selected: trusteeTypeItems.find((type) => {
22313
+ var _a2;
22314
+ return type.id === ((_a2 = data.trusteeType) == null ? void 0 : _a2.id);
22315
+ }),
22316
+ onSelect: (item) => handleChangeFor("trusteeType")(item)
22317
+ })
22318
+ })]
22319
+ }), isWeCannotSetUpAccountStep && jsxs(Fragment, {
22320
+ children: [jsx("p", {
22321
+ children: i18n.get("ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations")
22322
+ }), jsx("p", {
22323
+ className: "u-margin-top-32",
22324
+ children: i18n.get("needHelpYouCanAlwaysReachOutToCustomerSupport")
22325
+ })]
22326
+ }), currentStep === 3 ? jsxs(Fragment, {
22327
+ children: [jsx("p", {
22328
+ children: i18n.get("someInformationWillNotBeSaved")
22329
+ }), jsxs("div", {
22330
+ className: "adyen-kyc-business-type-selection__confirm",
22331
+ children: [jsx(Button, {
22332
+ label: i18n.get("cancel"),
22333
+ secondary: true,
22334
+ onClick: () => setCurrentStep(
22335
+ 0
22336
+ /* BUSINESS_TYPE_SELECTION */
22337
+ ),
22338
+ type: "button"
22339
+ }), jsx(Button, {
22340
+ label: i18n.get("yesChange"),
22341
+ onClick: () => updateLegalEntityAndSelectAccountHolder(),
22342
+ type: "button"
22343
+ })]
22344
+ })]
22345
+ }) : jsxs("div", {
22346
+ className: "adyen-kyc-business-type-selection__nav",
22347
+ children: [!isWeCannotSetUpAccountStep && jsx(Button, {
22348
+ label: i18n.get("next"),
22349
+ block: true,
22350
+ disabled: currentStep === 1 && !data.legalArrangement,
22351
+ onClick: handleNextClick,
22352
+ type: "button"
22353
+ }), hasBackButton && jsx(Button, {
22354
+ label: i18n.get("back"),
22355
+ showAsLink: !isWeCannotSetUpAccountStep,
22356
+ block: isWeCannotSetUpAccountStep,
22357
+ onClick: handleBackClick,
22358
+ type: "button",
22359
+ className: "adl-u-margin-top-16"
22360
+ })]
22361
+ })]
22362
+ })
22363
+ });
22364
+ };
22365
+ const DecisionMakers = "";
22366
+ function useDataMissingRemediations({
22367
+ legalEntityId,
22368
+ problems
22369
+ }) {
22370
+ const {
22371
+ i18n
22372
+ } = useI18nContext();
22373
+ const decisionMakersRemediationMessage = useMemo(() => {
22374
+ var _a, _b;
22375
+ const remediationCodes = (_b = (_a = problems[EntityType.LEGAL_ENTITY]) == null ? void 0 : _a[legalEntityId]) == null ? void 0 : _b.missingData.reduce((remediations, error) => {
22376
+ const remediation = DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING[error.code];
22377
+ return remediation ? [...remediations, remediation] : remediations;
22378
+ }, []);
22379
+ switch (remediationCodes == null ? void 0 : remediationCodes.length) {
22380
+ case void 0:
22381
+ case 0:
22382
+ return void 0;
22383
+ case 1:
22384
+ return remediationCodes[0] ? i18n.get(`remediationMessage_${remediationCodes[0]}`) : i18n.get("missingMultipleDecisionMakers");
22385
+ default:
22386
+ return i18n.get("missingMultipleDecisionMakers");
22387
+ }
22388
+ }, [problems, i18n, legalEntityId]);
22389
+ return {
22390
+ remediationMessages: {
22391
+ [TaskTypes.DECISION_MAKER]: decisionMakersRemediationMessage
22392
+ }
22393
+ };
22394
+ }
22395
+ const iconStatus = (current, min, max) => {
22396
+ const isEmpty2 = current === 0;
22397
+ const isWithinObligatoryRange = current === max || min > 0 && current >= min;
22398
+ const isWithinConditionalRange = current >= min;
22399
+ if (isEmpty2) {
22400
+ return min > 0 ? "obligatoryEmpty" : "conditionalEmpty";
22401
+ }
22402
+ if (isWithinObligatoryRange) {
22403
+ return "obligatoryFinished";
22404
+ }
22405
+ return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22406
+ };
22407
+ const entityStatusRoles = {
22408
+ ...decisionMakerRoles,
22409
+ ...trustMemberGuidanceRoles
22410
+ };
22411
+ const getEntityStatusTagColor = (entityLabel) => {
22412
+ var _a;
22413
+ return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22414
+ };
22415
+ const getEntityStatusName = (entityLabel) => {
22416
+ var _a;
22417
+ return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22418
+ };
22419
+ const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22420
+ const _cardGroup_component = "";
22421
+ function CardGroup({
22422
+ className,
22423
+ children
22424
+ }) {
22425
+ return jsx("section", {
22426
+ className: cx("adl-card-group", className),
22427
+ children
22428
+ });
22429
+ }
22430
+ const _entityAssociation_component = "";
22431
+ const Status$1 = "";
22432
+ const Status = ({
22433
+ text,
22434
+ className,
22435
+ iconStatusClass,
22436
+ icon
22437
+ }) => {
22438
+ const containerClasses = cx("adl-status", className);
22439
+ const iconClasses = cx("adl-status__icon", iconStatusClass);
22440
+ return jsxs("div", {
22441
+ className: containerClasses,
22442
+ children: [jsx("span", {
22443
+ className: iconClasses,
22444
+ children: icon === "loading" ? jsx(Loader, {
22445
+ size: "xsmall",
22446
+ dot: true
22447
+ }) : jsx(Icon, {
22448
+ name: icon
22449
+ })
22450
+ }), jsx("span", {
22451
+ className: "adl-status__text",
22452
+ children: text
22453
+ })]
22454
+ });
22455
+ };
22456
+ const TaskItemStatus = ({
22457
+ status,
22458
+ downloadHandler
22459
+ }) => {
22460
+ const {
22461
+ i18n
22462
+ } = useI18nContext();
22463
+ const handleDownloadClick = (e) => {
22464
+ e.stopPropagation();
22465
+ downloadHandler == null ? void 0 : downloadHandler();
22466
+ };
22467
+ switch (status) {
22468
+ case TaskStatus.DOWNLOAD:
22469
+ return jsxs("span", {
22470
+ className: "adl-status--download",
22471
+ role: "button",
22472
+ tabIndex: 0,
22473
+ icon: "download",
22474
+ onClick: handleDownloadClick,
22475
+ children: [i18n.get("download"), " "]
22476
+ });
22477
+ case TaskStatus.FINISHED:
22478
+ return jsx(Status, {
22479
+ className: "adl-status--finished",
22480
+ iconStatusClass: "adl-status__icon--finished",
22481
+ icon: "check",
22482
+ text: i18n.get("verified")
22483
+ });
22484
+ case TaskStatus.SIGNED:
22485
+ return jsx(Status, {
22486
+ className: "adl-status--finished",
22487
+ iconStatusClass: "adl-status__icon--finished",
22488
+ icon: "check",
22489
+ text: i18n.get("signed")
22490
+ });
22491
+ case TaskStatus.ERROR:
22492
+ return jsx(Status, {
22493
+ className: "adl-status--error",
22494
+ iconStatusClass: "adl-status__icon--error",
22495
+ icon: "info-circle",
22496
+ text: i18n.get("unsuccessful")
22497
+ });
22498
+ case TaskStatus.PROCESSING:
22499
+ return jsx(Status, {
22500
+ className: "",
22501
+ iconStatusClass: "",
22502
+ icon: "loading",
22503
+ text: i18n.get("inReview")
22504
+ });
22505
+ case TaskStatus.SIGN:
22506
+ return jsx("span", {
22507
+ className: "adl-task-status-sign",
22508
+ children: i18n.get("sign")
22509
+ });
22510
+ case TaskStatus.SUBMIT:
22511
+ return jsx("span", {
22512
+ className: "adl-task-status-submit",
22513
+ children: i18n.get("submit")
22514
+ });
22515
+ case TaskStatus.REMOVING:
22516
+ return jsx(Status, {
22517
+ className: "",
22518
+ iconStatusClass: "",
22519
+ icon: "loading",
22520
+ text: i18n.get("removing")
22521
+ });
22522
+ case "review":
22523
+ return jsx("span", {
22524
+ className: "adl-task-status-details-required",
22525
+ children: i18n.get("verify")
22526
+ });
22527
+ case TaskStatus.DETAILS_REQUIRED:
22528
+ case TaskStatus.EMPTY:
22529
+ default:
22530
+ return jsx("span", {
22531
+ className: "adl-task-status-details-required",
22532
+ children: i18n.get("add")
22533
+ });
22534
+ }
22535
+ };
22536
+ const VerificationErrorAlert = ({
22537
+ className,
22538
+ problems
22539
+ }) => {
22540
+ const {
22541
+ i18n
22542
+ } = useI18nContext();
22543
+ if ((problems == null ? void 0 : problems.verificationErrors) && Object.keys(problems.verificationErrors).length > 0) {
22544
+ const childErrors = Object.values(problems.verificationErrors).reduce((acc, parentChildErrors) => {
22545
+ acc = {
22546
+ ...acc,
22547
+ ...parentChildErrors
22548
+ };
22549
+ return acc;
22550
+ }, {});
22551
+ const childErrorCodes = Object.keys(childErrors);
22552
+ if (childErrorCodes.length === 1) {
22553
+ const remediationActions = Object.values(childErrors[childErrorCodes[0]]).flat();
22554
+ if (remediationActions.length === 1) {
22555
+ const childErrorMsg = i18n.get(`errorMessage_${childErrorCodes[0]}`);
22556
+ const remediationActionMsg = i18n.get(`remediationMessage_${remediationActions[0].code}`);
22557
+ return jsx(Alert, {
22558
+ className,
22559
+ hasCloseButton: false,
22560
+ type: AlertTypes.ERROR,
22561
+ title: `${childErrorMsg}. ${remediationActionMsg}`
22562
+ });
22563
+ }
22564
+ }
22565
+ }
22566
+ return jsx(Alert, {
22567
+ className,
22568
+ hasCloseButton: false,
22569
+ type: AlertTypes.ERROR,
22570
+ title: i18n.get("verificationErrorMessage")
22571
+ });
22572
+ };
22573
+ const _card_component = "";
22574
+ function Card({
22575
+ className,
22576
+ children,
22577
+ stateful,
22578
+ active,
22579
+ disabled,
22580
+ title,
22581
+ subTitle,
22582
+ onClick,
22583
+ onKeyDown
22584
+ }) {
22585
+ const classNames = cx("adl-card", className, {
22586
+ "adl-card--stateful": stateful,
22587
+ "adl-card--active": stateful && active,
22588
+ "adl-card--disabled": disabled
22589
+ });
22037
22590
  const tabIndex = stateful ? 0 : void 0;
22038
22591
  const role2 = stateful ? "button" : void 0;
22039
22592
  const onClickHandler = (e) => {
@@ -22386,6 +22939,12 @@ const DecisionMakersComponent = ({
22386
22939
  const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
22387
22940
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
22388
22941
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
22942
+ const {
22943
+ remediationMessages
22944
+ } = useDataMissingRemediations({
22945
+ legalEntityId: legalEntityResponse.id,
22946
+ problems: capabilityProblems
22947
+ });
22389
22948
  const mappedDecisionMakers = decisionMakers2 == null ? void 0 : decisionMakers2.reduce((mappedDecisionMakers2, decisionMaker2) => {
22390
22949
  var _a2;
22391
22950
  const mappedDecisionMaker = mappedDecisionMakers2[decisionMaker2.legalEntityId];
@@ -22504,7 +23063,12 @@ const DecisionMakersComponent = ({
22504
23063
  isRemoveDisabled,
22505
23064
  handleIsRemoveDisabled: setIsRemoveDisabled
22506
23065
  }, decisionMaker2.reference))
22507
- }) : null, jsx(Button, {
23066
+ }) : null, remediationMessages.DECISION_MAKER && jsx(Alert, {
23067
+ className: "adl-decision-makers__warning",
23068
+ title: remediationMessages.DECISION_MAKER,
23069
+ hasCloseButton: false,
23070
+ type: AlertTypes.WARNING
23071
+ }), jsx(Button, {
22508
23072
  secondary: true,
22509
23073
  className: cx("adl-decision-makers__add", {
22510
23074
  "adl-decision-makers__add--more": (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0
@@ -22830,6 +23394,45 @@ const TaskIntros = ({
22830
23394
  }) : null;
22831
23395
  };
22832
23396
  const TaskList = "";
23397
+ const businessTypeMapping = {
23398
+ myName: {
23399
+ [LegalEntityType.INDIVIDUAL]: "individual"
23400
+ /* INDIVIDUAL */
23401
+ },
23402
+ theCompanyIWorkFor: {
23403
+ [LegalEntityType.ORGANIZATION]: "company"
23404
+ /* COMPANY */
23405
+ },
23406
+ mySoleProprietorName: {
23407
+ [LegalEntityType.INDIVIDUAL]: "soleProprietorship"
23408
+ /* SOLE_PROPRIETORSHIP */
23409
+ },
23410
+ aTrust: {
23411
+ [LegalEntityType.INDIVIDUAL]: "individualTrustee",
23412
+ [LegalEntityType.ORGANIZATION]: "companyTrustee"
23413
+ /* COMPANY_TRUSTEE */
23414
+ }
23415
+ };
23416
+ const useBusinessSetup = (legalEntityResponse) => {
23417
+ var _a;
23418
+ const {
23419
+ accountHolder: accountHolder2
23420
+ } = useCoreContext();
23421
+ const accountHolderType = accountHolder2 || getDefaultAccountHolderType(legalEntityResponse);
23422
+ const businessSetup = (_a = businessTypeMapping[accountHolderType]) == null ? void 0 : _a[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23423
+ return {
23424
+ businessSetup
23425
+ };
23426
+ };
23427
+ const useEnableNewEntryFlow = () => {
23428
+ const {
23429
+ isSettingEnabled
23430
+ } = useSettingsContext();
23431
+ const {
23432
+ isExperimentEnabled
23433
+ } = useExperimentsContext();
23434
+ return isSettingEnabled(SettingNames.AllowLegalEntityTypeChange) && isExperimentEnabled("EnableNewEntryFlow");
23435
+ };
22833
23436
  const hasPayoutAccount = (legalEntityResponse) => {
22834
23437
  var _a;
22835
23438
  return Boolean((_a = legalEntityResponse.transferInstruments) == null ? void 0 : _a.length);
@@ -22847,6 +23450,7 @@ const TaskListItem = ({
22847
23450
  info,
22848
23451
  loading: loading2 = false,
22849
23452
  showErrorAlerts = "onErrorStatus",
23453
+ showWarningAlert = false,
22850
23454
  removeEntity,
22851
23455
  isRemoveDisabled = false,
22852
23456
  handleIsRemoveDisabled
@@ -22857,7 +23461,9 @@ const TaskListItem = ({
22857
23461
  stateful: onNavigateToTask && !loading2 && !disabled,
22858
23462
  onClick: loading2 ? void 0 : onNavigateToTask,
22859
23463
  onKeyDown: handleKeys(["Enter"], onNavigateToTask ?? noop),
22860
- className: "adyen-task",
23464
+ className: cx("adyen-task", {
23465
+ "adyen-task--warning": showWarningAlert
23466
+ }),
22861
23467
  disabled,
22862
23468
  children: jsxs(LoaderWrapper, {
22863
23469
  status: loading2 ? "loading" : "success",
@@ -22928,6 +23534,9 @@ const PayoutAccountTaskListItem = ({
22928
23534
  const {
22929
23535
  i18n
22930
23536
  } = useI18nContext();
23537
+ const {
23538
+ isExperimentEnabled
23539
+ } = useExperimentsContext();
22931
23540
  const [isDeletingTransferInstrument, setIsDeletingTransferInstrument] = useState(false);
22932
23541
  const isInstantVerificationAccount = isInstantVerifiedAccount(account);
22933
23542
  const [isRemoveDisabled, setIsRemoveDisabled] = useState(false);
@@ -22938,7 +23547,7 @@ const PayoutAccountTaskListItem = ({
22938
23547
  onNavigateToTask: isInstantVerificationAccount ? void 0 : onNavigateToTask,
22939
23548
  icon: "payout",
22940
23549
  title: maskedAccountNumber,
22941
- tagline: i18n.get("payoutDetails"),
23550
+ tagline: isExperimentEnabled("EnableNewEntryFlow") ? void 0 : i18n.get("payoutDetails"),
22942
23551
  status,
22943
23552
  problems: (_a = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _a[account.id],
22944
23553
  loading: isDeletingTransferInstrument,
@@ -22991,12 +23600,22 @@ function TaskListComponent({
22991
23600
  const {
22992
23601
  i18n
22993
23602
  } = useI18nContext();
23603
+ const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
22994
23604
  const {
22995
23605
  isExperimentEnabled
22996
23606
  } = useExperimentsContext();
22997
23607
  const {
22998
23608
  canSeeIntro
22999
23609
  } = useCanSeeIntro(legalEntityResponse);
23610
+ const {
23611
+ remediationMessages
23612
+ } = useDataMissingRemediations({
23613
+ legalEntityId: legalEntityResponse.id,
23614
+ problems: capabilityProblems
23615
+ });
23616
+ const {
23617
+ businessSetup
23618
+ } = useBusinessSetup(legalEntityResponse);
23000
23619
  const hasTaskOfGroupAccountDetails = tasks.some((task) => LEGAL_ENTITY_BASE_TASKS.includes(task));
23001
23620
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
23002
23621
  const hasContractTasks = tasks.some((task) => CONTRACT_TASKS.includes(task));
@@ -23036,9 +23655,33 @@ function TaskListComponent({
23036
23655
  showAsLink: true,
23037
23656
  type: "button"
23038
23657
  })
23658
+ }), isEnableNewEntryFlowEnabled && jsxs("header", {
23659
+ className: "adyen-task-list__heading",
23660
+ children: [jsx(Heading, {
23661
+ level: 1,
23662
+ children: i18n.get("setUpYourAccount")
23663
+ }), jsxs(Heading, {
23664
+ level: "sub",
23665
+ children: [jsx("span", {
23666
+ className: "adl-u-font-weight-semi-bold",
23667
+ children: i18n.get("yourBusinessSetup", {
23668
+ values: {
23669
+ businessSetup: i18n.get(businessSetup)
23670
+ }
23671
+ })
23672
+ }), jsx(Button, {
23673
+ title: i18n.get("edit"),
23674
+ icon: "edit",
23675
+ ghost: true,
23676
+ circle: true,
23677
+ onClick: () => onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION),
23678
+ className: "adl-u-margin-left-4",
23679
+ type: "button"
23680
+ })]
23681
+ })]
23039
23682
  }), jsxs("div", {
23040
23683
  children: [hasTaskOfGroupAccountDetails && jsxs(TaskListGroup, {
23041
- title: isCompany ? i18n.get(companyTaskDescriptionKey) : i18n.get("accountDetailsDescription"),
23684
+ title: isCompany ? i18n.get(companyTaskDescriptionKey) : i18n.get(isEnableNewEntryFlowEnabled ? "provideFewDetailsAboutYourself" : "accountDetailsDescription"),
23042
23685
  children: [tasks.includes(TaskTypes.INDIVIDUAL) && jsx(TaskListItem, {
23043
23686
  onNavigateToTask: handleOnNavigateToTaskIndividual,
23044
23687
  icon: "decision-maker",
@@ -23048,7 +23691,7 @@ function TaskListComponent({
23048
23691
  }), hasSoleProprietorship && jsx(TaskListItem, {
23049
23692
  onNavigateToTask: handleOnNavigateToSoleProp,
23050
23693
  icon: "company",
23051
- title: i18n.get("soleProprietorDetails"),
23694
+ title: i18n.get(isEnableNewEntryFlowEnabled ? "soleProprietorshipDetails" : "soleProprietorDetails"),
23052
23695
  status: getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnSoleProprietorshipIdArray(legalEntityResponse)),
23053
23696
  problems: getOwnSolePropProblems(legalEntityResponse, capabilityProblems)
23054
23697
  }), tasks.includes(TaskTypes.COMPANY) && jsx(TaskListItem, {
@@ -23057,11 +23700,19 @@ function TaskListComponent({
23057
23700
  title: hasTrust ? i18n.get("companyTrusteeDetails") : i18n.get("companyDetails"),
23058
23701
  status: getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, [legalEntityResponse.id]),
23059
23702
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _f[legalEntityResponse.id]
23060
- }), tasks.includes(TaskTypes.DECISION_MAKER) && jsx(TaskListItem, {
23061
- onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
23062
- icon: "decision-maker",
23063
- title: i18n.get("decisionMakers"),
23064
- status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnDecisionMakersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
23703
+ }), tasks.includes(TaskTypes.DECISION_MAKER) && jsxs(Fragment, {
23704
+ children: [jsx(TaskListItem, {
23705
+ onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
23706
+ icon: "decision-maker",
23707
+ title: i18n.get("decisionMakers"),
23708
+ status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnDecisionMakersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED,
23709
+ showWarningAlert: Boolean(remediationMessages.DECISION_MAKER)
23710
+ }), remediationMessages.DECISION_MAKER && jsx(Alert, {
23711
+ className: "adyen-task-list__warning",
23712
+ title: remediationMessages.DECISION_MAKER,
23713
+ hasCloseButton: false,
23714
+ type: AlertTypes.WARNING
23715
+ })]
23065
23716
  })]
23066
23717
  }), hasTrust && jsxs(TaskListGroup, {
23067
23718
  title: i18n.get("trustDetailsDescription"),
@@ -23078,7 +23729,7 @@ function TaskListComponent({
23078
23729
  status: hasMinRequiredTrustMemberCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
23079
23730
  })]
23080
23731
  }), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && jsx(TaskListGroup, {
23081
- title: i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
23732
+ title: isEnableNewEntryFlowEnabled ? i18n.get("letUsKnowTheBankAccountToSendReceiveFunds") : i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
23082
23733
  children: transferInstruments.length > 0 ? jsxs(Fragment, {
23083
23734
  children: [transferInstruments.map((transferInstrument) => jsx(PayoutAccountTaskListItem, {
23084
23735
  account: transferInstrument,
@@ -23095,13 +23746,13 @@ function TaskListComponent({
23095
23746
  name: "plus",
23096
23747
  className: "adl-u-padding-top-2 adl-u-margin-right-8"
23097
23748
  }), jsx("span", {
23098
- children: i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
23749
+ children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
23099
23750
  })]
23100
23751
  })]
23101
23752
  }) : jsx(TaskListItem, {
23102
23753
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
23103
23754
  icon: "payout",
23104
- title: i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
23755
+ title: isEnableNewEntryFlowEnabled ? i18n.get("bankAccountDetails") : i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
23105
23756
  status: hasPayoutAccount(legalEntityResponse) ? getTaskStatus(EntityType.BANK_ACCOUNT, capabilityProblems, legalEntityResponse, [(_h = (_g = legalEntityResponse == null ? void 0 : legalEntityResponse.transferInstruments) == null ? void 0 : _g[0]) == null ? void 0 : _h.id]) : TaskStatus.DETAILS_REQUIRED,
23106
23757
  disabled: !canAddPayoutAccount,
23107
23758
  problems: (_k = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _k[(_j = (_i = legalEntityResponse == null ? void 0 : legalEntityResponse.transferInstruments) == null ? void 0 : _i[0]) == null ? void 0 : _j.id]
@@ -23446,84 +24097,6 @@ const omitMaskedFieldsIfUnchanged = (maskedFields, dataSubmitted, savedData) =>
23446
24097
  });
23447
24098
  return filtered;
23448
24099
  };
23449
- const _toast = "";
23450
- function Toast({
23451
- label,
23452
- subLabel,
23453
- actionLabel,
23454
- type,
23455
- duration = 3500,
23456
- onToastHide,
23457
- onToastAction
23458
- }) {
23459
- const toastRef = useRef(null);
23460
- const loading2 = type === ToastType.LOADING;
23461
- const successToast = type === ToastType.SUCCESS;
23462
- const labelId = getUniqueId("toast");
23463
- const handleShow = useCallback(() => {
23464
- var _a;
23465
- return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
23466
- }, []);
23467
- const handleHide = useCallback(() => {
23468
- var _a;
23469
- (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
23470
- onToastHide();
23471
- }, [onToastHide]);
23472
- useEffect(() => {
23473
- handleShow();
23474
- if (duration !== "indefinite") {
23475
- setTimeout(() => handleHide(), duration);
23476
- }
23477
- }, [label, duration, handleHide, handleShow]);
23478
- return jsxs("div", {
23479
- ref: toastRef,
23480
- role: actionLabel ? "alertdialog" : "alert",
23481
- className: "adl-toast",
23482
- "aria-labelledby": labelId,
23483
- children: [loading2 && jsx("div", {
23484
- className: "adl-toast__loader",
23485
- children: jsx("div", {
23486
- className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
23487
- })
23488
- }), !loading2 && jsxs("div", {
23489
- className: cx("adl-toast__status", {
23490
- "adl-toast__status--success": successToast,
23491
- "adl-toast__status--error": !successToast
23492
- }),
23493
- children: [successToast && jsx(Icon, {
23494
- className: "adl-toast__status-icon",
23495
- name: "checkmark"
23496
- }), !successToast && jsx(Icon, {
23497
- className: "adl-toast__status-icon",
23498
- name: "cross"
23499
- })]
23500
- }), jsxs("div", {
23501
- className: "adl-toast__message",
23502
- children: [jsx("span", {
23503
- id: labelId,
23504
- className: "adl-toast__title",
23505
- children: label
23506
- }), actionLabel && jsx("button", {
23507
- className: "adl-link adl-toast__action",
23508
- title: "performAction",
23509
- type: "button",
23510
- onClick: onToastAction,
23511
- children: actionLabel
23512
- }), !loading2 && subLabel && jsx("span", {
23513
- className: "adl-toast__subtitle",
23514
- children: subLabel
23515
- })]
23516
- }), !loading2 && jsx("button", {
23517
- className: "adl-toast__close",
23518
- title: "close",
23519
- type: "button",
23520
- onClick: handleHide,
23521
- children: jsx(Icon, {
23522
- name: "cross"
23523
- })
23524
- })]
23525
- });
23526
- }
23527
24100
  const parseConfiguration$1 = ({
23528
24101
  country: country2,
23529
24102
  matchingScenario
@@ -23536,7 +24109,7 @@ function IndividualDropinComponent({
23536
24109
  handleFindAddress,
23537
24110
  handleGetIdVerificationToken,
23538
24111
  handleGetIdVerificationStartCheck,
23539
- taskType,
24112
+ taskType = TaskTypes.INDIVIDUAL,
23540
24113
  trackingConfig,
23541
24114
  parentLegalEntity,
23542
24115
  legalEntityResponse,
@@ -23637,7 +24210,7 @@ function IndividualDropinComponent({
23637
24210
  if (parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) {
23638
24211
  const associations = (_b = parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) == null ? void 0 : _b.filter((ea) => ea.legalEntityId === (legalEntityResponse == null ? void 0 : legalEntityResponse.id));
23639
24212
  if (associations && associations.length > 0) {
23640
- const jobTitle2 = (_c = associations.find((association) => Boolean(association.jobTitle))) == null ? void 0 : _c.jobTitle;
24213
+ const jobTitle2 = (_c = associations.find((association2) => Boolean(association2.jobTitle))) == null ? void 0 : _c.jobTitle;
23641
24214
  dataFromResponse = {
23642
24215
  ...dataFromResponse,
23643
24216
  personalDetails: {
@@ -24129,6 +24702,9 @@ function PayoutDetailsDropinComponent({
24129
24702
  i18n,
24130
24703
  setLocale
24131
24704
  } = useI18nContext();
24705
+ const {
24706
+ isExperimentEnabled
24707
+ } = useExperimentsContext();
24132
24708
  const {
24133
24709
  showToast,
24134
24710
  clearToasts
@@ -24224,7 +24800,7 @@ function PayoutDetailsDropinComponent({
24224
24800
  country: (_b2 = prefilledData == null ? void 0 : prefilledData.payoutVerificationMethod) == null ? void 0 : _b2.bankCountry,
24225
24801
  bankVerificationVendors,
24226
24802
  verificationVendorsCallback: handleGetBankVerificationVendors
24227
- }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout));
24803
+ }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
24228
24804
  }, [bankVerificationVendors]);
24229
24805
  const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, payoutDetailsSteps, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], [], fieldsFromCustomRules, fieldsFormCustomLabels), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
24230
24806
  const {
@@ -24428,7 +25004,7 @@ function PayoutDetailsDropinComponent({
24428
25004
  onSkipSubmit: navigateBackToTaskList
24429
25005
  });
24430
25006
  return jsx(FormWrapper, {
24431
- taskName: taskName ?? "payoutDetails",
25007
+ taskName: taskName ?? isExperimentEnabled("EnableNewEntryFlow") ? "bankAccountDetails" : "payoutDetails",
24432
25008
  activeForm,
24433
25009
  summary: {
24434
25010
  data: formatDataForSummary(),
@@ -26511,6 +27087,9 @@ function SolePropDropinComponent({
26511
27087
  i18n,
26512
27088
  setLocale
26513
27089
  } = useI18nContext();
27090
+ const {
27091
+ isExperimentEnabled
27092
+ } = useExperimentsContext();
26514
27093
  const [problems, setProblems] = useState(problemsProp);
26515
27094
  const datasetUtils = datasetUtilities(i18n.locale);
26516
27095
  const getOmittedKeys = () => ["operationalAddressIsSame"];
@@ -26700,6 +27279,7 @@ function SolePropDropinComponent({
26700
27279
  eventEmitter,
26701
27280
  hideDropinLayout,
26702
27281
  legalEntityType: LegalEntityType.TRUST,
27282
+ taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
26703
27283
  legalEntityResponse,
26704
27284
  summary: {
26705
27285
  formatData: formatDataForSummary,
@@ -26839,7 +27419,7 @@ function TrustDropinComponent(props) {
26839
27419
  }
26840
27420
  };
26841
27421
  const isDocumentsRequired2 = (forms) => forms.some((form) => [trustForms.trustConstitutionalDocument.formId].includes(form.formId));
26842
- const attachTrustToParentLegalEntity = async (trust) => {
27422
+ const attachTrustToParentLegalEntity = async (trust2) => {
26843
27423
  if (legalEntityResponse == null ? void 0 : legalEntityResponse.id) {
26844
27424
  return;
26845
27425
  }
@@ -26847,7 +27427,7 @@ function TrustDropinComponent(props) {
26847
27427
  const updatedParentLegalEntity = {
26848
27428
  entityAssociations: [{
26849
27429
  type: LegalEntityType.TRUST,
26850
- legalEntityId: trust.id
27430
+ legalEntityId: trust2.id
26851
27431
  }, ...existingEntityAssociations]
26852
27432
  };
26853
27433
  await props.handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
@@ -26947,7 +27527,8 @@ function DropinComposerComponent({
26947
27527
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
26948
27528
  const {
26949
27529
  contextCountry,
26950
- accountHolder: accountHolder2
27530
+ accountHolder: accountHolder2,
27531
+ setAccountHolder
26951
27532
  } = useCoreContext();
26952
27533
  const {
26953
27534
  i18n,
@@ -26964,20 +27545,28 @@ function DropinComposerComponent({
26964
27545
  } = useToastContext();
26965
27546
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
26966
27547
  const [pollingId, setPollingId] = useState(null);
27548
+ const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
26967
27549
  const showIntro = useShouldShowIntro(legalEntityResponse);
26968
27550
  const {
26969
27551
  setHasSeenIntro
26970
27552
  } = useHasSeenIntro(legalEntityResponse.id);
26971
27553
  const [tasks, setTasks] = useState([]);
26972
- const [taskHistory, setTaskHistory] = useState([showIntro ? TaskTypes.INTRO : TaskTypes.TASKS_OVERVIEW]);
27554
+ const initialTask = useMemo(() => {
27555
+ if (showBusinessTypeSelection)
27556
+ return TaskTypes.BUSINESS_TYPE_SELECTION;
27557
+ if (showIntro)
27558
+ return TaskTypes.INTRO;
27559
+ return TaskTypes.TASKS_OVERVIEW;
27560
+ }, [showBusinessTypeSelection, showIntro]);
27561
+ const [taskHistory, setTaskHistory] = useState([initialTask]);
26973
27562
  const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
26974
27563
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
26975
27564
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
26976
27565
  const [legalEntityType, setLegalEntityType] = useState(null);
26977
27566
  const [solePropietor, setSolePropietor] = useState(null);
26978
- const [trust, setTrust] = useState(null);
27567
+ const [trust2, setTrust] = useState(null);
26979
27568
  const exemptSettlor = useExemptSettlor({
26980
- trust,
27569
+ trust: trust2,
26981
27570
  handleGetLegalEntity: args.handleGetLegalEntity
26982
27571
  });
26983
27572
  const [trustMember, setTrustMember] = useState(null);
@@ -26992,7 +27581,7 @@ function DropinComposerComponent({
26992
27581
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
26993
27582
  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);
26994
27583
  const additionalSalesChannels = useSalesChannelsSettings();
26995
- const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("OrganizationSettlorWithExemptionReason"), trust == null ? void 0 : trust.trust.countryOfGoverningLaw);
27584
+ const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
26996
27585
  const getLegalEntityProblems = (le) => {
26997
27586
  var _a2;
26998
27587
  if (le == null ? void 0 : le.id) {
@@ -27103,9 +27692,9 @@ function DropinComposerComponent({
27103
27692
  return void 0;
27104
27693
  };
27105
27694
  const refreshTrust = async () => {
27106
- if (trust.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
27695
+ if (trust2.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
27107
27696
  try {
27108
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(trust.id));
27697
+ const response = await (args == null ? void 0 : args.handleGetLegalEntity(trust2.id));
27109
27698
  setTrust(response);
27110
27699
  return response;
27111
27700
  } catch (e) {
@@ -27139,14 +27728,14 @@ function DropinComposerComponent({
27139
27728
  case "company":
27140
27729
  await deleteAssociatedTrustMember({
27141
27730
  associatedTrustMember: trustMember2,
27142
- trust,
27731
+ trust: trust2,
27143
27732
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27144
27733
  });
27145
27734
  break;
27146
27735
  case "undefinedBeneficiary":
27147
27736
  await deleteUndefinedBeneficiary({
27148
27737
  undefinedBeneficiary: trustMember2,
27149
- trust,
27738
+ trust: trust2,
27150
27739
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27151
27740
  });
27152
27741
  break;
@@ -27168,7 +27757,7 @@ function DropinComposerComponent({
27168
27757
  };
27169
27758
  const addOrUpdateTrustMember = async (updated, existing) => {
27170
27759
  if ((existing == null ? void 0 : existing.trustMemberType) === "undefinedBeneficiary" && updated.trustMemberType === "undefinedBeneficiary" && existing.description === updated.description) {
27171
- await refreshTrustAndRunOnSubmit(trust, 1);
27760
+ await refreshTrustAndRunOnSubmit(trust2, 1);
27172
27761
  return;
27173
27762
  }
27174
27763
  try {
@@ -27176,7 +27765,7 @@ function DropinComposerComponent({
27176
27765
  case "undefinedBeneficiary":
27177
27766
  await addOrUpdateUndefinedBeneficiary({
27178
27767
  newOrUpdated: updated,
27179
- trust,
27768
+ trust: trust2,
27180
27769
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27181
27770
  });
27182
27771
  break;
@@ -27187,7 +27776,7 @@ function DropinComposerComponent({
27187
27776
  handleCreateLegalEntity: args.handleCreateLegalEntity
27188
27777
  }) : await createExemptSettlor({
27189
27778
  exemptSettlor: updated,
27190
- trust,
27779
+ trust: trust2,
27191
27780
  handleCreateLegalEntity: args.handleCreateLegalEntity
27192
27781
  });
27193
27782
  updated.legalEntityId = newSettlorLE.id;
@@ -27206,7 +27795,7 @@ function DropinComposerComponent({
27206
27795
  }
27207
27796
  await addOrUpdateAssociatedTrustMember({
27208
27797
  newOrUpdated: updated,
27209
- trust,
27798
+ trust: trust2,
27210
27799
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27211
27800
  });
27212
27801
  break;
@@ -27214,7 +27803,7 @@ function DropinComposerComponent({
27214
27803
  case "company":
27215
27804
  await addOrUpdateAssociatedTrustMember({
27216
27805
  newOrUpdated: updated,
27217
- trust,
27806
+ trust: trust2,
27218
27807
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27219
27808
  });
27220
27809
  break;
@@ -27226,7 +27815,7 @@ function DropinComposerComponent({
27226
27815
  label: i18n.get("successfullyUpdatedDetails"),
27227
27816
  type: ToastType.SUCCESS
27228
27817
  });
27229
- await refreshTrustAndRunOnSubmit(trust, 1);
27818
+ await refreshTrustAndRunOnSubmit(trust2, 1);
27230
27819
  } catch (err) {
27231
27820
  logger$5.error(err);
27232
27821
  showToast({
@@ -27297,7 +27886,7 @@ function DropinComposerComponent({
27297
27886
  };
27298
27887
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
27299
27888
  var _a2, _b2;
27300
- const trustId = (_b2 = (_a2 = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a2.find((association) => association.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
27889
+ 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;
27301
27890
  if (trustId) {
27302
27891
  try {
27303
27892
  const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
@@ -27491,6 +28080,19 @@ function DropinComposerComponent({
27491
28080
  }
27492
28081
  const currentTask = taskHistory[taskHistory.length - 1];
27493
28082
  switch (currentTask) {
28083
+ case TaskTypes.BUSINESS_TYPE_SELECTION:
28084
+ return jsx(BusinessTypeSelection, {
28085
+ ...args,
28086
+ legalEntityResponse: legalEntity,
28087
+ accountHolder: accountHolder2,
28088
+ showTrustOption: isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(rootLegalEntityCountry),
28089
+ showSolePropOption: SOLE_PROP_COUNTRIES.includes(rootLegalEntityCountry),
28090
+ onAccountHolderSelect: async (newAccountHolder) => {
28091
+ setAccountHolder(newAccountHolder);
28092
+ await refreshLegalEntity();
28093
+ onNavigateTo(showIntro ? TaskTypes.INTRO : TaskTypes.TASKS_OVERVIEW);
28094
+ }
28095
+ });
27494
28096
  case TaskTypes.INTRO:
27495
28097
  return jsx(TaskIntros, {
27496
28098
  legalEntityType: legalEntity.type,
@@ -27613,7 +28215,7 @@ function DropinComposerComponent({
27613
28215
  topLevelLegalEntity: legalEntityResponse
27614
28216
  },
27615
28217
  taskType: TaskTypes.TRUST_MEMBER_INDIVIDUAL,
27616
- parentLegalEntity: trust,
28218
+ parentLegalEntity: trust2,
27617
28219
  legalEntityResponse: associatedLegalEntity,
27618
28220
  problems: getLegalEntityProblems(associatedLegalEntity),
27619
28221
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
@@ -27661,7 +28263,7 @@ function DropinComposerComponent({
27661
28263
  topLevelLegalEntity: legalEntityResponse
27662
28264
  },
27663
28265
  taskType: TaskTypes.TRUST_MEMBER_COMPANY,
27664
- parentLegalEntity: trust,
28266
+ parentLegalEntity: trust2,
27665
28267
  legalEntityResponse: associatedLegalEntity,
27666
28268
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
27667
28269
  problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[legalEntity.id],
@@ -27706,22 +28308,22 @@ function DropinComposerComponent({
27706
28308
  topLevelLegalEntity: legalEntityResponse
27707
28309
  },
27708
28310
  taskType: TaskTypes.TRUST,
27709
- problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust == null ? void 0 : trust.id],
28311
+ problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust2 == null ? void 0 : trust2.id],
27710
28312
  parentLegalEntity: legalEntity,
27711
- legalEntityResponse: trust,
28313
+ legalEntityResponse: trust2,
27712
28314
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
27713
28315
  onChange: componentOnChange,
27714
28316
  eventEmitter,
27715
28317
  onSubmit: componentOnSubmit,
27716
28318
  handleHomeClick: navigateBack,
27717
28319
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
27718
- country: (((_h = trust == null ? void 0 : trust.trust) == null ? void 0 : _h.countryOfGoverningLaw) || ((_i = trust == null ? void 0 : trust.trust) == null ? void 0 : _i.registeredAddress.country)) ?? rootLegalEntityCountry,
28320
+ country: (((_h = trust2 == null ? void 0 : trust2.trust) == null ? void 0 : _h.countryOfGoverningLaw) || ((_i = trust2 == null ? void 0 : trust2.trust) == null ? void 0 : _i.registeredAddress.country)) ?? rootLegalEntityCountry,
27719
28321
  handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
27720
28322
  handleFindAddress: args == null ? void 0 : args.handleFindAddress
27721
28323
  });
27722
28324
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
27723
28325
  return jsx(TrustMembersOverview, {
27724
- trustMembers: getTrustMembers(trust, legalEntity, exemptSettlor),
28326
+ trustMembers: getTrustMembers(trust2, legalEntity, exemptSettlor),
27725
28327
  getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
27726
28328
  navigateBackToTaskList: navigateBack,
27727
28329
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
@@ -28207,6 +28809,22 @@ const getAllowedLocales$1 = async (context) => {
28207
28809
  }
28208
28810
  });
28209
28811
  };
28812
+ const getSupportedCountries = async (context) => {
28813
+ const {
28814
+ loadingContext,
28815
+ legalEntityId
28816
+ } = context;
28817
+ return httpGet({
28818
+ loadingContext,
28819
+ errorLevel: "warn",
28820
+ errorMessage: `Supported countries not available`,
28821
+ path: `${legalEntityId}/configurations/supportedCountries`,
28822
+ authentication: "jwt",
28823
+ headers: {
28824
+ "Content-Type": "application/json"
28825
+ }
28826
+ });
28827
+ };
28210
28828
  const getEmbeddedApi = ({
28211
28829
  base,
28212
28830
  rootLegalEntityId
@@ -28237,9 +28855,7 @@ const getEmbeddedApi = ({
28237
28855
  loadFlags: async () => loadFlags(base),
28238
28856
  loadDocumentGuidance: async () => loadDocumentGuidance(base),
28239
28857
  getImageUrl: () => `${base}static/images/`,
28240
- getAllowedCountries: () => {
28241
- throw new Error("getAllowedCountries: Not implemented in onboarding component api");
28242
- },
28858
+ getAllowedCountries: async () => getSupportedCountries(baseRequestContext),
28243
28859
  getAllowedLocales: async () => getAllowedLocales$1(baseRequestContext),
28244
28860
  validatePhoneNumber: () => {
28245
28861
  throw new Error("validatePhoneNumber: Not implemented in onboarding component api");
@@ -28548,36 +29164,46 @@ const ConfigurationApiProvider = ({
28548
29164
  children
28549
29165
  });
28550
29166
  };
29167
+ const accountHolderStorageKey = "ACCOUNT_HOLDER";
29168
+ const useAccountHolder = (enableNewEntryFlow) => {
29169
+ let hook;
29170
+ let initialStateParams;
29171
+ if (enableNewEntryFlow) {
29172
+ hook = useLocalStorage;
29173
+ initialStateParams = [accountHolderStorageKey, null];
29174
+ } else {
29175
+ hook = useState;
29176
+ initialStateParams = [null];
29177
+ }
29178
+ const [accountHolder2, setAccountHolder] = hook(...initialStateParams);
29179
+ return [accountHolder2, setAccountHolder];
29180
+ };
28551
29181
  const logger$2 = createLogger("CoreProvider");
28552
29182
  const CoreProvider = ({
28553
29183
  contextCountry: initialContextCountry,
29184
+ enableNewEntryFlowExperiment = false,
28554
29185
  children
28555
29186
  }) => {
28556
29187
  const {
28557
29188
  loadingContext
28558
29189
  } = useAuthContext();
28559
- const {
28560
- getAllowedCountries: getAllowedCountries2
28561
- } = useConfigurationApi();
28562
29190
  const [contextCountry, setContextCountry] = useState(initialContextCountry);
28563
- const [accountHolder2, setAccountHolder] = useState(null);
29191
+ const [accountHolder2, setAccountHolder] = useAccountHolder(enableNewEntryFlowExperiment);
28564
29192
  const [accountFormat, setAccountFormat] = useState("local");
28565
29193
  useEffect(() => {
28566
29194
  addStyleTagForADLIconFont(loadingContext);
28567
29195
  }, [loadingContext]);
29196
+ const allowedCountries = useAllowedCountries();
29197
+ const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
28568
29198
  useEffect(() => {
28569
- const checkIfCountryIsAllowed = async () => {
28570
- const allowedCountries = (await getAllowedCountries2()).countries;
28571
- if (!allowedCountries.includes(contextCountry)) {
28572
- logger$2.warn(`
29199
+ if (allowedCountries && !isCountryAllowed) {
29200
+ logger$2.warn(`
28573
29201
 
28574
29202
  "${contextCountry}" isn't a supported country. Please use one of the following:
28575
29203
  - ${listify(allowedCountries)}.
28576
- `);
28577
- }
28578
- };
28579
- checkIfCountryIsAllowed().catch(logger$2.warn);
28580
- }, [contextCountry, getAllowedCountries2]);
29204
+ `);
29205
+ }
29206
+ }, [allowedCountries, contextCountry, isCountryAllowed]);
28581
29207
  const contextValue = useMemo(() => ({
28582
29208
  setContextCountry,
28583
29209
  contextCountry,
@@ -28818,6 +29444,7 @@ class UIElement extends BaseElement {
28818
29444
  constructor(props) {
28819
29445
  super(props);
28820
29446
  this.render = () => {
29447
+ var _a;
28821
29448
  const Component = this.props.component;
28822
29449
  return jsx(AuthProvider, {
28823
29450
  sdkToken: this.props.sdkToken,
@@ -28828,6 +29455,7 @@ class UIElement extends BaseElement {
28828
29455
  rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
28829
29456
  children: jsx(CoreProvider, {
28830
29457
  contextCountry: this.props.contextCountry,
29458
+ enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
28831
29459
  children: jsx(I18nProvider, {
28832
29460
  locale: this.props.locale,
28833
29461
  customTranslations: this.props.customTranslations,