UNPKG

ashish-sdk

Version:
120 lines (119 loc) 3.32 kB
/** * 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> */ import { DOMSelector } from '../types'; import { V1Embed, ViewConfig } from './ts-embed'; /** * 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" } /** * The view configuration for full app embedding. * @Category App Embed */ export interface AppViewConfig extends ViewConfig { /** * If true, the main navigation bar within the ThoughtSpot app * is displayed. By default, the navigation bar is hidden. */ showPrimaryNavbar?: boolean; /** * If true, help and profile buttons will hide on NavBar. By default, * they are shown. */ disableProfileAndHelp?: boolean; /** * A URL path within the app that is to be embedded. * If both path and pageId attributes are defined, the path definition * takes precedence. */ path?: string; /** * The application page to set as the start page * in the embedded view. */ 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. */ tag?: string; /** * The array of GUIDs to be hidden */ hideObjects?: string[]; } /** * Embeds full ThoughtSpot experience in a host application. * @Category App Embed */ export declare class AppEmbed extends V1Embed { protected viewConfig: AppViewConfig; constructor(domSelector: DOMSelector, viewConfig: AppViewConfig); /** * Constructs a map of parameters to be passed on to the * embedded Liveboard or visualization. */ private getEmbedParams; /** * Constructs the URL of the ThoughtSpot app page to be rendered. * @param pageId The ID of the page to be embedded. */ private getIFrameSrc; /** * Gets the ThoughtSpot route of the page for a particular page ID. * @param pageId The identifier for a page in the ThoughtSpot app. */ private getPageRoute; /** * Formats the path provided by the user. * @param path The URL path. * @returns The URL path that the embedded app understands. */ private formatPath; /** * Navigate to particular page for app embed. eg:answers/pinboards/home * This is used for embedding answers, pinboards, visualizations and full application only. * @param path The string, set to iframe src and navigate to new page * eg: appEmbed.navigateToPage('pinboards') */ navigateToPage(path: string): void; /** * Renders the embedded application pages in the ThoughtSpot app. * @param renderOptions An object containing the page ID * to be embedded. */ render(): AppEmbed; }