ConversationEmbed

ConversationEmbed

Embed ThoughtSpot AI Conversation.

Version : SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl

const conversation = new ConversationEmbed('#tsEmbed', {
  worksheetId: 'worksheetId',
  searchOptions: {
    searchQuery: 'searchQuery',
  },
});
conversation.render();

Constructors🔗

new ConversationEmbed(container: HTMLElement , viewConfig: ConversationViewConfig ) : ConversationEmbed

Function Parameters

container
  • container: HTMLElement

viewConfig

Returns

Defined in : embed/conversation.ts

Overrides TsEmbed.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 TsEmbed.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 TsEmbed.getAnswerService

getIframeSrc🔗

getIframeSrc() : string

Returns

string

Defined in : embed/conversation.ts

Overrides TsEmbed.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 TsEmbed.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 TsEmbed.getThoughtSpotPostUrlParams

getUnderlyingFrameElement🔗

getUnderlyingFrameElement() : HTMLIFrameElement

Returns

HTMLIFrameElement

Defined in : embed/ts-embed.ts

Inherited from TsEmbed.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 TsEmbed.hidePreRender

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 TsEmbed.off

on🔗

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

Registers an event listener to trigger an alert when the ThoughtSpot app sends an event of a particular message type to the host application.

Function Parameters

messageType

The message type

callback

A callback as a function

options

The message options

isRegisteredBySDK
  • isRegisteredBySDK: boolean = false

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 TsEmbed.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 TsEmbed.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 TsEmbed.prerenderGeneric

render🔗

render() : Promise< ConversationEmbed >

Returns

Promise< ConversationEmbed >

Defined in : embed/conversation.ts

Overrides TsEmbed.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 TsEmbed.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 TsEmbed.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 TsEmbed.trigger