@thoughtspot/visual-embed-sdk
Version:
ThoughtSpot Embed SDK
1,365 lines (1,358 loc) • 314 kB
TypeScript
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// ../../../react
// ../../../eventemitter3
import React from 'react';
import EventEmitter from 'eventemitter3';
interface SearchProps extends EmbedProps, SearchViewConfig {
}
interface PreRenderProps {
/**
* 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.
* @example
* ```js
* const embed = new LiveboardEmbed('#embed', {
* ... // other liveboard view config
* preRenderId: "preRenderId-123"
* });
* embed.showPreRender();
* ```
*
* Use PreRendered react component for pre rendering embed components.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedLiveboardEmbed preRenderId="someId" liveboardId="libId" />
* }
* ```
* function MyComponent() {
* return <LiveboardEmbed preRenderId="someId" liveboardId="libId" />
* }
* ```
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
*/
preRenderId: string;
}
/**
* React component for Search Embed.
* @example
* ```tsx
* function Search() {
* return <SearchEmbed
* dataSource="dataSourceId"
* searchOptions={{ searchTokenString: "[revenue]" }}
* />
* }
* ```
*/
export const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<_SearchEmbed>>;
export const PreRenderedSearchEmbed: React.ForwardRefExoticComponent<SearchProps & PreRenderProps & React.RefAttributes<_SearchEmbed>>;
interface AppProps extends EmbedProps, AppViewConfig {
}
/**
* React component for Full app Embed.
* @example
* ```tsx
* function Search() {
* return <AppEmbed
* showPrimaryNavbar={false}
* pageId={Page.Liveboards}
* onError={(error) => console.error(error)}
* />
* }
* ```
*/
export const AppEmbed: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<_AppEmbed>>;
/**
* React component for PreRendered Liveboard embed.
*
* PreRenderedAppEmbed will preRender the SearchBarEmbed and will be hidden by
* default.
*
* AppEmbed with preRenderId passed will call showPreRender on the embed.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedAppEmbed preRenderId="someId" showPrimaryNavbar={false} />
* }
* ```
* function MyComponent() {
* return <AppEmbed preRenderId="someId" showPrimaryNavbar={false} />
* }
* ```
*/
export const PreRenderedAppEmbed: React.ForwardRefExoticComponent<AppProps & PreRenderProps & React.RefAttributes<_AppEmbed>>;
interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
}
/**
* React component for Liveboard embed.
* @example
* ```tsx
* function Liveboard() {
* return <LiveboardEmbed
* liveboardId="liveboardId"
* fullHeight={true} {/* default false *\/}
* onLiveboardRendered={() => console.log('Liveboard rendered')}
* vizId="vizId" {/* if doing viz embed *\/}
* />
* }
* ```
*/
export const LiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
export const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
/**
* React component for PreRendered Liveboard embed.
*
* PreRenderedLiveboardEmbed will preRender the liveboard and will be hidden by default.
*
* LiveboardEmbed with preRenderId passed will call showPreRender on the embed.
*
* If LiveboardEmbed is rendered before PreRenderedLiveboardEmbed is rendered it
* tries to preRender the LiveboardEmbed, so it is recommended to use pass the
* liveboardId to both the components.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedLiveboardEmbed preRenderId="someId" liveboardId="libId" />
* }
* ```
* function MyComponent() {
* return <LiveboardEmbed preRenderId="someId" liveboardId="libId" />
* }
* ```
*/
export const PreRenderedLiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & PreRenderProps & React.RefAttributes<_LiveboardEmbed>>;
export const PreRenderedPinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & PreRenderProps & React.RefAttributes<_LiveboardEmbed>>;
interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
}
/**
* React component for Search bar embed.
* @example
* ```tsx
* function SearchBar() {
* return <SearchBarEmbed
* dataSource="dataSourceId"
* searchOptions={{ searchTokenString: "[revenue]" }}
* />
* }
* ```
*/
export const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & React.RefAttributes<_SearchBarEmbed>>;
/**
* React component for PreRendered Liveboard embed.
*
* PreRenderedSearchBarEmbed will preRender the SearchBarEmbed and will be hidden by
* default.
*
* SearchBarEmbed with preRenderId passed will call showPreRender on the embed.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedSearchBarEmbed preRenderId="someId" dataSource="dataSourceId" />
* }
* ```
* function MyComponent() {
* return <SearchBarEmbed preRenderId="someId" dataSource="dataSourceId" />
* }
* ```
*/
export const PreRenderedSearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & PreRenderProps & React.RefAttributes<_SearchBarEmbed>>;
interface SageEmbedProps extends EmbedProps, SageViewConfig {
}
/**
* React component for LLM based search Sage embed.
* @example
* ```tsx
* function Sage() {
* return <SageEmbed
* showObjectResults={true}
* ... other view config props or event listeners.
* />
* }
* ```
*/
export const SageEmbed: React.ForwardRefExoticComponent<SageEmbedProps & React.RefAttributes<_SageEmbed>>;
/**
* React component for PreRendered Liveboard embed.
*
* PreRenderedSageEmbed will preRender the SearchBarEmbed and will be hidden by
* default.
*
* SageEmbed with preRenderId passed will call showPreRender on the embed.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedSageEmbed preRenderId="someId" showObjectResults={true} />
* }
* ```
* function MyComponent() {
* return <SageEmbed preRenderId="someId" showObjectResults={true} />
* }
* ```
*/
export const PreRenderedSageEmbed: React.ForwardRefExoticComponent<SageEmbedProps & PreRenderProps & React.RefAttributes<_SageEmbed>>;
interface ConversationEmbedProps extends EmbedProps, ConversationViewConfig {
}
/**
* React component for LLM based conversation BI.
* @example
* ```tsx
* function Sage() {
* return <ConversationEmbed
* worksheetId="<worksheet-id-here>"
* searchOptions={{
* searchQuery: "<search query to start with>"
* }}
* ... other view config props or event listeners.
* />
* }
* ```
*/
export const ConversationEmbed: React.ForwardRefExoticComponent<ConversationEmbedProps & React.RefAttributes<_ConversationEmbed>>;
/**
* React component for PreRendered Conversation embed.
*
* PreRenderedConversationEmbed will preRender the ConversationEmbed and will be hidden by
* default.
*
* SageEmbed with preRenderId passed will call showPreRender on the embed.
* @example
* ```tsx
* function LandingPageComponent() {
* return <PreRenderedConversationEmbed preRenderId="someId" worksheetId={"id-"} />
* }
* ```
* function MyComponent() {
* return <ConversationEmbed preRenderId="someId" worksheetId="id" />
* }
* ```
*/
export const PreRenderedConversationEmbed: React.ForwardRefExoticComponent<SageEmbedProps & PreRenderProps & React.RefAttributes<_ConversationEmbed>>;
type EmbedComponent = typeof SearchEmbed | typeof AppEmbed | typeof LiveboardEmbed | typeof SearchBarEmbed | typeof SageEmbed | typeof ConversationEmbed;
/**
* Get a reference to the embed component to trigger events on the component.
* @example
* ```
* function Component() {
* const ref = useEmbedRef();
* useEffect(() => {
* ref.current.trigger(
* EmbedEvent.UpdateRuntimeFilter,
* [{ columnName: 'name', operator: 'EQ', values: ['value']}]);
* }, [])
* return <LiveboardEmbed ref={ref} liveboardId={<id>} />
* }
* ```
* @returns {React.MutableRefObject<T extends TsEmbed>} ref
*/
export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<React.ComponentRef<T>>;
/**
*
* @param config - EmbedConfig
* @returns AuthEventEmitter
* @example
* ```
* function Component() {
* const authEE = useInit({ ...initConfig });
* return <LiveboardEmbed ref={ref} liveboardId={<id>} />
* }
* ```
* @version SDK: 1.36.2 | ThoughtSpot: *
*/
export function useInit(config: EmbedConfig): React.MutableRefObject<AuthEventEmitter>;
export declare let loggedInStatus: boolean;
export declare let samlAuthWindow: Window;
export declare let samlCompletionPromise: Promise<void>;
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
/**
* Enum for auth failure types. This is the parameter passed to the listner
* of {@link AuthStatus.FAILURE}.
* @group Authentication / Init
*/
export declare enum AuthFailureType {
SDK = "SDK",
NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
EXPIRY = "EXPIRY",
OTHER = "OTHER",
IDLE_SESSION_TIMEOUT = "IDLE_SESSION_TIMEOUT"
}
/**
* Enum for auth status emitted by the emitter returned from {@link init}.
* @group Authentication / Init
*/
export declare enum AuthStatus {
/**
* Emits when the SDK fails to authenticate
*/
FAILURE = "FAILURE",
/**
* Emits when the SDK authenticates successfully
*/
SDK_SUCCESS = "SDK_SUCCESS",
/**
* @hidden
* Emits when iframe is loaded and session info is available
*/
SESSION_INFO_SUCCESS = "SESSION_INFO_SUCCESS",
/**
* Emits when the app sends an authentication success message
*/
SUCCESS = "SUCCESS",
/**
* Emits when a user logs out
*/
LOGOUT = "LOGOUT",
/**
* Emitted when inPopup is true in the SAMLRedirect flow and the
* popup is waiting to be triggered either programmatically
* or by the trigger button.
* @version SDK: 1.19.0
*/
WAITING_FOR_POPUP = "WAITING_FOR_POPUP"
}
/**
* Event emitter returned from {@link init}.
* @group Authentication / Init
*/
export interface AuthEventEmitter {
/**
* Register a listener on Auth failure.
* @param event
* @param listener
*/
on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
/**
* Register a listener on Auth SDK success.
* @param event
* @param listener
*/
on(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
on(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
once(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
once(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
/**
* Trigger an event on the emitter returned from init.
* @param {@link AuthEvent}
*/
emit(event: AuthEvent, ...args: any[]): boolean;
/**
* Remove listener from the emitter returned from init.
* @param event
* @param listener
* @param context
* @param once
*/
off(event: AuthStatus, listener: (...args: any[]) => void, context: any, once: boolean): this;
/**
* Remove all the event listeners
* @param event
*/
removeAllListeners(event: AuthStatus): this;
}
/**
* Events which can be triggered on the emitter returned from {@link init}.
* @group Authentication / Init
*/
export declare enum AuthEvent {
/**
* Manually trigger the SSO popup. This is useful when
* authStatus is SAMLRedirect/OIDCRedirect and inPopup is set to true
*/
TRIGGER_SSO_POPUP = "TRIGGER_SSO_POPUP"
}
/**
*
*/
export declare function getAuthEE(): EventEmitter<AuthStatus | AuthEvent>;
/**
*
* @param eventEmitter
*/
export declare function setAuthEE(eventEmitter: EventEmitter<AuthStatus | AuthEvent>): void;
/**
*
*/
export declare function notifyAuthSDKSuccess(): void;
/**
*
*/
export declare function notifyAuthSuccess(): Promise<void>;
/**
*
* @param failureType
*/
export declare function notifyAuthFailure(failureType: AuthFailureType): void;
/**
*
*/
export declare function notifyLogout(): void;
/**
* Services to be called after the login is successful,
* This should be called after the cookie is set for cookie auth or
* after the token is set for cookieless.
* @return {Promise<void>}
* @example
* ```js
* await postLoginService();
* ```
* @version SDK: 1.28.3 | ThoughtSpot: *
*/
export declare function postLoginService(): Promise<void>;
/**
* Return releaseVersion if available
*/
export declare function getReleaseVersion(): string;
/**
* Perform token based authentication
* @param embedConfig The embed configuration
*/
export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
/**
* Validate embedConfig parameters required for cookielessTokenAuth
* @param embedConfig The embed configuration
*/
export declare const doCookielessTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
/**
* Perform basic authentication to the ThoughtSpot cluster using the cluster
* credentials.
*
* Warning: This feature is primarily intended for developer testing. It is
* strongly advised not to use this authentication method in production.
* @param embedConfig The embed configuration
*/
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
export declare const logout: (embedConfig: EmbedConfig) => Promise<boolean>;
/**
* Perform authentication on the ThoughtSpot cluster
* @param embedConfig The embed configuration
*/
export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean>;
/**
* Check if we are authenticated to the ThoughtSpot cluster
*/
export declare const isAuthenticated: () => boolean;
/**
* @group Embed components
*/
export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts' | 'dataPanelV2' | 'hiddenHomepageModules' | 'hiddenHomeLeftNavItems' | 'hiddenTabs' | 'visibleTabs' | 'reorderedHomepageModules'> {
/**
* The array of data source GUIDs to set on load.
* Only a single data source is supported currently.
* @deprecated Use `dataSource` instead
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.1-sw
* @example
* ```js
* const embed = new SearchBarEmbed('#tsEmbed', {
* ... // other options
* dataSources:['id-2345','id-2345'],
* })
* ```
*/
dataSources?: string[];
/**
* Pass the ID of the source to be selected.
* @version: SDK: 1.19.0, ThoughtSpot 9.0.0.cl, 9.0.1.sw
* @example
* ```js
* const embed = new SearchBarEmbed('#tsEmbed', {
* ... // other options
* dataSource:'id-2345',
* })
* ```
*/
dataSource?: string;
/**
* Boolean to define if the last selected data source should be used
* @version: SDK: 1.24.0, ThoughtSpot 9.5.0.cl, 9.5.0.sw
* @example
* ```js
* const embed = new SearchBarEmbed('#tsEmbed', {
* ... // other options
* useLastSelectedSources:false,
* })
* ```
*/
useLastSelectedSources?: boolean;
/**
* 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.
* @version: SDK: 1.2.0 | ThoughtSpot: 9.4.0.sw
* @example
* ```js
* const embed = new SearchBarEmbed('#tsEmbed', {
* ... // other options
* 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;
}
export interface SearchAppInitData extends DefaultAppInitData {
searchOptions: SearchOptions;
}
/**
* Embed ThoughtSpot search bar
* @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
* @group Embed components
*/
export declare class SearchBarEmbed extends TsEmbed {
/**
* The view configuration for the embedded ThoughtSpot search bar.
*/
protected viewConfig: SearchBarViewConfig;
protected embedComponentType: string;
constructor(domSelector: string, viewConfig: SearchBarViewConfig);
/**
* Render the embedded ThoughtSpot search
*/
render(): Promise<SearchBarEmbed>;
protected getSearchInitData(): {
searchOptions: SearchOptions;
};
protected getAppInitData(): Promise<SearchAppInitData>;
}
/**
* Copyright (c) 2023
*
* Embed ThoughtSpot Sage
* @summary TS Sage embed
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
*/
/**
* Configuration for search options
*/
export interface SearchOptions {
/**
* The query string to pass for Natural Language Search.
*/
searchQuery: 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;
}
/**
* The configuration attributes for the embedded Natural language search view. Based on
* GPT and LLM.
* @version: SDK: 1.23.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
* @group Embed components
*/
export interface SageViewConfig extends Omit<ViewConfig, 'hiddenHomepageModules' | 'hiddenHomeLeftNavItems' | 'hiddenTabs' | 'visibleTabs' | 'reorderedHomepageModules'> {
/**
* If set to true, a list of Liveboard and Answers related
* to the natural language search will be shown below the
* AI generated answer.
* @deprecated Currently Liveboard and Answers related
* to the natural language search will not be shown for sage
* embed
*/
showObjectResults?: boolean;
/**
* flag used by the TS product tour page to show the blue search bar
* even after the search is completed. This is different from Thoughtspot Embedded
* Sage Embed experience where it mimics closer to the non-embed case.
* The Sample questions container is collapsed when this value is set after
* does a search.
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl
* @hidden
*/
isProductTour?: boolean;
/**
* Show or hide the search bar title.
* @version SDK: 1.29.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
* @deprecated Thoughtspot: 9.10.0.cl | search bar doesn't have the title from 9.10.0.cl
*/
hideSearchBarTitle?: boolean;
/**
* Show or hide the Answer header, that is, the `AI Answer` title
* at the top of the Answer page.
* @version SDK: 1.26.0 | Thoughtspot: 9.10.0.cl
*/
hideSageAnswerHeader?: boolean;
/**
* Disable the worksheet selection option.
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
*/
disableWorksheetChange?: boolean;
/**
* Hide the worksheet selection panel.
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
*/
hideWorksheetSelector?: boolean;
/**
* Show or hide autocomplete suggestions for the search query string.
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
*/
hideAutocompleteSuggestions?: boolean;
/**
* Show or hide autocomplete suggestions for the search query string.
* @deprecated
* Currently, the object suggestions will not be shown for Natural Language Search.
* You can use {@link hideAutocompleteSuggestions} instead.
*/
showObjectSuggestions?: boolean;
/**
* Show or hide sample questions.
* The sample questions are autogenerated based on the worksheet
* selected for the search operation.
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
*/
hideSampleQuestions?: boolean;
/**
* The data source GUID (Worksheet GUID) to set on load.
*/
dataSource?: string;
/**
* Includes the following properties:
*
* `searchQuery`: The search query string to pass in the search bar.
* Supports Natural Language Search queries.
*
* `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: {
* searchQuery: 'average sales by country and product type',
* executeSearch: true,
* }
* ```
* @version SDK: 1.26.0 | Thoughtspot: 9.8.0.cl, 9.8.0.sw
*/
searchOptions?: SearchOptions;
}
/**
* Embed ThoughtSpot LLM and GPT-based Natural Language Search component.
* @version: SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl, 9.5.1-sw
* @group Embed components
*/
export declare class SageEmbed extends V1Embed {
/**
* The view configuration for the embedded ThoughtSpot sage.
*
*/
protected viewConfig: SageViewConfig;
constructor(domSelector: DOMSelector, viewConfig: SageViewConfig);
/**
* Constructs a map of parameters to be passed on to the
* embedded Eureka or Sage search page.
* @returns {string} query string
*/
protected getEmbedParams(): string;
/**
* Construct the URL of the embedded ThoughtSpot sage to be
* loaded in the iframe
* @returns {string} iframe url
*/
getIFrameSrc(): string;
/**
* Render the embedded ThoughtSpot Sage
* @returns {SageEmbed} Eureka/Sage embed
*/
render(): Promise<SageEmbed>;
}
/**
* 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 declare 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
* @version: SDK: 1.24.0
*/
useLastSelectedSources?: boolean;
/**
* To set the initial state of the search bar in case of saved-answers.
* @default false
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
* @deprecated Use {@link collapseSearchBar} instead
*/
collapseSearchBarInitially?: boolean;
/**
* Flag to enable onBeforeSearchExecute Embed Event
* @version: SDK: 1.29.0 | Thoughtspot: 10.1.0.cl
*/
isOnBeforeGetVizDataInterceptEnabled?: 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 SearchEmbed('#tsEmbed', {
* ... // other options
* dataPanelCustomGroupsAccordionInitialState:
* DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
* });
* ```
*/
dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
/**
* Flag to remove focus from search bar initially when user
* lands on search embed page.
* @version SDK: 1.32.0 | Thoughtspot: 10.3.0.cl
* @default true
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* focusSearchBarOnRender: false,
* });
* ```
*/
focusSearchBarOnRender?: boolean;
}
export declare const HiddenActionItemByDefaultForSearchEmbed: Action[];
export interface SearchAppInitData extends DefaultAppInitData {
searchOptions?: SearchOptions;
}
/**
* Embed ThoughtSpot search
* @group Embed components
*/
export declare class SearchEmbed extends TsEmbed {
/**
* The view configuration for the embedded ThoughtSpot search.
*/
protected viewConfig: SearchViewConfig;
constructor(domSelector: DOMSelector, viewConfig: SearchViewConfig);
protected getSearchInitData(): {
searchOptions?: {
searchTokenString: string;
};
};
protected getAppInitData(): Promise<SearchAppInitData>;
protected getEmbedParams(): string;
/**
* Construct the URL of the embedded ThoughtSpot search to be
* loaded in the iframe
* @param answerId The GUID of a saved answer
* @param dataSources A list of data source GUIDs
*/
getIFrameSrc(): string;
/**
* Render the embedded ThoughtSpot search
*/
render(): Promise<SearchEmbed>;
}
/**
* 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 declare 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 declare 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 declare 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.EXP