@thoughtspot/visual-embed-sdk 1.24.0-dev → 1.24.0-preRender.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/cjs/package.json +2 -3
- package/cjs/src/embed/TsEmbed.d.ts +302 -0
- package/cjs/src/embed/TsEmbed.d.ts.map +1 -0
- package/cjs/src/embed/TsEmbed.js +851 -0
- package/cjs/src/embed/TsEmbed.js.map +1 -0
- package/cjs/src/embed/app.d.ts +4 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +9 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +2 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +3 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +6 -5
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +4 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +9 -2
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +1 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +1 -0
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +5 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +10 -2
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +14 -7
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +94 -63
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +47 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +3 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +2 -0
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +1 -0
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +5 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +8 -8
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +60 -19
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +7 -13
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.js +80 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.js +182 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +201 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
- package/cjs/src/utils/graphql/graphql-request.d.ts +15 -0
- package/cjs/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/cjs/src/utils/graphql/graphql-request.js +40 -0
- package/cjs/src/utils/graphql/graphql-request.js.map +1 -0
- package/cjs/src/utils/graphql/sourceService.d.ts +8 -0
- package/cjs/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/cjs/src/utils/graphql/sourceService.js +69 -0
- package/cjs/src/utils/graphql/sourceService.js.map +1 -0
- package/cjs/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/cjs/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/cjs/src/utils/graphql/sourceService.spec.js +12 -0
- package/cjs/src/utils/graphql/sourceService.spec.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +7 -11
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +13 -17
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +6 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +26 -1
- package/cjs/src/utils.js.map +1 -1
- package/dist/src/embed/app.d.ts +4 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +2 -0
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +3 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +4 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +1 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +5 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +14 -7
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +5 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +60 -19
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/dist/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/dist/src/utils/graphql/graphql-request.d.ts +15 -0
- package/dist/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/dist/src/utils/graphql/sourceService.d.ts +8 -0
- package/dist/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/dist/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/dist/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +513 -150
- package/dist/tsembed-react.js +516 -149
- package/dist/tsembed.es.js +556 -146
- package/dist/tsembed.js +556 -145
- package/dist/visual-embed-sdk-react-full.d.ts +152 -33
- package/dist/visual-embed-sdk-react.d.ts +152 -33
- package/dist/visual-embed-sdk.d.ts +147 -32
- package/lib/package.json +2 -3
- package/lib/src/embed/TsEmbed.d.ts +302 -0
- package/lib/src/embed/TsEmbed.d.ts.map +1 -0
- package/lib/src/embed/TsEmbed.js +847 -0
- package/lib/src/embed/TsEmbed.js.map +1 -0
- package/lib/src/embed/app.d.ts +4 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +9 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +2 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +2 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +3 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +6 -5
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/sage.d.ts +4 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +9 -2
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +1 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +1 -0
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +5 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +10 -2
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +14 -7
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +94 -63
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +47 -0
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +3 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +2 -0
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +1 -0
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +5 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +7 -7
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +60 -19
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +6 -12
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js +77 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.js +177 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js +199 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
- package/lib/src/utils/graphql/graphql-request.d.ts +15 -0
- package/lib/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/lib/src/utils/graphql/graphql-request.js +36 -0
- package/lib/src/utils/graphql/graphql-request.js.map +1 -0
- package/lib/src/utils/graphql/sourceService.d.ts +8 -0
- package/lib/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/lib/src/utils/graphql/sourceService.js +65 -0
- package/lib/src/utils/graphql/sourceService.js.map +1 -0
- package/lib/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/lib/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/lib/src/utils/graphql/sourceService.spec.js +10 -0
- package/lib/src/utils/graphql/sourceService.spec.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -12
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +14 -18
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils.d.ts +6 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +23 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +153 -33
- package/package.json +2 -3
- package/src/embed/app.ts +13 -6
- package/src/embed/base.ts +2 -0
- package/src/embed/liveboard.ts +7 -5
- package/src/embed/sage.ts +13 -2
- package/src/embed/search-bar.tsx +2 -0
- package/src/embed/search.ts +14 -2
- package/src/embed/ts-embed.spec.ts +49 -0
- package/src/embed/ts-embed.ts +116 -64
- package/src/index.ts +5 -0
- package/src/mixpanel-service.spec.ts +1 -0
- package/src/mixpanel-service.ts +1 -0
- package/src/react/index.tsx +50 -45
- package/src/types.ts +64 -21
- package/src/utils/graphql/answerService/answer-queries.ts +80 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +231 -0
- package/src/utils/graphql/answerService/answerService.ts +234 -0
- package/src/utils/graphql/graphql-request.ts +45 -0
- package/src/utils/graphql/sourceService.spec.ts +10 -0
- package/src/utils/graphql/sourceService.ts +71 -0
- package/src/utils/processData.spec.ts +15 -25
- package/src/utils/processData.ts +13 -15
- package/src/utils.ts +24 -0
- package/src/utils/answerService.spec.ts +0 -41
- package/src/utils/answerService.ts +0 -63
package/dist/tsembed.es.js
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
// istanbul ignore next
|
|
2
|
+
const isObject = (obj) => {
|
|
3
|
+
if (typeof obj === "object" && obj !== null) {
|
|
4
|
+
if (typeof Object.getPrototypeOf === "function") {
|
|
5
|
+
const prototype = Object.getPrototypeOf(obj);
|
|
6
|
+
return prototype === Object.prototype || prototype === null;
|
|
7
|
+
}
|
|
8
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
const merge = (...objects) => objects.reduce((result, current) => {
|
|
13
|
+
if (Array.isArray(current)) {
|
|
14
|
+
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
15
|
+
}
|
|
16
|
+
Object.keys(current).forEach((key) => {
|
|
17
|
+
if (["__proto__", "constructor", "prototype"].includes(key)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
21
|
+
result[key] = merge.options.mergeArrays
|
|
22
|
+
? Array.from(new Set(result[key].concat(current[key])))
|
|
23
|
+
: current[key];
|
|
24
|
+
}
|
|
25
|
+
else if (isObject(result[key]) && isObject(current[key])) {
|
|
26
|
+
result[key] = merge(result[key], current[key]);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
result[key] = current[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return result;
|
|
33
|
+
}, {});
|
|
34
|
+
const defaultOptions = {
|
|
35
|
+
mergeArrays: true,
|
|
36
|
+
};
|
|
37
|
+
merge.options = defaultOptions;
|
|
38
|
+
merge.withOptions = (options, ...objects) => {
|
|
39
|
+
merge.options = Object.assign({ mergeArrays: true }, options);
|
|
40
|
+
const result = merge(...objects);
|
|
41
|
+
merge.options = defaultOptions;
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
|
|
1
45
|
/**
|
|
2
46
|
* Copyright (c) 2023
|
|
3
47
|
*
|
|
@@ -194,6 +238,30 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
194
238
|
function getDOMNode(domSelector) {
|
|
195
239
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
196
240
|
}
|
|
241
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
242
|
+
const getOperationNameFromQuery = (query) => {
|
|
243
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
244
|
+
const matches = query.match(regex);
|
|
245
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @param obj
|
|
250
|
+
*/
|
|
251
|
+
function removeTypename(obj) {
|
|
252
|
+
if (!obj || typeof obj !== 'object')
|
|
253
|
+
return obj;
|
|
254
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
255
|
+
for (const key in obj) {
|
|
256
|
+
if (key === '__typename') {
|
|
257
|
+
delete obj[key];
|
|
258
|
+
}
|
|
259
|
+
else if (typeof obj[key] === 'object') {
|
|
260
|
+
removeTypename(obj[key]);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return obj;
|
|
264
|
+
}
|
|
197
265
|
const setStyleProperties = (element, styleProperties) => {
|
|
198
266
|
if (!element || !styleProperties)
|
|
199
267
|
return;
|
|
@@ -470,27 +538,27 @@ var HomepageModule;
|
|
|
470
538
|
/**
|
|
471
539
|
* Search bar
|
|
472
540
|
*/
|
|
473
|
-
HomepageModule["Search"] = "
|
|
541
|
+
HomepageModule["Search"] = "SEARCH";
|
|
474
542
|
/**
|
|
475
543
|
* kPI watchlist module
|
|
476
544
|
*/
|
|
477
|
-
HomepageModule["Watchlist"] = "
|
|
545
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
478
546
|
/**
|
|
479
547
|
* favorite objects
|
|
480
548
|
*/
|
|
481
|
-
HomepageModule["Favorite"] = "
|
|
549
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
482
550
|
/**
|
|
483
551
|
* List of answers and liveboards
|
|
484
552
|
*/
|
|
485
|
-
HomepageModule["MyLibrary"] = "
|
|
553
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
486
554
|
/**
|
|
487
555
|
* Trending list
|
|
488
556
|
*/
|
|
489
|
-
HomepageModule["Trending"] = "
|
|
557
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
490
558
|
/**
|
|
491
559
|
* Learning videos
|
|
492
560
|
*/
|
|
493
|
-
HomepageModule["Learning"] = "
|
|
561
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
494
562
|
})(HomepageModule || (HomepageModule = {}));
|
|
495
563
|
/**
|
|
496
564
|
* Event types emitted by the embedded ThoughtSpot application.
|
|
@@ -2638,12 +2706,6 @@ var Action;
|
|
|
2638
2706
|
*/
|
|
2639
2707
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2640
2708
|
})(Action || (Action = {}));
|
|
2641
|
-
// eslint-disable-next-line no-shadow
|
|
2642
|
-
var OperationType;
|
|
2643
|
-
(function (OperationType) {
|
|
2644
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2645
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2646
|
-
})(OperationType || (OperationType = {}));
|
|
2647
2709
|
var PrefetchFeatures;
|
|
2648
2710
|
(function (PrefetchFeatures) {
|
|
2649
2711
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8759,6 +8821,7 @@ function emptyQueue() {
|
|
|
8759
8821
|
* @param sessionInfo
|
|
8760
8822
|
*/
|
|
8761
8823
|
function initMixpanel(sessionInfo) {
|
|
8824
|
+
var _a;
|
|
8762
8825
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8763
8826
|
return;
|
|
8764
8827
|
}
|
|
@@ -8776,6 +8839,7 @@ function initMixpanel(sessionInfo) {
|
|
|
8776
8839
|
clusterId: sessionInfo.clusterId,
|
|
8777
8840
|
clusterName: sessionInfo.clusterName,
|
|
8778
8841
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8842
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8779
8843
|
});
|
|
8780
8844
|
isMixpanelInitialized = true;
|
|
8781
8845
|
emptyQueue();
|
|
@@ -9268,12 +9332,12 @@ var _baseGetTag = baseGetTag;
|
|
|
9268
9332
|
* _.isObject(null);
|
|
9269
9333
|
* // => false
|
|
9270
9334
|
*/
|
|
9271
|
-
function isObject(value) {
|
|
9335
|
+
function isObject$1(value) {
|
|
9272
9336
|
var type = typeof value;
|
|
9273
9337
|
return value != null && (type == 'object' || type == 'function');
|
|
9274
9338
|
}
|
|
9275
9339
|
|
|
9276
|
-
var isObject_1 = isObject;
|
|
9340
|
+
var isObject_1 = isObject$1;
|
|
9277
9341
|
|
|
9278
9342
|
/** `Object#toString` result references. */
|
|
9279
9343
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -10104,9 +10168,9 @@ function cacheHas(cache, key) {
|
|
|
10104
10168
|
var _cacheHas = cacheHas;
|
|
10105
10169
|
|
|
10106
10170
|
/* Built-in method references that are verified to be native. */
|
|
10107
|
-
var Set = _getNative(_root, 'Set');
|
|
10171
|
+
var Set$1 = _getNative(_root, 'Set');
|
|
10108
10172
|
|
|
10109
|
-
var _Set = Set;
|
|
10173
|
+
var _Set = Set$1;
|
|
10110
10174
|
|
|
10111
10175
|
/**
|
|
10112
10176
|
* This method returns `undefined`.
|
|
@@ -10964,6 +11028,7 @@ const renderInQueue = (fn) => {
|
|
|
10964
11028
|
*
|
|
10965
11029
|
* @param data
|
|
10966
11030
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11031
|
+
* @group Global methods
|
|
10967
11032
|
*/
|
|
10968
11033
|
const executeTML = async (data) => {
|
|
10969
11034
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -11011,6 +11076,7 @@ const executeTML = async (data) => {
|
|
|
11011
11076
|
*
|
|
11012
11077
|
* @param data
|
|
11013
11078
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11079
|
+
* @group Global methods
|
|
11014
11080
|
*/
|
|
11015
11081
|
const exportTML = async (data) => {
|
|
11016
11082
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -11056,58 +11122,351 @@ const exportTML = async (data) => {
|
|
|
11056
11122
|
|
|
11057
11123
|
/**
|
|
11058
11124
|
*
|
|
11059
|
-
* @param
|
|
11060
|
-
* @param query
|
|
11061
|
-
* @param
|
|
11125
|
+
* @param root0
|
|
11126
|
+
* @param root0.query
|
|
11127
|
+
* @param root0.variables
|
|
11128
|
+
* @param root0.thoughtSpotHost
|
|
11129
|
+
* @param root0.isCompositeQuery
|
|
11130
|
+
*/
|
|
11131
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
11132
|
+
const operationName = getOperationNameFromQuery(query);
|
|
11133
|
+
try {
|
|
11134
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
11135
|
+
method: 'POST',
|
|
11136
|
+
headers: {
|
|
11137
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
11138
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11139
|
+
accept: '*/*',
|
|
11140
|
+
'accept-language': 'en-us',
|
|
11141
|
+
},
|
|
11142
|
+
body: JSON.stringify({
|
|
11143
|
+
operationName,
|
|
11144
|
+
query,
|
|
11145
|
+
variables,
|
|
11146
|
+
}),
|
|
11147
|
+
credentials: 'include',
|
|
11148
|
+
});
|
|
11149
|
+
const result = await response.json();
|
|
11150
|
+
const dataValues = Object.values(result.data);
|
|
11151
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
11152
|
+
}
|
|
11153
|
+
catch (error) {
|
|
11154
|
+
return error;
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
|
|
11158
|
+
const getSourceDetailQuery = `
|
|
11159
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
11160
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
11161
|
+
id
|
|
11162
|
+
name
|
|
11163
|
+
description
|
|
11164
|
+
authorName
|
|
11165
|
+
authorDisplayName
|
|
11166
|
+
isExternal
|
|
11167
|
+
type
|
|
11168
|
+
created
|
|
11169
|
+
modified
|
|
11170
|
+
columns {
|
|
11171
|
+
id
|
|
11172
|
+
name
|
|
11173
|
+
author
|
|
11174
|
+
authorDisplayName
|
|
11175
|
+
description
|
|
11176
|
+
dataType
|
|
11177
|
+
type
|
|
11178
|
+
modified
|
|
11179
|
+
ownerName
|
|
11180
|
+
owner
|
|
11181
|
+
dataRecency
|
|
11182
|
+
sources {
|
|
11183
|
+
tableId
|
|
11184
|
+
tableName
|
|
11185
|
+
columnId
|
|
11186
|
+
columnName
|
|
11187
|
+
__typename
|
|
11188
|
+
}
|
|
11189
|
+
synonyms
|
|
11190
|
+
cohortAnswerId
|
|
11191
|
+
__typename
|
|
11192
|
+
}
|
|
11193
|
+
relationships
|
|
11194
|
+
destinationRelationships
|
|
11195
|
+
dataSourceId
|
|
11196
|
+
__typename
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
`;
|
|
11200
|
+
const sourceDetailCache = new Map();
|
|
11201
|
+
/**
|
|
11202
|
+
*
|
|
11062
11203
|
* @param thoughtSpotHost
|
|
11204
|
+
* @param sourceId
|
|
11063
11205
|
*/
|
|
11064
|
-
function
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11206
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
11207
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
11208
|
+
return sourceDetailCache.get(sourceId);
|
|
11209
|
+
}
|
|
11210
|
+
const details = await graphqlQuery({
|
|
11211
|
+
query: getSourceDetailQuery,
|
|
11212
|
+
variables: {
|
|
11213
|
+
ids: [sourceId],
|
|
11214
|
+
},
|
|
11215
|
+
thoughtSpotHost,
|
|
11216
|
+
});
|
|
11217
|
+
const souceDetails = details[0];
|
|
11218
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
11219
|
+
return souceDetails;
|
|
11220
|
+
}
|
|
11221
|
+
|
|
11222
|
+
const bachSessionId = `
|
|
11223
|
+
id {
|
|
11224
|
+
sessionId
|
|
11225
|
+
genNo
|
|
11226
|
+
acSession {
|
|
11227
|
+
sessionId
|
|
11228
|
+
genNo
|
|
11229
|
+
}
|
|
11230
|
+
}
|
|
11231
|
+
`;
|
|
11232
|
+
const getUnaggregatedAnswerSession = `
|
|
11233
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
11234
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
11235
|
+
${bachSessionId}
|
|
11236
|
+
answer {
|
|
11237
|
+
visualizations {
|
|
11238
|
+
... on TableViz {
|
|
11239
|
+
columns {
|
|
11240
|
+
column {
|
|
11241
|
+
id
|
|
11242
|
+
name
|
|
11243
|
+
referencedColumns {
|
|
11244
|
+
guid
|
|
11245
|
+
displayName
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
}
|
|
11249
|
+
}
|
|
11250
|
+
}
|
|
11251
|
+
}
|
|
11252
|
+
}
|
|
11253
|
+
}
|
|
11254
|
+
`;
|
|
11255
|
+
const removeColumns = `
|
|
11256
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
11257
|
+
Answer__removeColumns(
|
|
11258
|
+
session: $session
|
|
11259
|
+
logicalColumnIds: $logicalColumnIds
|
|
11260
|
+
columnIds: $columnIds
|
|
11261
|
+
) {
|
|
11262
|
+
${bachSessionId}
|
|
11263
|
+
}
|
|
11264
|
+
}
|
|
11265
|
+
`;
|
|
11266
|
+
const addColumns = `
|
|
11267
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
11268
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
11269
|
+
${bachSessionId}
|
|
11270
|
+
}
|
|
11271
|
+
}
|
|
11272
|
+
`;
|
|
11273
|
+
const getAnswerData = `
|
|
11274
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
11275
|
+
getAnswer(session: $session) {
|
|
11276
|
+
${bachSessionId}
|
|
11277
|
+
answer {
|
|
11278
|
+
id
|
|
11279
|
+
visualizations {
|
|
11280
|
+
id
|
|
11281
|
+
... on TableViz {
|
|
11282
|
+
columns {
|
|
11283
|
+
column {
|
|
11284
|
+
id
|
|
11285
|
+
name
|
|
11286
|
+
type
|
|
11287
|
+
aggregationType
|
|
11288
|
+
dataType
|
|
11289
|
+
}
|
|
11290
|
+
}
|
|
11291
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
11292
|
+
}
|
|
11293
|
+
}
|
|
11294
|
+
}
|
|
11295
|
+
}
|
|
11296
|
+
}
|
|
11297
|
+
`;
|
|
11298
|
+
|
|
11299
|
+
// eslint-disable-next-line no-shadow
|
|
11300
|
+
var OperationType;
|
|
11301
|
+
(function (OperationType) {
|
|
11302
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
11303
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
11304
|
+
})(OperationType || (OperationType = {}));
|
|
11305
|
+
/**
|
|
11306
|
+
* Class representing the answer service provided with the
|
|
11307
|
+
* custom action payload. This service could be used to run
|
|
11308
|
+
* graphql queries in the context of the answer on which the
|
|
11309
|
+
* custom action was triggered.
|
|
11310
|
+
*
|
|
11311
|
+
* @example
|
|
11312
|
+
* ```js
|
|
11313
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
11314
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
11315
|
+
* 'col name 1'
|
|
11316
|
+
* ]);
|
|
11317
|
+
* const data = await underlying.fetchData(0, 100);
|
|
11318
|
+
* })
|
|
11319
|
+
* ```
|
|
11320
|
+
* @version
|
|
11321
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
11322
|
+
*/
|
|
11323
|
+
class AnswerService {
|
|
11324
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
11325
|
+
this.session = session;
|
|
11326
|
+
this.answer = answer;
|
|
11327
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
11328
|
+
this.selectedPoints = selectedPoints;
|
|
11329
|
+
this.session = removeTypename(session);
|
|
11330
|
+
}
|
|
11331
|
+
async getSourceDetail() {
|
|
11332
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
11333
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
11334
|
+
}
|
|
11335
|
+
async removeColumns(columnIds) {
|
|
11336
|
+
return this.executeQuery(removeColumns, {
|
|
11337
|
+
logicalColumnIds: columnIds,
|
|
11338
|
+
});
|
|
11339
|
+
}
|
|
11340
|
+
async addColumns(columnIds) {
|
|
11341
|
+
return this.executeQuery(addColumns, {
|
|
11342
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
11343
|
+
});
|
|
11344
|
+
}
|
|
11345
|
+
async fetchData(offset = 0, size = 1000) {
|
|
11346
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
11347
|
+
deadline: 0,
|
|
11348
|
+
dataPaginationParams: {
|
|
11349
|
+
isClientPaginated: true,
|
|
11350
|
+
offset,
|
|
11351
|
+
size,
|
|
11352
|
+
},
|
|
11353
|
+
});
|
|
11354
|
+
const { columns, data } = answer.visualizations[0];
|
|
11355
|
+
return {
|
|
11356
|
+
columns,
|
|
11357
|
+
data,
|
|
11358
|
+
};
|
|
11359
|
+
}
|
|
11360
|
+
/**
|
|
11361
|
+
*
|
|
11362
|
+
* @param userLocale
|
|
11363
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
11364
|
+
* @returns Response
|
|
11365
|
+
*/
|
|
11366
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
11367
|
+
if (omitInfo) {
|
|
11368
|
+
console.warn('omitInfo not supported yet.');
|
|
11085
11369
|
}
|
|
11086
|
-
|
|
11087
|
-
|
|
11370
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
11371
|
+
return fetch(fetchUrl, {
|
|
11372
|
+
credentials: 'include',
|
|
11373
|
+
});
|
|
11374
|
+
}
|
|
11375
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
11376
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
11377
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
11088
11378
|
}
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
|
|
11379
|
+
if (!selectedPoints) {
|
|
11380
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
11381
|
+
}
|
|
11382
|
+
const sourceDetail = await this.getSourceDetail();
|
|
11383
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
11384
|
+
const unAggAnswer = await graphqlQuery({
|
|
11385
|
+
query: getUnaggregatedAnswerSession,
|
|
11386
|
+
variables: {
|
|
11387
|
+
session: this.session,
|
|
11388
|
+
columns: selectedPoints,
|
|
11389
|
+
},
|
|
11390
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11391
|
+
});
|
|
11392
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
11393
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
11394
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
11395
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
11396
|
+
if (columnsToAdd.length) {
|
|
11397
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
11398
|
+
}
|
|
11399
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
11400
|
+
if (columnsToRemove.length) {
|
|
11401
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
11402
|
+
}
|
|
11403
|
+
return unaggAnswerSession;
|
|
11404
|
+
}
|
|
11405
|
+
async executeQuery(query, variables) {
|
|
11406
|
+
const data = await graphqlQuery({
|
|
11407
|
+
query,
|
|
11408
|
+
variables: {
|
|
11409
|
+
session: this.session,
|
|
11410
|
+
...variables,
|
|
11411
|
+
},
|
|
11412
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11413
|
+
isCompositeQuery: false,
|
|
11414
|
+
});
|
|
11415
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
11416
|
+
return data;
|
|
11417
|
+
}
|
|
11418
|
+
getSession() {
|
|
11419
|
+
return this.session;
|
|
11420
|
+
}
|
|
11421
|
+
}
|
|
11422
|
+
/**
|
|
11423
|
+
*
|
|
11424
|
+
* @param sourceDetail
|
|
11425
|
+
* @param colNames
|
|
11426
|
+
*/
|
|
11427
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
11428
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
11429
|
+
colSet[col.name] = col;
|
|
11430
|
+
return colSet;
|
|
11431
|
+
}, {});
|
|
11432
|
+
return new Set(colNames.map((colName) => {
|
|
11433
|
+
const col = cols[colName];
|
|
11434
|
+
return col.id;
|
|
11435
|
+
}));
|
|
11436
|
+
}
|
|
11437
|
+
/**
|
|
11438
|
+
*
|
|
11439
|
+
* @param selectedPoints
|
|
11440
|
+
*/
|
|
11441
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
11442
|
+
const underlyingDataPoint = [];
|
|
11443
|
+
/**
|
|
11444
|
+
*
|
|
11445
|
+
* @param colVal
|
|
11446
|
+
*/
|
|
11447
|
+
function addPointFromColVal(colVal) {
|
|
11448
|
+
const dataType = colVal.column.dataType;
|
|
11449
|
+
const id = colVal.column.id;
|
|
11450
|
+
let dataValue;
|
|
11451
|
+
if (dataType === 'DATE') {
|
|
11452
|
+
dataValue = [{
|
|
11453
|
+
epochRange: {
|
|
11454
|
+
startEpoch: colVal.value,
|
|
11455
|
+
},
|
|
11456
|
+
}];
|
|
11093
11457
|
}
|
|
11094
11458
|
else {
|
|
11095
|
-
|
|
11096
|
-
dataPaginationParams: {
|
|
11097
|
-
isClientPaginated: true,
|
|
11098
|
-
offset: offset * batchSize,
|
|
11099
|
-
size: batchSize,
|
|
11100
|
-
},
|
|
11101
|
-
};
|
|
11459
|
+
dataValue = [{ value: colVal.value }];
|
|
11102
11460
|
}
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11461
|
+
underlyingDataPoint.push({
|
|
11462
|
+
columnId: colVal.column.id,
|
|
11463
|
+
dataValue,
|
|
11106
11464
|
});
|
|
11107
|
-
}
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
};
|
|
11465
|
+
}
|
|
11466
|
+
selectedPoints.forEach((p) => {
|
|
11467
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
11468
|
+
});
|
|
11469
|
+
return underlyingDataPoint;
|
|
11111
11470
|
}
|
|
11112
11471
|
|
|
11113
11472
|
/**
|
|
@@ -11116,16 +11475,12 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
|
11116
11475
|
* @param thoughtSpotHost
|
|
11117
11476
|
*/
|
|
11118
11477
|
function processCustomAction(e, thoughtSpotHost) {
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
answerService,
|
|
11126
|
-
};
|
|
11127
|
-
}
|
|
11128
|
-
return e;
|
|
11478
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
11479
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
11480
|
+
return {
|
|
11481
|
+
...e,
|
|
11482
|
+
answerService,
|
|
11483
|
+
};
|
|
11129
11484
|
}
|
|
11130
11485
|
/**
|
|
11131
11486
|
*
|
|
@@ -11270,7 +11625,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
11270
11625
|
});
|
|
11271
11626
|
}
|
|
11272
11627
|
|
|
11273
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-
|
|
11628
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/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","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","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":"6.7.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-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};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,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
11274
11629
|
|
|
11275
11630
|
/**
|
|
11276
11631
|
* Copyright (c) 2022
|
|
@@ -11302,6 +11657,7 @@ const V1EventMap = {};
|
|
|
11302
11657
|
class TsEmbed {
|
|
11303
11658
|
constructor(domSelector, viewConfig) {
|
|
11304
11659
|
this.isAppInitialized = false;
|
|
11660
|
+
this.embedComponentType = 'TsEmbed';
|
|
11305
11661
|
/**
|
|
11306
11662
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
11307
11663
|
* will generate for embedding. This provides additional security to
|
|
@@ -11311,6 +11667,7 @@ class TsEmbed {
|
|
|
11311
11667
|
*/
|
|
11312
11668
|
this.shouldEncodeUrlQueryParams = false;
|
|
11313
11669
|
this.defaultHiddenActions = [Action.ReportError];
|
|
11670
|
+
this.subscribedListeners = {};
|
|
11314
11671
|
/**
|
|
11315
11672
|
* Send Custom style as part of payload of APP_INIT
|
|
11316
11673
|
*
|
|
@@ -11333,6 +11690,7 @@ class TsEmbed {
|
|
|
11333
11690
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
11334
11691
|
: null,
|
|
11335
11692
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
11693
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
11336
11694
|
hostConfig: this.embedConfig.hostConfig,
|
|
11337
11695
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
11338
11696
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -11382,6 +11740,7 @@ class TsEmbed {
|
|
|
11382
11740
|
this.registerAppInit();
|
|
11383
11741
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
11384
11742
|
...viewConfig,
|
|
11743
|
+
embedComponentType: this.embedComponentType,
|
|
11385
11744
|
});
|
|
11386
11745
|
}
|
|
11387
11746
|
/**
|
|
@@ -11450,23 +11809,37 @@ class TsEmbed {
|
|
|
11450
11809
|
* and executes the registered callbacks accordingly.
|
|
11451
11810
|
*/
|
|
11452
11811
|
subscribeToEvents() {
|
|
11453
|
-
|
|
11812
|
+
this.unsubscribeToEvents();
|
|
11813
|
+
const messageEventListener = (event) => {
|
|
11454
11814
|
const eventType = this.getEventType(event);
|
|
11455
11815
|
const eventPort = this.getEventPort(event);
|
|
11456
11816
|
const eventData = this.formatEventData(event, eventType);
|
|
11457
11817
|
if (event.source === this.iFrame.contentWindow) {
|
|
11458
11818
|
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.el), eventPort);
|
|
11459
11819
|
}
|
|
11460
|
-
}
|
|
11461
|
-
window.addEventListener('
|
|
11820
|
+
};
|
|
11821
|
+
window.addEventListener('message', messageEventListener);
|
|
11822
|
+
const onlineEventListener = (e) => {
|
|
11462
11823
|
this.trigger(HostEvent.Reload);
|
|
11463
|
-
}
|
|
11464
|
-
window.addEventListener('
|
|
11824
|
+
};
|
|
11825
|
+
window.addEventListener('online', onlineEventListener);
|
|
11826
|
+
const offlineEventListener = (e) => {
|
|
11465
11827
|
const offlineWarning = 'Network not Detected. Embed is offline. Please reconnect and refresh';
|
|
11466
11828
|
this.executeCallbacks(EmbedEvent.Error, {
|
|
11467
11829
|
offlineWarning,
|
|
11468
11830
|
});
|
|
11469
11831
|
console.warn(offlineWarning);
|
|
11832
|
+
};
|
|
11833
|
+
window.addEventListener('offline', offlineEventListener);
|
|
11834
|
+
this.subscribedListeners = {
|
|
11835
|
+
message: messageEventListener,
|
|
11836
|
+
online: onlineEventListener,
|
|
11837
|
+
offline: offlineEventListener,
|
|
11838
|
+
};
|
|
11839
|
+
}
|
|
11840
|
+
unsubscribeToEvents() {
|
|
11841
|
+
Object.keys(this.subscribedListeners).forEach((key) => {
|
|
11842
|
+
window.removeEventListener(key, this.subscribedListeners[key]);
|
|
11470
11843
|
});
|
|
11471
11844
|
}
|
|
11472
11845
|
/**
|
|
@@ -11638,14 +12011,22 @@ class TsEmbed {
|
|
|
11638
12011
|
iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
11639
12012
|
return iFrame;
|
|
11640
12013
|
}
|
|
12014
|
+
handleInsertionIntoDOM(child, showPreRenderByDefault = false) {
|
|
12015
|
+
if (this.isPreRendered) {
|
|
12016
|
+
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
|
|
12017
|
+
}
|
|
12018
|
+
else {
|
|
12019
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
12020
|
+
}
|
|
12021
|
+
}
|
|
11641
12022
|
/**
|
|
11642
12023
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
11643
12024
|
* event listeners.
|
|
11644
12025
|
*
|
|
11645
|
-
* @param url
|
|
11646
|
-
* @param
|
|
12026
|
+
* @param url - The URL of the embedded ThoughtSpot app.
|
|
12027
|
+
* @param showPreRenderByDefault - The flag to show the preRender by default.
|
|
11647
12028
|
*/
|
|
11648
|
-
async renderIFrame(url) {
|
|
12029
|
+
async renderIFrame(url, showPreRenderByDefault = false) {
|
|
11649
12030
|
if (this.isError) {
|
|
11650
12031
|
return null;
|
|
11651
12032
|
}
|
|
@@ -11665,12 +12046,7 @@ class TsEmbed {
|
|
|
11665
12046
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
11666
12047
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
11667
12048
|
if (!isLoggedIn) {
|
|
11668
|
-
|
|
11669
|
-
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage);
|
|
11670
|
-
}
|
|
11671
|
-
else {
|
|
11672
|
-
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11673
|
-
}
|
|
12049
|
+
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
|
|
11674
12050
|
return;
|
|
11675
12051
|
}
|
|
11676
12052
|
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
@@ -11692,12 +12068,7 @@ class TsEmbed {
|
|
|
11692
12068
|
this.iFrame.addEventListener('error', () => {
|
|
11693
12069
|
nextInQueue();
|
|
11694
12070
|
});
|
|
11695
|
-
|
|
11696
|
-
this.insertIntoDOMForPreRender(this.iFrame);
|
|
11697
|
-
}
|
|
11698
|
-
else {
|
|
11699
|
-
this.insertIntoDOM(this.iFrame);
|
|
11700
|
-
}
|
|
12071
|
+
this.handleInsertionIntoDOM(this.iFrame, showPreRenderByDefault);
|
|
11701
12072
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
11702
12073
|
if (prefetchIframe.length) {
|
|
11703
12074
|
prefetchIframe.forEach((el) => {
|
|
@@ -11710,12 +12081,7 @@ class TsEmbed {
|
|
|
11710
12081
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
11711
12082
|
error: JSON.stringify(error),
|
|
11712
12083
|
});
|
|
11713
|
-
|
|
11714
|
-
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage);
|
|
11715
|
-
}
|
|
11716
|
-
else {
|
|
11717
|
-
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11718
|
-
}
|
|
12084
|
+
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11719
12085
|
this.handleError(error);
|
|
11720
12086
|
});
|
|
11721
12087
|
});
|
|
@@ -11729,40 +12095,46 @@ class TsEmbed {
|
|
|
11729
12095
|
}
|
|
11730
12096
|
createPreRenderWrapper(child) {
|
|
11731
12097
|
if (!this.viewConfig.preRenderId) {
|
|
11732
|
-
throw new Error('
|
|
12098
|
+
throw new Error('PreRender id is required');
|
|
11733
12099
|
}
|
|
11734
12100
|
const preRenderIds = this.getPreRenderIds();
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
}
|
|
12101
|
+
[preRenderIds.wrapper, preRenderIds.shield, preRenderIds.child]
|
|
12102
|
+
.map((id) => document.getElementById(id))
|
|
12103
|
+
.filter((element) => element)
|
|
12104
|
+
.forEach((existingElement) => existingElement.remove());
|
|
11740
12105
|
const preRenderWrapper = document.createElement('div');
|
|
11741
12106
|
preRenderWrapper.id = preRenderIds.wrapper;
|
|
11742
12107
|
setStyleProperties(preRenderWrapper, { position: 'absolute', width: '100vw', height: '100vh' });
|
|
11743
|
-
const preRenderShield = document.createElement('div');
|
|
11744
|
-
preRenderShield.id = preRenderIds.shield;
|
|
11745
|
-
setStyleProperties(preRenderShield, { position: 'absolute',
|
|
12108
|
+
// const preRenderShield = document.createElement('div');
|
|
12109
|
+
// preRenderShield.id = preRenderIds.shield;
|
|
12110
|
+
// setStyleProperties(preRenderShield, { position: 'absolute',
|
|
12111
|
+
// width: '100%', height: '100%' });
|
|
11746
12112
|
child.id = preRenderIds.child;
|
|
11747
12113
|
preRenderWrapper.appendChild(child);
|
|
11748
|
-
preRenderWrapper.appendChild(preRenderShield);
|
|
12114
|
+
// preRenderWrapper.appendChild(preRenderShield);
|
|
11749
12115
|
this.preRenderWrapper = preRenderWrapper;
|
|
11750
|
-
this.preRenderShield = preRenderShield;
|
|
12116
|
+
// this.preRenderShield = preRenderShield;
|
|
11751
12117
|
this.preRenderChild = child;
|
|
11752
12118
|
return preRenderWrapper;
|
|
11753
12119
|
}
|
|
11754
|
-
|
|
12120
|
+
connectPreRendered() {
|
|
11755
12121
|
const preRenderIds = this.getPreRenderIds();
|
|
11756
12122
|
this.preRenderWrapper = this.preRenderWrapper
|
|
11757
12123
|
|| document.getElementById(preRenderIds.wrapper);
|
|
11758
|
-
this.preRenderShield = this.preRenderShield
|
|
11759
|
-
|
|
12124
|
+
// this.preRenderShield = this.preRenderShield
|
|
12125
|
+
// || document.getElementById(preRenderIds.shield);
|
|
11760
12126
|
this.preRenderChild = this.preRenderChild
|
|
11761
12127
|
|| document.getElementById(preRenderIds.child);
|
|
11762
|
-
|
|
11763
|
-
|
|
12128
|
+
if (this.preRenderWrapper && this.preRenderChild) {
|
|
12129
|
+
this.isPreRendered = true;
|
|
12130
|
+
this.iFrame = this.preRenderChild;
|
|
12131
|
+
}
|
|
12132
|
+
return this.isPreRenderAvailable();
|
|
11764
12133
|
}
|
|
11765
|
-
|
|
12134
|
+
isPreRenderAvailable() {
|
|
12135
|
+
return this.isPreRendered;
|
|
12136
|
+
}
|
|
12137
|
+
insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
|
|
11766
12138
|
let childNode;
|
|
11767
12139
|
if (typeof child === 'string') {
|
|
11768
12140
|
const divChildNode = document.createElement('div');
|
|
@@ -11773,8 +12145,13 @@ class TsEmbed {
|
|
|
11773
12145
|
childNode = child;
|
|
11774
12146
|
}
|
|
11775
12147
|
const preRenderWrapper = this.createPreRenderWrapper(childNode);
|
|
12148
|
+
if (showPreRenderByDefault) {
|
|
12149
|
+
this.showPreRender();
|
|
12150
|
+
}
|
|
12151
|
+
else {
|
|
12152
|
+
this.hidePreRender();
|
|
12153
|
+
}
|
|
11776
12154
|
document.body.appendChild(preRenderWrapper);
|
|
11777
|
-
this.hidePreRender();
|
|
11778
12155
|
}
|
|
11779
12156
|
hidePreRender() {
|
|
11780
12157
|
if (!this.isPreRenderAvailable()) {
|
|
@@ -11791,28 +12168,33 @@ class TsEmbed {
|
|
|
11791
12168
|
left: '0',
|
|
11792
12169
|
});
|
|
11793
12170
|
const childBoundingRect = this.preRenderChild.getBoundingClientRect();
|
|
11794
|
-
setStyleProperties(this.preRenderShield, {
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
});
|
|
12171
|
+
// setStyleProperties(this.preRenderShield, {
|
|
12172
|
+
// opacity: '0',
|
|
12173
|
+
// pointerEvents: 'none',
|
|
12174
|
+
// zIndex: '1',
|
|
12175
|
+
// width: `${childBoundingRect.width}px`,
|
|
12176
|
+
// height: `${childBoundingRect.height}px`,
|
|
12177
|
+
// position: 'absolute',
|
|
12178
|
+
// top: '0',
|
|
12179
|
+
// left: '0',
|
|
12180
|
+
// });
|
|
12181
|
+
this.unsubscribeToEvents();
|
|
11804
12182
|
}
|
|
11805
12183
|
showPreRender() {
|
|
11806
12184
|
if (!this.isPreRenderAvailable()) {
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
12185
|
+
const isAvailable = this.connectPreRendered();
|
|
12186
|
+
if (!isAvailable) {
|
|
12187
|
+
// if the Embed component is nor preRendered , Render it now and
|
|
12188
|
+
// show it (hide is defalt behaviour)
|
|
12189
|
+
console.log('No preRender found, creating new ');
|
|
12190
|
+
this.preRender(true);
|
|
12191
|
+
return;
|
|
12192
|
+
}
|
|
11812
12193
|
}
|
|
11813
12194
|
this.syncPreRenderStyle();
|
|
11814
12195
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
11815
|
-
setStyleProperties(this.preRenderShield, { zIndex: '-1' });
|
|
12196
|
+
// setStyleProperties(this.preRenderShield, { zIndex: '-1' });
|
|
12197
|
+
this.subscribeToEvents();
|
|
11816
12198
|
}
|
|
11817
12199
|
syncPreRenderStyle() {
|
|
11818
12200
|
if (!this.el) {
|
|
@@ -12039,8 +12421,10 @@ class TsEmbed {
|
|
|
12039
12421
|
}
|
|
12040
12422
|
/**
|
|
12041
12423
|
* Creates the preRender shell
|
|
12424
|
+
*
|
|
12425
|
+
* @param showPreRenderByDefault
|
|
12042
12426
|
*/
|
|
12043
|
-
preRender() {
|
|
12427
|
+
preRender(showPreRenderByDefault = false) {
|
|
12044
12428
|
this.isPreRendered = true;
|
|
12045
12429
|
return this;
|
|
12046
12430
|
}
|
|
@@ -12079,6 +12463,7 @@ class TsEmbed {
|
|
|
12079
12463
|
var _a;
|
|
12080
12464
|
try {
|
|
12081
12465
|
(_a = this.insertedDomEl) === null || _a === void 0 ? void 0 : _a.parentNode.removeChild(this.insertedDomEl);
|
|
12466
|
+
this.unsubscribeToEvents();
|
|
12082
12467
|
}
|
|
12083
12468
|
catch (e) {
|
|
12084
12469
|
console.log('Error destroying TS Embed', e);
|
|
@@ -12116,9 +12501,10 @@ class V1Embed extends TsEmbed {
|
|
|
12116
12501
|
* Render the app in an iframe and set up event handlers
|
|
12117
12502
|
*
|
|
12118
12503
|
* @param iframeSrc
|
|
12504
|
+
* @param showPreRenderByDefault - if true the preRender will be shown by default
|
|
12119
12505
|
*/
|
|
12120
|
-
renderV1Embed(iframeSrc) {
|
|
12121
|
-
return this.renderIFrame(iframeSrc);
|
|
12506
|
+
renderV1Embed(iframeSrc, showPreRenderByDefault = false) {
|
|
12507
|
+
return this.renderIFrame(iframeSrc, showPreRenderByDefault);
|
|
12122
12508
|
}
|
|
12123
12509
|
getRootIframeSrc() {
|
|
12124
12510
|
const queryParams = this.getEmbedParams();
|
|
@@ -12210,6 +12596,7 @@ class AppEmbed extends V1Embed {
|
|
|
12210
12596
|
constructor(domSelector, viewConfig) {
|
|
12211
12597
|
super(domSelector, viewConfig);
|
|
12212
12598
|
this.defaultHeight = '100%';
|
|
12599
|
+
this.embedComponentType = 'AppEmbed';
|
|
12213
12600
|
/**
|
|
12214
12601
|
* Set the iframe height as per the computed height received
|
|
12215
12602
|
* from the ThoughtSpot app.
|
|
@@ -12360,11 +12747,17 @@ class AppEmbed extends V1Embed {
|
|
|
12360
12747
|
*
|
|
12361
12748
|
* @param renderOptions An object containing the page ID
|
|
12362
12749
|
* to be embedded.
|
|
12750
|
+
* @param showPreRenderByDefault
|
|
12363
12751
|
*/
|
|
12364
|
-
render() {
|
|
12752
|
+
render(showPreRenderByDefault = false) {
|
|
12365
12753
|
super.render();
|
|
12366
12754
|
const src = this.getIFrameSrc();
|
|
12367
|
-
this.renderV1Embed(src);
|
|
12755
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
12756
|
+
return this;
|
|
12757
|
+
}
|
|
12758
|
+
preRender(showPreRenderByDefault = false) {
|
|
12759
|
+
super.preRender(showPreRenderByDefault);
|
|
12760
|
+
this.render(showPreRenderByDefault);
|
|
12368
12761
|
return this;
|
|
12369
12762
|
}
|
|
12370
12763
|
}
|
|
@@ -12399,6 +12792,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12399
12792
|
constructor(domSelector, viewConfig) {
|
|
12400
12793
|
super(domSelector, viewConfig);
|
|
12401
12794
|
this.defaultHeight = 500;
|
|
12795
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
12402
12796
|
/**
|
|
12403
12797
|
* Set the iframe height as per the computed height received
|
|
12404
12798
|
* from the ThoughtSpot app.
|
|
@@ -12520,15 +12914,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12520
12914
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
12521
12915
|
* visualization ID and the runtime filters.
|
|
12522
12916
|
*/
|
|
12523
|
-
render() {
|
|
12917
|
+
render(showPreRenderByDefault = false) {
|
|
12524
12918
|
super.render();
|
|
12525
12919
|
const src = this.getIFrameSrc();
|
|
12526
|
-
this.renderV1Embed(src);
|
|
12920
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
12527
12921
|
return this;
|
|
12528
12922
|
}
|
|
12529
|
-
preRender() {
|
|
12530
|
-
super.preRender();
|
|
12531
|
-
this.render();
|
|
12923
|
+
preRender(showPreRenderByDefault = false) {
|
|
12924
|
+
super.preRender(showPreRenderByDefault);
|
|
12925
|
+
this.render(showPreRenderByDefault);
|
|
12532
12926
|
return this;
|
|
12533
12927
|
}
|
|
12534
12928
|
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
@@ -12573,6 +12967,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
12573
12967
|
class SearchEmbed extends TsEmbed {
|
|
12574
12968
|
constructor(domSelector, viewConfig) {
|
|
12575
12969
|
super(domSelector);
|
|
12970
|
+
this.embedComponentType = 'SearchEmbed';
|
|
12576
12971
|
this.viewConfig = viewConfig;
|
|
12577
12972
|
}
|
|
12578
12973
|
/**
|
|
@@ -12653,12 +13048,14 @@ class SearchEmbed extends TsEmbed {
|
|
|
12653
13048
|
}
|
|
12654
13049
|
/**
|
|
12655
13050
|
* Render the embedded ThoughtSpot search
|
|
13051
|
+
*
|
|
13052
|
+
* @param showPreRenderByDefault
|
|
12656
13053
|
*/
|
|
12657
|
-
render() {
|
|
13054
|
+
render(showPreRenderByDefault = false) {
|
|
12658
13055
|
super.render();
|
|
12659
13056
|
const { answerId } = this.viewConfig;
|
|
12660
13057
|
const src = this.getIFrameSrc(answerId);
|
|
12661
|
-
this.renderIFrame(src);
|
|
13058
|
+
this.renderIFrame(src, showPreRenderByDefault);
|
|
12662
13059
|
getAuthPromise().then(() => {
|
|
12663
13060
|
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
12664
13061
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
@@ -12666,6 +13063,11 @@ class SearchEmbed extends TsEmbed {
|
|
|
12666
13063
|
});
|
|
12667
13064
|
return this;
|
|
12668
13065
|
}
|
|
13066
|
+
preRender(showPreRenderByDefault = false) {
|
|
13067
|
+
super.preRender(showPreRenderByDefault);
|
|
13068
|
+
this.render(showPreRenderByDefault);
|
|
13069
|
+
return this;
|
|
13070
|
+
}
|
|
12669
13071
|
}
|
|
12670
13072
|
|
|
12671
13073
|
/**
|
|
@@ -12677,6 +13079,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
12677
13079
|
class SearchBarEmbed extends TsEmbed {
|
|
12678
13080
|
constructor(domSelector, viewConfig) {
|
|
12679
13081
|
super(domSelector);
|
|
13082
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
12680
13083
|
this.viewConfig = viewConfig;
|
|
12681
13084
|
}
|
|
12682
13085
|
/**
|
|
@@ -12755,6 +13158,7 @@ class SageEmbed extends V1Embed {
|
|
|
12755
13158
|
// eslint-disable-next-line no-useless-constructor
|
|
12756
13159
|
constructor(domSelector, viewConfig) {
|
|
12757
13160
|
super(domSelector, viewConfig);
|
|
13161
|
+
this.embedComponentType = 'SageEmbed';
|
|
12758
13162
|
}
|
|
12759
13163
|
/**
|
|
12760
13164
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -12806,14 +13210,20 @@ class SageEmbed extends V1Embed {
|
|
|
12806
13210
|
/**
|
|
12807
13211
|
* Render the embedded ThoughtSpot Sage
|
|
12808
13212
|
*
|
|
13213
|
+
* @param showPreRenderByDefault
|
|
12809
13214
|
* @returns {SageEmbed} Eureka/Sage embed
|
|
12810
13215
|
*/
|
|
12811
|
-
render() {
|
|
13216
|
+
render(showPreRenderByDefault = false) {
|
|
12812
13217
|
super.render();
|
|
12813
13218
|
const src = this.getIFrameSrc();
|
|
12814
|
-
this.renderV1Embed(src);
|
|
13219
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
13220
|
+
return this;
|
|
13221
|
+
}
|
|
13222
|
+
preRender(showPreRenderByDefault = false) {
|
|
13223
|
+
super.preRender(showPreRenderByDefault);
|
|
13224
|
+
this.render(showPreRenderByDefault);
|
|
12815
13225
|
return this;
|
|
12816
13226
|
}
|
|
12817
13227
|
}
|
|
12818
13228
|
|
|
12819
|
-
export { Action, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
|
|
13229
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
|