@thoughtspot/visual-embed-sdk 1.20.0-alpha.2 → 1.20.0-prerender.0
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/dist/src/auth.d.ts +75 -5
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +19 -7
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +39 -19
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +19 -7
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +7 -1
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +11 -3
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +76 -5
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +8 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +4 -0
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +11 -2
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/types.d.ts +429 -97
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/answerService.d.ts +7 -0
- package/dist/src/utils/answerService.d.ts.map +1 -1
- package/dist/src/utils/authService.d.ts +30 -0
- package/dist/src/utils/authService.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +12 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +7 -0
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +12 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed.es.js +818 -285
- package/dist/tsembed.js +791 -284
- package/lib/package.json +4 -3
- package/lib/src/auth.d.ts +75 -5
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +86 -26
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +14 -5
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/config.d.ts +1 -0
- package/lib/src/config.d.ts.map +1 -1
- package/lib/src/config.js +5 -3
- package/lib/src/config.js.map +1 -1
- package/lib/src/config.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +19 -7
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +26 -16
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +12 -12
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +39 -19
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +49 -15
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +2 -2
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +1 -1
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +19 -7
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +50 -38
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +37 -30
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +14 -26
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +7 -1
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +6 -7
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +11 -3
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +19 -15
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +16 -19
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +4 -0
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +76 -5
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +150 -72
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +23 -24
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +3 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +3 -3
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +8 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +13 -1
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +4 -6
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +3 -6
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/react/util.d.ts +4 -0
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/react/util.js +4 -0
- package/lib/src/react/util.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +11 -2
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/test/test-utils.js +36 -25
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/types.d.ts +429 -97
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +310 -72
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/answerService.d.ts +7 -0
- package/lib/src/utils/answerService.d.ts.map +1 -1
- package/lib/src/utils/answerService.js +7 -0
- package/lib/src/utils/answerService.js.map +1 -1
- package/lib/src/utils/answerService.spec.js.map +1 -1
- package/lib/src/utils/authService.d.ts +30 -0
- package/lib/src/utils/authService.d.ts.map +1 -1
- package/lib/src/utils/authService.js +39 -2
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js.map +1 -1
- package/lib/src/utils/processData.d.ts +12 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +33 -5
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +7 -0
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +17 -3
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils.d.ts +12 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +24 -19
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +664 -141
- package/package.json +4 -3
- package/src/auth.spec.ts +68 -150
- package/src/auth.ts +141 -101
- package/src/config.spec.ts +2 -4
- package/src/config.ts +5 -3
- package/src/embed/app.spec.ts +25 -14
- package/src/embed/app.ts +49 -37
- package/src/embed/base.spec.ts +6 -12
- package/src/embed/base.ts +74 -57
- package/src/embed/embed.spec.ts +5 -6
- package/src/embed/liveboard.spec.ts +56 -37
- package/src/embed/liveboard.ts +67 -65
- package/src/embed/pinboard.spec.ts +26 -29
- package/src/embed/search-bar.tsx +14 -9
- package/src/embed/search.spec.ts +31 -21
- package/src/embed/search.ts +28 -22
- package/src/embed/searchEmbed-basic-auth.spec.ts +22 -28
- package/src/embed/ts-embed.spec.ts +70 -148
- package/src/embed/ts-embed.ts +180 -157
- package/src/errors.ts +3 -6
- package/src/index.ts +23 -7
- package/src/mixpanel-service.spec.ts +1 -3
- package/src/mixpanel-service.ts +13 -1
- package/src/react/index.spec.tsx +11 -20
- package/src/react/index.tsx +40 -71
- package/src/react/util.ts +8 -4
- package/src/test/test-utils.ts +43 -39
- package/src/types.ts +427 -97
- package/src/utils/answerService.spec.ts +3 -5
- package/src/utils/answerService.ts +21 -17
- package/src/utils/authService.spec.ts +26 -41
- package/src/utils/authService.ts +47 -21
- package/src/utils/processData.spec.ts +26 -59
- package/src/utils/processData.ts +36 -14
- package/src/utils/processTrigger.spec.ts +1 -6
- package/src/utils/processTrigger.ts +18 -9
- package/src/utils.spec.ts +8 -12
- package/src/utils.ts +25 -26
package/dist/tsembed.es.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Refer to the following docs for more details on runtime filter syntax:
|
|
12
12
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/apply-runtime-filter.html
|
|
13
13
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/runtime-filter-operators.html
|
|
14
|
+
*
|
|
14
15
|
* @param runtimeFilters
|
|
15
16
|
*/
|
|
16
17
|
const getFilterQuery = (runtimeFilters) => {
|
|
@@ -30,13 +31,12 @@ const getFilterQuery = (runtimeFilters) => {
|
|
|
30
31
|
/**
|
|
31
32
|
* Convert a value to a string representation to be sent as a query
|
|
32
33
|
* parameter to the ThoughtSpot app.
|
|
34
|
+
*
|
|
33
35
|
* @param value Any parameter value
|
|
34
36
|
*/
|
|
35
37
|
const serializeParam = (value) => {
|
|
36
38
|
// do not serialize primitive types
|
|
37
|
-
if (typeof value === 'string' ||
|
|
38
|
-
typeof value === 'number' ||
|
|
39
|
-
typeof value === 'boolean') {
|
|
39
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
40
40
|
return value;
|
|
41
41
|
}
|
|
42
42
|
return JSON.stringify(value);
|
|
@@ -45,12 +45,15 @@ const serializeParam = (value) => {
|
|
|
45
45
|
* Convert a value to a string:
|
|
46
46
|
* in case of an array, we convert it to CSV.
|
|
47
47
|
* in case of any other type, we directly return the value.
|
|
48
|
+
*
|
|
48
49
|
* @param value
|
|
49
50
|
*/
|
|
50
|
-
const paramToString = (value) => Array.isArray(value) ? value.join(',') : value;
|
|
51
|
+
const paramToString = (value) => (Array.isArray(value) ? value.join(',') : value);
|
|
51
52
|
/**
|
|
52
53
|
* Return a query param string composed from the given params object
|
|
54
|
+
*
|
|
53
55
|
* @param queryParams
|
|
56
|
+
* @param shouldSerializeParamValues
|
|
54
57
|
*/
|
|
55
58
|
const getQueryParamString = (queryParams, shouldSerializeParamValues = false) => {
|
|
56
59
|
const qp = [];
|
|
@@ -72,6 +75,7 @@ const getQueryParamString = (queryParams, shouldSerializeParamValues = false) =>
|
|
|
72
75
|
/**
|
|
73
76
|
* Get a string representation of a dimension value in CSS
|
|
74
77
|
* If numeric, it is considered in pixels.
|
|
78
|
+
*
|
|
75
79
|
* @param value
|
|
76
80
|
*/
|
|
77
81
|
const getCssDimension = (value) => {
|
|
@@ -82,6 +86,7 @@ const getCssDimension = (value) => {
|
|
|
82
86
|
};
|
|
83
87
|
/**
|
|
84
88
|
* Append a string to a URL's hash fragment
|
|
89
|
+
*
|
|
85
90
|
* @param url A URL
|
|
86
91
|
* @param stringToAppend The string to append to the URL hash
|
|
87
92
|
*/
|
|
@@ -96,6 +101,12 @@ const appendToUrlHash = (url, stringToAppend) => {
|
|
|
96
101
|
}
|
|
97
102
|
return outputUrl;
|
|
98
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param url
|
|
107
|
+
* @param stringToAppend
|
|
108
|
+
* @param path
|
|
109
|
+
*/
|
|
99
110
|
function getRedirectUrl(url, stringToAppend, path = '') {
|
|
100
111
|
const targetUrl = path ? new URL(path, window.location.origin).href : url;
|
|
101
112
|
return appendToUrlHash(targetUrl, stringToAppend);
|
|
@@ -104,10 +115,7 @@ const getEncodedQueryParamsString = (queryString) => {
|
|
|
104
115
|
if (!queryString) {
|
|
105
116
|
return queryString;
|
|
106
117
|
}
|
|
107
|
-
return btoa(queryString)
|
|
108
|
-
.replace(/\+/g, '-')
|
|
109
|
-
.replace(/\//g, '_')
|
|
110
|
-
.replace(/=+$/, '');
|
|
118
|
+
return btoa(queryString).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
111
119
|
};
|
|
112
120
|
const getOffsetTop = (element) => {
|
|
113
121
|
const rect = element.getBoundingClientRect();
|
|
@@ -137,8 +145,8 @@ const getCustomisations = (embedConfig, viewConfig) => {
|
|
|
137
145
|
var _a, _b, _c, _d;
|
|
138
146
|
const customCssUrlFromEmbedConfig = embedConfig.customCssUrl;
|
|
139
147
|
const customizationsFromViewConfig = viewConfig.customizations;
|
|
140
|
-
const customizationsFromEmbedConfig = embedConfig.customizations
|
|
141
|
-
embedConfig.customisations;
|
|
148
|
+
const customizationsFromEmbedConfig = embedConfig.customizations
|
|
149
|
+
|| embedConfig.customisations;
|
|
142
150
|
const customizations = {
|
|
143
151
|
style: {
|
|
144
152
|
...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style,
|
|
@@ -147,9 +155,9 @@ const getCustomisations = (embedConfig, viewConfig) => {
|
|
|
147
155
|
...(_a = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _a === void 0 ? void 0 : _a.customCSS,
|
|
148
156
|
...(_b = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _b === void 0 ? void 0 : _b.customCSS,
|
|
149
157
|
},
|
|
150
|
-
customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
|
|
151
|
-
((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl)
|
|
152
|
-
customCssUrlFromEmbedConfig,
|
|
158
|
+
customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
|
|
159
|
+
|| ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl)
|
|
160
|
+
|| customCssUrlFromEmbedConfig,
|
|
153
161
|
},
|
|
154
162
|
content: {
|
|
155
163
|
...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.content,
|
|
@@ -161,12 +169,11 @@ const getCustomisations = (embedConfig, viewConfig) => {
|
|
|
161
169
|
/**
|
|
162
170
|
* Gets a reference to the DOM node given
|
|
163
171
|
* a selector.
|
|
172
|
+
*
|
|
164
173
|
* @param domSelector
|
|
165
174
|
*/
|
|
166
175
|
function getDOMNode(domSelector) {
|
|
167
|
-
return typeof domSelector === 'string'
|
|
168
|
-
? document.querySelector(domSelector)
|
|
169
|
-
: domSelector;
|
|
176
|
+
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
170
177
|
}
|
|
171
178
|
|
|
172
179
|
/**
|
|
@@ -180,28 +187,35 @@ function getDOMNode(domSelector) {
|
|
|
180
187
|
/**
|
|
181
188
|
* The authentication mechanism for allowing access to the
|
|
182
189
|
* the embedded app
|
|
190
|
+
*
|
|
191
|
+
* @group Authentication / Init
|
|
183
192
|
*/
|
|
184
193
|
// eslint-disable-next-line no-shadow
|
|
185
194
|
var AuthType;
|
|
186
195
|
(function (AuthType) {
|
|
187
196
|
/**
|
|
188
|
-
* No authentication on the SDK. Passthrough to the embedded App. Alias for
|
|
197
|
+
* No authentication on the SDK. Passthrough to the embedded App. Alias for
|
|
198
|
+
* `Passthrough`.
|
|
189
199
|
*/
|
|
190
200
|
AuthType["None"] = "None";
|
|
191
201
|
/**
|
|
192
|
-
* Passthrough SSO to the embedded App within the iframe. Requires least
|
|
193
|
-
* be supported by all IDPs. This will behave like `None`
|
|
202
|
+
* Passthrough SSO to the embedded App within the iframe. Requires least
|
|
203
|
+
* configuration, but may not be supported by all IDPs. This will behave like `None`
|
|
204
|
+
* if SSO is not configured on ThoughtSpot.
|
|
205
|
+
*
|
|
194
206
|
* @version: SDK: 1.15.0 | ThouhgtSpot: 8.8.0.cl
|
|
195
207
|
*/
|
|
196
208
|
AuthType["EmbeddedSSO"] = "EmbeddedSSO";
|
|
197
209
|
/**
|
|
198
210
|
* SSO using SAML
|
|
211
|
+
*
|
|
199
212
|
* @deprecated Use {@link SAMLRedirect} instead
|
|
200
213
|
* @hidden
|
|
201
214
|
*/
|
|
202
215
|
AuthType["SSO"] = "SSO_SAML";
|
|
203
216
|
/**
|
|
204
217
|
* SSO using SAML
|
|
218
|
+
*
|
|
205
219
|
* @deprecated Use {@link SAMLRedirect} instead
|
|
206
220
|
* @hidden
|
|
207
221
|
*/
|
|
@@ -209,10 +223,21 @@ var AuthType;
|
|
|
209
223
|
/**
|
|
210
224
|
* SSO using SAML
|
|
211
225
|
* Will make the host application redirect to the SAML Idp.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```js
|
|
229
|
+
* init({
|
|
230
|
+
* // ...
|
|
231
|
+
* authType: AuthType.SAMLRedirect,
|
|
232
|
+
* authTriggerText: 'Login with SAML',
|
|
233
|
+
* authTriggerContainer: '#embed-container',
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
212
236
|
*/
|
|
213
237
|
AuthType["SAMLRedirect"] = "SSO_SAML";
|
|
214
238
|
/**
|
|
215
239
|
* SSO using OIDC
|
|
240
|
+
*
|
|
216
241
|
* @hidden
|
|
217
242
|
* @deprecated Use {@link OIDCRedirect} instead
|
|
218
243
|
*/
|
|
@@ -224,21 +249,35 @@ var AuthType;
|
|
|
224
249
|
AuthType["OIDCRedirect"] = "SSO_OIDC";
|
|
225
250
|
/**
|
|
226
251
|
* Trusted authentication server
|
|
252
|
+
*
|
|
227
253
|
* @hidden
|
|
228
254
|
* @deprecated Use {@link TrustedAuth} instead
|
|
229
255
|
*/
|
|
230
256
|
AuthType["AuthServer"] = "AuthServer";
|
|
231
257
|
/**
|
|
232
258
|
* Trusted authentication server, Use your own authentication server
|
|
233
|
-
* which returns a bearer token, generated using the secret_key obtained
|
|
234
|
-
* ThoughtSpot.
|
|
259
|
+
* which returns a bearer token, generated using the secret_key obtained
|
|
260
|
+
* from ThoughtSpot.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```js
|
|
264
|
+
* init({
|
|
265
|
+
* // ...
|
|
266
|
+
* authType: AuthType.TrustedAuthToken,
|
|
267
|
+
* getAuthToken: () => {
|
|
268
|
+
* return fetch('https://my-backend.app/ts-token')
|
|
269
|
+
* .then((response) => response.json())
|
|
270
|
+
* .then((data) => data.token);
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
235
273
|
*/
|
|
236
274
|
AuthType["TrustedAuthToken"] = "AuthServer";
|
|
237
275
|
/**
|
|
238
|
-
* Trusted authentication server Cookieless, Use you own authentication
|
|
239
|
-
* which returns a bearer token, generated using the secret_key
|
|
240
|
-
* ThoughtSpot. This uses a cookieless authentication
|
|
241
|
-
* to by pass third-party cookie-blocking restriction
|
|
276
|
+
* Trusted authentication server Cookieless, Use you own authentication
|
|
277
|
+
* server which returns a bearer token, generated using the secret_key
|
|
278
|
+
* obtained from ThoughtSpot. This uses a cookieless authentication
|
|
279
|
+
* approach, recommended to by pass third-party cookie-blocking restriction
|
|
280
|
+
* implemented by some browsers
|
|
242
281
|
*/
|
|
243
282
|
AuthType["TrustedAuthTokenCookieless"] = "AuthServerCookieless";
|
|
244
283
|
/**
|
|
@@ -314,32 +353,42 @@ var RuntimeFilterOp;
|
|
|
314
353
|
})(RuntimeFilterOp || (RuntimeFilterOp = {}));
|
|
315
354
|
/**
|
|
316
355
|
* Event types emitted by the embedded ThoughtSpot application.
|
|
356
|
+
*
|
|
357
|
+
* To add an event listener use the corresponding
|
|
358
|
+
* {@link LiveboardEmbed.on} or {@link AppEmbed.on} or {@link SearchEmbed.on} method.
|
|
359
|
+
*
|
|
360
|
+
* @group Events
|
|
317
361
|
*/
|
|
318
362
|
// eslint-disable-next-line no-shadow
|
|
319
363
|
var EmbedEvent;
|
|
320
364
|
(function (EmbedEvent) {
|
|
321
365
|
/**
|
|
322
366
|
* Rendering has initialized.
|
|
323
|
-
*
|
|
367
|
+
*
|
|
368
|
+
* @returns timestamp - The timestamp when the event was generated.
|
|
324
369
|
*/
|
|
325
370
|
EmbedEvent["Init"] = "init";
|
|
326
371
|
/**
|
|
327
372
|
* Authentication has either succeeded or failed.
|
|
328
|
-
*
|
|
373
|
+
*
|
|
374
|
+
* @returns isLoggedIn - A Boolean specifying whether authentication was successful.
|
|
329
375
|
*/
|
|
330
376
|
EmbedEvent["AuthInit"] = "authInit";
|
|
331
377
|
/**
|
|
332
378
|
* The embed object container has loaded.
|
|
333
|
-
*
|
|
379
|
+
*
|
|
380
|
+
* @returns timestamp - The timestamp when the event was generated.
|
|
334
381
|
*/
|
|
335
382
|
EmbedEvent["Load"] = "load";
|
|
336
383
|
/**
|
|
337
384
|
* Data pertaining to answer or Liveboard is received
|
|
338
|
-
*
|
|
385
|
+
*
|
|
386
|
+
* @returns data - The answer or Liveboard data
|
|
339
387
|
*/
|
|
340
388
|
EmbedEvent["Data"] = "data";
|
|
341
389
|
/**
|
|
342
390
|
* Search/answer/Liveboard filters have been applied/updated
|
|
391
|
+
*
|
|
343
392
|
* @hidden
|
|
344
393
|
*/
|
|
345
394
|
EmbedEvent["FiltersChanged"] = "filtersChanged";
|
|
@@ -349,48 +398,56 @@ var EmbedEvent;
|
|
|
349
398
|
EmbedEvent["QueryChanged"] = "queryChanged";
|
|
350
399
|
/**
|
|
351
400
|
* A drill down operation has been performed.
|
|
352
|
-
*
|
|
353
|
-
* @
|
|
354
|
-
* @
|
|
401
|
+
*
|
|
402
|
+
* @returns additionalFilters - Any additional filters applied
|
|
403
|
+
* @returns drillDownColumns - The columns on which drill down was performed
|
|
404
|
+
* @returns nonFilteredColumns - The columns that were not filtered
|
|
355
405
|
*/
|
|
356
406
|
EmbedEvent["Drilldown"] = "drillDown";
|
|
357
407
|
/**
|
|
358
408
|
* One or more data sources have been selected.
|
|
359
|
-
*
|
|
409
|
+
*
|
|
410
|
+
* @returns dataSourceIds - the list of data sources
|
|
360
411
|
*/
|
|
361
412
|
EmbedEvent["DataSourceSelected"] = "dataSourceSelected";
|
|
362
413
|
/**
|
|
363
414
|
* One or more data columns have been selected.
|
|
364
|
-
*
|
|
415
|
+
*
|
|
416
|
+
* @returns columnIds - the list of columns
|
|
365
417
|
* @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
366
418
|
*/
|
|
367
419
|
EmbedEvent["AddRemoveColumns"] = "addRemoveColumns";
|
|
368
420
|
/**
|
|
369
421
|
* A custom action has been triggered
|
|
370
|
-
*
|
|
371
|
-
* @
|
|
422
|
+
*
|
|
423
|
+
* @returns actionId - The id of the custom action
|
|
424
|
+
* @returns data - The answer or Liveboard data
|
|
372
425
|
*/
|
|
373
426
|
EmbedEvent["CustomAction"] = "customAction";
|
|
374
427
|
/**
|
|
375
428
|
* A double click has been triggered on table/chart
|
|
376
|
-
*
|
|
429
|
+
*
|
|
430
|
+
* @returns ContextMenuInputPoints - data point that is double clicked
|
|
377
431
|
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
378
432
|
*/
|
|
379
433
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
380
434
|
/**
|
|
381
435
|
* A click has been triggered on table/chart
|
|
382
|
-
*
|
|
436
|
+
*
|
|
437
|
+
* @returns ContextMenuInputPoints - data point that is clicked
|
|
383
438
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
384
439
|
*/
|
|
385
440
|
EmbedEvent["VizPointClick"] = "vizPointClick";
|
|
386
441
|
/**
|
|
387
442
|
* An error has occurred.
|
|
388
|
-
*
|
|
443
|
+
*
|
|
444
|
+
* @returns error - An error object or message
|
|
389
445
|
*/
|
|
390
446
|
EmbedEvent["Error"] = "Error";
|
|
391
447
|
/**
|
|
392
448
|
* The embedded object has sent an alert
|
|
393
|
-
*
|
|
449
|
+
*
|
|
450
|
+
* @returns alert - An alert object
|
|
394
451
|
*/
|
|
395
452
|
EmbedEvent["Alert"] = "alert";
|
|
396
453
|
/**
|
|
@@ -399,29 +456,34 @@ var EmbedEvent;
|
|
|
399
456
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
400
457
|
/**
|
|
401
458
|
* ThoughtSpot failed to validate the auth session.
|
|
459
|
+
*
|
|
402
460
|
* @hidden
|
|
403
461
|
*/
|
|
404
462
|
EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
|
|
405
463
|
/**
|
|
406
464
|
* ThoughtSpot failed to validate the auth session.
|
|
465
|
+
*
|
|
407
466
|
* @hidden
|
|
408
467
|
*/
|
|
409
468
|
EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
|
|
410
469
|
/**
|
|
411
470
|
* The height of the embedded Liveboard or visualization has been computed.
|
|
412
|
-
*
|
|
471
|
+
*
|
|
472
|
+
* @returns data - The height of the embedded Liveboard or visualization
|
|
413
473
|
* @hidden
|
|
414
474
|
*/
|
|
415
475
|
EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
|
|
416
476
|
/**
|
|
417
477
|
* The center of visible iframe viewport is calculated.
|
|
418
|
-
*
|
|
478
|
+
*
|
|
479
|
+
* @returns data - The center of the visible Iframe viewport.
|
|
419
480
|
* @hidden
|
|
420
481
|
*/
|
|
421
482
|
EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
|
|
422
483
|
/**
|
|
423
484
|
* Emitted when the "Get Data" button in Search Bar embed
|
|
424
485
|
* is clicked.
|
|
486
|
+
*
|
|
425
487
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.0-sw
|
|
426
488
|
*/
|
|
427
489
|
EmbedEvent["GetDataClick"] = "getDataClick";
|
|
@@ -431,6 +493,7 @@ var EmbedEvent;
|
|
|
431
493
|
EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
|
|
432
494
|
/**
|
|
433
495
|
* The v1 event type for Data
|
|
496
|
+
*
|
|
434
497
|
* @hidden
|
|
435
498
|
*/
|
|
436
499
|
EmbedEvent["V1Data"] = "exportVizDataToParent";
|
|
@@ -443,17 +506,20 @@ var EmbedEvent;
|
|
|
443
506
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
444
507
|
/**
|
|
445
508
|
* Emitted when SAML is complete
|
|
509
|
+
*
|
|
446
510
|
* @private
|
|
447
511
|
* @hidden
|
|
448
512
|
*/
|
|
449
513
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
450
514
|
/**
|
|
451
515
|
* Emitted when any modal is opened in the app
|
|
516
|
+
*
|
|
452
517
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
453
518
|
*/
|
|
454
519
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
455
520
|
/**
|
|
456
521
|
* Emitted when any modal is closed in the app
|
|
522
|
+
*
|
|
457
523
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
458
524
|
*/
|
|
459
525
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
@@ -461,416 +527,571 @@ var EmbedEvent;
|
|
|
461
527
|
* Emitted when the Liveboard shell loads.
|
|
462
528
|
* You can use this event as a hook to trigger
|
|
463
529
|
* other events on the rendered Liveboard.
|
|
530
|
+
*
|
|
464
531
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
465
532
|
*/
|
|
466
533
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
467
534
|
/**
|
|
468
535
|
* This can be used to register an event listener which
|
|
469
536
|
* is triggered on all events.
|
|
537
|
+
*
|
|
470
538
|
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
471
539
|
*/
|
|
472
540
|
EmbedEvent["ALL"] = "*";
|
|
473
541
|
/**
|
|
474
542
|
* Emitted when answer is saved in the app
|
|
543
|
+
*
|
|
475
544
|
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
476
545
|
*/
|
|
477
546
|
EmbedEvent["Save"] = "save";
|
|
478
547
|
/**
|
|
479
548
|
* Emitted when the download action is triggered on an answer
|
|
549
|
+
*
|
|
480
550
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
481
551
|
*/
|
|
482
552
|
EmbedEvent["Download"] = "download";
|
|
483
553
|
/**
|
|
484
554
|
* Emitted when the Download as PDF action is triggered on an answer
|
|
555
|
+
*
|
|
485
556
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
486
557
|
*/
|
|
487
558
|
EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
488
559
|
/**
|
|
489
560
|
* Emitted when the Download as CSV action is triggered on an answer
|
|
561
|
+
*
|
|
490
562
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
491
563
|
*/
|
|
492
564
|
EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
|
|
493
565
|
/**
|
|
494
566
|
* Emitted when the Download as XLSX action is triggered on an answer
|
|
567
|
+
*
|
|
495
568
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
496
569
|
*/
|
|
497
570
|
EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
|
|
498
571
|
/**
|
|
499
572
|
* Emitted when an answer is deleted in the app
|
|
573
|
+
*
|
|
500
574
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
501
575
|
*/
|
|
502
576
|
EmbedEvent["AnswerDelete"] = "answerDelete";
|
|
503
577
|
/**
|
|
504
578
|
* Emitted when an answer is pinned to a Liveboard
|
|
579
|
+
*
|
|
505
580
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
506
581
|
*/
|
|
507
582
|
EmbedEvent["Pin"] = "pin";
|
|
508
583
|
/**
|
|
509
584
|
* Emitted when SpotIQ analysis is triggered
|
|
585
|
+
*
|
|
510
586
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
511
587
|
*/
|
|
512
588
|
EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
513
589
|
/**
|
|
514
590
|
* Emitted when a user shares an object with another user or group
|
|
591
|
+
*
|
|
515
592
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
516
593
|
*/
|
|
517
594
|
EmbedEvent["Share"] = "share";
|
|
518
595
|
/**
|
|
519
|
-
* Emitted when a user clicks the Include action to include a specific value or data
|
|
596
|
+
* Emitted when a user clicks the Include action to include a specific value or data
|
|
597
|
+
* on a chart or table
|
|
598
|
+
*
|
|
520
599
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
521
600
|
*/
|
|
522
601
|
EmbedEvent["DrillInclude"] = "context-menu-item-include";
|
|
523
602
|
/**
|
|
524
|
-
* Emitted when a user clicks the Exclude action to exclude a specific value or data
|
|
603
|
+
* Emitted when a user clicks the Exclude action to exclude a specific value or data
|
|
604
|
+
* on a chart or table
|
|
605
|
+
*
|
|
525
606
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
526
607
|
*/
|
|
527
608
|
EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
|
|
528
609
|
/**
|
|
529
610
|
* Emitted when copied column value on the app
|
|
611
|
+
*
|
|
530
612
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
531
613
|
*/
|
|
532
614
|
EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
533
615
|
/**
|
|
534
616
|
* Emitted when a user clicks the Update TML action
|
|
617
|
+
*
|
|
535
618
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
536
619
|
*/
|
|
537
620
|
EmbedEvent["UpdateTML"] = "updateTSL";
|
|
538
621
|
/**
|
|
539
622
|
* Emitted when a user clicks the Edit TML action
|
|
623
|
+
*
|
|
540
624
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
541
625
|
*/
|
|
542
626
|
EmbedEvent["EditTML"] = "editTSL";
|
|
543
627
|
/**
|
|
544
628
|
* Emitted when ExportTML trigger in answer on the app
|
|
629
|
+
*
|
|
545
630
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
546
631
|
*/
|
|
547
632
|
EmbedEvent["ExportTML"] = "exportTSL";
|
|
548
633
|
/**
|
|
549
634
|
* Emitted when an answer is saved as a view
|
|
635
|
+
*
|
|
550
636
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
551
637
|
*/
|
|
552
638
|
EmbedEvent["SaveAsView"] = "saveAsView";
|
|
553
639
|
/**
|
|
554
640
|
* Emitted when copy of existing answer on the app
|
|
641
|
+
*
|
|
555
642
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
556
643
|
*/
|
|
557
644
|
EmbedEvent["CopyAEdit"] = "copyAEdit";
|
|
558
645
|
/**
|
|
559
646
|
* Emitted when a user clicks Show underlying data on an answe
|
|
647
|
+
*
|
|
560
648
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
561
649
|
*/
|
|
562
650
|
EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
563
651
|
/**
|
|
564
652
|
* Emitted when an answer is switched to a chart or table view
|
|
653
|
+
*
|
|
565
654
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
566
655
|
*/
|
|
567
656
|
EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
568
657
|
/**
|
|
569
658
|
* Internal event to communicate the initial settings back to the TS APP
|
|
659
|
+
*
|
|
570
660
|
* @hidden
|
|
571
661
|
*/
|
|
572
662
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
573
663
|
/**
|
|
574
664
|
* Emitted when a user clicks Show Liveboard details on a Liveboard
|
|
665
|
+
*
|
|
575
666
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
576
667
|
*/
|
|
577
668
|
EmbedEvent["LiveboardInfo"] = "pinboardInfo";
|
|
578
669
|
/**
|
|
579
670
|
* Emitted when a user clicks on the Favorite icon on a Liveboard
|
|
671
|
+
*
|
|
580
672
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
581
673
|
*/
|
|
582
674
|
EmbedEvent["AddToFavorites"] = "addToFavorites";
|
|
583
675
|
/**
|
|
584
676
|
* Emitted when a user clicks Schedule on a Liveboard
|
|
677
|
+
*
|
|
585
678
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
586
679
|
*/
|
|
587
680
|
EmbedEvent["Schedule"] = "subscription";
|
|
588
681
|
/**
|
|
589
682
|
* Emitted when a user clicks Edit on a Liveboard or visualization
|
|
683
|
+
*
|
|
590
684
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
591
685
|
*/
|
|
592
686
|
EmbedEvent["Edit"] = "edit";
|
|
593
687
|
/**
|
|
594
688
|
* Emitted when a user clicks Make a copy on a Liveboard
|
|
689
|
+
*
|
|
595
690
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
596
691
|
*/
|
|
597
692
|
EmbedEvent["MakeACopy"] = "makeACopy";
|
|
598
693
|
/**
|
|
599
694
|
* Emitted when a user clicks Present on a Liveboard or visualization
|
|
695
|
+
*
|
|
600
696
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
601
697
|
*/
|
|
602
698
|
EmbedEvent["Present"] = "present";
|
|
603
699
|
/**
|
|
604
700
|
* Emitted when a user clicks Delete on a Liveboard
|
|
701
|
+
*
|
|
605
702
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
606
703
|
*/
|
|
607
704
|
EmbedEvent["Delete"] = "delete";
|
|
608
705
|
/**
|
|
609
706
|
* Emitted when a user clicks Manage schedules on a Liveboard
|
|
707
|
+
*
|
|
610
708
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
611
709
|
*/
|
|
612
710
|
EmbedEvent["SchedulesList"] = "schedule-list";
|
|
613
711
|
/**
|
|
614
712
|
* Emitted when a user clicks Cancel in edit mode on a Liveboard
|
|
713
|
+
*
|
|
615
714
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
616
715
|
*/
|
|
617
716
|
EmbedEvent["Cancel"] = "cancel";
|
|
618
717
|
/**
|
|
619
718
|
* Emitted when a user clicks Explore on a visualization
|
|
719
|
+
*
|
|
620
720
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
621
721
|
*/
|
|
622
722
|
EmbedEvent["Explore"] = "explore";
|
|
623
723
|
/**
|
|
624
724
|
* Emitted when a user clicks Copy link action on a visualization
|
|
725
|
+
*
|
|
625
726
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
626
727
|
*/
|
|
627
728
|
EmbedEvent["CopyLink"] = "embedDocument";
|
|
628
729
|
/**
|
|
629
730
|
* Emitted when a user interacts with cross filters on a visualization or liveboard
|
|
731
|
+
*
|
|
630
732
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
631
733
|
*/
|
|
632
734
|
EmbedEvent["CrossFilterChanged"] = "cross-filter-changed";
|
|
633
735
|
/**
|
|
634
736
|
* Emitted when a user right clicks on chart or table
|
|
737
|
+
*
|
|
635
738
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
636
739
|
*/
|
|
637
740
|
EmbedEvent["VizPointRightClick"] = "vizPointRightClick";
|
|
741
|
+
/**
|
|
742
|
+
* Emitted when a user clicks on Insert to slide on a visualization
|
|
743
|
+
*
|
|
744
|
+
* @hidden
|
|
745
|
+
*/
|
|
746
|
+
EmbedEvent["InsertIntoSlide"] = "insertInToSlide";
|
|
638
747
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
639
748
|
/**
|
|
640
749
|
* Event types that can be triggered by the host application
|
|
641
750
|
* to the embedded ThoughtSpot app
|
|
642
751
|
*
|
|
643
752
|
* To trigger an event use the corresponding
|
|
644
|
-
* {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
|
|
753
|
+
* {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
|
|
754
|
+
* SearchEmbed.trigger} method.
|
|
755
|
+
*
|
|
756
|
+
* @group Events
|
|
645
757
|
*/
|
|
646
758
|
// eslint-disable-next-line no-shadow
|
|
647
759
|
var HostEvent;
|
|
648
760
|
(function (HostEvent) {
|
|
649
761
|
/**
|
|
650
762
|
* Trigger a search
|
|
763
|
+
*
|
|
651
764
|
* @param - dataSourceIds - The data source GUID to Search on
|
|
652
765
|
* - Although an array, only a single source
|
|
653
766
|
* is supported at this time.
|
|
654
767
|
* @param - searchQuery - The search query
|
|
655
768
|
* @param - execute - execute the existing / updated query
|
|
656
769
|
* @example
|
|
770
|
+
* ```js
|
|
657
771
|
* searchEmbed.trigger(HostEvent.Search, {
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
772
|
+
* searchQuery: "[sales] by [item type],
|
|
773
|
+
* dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
|
|
774
|
+
* execute: true
|
|
661
775
|
* })
|
|
776
|
+
* ```
|
|
662
777
|
*/
|
|
663
778
|
HostEvent["Search"] = "search";
|
|
664
779
|
/**
|
|
665
780
|
* Trigger a drill on certain points by certain column
|
|
781
|
+
*
|
|
666
782
|
* @param - points - an object containing selectedPoints/clickedPoints
|
|
667
783
|
* eg. { selectedPoints: []}
|
|
668
784
|
* @param - columnGuid - a string guid of the column to drill by. This is optional,
|
|
669
|
-
* if not provided it will auto drill by the configured
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
785
|
+
* if not provided it will auto drill by the configured
|
|
786
|
+
* column.
|
|
787
|
+
* @example
|
|
788
|
+
* ```js
|
|
789
|
+
* searchEmbed.trigger(HostEvent.DrillDown, {
|
|
790
|
+
* points: clickedPointData,
|
|
791
|
+
* autoDrillDown: true,
|
|
673
792
|
* })
|
|
793
|
+
* ```
|
|
674
794
|
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
675
795
|
*/
|
|
676
796
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
677
797
|
/**
|
|
678
798
|
* Apply filters
|
|
799
|
+
*
|
|
679
800
|
* @hidden
|
|
680
801
|
*/
|
|
681
802
|
HostEvent["Filter"] = "filter";
|
|
682
803
|
/**
|
|
683
804
|
* Reload the answer or visualization
|
|
805
|
+
*
|
|
684
806
|
* @hidden
|
|
685
807
|
*/
|
|
686
808
|
HostEvent["Reload"] = "reload";
|
|
687
809
|
/**
|
|
688
810
|
* Set the visible visualizations on a Liveboard.
|
|
811
|
+
*
|
|
689
812
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
690
813
|
* will be hidden.
|
|
691
814
|
* @example
|
|
692
|
-
* liveboardEmbed.trigger(HostEvent.SetVisibleVizs, [
|
|
815
|
+
* liveboardEmbed.trigger(HostEvent.SetVisibleVizs, [
|
|
816
|
+
* '730496d6-6903-4601-937e-2c691821af3c',
|
|
817
|
+
* 'd547ec54-2a37-4516-a222-2b06719af726'])
|
|
693
818
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
694
819
|
*/
|
|
695
820
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
696
821
|
/**
|
|
697
822
|
* Update the runtime filters. The runtime filters passed here are extended
|
|
698
823
|
* on to the existing runtime filters if they exist.
|
|
824
|
+
*
|
|
699
825
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
700
826
|
* @example
|
|
701
827
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
702
828
|
* {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
|
|
703
|
-
* {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
|
|
704
|
-
* ])
|
|
829
|
+
* {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
|
|
830
|
+
* ["Jackets"]} ])
|
|
705
831
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
706
832
|
*/
|
|
707
833
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
708
834
|
/**
|
|
709
835
|
* Navigate to a specific page in App embed without any reload.
|
|
710
836
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
837
|
+
*
|
|
711
838
|
* @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
712
|
-
* @example
|
|
839
|
+
* @example
|
|
840
|
+
* ```js
|
|
841
|
+
* appEmbed.navigateToPage(-1)
|
|
842
|
+
* ```
|
|
713
843
|
* @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
|
|
714
844
|
*/
|
|
715
845
|
HostEvent["Navigate"] = "Navigate";
|
|
716
846
|
/**
|
|
717
847
|
* Opens the filter panel for a particular column.
|
|
718
848
|
* Works with Search embed.
|
|
719
|
-
*
|
|
720
|
-
* @
|
|
849
|
+
*
|
|
850
|
+
* @param - { columnId: string,
|
|
851
|
+
* name: string,
|
|
852
|
+
* type: INT64/CHAR/DATE,
|
|
853
|
+
* dataType: ATTRIBUTE/MEASURE }
|
|
854
|
+
* @example
|
|
855
|
+
* ```js
|
|
856
|
+
* searchEmbed.trigger(HostEvent.OpenFilter,
|
|
857
|
+
* { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
|
|
858
|
+
* ```
|
|
721
859
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
722
860
|
*/
|
|
723
861
|
HostEvent["OpenFilter"] = "openFilter";
|
|
724
862
|
/**
|
|
725
863
|
* Adds the columns to the current Search.
|
|
864
|
+
*
|
|
726
865
|
* @param - { columnIds: string[] }
|
|
727
|
-
* @example
|
|
866
|
+
* @example
|
|
867
|
+
* ```js
|
|
868
|
+
* searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['123', '456'] })
|
|
869
|
+
* ```
|
|
728
870
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
729
871
|
*/
|
|
730
872
|
HostEvent["AddColumns"] = "addColumns";
|
|
731
873
|
/**
|
|
732
874
|
* Removes a column from the current Search.
|
|
875
|
+
*
|
|
733
876
|
* @param - { columnId: string }
|
|
734
|
-
* @example
|
|
877
|
+
* @example
|
|
878
|
+
* ```js
|
|
879
|
+
* searchEmbed.trigger(HostEvent.RemoveColumn, { columnId: '123' })
|
|
880
|
+
* ```
|
|
735
881
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
736
882
|
*/
|
|
737
883
|
HostEvent["RemoveColumn"] = "removeColumn";
|
|
738
884
|
/**
|
|
739
885
|
* Gets the current pinboard content.
|
|
740
|
-
*
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* ```js
|
|
889
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
|
|
890
|
+
* ```
|
|
741
891
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
742
892
|
*/
|
|
743
893
|
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
744
894
|
/**
|
|
745
895
|
* Triggers the Pin action on an embedded object
|
|
896
|
+
*
|
|
746
897
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
747
898
|
* can be left empty for search and visualization embeds
|
|
748
899
|
* @example
|
|
900
|
+
* ```js
|
|
749
901
|
* liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
750
902
|
* vizEmbed.trigger(HostEvent.Pin)
|
|
751
903
|
* searchEmbed.trigger(HostEvent.Pin)
|
|
904
|
+
* ```
|
|
752
905
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
753
906
|
*/
|
|
754
907
|
HostEvent["Pin"] = "pin";
|
|
755
908
|
/**
|
|
756
909
|
* Triggers the Show Liveboard details action on a Liveboard
|
|
757
|
-
*
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* ```js
|
|
913
|
+
* liveboardEmbed.trigger(HostEvent.LiveboardInfo)
|
|
914
|
+
* ```
|
|
758
915
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
759
916
|
*/
|
|
760
917
|
HostEvent["LiveboardInfo"] = "pinboardInfo";
|
|
761
918
|
/**
|
|
762
919
|
* Triggers the Schedule action on a Liveboard
|
|
763
|
-
*
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* ```js
|
|
923
|
+
* liveboardEmbed.trigger(HostEvent.Schedule)
|
|
924
|
+
* ```
|
|
764
925
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
765
926
|
*/
|
|
766
927
|
HostEvent["Schedule"] = "subscription";
|
|
767
928
|
/**
|
|
768
929
|
* Triggers the Manage schedule action on a Liveboard
|
|
769
|
-
*
|
|
930
|
+
*
|
|
931
|
+
* @example
|
|
932
|
+
* ```js
|
|
933
|
+
* liveboardEmbed.trigger(HostEvent.ScheduleList)
|
|
934
|
+
* ```
|
|
770
935
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
771
936
|
*/
|
|
772
937
|
HostEvent["SchedulesList"] = "schedule-list";
|
|
773
938
|
/**
|
|
774
939
|
* Triggers the Export TML action on a Liveboard
|
|
775
|
-
*
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```js
|
|
943
|
+
* liveboardEmbed.trigger(HostEvent.ExportTML)
|
|
944
|
+
* ```
|
|
776
945
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
777
946
|
*/
|
|
778
947
|
HostEvent["ExportTML"] = "exportTSL";
|
|
779
948
|
/**
|
|
780
949
|
* Triggers the Edit TML action on a Liveboard
|
|
781
|
-
*
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```js
|
|
953
|
+
* liveboardEmbed.trigger(HostEvent.EditTML)
|
|
954
|
+
* ```
|
|
782
955
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
783
956
|
*/
|
|
784
957
|
HostEvent["EditTML"] = "editTSL";
|
|
785
958
|
/**
|
|
786
959
|
* Triggers the Update TML action on a Liveboard
|
|
787
|
-
*
|
|
960
|
+
*
|
|
961
|
+
* @example
|
|
962
|
+
* ```js
|
|
963
|
+
* liveboardEmbed.trigger(HostEvent.UpdateTML)
|
|
964
|
+
* ```
|
|
788
965
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
789
966
|
*/
|
|
790
967
|
HostEvent["UpdateTML"] = "updateTSL";
|
|
791
968
|
/**
|
|
792
969
|
* Triggers the Download PDF action on a Liveboard
|
|
793
|
-
*
|
|
970
|
+
*
|
|
971
|
+
* @example
|
|
972
|
+
* ```js
|
|
973
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
|
|
974
|
+
* ```
|
|
794
975
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
795
976
|
*/
|
|
796
977
|
HostEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
797
978
|
/**
|
|
798
979
|
* Triggers the Make a copy action on a Liveboard, search or visualization
|
|
980
|
+
*
|
|
799
981
|
* @example
|
|
982
|
+
* ```js
|
|
800
983
|
* liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
801
984
|
* vizEmbed.trigger(HostEvent.MakeACopy)
|
|
802
985
|
* searchEmbed.trigger(HostEvent.MakeACopy)
|
|
986
|
+
* ```
|
|
803
987
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
804
988
|
*/
|
|
805
989
|
HostEvent["MakeACopy"] = "makeACopy";
|
|
806
990
|
/**
|
|
807
991
|
* Triggers the Delete action on a Liveboard
|
|
808
|
-
*
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```js
|
|
995
|
+
* appEmbed.trigger(HostEvent.Remove)
|
|
996
|
+
* ```
|
|
809
997
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
810
998
|
*/
|
|
811
999
|
HostEvent["Remove"] = "delete";
|
|
812
1000
|
/**
|
|
813
1001
|
* Triggers the Explore action on a visualization
|
|
1002
|
+
*
|
|
814
1003
|
* @param - an object with vizId as a key
|
|
815
|
-
* @example
|
|
1004
|
+
* @example
|
|
1005
|
+
* ```js
|
|
1006
|
+
* liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1007
|
+
* ```
|
|
816
1008
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
817
1009
|
*/
|
|
818
1010
|
HostEvent["Explore"] = "explore";
|
|
819
1011
|
/**
|
|
820
1012
|
* Triggers the Create alert action on a visualization
|
|
1013
|
+
*
|
|
821
1014
|
* @param - an object with vizId as a key
|
|
822
|
-
* @example
|
|
1015
|
+
* @example
|
|
1016
|
+
* ```js
|
|
1017
|
+
* liveboardEmbed.trigger(HostEvent.CreateMonitor {
|
|
1018
|
+
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
1019
|
+
* })
|
|
1020
|
+
* ```
|
|
823
1021
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
824
1022
|
*/
|
|
825
1023
|
HostEvent["CreateMonitor"] = "createMonitor";
|
|
826
1024
|
/**
|
|
827
1025
|
* Triggers the Manage alert action on a visualization
|
|
1026
|
+
*
|
|
828
1027
|
* @param - an object with vizId as a key
|
|
829
|
-
* @example
|
|
1028
|
+
* @example
|
|
1029
|
+
* ```js
|
|
1030
|
+
* liveboardEmbed.trigger(HostEvent.ManageMonitor, {
|
|
1031
|
+
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
1032
|
+
* })
|
|
1033
|
+
* ```
|
|
830
1034
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
831
1035
|
*/
|
|
832
1036
|
HostEvent["ManageMonitor"] = "manageMonitor";
|
|
833
1037
|
/**
|
|
834
1038
|
* Triggers the Edit action on a Liveboard or visualization
|
|
835
|
-
*
|
|
1039
|
+
*
|
|
1040
|
+
* @param - object - to trigger the action for a specfic visualization
|
|
1041
|
+
* in Liveboard embed, pass in vizId as a key
|
|
836
1042
|
* @example
|
|
837
1043
|
* liveboardEmbed.trigger(HostEvent.Edit)
|
|
838
|
-
* liveboardEmbed.trigger(HostEvent.Edit, {vizId:
|
|
1044
|
+
* liveboardEmbed.trigger(HostEvent.Edit, {vizId:
|
|
1045
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
839
1046
|
* vizEmbed.trigger((HostEvent.Edit)
|
|
840
1047
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
841
1048
|
*/
|
|
842
1049
|
HostEvent["Edit"] = "edit";
|
|
843
1050
|
/**
|
|
844
1051
|
* Triggers the Copy link action on a Liveboard or visualization
|
|
845
|
-
*
|
|
1052
|
+
*
|
|
1053
|
+
* @param - object - to trigger the action for a s
|
|
1054
|
+
* pecfic visualization in Liveboard embed, pass in vizId as a key
|
|
846
1055
|
* @example
|
|
1056
|
+
* ```js
|
|
847
1057
|
* liveboardEmbed.trigger(HostEvent.CopyLink)
|
|
848
1058
|
* liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
849
1059
|
* vizEmbed.trigger((HostEvent.CopyLink)
|
|
1060
|
+
* ```
|
|
850
1061
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
851
1062
|
*/
|
|
852
1063
|
HostEvent["CopyLink"] = "embedDocument";
|
|
853
1064
|
/**
|
|
854
1065
|
* Triggers the Present action on a Liveboard or visualization
|
|
855
|
-
*
|
|
1066
|
+
*
|
|
1067
|
+
* @param - object - to trigger the action for a specfic visualization
|
|
1068
|
+
* in Liveboard embed, pass in vizId as a key
|
|
856
1069
|
* @example
|
|
1070
|
+
* ```js
|
|
857
1071
|
* liveboardEmbed.trigger(HostEvent.Present)
|
|
858
1072
|
* liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
859
1073
|
* vizEmbed.trigger((HostEvent.Present)
|
|
1074
|
+
* ```
|
|
860
1075
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
861
1076
|
*/
|
|
862
1077
|
HostEvent["Present"] = "present";
|
|
863
1078
|
/**
|
|
864
1079
|
* Get TML for the current search.
|
|
865
|
-
*
|
|
1080
|
+
*
|
|
1081
|
+
* @example
|
|
1082
|
+
* ```js
|
|
1083
|
+
* searchEmbed.trigger(HostEvent.GetTML)
|
|
1084
|
+
* ```
|
|
866
1085
|
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
|
|
867
1086
|
*/
|
|
868
1087
|
HostEvent["GetTML"] = "getTML";
|
|
869
1088
|
/**
|
|
870
1089
|
* Triggers the ShowUnderlyingData action on visualization or search
|
|
1090
|
+
*
|
|
871
1091
|
* @param - an object with vizId as a key
|
|
872
1092
|
* @example
|
|
873
|
-
* liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId:
|
|
1093
|
+
* liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId:
|
|
1094
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
874
1095
|
* vizEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
875
1096
|
* searchEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
876
1097
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -878,10 +1099,12 @@ var HostEvent;
|
|
|
878
1099
|
HostEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
879
1100
|
/**
|
|
880
1101
|
* Triggers the Delete action on visualization or search
|
|
1102
|
+
*
|
|
881
1103
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
882
1104
|
* can be left empty for search and visualization embeds
|
|
883
1105
|
* @example
|
|
884
|
-
* liveboardEmbed.trigger(HostEvent.Delete, {vizId:
|
|
1106
|
+
* liveboardEmbed.trigger(HostEvent.Delete, {vizId:
|
|
1107
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
885
1108
|
* vizEmbed.trigger(HostEvent.Delete)
|
|
886
1109
|
* searchEmbed.trigger(HostEvent.Delete)
|
|
887
1110
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -889,10 +1112,12 @@ var HostEvent;
|
|
|
889
1112
|
HostEvent["Delete"] = "delete";
|
|
890
1113
|
/**
|
|
891
1114
|
* Triggers the SpotIQAnalyze action on visualization or search
|
|
1115
|
+
*
|
|
892
1116
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
893
1117
|
* can be left empty for search and visualization embeds
|
|
894
1118
|
* @example
|
|
895
|
-
* liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId:
|
|
1119
|
+
* liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId:
|
|
1120
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
896
1121
|
* vizEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
897
1122
|
* searchEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
898
1123
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -900,26 +1125,34 @@ var HostEvent;
|
|
|
900
1125
|
HostEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
901
1126
|
/**
|
|
902
1127
|
* Triggers the Download action on visualization or search when Displaymode is Chart
|
|
1128
|
+
*
|
|
903
1129
|
* @example
|
|
904
|
-
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
1130
|
+
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
1131
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
905
1132
|
* vizEmbed.trigger(HostEvent.Download)
|
|
906
1133
|
* searchEmbed.trigger(HostEvent.Download)
|
|
907
1134
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
908
1135
|
*/
|
|
909
1136
|
HostEvent["Download"] = "download";
|
|
910
1137
|
/**
|
|
911
|
-
* Triggers the downloadAsCSV action on visualization or search when Displaymode is
|
|
1138
|
+
* Triggers the downloadAsCSV action on visualization or search when Displaymode is
|
|
1139
|
+
* Table
|
|
1140
|
+
*
|
|
912
1141
|
* @example
|
|
913
|
-
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
1142
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
1143
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
914
1144
|
* vizEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
915
1145
|
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
916
1146
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
917
1147
|
*/
|
|
918
1148
|
HostEvent["DownloadAsCsv"] = "downloadAsCSV";
|
|
919
1149
|
/**
|
|
920
|
-
* Triggers the downloadAsXLSX action on visualization or search when Displaymode is
|
|
1150
|
+
* Triggers the downloadAsXLSX action on visualization or search when Displaymode is
|
|
1151
|
+
* Table
|
|
1152
|
+
*
|
|
921
1153
|
* @example
|
|
922
|
-
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
1154
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
1155
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
923
1156
|
* vizEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
924
1157
|
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
925
1158
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -927,6 +1160,7 @@ var HostEvent;
|
|
|
927
1160
|
HostEvent["DownloadAsXlsx"] = "downloadAsXLSX";
|
|
928
1161
|
/**
|
|
929
1162
|
* Triggers the Share action on a liveboard or answer
|
|
1163
|
+
*
|
|
930
1164
|
* @example
|
|
931
1165
|
* liveboardEmbed.trigger(HostEvent.Share)
|
|
932
1166
|
* searchEmbed.trigger(HostEvent.Share)
|
|
@@ -935,6 +1169,7 @@ var HostEvent;
|
|
|
935
1169
|
HostEvent["Share"] = "share";
|
|
936
1170
|
/**
|
|
937
1171
|
* Trigger the Save action on a liveboard or answer
|
|
1172
|
+
*
|
|
938
1173
|
* @example
|
|
939
1174
|
* liveboardEmbed.trigger(HostEvent.Save)
|
|
940
1175
|
* searchEmbed.trigger(HostEvent.Save)
|
|
@@ -943,33 +1178,40 @@ var HostEvent;
|
|
|
943
1178
|
HostEvent["Save"] = "save";
|
|
944
1179
|
/**
|
|
945
1180
|
* Triggers the SyncToSheets action on visualization
|
|
1181
|
+
*
|
|
946
1182
|
* @param - an object with vizId as a key
|
|
947
1183
|
* @example
|
|
948
|
-
* liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId:
|
|
1184
|
+
* liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId:
|
|
1185
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
949
1186
|
* vizEmbed.trigger(HostEvent.SyncToSheets)
|
|
950
1187
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
951
1188
|
*/
|
|
952
1189
|
HostEvent["SyncToSheets"] = "sync-to-sheets";
|
|
953
1190
|
/**
|
|
954
1191
|
* Triggers the SyncToOtherApps action on visualization
|
|
1192
|
+
*
|
|
955
1193
|
* @param - an object with vizId as a key
|
|
956
1194
|
* @example
|
|
957
|
-
* liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId:
|
|
1195
|
+
* liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId:
|
|
1196
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
958
1197
|
* vizEmbed.trigger(HostEvent.SyncToOtherApps)
|
|
959
1198
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
960
1199
|
*/
|
|
961
1200
|
HostEvent["SyncToOtherApps"] = "sync-to-other-apps";
|
|
962
1201
|
/**
|
|
963
1202
|
* Triggers the ManagePipelines action on visualization
|
|
1203
|
+
*
|
|
964
1204
|
* @param - an object with vizId as a key
|
|
965
1205
|
* @example
|
|
966
|
-
* liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId:
|
|
1206
|
+
* liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId:
|
|
1207
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
967
1208
|
* vizEmbed.trigger(HostEvent.ManagePipelines)
|
|
968
1209
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
969
1210
|
*/
|
|
970
1211
|
HostEvent["ManagePipelines"] = "manage-pipeline";
|
|
971
1212
|
/**
|
|
972
1213
|
* Triggers the Reset search in answer
|
|
1214
|
+
*
|
|
973
1215
|
* @example
|
|
974
1216
|
* searchEmbed.trigger(HostEvent.SearchReset
|
|
975
1217
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.0.1-sw
|
|
@@ -1003,6 +1245,7 @@ var DataSourceVisualMode;
|
|
|
1003
1245
|
// eslint-disable-next-line no-shadow
|
|
1004
1246
|
var Param;
|
|
1005
1247
|
(function (Param) {
|
|
1248
|
+
Param["EmbedApp"] = "embedApp";
|
|
1006
1249
|
Param["DataSources"] = "dataSources";
|
|
1007
1250
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
1008
1251
|
Param["DisableActions"] = "disableAction";
|
|
@@ -1043,6 +1286,8 @@ var Param;
|
|
|
1043
1286
|
Param["ContextMenuTrigger"] = "isContextMenuEnabledOnLeftClick";
|
|
1044
1287
|
Param["LinkOverride"] = "linkOverride";
|
|
1045
1288
|
Param["ShowInsertToSlide"] = "insertInToSlide";
|
|
1289
|
+
Param["PrimaryNavHidden"] = "primaryNavHidden";
|
|
1290
|
+
Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
|
|
1046
1291
|
})(Param || (Param = {}));
|
|
1047
1292
|
/**
|
|
1048
1293
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
@@ -1297,6 +1542,7 @@ const urlRegex = new RegExp([
|
|
|
1297
1542
|
/**
|
|
1298
1543
|
* Parse and construct the ThoughtSpot hostname or IP address
|
|
1299
1544
|
* from the embed configuration object.
|
|
1545
|
+
*
|
|
1300
1546
|
* @param config
|
|
1301
1547
|
*/
|
|
1302
1548
|
const getThoughtSpotHost = (config) => {
|
|
@@ -1320,9 +1566,10 @@ const getV2BasePath = (config) => {
|
|
|
1320
1566
|
return config.basepath;
|
|
1321
1567
|
}
|
|
1322
1568
|
const tsHost = getThoughtSpotHost(config);
|
|
1323
|
-
// This is to handle when e2e's. Search is run on pods for
|
|
1324
|
-
// with baseUrl=https://localhost:8443.
|
|
1325
|
-
// This is to handle when the developer is developing in their local
|
|
1569
|
+
// This is to handle when e2e's. Search is run on pods for
|
|
1570
|
+
// comp-blink-test-pipeline with baseUrl=https://localhost:8443.
|
|
1571
|
+
// This is to handle when the developer is developing in their local
|
|
1572
|
+
// environment.
|
|
1326
1573
|
if (tsHost.includes('://localhost') && !tsHost.includes(':8443')) {
|
|
1327
1574
|
return '';
|
|
1328
1575
|
}
|
|
@@ -7332,6 +7579,7 @@ let isMixpanelInitialized = false;
|
|
|
7332
7579
|
let eventQueue = [];
|
|
7333
7580
|
/**
|
|
7334
7581
|
* Pushes the event with its Property key-value map to mixpanel.
|
|
7582
|
+
*
|
|
7335
7583
|
* @param eventId
|
|
7336
7584
|
* @param eventProps
|
|
7337
7585
|
*/
|
|
@@ -7342,6 +7590,9 @@ function uploadMixpanelEvent(eventId, eventProps = {}) {
|
|
|
7342
7590
|
}
|
|
7343
7591
|
mixpanel_cjs.track(eventId, eventProps);
|
|
7344
7592
|
}
|
|
7593
|
+
/**
|
|
7594
|
+
*
|
|
7595
|
+
*/
|
|
7345
7596
|
function emptyQueue() {
|
|
7346
7597
|
if (!isMixpanelInitialized) {
|
|
7347
7598
|
return;
|
|
@@ -7351,11 +7602,16 @@ function emptyQueue() {
|
|
|
7351
7602
|
});
|
|
7352
7603
|
eventQueue = [];
|
|
7353
7604
|
}
|
|
7605
|
+
/**
|
|
7606
|
+
*
|
|
7607
|
+
* @param sessionInfo
|
|
7608
|
+
*/
|
|
7354
7609
|
function initMixpanel(sessionInfo) {
|
|
7355
7610
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
7356
7611
|
return;
|
|
7357
7612
|
}
|
|
7358
|
-
// On a public cluster the user is anonymous, so don't set the identify to
|
|
7613
|
+
// On a public cluster the user is anonymous, so don't set the identify to
|
|
7614
|
+
// userGUID
|
|
7359
7615
|
const isPublicCluster = !!sessionInfo.isPublicUser;
|
|
7360
7616
|
const token = sessionInfo.mixpanelToken;
|
|
7361
7617
|
if (token) {
|
|
@@ -8834,6 +9090,11 @@ function uniq(array) {
|
|
|
8834
9090
|
var uniq_1 = uniq;
|
|
8835
9091
|
|
|
8836
9092
|
// eslint-disable-next-line import/no-cycle
|
|
9093
|
+
/**
|
|
9094
|
+
*
|
|
9095
|
+
* @param url
|
|
9096
|
+
* @param options
|
|
9097
|
+
*/
|
|
8837
9098
|
function failureLoggedFetch(url, options = {}) {
|
|
8838
9099
|
return fetch(url, options).then(async (r) => {
|
|
8839
9100
|
var _a;
|
|
@@ -8843,21 +9104,42 @@ function failureLoggedFetch(url, options = {}) {
|
|
|
8843
9104
|
return r;
|
|
8844
9105
|
});
|
|
8845
9106
|
}
|
|
9107
|
+
/**
|
|
9108
|
+
*
|
|
9109
|
+
* @param authVerificationUrl
|
|
9110
|
+
*/
|
|
8846
9111
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
8847
9112
|
return failureLoggedFetch(authVerificationUrl, {
|
|
8848
9113
|
credentials: 'include',
|
|
8849
9114
|
});
|
|
8850
9115
|
}
|
|
9116
|
+
/**
|
|
9117
|
+
*
|
|
9118
|
+
* @param authEndpoint
|
|
9119
|
+
*/
|
|
8851
9120
|
async function fetchAuthTokenService(authEndpoint) {
|
|
8852
9121
|
return fetch(authEndpoint);
|
|
8853
9122
|
}
|
|
9123
|
+
/**
|
|
9124
|
+
*
|
|
9125
|
+
* @param thoughtSpotHost
|
|
9126
|
+
* @param username
|
|
9127
|
+
* @param authToken
|
|
9128
|
+
*/
|
|
8854
9129
|
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
8855
9130
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
8856
9131
|
credentials: 'include',
|
|
8857
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9132
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9133
|
+
// error
|
|
8858
9134
|
redirect: 'manual',
|
|
8859
9135
|
});
|
|
8860
9136
|
}
|
|
9137
|
+
/**
|
|
9138
|
+
*
|
|
9139
|
+
* @param thoughtSpotHost
|
|
9140
|
+
* @param username
|
|
9141
|
+
* @param authToken
|
|
9142
|
+
*/
|
|
8861
9143
|
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
8862
9144
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
8863
9145
|
method: 'POST',
|
|
@@ -8867,10 +9149,17 @@ async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
|
8867
9149
|
},
|
|
8868
9150
|
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
8869
9151
|
credentials: 'include',
|
|
8870
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9152
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9153
|
+
// error
|
|
8871
9154
|
redirect: 'manual',
|
|
8872
9155
|
});
|
|
8873
9156
|
}
|
|
9157
|
+
/**
|
|
9158
|
+
*
|
|
9159
|
+
* @param thoughtSpotHost
|
|
9160
|
+
* @param username
|
|
9161
|
+
* @param password
|
|
9162
|
+
*/
|
|
8874
9163
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
8875
9164
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
8876
9165
|
method: 'POST',
|
|
@@ -8882,6 +9171,10 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
|
8882
9171
|
credentials: 'include',
|
|
8883
9172
|
});
|
|
8884
9173
|
}
|
|
9174
|
+
/**
|
|
9175
|
+
*
|
|
9176
|
+
* @param thoughtSpotHost
|
|
9177
|
+
*/
|
|
8885
9178
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
8886
9179
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
8887
9180
|
credentials: 'include',
|
|
@@ -8913,6 +9206,12 @@ const EndPoints = {
|
|
|
8913
9206
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8914
9207
|
LOGOUT: '/callosum/v1/session/logout',
|
|
8915
9208
|
};
|
|
9209
|
+
/**
|
|
9210
|
+
* Enum for auth failure types. This is the parameter passed to the listner
|
|
9211
|
+
* of {@link AuthStatus.FAILURE}.
|
|
9212
|
+
*
|
|
9213
|
+
* @group Authentication / Init
|
|
9214
|
+
*/
|
|
8916
9215
|
var AuthFailureType;
|
|
8917
9216
|
(function (AuthFailureType) {
|
|
8918
9217
|
AuthFailureType["SDK"] = "SDK";
|
|
@@ -8920,6 +9219,11 @@ var AuthFailureType;
|
|
|
8920
9219
|
AuthFailureType["EXPIRY"] = "EXPIRY";
|
|
8921
9220
|
AuthFailureType["OTHER"] = "OTHER";
|
|
8922
9221
|
})(AuthFailureType || (AuthFailureType = {}));
|
|
9222
|
+
/**
|
|
9223
|
+
* Enum for auth status emitted by the emitter returned from {@link init}.
|
|
9224
|
+
*
|
|
9225
|
+
* @group Authentication / Init
|
|
9226
|
+
*/
|
|
8923
9227
|
var AuthStatus;
|
|
8924
9228
|
(function (AuthStatus) {
|
|
8925
9229
|
/**
|
|
@@ -8942,21 +9246,35 @@ var AuthStatus;
|
|
|
8942
9246
|
* Emitted when inPopup: true in the SAMLRedirect flow.
|
|
8943
9247
|
* And, we are waiting for popup to be triggered either programatically
|
|
8944
9248
|
* or by the trigger button.
|
|
9249
|
+
*
|
|
8945
9250
|
* @version SDK: 1.19.0
|
|
8946
9251
|
*/
|
|
8947
9252
|
AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
|
|
8948
9253
|
})(AuthStatus || (AuthStatus = {}));
|
|
9254
|
+
/**
|
|
9255
|
+
* Events which can be triggered on the emitter returned from {@link init}.
|
|
9256
|
+
*
|
|
9257
|
+
* @group Authentication / Init
|
|
9258
|
+
*/
|
|
8949
9259
|
var AuthEvent;
|
|
8950
9260
|
(function (AuthEvent) {
|
|
8951
9261
|
/**
|
|
8952
|
-
* Manually trigger the SSO popup.
|
|
9262
|
+
* Manually trigger the SSO popup. This is useful with
|
|
9263
|
+
* authStatus: SAMLRedirect/OIDCRedicre and inPopup: true
|
|
8953
9264
|
*/
|
|
8954
9265
|
AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
|
|
8955
9266
|
})(AuthEvent || (AuthEvent = {}));
|
|
8956
9267
|
let authEE;
|
|
9268
|
+
/**
|
|
9269
|
+
*
|
|
9270
|
+
* @param eventEmitter
|
|
9271
|
+
*/
|
|
8957
9272
|
function setAuthEE(eventEmitter) {
|
|
8958
9273
|
authEE = eventEmitter;
|
|
8959
9274
|
}
|
|
9275
|
+
/**
|
|
9276
|
+
*
|
|
9277
|
+
*/
|
|
8960
9278
|
function notifyAuthSDKSuccess() {
|
|
8961
9279
|
if (!authEE) {
|
|
8962
9280
|
console.error('SDK not initialized');
|
|
@@ -8964,6 +9282,9 @@ function notifyAuthSDKSuccess() {
|
|
|
8964
9282
|
}
|
|
8965
9283
|
authEE.emit(AuthStatus.SDK_SUCCESS);
|
|
8966
9284
|
}
|
|
9285
|
+
/**
|
|
9286
|
+
*
|
|
9287
|
+
*/
|
|
8967
9288
|
function notifyAuthSuccess() {
|
|
8968
9289
|
if (!authEE) {
|
|
8969
9290
|
console.error('SDK not initialized');
|
|
@@ -8971,6 +9292,10 @@ function notifyAuthSuccess() {
|
|
|
8971
9292
|
}
|
|
8972
9293
|
authEE.emit(AuthStatus.SUCCESS, sessionInfo);
|
|
8973
9294
|
}
|
|
9295
|
+
/**
|
|
9296
|
+
*
|
|
9297
|
+
* @param failureType
|
|
9298
|
+
*/
|
|
8974
9299
|
function notifyAuthFailure(failureType) {
|
|
8975
9300
|
if (!authEE) {
|
|
8976
9301
|
console.error('SDK not initialized');
|
|
@@ -8978,6 +9303,9 @@ function notifyAuthFailure(failureType) {
|
|
|
8978
9303
|
}
|
|
8979
9304
|
authEE.emit(AuthStatus.FAILURE, failureType);
|
|
8980
9305
|
}
|
|
9306
|
+
/**
|
|
9307
|
+
*
|
|
9308
|
+
*/
|
|
8981
9309
|
function notifyLogout() {
|
|
8982
9310
|
if (!authEE) {
|
|
8983
9311
|
console.error('SDK not initialized');
|
|
@@ -8987,6 +9315,7 @@ function notifyLogout() {
|
|
|
8987
9315
|
}
|
|
8988
9316
|
/**
|
|
8989
9317
|
* Check if we are logged into the ThoughtSpot cluster
|
|
9318
|
+
*
|
|
8990
9319
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
8991
9320
|
*/
|
|
8992
9321
|
async function isLoggedIn(thoughtSpotHost) {
|
|
@@ -9009,20 +9338,30 @@ function getReleaseVersion() {
|
|
|
9009
9338
|
return releaseVersion;
|
|
9010
9339
|
}
|
|
9011
9340
|
/**
|
|
9012
|
-
* Return a promise that resolves with the session
|
|
9013
|
-
* successful. And info is available.
|
|
9341
|
+
* Return a promise that resolves with the session information when
|
|
9342
|
+
* authentication is successful. And info is available.
|
|
9343
|
+
*
|
|
9344
|
+
* @group Global methods
|
|
9014
9345
|
*/
|
|
9015
9346
|
function getSessionInfo() {
|
|
9016
9347
|
return sessionInfoPromise;
|
|
9017
9348
|
}
|
|
9349
|
+
/**
|
|
9350
|
+
*
|
|
9351
|
+
* @param sessionDetails
|
|
9352
|
+
*/
|
|
9018
9353
|
function initSession(sessionDetails) {
|
|
9019
9354
|
sessionInfo = sessionDetails;
|
|
9020
9355
|
initMixpanel(sessionInfo);
|
|
9021
9356
|
sessionInfoResolver(sessionInfo);
|
|
9022
9357
|
}
|
|
9023
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
9024
|
-
'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
9358
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
9359
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
9025
9360
|
let prevAuthToken = null;
|
|
9361
|
+
/**
|
|
9362
|
+
*
|
|
9363
|
+
* @param authtoken
|
|
9364
|
+
*/
|
|
9026
9365
|
function alertForDuplicateToken(authtoken) {
|
|
9027
9366
|
if (prevAuthToken === authtoken) {
|
|
9028
9367
|
// eslint-disable-next-line no-alert
|
|
@@ -9042,9 +9381,10 @@ function isAtSSORedirectUrl() {
|
|
|
9042
9381
|
*/
|
|
9043
9382
|
function removeSSORedirectUrlMarker() {
|
|
9044
9383
|
// Note (sunny): This will leave a # around even if it was not in the URL
|
|
9045
|
-
// to begin with. Trying to remove the hash by changing window.location will
|
|
9046
|
-
// the page which we don't want. We'll live with adding an
|
|
9047
|
-
// parent page URL until we find any use case where
|
|
9384
|
+
// to begin with. Trying to remove the hash by changing window.location will
|
|
9385
|
+
// reload the page which we don't want. We'll live with adding an
|
|
9386
|
+
// unnecessary hash to the parent page URL until we find any use case where
|
|
9387
|
+
// that creates an issue.
|
|
9048
9388
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
9049
9389
|
}
|
|
9050
9390
|
const getAuthenticaionToken = async (embedConfig) => {
|
|
@@ -9062,6 +9402,7 @@ const getAuthenticaionToken = async (embedConfig) => {
|
|
|
9062
9402
|
};
|
|
9063
9403
|
/**
|
|
9064
9404
|
* Perform token based authentication
|
|
9405
|
+
*
|
|
9065
9406
|
* @param embedConfig The embed configuration
|
|
9066
9407
|
*/
|
|
9067
9408
|
const doTokenAuth = async (embedConfig) => {
|
|
@@ -9082,8 +9423,8 @@ const doTokenAuth = async (embedConfig) => {
|
|
|
9082
9423
|
// token login issues a 302 when successful
|
|
9083
9424
|
loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
|
|
9084
9425
|
if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
|
|
9085
|
-
// When 3rd party cookie access is blocked, this will fail because
|
|
9086
|
-
// not be sent with the call.
|
|
9426
|
+
// When 3rd party cookie access is blocked, this will fail because
|
|
9427
|
+
// cookies will not be sent with the call.
|
|
9087
9428
|
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
9088
9429
|
}
|
|
9089
9430
|
}
|
|
@@ -9091,6 +9432,7 @@ const doTokenAuth = async (embedConfig) => {
|
|
|
9091
9432
|
};
|
|
9092
9433
|
/**
|
|
9093
9434
|
* Validate embedConfig parameters required for cookielessTokenAuth
|
|
9435
|
+
*
|
|
9094
9436
|
* @param embedConfig The embed configuration
|
|
9095
9437
|
*/
|
|
9096
9438
|
const doCookielessTokenAuth = async (embedConfig) => {
|
|
@@ -9106,6 +9448,7 @@ const doCookielessTokenAuth = async (embedConfig) => {
|
|
|
9106
9448
|
*
|
|
9107
9449
|
* Warning: This feature is primarily intended for developer testing. It is
|
|
9108
9450
|
* strongly advised not to use this authentication method in production.
|
|
9451
|
+
*
|
|
9109
9452
|
* @param embedConfig The embed configuration
|
|
9110
9453
|
*/
|
|
9111
9454
|
const doBasicAuth = async (embedConfig) => {
|
|
@@ -9123,6 +9466,12 @@ const doBasicAuth = async (embedConfig) => {
|
|
|
9123
9466
|
}
|
|
9124
9467
|
return loggedInStatus;
|
|
9125
9468
|
};
|
|
9469
|
+
/**
|
|
9470
|
+
*
|
|
9471
|
+
* @param ssoURL
|
|
9472
|
+
* @param triggerContainer
|
|
9473
|
+
* @param triggerText
|
|
9474
|
+
*/
|
|
9126
9475
|
async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
9127
9476
|
const openPopup = () => {
|
|
9128
9477
|
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
@@ -9135,28 +9484,28 @@ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
|
9135
9484
|
authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
|
|
9136
9485
|
const containerEl = getDOMNode(triggerContainer);
|
|
9137
9486
|
if (containerEl) {
|
|
9138
|
-
containerEl.innerHTML =
|
|
9139
|
-
'<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9487
|
+
containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9140
9488
|
const authElem = document.getElementById('ts-auth-btn');
|
|
9141
9489
|
authElem.textContent = triggerText;
|
|
9142
9490
|
authElem.addEventListener('click', openPopup, { once: true });
|
|
9143
9491
|
}
|
|
9144
|
-
samlCompletionPromise =
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
}
|
|
9152
|
-
});
|
|
9492
|
+
samlCompletionPromise = samlCompletionPromise
|
|
9493
|
+
|| new Promise((resolve, reject) => {
|
|
9494
|
+
window.addEventListener('message', (e) => {
|
|
9495
|
+
if (e.data.type === EmbedEvent.SAMLComplete) {
|
|
9496
|
+
e.source.close();
|
|
9497
|
+
resolve();
|
|
9498
|
+
}
|
|
9153
9499
|
});
|
|
9500
|
+
});
|
|
9154
9501
|
authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
|
|
9155
9502
|
return samlCompletionPromise;
|
|
9156
9503
|
}
|
|
9157
9504
|
/**
|
|
9158
9505
|
* Perform SAML authentication
|
|
9506
|
+
*
|
|
9159
9507
|
* @param embedConfig The embed configuration
|
|
9508
|
+
* @param ssoEndPoint
|
|
9160
9509
|
*/
|
|
9161
9510
|
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
9162
9511
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -9185,8 +9534,8 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
|
9185
9534
|
};
|
|
9186
9535
|
const doSamlAuth = async (embedConfig) => {
|
|
9187
9536
|
const { thoughtSpotHost } = embedConfig;
|
|
9188
|
-
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9189
|
-
// again and the same JS will execute again.
|
|
9537
|
+
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9538
|
+
// loaded again and the same JS will execute again.
|
|
9190
9539
|
const ssoRedirectUrl = embedConfig.inPopup
|
|
9191
9540
|
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
9192
9541
|
: getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
|
|
@@ -9197,8 +9546,8 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
9197
9546
|
};
|
|
9198
9547
|
const doOIDCAuth = async (embedConfig) => {
|
|
9199
9548
|
const { thoughtSpotHost } = embedConfig;
|
|
9200
|
-
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9201
|
-
// again and the same JS will execute again.
|
|
9549
|
+
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9550
|
+
// loaded again and the same JS will execute again.
|
|
9202
9551
|
const ssoRedirectUrl = embedConfig.noRedirect || embedConfig.inPopup
|
|
9203
9552
|
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
9204
9553
|
: getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
|
|
@@ -9215,6 +9564,7 @@ const logout = async (embedConfig) => {
|
|
|
9215
9564
|
};
|
|
9216
9565
|
/**
|
|
9217
9566
|
* Perform authentication on the ThoughtSpot cluster
|
|
9567
|
+
*
|
|
9218
9568
|
* @param embedConfig The embed configuration
|
|
9219
9569
|
*/
|
|
9220
9570
|
const authenticate = async (embedConfig) => {
|
|
@@ -9247,6 +9597,13 @@ const CONFIG_DEFAULTS = {
|
|
|
9247
9597
|
authType: AuthType.None,
|
|
9248
9598
|
};
|
|
9249
9599
|
let authPromise;
|
|
9600
|
+
/**
|
|
9601
|
+
* Gets the configuration embed was initialized with.
|
|
9602
|
+
*
|
|
9603
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
9604
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
9605
|
+
* @group Global methods
|
|
9606
|
+
*/
|
|
9250
9607
|
const getEmbedConfig = () => config;
|
|
9251
9608
|
const getAuthPromise = () => authPromise;
|
|
9252
9609
|
/**
|
|
@@ -9273,10 +9630,14 @@ const hostUrlToFeatureUrl = {
|
|
|
9273
9630
|
[PrefetchFeatures.VizEmbed]: (url) => url,
|
|
9274
9631
|
};
|
|
9275
9632
|
/**
|
|
9276
|
-
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
9633
|
+
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
9634
|
+
* prefetched resources and serve them from the user's local disk to provide faster access
|
|
9635
|
+
* to your app.
|
|
9636
|
+
*
|
|
9277
9637
|
* @param url The URL provided for prefetch
|
|
9278
9638
|
* @param prefetchFeatures Specify features which needs to be prefetched.
|
|
9279
9639
|
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
|
|
9640
|
+
* @group Global methods
|
|
9280
9641
|
*/
|
|
9281
9642
|
const prefetch = (url, prefetchFeatures) => {
|
|
9282
9643
|
if (url === '') {
|
|
@@ -9299,6 +9660,10 @@ const prefetch = (url, prefetchFeatures) => {
|
|
|
9299
9660
|
});
|
|
9300
9661
|
}
|
|
9301
9662
|
};
|
|
9663
|
+
/**
|
|
9664
|
+
*
|
|
9665
|
+
* @param embedConfig
|
|
9666
|
+
*/
|
|
9302
9667
|
function sanity(embedConfig) {
|
|
9303
9668
|
if (embedConfig.thoughtSpotHost === undefined) {
|
|
9304
9669
|
throw new Error('ThoughtSpot host not provided');
|
|
@@ -9307,16 +9672,18 @@ function sanity(embedConfig) {
|
|
|
9307
9672
|
if (!embedConfig.username) {
|
|
9308
9673
|
throw new Error('Username not provided with Trusted auth');
|
|
9309
9674
|
}
|
|
9310
|
-
if (!embedConfig.authEndpoint &&
|
|
9311
|
-
typeof embedConfig.getAuthToken !== 'function') {
|
|
9675
|
+
if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
|
|
9312
9676
|
throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
|
|
9313
9677
|
}
|
|
9314
9678
|
}
|
|
9315
9679
|
}
|
|
9680
|
+
/**
|
|
9681
|
+
*
|
|
9682
|
+
* @param embedConfig
|
|
9683
|
+
*/
|
|
9316
9684
|
function backwardCompat(embedConfig) {
|
|
9317
9685
|
const newConfig = { ...embedConfig };
|
|
9318
|
-
if (embedConfig.noRedirect !== undefined &&
|
|
9319
|
-
embedConfig.inPopup === undefined) {
|
|
9686
|
+
if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
|
|
9320
9687
|
newConfig.inPopup = embedConfig.noRedirect;
|
|
9321
9688
|
}
|
|
9322
9689
|
return newConfig;
|
|
@@ -9324,12 +9691,21 @@ function backwardCompat(embedConfig) {
|
|
|
9324
9691
|
/**
|
|
9325
9692
|
* Initializes the Visual Embed SDK globally and perform
|
|
9326
9693
|
* authentication if applicable.
|
|
9694
|
+
*
|
|
9327
9695
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
9328
9696
|
* authentication mechanism and so on.
|
|
9329
|
-
* example
|
|
9330
|
-
*
|
|
9331
|
-
*
|
|
9697
|
+
* @example
|
|
9698
|
+
* ```js
|
|
9699
|
+
* const authStatus = init({
|
|
9700
|
+
* thoughtSpotHost: 'https://my.thoughtspot.cloud',
|
|
9701
|
+
* authType: AuthType.None,
|
|
9702
|
+
* });
|
|
9703
|
+
* authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
|
|
9704
|
+
* ```
|
|
9705
|
+
* @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
|
|
9706
|
+
* failure and logout. See {@link AuthStatus}
|
|
9332
9707
|
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
9708
|
+
* @group Authentication / Init
|
|
9333
9709
|
*/
|
|
9334
9710
|
const init = (embedConfig) => {
|
|
9335
9711
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -9348,8 +9724,7 @@ const init = (embedConfig) => {
|
|
|
9348
9724
|
host: config.thoughtSpotHost,
|
|
9349
9725
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
9350
9726
|
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,
|
|
9351
|
-
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) !=
|
|
9352
|
-
null,
|
|
9727
|
+
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,
|
|
9353
9728
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
9354
9729
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
9355
9730
|
});
|
|
@@ -9358,19 +9733,23 @@ const init = (embedConfig) => {
|
|
|
9358
9733
|
}
|
|
9359
9734
|
return authEE;
|
|
9360
9735
|
};
|
|
9736
|
+
/**
|
|
9737
|
+
*
|
|
9738
|
+
*/
|
|
9361
9739
|
function disableAutoLogin() {
|
|
9362
9740
|
config.autoLogin = false;
|
|
9363
9741
|
}
|
|
9364
9742
|
/**
|
|
9365
|
-
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
9366
|
-
* the SDK from automatically logging in again.
|
|
9743
|
+
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
9744
|
+
* prevent the SDK from automatically logging in again.
|
|
9367
9745
|
*
|
|
9368
|
-
* You can call the `init` method again to re login, if autoLogin is set to
|
|
9369
|
-
* second call it will be honored.
|
|
9746
|
+
* You can call the `init` method again to re login, if autoLogin is set to
|
|
9747
|
+
* true in this second call it will be honored.
|
|
9370
9748
|
*
|
|
9371
9749
|
* @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
|
|
9372
9750
|
* @returns Promise which resolves when logout completes.
|
|
9373
9751
|
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
9752
|
+
* @group Global methods
|
|
9374
9753
|
*/
|
|
9375
9754
|
const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
9376
9755
|
if (!doNotDisableAutoLogin) {
|
|
@@ -9383,7 +9762,9 @@ const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
|
9383
9762
|
};
|
|
9384
9763
|
let renderQueue = Promise.resolve();
|
|
9385
9764
|
/**
|
|
9386
|
-
* Renders functions in a queue, resolves to next function only after the callback next
|
|
9765
|
+
* Renders functions in a queue, resolves to next function only after the callback next
|
|
9766
|
+
* is called
|
|
9767
|
+
*
|
|
9387
9768
|
* @param fn The function being registered
|
|
9388
9769
|
*/
|
|
9389
9770
|
const renderInQueue = (fn) => {
|
|
@@ -9396,6 +9777,13 @@ const renderInQueue = (fn) => {
|
|
|
9396
9777
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
9397
9778
|
};
|
|
9398
9779
|
|
|
9780
|
+
/**
|
|
9781
|
+
*
|
|
9782
|
+
* @param session
|
|
9783
|
+
* @param query
|
|
9784
|
+
* @param operation
|
|
9785
|
+
* @param thoughtSpotHost
|
|
9786
|
+
*/
|
|
9399
9787
|
function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
9400
9788
|
let variable;
|
|
9401
9789
|
const fetchQuery = async (variables) => {
|
|
@@ -9445,12 +9833,14 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
|
9445
9833
|
};
|
|
9446
9834
|
}
|
|
9447
9835
|
|
|
9836
|
+
/**
|
|
9837
|
+
*
|
|
9838
|
+
* @param e
|
|
9839
|
+
* @param thoughtSpotHost
|
|
9840
|
+
*/
|
|
9448
9841
|
function processCustomAction(e, thoughtSpotHost) {
|
|
9449
9842
|
var _a;
|
|
9450
|
-
if ([
|
|
9451
|
-
OperationType.GetChartWithData,
|
|
9452
|
-
OperationType.GetTableWithHeadlineData,
|
|
9453
|
-
].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
|
|
9843
|
+
if ([OperationType.GetChartWithData, OperationType.GetTableWithHeadlineData].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
|
|
9454
9844
|
const { session, query, operation } = e.data;
|
|
9455
9845
|
const answerService = getAnswerServiceInstance(session, query, operation, thoughtSpotHost);
|
|
9456
9846
|
return {
|
|
@@ -9460,6 +9850,10 @@ function processCustomAction(e, thoughtSpotHost) {
|
|
|
9460
9850
|
}
|
|
9461
9851
|
return e;
|
|
9462
9852
|
}
|
|
9853
|
+
/**
|
|
9854
|
+
*
|
|
9855
|
+
* @param e
|
|
9856
|
+
*/
|
|
9463
9857
|
function processAuthInit(e) {
|
|
9464
9858
|
var _a, _b;
|
|
9465
9859
|
// Store user session details sent by app.
|
|
@@ -9473,8 +9867,13 @@ function processAuthInit(e) {
|
|
|
9473
9867
|
},
|
|
9474
9868
|
};
|
|
9475
9869
|
}
|
|
9870
|
+
/**
|
|
9871
|
+
*
|
|
9872
|
+
* @param e
|
|
9873
|
+
* @param containerEl
|
|
9874
|
+
*/
|
|
9476
9875
|
function processNoCookieAccess(e, containerEl) {
|
|
9477
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert
|
|
9876
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert } = getEmbedConfig();
|
|
9478
9877
|
if (!suppressNoCookieAccessAlert) {
|
|
9479
9878
|
// eslint-disable-next-line no-alert
|
|
9480
9879
|
alert('Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.');
|
|
@@ -9484,6 +9883,11 @@ function processNoCookieAccess(e, containerEl) {
|
|
|
9484
9883
|
notifyAuthFailure(AuthFailureType.NO_COOKIE_ACCESS);
|
|
9485
9884
|
return e;
|
|
9486
9885
|
}
|
|
9886
|
+
/**
|
|
9887
|
+
*
|
|
9888
|
+
* @param e
|
|
9889
|
+
* @param containerEl
|
|
9890
|
+
*/
|
|
9487
9891
|
function processAuthFailure(e, containerEl) {
|
|
9488
9892
|
const { loginFailedMessage, authType } = getEmbedConfig();
|
|
9489
9893
|
if (authType !== AuthType.None) {
|
|
@@ -9493,6 +9897,11 @@ function processAuthFailure(e, containerEl) {
|
|
|
9493
9897
|
}
|
|
9494
9898
|
return e;
|
|
9495
9899
|
}
|
|
9900
|
+
/**
|
|
9901
|
+
*
|
|
9902
|
+
* @param e
|
|
9903
|
+
* @param containerEl
|
|
9904
|
+
*/
|
|
9496
9905
|
function processAuthLogout(e, containerEl) {
|
|
9497
9906
|
const { loginFailedMessage } = getEmbedConfig();
|
|
9498
9907
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -9501,6 +9910,13 @@ function processAuthLogout(e, containerEl) {
|
|
|
9501
9910
|
notifyLogout();
|
|
9502
9911
|
return e;
|
|
9503
9912
|
}
|
|
9913
|
+
/**
|
|
9914
|
+
*
|
|
9915
|
+
* @param type
|
|
9916
|
+
* @param e
|
|
9917
|
+
* @param thoughtSpotHost
|
|
9918
|
+
* @param containerEl
|
|
9919
|
+
*/
|
|
9504
9920
|
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
9505
9921
|
switch (type) {
|
|
9506
9922
|
case EmbedEvent.CustomAction:
|
|
@@ -9519,6 +9935,8 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
9519
9935
|
|
|
9520
9936
|
/**
|
|
9521
9937
|
* Reloads the ThoughtSpot iframe.
|
|
9938
|
+
*
|
|
9939
|
+
* @param iFrame
|
|
9522
9940
|
*/
|
|
9523
9941
|
function reload(iFrame) {
|
|
9524
9942
|
const oldFrame = iFrame.cloneNode();
|
|
@@ -9528,13 +9946,25 @@ function reload(iFrame) {
|
|
|
9528
9946
|
}
|
|
9529
9947
|
/**
|
|
9530
9948
|
* Post Iframe message.
|
|
9949
|
+
*
|
|
9950
|
+
* @param iFrame
|
|
9951
|
+
* @param message
|
|
9952
|
+
* @param message.type
|
|
9953
|
+
* @param message.data
|
|
9954
|
+
* @param thoughtSpotHost
|
|
9955
|
+
* @param channel
|
|
9531
9956
|
*/
|
|
9532
9957
|
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
9533
|
-
return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [
|
|
9534
|
-
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
9535
|
-
]);
|
|
9958
|
+
return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
|
|
9536
9959
|
}
|
|
9537
9960
|
const TRIGGER_TIMEOUT = 30000;
|
|
9961
|
+
/**
|
|
9962
|
+
*
|
|
9963
|
+
* @param iFrame
|
|
9964
|
+
* @param messageType
|
|
9965
|
+
* @param thoughtSpotHost
|
|
9966
|
+
* @param data
|
|
9967
|
+
*/
|
|
9538
9968
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
9539
9969
|
return new Promise((res, rej) => {
|
|
9540
9970
|
if (messageType === HostEvent.Reload) {
|
|
@@ -9560,7 +9990,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
9560
9990
|
});
|
|
9561
9991
|
}
|
|
9562
9992
|
|
|
9563
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.20.0-
|
|
9993
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.20.0-prerender.0";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/**"];var exports={".":"./lib/src/index.js","./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.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":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",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",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","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","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","@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","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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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,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};
|
|
9564
9994
|
|
|
9565
9995
|
/**
|
|
9566
9996
|
* Copyright (c) 2022
|
|
@@ -9580,6 +10010,7 @@ const TS_EMBED_ID = '_thoughtspot-embed';
|
|
|
9580
10010
|
* The event id map from v2 event names to v1 event id
|
|
9581
10011
|
* v1 events are the classic embed events implemented in Blink v1
|
|
9582
10012
|
* We cannot rename v1 event types to maintain backward compatibility
|
|
10013
|
+
*
|
|
9583
10014
|
* @internal
|
|
9584
10015
|
*/
|
|
9585
10016
|
const V1EventMap = {};
|
|
@@ -9590,22 +10021,28 @@ const V1EventMap = {};
|
|
|
9590
10021
|
*/
|
|
9591
10022
|
class TsEmbed {
|
|
9592
10023
|
constructor(domSelector, viewConfig) {
|
|
10024
|
+
this.isAppInitialized = false;
|
|
9593
10025
|
/**
|
|
9594
10026
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
9595
10027
|
* will generate for embedding. This provides additional security to
|
|
9596
10028
|
* thoughtspot clusters against Cross site scripting attacks.
|
|
10029
|
+
*
|
|
9597
10030
|
* @default false
|
|
9598
10031
|
*/
|
|
9599
10032
|
this.shouldEncodeUrlQueryParams = false;
|
|
9600
10033
|
this.defaultHiddenActions = [Action.ReportError];
|
|
9601
10034
|
/**
|
|
9602
10035
|
* Send Custom style as part of payload of APP_INIT
|
|
10036
|
+
*
|
|
10037
|
+
* @param _
|
|
10038
|
+
* @param responder
|
|
9603
10039
|
*/
|
|
9604
10040
|
this.appInitCb = async (_, responder) => {
|
|
9605
10041
|
let authToken = '';
|
|
9606
10042
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
9607
10043
|
authToken = await getAuthenticaionToken(this.embedConfig);
|
|
9608
10044
|
}
|
|
10045
|
+
this.isAppInitialized = true;
|
|
9609
10046
|
responder({
|
|
9610
10047
|
type: EmbedEvent.APP_INIT,
|
|
9611
10048
|
data: {
|
|
@@ -9616,6 +10053,9 @@ class TsEmbed {
|
|
|
9616
10053
|
};
|
|
9617
10054
|
/**
|
|
9618
10055
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
10056
|
+
*
|
|
10057
|
+
* @param _
|
|
10058
|
+
* @param responder
|
|
9619
10059
|
*/
|
|
9620
10060
|
this.updateAuthToken = async (_, responder) => {
|
|
9621
10061
|
const { autoLogin = false, authType } = this.embedConfig; // Set autoLogin default to false
|
|
@@ -9657,6 +10097,7 @@ class TsEmbed {
|
|
|
9657
10097
|
}
|
|
9658
10098
|
/**
|
|
9659
10099
|
* Handles errors within the SDK
|
|
10100
|
+
*
|
|
9660
10101
|
* @param error The error message or object
|
|
9661
10102
|
*/
|
|
9662
10103
|
handleError(error) {
|
|
@@ -9669,6 +10110,7 @@ class TsEmbed {
|
|
|
9669
10110
|
}
|
|
9670
10111
|
/**
|
|
9671
10112
|
* Extracts the type field from the event payload
|
|
10113
|
+
*
|
|
9672
10114
|
* @param event The window message event
|
|
9673
10115
|
*/
|
|
9674
10116
|
getEventType(event) {
|
|
@@ -9678,6 +10120,7 @@ class TsEmbed {
|
|
|
9678
10120
|
}
|
|
9679
10121
|
/**
|
|
9680
10122
|
* Extracts the port field from the event payload
|
|
10123
|
+
*
|
|
9681
10124
|
* @param event The window message event
|
|
9682
10125
|
* @returns
|
|
9683
10126
|
*/
|
|
@@ -9690,6 +10133,9 @@ class TsEmbed {
|
|
|
9690
10133
|
/**
|
|
9691
10134
|
* fix for ts7.sep.cl
|
|
9692
10135
|
* will be removed for ts7.oct.cl
|
|
10136
|
+
*
|
|
10137
|
+
* @param event
|
|
10138
|
+
* @param eventType
|
|
9693
10139
|
* @hidden
|
|
9694
10140
|
*/
|
|
9695
10141
|
formatEventData(event, eventType) {
|
|
@@ -9720,33 +10166,31 @@ class TsEmbed {
|
|
|
9720
10166
|
}
|
|
9721
10167
|
/**
|
|
9722
10168
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
10169
|
+
*
|
|
10170
|
+
* @param query
|
|
9723
10171
|
*/
|
|
9724
10172
|
getEmbedBasePath(query) {
|
|
9725
10173
|
let queryString = query;
|
|
9726
10174
|
if (this.shouldEncodeUrlQueryParams) {
|
|
9727
10175
|
queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString.substr(1))}`;
|
|
9728
10176
|
}
|
|
9729
|
-
const basePath = [
|
|
9730
|
-
this.thoughtSpotHost,
|
|
9731
|
-
this.thoughtSpotV2Base,
|
|
9732
|
-
queryString,
|
|
9733
|
-
]
|
|
10177
|
+
const basePath = [this.thoughtSpotHost, this.thoughtSpotV2Base, queryString]
|
|
9734
10178
|
.filter((x) => x.length > 0)
|
|
9735
10179
|
.join('/');
|
|
9736
|
-
return `${basePath}
|
|
10180
|
+
return `${basePath}#`;
|
|
9737
10181
|
}
|
|
9738
10182
|
/**
|
|
9739
10183
|
* Common query params set for all the embed modes.
|
|
10184
|
+
*
|
|
10185
|
+
* @param queryParams
|
|
9740
10186
|
* @returns queryParams
|
|
9741
10187
|
*/
|
|
9742
|
-
getBaseQueryParams() {
|
|
10188
|
+
getBaseQueryParams(queryParams = {}) {
|
|
9743
10189
|
var _a, _b;
|
|
9744
|
-
const queryParams = {};
|
|
9745
10190
|
let hostAppUrl = ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '';
|
|
9746
|
-
// The below check is needed because TS Cloud firewall, blocks
|
|
9747
|
-
// in any url param.
|
|
9748
|
-
if (hostAppUrl.includes('localhost') ||
|
|
9749
|
-
hostAppUrl.includes('127.0.0.1')) {
|
|
10191
|
+
// The below check is needed because TS Cloud firewall, blocks
|
|
10192
|
+
// localhost/127.0.0.1 in any url param.
|
|
10193
|
+
if (hostAppUrl.includes('localhost') || hostAppUrl.includes('127.0.0.1')) {
|
|
9750
10194
|
hostAppUrl = 'local-host';
|
|
9751
10195
|
}
|
|
9752
10196
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
@@ -9754,8 +10198,7 @@ class TsEmbed {
|
|
|
9754
10198
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9755
10199
|
queryParams[Param.Version] = version$1;
|
|
9756
10200
|
queryParams[Param.AuthType] = this.embedConfig.authType;
|
|
9757
|
-
if (this.embedConfig.disableLoginRedirect === true ||
|
|
9758
|
-
this.embedConfig.autoLogin === true) {
|
|
10201
|
+
if (this.embedConfig.disableLoginRedirect === true || this.embedConfig.autoLogin === true) {
|
|
9759
10202
|
queryParams[Param.DisableLoginRedirect] = true;
|
|
9760
10203
|
}
|
|
9761
10204
|
if (this.embedConfig.authType === AuthType.EmbeddedSSO) {
|
|
@@ -9770,8 +10213,7 @@ class TsEmbed {
|
|
|
9770
10213
|
return queryParams;
|
|
9771
10214
|
}
|
|
9772
10215
|
// TODO remove embedConfig.customCssUrl
|
|
9773
|
-
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) ||
|
|
9774
|
-
this.embedConfig.customCssUrl;
|
|
10216
|
+
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) || this.embedConfig.customCssUrl;
|
|
9775
10217
|
if (cssUrlParam) {
|
|
9776
10218
|
queryParams[Param.CustomCSSUrl] = cssUrlParam;
|
|
9777
10219
|
}
|
|
@@ -9781,15 +10223,14 @@ class TsEmbed {
|
|
|
9781
10223
|
if (disabledActionReason) {
|
|
9782
10224
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
9783
10225
|
}
|
|
9784
|
-
queryParams[Param.HideActions] = [
|
|
9785
|
-
...this.defaultHiddenActions,
|
|
9786
|
-
...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
|
|
9787
|
-
];
|
|
10226
|
+
queryParams[Param.HideActions] = [...this.defaultHiddenActions, ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : [])];
|
|
9788
10227
|
if (Array.isArray(visibleActions)) {
|
|
9789
10228
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
9790
10229
|
}
|
|
9791
|
-
/**
|
|
9792
|
-
*
|
|
10230
|
+
/**
|
|
10231
|
+
* Default behavior for context menu will be left-click
|
|
10232
|
+
* from version 9.2.0.cl the user have an option to override context
|
|
10233
|
+
* menu click
|
|
9793
10234
|
*/
|
|
9794
10235
|
if (contextMenuTrigger === ContextMenuTriggerOptions.LEFT_CLICK) {
|
|
9795
10236
|
queryParams[Param.ContextMenuTrigger] = true;
|
|
@@ -9821,32 +10262,61 @@ class TsEmbed {
|
|
|
9821
10262
|
/**
|
|
9822
10263
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
9823
10264
|
* This is used for embedding Liveboards, visualizations, and full application.
|
|
10265
|
+
*
|
|
9824
10266
|
* @param queryString The query string to append to the URL.
|
|
9825
10267
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
9826
10268
|
* the full application.
|
|
9827
10269
|
*/
|
|
9828
|
-
getV1EmbedBasePath(queryString
|
|
9829
|
-
const
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
const
|
|
9833
|
-
let queryParams = `?embedApp=true${isAppEmbed ? primaryNavParam : ''}${isAppEmbed ? disableProfileAndHelpParam : ''}${enableSearchAssist ? enableSearchAssistParam : ''}${queryStringFrag}`;
|
|
9834
|
-
if (this.shouldEncodeUrlQueryParams) {
|
|
9835
|
-
queryParams = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryParams.substr(1))}`;
|
|
9836
|
-
}
|
|
9837
|
-
let path = `${this.thoughtSpotHost}/${queryParams}#`;
|
|
9838
|
-
if (!isAppEmbed) {
|
|
9839
|
-
path = `${path}/embed`;
|
|
9840
|
-
}
|
|
10270
|
+
getV1EmbedBasePath(queryString) {
|
|
10271
|
+
const queryParams = this.shouldEncodeUrlQueryParams
|
|
10272
|
+
? `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString)}`
|
|
10273
|
+
: `?${queryString}`;
|
|
10274
|
+
const path = `${this.thoughtSpotHost}/${queryParams}#`;
|
|
9841
10275
|
return path;
|
|
9842
10276
|
}
|
|
10277
|
+
getEmbedParams() {
|
|
10278
|
+
const queryParams = this.getBaseQueryParams();
|
|
10279
|
+
return getQueryParamString(queryParams);
|
|
10280
|
+
}
|
|
10281
|
+
getRootIframeSrc() {
|
|
10282
|
+
const query = this.getEmbedParams();
|
|
10283
|
+
return this.getEmbedBasePath(query);
|
|
10284
|
+
}
|
|
10285
|
+
createIframeEl(frameSrc) {
|
|
10286
|
+
const iFrame = document.createElement('iframe');
|
|
10287
|
+
iFrame.src = frameSrc;
|
|
10288
|
+
iFrame.id = TS_EMBED_ID;
|
|
10289
|
+
// according to screenfull.js documentation
|
|
10290
|
+
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be
|
|
10291
|
+
// true
|
|
10292
|
+
iFrame.allowFullscreen = true;
|
|
10293
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10294
|
+
// @ts-ignore
|
|
10295
|
+
iFrame.webkitallowfullscreen = true;
|
|
10296
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10297
|
+
// @ts-ignore
|
|
10298
|
+
iFrame.mozallowfullscreen = true;
|
|
10299
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10300
|
+
// @ts-ignore
|
|
10301
|
+
iFrame.allow = 'clipboard-read; clipboard-write';
|
|
10302
|
+
const { height: frameHeight, width: frameWidth, ...restParams } = this.viewConfig.frameParams || {};
|
|
10303
|
+
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
10304
|
+
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
10305
|
+
setAttributes(iFrame, restParams);
|
|
10306
|
+
iFrame.style.width = `${width}`;
|
|
10307
|
+
iFrame.style.height = `${height}`;
|
|
10308
|
+
iFrame.style.border = '0';
|
|
10309
|
+
iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
10310
|
+
return iFrame;
|
|
10311
|
+
}
|
|
9843
10312
|
/**
|
|
9844
10313
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
9845
10314
|
* event listeners.
|
|
10315
|
+
*
|
|
9846
10316
|
* @param url
|
|
9847
10317
|
* @param frameOptions
|
|
9848
10318
|
*/
|
|
9849
|
-
async renderIFrame(url
|
|
10319
|
+
async renderIFrame(url) {
|
|
9850
10320
|
if (this.isError) {
|
|
9851
10321
|
return null;
|
|
9852
10322
|
}
|
|
@@ -9870,30 +10340,7 @@ class TsEmbed {
|
|
|
9870
10340
|
return;
|
|
9871
10341
|
}
|
|
9872
10342
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
9873
|
-
this.iFrame =
|
|
9874
|
-
this.iFrame || document.createElement('iframe');
|
|
9875
|
-
this.iFrame.src = url;
|
|
9876
|
-
this.iFrame.id = TS_EMBED_ID;
|
|
9877
|
-
// according to screenfull.js documentation
|
|
9878
|
-
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be true
|
|
9879
|
-
this.iFrame.allowFullscreen = true;
|
|
9880
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9881
|
-
// @ts-ignore
|
|
9882
|
-
this.iFrame.webkitallowfullscreen = true;
|
|
9883
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9884
|
-
// @ts-ignore
|
|
9885
|
-
this.iFrame.mozallowfullscreen = true;
|
|
9886
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9887
|
-
// @ts-ignore
|
|
9888
|
-
this.iFrame.allow = 'clipboard-read; clipboard-write';
|
|
9889
|
-
const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
|
|
9890
|
-
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
9891
|
-
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
9892
|
-
setAttributes(this.iFrame, restParams);
|
|
9893
|
-
this.iFrame.style.width = `${width}`;
|
|
9894
|
-
this.iFrame.style.height = `${height}`;
|
|
9895
|
-
this.iFrame.style.border = '0';
|
|
9896
|
-
this.iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
10343
|
+
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
9897
10344
|
this.iFrame.addEventListener('load', () => {
|
|
9898
10345
|
nextInQueue();
|
|
9899
10346
|
const loadTimestamp = Date.now();
|
|
@@ -9920,7 +10367,9 @@ class TsEmbed {
|
|
|
9920
10367
|
this.subscribeToEvents();
|
|
9921
10368
|
}).catch((error) => {
|
|
9922
10369
|
nextInQueue();
|
|
9923
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
10370
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
10371
|
+
error: JSON.stringify(error),
|
|
10372
|
+
});
|
|
9924
10373
|
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9925
10374
|
this.handleError(error);
|
|
9926
10375
|
});
|
|
@@ -9954,6 +10403,7 @@ class TsEmbed {
|
|
|
9954
10403
|
}
|
|
9955
10404
|
/**
|
|
9956
10405
|
* Sets the height of the iframe
|
|
10406
|
+
*
|
|
9957
10407
|
* @param height The height in pixels
|
|
9958
10408
|
*/
|
|
9959
10409
|
setIFrameHeight(height) {
|
|
@@ -9961,6 +10411,7 @@ class TsEmbed {
|
|
|
9961
10411
|
}
|
|
9962
10412
|
/**
|
|
9963
10413
|
* Executes all registered event handlers for a particular event type
|
|
10414
|
+
*
|
|
9964
10415
|
* @param eventType The event type
|
|
9965
10416
|
* @param data The payload invoked with the event handler
|
|
9966
10417
|
* @param eventPort The event Port for a specific MessageChannel
|
|
@@ -9971,11 +10422,13 @@ class TsEmbed {
|
|
|
9971
10422
|
callbacks.push(...allHandlers);
|
|
9972
10423
|
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9973
10424
|
callbacks.forEach((callbackObj) => {
|
|
9974
|
-
if (
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
10425
|
+
if (
|
|
10426
|
+
// When start status is true it trigger only start releated
|
|
10427
|
+
// payload
|
|
10428
|
+
(callbackObj.options.start && dataStatus === embedEventStatus.START)
|
|
10429
|
+
// When start status is false it trigger only end releated
|
|
10430
|
+
// payload
|
|
10431
|
+
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
9979
10432
|
callbackObj.callback(data, (payload) => {
|
|
9980
10433
|
this.triggerEventOnPort(eventPort, payload);
|
|
9981
10434
|
});
|
|
@@ -9990,6 +10443,7 @@ class TsEmbed {
|
|
|
9990
10443
|
}
|
|
9991
10444
|
/**
|
|
9992
10445
|
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
10446
|
+
*
|
|
9993
10447
|
* @param eventType The v2 event type
|
|
9994
10448
|
* @returns The corresponding v1 event type if one exists
|
|
9995
10449
|
* or else the v2 event type itself
|
|
@@ -10001,6 +10455,7 @@ class TsEmbed {
|
|
|
10001
10455
|
* Calculates the iframe center for the current visible viewPort
|
|
10002
10456
|
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
10003
10457
|
* in Host app. ViewPort height of the tab.
|
|
10458
|
+
*
|
|
10004
10459
|
* @returns iframe Center in visible viewport,
|
|
10005
10460
|
* Iframe height,
|
|
10006
10461
|
* View port height.
|
|
@@ -10014,8 +10469,7 @@ class TsEmbed {
|
|
|
10014
10469
|
let iframeVisibleViewPort;
|
|
10015
10470
|
let iframeOffset;
|
|
10016
10471
|
if (iframeScrolled < 0) {
|
|
10017
|
-
iframeVisibleViewPort =
|
|
10018
|
-
viewPortHeight - (offsetTopClient - scrollTopClient);
|
|
10472
|
+
iframeVisibleViewPort = viewPortHeight - (offsetTopClient - scrollTopClient);
|
|
10019
10473
|
iframeVisibleViewPort = Math.min(iframeHeight, iframeVisibleViewPort);
|
|
10020
10474
|
iframeOffset = 0;
|
|
10021
10475
|
}
|
|
@@ -10039,6 +10493,20 @@ class TsEmbed {
|
|
|
10039
10493
|
* @param messageType The message type
|
|
10040
10494
|
* @param callback A callback as a function
|
|
10041
10495
|
* @param options The message options
|
|
10496
|
+
* @example
|
|
10497
|
+
* ```js
|
|
10498
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
10499
|
+
* console.error(data);
|
|
10500
|
+
* });
|
|
10501
|
+
* ```
|
|
10502
|
+
* @example
|
|
10503
|
+
* ```js
|
|
10504
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
10505
|
+
* console.log("Answer save clicked", data);
|
|
10506
|
+
* }, {
|
|
10507
|
+
* start: true // This will trigger the callback on start of save
|
|
10508
|
+
* });
|
|
10509
|
+
* ```
|
|
10042
10510
|
*/
|
|
10043
10511
|
on(messageType, callback, options = { start: false }) {
|
|
10044
10512
|
if (this.isRendered) {
|
|
@@ -10052,8 +10520,11 @@ class TsEmbed {
|
|
|
10052
10520
|
/**
|
|
10053
10521
|
* Triggers an event on specific Port registered against
|
|
10054
10522
|
* for the EmbedEvent
|
|
10523
|
+
*
|
|
10055
10524
|
* @param eventType The message type
|
|
10056
10525
|
* @param data The payload to send
|
|
10526
|
+
* @param eventPort
|
|
10527
|
+
* @param payload
|
|
10057
10528
|
*/
|
|
10058
10529
|
triggerEventOnPort(eventPort, payload) {
|
|
10059
10530
|
if (eventPort) {
|
|
@@ -10074,6 +10545,7 @@ class TsEmbed {
|
|
|
10074
10545
|
}
|
|
10075
10546
|
/**
|
|
10076
10547
|
* Triggers an event to the embedded app
|
|
10548
|
+
*
|
|
10077
10549
|
* @param messageType The event type
|
|
10078
10550
|
* @param data The payload to send with the message
|
|
10079
10551
|
*/
|
|
@@ -10085,6 +10557,7 @@ class TsEmbed {
|
|
|
10085
10557
|
* Marks the ThoughtSpot object to have been rendered
|
|
10086
10558
|
* Needs to be overridden by subclasses to do the actual
|
|
10087
10559
|
* rendering of the iframe.
|
|
10560
|
+
*
|
|
10088
10561
|
* @param args
|
|
10089
10562
|
*/
|
|
10090
10563
|
render() {
|
|
@@ -10095,6 +10568,7 @@ class TsEmbed {
|
|
|
10095
10568
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
10096
10569
|
* host app URL.
|
|
10097
10570
|
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
10571
|
+
*
|
|
10098
10572
|
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
10099
10573
|
*/
|
|
10100
10574
|
getThoughtSpotPostUrlParams() {
|
|
@@ -10118,6 +10592,7 @@ class TsEmbed {
|
|
|
10118
10592
|
}
|
|
10119
10593
|
/**
|
|
10120
10594
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
10595
|
+
*
|
|
10121
10596
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
10122
10597
|
*/
|
|
10123
10598
|
destroy() {
|
|
@@ -10128,11 +10603,20 @@ class TsEmbed {
|
|
|
10128
10603
|
console.log('Error destroying TS Embed', e);
|
|
10129
10604
|
}
|
|
10130
10605
|
}
|
|
10606
|
+
getUnderlyingFrameElement() {
|
|
10607
|
+
return this.iFrame;
|
|
10608
|
+
}
|
|
10609
|
+
async prerenderGeneric() {
|
|
10610
|
+
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
10611
|
+
return this.renderIFrame(prerenderFrameSrc);
|
|
10612
|
+
}
|
|
10131
10613
|
}
|
|
10132
10614
|
/**
|
|
10133
10615
|
* Base class for embedding v1 experience
|
|
10134
10616
|
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
10135
10617
|
* which is currently under migration to v2
|
|
10618
|
+
*
|
|
10619
|
+
* @inheritdoc
|
|
10136
10620
|
*/
|
|
10137
10621
|
class V1Embed extends TsEmbed {
|
|
10138
10622
|
constructor(domSelector, viewConfig) {
|
|
@@ -10140,13 +10624,37 @@ class V1Embed extends TsEmbed {
|
|
|
10140
10624
|
this.viewConfig = viewConfig;
|
|
10141
10625
|
}
|
|
10142
10626
|
/**
|
|
10143
|
-
* Render the
|
|
10627
|
+
* Render the ap p in an iframe and set up event handlers
|
|
10628
|
+
*
|
|
10144
10629
|
* @param iframeSrc
|
|
10145
10630
|
*/
|
|
10146
10631
|
renderV1Embed(iframeSrc) {
|
|
10147
|
-
return this.renderIFrame(iframeSrc
|
|
10632
|
+
return this.renderIFrame(iframeSrc);
|
|
10633
|
+
}
|
|
10634
|
+
getRootIframeSrc() {
|
|
10635
|
+
const runtimeFilters = this.viewConfig.runtimeFilters;
|
|
10636
|
+
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
10637
|
+
const queryParams = this.getEmbedParams();
|
|
10638
|
+
const queryString = [filterQuery, queryParams].filter(Boolean).join('&');
|
|
10639
|
+
return this.getV1EmbedBasePath(queryString);
|
|
10148
10640
|
}
|
|
10149
|
-
|
|
10641
|
+
/**
|
|
10642
|
+
* @inheritdoc
|
|
10643
|
+
* @example
|
|
10644
|
+
* ```js
|
|
10645
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
10646
|
+
* console.error(data);
|
|
10647
|
+
* });
|
|
10648
|
+
* ```
|
|
10649
|
+
* @example
|
|
10650
|
+
* ```js
|
|
10651
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
10652
|
+
* console.log("Answer save clicked", data);
|
|
10653
|
+
* }, {
|
|
10654
|
+
* start: true // This will trigger the callback on start of save
|
|
10655
|
+
* });
|
|
10656
|
+
* ```
|
|
10657
|
+
*/
|
|
10150
10658
|
on(messageType, callback, options = { start: false }) {
|
|
10151
10659
|
const eventType = this.getCompatibleEventType(messageType);
|
|
10152
10660
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
@@ -10201,7 +10709,8 @@ var Page;
|
|
|
10201
10709
|
})(Page || (Page = {}));
|
|
10202
10710
|
/**
|
|
10203
10711
|
* Embeds full ThoughtSpot experience in a host application.
|
|
10204
|
-
*
|
|
10712
|
+
*
|
|
10713
|
+
* @group Embed components
|
|
10205
10714
|
*/
|
|
10206
10715
|
class AppEmbed extends V1Embed {
|
|
10207
10716
|
// eslint-disable-next-line no-useless-constructor
|
|
@@ -10213,8 +10722,12 @@ class AppEmbed extends V1Embed {
|
|
|
10213
10722
|
* embedded Liveboard or visualization.
|
|
10214
10723
|
*/
|
|
10215
10724
|
getEmbedParams() {
|
|
10216
|
-
const
|
|
10217
|
-
|
|
10725
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, enableSearchAssist, } = this.viewConfig;
|
|
10726
|
+
let params = {};
|
|
10727
|
+
params[Param.EmbedApp] = true;
|
|
10728
|
+
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
10729
|
+
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
10730
|
+
params = this.getBaseQueryParams(params);
|
|
10218
10731
|
if (tag) {
|
|
10219
10732
|
params[Param.Tag] = tag;
|
|
10220
10733
|
}
|
|
@@ -10224,26 +10737,28 @@ class AppEmbed extends V1Embed {
|
|
|
10224
10737
|
if (liveboardV2 !== undefined) {
|
|
10225
10738
|
params[Param.LiveboardV2Enabled] = liveboardV2;
|
|
10226
10739
|
}
|
|
10740
|
+
if (enableSearchAssist !== undefined) {
|
|
10741
|
+
params[Param.EnableSearchAssist] = enableSearchAssist;
|
|
10742
|
+
}
|
|
10227
10743
|
const queryParams = getQueryParamString(params, true);
|
|
10228
10744
|
return queryParams;
|
|
10229
10745
|
}
|
|
10230
10746
|
/**
|
|
10231
10747
|
* Constructs the URL of the ThoughtSpot app page to be rendered.
|
|
10748
|
+
*
|
|
10232
10749
|
* @param pageId The ID of the page to be embedded.
|
|
10233
10750
|
*/
|
|
10234
|
-
getIFrameSrc(
|
|
10235
|
-
const
|
|
10236
|
-
const
|
|
10237
|
-
|
|
10238
|
-
.filter(Boolean)
|
|
10239
|
-
.join('&');
|
|
10240
|
-
let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true, this.viewConfig.enableSearchAssist)}/${pageId}`;
|
|
10751
|
+
getIFrameSrc() {
|
|
10752
|
+
const { pageId, path } = this.viewConfig;
|
|
10753
|
+
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
10754
|
+
let url = `${this.getRootIframeSrc()}/${pageRoute}`;
|
|
10241
10755
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10242
10756
|
url = `${url}${tsPostHashParams}`;
|
|
10243
10757
|
return url;
|
|
10244
10758
|
}
|
|
10245
10759
|
/**
|
|
10246
10760
|
* Gets the ThoughtSpot route of the page for a particular page ID.
|
|
10761
|
+
*
|
|
10247
10762
|
* @param pageId The identifier for a page in the ThoughtSpot app.
|
|
10248
10763
|
*/
|
|
10249
10764
|
getPageRoute(pageId) {
|
|
@@ -10267,6 +10782,7 @@ class AppEmbed extends V1Embed {
|
|
|
10267
10782
|
}
|
|
10268
10783
|
/**
|
|
10269
10784
|
* Formats the path provided by the user.
|
|
10785
|
+
*
|
|
10270
10786
|
* @param path The URL path.
|
|
10271
10787
|
* @returns The URL path that the embedded app understands.
|
|
10272
10788
|
*/
|
|
@@ -10282,10 +10798,13 @@ class AppEmbed extends V1Embed {
|
|
|
10282
10798
|
}
|
|
10283
10799
|
/**
|
|
10284
10800
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
10285
|
-
* This is used for embedding answers, pinboards, visualizations and full application
|
|
10801
|
+
* This is used for embedding answers, pinboards, visualizations and full application
|
|
10802
|
+
* only.
|
|
10803
|
+
*
|
|
10286
10804
|
* @param path string | number The string, set to iframe src and navigate to new page
|
|
10287
10805
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
10288
|
-
* When used with `noReload` this can also be a number
|
|
10806
|
+
* When used with `noReload` (default: true) this can also be a number
|
|
10807
|
+
* like 1/-1 to go forward/back.
|
|
10289
10808
|
* @param noReload boolean Trigger the navigation without reloading the page
|
|
10290
10809
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
10291
10810
|
*/
|
|
@@ -10310,14 +10829,13 @@ class AppEmbed extends V1Embed {
|
|
|
10310
10829
|
}
|
|
10311
10830
|
/**
|
|
10312
10831
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
10832
|
+
*
|
|
10313
10833
|
* @param renderOptions An object containing the page ID
|
|
10314
10834
|
* to be embedded.
|
|
10315
10835
|
*/
|
|
10316
10836
|
render() {
|
|
10317
10837
|
super.render();
|
|
10318
|
-
const
|
|
10319
|
-
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
10320
|
-
const src = this.getIFrameSrc(pageRoute, runtimeFilters);
|
|
10838
|
+
const src = this.getIFrameSrc();
|
|
10321
10839
|
this.renderV1Embed(src);
|
|
10322
10840
|
return this;
|
|
10323
10841
|
}
|
|
@@ -10335,7 +10853,8 @@ class AppEmbed extends V1Embed {
|
|
|
10335
10853
|
*/
|
|
10336
10854
|
/**
|
|
10337
10855
|
* Embed a ThoughtSpot Liveboard or visualization
|
|
10338
|
-
*
|
|
10856
|
+
*
|
|
10857
|
+
* @group Embed components
|
|
10339
10858
|
*/
|
|
10340
10859
|
class LiveboardEmbed extends V1Embed {
|
|
10341
10860
|
// eslint-disable-next-line no-useless-constructor
|
|
@@ -10345,6 +10864,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
10345
10864
|
/**
|
|
10346
10865
|
* Set the iframe height as per the computed height received
|
|
10347
10866
|
* from the ThoughtSpot app.
|
|
10867
|
+
*
|
|
10348
10868
|
* @param data The event payload
|
|
10349
10869
|
*/
|
|
10350
10870
|
this.updateIFrameHeight = (data) => {
|
|
@@ -10359,16 +10879,23 @@ class LiveboardEmbed extends V1Embed {
|
|
|
10359
10879
|
this.setIFrameHeight(this.defaultHeight);
|
|
10360
10880
|
}
|
|
10361
10881
|
};
|
|
10882
|
+
if (this.viewConfig.fullHeight === true) {
|
|
10883
|
+
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
10884
|
+
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
10885
|
+
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
10886
|
+
}
|
|
10362
10887
|
}
|
|
10363
10888
|
/**
|
|
10364
10889
|
* Construct a map of params to be passed on to the
|
|
10365
10890
|
* embedded Liveboard or visualization.
|
|
10366
10891
|
*/
|
|
10367
10892
|
getEmbedParams() {
|
|
10368
|
-
|
|
10893
|
+
let params = {};
|
|
10894
|
+
params[Param.EmbedApp] = true;
|
|
10895
|
+
params = this.getBaseQueryParams(params);
|
|
10369
10896
|
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, activeTabId, } = this.viewConfig;
|
|
10370
|
-
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
10371
|
-
this.viewConfig.preventPinboardFilterRemoval;
|
|
10897
|
+
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
10898
|
+
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
10372
10899
|
if (fullHeight === true) {
|
|
10373
10900
|
params[Param.fullHeight] = true;
|
|
10374
10901
|
}
|
|
@@ -10394,65 +10921,68 @@ class LiveboardEmbed extends V1Embed {
|
|
|
10394
10921
|
const queryParams = getQueryParamString(params, true);
|
|
10395
10922
|
return queryParams;
|
|
10396
10923
|
}
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
* to be loaded within the iframe.
|
|
10400
|
-
* @param liveboardId The GUID of the Liveboard.
|
|
10401
|
-
* @param vizId The optional GUID of a visualization within the Liveboard.
|
|
10402
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
10403
|
-
* the Liveboard or visualization on load.
|
|
10404
|
-
*/
|
|
10405
|
-
getIFrameSrc(liveboardId, vizId, runtimeFilters, activeTabId) {
|
|
10406
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
10407
|
-
const queryParams = this.getEmbedParams();
|
|
10408
|
-
const queryString = [filterQuery, queryParams]
|
|
10409
|
-
.filter(Boolean)
|
|
10410
|
-
.join('&');
|
|
10411
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${liveboardId}`;
|
|
10924
|
+
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
10925
|
+
let suffix = `/embed/viz/${liveboardId}`;
|
|
10412
10926
|
if (activeTabId) {
|
|
10413
|
-
|
|
10927
|
+
suffix = `${suffix}/tab/${activeTabId} `;
|
|
10414
10928
|
}
|
|
10415
10929
|
if (vizId) {
|
|
10416
|
-
|
|
10930
|
+
suffix = `${suffix}/${vizId}`;
|
|
10417
10931
|
}
|
|
10418
10932
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10419
|
-
|
|
10420
|
-
return
|
|
10933
|
+
suffix = `${suffix}${tsPostHashParams}`;
|
|
10934
|
+
return suffix;
|
|
10935
|
+
}
|
|
10936
|
+
/**
|
|
10937
|
+
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
10938
|
+
* to be loaded within the iframe.
|
|
10939
|
+
*/
|
|
10940
|
+
getIFrameSrc() {
|
|
10941
|
+
var _a;
|
|
10942
|
+
const { vizId, activeTabId } = this.viewConfig;
|
|
10943
|
+
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
10944
|
+
if (!liveboardId) {
|
|
10945
|
+
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
10946
|
+
}
|
|
10947
|
+
return `${this.getRootIframeSrc()}${this.getIframeSuffixSrc(liveboardId, vizId, activeTabId)}`;
|
|
10421
10948
|
}
|
|
10422
10949
|
/**
|
|
10423
10950
|
* Triggers an event to the embedded app
|
|
10951
|
+
*
|
|
10424
10952
|
* @param messageType The event type
|
|
10425
10953
|
* @param data The payload to send with the message
|
|
10426
10954
|
*/
|
|
10427
10955
|
trigger(messageType, data = {}) {
|
|
10428
10956
|
const dataWithVizId = data;
|
|
10429
|
-
if (this.viewConfig.vizId) {
|
|
10957
|
+
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
10430
10958
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
10431
10959
|
}
|
|
10432
10960
|
return super.trigger(messageType, dataWithVizId);
|
|
10433
10961
|
}
|
|
10434
10962
|
/**
|
|
10435
10963
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
10964
|
+
*
|
|
10436
10965
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
10437
10966
|
* visualization ID and the runtime filters.
|
|
10438
10967
|
*/
|
|
10439
10968
|
render() {
|
|
10440
|
-
var _a;
|
|
10441
|
-
const { vizId, activeTabId, runtimeFilters } = this.viewConfig;
|
|
10442
|
-
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
10443
|
-
if (!liveboardId) {
|
|
10444
|
-
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
10445
|
-
}
|
|
10446
|
-
if (this.viewConfig.fullHeight === true) {
|
|
10447
|
-
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
10448
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
10449
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
10450
|
-
}
|
|
10451
10969
|
super.render();
|
|
10452
|
-
const src = this.getIFrameSrc(
|
|
10970
|
+
const src = this.getIFrameSrc();
|
|
10453
10971
|
this.renderV1Embed(src);
|
|
10454
10972
|
return this;
|
|
10455
10973
|
}
|
|
10974
|
+
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
10975
|
+
const path = this.getIframeSuffixSrc(liveboardId, vizId, activeTabId);
|
|
10976
|
+
this.viewConfig.liveboardId = liveboardId;
|
|
10977
|
+
this.viewConfig.activeTabId = activeTabId;
|
|
10978
|
+
this.viewConfig.vizId = vizId;
|
|
10979
|
+
if (this.isAppInitialized) {
|
|
10980
|
+
this.trigger(HostEvent.Navigate, path);
|
|
10981
|
+
}
|
|
10982
|
+
else {
|
|
10983
|
+
this.render();
|
|
10984
|
+
}
|
|
10985
|
+
}
|
|
10456
10986
|
}
|
|
10457
10987
|
/**
|
|
10458
10988
|
* @hidden
|
|
@@ -10478,7 +11008,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
10478
11008
|
/**
|
|
10479
11009
|
* Embed ThoughtSpot search
|
|
10480
11010
|
*
|
|
10481
|
-
* @
|
|
11011
|
+
* @group Embed components
|
|
10482
11012
|
*/
|
|
10483
11013
|
class SearchEmbed extends TsEmbed {
|
|
10484
11014
|
constructor(domSelector, viewConfig) {
|
|
@@ -10499,16 +11029,9 @@ class SearchEmbed extends TsEmbed {
|
|
|
10499
11029
|
}
|
|
10500
11030
|
return dataSourceMode;
|
|
10501
11031
|
}
|
|
10502
|
-
|
|
10503
|
-
* Construct the URL of the embedded ThoughtSpot search to be
|
|
10504
|
-
* loaded in the iframe
|
|
10505
|
-
* @param answerId The GUID of a saved answer
|
|
10506
|
-
* @param dataSources A list of data source GUIDs
|
|
10507
|
-
*/
|
|
10508
|
-
getIFrameSrc(answerId, dataSources) {
|
|
11032
|
+
getEmbedParams() {
|
|
10509
11033
|
var _a;
|
|
10510
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, } = this.viewConfig;
|
|
10511
|
-
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
11034
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, } = this.viewConfig;
|
|
10512
11035
|
const queryParams = this.getBaseQueryParams();
|
|
10513
11036
|
queryParams[Param.HideActions] = [
|
|
10514
11037
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -10547,17 +11070,28 @@ class SearchEmbed extends TsEmbed {
|
|
|
10547
11070
|
if (filterQuery) {
|
|
10548
11071
|
query += `&${filterQuery}`;
|
|
10549
11072
|
}
|
|
11073
|
+
return query;
|
|
11074
|
+
}
|
|
11075
|
+
/**
|
|
11076
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
11077
|
+
* loaded in the iframe
|
|
11078
|
+
*
|
|
11079
|
+
* @param answerId The GUID of a saved answer
|
|
11080
|
+
* @param dataSources A list of data source GUIDs
|
|
11081
|
+
*/
|
|
11082
|
+
getIFrameSrc(answerId) {
|
|
11083
|
+
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
10550
11084
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10551
|
-
return `${this.
|
|
11085
|
+
return `${this.getRootIframeSrc()}/embed/${answerPath}${tsPostHashParams}`;
|
|
10552
11086
|
}
|
|
10553
11087
|
/**
|
|
10554
11088
|
* Render the embedded ThoughtSpot search
|
|
10555
11089
|
*/
|
|
10556
11090
|
render() {
|
|
10557
11091
|
super.render();
|
|
10558
|
-
const { answerId
|
|
10559
|
-
const src = this.getIFrameSrc(answerId
|
|
10560
|
-
this.renderIFrame(src
|
|
11092
|
+
const { answerId } = this.viewConfig;
|
|
11093
|
+
const src = this.getIFrameSrc(answerId);
|
|
11094
|
+
this.renderIFrame(src);
|
|
10561
11095
|
getAuthPromise().then(() => {
|
|
10562
11096
|
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
10563
11097
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
@@ -10570,8 +11104,8 @@ class SearchEmbed extends TsEmbed {
|
|
|
10570
11104
|
/**
|
|
10571
11105
|
* Embed ThoughtSpot search bar
|
|
10572
11106
|
*
|
|
10573
|
-
* @Category Search Embed
|
|
10574
11107
|
* @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
|
|
11108
|
+
* @group Embed components
|
|
10575
11109
|
*/
|
|
10576
11110
|
class SearchBarEmbed extends TsEmbed {
|
|
10577
11111
|
constructor(domSelector, viewConfig) {
|
|
@@ -10581,6 +11115,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
10581
11115
|
/**
|
|
10582
11116
|
* Construct the URL of the embedded ThoughtSpot search to be
|
|
10583
11117
|
* loaded in the iframe
|
|
11118
|
+
*
|
|
10584
11119
|
* @param dataSources A list of data source GUIDs
|
|
10585
11120
|
*/
|
|
10586
11121
|
getIFrameSrc() {
|
|
@@ -10588,9 +11123,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
10588
11123
|
const { searchOptions, dataSource, dataSources } = this.viewConfig;
|
|
10589
11124
|
const path = 'search-bar-embed';
|
|
10590
11125
|
const queryParams = this.getBaseQueryParams();
|
|
10591
|
-
queryParams[Param.HideActions] = [
|
|
10592
|
-
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
10593
|
-
];
|
|
11126
|
+
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
10594
11127
|
if (dataSources && dataSources.length) {
|
|
10595
11128
|
queryParams[Param.DataSources] = JSON.stringify(dataSources);
|
|
10596
11129
|
}
|
|
@@ -10611,7 +11144,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
10611
11144
|
query = `?${queryParamsString}`;
|
|
10612
11145
|
}
|
|
10613
11146
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10614
|
-
return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
|
|
11147
|
+
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
10615
11148
|
}
|
|
10616
11149
|
/**
|
|
10617
11150
|
* Render the embedded ThoughtSpot search
|
|
@@ -10619,7 +11152,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
10619
11152
|
render() {
|
|
10620
11153
|
super.render();
|
|
10621
11154
|
const src = this.getIFrameSrc();
|
|
10622
|
-
this.renderIFrame(src
|
|
11155
|
+
this.renderIFrame(src);
|
|
10623
11156
|
return this;
|
|
10624
11157
|
}
|
|
10625
11158
|
}
|