UNPKG

@swrve/smarttv-sdk

Version:

Swrve marketing engagement platform SDK for SmartTV OTT devices

66 lines (65 loc) 4.32 kB
import { ResourceManager } from './Resources/ResourceManager'; import { ISwrveCampaign, ISwrveBaseMessage, IUserResource } from './Campaigns/ISwrveCampaign'; import { IUserInfo } from './Profile/IUser'; import ISwrveConfig from "./Config/ISwrveConfig"; import IDictionary from "./utils/IDictionary"; import IReadonlyDictionary from "./utils/IReadonlyDictionary"; import IReward from "./WebApi/Events/IReward"; import { ISwrveEmbeddedMessage } from "./Campaigns/ISwrveCampaign"; import { ICampaignState } from './Campaigns/ICampaignState'; import { IPlatform } from './utils/platforms/IPlatform'; export declare type OnResourcesLoadedCallback = (resources: ReadonlyArray<IUserResource> | null) => void; export declare type OnCampaignLoadedCallback = (error?: Error) => void; export declare type GetResourcesCallback = (resources: ReadonlyArray<IUserResource>) => void; export declare type GetUserResourcesDiffCallback = (oldDictionary: IDictionary<IUserResource>, newDictionary: IDictionary<IUserResource>, json: any) => any; export declare type OnIdentifySuccessCallback = (status: string, swrveUserId: string) => void; export declare type OnIdentifyErrorCallback = (error: string) => void; export declare type OnMessageListener = (msg: ISwrveBaseMessage) => void; export declare type OnIAMDismissed = () => void; export declare type OnIAMShown = () => void; export declare type OnCustomButtonClicked = (customString: string) => void; export declare class SwrveSDK { private static _instance; static createInstance(config: ISwrveConfig): SwrveSDK; private constructor(); init(): void; private static checkInstance; static onResourcesLoaded(callback: OnResourcesLoadedCallback): void; static onCampaignLoaded(callback: OnCampaignLoadedCallback): void; static onMessage(callback: OnMessageListener): void; static getResources(callback: GetResourcesCallback): void; static getUserResourcesDiff(callback: GetUserResourcesDiffCallback): void; static onIAMDismissed(callback: OnIAMDismissed): void; static onCustomButtonClicked(callback: OnCustomButtonClicked): void; static onIAMShown(callback: OnIAMShown): void; static getConfig(): Readonly<ISwrveConfig>; static getInstance(): SwrveSDK; static getResourceManager(): ResourceManager; static getUserInfo(): IUserInfo; static getSDKVersion(): string; static embeddedMessageWasShownToUser(message: ISwrveEmbeddedMessage): void; static embeddedMessageButtonWasPressed(message: ISwrveEmbeddedMessage, buttonName: string): void; static getPersonalizedEmbeddedMessageData(message: ISwrveEmbeddedMessage, personalizationProperties: IDictionary<string>): string | null; static getPersonalizedText(text: string, personalizationProperties: IDictionary<string>): string | null; static sendEvent(name: string, payload?: IDictionary<string | number>): void; static sendUserUpdateWithDate(keyName: string, date: Date): void; static sendUserUpdate(attributes: IReadonlyDictionary<string | number | boolean>): void; static sendPurchaseEvent(name: string, currency: string, cost: number, quantity: number): void; static sendInAppPurchaseWithoutReceipt(quantity: number, productId: string, productPrice: number, currency: string, rewards: IReadonlyDictionary<IReward>): void; static sendCurrencyGiven(currencyGiven: string, amount: number): void; static sendQueuedEvents(): void; static identify(externalUserId: string, onIdentifySuccess: OnIdentifySuccessCallback, onIdentifyError: OnIdentifyErrorCallback): void; static start(userId?: string): void; static isStarted(): boolean; static shutdown(): void; static stop(): void; static getMessageCenterCampaigns(personalizationProperties?: IDictionary<string>): ISwrveCampaign[]; static showMessageCenterCampaign(campaign: ISwrveCampaign, personalizationProperties?: IDictionary<string>): boolean; static markMessageCenterCampaignAsSeen(campaign: ISwrveCampaign): void; static removeMessageCenterCampaign(campaign: ISwrveCampaign): void; static getCampaignState(campaignId: string): ICampaignState | undefined; static isMessageShowing(): boolean; static saveToStorage(): void; static showCampaign(campaign: ISwrveCampaign): boolean; static getPlatform(): IPlatform; }