@thoughtspot/visual-embed-sdk 1.6.0-alpha.2 → 1.6.2
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/dist/src/auth.d.ts +2 -4
- package/dist/src/embed/app.d.ts +9 -2
- package/dist/src/embed/liveboard.d.ts +19 -19
- package/dist/src/embed/liveboard.spec.d.ts +1 -0
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/embed/ts-embed.d.ts +2 -11
- package/dist/src/types.d.ts +24 -24
- package/dist/tsembed.es.js +82 -68
- package/dist/tsembed.js +81 -67
- package/lib/package.json +5 -1
- package/lib/src/auth.d.ts +2 -4
- package/lib/src/auth.js +25 -7
- package/lib/src/auth.js.map +1 -1
- package/lib/src/embed/app.d.ts +9 -2
- package/lib/src/embed/app.js +18 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +31 -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 +19 -19
- package/lib/src/embed/liveboard.js +12 -13
- package/lib/src/embed/liveboard.js.map +1 -1
- 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/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/types.d.ts +24 -24
- package/lib/src/types.js +21 -22
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +51 -49
- package/package.json +5 -1
- package/src/auth.ts +35 -7
- package/src/embed/app.spec.ts +40 -0
- package/src/embed/app.ts +21 -2
- package/src/embed/events.spec.ts +60 -1
- package/src/embed/liveboard.spec.ts +199 -0
- package/src/embed/liveboard.ts +21 -24
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.spec.ts +78 -5
- package/src/embed/ts-embed.ts +6 -25
- package/src/types.ts +24 -24
- package/dist/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.js +0 -107
- package/lib/src/embed/pinboard.js.map +0 -1
- package/lib/src/utils/fetchAnswers.d.ts +0 -3
- package/lib/src/utils/fetchAnswers.js +0 -49
- package/lib/src/utils/fetchAnswers.js.map +0 -1
package/dist/tsembed.es.js
CHANGED
|
@@ -133,6 +133,10 @@ var AuthType;
|
|
|
133
133
|
* SSO using SAML
|
|
134
134
|
*/
|
|
135
135
|
AuthType["SSO"] = "SSO_SAML";
|
|
136
|
+
/**
|
|
137
|
+
* SSO using IODC
|
|
138
|
+
*/
|
|
139
|
+
AuthType["IODC"] = "SSO_IODC";
|
|
136
140
|
/**
|
|
137
141
|
* Trusted authentication server
|
|
138
142
|
*/
|
|
@@ -230,12 +234,12 @@ var EmbedEvent;
|
|
|
230
234
|
*/
|
|
231
235
|
EmbedEvent["Load"] = "load";
|
|
232
236
|
/**
|
|
233
|
-
* Data pertaining to answer or
|
|
234
|
-
* @return data - The answer or
|
|
237
|
+
* Data pertaining to answer or Liveboard is received
|
|
238
|
+
* @return data - The answer or Liveboard data
|
|
235
239
|
*/
|
|
236
240
|
EmbedEvent["Data"] = "data";
|
|
237
241
|
/**
|
|
238
|
-
* Search/answer/
|
|
242
|
+
* Search/answer/Liveboard filters have been applied/updated
|
|
239
243
|
* @hidden
|
|
240
244
|
*/
|
|
241
245
|
EmbedEvent["FiltersChanged"] = "filtersChanged";
|
|
@@ -258,13 +262,13 @@ var EmbedEvent;
|
|
|
258
262
|
/**
|
|
259
263
|
* A custom action has been triggered
|
|
260
264
|
* @return actionId - The id of the custom action
|
|
261
|
-
* @return data - The answer or
|
|
265
|
+
* @return data - The answer or Liveboard data
|
|
262
266
|
*/
|
|
263
267
|
EmbedEvent["CustomAction"] = "customAction";
|
|
264
268
|
/**
|
|
265
269
|
* A double click has been triggered on table/chart
|
|
266
270
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
267
|
-
*
|
|
271
|
+
* @version 1.5.0 or later
|
|
268
272
|
*/
|
|
269
273
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
270
274
|
/**
|
|
@@ -282,8 +286,8 @@ var EmbedEvent;
|
|
|
282
286
|
*/
|
|
283
287
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
284
288
|
/**
|
|
285
|
-
* The height of the embedded
|
|
286
|
-
* @return data - The height of the embedded
|
|
289
|
+
* The height of the embedded Liveboard or visualization has been computed.
|
|
290
|
+
* @return data - The height of the embedded Liveboard or visualization
|
|
287
291
|
* @hidden
|
|
288
292
|
*/
|
|
289
293
|
EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
|
|
@@ -295,7 +299,6 @@ var EmbedEvent;
|
|
|
295
299
|
EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
|
|
296
300
|
/**
|
|
297
301
|
* Detects the route change.
|
|
298
|
-
* @hidden
|
|
299
302
|
*/
|
|
300
303
|
EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
|
|
301
304
|
/**
|
|
@@ -307,7 +310,7 @@ var EmbedEvent;
|
|
|
307
310
|
* Emitted when the embed does not have cookie access. This
|
|
308
311
|
* happens on Safari where third-party cookies are blocked by default.
|
|
309
312
|
*
|
|
310
|
-
* @version 1.1.0
|
|
313
|
+
* @version 1.1.0 or later
|
|
311
314
|
*/
|
|
312
315
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
313
316
|
/**
|
|
@@ -318,12 +321,12 @@ var EmbedEvent;
|
|
|
318
321
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
319
322
|
/**
|
|
320
323
|
* Emitted when any modal is opened in the app
|
|
321
|
-
*
|
|
324
|
+
* @version 1.6.0 or later
|
|
322
325
|
*/
|
|
323
326
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
324
327
|
/**
|
|
325
328
|
* Emitted when any modal is closed in the app
|
|
326
|
-
*
|
|
329
|
+
* @version 1.6.0 or later
|
|
327
330
|
*/
|
|
328
331
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
329
332
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
@@ -346,7 +349,7 @@ var HostEvent;
|
|
|
346
349
|
* eg. { selectedPoints: []}
|
|
347
350
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
348
351
|
* if not provided it will auto drill by the configured column. \
|
|
349
|
-
*
|
|
352
|
+
* @version 1.5.0 or later
|
|
350
353
|
*/
|
|
351
354
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
352
355
|
/**
|
|
@@ -360,10 +363,10 @@ var HostEvent;
|
|
|
360
363
|
*/
|
|
361
364
|
HostEvent["Reload"] = "reload";
|
|
362
365
|
/**
|
|
363
|
-
* Set the visible
|
|
364
|
-
* @param - an array of ids of
|
|
366
|
+
* Set the visible visualizations on a Liveboard.
|
|
367
|
+
* @param - an array of ids of visualizations to show, the ids not passed
|
|
365
368
|
* will be hidden.
|
|
366
|
-
*
|
|
369
|
+
* @version 1.6.0 or later
|
|
367
370
|
*/
|
|
368
371
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
369
372
|
})(HostEvent || (HostEvent = {}));
|
|
@@ -396,6 +399,7 @@ var Param;
|
|
|
396
399
|
(function (Param) {
|
|
397
400
|
Param["DataSources"] = "dataSources";
|
|
398
401
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
402
|
+
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
399
403
|
Param["DisableActions"] = "disableAction";
|
|
400
404
|
Param["DisableActionReason"] = "disableHint";
|
|
401
405
|
Param["ForceTable"] = "forceTable";
|
|
@@ -421,7 +425,7 @@ var Param;
|
|
|
421
425
|
})(Param || (Param = {}));
|
|
422
426
|
/**
|
|
423
427
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
424
|
-
* entities, such as answers and
|
|
428
|
+
* entities, such as answers and Liveboards.
|
|
425
429
|
*/
|
|
426
430
|
// eslint-disable-next-line no-shadow
|
|
427
431
|
var Action;
|
|
@@ -433,11 +437,6 @@ var Action;
|
|
|
433
437
|
Action["MakeACopy"] = "makeACopy";
|
|
434
438
|
Action["EditACopy"] = "editACopy";
|
|
435
439
|
Action["CopyLink"] = "embedDocument";
|
|
436
|
-
/**
|
|
437
|
-
* @hidden
|
|
438
|
-
*/
|
|
439
|
-
Action["PinboardSnapshot"] = "pinboardSnapshot";
|
|
440
|
-
Action["LiveboardSnapshot"] = "liveboardSnapshot";
|
|
441
440
|
Action["ResetLayout"] = "resetLayout";
|
|
442
441
|
Action["Schedule"] = "schedule";
|
|
443
442
|
Action["SchedulesList"] = "schedule-list";
|
|
@@ -474,7 +473,7 @@ var Action;
|
|
|
474
473
|
* @hidden
|
|
475
474
|
*/
|
|
476
475
|
Action["PinboardInfo"] = "pinboardInfo";
|
|
477
|
-
Action["LiveboardInfo"] = "
|
|
476
|
+
Action["LiveboardInfo"] = "pinboardInfo";
|
|
478
477
|
Action["SendAnswerFeedback"] = "sendFeedback";
|
|
479
478
|
/**
|
|
480
479
|
* @deprecated Will be removed in next version
|
|
@@ -8503,6 +8502,7 @@ const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
|
8503
8502
|
const EndPoints = {
|
|
8504
8503
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8505
8504
|
SSO_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8505
|
+
IODC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8506
8506
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8507
8507
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8508
8508
|
};
|
|
@@ -8610,7 +8610,7 @@ async function samlPopupFlow(ssoURL) {
|
|
|
8610
8610
|
* Perform SAML authentication
|
|
8611
8611
|
* @param embedConfig The embed configuration
|
|
8612
8612
|
*/
|
|
8613
|
-
const
|
|
8613
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
8614
8614
|
const { thoughtSpotHost } = embedConfig;
|
|
8615
8615
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8616
8616
|
if (loggedIn) {
|
|
@@ -8627,6 +8627,15 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8627
8627
|
loggedInStatus = false;
|
|
8628
8628
|
return;
|
|
8629
8629
|
}
|
|
8630
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8631
|
+
if (embedConfig.noRedirect) {
|
|
8632
|
+
await samlPopupFlow(ssoURL);
|
|
8633
|
+
return;
|
|
8634
|
+
}
|
|
8635
|
+
window.location.href = ssoURL;
|
|
8636
|
+
};
|
|
8637
|
+
const doSamlAuth = async (embedConfig) => {
|
|
8638
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8630
8639
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8631
8640
|
// again and the same JS will execute again.
|
|
8632
8641
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -8634,12 +8643,18 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8634
8643
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8635
8644
|
// bring back the page to the same URL
|
|
8636
8645
|
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8646
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8647
|
+
};
|
|
8648
|
+
const doIODCAuth = async (embedConfig) => {
|
|
8649
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8650
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8651
|
+
// again and the same JS will execute again.
|
|
8652
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8653
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8654
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8655
|
+
// bring back the page to the same URL
|
|
8656
|
+
const ssoEndPoint = `${EndPoints.IODC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8657
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8643
8658
|
};
|
|
8644
8659
|
/**
|
|
8645
8660
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -8650,6 +8665,8 @@ const authenticate = async (embedConfig) => {
|
|
|
8650
8665
|
switch (authType) {
|
|
8651
8666
|
case AuthType.SSO:
|
|
8652
8667
|
return doSamlAuth(embedConfig);
|
|
8668
|
+
case AuthType.IODC:
|
|
8669
|
+
return doIODCAuth(embedConfig);
|
|
8653
8670
|
case AuthType.AuthServer:
|
|
8654
8671
|
return doTokenAuth(embedConfig);
|
|
8655
8672
|
case AuthType.Basic:
|
|
@@ -8845,7 +8862,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8845
8862
|
}
|
|
8846
8863
|
}
|
|
8847
8864
|
|
|
8848
|
-
var version="1.6.0-
|
|
8865
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.2";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};
|
|
8849
8866
|
|
|
8850
8867
|
/**
|
|
8851
8868
|
* Copyright (c) 2021
|
|
@@ -8855,6 +8872,7 @@ var version="1.6.0-alpha.2";
|
|
|
8855
8872
|
* @summary Base classes
|
|
8856
8873
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8857
8874
|
*/
|
|
8875
|
+
const { version: version$1 } = pkgInfo;
|
|
8858
8876
|
/**
|
|
8859
8877
|
* The event id map from v2 event names to v1 event id
|
|
8860
8878
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -9006,12 +9024,12 @@ class TsEmbed {
|
|
|
9006
9024
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
9007
9025
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
9008
9026
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9009
|
-
queryParams[Param.Version] = version;
|
|
9027
|
+
queryParams[Param.Version] = version$1;
|
|
9010
9028
|
if (this.embedConfig.customCssUrl) {
|
|
9011
9029
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
9012
9030
|
}
|
|
9013
9031
|
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, } = this.viewConfig;
|
|
9014
|
-
if ((visibleActions
|
|
9032
|
+
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
9015
9033
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
9016
9034
|
return queryParams;
|
|
9017
9035
|
}
|
|
@@ -9031,7 +9049,7 @@ class TsEmbed {
|
|
|
9031
9049
|
}
|
|
9032
9050
|
/**
|
|
9033
9051
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
9034
|
-
* This is used for embedding
|
|
9052
|
+
* This is used for embedding Liveboards, visualizations, and full application.
|
|
9035
9053
|
* @param queryString The query string to append to the URL.
|
|
9036
9054
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
9037
9055
|
* the full application.
|
|
@@ -9209,26 +9227,6 @@ class TsEmbed {
|
|
|
9209
9227
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
9210
9228
|
return this;
|
|
9211
9229
|
}
|
|
9212
|
-
/**
|
|
9213
|
-
* Navigates users to the specified application page.
|
|
9214
|
-
* Use this method to navigate users from the embedded
|
|
9215
|
-
* ThoughtSpot context to a specific page in your app.
|
|
9216
|
-
* @param path The page path string.
|
|
9217
|
-
* For example, to navigate users to a liveboard page,
|
|
9218
|
-
* define the method as navigateToPage('liveboard/<liveboardId>').
|
|
9219
|
-
*/
|
|
9220
|
-
navigateToPage(path) {
|
|
9221
|
-
var _a;
|
|
9222
|
-
const iframeSrc = (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.src;
|
|
9223
|
-
if (iframeSrc) {
|
|
9224
|
-
const embedPath = '#/embed';
|
|
9225
|
-
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9226
|
-
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9227
|
-
}
|
|
9228
|
-
else {
|
|
9229
|
-
console.log('Please call render before invoking this method');
|
|
9230
|
-
}
|
|
9231
|
-
}
|
|
9232
9230
|
/**
|
|
9233
9231
|
* Triggers an event on specific Port registered against
|
|
9234
9232
|
* for the EmbedEvent
|
|
@@ -9349,7 +9347,7 @@ class AppEmbed extends V1Embed {
|
|
|
9349
9347
|
}
|
|
9350
9348
|
/**
|
|
9351
9349
|
* Constructs a map of parameters to be passed on to the
|
|
9352
|
-
* embedded
|
|
9350
|
+
* embedded Liveboard or visualization.
|
|
9353
9351
|
*/
|
|
9354
9352
|
getEmbedParams() {
|
|
9355
9353
|
const params = this.getBaseQueryParams();
|
|
@@ -9412,6 +9410,23 @@ class AppEmbed extends V1Embed {
|
|
|
9412
9410
|
}
|
|
9413
9411
|
return path;
|
|
9414
9412
|
}
|
|
9413
|
+
/**
|
|
9414
|
+
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9415
|
+
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9416
|
+
* @param path The string, set to iframe src and navigate to new page
|
|
9417
|
+
* eg: appEmbed.navigateToPage('pinboards')
|
|
9418
|
+
*/
|
|
9419
|
+
navigateToPage(path) {
|
|
9420
|
+
if (this.iFrame) {
|
|
9421
|
+
const iframeSrc = this.iFrame.src;
|
|
9422
|
+
const embedPath = '#/embed';
|
|
9423
|
+
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9424
|
+
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9425
|
+
}
|
|
9426
|
+
else {
|
|
9427
|
+
console.log('Please call render before invoking this method');
|
|
9428
|
+
}
|
|
9429
|
+
}
|
|
9415
9430
|
/**
|
|
9416
9431
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
9417
9432
|
* @param renderOptions An object containing the page ID
|
|
@@ -9430,7 +9445,7 @@ class AppEmbed extends V1Embed {
|
|
|
9430
9445
|
/**
|
|
9431
9446
|
* Copyright (c) 2021
|
|
9432
9447
|
*
|
|
9433
|
-
* Embed a ThoughtSpot
|
|
9448
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9434
9449
|
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
9435
9450
|
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
9436
9451
|
*
|
|
@@ -9438,7 +9453,7 @@ class AppEmbed extends V1Embed {
|
|
|
9438
9453
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9439
9454
|
*/
|
|
9440
9455
|
/**
|
|
9441
|
-
* Embed a ThoughtSpot
|
|
9456
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9442
9457
|
* @Category Liveboards and Charts
|
|
9443
9458
|
*/
|
|
9444
9459
|
class LiveboardEmbed extends V1Embed {
|
|
@@ -9458,16 +9473,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9458
9473
|
const obj = this.getIframeCenter();
|
|
9459
9474
|
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
9460
9475
|
};
|
|
9461
|
-
this.
|
|
9462
|
-
if (data.data.
|
|
9463
|
-
data.data.canvasState !== 'pinboard') {
|
|
9476
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
9477
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
9464
9478
|
this.setIFrameHeight(this.defaultHeight);
|
|
9465
9479
|
}
|
|
9466
9480
|
};
|
|
9467
9481
|
}
|
|
9468
9482
|
/**
|
|
9469
9483
|
* Construct a map of params to be passed on to the
|
|
9470
|
-
* embedded
|
|
9484
|
+
* embedded Liveboard or visualization.
|
|
9471
9485
|
*/
|
|
9472
9486
|
getEmbedParams() {
|
|
9473
9487
|
const params = this.getBaseQueryParams();
|
|
@@ -9491,12 +9505,12 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9491
9505
|
return queryParams;
|
|
9492
9506
|
}
|
|
9493
9507
|
/**
|
|
9494
|
-
* Construct the URL of the embedded ThoughtSpot
|
|
9508
|
+
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
9495
9509
|
* to be loaded within the iframe.
|
|
9496
|
-
* @param liveboardId The GUID of the
|
|
9497
|
-
* @param vizId The optional GUID of a visualization within the
|
|
9510
|
+
* @param liveboardId The GUID of the Liveboard.
|
|
9511
|
+
* @param vizId The optional GUID of a visualization within the Liveboard.
|
|
9498
9512
|
* @param runtimeFilters A list of runtime filters to be applied to
|
|
9499
|
-
* the
|
|
9513
|
+
* the Liveboard or visualization on load.
|
|
9500
9514
|
*/
|
|
9501
9515
|
getIFrameSrc(liveboardId, vizId, runtimeFilters) {
|
|
9502
9516
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
@@ -9511,8 +9525,8 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9511
9525
|
return url;
|
|
9512
9526
|
}
|
|
9513
9527
|
/**
|
|
9514
|
-
* Render an embedded ThoughtSpot
|
|
9515
|
-
* @param renderOptions An object specifying the
|
|
9528
|
+
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
9529
|
+
* @param renderOptions An object specifying the Liveboard ID,
|
|
9516
9530
|
* visualization ID and the runtime filters.
|
|
9517
9531
|
*/
|
|
9518
9532
|
render() {
|
|
@@ -9523,7 +9537,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9523
9537
|
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
9524
9538
|
}
|
|
9525
9539
|
if (this.viewConfig.fullHeight === true) {
|
|
9526
|
-
this.on(EmbedEvent.RouteChange, this.
|
|
9540
|
+
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
9527
9541
|
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
9528
9542
|
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
9529
9543
|
}
|
|
@@ -9578,7 +9592,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
9578
9592
|
* @param dataSources A list of data source GUIDs
|
|
9579
9593
|
*/
|
|
9580
9594
|
getIFrameSrc(answerId, dataSources) {
|
|
9581
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9595
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9582
9596
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9583
9597
|
const queryParams = this.getBaseQueryParams();
|
|
9584
9598
|
if (dataSources && dataSources.length) {
|