import { RpcMethod } from './commonTypes'; export type RichMediaService_Create = RpcMethod; export type RichMediaService_CreateNative = RpcMethod; export type RichMediaService_UpdateNative = RpcMethod; export type RichMediaService_Clone = RpcMethod; export type RichMediaService_Delete = RpcMethod; export type RichMediaService_Get = RpcMethod; export type RichMediaService_GetBlockTemplate = RpcMethod; export type RichMediaService_SaveBlockTemplate = RpcMethod; export type RichMediaService_List = RpcMethod; export type RichMediaService_GetDetailedStatistics = RpcMethod; export type RichMediaService_GetDetailedActionStatistics = RpcMethod; export type RichMediaService_GetSendChannels = RpcMethod; export type RichMediaService_GetDevices = RpcMethod; export type RichMediaService_GetEvents = RpcMethod; export interface RichMediaService { /** Creates a new rich media for the account, either block-based (built from an empty template) or from an uploaded base64 zip; the server persists it and returns the generated rich media code. Use for HTML/zip rich media; use create_native_rich_media for SDK-rendered native content. */ Create: RichMediaService_Create; /** Creates a new native (SDK-rendered) rich media from a native-config.json content object plus localizations, returning the generated rich media code. Use for native display types (modal, carousel, stories, etc.); use create_rich_media for HTML/zip content. */ CreateNative: RichMediaService_CreateNative; /** Replaces the content, name and localizations of an existing native rich media identified by code. Fails if the rich media is not of the NATIVE created type; use save_rich_media_block_template for HTML/block-based content. */ UpdateNative: RichMediaService_UpdateNative; /** Duplicates an existing rich media (by code) under a new name, copying its content, and returns the new rich media code. Use to start a new rich media from an existing one without editing the original. */ Clone: RichMediaService_Clone; /** Permanently deletes a rich media by code, removing its DB record and content files. Rejected if any in-app message still references it; detach those in-apps first. */ Delete: RichMediaService_Delete; /** Returns a single rich media by code, including its rendered content (index.html or native-config.json), params, created type and metadata. Use to inspect one rich media; use list_rich_medias to browse. */ Get: RichMediaService_Get; /** Returns the block-editor payload of a rich media by code: html, editor_json, params, input_groups and default language extracted from its zip. Use to load a rich media into the block/AI builder for editing. */ GetBlockTemplate: RichMediaService_GetBlockTemplate; /** Saves block/AI-builder rich media content (html, editor_json, localization) for an existing rich media code, overwriting its stored zip. Rejects native rich media (use update_native_rich_media instead). */ SaveBlockTemplate: RichMediaService_SaveBlockTemplate; /** Lists an account's rich medias with paging, free-text search over name and code, category filter, and last-month aggregate metrics per item. Use to browse rich medias or find a code before fetching details or statistics. */ List: RichMediaService_List; /** Returns time-series show/interaction/skip metrics for one rich media (by code) over a date range, broken down by platform and aggregation interval, plus frequency-capping suppression counts. Use for the rich media statistics chart. */ GetDetailedStatistics: RichMediaService_GetDetailedStatistics; /** Returns per-element (element_id/path) action counts for a rich media by code over a date range, split by action type (click, form submit, open, close) and platform. Use to see which elements users interacted with. */ GetDetailedActionStatistics: RichMediaService_GetDetailedActionStatistics; /** Lists the send channels (in-app, journey, push messages) that used a rich media by code over a date range, with per-channel triggered counts, paged. Use to see where a rich media was delivered. */ GetSendChannels: RichMediaService_GetSendChannels; /** Lists the devices (hwid, platform, open time) that were shown a rich media by code over a date range, paged. Use to inspect the exact devices that saw a rich media. */ GetDevices: RichMediaService_GetDevices; /** Returns per-event triggered and unique-triggered counts fired from within a rich media by code over a date range, by platform. Use to measure custom events emitted by a rich media's content. */ GetEvents: RichMediaService_GetEvents; } export type ActionType = 'ACTION_TYPE_UNSPECIFIED' | 'ELEMENT_CLICK' | 'FORM_SUBMIT' | 'OPEN' | 'CLOSE'; export type RichMediaSendChannel = 'RichMediaSendChannel_UNDEFINED' | 'IN_APP' | 'CJ' | 'PUSH'; export type AggregationInterval = 'HOUR' | 'DAY' | 'WEEK' | 'MONTH'; export type Metrics_SessionDuration = { secondFrom: number; secondTo: number; count: number; }; export type Metrics = { shown: number; interaction: number; sessionDurations: Metrics_SessionDuration[]; skipped: number; uniqueShown: number; uniqueInteraction: number; }; export type RichMedia_CreatedType = 'UNDEFINED' | 'TEMPLATE' | 'BUILDER' /** * Built with the AI (smart-blocks) builder; `editor_json` carries the * AiBuilderDocument JSON instead of an Unlayer design. */ | 'SMARTCARDS' /** Rendered natively by the SDK from native-config.json (no HTML). */ | 'NATIVE'; export type RichMedia = { code: string; name: string; /** * For NATIVE created type — the JSON from native-config.json; * for all other created types — the HTML from index.html. */ content: string; params: string; baseUrl: string; isSystem: boolean; isGdpr: boolean; application: string; defaultLanguage: string; hasRightAceModify: boolean; createdDate: Date; updateDate: Date; createdType: RichMedia_CreatedType; categories: string[]; closeButtonType: boolean; }; export type GetRequest = { /** Application code (format XXXXX-XXXXX). */ application?: string; /** Rich media code to fetch. */ code?: string; }; export type GetResponse = { richMedia: RichMedia; }; export type ListRequest_ListView = 'LIST' | 'TILES'; export type ListRequest_OrderBy = 'CREATED_DATE'; export type ListRequest_OrderType = 'ASC' | 'DESC'; export type ListRequest = { /** Free-text search over rich media name and code. */ search?: string; /** Application code (format XXXXX-XXXXX); scopes metrics. */ application?: string; viewType?: ListRequest_ListView; withMetrics?: boolean; withContent?: boolean; /** Restrict to rich medias in these categories. */ searchByCategory?: string[]; /** Restrict to these rich media codes. */ codes?: string[]; orderBy?: ListRequest_OrderBy; orderType?: ListRequest_OrderType; page?: number; perPage?: number; }; export type ListResponse_Item = { richMedia: RichMedia; metrics: Metrics; sendChannels: RichMediaSendChannel[]; }; export type ListResponse = { items: ListResponse_Item[]; total: number; }; export type GetDetailedStatisticsRequest = { /** rich media code */ code?: string; application?: string; dateFrom?: Date; dateTo?: Date; /** Restrict stats to these send channels (in-app, journey, push). */ sendChannels?: RichMediaSendChannel[]; /** Restrict stats to these platform ids. */ platforms?: number[]; /** Scope stats to a single message send by its message code. */ messageCode?: string; /** Scope stats to a whole campaign by its campaign code. */ campaignCode?: string; /** Scope stats to a single in-app by its in-app code. */ inAppCode?: string; aggregationInterval?: AggregationInterval; }; export type GetDetailedStatisticsResponse_MetricsWithTimestamp = { timestamp: Date; platform: number; metric: Metrics; }; export type GetDetailedStatisticsResponse = { items: GetDetailedStatisticsResponse_MetricsWithTimestamp[]; totals: GetDetailedStatisticsResponse_MetricsWithTimestamp[]; frequencyCappingSuppressions: number; frequencyCappingUniqueUsers: number; }; export type GetDetailedActionStatisticsRequest = { /** rich media code */ code?: string; application?: string; dateFrom?: Date; dateTo?: Date; /** Restrict stats to these send channels (in-app, journey, push). */ sendChannels?: RichMediaSendChannel[]; /** Restrict stats to these platform ids. */ platforms?: number[]; /** Scope stats to a single message send by its message code. */ messageCode?: string; /** Scope stats to a whole campaign by its campaign code. */ campaignCode?: string; /** Scope stats to a single in-app by its in-app code. */ inAppCode?: string; aggregationInterval?: AggregationInterval; }; export type Action_ActionMetricsWithTimestamp = { timestamp: Date; platform: number; count: number; }; export type Action = { elementId: string; elementPath: string; isSkipped: boolean; actionType: ActionType; metrics: Action_ActionMetricsWithTimestamp[]; }; export type GetDetailedActionStatisticsResponse = { items: Action[]; totals: Action[]; }; export type GetSendChannelsRequest = { /** rich media code */ code?: string; application?: string; dateFrom?: Date; dateTo?: Date; /** Restrict stats to these send channels (in-app, journey, push). */ sendChannels?: RichMediaSendChannel[]; /** Restrict stats to these platform ids. */ platforms?: number[]; /** Scope stats to a single message send by its message code. */ messageCode?: string; /** Scope stats to a whole campaign by its campaign code. */ campaignCode?: string; /** Scope stats to a single in-app by its in-app code. */ inAppCode?: string; page?: number; perPage?: number; }; export type GetSendChannelsResponse_SendChannel = { id: number; code: string; title: string; journeyTitle: string; startDate: Date; channel: RichMediaSendChannel; triggeredCount: number; }; export type GetSendChannelsResponse = { total: number; items: GetSendChannelsResponse_SendChannel[]; }; export type GetDevicesRequest = { /** rich media code */ code?: string; application?: string; dateFrom?: Date; dateTo?: Date; /** Restrict stats to these send channels (in-app, journey, push). */ sendChannels?: RichMediaSendChannel[]; /** Restrict stats to these platform ids. */ platforms?: number[]; /** Scope stats to a single message send by its message code. */ messageCode?: string; /** Scope stats to a whole campaign by its campaign code. */ campaignCode?: string; /** Scope stats to a single in-app by its in-app code. */ inAppCode?: string; page?: number; perPage?: number; }; export type GetDevicesResponse_Device = { hwid: string; platform: number; openTime: Date; }; export type GetDevicesResponse = { total: number; items: GetDevicesResponse_Device[]; }; export type GetEventsRequest = { /** rich media code */ code?: string; application?: string; dateFrom?: Date; dateTo?: Date; /** Restrict stats to these send channels (in-app, journey, push). */ sendChannels?: RichMediaSendChannel[]; /** Restrict stats to these platform ids. */ platforms?: number[]; /** Scope stats to a single message send by its message code. */ messageCode?: string; /** Scope stats to a whole campaign by its campaign code. */ campaignCode?: string; /** Scope stats to a single in-app by its in-app code. */ inAppCode?: string; }; export type GetEventsResponse_EventStatistics = { name: string; platform: number; triggeredCount: number; uniqTriggeredCount: number; }; export type GetEventsResponse = { items: GetEventsResponse_EventStatistics[]; }; export type CreateRequest_RichMediaType = 'BLOCK_BASED' | 'ZIP'; export type CreateRequest = { /** Name of the rich media. */ name?: string; /** BLOCK_BASED starts an empty block-editor template; ZIP imports from zip_content. */ type?: CreateRequest_RichMediaType; /** Whether the rich media shows a close button. */ closeButtonType?: boolean; /** Base64-encoded zip archive (must contain index.html, or native-config.json + pushwoosh.json). Used only when type is ZIP. */ zipContent?: string; }; export type CreateResponse = { code: string; isBlockBased: boolean; }; export type CreateNativeRequest = { /** Name of rich media. */ name?: string; /** Content of native-config.json: json object with displayType and the matching display block. */ content?: string; /** * Json object of localizations: default texts under the "default" key, extra languages * keyed by language code, e.g. {"default": {...}, "de": {...}}. Legacy payloads with the * default texts keyed by default_language are accepted and normalized on save. */ localization?: string; /** Real language code of the default localization, e.g. "en". */ defaultLanguage?: string; }; export type CreateNativeResponse = { /** Code of the created rich media. */ code: string; }; export type UpdateNativeRequest = { /** Code of the rich media to update. Must be of NATIVE created type. */ code?: string; /** Name of rich media. */ name?: string; /** Content of native-config.json: json object with displayType and the matching display block. */ content?: string; /** * Json object of localizations: default texts under the "default" key, extra languages * keyed by language code, e.g. {"default": {...}, "de": {...}}. Legacy payloads with the * default texts keyed by default_language are accepted and normalized on save. */ localization?: string; /** Real language code of the default localization, e.g. "en". */ defaultLanguage?: string; }; export type UpdateNativeResponse = { /** Code of the updated rich media. */ code: string; }; export type CloneRequest = { /** Rich media code to duplicate. */ code?: string; /** Name for the new cloned rich media. */ name?: string; }; export type CloneResponse = { code: string; isBlockBased: boolean; }; export type DeleteRequest = { /** Rich media code to delete. */ code?: string; }; export type DeleteResponse = {}; export type GetBlockTemplateRequest = { /** Rich media code whose block-editor payload to return. */ code?: string; }; export type GetBlockTemplateResponse = { code: string; content: string; name: string; downloadUrl: string; params: string; defaultLanguage: string; inputGroups: string; editorJson: string; closeButtonType?: boolean; createdType: RichMedia_CreatedType; }; export type SaveBlockTemplateRequest = { /** Rich media code to overwrite. */ code?: string; /** Name of the rich media. */ name?: string; /** Rendered HTML written to index.html; required. */ html?: string; /** Builder design JSON stored in editor.json: an Unlayer design for BUILDER, an AI-builder document for SMARTCARDS. */ editorJson?: string; /** JSON object of per-language texts; required. */ localization?: string; /** Default language code, e.g. "en"; falls back to the first localization key if not present. */ defaultLanguage?: string; styleSettings?: string; /** Whether the rich media shows a close button. */ closeButtonType?: boolean; inputGroups?: string; /** Editor type: TEMPLATE, BUILDER (Unlayer) or SMARTCARDS (AI builder). NATIVE is rejected here. */ createdType?: RichMedia_CreatedType; }; export type SaveBlockTemplateResponse = { code: string; };