UNPKG

@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.

190 lines (189 loc) 10.7 kB
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] = "06e13b80-1238-4d43-84bc-c3705d11cebf", e._sentryDebugIdIdentifier = "sentry-dbid-06e13b80-1238-4d43-84bc-c3705d11cebf"); } catch (e) {} import { n as addResourceBundles, r as useTranslation } from "./translation-BFxyJ1c5.js"; import { a as stylesheets, n as EmbedShell, t as resolveEnvironment } from "./resolveEnvironment-DcaNthZ2.js"; import { r as Loader } from "./Button-oj6H8OrC.js"; import { r as useLegalEntity } from "./useLegalEntity-yxi9XhLi.js"; import { t as getLegalEntityCountry } from "./getLegalEntityCountry-C6bSV6sB.js"; import { t as _rolldown_dynamic_import_helper_default } from "./_rolldown_dynamic_import_helper-rq_tsyLP.js"; import { C as EntityTypes } 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 { t as IndividualDropin } from "./IndividualDropin-B80xG2_y.js"; import { t as emitAdyenSdkEvent } from "./emitEvent-Cdd95HOT.js"; import register from "preact-custom-element"; import { useRef } from "preact/hooks"; import { jsx } from "preact/jsx-runtime"; //#region src/components/EmbeddedDropins/CreateIndividualComponent/CreateIndividualComponent.tsx var CreateIndividualComponent = ({ legalEntityId, onSubmitSuccess, modalView = false, onClose, onUnmount }) => { if (!legalEntityId) throw new Error("Must provide a legalEntityId"); const { data: individualLe } = useLegalEntity(legalEntityId); const capabilityProblems = useCapabilityProblems(); const { i18n } = useTranslation(); addResourceBundles(i18n, [ { ns: "common", importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({ "../../../language/locales/bg-BG.json": () => import("./bg-BG-COHRuTI-.js"), "../../../language/locales/cs-CZ.json": () => import("./cs-CZ-CmcYZLZp.js"), "../../../language/locales/da-DK.json": () => import("./da-DK-C_oe1bpM.js"), "../../../language/locales/de-DE.json": () => import("./de-DE-CMc1Fpfl.js"), "../../../language/locales/el-GR.json": () => import("./el-GR-Bv2QgmVV.js"), "../../../language/locales/en-US.instructions.json": () => import("./en-US.instructions-DJharl6b.js"), "../../../language/locales/en-US.json": () => import("./en-US-cJAmQhFR.js").then((n) => n.n), "../../../language/locales/es-ES.json": () => import("./es-ES-DtlXpZ_5.js"), "../../../language/locales/et-EE.json": () => import("./et-EE-PTcJ2hRW.js"), "../../../language/locales/fi-FI.json": () => import("./fi-FI-C1Ns3CEo.js"), "../../../language/locales/fr-FR.json": () => import("./fr-FR-DgPRYmmJ.js"), "../../../language/locales/hr-HR.json": () => import("./hr-HR-BQfjrcPC.js"), "../../../language/locales/hu-HU.json": () => import("./hu-HU-DfYPelYo.js"), "../../../language/locales/it-IT.json": () => import("./it-IT-cnETv3Cg.js"), "../../../language/locales/ja-JP.json": () => import("./ja-JP-D0gz56Ni.js"), "../../../language/locales/lt-LT.json": () => import("./lt-LT-Bbh9MWxc.js"), "../../../language/locales/lv-LV.json": () => import("./lv-LV-C8fqHR2g.js"), "../../../language/locales/nl-NL.json": () => import("./nl-NL-CQSu4iNn.js"), "../../../language/locales/no-NO.json": () => import("./no-NO-C0DXekH-.js"), "../../../language/locales/pl-PL.json": () => import("./pl-PL-10KUcobm.js"), "../../../language/locales/pt-BR.json": () => import("./pt-BR-DWKF33yP.js"), "../../../language/locales/pt-PT.json": () => import("./pt-PT-CjIFIi4R.js"), "../../../language/locales/ro-RO.json": () => import("./ro-RO-DQFRJwp8.js"), "../../../language/locales/sk-SK.json": () => import("./sk-SK-BfoXFhAL.js"), "../../../language/locales/sl-SI.json": () => import("./sl-SI-CyIN1sc5.js"), "../../../language/locales/sv-SE.json": () => import("./sv-SE-Xh17T6yC.js") }), `../../../language/locales/${lang}.json`, 6) }, { ns: "ui", importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({ "../../ui/language/bg-BG.json": () => import("./bg-BG-BUBUyZgz.js"), "../../ui/language/cs-CZ.json": () => import("./cs-CZ-BFJyFYpX.js"), "../../ui/language/da-DK.json": () => import("./da-DK-BNvIcL59.js"), "../../ui/language/de-DE.json": () => import("./de-DE-B8Eby_UK.js"), "../../ui/language/el-GR.json": () => import("./el-GR-DYmDnzZe.js"), "../../ui/language/en-US.json": () => import("./en-US-Mma5wIWL.js"), "../../ui/language/es-ES.json": () => import("./es-ES-DLBRDQJZ.js"), "../../ui/language/et-EE.json": () => import("./et-EE-C_Z4PWda.js"), "../../ui/language/fi-FI.json": () => import("./fi-FI-azwPyx-k.js"), "../../ui/language/fr-FR.json": () => import("./fr-FR-CzdHSH04.js"), "../../ui/language/hr-HR.json": () => import("./hr-HR-C7Hp8OgD.js"), "../../ui/language/hu-HU.json": () => import("./hu-HU-B34uBEZ9.js"), "../../ui/language/it-IT.json": () => import("./it-IT-BCqVu72_.js"), "../../ui/language/ja-JP.json": () => import("./ja-JP-C7_6K98B.js"), "../../ui/language/lt-LT.json": () => import("./lt-LT-BhzsTniu.js"), "../../ui/language/lv-LV.json": () => import("./lv-LV-B6yxwa6Z.js"), "../../ui/language/nl-NL.json": () => import("./nl-NL-4iZ44kzK.js"), "../../ui/language/no-NO.json": () => import("./no-NO-BSJ1rjY4.js"), "../../ui/language/pl-PL.json": () => import("./pl-PL-BHjlKdWC.js"), "../../ui/language/pt-BR.json": () => import("./pt-BR-BMIZHo3V.js"), "../../ui/language/pt-PT.json": () => import("./pt-PT-s_KcBKav.js"), "../../ui/language/ro-RO.json": () => import("./ro-RO-DsFmqo3p.js"), "../../ui/language/sk-SK.json": () => import("./sk-SK-BspZv60l.js"), "../../ui/language/sl-SI.json": () => import("./sl-SI-D26FDPwq.js"), "../../ui/language/sv-SE.json": () => import("./sv-SE-JKGeqd9J.js") }), `../../ui/language/${lang}.json`, 5) }, { ns: "individual", importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({ "../../Individual/language/bg-BG.json": () => import("./bg-BG-BlOJQ7iZ.js"), "../../Individual/language/cs-CZ.json": () => import("./cs-CZ-CtEcakjz.js"), "../../Individual/language/da-DK.json": () => import("./da-DK-Cp1cdZTG.js"), "../../Individual/language/de-DE.json": () => import("./de-DE-ZWLyKP5G.js"), "../../Individual/language/el-GR.json": () => import("./el-GR-DSmTVw3A.js"), "../../Individual/language/en-US.instructions.json": () => import("./en-US.instructions-HI_HXwIA.js"), "../../Individual/language/en-US.json": () => import("./en-US-5p2iDJhN.js"), "../../Individual/language/es-ES.json": () => import("./es-ES-CKWpTQva.js"), "../../Individual/language/et-EE.json": () => import("./et-EE-BeU-JlIv.js"), "../../Individual/language/fi-FI.json": () => import("./fi-FI-DKJi4py_.js"), "../../Individual/language/fr-FR.json": () => import("./fr-FR-JIF28b7U.js"), "../../Individual/language/hr-HR.json": () => import("./hr-HR-C4LLZhRc.js"), "../../Individual/language/hu-HU.json": () => import("./hu-HU-1NJpWkUj.js"), "../../Individual/language/it-IT.json": () => import("./it-IT-C4b9Y6tP.js"), "../../Individual/language/ja-JP.json": () => import("./ja-JP-BFkGV7Ct.js"), "../../Individual/language/lt-LT.json": () => import("./lt-LT-Cq2T_YgH.js"), "../../Individual/language/lv-LV.json": () => import("./lv-LV-DcclJdry.js"), "../../Individual/language/nl-NL.json": () => import("./nl-NL-DWgJVfgU.js"), "../../Individual/language/no-NO.json": () => import("./no-NO-BCZzdSpR.js"), "../../Individual/language/pl-PL.json": () => import("./pl-PL-D3efS6b_.js"), "../../Individual/language/pt-BR.json": () => import("./pt-BR-OCQiqikl.js"), "../../Individual/language/pt-PT.json": () => import("./pt-PT-BHbd93Ic.js"), "../../Individual/language/ro-RO.json": () => import("./ro-RO-CVzi0I9_.js"), "../../Individual/language/sk-SK.json": () => import("./sk-SK-woMNza6o.js"), "../../Individual/language/sl-SI.json": () => import("./sl-SI-Czu6HrQs.js"), "../../Individual/language/sv-SE.json": () => import("./sv-SE-BIe7wyHM.js") }), `../../Individual/language/${lang}.json`, 5) } ]); const handleOnClose = () => { if (modalView) onUnmount?.(); onClose?.(); }; const onSubmit = (d) => { if (modalView) onUnmount?.(); onSubmitSuccess?.(d); }; if (!individualLe) return /* @__PURE__ */ jsx(Loader, {}); const country = getLegalEntityCountry(individualLe); const problems = capabilityProblems ? getProblemsForEntity(capabilityProblems, EntityTypes.LEGAL_ENTITY, individualLe.id) : void 0; return /* @__PURE__ */ jsx(IndividualDropin, { taskType: TaskTypes.INDIVIDUAL, taskName: "individualDetails", legalEntityResponse: individualLe, problems, country, asModal: modalView, hideSidebar: true, onSubmit, handleHomeClick: handleOnClose, handleCloseClick: handleOnClose }); }; //#endregion //#region src/embeds/individual-configuration/adyen-individual-configuration.tsx /** * Enables users to enter their personal details, upload the required documents, and send this information to Adyen for verification. * */ var AdyenIndividual = ({ rootlegalentityid, fetchToken, environment, locale, settings = {}, experiments = {}, view }) => { const eventEmitterRef = useRef(null); const handleOnComplete = (data) => { emitAdyenSdkEvent(eventEmitterRef, "complete", data); }; const handleOnClose = () => { emitAdyenSdkEvent(eventEmitterRef, "close"); }; return /* @__PURE__ */ jsx("div", { ref: eventEmitterRef, style: "width:100%;", children: /* @__PURE__ */ jsx(EmbedShell, { componentName: "adyen-individual-configuration", rootLegalEntityId: rootlegalentityid, settings, features: experiments, getSdkToken: fetchToken, locale, baseUrl: resolveEnvironment(environment), children: /* @__PURE__ */ jsx(CreateIndividualComponent, { legalEntityId: rootlegalentityid, onSubmitSuccess: handleOnComplete, modalView: view === "modal", onClose: handleOnClose }) }) }); }; register(AdyenIndividual, "adyen-individual-configuration", [ "rootlegalentityid", "environment", "locale", "fetchToken", "settings", "experiments", "view" ], { shadow: true, adoptedStyleSheets: stylesheets }); //#endregion export { AdyenIndividual };