@thoughtspot/visual-embed-sdk 1.29.1-alpha.0 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cjs/package.json +2 -1
- package/cjs/src/auth.d.ts +0 -15
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +2 -13
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts +1 -2
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +9 -3
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/authToken.spec.d.ts +2 -0
- package/cjs/src/authToken.spec.d.ts.map +1 -0
- package/cjs/src/authToken.spec.js +29 -0
- package/cjs/src/authToken.spec.js.map +1 -0
- package/cjs/src/config.d.ts +0 -1
- package/cjs/src/config.d.ts.map +1 -1
- package/cjs/src/config.js +0 -2
- package/cjs/src/config.js.map +1 -1
- package/cjs/src/embed/app.d.ts +73 -43
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +45 -12
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +21 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +1 -7
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +9 -15
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +3 -1
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts +0 -2
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js +0 -2
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +14 -28
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +9 -9
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +79 -4
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +5 -21
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +2 -23
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/sage.spec.js +20 -31
- package/cjs/src/embed/sage.spec.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +0 -11
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +0 -2
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +60 -29
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +43 -9
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +34 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -31
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +34 -43
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +83 -9
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.js +1 -1
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +0 -1
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +0 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +0 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +0 -1
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -12
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +1 -11
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +15 -3
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/test/test-utils.d.ts +0 -2
- package/cjs/src/test/test-utils.d.ts.map +1 -1
- package/cjs/src/test/test-utils.js +0 -2
- package/cjs/src/test/test-utils.js.map +1 -1
- package/cjs/src/tokenizedFetch.d.ts +0 -1
- package/cjs/src/tokenizedFetch.d.ts.map +1 -1
- package/cjs/src/tokenizedFetch.js +0 -1
- package/cjs/src/tokenizedFetch.js.map +1 -1
- package/cjs/src/types.d.ts +245 -366
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +196 -296
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.d.ts +0 -1
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +0 -1
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.js +57 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +70 -14
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +78 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/logger.d.ts.map +1 -1
- package/cjs/src/utils/logger.js +3 -5
- package/cjs/src/utils/logger.js.map +1 -1
- package/cjs/src/utils/processData.js +1 -1
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +0 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +0 -2
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +2 -10
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +19 -13
- package/cjs/src/utils.js.map +1 -1
- package/dist/src/auth.d.ts +0 -15
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +1 -2
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/authToken.spec.d.ts +2 -0
- package/dist/src/authToken.spec.d.ts.map +1 -0
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +73 -43
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +1 -7
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts +0 -2
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +14 -28
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +5 -21
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +0 -11
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +60 -29
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -31
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +0 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -12
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +0 -2
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/tokenizedFetch.d.ts +0 -1
- package/dist/src/tokenizedFetch.d.ts.map +1 -1
- package/dist/src/types.d.ts +245 -366
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService/authService.d.ts +0 -1
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +0 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +2 -10
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +2331 -2358
- package/dist/tsembed-react.js +3475 -3498
- package/dist/tsembed.es.js +3690 -3922
- package/dist/tsembed.js +15218 -15442
- package/dist/visual-embed-sdk-react-full.d.ts +431 -564
- package/dist/visual-embed-sdk-react.d.ts +434 -567
- package/dist/visual-embed-sdk.d.ts +430 -552
- package/lib/package.json +2 -1
- package/lib/src/auth.d.ts +0 -15
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -14
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts +1 -2
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +9 -3
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/authToken.spec.d.ts +2 -0
- package/lib/src/authToken.spec.d.ts.map +1 -0
- package/lib/src/authToken.spec.js +26 -0
- package/lib/src/authToken.spec.js.map +1 -0
- package/lib/src/config.d.ts +0 -1
- package/lib/src/config.d.ts.map +1 -1
- package/lib/src/config.js +0 -2
- package/lib/src/config.js.map +1 -1
- package/lib/src/embed/app.d.ts +73 -43
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +44 -11
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +22 -1
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -7
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +8 -14
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +4 -2
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts +0 -2
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js +0 -2
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +14 -28
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +10 -10
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +79 -4
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +5 -21
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +2 -23
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/sage.spec.js +20 -31
- package/lib/src/embed/sage.spec.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +0 -11
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +0 -2
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +60 -29
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +43 -9
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +35 -1
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -31
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +37 -46
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +83 -9
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.js +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +0 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +0 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +0 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +0 -1
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -12
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -11
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +16 -4
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +0 -2
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/test/test-utils.js +0 -2
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/tokenizedFetch.d.ts +0 -1
- package/lib/src/tokenizedFetch.d.ts.map +1 -1
- package/lib/src/tokenizedFetch.js +0 -1
- package/lib/src/tokenizedFetch.js.map +1 -1
- package/lib/src/types.d.ts +245 -366
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +196 -296
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.d.ts +0 -1
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +0 -1
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +1 -1
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answer-queries.js +56 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +71 -15
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +80 -2
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/logger.d.ts.map +1 -1
- package/lib/src/utils/logger.js +2 -3
- package/lib/src/utils/logger.js.map +1 -1
- package/lib/src/utils/processData.js +1 -1
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +0 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +0 -2
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +2 -10
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +17 -12
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +436 -558
- package/package.json +3 -1
- package/src/auth.spec.ts +72 -66
- package/src/auth.ts +53 -54
- package/src/authToken.spec.ts +31 -0
- package/src/authToken.ts +12 -12
- package/src/config.ts +0 -2
- package/src/embed/app.spec.ts +39 -5
- package/src/embed/app.ts +108 -50
- package/src/embed/base.spec.ts +5 -4
- package/src/embed/base.ts +30 -36
- package/src/embed/embed.spec.ts +0 -2
- package/src/embed/embedConfig.ts +0 -2
- package/src/embed/events.spec.ts +0 -2
- package/src/embed/liveboard.spec.ts +104 -11
- package/src/embed/liveboard.ts +25 -38
- package/src/embed/pinboard.spec.ts +0 -2
- package/src/embed/sage.spec.ts +20 -38
- package/src/embed/sage.ts +5 -38
- package/src/embed/search-bar.tsx +0 -11
- package/src/embed/search.spec.ts +48 -2
- package/src/embed/search.ts +94 -38
- package/src/embed/ts-embed-trigger.spec.ts +0 -3
- package/src/embed/ts-embed.spec.ts +109 -32
- package/src/embed/ts-embed.ts +68 -79
- package/src/errors.ts +1 -1
- package/src/index.ts +1 -3
- package/src/mixpanel-service.spec.ts +3 -4
- package/src/mixpanel-service.ts +1 -4
- package/src/react/index.spec.tsx +48 -67
- package/src/react/index.tsx +1 -13
- package/src/test/test-utils.ts +0 -2
- package/src/tokenizedFetch.ts +0 -1
- package/src/types.ts +245 -365
- package/src/utils/authService/authService.spec.ts +8 -13
- package/src/utils/authService/authService.ts +0 -2
- package/src/utils/authService/tokenizedAuthService.ts +8 -38
- package/src/utils/graphql/answerService/answer-queries.ts +58 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +88 -2
- package/src/utils/graphql/answerService/answerService.ts +87 -16
- package/src/utils/logger.ts +2 -3
- package/src/utils/processData.spec.ts +3 -4
- package/src/utils/processData.ts +4 -2
- package/src/utils/processTrigger.ts +0 -2
- package/src/utils.ts +21 -13
- package/cjs/src/utils/sessionInfoService.d.ts +0 -66
- package/cjs/src/utils/sessionInfoService.d.ts.map +0 -1
- package/cjs/src/utils/sessionInfoService.js +0 -92
- package/cjs/src/utils/sessionInfoService.js.map +0 -1
- package/lib/src/utils/sessionInfoService.d.ts +0 -66
- package/lib/src/utils/sessionInfoService.d.ts.map +0 -1
- package/lib/src/utils/sessionInfoService.js +0 -85
- package/lib/src/utils/sessionInfoService.js.map +0 -1
- package/src/utils/sessionInfoService.ts +0 -101
package/src/utils.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023
|
|
3
3
|
*
|
|
4
4
|
* Common utility functions for ThoughtSpot Visual Embed SDK
|
|
5
|
-
*
|
|
6
5
|
* @summary Utils
|
|
7
6
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
7
|
*/
|
|
@@ -23,17 +22,21 @@ import {
|
|
|
23
22
|
* Refer to the following docs for more details on runtime filter syntax:
|
|
24
23
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/apply-runtime-filter.html
|
|
25
24
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/runtime-filter-operators.html
|
|
26
|
-
*
|
|
27
25
|
* @param runtimeFilters
|
|
28
26
|
*/
|
|
29
|
-
export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string => {
|
|
27
|
+
export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string | null => {
|
|
30
28
|
if (runtimeFilters && runtimeFilters.length) {
|
|
31
29
|
const filters = runtimeFilters.map((filter, valueIndex) => {
|
|
32
30
|
const index = valueIndex + 1;
|
|
33
31
|
const filterExpr = [];
|
|
34
32
|
filterExpr.push(`col${index}=${encodeURIComponent(filter.columnName)}`);
|
|
35
33
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
36
|
-
filterExpr.push(
|
|
34
|
+
filterExpr.push(
|
|
35
|
+
filter.values.map((value) => {
|
|
36
|
+
const encodedValue = typeof value === 'bigint' ? value.toString() : value;
|
|
37
|
+
return `val${index}=${encodeURIComponent(String(encodedValue))}`;
|
|
38
|
+
}).join('&'),
|
|
39
|
+
);
|
|
37
40
|
|
|
38
41
|
return filterExpr.join('&');
|
|
39
42
|
});
|
|
@@ -46,7 +49,6 @@ export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string => {
|
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
51
|
* Construct a runtime parameter override query string from the given option.
|
|
49
|
-
*
|
|
50
52
|
* @param runtimeParameters
|
|
51
53
|
*/
|
|
52
54
|
export const getRuntimeParameters = (runtimeParameters: RuntimeParameter[]): string => {
|
|
@@ -69,7 +71,6 @@ export const getRuntimeParameters = (runtimeParameters: RuntimeParameter[]): str
|
|
|
69
71
|
/**
|
|
70
72
|
* Convert a value to a string representation to be sent as a query
|
|
71
73
|
* parameter to the ThoughtSpot app.
|
|
72
|
-
*
|
|
73
74
|
* @param value Any parameter value
|
|
74
75
|
*/
|
|
75
76
|
const serializeParam = (value: any) => {
|
|
@@ -85,14 +86,12 @@ const serializeParam = (value: any) => {
|
|
|
85
86
|
* Convert a value to a string:
|
|
86
87
|
* in case of an array, we convert it to CSV.
|
|
87
88
|
* in case of any other type, we directly return the value.
|
|
88
|
-
*
|
|
89
89
|
* @param value
|
|
90
90
|
*/
|
|
91
91
|
const paramToString = (value: any) => (Array.isArray(value) ? value.join(',') : value);
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* Return a query param string composed from the given params object
|
|
95
|
-
*
|
|
96
95
|
* @param queryParams
|
|
97
96
|
* @param shouldSerializeParamValues
|
|
98
97
|
*/
|
|
@@ -122,7 +121,6 @@ export const getQueryParamString = (
|
|
|
122
121
|
/**
|
|
123
122
|
* Get a string representation of a dimension value in CSS
|
|
124
123
|
* If numeric, it is considered in pixels.
|
|
125
|
-
*
|
|
126
124
|
* @param value
|
|
127
125
|
*/
|
|
128
126
|
export const getCssDimension = (value: number | string): string => {
|
|
@@ -135,7 +133,6 @@ export const getCssDimension = (value: number | string): string => {
|
|
|
135
133
|
|
|
136
134
|
/**
|
|
137
135
|
* Append a string to a URL's hash fragment
|
|
138
|
-
*
|
|
139
136
|
* @param url A URL
|
|
140
137
|
* @param stringToAppend The string to append to the URL hash
|
|
141
138
|
*/
|
|
@@ -240,7 +237,6 @@ export const getRuntimeFilters = (runtimefilters: any) => getFilterQuery(runtime
|
|
|
240
237
|
/**
|
|
241
238
|
* Gets a reference to the DOM node given
|
|
242
239
|
* a selector.
|
|
243
|
-
*
|
|
244
240
|
* @param domSelector
|
|
245
241
|
*/
|
|
246
242
|
export function getDOMNode(domSelector: DOMSelector): HTMLElement {
|
|
@@ -275,7 +271,6 @@ export function removeTypename(obj: any) {
|
|
|
275
271
|
|
|
276
272
|
/**
|
|
277
273
|
* Sets the specified style properties on an HTML element.
|
|
278
|
-
*
|
|
279
274
|
* @param {HTMLElement} element - The HTML element to which the styles should be applied.
|
|
280
275
|
* @param {Partial<CSSStyleDeclaration>} styleProperties - An object containing style
|
|
281
276
|
* property names and their values.
|
|
@@ -299,7 +294,6 @@ export const setStyleProperties = (
|
|
|
299
294
|
};
|
|
300
295
|
/**
|
|
301
296
|
* Removes specified style properties from an HTML element.
|
|
302
|
-
*
|
|
303
297
|
* @param {HTMLElement} element - The HTML element from which the styles should be removed.
|
|
304
298
|
* @param {string[]} styleProperties - An array of style property names to be removed.
|
|
305
299
|
* @example
|
|
@@ -317,3 +311,17 @@ export const removeStyleProperties = (element: HTMLElement, styleProperties: str
|
|
|
317
311
|
};
|
|
318
312
|
|
|
319
313
|
export const isUndefined = (value: any): boolean => value === undefined;
|
|
314
|
+
|
|
315
|
+
// Return if the value is a string, double or boolean.
|
|
316
|
+
export const getTypeFromValue = (value: any): [string, string] => {
|
|
317
|
+
if (typeof value === 'string') {
|
|
318
|
+
return ['char', 'string'];
|
|
319
|
+
}
|
|
320
|
+
if (typeof value === 'number') {
|
|
321
|
+
return ['double', 'double'];
|
|
322
|
+
}
|
|
323
|
+
if (typeof value === 'boolean') {
|
|
324
|
+
return ['boolean', 'boolean'];
|
|
325
|
+
}
|
|
326
|
+
return ['', ''];
|
|
327
|
+
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type SessionInfo = {
|
|
2
|
-
releaseVersion: string;
|
|
3
|
-
userGUID: string;
|
|
4
|
-
currentOrgId: number;
|
|
5
|
-
privileges: string[];
|
|
6
|
-
mixpanelToken: string;
|
|
7
|
-
isPublicUser: boolean;
|
|
8
|
-
clusterId: string;
|
|
9
|
-
clusterName: string;
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Returns the session info object and caches it for future use.
|
|
14
|
-
* Once fetched the session info object is cached and returned from the cache on
|
|
15
|
-
* subsequent calls.
|
|
16
|
-
*
|
|
17
|
-
* @example ```js
|
|
18
|
-
* const sessionInfo = await getSessionInfo();
|
|
19
|
-
* console.log(sessionInfo);
|
|
20
|
-
* ```
|
|
21
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
22
|
-
* @returns {Promise<SessionInfo>} The session info object.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getSessionInfo(): Promise<SessionInfo>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the cached session info object. If the client is not authenticated the
|
|
27
|
-
* function will return null.
|
|
28
|
-
*
|
|
29
|
-
* @example ```js
|
|
30
|
-
* const sessionInfo = getSessionInfoSync();
|
|
31
|
-
* if (sessionInfo) {
|
|
32
|
-
* console.log(sessionInfo);
|
|
33
|
-
* } else {
|
|
34
|
-
* console.log('Not authenticated');
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
* @returns {SessionInfo | null} The session info object.
|
|
38
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
39
|
-
*/
|
|
40
|
-
export declare function getSessionInfoSync(): SessionInfo | null;
|
|
41
|
-
/**
|
|
42
|
-
* Processes the session info response and returns the session info object.
|
|
43
|
-
*
|
|
44
|
-
* @param sessionInfoResp {any} Response from the session info API.
|
|
45
|
-
* @returns {SessionInfo} The session info object.
|
|
46
|
-
* @example ```js
|
|
47
|
-
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
48
|
-
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
49
|
-
* console.log(sessionInfo);
|
|
50
|
-
* ```
|
|
51
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
52
|
-
*/
|
|
53
|
-
export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
|
|
54
|
-
/**
|
|
55
|
-
* Resets the cached session info object and forces a new fetch on the next call.
|
|
56
|
-
*
|
|
57
|
-
* @example ```js
|
|
58
|
-
* resetCachedSessionInfo();
|
|
59
|
-
* const sessionInfo = await getSessionInfo();
|
|
60
|
-
* console.log(sessionInfo);
|
|
61
|
-
* ```
|
|
62
|
-
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
|
-
export declare function resetCachedSessionInfo(): void;
|
|
66
|
-
//# sourceMappingURL=sessionInfoService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInfoService.d.ts","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAQ3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oBAAqB,GAAG,KAAG,WAexD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resetCachedSessionInfo = exports.getSessionDetails = exports.getSessionInfoSync = exports.getSessionInfo = void 0;
|
|
4
|
-
const embedConfig_1 = require("../embed/embedConfig");
|
|
5
|
-
const authService_1 = require("./authService");
|
|
6
|
-
let sessionInfo = null;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the session info object and caches it for future use.
|
|
9
|
-
* Once fetched the session info object is cached and returned from the cache on
|
|
10
|
-
* subsequent calls.
|
|
11
|
-
*
|
|
12
|
-
* @example ```js
|
|
13
|
-
* const sessionInfo = await getSessionInfo();
|
|
14
|
-
* console.log(sessionInfo);
|
|
15
|
-
* ```
|
|
16
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
17
|
-
* @returns {Promise<SessionInfo>} The session info object.
|
|
18
|
-
*/
|
|
19
|
-
async function getSessionInfo() {
|
|
20
|
-
if (!sessionInfo) {
|
|
21
|
-
const host = (0, embedConfig_1.getEmbedConfig)().thoughtSpotHost;
|
|
22
|
-
const sessionResponse = await (0, authService_1.fetchSessionInfoService)(host);
|
|
23
|
-
const processedSessionInfo = (0, exports.getSessionDetails)(sessionResponse);
|
|
24
|
-
sessionInfo = processedSessionInfo;
|
|
25
|
-
}
|
|
26
|
-
return sessionInfo;
|
|
27
|
-
}
|
|
28
|
-
exports.getSessionInfo = getSessionInfo;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the cached session info object. If the client is not authenticated the
|
|
31
|
-
* function will return null.
|
|
32
|
-
*
|
|
33
|
-
* @example ```js
|
|
34
|
-
* const sessionInfo = getSessionInfoSync();
|
|
35
|
-
* if (sessionInfo) {
|
|
36
|
-
* console.log(sessionInfo);
|
|
37
|
-
* } else {
|
|
38
|
-
* console.log('Not authenticated');
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
* @returns {SessionInfo | null} The session info object.
|
|
42
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
43
|
-
*/
|
|
44
|
-
function getSessionInfoSync() {
|
|
45
|
-
return sessionInfo;
|
|
46
|
-
}
|
|
47
|
-
exports.getSessionInfoSync = getSessionInfoSync;
|
|
48
|
-
/**
|
|
49
|
-
* Processes the session info response and returns the session info object.
|
|
50
|
-
*
|
|
51
|
-
* @param sessionInfoResp {any} Response from the session info API.
|
|
52
|
-
* @returns {SessionInfo} The session info object.
|
|
53
|
-
* @example ```js
|
|
54
|
-
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
55
|
-
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
56
|
-
* console.log(sessionInfo);
|
|
57
|
-
* ```
|
|
58
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
59
|
-
*/
|
|
60
|
-
const getSessionDetails = (sessionInfoResp) => {
|
|
61
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
62
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
63
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
64
|
-
? prodMixpanelToken
|
|
65
|
-
: devMixpanelToken;
|
|
66
|
-
return {
|
|
67
|
-
userGUID: sessionInfoResp.userGUID,
|
|
68
|
-
mixpanelToken,
|
|
69
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
70
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
71
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
72
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
73
|
-
...sessionInfoResp,
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
exports.getSessionDetails = getSessionDetails;
|
|
77
|
-
/**
|
|
78
|
-
* Resets the cached session info object and forces a new fetch on the next call.
|
|
79
|
-
*
|
|
80
|
-
* @example ```js
|
|
81
|
-
* resetCachedSessionInfo();
|
|
82
|
-
* const sessionInfo = await getSessionInfo();
|
|
83
|
-
* console.log(sessionInfo);
|
|
84
|
-
* ```
|
|
85
|
-
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
86
|
-
* @returns {void}
|
|
87
|
-
*/
|
|
88
|
-
function resetCachedSessionInfo() {
|
|
89
|
-
sessionInfo = null;
|
|
90
|
-
}
|
|
91
|
-
exports.resetCachedSessionInfo = resetCachedSessionInfo;
|
|
92
|
-
//# sourceMappingURL=sessionInfoService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInfoService.js","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,+CAAwD;AAcxD,IAAI,WAAW,GAAuB,IAAI,CAAC;AAE3C;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,cAAc;IAChC,IAAI,CAAC,WAAW,EAAE;QACd,MAAM,IAAI,GAAG,IAAA,4BAAc,GAAE,CAAC,eAAe,CAAC;QAC9C,MAAM,eAAe,GAAG,MAAM,IAAA,qCAAuB,EAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,oBAAoB,GAAG,IAAA,yBAAiB,EAAC,eAAe,CAAC,CAAC;QAChE,WAAW,GAAG,oBAAoB,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AARD,wCAQC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB;IAC9B,OAAO,WAAW,CAAC;AACvB,CAAC;AAFD,gDAEC;AAED;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,eAAoB,EAAe,EAAE;IACnE,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC;IAC7E,MAAM,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;IAC/E,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU;QACtE,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,gBAAgB,CAAC;IACvB,OAAO;QACH,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,aAAa;QACb,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,YAAY;QACrD,cAAc,EAAE,eAAe,CAAC,cAAc;QAC9C,SAAS,EAAE,eAAe,CAAC,UAAU,CAAC,aAAa;QACnD,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,eAAe;QACvD,GAAG,eAAe;KACrB,CAAC;AACN,CAAC,CAAC;AAfW,QAAA,iBAAiB,qBAe5B;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB;IAClC,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC;AAFD,wDAEC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type SessionInfo = {
|
|
2
|
-
releaseVersion: string;
|
|
3
|
-
userGUID: string;
|
|
4
|
-
currentOrgId: number;
|
|
5
|
-
privileges: string[];
|
|
6
|
-
mixpanelToken: string;
|
|
7
|
-
isPublicUser: boolean;
|
|
8
|
-
clusterId: string;
|
|
9
|
-
clusterName: string;
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Returns the session info object and caches it for future use.
|
|
14
|
-
* Once fetched the session info object is cached and returned from the cache on
|
|
15
|
-
* subsequent calls.
|
|
16
|
-
*
|
|
17
|
-
* @example ```js
|
|
18
|
-
* const sessionInfo = await getSessionInfo();
|
|
19
|
-
* console.log(sessionInfo);
|
|
20
|
-
* ```
|
|
21
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
22
|
-
* @returns {Promise<SessionInfo>} The session info object.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getSessionInfo(): Promise<SessionInfo>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the cached session info object. If the client is not authenticated the
|
|
27
|
-
* function will return null.
|
|
28
|
-
*
|
|
29
|
-
* @example ```js
|
|
30
|
-
* const sessionInfo = getSessionInfoSync();
|
|
31
|
-
* if (sessionInfo) {
|
|
32
|
-
* console.log(sessionInfo);
|
|
33
|
-
* } else {
|
|
34
|
-
* console.log('Not authenticated');
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
* @returns {SessionInfo | null} The session info object.
|
|
38
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
39
|
-
*/
|
|
40
|
-
export declare function getSessionInfoSync(): SessionInfo | null;
|
|
41
|
-
/**
|
|
42
|
-
* Processes the session info response and returns the session info object.
|
|
43
|
-
*
|
|
44
|
-
* @param sessionInfoResp {any} Response from the session info API.
|
|
45
|
-
* @returns {SessionInfo} The session info object.
|
|
46
|
-
* @example ```js
|
|
47
|
-
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
48
|
-
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
49
|
-
* console.log(sessionInfo);
|
|
50
|
-
* ```
|
|
51
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
52
|
-
*/
|
|
53
|
-
export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
|
|
54
|
-
/**
|
|
55
|
-
* Resets the cached session info object and forces a new fetch on the next call.
|
|
56
|
-
*
|
|
57
|
-
* @example ```js
|
|
58
|
-
* resetCachedSessionInfo();
|
|
59
|
-
* const sessionInfo = await getSessionInfo();
|
|
60
|
-
* console.log(sessionInfo);
|
|
61
|
-
* ```
|
|
62
|
-
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
|
-
export declare function resetCachedSessionInfo(): void;
|
|
66
|
-
//# sourceMappingURL=sessionInfoService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInfoService.d.ts","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAQ3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oBAAqB,GAAG,KAAG,WAexD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { getEmbedConfig } from '../embed/embedConfig';
|
|
2
|
-
import { fetchSessionInfoService } from './authService';
|
|
3
|
-
let sessionInfo = null;
|
|
4
|
-
/**
|
|
5
|
-
* Returns the session info object and caches it for future use.
|
|
6
|
-
* Once fetched the session info object is cached and returned from the cache on
|
|
7
|
-
* subsequent calls.
|
|
8
|
-
*
|
|
9
|
-
* @example ```js
|
|
10
|
-
* const sessionInfo = await getSessionInfo();
|
|
11
|
-
* console.log(sessionInfo);
|
|
12
|
-
* ```
|
|
13
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
14
|
-
* @returns {Promise<SessionInfo>} The session info object.
|
|
15
|
-
*/
|
|
16
|
-
export async function getSessionInfo() {
|
|
17
|
-
if (!sessionInfo) {
|
|
18
|
-
const host = getEmbedConfig().thoughtSpotHost;
|
|
19
|
-
const sessionResponse = await fetchSessionInfoService(host);
|
|
20
|
-
const processedSessionInfo = getSessionDetails(sessionResponse);
|
|
21
|
-
sessionInfo = processedSessionInfo;
|
|
22
|
-
}
|
|
23
|
-
return sessionInfo;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns the cached session info object. If the client is not authenticated the
|
|
27
|
-
* function will return null.
|
|
28
|
-
*
|
|
29
|
-
* @example ```js
|
|
30
|
-
* const sessionInfo = getSessionInfoSync();
|
|
31
|
-
* if (sessionInfo) {
|
|
32
|
-
* console.log(sessionInfo);
|
|
33
|
-
* } else {
|
|
34
|
-
* console.log('Not authenticated');
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
* @returns {SessionInfo | null} The session info object.
|
|
38
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
39
|
-
*/
|
|
40
|
-
export function getSessionInfoSync() {
|
|
41
|
-
return sessionInfo;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Processes the session info response and returns the session info object.
|
|
45
|
-
*
|
|
46
|
-
* @param sessionInfoResp {any} Response from the session info API.
|
|
47
|
-
* @returns {SessionInfo} The session info object.
|
|
48
|
-
* @example ```js
|
|
49
|
-
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
50
|
-
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
51
|
-
* console.log(sessionInfo);
|
|
52
|
-
* ```
|
|
53
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
54
|
-
*/
|
|
55
|
-
export const getSessionDetails = (sessionInfoResp) => {
|
|
56
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
57
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
58
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
59
|
-
? prodMixpanelToken
|
|
60
|
-
: devMixpanelToken;
|
|
61
|
-
return {
|
|
62
|
-
userGUID: sessionInfoResp.userGUID,
|
|
63
|
-
mixpanelToken,
|
|
64
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
65
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
66
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
67
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
68
|
-
...sessionInfoResp,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Resets the cached session info object and forces a new fetch on the next call.
|
|
73
|
-
*
|
|
74
|
-
* @example ```js
|
|
75
|
-
* resetCachedSessionInfo();
|
|
76
|
-
* const sessionInfo = await getSessionInfo();
|
|
77
|
-
* console.log(sessionInfo);
|
|
78
|
-
* ```
|
|
79
|
-
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
80
|
-
* @returns {void}
|
|
81
|
-
*/
|
|
82
|
-
export function resetCachedSessionInfo() {
|
|
83
|
-
sessionInfo = null;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=sessionInfoService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInfoService.js","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAcxD,IAAI,WAAW,GAAuB,IAAI,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAChC,IAAI,CAAC,WAAW,EAAE;QACd,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC,eAAe,CAAC;QAC9C,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAChE,WAAW,GAAG,oBAAoB,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB;IAC9B,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAoB,EAAe,EAAE;IACnE,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC;IAC7E,MAAM,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;IAC/E,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU;QACtE,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,gBAAgB,CAAC;IACvB,OAAO;QACH,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,aAAa;QACb,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,YAAY;QACrD,cAAc,EAAE,eAAe,CAAC,cAAc;QAC9C,SAAS,EAAE,eAAe,CAAC,UAAU,CAAC,aAAa;QACnD,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,eAAe;QACvD,GAAG,eAAe;KACrB,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB;IAClC,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { getEmbedConfig } from '../embed/embedConfig';
|
|
2
|
-
import { fetchSessionInfoService } from './authService';
|
|
3
|
-
|
|
4
|
-
export type SessionInfo = {
|
|
5
|
-
releaseVersion: string;
|
|
6
|
-
userGUID: string;
|
|
7
|
-
currentOrgId: number;
|
|
8
|
-
privileges: string[];
|
|
9
|
-
mixpanelToken: string;
|
|
10
|
-
isPublicUser: boolean;
|
|
11
|
-
clusterId: string;
|
|
12
|
-
clusterName: string;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
let sessionInfo: null | SessionInfo = null;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns the session info object and caches it for future use.
|
|
20
|
-
* Once fetched the session info object is cached and returned from the cache on
|
|
21
|
-
* subsequent calls.
|
|
22
|
-
*
|
|
23
|
-
* @example ```js
|
|
24
|
-
* const sessionInfo = await getSessionInfo();
|
|
25
|
-
* console.log(sessionInfo);
|
|
26
|
-
* ```
|
|
27
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
28
|
-
* @returns {Promise<SessionInfo>} The session info object.
|
|
29
|
-
*/
|
|
30
|
-
export async function getSessionInfo(): Promise<SessionInfo> {
|
|
31
|
-
if (!sessionInfo) {
|
|
32
|
-
const host = getEmbedConfig().thoughtSpotHost;
|
|
33
|
-
const sessionResponse = await fetchSessionInfoService(host);
|
|
34
|
-
const processedSessionInfo = getSessionDetails(sessionResponse);
|
|
35
|
-
sessionInfo = processedSessionInfo;
|
|
36
|
-
}
|
|
37
|
-
return sessionInfo;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns the cached session info object. If the client is not authenticated the
|
|
42
|
-
* function will return null.
|
|
43
|
-
*
|
|
44
|
-
* @example ```js
|
|
45
|
-
* const sessionInfo = getSessionInfoSync();
|
|
46
|
-
* if (sessionInfo) {
|
|
47
|
-
* console.log(sessionInfo);
|
|
48
|
-
* } else {
|
|
49
|
-
* console.log('Not authenticated');
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
* @returns {SessionInfo | null} The session info object.
|
|
53
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
54
|
-
*/
|
|
55
|
-
export function getSessionInfoSync(): SessionInfo | null {
|
|
56
|
-
return sessionInfo;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Processes the session info response and returns the session info object.
|
|
61
|
-
*
|
|
62
|
-
* @param sessionInfoResp {any} Response from the session info API.
|
|
63
|
-
* @returns {SessionInfo} The session info object.
|
|
64
|
-
* @example ```js
|
|
65
|
-
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
66
|
-
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
67
|
-
* console.log(sessionInfo);
|
|
68
|
-
* ```
|
|
69
|
-
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
70
|
-
*/
|
|
71
|
-
export const getSessionDetails = (sessionInfoResp: any): SessionInfo => {
|
|
72
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
73
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
74
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
75
|
-
? prodMixpanelToken
|
|
76
|
-
: devMixpanelToken;
|
|
77
|
-
return {
|
|
78
|
-
userGUID: sessionInfoResp.userGUID,
|
|
79
|
-
mixpanelToken,
|
|
80
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
81
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
82
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
83
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
84
|
-
...sessionInfoResp,
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Resets the cached session info object and forces a new fetch on the next call.
|
|
90
|
-
*
|
|
91
|
-
* @example ```js
|
|
92
|
-
* resetCachedSessionInfo();
|
|
93
|
-
* const sessionInfo = await getSessionInfo();
|
|
94
|
-
* console.log(sessionInfo);
|
|
95
|
-
* ```
|
|
96
|
-
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
97
|
-
* @returns {void}
|
|
98
|
-
*/
|
|
99
|
-
export function resetCachedSessionInfo(): void {
|
|
100
|
-
sessionInfo = null;
|
|
101
|
-
}
|