@thoughtspot/visual-embed-sdk 1.20.0-alpha.2 → 1.20.0-prerender.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/src/auth.d.ts +75 -5
  2. package/dist/src/auth.d.ts.map +1 -1
  3. package/dist/src/config.d.ts +1 -0
  4. package/dist/src/config.d.ts.map +1 -1
  5. package/dist/src/embed/app.d.ts +19 -7
  6. package/dist/src/embed/app.d.ts.map +1 -1
  7. package/dist/src/embed/base.d.ts +39 -19
  8. package/dist/src/embed/base.d.ts.map +1 -1
  9. package/dist/src/embed/liveboard.d.ts +19 -7
  10. package/dist/src/embed/liveboard.d.ts.map +1 -1
  11. package/dist/src/embed/search-bar.d.ts +7 -1
  12. package/dist/src/embed/search-bar.d.ts.map +1 -1
  13. package/dist/src/embed/search.d.ts +11 -3
  14. package/dist/src/embed/search.d.ts.map +1 -1
  15. package/dist/src/embed/ts-embed.d.ts +76 -5
  16. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  17. package/dist/src/errors.d.ts.map +1 -1
  18. package/dist/src/index.d.ts +3 -3
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/mixpanel-service.d.ts +8 -0
  21. package/dist/src/mixpanel-service.d.ts.map +1 -1
  22. package/dist/src/react/index.d.ts.map +1 -1
  23. package/dist/src/react/util.d.ts +4 -0
  24. package/dist/src/react/util.d.ts.map +1 -1
  25. package/dist/src/test/test-utils.d.ts +11 -2
  26. package/dist/src/test/test-utils.d.ts.map +1 -1
  27. package/dist/src/types.d.ts +429 -97
  28. package/dist/src/types.d.ts.map +1 -1
  29. package/dist/src/utils/answerService.d.ts +7 -0
  30. package/dist/src/utils/answerService.d.ts.map +1 -1
  31. package/dist/src/utils/authService.d.ts +30 -0
  32. package/dist/src/utils/authService.d.ts.map +1 -1
  33. package/dist/src/utils/processData.d.ts +12 -0
  34. package/dist/src/utils/processData.d.ts.map +1 -1
  35. package/dist/src/utils/processTrigger.d.ts +7 -0
  36. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  37. package/dist/src/utils.d.ts +12 -0
  38. package/dist/src/utils.d.ts.map +1 -1
  39. package/dist/tsembed.es.js +818 -285
  40. package/dist/tsembed.js +791 -284
  41. package/lib/package.json +4 -3
  42. package/lib/src/auth.d.ts +75 -5
  43. package/lib/src/auth.d.ts.map +1 -1
  44. package/lib/src/auth.js +86 -26
  45. package/lib/src/auth.js.map +1 -1
  46. package/lib/src/auth.spec.js +14 -5
  47. package/lib/src/auth.spec.js.map +1 -1
  48. package/lib/src/config.d.ts +1 -0
  49. package/lib/src/config.d.ts.map +1 -1
  50. package/lib/src/config.js +5 -3
  51. package/lib/src/config.js.map +1 -1
  52. package/lib/src/config.spec.js.map +1 -1
  53. package/lib/src/embed/app.d.ts +19 -7
  54. package/lib/src/embed/app.d.ts.map +1 -1
  55. package/lib/src/embed/app.js +26 -16
  56. package/lib/src/embed/app.js.map +1 -1
  57. package/lib/src/embed/app.spec.js +12 -12
  58. package/lib/src/embed/app.spec.js.map +1 -1
  59. package/lib/src/embed/base.d.ts +39 -19
  60. package/lib/src/embed/base.d.ts.map +1 -1
  61. package/lib/src/embed/base.js +49 -15
  62. package/lib/src/embed/base.js.map +1 -1
  63. package/lib/src/embed/base.spec.js +2 -2
  64. package/lib/src/embed/base.spec.js.map +1 -1
  65. package/lib/src/embed/embed.spec.js +1 -1
  66. package/lib/src/embed/embed.spec.js.map +1 -1
  67. package/lib/src/embed/liveboard.d.ts +19 -7
  68. package/lib/src/embed/liveboard.d.ts.map +1 -1
  69. package/lib/src/embed/liveboard.js +50 -38
  70. package/lib/src/embed/liveboard.js.map +1 -1
  71. package/lib/src/embed/liveboard.spec.js +37 -30
  72. package/lib/src/embed/liveboard.spec.js.map +1 -1
  73. package/lib/src/embed/pinboard.spec.js +14 -26
  74. package/lib/src/embed/pinboard.spec.js.map +1 -1
  75. package/lib/src/embed/search-bar.d.ts +7 -1
  76. package/lib/src/embed/search-bar.d.ts.map +1 -1
  77. package/lib/src/embed/search-bar.js +6 -7
  78. package/lib/src/embed/search-bar.js.map +1 -1
  79. package/lib/src/embed/search.d.ts +11 -3
  80. package/lib/src/embed/search.d.ts.map +1 -1
  81. package/lib/src/embed/search.js +19 -15
  82. package/lib/src/embed/search.js.map +1 -1
  83. package/lib/src/embed/search.spec.js +16 -19
  84. package/lib/src/embed/search.spec.js.map +1 -1
  85. package/lib/src/embed/searchEmbed-basic-auth.spec.js +4 -0
  86. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  87. package/lib/src/embed/ts-embed.d.ts +76 -5
  88. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  89. package/lib/src/embed/ts-embed.js +150 -72
  90. package/lib/src/embed/ts-embed.js.map +1 -1
  91. package/lib/src/embed/ts-embed.spec.js +23 -24
  92. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  93. package/lib/src/errors.d.ts.map +1 -1
  94. package/lib/src/errors.js.map +1 -1
  95. package/lib/src/index.d.ts +3 -3
  96. package/lib/src/index.d.ts.map +1 -1
  97. package/lib/src/index.js +3 -3
  98. package/lib/src/index.js.map +1 -1
  99. package/lib/src/mixpanel-service.d.ts +8 -0
  100. package/lib/src/mixpanel-service.d.ts.map +1 -1
  101. package/lib/src/mixpanel-service.js +13 -1
  102. package/lib/src/mixpanel-service.js.map +1 -1
  103. package/lib/src/mixpanel-service.spec.js.map +1 -1
  104. package/lib/src/react/index.d.ts.map +1 -1
  105. package/lib/src/react/index.js +4 -6
  106. package/lib/src/react/index.js.map +1 -1
  107. package/lib/src/react/index.spec.js +3 -6
  108. package/lib/src/react/index.spec.js.map +1 -1
  109. package/lib/src/react/util.d.ts +4 -0
  110. package/lib/src/react/util.d.ts.map +1 -1
  111. package/lib/src/react/util.js +4 -0
  112. package/lib/src/react/util.js.map +1 -1
  113. package/lib/src/test/test-utils.d.ts +11 -2
  114. package/lib/src/test/test-utils.d.ts.map +1 -1
  115. package/lib/src/test/test-utils.js +36 -25
  116. package/lib/src/test/test-utils.js.map +1 -1
  117. package/lib/src/types.d.ts +429 -97
  118. package/lib/src/types.d.ts.map +1 -1
  119. package/lib/src/types.js +310 -72
  120. package/lib/src/types.js.map +1 -1
  121. package/lib/src/utils/answerService.d.ts +7 -0
  122. package/lib/src/utils/answerService.d.ts.map +1 -1
  123. package/lib/src/utils/answerService.js +7 -0
  124. package/lib/src/utils/answerService.js.map +1 -1
  125. package/lib/src/utils/answerService.spec.js.map +1 -1
  126. package/lib/src/utils/authService.d.ts +30 -0
  127. package/lib/src/utils/authService.d.ts.map +1 -1
  128. package/lib/src/utils/authService.js +39 -2
  129. package/lib/src/utils/authService.js.map +1 -1
  130. package/lib/src/utils/authService.spec.js.map +1 -1
  131. package/lib/src/utils/processData.d.ts +12 -0
  132. package/lib/src/utils/processData.d.ts.map +1 -1
  133. package/lib/src/utils/processData.js +33 -5
  134. package/lib/src/utils/processData.js.map +1 -1
  135. package/lib/src/utils/processData.spec.js.map +1 -1
  136. package/lib/src/utils/processTrigger.d.ts +7 -0
  137. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  138. package/lib/src/utils/processTrigger.js +17 -3
  139. package/lib/src/utils/processTrigger.js.map +1 -1
  140. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  141. package/lib/src/utils.d.ts +12 -0
  142. package/lib/src/utils.d.ts.map +1 -1
  143. package/lib/src/utils.js +24 -19
  144. package/lib/src/utils.js.map +1 -1
  145. package/lib/src/utils.spec.js.map +1 -1
  146. package/lib/src/visual-embed-sdk.d.ts +664 -141
  147. package/package.json +4 -3
  148. package/src/auth.spec.ts +68 -150
  149. package/src/auth.ts +141 -101
  150. package/src/config.spec.ts +2 -4
  151. package/src/config.ts +5 -3
  152. package/src/embed/app.spec.ts +25 -14
  153. package/src/embed/app.ts +49 -37
  154. package/src/embed/base.spec.ts +6 -12
  155. package/src/embed/base.ts +74 -57
  156. package/src/embed/embed.spec.ts +5 -6
  157. package/src/embed/liveboard.spec.ts +56 -37
  158. package/src/embed/liveboard.ts +67 -65
  159. package/src/embed/pinboard.spec.ts +26 -29
  160. package/src/embed/search-bar.tsx +14 -9
  161. package/src/embed/search.spec.ts +31 -21
  162. package/src/embed/search.ts +28 -22
  163. package/src/embed/searchEmbed-basic-auth.spec.ts +22 -28
  164. package/src/embed/ts-embed.spec.ts +70 -148
  165. package/src/embed/ts-embed.ts +180 -157
  166. package/src/errors.ts +3 -6
  167. package/src/index.ts +23 -7
  168. package/src/mixpanel-service.spec.ts +1 -3
  169. package/src/mixpanel-service.ts +13 -1
  170. package/src/react/index.spec.tsx +11 -20
  171. package/src/react/index.tsx +40 -71
  172. package/src/react/util.ts +8 -4
  173. package/src/test/test-utils.ts +43 -39
  174. package/src/types.ts +427 -97
  175. package/src/utils/answerService.spec.ts +3 -5
  176. package/src/utils/answerService.ts +21 -17
  177. package/src/utils/authService.spec.ts +26 -41
  178. package/src/utils/authService.ts +47 -21
  179. package/src/utils/processData.spec.ts +26 -59
  180. package/src/utils/processData.ts +36 -14
  181. package/src/utils/processTrigger.spec.ts +1 -6
  182. package/src/utils/processTrigger.ts +18 -9
  183. package/src/utils.spec.ts +8 -12
  184. 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 `Passthrough`.
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 configuration, but may not
193
- * be supported by all IDPs. This will behave like `None` if SSO is not configured on ThoughtSpot.
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 from
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 server
239
- * which returns a bearer token, generated using the secret_key obtained from
240
- * ThoughtSpot. This uses a cookieless authentication approach, recommended
241
- * to by pass third-party cookie-blocking restriction implemented by some browsers
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
- * @return timestamp - The timestamp when the event was generated.
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
- * @return isLoggedIn - A Boolean specifying whether authentication was successful.
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
- * @return timestamp - The timestamp when the event was generated.
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
- * @return data - The answer or Liveboard data
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
- * @return additionalFilters - Any additional filters applied
343
- * @return drillDownColumns - The columns on which drill down was performed
344
- * @return nonFilteredColumns - The columns that were not filtered
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
- * @return dataSourceIds - the list of data sources
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
- * @return columnIds - the list of columns
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
- * @return actionId - The id of the custom action
361
- * @return data - The answer or Liveboard data
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
- * @return ContextMenuInputPoints - data point that is double clicked
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
- * @return ContextMenuInputPoints - data point that is clicked
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
- * @return error - An error object or message
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
- * @return alert - An alert object
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
- * @return data - The height of the embedded Liveboard or visualization
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
- * @return data - The center of the visible Iframe viewport.
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 on a chart or table
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 on a chart or table
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
- * searchQuery: "[sales] by [item type],
640
- * "dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
641
- * "execute": true
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 column.
651
- * @example searchEmbed.trigger(HostEvent.DrillDown, {
652
- * points: clickedPointData,
653
- * autoDrillDown: true,
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, ['730496d6-6903-4601-937e-2c691821af3c', 'd547ec54-2a37-4516-a222-2b06719af726'])
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: ["Jackets"]}
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 appEmbed.navigateToPage(-1)
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
- * @param - { columnId: string, name: string, type: INT64/CHAR/DATE, dataType: ATTRIBUTE/MEASURE }
701
- * @example searchEmbed.trigger(HostEvent.OpenFilter, { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
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 searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['123', '456'] })
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 - searchEmbed.trigger(HostEvent.RemoveColumn, { columnId: '123' })
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
- * @example liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
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
- * @example liveboardEmbed.trigger(HostEvent.LiveboardInfo)
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
- * @example liveboardEmbed.trigger(HostEvent.Schedule)
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
- * @example liveboardEmbed.trigger(HostEvent.ScheduleList)
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
- * @example liveboardEmbed.trigger(HostEvent.ExportTML)
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
- * @example liveboardEmbed.trigger(HostEvent.EditTML)
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
- * @example liveboardEmbed.trigger(HostEvent.UpdateTML)
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
- * @example liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
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
- * @example appEmbed.trigger(HostEvent.Remove)
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 liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
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 liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
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 liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
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
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
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: '730496d6-6903-4601-937e-2c691821af3c'})
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
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
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
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
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
- * @example searchEmbed.trigger(HostEvent.GetTML)
1051
+ *
1052
+ * @example
1053
+ * ```js
1054
+ * searchEmbed.trigger(HostEvent.GetTML)
1055
+ * ```
847
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: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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 Table
1109
+ * Triggers the downloadAsCSV action on visualization or search when Displaymode is
1110
+ * Table
1111
+ *
893
1112
  * @example
894
- * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
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 Table
1121
+ * Triggers the downloadAsXLSX action on visualization or search when Displaymode is
1122
+ * Table
1123
+ *
902
1124
  * @example
903
- * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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: '730496d6-6903-4601-937e-2c691821af3c'})
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 comp-blink-test-pipeline
1292
- // with baseUrl=https://localhost:8443.
1293
- // This is to handle when the developer is developing in their local environment.
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 userGUID
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 error
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 error
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 info when authentication is
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 reload
9011
- // the page which we don't want. We'll live with adding an unnecessary hash to the
9012
- // parent page URL until we find any use case where that creates an issue.
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 cookies will
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
- samlCompletionPromise ||
9111
- new Promise((resolve, reject) => {
9112
- window.addEventListener('message', (e) => {
9113
- if (e.data.type === exports.EmbedEvent.SAMLComplete) {
9114
- e.source.close();
9115
- resolve();
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 loaded
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 loaded
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 prefetched resources and serve them from the user's local disk to provide faster access to your app.
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: authStatus = init(config);
9295
- * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
9296
- * @returns event emitter which emits events on authentication success, failure and logout. See {@link AuthStatus}
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 prevent
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 true in this
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 is called
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, } = getEmbedConfig();
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.20.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];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",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-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",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};
9932
+ var name="@thoughtspot/visual-embed-sdk";var version="1.20.0-prerender.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$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}#/embed`;
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 localhost/127.0.0.1
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
- /** Default behavior for context menu will be left-click
9757
- * from version 9.2.0.cl the user have an option to override context menu click
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, showPrimaryNavbar = false, disableProfileAndHelp = false, isAppEmbed = false, enableSearchAssist = false) {
9794
- const queryStringFrag = queryString ? `&${queryString}` : '';
9795
- const primaryNavParam = `&primaryNavHidden=${!showPrimaryNavbar}`;
9796
- const disableProfileAndHelpParam = `&profileAndHelpInNavBarHidden=${disableProfileAndHelp}`;
9797
- const enableSearchAssistParam = `&${Param.EnableSearchAssist}=${enableSearchAssist}`;
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, frameOptions = {}) {
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, { error: JSON.stringify(error) });
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,6 +10350,7 @@
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
@@ -9936,11 +10361,13 @@
9936
10361
  callbacks.push(...allHandlers);
9937
10362
  const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
9938
10363
  callbacks.forEach((callbackObj) => {
9939
- if ((callbackObj.options.start &&
9940
- dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
9941
- (!callbackObj.options.start &&
9942
- dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
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) {
@@ -10017,8 +10459,11 @@
10017
10459
  /**
10018
10460
  * Triggers an event on specific Port registered against
10019
10461
  * for the EmbedEvent
10462
+ *
10020
10463
  * @param eventType The message type
10021
10464
  * @param data The payload to send
10465
+ * @param eventPort
10466
+ * @param payload
10022
10467
  */
10023
10468
  triggerEventOnPort(eventPort, payload) {
10024
10469
  if (eventPort) {
@@ -10039,6 +10484,7 @@
10039
10484
  }
10040
10485
  /**
10041
10486
  * Triggers an event to the embedded app
10487
+ *
10042
10488
  * @param messageType The event type
10043
10489
  * @param data The payload to send with the message
10044
10490
  */
@@ -10050,6 +10496,7 @@
10050
10496
  * Marks the ThoughtSpot object to have been rendered
10051
10497
  * Needs to be overridden by subclasses to do the actual
10052
10498
  * rendering of the iframe.
10499
+ *
10053
10500
  * @param args
10054
10501
  */
10055
10502
  render() {
@@ -10060,6 +10507,7 @@
10060
10507
  * Get the Post Url Params for THOUGHTSPOT from the current
10061
10508
  * host app URL.
10062
10509
  * THOUGHTSPOT URL params starts with a prefix "ts-"
10510
+ *
10063
10511
  * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
10064
10512
  */
10065
10513
  getThoughtSpotPostUrlParams() {
@@ -10083,6 +10531,7 @@
10083
10531
  }
10084
10532
  /**
10085
10533
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
10534
+ *
10086
10535
  * @version SDK: 1.19.1 | ThoughtSpot: *
10087
10536
  */
10088
10537
  destroy() {
@@ -10093,11 +10542,20 @@
10093
10542
  console.log('Error destroying TS Embed', e);
10094
10543
  }
10095
10544
  }
10545
+ getUnderlyingFrameElement() {
10546
+ return this.iFrame;
10547
+ }
10548
+ async prerenderGeneric() {
10549
+ const prerenderFrameSrc = this.getRootIframeSrc();
10550
+ return this.renderIFrame(prerenderFrameSrc);
10551
+ }
10096
10552
  }
10097
10553
  /**
10098
10554
  * Base class for embedding v1 experience
10099
10555
  * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
10100
10556
  * which is currently under migration to v2
10557
+ *
10558
+ * @inheritdoc
10101
10559
  */
10102
10560
  class V1Embed extends TsEmbed {
10103
10561
  constructor(domSelector, viewConfig) {
@@ -10105,13 +10563,37 @@
10105
10563
  this.viewConfig = viewConfig;
10106
10564
  }
10107
10565
  /**
10108
- * Render the app in an iframe and set up event handlers
10566
+ * Render the ap p in an iframe and set up event handlers
10567
+ *
10109
10568
  * @param iframeSrc
10110
10569
  */
10111
10570
  renderV1Embed(iframeSrc) {
10112
- return this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
10571
+ return this.renderIFrame(iframeSrc);
10572
+ }
10573
+ getRootIframeSrc() {
10574
+ const runtimeFilters = this.viewConfig.runtimeFilters;
10575
+ const filterQuery = getFilterQuery(runtimeFilters || []);
10576
+ const queryParams = this.getEmbedParams();
10577
+ const queryString = [filterQuery, queryParams].filter(Boolean).join('&');
10578
+ return this.getV1EmbedBasePath(queryString);
10113
10579
  }
10114
- // @override
10580
+ /**
10581
+ * @inheritdoc
10582
+ * @example
10583
+ * ```js
10584
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
10585
+ * console.error(data);
10586
+ * });
10587
+ * ```
10588
+ * @example
10589
+ * ```js
10590
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
10591
+ * console.log("Answer save clicked", data);
10592
+ * }, {
10593
+ * start: true // This will trigger the callback on start of save
10594
+ * });
10595
+ * ```
10596
+ */
10115
10597
  on(messageType, callback, options = { start: false }) {
10116
10598
  const eventType = this.getCompatibleEventType(messageType);
10117
10599
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
@@ -10161,7 +10643,8 @@
10161
10643
  })(exports.Page || (exports.Page = {}));
10162
10644
  /**
10163
10645
  * Embeds full ThoughtSpot experience in a host application.
10164
- * @Category App Embed
10646
+ *
10647
+ * @group Embed components
10165
10648
  */
10166
10649
  class AppEmbed extends V1Embed {
10167
10650
  // eslint-disable-next-line no-useless-constructor
@@ -10173,8 +10656,12 @@
10173
10656
  * embedded Liveboard or visualization.
10174
10657
  */
10175
10658
  getEmbedParams() {
10176
- const params = this.getBaseQueryParams();
10177
- const { tag, hideObjects, liveboardV2 } = this.viewConfig;
10659
+ const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, enableSearchAssist, } = this.viewConfig;
10660
+ let params = {};
10661
+ params[Param.EmbedApp] = true;
10662
+ params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
10663
+ params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
10664
+ params = this.getBaseQueryParams(params);
10178
10665
  if (tag) {
10179
10666
  params[Param.Tag] = tag;
10180
10667
  }
@@ -10184,26 +10671,28 @@
10184
10671
  if (liveboardV2 !== undefined) {
10185
10672
  params[Param.LiveboardV2Enabled] = liveboardV2;
10186
10673
  }
10674
+ if (enableSearchAssist !== undefined) {
10675
+ params[Param.EnableSearchAssist] = enableSearchAssist;
10676
+ }
10187
10677
  const queryParams = getQueryParamString(params, true);
10188
10678
  return queryParams;
10189
10679
  }
10190
10680
  /**
10191
10681
  * Constructs the URL of the ThoughtSpot app page to be rendered.
10682
+ *
10192
10683
  * @param pageId The ID of the page to be embedded.
10193
10684
  */
10194
- getIFrameSrc(pageId, runtimeFilters) {
10195
- const filterQuery = getFilterQuery(runtimeFilters || []);
10196
- const queryParams = this.getEmbedParams();
10197
- const queryString = [filterQuery, queryParams]
10198
- .filter(Boolean)
10199
- .join('&');
10200
- let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true, this.viewConfig.enableSearchAssist)}/${pageId}`;
10685
+ getIFrameSrc() {
10686
+ const { pageId, path } = this.viewConfig;
10687
+ const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
10688
+ let url = `${this.getRootIframeSrc()}/${pageRoute}`;
10201
10689
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10202
10690
  url = `${url}${tsPostHashParams}`;
10203
10691
  return url;
10204
10692
  }
10205
10693
  /**
10206
10694
  * Gets the ThoughtSpot route of the page for a particular page ID.
10695
+ *
10207
10696
  * @param pageId The identifier for a page in the ThoughtSpot app.
10208
10697
  */
10209
10698
  getPageRoute(pageId) {
@@ -10227,6 +10716,7 @@
10227
10716
  }
10228
10717
  /**
10229
10718
  * Formats the path provided by the user.
10719
+ *
10230
10720
  * @param path The URL path.
10231
10721
  * @returns The URL path that the embedded app understands.
10232
10722
  */
@@ -10242,10 +10732,13 @@
10242
10732
  }
10243
10733
  /**
10244
10734
  * Navigate to particular page for app embed. eg:answers/pinboards/home
10245
- * This is used for embedding answers, pinboards, visualizations and full application only.
10735
+ * This is used for embedding answers, pinboards, visualizations and full application
10736
+ * only.
10737
+ *
10246
10738
  * @param path string | number The string, set to iframe src and navigate to new page
10247
10739
  * eg: appEmbed.navigateToPage('pinboards')
10248
- * When used with `noReload` this can also be a number like 1/-1 to go forward/back.
10740
+ * When used with `noReload` (default: true) this can also be a number
10741
+ * like 1/-1 to go forward/back.
10249
10742
  * @param noReload boolean Trigger the navigation without reloading the page
10250
10743
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
10251
10744
  */
@@ -10270,14 +10763,13 @@
10270
10763
  }
10271
10764
  /**
10272
10765
  * Renders the embedded application pages in the ThoughtSpot app.
10766
+ *
10273
10767
  * @param renderOptions An object containing the page ID
10274
10768
  * to be embedded.
10275
10769
  */
10276
10770
  render() {
10277
10771
  super.render();
10278
- const { pageId, runtimeFilters, path } = this.viewConfig;
10279
- const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
10280
- const src = this.getIFrameSrc(pageRoute, runtimeFilters);
10772
+ const src = this.getIFrameSrc();
10281
10773
  this.renderV1Embed(src);
10282
10774
  return this;
10283
10775
  }
@@ -10295,7 +10787,8 @@
10295
10787
  */
10296
10788
  /**
10297
10789
  * Embed a ThoughtSpot Liveboard or visualization
10298
- * @Category Liveboards and Charts
10790
+ *
10791
+ * @group Embed components
10299
10792
  */
10300
10793
  class LiveboardEmbed extends V1Embed {
10301
10794
  // eslint-disable-next-line no-useless-constructor
@@ -10305,6 +10798,7 @@
10305
10798
  /**
10306
10799
  * Set the iframe height as per the computed height received
10307
10800
  * from the ThoughtSpot app.
10801
+ *
10308
10802
  * @param data The event payload
10309
10803
  */
10310
10804
  this.updateIFrameHeight = (data) => {
@@ -10319,16 +10813,23 @@
10319
10813
  this.setIFrameHeight(this.defaultHeight);
10320
10814
  }
10321
10815
  };
10816
+ if (this.viewConfig.fullHeight === true) {
10817
+ this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
10818
+ this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
10819
+ this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
10820
+ }
10322
10821
  }
10323
10822
  /**
10324
10823
  * Construct a map of params to be passed on to the
10325
10824
  * embedded Liveboard or visualization.
10326
10825
  */
10327
10826
  getEmbedParams() {
10328
- const params = this.getBaseQueryParams();
10827
+ let params = {};
10828
+ params[Param.EmbedApp] = true;
10829
+ params = this.getBaseQueryParams(params);
10329
10830
  const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, activeTabId, } = this.viewConfig;
10330
- const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
10331
- this.viewConfig.preventPinboardFilterRemoval;
10831
+ const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
10832
+ || this.viewConfig.preventPinboardFilterRemoval;
10332
10833
  if (fullHeight === true) {
10333
10834
  params[Param.fullHeight] = true;
10334
10835
  }
@@ -10354,65 +10855,68 @@
10354
10855
  const queryParams = getQueryParamString(params, true);
10355
10856
  return queryParams;
10356
10857
  }
10357
- /**
10358
- * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
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}`;
10858
+ getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
10859
+ let suffix = `/embed/viz/${liveboardId}`;
10372
10860
  if (activeTabId) {
10373
- url = `${url}/tab/${activeTabId}`;
10861
+ suffix = `${suffix}/tab/${activeTabId} `;
10374
10862
  }
10375
10863
  if (vizId) {
10376
- url = `${url}/${vizId}`;
10864
+ suffix = `${suffix}/${vizId}`;
10377
10865
  }
10378
10866
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10379
- url = `${url}${tsPostHashParams}`;
10380
- return url;
10867
+ suffix = `${suffix}${tsPostHashParams}`;
10868
+ return suffix;
10869
+ }
10870
+ /**
10871
+ * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
10872
+ * to be loaded within the iframe.
10873
+ */
10874
+ getIFrameSrc() {
10875
+ var _a;
10876
+ const { vizId, activeTabId } = this.viewConfig;
10877
+ const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
10878
+ if (!liveboardId) {
10879
+ this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
10880
+ }
10881
+ return `${this.getRootIframeSrc()}${this.getIframeSuffixSrc(liveboardId, vizId, activeTabId)}`;
10381
10882
  }
10382
10883
  /**
10383
10884
  * Triggers an event to the embedded app
10885
+ *
10384
10886
  * @param messageType The event type
10385
10887
  * @param data The payload to send with the message
10386
10888
  */
10387
10889
  trigger(messageType, data = {}) {
10388
10890
  const dataWithVizId = data;
10389
- if (this.viewConfig.vizId) {
10891
+ if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
10390
10892
  dataWithVizId.vizId = this.viewConfig.vizId;
10391
10893
  }
10392
10894
  return super.trigger(messageType, dataWithVizId);
10393
10895
  }
10394
10896
  /**
10395
10897
  * Render an embedded ThoughtSpot Liveboard or visualization
10898
+ *
10396
10899
  * @param renderOptions An object specifying the Liveboard ID,
10397
10900
  * visualization ID and the runtime filters.
10398
10901
  */
10399
10902
  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
10903
  super.render();
10412
- const src = this.getIFrameSrc(liveboardId, vizId, runtimeFilters, activeTabId);
10904
+ const src = this.getIFrameSrc();
10413
10905
  this.renderV1Embed(src);
10414
10906
  return this;
10415
10907
  }
10908
+ navigateToLiveboard(liveboardId, vizId, activeTabId) {
10909
+ const path = this.getIframeSuffixSrc(liveboardId, vizId, activeTabId);
10910
+ this.viewConfig.liveboardId = liveboardId;
10911
+ this.viewConfig.activeTabId = activeTabId;
10912
+ this.viewConfig.vizId = vizId;
10913
+ if (this.isAppInitialized) {
10914
+ this.trigger(exports.HostEvent.Navigate, path);
10915
+ }
10916
+ else {
10917
+ this.render();
10918
+ }
10919
+ }
10416
10920
  }
10417
10921
  /**
10418
10922
  * @hidden
@@ -10438,7 +10942,7 @@
10438
10942
  /**
10439
10943
  * Embed ThoughtSpot search
10440
10944
  *
10441
- * @Category Search Embed
10945
+ * @group Embed components
10442
10946
  */
10443
10947
  class SearchEmbed extends TsEmbed {
10444
10948
  constructor(domSelector, viewConfig) {
@@ -10459,16 +10963,9 @@
10459
10963
  }
10460
10964
  return dataSourceMode;
10461
10965
  }
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) {
10966
+ getEmbedParams() {
10469
10967
  var _a;
10470
- const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, } = this.viewConfig;
10471
- const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
10968
+ const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, } = this.viewConfig;
10472
10969
  const queryParams = this.getBaseQueryParams();
10473
10970
  queryParams[Param.HideActions] = [
10474
10971
  ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
@@ -10507,17 +11004,28 @@
10507
11004
  if (filterQuery) {
10508
11005
  query += `&${filterQuery}`;
10509
11006
  }
11007
+ return query;
11008
+ }
11009
+ /**
11010
+ * Construct the URL of the embedded ThoughtSpot search to be
11011
+ * loaded in the iframe
11012
+ *
11013
+ * @param answerId The GUID of a saved answer
11014
+ * @param dataSources A list of data source GUIDs
11015
+ */
11016
+ getIFrameSrc(answerId) {
11017
+ const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
10510
11018
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10511
- return `${this.getEmbedBasePath(query)}/${answerPath}${tsPostHashParams}`;
11019
+ return `${this.getRootIframeSrc()}/embed/${answerPath}${tsPostHashParams}`;
10512
11020
  }
10513
11021
  /**
10514
11022
  * Render the embedded ThoughtSpot search
10515
11023
  */
10516
11024
  render() {
10517
11025
  super.render();
10518
- const { answerId, dataSources } = this.viewConfig;
10519
- const src = this.getIFrameSrc(answerId, dataSources);
10520
- this.renderIFrame(src, this.viewConfig.frameParams);
11026
+ const { answerId } = this.viewConfig;
11027
+ const src = this.getIFrameSrc(answerId);
11028
+ this.renderIFrame(src);
10521
11029
  getAuthPromise().then(() => {
10522
11030
  if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
10523
11031
  alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
@@ -10530,8 +11038,8 @@
10530
11038
  /**
10531
11039
  * Embed ThoughtSpot search bar
10532
11040
  *
10533
- * @Category Search Embed
10534
11041
  * @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
11042
+ * @group Embed components
10535
11043
  */
10536
11044
  class SearchBarEmbed extends TsEmbed {
10537
11045
  constructor(domSelector, viewConfig) {
@@ -10541,6 +11049,7 @@
10541
11049
  /**
10542
11050
  * Construct the URL of the embedded ThoughtSpot search to be
10543
11051
  * loaded in the iframe
11052
+ *
10544
11053
  * @param dataSources A list of data source GUIDs
10545
11054
  */
10546
11055
  getIFrameSrc() {
@@ -10548,9 +11057,7 @@
10548
11057
  const { searchOptions, dataSource, dataSources } = this.viewConfig;
10549
11058
  const path = 'search-bar-embed';
10550
11059
  const queryParams = this.getBaseQueryParams();
10551
- queryParams[Param.HideActions] = [
10552
- ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
10553
- ];
11060
+ queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
10554
11061
  if (dataSources && dataSources.length) {
10555
11062
  queryParams[Param.DataSources] = JSON.stringify(dataSources);
10556
11063
  }
@@ -10571,7 +11078,7 @@
10571
11078
  query = `?${queryParamsString}`;
10572
11079
  }
10573
11080
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10574
- return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
11081
+ return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
10575
11082
  }
10576
11083
  /**
10577
11084
  * Render the embedded ThoughtSpot search
@@ -10579,7 +11086,7 @@
10579
11086
  render() {
10580
11087
  super.render();
10581
11088
  const src = this.getIFrameSrc();
10582
- this.renderIFrame(src, this.viewConfig.frameParams);
11089
+ this.renderIFrame(src);
10583
11090
  return this;
10584
11091
  }
10585
11092
  }