UNPKG

@secrethub/ngx-stripe

Version:

The core package for ngx-stripe, for using stripe.js in your application

46 lines (45 loc) 1.54 kB
import { Observable } from 'rxjs'; import { SupportedVersions } from '../model/SupportedVersions'; import { StripeConfigOptions, StripeJS } from 'stripejs'; export declare class StripeLoader { private version; private options; private key; /** * The key under which the stripe script is placed in the * window object * * @default 'Stripe' */ private static readonly STRIPE_WINDOW_KEY; constructor(version: SupportedVersions, options: StripeConfigOptions, key: string); /** * Fetches the stripe instance from the DOM * * @return The Stripe instance or null if it is not yet registered */ static getStripeInstance(key: string, options: StripeConfigOptions): StripeJS | null; /** * Checks whether or not StripeJS has been loaded */ static isStripeLoaded(): boolean; /** * Injects the script tag into the body of the page in order to lazy * load the Stripe script * * @return Observable to indicate when the script has finished loading */ loadScript(): Observable<StripeJS>; /** * Constructs the url that should be used for loading the Stripe script * @return URL to stripe script location */ private getStripeScriptUrl; /** * Constructs a script element that loads javascript from the given url * @param url - The URL from which the javascript should be loaded * * @return A script element that can be attached to the DOM */ private static constructScript; }