import { FlexErrorContents, SessionData } from "../FlexError"; /** * Information about the session where the error occured * * @category Flex Errors * @ignore * @typedef ErrorDetails * @extends {FlexErrorContents} * @property {string} message Error message. * @property {string} [wrappedError] The original error message. * @memberof FlexError */ interface ErrorDetails extends Partial> { message: string; wrappedError?: string; } /** * Information about the session where the error occured * * @category Flex Errors * @ignore * @typedef FlexErrorJSON * @property {string} title Normalized title of an error. * @property {string} name Raw name of an error. * @property {string} message Error message. * @property {string} logLine Normalized log line of an error. * @property {string} stack Represents stack trace of an error * @property {Monitor.ErrorDetails} details Contents more details of an error. * @property {string | Monitor.FlexErrorJSON} wrappedError The original error. * @property {string} logs Logs around the error. * @property {SessionData} sessionData Information about the session where the error occured. * @memberof FlexError */ interface FlexErrorJSON { title: string; name: string; message: string; logLine: string; stack: string; details: ErrorDetails; wrappedError: string | FlexErrorJSON; logs: string; sessionData: SessionData; } /** * @package * @class Monitor * @hideconstructor * @category Flex Errors * @classdesc Monitor API’s are designed to retrieve Error reports and logs programmatically. Flex.Monitor.getLogs returns the current logs and Flex.Monitor.getError returns all recorded errors in an array. You can use these methods to implement special reporting or report handling. * You can learn more about [troubleshooting Flex UI here](https://www.twilio.com/docs/flex/developer/ui/troubleshooting-the-flex-ui) */ export declare const Monitor: { /** * Creates and returns a JSON representation of the error array * * @name Monitor.getErrors * @returns {{ errors: FlexErrorJSON[] }} JSON representation of the error array * @example * import { Monitor } from "@twilio/flex-ui"; * Monitor.getErrors(); // returns { errors: {@link Monitor.FlexErrorJSON}[] } */ getErrors(): { errors: FlexErrorJSON[]; }; /** * Creates a dump from the log manager content and returns the formatted data * * @name Monitor.getLogs * @returns {{ logs: string }} the formatted logs * @example * import { Monitor } from "@twilio/flex-ui"; * Monitor.getLogs(); // returns { logs: string } */ getLogs(): { logs: string; }; /** * Creates and sends a Custom Error Event to Twilio Debugger * * @name Monitor.sendDebuggerEvent * @param {string} message message field of error * @param {string} description description of error * @returns {void} * @example * Monitor.sendDebuggerEvent("Connection failed"); // creates and sends error event to Twilio Debugger */ sendDebuggerEvent(message: string, description?: string): void; }; export {};