/*! Tripetto Chat Runner 4.1.6 - Copyright (C) 2023 Tripetto B.V. - All Rights Reserved */ declare module "tripetto-runner-chat" { import * as TripettoChat from "tripetto-runner-chat/module"; export * from "tripetto-runner-chat/module"; export { TripettoChat }; export default TripettoChat; } declare module "tripetto-runner-chat/module" { import { CSSProperties, FocusEvent, ReactNode } from "react"; import { TAvataaarsClothing } from "tripetto-runner-fabric/components/avataaars/clothing"; import { TAvataaarsClothingFabric } from "tripetto-runner-fabric/components/avataaars/clothing/fabric"; import { TAvataaarsClothingGraphic } from "tripetto-runner-fabric/components/avataaars/clothing/graphic"; import { TAvataaarsEyebrow } from "tripetto-runner-fabric/components/avataaars/face/eyebrow"; import { TAvataaarsEyes } from "tripetto-runner-fabric/components/avataaars/face/eyes"; import { TAvataaarsMouth } from "tripetto-runner-fabric/components/avataaars/face/mouth"; import { TAvataaarsSkin } from "tripetto-runner-fabric/components/avataaars/skin"; import { TAvataaarsTop } from "tripetto-runner-fabric/components/avataaars/top"; import { TAvataaarsAccessories } from "tripetto-runner-fabric/components/avataaars/top/accessories"; import { TAvataaarsFacialHair, TAvataaarsFacialHairColor } from "tripetto-runner-fabric/components/avataaars/top/facial-hair"; import { TAvataaarsHairColor } from "tripetto-runner-fabric/components/avataaars/top/hair"; import { TAvataaarsHatColor } from "tripetto-runner-fabric/components/avataaars/top/hat"; import { TOverlayContext } from "tripetto-runner-fabric/overlay"; import { IDefinition, ISnapshot, Instance, L10n, NodeBlock, TL10n, TStyles } from "tripetto-runner-foundation"; import { IRunnerAttachments, IRunnerProps, TRunnerPreviewData, TRunnerViews } from "tripetto-runner-react-hook"; import styled from "styled-components"; export interface IChatStyles extends TStyles { readonly display?: "inline" | "button" | "page"; readonly color?: string; readonly autoOpen?: boolean; readonly autoFocus?: boolean; readonly showScrollbar?: boolean; readonly fullWidth?: boolean; readonly noBranding?: boolean; readonly font?: { readonly family?: string; readonly size?: number; readonly sizeSmall?: number; }; readonly background?: { readonly color?: string; readonly url?: string; readonly opacity?: number; readonly positioning?: "auto" | "100% auto" | "auto 100%" | "cover" | "contain" | "repeat"; }; readonly avatar?: { readonly type?: "avataaar" | "image"; readonly image?: string; readonly skin?: TAvataaarsSkin; readonly eyes?: TAvataaarsEyes; readonly eyeBrow?: TAvataaarsEyebrow; readonly mouth?: TAvataaarsMouth; readonly top?: TAvataaarsTop; readonly hairColor?: TAvataaarsHairColor; readonly hatColor?: TAvataaarsHatColor; readonly facialHair?: TAvataaarsFacialHair; readonly facialHairColor?: TAvataaarsFacialHairColor; readonly clothing?: TAvataaarsClothing; readonly clothingFabric?: TAvataaarsClothingFabric; readonly clothingGraphic?: TAvataaarsClothingGraphic; readonly accessories?: TAvataaarsAccessories; }; readonly questions?: { readonly alignment?: "left" | "right"; readonly roundness?: number; readonly backgroundColor?: string; readonly borderColor?: string; readonly textColor?: string; }; readonly answers?: { readonly alignment?: "left" | "right"; readonly roundness?: number; readonly backgroundColor?: string; readonly borderColor?: string; readonly textColor?: string; readonly avatarImage?: string; }; readonly chatButton?: { readonly color?: string; readonly image?: string; }; readonly inputs?: { readonly backgroundColor?: string; readonly borderColor?: string; readonly borderSize?: number; readonly roundness?: number; readonly textColor?: string; readonly errorColor?: string; readonly agreeColor?: string; readonly declineColor?: string; readonly selectionColor?: string; }; readonly buttons?: { readonly baseColor?: string; readonly textColor?: string; readonly roundness?: number; readonly mode?: "fill" | "outline"; }; } export interface IRuntimeStyles extends IChatStyles { readonly font: { readonly family: string; readonly size: number; readonly sizeSmall: number; }; readonly background: { readonly color: string; readonly opacity: number; readonly url?: string; readonly positioning?: "auto" | "100% auto" | "auto 100%" | "cover" | "contain" | "repeat"; }; readonly questions: { readonly alignment: "left" | "right"; readonly roundness: number | undefined; readonly backgroundColor: string; readonly borderColor?: string; readonly textColor: string; }; readonly answers: { readonly alignment: "left" | "right"; readonly roundness: number | undefined; readonly backgroundColor?: string; readonly borderColor?: string; readonly textColor: string; readonly avatarImage?: string; }; readonly inputs: { readonly backgroundColor: string; readonly borderColor: string; readonly borderSize: number; readonly roundness: number | undefined; readonly textColor: string; readonly errorColor: string; readonly scale: number; }; readonly checkboxes: { readonly backgroundColor: string; readonly borderColor: string; readonly borderSize: number; readonly roundness: number | undefined; readonly textColor: string; readonly errorColor: string; readonly scale: number; }; readonly radiobuttons: { readonly backgroundColor: string; readonly borderColor: string; readonly borderSize: number; readonly textColor: string; readonly scale: number; }; readonly matrix: { readonly backgroundColor: string; readonly borderColor: string; readonly borderSize: number; readonly textColor: string; readonly errorColor: string; readonly scale: number; }; readonly yesNo: { readonly yesColor: string; readonly noColor: string; readonly outlineSize: number; readonly roundness: number | undefined; readonly scale: number; readonly margin: number; readonly alignment: "horizontal" | "vertical"; }; readonly rating: { readonly color: string; readonly scale: number; }; readonly scale: { readonly color: string; readonly outlineSize: number; readonly roundness: number | undefined; readonly scale: number; readonly margin: number; readonly labelColor: string; }; readonly multipleChoice: { readonly color: string; readonly outlineSize: number; readonly roundness: number | undefined; readonly scale: number; readonly margin: number; }; readonly pictureChoice: { readonly color: string; readonly outlineSize: number; readonly roundness: number | undefined; readonly scale: number; readonly margin: number; }; readonly fileUpload: { readonly backgroundColor: string; readonly borderColor: string; readonly borderSize: number; readonly roundness: number | undefined; readonly textColor: string; readonly errorColor: string; readonly scale: number; }; readonly buttons: { readonly baseColor: string; readonly textColor: string | undefined; readonly outlineSize: number; readonly roundness: number | undefined; readonly mode: "fill" | "outline"; readonly scale: number; }; readonly chatButton: { readonly color: string; readonly image?: string; }; } export interface IChatRenderProps { readonly id: string; readonly l10n: L10n.Namespace; readonly styles: IRuntimeStyles; readonly overlay: TOverlayContext; readonly view: TRunnerViews; readonly name: JSX.Element | undefined; readonly description: JSX.Element | undefined; readonly explanation: JSX.Element | undefined; readonly label: JSX.Element | undefined; readonly placeholder: string; readonly submitLabel: string; readonly isFailed: boolean; readonly ariaDescribedBy: string | undefined; readonly ariaDescription: JSX.Element | undefined; readonly focus: (e: FocusEvent) => T; readonly blur: (e: FocusEvent) => T; readonly autoFocus: (element: HTMLElement | null) => void; readonly attachments: IRunnerAttachments | undefined; readonly markdownifyToJSX: (md: string, lineBreaks?: boolean) => JSX.Element; readonly markdownifyToURL: (md: string) => string; readonly markdownifyToImage: (md: string) => string; readonly markdownifyToString: (md: string) => string; } export interface IChatRendering extends NodeBlock { readonly required?: boolean; readonly question?: (props: IChatRenderProps) => ReactNode; readonly answer?: (props: IChatRenderProps) => ReactNode; readonly input?: (props: IChatRenderProps, done?: () => void, cancel?: () => void) => ReactNode; } export interface IChatSnapshot { /** Contains the key of the active item. */ readonly a?: string; /** Contains focus information. */ readonly b?: { [key: string]: false | true | undefined; }; /** Contains if the chat was visible or not. */ readonly c?: boolean; /** Contains the email address that was used to pause. */ readonly d?: string; /** Contains a timestamp of the snapshot. */ readonly e?: number; } export interface IChatController { definition: IDefinition; styles: IChatStyles; l10n: TL10n; view: TRunnerViews; readonly instance: Instance | undefined; readonly fingerprint: string; readonly snapshot: ISnapshot | undefined; readonly isRunning: boolean; readonly isFinishing: boolean; readonly isPausing: boolean; readonly allowStart: boolean; readonly allowRestart: boolean; readonly allowPause: boolean; readonly allowStop: boolean; readonly start: () => void; readonly restart: () => void; readonly pause: () => ISnapshot | Promise> | undefined; readonly stop: () => void; readonly doPreview: (data: TRunnerPreviewData) => void; readonly openChat: () => void; readonly closeChat: () => void; } export type TChatDisplay = "inline" | "button" | "page"; export type TChatPause = | { readonly recipe: "email"; readonly onPause: ( emailAddress: string, snapshot: ISnapshot, language: string, locale: string, namespace: string ) => Promise | boolean | void; } | ((snapshot: ISnapshot, language: string, locale: string, namespace: string) => Promise | boolean | void); export interface IChatProps extends IRunnerProps { readonly styles?: IChatStyles; readonly l10n?: TL10n; readonly view?: TRunnerViews; readonly display?: TChatDisplay; readonly controller?: [IChatController | undefined]; readonly className?: string; readonly customStyle?: CSSProperties; readonly customCSS?: string; readonly onL10n?: (l10n: TL10n) => Promise; readonly onReload?: () => IDefinition | Promise; readonly onEdit?: (type: "prologue" | "epilogue" | "styles" | "l10n" | "block", id?: string) => void; readonly onPause?: TChatPause; readonly onTouch?: () => void; } export const ChatRunner: (props: IChatProps) => JSX.Element; export interface IChat { /** Specifies the parent element for the runner. */ readonly element?: HTMLElement | null; /** Specifies the definition to run. */ readonly definition?: IDefinition | Promise; /** Specifies the snapshot that should be restored. */ readonly snapshot?: ISnapshot | Promise | undefined>; /** Specifies the styles. */ readonly styles?: IChatStyles | Promise; /** Specifies the localization information. */ readonly l10n?: TL10n | Promise; /** Specifies the view mode. */ readonly view?: TRunnerViews; /** Specifies the chat display mode. */ readonly display?: TChatDisplay; /** Try to store sessions in the local store to preserve persistency on navigation between multiple pages that host the runner. */ readonly persistent?: boolean; /** Specifies a custom class name for the runner element. */ readonly className?: string; /** Specifies the inline style for the runner element. */ readonly customStyle?: CSSProperties; /** * Specifies custom CSS rules. * To specify rules for a specific block, use this selector: [data-block=""] { ... } */ readonly customCSS?: string; /** Specifies the attachments handler. */ readonly attachments?: IRunnerAttachments; /** Specifies the preferred language (when no language is specified in the definition). */ readonly language?: string; /** Provides locale information. */ readonly locale?: L10n.ILocale | ((locale: string) => L10n.ILocale | Promise | undefined); /** Provides translations. */ readonly translations?: | L10n.TTranslation | L10n.TTranslation[] | (( language: string, name: string, version: string ) => L10n.TTranslation | L10n.TTranslation[] | Promise | undefined); /** Specifies a function that is invoked when the runner is ready. */ readonly onReady?: (instance?: Instance) => void; /** Specifies a function that is invoked when the runner is touched by a user. */ readonly onTouch?: () => void; /** Specifies a function that is invoked when the user performs an action. */ readonly onAction?: ( type: "start" | "stage" | "unstage" | "focus" | "blur" | "pause" | "complete", definition: { readonly fingerprint: string; readonly name: string; }, block?: { readonly id: string; readonly name: string; } ) => void; /** Invoked when data can be imported into the instance. */ readonly onImport?: (instance: Instance) => void; /** Invoked when there is a change. */ readonly onChange?: (instance: Instance) => void; /** Invoked when there is a data change. */ readonly onData?: (instance: Instance) => void; /** Specifies a function that is invoked when the runner wants to pause. */ readonly onPause?: TChatPause; /** Specifies a function that is invoked when the runner submits data. */ readonly onSubmit?: ( instance: Instance, language: string, locale: string, namespace?: string ) => Promise | boolean | void; /** Invoked when the runner is completed (after the data is submitted). */ readonly onComplete?: (instance: Instance, id?: string) => void; /** Invoked when the runner wants to reload the definition. */ readonly onReload?: () => IDefinition | Promise; /** Specifies a function that is invoked when an edit action is requested. */ readonly onEdit?: (type: "prologue" | "epilogue" | "styles" | "l10n" | "block", id?: string) => void; /** Specifies a function that is invoked when the runner is destroyed. */ readonly onDestroy?: () => void; } export interface IChatRunner extends IChatController { readonly destroy: () => void; } /** * Bootstraps a new runner. * @param props Specifies the properties for the runner. * @returns Returns a promise to the runner controller. */ export function run(props: IChat): Promise; /** Namespace identifier for the runner. */ export const namespace: string; export { color } from "tripetto-runner-fabric/color"; export { avataaars, IAvataaars } from "tripetto-runner-fabric/components/avataaars"; export { ButtonFabric } from "tripetto-runner-fabric/components/button"; export { CheckboxFabric } from "tripetto-runner-fabric/components/checkbox"; export { CheckboxesFabric, ICheckbox } from "tripetto-runner-fabric/components/checkboxes"; export { DateTimeFabric } from "tripetto-runner-fabric/components/datetime"; export { DropdownFabric, IDropdownFabricOption } from "tripetto-runner-fabric/components/dropdown"; export { EmailFabric } from "tripetto-runner-fabric/components/email"; export { FileFabric, FileThumbnailFabric, IFileController, IFileService } from "tripetto-runner-fabric/components/file"; export { InputFabric } from "tripetto-runner-fabric/components/input"; export { MatrixFabric, IMatrixColumn, IMatrixRow } from "tripetto-runner-fabric/components/matrix"; export { MultiSelectFabric, IMultiSelectOption } from "tripetto-runner-fabric/components/multi-select"; export { MultipleChoiceFabric, IMultipleChoiceButton } from "tripetto-runner-fabric/components/multiple-choice"; export { NumberFabric } from "tripetto-runner-fabric/components/number"; export { PasswordFabric } from "tripetto-runner-fabric/components/password"; export { PhoneNumberFabric } from "tripetto-runner-fabric/components/phone-number"; export { PictureChoiceFabric, IPictureChoiceOption } from "tripetto-runner-fabric/components/picture-choice"; export { RadiobuttonsFabric, IRadiobutton } from "tripetto-runner-fabric/components/radiobuttons"; export { RatingFabric, RatingShapes } from "tripetto-runner-fabric/components/rating"; export { RequiredIndicatorFabric } from "tripetto-runner-fabric/components/required-indicator"; export { ScaleFabric, IScaleNumeric, IScaleOption } from "tripetto-runner-fabric/components/scale"; export { TextFabric } from "tripetto-runner-fabric/components/text"; export { TextareaFabric } from "tripetto-runner-fabric/components/textarea"; export { URLFabric } from "tripetto-runner-fabric/components/url"; export { YesNoFabric, IYesNo } from "tripetto-runner-fabric/components/yes-no"; export { styled }; export { css, keyframes } from "styled-components"; }