@adyen/kyc-components 3.14.1 → 3.15.1

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.
@@ -5,6 +5,7 @@ import cx from "classnames";
5
5
  import { lazy, Suspense, useId, forwardRef, memo, useMemo as useMemo$1, useEffect as useEffect$1, useState as useState$1 } from "preact/compat";
6
6
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
7
7
  import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
8
+ import isISIN from "validator/es/lib/isISIN.js";
8
9
  import OpenBankingSDK from "@adyen/openbankingsdk";
9
10
  import { jsxs as jsxs$1, jsx as jsx$1 } from "preact/compat/jsx-runtime";
10
11
  import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
@@ -42,7 +43,7 @@ const payoutAccount = "Payout account";
42
43
  const payinAccount = "Payin account";
43
44
  const firstName = "First name";
44
45
  const lastName = "Last name";
45
- const country = "Country";
46
+ const country = "Country/region";
46
47
  const street = "Street";
47
48
  const otherAddressInformation = "Other address information (optional)";
48
49
  const postalCode = "Postal code";
@@ -65,7 +66,7 @@ const invalidPhoneNumber = "Please enter a valid phone number.";
65
66
  const birthDate = "Date of birth";
66
67
  const idNumber = "Identity number";
67
68
  const selectState = "Select a state";
68
- const selectCountry = "Select a country";
69
+ const selectCountryRegion = "Select a country/region";
69
70
  const search = "Search";
70
71
  const noOptionsFound = "No options found";
71
72
  const SSNFormatUS = "*** — ** — XXXX";
@@ -118,8 +119,9 @@ const invalidFormatIdentityNumberUS9 = "Please use the SSN format: XXXXXXXXX";
118
119
  const invalidFormatIdentityNumberSG = "Please use the NRIC format: S1234567A";
119
120
  const invalidFormatIdentityNumberHK = "Not valid for HK. Format should be: 8 or 9-character alphanumeric. For example: C668668E";
120
121
  const invalidFormatBankStatementDescription = "Please ensure your input contains solely letters, digits, currency codes, and the specified special characters: -._,:;'*!@#%()+?¿/「」";
121
- const residencyCountry = "Country of residence";
122
+ const residencyCountry = "Country/region of residence";
122
123
  const stateOrProvince = "State or province";
124
+ const basicInformation = "Basic information";
123
125
  const selectStateOrProvince = "Select a state or province";
124
126
  const dragYourFilesHereOr = "Drag your files here, or";
125
127
  const browse = "Browse";
@@ -242,7 +244,7 @@ const enterValidRegistrationNumber = "Please enter a valid registration number";
242
244
  const stockExchangeMICHelper = "Market Identifier Code, as defined in ISO 10383";
243
245
  const stockISINHelper = "International Securities Identification Number, as defined in ISO 10383";
244
246
  const validationPleaseEnterAValidMarketIdentifier = "Please enter a valid Market identifier code";
245
- const validationPleaseEnterAValidStockISIN = "Please enter a valid International Securities Identification Number";
247
+ const validationPleaseEnterAValidStockISIN = "Please enter a valid ISIN. For example, %{example}";
246
248
  const shareholderDocument = "Shareholder document";
247
249
  const role = "Role";
248
250
  const selectAllTheRolesThatThisDecisionMakerHolds = "Select all the roles that this decision-maker holds.";
@@ -261,7 +263,6 @@ const cantSetUpAcccount = "You can’t set up an account";
261
263
  const accountCantBeSetUp = "Your account can’t be set up as your information couldn’t be verified. To find out more, reach out to customer support.";
262
264
  const pleaseNote = "Please note:";
263
265
  const byClickingSubmitReview = "By clicking 'Submit review', you confirm that all of your information has been reviewed, and that all newly provided or already existing data is accurate and up-to-date.";
264
- const nameAndCountry = "Name and country";
265
266
  const companyCountry = "Where is your business located?";
266
267
  const accountDetailsDescription = "Provide a few details about you to start accepting live payments.";
267
268
  const provideFewDetailsAboutYourself = "Provide a few details about yourself.";
@@ -322,8 +323,8 @@ const bankAccountToHaveSameNameAsTrust = " The bank account holder has to have t
322
323
  const bankAccountHasToBeInYourName = "The bank account has to be in your name";
323
324
  const orSoleProprietorshipName = "or sole proprietorship's name";
324
325
  const bankAccountHasToBeInYourCompanyName = "The bank account has to be in your company's name";
325
- const bankCountry = "Bank country";
326
- const bankAccountCountry = "Bank account country";
326
+ const bankCountry = "Bank country/region";
327
+ const bankAccountCountryRegion = "Bank account country/region";
327
328
  const currency = "Currency";
328
329
  const currencyCode = "Currency code";
329
330
  const currencyPlaceholder = "Select a currency code";
@@ -400,6 +401,7 @@ const documentCannotBeDamaged = "The document cannot be damaged";
400
401
  const verify = "Verify";
401
402
  const add = "Add";
402
403
  const idUploadDocumentSubtitle = "So that we can verify the identity of <strong>%{name}</strong>, we need to see their government issued ID. Choose the method most convenient to you.";
404
+ const verifyIndividualIdentity = "Verify %{name}'s Identity";
403
405
  const documentNotExpiredOrDamaged = "The document cannot be expired or damaged";
404
406
  const weAccept = "We accept:";
405
407
  const includeFrontAndBack = "Include both the front and back side, each in separate file";
@@ -417,6 +419,7 @@ const invalidDateOfBirth = "Please enter a valid date of birth";
417
419
  const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
418
420
  const successfullyUpdatedDetails = "Successfully updated details";
419
421
  const failedToUpdateDetails = "Failed to update details";
422
+ const documentUploadfailed = "Document upload failed. Please ensure the document is not a duplicate and its size is 4MBs or less.";
420
423
  const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
421
424
  const failedFetchingDecisionMaker = "Failed to get decision maker details";
422
425
  const fileUpload = "File upload";
@@ -568,7 +571,7 @@ const otherTrust = "Other trust";
568
571
  const pooledSuperannuationTrust = "Pooled superannuation trust";
569
572
  const publicTradingTrust = "Public trading trust";
570
573
  const unlistedPublicUnitTrust = "Unlisted public unit trust";
571
- const countryOfEstablishment = "Country of establishment";
574
+ const countryRegionOfEstablishment = "Country/region of establishment";
572
575
  const nameOfTrustAgreement = "Name of trust agreement";
573
576
  const typeOfTrustAgreement = "Type of trust agreement";
574
577
  const objectOfCharitableTrust = "Object of charitable trust";
@@ -770,13 +773,13 @@ const enterTheRemainingNDigitsThenXToYLettersForExample = "Enter the remaining %
770
773
  const provideAllOwners = "Add <strong>all owners</strong> holding 25% or more of your company.";
771
774
  const ifNoOwnersSpecifyControllingPersons = "If you don’t have any owners holding 25% or more, then specify <strong>all controlling persons</strong>.";
772
775
  const provideAtLeastOneSignatory = "Add at least <strong>1 signatory</strong>.";
773
- const provideOneControllingPerson = "Provide <strong>1 controlling person</strong>.";
776
+ const provideOneControllingPerson = "Add <strong>1 controlling person</strong>.";
774
777
  const textToVerifyAccount = "For you to receive your payouts, we need a verified bank account.";
775
778
  const theBankAccountHolderMustHaveTheSameNameAsYourCompany_ = "The bank account holder must have the same name as your company <strong>%{companyName}</strong>.";
776
779
  const theBankAccountHolderMustBeInYourName_ = "The bank account holder must be in your name: <strong>%{name}</strong>";
777
780
  const weDoNotYetSupportInstantVerificationForBankAccountsIn_ = "We do not yet support instant verification for bank accounts in %{countryName}. Therefore, you must provide your account details manually.";
778
- const youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered = "You can only use a bank account in the country where your company is registered.";
779
- const youCanOnlyUseABankAccountInTheCountryWhereYouLive = "You can only use a bank account in the country where you live.";
781
+ const youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered = "You can only use a bank account in the country/region where your company is registered.";
782
+ const youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive = "You can only use a bank account in the country/region where you live.";
780
783
  const mobileApplication = "Mobile Application";
781
784
  const onOnlineBankingEnvironment = "Or web version of online banking environment";
782
785
  const dontHaveAccessOnlineBanking = "Don’t have access to online banking environment?";
@@ -879,8 +882,8 @@ const doNotHaveBusinessNumber = "I do not have a Business number";
879
882
  const enterNameExactlyAsAppearInID = "Enter your first name(s) exactly as it appears on your identity document";
880
883
  const enterLastNameExactlyAsAppearInID = "Enter your last name(s) exactly as it appears on your identity document";
881
884
  const takePhotoOriginalDocumentWithPhone = "Take a photo of the original ID document with your phone";
882
- const instantIDVerificationDescription = "With access to a physical ID document and a phone you can go through verification instantly!";
883
- const manualIDVerificationDescription = "Upload a good quality copy of your ID so we can verify it offline. Make sure it is clear with all corners and letters visible.";
885
+ const instantIDVerificationDescription = "Take a photo of a passport, identity card, or driver’s license.";
886
+ const manualIDVerificationDescription = "May take a few days. Upload a copy of a passport, identity, or driver’s license.";
884
887
  const uploadScanOriginalIDDocument = "Upload a scan of the original ID document";
885
888
  const takesLonger = "Takes longer";
886
889
  const howVerificationWithOnfidoWork = "How does verification with our partner Onfido work?";
@@ -920,7 +923,7 @@ const legalCompanyName__helperText__HK = "Enter the name exactly as it is on you
920
923
  const taxInformationNumber = "Tax Identification Number";
921
924
  const taxInformationNumber__HK = "Business Registration number (BRN)";
922
925
  const stockExchangeMIC = "Market Identifier Code (MIC)";
923
- const stockISIN = "ISIN";
926
+ const stockISIN = "International Securities Identification Number (ISIN)";
924
927
  const companyLookupResultsHeader = "Let's find your company";
925
928
  const companyLookupResultsHeader__searching = "Searching for companies...";
926
929
  const companyLookupResultsHeader__verifying = "Verifying company selection...";
@@ -1345,7 +1348,7 @@ const defaultTrans = {
1345
1348
  birthDate,
1346
1349
  idNumber,
1347
1350
  selectState,
1348
- selectCountry,
1351
+ selectCountryRegion,
1349
1352
  search,
1350
1353
  noOptionsFound,
1351
1354
  SSNFormatUS,
@@ -1400,6 +1403,7 @@ const defaultTrans = {
1400
1403
  invalidFormatBankStatementDescription,
1401
1404
  residencyCountry,
1402
1405
  stateOrProvince,
1406
+ basicInformation,
1403
1407
  selectStateOrProvince,
1404
1408
  dragYourFilesHereOr,
1405
1409
  browse,
@@ -1541,7 +1545,6 @@ const defaultTrans = {
1541
1545
  accountCantBeSetUp,
1542
1546
  pleaseNote,
1543
1547
  byClickingSubmitReview,
1544
- nameAndCountry,
1545
1548
  companyCountry,
1546
1549
  accountDetailsDescription,
1547
1550
  provideFewDetailsAboutYourself,
@@ -1603,7 +1606,7 @@ const defaultTrans = {
1603
1606
  orSoleProprietorshipName,
1604
1607
  bankAccountHasToBeInYourCompanyName,
1605
1608
  bankCountry,
1606
- bankAccountCountry,
1609
+ bankAccountCountryRegion,
1607
1610
  currency,
1608
1611
  currencyCode,
1609
1612
  currencyPlaceholder,
@@ -1680,6 +1683,7 @@ const defaultTrans = {
1680
1683
  verify,
1681
1684
  add,
1682
1685
  idUploadDocumentSubtitle,
1686
+ verifyIndividualIdentity,
1683
1687
  documentNotExpiredOrDamaged,
1684
1688
  weAccept,
1685
1689
  includeFrontAndBack,
@@ -1697,6 +1701,7 @@ const defaultTrans = {
1697
1701
  invalidDateOfIncorporation,
1698
1702
  successfullyUpdatedDetails,
1699
1703
  failedToUpdateDetails,
1704
+ documentUploadfailed,
1700
1705
  successfullyVerifiedIdNumber,
1701
1706
  failedFetchingDecisionMaker,
1702
1707
  fileUpload,
@@ -1853,7 +1858,7 @@ const defaultTrans = {
1853
1858
  pooledSuperannuationTrust,
1854
1859
  publicTradingTrust,
1855
1860
  unlistedPublicUnitTrust,
1856
- countryOfEstablishment,
1861
+ countryRegionOfEstablishment,
1857
1862
  nameOfTrustAgreement,
1858
1863
  typeOfTrustAgreement,
1859
1864
  objectOfCharitableTrust,
@@ -2062,8 +2067,8 @@ const defaultTrans = {
2062
2067
  theBankAccountHolderMustHaveTheSameNameAsYourCompany_,
2063
2068
  theBankAccountHolderMustBeInYourName_,
2064
2069
  weDoNotYetSupportInstantVerificationForBankAccountsIn_,
2065
- youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered,
2066
- youCanOnlyUseABankAccountInTheCountryWhereYouLive,
2070
+ youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered,
2071
+ youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive,
2067
2072
  mobileApplication,
2068
2073
  onOnlineBankingEnvironment,
2069
2074
  dontHaveAccessOnlineBanking,
@@ -4991,7 +4996,7 @@ function CountryField({
4991
4996
  children: (childProps) => jsx(Select, {
4992
4997
  ...childProps,
4993
4998
  name: "country",
4994
- placeholder: i18n.get("selectCountry"),
4999
+ placeholder: i18n.get("selectCountryRegion"),
4995
5000
  selected: data.country,
4996
5001
  items: countries,
4997
5002
  readonly: (countries.length === 1 || readonly) && !!data,
@@ -6760,6 +6765,11 @@ const PassportNumberPatterns = {
6760
6765
  const ProofOfIdentityCardPatterns = {
6761
6766
  [CountryCodes.HongKong]: /^[A-Z]{1,2}[0-9]{6}[0-9A]$/
6762
6767
  };
6768
+ const validateNotEmptyOnBlur = {
6769
+ modes: ["blur"],
6770
+ validate: (val) => !isEmpty(val),
6771
+ errorMessage: "fieldIsRequired"
6772
+ };
6763
6773
  const validatePatternOnBlur = (pattern) => ({
6764
6774
  modes: ["blur"],
6765
6775
  validate: (val) => !!val && pattern.test(val)
@@ -7702,9 +7712,13 @@ function CollapsibleContainer({
7702
7712
  children
7703
7713
  });
7704
7714
  }
7705
- function useAccordionContext() {
7706
- return useContext(AccordionContext);
7707
- }
7715
+ const useAccordionContext = () => {
7716
+ const accordionContext = useContext(AccordionContext);
7717
+ if (!accordionContext) {
7718
+ throw new Error("Cannot use useAccordionContext without AccordionContext");
7719
+ }
7720
+ return accordionContext;
7721
+ };
7708
7722
  function AccordionItem({
7709
7723
  children,
7710
7724
  className,
@@ -7915,7 +7929,7 @@ function StockExchangeMICField({
7915
7929
  }
7916
7930
  const stockExchangeMICFieldMetadata = {
7917
7931
  label: "stockExchangeMIC",
7918
- validators: validatePatternOnBlur(/^[a-zA-Z0-9]{4}$/),
7932
+ validators: [validateNotEmptyOnBlur, validatePatternOnBlur(/^[a-zA-Z0-9]{4}$/)],
7919
7933
  mask: {
7920
7934
  mask: makeMask(...alphanumericInputs(4)),
7921
7935
  transformOnType: uppercase
@@ -7963,16 +7977,19 @@ function StockISINField({
7963
7977
  }
7964
7978
  const stockISINFieldMetadata = {
7965
7979
  label: "stockISIN",
7966
- validators: validatePatternOnBlur(/^[a-zA-Z0-9]{12}$/),
7980
+ validators: [validateNotEmptyOnBlur, {
7981
+ modes: ["blur"],
7982
+ validate: (value) => !!value && isISIN(value)
7983
+ }],
7967
7984
  mask: {
7968
7985
  mask: makeMask(...alphaInputs(2), ...alphanumericInputs(9), ...numericInputs(1)),
7969
7986
  transformOnType: uppercase
7970
7987
  },
7988
+ helperText: "stockISINHelper",
7971
7989
  guidanceText: {
7972
- key: "enterNCharactersWithAMixForExample",
7990
+ key: "validationPleaseEnterAValidStockISIN",
7973
7991
  values: {
7974
- numChars: "12",
7975
- example: "US00379P1010"
7992
+ example: "NL0012969182"
7976
7993
  }
7977
7994
  }
7978
7995
  };
@@ -10458,7 +10475,9 @@ function AccountHolder(props) {
10458
10475
  dataStoreId
10459
10476
  }
10460
10477
  });
10461
- setAccountHolder((data == null ? void 0 : data.accountHolder) ?? null);
10478
+ if (data == null ? void 0 : data.accountHolder) {
10479
+ setAccountHolder(data.accountHolder);
10480
+ }
10462
10481
  }, [data, errors, valid, dataStoreId]);
10463
10482
  const formUtils = formUtilities(props, i18n);
10464
10483
  const questionLabel = i18n.get("nameOfBankAccountHolder");
@@ -10707,7 +10726,7 @@ function DropzoneFile(props) {
10707
10726
  const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
10708
10727
  if (i === 0)
10709
10728
  return `${bytes} ${sizes[i]}`;
10710
- return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
10729
+ return `${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]}`;
10711
10730
  };
10712
10731
  return jsxs("div", {
10713
10732
  className: "adyen-kyc-dropzone-file",
@@ -10732,11 +10751,9 @@ function DropzoneFile(props) {
10732
10751
  }), errorMessage ? jsx("div", {
10733
10752
  className: "adyen-kyc-dropzone-file__error",
10734
10753
  children: i18n.get(errorMessage)
10735
- }) : jsxs("div", {
10754
+ }) : jsx("div", {
10736
10755
  className: "adyen-kyc-dropzone-file__size",
10737
- children: [jsxs("span", {
10738
- children: [i18n.get("complete"), " "]
10739
- }), isNewlyUploadedFile(file) ? formatSize(file.size) : void 0]
10756
+ children: isNewlyUploadedFile(file) ? formatSize(file.size) : void 0
10740
10757
  })]
10741
10758
  }), jsx("button", {
10742
10759
  type: "button",
@@ -12638,7 +12655,7 @@ function TaxDocumentComponent({
12638
12655
  const companyForms = {
12639
12656
  companyNameAndCountry: {
12640
12657
  formId: "companyNameAndCountry",
12641
- formName: "nameAndCountry",
12658
+ formName: "basicInformation",
12642
12659
  fields: companyNameAndCountryFields
12643
12660
  },
12644
12661
  companyType: {
@@ -12718,7 +12735,7 @@ function CompanyComponent(props) {
12718
12735
  ...companyNameAndCountryFormProps.data,
12719
12736
  country: props.country
12720
12737
  },
12721
- heading: i18n.get("nameAndCountry"),
12738
+ heading: i18n.get("basicInformation"),
12722
12739
  id: CompanyNameAndCountryFormID,
12723
12740
  isTopLevelEntity: props.isTopLevelEntity
12724
12741
  })
@@ -14681,31 +14698,16 @@ function IdVerificationMethodComponent(props) {
14681
14698
  }), jsxs("form", {
14682
14699
  className: "adyen-kyc-verification-method",
14683
14700
  children: [jsx(FormHeader, {
14684
- heading: i18n.get("verificationMethod")
14701
+ heading: i18n.get("verifyIndividualIdentity", {
14702
+ values: {
14703
+ name
14704
+ }
14705
+ })
14685
14706
  }), jsx(ErrorPanel, {
14686
14707
  verificationErrors: formVerificationErrors,
14687
14708
  validationErrors: fieldValidationErrors,
14688
14709
  formUtils,
14689
14710
  id: "ariaErrorField"
14690
- }), jsx("div", {
14691
- dangerouslySetInnerHTML: {
14692
- __html: i18n.get("idUploadDocumentSubtitle", {
14693
- values: {
14694
- name
14695
- }
14696
- })
14697
- }
14698
- }), jsx("div", {
14699
- children: i18n.get("weAccept")
14700
- }), jsxs(List, {
14701
- className: "adl-u-margin-bottom-16",
14702
- children: [jsx(ListItem, {
14703
- children: i18n.get("passport")
14704
- }), jsx(ListItem, {
14705
- children: i18n.get("identityCard")
14706
- }), jsx(ListItem, {
14707
- children: i18n.get("driversLicense")
14708
- })]
14709
14711
  }), jsx(Field, {
14710
14712
  name: "verificationMethods",
14711
14713
  useLabelElement: false,
@@ -17231,6 +17233,7 @@ function IndividualComponent(props) {
17231
17233
  });
17232
17234
  }
17233
17235
  const useAsyncAccountDetailsValidationRules = (payload, hasEmptyFields2, isAccountNumberMasked2) => {
17236
+ const [timeoutId, setTimeoutId] = useState(null);
17234
17237
  const {
17235
17238
  validateAccountIdentification: validateAccountIdentification2
17236
17239
  } = useConfigurationApi();
@@ -17248,7 +17251,13 @@ const useAsyncAccountDetailsValidationRules = (payload, hasEmptyFields2, isAccou
17248
17251
  }
17249
17252
  };
17250
17253
  if (payload && !hasEmptyFields2 && !isAccountNumberMasked2) {
17251
- fetchAccountDetails(payload);
17254
+ if (timeoutId !== null) {
17255
+ clearTimeout(timeoutId);
17256
+ }
17257
+ setTimeoutId(setTimeout(() => {
17258
+ fetchAccountDetails(payload);
17259
+ setTimeoutId(null);
17260
+ }, 500));
17252
17261
  }
17253
17262
  }, [validateAccountIdentification2, hasEmptyFields2, payload]);
17254
17263
  return accountValidationData;
@@ -19740,90 +19749,6 @@ const makePayoutVerificationMethodsMetadata = (svgPath, instantVerificationProvi
19740
19749
  }
19741
19750
  });
19742
19751
  const payoutVerificationMethods = ["instantVerification", "manualVerification"];
19743
- const logger$j = createLogger("useLocalStorage");
19744
- const useLocalStorage = (key, defaultValue, options) => {
19745
- const {
19746
- serializer,
19747
- parser,
19748
- syncData
19749
- } = useMemo(() => ({
19750
- serializer: JSON.stringify,
19751
- parser: JSON.parse,
19752
- syncData: true,
19753
- ...options
19754
- }), [options]);
19755
- const rawValueRef = useRef(null);
19756
- const [value, setValue] = useState(() => {
19757
- if (typeof window === "undefined")
19758
- return defaultValue;
19759
- try {
19760
- rawValueRef.current = window.localStorage.getItem(key);
19761
- const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
19762
- return res;
19763
- } catch (err) {
19764
- logger$j.error(err);
19765
- return defaultValue;
19766
- }
19767
- });
19768
- useEffect(() => {
19769
- if (typeof window === "undefined")
19770
- return;
19771
- const updateLocalStorage = () => {
19772
- if (value !== void 0) {
19773
- const newValue = serializer(value);
19774
- const oldValue = rawValueRef.current;
19775
- rawValueRef.current = newValue;
19776
- window.localStorage.setItem(key, newValue);
19777
- window.dispatchEvent(new StorageEvent("storage", {
19778
- storageArea: window.localStorage,
19779
- url: window.location.href,
19780
- key,
19781
- newValue,
19782
- oldValue
19783
- }));
19784
- } else {
19785
- window.localStorage.removeItem(key);
19786
- window.dispatchEvent(new StorageEvent("storage", {
19787
- storageArea: window.localStorage,
19788
- url: window.location.href,
19789
- key
19790
- }));
19791
- }
19792
- };
19793
- try {
19794
- updateLocalStorage();
19795
- } catch (err) {
19796
- logger$j.error(err);
19797
- }
19798
- }, [value]);
19799
- useEffect(() => {
19800
- if (!syncData)
19801
- return;
19802
- const handleStorageChange = (event) => {
19803
- if (event.key !== key || event.storageArea !== window.localStorage)
19804
- return;
19805
- try {
19806
- if (event.newValue !== rawValueRef.current) {
19807
- rawValueRef.current = event.newValue;
19808
- setValue(event.newValue ? parser(event.newValue) : void 0);
19809
- }
19810
- } catch (err) {
19811
- logger$j.error(err);
19812
- }
19813
- };
19814
- if (typeof window === "undefined")
19815
- return;
19816
- window.addEventListener("storage", handleStorageChange);
19817
- return () => window.removeEventListener("storage", handleStorageChange);
19818
- }, [key, syncData]);
19819
- return [value, setValue];
19820
- };
19821
- const accountHolderStorageKey = "ACCOUNT_HOLDER";
19822
- const useAccountHolder = (enableNewEntryFlow) => {
19823
- const [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] = useLocalStorage(accountHolderStorageKey, null);
19824
- const [accountHolderFromState, setAccountHolderIntoState] = useState(null);
19825
- return enableNewEntryFlow ? [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] : [accountHolderFromState, setAccountHolderIntoState];
19826
- };
19827
19752
  const AccountHolderDescriptionFragment = ({
19828
19753
  legalEntityResponse
19829
19754
  }) => {
@@ -19832,7 +19757,9 @@ const AccountHolderDescriptionFragment = ({
19832
19757
  i18n
19833
19758
  } = useI18nContext();
19834
19759
  const hasSolePropEntityAssociations = hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id);
19835
- const [accountHolder2] = useAccountHolder(true);
19760
+ const {
19761
+ accountHolder: accountHolder2
19762
+ } = useCoreContext();
19836
19763
  if (accountHolder2 === "mySoleProprietorName" || hasSolePropEntityAssociations) {
19837
19764
  const soleProp = (_a = legalEntityResponse.entityAssociations) == null ? void 0 : _a.find((ea) => ea.entityType === "soleProprietorship");
19838
19765
  const {
@@ -20079,14 +20006,14 @@ function PayoutVerificationMethod(props) {
20079
20006
  country: formUtils.getErrorMessage("bankCountry", errors, fieldProblems)
20080
20007
  },
20081
20008
  labels: {
20082
- country: formUtils.getLabel("bankCountry", "bankAccountCountry")
20009
+ country: formUtils.getLabel("bankCountry", "bankAccountCountryRegion")
20083
20010
  },
20084
20011
  readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
20085
20012
  allowedCountries: allowedBankCountries,
20086
20013
  classNameModifiers: ["country"],
20087
20014
  handleChangeFor: () => handleChangeFor("bankCountry", "input"),
20088
20015
  helperText: {
20089
- country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
20016
+ country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered")
20090
20017
  }
20091
20018
  }), jsx(Field, {
20092
20019
  name: "verificationMethods",
@@ -20259,8 +20186,7 @@ function PayoutDetailsComponent(props) {
20259
20186
  const [bankInfoValidated, setBankInfoValidated] = useState(false);
20260
20187
  const [arePayoutAccountDetailsInvalid, setArePayoutAccountDetailsInvalid] = useState(false);
20261
20188
  const [invalidFieldNames, setInvalidFieldNames] = useState("");
20262
- const debouncedGetAccountIdentificationFromPayoutAccountSchema = useCallback(debounce(getAccountIdentificationFromPayoutAccountSchema, 500), [getAccountIdentificationFromPayoutAccountSchema]);
20263
- const payload = useMemo(() => bankCountry2 && accountDetailsFromInput ? debouncedGetAccountIdentificationFromPayoutAccountSchema(accountDetailsFromInput, bankCountry2) : {}, [accountDetailsFromInput, bankCountry2, debouncedGetAccountIdentificationFromPayoutAccountSchema]);
20189
+ const payload = useMemo(() => bankCountry2 && accountDetailsFromInput ? getAccountIdentificationFromPayoutAccountSchema(accountDetailsFromInput, bankCountry2) : {}, [accountDetailsFromInput, bankCountry2]);
20264
20190
  const validateAccountDetails = useAsyncAccountDetailsValidationRules(payload, hasEmptyFields(payload), isAccountNumberMasked(payload));
20265
20191
  const resetInvalidFieldState = () => {
20266
20192
  setInvalidFieldNames("");
@@ -20437,7 +20363,7 @@ const ConstitutionalDocumentComponent = memo(ConstitutionalDocumentUpload, (prev
20437
20363
  const solePropForms = {
20438
20364
  solePropNameAndCountry: {
20439
20365
  formId: "solePropNameAndCountry",
20440
- formName: "nameAndCountry",
20366
+ formName: "basicInformation",
20441
20367
  fields: companyNameAndCountryFields
20442
20368
  },
20443
20369
  solePropRegistrationDetails: {
@@ -20495,10 +20421,10 @@ function SolePropComponent(props) {
20495
20421
  legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
20496
20422
  },
20497
20423
  labels: {
20498
- country: "countryOfEstablishment",
20424
+ country: "countryRegionOfEstablishment",
20499
20425
  legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
20500
20426
  },
20501
- heading: i18n.get("nameAndCountry"),
20427
+ heading: i18n.get("basicInformation"),
20502
20428
  id: solePropNameAndCountryFormId,
20503
20429
  disableCountry: true,
20504
20430
  isTopLevelEntity: false
@@ -20962,7 +20888,7 @@ function TrustRegistrationDetailsComponent(props) {
20962
20888
  valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
20963
20889
  errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
20964
20890
  labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
20965
- country: "countryOfEstablishment"
20891
+ country: "countryRegionOfEstablishment"
20966
20892
  }),
20967
20893
  readonly: formUtils.isReadOnly("country"),
20968
20894
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
@@ -22163,7 +22089,7 @@ const defaultPayoutAccountFormat = {
22163
22089
  [CountryCodes.Sweden]: "local",
22164
22090
  [CountryCodes.UnitedKingdom]: "local"
22165
22091
  };
22166
- const logger$i = createLogger("useScenarioConfiguration");
22092
+ const logger$j = createLogger("useScenarioConfiguration");
22167
22093
  const useScenarioConfiguration = ({
22168
22094
  getConfigurationData,
22169
22095
  getPayoutAccountFormatData,
@@ -22186,12 +22112,12 @@ const useScenarioConfiguration = ({
22186
22112
  const response = await getConfigurationData();
22187
22113
  setConfigurationResponse(response);
22188
22114
  } catch (err) {
22189
- logger$i.warn("WARNING: Configuration request failed - error:", err);
22115
+ logger$j.warn("WARNING: Configuration request failed - error:", err);
22190
22116
  } finally {
22191
22117
  setLoadingStatus("success");
22192
22118
  }
22193
22119
  };
22194
- makeConfigCallAndSave().catch(logger$i.error);
22120
+ makeConfigCallAndSave().catch(logger$j.error);
22195
22121
  }, [getConfigurationData, setLoadingStatus]);
22196
22122
  useEffect(() => {
22197
22123
  setLoadingStatus("loading");
@@ -22210,12 +22136,12 @@ const useScenarioConfiguration = ({
22210
22136
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
22211
22137
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
22212
22138
  } catch (err) {
22213
- logger$i.warn("WARNING: Payout format request failed - error:", err);
22139
+ logger$j.warn("WARNING: Payout format request failed - error:", err);
22214
22140
  } finally {
22215
22141
  setLoadingStatus("success");
22216
22142
  }
22217
22143
  };
22218
- makePayoutFormatCallAndSave().catch(logger$i.error);
22144
+ makePayoutFormatCallAndSave().catch(logger$j.error);
22219
22145
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
22220
22146
  const {
22221
22147
  fieldConfigurations,
@@ -22254,7 +22180,9 @@ const useScenarioConfiguration = ({
22254
22180
  };
22255
22181
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
22256
22182
  const API_VALIDATION_ERROR_CODE = "30_102";
22183
+ const DOCUMENT_UPLOAD_ERROR_CODE = ["30_105", "30_106"];
22257
22184
  const isValidationError = (error) => error && "errorCode" in error && error.errorCode === API_VALIDATION_ERROR_CODE;
22185
+ const isDocumentUploadError = (error) => error && "errorCode" in error && typeof error.errorCode === "string" && DOCUMENT_UPLOAD_ERROR_CODE.includes(error.errorCode);
22258
22186
  const linkedFieldsMap = {
22259
22187
  "companyRegistrationDetails.vatNumber": ["companyRegistrationDetails.vatAbsenceReason", "companyRegistrationDetails.exemptedFromVat"],
22260
22188
  "companyRegistrationDetails.vatAbsenceReason": ["companyRegistrationDetails.vatNumber", "companyRegistrationDetails.exemptedFromVat"],
@@ -22987,7 +22915,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
22987
22915
  ToastType2["ERROR"] = "error";
22988
22916
  return ToastType2;
22989
22917
  })(ToastType || {});
22990
- const logger$h = createLogger("FormRouterContextProvider");
22918
+ const logger$i = createLogger("FormRouterContextProvider");
22991
22919
  function FormRouterContextProvider({
22992
22920
  children,
22993
22921
  forms: forms2,
@@ -23007,7 +22935,7 @@ function FormRouterContextProvider({
23007
22935
  if (formIndex > -1) {
23008
22936
  setFormIndex(formIndex);
23009
22937
  } else {
23010
- logger$h.error("No form was found to have that field so form navigation failed.");
22938
+ logger$i.error("No form was found to have that field so form navigation failed.");
23011
22939
  }
23012
22940
  }
23013
22941
  }), [forms2, handleGetIdVerificationToken, setFormIndex]);
@@ -23619,7 +23547,7 @@ var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
23619
23547
  CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
23620
23548
  return CompanySearchEvents2;
23621
23549
  })(CompanySearchEvents || {});
23622
- const logger$g = createLogger("useCompanySearch");
23550
+ const logger$h = createLogger("useCompanySearch");
23623
23551
  const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
23624
23552
  function useCompanySearch({
23625
23553
  defaultData,
@@ -23746,7 +23674,7 @@ function useCompanySearch({
23746
23674
  state: companyData.state ?? stateOrProvince2
23747
23675
  });
23748
23676
  } catch (e) {
23749
- logger$g.error(e);
23677
+ logger$h.error(e);
23750
23678
  setError(e);
23751
23679
  setStatus("error");
23752
23680
  } finally {
@@ -23779,7 +23707,7 @@ function useCompanySearch({
23779
23707
  indexSearch: handleCompanyIndexSearch,
23780
23708
  deepSearch: handleCompanyDeepSearch,
23781
23709
  resultsLimit: limit
23782
- })) == null ? void 0 : _a.catch((e) => logger$g.error(e));
23710
+ })) == null ? void 0 : _a.catch((e) => logger$h.error(e));
23783
23711
  }
23784
23712
  }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
23785
23713
  useEffect(() => {
@@ -25582,7 +25510,7 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType) => {
25582
25510
  }
25583
25511
  }, {});
25584
25512
  };
25585
- const logger$f = createLogger("useFormTaskSubmit");
25513
+ const logger$g = createLogger("useFormTaskSubmit");
25586
25514
  function useCompanySearchTaskSubmit({
25587
25515
  task,
25588
25516
  forms: forms2,
@@ -25626,7 +25554,7 @@ function useCompanySearchTaskSubmit({
25626
25554
  });
25627
25555
  }
25628
25556
  } catch (e) {
25629
- logger$f.error(e);
25557
+ logger$g.error(e);
25630
25558
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
25631
25559
  segmentation: {
25632
25560
  ...baseTrackingPayload,
@@ -25678,7 +25606,7 @@ function useCompanySearchTaskSubmit({
25678
25606
  ...trackingPayload
25679
25607
  }
25680
25608
  });
25681
- logger$f.log(submittedLegalEntity);
25609
+ logger$g.log(submittedLegalEntity);
25682
25610
  clearToasts();
25683
25611
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
25684
25612
  } catch (e) {
@@ -25702,7 +25630,7 @@ function useCompanySearchTaskSubmit({
25702
25630
  type: ToastType.ERROR
25703
25631
  });
25704
25632
  }
25705
- logger$f.error(e);
25633
+ logger$g.error(e);
25706
25634
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
25707
25635
  segmentation: {
25708
25636
  ...baseTrackingPayload,
@@ -26057,6 +25985,84 @@ function CompanySearchDropinComponent({
26057
25985
  })
26058
25986
  });
26059
25987
  }
25988
+ const logger$f = createLogger("useLocalStorage");
25989
+ const useLocalStorage = (key, defaultValue, options) => {
25990
+ const {
25991
+ serializer,
25992
+ parser,
25993
+ syncData
25994
+ } = useMemo(() => ({
25995
+ serializer: JSON.stringify,
25996
+ parser: JSON.parse,
25997
+ syncData: true,
25998
+ ...options
25999
+ }), [options]);
26000
+ const rawValueRef = useRef(null);
26001
+ const [value, setValue] = useState(() => {
26002
+ if (typeof window === "undefined")
26003
+ return defaultValue;
26004
+ try {
26005
+ rawValueRef.current = window.localStorage.getItem(key);
26006
+ const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
26007
+ return res;
26008
+ } catch (err) {
26009
+ logger$f.error(err);
26010
+ return defaultValue;
26011
+ }
26012
+ });
26013
+ useEffect(() => {
26014
+ if (typeof window === "undefined")
26015
+ return;
26016
+ const updateLocalStorage = () => {
26017
+ if (value !== void 0) {
26018
+ const newValue = serializer(value);
26019
+ const oldValue = rawValueRef.current;
26020
+ rawValueRef.current = newValue;
26021
+ window.localStorage.setItem(key, newValue);
26022
+ window.dispatchEvent(new StorageEvent("storage", {
26023
+ storageArea: window.localStorage,
26024
+ url: window.location.href,
26025
+ key,
26026
+ newValue,
26027
+ oldValue
26028
+ }));
26029
+ } else {
26030
+ window.localStorage.removeItem(key);
26031
+ window.dispatchEvent(new StorageEvent("storage", {
26032
+ storageArea: window.localStorage,
26033
+ url: window.location.href,
26034
+ key
26035
+ }));
26036
+ }
26037
+ };
26038
+ try {
26039
+ updateLocalStorage();
26040
+ } catch (err) {
26041
+ logger$f.error(err);
26042
+ }
26043
+ }, [value]);
26044
+ useEffect(() => {
26045
+ if (!syncData)
26046
+ return;
26047
+ const handleStorageChange = (event) => {
26048
+ if (event.key !== key || event.storageArea !== window.localStorage)
26049
+ return;
26050
+ try {
26051
+ if (event.newValue !== rawValueRef.current) {
26052
+ rawValueRef.current = event.newValue;
26053
+ setValue(event.newValue ? parser(event.newValue) : void 0);
26054
+ }
26055
+ } catch (err) {
26056
+ logger$f.error(err);
26057
+ }
26058
+ };
26059
+ if (typeof window === "undefined")
26060
+ return;
26061
+ window.addEventListener("storage", handleStorageChange);
26062
+ return () => window.removeEventListener("storage", handleStorageChange);
26063
+ }, [key, syncData]);
26064
+ return [value, setValue];
26065
+ };
26060
26066
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
26061
26067
  const useHasSeenIntroduction = ({
26062
26068
  legalEntityId
@@ -26067,61 +26073,6 @@ const useHasSeenIntroduction = ({
26067
26073
  setHasSeenIntroduction
26068
26074
  };
26069
26075
  };
26070
- const useLegalEntityType = ({
26071
- legalEntity
26072
- }) => {
26073
- const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
26074
- const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
26075
- const hasLegalAssociation = isTrust || isSoleProprietor;
26076
- switch (legalEntity.type) {
26077
- case LegalEntityType.INDIVIDUAL:
26078
- case LegalEntityType.ORGANIZATION:
26079
- if (!hasLegalAssociation)
26080
- return legalEntity.type;
26081
- if (isSoleProprietor)
26082
- return LegalEntityType.SOLE_PROPRIETORSHIP;
26083
- if (isTrust)
26084
- return LegalEntityType.TRUST;
26085
- break;
26086
- default:
26087
- return void 0;
26088
- }
26089
- };
26090
- const useCanSeeIntroduction = ({
26091
- legalEntity
26092
- }) => {
26093
- const legalEntityType = useLegalEntityType({
26094
- legalEntity
26095
- });
26096
- const {
26097
- isSettingEnabled
26098
- } = useSettingsContext();
26099
- switch (legalEntityType) {
26100
- case LegalEntityType.INDIVIDUAL:
26101
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
26102
- case LegalEntityType.ORGANIZATION:
26103
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
26104
- case LegalEntityType.SOLE_PROPRIETORSHIP:
26105
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
26106
- case LegalEntityType.TRUST:
26107
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
26108
- default:
26109
- return false;
26110
- }
26111
- };
26112
- const useShouldShowIntroduction = ({
26113
- legalEntity
26114
- }) => {
26115
- const canSeeIntroduction = useCanSeeIntroduction({
26116
- legalEntity
26117
- });
26118
- const {
26119
- hasSeenIntroduction
26120
- } = useHasSeenIntroduction({
26121
- legalEntityId: legalEntity.id
26122
- });
26123
- return canSeeIntroduction && !hasSeenIntroduction;
26124
- };
26125
26076
  const getHasSeenSingpassSelectionStorageKey = (legalEntityId) => `COMPLETED_SINGPASS_SELECTION-${legalEntityId}`;
26126
26077
  const useHasSeenSingpassSelection = ({
26127
26078
  legalEntityId
@@ -26132,27 +26083,23 @@ const useHasSeenSingpassSelection = ({
26132
26083
  setHasSeenSingpassSelection
26133
26084
  };
26134
26085
  };
26135
- const useShouldShowSingpass = ({
26136
- isExperimentEnabled = false,
26086
+ const useIsEligibleForSingpass = ({
26137
26087
  legalEntity,
26138
26088
  accountHolder: accountHolder2,
26139
26089
  handleOpenSingpassAuthorizationLink
26140
26090
  }) => {
26141
- const shouldShowSingpassForAccountHolder = (newAccountHolder) => {
26142
- if (!isExperimentEnabled) {
26143
- return false;
26144
- }
26145
- const country2 = getLegalEntityCountry(legalEntity);
26146
- const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink && country2 === CountryCodes.Singapore);
26147
- if (newAccountHolder) {
26148
- return isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor";
26149
- }
26150
- return isSingpassEnabled && (legalEntity == null ? void 0 : legalEntity.type) === LegalEntityType.ORGANIZATION;
26151
- };
26152
- return {
26153
- shouldShowSingpass: shouldShowSingpassForAccountHolder(accountHolder2),
26154
- shouldShowSingpassForAccountHolder
26155
- };
26091
+ const {
26092
+ isExperimentEnabled
26093
+ } = useExperimentsContext();
26094
+ if (!isExperimentEnabled("ShowSingPassButtonForCompanies"))
26095
+ return false;
26096
+ const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink) && getLegalEntityCountry(legalEntity) === CountryCodes.Singapore;
26097
+ if (!isSingpassEnabled)
26098
+ return false;
26099
+ if (accountHolder2) {
26100
+ return accountHolder2 === "theCompanyIWorkFor";
26101
+ }
26102
+ return legalEntity.type === LegalEntityType.ORGANIZATION;
26156
26103
  };
26157
26104
  const logger$e = createLogger("useAssociatedLegalArrangement");
26158
26105
  function useAssociatedLegalArrangement({
@@ -26197,11 +26144,6 @@ const useExemptSettlor = ({
26197
26144
  }, [trust2, updateExemptSettlor]);
26198
26145
  return exemptSettlor;
26199
26146
  };
26200
- const leIdStorageKey = "LE_ID";
26201
- const useLeId = () => {
26202
- const [leIdFromLocalStorage, setLeIdIntoLocalStorage] = useLocalStorage(leIdStorageKey, null);
26203
- return [leIdFromLocalStorage, setLeIdIntoLocalStorage];
26204
- };
26205
26147
  function useSalesChannelsSettings() {
26206
26148
  const {
26207
26149
  isSettingEnabled
@@ -26669,11 +26611,9 @@ const BusinessTypeIcon = (item) => jsx(Icon, {
26669
26611
  const BusinessTypeSelection = ({
26670
26612
  legalEntityResponse,
26671
26613
  accountHolder: accountHolder2,
26672
- onAccountHolderSelect,
26614
+ onComplete,
26615
+ onBack,
26673
26616
  handleUpdateLegalEntity,
26674
- taskHistory,
26675
- setTaskHistory,
26676
- onNavigateTo,
26677
26617
  baseTrackingPayload
26678
26618
  }) => {
26679
26619
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
@@ -26693,8 +26633,7 @@ const BusinessTypeSelection = ({
26693
26633
  1,
26694
26634
  2
26695
26635
  /* WE_CANNOT_SET_UP_ACCOUNT */
26696
- ].includes(currentStep);
26697
- const isPrevTaskTasksOverview = taskHistory[taskHistory.length - 2] === TaskTypes.TASKS_OVERVIEW;
26636
+ ].includes(currentStep) || currentStep === 0 && Boolean(onBack);
26698
26637
  const {
26699
26638
  businessTypeOptions,
26700
26639
  legalArrangementOptions
@@ -26786,7 +26725,7 @@ const BusinessTypeSelection = ({
26786
26725
  segmentation: baseTrackingPayload
26787
26726
  });
26788
26727
  } else {
26789
- onAccountHolderSelect(newAccountHolder);
26728
+ onComplete(newAccountHolder);
26790
26729
  }
26791
26730
  if (isLegalArrangementChanging) {
26792
26731
  await updateLegalEntityAndSelectAccountHolder();
@@ -26826,7 +26765,7 @@ const BusinessTypeSelection = ({
26826
26765
  });
26827
26766
  } finally {
26828
26767
  setLoadingStatus("success");
26829
- onAccountHolderSelect(newAccountHolder);
26768
+ onComplete(newAccountHolder);
26830
26769
  }
26831
26770
  };
26832
26771
  const handleBackClick = () => {
@@ -26842,9 +26781,8 @@ const BusinessTypeSelection = ({
26842
26781
  /* BUSINESS_TYPE_SELECTION */
26843
26782
  );
26844
26783
  }
26845
- if (currentStep === 0 && isPrevTaskTasksOverview) {
26846
- setTaskHistory(taskHistory.slice(taskHistory.length - 2));
26847
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
26784
+ if (currentStep === 0) {
26785
+ onBack == null ? void 0 : onBack();
26848
26786
  }
26849
26787
  };
26850
26788
  const isWeCannotSetUpAccountStep = currentStep === 2;
@@ -26951,7 +26889,7 @@ const BusinessTypeSelection = ({
26951
26889
  disabled: currentStep === 1 && !data.legalArrangement,
26952
26890
  onClick: handleNextClick,
26953
26891
  type: "button"
26954
- }), (hasBackButton || isPrevTaskTasksOverview) && jsxs("button", {
26892
+ }), hasBackButton && jsxs("button", {
26955
26893
  onClick: handleBackClick,
26956
26894
  type: "button",
26957
26895
  "aria-label": i18n.get("back"),
@@ -27762,6 +27700,48 @@ var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
27762
27700
  IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
27763
27701
  return IntroductionScreenTiming2;
27764
27702
  })(IntroductionScreenTiming || {});
27703
+ const useLegalEntityType = ({
27704
+ legalEntity
27705
+ }) => {
27706
+ const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
27707
+ const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
27708
+ const hasLegalAssociation = isTrust || isSoleProprietor;
27709
+ switch (legalEntity.type) {
27710
+ case LegalEntityType.INDIVIDUAL:
27711
+ case LegalEntityType.ORGANIZATION:
27712
+ if (!hasLegalAssociation)
27713
+ return legalEntity.type;
27714
+ if (isSoleProprietor)
27715
+ return LegalEntityType.SOLE_PROPRIETORSHIP;
27716
+ if (isTrust)
27717
+ return LegalEntityType.TRUST;
27718
+ break;
27719
+ default:
27720
+ return void 0;
27721
+ }
27722
+ };
27723
+ const useCanSeeIntroduction = ({
27724
+ legalEntity
27725
+ }) => {
27726
+ const legalEntityType = useLegalEntityType({
27727
+ legalEntity
27728
+ });
27729
+ const {
27730
+ isSettingEnabled
27731
+ } = useSettingsContext();
27732
+ switch (legalEntityType) {
27733
+ case LegalEntityType.INDIVIDUAL:
27734
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
27735
+ case LegalEntityType.ORGANIZATION:
27736
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
27737
+ case LegalEntityType.SOLE_PROPRIETORSHIP:
27738
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
27739
+ case LegalEntityType.TRUST:
27740
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
27741
+ default:
27742
+ return false;
27743
+ }
27744
+ };
27765
27745
  const useIntroductionScreens = ({
27766
27746
  legalEntity,
27767
27747
  tasks
@@ -29513,7 +29493,7 @@ function IndividualDropinComponent({
29513
29493
  const useBankConfigurationHandlers = ({
29514
29494
  isEmbeddedDropin,
29515
29495
  handleGetBankVerificationVendors,
29516
- bankAccountCountry: bankAccountCountry2,
29496
+ bankAccountCountry,
29517
29497
  getConfiguration: getConfiguration2,
29518
29498
  legalEntityType,
29519
29499
  capabilities
@@ -29522,16 +29502,16 @@ const useBankConfigurationHandlers = ({
29522
29502
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
29523
29503
  useEffect(() => {
29524
29504
  (async () => {
29525
- const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry2) : [];
29505
+ const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
29526
29506
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
29527
29507
  })();
29528
- }, [bankAccountCountry2]);
29508
+ }, [bankAccountCountry]);
29529
29509
  const getConfigurationData = useCallback(async () => {
29530
29510
  var _a;
29531
29511
  const configuration = await getConfiguration2({
29532
29512
  legalEntityType,
29533
29513
  capabilities,
29534
- country: bankAccountCountry2
29514
+ country: bankAccountCountry
29535
29515
  });
29536
29516
  if (!callBankVerificationVendorsUpfront || !((_a = bankVerificationVendorsResponse == null ? void 0 : bankVerificationVendorsResponse[0]) == null ? void 0 : _a.name)) {
29537
29517
  return configuration;
@@ -29539,10 +29519,10 @@ const useBankConfigurationHandlers = ({
29539
29519
  return {
29540
29520
  ...configuration,
29541
29521
  bankVerificationProviders: {
29542
- [bankAccountCountry2]: bankVerificationVendorsResponse[0].name
29522
+ [bankAccountCountry]: bankVerificationVendorsResponse[0].name
29543
29523
  }
29544
29524
  };
29545
- }, [bankAccountCountry2, capabilities, bankVerificationVendorsResponse]);
29525
+ }, [bankAccountCountry, capabilities, bankVerificationVendorsResponse]);
29546
29526
  const getBankVerificationVendorsHandler = useMemo(() => callBankVerificationVendorsUpfront && bankVerificationVendorsResponse ? (country2) => country2 && Promise.resolve(bankVerificationVendorsResponse) : handleGetBankVerificationVendors, [bankVerificationVendorsResponse, callBankVerificationVendorsUpfront]);
29547
29527
  return {
29548
29528
  getConfigurationData,
@@ -29701,7 +29681,7 @@ function PayoutDetailsDropinComponent({
29701
29681
  }
29702
29682
  } = useStateContext();
29703
29683
  const formValidity = currentState.validityByForm;
29704
- const bankAccountCountry2 = ((_c = (_b = currentState == null ? void 0 : currentState.data) == null ? void 0 : _b.payoutVerificationMethod) == null ? void 0 : _c.bankCountry) ?? defaultPayoutCountry;
29684
+ const bankAccountCountry = ((_c = (_b = currentState == null ? void 0 : currentState.data) == null ? void 0 : _b.payoutVerificationMethod) == null ? void 0 : _c.bankCountry) ?? defaultPayoutCountry;
29705
29685
  const [hideDropinLayout, setHideDropinLayout] = useState(false);
29706
29686
  const [submitButtonLabel, setSubmitButtonLabel] = useState("submit");
29707
29687
  const [skipSubmit, setSkipSubmit] = useState(false);
@@ -29709,7 +29689,7 @@ function PayoutDetailsDropinComponent({
29709
29689
  const [hideBackButton, setHideBackButton] = useState(false);
29710
29690
  const [loadingStatus, setLoadingStatus] = useState("success");
29711
29691
  const [data, setData] = useState(prefilledData);
29712
- const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_e = (_d = getCapabilityProblems(legalEntityResponse, bankAccountCountry2)) == null ? void 0 : _d.BankAccount) == null ? void 0 : _e[transferInstrument.id] : void 0));
29692
+ const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_e = (_d = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _d.BankAccount) == null ? void 0 : _e[transferInstrument.id] : void 0));
29713
29693
  const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(prefilledData.payoutAccountDetails);
29714
29694
  const existingBankAccountFormat = transferInstrument ? ((_f = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _f.iban) ? "iban" : "local" : void 0;
29715
29695
  const baseTrackingPayload = getBaseTrackingPayload({
@@ -29731,23 +29711,23 @@ function PayoutDetailsDropinComponent({
29731
29711
  ...currentState.data,
29732
29712
  payoutAccountDetails: {
29733
29713
  ...(_a2 = currentState.data) == null ? void 0 : _a2.payoutAccountDetails,
29734
- currency: (_b2 = currencyByCountry[bankAccountCountry2]) == null ? void 0 : _b2[0]
29714
+ currency: (_b2 = currencyByCountry[bankAccountCountry]) == null ? void 0 : _b2[0]
29735
29715
  }
29736
29716
  });
29737
29717
  onChange == null ? void 0 : onChange(currentState);
29738
- }, [bankAccountCountry2, currentState, onChange]);
29718
+ }, [bankAccountCountry, currentState, onChange]);
29739
29719
  const {
29740
29720
  getConfigurationData,
29741
29721
  getBankVerificationVendorsHandler
29742
29722
  } = useBankConfigurationHandlers({
29743
29723
  isEmbeddedDropin,
29744
29724
  handleGetBankVerificationVendors,
29745
- bankAccountCountry: bankAccountCountry2,
29725
+ bankAccountCountry,
29746
29726
  getConfiguration: getConfiguration2,
29747
29727
  legalEntityType: legalEntityResponse.type,
29748
29728
  capabilities
29749
29729
  });
29750
- const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry2), [bankAccountCountry2]);
29730
+ const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry), [bankAccountCountry]);
29751
29731
  const {
29752
29732
  fieldConfigurations,
29753
29733
  requiredFields,
@@ -29758,16 +29738,16 @@ function PayoutDetailsDropinComponent({
29758
29738
  getPayoutAccountFormatData,
29759
29739
  instantVerificationEnabled,
29760
29740
  setLoadingStatus,
29761
- country: bankAccountCountry2,
29741
+ country: bankAccountCountry,
29762
29742
  existingBankAccountFormat
29763
29743
  });
29764
29744
  const fieldsFromCustomRules = useMemo(() => rules$1({
29765
29745
  data,
29766
- country: bankAccountCountry2,
29746
+ country: bankAccountCountry,
29767
29747
  taskType,
29768
29748
  requiredFields
29769
- }), [bankAccountCountry2, data, taskType]);
29770
- const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry2]);
29749
+ }), [bankAccountCountry, data, taskType]);
29750
+ const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry]);
29771
29751
  const payoutDetailsSteps = useMemo(() => {
29772
29752
  var _a2;
29773
29753
  return getAppropriatePayoutDetailsSteps(taskType, Boolean((_a2 = prefilledData == null ? void 0 : prefilledData.payoutAccountDetails) == null ? void 0 : _a2.transferInstrumentId), !transferInstrument && isInstantVerificationAvailable({
@@ -29890,6 +29870,11 @@ function PayoutDetailsDropinComponent({
29890
29870
  ...problems,
29891
29871
  validationErrors
29892
29872
  });
29873
+ } else if (isDocumentUploadError(e)) {
29874
+ showToast({
29875
+ label: i18n.get("documentUploadfailed"),
29876
+ type: ToastType.ERROR
29877
+ });
29893
29878
  } else if (isMaintenanceModeError(e)) {
29894
29879
  showToast({
29895
29880
  label: i18n.get("failedToUpdateDetails"),
@@ -31514,7 +31499,7 @@ function SolePropDropinComponent({
31514
31499
  const solePropCountry = ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country) : void 0;
31515
31500
  summaryData.solePropNameAndCountry = {
31516
31501
  legalNameOfSoleProprietor: (_b2 = data2.solePropNameAndCountry) == null ? void 0 : _b2.legalCompanyName,
31517
- countryOfEstablishment: solePropCountry
31502
+ countryRegionOfEstablishment: solePropCountry
31518
31503
  };
31519
31504
  if ((_c = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress) {
31520
31505
  summaryData.solePropRegistrationAddress.hasInnerForms = true;
@@ -31799,7 +31784,7 @@ function TrustDropinComponent({
31799
31784
  })) == null ? void 0 : _c.name) : void 0;
31800
31785
  summaryData.trustRegistrationDetails = {
31801
31786
  nameOfTrustAgreement: (_d = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _d.legalName,
31802
- countryOfEstablishment: trustCountry,
31787
+ countryRegionOfEstablishment: trustCountry,
31803
31788
  typeOfTrustAgreement: trustType2,
31804
31789
  objectOfTrust: (_e = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
31805
31790
  taxId: (_f = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _f.taxId
@@ -31892,6 +31877,107 @@ function TrustDropinComponent({
31892
31877
  })
31893
31878
  });
31894
31879
  }
31880
+ const useShouldShowIntroduction = ({
31881
+ legalEntity
31882
+ }) => {
31883
+ const canSeeIntroduction = useCanSeeIntroduction({
31884
+ legalEntity
31885
+ });
31886
+ const {
31887
+ hasSeenIntroduction
31888
+ } = useHasSeenIntroduction({
31889
+ legalEntityId: legalEntity.id
31890
+ });
31891
+ return canSeeIntroduction && !hasSeenIntroduction;
31892
+ };
31893
+ const useNavigation = ({
31894
+ legalEntity,
31895
+ onNavigate,
31896
+ handleOpenSingpassAuthorizationLink
31897
+ }) => {
31898
+ const isNewEntryFlowEnabled = useEnableNewEntryFlow();
31899
+ const showIntroduction = useShouldShowIntroduction({
31900
+ legalEntity
31901
+ });
31902
+ const {
31903
+ hasSeenSingpassSelection
31904
+ } = useHasSeenSingpassSelection({
31905
+ legalEntityId: legalEntity.id
31906
+ });
31907
+ const {
31908
+ accountHolder: accountHolder2
31909
+ } = useCoreContext();
31910
+ const eligibleForSingpass = useIsEligibleForSingpass({
31911
+ legalEntity,
31912
+ accountHolder: accountHolder2,
31913
+ handleOpenSingpassAuthorizationLink
31914
+ });
31915
+ const shouldShowSingpassSelection = eligibleForSingpass && !hasSeenSingpassSelection;
31916
+ const [taskHistory, setTaskHistory] = useState(["default"]);
31917
+ const actualTasks = taskHistory.filter((task) => task !== "default");
31918
+ const navigateTo = useCallback((task, deletePreviousHistory = false) => {
31919
+ const pushNewTask = () => setTaskHistory((taskHistory2) => deletePreviousHistory ? [task] : [...taskHistory2, task]);
31920
+ if (task === "default") {
31921
+ setTimeout(pushNewTask);
31922
+ } else {
31923
+ pushNewTask();
31924
+ onNavigate == null ? void 0 : onNavigate(task);
31925
+ }
31926
+ }, [onNavigate]);
31927
+ const navigateBack = useCallback((stepCount = 1) => {
31928
+ if (taskHistory.length <= 1)
31929
+ return;
31930
+ const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
31931
+ if (prevTask === "default") {
31932
+ throw Error("Cannot navigate back to 'default' task");
31933
+ }
31934
+ if (prevTask === TaskTypes.TASKS_OVERVIEW) {
31935
+ setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
31936
+ onNavigate == null ? void 0 : onNavigate(TaskTypes.TASKS_OVERVIEW);
31937
+ return;
31938
+ }
31939
+ setTaskHistory(taskHistory.slice(0, -1 * stepCount));
31940
+ onNavigate == null ? void 0 : onNavigate(prevTask);
31941
+ }, [taskHistory, onNavigate]);
31942
+ useEffect(() => {
31943
+ const pushedTask = taskHistory.at(-1);
31944
+ if (pushedTask === "default") {
31945
+ const defaultTask = getDefaultTask({
31946
+ legalEntity,
31947
+ accountHolder: accountHolder2,
31948
+ showIntroduction,
31949
+ isNewEntryFlowEnabled,
31950
+ shouldShowSingpassSelection
31951
+ });
31952
+ setTaskHistory([...taskHistory.slice(0, taskHistory.length - 1), defaultTask]);
31953
+ }
31954
+ }, [legalEntity, accountHolder2, showIntroduction, isNewEntryFlowEnabled, shouldShowSingpassSelection, taskHistory]);
31955
+ return {
31956
+ currentTask: actualTasks.at(-1),
31957
+ previousTask: actualTasks.at(-2),
31958
+ navigateBack,
31959
+ navigateTo
31960
+ };
31961
+ };
31962
+ const getDefaultTask = ({
31963
+ legalEntity,
31964
+ accountHolder: accountHolder2,
31965
+ isNewEntryFlowEnabled,
31966
+ showIntroduction,
31967
+ shouldShowSingpassSelection
31968
+ }) => {
31969
+ var _a, _b;
31970
+ const hasOwnEntityAssocation = (_a = legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.associatorId === legalEntity.id);
31971
+ const hasOrganizationType = (_b = legalEntity.organization) == null ? void 0 : _b.type;
31972
+ const hasProgressedBeyondEntitySelection = hasOwnEntityAssocation || !!hasOrganizationType;
31973
+ if (isNewEntryFlowEnabled && !accountHolder2 && !hasProgressedBeyondEntitySelection)
31974
+ return TaskTypes.BUSINESS_TYPE_SELECTION;
31975
+ if (showIntroduction)
31976
+ return TaskTypes.INTRODUCTION;
31977
+ if (shouldShowSingpassSelection)
31978
+ return TaskTypes.SINGPASS_SELECTION;
31979
+ return TaskTypes.TASKS_OVERVIEW;
31980
+ };
31895
31981
  const PAGES_WITH_POLLING = [TaskTypes.DECISION_MAKER_OVERVIEW, TaskTypes.TASKS_OVERVIEW];
31896
31982
  const POLLING_INTERVAL = 3e3;
31897
31983
  const logger$b = createLogger("DropinComposerComponent");
@@ -31926,50 +32012,27 @@ function DropinComposerComponent({
31926
32012
  showToast
31927
32013
  } = useToastContext();
31928
32014
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
31929
- const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
31930
- const isSingpassExperimentEnabled = isExperimentEnabled("ShowSingPassButtonForCompanies");
31931
32015
  const {
31932
- hasSeenSingpassSelection,
32016
+ handleOpenSingpassAuthorizationLink
32017
+ } = args;
32018
+ const {
31933
32019
  setHasSeenSingpassSelection
31934
32020
  } = useHasSeenSingpassSelection({
31935
32021
  legalEntityId: legalEntityResponse.id
31936
32022
  });
31937
- const [leId, setLeId] = useLeId();
31938
- const showIntroduction = useShouldShowIntroduction({
31939
- legalEntity: legalEntityResponse
31940
- });
31941
32023
  const {
31942
32024
  setHasSeenIntroduction
31943
32025
  } = useHasSeenIntroduction({
31944
32026
  legalEntityId: legalEntityResponse.id
31945
32027
  });
31946
- const [tasks, setTasks] = useState([]);
31947
- const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
31948
- const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
31949
- const {
31950
- handleOpenSingpassAuthorizationLink
31951
- } = args;
31952
- const {
31953
- shouldShowSingpass,
31954
- shouldShowSingpassForAccountHolder
31955
- } = useShouldShowSingpass({
31956
- isExperimentEnabled: isSingpassExperimentEnabled,
32028
+ const eligibleForSingpass = useIsEligibleForSingpass({
31957
32029
  legalEntity: legalEntityResponse,
31958
32030
  accountHolder: accountHolder2,
31959
32031
  handleOpenSingpassAuthorizationLink
31960
32032
  });
31961
- const shouldShowSingpassSelection = shouldShowSingpass && !hasSeenSingpassSelection;
31962
- const initialTask = useMemo(() => {
31963
- if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
31964
- return TaskTypes.BUSINESS_TYPE_SELECTION;
31965
- }
31966
- if (showIntroduction)
31967
- return TaskTypes.INTRODUCTION;
31968
- if (shouldShowSingpassSelection)
31969
- return TaskTypes.SINGPASS_SELECTION;
31970
- return TaskTypes.TASKS_OVERVIEW;
31971
- }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
31972
- const [taskHistory, setTaskHistory] = useState([initialTask]);
32033
+ const [tasks, setTasks] = useState([]);
32034
+ const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32035
+ const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
31973
32036
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
31974
32037
  const {
31975
32038
  associatedLegalArrangement,
@@ -31993,6 +32056,16 @@ function DropinComposerComponent({
31993
32056
  const [transferInstrument, setTransferInstrument] = useState(null);
31994
32057
  const [capabilityProblems, setCapabilityProblems] = useState(getCapabilityProblems(legalEntityResponse, rootLegalEntityCountry, isExperimentEnabled));
31995
32058
  const [bankVerificationVendors, setBankVerificationVendors] = useState();
32059
+ const {
32060
+ currentTask,
32061
+ previousTask,
32062
+ navigateTo,
32063
+ navigateBack
32064
+ } = useNavigation({
32065
+ legalEntity: legalEntityResponse,
32066
+ onNavigate,
32067
+ handleOpenSingpassAuthorizationLink
32068
+ });
31996
32069
  const hasTrust = accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse);
31997
32070
  const reviewRequired = (rootLegalEntity == null ? void 0 : rootLegalEntity.id) && ((_b = (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[rootLegalEntity.id]) == null ? void 0 : _b.isReviewRequired);
31998
32071
  const additionalSalesChannels = useSalesChannelsSettings();
@@ -32255,7 +32328,7 @@ function DropinComposerComponent({
32255
32328
  }
32256
32329
  };
32257
32330
  const handleSingpassSelectionNextClick = async (method) => {
32258
- if (method === "singpass" && shouldShowSingpass) {
32331
+ if (method === "singpass") {
32259
32332
  try {
32260
32333
  const {
32261
32334
  item: {
@@ -32264,8 +32337,8 @@ function DropinComposerComponent({
32264
32337
  } = await handleOpenSingpassAuthorizationLink();
32265
32338
  setHasSeenSingpassSelection(true);
32266
32339
  window.open(authUrl, "_blank").focus();
32267
- if (taskHistory[taskHistory.length - 1] !== TaskTypes.TASKS_OVERVIEW) {
32268
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32340
+ if (currentTask !== TaskTypes.TASKS_OVERVIEW) {
32341
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32269
32342
  }
32270
32343
  } catch (e) {
32271
32344
  logger$b.error(e);
@@ -32277,13 +32350,9 @@ function DropinComposerComponent({
32277
32350
  }
32278
32351
  if (method === "manual") {
32279
32352
  setHasSeenSingpassSelection(true);
32280
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32353
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32281
32354
  }
32282
32355
  };
32283
- const onNavigateTo = (task) => {
32284
- setTaskHistory([...taskHistory, task]);
32285
- onNavigate(task);
32286
- };
32287
32356
  const onNavigateToDecisionMakerIndividual = async (task, id2, parentId) => {
32288
32357
  if (parentId && parentId !== rootLegalEntity.id) {
32289
32358
  const parentLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(parentId));
@@ -32295,7 +32364,7 @@ function DropinComposerComponent({
32295
32364
  try {
32296
32365
  const currentAssociatedLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(id2));
32297
32366
  setAssociatedLegalEntity(currentAssociatedLegalEntity);
32298
- onNavigateTo(task);
32367
+ navigateTo(task);
32299
32368
  } catch (e) {
32300
32369
  showToast({
32301
32370
  label: i18n.get("failedFetchingDecisionMaker"),
@@ -32304,7 +32373,7 @@ function DropinComposerComponent({
32304
32373
  }
32305
32374
  } else {
32306
32375
  setAssociatedLegalEntity(null);
32307
- onNavigateTo(task);
32376
+ navigateTo(task);
32308
32377
  }
32309
32378
  };
32310
32379
  const onNavigateToPayinOrPayout = async (id2, task = TaskTypes.PAYOUT) => {
@@ -32315,17 +32384,17 @@ function DropinComposerComponent({
32315
32384
  await getSolePropietor();
32316
32385
  }
32317
32386
  } finally {
32318
- onNavigateTo(task);
32387
+ navigateTo(task);
32319
32388
  }
32320
32389
  } else {
32321
32390
  setTransferInstrument(null);
32322
- onNavigateTo(task);
32391
+ navigateTo(task);
32323
32392
  }
32324
32393
  };
32325
32394
  const onNavigateToPci = async (task = TaskTypes.PCI_DSS) => {
32326
32395
  try {
32327
32396
  await getPciTemplate2();
32328
- onNavigateTo(task);
32397
+ navigateTo(task);
32329
32398
  } catch (e) {
32330
32399
  showToast({
32331
32400
  label: i18n.get("failedToGetPciTemplate"),
@@ -32337,15 +32406,15 @@ function DropinComposerComponent({
32337
32406
  try {
32338
32407
  await getSolePropietor();
32339
32408
  } finally {
32340
- onNavigateTo(task);
32409
+ navigateTo(task);
32341
32410
  }
32342
32411
  };
32343
32412
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
32344
32413
  try {
32345
32414
  if (associatedLegalArrangement) {
32346
- onNavigateTo(task);
32415
+ navigateTo(task);
32347
32416
  } else {
32348
- onNavigateTo(TaskTypes.TRUST);
32417
+ navigateTo(TaskTypes.TRUST);
32349
32418
  }
32350
32419
  } catch (e) {
32351
32420
  showToast({
@@ -32363,7 +32432,7 @@ function DropinComposerComponent({
32363
32432
  setAssociatedLegalEntity(response);
32364
32433
  }
32365
32434
  setTrustMember(tm);
32366
- onNavigateTo(tm.trustMemberType === "company" ? TaskTypes.TRUST_MEMBER_COMPANY : TaskTypes.TRUST_MEMBER_INDIVIDUAL);
32435
+ navigateTo(tm.trustMemberType === "company" ? TaskTypes.TRUST_MEMBER_COMPANY : TaskTypes.TRUST_MEMBER_INDIVIDUAL);
32367
32436
  } catch (e) {
32368
32437
  showToast({
32369
32438
  label: i18n.get("failedToFetchTrustMemberDetails"),
@@ -32373,35 +32442,23 @@ function DropinComposerComponent({
32373
32442
  };
32374
32443
  const onNavigateToTrustMemberRoleAndType = (tm) => {
32375
32444
  setTrustMember(tm === "new" ? null : tm);
32376
- onNavigateTo(TaskTypes.TRUST_MEMBER_ROLE_AND_TYPE);
32377
- };
32378
- const navigateBack = (stepCount = 1) => {
32379
- if (taskHistory.length > 1) {
32380
- const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
32381
- if (prevTask === TaskTypes.TASKS_OVERVIEW) {
32382
- setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
32383
- onNavigate(TaskTypes.TASKS_OVERVIEW);
32384
- } else {
32385
- setTaskHistory(taskHistory.slice(0, -1 * stepCount));
32386
- onNavigate(taskHistory[taskHistory.length - 1]);
32387
- }
32388
- }
32445
+ navigateTo(TaskTypes.TRUST_MEMBER_ROLE_AND_TYPE);
32389
32446
  };
32390
32447
  const navigateToTypeSwitcher = (leType) => {
32391
32448
  setLegalEntityType(leType);
32392
- onNavigateTo(TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER);
32449
+ navigateTo(TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER);
32393
32450
  };
32394
32451
  const navigateToTargetEntityType = () => {
32395
32452
  switch (legalEntityType) {
32396
32453
  case LegalEntityType.INDIVIDUAL:
32397
- onNavigateTo(TaskTypes.INDIVIDUAL);
32454
+ navigateTo(TaskTypes.INDIVIDUAL);
32398
32455
  break;
32399
32456
  case LegalEntityType.ORGANIZATION:
32400
- onNavigateTo(TaskTypes.COMPANY);
32457
+ navigateTo(TaskTypes.COMPANY);
32401
32458
  break;
32402
32459
  }
32403
32460
  };
32404
- const navigateTo = async (task, id2) => {
32461
+ const onNavigateToTask = async (task, id2) => {
32405
32462
  switch (task) {
32406
32463
  case TaskTypes.PAYOUT:
32407
32464
  await onNavigateToPayinOrPayout(id2, TaskTypes.PAYOUT);
@@ -32426,7 +32483,7 @@ function DropinComposerComponent({
32426
32483
  break;
32427
32484
  }
32428
32485
  default:
32429
- onNavigateTo(task);
32486
+ navigateTo(task);
32430
32487
  }
32431
32488
  };
32432
32489
  const componentOnChange = (state2) => {
@@ -32499,15 +32556,14 @@ function DropinComposerComponent({
32499
32556
  }, [rootLegalEntity.type, contextCountry]);
32500
32557
  useEffect(() => {
32501
32558
  if (hasRejectedCapabilities(rootLegalEntity)) {
32502
- setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
32559
+ navigateTo(TaskTypes.CAPABILITY_REJECTED, true);
32503
32560
  }
32504
32561
  }, [rootLegalEntity]);
32505
32562
  useEffect(() => {
32506
- if (!PAGES_WITH_POLLING.includes(taskHistory[taskHistory.length - 1]) || hasResolvedCapabilities(rootLegalEntity)) {
32563
+ if (!PAGES_WITH_POLLING.includes(currentTask) || hasResolvedCapabilities(rootLegalEntity)) {
32507
32564
  return;
32508
32565
  }
32509
32566
  if (hasRejectedCapabilities(rootLegalEntity)) {
32510
- setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
32511
32567
  return;
32512
32568
  }
32513
32569
  const timeoutId = setTimeout(() => {
@@ -32516,17 +32572,10 @@ function DropinComposerComponent({
32516
32572
  return () => {
32517
32573
  clearInterval(timeoutId);
32518
32574
  };
32519
- }, [refreshLegalEntity, rootLegalEntity, taskHistory]);
32520
- useEffect(() => {
32521
- if (!isNewEntryFlowEnabled || leId !== legalEntityResponse.id) {
32522
- setLeId(null);
32523
- setAccountHolder(null);
32524
- }
32525
- }, [isNewEntryFlowEnabled, setLeId]);
32575
+ }, [refreshLegalEntity, rootLegalEntity]);
32526
32576
  if (isLoadingConfiguration) {
32527
32577
  return jsx(Shimmer, {});
32528
32578
  }
32529
- const currentTask = taskHistory[taskHistory.length - 1];
32530
32579
  switch (currentTask) {
32531
32580
  case TaskTypes.BUSINESS_TYPE_SELECTION:
32532
32581
  return jsx("div", {
@@ -32535,23 +32584,12 @@ function DropinComposerComponent({
32535
32584
  ...args,
32536
32585
  legalEntityResponse: rootLegalEntity,
32537
32586
  accountHolder: accountHolder2,
32538
- onAccountHolderSelect: async (newAccountHolder) => {
32539
- setLeId(legalEntityResponse.id);
32587
+ onComplete: async (newAccountHolder) => {
32540
32588
  setAccountHolder(newAccountHolder);
32541
32589
  await refreshLegalEntity();
32542
- if (showIntroduction) {
32543
- onNavigateTo(TaskTypes.INTRODUCTION);
32544
- return;
32545
- }
32546
- if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
32547
- onNavigateTo(TaskTypes.SINGPASS_SELECTION);
32548
- return;
32549
- }
32550
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32590
+ navigateTo("default");
32551
32591
  },
32552
- taskHistory,
32553
- setTaskHistory,
32554
- onNavigateTo,
32592
+ onBack: previousTask ? navigateBack : void 0,
32555
32593
  trackingConfig: {
32556
32594
  topLevelLegalEntity: legalEntityResponse
32557
32595
  },
@@ -32567,11 +32605,7 @@ function DropinComposerComponent({
32567
32605
  legalEntity: rootLegalEntity,
32568
32606
  onExitIntroduction: () => {
32569
32607
  setHasSeenIntroduction(true);
32570
- if (shouldShowSingpassSelection) {
32571
- onNavigateTo(TaskTypes.SINGPASS_SELECTION);
32572
- return;
32573
- }
32574
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32608
+ navigateTo("default");
32575
32609
  },
32576
32610
  tasks
32577
32611
  });
@@ -32582,7 +32616,7 @@ function DropinComposerComponent({
32582
32616
  trackingConfig: {
32583
32617
  topLevelLegalEntity: legalEntityResponse
32584
32618
  },
32585
- onNavigateToTask: navigateTo,
32619
+ onNavigateToTask,
32586
32620
  tasks,
32587
32621
  legalEntityResponse: rootLegalEntity,
32588
32622
  capabilityProblems,
@@ -32593,7 +32627,7 @@ function DropinComposerComponent({
32593
32627
  isReview: reviewRequired,
32594
32628
  hasRequiredTrustMemberCount: hasRequiredTrustMemberCount(trustMembers2),
32595
32629
  onTransferInstrumentDelete: deleteTransferInstrument2,
32596
- onRetrieveMyinfoBusinessWithSingpass: shouldShowSingpass ? () => handleSingpassSelectionNextClick("singpass") : null
32630
+ onRetrieveMyinfoBusinessWithSingpass: eligibleForSingpass ? () => handleSingpassSelectionNextClick("singpass") : null
32597
32631
  });
32598
32632
  case TaskTypes.DECISION_MAKER_OVERVIEW:
32599
32633
  return jsx(DecisionMakersComponent, {
@@ -32626,10 +32660,10 @@ function DropinComposerComponent({
32626
32660
  onSubmit: async (data) => {
32627
32661
  onSubmit == null ? void 0 : onSubmit(data);
32628
32662
  await refreshLegalEntity();
32629
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32663
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32630
32664
  setLegalEntityType(null);
32631
32665
  },
32632
- handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW),
32666
+ handleHomeClick: () => navigateTo(TaskTypes.TASKS_OVERVIEW),
32633
32667
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
32634
32668
  handleCreateLegalEntity: args == null ? void 0 : args.handleCreateLegalEntity,
32635
32669
  handleUpdateLegalEntity: args == null ? void 0 : args.handleUpdateLegalEntity,
@@ -32646,7 +32680,7 @@ function DropinComposerComponent({
32646
32680
  return jsx(ReviewComponent, {
32647
32681
  legalEntityId: rootLegalEntity.id,
32648
32682
  handleReviewConfirm: args.handleReviewConfirm,
32649
- handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW)
32683
+ handleHomeClick: () => navigateTo(TaskTypes.TASKS_OVERVIEW)
32650
32684
  });
32651
32685
  case TaskTypes.DECISION_MAKER:
32652
32686
  return jsx(IndividualDropinComponent, {
@@ -32716,7 +32750,7 @@ function DropinComposerComponent({
32716
32750
  eventEmitter,
32717
32751
  onSubmit: (data) => refreshLegalArrangementAndRunOnSubmit(data, 2),
32718
32752
  handleBackClick: navigateBack,
32719
- handleHomeClick: () => onNavigateTo(TaskTypes.TRUST_MEMBER_OVERVIEW),
32753
+ handleHomeClick: () => navigateTo(TaskTypes.TRUST_MEMBER_OVERVIEW),
32720
32754
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
32721
32755
  trustMember,
32722
32756
  handleCreateLegalEntity: args == null ? void 0 : args.handleCreateLegalEntity,
@@ -32744,7 +32778,7 @@ function DropinComposerComponent({
32744
32778
  onSubmit: async (data) => {
32745
32779
  onSubmit == null ? void 0 : onSubmit(data);
32746
32780
  await refreshLegalEntity();
32747
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32781
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32748
32782
  setLegalEntityType(null);
32749
32783
  },
32750
32784
  handleHomeClick: navigateBack,
@@ -32772,7 +32806,7 @@ function DropinComposerComponent({
32772
32806
  onSubmit: async (data) => {
32773
32807
  onSubmit == null ? void 0 : onSubmit(data);
32774
32808
  await refreshLegalEntity();
32775
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32809
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32776
32810
  setLegalEntityType(null);
32777
32811
  },
32778
32812
  handleGetDocument: args.handleGetDocument,
@@ -34160,6 +34194,7 @@ function ViewVerificationStatusComponent({
34160
34194
  hideExplanation = false,
34161
34195
  returnUrl,
34162
34196
  redirectTarget,
34197
+ themeId,
34163
34198
  onStatusChange,
34164
34199
  onError,
34165
34200
  onRedirect,
@@ -34235,7 +34270,8 @@ function ViewVerificationStatusComponent({
34235
34270
  setLinkLoadingStatus("loading");
34236
34271
  const config = {
34237
34272
  locale: i18n.locale,
34238
- returnUrl
34273
+ returnUrl,
34274
+ themeId
34239
34275
  };
34240
34276
  try {
34241
34277
  const {
@@ -34762,7 +34798,7 @@ const ConfigurationApiProvider = ({
34762
34798
  isEmbeddedDropin,
34763
34799
  loadingContext
34764
34800
  } = authContext;
34765
- const sdkVersion = "3.14.1";
34801
+ const sdkVersion = "3.15.1";
34766
34802
  useAnalytics({
34767
34803
  onUserEvent,
34768
34804
  legalEntityId: rootLegalEntityId,
@@ -34785,14 +34821,25 @@ const ConfigurationApiProvider = ({
34785
34821
  }), children]
34786
34822
  });
34787
34823
  };
34824
+ const getAccountHolderStorageKey = (legalEntityId) => `ACCOUNT_HOLDER-${legalEntityId}`;
34825
+ const useAccountHolder = (legalEntityId) => {
34826
+ const [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] = useLocalStorage(getAccountHolderStorageKey(legalEntityId), null);
34827
+ return {
34828
+ accountHolder: accountHolderFromLocalStorage,
34829
+ setAccountHolder: setAccountHolderIntoLocalStorage
34830
+ };
34831
+ };
34788
34832
  const logger$2 = createLogger("CoreProvider");
34789
34833
  const CoreProvider = ({
34790
34834
  contextCountry: initialContextCountry,
34791
- enableNewEntryFlowExperiment = false,
34835
+ rootLegalEntityId,
34792
34836
  children
34793
34837
  }) => {
34794
34838
  const [contextCountry, setContextCountry] = useState(initialContextCountry);
34795
- const [accountHolder2, setAccountHolder] = useAccountHolder(enableNewEntryFlowExperiment);
34839
+ const {
34840
+ accountHolder: accountHolder2,
34841
+ setAccountHolder
34842
+ } = useAccountHolder(rootLegalEntityId);
34796
34843
  const [accountFormat, setAccountFormat] = useState("local");
34797
34844
  const allowedCountries = useAllowedCountries();
34798
34845
  const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
@@ -35238,8 +35285,8 @@ class UIElement extends BaseElement {
35238
35285
  constructor() {
35239
35286
  super(...arguments);
35240
35287
  this.render = () => {
35241
- var _a;
35242
35288
  const Component = this.props.component;
35289
+ const rootLegalEntityId = getRootLegalEntityId(this.props.componentProps);
35243
35290
  return jsx(SettingsProvider, {
35244
35291
  settings: this.props.settings,
35245
35292
  children: jsx(AuthProvider, {
@@ -35248,12 +35295,12 @@ class UIElement extends BaseElement {
35248
35295
  clientKey: this.props.clientKey,
35249
35296
  loadingContext: this.props.loadingContext,
35250
35297
  children: jsx(ConfigurationApiProvider, {
35251
- rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
35298
+ rootLegalEntityId,
35252
35299
  onUserEvent: this.props.onUserEvent,
35253
35300
  componentName: this.props.componentName,
35254
35301
  children: jsx(CoreProvider, {
35255
35302
  contextCountry: this.props.contextCountry,
35256
- enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
35303
+ rootLegalEntityId,
35257
35304
  children: jsx(I18nProvider, {
35258
35305
  locale: this.props.locale,
35259
35306
  customTranslations: this.props.customTranslations,
@@ -35940,6 +35987,9 @@ const viewVerificationStatusComponentSchema = {
35940
35987
  redirectTarget: {
35941
35988
  type: "string"
35942
35989
  },
35990
+ themeId: {
35991
+ type: "string"
35992
+ },
35943
35993
  onStatusChange: {
35944
35994
  type: "function"
35945
35995
  },