UNPKG

@thoughtspot/visual-embed-sdk

Version:
1,508 lines (1,507 loc) 145 kB
"use strict"; /** * Copyright (c) 2023 * * TypeScript type definitions for ThoughtSpot Visual Embed SDK * @summary Type definitions for Embed SDK * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com> */ Object.defineProperty(exports, "__esModule", { value: true }); exports.LogLevel = exports.CustomActionTarget = exports.CustomActionsPosition = exports.ContextMenuTriggerOptions = exports.PrefetchFeatures = exports.Action = exports.Param = exports.DataSourceVisualMode = exports.HostEvent = exports.EmbedEvent = exports.ListPageColumns = exports.HomepageModule = exports.RuntimeFilterOp = exports.HomeLeftNavItem = exports.AuthType = void 0; /** * The authentication mechanism for allowing access to the * the embedded app * @group Authentication / Init */ var AuthType; (function (AuthType) { /** * No authentication on the SDK. Pass-through to the embedded App. Alias for * `Passthrough`. * @example * ```js * init({ * // ... * authType: AuthType.None, * }); * ``` */ AuthType["None"] = "None"; /** * Passthrough SSO to the embedded application within the iframe. Requires least * configuration, but may not be supported by all IDPs. This will behave like `None` * if SSO is not configured on ThoughtSpot. * * To use this: * Your SAML or OpenID provider must allow iframe redirects. * For example, if you are using Okta as IdP, you can enable iframe embedding. * @example * ```js * init({ * // ... * authType: AuthType.EmbeddedSSO, * }); * ``` * @version: SDK: 1.15.0 | ThoughtSpot: 8.8.0.cl */ AuthType["EmbeddedSSO"] = "EmbeddedSSO"; /** * SSO using SAML * @deprecated Use {@link SAMLRedirect} instead * @hidden */ AuthType["SSO"] = "SSO_SAML"; /** * SSO using SAML * @deprecated Use {@link SAMLRedirect} instead * @hidden */ AuthType["SAML"] = "SSO_SAML"; /** * SSO using SAML * Makes the host application redirect to the SAML IdP. Use this * if your IdP does not allow itself to be embedded. * * This redirects the host application to the SAML IdP. The host application * will be redirected back to the ThoughtSpot app after authentication. * @example * ```js * init({ * // ... * authType: AuthType.SAMLRedirect, * }); * ``` * * This opens the SAML IdP in a popup window. The popup is triggered * when the user clicks the trigger button. The popup window will be * closed automatically after authentication. * @example * ```js * init({ * // ... * authType: AuthType.SAMLRedirect, * authTriggerText: 'Login with SAML', * authTriggerContainer: '#tsEmbed', * inPopup: true, * }); * ``` * * Can also use the event to trigger the popup flow. Works the same * as the above example. * @example * ```js * const authEE = init({ * // ... * authType: AuthType.SAMLRedirect, * inPopup: true, * }); * * someButtonOnYourPage.addEventListener('click', () => { * authEE.emit(AuthEvent.TRIGGER_SSO_POPUP); * }); * ``` */ AuthType["SAMLRedirect"] = "SSO_SAML"; /** * SSO using OIDC * @hidden * @deprecated Use {@link OIDCRedirect} instead */ AuthType["OIDC"] = "SSO_OIDC"; /** * SSO using OIDC * Will make the host application redirect to the OIDC IdP. * See code samples in {@link SAMLRedirect}. */ AuthType["OIDCRedirect"] = "SSO_OIDC"; /** * Trusted authentication server * @hidden * @deprecated Use {@link TrustedAuth} instead */ AuthType["AuthServer"] = "AuthServer"; /** * Trusted authentication server. Use your own authentication server * which returns a bearer token, generated using the `secret_key` obtained * from ThoughtSpot. * @example * ```js * init({ * // ... * authType: AuthType.TrustedAuthToken, * getAuthToken: () => { * return fetch('https://my-backend.app/ts-token') * .then((response) => response.json()) * .then((data) => data.token); * } * }); * ``` */ AuthType["TrustedAuthToken"] = "AuthServer"; /** * Trusted authentication server Cookieless, Use your own authentication * server which returns a bearer token, generated using the `secret_key` * obtained from ThoughtSpot. This uses a cookieless authentication * approach, recommended to bypass the third-party cookie-blocking restriction * implemented by some browsers. * @example * ```js * init({ * // ... * authType: AuthType.TrustedAuthTokenCookieless, * getAuthToken: () => { * return fetch('https://my-backend.app/ts-token') * .then((response) => response.json()) * .then((data) => data.token); * } * ``` * @version SDK: 1.22.0| ThoughtSpot: 9.3.0.cl, 9.5.1.sw */ AuthType["TrustedAuthTokenCookieless"] = "AuthServerCookieless"; /** * Use the ThoughtSpot login API to authenticate to the cluster directly. * * Warning: This feature is primarily intended for developer testing. It is * strongly advised not to use this authentication method in production. */ AuthType["Basic"] = "Basic"; })(AuthType = exports.AuthType || (exports.AuthType = {})); /** * * This option does not apply to the classic homepage experience. * To access the updated modular homepage, * set `modularHomeExperience` to `true` * (available as Early Access feature in 9.12.5.cl). * */ var HomeLeftNavItem; (function (HomeLeftNavItem) { /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["SearchData"] = "search-data"; /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["Home"] = "insights-home"; /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["Liveboards"] = "liveboards"; /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["Answers"] = "answers"; /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["MonitorSubscription"] = "monitor-alerts"; /** * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl */ HomeLeftNavItem["SpotIQAnalysis"] = "spotiq-analysis"; /** * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl */ HomeLeftNavItem["LiveboardSchedules"] = "liveboard-schedules"; /** * Create new options in the insights left navigation, * available when new navigation V3 is enabled. * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl */ HomeLeftNavItem["Create"] = "create"; /** * Spotter option in the insights left navigation, * available when new navigation V3 is enabled. * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl */ HomeLeftNavItem["Spotter"] = "spotter"; /** * Favorites option in the insights left navigation, * available when new navigation V3 is enabled. * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl */ HomeLeftNavItem["Favorites"] = "favorites"; })(HomeLeftNavItem = exports.HomeLeftNavItem || (exports.HomeLeftNavItem = {})); /** * A map of the supported runtime filter operations */ var RuntimeFilterOp; (function (RuntimeFilterOp) { /** * Equals */ RuntimeFilterOp["EQ"] = "EQ"; /** * Does not equal */ RuntimeFilterOp["NE"] = "NE"; /** * Less than */ RuntimeFilterOp["LT"] = "LT"; /** * Less than or equal to */ RuntimeFilterOp["LE"] = "LE"; /** * Greater than */ RuntimeFilterOp["GT"] = "GT"; /** * Greater than or equal to */ RuntimeFilterOp["GE"] = "GE"; /** * Contains */ RuntimeFilterOp["CONTAINS"] = "CONTAINS"; /** * Begins with */ RuntimeFilterOp["BEGINS_WITH"] = "BEGINS_WITH"; /** * Ends with */ RuntimeFilterOp["ENDS_WITH"] = "ENDS_WITH"; /** * Between, inclusive of higher value */ RuntimeFilterOp["BW_INC_MAX"] = "BW_INC_MAX"; /** * Between, inclusive of lower value */ RuntimeFilterOp["BW_INC_MIN"] = "BW_INC_MIN"; /** * Between, inclusive of both higher and lower value */ RuntimeFilterOp["BW_INC"] = "BW_INC"; /** * Between, non-inclusive */ RuntimeFilterOp["BW"] = "BW"; /** * Is included in this list of values */ RuntimeFilterOp["IN"] = "IN"; /** * Is not included in this list of values */ RuntimeFilterOp["NOT_IN"] = "NOT_IN"; })(RuntimeFilterOp = exports.RuntimeFilterOp || (exports.RuntimeFilterOp = {})); /** * Home page module that can be hidden. * **Note**: This option does not apply to the classic homepage. * To access the updated modular homepage, set * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl). * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw */ var HomepageModule; (function (HomepageModule) { /** * Search bar */ HomepageModule["Search"] = "SEARCH"; /** * kPI watchlist module */ HomepageModule["Watchlist"] = "WATCHLIST"; /** * favorite objects */ HomepageModule["Favorite"] = "FAVORITE"; /** * List of answers and Liveboards */ HomepageModule["MyLibrary"] = "MY_LIBRARY"; /** * Trending list */ HomepageModule["Trending"] = "TRENDING"; /** * Learning videos */ HomepageModule["Learning"] = "LEARNING"; })(HomepageModule = exports.HomepageModule || (exports.HomepageModule = {})); /** * List page columns that can be hidden. * **Note**: This option is applicable to full app embedding only. * @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl */ var ListPageColumns; (function (ListPageColumns) { /** * Favourite */ ListPageColumns["Favourite"] = "FAVOURITE"; /** * Tags */ ListPageColumns["Tags"] = "TAGS"; /** * Author */ ListPageColumns["Author"] = "AUTHOR"; /** * Last viewed/Last modified */ ListPageColumns["DateSort"] = "DATE_SORT"; /** * Share */ ListPageColumns["Share"] = "SHARE"; })(ListPageColumns = exports.ListPageColumns || (exports.ListPageColumns = {})); /** * Event types emitted by the embedded ThoughtSpot application. * * To add an event listener use the corresponding * {@link LiveboardEmbed.on} or {@link AppEmbed.on} or {@link SearchEmbed.on} method. * @example * ```js * import { EmbedEvent } from '@thoughtspot/visual-embed-sdk'; * // Or * // const { EmbedEvent } = window.tsembed; * * // create the liveboard embed. * * liveboardEmbed.on(EmbedEvent.Drilldown, (drilldown) => { * console.log('Drilldown event', drilldown); * })); * ``` * * If you are using React components for embedding, you can register to any * events from the `EmbedEvent` list by using the `on<EventName>` convention. * For example,`onAlert`, `onCopyToClipboard` and so on. * @example * ```js * // ... * const MyComponent = ({ dataSources }) => { * const onLoad = () => { * console.log(EmbedEvent.Load, {}); * }; * * return ( * <SearchEmbed * dataSources={dataSources} * onLoad = {logEvent("Load")} * /> * ); * }; * ``` * @group Events */ var EmbedEvent; (function (EmbedEvent) { /** * Rendering has initialized. * @example *```js * liveboardEmbed.on(EmbedEvent.Init, showLoader) * //show a loader * function showLoader() { * document.getElementById("loader"); * } *``` * @returns timestamp - The timestamp when the event was generated. */ EmbedEvent["Init"] = "init"; /** * Authentication has either succeeded or failed. * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.AuthInit, payload => { * console.log('AuthInit', payload); * }) *``` * @returns isLoggedIn - A Boolean specifying whether authentication was successful. */ EmbedEvent["AuthInit"] = "authInit"; /** * The embed object container has loaded. * @returns timestamp - The timestamp when the event was generated. * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Load, hideLoader) * //hide loader * function hideLoader() { * document.getElementById("loader"); * } *``` */ EmbedEvent["Load"] = "load"; /** * Data pertaining to an Answer or Liveboard is received. * The event payload includes the raw data of the object. * @return data - Answer of Liveboard data * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Data, payload => { * console.log('data', payload); * }) *``` * @important */ EmbedEvent["Data"] = "data"; /** * Search query has been updated by the user. * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw * @example *```js * searchEmbed.on(EmbedEvent.QueryChanged, payload => console.log('data', payload)) *``` */ EmbedEvent["QueryChanged"] = "queryChanged"; /** * A drill-down operation has been performed. * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @returns additionalFilters - Any additional filters applied * @returns drillDownColumns - The columns on which drill down was performed * @returns nonFilteredColumns - The columns that were not filtered * @example *```js * searchEmbed.on(EmbedEvent.DrillDown, { * points: { * clickedPoint, * selectedPoints: selectedPoint * }, * autoDrillDown: true, * }) *``` * In this example, `VizPointDoubleClick` event is used for * triggering the `DrillDown` event when an area or specific * data point on a table or chart is double-clicked. * @example *```js * searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => { * console.log(payload); * const clickedPoint = payload.data.clickedPoint; * const selectedPoint = payload.data.selectedPoints; * console.log('>>> called', clickedPoint); * embed.trigger(HostEvent.DrillDown, { * points: { * clickedPoint, * selectedPoints: selectedPoint * }, * autoDrillDown: true, * }) * }) *``` */ EmbedEvent["Drilldown"] = "drillDown"; /** * One or more data sources have been selected. * @returns dataSourceIds - the list of data sources * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example * ```js * searchEmbed.on(EmbedEvent.DataSourceSelected, payload => { * console.log('DataSourceSelected', payload); * }) * ``` */ EmbedEvent["DataSourceSelected"] = "dataSourceSelected"; /** * One or more data columns have been selected. * @returns columnIds - the list of columns * @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw * @example * ```js * appEmbed.on(EmbedEvent.AddRemoveColumns, payload => { * console.log('AddRemoveColumns', payload); * }) * ``` */ EmbedEvent["AddRemoveColumns"] = "addRemoveColumns"; /** * A custom action has been triggered. * @returns actionId - ID of the custom action * @returns payload {@link CustomActionPayload} - Response payload with the * Answer or Liveboard data * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example * ```js * appEmbed.on(EmbedEvent.customAction, payload => { * const data = payload.data; * if (data.id === 'insert Custom Action ID here') { * console.log('Custom Action event:', data.embedAnswerData); * } * }) * ``` */ EmbedEvent["CustomAction"] = "customAction"; /** * Listen to double click actions on a visualization. * @return ContextMenuInputPoints - Data point that is double-clicked * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1 * @example * ```js * LiveboardEmbed.on(EmbedEvent.VizPointDoubleClick, payload => { * console.log('VizPointDoubleClick', payload); * }) * ``` */ EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick"; /** * Listen to clicks on a visualization in a Liveboard or Search result. * @return viz, clickedPoint - metadata about the point that is clicked * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @important * @example * ```js * embed.on(EmbedEvent.VizPointClick, ({data}) => { * console.log( * data.vizId, // viz id * data.clickedPoint.selectedAttributes[0].value, * data.clickedPoint.selectedAttributes[0].column.name, * data.clickedPoint.selectedMeasures[0].value, * data.clickedPoint.selectedMeasures[0].column.name, * ) * }); * ``` */ EmbedEvent["VizPointClick"] = "vizPointClick"; /** * An error has occurred. This event is fired for the following error types: * * `API` - API call failure error. * `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen * mode. `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value * filter. `NON_EXIST_FILTER` - Error due to a non-existent filter. * `INVALID_DATE_VALUE` - Invalid date value error. * `INVALID_OPERATOR` - Use of invalid operator during filter application. * * For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType * @returns error - An error object or message * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example * ```js * // API error * SearchEmbed.on(EmbedEvent.Error, (error) => { * console.log(error); * // { type: "Error", data: { errorType: "API", error: { message: '...', error: '...' } } } * }); * ``` * @example * ```js * // Fullscreen error (Errors during presenting of a liveboard) * LiveboardEmbed.on(EmbedEvent.Error, (error) => { * console.log(error); * // { type: "Error", data: { errorType: "FULLSCREEN", error: { * // message: "Fullscreen API is not enabled", * // stack: "..." * // } }} * }) * ``` */ EmbedEvent["Error"] = "Error"; /** * The embedded object has sent an alert. * @returns alert - An alert object * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw * @example * ```js * searchEmbed.on(EmbedEvent.Alert) * ``` */ EmbedEvent["Alert"] = "alert"; /** * The ThoughtSpot authentication session has expired. * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.AuthExpire, showAuthExpired) * //show auth expired banner * function showAuthExpired() { * document.getElementById("authExpiredBanner"); * } *``` */ EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired"; /** * ThoughtSpot failed to validate the auth session. * @hidden */ EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure"; /** * ThoughtSpot failed to re validate the auth session. * @hidden */ EmbedEvent["IdleSessionTimeout"] = "IdleSessionTimeout"; /** * ThoughtSpot failed to validate the auth session. * @hidden */ EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout"; /** * The height of the embedded Liveboard or visualization has been computed. * @returns data - The height of the embedded Liveboard or visualization * @hidden */ EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT"; /** * The center of visible iframe viewport is calculated. * @returns data - The center of the visible Iframe viewport. * @hidden */ EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter"; /** * Emitted when the **Get Data** action is initiated. * Applicable to `SearchBarEmbed` only. * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw * @example *```js * searchbarEmbed.on(EmbedEvent.GetDataClick) * .then(data => { * console.log('Answer Data:', data); * }) *``` */ EmbedEvent["GetDataClick"] = "getDataClick"; /** * Detects the route change. * @version SDK: 1.7.0 | ThoughtSpot: 8.0.0.cl, 8.4.1.sw * @example *```js * searchEmbed.on(EmbedEvent.RouteChange, payload => * console.log('data', payload)) *``` */ EmbedEvent["RouteChange"] = "ROUTE_CHANGE"; /** * The v1 event type for Data * @hidden */ EmbedEvent["V1Data"] = "exportVizDataToParent"; /** * Emitted when the embed does not have cookie access. This happens * when Safari and other Web browsers block third-party cookies * are blocked by default. `NoCookieAccess` can trigger. * @example *```js * appEmbed.on(EmbedEvent.NoCookieAccess) *``` * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1.sw */ EmbedEvent["NoCookieAccess"] = "noCookieAccess"; /** * Emitted when SAML is complete * @private * @hidden */ EmbedEvent["SAMLComplete"] = "samlComplete"; /** * Emitted when any modal is opened in the app * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.DialogOpen, payload => { * console.log('dialog open', payload); * }) *``` */ EmbedEvent["DialogOpen"] = "dialog-open"; /** * Emitted when any modal is closed in the app * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.DialogClose, payload => { * console.log('dialog close', payload); * }) *``` */ EmbedEvent["DialogClose"] = "dialog-close"; /** * Emitted when the Liveboard shell loads. * You can use this event as a hook to trigger * other events on the rendered Liveboard. * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.LiveboardRendered, payload => { console.log('Liveboard is rendered', payload); }) *``` * The following example shows how to trigger * `SetVisibleVizs` event using LiveboardRendered embed event: * @example *```js * const embedRef = useEmbedRef(); * const onLiveboardRendered = () => { * embed.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']); * }; *``` */ EmbedEvent["LiveboardRendered"] = "PinboardRendered"; /** * Emits all events. * @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.ALL, payload => { * console.log('Embed Events', payload) * }) *``` */ EmbedEvent["ALL"] = "*"; /** * Emitted when an Answer is saved in the app * @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //Emit when action starts * searchEmbed.on(EmbedEvent.Save, payload => { * console.log('Save', payload) * }, { * start: true * }) * //emit when action ends * searchEmbed.on(EmbedEvent.Save, payload => { * console.log('Save', payload) * }) *``` */ EmbedEvent["Save"] = "save"; /** * Emitted when the download action is triggered on an Answer. * * **Note**: This event is deprecated in v1.21.0. * To fire an event when a download action is initiated on a chart or table, * use `EmbedEvent.DownloadAsPng`, `EmbedEvent.DownloadAsPDF`, * `EmbedEvent.DownloadAsCSV`, or `EmbedEvent.DownloadAsXLSX` * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Download, { * vizId: '730496d6-6903-4601-937e-2c691821af3c' * }) *``` */ EmbedEvent["Download"] = "download"; /** * Emitted when the download action is triggered on an Answer. * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.DownloadAsPng, payload => { * console.log('download PNG', payload)}, {start: true }) * //emit when action ends * searchEmbed.on(EmbedEvent.DownloadAsPng, payload => { * console.log('download PNG', payload)}) *``` */ EmbedEvent["DownloadAsPng"] = "downloadAsPng"; /** * Emitted when the Download as PDF action is triggered on an Answer * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => { * console.log('download PDF', payload)}, {start: true }) * //emit when action ends * searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => { * console.log('download PDF', payload)}) *``` */ EmbedEvent["DownloadAsPdf"] = "downloadAsPdf"; /** * Emitted when the Download as CSV action is triggered on an Answer. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => { * console.log('download CSV', payload)}, {start: true }) * //emit when action ends * searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => { * console.log('download CSV', payload)}) *``` */ EmbedEvent["DownloadAsCsv"] = "downloadAsCsv"; /** * Emitted when the Download as XLSX action is triggered on an Answer. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => { * console.log('download Xlsx', payload)}, { start: true }) * //emit when action ends * searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => { * console.log('download Xlsx', payload)}) *``` */ EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx"; /** * Emitted when an Answer is deleted in the app * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * appEmbed.on(EmbedEvent.AnswerDelete, payload => { * console.log('delete answer', payload)}, {start: true }) * //trigger when action is completed * appEmbed.on(EmbedEvent.AnswerDelete, payload => { * console.log('delete answer', payload)}) *``` */ EmbedEvent["AnswerDelete"] = "answerDelete"; /** * Emitted when a user initiates the Pin action to * add an Answer to a Liveboard. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.Pin, payload => { * console.log('pin', payload) * }, { * start: true * }) * //emit when action ends * searchEmbed.on(EmbedEvent.Pin, payload => { * console.log('pin', payload) * }) *``` */ EmbedEvent["Pin"] = "pin"; /** * Emitted when SpotIQ analysis is triggered * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => { * console.log('SpotIQAnalyze', payload) * }, { * start: true * }) * //emit when action ends * searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => { * console.log('SpotIQ analyze', payload) * }) *``` */ EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze"; /** * Emitted when a user shares an object with another user or group * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.Share, payload => { * console.log('Share', payload) * }, { * start: true * }) * //emit when action ends * searchEmbed.on(EmbedEvent.Share, payload => { * console.log('Share', payload) * }) *``` */ EmbedEvent["Share"] = "share"; /** * Emitted when a user clicks the **Include** action to include a specific value or * data on a chart or table. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.DrillInclude, payload => { * console.log('Drill include', payload); * }) *``` */ EmbedEvent["DrillInclude"] = "context-menu-item-include"; /** * Emitted when a user clicks the **Exclude** action to exclude a specific value or * data on a chart or table * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.DrillExclude, payload => { * console.log('Drill exclude', payload); * }) *``` */ EmbedEvent["DrillExclude"] = "context-menu-item-exclude"; /** * Emitted when a column value is copied in the embedded app. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * seachEmbed.on(EmbedEvent.CopyToClipboard, payload => { * console.log('copy to clipboard', payload); * }) *``` */ EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard"; /** * Emitted when a user clicks the **Update TML** action on * embedded Liveboard. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.UpdateTML) * }) *``` */ EmbedEvent["UpdateTML"] = "updateTSL"; /** * Emitted when a user clicks the **Edit TML** action * on an embedded Liveboard. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.EditTML, payload => { * console.log('Edit TML', payload); * }) *``` */ EmbedEvent["EditTML"] = "editTSL"; /** * Emitted when the **Export TML** action is triggered on an * an embedded object in the app * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * searchEmbed.on(EmbedEvent.ExportTML, payload => { * console.log('Export TML', payload)}, { start: true }) * //emit when action ends * searchEmbed.on(EmbedEvent.ExportTML, payload => { * console.log('Export TML', payload)}) *``` */ EmbedEvent["ExportTML"] = "exportTSL"; /** * Emitted when an Answer is saved as a View. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * appEmbed.on(EmbedEvent.SaveAsView, payload => { * console.log('View', payload); * }) *``` */ EmbedEvent["SaveAsView"] = "saveAsView"; /** * Emitted when the user creates a copy of an Answer. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * //emit when action starts * appEmbed.on(EmbedEvent.CopyAEdit, payload => { * console.log('Copy and edit', payload)}, {start: true }) * //emit when action ends * appEmbed.on(EmbedEvent.CopyAEdit, payload => { * console.log('Copy and edit', payload)}) *``` */ EmbedEvent["CopyAEdit"] = "copyAEdit"; /** * Emitted when a user clicks *Show underlying data* on an Answer. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.ShowUnderlyingData, payload => { * console.log('show data', payload); * }) *``` */ EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData"; /** * Emitted when an Answer is switched to a chart or table view. * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw * @example *```js * searchEmbed.on(EmbedEvent.AnswerChartSwitcher, payload => { * console.log('switch view', payload); * }) *``` */ EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher"; /** * Internal event to communicate the initial settings back to the ThoughtSpot app * @hidden */ EmbedEvent["APP_INIT"] = "appInit"; /** * Internal event to clear the cached info * @hidden */ EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache"; /** * Emitted when a user clicks **Show Liveboard details** on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.LiveboardInfo, payload => { * console.log('Liveboard details', payload); * }) *``` */ EmbedEvent["LiveboardInfo"] = "pinboardInfo"; /** * Emitted when a user clicks on the Favorite icon on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.AddToFavorites, payload => { * console.log('favorites', payload); * }) *``` */ EmbedEvent["AddToFavorites"] = "addToFavorites"; /** * Emitted when a user clicks **Schedule** on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Schedule, payload => { * console.log(`Liveboard schedule', payload); * }) *``` */ EmbedEvent["Schedule"] = "subscription"; /** * Emitted when a user clicks **Edit** on a Liveboard or visualization * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Edit, payload => { * console.log(`Liveboard edit', payload); * }) *``` */ EmbedEvent["Edit"] = "edit"; /** * Emitted when a user clicks *Make a copy* on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.MakeACopy, payload => { * console.log(`Copy', payload); * }) *``` */ EmbedEvent["MakeACopy"] = "makeACopy"; /** * Emitted when a user clicks **Present** on a Liveboard or visualization * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Present) *``` * @example *```js * liveboardEmbed.on(EmbedEvent.Present, { * vizId: '730496d6-6903-4601-937e-2c691821af3c'}) * }) *``` */ EmbedEvent["Present"] = "present"; /** * Emitted when a user clicks **Delete** on a visualization * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Delete, * {vizId: '730496d6-6903-4601-937e-2c691821af3c'}) *``` */ EmbedEvent["Delete"] = "delete"; /** * Emitted when a user clicks Manage schedules on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.SchedulesList) *``` */ EmbedEvent["SchedulesList"] = "schedule-list"; /** * Emitted when a user clicks **Cancel** in edit mode on a Liveboard * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Cancel) *``` */ EmbedEvent["Cancel"] = "cancel"; /** * Emitted when a user clicks **Explore** on a visualization * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.Explore, { * vizId: '730496d6-6903-4601-937e-2c691821af3c'}) *``` */ EmbedEvent["Explore"] = "explore"; /** * Emitted when a user clicks **Copy link** action on a visualization. * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw * @example *```js * liveboardEmbed.on(EmbedEvent.CopyLink, { * vizId: '730496d6-6903-4601-937e-2c691821af3c'}) *``` */ EmbedEvent["CopyLink"] = "embedDocument"; /** * Emitted when a user interacts with cross filters on a * visualization or Liveboard. * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw * @example *```js * liveboardEmbed.on(EmbedEvent.CrossFilterChanged, { * vizId: '730496d6-6903-4601-937e-2c691821af3c'}) *``` */ EmbedEvent["CrossFilterChanged"] = "cross-filter-changed"; /** * Emitted when a user right clicks on a visualization (chart or table) * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw * @example *```js * LiveboardEmbed.on(EmbedEvent.VizPointRightClick, payload => { * console.log('VizPointClick', payload) * }) *``` */ EmbedEvent["VizPointRightClick"] = "vizPointRightClick"; /** * Emitted when a user clicks **Insert to slide** on a visualization * @hidden */ EmbedEvent["InsertIntoSlide"] = "insertInToSlide"; /** * Emitted when a user changes any filter on a Liveboard. * Returns filter type and name, column name and ID, and runtime * filter details. * @example * *```js * LiveboardEmbed.on(EmbedEvent.FilterChanged, (payload) => { * console.log('payload', payload); * }) * * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl, 9.5.0.sw */ EmbedEvent["FilterChanged"] = "filterChanged"; /** * Emitted when a user clicks the **Go** button to initiate * a Natural Language Search query * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["SageEmbedQuery"] = "sageEmbedQuery"; /** * Emitted when a user selects a data source on the embedded * Natural Language Search interface. * * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["SageWorksheetUpdated"] = "sageWorksheetUpdated"; /** * Emitted when a user updates a connection on the **Data** page * @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw */ EmbedEvent["UpdateConnection"] = "updateConnection"; /** * Emitted when a user updates a connection on the **Data** page * @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw */ EmbedEvent["CreateConnection"] = "createConnection"; /** * Emitted when name, status (private or public) or filter values of a * Personalised view is updated. * @returns viewName: string * @returns viewId: string * @returns liveboardId: string * @returns isPublic: boolean * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["UpdatePersonalisedView"] = "updatePersonalisedView"; /** * Emitted when a Personalised view is saved. * @returns viewName: string * @returns viewId: string * @returns liveboardId: string * @returns isPublic: boolean * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["SavePersonalisedView"] = "savePersonalisedView"; /** * Emitted when a Liveboard is reset. * @returns viewName: string * @returns viewId: string * @returns liveboardId: string * @returns isPublic: boolean * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["ResetLiveboard"] = "resetLiveboard"; /** * Emitted when a PersonalisedView is deleted. * @returns views: string[] * @returns liveboardId: string * @version SDK : 1.26.0 | ThoughtSpot: 9.7.0.cl, 9.8.0.sw */ EmbedEvent["DeletePersonalisedView"] = "deletePersonalisedView"; /** * Emitted when a user creates a Worksheet. * @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw */ EmbedEvent["CreateWorksheet"] = "createWorksheet"; /** * Emitted when the *Ask Sage* is initialized. * @returns viewName: string * @returns viewId: string * @returns liveboardId: string * @returns isPublic: boolean * @version SDK : 1.29.0 | ThoughtSpot Cloud: 9.12.0.cl */ EmbedEvent["AskSageInit"] = "AskSageInit"; /** * Emitted when a Liveboard or visualization is renamed. * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl, 10.1.0.sw */ EmbedEvent["Rename"] = "rename"; /** * * This event can be emitted to intercept search execution initiated by * the users and implement the logic to allow or restrict search execution. * You can can also show custom error text if the search query must be * restricted due to your application or business requirements. * Prerequisite: Set `isOnBeforeGetVizDataInterceptEnabled` to `true` * for this embed event to get emitted. * @param: payload * @param: responder * Contains elements that lets developers define whether ThoughtSpot * should run the search, and if not, what error message * should be shown to the user. * * execute: When execute returns `true`, the search will be run. * When execute returns `false`, the search will not be executed. * * error: Developers can customize the error message text when `execute` * returns `false` using the error parameter in responder. * @version SDK : 1.29.0 | ThoughtSpot: 10.3.0.cl * @example *```js * .on(EmbedEvent.OnBeforeGetVizDataIntercept, * (payload, responder) => { * responder({ * data: { * execute:false, * error: { * //Provide a custom error message to explain to your end user * //why their search did not run * errorText: "This search query cannot be run. * Please contact your administrator for more details." * } * }}) * }) * ``` * *```js * .on(EmbedEvent.OnBeforeGetVizDataIntercept, * (payload, responder) => { * const query = payload.data.data.answer.search_query * responder({ * data: { * // returns true as long as the query does not include * // both the 'sales' AND the 'county' column * execute: !(query.includes("sales")&&query.includes("county")), * error: { * //Provide a custom error message to explain to your end user * // why their search did not run, and which searches are accepted by your custom logic. * errorText: "You can't use this query :" + query + ". * The 'sales' measures can never be used at the 'county' level. * Please try another measure, or remove 'county' from your search." * } * }}) * }) *``` */ EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept"; /** * Emitted when parameter changes in an Answer * or Liveboard. * ```js * liveboardEmbed.on(EmbedEvent.ParameterChanged, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK : 1.29.0 | ThoughtSpot: 10.3.0.cl */ EmbedEvent["ParameterChanged"] = "parameterChanged"; /** * Emits when a table visualization is rendered in * the ThoughtSpot embedded app. * * You can also use this event as a hook to trigger host events * such as `HostEvent.TransformTableVizData` on the table visualization. * The event payload contains the data used in the rendered table. * You can extract the relevant data from the payload * stored in `payload.data.data.columnDataLite`. * * `columnDataLite` is a multidimensional array that contains * data values for each column, which was used in the query to * generate the table visualization. To find and modify specific cell data, * you can either loop through the array or directly access a cell if * you know its position and data index. * * In the following code sample, the first cell in the first column * (`columnDataLite[0].dataValue[0]`) is set to `new fob`. * Note that any changes made to the data in the payload will only update the * visual presentation and do not affect the underlying data. * To persist data value modifications after a reload or during chart * interactions such as drill down, ensure that the modified * payload in the `columnDataLite` is passed on to * `HostEvent.TransformTableVizData` and trigger an update to * the table visualization. * * If the Row-Level Security (RLS) rules are applied on the * Worksheet or Model, exercise caution when changing column * or table cell values to maintain data security. * * @example * ```js * searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => { * console.log(payload); * const columnDataLite = payload.data.data.columnDataLite; * columnDataLite[0].dataValue[0]="new fob"; * console.log('>>> new Data', columnDataLite); * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite); * }) * ``` * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl */ EmbedEvent["TableVizRendered"] = "TableVizRendered"; /** * Emitted when the liveboard is created from pin modal or Liveboard list page. * You can use this event as a hook to trigger * other events on liveboard creation. * * ```js * liveboardEmbed.on(EmbedEvent.CreateLiveboard, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK : 1.37.0 | ThoughtSpot: 10.8.0.cl */ EmbedEvent["CreateLiveboard"] = "createLiveboard"; /** * Emitted when a user creates a Model. * @version SDK : 1.37.0 | ThoughtSpot: 10.8.0.cl */ EmbedEvent["CreateModel"] = "createModel"; /** * @hidden * Emitted when a user exits present mode. * @version SDK : 1.40.0 | ThoughtSpot: 10.11.0.cl */ EmbedEvent["ExitPresentMode"] = "exitPresentMode"; /** * Emitted when a user requests the full height lazy load data. * @version SDK : 1.39.0 | ThoughtSpot : 10.10.0.cl * @hidden */ EmbedEvent["RequestVisibleEmbedCoordinates"] = "requestVisibleEmbedCoordinates"; /** * Emitted when Spotter response is text data * @example * ```js * spotterEmbed.on(EmbedEvent.SpotterData, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["SpotterData"] = "SpotterData"; /** * Emitted when user opens up the worksheet preview modal in Spotter embed. * @example * ```js * spotterEmbed.on(EmbedEvent.PreviewSpotterData, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["PreviewSpotterData"] = "PreviewSpotterData"; /** * Emitted when the Spotter query is triggered in Spotter embed. * @example * ```js * spotterEmbed.on(EmbedEvent.SpotterQueryTriggered, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["SpotterQueryTriggered"] = "SpotterQueryTriggered"; /** * Emitted when the last Spotter query is edited in Spotter embed. * @example * ```js * spotterEmbed.on(EmbedEvent.LastPromptEdited, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["LastPromptEdited"] = "LastPromptEdited"; /** * Emitted when the last Spotter query is deleted in Spotter embed. * @example * ```js * spotterEmbed.on(EmbedEvent.LastPromptDeleted, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["LastPromptDeleted"] = "LastPromptDeleted"; /** * Emitted when the coversation is reset in spotter embed. * @example * ```js * spotterEmbed.on(EmbedEvent.ResetSpotterConversation, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl */ EmbedEvent["ResetSpotterConversation"] = "ResetSpotterConversation"; /** * Emitted when the *Spotter* is initialized. * @example * ```js * spotterEmbed.on(EmbedEvent.SpotterInit, (payload) => { * console.log('payload', payload); * }) *``` * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl */ EmbedEvent["SpotterInit"] = "spotterInit"; /** * @hidden * Triggers when the embed listener is ready to receive events. * This is used to trigger events after the embed container is loaded. * @example * ```js * liveboardEmbed.on(EmbedEvent.EmbedListenerReady, () => { * console.log('EmbedListenerReady'); * }) * ``` */ EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady"; /** * Emitted when the organizati