@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.es.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
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
@@ -1829,7 +1829,7 @@ var HostEvent;
|
|
|
1829
1829
|
* @param - autoDrillDown - Optional. If true, the drill down will be
|
|
1830
1830
|
* done automatically on the most popular column.
|
|
1831
1831
|
* @param - vizId [TS >= 9.8.0] - Optional. The GUID of the visualization to drill
|
|
1832
|
-
* in case of a
|
|
1832
|
+
* in case of a Liveboard.
|
|
1833
1833
|
* @example
|
|
1834
1834
|
* ```js
|
|
1835
1835
|
* searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
|
|
@@ -1916,26 +1916,26 @@ var HostEvent;
|
|
|
1916
1916
|
*/
|
|
1917
1917
|
HostEvent["SetActiveTab"] = "SetActiveTab";
|
|
1918
1918
|
/**
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
* filters.
|
|
1919
|
+
* Updates the runtime filters applied on a Liveboard. The filter
|
|
1920
|
+
* attributes passed with this event are appended to the existing runtime
|
|
1921
|
+
* filters applied on a Liveboard.
|
|
1922
|
+
*
|
|
1922
1923
|
* Pass an array of runtime filters with the following attributes:
|
|
1923
1924
|
*
|
|
1924
|
-
* `columnName`
|
|
1925
|
-
* _String_. The name of the column to filter on.
|
|
1925
|
+
* `columnName` - _String_. The name of the column to filter on.
|
|
1926
1926
|
*
|
|
1927
|
-
* `operator`
|
|
1928
|
-
* Runtime filter operator to apply. For information,
|
|
1927
|
+
* `operator` - Runtime filter operator to apply. For more information,
|
|
1929
1928
|
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
1930
1929
|
*
|
|
1931
|
-
* `values`
|
|
1932
|
-
*
|
|
1933
|
-
*
|
|
1930
|
+
* `values` - List of operands. Some operators such as EQ and LE allow a
|
|
1931
|
+
* single value, whereas BW and IN accept multiple values.
|
|
1932
|
+
*
|
|
1933
|
+
* **Note**: `HostEvent.UpdateRuntimeFilters` is supported in `LiveboardEmbed`
|
|
1934
|
+
* and `AppEmbed` only. In full application embedding, this event updates
|
|
1935
|
+
* the runtime filters applied on the Liveboard and saved Answer objects.
|
|
1934
1936
|
*
|
|
1935
|
-
* **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
|
|
1936
|
-
* Search embedding (SearchEmbed) and Natural Language Search
|
|
1937
|
-
* embedding (SageEmbed).
|
|
1938
1937
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
1938
|
+
*
|
|
1939
1939
|
* @example
|
|
1940
1940
|
* ```js
|
|
1941
1941
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
@@ -2634,7 +2634,7 @@ var HostEvent;
|
|
|
2634
2634
|
*/
|
|
2635
2635
|
HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
|
|
2636
2636
|
/**
|
|
2637
|
-
* Triggers Update
|
|
2637
|
+
* Triggers an event to Update Parameter values for Answers and Liveboard
|
|
2638
2638
|
* @example
|
|
2639
2639
|
* ```js
|
|
2640
2640
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
@@ -2656,7 +2656,7 @@ var HostEvent;
|
|
|
2656
2656
|
*/
|
|
2657
2657
|
HostEvent["GetParameters"] = "GetParameters";
|
|
2658
2658
|
/**
|
|
2659
|
-
* Triggers update
|
|
2659
|
+
* Triggers an event to update a persoanlised view of a Liveboard
|
|
2660
2660
|
* ```js
|
|
2661
2661
|
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
2662
2662
|
* ```
|
|
@@ -2672,7 +2672,7 @@ var HostEvent;
|
|
|
2672
2672
|
* EmbedApi
|
|
2673
2673
|
* @hidden
|
|
2674
2674
|
*/
|
|
2675
|
-
HostEvent["
|
|
2675
|
+
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2676
2676
|
})(HostEvent || (HostEvent = {}));
|
|
2677
2677
|
/**
|
|
2678
2678
|
* The different visual modes that the data sources panel within
|
|
@@ -3652,7 +3652,7 @@ var Action;
|
|
|
3652
3652
|
*/
|
|
3653
3653
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
3654
3654
|
/**
|
|
3655
|
-
* The **Move to Tab** menu action on visualizations in
|
|
3655
|
+
* The **Move to Tab** menu action on visualizations in Liveboard edit mode.
|
|
3656
3656
|
* Allows moving a visualization to a different tab.
|
|
3657
3657
|
* @example
|
|
3658
3658
|
* ```js
|
|
@@ -3705,7 +3705,8 @@ var Action;
|
|
|
3705
3705
|
*/
|
|
3706
3706
|
Action["TML"] = "tml";
|
|
3707
3707
|
/**
|
|
3708
|
-
* Action
|
|
3708
|
+
* Action ID for the create Liveboard option on the Liveboard list page
|
|
3709
|
+
* and Pin modal
|
|
3709
3710
|
* @example
|
|
3710
3711
|
* ```js
|
|
3711
3712
|
* hiddenAction: [Action.CreateLiveboard]
|
|
@@ -7160,7 +7161,7 @@ class AnswerService {
|
|
|
7160
7161
|
async getTML() {
|
|
7161
7162
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
7162
7163
|
const edoc = object[0].edoc;
|
|
7163
|
-
const YAML = await import('./index-
|
|
7164
|
+
const YAML = await import('./index-nWevLycs.js');
|
|
7164
7165
|
const parsedDoc = YAML.parse(edoc);
|
|
7165
7166
|
return {
|
|
7166
7167
|
answer: {
|
|
@@ -14503,7 +14504,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
14503
14504
|
return e;
|
|
14504
14505
|
}
|
|
14505
14506
|
|
|
14506
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14507
|
+
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={".":{"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,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};
|
|
14507
14508
|
|
|
14508
14509
|
/**
|
|
14509
14510
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14563,61 +14564,94 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14563
14564
|
});
|
|
14564
14565
|
}
|
|
14565
14566
|
|
|
14566
|
-
var
|
|
14567
|
-
(function (
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
})(
|
|
14567
|
+
var UIPassthroughEvent;
|
|
14568
|
+
(function (UIPassthroughEvent) {
|
|
14569
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14570
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14571
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14572
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14573
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14574
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14575
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
14575
14576
|
|
|
14576
14577
|
class HostEventClient {
|
|
14577
|
-
constructor(
|
|
14578
|
-
this.
|
|
14578
|
+
constructor(iFrame) {
|
|
14579
|
+
this.iFrame = iFrame;
|
|
14579
14580
|
}
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14581
|
+
/**
|
|
14582
|
+
* A wrapper over process trigger to
|
|
14583
|
+
* @param {HostEvent} message Host event to send
|
|
14584
|
+
* @param {any} data Data to send with the host event
|
|
14585
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14586
|
+
*/
|
|
14587
|
+
async processTrigger(message, data) {
|
|
14588
|
+
if (!this.iFrame) {
|
|
14589
|
+
throw new Error('Iframe element is not set');
|
|
14590
|
+
}
|
|
14591
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14592
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14586
14593
|
}
|
|
14587
|
-
async
|
|
14588
|
-
var _a, _b, _c;
|
|
14589
|
-
const response = (_b = (_a = (await this.
|
|
14594
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14595
|
+
var _a, _b, _c, _d;
|
|
14596
|
+
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];
|
|
14590
14597
|
if (!response) {
|
|
14591
14598
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14592
14599
|
// eslint-disable-next-line no-throw-literal
|
|
14593
14600
|
throw { error };
|
|
14594
14601
|
}
|
|
14595
|
-
const errors = response.error
|
|
14602
|
+
const errors = response.error
|
|
14603
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14604
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14596
14605
|
if (errors) {
|
|
14597
14606
|
// eslint-disable-next-line no-throw-literal
|
|
14598
|
-
throw { error:
|
|
14607
|
+
throw { error: errors };
|
|
14599
14608
|
}
|
|
14600
14609
|
return { ...response.value };
|
|
14601
14610
|
}
|
|
14602
|
-
async hostEventFallback(
|
|
14603
|
-
return processTrigger(
|
|
14611
|
+
async hostEventFallback(hostEvent, data) {
|
|
14612
|
+
return this.processTrigger(hostEvent, data);
|
|
14604
14613
|
}
|
|
14605
|
-
|
|
14614
|
+
/**
|
|
14615
|
+
* Setter for the iframe element used for host events
|
|
14616
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14617
|
+
*/
|
|
14618
|
+
setIframeElement(iFrame) {
|
|
14619
|
+
this.iFrame = iFrame;
|
|
14620
|
+
}
|
|
14621
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14622
|
+
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
14623
|
+
type: apiName,
|
|
14624
|
+
parameters,
|
|
14625
|
+
});
|
|
14626
|
+
return res;
|
|
14627
|
+
}
|
|
14628
|
+
async handlePinEvent(payload) {
|
|
14629
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14630
|
+
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
14631
|
+
}
|
|
14632
|
+
return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14633
|
+
}
|
|
14634
|
+
async handleSaveAnswerEvent(payload) {
|
|
14606
14635
|
var _a, _b, _c, _d;
|
|
14607
|
-
if (
|
|
14608
|
-
|
|
14636
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14637
|
+
// Save is the fallback for SaveAnswer
|
|
14638
|
+
return this.hostEventFallback(HostEvent.Save, payload);
|
|
14609
14639
|
}
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14640
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
14641
|
+
return {
|
|
14642
|
+
...data,
|
|
14643
|
+
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,
|
|
14644
|
+
};
|
|
14645
|
+
}
|
|
14646
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14647
|
+
switch (hostEvent) {
|
|
14648
|
+
case HostEvent.Pin:
|
|
14649
|
+
return this.handlePinEvent(payload);
|
|
14650
|
+
case HostEvent.SaveAnswer:
|
|
14651
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14652
|
+
default:
|
|
14653
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14616
14654
|
}
|
|
14617
|
-
// fallback for save answer is Save
|
|
14618
|
-
if (hostEvent === HostEvent.SaveAnswer)
|
|
14619
|
-
hostEvent = HostEvent.Save;
|
|
14620
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
14621
14655
|
}
|
|
14622
14656
|
}
|
|
14623
14657
|
|
|
@@ -14647,6 +14681,14 @@ const V1EventMap = {};
|
|
|
14647
14681
|
* React+GraphQL
|
|
14648
14682
|
*/
|
|
14649
14683
|
class TsEmbed {
|
|
14684
|
+
/**
|
|
14685
|
+
* Setter for the iframe element
|
|
14686
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14687
|
+
*/
|
|
14688
|
+
setIframeElement(iFrame) {
|
|
14689
|
+
this.iFrame = iFrame;
|
|
14690
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14691
|
+
}
|
|
14650
14692
|
constructor(domSelector, viewConfig) {
|
|
14651
14693
|
/**
|
|
14652
14694
|
* The key to store the embed instance in the DOM node
|
|
@@ -14775,7 +14817,7 @@ class TsEmbed {
|
|
|
14775
14817
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
14776
14818
|
...viewConfig,
|
|
14777
14819
|
});
|
|
14778
|
-
this.hostEventClient = new HostEventClient(this.
|
|
14820
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
14779
14821
|
}
|
|
14780
14822
|
/**
|
|
14781
14823
|
* Throws error encountered during initialization.
|
|
@@ -15096,7 +15138,7 @@ class TsEmbed {
|
|
|
15096
15138
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15097
15139
|
return;
|
|
15098
15140
|
}
|
|
15099
|
-
this.
|
|
15141
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15100
15142
|
this.iFrame.addEventListener('load', () => {
|
|
15101
15143
|
nextInQueue();
|
|
15102
15144
|
const loadTimestamp = Date.now();
|
|
@@ -15155,7 +15197,7 @@ class TsEmbed {
|
|
|
15155
15197
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15156
15198
|
this.isPreRendered = true;
|
|
15157
15199
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15158
|
-
this.
|
|
15200
|
+
this.setIframeElement(this.preRenderChild);
|
|
15159
15201
|
}
|
|
15160
15202
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15161
15203
|
this.isRendered = true;
|
|
@@ -15193,7 +15235,7 @@ class TsEmbed {
|
|
|
15193
15235
|
this.preRenderChild = preRenderChild;
|
|
15194
15236
|
this.preRenderWrapper = preRenderWrapper;
|
|
15195
15237
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15196
|
-
this.
|
|
15238
|
+
this.setIframeElement(preRenderChild);
|
|
15197
15239
|
}
|
|
15198
15240
|
this.insertedDomEl = preRenderWrapper;
|
|
15199
15241
|
if (this.showPreRenderByDefault) {
|
|
@@ -15392,11 +15434,11 @@ class TsEmbed {
|
|
|
15392
15434
|
}
|
|
15393
15435
|
/**
|
|
15394
15436
|
* Triggers an event to the embedded app
|
|
15395
|
-
* @param messageType The event type
|
|
15396
|
-
* @param data The payload to send with the message
|
|
15437
|
+
* @param {HostEvent} messageType The event type
|
|
15438
|
+
* @param {any} data The payload to send with the message
|
|
15397
15439
|
* @returns A promise that resolves with the response from the embedded app
|
|
15398
15440
|
*/
|
|
15399
|
-
trigger(messageType, data) {
|
|
15441
|
+
async trigger(messageType, data) {
|
|
15400
15442
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15401
15443
|
if (!this.isRendered) {
|
|
15402
15444
|
this.handleError('Please call render before triggering events');
|
|
@@ -15406,18 +15448,18 @@ class TsEmbed {
|
|
|
15406
15448
|
this.handleError('Host event type is undefined');
|
|
15407
15449
|
return null;
|
|
15408
15450
|
}
|
|
15409
|
-
return this.hostEventClient.
|
|
15451
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15410
15452
|
}
|
|
15411
15453
|
/**
|
|
15412
15454
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15413
|
-
* @param {
|
|
15414
|
-
* @param {
|
|
15415
|
-
* @returns {Promise<
|
|
15455
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15456
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15457
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15416
15458
|
* from the embedded app.
|
|
15417
15459
|
*/
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
return
|
|
15460
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15461
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15462
|
+
return response;
|
|
15421
15463
|
}
|
|
15422
15464
|
/**
|
|
15423
15465
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -15606,7 +15648,7 @@ class TsEmbed {
|
|
|
15606
15648
|
/**
|
|
15607
15649
|
* Returns the answerService which can be used to make arbitrary graphql calls on top
|
|
15608
15650
|
* session.
|
|
15609
|
-
* @param vizId [Optional] to get for a specific viz in case of a
|
|
15651
|
+
* @param vizId [Optional] to get for a specific viz in case of a Liveboard.
|
|
15610
15652
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
15611
15653
|
*/
|
|
15612
15654
|
async getAnswerService(vizId) {
|
|
@@ -16567,8 +16609,8 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
16567
16609
|
}
|
|
16568
16610
|
}
|
|
16569
16611
|
/**
|
|
16570
|
-
* Returns the full url of the
|
|
16571
|
-
* this
|
|
16612
|
+
* Returns the full url of the Liveboard/visualization which can be used to open
|
|
16613
|
+
* this Liveboard inside the full Thoughtspot application in a new tab.
|
|
16572
16614
|
* @returns url string
|
|
16573
16615
|
*/
|
|
16574
16616
|
getLiveboardUrl() {
|