UNPKG

@namiml/web-sdk

Version:

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

77 lines (76 loc) 2.11 kB
import type { NamiConditions } from "./conditions"; import { FormFactor } from "./campaign"; export declare enum NamiFlowStepType { ENTRY = "entry", SCREEN = "screen", BRANCH = "branch", EXIT = "exit", UNKNOWN = "unknown" } export declare enum NamiFlowActionFunction { NAVIGATE = "flowNav", BACK = "flowPrev", NEXT = "flowNext", FINISHED = "flowDone", DISMISS = "flowDismiss", EXIT = "flowExit", HANDOFF = "flowHandoff", TRACK = "trackEvent", LOG = "logEvent", SET_VIDEO = "setVideo", FLOW_EVENT = "flowEvent", BLOCK_BACK = "blockBackToStep", FLOW_ENABLED = "flowInteractionEnabled", FLOW_DISABLED = "flowInteractionDisabled" } export type NamiFlowHandoffStepHandler = (handoffTag: string, handoffData?: Record<string, any>) => void; export type NamiFlowEventHandler = (eventHandler: Record<string, any>) => void; export interface NamiFlowDTO { flow_id?: string; object_id?: string; object?: NamiFlowObjectDTO; } export type NamiFlowWithObject = Omit<NamiFlowDTO, 'object'> & { object: NamiFlowObjectDTO; }; export interface NamiFlowObjectDTO { id?: string; name?: string; resume_from_bookmark?: boolean; screens?: string[]; form_factors?: FormFactor[]; version?: string; steps?: NamiFlowStep[]; } type SetVideoAction = { name?: string; url?: string; }; export interface NamiFlowAction { id?: string; function: `${NamiFlowActionFunction}`; parameters?: { handoffTag?: string; handoffData?: Record<string, any>; handoffFormId?: string; step?: string; eventName?: string; delay?: string | number; } & SetVideoAction; conditions?: NamiConditions[]; } export interface NamiFlowOn { before?: NamiFlowAction[]; action?: NamiFlowAction[]; after?: NamiFlowAction[]; } export interface NamiFlowStep { id: string; name?: string; type: NamiFlowStepType; screen?: string; branch_tags?: string[]; actions: Partial<Record<string, NamiFlowOn[]>>; allow_back_to?: boolean; } export {};