import CardLink from "./card-link"; import IssuedCard from "./issued-card"; import Onboarding from "./onboarding"; import PaymentMethods from "./payment-methods"; export interface Drops { cardLink: (config: any, elementID?: string) => void; issuedCard: (config: any, elementID?: string) => void; onboarding: (config: any, elementID?: string) => void; paymentMethods: (config: any, elementID?: string) => void; } declare global { interface Window { drops: Drops; } } const initializeDropWebComponents = () => { if (!window || !window.customElements) return; if (window.customElements.get("moov-card-link")) return; window.customElements.define("moov-card-link", CardLink); window.customElements.define("moov-issued-card", IssuedCard); window.customElements.define("moov-onboarding", Onboarding); window.customElements.define("moov-payment-methods", PaymentMethods); }; export const drops = (moovAccessToken: string): () => Promise => { async function initialize() { await import("moov-drops"); sessionStorage.setItem("moov-js-token", moovAccessToken); return window.drops; } return initialize; } export default initializeDropWebComponents;