@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-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.45.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.45.2 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
@@ -1867,6 +1867,18 @@
|
|
|
1867
1867
|
* @version SDK: 1.43.0 | ThoughtSpot: 10.15.0.cl
|
|
1868
1868
|
*/
|
|
1869
1869
|
EmbedEvent["ApiIntercept"] = "ApiIntercept";
|
|
1870
|
+
/**
|
|
1871
|
+
* @hidden
|
|
1872
|
+
* Emitted when the auth token is about to get expired and needs to be refreshed.
|
|
1873
|
+
* @example
|
|
1874
|
+
* ```js
|
|
1875
|
+
* embed.on(EmbedEvent.RefreshAuthToken, (payload) => {
|
|
1876
|
+
* console.log('payload', payload);
|
|
1877
|
+
* })
|
|
1878
|
+
* ```
|
|
1879
|
+
* @version SDK: 1.45.2 | ThoughtSpot: 26.3.0.cl
|
|
1880
|
+
*/
|
|
1881
|
+
EmbedEvent["RefreshAuthToken"] = "RefreshAuthToken";
|
|
1870
1882
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1871
1883
|
/**
|
|
1872
1884
|
* Event types that can be triggered by the host application
|
|
@@ -3250,6 +3262,17 @@
|
|
|
3250
3262
|
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
|
|
3251
3263
|
*/
|
|
3252
3264
|
HostEvent["StartNewSpotterConversation"] = "StartNewSpotterConversation";
|
|
3265
|
+
/**
|
|
3266
|
+
* @hidden
|
|
3267
|
+
* Get the current context of the embedded page.
|
|
3268
|
+
*
|
|
3269
|
+
* @example
|
|
3270
|
+
* ```js
|
|
3271
|
+
* const context = await liveboardEmbed.trigger(HostEvent.GetPageContext);
|
|
3272
|
+
* ```
|
|
3273
|
+
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
|
|
3274
|
+
*/
|
|
3275
|
+
HostEvent["GetPageContext"] = "GetPageContext";
|
|
3253
3276
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
3254
3277
|
/**
|
|
3255
3278
|
* The different visual modes that the data sources panel within
|
|
@@ -5035,6 +5058,25 @@
|
|
|
5035
5058
|
/** Failed to update embed parameters during pre-render */
|
|
5036
5059
|
EmbedErrorCodes["UPDATE_PARAMS_FAILED"] = "UPDATE_PARAMS_FAILED";
|
|
5037
5060
|
})(EmbedErrorCodes || (EmbedErrorCodes = {}));
|
|
5061
|
+
var ContextType;
|
|
5062
|
+
(function (ContextType) {
|
|
5063
|
+
/**
|
|
5064
|
+
* Search answer context for search page or edit viz dialog on liveboard page.
|
|
5065
|
+
*/
|
|
5066
|
+
ContextType["Search"] = "search-answer";
|
|
5067
|
+
/**
|
|
5068
|
+
* Liveboard context for liveboard page.
|
|
5069
|
+
*/
|
|
5070
|
+
ContextType["Liveboard"] = "liveboard";
|
|
5071
|
+
/**
|
|
5072
|
+
* Answer context for explore modal/page on liveboard page.
|
|
5073
|
+
*/
|
|
5074
|
+
ContextType["Answer"] = "answer";
|
|
5075
|
+
/**
|
|
5076
|
+
* Spotter context for spotter modal/page.
|
|
5077
|
+
*/
|
|
5078
|
+
ContextType["Spotter"] = "spotter";
|
|
5079
|
+
})(ContextType || (ContextType = {}));
|
|
5038
5080
|
/**
|
|
5039
5081
|
* Enum for the type of API intercepted
|
|
5040
5082
|
*/
|
|
@@ -5621,6 +5663,12 @@
|
|
|
5621
5663
|
return values[key] !== undefined ? String(values[key]) : match;
|
|
5622
5664
|
});
|
|
5623
5665
|
};
|
|
5666
|
+
const getHostEventsConfig = (viewConfig) => {
|
|
5667
|
+
return {
|
|
5668
|
+
shouldBypassPayloadValidation: viewConfig.shouldBypassPayloadValidation,
|
|
5669
|
+
useHostEventsV2: viewConfig.useHostEventsV2,
|
|
5670
|
+
};
|
|
5671
|
+
};
|
|
5624
5672
|
/**
|
|
5625
5673
|
* Check if the window is undefined
|
|
5626
5674
|
* If the window is undefined, it means the code is running in a SSR environment.
|
|
@@ -8044,11 +8092,11 @@
|
|
|
8044
8092
|
*
|
|
8045
8093
|
* @param embedConfig
|
|
8046
8094
|
*/
|
|
8047
|
-
async function getAuthenticationToken(embedConfig) {
|
|
8095
|
+
async function getAuthenticationToken(embedConfig, skipvalidation = false) {
|
|
8048
8096
|
const cachedAuthToken = getCacheAuthToken();
|
|
8049
8097
|
// Since we don't have token validation enabled , we cannot tell if the
|
|
8050
8098
|
// cached token is valid or not. So we will always fetch a new token.
|
|
8051
|
-
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
8099
|
+
if (cachedAuthToken && !embedConfig.disableTokenVerification && !skipvalidation) {
|
|
8052
8100
|
let isCachedTokenStillValid;
|
|
8053
8101
|
try {
|
|
8054
8102
|
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
@@ -17678,6 +17726,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17678
17726
|
* @param message
|
|
17679
17727
|
* @param message.type
|
|
17680
17728
|
* @param message.data
|
|
17729
|
+
* @param message.context
|
|
17681
17730
|
* @param thoughtSpotHost
|
|
17682
17731
|
* @param channel
|
|
17683
17732
|
*/
|
|
@@ -17692,8 +17741,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17692
17741
|
* @param messageType
|
|
17693
17742
|
* @param thoughtSpotHost
|
|
17694
17743
|
* @param data
|
|
17744
|
+
* @param context
|
|
17695
17745
|
*/
|
|
17696
|
-
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
17746
|
+
function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
17697
17747
|
return new Promise((res, rej) => {
|
|
17698
17748
|
var _a;
|
|
17699
17749
|
if (messageType === exports.HostEvent.Reload) {
|
|
@@ -17727,7 +17777,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17727
17777
|
channel.port1.close();
|
|
17728
17778
|
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
17729
17779
|
}, TRIGGER_TIMEOUT);
|
|
17730
|
-
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
17780
|
+
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
17731
17781
|
});
|
|
17732
17782
|
}
|
|
17733
17783
|
|
|
@@ -18073,7 +18123,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18073
18123
|
return eventData;
|
|
18074
18124
|
}
|
|
18075
18125
|
|
|
18076
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.45.
|
|
18126
|
+
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$1={".":{"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$1,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};
|
|
18077
18127
|
|
|
18078
18128
|
class HostEventClient {
|
|
18079
18129
|
constructor(iFrame) {
|
|
@@ -18085,16 +18135,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18085
18135
|
* @param {any} data Data to send with the host event
|
|
18086
18136
|
* @returns {Promise<any>} - the response from the process trigger
|
|
18087
18137
|
*/
|
|
18088
|
-
async processTrigger(message, data) {
|
|
18138
|
+
async processTrigger(message, data, context) {
|
|
18089
18139
|
if (!this.iFrame) {
|
|
18090
18140
|
throw new Error('Iframe element is not set');
|
|
18091
18141
|
}
|
|
18092
18142
|
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
18093
|
-
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
18143
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
|
|
18094
18144
|
}
|
|
18095
|
-
async handleHostEventWithParam(apiName, parameters) {
|
|
18145
|
+
async handleHostEventWithParam(apiName, parameters, context) {
|
|
18096
18146
|
var _a, _b, _c, _d;
|
|
18097
|
-
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];
|
|
18147
|
+
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];
|
|
18098
18148
|
if (!response) {
|
|
18099
18149
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
18100
18150
|
// eslint-disable-next-line no-throw-literal
|
|
@@ -18109,8 +18159,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18109
18159
|
}
|
|
18110
18160
|
return { ...response.value };
|
|
18111
18161
|
}
|
|
18112
|
-
async hostEventFallback(hostEvent, data) {
|
|
18113
|
-
return this.processTrigger(hostEvent, data);
|
|
18162
|
+
async hostEventFallback(hostEvent, data, context) {
|
|
18163
|
+
return this.processTrigger(hostEvent, data, context);
|
|
18114
18164
|
}
|
|
18115
18165
|
/**
|
|
18116
18166
|
* Setter for the iframe element used for host events
|
|
@@ -18119,49 +18169,49 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18119
18169
|
setIframeElement(iFrame) {
|
|
18120
18170
|
this.iFrame = iFrame;
|
|
18121
18171
|
}
|
|
18122
|
-
async triggerUIPassthroughApi(apiName, parameters) {
|
|
18172
|
+
async triggerUIPassthroughApi(apiName, parameters, context) {
|
|
18123
18173
|
const res = await this.processTrigger(exports.HostEvent.UIPassthrough, {
|
|
18124
18174
|
type: apiName,
|
|
18125
18175
|
parameters,
|
|
18126
|
-
});
|
|
18176
|
+
}, context);
|
|
18127
18177
|
return res;
|
|
18128
18178
|
}
|
|
18129
|
-
async handlePinEvent(payload) {
|
|
18179
|
+
async handlePinEvent(payload, context) {
|
|
18130
18180
|
var _a, _b;
|
|
18131
18181
|
if (!payload || !('newVizName' in payload)) {
|
|
18132
|
-
return this.hostEventFallback(exports.HostEvent.Pin, payload);
|
|
18182
|
+
return this.hostEventFallback(exports.HostEvent.Pin, payload, context);
|
|
18133
18183
|
}
|
|
18134
18184
|
const formattedPayload = {
|
|
18135
18185
|
...payload,
|
|
18136
18186
|
pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
|
|
18137
18187
|
newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
|
|
18138
18188
|
};
|
|
18139
|
-
const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
|
|
18189
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload, context);
|
|
18140
18190
|
return {
|
|
18141
18191
|
...data,
|
|
18142
18192
|
liveboardId: data.pinboardId,
|
|
18143
18193
|
};
|
|
18144
18194
|
}
|
|
18145
|
-
async handleSaveAnswerEvent(payload) {
|
|
18195
|
+
async handleSaveAnswerEvent(payload, context) {
|
|
18146
18196
|
var _a, _b, _c, _d;
|
|
18147
18197
|
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
18148
18198
|
// Save is the fallback for SaveAnswer
|
|
18149
|
-
return this.hostEventFallback(exports.HostEvent.Save, payload);
|
|
18199
|
+
return this.hostEventFallback(exports.HostEvent.Save, payload, context);
|
|
18150
18200
|
}
|
|
18151
|
-
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
18201
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload, context);
|
|
18152
18202
|
return {
|
|
18153
18203
|
...data,
|
|
18154
18204
|
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,
|
|
18155
18205
|
};
|
|
18156
18206
|
}
|
|
18157
|
-
async triggerHostEvent(hostEvent, payload) {
|
|
18207
|
+
async triggerHostEvent(hostEvent, payload, context) {
|
|
18158
18208
|
switch (hostEvent) {
|
|
18159
18209
|
case exports.HostEvent.Pin:
|
|
18160
|
-
return this.handlePinEvent(payload);
|
|
18210
|
+
return this.handlePinEvent(payload, context);
|
|
18161
18211
|
case exports.HostEvent.SaveAnswer:
|
|
18162
|
-
return this.handleSaveAnswerEvent(payload);
|
|
18212
|
+
return this.handleSaveAnswerEvent(payload, context);
|
|
18163
18213
|
default:
|
|
18164
|
-
return this.hostEventFallback(hostEvent, payload);
|
|
18214
|
+
return this.hostEventFallback(hostEvent, payload, context);
|
|
18165
18215
|
}
|
|
18166
18216
|
}
|
|
18167
18217
|
}
|
|
@@ -18422,31 +18472,39 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18422
18472
|
logger$3.error(`AppInit failed, Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
18423
18473
|
}
|
|
18424
18474
|
};
|
|
18475
|
+
this.handleAuthFailure = (error) => {
|
|
18476
|
+
logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
18477
|
+
processAuthFailure(error, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18478
|
+
};
|
|
18479
|
+
/**
|
|
18480
|
+
* Refresh the auth token if the autoLogin is true and the authType is TrustedAuthTokenCookieless
|
|
18481
|
+
* @param _
|
|
18482
|
+
* @param responder
|
|
18483
|
+
*/
|
|
18484
|
+
this.tokenRefresh = async (_, responder) => {
|
|
18485
|
+
try {
|
|
18486
|
+
await this.refreshAuthTokenForCookieless(responder, exports.EmbedEvent.RefreshAuthToken, true);
|
|
18487
|
+
}
|
|
18488
|
+
catch (e) {
|
|
18489
|
+
this.handleAuthFailure(e);
|
|
18490
|
+
}
|
|
18491
|
+
};
|
|
18425
18492
|
/**
|
|
18426
18493
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
18427
18494
|
* @param _
|
|
18428
18495
|
* @param responder
|
|
18429
18496
|
*/
|
|
18430
18497
|
this.updateAuthToken = async (_, responder) => {
|
|
18431
|
-
const { authType } = this.embedConfig;
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
responder({
|
|
18440
|
-
type: exports.EmbedEvent.AuthExpire,
|
|
18441
|
-
data: { authToken },
|
|
18442
|
-
});
|
|
18443
|
-
}
|
|
18444
|
-
catch (e) {
|
|
18445
|
-
logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
18446
|
-
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18447
|
-
}
|
|
18498
|
+
const { authType, autoLogin: autoLoginConfig } = this.embedConfig;
|
|
18499
|
+
// Default autoLogin: true for cookieless if undefined/null, otherwise false
|
|
18500
|
+
const autoLogin = autoLoginConfig !== null && autoLoginConfig !== void 0 ? autoLoginConfig : (authType === AuthType.TrustedAuthTokenCookieless);
|
|
18501
|
+
try {
|
|
18502
|
+
await this.refreshAuthTokenForCookieless(responder, exports.EmbedEvent.AuthExpire, false);
|
|
18503
|
+
}
|
|
18504
|
+
catch (e) {
|
|
18505
|
+
this.handleAuthFailure(e);
|
|
18448
18506
|
}
|
|
18449
|
-
|
|
18507
|
+
if (autoLogin && authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
18450
18508
|
handleAuth();
|
|
18451
18509
|
}
|
|
18452
18510
|
notifyAuthFailure(AuthFailureType.EXPIRY);
|
|
@@ -18467,8 +18525,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18467
18525
|
});
|
|
18468
18526
|
}
|
|
18469
18527
|
catch (e) {
|
|
18470
|
-
|
|
18471
|
-
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
18528
|
+
this.handleAuthFailure(e);
|
|
18472
18529
|
}
|
|
18473
18530
|
}).catch((e) => {
|
|
18474
18531
|
logger$3.error(`Auto Login failed, Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
@@ -18486,6 +18543,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18486
18543
|
this.on(exports.EmbedEvent.EmbedListenerReady, embedListenerReadyHandler, { start: false }, true);
|
|
18487
18544
|
const authInitHandler = this.createEmbedContainerHandler(exports.EmbedEvent.AuthInit);
|
|
18488
18545
|
this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
|
|
18546
|
+
this.on(exports.EmbedEvent.RefreshAuthToken, this.tokenRefresh, { start: false }, true);
|
|
18489
18547
|
};
|
|
18490
18548
|
this.showPreRenderByDefault = false;
|
|
18491
18549
|
/**
|
|
@@ -18795,13 +18853,33 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18795
18853
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
18796
18854
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
18797
18855
|
customActions: customActionsResult.actions,
|
|
18856
|
+
embedExpiryInAuthToken: this.viewConfig.refreshAuthTokenOnNearExpiry,
|
|
18798
18857
|
...getInterceptInitData(this.viewConfig),
|
|
18858
|
+
...getHostEventsConfig(this.viewConfig),
|
|
18799
18859
|
};
|
|
18800
18860
|
return baseInitData;
|
|
18801
18861
|
}
|
|
18802
18862
|
async getAppInitData() {
|
|
18803
18863
|
return this.getDefaultAppInitData();
|
|
18804
18864
|
}
|
|
18865
|
+
/**
|
|
18866
|
+
* Helper method to refresh/update auth token for TrustedAuthTokenCookieless auth type
|
|
18867
|
+
* @param responder - Function to send response back
|
|
18868
|
+
* @param eventType - The embed event type to send
|
|
18869
|
+
* @param forceRefresh - Whether to force refresh the token
|
|
18870
|
+
* @returns Promise that resolves if token was refreshed, rejects otherwise
|
|
18871
|
+
*/
|
|
18872
|
+
async refreshAuthTokenForCookieless(responder, eventType, forceRefresh = false) {
|
|
18873
|
+
const { authType, autoLogin } = this.embedConfig;
|
|
18874
|
+
const isAutoLoginTrue = autoLogin !== null && autoLogin !== void 0 ? autoLogin : (authType === AuthType.TrustedAuthTokenCookieless);
|
|
18875
|
+
if (isAutoLoginTrue && authType === AuthType.TrustedAuthTokenCookieless) {
|
|
18876
|
+
const authToken = await getAuthenticationToken(this.embedConfig, forceRefresh);
|
|
18877
|
+
responder({
|
|
18878
|
+
type: eventType,
|
|
18879
|
+
data: { authToken },
|
|
18880
|
+
});
|
|
18881
|
+
}
|
|
18882
|
+
}
|
|
18805
18883
|
/**
|
|
18806
18884
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
18807
18885
|
* @param query
|
|
@@ -19420,7 +19498,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19420
19498
|
* @param {any} data The payload to send with the message
|
|
19421
19499
|
* @returns A promise that resolves with the response from the embedded app
|
|
19422
19500
|
*/
|
|
19423
|
-
async trigger(messageType, data = {}) {
|
|
19501
|
+
async trigger(messageType, data = {}, context) {
|
|
19424
19502
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
19425
19503
|
if (!this.isRendered) {
|
|
19426
19504
|
this.handleError({
|
|
@@ -19447,7 +19525,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19447
19525
|
return null;
|
|
19448
19526
|
}
|
|
19449
19527
|
// send an empty object, this is needed for liveboard default handlers
|
|
19450
|
-
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
19528
|
+
return this.hostEventClient.triggerHostEvent(messageType, data, context);
|
|
19451
19529
|
}
|
|
19452
19530
|
/**
|
|
19453
19531
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
@@ -19480,6 +19558,19 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19480
19558
|
handleRenderForPrerender() {
|
|
19481
19559
|
return this.render();
|
|
19482
19560
|
}
|
|
19561
|
+
/**
|
|
19562
|
+
* Get the current context of the embedded TS component.
|
|
19563
|
+
* @returns The current context object containing the page type and object ids.
|
|
19564
|
+
* @version SDK: 1.45.2 | ThoughtSpot: 26.3.0.cl
|
|
19565
|
+
*/
|
|
19566
|
+
async getCurrentContext() {
|
|
19567
|
+
return new Promise((resolve) => {
|
|
19568
|
+
this.executeAfterEmbedContainerLoaded(async () => {
|
|
19569
|
+
const context = await this.trigger(exports.HostEvent.GetPageContext, {});
|
|
19570
|
+
resolve(context);
|
|
19571
|
+
});
|
|
19572
|
+
});
|
|
19573
|
+
}
|
|
19483
19574
|
/**
|
|
19484
19575
|
* Creates the preRender shell
|
|
19485
19576
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
@@ -20969,7 +21060,7 @@ query GetEurekaVizSnapshots(
|
|
|
20969
21060
|
* @param {any} data The payload to send with the message
|
|
20970
21061
|
* @returns A promise that resolves with the response from the embedded app
|
|
20971
21062
|
*/
|
|
20972
|
-
trigger(messageType, data = {}) {
|
|
21063
|
+
trigger(messageType, data = {}, context) {
|
|
20973
21064
|
const dataWithVizId = data;
|
|
20974
21065
|
if (messageType === exports.HostEvent.SetActiveTab) {
|
|
20975
21066
|
this.setActiveTab(data);
|
|
@@ -20978,7 +21069,7 @@ query GetEurekaVizSnapshots(
|
|
|
20978
21069
|
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
20979
21070
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
20980
21071
|
}
|
|
20981
|
-
return super.trigger(messageType, dataWithVizId);
|
|
21072
|
+
return super.trigger(messageType, dataWithVizId, context);
|
|
20982
21073
|
}
|
|
20983
21074
|
/**
|
|
20984
21075
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|