@adyen/kyc-components 2.40.1 → 2.41.1

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