UNPKG

react-klasha

Version:

React hooks and components for accepting payments with the Klasha payment gateway

23 lines (22 loc) 1.17 kB
/** Marks the containers this library owns, so merchant-supplied nodes survive. */ export declare const KLASHA_CONTAINER_ATTRIBUTE = "data-react-klasha-container"; /** A container id that is unique for the lifetime of the page. */ export declare const nextKlashaContainerId: () => string; /** * Returns the element with `id`, creating it only when it is missing. * * 0.0.x appended a `<div id="ktest">` on every effect run, so remounting or * rendering two payment components produced duplicate DOM ids and the checkout * rendered into whichever one the browser happened to return first. */ export declare const ensureKlashaContainer: (id: string) => HTMLElement | null; /** Removes a container, but only if this library created it. */ export declare const removeKlashaContainer: (id: string) => void; /** * Owns the checkout container for one hook instance. * * @param containerId use a specific element instead of a generated one. The * element is reused if it already exists and is left in place on unmount. * @returns the id to hand to the Klasha client as `containerId`. */ export default function useKlashaContainer(containerId?: string): string;