@adyen/kyc-components 2.40.0 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,10 +5,12 @@ 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";
11
12
  import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
13
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
12
14
  const ConfigurationApiContext = createContext(void 0);
13
15
  const useConfigurationApi = () => {
14
16
  const configurationApi = useContext(ConfigurationApiContext);
@@ -42,7 +44,7 @@ const payoutAccount = "Payout account";
42
44
  const payinAccount = "Payin account";
43
45
  const firstName = "First name";
44
46
  const lastName = "Last name";
45
- const country = "Country";
47
+ const country = "Country/region";
46
48
  const street = "Street";
47
49
  const otherAddressInformation = "Other address information (optional)";
48
50
  const postalCode = "Postal code";
@@ -65,7 +67,7 @@ const invalidPhoneNumber = "Please enter a valid phone number.";
65
67
  const birthDate = "Date of birth";
66
68
  const idNumber = "Identity number";
67
69
  const selectState = "Select a state";
68
- const selectCountry = "Select a country";
70
+ const selectCountryRegion = "Select a country/region";
69
71
  const search = "Search";
70
72
  const noOptionsFound = "No options found";
71
73
  const SSNFormatUS = "*** — ** — XXXX";
@@ -118,8 +120,9 @@ const invalidFormatIdentityNumberUS9 = "Please use the SSN format: XXXXXXXXX";
118
120
  const invalidFormatIdentityNumberSG = "Please use the NRIC format: S1234567A";
119
121
  const invalidFormatIdentityNumberHK = "Not valid for HK. Format should be: 8 or 9-character alphanumeric. For example: C668668E";
120
122
  const invalidFormatBankStatementDescription = "Please ensure your input contains solely letters, digits, currency codes, and the specified special characters: -._,:;'*!@#%()+?¿/「」";
121
- const residencyCountry = "Country of residence";
123
+ const residencyCountry = "Country/region of residence";
122
124
  const stateOrProvince = "State or province";
125
+ const basicInformation = "Basic information";
123
126
  const selectStateOrProvince = "Select a state or province";
124
127
  const dragYourFilesHereOr = "Drag your files here, or";
125
128
  const browse = "Browse";
@@ -242,7 +245,7 @@ const enterValidRegistrationNumber = "Please enter a valid registration number";
242
245
  const stockExchangeMICHelper = "Market Identifier Code, as defined in ISO 10383";
243
246
  const stockISINHelper = "International Securities Identification Number, as defined in ISO 10383";
244
247
  const validationPleaseEnterAValidMarketIdentifier = "Please enter a valid Market identifier code";
245
- const validationPleaseEnterAValidStockISIN = "Please enter a valid International Securities Identification Number";
248
+ const validationPleaseEnterAValidStockISIN = "Please enter a valid ISIN. For example, %{example}";
246
249
  const shareholderDocument = "Shareholder document";
247
250
  const role = "Role";
248
251
  const selectAllTheRolesThatThisDecisionMakerHolds = "Select all the roles that this decision-maker holds.";
@@ -261,7 +264,6 @@ const cantSetUpAcccount = "You can’t set up an account";
261
264
  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
265
  const pleaseNote = "Please note:";
263
266
  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
267
  const companyCountry = "Where is your business located?";
266
268
  const accountDetailsDescription = "Provide a few details about you to start accepting live payments.";
267
269
  const provideFewDetailsAboutYourself = "Provide a few details about yourself.";
@@ -322,8 +324,8 @@ const bankAccountToHaveSameNameAsTrust = " The bank account holder has to have t
322
324
  const bankAccountHasToBeInYourName = "The bank account has to be in your name";
323
325
  const orSoleProprietorshipName = "or sole proprietorship's name";
324
326
  const bankAccountHasToBeInYourCompanyName = "The bank account has to be in your company's name";
325
- const bankCountry = "Bank country";
326
- const bankAccountCountry = "Bank account country";
327
+ const bankCountry = "Bank country/region";
328
+ const bankAccountCountryRegion = "Bank account country/region";
327
329
  const currency = "Currency";
328
330
  const currencyCode = "Currency code";
329
331
  const currencyPlaceholder = "Select a currency code";
@@ -396,6 +398,7 @@ const documentCannotBeDamaged = "The document cannot be damaged";
396
398
  const verify = "Verify";
397
399
  const add = "Add";
398
400
  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.";
401
+ const verifyIndividualIdentity = "Verify %{name}'s Identity";
399
402
  const documentNotExpiredOrDamaged = "The document cannot be expired or damaged";
400
403
  const weAccept = "We accept:";
401
404
  const includeFrontAndBack = "Include both the front and back side, each in separate file";
@@ -413,6 +416,7 @@ const invalidDateOfBirth = "Please enter a valid date of birth";
413
416
  const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
414
417
  const successfullyUpdatedDetails = "Successfully updated details";
415
418
  const failedToUpdateDetails = "Failed to update details";
419
+ const documentUploadfailed = "Document upload failed. Please ensure the document is not a duplicate and its size is 4MBs or less.";
416
420
  const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
417
421
  const failedFetchingDecisionMaker = "Failed to get decision maker details";
418
422
  const fileUpload = "File upload";
@@ -564,7 +568,7 @@ const otherTrust = "Other trust";
564
568
  const pooledSuperannuationTrust = "Pooled superannuation trust";
565
569
  const publicTradingTrust = "Public trading trust";
566
570
  const unlistedPublicUnitTrust = "Unlisted public unit trust";
567
- const countryOfEstablishment = "Country of establishment";
571
+ const countryRegionOfEstablishment = "Country/region of establishment";
568
572
  const nameOfTrustAgreement = "Name of trust agreement";
569
573
  const typeOfTrustAgreement = "Type of trust agreement";
570
574
  const objectOfCharitableTrust = "Object of charitable trust";
@@ -764,13 +768,13 @@ const enterTheRemainingNDigitsThenXToYLettersForExample = "Enter the remaining %
764
768
  const provideAllOwners = "Add <strong>all owners</strong> holding 25% or more of your company.";
765
769
  const ifNoOwnersSpecifyControllingPersons = "If you don’t have any owners holding 25% or more, then specify <strong>all controlling persons</strong>.";
766
770
  const provideAtLeastOneSignatory = "Add at least <strong>1 signatory</strong>.";
767
- const provideOneControllingPerson = "Provide <strong>1 controlling person</strong>.";
771
+ const provideOneControllingPerson = "Add <strong>1 controlling person</strong>.";
768
772
  const textToVerifyAccount = "For you to receive your payouts, we need a verified bank account.";
769
773
  const theBankAccountHolderMustHaveTheSameNameAsYourCompany_ = "The bank account holder must have the same name as your company <strong>%{companyName}</strong>.";
770
774
  const theBankAccountHolderMustBeInYourName_ = "The bank account holder must be in your name: <strong>%{name}</strong>";
771
775
  const weDoNotYetSupportInstantVerificationForBankAccountsIn_ = "We do not yet support instant verification for bank accounts in %{countryName}. Therefore, you must provide your account details manually.";
772
- const youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered = "You can only use a bank account in the country where your company is registered.";
773
- const youCanOnlyUseABankAccountInTheCountryWhereYouLive = "You can only use a bank account in the country where you live.";
776
+ const youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered = "You can only use a bank account in the country/region where your company is registered.";
777
+ const youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive = "You can only use a bank account in the country/region where you live.";
774
778
  const mobileApplication = "Mobile Application";
775
779
  const onOnlineBankingEnvironment = "Or web version of online banking environment";
776
780
  const dontHaveAccessOnlineBanking = "Don’t have access to online banking environment?";
@@ -873,8 +877,8 @@ const doNotHaveBusinessNumber = "I do not have a Business number";
873
877
  const enterNameExactlyAsAppearInID = "Enter your first name(s) exactly as it appears on your identity document";
874
878
  const enterLastNameExactlyAsAppearInID = "Enter your last name(s) exactly as it appears on your identity document";
875
879
  const takePhotoOriginalDocumentWithPhone = "Take a photo of the original ID document with your phone";
876
- const instantIDVerificationDescription = "With access to a physical ID document and a phone you can go through verification instantly!";
877
- 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.";
880
+ const instantIDVerificationDescription = "Take a photo of a passport, identity card, or driver’s license.";
881
+ const manualIDVerificationDescription = "May take a few days. Upload a copy of a passport, identity, or driver’s license.";
878
882
  const uploadScanOriginalIDDocument = "Upload a scan of the original ID document";
879
883
  const takesLonger = "Takes longer";
880
884
  const howVerificationWithOnfidoWork = "How does verification with our partner Onfido work?";
@@ -914,7 +918,7 @@ const legalCompanyName__helperText__HK = "Enter the name exactly as it is on you
914
918
  const taxInformationNumber = "Tax Identification Number";
915
919
  const taxInformationNumber__HK = "Business Registration number (BRN)";
916
920
  const stockExchangeMIC = "Market Identifier Code (MIC)";
917
- const stockISIN = "ISIN";
921
+ const stockISIN = "International Securities Identification Number (ISIN)";
918
922
  const companyLookupResultsHeader = "Let's find your company";
919
923
  const companyLookupResultsHeader__searching = "Searching for companies...";
920
924
  const companyLookupResultsHeader__verifying = "Verifying company selection...";
@@ -1326,7 +1330,7 @@ const defaultTrans = {
1326
1330
  birthDate,
1327
1331
  idNumber,
1328
1332
  selectState,
1329
- selectCountry,
1333
+ selectCountryRegion,
1330
1334
  search,
1331
1335
  noOptionsFound,
1332
1336
  SSNFormatUS,
@@ -1381,6 +1385,7 @@ const defaultTrans = {
1381
1385
  invalidFormatBankStatementDescription,
1382
1386
  residencyCountry,
1383
1387
  stateOrProvince,
1388
+ basicInformation,
1384
1389
  selectStateOrProvince,
1385
1390
  dragYourFilesHereOr,
1386
1391
  browse,
@@ -1522,7 +1527,6 @@ const defaultTrans = {
1522
1527
  accountCantBeSetUp,
1523
1528
  pleaseNote,
1524
1529
  byClickingSubmitReview,
1525
- nameAndCountry,
1526
1530
  companyCountry,
1527
1531
  accountDetailsDescription,
1528
1532
  provideFewDetailsAboutYourself,
@@ -1584,7 +1588,7 @@ const defaultTrans = {
1584
1588
  orSoleProprietorshipName,
1585
1589
  bankAccountHasToBeInYourCompanyName,
1586
1590
  bankCountry,
1587
- bankAccountCountry,
1591
+ bankAccountCountryRegion,
1588
1592
  currency,
1589
1593
  currencyCode,
1590
1594
  currencyPlaceholder,
@@ -1657,6 +1661,7 @@ const defaultTrans = {
1657
1661
  verify,
1658
1662
  add,
1659
1663
  idUploadDocumentSubtitle,
1664
+ verifyIndividualIdentity,
1660
1665
  documentNotExpiredOrDamaged,
1661
1666
  weAccept,
1662
1667
  includeFrontAndBack,
@@ -1674,6 +1679,7 @@ const defaultTrans = {
1674
1679
  invalidDateOfIncorporation,
1675
1680
  successfullyUpdatedDetails,
1676
1681
  failedToUpdateDetails,
1682
+ documentUploadfailed,
1677
1683
  successfullyVerifiedIdNumber,
1678
1684
  failedFetchingDecisionMaker,
1679
1685
  fileUpload,
@@ -1830,7 +1836,7 @@ const defaultTrans = {
1830
1836
  pooledSuperannuationTrust,
1831
1837
  publicTradingTrust,
1832
1838
  unlistedPublicUnitTrust,
1833
- countryOfEstablishment,
1839
+ countryRegionOfEstablishment,
1834
1840
  nameOfTrustAgreement,
1835
1841
  typeOfTrustAgreement,
1836
1842
  objectOfCharitableTrust,
@@ -2037,8 +2043,8 @@ const defaultTrans = {
2037
2043
  theBankAccountHolderMustHaveTheSameNameAsYourCompany_,
2038
2044
  theBankAccountHolderMustBeInYourName_,
2039
2045
  weDoNotYetSupportInstantVerificationForBankAccountsIn_,
2040
- youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered,
2041
- youCanOnlyUseABankAccountInTheCountryWhereYouLive,
2046
+ youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered,
2047
+ youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive,
2042
2048
  mobileApplication,
2043
2049
  onOnlineBankingEnvironment,
2044
2050
  dontHaveAccessOnlineBanking,
@@ -4942,7 +4948,7 @@ function CountryField({
4942
4948
  children: (childProps) => jsx(Select, {
4943
4949
  ...childProps,
4944
4950
  name: "country",
4945
- placeholder: i18n.get("selectCountry"),
4951
+ placeholder: i18n.get("selectCountryRegion"),
4946
4952
  selected: data.country,
4947
4953
  items: countries,
4948
4954
  readonly: (countries.length === 1 || readonly) && !!data,
@@ -6711,6 +6717,11 @@ const PassportNumberPatterns = {
6711
6717
  const ProofOfIdentityCardPatterns = {
6712
6718
  [CountryCodes.HongKong]: /^[A-Z]{1,2}[0-9]{6}[0-9A]$/
6713
6719
  };
6720
+ const validateNotEmptyOnBlur = {
6721
+ modes: ["blur"],
6722
+ validate: (val) => !isEmpty(val),
6723
+ errorMessage: "fieldIsRequired"
6724
+ };
6714
6725
  const validatePatternOnBlur = (pattern) => ({
6715
6726
  modes: ["blur"],
6716
6727
  validate: (val) => !!val && pattern.test(val)
@@ -7653,9 +7664,13 @@ function CollapsibleContainer({
7653
7664
  children
7654
7665
  });
7655
7666
  }
7656
- function useAccordionContext() {
7657
- return useContext(AccordionContext);
7658
- }
7667
+ const useAccordionContext = () => {
7668
+ const accordionContext = useContext(AccordionContext);
7669
+ if (!accordionContext) {
7670
+ throw new Error("Cannot use useAccordionContext without AccordionContext");
7671
+ }
7672
+ return accordionContext;
7673
+ };
7659
7674
  function AccordionItem({
7660
7675
  children,
7661
7676
  open = false,
@@ -7859,7 +7874,7 @@ function StockExchangeMICField({
7859
7874
  }
7860
7875
  const stockExchangeMICFieldMetadata = {
7861
7876
  label: "stockExchangeMIC",
7862
- validators: validatePatternOnBlur(/^[a-zA-Z0-9]{4}$/),
7877
+ validators: [validateNotEmptyOnBlur, validatePatternOnBlur(/^[a-zA-Z0-9]{4}$/)],
7863
7878
  mask: {
7864
7879
  mask: makeMask(...alphanumericInputs(4)),
7865
7880
  transformOnType: uppercase
@@ -7907,16 +7922,19 @@ function StockISINField({
7907
7922
  }
7908
7923
  const stockISINFieldMetadata = {
7909
7924
  label: "stockISIN",
7910
- validators: validatePatternOnBlur(/^[a-zA-Z0-9]{12}$/),
7925
+ validators: [validateNotEmptyOnBlur, {
7926
+ modes: ["blur"],
7927
+ validate: (value) => !!value && isISIN(value)
7928
+ }],
7911
7929
  mask: {
7912
7930
  mask: makeMask(...alphaInputs(2), ...alphanumericInputs(9), ...numericInputs(1)),
7913
7931
  transformOnType: uppercase
7914
7932
  },
7933
+ helperText: "stockISINHelper",
7915
7934
  guidanceText: {
7916
- key: "enterNCharactersWithAMixForExample",
7935
+ key: "validationPleaseEnterAValidStockISIN",
7917
7936
  values: {
7918
- numChars: "12",
7919
- example: "US00379P1010"
7937
+ example: "NL0012969182"
7920
7938
  }
7921
7939
  }
7922
7940
  };
@@ -10402,7 +10420,9 @@ function AccountHolder(props) {
10402
10420
  dataStoreId
10403
10421
  }
10404
10422
  });
10405
- setAccountHolder((data == null ? void 0 : data.accountHolder) ?? null);
10423
+ if (data == null ? void 0 : data.accountHolder) {
10424
+ setAccountHolder(data.accountHolder);
10425
+ }
10406
10426
  }, [data, errors, valid, dataStoreId]);
10407
10427
  const formUtils = formUtilities(props, i18n);
10408
10428
  const questionLabel = i18n.get("nameOfBankAccountHolder");
@@ -10651,7 +10671,7 @@ function DropzoneFile(props) {
10651
10671
  const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
10652
10672
  if (i === 0)
10653
10673
  return `${bytes} ${sizes[i]}`;
10654
- return `(${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]})`;
10674
+ return `${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]}`;
10655
10675
  };
10656
10676
  return jsxs("div", {
10657
10677
  className: "adyen-kyc-dropzone-file",
@@ -10676,11 +10696,9 @@ function DropzoneFile(props) {
10676
10696
  }), errorMessage ? jsx("div", {
10677
10697
  className: "adyen-kyc-dropzone-file__error",
10678
10698
  children: i18n.get(errorMessage)
10679
- }) : jsxs("div", {
10699
+ }) : jsx("div", {
10680
10700
  className: "adyen-kyc-dropzone-file__size",
10681
- children: [jsxs("span", {
10682
- children: [i18n.get("complete"), " "]
10683
- }), isNewlyUploadedFile(file) ? formatSize(file.size) : void 0]
10701
+ children: isNewlyUploadedFile(file) ? formatSize(file.size) : void 0
10684
10702
  })]
10685
10703
  }), jsx("button", {
10686
10704
  type: "button",
@@ -12582,7 +12600,7 @@ function TaxDocumentComponent({
12582
12600
  const companyForms = {
12583
12601
  companyNameAndCountry: {
12584
12602
  formId: "companyNameAndCountry",
12585
- formName: "nameAndCountry",
12603
+ formName: "basicInformation",
12586
12604
  fields: companyNameAndCountryFields
12587
12605
  },
12588
12606
  companyType: {
@@ -12662,7 +12680,7 @@ function CompanyComponent(props) {
12662
12680
  ...companyNameAndCountryFormProps.data,
12663
12681
  country: props.country
12664
12682
  },
12665
- heading: i18n.get("nameAndCountry"),
12683
+ heading: i18n.get("basicInformation"),
12666
12684
  id: CompanyNameAndCountryFormID,
12667
12685
  isTopLevelEntity: props.isTopLevelEntity
12668
12686
  })
@@ -14539,31 +14557,16 @@ function IdVerificationMethodComponent(props) {
14539
14557
  }), jsxs("form", {
14540
14558
  className: "adyen-kyc-verification-method",
14541
14559
  children: [jsx(FormHeader, {
14542
- heading: i18n.get("verificationMethod")
14560
+ heading: i18n.get("verifyIndividualIdentity", {
14561
+ values: {
14562
+ name
14563
+ }
14564
+ })
14543
14565
  }), jsx(ErrorPanel, {
14544
14566
  verificationErrors: formVerificationErrors,
14545
14567
  validationErrors: fieldValidationErrors,
14546
14568
  formUtils,
14547
14569
  id: "ariaErrorField"
14548
- }), jsx("div", {
14549
- dangerouslySetInnerHTML: {
14550
- __html: i18n.get("idUploadDocumentSubtitle", {
14551
- values: {
14552
- name
14553
- }
14554
- })
14555
- }
14556
- }), jsx("div", {
14557
- children: i18n.get("weAccept")
14558
- }), jsxs(List, {
14559
- className: "adl-u-margin-bottom-16",
14560
- children: [jsx(ListItem, {
14561
- children: i18n.get("passport")
14562
- }), jsx(ListItem, {
14563
- children: i18n.get("identityCard")
14564
- }), jsx(ListItem, {
14565
- children: i18n.get("driversLicense")
14566
- })]
14567
14570
  }), jsx(Field, {
14568
14571
  name: "verificationMethods",
14569
14572
  useLabelElement: false,
@@ -19571,90 +19574,6 @@ const makePayoutVerificationMethodsMetadata = (svgPath, instantVerificationProvi
19571
19574
  }
19572
19575
  });
19573
19576
  const payoutVerificationMethods = ["instantVerification", "manualVerification"];
19574
- const logger$g = createLogger("useLocalStorage");
19575
- const useLocalStorage = (key, defaultValue, options) => {
19576
- const {
19577
- serializer,
19578
- parser,
19579
- syncData
19580
- } = useMemo(() => ({
19581
- serializer: JSON.stringify,
19582
- parser: JSON.parse,
19583
- syncData: true,
19584
- ...options
19585
- }), [options]);
19586
- const rawValueRef = useRef(null);
19587
- const [value, setValue] = useState(() => {
19588
- if (typeof window === "undefined")
19589
- return defaultValue;
19590
- try {
19591
- rawValueRef.current = window.localStorage.getItem(key);
19592
- const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
19593
- return res;
19594
- } catch (err) {
19595
- logger$g.error(err);
19596
- return defaultValue;
19597
- }
19598
- });
19599
- useEffect(() => {
19600
- if (typeof window === "undefined")
19601
- return;
19602
- const updateLocalStorage = () => {
19603
- if (value !== void 0) {
19604
- const newValue = serializer(value);
19605
- const oldValue = rawValueRef.current;
19606
- rawValueRef.current = newValue;
19607
- window.localStorage.setItem(key, newValue);
19608
- window.dispatchEvent(new StorageEvent("storage", {
19609
- storageArea: window.localStorage,
19610
- url: window.location.href,
19611
- key,
19612
- newValue,
19613
- oldValue
19614
- }));
19615
- } else {
19616
- window.localStorage.removeItem(key);
19617
- window.dispatchEvent(new StorageEvent("storage", {
19618
- storageArea: window.localStorage,
19619
- url: window.location.href,
19620
- key
19621
- }));
19622
- }
19623
- };
19624
- try {
19625
- updateLocalStorage();
19626
- } catch (err) {
19627
- logger$g.error(err);
19628
- }
19629
- }, [value]);
19630
- useEffect(() => {
19631
- if (!syncData)
19632
- return;
19633
- const handleStorageChange = (event) => {
19634
- if (event.key !== key || event.storageArea !== window.localStorage)
19635
- return;
19636
- try {
19637
- if (event.newValue !== rawValueRef.current) {
19638
- rawValueRef.current = event.newValue;
19639
- setValue(event.newValue ? parser(event.newValue) : void 0);
19640
- }
19641
- } catch (err) {
19642
- logger$g.error(err);
19643
- }
19644
- };
19645
- if (typeof window === "undefined")
19646
- return;
19647
- window.addEventListener("storage", handleStorageChange);
19648
- return () => window.removeEventListener("storage", handleStorageChange);
19649
- }, [key, syncData]);
19650
- return [value, setValue];
19651
- };
19652
- const accountHolderStorageKey = "ACCOUNT_HOLDER";
19653
- const useAccountHolder = (enableNewEntryFlow) => {
19654
- const [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] = useLocalStorage(accountHolderStorageKey, null);
19655
- const [accountHolderFromState, setAccountHolderIntoState] = useState(null);
19656
- return enableNewEntryFlow ? [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] : [accountHolderFromState, setAccountHolderIntoState];
19657
- };
19658
19577
  const AccountHolderDescriptionFragment = ({
19659
19578
  legalEntityResponse
19660
19579
  }) => {
@@ -19663,7 +19582,9 @@ const AccountHolderDescriptionFragment = ({
19663
19582
  i18n
19664
19583
  } = useI18nContext();
19665
19584
  const hasSolePropEntityAssociations = hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id);
19666
- const [accountHolder2] = useAccountHolder(true);
19585
+ const {
19586
+ accountHolder: accountHolder2
19587
+ } = useCoreContext();
19667
19588
  if (accountHolder2 === "mySoleProprietorName" || hasSolePropEntityAssociations) {
19668
19589
  const soleProp = (_a = legalEntityResponse.entityAssociations) == null ? void 0 : _a.find((ea) => ea.entityType === "soleProprietorship");
19669
19590
  const {
@@ -19910,14 +19831,14 @@ function PayoutVerificationMethod(props) {
19910
19831
  country: formUtils.getErrorMessage("bankCountry", errors, fieldProblems)
19911
19832
  },
19912
19833
  labels: {
19913
- country: formUtils.getLabel("bankCountry", "bankAccountCountry")
19834
+ country: formUtils.getLabel("bankCountry", "bankAccountCountryRegion")
19914
19835
  },
19915
19836
  readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
19916
19837
  allowedCountries: allowedBankCountries,
19917
19838
  classNameModifiers: ["country"],
19918
19839
  handleChangeFor: () => handleChangeFor("bankCountry", "input"),
19919
19840
  helperText: {
19920
- country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
19841
+ country: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryRegionWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryRegionWhereYourCompanyIsRegistered")
19921
19842
  }
19922
19843
  }), jsx(Field, {
19923
19844
  name: "verificationMethods",
@@ -20245,7 +20166,7 @@ const ConstitutionalDocumentComponent = memo(ConstitutionalDocumentUpload, (prev
20245
20166
  const solePropForms = {
20246
20167
  solePropNameAndCountry: {
20247
20168
  formId: "solePropNameAndCountry",
20248
- formName: "nameAndCountry",
20169
+ formName: "basicInformation",
20249
20170
  fields: companyNameAndCountryFields
20250
20171
  },
20251
20172
  solePropRegistrationDetails: {
@@ -20303,10 +20224,10 @@ function SolePropComponent(props) {
20303
20224
  legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
20304
20225
  },
20305
20226
  labels: {
20306
- country: "countryOfEstablishment",
20227
+ country: "countryRegionOfEstablishment",
20307
20228
  legalCompanyName: isExperimentEnabled("EnableNewEntryFlow") ? "legalNameOfSoleProprietorship" : "legalNameOfSoleProprietor"
20308
20229
  },
20309
- heading: i18n.get("nameAndCountry"),
20230
+ heading: i18n.get("basicInformation"),
20310
20231
  id: solePropNameAndCountryFormId,
20311
20232
  disableCountry: true,
20312
20233
  isTopLevelEntity: false
@@ -20770,7 +20691,7 @@ function TrustRegistrationDetailsComponent(props) {
20770
20691
  valid: formUtils.getFieldValid(valid, COUNTRY_FIELD),
20771
20692
  errors: formUtils.getFieldErrors(errors, fieldProblems, COUNTRY_FIELD),
20772
20693
  labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
20773
- country: "countryOfEstablishment"
20694
+ country: "countryRegionOfEstablishment"
20774
20695
  }),
20775
20696
  readonly: formUtils.isReadOnly("country"),
20776
20697
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
@@ -21919,7 +21840,7 @@ const defaultPayoutAccountFormat = {
21919
21840
  [CountryCodes.Sweden]: "local",
21920
21841
  [CountryCodes.UnitedKingdom]: "local"
21921
21842
  };
21922
- const logger$f = createLogger("useScenarioConfiguration");
21843
+ const logger$g = createLogger("useScenarioConfiguration");
21923
21844
  const useScenarioConfiguration = ({
21924
21845
  getConfigurationData,
21925
21846
  getPayoutAccountFormatData,
@@ -21942,12 +21863,12 @@ const useScenarioConfiguration = ({
21942
21863
  const response = await getConfigurationData();
21943
21864
  setConfigurationResponse(response);
21944
21865
  } catch (err) {
21945
- logger$f.warn("WARNING: Configuration request failed - error:", err);
21866
+ logger$g.warn("WARNING: Configuration request failed - error:", err);
21946
21867
  } finally {
21947
21868
  setLoadingStatus("success");
21948
21869
  }
21949
21870
  };
21950
- makeConfigCallAndSave().catch(logger$f.error);
21871
+ makeConfigCallAndSave().catch(logger$g.error);
21951
21872
  }, [getConfigurationData, setLoadingStatus]);
21952
21873
  useEffect(() => {
21953
21874
  setLoadingStatus("loading");
@@ -21966,12 +21887,12 @@ const useScenarioConfiguration = ({
21966
21887
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
21967
21888
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
21968
21889
  } catch (err) {
21969
- logger$f.warn("WARNING: Payout format request failed - error:", err);
21890
+ logger$g.warn("WARNING: Payout format request failed - error:", err);
21970
21891
  } finally {
21971
21892
  setLoadingStatus("success");
21972
21893
  }
21973
21894
  };
21974
- makePayoutFormatCallAndSave().catch(logger$f.error);
21895
+ makePayoutFormatCallAndSave().catch(logger$g.error);
21975
21896
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
21976
21897
  const {
21977
21898
  fieldConfigurations,
@@ -22010,7 +21931,9 @@ const useScenarioConfiguration = ({
22010
21931
  };
22011
21932
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
22012
21933
  const API_VALIDATION_ERROR_CODE = "30_102";
21934
+ const DOCUMENT_UPLOAD_ERROR_CODE = ["30_105", "30_106"];
22013
21935
  const isValidationError = (error) => error && "errorCode" in error && error.errorCode === API_VALIDATION_ERROR_CODE;
21936
+ const isDocumentUploadError = (error) => error && "errorCode" in error && typeof error.errorCode === "string" && DOCUMENT_UPLOAD_ERROR_CODE.includes(error.errorCode);
22014
21937
  const linkedFieldsMap = {
22015
21938
  "companyRegistrationDetails.vatNumber": ["companyRegistrationDetails.vatAbsenceReason", "companyRegistrationDetails.exemptedFromVat"],
22016
21939
  "companyRegistrationDetails.vatAbsenceReason": ["companyRegistrationDetails.vatNumber", "companyRegistrationDetails.exemptedFromVat"],
@@ -22737,7 +22660,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
22737
22660
  ToastType2["ERROR"] = "error";
22738
22661
  return ToastType2;
22739
22662
  })(ToastType || {});
22740
- const logger$e = createLogger("FormRouterContextProvider");
22663
+ const logger$f = createLogger("FormRouterContextProvider");
22741
22664
  function FormRouterContextProvider({
22742
22665
  children,
22743
22666
  forms: forms2,
@@ -22757,7 +22680,7 @@ function FormRouterContextProvider({
22757
22680
  if (formIndex > -1) {
22758
22681
  setFormIndex(formIndex);
22759
22682
  } else {
22760
- logger$e.error("No form was found to have that field so form navigation failed.");
22683
+ logger$f.error("No form was found to have that field so form navigation failed.");
22761
22684
  }
22762
22685
  }
22763
22686
  }), [forms2, handleGetIdVerificationToken, setFormIndex]);
@@ -23369,7 +23292,7 @@ var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
23369
23292
  CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
23370
23293
  return CompanySearchEvents2;
23371
23294
  })(CompanySearchEvents || {});
23372
- const logger$d = createLogger("useCompanySearch");
23295
+ const logger$e = createLogger("useCompanySearch");
23373
23296
  const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
23374
23297
  function useCompanySearch({
23375
23298
  defaultData,
@@ -23496,7 +23419,7 @@ function useCompanySearch({
23496
23419
  state: companyData.state ?? stateOrProvince2
23497
23420
  });
23498
23421
  } catch (e) {
23499
- logger$d.error(e);
23422
+ logger$e.error(e);
23500
23423
  setError(e);
23501
23424
  setStatus("error");
23502
23425
  } finally {
@@ -23529,7 +23452,7 @@ function useCompanySearch({
23529
23452
  indexSearch: handleCompanyIndexSearch,
23530
23453
  deepSearch: handleCompanyDeepSearch,
23531
23454
  resultsLimit: limit
23532
- })) == null ? void 0 : _a.catch((e) => logger$d.error(e));
23455
+ })) == null ? void 0 : _a.catch((e) => logger$e.error(e));
23533
23456
  }
23534
23457
  }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
23535
23458
  useEffect(() => {
@@ -25332,7 +25255,7 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType) => {
25332
25255
  }
25333
25256
  }, {});
25334
25257
  };
25335
- const logger$c = createLogger("useFormTaskSubmit");
25258
+ const logger$d = createLogger("useFormTaskSubmit");
25336
25259
  function useCompanySearchTaskSubmit({
25337
25260
  task,
25338
25261
  forms: forms2,
@@ -25376,7 +25299,7 @@ function useCompanySearchTaskSubmit({
25376
25299
  });
25377
25300
  }
25378
25301
  } catch (e) {
25379
- logger$c.error(e);
25302
+ logger$d.error(e);
25380
25303
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
25381
25304
  segmentation: {
25382
25305
  ...baseTrackingPayload,
@@ -25428,7 +25351,7 @@ function useCompanySearchTaskSubmit({
25428
25351
  ...trackingPayload
25429
25352
  }
25430
25353
  });
25431
- logger$c.log(submittedLegalEntity);
25354
+ logger$d.log(submittedLegalEntity);
25432
25355
  clearToasts();
25433
25356
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
25434
25357
  } catch (e) {
@@ -25452,7 +25375,7 @@ function useCompanySearchTaskSubmit({
25452
25375
  type: ToastType.ERROR
25453
25376
  });
25454
25377
  }
25455
- logger$c.error(e);
25378
+ logger$d.error(e);
25456
25379
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
25457
25380
  segmentation: {
25458
25381
  ...baseTrackingPayload,
@@ -25807,6 +25730,84 @@ function CompanySearchDropinComponent({
25807
25730
  })
25808
25731
  });
25809
25732
  }
25733
+ const logger$c = createLogger("useLocalStorage");
25734
+ const useLocalStorage = (key, defaultValue, options) => {
25735
+ const {
25736
+ serializer,
25737
+ parser,
25738
+ syncData
25739
+ } = useMemo(() => ({
25740
+ serializer: JSON.stringify,
25741
+ parser: JSON.parse,
25742
+ syncData: true,
25743
+ ...options
25744
+ }), [options]);
25745
+ const rawValueRef = useRef(null);
25746
+ const [value, setValue] = useState(() => {
25747
+ if (typeof window === "undefined")
25748
+ return defaultValue;
25749
+ try {
25750
+ rawValueRef.current = window.localStorage.getItem(key);
25751
+ const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
25752
+ return res;
25753
+ } catch (err) {
25754
+ logger$c.error(err);
25755
+ return defaultValue;
25756
+ }
25757
+ });
25758
+ useEffect(() => {
25759
+ if (typeof window === "undefined")
25760
+ return;
25761
+ const updateLocalStorage = () => {
25762
+ if (value !== void 0) {
25763
+ const newValue = serializer(value);
25764
+ const oldValue = rawValueRef.current;
25765
+ rawValueRef.current = newValue;
25766
+ window.localStorage.setItem(key, newValue);
25767
+ window.dispatchEvent(new StorageEvent("storage", {
25768
+ storageArea: window.localStorage,
25769
+ url: window.location.href,
25770
+ key,
25771
+ newValue,
25772
+ oldValue
25773
+ }));
25774
+ } else {
25775
+ window.localStorage.removeItem(key);
25776
+ window.dispatchEvent(new StorageEvent("storage", {
25777
+ storageArea: window.localStorage,
25778
+ url: window.location.href,
25779
+ key
25780
+ }));
25781
+ }
25782
+ };
25783
+ try {
25784
+ updateLocalStorage();
25785
+ } catch (err) {
25786
+ logger$c.error(err);
25787
+ }
25788
+ }, [value]);
25789
+ useEffect(() => {
25790
+ if (!syncData)
25791
+ return;
25792
+ const handleStorageChange = (event) => {
25793
+ if (event.key !== key || event.storageArea !== window.localStorage)
25794
+ return;
25795
+ try {
25796
+ if (event.newValue !== rawValueRef.current) {
25797
+ rawValueRef.current = event.newValue;
25798
+ setValue(event.newValue ? parser(event.newValue) : void 0);
25799
+ }
25800
+ } catch (err) {
25801
+ logger$c.error(err);
25802
+ }
25803
+ };
25804
+ if (typeof window === "undefined")
25805
+ return;
25806
+ window.addEventListener("storage", handleStorageChange);
25807
+ return () => window.removeEventListener("storage", handleStorageChange);
25808
+ }, [key, syncData]);
25809
+ return [value, setValue];
25810
+ };
25810
25811
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
25811
25812
  const useHasSeenIntroduction = ({
25812
25813
  legalEntityId
@@ -25817,61 +25818,6 @@ const useHasSeenIntroduction = ({
25817
25818
  setHasSeenIntroduction
25818
25819
  };
25819
25820
  };
25820
- const useLegalEntityType = ({
25821
- legalEntity
25822
- }) => {
25823
- const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
25824
- const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
25825
- const hasLegalAssociation = isTrust || isSoleProprietor;
25826
- switch (legalEntity.type) {
25827
- case LegalEntityType.INDIVIDUAL:
25828
- case LegalEntityType.ORGANIZATION:
25829
- if (!hasLegalAssociation)
25830
- return legalEntity.type;
25831
- if (isSoleProprietor)
25832
- return LegalEntityType.SOLE_PROPRIETORSHIP;
25833
- if (isTrust)
25834
- return LegalEntityType.TRUST;
25835
- break;
25836
- default:
25837
- return void 0;
25838
- }
25839
- };
25840
- const useCanSeeIntroduction = ({
25841
- legalEntity
25842
- }) => {
25843
- const legalEntityType = useLegalEntityType({
25844
- legalEntity
25845
- });
25846
- const {
25847
- isSettingEnabled
25848
- } = useSettingsContext();
25849
- switch (legalEntityType) {
25850
- case LegalEntityType.INDIVIDUAL:
25851
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
25852
- case LegalEntityType.ORGANIZATION:
25853
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
25854
- case LegalEntityType.SOLE_PROPRIETORSHIP:
25855
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
25856
- case LegalEntityType.TRUST:
25857
- return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
25858
- default:
25859
- return false;
25860
- }
25861
- };
25862
- const useShouldShowIntroduction = ({
25863
- legalEntity
25864
- }) => {
25865
- const canSeeIntroduction = useCanSeeIntroduction({
25866
- legalEntity
25867
- });
25868
- const {
25869
- hasSeenIntroduction
25870
- } = useHasSeenIntroduction({
25871
- legalEntityId: legalEntity.id
25872
- });
25873
- return canSeeIntroduction && !hasSeenIntroduction;
25874
- };
25875
25821
  const getHasSeenSingpassSelectionStorageKey = (legalEntityId) => `COMPLETED_SINGPASS_SELECTION-${legalEntityId}`;
25876
25822
  const useHasSeenSingpassSelection = ({
25877
25823
  legalEntityId
@@ -25882,27 +25828,23 @@ const useHasSeenSingpassSelection = ({
25882
25828
  setHasSeenSingpassSelection
25883
25829
  };
25884
25830
  };
25885
- const useShouldShowSingpass = ({
25886
- isExperimentEnabled = false,
25831
+ const useIsEligibleForSingpass = ({
25887
25832
  legalEntity,
25888
25833
  accountHolder: accountHolder2,
25889
25834
  handleOpenSingpassAuthorizationLink
25890
25835
  }) => {
25891
- const shouldShowSingpassForAccountHolder = (newAccountHolder) => {
25892
- if (!isExperimentEnabled) {
25893
- return false;
25894
- }
25895
- const country2 = getLegalEntityCountry(legalEntity);
25896
- const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink && country2 === CountryCodes.Singapore);
25897
- if (newAccountHolder) {
25898
- return isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor";
25899
- }
25900
- return isSingpassEnabled && (legalEntity == null ? void 0 : legalEntity.type) === LegalEntityType.ORGANIZATION;
25901
- };
25902
- return {
25903
- shouldShowSingpass: shouldShowSingpassForAccountHolder(accountHolder2),
25904
- shouldShowSingpassForAccountHolder
25905
- };
25836
+ const {
25837
+ isExperimentEnabled
25838
+ } = useExperimentsContext();
25839
+ if (!isExperimentEnabled("ShowSingPassButtonForCompanies"))
25840
+ return false;
25841
+ const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink) && getLegalEntityCountry(legalEntity) === CountryCodes.Singapore;
25842
+ if (!isSingpassEnabled)
25843
+ return false;
25844
+ if (accountHolder2) {
25845
+ return accountHolder2 === "theCompanyIWorkFor";
25846
+ }
25847
+ return legalEntity.type === LegalEntityType.ORGANIZATION;
25906
25848
  };
25907
25849
  const logger$b = createLogger("useAssociatedLegalArrangement");
25908
25850
  function useAssociatedLegalArrangement({
@@ -25947,11 +25889,6 @@ const useExemptSettlor = ({
25947
25889
  }, [trust2, updateExemptSettlor]);
25948
25890
  return exemptSettlor;
25949
25891
  };
25950
- const leIdStorageKey = "LE_ID";
25951
- const useLeId = () => {
25952
- const [leIdFromLocalStorage, setLeIdIntoLocalStorage] = useLocalStorage(leIdStorageKey, null);
25953
- return [leIdFromLocalStorage, setLeIdIntoLocalStorage];
25954
- };
25955
25892
  function useSalesChannelsSettings() {
25956
25893
  const {
25957
25894
  isSettingEnabled
@@ -26419,11 +26356,9 @@ const BusinessTypeIcon = (item) => jsx(Icon, {
26419
26356
  const BusinessTypeSelection = ({
26420
26357
  legalEntityResponse,
26421
26358
  accountHolder: accountHolder2,
26422
- onAccountHolderSelect,
26359
+ onComplete,
26360
+ onBack,
26423
26361
  handleUpdateLegalEntity,
26424
- taskHistory,
26425
- setTaskHistory,
26426
- onNavigateTo,
26427
26362
  baseTrackingPayload
26428
26363
  }) => {
26429
26364
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
@@ -26443,8 +26378,7 @@ const BusinessTypeSelection = ({
26443
26378
  1,
26444
26379
  2
26445
26380
  /* WE_CANNOT_SET_UP_ACCOUNT */
26446
- ].includes(currentStep);
26447
- const isPrevTaskTasksOverview = taskHistory[taskHistory.length - 2] === TaskTypes.TASKS_OVERVIEW;
26381
+ ].includes(currentStep) || currentStep === 0 && Boolean(onBack);
26448
26382
  const {
26449
26383
  businessTypeOptions,
26450
26384
  legalArrangementOptions
@@ -26536,7 +26470,7 @@ const BusinessTypeSelection = ({
26536
26470
  segmentation: baseTrackingPayload
26537
26471
  });
26538
26472
  } else {
26539
- onAccountHolderSelect(newAccountHolder);
26473
+ onComplete(newAccountHolder);
26540
26474
  }
26541
26475
  if (isLegalArrangementChanging) {
26542
26476
  await updateLegalEntityAndSelectAccountHolder();
@@ -26562,7 +26496,7 @@ const BusinessTypeSelection = ({
26562
26496
  }, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
26563
26497
  }
26564
26498
  }
26565
- if (isLegalArrangementChanging) {
26499
+ if (isLegalArrangementChanging && targetLegalArrangement) {
26566
26500
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity({
26567
26501
  organization: {
26568
26502
  type: mapLegalArrangementOptionToCompanyTypesValue(targetLegalArrangement)
@@ -26576,7 +26510,7 @@ const BusinessTypeSelection = ({
26576
26510
  });
26577
26511
  } finally {
26578
26512
  setLoadingStatus("success");
26579
- onAccountHolderSelect(newAccountHolder);
26513
+ onComplete(newAccountHolder);
26580
26514
  }
26581
26515
  };
26582
26516
  const handleBackClick = () => {
@@ -26592,9 +26526,8 @@ const BusinessTypeSelection = ({
26592
26526
  /* BUSINESS_TYPE_SELECTION */
26593
26527
  );
26594
26528
  }
26595
- if (currentStep === 0 && isPrevTaskTasksOverview) {
26596
- setTaskHistory(taskHistory.slice(taskHistory.length - 2));
26597
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
26529
+ if (currentStep === 0) {
26530
+ onBack == null ? void 0 : onBack();
26598
26531
  }
26599
26532
  };
26600
26533
  const isWeCannotSetUpAccountStep = currentStep === 2;
@@ -26701,7 +26634,7 @@ const BusinessTypeSelection = ({
26701
26634
  disabled: currentStep === 1 && !data.legalArrangement,
26702
26635
  onClick: handleNextClick,
26703
26636
  type: "button"
26704
- }), (hasBackButton || isPrevTaskTasksOverview) && jsxs("button", {
26637
+ }), hasBackButton && jsxs("button", {
26705
26638
  onClick: handleBackClick,
26706
26639
  type: "button",
26707
26640
  "aria-label": i18n.get("back"),
@@ -27492,6 +27425,48 @@ var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
27492
27425
  IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
27493
27426
  return IntroductionScreenTiming2;
27494
27427
  })(IntroductionScreenTiming || {});
27428
+ const useLegalEntityType = ({
27429
+ legalEntity
27430
+ }) => {
27431
+ const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
27432
+ const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
27433
+ const hasLegalAssociation = isTrust || isSoleProprietor;
27434
+ switch (legalEntity.type) {
27435
+ case LegalEntityType.INDIVIDUAL:
27436
+ case LegalEntityType.ORGANIZATION:
27437
+ if (!hasLegalAssociation)
27438
+ return legalEntity.type;
27439
+ if (isSoleProprietor)
27440
+ return LegalEntityType.SOLE_PROPRIETORSHIP;
27441
+ if (isTrust)
27442
+ return LegalEntityType.TRUST;
27443
+ break;
27444
+ default:
27445
+ return void 0;
27446
+ }
27447
+ };
27448
+ const useCanSeeIntroduction = ({
27449
+ legalEntity
27450
+ }) => {
27451
+ const legalEntityType = useLegalEntityType({
27452
+ legalEntity
27453
+ });
27454
+ const {
27455
+ isSettingEnabled
27456
+ } = useSettingsContext();
27457
+ switch (legalEntityType) {
27458
+ case LegalEntityType.INDIVIDUAL:
27459
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
27460
+ case LegalEntityType.ORGANIZATION:
27461
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
27462
+ case LegalEntityType.SOLE_PROPRIETORSHIP:
27463
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
27464
+ case LegalEntityType.TRUST:
27465
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
27466
+ default:
27467
+ return false;
27468
+ }
27469
+ };
27495
27470
  const useIntroductionScreens = ({
27496
27471
  legalEntity,
27497
27472
  tasks
@@ -29243,7 +29218,7 @@ function IndividualDropinComponent({
29243
29218
  const useBankConfigurationHandlers = ({
29244
29219
  isEmbeddedDropin,
29245
29220
  handleGetBankVerificationVendors,
29246
- bankAccountCountry: bankAccountCountry2,
29221
+ bankAccountCountry,
29247
29222
  getConfiguration: getConfiguration2,
29248
29223
  legalEntityType,
29249
29224
  capabilities
@@ -29252,16 +29227,16 @@ const useBankConfigurationHandlers = ({
29252
29227
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
29253
29228
  useEffect(() => {
29254
29229
  (async () => {
29255
- const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry2) : [];
29230
+ const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
29256
29231
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
29257
29232
  })();
29258
- }, [bankAccountCountry2]);
29233
+ }, [bankAccountCountry]);
29259
29234
  const getConfigurationData = useCallback(async () => {
29260
29235
  var _a;
29261
29236
  const configuration = await getConfiguration2({
29262
29237
  legalEntityType,
29263
29238
  capabilities,
29264
- country: bankAccountCountry2
29239
+ country: bankAccountCountry
29265
29240
  });
29266
29241
  if (!callBankVerificationVendorsUpfront || !((_a = bankVerificationVendorsResponse == null ? void 0 : bankVerificationVendorsResponse[0]) == null ? void 0 : _a.name)) {
29267
29242
  return configuration;
@@ -29269,10 +29244,10 @@ const useBankConfigurationHandlers = ({
29269
29244
  return {
29270
29245
  ...configuration,
29271
29246
  bankVerificationProviders: {
29272
- [bankAccountCountry2]: bankVerificationVendorsResponse[0].name
29247
+ [bankAccountCountry]: bankVerificationVendorsResponse[0].name
29273
29248
  }
29274
29249
  };
29275
- }, [bankAccountCountry2, capabilities, bankVerificationVendorsResponse]);
29250
+ }, [bankAccountCountry, capabilities, bankVerificationVendorsResponse]);
29276
29251
  const getBankVerificationVendorsHandler = useMemo(() => callBankVerificationVendorsUpfront && bankVerificationVendorsResponse ? (country2) => country2 && Promise.resolve(bankVerificationVendorsResponse) : handleGetBankVerificationVendors, [bankVerificationVendorsResponse, callBankVerificationVendorsUpfront]);
29277
29252
  return {
29278
29253
  getConfigurationData,
@@ -29400,7 +29375,7 @@ function PayoutDetailsDropinComponent({
29400
29375
  getConfiguration: getConfiguration2
29401
29376
  } = useConfigurationApi();
29402
29377
  const defaultPayoutCountry = getLegalEntityCountry(legalEntityResponse);
29403
- const [bankAccountCountry2, setBankAccountCountry] = useState(defaultPayoutCountry);
29378
+ const [bankAccountCountry, setBankAccountCountry] = useState(defaultPayoutCountry);
29404
29379
  const existingPayoutDetails = transferInstrument ? mapTransferInstrumentToPayoutAccount(transferInstrument) : void 0;
29405
29380
  const [documents2, setDocuments] = useState();
29406
29381
  const [newTransferInstrumentId, setNewTransferInstrumentId] = useState();
@@ -29434,7 +29409,7 @@ function PayoutDetailsDropinComponent({
29434
29409
  const [hideBackButton, setHideBackButton] = useState(false);
29435
29410
  const [loadingStatus, setLoadingStatus] = useState("success");
29436
29411
  const [data, setData] = useState(prefilledData);
29437
- const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_c = (_b = getCapabilityProblems(legalEntityResponse, bankAccountCountry2)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument.id] : void 0));
29412
+ const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_c = (_b = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument.id] : void 0));
29438
29413
  const existingBankAccountFormat = transferInstrument ? ((_d = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _d.iban) ? "iban" : "local" : void 0;
29439
29414
  const baseTrackingPayload = getBaseTrackingPayload({
29440
29415
  trackingConfig,
@@ -29455,12 +29430,12 @@ function PayoutDetailsDropinComponent({
29455
29430
  } = useBankConfigurationHandlers({
29456
29431
  isEmbeddedDropin,
29457
29432
  handleGetBankVerificationVendors,
29458
- bankAccountCountry: bankAccountCountry2 ?? defaultPayoutCountry,
29433
+ bankAccountCountry: bankAccountCountry ?? defaultPayoutCountry,
29459
29434
  getConfiguration: getConfiguration2,
29460
29435
  legalEntityType: legalEntityResponse.type,
29461
29436
  capabilities
29462
29437
  });
29463
- const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry2 ?? defaultPayoutCountry), [bankAccountCountry2]);
29438
+ const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry ?? defaultPayoutCountry), [bankAccountCountry]);
29464
29439
  const {
29465
29440
  fieldConfigurations,
29466
29441
  requiredFields,
@@ -29471,16 +29446,16 @@ function PayoutDetailsDropinComponent({
29471
29446
  getPayoutAccountFormatData,
29472
29447
  instantVerificationEnabled,
29473
29448
  setLoadingStatus,
29474
- country: bankAccountCountry2 ?? defaultPayoutCountry,
29449
+ country: bankAccountCountry ?? defaultPayoutCountry,
29475
29450
  existingBankAccountFormat
29476
29451
  });
29477
29452
  const fieldsFromCustomRules = useMemo(() => rules$1({
29478
29453
  data,
29479
- country: bankAccountCountry2 ?? defaultPayoutCountry,
29454
+ country: bankAccountCountry ?? defaultPayoutCountry,
29480
29455
  taskType,
29481
29456
  requiredFields
29482
- }), [bankAccountCountry2, data, taskType]);
29483
- const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry2]);
29457
+ }), [bankAccountCountry, data, taskType]);
29458
+ const fieldsFormCustomLabels = useMemo(() => labels ? labels() : {}, [data, bankAccountCountry]);
29484
29459
  const payoutDetailsSteps = useMemo(() => {
29485
29460
  var _a2;
29486
29461
  return getAppropriatePayoutDetailsSteps(taskType, Boolean((_a2 = prefilledData == null ? void 0 : prefilledData.payoutAccountDetails) == null ? void 0 : _a2.transferInstrumentId), !transferInstrument && isInstantVerificationAvailable({
@@ -29625,6 +29600,11 @@ function PayoutDetailsDropinComponent({
29625
29600
  ...problems,
29626
29601
  validationErrors
29627
29602
  });
29603
+ } else if (isDocumentUploadError(e)) {
29604
+ showToast({
29605
+ label: i18n.get("documentUploadfailed"),
29606
+ type: ToastType.ERROR
29607
+ });
29628
29608
  } else if (isMaintenanceModeError(e)) {
29629
29609
  showToast({
29630
29610
  label: i18n.get("failedToUpdateDetails"),
@@ -31250,7 +31230,7 @@ function SolePropDropinComponent({
31250
31230
  const solePropCountry = ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) ? datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country) : void 0;
31251
31231
  summaryData.solePropNameAndCountry = {
31252
31232
  legalNameOfSoleProprietor: (_b2 = data2.solePropNameAndCountry) == null ? void 0 : _b2.legalCompanyName,
31253
- countryOfEstablishment: solePropCountry
31233
+ countryRegionOfEstablishment: solePropCountry
31254
31234
  };
31255
31235
  if ((_c = summaryData == null ? void 0 : summaryData.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress) {
31256
31236
  summaryData.solePropRegistrationAddress.hasInnerForms = true;
@@ -31535,7 +31515,7 @@ function TrustDropinComponent({
31535
31515
  })) == null ? void 0 : _c.name) : void 0;
31536
31516
  summaryData.trustRegistrationDetails = {
31537
31517
  nameOfTrustAgreement: (_d = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _d.legalName,
31538
- countryOfEstablishment: trustCountry,
31518
+ countryRegionOfEstablishment: trustCountry,
31539
31519
  typeOfTrustAgreement: trustType2,
31540
31520
  objectOfTrust: (_e = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _e.objectOfTrust,
31541
31521
  taxId: (_f = summaryData == null ? void 0 : summaryData.trustRegistrationDetails) == null ? void 0 : _f.taxId
@@ -31628,6 +31608,107 @@ function TrustDropinComponent({
31628
31608
  })
31629
31609
  });
31630
31610
  }
31611
+ const useShouldShowIntroduction = ({
31612
+ legalEntity
31613
+ }) => {
31614
+ const canSeeIntroduction = useCanSeeIntroduction({
31615
+ legalEntity
31616
+ });
31617
+ const {
31618
+ hasSeenIntroduction
31619
+ } = useHasSeenIntroduction({
31620
+ legalEntityId: legalEntity.id
31621
+ });
31622
+ return canSeeIntroduction && !hasSeenIntroduction;
31623
+ };
31624
+ const useNavigation = ({
31625
+ legalEntity,
31626
+ onNavigate,
31627
+ handleOpenSingpassAuthorizationLink
31628
+ }) => {
31629
+ const isNewEntryFlowEnabled = useEnableNewEntryFlow();
31630
+ const showIntroduction = useShouldShowIntroduction({
31631
+ legalEntity
31632
+ });
31633
+ const {
31634
+ hasSeenSingpassSelection
31635
+ } = useHasSeenSingpassSelection({
31636
+ legalEntityId: legalEntity.id
31637
+ });
31638
+ const {
31639
+ accountHolder: accountHolder2
31640
+ } = useCoreContext();
31641
+ const eligibleForSingpass = useIsEligibleForSingpass({
31642
+ legalEntity,
31643
+ accountHolder: accountHolder2,
31644
+ handleOpenSingpassAuthorizationLink
31645
+ });
31646
+ const shouldShowSingpassSelection = eligibleForSingpass && !hasSeenSingpassSelection;
31647
+ const [taskHistory, setTaskHistory] = useState(["default"]);
31648
+ const actualTasks = taskHistory.filter((task) => task !== "default");
31649
+ const navigateTo = useCallback((task, deletePreviousHistory = false) => {
31650
+ const pushNewTask = () => setTaskHistory((taskHistory2) => deletePreviousHistory ? [task] : [...taskHistory2, task]);
31651
+ if (task === "default") {
31652
+ setTimeout(pushNewTask);
31653
+ } else {
31654
+ pushNewTask();
31655
+ onNavigate == null ? void 0 : onNavigate(task);
31656
+ }
31657
+ }, [onNavigate]);
31658
+ const navigateBack = useCallback((stepCount = 1) => {
31659
+ if (taskHistory.length <= 1)
31660
+ return;
31661
+ const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
31662
+ if (prevTask === "default") {
31663
+ throw Error("Cannot navigate back to 'default' task");
31664
+ }
31665
+ if (prevTask === TaskTypes.TASKS_OVERVIEW) {
31666
+ setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
31667
+ onNavigate == null ? void 0 : onNavigate(TaskTypes.TASKS_OVERVIEW);
31668
+ return;
31669
+ }
31670
+ setTaskHistory(taskHistory.slice(0, -1 * stepCount));
31671
+ onNavigate == null ? void 0 : onNavigate(prevTask);
31672
+ }, [taskHistory, onNavigate]);
31673
+ useEffect(() => {
31674
+ const pushedTask = taskHistory.at(-1);
31675
+ if (pushedTask === "default") {
31676
+ const defaultTask = getDefaultTask({
31677
+ legalEntity,
31678
+ accountHolder: accountHolder2,
31679
+ showIntroduction,
31680
+ isNewEntryFlowEnabled,
31681
+ shouldShowSingpassSelection
31682
+ });
31683
+ setTaskHistory([...taskHistory.slice(0, taskHistory.length - 1), defaultTask]);
31684
+ }
31685
+ }, [legalEntity, accountHolder2, showIntroduction, isNewEntryFlowEnabled, shouldShowSingpassSelection, taskHistory]);
31686
+ return {
31687
+ currentTask: actualTasks.at(-1),
31688
+ previousTask: actualTasks.at(-2),
31689
+ navigateBack,
31690
+ navigateTo
31691
+ };
31692
+ };
31693
+ const getDefaultTask = ({
31694
+ legalEntity,
31695
+ accountHolder: accountHolder2,
31696
+ isNewEntryFlowEnabled,
31697
+ showIntroduction,
31698
+ shouldShowSingpassSelection
31699
+ }) => {
31700
+ var _a, _b;
31701
+ const hasOwnEntityAssocation = (_a = legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.associatorId === legalEntity.id);
31702
+ const hasOrganizationType = (_b = legalEntity.organization) == null ? void 0 : _b.type;
31703
+ const hasProgressedBeyondEntitySelection = hasOwnEntityAssocation || !!hasOrganizationType;
31704
+ if (isNewEntryFlowEnabled && !accountHolder2 && !hasProgressedBeyondEntitySelection)
31705
+ return TaskTypes.BUSINESS_TYPE_SELECTION;
31706
+ if (showIntroduction)
31707
+ return TaskTypes.INTRODUCTION;
31708
+ if (shouldShowSingpassSelection)
31709
+ return TaskTypes.SINGPASS_SELECTION;
31710
+ return TaskTypes.TASKS_OVERVIEW;
31711
+ };
31631
31712
  const PAGES_WITH_POLLING = [TaskTypes.DECISION_MAKER_OVERVIEW, TaskTypes.TASKS_OVERVIEW];
31632
31713
  const POLLING_INTERVAL = 3e3;
31633
31714
  const logger$8 = createLogger("DropinComposerComponent");
@@ -31662,50 +31743,27 @@ function DropinComposerComponent({
31662
31743
  showToast
31663
31744
  } = useToastContext();
31664
31745
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
31665
- const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
31666
- const isSingpassExperimentEnabled = isExperimentEnabled("ShowSingPassButtonForCompanies");
31667
31746
  const {
31668
- hasSeenSingpassSelection,
31747
+ handleOpenSingpassAuthorizationLink
31748
+ } = args;
31749
+ const {
31669
31750
  setHasSeenSingpassSelection
31670
31751
  } = useHasSeenSingpassSelection({
31671
31752
  legalEntityId: legalEntityResponse.id
31672
31753
  });
31673
- const [leId, setLeId] = useLeId();
31674
- const showIntroduction = useShouldShowIntroduction({
31675
- legalEntity: legalEntityResponse
31676
- });
31677
31754
  const {
31678
31755
  setHasSeenIntroduction
31679
31756
  } = useHasSeenIntroduction({
31680
31757
  legalEntityId: legalEntityResponse.id
31681
31758
  });
31682
- const [tasks, setTasks] = useState([]);
31683
- const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
31684
- const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
31685
- const {
31686
- handleOpenSingpassAuthorizationLink
31687
- } = args;
31688
- const {
31689
- shouldShowSingpass,
31690
- shouldShowSingpassForAccountHolder
31691
- } = useShouldShowSingpass({
31692
- isExperimentEnabled: isSingpassExperimentEnabled,
31759
+ const eligibleForSingpass = useIsEligibleForSingpass({
31693
31760
  legalEntity: legalEntityResponse,
31694
31761
  accountHolder: accountHolder2,
31695
31762
  handleOpenSingpassAuthorizationLink
31696
31763
  });
31697
- const shouldShowSingpassSelection = shouldShowSingpass && !hasSeenSingpassSelection;
31698
- const initialTask = useMemo(() => {
31699
- if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
31700
- return TaskTypes.BUSINESS_TYPE_SELECTION;
31701
- }
31702
- if (showIntroduction)
31703
- return TaskTypes.INTRODUCTION;
31704
- if (shouldShowSingpassSelection)
31705
- return TaskTypes.SINGPASS_SELECTION;
31706
- return TaskTypes.TASKS_OVERVIEW;
31707
- }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
31708
- const [taskHistory, setTaskHistory] = useState([initialTask]);
31764
+ const [tasks, setTasks] = useState([]);
31765
+ const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
31766
+ const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
31709
31767
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
31710
31768
  const {
31711
31769
  associatedLegalArrangement,
@@ -31729,6 +31787,16 @@ function DropinComposerComponent({
31729
31787
  const [transferInstrument, setTransferInstrument] = useState(null);
31730
31788
  const [capabilityProblems, setCapabilityProblems] = useState(getCapabilityProblems(legalEntityResponse, rootLegalEntityCountry, isExperimentEnabled));
31731
31789
  const [bankVerificationVendors, setBankVerificationVendors] = useState();
31790
+ const {
31791
+ currentTask,
31792
+ previousTask,
31793
+ navigateTo,
31794
+ navigateBack
31795
+ } = useNavigation({
31796
+ legalEntity: legalEntityResponse,
31797
+ onNavigate,
31798
+ handleOpenSingpassAuthorizationLink
31799
+ });
31732
31800
  const hasTrust = accountHolder2 === "aTrust" || isPartOfTrustFromLegalEntity(legalEntityResponse);
31733
31801
  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);
31734
31802
  const additionalSalesChannels = useSalesChannelsSettings();
@@ -31991,7 +32059,7 @@ function DropinComposerComponent({
31991
32059
  }
31992
32060
  };
31993
32061
  const handleSingpassSelectionNextClick = async (method) => {
31994
- if (method === "singpass" && shouldShowSingpass) {
32062
+ if (method === "singpass") {
31995
32063
  try {
31996
32064
  const {
31997
32065
  item: {
@@ -32000,8 +32068,8 @@ function DropinComposerComponent({
32000
32068
  } = await handleOpenSingpassAuthorizationLink();
32001
32069
  setHasSeenSingpassSelection(true);
32002
32070
  window.open(authUrl, "_blank").focus();
32003
- if (taskHistory[taskHistory.length - 1] !== TaskTypes.TASKS_OVERVIEW) {
32004
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32071
+ if (currentTask !== TaskTypes.TASKS_OVERVIEW) {
32072
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32005
32073
  }
32006
32074
  } catch (e) {
32007
32075
  logger$8.error(e);
@@ -32013,13 +32081,9 @@ function DropinComposerComponent({
32013
32081
  }
32014
32082
  if (method === "manual") {
32015
32083
  setHasSeenSingpassSelection(true);
32016
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32084
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32017
32085
  }
32018
32086
  };
32019
- const onNavigateTo = (task) => {
32020
- setTaskHistory([...taskHistory, task]);
32021
- onNavigate(task);
32022
- };
32023
32087
  const onNavigateToDecisionMakerIndividual = async (task, id2, parentId) => {
32024
32088
  if (parentId && parentId !== rootLegalEntity.id) {
32025
32089
  const parentLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(parentId));
@@ -32031,7 +32095,7 @@ function DropinComposerComponent({
32031
32095
  try {
32032
32096
  const currentAssociatedLegalEntity = await (args == null ? void 0 : args.handleGetLegalEntity(id2));
32033
32097
  setAssociatedLegalEntity(currentAssociatedLegalEntity);
32034
- onNavigateTo(task);
32098
+ navigateTo(task);
32035
32099
  } catch (e) {
32036
32100
  showToast({
32037
32101
  label: i18n.get("failedFetchingDecisionMaker"),
@@ -32040,7 +32104,7 @@ function DropinComposerComponent({
32040
32104
  }
32041
32105
  } else {
32042
32106
  setAssociatedLegalEntity(null);
32043
- onNavigateTo(task);
32107
+ navigateTo(task);
32044
32108
  }
32045
32109
  };
32046
32110
  const onNavigateToPayinOrPayout = async (id2, task = TaskTypes.PAYOUT) => {
@@ -32051,17 +32115,17 @@ function DropinComposerComponent({
32051
32115
  await getSolePropietor();
32052
32116
  }
32053
32117
  } finally {
32054
- onNavigateTo(task);
32118
+ navigateTo(task);
32055
32119
  }
32056
32120
  } else {
32057
32121
  setTransferInstrument(null);
32058
- onNavigateTo(task);
32122
+ navigateTo(task);
32059
32123
  }
32060
32124
  };
32061
32125
  const onNavigateToPci = async (task = TaskTypes.PCI_DSS) => {
32062
32126
  try {
32063
32127
  await getPciTemplate();
32064
- onNavigateTo(task);
32128
+ navigateTo(task);
32065
32129
  } catch (e) {
32066
32130
  showToast({
32067
32131
  label: i18n.get("failedToGetPciTemplate"),
@@ -32073,15 +32137,15 @@ function DropinComposerComponent({
32073
32137
  try {
32074
32138
  await getSolePropietor();
32075
32139
  } finally {
32076
- onNavigateTo(task);
32140
+ navigateTo(task);
32077
32141
  }
32078
32142
  };
32079
32143
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
32080
32144
  try {
32081
32145
  if (associatedLegalArrangement) {
32082
- onNavigateTo(task);
32146
+ navigateTo(task);
32083
32147
  } else {
32084
- onNavigateTo(TaskTypes.TRUST);
32148
+ navigateTo(TaskTypes.TRUST);
32085
32149
  }
32086
32150
  } catch (e) {
32087
32151
  showToast({
@@ -32099,7 +32163,7 @@ function DropinComposerComponent({
32099
32163
  setAssociatedLegalEntity(response);
32100
32164
  }
32101
32165
  setTrustMember(tm);
32102
- onNavigateTo(tm.trustMemberType === "company" ? TaskTypes.TRUST_MEMBER_COMPANY : TaskTypes.TRUST_MEMBER_INDIVIDUAL);
32166
+ navigateTo(tm.trustMemberType === "company" ? TaskTypes.TRUST_MEMBER_COMPANY : TaskTypes.TRUST_MEMBER_INDIVIDUAL);
32103
32167
  } catch (e) {
32104
32168
  showToast({
32105
32169
  label: i18n.get("failedToFetchTrustMemberDetails"),
@@ -32109,35 +32173,23 @@ function DropinComposerComponent({
32109
32173
  };
32110
32174
  const onNavigateToTrustMemberRoleAndType = (tm) => {
32111
32175
  setTrustMember(tm === "new" ? null : tm);
32112
- onNavigateTo(TaskTypes.TRUST_MEMBER_ROLE_AND_TYPE);
32113
- };
32114
- const navigateBack = (stepCount = 1) => {
32115
- if (taskHistory.length > 1) {
32116
- const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
32117
- if (prevTask === TaskTypes.TASKS_OVERVIEW) {
32118
- setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
32119
- onNavigate(TaskTypes.TASKS_OVERVIEW);
32120
- } else {
32121
- setTaskHistory(taskHistory.slice(0, -1 * stepCount));
32122
- onNavigate(taskHistory[taskHistory.length - 1]);
32123
- }
32124
- }
32176
+ navigateTo(TaskTypes.TRUST_MEMBER_ROLE_AND_TYPE);
32125
32177
  };
32126
32178
  const navigateToTypeSwitcher = (leType) => {
32127
32179
  setLegalEntityType(leType);
32128
- onNavigateTo(TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER);
32180
+ navigateTo(TaskTypes.LEGAL_ENTITY_TYPE_SWITCHER);
32129
32181
  };
32130
32182
  const navigateToTargetEntityType = () => {
32131
32183
  switch (legalEntityType) {
32132
32184
  case LegalEntityType.INDIVIDUAL:
32133
- onNavigateTo(TaskTypes.INDIVIDUAL);
32185
+ navigateTo(TaskTypes.INDIVIDUAL);
32134
32186
  break;
32135
32187
  case LegalEntityType.ORGANIZATION:
32136
- onNavigateTo(TaskTypes.COMPANY);
32188
+ navigateTo(TaskTypes.COMPANY);
32137
32189
  break;
32138
32190
  }
32139
32191
  };
32140
- const navigateTo = async (task, id2) => {
32192
+ const onNavigateToTask = async (task, id2) => {
32141
32193
  switch (task) {
32142
32194
  case TaskTypes.PAYOUT:
32143
32195
  await onNavigateToPayinOrPayout(id2, TaskTypes.PAYOUT);
@@ -32162,7 +32214,7 @@ function DropinComposerComponent({
32162
32214
  break;
32163
32215
  }
32164
32216
  default:
32165
- onNavigateTo(task);
32217
+ navigateTo(task);
32166
32218
  }
32167
32219
  };
32168
32220
  const componentOnChange = (state2) => {
@@ -32235,15 +32287,14 @@ function DropinComposerComponent({
32235
32287
  }, [rootLegalEntity.type, contextCountry]);
32236
32288
  useEffect(() => {
32237
32289
  if (hasRejectedCapabilities(rootLegalEntity)) {
32238
- setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
32290
+ navigateTo(TaskTypes.CAPABILITY_REJECTED, true);
32239
32291
  }
32240
32292
  }, [rootLegalEntity]);
32241
32293
  useEffect(() => {
32242
- if (!PAGES_WITH_POLLING.includes(taskHistory[taskHistory.length - 1]) || hasResolvedCapabilities(rootLegalEntity)) {
32294
+ if (!PAGES_WITH_POLLING.includes(currentTask) || hasResolvedCapabilities(rootLegalEntity)) {
32243
32295
  return;
32244
32296
  }
32245
32297
  if (hasRejectedCapabilities(rootLegalEntity)) {
32246
- setTaskHistory([TaskTypes.CAPABILITY_REJECTED]);
32247
32298
  return;
32248
32299
  }
32249
32300
  const timeoutId = setTimeout(() => {
@@ -32252,17 +32303,10 @@ function DropinComposerComponent({
32252
32303
  return () => {
32253
32304
  clearInterval(timeoutId);
32254
32305
  };
32255
- }, [refreshLegalEntity, rootLegalEntity, taskHistory]);
32256
- useEffect(() => {
32257
- if (!isNewEntryFlowEnabled || leId !== legalEntityResponse.id) {
32258
- setLeId(null);
32259
- setAccountHolder(null);
32260
- }
32261
- }, [isNewEntryFlowEnabled, setLeId]);
32306
+ }, [refreshLegalEntity, rootLegalEntity]);
32262
32307
  if (isLoadingConfiguration) {
32263
32308
  return jsx(Shimmer, {});
32264
32309
  }
32265
- const currentTask = taskHistory[taskHistory.length - 1];
32266
32310
  switch (currentTask) {
32267
32311
  case TaskTypes.BUSINESS_TYPE_SELECTION:
32268
32312
  return jsx("div", {
@@ -32271,23 +32315,12 @@ function DropinComposerComponent({
32271
32315
  ...args,
32272
32316
  legalEntityResponse: rootLegalEntity,
32273
32317
  accountHolder: accountHolder2,
32274
- onAccountHolderSelect: async (newAccountHolder) => {
32275
- setLeId(legalEntityResponse.id);
32318
+ onComplete: async (newAccountHolder) => {
32276
32319
  setAccountHolder(newAccountHolder);
32277
32320
  await refreshLegalEntity();
32278
- if (showIntroduction) {
32279
- onNavigateTo(TaskTypes.INTRODUCTION);
32280
- return;
32281
- }
32282
- if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
32283
- onNavigateTo(TaskTypes.SINGPASS_SELECTION);
32284
- return;
32285
- }
32286
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32321
+ navigateTo("default");
32287
32322
  },
32288
- taskHistory,
32289
- setTaskHistory,
32290
- onNavigateTo,
32323
+ onBack: previousTask ? navigateBack : void 0,
32291
32324
  trackingConfig: {
32292
32325
  topLevelLegalEntity: legalEntityResponse
32293
32326
  },
@@ -32303,11 +32336,7 @@ function DropinComposerComponent({
32303
32336
  legalEntity: rootLegalEntity,
32304
32337
  onExitIntroduction: () => {
32305
32338
  setHasSeenIntroduction(true);
32306
- if (shouldShowSingpassSelection) {
32307
- onNavigateTo(TaskTypes.SINGPASS_SELECTION);
32308
- return;
32309
- }
32310
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32339
+ navigateTo("default");
32311
32340
  },
32312
32341
  tasks
32313
32342
  });
@@ -32318,7 +32347,7 @@ function DropinComposerComponent({
32318
32347
  trackingConfig: {
32319
32348
  topLevelLegalEntity: legalEntityResponse
32320
32349
  },
32321
- onNavigateToTask: navigateTo,
32350
+ onNavigateToTask,
32322
32351
  tasks,
32323
32352
  legalEntityResponse: rootLegalEntity,
32324
32353
  capabilityProblems,
@@ -32329,7 +32358,7 @@ function DropinComposerComponent({
32329
32358
  isReview: reviewRequired,
32330
32359
  hasRequiredTrustMemberCount: hasRequiredTrustMemberCount(trustMembers2),
32331
32360
  onTransferInstrumentDelete: deleteTransferInstrument,
32332
- onRetrieveMyinfoBusinessWithSingpass: shouldShowSingpass ? () => handleSingpassSelectionNextClick("singpass") : null
32361
+ onRetrieveMyinfoBusinessWithSingpass: eligibleForSingpass ? () => handleSingpassSelectionNextClick("singpass") : null
32333
32362
  });
32334
32363
  case TaskTypes.DECISION_MAKER_OVERVIEW:
32335
32364
  return jsx(DecisionMakersComponent, {
@@ -32362,10 +32391,10 @@ function DropinComposerComponent({
32362
32391
  onSubmit: async (data) => {
32363
32392
  onSubmit == null ? void 0 : onSubmit(data);
32364
32393
  await refreshLegalEntity();
32365
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32394
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32366
32395
  setLegalEntityType(null);
32367
32396
  },
32368
- handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW),
32397
+ handleHomeClick: () => navigateTo(TaskTypes.TASKS_OVERVIEW),
32369
32398
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
32370
32399
  handleCreateLegalEntity: args == null ? void 0 : args.handleCreateLegalEntity,
32371
32400
  handleUpdateLegalEntity: args == null ? void 0 : args.handleUpdateLegalEntity,
@@ -32382,7 +32411,7 @@ function DropinComposerComponent({
32382
32411
  return jsx(ReviewComponent, {
32383
32412
  legalEntityId: rootLegalEntity.id,
32384
32413
  handleReviewConfirm: args.handleReviewConfirm,
32385
- handleHomeClick: () => onNavigateTo(TaskTypes.TASKS_OVERVIEW)
32414
+ handleHomeClick: () => navigateTo(TaskTypes.TASKS_OVERVIEW)
32386
32415
  });
32387
32416
  case TaskTypes.DECISION_MAKER:
32388
32417
  return jsx(IndividualDropinComponent, {
@@ -32452,7 +32481,7 @@ function DropinComposerComponent({
32452
32481
  eventEmitter,
32453
32482
  onSubmit: (data) => refreshLegalArrangementAndRunOnSubmit(data, 2),
32454
32483
  handleBackClick: navigateBack,
32455
- handleHomeClick: () => onNavigateTo(TaskTypes.TRUST_MEMBER_OVERVIEW),
32484
+ handleHomeClick: () => navigateTo(TaskTypes.TRUST_MEMBER_OVERVIEW),
32456
32485
  homeButtonLabel: i18n.get("saveAndGoToOverview"),
32457
32486
  trustMember,
32458
32487
  handleCreateLegalEntity: args == null ? void 0 : args.handleCreateLegalEntity,
@@ -32480,7 +32509,7 @@ function DropinComposerComponent({
32480
32509
  onSubmit: async (data) => {
32481
32510
  onSubmit == null ? void 0 : onSubmit(data);
32482
32511
  await refreshLegalEntity();
32483
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32512
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32484
32513
  setLegalEntityType(null);
32485
32514
  },
32486
32515
  handleHomeClick: navigateBack,
@@ -32508,7 +32537,7 @@ function DropinComposerComponent({
32508
32537
  onSubmit: async (data) => {
32509
32538
  onSubmit == null ? void 0 : onSubmit(data);
32510
32539
  await refreshLegalEntity();
32511
- onNavigateTo(TaskTypes.TASKS_OVERVIEW);
32540
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
32512
32541
  setLegalEntityType(null);
32513
32542
  },
32514
32543
  handleGetDocument: args.handleGetDocument,
@@ -33288,6 +33317,7 @@ function ViewVerificationStatusComponent({
33288
33317
  hideExplanation = false,
33289
33318
  returnUrl,
33290
33319
  redirectTarget,
33320
+ themeId,
33291
33321
  onStatusChange,
33292
33322
  onError,
33293
33323
  onRedirect,
@@ -33363,7 +33393,8 @@ function ViewVerificationStatusComponent({
33363
33393
  setLinkLoadingStatus("loading");
33364
33394
  const config = {
33365
33395
  locale: i18n.locale,
33366
- returnUrl
33396
+ returnUrl,
33397
+ themeId
33367
33398
  };
33368
33399
  try {
33369
33400
  const {
@@ -33847,7 +33878,7 @@ const ConfigurationApiProvider = ({
33847
33878
  isEmbeddedDropin,
33848
33879
  loadingContext
33849
33880
  } = authContext;
33850
- const sdkVersion = "2.40.0";
33881
+ const sdkVersion = "2.41.0";
33851
33882
  useAnalytics({
33852
33883
  onUserEvent,
33853
33884
  legalEntityId: rootLegalEntityId,
@@ -33870,14 +33901,25 @@ const ConfigurationApiProvider = ({
33870
33901
  }), children]
33871
33902
  });
33872
33903
  };
33904
+ const getAccountHolderStorageKey = (legalEntityId) => `ACCOUNT_HOLDER-${legalEntityId}`;
33905
+ const useAccountHolder = (legalEntityId) => {
33906
+ const [accountHolderFromLocalStorage, setAccountHolderIntoLocalStorage] = useLocalStorage(getAccountHolderStorageKey(legalEntityId), null);
33907
+ return {
33908
+ accountHolder: accountHolderFromLocalStorage,
33909
+ setAccountHolder: setAccountHolderIntoLocalStorage
33910
+ };
33911
+ };
33873
33912
  const logger$2 = createLogger("CoreProvider");
33874
33913
  const CoreProvider = ({
33875
33914
  contextCountry: initialContextCountry,
33876
- enableNewEntryFlowExperiment = false,
33915
+ rootLegalEntityId,
33877
33916
  children
33878
33917
  }) => {
33879
33918
  const [contextCountry, setContextCountry] = useState(initialContextCountry);
33880
- const [accountHolder2, setAccountHolder] = useAccountHolder(enableNewEntryFlowExperiment);
33919
+ const {
33920
+ accountHolder: accountHolder2,
33921
+ setAccountHolder
33922
+ } = useAccountHolder(rootLegalEntityId);
33881
33923
  const [accountFormat, setAccountFormat] = useState("local");
33882
33924
  const allowedCountries = useAllowedCountries();
33883
33925
  const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
@@ -33995,6 +34037,15 @@ const I18nProvider = ({
33995
34037
  children
33996
34038
  });
33997
34039
  };
34040
+ const ReactQueryClient = new QueryClient();
34041
+ function ReactQueryProvider({
34042
+ children
34043
+ }) {
34044
+ return jsx(QueryClientProvider, {
34045
+ client: ReactQueryClient,
34046
+ children
34047
+ });
34048
+ }
33998
34049
  const settingsDefaults = {
33999
34050
  acceptedCountries: void 0,
34000
34051
  allowBankAccountFormatSelection: false,
@@ -34323,8 +34374,8 @@ class UIElement extends BaseElement {
34323
34374
  constructor() {
34324
34375
  super(...arguments);
34325
34376
  this.render = () => {
34326
- var _a;
34327
34377
  const Component = this.props.component;
34378
+ const rootLegalEntityId = getRootLegalEntityId(this.props.componentProps);
34328
34379
  return jsx(SettingsProvider, {
34329
34380
  settings: this.props.settings,
34330
34381
  children: jsx(AuthProvider, {
@@ -34333,12 +34384,12 @@ class UIElement extends BaseElement {
34333
34384
  clientKey: this.props.clientKey,
34334
34385
  loadingContext: this.props.loadingContext,
34335
34386
  children: jsx(ConfigurationApiProvider, {
34336
- rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
34387
+ rootLegalEntityId,
34337
34388
  onUserEvent: this.props.onUserEvent,
34338
34389
  componentName: this.props.componentName,
34339
34390
  children: jsx(CoreProvider, {
34340
34391
  contextCountry: this.props.contextCountry,
34341
- enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
34392
+ rootLegalEntityId,
34342
34393
  children: jsx(I18nProvider, {
34343
34394
  locale: this.props.locale,
34344
34395
  customTranslations: this.props.customTranslations,
@@ -34349,9 +34400,11 @@ class UIElement extends BaseElement {
34349
34400
  children: jsx(AutoResizer, {
34350
34401
  children: jsx(ToastContextProvider, {
34351
34402
  children: jsx(StateProvider, {
34352
- children: jsx(Component, {
34353
- ...this.props.componentProps,
34354
- eventEmitter: this.eventEmitter
34403
+ children: jsx(ReactQueryProvider, {
34404
+ children: jsx(Component, {
34405
+ ...this.props.componentProps,
34406
+ eventEmitter: this.eventEmitter
34407
+ })
34355
34408
  })
34356
34409
  })
34357
34410
  })
@@ -35019,6 +35072,9 @@ const viewVerificationStatusComponentSchema = {
35019
35072
  redirectTarget: {
35020
35073
  type: "string"
35021
35074
  },
35075
+ themeId: {
35076
+ type: "string"
35077
+ },
35022
35078
  onStatusChange: {
35023
35079
  type: "function"
35024
35080
  },