/** * Upsell flow — pitch a paid plan. * * Two send modes: * - `send()` — full pitch (optional video → pitch text + CTA URL). Updates * the lead's funnel state to mark "already pitched". * - `sendReminder()` — compact reminder for users who already saw the full * pitch. No video, no funnel-state change. Configured via the optional * `reminder` block. * * Why two modes: sending the same video pitch every time a free user hits a * paywall annoys them and does not improve conversion. Send the full pitch * once; on subsequent hits, send a short CTA only. * * `sendSmart()` picks between the two automatically: if the lead is already * in the target funnel state (e.g. `CHECKOUT`), it sends the reminder. * Otherwise it sends the full pitch and transitions the state. */ import type { WhatsAppClient } from '../client/whatsapp.js'; import type { LeadStore } from '../lead/lead_store.js'; export interface UpsellReminderConfig { /** Body text. Function form receives `{whatsapp, ...vars}` like `pitch`. */ pitch: string | ((args: Record) => string); /** CTA button label. Defaults to the main `ctaText`. */ ctaText?: string; /** Override CTA URL resolver. Defaults to the main `ctaUrl`. */ ctaUrl?: string | ((whatsapp: string, vars: Record) => Promise | string); } export interface UpsellOptions { client: WhatsAppClient; leads?: LeadStore | null; funnelState?: string; pitch: string | ((args: Record) => string); ctaText: string; ctaUrl: string | ((whatsapp: string, vars: Record) => Promise | string); video?: { url: string; caption?: string; } | null; videoDelayMs?: number; /** Optional shorter pitch sent on repeat hits via `sendReminder()` / `sendSmart()`. */ reminder?: UpsellReminderConfig | null; } export declare class Upsell { readonly client: WhatsAppClient; readonly leads: LeadStore | null; readonly funnelState: string; readonly pitch: string | ((args: Record) => string); readonly ctaText: string; readonly ctaUrl: string | ((whatsapp: string, vars: Record) => Promise | string); readonly video: { url: string; caption?: string; } | null; readonly videoDelayMs: number; readonly reminder: UpsellReminderConfig | null; constructor({ client, leads, funnelState, pitch, ctaText, ctaUrl, video, videoDelayMs, reminder, }: UpsellOptions); /** * Full pitch: optional video → pitch text + CTA URL → funnel state transition. */ send(whatsapp: string, vars?: Record): Promise; /** * Compact pitch: just the CTA URL message. No video, no funnel state change. * Throws if no `reminder` was configured at construction time. */ sendReminder(whatsapp: string, vars?: Record): Promise; /** * Picks between `send()` and `sendReminder()` based on the lead's current * funnel state: * - If a `reminder` is configured AND `leads` is configured AND the user * is already in `funnelState` (i.e. already pitched), send the reminder. * - Otherwise, send the full pitch. * * Falls back to `send()` if any prerequisite is missing — never blocks. */ sendSmart(whatsapp: string, vars?: Record): Promise; } //# sourceMappingURL=upsell.d.ts.map