@thoughtspot/visual-embed-sdk 1.35.5-hostEvent.5 → 1.35.5-hostEvent.7
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 +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +10 -10
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +61 -27
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +43 -39
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +4 -2
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +13 -8
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +22 -14
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +4 -4
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.js +2 -2
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.js +2 -2
- package/cjs/src/types.d.ts +1 -1
- package/cjs/src/types.js +1 -1
- package/dist/index-DOIjN0N_.js +7370 -0
- package/dist/index-DaLHJaLd.js +7370 -0
- package/dist/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +13 -8
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/tsembed-react.es.js +95 -54
- package/dist/tsembed-react.js +94 -53
- package/dist/tsembed.es.js +96 -55
- package/dist/tsembed.js +94 -53
- package/dist/visual-embed-sdk-react-full.d.ts +61 -46
- package/dist/visual-embed-sdk-react.d.ts +61 -46
- package/dist/visual-embed-sdk.d.ts +61 -46
- package/lib/package.json +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +9 -9
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +63 -29
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +43 -40
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +4 -2
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +13 -8
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +22 -14
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +5 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +2 -2
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/types.d.ts +1 -1
- package/lib/src/types.js +1 -1
- package/lib/src/visual-embed-sdk.d.ts +64 -49
- package/package.json +1 -1
- package/src/embed/hostEventClient/contracts.ts +44 -33
- package/src/embed/hostEventClient/host-event-client.spec.ts +58 -54
- package/src/embed/hostEventClient/host-event-client.ts +109 -47
- package/src/embed/liveboard.spec.ts +4 -2
- package/src/embed/ts-embed.spec.ts +6 -6
- package/src/embed/ts-embed.ts +38 -27
- package/src/index.ts +2 -2
- package/src/react/all-types-export.ts +1 -1
- package/src/types.ts +1 -1
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.35.5-hostEvent.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.35.5-hostEvent.7 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -2563,7 +2563,7 @@
|
|
|
2563
2563
|
* EmbedApi
|
|
2564
2564
|
* @hidden
|
|
2565
2565
|
*/
|
|
2566
|
-
HostEvent["
|
|
2566
|
+
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2567
2567
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
2568
2568
|
/**
|
|
2569
2569
|
* The different visual modes that the data sources panel within
|
|
@@ -14751,7 +14751,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14751
14751
|
return e;
|
|
14752
14752
|
}
|
|
14753
14753
|
|
|
14754
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14754
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.7";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 . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.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 | coveralls","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={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","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":"^8.2.6","@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/lodash":"^4.17.0","@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",crypto:"^1.0.1","current-git-branch":"^1.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","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.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-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.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":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.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","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:"31 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};
|
|
14755
14755
|
|
|
14756
14756
|
/**
|
|
14757
14757
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14811,61 +14811,94 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14811
14811
|
});
|
|
14812
14812
|
}
|
|
14813
14813
|
|
|
14814
|
-
exports.
|
|
14815
|
-
(function (
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
})(exports.
|
|
14814
|
+
exports.UIPassthroughEvent = void 0;
|
|
14815
|
+
(function (UIPassthroughEvent) {
|
|
14816
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14817
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14818
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14819
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14820
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14821
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14822
|
+
})(exports.UIPassthroughEvent || (exports.UIPassthroughEvent = {}));
|
|
14823
14823
|
|
|
14824
14824
|
class HostEventClient {
|
|
14825
|
-
constructor(
|
|
14826
|
-
this.
|
|
14825
|
+
constructor(iFrame) {
|
|
14826
|
+
this.iFrame = iFrame;
|
|
14827
14827
|
}
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14828
|
+
/**
|
|
14829
|
+
* A wrapper over process trigger to
|
|
14830
|
+
* @param {HostEvent} message Host event to send
|
|
14831
|
+
* @param {any} data Data to send with the host event
|
|
14832
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14833
|
+
*/
|
|
14834
|
+
async processTrigger(message, data) {
|
|
14835
|
+
if (!this.iFrame) {
|
|
14836
|
+
throw new Error('Iframe element is not set');
|
|
14837
|
+
}
|
|
14838
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14839
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14834
14840
|
}
|
|
14835
|
-
async
|
|
14836
|
-
var _a, _b, _c;
|
|
14837
|
-
const response = (_b = (_a = (await this.
|
|
14841
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14842
|
+
var _a, _b, _c, _d;
|
|
14843
|
+
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];
|
|
14838
14844
|
if (!response) {
|
|
14839
14845
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14840
14846
|
// eslint-disable-next-line no-throw-literal
|
|
14841
14847
|
throw { error };
|
|
14842
14848
|
}
|
|
14843
|
-
const errors = response.error
|
|
14849
|
+
const errors = response.error
|
|
14850
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14851
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14844
14852
|
if (errors) {
|
|
14845
14853
|
// eslint-disable-next-line no-throw-literal
|
|
14846
14854
|
throw { error: response.error };
|
|
14847
14855
|
}
|
|
14848
14856
|
return { ...response.value };
|
|
14849
14857
|
}
|
|
14850
|
-
async hostEventFallback(
|
|
14851
|
-
return processTrigger(
|
|
14858
|
+
async hostEventFallback(hostEvent, data) {
|
|
14859
|
+
return this.processTrigger(hostEvent, data);
|
|
14860
|
+
}
|
|
14861
|
+
/**
|
|
14862
|
+
* Setter for the iframe element used for host events
|
|
14863
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14864
|
+
*/
|
|
14865
|
+
setIframeElement(iFrame) {
|
|
14866
|
+
this.iFrame = iFrame;
|
|
14867
|
+
}
|
|
14868
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14869
|
+
const res = await this.processTrigger(exports.HostEvent.UIPassthrough, {
|
|
14870
|
+
type: apiName,
|
|
14871
|
+
parameters,
|
|
14872
|
+
});
|
|
14873
|
+
return res;
|
|
14874
|
+
}
|
|
14875
|
+
async handlePinEvent(payload) {
|
|
14876
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14877
|
+
return this.hostEventFallback(exports.HostEvent.Pin, payload);
|
|
14878
|
+
}
|
|
14879
|
+
return this.handleHostEventWithParam(exports.UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14852
14880
|
}
|
|
14853
|
-
async
|
|
14881
|
+
async handleSaveAnswerEvent(payload) {
|
|
14854
14882
|
var _a, _b, _c, _d;
|
|
14855
|
-
if (
|
|
14856
|
-
|
|
14883
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14884
|
+
// Save is the fallback for SaveAnswer
|
|
14885
|
+
return this.hostEventFallback(exports.HostEvent.Save, payload);
|
|
14857
14886
|
}
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14887
|
+
const data = await this.handleHostEventWithParam(exports.UIPassthroughEvent.SaveAnswer, payload);
|
|
14888
|
+
return {
|
|
14889
|
+
...data,
|
|
14890
|
+
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,
|
|
14891
|
+
};
|
|
14892
|
+
}
|
|
14893
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14894
|
+
switch (hostEvent) {
|
|
14895
|
+
case exports.HostEvent.Pin:
|
|
14896
|
+
return this.handlePinEvent(payload);
|
|
14897
|
+
case exports.HostEvent.SaveAnswer:
|
|
14898
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14899
|
+
default:
|
|
14900
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14864
14901
|
}
|
|
14865
|
-
// fallback for save answer is Save
|
|
14866
|
-
if (hostEvent === exports.HostEvent.SaveAnswer)
|
|
14867
|
-
hostEvent = exports.HostEvent.Save;
|
|
14868
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
14869
14902
|
}
|
|
14870
14903
|
}
|
|
14871
14904
|
|
|
@@ -14895,6 +14928,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14895
14928
|
* React+GraphQL
|
|
14896
14929
|
*/
|
|
14897
14930
|
class TsEmbed {
|
|
14931
|
+
/**
|
|
14932
|
+
* Setter for the iframe element
|
|
14933
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14934
|
+
*/
|
|
14935
|
+
setIframeElement(iFrame) {
|
|
14936
|
+
this.iFrame = iFrame;
|
|
14937
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14938
|
+
}
|
|
14898
14939
|
constructor(domSelector, viewConfig) {
|
|
14899
14940
|
/**
|
|
14900
14941
|
* The key to store the embed instance in the DOM node
|
|
@@ -15023,7 +15064,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15023
15064
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15024
15065
|
...viewConfig,
|
|
15025
15066
|
});
|
|
15026
|
-
this.hostEventClient = new HostEventClient(this.
|
|
15067
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15027
15068
|
}
|
|
15028
15069
|
/**
|
|
15029
15070
|
* Throws error encountered during initialization.
|
|
@@ -15344,7 +15385,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15344
15385
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15345
15386
|
return;
|
|
15346
15387
|
}
|
|
15347
|
-
this.
|
|
15388
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15348
15389
|
this.iFrame.addEventListener('load', () => {
|
|
15349
15390
|
nextInQueue();
|
|
15350
15391
|
const loadTimestamp = Date.now();
|
|
@@ -15403,7 +15444,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15403
15444
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15404
15445
|
this.isPreRendered = true;
|
|
15405
15446
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15406
|
-
this.
|
|
15447
|
+
this.setIframeElement(this.preRenderChild);
|
|
15407
15448
|
}
|
|
15408
15449
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15409
15450
|
this.isRendered = true;
|
|
@@ -15441,7 +15482,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15441
15482
|
this.preRenderChild = preRenderChild;
|
|
15442
15483
|
this.preRenderWrapper = preRenderWrapper;
|
|
15443
15484
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15444
|
-
this.
|
|
15485
|
+
this.setIframeElement(preRenderChild);
|
|
15445
15486
|
}
|
|
15446
15487
|
this.insertedDomEl = preRenderWrapper;
|
|
15447
15488
|
if (this.showPreRenderByDefault) {
|
|
@@ -15640,11 +15681,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15640
15681
|
}
|
|
15641
15682
|
/**
|
|
15642
15683
|
* Triggers an event to the embedded app
|
|
15643
|
-
* @param messageType The event type
|
|
15644
|
-
* @param data The payload to send with the message
|
|
15684
|
+
* @param {HostEvent} messageType The event type
|
|
15685
|
+
* @param {any} data The payload to send with the message
|
|
15645
15686
|
* @returns A promise that resolves with the response from the embedded app
|
|
15646
15687
|
*/
|
|
15647
|
-
trigger(messageType, data) {
|
|
15688
|
+
async trigger(messageType, data) {
|
|
15648
15689
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15649
15690
|
if (!this.isRendered) {
|
|
15650
15691
|
this.handleError('Please call render before triggering events');
|
|
@@ -15654,18 +15695,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15654
15695
|
this.handleError('Host event type is undefined');
|
|
15655
15696
|
return null;
|
|
15656
15697
|
}
|
|
15657
|
-
return this.hostEventClient.
|
|
15698
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15658
15699
|
}
|
|
15659
15700
|
/**
|
|
15660
15701
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15661
|
-
* @param {
|
|
15662
|
-
* @param {
|
|
15663
|
-
* @returns {Promise<
|
|
15702
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15703
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15704
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15664
15705
|
* from the embedded app.
|
|
15665
15706
|
*/
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
return
|
|
15707
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15708
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15709
|
+
return response;
|
|
15669
15710
|
}
|
|
15670
15711
|
/**
|
|
15671
15712
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -259,7 +259,7 @@ export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<
|
|
|
259
259
|
* @summary ThoughtSpot Visual Embed SDK
|
|
260
260
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
261
261
|
*/
|
|
262
|
-
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload,
|
|
262
|
+
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload, UIPassthroughEvent, };
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
265
|
* @group Embed components
|
|
@@ -5313,7 +5313,7 @@ export declare enum HostEvent {
|
|
|
5313
5313
|
* EmbedApi
|
|
5314
5314
|
* @hidden
|
|
5315
5315
|
*/
|
|
5316
|
-
|
|
5316
|
+
UIPassthrough = "UiPassthrough"
|
|
5317
5317
|
}
|
|
5318
5318
|
/**
|
|
5319
5319
|
* The different visual modes that the data sources panel within
|
|
@@ -7326,16 +7326,16 @@ export declare const getAnswerFromQuery: (query: string, worksheetId: string) =>
|
|
|
7326
7326
|
*/
|
|
7327
7327
|
export declare const createLiveboardWithAnswers: (answers: AnswerService[], name: string) => Promise<any>;
|
|
7328
7328
|
|
|
7329
|
-
export declare enum
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7329
|
+
export declare enum UIPassthroughEvent {
|
|
7330
|
+
PinAnswerToLiveboard = "addVizToPinboard",
|
|
7331
|
+
SaveAnswer = "saveAnswer",
|
|
7332
|
+
GetDiscoverabilityStatus = "getDiscoverabilityStatus",
|
|
7333
|
+
GetAvailableUIPassthroughs = "getAvailableUIPassthroughs",
|
|
7334
|
+
GetAnswerConfig = "getAnswerPageConfig",
|
|
7335
|
+
GetLiveboardConfig = "getPinboardPageConfig"
|
|
7336
7336
|
}
|
|
7337
|
-
export type
|
|
7338
|
-
[
|
|
7337
|
+
export type UIPassthroughContractBase = {
|
|
7338
|
+
[UIPassthroughEvent.PinAnswerToLiveboard]: {
|
|
7339
7339
|
request: {
|
|
7340
7340
|
vizId?: string;
|
|
7341
7341
|
newVizName: string;
|
|
@@ -7351,62 +7351,58 @@ export type UiPassthroughContractBase = {
|
|
|
7351
7351
|
vizId: string;
|
|
7352
7352
|
};
|
|
7353
7353
|
};
|
|
7354
|
-
[
|
|
7354
|
+
[UIPassthroughEvent.SaveAnswer]: {
|
|
7355
7355
|
request: {
|
|
7356
7356
|
name: string;
|
|
7357
7357
|
description: string;
|
|
7358
|
-
vizId
|
|
7358
|
+
vizId?: string;
|
|
7359
7359
|
isDiscoverable?: boolean;
|
|
7360
7360
|
};
|
|
7361
7361
|
response: {
|
|
7362
7362
|
answerId: string;
|
|
7363
|
-
saveResponse
|
|
7363
|
+
saveResponse?: any;
|
|
7364
7364
|
shareResponse?: any;
|
|
7365
|
-
errors?: any;
|
|
7366
7365
|
};
|
|
7367
7366
|
};
|
|
7368
|
-
[
|
|
7367
|
+
[UIPassthroughEvent.GetDiscoverabilityStatus]: {
|
|
7369
7368
|
request: any;
|
|
7370
7369
|
response: {
|
|
7371
7370
|
shouldShowDiscoverability: boolean;
|
|
7372
7371
|
isDiscoverabilityCheckboxUnselectedPerOrg: boolean;
|
|
7373
7372
|
};
|
|
7374
7373
|
};
|
|
7375
|
-
[
|
|
7374
|
+
[UIPassthroughEvent.GetAvailableUIPassthroughs]: {
|
|
7376
7375
|
request: any;
|
|
7377
7376
|
response: {
|
|
7378
7377
|
keys: string[];
|
|
7379
7378
|
};
|
|
7380
7379
|
};
|
|
7381
|
-
[
|
|
7380
|
+
[UIPassthroughEvent.GetAnswerConfig]: {
|
|
7382
7381
|
request: {
|
|
7383
7382
|
vizId?: string;
|
|
7384
7383
|
};
|
|
7385
7384
|
response: any;
|
|
7386
7385
|
};
|
|
7387
|
-
[
|
|
7386
|
+
[UIPassthroughEvent.GetLiveboardConfig]: {
|
|
7388
7387
|
request: any;
|
|
7389
7388
|
response: any;
|
|
7390
7389
|
};
|
|
7391
7390
|
};
|
|
7392
|
-
export type
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
export type UiPassthroughRequest<T extends keyof UiPassthroughContractBase> = FlattenType<UiPassthroughContractBase[T]['request']>;
|
|
7396
|
-
export type UiPassthroughResponse<T extends keyof UiPassthroughContractBase> = FlattenType<UiPassthroughContractBase[T]['response']>;
|
|
7397
|
-
export type UiPassthroughArrayResponse<ApiName extends keyof UiPassthroughContractBase> = Promise<Array<{
|
|
7391
|
+
export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['request'];
|
|
7392
|
+
export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['response'];
|
|
7393
|
+
export type UIPassthroughArrayResponse<ApiName extends keyof UIPassthroughContractBase> = Array<{
|
|
7398
7394
|
redId?: string;
|
|
7399
|
-
value?:
|
|
7395
|
+
value?: UIPassthroughResponse<ApiName>;
|
|
7400
7396
|
error?: any;
|
|
7401
|
-
}
|
|
7397
|
+
}>;
|
|
7402
7398
|
export type EmbedApiHostEventMapping = {
|
|
7403
|
-
[HostEvent.Pin]:
|
|
7404
|
-
[HostEvent.SaveAnswer]:
|
|
7399
|
+
[HostEvent.Pin]: UIPassthroughEvent.PinAnswerToLiveboard;
|
|
7400
|
+
[HostEvent.SaveAnswer]: UIPassthroughEvent.SaveAnswer;
|
|
7405
7401
|
};
|
|
7406
|
-
export type HostEventRequest<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ?
|
|
7407
|
-
export type HostEventResponse<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ?
|
|
7408
|
-
|
|
7409
|
-
|
|
7402
|
+
export type HostEventRequest<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]> : any;
|
|
7403
|
+
export type HostEventResponse<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]> : any;
|
|
7404
|
+
export type TriggerPayload<PayloadT, HostEventT extends HostEvent> = PayloadT | HostEventRequest<HostEventT>;
|
|
7405
|
+
export type TriggerResponse<PayloadT, HostEventT extends HostEvent> = PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;
|
|
7410
7406
|
|
|
7411
7407
|
/**
|
|
7412
7408
|
*
|
|
@@ -7462,6 +7458,11 @@ export declare class TsEmbed {
|
|
|
7462
7458
|
* will be rendered.
|
|
7463
7459
|
*/
|
|
7464
7460
|
protected iFrame: HTMLIFrameElement;
|
|
7461
|
+
/**
|
|
7462
|
+
* Setter for the iframe element
|
|
7463
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
7464
|
+
*/
|
|
7465
|
+
protected setIframeElement(iFrame: HTMLIFrameElement): void;
|
|
7465
7466
|
protected viewConfig: ViewConfig;
|
|
7466
7467
|
protected embedConfig: EmbedConfig;
|
|
7467
7468
|
/**
|
|
@@ -7593,19 +7594,19 @@ export declare class TsEmbed {
|
|
|
7593
7594
|
off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
|
|
7594
7595
|
/**
|
|
7595
7596
|
* Triggers an event to the embedded app
|
|
7596
|
-
* @param messageType The event type
|
|
7597
|
-
* @param data The payload to send with the message
|
|
7597
|
+
* @param {HostEvent} messageType The event type
|
|
7598
|
+
* @param {any} data The payload to send with the message
|
|
7598
7599
|
* @returns A promise that resolves with the response from the embedded app
|
|
7599
7600
|
*/
|
|
7600
|
-
trigger<HostEventT extends HostEvent>(messageType: HostEventT, data?:
|
|
7601
|
+
trigger<HostEventT extends HostEvent, PayloadT>(messageType: HostEventT, data?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
|
|
7601
7602
|
/**
|
|
7602
7603
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
7603
|
-
* @param {
|
|
7604
|
-
* @param {
|
|
7605
|
-
* @returns {Promise<
|
|
7604
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
7605
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
7606
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
7606
7607
|
* from the embedded app.
|
|
7607
7608
|
*/
|
|
7608
|
-
|
|
7609
|
+
triggerUIPassThrough<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
|
|
7609
7610
|
/**
|
|
7610
7611
|
* Marks the ThoughtSpot object to have been rendered
|
|
7611
7612
|
* Needs to be overridden by subclasses to do the actual
|
|
@@ -7725,11 +7726,25 @@ export declare class V1Embed extends TsEmbed {
|
|
|
7725
7726
|
}
|
|
7726
7727
|
|
|
7727
7728
|
export declare class HostEventClient {
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7729
|
+
iFrame: HTMLIFrameElement;
|
|
7730
|
+
constructor(iFrame?: HTMLIFrameElement);
|
|
7731
|
+
/**
|
|
7732
|
+
* A wrapper over process trigger to
|
|
7733
|
+
* @param {HostEvent} message Host event to send
|
|
7734
|
+
* @param {any} data Data to send with the host event
|
|
7735
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
7736
|
+
*/
|
|
7737
|
+
protected processTrigger(message: HostEvent, data: any): Promise<any>;
|
|
7738
|
+
handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughResponse<UIPassthroughEventT>>;
|
|
7739
|
+
hostEventFallback(hostEvent: HostEvent, data: any): Promise<any>;
|
|
7740
|
+
/**
|
|
7741
|
+
* Setter for the iframe element used for host events
|
|
7742
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
7743
|
+
*/
|
|
7744
|
+
setIframeElement(iFrame: HTMLIFrameElement): void;
|
|
7745
|
+
triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
|
|
7746
|
+
protected handlePinEvent(payload: HostEventRequest<HostEvent.Pin>): Promise<HostEventResponse<HostEvent.Pin>>;
|
|
7747
|
+
protected handleSaveAnswerEvent(payload: HostEventRequest<HostEvent.SaveAnswer>): Promise<any>;
|
|
7748
|
+
triggerHostEvent<HostEventT extends HostEvent, PayloadT>(hostEvent: HostEventT, payload?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
|
|
7734
7749
|
}
|
|
7735
7750
|
|