/** * A node in a {@link TextBlock} that renders its children as a clickable {@link https://talkjs.com/docs/Guides/JavaScript/Classic/Action_Buttons_Links/ | action button} which triggers a custom action. * * @remarks * By default, users do not have permission to send messages containing action buttons as they can be used maliciously to trick others into invoking custom actions. * For example, a user could send an "accept offer" action button, but disguise it as "view offer". * * @public */ export declare interface ActionButtonNode { readonly type: "actionButton"; /** * The name of the custom action to invoke when the button is clicked. */ readonly action: string; /** * The parameters to pass to the custom action when the button is clicked. */ readonly params: Record; readonly children: TextNode[]; } /** * @public * Provides additional parameters to custom message action or conversation action events. */ export declare interface ActionEventParams { /** * Any number of key/value pairs that will be sent with the action event. * * @remarks * Both the key and the value must be strings. Deeply nested JSON is not supported. * * Add to action buttons in your theme components with the syntax `data-=`, * or to action buttons in messages with the syntax `action?=`. * * @example In a theme * ``` * Red * ``` * * This theme component creates an action button that emits a `color` action event * when you click it, with a parameter called `choice` that takes the value `red`. * * @example In message markup * ``` * * ``` * * This message markup creates an action button that emits a `color` message action event * when you click it, with a parameter called `choice` that takes the value `blue`. */ [key: string]: string; } /** * A node in a {@link TextBlock} that renders its children as a clickable {@link https://talkjs.com/docs/Guides/JavaScript/Classic/Action_Buttons_Links/ | action link} which triggers a custom action. * * @remarks * By default, users do not have permission to send messages containing `ActionLinkNode` as it can be used maliciously to trick others into invoking custom actions. * For example, a user could send an "accept offer" action link, but disguise it as a link to a website. * * @public */ export declare interface ActionLinkNode { readonly type: "actionLink"; /** * The name of the custom action to invoke when the link is clicked. */ readonly action: string; /** * The parameters to pass to the custom action when the link is clicked. */ readonly params: Record; readonly children: TextNode[]; } declare type Attachment = { url: string; size: number; dimensions?: AttachmentDimensions; }; declare type AttachmentDimensions = { width?: number; height?: number; duration?: number; }; /** * A FileBlock variant for an audio attachment, with additional audio-specific metadata. * * @remarks * You can identify this variant by checking for `subtype: "audio"`. * * The same file could be uploaded as either an audio block, or as a {@link VoiceBlock}. * The same data will be available either way, but they will be rendered differently in the UI. * * Includes metadata about the duration of the audio file in seconds, where available. * * Audio files that you upload with the TalkJS UI will include the duration as long as the sender's browser can preview the file. * Audio files that you upload with the REST API or {@link Session.uploadAudio} will include the duration if you specified it when uploading. * Audio files attached in a reply to an email notification will not include the duration. * * @public */ export declare interface AudioBlock { readonly type: "file"; readonly subtype: "audio"; /** * An encoded identifier for this file. Use in {@link SendFileBlock} to send this file in another message. */ readonly fileToken: FileToken; /** * The URL where you can fetch the file */ readonly url: string; /** * The size of the file in bytes */ readonly size: number; /** * The name of the audio file, including file extension */ readonly filename: string; /** * The duration of the audio in seconds, if known */ readonly duration?: number; } /** * @public */ export declare interface AudioFileMetadata { /** * The name of the file including extension. */ filename: string; /** * The duration of the audio file in seconds, if known. */ duration?: number; } /** * A node in a {@link TextBlock} that renders `text` as a link (HTML ``). * * @remarks * Used when user-typed text is turned into a link automatically. * * Unlike {@link LinkNode}, users do have permission to send AutoLinkNodes by default, because the `text` and `url` properties must match. * Specifically: * * - If `text` is an email, `url` must contain a `mailto:` link to the same email address * * - If `text` is a phone number, `url` must contain a `tel:` link to the same phone number * * - If `text` is a website, the domain name including subdomains must be the same in both `text` and `url`. * If `text` includes a protocol (such as `https`), path (/page), query string (?page=true), or url fragment (#title), they must be the same in `url`. * If `text` does not specify a protocol, `url` must use either `https` or `http`. * * This means that the following AutoLink is valid: * * ```json * { * type: "autoLink", * text: "talkjs.com" * url: "https://talkjs.com/docs/JavaScript_Data_API/Message_Content/#AutoLinkNode" * } * ``` * * That link will appear as `talkjs.com` and link you to the specific section of the documentation that explains how AutoLinkNodes work. * * These rules ensure that the user knows what link they are clicking, and prevents AutoLinkNode being used for phishing. * If you try to send a message containing an AutoLink that breaks these rules, the request will be rejected. * * @public */ export declare interface AutoLinkNode { readonly type: "autoLink"; /** * The URL to open when a user clicks this node. */ readonly url: string; /** * The text to display in the link. */ readonly text: string; } /** * @public * @hidden due to being empty * @deprecated Use `chatbox.onBlur(() => {...})` instead, without an event parameter. */ export declare interface BlurEvent { } /** * Sent by {@link Session.onBrowserPermissionDenied} when the user tried to do * an action that require explicit browser permission, but it was denied. * * @public */ export declare interface BrowserPermissionDeniedEvent { /** * The type of permission that was denied. * * @remarks * Note that more possible values may be added in the future, so make sure your * handler can deal with unknown permission types gracefully. */ type: PermissionType; } /** * Sent by {@link Session.onBrowserPermissionNeeded} when a browser permission * dialog is about to be shown to the user. * * @public */ export declare interface BrowserPermissionNeededEvent { /** * The type of permission requested. * * @remarks * Note that more possible values may be added in the future, so make sure your * handler can deal with unknown permission types gracefully. */ type: PermissionType; /** * Cancel whatever user action caused the permission to be requested. * * @remarks * For example, if a user wants to share their location for the first time so * that this event is triggered, then if you call `preventDefault()`, no * permission will be requested from the browser, the location sharing will be * cancelled, and TalkJS will continue as if the location sharing button had * not been clicked at all. * * This may be useful if you're using this event to show custom UI elements * that nudge users towards granting permission, and this UI has a "cancel" * button. */ preventDefault(): void; } /** * A node in a {@link TextBlock} that adds indentation for a bullet-point list around its children (HTML `