UNPKG

@namiml/web-sdk

Version:

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

64 lines (63 loc) 2.93 kB
import { ReactiveController, ReactiveControllerHost } from 'lit'; import { IPaywall, NamiAppSuppliedVideoDetails, TPaywallContext, TPaywallLaunchContext, TPaywallMedia } from '../types/paywall'; import { NamiProductDetails } from '../types/externals/product'; import { NamiSKU } from '../types/externals/sku'; import { NamiCampaign } from '../types/externals/campaign'; import { TDevice } from '../types/device'; import { Callback } from '../types/components/containers'; import type { NamiFlow } from '../nami/flow/NamiFlow'; export declare const initialState: TPaywallContext; declare class ContextProvider extends EventTarget implements ReactiveController { host: ReactiveControllerHost | null; state: TPaywallContext; subscribers: Set<Callback>; productDetails: NamiProductDetails[]; flow?: NamiFlow; constructor(); subscribe(callback: Callback): Callback; unsubscribe(callback: Callback): void; emitEvent<T = any>(name: string, payload?: T): void; onEvent<T = any>(name: string, handler: (payload: T) => void): () => void; hostConnected(): void; hostDisconnected(): void; private setState; setProductDetails(details: NamiProductDetails[]): void; getProductDetails(): NamiProductDetails[]; setCurrentGroupData(currentGroupId: string, currentGroupName: string): void; getCurrentGroupId(): string; getCurrentGroupName(): string; setSelectedProdcuts(products: { [currentGroupId: string]: string | null; }): void; selectedProducts(): { [currentGroupId: string]: string | null; }; setPaywall(paywall: IPaywall, context?: TPaywallLaunchContext, campaign?: NamiCampaign): void; getSelectedPaywall(): IPaywall | undefined; getSelectedCampaign(): NamiCampaign | undefined; paywallId(): string; setCurrentPage(page: string): void; setCustomerAttribute(attributes: { [key: string]: string; }): void; removeCustomerAttribute(key: string): void; setIsLoggedIn(isLoggedIn: boolean): void; setMediaList(media: TPaywallMedia[]): void; setSafeAreaTop(safeAreaTop: number): void; setFullScreenPresentation(fullScreenPresentation: boolean): void; setFormFactor(formFactor: TDevice): void; getFormFactor(): TDevice; setPurchaseInProgress(inProgress: boolean): void; setPurchase(inProgress: boolean, product?: NamiSKU): void; setTimeSpentOnPaywall(time: number): void; setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void; resetAppSuppliedVideoDetails(): void; setLaunchDetails(value: string, type?: string): void; setOpenHeaderIds(id: string, sku?: NamiSKU): void; getCurrentCollapsibleSku(): NamiSKU; setFlow(flow: NamiFlow): void; setUserInteractionEnabled(enabled: boolean): void; setCurrentSlideIndex(index: number): void; } declare const contextProvider: ContextProvider; export default contextProvider;