@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.js
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
const filterExpr = [];
|
|
188
188
|
filterExpr.push(`col${index}=${filter.columnName}`);
|
|
189
189
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
190
|
-
filterExpr.push(filter.values.map((value) => `val${index}=${value}`).join('&'));
|
|
190
|
+
filterExpr.push(filter.values.map((value) => `val${index}=${encodeURIComponent(value)}`).join('&'));
|
|
191
191
|
return filterExpr.join('&');
|
|
192
192
|
});
|
|
193
193
|
return `${filters.join('&')}`;
|
|
@@ -360,7 +360,30 @@
|
|
|
360
360
|
function getDOMNode(domSelector) {
|
|
361
361
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
362
362
|
}
|
|
363
|
-
const deepMerge = (target, source) => merge(target, source);
|
|
363
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
364
|
+
const getOperationNameFromQuery = (query) => {
|
|
365
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
366
|
+
const matches = query.match(regex);
|
|
367
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
*
|
|
371
|
+
* @param obj
|
|
372
|
+
*/
|
|
373
|
+
function removeTypename(obj) {
|
|
374
|
+
if (!obj || typeof obj !== 'object')
|
|
375
|
+
return obj;
|
|
376
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
377
|
+
for (const key in obj) {
|
|
378
|
+
if (key === '__typename') {
|
|
379
|
+
delete obj[key];
|
|
380
|
+
}
|
|
381
|
+
else if (typeof obj[key] === 'object') {
|
|
382
|
+
removeTypename(obj[key]);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return obj;
|
|
386
|
+
}
|
|
364
387
|
|
|
365
388
|
/**
|
|
366
389
|
* Copyright (c) 2023
|
|
@@ -612,27 +635,27 @@
|
|
|
612
635
|
/**
|
|
613
636
|
* Search bar
|
|
614
637
|
*/
|
|
615
|
-
HomepageModule["Search"] = "
|
|
638
|
+
HomepageModule["Search"] = "SEARCH";
|
|
616
639
|
/**
|
|
617
640
|
* kPI watchlist module
|
|
618
641
|
*/
|
|
619
|
-
HomepageModule["Watchlist"] = "
|
|
642
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
620
643
|
/**
|
|
621
644
|
* favorite objects
|
|
622
645
|
*/
|
|
623
|
-
HomepageModule["Favorite"] = "
|
|
646
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
624
647
|
/**
|
|
625
648
|
* List of answers and liveboards
|
|
626
649
|
*/
|
|
627
|
-
HomepageModule["MyLibrary"] = "
|
|
650
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
628
651
|
/**
|
|
629
652
|
* Trending list
|
|
630
653
|
*/
|
|
631
|
-
HomepageModule["Trending"] = "
|
|
654
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
632
655
|
/**
|
|
633
656
|
* Learning videos
|
|
634
657
|
*/
|
|
635
|
-
HomepageModule["Learning"] = "
|
|
658
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
636
659
|
})(exports.HomepageModule || (exports.HomepageModule = {}));
|
|
637
660
|
(function (EmbedEvent) {
|
|
638
661
|
/**
|
|
@@ -2705,12 +2728,6 @@
|
|
|
2705
2728
|
*/
|
|
2706
2729
|
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2707
2730
|
})(exports.Action || (exports.Action = {}));
|
|
2708
|
-
// eslint-disable-next-line no-shadow
|
|
2709
|
-
var OperationType;
|
|
2710
|
-
(function (OperationType) {
|
|
2711
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2712
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2713
|
-
})(OperationType || (OperationType = {}));
|
|
2714
2731
|
var PrefetchFeatures;
|
|
2715
2732
|
(function (PrefetchFeatures) {
|
|
2716
2733
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8826,6 +8843,7 @@
|
|
|
8826
8843
|
* @param sessionInfo
|
|
8827
8844
|
*/
|
|
8828
8845
|
function initMixpanel(sessionInfo) {
|
|
8846
|
+
var _a;
|
|
8829
8847
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8830
8848
|
return;
|
|
8831
8849
|
}
|
|
@@ -8843,6 +8861,7 @@
|
|
|
8843
8861
|
clusterId: sessionInfo.clusterId,
|
|
8844
8862
|
clusterName: sessionInfo.clusterName,
|
|
8845
8863
|
releaseVersion: sessionInfo.releaseVersion,
|
|
8864
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8846
8865
|
});
|
|
8847
8866
|
isMixpanelInitialized = true;
|
|
8848
8867
|
emptyQueue();
|
|
@@ -10104,58 +10123,351 @@
|
|
|
10104
10123
|
|
|
10105
10124
|
/**
|
|
10106
10125
|
*
|
|
10107
|
-
* @param
|
|
10108
|
-
* @param query
|
|
10109
|
-
* @param
|
|
10126
|
+
* @param root0
|
|
10127
|
+
* @param root0.query
|
|
10128
|
+
* @param root0.variables
|
|
10129
|
+
* @param root0.thoughtSpotHost
|
|
10130
|
+
* @param root0.isCompositeQuery
|
|
10131
|
+
*/
|
|
10132
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
10133
|
+
const operationName = getOperationNameFromQuery(query);
|
|
10134
|
+
try {
|
|
10135
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
10136
|
+
method: 'POST',
|
|
10137
|
+
headers: {
|
|
10138
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
10139
|
+
'x-requested-by': 'ThoughtSpot',
|
|
10140
|
+
accept: '*/*',
|
|
10141
|
+
'accept-language': 'en-us',
|
|
10142
|
+
},
|
|
10143
|
+
body: JSON.stringify({
|
|
10144
|
+
operationName,
|
|
10145
|
+
query,
|
|
10146
|
+
variables,
|
|
10147
|
+
}),
|
|
10148
|
+
credentials: 'include',
|
|
10149
|
+
});
|
|
10150
|
+
const result = await response.json();
|
|
10151
|
+
const dataValues = Object.values(result.data);
|
|
10152
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
10153
|
+
}
|
|
10154
|
+
catch (error) {
|
|
10155
|
+
return error;
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
|
|
10159
|
+
const getSourceDetailQuery = `
|
|
10160
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
10161
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
10162
|
+
id
|
|
10163
|
+
name
|
|
10164
|
+
description
|
|
10165
|
+
authorName
|
|
10166
|
+
authorDisplayName
|
|
10167
|
+
isExternal
|
|
10168
|
+
type
|
|
10169
|
+
created
|
|
10170
|
+
modified
|
|
10171
|
+
columns {
|
|
10172
|
+
id
|
|
10173
|
+
name
|
|
10174
|
+
author
|
|
10175
|
+
authorDisplayName
|
|
10176
|
+
description
|
|
10177
|
+
dataType
|
|
10178
|
+
type
|
|
10179
|
+
modified
|
|
10180
|
+
ownerName
|
|
10181
|
+
owner
|
|
10182
|
+
dataRecency
|
|
10183
|
+
sources {
|
|
10184
|
+
tableId
|
|
10185
|
+
tableName
|
|
10186
|
+
columnId
|
|
10187
|
+
columnName
|
|
10188
|
+
__typename
|
|
10189
|
+
}
|
|
10190
|
+
synonyms
|
|
10191
|
+
cohortAnswerId
|
|
10192
|
+
__typename
|
|
10193
|
+
}
|
|
10194
|
+
relationships
|
|
10195
|
+
destinationRelationships
|
|
10196
|
+
dataSourceId
|
|
10197
|
+
__typename
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
`;
|
|
10201
|
+
const sourceDetailCache = new Map();
|
|
10202
|
+
/**
|
|
10203
|
+
*
|
|
10110
10204
|
* @param thoughtSpotHost
|
|
10205
|
+
* @param sourceId
|
|
10111
10206
|
*/
|
|
10112
|
-
function
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10207
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
10208
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
10209
|
+
return sourceDetailCache.get(sourceId);
|
|
10210
|
+
}
|
|
10211
|
+
const details = await graphqlQuery({
|
|
10212
|
+
query: getSourceDetailQuery,
|
|
10213
|
+
variables: {
|
|
10214
|
+
ids: [sourceId],
|
|
10215
|
+
},
|
|
10216
|
+
thoughtSpotHost,
|
|
10217
|
+
});
|
|
10218
|
+
const souceDetails = details[0];
|
|
10219
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
10220
|
+
return souceDetails;
|
|
10221
|
+
}
|
|
10222
|
+
|
|
10223
|
+
const bachSessionId = `
|
|
10224
|
+
id {
|
|
10225
|
+
sessionId
|
|
10226
|
+
genNo
|
|
10227
|
+
acSession {
|
|
10228
|
+
sessionId
|
|
10229
|
+
genNo
|
|
10230
|
+
}
|
|
10231
|
+
}
|
|
10232
|
+
`;
|
|
10233
|
+
const getUnaggregatedAnswerSession = `
|
|
10234
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
10235
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
10236
|
+
${bachSessionId}
|
|
10237
|
+
answer {
|
|
10238
|
+
visualizations {
|
|
10239
|
+
... on TableViz {
|
|
10240
|
+
columns {
|
|
10241
|
+
column {
|
|
10242
|
+
id
|
|
10243
|
+
name
|
|
10244
|
+
referencedColumns {
|
|
10245
|
+
guid
|
|
10246
|
+
displayName
|
|
10247
|
+
}
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
}
|
|
10253
|
+
}
|
|
10254
|
+
}
|
|
10255
|
+
`;
|
|
10256
|
+
const removeColumns = `
|
|
10257
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
10258
|
+
Answer__removeColumns(
|
|
10259
|
+
session: $session
|
|
10260
|
+
logicalColumnIds: $logicalColumnIds
|
|
10261
|
+
columnIds: $columnIds
|
|
10262
|
+
) {
|
|
10263
|
+
${bachSessionId}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
`;
|
|
10267
|
+
const addColumns = `
|
|
10268
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
10269
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
10270
|
+
${bachSessionId}
|
|
10271
|
+
}
|
|
10272
|
+
}
|
|
10273
|
+
`;
|
|
10274
|
+
const getAnswerData = `
|
|
10275
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
10276
|
+
getAnswer(session: $session) {
|
|
10277
|
+
${bachSessionId}
|
|
10278
|
+
answer {
|
|
10279
|
+
id
|
|
10280
|
+
visualizations {
|
|
10281
|
+
id
|
|
10282
|
+
... on TableViz {
|
|
10283
|
+
columns {
|
|
10284
|
+
column {
|
|
10285
|
+
id
|
|
10286
|
+
name
|
|
10287
|
+
type
|
|
10288
|
+
aggregationType
|
|
10289
|
+
dataType
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
10293
|
+
}
|
|
10294
|
+
}
|
|
10295
|
+
}
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10298
|
+
`;
|
|
10299
|
+
|
|
10300
|
+
// eslint-disable-next-line no-shadow
|
|
10301
|
+
var OperationType;
|
|
10302
|
+
(function (OperationType) {
|
|
10303
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
10304
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
10305
|
+
})(OperationType || (OperationType = {}));
|
|
10306
|
+
/**
|
|
10307
|
+
* Class representing the answer service provided with the
|
|
10308
|
+
* custom action payload. This service could be used to run
|
|
10309
|
+
* graphql queries in the context of the answer on which the
|
|
10310
|
+
* custom action was triggered.
|
|
10311
|
+
*
|
|
10312
|
+
* @example
|
|
10313
|
+
* ```js
|
|
10314
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
10315
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
10316
|
+
* 'col name 1'
|
|
10317
|
+
* ]);
|
|
10318
|
+
* const data = await underlying.fetchData(0, 100);
|
|
10319
|
+
* })
|
|
10320
|
+
* ```
|
|
10321
|
+
* @version
|
|
10322
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
10323
|
+
*/
|
|
10324
|
+
class AnswerService {
|
|
10325
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
10326
|
+
this.session = session;
|
|
10327
|
+
this.answer = answer;
|
|
10328
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
10329
|
+
this.selectedPoints = selectedPoints;
|
|
10330
|
+
this.session = removeTypename(session);
|
|
10331
|
+
}
|
|
10332
|
+
async getSourceDetail() {
|
|
10333
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
10334
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
10335
|
+
}
|
|
10336
|
+
async removeColumns(columnIds) {
|
|
10337
|
+
return this.executeQuery(removeColumns, {
|
|
10338
|
+
logicalColumnIds: columnIds,
|
|
10339
|
+
});
|
|
10340
|
+
}
|
|
10341
|
+
async addColumns(columnIds) {
|
|
10342
|
+
return this.executeQuery(addColumns, {
|
|
10343
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
10344
|
+
});
|
|
10345
|
+
}
|
|
10346
|
+
async fetchData(offset = 0, size = 1000) {
|
|
10347
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
10348
|
+
deadline: 0,
|
|
10349
|
+
dataPaginationParams: {
|
|
10350
|
+
isClientPaginated: true,
|
|
10351
|
+
offset,
|
|
10352
|
+
size,
|
|
10353
|
+
},
|
|
10354
|
+
});
|
|
10355
|
+
const { columns, data } = answer.visualizations[0];
|
|
10356
|
+
return {
|
|
10357
|
+
columns,
|
|
10358
|
+
data,
|
|
10359
|
+
};
|
|
10360
|
+
}
|
|
10361
|
+
/**
|
|
10362
|
+
*
|
|
10363
|
+
* @param userLocale
|
|
10364
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
10365
|
+
* @returns Response
|
|
10366
|
+
*/
|
|
10367
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
10368
|
+
if (omitInfo) {
|
|
10369
|
+
console.warn('omitInfo not supported yet.');
|
|
10370
|
+
}
|
|
10371
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
10372
|
+
return fetch(fetchUrl, {
|
|
10373
|
+
credentials: 'include',
|
|
10374
|
+
});
|
|
10375
|
+
}
|
|
10376
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
10377
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
10378
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
10133
10379
|
}
|
|
10134
|
-
|
|
10135
|
-
|
|
10380
|
+
if (!selectedPoints) {
|
|
10381
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
10136
10382
|
}
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10383
|
+
const sourceDetail = await this.getSourceDetail();
|
|
10384
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
10385
|
+
const unAggAnswer = await graphqlQuery({
|
|
10386
|
+
query: getUnaggregatedAnswerSession,
|
|
10387
|
+
variables: {
|
|
10388
|
+
session: this.session,
|
|
10389
|
+
columns: selectedPoints,
|
|
10390
|
+
},
|
|
10391
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10392
|
+
});
|
|
10393
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
10394
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
10395
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
10396
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
10397
|
+
if (columnsToAdd.length) {
|
|
10398
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
10399
|
+
}
|
|
10400
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
10401
|
+
if (columnsToRemove.length) {
|
|
10402
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
10403
|
+
}
|
|
10404
|
+
return unaggAnswerSession;
|
|
10405
|
+
}
|
|
10406
|
+
async executeQuery(query, variables) {
|
|
10407
|
+
const data = await graphqlQuery({
|
|
10408
|
+
query,
|
|
10409
|
+
variables: {
|
|
10410
|
+
session: this.session,
|
|
10411
|
+
...variables,
|
|
10412
|
+
},
|
|
10413
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10414
|
+
isCompositeQuery: false,
|
|
10415
|
+
});
|
|
10416
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
10417
|
+
return data;
|
|
10418
|
+
}
|
|
10419
|
+
getSession() {
|
|
10420
|
+
return this.session;
|
|
10421
|
+
}
|
|
10422
|
+
}
|
|
10423
|
+
/**
|
|
10424
|
+
*
|
|
10425
|
+
* @param sourceDetail
|
|
10426
|
+
* @param colNames
|
|
10427
|
+
*/
|
|
10428
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
10429
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
10430
|
+
colSet[col.name] = col;
|
|
10431
|
+
return colSet;
|
|
10432
|
+
}, {});
|
|
10433
|
+
return new Set(colNames.map((colName) => {
|
|
10434
|
+
const col = cols[colName];
|
|
10435
|
+
return col.id;
|
|
10436
|
+
}));
|
|
10437
|
+
}
|
|
10438
|
+
/**
|
|
10439
|
+
*
|
|
10440
|
+
* @param selectedPoints
|
|
10441
|
+
*/
|
|
10442
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
10443
|
+
const underlyingDataPoint = [];
|
|
10444
|
+
/**
|
|
10445
|
+
*
|
|
10446
|
+
* @param colVal
|
|
10447
|
+
*/
|
|
10448
|
+
function addPointFromColVal(colVal) {
|
|
10449
|
+
const dataType = colVal.column.dataType;
|
|
10450
|
+
const id = colVal.column.id;
|
|
10451
|
+
let dataValue;
|
|
10452
|
+
if (dataType === 'DATE') {
|
|
10453
|
+
dataValue = [{
|
|
10454
|
+
epochRange: {
|
|
10455
|
+
startEpoch: colVal.value,
|
|
10456
|
+
},
|
|
10457
|
+
}];
|
|
10141
10458
|
}
|
|
10142
10459
|
else {
|
|
10143
|
-
|
|
10144
|
-
dataPaginationParams: {
|
|
10145
|
-
isClientPaginated: true,
|
|
10146
|
-
offset: offset * batchSize,
|
|
10147
|
-
size: batchSize,
|
|
10148
|
-
},
|
|
10149
|
-
};
|
|
10460
|
+
dataValue = [{ value: colVal.value }];
|
|
10150
10461
|
}
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10462
|
+
underlyingDataPoint.push({
|
|
10463
|
+
columnId: colVal.column.id,
|
|
10464
|
+
dataValue,
|
|
10154
10465
|
});
|
|
10155
|
-
}
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
};
|
|
10466
|
+
}
|
|
10467
|
+
selectedPoints.forEach((p) => {
|
|
10468
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
10469
|
+
});
|
|
10470
|
+
return underlyingDataPoint;
|
|
10159
10471
|
}
|
|
10160
10472
|
|
|
10161
10473
|
/**
|
|
@@ -10164,16 +10476,12 @@
|
|
|
10164
10476
|
* @param thoughtSpotHost
|
|
10165
10477
|
*/
|
|
10166
10478
|
function processCustomAction(e, thoughtSpotHost) {
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
answerService,
|
|
10174
|
-
};
|
|
10175
|
-
}
|
|
10176
|
-
return e;
|
|
10479
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
10480
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
10481
|
+
return {
|
|
10482
|
+
...e,
|
|
10483
|
+
answerService,
|
|
10484
|
+
};
|
|
10177
10485
|
}
|
|
10178
10486
|
/**
|
|
10179
10487
|
*
|
|
@@ -10318,7 +10626,7 @@
|
|
|
10318
10626
|
});
|
|
10319
10627
|
}
|
|
10320
10628
|
|
|
10321
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
10629
|
+
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};
|
|
10322
10630
|
|
|
10323
10631
|
/**
|
|
10324
10632
|
* Copyright (c) 2022
|
|
@@ -10350,6 +10658,7 @@
|
|
|
10350
10658
|
class TsEmbed {
|
|
10351
10659
|
constructor(domSelector, viewConfig) {
|
|
10352
10660
|
this.isAppInitialized = false;
|
|
10661
|
+
this.embedComponentType = 'TsEmbed';
|
|
10353
10662
|
/**
|
|
10354
10663
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
10355
10664
|
* will generate for embedding. This provides additional security to
|
|
@@ -10381,6 +10690,7 @@
|
|
|
10381
10690
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
10382
10691
|
: null,
|
|
10383
10692
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
10693
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
10384
10694
|
hostConfig: this.embedConfig.hostConfig,
|
|
10385
10695
|
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
10386
10696
|
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
@@ -10430,6 +10740,7 @@
|
|
|
10430
10740
|
this.registerAppInit();
|
|
10431
10741
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
10432
10742
|
...viewConfig,
|
|
10743
|
+
embedComponentType: this.embedComponentType,
|
|
10433
10744
|
});
|
|
10434
10745
|
}
|
|
10435
10746
|
/**
|
|
@@ -10564,7 +10875,7 @@
|
|
|
10564
10875
|
if (this.embedConfig.pendoTrackingKey) {
|
|
10565
10876
|
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
10566
10877
|
}
|
|
10567
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide,
|
|
10878
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, } = this.viewConfig;
|
|
10568
10879
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
10569
10880
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
10570
10881
|
return queryParams;
|
|
@@ -10625,15 +10936,6 @@
|
|
|
10625
10936
|
if (insertInToSlide) {
|
|
10626
10937
|
queryParams[Param.ShowInsertToSlide] = insertInToSlide;
|
|
10627
10938
|
}
|
|
10628
|
-
if (hideLiveboardHeader) {
|
|
10629
|
-
queryParams[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
10630
|
-
}
|
|
10631
|
-
if (showLiveboardDescription) {
|
|
10632
|
-
queryParams[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
10633
|
-
}
|
|
10634
|
-
if (showLiveboardTitle) {
|
|
10635
|
-
queryParams[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
10636
|
-
}
|
|
10637
10939
|
return queryParams;
|
|
10638
10940
|
}
|
|
10639
10941
|
/**
|
|
@@ -11087,6 +11389,7 @@
|
|
|
11087
11389
|
class SearchBarEmbed extends TsEmbed {
|
|
11088
11390
|
constructor(domSelector, viewConfig) {
|
|
11089
11391
|
super(domSelector);
|
|
11392
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
11090
11393
|
this.viewConfig = viewConfig;
|
|
11091
11394
|
}
|
|
11092
11395
|
/**
|
|
@@ -11165,6 +11468,7 @@
|
|
|
11165
11468
|
// eslint-disable-next-line no-useless-constructor
|
|
11166
11469
|
constructor(domSelector, viewConfig) {
|
|
11167
11470
|
super(domSelector, viewConfig);
|
|
11471
|
+
this.embedComponentType = 'SageEmbed';
|
|
11168
11472
|
}
|
|
11169
11473
|
/**
|
|
11170
11474
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -11249,6 +11553,7 @@
|
|
|
11249
11553
|
class SearchEmbed extends TsEmbed {
|
|
11250
11554
|
constructor(domSelector, viewConfig) {
|
|
11251
11555
|
super(domSelector);
|
|
11556
|
+
this.embedComponentType = 'SearchEmbed';
|
|
11252
11557
|
this.viewConfig = viewConfig;
|
|
11253
11558
|
}
|
|
11254
11559
|
/**
|
|
@@ -11394,6 +11699,7 @@
|
|
|
11394
11699
|
constructor(domSelector, viewConfig) {
|
|
11395
11700
|
super(domSelector, viewConfig);
|
|
11396
11701
|
this.defaultHeight = '100%';
|
|
11702
|
+
this.embedComponentType = 'AppEmbed';
|
|
11397
11703
|
/**
|
|
11398
11704
|
* Set the iframe height as per the computed height received
|
|
11399
11705
|
* from the ThoughtSpot app.
|
|
@@ -11425,13 +11731,16 @@
|
|
|
11425
11731
|
* embedded Liveboard or visualization.
|
|
11426
11732
|
*/
|
|
11427
11733
|
getEmbedParams() {
|
|
11428
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11734
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader, showLiveboardTitle, showLiveboardDescription, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11429
11735
|
let params = {};
|
|
11430
11736
|
params[Param.EmbedApp] = true;
|
|
11431
11737
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
11432
11738
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
11433
11739
|
params[Param.HideApplicationSwitcher] = !!hideApplicationSwitcher;
|
|
11434
11740
|
params[Param.HideOrgSwitcher] = !!hideOrgSwitcher;
|
|
11741
|
+
params[Param.HideLiveboardHeader] = !!hideLiveboardHeader;
|
|
11742
|
+
params[Param.ShowLiveboardTitle] = !!showLiveboardTitle;
|
|
11743
|
+
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
|
|
11435
11744
|
params = this.getBaseQueryParams(params);
|
|
11436
11745
|
if (fullHeight === true) {
|
|
11437
11746
|
params[Param.fullHeight] = true;
|
|
@@ -11583,6 +11892,7 @@
|
|
|
11583
11892
|
constructor(domSelector, viewConfig) {
|
|
11584
11893
|
super(domSelector, viewConfig);
|
|
11585
11894
|
this.defaultHeight = 500;
|
|
11895
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
11586
11896
|
/**
|
|
11587
11897
|
* Set the iframe height as per the computed height received
|
|
11588
11898
|
* from the ThoughtSpot app.
|
|
@@ -11615,7 +11925,7 @@
|
|
|
11615
11925
|
let params = {};
|
|
11616
11926
|
params[Param.EmbedApp] = true;
|
|
11617
11927
|
params = this.getBaseQueryParams(params);
|
|
11618
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
11928
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, runtimeParameters, } = this.viewConfig;
|
|
11619
11929
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
11620
11930
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
11621
11931
|
if (fullHeight === true) {
|
|
@@ -11643,6 +11953,15 @@
|
|
|
11643
11953
|
if (hideTabPanel) {
|
|
11644
11954
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
11645
11955
|
}
|
|
11956
|
+
if (hideLiveboardHeader) {
|
|
11957
|
+
params[Param.HideLiveboardHeader] = hideLiveboardHeader;
|
|
11958
|
+
}
|
|
11959
|
+
if (showLiveboardDescription) {
|
|
11960
|
+
params[Param.ShowLiveboardDescription] = showLiveboardDescription;
|
|
11961
|
+
}
|
|
11962
|
+
if (showLiveboardTitle) {
|
|
11963
|
+
params[Param.ShowLiveboardTitle] = showLiveboardTitle;
|
|
11964
|
+
}
|
|
11646
11965
|
let queryParams = getQueryParamString(params, true);
|
|
11647
11966
|
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
11648
11967
|
if (parameterQuery)
|