@adyen/kyc-components 3.8.0 → 3.8.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.
@@ -8,7 +8,6 @@ import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
8
8
  import OpenBankingSDK from "@adyen/openbankingsdk";
9
9
  import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
10
10
  import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
11
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
12
11
  const ConfigurationApiContext = createContext(void 0);
13
12
  const useConfigurationApi = () => {
14
13
  const configurationApi = useContext(ConfigurationApiContext);
@@ -3018,7 +3017,7 @@ const icons = {
3018
3017
  warning: lazy(() => import("./warning-99uFf1WU.js")),
3019
3018
  wrong: lazy(() => import("./wrong-1wvh7nZe.js"))
3020
3019
  };
3021
- const logger$x = createLogger("Icon");
3020
+ const logger$y = createLogger("Icon");
3022
3021
  const Icon = ({
3023
3022
  className,
3024
3023
  name,
@@ -3026,7 +3025,7 @@ const Icon = ({
3026
3025
  }) => {
3027
3026
  const LazyLoadedIcon = icons[name];
3028
3027
  if (!LazyLoadedIcon) {
3029
- logger$x.error(`No such icon: "${name}"`);
3028
+ logger$y.error(`No such icon: "${name}"`);
3030
3029
  return null;
3031
3030
  }
3032
3031
  return jsx("span", {
@@ -3230,7 +3229,7 @@ function useFormRouterContext() {
3230
3229
  }
3231
3230
  return context;
3232
3231
  }
3233
- const logger$w = createLogger("Link");
3232
+ const logger$x = createLogger("Link");
3234
3233
  const getIconClass = (icon, external) => {
3235
3234
  if (external) {
3236
3235
  return "adl-link__icon adyen-kyc-icon-external-link";
@@ -3242,7 +3241,7 @@ const getIconClass = (icon, external) => {
3242
3241
  };
3243
3242
  const isValidLink = (href) => {
3244
3243
  if (href === "#") {
3245
- logger$w.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3244
+ logger$x.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3246
3245
  return false;
3247
3246
  }
3248
3247
  return true;
@@ -3530,7 +3529,7 @@ const useSetting = (settingName) => {
3530
3529
  } = context;
3531
3530
  return getSetting(settingName);
3532
3531
  };
3533
- const logger$v = createLogger("useAllowedCountries");
3532
+ const logger$w = createLogger("useAllowedCountries");
3534
3533
  const useAllowedCountries = () => {
3535
3534
  const acceptedCountries = useSetting("acceptedCountries");
3536
3535
  const {
@@ -3540,7 +3539,7 @@ const useAllowedCountries = () => {
3540
3539
  useEffect(() => {
3541
3540
  if (acceptedCountries !== void 0)
3542
3541
  return;
3543
- getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$v.error);
3542
+ getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$w.error);
3544
3543
  }, [acceptedCountries]);
3545
3544
  return allowedCountries;
3546
3545
  };
@@ -3879,7 +3878,7 @@ class ValidationResult {
3879
3878
  return this.validationResults.filter((result) => result.hasError);
3880
3879
  }
3881
3880
  }
3882
- const logger$u = createLogger("useAsyncValidator");
3881
+ const logger$v = createLogger("useAsyncValidator");
3883
3882
  const useAsyncValidator = (asyncRules) => {
3884
3883
  const [asyncValidationResults, setAsyncValidationResults] = useState({});
3885
3884
  const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
@@ -3902,7 +3901,7 @@ const useAsyncValidator = (asyncRules) => {
3902
3901
  hasError: !isValid
3903
3902
  }])
3904
3903
  });
3905
- }).catch(logger$u.error);
3904
+ }).catch(logger$v.error);
3906
3905
  }, [asyncRules, clearAsyncValidationResults]);
3907
3906
  return {
3908
3907
  asyncValidationResults,
@@ -5333,7 +5332,7 @@ function useIsElementVisible(ref, fallback = true) {
5333
5332
  }, [ref]);
5334
5333
  return isOnScreen;
5335
5334
  }
5336
- const logger$t = createLogger("Flag");
5335
+ const logger$u = createLogger("Flag");
5337
5336
  const flagImports = /* @__PURE__ */ Object.assign({
5338
5337
  "../../../../assets/flags/ad.svg": () => import("./ad-DT4vRaBJ.js"),
5339
5338
  "../../../../assets/flags/ae.svg": () => import("./ae-BOcuAHGY.js"),
@@ -5590,7 +5589,7 @@ const flagImports = /* @__PURE__ */ Object.assign({
5590
5589
  const getLazyLoadedSvgComponent = (country2) => {
5591
5590
  const importForCountry = flagImports[`../../../../assets/flags/${country2.toLowerCase()}.svg`];
5592
5591
  if (!importForCountry) {
5593
- logger$t.error(`No flag available for ${country2}`);
5592
+ logger$u.error(`No flag available for ${country2}`);
5594
5593
  return void 0;
5595
5594
  }
5596
5595
  return lazy(importForCountry);
@@ -6379,7 +6378,7 @@ const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessa
6379
6378
  };
6380
6379
  };
6381
6380
  const MISMATCH_ANIMATION_NAME = "mismatchShake";
6382
- const logger$s = createLogger("MaskedInputText");
6381
+ const logger$t = createLogger("MaskedInputText");
6383
6382
  const MaskedInputText = ({
6384
6383
  value,
6385
6384
  onInput,
@@ -6421,7 +6420,7 @@ const MaskedInputText = ({
6421
6420
  };
6422
6421
  useEffect(() => {
6423
6422
  if (!mask) {
6424
- logger$s.warn("`mask` is undefined. No masking of input will take place.");
6423
+ logger$t.warn("`mask` is undefined. No masking of input will take place.");
6425
6424
  }
6426
6425
  }, [mask]);
6427
6426
  const getMaskResult = useCallback((pureValue) => {
@@ -6448,7 +6447,7 @@ const MaskedInputText = ({
6448
6447
  return;
6449
6448
  }
6450
6449
  const fallback = displayValueToPure(maskResult.partialDisplayValue);
6451
- logger$s.warn(`Value received "${value}" does not match mask`, maskResult, `
6450
+ logger$t.warn(`Value received "${value}" does not match mask`, maskResult, `
6452
6451
  Falling back to partially valid value "${fallback}"`);
6453
6452
  onInput(fallback);
6454
6453
  }
@@ -10556,7 +10555,7 @@ const accountHolderValidationRules = {
10556
10555
  }
10557
10556
  };
10558
10557
  const accountHolderFields = ["accountHolder"];
10559
- const logger$r = createLogger("AccountHolder");
10558
+ const logger$s = createLogger("AccountHolder");
10560
10559
  function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntityTypeAllowed, isTrustFlowEnabled, isSoleProprietorshipAllowed, isChangeToMyNameAllowed) {
10561
10560
  switch (legalEntityType) {
10562
10561
  case LegalEntityType.ORGANIZATION: {
@@ -10566,7 +10565,7 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
10566
10565
  return [...isChangeToMyNameAllowed ? ["myName"] : [], ...isChangeOfLegalEntityTypeAllowed ? ["theCompanyIWorkFor"] : [], ...isTrustFlowEnabled ? ["aTrust"] : [], ...isSoleProprietorshipAllowed ? ["mySoleProprietorName"] : []];
10567
10566
  }
10568
10567
  default:
10569
- logger$r.error(`No available account holder options for legal entity type '${legalEntityType}'`);
10568
+ logger$s.error(`No available account holder options for legal entity type '${legalEntityType}'`);
10570
10569
  return [];
10571
10570
  }
10572
10571
  }
@@ -11309,7 +11308,7 @@ function Dropzone(props) {
11309
11308
  })]
11310
11309
  });
11311
11310
  }
11312
- const logger$q = createLogger("TextArea");
11311
+ const logger$r = createLogger("TextArea");
11313
11312
  function TextArea(props) {
11314
11313
  const {
11315
11314
  classNameModifiers,
@@ -11330,7 +11329,7 @@ function TextArea(props) {
11330
11329
  } = useI18nContext();
11331
11330
  const [value, setValue] = useState("");
11332
11331
  if (Object.prototype.hasOwnProperty.call(props, "onChange")) {
11333
- logger$q.error("Error: Form fields that rely on InputBase may not have an onChange property");
11332
+ logger$r.error("Error: Form fields that rely on InputBase may not have an onChange property");
11334
11333
  }
11335
11334
  const handleInput = (e) => {
11336
11335
  var _a;
@@ -11743,7 +11742,7 @@ function FieldContainer(props) {
11743
11742
  }
11744
11743
  return renderField(fieldName);
11745
11744
  }
11746
- const logger$p = createLogger("SearchAddress");
11745
+ const logger$q = createLogger("SearchAddress");
11747
11746
  const SearchAddress = ({
11748
11747
  data,
11749
11748
  legalEntityId,
@@ -11786,7 +11785,7 @@ const SearchAddress = ({
11786
11785
  const response = await handleFindAddress(selectedAddressId);
11787
11786
  autocompleteAddressForm(response);
11788
11787
  } catch (e) {
11789
- logger$p.error(e);
11788
+ logger$q.error(e);
11790
11789
  }
11791
11790
  };
11792
11791
  const onDrilldown = async (selectedAddress) => {
@@ -11798,7 +11797,7 @@ const SearchAddress = ({
11798
11797
  }, legalEntityId);
11799
11798
  setItems((response == null ? void 0 : response.results) || []);
11800
11799
  } catch (e) {
11801
- logger$p.error(e);
11800
+ logger$q.error(e);
11802
11801
  }
11803
11802
  };
11804
11803
  const onChange = (e) => {
@@ -11853,7 +11852,7 @@ const SearchAddress = ({
11853
11852
  setItems([]);
11854
11853
  }
11855
11854
  } catch (e) {
11856
- logger$p.error(e);
11855
+ logger$q.error(e);
11857
11856
  }
11858
11857
  setLoading(false);
11859
11858
  }
@@ -14889,7 +14888,7 @@ const initOnfido = async ({
14889
14888
  language: getOnfidoLocaleConfig(i18n)
14890
14889
  });
14891
14890
  };
14892
- const logger$o = createLogger("IdVerificationComponent");
14891
+ const logger$p = createLogger("IdVerificationComponent");
14893
14892
  function IdVerificationComponent({
14894
14893
  userDetails,
14895
14894
  legalEntityId,
@@ -14922,7 +14921,7 @@ function IdVerificationComponent({
14922
14921
  onIdVerificationError,
14923
14922
  onIdVerificationComplete
14924
14923
  });
14925
- })().catch(logger$o.error);
14924
+ })().catch(logger$p.error);
14926
14925
  return () => {
14927
14926
  if (onfidoSdk.current)
14928
14927
  onfidoSdk.current.tearDown();
@@ -14974,7 +14973,7 @@ function IdDocumentAlreadyUpload(props) {
14974
14973
  })]
14975
14974
  });
14976
14975
  }
14977
- const logger$n = createLogger("IdDocumentInstantVerificationComponent");
14976
+ const logger$o = createLogger("IdDocumentInstantVerificationComponent");
14978
14977
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
14979
14978
  const documentTypeValidationRules = {
14980
14979
  instantIdVerificationData: {
@@ -15056,7 +15055,7 @@ function IdDocumentInstantVerificationComponent(props) {
15056
15055
  userDetails: props.userDetails,
15057
15056
  legalEntityId: props.legalEntityId,
15058
15057
  onIdVerificationComplete: handleIdVerificationComplete,
15059
- onIdVerificationError: logger$n.error
15058
+ onIdVerificationError: logger$o.error
15060
15059
  }), jsxs("div", {
15061
15060
  className: "adyen-kyc-document-upload__manual-upload",
15062
15061
  children: [i18n.get("canNotCompleteInstantVerification"), " ", jsx("button", {
@@ -18523,7 +18522,7 @@ class AdyenKycSdkError extends Error {
18523
18522
  }
18524
18523
  let sdkToken;
18525
18524
  let fetchSdkToken;
18526
- const logger$m = createLogger("Session");
18525
+ const logger$n = createLogger("Session");
18527
18526
  const setSdkToken = (token) => {
18528
18527
  sdkToken = token;
18529
18528
  };
@@ -18546,7 +18545,7 @@ const refreshSession = async () => {
18546
18545
  setSdkToken(token);
18547
18546
  isSessionRefreshed = true;
18548
18547
  } catch (e) {
18549
- logger$m.error("Failed to fetch sdk token", e);
18548
+ logger$n.error("Failed to fetch sdk token", e);
18550
18549
  }
18551
18550
  return isSessionRefreshed;
18552
18551
  };
@@ -18556,7 +18555,7 @@ const addAnimationStartListener = (element, listener) => {
18556
18555
  const removeAnimationStartListener = (element, listener) => {
18557
18556
  element.removeEventListener("animationstart", listener, false);
18558
18557
  };
18559
- const logger$l = createLogger("Fetch");
18558
+ const logger$m = createLogger("Fetch");
18560
18559
  const getRequestObject = (options, data) => {
18561
18560
  const {
18562
18561
  headers = [],
@@ -18603,10 +18602,10 @@ const logFetchError = (message, level) => {
18603
18602
  case "info":
18604
18603
  case "warn":
18605
18604
  case "error":
18606
- logger$l[level](message);
18605
+ logger$m[level](message);
18607
18606
  break;
18608
18607
  default:
18609
- logger$l.error(message);
18608
+ logger$m.error(message);
18610
18609
  }
18611
18610
  };
18612
18611
  const handleFetchResponse = async (response, responseType) => {
@@ -18706,7 +18705,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
18706
18705
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
18707
18706
  const MOUNT_TIMEOUT = 10 * 1e3;
18708
18707
  const TINK_VENDOR = "Tink";
18709
- const logger$k = createLogger("iframeWidget");
18708
+ const logger$l = createLogger("iframeWidget");
18710
18709
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
18711
18710
  const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
18712
18711
  const parseMessageJson = (message) => {
@@ -18725,7 +18724,7 @@ const callbackErrorHandler = async (response) => {
18725
18724
  try {
18726
18725
  await response;
18727
18726
  } catch (ex) {
18728
- logger$k.error(ex);
18727
+ logger$l.error(ex);
18729
18728
  }
18730
18729
  return {
18731
18730
  error: "UNKNOWN_ERROR",
@@ -18834,7 +18833,7 @@ class IFrameWidget {
18834
18833
  message = responseData.errorMessage;
18835
18834
  }
18836
18835
  } catch (ex) {
18837
- logger$k.error(ex);
18836
+ logger$l.error(ex);
18838
18837
  }
18839
18838
  throw new AdyenKycSdkError(reason, jsonData.error);
18840
18839
  }
@@ -19022,7 +19021,7 @@ function BankVerificationWidget({
19022
19021
  ref: widgetContainerRef
19023
19022
  });
19024
19023
  }
19025
- const logger$j = createLogger("BankVerification");
19024
+ const logger$k = createLogger("BankVerification");
19026
19025
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
19027
19026
  const InstantVerificationErrorContext = createContext(null);
19028
19027
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -19056,7 +19055,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
19056
19055
  const vendor = vendors[0];
19057
19056
  setPreferredVendor(vendor.name ? vendor : void 0);
19058
19057
  };
19059
- getPreferredVendor().catch(logger$j.error);
19058
+ getPreferredVendor().catch(logger$k.error);
19060
19059
  }, [country2, getBankVerificationVendors]);
19061
19060
  return preferredVendor;
19062
19061
  };
@@ -20330,7 +20329,7 @@ const makePayoutVerificationMethodsMetadata = (svgPath, instantVerificationProvi
20330
20329
  }
20331
20330
  });
20332
20331
  const payoutVerificationMethods = ["instantVerification", "manualVerification"];
20333
- const logger$i = createLogger("useLocalStorage");
20332
+ const logger$j = createLogger("useLocalStorage");
20334
20333
  const useLocalStorage = (key, defaultValue, options) => {
20335
20334
  const {
20336
20335
  serializer,
@@ -20351,7 +20350,7 @@ const useLocalStorage = (key, defaultValue, options) => {
20351
20350
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
20352
20351
  return res;
20353
20352
  } catch (err) {
20354
- logger$i.error(err);
20353
+ logger$j.error(err);
20355
20354
  return defaultValue;
20356
20355
  }
20357
20356
  });
@@ -20383,7 +20382,7 @@ const useLocalStorage = (key, defaultValue, options) => {
20383
20382
  try {
20384
20383
  updateLocalStorage();
20385
20384
  } catch (err) {
20386
- logger$i.error(err);
20385
+ logger$j.error(err);
20387
20386
  }
20388
20387
  }, [value]);
20389
20388
  useEffect(() => {
@@ -20398,7 +20397,7 @@ const useLocalStorage = (key, defaultValue, options) => {
20398
20397
  setValue(event.newValue ? parser(event.newValue) : void 0);
20399
20398
  }
20400
20399
  } catch (err) {
20401
- logger$i.error(err);
20400
+ logger$j.error(err);
20402
20401
  }
20403
20402
  };
20404
20403
  if (typeof window === "undefined")
@@ -21377,30 +21376,10 @@ const hasMinRequiredDecisionMakerCount = (rootLegalEntity) => {
21377
21376
  return roleTypes.some((role2) => min ? (existingDecisionMakerCount == null ? void 0 : existingDecisionMakerCount[role2]) ?? min <= 0 : true);
21378
21377
  });
21379
21378
  };
21380
- const TRUST_MEMBER_COUNT_RANGE = {
21381
- [TrustMemberTypes.DEFINED_BENEFICIARY]: {
21382
- min: 1
21383
- },
21384
- [TrustMemberTypes.SETTLOR]: {
21385
- min: 1
21386
- }
21387
- };
21388
21379
  const isPartOfTrustFromLegalEntity = (legalEntity) => {
21389
21380
  var _a;
21390
21381
  return (_a = legalEntity == null ? void 0 : legalEntity.entityAssociations) == null ? void 0 : _a.some((ea) => ea.entityType === LegalEntityType.TRUST && ea.associatorId === legalEntity.id);
21391
21382
  };
21392
- const getTrustLegalEntityId = (rootLegalEntity) => {
21393
- var _a;
21394
- if (!rootLegalEntity.entityAssociations)
21395
- return void 0;
21396
- return (_a = rootLegalEntity.entityAssociations.find((entityAssociation) => entityAssociation.type === LegalEntityType.TRUST)) == null ? void 0 : _a.legalEntityId;
21397
- };
21398
- const getOwnTrustMembers = (rootLegalEntity) => {
21399
- const trustLegalEntityId = getTrustLegalEntityId(rootLegalEntity);
21400
- if (!trustLegalEntityId || !rootLegalEntity.entityAssociations)
21401
- return [];
21402
- return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(TrustMemberTypes).includes(entityAssociation.type) && trustLegalEntityId === entityAssociation.associatorId);
21403
- };
21404
21383
  const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
21405
21384
  const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
21406
21385
  if (!trustLegalEntityId)
@@ -21428,17 +21407,23 @@ const getOwnTrustProblems = (legalEntity, capabilityProblems) => {
21428
21407
  return (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[trustLegalEntityId];
21429
21408
  }
21430
21409
  };
21431
- const getTrustMemberCount = (rootLegalEntity) => {
21432
- const trustMembers2 = getOwnTrustMembers(rootLegalEntity);
21433
- return trustMembers2.reduce((trustMemberCount, trustMember) => {
21434
- trustMemberCount[trustMember.type] = (trustMemberCount[trustMember.type] ?? 0) + 1;
21435
- return trustMemberCount;
21436
- }, {});
21437
- };
21438
- const hasMinRequiredTrustMemberCount = (rootLegalEntity) => {
21439
- const existingTrustMemberCount = getTrustMemberCount(rootLegalEntity);
21440
- const countRangeEntries = Object.entries(TRUST_MEMBER_COUNT_RANGE);
21441
- return countRangeEntries.every(([trustMemberType, requiredRange]) => requiredRange.min ? (existingTrustMemberCount == null ? void 0 : existingTrustMemberCount[trustMemberType]) ?? requiredRange.min <= 0 : true);
21410
+ const hasRequiredTrustMemberCount = (trustMembers2) => {
21411
+ if (!trustMembers2.length) {
21412
+ return false;
21413
+ }
21414
+ return DEFAULT_TRUST_MEMBER_REQUIREMENTS.every(({
21415
+ roleTypes,
21416
+ min
21417
+ }) => {
21418
+ var _a;
21419
+ if (min === 0) {
21420
+ return true;
21421
+ }
21422
+ const actualCount = ((_a = trustMembers2.filter(({
21423
+ roles
21424
+ }) => roleTypes.some((label) => roles.includes(label)))) == null ? void 0 : _a.length) ?? 0;
21425
+ return actualCount >= min;
21426
+ });
21442
21427
  };
21443
21428
  const getCountrySpecificTrustTypeOptions = (country2) => {
21444
21429
  const countrySpecificTrustTypes = countryToTrustTypes[country2];
@@ -22762,7 +22747,7 @@ const defaultPayoutAccountFormat = {
22762
22747
  [CountryCodes.Sweden]: "local",
22763
22748
  [CountryCodes.UnitedKingdom]: "local"
22764
22749
  };
22765
- const logger$h = createLogger("useScenarioConfiguration");
22750
+ const logger$i = createLogger("useScenarioConfiguration");
22766
22751
  const useScenarioConfiguration = ({
22767
22752
  getConfigurationData,
22768
22753
  getPayoutAccountFormatData,
@@ -22785,12 +22770,12 @@ const useScenarioConfiguration = ({
22785
22770
  const response = await getConfigurationData();
22786
22771
  setConfigurationResponse(response);
22787
22772
  } catch (err) {
22788
- logger$h.warn("WARNING: Configuration request failed - error:", err);
22773
+ logger$i.warn("WARNING: Configuration request failed - error:", err);
22789
22774
  } finally {
22790
22775
  setLoadingStatus("success");
22791
22776
  }
22792
22777
  };
22793
- makeConfigCallAndSave().catch(logger$h.error);
22778
+ makeConfigCallAndSave().catch(logger$i.error);
22794
22779
  }, [getConfigurationData, setLoadingStatus]);
22795
22780
  useEffect(() => {
22796
22781
  setLoadingStatus("loading");
@@ -22809,12 +22794,12 @@ const useScenarioConfiguration = ({
22809
22794
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
22810
22795
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
22811
22796
  } catch (err) {
22812
- logger$h.warn("WARNING: Payout format request failed - error:", err);
22797
+ logger$i.warn("WARNING: Payout format request failed - error:", err);
22813
22798
  } finally {
22814
22799
  setLoadingStatus("success");
22815
22800
  }
22816
22801
  };
22817
- makePayoutFormatCallAndSave().catch(logger$h.error);
22802
+ makePayoutFormatCallAndSave().catch(logger$i.error);
22818
22803
  }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
22819
22804
  const {
22820
22805
  fieldConfigurations,
@@ -23556,7 +23541,7 @@ var ToastType = /* @__PURE__ */ ((ToastType2) => {
23556
23541
  ToastType2["ERROR"] = "error";
23557
23542
  return ToastType2;
23558
23543
  })(ToastType || {});
23559
- const logger$g = createLogger("FormRouterContextProvider");
23544
+ const logger$h = createLogger("FormRouterContextProvider");
23560
23545
  function FormRouterContextProvider({
23561
23546
  children,
23562
23547
  forms: forms2,
@@ -23576,7 +23561,7 @@ function FormRouterContextProvider({
23576
23561
  if (formIndex > -1) {
23577
23562
  setFormIndex(formIndex);
23578
23563
  } else {
23579
- logger$g.error("No form was found to have that field so form navigation failed.");
23564
+ logger$h.error("No form was found to have that field so form navigation failed.");
23580
23565
  }
23581
23566
  }
23582
23567
  }), [forms2, handleGetIdVerificationToken, setFormIndex]);
@@ -24189,7 +24174,7 @@ var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
24189
24174
  CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
24190
24175
  return CompanySearchEvents2;
24191
24176
  })(CompanySearchEvents || {});
24192
- const logger$f = createLogger("useCompanySearch");
24177
+ const logger$g = createLogger("useCompanySearch");
24193
24178
  const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
24194
24179
  function useCompanySearch({
24195
24180
  defaultData,
@@ -24317,7 +24302,7 @@ function useCompanySearch({
24317
24302
  state: companyData.state ?? stateOrProvince2
24318
24303
  });
24319
24304
  } catch (e) {
24320
- logger$f.error(e);
24305
+ logger$g.error(e);
24321
24306
  setError(e);
24322
24307
  setStatus("error");
24323
24308
  } finally {
@@ -24350,7 +24335,7 @@ function useCompanySearch({
24350
24335
  indexSearch: handleCompanyIndexSearch,
24351
24336
  deepSearch: handleCompanyDeepSearch,
24352
24337
  resultsLimit: limit
24353
- })) == null ? void 0 : _a.catch((e) => logger$f.error(e));
24338
+ })) == null ? void 0 : _a.catch((e) => logger$g.error(e));
24354
24339
  }
24355
24340
  }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
24356
24341
  useEffect(() => {
@@ -26127,7 +26112,7 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26127
26112
  }
26128
26113
  }, {});
26129
26114
  };
26130
- const logger$e = createLogger("useFormTaskSubmit");
26115
+ const logger$f = createLogger("useFormTaskSubmit");
26131
26116
  function useCompanySearchTaskSubmit({
26132
26117
  task,
26133
26118
  forms: forms2,
@@ -26173,7 +26158,7 @@ function useCompanySearchTaskSubmit({
26173
26158
  });
26174
26159
  }
26175
26160
  } catch (e) {
26176
- logger$e.error(e);
26161
+ logger$f.error(e);
26177
26162
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
26178
26163
  segmentation: {
26179
26164
  ...baseTrackingPayload,
@@ -26225,7 +26210,7 @@ function useCompanySearchTaskSubmit({
26225
26210
  ...trackingPayload
26226
26211
  }
26227
26212
  });
26228
- logger$e.log(submittedLegalEntity);
26213
+ logger$f.log(submittedLegalEntity);
26229
26214
  setAccountHolder(entityTypeToCorrespondingAccountHolderOption[legalEntityResponse.type]);
26230
26215
  clearToasts();
26231
26216
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
@@ -26250,7 +26235,7 @@ function useCompanySearchTaskSubmit({
26250
26235
  type: ToastType.ERROR
26251
26236
  });
26252
26237
  }
26253
- logger$e.error(e);
26238
+ logger$f.error(e);
26254
26239
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
26255
26240
  segmentation: {
26256
26241
  ...baseTrackingPayload,
@@ -26683,7 +26668,7 @@ const useShouldShowIntroduction = ({
26683
26668
  });
26684
26669
  return canSeeIntroduction && !hasSeenIntroduction;
26685
26670
  };
26686
- const logger$d = createLogger("useAssociatedLegalArrangement");
26671
+ const logger$e = createLogger("useAssociatedLegalArrangement");
26687
26672
  function useAssociatedLegalArrangement({
26688
26673
  rootLegalEntity,
26689
26674
  getLegalEntity: getLegalEntity2
@@ -26694,14 +26679,14 @@ function useAssociatedLegalArrangement({
26694
26679
  var _a;
26695
26680
  const foundEntity = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a.find((entity) => entity.type === LegalEntityType.SOLE_PROPRIETORSHIP || entity.type === LegalEntityType.TRUST);
26696
26681
  if (foundEntity == null ? void 0 : foundEntity.legalEntityId) {
26697
- getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$d.error);
26682
+ getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$e.error);
26698
26683
  }
26699
26684
  }, [getAssociatedEntity, rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations]);
26700
26685
  return {
26701
26686
  associatedLegalArrangement
26702
26687
  };
26703
26688
  }
26704
- const logger$c = createLogger("useExemptSettlor");
26689
+ const logger$d = createLogger("useExemptSettlor");
26705
26690
  const useExemptSettlor = ({
26706
26691
  trust: trust2,
26707
26692
  handleGetLegalEntity
@@ -26715,7 +26700,7 @@ const useExemptSettlor = ({
26715
26700
  useEffect(() => {
26716
26701
  if (!trust2)
26717
26702
  return;
26718
- updateExemptSettlor(trust2).catch(logger$c.error);
26703
+ updateExemptSettlor(trust2).catch(logger$d.error);
26719
26704
  }, [trust2, updateExemptSettlor]);
26720
26705
  return exemptSettlor;
26721
26706
  };
@@ -26745,6 +26730,26 @@ function useSalesChannelsSettings() {
26745
26730
  return settings;
26746
26731
  }, [isSettingEnabled]);
26747
26732
  }
26733
+ const logger$c = createLogger("useTrust");
26734
+ const useTrust = ({
26735
+ rootLegalEntity,
26736
+ handleGetLegalEntity
26737
+ }) => {
26738
+ const [trust2, setTrust] = useState();
26739
+ const refreshTrust = useCallback(async () => {
26740
+ var _a, _b;
26741
+ const trustId = (_b = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b.legalEntityId;
26742
+ const trustLE = trustId ? await handleGetLegalEntity(trustId) : void 0;
26743
+ setTrust(trustLE);
26744
+ return trustLE;
26745
+ }, [handleGetLegalEntity]);
26746
+ useEffect(() => {
26747
+ if (hasOwnEntityAssociationOfType(LegalEntityType.TRUST, rootLegalEntity.entityAssociations, rootLegalEntity.id)) {
26748
+ refreshTrust().catch(logger$c.error);
26749
+ }
26750
+ }, [refreshTrust]);
26751
+ return [trust2, refreshTrust];
26752
+ };
26748
26753
  const downloadFile = async (base64, filename) => {
26749
26754
  saveBlobAsFile(base64ToBlob(base64), filename);
26750
26755
  };
@@ -26844,7 +26849,7 @@ const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations,
26844
26849
  };
26845
26850
  const mapRootLegalEntityToTrustMember = (rootLegalEntity) => ({
26846
26851
  trustMemberType: "rootTrustee",
26847
- roles: [],
26852
+ roles: [TrustMemberTypes.TRUSTEE],
26848
26853
  legalEntityType: rootLegalEntity.type,
26849
26854
  legalEntityId: rootLegalEntity.id,
26850
26855
  name: getLegalEntityNameBasedOnType(rootLegalEntity)
@@ -28798,6 +28803,7 @@ function TaskListComponent({
28798
28803
  pciStatus,
28799
28804
  serviceAgreementTypes,
28800
28805
  serviceAgreementAcceptanceInfos,
28806
+ hasRequiredTrustMemberCount: hasRequiredTrustMemberCount2,
28801
28807
  onTransferInstrumentDelete
28802
28808
  }) {
28803
28809
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
@@ -28947,7 +28953,7 @@ function TaskListComponent({
28947
28953
  onNavigateToTask: handleOnNavigateToTaskTrustMember,
28948
28954
  icon: "decision-maker",
28949
28955
  title: i18n.get("trustMembers"),
28950
- status: hasMinRequiredTrustMemberCount(legalEntityResponse) ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
28956
+ status: hasRequiredTrustMemberCount2 ? getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntityResponse, getOwnTrustMembersLegalEntityIds(legalEntityResponse)) : TaskStatus.DETAILS_REQUIRED
28951
28957
  })]
28952
28958
  }), (tasks.includes(TaskTypes.PAYOUT) || tasks.includes(TaskTypes.PAYIN)) && jsx(TaskListGroup, {
28953
28959
  title: isEnableNewEntryFlowEnabled ? i18n.get("letUsKnowTheBankAccountToSendReceiveFunds") : i18n.get(hasPayinTaskNotPayout ? "payinAccountsDescription" : payoutTaskDescriptionKey),
@@ -32109,7 +32115,7 @@ function TrustDropinComponent({
32109
32115
  ...derivedProps,
32110
32116
  activeForm,
32111
32117
  capabilities,
32112
- data,
32118
+ data: dataFromResponse,
32113
32119
  country: ((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.country) ?? country2,
32114
32120
  problems,
32115
32121
  handleAddressSearch,
@@ -32184,7 +32190,10 @@ function DropinComposerComponent({
32184
32190
  const [associatedLegalEntityParent, setAssociatedLegalEntityParent] = useState(null);
32185
32191
  const [legalEntityType, setLegalEntityType] = useState(null);
32186
32192
  const [solePropietor, setSolePropietor] = useState(null);
32187
- const [trust2, setTrust] = useState(null);
32193
+ const [trust2, refreshTrust] = useTrust({
32194
+ rootLegalEntity,
32195
+ handleGetLegalEntity: args.handleGetLegalEntity
32196
+ });
32188
32197
  const exemptSettlor = useExemptSettlor({
32189
32198
  trust: trust2,
32190
32199
  handleGetLegalEntity: args.handleGetLegalEntity
@@ -32203,6 +32212,7 @@ function DropinComposerComponent({
32203
32212
  const additionalSalesChannels = useSalesChannelsSettings();
32204
32213
  const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
32205
32214
  const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
32215
+ const trustMembers2 = trust2 ? allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, rootLegalEntity, exemptSettlor) : getTrustMembers(trust2, rootLegalEntity, exemptSettlor) : [];
32206
32216
  const getLegalEntityProblems = (le) => {
32207
32217
  var _a2;
32208
32218
  if (le == null ? void 0 : le.id) {
@@ -32312,18 +32322,6 @@ function DropinComposerComponent({
32312
32322
  }
32313
32323
  return void 0;
32314
32324
  }, [i18n, rootLegalEntity.id]);
32315
- const refreshTrust = async () => {
32316
- if (trust2.id && (args == null ? void 0 : args.handleGetLegalEntity)) {
32317
- try {
32318
- const response = await (args == null ? void 0 : args.handleGetLegalEntity(trust2.id));
32319
- setTrust(response);
32320
- return response;
32321
- } catch (e) {
32322
- logger$a.warn(i18n.get("failedToFetchTrustDetails"));
32323
- }
32324
- }
32325
- return void 0;
32326
- };
32327
32325
  const deleteTransferInstrument2 = async (id2) => {
32328
32326
  if (id2 && (args == null ? void 0 : args.handleDeleteTransferInstrument)) {
32329
32327
  try {
@@ -32515,21 +32513,18 @@ function DropinComposerComponent({
32515
32513
  }
32516
32514
  };
32517
32515
  const onNavigateToTrust = async (task = TaskTypes.TRUST) => {
32518
- var _a2, _b2;
32519
- const trustId = (_b2 = (_a2 = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a2.find((association2) => association2.type === LegalEntityType.TRUST)) == null ? void 0 : _b2.legalEntityId;
32520
- if (trustId) {
32521
- try {
32522
- const currentTrust = await (args == null ? void 0 : args.handleGetLegalEntity(trustId));
32523
- setTrust(currentTrust);
32516
+ try {
32517
+ const trust22 = await refreshTrust();
32518
+ if (trust22) {
32524
32519
  onNavigateTo(task);
32525
- } catch (e) {
32526
- showToast({
32527
- label: i18n.get("failedToFetchTrustDetails"),
32528
- type: ToastType.ERROR
32529
- });
32520
+ } else {
32521
+ onNavigateTo(TaskTypes.TRUST);
32530
32522
  }
32531
- } else {
32532
- onNavigateTo(TaskTypes.TRUST);
32523
+ } catch (e) {
32524
+ showToast({
32525
+ label: i18n.get("failedToFetchTrustDetails"),
32526
+ type: ToastType.ERROR
32527
+ });
32533
32528
  }
32534
32529
  };
32535
32530
  const onNavigateToTrustMember = async (tm) => {
@@ -32753,6 +32748,7 @@ function DropinComposerComponent({
32753
32748
  serviceAgreementTypes,
32754
32749
  serviceAgreementAcceptanceInfos,
32755
32750
  isReview: reviewRequired,
32751
+ hasRequiredTrustMemberCount: hasRequiredTrustMemberCount(trustMembers2),
32756
32752
  onTransferInstrumentDelete: deleteTransferInstrument2
32757
32753
  });
32758
32754
  case TaskTypes.DECISION_MAKER_OVERVIEW:
@@ -33021,7 +33017,7 @@ function DropinComposerComponent({
33021
33017
  });
33022
33018
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
33023
33019
  return jsx(TrustMembersOverview, {
33024
- trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, rootLegalEntity, exemptSettlor) : getTrustMembers(trust2, rootLegalEntity, exemptSettlor),
33020
+ trustMembers: trustMembers2,
33025
33021
  getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, rootLegalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId, ...getDirectEntityAssociations(rootLegalEntity, member.legalEntityId).map((association2) => association2.legalEntityId)]),
33026
33022
  navigateBackToTaskList: navigateBack,
33027
33023
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
@@ -34712,15 +34708,6 @@ const I18nProvider = ({
34712
34708
  children
34713
34709
  });
34714
34710
  };
34715
- const ReactQueryClient = new QueryClient();
34716
- function ReactQueryProvider({
34717
- children
34718
- }) {
34719
- return jsx(QueryClientProvider, {
34720
- client: ReactQueryClient,
34721
- children
34722
- });
34723
- }
34724
34711
  const settingsDefaults = {
34725
34712
  acceptedCountries: void 0,
34726
34713
  allowBankAccountFormatSelection: false,
@@ -35073,11 +35060,9 @@ class UIElement extends BaseElement {
35073
35060
  children: jsx(AutoResizer, {
35074
35061
  children: jsx(ToastContextProvider, {
35075
35062
  children: jsx(StateProvider, {
35076
- children: jsx(ReactQueryProvider, {
35077
- children: jsx(Component, {
35078
- ...this.props.componentProps,
35079
- eventEmitter: this.eventEmitter
35080
- })
35063
+ children: jsx(Component, {
35064
+ ...this.props.componentProps,
35065
+ eventEmitter: this.eventEmitter
35081
35066
  })
35082
35067
  })
35083
35068
  })
@@ -1,4 +1,4 @@
1
1
  import '../TaskList.scss';
2
2
  import { TaskListComponentProps } from '../types';
3
- declare function TaskListComponent({ tasks, trackingConfig, onNavigateToTask, legalEntityResponse, capabilityProblems, onPciDownload, isReview, pciStatus, serviceAgreementTypes, serviceAgreementAcceptanceInfos, onTransferInstrumentDelete, }: TaskListComponentProps): import("preact").JSX.Element;
3
+ declare function TaskListComponent({ tasks, trackingConfig, onNavigateToTask, legalEntityResponse, capabilityProblems, onPciDownload, isReview, pciStatus, serviceAgreementTypes, serviceAgreementAcceptanceInfos, hasRequiredTrustMemberCount, onTransferInstrumentDelete, }: TaskListComponentProps): import("preact").JSX.Element;
4
4
  export default TaskListComponent;
@@ -66,6 +66,7 @@ export interface TaskListComponentProps {
66
66
  onPciDownload?(): void;
67
67
  country?: string;
68
68
  onTransferInstrumentDelete: (id: string) => void;
69
+ hasRequiredTrustMemberCount?: boolean;
69
70
  trackingConfig?: {
70
71
  topLevelLegalEntity: ExistingLegalEntity;
71
72
  };
@@ -0,0 +1,11 @@
1
+ import { DropinAPIHandlers } from '../../components/Dropins/types';
2
+ import { ExistingLegalEntity } from '../models/api/legal-entity';
3
+ interface UseTrustArgs {
4
+ rootLegalEntity: ExistingLegalEntity;
5
+ handleGetLegalEntity: NonNullable<DropinAPIHandlers['handleGetLegalEntity']>;
6
+ }
7
+ export declare const useTrust: ({ rootLegalEntity, handleGetLegalEntity, }: UseTrustArgs) => [
8
+ ExistingLegalEntity | undefined,
9
+ () => Promise<ExistingLegalEntity | undefined>
10
+ ];
11
+ export {};
@@ -1,3 +1,4 @@
1
+ import { TrustMember } from '../components/TrustMembers/types';
1
2
  import { TrustTypeOption } from '../components/TrustRegistrationDetails/types';
2
3
  import { ExistingLegalEntity, LegalEntity } from '../core/models/api/legal-entity';
3
4
  import { LegalEntityAssociation } from '../core/models/api/legal-entity-association';
@@ -9,5 +10,5 @@ export declare const getOwnTrustMembers: (rootLegalEntity: ExistingLegalEntity)
9
10
  export declare const getOwnTrustMembersLegalEntityIds: (rootLegalEntity: ExistingLegalEntity) => string[];
10
11
  export declare const getOwnTrustLegalEntityIdAsArray: (legalEntity: LegalEntity) => string[];
11
12
  export declare const getOwnTrustProblems: (legalEntity: LegalEntity, capabilityProblems: CapabilityProblems) => EntityProblems | undefined;
12
- export declare const hasMinRequiredTrustMemberCount: (rootLegalEntity: ExistingLegalEntity) => boolean;
13
+ export declare const hasRequiredTrustMemberCount: (trustMembers: TrustMember[]) => boolean;
13
14
  export declare const getCountrySpecificTrustTypeOptions: (country: CountryCode) => TrustTypeOption[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -70,7 +70,6 @@
70
70
  "dependencies": {
71
71
  "@adyen/adyen-document-viewer": "^1.1.0",
72
72
  "@adyen/openbankingsdk": "^0.1.2",
73
- "@tanstack/react-query": "^5.18.1",
74
73
  "classnames": "^2.3.2",
75
74
  "isomorphic-dompurify": "^0.13.0",
76
75
  "lodash": "^4.17.21",
@@ -88,7 +87,6 @@
88
87
  "@storybook/core-server": "^8.0.4",
89
88
  "@storybook/preact": "^8.0.4",
90
89
  "@storybook/preact-vite": "^8.0.4",
91
- "@tanstack/eslint-plugin-query": "^4.38.0",
92
90
  "@testing-library/jest-dom": "^5.17.0",
93
91
  "@testing-library/preact": "^3.2.3",
94
92
  "@testing-library/user-event": "^14.4.3",
@@ -136,10 +134,6 @@
136
134
  "vitest": "^1.3.1"
137
135
  },
138
136
  "overrides": {
139
- "@tanstack/react-query": {
140
- "react": "npm:@preact/compat@*",
141
- "react-dom": "npm:@preact/compat@*"
142
- },
143
137
  "msw": {
144
138
  "typescript": "^5"
145
139
  },
@@ -1,2 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- export declare const ReactQueryClient: QueryClient;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function ReactQueryProvider({ children }: {
3
- children: JSX.Element;
4
- }): import("preact").JSX.Element;