@thoughtspot/visual-embed-sdk
Version:
ThoughtSpot Embed SDK
1,316 lines (1,310 loc) • 304 kB
TypeScript
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// ../../eventemitter3
import EventEmitter from 'eventemitter3';
/**
* Copyright (c) 2023
*
* ThoughtSpot Visual Embed SDK for embedding ThoughtSpot analytics
* in other web applications.
* @summary ThoughtSpot Visual Embed SDK
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload, UIPassthroughEvent, };
/**
* Copyright (c) 2022
*
* Full application embedding
* https://developers.thoughtspot.com/docs/?pageid=full-embed
* @summary Full app embed
* @module
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
/**
* Pages within the ThoughtSpot app that can be embedded.
*/
export enum Page {
/**
* Home page
*/
Home = "home",
/**
* Search page
*/
Search = "search",
/**
* Saved answers listing page
*/
Answers = "answers",
/**
* Liveboards listing page
*/
Liveboards = "liveboards",
/**
* @hidden
*/
Pinboards = "pinboards",
/**
* Data management page
*/
Data = "data",
/**
* SpotIQ listing page
*/
SpotIQ = "insights",
/**
* Monitor Alerts Page
*/
Monitor = "monitor"
}
/**
* Define the initial state os column custom group accordions
* in data panel v2.
*/
export enum DataPanelCustomColumnGroupsAccordionState {
/**
* Expand all the accordion initially in data panel v2.
*/
EXPAND_ALL = "EXPAND_ALL",
/**
* Collapse all the accordions initially in data panel v2.
*/
COLLAPSE_ALL = "COLLAPSE_ALL",
/**
* Expand the first accordion and collapse the rest.
*/
EXPAND_FIRST = "EXPAND_FIRST"
}
export enum HomePageSearchBarMode {
OBJECT_SEARCH = "objectSearch",
AI_ANSWER = "aiAnswer",
NONE = "none"
}
/**
* The view configuration for full app embedding.
* @group Embed components
*/
export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
/**
* If true, the top navigation bar within the ThoughtSpot app
* is displayed. By default, the navigation bar is hidden.
* This flag also controls the homepage left navigation bar.
* @default true
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* showPrimaryNavbar:true,
* })
* ```
*/
showPrimaryNavbar?: boolean;
/**
* Control the visibility of the left navigation bar on the Homepage.
* If showPrimaryNavbar is true, that is, if the Global and Homepage
* nav-bars are visible, this flag will only hide the homepage left nav-bar.
* The showPrimaryNavbar flag takes precedence over the hideHomepageLeftNav.
*
* **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).
* @default false
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* hideHomepageLeftNav : true,
* })
* ```
*/
hideHomepageLeftNav?: boolean;
/**
* Control the visibility of the help (?) and profile buttons on the
* Global nav-bar. By default, these buttons are visible on the nav-bar.
* @default false
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* disableProfileAndHelp: true,
* })
* ```
*/
disableProfileAndHelp?: boolean;
/**
* @version SDK: 1.36.3 | ThoughtSpot: 10.1.0.cl
* @default true
* Whether the help menu in the top nav bar should be served
* from Pendo or ThoughtSpot's internal help items.
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* enablePendoHelp: false,
* });
* ```
*/
enablePendoHelp?: boolean;
/**
* Control the visibility of the application switcher button on the nav-bar.
* By default, the application switcher is shown.
*
* **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
* @default false
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* hideApplicationSwitcher : true,
* })
* ```
*/
hideApplicationSwitcher?: boolean;
/**
* Control the visibility of the Org switcher button on the nav-bar.
* By default, the Org switcher button is shown.
*
* **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
* @default true
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* hideOrgSwitcher : true,
* })
* ```
*/
hideOrgSwitcher?: boolean;
/**
* A URL path to the embedded application page
* If both path and pageId attributes are defined, the path definition
* takes precedence. This is the path post the `#/` in the URL of the standalone
* ThoughtSpot app. Use this to open the embedded view to a specific path.
*
* For eg, if you want the component to open to a specific Liveboard
* you could set the path to `pinboard/<liveboardId>/tab/<tabId>`.
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* path:"pinboard/1234/tab/7464"
* })
* ```
*/
path?: string;
/**
* The application page to set as the start page
* in the embedded view.
*
* Use this to open to particular page in the app. To open to a specific
* path within the app, use the `path` attribute which is more flexible.
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* pageId : Page.Answers | Page.Data
* })
* ```
*/
pageId?: Page;
/**
* This puts a filter tag on the application. All metadata lists in the
* application, such as Liveboards and answers, would be filtered by this
* tag.
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* tag:'value',
* })
* ```
*/
tag?: string;
/**
* The array of GUIDs to be hidden
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* hideObjects: [
* '430496d6-6903-4601-937e-2c691821af3c',
* 'f547ec54-2a37-4516-a222-2b06719af726'
* ]
* })
* ```
*/
hideObjects?: string[];
/**
* Render liveboards using the new v2 rendering mode
* This is a transient flag which is primarily meant for internal use
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
* @hidden
*/
liveboardV2?: boolean;
/**
* If set to true, the Search Assist feature is enabled.
* @default true
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* enableSearchAssist: true,
* })
* ```
*/
enableSearchAssist?: boolean;
/**
* If set to true, the Liveboard container dynamically resizes
* according to the height of the Liveboard.
*
* **Note**: Using fullHeight loads all visualizations
* on the Liveboard simultaneously, which results in
* multiple warehouse queries and potentially a
* longer wait for the topmost visualizations to
* display on the screen. Setting fullHeight to
* `false` fetches visualizations incrementally as
* users scroll the page to view the charts and tables.
*
* @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* fullHeight: true,
* })
* ```
*/
fullHeight?: boolean;
/**
* Show or hide Liveboard header
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* hideLiveboardHeader : true,
* })
* ```
*/
hideLiveboardHeader?: boolean;
/**
* Show or hide Liveboard title
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* showLiveboardTitle:true,
* })
* ```
*/
showLiveboardTitle?: boolean;
/**
* Show or hide Liveboard description
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* showLiveboardDescription:true,
* })
* ```
*/
showLiveboardDescription?: boolean;
/**
* Flag to control new Modular Home experience.
* @default false
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* modularHomeExperience : true,
* })
* ```
*/
modularHomeExperience?: boolean;
/**
* Boolean to control if Liveboard header is sticky or not.
* @example
* ```js
* const embed = new AppEmbed('#embed', {
* ... // other app view config
* isLiveboardHeaderSticky: true,
* });
* ```
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
*/
isLiveboardHeaderSticky?: boolean;
/**
* enable or disable ask sage
* @version SDK: 1.29.0 | Thoughtspot: 9.12.0.cl
* @default false
*/
enableAskSage?: boolean;
/**
* To set the initial state of the search bar in case of saved-answers.
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
* @default false
* @deprecated Use {@link collapseSearchBar} instead
*/
collapseSearchBarInitially?: boolean;
/**
* This controls the initial behaviour of custom column groups accordion.
* It takes DataPanelCustomColumnGroupsAccordionState enum values as input.
* List of different enum values:-
* - EXPAND_ALL: Expand all the accordion initially in data panel v2.
* - COLLAPSE_ALL: Collapse all the accordions initially in data panel v2.
* - EXPAND_FIRST: Expand the first accordion and collapse the rest.
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
* @default DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL
* @example
* ```js
* const embed = new AppEmbed('#embed', {
* ... // other app view config
* dataPanelCustomGroupsAccordionInitialState:
* DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
* });
* ```
*/
dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
/**
* This attribute can be used to enable the two-column layout on an embedded Liveboard
* @type {boolean}
* @default false
* @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* enable2ColumnLayout: true,
* })
* ```
*/
enable2ColumnLayout?: boolean;
/**
* Flag that allows using `EmbedEvent.OnBeforeGetVizDataIntercept`.
* @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
*/
isOnBeforeGetVizDataInterceptEnabled?: boolean;
/**
* Flag to use home page search bar mode
* @version SDK : 1.33.0 | Thoughtspot : 10.3.0.cl
*/
homePageSearchBarMode?: HomePageSearchBarMode;
/**
* This flag can be used to enable the compact header in Liveboard
* @type {boolean}
* @default false
* @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
* @example
* ```js
* const embed = new AppEmbed('#embed-container', {
* ... // other options
* isLiveboardCompactHeaderEnabled: true,
* })
* ```
*/
isLiveboardCompactHeaderEnabled?: boolean;
/**
* This flag can be used to show or hide the Liveboard verified icon in the compact header.
* @type {boolean}
* @default true
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#embed-container', {
* ... // other options
* showLiveboardVerifiedBadge: true,
* })
* ```
*/
showLiveboardVerifiedBadge?: boolean;
/**
* This flag is used to enable/disable hide irrelevant filters in Liveboard tab
* @type {boolean}
* @default false
* @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
* @example
* ```js
* const embed = new AppEmbed('#embed-container', {
* ... // other options
* hideIrrelevantChipsInLiveboardTabs: true,
* })
* ```
*/
hideIrrelevantChipsInLiveboardTabs?: boolean;
/**
* This flag can be used to show or hide the re-verify banner on the Liveboard compact header
* @type {boolean}
* @default true
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
* @example
* ```js
* const embed = new AppEmbed('#embed-container', {
* ... // other options
* showLiveboardReverifyBanner: true,
* })
* ```
*/
showLiveboardReverifyBanner?: boolean;
/**
* This flag is used to enable unified search experience for full app embed.
* @type {boolean}
* @default true
* @version SDK: 1.34.0 | ThoughtSpot:10.5.0.cl
* @example
* ```js
* const embed = new AppEmbed('#embed-container', {
* ... // other options
* isUnifiedSearchExperienceEnabled: true,
* })
* ```
*/
isUnifiedSearchExperienceEnabled?: boolean;
}
/**
* Embeds full ThoughtSpot experience in a host application.
* @group Embed components
*/
export class AppEmbed extends V1Embed {
protected viewConfig: AppViewConfig;
constructor(domSelector: DOMSelector, viewConfig: AppViewConfig);
/**
* Constructs a map of parameters to be passed on to the
* embedded Liveboard or visualization.
*/
protected getEmbedParams(): string;
/**
* Constructs the URL of the ThoughtSpot app page to be rendered.
* @param pageId The ID of the page to be embedded.
*/
getIFrameSrc(): string;
/**
* Set the iframe height as per the computed height received
* from the ThoughtSpot app.
* @param data The event payload
*/
protected updateIFrameHeight: (data: MessagePayload) => void;
/**
* Navigate to particular page for app embed. eg:answers/pinboards/home
* This is used for embedding answers, pinboards, visualizations and full application
* only.
* @param path string | number The string, set to iframe src and navigate to new page
* eg: appEmbed.navigateToPage('pinboards')
* When used with `noReload` (default: true) this can also be a number
* like 1/-1 to go forward/back.
* @param noReload boolean Trigger the navigation without reloading the page
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
*/
navigateToPage(path: string | number, noReload?: boolean): void;
/**
* Renders the embedded application pages in the ThoughtSpot app.
* @param renderOptions An object containing the page ID
* to be embedded.
*/
render(): Promise<AppEmbed>;
}
import '../utils/with-resolvers-polyfill';
export interface executeTMLInput {
metadata_tmls: string[];
import_policy?: 'PARTIAL' | 'ALL_OR_NONE' | 'VALIDATE_ONLY';
create_new?: boolean;
}
export interface exportTMLInput {
metadata: {
identifier: string;
type?: 'LIVEBOARD' | 'ANSWER' | 'LOGICAL_TABLE' | 'CONNECTION';
}[];
export_associated?: boolean;
export_fqn?: boolean;
edoc_format?: 'YAML' | 'JSON';
}
export let authPromise: Promise<boolean>;
export const getAuthPromise: () => Promise<boolean>;
export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
/**
* Perform authentication on the ThoughtSpot app as applicable.
*/
export const handleAuth: () => Promise<boolean>;
/**
* Prefetches static resources from the specified URL. Web browsers can then cache the
* prefetched resources and serve them from the user's local disk to provide faster access
* to your app.
* @param url The URL provided for prefetch
* @param prefetchFeatures Specify features which needs to be prefetched.
* @param additionalFlags This can be used to add any URL flag.
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
* @group Global methods
*/
export const prefetch: (url?: string, prefetchFeatures?: PrefetchFeatures[], additionalFlags?: {
[key: string]: string | number | boolean;
}) => void;
export const createAndSetInitPromise: () => void;
export const getInitPromise: () => Promise<ReturnType<typeof init>>;
export const getIsInitCalled: () => boolean;
/**
* Initializes the Visual Embed SDK globally and perform
* authentication if applicable. This function needs to be called before any ThoughtSpot
* component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
* to actually embed. That is handled internally.
* @param embedConfig The configuration object containing ThoughtSpot host,
* authentication mechanism and so on.
* @example
* ```js
* const authStatus = init({
* thoughtSpotHost: 'https://my.thoughtspot.cloud',
* authType: AuthType.None,
* });
* authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
* ```
* @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
* failure and logout. See {@link AuthStatus}
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
* @group Authentication / Init
*/
export const init: (embedConfig: EmbedConfig) => AuthEventEmitter;
/**
*
*/
export function disableAutoLogin(): void;
/**
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
* prevent the SDK from automatically logging in again.
*
* You can call the `init` method again to re login, if autoLogin is set to
* true in this second call it will be honored.
* @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
* @returns Promise which resolves when logout completes.
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
* @group Global methods
*/
export const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
/**
* Renders functions in a queue, resolves to next function only after the callback next
* is called
* @param fn The function being registered
*/
export const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
/**
* Imports TML representation of the metadata objects into ThoughtSpot.
* @param data
* @returns imports TML data into ThoughtSpot
* @example
* ```js
* executeTML({
* //Array of metadata Tmls in string format
* metadata_tmls: [
* "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
* \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
* ],
* import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
* create_new: false, // If selected, creates TML objects with new GUIDs.
* }).then(result => {
* console.log(result);
* }).catch(error => {
* console.error(error);
* });
*```
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
* @group Global methods
*/
export const executeTML: (data: executeTMLInput) => Promise<any>;
/**
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
* format.
* @param data
* @returns exports TML data
* @example
* ```js
* exportTML({
* metadata: [
* {
* type: "LIVEBOARD", //Metadata Type
* identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
* }
* ],
* export_associated: false,//indicates whether to export associated metadata objects
* export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
* //exporting a Liveboard and its associated objects, the API
* //returns the Liveboard TML data with the FQNs of the referenced
* //worksheet. If the exported TML data includes FQNs, you don't need
* //to manually add FQNs of the referenced objects during TML import.
* edoc_format: "JSON" //It takes JSON or YAML value
* }).then(result => {
* console.log(result);
* }).catch(error => {
* console.error(error);
* });
* ```
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
* @group Global methods
*/
export const exportTML: (data: exportTMLInput) => Promise<any>;
/**
*
*/
export function reset(): void;
/**
* Copyright (c) 2022
*
* Embed a ThoughtSpot Liveboard or visualization
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
* @summary Liveboard & visualization embed
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
/**
* The configuration for the embedded Liveboard or visualization page view.
* @group Embed components
*/
export interface LiveboardViewConfig extends Omit<ViewConfig, 'hiddenHomepageModules' | 'hiddenHomeLeftNavItems' | 'reorderedHomepageModules'> {
/**
* If set to true, the embedded object container dynamically resizes
* according to the height of the Liveboard.
*
* **Note**: Using fullHeight loads all visualizations on the
* Liveboard simultaneously, which results in multiple warehouse
* queries and potentially a longer wait for the topmost
* visualizations to display on the screen.
* Setting `fullHeight` to `false` fetches visualizations
* incrementally as users scroll the page to view the charts and tables.
*
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* fullHeight: true,
* });
* ```
*/
fullHeight?: boolean;
/**
* This is the minimum height(in pixels) for a full-height Liveboard.
* Setting this height helps resolve issues with empty Liveboards and
* other screens navigable from a Liveboard.
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
* @default 500
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* fullHeight: true,
* defaultHeight: 600,
* });
* ```
*/
defaultHeight?: number;
/**
* @Deprecated If set to true, the context menu in visualizations will be enabled.
* @example
* ```js
* const embed = new LiveboardEmbed('#tsEmbed', {
* ... // other options
* enableVizTransformations:true,
* })
* ```
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
*/
enableVizTransformations?: boolean;
/**
* The Liveboard to display in the embedded view.
* Use either liveboardId or pinboardId to reference the Liveboard to embed.
* @version SDK: 1.3.0 | ThoughtSpot ts7.aug.cl, 7.2.1
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* liveboardId:id of liveboard,
* })
*/
liveboardId?: string;
/**
* To support backward compatibility
* @hidden
*/
pinboardId?: string;
/**
* The visualization within the Liveboard to display.
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* vizId:'430496d6-6903-4601-937e-2c691821af3c',
* })
* ```
*/
vizId?: string;
/**
* If set to true, all filter chips from a
* Liveboard page will be read-only (no X buttons)
* @version SDK: 1.3.0 | ThoughtSpot ts7.aug.cl, 7.2.1.sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* preventLiveboardFilterRemoval:true,
* })
* ```
*/
preventLiveboardFilterRemoval?: boolean;
/**
* Array of visualization IDs which should be visible when the Liveboard
* renders. This can be changed by triggering the `SetVisibleVizs`
* event.
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* visibleVizs: [
* '430496d6-6903-4601-937e-2c691821af3c',
* 'f547ec54-2a37-4516-a222-2b06719af726'
* ]
* })
*/
visibleVizs?: string[];
/**
* To support backward compatibility
* @hidden
*/
preventPinboardFilterRemoval?: boolean;
/**
* Render embedded Liveboards and visualizations in the
* new Liveboard experience mode.
* @version SDK: 1.14.0 | ThoughtSpot: 8.6.0.cl, 8.8.1-sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* liveboardV2:true,
* })
* ```
*/
liveboardV2?: boolean;
/**
* Set a Liveboard tab as an active tab.
* Specify the tab ID.
* @example
* ```js
* const embed = new LiveboardEmbed('#tsEmbed', {
* ... // other options
* activeTabId:'id-1234',
* })
* ```
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
*/
activeTabId?: string;
/**
* Show or hide the tab panel of the embedded Liveboard.
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl, 9.8.0.sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* hideTabPanel:true,
* })
* ```
*/
hideTabPanel?: boolean;
/**
* Show or hide the Liveboard header.
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
* @default false
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* hideLiveboardHeader:true,
* });
* ```
*/
hideLiveboardHeader?: boolean;
/**
* Show or hide the Liveboard title.
* @default false
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* showLiveboardTitle:true,
* })
* ```
*/
showLiveboardTitle?: boolean;
/**
* Show or hide the Liveboard description.
* @default false
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* showLiveboardDescription:true,
* })
* ```
*/
showLiveboardDescription?: boolean;
/**
* Control the position and visibility of
* the Liveboard header as the users scroll down the
* embedded Liveboard page.
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other Liveboard view config
* isLiveboardHeaderSticky: true,
* });
* ```
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
*/
isLiveboardHeaderSticky?: boolean;
/**
* enable or disable ask sage
* @default false
* @version SDK: 1.29.0 | Thoughtspot: 9.12.0.cl
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* enableAskSage:true,
* })
* ```
*/
enableAskSage?: boolean;
/**
* This flag is used to enable the 2 column layout on a Liveboard
* @type {boolean}
* @default false
* @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* enable2ColumnLayout: true,
* })
* ```
*/
enable2ColumnLayout?: boolean;
/**
* Show a preview image of the visualization before the visualization loads.
* Only works for visualizations embeds with a viz id.
*
* Also, viz snashot should be enabled in the ThoughtSpot instance.
* Contact ThoughtSpot support to enable this feature.
*
* Since, this will show preview images, be careful that it may show
* undesired data to the user when using row level security.
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* liveboardId: 'liveboard-id',
* vizId: 'viz-id',
* showPreviewLoader: true,
* });
* embed.render();
* ```
* @version SDK: 1.32.0 | ThoughtSpot: 10.0.0.cl
*/
showPreviewLoader?: boolean;
/**
* Enables or disables the compact header feature on a Liveboard.
* Compact Liveboard header is turned off by default on Liveboards in
* ThoughtSpot Embedded apps.
*
* @type {boolean}
* @default false
* @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* isLiveboardCompactHeaderEnabled: true,
* })
* ```
*/
isLiveboardCompactHeaderEnabled?: boolean;
/**
* This flag is used to show/hide verified icon in the Liveboard compact header
* @type {boolean}
* @default true
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* showLiveboardVerifiedBadge: true,
* })
* ```
*/
showLiveboardVerifiedBadge?: boolean;
/**
* This flag is used to show/hide the re-verify banner
* in Liveboard compact header
* @type {boolean}
* @default true
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* showLiveboardReverifyBanner: true,
* })
* ```
*/
showLiveboardReverifyBanner?: boolean;
/**
* This flag is used to enable/disable hide irrelevant filters in a Liveboard tab
* @type {boolean}
* @default false
* @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* hideIrrelevantChipsInLiveboardTabs: true,
* })
* ```
*/
hideIrrelevantChipsInLiveboardTabs?: boolean;
/**
* The Liveboard to run on regular intervals to fetch the cdw token.
* @hidden
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* oAuthPollingInterval: value in milliseconds,
* })
*/
oAuthPollingInterval?: number;
/**
* The Liveboard is set to force a token fetch during the initial load.
* @hidden
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* isForceRedirect: false,
* })
*/
isForceRedirect?: boolean;
/**
* The source connection ID for authentication.
* @hidden
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* dataSourceId: '',
* })
*/
dataSourceId?: string;
/**
* This flag is for show/hide checkboxes for include or exclude
* cover and filter pages in the Liveboard PDF
* @type {boolean}
* @default true
* @version SDK: 1.38.0 | ThoughtSpot:10.8.0.cl
* @example
* ```js
* const embed = new LiveboardEmbed('#embed-container', {
* ... // other options
* coverAndFilterOptionInPDF: false,
* })
* ```
*/
coverAndFilterOptionInPDF?: boolean;
}
/**
* Embed a ThoughtSpot Liveboard or visualization. When rendered it already
* waits for the authentication to complete, so you need not wait for
* `AuthStatus.SUCCESS`.
* @example
* ```js
* import { .. } from '@thoughtspot/visual-embed-sdk';
* init({ ... });
* const embed = new LiveboardEmbed("#container", {
* liveboardId: <your-id-here>,
* // .. other params here.
* })
* ```
* @group Embed components
*/
export class LiveboardEmbed extends V1Embed {
protected viewConfig: LiveboardViewConfig;
constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig);
/**
* Construct a map of params to be passed on to the
* embedded Liveboard or visualization.
*/
protected getEmbedParams(): string;
protected beforePrerenderVisible(): void;
protected handleRenderForPrerender(): Promise<TsEmbed>;
/**
* Triggers an event to the embedded app
* @param {HostEvent} messageType The event type
* @param {any} data The payload to send with the message
* @returns A promise that resolves with the response from the embedded app
*/
trigger<HostEventT extends HostEvent, PayloadT>(messageType: HostEventT, data?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
/**
* Render an embedded ThoughtSpot Liveboard or visualization
* @param renderOptions An object specifying the Liveboard ID,
* visualization ID and the runtime filters.
*/
render(): Promise<LiveboardEmbed>;
navigateToLiveboard(liveboardId: string, vizId?: string, activeTabId?: string): void;
/**
* Returns the full url of the Liveboard/visualization which can be used to open
* this Liveboard inside the full Thoughtspot application in a new tab.
* @returns url string
*/
getLiveboardUrl(): string;
}
/**
* @hidden
*/
export class PinboardEmbed extends LiveboardEmbed {
}
/**
* Copyright (c) 2022
*
* Embed ThoughtSpot search or a saved answer
* @summary Search embed
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
/**
* Configuration for search options.
*
*/
export interface SearchOptions {
/**
* Search tokens to pass in the query.
*/
searchTokenString: string;
/**
* Boolean to define if the search should be executed or not.
* If it is executed, the focus is placed on the results.
* If it’s not executed, the focus is placed at the end of
* the token string in the search bar.
*/
executeSearch?: boolean;
}
/**
* Define the initial state os column custom group accordions
* in data panel v2.
*/
export enum DataPanelCustomColumnGroupsAccordionState {
/**
* Expand all the accordion initially in data panel v2.
*/
EXPAND_ALL = "EXPAND_ALL",
/**
* Collapse all the accordions initially in data panel v2.
*/
COLLAPSE_ALL = "COLLAPSE_ALL",
/**
* Expand the first accordion and collapse the rest.
*/
EXPAND_FIRST = "EXPAND_FIRST"
}
/**
* The configuration attributes for the embedded search view.
* @group Embed components
*/
export interface SearchViewConfig extends Omit<ViewConfig, 'hiddenHomepageModules' | 'hiddenHomeLeftNavItems' | 'hiddenTabs' | 'visibleTabs' | 'reorderedHomepageModules'> {
/**
* If set to true, the data sources panel is collapsed on load,
* but can be expanded manually.
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* collapseDataSources:true,
* })
* ```
*/
collapseDataSources?: boolean;
/**
* If set to true, the data panel is collapsed on load,
* but can be expanded manually.
* @version: SDK: 1.34.0 | ThoughtSpot: 10.3.0.cl
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* collapseDataPanel:true,
* })
* ```
*/
collapseDataPanel?: boolean;
/**
* Show or hide the data sources panel.
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* hideDataSources:true,
* })
* ```
*/
hideDataSources?: boolean;
/**
* Show or hide the charts and tables in search answers.
* This attribute can be used to create a custom visualization
* using raw answer data.
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* hideResults:true,
* })
* ```
*/
hideResults?: boolean;
/**
* If set to true, the Search Assist feature is enabled.
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* enableSearchAssist:true,
* })
* ```
*/
enableSearchAssist?: boolean;
/**
* If set to true, the tabular view is set as the default
* format for presenting search data.
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* forceTable:true,
* })
*/
forceTable?: boolean;
/**
* The array of data source GUIDs to set on load.
* Only a single data source is supported currently.
* @deprecated Use `dataSource` instead.
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* dataSources:['id-234','id-456'],
* })
* ```
*/
dataSources?: string[];
/**
* The array of data source GUIDs to set on load.
* @version: SDK: 1.19.0
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* dataSource:'id-234',
* })
* ```
*/
dataSource?: string;
/**
* The initial search query to load the answer with.
* @deprecated
*
* Use {@link searchOptions} instead.
*/
searchQuery?: string;
/**
* Configuration for search options.
* Includes the following properties:
*
* `searchTokenString`: Search tokens to pass in the query.
*
* `executeSearch`: Boolean to define if the search should be executed or not.
* If it is executed, the focus is placed on the results.
* If it’s not executed, the focus is placed at the end of
* the token string in the search bar.
* @example
* ```js
* searchOptions: {
* searchTokenString: '[quantity purchased] [region]',
* executeSearch: true,
* }
* ```
*/
searchOptions?: SearchOptions;
/**
* Exclude the search token string from the URL.
* If set to true, the search token string is not appended to the URL.
* @version: SDK: 1.35.7 | ThoughtSpot: 10.7.0.cl
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* searchOptions: {
* searchTokenString: '[quantity purchased] [region]',
* executeSearch: true,
* },
* excludeSearchTokenStringFromURL: true,
* });
* ```
*/
excludeSearchTokenStringFromURL?: boolean;
/**
* The GUID of a saved answer to load initially.
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* answerId:'sed-1234',
* })
* ```
*/
answerId?: string;
/**
* If set to true, the search page will render without the Search Bar
* The chart/table should still be visible.
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* hideSearchBar:true,
* })
* ```
*/
hideSearchBar?: boolean;
/**
* Flag to set if last selected dataSource should be used
*