@thoughtspot/visual-embed-sdk 1.24.0-sage.3 → 1.24.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 +10 -3
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +3 -0
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/css-variables.d.ts +38 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +33 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +12 -8
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +46 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +6 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +8 -3
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +6 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +6 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +23 -7
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +1 -0
- 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 +7 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +6 -2
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +16 -2
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +9 -2
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +49 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +4 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +31 -8
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +186 -3
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +4 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +1 -0
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +12 -3
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +13 -3
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +15 -15
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +7 -3
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +12 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +216 -21
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +133 -13
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/answerService/answerService.d.ts +34 -0
- package/cjs/src/utils/answerService/answerService.d.ts.map +1 -0
- package/cjs/src/utils/answerService/answerService.js +142 -0
- package/cjs/src/utils/answerService/answerService.js.map +1 -0
- package/cjs/src/utils/answerService/answerService.spec.d.ts +1 -0
- package/cjs/src/utils/answerService/answerService.spec.d.ts.map +1 -0
- package/cjs/src/utils/answerService/answerService.spec.js +1 -0
- package/cjs/src/utils/answerService/answerService.spec.js.map +1 -0
- package/cjs/src/utils/answerService/graphql-queries.d.ts +6 -0
- package/cjs/src/utils/answerService/graphql-queries.d.ts.map +1 -0
- package/cjs/src/utils/answerService/graphql-queries.js +123 -0
- package/cjs/src/utils/answerService/graphql-queries.js.map +1 -0
- 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/answerService/graphql-queries.d.ts +5 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.js +80 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.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 +13 -1
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +45 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +24 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/css-variables.d.ts +38 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +33 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +6 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +1 -0
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +7 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +16 -2
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +1 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +15 -15
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +216 -21
- 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 +13 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +603 -96
- package/dist/tsembed-react.js +596 -95
- package/dist/tsembed.es.js +655 -100
- package/dist/tsembed.js +649 -99
- package/dist/visual-embed-sdk-react-full.d.ts +615 -260
- package/dist/visual-embed-sdk-react.d.ts +617 -262
- package/dist/visual-embed-sdk.d.ts +380 -26
- package/lib/package.json +10 -3
- package/lib/src/.index.d.ts.swp +0 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -0
- package/lib/src/auth.js.map +1 -1
- package/lib/src/css-variables.d.ts +38 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +33 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +12 -8
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +46 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +6 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +8 -3
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +6 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +7 -3
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +23 -7
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +1 -0
- 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 +7 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +7 -3
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +16 -2
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +10 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +49 -0
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +32 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +187 -4
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +4 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +4 -3
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +1 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +12 -3
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +13 -3
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +15 -15
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +5 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +13 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +216 -21
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +132 -12
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/answerService/answerService.d.ts +34 -0
- package/lib/src/utils/answerService/answerService.d.ts.map +1 -0
- package/lib/src/utils/answerService/answerService.js +137 -0
- package/lib/src/utils/answerService/answerService.js.map +1 -0
- package/lib/src/utils/answerService/answerService.spec.d.ts +1 -0
- package/lib/src/utils/answerService/answerService.spec.d.ts.map +1 -0
- package/lib/src/utils/answerService/answerService.spec.js +1 -0
- package/lib/src/utils/answerService/answerService.spec.js.map +1 -0
- package/lib/src/utils/answerService/graphql-queries.d.ts +6 -0
- package/lib/src/utils/answerService/graphql-queries.d.ts.map +1 -0
- package/lib/src/utils/answerService/graphql-queries.js +120 -0
- package/lib/src/utils/answerService/graphql-queries.js.map +1 -0
- 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/answerService/graphql-queries.d.ts +5 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.js +77 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.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 +13 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +41 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +25 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +389 -30
- package/package.json +10 -3
- package/src/auth.ts +6 -3
- package/src/css-variables.ts +47 -0
- package/src/embed/app.spec.ts +63 -0
- package/src/embed/app.ts +52 -15
- package/src/embed/base.ts +11 -6
- package/src/embed/liveboard.spec.ts +29 -10
- package/src/embed/liveboard.ts +13 -2
- package/src/embed/sage.ts +2 -0
- package/src/embed/search-bar.tsx +21 -6
- package/src/embed/search.spec.ts +61 -0
- package/src/embed/search.ts +36 -3
- package/src/embed/ts-embed.spec.ts +211 -8
- package/src/embed/ts-embed.ts +34 -9
- package/src/index.ts +9 -0
- package/src/mixpanel-service.spec.ts +13 -3
- package/src/mixpanel-service.ts +11 -3
- package/src/react/index.spec.tsx +33 -2
- package/src/react/index.tsx +37 -26
- package/src/types.ts +305 -103
- 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 +31 -0
- package/src/utils.ts +47 -0
- package/src/utils/answerService.spec.ts +0 -41
- package/src/utils/answerService.ts +0 -63
package/dist/tsembed.es.js
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
// istanbul ignore next
|
|
2
|
+
const isObject = (obj) => {
|
|
3
|
+
if (typeof obj === "object" && obj !== null) {
|
|
4
|
+
if (typeof Object.getPrototypeOf === "function") {
|
|
5
|
+
const prototype = Object.getPrototypeOf(obj);
|
|
6
|
+
return prototype === Object.prototype || prototype === null;
|
|
7
|
+
}
|
|
8
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
const merge = (...objects) => objects.reduce((result, current) => {
|
|
13
|
+
if (Array.isArray(current)) {
|
|
14
|
+
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
15
|
+
}
|
|
16
|
+
Object.keys(current).forEach((key) => {
|
|
17
|
+
if (["__proto__", "constructor", "prototype"].includes(key)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
21
|
+
result[key] = merge.options.mergeArrays
|
|
22
|
+
? Array.from(new Set(result[key].concat(current[key])))
|
|
23
|
+
: current[key];
|
|
24
|
+
}
|
|
25
|
+
else if (isObject(result[key]) && isObject(current[key])) {
|
|
26
|
+
result[key] = merge(result[key], current[key]);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
result[key] = current[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return result;
|
|
33
|
+
}, {});
|
|
34
|
+
const defaultOptions = {
|
|
35
|
+
mergeArrays: true,
|
|
36
|
+
};
|
|
37
|
+
merge.options = defaultOptions;
|
|
38
|
+
merge.withOptions = (options, ...objects) => {
|
|
39
|
+
merge.options = Object.assign({ mergeArrays: true }, options);
|
|
40
|
+
const result = merge(...objects);
|
|
41
|
+
merge.options = defaultOptions;
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
|
|
1
45
|
/**
|
|
2
46
|
* Copyright (c) 2023
|
|
3
47
|
*
|
|
@@ -28,6 +72,24 @@ const getFilterQuery = (runtimeFilters) => {
|
|
|
28
72
|
}
|
|
29
73
|
return null;
|
|
30
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Construct a runtime parameter override query string from the given option.
|
|
77
|
+
*
|
|
78
|
+
* @param runtimeParameters
|
|
79
|
+
*/
|
|
80
|
+
const getRuntimeParameters = (runtimeParameters) => {
|
|
81
|
+
if (runtimeParameters && runtimeParameters.length) {
|
|
82
|
+
const params = runtimeParameters.map((param, valueIndex) => {
|
|
83
|
+
const index = valueIndex + 1;
|
|
84
|
+
const filterExpr = [];
|
|
85
|
+
filterExpr.push(`param${index}=${encodeURIComponent(param.name)}`);
|
|
86
|
+
filterExpr.push(`paramVal${index}=${encodeURIComponent(param.value)}`);
|
|
87
|
+
return filterExpr.join('&');
|
|
88
|
+
});
|
|
89
|
+
return `${params.join('&')}`;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
};
|
|
31
93
|
/**
|
|
32
94
|
* Convert a value to a string representation to be sent as a query
|
|
33
95
|
* parameter to the ThoughtSpot app.
|
|
@@ -175,6 +237,30 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
175
237
|
*/
|
|
176
238
|
function getDOMNode(domSelector) {
|
|
177
239
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
240
|
+
}
|
|
241
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
242
|
+
const getOperationNameFromQuery = (query) => {
|
|
243
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
244
|
+
const matches = query.match(regex);
|
|
245
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @param obj
|
|
250
|
+
*/
|
|
251
|
+
function removeTypename(obj) {
|
|
252
|
+
if (!obj || typeof obj !== 'object')
|
|
253
|
+
return obj;
|
|
254
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
255
|
+
for (const key in obj) {
|
|
256
|
+
if (key === '__typename') {
|
|
257
|
+
delete obj[key];
|
|
258
|
+
}
|
|
259
|
+
else if (typeof obj[key] === 'object') {
|
|
260
|
+
removeTypename(obj[key]);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return obj;
|
|
178
264
|
}
|
|
179
265
|
|
|
180
266
|
/**
|
|
@@ -354,6 +440,18 @@ var AuthType;
|
|
|
354
440
|
*/
|
|
355
441
|
AuthType["Basic"] = "Basic";
|
|
356
442
|
})(AuthType || (AuthType = {}));
|
|
443
|
+
var HomeLeftNavItem;
|
|
444
|
+
(function (HomeLeftNavItem) {
|
|
445
|
+
HomeLeftNavItem["QueryBuilder"] = "query-builder";
|
|
446
|
+
HomeLeftNavItem["Home"] = "insights-home";
|
|
447
|
+
HomeLeftNavItem["Liveboards"] = "liveboards";
|
|
448
|
+
HomeLeftNavItem["Answers"] = "answers";
|
|
449
|
+
HomeLeftNavItem["MonitorSubscription"] = "monitor-alerts";
|
|
450
|
+
HomeLeftNavItem["SpotIQAnalysis"] = "spotiq-analysis";
|
|
451
|
+
HomeLeftNavItem["Tutorials"] = "tutorials";
|
|
452
|
+
HomeLeftNavItem["Documentation"] = "documentation";
|
|
453
|
+
HomeLeftNavItem["Community"] = "community";
|
|
454
|
+
})(HomeLeftNavItem || (HomeLeftNavItem = {}));
|
|
357
455
|
/**
|
|
358
456
|
* A map of the supported runtime filter operations
|
|
359
457
|
*/
|
|
@@ -417,6 +515,37 @@ var RuntimeFilterOp;
|
|
|
417
515
|
*/
|
|
418
516
|
RuntimeFilterOp["IN"] = "IN";
|
|
419
517
|
})(RuntimeFilterOp || (RuntimeFilterOp = {}));
|
|
518
|
+
/**
|
|
519
|
+
* Home page module that can be hide
|
|
520
|
+
*/
|
|
521
|
+
// eslint-disable-next-line no-shadow
|
|
522
|
+
var HomepageModule;
|
|
523
|
+
(function (HomepageModule) {
|
|
524
|
+
/**
|
|
525
|
+
* Search bar
|
|
526
|
+
*/
|
|
527
|
+
HomepageModule["Search"] = "SEARCH";
|
|
528
|
+
/**
|
|
529
|
+
* kPI watchlist module
|
|
530
|
+
*/
|
|
531
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
532
|
+
/**
|
|
533
|
+
* favorite objects
|
|
534
|
+
*/
|
|
535
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
536
|
+
/**
|
|
537
|
+
* List of answers and liveboards
|
|
538
|
+
*/
|
|
539
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
540
|
+
/**
|
|
541
|
+
* Trending list
|
|
542
|
+
*/
|
|
543
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
544
|
+
/**
|
|
545
|
+
* Learning videos
|
|
546
|
+
*/
|
|
547
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
548
|
+
})(HomepageModule || (HomepageModule = {}));
|
|
420
549
|
/**
|
|
421
550
|
* Event types emitted by the embedded ThoughtSpot application.
|
|
422
551
|
*
|
|
@@ -843,23 +972,74 @@ var EmbedEvent;
|
|
|
843
972
|
*/
|
|
844
973
|
EmbedEvent["InsertIntoSlide"] = "insertInToSlide";
|
|
845
974
|
/**
|
|
975
|
+
* @hidden
|
|
846
976
|
* Emitted when a user changes any filter on a Liveboard.
|
|
847
|
-
*
|
|
848
977
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
849
978
|
*/
|
|
850
979
|
EmbedEvent["FilterChanged"] = "filterChanged";
|
|
851
980
|
/**
|
|
852
981
|
* Emitted when a user click on Go button in Sage Embed
|
|
853
982
|
*
|
|
854
|
-
* @version SDK : 1.
|
|
983
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
855
984
|
*/
|
|
856
985
|
EmbedEvent["SageEmbedQuery"] = "sageEmbedQuery";
|
|
857
986
|
/**
|
|
858
987
|
* Emitten when a user select data source in Sage Embed
|
|
859
988
|
*
|
|
860
|
-
* @version SDK : 1.
|
|
989
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
861
990
|
*/
|
|
862
991
|
EmbedEvent["SageWorksheetUpdated"] = "sageWorksheetUpdated";
|
|
992
|
+
/**
|
|
993
|
+
* Emitten when a user updates a connection in Data tab
|
|
994
|
+
*
|
|
995
|
+
* @version SDK : 1.27.0 | Thoughtspot: 9.8.0.cl
|
|
996
|
+
*/
|
|
997
|
+
EmbedEvent["UpdateConnection"] = "updateConnection";
|
|
998
|
+
/**
|
|
999
|
+
* Emitted when name, status (private or public) or filter values of a
|
|
1000
|
+
* PersonalisedView is updated.
|
|
1001
|
+
*
|
|
1002
|
+
* @returns viewName: string
|
|
1003
|
+
* @returns viewId: string
|
|
1004
|
+
* @returns liveboardId: string
|
|
1005
|
+
* @returns isPublic: boolean
|
|
1006
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1007
|
+
*/
|
|
1008
|
+
EmbedEvent["UpdatePersonalisedView"] = "updatePersonalisedView";
|
|
1009
|
+
/**
|
|
1010
|
+
* Emitted when a PersonalisedView is saved.
|
|
1011
|
+
*
|
|
1012
|
+
* @returns viewName: string
|
|
1013
|
+
* @returns viewId: string
|
|
1014
|
+
* @returns liveboardId: string
|
|
1015
|
+
* @returns isPublic: boolean
|
|
1016
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1017
|
+
*/
|
|
1018
|
+
EmbedEvent["SavePersonalisedView"] = "savePersonalisedView";
|
|
1019
|
+
/**
|
|
1020
|
+
* Emitted when a Liveboard is reset.
|
|
1021
|
+
*
|
|
1022
|
+
* @returns viewName: string
|
|
1023
|
+
* @returns viewId: string
|
|
1024
|
+
* @returns liveboardId: string
|
|
1025
|
+
* @returns isPublic: boolean
|
|
1026
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1027
|
+
*/
|
|
1028
|
+
EmbedEvent["ResetLiveboard"] = "resetLiveboard";
|
|
1029
|
+
/**
|
|
1030
|
+
* Emitted when a PersonalisedView is deleted.
|
|
1031
|
+
*
|
|
1032
|
+
* @returns views: string[]
|
|
1033
|
+
* @returns liveboardId: string
|
|
1034
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1035
|
+
*/
|
|
1036
|
+
EmbedEvent["DeletePersonalisedView"] = "deletePersonalisedView";
|
|
1037
|
+
/**
|
|
1038
|
+
* Emitten when a user creates a new worksheet
|
|
1039
|
+
*
|
|
1040
|
+
* @version SDK : 1.27.0 | Thoughtspot: 9.8.0.cl
|
|
1041
|
+
*/
|
|
1042
|
+
EmbedEvent["CreateWorksheet"] = "createWorksheet";
|
|
863
1043
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
864
1044
|
/**
|
|
865
1045
|
* Event types that can be triggered by the host application
|
|
@@ -1504,16 +1684,16 @@ var HostEvent;
|
|
|
1504
1684
|
*/
|
|
1505
1685
|
HostEvent["ResetSearch"] = "resetSearch";
|
|
1506
1686
|
/**
|
|
1687
|
+
* @hidden
|
|
1507
1688
|
* Gets the currents visible and runtime filters applied on a Liveboard
|
|
1508
|
-
*
|
|
1509
1689
|
* @example
|
|
1510
1690
|
* liveboardEmbed.trigger(HostEvent.GetFilters)
|
|
1511
1691
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
1512
1692
|
*/
|
|
1513
1693
|
HostEvent["GetFilters"] = "getFilters";
|
|
1514
1694
|
/**
|
|
1695
|
+
* @hidden
|
|
1515
1696
|
* Updates the visible filters on the Liveboard.
|
|
1516
|
-
*
|
|
1517
1697
|
* @param - filter: filter object containing column name and filter operation and values
|
|
1518
1698
|
* @example
|
|
1519
1699
|
*
|
|
@@ -1670,6 +1850,9 @@ var Param;
|
|
|
1670
1850
|
Param["HideSampleQuestions"] = "hideSampleQuestions";
|
|
1671
1851
|
Param["WorksheetId"] = "worksheet";
|
|
1672
1852
|
Param["Query"] = "query";
|
|
1853
|
+
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
1854
|
+
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
1855
|
+
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
1673
1856
|
})(Param || (Param = {}));
|
|
1674
1857
|
/**
|
|
1675
1858
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -2174,7 +2357,7 @@ var Action;
|
|
|
2174
2357
|
* disabledActions: [Action.QueryDetailsButtons]
|
|
2175
2358
|
* ```
|
|
2176
2359
|
*/
|
|
2177
|
-
Action["QueryDetailsButtons"] = "
|
|
2360
|
+
Action["QueryDetailsButtons"] = "queryDetailsButtons";
|
|
2178
2361
|
/**
|
|
2179
2362
|
* The **Delete** action for Answers.
|
|
2180
2363
|
*
|
|
@@ -2479,13 +2662,36 @@ var Action;
|
|
|
2479
2662
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
2480
2663
|
*/
|
|
2481
2664
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
2665
|
+
/**
|
|
2666
|
+
* The **Move to Tab** menu action on visualizations in liveboard edit mode.
|
|
2667
|
+
* Allows moving a visualization to a different tab.
|
|
2668
|
+
*
|
|
2669
|
+
* @example
|
|
2670
|
+
* ```js
|
|
2671
|
+
* disabledActions: [Action.MoveToTab]
|
|
2672
|
+
* ```
|
|
2673
|
+
*/
|
|
2674
|
+
Action["MoveToTab"] = "onContainerMove";
|
|
2675
|
+
/**
|
|
2676
|
+
* The **Manage Alertsb** menu action on KPI visualizations.
|
|
2677
|
+
*
|
|
2678
|
+
* @example
|
|
2679
|
+
* ```js
|
|
2680
|
+
* disabledActions: [Action.ManageMonitor]
|
|
2681
|
+
* ```
|
|
2682
|
+
*/
|
|
2683
|
+
Action["ManageMonitor"] = "ManageMonitor";
|
|
2684
|
+
/**
|
|
2685
|
+
* Action ID for Liveboard Personalised Views dropdown
|
|
2686
|
+
*
|
|
2687
|
+
* @example
|
|
2688
|
+
* ```js
|
|
2689
|
+
* disabledActions: [Action.PersonalisedViewsDropdown]
|
|
2690
|
+
* ```
|
|
2691
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
2692
|
+
*/
|
|
2693
|
+
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2482
2694
|
})(Action || (Action = {}));
|
|
2483
|
-
// eslint-disable-next-line no-shadow
|
|
2484
|
-
var OperationType;
|
|
2485
|
-
(function (OperationType) {
|
|
2486
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2487
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2488
|
-
})(OperationType || (OperationType = {}));
|
|
2489
2695
|
var PrefetchFeatures;
|
|
2490
2696
|
(function (PrefetchFeatures) {
|
|
2491
2697
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8558,6 +8764,7 @@ var mixpanel$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE
|
|
|
8558
8764
|
|
|
8559
8765
|
// Needed to avoid error in CJS builds on some bundlers.
|
|
8560
8766
|
const mixpanelLib = mixpanel_cjs || mixpanel$1;
|
|
8767
|
+
let mixpanelInstance;
|
|
8561
8768
|
const MIXPANEL_EVENT = {
|
|
8562
8769
|
VISUAL_SDK_RENDER_START: 'visual-sdk-render-start',
|
|
8563
8770
|
VISUAL_SDK_CALLED_INIT: 'visual-sdk-called-init',
|
|
@@ -8566,6 +8773,7 @@ const MIXPANEL_EVENT = {
|
|
|
8566
8773
|
VISUAL_SDK_TRIGGER: 'visual-sdk-trigger',
|
|
8567
8774
|
VISUAL_SDK_ON: 'visual-sdk-on',
|
|
8568
8775
|
VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
|
|
8776
|
+
VISUAL_SDK_EMBED_CREATE: 'visual-sdk-embed-create',
|
|
8569
8777
|
};
|
|
8570
8778
|
let isMixpanelInitialized = false;
|
|
8571
8779
|
let eventQueue = [];
|
|
@@ -8580,7 +8788,7 @@ function uploadMixpanelEvent(eventId, eventProps = {}) {
|
|
|
8580
8788
|
eventQueue.push({ eventId, eventProps });
|
|
8581
8789
|
return;
|
|
8582
8790
|
}
|
|
8583
|
-
|
|
8791
|
+
mixpanelInstance.track(eventId, eventProps);
|
|
8584
8792
|
}
|
|
8585
8793
|
/**
|
|
8586
8794
|
*
|
|
@@ -8599,6 +8807,7 @@ function emptyQueue() {
|
|
|
8599
8807
|
* @param sessionInfo
|
|
8600
8808
|
*/
|
|
8601
8809
|
function initMixpanel(sessionInfo) {
|
|
8810
|
+
var _a;
|
|
8602
8811
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8603
8812
|
return;
|
|
8604
8813
|
}
|
|
@@ -8608,10 +8817,16 @@ function initMixpanel(sessionInfo) {
|
|
|
8608
8817
|
const token = sessionInfo.mixpanelToken;
|
|
8609
8818
|
try {
|
|
8610
8819
|
if (token) {
|
|
8611
|
-
mixpanelLib.init(token);
|
|
8820
|
+
mixpanelInstance = mixpanelLib.init(token, undefined, 'tsEmbed');
|
|
8612
8821
|
if (!isPublicCluster) {
|
|
8613
|
-
|
|
8822
|
+
mixpanelInstance.identify(sessionInfo.userGUID);
|
|
8614
8823
|
}
|
|
8824
|
+
mixpanelInstance.register_once({
|
|
8825
|
+
clusterId: sessionInfo.clusterId,
|
|
8826
|
+
clusterName: sessionInfo.clusterName,
|
|
8827
|
+
releaseVersion: sessionInfo.releaseVersion,
|
|
8828
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8829
|
+
});
|
|
8615
8830
|
isMixpanelInitialized = true;
|
|
8616
8831
|
emptyQueue();
|
|
8617
8832
|
}
|
|
@@ -9103,12 +9318,12 @@ var _baseGetTag = baseGetTag;
|
|
|
9103
9318
|
* _.isObject(null);
|
|
9104
9319
|
* // => false
|
|
9105
9320
|
*/
|
|
9106
|
-
function isObject(value) {
|
|
9321
|
+
function isObject$1(value) {
|
|
9107
9322
|
var type = typeof value;
|
|
9108
9323
|
return value != null && (type == 'object' || type == 'function');
|
|
9109
9324
|
}
|
|
9110
9325
|
|
|
9111
|
-
var isObject_1 = isObject;
|
|
9326
|
+
var isObject_1 = isObject$1;
|
|
9112
9327
|
|
|
9113
9328
|
/** `Object#toString` result references. */
|
|
9114
9329
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -9939,9 +10154,9 @@ function cacheHas(cache, key) {
|
|
|
9939
10154
|
var _cacheHas = cacheHas;
|
|
9940
10155
|
|
|
9941
10156
|
/* Built-in method references that are verified to be native. */
|
|
9942
|
-
var Set = _getNative(_root, 'Set');
|
|
10157
|
+
var Set$1 = _getNative(_root, 'Set');
|
|
9943
10158
|
|
|
9944
|
-
var _Set = Set;
|
|
10159
|
+
var _Set = Set$1;
|
|
9945
10160
|
|
|
9946
10161
|
/**
|
|
9947
10162
|
* This method returns `undefined`.
|
|
@@ -10329,6 +10544,9 @@ const getSessionDetails = (sessionInfoResp) => {
|
|
|
10329
10544
|
userGUID: sessionInfoResp.userGUID,
|
|
10330
10545
|
mixpanelToken,
|
|
10331
10546
|
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
10547
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
10548
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
10549
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
10332
10550
|
...sessionInfoResp,
|
|
10333
10551
|
};
|
|
10334
10552
|
};
|
|
@@ -10734,9 +10952,9 @@ const init = (embedConfig) => {
|
|
|
10734
10952
|
const authEE = new eventemitter3();
|
|
10735
10953
|
setAuthEE(authEE);
|
|
10736
10954
|
handleAuth();
|
|
10955
|
+
const { password, ...configToTrack } = config;
|
|
10737
10956
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
10738
|
-
|
|
10739
|
-
host: config.thoughtSpotHost,
|
|
10957
|
+
...configToTrack,
|
|
10740
10958
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
10741
10959
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
10742
10960
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
@@ -10793,8 +11011,10 @@ const renderInQueue = (fn) => {
|
|
|
10793
11011
|
};
|
|
10794
11012
|
/**
|
|
10795
11013
|
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
11014
|
+
*
|
|
10796
11015
|
* @param data
|
|
10797
11016
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11017
|
+
* @group Global methods
|
|
10798
11018
|
*/
|
|
10799
11019
|
const executeTML = async (data) => {
|
|
10800
11020
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10837,9 +11057,12 @@ const executeTML = async (data) => {
|
|
|
10837
11057
|
});
|
|
10838
11058
|
};
|
|
10839
11059
|
/**
|
|
10840
|
-
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
|
|
11060
|
+
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
|
|
11061
|
+
* format.
|
|
11062
|
+
*
|
|
10841
11063
|
* @param data
|
|
10842
11064
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
11065
|
+
* @group Global methods
|
|
10843
11066
|
*/
|
|
10844
11067
|
const exportTML = async (data) => {
|
|
10845
11068
|
const { thoughtSpotHost, authType } = config;
|
|
@@ -10885,58 +11108,351 @@ const exportTML = async (data) => {
|
|
|
10885
11108
|
|
|
10886
11109
|
/**
|
|
10887
11110
|
*
|
|
10888
|
-
* @param
|
|
10889
|
-
* @param query
|
|
10890
|
-
* @param
|
|
11111
|
+
* @param root0
|
|
11112
|
+
* @param root0.query
|
|
11113
|
+
* @param root0.variables
|
|
11114
|
+
* @param root0.thoughtSpotHost
|
|
11115
|
+
* @param root0.isCompositeQuery
|
|
11116
|
+
*/
|
|
11117
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
11118
|
+
const operationName = getOperationNameFromQuery(query);
|
|
11119
|
+
try {
|
|
11120
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
11121
|
+
method: 'POST',
|
|
11122
|
+
headers: {
|
|
11123
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
11124
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11125
|
+
accept: '*/*',
|
|
11126
|
+
'accept-language': 'en-us',
|
|
11127
|
+
},
|
|
11128
|
+
body: JSON.stringify({
|
|
11129
|
+
operationName,
|
|
11130
|
+
query,
|
|
11131
|
+
variables,
|
|
11132
|
+
}),
|
|
11133
|
+
credentials: 'include',
|
|
11134
|
+
});
|
|
11135
|
+
const result = await response.json();
|
|
11136
|
+
const dataValues = Object.values(result.data);
|
|
11137
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
11138
|
+
}
|
|
11139
|
+
catch (error) {
|
|
11140
|
+
return error;
|
|
11141
|
+
}
|
|
11142
|
+
}
|
|
11143
|
+
|
|
11144
|
+
const getSourceDetailQuery = `
|
|
11145
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
11146
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
11147
|
+
id
|
|
11148
|
+
name
|
|
11149
|
+
description
|
|
11150
|
+
authorName
|
|
11151
|
+
authorDisplayName
|
|
11152
|
+
isExternal
|
|
11153
|
+
type
|
|
11154
|
+
created
|
|
11155
|
+
modified
|
|
11156
|
+
columns {
|
|
11157
|
+
id
|
|
11158
|
+
name
|
|
11159
|
+
author
|
|
11160
|
+
authorDisplayName
|
|
11161
|
+
description
|
|
11162
|
+
dataType
|
|
11163
|
+
type
|
|
11164
|
+
modified
|
|
11165
|
+
ownerName
|
|
11166
|
+
owner
|
|
11167
|
+
dataRecency
|
|
11168
|
+
sources {
|
|
11169
|
+
tableId
|
|
11170
|
+
tableName
|
|
11171
|
+
columnId
|
|
11172
|
+
columnName
|
|
11173
|
+
__typename
|
|
11174
|
+
}
|
|
11175
|
+
synonyms
|
|
11176
|
+
cohortAnswerId
|
|
11177
|
+
__typename
|
|
11178
|
+
}
|
|
11179
|
+
relationships
|
|
11180
|
+
destinationRelationships
|
|
11181
|
+
dataSourceId
|
|
11182
|
+
__typename
|
|
11183
|
+
}
|
|
11184
|
+
}
|
|
11185
|
+
`;
|
|
11186
|
+
const sourceDetailCache = new Map();
|
|
11187
|
+
/**
|
|
11188
|
+
*
|
|
10891
11189
|
* @param thoughtSpotHost
|
|
11190
|
+
* @param sourceId
|
|
10892
11191
|
*/
|
|
10893
|
-
function
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
11192
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
11193
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
11194
|
+
return sourceDetailCache.get(sourceId);
|
|
11195
|
+
}
|
|
11196
|
+
const details = await graphqlQuery({
|
|
11197
|
+
query: getSourceDetailQuery,
|
|
11198
|
+
variables: {
|
|
11199
|
+
ids: [sourceId],
|
|
11200
|
+
},
|
|
11201
|
+
thoughtSpotHost,
|
|
11202
|
+
});
|
|
11203
|
+
const souceDetails = details[0];
|
|
11204
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
11205
|
+
return souceDetails;
|
|
11206
|
+
}
|
|
11207
|
+
|
|
11208
|
+
const bachSessionId = `
|
|
11209
|
+
id {
|
|
11210
|
+
sessionId
|
|
11211
|
+
genNo
|
|
11212
|
+
acSession {
|
|
11213
|
+
sessionId
|
|
11214
|
+
genNo
|
|
11215
|
+
}
|
|
11216
|
+
}
|
|
11217
|
+
`;
|
|
11218
|
+
const getUnaggregatedAnswerSession = `
|
|
11219
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
11220
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
11221
|
+
${bachSessionId}
|
|
11222
|
+
answer {
|
|
11223
|
+
visualizations {
|
|
11224
|
+
... on TableViz {
|
|
11225
|
+
columns {
|
|
11226
|
+
column {
|
|
11227
|
+
id
|
|
11228
|
+
name
|
|
11229
|
+
referencedColumns {
|
|
11230
|
+
guid
|
|
11231
|
+
displayName
|
|
11232
|
+
}
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11238
|
+
}
|
|
11239
|
+
}
|
|
11240
|
+
`;
|
|
11241
|
+
const removeColumns = `
|
|
11242
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
11243
|
+
Answer__removeColumns(
|
|
11244
|
+
session: $session
|
|
11245
|
+
logicalColumnIds: $logicalColumnIds
|
|
11246
|
+
columnIds: $columnIds
|
|
11247
|
+
) {
|
|
11248
|
+
${bachSessionId}
|
|
11249
|
+
}
|
|
11250
|
+
}
|
|
11251
|
+
`;
|
|
11252
|
+
const addColumns = `
|
|
11253
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
11254
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
11255
|
+
${bachSessionId}
|
|
11256
|
+
}
|
|
11257
|
+
}
|
|
11258
|
+
`;
|
|
11259
|
+
const getAnswerData = `
|
|
11260
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
11261
|
+
getAnswer(session: $session) {
|
|
11262
|
+
${bachSessionId}
|
|
11263
|
+
answer {
|
|
11264
|
+
id
|
|
11265
|
+
visualizations {
|
|
11266
|
+
id
|
|
11267
|
+
... on TableViz {
|
|
11268
|
+
columns {
|
|
11269
|
+
column {
|
|
11270
|
+
id
|
|
11271
|
+
name
|
|
11272
|
+
type
|
|
11273
|
+
aggregationType
|
|
11274
|
+
dataType
|
|
11275
|
+
}
|
|
11276
|
+
}
|
|
11277
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
11278
|
+
}
|
|
11279
|
+
}
|
|
11280
|
+
}
|
|
11281
|
+
}
|
|
11282
|
+
}
|
|
11283
|
+
`;
|
|
11284
|
+
|
|
11285
|
+
// eslint-disable-next-line no-shadow
|
|
11286
|
+
var OperationType;
|
|
11287
|
+
(function (OperationType) {
|
|
11288
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
11289
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
11290
|
+
})(OperationType || (OperationType = {}));
|
|
11291
|
+
/**
|
|
11292
|
+
* Class representing the answer service provided with the
|
|
11293
|
+
* custom action payload. This service could be used to run
|
|
11294
|
+
* graphql queries in the context of the answer on which the
|
|
11295
|
+
* custom action was triggered.
|
|
11296
|
+
*
|
|
11297
|
+
* @example
|
|
11298
|
+
* ```js
|
|
11299
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
11300
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
11301
|
+
* 'col name 1'
|
|
11302
|
+
* ]);
|
|
11303
|
+
* const data = await underlying.fetchData(0, 100);
|
|
11304
|
+
* })
|
|
11305
|
+
* ```
|
|
11306
|
+
* @version
|
|
11307
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
11308
|
+
*/
|
|
11309
|
+
class AnswerService {
|
|
11310
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
11311
|
+
this.session = session;
|
|
11312
|
+
this.answer = answer;
|
|
11313
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
11314
|
+
this.selectedPoints = selectedPoints;
|
|
11315
|
+
this.session = removeTypename(session);
|
|
11316
|
+
}
|
|
11317
|
+
async getSourceDetail() {
|
|
11318
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
11319
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
11320
|
+
}
|
|
11321
|
+
async removeColumns(columnIds) {
|
|
11322
|
+
return this.executeQuery(removeColumns, {
|
|
11323
|
+
logicalColumnIds: columnIds,
|
|
11324
|
+
});
|
|
11325
|
+
}
|
|
11326
|
+
async addColumns(columnIds) {
|
|
11327
|
+
return this.executeQuery(addColumns, {
|
|
11328
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
11329
|
+
});
|
|
11330
|
+
}
|
|
11331
|
+
async fetchData(offset = 0, size = 1000) {
|
|
11332
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
11333
|
+
deadline: 0,
|
|
11334
|
+
dataPaginationParams: {
|
|
11335
|
+
isClientPaginated: true,
|
|
11336
|
+
offset,
|
|
11337
|
+
size,
|
|
11338
|
+
},
|
|
11339
|
+
});
|
|
11340
|
+
const { columns, data } = answer.visualizations[0];
|
|
11341
|
+
return {
|
|
11342
|
+
columns,
|
|
11343
|
+
data,
|
|
11344
|
+
};
|
|
11345
|
+
}
|
|
11346
|
+
/**
|
|
11347
|
+
*
|
|
11348
|
+
* @param userLocale
|
|
11349
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
11350
|
+
* @returns Response
|
|
11351
|
+
*/
|
|
11352
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
11353
|
+
if (omitInfo) {
|
|
11354
|
+
console.warn('omitInfo not supported yet.');
|
|
10914
11355
|
}
|
|
10915
|
-
|
|
10916
|
-
|
|
11356
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
11357
|
+
return fetch(fetchUrl, {
|
|
11358
|
+
credentials: 'include',
|
|
11359
|
+
});
|
|
11360
|
+
}
|
|
11361
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
11362
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
11363
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
10917
11364
|
}
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
11365
|
+
if (!selectedPoints) {
|
|
11366
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
11367
|
+
}
|
|
11368
|
+
const sourceDetail = await this.getSourceDetail();
|
|
11369
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
11370
|
+
const unAggAnswer = await graphqlQuery({
|
|
11371
|
+
query: getUnaggregatedAnswerSession,
|
|
11372
|
+
variables: {
|
|
11373
|
+
session: this.session,
|
|
11374
|
+
columns: selectedPoints,
|
|
11375
|
+
},
|
|
11376
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11377
|
+
});
|
|
11378
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
11379
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
11380
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
11381
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
11382
|
+
if (columnsToAdd.length) {
|
|
11383
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
11384
|
+
}
|
|
11385
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
11386
|
+
if (columnsToRemove.length) {
|
|
11387
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
11388
|
+
}
|
|
11389
|
+
return unaggAnswerSession;
|
|
11390
|
+
}
|
|
11391
|
+
async executeQuery(query, variables) {
|
|
11392
|
+
const data = await graphqlQuery({
|
|
11393
|
+
query,
|
|
11394
|
+
variables: {
|
|
11395
|
+
session: this.session,
|
|
11396
|
+
...variables,
|
|
11397
|
+
},
|
|
11398
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
11399
|
+
isCompositeQuery: false,
|
|
11400
|
+
});
|
|
11401
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
11402
|
+
return data;
|
|
11403
|
+
}
|
|
11404
|
+
getSession() {
|
|
11405
|
+
return this.session;
|
|
11406
|
+
}
|
|
11407
|
+
}
|
|
11408
|
+
/**
|
|
11409
|
+
*
|
|
11410
|
+
* @param sourceDetail
|
|
11411
|
+
* @param colNames
|
|
11412
|
+
*/
|
|
11413
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
11414
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
11415
|
+
colSet[col.name] = col;
|
|
11416
|
+
return colSet;
|
|
11417
|
+
}, {});
|
|
11418
|
+
return new Set(colNames.map((colName) => {
|
|
11419
|
+
const col = cols[colName];
|
|
11420
|
+
return col.id;
|
|
11421
|
+
}));
|
|
11422
|
+
}
|
|
11423
|
+
/**
|
|
11424
|
+
*
|
|
11425
|
+
* @param selectedPoints
|
|
11426
|
+
*/
|
|
11427
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
11428
|
+
const underlyingDataPoint = [];
|
|
11429
|
+
/**
|
|
11430
|
+
*
|
|
11431
|
+
* @param colVal
|
|
11432
|
+
*/
|
|
11433
|
+
function addPointFromColVal(colVal) {
|
|
11434
|
+
const dataType = colVal.column.dataType;
|
|
11435
|
+
const id = colVal.column.id;
|
|
11436
|
+
let dataValue;
|
|
11437
|
+
if (dataType === 'DATE') {
|
|
11438
|
+
dataValue = [{
|
|
11439
|
+
epochRange: {
|
|
11440
|
+
startEpoch: colVal.value,
|
|
11441
|
+
},
|
|
11442
|
+
}];
|
|
10922
11443
|
}
|
|
10923
11444
|
else {
|
|
10924
|
-
|
|
10925
|
-
dataPaginationParams: {
|
|
10926
|
-
isClientPaginated: true,
|
|
10927
|
-
offset: offset * batchSize,
|
|
10928
|
-
size: batchSize,
|
|
10929
|
-
},
|
|
10930
|
-
};
|
|
11445
|
+
dataValue = [{ value: colVal.value }];
|
|
10931
11446
|
}
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
11447
|
+
underlyingDataPoint.push({
|
|
11448
|
+
columnId: colVal.column.id,
|
|
11449
|
+
dataValue,
|
|
10935
11450
|
});
|
|
10936
|
-
}
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
};
|
|
11451
|
+
}
|
|
11452
|
+
selectedPoints.forEach((p) => {
|
|
11453
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
11454
|
+
});
|
|
11455
|
+
return underlyingDataPoint;
|
|
10940
11456
|
}
|
|
10941
11457
|
|
|
10942
11458
|
/**
|
|
@@ -10945,16 +11461,12 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
|
10945
11461
|
* @param thoughtSpotHost
|
|
10946
11462
|
*/
|
|
10947
11463
|
function processCustomAction(e, thoughtSpotHost) {
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
answerService,
|
|
10955
|
-
};
|
|
10956
|
-
}
|
|
10957
|
-
return e;
|
|
11464
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
11465
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
11466
|
+
return {
|
|
11467
|
+
...e,
|
|
11468
|
+
answerService,
|
|
11469
|
+
};
|
|
10958
11470
|
}
|
|
10959
11471
|
/**
|
|
10960
11472
|
*
|
|
@@ -11099,7 +11611,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
11099
11611
|
});
|
|
11100
11612
|
}
|
|
11101
11613
|
|
|
11102
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
11614
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.24.1";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};
|
|
11103
11615
|
|
|
11104
11616
|
/**
|
|
11105
11617
|
* Copyright (c) 2022
|
|
@@ -11131,6 +11643,7 @@ const V1EventMap = {};
|
|
|
11131
11643
|
class TsEmbed {
|
|
11132
11644
|
constructor(domSelector, viewConfig) {
|
|
11133
11645
|
this.isAppInitialized = false;
|
|
11646
|
+
this.embedComponentType = 'TsEmbed';
|
|
11134
11647
|
/**
|
|
11135
11648
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
11136
11649
|
* will generate for embedding. This provides additional security to
|
|
@@ -11147,6 +11660,7 @@ class TsEmbed {
|
|
|
11147
11660
|
* @param responder
|
|
11148
11661
|
*/
|
|
11149
11662
|
this.appInitCb = async (_, responder) => {
|
|
11663
|
+
var _a, _b;
|
|
11150
11664
|
let authToken = '';
|
|
11151
11665
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
11152
11666
|
authToken = await getAuthenticaionToken(this.embedConfig);
|
|
@@ -11157,8 +11671,15 @@ class TsEmbed {
|
|
|
11157
11671
|
data: {
|
|
11158
11672
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
11159
11673
|
authToken,
|
|
11160
|
-
runtimeFilterParams:
|
|
11674
|
+
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
11675
|
+
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
11676
|
+
: null,
|
|
11677
|
+
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
11678
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
11161
11679
|
hostConfig: this.embedConfig.hostConfig,
|
|
11680
|
+
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
11681
|
+
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
11682
|
+
: [],
|
|
11162
11683
|
},
|
|
11163
11684
|
});
|
|
11164
11685
|
};
|
|
@@ -11186,8 +11707,8 @@ class TsEmbed {
|
|
|
11186
11707
|
* Register APP_INIT event and sendback init payload
|
|
11187
11708
|
*/
|
|
11188
11709
|
this.registerAppInit = () => {
|
|
11189
|
-
this.on(EmbedEvent.APP_INIT, this.appInitCb);
|
|
11190
|
-
this.on(EmbedEvent.AuthExpire, this.updateAuthToken);
|
|
11710
|
+
this.on(EmbedEvent.APP_INIT, this.appInitCb, { start: false }, true);
|
|
11711
|
+
this.on(EmbedEvent.AuthExpire, this.updateAuthToken, { start: false }, true);
|
|
11191
11712
|
};
|
|
11192
11713
|
this.el = getDOMNode(domSelector);
|
|
11193
11714
|
// TODO: handle error
|
|
@@ -11202,6 +11723,10 @@ class TsEmbed {
|
|
|
11202
11723
|
this.viewConfig = viewConfig;
|
|
11203
11724
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
11204
11725
|
this.registerAppInit();
|
|
11726
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
11727
|
+
...viewConfig,
|
|
11728
|
+
embedComponentType: this.embedComponentType,
|
|
11729
|
+
});
|
|
11205
11730
|
}
|
|
11206
11731
|
/**
|
|
11207
11732
|
* Throws error encountered during initialization.
|
|
@@ -11332,6 +11857,9 @@ class TsEmbed {
|
|
|
11332
11857
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
11333
11858
|
queryParams[Param.cookieless] = true;
|
|
11334
11859
|
}
|
|
11860
|
+
if (this.embedConfig.pendoTrackingKey) {
|
|
11861
|
+
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
11862
|
+
}
|
|
11335
11863
|
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, } = this.viewConfig;
|
|
11336
11864
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
11337
11865
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
@@ -11484,7 +12012,6 @@ class TsEmbed {
|
|
|
11484
12012
|
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
11485
12013
|
return;
|
|
11486
12014
|
}
|
|
11487
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
11488
12015
|
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
11489
12016
|
this.iFrame.addEventListener('load', () => {
|
|
11490
12017
|
nextInQueue();
|
|
@@ -11495,7 +12022,9 @@ class TsEmbed {
|
|
|
11495
12022
|
},
|
|
11496
12023
|
type: EmbedEvent.Load,
|
|
11497
12024
|
});
|
|
11498
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.
|
|
12025
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE, {
|
|
12026
|
+
elWidth: this.iFrame.clientWidth,
|
|
12027
|
+
elHeight: this.iFrame.clientHeight,
|
|
11499
12028
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
11500
12029
|
});
|
|
11501
12030
|
});
|
|
@@ -11638,6 +12167,8 @@ class TsEmbed {
|
|
|
11638
12167
|
* @param messageType The message type
|
|
11639
12168
|
* @param callback A callback as a function
|
|
11640
12169
|
* @param options The message options
|
|
12170
|
+
* @param isSelf
|
|
12171
|
+
* @param isRegisteredBySDK
|
|
11641
12172
|
* @example
|
|
11642
12173
|
* ```js
|
|
11643
12174
|
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
@@ -11653,7 +12184,10 @@ class TsEmbed {
|
|
|
11653
12184
|
* });
|
|
11654
12185
|
* ```
|
|
11655
12186
|
*/
|
|
11656
|
-
on(messageType, callback, options = { start: false }) {
|
|
12187
|
+
on(messageType, callback, options = { start: false }, isRegisteredBySDK = false) {
|
|
12188
|
+
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`, {
|
|
12189
|
+
isRegisteredBySDK,
|
|
12190
|
+
});
|
|
11657
12191
|
if (this.isRendered) {
|
|
11658
12192
|
this.handleError('Please register event handlers before calling render');
|
|
11659
12193
|
}
|
|
@@ -11810,8 +12344,10 @@ class V1Embed extends TsEmbed {
|
|
|
11810
12344
|
let queryString = queryParams;
|
|
11811
12345
|
if (!this.viewConfig.excludeRuntimeFiltersfromURL) {
|
|
11812
12346
|
const runtimeFilters = this.viewConfig.runtimeFilters;
|
|
12347
|
+
const runtimeParameters = this.viewConfig.runtimeParameters;
|
|
12348
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
11813
12349
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
11814
|
-
queryString = [filterQuery, queryParams].filter(Boolean).join('&');
|
|
12350
|
+
queryString = [parameterQuery, filterQuery, queryParams].filter(Boolean).join('&');
|
|
11815
12351
|
}
|
|
11816
12352
|
return this.getV1EmbedBasePath(queryString);
|
|
11817
12353
|
}
|
|
@@ -11834,7 +12370,6 @@ class V1Embed extends TsEmbed {
|
|
|
11834
12370
|
*/
|
|
11835
12371
|
on(messageType, callback, options = { start: false }) {
|
|
11836
12372
|
const eventType = this.getCompatibleEventType(messageType);
|
|
11837
|
-
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
11838
12373
|
return super.on(eventType, callback, options);
|
|
11839
12374
|
}
|
|
11840
12375
|
}
|
|
@@ -11894,6 +12429,7 @@ class AppEmbed extends V1Embed {
|
|
|
11894
12429
|
constructor(domSelector, viewConfig) {
|
|
11895
12430
|
super(domSelector, viewConfig);
|
|
11896
12431
|
this.defaultHeight = '100%';
|
|
12432
|
+
this.embedComponentType = 'AppEmbed';
|
|
11897
12433
|
/**
|
|
11898
12434
|
* Set the iframe height as per the computed height received
|
|
11899
12435
|
* from the ThoughtSpot app.
|
|
@@ -11925,7 +12461,7 @@ class AppEmbed extends V1Embed {
|
|
|
11925
12461
|
* embedded Liveboard or visualization.
|
|
11926
12462
|
*/
|
|
11927
12463
|
getEmbedParams() {
|
|
11928
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, } = this.viewConfig;
|
|
12464
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11929
12465
|
let params = {};
|
|
11930
12466
|
params[Param.EmbedApp] = true;
|
|
11931
12467
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
@@ -11949,6 +12485,8 @@ class AppEmbed extends V1Embed {
|
|
|
11949
12485
|
params[Param.EnableSearchAssist] = enableSearchAssist;
|
|
11950
12486
|
}
|
|
11951
12487
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
12488
|
+
params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
|
|
12489
|
+
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
11952
12490
|
const queryParams = getQueryParamString(params, true);
|
|
11953
12491
|
return queryParams;
|
|
11954
12492
|
}
|
|
@@ -11958,8 +12496,8 @@ class AppEmbed extends V1Embed {
|
|
|
11958
12496
|
* @param pageId The ID of the page to be embedded.
|
|
11959
12497
|
*/
|
|
11960
12498
|
getIFrameSrc() {
|
|
11961
|
-
const { pageId, path } = this.viewConfig;
|
|
11962
|
-
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
12499
|
+
const { pageId, path, modularHomeExperience } = this.viewConfig;
|
|
12500
|
+
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId, modularHomeExperience);
|
|
11963
12501
|
let url = `${this.getRootIframeSrc()}/${pageRoute}`;
|
|
11964
12502
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
11965
12503
|
url = `${url}${tsPostHashParams}`;
|
|
@@ -11969,21 +12507,22 @@ class AppEmbed extends V1Embed {
|
|
|
11969
12507
|
* Gets the ThoughtSpot route of the page for a particular page ID.
|
|
11970
12508
|
*
|
|
11971
12509
|
* @param pageId The identifier for a page in the ThoughtSpot app.
|
|
12510
|
+
* @param modularHomeExperience
|
|
11972
12511
|
*/
|
|
11973
|
-
getPageRoute(pageId) {
|
|
12512
|
+
getPageRoute(pageId, modularHomeExperience = false) {
|
|
11974
12513
|
switch (pageId) {
|
|
11975
12514
|
case Page.Search:
|
|
11976
12515
|
return 'answer';
|
|
11977
12516
|
case Page.Answers:
|
|
11978
|
-
return 'answers';
|
|
12517
|
+
return modularHomeExperience ? 'home/answers' : 'answers';
|
|
11979
12518
|
case Page.Liveboards:
|
|
11980
|
-
return 'pinboards';
|
|
12519
|
+
return modularHomeExperience ? 'home/liveboards' : 'pinboards';
|
|
11981
12520
|
case Page.Pinboards:
|
|
11982
|
-
return 'pinboards';
|
|
12521
|
+
return modularHomeExperience ? 'home/liveboards' : 'pinboards';
|
|
11983
12522
|
case Page.Data:
|
|
11984
12523
|
return 'data/tables';
|
|
11985
12524
|
case Page.SpotIQ:
|
|
11986
|
-
return 'insights/results';
|
|
12525
|
+
return modularHomeExperience ? 'home/spotiq-analysis' : 'insights/results';
|
|
11987
12526
|
case Page.Home:
|
|
11988
12527
|
default:
|
|
11989
12528
|
return 'home';
|
|
@@ -12080,6 +12619,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12080
12619
|
constructor(domSelector, viewConfig) {
|
|
12081
12620
|
super(domSelector, viewConfig);
|
|
12082
12621
|
this.defaultHeight = 500;
|
|
12622
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
12083
12623
|
/**
|
|
12084
12624
|
* Set the iframe height as per the computed height received
|
|
12085
12625
|
* from the ThoughtSpot app.
|
|
@@ -12112,7 +12652,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12112
12652
|
let params = {};
|
|
12113
12653
|
params[Param.EmbedApp] = true;
|
|
12114
12654
|
params = this.getBaseQueryParams(params);
|
|
12115
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, } = this.viewConfig;
|
|
12655
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
12116
12656
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
12117
12657
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
12118
12658
|
if (fullHeight === true) {
|
|
@@ -12140,7 +12680,10 @@ class LiveboardEmbed extends V1Embed {
|
|
|
12140
12680
|
if (hideTabPanel) {
|
|
12141
12681
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
12142
12682
|
}
|
|
12143
|
-
|
|
12683
|
+
let queryParams = getQueryParamString(params, true);
|
|
12684
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
12685
|
+
if (parameterQuery)
|
|
12686
|
+
queryParams += `&${parameterQuery}`;
|
|
12144
12687
|
return queryParams;
|
|
12145
12688
|
}
|
|
12146
12689
|
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
@@ -12246,6 +12789,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
12246
12789
|
class SearchEmbed extends TsEmbed {
|
|
12247
12790
|
constructor(domSelector, viewConfig) {
|
|
12248
12791
|
super(domSelector);
|
|
12792
|
+
this.embedComponentType = 'SearchEmbed';
|
|
12249
12793
|
this.viewConfig = viewConfig;
|
|
12250
12794
|
}
|
|
12251
12795
|
/**
|
|
@@ -12264,7 +12808,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
12264
12808
|
}
|
|
12265
12809
|
getEmbedParams() {
|
|
12266
12810
|
var _a;
|
|
12267
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, } = this.viewConfig;
|
|
12811
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
|
|
12268
12812
|
const queryParams = this.getBaseQueryParams();
|
|
12269
12813
|
queryParams[Param.HideActions] = [
|
|
12270
12814
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -12293,13 +12837,19 @@ class SearchEmbed extends TsEmbed {
|
|
|
12293
12837
|
}
|
|
12294
12838
|
queryParams[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
12295
12839
|
queryParams[Param.DataSourceMode] = this.getDataSourceMode();
|
|
12296
|
-
queryParams[Param.UseLastSelectedDataSource] =
|
|
12840
|
+
queryParams[Param.UseLastSelectedDataSource] = useLastSelectedSources;
|
|
12841
|
+
if (dataSource || dataSources) {
|
|
12842
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
12843
|
+
}
|
|
12297
12844
|
queryParams[Param.searchEmbed] = true;
|
|
12298
12845
|
let query = '';
|
|
12299
12846
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
12300
12847
|
if (queryParamsString) {
|
|
12301
12848
|
query = `?${queryParamsString}`;
|
|
12302
12849
|
}
|
|
12850
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
12851
|
+
if (parameterQuery)
|
|
12852
|
+
query += `&${parameterQuery}`;
|
|
12303
12853
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
12304
12854
|
if (filterQuery && !excludeRuntimeFiltersfromURL) {
|
|
12305
12855
|
query += `&${filterQuery}`;
|
|
@@ -12344,6 +12894,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
12344
12894
|
class SearchBarEmbed extends TsEmbed {
|
|
12345
12895
|
constructor(domSelector, viewConfig) {
|
|
12346
12896
|
super(domSelector);
|
|
12897
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
12347
12898
|
this.viewConfig = viewConfig;
|
|
12348
12899
|
}
|
|
12349
12900
|
/**
|
|
@@ -12354,7 +12905,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
12354
12905
|
*/
|
|
12355
12906
|
getIFrameSrc() {
|
|
12356
12907
|
var _a;
|
|
12357
|
-
const { searchOptions, dataSource, dataSources } = this.viewConfig;
|
|
12908
|
+
const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, } = this.viewConfig;
|
|
12358
12909
|
const path = 'search-bar-embed';
|
|
12359
12910
|
const queryParams = this.getBaseQueryParams();
|
|
12360
12911
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
@@ -12370,7 +12921,10 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
12370
12921
|
queryParams[Param.executeSearch] = true;
|
|
12371
12922
|
}
|
|
12372
12923
|
}
|
|
12373
|
-
queryParams[Param.UseLastSelectedDataSource] =
|
|
12924
|
+
queryParams[Param.UseLastSelectedDataSource] = useLastSelectedSources;
|
|
12925
|
+
if (dataSource || dataSources) {
|
|
12926
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
12927
|
+
}
|
|
12374
12928
|
queryParams[Param.searchEmbed] = true;
|
|
12375
12929
|
let query = '';
|
|
12376
12930
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
@@ -12419,6 +12973,7 @@ class SageEmbed extends V1Embed {
|
|
|
12419
12973
|
// eslint-disable-next-line no-useless-constructor
|
|
12420
12974
|
constructor(domSelector, viewConfig) {
|
|
12421
12975
|
super(domSelector, viewConfig);
|
|
12976
|
+
this.embedComponentType = 'SageEmbed';
|
|
12422
12977
|
}
|
|
12423
12978
|
/**
|
|
12424
12979
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -12480,4 +13035,4 @@ class SageEmbed extends V1Embed {
|
|
|
12480
13035
|
}
|
|
12481
13036
|
}
|
|
12482
13037
|
|
|
12483
|
-
export { Action, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
|
|
13038
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
|