@thoughtspot/visual-embed-sdk
Version:
ThoughtSpot Embed SDK
1,447 lines (1,406 loc) • 188 kB
text/typescript
/**
* Copyright (c) 2023
*
* TypeScript type definitions for ThoughtSpot Visual Embed SDK
* @summary Type definitions for Embed SDK
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
import { CustomCssVariables } from './css-variables';
import type { SessionInterface } from './utils/graphql/answerService/answerService';
/**
* The authentication mechanism for allowing access to the
* the embedded app
* @group Authentication / Init
*/
export enum AuthType {
/**
* No authentication on the SDK. Pass-through to the embedded App. Alias for
* `Passthrough`.
* @example
* ```js
* init({
* // ...
* authType: AuthType.None,
* });
* ```
*/
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
*/
EmbeddedSSO = 'EmbeddedSSO',
/**
* SSO using SAML
* @deprecated Use {@link SAMLRedirect} instead
* @hidden
*/
SSO = 'SSO_SAML',
/**
* SSO using SAML
* @deprecated Use {@link SAMLRedirect} instead
* @hidden
*/
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);
* });
* ```
*/
SAMLRedirect = 'SSO_SAML',
/**
* SSO using OIDC
* @hidden
* @deprecated Use {@link OIDCRedirect} instead
*/
OIDC = 'SSO_OIDC',
/**
* SSO using OIDC
* Will make the host application redirect to the OIDC IdP.
* See code samples in {@link SAMLRedirect}.
*/
OIDCRedirect = 'SSO_OIDC',
/**
* Trusted authentication server
* @hidden
* @deprecated Use {@link TrustedAuth} instead
*/
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);
* }
* });
* ```
*/
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
*/
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.
*/
Basic = 'Basic',
}
/**
*
* 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).
*
*/
export enum HomeLeftNavItem {
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
SearchData = 'search-data',
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
Home = 'insights-home',
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
Liveboards = 'liveboards',
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
Answers = 'answers',
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
MonitorSubscription = 'monitor-alerts',
/**
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
*/
SpotIQAnalysis = 'spotiq-analysis',
/**
* @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
*/
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
*/
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
*/
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
*/
Favorites = 'favorites',
}
export type DOMSelector = string | HTMLElement;
/**
* inline customCSS within the {@link CustomisationsInterface}.
* Use {@link CustomCssVariables} or css rules.
*/
export interface customCssInterface {
/**
* The custom css variables, which can be set.
* The variables are available in the {@link CustomCssVariables}
* interface. For more information, see
* link:https://developers.thoughtspot.com/docs/css-variables-reference[CSS variable reference].
*/
variables?: CustomCssVariables;
/**
* Can be used to define a custom font face
* like:
* @example
* ```js
* rules_UNSTABLE?: {
* "@font-face": {
* "font-family": "custom-font",
* "src": url("/path/")
* };
* };
* ```
*
* Also, custom css rules outside of variables.
* @example
* ```js
* rules_UNSTABLE?: {
* ".thoughtspot_class_name": {
* "border-radius": "10px",
* margin: "20px"
* };
* };
* ```
*/
rules_UNSTABLE?: {
[selector: string]: {
[declaration: string]: string;
};
};
}
/**
* Styles within the {@link CustomisationsInterface}.
*/
export interface CustomStyles {
customCSSUrl?: string;
customCSS?: customCssInterface;
}
/**
* Configuration to define the customization on the Embedded
* ThoughtSpot components.
* You can customize styles, text strings, and icons.
* For more information, see link:https://developers.thoughtspot.com/docs/custom-css[CSS customization framework].
* @example
* ```js
* init({
* // ...
* customizations: {
* style: {
* customCSS: {
* variables: {},
* rules_UNSTABLE: {}
* }
* },
* content: {
* strings: {
* 'LIVEBOARDS': 'Dashboards',
* 'ANSWERS': 'Visualizations',
* 'Edit': 'Modify',
* 'Show underlying data': 'Show source data',
* 'SpotIQ': 'Insights',
* 'Monitor': 'Alerts',
* }
* },
* iconSpriteUrl: 'https://my-custom-icon-sprite.svg'
* }
* })
* ```
*/
export interface CustomisationsInterface {
style?: CustomStyles;
content?: {
/**
* @version SDK: 1.26.0 | 9.7.0.cl
*/
strings?: Record<string, any>;
stringIDs?: Record<string, string>;
stringIDsUrl?: string;
[key: string]: any;
};
iconSpriteUrl?: string;
}
/**
* The configuration object for embedding ThoughtSpot content.
* It includes the ThoughtSpot hostname or IP address,
* the type of authentication, and the authentication endpoint
* if a trusted authentication server is used.
* @group Authentication / Init
*/
export interface EmbedConfig {
/**
* The ThoughtSpot cluster hostname or IP address.
*/
thoughtSpotHost: string;
/**
* The authentication mechanism to use.
*/
authType: AuthType;
/**
* [AuthServer] The trusted authentication endpoint to use to get the
* authentication token. A `GET` request is made to the
* authentication API endpoint, which returns the token
* as a plaintext response. For trusted authentication,
* the `authEndpoint` or `getAuthToken` attribute is required.
*/
authEndpoint?: string;
/**
* [AuthServer] A function that invokes the trusted authentication endpoint
* and returns a Promise that resolves to the `auth token` string.
* For trusted authentication, the `authEndpoint` or `getAuthToken`
* attribute is required.
*
* It is advisable to fetch a new token inside this method and not
* reuse the old issued token. When auth expires this method is
* called again and if it is called with an older token, the authentication
* will not succeed.
*/
getAuthToken?: () => Promise<string>;
/**
* [AuthServer / Basic] The user name of the ThoughtSpot user. This
* attribute is required for trusted authentication.
*/
username?: string;
/**
* [Basic] The ThoughtSpot login password corresponding to the username
*
* Warning: This feature is primarily intended for developer testing. It is
* strongly advised not to use this authentication method in production.
*/
password?: string;
/**
* [SSO] For SSO Authentication, if `noRedirect` is set to true, it will
* open the SAML auth flow in a popup, instead of redirecting the browser in
* place.
* @default false
* @deprecated
*/
noRedirect?: boolean;
/**
* [SSO] For SSO Authentication, if `inPopup` is set to true, it will open
* the SAML auth flow in a popup, instead of redirecting the browser in place.
*
* Need to use this with `authTriggerContainer`. Or manually trigger
* the `AuthEvent.TRIGGER_SSO_POPUP` event on a user interaction.
* @default false
* @version SDK: 1.18.0
*/
inPopup?: boolean;
/**
* [SSO] For SSO Authentication, one can supply an optional path param;
* This will be the path on the host origin where the SAML flow will be
* terminated.
*
* Eg: "/dashboard", "#/foo" [Do not include the host]
* @version SDK: 1.10.2 | ThoughtSpot 8.2.0.cl, 8.4.1.sw
*/
redirectPath?: string;
/** @internal */
basepath?: string;
/**
* Boolean to define if the query parameters in the ThoughtSpot URL
* should be encoded in base64. This provides additional security to
* ThoughtSpot clusters against cross-site scripting attacks.
* @default false
*/
shouldEncodeUrlQueryParams?: boolean;
/**
* Suppress cookie access alert when third-party cookies are blocked by the
* user's browser. Third-party cookie blocking is the default behaviour on
* some web browsers like Safari. If you set this attribute to `true`,
* you are encouraged to handle `noCookieAccess` event, to show your own treatment
* in this case.
* @default false
*/
suppressNoCookieAccessAlert?: boolean;
/**
* Ignore the cookie access alert when third-party cookies are blocked by the
* user's browser. If you set this to `true`, the embedded iframe behaviour
* persists even in the case of a non-logged-in user.
* @default false
*/
ignoreNoCookieAccess?: boolean;
/**
* Re-login a user with the previous login options
* when a user session expires.
* @default false
*/
autoLogin?: boolean;
/**
* Disable redirection to the login page when the embedded session expires
* This flag is typically used alongside the combination of authentication modes such
* as {@link AuthType.AuthServer} and auto-login behavior {@link
* EmbedConfig.autoLogin}
* @version SDK: 1.9.3 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
* @default false
*/
disableLoginRedirect?: boolean;
/**
* This message is displayed in the embedded view when a user login fails.
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
*/
loginFailedMessage?: string;
/**
* Calls the prefetch method internally when set to `true`
* @default false
*/
callPrefetch?: boolean;
/**
* When there are multiple objects embedded, queue the rendering of embedded objects
* to start after the previous embed's render is complete. This helps improve
* performance by decreasing the load on the browser.
* @Version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
* @default false
*/
queueMultiRenders?: boolean;
/**
* [AuthServer|Basic] Detect if third-party party cookies are enabled by doing an
* additional call. This is slower and should be avoided. Listen to the
* `NO_COOKIE_ACCESS` event to handle the situation.
*
* This is slightly slower than letting the browser handle the cookie check, as it
* involves an extra network call.
* @version SDK: 1.10.4 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
*/
detectCookieAccessSlow?: boolean;
/**
* Hide the `beta` alert warning message for SearchEmbed.
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
*/
suppressSearchEmbedBetaWarning?: boolean;
/**
* Hide `beta` alert warning message for SageEmbed.
*
*/
suppressSageEmbedBetaWarning?: boolean;
/**
* Custom style params for embed Config.
* @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
*/
customizations?: CustomisationsInterface;
/**
* For `inPopup` SAMLRedirect or OIDCRedirect authentication, we need a
* button that the user can click to trigger the flow.
* This attribute sets a containing element for that button.
* @example
* ```js
* init({
* authType: AuthType.SAMLRedirect,
* inPopup: true,
* authTriggerContainer: '#auth-trigger-container'
* })
* ```
* @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
*/
authTriggerContainer?: string | HTMLElement;
/**
* Specify that we want to use the `AuthEvent.TRIGGER_SSO_POPUP` event to trigger
* SAML popup. This is useful when you want to trigger the popup on a custom user
* action.
*
*/
useEventForSAMLPopup?: boolean;
/**
* Text to show in the button which triggers the popup auth flow.
* Default: `Authorize`.
* @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
*/
authTriggerText?: string;
/**
* Prevent users from accessing the full application or ThoughtSpot application pages
* access to the embedded application users
* outside of the iframe.
* @default true
* @version SDK: 1.22.0 | ThoughtSpot: 9.3.0.cl, 9.5.1.sw
*/
blockNonEmbedFullAppAccess?: boolean;
/**
* Host config in case embedded app is inside TS app itself
* @hidden
*/
hostConfig?: {
hostUserGuid: string;
hostClusterId: string;
hostClusterName: string;
};
/**
* Pendo API key to enable Pendo tracking to your own subscription, the key
* is added as an additional key to the embed, as per this link:https://support.pendo.io/hc/en-us/articles/360032201951-Send-data-to-multiple-subscriptions[document].
* @version SDK: 1.27.0 | ThoughtSpot: 9.8.0.cl
*/
pendoTrackingKey?: string;
/**
* If passed as true all alerts will be suppressed in the embedded app.
* @version SDK: 1.26.2 | ThoughtSpot: *
*/
suppressErrorAlerts?: boolean;
/**
* Suppress or show specific types of logs in the console output.
* For example, `LogLevel.ERROR` shows only Visual Embed SDK and
* ThoughtSpot application errors and suppresses
* other logs such as warnings, information alerts,
* and debug messages in the console output.
*
* @default LogLevel.ERROR
* @example
* ```js
* init({
* ...embedConfig,
* logLevel: LogLevel.SILENT
* })
* ```
* @version SDK: 1.26.7 | ThoughtSpot: 9.10.0.cl
*/
logLevel?: LogLevel;
/**
* Disables the Mixpanel tracking from the SDK.
* @version SDK: 1.27.9
*/
disableSDKTracking?: boolean;
/**
* Overrides default/user preferred locale for date formatting
* @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
*/
dateFormatLocale?: string;
/**
* Overrides default/user preferred locale for number formatting
* @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
*/
numberFormatLocale?: string;
/**
* Format to be used for currency when currency format is set to infer from browser
* @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
*/
currencyFormat?: string;
/**
* This flag is used to disable the token verification in the SDK.
* Enabling this flag will also disable the caching of the token.
* @hidden
* @example
* ```js
* init({
* ...embedConfig,
* disableTokenVerification : true
* })
* ```
* @version SDK: 1.28.5 | ThoughtSpot: 9.10.0.cl, 10.1.0.sw
*/
disableTokenVerification?: boolean;
/**
* This flag is used to disable showing the login failure page in the embedded app.
* @version SDK 1.32.3 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
*/
disableLoginFailurePage?: boolean;
/**
* This is an object (key/val) of override flags which will be applied
* to the internal embedded object. This can be used to add any
* URL flag.
* Warning: This option is for advanced use only and is used internally
* to control embed behavior in non-regular ways. We do not publish the
* list of supported keys and values associated with each.
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* additionalFlags: {
* flag1: 'value1',
* flag2: 'value2'
* }
* });
* ```
* @version SDK: 1.33.5 | ThoughtSpot: *
*/
additionalFlags?: { [key: string]: string | number | boolean };
/**
* This is an object (key/val) for customVariables being
* used by the third party tool's script.
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* customVariablesForThirdPartyTools: {
* key1: 'value1',
* key2: 'value2'
* }
* });
* ```
* @version SDK 1.37.0 | ThoughtSpot: 10.8.0.cl
*/
customVariablesForThirdPartyTools?: Record< string, any >;
disablePreauthCache?: boolean;
/**
* Disable fullscreen presentation mode functionality. When enabled, prevents entering
* and exiting fullscreen mode for embedded visualizations during presentations.
* @default true (feature is disabled by default)
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
* @example
* ```js
* init({
* ... // other embed config options
* disableFullscreenPresentation: false, // enables the feature
* })
* ```
*/
disableFullscreenPresentation?: boolean;
/**
* Custom Actions allows users to define interactive UI actions (like buttons or menu
* items) that appear in ThoughtSpot's visualizations, answers, and Liveboards. These
* actions enable users to trigger custom workflows — such as navigating to an
* external app, calling an API, or opening a modal — based on the data context of
* what they clicked can be used to trigger custom logic when the action is clicked.
* @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
* @example
* ```js
* import { CustomActionPosition, CustomActionTarget } from '@thoughtspot/visual-embed-sdk';
* init({
* ... // other embed config options
* customActions: [
* {
* name: 'customAction',
* id: 'customAction',
* target: CustomActionTarget.VISUALIZATION,
* position: CustomActionPosition.PRIMARY,
* }
* }
* ]
* })
* ```
*/
customActions?: CustomAction[];
}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface LayoutConfig {}
/**
* Embedded iframe configuration
* @group Embed components
*/
export interface FrameParams {
/**
* The width of the iframe (unit is pixels if numeric).
*/
width?: number | string;
/**
* The height of the iframe (unit is pixels if numeric).
*/
height?: number | string;
/**
* Set to 'lazy' to enable lazy loading of the embedded TS frame.
* This will defer loading of the frame until it comes into the
* viewport. This is useful for performance optimization.
*/
loading?: 'lazy' | 'eager' | 'auto';
/**
* This parameters will be passed on the iframe
* as is.
*/
[key: string]: string | number | boolean | undefined;
}
/**
* The common configuration object for an embedded view.
*/
export interface BaseViewConfig {
/**
* @hidden
*/
layoutConfig?: LayoutConfig;
/**
* The width and height dimensions to render an embedded
* object inside your app. Specify the values in pixels or percentage.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* frameParams: {
* width: '500px' | '50%',
* height: '400px' | '60%',
* },
* })
* ```
*/
frameParams?: FrameParams;
/**
* @hidden
*/
theme?: string;
/**
* @hidden
*/
styleSheet__unstable?: string;
/**
* The list of actions to disable from the primary menu, more menu
* (...), and the contextual menu. These actions will be disabled
* for the user.
* Use this to disable actions.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* disabledActions: [Action.Download, Action.Save],
* });
* ```
*/
disabledActions?: Action[];
/**
* The tooltip to display for disabled actions.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* disabledActions: [Action.Download, Action.Save],
* disabledActionReason: "Reason for disabling",
* });
* ```
*/
disabledActionReason?: string;
/**
* The list of actions to hide from the embedded.
* This actions will be hidden from the user.
* Use this to hide an action.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* hiddenActions: [Action.Download, Action.Export],
* });
* ```
* @important
*/
hiddenActions?: Action[];
/**
* The list of actions to display from the primary menu, more menu
* (...), and the contextual menu. These will be only actions that
* are visible to the user.
* Use this to hide all actions except the ones you want to show.
*
* Use either this or hiddenActions.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
* @important
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* visibleActions: [Action.Download, Action.Export],
* });
* ```
*/
visibleActions?: Action[];
/**
* The locale settings to apply to the embedded view.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* locale:'en',
* })
* ```
*/
locale?: string;
/**
* This is an object (key/val) of override flags which will be applied
* to the internal embedded object. This can be used to add any
* URL flag.
* If the same flags are passed in init, they will be overriden by the values here.
* Warning: This option is for advanced use only and is used internally
* to control embed behavior in non-regular ways. We do not publish the
* list of supported keys and values associated with each.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* additionalFlags: {
* flag1: 'value1',
* flag2: 'value2'
* },
* });
* ```
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
*/
additionalFlags?: { [key: string]: string | number | boolean };
/**
* Dynamic CSSUrl and customCSS to be injected in the loaded application.
* You would also need to set `style-src` in the CSP settings.
* @version SDK: 1.17.2 | ThoughtSpot: 8.4.1.sw, 8.4.0.cl
* @default ''
*/
customizations?: CustomisationsInterface;
/**
* Insert as a sibling of the target container, instead of appending to a
* child inside it.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.2.0 | ThoughtSpot: 9.0.0.cl, 9.0.0.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* insertAsSibling:true,
* })
* ```
*/
insertAsSibling?: boolean;
/**
* Use a pre-rendered iframe from a pool of pre-rendered iframes
* if available and matches the configuration.
* @version SDK: 1.22.0
* @hidden
*
* See [docs]() on how to create a prerender pool.
*/
usePrerenderedIfAvailable?: boolean;
/**
* PreRender id to be used for PreRendering the embed.
* Use PreRender to render the embed in the background and then
* show or hide the rendered embed using showPreRender or hidePreRender respectively.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* preRenderId: "preRenderId-123",
* });
* embed.showPreRender();
* ```
* @version SDK: 1.25.0 | ThoughtSpot: 9.6.0.cl, 9.8.0.sw
*/
preRenderId?: string;
/**
* Determines if the PreRender component should dynamically track the size
* of its embedding element and adjust its own size accordingly.
* Enabling this option allows the PreRender component to automatically adapt
* its dimensions based on changes to the size of the embedding element.
* @type {boolean}
* @default false
* @version SDK: 1.24.0 | ThoughtSpot:9.4.0.cl, 9.4.0.sw
* @example
* ```js
* // Disable tracking PreRender size in the configuration
* const config = {
* doNotTrackPreRenderSize: true,
* };
*
* // Instantiate an object with the configuration
* const myComponent = new MyComponent(config);
* ```
*/
doNotTrackPreRenderSize?: boolean;
/**
* Enable the V2 shell. This can provide performance benefits
* due to a lighterweight shell.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* enableV2Shell_experimental: true,
* });
* ```
* @version SDK: 1.31.2 | ThoughtSpot: 10.0.0.cl
*/
enableV2Shell_experimental?: boolean;
/**
* For internal tracking of the embed component type.
* @hidden
*/
embedComponentType?: string;
/**
* This flag can be used to expose translation IDs on the embedded app.
* @default false
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
*/
exposeTranslationIDs?: boolean;
/**
* This flag can be used to disable links inside the embedded app,
* and disable redirection of links in a new tab.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* disableRedirectionLinksInNewTab: true,
* });
* ```
* @version SDK: 1.32.1 | ThoughtSpot: 10.3.0.cl
*/
disableRedirectionLinksInNewTab?: boolean;
/**
* Overrides an Org context for embedding application users.
* This parameter allows a user authenticated to one Org to view the
* objects from another Org.
* The `overrideOrgId` setting is honoured only if the
* Per Org URL feature is enabled on your ThoughtSpot instance.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* overrideOrgId: 142536,
* });
* ```
* @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
*/
overrideOrgId?: number;
/**
* Flag to override the *Open Link in New Tab* context menu option.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* linkOverride:false,
* })
* ```
*/
linkOverride?: boolean;
/**
* The primary action to display on top of the viz for Liveboard and App Embed.
* Use this to set the primary action.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* primaryAction: Action.Download
* });
* ```
*/
primaryAction?: Action | string;
/**
* flag to enable insert into slides action
* @hidden
* @private
*/
insertInToSlide?: boolean;
/**
* Show alert messages and toast messages in the embed.
* Supported embed in all embed types.
*
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other embed view config
* showAlerts:true,
* })
* ```
*/
showAlerts?: boolean;
/**
* Custom Actions allows users to define interactive UI actions (like buttons or menu
* items) that appear in ThoughtSpot's visualizations, answers, and Liveboards. These
* actions enable users to trigger custom workflows — such as navigating to an
* external app, calling an API, or opening a modal — based on the data context of
* what they clicked can be used to trigger custom logic when the action is clicked.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterEmbed`
* @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
* @example
* ```js
* import { CustomActionPosition, CustomActionTarget } from '@thoughtspot/visual-embed-sdk';
* // Use supported embed types such as AppEmbed or LiveboardEmbed
* const embed = new LiveboardEmbed('#tsEmbed', {
* ... // other embed config options
* customActions: [
* {
* name: 'customAction',
* id: 'customAction',
* target: CustomActionTarget.VISUALIZATION,
* position: CustomActionPosition.PRIMARY,
* }
* }
* ]
* })
* ```
*/
customActions?: CustomAction[];
}
/**
* The configuration object for Home page embeds configs.
*/
export interface HomePageConfig {
/**
* Hide list page columns
* For example: hiddenListColumns = [ListPageColumns.Author]
*
* **Note**: This option is currently available only in full app embedding and requires importing the ListPageColumns enum.
* At present, it can be used with Liveboard and Answer list pages, and starting with version 10.14.0.cl, it will also be supported for the Home page.
*
* Supported embed types: `AppEmbed`
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
* @example
* ```js
* import { ListPageColumns } from '@thoughtspot/visual-embed-sdk';
*
* const embed = new AppEmbed('#tsEmbed', {
* ... //other embed view config
* hiddenListColumns : [ListPageColumns.Favorite,ListPageColumns.Author],
* })
* ```
*/
hiddenListColumns?: ListPageColumns[];
/**
* Hide the home page modules
* For example: hiddenHomepageModules = [HomepageModule.MyLibrary]
*
* **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).
* To use it, you need to import `HomepageModule` enum.
*
* Supported embed types: `AppEmbed`
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
* @example
* ```js
* import { HomepageModule } from '@thoughtspot/visual-embed-sdk';
*
* const embed = new AppEmbed('#tsEmbed', {
* ... //other embed view config
* hiddenHomepageModules : [HomepageModule.Favorite,HomepageModule.Learning],
* })
* ```
*/
hiddenHomepageModules?: HomepageModule[];
/**
* reordering the home page modules
* eg: reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]
*
* **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).
* To use it, you need to import `HomepageModule` enum.
*
* Supported embed types: `AppEmbed`
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl, 10.1.0.sw
* @example
* ```js
* import { HomepageModule } from '@thoughtspot/visual-embed-sdk';
*
* const embed = new AppEmbed('#tsEmbed', {
* ... //other embed view config
* reorderedHomepageModules:[HomepageModule.Favorite,HomepageModule.MyLibrary],
* })
* ```
*/
reorderedHomepageModules?: HomepageModule[];
/**
* homepageLeftNavItems : Show or hide the left navigation bar items.
* There are 8 eight home navigation list items.
* To hide these items, specify the string in the array.
*
* Supported embed types: `AppEmbed`
* @example
* ```js
* import { HomeLeftNavItem } from '@thoughtspot/visual-embed-sdk';
*
* const embed = new AppEmbed('#tsEmbed', {
* ... //other embed view config
* hiddenHomeLeftNavItems : [HomeLeftNavItem.Home,HomeLeftNavItem.Answers],
* })
* ```
*
* **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).
* To use it, you need to import `HomeLeftNavItem` enum.
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
*/
hiddenHomeLeftNavItems?: HomeLeftNavItem[];
}
/**
* The configuration object for common Search and Liveboard embeds configs.
*/
export interface SearchLiveboardCommonViewConfig {
/**
* The list of runtime filters to apply to a search Answer,
* visualization, or Liveboard.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SearchEmbed`
* @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* runtimeFilters: [
* {
* columnName: 'value',
* operator: RuntimeFilterOp.EQ,
* values: ['string' | 123 | true],
* },
* ],
* })
* ```
*/
runtimeFilters?: RuntimeFilter[];
/**
* The list of parameter override to apply to a search Answer,
* visualization, or Liveboard.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SearchEmbed`
* @version SDK : 1.25.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* runtimeParameters: [
* {
* name: 'value',
* value: 'string' | 123 | true,
* },
* ]
* })
* ```
*/
runtimeParameters?: RuntimeParameter[];
/**
* flag to set ContextMenu Trigger to either left or right click.
*
* Supported embed types: `AppEmbed`, `SageEmbed`, `SearchEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SageEmbed, or SearchEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* contextMenuTrigger:ContextMenuTriggerOptions.LEFT_CLICK || RIGHT_CLICK,
* })
* ```
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
*/
contextMenuTrigger?: ContextMenuTriggerOptions;
/**
* Boolean to exclude runtimeFilters in the URL
* By default it is true, this flag removes runtime filters from the URL
* when set to false, runtime filters will be included in the URL.
*
* Irrespective of this flag, runtime filters ( if passed ) will be applied to the
* embedded view.
* @default false
* @version SDK: 1.24.0 | ThoughtSpot: 9.5.0.cl
*/
excludeRuntimeFiltersfromURL?: boolean;
/**
* Boolean to exclude runtimeParameters from the URL
* when set to true, this flag removes runtime parameters from the URL.
*
* Irrespective of this flag, runtime filters ( if passed ) will be applied to the
* embedded view.
* @default false
* @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl
*/
excludeRuntimeParametersfromURL?: boolean;
/**
* To set the initial state of the search bar in case of saved Answers.
*
* Supported embed types: `SageEmbed`, `AppEmbed`, `SearchBarEmbed`
* @default true
* @version SDK: 1.34.0 | ThoughtSpot: 10.3.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, SageEmbed, AppEmbed, or SearchBarEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* collapseSearchBar: true,
* });
*/
collapseSearchBar?: boolean;
/**
* Flag to control Data panel experience
*
* Supported embed types: `SageEmbed`, `AppEmbed`, `SearchBarEmbed`, `LiveboardEmbed`, `SearchEmbed`
* @default true
* @version SDK: 1.43.0 | ThoughtSpot Cloud: 10.14.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, SageEmbed, AppEmbed, or SearchBarEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* dataPanelV2: true,
* })
* ```
*/
dataPanelV2?: boolean;
/**
* To enable custom column groups in data panel v2
*
* Supported embed types: `SageEmbed`, `SearchBarEmbed`, `LiveboardEmbed`, `SearchEmbed`
* @version SDK: 1.32.0 | ThoughtSpot: 10.0.0.cl, 10.1.0.sw
* @default false
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, SageEmbed, SearchBarEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* enableCustomColumnGroups: true,
* });
* ```
*/
enableCustomColumnGroups?: boolean;
}
/**
* The configuration object for common Liveboard and App embeds configs.
*/
export interface LiveboardAppEmbedViewConfig {
/**
* Show or hide Liveboard header
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* hideLiveboardHeader : true,
* })
* ```
*/
hideLiveboardHeader?: boolean;
/**
* Show or hide Liveboard title
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* showLiveboardTitle:true,
* })
* ```
*/
showLiveboardTitle?: boolean;
/**
* Show or hide Liveboard description
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @default false
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* showLiveboardDescription:true,
* })
* ```
*/
showLiveboardDescription?: boolean;
/**
* Boolean to control if Liveboard header is sticky or not.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#embed', {
* ... // other app view config
* isLiveboardHeaderSticky: true,
* });
* ```
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
*/
isLiveboardHeaderSticky?: boolean;
/**
* This attribute can be used to enable the two-column layout on an embedded Liveboard
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @type {boolean}
* @default false
* @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* enable2ColumnLayout: true,
* })
* ```
*/
enable2ColumnLayout?: boolean;
/**
* This flag can be used to enable the compact header in Liveboard
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @type {boolean}
* @default false
* @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* isLiveboardCompactHeaderEnabled: true,
* })
* ```
*/
isLiveboardCompactHeaderEnabled?: boolean;
/**
* This flag can be used to show or hide the Liveboard verified icon in the compact
* header.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
* @default true
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* showLiveboardVerifiedBadge: true,
* })
* ```
*/
showLiveboardVerifiedBadge?: boolean;
/**
* This flag is used to enable/disable hide irrelevant filters in Liveboard tab
*
* **Note**: This feature is supported only if compact header is enabled on your Liveboard. To enable compact header, use the `isLiveboardCompactHeaderEnabled` attribute.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
* @default false
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* hideIrrelevantChipsInLiveboardTabs: true,
* isLiveboardCompactHeaderEnabled: true,