@thoughtspot/visual-embed-sdk 1.10.0-alpha.3 → 1.10.0-alpha.4
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/README.md +21 -2
- package/dist/src/embed/app.d.ts +4 -2
- package/dist/src/embed/pinboard.d.ts +0 -6
- package/dist/src/types.d.ts +8 -1
- package/dist/tsembed.es.js +24 -7
- package/dist/tsembed.js +24 -7
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts +4 -2
- package/lib/src/embed/app.js +17 -7
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +36 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/pinboard.d.ts +0 -6
- package/lib/src/embed/pinboard.js +1 -4
- package/lib/src/embed/pinboard.js.map +1 -1
- package/lib/src/types.d.ts +8 -1
- package/lib/src/types.js +7 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/fetchAnswers.d.ts +3 -0
- package/lib/src/utils/fetchAnswers.js +49 -0
- package/lib/src/utils/fetchAnswers.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +12 -3
- package/package.json +1 -1
- package/src/embed/app.spec.ts +49 -1
- package/src/embed/app.ts +18 -6
- package/src/types.ts +7 -0
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +0 -19
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +0 -1
- package/lib/src/utils/plugin.js.map +0 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ The SDK is written in TypeScript and is also provided both as ES Module (ESM) an
|
|
|
25
25
|
```js
|
|
26
26
|
// ESM via NPM
|
|
27
27
|
import * as TsEmbedSDK from '@thoughtspot/visual-embed-sdk';
|
|
28
|
+
// OR
|
|
29
|
+
import { LiveboardEmbed } from '@thoughtspot/visual-embed-sdk';
|
|
28
30
|
|
|
29
31
|
// NPM <script>
|
|
30
32
|
<script src="https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.js"></script>;
|
|
@@ -41,7 +43,8 @@ import {
|
|
|
41
43
|
|
|
42
44
|
## Live Playground
|
|
43
45
|
|
|
44
|
-
Visit our [code playground](https://try-everywhere.thoughtspot.cloud/v2/#/everywhere).
|
|
46
|
+
Visit our [code playground](https://try-everywhere.thoughtspot.cloud/v2/#/everywhere). <br/><br/>
|
|
47
|
+
Start a [free trial](https://www.thoughtspot.com/trial?tsref=trialtse) on your own data.
|
|
45
48
|
|
|
46
49
|
<br/>
|
|
47
50
|
|
|
@@ -132,10 +135,26 @@ const appEmbed = new AppEmbed(document.getElementById('ts-embed'), {
|
|
|
132
135
|
appEmbed.render();
|
|
133
136
|
```
|
|
134
137
|
|
|
138
|
+
### Triggering and Listening to events
|
|
139
|
+
```js
|
|
140
|
+
// NPM
|
|
141
|
+
import { LiveboardEmbed, Page, AuthType, init, EmbedEvent, HostEvent } from '@thoughtspot/visual-embed-sdk';
|
|
142
|
+
|
|
143
|
+
// .. Do init and create a liveboardEmbed object as above.
|
|
144
|
+
|
|
145
|
+
liveboardEmbed.render();
|
|
146
|
+
|
|
147
|
+
liveboardEmbed.on(EmbedEvent.LiveboardRendered, () => {
|
|
148
|
+
liveboardEmbed.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
135
152
|
## React Components
|
|
136
153
|
|
|
137
154
|
All the above flavors of embedding are also provided as React components for your convenience.
|
|
138
155
|
The constructor options are passed as props and the event listeners can be attached using `on<EventName>` convention.
|
|
156
|
+
<br/><br/>
|
|
157
|
+
Checkout a comprehensive working demo [here](https://codesandbox.io/s/github/ashubham/big-react-demo)
|
|
139
158
|
|
|
140
159
|
### Search Component
|
|
141
160
|
|
|
@@ -166,7 +185,7 @@ const MyComponent = ({ dataSources }) => {
|
|
|
166
185
|
};
|
|
167
186
|
```
|
|
168
187
|
|
|
169
|
-
### Triggering events on React components
|
|
188
|
+
### Triggering events on React components (> version 1.9.2)
|
|
170
189
|
|
|
171
190
|
```jsx
|
|
172
191
|
import { HostEvent } from '@thoughtspot/visual-embed-sdk';
|
package/dist/src/embed/app.d.ts
CHANGED
|
@@ -118,10 +118,12 @@ export declare class AppEmbed extends V1Embed {
|
|
|
118
118
|
/**
|
|
119
119
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
120
120
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
121
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
121
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
122
122
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
123
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
124
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
123
125
|
*/
|
|
124
|
-
navigateToPage(path: string): void;
|
|
126
|
+
navigateToPage(path: string | number, noReload?: boolean): void;
|
|
125
127
|
/**
|
|
126
128
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
127
129
|
* @param renderOptions An object containing the page ID
|
|
@@ -45,12 +45,6 @@ export interface PinboardViewConfig extends ViewConfig {
|
|
|
45
45
|
* pinboard page will be read-only (no X buttons)
|
|
46
46
|
*/
|
|
47
47
|
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
48
|
}
|
|
55
49
|
/**
|
|
56
50
|
* Embed a ThoughtSpot pinboard or visualization
|
package/dist/src/types.d.ts
CHANGED
|
@@ -525,7 +525,14 @@ export declare enum HostEvent {
|
|
|
525
525
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
526
526
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
527
527
|
*/
|
|
528
|
-
UpdateRuntimeFilters = "UpdateRuntimeFilters"
|
|
528
|
+
UpdateRuntimeFilters = "UpdateRuntimeFilters",
|
|
529
|
+
/**
|
|
530
|
+
* Navigate to a specific page in App embed without any reload.
|
|
531
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
532
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
533
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
534
|
+
*/
|
|
535
|
+
Navigate = "Navigate"
|
|
529
536
|
}
|
|
530
537
|
/**
|
|
531
538
|
* The different visual modes that the data sources panel within
|
package/dist/tsembed.es.js
CHANGED
|
@@ -502,6 +502,13 @@ var HostEvent;
|
|
|
502
502
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
503
503
|
*/
|
|
504
504
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
505
|
+
/**
|
|
506
|
+
* Navigate to a specific page in App embed without any reload.
|
|
507
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
508
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
509
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
510
|
+
*/
|
|
511
|
+
HostEvent["Navigate"] = "Navigate";
|
|
505
512
|
})(HostEvent || (HostEvent = {}));
|
|
506
513
|
/**
|
|
507
514
|
* The different visual modes that the data sources panel within
|
|
@@ -9075,7 +9082,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
9075
9082
|
}
|
|
9076
9083
|
}
|
|
9077
9084
|
|
|
9078
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.
|
|
9085
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.4";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/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};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","@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/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","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","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.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","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,description:description,module:module,main:main,types:types,files:files,exports:exports,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};
|
|
9079
9086
|
|
|
9080
9087
|
/**
|
|
9081
9088
|
* Copyright (c) 2022
|
|
@@ -9688,19 +9695,29 @@ class AppEmbed extends V1Embed {
|
|
|
9688
9695
|
/**
|
|
9689
9696
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9690
9697
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9691
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
9698
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
9692
9699
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
9700
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
9701
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
9693
9702
|
*/
|
|
9694
|
-
navigateToPage(path) {
|
|
9695
|
-
if (this.iFrame) {
|
|
9703
|
+
navigateToPage(path, noReload = false) {
|
|
9704
|
+
if (!this.iFrame) {
|
|
9705
|
+
console.log('Please call render before invoking this method');
|
|
9706
|
+
return;
|
|
9707
|
+
}
|
|
9708
|
+
if (noReload) {
|
|
9709
|
+
this.trigger(HostEvent.Navigate, path);
|
|
9710
|
+
}
|
|
9711
|
+
else {
|
|
9712
|
+
if (typeof path !== 'string') {
|
|
9713
|
+
console.warn('Path can only by a string when triggered without noReload');
|
|
9714
|
+
return;
|
|
9715
|
+
}
|
|
9696
9716
|
const iframeSrc = this.iFrame.src;
|
|
9697
9717
|
const embedPath = '#/embed';
|
|
9698
9718
|
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9699
9719
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9700
9720
|
}
|
|
9701
|
-
else {
|
|
9702
|
-
console.log('Please call render before invoking this method');
|
|
9703
|
-
}
|
|
9704
9721
|
}
|
|
9705
9722
|
/**
|
|
9706
9723
|
* Renders the embedded application pages in the ThoughtSpot app.
|
package/dist/tsembed.js
CHANGED
|
@@ -483,6 +483,13 @@
|
|
|
483
483
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
484
484
|
*/
|
|
485
485
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
486
|
+
/**
|
|
487
|
+
* Navigate to a specific page in App embed without any reload.
|
|
488
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
489
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
490
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
491
|
+
*/
|
|
492
|
+
HostEvent["Navigate"] = "Navigate";
|
|
486
493
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
487
494
|
(function (DataSourceVisualMode) {
|
|
488
495
|
/**
|
|
@@ -9044,7 +9051,7 @@
|
|
|
9044
9051
|
}
|
|
9045
9052
|
}
|
|
9046
9053
|
|
|
9047
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.
|
|
9054
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.4";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/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};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","@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/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","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","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.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","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,description:description,module:module,main:main,types:types,files:files,exports:exports$1,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};
|
|
9048
9055
|
|
|
9049
9056
|
/**
|
|
9050
9057
|
* Copyright (c) 2022
|
|
@@ -9652,19 +9659,29 @@
|
|
|
9652
9659
|
/**
|
|
9653
9660
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9654
9661
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9655
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
9662
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
9656
9663
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
9664
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
9665
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
9657
9666
|
*/
|
|
9658
|
-
navigateToPage(path) {
|
|
9659
|
-
if (this.iFrame) {
|
|
9667
|
+
navigateToPage(path, noReload = false) {
|
|
9668
|
+
if (!this.iFrame) {
|
|
9669
|
+
console.log('Please call render before invoking this method');
|
|
9670
|
+
return;
|
|
9671
|
+
}
|
|
9672
|
+
if (noReload) {
|
|
9673
|
+
this.trigger(exports.HostEvent.Navigate, path);
|
|
9674
|
+
}
|
|
9675
|
+
else {
|
|
9676
|
+
if (typeof path !== 'string') {
|
|
9677
|
+
console.warn('Path can only by a string when triggered without noReload');
|
|
9678
|
+
return;
|
|
9679
|
+
}
|
|
9660
9680
|
const iframeSrc = this.iFrame.src;
|
|
9661
9681
|
const embedPath = '#/embed';
|
|
9662
9682
|
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9663
9683
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9664
9684
|
}
|
|
9665
|
-
else {
|
|
9666
|
-
console.log('Please call render before invoking this method');
|
|
9667
|
-
}
|
|
9668
9685
|
}
|
|
9669
9686
|
/**
|
|
9670
9687
|
* Renders the embedded application pages in the ThoughtSpot app.
|
package/lib/package.json
CHANGED
package/lib/src/embed/app.d.ts
CHANGED
|
@@ -118,10 +118,12 @@ export declare class AppEmbed extends V1Embed {
|
|
|
118
118
|
/**
|
|
119
119
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
120
120
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
121
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
121
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
122
122
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
123
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
124
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
123
125
|
*/
|
|
124
|
-
navigateToPage(path: string): void;
|
|
126
|
+
navigateToPage(path: string | number, noReload?: boolean): void;
|
|
125
127
|
/**
|
|
126
128
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
127
129
|
* @param renderOptions An object containing the page ID
|
package/lib/src/embed/app.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
10
|
*/
|
|
11
11
|
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
12
|
-
import { Param } from '../types';
|
|
12
|
+
import { Param, HostEvent } from '../types';
|
|
13
13
|
import { V1Embed } from './ts-embed';
|
|
14
14
|
/**
|
|
15
15
|
* Pages within the ThoughtSpot app that can be embedded.
|
|
@@ -128,19 +128,29 @@ export class AppEmbed extends V1Embed {
|
|
|
128
128
|
/**
|
|
129
129
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
130
130
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
131
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
131
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
132
132
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
133
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
134
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
133
135
|
*/
|
|
134
|
-
navigateToPage(path) {
|
|
135
|
-
if (this.iFrame) {
|
|
136
|
+
navigateToPage(path, noReload = false) {
|
|
137
|
+
if (!this.iFrame) {
|
|
138
|
+
console.log('Please call render before invoking this method');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (noReload) {
|
|
142
|
+
this.trigger(HostEvent.Navigate, path);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
if (typeof path !== 'string') {
|
|
146
|
+
console.warn('Path can only by a string when triggered without noReload');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
136
149
|
const iframeSrc = this.iFrame.src;
|
|
137
150
|
const embedPath = '#/embed';
|
|
138
151
|
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
139
152
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
140
153
|
}
|
|
141
|
-
else {
|
|
142
|
-
console.log('Please call render before invoking this method');
|
|
143
|
-
}
|
|
144
154
|
}
|
|
145
155
|
/**
|
|
146
156
|
* Renders the embedded application pages in the ThoughtSpot app.
|
package/lib/src/embed/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/embed/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,KAAK,EAA8B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/embed/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAA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AAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppEmbed, Page } from './app';
|
|
2
2
|
import { init } from '../index';
|
|
3
|
-
import { Action, AuthType, RuntimeFilterOp } from '../types';
|
|
4
|
-
import { executeAfterWait, getDocumentBody, getIFrameSrc, getRootEl, } from '../test/test-utils';
|
|
3
|
+
import { Action, AuthType, HostEvent, RuntimeFilterOp } from '../types';
|
|
4
|
+
import { executeAfterWait, getDocumentBody, getIFrameSrc, getRootEl, getIFrameEl, } from '../test/test-utils';
|
|
5
5
|
import { version } from '../../package.json';
|
|
6
6
|
import * as config from '../config';
|
|
7
7
|
const defaultViewConfig = {
|
|
@@ -63,6 +63,7 @@ describe('App embed tests', () => {
|
|
|
63
63
|
[Page.Liveboards]: 'pinboards',
|
|
64
64
|
[Page.Data]: 'data/tables',
|
|
65
65
|
[Page.Home]: 'home',
|
|
66
|
+
[Page.SpotIQ]: 'insights/results',
|
|
66
67
|
};
|
|
67
68
|
const pageIds = Object.keys(pageRouteMap);
|
|
68
69
|
for (let i = 0; i < pageIds.length; i++) {
|
|
@@ -148,6 +149,39 @@ describe('App embed tests', () => {
|
|
|
148
149
|
appEmbed.navigateToPage(path);
|
|
149
150
|
expect(getIFrameSrc()).toBe(`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`);
|
|
150
151
|
});
|
|
152
|
+
test('navigateToPage with noReload should trigger the appropriate event', async () => {
|
|
153
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
154
|
+
frameParams: {
|
|
155
|
+
width: '100%',
|
|
156
|
+
height: '100%',
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
await appEmbed.render();
|
|
160
|
+
const iframe = getIFrameEl();
|
|
161
|
+
iframe.contentWindow.postMessage = jest.fn();
|
|
162
|
+
appEmbed.navigateToPage(path, true);
|
|
163
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(expect.objectContaining({
|
|
164
|
+
type: HostEvent.Navigate,
|
|
165
|
+
data: path,
|
|
166
|
+
}), `http://${thoughtSpotHost}`);
|
|
167
|
+
appEmbed.navigateToPage(-1, true);
|
|
168
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(expect.objectContaining({
|
|
169
|
+
type: HostEvent.Navigate,
|
|
170
|
+
data: -1,
|
|
171
|
+
}), `http://${thoughtSpotHost}`);
|
|
172
|
+
});
|
|
173
|
+
test('Do not allow number path without noReload in navigateToPage', async () => {
|
|
174
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
175
|
+
frameParams: {
|
|
176
|
+
width: '100%',
|
|
177
|
+
height: '100%',
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
await appEmbed.render();
|
|
181
|
+
spyOn(console, 'warn');
|
|
182
|
+
appEmbed.navigateToPage(-1);
|
|
183
|
+
expect(console.warn).toHaveBeenCalledWith('Path can only by a string when triggered without noReload');
|
|
184
|
+
});
|
|
151
185
|
test('navigateToPage function use before render', async () => {
|
|
152
186
|
spyOn(console, 'log');
|
|
153
187
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.spec.js","sourceRoot":"","sources":["../../../src/embed/app.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,IAAI,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"app.spec.js","sourceRoot":"","sources":["../../../src/embed/app.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,IAAI,EAAE,MAAM,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B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,oBAAoB,CACrC,2DAA2D,CAC9D,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;YACzD,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACtB,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,EAAE;gBACvC,WAAW,EAAE;oBACT,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;iBACjB;aACJ,CAAC,CAAC;YACH,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC9B,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAoB,CACpC,gDAAgD,CACnD,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -45,12 +45,6 @@ export interface PinboardViewConfig extends ViewConfig {
|
|
|
45
45
|
* pinboard page will be read-only (no X buttons)
|
|
46
46
|
*/
|
|
47
47
|
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
48
|
}
|
|
55
49
|
/**
|
|
56
50
|
* Embed a ThoughtSpot pinboard or visualization
|
|
@@ -46,7 +46,7 @@ export class PinboardEmbed extends V1Embed {
|
|
|
46
46
|
*/
|
|
47
47
|
getEmbedParams() {
|
|
48
48
|
const params = this.getBaseQueryParams();
|
|
49
|
-
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight,
|
|
49
|
+
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight, } = this.viewConfig;
|
|
50
50
|
if (fullHeight === true) {
|
|
51
51
|
params[Param.fullHeight] = true;
|
|
52
52
|
}
|
|
@@ -59,9 +59,6 @@ export class PinboardEmbed extends V1Embed {
|
|
|
59
59
|
if (preventPinboardFilterRemoval) {
|
|
60
60
|
params[Param.preventPinboardFilterRemoval] = true;
|
|
61
61
|
}
|
|
62
|
-
if (pinboardVisibleVizs) {
|
|
63
|
-
params[Param.PinboardVisibleVizs] = pinboardVisibleVizs;
|
|
64
|
-
}
|
|
65
62
|
params[Param.livedBoardEmbed] = true;
|
|
66
63
|
const queryParams = getQueryParamString(params, true);
|
|
67
64
|
return queryParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACH,UAAU,EAEV,KAAK,GAIR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACH,UAAU,EAEV,KAAK,GAIR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAuCjD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO;IAKtC,kDAAkD;IAClD,YAAY,WAAwB,EAAE,UAA8B;QAChE,KAAK,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAJ3B,kBAAa,GAAG,GAAG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,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjE;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -525,7 +525,14 @@ export declare enum HostEvent {
|
|
|
525
525
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
526
526
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
527
527
|
*/
|
|
528
|
-
UpdateRuntimeFilters = "UpdateRuntimeFilters"
|
|
528
|
+
UpdateRuntimeFilters = "UpdateRuntimeFilters",
|
|
529
|
+
/**
|
|
530
|
+
* Navigate to a specific page in App embed without any reload.
|
|
531
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
532
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
533
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
534
|
+
*/
|
|
535
|
+
Navigate = "Navigate"
|
|
529
536
|
}
|
|
530
537
|
/**
|
|
531
538
|
* The different visual modes that the data sources panel within
|
package/lib/src/types.js
CHANGED
|
@@ -381,6 +381,13 @@ export var HostEvent;
|
|
|
381
381
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
382
382
|
*/
|
|
383
383
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
384
|
+
/**
|
|
385
|
+
* Navigate to a specific page in App embed without any reload.
|
|
386
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
387
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
388
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
389
|
+
*/
|
|
390
|
+
HostEvent["Navigate"] = "Navigate";
|
|
384
391
|
})(HostEvent || (HostEvent = {}));
|
|
385
392
|
/**
|
|
386
393
|
* The different visual modes that the data sources panel within
|
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;AAkKD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,eAyDX;AAzDD,WAAY,eAAe;IACvB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,8CAA2B,CAAA;IAC3B;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;AACb,CAAC,EAzDW,eAAe,KAAf,eAAe,QAyD1B;AAsBD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,UAkOX;AAlOD,WAAY,UAAU;IAClB;;;OAGG;IACH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,CAAA;IACvB;;;OAGG;IACH,iCAAmB,CAAA;IACnB;;;OAGG;IACH,qCAAuB,CAAA;IACvB;;;OAGG;IACH,uCAAyB,CAAA;IACzB;;;OAGG;IACH,qCAAuB,CAAA;IACvB;;;OAGG;IACH,uDAAyC,CAAA;IACzC;;;OAGG;IACH,yDAA2C,CAAA;AAC/C,CAAC,EAlOW,UAAU,KAAV,UAAU,QAkOrB;AAED;;;;;;GAMG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;AAkKD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,eAyDX;AAzDD,WAAY,eAAe;IACvB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,8CAA2B,CAAA;IAC3B;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;AACb,CAAC,EAzDW,eAAe,K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ACvB,iCAAuB,CAAA;IACvB,iCAAuB,CAAA;IACvB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,mCAAyB,CAAA;IACzB,uBAAa,CAAA;IACb,iCAAuB,CAAA;IACvB,2BAAiB,CAAA;IACjB;;OAEG;IACH,6BAAmB,CAAA;IACnB;;OAEG;IACH,+BAAqB,CAAA;IACrB;;OAEG;IACH,2BAAiB,CAAA;IACjB;;OAEG;IACH,mDAAyC,CAAA;IACzC;;OAEG;IACH,uCAA6B,CAAA;IAC7B,wCAA8B,CAAA;IAC9B;;OAEG;IACH,6CAAmC,CAAA;IACnC;;OAEG;IACH,2DAAiD,CAAA;IACjD,qBAAW,CAAA;IACX;;OAEG;IACH,uCAA6B,CAAA;IAC7B,uCAA6B,CAAA;IAC7B,6BAAmB,CAAA;IACnB,oDAA0C,CAAA;IAC1C,oDAA0C,CAAA;IAC1C,iEAAuD,CAAA;IACvD,yDAA+C,CAAA;IAC/C;;OAEG;IACH,8CAAoC,CAAA;IACpC,wDAA8C,CAAA;IAC9C,mDAAyC,CAAA;IACzC;;OAEG;IACH,6BAAmB,CAAA;IACnB,yCAA+B,CAAA;IAC/B,qDAA2C,CAAA;IAC3C;;OAEG;IACH,yCAA+B,CAAA;IAC/B;;OAEG;IACH,qDAA2C,CAAA;IAC3C;;OAEG;IACH,2CAAiC,CAAA;IACjC;;OAEG;IACH,qCAA2B,CAAA;IAC3B;;OAEG;IACH,yCAA+B,CAAA;AACnC,CAAC,EAvIW,MAAM,KAAN,MAAM,QAuIjB;AAQD,qCAAqC;AACrC,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,sDAAqC,CAAA;IACrC,sEAAqD,CAAA;AACzD,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OperationType } from '../types';
|
|
2
|
+
function FetchAnswers(session, query, operation, thoughtSpotHost) {
|
|
3
|
+
let variable;
|
|
4
|
+
const fetchQuery = async (variables) => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operation}`, {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
headers: {
|
|
9
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
10
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11
|
+
accept: '*/*',
|
|
12
|
+
'accept-language': 'en-us',
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
operationName: operation,
|
|
16
|
+
query,
|
|
17
|
+
variables,
|
|
18
|
+
}),
|
|
19
|
+
credentials: 'include'
|
|
20
|
+
});
|
|
21
|
+
const result = await response.json();
|
|
22
|
+
return result.data;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (offset, batchSize) => {
|
|
29
|
+
if (operation === OperationType.GetChartWithData) {
|
|
30
|
+
variable = { batchSize, offset };
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
variable = {
|
|
34
|
+
dataPaginationParams: {
|
|
35
|
+
isClientPaginated: true,
|
|
36
|
+
offset,
|
|
37
|
+
size: batchSize,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return fetchQuery({
|
|
42
|
+
session,
|
|
43
|
+
...variable,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return getAnswer;
|
|
47
|
+
}
|
|
48
|
+
export default FetchAnswers;
|
|
49
|
+
//# sourceMappingURL=fetchAnswers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAnswers.js","sourceRoot":"","sources":["../../../src/utils/fetchAnswers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3D,SAAS,YAAY,CACjB,OAAyB,EACzB,KAAa,EACb,SAAiB,EACjB,eAAuB;IAEvB,IAAI,QAAa,CAAC;IAElB,MAAM,UAAU,GAAG,KAAK,EAAE,SAAc,EAAE,EAAE;QACxC,IAAI;YACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,eAAe,cAAc,SAAS,EAAE,EAC3C;gBACI,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACL,cAAc,EAAE,gCAAgC;oBAChD,gBAAgB,EAAE,aAAa;oBAC/B,MAAM,EAAE,KAAK;oBACb,iBAAiB,EAAE,OAAO;iBAC7B;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACjB,aAAa,EAAE,SAAS;oBACxB,KAAK;oBACL,SAAS;iBACZ,CAAC;gBACF,WAAW,EAAE,SAAS;aACzB,CACA,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACrC,OAAO,MAAM,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE;QACpD,IAAI,SAAS,KAAK,aAAa,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;SACpC;aAAM;YACH,QAAQ,GAAG;gBACP,oBAAoB,EAAE;oBAClB,iBAAiB,EAAE,IAAI;oBACvB,MAAM;oBACN,IAAI,EAAE,SAAS;iBAClB;aACJ,CAAC;SACL;QACD,OAAO,UAAU,CAAC;YACd,OAAO;YACP,GAAG,QAAQ;SACd,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -118,10 +118,12 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
|
|
|
118
118
|
/**
|
|
119
119
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
120
120
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
121
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
121
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
122
122
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
123
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
124
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
123
125
|
*/
|
|
124
|
-
navigateToPage(path: string): void;
|
|
126
|
+
navigateToPage(path: string | number, noReload?: boolean): void;
|
|
125
127
|
/**
|
|
126
128
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
127
129
|
* @param renderOptions An object containing the page ID
|
|
@@ -871,7 +873,14 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
871
873
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
872
874
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
873
875
|
*/
|
|
874
|
-
UpdateRuntimeFilters = "UpdateRuntimeFilters"
|
|
876
|
+
UpdateRuntimeFilters = "UpdateRuntimeFilters",
|
|
877
|
+
/**
|
|
878
|
+
* Navigate to a specific page in App embed without any reload.
|
|
879
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
880
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
881
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
882
|
+
*/
|
|
883
|
+
Navigate = "Navigate"
|
|
875
884
|
}
|
|
876
885
|
/**
|
|
877
886
|
* The different visual modes that the data sources panel within
|
package/package.json
CHANGED
package/src/embed/app.spec.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AppEmbed, AppViewConfig, Page } from './app';
|
|
2
2
|
import { init } from '../index';
|
|
3
|
-
import { Action, AuthType, RuntimeFilterOp } from '../types';
|
|
3
|
+
import { Action, AuthType, HostEvent, RuntimeFilterOp } from '../types';
|
|
4
4
|
import {
|
|
5
5
|
executeAfterWait,
|
|
6
6
|
getDocumentBody,
|
|
7
7
|
getIFrameSrc,
|
|
8
8
|
getRootEl,
|
|
9
|
+
getIFrameEl,
|
|
9
10
|
} from '../test/test-utils';
|
|
10
11
|
import { version } from '../../package.json';
|
|
11
12
|
import * as config from '../config';
|
|
@@ -82,6 +83,7 @@ describe('App embed tests', () => {
|
|
|
82
83
|
[Page.Liveboards]: 'pinboards',
|
|
83
84
|
[Page.Data]: 'data/tables',
|
|
84
85
|
[Page.Home]: 'home',
|
|
86
|
+
[Page.SpotIQ]: 'insights/results',
|
|
85
87
|
};
|
|
86
88
|
|
|
87
89
|
const pageIds = Object.keys(pageRouteMap);
|
|
@@ -194,6 +196,52 @@ describe('App embed tests', () => {
|
|
|
194
196
|
);
|
|
195
197
|
});
|
|
196
198
|
|
|
199
|
+
test('navigateToPage with noReload should trigger the appropriate event', async () => {
|
|
200
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
201
|
+
frameParams: {
|
|
202
|
+
width: '100%',
|
|
203
|
+
height: '100%',
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
await appEmbed.render();
|
|
207
|
+
|
|
208
|
+
const iframe = getIFrameEl();
|
|
209
|
+
iframe.contentWindow.postMessage = jest.fn();
|
|
210
|
+
appEmbed.navigateToPage(path, true);
|
|
211
|
+
|
|
212
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
213
|
+
expect.objectContaining({
|
|
214
|
+
type: HostEvent.Navigate,
|
|
215
|
+
data: path,
|
|
216
|
+
}),
|
|
217
|
+
`http://${thoughtSpotHost}`,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
appEmbed.navigateToPage(-1, true);
|
|
221
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
222
|
+
expect.objectContaining({
|
|
223
|
+
type: HostEvent.Navigate,
|
|
224
|
+
data: -1,
|
|
225
|
+
}),
|
|
226
|
+
`http://${thoughtSpotHost}`,
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('Do not allow number path without noReload in navigateToPage', async () => {
|
|
231
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
232
|
+
frameParams: {
|
|
233
|
+
width: '100%',
|
|
234
|
+
height: '100%',
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
await appEmbed.render();
|
|
238
|
+
spyOn(console, 'warn');
|
|
239
|
+
appEmbed.navigateToPage(-1);
|
|
240
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
241
|
+
'Path can only by a string when triggered without noReload',
|
|
242
|
+
);
|
|
243
|
+
});
|
|
244
|
+
|
|
197
245
|
test('navigateToPage function use before render', async () => {
|
|
198
246
|
spyOn(console, 'log');
|
|
199
247
|
const appEmbed = new AppEmbed(getRootEl(), {
|
package/src/embed/app.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
13
|
-
import { Param, RuntimeFilter, DOMSelector } from '../types';
|
|
13
|
+
import { Param, RuntimeFilter, DOMSelector, HostEvent } from '../types';
|
|
14
14
|
import { V1Embed, ViewConfig } from './ts-embed';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -194,19 +194,31 @@ export class AppEmbed extends V1Embed {
|
|
|
194
194
|
/**
|
|
195
195
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
196
196
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
197
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
197
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
198
198
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
199
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
200
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
199
201
|
*/
|
|
200
|
-
public navigateToPage(path: string): void {
|
|
201
|
-
if (this.iFrame) {
|
|
202
|
+
public navigateToPage(path: string | number, noReload = false): void {
|
|
203
|
+
if (!this.iFrame) {
|
|
204
|
+
console.log('Please call render before invoking this method');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (noReload) {
|
|
208
|
+
this.trigger(HostEvent.Navigate, path);
|
|
209
|
+
} else {
|
|
210
|
+
if (typeof path !== 'string') {
|
|
211
|
+
console.warn(
|
|
212
|
+
'Path can only by a string when triggered without noReload',
|
|
213
|
+
);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
202
216
|
const iframeSrc = this.iFrame.src;
|
|
203
217
|
const embedPath = '#/embed';
|
|
204
218
|
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
205
219
|
this.iFrame.src = `${
|
|
206
220
|
iframeSrc.split(currentPath)[0]
|
|
207
221
|
}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
208
|
-
} else {
|
|
209
|
-
console.log('Please call render before invoking this method');
|
|
210
222
|
}
|
|
211
223
|
}
|
|
212
224
|
|
package/src/types.ts
CHANGED
|
@@ -561,6 +561,13 @@ export enum HostEvent {
|
|
|
561
561
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
562
562
|
*/
|
|
563
563
|
UpdateRuntimeFilters = 'UpdateRuntimeFilters',
|
|
564
|
+
/**
|
|
565
|
+
* Navigate to a specific page in App embed without any reload.
|
|
566
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
567
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
568
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
569
|
+
*/
|
|
570
|
+
Navigate = 'Navigate',
|
|
564
571
|
}
|
|
565
572
|
|
|
566
573
|
/**
|
|
File without changes
|
package/dist/src/v1/api.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright: ThoughtSpot Inc. 2012-2016
|
|
3
|
-
* Author: Shashank Singh (sunny@thoughtspot.com)
|
|
4
|
-
*
|
|
5
|
-
* @fileoverview ThoughtSpot Javascript API for use of ThoughtSpot in external webpages.
|
|
6
|
-
*/
|
|
7
|
-
import { AuthType } from '../types';
|
|
8
|
-
export declare enum Events {
|
|
9
|
-
THOUGHTSPOT_AUTH_EXPIRED = "ThoughtspotAuthExpired",
|
|
10
|
-
EXPORT_VIZ_DATA_TO_PARENT = "exportVizDataToParent",
|
|
11
|
-
ALERT = "alert",
|
|
12
|
-
EXPORT_VIZ_DATA_TO_CHILD = "exportVizDataToChild",
|
|
13
|
-
GET_DATA = "getData"
|
|
14
|
-
}
|
|
15
|
-
declare type Callback = (...args: any[]) => void;
|
|
16
|
-
declare function checkIfLoggedIn(tsHost: string, callback: Callback): void;
|
|
17
|
-
declare function initialize(onInitialized: Callback, onAuthExpiration: Callback, _thoughtspotHost: string, authType: AuthType): void;
|
|
18
|
-
declare function notifyOnAuthExpiration(): void;
|
|
19
|
-
export { initialize, checkIfLoggedIn, notifyOnAuthExpiration };
|
|
File without changes
|
package/lib/src/utils/plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/utils/plugin.ts"],"names":[],"mappings":""}
|