@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.js
CHANGED
|
@@ -4,6 +4,50 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.tsembed = {}));
|
|
5
5
|
}(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
// istanbul ignore next
|
|
8
|
+
const isObject = (obj) => {
|
|
9
|
+
if (typeof obj === "object" && obj !== null) {
|
|
10
|
+
if (typeof Object.getPrototypeOf === "function") {
|
|
11
|
+
const prototype = Object.getPrototypeOf(obj);
|
|
12
|
+
return prototype === Object.prototype || prototype === null;
|
|
13
|
+
}
|
|
14
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
const merge = (...objects) => objects.reduce((result, current) => {
|
|
19
|
+
if (Array.isArray(current)) {
|
|
20
|
+
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
21
|
+
}
|
|
22
|
+
Object.keys(current).forEach((key) => {
|
|
23
|
+
if (["__proto__", "constructor", "prototype"].includes(key)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
27
|
+
result[key] = merge.options.mergeArrays
|
|
28
|
+
? Array.from(new Set(result[key].concat(current[key])))
|
|
29
|
+
: current[key];
|
|
30
|
+
}
|
|
31
|
+
else if (isObject(result[key]) && isObject(current[key])) {
|
|
32
|
+
result[key] = merge(result[key], current[key]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
result[key] = current[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return result;
|
|
39
|
+
}, {});
|
|
40
|
+
const defaultOptions = {
|
|
41
|
+
mergeArrays: true,
|
|
42
|
+
};
|
|
43
|
+
merge.options = defaultOptions;
|
|
44
|
+
merge.withOptions = (options, ...objects) => {
|
|
45
|
+
merge.options = Object.assign({ mergeArrays: true }, options);
|
|
46
|
+
const result = merge(...objects);
|
|
47
|
+
merge.options = defaultOptions;
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
|
|
7
51
|
/**
|
|
8
52
|
* Copyright (c) 2023
|
|
9
53
|
*
|
|
@@ -200,6 +244,30 @@
|
|
|
200
244
|
function getDOMNode(domSelector) {
|
|
201
245
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
202
246
|
}
|
|
247
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
248
|
+
const getOperationNameFromQuery = (query) => {
|
|
249
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
250
|
+
const matches = query.match(regex);
|
|
251
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* @param obj
|
|
256
|
+
*/
|
|
257
|
+
function removeTypename(obj) {
|
|
258
|
+
if (!obj || typeof obj !== 'object')
|
|
259
|
+
return obj;
|
|
260
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
261
|
+
for (const key in obj) {
|
|
262
|
+
if (key === '__typename') {
|
|
263
|
+
delete obj[key];
|
|
264
|
+
}
|
|
265
|
+
else if (typeof obj[key] === 'object') {
|
|
266
|
+
removeTypename(obj[key]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return obj;
|
|
270
|
+
}
|
|
203
271
|
const setStyleProperties = (element, styleProperties) => {
|
|
204
272
|
if (!element || !styleProperties)
|
|
205
273
|
return;
|
|
@@ -457,27 +525,27 @@
|
|
|
457
525
|
/**
|
|
458
526
|
* Search bar
|
|
459
527
|
*/
|
|
460
|
-
HomepageModule["Search"] = "
|
|
528
|
+
HomepageModule["Search"] = "SEARCH";
|
|
461
529
|
/**
|
|
462
530
|
* kPI watchlist module
|
|
463
531
|
*/
|
|
464
|
-
HomepageModule["Watchlist"] = "
|
|
532
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
465
533
|
/**
|
|
466
534
|
* favorite objects
|
|
467
535
|
*/
|
|
468
|
-
HomepageModule["Favorite"] = "
|
|
536
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
469
537
|
/**
|
|
470
538
|
* List of answers and liveboards
|
|
471
539
|
*/
|
|
472
|
-
HomepageModule["MyLibrary"] = "
|
|
540
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
473
541
|
/**
|
|
474
542
|
* Trending list
|
|
475
543
|
*/
|
|
476
|
-
HomepageModule["Trending"] = "
|
|
544
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
477
545
|
/**
|
|
478
546
|
* Learning videos
|
|
479
547
|
*/
|
|
480
|
-
HomepageModule["Learning"] = "
|
|
548
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
481
549
|
})(exports.HomepageModule || (exports.HomepageModule = {}));
|
|
482
550
|
(function (EmbedEvent) {
|
|
483
551
|
/**
|
|
@@ -2544,12 +2612,6 @@
|
|
|
2544
2612
|
*/
|
|
2545
2613
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2546
2614
|
})(exports.Action || (exports.Action = {}));
|
|
2547
|
-
// eslint-disable-next-line no-shadow
|
|
2548
|
-
var OperationType;
|
|
2549
|
-
(function (OperationType) {
|
|
2550
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2551
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2552
|
-
})(OperationType || (OperationType = {}));
|
|
2553
2615
|
(function (PrefetchFeatures) {
|
|
2554
2616
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
2555
2617
|
PrefetchFeatures["SearchEmbed"] = "SearchEmbed";
|
|
@@ -8660,6 +8722,7 @@
|
|
|
8660
8722
|
* @param sessionInfo
|
|
8661
8723
|
*/
|
|
8662
8724
|
function initMixpanel(sessionInfo) {
|
|
8725
|
+
var _a;
|
|
8663
8726
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8664
8727
|
return;
|
|
8665
8728
|
}
|
|
@@ -8677,6 +8740,7 @@
|
|
|
8677
8740
|
clusterId: sessionInfo.clusterId,
|
|
8678
8741
|
clusterName: sessionInfo.clusterName,
|
|
8679
8742
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8743
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8680
8744
|
});
|
|
8681
8745
|
isMixpanelInitialized = true;
|
|
8682
8746
|
emptyQueue();
|
|
@@ -9169,12 +9233,12 @@
|
|
|
9169
9233
|
* _.isObject(null);
|
|
9170
9234
|
* // => false
|
|
9171
9235
|
*/
|
|
9172
|
-
function isObject(value) {
|
|
9236
|
+
function isObject$1(value) {
|
|
9173
9237
|
var type = typeof value;
|
|
9174
9238
|
return value != null && (type == 'object' || type == 'function');
|
|
9175
9239
|
}
|
|
9176
9240
|
|
|
9177
|
-
var isObject_1 = isObject;
|
|
9241
|
+
var isObject_1 = isObject$1;
|
|
9178
9242
|
|
|
9179
9243
|
/** `Object#toString` result references. */
|
|
9180
9244
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -10005,9 +10069,9 @@
|
|
|
10005
10069
|
var _cacheHas = cacheHas;
|
|
10006
10070
|
|
|
10007
10071
|
/* Built-in method references that are verified to be native. */
|
|
10008
|
-
var Set = _getNative(_root, 'Set');
|
|
10072
|
+
var Set$1 = _getNative(_root, 'Set');
|
|
10009
10073
|
|
|
10010
|
-
var _Set = Set;
|
|
10074
|
+
var _Set = Set$1;
|
|
10011
10075
|
|
|
10012
10076
|
/**
|
|
10013
10077
|
* This method returns `undefined`.
|
|
@@ -10846,6 +10910,7 @@
|
|
|
10846
10910
|
*
|
|
10847
10911
|
* @param data
|
|
10848
10912
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
10913
|
+
* @group Global methods
|
|
10849
10914
|
*/
|
|
10850
10915
|
const executeTML = async (data) => {
|
|
10851
10916
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10893,6 +10958,7 @@
|
|
|
10893
10958
|
*
|
|
10894
10959
|
* @param data
|
|
10895
10960
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
10961
|
+
* @group Global methods
|
|
10896
10962
|
*/
|
|
10897
10963
|
const exportTML = async (data) => {
|
|
10898
10964
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10938,58 +11004,351 @@
|
|
|
10938
11004
|
|
|
10939
11005
|
/**
|
|
10940
11006
|
*
|
|
10941
|
-
* @param
|
|
10942
|
-
* @param query
|
|
10943
|
-
* @param
|
|
11007
|
+
* @param root0
|
|
11008
|
+
* @param root0.query
|
|
11009
|
+
* @param root0.variables
|
|
11010
|
+
* @param root0.thoughtSpotHost
|
|
11011
|
+
* @param root0.isCompositeQuery
|
|
11012
|
+
*/
|
|
11013
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
11014
|
+
const operationName = getOperationNameFromQuery(query);
|
|
11015
|
+
try {
|
|
11016
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
11017
|
+
method: 'POST',
|
|
11018
|
+
headers: {
|
|
11019
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
11020
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11021
|
+
accept: '*/*',
|
|
11022
|
+
'accept-language': 'en-us',
|
|
11023
|
+
},
|
|
11024
|
+
body: JSON.stringify({
|
|
11025
|
+
operationName,
|
|
11026
|
+
query,
|
|
11027
|
+
variables,
|
|
11028
|
+
}),
|
|
11029
|
+
credentials: 'include',
|
|
11030
|
+
});
|
|
11031
|
+
const result = await response.json();
|
|
11032
|
+
const dataValues = Object.values(result.data);
|
|
11033
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
11034
|
+
}
|
|
11035
|
+
catch (error) {
|
|
11036
|
+
return error;
|
|
11037
|
+
}
|
|
11038
|
+
}
|
|
11039
|
+
|
|
11040
|
+
const getSourceDetailQuery = `
|
|
11041
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
11042
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
11043
|
+
id
|
|
11044
|
+
name
|
|
11045
|
+
description
|
|
11046
|
+
authorName
|
|
11047
|
+
authorDisplayName
|
|
11048
|
+
isExternal
|
|
11049
|
+
type
|
|
11050
|
+
created
|
|
11051
|
+
modified
|
|
11052
|
+
columns {
|
|
11053
|
+
id
|
|
11054
|
+
name
|
|
11055
|
+
author
|
|
11056
|
+
authorDisplayName
|
|
11057
|
+
description
|
|
11058
|
+
dataType
|
|
11059
|
+
type
|
|
11060
|
+
modified
|
|
11061
|
+
ownerName
|
|
11062
|
+
owner
|
|
11063
|
+
dataRecency
|
|
11064
|
+
sources {
|
|
11065
|
+
tableId
|
|
11066
|
+
tableName
|
|
11067
|
+
columnId
|
|
11068
|
+
columnName
|
|
11069
|
+
__typename
|
|
11070
|
+
}
|
|
11071
|
+
synonyms
|
|
11072
|
+
cohortAnswerId
|
|
11073
|
+
__typename
|
|
11074
|
+
}
|
|
11075
|
+
relationships
|
|
11076
|
+
destinationRelationships
|
|
11077
|
+
dataSourceId
|
|
11078
|
+
__typename
|
|
11079
|
+
}
|
|
11080
|
+
}
|
|
11081
|
+
`;
|
|
11082
|
+
const sourceDetailCache = new Map();
|
|
11083
|
+
/**
|
|
11084
|
+
*
|
|
10944
11085
|
* @param thoughtSpotHost
|
|
11086
|
+
* @param sourceId
|
|
10945
11087
|
*/
|
|
10946
|
-
function
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
11088
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
11089
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
11090
|
+
return sourceDetailCache.get(sourceId);
|
|
11091
|
+
}
|
|
11092
|
+
const details = await graphqlQuery({
|
|
11093
|
+
query: getSourceDetailQuery,
|
|
11094
|
+
variables: {
|
|
11095
|
+
ids: [sourceId],
|
|
11096
|
+
},
|
|
11097
|
+
thoughtSpotHost,
|
|
11098
|
+
});
|
|
11099
|
+
const souceDetails = details[0];
|
|
11100
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
11101
|
+
return souceDetails;
|
|
11102
|
+
}
|
|
11103
|
+
|
|
11104
|
+
const bachSessionId = `
|
|
11105
|
+
id {
|
|
11106
|
+
sessionId
|
|
11107
|
+
genNo
|
|
11108
|
+
acSession {
|
|
11109
|
+
sessionId
|
|
11110
|
+
genNo
|
|
11111
|
+
}
|
|
11112
|
+
}
|
|
11113
|
+
`;
|
|
11114
|
+
const getUnaggregatedAnswerSession = `
|
|
11115
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
11116
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
11117
|
+
${bachSessionId}
|
|
11118
|
+
answer {
|
|
11119
|
+
visualizations {
|
|
11120
|
+
... on TableViz {
|
|
11121
|
+
columns {
|
|
11122
|
+
column {
|
|
11123
|
+
id
|
|
11124
|
+
name
|
|
11125
|
+
referencedColumns {
|
|
11126
|
+
guid
|
|
11127
|
+
displayName
|
|
11128
|
+
}
|
|
11129
|
+
}
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
}
|
|
11133
|
+
}
|
|
11134
|
+
}
|
|
11135
|
+
}
|
|
11136
|
+
`;
|
|
11137
|
+
const removeColumns = `
|
|
11138
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
11139
|
+
Answer__removeColumns(
|
|
11140
|
+
session: $session
|
|
11141
|
+
logicalColumnIds: $logicalColumnIds
|
|
11142
|
+
columnIds: $columnIds
|
|
11143
|
+
) {
|
|
11144
|
+
${bachSessionId}
|
|
11145
|
+
}
|
|
11146
|
+
}
|
|
11147
|
+
`;
|
|
11148
|
+
const addColumns = `
|
|
11149
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
11150
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
11151
|
+
${bachSessionId}
|
|
11152
|
+
}
|
|
11153
|
+
}
|
|
11154
|
+
`;
|
|
11155
|
+
const getAnswerData = `
|
|
11156
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
11157
|
+
getAnswer(session: $session) {
|
|
11158
|
+
${bachSessionId}
|
|
11159
|
+
answer {
|
|
11160
|
+
id
|
|
11161
|
+
visualizations {
|
|
11162
|
+
id
|
|
11163
|
+
... on TableViz {
|
|
11164
|
+
columns {
|
|
11165
|
+
column {
|
|
11166
|
+
id
|
|
11167
|
+
name
|
|
11168
|
+
type
|
|
11169
|
+
aggregationType
|
|
11170
|
+
dataType
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
11174
|
+
}
|
|
11175
|
+
}
|
|
11176
|
+
}
|
|
11177
|
+
}
|
|
11178
|
+
}
|
|
11179
|
+
`;
|
|
11180
|
+
|
|
11181
|
+
// eslint-disable-next-line no-shadow
|
|
11182
|
+
var OperationType;
|
|
11183
|
+
(function (OperationType) {
|
|
11184
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
11185
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
11186
|
+
})(OperationType || (OperationType = {}));
|
|
11187
|
+
/**
|
|
11188
|
+
* Class representing the answer service provided with the
|
|
11189
|
+
* custom action payload. This service could be used to run
|
|
11190
|
+
* graphql queries in the context of the answer on which the
|
|
11191
|
+
* custom action was triggered.
|
|
11192
|
+
*
|
|
11193
|
+
* @example
|
|
11194
|
+
* ```js
|
|
11195
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
11196
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
11197
|
+
* 'col name 1'
|
|
11198
|
+
* ]);
|
|
11199
|
+
* const data = await underlying.fetchData(0, 100);
|
|
11200
|
+
* })
|
|
11201
|
+
* ```
|
|
11202
|
+
* @version
|
|
11203
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
11204
|
+
*/
|
|
11205
|
+
class AnswerService {
|
|
11206
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
11207
|
+
this.session = session;
|
|
11208
|
+
this.answer = answer;
|
|
11209
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
11210
|
+
this.selectedPoints = selectedPoints;
|
|
11211
|
+
this.session = removeTypename(session);
|
|
11212
|
+
}
|
|
11213
|
+
async getSourceDetail() {
|
|
11214
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
11215
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
11216
|
+
}
|
|
11217
|
+
async removeColumns(columnIds) {
|
|
11218
|
+
return this.executeQuery(removeColumns, {
|
|
11219
|
+
logicalColumnIds: columnIds,
|
|
11220
|
+
});
|
|
11221
|
+
}
|
|
11222
|
+
async addColumns(columnIds) {
|
|
11223
|
+
return this.executeQuery(addColumns, {
|
|
11224
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
11225
|
+
});
|
|
11226
|
+
}
|
|
11227
|
+
async fetchData(offset = 0, size = 1000) {
|
|
11228
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
11229
|
+
deadline: 0,
|
|
11230
|
+
dataPaginationParams: {
|
|
11231
|
+
isClientPaginated: true,
|
|
11232
|
+
offset,
|
|
11233
|
+
size,
|
|
11234
|
+
},
|
|
11235
|
+
});
|
|
11236
|
+
const { columns, data } = answer.visualizations[0];
|
|
11237
|
+
return {
|
|
11238
|
+
columns,
|
|
11239
|
+
data,
|
|
11240
|
+
};
|
|
11241
|
+
}
|
|
11242
|
+
/**
|
|
11243
|
+
*
|
|
11244
|
+
* @param userLocale
|
|
11245
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
11246
|
+
* @returns Response
|
|
11247
|
+
*/
|
|
11248
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
11249
|
+
if (omitInfo) {
|
|
11250
|
+
console.warn('omitInfo not supported yet.');
|
|
10967
11251
|
}
|
|
10968
|
-
|
|
10969
|
-
|
|
11252
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
11253
|
+
return fetch(fetchUrl, {
|
|
11254
|
+
credentials: 'include',
|
|
11255
|
+
});
|
|
11256
|
+
}
|
|
11257
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
11258
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
11259
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
10970
11260
|
}
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
11261
|
+
if (!selectedPoints) {
|
|
11262
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
11263
|
+
}
|
|
11264
|
+
const sourceDetail = await this.getSourceDetail();
|
|
11265
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
11266
|
+
const unAggAnswer = await graphqlQuery({
|
|
11267
|
+
query: getUnaggregatedAnswerSession,
|
|
11268
|
+
variables: {
|
|
11269
|
+
session: this.session,
|
|
11270
|
+
columns: selectedPoints,
|
|
11271
|
+
},
|
|
11272
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11273
|
+
});
|
|
11274
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
11275
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
11276
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
11277
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
11278
|
+
if (columnsToAdd.length) {
|
|
11279
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
11280
|
+
}
|
|
11281
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
11282
|
+
if (columnsToRemove.length) {
|
|
11283
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
11284
|
+
}
|
|
11285
|
+
return unaggAnswerSession;
|
|
11286
|
+
}
|
|
11287
|
+
async executeQuery(query, variables) {
|
|
11288
|
+
const data = await graphqlQuery({
|
|
11289
|
+
query,
|
|
11290
|
+
variables: {
|
|
11291
|
+
session: this.session,
|
|
11292
|
+
...variables,
|
|
11293
|
+
},
|
|
11294
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11295
|
+
isCompositeQuery: false,
|
|
11296
|
+
});
|
|
11297
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
11298
|
+
return data;
|
|
11299
|
+
}
|
|
11300
|
+
getSession() {
|
|
11301
|
+
return this.session;
|
|
11302
|
+
}
|
|
11303
|
+
}
|
|
11304
|
+
/**
|
|
11305
|
+
*
|
|
11306
|
+
* @param sourceDetail
|
|
11307
|
+
* @param colNames
|
|
11308
|
+
*/
|
|
11309
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
11310
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
11311
|
+
colSet[col.name] = col;
|
|
11312
|
+
return colSet;
|
|
11313
|
+
}, {});
|
|
11314
|
+
return new Set(colNames.map((colName) => {
|
|
11315
|
+
const col = cols[colName];
|
|
11316
|
+
return col.id;
|
|
11317
|
+
}));
|
|
11318
|
+
}
|
|
11319
|
+
/**
|
|
11320
|
+
*
|
|
11321
|
+
* @param selectedPoints
|
|
11322
|
+
*/
|
|
11323
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
11324
|
+
const underlyingDataPoint = [];
|
|
11325
|
+
/**
|
|
11326
|
+
*
|
|
11327
|
+
* @param colVal
|
|
11328
|
+
*/
|
|
11329
|
+
function addPointFromColVal(colVal) {
|
|
11330
|
+
const dataType = colVal.column.dataType;
|
|
11331
|
+
const id = colVal.column.id;
|
|
11332
|
+
let dataValue;
|
|
11333
|
+
if (dataType === 'DATE') {
|
|
11334
|
+
dataValue = [{
|
|
11335
|
+
epochRange: {
|
|
11336
|
+
startEpoch: colVal.value,
|
|
11337
|
+
},
|
|
11338
|
+
}];
|
|
10975
11339
|
}
|
|
10976
11340
|
else {
|
|
10977
|
-
|
|
10978
|
-
dataPaginationParams: {
|
|
10979
|
-
isClientPaginated: true,
|
|
10980
|
-
offset: offset * batchSize,
|
|
10981
|
-
size: batchSize,
|
|
10982
|
-
},
|
|
10983
|
-
};
|
|
11341
|
+
dataValue = [{ value: colVal.value }];
|
|
10984
11342
|
}
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
11343
|
+
underlyingDataPoint.push({
|
|
11344
|
+
columnId: colVal.column.id,
|
|
11345
|
+
dataValue,
|
|
10988
11346
|
});
|
|
10989
|
-
}
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
};
|
|
11347
|
+
}
|
|
11348
|
+
selectedPoints.forEach((p) => {
|
|
11349
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
11350
|
+
});
|
|
11351
|
+
return underlyingDataPoint;
|
|
10993
11352
|
}
|
|
10994
11353
|
|
|
10995
11354
|
/**
|
|
@@ -10998,16 +11357,12 @@
|
|
|
10998
11357
|
* @param thoughtSpotHost
|
|
10999
11358
|
*/
|
|
11000
11359
|
function processCustomAction(e, thoughtSpotHost) {
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
answerService,
|
|
11008
|
-
};
|
|
11009
|
-
}
|
|
11010
|
-
return e;
|
|
11360
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
11361
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
11362
|
+
return {
|
|
11363
|
+
...e,
|
|
11364
|
+
answerService,
|
|
11365
|
+
};
|
|
11011
11366
|
}
|
|
11012
11367
|
/**
|
|
11013
11368
|
*
|
|
@@ -11152,7 +11507,7 @@
|
|
|
11152
11507
|
});
|
|
11153
11508
|
}
|
|
11154
11509
|
|
|
11155
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-
|
|
11510
|
+
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$1={".":{"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$1,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};
|
|
11156
11511
|
|
|
11157
11512
|
/**
|
|
11158
11513
|
* Copyright (c) 2022
|
|
@@ -11184,6 +11539,7 @@
|
|
|
11184
11539
|
class TsEmbed {
|
|
11185
11540
|
constructor(domSelector, viewConfig) {
|
|
11186
11541
|
this.isAppInitialized = false;
|
|
11542
|
+
this.embedComponentType = 'TsEmbed';
|
|
11187
11543
|
/**
|
|
11188
11544
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
11189
11545
|
* will generate for embedding. This provides additional security to
|
|
@@ -11193,6 +11549,7 @@
|
|
|
11193
11549
|
*/
|
|
11194
11550
|
this.shouldEncodeUrlQueryParams = false;
|
|
11195
11551
|
this.defaultHiddenActions = [exports.Action.ReportError];
|
|
11552
|
+
this.subscribedListeners = {};
|
|
11196
11553
|
/**
|
|
11197
11554
|
* Send Custom style as part of payload of APP_INIT
|
|
11198
11555
|
*
|
|
@@ -11215,6 +11572,7 @@
|
|
|
11215
11572
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
11216
11573
|
: null,
|
|
11217
11574
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
11575
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
11218
11576
|
hostConfig: this.embedConfig.hostConfig,
|
|
11219
11577
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
11220
11578
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -11264,6 +11622,7 @@
|
|
|
11264
11622
|
this.registerAppInit();
|
|
11265
11623
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
11266
11624
|
...viewConfig,
|
|
11625
|
+
embedComponentType: this.embedComponentType,
|
|
11267
11626
|
});
|
|
11268
11627
|
}
|
|
11269
11628
|
/**
|
|
@@ -11332,23 +11691,37 @@
|
|
|
11332
11691
|
* and executes the registered callbacks accordingly.
|
|
11333
11692
|
*/
|
|
11334
11693
|
subscribeToEvents() {
|
|
11335
|
-
|
|
11694
|
+
this.unsubscribeToEvents();
|
|
11695
|
+
const messageEventListener = (event) => {
|
|
11336
11696
|
const eventType = this.getEventType(event);
|
|
11337
11697
|
const eventPort = this.getEventPort(event);
|
|
11338
11698
|
const eventData = this.formatEventData(event, eventType);
|
|
11339
11699
|
if (event.source === this.iFrame.contentWindow) {
|
|
11340
11700
|
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.el), eventPort);
|
|
11341
11701
|
}
|
|
11342
|
-
}
|
|
11343
|
-
window.addEventListener('
|
|
11702
|
+
};
|
|
11703
|
+
window.addEventListener('message', messageEventListener);
|
|
11704
|
+
const onlineEventListener = (e) => {
|
|
11344
11705
|
this.trigger(exports.HostEvent.Reload);
|
|
11345
|
-
}
|
|
11346
|
-
window.addEventListener('
|
|
11706
|
+
};
|
|
11707
|
+
window.addEventListener('online', onlineEventListener);
|
|
11708
|
+
const offlineEventListener = (e) => {
|
|
11347
11709
|
const offlineWarning = 'Network not Detected. Embed is offline. Please reconnect and refresh';
|
|
11348
11710
|
this.executeCallbacks(exports.EmbedEvent.Error, {
|
|
11349
11711
|
offlineWarning,
|
|
11350
11712
|
});
|
|
11351
11713
|
console.warn(offlineWarning);
|
|
11714
|
+
};
|
|
11715
|
+
window.addEventListener('offline', offlineEventListener);
|
|
11716
|
+
this.subscribedListeners = {
|
|
11717
|
+
message: messageEventListener,
|
|
11718
|
+
online: onlineEventListener,
|
|
11719
|
+
offline: offlineEventListener,
|
|
11720
|
+
};
|
|
11721
|
+
}
|
|
11722
|
+
unsubscribeToEvents() {
|
|
11723
|
+
Object.keys(this.subscribedListeners).forEach((key) => {
|
|
11724
|
+
window.removeEventListener(key, this.subscribedListeners[key]);
|
|
11352
11725
|
});
|
|
11353
11726
|
}
|
|
11354
11727
|
/**
|
|
@@ -11520,14 +11893,22 @@
|
|
|
11520
11893
|
iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
11521
11894
|
return iFrame;
|
|
11522
11895
|
}
|
|
11896
|
+
handleInsertionIntoDOM(child, showPreRenderByDefault = false) {
|
|
11897
|
+
if (this.isPreRendered) {
|
|
11898
|
+
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
|
|
11899
|
+
}
|
|
11900
|
+
else {
|
|
11901
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11902
|
+
}
|
|
11903
|
+
}
|
|
11523
11904
|
/**
|
|
11524
11905
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
11525
11906
|
* event listeners.
|
|
11526
11907
|
*
|
|
11527
|
-
* @param url
|
|
11528
|
-
* @param
|
|
11908
|
+
* @param url - The URL of the embedded ThoughtSpot app.
|
|
11909
|
+
* @param showPreRenderByDefault - The flag to show the preRender by default.
|
|
11529
11910
|
*/
|
|
11530
|
-
async renderIFrame(url) {
|
|
11911
|
+
async renderIFrame(url, showPreRenderByDefault = false) {
|
|
11531
11912
|
if (this.isError) {
|
|
11532
11913
|
return null;
|
|
11533
11914
|
}
|
|
@@ -11547,12 +11928,7 @@
|
|
|
11547
11928
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
11548
11929
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
11549
11930
|
if (!isLoggedIn) {
|
|
11550
|
-
|
|
11551
|
-
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage);
|
|
11552
|
-
}
|
|
11553
|
-
else {
|
|
11554
|
-
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11555
|
-
}
|
|
11931
|
+
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
|
|
11556
11932
|
return;
|
|
11557
11933
|
}
|
|
11558
11934
|
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
@@ -11574,12 +11950,7 @@
|
|
|
11574
11950
|
this.iFrame.addEventListener('error', () => {
|
|
11575
11951
|
nextInQueue();
|
|
11576
11952
|
});
|
|
11577
|
-
|
|
11578
|
-
this.insertIntoDOMForPreRender(this.iFrame);
|
|
11579
|
-
}
|
|
11580
|
-
else {
|
|
11581
|
-
this.insertIntoDOM(this.iFrame);
|
|
11582
|
-
}
|
|
11953
|
+
this.handleInsertionIntoDOM(this.iFrame, showPreRenderByDefault);
|
|
11583
11954
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
11584
11955
|
if (prefetchIframe.length) {
|
|
11585
11956
|
prefetchIframe.forEach((el) => {
|
|
@@ -11592,12 +11963,7 @@
|
|
|
11592
11963
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
11593
11964
|
error: JSON.stringify(error),
|
|
11594
11965
|
});
|
|
11595
|
-
|
|
11596
|
-
this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage);
|
|
11597
|
-
}
|
|
11598
|
-
else {
|
|
11599
|
-
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11600
|
-
}
|
|
11966
|
+
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11601
11967
|
this.handleError(error);
|
|
11602
11968
|
});
|
|
11603
11969
|
});
|
|
@@ -11611,40 +11977,46 @@
|
|
|
11611
11977
|
}
|
|
11612
11978
|
createPreRenderWrapper(child) {
|
|
11613
11979
|
if (!this.viewConfig.preRenderId) {
|
|
11614
|
-
throw new Error('
|
|
11980
|
+
throw new Error('PreRender id is required');
|
|
11615
11981
|
}
|
|
11616
11982
|
const preRenderIds = this.getPreRenderIds();
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
}
|
|
11983
|
+
[preRenderIds.wrapper, preRenderIds.shield, preRenderIds.child]
|
|
11984
|
+
.map((id) => document.getElementById(id))
|
|
11985
|
+
.filter((element) => element)
|
|
11986
|
+
.forEach((existingElement) => existingElement.remove());
|
|
11622
11987
|
const preRenderWrapper = document.createElement('div');
|
|
11623
11988
|
preRenderWrapper.id = preRenderIds.wrapper;
|
|
11624
11989
|
setStyleProperties(preRenderWrapper, { position: 'absolute', width: '100vw', height: '100vh' });
|
|
11625
|
-
const preRenderShield = document.createElement('div');
|
|
11626
|
-
preRenderShield.id = preRenderIds.shield;
|
|
11627
|
-
setStyleProperties(preRenderShield, { position: 'absolute',
|
|
11990
|
+
// const preRenderShield = document.createElement('div');
|
|
11991
|
+
// preRenderShield.id = preRenderIds.shield;
|
|
11992
|
+
// setStyleProperties(preRenderShield, { position: 'absolute',
|
|
11993
|
+
// width: '100%', height: '100%' });
|
|
11628
11994
|
child.id = preRenderIds.child;
|
|
11629
11995
|
preRenderWrapper.appendChild(child);
|
|
11630
|
-
preRenderWrapper.appendChild(preRenderShield);
|
|
11996
|
+
// preRenderWrapper.appendChild(preRenderShield);
|
|
11631
11997
|
this.preRenderWrapper = preRenderWrapper;
|
|
11632
|
-
this.preRenderShield = preRenderShield;
|
|
11998
|
+
// this.preRenderShield = preRenderShield;
|
|
11633
11999
|
this.preRenderChild = child;
|
|
11634
12000
|
return preRenderWrapper;
|
|
11635
12001
|
}
|
|
11636
|
-
|
|
12002
|
+
connectPreRendered() {
|
|
11637
12003
|
const preRenderIds = this.getPreRenderIds();
|
|
11638
12004
|
this.preRenderWrapper = this.preRenderWrapper
|
|
11639
12005
|
|| document.getElementById(preRenderIds.wrapper);
|
|
11640
|
-
this.preRenderShield = this.preRenderShield
|
|
11641
|
-
|
|
12006
|
+
// this.preRenderShield = this.preRenderShield
|
|
12007
|
+
// || document.getElementById(preRenderIds.shield);
|
|
11642
12008
|
this.preRenderChild = this.preRenderChild
|
|
11643
12009
|
|| document.getElementById(preRenderIds.child);
|
|
11644
|
-
|
|
11645
|
-
|
|
12010
|
+
if (this.preRenderWrapper && this.preRenderChild) {
|
|
12011
|
+
this.isPreRendered = true;
|
|
12012
|
+
this.iFrame = this.preRenderChild;
|
|
12013
|
+
}
|
|
12014
|
+
return this.isPreRenderAvailable();
|
|
11646
12015
|
}
|
|
11647
|
-
|
|
12016
|
+
isPreRenderAvailable() {
|
|
12017
|
+
return this.isPreRendered;
|
|
12018
|
+
}
|
|
12019
|
+
insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
|
|
11648
12020
|
let childNode;
|
|
11649
12021
|
if (typeof child === 'string') {
|
|
11650
12022
|
const divChildNode = document.createElement('div');
|
|
@@ -11655,8 +12027,13 @@
|
|
|
11655
12027
|
childNode = child;
|
|
11656
12028
|
}
|
|
11657
12029
|
const preRenderWrapper = this.createPreRenderWrapper(childNode);
|
|
12030
|
+
if (showPreRenderByDefault) {
|
|
12031
|
+
this.showPreRender();
|
|
12032
|
+
}
|
|
12033
|
+
else {
|
|
12034
|
+
this.hidePreRender();
|
|
12035
|
+
}
|
|
11658
12036
|
document.body.appendChild(preRenderWrapper);
|
|
11659
|
-
this.hidePreRender();
|
|
11660
12037
|
}
|
|
11661
12038
|
hidePreRender() {
|
|
11662
12039
|
if (!this.isPreRenderAvailable()) {
|
|
@@ -11673,28 +12050,33 @@
|
|
|
11673
12050
|
left: '0',
|
|
11674
12051
|
});
|
|
11675
12052
|
const childBoundingRect = this.preRenderChild.getBoundingClientRect();
|
|
11676
|
-
setStyleProperties(this.preRenderShield, {
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
});
|
|
12053
|
+
// setStyleProperties(this.preRenderShield, {
|
|
12054
|
+
// opacity: '0',
|
|
12055
|
+
// pointerEvents: 'none',
|
|
12056
|
+
// zIndex: '1',
|
|
12057
|
+
// width: `${childBoundingRect.width}px`,
|
|
12058
|
+
// height: `${childBoundingRect.height}px`,
|
|
12059
|
+
// position: 'absolute',
|
|
12060
|
+
// top: '0',
|
|
12061
|
+
// left: '0',
|
|
12062
|
+
// });
|
|
12063
|
+
this.unsubscribeToEvents();
|
|
11686
12064
|
}
|
|
11687
12065
|
showPreRender() {
|
|
11688
12066
|
if (!this.isPreRenderAvailable()) {
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
12067
|
+
const isAvailable = this.connectPreRendered();
|
|
12068
|
+
if (!isAvailable) {
|
|
12069
|
+
// if the Embed component is nor preRendered , Render it now and
|
|
12070
|
+
// show it (hide is defalt behaviour)
|
|
12071
|
+
console.log('No preRender found, creating new ');
|
|
12072
|
+
this.preRender(true);
|
|
12073
|
+
return;
|
|
12074
|
+
}
|
|
11694
12075
|
}
|
|
11695
12076
|
this.syncPreRenderStyle();
|
|
11696
12077
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
11697
|
-
setStyleProperties(this.preRenderShield, { zIndex: '-1' });
|
|
12078
|
+
// setStyleProperties(this.preRenderShield, { zIndex: '-1' });
|
|
12079
|
+
this.subscribeToEvents();
|
|
11698
12080
|
}
|
|
11699
12081
|
syncPreRenderStyle() {
|
|
11700
12082
|
if (!this.el) {
|
|
@@ -11921,8 +12303,10 @@
|
|
|
11921
12303
|
}
|
|
11922
12304
|
/**
|
|
11923
12305
|
* Creates the preRender shell
|
|
12306
|
+
*
|
|
12307
|
+
* @param showPreRenderByDefault
|
|
11924
12308
|
*/
|
|
11925
|
-
preRender() {
|
|
12309
|
+
preRender(showPreRenderByDefault = false) {
|
|
11926
12310
|
this.isPreRendered = true;
|
|
11927
12311
|
return this;
|
|
11928
12312
|
}
|
|
@@ -11961,6 +12345,7 @@
|
|
|
11961
12345
|
var _a;
|
|
11962
12346
|
try {
|
|
11963
12347
|
(_a = this.insertedDomEl) === null || _a === void 0 ? void 0 : _a.parentNode.removeChild(this.insertedDomEl);
|
|
12348
|
+
this.unsubscribeToEvents();
|
|
11964
12349
|
}
|
|
11965
12350
|
catch (e) {
|
|
11966
12351
|
console.log('Error destroying TS Embed', e);
|
|
@@ -11998,9 +12383,10 @@
|
|
|
11998
12383
|
* Render the app in an iframe and set up event handlers
|
|
11999
12384
|
*
|
|
12000
12385
|
* @param iframeSrc
|
|
12386
|
+
* @param showPreRenderByDefault - if true the preRender will be shown by default
|
|
12001
12387
|
*/
|
|
12002
|
-
renderV1Embed(iframeSrc) {
|
|
12003
|
-
return this.renderIFrame(iframeSrc);
|
|
12388
|
+
renderV1Embed(iframeSrc, showPreRenderByDefault = false) {
|
|
12389
|
+
return this.renderIFrame(iframeSrc, showPreRenderByDefault);
|
|
12004
12390
|
}
|
|
12005
12391
|
getRootIframeSrc() {
|
|
12006
12392
|
const queryParams = this.getEmbedParams();
|
|
@@ -12087,6 +12473,7 @@
|
|
|
12087
12473
|
constructor(domSelector, viewConfig) {
|
|
12088
12474
|
super(domSelector, viewConfig);
|
|
12089
12475
|
this.defaultHeight = '100%';
|
|
12476
|
+
this.embedComponentType = 'AppEmbed';
|
|
12090
12477
|
/**
|
|
12091
12478
|
* Set the iframe height as per the computed height received
|
|
12092
12479
|
* from the ThoughtSpot app.
|
|
@@ -12237,11 +12624,17 @@
|
|
|
12237
12624
|
*
|
|
12238
12625
|
* @param renderOptions An object containing the page ID
|
|
12239
12626
|
* to be embedded.
|
|
12627
|
+
* @param showPreRenderByDefault
|
|
12240
12628
|
*/
|
|
12241
|
-
render() {
|
|
12629
|
+
render(showPreRenderByDefault = false) {
|
|
12242
12630
|
super.render();
|
|
12243
12631
|
const src = this.getIFrameSrc();
|
|
12244
|
-
this.renderV1Embed(src);
|
|
12632
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
12633
|
+
return this;
|
|
12634
|
+
}
|
|
12635
|
+
preRender(showPreRenderByDefault = false) {
|
|
12636
|
+
super.preRender(showPreRenderByDefault);
|
|
12637
|
+
this.render(showPreRenderByDefault);
|
|
12245
12638
|
return this;
|
|
12246
12639
|
}
|
|
12247
12640
|
}
|
|
@@ -12276,6 +12669,7 @@
|
|
|
12276
12669
|
constructor(domSelector, viewConfig) {
|
|
12277
12670
|
super(domSelector, viewConfig);
|
|
12278
12671
|
this.defaultHeight = 500;
|
|
12672
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
12279
12673
|
/**
|
|
12280
12674
|
* Set the iframe height as per the computed height received
|
|
12281
12675
|
* from the ThoughtSpot app.
|
|
@@ -12397,15 +12791,15 @@
|
|
|
12397
12791
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
12398
12792
|
* visualization ID and the runtime filters.
|
|
12399
12793
|
*/
|
|
12400
|
-
render() {
|
|
12794
|
+
render(showPreRenderByDefault = false) {
|
|
12401
12795
|
super.render();
|
|
12402
12796
|
const src = this.getIFrameSrc();
|
|
12403
|
-
this.renderV1Embed(src);
|
|
12797
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
12404
12798
|
return this;
|
|
12405
12799
|
}
|
|
12406
|
-
preRender() {
|
|
12407
|
-
super.preRender();
|
|
12408
|
-
this.render();
|
|
12800
|
+
preRender(showPreRenderByDefault = false) {
|
|
12801
|
+
super.preRender(showPreRenderByDefault);
|
|
12802
|
+
this.render(showPreRenderByDefault);
|
|
12409
12803
|
return this;
|
|
12410
12804
|
}
|
|
12411
12805
|
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
@@ -12450,6 +12844,7 @@
|
|
|
12450
12844
|
class SearchEmbed extends TsEmbed {
|
|
12451
12845
|
constructor(domSelector, viewConfig) {
|
|
12452
12846
|
super(domSelector);
|
|
12847
|
+
this.embedComponentType = 'SearchEmbed';
|
|
12453
12848
|
this.viewConfig = viewConfig;
|
|
12454
12849
|
}
|
|
12455
12850
|
/**
|
|
@@ -12530,12 +12925,14 @@
|
|
|
12530
12925
|
}
|
|
12531
12926
|
/**
|
|
12532
12927
|
* Render the embedded ThoughtSpot search
|
|
12928
|
+
*
|
|
12929
|
+
* @param showPreRenderByDefault
|
|
12533
12930
|
*/
|
|
12534
|
-
render() {
|
|
12931
|
+
render(showPreRenderByDefault = false) {
|
|
12535
12932
|
super.render();
|
|
12536
12933
|
const { answerId } = this.viewConfig;
|
|
12537
12934
|
const src = this.getIFrameSrc(answerId);
|
|
12538
|
-
this.renderIFrame(src);
|
|
12935
|
+
this.renderIFrame(src, showPreRenderByDefault);
|
|
12539
12936
|
getAuthPromise().then(() => {
|
|
12540
12937
|
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
12541
12938
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
@@ -12543,6 +12940,11 @@
|
|
|
12543
12940
|
});
|
|
12544
12941
|
return this;
|
|
12545
12942
|
}
|
|
12943
|
+
preRender(showPreRenderByDefault = false) {
|
|
12944
|
+
super.preRender(showPreRenderByDefault);
|
|
12945
|
+
this.render(showPreRenderByDefault);
|
|
12946
|
+
return this;
|
|
12947
|
+
}
|
|
12546
12948
|
}
|
|
12547
12949
|
|
|
12548
12950
|
/**
|
|
@@ -12554,6 +12956,7 @@
|
|
|
12554
12956
|
class SearchBarEmbed extends TsEmbed {
|
|
12555
12957
|
constructor(domSelector, viewConfig) {
|
|
12556
12958
|
super(domSelector);
|
|
12959
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
12557
12960
|
this.viewConfig = viewConfig;
|
|
12558
12961
|
}
|
|
12559
12962
|
/**
|
|
@@ -12632,6 +13035,7 @@
|
|
|
12632
13035
|
// eslint-disable-next-line no-useless-constructor
|
|
12633
13036
|
constructor(domSelector, viewConfig) {
|
|
12634
13037
|
super(domSelector, viewConfig);
|
|
13038
|
+
this.embedComponentType = 'SageEmbed';
|
|
12635
13039
|
}
|
|
12636
13040
|
/**
|
|
12637
13041
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -12683,16 +13087,23 @@
|
|
|
12683
13087
|
/**
|
|
12684
13088
|
* Render the embedded ThoughtSpot Sage
|
|
12685
13089
|
*
|
|
13090
|
+
* @param showPreRenderByDefault
|
|
12686
13091
|
* @returns {SageEmbed} Eureka/Sage embed
|
|
12687
13092
|
*/
|
|
12688
|
-
render() {
|
|
13093
|
+
render(showPreRenderByDefault = false) {
|
|
12689
13094
|
super.render();
|
|
12690
13095
|
const src = this.getIFrameSrc();
|
|
12691
|
-
this.renderV1Embed(src);
|
|
13096
|
+
this.renderV1Embed(src, showPreRenderByDefault);
|
|
13097
|
+
return this;
|
|
13098
|
+
}
|
|
13099
|
+
preRender(showPreRenderByDefault = false) {
|
|
13100
|
+
super.preRender(showPreRenderByDefault);
|
|
13101
|
+
this.render(showPreRenderByDefault);
|
|
12692
13102
|
return this;
|
|
12693
13103
|
}
|
|
12694
13104
|
}
|
|
12695
13105
|
|
|
13106
|
+
exports.AnswerService = AnswerService;
|
|
12696
13107
|
exports.AppEmbed = AppEmbed;
|
|
12697
13108
|
exports.LiveboardEmbed = LiveboardEmbed;
|
|
12698
13109
|
exports.PinboardEmbed = PinboardEmbed;
|