UNPKG

@namiml/web-sdk

Version:

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

102 lines (101 loc) 3.21 kB
import type { NamiConditions } from "./conditions"; import { FormFactor } from "./campaign"; export declare const NamiFlowStepType: { readonly ENTRY: "entry"; readonly SCREEN: "screen"; readonly BRANCH: "branch"; readonly EXIT: "exit"; readonly UNKNOWN: "unknown"; }; export type NamiFlowStepType = (typeof NamiFlowStepType)[keyof typeof NamiFlowStepType]; 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", PAUSE = "flowPause", RESUME = "flowResume" } 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[]; transition?: NamiFlowTransition; } 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; [key: string]: any; } & 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 type NamiFlowTransition = 'none' | 'slide' | 'verticalSlide' | 'fade'; export type NamiFlowTransitionDirection = 'forward' | 'backward'; export interface NamiFlowAnimation { transition: NamiFlowTransition; direction: NamiFlowTransitionDirection; } export declare const NamiReservedActions: { readonly BUY_SKU: "__buy_sku__"; readonly DEFAULT: "__default__"; readonly APPEAR: "__appear__"; readonly DISAPPEAR: "__disappear__"; readonly LOGIN_SUCCESS: "__login_success__"; readonly LOGIN_FAILURE: "__login_failure__"; readonly LOGOUT_SUCCESS: "__logout_success__"; readonly LOGOUT_FAILURE: "__logout_failure__"; readonly PURCHASE_SUCCESS: "__purchase_success__"; readonly PURCHASE_FAILURE: "__purchase_failure__"; readonly RESUME: "__resume__"; readonly REMOTE_BACK: "__remoteback__"; }; export {};