@thoughtspot/visual-embed-sdk 1.24.0 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +2 -3
- package/cjs/src/embed/app.d.ts +23 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +5 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +3 -4
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +3 -4
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +23 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +11 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +2 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -0
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +2 -1
- 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 +2 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -0
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +4 -10
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +49 -2
- 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/types.d.ts +46 -39
- 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 +27 -2
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +10 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/src/embed/app.d.ts +23 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +3 -4
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +23 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +2 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +2 -1
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +2 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -0
- 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/types.d.ts +46 -39
- 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 +400 -81
- package/dist/tsembed-react.js +400 -81
- package/dist/tsembed.es.js +452 -89
- package/dist/tsembed.js +452 -88
- package/dist/visual-embed-sdk-react-full.d.ts +158 -49
- package/dist/visual-embed-sdk-react.d.ts +158 -49
- package/dist/visual-embed-sdk.d.ts +158 -49
- package/lib/package.json +2 -3
- package/lib/src/embed/app.d.ts +23 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +5 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +3 -4
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +3 -4
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +23 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +11 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/sage.d.ts +2 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -0
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +2 -1
- 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 +2 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -0
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +4 -10
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +49 -2
- 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/types.d.ts +46 -39
- 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 +24 -1
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +10 -0
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +164 -50
- package/package.json +4 -5
- package/src/embed/app.ts +30 -1
- package/src/embed/base.ts +3 -4
- package/src/embed/liveboard.ts +36 -1
- package/src/embed/sage.ts +9 -4
- package/src/embed/search-bar.tsx +12 -1
- package/src/embed/search.ts +7 -1
- package/src/embed/ts-embed.spec.ts +51 -2
- package/src/embed/ts-embed.ts +4 -12
- package/src/index.ts +5 -0
- package/src/mixpanel-service.spec.ts +1 -0
- package/src/mixpanel-service.ts +1 -0
- package/src/types.ts +50 -40
- 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.spec.ts +13 -0
- package/src/utils.ts +25 -1
- package/cjs/src/utils/answerService.d.ts +0 -10
- package/cjs/src/utils/answerService.d.ts.map +0 -1
- package/cjs/src/utils/answerService.js +0 -61
- package/cjs/src/utils/answerService.js.map +0 -1
- package/cjs/src/utils/answerService.spec.d.ts +0 -2
- package/cjs/src/utils/answerService.spec.d.ts.map +0 -1
- package/cjs/src/utils/answerService.spec.js +0 -31
- package/cjs/src/utils/answerService.spec.js.map +0 -1
- package/dist/src/utils/answerService.d.ts +0 -10
- package/dist/src/utils/answerService.d.ts.map +0 -1
- package/dist/src/utils/answerService.spec.d.ts +0 -2
- package/dist/src/utils/answerService.spec.d.ts.map +0 -1
- package/lib/src/utils/answerService.d.ts +0 -10
- package/lib/src/utils/answerService.d.ts.map +0 -1
- package/lib/src/utils/answerService.js +0 -57
- package/lib/src/utils/answerService.js.map +0 -1
- package/lib/src/utils/answerService.spec.d.ts +0 -2
- package/lib/src/utils/answerService.spec.d.ts.map +0 -1
- package/lib/src/utils/answerService.spec.js +0 -29
- package/lib/src/utils/answerService.spec.js.map +0 -1
- 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
|
*
|
|
@@ -21,7 +65,7 @@ const getFilterQuery = (runtimeFilters) => {
|
|
|
21
65
|
const filterExpr = [];
|
|
22
66
|
filterExpr.push(`col${index}=${filter.columnName}`);
|
|
23
67
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
24
|
-
filterExpr.push(filter.values.map((value) => `val${index}=${value}`).join('&'));
|
|
68
|
+
filterExpr.push(filter.values.map((value) => `val${index}=${encodeURIComponent(value)}`).join('&'));
|
|
25
69
|
return filterExpr.join('&');
|
|
26
70
|
});
|
|
27
71
|
return `${filters.join('&')}`;
|
|
@@ -193,6 +237,30 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
193
237
|
*/
|
|
194
238
|
function getDOMNode(domSelector) {
|
|
195
239
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
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;
|
|
196
264
|
}
|
|
197
265
|
|
|
198
266
|
/**
|
|
@@ -456,27 +524,27 @@ var HomepageModule;
|
|
|
456
524
|
/**
|
|
457
525
|
* Search bar
|
|
458
526
|
*/
|
|
459
|
-
HomepageModule["Search"] = "
|
|
527
|
+
HomepageModule["Search"] = "SEARCH";
|
|
460
528
|
/**
|
|
461
529
|
* kPI watchlist module
|
|
462
530
|
*/
|
|
463
|
-
HomepageModule["Watchlist"] = "
|
|
531
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
464
532
|
/**
|
|
465
533
|
* favorite objects
|
|
466
534
|
*/
|
|
467
|
-
HomepageModule["Favorite"] = "
|
|
535
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
468
536
|
/**
|
|
469
537
|
* List of answers and liveboards
|
|
470
538
|
*/
|
|
471
|
-
HomepageModule["MyLibrary"] = "
|
|
539
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
472
540
|
/**
|
|
473
541
|
* Trending list
|
|
474
542
|
*/
|
|
475
|
-
HomepageModule["Trending"] = "
|
|
543
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
476
544
|
/**
|
|
477
545
|
* Learning videos
|
|
478
546
|
*/
|
|
479
|
-
HomepageModule["Learning"] = "
|
|
547
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
480
548
|
})(HomepageModule || (HomepageModule = {}));
|
|
481
549
|
/**
|
|
482
550
|
* Event types emitted by the embedded ThoughtSpot application.
|
|
@@ -2624,12 +2692,6 @@ var Action;
|
|
|
2624
2692
|
*/
|
|
2625
2693
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2626
2694
|
})(Action || (Action = {}));
|
|
2627
|
-
// eslint-disable-next-line no-shadow
|
|
2628
|
-
var OperationType;
|
|
2629
|
-
(function (OperationType) {
|
|
2630
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2631
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2632
|
-
})(OperationType || (OperationType = {}));
|
|
2633
2695
|
var PrefetchFeatures;
|
|
2634
2696
|
(function (PrefetchFeatures) {
|
|
2635
2697
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8745,6 +8807,7 @@ function emptyQueue() {
|
|
|
8745
8807
|
* @param sessionInfo
|
|
8746
8808
|
*/
|
|
8747
8809
|
function initMixpanel(sessionInfo) {
|
|
8810
|
+
var _a;
|
|
8748
8811
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8749
8812
|
return;
|
|
8750
8813
|
}
|
|
@@ -8762,6 +8825,7 @@ function initMixpanel(sessionInfo) {
|
|
|
8762
8825
|
clusterId: sessionInfo.clusterId,
|
|
8763
8826
|
clusterName: sessionInfo.clusterName,
|
|
8764
8827
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8828
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8765
8829
|
});
|
|
8766
8830
|
isMixpanelInitialized = true;
|
|
8767
8831
|
emptyQueue();
|
|
@@ -9254,12 +9318,12 @@ var _baseGetTag = baseGetTag;
|
|
|
9254
9318
|
* _.isObject(null);
|
|
9255
9319
|
* // => false
|
|
9256
9320
|
*/
|
|
9257
|
-
function isObject(value) {
|
|
9321
|
+
function isObject$1(value) {
|
|
9258
9322
|
var type = typeof value;
|
|
9259
9323
|
return value != null && (type == 'object' || type == 'function');
|
|
9260
9324
|
}
|
|
9261
9325
|
|
|
9262
|
-
var isObject_1 = isObject;
|
|
9326
|
+
var isObject_1 = isObject$1;
|
|
9263
9327
|
|
|
9264
9328
|
/** `Object#toString` result references. */
|
|
9265
9329
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -10090,9 +10154,9 @@ function cacheHas(cache, key) {
|
|
|
10090
10154
|
var _cacheHas = cacheHas;
|
|
10091
10155
|
|
|
10092
10156
|
/* Built-in method references that are verified to be native. */
|
|
10093
|
-
var Set = _getNative(_root, 'Set');
|
|
10157
|
+
var Set$1 = _getNative(_root, 'Set');
|
|
10094
10158
|
|
|
10095
|
-
var _Set = Set;
|
|
10159
|
+
var _Set = Set$1;
|
|
10096
10160
|
|
|
10097
10161
|
/**
|
|
10098
10162
|
* This method returns `undefined`.
|
|
@@ -10947,9 +11011,9 @@ const renderInQueue = (fn) => {
|
|
|
10947
11011
|
};
|
|
10948
11012
|
/**
|
|
10949
11013
|
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
10950
|
-
*
|
|
10951
11014
|
* @param data
|
|
10952
11015
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11016
|
+
* @group Global methods
|
|
10953
11017
|
*/
|
|
10954
11018
|
const executeTML = async (data) => {
|
|
10955
11019
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10992,11 +11056,10 @@ const executeTML = async (data) => {
|
|
|
10992
11056
|
});
|
|
10993
11057
|
};
|
|
10994
11058
|
/**
|
|
10995
|
-
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
|
|
10996
|
-
* format.
|
|
10997
|
-
*
|
|
11059
|
+
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
|
|
10998
11060
|
* @param data
|
|
10999
11061
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11062
|
+
* @group Global methods
|
|
11000
11063
|
*/
|
|
11001
11064
|
const exportTML = async (data) => {
|
|
11002
11065
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -11042,58 +11105,351 @@ const exportTML = async (data) => {
|
|
|
11042
11105
|
|
|
11043
11106
|
/**
|
|
11044
11107
|
*
|
|
11045
|
-
* @param
|
|
11046
|
-
* @param query
|
|
11047
|
-
* @param
|
|
11108
|
+
* @param root0
|
|
11109
|
+
* @param root0.query
|
|
11110
|
+
* @param root0.variables
|
|
11111
|
+
* @param root0.thoughtSpotHost
|
|
11112
|
+
* @param root0.isCompositeQuery
|
|
11113
|
+
*/
|
|
11114
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
11115
|
+
const operationName = getOperationNameFromQuery(query);
|
|
11116
|
+
try {
|
|
11117
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
11118
|
+
method: 'POST',
|
|
11119
|
+
headers: {
|
|
11120
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
11121
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11122
|
+
accept: '*/*',
|
|
11123
|
+
'accept-language': 'en-us',
|
|
11124
|
+
},
|
|
11125
|
+
body: JSON.stringify({
|
|
11126
|
+
operationName,
|
|
11127
|
+
query,
|
|
11128
|
+
variables,
|
|
11129
|
+
}),
|
|
11130
|
+
credentials: 'include',
|
|
11131
|
+
});
|
|
11132
|
+
const result = await response.json();
|
|
11133
|
+
const dataValues = Object.values(result.data);
|
|
11134
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
11135
|
+
}
|
|
11136
|
+
catch (error) {
|
|
11137
|
+
return error;
|
|
11138
|
+
}
|
|
11139
|
+
}
|
|
11140
|
+
|
|
11141
|
+
const getSourceDetailQuery = `
|
|
11142
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
11143
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
11144
|
+
id
|
|
11145
|
+
name
|
|
11146
|
+
description
|
|
11147
|
+
authorName
|
|
11148
|
+
authorDisplayName
|
|
11149
|
+
isExternal
|
|
11150
|
+
type
|
|
11151
|
+
created
|
|
11152
|
+
modified
|
|
11153
|
+
columns {
|
|
11154
|
+
id
|
|
11155
|
+
name
|
|
11156
|
+
author
|
|
11157
|
+
authorDisplayName
|
|
11158
|
+
description
|
|
11159
|
+
dataType
|
|
11160
|
+
type
|
|
11161
|
+
modified
|
|
11162
|
+
ownerName
|
|
11163
|
+
owner
|
|
11164
|
+
dataRecency
|
|
11165
|
+
sources {
|
|
11166
|
+
tableId
|
|
11167
|
+
tableName
|
|
11168
|
+
columnId
|
|
11169
|
+
columnName
|
|
11170
|
+
__typename
|
|
11171
|
+
}
|
|
11172
|
+
synonyms
|
|
11173
|
+
cohortAnswerId
|
|
11174
|
+
__typename
|
|
11175
|
+
}
|
|
11176
|
+
relationships
|
|
11177
|
+
destinationRelationships
|
|
11178
|
+
dataSourceId
|
|
11179
|
+
__typename
|
|
11180
|
+
}
|
|
11181
|
+
}
|
|
11182
|
+
`;
|
|
11183
|
+
const sourceDetailCache = new Map();
|
|
11184
|
+
/**
|
|
11185
|
+
*
|
|
11048
11186
|
* @param thoughtSpotHost
|
|
11187
|
+
* @param sourceId
|
|
11049
11188
|
*/
|
|
11050
|
-
function
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11189
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
11190
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
11191
|
+
return sourceDetailCache.get(sourceId);
|
|
11192
|
+
}
|
|
11193
|
+
const details = await graphqlQuery({
|
|
11194
|
+
query: getSourceDetailQuery,
|
|
11195
|
+
variables: {
|
|
11196
|
+
ids: [sourceId],
|
|
11197
|
+
},
|
|
11198
|
+
thoughtSpotHost,
|
|
11199
|
+
});
|
|
11200
|
+
const souceDetails = details[0];
|
|
11201
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
11202
|
+
return souceDetails;
|
|
11203
|
+
}
|
|
11204
|
+
|
|
11205
|
+
const bachSessionId = `
|
|
11206
|
+
id {
|
|
11207
|
+
sessionId
|
|
11208
|
+
genNo
|
|
11209
|
+
acSession {
|
|
11210
|
+
sessionId
|
|
11211
|
+
genNo
|
|
11212
|
+
}
|
|
11213
|
+
}
|
|
11214
|
+
`;
|
|
11215
|
+
const getUnaggregatedAnswerSession = `
|
|
11216
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
11217
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
11218
|
+
${bachSessionId}
|
|
11219
|
+
answer {
|
|
11220
|
+
visualizations {
|
|
11221
|
+
... on TableViz {
|
|
11222
|
+
columns {
|
|
11223
|
+
column {
|
|
11224
|
+
id
|
|
11225
|
+
name
|
|
11226
|
+
referencedColumns {
|
|
11227
|
+
guid
|
|
11228
|
+
displayName
|
|
11229
|
+
}
|
|
11230
|
+
}
|
|
11231
|
+
}
|
|
11232
|
+
}
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11236
|
+
}
|
|
11237
|
+
`;
|
|
11238
|
+
const removeColumns = `
|
|
11239
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
11240
|
+
Answer__removeColumns(
|
|
11241
|
+
session: $session
|
|
11242
|
+
logicalColumnIds: $logicalColumnIds
|
|
11243
|
+
columnIds: $columnIds
|
|
11244
|
+
) {
|
|
11245
|
+
${bachSessionId}
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
`;
|
|
11249
|
+
const addColumns = `
|
|
11250
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
11251
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
11252
|
+
${bachSessionId}
|
|
11253
|
+
}
|
|
11254
|
+
}
|
|
11255
|
+
`;
|
|
11256
|
+
const getAnswerData = `
|
|
11257
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
11258
|
+
getAnswer(session: $session) {
|
|
11259
|
+
${bachSessionId}
|
|
11260
|
+
answer {
|
|
11261
|
+
id
|
|
11262
|
+
visualizations {
|
|
11263
|
+
id
|
|
11264
|
+
... on TableViz {
|
|
11265
|
+
columns {
|
|
11266
|
+
column {
|
|
11267
|
+
id
|
|
11268
|
+
name
|
|
11269
|
+
type
|
|
11270
|
+
aggregationType
|
|
11271
|
+
dataType
|
|
11272
|
+
}
|
|
11273
|
+
}
|
|
11274
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
11275
|
+
}
|
|
11276
|
+
}
|
|
11277
|
+
}
|
|
11278
|
+
}
|
|
11279
|
+
}
|
|
11280
|
+
`;
|
|
11281
|
+
|
|
11282
|
+
// eslint-disable-next-line no-shadow
|
|
11283
|
+
var OperationType;
|
|
11284
|
+
(function (OperationType) {
|
|
11285
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
11286
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
11287
|
+
})(OperationType || (OperationType = {}));
|
|
11288
|
+
/**
|
|
11289
|
+
* Class representing the answer service provided with the
|
|
11290
|
+
* custom action payload. This service could be used to run
|
|
11291
|
+
* graphql queries in the context of the answer on which the
|
|
11292
|
+
* custom action was triggered.
|
|
11293
|
+
*
|
|
11294
|
+
* @example
|
|
11295
|
+
* ```js
|
|
11296
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
11297
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
11298
|
+
* 'col name 1'
|
|
11299
|
+
* ]);
|
|
11300
|
+
* const data = await underlying.fetchData(0, 100);
|
|
11301
|
+
* })
|
|
11302
|
+
* ```
|
|
11303
|
+
* @version
|
|
11304
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
11305
|
+
*/
|
|
11306
|
+
class AnswerService {
|
|
11307
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
11308
|
+
this.session = session;
|
|
11309
|
+
this.answer = answer;
|
|
11310
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
11311
|
+
this.selectedPoints = selectedPoints;
|
|
11312
|
+
this.session = removeTypename(session);
|
|
11313
|
+
}
|
|
11314
|
+
async getSourceDetail() {
|
|
11315
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
11316
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
11317
|
+
}
|
|
11318
|
+
async removeColumns(columnIds) {
|
|
11319
|
+
return this.executeQuery(removeColumns, {
|
|
11320
|
+
logicalColumnIds: columnIds,
|
|
11321
|
+
});
|
|
11322
|
+
}
|
|
11323
|
+
async addColumns(columnIds) {
|
|
11324
|
+
return this.executeQuery(addColumns, {
|
|
11325
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
11326
|
+
});
|
|
11327
|
+
}
|
|
11328
|
+
async fetchData(offset = 0, size = 1000) {
|
|
11329
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
11330
|
+
deadline: 0,
|
|
11331
|
+
dataPaginationParams: {
|
|
11332
|
+
isClientPaginated: true,
|
|
11333
|
+
offset,
|
|
11334
|
+
size,
|
|
11335
|
+
},
|
|
11336
|
+
});
|
|
11337
|
+
const { columns, data } = answer.visualizations[0];
|
|
11338
|
+
return {
|
|
11339
|
+
columns,
|
|
11340
|
+
data,
|
|
11341
|
+
};
|
|
11342
|
+
}
|
|
11343
|
+
/**
|
|
11344
|
+
*
|
|
11345
|
+
* @param userLocale
|
|
11346
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
11347
|
+
* @returns Response
|
|
11348
|
+
*/
|
|
11349
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
11350
|
+
if (omitInfo) {
|
|
11351
|
+
console.warn('omitInfo not supported yet.');
|
|
11352
|
+
}
|
|
11353
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
11354
|
+
return fetch(fetchUrl, {
|
|
11355
|
+
credentials: 'include',
|
|
11356
|
+
});
|
|
11357
|
+
}
|
|
11358
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
11359
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
11360
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
11071
11361
|
}
|
|
11072
|
-
|
|
11073
|
-
|
|
11362
|
+
if (!selectedPoints) {
|
|
11363
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
11074
11364
|
}
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11365
|
+
const sourceDetail = await this.getSourceDetail();
|
|
11366
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
11367
|
+
const unAggAnswer = await graphqlQuery({
|
|
11368
|
+
query: getUnaggregatedAnswerSession,
|
|
11369
|
+
variables: {
|
|
11370
|
+
session: this.session,
|
|
11371
|
+
columns: selectedPoints,
|
|
11372
|
+
},
|
|
11373
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11374
|
+
});
|
|
11375
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
11376
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
11377
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
11378
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
11379
|
+
if (columnsToAdd.length) {
|
|
11380
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
11381
|
+
}
|
|
11382
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
11383
|
+
if (columnsToRemove.length) {
|
|
11384
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
11385
|
+
}
|
|
11386
|
+
return unaggAnswerSession;
|
|
11387
|
+
}
|
|
11388
|
+
async executeQuery(query, variables) {
|
|
11389
|
+
const data = await graphqlQuery({
|
|
11390
|
+
query,
|
|
11391
|
+
variables: {
|
|
11392
|
+
session: this.session,
|
|
11393
|
+
...variables,
|
|
11394
|
+
},
|
|
11395
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11396
|
+
isCompositeQuery: false,
|
|
11397
|
+
});
|
|
11398
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
11399
|
+
return data;
|
|
11400
|
+
}
|
|
11401
|
+
getSession() {
|
|
11402
|
+
return this.session;
|
|
11403
|
+
}
|
|
11404
|
+
}
|
|
11405
|
+
/**
|
|
11406
|
+
*
|
|
11407
|
+
* @param sourceDetail
|
|
11408
|
+
* @param colNames
|
|
11409
|
+
*/
|
|
11410
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
11411
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
11412
|
+
colSet[col.name] = col;
|
|
11413
|
+
return colSet;
|
|
11414
|
+
}, {});
|
|
11415
|
+
return new Set(colNames.map((colName) => {
|
|
11416
|
+
const col = cols[colName];
|
|
11417
|
+
return col.id;
|
|
11418
|
+
}));
|
|
11419
|
+
}
|
|
11420
|
+
/**
|
|
11421
|
+
*
|
|
11422
|
+
* @param selectedPoints
|
|
11423
|
+
*/
|
|
11424
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
11425
|
+
const underlyingDataPoint = [];
|
|
11426
|
+
/**
|
|
11427
|
+
*
|
|
11428
|
+
* @param colVal
|
|
11429
|
+
*/
|
|
11430
|
+
function addPointFromColVal(colVal) {
|
|
11431
|
+
const dataType = colVal.column.dataType;
|
|
11432
|
+
const id = colVal.column.id;
|
|
11433
|
+
let dataValue;
|
|
11434
|
+
if (dataType === 'DATE') {
|
|
11435
|
+
dataValue = [{
|
|
11436
|
+
epochRange: {
|
|
11437
|
+
startEpoch: colVal.value,
|
|
11438
|
+
},
|
|
11439
|
+
}];
|
|
11079
11440
|
}
|
|
11080
11441
|
else {
|
|
11081
|
-
|
|
11082
|
-
dataPaginationParams: {
|
|
11083
|
-
isClientPaginated: true,
|
|
11084
|
-
offset: offset * batchSize,
|
|
11085
|
-
size: batchSize,
|
|
11086
|
-
},
|
|
11087
|
-
};
|
|
11442
|
+
dataValue = [{ value: colVal.value }];
|
|
11088
11443
|
}
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11444
|
+
underlyingDataPoint.push({
|
|
11445
|
+
columnId: colVal.column.id,
|
|
11446
|
+
dataValue,
|
|
11092
11447
|
});
|
|
11093
|
-
}
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
};
|
|
11448
|
+
}
|
|
11449
|
+
selectedPoints.forEach((p) => {
|
|
11450
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
11451
|
+
});
|
|
11452
|
+
return underlyingDataPoint;
|
|
11097
11453
|
}
|
|
11098
11454
|
|
|
11099
11455
|
/**
|
|
@@ -11102,16 +11458,12 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
|
11102
11458
|
* @param thoughtSpotHost
|
|
11103
11459
|
*/
|
|
11104
11460
|
function processCustomAction(e, thoughtSpotHost) {
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
answerService,
|
|
11112
|
-
};
|
|
11113
|
-
}
|
|
11114
|
-
return e;
|
|
11461
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
11462
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
11463
|
+
return {
|
|
11464
|
+
...e,
|
|
11465
|
+
answerService,
|
|
11466
|
+
};
|
|
11115
11467
|
}
|
|
11116
11468
|
/**
|
|
11117
11469
|
*
|
|
@@ -11256,7 +11608,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
11256
11608
|
});
|
|
11257
11609
|
}
|
|
11258
11610
|
|
|
11259
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
11611
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.24.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","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 is-publish-allowed && npm run test && 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};
|
|
11260
11612
|
|
|
11261
11613
|
/**
|
|
11262
11614
|
* Copyright (c) 2022
|
|
@@ -11288,6 +11640,7 @@ const V1EventMap = {};
|
|
|
11288
11640
|
class TsEmbed {
|
|
11289
11641
|
constructor(domSelector, viewConfig) {
|
|
11290
11642
|
this.isAppInitialized = false;
|
|
11643
|
+
this.embedComponentType = 'TsEmbed';
|
|
11291
11644
|
/**
|
|
11292
11645
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
11293
11646
|
* will generate for embedding. This provides additional security to
|
|
@@ -11319,6 +11672,7 @@ class TsEmbed {
|
|
|
11319
11672
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
11320
11673
|
: null,
|
|
11321
11674
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
11675
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
11322
11676
|
hostConfig: this.embedConfig.hostConfig,
|
|
11323
11677
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
11324
11678
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -11368,6 +11722,7 @@ class TsEmbed {
|
|
|
11368
11722
|
this.registerAppInit();
|
|
11369
11723
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
11370
11724
|
...viewConfig,
|
|
11725
|
+
embedComponentType: this.embedComponentType,
|
|
11371
11726
|
});
|
|
11372
11727
|
}
|
|
11373
11728
|
/**
|
|
@@ -11502,7 +11857,7 @@ class TsEmbed {
|
|
|
11502
11857
|
if (this.embedConfig.pendoTrackingKey) {
|
|
11503
11858
|
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
11504
11859
|
}
|
|
11505
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide,
|
|
11860
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, } = this.viewConfig;
|
|
11506
11861
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
11507
11862
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
11508
11863
|
return queryParams;
|
|
@@ -11563,15 +11918,6 @@ class TsEmbed {
|
|
|
11563
11918
|
if (insertInToSlide) {
|
|
11564
11919
|
queryParams[Param.ShowInsertToSlide] = insertInToSlide;
|
|
11565
11920
|
}
|
|
11566
|
-
if (hideLiveboardHeader) {
|
|
11567
|
-
queryParams[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
11568
|
-
}
|
|
11569
|
-
if (showLiveboardDescription) {
|
|
11570
|
-
queryParams[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
11571
|
-
}
|
|
11572
|
-
if (showLiveboardTitle) {
|
|
11573
|
-
queryParams[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
11574
|
-
}
|
|
11575
11921
|
return queryParams;
|
|
11576
11922
|
}
|
|
11577
11923
|
/**
|
|
@@ -12071,6 +12417,7 @@ class AppEmbed extends V1Embed {
|
|
|
12071
12417
|
constructor(domSelector, viewConfig) {
|
|
12072
12418
|
super(domSelector, viewConfig);
|
|
12073
12419
|
this.defaultHeight = '100%';
|
|
12420
|
+
this.embedComponentType = 'AppEmbed';
|
|
12074
12421
|
/**
|
|
12075
12422
|
* Set the iframe height as per the computed height received
|
|
12076
12423
|
* from the ThoughtSpot app.
|
|
@@ -12102,13 +12449,16 @@ class AppEmbed extends V1Embed {
|
|
|
12102
12449
|
* embedded Liveboard or visualization.
|
|
12103
12450
|
*/
|
|
12104
12451
|
getEmbedParams() {
|
|
12105
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
12452
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader, showLiveboardTitle, showLiveboardDescription, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
12106
12453
|
let params = {};
|
|
12107
12454
|
params[Param.EmbedApp] = true;
|
|
12108
12455
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
12109
12456
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
12110
12457
|
params[Param.HideApplicationSwitcher] = !!hideApplicationSwitcher;
|
|
12111
12458
|
params[Param.HideOrgSwitcher] = !!hideOrgSwitcher;
|
|
12459
|
+
params[Param.HideLiveboardHeader] = !!hideLiveboardHeader;
|
|
12460
|
+
params[Param.ShowLiveboardTitle] = !!showLiveboardTitle;
|
|
12461
|
+
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
|
|
12112
12462
|
params = this.getBaseQueryParams(params);
|
|
12113
12463
|
if (fullHeight === true) {
|
|
12114
12464
|
params[Param.fullHeight] = true;
|
|
@@ -12260,6 +12610,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12260
12610
|
constructor(domSelector, viewConfig) {
|
|
12261
12611
|
super(domSelector, viewConfig);
|
|
12262
12612
|
this.defaultHeight = 500;
|
|
12613
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
12263
12614
|
/**
|
|
12264
12615
|
* Set the iframe height as per the computed height received
|
|
12265
12616
|
* from the ThoughtSpot app.
|
|
@@ -12292,7 +12643,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12292
12643
|
let params = {};
|
|
12293
12644
|
params[Param.EmbedApp] = true;
|
|
12294
12645
|
params = this.getBaseQueryParams(params);
|
|
12295
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
12646
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, runtimeParameters, } = this.viewConfig;
|
|
12296
12647
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
12297
12648
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
12298
12649
|
if (fullHeight === true) {
|
|
@@ -12320,6 +12671,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12320
12671
|
if (hideTabPanel) {
|
|
12321
12672
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
12322
12673
|
}
|
|
12674
|
+
if (hideLiveboardHeader) {
|
|
12675
|
+
params[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
12676
|
+
}
|
|
12677
|
+
if (showLiveboardDescription) {
|
|
12678
|
+
params[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
12679
|
+
}
|
|
12680
|
+
if (showLiveboardTitle) {
|
|
12681
|
+
params[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
12682
|
+
}
|
|
12323
12683
|
let queryParams = getQueryParamString(params, true);
|
|
12324
12684
|
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
12325
12685
|
if (parameterQuery)
|
|
@@ -12429,6 +12789,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
12429
12789
|
class SearchEmbed extends TsEmbed {
|
|
12430
12790
|
constructor(domSelector, viewConfig) {
|
|
12431
12791
|
super(domSelector);
|
|
12792
|
+
this.embedComponentType = 'SearchEmbed';
|
|
12432
12793
|
this.viewConfig = viewConfig;
|
|
12433
12794
|
}
|
|
12434
12795
|
/**
|
|
@@ -12533,6 +12894,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
12533
12894
|
class SearchBarEmbed extends TsEmbed {
|
|
12534
12895
|
constructor(domSelector, viewConfig) {
|
|
12535
12896
|
super(domSelector);
|
|
12897
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
12536
12898
|
this.viewConfig = viewConfig;
|
|
12537
12899
|
}
|
|
12538
12900
|
/**
|
|
@@ -12611,6 +12973,7 @@ class SageEmbed extends V1Embed {
|
|
|
12611
12973
|
// eslint-disable-next-line no-useless-constructor
|
|
12612
12974
|
constructor(domSelector, viewConfig) {
|
|
12613
12975
|
super(domSelector, viewConfig);
|
|
12976
|
+
this.embedComponentType = 'SageEmbed';
|
|
12614
12977
|
}
|
|
12615
12978
|
/**
|
|
12616
12979
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -12672,4 +13035,4 @@ class SageEmbed extends V1Embed {
|
|
|
12672
13035
|
}
|
|
12673
13036
|
}
|
|
12674
13037
|
|
|
12675
|
-
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 };
|
|
13038
|
+
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 };
|