react-klasha
Version:
React hooks and components for accepting payments with the Klasha payment gateway
31 lines (30 loc) • 1.35 kB
TypeScript
/**
* The Klasha inline checkout script.
*
* There is a single URL for both test and live traffic — the environment is
* chosen by the `isTestMode` constructor argument, not by the script.
*
* The URLs used by 0.0.x
* (`https://klastatic.fra1.digitaloceanspaces.com/{test,prod}/js/klasha-integration.js`)
* no longer exist: the bucket was deleted and both return a 404, which is why
* every 0.0.x integration is dead.
*/
export declare const KLASHA_SDK_URL = "https://js.klasha.com/pay.js";
/**
* Kept for symmetry with the rest of the API. Both modes resolve to the same
* script; `isTestMode` is forwarded to the client constructor instead.
*/
export declare const getKlashaScriptUrl: (_isTestMode?: boolean) => string;
/**
* Loads the Klasha inline checkout script.
*
* @param isTestMode accepted for API symmetry; the same script serves both
* environments.
* @returns `[loaded, error]` — `loaded` only turns true once the Klasha script
* itself has executed. 0.0.x also loaded jQuery and resolved on whichever
* script won the race, so `loaded` regularly reported true while
* `window.KlashaClient` was still undefined.
*/
export default function useKlashaScript(isTestMode?: boolean): boolean[];
/** Exposed for tests — clears the shared load cache. */
export declare const __resetKlashaScriptCache: () => void;