UNPKG

@namiml/web-sdk

Version:

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

30 lines (29 loc) 1.66 kB
import { NamiAnonymousCampaign, NamiCampaign, NamiCampaignSegment } from "../../types/externals/campaign"; import { IPaywall } from "../../types/paywall"; import type { TDevice } from '../../types/device'; export declare const isValidUrl: (label: string) => boolean; export declare const selectSegment: (segments: NamiCampaignSegment[], splitPosition: number) => NamiCampaignSegment; export declare const mapAnonymousCampaigns: (campaigns: NamiAnonymousCampaign[], splitPosition: number, formFactor?: TDevice) => NamiCampaign[]; /** * * @returns A combined list of unique campaigns based on both API and Initial, filtered by form factor. * This is used to get all campaigns that are applicable to the current device. * * Note: Since this function returns a unique list of campaigns, and API campaigns take precedence, * there may be times when API campaigns are returned that do not yet have paywalls but initial campaigns would. */ export declare const allCampaigns: () => NamiCampaign[]; export declare const getInitialCampaigns: () => NamiCampaign[]; export declare const getApiCampaigns: () => NamiCampaign[]; /** * Get paywall data from label. This function continues to search for both the campaign and paywall * based on the provided label and type. It first checks API data, then falls back to initial data. * * @param value Campaign label to search for * @param type Campaign type to filter by * @returns An object containing the currently available campaign and paywall data */ export declare const getPaywallDataFromLabel: (value: string, type?: string) => { campaign: NamiCampaign | undefined; paywall: IPaywall | undefined; };