Skip to main content
These types are used internally by the SDK. While they are not directly exported from the package, they are documented here for reference when configuring popups in client mode or understanding the SDK’s behavior.

PopupDefinition

Complete definition of a popup including trigger, actions, style, and targeting.
export interface PopupDefinition {
    id: string;
    title: string;
    message: string;
    triggers: PopupTrigger;
    actions?: PopupActions;
    surveyId: string;
    productId: string;
    style?: PopupStyle;
    segments?: PopupSegments;
}

Parameters

id
string
required
Unique identifier for the popup
title
string
required
Title text displayed in the popup
message
string
required
Message content (HTML string - should be sanitized before use)
triggers
PopupTrigger
required
Trigger configuration that determines when the popup appears
actions
PopupActions
Available actions (accept, decline, complete, start, back)
surveyId
string
required
Survey ID to associate with this popup
productId
string
required
Product ID associated with the survey
style
PopupStyle
Visual styling configuration for the popup
segments
PopupSegments
Targeting configuration to control when/where popup appears

PopupTrigger

Trigger associated with the popup definition.
export interface PopupTrigger {
    type: PopupTriggerType;
    value: number | string;
    condition?: PopupTriggerCondition[];
}

export type PopupTriggerType = 'time_on_page' | 'scroll' | 'exit' | 'click' | 'event';

PopupTriggerCondition

Additional condition for popup activation.
export interface PopupTriggerCondition {
    answered: boolean;
    cooldownDays: number;
}

PopupActions

Set of available actions in the popup.
export interface PopupActions {
    accept?: PopupActionAccept;
    decline?: PopupActionDecline;
    complete?: PopupActionComplete;
    start?: PopupActionStart;
    back?: PopupActionDecline;
}

Action Interfaces


PopupStyle

Configurable styles for the popup appearance.
export interface PopupStyle {
    theme: 'light' | 'dark';
    position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'center';
    imageUrl: string | null;
}

PopupSegments

Targeting configuration to control when and where popups appear.
export interface PopupSegments {
    lang?: string[];
    path?: string[];
    [key: string]: unknown;
}

Example Usage

const popup: PopupDefinition = {
  id: 'welcome-popup',
  title: 'Welcome to our app!',
  message: 'We'd love to hear your feedback',
  surveyId: 'survey-123',
  productId: 'product-456',
  triggers: {
    type: 'time_on_page',
    value: 10
  }
};

Build docs developers (and LLMs) love