@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-react.es.js
CHANGED
|
@@ -179,7 +179,7 @@ const getFilterQuery = (runtimeFilters) => {
|
|
|
179
179
|
const filterExpr = [];
|
|
180
180
|
filterExpr.push(`col${index}=${filter.columnName}`);
|
|
181
181
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
182
|
-
filterExpr.push(filter.values.map((value) => `val${index}=${value}`).join('&'));
|
|
182
|
+
filterExpr.push(filter.values.map((value) => `val${index}=${encodeURIComponent(value)}`).join('&'));
|
|
183
183
|
return filterExpr.join('&');
|
|
184
184
|
});
|
|
185
185
|
return `${filters.join('&')}`;
|
|
@@ -352,7 +352,30 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
352
352
|
function getDOMNode(domSelector) {
|
|
353
353
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
354
354
|
}
|
|
355
|
-
const deepMerge = (target, source) => merge(target, source);
|
|
355
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
356
|
+
const getOperationNameFromQuery = (query) => {
|
|
357
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
358
|
+
const matches = query.match(regex);
|
|
359
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
*
|
|
363
|
+
* @param obj
|
|
364
|
+
*/
|
|
365
|
+
function removeTypename(obj) {
|
|
366
|
+
if (!obj || typeof obj !== 'object')
|
|
367
|
+
return obj;
|
|
368
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
369
|
+
for (const key in obj) {
|
|
370
|
+
if (key === '__typename') {
|
|
371
|
+
delete obj[key];
|
|
372
|
+
}
|
|
373
|
+
else if (typeof obj[key] === 'object') {
|
|
374
|
+
removeTypename(obj[key]);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return obj;
|
|
378
|
+
}
|
|
356
379
|
|
|
357
380
|
/**
|
|
358
381
|
* Copyright (c) 2023
|
|
@@ -615,27 +638,27 @@ var HomepageModule;
|
|
|
615
638
|
/**
|
|
616
639
|
* Search bar
|
|
617
640
|
*/
|
|
618
|
-
HomepageModule["Search"] = "
|
|
641
|
+
HomepageModule["Search"] = "SEARCH";
|
|
619
642
|
/**
|
|
620
643
|
* kPI watchlist module
|
|
621
644
|
*/
|
|
622
|
-
HomepageModule["Watchlist"] = "
|
|
645
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
623
646
|
/**
|
|
624
647
|
* favorite objects
|
|
625
648
|
*/
|
|
626
|
-
HomepageModule["Favorite"] = "
|
|
649
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
627
650
|
/**
|
|
628
651
|
* List of answers and liveboards
|
|
629
652
|
*/
|
|
630
|
-
HomepageModule["MyLibrary"] = "
|
|
653
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
631
654
|
/**
|
|
632
655
|
* Trending list
|
|
633
656
|
*/
|
|
634
|
-
HomepageModule["Trending"] = "
|
|
657
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
635
658
|
/**
|
|
636
659
|
* Learning videos
|
|
637
660
|
*/
|
|
638
|
-
HomepageModule["Learning"] = "
|
|
661
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
639
662
|
})(HomepageModule || (HomepageModule = {}));
|
|
640
663
|
/**
|
|
641
664
|
* Event types emitted by the embedded ThoughtSpot application.
|
|
@@ -2783,12 +2806,6 @@ var Action;
|
|
|
2783
2806
|
*/
|
|
2784
2807
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2785
2808
|
})(Action || (Action = {}));
|
|
2786
|
-
// eslint-disable-next-line no-shadow
|
|
2787
|
-
var OperationType;
|
|
2788
|
-
(function (OperationType) {
|
|
2789
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2790
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2791
|
-
})(OperationType || (OperationType = {}));
|
|
2792
2809
|
var PrefetchFeatures;
|
|
2793
2810
|
(function (PrefetchFeatures) {
|
|
2794
2811
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8904,6 +8921,7 @@ function emptyQueue() {
|
|
|
8904
8921
|
* @param sessionInfo
|
|
8905
8922
|
*/
|
|
8906
8923
|
function initMixpanel(sessionInfo) {
|
|
8924
|
+
var _a;
|
|
8907
8925
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8908
8926
|
return;
|
|
8909
8927
|
}
|
|
@@ -8921,6 +8939,7 @@ function initMixpanel(sessionInfo) {
|
|
|
8921
8939
|
clusterId: sessionInfo.clusterId,
|
|
8922
8940
|
clusterName: sessionInfo.clusterName,
|
|
8923
8941
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8942
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8924
8943
|
});
|
|
8925
8944
|
isMixpanelInitialized = true;
|
|
8926
8945
|
emptyQueue();
|
|
@@ -10182,58 +10201,351 @@ const renderInQueue = (fn) => {
|
|
|
10182
10201
|
|
|
10183
10202
|
/**
|
|
10184
10203
|
*
|
|
10185
|
-
* @param
|
|
10186
|
-
* @param query
|
|
10187
|
-
* @param
|
|
10204
|
+
* @param root0
|
|
10205
|
+
* @param root0.query
|
|
10206
|
+
* @param root0.variables
|
|
10207
|
+
* @param root0.thoughtSpotHost
|
|
10208
|
+
* @param root0.isCompositeQuery
|
|
10209
|
+
*/
|
|
10210
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
10211
|
+
const operationName = getOperationNameFromQuery(query);
|
|
10212
|
+
try {
|
|
10213
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
10214
|
+
method: 'POST',
|
|
10215
|
+
headers: {
|
|
10216
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
10217
|
+
'x-requested-by': 'ThoughtSpot',
|
|
10218
|
+
accept: '*/*',
|
|
10219
|
+
'accept-language': 'en-us',
|
|
10220
|
+
},
|
|
10221
|
+
body: JSON.stringify({
|
|
10222
|
+
operationName,
|
|
10223
|
+
query,
|
|
10224
|
+
variables,
|
|
10225
|
+
}),
|
|
10226
|
+
credentials: 'include',
|
|
10227
|
+
});
|
|
10228
|
+
const result = await response.json();
|
|
10229
|
+
const dataValues = Object.values(result.data);
|
|
10230
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
10231
|
+
}
|
|
10232
|
+
catch (error) {
|
|
10233
|
+
return error;
|
|
10234
|
+
}
|
|
10235
|
+
}
|
|
10236
|
+
|
|
10237
|
+
const getSourceDetailQuery = `
|
|
10238
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
10239
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
10240
|
+
id
|
|
10241
|
+
name
|
|
10242
|
+
description
|
|
10243
|
+
authorName
|
|
10244
|
+
authorDisplayName
|
|
10245
|
+
isExternal
|
|
10246
|
+
type
|
|
10247
|
+
created
|
|
10248
|
+
modified
|
|
10249
|
+
columns {
|
|
10250
|
+
id
|
|
10251
|
+
name
|
|
10252
|
+
author
|
|
10253
|
+
authorDisplayName
|
|
10254
|
+
description
|
|
10255
|
+
dataType
|
|
10256
|
+
type
|
|
10257
|
+
modified
|
|
10258
|
+
ownerName
|
|
10259
|
+
owner
|
|
10260
|
+
dataRecency
|
|
10261
|
+
sources {
|
|
10262
|
+
tableId
|
|
10263
|
+
tableName
|
|
10264
|
+
columnId
|
|
10265
|
+
columnName
|
|
10266
|
+
__typename
|
|
10267
|
+
}
|
|
10268
|
+
synonyms
|
|
10269
|
+
cohortAnswerId
|
|
10270
|
+
__typename
|
|
10271
|
+
}
|
|
10272
|
+
relationships
|
|
10273
|
+
destinationRelationships
|
|
10274
|
+
dataSourceId
|
|
10275
|
+
__typename
|
|
10276
|
+
}
|
|
10277
|
+
}
|
|
10278
|
+
`;
|
|
10279
|
+
const sourceDetailCache = new Map();
|
|
10280
|
+
/**
|
|
10281
|
+
*
|
|
10188
10282
|
* @param thoughtSpotHost
|
|
10283
|
+
* @param sourceId
|
|
10189
10284
|
*/
|
|
10190
|
-
function
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10285
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
10286
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
10287
|
+
return sourceDetailCache.get(sourceId);
|
|
10288
|
+
}
|
|
10289
|
+
const details = await graphqlQuery({
|
|
10290
|
+
query: getSourceDetailQuery,
|
|
10291
|
+
variables: {
|
|
10292
|
+
ids: [sourceId],
|
|
10293
|
+
},
|
|
10294
|
+
thoughtSpotHost,
|
|
10295
|
+
});
|
|
10296
|
+
const souceDetails = details[0];
|
|
10297
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
10298
|
+
return souceDetails;
|
|
10299
|
+
}
|
|
10300
|
+
|
|
10301
|
+
const bachSessionId = `
|
|
10302
|
+
id {
|
|
10303
|
+
sessionId
|
|
10304
|
+
genNo
|
|
10305
|
+
acSession {
|
|
10306
|
+
sessionId
|
|
10307
|
+
genNo
|
|
10308
|
+
}
|
|
10309
|
+
}
|
|
10310
|
+
`;
|
|
10311
|
+
const getUnaggregatedAnswerSession = `
|
|
10312
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
10313
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
10314
|
+
${bachSessionId}
|
|
10315
|
+
answer {
|
|
10316
|
+
visualizations {
|
|
10317
|
+
... on TableViz {
|
|
10318
|
+
columns {
|
|
10319
|
+
column {
|
|
10320
|
+
id
|
|
10321
|
+
name
|
|
10322
|
+
referencedColumns {
|
|
10323
|
+
guid
|
|
10324
|
+
displayName
|
|
10325
|
+
}
|
|
10326
|
+
}
|
|
10327
|
+
}
|
|
10328
|
+
}
|
|
10329
|
+
}
|
|
10330
|
+
}
|
|
10331
|
+
}
|
|
10332
|
+
}
|
|
10333
|
+
`;
|
|
10334
|
+
const removeColumns = `
|
|
10335
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
10336
|
+
Answer__removeColumns(
|
|
10337
|
+
session: $session
|
|
10338
|
+
logicalColumnIds: $logicalColumnIds
|
|
10339
|
+
columnIds: $columnIds
|
|
10340
|
+
) {
|
|
10341
|
+
${bachSessionId}
|
|
10342
|
+
}
|
|
10343
|
+
}
|
|
10344
|
+
`;
|
|
10345
|
+
const addColumns = `
|
|
10346
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
10347
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
10348
|
+
${bachSessionId}
|
|
10349
|
+
}
|
|
10350
|
+
}
|
|
10351
|
+
`;
|
|
10352
|
+
const getAnswerData = `
|
|
10353
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
10354
|
+
getAnswer(session: $session) {
|
|
10355
|
+
${bachSessionId}
|
|
10356
|
+
answer {
|
|
10357
|
+
id
|
|
10358
|
+
visualizations {
|
|
10359
|
+
id
|
|
10360
|
+
... on TableViz {
|
|
10361
|
+
columns {
|
|
10362
|
+
column {
|
|
10363
|
+
id
|
|
10364
|
+
name
|
|
10365
|
+
type
|
|
10366
|
+
aggregationType
|
|
10367
|
+
dataType
|
|
10368
|
+
}
|
|
10369
|
+
}
|
|
10370
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
10371
|
+
}
|
|
10372
|
+
}
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
}
|
|
10376
|
+
`;
|
|
10377
|
+
|
|
10378
|
+
// eslint-disable-next-line no-shadow
|
|
10379
|
+
var OperationType;
|
|
10380
|
+
(function (OperationType) {
|
|
10381
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
10382
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
10383
|
+
})(OperationType || (OperationType = {}));
|
|
10384
|
+
/**
|
|
10385
|
+
* Class representing the answer service provided with the
|
|
10386
|
+
* custom action payload. This service could be used to run
|
|
10387
|
+
* graphql queries in the context of the answer on which the
|
|
10388
|
+
* custom action was triggered.
|
|
10389
|
+
*
|
|
10390
|
+
* @example
|
|
10391
|
+
* ```js
|
|
10392
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
10393
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
10394
|
+
* 'col name 1'
|
|
10395
|
+
* ]);
|
|
10396
|
+
* const data = await underlying.fetchData(0, 100);
|
|
10397
|
+
* })
|
|
10398
|
+
* ```
|
|
10399
|
+
* @version
|
|
10400
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
10401
|
+
*/
|
|
10402
|
+
class AnswerService {
|
|
10403
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
10404
|
+
this.session = session;
|
|
10405
|
+
this.answer = answer;
|
|
10406
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
10407
|
+
this.selectedPoints = selectedPoints;
|
|
10408
|
+
this.session = removeTypename(session);
|
|
10409
|
+
}
|
|
10410
|
+
async getSourceDetail() {
|
|
10411
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
10412
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
10413
|
+
}
|
|
10414
|
+
async removeColumns(columnIds) {
|
|
10415
|
+
return this.executeQuery(removeColumns, {
|
|
10416
|
+
logicalColumnIds: columnIds,
|
|
10417
|
+
});
|
|
10418
|
+
}
|
|
10419
|
+
async addColumns(columnIds) {
|
|
10420
|
+
return this.executeQuery(addColumns, {
|
|
10421
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
10422
|
+
});
|
|
10423
|
+
}
|
|
10424
|
+
async fetchData(offset = 0, size = 1000) {
|
|
10425
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
10426
|
+
deadline: 0,
|
|
10427
|
+
dataPaginationParams: {
|
|
10428
|
+
isClientPaginated: true,
|
|
10429
|
+
offset,
|
|
10430
|
+
size,
|
|
10431
|
+
},
|
|
10432
|
+
});
|
|
10433
|
+
const { columns, data } = answer.visualizations[0];
|
|
10434
|
+
return {
|
|
10435
|
+
columns,
|
|
10436
|
+
data,
|
|
10437
|
+
};
|
|
10438
|
+
}
|
|
10439
|
+
/**
|
|
10440
|
+
*
|
|
10441
|
+
* @param userLocale
|
|
10442
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
10443
|
+
* @returns Response
|
|
10444
|
+
*/
|
|
10445
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
10446
|
+
if (omitInfo) {
|
|
10447
|
+
console.warn('omitInfo not supported yet.');
|
|
10211
10448
|
}
|
|
10212
|
-
|
|
10213
|
-
|
|
10449
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
10450
|
+
return fetch(fetchUrl, {
|
|
10451
|
+
credentials: 'include',
|
|
10452
|
+
});
|
|
10453
|
+
}
|
|
10454
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
10455
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
10456
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
10214
10457
|
}
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10458
|
+
if (!selectedPoints) {
|
|
10459
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
10460
|
+
}
|
|
10461
|
+
const sourceDetail = await this.getSourceDetail();
|
|
10462
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
10463
|
+
const unAggAnswer = await graphqlQuery({
|
|
10464
|
+
query: getUnaggregatedAnswerSession,
|
|
10465
|
+
variables: {
|
|
10466
|
+
session: this.session,
|
|
10467
|
+
columns: selectedPoints,
|
|
10468
|
+
},
|
|
10469
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10470
|
+
});
|
|
10471
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
10472
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
10473
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
10474
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
10475
|
+
if (columnsToAdd.length) {
|
|
10476
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
10477
|
+
}
|
|
10478
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
10479
|
+
if (columnsToRemove.length) {
|
|
10480
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
10481
|
+
}
|
|
10482
|
+
return unaggAnswerSession;
|
|
10483
|
+
}
|
|
10484
|
+
async executeQuery(query, variables) {
|
|
10485
|
+
const data = await graphqlQuery({
|
|
10486
|
+
query,
|
|
10487
|
+
variables: {
|
|
10488
|
+
session: this.session,
|
|
10489
|
+
...variables,
|
|
10490
|
+
},
|
|
10491
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10492
|
+
isCompositeQuery: false,
|
|
10493
|
+
});
|
|
10494
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
10495
|
+
return data;
|
|
10496
|
+
}
|
|
10497
|
+
getSession() {
|
|
10498
|
+
return this.session;
|
|
10499
|
+
}
|
|
10500
|
+
}
|
|
10501
|
+
/**
|
|
10502
|
+
*
|
|
10503
|
+
* @param sourceDetail
|
|
10504
|
+
* @param colNames
|
|
10505
|
+
*/
|
|
10506
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
10507
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
10508
|
+
colSet[col.name] = col;
|
|
10509
|
+
return colSet;
|
|
10510
|
+
}, {});
|
|
10511
|
+
return new Set(colNames.map((colName) => {
|
|
10512
|
+
const col = cols[colName];
|
|
10513
|
+
return col.id;
|
|
10514
|
+
}));
|
|
10515
|
+
}
|
|
10516
|
+
/**
|
|
10517
|
+
*
|
|
10518
|
+
* @param selectedPoints
|
|
10519
|
+
*/
|
|
10520
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
10521
|
+
const underlyingDataPoint = [];
|
|
10522
|
+
/**
|
|
10523
|
+
*
|
|
10524
|
+
* @param colVal
|
|
10525
|
+
*/
|
|
10526
|
+
function addPointFromColVal(colVal) {
|
|
10527
|
+
const dataType = colVal.column.dataType;
|
|
10528
|
+
const id = colVal.column.id;
|
|
10529
|
+
let dataValue;
|
|
10530
|
+
if (dataType === 'DATE') {
|
|
10531
|
+
dataValue = [{
|
|
10532
|
+
epochRange: {
|
|
10533
|
+
startEpoch: colVal.value,
|
|
10534
|
+
},
|
|
10535
|
+
}];
|
|
10219
10536
|
}
|
|
10220
10537
|
else {
|
|
10221
|
-
|
|
10222
|
-
dataPaginationParams: {
|
|
10223
|
-
isClientPaginated: true,
|
|
10224
|
-
offset: offset * batchSize,
|
|
10225
|
-
size: batchSize,
|
|
10226
|
-
},
|
|
10227
|
-
};
|
|
10538
|
+
dataValue = [{ value: colVal.value }];
|
|
10228
10539
|
}
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10540
|
+
underlyingDataPoint.push({
|
|
10541
|
+
columnId: colVal.column.id,
|
|
10542
|
+
dataValue,
|
|
10232
10543
|
});
|
|
10233
|
-
}
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
};
|
|
10544
|
+
}
|
|
10545
|
+
selectedPoints.forEach((p) => {
|
|
10546
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
10547
|
+
});
|
|
10548
|
+
return underlyingDataPoint;
|
|
10237
10549
|
}
|
|
10238
10550
|
|
|
10239
10551
|
/**
|
|
@@ -10242,16 +10554,12 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
|
10242
10554
|
* @param thoughtSpotHost
|
|
10243
10555
|
*/
|
|
10244
10556
|
function processCustomAction(e, thoughtSpotHost) {
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
answerService,
|
|
10252
|
-
};
|
|
10253
|
-
}
|
|
10254
|
-
return e;
|
|
10557
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
10558
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
10559
|
+
return {
|
|
10560
|
+
...e,
|
|
10561
|
+
answerService,
|
|
10562
|
+
};
|
|
10255
10563
|
}
|
|
10256
10564
|
/**
|
|
10257
10565
|
*
|
|
@@ -10396,7 +10704,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
10396
10704
|
});
|
|
10397
10705
|
}
|
|
10398
10706
|
|
|
10399
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
10707
|
+
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};
|
|
10400
10708
|
|
|
10401
10709
|
/**
|
|
10402
10710
|
* Copyright (c) 2022
|
|
@@ -10428,6 +10736,7 @@ const V1EventMap = {};
|
|
|
10428
10736
|
class TsEmbed {
|
|
10429
10737
|
constructor(domSelector, viewConfig) {
|
|
10430
10738
|
this.isAppInitialized = false;
|
|
10739
|
+
this.embedComponentType = 'TsEmbed';
|
|
10431
10740
|
/**
|
|
10432
10741
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
10433
10742
|
* will generate for embedding. This provides additional security to
|
|
@@ -10459,6 +10768,7 @@ class TsEmbed {
|
|
|
10459
10768
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
10460
10769
|
: null,
|
|
10461
10770
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
10771
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
10462
10772
|
hostConfig: this.embedConfig.hostConfig,
|
|
10463
10773
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
10464
10774
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -10508,6 +10818,7 @@ class TsEmbed {
|
|
|
10508
10818
|
this.registerAppInit();
|
|
10509
10819
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
10510
10820
|
...viewConfig,
|
|
10821
|
+
embedComponentType: this.embedComponentType,
|
|
10511
10822
|
});
|
|
10512
10823
|
}
|
|
10513
10824
|
/**
|
|
@@ -10642,7 +10953,7 @@ class TsEmbed {
|
|
|
10642
10953
|
if (this.embedConfig.pendoTrackingKey) {
|
|
10643
10954
|
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
10644
10955
|
}
|
|
10645
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide,
|
|
10956
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, } = this.viewConfig;
|
|
10646
10957
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
10647
10958
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
10648
10959
|
return queryParams;
|
|
@@ -10703,15 +11014,6 @@ class TsEmbed {
|
|
|
10703
11014
|
if (insertInToSlide) {
|
|
10704
11015
|
queryParams[Param.ShowInsertToSlide] = insertInToSlide;
|
|
10705
11016
|
}
|
|
10706
|
-
if (hideLiveboardHeader) {
|
|
10707
|
-
queryParams[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
10708
|
-
}
|
|
10709
|
-
if (showLiveboardDescription) {
|
|
10710
|
-
queryParams[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
10711
|
-
}
|
|
10712
|
-
if (showLiveboardTitle) {
|
|
10713
|
-
queryParams[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
10714
|
-
}
|
|
10715
11017
|
return queryParams;
|
|
10716
11018
|
}
|
|
10717
11019
|
/**
|
|
@@ -11165,6 +11467,7 @@ class V1Embed extends TsEmbed {
|
|
|
11165
11467
|
class SearchBarEmbed extends TsEmbed {
|
|
11166
11468
|
constructor(domSelector, viewConfig) {
|
|
11167
11469
|
super(domSelector);
|
|
11470
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
11168
11471
|
this.viewConfig = viewConfig;
|
|
11169
11472
|
}
|
|
11170
11473
|
/**
|
|
@@ -11243,6 +11546,7 @@ class SageEmbed extends V1Embed {
|
|
|
11243
11546
|
// eslint-disable-next-line no-useless-constructor
|
|
11244
11547
|
constructor(domSelector, viewConfig) {
|
|
11245
11548
|
super(domSelector, viewConfig);
|
|
11549
|
+
this.embedComponentType = 'SageEmbed';
|
|
11246
11550
|
}
|
|
11247
11551
|
/**
|
|
11248
11552
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -11327,6 +11631,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
11327
11631
|
class SearchEmbed extends TsEmbed {
|
|
11328
11632
|
constructor(domSelector, viewConfig) {
|
|
11329
11633
|
super(domSelector);
|
|
11634
|
+
this.embedComponentType = 'SearchEmbed';
|
|
11330
11635
|
this.viewConfig = viewConfig;
|
|
11331
11636
|
}
|
|
11332
11637
|
/**
|
|
@@ -11477,6 +11782,7 @@ class AppEmbed extends V1Embed {
|
|
|
11477
11782
|
constructor(domSelector, viewConfig) {
|
|
11478
11783
|
super(domSelector, viewConfig);
|
|
11479
11784
|
this.defaultHeight = '100%';
|
|
11785
|
+
this.embedComponentType = 'AppEmbed';
|
|
11480
11786
|
/**
|
|
11481
11787
|
* Set the iframe height as per the computed height received
|
|
11482
11788
|
* from the ThoughtSpot app.
|
|
@@ -11508,13 +11814,16 @@ class AppEmbed extends V1Embed {
|
|
|
11508
11814
|
* embedded Liveboard or visualization.
|
|
11509
11815
|
*/
|
|
11510
11816
|
getEmbedParams() {
|
|
11511
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11817
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader, showLiveboardTitle, showLiveboardDescription, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11512
11818
|
let params = {};
|
|
11513
11819
|
params[Param.EmbedApp] = true;
|
|
11514
11820
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
11515
11821
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
11516
11822
|
params[Param.HideApplicationSwitcher] = !!hideApplicationSwitcher;
|
|
11517
11823
|
params[Param.HideOrgSwitcher] = !!hideOrgSwitcher;
|
|
11824
|
+
params[Param.HideLiveboardHeader] = !!hideLiveboardHeader;
|
|
11825
|
+
params[Param.ShowLiveboardTitle] = !!showLiveboardTitle;
|
|
11826
|
+
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
|
|
11518
11827
|
params = this.getBaseQueryParams(params);
|
|
11519
11828
|
if (fullHeight === true) {
|
|
11520
11829
|
params[Param.fullHeight] = true;
|
|
@@ -11666,6 +11975,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
11666
11975
|
constructor(domSelector, viewConfig) {
|
|
11667
11976
|
super(domSelector, viewConfig);
|
|
11668
11977
|
this.defaultHeight = 500;
|
|
11978
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
11669
11979
|
/**
|
|
11670
11980
|
* Set the iframe height as per the computed height received
|
|
11671
11981
|
* from the ThoughtSpot app.
|
|
@@ -11698,7 +12008,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
11698
12008
|
let params = {};
|
|
11699
12009
|
params[Param.EmbedApp] = true;
|
|
11700
12010
|
params = this.getBaseQueryParams(params);
|
|
11701
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
12011
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, runtimeParameters, } = this.viewConfig;
|
|
11702
12012
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
11703
12013
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
11704
12014
|
if (fullHeight === true) {
|
|
@@ -11726,6 +12036,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
11726
12036
|
if (hideTabPanel) {
|
|
11727
12037
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
11728
12038
|
}
|
|
12039
|
+
if (hideLiveboardHeader) {
|
|
12040
|
+
params[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
12041
|
+
}
|
|
12042
|
+
if (showLiveboardDescription) {
|
|
12043
|
+
params[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
12044
|
+
}
|
|
12045
|
+
if (showLiveboardTitle) {
|
|
12046
|
+
params[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
12047
|
+
}
|
|
11729
12048
|
let queryParams = getQueryParamString(params, true);
|
|
11730
12049
|
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
11731
12050
|
if (parameterQuery)
|