@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.
165 lines (164 loc) • 9.91 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] = "cecd804c-e43b-4aba-ad2f-c27e85c68505", e._sentryDebugIdIdentifier = "sentry-dbid-cecd804c-e43b-4aba-ad2f-c27e85c68505");
} catch (e) {}
import { n as addResourceBundles, r as useTranslation } from "./translation-BYvhW5zA.js";
import { A as _rolldown_dynamic_import_helper_default } from "./resolveEnvironment-DNmu53Rr.js";
import { r as Loader } from "./Button-i8I2dHP8.js";
import { AdaptiveWorkflow, n as useAdaptiveWorkflow, t as WorkflowContext } from "./AdaptiveWorkflow-BBlqVmLJ.js";
import { useMemo } from "preact/hooks";
import { jsx } from "preact/jsx-runtime";
import { signal } from "@preact/signals";
//#region src/context/WorkflowContext/WorkflowContextProvider.tsx
/**
* To manage global variables and entity details returned from AWE
*/
var createWorkflowStore = () => {
const globals = signal({});
const entity = signal(void 0);
const taskStatuses = signal({});
return {
globals,
entity,
setGlobals: (val) => globals.value = val,
setEntity: (val) => entity.value = val,
updateGlobals: (val) => globals.value = {
...globals.value,
...val
},
taskStatuses,
setTaskStatuses: (statuses) => taskStatuses.value = statuses,
updateTaskStatus: (taskId, status) => taskStatuses.value = {
...taskStatuses.value,
[taskId]: status
}
};
};
function WorkflowContextProvider({ children }) {
const store = useMemo(() => createWorkflowStore(), []);
return /* @__PURE__ */ jsx(WorkflowContext.Provider, {
value: store,
children
});
}
//#endregion
//#region src/components/EmbeddedDropins/AdaptiveWorkflowComponent/AdaptiveWorkflowComponent.tsx
/**
* The component which will be used to render an adaptive UI based on a response from the
* Adaptive Workflow Engine (AWE). AWE uses the Requirements Engine (RE) to determine what
* data points are required from a user based what products they have requested and then uses these
* requirements to generate a UI Manifest that this component will use to render a UI.
*/
var AdaptiveWorkflowComponent = ({ onBack }) => {
const { data: uiManifest, isRefetching } = useAdaptiveWorkflow();
const { i18n } = useTranslation();
addResourceBundles(i18n, [
{
ns: "adaptive",
importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({ "../../../adaptiveWorkflow/language/en-US.json": () => import("./en-US-CeiLSh8o.js") }), `../../../adaptiveWorkflow/language/${lang}.json`, 6)
},
{
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: "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)
},
{
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)
}
]);
const loaderMessage = isRefetching ? "Checking everything over. Just a minute." : void 0;
if (!uiManifest || isRefetching) return /* @__PURE__ */ jsx(Loader, { shortMessage: loaderMessage });
return /* @__PURE__ */ jsx(WorkflowContextProvider, { children: /* @__PURE__ */ jsx(AdaptiveWorkflow, {
uiManifest,
onBack
}) });
};
//#endregion
export { AdaptiveWorkflowComponent };