UNPKG

@namiml/web-sdk

Version:

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

86 lines (85 loc) 3.52 kB
import { Device } from "../types/device"; import { IConfig } from "../types/config"; import { NamiConfiguration } from "../types/externals/config"; import { IPaywall } from "../types/paywall"; import { NamiCampaign } from "../types/externals/campaign"; import { NamiProfile } from "../types/profile"; import { IEntitlements, NamiEntitlement } from "../types/entitlements"; import { SKU } from "../types/sku"; import { CustomerJourneyState } from "../types/externals/customer"; export declare class StorageService { private memoryStore; setDevice(device: Device): void; getDevice(): Device | null; resetDevice(): void; getAnonymousMode(): boolean; setAnonymousMode(mode: boolean): void; clearAnonymousMode(): void; setAppConfig(key: string, config: IConfig): void; getAppConfig(key: string): IConfig | null; setLanguageCode(code?: string): void; getLanguageCode(): string; setCampaignRules(key: string, campaignRules: NamiCampaign[]): void; getCampaignRules(key: string): NamiCampaign[] | null; setPaywalls(key: string, paywalls: IPaywall[]): void; getPaywalls(key: string): IPaywall[] | null; setActiveEntitlements(key: string, entitlements: IEntitlements[]): void; getActiveEntitlements(key: string): IEntitlements[]; setNamiEntitlements(key: string, entitlements: NamiEntitlement[]): void; getNamiEntitlements(key: string): NamiEntitlement[]; setProducts(key: string, products: SKU[]): void; getProducts(key: string): SKU[] | null; getCachedProducts(): SKU[] | null; setNamiConfig(config: Omit<NamiConfiguration, "initialConfig">): void; getNamiConfig(): Omit<NamiConfiguration, "initialConfig"> | null; setCustomerAttribute<T>(attribute: string, value: T): void; getCustomerAttribute<T>(attribute: string): T | null; getAllCustomerAttributes(): string[]; getAllCustomerAttributesKeys(): string[]; clearCustomerAttribute(attribute: string): boolean; clearAllCustomerAttributes(): void; setNamiProfile(profileData: NamiProfile): void; getNamiProfile(): NamiProfile | null; removeNamiProfile(): void; setCustomerJourneyState(state: CustomerJourneyState): void; getCustomerJourneyState(): CustomerJourneyState | null; setSessionCounter(): void; getSessionCounter(): number; setLastImpressionId(id: string): void; getLastImpressionId(): string; setPurchaseImpression(): void; getPurchaseImpression(): string; setSessionId(id?: string): void; getSessionId(): string; clearSessionId(): void; setLaunchId(id?: string): void; getLaunchId(): string; clearLaunchId(): void; setPurchaseChannel(channel?: string): void; getPurchaseChannel(): string | null; getAnonymousUUID(): string | null; setAnonymousUUID(uuid: string): void; clearAnonymousUUID(): void; /** * Set an item in localStorage. * @param {string} key - The key under which to store the data. * @param {T} value - The data to store. */ private setItem; /** * Get an item from localStorage. * @param {string} key - The key of the item to retrieve. * @returns {T | null} The stored data, or null if not found. */ private getItem; /** * Remove an item from localStorage. * @param {string} key - The key of the item to remove. */ private resetItem; /** * Clear all items from localStorage. */ clear(): void; } export declare const storageService: StorageService;