@adyen/kyc-components 3.0.0-beta.15 → 3.0.0-beta.17

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 (37) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1044 -406
  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/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverviewItem/ManageTransferInstrumentOverviewItem.d.ts +1 -2
  9. package/dist/types/components/PayoutDetails/component/PayoutDetailsComponent.d.ts +2 -2
  10. package/dist/types/components/TaskList/component/TaskListItem.d.ts +1 -1
  11. package/dist/types/components/TaskList/types.d.ts +2 -0
  12. package/dist/types/components/internal/AccountHolder/types.d.ts +2 -1
  13. package/dist/types/components/internal/Address/types.d.ts +0 -2
  14. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  15. package/dist/types/components/internal/Alert/Alert.d.ts +1 -3
  16. package/dist/types/components/internal/Alert/index.d.ts +1 -1
  17. package/dist/types/components/internal/Alert/types.d.ts +1 -0
  18. package/dist/types/components/internal/FormFields/RadioGroupCard/RadioCardSelect.d.ts +1 -1
  19. package/dist/types/components/internal/FormFields/RadioGroupCard/types.d.ts +2 -2
  20. package/dist/types/core/Context/CoreProvider.d.ts +2 -1
  21. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  22. package/dist/types/core/Services/componentApi/get-supported-countries.d.ts +3 -0
  23. package/dist/types/core/errorMapping.d.ts +2 -0
  24. package/dist/types/core/hooks/useAccountHolder.d.ts +2 -0
  25. package/dist/types/core/hooks/useAllowedCountries.d.ts +2 -0
  26. package/dist/types/core/hooks/useBusinessSetup.d.ts +16 -0
  27. package/dist/types/core/hooks/useBusinessTypeSelection.d.ts +2 -0
  28. package/dist/types/core/hooks/useDataMissingRemediations.d.ts +18 -0
  29. package/dist/types/core/hooks/useEnableNewEntryFlow.d.ts +1 -0
  30. package/dist/types/core/hooks/useInterval.d.ts +2 -1
  31. package/dist/types/language/config.d.ts +43 -0
  32. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  33. package/dist/types/utils/entity-status-util.d.ts +2 -2
  34. package/dist/types/utils/trust-util.d.ts +1 -1
  35. package/package.json +3 -2
  36. package/dist/types/openbankingsdk/OpenBankingSDK.d.ts +0 -14
  37. 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.";
@@ -457,7 +459,7 @@ const ICO = "IČO (Identifikační číslo)";
457
459
  const handelsregisternummer = "Handelsregisternummer";
458
460
  const NumeroDeTVA = "Numéro de TVA";
459
461
  const organisasjonsnummer = "Organisasjonsnummer";
460
- const mvanummer = "MVA nummer";
462
+ const mvanummer = "MVA-nummer";
461
463
  const verificationErrorMessage = "Some information couldn’t be verified. Click to see what needs to be adjusted.";
462
464
  const remediationFormErrorMessage = "Some information couldn’t be verified. Information in this form may need to be adjusted.";
463
465
  const youHaveUnsavedChanges = "You have unsaved changes";
@@ -589,11 +591,38 @@ const providePageWithPhotoAndCode = "Provide the page with the photo, including
589
591
  const constitutionalDocument = "Constitutional document";
590
592
  const solePropDetails = "Sole proprietor details";
591
593
  const soleProprietorDetails = "Sole proprietor details";
594
+ const soleProprietorshipDetails = "Sole proprietorship details";
592
595
  const selectAccountHolder = "Select account holder";
593
596
  const nameOfBankAccountHolder = "We need to know about the bank account where you want to receive your payouts. What is the name of the account holder of that bank account?";
594
597
  const enterValidAccountDetails = "Please enter valid account details";
595
598
  const enterValid_ = "Please enter valid: %{fieldNames}";
599
+ const whatBestDescribesYourBusinessSetup = "What best describes your business setup?";
600
+ const whichLegalArrangementDoesYourBusinessHave = "Which legal arrangement does your business have?";
601
+ const sorryWeCantSetUpAnAccountForYou = "Sorry, we can’t set up an account for you";
602
+ const changeYourBusinessSetup = "Change your business setup?";
603
+ const someInformationWillNotBeSaved = "Some information that you entered previously will not be saved. ";
604
+ const yesChange = "Yes, change";
605
+ const youAreNotSoleProprietorAndUseBankAccount = "You’re not a sole proprietor and you use a personal bank account.";
606
+ const soleProprietorship = "Sole proprietorship";
607
+ const youAreRegisteredSoleProprietorAndUseBankAccount = "You’re a registered sole proprietor and you use a bank account in your name or sole proprietorship’s name.";
608
+ const company = "Company";
609
+ const youUseCompanyBankAccount = "You use a company bank account.";
610
+ const trust = "Trust";
611
+ const trustPartnershipOrAssociation = "Trust, partnership, or association";
612
+ const whatTypeOfTrusteeAreYou = "What type of trustee are you?";
613
+ const youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation = "You’re an individual or company, and you use a bank account in the name of a trust, partnership, or association.";
614
+ const individualTrustee = "Individual trustee";
615
+ const companyTrustee = "Company trustee";
616
+ const association = "Association";
617
+ const partnership = "Partnership";
618
+ const youAreTrusteeManagingTheTrustForBeneficiaries = "You’re a trustee managing the trust for beneficiaries.";
619
+ const jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits = "A jointly owned business where two or more people operate and share profits.";
620
+ const groupOfPeopleActingTogetherForNonCommercialPurpose = "A group of people acting together for a non-commercial purpose.";
621
+ const ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations = "Our financial services aren’t available yet for partnerships and associations";
622
+ const needHelpYouCanAlwaysReachOutToCustomerSupport = "Need help? You can always reach out to customer support.";
596
623
  const myName = "My name";
624
+ const setUpYourAccount = "Set up your account";
625
+ const yourBusinessSetup = "Your business setup: %{businessSetup}";
597
626
  const myNameDescription = "It’s a personal bank account held in my own name";
598
627
  const mySoleProprietorName = "My sole proprietor name";
599
628
  const mySoleProprietorNameDescription = "The account is in my name, but I am registered as a sole proprietor, sole trader, or freelancer";
@@ -606,6 +635,12 @@ const aPartnershipDescription = "The account belongs to a jointly owned business
606
635
  const anAssociation = "An association";
607
636
  const anAssociationDescription = "The account belongs to a group of people acting together for a specific non-commercial purpose";
608
637
  const legalNameOfSoleProprietor = "Legal name of sole proprietor";
638
+ const legalNameOfSoleProprietorship = "Legal name of sole proprietorship";
639
+ const letUsKnowTheBankAccountToSendReceiveFunds = "Let us know the bank account you use to send or receive funds.";
640
+ const bankAccount = "Bank account";
641
+ const bankAccountDetails = "Bank account details";
642
+ const addExtraBankAccount = "Add extra bank account";
643
+ const addAndVerifyYourBankDetails = "Add and verify your bank account details";
609
644
  const failedToFetchSoleProp = "Failed to fetch the sole propietor";
610
645
  const uniqueIdentificationCode = "Unique identification code (ЕИК/UIC)";
611
646
  const identifikacionenNomerDDS = "VAT number (ДДС)";
@@ -762,6 +797,7 @@ const passportPhotoPage = "Passport photo page";
762
797
  const residencePermitBack = "Residence permit (back)";
763
798
  const residencePermitFront = "Residence permit (front)";
764
799
  const manualUpload = "Manual upload";
800
+ const missingMultipleDecisionMakers = "You haven't added all required decision-makers";
765
801
  const legalCompanyName = "Legal name of the company";
766
802
  const legalCompanyName__helperText = "Enter the name exactly as it is on your company's official registration documents.";
767
803
  const legalCompanyName__helperText__AU = "Enter the name exactly as it is on your Australian Securities and Investment Commission's (ASIC).";
@@ -985,6 +1021,10 @@ const errorMessage_1_7019 = "The bank document wasn't issued in the past 12 mont
985
1021
  const errorMessage_1_7020 = "The bank name didn't match the one on the bank document.";
986
1022
  const errorMessage_1_7021 = "The bank document didn't show an official bank logo.";
987
1023
  const errorMessage_1_7022 = "The bank document didn't show an official bank stamp.";
1024
+ const errorMessage_2_8064 = "UBO through ownership was missing.";
1025
+ const errorMessage_2_8067 = "Signatory was missing.";
1026
+ const errorMessage_2_8189 = "UBO through control was missing.";
1027
+ const errorMessage_2_8193 = "Director was missing.";
988
1028
  const errorMessage_3_10 = "Review of data is required";
989
1029
  const remediationMessage_1_100 = "No remediation possible";
990
1030
  const remediationMessage_1_101 = "Contact Support";
@@ -1023,6 +1063,10 @@ const remediationMessage_1_702 = "Use other means of bank account verification";
1023
1063
  const remediationMessage_1_703 = "Upload a bank statement";
1024
1064
  const remediationMessage_1_704 = "Upload a different bank statement";
1025
1065
  const remediationMessage_1_705 = "Upload an official bank statement";
1066
+ const remediationMessage_2_123 = "You haven't added an owner";
1067
+ const remediationMessage_2_124 = "You haven't added a signatory";
1068
+ const remediationMessage_2_151 = "You haven't added a controlling person";
1069
+ const remediationMessage_2_185 = "You haven't added your directors";
1026
1070
  const remediationMessage_3_100 = "Check the above information, then click here to confirm.";
1027
1071
  const sameNameAsLegalName = "Same as legal name of the company";
1028
1072
  const whereCanIFindTheseNumbersOnMyDriversLicense = "Where can I find these numbers on my driver's license?";
@@ -1307,6 +1351,7 @@ const defaultTrans = {
1307
1351
  nameAndCountry,
1308
1352
  companyCountry,
1309
1353
  accountDetailsDescription,
1354
+ provideFewDetailsAboutYourself,
1310
1355
  provideDetails,
1311
1356
  payoutAccountsDescription,
1312
1357
  payoutAccountsDescriptionReview,
@@ -1673,11 +1718,38 @@ const defaultTrans = {
1673
1718
  constitutionalDocument,
1674
1719
  solePropDetails,
1675
1720
  soleProprietorDetails,
1721
+ soleProprietorshipDetails,
1676
1722
  selectAccountHolder,
1677
1723
  nameOfBankAccountHolder,
1678
1724
  enterValidAccountDetails,
1679
1725
  enterValid_,
1726
+ whatBestDescribesYourBusinessSetup,
1727
+ whichLegalArrangementDoesYourBusinessHave,
1728
+ sorryWeCantSetUpAnAccountForYou,
1729
+ changeYourBusinessSetup,
1730
+ someInformationWillNotBeSaved,
1731
+ yesChange,
1732
+ youAreNotSoleProprietorAndUseBankAccount,
1733
+ soleProprietorship,
1734
+ youAreRegisteredSoleProprietorAndUseBankAccount,
1735
+ company,
1736
+ youUseCompanyBankAccount,
1737
+ trust,
1738
+ trustPartnershipOrAssociation,
1739
+ whatTypeOfTrusteeAreYou,
1740
+ youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation,
1741
+ individualTrustee,
1742
+ companyTrustee,
1743
+ association,
1744
+ partnership,
1745
+ youAreTrusteeManagingTheTrustForBeneficiaries,
1746
+ jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits,
1747
+ groupOfPeopleActingTogetherForNonCommercialPurpose,
1748
+ ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations,
1749
+ needHelpYouCanAlwaysReachOutToCustomerSupport,
1680
1750
  myName,
1751
+ setUpYourAccount,
1752
+ yourBusinessSetup,
1681
1753
  myNameDescription,
1682
1754
  mySoleProprietorName,
1683
1755
  mySoleProprietorNameDescription,
@@ -1690,6 +1762,12 @@ const defaultTrans = {
1690
1762
  anAssociation,
1691
1763
  anAssociationDescription,
1692
1764
  legalNameOfSoleProprietor,
1765
+ legalNameOfSoleProprietorship,
1766
+ letUsKnowTheBankAccountToSendReceiveFunds,
1767
+ bankAccount,
1768
+ bankAccountDetails,
1769
+ addExtraBankAccount,
1770
+ addAndVerifyYourBankDetails,
1693
1771
  failedToFetchSoleProp,
1694
1772
  uniqueIdentificationCode,
1695
1773
  identifikacionenNomerDDS,
@@ -1858,6 +1936,7 @@ const defaultTrans = {
1858
1936
  residencePermitBack,
1859
1937
  residencePermitFront,
1860
1938
  manualUpload,
1939
+ missingMultipleDecisionMakers,
1861
1940
  legalCompanyName,
1862
1941
  legalCompanyName__helperText,
1863
1942
  legalCompanyName__helperText__AU,
@@ -2081,6 +2160,10 @@ const defaultTrans = {
2081
2160
  errorMessage_1_7020,
2082
2161
  errorMessage_1_7021,
2083
2162
  errorMessage_1_7022,
2163
+ errorMessage_2_8064,
2164
+ errorMessage_2_8067,
2165
+ errorMessage_2_8189,
2166
+ errorMessage_2_8193,
2084
2167
  errorMessage_3_10,
2085
2168
  remediationMessage_1_100,
2086
2169
  remediationMessage_1_101,
@@ -2119,6 +2202,10 @@ const defaultTrans = {
2119
2202
  remediationMessage_1_703,
2120
2203
  remediationMessage_1_704,
2121
2204
  remediationMessage_1_705,
2205
+ remediationMessage_2_123,
2206
+ remediationMessage_2_124,
2207
+ remediationMessage_2_151,
2208
+ remediationMessage_2_185,
2122
2209
  remediationMessage_3_100,
2123
2210
  sameNameAsLegalName,
2124
2211
  whereCanIFindTheseNumbersOnMyDriversLicense,
@@ -2770,11 +2857,11 @@ var AlertTypes = /* @__PURE__ */ ((AlertTypes2) => {
2770
2857
  return AlertTypes2;
2771
2858
  })(AlertTypes || {});
2772
2859
  const Alert = ({
2773
- className,
2774
2860
  title,
2775
2861
  type = AlertTypes.BASIC,
2776
- children,
2777
- hasCloseButton = true
2862
+ className,
2863
+ hasCloseButton = true,
2864
+ children
2778
2865
  }) => {
2779
2866
  const {
2780
2867
  i18n
@@ -2873,7 +2960,7 @@ const createLogger = (namespace) => {
2873
2960
  });
2874
2961
  return methods;
2875
2962
  };
2876
- const logger$o = createLogger("Link");
2963
+ const logger$p = createLogger("Link");
2877
2964
  const getIconClass = (icon, external) => {
2878
2965
  if (external) {
2879
2966
  return "adl-link__icon adyen-kyc-icon-external-link";
@@ -2885,7 +2972,7 @@ const getIconClass = (icon, external) => {
2885
2972
  };
2886
2973
  const isValidLink = (href) => {
2887
2974
  if (href === "#") {
2888
- logger$o.error('Links must include a valid href. If your href is "#", consider using a Button instead');
2975
+ logger$p.error('Links must include a valid href. If your href is "#", consider using a Button instead');
2889
2976
  return false;
2890
2977
  }
2891
2978
  return true;
@@ -3175,6 +3262,17 @@ function useResetGlobalData(caller) {
3175
3262
  }
3176
3263
  }), [dispatch, caller]);
3177
3264
  }
3265
+ const logger$o = createLogger("useAllowedCountries");
3266
+ const useAllowedCountries = () => {
3267
+ const {
3268
+ getAllowedCountries: getAllowedCountries2
3269
+ } = useConfigurationApi();
3270
+ const [allowedCountries, setAllowedCountries] = useState();
3271
+ useEffect(() => {
3272
+ getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$o.error);
3273
+ }, []);
3274
+ return allowedCountries;
3275
+ };
3178
3276
  const processField = ({
3179
3277
  key,
3180
3278
  value = null,
@@ -4964,7 +5062,7 @@ function CountryField({
4964
5062
  readonly,
4965
5063
  handleChangeFor,
4966
5064
  helperText,
4967
- allowedCountries = [],
5065
+ allowedCountries,
4968
5066
  classNameModifiers = []
4969
5067
  }) {
4970
5068
  const {
@@ -4979,7 +5077,7 @@ function CountryField({
4979
5077
  useEffect(() => {
4980
5078
  loadFlags2().catch(logger$m.error);
4981
5079
  }, [loadFlags2]);
4982
- const countries = countriesFromApi.filter((country2) => allowedCountries.length ? allowedCountries.includes(country2.id) : true).map((item) => ({
5080
+ const countries = countriesFromApi.filter((country2) => allowedCountries ? allowedCountries.includes(country2.id) : true).map((item) => ({
4983
5081
  ...item,
4984
5082
  sprite: `#adl-flag-${item.id.toLowerCase()}`
4985
5083
  }));
@@ -5208,8 +5306,10 @@ function CompanyNameAndCountry(props) {
5208
5306
  isSettingEnabled
5209
5307
  } = useSettingsContext();
5210
5308
  const {
5211
- id: id2
5309
+ id: id2,
5310
+ isTopLevelEntity
5212
5311
  } = props;
5312
+ const allowedCountries = useAllowedCountries();
5213
5313
  const {
5214
5314
  sliceData,
5215
5315
  updateStateSlice
@@ -5255,7 +5355,7 @@ function CompanyNameAndCountry(props) {
5255
5355
  labels: formUtils.getFieldLabels(COUNTRY_FIELD),
5256
5356
  readonly: !isAllowedEditPrefilledCountry || Boolean(props == null ? void 0 : props.disableCountry),
5257
5357
  classNameModifiers: ["country"],
5258
- allowedCountries: [],
5358
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
5259
5359
  handleChangeFor
5260
5360
  }), formUtils.isRequiredField("legalCompanyName") && jsx(LegalCompanyNameField, {
5261
5361
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -8669,6 +8769,7 @@ var DecisionMakerType = /* @__PURE__ */ ((DecisionMakerType2) => {
8669
8769
  return DecisionMakerType2;
8670
8770
  })(DecisionMakerType || {});
8671
8771
  var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
8772
+ TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
8672
8773
  TaskTypes2["INTRO"] = "INTRO";
8673
8774
  TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
8674
8775
  TaskTypes2["REVIEW"] = "REVIEW";
@@ -8840,12 +8941,19 @@ function AccountHolder(props) {
8840
8941
  dataStoreId,
8841
8942
  capabilities
8842
8943
  } = props;
8944
+ const {
8945
+ accountHolder: accountHolder2
8946
+ } = useCoreContext();
8843
8947
  const {
8844
8948
  isSettingEnabled
8845
8949
  } = useSettingsContext();
8846
8950
  const {
8847
8951
  isExperimentEnabled
8848
8952
  } = useExperimentsContext();
8953
+ const defaultData = cloneObject(props.data);
8954
+ if (isExperimentEnabled("EnableNewEntryFlow") && defaultData) {
8955
+ defaultData.accountHolder = accountHolder2 || defaultData.accountHolder;
8956
+ }
8849
8957
  const {
8850
8958
  handleChangeFor,
8851
8959
  data,
@@ -8855,7 +8963,7 @@ function AccountHolder(props) {
8855
8963
  } = useForm({
8856
8964
  ...props,
8857
8965
  schema: ["accountHolder"],
8858
- defaultData: props.data,
8966
+ defaultData,
8859
8967
  rules: props.validators || accountHolderValidationRules,
8860
8968
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
8861
8969
  });
@@ -8965,7 +9073,7 @@ const RadioCard = ({
8965
9073
  })]
8966
9074
  }), jsx("div", {
8967
9075
  className: "adl-radio-card__body adl-u-margin-bottom-16",
8968
- children: body ?? i18n.get(optionDescription)
9076
+ children: body ?? (optionDescription && i18n.get(optionDescription))
8969
9077
  }), footer && jsx("div", {
8970
9078
  className: "adl-u-margin-bottom-16",
8971
9079
  children: footer
@@ -8998,7 +9106,7 @@ function RadioCardSelect({
8998
9106
  children: options.map((option) => jsx(RadioCard, {
8999
9107
  optionId: optionId(option),
9000
9108
  optionName: optionName(option),
9001
- optionDescription: optionDescription(option),
9109
+ optionDescription: optionDescription == null ? void 0 : optionDescription(option),
9002
9110
  optionSubtitle: optionSubtitle == null ? void 0 : optionSubtitle(option),
9003
9111
  uniqueId: getUniqueId(uniqueIdBase),
9004
9112
  isInvalid,
@@ -9912,7 +10020,6 @@ function FieldContainer(props) {
9912
10020
  fieldProblems,
9913
10021
  fieldName,
9914
10022
  trimOnBlur,
9915
- allowedCountries,
9916
10023
  hideField,
9917
10024
  maxlength,
9918
10025
  handleChangeFor
@@ -9939,7 +10046,6 @@ function FieldContainer(props) {
9939
10046
  },
9940
10047
  readonly: formUtils.isReadOnly(field),
9941
10048
  classNameModifiers,
9942
- allowedCountries,
9943
10049
  className: hideField ? "adl-u-display-none" : "",
9944
10050
  handleChangeFor
9945
10051
  });
@@ -10521,7 +10627,6 @@ function Address(props) {
10521
10627
  shouldValidate,
10522
10628
  id: id2,
10523
10629
  hideCountry,
10524
- allowedCountries,
10525
10630
  heading
10526
10631
  } = props;
10527
10632
  const {
@@ -10640,7 +10745,6 @@ function Address(props) {
10640
10745
  return null;
10641
10746
  const hideField = fieldName === "country" && hideCountry;
10642
10747
  return jsx(FieldContainer, {
10643
- allowedCountries,
10644
10748
  classNameModifiers: [fieldName],
10645
10749
  data,
10646
10750
  valid,
@@ -11008,7 +11112,8 @@ function CompanyComponent(props) {
11008
11112
  country: props.country
11009
11113
  },
11010
11114
  heading: i18n.get("nameAndCountry"),
11011
- id: CompanyNameAndCountryFormID
11115
+ id: CompanyNameAndCountryFormID,
11116
+ isTopLevelEntity: props.isTopLevelEntity
11012
11117
  })
11013
11118
  }), jsx("div", {
11014
11119
  className: props.activeForm.formId !== CompanyTypeFormID ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -12613,13 +12718,23 @@ const mapExistingFile = (name) => ({
12613
12718
  existing: true
12614
12719
  });
12615
12720
  const mapApiIdDocumentToSchema = (idDocument2) => {
12721
+ const {
12722
+ type,
12723
+ attachments
12724
+ } = idDocument2;
12616
12725
  const {
12617
12726
  hasBackPage
12618
12727
  } = idDocumentTypeOptions.find(({
12619
12728
  id: id2
12620
- }) => id2 === idDocument2.type);
12621
- const frontPage2 = hasBackPage ? getPage(idDocument2, "front") : getPage(idDocument2);
12622
- const backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12729
+ }) => id2 === type);
12730
+ let frontPage2;
12731
+ let backPage2;
12732
+ if ((attachments == null ? void 0 : attachments.length) === 1) {
12733
+ frontPage2 = getPage(idDocument2);
12734
+ } else {
12735
+ frontPage2 = hasBackPage ? getPage(idDocument2, "front") : getPage(idDocument2);
12736
+ backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12737
+ }
12623
12738
  return {
12624
12739
  ...frontPage2 ? {
12625
12740
  idFrontPage: [mapExistingFile(frontPage2.pageName)]
@@ -12627,7 +12742,7 @@ const mapApiIdDocumentToSchema = (idDocument2) => {
12627
12742
  ...backPage2 ? {
12628
12743
  idBackPage: [mapExistingFile(backPage2.pageName)]
12629
12744
  } : {},
12630
- idDocumentType: idDocument2.type
12745
+ idDocumentType: type
12631
12746
  };
12632
12747
  };
12633
12748
  const mapApiDocumentToIndividualDocuments = (entityId) => {
@@ -15706,6 +15821,7 @@ function PersonalDetailsComponent(props) {
15706
15821
  const {
15707
15822
  isSettingEnabled
15708
15823
  } = useSettingsContext();
15824
+ const allowedCountries = useAllowedCountries();
15709
15825
  const PERSONAL_DETAILS = props.id;
15710
15826
  const [externalErrors, setExternalErrors] = useState(null);
15711
15827
  const [status, setStatus] = useState("success");
@@ -15714,6 +15830,7 @@ function PersonalDetailsComponent(props) {
15714
15830
  });
15715
15831
  const [personalDetailsData, setPersonalDetailsData] = useState(null);
15716
15832
  const isDecisionMakerTask = props.taskType === TaskTypes.DECISION_MAKER || props.taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER;
15833
+ const isTopLevelEntity = props.taskType === TaskTypes.INDIVIDUAL;
15717
15834
  const requiredFieldsByTask = (props.requiredFields || personalDetailsFields).filter((field) => field !== "role" || field === "role" && isDecisionMakerTask);
15718
15835
  const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
15719
15836
  const getDirectChildFields = () => requiredFieldsByTask.filter((field) => ["birthDate", "residencyCountry", "jobTitle", "nationality"].includes(field));
@@ -15830,7 +15947,7 @@ function PersonalDetailsComponent(props) {
15830
15947
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
15831
15948
  formUtils,
15832
15949
  id: "ariaErrorField"
15833
- }), data.residencyCountry === "US" && !isDecisionMakerTask ? jsx(PatriotActDisclosure, {}) : void 0, jsx(ContextGuidance, {
15950
+ }), data.residencyCountry === "US" && isTopLevelEntity ? jsx(PatriotActDisclosure, {}) : void 0, jsx(ContextGuidance, {
15834
15951
  page: "Personal details",
15835
15952
  title: i18n.get("whyDoINeedToFillInThisInformation"),
15836
15953
  content: i18n.get("reasonForFillingIndividualPersonalDetails"),
@@ -15877,7 +15994,7 @@ function PersonalDetailsComponent(props) {
15877
15994
  country: formUtils.getLabel("residencyCountry")
15878
15995
  },
15879
15996
  readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask,
15880
- allowedCountries: [],
15997
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
15881
15998
  classNameModifiers: ["country"],
15882
15999
  handleChangeFor: () => handleChangeFor("residencyCountry", "input")
15883
16000
  }), jsx(IdentityComponent, {
@@ -16436,61 +16553,6 @@ const refreshSession = async () => {
16436
16553
  logger$g.error("Failed to fetch sdk token", e);
16437
16554
  }
16438
16555
  };
16439
- const OpenBankingSDKStyles = "";
16440
- const WIDGET_IFRAME_CLASS$1 = "adyen-open-banking-sdk-widget";
16441
- const WIDGET_CONTAINER_CLASS$1 = `${WIDGET_IFRAME_CLASS$1}-container`;
16442
- class OpenBankingSDK {
16443
- constructor({
16444
- divElement,
16445
- link,
16446
- successHandler,
16447
- errorHandler
16448
- }) {
16449
- this.divElement = divElement;
16450
- this.link = link;
16451
- this.successHandler = successHandler;
16452
- this.errorHandler = errorHandler;
16453
- }
16454
- static create(parameters) {
16455
- return new OpenBankingSDK(parameters);
16456
- }
16457
- open() {
16458
- this.iframe = document.createElement("iframe");
16459
- this.iframe.setAttribute("allowFullscreen", "true");
16460
- this.iframe.classList.add(WIDGET_IFRAME_CLASS$1);
16461
- this.divElement.appendChild(this.iframe);
16462
- this.divElement.classList.add(WIDGET_CONTAINER_CLASS$1);
16463
- const iframeUrl = new URL(this.link);
16464
- const iframeWindow = this.iframe.contentWindow;
16465
- this.listener = ({
16466
- data,
16467
- origin,
16468
- source
16469
- }) => {
16470
- if (source !== iframeWindow || origin !== iframeUrl.origin)
16471
- return;
16472
- switch (data.type) {
16473
- case "account_verification_report":
16474
- this.successHandler(data.code, data.state);
16475
- break;
16476
- case "error":
16477
- this.errorHandler(data.error_code, data.error_message, data.state, data.metadata);
16478
- break;
16479
- }
16480
- };
16481
- window.addEventListener("message", this.listener);
16482
- this.iframe.setAttribute("src", iframeUrl.href);
16483
- }
16484
- destroy() {
16485
- if (this.listener) {
16486
- window.removeEventListener("message", this.listener);
16487
- }
16488
- if (this.iframe) {
16489
- this.divElement.removeChild(this.iframe);
16490
- this.iframe = void 0;
16491
- }
16492
- }
16493
- }
16494
16556
  const addAnimationStartListener = (element, listener) => {
16495
16557
  element.addEventListener("animationstart", listener, false);
16496
16558
  element.addEventListener("MSAnimationStart", listener, false);
@@ -17293,7 +17355,8 @@ function BankAccountFormat(props) {
17293
17355
  var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
17294
17356
  ExperimentNames2["EnableTrustFlow"] = "EnableTrustFlow";
17295
17357
  ExperimentNames2["OnlyAllowAlphanumericBankAccountNumbers"] = "OnlyAllowAlphanumericBankAccountNumbers";
17296
- ExperimentNames2["OrganizationSettlorWithExemptionReason"] = "OrganizationSettlorWithExemptionReason";
17358
+ ExperimentNames2["EnableNewEntryFlow"] = "EnableNewEntryFlow";
17359
+ ExperimentNames2["AllowOrganizationSettlorWithExemptionReason"] = "AllowOrganizationSettlorWithExemptionReason";
17297
17360
  return ExperimentNames2;
17298
17361
  })(ExperimentNames || {});
17299
17362
  const stripNonAlphanumeric = (value) => value.replaceAll(/[^0-9a-zA-Z]/g, "");
@@ -18711,9 +18774,13 @@ const payoutSteps = {
18711
18774
  formName: "verificationMethod",
18712
18775
  fields: payoutVerificationMethodFields
18713
18776
  },
18714
- payoutAccountDetails: (tasktype) => ({
18777
+ payoutAccountDetails: (tasktype, isNewEntryFlowExperimentEnabled) => ({
18715
18778
  formId: "payoutAccountDetails",
18716
- formName: tasktype === TaskTypes.PAYIN ? "payinAccount" : "payoutAccount",
18779
+ ...isNewEntryFlowExperimentEnabled ? {
18780
+ formName: "bankAccount"
18781
+ } : {
18782
+ formName: tasktype === TaskTypes.PAYIN ? "payinAccount" : "payoutAccount"
18783
+ },
18717
18784
  fields: payoutAccountFields
18718
18785
  }),
18719
18786
  payoutAccountDocuments: {
@@ -18727,9 +18794,9 @@ const payoutSteps = {
18727
18794
  fields: accountVerificationFields
18728
18795
  }
18729
18796
  };
18730
- const getAppropriatePayoutDetailsSteps = (currentTask, isEditing, instantVerificationAvailable, canChangeCountry) => {
18797
+ const getAppropriatePayoutDetailsSteps = (currentTask, isEditing, instantVerificationAvailable, canChangeCountry, isNewEntryFlowExperimentEnabled) => {
18731
18798
  const dependentSteps = {
18732
- payoutAccountDetails: payoutSteps.payoutAccountDetails(currentTask),
18799
+ payoutAccountDetails: payoutSteps.payoutAccountDetails(currentTask, isNewEntryFlowExperimentEnabled),
18733
18800
  payoutAccountDocuments: payoutSteps.payoutAccountDocuments,
18734
18801
  payoutAccountVerification: payoutSteps.payoutAccountVerification
18735
18802
  };
@@ -18747,6 +18814,9 @@ function PayoutDetailsComponent(props) {
18747
18814
  const {
18748
18815
  i18n
18749
18816
  } = useI18nContext();
18817
+ const {
18818
+ isExperimentEnabled
18819
+ } = useExperimentsContext();
18750
18820
  const {
18751
18821
  activeForm,
18752
18822
  taskType,
@@ -18764,9 +18834,9 @@ function PayoutDetailsComponent(props) {
18764
18834
  const [instantVerificationError, setInstantVerificationError] = useInstantVerificationErrorNotification(1e4);
18765
18835
  const verificationMethodFormProps = getFormProps(props, payoutSteps.payoutVerificationMethod.formId);
18766
18836
  const accountVerificationFormProps = getFormProps(props, payoutSteps.payoutAccountVerification.formId);
18767
- const payoutAccountFormProps = getFormProps(props, payoutSteps.payoutAccountDetails(taskType).formId);
18837
+ const payoutAccountFormProps = getFormProps(props, payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId);
18768
18838
  const payoutBankStatementFormProps = getFormProps(props, payoutSteps.payoutAccountDocuments.formId);
18769
- const taskHeading = i18n.get(taskHeadings[taskType]);
18839
+ const taskHeading = isExperimentEnabled("EnableNewEntryFlow") ? i18n.get("addAndVerifyYourBankDetails") : i18n.get(taskHeadings[taskType]);
18770
18840
  const isBankStatementDocumentOptional = formUtilities(payoutBankStatementFormProps, i18n).isOptionalField("bankStatementDocument");
18771
18841
  const globalData = useGlobalData();
18772
18842
  const data = isEmpty(globalData) ? props.data : globalData;
@@ -18841,11 +18911,11 @@ function PayoutDetailsComponent(props) {
18841
18911
  handleBankVerificationError: handleBankVerificationError2
18842
18912
  })
18843
18913
  }) : jsx("div", {
18844
- className: activeForm.formId !== payoutSteps.payoutAccountDetails(taskType).formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18914
+ className: activeForm.formId !== payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18845
18915
  children: jsx(PayoutAccount, {
18846
18916
  ...payoutAccountFormProps,
18847
18917
  heading: taskHeading,
18848
- id: payoutSteps.payoutAccountDetails(taskType).formId,
18918
+ id: payoutSteps.payoutAccountDetails(taskType, isExperimentEnabled("EnableNewEntryFlow")).formId,
18849
18919
  country: bankCountry2,
18850
18920
  legalEntityResponse,
18851
18921
  arePayoutAccountDetailsInvalid,
@@ -18959,6 +19029,9 @@ function SolePropComponent(props) {
18959
19029
  const {
18960
19030
  i18n
18961
19031
  } = useI18nContext();
19032
+ const {
19033
+ isExperimentEnabled
19034
+ } = useExperimentsContext();
18962
19035
  const [tradingName2, setTradingName] = useState();
18963
19036
  const solePropNameAndCountryFormProps = getFormProps(props, solePropNameAndCountryFormId);
18964
19037
  const solePropsRegistrationDetailsFormProps = getFormProps(props, solePropRegistrationDetailsFormId);
@@ -18988,11 +19061,12 @@ function SolePropComponent(props) {
18988
19061
  },
18989
19062
  labels: {
18990
19063
  country: "countryOfEstablishment",
18991
- legalCompanyName: "legalNameOfSoleProprietor"
19064
+ legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
18992
19065
  },
18993
19066
  heading: i18n.get("nameAndCountry"),
18994
19067
  id: solePropNameAndCountryFormId,
18995
- disableCountry: true
19068
+ disableCountry: true,
19069
+ isTopLevelEntity: false
18996
19070
  })
18997
19071
  }), jsx("div", {
18998
19072
  className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
@@ -19438,6 +19512,16 @@ const remediationActionMappings = {
19438
19512
  const dataMissingRemediationsToFieldsMap = {
19439
19513
  "2_158": ["vatNumber", "exemptedFromVat", "vatAbsenceReason"]
19440
19514
  };
19515
+ const DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING = {
19516
+ "2_8064": "2_123",
19517
+ // Owner
19518
+ "2_8067": "2_124",
19519
+ // Signatory
19520
+ "2_8189": "2_151",
19521
+ // Controller
19522
+ "2_8193": "2_185"
19523
+ // Director
19524
+ };
19441
19525
  var EntityType = /* @__PURE__ */ ((EntityType2) => {
19442
19526
  EntityType2["BANK_ACCOUNT"] = "BankAccount";
19443
19527
  EntityType2["LEGAL_ENTITY"] = "LegalEntity";
@@ -19451,7 +19535,7 @@ var VerificationErrorType = /* @__PURE__ */ ((VerificationErrorType2) => {
19451
19535
  VerificationErrorType2["REJECTED"] = "rejected";
19452
19536
  return VerificationErrorType2;
19453
19537
  })(VerificationErrorType || {});
19454
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
19538
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036"];
19455
19539
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
19456
19540
  const getComponentMappingFromLEFieldPath = (context, entityType2) => {
19457
19541
  if (!(context == null ? void 0 : context.key)) {
@@ -21294,7 +21378,7 @@ function CompanyDropinComponent({
21294
21378
  taskName,
21295
21379
  capabilities,
21296
21380
  homeButtonLabel,
21297
- taskType,
21381
+ taskType = TaskTypes.COMPANY,
21298
21382
  trackingConfig,
21299
21383
  associationDetail,
21300
21384
  parentLegalEntity,
@@ -21622,7 +21706,8 @@ function CompanyDropinComponent({
21622
21706
  onTypeSwitch,
21623
21707
  onCountryChange: setCountry,
21624
21708
  ref: formRef,
21625
- shouldValidate
21709
+ shouldValidate,
21710
+ isTopLevelEntity: taskType === TaskTypes.COMPANY
21626
21711
  })
21627
21712
  });
21628
21713
  }
@@ -21730,20 +21815,26 @@ const useShouldShowIntro = (legalEntity) => {
21730
21815
  } = useHasSeenIntro(legalEntity.id);
21731
21816
  return canSeeIntro && !hasSeenIntro;
21732
21817
  };
21818
+ const useShouldShowBusinessTypeSelection = (accountHolder2) => {
21819
+ const {
21820
+ isExperimentEnabled
21821
+ } = useExperimentsContext();
21822
+ return isExperimentEnabled("EnableNewEntryFlow") && !accountHolder2;
21823
+ };
21733
21824
  const logger$9 = createLogger("useExemptSettlor");
21734
21825
  const useExemptSettlor = ({
21735
- trust,
21826
+ trust: trust2,
21736
21827
  handleGetLegalEntity
21737
21828
  }) => {
21738
21829
  const [exemptSettlor, setExemptSettlor] = useState();
21739
21830
  const updateExemptSettlor = useCallback(async (trustLE) => {
21740
- const exemptSettlorAssociation = getOwnEntityAssociations(trustLE).find((association) => association.type === TrustMemberTypes.SETTLOR && Boolean(association.settlorExemptionReason));
21831
+ const exemptSettlorAssociation = getOwnEntityAssociations(trustLE).find((association2) => association2.type === TrustMemberTypes.SETTLOR && Boolean(association2.settlorExemptionReason));
21741
21832
  const exemptSettlorLE = (exemptSettlorAssociation == null ? void 0 : exemptSettlorAssociation.legalEntityId) ? await handleGetLegalEntity(exemptSettlorAssociation.legalEntityId) : void 0;
21742
21833
  setExemptSettlor(exemptSettlorLE);
21743
21834
  }, [handleGetLegalEntity]);
21744
21835
  useEffect(() => {
21745
- updateExemptSettlor(trust).catch(logger$9.error);
21746
- }, [trust, updateExemptSettlor]);
21836
+ updateExemptSettlor(trust2).catch(logger$9.error);
21837
+ }, [trust2, updateExemptSettlor]);
21747
21838
  return exemptSettlor;
21748
21839
  };
21749
21840
  function useSalesChannelsSettings() {
@@ -21838,7 +21929,7 @@ const splitAtFirstOccurrence = (str, separator) => {
21838
21929
  };
21839
21930
  const getTrustMemberOwnerId = (trustMemberId, entityAssociations) => {
21840
21931
  var _a;
21841
- return (_a = entityAssociations.find((association) => association.associatorId === trustMemberId && association.type === TrustMemberTypes.TRUSTEE)) == null ? void 0 : _a.legalEntityId;
21932
+ return (_a = entityAssociations.find((association2) => association2.associatorId === trustMemberId && association2.type === TrustMemberTypes.TRUSTEE)) == null ? void 0 : _a.legalEntityId;
21842
21933
  };
21843
21934
  const getFallbackName = (exemptSettlorAssociation) => {
21844
21935
  const [firstName2, lastName2] = splitAtFirstOccurrence(exemptSettlorAssociation.name ?? "", " ");
@@ -21847,37 +21938,37 @@ const getFallbackName = (exemptSettlorAssociation) => {
21847
21938
  lastName: lastName2
21848
21939
  };
21849
21940
  };
21850
- const convertEntityAssociationIntoTrustMember = (association, associations, exemptSettlorLE) => {
21941
+ const convertEntityAssociationIntoTrustMember = (association2, associations, exemptSettlorLE) => {
21851
21942
  var _a;
21852
- if (association.settlorExemptionReason) {
21943
+ if (association2.settlorExemptionReason) {
21853
21944
  return {
21854
21945
  trustMemberType: "exemptSettlor",
21855
21946
  roles: [TrustMemberTypes.SETTLOR],
21856
- legalEntityType: association.entityType,
21857
- legalEntityId: association.legalEntityId,
21858
- settlorExemptionReason: association.settlorExemptionReason,
21859
- exemptSettlorName: association.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association) : void 0,
21860
- name: association.name
21947
+ legalEntityType: association2.entityType,
21948
+ legalEntityId: association2.legalEntityId,
21949
+ settlorExemptionReason: association2.settlorExemptionReason,
21950
+ exemptSettlorName: association2.entityType === LegalEntityType.INDIVIDUAL ? ((_a = exemptSettlorLE == null ? void 0 : exemptSettlorLE.individual) == null ? void 0 : _a.name) ?? getFallbackName(association2) : void 0,
21951
+ name: association2.name
21861
21952
  };
21862
21953
  }
21863
- if (association.entityType === LegalEntityType.ORGANIZATION)
21954
+ if (association2.entityType === LegalEntityType.ORGANIZATION)
21864
21955
  return {
21865
21956
  trustMemberType: "company",
21866
21957
  roles: [],
21867
21958
  legalEntityType: LegalEntityType.ORGANIZATION,
21868
- legalEntityId: association.legalEntityId,
21869
- name: association.name,
21870
- ownerId: getTrustMemberOwnerId(association.legalEntityId, associations)
21959
+ legalEntityId: association2.legalEntityId,
21960
+ name: association2.name,
21961
+ ownerId: getTrustMemberOwnerId(association2.legalEntityId, associations)
21871
21962
  };
21872
- if (association.entityType === LegalEntityType.INDIVIDUAL)
21963
+ if (association2.entityType === LegalEntityType.INDIVIDUAL)
21873
21964
  return {
21874
21965
  trustMemberType: "regular",
21875
21966
  roles: [],
21876
21967
  legalEntityType: LegalEntityType.INDIVIDUAL,
21877
- legalEntityId: association.legalEntityId,
21878
- name: association.name
21968
+ legalEntityId: association2.legalEntityId,
21969
+ name: association2.name
21879
21970
  };
21880
- throw new Error(`Not a valid trust member: ${JSON.stringify(association)}`);
21971
+ throw new Error(`Not a valid trust member: ${JSON.stringify(association2)}`);
21881
21972
  };
21882
21973
  const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations, exemptSettlorLE) => {
21883
21974
  const mappedTrustMembers = entityAssociations.reduce((acc, entityAssociation) => {
@@ -21934,23 +22025,23 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
21934
22025
  };
21935
22026
  const addOrUpdateAssociatedTrustMember = async ({
21936
22027
  newOrUpdated,
21937
- trust,
22028
+ trust: trust2,
21938
22029
  handleUpdateLegalEntity
21939
22030
  }) => {
21940
- const otherAssociations = getOwnEntityAssociations(trust).filter((existingAssociation) => existingAssociation.legalEntityId !== newOrUpdated.legalEntityId);
22031
+ const otherAssociations = getOwnEntityAssociations(trust2).filter((existingAssociation) => existingAssociation.legalEntityId !== newOrUpdated.legalEntityId);
21941
22032
  const updatedAssociations = mapTrustMemberToEntityAssociations(newOrUpdated);
21942
22033
  const patchLE = {
21943
22034
  entityAssociations: [...otherAssociations, ...updatedAssociations]
21944
22035
  };
21945
- await handleUpdateLegalEntity(patchLE, trust.id);
22036
+ await handleUpdateLegalEntity(patchLE, trust2.id);
21946
22037
  };
21947
22038
  const addOrUpdateUndefinedBeneficiary = async ({
21948
22039
  newOrUpdated,
21949
- trust,
22040
+ trust: trust2,
21950
22041
  handleUpdateLegalEntity
21951
22042
  }) => {
21952
22043
  var _a, _b;
21953
- const otherUndefinedBeneficiaries = ((_b = (_a = trust.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) == null ? void 0 : _b.filter((ub) => ub.reference !== newOrUpdated.reference)) ?? [];
22044
+ const otherUndefinedBeneficiaries = ((_b = (_a = trust2.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) == null ? void 0 : _b.filter((ub) => ub.reference !== newOrUpdated.reference)) ?? [];
21954
22045
  const patchLE = {
21955
22046
  trust: {
21956
22047
  undefinedBeneficiaryInfo: [...otherUndefinedBeneficiaries, newOrUpdated.reference === isNewEntity ? {
@@ -21961,11 +22052,11 @@ const addOrUpdateUndefinedBeneficiary = async ({
21961
22052
  }]
21962
22053
  }
21963
22054
  };
21964
- await handleUpdateLegalEntity(patchLE, trust.id);
22055
+ await handleUpdateLegalEntity(patchLE, trust2.id);
21965
22056
  };
21966
22057
  const createExemptSettlor = async ({
21967
22058
  exemptSettlor,
21968
- trust,
22059
+ trust: trust2,
21969
22060
  handleCreateLegalEntity
21970
22061
  }) => {
21971
22062
  var _a, _b;
@@ -21977,7 +22068,7 @@ const createExemptSettlor = async ({
21977
22068
  lastName: ((_b = exemptSettlor.exemptSettlorName) == null ? void 0 : _b.lastName) ?? ""
21978
22069
  },
21979
22070
  residentialAddress: {
21980
- country: trust.trust.registeredAddress.country
22071
+ country: trust2.trust.registeredAddress.country
21981
22072
  }
21982
22073
  }
21983
22074
  };
@@ -22000,28 +22091,28 @@ const createOrganizationExemptSettlor = async ({
22000
22091
  };
22001
22092
  const deleteAssociatedTrustMember = async ({
22002
22093
  associatedTrustMember,
22003
- trust,
22094
+ trust: trust2,
22004
22095
  handleUpdateLegalEntity
22005
22096
  }) => {
22006
- const ownEntityAssociations = getOwnEntityAssociations(trust);
22097
+ const ownEntityAssociations = getOwnEntityAssociations(trust2);
22007
22098
  const updatedTrustAssociations = {
22008
22099
  entityAssociations: ownEntityAssociations.filter((entityAssociation) => entityAssociation.legalEntityId !== associatedTrustMember.legalEntityId)
22009
22100
  };
22010
- await handleUpdateLegalEntity(updatedTrustAssociations, trust.id);
22101
+ await handleUpdateLegalEntity(updatedTrustAssociations, trust2.id);
22011
22102
  };
22012
22103
  const deleteUndefinedBeneficiary = async ({
22013
22104
  undefinedBeneficiary: undefinedBeneficiary2,
22014
- trust,
22105
+ trust: trust2,
22015
22106
  handleUpdateLegalEntity
22016
22107
  }) => {
22017
22108
  var _a;
22018
- const existingUndefinedBeneficiaries = ((_a = trust.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [];
22109
+ const existingUndefinedBeneficiaries = ((_a = trust2.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [];
22019
22110
  const updatedTrust = {
22020
22111
  trust: {
22021
22112
  undefinedBeneficiaryInfo: existingUndefinedBeneficiaries.filter((ub) => ub.reference !== undefinedBeneficiary2.reference)
22022
22113
  }
22023
22114
  };
22024
- await handleUpdateLegalEntity(updatedTrust, trust.id);
22115
+ await handleUpdateLegalEntity(updatedTrust, trust2.id);
22025
22116
  };
22026
22117
  const exemptSettlorNamesTheSame = (existingSettlor, newSettlor) => JSON.stringify(existingSettlor.exemptSettlorName) === JSON.stringify(newSettlor.exemptSettlorName);
22027
22118
  const updateExemptSettlorName = async ({
@@ -22071,86 +22162,598 @@ function AccountSetupRejected() {
22071
22162
  content
22072
22163
  });
22073
22164
  }
22074
- const DecisionMakers = "";
22075
- const iconStatus = (current, min, max) => {
22076
- const isEmpty2 = current === 0;
22077
- const isWithinObligatoryRange = current === max || min > 0 && current >= min;
22078
- const isWithinConditionalRange = current >= min;
22079
- if (isEmpty2) {
22080
- return min > 0 ? "obligatoryEmpty" : "conditionalEmpty";
22081
- }
22082
- if (isWithinObligatoryRange) {
22083
- return "obligatoryFinished";
22084
- }
22085
- return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22086
- };
22087
- const entityStatusRoles = {
22088
- ...decisionMakerRoles,
22089
- ...trustMemberGuidanceRoles
22090
- };
22091
- const getEntityStatusTagColor = (entityLabel) => {
22092
- var _a;
22093
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22094
- };
22095
- const getEntityStatusName = (entityLabel) => {
22096
- var _a;
22097
- return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22165
+ const _businessTypeSelection_component = "";
22166
+ const _heading_component = "";
22167
+ const headingTypes = {
22168
+ 1: ({
22169
+ children,
22170
+ className
22171
+ }) => jsx("h1", {
22172
+ className,
22173
+ children
22174
+ }),
22175
+ 2: ({
22176
+ children,
22177
+ className
22178
+ }) => jsx("h2", {
22179
+ className,
22180
+ children
22181
+ }),
22182
+ 3: ({
22183
+ children,
22184
+ className
22185
+ }) => jsx("h3", {
22186
+ className,
22187
+ children
22188
+ }),
22189
+ 4: ({
22190
+ children,
22191
+ className
22192
+ }) => jsx("h4", {
22193
+ className,
22194
+ children
22195
+ }),
22196
+ sub: ({
22197
+ children,
22198
+ className
22199
+ }) => jsx("div", {
22200
+ className,
22201
+ children
22202
+ })
22098
22203
  };
22099
- const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22100
- const _cardGroup_component = "";
22101
- function CardGroup({
22204
+ function Heading({
22102
22205
  className,
22206
+ level,
22103
22207
  children
22104
22208
  }) {
22105
- return jsx("section", {
22106
- className: cx("adl-card-group", className),
22209
+ const HeadingElement = headingTypes[level] || headingTypes[1];
22210
+ const classNames = cx("adl-heading", `adl-heading--${level}`, className);
22211
+ return jsx(HeadingElement, {
22212
+ className: classNames,
22107
22213
  children
22108
22214
  });
22109
22215
  }
22110
- const _entityAssociation_component = "";
22111
- const Status$1 = "";
22112
- const Status = ({
22113
- text,
22114
- className,
22115
- iconStatusClass,
22116
- icon,
22117
- size = "small",
22118
- showText = true
22119
- }) => {
22120
- const containerClasses = cx("adl-status", className, {
22121
- "adl-status--with-text": showText
22122
- });
22123
- const iconClasses = cx("adl-status__icon", iconStatusClass, {
22124
- "adl-status__icon--large": size === "large"
22125
- });
22216
+ const _toast = "";
22217
+ function Toast({
22218
+ label,
22219
+ subLabel,
22220
+ actionLabel,
22221
+ type,
22222
+ duration = 3500,
22223
+ onToastHide,
22224
+ onToastAction
22225
+ }) {
22226
+ const toastRef = useRef(null);
22227
+ const loading2 = type === ToastType.LOADING;
22228
+ const successToast = type === ToastType.SUCCESS;
22229
+ const labelId = getUniqueId("toast");
22230
+ const handleShow = useCallback(() => {
22231
+ var _a;
22232
+ return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
22233
+ }, []);
22234
+ const handleHide = useCallback(() => {
22235
+ var _a;
22236
+ (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
22237
+ onToastHide();
22238
+ }, [onToastHide]);
22239
+ useEffect(() => {
22240
+ handleShow();
22241
+ if (duration !== "indefinite") {
22242
+ setTimeout(() => handleHide(), duration);
22243
+ }
22244
+ }, [label, duration, handleHide, handleShow]);
22126
22245
  return jsxs("div", {
22127
- className: containerClasses,
22128
- children: [jsx("span", {
22129
- className: iconClasses,
22130
- children: icon === "loading" ? jsx(Loader, {
22131
- size: size === "large" ? "small" : "xsmall",
22132
- dot: true
22133
- }) : jsx(Icon, {
22134
- name: icon
22246
+ ref: toastRef,
22247
+ role: actionLabel ? "alertdialog" : "alert",
22248
+ className: "adl-toast",
22249
+ "aria-labelledby": labelId,
22250
+ children: [loading2 && jsx("div", {
22251
+ className: "adl-toast__loader",
22252
+ children: jsx("div", {
22253
+ className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
22254
+ })
22255
+ }), !loading2 && jsxs("div", {
22256
+ className: cx("adl-toast__status", {
22257
+ "adl-toast__status--success": successToast,
22258
+ "adl-toast__status--error": !successToast
22259
+ }),
22260
+ children: [successToast && jsx(Icon, {
22261
+ className: "adl-toast__status-icon",
22262
+ name: "checkmark"
22263
+ }), !successToast && jsx(Icon, {
22264
+ className: "adl-toast__status-icon",
22265
+ name: "cross"
22266
+ })]
22267
+ }), jsxs("div", {
22268
+ className: "adl-toast__message",
22269
+ children: [jsx("span", {
22270
+ id: labelId,
22271
+ className: "adl-toast__title",
22272
+ children: label
22273
+ }), actionLabel && jsx("button", {
22274
+ className: "adl-link adl-toast__action",
22275
+ title: "performAction",
22276
+ type: "button",
22277
+ onClick: onToastAction,
22278
+ children: actionLabel
22279
+ }), !loading2 && subLabel && jsx("span", {
22280
+ className: "adl-toast__subtitle",
22281
+ children: subLabel
22282
+ })]
22283
+ }), !loading2 && jsx("button", {
22284
+ className: "adl-toast__close",
22285
+ title: "close",
22286
+ type: "button",
22287
+ onClick: handleHide,
22288
+ children: jsx(Icon, {
22289
+ name: "cross"
22135
22290
  })
22136
- }), showText && jsx("span", {
22137
- className: "adl-status__text",
22138
- children: text
22139
22291
  })]
22140
22292
  });
22293
+ }
22294
+ const businessTypes = [{
22295
+ id: "individual",
22296
+ accountHolder: "myName",
22297
+ name: "individual",
22298
+ description: "youAreNotSoleProprietorAndUseBankAccount"
22299
+ }, {
22300
+ id: "soleProprietorship",
22301
+ accountHolder: "mySoleProprietorName",
22302
+ name: "soleProprietorship",
22303
+ description: "youAreRegisteredSoleProprietorAndUseBankAccount"
22304
+ }, {
22305
+ id: "company",
22306
+ accountHolder: "theCompanyIWorkFor",
22307
+ name: "company",
22308
+ description: "youUseCompanyBankAccount"
22309
+ }, {
22310
+ id: "legalArrangement",
22311
+ name: "trustPartnershipOrAssociation",
22312
+ description: "youAreIndividualOrCompanyAndUseBankAccountInNameOfTrustPartnershipOrAssociation"
22313
+ }];
22314
+ const legalArrangementItems = [{
22315
+ id: "aTrust",
22316
+ accountHolder: "aTrust",
22317
+ name: "trust",
22318
+ description: "youAreTrusteeManagingTheTrustForBeneficiaries"
22319
+ }, {
22320
+ id: "aPartnership",
22321
+ accountHolder: "aPartnership",
22322
+ name: "partnership",
22323
+ description: "jointlyOwnedBusinessWhereTwoOrMorePeopleOperateAndShareProfits"
22324
+ }, {
22325
+ id: "anAssociation",
22326
+ accountHolder: "anAssociation",
22327
+ name: "association",
22328
+ description: "groupOfPeopleActingTogetherForNonCommercialPurpose"
22329
+ }];
22330
+ const trusteeTypeItems = [{
22331
+ id: "individual",
22332
+ name: "individual"
22333
+ }, {
22334
+ id: "company",
22335
+ name: "company"
22336
+ }];
22337
+ const getFormSchema = (isLegalArrangement, isTrust) => {
22338
+ const schema = ["businessType"];
22339
+ if (isLegalArrangement) {
22340
+ schema.push("legalArrangement");
22341
+ }
22342
+ if (isTrust) {
22343
+ schema.push("trusteeType");
22344
+ }
22345
+ return schema;
22141
22346
  };
22142
- const TaskItemStatus = ({
22143
- status,
22144
- downloadHandler,
22145
- size = "small",
22146
- showText = true
22147
- }) => {
22148
- const {
22149
- i18n
22150
- } = useI18nContext();
22151
- const handleDownloadClick = (e) => {
22152
- e.stopPropagation();
22153
- downloadHandler == null ? void 0 : downloadHandler();
22347
+ const getBusinessTypes = (includeTrust, includeSoleProp) => businessTypes.filter((businessType) => {
22348
+ if (businessType.id === "legalArrangement") {
22349
+ return includeTrust;
22350
+ }
22351
+ if (businessType.id === "soleProprietorship") {
22352
+ return includeSoleProp;
22353
+ }
22354
+ return true;
22355
+ });
22356
+ const businessTypeSelectionValidationRules = {
22357
+ businessType: {
22358
+ modes: ["blur"],
22359
+ validate: (businessType) => !!businessType,
22360
+ errorMessage: "fieldIsRequired"
22361
+ },
22362
+ legalArrangement: {
22363
+ modes: ["blur"],
22364
+ validate: (legalArrangement) => !!legalArrangement,
22365
+ errorMessage: "fieldIsRequired"
22366
+ },
22367
+ trusteeType: {
22368
+ modes: ["blur"],
22369
+ validate: (trusteeType) => !!trusteeType,
22370
+ errorMessage: "fieldIsRequired"
22371
+ }
22372
+ };
22373
+ const businessTypeSelectionStepTitles = {
22374
+ [
22375
+ 0
22376
+ /* BUSINESS_TYPE_SELECTION */
22377
+ ]: "whatBestDescribesYourBusinessSetup",
22378
+ [
22379
+ 1
22380
+ /* LEGAL_ARRANGEMENT_SELECTION */
22381
+ ]: "whichLegalArrangementDoesYourBusinessHave",
22382
+ [
22383
+ 2
22384
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22385
+ ]: "sorryWeCantSetUpAnAccountForYou",
22386
+ [
22387
+ 3
22388
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22389
+ ]: "changeYourBusinessSetup"
22390
+ };
22391
+ const getTargetLegalEntityType = (businessType, legalArrangement, trusteeType, currentLegalEntityType) => {
22392
+ const isIndividual = currentLegalEntityType === LegalEntityType.INDIVIDUAL;
22393
+ const isOrganization = currentLegalEntityType === LegalEntityType.ORGANIZATION;
22394
+ if (isIndividual && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "company" || businessType === "company") {
22395
+ return LegalEntityType.ORGANIZATION;
22396
+ }
22397
+ if (isOrganization && businessType === "legalArrangement" && legalArrangement === "aTrust" && trusteeType === "individual" || businessType === "individual" || businessType === "soleProprietorship") {
22398
+ return LegalEntityType.INDIVIDUAL;
22399
+ }
22400
+ return currentLegalEntityType;
22401
+ };
22402
+ const BusinessTypeSelection = ({
22403
+ legalEntityResponse,
22404
+ accountHolder: accountHolder2,
22405
+ showTrustOption,
22406
+ showSolePropOption,
22407
+ onAccountHolderSelect,
22408
+ handleUpdateLegalEntity
22409
+ }) => {
22410
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
22411
+ const {
22412
+ i18n
22413
+ } = useI18nContext();
22414
+ const {
22415
+ showToast
22416
+ } = useToastContext();
22417
+ const [loadingStatus, setLoadingStatus] = useState();
22418
+ const [currentStep, setCurrentStep] = useState(
22419
+ 0
22420
+ /* BUSINESS_TYPE_SELECTION */
22421
+ );
22422
+ const [formSchema, setFormSchema] = useState(["businessType"]);
22423
+ const hasBackButton = [
22424
+ 1,
22425
+ 2
22426
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22427
+ ].includes(currentStep);
22428
+ const businessTypeItems = getBusinessTypes(showTrustOption, showSolePropOption);
22429
+ const getDefaultBusinessType = () => {
22430
+ if (accountHolder2) {
22431
+ if (["aTrust", "aPartnership", "anAssociation"].includes(accountHolder2)) {
22432
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "legalArrangement");
22433
+ }
22434
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.accountHolder === accountHolder2);
22435
+ }
22436
+ switch (legalEntityResponse.type) {
22437
+ case LegalEntityType.ORGANIZATION:
22438
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "company");
22439
+ case LegalEntityType.INDIVIDUAL:
22440
+ return businessTypeItems.find((businessTypeItem) => businessTypeItem.id === "individual");
22441
+ }
22442
+ };
22443
+ const getDefaultLegalArrangementType = () => accountHolder2 && legalArrangementItems.find((item) => item.accountHolder === accountHolder2);
22444
+ const defaultTrusteeType = legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? trusteeTypeItems[0] : trusteeTypeItems[1];
22445
+ const {
22446
+ handleChangeFor,
22447
+ triggerValidation,
22448
+ data,
22449
+ valid,
22450
+ errors,
22451
+ isValid
22452
+ } = useForm({
22453
+ schema: formSchema,
22454
+ defaultData: {
22455
+ businessType: getDefaultBusinessType(),
22456
+ legalArrangement: getDefaultLegalArrangementType(),
22457
+ trusteeType: defaultTrusteeType
22458
+ },
22459
+ rules: businessTypeSelectionValidationRules
22460
+ });
22461
+ const newAccountHolder = ((_a = data.businessType) == null ? void 0 : _a.accountHolder) || ((_b = data.legalArrangement) == null ? void 0 : _b.accountHolder);
22462
+ 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);
22463
+ useEffect(() => {
22464
+ var _a2, _b2;
22465
+ setFormSchema(getFormSchema(((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement" && !!data.legalArrangement || currentStep === 1, ((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aTrust"));
22466
+ }, [data.businessType, data.legalArrangement, currentStep]);
22467
+ const handleNextClick = async () => {
22468
+ var _a2, _b2, _c2;
22469
+ if (loadingStatus === "loading")
22470
+ return;
22471
+ triggerValidation();
22472
+ if (isValid) {
22473
+ if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
22474
+ if (currentStep !== 1) {
22475
+ setCurrentStep(
22476
+ 1
22477
+ /* LEGAL_ARRANGEMENT_SELECTION */
22478
+ );
22479
+ return;
22480
+ }
22481
+ if (((_b2 = data.legalArrangement) == null ? void 0 : _b2.id) === "aPartnership" || ((_c2 = data.legalArrangement) == null ? void 0 : _c2.id) === "anAssociation") {
22482
+ setCurrentStep(
22483
+ 2
22484
+ /* WE_CANNOT_SET_UP_ACCOUNT */
22485
+ );
22486
+ return;
22487
+ }
22488
+ }
22489
+ }
22490
+ if (newAccountHolder !== accountHolder2 || targetLegalEntityType !== legalEntityResponse.type) {
22491
+ if (accountHolder2) {
22492
+ setCurrentStep(
22493
+ 3
22494
+ /* CONFIRM_BUSINESS_SETUP_CHANGE */
22495
+ );
22496
+ } else {
22497
+ await updateLegalEntityAndSelectAccountHolder();
22498
+ }
22499
+ } else {
22500
+ onAccountHolderSelect(newAccountHolder);
22501
+ }
22502
+ };
22503
+ const updateLegalEntityAndSelectAccountHolder = async () => {
22504
+ try {
22505
+ if (legalEntityResponse.type !== targetLegalEntityType) {
22506
+ setLoadingStatus("loading");
22507
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
22508
+ type: targetLegalEntityType,
22509
+ entityAssociations: []
22510
+ }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
22511
+ }
22512
+ } catch (e) {
22513
+ showToast({
22514
+ label: i18n.get("failedToUpdateDetails"),
22515
+ type: ToastType.ERROR
22516
+ });
22517
+ } finally {
22518
+ setLoadingStatus("success");
22519
+ onAccountHolderSelect(newAccountHolder);
22520
+ }
22521
+ };
22522
+ const handleBackClick = () => {
22523
+ if (currentStep === 2) {
22524
+ setCurrentStep(
22525
+ 1
22526
+ /* LEGAL_ARRANGEMENT_SELECTION */
22527
+ );
22528
+ }
22529
+ if (currentStep === 1) {
22530
+ setCurrentStep(
22531
+ 0
22532
+ /* BUSINESS_TYPE_SELECTION */
22533
+ );
22534
+ }
22535
+ };
22536
+ const isWeCannotSetUpAccountStep = currentStep === 2;
22537
+ return jsx(LoaderWrapper, {
22538
+ status: loadingStatus,
22539
+ formOpacityWhenLoading: 0.3,
22540
+ showSpinner: false,
22541
+ children: jsxs("div", {
22542
+ className: "adyen-kyc-business-type-selection",
22543
+ children: [jsx("header", {
22544
+ children: jsx(Heading, {
22545
+ level: 1,
22546
+ children: i18n.get(businessTypeSelectionStepTitles[currentStep])
22547
+ })
22548
+ }), currentStep === 0 && jsx(Field, {
22549
+ name: "businessType",
22550
+ useLabelElement: false,
22551
+ errorMessage: i18n.get((_f = errors.businessType) == null ? void 0 : _f.errorMessage),
22552
+ showErrorIconBottom: true,
22553
+ isValid: valid.businessType,
22554
+ children: (childProps) => jsx(RadioGroupCard, {
22555
+ ...childProps,
22556
+ name: "businessType",
22557
+ items: businessTypeItems,
22558
+ selected: businessTypeItems.find((type) => {
22559
+ var _a2;
22560
+ return type.id === ((_a2 = data.businessType) == null ? void 0 : _a2.id);
22561
+ }),
22562
+ onSelect: (item) => handleChangeFor("businessType")(item)
22563
+ })
22564
+ }), currentStep === 1 && jsxs(Fragment, {
22565
+ children: [jsx(Field, {
22566
+ name: "legalArrangement",
22567
+ useLabelElement: false,
22568
+ errorMessage: i18n.get((_g = errors.legalArrangement) == null ? void 0 : _g.errorMessage),
22569
+ showErrorIconBottom: true,
22570
+ isValid: valid.legalArrangement,
22571
+ children: (childProps) => jsx(RadioGroupCard, {
22572
+ ...childProps,
22573
+ name: "legalArrangement",
22574
+ items: legalArrangementItems,
22575
+ selected: legalArrangementItems.find((legalArrangementItem) => {
22576
+ var _a2;
22577
+ return legalArrangementItem.id === ((_a2 = data.legalArrangement) == null ? void 0 : _a2.id);
22578
+ }),
22579
+ onSelect: (item) => handleChangeFor("legalArrangement")(item)
22580
+ })
22581
+ }), ((_h = data.legalArrangement) == null ? void 0 : _h.id) === "aTrust" && jsx(Field, {
22582
+ name: "trusteeType",
22583
+ label: i18n.get("whatTypeOfTrusteeAreYou"),
22584
+ className: "adl-u-margin-top-32",
22585
+ useLabelElement: false,
22586
+ errorMessage: i18n.get((_i = errors.trusteeType) == null ? void 0 : _i.errorMessage),
22587
+ showErrorIconBottom: true,
22588
+ isValid: valid.trusteeType,
22589
+ children: (childProps) => jsx(RadioGroupCard, {
22590
+ className: "adyen-kyc-trustee-type-radio-group-card",
22591
+ itemLabelClassName: () => "adl-u-width-full",
22592
+ ...childProps,
22593
+ name: "trusteeType",
22594
+ items: trusteeTypeItems,
22595
+ selected: trusteeTypeItems.find((type) => {
22596
+ var _a2;
22597
+ return type.id === ((_a2 = data.trusteeType) == null ? void 0 : _a2.id);
22598
+ }),
22599
+ onSelect: (item) => handleChangeFor("trusteeType")(item)
22600
+ })
22601
+ })]
22602
+ }), isWeCannotSetUpAccountStep && jsxs(Fragment, {
22603
+ children: [jsx("p", {
22604
+ children: i18n.get("ourFinancialServicesAreNotAvailableYetForPartnershipsAndAssociations")
22605
+ }), jsx("p", {
22606
+ className: "u-margin-top-32",
22607
+ children: i18n.get("needHelpYouCanAlwaysReachOutToCustomerSupport")
22608
+ })]
22609
+ }), currentStep === 3 ? jsxs(Fragment, {
22610
+ children: [jsx("p", {
22611
+ children: i18n.get("someInformationWillNotBeSaved")
22612
+ }), jsxs("div", {
22613
+ className: "adyen-kyc-business-type-selection__confirm",
22614
+ children: [jsx(Button, {
22615
+ label: i18n.get("cancel"),
22616
+ secondary: true,
22617
+ onClick: () => setCurrentStep(
22618
+ 0
22619
+ /* BUSINESS_TYPE_SELECTION */
22620
+ ),
22621
+ type: "button"
22622
+ }), jsx(Button, {
22623
+ label: i18n.get("yesChange"),
22624
+ onClick: () => updateLegalEntityAndSelectAccountHolder(),
22625
+ type: "button"
22626
+ })]
22627
+ })]
22628
+ }) : jsxs("div", {
22629
+ className: "adyen-kyc-business-type-selection__nav",
22630
+ children: [!isWeCannotSetUpAccountStep && jsx(Button, {
22631
+ label: i18n.get("next"),
22632
+ block: true,
22633
+ disabled: currentStep === 1 && !data.legalArrangement,
22634
+ onClick: handleNextClick,
22635
+ type: "button"
22636
+ }), hasBackButton && jsx(Button, {
22637
+ label: i18n.get("back"),
22638
+ showAsLink: !isWeCannotSetUpAccountStep,
22639
+ block: isWeCannotSetUpAccountStep,
22640
+ onClick: handleBackClick,
22641
+ type: "button",
22642
+ className: "adl-u-margin-top-16"
22643
+ })]
22644
+ })]
22645
+ })
22646
+ });
22647
+ };
22648
+ const DecisionMakers = "";
22649
+ function useDataMissingRemediations({
22650
+ legalEntityId,
22651
+ problems
22652
+ }) {
22653
+ const {
22654
+ i18n
22655
+ } = useI18nContext();
22656
+ const decisionMakersRemediationMessage = useMemo(() => {
22657
+ var _a, _b, _c;
22658
+ const remediationCodes = (_c = (_b = (_a = problems[EntityType.LEGAL_ENTITY]) == null ? void 0 : _a[legalEntityId]) == null ? void 0 : _b.missingData) == null ? void 0 : _c.reduce((remediations, error) => {
22659
+ const remediation = DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING[error.code];
22660
+ return remediation ? [...remediations, remediation] : remediations;
22661
+ }, []);
22662
+ switch (remediationCodes == null ? void 0 : remediationCodes.length) {
22663
+ case void 0:
22664
+ case 0:
22665
+ return void 0;
22666
+ case 1:
22667
+ return remediationCodes[0] ? i18n.get(`remediationMessage_${remediationCodes[0]}`) : i18n.get("missingMultipleDecisionMakers");
22668
+ default:
22669
+ return i18n.get("missingMultipleDecisionMakers");
22670
+ }
22671
+ }, [problems, i18n, legalEntityId]);
22672
+ return {
22673
+ remediationMessages: {
22674
+ [TaskTypes.DECISION_MAKER]: decisionMakersRemediationMessage
22675
+ }
22676
+ };
22677
+ }
22678
+ const iconStatus = (current, min, max) => {
22679
+ const isEmpty2 = current === 0;
22680
+ const isWithinObligatoryRange = current === max || min > 0 && current >= min;
22681
+ const isWithinConditionalRange = current >= min;
22682
+ if (isEmpty2) {
22683
+ return min > 0 ? "obligatoryEmpty" : "conditionalEmpty";
22684
+ }
22685
+ if (isWithinObligatoryRange) {
22686
+ return "obligatoryFinished";
22687
+ }
22688
+ return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
22689
+ };
22690
+ const entityStatusRoles = {
22691
+ ...decisionMakerRoles,
22692
+ ...trustMemberGuidanceRoles
22693
+ };
22694
+ const getEntityStatusTagColor = (entityLabel) => {
22695
+ var _a;
22696
+ return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.className;
22697
+ };
22698
+ const getEntityStatusName = (entityLabel) => {
22699
+ var _a;
22700
+ return (_a = entityStatusRoles[entityLabel]) == null ? void 0 : _a.name;
22701
+ };
22702
+ const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
22703
+ const _cardGroup_component = "";
22704
+ function CardGroup({
22705
+ className,
22706
+ children
22707
+ }) {
22708
+ return jsx("section", {
22709
+ className: cx("adl-card-group", className),
22710
+ children
22711
+ });
22712
+ }
22713
+ const _entityAssociation_component = "";
22714
+ const Status$1 = "";
22715
+ const Status = ({
22716
+ text,
22717
+ className,
22718
+ iconStatusClass,
22719
+ icon,
22720
+ size = "small",
22721
+ showText = true
22722
+ }) => {
22723
+ const containerClasses = cx("adl-status", className, {
22724
+ "adl-status--with-text": showText
22725
+ });
22726
+ const iconClasses = cx("adl-status__icon", iconStatusClass, {
22727
+ "adl-status__icon--large": size === "large"
22728
+ });
22729
+ return jsxs("div", {
22730
+ className: containerClasses,
22731
+ children: [jsx("span", {
22732
+ className: iconClasses,
22733
+ children: icon === "loading" ? jsx(Loader, {
22734
+ size: size === "large" ? "small" : "xsmall",
22735
+ dot: true
22736
+ }) : jsx(Icon, {
22737
+ name: icon
22738
+ })
22739
+ }), showText && jsx("span", {
22740
+ className: "adl-status__text",
22741
+ children: text
22742
+ })]
22743
+ });
22744
+ };
22745
+ const TaskItemStatus = ({
22746
+ status,
22747
+ downloadHandler,
22748
+ size = "small",
22749
+ showText = true
22750
+ }) => {
22751
+ const {
22752
+ i18n
22753
+ } = useI18nContext();
22754
+ const handleDownloadClick = (e) => {
22755
+ e.stopPropagation();
22756
+ downloadHandler == null ? void 0 : downloadHandler();
22154
22757
  };
22155
22758
  switch (status) {
22156
22759
  case TaskStatus.DOWNLOAD:
@@ -22271,56 +22874,6 @@ const VerificationErrorAlert = ({
22271
22874
  });
22272
22875
  };
22273
22876
  const _card_component = "";
22274
- const _heading_component = "";
22275
- const headingTypes = {
22276
- 1: ({
22277
- children,
22278
- className
22279
- }) => jsx("h1", {
22280
- className,
22281
- children
22282
- }),
22283
- 2: ({
22284
- children,
22285
- className
22286
- }) => jsx("h2", {
22287
- className,
22288
- children
22289
- }),
22290
- 3: ({
22291
- children,
22292
- className
22293
- }) => jsx("h3", {
22294
- className,
22295
- children
22296
- }),
22297
- 4: ({
22298
- children,
22299
- className
22300
- }) => jsx("h4", {
22301
- className,
22302
- children
22303
- }),
22304
- sub: ({
22305
- children,
22306
- className
22307
- }) => jsx("div", {
22308
- className,
22309
- children
22310
- })
22311
- };
22312
- function Heading({
22313
- className,
22314
- level,
22315
- children
22316
- }) {
22317
- const HeadingElement = headingTypes[level] || headingTypes[1];
22318
- const classNames = cx("adl-heading", `adl-heading--${level}`, className);
22319
- return jsx(HeadingElement, {
22320
- className: classNames,
22321
- children
22322
- });
22323
- }
22324
22877
  function Card({
22325
22878
  className,
22326
22879
  children,
@@ -22689,6 +23242,12 @@ const DecisionMakersComponent = ({
22689
23242
  const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
22690
23243
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
22691
23244
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
23245
+ const {
23246
+ remediationMessages
23247
+ } = useDataMissingRemediations({
23248
+ legalEntityId: legalEntityResponse.id,
23249
+ problems: capabilityProblems
23250
+ });
22692
23251
  const mappedDecisionMakers = decisionMakers2 == null ? void 0 : decisionMakers2.reduce((mappedDecisionMakers2, decisionMaker2) => {
22693
23252
  var _a2;
22694
23253
  const mappedDecisionMaker = mappedDecisionMakers2[decisionMaker2.legalEntityId];
@@ -22807,7 +23366,12 @@ const DecisionMakersComponent = ({
22807
23366
  isRemoveDisabled,
22808
23367
  handleIsRemoveDisabled: setIsRemoveDisabled
22809
23368
  }, decisionMaker2.reference))
22810
- }) : null, jsx(Button, {
23369
+ }) : null, remediationMessages.DECISION_MAKER && jsx(Alert, {
23370
+ className: "adl-decision-makers__warning",
23371
+ title: remediationMessages.DECISION_MAKER,
23372
+ hasCloseButton: false,
23373
+ type: AlertTypes.WARNING
23374
+ }), jsx(Button, {
22811
23375
  secondary: true,
22812
23376
  className: cx("adl-decision-makers__add", {
22813
23377
  "adl-decision-makers__add--more": (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0
@@ -23133,6 +23697,45 @@ const TaskIntros = ({
23133
23697
  }) : null;
23134
23698
  };
23135
23699
  const TaskList = "";
23700
+ const businessTypeMapping = {
23701
+ myName: {
23702
+ [LegalEntityType.INDIVIDUAL]: "individual"
23703
+ /* INDIVIDUAL */
23704
+ },
23705
+ theCompanyIWorkFor: {
23706
+ [LegalEntityType.ORGANIZATION]: "company"
23707
+ /* COMPANY */
23708
+ },
23709
+ mySoleProprietorName: {
23710
+ [LegalEntityType.INDIVIDUAL]: "soleProprietorship"
23711
+ /* SOLE_PROPRIETORSHIP */
23712
+ },
23713
+ aTrust: {
23714
+ [LegalEntityType.INDIVIDUAL]: "individualTrustee",
23715
+ [LegalEntityType.ORGANIZATION]: "companyTrustee"
23716
+ /* COMPANY_TRUSTEE */
23717
+ }
23718
+ };
23719
+ const useBusinessSetup = (legalEntityResponse) => {
23720
+ var _a;
23721
+ const {
23722
+ accountHolder: accountHolder2
23723
+ } = useCoreContext();
23724
+ const accountHolderType = accountHolder2 || getDefaultAccountHolderType(legalEntityResponse);
23725
+ const businessSetup = (_a = businessTypeMapping[accountHolderType]) == null ? void 0 : _a[legalEntityResponse == null ? void 0 : legalEntityResponse.type];
23726
+ return {
23727
+ businessSetup
23728
+ };
23729
+ };
23730
+ const useEnableNewEntryFlow = () => {
23731
+ const {
23732
+ isSettingEnabled
23733
+ } = useSettingsContext();
23734
+ const {
23735
+ isExperimentEnabled
23736
+ } = useExperimentsContext();
23737
+ return isSettingEnabled(SettingNames.AllowLegalEntityTypeChange) && isExperimentEnabled("EnableNewEntryFlow");
23738
+ };
23136
23739
  const hasPayoutAccount = (legalEntityResponse) => {
23137
23740
  var _a;
23138
23741
  return Boolean((_a = legalEntityResponse.transferInstruments) == null ? void 0 : _a.length);
@@ -23150,6 +23753,7 @@ const TaskListItem = ({
23150
23753
  info,
23151
23754
  loading: loading2 = false,
23152
23755
  showErrorAlerts = "onErrorStatus",
23756
+ showWarningAlert = false,
23153
23757
  removeEntity,
23154
23758
  isRemoveDisabled = false,
23155
23759
  handleIsRemoveDisabled
@@ -23160,7 +23764,9 @@ const TaskListItem = ({
23160
23764
  stateful: onNavigateToTask && !loading2 && !disabled,
23161
23765
  onClick: loading2 ? void 0 : onNavigateToTask,
23162
23766
  onKeyDown: handleKeys(["Enter"], onNavigateToTask ?? noop),
23163
- className: "adyen-task",
23767
+ className: cx("adyen-task", {
23768
+ "adyen-task--warning": showWarningAlert
23769
+ }),
23164
23770
  disabled,
23165
23771
  children: jsxs(LoaderWrapper, {
23166
23772
  status: loading2 ? "loading" : "success",
@@ -23231,6 +23837,9 @@ const PayoutAccountTaskListItem = ({
23231
23837
  const {
23232
23838
  i18n
23233
23839
  } = useI18nContext();
23840
+ const {
23841
+ isExperimentEnabled
23842
+ } = useExperimentsContext();
23234
23843
  const [isDeletingTransferInstrument, setIsDeletingTransferInstrument] = useState(false);
23235
23844
  const isInstantVerificationAccount = isInstantVerifiedAccount(account);
23236
23845
  const [isRemoveDisabled, setIsRemoveDisabled] = useState(false);
@@ -23241,7 +23850,7 @@ const PayoutAccountTaskListItem = ({
23241
23850
  onNavigateToTask: isInstantVerificationAccount ? void 0 : onNavigateToTask,
23242
23851
  icon: "payout",
23243
23852
  title: maskedAccountNumber,
23244
- tagline: i18n.get("payoutDetails"),
23853
+ tagline: isExperimentEnabled("EnableNewEntryFlow") ? void 0 : i18n.get("payoutDetails"),
23245
23854
  status,
23246
23855
  problems: (_a = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _a[account.id],
23247
23856
  loading: isDeletingTransferInstrument,
@@ -23294,12 +23903,22 @@ function TaskListComponent({
23294
23903
  const {
23295
23904
  i18n
23296
23905
  } = useI18nContext();
23906
+ const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
23297
23907
  const {
23298
23908
  isExperimentEnabled
23299
23909
  } = useExperimentsContext();
23300
23910
  const {
23301
23911
  canSeeIntro
23302
23912
  } = useCanSeeIntro(legalEntityResponse);
23913
+ const {
23914
+ remediationMessages
23915
+ } = useDataMissingRemediations({
23916
+ legalEntityId: legalEntityResponse.id,
23917
+ problems: capabilityProblems
23918
+ });
23919
+ const {
23920
+ businessSetup
23921
+ } = useBusinessSetup(legalEntityResponse);
23303
23922
  const hasTaskOfGroupAccountDetails = tasks.some((task) => LEGAL_ENTITY_BASE_TASKS.includes(task));
23304
23923
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
23305
23924
  const hasContractTasks = tasks.some((task) => CONTRACT_TASKS.includes(task));
@@ -23339,9 +23958,33 @@ function TaskListComponent({
23339
23958
  showAsLink: true,
23340
23959
  type: "button"
23341
23960
  })
23961
+ }), isEnableNewEntryFlowEnabled && jsxs("header", {
23962
+ className: "adyen-task-list__heading",
23963
+ children: [jsx(Heading, {
23964
+ level: 1,
23965
+ children: i18n.get("setUpYourAccount")
23966
+ }), jsxs(Heading, {
23967
+ level: "sub",
23968
+ children: [jsx("span", {
23969
+ className: "adl-u-font-weight-semi-bold",
23970
+ children: i18n.get("yourBusinessSetup", {
23971
+ values: {
23972
+ businessSetup: i18n.get(businessSetup)
23973
+ }
23974
+ })
23975
+ }), jsx(Button, {
23976
+ title: i18n.get("edit"),
23977
+ icon: "edit",
23978
+ ghost: true,
23979
+ circle: true,
23980
+ onClick: () => onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION),
23981
+ className: "adl-u-margin-left-4",
23982
+ type: "button"
23983
+ })]
23984
+ })]
23342
23985
  }), jsxs("div", {
23343
23986
  children: [hasTaskOfGroupAccountDetails && jsxs(TaskListGroup, {
23344
- title: isCompany ? i18n.get(companyTaskDescriptionKey) : i18n.get("accountDetailsDescription"),
23987
+ title: isCompany ? i18n.get(companyTaskDescriptionKey) : i18n.get(isEnableNewEntryFlowEnabled ? "provideFewDetailsAboutYourself" : "accountDetailsDescription"),
23345
23988
  children: [tasks.includes(TaskTypes.INDIVIDUAL) && jsx(TaskListItem, {
23346
23989
  onNavigateToTask: handleOnNavigateToTaskIndividual,
23347
23990
  icon: "decision-maker",
@@ -23351,7 +23994,7 @@ function TaskListComponent({
23351
23994
  }), hasSoleProprietorship && jsx(TaskListItem, {
23352
23995
  onNavigateToTask: handleOnNavigateToSoleProp,
23353
23996
  icon: "company",
23354
- title: i18n.get("soleProprietorDetails"),
23997
+ title: i18n.get(isEnableNewEntryFlowEnabled ? "soleProprietorshipDetails" : "soleProprietorDetails"),
23355
23998
  status: getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnSoleProprietorshipIdArray(legalEntityResponse)),
23356
23999
  problems: getOwnSolePropProblems(legalEntityResponse, capabilityProblems)
23357
24000
  }), tasks.includes(TaskTypes.COMPANY) && jsx(TaskListItem, {
@@ -23360,11 +24003,19 @@ function TaskListComponent({
23360
24003
  title: hasTrust ? i18n.get("companyTrusteeDetails") : i18n.get("companyDetails"),
23361
24004
  status: getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, [legalEntityResponse.id]),
23362
24005
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _f[legalEntityResponse.id]
23363
- }), tasks.includes(TaskTypes.DECISION_MAKER) && jsx(TaskListItem, {
23364
- onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
23365
- icon: "decision-maker",
23366
- title: i18n.get("decisionMakers"),
23367
- status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnDecisionMakersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
24006
+ }), tasks.includes(TaskTypes.DECISION_MAKER) && jsxs(Fragment, {
24007
+ children: [jsx(TaskListItem, {
24008
+ onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
24009
+ icon: "decision-maker",
24010
+ title: i18n.get("decisionMakers"),
24011
+ status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnDecisionMakersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED,
24012
+ showWarningAlert: Boolean(remediationMessages.DECISION_MAKER)
24013
+ }), remediationMessages.DECISION_MAKER && jsx(Alert, {
24014
+ className: "adyen-task-list__warning",
24015
+ title: remediationMessages.DECISION_MAKER,
24016
+ hasCloseButton: false,
24017
+ type: AlertTypes.WARNING
24018
+ })]
23368
24019
  })]
23369
24020
  }), hasTrust && jsxs(TaskListGroup, {
23370
24021
  title: i18n.get("trustDetailsDescription"),
@@ -23381,7 +24032,7 @@ function TaskListComponent({
23381
24032
  status: hasMinRequiredTrustMemberCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
23382
24033
  })]
23383
24034
  }), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && jsx(TaskListGroup, {
23384
- title: i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
24035
+ title: isEnableNewEntryFlowEnabled ? i18n.get("letUsKnowTheBankAccountToSendReceiveFunds") : i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
23385
24036
  children: transferInstruments.length > 0 ? jsxs(Fragment, {
23386
24037
  children: [transferInstruments.map((transferInstrument) => jsx(PayoutAccountTaskListItem, {
23387
24038
  account: transferInstrument,
@@ -23398,13 +24049,13 @@ function TaskListComponent({
23398
24049
  name: "plus",
23399
24050
  className: "adl-u-padding-top-2 adl-u-margin-right-8"
23400
24051
  }), jsx("span", {
23401
- children: i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
24052
+ children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
23402
24053
  })]
23403
24054
  })]
23404
24055
  }) : jsx(TaskListItem, {
23405
24056
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
23406
24057
  icon: "payout",
23407
- title: i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
24058
+ title: isEnableNewEntryFlowEnabled ? i18n.get("bankAccountDetails") : i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
23408
24059
  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,
23409
24060
  disabled: !canAddPayoutAccount,
23410
24061
  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]
@@ -23749,84 +24400,6 @@ const omitMaskedFieldsIfUnchanged = (maskedFields, dataSubmitted, savedData) =>
23749
24400
  });
23750
24401
  return filtered;
23751
24402
  };
23752
- const _toast = "";
23753
- function Toast({
23754
- label,
23755
- subLabel,
23756
- actionLabel,
23757
- type,
23758
- duration = 3500,
23759
- onToastHide,
23760
- onToastAction
23761
- }) {
23762
- const toastRef = useRef(null);
23763
- const loading2 = type === ToastType.LOADING;
23764
- const successToast = type === ToastType.SUCCESS;
23765
- const labelId = getUniqueId("toast");
23766
- const handleShow = useCallback(() => {
23767
- var _a;
23768
- return (_a = toastRef.current) == null ? void 0 : _a.classList.add("adl-toast--visible");
23769
- }, []);
23770
- const handleHide = useCallback(() => {
23771
- var _a;
23772
- (_a = toastRef.current) == null ? void 0 : _a.classList.remove("adl-toast--visible");
23773
- onToastHide();
23774
- }, [onToastHide]);
23775
- useEffect(() => {
23776
- handleShow();
23777
- if (duration !== "indefinite") {
23778
- setTimeout(() => handleHide(), duration);
23779
- }
23780
- }, [label, duration, handleHide, handleShow]);
23781
- return jsxs("div", {
23782
- ref: toastRef,
23783
- role: actionLabel ? "alertdialog" : "alert",
23784
- className: "adl-toast",
23785
- "aria-labelledby": labelId,
23786
- children: [loading2 && jsx("div", {
23787
- className: "adl-toast__loader",
23788
- children: jsx("div", {
23789
- className: "adl-loading-indicator adl-loading-indicator--small adl-loading-indicator--dark"
23790
- })
23791
- }), !loading2 && jsxs("div", {
23792
- className: cx("adl-toast__status", {
23793
- "adl-toast__status--success": successToast,
23794
- "adl-toast__status--error": !successToast
23795
- }),
23796
- children: [successToast && jsx(Icon, {
23797
- className: "adl-toast__status-icon",
23798
- name: "checkmark"
23799
- }), !successToast && jsx(Icon, {
23800
- className: "adl-toast__status-icon",
23801
- name: "cross"
23802
- })]
23803
- }), jsxs("div", {
23804
- className: "adl-toast__message",
23805
- children: [jsx("span", {
23806
- id: labelId,
23807
- className: "adl-toast__title",
23808
- children: label
23809
- }), actionLabel && jsx("button", {
23810
- className: "adl-link adl-toast__action",
23811
- title: "performAction",
23812
- type: "button",
23813
- onClick: onToastAction,
23814
- children: actionLabel
23815
- }), !loading2 && subLabel && jsx("span", {
23816
- className: "adl-toast__subtitle",
23817
- children: subLabel
23818
- })]
23819
- }), !loading2 && jsx("button", {
23820
- className: "adl-toast__close",
23821
- title: "close",
23822
- type: "button",
23823
- onClick: handleHide,
23824
- children: jsx(Icon, {
23825
- name: "cross"
23826
- })
23827
- })]
23828
- });
23829
- }
23830
24403
  const parseConfiguration$1 = ({
23831
24404
  country: country2,
23832
24405
  matchingScenario
@@ -23839,7 +24412,7 @@ function IndividualDropinComponent({
23839
24412
  handleFindAddress,
23840
24413
  handleGetIdVerificationToken,
23841
24414
  handleGetIdVerificationStartCheck,
23842
- taskType,
24415
+ taskType = TaskTypes.INDIVIDUAL,
23843
24416
  trackingConfig,
23844
24417
  parentLegalEntity,
23845
24418
  legalEntityResponse,
@@ -23940,7 +24513,7 @@ function IndividualDropinComponent({
23940
24513
  if (parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) {
23941
24514
  const associations = (_b = parentLegalEntity == null ? void 0 : parentLegalEntity.entityAssociations) == null ? void 0 : _b.filter((ea) => ea.legalEntityId === (legalEntityResponse == null ? void 0 : legalEntityResponse.id));
23942
24515
  if (associations && associations.length > 0) {
23943
- const jobTitle2 = (_c = associations.find((association) => Boolean(association.jobTitle))) == null ? void 0 : _c.jobTitle;
24516
+ const jobTitle2 = (_c = associations.find((association2) => Boolean(association2.jobTitle))) == null ? void 0 : _c.jobTitle;
23944
24517
  dataFromResponse = {
23945
24518
  ...dataFromResponse,
23946
24519
  personalDetails: {
@@ -24432,6 +25005,9 @@ function PayoutDetailsDropinComponent({
24432
25005
  i18n,
24433
25006
  setLocale
24434
25007
  } = useI18nContext();
25008
+ const {
25009
+ isExperimentEnabled
25010
+ } = useExperimentsContext();
24435
25011
  const {
24436
25012
  showToast,
24437
25013
  clearToasts
@@ -24544,7 +25120,7 @@ function PayoutDetailsDropinComponent({
24544
25120
  country: (_b2 = prefilledData == null ? void 0 : prefilledData.payoutVerificationMethod) == null ? void 0 : _b2.bankCountry,
24545
25121
  bankVerificationVendors,
24546
25122
  verificationVendorsCallback: handleGetBankVerificationVendors
24547
- }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout));
25123
+ }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
24548
25124
  }, [bankVerificationVendors]);
24549
25125
  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]);
24550
25126
  const forms = useMemo(() => {
@@ -24730,7 +25306,7 @@ function PayoutDetailsDropinComponent({
24730
25306
  } : onSubmit
24731
25307
  });
24732
25308
  return jsx(FormWrapper, {
24733
- taskName: taskName ?? "payoutDetails",
25309
+ taskName: taskName ?? isExperimentEnabled("EnableNewEntryFlow") ? "bankAccountDetails" : "payoutDetails",
24734
25310
  activeForm,
24735
25311
  summary: {
24736
25312
  data: formatDataForSummary(),
@@ -26814,6 +27390,9 @@ function SolePropDropinComponent({
26814
27390
  i18n,
26815
27391
  setLocale
26816
27392
  } = useI18nContext();
27393
+ const {
27394
+ isExperimentEnabled
27395
+ } = useExperimentsContext();
26817
27396
  const [problems, setProblems] = useState(problemsProp);
26818
27397
  const datasetUtils = datasetUtilities(i18n.locale);
26819
27398
  const getOmittedKeys = () => ["operationalAddressIsSame"];
@@ -27003,6 +27582,7 @@ function SolePropDropinComponent({
27003
27582
  eventEmitter,
27004
27583
  hideDropinLayout,
27005
27584
  legalEntityType: LegalEntityType.TRUST,
27585
+ taskName: isExperimentEnabled("EnableNewEntryFlow") ? "soleProprietorshipDetails" : "solePropDetails",
27006
27586
  legalEntityResponse,
27007
27587
  summary: {
27008
27588
  formatData: formatDataForSummary,
@@ -27142,7 +27722,7 @@ function TrustDropinComponent(props) {
27142
27722
  }
27143
27723
  };
27144
27724
  const isDocumentsRequired2 = (forms) => forms.some((form) => [trustForms.trustConstitutionalDocument.formId].includes(form.formId));
27145
- const attachTrustToParentLegalEntity = async (trust) => {
27725
+ const attachTrustToParentLegalEntity = async (trust2) => {
27146
27726
  if (legalEntityResponse == null ? void 0 : legalEntityResponse.id) {
27147
27727
  return;
27148
27728
  }
@@ -27150,7 +27730,7 @@ function TrustDropinComponent(props) {
27150
27730
  const updatedParentLegalEntity = {
27151
27731
  entityAssociations: [{
27152
27732
  type: LegalEntityType.TRUST,
27153
- legalEntityId: trust.id
27733
+ legalEntityId: trust2.id
27154
27734
  }, ...existingEntityAssociations]
27155
27735
  };
27156
27736
  await props.handleUpdateLegalEntity(updatedParentLegalEntity, parentLegalEntity.id);
@@ -27250,7 +27830,8 @@ function DropinComposerComponent({
27250
27830
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
27251
27831
  const {
27252
27832
  contextCountry,
27253
- accountHolder: accountHolder2
27833
+ accountHolder: accountHolder2,
27834
+ setAccountHolder
27254
27835
  } = useCoreContext();
27255
27836
  const {
27256
27837
  i18n,
@@ -27267,20 +27848,28 @@ function DropinComposerComponent({
27267
27848
  } = useToastContext();
27268
27849
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
27269
27850
  const [pollingId, setPollingId] = useState(null);
27851
+ const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
27270
27852
  const showIntro = useShouldShowIntro(legalEntityResponse);
27271
27853
  const {
27272
27854
  setHasSeenIntro
27273
27855
  } = useHasSeenIntro(legalEntityResponse.id);
27274
27856
  const [tasks, setTasks] = useState([]);
27275
- const [taskHistory, setTaskHistory] = useState([showIntro ? TaskTypes.INTRO : TaskTypes.TASKS_OVERVIEW]);
27857
+ const initialTask = useMemo(() => {
27858
+ if (showBusinessTypeSelection)
27859
+ return TaskTypes.BUSINESS_TYPE_SELECTION;
27860
+ if (showIntro)
27861
+ return TaskTypes.INTRO;
27862
+ return TaskTypes.TASKS_OVERVIEW;
27863
+ }, [showBusinessTypeSelection, showIntro]);
27864
+ const [taskHistory, setTaskHistory] = useState([initialTask]);
27276
27865
  const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
27277
27866
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
27278
27867
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
27279
27868
  const [legalEntityType, setLegalEntityType] = useState(null);
27280
27869
  const [solePropietor, setSolePropietor] = useState(null);
27281
- const [trust, setTrust] = useState(null);
27870
+ const [trust2, setTrust] = useState(null);
27282
27871
  const exemptSettlor = useExemptSettlor({
27283
- trust,
27872
+ trust: trust2,
27284
27873
  handleGetLegalEntity: args.handleGetLegalEntity
27285
27874
  });
27286
27875
  const [trustMember, setTrustMember] = useState(null);
@@ -27295,7 +27884,7 @@ function DropinComposerComponent({
27295
27884
  const hasTrust = isExperimentEnabled("EnableTrustFlow") && (accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse));
27296
27885
  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);
27297
27886
  const additionalSalesChannels = useSalesChannelsSettings();
27298
- const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("OrganizationSettlorWithExemptionReason"), trust == null ? void 0 : trust.trust.countryOfGoverningLaw);
27887
+ const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
27299
27888
  const getLegalEntityProblems = (le) => {
27300
27889
  var _a2;
27301
27890
  if (le == null ? void 0 : le.id) {
@@ -27406,9 +27995,9 @@ function DropinComposerComponent({
27406
27995
  return void 0;
27407
27996
  };
27408
27997
  const refreshTrust = async () => {
27409
- if (trust.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
27998
+ if (trust2.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
27410
27999
  try {
27411
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(trust.id));
28000
+ const response = await (args == null ? void 0 : args.handleGetLegalEntity(trust2.id));
27412
28001
  setTrust(response);
27413
28002
  return response;
27414
28003
  } catch (e) {
@@ -27442,14 +28031,14 @@ function DropinComposerComponent({
27442
28031
  case "company":
27443
28032
  await deleteAssociatedTrustMember({
27444
28033
  associatedTrustMember: trustMember2,
27445
- trust,
28034
+ trust: trust2,
27446
28035
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27447
28036
  });
27448
28037
  break;
27449
28038
  case "undefinedBeneficiary":
27450
28039
  await deleteUndefinedBeneficiary({
27451
28040
  undefinedBeneficiary: trustMember2,
27452
- trust,
28041
+ trust: trust2,
27453
28042
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27454
28043
  });
27455
28044
  break;
@@ -27471,7 +28060,7 @@ function DropinComposerComponent({
27471
28060
  };
27472
28061
  const addOrUpdateTrustMember = async (updated, existing) => {
27473
28062
  if ((existing == null ? void 0 : existing.trustMemberType) === "undefinedBeneficiary" && updated.trustMemberType === "undefinedBeneficiary" && existing.description === updated.description) {
27474
- await refreshTrustAndRunOnSubmit(trust, 1);
28063
+ await refreshTrustAndRunOnSubmit(trust2, 1);
27475
28064
  return;
27476
28065
  }
27477
28066
  try {
@@ -27479,7 +28068,7 @@ function DropinComposerComponent({
27479
28068
  case "undefinedBeneficiary":
27480
28069
  await addOrUpdateUndefinedBeneficiary({
27481
28070
  newOrUpdated: updated,
27482
- trust,
28071
+ trust: trust2,
27483
28072
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27484
28073
  });
27485
28074
  break;
@@ -27490,7 +28079,7 @@ function DropinComposerComponent({
27490
28079
  handleCreateLegalEntity: args.handleCreateLegalEntity
27491
28080
  }) : await createExemptSettlor({
27492
28081
  exemptSettlor: updated,
27493
- trust,
28082
+ trust: trust2,
27494
28083
  handleCreateLegalEntity: args.handleCreateLegalEntity
27495
28084
  });
27496
28085
  updated.legalEntityId = newSettlorLE.id;
@@ -27509,7 +28098,7 @@ function DropinComposerComponent({
27509
28098
  }
27510
28099
  await addOrUpdateAssociatedTrustMember({
27511
28100
  newOrUpdated: updated,
27512
- trust,
28101
+ trust: trust2,
27513
28102
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27514
28103
  });
27515
28104
  break;
@@ -27517,7 +28106,7 @@ function DropinComposerComponent({
27517
28106
  case "company":
27518
28107
  await addOrUpdateAssociatedTrustMember({
27519
28108
  newOrUpdated: updated,
27520
- trust,
28109
+ trust: trust2,
27521
28110
  handleUpdateLegalEntity: args.handleUpdateLegalEntity
27522
28111
  });
27523
28112
  break;
@@ -27529,7 +28118,7 @@ function DropinComposerComponent({
27529
28118
  label: i18n.get("successfullyUpdatedDetails"),
27530
28119
  type: ToastType.SUCCESS
27531
28120
  });
27532
- await refreshTrustAndRunOnSubmit(trust, 1);
28121
+ await refreshTrustAndRunOnSubmit(trust2, 1);
27533
28122
  } catch (err) {
27534
28123
  logger$7.error(err);
27535
28124
  showToast({
@@ -27600,7 +28189,7 @@ function DropinComposerComponent({
27600
28189
  };
27601
28190
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
27602
28191
  var _a2, _b2;
27603
- 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;
28192
+ 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;
27604
28193
  if (trustId) {
27605
28194
  try {
27606
28195
  const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
@@ -27794,6 +28383,19 @@ function DropinComposerComponent({
27794
28383
  }
27795
28384
  const currentTask = taskHistory[taskHistory.length - 1];
27796
28385
  switch (currentTask) {
28386
+ case TaskTypes.BUSINESS_TYPE_SELECTION:
28387
+ return jsx(BusinessTypeSelection, {
28388
+ ...args,
28389
+ legalEntityResponse: legalEntity,
28390
+ accountHolder: accountHolder2,
28391
+ showTrustOption: isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(rootLegalEntityCountry),
28392
+ showSolePropOption: SOLE_PROP_COUNTRIES.includes(rootLegalEntityCountry),
28393
+ onAccountHolderSelect: async (newAccountHolder) => {
28394
+ setAccountHolder(newAccountHolder);
28395
+ await refreshLegalEntity();
28396
+ onNavigateTo(showIntro ? TaskTypes.INTRO : TaskTypes.TASKS_OVERVIEW);
28397
+ }
28398
+ });
27797
28399
  case TaskTypes.INTRO:
27798
28400
  return jsx(TaskIntros, {
27799
28401
  legalEntityType: legalEntity.type,
@@ -27916,7 +28518,7 @@ function DropinComposerComponent({
27916
28518
  topLevelLegalEntity: legalEntityResponse
27917
28519
  },
27918
28520
  taskType: TaskTypes.TRUST_MEMBER_INDIVIDUAL,
27919
- parentLegalEntity: trust,
28521
+ parentLegalEntity: trust2,
27920
28522
  legalEntityResponse: associatedLegalEntity,
27921
28523
  problems: getLegalEntityProblems(associatedLegalEntity),
27922
28524
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
@@ -27964,7 +28566,7 @@ function DropinComposerComponent({
27964
28566
  topLevelLegalEntity: legalEntityResponse
27965
28567
  },
27966
28568
  taskType: TaskTypes.TRUST_MEMBER_COMPANY,
27967
- parentLegalEntity: trust,
28569
+ parentLegalEntity: trust2,
27968
28570
  legalEntityResponse: associatedLegalEntity,
27969
28571
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
27970
28572
  problems: (_e = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _e[legalEntity.id],
@@ -28009,22 +28611,22 @@ function DropinComposerComponent({
28009
28611
  topLevelLegalEntity: legalEntityResponse
28010
28612
  },
28011
28613
  taskType: TaskTypes.TRUST,
28012
- problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust == null ? void 0 : trust.id],
28614
+ problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[trust2 == null ? void 0 : trust2.id],
28013
28615
  parentLegalEntity: legalEntity,
28014
- legalEntityResponse: trust,
28616
+ legalEntityResponse: trust2,
28015
28617
  capabilities: Object.keys((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}),
28016
28618
  onChange: componentOnChange,
28017
28619
  eventEmitter,
28018
28620
  onSubmit: componentOnSubmit,
28019
28621
  handleHomeClick: navigateBack,
28020
28622
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
28021
- 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,
28623
+ 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,
28022
28624
  handleAddressSearch: args == null ? void 0 : args.handleAddressSearch,
28023
28625
  handleFindAddress: args == null ? void 0 : args.handleFindAddress
28024
28626
  });
28025
28627
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
28026
28628
  return jsx(TrustMembersOverview, {
28027
- trustMembers: getTrustMembers(trust, legalEntity, exemptSettlor),
28629
+ trustMembers: getTrustMembers(trust2, legalEntity, exemptSettlor),
28028
28630
  getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
28029
28631
  navigateBackToTaskList: navigateBack,
28030
28632
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
@@ -28407,20 +29009,22 @@ const useComponentApi = (rootLegalEntityId) => {
28407
29009
  };
28408
29010
  const DEFAULT_POLLING_INTERVAL = 3e3;
28409
29011
  const DEFAULT_POLLING_INTERVAL_RETRY_COUNT = 3;
28410
- function useInterval(callback, clearInterval2 = false, initialDelay = DEFAULT_POLLING_INTERVAL) {
29012
+ function useInterval(callback, initialDelay = DEFAULT_POLLING_INTERVAL) {
28411
29013
  const savedCallback = useRef(null);
28412
29014
  const [timeoutId, setTimeoutId] = useState();
28413
- let delayValue = initialDelay || DEFAULT_POLLING_INTERVAL;
29015
+ const [delayValue, setDelayValue] = useState(initialDelay || DEFAULT_POLLING_INTERVAL);
28414
29016
  let retryCount = 0;
28415
29017
  useEffect(() => {
28416
29018
  savedCallback.current = callback;
28417
29019
  const delayGenerator = () => {
29020
+ let delay = delayValue;
28418
29021
  if (retryCount < DEFAULT_POLLING_INTERVAL_RETRY_COUNT) {
28419
29022
  retryCount += 1;
28420
29023
  } else {
28421
- delayValue = delayValue >= 9e3 ? delayValue = initialDelay : delayValue + 1e3;
29024
+ delay = delayValue >= 9e3 ? delay = initialDelay : delayValue + 1e3;
29025
+ setDelayValue(delay);
28422
29026
  }
28423
- return delayValue;
29027
+ return delay;
28424
29028
  };
28425
29029
  const handleTick = () => {
28426
29030
  if (savedCallback.current !== null) {
@@ -28435,13 +29039,11 @@ function useInterval(callback, clearInterval2 = false, initialDelay = DEFAULT_PO
28435
29039
  setTimeoutId(timeoutId2);
28436
29040
  };
28437
29041
  randomTick();
28438
- if (clearInterval2) {
28439
- clearTimeout(timeoutId);
28440
- }
28441
- return () => {
28442
- clearTimeout(timeoutId);
28443
- };
28444
- }, [initialDelay, clearInterval2]);
29042
+ }, [initialDelay]);
29043
+ useEffect(() => () => {
29044
+ clearTimeout(timeoutId);
29045
+ }, [timeoutId]);
29046
+ return timeoutId;
28445
29047
  }
28446
29048
  function AddTransferInstrument({
28447
29049
  onAdd
@@ -28503,7 +29105,7 @@ function ManageTransferInstrumentOverviewItemSummary({
28503
29105
  })
28504
29106
  }), jsx(Summary, {
28505
29107
  data: getSummaryData(transferInstrument),
28506
- forms: [payoutSteps.payoutAccountDetails(TaskTypes.PAYOUT)],
29108
+ forms: [payoutSteps.payoutAccountDetails(TaskTypes.PAYOUT, false)],
28507
29109
  showFormHeader: false,
28508
29110
  showSectionHeader: false,
28509
29111
  omittedKeys: ["transferInstrumentId"]
@@ -28519,7 +29121,6 @@ const statusDescription = {
28519
29121
  function ManageTransferInstrumentOverviewItem({
28520
29122
  transferInstrumentReference,
28521
29123
  transferInstrument,
28522
- onAdd,
28523
29124
  onEdit,
28524
29125
  onOpen,
28525
29126
  onRemove,
@@ -28566,7 +29167,8 @@ function ManageTransferInstrumentOverviewItem({
28566
29167
  subTitle,
28567
29168
  onOpen: () => onOpen(transferInstrumentReference.transferInstrument.id),
28568
29169
  children: [!transferInstrument ? jsx(LoaderWrapper, {
28569
- className: "adyen-kyc-manage-ti-overview-item__loader"
29170
+ className: "adyen-kyc-manage-ti-overview-item__loader",
29171
+ status: "loading"
28570
29172
  }) : jsx(ManageTransferInstrumentOverviewItemSummary, {
28571
29173
  transferInstrument,
28572
29174
  accountHolderName,
@@ -28614,11 +29216,10 @@ function ManageTransferInstrumentOverview({
28614
29216
  logger$6.error(e);
28615
29217
  }
28616
29218
  };
28617
- const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef, PAYOUT) => jsx(ManageTransferInstrumentOverviewItem, {
29219
+ const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef) => jsx(ManageTransferInstrumentOverviewItem, {
28618
29220
  accountHolderName,
28619
29221
  transferInstrument: transferInstrumentsMap[transferInstrumentRef.transferInstrument.id],
28620
29222
  transferInstrumentReference: transferInstrumentRef,
28621
- onAdd,
28622
29223
  onEdit,
28623
29224
  onRemove: onRemoveTransferinstrument,
28624
29225
  onOpen: onShowBankDetails
@@ -28661,10 +29262,10 @@ function ManageTransferInstrumentComponent({
28661
29262
  const transferInstrumentRefs = await getTransferInstruments2();
28662
29263
  setTransferInstruments(transferInstrumentRefs);
28663
29264
  };
28664
- const hasUnverifiedTransferInstruments = transferInstruments == null ? void 0 : transferInstruments.some(({
29265
+ const hasOnlyVerifiedTransferInstruments = transferInstruments == null ? void 0 : transferInstruments.every(({
28665
29266
  status
28666
- }) => status !== "FINISHED");
28667
- useInterval(refreshTransferInstruments, hasUnverifiedTransferInstruments);
29267
+ }) => status === "FINISHED");
29268
+ const timeoutId = useInterval(refreshTransferInstruments);
28668
29269
  const init2 = useCallback(async () => {
28669
29270
  const [transferInstrumentRefs, legalEntity] = await Promise.all([getTransferInstruments2(), getLegalEntity2(legalEntityId)]);
28670
29271
  const accountHolder2 = getPayoutAccountHolderName(legalEntity, i18n);
@@ -28677,9 +29278,14 @@ function ManageTransferInstrumentComponent({
28677
29278
  setLoadingStatus("success");
28678
29279
  });
28679
29280
  }, [init2, setLocale, eventEmitter]);
28680
- const onRemove = (transferInsrumentId) => {
29281
+ useEffect(() => {
29282
+ if (transferInstruments.length && hasOnlyVerifiedTransferInstruments) {
29283
+ clearTimeout(timeoutId);
29284
+ }
29285
+ }, [hasOnlyVerifiedTransferInstruments, timeoutId, transferInstruments]);
29286
+ const onRemove = (transferInstrumentId) => {
28681
29287
  refreshTransferInstruments().catch(logger$5.error);
28682
- onRemoveSuccess == null ? void 0 : onRemoveSuccess(transferInsrumentId, legalEntityId);
29288
+ onRemoveSuccess == null ? void 0 : onRemoveSuccess(transferInstrumentId, legalEntityId);
28683
29289
  };
28684
29290
  const render2 = () => {
28685
29291
  if (loadingStatus === "loading") {
@@ -28748,6 +29354,7 @@ function TransferInstrumentComponent({
28748
29354
  } = useComponentApi(legalEntityId);
28749
29355
  const [legalEntity, setLegalEntity] = useState();
28750
29356
  const [transferInstrument, setTransferInstrument] = useState();
29357
+ const [loadingStatus, setLoadingStatus] = useState("success");
28751
29358
  const fetchLegalEntity = useCallback(async () => {
28752
29359
  const le = await getLegalEntity2(legalEntityId);
28753
29360
  setLegalEntity(le);
@@ -28755,14 +29362,19 @@ function TransferInstrumentComponent({
28755
29362
  }, [getLegalEntity2, legalEntityId]);
28756
29363
  useEffect(() => {
28757
29364
  (async () => {
29365
+ setLoadingStatus("loading");
28758
29366
  await fetchLegalEntity();
28759
29367
  if (transferInstrumentId) {
28760
29368
  const ti = await getTransferInstrument2(transferInstrumentId);
28761
29369
  setTransferInstrument(ti);
28762
29370
  }
28763
- })().catch(logger$4.error);
28764
- }, [transferInstrumentId, fetchLegalEntity]);
28765
- return legalEntity ? jsx(PayoutDetailsDropinComponent, {
29371
+ })().catch(logger$4.error).finally(() => {
29372
+ setLoadingStatus("success");
29373
+ });
29374
+ }, [transferInstrumentId, fetchLegalEntity, getTransferInstrument2]);
29375
+ return loadingStatus === "loading" || !legalEntity ? jsx(Loader, {
29376
+ size: "medium"
29377
+ }) : jsx(PayoutDetailsDropinComponent, {
28766
29378
  eventEmitter: eventEmitter ?? new EventEmitter(),
28767
29379
  transferInstrument,
28768
29380
  setTransferInstrument,
@@ -28782,7 +29394,7 @@ function TransferInstrumentComponent({
28782
29394
  createTrustedTransferInstrument: createTrustedTransferInstrument2,
28783
29395
  handleBankVerificationError: handleBankVerificationError2,
28784
29396
  taskType: TaskTypes.PAYOUT
28785
- }) : null;
29397
+ });
28786
29398
  }
28787
29399
  const componentsMap = {
28788
29400
  individualDropin: IndividualDropinComponent,
@@ -28848,6 +29460,22 @@ const getAllowedLocales$1 = async (context) => {
28848
29460
  }
28849
29461
  });
28850
29462
  };
29463
+ const getSupportedCountries = async (context) => {
29464
+ const {
29465
+ loadingContext,
29466
+ legalEntityId
29467
+ } = context;
29468
+ return httpGet({
29469
+ loadingContext,
29470
+ errorLevel: "warn",
29471
+ errorMessage: `Supported countries not available`,
29472
+ path: `${legalEntityId}/configurations/supportedCountries`,
29473
+ authentication: "jwt",
29474
+ headers: {
29475
+ "Content-Type": "application/json"
29476
+ }
29477
+ });
29478
+ };
28851
29479
  const getEmbeddedApi = ({
28852
29480
  base,
28853
29481
  rootLegalEntityId
@@ -28881,9 +29509,7 @@ const getEmbeddedApi = ({
28881
29509
  loadFlags: async () => loadFlags(base),
28882
29510
  loadDocumentGuidance: async () => loadDocumentGuidance(base),
28883
29511
  getImageUrl: () => `${base}static/images/`,
28884
- getAllowedCountries: () => {
28885
- throw new Error("getAllowedCountries: Not implemented in onboarding component api");
28886
- },
29512
+ getAllowedCountries: async () => getSupportedCountries(baseRequestContext),
28887
29513
  getAllowedLocales: async () => getAllowedLocales$1(baseRequestContext),
28888
29514
  validatePhoneNumber: () => {
28889
29515
  throw new Error("validatePhoneNumber: Not implemented in onboarding component api");
@@ -29213,36 +29839,46 @@ const ConfigurationApiProvider = ({
29213
29839
  children
29214
29840
  });
29215
29841
  };
29842
+ const accountHolderStorageKey = "ACCOUNT_HOLDER";
29843
+ const useAccountHolder = (enableNewEntryFlow) => {
29844
+ let hook;
29845
+ let initialStateParams;
29846
+ if (enableNewEntryFlow) {
29847
+ hook = useLocalStorage;
29848
+ initialStateParams = [accountHolderStorageKey, null];
29849
+ } else {
29850
+ hook = useState;
29851
+ initialStateParams = [null];
29852
+ }
29853
+ const [accountHolder2, setAccountHolder] = hook(...initialStateParams);
29854
+ return [accountHolder2, setAccountHolder];
29855
+ };
29216
29856
  const logger$2 = createLogger("CoreProvider");
29217
29857
  const CoreProvider = ({
29218
29858
  contextCountry: initialContextCountry,
29859
+ enableNewEntryFlowExperiment = false,
29219
29860
  children
29220
29861
  }) => {
29221
29862
  const {
29222
29863
  loadingContext
29223
29864
  } = useAuthContext();
29224
- const {
29225
- getAllowedCountries: getAllowedCountries2
29226
- } = useConfigurationApi();
29227
29865
  const [contextCountry, setContextCountry] = useState(initialContextCountry);
29228
- const [accountHolder2, setAccountHolder] = useState(null);
29866
+ const [accountHolder2, setAccountHolder] = useAccountHolder(enableNewEntryFlowExperiment);
29229
29867
  const [accountFormat, setAccountFormat] = useState("local");
29230
29868
  useEffect(() => {
29231
29869
  addStyleTagForADLIconFont(loadingContext);
29232
29870
  }, [loadingContext]);
29871
+ const allowedCountries = useAllowedCountries();
29872
+ const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
29233
29873
  useEffect(() => {
29234
- const checkIfCountryIsAllowed = async () => {
29235
- const allowedCountries = (await getAllowedCountries2()).countries;
29236
- if (!allowedCountries.includes(contextCountry)) {
29237
- logger$2.warn(`
29874
+ if (allowedCountries && !isCountryAllowed) {
29875
+ logger$2.warn(`
29238
29876
 
29239
29877
  "${contextCountry}" isn't a supported country. Please use one of the following:
29240
29878
  - ${listify(allowedCountries)}.
29241
- `);
29242
- }
29243
- };
29244
- checkIfCountryIsAllowed().catch(logger$2.warn);
29245
- }, [contextCountry, getAllowedCountries2]);
29879
+ `);
29880
+ }
29881
+ }, [allowedCountries, contextCountry, isCountryAllowed]);
29246
29882
  const contextValue = useMemo(() => ({
29247
29883
  setContextCountry,
29248
29884
  contextCountry,
@@ -29483,6 +30119,7 @@ class UIElement extends BaseElement {
29483
30119
  constructor(props) {
29484
30120
  super(props);
29485
30121
  this.render = () => {
30122
+ var _a;
29486
30123
  const Component = this.props.component;
29487
30124
  return jsx(AuthProvider, {
29488
30125
  sdkToken: this.props.sdkToken,
@@ -29493,6 +30130,7 @@ class UIElement extends BaseElement {
29493
30130
  rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
29494
30131
  children: jsx(CoreProvider, {
29495
30132
  contextCountry: this.props.contextCountry,
30133
+ enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
29496
30134
  children: jsx(I18nProvider, {
29497
30135
  locale: this.props.locale,
29498
30136
  customTranslations: this.props.customTranslations,