@thoughtspot/visual-embed-sdk 1.10.0-alpha.2 → 1.10.0
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/CHANGELOG.md +14 -2
- package/README.md +22 -3
- package/dist/src/embed/app.d.ts +9 -3
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/embed/ts-embed.d.ts +18 -4
- package/dist/src/types.d.ts +139 -3
- package/dist/src/utils.d.ts +4 -0
- package/dist/tsembed.es.js +179 -21
- package/dist/tsembed.js +179 -21
- package/lib/package.json +2 -2
- package/lib/src/embed/app.d.ts +9 -3
- package/lib/src/embed/app.js +23 -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/base.spec.js +13 -1
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +30 -1
- package/lib/src/embed/events.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 +18 -4
- package/lib/src/embed/ts-embed.js +36 -14
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +123 -14
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/types.d.ts +139 -3
- package/lib/src/types.js +116 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils.d.ts +4 -0
- package/lib/src/utils.js +4 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +170 -10
- package/package.json +2 -2
- package/src/embed/app.spec.ts +49 -1
- package/src/embed/app.ts +24 -6
- package/src/embed/base.spec.ts +14 -0
- package/src/embed/events.spec.ts +32 -0
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.spec.ts +166 -14
- package/src/embed/ts-embed.ts +56 -16
- package/src/types.ts +148 -1
- package/src/utils.ts +5 -0
package/dist/tsembed.es.js
CHANGED
|
@@ -109,6 +109,10 @@ const getOffsetTop = (element) => {
|
|
|
109
109
|
const rect = element.getBoundingClientRect();
|
|
110
110
|
return rect.top + window.scrollY;
|
|
111
111
|
};
|
|
112
|
+
const embedEventStatus = {
|
|
113
|
+
START: 'start',
|
|
114
|
+
END: 'end',
|
|
115
|
+
};
|
|
112
116
|
const setAttributes = (element, attributes) => {
|
|
113
117
|
Object.keys(attributes).forEach((key) => {
|
|
114
118
|
element.setAttribute(key, attributes[key].toString());
|
|
@@ -282,6 +286,12 @@ var EmbedEvent;
|
|
|
282
286
|
* @version 1.5.0 or later
|
|
283
287
|
*/
|
|
284
288
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
289
|
+
/**
|
|
290
|
+
* A click has been triggered on table/chart
|
|
291
|
+
* @return ContextMenuInputPoints - data point that is clicked
|
|
292
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
293
|
+
*/
|
|
294
|
+
EmbedEvent["VizPointClick"] = "vizPointClick";
|
|
285
295
|
/**
|
|
286
296
|
* An error has occurred.
|
|
287
297
|
* @return error - An error object or message
|
|
@@ -347,6 +357,107 @@ var EmbedEvent;
|
|
|
347
357
|
* @version 1.9.1 or later
|
|
348
358
|
*/
|
|
349
359
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
360
|
+
/**
|
|
361
|
+
* This can be used to register an event listener which
|
|
362
|
+
* is triggered on all events.
|
|
363
|
+
* @version SDK: 1.10.0 | ThoughtSpot: any
|
|
364
|
+
*/
|
|
365
|
+
EmbedEvent["ALL"] = "*";
|
|
366
|
+
/**
|
|
367
|
+
* Emitted when answer is saved in the app
|
|
368
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
369
|
+
*/
|
|
370
|
+
EmbedEvent["Save"] = "save";
|
|
371
|
+
/**
|
|
372
|
+
* Emitted when the download action is triggered on an answer
|
|
373
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
374
|
+
*/
|
|
375
|
+
EmbedEvent["Download"] = "download";
|
|
376
|
+
/**
|
|
377
|
+
* Emitted when the Download as PDF action is triggered on an answer
|
|
378
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
379
|
+
*/
|
|
380
|
+
EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
381
|
+
/**
|
|
382
|
+
* Emitted when the Download as CSV action is triggered on an answer
|
|
383
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
384
|
+
*/
|
|
385
|
+
EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
|
|
386
|
+
/**
|
|
387
|
+
* Emitted when the Download as XLSX action is triggered on an answer
|
|
388
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
389
|
+
*/
|
|
390
|
+
EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
|
|
391
|
+
/**
|
|
392
|
+
* Emitted when an answer is deleted in the app
|
|
393
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
394
|
+
*/
|
|
395
|
+
EmbedEvent["AnswerDelete"] = "answerDelete";
|
|
396
|
+
/**
|
|
397
|
+
* Emitted when an answer is pinned to a Liveboard
|
|
398
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
399
|
+
*/
|
|
400
|
+
EmbedEvent["Pin"] = "pin";
|
|
401
|
+
/**
|
|
402
|
+
* Emitted when SpotIQ analysis is triggered
|
|
403
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
404
|
+
*/
|
|
405
|
+
EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
406
|
+
/**
|
|
407
|
+
* Emitted when a user shares an object with another user or group
|
|
408
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
409
|
+
*/
|
|
410
|
+
EmbedEvent["Share"] = "share";
|
|
411
|
+
/**
|
|
412
|
+
* Emitted when a user clicks the Include action to include a specific value or data on a chart or table
|
|
413
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
414
|
+
*/
|
|
415
|
+
EmbedEvent["DrillInclude"] = "context-menu-item-include";
|
|
416
|
+
/**
|
|
417
|
+
* Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
|
|
418
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
419
|
+
*/
|
|
420
|
+
EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
|
|
421
|
+
/**
|
|
422
|
+
* Emitted when copied column value on the app
|
|
423
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
424
|
+
*/
|
|
425
|
+
EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
426
|
+
/**
|
|
427
|
+
* Emitted when a user clicks the Update TML action
|
|
428
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
429
|
+
*/
|
|
430
|
+
EmbedEvent["UpdateTML"] = "updateTSL";
|
|
431
|
+
/**
|
|
432
|
+
* Emitted when a user clicks the Edit TML action
|
|
433
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
434
|
+
*/
|
|
435
|
+
EmbedEvent["EditTML"] = "editTSL";
|
|
436
|
+
/**
|
|
437
|
+
* Emitted when ExportTML trigger in answer on the app
|
|
438
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
439
|
+
*/
|
|
440
|
+
EmbedEvent["ExportTML"] = "exportTSL";
|
|
441
|
+
/**
|
|
442
|
+
* Emitted when an answer is saved as a view
|
|
443
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
444
|
+
*/
|
|
445
|
+
EmbedEvent["SaveAsView"] = "saveAsView";
|
|
446
|
+
/**
|
|
447
|
+
* Emitted when copy of existing answer on the app
|
|
448
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
449
|
+
*/
|
|
450
|
+
EmbedEvent["CopyAEdit"] = "copyAEdit";
|
|
451
|
+
/**
|
|
452
|
+
* Emitted when a user clicks Show underlying data on an answe
|
|
453
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
454
|
+
*/
|
|
455
|
+
EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
456
|
+
/**
|
|
457
|
+
* Emitted when an answer is switched to a chart or table view
|
|
458
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
459
|
+
*/
|
|
460
|
+
EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
350
461
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
351
462
|
/**
|
|
352
463
|
* Event types that can be triggered by the host application
|
|
@@ -397,6 +508,13 @@ var HostEvent;
|
|
|
397
508
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
398
509
|
*/
|
|
399
510
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
511
|
+
/**
|
|
512
|
+
* Navigate to a specific page in App embed without any reload.
|
|
513
|
+
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
514
|
+
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
515
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
516
|
+
*/
|
|
517
|
+
HostEvent["Navigate"] = "Navigate";
|
|
400
518
|
})(HostEvent || (HostEvent = {}));
|
|
401
519
|
/**
|
|
402
520
|
* The different visual modes that the data sources panel within
|
|
@@ -453,6 +571,8 @@ var Param;
|
|
|
453
571
|
Param["DisableLoginRedirect"] = "disableLoginRedirect";
|
|
454
572
|
Param["visibleVizs"] = "pinboardVisibleVizs";
|
|
455
573
|
Param["LiveboardV2Enabled"] = "isPinboardV2Enabled";
|
|
574
|
+
Param["ShowAlerts"] = "showAlerts";
|
|
575
|
+
Param["Locale"] = "locale";
|
|
456
576
|
})(Param || (Param = {}));
|
|
457
577
|
/**
|
|
458
578
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
@@ -8968,7 +9088,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8968
9088
|
}
|
|
8969
9089
|
}
|
|
8970
9090
|
|
|
8971
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0
|
|
9091
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0";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};
|
|
8972
9092
|
|
|
8973
9093
|
/**
|
|
8974
9094
|
* Copyright (c) 2022
|
|
@@ -9075,9 +9195,10 @@ class TsEmbed {
|
|
|
9075
9195
|
* will be removed for ts7.oct.cl
|
|
9076
9196
|
* @hidden
|
|
9077
9197
|
*/
|
|
9078
|
-
formatEventData(event) {
|
|
9198
|
+
formatEventData(event, eventType) {
|
|
9079
9199
|
const eventData = {
|
|
9080
9200
|
...event.data,
|
|
9201
|
+
type: eventType,
|
|
9081
9202
|
};
|
|
9082
9203
|
if (!eventData.data) {
|
|
9083
9204
|
eventData.data = event.data.payload;
|
|
@@ -9094,7 +9215,7 @@ class TsEmbed {
|
|
|
9094
9215
|
window.addEventListener('message', (event) => {
|
|
9095
9216
|
const eventType = this.getEventType(event);
|
|
9096
9217
|
const eventPort = this.getEventPort(event);
|
|
9097
|
-
const eventData = this.formatEventData(event);
|
|
9218
|
+
const eventData = this.formatEventData(event, eventType);
|
|
9098
9219
|
if (event.source === this.iFrame.contentWindow) {
|
|
9099
9220
|
this.executeCallbacks(eventType, getProcessData(eventType, eventData, this.thoughtSpotHost), eventPort);
|
|
9100
9221
|
}
|
|
@@ -9135,13 +9256,14 @@ class TsEmbed {
|
|
|
9135
9256
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
9136
9257
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9137
9258
|
queryParams[Param.Version] = version$1;
|
|
9138
|
-
if (this.embedConfig.disableLoginRedirect === true
|
|
9139
|
-
|
|
9259
|
+
if (this.embedConfig.disableLoginRedirect === true ||
|
|
9260
|
+
this.embedConfig.autoLogin === true) {
|
|
9261
|
+
queryParams[Param.DisableLoginRedirect] = true;
|
|
9140
9262
|
}
|
|
9141
9263
|
if (this.embedConfig.customCssUrl) {
|
|
9142
9264
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
9143
9265
|
}
|
|
9144
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, additionalFlags, } = this.viewConfig;
|
|
9266
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, showAlerts, additionalFlags, locale, } = this.viewConfig;
|
|
9145
9267
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
9146
9268
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
9147
9269
|
return queryParams;
|
|
@@ -9158,6 +9280,12 @@ class TsEmbed {
|
|
|
9158
9280
|
if (Array.isArray(visibleActions)) {
|
|
9159
9281
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
9160
9282
|
}
|
|
9283
|
+
if (showAlerts !== undefined) {
|
|
9284
|
+
queryParams[Param.ShowAlerts] = showAlerts;
|
|
9285
|
+
}
|
|
9286
|
+
if (locale !== undefined) {
|
|
9287
|
+
queryParams[Param.Locale] = locale;
|
|
9288
|
+
}
|
|
9161
9289
|
if (additionalFlags && additionalFlags.constructor.name === 'Object') {
|
|
9162
9290
|
Object.assign(queryParams, additionalFlags);
|
|
9163
9291
|
}
|
|
@@ -9205,6 +9333,7 @@ class TsEmbed {
|
|
|
9205
9333
|
data: {
|
|
9206
9334
|
timestamp: initTimestamp,
|
|
9207
9335
|
},
|
|
9336
|
+
type: EmbedEvent.Init,
|
|
9208
9337
|
});
|
|
9209
9338
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9210
9339
|
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then(() => {
|
|
@@ -9236,6 +9365,7 @@ class TsEmbed {
|
|
|
9236
9365
|
data: {
|
|
9237
9366
|
timestamp: loadTimestamp,
|
|
9238
9367
|
},
|
|
9368
|
+
type: EmbedEvent.Load,
|
|
9239
9369
|
});
|
|
9240
9370
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_IFRAME_LOAD_PERFORMANCE, {
|
|
9241
9371
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
@@ -9275,9 +9405,20 @@ class TsEmbed {
|
|
|
9275
9405
|
*/
|
|
9276
9406
|
executeCallbacks(eventType, data, eventPort) {
|
|
9277
9407
|
const callbacks = this.eventHandlerMap.get(eventType) || [];
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9408
|
+
const allHandlers = this.eventHandlerMap.get(EmbedEvent.ALL) || [];
|
|
9409
|
+
callbacks.push(...allHandlers);
|
|
9410
|
+
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9411
|
+
callbacks.forEach((callbackObj) => {
|
|
9412
|
+
if ((callbackObj.options.start &&
|
|
9413
|
+
dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
|
|
9414
|
+
(!callbackObj.options.start &&
|
|
9415
|
+
dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
|
|
9416
|
+
) {
|
|
9417
|
+
callbackObj.callback(data, (payload) => {
|
|
9418
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
9419
|
+
});
|
|
9420
|
+
}
|
|
9421
|
+
});
|
|
9281
9422
|
}
|
|
9282
9423
|
/**
|
|
9283
9424
|
* Returns the ThoughtSpot hostname or IP address.
|
|
@@ -9334,14 +9475,15 @@ class TsEmbed {
|
|
|
9334
9475
|
* sends an event of a particular message type to the host application.
|
|
9335
9476
|
*
|
|
9336
9477
|
* @param messageType The message type
|
|
9337
|
-
* @param callback A callback function
|
|
9478
|
+
* @param callback A callback as a function
|
|
9479
|
+
* @param options The message options
|
|
9338
9480
|
*/
|
|
9339
|
-
on(messageType, callback) {
|
|
9481
|
+
on(messageType, callback, options = { start: false }) {
|
|
9340
9482
|
if (this.isRendered) {
|
|
9341
9483
|
this.handleError('Please register event handlers before calling render');
|
|
9342
9484
|
}
|
|
9343
9485
|
const callbacks = this.eventHandlerMap.get(messageType) || [];
|
|
9344
|
-
callbacks.push(callback);
|
|
9486
|
+
callbacks.push({ options, callback });
|
|
9345
9487
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
9346
9488
|
return this;
|
|
9347
9489
|
}
|
|
@@ -9431,9 +9573,9 @@ class V1Embed extends TsEmbed {
|
|
|
9431
9573
|
this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
|
|
9432
9574
|
}
|
|
9433
9575
|
// @override
|
|
9434
|
-
on(messageType, callback) {
|
|
9576
|
+
on(messageType, callback, options = { start: false }) {
|
|
9435
9577
|
const eventType = this.getCompatibleEventType(messageType);
|
|
9436
|
-
return super.on(eventType, callback);
|
|
9578
|
+
return super.on(eventType, callback, options);
|
|
9437
9579
|
}
|
|
9438
9580
|
}
|
|
9439
9581
|
|
|
@@ -9477,6 +9619,10 @@ var Page;
|
|
|
9477
9619
|
* Data management page
|
|
9478
9620
|
*/
|
|
9479
9621
|
Page["Data"] = "data";
|
|
9622
|
+
/**
|
|
9623
|
+
* SpotIQ listing page
|
|
9624
|
+
*/
|
|
9625
|
+
Page["SpotIQ"] = "spotiq";
|
|
9480
9626
|
})(Page || (Page = {}));
|
|
9481
9627
|
/**
|
|
9482
9628
|
* Embeds full ThoughtSpot experience in a host application.
|
|
@@ -9535,6 +9681,8 @@ class AppEmbed extends V1Embed {
|
|
|
9535
9681
|
return 'pinboards';
|
|
9536
9682
|
case Page.Data:
|
|
9537
9683
|
return 'data/tables';
|
|
9684
|
+
case Page.SpotIQ:
|
|
9685
|
+
return 'insights/results';
|
|
9538
9686
|
case Page.Home:
|
|
9539
9687
|
default:
|
|
9540
9688
|
return 'home';
|
|
@@ -9558,19 +9706,29 @@ class AppEmbed extends V1Embed {
|
|
|
9558
9706
|
/**
|
|
9559
9707
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9560
9708
|
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9561
|
-
* @param path The string, set to iframe src and navigate to new page
|
|
9709
|
+
* @param path string | number The string, set to iframe src and navigate to new page
|
|
9562
9710
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
9711
|
+
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
9712
|
+
* @param noReload boolean Trigger the navigation without reloading the page (version: 1.12.0 | 8.4.0.cl)
|
|
9563
9713
|
*/
|
|
9564
|
-
navigateToPage(path) {
|
|
9565
|
-
if (this.iFrame) {
|
|
9714
|
+
navigateToPage(path, noReload = false) {
|
|
9715
|
+
if (!this.iFrame) {
|
|
9716
|
+
console.log('Please call render before invoking this method');
|
|
9717
|
+
return;
|
|
9718
|
+
}
|
|
9719
|
+
if (noReload) {
|
|
9720
|
+
this.trigger(HostEvent.Navigate, path);
|
|
9721
|
+
}
|
|
9722
|
+
else {
|
|
9723
|
+
if (typeof path !== 'string') {
|
|
9724
|
+
console.warn('Path can only by a string when triggered without noReload');
|
|
9725
|
+
return;
|
|
9726
|
+
}
|
|
9566
9727
|
const iframeSrc = this.iFrame.src;
|
|
9567
9728
|
const embedPath = '#/embed';
|
|
9568
9729
|
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9569
9730
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9570
9731
|
}
|
|
9571
|
-
else {
|
|
9572
|
-
console.log('Please call render before invoking this method');
|
|
9573
|
-
}
|
|
9574
9732
|
}
|
|
9575
9733
|
/**
|
|
9576
9734
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
@@ -9751,7 +9909,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
9751
9909
|
*/
|
|
9752
9910
|
getIFrameSrc(answerId, dataSources) {
|
|
9753
9911
|
var _a;
|
|
9754
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9912
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9755
9913
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9756
9914
|
const queryParams = this.getBaseQueryParams();
|
|
9757
9915
|
queryParams[Param.HideActions] = [
|