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.
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
Unique identifier for the popup
Title text displayed in the popup
Message content (HTML string - should be sanitized before use)
Trigger configuration that determines when the popup appears
Available actions (accept, decline, complete, start, back)
Survey ID to associate with this popup
Product ID associated with the survey
Visual styling configuration for the popup
Targeting configuration to control when/where popup appears
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' ;
Show PopupTrigger Properties
Type of trigger: 'time_on_page', 'scroll', 'exit', 'click', or 'event'
Value for the trigger:
time_on_page : seconds on page
scroll : scroll percentage (0-100)
exit : route exit delay in seconds
click : element id to click
event : custom event name
List of additional conditions for triggering the popup
Additional condition for popup activation.
export interface PopupTriggerCondition {
answered : boolean ;
cooldownDays : number ;
}
Show PopupTriggerCondition Properties
Whether the user has already answered the survey
Number of days to wait before showing the popup again
Set of available actions in the popup.
export interface PopupActions {
accept ?: PopupActionAccept ;
decline ?: PopupActionDecline ;
complete ?: PopupActionComplete ;
start ?: PopupActionStart ;
back ?: PopupActionDecline ;
}
Show PopupActions Properties
Action to accept and open the survey
Action to decline the popup
Action to accept and auto-complete the survey
Action to start the survey
Action to go back (uses same interface as decline)
Action Interfaces
export interface PopupActionAccept {
label : string ;
surveyId : string ;
}
ID of the survey to launch
export interface PopupActionDecline {
label : string ;
cooldownDays ?: number ;
}
Optional: do not show the popup for X days after declining
export interface PopupActionStart {
label : string ;
}
export interface PopupActionComplete {
label : string ;
surveyId : string ;
autoCompleteParams : Record < string , unknown >;
cooldownDays ?: number ;
}
ID of the survey to launch
autoCompleteParams
Record<string, unknown>
required
Parameters for auto-completing the survey (requires survey to support auto-complete via parameters)
Number of days to wait before showing again
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 ;
}
Show PopupStyle Properties
Visual theme for the popup
position
'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'center'
required
Screen position where the popup will appear
Optional image URL to display in the popup
Targeting configuration to control when and where popups appear.
export interface PopupSegments {
lang ?: string [];
path ?: string [];
[ key : string ] : unknown ;
}
Show PopupSegments Properties
Array of allowed language codes
Array of app routes where the popup should be shown
Extension point for future targeting options
Example Usage
Basic Popup
With Actions and Style
With Segments
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
}
};