0.0.1-alpha.10 • Published 3 years ago

ts-embed-sdk v0.0.1-alpha.10

Weekly downloads
18
License
UNLICENSED
Repository
github
Last release
3 years ago

embed-sdk

The ThoughtSpot Embed SDK is a set of JavaScript and TypeScript APIs to enable a host application to embed ThoughtSpot analytics.

The APIs offer the following core capabilities:

  • Render a ThoughtSpot object like search, pinboard or visualization within an iFrame
  • Two-way asynchronous event-based communication between the embedded ThoughtSpot object and the host app
  • Pass in parameters to configure the embedded ThoughtSpot object

Authentication

The SDK supports the following two kinds of authentication, the details of which can be found in the corresponding documentation:

High Level Usage

Initialization

To embed ThoughtSpot analyticsThe JavaScript SDK exposes an init function which must be invoked with a configuration object containing the following information:

  • thoughtSpotHost: the domain name or IP address of the ThoughtSpot web server
  • authType: the authentication mechanism used to sign into the ThoughtSpot web application, one of "SSO" (SAML) or "AuthServer" (trusted authentication server).

Rendering objects

Depending on which object you wish to embed, i.e., search, pinboards or visualization you need to import the corresponding class from the SDK, instantiate it and call the render method with the applicable arguments.

The embed classes are based on a fluent API design pattern, meaning you can chain calls to its public methods in a single statement.

Listening to events

In order to subscribe to events you need to register an event handler on the embed object using the on method.

Please note: you must register all event handlers before invoking the render method, i.e., all calls to on must occur before render is called.

Embedding Search

To embed a search pane, the SDK exposes the SearchEmbed class. The constructor accepts the following parameters:

  • a DOM node or a valid DOM selector
  • the view configuration including but not limited to the iFrame's height and width

The render method of this class accepts the following optional parameters:

  • The list of data sources (UUIDs) to initialize the search with
  • The UUID of a saved answer

Embedding Pinboards and Visualizations

To embed a pinboard or a single visualization contained within a pinboard, the SDK exposes the PinboardEmbed class. The constructor accepts the following parameters:

  • a DOM node or a valid DOM selector
  • the view configuration including but not limited to the iFrame's height and width

The render method of this class accepts the following parameters:

  • The UUID of the pinboard
  • The UUID of the visualization within the pinboard

If only the former is provided, the entire pinboard is rendered.

Embedding the Entire Application

It is also possible to embed an entire page within the ThoughtSpot application using the AppEmbed class. It's constructor accepts the following parameters:

  • a DOM node or a valid DOM selector
  • the view configuration including but not limited to the iFrame's height and width

The render method of this class accepts the following parameters:

  • The id of the page to render, one of 'home', 'search', 'answers', 'pinboard', 'data' or 'home'

Events

To register an event handler to subscribe to when certain things happen within the embedded ThoughtSpot application, every embed object instance gives you access to the on method that accepts the following parameters:

  • The name of the event
  • A callback function to execute when the particular event is triggered. The callback function is invoked with the event payload.

The SDK leverages the window.postMessage API to communicate between the host app and the embedded application within the iFrame.

0.0.1-alpha.10

3 years ago

0.0.1-alpha.9

3 years ago

0.0.1-alpha.8

3 years ago

0.0.1-alpha.7

3 years ago

0.0.1-alpha.6

3 years ago

0.0.1-alpha.5

3 years ago

0.0.1-alpha.4

3 years ago

0.0.1-alpha.3

3 years ago

0.0.1-alpha.2

3 years ago

0.0.1-alpha.1

3 years ago

0.0.1-alpha.0

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

4 years ago