@thoughtspot/visual-embed-sdk 1.45.0 → 1.45.2
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/cjs/package.json +2 -2
- package/cjs/src/authToken.d.ts +1 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +2 -2
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/authToken.spec.js +71 -0
- package/cjs/src/authToken.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +3 -3
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +18 -18
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +2 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +2 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +1 -1
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +23 -2
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +64 -22
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +138 -19
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/types.d.ts +164 -2
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +43 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +3 -2
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +4 -2
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +5 -1
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +8 -1
- package/cjs/src/utils.js.map +1 -1
- package/dist/{index-Dk-SLdNk.js → index-BdkKLLo1.js} +1 -1
- package/dist/src/authToken.d.ts +1 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +3 -3
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +2 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +23 -2
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +164 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +3 -2
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +5 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +140 -49
- package/dist/tsembed-react.js +139 -48
- package/dist/tsembed.es.js +155 -64
- package/dist/tsembed.js +29640 -29549
- package/dist/visual-embed-sdk-react-full.d.ts +196 -13
- package/dist/visual-embed-sdk-react.d.ts +196 -13
- package/dist/visual-embed-sdk.d.ts +196 -13
- package/lib/package.json +2 -2
- package/lib/src/authToken.d.ts +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +2 -2
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/authToken.spec.js +72 -1
- package/lib/src/authToken.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +3 -3
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +18 -18
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +2 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +2 -2
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +1 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +23 -2
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +64 -22
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +139 -20
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/types.d.ts +164 -2
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +42 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +3 -2
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +4 -2
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +5 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +6 -0
- package/lib/src/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/authToken.spec.ts +91 -2
- package/src/authToken.ts +2 -2
- package/src/embed/hostEventClient/contracts.ts +4 -4
- package/src/embed/hostEventClient/host-event-client.spec.ts +7 -1
- package/src/embed/hostEventClient/host-event-client.ts +22 -11
- package/src/embed/liveboard.spec.ts +1 -1
- package/src/embed/liveboard.ts +5 -3
- package/src/embed/ts-embed.spec.ts +184 -8
- package/src/embed/ts-embed.ts +81 -24
- package/src/index.ts +2 -0
- package/src/types.ts +171 -0
- package/src/utils/processTrigger.ts +6 -3
- package/src/utils.ts +8 -0
package/dist/tsembed.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.45.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.45.2 */
|
|
2
2
|
'use client';
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -1677,6 +1677,18 @@ var EmbedEvent;
|
|
|
1677
1677
|
* @version SDK: 1.43.0 | ThoughtSpot: 10.15.0.cl
|
|
1678
1678
|
*/
|
|
1679
1679
|
EmbedEvent["ApiIntercept"] = "ApiIntercept";
|
|
1680
|
+
/**
|
|
1681
|
+
* @hidden
|
|
1682
|
+
* Emitted when the auth token is about to get expired and needs to be refreshed.
|
|
1683
|
+
* @example
|
|
1684
|
+
* ```js
|
|
1685
|
+
* embed.on(EmbedEvent.RefreshAuthToken, (payload) => {
|
|
1686
|
+
* console.log('payload', payload);
|
|
1687
|
+
* })
|
|
1688
|
+
* ```
|
|
1689
|
+
* @version SDK: 1.45.2 | ThoughtSpot: 26.3.0.cl
|
|
1690
|
+
*/
|
|
1691
|
+
EmbedEvent["RefreshAuthToken"] = "RefreshAuthToken";
|
|
1680
1692
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1681
1693
|
/**
|
|
1682
1694
|
* Event types that can be triggered by the host application
|
|
@@ -3060,6 +3072,17 @@ var HostEvent;
|
|
|
3060
3072
|
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
|
|
3061
3073
|
*/
|
|
3062
3074
|
HostEvent["StartNewSpotterConversation"] = "StartNewSpotterConversation";
|
|
3075
|
+
/**
|
|
3076
|
+
* @hidden
|
|
3077
|
+
* Get the current context of the embedded page.
|
|
3078
|
+
*
|
|
3079
|
+
* @example
|
|
3080
|
+
* ```js
|
|
3081
|
+
* const context = await liveboardEmbed.trigger(HostEvent.GetPageContext);
|
|
3082
|
+
* ```
|
|
3083
|
+
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
|
|
3084
|
+
*/
|
|
3085
|
+
HostEvent["GetPageContext"] = "GetPageContext";
|
|
3063
3086
|
})(HostEvent || (HostEvent = {}));
|
|
3064
3087
|
/**
|
|
3065
3088
|
* The different visual modes that the data sources panel within
|
|
@@ -4845,6 +4868,25 @@ var EmbedErrorCodes;
|
|
|
4845
4868
|
/** Failed to update embed parameters during pre-render */
|
|
4846
4869
|
EmbedErrorCodes["UPDATE_PARAMS_FAILED"] = "UPDATE_PARAMS_FAILED";
|
|
4847
4870
|
})(EmbedErrorCodes || (EmbedErrorCodes = {}));
|
|
4871
|
+
var ContextType;
|
|
4872
|
+
(function (ContextType) {
|
|
4873
|
+
/**
|
|
4874
|
+
* Search answer context for search page or edit viz dialog on liveboard page.
|
|
4875
|
+
*/
|
|
4876
|
+
ContextType["Search"] = "search-answer";
|
|
4877
|
+
/**
|
|
4878
|
+
* Liveboard context for liveboard page.
|
|
4879
|
+
*/
|
|
4880
|
+
ContextType["Liveboard"] = "liveboard";
|
|
4881
|
+
/**
|
|
4882
|
+
* Answer context for explore modal/page on liveboard page.
|
|
4883
|
+
*/
|
|
4884
|
+
ContextType["Answer"] = "answer";
|
|
4885
|
+
/**
|
|
4886
|
+
* Spotter context for spotter modal/page.
|
|
4887
|
+
*/
|
|
4888
|
+
ContextType["Spotter"] = "spotter";
|
|
4889
|
+
})(ContextType || (ContextType = {}));
|
|
4848
4890
|
/**
|
|
4849
4891
|
* Enum for the type of API intercepted
|
|
4850
4892
|
*/
|
|
@@ -5484,6 +5526,12 @@ const formatTemplate = (template, values) => {
|
|
|
5484
5526
|
return values[key] !== undefined ? String(values[key]) : match;
|
|
5485
5527
|
});
|
|
5486
5528
|
};
|
|
5529
|
+
const getHostEventsConfig = (viewConfig) => {
|
|
5530
|
+
return {
|
|
5531
|
+
shouldBypassPayloadValidation: viewConfig.shouldBypassPayloadValidation,
|
|
5532
|
+
useHostEventsV2: viewConfig.useHostEventsV2,
|
|
5533
|
+
};
|
|
5534
|
+
};
|
|
5487
5535
|
/**
|
|
5488
5536
|
* Check if the window is undefined
|
|
5489
5537
|
* If the window is undefined, it means the code is running in a SSR environment.
|
|
@@ -7907,11 +7955,11 @@ const storeAuthTokenInCache = (token) => {
|
|
|
7907
7955
|
*
|
|
7908
7956
|
* @param embedConfig
|
|
7909
7957
|
*/
|
|
7910
|
-
async function getAuthenticationToken(embedConfig) {
|
|
7958
|
+
async function getAuthenticationToken(embedConfig, skipvalidation = false) {
|
|
7911
7959
|
const cachedAuthToken = getCacheAuthToken();
|
|
7912
7960
|
// Since we don't have token validation enabled , we cannot tell if the
|
|
7913
7961
|
// cached token is valid or not. So we will always fetch a new token.
|
|
7914
|
-
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
7962
|
+
if (cachedAuthToken && !embedConfig.disableTokenVerification && !skipvalidation) {
|
|
7915
7963
|
let isCachedTokenStillValid;
|
|
7916
7964
|
try {
|
|
7917
7965
|
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
@@ -8679,7 +8727,7 @@ class AnswerService {
|
|
|
8679
8727
|
async getTML() {
|
|
8680
8728
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8681
8729
|
const edoc = object[0].edoc;
|
|
8682
|
-
const YAML = await import('./index-
|
|
8730
|
+
const YAML = await import('./index-BdkKLLo1.js');
|
|
8683
8731
|
const parsedDoc = YAML.parse(edoc);
|
|
8684
8732
|
return {
|
|
8685
8733
|
answer: {
|
|
@@ -16415,8 +16463,8 @@ var mixpanel = init_as_module();
|
|
|
16415
16463
|
var mixpanel_cjs = mixpanel;
|
|
16416
16464
|
|
|
16417
16465
|
var mixpanel$1 = /*#__PURE__*/_mergeNamespaces({
|
|
16418
|
-
|
|
16419
|
-
|
|
16466
|
+
__proto__: null,
|
|
16467
|
+
default: mixpanel_cjs
|
|
16420
16468
|
}, [mixpanel_cjs]);
|
|
16421
16469
|
|
|
16422
16470
|
// Needed to avoid error in CJS builds on some bundlers.
|
|
@@ -17567,6 +17615,7 @@ const reload = (iFrame) => {
|
|
|
17567
17615
|
* @param message
|
|
17568
17616
|
* @param message.type
|
|
17569
17617
|
* @param message.data
|
|
17618
|
+
* @param message.context
|
|
17570
17619
|
* @param thoughtSpotHost
|
|
17571
17620
|
* @param channel
|
|
17572
17621
|
*/
|
|
@@ -17581,8 +17630,9 @@ const TRIGGER_TIMEOUT = 30000;
|
|
|
17581
17630
|
* @param messageType
|
|
17582
17631
|
* @param thoughtSpotHost
|
|
17583
17632
|
* @param data
|
|
17633
|
+
* @param context
|
|
17584
17634
|
*/
|
|
17585
|
-
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
17635
|
+
function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
17586
17636
|
return new Promise((res, rej) => {
|
|
17587
17637
|
var _a;
|
|
17588
17638
|
if (messageType === HostEvent.Reload) {
|
|
@@ -17616,7 +17666,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
17616
17666
|
channel.port1.close();
|
|
17617
17667
|
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
17618
17668
|
}, TRIGGER_TIMEOUT);
|
|
17619
|
-
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
17669
|
+
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
17620
17670
|
});
|
|
17621
17671
|
}
|
|
17622
17672
|
|
|
@@ -18115,7 +18165,7 @@ function processEventData(type, eventData, thoughtSpotHost, containerEl) {
|
|
|
18115
18165
|
return eventData;
|
|
18116
18166
|
}
|
|
18117
18167
|
|
|
18118
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.45.
|
|
18168
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.45.2";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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.23","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};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","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@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":"^30.0.0","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^30.2.0","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^30.2.0","jest-environment-jsdom":"^29.7.0","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",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:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^29.4.6","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],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};
|
|
18119
18169
|
|
|
18120
18170
|
class HostEventClient {
|
|
18121
18171
|
constructor(iFrame) {
|
|
@@ -18127,16 +18177,16 @@ class HostEventClient {
|
|
|
18127
18177
|
* @param {any} data Data to send with the host event
|
|
18128
18178
|
* @returns {Promise<any>} - the response from the process trigger
|
|
18129
18179
|
*/
|
|
18130
|
-
async processTrigger(message, data) {
|
|
18180
|
+
async processTrigger(message, data, context) {
|
|
18131
18181
|
if (!this.iFrame) {
|
|
18132
18182
|
throw new Error('Iframe element is not set');
|
|
18133
18183
|
}
|
|
18134
18184
|
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
18135
|
-
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
18185
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
|
|
18136
18186
|
}
|
|
18137
|
-
async handleHostEventWithParam(apiName, parameters) {
|
|
18187
|
+
async handleHostEventWithParam(apiName, parameters, context) {
|
|
18138
18188
|
var _a, _b, _c, _d;
|
|
18139
|
-
const response = (_b = (_a = (await this.triggerUIPassthroughApi(apiName, parameters))) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (r) => r.error || r.value)[0];
|
|
18189
|
+
const response = (_b = (_a = (await this.triggerUIPassthroughApi(apiName, parameters, context))) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (r) => r.error || r.value)[0];
|
|
18140
18190
|
if (!response) {
|
|
18141
18191
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
18142
18192
|
// eslint-disable-next-line no-throw-literal
|
|
@@ -18151,8 +18201,8 @@ class HostEventClient {
|
|
|
18151
18201
|
}
|
|
18152
18202
|
return { ...response.value };
|
|
18153
18203
|
}
|
|
18154
|
-
async hostEventFallback(hostEvent, data) {
|
|
18155
|
-
return this.processTrigger(hostEvent, data);
|
|
18204
|
+
async hostEventFallback(hostEvent, data, context) {
|
|
18205
|
+
return this.processTrigger(hostEvent, data, context);
|
|
18156
18206
|
}
|
|
18157
18207
|
/**
|
|
18158
18208
|
* Setter for the iframe element used for host events
|
|
@@ -18161,49 +18211,49 @@ class HostEventClient {
|
|
|
18161
18211
|
setIframeElement(iFrame) {
|
|
18162
18212
|
this.iFrame = iFrame;
|
|
18163
18213
|
}
|
|
18164
|
-
async triggerUIPassthroughApi(apiName, parameters) {
|
|
18214
|
+
async triggerUIPassthroughApi(apiName, parameters, context) {
|
|
18165
18215
|
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
18166
18216
|
type: apiName,
|
|
18167
18217
|
parameters,
|
|
18168
|
-
});
|
|
18218
|
+
}, context);
|
|
18169
18219
|
return res;
|
|
18170
18220
|
}
|
|
18171
|
-
async handlePinEvent(payload) {
|
|
18221
|
+
async handlePinEvent(payload, context) {
|
|
18172
18222
|
var _a, _b;
|
|
18173
18223
|
if (!payload || !('newVizName' in payload)) {
|
|
18174
|
-
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
18224
|
+
return this.hostEventFallback(HostEvent.Pin, payload, context);
|
|
18175
18225
|
}
|
|
18176
18226
|
const formattedPayload = {
|
|
18177
18227
|
...payload,
|
|
18178
18228
|
pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
|
|
18179
18229
|
newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
|
|
18180
18230
|
};
|
|
18181
|
-
const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
|
|
18231
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload, context);
|
|
18182
18232
|
return {
|
|
18183
18233
|
...data,
|
|
18184
18234
|
liveboardId: data.pinboardId,
|
|
18185
18235
|
};
|
|
18186
18236
|
}
|
|
18187
|
-
async handleSaveAnswerEvent(payload) {
|
|
18237
|
+
async handleSaveAnswerEvent(payload, context) {
|
|
18188
18238
|
var _a, _b, _c, _d;
|
|
18189
18239
|
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
18190
18240
|
// Save is the fallback for SaveAnswer
|
|
18191
|
-
return this.hostEventFallback(HostEvent.Save, payload);
|
|
18241
|
+
return this.hostEventFallback(HostEvent.Save, payload, context);
|
|
18192
18242
|
}
|
|
18193
|
-
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
18243
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload, context);
|
|
18194
18244
|
return {
|
|
18195
18245
|
...data,
|
|
18196
18246
|
answerId: (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.saveResponse) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Answer__save) === null || _c === void 0 ? void 0 : _c.answer) === null || _d === void 0 ? void 0 : _d.id,
|
|
18197
18247
|
};
|
|
18198
18248
|
}
|
|
18199
|
-
async triggerHostEvent(hostEvent, payload) {
|
|
18249
|
+
async triggerHostEvent(hostEvent, payload, context) {
|
|
18200
18250
|
switch (hostEvent) {
|
|
18201
18251
|
case HostEvent.Pin:
|
|
18202
|
-
return this.handlePinEvent(payload);
|
|
18252
|
+
return this.handlePinEvent(payload, context);
|
|
18203
18253
|
case HostEvent.SaveAnswer:
|
|
18204
|
-
return this.handleSaveAnswerEvent(payload);
|
|
18254
|
+
return this.handleSaveAnswerEvent(payload, context);
|
|
18205
18255
|
default:
|
|
18206
|
-
return this.hostEventFallback(hostEvent, payload);
|
|
18256
|
+
return this.hostEventFallback(hostEvent, payload, context);
|
|
18207
18257
|
}
|
|
18208
18258
|
}
|
|
18209
18259
|
}
|
|
@@ -18464,31 +18514,39 @@ class TsEmbed {
|
|
|
18464
18514
|
logger$3.error(`AppInit failed, Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
18465
18515
|
}
|
|
18466
18516
|
};
|
|
18517
|
+
this.handleAuthFailure = (error) => {
|
|
18518
|
+
logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
18519
|
+
processAuthFailure(error, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18520
|
+
};
|
|
18521
|
+
/**
|
|
18522
|
+
* Refresh the auth token if the autoLogin is true and the authType is TrustedAuthTokenCookieless
|
|
18523
|
+
* @param _
|
|
18524
|
+
* @param responder
|
|
18525
|
+
*/
|
|
18526
|
+
this.tokenRefresh = async (_, responder) => {
|
|
18527
|
+
try {
|
|
18528
|
+
await this.refreshAuthTokenForCookieless(responder, EmbedEvent.RefreshAuthToken, true);
|
|
18529
|
+
}
|
|
18530
|
+
catch (e) {
|
|
18531
|
+
this.handleAuthFailure(e);
|
|
18532
|
+
}
|
|
18533
|
+
};
|
|
18467
18534
|
/**
|
|
18468
18535
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
18469
18536
|
* @param _
|
|
18470
18537
|
* @param responder
|
|
18471
18538
|
*/
|
|
18472
18539
|
this.updateAuthToken = async (_, responder) => {
|
|
18473
|
-
const { authType } = this.embedConfig;
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
responder({
|
|
18482
|
-
type: EmbedEvent.AuthExpire,
|
|
18483
|
-
data: { authToken },
|
|
18484
|
-
});
|
|
18485
|
-
}
|
|
18486
|
-
catch (e) {
|
|
18487
|
-
logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
18488
|
-
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18489
|
-
}
|
|
18540
|
+
const { authType, autoLogin: autoLoginConfig } = this.embedConfig;
|
|
18541
|
+
// Default autoLogin: true for cookieless if undefined/null, otherwise false
|
|
18542
|
+
const autoLogin = autoLoginConfig !== null && autoLoginConfig !== void 0 ? autoLoginConfig : (authType === AuthType.TrustedAuthTokenCookieless);
|
|
18543
|
+
try {
|
|
18544
|
+
await this.refreshAuthTokenForCookieless(responder, EmbedEvent.AuthExpire, false);
|
|
18545
|
+
}
|
|
18546
|
+
catch (e) {
|
|
18547
|
+
this.handleAuthFailure(e);
|
|
18490
18548
|
}
|
|
18491
|
-
|
|
18549
|
+
if (autoLogin && authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
18492
18550
|
handleAuth();
|
|
18493
18551
|
}
|
|
18494
18552
|
notifyAuthFailure(AuthFailureType.EXPIRY);
|
|
@@ -18509,8 +18567,7 @@ class TsEmbed {
|
|
|
18509
18567
|
});
|
|
18510
18568
|
}
|
|
18511
18569
|
catch (e) {
|
|
18512
|
-
|
|
18513
|
-
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18570
|
+
this.handleAuthFailure(e);
|
|
18514
18571
|
}
|
|
18515
18572
|
}).catch((e) => {
|
|
18516
18573
|
logger$3.error(`Auto Login failed, Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
@@ -18528,6 +18585,7 @@ class TsEmbed {
|
|
|
18528
18585
|
this.on(EmbedEvent.EmbedListenerReady, embedListenerReadyHandler, { start: false }, true);
|
|
18529
18586
|
const authInitHandler = this.createEmbedContainerHandler(EmbedEvent.AuthInit);
|
|
18530
18587
|
this.on(EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
|
|
18588
|
+
this.on(EmbedEvent.RefreshAuthToken, this.tokenRefresh, { start: false }, true);
|
|
18531
18589
|
};
|
|
18532
18590
|
this.showPreRenderByDefault = false;
|
|
18533
18591
|
/**
|
|
@@ -18837,13 +18895,33 @@ class TsEmbed {
|
|
|
18837
18895
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
18838
18896
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
18839
18897
|
customActions: customActionsResult.actions,
|
|
18898
|
+
embedExpiryInAuthToken: this.viewConfig.refreshAuthTokenOnNearExpiry,
|
|
18840
18899
|
...getInterceptInitData(this.viewConfig),
|
|
18900
|
+
...getHostEventsConfig(this.viewConfig),
|
|
18841
18901
|
};
|
|
18842
18902
|
return baseInitData;
|
|
18843
18903
|
}
|
|
18844
18904
|
async getAppInitData() {
|
|
18845
18905
|
return this.getDefaultAppInitData();
|
|
18846
18906
|
}
|
|
18907
|
+
/**
|
|
18908
|
+
* Helper method to refresh/update auth token for TrustedAuthTokenCookieless auth type
|
|
18909
|
+
* @param responder - Function to send response back
|
|
18910
|
+
* @param eventType - The embed event type to send
|
|
18911
|
+
* @param forceRefresh - Whether to force refresh the token
|
|
18912
|
+
* @returns Promise that resolves if token was refreshed, rejects otherwise
|
|
18913
|
+
*/
|
|
18914
|
+
async refreshAuthTokenForCookieless(responder, eventType, forceRefresh = false) {
|
|
18915
|
+
const { authType, autoLogin } = this.embedConfig;
|
|
18916
|
+
const isAutoLoginTrue = autoLogin !== null && autoLogin !== void 0 ? autoLogin : (authType === AuthType.TrustedAuthTokenCookieless);
|
|
18917
|
+
if (isAutoLoginTrue && authType === AuthType.TrustedAuthTokenCookieless) {
|
|
18918
|
+
const authToken = await getAuthenticationToken(this.embedConfig, forceRefresh);
|
|
18919
|
+
responder({
|
|
18920
|
+
type: eventType,
|
|
18921
|
+
data: { authToken },
|
|
18922
|
+
});
|
|
18923
|
+
}
|
|
18924
|
+
}
|
|
18847
18925
|
/**
|
|
18848
18926
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
18849
18927
|
* @param query
|
|
@@ -19462,7 +19540,7 @@ class TsEmbed {
|
|
|
19462
19540
|
* @param {any} data The payload to send with the message
|
|
19463
19541
|
* @returns A promise that resolves with the response from the embedded app
|
|
19464
19542
|
*/
|
|
19465
|
-
async trigger(messageType, data = {}) {
|
|
19543
|
+
async trigger(messageType, data = {}, context) {
|
|
19466
19544
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
19467
19545
|
if (!this.isRendered) {
|
|
19468
19546
|
this.handleError({
|
|
@@ -19489,7 +19567,7 @@ class TsEmbed {
|
|
|
19489
19567
|
return null;
|
|
19490
19568
|
}
|
|
19491
19569
|
// send an empty object, this is needed for liveboard default handlers
|
|
19492
|
-
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
19570
|
+
return this.hostEventClient.triggerHostEvent(messageType, data, context);
|
|
19493
19571
|
}
|
|
19494
19572
|
/**
|
|
19495
19573
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
@@ -19522,6 +19600,19 @@ class TsEmbed {
|
|
|
19522
19600
|
handleRenderForPrerender() {
|
|
19523
19601
|
return this.render();
|
|
19524
19602
|
}
|
|
19603
|
+
/**
|
|
19604
|
+
* Get the current context of the embedded TS component.
|
|
19605
|
+
* @returns The current context object containing the page type and object ids.
|
|
19606
|
+
* @version SDK: 1.45.2 | ThoughtSpot: 26.3.0.cl
|
|
19607
|
+
*/
|
|
19608
|
+
async getCurrentContext() {
|
|
19609
|
+
return new Promise((resolve) => {
|
|
19610
|
+
this.executeAfterEmbedContainerLoaded(async () => {
|
|
19611
|
+
const context = await this.trigger(HostEvent.GetPageContext, {});
|
|
19612
|
+
resolve(context);
|
|
19613
|
+
});
|
|
19614
|
+
});
|
|
19615
|
+
}
|
|
19525
19616
|
/**
|
|
19526
19617
|
* Creates the preRender shell
|
|
19527
19618
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
@@ -20671,7 +20762,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
20671
20762
|
* @param {any} data The payload to send with the message
|
|
20672
20763
|
* @returns A promise that resolves with the response from the embedded app
|
|
20673
20764
|
*/
|
|
20674
|
-
trigger(messageType, data = {}) {
|
|
20765
|
+
trigger(messageType, data = {}, context) {
|
|
20675
20766
|
const dataWithVizId = data;
|
|
20676
20767
|
if (messageType === HostEvent.SetActiveTab) {
|
|
20677
20768
|
this.setActiveTab(data);
|
|
@@ -20680,7 +20771,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
20680
20771
|
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
20681
20772
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
20682
20773
|
}
|
|
20683
|
-
return super.trigger(messageType, dataWithVizId);
|
|
20774
|
+
return super.trigger(messageType, dataWithVizId, context);
|
|
20684
20775
|
}
|
|
20685
20776
|
/**
|
|
20686
20777
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
@@ -22281,4 +22372,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
|
|
|
22281
22372
|
return result;
|
|
22282
22373
|
};
|
|
22283
22374
|
|
|
22284
|
-
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedErrorCodes, EmbedEvent, ErrorDetailsTypes, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, InterceptedApiType, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, reloadIframe, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|
|
22375
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ContextType, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedErrorCodes, EmbedEvent, ErrorDetailsTypes, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, InterceptedApiType, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, reloadIframe, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|