@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.
181 lines (180 loc) • 10.5 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] = "7bedf10c-5fcd-487f-871c-87c793709398", e._sentryDebugIdIdentifier = "sentry-dbid-7bedf10c-5fcd-487f-871c-87c793709398");
} 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 TaskTypes } from "./taskTypes-NawDTp5n.js";
import { t as emitAdyenSdkEvent } from "./emitEvent-CcGIaOut.js";
import { t as PayoutDetailsDropinMultiForm } from "./PayoutDetailsDropinMultiForm-CyGVEwKC.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-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: "banking",
importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({
"../../BankAccount/language/bg-BG.json": () => import("./bg-BG-DYnhOtaS.js"),
"../../BankAccount/language/cs-CZ.json": () => import("./cs-CZ-DvmlHVW2.js"),
"../../BankAccount/language/da-DK.json": () => import("./da-DK-DDQUbqDb.js"),
"../../BankAccount/language/de-DE.json": () => import("./de-DE-DdOrCrMa.js"),
"../../BankAccount/language/el-GR.json": () => import("./el-GR-Bm9lqjyB.js"),
"../../BankAccount/language/en-US.json": () => import("./en-US-Dokjxy17.js"),
"../../BankAccount/language/es-ES.json": () => import("./es-ES-_w6Ygc8E.js"),
"../../BankAccount/language/es-LA.json": () => import("./es-LA-Cxk68z4n.js"),
"../../BankAccount/language/et-EE.json": () => import("./et-EE-CG66kNTM.js"),
"../../BankAccount/language/fi-FI.json": () => import("./fi-FI-DpgrKo5I.js"),
"../../BankAccount/language/fr-FR.json": () => import("./fr-FR-BN_jrAX4.js"),
"../../BankAccount/language/hr-HR.json": () => import("./hr-HR-SwSOMPhJ.js"),
"../../BankAccount/language/hu-HU.json": () => import("./hu-HU-BqW_xlCb.js"),
"../../BankAccount/language/it-IT.json": () => import("./it-IT-xc14pqAr.js"),
"../../BankAccount/language/ja-JP.json": () => import("./ja-JP-ClFJvhe2.js"),
"../../BankAccount/language/lt-LT.json": () => import("./lt-LT-CTtqyA86.js"),
"../../BankAccount/language/lv-LV.json": () => import("./lv-LV-D_9V3gBo.js"),
"../../BankAccount/language/nl-NL.json": () => import("./nl-NL-_NV5Dvt9.js"),
"../../BankAccount/language/no-NO.json": () => import("./no-NO-CoDL_uMQ.js"),
"../../BankAccount/language/pl-PL.json": () => import("./pl-PL-Bgrz9oPS.js"),
"../../BankAccount/language/pt-BR.json": () => import("./pt-BR-DUAQ_vv4.js"),
"../../BankAccount/language/pt-PT.json": () => import("./pt-PT-B6mC3m94.js"),
"../../BankAccount/language/ro-RO.json": () => import("./ro-RO-ClCWcOZD.js"),
"../../BankAccount/language/sk-SK.json": () => import("./sk-SK-CieZx5AS.js"),
"../../BankAccount/language/sl-SI.json": () => import("./sl-SI-DbVFyYEg.js"),
"../../BankAccount/language/sv-SE.json": () => import("./sv-SE-WmQ6EnrS.js")
}), `../../BankAccount/language/${lang}.json`, 5)
}
]);
const handleOnClose = () => {
if (modalView) onUnmount?.();
onClose?.();
};
return isLegalEntityLoading || !legalEntity ? /* @__PURE__ */ jsx(Loader, {}) : /* @__PURE__ */ jsx(PayoutDetailsDropinMultiForm, {
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 };