@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.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) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -1720,7 +1720,7 @@
|
|
|
1720
1720
|
* @param - autoDrillDown - Optional. If true, the drill down will be
|
|
1721
1721
|
* done automatically on the most popular column.
|
|
1722
1722
|
* @param - vizId [TS >= 9.8.0] - Optional. The GUID of the visualization to drill
|
|
1723
|
-
* in case of a
|
|
1723
|
+
* in case of a Liveboard.
|
|
1724
1724
|
* @example
|
|
1725
1725
|
* ```js
|
|
1726
1726
|
* searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
|
|
@@ -1807,26 +1807,26 @@
|
|
|
1807
1807
|
*/
|
|
1808
1808
|
HostEvent["SetActiveTab"] = "SetActiveTab";
|
|
1809
1809
|
/**
|
|
1810
|
-
*
|
|
1811
|
-
*
|
|
1812
|
-
* filters.
|
|
1810
|
+
* Updates the runtime filters applied on a Liveboard. The filter
|
|
1811
|
+
* attributes passed with this event are appended to the existing runtime
|
|
1812
|
+
* filters applied on a Liveboard.
|
|
1813
|
+
*
|
|
1813
1814
|
* Pass an array of runtime filters with the following attributes:
|
|
1814
1815
|
*
|
|
1815
|
-
* `columnName`
|
|
1816
|
-
* _String_. The name of the column to filter on.
|
|
1816
|
+
* `columnName` - _String_. The name of the column to filter on.
|
|
1817
1817
|
*
|
|
1818
|
-
* `operator`
|
|
1819
|
-
* Runtime filter operator to apply. For information,
|
|
1818
|
+
* `operator` - Runtime filter operator to apply. For more information,
|
|
1820
1819
|
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
1821
1820
|
*
|
|
1822
|
-
* `values`
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1821
|
+
* `values` - List of operands. Some operators such as EQ and LE allow a
|
|
1822
|
+
* single value, whereas BW and IN accept multiple values.
|
|
1823
|
+
*
|
|
1824
|
+
* **Note**: `HostEvent.UpdateRuntimeFilters` is supported in `LiveboardEmbed`
|
|
1825
|
+
* and `AppEmbed` only. In full application embedding, this event updates
|
|
1826
|
+
* the runtime filters applied on the Liveboard and saved Answer objects.
|
|
1825
1827
|
*
|
|
1826
|
-
* **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
|
|
1827
|
-
* Search embedding (SearchEmbed) and Natural Language Search
|
|
1828
|
-
* embedding (SageEmbed).
|
|
1829
1828
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
1829
|
+
*
|
|
1830
1830
|
* @example
|
|
1831
1831
|
* ```js
|
|
1832
1832
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
@@ -2525,7 +2525,7 @@
|
|
|
2525
2525
|
*/
|
|
2526
2526
|
HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
|
|
2527
2527
|
/**
|
|
2528
|
-
* Triggers Update
|
|
2528
|
+
* Triggers an event to Update Parameter values for Answers and Liveboard
|
|
2529
2529
|
* @example
|
|
2530
2530
|
* ```js
|
|
2531
2531
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
@@ -2547,7 +2547,7 @@
|
|
|
2547
2547
|
*/
|
|
2548
2548
|
HostEvent["GetParameters"] = "GetParameters";
|
|
2549
2549
|
/**
|
|
2550
|
-
* Triggers update
|
|
2550
|
+
* Triggers an event to update a persoanlised view of a Liveboard
|
|
2551
2551
|
* ```js
|
|
2552
2552
|
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
2553
2553
|
* ```
|
|
@@ -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
|
|
@@ -3543,7 +3543,7 @@
|
|
|
3543
3543
|
*/
|
|
3544
3544
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
3545
3545
|
/**
|
|
3546
|
-
* The **Move to Tab** menu action on visualizations in
|
|
3546
|
+
* The **Move to Tab** menu action on visualizations in Liveboard edit mode.
|
|
3547
3547
|
* Allows moving a visualization to a different tab.
|
|
3548
3548
|
* @example
|
|
3549
3549
|
* ```js
|
|
@@ -3596,7 +3596,8 @@
|
|
|
3596
3596
|
*/
|
|
3597
3597
|
Action["TML"] = "tml";
|
|
3598
3598
|
/**
|
|
3599
|
-
* Action
|
|
3599
|
+
* Action ID for the create Liveboard option on the Liveboard list page
|
|
3600
|
+
* and Pin modal
|
|
3600
3601
|
* @example
|
|
3601
3602
|
* ```js
|
|
3602
3603
|
* hiddenAction: [Action.CreateLiveboard]
|
|
@@ -14445,7 +14446,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14445
14446
|
/**
|
|
14446
14447
|
* Initializes the Visual Embed SDK globally and perform
|
|
14447
14448
|
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
14448
|
-
* component like
|
|
14449
|
+
* component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
|
|
14449
14450
|
* to actually embed. That is handled internally.
|
|
14450
14451
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
14451
14452
|
* authentication mechanism and so on.
|
|
@@ -14751,7 +14752,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14751
14752
|
return e;
|
|
14752
14753
|
}
|
|
14753
14754
|
|
|
14754
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14755
|
+
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};
|
|
14755
14756
|
|
|
14756
14757
|
/**
|
|
14757
14758
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14811,61 +14812,94 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14811
14812
|
});
|
|
14812
14813
|
}
|
|
14813
14814
|
|
|
14814
|
-
exports.
|
|
14815
|
-
(function (
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
})(exports.
|
|
14815
|
+
exports.UIPassthroughEvent = void 0;
|
|
14816
|
+
(function (UIPassthroughEvent) {
|
|
14817
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14818
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14819
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14820
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14821
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14822
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14823
|
+
})(exports.UIPassthroughEvent || (exports.UIPassthroughEvent = {}));
|
|
14823
14824
|
|
|
14824
14825
|
class HostEventClient {
|
|
14825
|
-
constructor(
|
|
14826
|
-
this.
|
|
14826
|
+
constructor(iFrame) {
|
|
14827
|
+
this.iFrame = iFrame;
|
|
14827
14828
|
}
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14829
|
+
/**
|
|
14830
|
+
* A wrapper over process trigger to
|
|
14831
|
+
* @param {HostEvent} message Host event to send
|
|
14832
|
+
* @param {any} data Data to send with the host event
|
|
14833
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14834
|
+
*/
|
|
14835
|
+
async processTrigger(message, data) {
|
|
14836
|
+
if (!this.iFrame) {
|
|
14837
|
+
throw new Error('Iframe element is not set');
|
|
14838
|
+
}
|
|
14839
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14840
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14834
14841
|
}
|
|
14835
|
-
async
|
|
14836
|
-
var _a, _b, _c;
|
|
14837
|
-
const response = (_b = (_a = (await this.
|
|
14842
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14843
|
+
var _a, _b, _c, _d;
|
|
14844
|
+
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
14845
|
if (!response) {
|
|
14839
14846
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14840
14847
|
// eslint-disable-next-line no-throw-literal
|
|
14841
14848
|
throw { error };
|
|
14842
14849
|
}
|
|
14843
|
-
const errors = response.error
|
|
14850
|
+
const errors = response.error
|
|
14851
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14852
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14844
14853
|
if (errors) {
|
|
14845
14854
|
// eslint-disable-next-line no-throw-literal
|
|
14846
|
-
throw { error:
|
|
14855
|
+
throw { error: errors };
|
|
14847
14856
|
}
|
|
14848
14857
|
return { ...response.value };
|
|
14849
14858
|
}
|
|
14850
|
-
async hostEventFallback(
|
|
14851
|
-
return processTrigger(
|
|
14859
|
+
async hostEventFallback(hostEvent, data) {
|
|
14860
|
+
return this.processTrigger(hostEvent, data);
|
|
14852
14861
|
}
|
|
14853
|
-
|
|
14862
|
+
/**
|
|
14863
|
+
* Setter for the iframe element used for host events
|
|
14864
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14865
|
+
*/
|
|
14866
|
+
setIframeElement(iFrame) {
|
|
14867
|
+
this.iFrame = iFrame;
|
|
14868
|
+
}
|
|
14869
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14870
|
+
const res = await this.processTrigger(exports.HostEvent.UIPassthrough, {
|
|
14871
|
+
type: apiName,
|
|
14872
|
+
parameters,
|
|
14873
|
+
});
|
|
14874
|
+
return res;
|
|
14875
|
+
}
|
|
14876
|
+
async handlePinEvent(payload) {
|
|
14877
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14878
|
+
return this.hostEventFallback(exports.HostEvent.Pin, payload);
|
|
14879
|
+
}
|
|
14880
|
+
return this.handleHostEventWithParam(exports.UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14881
|
+
}
|
|
14882
|
+
async handleSaveAnswerEvent(payload) {
|
|
14854
14883
|
var _a, _b, _c, _d;
|
|
14855
|
-
if (
|
|
14856
|
-
|
|
14884
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14885
|
+
// Save is the fallback for SaveAnswer
|
|
14886
|
+
return this.hostEventFallback(exports.HostEvent.Save, payload);
|
|
14857
14887
|
}
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14888
|
+
const data = await this.handleHostEventWithParam(exports.UIPassthroughEvent.SaveAnswer, payload);
|
|
14889
|
+
return {
|
|
14890
|
+
...data,
|
|
14891
|
+
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,
|
|
14892
|
+
};
|
|
14893
|
+
}
|
|
14894
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14895
|
+
switch (hostEvent) {
|
|
14896
|
+
case exports.HostEvent.Pin:
|
|
14897
|
+
return this.handlePinEvent(payload);
|
|
14898
|
+
case exports.HostEvent.SaveAnswer:
|
|
14899
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14900
|
+
default:
|
|
14901
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14864
14902
|
}
|
|
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
14903
|
}
|
|
14870
14904
|
}
|
|
14871
14905
|
|
|
@@ -14895,6 +14929,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14895
14929
|
* React+GraphQL
|
|
14896
14930
|
*/
|
|
14897
14931
|
class TsEmbed {
|
|
14932
|
+
/**
|
|
14933
|
+
* Setter for the iframe element
|
|
14934
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14935
|
+
*/
|
|
14936
|
+
setIframeElement(iFrame) {
|
|
14937
|
+
this.iFrame = iFrame;
|
|
14938
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14939
|
+
}
|
|
14898
14940
|
constructor(domSelector, viewConfig) {
|
|
14899
14941
|
/**
|
|
14900
14942
|
* The key to store the embed instance in the DOM node
|
|
@@ -15023,7 +15065,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15023
15065
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15024
15066
|
...viewConfig,
|
|
15025
15067
|
});
|
|
15026
|
-
this.hostEventClient = new HostEventClient(this.
|
|
15068
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15027
15069
|
}
|
|
15028
15070
|
/**
|
|
15029
15071
|
* Throws error encountered during initialization.
|
|
@@ -15344,7 +15386,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15344
15386
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15345
15387
|
return;
|
|
15346
15388
|
}
|
|
15347
|
-
this.
|
|
15389
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15348
15390
|
this.iFrame.addEventListener('load', () => {
|
|
15349
15391
|
nextInQueue();
|
|
15350
15392
|
const loadTimestamp = Date.now();
|
|
@@ -15403,7 +15445,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15403
15445
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15404
15446
|
this.isPreRendered = true;
|
|
15405
15447
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15406
|
-
this.
|
|
15448
|
+
this.setIframeElement(this.preRenderChild);
|
|
15407
15449
|
}
|
|
15408
15450
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15409
15451
|
this.isRendered = true;
|
|
@@ -15441,7 +15483,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15441
15483
|
this.preRenderChild = preRenderChild;
|
|
15442
15484
|
this.preRenderWrapper = preRenderWrapper;
|
|
15443
15485
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15444
|
-
this.
|
|
15486
|
+
this.setIframeElement(preRenderChild);
|
|
15445
15487
|
}
|
|
15446
15488
|
this.insertedDomEl = preRenderWrapper;
|
|
15447
15489
|
if (this.showPreRenderByDefault) {
|
|
@@ -15640,11 +15682,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15640
15682
|
}
|
|
15641
15683
|
/**
|
|
15642
15684
|
* Triggers an event to the embedded app
|
|
15643
|
-
* @param messageType The event type
|
|
15644
|
-
* @param data The payload to send with the message
|
|
15685
|
+
* @param {HostEvent} messageType The event type
|
|
15686
|
+
* @param {any} data The payload to send with the message
|
|
15645
15687
|
* @returns A promise that resolves with the response from the embedded app
|
|
15646
15688
|
*/
|
|
15647
|
-
trigger(messageType, data) {
|
|
15689
|
+
async trigger(messageType, data) {
|
|
15648
15690
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15649
15691
|
if (!this.isRendered) {
|
|
15650
15692
|
this.handleError('Please call render before triggering events');
|
|
@@ -15654,18 +15696,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15654
15696
|
this.handleError('Host event type is undefined');
|
|
15655
15697
|
return null;
|
|
15656
15698
|
}
|
|
15657
|
-
return this.hostEventClient.
|
|
15699
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15658
15700
|
}
|
|
15659
15701
|
/**
|
|
15660
15702
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15661
|
-
* @param {
|
|
15662
|
-
* @param {
|
|
15663
|
-
* @returns {Promise<
|
|
15703
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15704
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15705
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15664
15706
|
* from the embedded app.
|
|
15665
15707
|
*/
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
return
|
|
15708
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15709
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15710
|
+
return response;
|
|
15669
15711
|
}
|
|
15670
15712
|
/**
|
|
15671
15713
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -15854,7 +15896,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15854
15896
|
/**
|
|
15855
15897
|
* Returns the answerService which can be used to make arbitrary graphql calls on top
|
|
15856
15898
|
* session.
|
|
15857
|
-
* @param vizId [Optional] to get for a specific viz in case of a
|
|
15899
|
+
* @param vizId [Optional] to get for a specific viz in case of a Liveboard.
|
|
15858
15900
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
15859
15901
|
*/
|
|
15860
15902
|
async getAnswerService(vizId) {
|
|
@@ -16518,8 +16560,8 @@ query GetEurekaVizSnapshots(
|
|
|
16518
16560
|
}
|
|
16519
16561
|
}
|
|
16520
16562
|
/**
|
|
16521
|
-
* Returns the full url of the
|
|
16522
|
-
* this
|
|
16563
|
+
* Returns the full url of the Liveboard/visualization which can be used to open
|
|
16564
|
+
* this Liveboard inside the full Thoughtspot application in a new tab.
|
|
16523
16565
|
* @returns url string
|
|
16524
16566
|
*/
|
|
16525
16567
|
getLiveboardUrl() {
|