AppEmbed

AppEmbed

Embeds full ThoughtSpot experience in a host application.

Constructors🔗

new AppEmbed(domSelector: DOMSelector , viewConfig: AppViewConfig ) : AppEmbed

Function Parameters

domSelector
viewConfig

Returns

Defined in : embed/app.ts

Overrides V1Embed.constructor

Methods🔗

destroy🔗

destroy() : void

Destroys the ThoughtSpot embed, and remove any nodes from the DOM.

Returns

void

Version : SDK: 1.19.1 | ThoughtSpot: *

Defined in : embed/ts-embed.ts

Inherited from V1Embed.destroy

getAnswerService🔗

getAnswerService(vizId?: string ) : Promise< AnswerService >

Returns the answerService which can be used to make arbitrary graphql calls on top session.

Function Parameters

vizId

Optional

  • vizId: string

to get for a specific viz in case of a liveboard.

Returns

Promise< AnswerService >

Version : SDK: 1.25.0 / ThoughtSpot 9.10.0

Defined in : embed/ts-embed.ts

Inherited from V1Embed.getAnswerService

getIFrameSrc🔗

getIFrameSrc() : string

Constructs the URL of the ThoughtSpot app page to be rendered.

Returns

string

Defined in : embed/app.ts

getIframeSrc🔗

getIframeSrc() : string

Returns

string

Defined in : embed/ts-embed.ts

Inherited from V1Embed.getIframeSrc

getPreRenderIds🔗

getPreRenderIds() : {child?: string = …​, wrapper?: string = …​}

Retrieves unique HTML element IDs for PreRender-related elements. These IDs are constructed based on the provided 'preRenderId' from 'viewConfig'.

Returns

{child?: string = …​, wrapper?: string = …​}

property : {string} wrapper - The HTML element ID for the PreRender wrapper.

property : {string} child - The HTML element ID for the PreRender child.

Defined in : embed/ts-embed.ts

Inherited from V1Embed.getPreRenderIds

getThoughtSpotPostUrlParams🔗

getThoughtSpotPostUrlParams(additionalParams?: {[key: string ] : string | number} = {}) : string

Get the Post Url Params for THOUGHTSPOT from the current host app URL. THOUGHTSPOT URL params starts with a prefix "ts-"

Function Parameters

additionalParams
  • additionalParams: {[key: string ] : string | number} = {}

Index Signature Parameters

Returns

string

Version : SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw

Defined in : embed/ts-embed.ts

Inherited from V1Embed.getThoughtSpotPostUrlParams

getUnderlyingFrameElement🔗

getUnderlyingFrameElement() : HTMLIFrameElement

Returns

HTMLIFrameElement

Defined in : embed/ts-embed.ts

Inherited from V1Embed.getUnderlyingFrameElement

hidePreRender🔗

hidePreRender() : void

Hides the PreRender component if it is available. If the component is not preRendered, it issues a warning.

Returns

void

Defined in : embed/ts-embed.ts

Inherited from V1Embed.hidePreRender

navigateToPage🔗

navigateToPage(path: string | number , noReload?: boolean = false) : void

Navigate to particular page for app embed. eg:answers/pinboards/home This is used for embedding answers, pinboards, visualizations and full application only.

Function Parameters

path
  • path: string | number

string | number The string, set to iframe src and navigate to new page eg: appEmbed.navigateToPage('pinboards') When used with noReload (default: true) this can also be a number like 1/-1 to go forward/back.

noReload
  • noReload: boolean = false

boolean Trigger the navigation without reloading the page

Returns

void

Version : SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw

Defined in : embed/app.ts

off🔗

off(messageType: EmbedEvent , callback: MessageCallback ) : TsEmbed

Removes an event listener for a particular event type.

Function Parameters

messageType

The message type

callback

The callback to remove

Returns

TsEmbed

const errorHandler = (data) => { console.error(data); };
tsEmbed.on(EmbedEvent.Error, errorHandler);
tsEmbed.off(EmbedEvent.Error, errorHandler);

Defined in : embed/ts-embed.ts

Inherited from V1Embed.off

on🔗

on(messageType: EmbedEvent , callback: MessageCallback , options?: MessageOptions = …​) : TsEmbed

Function Parameters

messageType
callback
options

Returns

TsEmbed

tsEmbed.on(EmbedEvent.Error, (data) => {
  console.error(data);
});
tsEmbed.on(EmbedEvent.Save, (data) => {
  console.log("Answer save clicked", data);
}, {
  start: true // This will trigger the callback on start of save
});

Defined in : embed/ts-embed.ts

Inherited from V1Embed.on

preRender🔗

preRender(showPreRenderByDefault?: boolean = false) : TsEmbed

Creates the preRender shell

Function Parameters

showPreRenderByDefault
  • showPreRenderByDefault: boolean = false

Show the preRender after render, hidden by default

Returns

TsEmbed

Defined in : embed/ts-embed.ts

Inherited from V1Embed.preRender

prerenderGeneric🔗

prerenderGeneric() : Promise< any >

Prerenders a generic instance of the TS component. This means without the path but with the flags already applied. This is useful for prerendering the component in the background.

Returns

Promise< any >

Version : SDK: 1.22.0

Defined in : embed/ts-embed.ts

Inherited from V1Embed.prerenderGeneric

render🔗

render() : Promise< AppEmbed >

Renders the embedded application pages in the ThoughtSpot app.

Returns

Promise< AppEmbed >

Defined in : embed/app.ts

Overrides V1Embed.render

showPreRender🔗

showPreRender() : void

Displays the PreRender component. If the component is not preRendered, it attempts to create and render it. Also, synchronizes the style of the PreRender component with the embedding element.

Returns

void

Defined in : embed/ts-embed.ts

Inherited from V1Embed.showPreRender

syncPreRenderStyle🔗

syncPreRenderStyle() : void

Synchronizes the style properties of the PreRender component with the embedding element. This function adjusts the position, width, and height of the PreRender component to match the dimensions and position of the embedding element.

Returns

void

throws : {Error} Throws an error if the embedding element (passed as domSelector) is not defined or not found.

Defined in : embed/ts-embed.ts

Inherited from V1Embed.syncPreRenderStyle

trigger🔗

trigger(messageType: HostEvent , data?: any = {}) : Promise< any >

Triggers an event to the embedded app

Function Parameters

messageType

The event type

data
  • data: any = {}

The payload to send with the message

Returns

Promise< any >

Defined in : embed/ts-embed.ts

Inherited from V1Embed.trigger