@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.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
|
function _mergeNamespaces(n, m) {
|
|
3
3
|
m.forEach(function (e) {
|
|
4
4
|
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
@@ -1714,7 +1714,7 @@ var HostEvent;
|
|
|
1714
1714
|
* @param - autoDrillDown - Optional. If true, the drill down will be
|
|
1715
1715
|
* done automatically on the most popular column.
|
|
1716
1716
|
* @param - vizId [TS >= 9.8.0] - Optional. The GUID of the visualization to drill
|
|
1717
|
-
* in case of a
|
|
1717
|
+
* in case of a Liveboard.
|
|
1718
1718
|
* @example
|
|
1719
1719
|
* ```js
|
|
1720
1720
|
* searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
|
|
@@ -1801,26 +1801,26 @@ var HostEvent;
|
|
|
1801
1801
|
*/
|
|
1802
1802
|
HostEvent["SetActiveTab"] = "SetActiveTab";
|
|
1803
1803
|
/**
|
|
1804
|
-
*
|
|
1805
|
-
*
|
|
1806
|
-
* filters.
|
|
1804
|
+
* Updates the runtime filters applied on a Liveboard. The filter
|
|
1805
|
+
* attributes passed with this event are appended to the existing runtime
|
|
1806
|
+
* filters applied on a Liveboard.
|
|
1807
|
+
*
|
|
1807
1808
|
* Pass an array of runtime filters with the following attributes:
|
|
1808
1809
|
*
|
|
1809
|
-
* `columnName`
|
|
1810
|
-
* _String_. The name of the column to filter on.
|
|
1810
|
+
* `columnName` - _String_. The name of the column to filter on.
|
|
1811
1811
|
*
|
|
1812
|
-
* `operator`
|
|
1813
|
-
* Runtime filter operator to apply. For information,
|
|
1812
|
+
* `operator` - Runtime filter operator to apply. For more information,
|
|
1814
1813
|
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
1815
1814
|
*
|
|
1816
|
-
* `values`
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1815
|
+
* `values` - List of operands. Some operators such as EQ and LE allow a
|
|
1816
|
+
* single value, whereas BW and IN accept multiple values.
|
|
1817
|
+
*
|
|
1818
|
+
* **Note**: `HostEvent.UpdateRuntimeFilters` is supported in `LiveboardEmbed`
|
|
1819
|
+
* and `AppEmbed` only. In full application embedding, this event updates
|
|
1820
|
+
* the runtime filters applied on the Liveboard and saved Answer objects.
|
|
1819
1821
|
*
|
|
1820
|
-
* **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
|
|
1821
|
-
* Search embedding (SearchEmbed) and Natural Language Search
|
|
1822
|
-
* embedding (SageEmbed).
|
|
1823
1822
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
1823
|
+
*
|
|
1824
1824
|
* @example
|
|
1825
1825
|
* ```js
|
|
1826
1826
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
@@ -2519,7 +2519,7 @@ var HostEvent;
|
|
|
2519
2519
|
*/
|
|
2520
2520
|
HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
|
|
2521
2521
|
/**
|
|
2522
|
-
* Triggers Update
|
|
2522
|
+
* Triggers an event to Update Parameter values for Answers and Liveboard
|
|
2523
2523
|
* @example
|
|
2524
2524
|
* ```js
|
|
2525
2525
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
@@ -2541,7 +2541,7 @@ var HostEvent;
|
|
|
2541
2541
|
*/
|
|
2542
2542
|
HostEvent["GetParameters"] = "GetParameters";
|
|
2543
2543
|
/**
|
|
2544
|
-
* Triggers update
|
|
2544
|
+
* Triggers an event to update a persoanlised view of a Liveboard
|
|
2545
2545
|
* ```js
|
|
2546
2546
|
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
2547
2547
|
* ```
|
|
@@ -2557,7 +2557,7 @@ var HostEvent;
|
|
|
2557
2557
|
* EmbedApi
|
|
2558
2558
|
* @hidden
|
|
2559
2559
|
*/
|
|
2560
|
-
HostEvent["
|
|
2560
|
+
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2561
2561
|
})(HostEvent || (HostEvent = {}));
|
|
2562
2562
|
/**
|
|
2563
2563
|
* The different visual modes that the data sources panel within
|
|
@@ -3537,7 +3537,7 @@ var Action;
|
|
|
3537
3537
|
*/
|
|
3538
3538
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
3539
3539
|
/**
|
|
3540
|
-
* The **Move to Tab** menu action on visualizations in
|
|
3540
|
+
* The **Move to Tab** menu action on visualizations in Liveboard edit mode.
|
|
3541
3541
|
* Allows moving a visualization to a different tab.
|
|
3542
3542
|
* @example
|
|
3543
3543
|
* ```js
|
|
@@ -3590,7 +3590,8 @@ var Action;
|
|
|
3590
3590
|
*/
|
|
3591
3591
|
Action["TML"] = "tml";
|
|
3592
3592
|
/**
|
|
3593
|
-
* Action
|
|
3593
|
+
* Action ID for the create Liveboard option on the Liveboard list page
|
|
3594
|
+
* and Pin modal
|
|
3594
3595
|
* @example
|
|
3595
3596
|
* ```js
|
|
3596
3597
|
* hiddenAction: [Action.CreateLiveboard]
|
|
@@ -7059,7 +7060,7 @@ class AnswerService {
|
|
|
7059
7060
|
async getTML() {
|
|
7060
7061
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
7061
7062
|
const edoc = object[0].edoc;
|
|
7062
|
-
const YAML = await import('./index-
|
|
7063
|
+
const YAML = await import('./index-nWevLycs.js');
|
|
7063
7064
|
const parsedDoc = YAML.parse(edoc);
|
|
7064
7065
|
return {
|
|
7065
7066
|
answer: {
|
|
@@ -14439,7 +14440,7 @@ function backwardCompat(embedConfig) {
|
|
|
14439
14440
|
/**
|
|
14440
14441
|
* Initializes the Visual Embed SDK globally and perform
|
|
14441
14442
|
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
14442
|
-
* component like
|
|
14443
|
+
* component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
|
|
14443
14444
|
* to actually embed. That is handled internally.
|
|
14444
14445
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
14445
14446
|
* authentication mechanism and so on.
|
|
@@ -14745,7 +14746,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
14745
14746
|
return e;
|
|
14746
14747
|
}
|
|
14747
14748
|
|
|
14748
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14749
|
+
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};
|
|
14749
14750
|
|
|
14750
14751
|
/**
|
|
14751
14752
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14805,61 +14806,94 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14805
14806
|
});
|
|
14806
14807
|
}
|
|
14807
14808
|
|
|
14808
|
-
var
|
|
14809
|
-
(function (
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
})(
|
|
14809
|
+
var UIPassthroughEvent;
|
|
14810
|
+
(function (UIPassthroughEvent) {
|
|
14811
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14812
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14813
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14814
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14815
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14816
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14817
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
14817
14818
|
|
|
14818
14819
|
class HostEventClient {
|
|
14819
|
-
constructor(
|
|
14820
|
-
this.
|
|
14820
|
+
constructor(iFrame) {
|
|
14821
|
+
this.iFrame = iFrame;
|
|
14821
14822
|
}
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14823
|
+
/**
|
|
14824
|
+
* A wrapper over process trigger to
|
|
14825
|
+
* @param {HostEvent} message Host event to send
|
|
14826
|
+
* @param {any} data Data to send with the host event
|
|
14827
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14828
|
+
*/
|
|
14829
|
+
async processTrigger(message, data) {
|
|
14830
|
+
if (!this.iFrame) {
|
|
14831
|
+
throw new Error('Iframe element is not set');
|
|
14832
|
+
}
|
|
14833
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14834
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14828
14835
|
}
|
|
14829
|
-
async
|
|
14830
|
-
var _a, _b, _c;
|
|
14831
|
-
const response = (_b = (_a = (await this.
|
|
14836
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14837
|
+
var _a, _b, _c, _d;
|
|
14838
|
+
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];
|
|
14832
14839
|
if (!response) {
|
|
14833
14840
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14834
14841
|
// eslint-disable-next-line no-throw-literal
|
|
14835
14842
|
throw { error };
|
|
14836
14843
|
}
|
|
14837
|
-
const errors = response.error
|
|
14844
|
+
const errors = response.error
|
|
14845
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14846
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14838
14847
|
if (errors) {
|
|
14839
14848
|
// eslint-disable-next-line no-throw-literal
|
|
14840
|
-
throw { error:
|
|
14849
|
+
throw { error: errors };
|
|
14841
14850
|
}
|
|
14842
14851
|
return { ...response.value };
|
|
14843
14852
|
}
|
|
14844
|
-
async hostEventFallback(
|
|
14845
|
-
return processTrigger(
|
|
14853
|
+
async hostEventFallback(hostEvent, data) {
|
|
14854
|
+
return this.processTrigger(hostEvent, data);
|
|
14846
14855
|
}
|
|
14847
|
-
|
|
14856
|
+
/**
|
|
14857
|
+
* Setter for the iframe element used for host events
|
|
14858
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14859
|
+
*/
|
|
14860
|
+
setIframeElement(iFrame) {
|
|
14861
|
+
this.iFrame = iFrame;
|
|
14862
|
+
}
|
|
14863
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14864
|
+
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
14865
|
+
type: apiName,
|
|
14866
|
+
parameters,
|
|
14867
|
+
});
|
|
14868
|
+
return res;
|
|
14869
|
+
}
|
|
14870
|
+
async handlePinEvent(payload) {
|
|
14871
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14872
|
+
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
14873
|
+
}
|
|
14874
|
+
return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14875
|
+
}
|
|
14876
|
+
async handleSaveAnswerEvent(payload) {
|
|
14848
14877
|
var _a, _b, _c, _d;
|
|
14849
|
-
if (
|
|
14850
|
-
|
|
14878
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14879
|
+
// Save is the fallback for SaveAnswer
|
|
14880
|
+
return this.hostEventFallback(HostEvent.Save, payload);
|
|
14851
14881
|
}
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14882
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
14883
|
+
return {
|
|
14884
|
+
...data,
|
|
14885
|
+
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,
|
|
14886
|
+
};
|
|
14887
|
+
}
|
|
14888
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14889
|
+
switch (hostEvent) {
|
|
14890
|
+
case HostEvent.Pin:
|
|
14891
|
+
return this.handlePinEvent(payload);
|
|
14892
|
+
case HostEvent.SaveAnswer:
|
|
14893
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14894
|
+
default:
|
|
14895
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14858
14896
|
}
|
|
14859
|
-
// fallback for save answer is Save
|
|
14860
|
-
if (hostEvent === HostEvent.SaveAnswer)
|
|
14861
|
-
hostEvent = HostEvent.Save;
|
|
14862
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
14863
14897
|
}
|
|
14864
14898
|
}
|
|
14865
14899
|
|
|
@@ -14889,6 +14923,14 @@ const V1EventMap = {};
|
|
|
14889
14923
|
* React+GraphQL
|
|
14890
14924
|
*/
|
|
14891
14925
|
class TsEmbed {
|
|
14926
|
+
/**
|
|
14927
|
+
* Setter for the iframe element
|
|
14928
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14929
|
+
*/
|
|
14930
|
+
setIframeElement(iFrame) {
|
|
14931
|
+
this.iFrame = iFrame;
|
|
14932
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14933
|
+
}
|
|
14892
14934
|
constructor(domSelector, viewConfig) {
|
|
14893
14935
|
/**
|
|
14894
14936
|
* The key to store the embed instance in the DOM node
|
|
@@ -15017,7 +15059,7 @@ class TsEmbed {
|
|
|
15017
15059
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15018
15060
|
...viewConfig,
|
|
15019
15061
|
});
|
|
15020
|
-
this.hostEventClient = new HostEventClient(this.
|
|
15062
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15021
15063
|
}
|
|
15022
15064
|
/**
|
|
15023
15065
|
* Throws error encountered during initialization.
|
|
@@ -15338,7 +15380,7 @@ class TsEmbed {
|
|
|
15338
15380
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15339
15381
|
return;
|
|
15340
15382
|
}
|
|
15341
|
-
this.
|
|
15383
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15342
15384
|
this.iFrame.addEventListener('load', () => {
|
|
15343
15385
|
nextInQueue();
|
|
15344
15386
|
const loadTimestamp = Date.now();
|
|
@@ -15397,7 +15439,7 @@ class TsEmbed {
|
|
|
15397
15439
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15398
15440
|
this.isPreRendered = true;
|
|
15399
15441
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15400
|
-
this.
|
|
15442
|
+
this.setIframeElement(this.preRenderChild);
|
|
15401
15443
|
}
|
|
15402
15444
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15403
15445
|
this.isRendered = true;
|
|
@@ -15435,7 +15477,7 @@ class TsEmbed {
|
|
|
15435
15477
|
this.preRenderChild = preRenderChild;
|
|
15436
15478
|
this.preRenderWrapper = preRenderWrapper;
|
|
15437
15479
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15438
|
-
this.
|
|
15480
|
+
this.setIframeElement(preRenderChild);
|
|
15439
15481
|
}
|
|
15440
15482
|
this.insertedDomEl = preRenderWrapper;
|
|
15441
15483
|
if (this.showPreRenderByDefault) {
|
|
@@ -15634,11 +15676,11 @@ class TsEmbed {
|
|
|
15634
15676
|
}
|
|
15635
15677
|
/**
|
|
15636
15678
|
* Triggers an event to the embedded app
|
|
15637
|
-
* @param messageType The event type
|
|
15638
|
-
* @param data The payload to send with the message
|
|
15679
|
+
* @param {HostEvent} messageType The event type
|
|
15680
|
+
* @param {any} data The payload to send with the message
|
|
15639
15681
|
* @returns A promise that resolves with the response from the embedded app
|
|
15640
15682
|
*/
|
|
15641
|
-
trigger(messageType, data) {
|
|
15683
|
+
async trigger(messageType, data) {
|
|
15642
15684
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15643
15685
|
if (!this.isRendered) {
|
|
15644
15686
|
this.handleError('Please call render before triggering events');
|
|
@@ -15648,18 +15690,18 @@ class TsEmbed {
|
|
|
15648
15690
|
this.handleError('Host event type is undefined');
|
|
15649
15691
|
return null;
|
|
15650
15692
|
}
|
|
15651
|
-
return this.hostEventClient.
|
|
15693
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15652
15694
|
}
|
|
15653
15695
|
/**
|
|
15654
15696
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15655
|
-
* @param {
|
|
15656
|
-
* @param {
|
|
15657
|
-
* @returns {Promise<
|
|
15697
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15698
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15699
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15658
15700
|
* from the embedded app.
|
|
15659
15701
|
*/
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
return
|
|
15702
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15703
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15704
|
+
return response;
|
|
15663
15705
|
}
|
|
15664
15706
|
/**
|
|
15665
15707
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -15848,7 +15890,7 @@ class TsEmbed {
|
|
|
15848
15890
|
/**
|
|
15849
15891
|
* Returns the answerService which can be used to make arbitrary graphql calls on top
|
|
15850
15892
|
* session.
|
|
15851
|
-
* @param vizId [Optional] to get for a specific viz in case of a
|
|
15893
|
+
* @param vizId [Optional] to get for a specific viz in case of a Liveboard.
|
|
15852
15894
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
15853
15895
|
*/
|
|
15854
15896
|
async getAnswerService(vizId) {
|
|
@@ -16512,8 +16554,8 @@ class LiveboardEmbed extends V1Embed {
|
|
|
16512
16554
|
}
|
|
16513
16555
|
}
|
|
16514
16556
|
/**
|
|
16515
|
-
* Returns the full url of the
|
|
16516
|
-
* this
|
|
16557
|
+
* Returns the full url of the Liveboard/visualization which can be used to open
|
|
16558
|
+
* this Liveboard inside the full Thoughtspot application in a new tab.
|
|
16517
16559
|
* @returns url string
|
|
16518
16560
|
*/
|
|
16519
16561
|
getLiveboardUrl() {
|
|
@@ -17867,4 +17909,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
|
|
|
17867
17909
|
return result;
|
|
17868
17910
|
};
|
|
17869
17911
|
|
|
17870
|
-
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePageSearchBarMode, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed,
|
|
17912
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePageSearchBarMode, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|