export interface BaseSurveyField { id: string; showConditions?: ShowCondition[]; } export interface BaseQuestionField extends BaseSurveyField { required?: boolean; } export interface MessageSurveyField extends BaseSurveyField { type: 'message'; label: string; } export interface Link { label?: string; link: string; } export interface LinkSurveyField extends BaseSurveyField { type: 'links'; links: Link[]; } export interface AppReviewSurveyField extends BaseSurveyField { type: 'app-review'; } export type ScaleShape = 'number' | 'star'; export interface ScaleSurveyField extends BaseQuestionField { label: string; type: 'scale'; shape?: ScaleShape; min: number; max: number; lowLegend: string; highLegend: string; } export interface SmileySurveyField extends BaseQuestionField { label: string; type: 'smiley'; lowLegend: string; highLegend: string; } export interface ThumbSurveyField extends BaseQuestionField { label: string; type: 'thumb'; lowLegend: string; highLegend: string; } export interface LongTextSurveyField extends BaseQuestionField { label: string; type: 'long-text'; } export interface SingleChoiceSurveyField extends BaseQuestionField { label: string; type: 'single-choice'; choices: string[]; } export interface MultipleChoiceSurveyField extends BaseQuestionField { label: string; type: 'multiple-choice'; choices: string[]; } export type Question = ScaleSurveyField | SmileySurveyField | ThumbSurveyField | LongTextSurveyField | SingleChoiceSurveyField | MultipleChoiceSurveyField; export interface SingleShowCondition { attribute: string; operator: 'eq' | 'neq' | 'gt' | 'lt' | 'exists' | 'nexists'; value: number | string; } export interface MultiShowCondition { attribute: string; operator: 'in'; value: (number | string)[]; } export type ShowCondition = SingleShowCondition | MultiShowCondition; export type ThanksField = MessageSurveyField | LinkSurveyField | AppReviewSurveyField; export type TranslatedSurveyField = ThanksField | Question; export interface SurveyDefinition { questions: Question[]; thanksFields: ThanksField[]; } export type ThumbSurveyValue = 'up' | 'down'; export type AnswerValue = string | string[] | number; export interface SurveyValues { [id: string]: AnswerValue | undefined; } export interface SurveyState { values: SurveyValues; visible: boolean; screenId: string; isOnInitialScreen: boolean; } export interface SurveyScreen { id: string; fields: TranslatedSurveyField[]; autoClose: boolean; autoFocus: boolean; showSubmit: boolean; } export interface ResponseAnswer { id: string; label: string; value: number | string | string[]; } export interface Colors { primary: string; background: string; foreground: string; } export type WidgetPosition = 'tl' | 'tc' | 'tr' | 'ml' | 'mc' | 'mr' | 'bl' | 'bc' | 'br'; export interface WidgetStyle { type: 'widget'; position: WidgetPosition; overlay: boolean; } export type WidgetSkin = 'bar' | 'dialog' | 'panel' | 'raw' | 'preview' | 'preview-desktop' | 'preview-mobile'; export type WidgetSize = 'normal' | 'small'; export interface FormStyle { type: 'form'; } export interface RawStyle { type: 'raw'; } interface DesktopPreviewStyle { type: 'preview'; device: 'desktop'; position: WidgetPosition; overlay: boolean; } interface GenericPreviewStyle { type: 'preview'; device: 'generic'; } interface MobilePreviewStyle { type: 'preview'; device: 'mobile'; } export type PreviewStyle = DesktopPreviewStyle | GenericPreviewStyle | MobilePreviewStyle; export type SurveyStyle = WidgetStyle | FormStyle | RawStyle | PreviewStyle; export type TextDirection = 'rtl' | 'ltr'; export interface Translations { CONTINUE: string; SUBMIT: string; REQUIRED: string; } export interface SurveyRenderOptions { translations: Translations; colors: Colors; direction: TextDirection; style: SurveyStyle; showPoweredBy: boolean; embed: boolean; medium?: string; autoFocus: boolean; autoClose: boolean; autoCloseDelay: number; transitionDuration: number; } export {};