@thoughtspot/visual-embed-sdk 1.35.5-hostEvent.6 → 1.35.5-hostEvent.8
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/app.d.ts +1 -1
- package/cjs/src/embed/base.d.ts +1 -1
- package/cjs/src/embed/base.js +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +26 -30
- 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 +62 -28
- 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.d.ts +8 -7
- 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 +4 -2
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +14 -9
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +23 -15
- 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 +26 -21
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +20 -19
- package/cjs/src/types.js.map +1 -1
- package/dist/index-DaLHJaLd.js +7370 -0
- package/dist/index-nWevLycs.js +7370 -0
- package/dist/src/embed/app.d.ts +1 -1
- package/dist/src/embed/base.d.ts +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +26 -30
- 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/liveboard.d.ts +8 -7
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +14 -9
- 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 +26 -21
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +118 -76
- package/dist/tsembed-react.js +117 -75
- package/dist/tsembed.es.js +120 -78
- package/dist/tsembed.js +118 -76
- package/dist/visual-embed-sdk-react-full.d.ts +96 -75
- package/dist/visual-embed-sdk-react.d.ts +96 -75
- package/dist/visual-embed-sdk.d.ts +96 -75
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts +1 -1
- package/lib/src/embed/base.d.ts +1 -1
- package/lib/src/embed/base.js +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +26 -30
- 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 +64 -30
- 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.d.ts +8 -7
- 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 +4 -2
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +14 -9
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +23 -15
- 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 +26 -21
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +20 -19
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +99 -78
- package/package.json +1 -1
- package/src/embed/app.ts +1 -1
- package/src/embed/base.ts +1 -1
- package/src/embed/hostEventClient/contracts.ts +43 -32
- package/src/embed/hostEventClient/host-event-client.spec.ts +58 -54
- package/src/embed/hostEventClient/host-event-client.ts +105 -48
- package/src/embed/liveboard.spec.ts +4 -2
- package/src/embed/liveboard.ts +8 -7
- package/src/embed/ts-embed.spec.ts +6 -6
- package/src/embed/ts-embed.ts +39 -28
- package/src/index.ts +2 -2
- package/src/react/all-types-export.ts +1 -1
- package/src/types.ts +26 -21
package/dist/tsembed-react.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.8 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -1851,7 +1851,7 @@
|
|
|
1851
1851
|
* @param - autoDrillDown - Optional. If true, the drill down will be
|
|
1852
1852
|
* done automatically on the most popular column.
|
|
1853
1853
|
* @param - vizId [TS >= 9.8.0] - Optional. The GUID of the visualization to drill
|
|
1854
|
-
* in case of a
|
|
1854
|
+
* in case of a Liveboard.
|
|
1855
1855
|
* @example
|
|
1856
1856
|
* ```js
|
|
1857
1857
|
* searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
|
|
@@ -1938,26 +1938,26 @@
|
|
|
1938
1938
|
*/
|
|
1939
1939
|
HostEvent["SetActiveTab"] = "SetActiveTab";
|
|
1940
1940
|
/**
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1943
|
-
* filters.
|
|
1941
|
+
* Updates the runtime filters applied on a Liveboard. The filter
|
|
1942
|
+
* attributes passed with this event are appended to the existing runtime
|
|
1943
|
+
* filters applied on a Liveboard.
|
|
1944
|
+
*
|
|
1944
1945
|
* Pass an array of runtime filters with the following attributes:
|
|
1945
1946
|
*
|
|
1946
|
-
* `columnName`
|
|
1947
|
-
* _String_. The name of the column to filter on.
|
|
1947
|
+
* `columnName` - _String_. The name of the column to filter on.
|
|
1948
1948
|
*
|
|
1949
|
-
* `operator`
|
|
1950
|
-
* Runtime filter operator to apply. For information,
|
|
1949
|
+
* `operator` - Runtime filter operator to apply. For more information,
|
|
1951
1950
|
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
1952
1951
|
*
|
|
1953
|
-
* `values`
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
1952
|
+
* `values` - List of operands. Some operators such as EQ and LE allow a
|
|
1953
|
+
* single value, whereas BW and IN accept multiple values.
|
|
1954
|
+
*
|
|
1955
|
+
* **Note**: `HostEvent.UpdateRuntimeFilters` is supported in `LiveboardEmbed`
|
|
1956
|
+
* and `AppEmbed` only. In full application embedding, this event updates
|
|
1957
|
+
* the runtime filters applied on the Liveboard and saved Answer objects.
|
|
1956
1958
|
*
|
|
1957
|
-
* **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
|
|
1958
|
-
* Search embedding (SearchEmbed) and Natural Language Search
|
|
1959
|
-
* embedding (SageEmbed).
|
|
1960
1959
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
1960
|
+
*
|
|
1961
1961
|
* @example
|
|
1962
1962
|
* ```js
|
|
1963
1963
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
@@ -2656,7 +2656,7 @@
|
|
|
2656
2656
|
*/
|
|
2657
2657
|
HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
|
|
2658
2658
|
/**
|
|
2659
|
-
* Triggers Update
|
|
2659
|
+
* Triggers an event to Update Parameter values for Answers and Liveboard
|
|
2660
2660
|
* @example
|
|
2661
2661
|
* ```js
|
|
2662
2662
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
@@ -2678,7 +2678,7 @@
|
|
|
2678
2678
|
*/
|
|
2679
2679
|
HostEvent["GetParameters"] = "GetParameters";
|
|
2680
2680
|
/**
|
|
2681
|
-
* Triggers update
|
|
2681
|
+
* Triggers an event to update a persoanlised view of a Liveboard
|
|
2682
2682
|
* ```js
|
|
2683
2683
|
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
2684
2684
|
* ```
|
|
@@ -2694,7 +2694,7 @@
|
|
|
2694
2694
|
* EmbedApi
|
|
2695
2695
|
* @hidden
|
|
2696
2696
|
*/
|
|
2697
|
-
HostEvent["
|
|
2697
|
+
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2698
2698
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
2699
2699
|
/**
|
|
2700
2700
|
* The different visual modes that the data sources panel within
|
|
@@ -3674,7 +3674,7 @@
|
|
|
3674
3674
|
*/
|
|
3675
3675
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
3676
3676
|
/**
|
|
3677
|
-
* The **Move to Tab** menu action on visualizations in
|
|
3677
|
+
* The **Move to Tab** menu action on visualizations in Liveboard edit mode.
|
|
3678
3678
|
* Allows moving a visualization to a different tab.
|
|
3679
3679
|
* @example
|
|
3680
3680
|
* ```js
|
|
@@ -3727,7 +3727,8 @@
|
|
|
3727
3727
|
*/
|
|
3728
3728
|
Action["TML"] = "tml";
|
|
3729
3729
|
/**
|
|
3730
|
-
* Action
|
|
3730
|
+
* Action ID for the create Liveboard option on the Liveboard list page
|
|
3731
|
+
* and Pin modal
|
|
3731
3732
|
* @example
|
|
3732
3733
|
* ```js
|
|
3733
3734
|
* hiddenAction: [Action.CreateLiveboard]
|
|
@@ -14525,7 +14526,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14525
14526
|
return e;
|
|
14526
14527
|
}
|
|
14527
14528
|
|
|
14528
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14529
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.8";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};
|
|
14529
14530
|
|
|
14530
14531
|
/**
|
|
14531
14532
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14585,61 +14586,94 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14585
14586
|
});
|
|
14586
14587
|
}
|
|
14587
14588
|
|
|
14588
|
-
var
|
|
14589
|
-
(function (
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
})(
|
|
14589
|
+
var UIPassthroughEvent;
|
|
14590
|
+
(function (UIPassthroughEvent) {
|
|
14591
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14592
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14593
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14594
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14595
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14596
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14597
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
14597
14598
|
|
|
14598
14599
|
class HostEventClient {
|
|
14599
|
-
constructor(
|
|
14600
|
-
this.
|
|
14600
|
+
constructor(iFrame) {
|
|
14601
|
+
this.iFrame = iFrame;
|
|
14601
14602
|
}
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14603
|
+
/**
|
|
14604
|
+
* A wrapper over process trigger to
|
|
14605
|
+
* @param {HostEvent} message Host event to send
|
|
14606
|
+
* @param {any} data Data to send with the host event
|
|
14607
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14608
|
+
*/
|
|
14609
|
+
async processTrigger(message, data) {
|
|
14610
|
+
if (!this.iFrame) {
|
|
14611
|
+
throw new Error('Iframe element is not set');
|
|
14612
|
+
}
|
|
14613
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14614
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14608
14615
|
}
|
|
14609
|
-
async
|
|
14610
|
-
var _a, _b, _c;
|
|
14611
|
-
const response = (_b = (_a = (await this.
|
|
14616
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14617
|
+
var _a, _b, _c, _d;
|
|
14618
|
+
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];
|
|
14612
14619
|
if (!response) {
|
|
14613
14620
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14614
14621
|
// eslint-disable-next-line no-throw-literal
|
|
14615
14622
|
throw { error };
|
|
14616
14623
|
}
|
|
14617
|
-
const errors = response.error
|
|
14624
|
+
const errors = response.error
|
|
14625
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14626
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14618
14627
|
if (errors) {
|
|
14619
14628
|
// eslint-disable-next-line no-throw-literal
|
|
14620
|
-
throw { error:
|
|
14629
|
+
throw { error: errors };
|
|
14621
14630
|
}
|
|
14622
14631
|
return { ...response.value };
|
|
14623
14632
|
}
|
|
14624
|
-
async hostEventFallback(
|
|
14625
|
-
return processTrigger(
|
|
14633
|
+
async hostEventFallback(hostEvent, data) {
|
|
14634
|
+
return this.processTrigger(hostEvent, data);
|
|
14626
14635
|
}
|
|
14627
|
-
|
|
14636
|
+
/**
|
|
14637
|
+
* Setter for the iframe element used for host events
|
|
14638
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14639
|
+
*/
|
|
14640
|
+
setIframeElement(iFrame) {
|
|
14641
|
+
this.iFrame = iFrame;
|
|
14642
|
+
}
|
|
14643
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14644
|
+
const res = await this.processTrigger(exports.HostEvent.UIPassthrough, {
|
|
14645
|
+
type: apiName,
|
|
14646
|
+
parameters,
|
|
14647
|
+
});
|
|
14648
|
+
return res;
|
|
14649
|
+
}
|
|
14650
|
+
async handlePinEvent(payload) {
|
|
14651
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14652
|
+
return this.hostEventFallback(exports.HostEvent.Pin, payload);
|
|
14653
|
+
}
|
|
14654
|
+
return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14655
|
+
}
|
|
14656
|
+
async handleSaveAnswerEvent(payload) {
|
|
14628
14657
|
var _a, _b, _c, _d;
|
|
14629
|
-
if (
|
|
14630
|
-
|
|
14658
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14659
|
+
// Save is the fallback for SaveAnswer
|
|
14660
|
+
return this.hostEventFallback(exports.HostEvent.Save, payload);
|
|
14631
14661
|
}
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14662
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
14663
|
+
return {
|
|
14664
|
+
...data,
|
|
14665
|
+
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,
|
|
14666
|
+
};
|
|
14667
|
+
}
|
|
14668
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14669
|
+
switch (hostEvent) {
|
|
14670
|
+
case exports.HostEvent.Pin:
|
|
14671
|
+
return this.handlePinEvent(payload);
|
|
14672
|
+
case exports.HostEvent.SaveAnswer:
|
|
14673
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14674
|
+
default:
|
|
14675
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14638
14676
|
}
|
|
14639
|
-
// fallback for save answer is Save
|
|
14640
|
-
if (hostEvent === exports.HostEvent.SaveAnswer)
|
|
14641
|
-
hostEvent = exports.HostEvent.Save;
|
|
14642
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
14643
14677
|
}
|
|
14644
14678
|
}
|
|
14645
14679
|
|
|
@@ -14669,6 +14703,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14669
14703
|
* React+GraphQL
|
|
14670
14704
|
*/
|
|
14671
14705
|
class TsEmbed {
|
|
14706
|
+
/**
|
|
14707
|
+
* Setter for the iframe element
|
|
14708
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14709
|
+
*/
|
|
14710
|
+
setIframeElement(iFrame) {
|
|
14711
|
+
this.iFrame = iFrame;
|
|
14712
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14713
|
+
}
|
|
14672
14714
|
constructor(domSelector, viewConfig) {
|
|
14673
14715
|
/**
|
|
14674
14716
|
* The key to store the embed instance in the DOM node
|
|
@@ -14797,7 +14839,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14797
14839
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
14798
14840
|
...viewConfig,
|
|
14799
14841
|
});
|
|
14800
|
-
this.hostEventClient = new HostEventClient(this.
|
|
14842
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
14801
14843
|
}
|
|
14802
14844
|
/**
|
|
14803
14845
|
* Throws error encountered during initialization.
|
|
@@ -15118,7 +15160,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15118
15160
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15119
15161
|
return;
|
|
15120
15162
|
}
|
|
15121
|
-
this.
|
|
15163
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15122
15164
|
this.iFrame.addEventListener('load', () => {
|
|
15123
15165
|
nextInQueue();
|
|
15124
15166
|
const loadTimestamp = Date.now();
|
|
@@ -15177,7 +15219,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15177
15219
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15178
15220
|
this.isPreRendered = true;
|
|
15179
15221
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15180
|
-
this.
|
|
15222
|
+
this.setIframeElement(this.preRenderChild);
|
|
15181
15223
|
}
|
|
15182
15224
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15183
15225
|
this.isRendered = true;
|
|
@@ -15215,7 +15257,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15215
15257
|
this.preRenderChild = preRenderChild;
|
|
15216
15258
|
this.preRenderWrapper = preRenderWrapper;
|
|
15217
15259
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15218
|
-
this.
|
|
15260
|
+
this.setIframeElement(preRenderChild);
|
|
15219
15261
|
}
|
|
15220
15262
|
this.insertedDomEl = preRenderWrapper;
|
|
15221
15263
|
if (this.showPreRenderByDefault) {
|
|
@@ -15414,11 +15456,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15414
15456
|
}
|
|
15415
15457
|
/**
|
|
15416
15458
|
* Triggers an event to the embedded app
|
|
15417
|
-
* @param messageType The event type
|
|
15418
|
-
* @param data The payload to send with the message
|
|
15459
|
+
* @param {HostEvent} messageType The event type
|
|
15460
|
+
* @param {any} data The payload to send with the message
|
|
15419
15461
|
* @returns A promise that resolves with the response from the embedded app
|
|
15420
15462
|
*/
|
|
15421
|
-
trigger(messageType, data) {
|
|
15463
|
+
async trigger(messageType, data) {
|
|
15422
15464
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15423
15465
|
if (!this.isRendered) {
|
|
15424
15466
|
this.handleError('Please call render before triggering events');
|
|
@@ -15428,18 +15470,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15428
15470
|
this.handleError('Host event type is undefined');
|
|
15429
15471
|
return null;
|
|
15430
15472
|
}
|
|
15431
|
-
return this.hostEventClient.
|
|
15473
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15432
15474
|
}
|
|
15433
15475
|
/**
|
|
15434
15476
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15435
|
-
* @param {
|
|
15436
|
-
* @param {
|
|
15437
|
-
* @returns {Promise<
|
|
15477
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15478
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15479
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15438
15480
|
* from the embedded app.
|
|
15439
15481
|
*/
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
return
|
|
15482
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15483
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15484
|
+
return response;
|
|
15443
15485
|
}
|
|
15444
15486
|
/**
|
|
15445
15487
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -15628,7 +15670,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15628
15670
|
/**
|
|
15629
15671
|
* Returns the answerService which can be used to make arbitrary graphql calls on top
|
|
15630
15672
|
* session.
|
|
15631
|
-
* @param vizId [Optional] to get for a specific viz in case of a
|
|
15673
|
+
* @param vizId [Optional] to get for a specific viz in case of a Liveboard.
|
|
15632
15674
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
15633
15675
|
*/
|
|
15634
15676
|
async getAnswerService(vizId) {
|
|
@@ -16589,8 +16631,8 @@ query GetEurekaVizSnapshots(
|
|
|
16589
16631
|
}
|
|
16590
16632
|
}
|
|
16591
16633
|
/**
|
|
16592
|
-
* Returns the full url of the
|
|
16593
|
-
* this
|
|
16634
|
+
* Returns the full url of the Liveboard/visualization which can be used to open
|
|
16635
|
+
* this Liveboard inside the full Thoughtspot application in a new tab.
|
|
16594
16636
|
* @returns url string
|
|
16595
16637
|
*/
|
|
16596
16638
|
getLiveboardUrl() {
|