@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.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
|
*
|
|
@@ -27,7 +71,7 @@
|
|
|
27
71
|
const filterExpr = [];
|
|
28
72
|
filterExpr.push(`col${index}=${filter.columnName}`);
|
|
29
73
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
30
|
-
filterExpr.push(filter.values.map((value) => `val${index}=${value}`).join('&'));
|
|
74
|
+
filterExpr.push(filter.values.map((value) => `val${index}=${encodeURIComponent(value)}`).join('&'));
|
|
31
75
|
return filterExpr.join('&');
|
|
32
76
|
});
|
|
33
77
|
return `${filters.join('&')}`;
|
|
@@ -199,6 +243,30 @@
|
|
|
199
243
|
*/
|
|
200
244
|
function getDOMNode(domSelector) {
|
|
201
245
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
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;
|
|
202
270
|
}
|
|
203
271
|
|
|
204
272
|
/**
|
|
@@ -443,27 +511,27 @@
|
|
|
443
511
|
/**
|
|
444
512
|
* Search bar
|
|
445
513
|
*/
|
|
446
|
-
HomepageModule["Search"] = "
|
|
514
|
+
HomepageModule["Search"] = "SEARCH";
|
|
447
515
|
/**
|
|
448
516
|
* kPI watchlist module
|
|
449
517
|
*/
|
|
450
|
-
HomepageModule["Watchlist"] = "
|
|
518
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
451
519
|
/**
|
|
452
520
|
* favorite objects
|
|
453
521
|
*/
|
|
454
|
-
HomepageModule["Favorite"] = "
|
|
522
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
455
523
|
/**
|
|
456
524
|
* List of answers and liveboards
|
|
457
525
|
*/
|
|
458
|
-
HomepageModule["MyLibrary"] = "
|
|
526
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
459
527
|
/**
|
|
460
528
|
* Trending list
|
|
461
529
|
*/
|
|
462
|
-
HomepageModule["Trending"] = "
|
|
530
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
463
531
|
/**
|
|
464
532
|
* Learning videos
|
|
465
533
|
*/
|
|
466
|
-
HomepageModule["Learning"] = "
|
|
534
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
467
535
|
})(exports.HomepageModule || (exports.HomepageModule = {}));
|
|
468
536
|
(function (EmbedEvent) {
|
|
469
537
|
/**
|
|
@@ -2530,12 +2598,6 @@
|
|
|
2530
2598
|
*/
|
|
2531
2599
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2532
2600
|
})(exports.Action || (exports.Action = {}));
|
|
2533
|
-
// eslint-disable-next-line no-shadow
|
|
2534
|
-
var OperationType;
|
|
2535
|
-
(function (OperationType) {
|
|
2536
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2537
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2538
|
-
})(OperationType || (OperationType = {}));
|
|
2539
2601
|
(function (PrefetchFeatures) {
|
|
2540
2602
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
2541
2603
|
PrefetchFeatures["SearchEmbed"] = "SearchEmbed";
|
|
@@ -8646,6 +8708,7 @@
|
|
|
8646
8708
|
* @param sessionInfo
|
|
8647
8709
|
*/
|
|
8648
8710
|
function initMixpanel(sessionInfo) {
|
|
8711
|
+
var _a;
|
|
8649
8712
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8650
8713
|
return;
|
|
8651
8714
|
}
|
|
@@ -8663,6 +8726,7 @@
|
|
|
8663
8726
|
clusterId: sessionInfo.clusterId,
|
|
8664
8727
|
clusterName: sessionInfo.clusterName,
|
|
8665
8728
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8729
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8666
8730
|
});
|
|
8667
8731
|
isMixpanelInitialized = true;
|
|
8668
8732
|
emptyQueue();
|
|
@@ -9155,12 +9219,12 @@
|
|
|
9155
9219
|
* _.isObject(null);
|
|
9156
9220
|
* // => false
|
|
9157
9221
|
*/
|
|
9158
|
-
function isObject(value) {
|
|
9222
|
+
function isObject$1(value) {
|
|
9159
9223
|
var type = typeof value;
|
|
9160
9224
|
return value != null && (type == 'object' || type == 'function');
|
|
9161
9225
|
}
|
|
9162
9226
|
|
|
9163
|
-
var isObject_1 = isObject;
|
|
9227
|
+
var isObject_1 = isObject$1;
|
|
9164
9228
|
|
|
9165
9229
|
/** `Object#toString` result references. */
|
|
9166
9230
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -9991,9 +10055,9 @@
|
|
|
9991
10055
|
var _cacheHas = cacheHas;
|
|
9992
10056
|
|
|
9993
10057
|
/* Built-in method references that are verified to be native. */
|
|
9994
|
-
var Set = _getNative(_root, 'Set');
|
|
10058
|
+
var Set$1 = _getNative(_root, 'Set');
|
|
9995
10059
|
|
|
9996
|
-
var _Set = Set;
|
|
10060
|
+
var _Set = Set$1;
|
|
9997
10061
|
|
|
9998
10062
|
/**
|
|
9999
10063
|
* This method returns `undefined`.
|
|
@@ -10829,9 +10893,9 @@
|
|
|
10829
10893
|
};
|
|
10830
10894
|
/**
|
|
10831
10895
|
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
10832
|
-
*
|
|
10833
10896
|
* @param data
|
|
10834
10897
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
10898
|
+
* @group Global methods
|
|
10835
10899
|
*/
|
|
10836
10900
|
const executeTML = async (data) => {
|
|
10837
10901
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10874,11 +10938,10 @@
|
|
|
10874
10938
|
});
|
|
10875
10939
|
};
|
|
10876
10940
|
/**
|
|
10877
|
-
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
|
|
10878
|
-
* format.
|
|
10879
|
-
*
|
|
10941
|
+
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
|
|
10880
10942
|
* @param data
|
|
10881
10943
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
10944
|
+
* @group Global methods
|
|
10882
10945
|
*/
|
|
10883
10946
|
const exportTML = async (data) => {
|
|
10884
10947
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10924,58 +10987,351 @@
|
|
|
10924
10987
|
|
|
10925
10988
|
/**
|
|
10926
10989
|
*
|
|
10927
|
-
* @param
|
|
10928
|
-
* @param query
|
|
10929
|
-
* @param
|
|
10990
|
+
* @param root0
|
|
10991
|
+
* @param root0.query
|
|
10992
|
+
* @param root0.variables
|
|
10993
|
+
* @param root0.thoughtSpotHost
|
|
10994
|
+
* @param root0.isCompositeQuery
|
|
10995
|
+
*/
|
|
10996
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
10997
|
+
const operationName = getOperationNameFromQuery(query);
|
|
10998
|
+
try {
|
|
10999
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
11000
|
+
method: 'POST',
|
|
11001
|
+
headers: {
|
|
11002
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
11003
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11004
|
+
accept: '*/*',
|
|
11005
|
+
'accept-language': 'en-us',
|
|
11006
|
+
},
|
|
11007
|
+
body: JSON.stringify({
|
|
11008
|
+
operationName,
|
|
11009
|
+
query,
|
|
11010
|
+
variables,
|
|
11011
|
+
}),
|
|
11012
|
+
credentials: 'include',
|
|
11013
|
+
});
|
|
11014
|
+
const result = await response.json();
|
|
11015
|
+
const dataValues = Object.values(result.data);
|
|
11016
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
11017
|
+
}
|
|
11018
|
+
catch (error) {
|
|
11019
|
+
return error;
|
|
11020
|
+
}
|
|
11021
|
+
}
|
|
11022
|
+
|
|
11023
|
+
const getSourceDetailQuery = `
|
|
11024
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
11025
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
11026
|
+
id
|
|
11027
|
+
name
|
|
11028
|
+
description
|
|
11029
|
+
authorName
|
|
11030
|
+
authorDisplayName
|
|
11031
|
+
isExternal
|
|
11032
|
+
type
|
|
11033
|
+
created
|
|
11034
|
+
modified
|
|
11035
|
+
columns {
|
|
11036
|
+
id
|
|
11037
|
+
name
|
|
11038
|
+
author
|
|
11039
|
+
authorDisplayName
|
|
11040
|
+
description
|
|
11041
|
+
dataType
|
|
11042
|
+
type
|
|
11043
|
+
modified
|
|
11044
|
+
ownerName
|
|
11045
|
+
owner
|
|
11046
|
+
dataRecency
|
|
11047
|
+
sources {
|
|
11048
|
+
tableId
|
|
11049
|
+
tableName
|
|
11050
|
+
columnId
|
|
11051
|
+
columnName
|
|
11052
|
+
__typename
|
|
11053
|
+
}
|
|
11054
|
+
synonyms
|
|
11055
|
+
cohortAnswerId
|
|
11056
|
+
__typename
|
|
11057
|
+
}
|
|
11058
|
+
relationships
|
|
11059
|
+
destinationRelationships
|
|
11060
|
+
dataSourceId
|
|
11061
|
+
__typename
|
|
11062
|
+
}
|
|
11063
|
+
}
|
|
11064
|
+
`;
|
|
11065
|
+
const sourceDetailCache = new Map();
|
|
11066
|
+
/**
|
|
11067
|
+
*
|
|
10930
11068
|
* @param thoughtSpotHost
|
|
11069
|
+
* @param sourceId
|
|
10931
11070
|
*/
|
|
10932
|
-
function
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
11071
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
11072
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
11073
|
+
return sourceDetailCache.get(sourceId);
|
|
11074
|
+
}
|
|
11075
|
+
const details = await graphqlQuery({
|
|
11076
|
+
query: getSourceDetailQuery,
|
|
11077
|
+
variables: {
|
|
11078
|
+
ids: [sourceId],
|
|
11079
|
+
},
|
|
11080
|
+
thoughtSpotHost,
|
|
11081
|
+
});
|
|
11082
|
+
const souceDetails = details[0];
|
|
11083
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
11084
|
+
return souceDetails;
|
|
11085
|
+
}
|
|
11086
|
+
|
|
11087
|
+
const bachSessionId = `
|
|
11088
|
+
id {
|
|
11089
|
+
sessionId
|
|
11090
|
+
genNo
|
|
11091
|
+
acSession {
|
|
11092
|
+
sessionId
|
|
11093
|
+
genNo
|
|
11094
|
+
}
|
|
11095
|
+
}
|
|
11096
|
+
`;
|
|
11097
|
+
const getUnaggregatedAnswerSession = `
|
|
11098
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
11099
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
11100
|
+
${bachSessionId}
|
|
11101
|
+
answer {
|
|
11102
|
+
visualizations {
|
|
11103
|
+
... on TableViz {
|
|
11104
|
+
columns {
|
|
11105
|
+
column {
|
|
11106
|
+
id
|
|
11107
|
+
name
|
|
11108
|
+
referencedColumns {
|
|
11109
|
+
guid
|
|
11110
|
+
displayName
|
|
11111
|
+
}
|
|
11112
|
+
}
|
|
11113
|
+
}
|
|
11114
|
+
}
|
|
11115
|
+
}
|
|
11116
|
+
}
|
|
11117
|
+
}
|
|
11118
|
+
}
|
|
11119
|
+
`;
|
|
11120
|
+
const removeColumns = `
|
|
11121
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
11122
|
+
Answer__removeColumns(
|
|
11123
|
+
session: $session
|
|
11124
|
+
logicalColumnIds: $logicalColumnIds
|
|
11125
|
+
columnIds: $columnIds
|
|
11126
|
+
) {
|
|
11127
|
+
${bachSessionId}
|
|
11128
|
+
}
|
|
11129
|
+
}
|
|
11130
|
+
`;
|
|
11131
|
+
const addColumns = `
|
|
11132
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
11133
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
11134
|
+
${bachSessionId}
|
|
11135
|
+
}
|
|
11136
|
+
}
|
|
11137
|
+
`;
|
|
11138
|
+
const getAnswerData = `
|
|
11139
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
11140
|
+
getAnswer(session: $session) {
|
|
11141
|
+
${bachSessionId}
|
|
11142
|
+
answer {
|
|
11143
|
+
id
|
|
11144
|
+
visualizations {
|
|
11145
|
+
id
|
|
11146
|
+
... on TableViz {
|
|
11147
|
+
columns {
|
|
11148
|
+
column {
|
|
11149
|
+
id
|
|
11150
|
+
name
|
|
11151
|
+
type
|
|
11152
|
+
aggregationType
|
|
11153
|
+
dataType
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
}
|
|
11160
|
+
}
|
|
11161
|
+
}
|
|
11162
|
+
`;
|
|
11163
|
+
|
|
11164
|
+
// eslint-disable-next-line no-shadow
|
|
11165
|
+
var OperationType;
|
|
11166
|
+
(function (OperationType) {
|
|
11167
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
11168
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
11169
|
+
})(OperationType || (OperationType = {}));
|
|
11170
|
+
/**
|
|
11171
|
+
* Class representing the answer service provided with the
|
|
11172
|
+
* custom action payload. This service could be used to run
|
|
11173
|
+
* graphql queries in the context of the answer on which the
|
|
11174
|
+
* custom action was triggered.
|
|
11175
|
+
*
|
|
11176
|
+
* @example
|
|
11177
|
+
* ```js
|
|
11178
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
11179
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
11180
|
+
* 'col name 1'
|
|
11181
|
+
* ]);
|
|
11182
|
+
* const data = await underlying.fetchData(0, 100);
|
|
11183
|
+
* })
|
|
11184
|
+
* ```
|
|
11185
|
+
* @version
|
|
11186
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
11187
|
+
*/
|
|
11188
|
+
class AnswerService {
|
|
11189
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
11190
|
+
this.session = session;
|
|
11191
|
+
this.answer = answer;
|
|
11192
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
11193
|
+
this.selectedPoints = selectedPoints;
|
|
11194
|
+
this.session = removeTypename(session);
|
|
11195
|
+
}
|
|
11196
|
+
async getSourceDetail() {
|
|
11197
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
11198
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
11199
|
+
}
|
|
11200
|
+
async removeColumns(columnIds) {
|
|
11201
|
+
return this.executeQuery(removeColumns, {
|
|
11202
|
+
logicalColumnIds: columnIds,
|
|
11203
|
+
});
|
|
11204
|
+
}
|
|
11205
|
+
async addColumns(columnIds) {
|
|
11206
|
+
return this.executeQuery(addColumns, {
|
|
11207
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
11208
|
+
});
|
|
11209
|
+
}
|
|
11210
|
+
async fetchData(offset = 0, size = 1000) {
|
|
11211
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
11212
|
+
deadline: 0,
|
|
11213
|
+
dataPaginationParams: {
|
|
11214
|
+
isClientPaginated: true,
|
|
11215
|
+
offset,
|
|
11216
|
+
size,
|
|
11217
|
+
},
|
|
11218
|
+
});
|
|
11219
|
+
const { columns, data } = answer.visualizations[0];
|
|
11220
|
+
return {
|
|
11221
|
+
columns,
|
|
11222
|
+
data,
|
|
11223
|
+
};
|
|
11224
|
+
}
|
|
11225
|
+
/**
|
|
11226
|
+
*
|
|
11227
|
+
* @param userLocale
|
|
11228
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
11229
|
+
* @returns Response
|
|
11230
|
+
*/
|
|
11231
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
11232
|
+
if (omitInfo) {
|
|
11233
|
+
console.warn('omitInfo not supported yet.');
|
|
11234
|
+
}
|
|
11235
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
11236
|
+
return fetch(fetchUrl, {
|
|
11237
|
+
credentials: 'include',
|
|
11238
|
+
});
|
|
11239
|
+
}
|
|
11240
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
11241
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
11242
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
10953
11243
|
}
|
|
10954
|
-
|
|
10955
|
-
|
|
11244
|
+
if (!selectedPoints) {
|
|
11245
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
10956
11246
|
}
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
11247
|
+
const sourceDetail = await this.getSourceDetail();
|
|
11248
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
11249
|
+
const unAggAnswer = await graphqlQuery({
|
|
11250
|
+
query: getUnaggregatedAnswerSession,
|
|
11251
|
+
variables: {
|
|
11252
|
+
session: this.session,
|
|
11253
|
+
columns: selectedPoints,
|
|
11254
|
+
},
|
|
11255
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11256
|
+
});
|
|
11257
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
11258
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
11259
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
11260
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
11261
|
+
if (columnsToAdd.length) {
|
|
11262
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
11263
|
+
}
|
|
11264
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
11265
|
+
if (columnsToRemove.length) {
|
|
11266
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
11267
|
+
}
|
|
11268
|
+
return unaggAnswerSession;
|
|
11269
|
+
}
|
|
11270
|
+
async executeQuery(query, variables) {
|
|
11271
|
+
const data = await graphqlQuery({
|
|
11272
|
+
query,
|
|
11273
|
+
variables: {
|
|
11274
|
+
session: this.session,
|
|
11275
|
+
...variables,
|
|
11276
|
+
},
|
|
11277
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11278
|
+
isCompositeQuery: false,
|
|
11279
|
+
});
|
|
11280
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
11281
|
+
return data;
|
|
11282
|
+
}
|
|
11283
|
+
getSession() {
|
|
11284
|
+
return this.session;
|
|
11285
|
+
}
|
|
11286
|
+
}
|
|
11287
|
+
/**
|
|
11288
|
+
*
|
|
11289
|
+
* @param sourceDetail
|
|
11290
|
+
* @param colNames
|
|
11291
|
+
*/
|
|
11292
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
11293
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
11294
|
+
colSet[col.name] = col;
|
|
11295
|
+
return colSet;
|
|
11296
|
+
}, {});
|
|
11297
|
+
return new Set(colNames.map((colName) => {
|
|
11298
|
+
const col = cols[colName];
|
|
11299
|
+
return col.id;
|
|
11300
|
+
}));
|
|
11301
|
+
}
|
|
11302
|
+
/**
|
|
11303
|
+
*
|
|
11304
|
+
* @param selectedPoints
|
|
11305
|
+
*/
|
|
11306
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
11307
|
+
const underlyingDataPoint = [];
|
|
11308
|
+
/**
|
|
11309
|
+
*
|
|
11310
|
+
* @param colVal
|
|
11311
|
+
*/
|
|
11312
|
+
function addPointFromColVal(colVal) {
|
|
11313
|
+
const dataType = colVal.column.dataType;
|
|
11314
|
+
const id = colVal.column.id;
|
|
11315
|
+
let dataValue;
|
|
11316
|
+
if (dataType === 'DATE') {
|
|
11317
|
+
dataValue = [{
|
|
11318
|
+
epochRange: {
|
|
11319
|
+
startEpoch: colVal.value,
|
|
11320
|
+
},
|
|
11321
|
+
}];
|
|
10961
11322
|
}
|
|
10962
11323
|
else {
|
|
10963
|
-
|
|
10964
|
-
dataPaginationParams: {
|
|
10965
|
-
isClientPaginated: true,
|
|
10966
|
-
offset: offset * batchSize,
|
|
10967
|
-
size: batchSize,
|
|
10968
|
-
},
|
|
10969
|
-
};
|
|
11324
|
+
dataValue = [{ value: colVal.value }];
|
|
10970
11325
|
}
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
11326
|
+
underlyingDataPoint.push({
|
|
11327
|
+
columnId: colVal.column.id,
|
|
11328
|
+
dataValue,
|
|
10974
11329
|
});
|
|
10975
|
-
}
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
};
|
|
11330
|
+
}
|
|
11331
|
+
selectedPoints.forEach((p) => {
|
|
11332
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
11333
|
+
});
|
|
11334
|
+
return underlyingDataPoint;
|
|
10979
11335
|
}
|
|
10980
11336
|
|
|
10981
11337
|
/**
|
|
@@ -10984,16 +11340,12 @@
|
|
|
10984
11340
|
* @param thoughtSpotHost
|
|
10985
11341
|
*/
|
|
10986
11342
|
function processCustomAction(e, thoughtSpotHost) {
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
answerService,
|
|
10994
|
-
};
|
|
10995
|
-
}
|
|
10996
|
-
return e;
|
|
11343
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
11344
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
11345
|
+
return {
|
|
11346
|
+
...e,
|
|
11347
|
+
answerService,
|
|
11348
|
+
};
|
|
10997
11349
|
}
|
|
10998
11350
|
/**
|
|
10999
11351
|
*
|
|
@@ -11138,7 +11490,7 @@
|
|
|
11138
11490
|
});
|
|
11139
11491
|
}
|
|
11140
11492
|
|
|
11141
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
11493
|
+
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$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 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$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};
|
|
11142
11494
|
|
|
11143
11495
|
/**
|
|
11144
11496
|
* Copyright (c) 2022
|
|
@@ -11170,6 +11522,7 @@
|
|
|
11170
11522
|
class TsEmbed {
|
|
11171
11523
|
constructor(domSelector, viewConfig) {
|
|
11172
11524
|
this.isAppInitialized = false;
|
|
11525
|
+
this.embedComponentType = 'TsEmbed';
|
|
11173
11526
|
/**
|
|
11174
11527
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
11175
11528
|
* will generate for embedding. This provides additional security to
|
|
@@ -11201,6 +11554,7 @@
|
|
|
11201
11554
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
11202
11555
|
: null,
|
|
11203
11556
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
11557
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
11204
11558
|
hostConfig: this.embedConfig.hostConfig,
|
|
11205
11559
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
11206
11560
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -11250,6 +11604,7 @@
|
|
|
11250
11604
|
this.registerAppInit();
|
|
11251
11605
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
11252
11606
|
...viewConfig,
|
|
11607
|
+
embedComponentType: this.embedComponentType,
|
|
11253
11608
|
});
|
|
11254
11609
|
}
|
|
11255
11610
|
/**
|
|
@@ -11384,7 +11739,7 @@
|
|
|
11384
11739
|
if (this.embedConfig.pendoTrackingKey) {
|
|
11385
11740
|
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
11386
11741
|
}
|
|
11387
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide,
|
|
11742
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, } = this.viewConfig;
|
|
11388
11743
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
11389
11744
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
11390
11745
|
return queryParams;
|
|
@@ -11445,15 +11800,6 @@
|
|
|
11445
11800
|
if (insertInToSlide) {
|
|
11446
11801
|
queryParams[Param.ShowInsertToSlide] = insertInToSlide;
|
|
11447
11802
|
}
|
|
11448
|
-
if (hideLiveboardHeader) {
|
|
11449
|
-
queryParams[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
11450
|
-
}
|
|
11451
|
-
if (showLiveboardDescription) {
|
|
11452
|
-
queryParams[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
11453
|
-
}
|
|
11454
|
-
if (showLiveboardTitle) {
|
|
11455
|
-
queryParams[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
11456
|
-
}
|
|
11457
11803
|
return queryParams;
|
|
11458
11804
|
}
|
|
11459
11805
|
/**
|
|
@@ -11948,6 +12294,7 @@
|
|
|
11948
12294
|
constructor(domSelector, viewConfig) {
|
|
11949
12295
|
super(domSelector, viewConfig);
|
|
11950
12296
|
this.defaultHeight = '100%';
|
|
12297
|
+
this.embedComponentType = 'AppEmbed';
|
|
11951
12298
|
/**
|
|
11952
12299
|
* Set the iframe height as per the computed height received
|
|
11953
12300
|
* from the ThoughtSpot app.
|
|
@@ -11979,13 +12326,16 @@
|
|
|
11979
12326
|
* embedded Liveboard or visualization.
|
|
11980
12327
|
*/
|
|
11981
12328
|
getEmbedParams() {
|
|
11982
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
12329
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader, showLiveboardTitle, showLiveboardDescription, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11983
12330
|
let params = {};
|
|
11984
12331
|
params[Param.EmbedApp] = true;
|
|
11985
12332
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
11986
12333
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
11987
12334
|
params[Param.HideApplicationSwitcher] = !!hideApplicationSwitcher;
|
|
11988
12335
|
params[Param.HideOrgSwitcher] = !!hideOrgSwitcher;
|
|
12336
|
+
params[Param.HideLiveboardHeader] = !!hideLiveboardHeader;
|
|
12337
|
+
params[Param.ShowLiveboardTitle] = !!showLiveboardTitle;
|
|
12338
|
+
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
|
|
11989
12339
|
params = this.getBaseQueryParams(params);
|
|
11990
12340
|
if (fullHeight === true) {
|
|
11991
12341
|
params[Param.fullHeight] = true;
|
|
@@ -12137,6 +12487,7 @@
|
|
|
12137
12487
|
constructor(domSelector, viewConfig) {
|
|
12138
12488
|
super(domSelector, viewConfig);
|
|
12139
12489
|
this.defaultHeight = 500;
|
|
12490
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
12140
12491
|
/**
|
|
12141
12492
|
* Set the iframe height as per the computed height received
|
|
12142
12493
|
* from the ThoughtSpot app.
|
|
@@ -12169,7 +12520,7 @@
|
|
|
12169
12520
|
let params = {};
|
|
12170
12521
|
params[Param.EmbedApp] = true;
|
|
12171
12522
|
params = this.getBaseQueryParams(params);
|
|
12172
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
12523
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, runtimeParameters, } = this.viewConfig;
|
|
12173
12524
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
12174
12525
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
12175
12526
|
if (fullHeight === true) {
|
|
@@ -12197,6 +12548,15 @@
|
|
|
12197
12548
|
if (hideTabPanel) {
|
|
12198
12549
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
12199
12550
|
}
|
|
12551
|
+
if (hideLiveboardHeader) {
|
|
12552
|
+
params[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
12553
|
+
}
|
|
12554
|
+
if (showLiveboardDescription) {
|
|
12555
|
+
params[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
12556
|
+
}
|
|
12557
|
+
if (showLiveboardTitle) {
|
|
12558
|
+
params[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
12559
|
+
}
|
|
12200
12560
|
let queryParams = getQueryParamString(params, true);
|
|
12201
12561
|
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
12202
12562
|
if (parameterQuery)
|
|
@@ -12306,6 +12666,7 @@
|
|
|
12306
12666
|
class SearchEmbed extends TsEmbed {
|
|
12307
12667
|
constructor(domSelector, viewConfig) {
|
|
12308
12668
|
super(domSelector);
|
|
12669
|
+
this.embedComponentType = 'SearchEmbed';
|
|
12309
12670
|
this.viewConfig = viewConfig;
|
|
12310
12671
|
}
|
|
12311
12672
|
/**
|
|
@@ -12410,6 +12771,7 @@
|
|
|
12410
12771
|
class SearchBarEmbed extends TsEmbed {
|
|
12411
12772
|
constructor(domSelector, viewConfig) {
|
|
12412
12773
|
super(domSelector);
|
|
12774
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
12413
12775
|
this.viewConfig = viewConfig;
|
|
12414
12776
|
}
|
|
12415
12777
|
/**
|
|
@@ -12488,6 +12850,7 @@
|
|
|
12488
12850
|
// eslint-disable-next-line no-useless-constructor
|
|
12489
12851
|
constructor(domSelector, viewConfig) {
|
|
12490
12852
|
super(domSelector, viewConfig);
|
|
12853
|
+
this.embedComponentType = 'SageEmbed';
|
|
12491
12854
|
}
|
|
12492
12855
|
/**
|
|
12493
12856
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -12549,6 +12912,7 @@
|
|
|
12549
12912
|
}
|
|
12550
12913
|
}
|
|
12551
12914
|
|
|
12915
|
+
exports.AnswerService = AnswerService;
|
|
12552
12916
|
exports.AppEmbed = AppEmbed;
|
|
12553
12917
|
exports.LiveboardEmbed = LiveboardEmbed;
|
|
12554
12918
|
exports.PinboardEmbed = PinboardEmbed;
|