@thoughtspot/visual-embed-sdk 1.6.0-alpha.1 → 1.6.1
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 +8 -8
- package/dist/src/embed/app.d.ts +14 -3
- package/dist/src/embed/liveboard.d.ts +101 -0
- package/dist/src/embed/liveboard.spec.d.ts +1 -0
- package/dist/src/embed/pinboard.d.ts +6 -0
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/embed/ts-embed.d.ts +2 -11
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/react/index.d.ts +4 -3
- package/dist/src/types.d.ts +24 -20
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +87 -72
- package/dist/tsembed.js +86 -70
- package/lib/package.json +5 -1
- package/lib/src/embed/app.d.ts +14 -3
- package/lib/src/embed/app.js +25 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +32 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +55 -2
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +101 -0
- package/lib/src/embed/liveboard.js +115 -0
- package/lib/src/embed/liveboard.js.map +1 -0
- package/lib/src/embed/liveboard.spec.d.ts +1 -0
- package/lib/src/embed/liveboard.spec.js +159 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -0
- package/lib/src/embed/pinboard.d.ts +6 -0
- package/lib/src/embed/pinboard.js +4 -1
- package/lib/src/embed/pinboard.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +1 -1
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +4 -0
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +2 -11
- package/lib/src/embed/ts-embed.js +4 -23
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +63 -6
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -1
- package/lib/src/errors.js +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.d.ts +4 -3
- package/lib/src/react/index.js +3 -2
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +24 -20
- package/lib/src/types.js +21 -18
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +84 -58
- package/package.json +5 -1
- package/src/embed/app.spec.ts +41 -0
- package/src/embed/app.ts +28 -3
- package/src/embed/events.spec.ts +64 -5
- package/src/embed/liveboard.spec.ts +199 -0
- package/src/embed/{pinboard.ts → liveboard.ts} +60 -42
- package/src/embed/pinboard.spec.ts +11 -11
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.spec.ts +81 -8
- package/src/embed/ts-embed.ts +6 -25
- package/src/errors.ts +2 -2
- package/src/index.ts +7 -2
- package/src/react/index.tsx +14 -8
- package/src/types.ts +24 -20
package/dist/tsembed.es.js
CHANGED
|
@@ -230,12 +230,12 @@ var EmbedEvent;
|
|
|
230
230
|
*/
|
|
231
231
|
EmbedEvent["Load"] = "load";
|
|
232
232
|
/**
|
|
233
|
-
* Data pertaining to answer or
|
|
234
|
-
* @return data - The answer or
|
|
233
|
+
* Data pertaining to answer or Liveboard is received
|
|
234
|
+
* @return data - The answer or Liveboard data
|
|
235
235
|
*/
|
|
236
236
|
EmbedEvent["Data"] = "data";
|
|
237
237
|
/**
|
|
238
|
-
* Search/answer/
|
|
238
|
+
* Search/answer/Liveboard filters have been applied/updated
|
|
239
239
|
* @hidden
|
|
240
240
|
*/
|
|
241
241
|
EmbedEvent["FiltersChanged"] = "filtersChanged";
|
|
@@ -258,13 +258,13 @@ var EmbedEvent;
|
|
|
258
258
|
/**
|
|
259
259
|
* A custom action has been triggered
|
|
260
260
|
* @return actionId - The id of the custom action
|
|
261
|
-
* @return data - The answer or
|
|
261
|
+
* @return data - The answer or Liveboard data
|
|
262
262
|
*/
|
|
263
263
|
EmbedEvent["CustomAction"] = "customAction";
|
|
264
264
|
/**
|
|
265
265
|
* A double click has been triggered on table/chart
|
|
266
266
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
267
|
-
*
|
|
267
|
+
* @version 1.5.0 or later
|
|
268
268
|
*/
|
|
269
269
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
270
270
|
/**
|
|
@@ -282,8 +282,8 @@ var EmbedEvent;
|
|
|
282
282
|
*/
|
|
283
283
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
284
284
|
/**
|
|
285
|
-
* The height of the embedded
|
|
286
|
-
* @return data - The height of the embedded
|
|
285
|
+
* The height of the embedded Liveboard or visualization has been computed.
|
|
286
|
+
* @return data - The height of the embedded Liveboard or visualization
|
|
287
287
|
* @hidden
|
|
288
288
|
*/
|
|
289
289
|
EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
|
|
@@ -295,7 +295,6 @@ var EmbedEvent;
|
|
|
295
295
|
EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
|
|
296
296
|
/**
|
|
297
297
|
* Detects the route change.
|
|
298
|
-
* @hidden
|
|
299
298
|
*/
|
|
300
299
|
EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
|
|
301
300
|
/**
|
|
@@ -307,7 +306,7 @@ var EmbedEvent;
|
|
|
307
306
|
* Emitted when the embed does not have cookie access. This
|
|
308
307
|
* happens on Safari where third-party cookies are blocked by default.
|
|
309
308
|
*
|
|
310
|
-
* @version 1.1.0
|
|
309
|
+
* @version 1.1.0 or later
|
|
311
310
|
*/
|
|
312
311
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
313
312
|
/**
|
|
@@ -318,12 +317,12 @@ var EmbedEvent;
|
|
|
318
317
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
319
318
|
/**
|
|
320
319
|
* Emitted when any modal is opened in the app
|
|
321
|
-
*
|
|
320
|
+
* @version 1.6.0 or later
|
|
322
321
|
*/
|
|
323
322
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
324
323
|
/**
|
|
325
324
|
* Emitted when any modal is closed in the app
|
|
326
|
-
*
|
|
325
|
+
* @version 1.6.0 or later
|
|
327
326
|
*/
|
|
328
327
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
329
328
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
@@ -346,7 +345,7 @@ var HostEvent;
|
|
|
346
345
|
* eg. { selectedPoints: []}
|
|
347
346
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
348
347
|
* if not provided it will auto drill by the configured column. \
|
|
349
|
-
*
|
|
348
|
+
* @version 1.5.0 or later
|
|
350
349
|
*/
|
|
351
350
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
352
351
|
/**
|
|
@@ -360,10 +359,10 @@ var HostEvent;
|
|
|
360
359
|
*/
|
|
361
360
|
HostEvent["Reload"] = "reload";
|
|
362
361
|
/**
|
|
363
|
-
* Set the visible
|
|
364
|
-
* @param - an array of ids of
|
|
362
|
+
* Set the visible visualizations on a Liveboard.
|
|
363
|
+
* @param - an array of ids of visualizations to show, the ids not passed
|
|
365
364
|
* will be hidden.
|
|
366
|
-
*
|
|
365
|
+
* @version 1.6.0 or later
|
|
367
366
|
*/
|
|
368
367
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
369
368
|
})(HostEvent || (HostEvent = {}));
|
|
@@ -396,10 +395,11 @@ var Param;
|
|
|
396
395
|
(function (Param) {
|
|
397
396
|
Param["DataSources"] = "dataSources";
|
|
398
397
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
398
|
+
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
399
399
|
Param["DisableActions"] = "disableAction";
|
|
400
400
|
Param["DisableActionReason"] = "disableHint";
|
|
401
401
|
Param["ForceTable"] = "forceTable";
|
|
402
|
-
Param["
|
|
402
|
+
Param["preventLiveboardFilterRemoval"] = "preventPinboardFilterRemoval";
|
|
403
403
|
Param["SearchQuery"] = "searchQuery";
|
|
404
404
|
Param["HideActions"] = "hideAction";
|
|
405
405
|
Param["HideObjects"] = "hideObjects";
|
|
@@ -421,7 +421,7 @@ var Param;
|
|
|
421
421
|
})(Param || (Param = {}));
|
|
422
422
|
/**
|
|
423
423
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
424
|
-
* entities, such as answers and
|
|
424
|
+
* entities, such as answers and Liveboards.
|
|
425
425
|
*/
|
|
426
426
|
// eslint-disable-next-line no-shadow
|
|
427
427
|
var Action;
|
|
@@ -433,7 +433,6 @@ var Action;
|
|
|
433
433
|
Action["MakeACopy"] = "makeACopy";
|
|
434
434
|
Action["EditACopy"] = "editACopy";
|
|
435
435
|
Action["CopyLink"] = "embedDocument";
|
|
436
|
-
Action["PinboardSnapshot"] = "pinboardSnapshot";
|
|
437
436
|
Action["ResetLayout"] = "resetLayout";
|
|
438
437
|
Action["Schedule"] = "schedule";
|
|
439
438
|
Action["SchedulesList"] = "schedule-list";
|
|
@@ -466,7 +465,11 @@ var Action;
|
|
|
466
465
|
Action["Describe"] = "describe";
|
|
467
466
|
Action["Relate"] = "relate";
|
|
468
467
|
Action["CustomizeHeadlines"] = "customizeHeadlines";
|
|
468
|
+
/**
|
|
469
|
+
* @hidden
|
|
470
|
+
*/
|
|
469
471
|
Action["PinboardInfo"] = "pinboardInfo";
|
|
472
|
+
Action["LiveboardInfo"] = "pinboardInfo";
|
|
470
473
|
Action["SendAnswerFeedback"] = "sendFeedback";
|
|
471
474
|
/**
|
|
472
475
|
* @deprecated Will be removed in next version
|
|
@@ -496,7 +499,7 @@ var OperationType;
|
|
|
496
499
|
|
|
497
500
|
const ERROR_MESSAGE = {
|
|
498
501
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
499
|
-
|
|
502
|
+
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
500
503
|
};
|
|
501
504
|
|
|
502
505
|
/**
|
|
@@ -8837,7 +8840,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8837
8840
|
}
|
|
8838
8841
|
}
|
|
8839
8842
|
|
|
8840
|
-
var version="1.6.0-
|
|
8843
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.1";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/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",classnames:"^2.3.1","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};
|
|
8841
8844
|
|
|
8842
8845
|
/**
|
|
8843
8846
|
* Copyright (c) 2021
|
|
@@ -8847,6 +8850,7 @@ var version="1.6.0-alpha.1";
|
|
|
8847
8850
|
* @summary Base classes
|
|
8848
8851
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8849
8852
|
*/
|
|
8853
|
+
const { version: version$1 } = pkgInfo;
|
|
8850
8854
|
/**
|
|
8851
8855
|
* The event id map from v2 event names to v1 event id
|
|
8852
8856
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -8998,12 +9002,12 @@ class TsEmbed {
|
|
|
8998
9002
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
8999
9003
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
9000
9004
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9001
|
-
queryParams[Param.Version] = version;
|
|
9005
|
+
queryParams[Param.Version] = version$1;
|
|
9002
9006
|
if (this.embedConfig.customCssUrl) {
|
|
9003
9007
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
9004
9008
|
}
|
|
9005
9009
|
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, } = this.viewConfig;
|
|
9006
|
-
if ((visibleActions
|
|
9010
|
+
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
9007
9011
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
9008
9012
|
return queryParams;
|
|
9009
9013
|
}
|
|
@@ -9023,7 +9027,7 @@ class TsEmbed {
|
|
|
9023
9027
|
}
|
|
9024
9028
|
/**
|
|
9025
9029
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
9026
|
-
* This is used for embedding
|
|
9030
|
+
* This is used for embedding Liveboards, visualizations, and full application.
|
|
9027
9031
|
* @param queryString The query string to append to the URL.
|
|
9028
9032
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
9029
9033
|
* the full application.
|
|
@@ -9201,26 +9205,6 @@ class TsEmbed {
|
|
|
9201
9205
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
9202
9206
|
return this;
|
|
9203
9207
|
}
|
|
9204
|
-
/**
|
|
9205
|
-
* Navigates users to the specified application page.
|
|
9206
|
-
* Use this method to navigate users from the embedded
|
|
9207
|
-
* ThoughtSpot context to a specific page in your app.
|
|
9208
|
-
* @param path The page path string.
|
|
9209
|
-
* For example, to navigate users to a pinboard page,
|
|
9210
|
-
* define the method as navigateToPage('pinboard/<pinboardId>').
|
|
9211
|
-
*/
|
|
9212
|
-
navigateToPage(path) {
|
|
9213
|
-
var _a;
|
|
9214
|
-
const iframeSrc = (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.src;
|
|
9215
|
-
if (iframeSrc) {
|
|
9216
|
-
const embedPath = '#/embed';
|
|
9217
|
-
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9218
|
-
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9219
|
-
}
|
|
9220
|
-
else {
|
|
9221
|
-
console.log('Please call render before invoking this method');
|
|
9222
|
-
}
|
|
9223
|
-
}
|
|
9224
9208
|
/**
|
|
9225
9209
|
* Triggers an event on specific Port registered against
|
|
9226
9210
|
* for the EmbedEvent
|
|
@@ -9318,7 +9302,11 @@ var Page;
|
|
|
9318
9302
|
*/
|
|
9319
9303
|
Page["Answers"] = "answers";
|
|
9320
9304
|
/**
|
|
9321
|
-
*
|
|
9305
|
+
* Liveboards listing page
|
|
9306
|
+
*/
|
|
9307
|
+
Page["Liveboards"] = "liveboards";
|
|
9308
|
+
/**
|
|
9309
|
+
* @hidden
|
|
9322
9310
|
*/
|
|
9323
9311
|
Page["Pinboards"] = "pinboards";
|
|
9324
9312
|
/**
|
|
@@ -9337,7 +9325,7 @@ class AppEmbed extends V1Embed {
|
|
|
9337
9325
|
}
|
|
9338
9326
|
/**
|
|
9339
9327
|
* Constructs a map of parameters to be passed on to the
|
|
9340
|
-
* embedded
|
|
9328
|
+
* embedded Liveboard or visualization.
|
|
9341
9329
|
*/
|
|
9342
9330
|
getEmbedParams() {
|
|
9343
9331
|
const params = this.getBaseQueryParams();
|
|
@@ -9374,6 +9362,8 @@ class AppEmbed extends V1Embed {
|
|
|
9374
9362
|
return 'answer';
|
|
9375
9363
|
case Page.Answers:
|
|
9376
9364
|
return 'answers';
|
|
9365
|
+
case Page.Liveboards:
|
|
9366
|
+
return 'pinboards';
|
|
9377
9367
|
case Page.Pinboards:
|
|
9378
9368
|
return 'pinboards';
|
|
9379
9369
|
case Page.Data:
|
|
@@ -9398,6 +9388,23 @@ class AppEmbed extends V1Embed {
|
|
|
9398
9388
|
}
|
|
9399
9389
|
return path;
|
|
9400
9390
|
}
|
|
9391
|
+
/**
|
|
9392
|
+
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9393
|
+
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9394
|
+
* @param path The string, set to iframe src and navigate to new page
|
|
9395
|
+
* eg: appEmbed.navigateToPage('pinboards')
|
|
9396
|
+
*/
|
|
9397
|
+
navigateToPage(path) {
|
|
9398
|
+
if (this.iFrame) {
|
|
9399
|
+
const iframeSrc = this.iFrame.src;
|
|
9400
|
+
const embedPath = '#/embed';
|
|
9401
|
+
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9402
|
+
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9403
|
+
}
|
|
9404
|
+
else {
|
|
9405
|
+
console.log('Please call render before invoking this method');
|
|
9406
|
+
}
|
|
9407
|
+
}
|
|
9401
9408
|
/**
|
|
9402
9409
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
9403
9410
|
* @param renderOptions An object containing the page ID
|
|
@@ -9416,18 +9423,18 @@ class AppEmbed extends V1Embed {
|
|
|
9416
9423
|
/**
|
|
9417
9424
|
* Copyright (c) 2021
|
|
9418
9425
|
*
|
|
9419
|
-
* Embed a ThoughtSpot
|
|
9426
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9420
9427
|
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
9421
9428
|
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
9422
9429
|
*
|
|
9423
|
-
* @summary
|
|
9430
|
+
* @summary Liveboard & visualization embed
|
|
9424
9431
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9425
9432
|
*/
|
|
9426
9433
|
/**
|
|
9427
|
-
* Embed a ThoughtSpot
|
|
9428
|
-
* @Category
|
|
9434
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9435
|
+
* @Category Liveboards and Charts
|
|
9429
9436
|
*/
|
|
9430
|
-
class
|
|
9437
|
+
class LiveboardEmbed extends V1Embed {
|
|
9431
9438
|
// eslint-disable-next-line no-useless-constructor
|
|
9432
9439
|
constructor(domSelector, viewConfig) {
|
|
9433
9440
|
super(domSelector, viewConfig);
|
|
@@ -9444,20 +9451,21 @@ class PinboardEmbed extends V1Embed {
|
|
|
9444
9451
|
const obj = this.getIframeCenter();
|
|
9445
9452
|
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
9446
9453
|
};
|
|
9447
|
-
this.
|
|
9448
|
-
if (data.data.
|
|
9449
|
-
data.data.canvasState !== 'pinboard') {
|
|
9454
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
9455
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
9450
9456
|
this.setIFrameHeight(this.defaultHeight);
|
|
9451
9457
|
}
|
|
9452
9458
|
};
|
|
9453
9459
|
}
|
|
9454
9460
|
/**
|
|
9455
9461
|
* Construct a map of params to be passed on to the
|
|
9456
|
-
* embedded
|
|
9462
|
+
* embedded Liveboard or visualization.
|
|
9457
9463
|
*/
|
|
9458
9464
|
getEmbedParams() {
|
|
9459
9465
|
const params = this.getBaseQueryParams();
|
|
9460
|
-
const { enableVizTransformations, fullHeight,
|
|
9466
|
+
const { enableVizTransformations, fullHeight, defaultHeight, } = this.viewConfig;
|
|
9467
|
+
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
|
|
9468
|
+
this.viewConfig.preventPinboardFilterRemoval;
|
|
9461
9469
|
if (fullHeight === true) {
|
|
9462
9470
|
params[Param.fullHeight] = true;
|
|
9463
9471
|
}
|
|
@@ -9467,53 +9475,60 @@ class PinboardEmbed extends V1Embed {
|
|
|
9467
9475
|
if (enableVizTransformations !== undefined) {
|
|
9468
9476
|
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
9469
9477
|
}
|
|
9470
|
-
if (
|
|
9471
|
-
params[Param.
|
|
9478
|
+
if (preventLiveboardFilterRemoval) {
|
|
9479
|
+
params[Param.preventLiveboardFilterRemoval] = true;
|
|
9472
9480
|
}
|
|
9473
9481
|
params[Param.livedBoardEmbed] = true;
|
|
9474
9482
|
const queryParams = getQueryParamString(params, true);
|
|
9475
9483
|
return queryParams;
|
|
9476
9484
|
}
|
|
9477
9485
|
/**
|
|
9478
|
-
* Construct the URL of the embedded ThoughtSpot
|
|
9486
|
+
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
9479
9487
|
* to be loaded within the iframe.
|
|
9480
|
-
* @param
|
|
9481
|
-
* @param vizId The optional GUID of a visualization within the
|
|
9488
|
+
* @param liveboardId The GUID of the Liveboard.
|
|
9489
|
+
* @param vizId The optional GUID of a visualization within the Liveboard.
|
|
9482
9490
|
* @param runtimeFilters A list of runtime filters to be applied to
|
|
9483
|
-
* the
|
|
9491
|
+
* the Liveboard or visualization on load.
|
|
9484
9492
|
*/
|
|
9485
|
-
getIFrameSrc(
|
|
9493
|
+
getIFrameSrc(liveboardId, vizId, runtimeFilters) {
|
|
9486
9494
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
9487
9495
|
const queryParams = this.getEmbedParams();
|
|
9488
9496
|
const queryString = [filterQuery, queryParams]
|
|
9489
9497
|
.filter(Boolean)
|
|
9490
9498
|
.join('&');
|
|
9491
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${
|
|
9499
|
+
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${liveboardId}`;
|
|
9492
9500
|
if (vizId) {
|
|
9493
9501
|
url = `${url}/${vizId}`;
|
|
9494
9502
|
}
|
|
9495
9503
|
return url;
|
|
9496
9504
|
}
|
|
9497
9505
|
/**
|
|
9498
|
-
* Render an embedded ThoughtSpot
|
|
9499
|
-
* @param renderOptions An object specifying the
|
|
9506
|
+
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
9507
|
+
* @param renderOptions An object specifying the Liveboard ID,
|
|
9500
9508
|
* visualization ID and the runtime filters.
|
|
9501
9509
|
*/
|
|
9502
9510
|
render() {
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9511
|
+
var _a;
|
|
9512
|
+
const { vizId, runtimeFilters } = this.viewConfig;
|
|
9513
|
+
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
9514
|
+
if (!liveboardId) {
|
|
9515
|
+
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
9506
9516
|
}
|
|
9507
9517
|
if (this.viewConfig.fullHeight === true) {
|
|
9508
|
-
this.on(EmbedEvent.RouteChange, this.
|
|
9518
|
+
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
9509
9519
|
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
9510
9520
|
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
9511
9521
|
}
|
|
9512
9522
|
super.render();
|
|
9513
|
-
const src = this.getIFrameSrc(
|
|
9523
|
+
const src = this.getIFrameSrc(liveboardId, vizId, runtimeFilters);
|
|
9514
9524
|
this.renderV1Embed(src);
|
|
9515
9525
|
return this;
|
|
9516
9526
|
}
|
|
9527
|
+
}
|
|
9528
|
+
/**
|
|
9529
|
+
* @hidden
|
|
9530
|
+
*/
|
|
9531
|
+
class PinboardEmbed extends LiveboardEmbed {
|
|
9517
9532
|
}
|
|
9518
9533
|
|
|
9519
9534
|
/**
|
|
@@ -9555,7 +9570,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
9555
9570
|
* @param dataSources A list of data source GUIDs
|
|
9556
9571
|
*/
|
|
9557
9572
|
getIFrameSrc(answerId, dataSources) {
|
|
9558
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9573
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9559
9574
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9560
9575
|
const queryParams = this.getBaseQueryParams();
|
|
9561
9576
|
if (dataSources && dataSources.length) {
|
|
@@ -9597,4 +9612,4 @@ class SearchEmbed extends TsEmbed {
|
|
|
9597
9612
|
}
|
|
9598
9613
|
}
|
|
9599
9614
|
|
|
9600
|
-
export { Action, AppEmbed, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, Page, PinboardEmbed, RuntimeFilterOp, SearchEmbed, init, prefetch };
|
|
9615
|
+
export { Action, AppEmbed, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, RuntimeFilterOp, SearchEmbed, init, prefetch };
|