@adyen/kyc-components
Version:
`adyen-kyc-components` provides the required pieces to build an onboarding flow based on a legal entity. To onboard and verify users, you need to create a user interface (UI) to collect user data. To speed up building your integration, Adyen offers onboar
40 lines (39 loc) • 1.56 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] = "45c409a3-a480-4d6e-85aa-c46754aad2db", e._sentryDebugIdIdentifier = "sentry-dbid-45c409a3-a480-4d6e-85aa-c46754aad2db");
} catch (e) {
}
}
;
import { getCoreFromSdkOptionsProp } from "./adyenConfig.js";
class AdyenIndividual extends HTMLElement {
// Setters are needed for the Preact renderer to detect these are properties and not attributes
set options(opt) {
this.sdkOptions = opt;
}
constructor() {
super();
this.root = this.attachShadow({ mode: "open" });
this.root.innerHTML = `
<style> @import "../../../dist/style.css"; </style>
<style> @import "../style.css"; </style>
<div id="mount"></div>`;
}
async connectedCallback() {
const legalEntityId = this.getAttribute("legalEntityId");
if (!legalEntityId) {
throw Error("Adyen Individual must have a `legalEntityId` prop");
}
const modalView = this.getAttribute("view") === "modal";
const { onSubmitSuccess } = this;
const core = await getCoreFromSdkOptionsProp(this.sdkOptions);
core == null ? void 0 : core.create("createIndividualComponent", {
legalEntityId,
onSubmitSuccess,
modalView
}).mount(this.root.querySelector("#mount"));
}
}
customElements.define("adyen-individual", AdyenIndividual);