@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
106 lines (105 loc) • 6.56 kB
JavaScript
try {
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "dc41218a-f40e-45a8-ab0f-8cd92519cb51", e._sentryDebugIdIdentifier = "sentry-dbid-dc41218a-f40e-45a8-ab0f-8cd92519cb51");
} catch (e) {}
import { n as addResourceBundles, r as useTranslation } from "./translation-BFxyJ1c5.js";
import { r as Loader } from "./Button-oj6H8OrC.js";
import { r as useLegalEntity } from "./useLegalEntity-yxi9XhLi.js";
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { t as getLegalEntityCountry } from "./getLegalEntityCountry-C6bSV6sB.js";
import { s as noop } from "./useAnalyticsContext-BVFDMrVE.js";
import { t as useToggleContext } from "./useToggleContext-DaQUBF8O.js";
import { t as _rolldown_dynamic_import_helper_default } from "./_rolldown_dynamic_import_helper-rq_tsyLP.js";
import { C as EntityTypes, c as individualBaseMapping } from "./processCapabilities-DlZY9-Jc.js";
import { p as TaskTypes } from "./entityAssociationUtil-BEzUdPbm.js";
import { n as useCapabilityProblems, t as getProblemsForEntity } from "./getProblemsForEntity-BLcIg3x_.js";
import { n as getTrustedFields, r as getTrustedFieldsProvider, t as getTrustedEntityAssociations } from "./getTrustedFields-UVTLadau.js";
import { n as removeIdVerificationProblemsForBafinSignatory, t as isBafinSignatoryFlow } from "./bafinUtils-kBPs58Au.js";
import { t as useScenarios } from "./useScenarios-BxrbVsQp.js";
import { t as IndividualDropin } from "./IndividualDropin-B80xG2_y.js";
import { jsx } from "preact/jsx-runtime";
import { skipToken } from "@tanstack/preact-query";
import { useParams } from "wouter-preact";
//#region src/components/Individual/pages/DecisionMakerDetailsPage.tsx
function DecisionMakerDetailsPage({ decisionMakerId: decisionMakerIdProp, parentCompanyId: parentCompanyIdProp, taskType = TaskTypes.DECISION_MAKER, asModal, hideSidebar, isTargetLegalEntityType, onSubmit, handleBackClick, handleCloseClick, handleHomeClick = noop }) {
const routeParams = useParams();
const parentCompanyId = parentCompanyIdProp ?? routeParams.parentId;
const decisionMakerId = decisionMakerIdProp ?? routeParams.decisionMakerId;
const { data: decisionMakerLe } = useLegalEntity(decisionMakerId ?? skipToken);
const { data: parentCompanyLe } = useLegalEntity(parentCompanyId ?? skipToken);
const capabilityProblems = useCapabilityProblems();
const { isFeatureEnabled } = useToggleContext();
const { data: scenarios } = useScenarios((parentCompanyLe && getLegalEntityCountry(parentCompanyLe)) ?? skipToken, LegalEntityTypes.INDIVIDUAL);
const { i18n } = useTranslation();
addResourceBundles(i18n, [{
ns: "individual",
importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({
"../language/bg-BG.json": () => import("./bg-BG-BlOJQ7iZ.js"),
"../language/cs-CZ.json": () => import("./cs-CZ-CtEcakjz.js"),
"../language/da-DK.json": () => import("./da-DK-Cp1cdZTG.js"),
"../language/de-DE.json": () => import("./de-DE-ZWLyKP5G.js"),
"../language/el-GR.json": () => import("./el-GR-DSmTVw3A.js"),
"../language/en-US.instructions.json": () => import("./en-US.instructions-HI_HXwIA.js"),
"../language/en-US.json": () => import("./en-US-5p2iDJhN.js"),
"../language/es-ES.json": () => import("./es-ES-CKWpTQva.js"),
"../language/et-EE.json": () => import("./et-EE-BeU-JlIv.js"),
"../language/fi-FI.json": () => import("./fi-FI-DKJi4py_.js"),
"../language/fr-FR.json": () => import("./fr-FR-JIF28b7U.js"),
"../language/hr-HR.json": () => import("./hr-HR-C4LLZhRc.js"),
"../language/hu-HU.json": () => import("./hu-HU-1NJpWkUj.js"),
"../language/it-IT.json": () => import("./it-IT-C4b9Y6tP.js"),
"../language/ja-JP.json": () => import("./ja-JP-BFkGV7Ct.js"),
"../language/lt-LT.json": () => import("./lt-LT-Cq2T_YgH.js"),
"../language/lv-LV.json": () => import("./lv-LV-DcclJdry.js"),
"../language/nl-NL.json": () => import("./nl-NL-DWgJVfgU.js"),
"../language/no-NO.json": () => import("./no-NO-BCZzdSpR.js"),
"../language/pl-PL.json": () => import("./pl-PL-D3efS6b_.js"),
"../language/pt-BR.json": () => import("./pt-BR-OCQiqikl.js"),
"../language/pt-PT.json": () => import("./pt-PT-BHbd93Ic.js"),
"../language/ro-RO.json": () => import("./ro-RO-CVzi0I9_.js"),
"../language/sk-SK.json": () => import("./sk-SK-woMNza6o.js"),
"../language/sl-SI.json": () => import("./sl-SI-Czu6HrQs.js"),
"../language/sv-SE.json": () => import("./sv-SE-BIe7wyHM.js")
}), `../language/${lang}.json`, 3)
}]);
if (!parentCompanyLe || decisionMakerId && !decisionMakerLe) return /* @__PURE__ */ jsx(Loader, {});
const country = getLegalEntityCountry(decisionMakerLe ?? parentCompanyLe);
let problems = capabilityProblems && decisionMakerId ? getProblemsForEntity(capabilityProblems, EntityTypes.LEGAL_ENTITY, decisionMakerId) : void 0;
if (problems && parentCompanyLe && decisionMakerLe && scenarios) {
if ((parentCompanyLe.entityAssociations?.filter((association) => association.legalEntityId === decisionMakerLe.id))?.some((association) => isBafinSignatoryFlow({
taskType,
data: association,
scenarios
}))) problems = removeIdVerificationProblemsForBafinSignatory(problems, decisionMakerLe);
}
const trustedFieldsProvider = getTrustedFieldsProvider(parentCompanyLe);
const trustedFields = decisionMakerLe ? getTrustedFields(decisionMakerLe, individualBaseMapping) : {};
const trustedRoles = getTrustedEntityAssociations(parentCompanyLe).find((ea) => ea.reference === decisionMakerId)?.types ?? [];
const isRevampedDecisionMakersTaskPageEnabled = isFeatureEnabled("EnableRevampedDecisionMakersTaskPage");
return /* @__PURE__ */ jsx(IndividualDropin, {
taskType,
taskName: TASK_NAMES[taskType],
legalEntityResponse: decisionMakerLe,
parentLegalEntity: parentCompanyLe,
problems,
country,
asModal,
hideSidebar,
isTargetLegalEntityType,
onSubmit,
trustedFieldsProvider,
trustedRoles,
handleBackClick,
handleCloseClick,
handleHomeClick,
asModal: isRevampedDecisionMakersTaskPageEnabled,
trustedFields
});
}
var TASK_NAMES = {
[TaskTypes.DECISION_MAKER]: "decisionMakerDetails",
[TaskTypes.TRUST_MEMBER_COMPANY_OWNER]: "companyOwnerDetails",
[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY_OWNER]: "companyOwnerDetails"
};
//#endregion
export { DecisionMakerDetailsPage };