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.

179 lines (178 loc) 10.3 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] = "b0dac785-43ed-4d41-9e35-1e6ce0208b0a", e._sentryDebugIdIdentifier = "sentry-dbid-b0dac785-43ed-4d41-9e35-1e6ce0208b0a"); } 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-CguBRdxx.js"; import { r as Loader } from "./Button-oj6H8OrC.js"; import { r as useLegalEntity } from "./useLegalEntity-yxi9XhLi.js"; import { t as _rolldown_dynamic_import_helper_default } from "./_rolldown_dynamic_import_helper-rq_tsyLP.js"; import { p as TaskTypes } from "./entityAssociationUtil-BEzUdPbm.js"; import { t as emitAdyenSdkEvent } from "./emitEvent-Cdd95HOT.js"; import { t as PayoutDetailsDropin } from "./PayoutDetailsDropin-kU0l62aD.js"; import register from "preact-custom-element"; import { useRef, useState } from "preact/hooks"; import { jsx } from "preact/jsx-runtime"; //#region src/components/EmbeddedDropins/CreateTransferInstrumentComponent/CreateTransferInstrumentComponent.tsx function CreateTransferInstrumentComponent({ legalEntityId, transferInstrumentId, openBankingPartnerConfigId, modalView = false, onClose, onUnmount, onSubmitSuccess, handleBackClick }) { const [currentTransferInstrumentId, setCurrentTransferInstrumentId] = useState(transferInstrumentId); const { i18n } = useTranslation(); const { data: legalEntity, isLoading: isLegalEntityLoading } = useLegalEntity(legalEntityId); 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: "banking", importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({ "../../BankAccount/language/bg-BG.json": () => import("./bg-BG-Bayyn2Vj.js"), "../../BankAccount/language/cs-CZ.json": () => import("./cs-CZ-DlGWvcHs.js"), "../../BankAccount/language/da-DK.json": () => import("./da-DK-FIY6i3zy.js"), "../../BankAccount/language/de-DE.json": () => import("./de-DE-DLQs11Hz.js"), "../../BankAccount/language/el-GR.json": () => import("./el-GR-no-mXzHz.js"), "../../BankAccount/language/en-US.json": () => import("./en-US-f2kgWe84.js"), "../../BankAccount/language/es-ES.json": () => import("./es-ES-BUSxmdKa.js"), "../../BankAccount/language/et-EE.json": () => import("./et-EE-9bkSuMa4.js"), "../../BankAccount/language/fi-FI.json": () => import("./fi-FI-whtJ_DRy.js"), "../../BankAccount/language/fr-FR.json": () => import("./fr-FR-SabLrXSF.js"), "../../BankAccount/language/hr-HR.json": () => import("./hr-HR-C7vNP6kG.js"), "../../BankAccount/language/hu-HU.json": () => import("./hu-HU-DBqKyuYs.js"), "../../BankAccount/language/it-IT.json": () => import("./it-IT-jTdy1a4s.js"), "../../BankAccount/language/ja-JP.json": () => import("./ja-JP-qs4tLgRF.js"), "../../BankAccount/language/lt-LT.json": () => import("./lt-LT-BCqnP7r6.js"), "../../BankAccount/language/lv-LV.json": () => import("./lv-LV-BEtE7iP6.js"), "../../BankAccount/language/nl-NL.json": () => import("./nl-NL-HAKt4Uc5.js"), "../../BankAccount/language/no-NO.json": () => import("./no-NO-ChSdsuYY.js"), "../../BankAccount/language/pl-PL.json": () => import("./pl-PL-YNg08-Ol.js"), "../../BankAccount/language/pt-BR.json": () => import("./pt-BR-BnDcVpJT.js"), "../../BankAccount/language/pt-PT.json": () => import("./pt-PT-tt1J0yv6.js"), "../../BankAccount/language/ro-RO.json": () => import("./ro-RO-CRHBNotW.js"), "../../BankAccount/language/sk-SK.json": () => import("./sk-SK-BJxKfous.js"), "../../BankAccount/language/sl-SI.json": () => import("./sl-SI-B9zMw3uZ.js"), "../../BankAccount/language/sv-SE.json": () => import("./sv-SE-BgyicZrq.js") }), `../../BankAccount/language/${lang}.json`, 5) } ]); const handleOnClose = () => { if (modalView) onUnmount?.(); onClose?.(); }; return isLegalEntityLoading || !legalEntity ? /* @__PURE__ */ jsx(Loader, {}) : /* @__PURE__ */ jsx(PayoutDetailsDropin, { legalEntityResponse: legalEntity, openBankingPartnerConfigId, handleBackClick, handleCloseClick: handleOnClose, currentTransferInstrumentId, setCurrentTransferInstrumentId, onSubmit: onSubmitSuccess, taskType: TaskTypes.PAYOUT, hideSidebar: true, asModal: modalView }); } //#endregion //#region src/embeds/transfer-instrument-configuration/adyen-transfer-instrument-configuration.tsx var AdyenTransferInstrument = ({ rootlegalentityid, fetchToken, environment, locale, settings = {}, experiments = {}, transferinstrumentid, view, openbankingpartnerconfigid }) => { 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-transfer-instrument-configuration", rootLegalEntityId: rootlegalentityid, settings, features: experiments, getSdkToken: fetchToken, locale, baseUrl: resolveEnvironment(environment), children: /* @__PURE__ */ jsx(CreateTransferInstrumentComponent, { legalEntityId: rootlegalentityid, transferInstrumentId: transferinstrumentid, modalView: view === "modal", openBankingPartnerConfigId: openbankingpartnerconfigid, onSubmitSuccess: handleOnComplete, onClose: handleOnClose }) }) }); }; register(AdyenTransferInstrument, "adyen-transfer-instrument-configuration", [ "rootlegalentityid", "fetchToken", "environment", "locale", "settings", "experiments", "transferinstrumentid", "view", "openbankingpartnerconfigid" ], { shadow: true, adoptedStyleSheets: stylesheets }); //#endregion export { AdyenTransferInstrument };