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.

192 lines (191 loc) 10.8 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] = "cd48e3fc-fbbb-456f-916e-00ed6955d323", e._sentryDebugIdIdentifier = "sentry-dbid-cd48e3fc-fbbb-456f-916e-00ed6955d323"); } catch (e) {} import { n as addResourceBundles, r as useTranslation } from "./translation-BYvhW5zA.js"; import { A as _rolldown_dynamic_import_helper_default, mt as stylesheets, n as EmbedShell, t as resolveEnvironment } from "./resolveEnvironment-DNmu53Rr.js"; import { r as Loader } from "./Button-i8I2dHP8.js"; import { r as useLegalEntity } from "./useLegalEntity-CtlUQv_J.js"; import { t as getLegalEntityCountry } from "./getLegalEntityCountry-BHh7Ux8v.js"; import { C as EntityTypes } from "./processCapabilities-fPuXc9gL.js"; import { t as TaskTypes } from "./taskTypes-NawDTp5n.js"; import { n as useCapabilityProblems, t as getProblemsForEntity } from "./getProblemsForEntity-D6XC4DZ2.js"; import { t as IndividualDropin } from "./IndividualDropin-DHrcFHNx.js"; import { t as emitAdyenSdkEvent } from "./emitEvent-CcGIaOut.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-BcmC41vE.js"), "../../../language/locales/cs-CZ.json": () => import("./cs-CZ-ghdW0Tc6.js"), "../../../language/locales/da-DK.json": () => import("./da-DK-CBOVFYaa.js"), "../../../language/locales/de-DE.json": () => import("./de-DE-CA81fzkA.js"), "../../../language/locales/el-GR.json": () => import("./el-GR-BjOmQ_B_.js"), "../../../language/locales/en-US.instructions.json": () => import("./en-US.instructions-FOYUYA3c.js"), "../../../language/locales/en-US.json": () => import("./en-US-Dab7moVA.js"), "../../../language/locales/es-ES.json": () => import("./es-ES-BEYl7Z8S.js"), "../../../language/locales/es-LA.json": () => import("./es-LA-D741KUNg.js"), "../../../language/locales/et-EE.json": () => import("./et-EE-CfgyGext.js"), "../../../language/locales/fi-FI.json": () => import("./fi-FI-DFO20YZY.js"), "../../../language/locales/fr-FR.json": () => import("./fr-FR-wvWrk_PU.js"), "../../../language/locales/hr-HR.json": () => import("./hr-HR-D0zfmZK6.js"), "../../../language/locales/hu-HU.json": () => import("./hu-HU-CL021irk.js"), "../../../language/locales/it-IT.json": () => import("./it-IT-6VoxKX97.js"), "../../../language/locales/ja-JP.json": () => import("./ja-JP-Cja4dur8.js"), "../../../language/locales/lt-LT.json": () => import("./lt-LT-CNFgOeH4.js"), "../../../language/locales/lv-LV.json": () => import("./lv-LV-BdSdhjTP.js"), "../../../language/locales/nl-NL.json": () => import("./nl-NL-CclRrN3_.js"), "../../../language/locales/no-NO.json": () => import("./no-NO-CO5xyGPh.js"), "../../../language/locales/pl-PL.json": () => import("./pl-PL-DUH23AYC.js"), "../../../language/locales/pt-BR.json": () => import("./pt-BR-MAQR_CUu2.js"), "../../../language/locales/pt-PT.json": () => import("./pt-PT-CoKsjpyN.js"), "../../../language/locales/ro-RO.json": () => import("./ro-RO-Cpv5pKod.js"), "../../../language/locales/sk-SK.json": () => import("./sk-SK-p_p2X_aA.js"), "../../../language/locales/sl-SI.json": () => import("./sl-SI-BpZp1MAq.js"), "../../../language/locales/sv-SE.json": () => import("./sv-SE-BoXCPhGb.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-CzXoDIev.js"), "../../ui/language/cs-CZ.json": () => import("./cs-CZ-JUprtMsH.js"), "../../ui/language/da-DK.json": () => import("./da-DK-D2RrHm98.js"), "../../ui/language/de-DE.json": () => import("./de-DE-o8i-cfnA.js"), "../../ui/language/el-GR.json": () => import("./el-GR-BAhj1djs.js"), "../../ui/language/en-US.json": () => import("./en-US-COWs58AF.js"), "../../ui/language/es-ES.json": () => import("./es-ES-BNjxmV8Q.js"), "../../ui/language/es-LA.json": () => import("./es-LA-BIPVrwXX.js"), "../../ui/language/et-EE.json": () => import("./et-EE-Dl6n-Am8.js"), "../../ui/language/fi-FI.json": () => import("./fi-FI-T33BAikx.js"), "../../ui/language/fr-FR.json": () => import("./fr-FR-CRO4taJU.js"), "../../ui/language/hr-HR.json": () => import("./hr-HR-CbEXwWeO.js"), "../../ui/language/hu-HU.json": () => import("./hu-HU-B9JCbRow.js"), "../../ui/language/it-IT.json": () => import("./it-IT-DE_Dkl_X.js"), "../../ui/language/ja-JP.json": () => import("./ja-JP-BaD-vLXo.js"), "../../ui/language/lt-LT.json": () => import("./lt-LT-5OY6az4F.js"), "../../ui/language/lv-LV.json": () => import("./lv-LV-DjAUG4pi.js"), "../../ui/language/nl-NL.json": () => import("./nl-NL-C3cXv5PD.js"), "../../ui/language/no-NO.json": () => import("./no-NO-DyMlgewS.js"), "../../ui/language/pl-PL.json": () => import("./pl-PL-ClUTW9pd.js"), "../../ui/language/pt-BR.json": () => import("./pt-BR-Bk2xOhdi.js"), "../../ui/language/pt-PT.json": () => import("./pt-PT-5O7ohkQD.js"), "../../ui/language/ro-RO.json": () => import("./ro-RO-BOV_LMAu.js"), "../../ui/language/sk-SK.json": () => import("./sk-SK-BUGTKkOC.js"), "../../ui/language/sl-SI.json": () => import("./sl-SI-DffYWi9P.js"), "../../ui/language/sv-SE.json": () => import("./sv-SE-D_bagacj.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-VIyyeYUh.js"), "../../Individual/language/cs-CZ.json": () => import("./cs-CZ-D8nnXFEh.js"), "../../Individual/language/da-DK.json": () => import("./da-DK-Cq-1LB6T.js"), "../../Individual/language/de-DE.json": () => import("./de-DE-Bc55gBv4.js"), "../../Individual/language/el-GR.json": () => import("./el-GR-Cr-3NgPk.js"), "../../Individual/language/en-US.instructions.json": () => import("./en-US.instructions-DfgivDPI.js"), "../../Individual/language/en-US.json": () => import("./en-US-C1J9jcVI.js"), "../../Individual/language/es-ES.json": () => import("./es-ES-uVSZu-EQ.js"), "../../Individual/language/es-LA.json": () => import("./es-LA-BU5Op1kh.js"), "../../Individual/language/et-EE.json": () => import("./et-EE-BFb0MPqf.js"), "../../Individual/language/fi-FI.json": () => import("./fi-FI-BI9sCCEP.js"), "../../Individual/language/fr-FR.json": () => import("./fr-FR-_TkFnevF.js"), "../../Individual/language/hr-HR.json": () => import("./hr-HR-DubR_a2h.js"), "../../Individual/language/hu-HU.json": () => import("./hu-HU-CK6lbZ-D.js"), "../../Individual/language/it-IT.json": () => import("./it-IT-CVVOlFfY.js"), "../../Individual/language/ja-JP.json": () => import("./ja-JP-B8sNFjt_.js"), "../../Individual/language/lt-LT.json": () => import("./lt-LT-C9lXLzZA.js"), "../../Individual/language/lv-LV.json": () => import("./lv-LV-2Q8G1u4p.js"), "../../Individual/language/nl-NL.json": () => import("./nl-NL-DMdoFepr.js"), "../../Individual/language/no-NO.json": () => import("./no-NO-CwgewQst.js"), "../../Individual/language/pl-PL.json": () => import("./pl-PL-D-TVYshE.js"), "../../Individual/language/pt-BR.json": () => import("./pt-BR-DwHag_mp.js"), "../../Individual/language/pt-PT.json": () => import("./pt-PT-BVcFY8gr.js"), "../../Individual/language/ro-RO.json": () => import("./ro-RO-D3Yk1KoW.js"), "../../Individual/language/sk-SK.json": () => import("./sk-SK-D3UYKttr.js"), "../../Individual/language/sl-SI.json": () => import("./sl-SI-BkcElOhl.js"), "../../Individual/language/sv-SE.json": () => import("./sv-SE-DkZ2LyW5.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 };