import { RpcMethod } from './commonTypes'; import { FilterExpression as pushwoosh_objects_filters_v1_FilterExpression } from './pushwoosh_objects_filters_v1'; /** * PopupFormsServiceErrors enumerates every machine-readable error reason * (field violations and failed preconditions) returned by PopupFormsService endpoints. */ export type PopupFormsServiceErrors = /** Unspecified error. */ 'POPUP_FORMS_SERVICE_ERRORS_UNSPECIFIED' /** Popup Form name cannot be empty. */ | 'NAME_EMPTY' /** * Popup Form name cannot be longer than 255 characters. * args: max_length - the maximum allowed length of name. */ | 'NAME_TOO_LONG' /** * Popup Form with the same name already exists. * args: name - the name of the existing popup form. */ | 'NAME_ALREADY_EXISTS' /** Popup Form Content code is required. */ | 'POPUP_FORM_CONTENT_CODE_EMPTY' /** Popup Form Content code is invalid. */ | 'POPUP_FORM_CONTENT_CODE_INVALID' /** Device type is required. */ | 'DEVICE_TYPE_EMPTY' /** Device type is invalid. */ | 'DEVICE_TYPE_INVALID' /** Visitors type is required. */ | 'VISITORS_TYPE_EMPTY' /** Visitors type is invalid. */ | 'VISITORS_TYPE_INVALID' /** Frequency is required. */ | 'FREQUENCY_EMPTY' /** Frequency is invalid. */ | 'FREQUENCY_INVALID' /** Delay must be a positive number. */ | 'DELAY_NEGATIVE' /** * Matching page has invalid format. * args: page - the invalid matching page value. */ | 'MATCHING_PAGE_INVALID' /** Status is required. */ | 'STATUS_EMPTY' /** Status is invalid. */ | 'STATUS_INVALID' /** * Per page cannot be greater than 100. * args: max_per_page - the maximum allowed value of per_page. */ | 'PER_PAGE_TOO_LARGE' /** Popup Form not found. */ | 'POPUP_FORM_NOT_FOUND' /** Popup Form is already draft. */ | 'POPUP_FORM_ALREADY_DRAFT' /** Popup Form is already active. */ | 'POPUP_FORM_ALREADY_ACTIVE' /** Popup Form is already paused. */ | 'POPUP_FORM_ALREADY_PAUSED' /** filter_expression and filter_code are mutually exclusive. */ | 'FILTER_AUDIENCE_MUTUALLY_EXCLUSIVE' /** filter_expression is not a valid filter expression. */ | 'FILTER_EXPRESSION_INVALID' /** filter_code does not reference an existing saved segment. */ | 'FILTER_CODE_SEGMENT_NOT_FOUND' /** filter_expression contains geo conditions, which are not supported for web popups. */ | 'FILTER_EXPRESSION_GEO_NOT_SUPPORTED' /** Subscription form code is invalid. */ | 'SUBSCRIPTION_FORM_CODE_INVALID' /** Subscription form code is required. */ | 'SUBSCRIPTION_FORM_CODE_EMPTY' /** * Excluded page path has invalid format. * args: page - the invalid excluded page path value. */ | 'EXCLUDED_PAGE_INVALID' /** * Excluded page operator is invalid (allowed: EQUALS, STARTS_WITH). * args: operator - the invalid operator value. */ | 'EXCLUDED_PAGE_OPERATOR_INVALID' /** * Too many excluded pages. * args: max - the maximum allowed number of excluded pages. */ | 'EXCLUDED_PAGES_TOO_MANY' /** excluded_pages cannot be combined with a non-empty matching_pages list. */ | 'EXCLUDED_PAGES_NOT_ALLOWED_WITH_SPECIFIED_PAGES' /** * Matching page rule operator is invalid (allowed: EQUALS, STARTS_WITH). * args: operator - the invalid operator value. */ | 'MATCHING_PAGE_RULE_OPERATOR_INVALID' /** * Too many matching page rules. * args: max - the maximum allowed number of matching page rules. */ | 'MATCHING_PAGE_RULES_TOO_MANY' /** Popup Form trigger type is required. */ | 'TRIGGER_TYPE_EMPTY' /** Popup Form trigger type is invalid (allowed: PAGE_LOAD, API). */ | 'TRIGGER_TYPE_INVALID'; export type PopupFormsService_List = RpcMethod; export type PopupFormsService_Get = RpcMethod; export type PopupFormsService_Create = RpcMethod; export type PopupFormsService_Update = RpcMethod; export type PopupFormsService_Delete = RpcMethod; export type PopupFormsService_Deactivate = RpcMethod; export type PopupFormsService_Activate = RpcMethod; export interface PopupFormsService { /** Lists web popup forms for an application code, newest-published first, with paging, name/code search and an optional status filter; each item carries visitor and impression counts. Use to browse popup forms or find a popup form code before fetching details. */ List: PopupFormsService_List; /** Returns a single web popup form by its popup form code, including status, display rules, audience targeting and the associated content and subscription form. Use after list_popup_forms to inspect one form's full configuration. */ Get: PopupFormsService_Get; /** Creates a new web popup form under an application code from a popup form content code, optionally referencing a subscription form as well, returning the server-generated popup form code. The name must be unique within the application. */ Create: PopupFormsService_Create; /** Updates an existing web popup form by code, patching name, display rules, audience and page rules per explicit update_* flags. Use to change an existing form's configuration. */ Update: PopupFormsService_Update; /** Permanently deletes a web popup form by its popup form code. Irreversible; use disable_popup_form instead to only pause a form while keeping it. */ Delete: PopupFormsService_Delete; /** Deactivates a web popup form by code, setting its status to paused so it stops showing to visitors. Reversible via enable_popup_form; errors if the form is already paused. */ Deactivate: PopupFormsService_Deactivate; /** Activates a web popup form by code, setting its status to active and stamping its published time so it starts showing to visitors. Reversible via disable_popup_form; errors if the form is already active. */ Activate: PopupFormsService_Activate; } /** * PageRule is a single "do not show on this page" rule. operator is a * string ("EQUALS" | "STARTS_WITH") to match the other categorical fields. */ export type PageRule = { /** Page path, e.g. "/checkout" or "/account". */ path: string; /** Match operator: "EQUALS" (exact path) or "STARTS_WITH" (path prefix). */ operator: string; }; export type PopupForm = { /** Popup Form code. */ code: string; /** Name of Popup Form. */ name: string; /** Description of Popup Form. */ description?: string; /** Status of Popup Form (active, paused, draft). */ status: string; /** Code of associated Popup Form Content. Always set. */ popupFormContentCode: string; /** Name of associated Popup Form Content. */ popupFormContentName: string; /** Code of associated subscription form. Optional, accompanies the content. */ subscriptionFormCode: string; /** Name of associated subscription form. */ subscriptionFormName: string; /** Device type (all, mobile, desktop). */ deviceType: string; /** Visitors type (all, new, returning). */ visitorsType: string; /** Matching pages for display rules. Empty list means no page restrictions. */ matchingPages: string[]; /** Delay in seconds before showing the Popup Form. */ delay: number; /** Frequency of showing (once, every_visit, once_per_session). */ frequency: string; /** Timestamp when Popup Form was published (activated). */ published: Date; /** Popup Form created timestamp. */ created: Date; /** Popup Form updated timestamp. */ updated: Date; /** * Inline audience filter (custom conditions: tags + userId). * Mutually exclusive with filter_code. */ filterExpression: pushwoosh_objects_filters_v1_FilterExpression; /** * Code of a saved Pushwoosh segment used for audience targeting. * Mutually exclusive with filter_expression. */ filterCode: string; /** * Pages to suppress the popup on. Only meaningful when matching_pages is empty * (i.e. the popup targets all pages). Empty list means no exclusions. */ excludedPages: PageRule[]; /** * Operator-aware "Specified pages" include list ({path, operator}, reuses the * PageRule shape). Superset of the legacy matching_pages, which is kept in * sync (= rule paths) for older SDKs. Empty means no page restrictions. */ matchingPageRules: PageRule[]; /** * Trigger type: "PAGE_LOAD" (shown automatically on page load) or * "API" (shown only on an explicit WebSDK call). */ triggerType: string; }; export type ListRequest_OrderBy = 'PUBLISHED' | 'NAME'; export type ListRequest_OrderDirection = 'DESC' | 'ASC'; export type ListRequest = { /** Application code to filter by. */ application?: string; /** Search query to filter by name or code. */ search?: string; /** Optional status filter. */ status?: string; /** Field to order results by. */ orderBy?: ListRequest_OrderBy; /** Order direction. */ orderDirection?: ListRequest_OrderDirection; /** Page number. Pagination starts from 0. */ page?: number; /** Number of items per page. */ perPage?: number; }; export type ListResponse_ListItem = { /** Similar to the PopupForm. */ code: string; /** Similar to the PopupForm. */ name: string; /** Similar to the PopupForm. */ description?: string; /** Similar to the PopupForm. */ status: string; /** Number of visitors. */ visitors: number; /** Number of impressions. */ impressions: number; /** Similar to the PopupForm. */ updated: Date; }; export type ListResponse = { /** List of Popup Forms for the current page. */ items: ListResponse_ListItem[]; /** Current page number. Pagination starts from 0. */ page: number; /** Number of items per page. */ perPage: number; /** Total number of pages. */ totalPages: number; /** Total number of items across all pages. */ total: number; }; export type GetRequest = { /** Similar to the PopupForm. */ code?: string; }; export type GetResponse = { /** Popup Form. */ item: PopupForm; }; export type CreateRequest = { /** Application code to which Popup Form belongs. */ application?: string; /** Similar to the PopupForm. */ name?: string; /** Similar to the PopupForm. */ description?: string; /** Similar to the PopupForm. Required. */ popupFormContentCode?: string; /** Similar to the PopupForm. Optional. */ subscriptionFormCode?: string; /** Similar to the PopupForm. */ deviceType?: string; /** Similar to the PopupForm. */ visitorsType?: string; /** Similar to the PopupForm. */ matchingPages?: string[]; /** Similar to the PopupForm. */ delay?: number; /** Similar to the PopupForm. */ frequency?: string; /** Similar to the PopupForm. */ status?: string; /** Similar to the PopupForm. Mutually exclusive with filter_code. */ filterExpression?: pushwoosh_objects_filters_v1_FilterExpression; /** Similar to the PopupForm. Mutually exclusive with filter_expression. */ filterCode?: string; /** Similar to the PopupForm. Only allowed when matching_pages is empty. */ excludedPages?: PageRule[]; /** * Similar to the PopupForm. Operator-aware include list; when set it supersedes * matching_pages (which is kept in sync = rule paths). */ matchingPageRules?: PageRule[]; /** Similar to the PopupForm. */ triggerType?: string; }; export type CreateResponse = { /** Similar to the PopupForm. */ code: string; }; export type UpdateRequest = { /** Similar to the PopupForm. */ code?: string; /** Similar to the PopupForm. */ name?: string; /** Similar to the PopupForm. */ description?: string; /** Similar to the PopupForm. Updates the referenced content. */ popupFormContentCode?: string; /** Similar to the PopupForm. Updates the referenced subscription form. */ subscriptionFormCode?: string; /** Similar to the PopupForm. */ deviceType?: string; /** Similar to the PopupForm. */ visitorsType?: string; /** * Controls how matching_pages is applied (PATCH semantics): * - true → replace matching_pages with the provided list. * - false → do not touch matching_pages. * Required because proto3 cannot distinguish an unset repeated field from one explicitly set to an empty list. */ updateMatchingPages?: boolean; /** Similar to the PopupForm. Only applied when update_matching_pages is true. */ matchingPages?: string[]; /** Similar to the PopupForm. */ delay?: number; /** Similar to the PopupForm. */ frequency?: string; /** Similar to the PopupForm. */ status?: string; /** * Controls how the audience fields are applied (PATCH semantics): * - true → replace audience with filter_expression / filter_code below * (both empty → clear audience, i.e. "all users"). * - false → do not touch audience. * Required because proto3 cannot distinguish an unset audience from a cleared one. */ updateAudience?: boolean; /** Similar to the PopupForm. Only applied when update_audience is true. */ filterExpression?: pushwoosh_objects_filters_v1_FilterExpression; /** Similar to the PopupForm. Only applied when update_audience is true. */ filterCode?: string; /** * Controls how excluded_pages is applied (PATCH semantics): * - true → replace excluded_pages with the provided list. * - false → do not touch excluded_pages. * Required because proto3 cannot distinguish an unset repeated field from one explicitly set to an empty list. */ updateExcludedPages?: boolean; /** Similar to the PopupForm. Only applied when update_excluded_pages is true. */ excludedPages?: PageRule[]; /** * Controls how matching_page_rules is applied (PATCH semantics): * - true → replace matching_page_rules (and the synced legacy matching_pages). * - false → do not touch them. */ updateMatchingPageRules?: boolean; /** Similar to the PopupForm. Only applied when update_matching_page_rules is true. */ matchingPageRules?: PageRule[]; /** Similar to the PopupForm. */ triggerType?: string; }; export type UpdateResponse = {}; export type DeleteRequest = { /** Similar to the PopupForm. */ code?: string; }; export type DeleteResponse = {}; export type DeactivateRequest = { /** Similar to the PopupForm. */ code?: string; }; export type DeactivateResponse = {}; export type ActivateRequest = { /** Similar to the PopupForm. */ code?: string; }; export type ActivateResponse = {};