UNPKG

@namiml/web-sdk

Version:

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

47 lines (46 loc) 1.99 kB
import { NamiActiveEntitlementsHandler, NamiEntitlement } from "../types/entitlements"; import { Callback } from "../types/components/containers"; /** * @class NamiEntitlementManager * Contains all methods and objects to work with entitlements in the SDK. */ export declare class NamiEntitlementManager { static instance: NamiEntitlementManager; private emitter; /** * @returns {NamiEntitlement[]} A list of currently active entitlements */ static active(): NamiEntitlement[]; /** * Checks if a Nami Control Center defined Entitlement has at least one backing purchase * and it's not expired. * * @param referenceId - entitlement referenceId * @returns {boolean} True if the entitlement is active for given referenceId, false otherwise. */ static isEntitlementActive(referenceId: string): boolean; /** * Asks Nami to fetch the latest active entitlements * * @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement */ static refresh(): Promise<NamiEntitlement[]>; /** * When there has been an update received to the active entitlements, * the Nami SDK will provide notification of that event through * this callback with list of active [NamiEntitlement] * * @param {NamiActiveEntitlementsHandler} handler - The callback function that will be invoked when the campaign list is updated. * @returns {Callback} A function that can be called to unregister the handler. */ static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback | undefined; /** * Clear any provisional entitlement grants, which are entitlements issued on-device only. * Useful for development and purchase testing. Not recommended to be called in production. */ static clearProvisionalEntitlementGrants(): void; /** * Private Instance Methods */ private get sdkInitialized(); }