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.

107 lines (106 loc) 5.65 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] = "0c0f4d20-2950-4be6-8956-0232371bd031", e._sentryDebugIdIdentifier = "sentry-dbid-0c0f4d20-2950-4be6-8956-0232371bd031"); } 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 { s as useApiContext } from "./http-D1NDkBxF.js"; import { r as useLegalEntity, t as ROOT_LE } from "./useLegalEntity-yxi9XhLi.js"; import { t as _rolldown_dynamic_import_helper_default } from "./_rolldown_dynamic_import_helper-rq_tsyLP.js"; import { t as emitAdyenSdkEvent } from "./emitEvent-Cdd95HOT.js"; import { t as useOnboardingStatus } from "./useOnboardingStatus-C4cuWhT6.js"; import { t as OnboardingStatuses } from "./view-verification-status-CYHM_Ggf.js"; import { t as EmbeddedStatus } from "./EmbeddedStatus-C0cKHgzR.js"; import register from "preact-custom-element"; import { useRef } from "preact/hooks"; import { jsx } from "preact/jsx-runtime"; //#region src/components/EmbeddedDropins/ManageIndividualComponent/ManageIndividualComponent.tsx function ManageIndividualComponent({ legalEntityId, onClick }) { const { i18n } = useTranslation(); const { rootLegalEntityId: currentLegalEntityId } = useApiContext(); currentLegalEntityId.value = 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) }]); const { data: legalEntityData } = useLegalEntity(ROOT_LE); const { isPending, data: onboardingStatusData } = useOnboardingStatus({ refetchInterval: (res) => res.state.data?.status === OnboardingStatuses.AWAITING_DATA ? 3e3 : false }); const name = legalEntityData?.individual?.name; const fullName = name ? `${name.firstName} ${name.lastName}` : ""; const subtitle = legalEntityData?.individual?.email ?? ""; const status = onboardingStatusData?.status; return /* @__PURE__ */ jsx(EmbeddedStatus, { onClick, title: fullName, subtitle, status, loading: isPending }); } //#endregion //#region src/embeds/individual-status/adyen-individual-status.tsx /** * Enables users to view their current verification status and update their information if necessary. */ var AdyenManageIndividual = ({ rootlegalentityid, fetchToken, environment, locale, settings = {}, experiments = {} }) => { const eventEmitterRef = useRef(null); const handleOnClick = () => { emitAdyenSdkEvent(eventEmitterRef, "click"); }; return /* @__PURE__ */ jsx("div", { ref: eventEmitterRef, style: "width:100%;", children: /* @__PURE__ */ jsx(EmbedShell, { componentName: "adyen-individual-status", rootLegalEntityId: rootlegalentityid, settings, features: experiments, getSdkToken: fetchToken, locale, baseUrl: resolveEnvironment(environment), children: /* @__PURE__ */ jsx(ManageIndividualComponent, { legalEntityId: rootlegalentityid, onClick: handleOnClick }) }) }); }; register(AdyenManageIndividual, "adyen-individual-status", [ "rootlegalentityid", "fetchToken", "environment", "locale", "settings", "experiments" ], { shadow: true, adoptedStyleSheets: stylesheets }); //#endregion