@thoughtspot/visual-embed-sdk 1.20.0 → 1.21.0-alpha.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/README.md +1 -1
- package/dist/src/auth.d.ts +84 -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 -7
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +97 -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 +430 -98
- 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 +849 -288
- package/dist/tsembed.js +822 -287
- package/lib/package.json +4 -10
- package/lib/src/auth.d.ts +84 -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 -7
- 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 +97 -5
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +180 -74
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +46 -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 +9 -7
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +29 -8
- 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 +430 -98
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +311 -73
- 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 +695 -146
- package/package.json +4 -10
- package/src/auth.spec.ts +68 -150
- package/src/auth.ts +153 -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 +68 -66
- 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 -27
- package/src/embed/searchEmbed-basic-auth.spec.ts +22 -28
- package/src/embed/ts-embed.spec.ts +99 -144
- package/src/embed/ts-embed.ts +214 -159
- 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 +72 -15
- package/src/react/index.tsx +43 -54
- package/src/react/util.ts +8 -4
- package/src/test/test-utils.ts +43 -39
- package/src/types.ts +428 -99
- 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.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* Refer to the following docs for more details on runtime filter syntax:
|
|
18
18
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/apply-runtime-filter.html
|
|
19
19
|
* https://cloud-docs.thoughtspot.com/admin/ts-cloud/runtime-filter-operators.html
|
|
20
|
+
*
|
|
20
21
|
* @param runtimeFilters
|
|
21
22
|
*/
|
|
22
23
|
const getFilterQuery = (runtimeFilters) => {
|
|
@@ -36,13 +37,12 @@
|
|
|
36
37
|
/**
|
|
37
38
|
* Convert a value to a string representation to be sent as a query
|
|
38
39
|
* parameter to the ThoughtSpot app.
|
|
40
|
+
*
|
|
39
41
|
* @param value Any parameter value
|
|
40
42
|
*/
|
|
41
43
|
const serializeParam = (value) => {
|
|
42
44
|
// do not serialize primitive types
|
|
43
|
-
if (typeof value === 'string' ||
|
|
44
|
-
typeof value === 'number' ||
|
|
45
|
-
typeof value === 'boolean') {
|
|
45
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
46
46
|
return value;
|
|
47
47
|
}
|
|
48
48
|
return JSON.stringify(value);
|
|
@@ -51,12 +51,15 @@
|
|
|
51
51
|
* Convert a value to a string:
|
|
52
52
|
* in case of an array, we convert it to CSV.
|
|
53
53
|
* in case of any other type, we directly return the value.
|
|
54
|
+
*
|
|
54
55
|
* @param value
|
|
55
56
|
*/
|
|
56
|
-
const paramToString = (value) => Array.isArray(value) ? value.join(',') : value;
|
|
57
|
+
const paramToString = (value) => (Array.isArray(value) ? value.join(',') : value);
|
|
57
58
|
/**
|
|
58
59
|
* Return a query param string composed from the given params object
|
|
60
|
+
*
|
|
59
61
|
* @param queryParams
|
|
62
|
+
* @param shouldSerializeParamValues
|
|
60
63
|
*/
|
|
61
64
|
const getQueryParamString = (queryParams, shouldSerializeParamValues = false) => {
|
|
62
65
|
const qp = [];
|
|
@@ -78,6 +81,7 @@
|
|
|
78
81
|
/**
|
|
79
82
|
* Get a string representation of a dimension value in CSS
|
|
80
83
|
* If numeric, it is considered in pixels.
|
|
84
|
+
*
|
|
81
85
|
* @param value
|
|
82
86
|
*/
|
|
83
87
|
const getCssDimension = (value) => {
|
|
@@ -88,6 +92,7 @@
|
|
|
88
92
|
};
|
|
89
93
|
/**
|
|
90
94
|
* Append a string to a URL's hash fragment
|
|
95
|
+
*
|
|
91
96
|
* @param url A URL
|
|
92
97
|
* @param stringToAppend The string to append to the URL hash
|
|
93
98
|
*/
|
|
@@ -102,6 +107,12 @@
|
|
|
102
107
|
}
|
|
103
108
|
return outputUrl;
|
|
104
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @param url
|
|
113
|
+
* @param stringToAppend
|
|
114
|
+
* @param path
|
|
115
|
+
*/
|
|
105
116
|
function getRedirectUrl(url, stringToAppend, path = '') {
|
|
106
117
|
const targetUrl = path ? new URL(path, window.location.origin).href : url;
|
|
107
118
|
return appendToUrlHash(targetUrl, stringToAppend);
|
|
@@ -110,10 +121,7 @@
|
|
|
110
121
|
if (!queryString) {
|
|
111
122
|
return queryString;
|
|
112
123
|
}
|
|
113
|
-
return btoa(queryString)
|
|
114
|
-
.replace(/\+/g, '-')
|
|
115
|
-
.replace(/\//g, '_')
|
|
116
|
-
.replace(/=+$/, '');
|
|
124
|
+
return btoa(queryString).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
117
125
|
};
|
|
118
126
|
const getOffsetTop = (element) => {
|
|
119
127
|
const rect = element.getBoundingClientRect();
|
|
@@ -143,8 +151,8 @@
|
|
|
143
151
|
var _a, _b, _c, _d;
|
|
144
152
|
const customCssUrlFromEmbedConfig = embedConfig.customCssUrl;
|
|
145
153
|
const customizationsFromViewConfig = viewConfig.customizations;
|
|
146
|
-
const customizationsFromEmbedConfig = embedConfig.customizations
|
|
147
|
-
embedConfig.customisations;
|
|
154
|
+
const customizationsFromEmbedConfig = embedConfig.customizations
|
|
155
|
+
|| embedConfig.customisations;
|
|
148
156
|
const customizations = {
|
|
149
157
|
style: {
|
|
150
158
|
...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style,
|
|
@@ -153,9 +161,9 @@
|
|
|
153
161
|
...(_a = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _a === void 0 ? void 0 : _a.customCSS,
|
|
154
162
|
...(_b = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _b === void 0 ? void 0 : _b.customCSS,
|
|
155
163
|
},
|
|
156
|
-
customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
|
|
157
|
-
((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl)
|
|
158
|
-
customCssUrlFromEmbedConfig,
|
|
164
|
+
customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
|
|
165
|
+
|| ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl)
|
|
166
|
+
|| customCssUrlFromEmbedConfig,
|
|
159
167
|
},
|
|
160
168
|
content: {
|
|
161
169
|
...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.content,
|
|
@@ -167,12 +175,11 @@
|
|
|
167
175
|
/**
|
|
168
176
|
* Gets a reference to the DOM node given
|
|
169
177
|
* a selector.
|
|
178
|
+
*
|
|
170
179
|
* @param domSelector
|
|
171
180
|
*/
|
|
172
181
|
function getDOMNode(domSelector) {
|
|
173
|
-
return typeof domSelector === 'string'
|
|
174
|
-
? document.querySelector(domSelector)
|
|
175
|
-
: domSelector;
|
|
182
|
+
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
176
183
|
}
|
|
177
184
|
|
|
178
185
|
/**
|
|
@@ -185,23 +192,28 @@
|
|
|
185
192
|
*/
|
|
186
193
|
(function (AuthType) {
|
|
187
194
|
/**
|
|
188
|
-
* No authentication on the SDK. Passthrough to the embedded App. Alias for
|
|
195
|
+
* No authentication on the SDK. Passthrough to the embedded App. Alias for
|
|
196
|
+
* `Passthrough`.
|
|
189
197
|
*/
|
|
190
198
|
AuthType["None"] = "None";
|
|
191
199
|
/**
|
|
192
|
-
* Passthrough SSO to the embedded App within the iframe. Requires least
|
|
193
|
-
* be supported by all IDPs. This will behave like `None`
|
|
200
|
+
* Passthrough SSO to the embedded App within the iframe. Requires least
|
|
201
|
+
* configuration, but may not be supported by all IDPs. This will behave like `None`
|
|
202
|
+
* if SSO is not configured on ThoughtSpot.
|
|
203
|
+
*
|
|
194
204
|
* @version: SDK: 1.15.0 | ThouhgtSpot: 8.8.0.cl
|
|
195
205
|
*/
|
|
196
206
|
AuthType["EmbeddedSSO"] = "EmbeddedSSO";
|
|
197
207
|
/**
|
|
198
208
|
* SSO using SAML
|
|
209
|
+
*
|
|
199
210
|
* @deprecated Use {@link SAMLRedirect} instead
|
|
200
211
|
* @hidden
|
|
201
212
|
*/
|
|
202
213
|
AuthType["SSO"] = "SSO_SAML";
|
|
203
214
|
/**
|
|
204
215
|
* SSO using SAML
|
|
216
|
+
*
|
|
205
217
|
* @deprecated Use {@link SAMLRedirect} instead
|
|
206
218
|
* @hidden
|
|
207
219
|
*/
|
|
@@ -209,10 +221,21 @@
|
|
|
209
221
|
/**
|
|
210
222
|
* SSO using SAML
|
|
211
223
|
* Will make the host application redirect to the SAML Idp.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```js
|
|
227
|
+
* init({
|
|
228
|
+
* // ...
|
|
229
|
+
* authType: AuthType.SAMLRedirect,
|
|
230
|
+
* authTriggerText: 'Login with SAML',
|
|
231
|
+
* authTriggerContainer: '#embed-container',
|
|
232
|
+
* });
|
|
233
|
+
* ```
|
|
212
234
|
*/
|
|
213
235
|
AuthType["SAMLRedirect"] = "SSO_SAML";
|
|
214
236
|
/**
|
|
215
237
|
* SSO using OIDC
|
|
238
|
+
*
|
|
216
239
|
* @hidden
|
|
217
240
|
* @deprecated Use {@link OIDCRedirect} instead
|
|
218
241
|
*/
|
|
@@ -224,21 +247,35 @@
|
|
|
224
247
|
AuthType["OIDCRedirect"] = "SSO_OIDC";
|
|
225
248
|
/**
|
|
226
249
|
* Trusted authentication server
|
|
250
|
+
*
|
|
227
251
|
* @hidden
|
|
228
252
|
* @deprecated Use {@link TrustedAuth} instead
|
|
229
253
|
*/
|
|
230
254
|
AuthType["AuthServer"] = "AuthServer";
|
|
231
255
|
/**
|
|
232
256
|
* Trusted authentication server, Use your own authentication server
|
|
233
|
-
* which returns a bearer token, generated using the secret_key obtained
|
|
234
|
-
* ThoughtSpot.
|
|
257
|
+
* which returns a bearer token, generated using the secret_key obtained
|
|
258
|
+
* from ThoughtSpot.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```js
|
|
262
|
+
* init({
|
|
263
|
+
* // ...
|
|
264
|
+
* authType: AuthType.TrustedAuthToken,
|
|
265
|
+
* getAuthToken: () => {
|
|
266
|
+
* return fetch('https://my-backend.app/ts-token')
|
|
267
|
+
* .then((response) => response.json())
|
|
268
|
+
* .then((data) => data.token);
|
|
269
|
+
* }
|
|
270
|
+
* ```
|
|
235
271
|
*/
|
|
236
272
|
AuthType["TrustedAuthToken"] = "AuthServer";
|
|
237
273
|
/**
|
|
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
|
|
274
|
+
* Trusted authentication server Cookieless, Use you own authentication
|
|
275
|
+
* server which returns a bearer token, generated using the secret_key
|
|
276
|
+
* obtained from ThoughtSpot. This uses a cookieless authentication
|
|
277
|
+
* approach, recommended to by pass third-party cookie-blocking restriction
|
|
278
|
+
* implemented by some browsers
|
|
242
279
|
*/
|
|
243
280
|
AuthType["TrustedAuthTokenCookieless"] = "AuthServerCookieless";
|
|
244
281
|
/**
|
|
@@ -310,26 +347,31 @@
|
|
|
310
347
|
(function (EmbedEvent) {
|
|
311
348
|
/**
|
|
312
349
|
* Rendering has initialized.
|
|
313
|
-
*
|
|
350
|
+
*
|
|
351
|
+
* @returns timestamp - The timestamp when the event was generated.
|
|
314
352
|
*/
|
|
315
353
|
EmbedEvent["Init"] = "init";
|
|
316
354
|
/**
|
|
317
355
|
* Authentication has either succeeded or failed.
|
|
318
|
-
*
|
|
356
|
+
*
|
|
357
|
+
* @returns isLoggedIn - A Boolean specifying whether authentication was successful.
|
|
319
358
|
*/
|
|
320
359
|
EmbedEvent["AuthInit"] = "authInit";
|
|
321
360
|
/**
|
|
322
361
|
* The embed object container has loaded.
|
|
323
|
-
*
|
|
362
|
+
*
|
|
363
|
+
* @returns timestamp - The timestamp when the event was generated.
|
|
324
364
|
*/
|
|
325
365
|
EmbedEvent["Load"] = "load";
|
|
326
366
|
/**
|
|
327
367
|
* Data pertaining to answer or Liveboard is received
|
|
328
|
-
*
|
|
368
|
+
*
|
|
369
|
+
* @returns data - The answer or Liveboard data
|
|
329
370
|
*/
|
|
330
371
|
EmbedEvent["Data"] = "data";
|
|
331
372
|
/**
|
|
332
373
|
* Search/answer/Liveboard filters have been applied/updated
|
|
374
|
+
*
|
|
333
375
|
* @hidden
|
|
334
376
|
*/
|
|
335
377
|
EmbedEvent["FiltersChanged"] = "filtersChanged";
|
|
@@ -339,48 +381,56 @@
|
|
|
339
381
|
EmbedEvent["QueryChanged"] = "queryChanged";
|
|
340
382
|
/**
|
|
341
383
|
* A drill down operation has been performed.
|
|
342
|
-
*
|
|
343
|
-
* @
|
|
344
|
-
* @
|
|
384
|
+
*
|
|
385
|
+
* @returns additionalFilters - Any additional filters applied
|
|
386
|
+
* @returns drillDownColumns - The columns on which drill down was performed
|
|
387
|
+
* @returns nonFilteredColumns - The columns that were not filtered
|
|
345
388
|
*/
|
|
346
389
|
EmbedEvent["Drilldown"] = "drillDown";
|
|
347
390
|
/**
|
|
348
391
|
* One or more data sources have been selected.
|
|
349
|
-
*
|
|
392
|
+
*
|
|
393
|
+
* @returns dataSourceIds - the list of data sources
|
|
350
394
|
*/
|
|
351
395
|
EmbedEvent["DataSourceSelected"] = "dataSourceSelected";
|
|
352
396
|
/**
|
|
353
397
|
* One or more data columns have been selected.
|
|
354
|
-
*
|
|
398
|
+
*
|
|
399
|
+
* @returns columnIds - the list of columns
|
|
355
400
|
* @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
356
401
|
*/
|
|
357
402
|
EmbedEvent["AddRemoveColumns"] = "addRemoveColumns";
|
|
358
403
|
/**
|
|
359
404
|
* A custom action has been triggered
|
|
360
|
-
*
|
|
361
|
-
* @
|
|
405
|
+
*
|
|
406
|
+
* @returns actionId - The id of the custom action
|
|
407
|
+
* @returns data - The answer or Liveboard data
|
|
362
408
|
*/
|
|
363
409
|
EmbedEvent["CustomAction"] = "customAction";
|
|
364
410
|
/**
|
|
365
411
|
* A double click has been triggered on table/chart
|
|
366
|
-
*
|
|
412
|
+
*
|
|
413
|
+
* @returns ContextMenuInputPoints - data point that is double clicked
|
|
367
414
|
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
368
415
|
*/
|
|
369
416
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
370
417
|
/**
|
|
371
418
|
* A click has been triggered on table/chart
|
|
372
|
-
*
|
|
419
|
+
*
|
|
420
|
+
* @returns ContextMenuInputPoints - data point that is clicked
|
|
373
421
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
374
422
|
*/
|
|
375
423
|
EmbedEvent["VizPointClick"] = "vizPointClick";
|
|
376
424
|
/**
|
|
377
425
|
* An error has occurred.
|
|
378
|
-
*
|
|
426
|
+
*
|
|
427
|
+
* @returns error - An error object or message
|
|
379
428
|
*/
|
|
380
429
|
EmbedEvent["Error"] = "Error";
|
|
381
430
|
/**
|
|
382
431
|
* The embedded object has sent an alert
|
|
383
|
-
*
|
|
432
|
+
*
|
|
433
|
+
* @returns alert - An alert object
|
|
384
434
|
*/
|
|
385
435
|
EmbedEvent["Alert"] = "alert";
|
|
386
436
|
/**
|
|
@@ -389,29 +439,34 @@
|
|
|
389
439
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
390
440
|
/**
|
|
391
441
|
* ThoughtSpot failed to validate the auth session.
|
|
442
|
+
*
|
|
392
443
|
* @hidden
|
|
393
444
|
*/
|
|
394
445
|
EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
|
|
395
446
|
/**
|
|
396
447
|
* ThoughtSpot failed to validate the auth session.
|
|
448
|
+
*
|
|
397
449
|
* @hidden
|
|
398
450
|
*/
|
|
399
451
|
EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
|
|
400
452
|
/**
|
|
401
453
|
* The height of the embedded Liveboard or visualization has been computed.
|
|
402
|
-
*
|
|
454
|
+
*
|
|
455
|
+
* @returns data - The height of the embedded Liveboard or visualization
|
|
403
456
|
* @hidden
|
|
404
457
|
*/
|
|
405
458
|
EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
|
|
406
459
|
/**
|
|
407
460
|
* The center of visible iframe viewport is calculated.
|
|
408
|
-
*
|
|
461
|
+
*
|
|
462
|
+
* @returns data - The center of the visible Iframe viewport.
|
|
409
463
|
* @hidden
|
|
410
464
|
*/
|
|
411
465
|
EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
|
|
412
466
|
/**
|
|
413
467
|
* Emitted when the "Get Data" button in Search Bar embed
|
|
414
468
|
* is clicked.
|
|
469
|
+
*
|
|
415
470
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.0-sw
|
|
416
471
|
*/
|
|
417
472
|
EmbedEvent["GetDataClick"] = "getDataClick";
|
|
@@ -421,6 +476,7 @@
|
|
|
421
476
|
EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
|
|
422
477
|
/**
|
|
423
478
|
* The v1 event type for Data
|
|
479
|
+
*
|
|
424
480
|
* @hidden
|
|
425
481
|
*/
|
|
426
482
|
EmbedEvent["V1Data"] = "exportVizDataToParent";
|
|
@@ -433,17 +489,20 @@
|
|
|
433
489
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
434
490
|
/**
|
|
435
491
|
* Emitted when SAML is complete
|
|
492
|
+
*
|
|
436
493
|
* @private
|
|
437
494
|
* @hidden
|
|
438
495
|
*/
|
|
439
496
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
440
497
|
/**
|
|
441
498
|
* Emitted when any modal is opened in the app
|
|
499
|
+
*
|
|
442
500
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
443
501
|
*/
|
|
444
502
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
445
503
|
/**
|
|
446
504
|
* Emitted when any modal is closed in the app
|
|
505
|
+
*
|
|
447
506
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
448
507
|
*/
|
|
449
508
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
@@ -451,407 +510,559 @@
|
|
|
451
510
|
* Emitted when the Liveboard shell loads.
|
|
452
511
|
* You can use this event as a hook to trigger
|
|
453
512
|
* other events on the rendered Liveboard.
|
|
513
|
+
*
|
|
454
514
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
455
515
|
*/
|
|
456
516
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
457
517
|
/**
|
|
458
518
|
* This can be used to register an event listener which
|
|
459
519
|
* is triggered on all events.
|
|
520
|
+
*
|
|
460
521
|
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
461
522
|
*/
|
|
462
523
|
EmbedEvent["ALL"] = "*";
|
|
463
524
|
/**
|
|
464
525
|
* Emitted when answer is saved in the app
|
|
526
|
+
*
|
|
465
527
|
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
466
528
|
*/
|
|
467
529
|
EmbedEvent["Save"] = "save";
|
|
468
530
|
/**
|
|
469
531
|
* Emitted when the download action is triggered on an answer
|
|
532
|
+
*
|
|
470
533
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
471
534
|
*/
|
|
472
535
|
EmbedEvent["Download"] = "download";
|
|
473
536
|
/**
|
|
474
537
|
* Emitted when the Download as PDF action is triggered on an answer
|
|
538
|
+
*
|
|
475
539
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
476
540
|
*/
|
|
477
541
|
EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
478
542
|
/**
|
|
479
543
|
* Emitted when the Download as CSV action is triggered on an answer
|
|
544
|
+
*
|
|
480
545
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
481
546
|
*/
|
|
482
547
|
EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
|
|
483
548
|
/**
|
|
484
549
|
* Emitted when the Download as XLSX action is triggered on an answer
|
|
550
|
+
*
|
|
485
551
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
486
552
|
*/
|
|
487
553
|
EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
|
|
488
554
|
/**
|
|
489
555
|
* Emitted when an answer is deleted in the app
|
|
556
|
+
*
|
|
490
557
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
491
558
|
*/
|
|
492
559
|
EmbedEvent["AnswerDelete"] = "answerDelete";
|
|
493
560
|
/**
|
|
494
561
|
* Emitted when an answer is pinned to a Liveboard
|
|
562
|
+
*
|
|
495
563
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
496
564
|
*/
|
|
497
565
|
EmbedEvent["Pin"] = "pin";
|
|
498
566
|
/**
|
|
499
567
|
* Emitted when SpotIQ analysis is triggered
|
|
568
|
+
*
|
|
500
569
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
501
570
|
*/
|
|
502
571
|
EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
503
572
|
/**
|
|
504
573
|
* Emitted when a user shares an object with another user or group
|
|
574
|
+
*
|
|
505
575
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
506
576
|
*/
|
|
507
577
|
EmbedEvent["Share"] = "share";
|
|
508
578
|
/**
|
|
509
|
-
* Emitted when a user clicks the Include action to include a specific value or data
|
|
579
|
+
* Emitted when a user clicks the Include action to include a specific value or data
|
|
580
|
+
* on a chart or table
|
|
581
|
+
*
|
|
510
582
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
511
583
|
*/
|
|
512
584
|
EmbedEvent["DrillInclude"] = "context-menu-item-include";
|
|
513
585
|
/**
|
|
514
|
-
* Emitted when a user clicks the Exclude action to exclude a specific value or data
|
|
586
|
+
* Emitted when a user clicks the Exclude action to exclude a specific value or data
|
|
587
|
+
* on a chart or table
|
|
588
|
+
*
|
|
515
589
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
516
590
|
*/
|
|
517
591
|
EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
|
|
518
592
|
/**
|
|
519
593
|
* Emitted when copied column value on the app
|
|
594
|
+
*
|
|
520
595
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
521
596
|
*/
|
|
522
597
|
EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
523
598
|
/**
|
|
524
599
|
* Emitted when a user clicks the Update TML action
|
|
600
|
+
*
|
|
525
601
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
526
602
|
*/
|
|
527
603
|
EmbedEvent["UpdateTML"] = "updateTSL";
|
|
528
604
|
/**
|
|
529
605
|
* Emitted when a user clicks the Edit TML action
|
|
606
|
+
*
|
|
530
607
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
531
608
|
*/
|
|
532
609
|
EmbedEvent["EditTML"] = "editTSL";
|
|
533
610
|
/**
|
|
534
611
|
* Emitted when ExportTML trigger in answer on the app
|
|
612
|
+
*
|
|
535
613
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
536
614
|
*/
|
|
537
615
|
EmbedEvent["ExportTML"] = "exportTSL";
|
|
538
616
|
/**
|
|
539
617
|
* Emitted when an answer is saved as a view
|
|
618
|
+
*
|
|
540
619
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
541
620
|
*/
|
|
542
621
|
EmbedEvent["SaveAsView"] = "saveAsView";
|
|
543
622
|
/**
|
|
544
623
|
* Emitted when copy of existing answer on the app
|
|
624
|
+
*
|
|
545
625
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
546
626
|
*/
|
|
547
627
|
EmbedEvent["CopyAEdit"] = "copyAEdit";
|
|
548
628
|
/**
|
|
549
629
|
* Emitted when a user clicks Show underlying data on an answe
|
|
630
|
+
*
|
|
550
631
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
551
632
|
*/
|
|
552
633
|
EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
553
634
|
/**
|
|
554
635
|
* Emitted when an answer is switched to a chart or table view
|
|
636
|
+
*
|
|
555
637
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
556
638
|
*/
|
|
557
639
|
EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
558
640
|
/**
|
|
559
641
|
* Internal event to communicate the initial settings back to the TS APP
|
|
642
|
+
*
|
|
560
643
|
* @hidden
|
|
561
644
|
*/
|
|
562
645
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
563
646
|
/**
|
|
564
647
|
* Emitted when a user clicks Show Liveboard details on a Liveboard
|
|
648
|
+
*
|
|
565
649
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
566
650
|
*/
|
|
567
651
|
EmbedEvent["LiveboardInfo"] = "pinboardInfo";
|
|
568
652
|
/**
|
|
569
653
|
* Emitted when a user clicks on the Favorite icon on a Liveboard
|
|
654
|
+
*
|
|
570
655
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
571
656
|
*/
|
|
572
657
|
EmbedEvent["AddToFavorites"] = "addToFavorites";
|
|
573
658
|
/**
|
|
574
659
|
* Emitted when a user clicks Schedule on a Liveboard
|
|
660
|
+
*
|
|
575
661
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
576
662
|
*/
|
|
577
663
|
EmbedEvent["Schedule"] = "subscription";
|
|
578
664
|
/**
|
|
579
665
|
* Emitted when a user clicks Edit on a Liveboard or visualization
|
|
666
|
+
*
|
|
580
667
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
581
668
|
*/
|
|
582
669
|
EmbedEvent["Edit"] = "edit";
|
|
583
670
|
/**
|
|
584
671
|
* Emitted when a user clicks Make a copy on a Liveboard
|
|
672
|
+
*
|
|
585
673
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
586
674
|
*/
|
|
587
675
|
EmbedEvent["MakeACopy"] = "makeACopy";
|
|
588
676
|
/**
|
|
589
677
|
* Emitted when a user clicks Present on a Liveboard or visualization
|
|
678
|
+
*
|
|
590
679
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
591
680
|
*/
|
|
592
681
|
EmbedEvent["Present"] = "present";
|
|
593
682
|
/**
|
|
594
683
|
* Emitted when a user clicks Delete on a Liveboard
|
|
684
|
+
*
|
|
595
685
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
596
686
|
*/
|
|
597
687
|
EmbedEvent["Delete"] = "delete";
|
|
598
688
|
/**
|
|
599
689
|
* Emitted when a user clicks Manage schedules on a Liveboard
|
|
690
|
+
*
|
|
600
691
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
601
692
|
*/
|
|
602
693
|
EmbedEvent["SchedulesList"] = "schedule-list";
|
|
603
694
|
/**
|
|
604
695
|
* Emitted when a user clicks Cancel in edit mode on a Liveboard
|
|
696
|
+
*
|
|
605
697
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
606
698
|
*/
|
|
607
699
|
EmbedEvent["Cancel"] = "cancel";
|
|
608
700
|
/**
|
|
609
701
|
* Emitted when a user clicks Explore on a visualization
|
|
702
|
+
*
|
|
610
703
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
611
704
|
*/
|
|
612
705
|
EmbedEvent["Explore"] = "explore";
|
|
613
706
|
/**
|
|
614
707
|
* Emitted when a user clicks Copy link action on a visualization
|
|
708
|
+
*
|
|
615
709
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
616
710
|
*/
|
|
617
711
|
EmbedEvent["CopyLink"] = "embedDocument";
|
|
618
712
|
/**
|
|
619
713
|
* Emitted when a user interacts with cross filters on a visualization or liveboard
|
|
714
|
+
*
|
|
620
715
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
621
716
|
*/
|
|
622
717
|
EmbedEvent["CrossFilterChanged"] = "cross-filter-changed";
|
|
623
718
|
/**
|
|
624
719
|
* Emitted when a user right clicks on chart or table
|
|
720
|
+
*
|
|
625
721
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
626
722
|
*/
|
|
627
723
|
EmbedEvent["VizPointRightClick"] = "vizPointRightClick";
|
|
724
|
+
/**
|
|
725
|
+
* Emitted when a user clicks on Insert to slide on a visualization
|
|
726
|
+
*
|
|
727
|
+
* @hidden
|
|
728
|
+
*/
|
|
729
|
+
EmbedEvent["InsertIntoSlide"] = "insertInToSlide";
|
|
628
730
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
629
731
|
(function (HostEvent) {
|
|
630
732
|
/**
|
|
631
733
|
* Trigger a search
|
|
734
|
+
*
|
|
632
735
|
* @param - dataSourceIds - The data source GUID to Search on
|
|
633
736
|
* - Although an array, only a single source
|
|
634
737
|
* is supported at this time.
|
|
635
738
|
* @param - searchQuery - The search query
|
|
636
739
|
* @param - execute - execute the existing / updated query
|
|
637
740
|
* @example
|
|
741
|
+
* ```js
|
|
638
742
|
* searchEmbed.trigger(HostEvent.Search, {
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
743
|
+
* searchQuery: "[sales] by [item type],
|
|
744
|
+
* dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
|
|
745
|
+
* execute: true
|
|
642
746
|
* })
|
|
747
|
+
* ```
|
|
643
748
|
*/
|
|
644
749
|
HostEvent["Search"] = "search";
|
|
645
750
|
/**
|
|
646
751
|
* Trigger a drill on certain points by certain column
|
|
752
|
+
*
|
|
647
753
|
* @param - points - an object containing selectedPoints/clickedPoints
|
|
648
754
|
* eg. { selectedPoints: []}
|
|
649
755
|
* @param - columnGuid - a string guid of the column to drill by. This is optional,
|
|
650
|
-
* if not provided it will auto drill by the configured
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
756
|
+
* if not provided it will auto drill by the configured
|
|
757
|
+
* column.
|
|
758
|
+
* @example
|
|
759
|
+
* ```js
|
|
760
|
+
* searchEmbed.trigger(HostEvent.DrillDown, {
|
|
761
|
+
* points: clickedPointData,
|
|
762
|
+
* autoDrillDown: true,
|
|
654
763
|
* })
|
|
764
|
+
* ```
|
|
655
765
|
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
656
766
|
*/
|
|
657
767
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
658
768
|
/**
|
|
659
769
|
* Apply filters
|
|
770
|
+
*
|
|
660
771
|
* @hidden
|
|
661
772
|
*/
|
|
662
773
|
HostEvent["Filter"] = "filter";
|
|
663
774
|
/**
|
|
664
775
|
* Reload the answer or visualization
|
|
776
|
+
*
|
|
665
777
|
* @hidden
|
|
666
778
|
*/
|
|
667
779
|
HostEvent["Reload"] = "reload";
|
|
668
780
|
/**
|
|
669
781
|
* Set the visible visualizations on a Liveboard.
|
|
782
|
+
*
|
|
670
783
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
671
784
|
* will be hidden.
|
|
672
785
|
* @example
|
|
673
|
-
* liveboardEmbed.trigger(HostEvent.SetVisibleVizs, [
|
|
786
|
+
* liveboardEmbed.trigger(HostEvent.SetVisibleVizs, [
|
|
787
|
+
* '730496d6-6903-4601-937e-2c691821af3c',
|
|
788
|
+
* 'd547ec54-2a37-4516-a222-2b06719af726'])
|
|
674
789
|
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
675
790
|
*/
|
|
676
791
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
677
792
|
/**
|
|
678
793
|
* Update the runtime filters. The runtime filters passed here are extended
|
|
679
794
|
* on to the existing runtime filters if they exist.
|
|
795
|
+
*
|
|
680
796
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
681
797
|
* @example
|
|
682
798
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
683
799
|
* {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
|
|
684
|
-
* {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
|
|
685
|
-
* ])
|
|
800
|
+
* {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
|
|
801
|
+
* ["Jackets"]} ])
|
|
686
802
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
687
803
|
*/
|
|
688
804
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
689
805
|
/**
|
|
690
806
|
* Navigate to a specific page in App embed without any reload.
|
|
691
807
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
808
|
+
*
|
|
692
809
|
* @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
693
|
-
* @example
|
|
810
|
+
* @example
|
|
811
|
+
* ```js
|
|
812
|
+
* appEmbed.navigateToPage(-1)
|
|
813
|
+
* ```
|
|
694
814
|
* @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
|
|
695
815
|
*/
|
|
696
816
|
HostEvent["Navigate"] = "Navigate";
|
|
697
817
|
/**
|
|
698
818
|
* Opens the filter panel for a particular column.
|
|
699
819
|
* Works with Search embed.
|
|
700
|
-
*
|
|
701
|
-
* @
|
|
820
|
+
*
|
|
821
|
+
* @param - { columnId: string,
|
|
822
|
+
* name: string,
|
|
823
|
+
* type: INT64/CHAR/DATE,
|
|
824
|
+
* dataType: ATTRIBUTE/MEASURE }
|
|
825
|
+
* @example
|
|
826
|
+
* ```js
|
|
827
|
+
* searchEmbed.trigger(HostEvent.OpenFilter,
|
|
828
|
+
* { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
|
|
829
|
+
* ```
|
|
702
830
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
703
831
|
*/
|
|
704
832
|
HostEvent["OpenFilter"] = "openFilter";
|
|
705
833
|
/**
|
|
706
834
|
* Adds the columns to the current Search.
|
|
835
|
+
*
|
|
707
836
|
* @param - { columnIds: string[] }
|
|
708
|
-
* @example
|
|
837
|
+
* @example
|
|
838
|
+
* ```js
|
|
839
|
+
* searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['123', '456'] })
|
|
840
|
+
* ```
|
|
709
841
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
710
842
|
*/
|
|
711
843
|
HostEvent["AddColumns"] = "addColumns";
|
|
712
844
|
/**
|
|
713
845
|
* Removes a column from the current Search.
|
|
846
|
+
*
|
|
714
847
|
* @param - { columnId: string }
|
|
715
|
-
* @example
|
|
848
|
+
* @example
|
|
849
|
+
* ```js
|
|
850
|
+
* searchEmbed.trigger(HostEvent.RemoveColumn, { columnId: '123' })
|
|
851
|
+
* ```
|
|
716
852
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
717
853
|
*/
|
|
718
854
|
HostEvent["RemoveColumn"] = "removeColumn";
|
|
719
855
|
/**
|
|
720
856
|
* Gets the current pinboard content.
|
|
721
|
-
*
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```js
|
|
860
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
|
|
861
|
+
* ```
|
|
722
862
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
723
863
|
*/
|
|
724
864
|
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
725
865
|
/**
|
|
726
866
|
* Triggers the Pin action on an embedded object
|
|
867
|
+
*
|
|
727
868
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
728
869
|
* can be left empty for search and visualization embeds
|
|
729
870
|
* @example
|
|
871
|
+
* ```js
|
|
730
872
|
* liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
731
873
|
* vizEmbed.trigger(HostEvent.Pin)
|
|
732
874
|
* searchEmbed.trigger(HostEvent.Pin)
|
|
875
|
+
* ```
|
|
733
876
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
734
877
|
*/
|
|
735
878
|
HostEvent["Pin"] = "pin";
|
|
736
879
|
/**
|
|
737
880
|
* Triggers the Show Liveboard details action on a Liveboard
|
|
738
|
-
*
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```js
|
|
884
|
+
* liveboardEmbed.trigger(HostEvent.LiveboardInfo)
|
|
885
|
+
* ```
|
|
739
886
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
740
887
|
*/
|
|
741
888
|
HostEvent["LiveboardInfo"] = "pinboardInfo";
|
|
742
889
|
/**
|
|
743
890
|
* Triggers the Schedule action on a Liveboard
|
|
744
|
-
*
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```js
|
|
894
|
+
* liveboardEmbed.trigger(HostEvent.Schedule)
|
|
895
|
+
* ```
|
|
745
896
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
746
897
|
*/
|
|
747
898
|
HostEvent["Schedule"] = "subscription";
|
|
748
899
|
/**
|
|
749
900
|
* Triggers the Manage schedule action on a Liveboard
|
|
750
|
-
*
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```js
|
|
904
|
+
* liveboardEmbed.trigger(HostEvent.ScheduleList)
|
|
905
|
+
* ```
|
|
751
906
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
752
907
|
*/
|
|
753
908
|
HostEvent["SchedulesList"] = "schedule-list";
|
|
754
909
|
/**
|
|
755
910
|
* Triggers the Export TML action on a Liveboard
|
|
756
|
-
*
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* ```js
|
|
914
|
+
* liveboardEmbed.trigger(HostEvent.ExportTML)
|
|
915
|
+
* ```
|
|
757
916
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
758
917
|
*/
|
|
759
918
|
HostEvent["ExportTML"] = "exportTSL";
|
|
760
919
|
/**
|
|
761
920
|
* Triggers the Edit TML action on a Liveboard
|
|
762
|
-
*
|
|
921
|
+
*
|
|
922
|
+
* @example
|
|
923
|
+
* ```js
|
|
924
|
+
* liveboardEmbed.trigger(HostEvent.EditTML)
|
|
925
|
+
* ```
|
|
763
926
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
764
927
|
*/
|
|
765
928
|
HostEvent["EditTML"] = "editTSL";
|
|
766
929
|
/**
|
|
767
930
|
* Triggers the Update TML action on a Liveboard
|
|
768
|
-
*
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```js
|
|
934
|
+
* liveboardEmbed.trigger(HostEvent.UpdateTML)
|
|
935
|
+
* ```
|
|
769
936
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
770
937
|
*/
|
|
771
938
|
HostEvent["UpdateTML"] = "updateTSL";
|
|
772
939
|
/**
|
|
773
940
|
* Triggers the Download PDF action on a Liveboard
|
|
774
|
-
*
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* ```js
|
|
944
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
|
|
945
|
+
* ```
|
|
775
946
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
776
947
|
*/
|
|
777
948
|
HostEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
778
949
|
/**
|
|
779
950
|
* Triggers the Make a copy action on a Liveboard, search or visualization
|
|
951
|
+
*
|
|
780
952
|
* @example
|
|
953
|
+
* ```js
|
|
781
954
|
* liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
782
955
|
* vizEmbed.trigger(HostEvent.MakeACopy)
|
|
783
956
|
* searchEmbed.trigger(HostEvent.MakeACopy)
|
|
957
|
+
* ```
|
|
784
958
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
785
959
|
*/
|
|
786
960
|
HostEvent["MakeACopy"] = "makeACopy";
|
|
787
961
|
/**
|
|
788
962
|
* Triggers the Delete action on a Liveboard
|
|
789
|
-
*
|
|
963
|
+
*
|
|
964
|
+
* @example
|
|
965
|
+
* ```js
|
|
966
|
+
* appEmbed.trigger(HostEvent.Remove)
|
|
967
|
+
* ```
|
|
790
968
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
791
969
|
*/
|
|
792
970
|
HostEvent["Remove"] = "delete";
|
|
793
971
|
/**
|
|
794
972
|
* Triggers the Explore action on a visualization
|
|
973
|
+
*
|
|
795
974
|
* @param - an object with vizId as a key
|
|
796
|
-
* @example
|
|
975
|
+
* @example
|
|
976
|
+
* ```js
|
|
977
|
+
* liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
978
|
+
* ```
|
|
797
979
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
798
980
|
*/
|
|
799
981
|
HostEvent["Explore"] = "explore";
|
|
800
982
|
/**
|
|
801
983
|
* Triggers the Create alert action on a visualization
|
|
984
|
+
*
|
|
802
985
|
* @param - an object with vizId as a key
|
|
803
|
-
* @example
|
|
986
|
+
* @example
|
|
987
|
+
* ```js
|
|
988
|
+
* liveboardEmbed.trigger(HostEvent.CreateMonitor {
|
|
989
|
+
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
990
|
+
* })
|
|
991
|
+
* ```
|
|
804
992
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
805
993
|
*/
|
|
806
994
|
HostEvent["CreateMonitor"] = "createMonitor";
|
|
807
995
|
/**
|
|
808
996
|
* Triggers the Manage alert action on a visualization
|
|
997
|
+
*
|
|
809
998
|
* @param - an object with vizId as a key
|
|
810
|
-
* @example
|
|
999
|
+
* @example
|
|
1000
|
+
* ```js
|
|
1001
|
+
* liveboardEmbed.trigger(HostEvent.ManageMonitor, {
|
|
1002
|
+
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
1003
|
+
* })
|
|
1004
|
+
* ```
|
|
811
1005
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
812
1006
|
*/
|
|
813
1007
|
HostEvent["ManageMonitor"] = "manageMonitor";
|
|
814
1008
|
/**
|
|
815
1009
|
* Triggers the Edit action on a Liveboard or visualization
|
|
816
|
-
*
|
|
1010
|
+
*
|
|
1011
|
+
* @param - object - to trigger the action for a specfic visualization
|
|
1012
|
+
* in Liveboard embed, pass in vizId as a key
|
|
817
1013
|
* @example
|
|
818
1014
|
* liveboardEmbed.trigger(HostEvent.Edit)
|
|
819
|
-
* liveboardEmbed.trigger(HostEvent.Edit, {vizId:
|
|
1015
|
+
* liveboardEmbed.trigger(HostEvent.Edit, {vizId:
|
|
1016
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
820
1017
|
* vizEmbed.trigger((HostEvent.Edit)
|
|
821
1018
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
822
1019
|
*/
|
|
823
1020
|
HostEvent["Edit"] = "edit";
|
|
824
1021
|
/**
|
|
825
1022
|
* Triggers the Copy link action on a Liveboard or visualization
|
|
826
|
-
*
|
|
1023
|
+
*
|
|
1024
|
+
* @param - object - to trigger the action for a s
|
|
1025
|
+
* pecfic visualization in Liveboard embed, pass in vizId as a key
|
|
827
1026
|
* @example
|
|
1027
|
+
* ```js
|
|
828
1028
|
* liveboardEmbed.trigger(HostEvent.CopyLink)
|
|
829
1029
|
* liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
830
1030
|
* vizEmbed.trigger((HostEvent.CopyLink)
|
|
1031
|
+
* ```
|
|
831
1032
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
832
1033
|
*/
|
|
833
1034
|
HostEvent["CopyLink"] = "embedDocument";
|
|
834
1035
|
/**
|
|
835
1036
|
* Triggers the Present action on a Liveboard or visualization
|
|
836
|
-
*
|
|
1037
|
+
*
|
|
1038
|
+
* @param - object - to trigger the action for a specfic visualization
|
|
1039
|
+
* in Liveboard embed, pass in vizId as a key
|
|
837
1040
|
* @example
|
|
1041
|
+
* ```js
|
|
838
1042
|
* liveboardEmbed.trigger(HostEvent.Present)
|
|
839
1043
|
* liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
840
1044
|
* vizEmbed.trigger((HostEvent.Present)
|
|
1045
|
+
* ```
|
|
841
1046
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
842
1047
|
*/
|
|
843
1048
|
HostEvent["Present"] = "present";
|
|
844
1049
|
/**
|
|
845
1050
|
* Get TML for the current search.
|
|
846
|
-
*
|
|
847
|
-
* @
|
|
1051
|
+
*
|
|
1052
|
+
* @example
|
|
1053
|
+
* ```js
|
|
1054
|
+
* searchEmbed.trigger(HostEvent.GetTML)
|
|
1055
|
+
* ```
|
|
1056
|
+
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
|
|
848
1057
|
*/
|
|
849
1058
|
HostEvent["GetTML"] = "getTML";
|
|
850
1059
|
/**
|
|
851
1060
|
* Triggers the ShowUnderlyingData action on visualization or search
|
|
1061
|
+
*
|
|
852
1062
|
* @param - an object with vizId as a key
|
|
853
1063
|
* @example
|
|
854
|
-
* liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId:
|
|
1064
|
+
* liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId:
|
|
1065
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
855
1066
|
* vizEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
856
1067
|
* searchEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
857
1068
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -859,10 +1070,12 @@
|
|
|
859
1070
|
HostEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
860
1071
|
/**
|
|
861
1072
|
* Triggers the Delete action on visualization or search
|
|
1073
|
+
*
|
|
862
1074
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
863
1075
|
* can be left empty for search and visualization embeds
|
|
864
1076
|
* @example
|
|
865
|
-
* liveboardEmbed.trigger(HostEvent.Delete, {vizId:
|
|
1077
|
+
* liveboardEmbed.trigger(HostEvent.Delete, {vizId:
|
|
1078
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
866
1079
|
* vizEmbed.trigger(HostEvent.Delete)
|
|
867
1080
|
* searchEmbed.trigger(HostEvent.Delete)
|
|
868
1081
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -870,10 +1083,12 @@
|
|
|
870
1083
|
HostEvent["Delete"] = "delete";
|
|
871
1084
|
/**
|
|
872
1085
|
* Triggers the SpotIQAnalyze action on visualization or search
|
|
1086
|
+
*
|
|
873
1087
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
874
1088
|
* can be left empty for search and visualization embeds
|
|
875
1089
|
* @example
|
|
876
|
-
* liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId:
|
|
1090
|
+
* liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId:
|
|
1091
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
877
1092
|
* vizEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
878
1093
|
* searchEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
879
1094
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -881,26 +1096,34 @@
|
|
|
881
1096
|
HostEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
882
1097
|
/**
|
|
883
1098
|
* Triggers the Download action on visualization or search when Displaymode is Chart
|
|
1099
|
+
*
|
|
884
1100
|
* @example
|
|
885
|
-
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
1101
|
+
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
1102
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
886
1103
|
* vizEmbed.trigger(HostEvent.Download)
|
|
887
1104
|
* searchEmbed.trigger(HostEvent.Download)
|
|
888
1105
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
889
1106
|
*/
|
|
890
1107
|
HostEvent["Download"] = "download";
|
|
891
1108
|
/**
|
|
892
|
-
* Triggers the downloadAsCSV action on visualization or search when Displaymode is
|
|
1109
|
+
* Triggers the downloadAsCSV action on visualization or search when Displaymode is
|
|
1110
|
+
* Table
|
|
1111
|
+
*
|
|
893
1112
|
* @example
|
|
894
|
-
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
1113
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
1114
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
895
1115
|
* vizEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
896
1116
|
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
897
1117
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
898
1118
|
*/
|
|
899
1119
|
HostEvent["DownloadAsCsv"] = "downloadAsCSV";
|
|
900
1120
|
/**
|
|
901
|
-
* Triggers the downloadAsXLSX action on visualization or search when Displaymode is
|
|
1121
|
+
* Triggers the downloadAsXLSX action on visualization or search when Displaymode is
|
|
1122
|
+
* Table
|
|
1123
|
+
*
|
|
902
1124
|
* @example
|
|
903
|
-
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
1125
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
1126
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
904
1127
|
* vizEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
905
1128
|
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
906
1129
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
@@ -908,6 +1131,7 @@
|
|
|
908
1131
|
HostEvent["DownloadAsXlsx"] = "downloadAsXLSX";
|
|
909
1132
|
/**
|
|
910
1133
|
* Triggers the Share action on a liveboard or answer
|
|
1134
|
+
*
|
|
911
1135
|
* @example
|
|
912
1136
|
* liveboardEmbed.trigger(HostEvent.Share)
|
|
913
1137
|
* searchEmbed.trigger(HostEvent.Share)
|
|
@@ -916,6 +1140,7 @@
|
|
|
916
1140
|
HostEvent["Share"] = "share";
|
|
917
1141
|
/**
|
|
918
1142
|
* Trigger the Save action on a liveboard or answer
|
|
1143
|
+
*
|
|
919
1144
|
* @example
|
|
920
1145
|
* liveboardEmbed.trigger(HostEvent.Save)
|
|
921
1146
|
* searchEmbed.trigger(HostEvent.Save)
|
|
@@ -924,33 +1149,40 @@
|
|
|
924
1149
|
HostEvent["Save"] = "save";
|
|
925
1150
|
/**
|
|
926
1151
|
* Triggers the SyncToSheets action on visualization
|
|
1152
|
+
*
|
|
927
1153
|
* @param - an object with vizId as a key
|
|
928
1154
|
* @example
|
|
929
|
-
* liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId:
|
|
1155
|
+
* liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId:
|
|
1156
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
930
1157
|
* vizEmbed.trigger(HostEvent.SyncToSheets)
|
|
931
1158
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
932
1159
|
*/
|
|
933
1160
|
HostEvent["SyncToSheets"] = "sync-to-sheets";
|
|
934
1161
|
/**
|
|
935
1162
|
* Triggers the SyncToOtherApps action on visualization
|
|
1163
|
+
*
|
|
936
1164
|
* @param - an object with vizId as a key
|
|
937
1165
|
* @example
|
|
938
|
-
* liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId:
|
|
1166
|
+
* liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId:
|
|
1167
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
939
1168
|
* vizEmbed.trigger(HostEvent.SyncToOtherApps)
|
|
940
1169
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
941
1170
|
*/
|
|
942
1171
|
HostEvent["SyncToOtherApps"] = "sync-to-other-apps";
|
|
943
1172
|
/**
|
|
944
1173
|
* Triggers the ManagePipelines action on visualization
|
|
1174
|
+
*
|
|
945
1175
|
* @param - an object with vizId as a key
|
|
946
1176
|
* @example
|
|
947
|
-
* liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId:
|
|
1177
|
+
* liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId:
|
|
1178
|
+
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
948
1179
|
* vizEmbed.trigger(HostEvent.ManagePipelines)
|
|
949
1180
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
950
1181
|
*/
|
|
951
1182
|
HostEvent["ManagePipelines"] = "manage-pipeline";
|
|
952
1183
|
/**
|
|
953
1184
|
* Triggers the Reset search in answer
|
|
1185
|
+
*
|
|
954
1186
|
* @example
|
|
955
1187
|
* searchEmbed.trigger(HostEvent.SearchReset
|
|
956
1188
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.0.1-sw
|
|
@@ -978,6 +1210,7 @@
|
|
|
978
1210
|
// eslint-disable-next-line no-shadow
|
|
979
1211
|
var Param;
|
|
980
1212
|
(function (Param) {
|
|
1213
|
+
Param["EmbedApp"] = "embedApp";
|
|
981
1214
|
Param["DataSources"] = "dataSources";
|
|
982
1215
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
983
1216
|
Param["DisableActions"] = "disableAction";
|
|
@@ -1018,6 +1251,8 @@
|
|
|
1018
1251
|
Param["ContextMenuTrigger"] = "isContextMenuEnabledOnLeftClick";
|
|
1019
1252
|
Param["LinkOverride"] = "linkOverride";
|
|
1020
1253
|
Param["ShowInsertToSlide"] = "insertInToSlide";
|
|
1254
|
+
Param["PrimaryNavHidden"] = "primaryNavHidden";
|
|
1255
|
+
Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
|
|
1021
1256
|
})(Param || (Param = {}));
|
|
1022
1257
|
(function (Action) {
|
|
1023
1258
|
Action["Save"] = "save";
|
|
@@ -1265,6 +1500,7 @@
|
|
|
1265
1500
|
/**
|
|
1266
1501
|
* Parse and construct the ThoughtSpot hostname or IP address
|
|
1267
1502
|
* from the embed configuration object.
|
|
1503
|
+
*
|
|
1268
1504
|
* @param config
|
|
1269
1505
|
*/
|
|
1270
1506
|
const getThoughtSpotHost = (config) => {
|
|
@@ -1288,9 +1524,10 @@
|
|
|
1288
1524
|
return config.basepath;
|
|
1289
1525
|
}
|
|
1290
1526
|
const tsHost = getThoughtSpotHost(config);
|
|
1291
|
-
// This is to handle when e2e's. Search is run on pods for
|
|
1292
|
-
// with baseUrl=https://localhost:8443.
|
|
1293
|
-
// This is to handle when the developer is developing in their local
|
|
1527
|
+
// This is to handle when e2e's. Search is run on pods for
|
|
1528
|
+
// comp-blink-test-pipeline with baseUrl=https://localhost:8443.
|
|
1529
|
+
// This is to handle when the developer is developing in their local
|
|
1530
|
+
// environment.
|
|
1294
1531
|
if (tsHost.includes('://localhost') && !tsHost.includes(':8443')) {
|
|
1295
1532
|
return '';
|
|
1296
1533
|
}
|
|
@@ -7300,6 +7537,7 @@
|
|
|
7300
7537
|
let eventQueue = [];
|
|
7301
7538
|
/**
|
|
7302
7539
|
* Pushes the event with its Property key-value map to mixpanel.
|
|
7540
|
+
*
|
|
7303
7541
|
* @param eventId
|
|
7304
7542
|
* @param eventProps
|
|
7305
7543
|
*/
|
|
@@ -7310,6 +7548,9 @@
|
|
|
7310
7548
|
}
|
|
7311
7549
|
mixpanel_cjs.track(eventId, eventProps);
|
|
7312
7550
|
}
|
|
7551
|
+
/**
|
|
7552
|
+
*
|
|
7553
|
+
*/
|
|
7313
7554
|
function emptyQueue() {
|
|
7314
7555
|
if (!isMixpanelInitialized) {
|
|
7315
7556
|
return;
|
|
@@ -7319,11 +7560,16 @@
|
|
|
7319
7560
|
});
|
|
7320
7561
|
eventQueue = [];
|
|
7321
7562
|
}
|
|
7563
|
+
/**
|
|
7564
|
+
*
|
|
7565
|
+
* @param sessionInfo
|
|
7566
|
+
*/
|
|
7322
7567
|
function initMixpanel(sessionInfo) {
|
|
7323
7568
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
7324
7569
|
return;
|
|
7325
7570
|
}
|
|
7326
|
-
// On a public cluster the user is anonymous, so don't set the identify to
|
|
7571
|
+
// On a public cluster the user is anonymous, so don't set the identify to
|
|
7572
|
+
// userGUID
|
|
7327
7573
|
const isPublicCluster = !!sessionInfo.isPublicUser;
|
|
7328
7574
|
const token = sessionInfo.mixpanelToken;
|
|
7329
7575
|
if (token) {
|
|
@@ -8802,6 +9048,11 @@
|
|
|
8802
9048
|
var uniq_1 = uniq;
|
|
8803
9049
|
|
|
8804
9050
|
// eslint-disable-next-line import/no-cycle
|
|
9051
|
+
/**
|
|
9052
|
+
*
|
|
9053
|
+
* @param url
|
|
9054
|
+
* @param options
|
|
9055
|
+
*/
|
|
8805
9056
|
function failureLoggedFetch(url, options = {}) {
|
|
8806
9057
|
return fetch(url, options).then(async (r) => {
|
|
8807
9058
|
var _a;
|
|
@@ -8811,21 +9062,42 @@
|
|
|
8811
9062
|
return r;
|
|
8812
9063
|
});
|
|
8813
9064
|
}
|
|
9065
|
+
/**
|
|
9066
|
+
*
|
|
9067
|
+
* @param authVerificationUrl
|
|
9068
|
+
*/
|
|
8814
9069
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
8815
9070
|
return failureLoggedFetch(authVerificationUrl, {
|
|
8816
9071
|
credentials: 'include',
|
|
8817
9072
|
});
|
|
8818
9073
|
}
|
|
9074
|
+
/**
|
|
9075
|
+
*
|
|
9076
|
+
* @param authEndpoint
|
|
9077
|
+
*/
|
|
8819
9078
|
async function fetchAuthTokenService(authEndpoint) {
|
|
8820
9079
|
return fetch(authEndpoint);
|
|
8821
9080
|
}
|
|
9081
|
+
/**
|
|
9082
|
+
*
|
|
9083
|
+
* @param thoughtSpotHost
|
|
9084
|
+
* @param username
|
|
9085
|
+
* @param authToken
|
|
9086
|
+
*/
|
|
8822
9087
|
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
8823
9088
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
8824
9089
|
credentials: 'include',
|
|
8825
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9090
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9091
|
+
// error
|
|
8826
9092
|
redirect: 'manual',
|
|
8827
9093
|
});
|
|
8828
9094
|
}
|
|
9095
|
+
/**
|
|
9096
|
+
*
|
|
9097
|
+
* @param thoughtSpotHost
|
|
9098
|
+
* @param username
|
|
9099
|
+
* @param authToken
|
|
9100
|
+
*/
|
|
8829
9101
|
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
8830
9102
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
8831
9103
|
method: 'POST',
|
|
@@ -8835,10 +9107,17 @@
|
|
|
8835
9107
|
},
|
|
8836
9108
|
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
8837
9109
|
credentials: 'include',
|
|
8838
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9110
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
9111
|
+
// error
|
|
8839
9112
|
redirect: 'manual',
|
|
8840
9113
|
});
|
|
8841
9114
|
}
|
|
9115
|
+
/**
|
|
9116
|
+
*
|
|
9117
|
+
* @param thoughtSpotHost
|
|
9118
|
+
* @param username
|
|
9119
|
+
* @param password
|
|
9120
|
+
*/
|
|
8842
9121
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
8843
9122
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
8844
9123
|
method: 'POST',
|
|
@@ -8850,6 +9129,10 @@
|
|
|
8850
9129
|
credentials: 'include',
|
|
8851
9130
|
});
|
|
8852
9131
|
}
|
|
9132
|
+
/**
|
|
9133
|
+
*
|
|
9134
|
+
* @param thoughtSpotHost
|
|
9135
|
+
*/
|
|
8853
9136
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
8854
9137
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
8855
9138
|
credentials: 'include',
|
|
@@ -8908,20 +9191,29 @@
|
|
|
8908
9191
|
* Emitted when inPopup: true in the SAMLRedirect flow.
|
|
8909
9192
|
* And, we are waiting for popup to be triggered either programatically
|
|
8910
9193
|
* or by the trigger button.
|
|
9194
|
+
*
|
|
8911
9195
|
* @version SDK: 1.19.0
|
|
8912
9196
|
*/
|
|
8913
9197
|
AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
|
|
8914
9198
|
})(exports.AuthStatus || (exports.AuthStatus = {}));
|
|
8915
9199
|
(function (AuthEvent) {
|
|
8916
9200
|
/**
|
|
8917
|
-
* Manually trigger the SSO popup.
|
|
9201
|
+
* Manually trigger the SSO popup. This is useful with
|
|
9202
|
+
* authStatus: SAMLRedirect/OIDCRedicre and inPopup: true
|
|
8918
9203
|
*/
|
|
8919
9204
|
AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
|
|
8920
9205
|
})(exports.AuthEvent || (exports.AuthEvent = {}));
|
|
8921
9206
|
let authEE;
|
|
9207
|
+
/**
|
|
9208
|
+
*
|
|
9209
|
+
* @param eventEmitter
|
|
9210
|
+
*/
|
|
8922
9211
|
function setAuthEE(eventEmitter) {
|
|
8923
9212
|
authEE = eventEmitter;
|
|
8924
9213
|
}
|
|
9214
|
+
/**
|
|
9215
|
+
*
|
|
9216
|
+
*/
|
|
8925
9217
|
function notifyAuthSDKSuccess() {
|
|
8926
9218
|
if (!authEE) {
|
|
8927
9219
|
console.error('SDK not initialized');
|
|
@@ -8929,6 +9221,9 @@
|
|
|
8929
9221
|
}
|
|
8930
9222
|
authEE.emit(exports.AuthStatus.SDK_SUCCESS);
|
|
8931
9223
|
}
|
|
9224
|
+
/**
|
|
9225
|
+
*
|
|
9226
|
+
*/
|
|
8932
9227
|
function notifyAuthSuccess() {
|
|
8933
9228
|
if (!authEE) {
|
|
8934
9229
|
console.error('SDK not initialized');
|
|
@@ -8936,6 +9231,10 @@
|
|
|
8936
9231
|
}
|
|
8937
9232
|
authEE.emit(exports.AuthStatus.SUCCESS, sessionInfo);
|
|
8938
9233
|
}
|
|
9234
|
+
/**
|
|
9235
|
+
*
|
|
9236
|
+
* @param failureType
|
|
9237
|
+
*/
|
|
8939
9238
|
function notifyAuthFailure(failureType) {
|
|
8940
9239
|
if (!authEE) {
|
|
8941
9240
|
console.error('SDK not initialized');
|
|
@@ -8943,6 +9242,9 @@
|
|
|
8943
9242
|
}
|
|
8944
9243
|
authEE.emit(exports.AuthStatus.FAILURE, failureType);
|
|
8945
9244
|
}
|
|
9245
|
+
/**
|
|
9246
|
+
*
|
|
9247
|
+
*/
|
|
8946
9248
|
function notifyLogout() {
|
|
8947
9249
|
if (!authEE) {
|
|
8948
9250
|
console.error('SDK not initialized');
|
|
@@ -8952,6 +9254,7 @@
|
|
|
8952
9254
|
}
|
|
8953
9255
|
/**
|
|
8954
9256
|
* Check if we are logged into the ThoughtSpot cluster
|
|
9257
|
+
*
|
|
8955
9258
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
8956
9259
|
*/
|
|
8957
9260
|
async function isLoggedIn(thoughtSpotHost) {
|
|
@@ -8974,20 +9277,30 @@
|
|
|
8974
9277
|
return releaseVersion;
|
|
8975
9278
|
}
|
|
8976
9279
|
/**
|
|
8977
|
-
* Return a promise that resolves with the session
|
|
8978
|
-
* successful. And info is available.
|
|
9280
|
+
* Return a promise that resolves with the session information when
|
|
9281
|
+
* authentication is successful. And info is available.
|
|
9282
|
+
*
|
|
9283
|
+
* @group Global methods
|
|
8979
9284
|
*/
|
|
8980
9285
|
function getSessionInfo() {
|
|
8981
9286
|
return sessionInfoPromise;
|
|
8982
9287
|
}
|
|
9288
|
+
/**
|
|
9289
|
+
*
|
|
9290
|
+
* @param sessionDetails
|
|
9291
|
+
*/
|
|
8983
9292
|
function initSession(sessionDetails) {
|
|
8984
9293
|
sessionInfo = sessionDetails;
|
|
8985
9294
|
initMixpanel(sessionInfo);
|
|
8986
9295
|
sessionInfoResolver(sessionInfo);
|
|
8987
9296
|
}
|
|
8988
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
8989
|
-
'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
9297
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
9298
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
8990
9299
|
let prevAuthToken = null;
|
|
9300
|
+
/**
|
|
9301
|
+
*
|
|
9302
|
+
* @param authtoken
|
|
9303
|
+
*/
|
|
8991
9304
|
function alertForDuplicateToken(authtoken) {
|
|
8992
9305
|
if (prevAuthToken === authtoken) {
|
|
8993
9306
|
// eslint-disable-next-line no-alert
|
|
@@ -9007,9 +9320,10 @@
|
|
|
9007
9320
|
*/
|
|
9008
9321
|
function removeSSORedirectUrlMarker() {
|
|
9009
9322
|
// Note (sunny): This will leave a # around even if it was not in the URL
|
|
9010
|
-
// to begin with. Trying to remove the hash by changing window.location will
|
|
9011
|
-
// the page which we don't want. We'll live with adding an
|
|
9012
|
-
// parent page URL until we find any use case where
|
|
9323
|
+
// to begin with. Trying to remove the hash by changing window.location will
|
|
9324
|
+
// reload the page which we don't want. We'll live with adding an
|
|
9325
|
+
// unnecessary hash to the parent page URL until we find any use case where
|
|
9326
|
+
// that creates an issue.
|
|
9013
9327
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
9014
9328
|
}
|
|
9015
9329
|
const getAuthenticaionToken = async (embedConfig) => {
|
|
@@ -9027,6 +9341,7 @@
|
|
|
9027
9341
|
};
|
|
9028
9342
|
/**
|
|
9029
9343
|
* Perform token based authentication
|
|
9344
|
+
*
|
|
9030
9345
|
* @param embedConfig The embed configuration
|
|
9031
9346
|
*/
|
|
9032
9347
|
const doTokenAuth = async (embedConfig) => {
|
|
@@ -9047,8 +9362,8 @@
|
|
|
9047
9362
|
// token login issues a 302 when successful
|
|
9048
9363
|
loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
|
|
9049
9364
|
if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
|
|
9050
|
-
// When 3rd party cookie access is blocked, this will fail because
|
|
9051
|
-
// not be sent with the call.
|
|
9365
|
+
// When 3rd party cookie access is blocked, this will fail because
|
|
9366
|
+
// cookies will not be sent with the call.
|
|
9052
9367
|
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
9053
9368
|
}
|
|
9054
9369
|
}
|
|
@@ -9056,6 +9371,7 @@
|
|
|
9056
9371
|
};
|
|
9057
9372
|
/**
|
|
9058
9373
|
* Validate embedConfig parameters required for cookielessTokenAuth
|
|
9374
|
+
*
|
|
9059
9375
|
* @param embedConfig The embed configuration
|
|
9060
9376
|
*/
|
|
9061
9377
|
const doCookielessTokenAuth = async (embedConfig) => {
|
|
@@ -9071,6 +9387,7 @@
|
|
|
9071
9387
|
*
|
|
9072
9388
|
* Warning: This feature is primarily intended for developer testing. It is
|
|
9073
9389
|
* strongly advised not to use this authentication method in production.
|
|
9390
|
+
*
|
|
9074
9391
|
* @param embedConfig The embed configuration
|
|
9075
9392
|
*/
|
|
9076
9393
|
const doBasicAuth = async (embedConfig) => {
|
|
@@ -9088,6 +9405,12 @@
|
|
|
9088
9405
|
}
|
|
9089
9406
|
return loggedInStatus;
|
|
9090
9407
|
};
|
|
9408
|
+
/**
|
|
9409
|
+
*
|
|
9410
|
+
* @param ssoURL
|
|
9411
|
+
* @param triggerContainer
|
|
9412
|
+
* @param triggerText
|
|
9413
|
+
*/
|
|
9091
9414
|
async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
9092
9415
|
const openPopup = () => {
|
|
9093
9416
|
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
@@ -9100,28 +9423,28 @@
|
|
|
9100
9423
|
authEE === null || authEE === void 0 ? void 0 : authEE.emit(exports.AuthStatus.WAITING_FOR_POPUP);
|
|
9101
9424
|
const containerEl = getDOMNode(triggerContainer);
|
|
9102
9425
|
if (containerEl) {
|
|
9103
|
-
containerEl.innerHTML =
|
|
9104
|
-
'<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9426
|
+
containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9105
9427
|
const authElem = document.getElementById('ts-auth-btn');
|
|
9106
9428
|
authElem.textContent = triggerText;
|
|
9107
9429
|
authElem.addEventListener('click', openPopup, { once: true });
|
|
9108
9430
|
}
|
|
9109
|
-
samlCompletionPromise =
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
}
|
|
9117
|
-
});
|
|
9431
|
+
samlCompletionPromise = samlCompletionPromise
|
|
9432
|
+
|| new Promise((resolve, reject) => {
|
|
9433
|
+
window.addEventListener('message', (e) => {
|
|
9434
|
+
if (e.data.type === exports.EmbedEvent.SAMLComplete) {
|
|
9435
|
+
e.source.close();
|
|
9436
|
+
resolve();
|
|
9437
|
+
}
|
|
9118
9438
|
});
|
|
9439
|
+
});
|
|
9119
9440
|
authEE === null || authEE === void 0 ? void 0 : authEE.once(exports.AuthEvent.TRIGGER_SSO_POPUP, openPopup);
|
|
9120
9441
|
return samlCompletionPromise;
|
|
9121
9442
|
}
|
|
9122
9443
|
/**
|
|
9123
9444
|
* Perform SAML authentication
|
|
9445
|
+
*
|
|
9124
9446
|
* @param embedConfig The embed configuration
|
|
9447
|
+
* @param ssoEndPoint
|
|
9125
9448
|
*/
|
|
9126
9449
|
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
9127
9450
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -9150,8 +9473,8 @@
|
|
|
9150
9473
|
};
|
|
9151
9474
|
const doSamlAuth = async (embedConfig) => {
|
|
9152
9475
|
const { thoughtSpotHost } = embedConfig;
|
|
9153
|
-
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9154
|
-
// again and the same JS will execute again.
|
|
9476
|
+
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9477
|
+
// loaded again and the same JS will execute again.
|
|
9155
9478
|
const ssoRedirectUrl = embedConfig.inPopup
|
|
9156
9479
|
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
9157
9480
|
: getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
|
|
@@ -9162,8 +9485,8 @@
|
|
|
9162
9485
|
};
|
|
9163
9486
|
const doOIDCAuth = async (embedConfig) => {
|
|
9164
9487
|
const { thoughtSpotHost } = embedConfig;
|
|
9165
|
-
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9166
|
-
// again and the same JS will execute again.
|
|
9488
|
+
// redirect for SSO, when the SSO authentication is done, this page will be
|
|
9489
|
+
// loaded again and the same JS will execute again.
|
|
9167
9490
|
const ssoRedirectUrl = embedConfig.noRedirect || embedConfig.inPopup
|
|
9168
9491
|
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
9169
9492
|
: getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
|
|
@@ -9180,6 +9503,7 @@
|
|
|
9180
9503
|
};
|
|
9181
9504
|
/**
|
|
9182
9505
|
* Perform authentication on the ThoughtSpot cluster
|
|
9506
|
+
*
|
|
9183
9507
|
* @param embedConfig The embed configuration
|
|
9184
9508
|
*/
|
|
9185
9509
|
const authenticate = async (embedConfig) => {
|
|
@@ -9212,6 +9536,13 @@
|
|
|
9212
9536
|
authType: exports.AuthType.None,
|
|
9213
9537
|
};
|
|
9214
9538
|
let authPromise;
|
|
9539
|
+
/**
|
|
9540
|
+
* Gets the configuration embed was initialized with.
|
|
9541
|
+
*
|
|
9542
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
9543
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
9544
|
+
* @group Global methods
|
|
9545
|
+
*/
|
|
9215
9546
|
const getEmbedConfig = () => config;
|
|
9216
9547
|
const getAuthPromise = () => authPromise;
|
|
9217
9548
|
/**
|
|
@@ -9238,10 +9569,14 @@
|
|
|
9238
9569
|
[exports.PrefetchFeatures.VizEmbed]: (url) => url,
|
|
9239
9570
|
};
|
|
9240
9571
|
/**
|
|
9241
|
-
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
9572
|
+
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
9573
|
+
* prefetched resources and serve them from the user's local disk to provide faster access
|
|
9574
|
+
* to your app.
|
|
9575
|
+
*
|
|
9242
9576
|
* @param url The URL provided for prefetch
|
|
9243
9577
|
* @param prefetchFeatures Specify features which needs to be prefetched.
|
|
9244
9578
|
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
|
|
9579
|
+
* @group Global methods
|
|
9245
9580
|
*/
|
|
9246
9581
|
const prefetch = (url, prefetchFeatures) => {
|
|
9247
9582
|
if (url === '') {
|
|
@@ -9264,6 +9599,10 @@
|
|
|
9264
9599
|
});
|
|
9265
9600
|
}
|
|
9266
9601
|
};
|
|
9602
|
+
/**
|
|
9603
|
+
*
|
|
9604
|
+
* @param embedConfig
|
|
9605
|
+
*/
|
|
9267
9606
|
function sanity(embedConfig) {
|
|
9268
9607
|
if (embedConfig.thoughtSpotHost === undefined) {
|
|
9269
9608
|
throw new Error('ThoughtSpot host not provided');
|
|
@@ -9272,16 +9611,18 @@
|
|
|
9272
9611
|
if (!embedConfig.username) {
|
|
9273
9612
|
throw new Error('Username not provided with Trusted auth');
|
|
9274
9613
|
}
|
|
9275
|
-
if (!embedConfig.authEndpoint &&
|
|
9276
|
-
typeof embedConfig.getAuthToken !== 'function') {
|
|
9614
|
+
if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
|
|
9277
9615
|
throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
|
|
9278
9616
|
}
|
|
9279
9617
|
}
|
|
9280
9618
|
}
|
|
9619
|
+
/**
|
|
9620
|
+
*
|
|
9621
|
+
* @param embedConfig
|
|
9622
|
+
*/
|
|
9281
9623
|
function backwardCompat(embedConfig) {
|
|
9282
9624
|
const newConfig = { ...embedConfig };
|
|
9283
|
-
if (embedConfig.noRedirect !== undefined &&
|
|
9284
|
-
embedConfig.inPopup === undefined) {
|
|
9625
|
+
if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
|
|
9285
9626
|
newConfig.inPopup = embedConfig.noRedirect;
|
|
9286
9627
|
}
|
|
9287
9628
|
return newConfig;
|
|
@@ -9289,12 +9630,21 @@
|
|
|
9289
9630
|
/**
|
|
9290
9631
|
* Initializes the Visual Embed SDK globally and perform
|
|
9291
9632
|
* authentication if applicable.
|
|
9633
|
+
*
|
|
9292
9634
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
9293
9635
|
* authentication mechanism and so on.
|
|
9294
|
-
* example
|
|
9295
|
-
*
|
|
9296
|
-
*
|
|
9636
|
+
* @example
|
|
9637
|
+
* ```js
|
|
9638
|
+
* const authStatus = init({
|
|
9639
|
+
* thoughtSpotHost: 'https://my.thoughtspot.cloud',
|
|
9640
|
+
* authType: AuthType.None,
|
|
9641
|
+
* });
|
|
9642
|
+
* authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
|
|
9643
|
+
* ```
|
|
9644
|
+
* @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
|
|
9645
|
+
* failure and logout. See {@link AuthStatus}
|
|
9297
9646
|
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
9647
|
+
* @group Authentication / Init
|
|
9298
9648
|
*/
|
|
9299
9649
|
const init = (embedConfig) => {
|
|
9300
9650
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -9313,8 +9663,7 @@
|
|
|
9313
9663
|
host: config.thoughtSpotHost,
|
|
9314
9664
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
9315
9665
|
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,
|
|
9316
|
-
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) !=
|
|
9317
|
-
null,
|
|
9666
|
+
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,
|
|
9318
9667
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
9319
9668
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
9320
9669
|
});
|
|
@@ -9323,19 +9672,23 @@
|
|
|
9323
9672
|
}
|
|
9324
9673
|
return authEE;
|
|
9325
9674
|
};
|
|
9675
|
+
/**
|
|
9676
|
+
*
|
|
9677
|
+
*/
|
|
9326
9678
|
function disableAutoLogin() {
|
|
9327
9679
|
config.autoLogin = false;
|
|
9328
9680
|
}
|
|
9329
9681
|
/**
|
|
9330
|
-
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
9331
|
-
* the SDK from automatically logging in again.
|
|
9682
|
+
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
9683
|
+
* prevent the SDK from automatically logging in again.
|
|
9332
9684
|
*
|
|
9333
|
-
* You can call the `init` method again to re login, if autoLogin is set to
|
|
9334
|
-
* second call it will be honored.
|
|
9685
|
+
* You can call the `init` method again to re login, if autoLogin is set to
|
|
9686
|
+
* true in this second call it will be honored.
|
|
9335
9687
|
*
|
|
9336
9688
|
* @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
|
|
9337
9689
|
* @returns Promise which resolves when logout completes.
|
|
9338
9690
|
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
9691
|
+
* @group Global methods
|
|
9339
9692
|
*/
|
|
9340
9693
|
const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
9341
9694
|
if (!doNotDisableAutoLogin) {
|
|
@@ -9348,7 +9701,9 @@
|
|
|
9348
9701
|
};
|
|
9349
9702
|
let renderQueue = Promise.resolve();
|
|
9350
9703
|
/**
|
|
9351
|
-
* Renders functions in a queue, resolves to next function only after the callback next
|
|
9704
|
+
* Renders functions in a queue, resolves to next function only after the callback next
|
|
9705
|
+
* is called
|
|
9706
|
+
*
|
|
9352
9707
|
* @param fn The function being registered
|
|
9353
9708
|
*/
|
|
9354
9709
|
const renderInQueue = (fn) => {
|
|
@@ -9361,6 +9716,13 @@
|
|
|
9361
9716
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
9362
9717
|
};
|
|
9363
9718
|
|
|
9719
|
+
/**
|
|
9720
|
+
*
|
|
9721
|
+
* @param session
|
|
9722
|
+
* @param query
|
|
9723
|
+
* @param operation
|
|
9724
|
+
* @param thoughtSpotHost
|
|
9725
|
+
*/
|
|
9364
9726
|
function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
|
|
9365
9727
|
let variable;
|
|
9366
9728
|
const fetchQuery = async (variables) => {
|
|
@@ -9410,12 +9772,14 @@
|
|
|
9410
9772
|
};
|
|
9411
9773
|
}
|
|
9412
9774
|
|
|
9775
|
+
/**
|
|
9776
|
+
*
|
|
9777
|
+
* @param e
|
|
9778
|
+
* @param thoughtSpotHost
|
|
9779
|
+
*/
|
|
9413
9780
|
function processCustomAction(e, thoughtSpotHost) {
|
|
9414
9781
|
var _a;
|
|
9415
|
-
if ([
|
|
9416
|
-
OperationType.GetChartWithData,
|
|
9417
|
-
OperationType.GetTableWithHeadlineData,
|
|
9418
|
-
].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
|
|
9782
|
+
if ([OperationType.GetChartWithData, OperationType.GetTableWithHeadlineData].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
|
|
9419
9783
|
const { session, query, operation } = e.data;
|
|
9420
9784
|
const answerService = getAnswerServiceInstance(session, query, operation, thoughtSpotHost);
|
|
9421
9785
|
return {
|
|
@@ -9425,6 +9789,10 @@
|
|
|
9425
9789
|
}
|
|
9426
9790
|
return e;
|
|
9427
9791
|
}
|
|
9792
|
+
/**
|
|
9793
|
+
*
|
|
9794
|
+
* @param e
|
|
9795
|
+
*/
|
|
9428
9796
|
function processAuthInit(e) {
|
|
9429
9797
|
var _a, _b;
|
|
9430
9798
|
// Store user session details sent by app.
|
|
@@ -9438,8 +9806,13 @@
|
|
|
9438
9806
|
},
|
|
9439
9807
|
};
|
|
9440
9808
|
}
|
|
9809
|
+
/**
|
|
9810
|
+
*
|
|
9811
|
+
* @param e
|
|
9812
|
+
* @param containerEl
|
|
9813
|
+
*/
|
|
9441
9814
|
function processNoCookieAccess(e, containerEl) {
|
|
9442
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert
|
|
9815
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert } = getEmbedConfig();
|
|
9443
9816
|
if (!suppressNoCookieAccessAlert) {
|
|
9444
9817
|
// eslint-disable-next-line no-alert
|
|
9445
9818
|
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.');
|
|
@@ -9449,6 +9822,11 @@
|
|
|
9449
9822
|
notifyAuthFailure(exports.AuthFailureType.NO_COOKIE_ACCESS);
|
|
9450
9823
|
return e;
|
|
9451
9824
|
}
|
|
9825
|
+
/**
|
|
9826
|
+
*
|
|
9827
|
+
* @param e
|
|
9828
|
+
* @param containerEl
|
|
9829
|
+
*/
|
|
9452
9830
|
function processAuthFailure(e, containerEl) {
|
|
9453
9831
|
const { loginFailedMessage, authType } = getEmbedConfig();
|
|
9454
9832
|
if (authType !== exports.AuthType.None) {
|
|
@@ -9458,6 +9836,11 @@
|
|
|
9458
9836
|
}
|
|
9459
9837
|
return e;
|
|
9460
9838
|
}
|
|
9839
|
+
/**
|
|
9840
|
+
*
|
|
9841
|
+
* @param e
|
|
9842
|
+
* @param containerEl
|
|
9843
|
+
*/
|
|
9461
9844
|
function processAuthLogout(e, containerEl) {
|
|
9462
9845
|
const { loginFailedMessage } = getEmbedConfig();
|
|
9463
9846
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -9466,6 +9849,13 @@
|
|
|
9466
9849
|
notifyLogout();
|
|
9467
9850
|
return e;
|
|
9468
9851
|
}
|
|
9852
|
+
/**
|
|
9853
|
+
*
|
|
9854
|
+
* @param type
|
|
9855
|
+
* @param e
|
|
9856
|
+
* @param thoughtSpotHost
|
|
9857
|
+
* @param containerEl
|
|
9858
|
+
*/
|
|
9469
9859
|
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
9470
9860
|
switch (type) {
|
|
9471
9861
|
case exports.EmbedEvent.CustomAction:
|
|
@@ -9484,6 +9874,8 @@
|
|
|
9484
9874
|
|
|
9485
9875
|
/**
|
|
9486
9876
|
* Reloads the ThoughtSpot iframe.
|
|
9877
|
+
*
|
|
9878
|
+
* @param iFrame
|
|
9487
9879
|
*/
|
|
9488
9880
|
function reload(iFrame) {
|
|
9489
9881
|
const oldFrame = iFrame.cloneNode();
|
|
@@ -9493,13 +9885,25 @@
|
|
|
9493
9885
|
}
|
|
9494
9886
|
/**
|
|
9495
9887
|
* Post Iframe message.
|
|
9888
|
+
*
|
|
9889
|
+
* @param iFrame
|
|
9890
|
+
* @param message
|
|
9891
|
+
* @param message.type
|
|
9892
|
+
* @param message.data
|
|
9893
|
+
* @param thoughtSpotHost
|
|
9894
|
+
* @param channel
|
|
9496
9895
|
*/
|
|
9497
9896
|
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
9498
|
-
return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [
|
|
9499
|
-
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
9500
|
-
]);
|
|
9897
|
+
return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
|
|
9501
9898
|
}
|
|
9502
9899
|
const TRIGGER_TIMEOUT = 30000;
|
|
9900
|
+
/**
|
|
9901
|
+
*
|
|
9902
|
+
* @param iFrame
|
|
9903
|
+
* @param messageType
|
|
9904
|
+
* @param thoughtSpotHost
|
|
9905
|
+
* @param data
|
|
9906
|
+
*/
|
|
9503
9907
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
9504
9908
|
return new Promise((res, rej) => {
|
|
9505
9909
|
if (messageType === exports.HostEvent.Reload) {
|
|
@@ -9525,7 +9929,7 @@
|
|
|
9525
9929
|
});
|
|
9526
9930
|
}
|
|
9527
9931
|
|
|
9528
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.
|
|
9932
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-alpha.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$1={".":"./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$1,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};
|
|
9529
9933
|
|
|
9530
9934
|
/**
|
|
9531
9935
|
* Copyright (c) 2022
|
|
@@ -9545,6 +9949,7 @@
|
|
|
9545
9949
|
* The event id map from v2 event names to v1 event id
|
|
9546
9950
|
* v1 events are the classic embed events implemented in Blink v1
|
|
9547
9951
|
* We cannot rename v1 event types to maintain backward compatibility
|
|
9952
|
+
*
|
|
9548
9953
|
* @internal
|
|
9549
9954
|
*/
|
|
9550
9955
|
const V1EventMap = {};
|
|
@@ -9555,22 +9960,28 @@
|
|
|
9555
9960
|
*/
|
|
9556
9961
|
class TsEmbed {
|
|
9557
9962
|
constructor(domSelector, viewConfig) {
|
|
9963
|
+
this.isAppInitialized = false;
|
|
9558
9964
|
/**
|
|
9559
9965
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
9560
9966
|
* will generate for embedding. This provides additional security to
|
|
9561
9967
|
* thoughtspot clusters against Cross site scripting attacks.
|
|
9968
|
+
*
|
|
9562
9969
|
* @default false
|
|
9563
9970
|
*/
|
|
9564
9971
|
this.shouldEncodeUrlQueryParams = false;
|
|
9565
9972
|
this.defaultHiddenActions = [exports.Action.ReportError];
|
|
9566
9973
|
/**
|
|
9567
9974
|
* Send Custom style as part of payload of APP_INIT
|
|
9975
|
+
*
|
|
9976
|
+
* @param _
|
|
9977
|
+
* @param responder
|
|
9568
9978
|
*/
|
|
9569
9979
|
this.appInitCb = async (_, responder) => {
|
|
9570
9980
|
let authToken = '';
|
|
9571
9981
|
if (this.embedConfig.authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
9572
9982
|
authToken = await getAuthenticaionToken(this.embedConfig);
|
|
9573
9983
|
}
|
|
9984
|
+
this.isAppInitialized = true;
|
|
9574
9985
|
responder({
|
|
9575
9986
|
type: exports.EmbedEvent.APP_INIT,
|
|
9576
9987
|
data: {
|
|
@@ -9581,6 +9992,9 @@
|
|
|
9581
9992
|
};
|
|
9582
9993
|
/**
|
|
9583
9994
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
9995
|
+
*
|
|
9996
|
+
* @param _
|
|
9997
|
+
* @param responder
|
|
9584
9998
|
*/
|
|
9585
9999
|
this.updateAuthToken = async (_, responder) => {
|
|
9586
10000
|
const { autoLogin = false, authType } = this.embedConfig; // Set autoLogin default to false
|
|
@@ -9622,6 +10036,7 @@
|
|
|
9622
10036
|
}
|
|
9623
10037
|
/**
|
|
9624
10038
|
* Handles errors within the SDK
|
|
10039
|
+
*
|
|
9625
10040
|
* @param error The error message or object
|
|
9626
10041
|
*/
|
|
9627
10042
|
handleError(error) {
|
|
@@ -9634,6 +10049,7 @@
|
|
|
9634
10049
|
}
|
|
9635
10050
|
/**
|
|
9636
10051
|
* Extracts the type field from the event payload
|
|
10052
|
+
*
|
|
9637
10053
|
* @param event The window message event
|
|
9638
10054
|
*/
|
|
9639
10055
|
getEventType(event) {
|
|
@@ -9643,6 +10059,7 @@
|
|
|
9643
10059
|
}
|
|
9644
10060
|
/**
|
|
9645
10061
|
* Extracts the port field from the event payload
|
|
10062
|
+
*
|
|
9646
10063
|
* @param event The window message event
|
|
9647
10064
|
* @returns
|
|
9648
10065
|
*/
|
|
@@ -9655,6 +10072,9 @@
|
|
|
9655
10072
|
/**
|
|
9656
10073
|
* fix for ts7.sep.cl
|
|
9657
10074
|
* will be removed for ts7.oct.cl
|
|
10075
|
+
*
|
|
10076
|
+
* @param event
|
|
10077
|
+
* @param eventType
|
|
9658
10078
|
* @hidden
|
|
9659
10079
|
*/
|
|
9660
10080
|
formatEventData(event, eventType) {
|
|
@@ -9685,33 +10105,31 @@
|
|
|
9685
10105
|
}
|
|
9686
10106
|
/**
|
|
9687
10107
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
10108
|
+
*
|
|
10109
|
+
* @param query
|
|
9688
10110
|
*/
|
|
9689
10111
|
getEmbedBasePath(query) {
|
|
9690
10112
|
let queryString = query;
|
|
9691
10113
|
if (this.shouldEncodeUrlQueryParams) {
|
|
9692
10114
|
queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString.substr(1))}`;
|
|
9693
10115
|
}
|
|
9694
|
-
const basePath = [
|
|
9695
|
-
this.thoughtSpotHost,
|
|
9696
|
-
this.thoughtSpotV2Base,
|
|
9697
|
-
queryString,
|
|
9698
|
-
]
|
|
10116
|
+
const basePath = [this.thoughtSpotHost, this.thoughtSpotV2Base, queryString]
|
|
9699
10117
|
.filter((x) => x.length > 0)
|
|
9700
10118
|
.join('/');
|
|
9701
|
-
return `${basePath}
|
|
10119
|
+
return `${basePath}#`;
|
|
9702
10120
|
}
|
|
9703
10121
|
/**
|
|
9704
10122
|
* Common query params set for all the embed modes.
|
|
10123
|
+
*
|
|
10124
|
+
* @param queryParams
|
|
9705
10125
|
* @returns queryParams
|
|
9706
10126
|
*/
|
|
9707
|
-
getBaseQueryParams() {
|
|
10127
|
+
getBaseQueryParams(queryParams = {}) {
|
|
9708
10128
|
var _a, _b;
|
|
9709
|
-
const queryParams = {};
|
|
9710
10129
|
let hostAppUrl = ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '';
|
|
9711
|
-
// The below check is needed because TS Cloud firewall, blocks
|
|
9712
|
-
// in any url param.
|
|
9713
|
-
if (hostAppUrl.includes('localhost') ||
|
|
9714
|
-
hostAppUrl.includes('127.0.0.1')) {
|
|
10130
|
+
// The below check is needed because TS Cloud firewall, blocks
|
|
10131
|
+
// localhost/127.0.0.1 in any url param.
|
|
10132
|
+
if (hostAppUrl.includes('localhost') || hostAppUrl.includes('127.0.0.1')) {
|
|
9715
10133
|
hostAppUrl = 'local-host';
|
|
9716
10134
|
}
|
|
9717
10135
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
@@ -9719,8 +10137,7 @@
|
|
|
9719
10137
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9720
10138
|
queryParams[Param.Version] = version$1;
|
|
9721
10139
|
queryParams[Param.AuthType] = this.embedConfig.authType;
|
|
9722
|
-
if (this.embedConfig.disableLoginRedirect === true ||
|
|
9723
|
-
this.embedConfig.autoLogin === true) {
|
|
10140
|
+
if (this.embedConfig.disableLoginRedirect === true || this.embedConfig.autoLogin === true) {
|
|
9724
10141
|
queryParams[Param.DisableLoginRedirect] = true;
|
|
9725
10142
|
}
|
|
9726
10143
|
if (this.embedConfig.authType === exports.AuthType.EmbeddedSSO) {
|
|
@@ -9735,8 +10152,7 @@
|
|
|
9735
10152
|
return queryParams;
|
|
9736
10153
|
}
|
|
9737
10154
|
// TODO remove embedConfig.customCssUrl
|
|
9738
|
-
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) ||
|
|
9739
|
-
this.embedConfig.customCssUrl;
|
|
10155
|
+
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) || this.embedConfig.customCssUrl;
|
|
9740
10156
|
if (cssUrlParam) {
|
|
9741
10157
|
queryParams[Param.CustomCSSUrl] = cssUrlParam;
|
|
9742
10158
|
}
|
|
@@ -9746,15 +10162,14 @@
|
|
|
9746
10162
|
if (disabledActionReason) {
|
|
9747
10163
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
9748
10164
|
}
|
|
9749
|
-
queryParams[Param.HideActions] = [
|
|
9750
|
-
...this.defaultHiddenActions,
|
|
9751
|
-
...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
|
|
9752
|
-
];
|
|
10165
|
+
queryParams[Param.HideActions] = [...this.defaultHiddenActions, ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : [])];
|
|
9753
10166
|
if (Array.isArray(visibleActions)) {
|
|
9754
10167
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
9755
10168
|
}
|
|
9756
|
-
/**
|
|
9757
|
-
*
|
|
10169
|
+
/**
|
|
10170
|
+
* Default behavior for context menu will be left-click
|
|
10171
|
+
* from version 9.2.0.cl the user have an option to override context
|
|
10172
|
+
* menu click
|
|
9758
10173
|
*/
|
|
9759
10174
|
if (contextMenuTrigger === ContextMenuTriggerOptions.LEFT_CLICK) {
|
|
9760
10175
|
queryParams[Param.ContextMenuTrigger] = true;
|
|
@@ -9786,32 +10201,61 @@
|
|
|
9786
10201
|
/**
|
|
9787
10202
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
9788
10203
|
* This is used for embedding Liveboards, visualizations, and full application.
|
|
10204
|
+
*
|
|
9789
10205
|
* @param queryString The query string to append to the URL.
|
|
9790
10206
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
9791
10207
|
* the full application.
|
|
9792
10208
|
*/
|
|
9793
|
-
getV1EmbedBasePath(queryString
|
|
9794
|
-
const
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
const
|
|
9798
|
-
let queryParams = `?embedApp=true${isAppEmbed ? primaryNavParam : ''}${isAppEmbed ? disableProfileAndHelpParam : ''}${enableSearchAssist ? enableSearchAssistParam : ''}${queryStringFrag}`;
|
|
9799
|
-
if (this.shouldEncodeUrlQueryParams) {
|
|
9800
|
-
queryParams = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryParams.substr(1))}`;
|
|
9801
|
-
}
|
|
9802
|
-
let path = `${this.thoughtSpotHost}/${queryParams}#`;
|
|
9803
|
-
if (!isAppEmbed) {
|
|
9804
|
-
path = `${path}/embed`;
|
|
9805
|
-
}
|
|
10209
|
+
getV1EmbedBasePath(queryString) {
|
|
10210
|
+
const queryParams = this.shouldEncodeUrlQueryParams
|
|
10211
|
+
? `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString)}`
|
|
10212
|
+
: `?${queryString}`;
|
|
10213
|
+
const path = `${this.thoughtSpotHost}/${queryParams}#`;
|
|
9806
10214
|
return path;
|
|
9807
10215
|
}
|
|
10216
|
+
getEmbedParams() {
|
|
10217
|
+
const queryParams = this.getBaseQueryParams();
|
|
10218
|
+
return getQueryParamString(queryParams);
|
|
10219
|
+
}
|
|
10220
|
+
getRootIframeSrc() {
|
|
10221
|
+
const query = this.getEmbedParams();
|
|
10222
|
+
return this.getEmbedBasePath(query);
|
|
10223
|
+
}
|
|
10224
|
+
createIframeEl(frameSrc) {
|
|
10225
|
+
const iFrame = document.createElement('iframe');
|
|
10226
|
+
iFrame.src = frameSrc;
|
|
10227
|
+
iFrame.id = TS_EMBED_ID;
|
|
10228
|
+
// according to screenfull.js documentation
|
|
10229
|
+
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be
|
|
10230
|
+
// true
|
|
10231
|
+
iFrame.allowFullscreen = true;
|
|
10232
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10233
|
+
// @ts-ignore
|
|
10234
|
+
iFrame.webkitallowfullscreen = true;
|
|
10235
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10236
|
+
// @ts-ignore
|
|
10237
|
+
iFrame.mozallowfullscreen = true;
|
|
10238
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10239
|
+
// @ts-ignore
|
|
10240
|
+
iFrame.allow = 'clipboard-read; clipboard-write';
|
|
10241
|
+
const { height: frameHeight, width: frameWidth, ...restParams } = this.viewConfig.frameParams || {};
|
|
10242
|
+
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
10243
|
+
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
10244
|
+
setAttributes(iFrame, restParams);
|
|
10245
|
+
iFrame.style.width = `${width}`;
|
|
10246
|
+
iFrame.style.height = `${height}`;
|
|
10247
|
+
iFrame.style.border = '0';
|
|
10248
|
+
iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
10249
|
+
return iFrame;
|
|
10250
|
+
}
|
|
9808
10251
|
/**
|
|
9809
10252
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
9810
10253
|
* event listeners.
|
|
10254
|
+
*
|
|
9811
10255
|
* @param url
|
|
9812
10256
|
* @param frameOptions
|
|
9813
10257
|
*/
|
|
9814
|
-
async renderIFrame(url
|
|
10258
|
+
async renderIFrame(url) {
|
|
9815
10259
|
if (this.isError) {
|
|
9816
10260
|
return null;
|
|
9817
10261
|
}
|
|
@@ -9835,30 +10279,7 @@
|
|
|
9835
10279
|
return;
|
|
9836
10280
|
}
|
|
9837
10281
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
9838
|
-
this.iFrame =
|
|
9839
|
-
this.iFrame || document.createElement('iframe');
|
|
9840
|
-
this.iFrame.src = url;
|
|
9841
|
-
this.iFrame.id = TS_EMBED_ID;
|
|
9842
|
-
// according to screenfull.js documentation
|
|
9843
|
-
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be true
|
|
9844
|
-
this.iFrame.allowFullscreen = true;
|
|
9845
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9846
|
-
// @ts-ignore
|
|
9847
|
-
this.iFrame.webkitallowfullscreen = true;
|
|
9848
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9849
|
-
// @ts-ignore
|
|
9850
|
-
this.iFrame.mozallowfullscreen = true;
|
|
9851
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9852
|
-
// @ts-ignore
|
|
9853
|
-
this.iFrame.allow = 'clipboard-read; clipboard-write';
|
|
9854
|
-
const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
|
|
9855
|
-
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
9856
|
-
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
9857
|
-
setAttributes(this.iFrame, restParams);
|
|
9858
|
-
this.iFrame.style.width = `${width}`;
|
|
9859
|
-
this.iFrame.style.height = `${height}`;
|
|
9860
|
-
this.iFrame.style.border = '0';
|
|
9861
|
-
this.iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
10282
|
+
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
9862
10283
|
this.iFrame.addEventListener('load', () => {
|
|
9863
10284
|
nextInQueue();
|
|
9864
10285
|
const loadTimestamp = Date.now();
|
|
@@ -9885,7 +10306,9 @@
|
|
|
9885
10306
|
this.subscribeToEvents();
|
|
9886
10307
|
}).catch((error) => {
|
|
9887
10308
|
nextInQueue();
|
|
9888
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
10309
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
10310
|
+
error: JSON.stringify(error),
|
|
10311
|
+
});
|
|
9889
10312
|
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9890
10313
|
this.handleError(error);
|
|
9891
10314
|
});
|
|
@@ -9919,6 +10342,7 @@
|
|
|
9919
10342
|
}
|
|
9920
10343
|
/**
|
|
9921
10344
|
* Sets the height of the iframe
|
|
10345
|
+
*
|
|
9922
10346
|
* @param height The height in pixels
|
|
9923
10347
|
*/
|
|
9924
10348
|
setIFrameHeight(height) {
|
|
@@ -9926,21 +10350,24 @@
|
|
|
9926
10350
|
}
|
|
9927
10351
|
/**
|
|
9928
10352
|
* Executes all registered event handlers for a particular event type
|
|
10353
|
+
*
|
|
9929
10354
|
* @param eventType The event type
|
|
9930
10355
|
* @param data The payload invoked with the event handler
|
|
9931
10356
|
* @param eventPort The event Port for a specific MessageChannel
|
|
9932
10357
|
*/
|
|
9933
10358
|
executeCallbacks(eventType, data, eventPort) {
|
|
9934
|
-
const
|
|
10359
|
+
const eventHandlers = this.eventHandlerMap.get(eventType) || [];
|
|
9935
10360
|
const allHandlers = this.eventHandlerMap.get(exports.EmbedEvent.ALL) || [];
|
|
9936
|
-
callbacks
|
|
10361
|
+
const callbacks = [...eventHandlers, ...allHandlers];
|
|
9937
10362
|
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9938
10363
|
callbacks.forEach((callbackObj) => {
|
|
9939
|
-
if (
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
10364
|
+
if (
|
|
10365
|
+
// When start status is true it trigger only start releated
|
|
10366
|
+
// payload
|
|
10367
|
+
(callbackObj.options.start && dataStatus === embedEventStatus.START)
|
|
10368
|
+
// When start status is false it trigger only end releated
|
|
10369
|
+
// payload
|
|
10370
|
+
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
9944
10371
|
callbackObj.callback(data, (payload) => {
|
|
9945
10372
|
this.triggerEventOnPort(eventPort, payload);
|
|
9946
10373
|
});
|
|
@@ -9955,6 +10382,7 @@
|
|
|
9955
10382
|
}
|
|
9956
10383
|
/**
|
|
9957
10384
|
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
10385
|
+
*
|
|
9958
10386
|
* @param eventType The v2 event type
|
|
9959
10387
|
* @returns The corresponding v1 event type if one exists
|
|
9960
10388
|
* or else the v2 event type itself
|
|
@@ -9966,6 +10394,7 @@
|
|
|
9966
10394
|
* Calculates the iframe center for the current visible viewPort
|
|
9967
10395
|
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
9968
10396
|
* in Host app. ViewPort height of the tab.
|
|
10397
|
+
*
|
|
9969
10398
|
* @returns iframe Center in visible viewport,
|
|
9970
10399
|
* Iframe height,
|
|
9971
10400
|
* View port height.
|
|
@@ -9979,8 +10408,7 @@
|
|
|
9979
10408
|
let iframeVisibleViewPort;
|
|
9980
10409
|
let iframeOffset;
|
|
9981
10410
|
if (iframeScrolled < 0) {
|
|
9982
|
-
iframeVisibleViewPort =
|
|
9983
|
-
viewPortHeight - (offsetTopClient - scrollTopClient);
|
|
10411
|
+
iframeVisibleViewPort = viewPortHeight - (offsetTopClient - scrollTopClient);
|
|
9984
10412
|
iframeVisibleViewPort = Math.min(iframeHeight, iframeVisibleViewPort);
|
|
9985
10413
|
iframeOffset = 0;
|
|
9986
10414
|
}
|
|
@@ -10004,6 +10432,20 @@
|
|
|
10004
10432
|
* @param messageType The message type
|
|
10005
10433
|
* @param callback A callback as a function
|
|
10006
10434
|
* @param options The message options
|
|
10435
|
+
* @example
|
|
10436
|
+
* ```js
|
|
10437
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
10438
|
+
* console.error(data);
|
|
10439
|
+
* });
|
|
10440
|
+
* ```
|
|
10441
|
+
* @example
|
|
10442
|
+
* ```js
|
|
10443
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
10444
|
+
* console.log("Answer save clicked", data);
|
|
10445
|
+
* }, {
|
|
10446
|
+
* start: true // This will trigger the callback on start of save
|
|
10447
|
+
* });
|
|
10448
|
+
* ```
|
|
10007
10449
|
*/
|
|
10008
10450
|
on(messageType, callback, options = { start: false }) {
|
|
10009
10451
|
if (this.isRendered) {
|
|
@@ -10014,11 +10456,34 @@
|
|
|
10014
10456
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
10015
10457
|
return this;
|
|
10016
10458
|
}
|
|
10459
|
+
/**
|
|
10460
|
+
* Removes an event listener for a particular event type.
|
|
10461
|
+
*
|
|
10462
|
+
* @param messageType The message type
|
|
10463
|
+
* @param callback The callback to remove
|
|
10464
|
+
* @example
|
|
10465
|
+
* ```js
|
|
10466
|
+
* const errorHandler = (data) => { console.error(data); };
|
|
10467
|
+
* tsEmbed.on(EmbedEvent.Error, errorHandler);
|
|
10468
|
+
* tsEmbed.off(EmbedEvent.Error, errorHandler);
|
|
10469
|
+
* ```
|
|
10470
|
+
*/
|
|
10471
|
+
off(messageType, callback) {
|
|
10472
|
+
const callbacks = this.eventHandlerMap.get(messageType) || [];
|
|
10473
|
+
const index = callbacks.findIndex((cb) => cb.callback === callback);
|
|
10474
|
+
if (index > -1) {
|
|
10475
|
+
callbacks.splice(index, 1);
|
|
10476
|
+
}
|
|
10477
|
+
return this;
|
|
10478
|
+
}
|
|
10017
10479
|
/**
|
|
10018
10480
|
* Triggers an event on specific Port registered against
|
|
10019
10481
|
* for the EmbedEvent
|
|
10482
|
+
*
|
|
10020
10483
|
* @param eventType The message type
|
|
10021
10484
|
* @param data The payload to send
|
|
10485
|
+
* @param eventPort
|
|
10486
|
+
* @param payload
|
|
10022
10487
|
*/
|
|
10023
10488
|
triggerEventOnPort(eventPort, payload) {
|
|
10024
10489
|
if (eventPort) {
|
|
@@ -10039,6 +10504,7 @@
|
|
|
10039
10504
|
}
|
|
10040
10505
|
/**
|
|
10041
10506
|
* Triggers an event to the embedded app
|
|
10507
|
+
*
|
|
10042
10508
|
* @param messageType The event type
|
|
10043
10509
|
* @param data The payload to send with the message
|
|
10044
10510
|
*/
|
|
@@ -10050,6 +10516,7 @@
|
|
|
10050
10516
|
* Marks the ThoughtSpot object to have been rendered
|
|
10051
10517
|
* Needs to be overridden by subclasses to do the actual
|
|
10052
10518
|
* rendering of the iframe.
|
|
10519
|
+
*
|
|
10053
10520
|
* @param args
|
|
10054
10521
|
*/
|
|
10055
10522
|
render() {
|
|
@@ -10060,6 +10527,7 @@
|
|
|
10060
10527
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
10061
10528
|
* host app URL.
|
|
10062
10529
|
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
10530
|
+
*
|
|
10063
10531
|
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
10064
10532
|
*/
|
|
10065
10533
|
getThoughtSpotPostUrlParams() {
|
|
@@ -10083,6 +10551,7 @@
|
|
|
10083
10551
|
}
|
|
10084
10552
|
/**
|
|
10085
10553
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
10554
|
+
*
|
|
10086
10555
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
10087
10556
|
*/
|
|
10088
10557
|
destroy() {
|
|
@@ -10093,11 +10562,28 @@
|
|
|
10093
10562
|
console.log('Error destroying TS Embed', e);
|
|
10094
10563
|
}
|
|
10095
10564
|
}
|
|
10565
|
+
getUnderlyingFrameElement() {
|
|
10566
|
+
return this.iFrame;
|
|
10567
|
+
}
|
|
10568
|
+
/**
|
|
10569
|
+
* Prerenders a generic instance of the TS component.
|
|
10570
|
+
* This means without the path but with the flags already applied.
|
|
10571
|
+
* This is useful for prerendering the component in the background.
|
|
10572
|
+
*
|
|
10573
|
+
* @version SDK: 1.21.0 | ThoughtSpot: * / Search: 9.3.0.cl
|
|
10574
|
+
* @returns
|
|
10575
|
+
*/
|
|
10576
|
+
async prerenderGeneric() {
|
|
10577
|
+
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
10578
|
+
return this.renderIFrame(prerenderFrameSrc);
|
|
10579
|
+
}
|
|
10096
10580
|
}
|
|
10097
10581
|
/**
|
|
10098
10582
|
* Base class for embedding v1 experience
|
|
10099
10583
|
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
10100
10584
|
* which is currently under migration to v2
|
|
10585
|
+
*
|
|
10586
|
+
* @inheritdoc
|
|
10101
10587
|
*/
|
|
10102
10588
|
class V1Embed extends TsEmbed {
|
|
10103
10589
|
constructor(domSelector, viewConfig) {
|
|
@@ -10105,13 +10591,37 @@
|
|
|
10105
10591
|
this.viewConfig = viewConfig;
|
|
10106
10592
|
}
|
|
10107
10593
|
/**
|
|
10108
|
-
* Render the
|
|
10594
|
+
* Render the ap p in an iframe and set up event handlers
|
|
10595
|
+
*
|
|
10109
10596
|
* @param iframeSrc
|
|
10110
10597
|
*/
|
|
10111
10598
|
renderV1Embed(iframeSrc) {
|
|
10112
|
-
return this.renderIFrame(iframeSrc
|
|
10599
|
+
return this.renderIFrame(iframeSrc);
|
|
10600
|
+
}
|
|
10601
|
+
getRootIframeSrc() {
|
|
10602
|
+
const runtimeFilters = this.viewConfig.runtimeFilters;
|
|
10603
|
+
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
10604
|
+
const queryParams = this.getEmbedParams();
|
|
10605
|
+
const queryString = [filterQuery, queryParams].filter(Boolean).join('&');
|
|
10606
|
+
return this.getV1EmbedBasePath(queryString);
|
|
10113
10607
|
}
|
|
10114
|
-
|
|
10608
|
+
/**
|
|
10609
|
+
* @inheritdoc
|
|
10610
|
+
* @example
|
|
10611
|
+
* ```js
|
|
10612
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
10613
|
+
* console.error(data);
|
|
10614
|
+
* });
|
|
10615
|
+
* ```
|
|
10616
|
+
* @example
|
|
10617
|
+
* ```js
|
|
10618
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
10619
|
+
* console.log("Answer save clicked", data);
|
|
10620
|
+
* }, {
|
|
10621
|
+
* start: true // This will trigger the callback on start of save
|
|
10622
|
+
* });
|
|
10623
|
+
* ```
|
|
10624
|
+
*/
|
|
10115
10625
|
on(messageType, callback, options = { start: false }) {
|
|
10116
10626
|
const eventType = this.getCompatibleEventType(messageType);
|
|
10117
10627
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
@@ -10161,7 +10671,8 @@
|
|
|
10161
10671
|
})(exports.Page || (exports.Page = {}));
|
|
10162
10672
|
/**
|
|
10163
10673
|
* Embeds full ThoughtSpot experience in a host application.
|
|
10164
|
-
*
|
|
10674
|
+
*
|
|
10675
|
+
* @group Embed components
|
|
10165
10676
|
*/
|
|
10166
10677
|
class AppEmbed extends V1Embed {
|
|
10167
10678
|
// eslint-disable-next-line no-useless-constructor
|
|
@@ -10173,8 +10684,12 @@
|
|
|
10173
10684
|
* embedded Liveboard or visualization.
|
|
10174
10685
|
*/
|
|
10175
10686
|
getEmbedParams() {
|
|
10176
|
-
const
|
|
10177
|
-
|
|
10687
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, enableSearchAssist, } = this.viewConfig;
|
|
10688
|
+
let params = {};
|
|
10689
|
+
params[Param.EmbedApp] = true;
|
|
10690
|
+
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
10691
|
+
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
10692
|
+
params = this.getBaseQueryParams(params);
|
|
10178
10693
|
if (tag) {
|
|
10179
10694
|
params[Param.Tag] = tag;
|
|
10180
10695
|
}
|
|
@@ -10184,26 +10699,28 @@
|
|
|
10184
10699
|
if (liveboardV2 !== undefined) {
|
|
10185
10700
|
params[Param.LiveboardV2Enabled] = liveboardV2;
|
|
10186
10701
|
}
|
|
10702
|
+
if (enableSearchAssist !== undefined) {
|
|
10703
|
+
params[Param.EnableSearchAssist] = enableSearchAssist;
|
|
10704
|
+
}
|
|
10187
10705
|
const queryParams = getQueryParamString(params, true);
|
|
10188
10706
|
return queryParams;
|
|
10189
10707
|
}
|
|
10190
10708
|
/**
|
|
10191
10709
|
* Constructs the URL of the ThoughtSpot app page to be rendered.
|
|
10710
|
+
*
|
|
10192
10711
|
* @param pageId The ID of the page to be embedded.
|
|
10193
10712
|
*/
|
|
10194
|
-
getIFrameSrc(
|
|
10195
|
-
const
|
|
10196
|
-
const
|
|
10197
|
-
|
|
10198
|
-
.filter(Boolean)
|
|
10199
|
-
.join('&');
|
|
10200
|
-
let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true, this.viewConfig.enableSearchAssist)}/${pageId}`;
|
|
10713
|
+
getIFrameSrc() {
|
|
10714
|
+
const { pageId, path } = this.viewConfig;
|
|
10715
|
+
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
10716
|
+
let url = `${this.getRootIframeSrc()}/${pageRoute}`;
|
|
10201
10717
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10202
10718
|
url = `${url}${tsPostHashParams}`;
|
|
10203
10719
|
return url;
|
|
10204
10720
|
}
|
|
10205
10721
|
/**
|
|
10206
10722
|
* Gets the ThoughtSpot route of the page for a particular page ID.
|
|
10723
|
+
*
|
|
10207
10724
|
* @param pageId The identifier for a page in the ThoughtSpot app.
|
|
10208
10725
|
*/
|
|
10209
10726
|
getPageRoute(pageId) {
|
|
@@ -10227,6 +10744,7 @@
|
|
|
10227
10744
|
}
|
|
10228
10745
|
/**
|
|
10229
10746
|
* Formats the path provided by the user.
|
|
10747
|
+
*
|
|
10230
10748
|
* @param path The URL path.
|
|
10231
10749
|
* @returns The URL path that the embedded app understands.
|
|
10232
10750
|
*/
|
|
@@ -10242,10 +10760,13 @@
|
|
|
10242
10760
|
}
|
|
10243
10761
|
/**
|
|
10244
10762
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
10245
|
-
* This is used for embedding answers, pinboards, visualizations and full application
|
|
10763
|
+
* This is used for embedding answers, pinboards, visualizations and full application
|
|
10764
|
+
* only.
|
|
10765
|
+
*
|
|
10246
10766
|
* @param path string | number The string, set to iframe src and navigate to new page
|
|
10247
10767
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
10248
|
-
* When used with `noReload` this can also be a number
|
|
10768
|
+
* When used with `noReload` (default: true) this can also be a number
|
|
10769
|
+
* like 1/-1 to go forward/back.
|
|
10249
10770
|
* @param noReload boolean Trigger the navigation without reloading the page
|
|
10250
10771
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
10251
10772
|
*/
|
|
@@ -10270,14 +10791,13 @@
|
|
|
10270
10791
|
}
|
|
10271
10792
|
/**
|
|
10272
10793
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
10794
|
+
*
|
|
10273
10795
|
* @param renderOptions An object containing the page ID
|
|
10274
10796
|
* to be embedded.
|
|
10275
10797
|
*/
|
|
10276
10798
|
render() {
|
|
10277
10799
|
super.render();
|
|
10278
|
-
const
|
|
10279
|
-
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
10280
|
-
const src = this.getIFrameSrc(pageRoute, runtimeFilters);
|
|
10800
|
+
const src = this.getIFrameSrc();
|
|
10281
10801
|
this.renderV1Embed(src);
|
|
10282
10802
|
return this;
|
|
10283
10803
|
}
|
|
@@ -10295,7 +10815,8 @@
|
|
|
10295
10815
|
*/
|
|
10296
10816
|
/**
|
|
10297
10817
|
* Embed a ThoughtSpot Liveboard or visualization
|
|
10298
|
-
*
|
|
10818
|
+
*
|
|
10819
|
+
* @group Embed components
|
|
10299
10820
|
*/
|
|
10300
10821
|
class LiveboardEmbed extends V1Embed {
|
|
10301
10822
|
// eslint-disable-next-line no-useless-constructor
|
|
@@ -10305,6 +10826,7 @@
|
|
|
10305
10826
|
/**
|
|
10306
10827
|
* Set the iframe height as per the computed height received
|
|
10307
10828
|
* from the ThoughtSpot app.
|
|
10829
|
+
*
|
|
10308
10830
|
* @param data The event payload
|
|
10309
10831
|
*/
|
|
10310
10832
|
this.updateIFrameHeight = (data) => {
|
|
@@ -10319,16 +10841,23 @@
|
|
|
10319
10841
|
this.setIFrameHeight(this.defaultHeight);
|
|
10320
10842
|
}
|
|
10321
10843
|
};
|
|
10844
|
+
if (this.viewConfig.fullHeight === true) {
|
|
10845
|
+
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
10846
|
+
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
10847
|
+
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
10848
|
+
}
|
|
10322
10849
|
}
|
|
10323
10850
|
/**
|
|
10324
10851
|
* Construct a map of params to be passed on to the
|
|
10325
10852
|
* embedded Liveboard or visualization.
|
|
10326
10853
|
*/
|
|
10327
10854
|
getEmbedParams() {
|
|
10328
|
-
|
|
10855
|
+
let params = {};
|
|
10856
|
+
params[Param.EmbedApp] = true;
|
|
10857
|
+
params = this.getBaseQueryParams(params);
|
|
10329
10858
|
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, activeTabId, } = this.viewConfig;
|
|
10330
|
-
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
10331
|
-
this.viewConfig.preventPinboardFilterRemoval;
|
|
10859
|
+
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
10860
|
+
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
10332
10861
|
if (fullHeight === true) {
|
|
10333
10862
|
params[Param.fullHeight] = true;
|
|
10334
10863
|
}
|
|
@@ -10354,65 +10883,68 @@
|
|
|
10354
10883
|
const queryParams = getQueryParamString(params, true);
|
|
10355
10884
|
return queryParams;
|
|
10356
10885
|
}
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
* to be loaded within the iframe.
|
|
10360
|
-
* @param liveboardId The GUID of the Liveboard.
|
|
10361
|
-
* @param vizId The optional GUID of a visualization within the Liveboard.
|
|
10362
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
10363
|
-
* the Liveboard or visualization on load.
|
|
10364
|
-
*/
|
|
10365
|
-
getIFrameSrc(liveboardId, vizId, runtimeFilters, activeTabId) {
|
|
10366
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
10367
|
-
const queryParams = this.getEmbedParams();
|
|
10368
|
-
const queryString = [filterQuery, queryParams]
|
|
10369
|
-
.filter(Boolean)
|
|
10370
|
-
.join('&');
|
|
10371
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${liveboardId}`;
|
|
10886
|
+
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
10887
|
+
let suffix = `/embed/viz/${liveboardId}`;
|
|
10372
10888
|
if (activeTabId) {
|
|
10373
|
-
|
|
10889
|
+
suffix = `${suffix}/tab/${activeTabId} `;
|
|
10374
10890
|
}
|
|
10375
10891
|
if (vizId) {
|
|
10376
|
-
|
|
10892
|
+
suffix = `${suffix}/${vizId}`;
|
|
10377
10893
|
}
|
|
10378
10894
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10379
|
-
|
|
10380
|
-
return
|
|
10895
|
+
suffix = `${suffix}${tsPostHashParams}`;
|
|
10896
|
+
return suffix;
|
|
10897
|
+
}
|
|
10898
|
+
/**
|
|
10899
|
+
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
10900
|
+
* to be loaded within the iframe.
|
|
10901
|
+
*/
|
|
10902
|
+
getIFrameSrc() {
|
|
10903
|
+
var _a;
|
|
10904
|
+
const { vizId, activeTabId } = this.viewConfig;
|
|
10905
|
+
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
10906
|
+
if (!liveboardId) {
|
|
10907
|
+
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
10908
|
+
}
|
|
10909
|
+
return `${this.getRootIframeSrc()}${this.getIframeSuffixSrc(liveboardId, vizId, activeTabId)}`;
|
|
10381
10910
|
}
|
|
10382
10911
|
/**
|
|
10383
10912
|
* Triggers an event to the embedded app
|
|
10913
|
+
*
|
|
10384
10914
|
* @param messageType The event type
|
|
10385
10915
|
* @param data The payload to send with the message
|
|
10386
10916
|
*/
|
|
10387
10917
|
trigger(messageType, data = {}) {
|
|
10388
10918
|
const dataWithVizId = data;
|
|
10389
|
-
if (this.viewConfig.vizId) {
|
|
10919
|
+
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
10390
10920
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
10391
10921
|
}
|
|
10392
10922
|
return super.trigger(messageType, dataWithVizId);
|
|
10393
10923
|
}
|
|
10394
10924
|
/**
|
|
10395
10925
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
10926
|
+
*
|
|
10396
10927
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
10397
10928
|
* visualization ID and the runtime filters.
|
|
10398
10929
|
*/
|
|
10399
10930
|
render() {
|
|
10400
|
-
var _a;
|
|
10401
|
-
const { vizId, activeTabId, runtimeFilters } = this.viewConfig;
|
|
10402
|
-
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
10403
|
-
if (!liveboardId) {
|
|
10404
|
-
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
10405
|
-
}
|
|
10406
|
-
if (this.viewConfig.fullHeight === true) {
|
|
10407
|
-
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
10408
|
-
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
10409
|
-
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
10410
|
-
}
|
|
10411
10931
|
super.render();
|
|
10412
|
-
const src = this.getIFrameSrc(
|
|
10932
|
+
const src = this.getIFrameSrc();
|
|
10413
10933
|
this.renderV1Embed(src);
|
|
10414
10934
|
return this;
|
|
10415
10935
|
}
|
|
10936
|
+
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
10937
|
+
const path = this.getIframeSuffixSrc(liveboardId, vizId, activeTabId);
|
|
10938
|
+
this.viewConfig.liveboardId = liveboardId;
|
|
10939
|
+
this.viewConfig.activeTabId = activeTabId;
|
|
10940
|
+
this.viewConfig.vizId = vizId;
|
|
10941
|
+
if (this.isAppInitialized) {
|
|
10942
|
+
this.trigger(exports.HostEvent.Navigate, path.substring(1));
|
|
10943
|
+
}
|
|
10944
|
+
else {
|
|
10945
|
+
this.render();
|
|
10946
|
+
}
|
|
10947
|
+
}
|
|
10416
10948
|
}
|
|
10417
10949
|
/**
|
|
10418
10950
|
* @hidden
|
|
@@ -10438,7 +10970,7 @@
|
|
|
10438
10970
|
/**
|
|
10439
10971
|
* Embed ThoughtSpot search
|
|
10440
10972
|
*
|
|
10441
|
-
* @
|
|
10973
|
+
* @group Embed components
|
|
10442
10974
|
*/
|
|
10443
10975
|
class SearchEmbed extends TsEmbed {
|
|
10444
10976
|
constructor(domSelector, viewConfig) {
|
|
@@ -10459,16 +10991,9 @@
|
|
|
10459
10991
|
}
|
|
10460
10992
|
return dataSourceMode;
|
|
10461
10993
|
}
|
|
10462
|
-
|
|
10463
|
-
* Construct the URL of the embedded ThoughtSpot search to be
|
|
10464
|
-
* loaded in the iframe
|
|
10465
|
-
* @param answerId The GUID of a saved answer
|
|
10466
|
-
* @param dataSources A list of data source GUIDs
|
|
10467
|
-
*/
|
|
10468
|
-
getIFrameSrc(answerId, dataSources) {
|
|
10994
|
+
getEmbedParams() {
|
|
10469
10995
|
var _a;
|
|
10470
|
-
const { hideResults,
|
|
10471
|
-
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
10996
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, } = this.viewConfig;
|
|
10472
10997
|
const queryParams = this.getBaseQueryParams();
|
|
10473
10998
|
queryParams[Param.HideActions] = [
|
|
10474
10999
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -10507,17 +11032,28 @@
|
|
|
10507
11032
|
if (filterQuery) {
|
|
10508
11033
|
query += `&${filterQuery}`;
|
|
10509
11034
|
}
|
|
11035
|
+
return query;
|
|
11036
|
+
}
|
|
11037
|
+
/**
|
|
11038
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
11039
|
+
* loaded in the iframe
|
|
11040
|
+
*
|
|
11041
|
+
* @param answerId The GUID of a saved answer
|
|
11042
|
+
* @param dataSources A list of data source GUIDs
|
|
11043
|
+
*/
|
|
11044
|
+
getIFrameSrc(answerId) {
|
|
11045
|
+
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
10510
11046
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10511
|
-
return `${this.
|
|
11047
|
+
return `${this.getRootIframeSrc()}/embed/${answerPath}${tsPostHashParams}`;
|
|
10512
11048
|
}
|
|
10513
11049
|
/**
|
|
10514
11050
|
* Render the embedded ThoughtSpot search
|
|
10515
11051
|
*/
|
|
10516
11052
|
render() {
|
|
10517
11053
|
super.render();
|
|
10518
|
-
const { answerId
|
|
10519
|
-
const src = this.getIFrameSrc(answerId
|
|
10520
|
-
this.renderIFrame(src
|
|
11054
|
+
const { answerId } = this.viewConfig;
|
|
11055
|
+
const src = this.getIFrameSrc(answerId);
|
|
11056
|
+
this.renderIFrame(src);
|
|
10521
11057
|
getAuthPromise().then(() => {
|
|
10522
11058
|
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
10523
11059
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
@@ -10530,8 +11066,8 @@
|
|
|
10530
11066
|
/**
|
|
10531
11067
|
* Embed ThoughtSpot search bar
|
|
10532
11068
|
*
|
|
10533
|
-
* @Category Search Embed
|
|
10534
11069
|
* @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
|
|
11070
|
+
* @group Embed components
|
|
10535
11071
|
*/
|
|
10536
11072
|
class SearchBarEmbed extends TsEmbed {
|
|
10537
11073
|
constructor(domSelector, viewConfig) {
|
|
@@ -10541,6 +11077,7 @@
|
|
|
10541
11077
|
/**
|
|
10542
11078
|
* Construct the URL of the embedded ThoughtSpot search to be
|
|
10543
11079
|
* loaded in the iframe
|
|
11080
|
+
*
|
|
10544
11081
|
* @param dataSources A list of data source GUIDs
|
|
10545
11082
|
*/
|
|
10546
11083
|
getIFrameSrc() {
|
|
@@ -10548,9 +11085,7 @@
|
|
|
10548
11085
|
const { searchOptions, dataSource, dataSources } = this.viewConfig;
|
|
10549
11086
|
const path = 'search-bar-embed';
|
|
10550
11087
|
const queryParams = this.getBaseQueryParams();
|
|
10551
|
-
queryParams[Param.HideActions] = [
|
|
10552
|
-
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
10553
|
-
];
|
|
11088
|
+
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
10554
11089
|
if (dataSources && dataSources.length) {
|
|
10555
11090
|
queryParams[Param.DataSources] = JSON.stringify(dataSources);
|
|
10556
11091
|
}
|
|
@@ -10571,7 +11106,7 @@
|
|
|
10571
11106
|
query = `?${queryParamsString}`;
|
|
10572
11107
|
}
|
|
10573
11108
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
10574
|
-
return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
|
|
11109
|
+
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
10575
11110
|
}
|
|
10576
11111
|
/**
|
|
10577
11112
|
* Render the embedded ThoughtSpot search
|
|
@@ -10579,7 +11114,7 @@
|
|
|
10579
11114
|
render() {
|
|
10580
11115
|
super.render();
|
|
10581
11116
|
const src = this.getIFrameSrc();
|
|
10582
|
-
this.renderIFrame(src
|
|
11117
|
+
this.renderIFrame(src);
|
|
10583
11118
|
return this;
|
|
10584
11119
|
}
|
|
10585
11120
|
}
|