/** * Represents the textual content of an app card. * * This model contains the title and description text that is displayed in the app card. */ export class InsiderAppCardContent { /** Main title text of the app card. */ readonly title: string; /** Description text of the app card. */ readonly description: string; } /** * Represents an image associated with an app card. * * This model contains the image URL to be displayed in the app card. */ export class InsiderAppCardImage { /** URL of the image to be displayed. */ readonly url: string; } /** * Represents a category associated with an app card. * * This model contains the identifier and name of a category assigned to the app card. */ export class InsiderAppCardCategory { /** Unique identifier for the category. */ readonly id: number; /** Name of the category. */ readonly name: string; } /** * Represents an action button within an app card. * * This model defines a button that can be displayed in an app card, containing text and an * associated action that is executed when the button is tapped. */ export class InsiderAppCardButton { /** Unique identifier for the button. */ readonly id: string; /** Identifier of the app card this button belongs to. */ readonly appCardId: string; /** Display text shown on the button. */ readonly text: string; /** Action to be executed when the button is tapped. */ readonly action?: InsiderAppCardAction; /** Handles the button click action. */ click(): void; } /** * Action type values for app card actions. * * - `"deep_link"`: deeplink navigation * - `"open_settings"`: open system app settings * - `"feedback"`: feedback action */ export type InsiderAppCardActionType = "deep_link" | "open_settings" | "feedback" /** * Defines the interface for app card actions. * * Conforming types represent different actions that can be executed when a user interacts * with an app card or button, such as opening a deeplink or navigating to app settings. */ export class InsiderAppCardAction { /** Type of the action (deeplink, open settings, or feedback). */ readonly type: InsiderAppCardActionType; } /** * Deeplink type values. * * - `"external"`: external URL * - `"internal"`: internal app navigation * - `"url_scheme"`: URL scheme * - `"unknown"`: unknown type */ export type InsiderAppCardDeeplinkType = "external" | "internal" | "url_scheme" | "unknown" /** * Represents a deeplink action that navigates to a specific location in the app or external URL. * * This action model contains the data needed to construct and execute a deeplink navigation, * including key-value pairs that define the deeplink parameters. */ export class InsiderAppCardDeeplinkAction extends InsiderAppCardAction { /** Key-value data containing deeplink related parameters. */ readonly keysAndValues: { key: string; value: string }[]; /** The deeplink type. */ readonly deeplinkType: InsiderAppCardDeeplinkType; /** The deeplink URL. */ readonly url: string | null; /** The parsed JSON data, or null if not available. */ readonly json: any | null; } /** * Represents an action that opens the app's settings. */ export class InsiderAppCardOpenSettingsAction extends InsiderAppCardAction { } /** * Represents a feedback action. */ export class InsiderAppCardFeedbackAction extends InsiderAppCardAction { } /** * App card type values. * * - `"message"`: text-based app card * - `"image"`: image-based app card */ export type InsiderAppCardType = "message" | "image" /** * Represents a single app card. * * This model contains all the data for an app card, including its content, * images, buttons, and associated actions. App cards can be either text-based or image-based. */ export class InsiderAppCard { /** Unique identifier for the app card. */ readonly id: string; /** Type of the app card (text or image). */ readonly type: InsiderAppCardType; /** Flag indicating whether the app card has been read by the user. */ readonly isRead: boolean; /** Array of images associated with the app card. */ readonly images?: InsiderAppCardImage[]; /** Array of categories associated with the app card. Always present (empty when the card has none). */ readonly categories: InsiderAppCardCategory[]; /** Content model containing the title and description of the app card. */ readonly content?: InsiderAppCardContent; /** Array of action buttons that can be displayed with the app card. */ readonly buttons?: InsiderAppCardButton[]; /** * Action to be executed when the app card is tapped. */ readonly action?: InsiderAppCardAction; /** Marks the app card as read. */ markAsRead(completion: (error?: Error) => void): void; /** Marks the app card as read and returns a promise. */ markAsRead(): Promise; /** Marks the app card as unread. */ markAsUnread(completion: (error?: Error) => void): void; /** Marks the app card as unread and returns a promise. */ markAsUnread(): Promise; /** Deletes the app card. */ delete(completion: (error?: Error) => void): void; /** Deletes the app card and returns a promise. */ delete(): Promise; /** Views the app card. */ view(): void; /** Handles the app card click action. */ click(): void; } /** * Represents the campaign response containing all app cards. * * This model is the root container for app cards data, holding an array of app card models * that can be displayed in the app cards UI. */ export class InsiderAppCardsCampaignResponse { /** * Array of app cards. * * Contains all app cards retrieved from the campaigns, including both read and unread app cards. */ readonly appCards: InsiderAppCard[]; }