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