UNPKG

@namiml/web-sdk

Version:

Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing

69 lines (68 loc) 2.73 kB
import { IPaywall } from "../types/paywall"; import { NamiProductDetails } from "../types/externals/product"; import { Callback, CloseHandler, DeepLinkUrlHandler, SKUActionHandler } from "../types/components/containers"; import { NamiPurchaseDetails } from "../types/externals/purchase"; /** * @class NamiPaywallManager * Provides methods for managing all aspects of a paywall in the Nami SDK. */ export declare class NamiPaywallManager { static instance: NamiPaywallManager; private emitter; productDetails: NamiProductDetails[]; /** * @returns {IPaywall[]} a list of Paywall */ static allPaywalls(): IPaywall[]; /** * Used to set product details when store products are unavailable. For advanced use cases only. */ static setProductDetails(productDetails: NamiProductDetails[]): void; /** * Register a callback which would be invoked when user will sign-in */ static registerSignInHandler(handler: Callback): Callback; /** * Register a callback which would be invoked when user close a paywall raised by Nami system */ static registerCloseHandler(handler: CloseHandler): Callback; /** * Register a callback which would be invoked when user will take action on deeplink */ static registerDeeplinkActionHandler(handler: DeepLinkUrlHandler): Callback; /** * Register a [NamiBuySkuHandler] which would be invoked when a user triggers * a buy sku action on a paywall. * * Only available for plans where Nami is not handling subscription & IAP management. */ static registerBuySkuHandler(handler: SKUActionHandler): Callback; /** * Register a callback which would be invoked when user restore a product */ static registerRestoreHandler(handler: Callback): Callback; /** * Notify the NamiPaywallManager that a purchase initiated from the * [NamiBuySkuHandler] is complete. * * Only available for plans where Nami is not handling subscription & IAP management. * * @returns {Promise<void>} A Promise that resolves when buying SKU will be complete. */ static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>; /** * Notify the NamiPaywallManager that purchase flow handled by you is cancelled. * Used to disable product purchase-in-progress loading indicators */ static buySkuCancel(): void; /** * Set the video details for the app supplied video * @param url The URL of the video * @param name The name of the video */ static setAppSuppliedVideoDetails(url: string, name?: string): void; /** * Private Instance Methods */ private get sdkInitialized(); }