
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@thoughtspot/visual-embed-sdk
Advanced tools
SDK to embed ThoughtSpot into your web apps. You need a ThoughtSpot account to use the SDK, click here to start a trial.
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';
// OR
import { LiveboardEmbed } from '@thoughtspot/visual-embed-sdk';
// NPM <script>
<script src="https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.js"></script>;
// Makes the SDK available on global namespace window.tsembed
// ES6 from web
import {
LiveboardEmbed,
AuthType,
init,
} from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
Visit our code playground.
Start a free trial on your own data.
The ThoughtSpot Embed SDK allows you to embed the ThoughtSpot search experience, liveboards, visualizations or the even full app version.
// 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();
// NPM
import { LiveboardEmbed, AuthType, init } from '@thoughtspot/visual-embed-sdk';
// or ES6
// import { LiveboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
init({
thoughtSpotHost: '<%=tshost%>',
authType: AuthType.None,
});
const liveboardEmbed = new LiveboardEmbed(
document.getElementById('ts-embed'),
{
frameParams: {
width: '100%',
height: '100%',
},
liveboardId: '<%=liveboardGUID%>',
vizId: '<%=vizGUID%>',
},
});
liveboardEmbed.render();
// 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();
// NPM
import { LiveboardEmbed, Page, AuthType, init, EmbedEvent, HostEvent } from '@thoughtspot/visual-embed-sdk';
// .. Do init and create a liveboardEmbed object as above.
liveboardEmbed.render();
liveboardEmbed.on(EmbedEvent.LiveboardRendered, () => {
liveboardEmbed.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
});
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.
Checkout a comprehensive working demo here
import { init } from '@thoughtspot/visual-embed-sdk';
import { SearchEmbed } from '@thoughtspot/visual-embed-sdk/react';
// If you are using Webpack 4 (which is the default when using create-react-app v4), you would need to import
// the React components using the below:
import { SearchEmbed } from '@thoughtspot/visual-embed-sdk/lib/src/react';
init({
thoughtSpotHost: '<%=tshost%>',
authType: AuthType.None,
});
const MyComponent = ({ dataSources }) => {
const onCustomAction = (actionEvent) => {
// Do something with actionEvent.
};
return (
<SearchEmbed
dataSources={dataSources}
onCustomAction={onCustomAction}
/>
);
};
import { HostEvent } from '@thoughtspot/visual-embed-sdk';
import { LiveboardEmbed, useEmbedRef } from '@thoughtspot/visual-embed-sdk/react';
const MyComponent = () => {
const embedRef = useEmbedRef();
const onLiveboardRendered = () => {
embedRef.current.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
};
return (
<LiveboardEmbed
ref={embedRef}
liveboardId="<liveboard-guid>"
onLiveboardRendered={onLiveboardRendered}
/>
);
};
How to run the local vite server to test out the sdk.
$ npm run build
$ npm run dev
Goto http://localhost:2343/local
to check the output.
Look at local/index.html
and local/index.ts
for some starter code.
Visual-Embed-SDK, © ThoughtSpot, Inc. 2023
FAQs
ThoughtSpot Embed SDK
The npm package @thoughtspot/visual-embed-sdk receives a total of 20,498 weekly downloads. As such, @thoughtspot/visual-embed-sdk popularity was classified as popular.
We found that @thoughtspot/visual-embed-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.