@thoughtspot/visual-embed-sdk 1.8.0-alpha.2 → 1.8.0-plugins.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/embed/pinboard.d.ts +91 -0
- package/dist/src/embed/ts-embed.d.ts +9 -1
- package/dist/src/types.d.ts +9 -1
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +15 -2
- package/dist/tsembed.js +15 -2
- package/lib/package.json +2 -2
- package/lib/src/embed/pinboard.d.ts +91 -0
- package/lib/src/embed/pinboard.js +110 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/ts-embed.d.ts +9 -1
- package/lib/src/embed/ts-embed.js +13 -0
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/types.d.ts +9 -1
- package/lib/src/types.js +2 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +1 -0
- package/lib/src/utils/plugin.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +17 -2
- package/package.json +2 -2
- package/src/embed/ts-embed.ts +23 -0
- package/src/index.ts +1 -0
- package/src/types.ts +10 -1
- package/src/utils/plugin.ts +2 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { DOMSelector } from '../types';
|
|
12
|
+
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
+
/**
|
|
14
|
+
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
+
* @Category Pinboards and Charts
|
|
16
|
+
*/
|
|
17
|
+
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
+
/**
|
|
19
|
+
* If set to true, the embedded object container dynamically resizes
|
|
20
|
+
* according to the height of the pinboard.
|
|
21
|
+
*/
|
|
22
|
+
fullHeight?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
+
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
+
* other screens navigable from a pinboard.
|
|
27
|
+
* @default 500
|
|
28
|
+
* * _since 1.5.0_
|
|
29
|
+
*/
|
|
30
|
+
defaultHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
+
*/
|
|
34
|
+
enableVizTransformations?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The pinboard to display in the embedded view.
|
|
37
|
+
*/
|
|
38
|
+
pinboardId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The visualization within the pinboard to display.
|
|
41
|
+
*/
|
|
42
|
+
vizId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* If set to true, all filter chips from a
|
|
45
|
+
* pinboard page will be read-only (no X buttons)
|
|
46
|
+
*/
|
|
47
|
+
preventPinboardFilterRemoval?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
+
* The ids not in this array are hidden from the pinboard.
|
|
51
|
+
* _since: 1.6.0_
|
|
52
|
+
*/
|
|
53
|
+
pinboardVisibleVizs?: string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
+
* @Category Pinboards and Charts
|
|
58
|
+
*/
|
|
59
|
+
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
+
protected viewConfig: PinboardViewConfig;
|
|
61
|
+
private defaultHeight;
|
|
62
|
+
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
+
/**
|
|
64
|
+
* Construct a map of params to be passed on to the
|
|
65
|
+
* embedded pinboard or visualization.
|
|
66
|
+
*/
|
|
67
|
+
private getEmbedParams;
|
|
68
|
+
/**
|
|
69
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
+
* to be loaded within the iframe.
|
|
71
|
+
* @param pinboardId The GUID of the pinboard.
|
|
72
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
+
* the pinboard or visualization on load.
|
|
75
|
+
*/
|
|
76
|
+
private getIFrameSrc;
|
|
77
|
+
/**
|
|
78
|
+
* Set the iframe height as per the computed height received
|
|
79
|
+
* from the ThoughtSpot app.
|
|
80
|
+
* @param data The event payload
|
|
81
|
+
*/
|
|
82
|
+
private updateIFrameHeight;
|
|
83
|
+
private embedIframeCenter;
|
|
84
|
+
private handleRouteChangeFullHeightPinboard;
|
|
85
|
+
/**
|
|
86
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
+
* visualization ID and the runtime filters.
|
|
89
|
+
*/
|
|
90
|
+
render(): PinboardEmbed;
|
|
91
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @summary Base classes
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
|
-
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig } from '../types';
|
|
9
|
+
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, Plugin } from '../types';
|
|
10
10
|
export interface LayoutConfig {
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -76,6 +76,13 @@ export interface ViewConfig {
|
|
|
76
76
|
additionalFlags?: {
|
|
77
77
|
[key: string]: string | number | boolean;
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
81
|
+
* provided below,
|
|
82
|
+
*
|
|
83
|
+
* @version alpha
|
|
84
|
+
*/
|
|
85
|
+
plugins?: Plugin[];
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
81
88
|
* Base class for embedding v2 experience
|
|
@@ -121,6 +128,7 @@ export declare class TsEmbed {
|
|
|
121
128
|
*/
|
|
122
129
|
private shouldEncodeUrlQueryParams;
|
|
123
130
|
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
131
|
+
private registerPlugins;
|
|
124
132
|
/**
|
|
125
133
|
* Gets a reference to the root DOM node where
|
|
126
134
|
* the embedded content will appear.
|
package/dist/src/types.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface EmbedConfig {
|
|
|
122
122
|
queueMultiRenders?: boolean;
|
|
123
123
|
/**
|
|
124
124
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
125
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
125
126
|
* @version 1.6.0 or later
|
|
126
127
|
* @default ''
|
|
127
128
|
*/
|
|
@@ -379,7 +380,8 @@ export declare enum HostEvent {
|
|
|
379
380
|
*/
|
|
380
381
|
SetVisibleVizs = "SetPinboardVisibleVizs",
|
|
381
382
|
/**
|
|
382
|
-
* Update the runtime filters
|
|
383
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
384
|
+
* on to the existing runtime filters if they exist.
|
|
383
385
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
384
386
|
* @version 1.8.0 or later
|
|
385
387
|
*/
|
|
@@ -535,3 +537,9 @@ export declare enum OperationType {
|
|
|
535
537
|
export interface AnswerServiceType {
|
|
536
538
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
537
539
|
}
|
|
540
|
+
export interface Plugin {
|
|
541
|
+
name: string;
|
|
542
|
+
handlers: {
|
|
543
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
544
|
+
};
|
|
545
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright: ThoughtSpot Inc. 2012-2016
|
|
3
|
+
* Author: Shashank Singh (sunny@thoughtspot.com)
|
|
4
|
+
*
|
|
5
|
+
* @fileoverview ThoughtSpot Javascript API for use of ThoughtSpot in external webpages.
|
|
6
|
+
*/
|
|
7
|
+
import { AuthType } from '../types';
|
|
8
|
+
export declare enum Events {
|
|
9
|
+
THOUGHTSPOT_AUTH_EXPIRED = "ThoughtspotAuthExpired",
|
|
10
|
+
EXPORT_VIZ_DATA_TO_PARENT = "exportVizDataToParent",
|
|
11
|
+
ALERT = "alert",
|
|
12
|
+
EXPORT_VIZ_DATA_TO_CHILD = "exportVizDataToChild",
|
|
13
|
+
GET_DATA = "getData"
|
|
14
|
+
}
|
|
15
|
+
declare type Callback = (...args: any[]) => void;
|
|
16
|
+
declare function checkIfLoggedIn(tsHost: string, callback: Callback): void;
|
|
17
|
+
declare function initialize(onInitialized: Callback, onAuthExpiration: Callback, _thoughtspotHost: string, authType: AuthType): void;
|
|
18
|
+
declare function notifyOnAuthExpiration(): void;
|
|
19
|
+
export { initialize, checkIfLoggedIn, notifyOnAuthExpiration };
|
package/dist/tsembed.es.js
CHANGED
|
@@ -379,7 +379,8 @@ var HostEvent;
|
|
|
379
379
|
*/
|
|
380
380
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
381
381
|
/**
|
|
382
|
-
* Update the runtime filters
|
|
382
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
383
|
+
* on to the existing runtime filters if they exist.
|
|
383
384
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
384
385
|
* @version 1.8.0 or later
|
|
385
386
|
*/
|
|
@@ -8894,7 +8895,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8894
8895
|
}
|
|
8895
8896
|
}
|
|
8896
8897
|
|
|
8897
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.8.0-
|
|
8898
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.8.0-plugins.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag plugins","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
8898
8899
|
|
|
8899
8900
|
/**
|
|
8900
8901
|
* Copyright (c) 2022
|
|
@@ -8937,6 +8938,7 @@ class TsEmbed {
|
|
|
8937
8938
|
this.isError = false;
|
|
8938
8939
|
this.viewConfig = viewConfig;
|
|
8939
8940
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
8941
|
+
this.registerPlugins(viewConfig === null || viewConfig === void 0 ? void 0 : viewConfig.plugins);
|
|
8940
8942
|
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
8941
8943
|
this.on(EmbedEvent.NoCookieAccess, () => {
|
|
8942
8944
|
// eslint-disable-next-line no-alert
|
|
@@ -8944,6 +8946,17 @@ class TsEmbed {
|
|
|
8944
8946
|
});
|
|
8945
8947
|
}
|
|
8946
8948
|
}
|
|
8949
|
+
registerPlugins(plugins) {
|
|
8950
|
+
if (!plugins) {
|
|
8951
|
+
return;
|
|
8952
|
+
}
|
|
8953
|
+
plugins.forEach((plugin) => {
|
|
8954
|
+
Object.keys(plugin.handlers).forEach((eventName) => {
|
|
8955
|
+
const listener = plugin[eventName];
|
|
8956
|
+
this.on(eventName, listener);
|
|
8957
|
+
});
|
|
8958
|
+
});
|
|
8959
|
+
}
|
|
8947
8960
|
/**
|
|
8948
8961
|
* Gets a reference to the root DOM node where
|
|
8949
8962
|
* the embedded content will appear.
|
package/dist/tsembed.js
CHANGED
|
@@ -360,7 +360,8 @@
|
|
|
360
360
|
*/
|
|
361
361
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
362
362
|
/**
|
|
363
|
-
* Update the runtime filters
|
|
363
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
364
|
+
* on to the existing runtime filters if they exist.
|
|
364
365
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
365
366
|
* @version 1.8.0 or later
|
|
366
367
|
*/
|
|
@@ -8863,7 +8864,7 @@
|
|
|
8863
8864
|
}
|
|
8864
8865
|
}
|
|
8865
8866
|
|
|
8866
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.8.0-
|
|
8867
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.8.0-plugins.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag plugins","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
8867
8868
|
|
|
8868
8869
|
/**
|
|
8869
8870
|
* Copyright (c) 2022
|
|
@@ -8906,6 +8907,7 @@
|
|
|
8906
8907
|
this.isError = false;
|
|
8907
8908
|
this.viewConfig = viewConfig;
|
|
8908
8909
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
8910
|
+
this.registerPlugins(viewConfig === null || viewConfig === void 0 ? void 0 : viewConfig.plugins);
|
|
8909
8911
|
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
8910
8912
|
this.on(exports.EmbedEvent.NoCookieAccess, () => {
|
|
8911
8913
|
// eslint-disable-next-line no-alert
|
|
@@ -8913,6 +8915,17 @@
|
|
|
8913
8915
|
});
|
|
8914
8916
|
}
|
|
8915
8917
|
}
|
|
8918
|
+
registerPlugins(plugins) {
|
|
8919
|
+
if (!plugins) {
|
|
8920
|
+
return;
|
|
8921
|
+
}
|
|
8922
|
+
plugins.forEach((plugin) => {
|
|
8923
|
+
Object.keys(plugin.handlers).forEach((eventName) => {
|
|
8924
|
+
const listener = plugin[eventName];
|
|
8925
|
+
this.on(eventName, listener);
|
|
8926
|
+
});
|
|
8927
|
+
});
|
|
8928
|
+
}
|
|
8916
8929
|
/**
|
|
8917
8930
|
* Gets a reference to the root DOM node where
|
|
8918
8931
|
* the embedded content will appear.
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.8.0-
|
|
3
|
+
"version": "1.8.0-plugins.0",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",
|
|
35
35
|
"posttest": "cat ./coverage/lcov.info | coveralls",
|
|
36
36
|
"prepublishOnly": "npm run test; npm run tsc; npm run bundle-dts; npm run build",
|
|
37
|
-
"publish-dev": "npm publish --tag
|
|
37
|
+
"publish-dev": "npm publish --tag plugins",
|
|
38
38
|
"publish-prod": "npm publish --tag latest"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { DOMSelector } from '../types';
|
|
12
|
+
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
+
/**
|
|
14
|
+
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
+
* @Category Pinboards and Charts
|
|
16
|
+
*/
|
|
17
|
+
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
+
/**
|
|
19
|
+
* If set to true, the embedded object container dynamically resizes
|
|
20
|
+
* according to the height of the pinboard.
|
|
21
|
+
*/
|
|
22
|
+
fullHeight?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
+
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
+
* other screens navigable from a pinboard.
|
|
27
|
+
* @default 500
|
|
28
|
+
* * _since 1.5.0_
|
|
29
|
+
*/
|
|
30
|
+
defaultHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
+
*/
|
|
34
|
+
enableVizTransformations?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The pinboard to display in the embedded view.
|
|
37
|
+
*/
|
|
38
|
+
pinboardId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The visualization within the pinboard to display.
|
|
41
|
+
*/
|
|
42
|
+
vizId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* If set to true, all filter chips from a
|
|
45
|
+
* pinboard page will be read-only (no X buttons)
|
|
46
|
+
*/
|
|
47
|
+
preventPinboardFilterRemoval?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
+
* The ids not in this array are hidden from the pinboard.
|
|
51
|
+
* _since: 1.6.0_
|
|
52
|
+
*/
|
|
53
|
+
pinboardVisibleVizs?: string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
+
* @Category Pinboards and Charts
|
|
58
|
+
*/
|
|
59
|
+
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
+
protected viewConfig: PinboardViewConfig;
|
|
61
|
+
private defaultHeight;
|
|
62
|
+
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
+
/**
|
|
64
|
+
* Construct a map of params to be passed on to the
|
|
65
|
+
* embedded pinboard or visualization.
|
|
66
|
+
*/
|
|
67
|
+
private getEmbedParams;
|
|
68
|
+
/**
|
|
69
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
+
* to be loaded within the iframe.
|
|
71
|
+
* @param pinboardId The GUID of the pinboard.
|
|
72
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
+
* the pinboard or visualization on load.
|
|
75
|
+
*/
|
|
76
|
+
private getIFrameSrc;
|
|
77
|
+
/**
|
|
78
|
+
* Set the iframe height as per the computed height received
|
|
79
|
+
* from the ThoughtSpot app.
|
|
80
|
+
* @param data The event payload
|
|
81
|
+
*/
|
|
82
|
+
private updateIFrameHeight;
|
|
83
|
+
private embedIframeCenter;
|
|
84
|
+
private handleRouteChangeFullHeightPinboard;
|
|
85
|
+
/**
|
|
86
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
+
* visualization ID and the runtime filters.
|
|
89
|
+
*/
|
|
90
|
+
render(): PinboardEmbed;
|
|
91
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
12
|
+
import { EmbedEvent, Param, } from '../types';
|
|
13
|
+
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
14
|
+
import { V1Embed } from './ts-embed';
|
|
15
|
+
/**
|
|
16
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
17
|
+
* @Category Pinboards and Charts
|
|
18
|
+
*/
|
|
19
|
+
export class PinboardEmbed extends V1Embed {
|
|
20
|
+
// eslint-disable-next-line no-useless-constructor
|
|
21
|
+
constructor(domSelector, viewConfig) {
|
|
22
|
+
super(domSelector, viewConfig);
|
|
23
|
+
this.defaultHeight = 500;
|
|
24
|
+
/**
|
|
25
|
+
* Set the iframe height as per the computed height received
|
|
26
|
+
* from the ThoughtSpot app.
|
|
27
|
+
* @param data The event payload
|
|
28
|
+
*/
|
|
29
|
+
this.updateIFrameHeight = (data) => {
|
|
30
|
+
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
31
|
+
};
|
|
32
|
+
this.embedIframeCenter = (data, responder) => {
|
|
33
|
+
const obj = this.getIframeCenter();
|
|
34
|
+
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
35
|
+
};
|
|
36
|
+
this.handleRouteChangeFullHeightPinboard = (data) => {
|
|
37
|
+
if (data.data.canvasState !== 'EMBED' &&
|
|
38
|
+
data.data.canvasState !== 'pinboard') {
|
|
39
|
+
this.setIFrameHeight(this.defaultHeight);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Construct a map of params to be passed on to the
|
|
45
|
+
* embedded pinboard or visualization.
|
|
46
|
+
*/
|
|
47
|
+
getEmbedParams() {
|
|
48
|
+
const params = this.getBaseQueryParams();
|
|
49
|
+
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight, pinboardVisibleVizs, } = this.viewConfig;
|
|
50
|
+
if (fullHeight === true) {
|
|
51
|
+
params[Param.fullHeight] = true;
|
|
52
|
+
}
|
|
53
|
+
if (defaultHeight) {
|
|
54
|
+
this.defaultHeight = defaultHeight;
|
|
55
|
+
}
|
|
56
|
+
if (enableVizTransformations !== undefined) {
|
|
57
|
+
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
58
|
+
}
|
|
59
|
+
if (preventPinboardFilterRemoval) {
|
|
60
|
+
params[Param.preventPinboardFilterRemoval] = true;
|
|
61
|
+
}
|
|
62
|
+
if (pinboardVisibleVizs) {
|
|
63
|
+
params[Param.PinboardVisibleVizs] = pinboardVisibleVizs;
|
|
64
|
+
}
|
|
65
|
+
params[Param.livedBoardEmbed] = true;
|
|
66
|
+
const queryParams = getQueryParamString(params, true);
|
|
67
|
+
return queryParams;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
71
|
+
* to be loaded within the iframe.
|
|
72
|
+
* @param pinboardId The GUID of the pinboard.
|
|
73
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
74
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
75
|
+
* the pinboard or visualization on load.
|
|
76
|
+
*/
|
|
77
|
+
getIFrameSrc(pinboardId, vizId, runtimeFilters) {
|
|
78
|
+
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
79
|
+
const queryParams = this.getEmbedParams();
|
|
80
|
+
const queryString = [filterQuery, queryParams]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join('&');
|
|
83
|
+
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${pinboardId}`;
|
|
84
|
+
if (vizId) {
|
|
85
|
+
url = `${url}/${vizId}`;
|
|
86
|
+
}
|
|
87
|
+
return url;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
91
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
92
|
+
* visualization ID and the runtime filters.
|
|
93
|
+
*/
|
|
94
|
+
render() {
|
|
95
|
+
const { pinboardId, vizId, runtimeFilters } = this.viewConfig;
|
|
96
|
+
if (!pinboardId && !vizId) {
|
|
97
|
+
this.handleError(ERROR_MESSAGE.PINBOARD_VIZ_ID_VALIDATION);
|
|
98
|
+
}
|
|
99
|
+
if (this.viewConfig.fullHeight === true) {
|
|
100
|
+
this.on(EmbedEvent.RouteChange, this.handleRouteChangeFullHeightPinboard);
|
|
101
|
+
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
102
|
+
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
103
|
+
}
|
|
104
|
+
super.render();
|
|
105
|
+
const src = this.getIFrameSrc(pinboardId, vizId, runtimeFilters);
|
|
106
|
+
this.renderV1Embed(src);
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=pinboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACH,UAAU,EAEV,KAAK,GAIR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAc,MAAM,YAA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,CAAC,0BAA0B,CAAC,CAAC;SAC9D;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC,EAAE,CACH,UAAU,CAAC,WAAW,EACtB,IAAI,CAAC,mCAAmC,CAC3C,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjE;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @summary Base classes
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
|
-
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig } from '../types';
|
|
9
|
+
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, Plugin } from '../types';
|
|
10
10
|
export interface LayoutConfig {
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -76,6 +76,13 @@ export interface ViewConfig {
|
|
|
76
76
|
additionalFlags?: {
|
|
77
77
|
[key: string]: string | number | boolean;
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
81
|
+
* provided below,
|
|
82
|
+
*
|
|
83
|
+
* @version alpha
|
|
84
|
+
*/
|
|
85
|
+
plugins?: Plugin[];
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
81
88
|
* Base class for embedding v2 experience
|
|
@@ -121,6 +128,7 @@ export declare class TsEmbed {
|
|
|
121
128
|
*/
|
|
122
129
|
private shouldEncodeUrlQueryParams;
|
|
123
130
|
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
131
|
+
private registerPlugins;
|
|
124
132
|
/**
|
|
125
133
|
* Gets a reference to the root DOM node where
|
|
126
134
|
* the embedded content will appear.
|
|
@@ -12,6 +12,7 @@ import { EmbedEvent, Param, } from '../types';
|
|
|
12
12
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
13
13
|
import { getProcessData } from '../utils/processData';
|
|
14
14
|
import { processTrigger } from '../utils/processTrigger';
|
|
15
|
+
// eslint-disable-next-line import/no-cycle
|
|
15
16
|
import pkgInfo from '../../package.json';
|
|
16
17
|
import { getAuthPromise, getEmbedConfig, renderInQueue } from './base';
|
|
17
18
|
const { version } = pkgInfo;
|
|
@@ -47,6 +48,7 @@ export class TsEmbed {
|
|
|
47
48
|
this.isError = false;
|
|
48
49
|
this.viewConfig = viewConfig;
|
|
49
50
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
51
|
+
this.registerPlugins(viewConfig === null || viewConfig === void 0 ? void 0 : viewConfig.plugins);
|
|
50
52
|
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
51
53
|
this.on(EmbedEvent.NoCookieAccess, () => {
|
|
52
54
|
// eslint-disable-next-line no-alert
|
|
@@ -54,6 +56,17 @@ export class TsEmbed {
|
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
registerPlugins(plugins) {
|
|
60
|
+
if (!plugins) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
plugins.forEach((plugin) => {
|
|
64
|
+
Object.keys(plugin.handlers).forEach((eventName) => {
|
|
65
|
+
const listener = plugin[eventName];
|
|
66
|
+
this.on(eventName, listener);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
57
70
|
/**
|
|
58
71
|
* Gets a reference to the root DOM node where
|
|
59
72
|
* the embedded content will appear.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-embed.js","sourceRoot":"","sources":["../../../src/embed/ts-embed.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACH,2BAA2B,EAC3B,eAAe,EACf,YAAY,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGH,UAAU,EAIV,KAAK,GAER,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,GAAG;IACf,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;CACzC,CAAC;AA0EF;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAmDhB,YAAY,WAAwB,EAAE,UAAuB;QAR7D;;;;;WAKG;QACK,+BAA0B,GAAG,KAAK,CAAC;QAGvC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACvC,qBAAqB;QACrB,IAAI,CAAC,WAAW,GAAG,cAAc,EAAE,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAA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KG;IACI,MAAM;QACT,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,OAAO;IAGhC,YAAY,WAAwB,EAAE,UAAsB;QACxD,KAAK,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,SAAiB;QACrC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED,YAAY;IACL,EAAE,CACL,WAAuB,EACvB,QAAyB;QAEzB,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAE3D,OAAO,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACJ"}
|
package/lib/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAiB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACH,aAAa,EAEb,cAAc,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EACH,QAAQ,EAER,eAAe,EACf,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAiB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACH,aAAa,EAEb,cAAc,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EACH,QAAQ,EAER,eAAe,EACf,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,MAAM,GAGT,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,QAAQ;AACR,QAAQ;AACR,IAAI,EACJ,QAAQ,EAER,eAAe,EACf,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,MAAM,GAKT,CAAC"}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface EmbedConfig {
|
|
|
122
122
|
queueMultiRenders?: boolean;
|
|
123
123
|
/**
|
|
124
124
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
125
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
125
126
|
* @version 1.6.0 or later
|
|
126
127
|
* @default ''
|
|
127
128
|
*/
|
|
@@ -379,7 +380,8 @@ export declare enum HostEvent {
|
|
|
379
380
|
*/
|
|
380
381
|
SetVisibleVizs = "SetPinboardVisibleVizs",
|
|
381
382
|
/**
|
|
382
|
-
* Update the runtime filters
|
|
383
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
384
|
+
* on to the existing runtime filters if they exist.
|
|
383
385
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
384
386
|
* @version 1.8.0 or later
|
|
385
387
|
*/
|
|
@@ -535,3 +537,9 @@ export declare enum OperationType {
|
|
|
535
537
|
export interface AnswerServiceType {
|
|
536
538
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
537
539
|
}
|
|
540
|
+
export interface Plugin {
|
|
541
|
+
name: string;
|
|
542
|
+
handlers: {
|
|
543
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
544
|
+
};
|
|
545
|
+
}
|
package/lib/src/types.js
CHANGED
|
@@ -267,7 +267,8 @@ export var HostEvent;
|
|
|
267
267
|
*/
|
|
268
268
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
269
269
|
/**
|
|
270
|
-
* Update the runtime filters
|
|
270
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
271
|
+
* on to the existing runtime filters if they exist.
|
|
271
272
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
272
273
|
* @version 1.8.0 or later
|
|
273
274
|
*/
|
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;AAsHD;;GAEG;AACH,qCAAqC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AA0C,CAAA;IAC1C,iEAAuD,CAAA;IACvD,yDAA+C,CAAA;IAC/C,8CAAoC,CAAA;IACpC,wDAA8C,CAAA;IAC9C,mDAAyC,CAAA;IACzC,6BAAmB,CAAA;IACnB,yCAA+B,CAAA;IAC/B,qDAA2C,CAAA;IAC3C;;OAEG;IACH,mCAAyB,CAAA;IACzB;;OAEG;IACH,yCAA+B,CAAA;IAC/B;;OAEG;IACH,qDAA2C,CAAA;IAC3C;;OAEG;IACH,2CAAiC,CAAA;IACjC;;OAEG;IACH,qCAA2B,CAAA;AAC/B,CAAC,EAjFW,MAAM,KAAN,MAAM,QAiFjB;AAQD,qCAAqC;AACrC,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,sDAAqC,CAAA;IACrC,sEAAqD,CAAA;AACzD,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/utils/plugin.ts"],"names":[],"mappings":""}
|
|
@@ -439,6 +439,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
439
439
|
queueMultiRenders?: boolean;
|
|
440
440
|
/**
|
|
441
441
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
442
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
442
443
|
* @version 1.6.0 or later
|
|
443
444
|
* @default ''
|
|
444
445
|
*/
|
|
@@ -696,7 +697,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
696
697
|
*/
|
|
697
698
|
SetVisibleVizs = "SetPinboardVisibleVizs",
|
|
698
699
|
/**
|
|
699
|
-
* Update the runtime filters
|
|
700
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
701
|
+
* on to the existing runtime filters if they exist.
|
|
700
702
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
701
703
|
* @version 1.8.0 or later
|
|
702
704
|
*/
|
|
@@ -852,6 +854,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
852
854
|
export interface AnswerServiceType {
|
|
853
855
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
854
856
|
}
|
|
857
|
+
export interface Plugin {
|
|
858
|
+
name: string;
|
|
859
|
+
handlers: {
|
|
860
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
861
|
+
};
|
|
862
|
+
}
|
|
855
863
|
}
|
|
856
864
|
|
|
857
865
|
declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
@@ -863,7 +871,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
|
863
871
|
* @summary Base classes
|
|
864
872
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
865
873
|
*/
|
|
866
|
-
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig } from '@thoughtspot/visual-embed-sdk/types';
|
|
874
|
+
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, Plugin } from '@thoughtspot/visual-embed-sdk/types';
|
|
867
875
|
export interface LayoutConfig {
|
|
868
876
|
}
|
|
869
877
|
/**
|
|
@@ -933,6 +941,13 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
|
933
941
|
additionalFlags?: {
|
|
934
942
|
[key: string]: string | number | boolean;
|
|
935
943
|
};
|
|
944
|
+
/**
|
|
945
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
946
|
+
* provided below,
|
|
947
|
+
*
|
|
948
|
+
* @version alpha
|
|
949
|
+
*/
|
|
950
|
+
plugins?: Plugin[];
|
|
936
951
|
}
|
|
937
952
|
/**
|
|
938
953
|
* Base class for embedding v2 experience
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.8.0-
|
|
3
|
+
"version": "1.8.0-plugins.0",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",
|
|
35
35
|
"posttest": "cat ./coverage/lcov.info | coveralls",
|
|
36
36
|
"prepublishOnly": "npm run test; npm run tsc; npm run bundle-dts; npm run build",
|
|
37
|
-
"publish-dev": "npm publish --tag
|
|
37
|
+
"publish-dev": "npm publish --tag plugins",
|
|
38
38
|
"publish-prod": "npm publish --tag latest"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -28,10 +28,12 @@ import {
|
|
|
28
28
|
RuntimeFilter,
|
|
29
29
|
Param,
|
|
30
30
|
EmbedConfig,
|
|
31
|
+
Plugin,
|
|
31
32
|
} from '../types';
|
|
32
33
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
33
34
|
import { getProcessData } from '../utils/processData';
|
|
34
35
|
import { processTrigger } from '../utils/processTrigger';
|
|
36
|
+
// eslint-disable-next-line import/no-cycle
|
|
35
37
|
import pkgInfo from '../../package.json';
|
|
36
38
|
import { getAuthPromise, getEmbedConfig, renderInQueue } from './base';
|
|
37
39
|
|
|
@@ -117,6 +119,13 @@ export interface ViewConfig {
|
|
|
117
119
|
* @version 1.8.0
|
|
118
120
|
*/
|
|
119
121
|
additionalFlags?: { [key: string]: string | number | boolean };
|
|
122
|
+
/**
|
|
123
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
124
|
+
* provided below,
|
|
125
|
+
*
|
|
126
|
+
* @version alpha
|
|
127
|
+
*/
|
|
128
|
+
plugins?: Plugin[];
|
|
120
129
|
}
|
|
121
130
|
|
|
122
131
|
/**
|
|
@@ -185,6 +194,8 @@ export class TsEmbed {
|
|
|
185
194
|
this.isError = false;
|
|
186
195
|
this.viewConfig = viewConfig;
|
|
187
196
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
197
|
+
this.registerPlugins(viewConfig?.plugins);
|
|
198
|
+
|
|
188
199
|
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
189
200
|
this.on(EmbedEvent.NoCookieAccess, () => {
|
|
190
201
|
// eslint-disable-next-line no-alert
|
|
@@ -195,6 +206,18 @@ export class TsEmbed {
|
|
|
195
206
|
}
|
|
196
207
|
}
|
|
197
208
|
|
|
209
|
+
private registerPlugins(plugins: Plugin[]) {
|
|
210
|
+
if (!plugins) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
plugins.forEach((plugin) => {
|
|
214
|
+
Object.keys(plugin.handlers).forEach((eventName: EmbedEvent) => {
|
|
215
|
+
const listener = plugin[eventName];
|
|
216
|
+
this.on(eventName, listener);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
198
221
|
/**
|
|
199
222
|
* Gets a reference to the root DOM node where
|
|
200
223
|
* the embedded content will appear.
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -135,6 +135,7 @@ export interface EmbedConfig {
|
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
138
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
138
139
|
* @version 1.6.0 or later
|
|
139
140
|
* @default ''
|
|
140
141
|
*/
|
|
@@ -402,7 +403,8 @@ export enum HostEvent {
|
|
|
402
403
|
*/
|
|
403
404
|
SetVisibleVizs = 'SetPinboardVisibleVizs',
|
|
404
405
|
/**
|
|
405
|
-
* Update the runtime filters
|
|
406
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
407
|
+
* on to the existing runtime filters if they exist.
|
|
406
408
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
407
409
|
* @version 1.8.0 or later
|
|
408
410
|
*/
|
|
@@ -565,3 +567,10 @@ export enum OperationType {
|
|
|
565
567
|
export interface AnswerServiceType {
|
|
566
568
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
567
569
|
}
|
|
570
|
+
|
|
571
|
+
export interface Plugin {
|
|
572
|
+
name: string;
|
|
573
|
+
handlers: {
|
|
574
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
575
|
+
};
|
|
576
|
+
}
|