UNPKG

@thoughtspot/visual-embed-sdk

Version:
1,385 lines (1,378 loc) 360 kB
// 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 SpotterEmbedProps extends EmbedProps, SpotterEmbedViewConfig { } interface ConversationEmbedProps extends EmbedProps, ConversationViewConfig { } /** * React component for LLM based conversation BI. * @example * ```tsx * function Sage() { * return <SpotterEmbed * worksheetId="<worksheet-id-here>" * searchOptions={{ * searchQuery: "<search query to start with>" * }} * ... other view config props or event listeners. * /> * } * ``` */ export const SpotterEmbed: React.ForwardRefExoticComponent<SpotterEmbedProps & React.RefAttributes<_SpotterEmbed>>; /** * React component for LLM based conversation BI. * @deprecated from SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl * Use {@link SpotterEmbed} instead * @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 individual conversation messages from SpotterAgent. * This component is used internally by the useSpotterAgent hook. * @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl */ interface ConversationMessageProps extends EmbedProps, SpotterAgentMessageViewConfig { } export const ConversationMessage: React.ForwardRefExoticComponent<ConversationMessageProps & React.RefAttributes<_ConversationMessage>>; /** * React component for displaying individual conversation messages from SpotterAgent. * * This component renders a single message response from your ThoughtSpot conversation, * showing charts, visualizations, or text responses based on the user's query. * * @example * ```tsx * const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' }); * const result = await sendMessage('show me sales by region'); * * if (!result.error) { * // Simple usage - just pass the message data * <SpotterMessage message={result.message} /> * * // With optional query for context * <SpotterMessage * message={result.message} * query={result.query} * /> * } * ``` * @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl */ export const SpotterMessage: React.ForwardRefExoticComponent<{ message: SpotterAgentMessageViewConfig; query?: string; } & Omit<EmbedProps, keyof SpotterAgentMessageViewConfig> & React.RefAttributes<_ConversationMessage>>; /** * React component for PreRendered Conversation embed. * * PreRenderedConversationEmbed will preRender the SpotterEmbed 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 <SpotterEmbed preRenderId="someId" worksheetId="id" /> * } * ``` */ export const PreRenderedConversationEmbed: React.ForwardRefExoticComponent<SpotterEmbedProps & PreRenderProps & React.RefAttributes<_SpotterEmbed>>; type EmbedComponent = typeof SearchEmbed | typeof AppEmbed | typeof LiveboardEmbed | typeof SearchBarEmbed | typeof SageEmbed | typeof ConversationMessage | typeof SpotterMessage | typeof SpotterEmbed | 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>; /** * React hook for interacting with SpotterAgent AI conversations. * * This hook provides a sendMessage function that allows you to send natural language * queries to your data and get back AI-generated responses with visualizations. * * @param config - Configuration object containing worksheetId and other options * @returns Object with sendMessage function that returns conversation results * @example * ```tsx * const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' }); * * const handleQuery = async () => { * const result = await sendMessage('show me sales by region'); * * if (!result.error) { * // Display the message response * <SpotterMessage message={result.message} /> * } else { * console.error('Error:', result.error); * } * }; * ``` * @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl */ export function useSpotterAgent(config: SpotterAgentEmbedViewConfig): { sendMessage: (query: string) => Promise<{ error: any; query?: undefined; message?: undefined; } | { query: string; message: { worksheetId: string; convId: any; messageId: any; sessionId: any; genNo: any; acSessionId: any; acGenNo: any; }; error?: undefined; }>; }; 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", UNAUTHENTICATED_FAILURE = "UNAUTHENTICATED_FAILURE" } /** * 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", /** * Emitted when the SAML popup is closed without authentication */ SAML_POPUP_CLOSED_NO_AUTH = "SAML_POPUP_CLOSED_NO_AUTH" } /** * 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 | AuthStatus.SAML_POPUP_CLOSED_NO_AUTH, 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 | AuthStatus.SAML_POPUP_CLOSED_NO_AUTH, 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 BaseViewConfig, SearchLiveboardCommonViewConfig { /** * The array of data source GUIDs to set on load. * Only a single data source is supported currently. * * Supported embed types: `SearchBarEmbed` * @deprecated Use `dataSource` instead * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.1-sw * @example * ```js * const embed = new SearchBarEmbed('#tsEmbed', { * ... //other embed view config * dataSources:['id-2345','id-2345'], * }) * ``` */ dataSources?: string[]; /** * Pass the ID of the source to be selected. * * Supported embed types: `SearchBarEmbed` * @version: SDK: 1.19.0, ThoughtSpot 9.0.0.cl, 9.0.1.sw * @example * ```js * const embed = new SearchBarEmbed('#tsEmbed', { * ... //other embed view config * dataSource:'id-2345', * }) * ``` */ dataSource?: string; /** * Boolean to define if the last selected data source should be used * * Supported embed types: `SearchBarEmbed` * @version: SDK: 1.24.0, ThoughtSpot 9.5.0.cl, 9.5.0.sw * @example * ```js * const embed = new SearchBarEmbed('#tsEmbed', { * ... //other embed view config * 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. * * Supported embed types: `SearchBarEmbed` * @version: SDK: 1.2.0 | ThoughtSpot: 9.4.0.sw * @example * ```js * const embed = new SearchBarEmbed('#tsEmbed', { * ... //other embed view config * 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. * * Supported embed types: `SearchBarEmbed` * @version: SDK: 1.35.7 | ThoughtSpot: 10.8.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 * * Note: This embed will be deprecated from SDK: 1.40.0 | ThoughtSpot: 10.13.0.cl * @group Embed components */ export interface SageViewConfig extends SearchLiveboardCommonViewConfig, Omit<BaseViewConfig, 'primaryAction' | 'runtimeFilters' | 'runtimeParameters' | 'excludeRuntimeFiltersfromURL' | 'excludeRuntimeParametersfromURL'> { /** * 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. * * Supported embed types: `SageEmbed` * @version SDK: 1.26.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw * @example * ```js * const embed = new SageEmbed('#tsEmbed', { * ... //other embed view config * hideSampleQuestions : true, * }) * ``` */ 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. * * Supported embed types: `SageEmbed` * @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 * * Note: This embed will be deprecated from SDK: 1.40.0 | ThoughtSpot: 10.13.0.cl * @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 SearchLiveboardCommonViewConfig, Omit<BaseViewConfig, 'primaryAction'> { /** * If set to true, the data sources panel is collapsed on load, * but can be expanded manually. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * collapseDataSources:true, * }) * ``` */ collapseDataSources?: boolean; /** * If set to true, the data panel is collapsed on load, * but can be expanded manually. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.34.0 | ThoughtSpot: 10.3.0.cl * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * collapseDataPanel:true, * }) * ``` */ collapseDataPanel?: boolean; /** * Show or hide the data sources panel. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * hideResults:true, * }) * ``` */ hideResults?: boolean; /** * If set to true, the Search Assist feature is enabled. * * Supported embed types: `SearchEmbed` * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * enableSearchAssist:true, * }) * ``` */ enableSearchAssist?: boolean; /** * If set to true, the tabular view is set as the default * format for presenting search data. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `SearchEmbed` * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * dataSources:['id-234','id-456'], * }) * ``` */ dataSources?: string[]; /** * The array of data source GUIDs to set on load. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.19.0 * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `SearchEmbed` * @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. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.35.7 | ThoughtSpot: 10.8.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. * * Supported embed types: `SearchEmbed` * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `SearchEmbed` * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * hideSearchBar:true, * }) * ``` */ hideSearchBar?: boolean; /** * Flag to set if last selected dataSource should be used * * Supported embed types: `SearchEmbed` * @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 * * Supported embed types: `SearchEmbed` * @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. * * Supported embed types: `SearchEmbed` * @version SDK: 1.32.0 | ThoughtSpot: 10.0.0.cl * @default DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * dataPanelCustomGroupsAccordionInitialState: * DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, * }); * ``` */ dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState; /** * Flag to remove focus from search bar initially when user * lands on search embed page. * * Supported embed types: `SearchEmbed` * @version SDK: 1.32.0 | ThoughtSpot: 10.3.0.cl * @default true * @example * ```js * const embed = new SearchEmbed('#tsEmbed', { * ... // other embed view config * 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" } /** * Define the version of the primary navbar * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl */ export declare enum PrimaryNavbarVersion { /** * Sliding (v3) introduces a new left-side navigation hub featuring a tab switcher, * along with updates to the top navigation bar. * It serves as the foundational version of the PrimaryNavBar. */ Sliding = "v3" } /** * Define the version of the home page * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl */ export declare enum HomePage { /** * Modular (v2) introduces the updated Modular Home Experience. * It serves as the foundational version of the home page. */ Modular = "v2" } /** * Define the version of the list page * @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl */ export declare enum ListPage { /** * List (v2) is the traditional List Experience. * It serves as the foundational version of the list page. */ List = "v2", /** * ListWithUXChanges (v3) introduces the new updated list page with UX changes. */ ListWithUXChanges = "v3" } /** * Define the discovery experience * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl */ export interface DiscoveryExperience { /** * primaryNavbarVersion determines the version of the navigation version. */ primaryNavbarVersion?: PrimaryNavbarVersion; /** * homePage determines the version of the home page. */ homePage?: HomePage; /** * listPageVersion determines the version of the list page. */ listPageVersion?: ListPage; } /** * The view configuration for full app embedding. * @group Embed components */ export interface AppViewConfig extends AllEmbedViewConfig { /** * 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. * * Supported embed types: `AppEmbed` * @default true * @version SDK: 1.2.0 | ThoughtSpot: 8.4.0.cl * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * ... // other embed view config * 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). * * Supported embed types: `AppEmbed` * @default false * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `AppEmbed` * @default false * @version SDK: 1.2.0 | ThoughtSpot: 8.4.0.cl * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * ... // other embed view config * 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. * * Supported embed types: `AppEmbed` * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * ... // other embed view config * enablePendoHelp: false, * }); * ``` */ enablePendoHelp?: boolean; /** * Control the visibility of the hamburger icon on the top nav bar * available when new navigation V3 is enabled. * * Supported embed types: `AppEmbed` * @default false * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * ... // other embed view config * hideHamburger : true, * }) * ``` */ hideHamburger?: boolean; /** * Control the visibility of the Eureka search on the top nav bar * this will control for both new V2 and new navigation V3. * * Supported embed types: `AppEmbed` * @default true * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl * @example * ```js * const embed = new AppEmbed('#tsEmbed', { * .