GithubHelp home page GithubHelp logo

cristian-cojocaru-ts / visual-embed-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thoughtspot/visual-embed-sdk

0.0 0.0 0.0 26.41 MB

ThoughtSpot Visual Embed SDK

Home Page: https://try-everywhere.thoughtspot.cloud/v2/#/everywhere

License: Other

JavaScript 3.40% TypeScript 17.50% CSS 23.46% HTML 49.17% Handlebars 6.47%

visual-embed-sdk's Introduction

ThoughtSpot


ThoughtSpot Visual Embed SDK Coverage Status npm (scoped with tag)

SDK to embed ThoughtSpot into your web apps.


Usage

The SDK is compatible with ThoughtSpot SW version >= 7.1 and ThoughtSpot Cloud.

Install the Visual Embed SDK from NPM:

npm i @thoughtspot/visual-embed-sdk

The SDK is written in TypeScript and is also provided both as ES Module (ESM) and Universal Module Definition (UMD) modules, allowing you to use it in a variety of environments. For example,...

// ESM via NPM
import * as TsEmbedSDK from '@thoughtspot/visual-embed-sdk';

// NPM <script>
<script src='https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.js'></script>

// ES6 from web
import { PinboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';

Live Playground

Visit our code playground.


Full API Reference


Quick Start

The ThoughtSpot Embed SDK allows you to embed the ThoughtSpot search experience, pinboards, visualizations or the even full app version.

Embedded Search

// NPM
import { SearchEmbed, AuthType, init } from '@thoughtspot/visual-embed-sdk';
// or ES6
// import { SearchEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';

init({
    thoughtSpotHost: '<%=tshost%>',
    authType: AuthType.None,
});

const searchEmbed = new SearchEmbed(document.getElementById('ts-embed'), {
    frameParams: {
        width: '100%',
        height: '100%',
    },
});

searchEmbed.render();

Embedded Pinboard & Visualization

// NPM
import { PinboardEmbed, AuthType, init } from '@thoughtspot/visual-embed-sdk';
// or ES6
// import { PinboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';

init({
    thoughtSpotHost: '<%=tshost%>',
    authType: AuthType.None,
});

const pinboardEmbed = new PinboardEmbed(
    document.getElementById('ts-embed'),
    {
        frameParams: {
            width: '100%',
            height: '100%',
        },
        pinboardId: '<%=pinboardGUID%>',
        vizId: '<%=vizGUID%>',
    },
});

pinboardEmbed.render();

Embedded Full App

// NPM
import { AppEmbed, Page, AuthType, init } from '@thoughtspot/visual-embed-sdk';
// or ES6
// import { AppEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';

init({
    thoughtSpotHost: '<%=tshost%>',
    authType: AuthType.None,
});

const appEmbed = new AppEmbed(
    document.getElementById('ts-embed'),
    {
        frameParams: {
            width: '100%',
            height: '100%',
        },
        pageId: Page.Data,
    });

appEmbed.render();

React Components

All the above flavors of embedding are also provided as React components for your convenience. The constructor options are passed as props and the event listeners can be attached using on<EventName> convention.

Search Component

import { init } from '@thoughtspot/visual-embed-sdk';
import { SearchEmbed } from '@thoughtspot/visual-embed-sdk/react';

init({
    thoughtSpotHost: '<%=tshost%>',
    authType: AuthType.None,
});

const MyComponent = ({ dataSources }) => {
    const onCustomAction = (actionEvent) => {
        // Do something with actionEvent.
    };
    
    return <SearchEmbed dataSources={dataSources} onCustomAction={onCustomAction} />
}



Visual-Embed-SDK, © ThoughtSpot, Inc. 2021

visual-embed-sdk's People

Contributors

ashubham avatar shashisubramanya avatar harsh-ts avatar ayonghosh avatar pankajp-ts avatar kailash-choudhary-thoughtspot avatar sumit-thoughtspot avatar jbhanu-thoughtspot avatar aayushgupta6 avatar gaurav-thoughtspot avatar bryanthowell-ts avatar utsav-test avatar lavishmantri avatar alexraescu-ts avatar cristian-cojocaru-ts avatar dependabot[bot] avatar somechandra-thoughtspot avatar thrinethra-thoughtspot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.