ashish-sdk
Version:
ThoughtSpot Embed SDK
104 lines (103 loc) • 2.88 kB
TypeScript
/**
* Copyright (c) 2022
*
* Embed ThoughtSpot search or a saved answer
*
* @summary Search embed
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
*/
import { DOMSelector, Action } from '../types';
import { ViewConfig, TsEmbed } from './ts-embed';
/**
* Configuration for search options
*/
interface SearchOptions {
/**
* The tml string to load the answer
*/
searchTokenString: string;
/**
* Boolean to determine if the search should be executed or not.
* if it is executed, put the focus on the results.
* if it’s not executed, put the focus in the search bar - at the end of the tokens
*/
executeSearch?: boolean;
}
/**
* The configuration attributes for the embedded search view.
*
* @Category Search Embed
*/
export interface SearchViewConfig extends ViewConfig {
/**
* If set to true, the data sources panel is collapsed on load,
* but can be expanded manually.
*/
collapseDataSources?: boolean;
/**
* If set to true, hides the data sources panel.
*/
hideDataSources?: boolean;
/**
* If set to true, hides the charts and tables in search answers.
* This attribute can be used to create a custom visualization
* using raw answer data.
*/
hideResults?: boolean;
/**
* If set to true, the Search Assist feature is enabled.
*/
enableSearchAssist?: boolean;
/**
* If set to true, the tabular view is set as the default
* format for presenting search data.
*/
forceTable?: boolean;
/**
* The array of data source GUIDs to set on load.
*/
dataSources?: string[];
/**
* The initial search query to load the answer with.
* @deprecated Use {@link searchOptions} instead
*/
searchQuery?: string;
/**
* Configuration for search options
*/
searchOptions?: SearchOptions;
/**
* The GUID of a saved answer to load initially.
*/
answerId?: string;
}
export declare const HiddenActionItemByDefaultForSearchEmbed: Action[];
/**
* Embed ThoughtSpot search
*
* @Category Search Embed
*/
export declare class SearchEmbed extends TsEmbed {
/**
* The view configuration for the embedded ThoughtSpot search.
*/
protected viewConfig: SearchViewConfig;
constructor(domSelector: DOMSelector, viewConfig: SearchViewConfig);
/**
* Get the state of the data sources panel that the embedded
* ThoughtSpot search will be initialized with.
*/
private getDataSourceMode;
/**
* 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
*/
private getIFrameSrc;
/**
* Render the embedded ThoughtSpot search
*/
render(): SearchEmbed;
}
export {};