@thoughtspot/visual-embed-sdk 1.20.1 → 1.21.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +1 -1
  2. package/dist/src/auth.d.ts +48 -3
  3. package/dist/src/auth.d.ts.map +1 -1
  4. package/dist/src/config.d.ts +1 -0
  5. package/dist/src/config.d.ts.map +1 -1
  6. package/dist/src/embed/app.d.ts +17 -5
  7. package/dist/src/embed/app.d.ts.map +1 -1
  8. package/dist/src/embed/base.d.ts +20 -9
  9. package/dist/src/embed/base.d.ts.map +1 -1
  10. package/dist/src/embed/liveboard.d.ts +17 -5
  11. package/dist/src/embed/liveboard.d.ts.map +1 -1
  12. package/dist/src/embed/search-bar.d.ts +3 -0
  13. package/dist/src/embed/search-bar.d.ts.map +1 -1
  14. package/dist/src/embed/search.d.ts +9 -5
  15. package/dist/src/embed/search.d.ts.map +1 -1
  16. package/dist/src/embed/ts-embed.d.ts +64 -6
  17. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  18. package/dist/src/errors.d.ts.map +1 -1
  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 +15 -0
  23. package/dist/src/react/index.d.ts.map +1 -1
  24. package/dist/src/react/util.d.ts +4 -0
  25. package/dist/src/react/util.d.ts.map +1 -1
  26. package/dist/src/test/test-utils.d.ts +11 -2
  27. package/dist/src/test/test-utils.d.ts.map +1 -1
  28. package/dist/src/types.d.ts +297 -77
  29. package/dist/src/types.d.ts.map +1 -1
  30. package/dist/src/utils/answerService.d.ts +7 -0
  31. package/dist/src/utils/answerService.d.ts.map +1 -1
  32. package/dist/src/utils/authService.d.ts +30 -0
  33. package/dist/src/utils/authService.d.ts.map +1 -1
  34. package/dist/src/utils/processData.d.ts +12 -0
  35. package/dist/src/utils/processData.d.ts.map +1 -1
  36. package/dist/src/utils/processTrigger.d.ts +7 -0
  37. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  38. package/dist/src/utils.d.ts +12 -0
  39. package/dist/src/utils.d.ts.map +1 -1
  40. package/dist/tsembed.es.js +694 -267
  41. package/dist/tsembed.js +686 -266
  42. package/lib/package.json +3 -8
  43. package/lib/src/auth.d.ts +48 -3
  44. package/lib/src/auth.d.ts.map +1 -1
  45. package/lib/src/auth.js +70 -25
  46. package/lib/src/auth.js.map +1 -1
  47. package/lib/src/auth.spec.js +14 -5
  48. package/lib/src/auth.spec.js.map +1 -1
  49. package/lib/src/config.d.ts +1 -0
  50. package/lib/src/config.d.ts.map +1 -1
  51. package/lib/src/config.js +5 -3
  52. package/lib/src/config.js.map +1 -1
  53. package/lib/src/config.spec.js.map +1 -1
  54. package/lib/src/embed/app.d.ts +17 -5
  55. package/lib/src/embed/app.d.ts.map +1 -1
  56. package/lib/src/embed/app.js +25 -15
  57. package/lib/src/embed/app.js.map +1 -1
  58. package/lib/src/embed/app.spec.js +12 -12
  59. package/lib/src/embed/app.spec.js.map +1 -1
  60. package/lib/src/embed/base.d.ts +20 -9
  61. package/lib/src/embed/base.d.ts.map +1 -1
  62. package/lib/src/embed/base.js +31 -15
  63. package/lib/src/embed/base.js.map +1 -1
  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 +17 -5
  68. package/lib/src/embed/liveboard.d.ts.map +1 -1
  69. package/lib/src/embed/liveboard.js +49 -37
  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 +3 -0
  76. package/lib/src/embed/search-bar.d.ts.map +1 -1
  77. package/lib/src/embed/search-bar.js +5 -6
  78. package/lib/src/embed/search-bar.js.map +1 -1
  79. package/lib/src/embed/search.d.ts +9 -5
  80. package/lib/src/embed/search.d.ts.map +1 -1
  81. package/lib/src/embed/search.js +18 -14
  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 +64 -6
  88. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  89. package/lib/src/embed/ts-embed.js +150 -76
  90. package/lib/src/embed/ts-embed.js.map +1 -1
  91. package/lib/src/embed/ts-embed.spec.js +46 -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.map +1 -1
  96. package/lib/src/index.js +2 -2
  97. package/lib/src/index.js.map +1 -1
  98. package/lib/src/mixpanel-service.d.ts +8 -0
  99. package/lib/src/mixpanel-service.d.ts.map +1 -1
  100. package/lib/src/mixpanel-service.js +13 -1
  101. package/lib/src/mixpanel-service.js.map +1 -1
  102. package/lib/src/mixpanel-service.spec.js.map +1 -1
  103. package/lib/src/react/index.d.ts +15 -0
  104. package/lib/src/react/index.d.ts.map +1 -1
  105. package/lib/src/react/index.js +21 -6
  106. package/lib/src/react/index.js.map +1 -1
  107. package/lib/src/react/index.spec.js +15 -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 +297 -77
  118. package/lib/src/types.d.ts.map +1 -1
  119. package/lib/src/types.js +224 -55
  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 +461 -104
  147. package/package.json +3 -8
  148. package/src/auth.spec.ts +68 -150
  149. package/src/auth.ts +115 -109
  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 +47 -35
  154. package/src/embed/base.spec.ts +3 -9
  155. package/src/embed/base.ts +51 -53
  156. package/src/embed/embed.spec.ts +5 -6
  157. package/src/embed/liveboard.spec.ts +56 -37
  158. package/src/embed/liveboard.ts +66 -64
  159. package/src/embed/pinboard.spec.ts +26 -29
  160. package/src/embed/search-bar.tsx +10 -8
  161. package/src/embed/search.spec.ts +31 -21
  162. package/src/embed/search.ts +26 -25
  163. package/src/embed/searchEmbed-basic-auth.spec.ts +22 -28
  164. package/src/embed/ts-embed.spec.ts +99 -144
  165. package/src/embed/ts-embed.ts +183 -160
  166. package/src/errors.ts +3 -6
  167. package/src/index.ts +4 -10
  168. package/src/mixpanel-service.spec.ts +1 -3
  169. package/src/mixpanel-service.ts +13 -1
  170. package/src/react/index.spec.tsx +37 -13
  171. package/src/react/index.tsx +53 -57
  172. package/src/react/util.ts +8 -4
  173. package/src/test/test-utils.ts +43 -39
  174. package/src/types.ts +294 -79
  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
@@ -11,6 +11,7 @@
11
11
  * Refer to the following docs for more details on runtime filter syntax:
12
12
  * https://cloud-docs.thoughtspot.com/admin/ts-cloud/apply-runtime-filter.html
13
13
  * https://cloud-docs.thoughtspot.com/admin/ts-cloud/runtime-filter-operators.html
14
+ *
14
15
  * @param runtimeFilters
15
16
  */
16
17
  const getFilterQuery = (runtimeFilters) => {
@@ -30,13 +31,12 @@ const getFilterQuery = (runtimeFilters) => {
30
31
  /**
31
32
  * Convert a value to a string representation to be sent as a query
32
33
  * parameter to the ThoughtSpot app.
34
+ *
33
35
  * @param value Any parameter value
34
36
  */
35
37
  const serializeParam = (value) => {
36
38
  // do not serialize primitive types
37
- if (typeof value === 'string' ||
38
- typeof value === 'number' ||
39
- typeof value === 'boolean') {
39
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
40
40
  return value;
41
41
  }
42
42
  return JSON.stringify(value);
@@ -45,12 +45,15 @@ const serializeParam = (value) => {
45
45
  * Convert a value to a string:
46
46
  * in case of an array, we convert it to CSV.
47
47
  * in case of any other type, we directly return the value.
48
+ *
48
49
  * @param value
49
50
  */
50
- const paramToString = (value) => Array.isArray(value) ? value.join(',') : value;
51
+ const paramToString = (value) => (Array.isArray(value) ? value.join(',') : value);
51
52
  /**
52
53
  * Return a query param string composed from the given params object
54
+ *
53
55
  * @param queryParams
56
+ * @param shouldSerializeParamValues
54
57
  */
55
58
  const getQueryParamString = (queryParams, shouldSerializeParamValues = false) => {
56
59
  const qp = [];
@@ -72,6 +75,7 @@ const getQueryParamString = (queryParams, shouldSerializeParamValues = false) =>
72
75
  /**
73
76
  * Get a string representation of a dimension value in CSS
74
77
  * If numeric, it is considered in pixels.
78
+ *
75
79
  * @param value
76
80
  */
77
81
  const getCssDimension = (value) => {
@@ -82,6 +86,7 @@ const getCssDimension = (value) => {
82
86
  };
83
87
  /**
84
88
  * Append a string to a URL's hash fragment
89
+ *
85
90
  * @param url A URL
86
91
  * @param stringToAppend The string to append to the URL hash
87
92
  */
@@ -96,6 +101,12 @@ const appendToUrlHash = (url, stringToAppend) => {
96
101
  }
97
102
  return outputUrl;
98
103
  };
104
+ /**
105
+ *
106
+ * @param url
107
+ * @param stringToAppend
108
+ * @param path
109
+ */
99
110
  function getRedirectUrl(url, stringToAppend, path = '') {
100
111
  const targetUrl = path ? new URL(path, window.location.origin).href : url;
101
112
  return appendToUrlHash(targetUrl, stringToAppend);
@@ -104,10 +115,7 @@ const getEncodedQueryParamsString = (queryString) => {
104
115
  if (!queryString) {
105
116
  return queryString;
106
117
  }
107
- return btoa(queryString)
108
- .replace(/\+/g, '-')
109
- .replace(/\//g, '_')
110
- .replace(/=+$/, '');
118
+ return btoa(queryString).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
111
119
  };
112
120
  const getOffsetTop = (element) => {
113
121
  const rect = element.getBoundingClientRect();
@@ -137,8 +145,8 @@ const getCustomisations = (embedConfig, viewConfig) => {
137
145
  var _a, _b, _c, _d;
138
146
  const customCssUrlFromEmbedConfig = embedConfig.customCssUrl;
139
147
  const customizationsFromViewConfig = viewConfig.customizations;
140
- const customizationsFromEmbedConfig = embedConfig.customizations ||
141
- embedConfig.customisations;
148
+ const customizationsFromEmbedConfig = embedConfig.customizations
149
+ || embedConfig.customisations;
142
150
  const customizations = {
143
151
  style: {
144
152
  ...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style,
@@ -147,9 +155,9 @@ const getCustomisations = (embedConfig, viewConfig) => {
147
155
  ...(_a = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _a === void 0 ? void 0 : _a.customCSS,
148
156
  ...(_b = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _b === void 0 ? void 0 : _b.customCSS,
149
157
  },
150
- customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl) ||
151
- ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl) ||
152
- customCssUrlFromEmbedConfig,
158
+ customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
159
+ || ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl)
160
+ || customCssUrlFromEmbedConfig,
153
161
  },
154
162
  content: {
155
163
  ...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.content,
@@ -161,12 +169,11 @@ const getCustomisations = (embedConfig, viewConfig) => {
161
169
  /**
162
170
  * Gets a reference to the DOM node given
163
171
  * a selector.
172
+ *
164
173
  * @param domSelector
165
174
  */
166
175
  function getDOMNode(domSelector) {
167
- return typeof domSelector === 'string'
168
- ? document.querySelector(domSelector)
169
- : domSelector;
176
+ return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
170
177
  }
171
178
 
172
179
  /**
@@ -180,29 +187,35 @@ function getDOMNode(domSelector) {
180
187
  /**
181
188
  * The authentication mechanism for allowing access to the
182
189
  * the embedded app
190
+ *
183
191
  * @group Authentication / Init
184
192
  */
185
193
  // eslint-disable-next-line no-shadow
186
194
  var AuthType;
187
195
  (function (AuthType) {
188
196
  /**
189
- * No authentication on the SDK. Passthrough to the embedded App. Alias for `Passthrough`.
197
+ * No authentication on the SDK. Passthrough to the embedded App. Alias for
198
+ * `Passthrough`.
190
199
  */
191
200
  AuthType["None"] = "None";
192
201
  /**
193
- * Passthrough SSO to the embedded App within the iframe. Requires least configuration, but may not
194
- * be supported by all IDPs. This will behave like `None` if SSO is not configured on ThoughtSpot.
202
+ * Passthrough SSO to the embedded App within the iframe. Requires least
203
+ * configuration, but may not be supported by all IDPs. This will behave like `None`
204
+ * if SSO is not configured on ThoughtSpot.
205
+ *
195
206
  * @version: SDK: 1.15.0 | ThouhgtSpot: 8.8.0.cl
196
207
  */
197
208
  AuthType["EmbeddedSSO"] = "EmbeddedSSO";
198
209
  /**
199
210
  * SSO using SAML
211
+ *
200
212
  * @deprecated Use {@link SAMLRedirect} instead
201
213
  * @hidden
202
214
  */
203
215
  AuthType["SSO"] = "SSO_SAML";
204
216
  /**
205
217
  * SSO using SAML
218
+ *
206
219
  * @deprecated Use {@link SAMLRedirect} instead
207
220
  * @hidden
208
221
  */
@@ -210,6 +223,7 @@ var AuthType;
210
223
  /**
211
224
  * SSO using SAML
212
225
  * Will make the host application redirect to the SAML Idp.
226
+ *
213
227
  * @example
214
228
  * ```js
215
229
  * init({
@@ -223,6 +237,7 @@ var AuthType;
223
237
  AuthType["SAMLRedirect"] = "SSO_SAML";
224
238
  /**
225
239
  * SSO using OIDC
240
+ *
226
241
  * @hidden
227
242
  * @deprecated Use {@link OIDCRedirect} instead
228
243
  */
@@ -234,14 +249,15 @@ var AuthType;
234
249
  AuthType["OIDCRedirect"] = "SSO_OIDC";
235
250
  /**
236
251
  * Trusted authentication server
252
+ *
237
253
  * @hidden
238
254
  * @deprecated Use {@link TrustedAuth} instead
239
255
  */
240
256
  AuthType["AuthServer"] = "AuthServer";
241
257
  /**
242
258
  * Trusted authentication server, Use your own authentication server
243
- * which returns a bearer token, generated using the secret_key obtained from
244
- * ThoughtSpot.
259
+ * which returns a bearer token, generated using the secret_key obtained
260
+ * from ThoughtSpot.
245
261
  *
246
262
  * @example
247
263
  * ```js
@@ -257,10 +273,11 @@ var AuthType;
257
273
  */
258
274
  AuthType["TrustedAuthToken"] = "AuthServer";
259
275
  /**
260
- * Trusted authentication server Cookieless, Use you own authentication server
261
- * which returns a bearer token, generated using the secret_key obtained from
262
- * ThoughtSpot. This uses a cookieless authentication approach, recommended
263
- * to by pass third-party cookie-blocking restriction implemented by some browsers
276
+ * Trusted authentication server Cookieless, Use you own authentication
277
+ * server which returns a bearer token, generated using the secret_key
278
+ * obtained from ThoughtSpot. This uses a cookieless authentication
279
+ * approach, recommended to by pass third-party cookie-blocking restriction
280
+ * implemented by some browsers
264
281
  */
265
282
  AuthType["TrustedAuthTokenCookieless"] = "AuthServerCookieless";
266
283
  /**
@@ -339,6 +356,7 @@ var RuntimeFilterOp;
339
356
  *
340
357
  * To add an event listener use the corresponding
341
358
  * {@link LiveboardEmbed.on} or {@link AppEmbed.on} or {@link SearchEmbed.on} method.
359
+ *
342
360
  * @group Events
343
361
  */
344
362
  // eslint-disable-next-line no-shadow
@@ -346,26 +364,31 @@ var EmbedEvent;
346
364
  (function (EmbedEvent) {
347
365
  /**
348
366
  * Rendering has initialized.
349
- * @return timestamp - The timestamp when the event was generated.
367
+ *
368
+ * @returns timestamp - The timestamp when the event was generated.
350
369
  */
351
370
  EmbedEvent["Init"] = "init";
352
371
  /**
353
372
  * Authentication has either succeeded or failed.
354
- * @return isLoggedIn - A Boolean specifying whether authentication was successful.
373
+ *
374
+ * @returns isLoggedIn - A Boolean specifying whether authentication was successful.
355
375
  */
356
376
  EmbedEvent["AuthInit"] = "authInit";
357
377
  /**
358
378
  * The embed object container has loaded.
359
- * @return timestamp - The timestamp when the event was generated.
379
+ *
380
+ * @returns timestamp - The timestamp when the event was generated.
360
381
  */
361
382
  EmbedEvent["Load"] = "load";
362
383
  /**
363
384
  * Data pertaining to answer or Liveboard is received
364
- * @return data - The answer or Liveboard data
385
+ *
386
+ * @returns data - The answer or Liveboard data
365
387
  */
366
388
  EmbedEvent["Data"] = "data";
367
389
  /**
368
390
  * Search/answer/Liveboard filters have been applied/updated
391
+ *
369
392
  * @hidden
370
393
  */
371
394
  EmbedEvent["FiltersChanged"] = "filtersChanged";
@@ -375,48 +398,56 @@ var EmbedEvent;
375
398
  EmbedEvent["QueryChanged"] = "queryChanged";
376
399
  /**
377
400
  * A drill down operation has been performed.
378
- * @return additionalFilters - Any additional filters applied
379
- * @return drillDownColumns - The columns on which drill down was performed
380
- * @return nonFilteredColumns - The columns that were not filtered
401
+ *
402
+ * @returns additionalFilters - Any additional filters applied
403
+ * @returns drillDownColumns - The columns on which drill down was performed
404
+ * @returns nonFilteredColumns - The columns that were not filtered
381
405
  */
382
406
  EmbedEvent["Drilldown"] = "drillDown";
383
407
  /**
384
408
  * One or more data sources have been selected.
385
- * @return dataSourceIds - the list of data sources
409
+ *
410
+ * @returns dataSourceIds - the list of data sources
386
411
  */
387
412
  EmbedEvent["DataSourceSelected"] = "dataSourceSelected";
388
413
  /**
389
414
  * One or more data columns have been selected.
390
- * @return columnIds - the list of columns
415
+ *
416
+ * @returns columnIds - the list of columns
391
417
  * @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
392
418
  */
393
419
  EmbedEvent["AddRemoveColumns"] = "addRemoveColumns";
394
420
  /**
395
421
  * A custom action has been triggered
396
- * @return actionId - The id of the custom action
397
- * @return data - The answer or Liveboard data
422
+ *
423
+ * @returns actionId - The id of the custom action
424
+ * @returns data - The answer or Liveboard data
398
425
  */
399
426
  EmbedEvent["CustomAction"] = "customAction";
400
427
  /**
401
428
  * A double click has been triggered on table/chart
402
- * @return ContextMenuInputPoints - data point that is double clicked
429
+ *
430
+ * @returns ContextMenuInputPoints - data point that is double clicked
403
431
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
404
432
  */
405
433
  EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
406
434
  /**
407
435
  * A click has been triggered on table/chart
408
- * @return ContextMenuInputPoints - data point that is clicked
436
+ *
437
+ * @returns ContextMenuInputPoints - data point that is clicked
409
438
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
410
439
  */
411
440
  EmbedEvent["VizPointClick"] = "vizPointClick";
412
441
  /**
413
442
  * An error has occurred.
414
- * @return error - An error object or message
443
+ *
444
+ * @returns error - An error object or message
415
445
  */
416
446
  EmbedEvent["Error"] = "Error";
417
447
  /**
418
448
  * The embedded object has sent an alert
419
- * @return alert - An alert object
449
+ *
450
+ * @returns alert - An alert object
420
451
  */
421
452
  EmbedEvent["Alert"] = "alert";
422
453
  /**
@@ -425,29 +456,34 @@ var EmbedEvent;
425
456
  EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
426
457
  /**
427
458
  * ThoughtSpot failed to validate the auth session.
459
+ *
428
460
  * @hidden
429
461
  */
430
462
  EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
431
463
  /**
432
464
  * ThoughtSpot failed to validate the auth session.
465
+ *
433
466
  * @hidden
434
467
  */
435
468
  EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
436
469
  /**
437
470
  * The height of the embedded Liveboard or visualization has been computed.
438
- * @return data - The height of the embedded Liveboard or visualization
471
+ *
472
+ * @returns data - The height of the embedded Liveboard or visualization
439
473
  * @hidden
440
474
  */
441
475
  EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
442
476
  /**
443
477
  * The center of visible iframe viewport is calculated.
444
- * @return data - The center of the visible Iframe viewport.
478
+ *
479
+ * @returns data - The center of the visible Iframe viewport.
445
480
  * @hidden
446
481
  */
447
482
  EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
448
483
  /**
449
484
  * Emitted when the "Get Data" button in Search Bar embed
450
485
  * is clicked.
486
+ *
451
487
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.0-sw
452
488
  */
453
489
  EmbedEvent["GetDataClick"] = "getDataClick";
@@ -457,6 +493,7 @@ var EmbedEvent;
457
493
  EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
458
494
  /**
459
495
  * The v1 event type for Data
496
+ *
460
497
  * @hidden
461
498
  */
462
499
  EmbedEvent["V1Data"] = "exportVizDataToParent";
@@ -469,17 +506,20 @@ var EmbedEvent;
469
506
  EmbedEvent["NoCookieAccess"] = "noCookieAccess";
470
507
  /**
471
508
  * Emitted when SAML is complete
509
+ *
472
510
  * @private
473
511
  * @hidden
474
512
  */
475
513
  EmbedEvent["SAMLComplete"] = "samlComplete";
476
514
  /**
477
515
  * Emitted when any modal is opened in the app
516
+ *
478
517
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
479
518
  */
480
519
  EmbedEvent["DialogOpen"] = "dialog-open";
481
520
  /**
482
521
  * Emitted when any modal is closed in the app
522
+ *
483
523
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
484
524
  */
485
525
  EmbedEvent["DialogClose"] = "dialog-close";
@@ -487,187 +527,238 @@ var EmbedEvent;
487
527
  * Emitted when the Liveboard shell loads.
488
528
  * You can use this event as a hook to trigger
489
529
  * other events on the rendered Liveboard.
530
+ *
490
531
  * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
491
532
  */
492
533
  EmbedEvent["LiveboardRendered"] = "PinboardRendered";
493
534
  /**
494
535
  * This can be used to register an event listener which
495
536
  * is triggered on all events.
537
+ *
496
538
  * @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
497
539
  */
498
540
  EmbedEvent["ALL"] = "*";
499
541
  /**
500
542
  * Emitted when answer is saved in the app
543
+ *
501
544
  * @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
502
545
  */
503
546
  EmbedEvent["Save"] = "save";
504
547
  /**
505
548
  * Emitted when the download action is triggered on an answer
549
+ *
506
550
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
507
551
  */
508
552
  EmbedEvent["Download"] = "download";
553
+ /**
554
+ * Emitted when the download action is triggered on an answer
555
+ *
556
+ * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0-sw
557
+ */
558
+ EmbedEvent["DownloadAsPng"] = "downloadAsPng";
509
559
  /**
510
560
  * Emitted when the Download as PDF action is triggered on an answer
561
+ *
511
562
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
512
563
  */
513
564
  EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
514
565
  /**
515
566
  * Emitted when the Download as CSV action is triggered on an answer
567
+ *
516
568
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
517
569
  */
518
570
  EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
519
571
  /**
520
572
  * Emitted when the Download as XLSX action is triggered on an answer
573
+ *
521
574
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
522
575
  */
523
576
  EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
524
577
  /**
525
578
  * Emitted when an answer is deleted in the app
579
+ *
526
580
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
527
581
  */
528
582
  EmbedEvent["AnswerDelete"] = "answerDelete";
529
583
  /**
530
584
  * Emitted when an answer is pinned to a Liveboard
585
+ *
531
586
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
532
587
  */
533
588
  EmbedEvent["Pin"] = "pin";
534
589
  /**
535
590
  * Emitted when SpotIQ analysis is triggered
591
+ *
536
592
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
537
593
  */
538
594
  EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
539
595
  /**
540
596
  * Emitted when a user shares an object with another user or group
597
+ *
541
598
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
542
599
  */
543
600
  EmbedEvent["Share"] = "share";
544
601
  /**
545
- * Emitted when a user clicks the Include action to include a specific value or data on a chart or table
602
+ * Emitted when a user clicks the Include action to include a specific value or data
603
+ * on a chart or table
604
+ *
546
605
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
547
606
  */
548
607
  EmbedEvent["DrillInclude"] = "context-menu-item-include";
549
608
  /**
550
- * Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
609
+ * Emitted when a user clicks the Exclude action to exclude a specific value or data
610
+ * on a chart or table
611
+ *
551
612
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
552
613
  */
553
614
  EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
554
615
  /**
555
616
  * Emitted when copied column value on the app
617
+ *
556
618
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
557
619
  */
558
620
  EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
559
621
  /**
560
622
  * Emitted when a user clicks the Update TML action
623
+ *
561
624
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
562
625
  */
563
626
  EmbedEvent["UpdateTML"] = "updateTSL";
564
627
  /**
565
628
  * Emitted when a user clicks the Edit TML action
629
+ *
566
630
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
567
631
  */
568
632
  EmbedEvent["EditTML"] = "editTSL";
569
633
  /**
570
634
  * Emitted when ExportTML trigger in answer on the app
635
+ *
571
636
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
572
637
  */
573
638
  EmbedEvent["ExportTML"] = "exportTSL";
574
639
  /**
575
640
  * Emitted when an answer is saved as a view
641
+ *
576
642
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
577
643
  */
578
644
  EmbedEvent["SaveAsView"] = "saveAsView";
579
645
  /**
580
646
  * Emitted when copy of existing answer on the app
647
+ *
581
648
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
582
649
  */
583
650
  EmbedEvent["CopyAEdit"] = "copyAEdit";
584
651
  /**
585
652
  * Emitted when a user clicks Show underlying data on an answe
653
+ *
586
654
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
587
655
  */
588
656
  EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
589
657
  /**
590
658
  * Emitted when an answer is switched to a chart or table view
659
+ *
591
660
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
592
661
  */
593
662
  EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
594
663
  /**
595
664
  * Internal event to communicate the initial settings back to the TS APP
665
+ *
596
666
  * @hidden
597
667
  */
598
668
  EmbedEvent["APP_INIT"] = "appInit";
599
669
  /**
600
670
  * Emitted when a user clicks Show Liveboard details on a Liveboard
671
+ *
601
672
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
602
673
  */
603
674
  EmbedEvent["LiveboardInfo"] = "pinboardInfo";
604
675
  /**
605
676
  * Emitted when a user clicks on the Favorite icon on a Liveboard
677
+ *
606
678
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
607
679
  */
608
680
  EmbedEvent["AddToFavorites"] = "addToFavorites";
609
681
  /**
610
682
  * Emitted when a user clicks Schedule on a Liveboard
683
+ *
611
684
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
612
685
  */
613
686
  EmbedEvent["Schedule"] = "subscription";
614
687
  /**
615
688
  * Emitted when a user clicks Edit on a Liveboard or visualization
689
+ *
616
690
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
617
691
  */
618
692
  EmbedEvent["Edit"] = "edit";
619
693
  /**
620
694
  * Emitted when a user clicks Make a copy on a Liveboard
695
+ *
621
696
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
622
697
  */
623
698
  EmbedEvent["MakeACopy"] = "makeACopy";
624
699
  /**
625
700
  * Emitted when a user clicks Present on a Liveboard or visualization
701
+ *
626
702
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
627
703
  */
628
704
  EmbedEvent["Present"] = "present";
629
705
  /**
630
706
  * Emitted when a user clicks Delete on a Liveboard
707
+ *
631
708
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
632
709
  */
633
710
  EmbedEvent["Delete"] = "delete";
634
711
  /**
635
712
  * Emitted when a user clicks Manage schedules on a Liveboard
713
+ *
636
714
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
637
715
  */
638
716
  EmbedEvent["SchedulesList"] = "schedule-list";
639
717
  /**
640
718
  * Emitted when a user clicks Cancel in edit mode on a Liveboard
719
+ *
641
720
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
642
721
  */
643
722
  EmbedEvent["Cancel"] = "cancel";
644
723
  /**
645
724
  * Emitted when a user clicks Explore on a visualization
725
+ *
646
726
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
647
727
  */
648
728
  EmbedEvent["Explore"] = "explore";
649
729
  /**
650
730
  * Emitted when a user clicks Copy link action on a visualization
731
+ *
651
732
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
652
733
  */
653
734
  EmbedEvent["CopyLink"] = "embedDocument";
654
735
  /**
655
736
  * Emitted when a user interacts with cross filters on a visualization or liveboard
737
+ *
656
738
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
657
739
  */
658
740
  EmbedEvent["CrossFilterChanged"] = "cross-filter-changed";
659
741
  /**
660
742
  * Emitted when a user right clicks on chart or table
743
+ *
661
744
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
662
745
  */
663
746
  EmbedEvent["VizPointRightClick"] = "vizPointRightClick";
747
+ /**
748
+ * Emitted when a user clicks on Insert to slide on a visualization
749
+ *
750
+ * @hidden
751
+ */
752
+ EmbedEvent["InsertIntoSlide"] = "insertInToSlide";
664
753
  })(EmbedEvent || (EmbedEvent = {}));
665
754
  /**
666
755
  * Event types that can be triggered by the host application
667
756
  * to the embedded ThoughtSpot app
668
757
  *
669
758
  * To trigger an event use the corresponding
670
- * {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link SearchEmbed.trigger} method.
759
+ * {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
760
+ * SearchEmbed.trigger} method.
761
+ *
671
762
  * @group Events
672
763
  */
673
764
  // eslint-disable-next-line no-shadow
@@ -675,6 +766,7 @@ var HostEvent;
675
766
  (function (HostEvent) {
676
767
  /**
677
768
  * Trigger a search
769
+ *
678
770
  * @param - dataSourceIds - The data source GUID to Search on
679
771
  * - Although an array, only a single source
680
772
  * is supported at this time.
@@ -692,10 +784,12 @@ var HostEvent;
692
784
  HostEvent["Search"] = "search";
693
785
  /**
694
786
  * Trigger a drill on certain points by certain column
787
+ *
695
788
  * @param - points - an object containing selectedPoints/clickedPoints
696
789
  * eg. { selectedPoints: []}
697
790
  * @param - columnGuid - a string guid of the column to drill by. This is optional,
698
- * if not provided it will auto drill by the configured column.
791
+ * if not provided it will auto drill by the configured
792
+ * column.
699
793
  * @example
700
794
  * ```js
701
795
  * searchEmbed.trigger(HostEvent.DrillDown, {
@@ -703,44 +797,50 @@ var HostEvent;
703
797
  * autoDrillDown: true,
704
798
  * })
705
799
  * ```
706
- *
707
800
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
708
801
  */
709
802
  HostEvent["DrillDown"] = "triggerDrillDown";
710
803
  /**
711
804
  * Apply filters
805
+ *
712
806
  * @hidden
713
807
  */
714
808
  HostEvent["Filter"] = "filter";
715
809
  /**
716
810
  * Reload the answer or visualization
811
+ *
717
812
  * @hidden
718
813
  */
719
814
  HostEvent["Reload"] = "reload";
720
815
  /**
721
816
  * Set the visible visualizations on a Liveboard.
817
+ *
722
818
  * @param - an array of ids of visualizations to show, the ids not passed
723
819
  * will be hidden.
724
820
  * @example
725
- * liveboardEmbed.trigger(HostEvent.SetVisibleVizs, ['730496d6-6903-4601-937e-2c691821af3c', 'd547ec54-2a37-4516-a222-2b06719af726'])
821
+ * liveboardEmbed.trigger(HostEvent.SetVisibleVizs, [
822
+ * '730496d6-6903-4601-937e-2c691821af3c',
823
+ * 'd547ec54-2a37-4516-a222-2b06719af726'])
726
824
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
727
825
  */
728
826
  HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
729
827
  /**
730
828
  * Update the runtime filters. The runtime filters passed here are extended
731
829
  * on to the existing runtime filters if they exist.
830
+ *
732
831
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
733
832
  * @example
734
833
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
735
834
  * {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
736
- * {columnName: "item type",operator: RuntimeFilterOp.EQ,values: ["Jackets"]}
737
- * ])
835
+ * {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
836
+ * ["Jackets"]} ])
738
837
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
739
838
  */
740
839
  HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
741
840
  /**
742
841
  * Navigate to a specific page in App embed without any reload.
743
842
  * This is the same as calling `appEmbed.navigateToPage(path, true)`
843
+ *
744
844
  * @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
745
845
  * @example
746
846
  * ```js
@@ -752,16 +852,22 @@ var HostEvent;
752
852
  /**
753
853
  * Opens the filter panel for a particular column.
754
854
  * Works with Search embed.
755
- * @param - { columnId: string, name: string, type: INT64/CHAR/DATE, dataType: ATTRIBUTE/MEASURE }
855
+ *
856
+ * @param - { columnId: string,
857
+ * name: string,
858
+ * type: INT64/CHAR/DATE,
859
+ * dataType: ATTRIBUTE/MEASURE }
756
860
  * @example
757
861
  * ```js
758
- * searchEmbed.trigger(HostEvent.OpenFilter, { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
862
+ * searchEmbed.trigger(HostEvent.OpenFilter,
863
+ * { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
759
864
  * ```
760
865
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
761
866
  */
762
867
  HostEvent["OpenFilter"] = "openFilter";
763
868
  /**
764
869
  * Adds the columns to the current Search.
870
+ *
765
871
  * @param - { columnIds: string[] }
766
872
  * @example
767
873
  * ```js
@@ -772,6 +878,7 @@ var HostEvent;
772
878
  HostEvent["AddColumns"] = "addColumns";
773
879
  /**
774
880
  * Removes a column from the current Search.
881
+ *
775
882
  * @param - { columnId: string }
776
883
  * @example
777
884
  * ```js
@@ -782,6 +889,7 @@ var HostEvent;
782
889
  HostEvent["RemoveColumn"] = "removeColumn";
783
890
  /**
784
891
  * Gets the current pinboard content.
892
+ *
785
893
  * @example
786
894
  * ```js
787
895
  * liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
@@ -791,6 +899,7 @@ var HostEvent;
791
899
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
792
900
  /**
793
901
  * Triggers the Pin action on an embedded object
902
+ *
794
903
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
795
904
  * can be left empty for search and visualization embeds
796
905
  * @example
@@ -804,6 +913,7 @@ var HostEvent;
804
913
  HostEvent["Pin"] = "pin";
805
914
  /**
806
915
  * Triggers the Show Liveboard details action on a Liveboard
916
+ *
807
917
  * @example
808
918
  * ```js
809
919
  * liveboardEmbed.trigger(HostEvent.LiveboardInfo)
@@ -813,6 +923,7 @@ var HostEvent;
813
923
  HostEvent["LiveboardInfo"] = "pinboardInfo";
814
924
  /**
815
925
  * Triggers the Schedule action on a Liveboard
926
+ *
816
927
  * @example
817
928
  * ```js
818
929
  * liveboardEmbed.trigger(HostEvent.Schedule)
@@ -822,6 +933,7 @@ var HostEvent;
822
933
  HostEvent["Schedule"] = "subscription";
823
934
  /**
824
935
  * Triggers the Manage schedule action on a Liveboard
936
+ *
825
937
  * @example
826
938
  * ```js
827
939
  * liveboardEmbed.trigger(HostEvent.ScheduleList)
@@ -831,6 +943,7 @@ var HostEvent;
831
943
  HostEvent["SchedulesList"] = "schedule-list";
832
944
  /**
833
945
  * Triggers the Export TML action on a Liveboard
946
+ *
834
947
  * @example
835
948
  * ```js
836
949
  * liveboardEmbed.trigger(HostEvent.ExportTML)
@@ -840,6 +953,7 @@ var HostEvent;
840
953
  HostEvent["ExportTML"] = "exportTSL";
841
954
  /**
842
955
  * Triggers the Edit TML action on a Liveboard
956
+ *
843
957
  * @example
844
958
  * ```js
845
959
  * liveboardEmbed.trigger(HostEvent.EditTML)
@@ -849,6 +963,7 @@ var HostEvent;
849
963
  HostEvent["EditTML"] = "editTSL";
850
964
  /**
851
965
  * Triggers the Update TML action on a Liveboard
966
+ *
852
967
  * @example
853
968
  * ```js
854
969
  * liveboardEmbed.trigger(HostEvent.UpdateTML)
@@ -858,6 +973,7 @@ var HostEvent;
858
973
  HostEvent["UpdateTML"] = "updateTSL";
859
974
  /**
860
975
  * Triggers the Download PDF action on a Liveboard
976
+ *
861
977
  * @example
862
978
  * ```js
863
979
  * liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
@@ -867,6 +983,7 @@ var HostEvent;
867
983
  HostEvent["DownloadAsPdf"] = "downloadAsPdf";
868
984
  /**
869
985
  * Triggers the Make a copy action on a Liveboard, search or visualization
986
+ *
870
987
  * @example
871
988
  * ```js
872
989
  * liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
@@ -878,6 +995,7 @@ var HostEvent;
878
995
  HostEvent["MakeACopy"] = "makeACopy";
879
996
  /**
880
997
  * Triggers the Delete action on a Liveboard
998
+ *
881
999
  * @example
882
1000
  * ```js
883
1001
  * appEmbed.trigger(HostEvent.Remove)
@@ -887,6 +1005,7 @@ var HostEvent;
887
1005
  HostEvent["Remove"] = "delete";
888
1006
  /**
889
1007
  * Triggers the Explore action on a visualization
1008
+ *
890
1009
  * @param - an object with vizId as a key
891
1010
  * @example
892
1011
  * ```js
@@ -897,37 +1016,48 @@ var HostEvent;
897
1016
  HostEvent["Explore"] = "explore";
898
1017
  /**
899
1018
  * Triggers the Create alert action on a visualization
1019
+ *
900
1020
  * @param - an object with vizId as a key
901
1021
  * @example
902
1022
  * ```js
903
- * liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1023
+ * liveboardEmbed.trigger(HostEvent.CreateMonitor {
1024
+ * vizId: '730496d6-6903-4601-937e-2c691821af3c'
1025
+ * })
904
1026
  * ```
905
1027
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
906
1028
  */
907
1029
  HostEvent["CreateMonitor"] = "createMonitor";
908
1030
  /**
909
1031
  * Triggers the Manage alert action on a visualization
1032
+ *
910
1033
  * @param - an object with vizId as a key
911
1034
  * @example
912
1035
  * ```js
913
- * liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1036
+ * liveboardEmbed.trigger(HostEvent.ManageMonitor, {
1037
+ * vizId: '730496d6-6903-4601-937e-2c691821af3c'
1038
+ * })
914
1039
  * ```
915
1040
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
916
1041
  */
917
1042
  HostEvent["ManageMonitor"] = "manageMonitor";
918
1043
  /**
919
1044
  * Triggers the Edit action on a Liveboard or visualization
920
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1045
+ *
1046
+ * @param - object - to trigger the action for a specfic visualization
1047
+ * in Liveboard embed, pass in vizId as a key
921
1048
  * @example
922
1049
  * liveboardEmbed.trigger(HostEvent.Edit)
923
- * liveboardEmbed.trigger(HostEvent.Edit, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1050
+ * liveboardEmbed.trigger(HostEvent.Edit, {vizId:
1051
+ * '730496d6-6903-4601-937e-2c691821af3c'})
924
1052
  * vizEmbed.trigger((HostEvent.Edit)
925
1053
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
926
1054
  */
927
1055
  HostEvent["Edit"] = "edit";
928
1056
  /**
929
1057
  * Triggers the Copy link action on a Liveboard or visualization
930
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1058
+ *
1059
+ * @param - object - to trigger the action for a s
1060
+ * pecfic visualization in Liveboard embed, pass in vizId as a key
931
1061
  * @example
932
1062
  * ```js
933
1063
  * liveboardEmbed.trigger(HostEvent.CopyLink)
@@ -939,7 +1069,9 @@ var HostEvent;
939
1069
  HostEvent["CopyLink"] = "embedDocument";
940
1070
  /**
941
1071
  * Triggers the Present action on a Liveboard or visualization
942
- * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1072
+ *
1073
+ * @param - object - to trigger the action for a specfic visualization
1074
+ * in Liveboard embed, pass in vizId as a key
943
1075
  * @example
944
1076
  * ```js
945
1077
  * liveboardEmbed.trigger(HostEvent.Present)
@@ -951,18 +1083,21 @@ var HostEvent;
951
1083
  HostEvent["Present"] = "present";
952
1084
  /**
953
1085
  * Get TML for the current search.
1086
+ *
954
1087
  * @example
955
1088
  * ```js
956
1089
  * searchEmbed.trigger(HostEvent.GetTML)
957
1090
  * ```
958
- * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
1091
+ * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
959
1092
  */
960
1093
  HostEvent["GetTML"] = "getTML";
961
1094
  /**
962
1095
  * Triggers the ShowUnderlyingData action on visualization or search
1096
+ *
963
1097
  * @param - an object with vizId as a key
964
1098
  * @example
965
- * liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1099
+ * liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId:
1100
+ * '730496d6-6903-4601-937e-2c691821af3c'})
966
1101
  * vizEmbed.trigger(HostEvent.ShowUnderlyingData)
967
1102
  * searchEmbed.trigger(HostEvent.ShowUnderlyingData)
968
1103
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
@@ -970,10 +1105,12 @@ var HostEvent;
970
1105
  HostEvent["ShowUnderlyingData"] = "showUnderlyingData";
971
1106
  /**
972
1107
  * Triggers the Delete action on visualization or search
1108
+ *
973
1109
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
974
1110
  * can be left empty for search and visualization embeds
975
1111
  * @example
976
- * liveboardEmbed.trigger(HostEvent.Delete, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1112
+ * liveboardEmbed.trigger(HostEvent.Delete, {vizId:
1113
+ * '730496d6-6903-4601-937e-2c691821af3c'})
977
1114
  * vizEmbed.trigger(HostEvent.Delete)
978
1115
  * searchEmbed.trigger(HostEvent.Delete)
979
1116
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
@@ -981,10 +1118,12 @@ var HostEvent;
981
1118
  HostEvent["Delete"] = "delete";
982
1119
  /**
983
1120
  * Triggers the SpotIQAnalyze action on visualization or search
1121
+ *
984
1122
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
985
1123
  * can be left empty for search and visualization embeds
986
1124
  * @example
987
- * liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1125
+ * liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId:
1126
+ * '730496d6-6903-4601-937e-2c691821af3c'})
988
1127
  * vizEmbed.trigger(HostEvent.SpotIQAnalyze)
989
1128
  * searchEmbed.trigger(HostEvent.SpotIQAnalyze)
990
1129
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
@@ -992,26 +1131,50 @@ var HostEvent;
992
1131
  HostEvent["SpotIQAnalyze"] = "spotIQAnalyze";
993
1132
  /**
994
1133
  * Triggers the Download action on visualization or search when Displaymode is Chart
1134
+ *
995
1135
  * @example
996
- * liveboardEmbed.trigger(HostEvent.Download, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1136
+ * liveboardEmbed.trigger(HostEvent.Download, {vizId:
1137
+ * '730496d6-6903-4601-937e-2c691821af3c'})
997
1138
  * vizEmbed.trigger(HostEvent.Download)
998
1139
  * searchEmbed.trigger(HostEvent.Download)
1140
+ * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1-sw, Please use DownloadAsPng
999
1141
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1000
1142
  */
1001
- HostEvent["Download"] = "download";
1143
+ HostEvent["Download"] = "downloadAsPng";
1002
1144
  /**
1003
- * Triggers the downloadAsCSV action on visualization or search when Displaymode is Table
1145
+ * Triggers the Download action on visualization or search when Displaymode is Chart
1146
+ *
1004
1147
  * @example
1005
- * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1148
+ * ```js
1149
+ * liveboardEmbed.trigger(HostEvent.DownloadAsPng,
1150
+ * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
1151
+ * ```
1152
+ * ```js
1153
+ * vizEmbed.trigger(HostEvent.DownloadAsPng)
1154
+ * ```
1155
+ * ```js
1156
+ * searchEmbed.trigger(HostEvent.DownloadAsPng)
1157
+ * ```
1158
+ * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1-sw
1159
+ */
1160
+ HostEvent["DownloadAsPng"] = "downloadAsPng";
1161
+ /**
1162
+ * Triggers the downloadAsCSV action on visualization or search
1163
+ *
1164
+ * @example
1165
+ * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
1166
+ * '730496d6-6903-4601-937e-2c691821af3c'})
1006
1167
  * vizEmbed.trigger(HostEvent.DownloadAsCsv)
1007
1168
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
1008
1169
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1009
1170
  */
1010
1171
  HostEvent["DownloadAsCsv"] = "downloadAsCSV";
1011
1172
  /**
1012
- * Triggers the downloadAsXLSX action on visualization or search when Displaymode is Table
1173
+ * Triggers the downloadAsXLSX action on visualization or search
1174
+ *
1013
1175
  * @example
1014
- * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1176
+ * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
1177
+ * '730496d6-6903-4601-937e-2c691821af3c'})
1015
1178
  * vizEmbed.trigger(HostEvent.DownloadAsXlsx)
1016
1179
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
1017
1180
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
@@ -1019,6 +1182,7 @@ var HostEvent;
1019
1182
  HostEvent["DownloadAsXlsx"] = "downloadAsXLSX";
1020
1183
  /**
1021
1184
  * Triggers the Share action on a liveboard or answer
1185
+ *
1022
1186
  * @example
1023
1187
  * liveboardEmbed.trigger(HostEvent.Share)
1024
1188
  * searchEmbed.trigger(HostEvent.Share)
@@ -1027,6 +1191,7 @@ var HostEvent;
1027
1191
  HostEvent["Share"] = "share";
1028
1192
  /**
1029
1193
  * Trigger the Save action on a liveboard or answer
1194
+ *
1030
1195
  * @example
1031
1196
  * liveboardEmbed.trigger(HostEvent.Save)
1032
1197
  * searchEmbed.trigger(HostEvent.Save)
@@ -1035,33 +1200,40 @@ var HostEvent;
1035
1200
  HostEvent["Save"] = "save";
1036
1201
  /**
1037
1202
  * Triggers the SyncToSheets action on visualization
1203
+ *
1038
1204
  * @param - an object with vizId as a key
1039
1205
  * @example
1040
- * liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1206
+ * liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId:
1207
+ * '730496d6-6903-4601-937e-2c691821af3c'})
1041
1208
  * vizEmbed.trigger(HostEvent.SyncToSheets)
1042
1209
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1043
1210
  */
1044
1211
  HostEvent["SyncToSheets"] = "sync-to-sheets";
1045
1212
  /**
1046
1213
  * Triggers the SyncToOtherApps action on visualization
1214
+ *
1047
1215
  * @param - an object with vizId as a key
1048
1216
  * @example
1049
- * liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1217
+ * liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId:
1218
+ * '730496d6-6903-4601-937e-2c691821af3c'})
1050
1219
  * vizEmbed.trigger(HostEvent.SyncToOtherApps)
1051
1220
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1052
1221
  */
1053
1222
  HostEvent["SyncToOtherApps"] = "sync-to-other-apps";
1054
1223
  /**
1055
1224
  * Triggers the ManagePipelines action on visualization
1225
+ *
1056
1226
  * @param - an object with vizId as a key
1057
1227
  * @example
1058
- * liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1228
+ * liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId:
1229
+ * '730496d6-6903-4601-937e-2c691821af3c'})
1059
1230
  * vizEmbed.trigger(HostEvent.ManagePipelines)
1060
1231
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1061
1232
  */
1062
1233
  HostEvent["ManagePipelines"] = "manage-pipeline";
1063
1234
  /**
1064
1235
  * Triggers the Reset search in answer
1236
+ *
1065
1237
  * @example
1066
1238
  * searchEmbed.trigger(HostEvent.SearchReset
1067
1239
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.0.1-sw
@@ -1095,6 +1267,7 @@ var DataSourceVisualMode;
1095
1267
  // eslint-disable-next-line no-shadow
1096
1268
  var Param;
1097
1269
  (function (Param) {
1270
+ Param["EmbedApp"] = "embedApp";
1098
1271
  Param["DataSources"] = "dataSources";
1099
1272
  Param["DataSourceMode"] = "dataSourceMode";
1100
1273
  Param["DisableActions"] = "disableAction";
@@ -1135,6 +1308,8 @@ var Param;
1135
1308
  Param["ContextMenuTrigger"] = "isContextMenuEnabledOnLeftClick";
1136
1309
  Param["LinkOverride"] = "linkOverride";
1137
1310
  Param["ShowInsertToSlide"] = "insertInToSlide";
1311
+ Param["PrimaryNavHidden"] = "primaryNavHidden";
1312
+ Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
1138
1313
  })(Param || (Param = {}));
1139
1314
  /**
1140
1315
  * The list of actions that can be performed on visual ThoughtSpot
@@ -1189,6 +1364,7 @@ var Action;
1189
1364
  Action["ReplaySearch"] = "replaySearch";
1190
1365
  Action["ShowUnderlyingData"] = "showUnderlyingData";
1191
1366
  Action["Download"] = "download";
1367
+ Action["DownloadAsPng"] = "downloadAsPng";
1192
1368
  Action["DownloadAsPdf"] = "downloadAsPdf";
1193
1369
  Action["DownloadAsCsv"] = "downloadAsCSV";
1194
1370
  Action["DownloadAsXlsx"] = "downloadAsXLSX";
@@ -1389,6 +1565,7 @@ const urlRegex = new RegExp([
1389
1565
  /**
1390
1566
  * Parse and construct the ThoughtSpot hostname or IP address
1391
1567
  * from the embed configuration object.
1568
+ *
1392
1569
  * @param config
1393
1570
  */
1394
1571
  const getThoughtSpotHost = (config) => {
@@ -1412,9 +1589,10 @@ const getV2BasePath = (config) => {
1412
1589
  return config.basepath;
1413
1590
  }
1414
1591
  const tsHost = getThoughtSpotHost(config);
1415
- // This is to handle when e2e's. Search is run on pods for comp-blink-test-pipeline
1416
- // with baseUrl=https://localhost:8443.
1417
- // This is to handle when the developer is developing in their local environment.
1592
+ // This is to handle when e2e's. Search is run on pods for
1593
+ // comp-blink-test-pipeline with baseUrl=https://localhost:8443.
1594
+ // This is to handle when the developer is developing in their local
1595
+ // environment.
1418
1596
  if (tsHost.includes('://localhost') && !tsHost.includes(':8443')) {
1419
1597
  return '';
1420
1598
  }
@@ -7424,6 +7602,7 @@ let isMixpanelInitialized = false;
7424
7602
  let eventQueue = [];
7425
7603
  /**
7426
7604
  * Pushes the event with its Property key-value map to mixpanel.
7605
+ *
7427
7606
  * @param eventId
7428
7607
  * @param eventProps
7429
7608
  */
@@ -7434,6 +7613,9 @@ function uploadMixpanelEvent(eventId, eventProps = {}) {
7434
7613
  }
7435
7614
  mixpanel_cjs.track(eventId, eventProps);
7436
7615
  }
7616
+ /**
7617
+ *
7618
+ */
7437
7619
  function emptyQueue() {
7438
7620
  if (!isMixpanelInitialized) {
7439
7621
  return;
@@ -7443,11 +7625,16 @@ function emptyQueue() {
7443
7625
  });
7444
7626
  eventQueue = [];
7445
7627
  }
7628
+ /**
7629
+ *
7630
+ * @param sessionInfo
7631
+ */
7446
7632
  function initMixpanel(sessionInfo) {
7447
7633
  if (!sessionInfo || !sessionInfo.mixpanelToken) {
7448
7634
  return;
7449
7635
  }
7450
- // On a public cluster the user is anonymous, so don't set the identify to userGUID
7636
+ // On a public cluster the user is anonymous, so don't set the identify to
7637
+ // userGUID
7451
7638
  const isPublicCluster = !!sessionInfo.isPublicUser;
7452
7639
  const token = sessionInfo.mixpanelToken;
7453
7640
  if (token) {
@@ -8926,6 +9113,11 @@ function uniq(array) {
8926
9113
  var uniq_1 = uniq;
8927
9114
 
8928
9115
  // eslint-disable-next-line import/no-cycle
9116
+ /**
9117
+ *
9118
+ * @param url
9119
+ * @param options
9120
+ */
8929
9121
  function failureLoggedFetch(url, options = {}) {
8930
9122
  return fetch(url, options).then(async (r) => {
8931
9123
  var _a;
@@ -8935,21 +9127,42 @@ function failureLoggedFetch(url, options = {}) {
8935
9127
  return r;
8936
9128
  });
8937
9129
  }
9130
+ /**
9131
+ *
9132
+ * @param authVerificationUrl
9133
+ */
8938
9134
  function fetchSessionInfoService(authVerificationUrl) {
8939
9135
  return failureLoggedFetch(authVerificationUrl, {
8940
9136
  credentials: 'include',
8941
9137
  });
8942
9138
  }
9139
+ /**
9140
+ *
9141
+ * @param authEndpoint
9142
+ */
8943
9143
  async function fetchAuthTokenService(authEndpoint) {
8944
9144
  return fetch(authEndpoint);
8945
9145
  }
9146
+ /**
9147
+ *
9148
+ * @param thoughtSpotHost
9149
+ * @param username
9150
+ * @param authToken
9151
+ */
8946
9152
  async function fetchAuthService(thoughtSpotHost, username, authToken) {
8947
9153
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
8948
9154
  credentials: 'include',
8949
- // We do not want to follow the redirect, as it starts giving a CORS error
9155
+ // We do not want to follow the redirect, as it starts giving a CORS
9156
+ // error
8950
9157
  redirect: 'manual',
8951
9158
  });
8952
9159
  }
9160
+ /**
9161
+ *
9162
+ * @param thoughtSpotHost
9163
+ * @param username
9164
+ * @param authToken
9165
+ */
8953
9166
  async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
8954
9167
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
8955
9168
  method: 'POST',
@@ -8959,10 +9172,17 @@ async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
8959
9172
  },
8960
9173
  body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
8961
9174
  credentials: 'include',
8962
- // We do not want to follow the redirect, as it starts giving a CORS error
9175
+ // We do not want to follow the redirect, as it starts giving a CORS
9176
+ // error
8963
9177
  redirect: 'manual',
8964
9178
  });
8965
9179
  }
9180
+ /**
9181
+ *
9182
+ * @param thoughtSpotHost
9183
+ * @param username
9184
+ * @param password
9185
+ */
8966
9186
  async function fetchBasicAuthService(thoughtSpotHost, username, password) {
8967
9187
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
8968
9188
  method: 'POST',
@@ -8974,6 +9194,10 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
8974
9194
  credentials: 'include',
8975
9195
  });
8976
9196
  }
9197
+ /**
9198
+ *
9199
+ * @param thoughtSpotHost
9200
+ */
8977
9201
  async function fetchLogoutService(thoughtSpotHost) {
8978
9202
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
8979
9203
  credentials: 'include',
@@ -9008,6 +9232,7 @@ const EndPoints = {
9008
9232
  /**
9009
9233
  * Enum for auth failure types. This is the parameter passed to the listner
9010
9234
  * of {@link AuthStatus.FAILURE}.
9235
+ *
9011
9236
  * @group Authentication / Init
9012
9237
  */
9013
9238
  var AuthFailureType;
@@ -9019,6 +9244,7 @@ var AuthFailureType;
9019
9244
  })(AuthFailureType || (AuthFailureType = {}));
9020
9245
  /**
9021
9246
  * Enum for auth status emitted by the emitter returned from {@link init}.
9247
+ *
9022
9248
  * @group Authentication / Init
9023
9249
  */
9024
9250
  var AuthStatus;
@@ -9043,12 +9269,14 @@ var AuthStatus;
9043
9269
  * Emitted when inPopup: true in the SAMLRedirect flow.
9044
9270
  * And, we are waiting for popup to be triggered either programatically
9045
9271
  * or by the trigger button.
9272
+ *
9046
9273
  * @version SDK: 1.19.0
9047
9274
  */
9048
9275
  AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
9049
9276
  })(AuthStatus || (AuthStatus = {}));
9050
9277
  /**
9051
9278
  * Events which can be triggered on the emitter returned from {@link init}.
9279
+ *
9052
9280
  * @group Authentication / Init
9053
9281
  */
9054
9282
  var AuthEvent;
@@ -9060,9 +9288,16 @@ var AuthEvent;
9060
9288
  AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
9061
9289
  })(AuthEvent || (AuthEvent = {}));
9062
9290
  let authEE;
9291
+ /**
9292
+ *
9293
+ * @param eventEmitter
9294
+ */
9063
9295
  function setAuthEE(eventEmitter) {
9064
9296
  authEE = eventEmitter;
9065
9297
  }
9298
+ /**
9299
+ *
9300
+ */
9066
9301
  function notifyAuthSDKSuccess() {
9067
9302
  if (!authEE) {
9068
9303
  console.error('SDK not initialized');
@@ -9070,6 +9305,9 @@ function notifyAuthSDKSuccess() {
9070
9305
  }
9071
9306
  authEE.emit(AuthStatus.SDK_SUCCESS);
9072
9307
  }
9308
+ /**
9309
+ *
9310
+ */
9073
9311
  function notifyAuthSuccess() {
9074
9312
  if (!authEE) {
9075
9313
  console.error('SDK not initialized');
@@ -9077,6 +9315,10 @@ function notifyAuthSuccess() {
9077
9315
  }
9078
9316
  authEE.emit(AuthStatus.SUCCESS, sessionInfo);
9079
9317
  }
9318
+ /**
9319
+ *
9320
+ * @param failureType
9321
+ */
9080
9322
  function notifyAuthFailure(failureType) {
9081
9323
  if (!authEE) {
9082
9324
  console.error('SDK not initialized');
@@ -9084,6 +9326,9 @@ function notifyAuthFailure(failureType) {
9084
9326
  }
9085
9327
  authEE.emit(AuthStatus.FAILURE, failureType);
9086
9328
  }
9329
+ /**
9330
+ *
9331
+ */
9087
9332
  function notifyLogout() {
9088
9333
  if (!authEE) {
9089
9334
  console.error('SDK not initialized');
@@ -9093,6 +9338,7 @@ function notifyLogout() {
9093
9338
  }
9094
9339
  /**
9095
9340
  * Check if we are logged into the ThoughtSpot cluster
9341
+ *
9096
9342
  * @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
9097
9343
  */
9098
9344
  async function isLoggedIn(thoughtSpotHost) {
@@ -9115,21 +9361,30 @@ function getReleaseVersion() {
9115
9361
  return releaseVersion;
9116
9362
  }
9117
9363
  /**
9118
- * Return a promise that resolves with the session information when authentication is
9119
- * successful. And info is available.
9364
+ * Return a promise that resolves with the session information when
9365
+ * authentication is successful. And info is available.
9366
+ *
9120
9367
  * @group Global methods
9121
9368
  */
9122
9369
  function getSessionInfo() {
9123
9370
  return sessionInfoPromise;
9124
9371
  }
9372
+ /**
9373
+ *
9374
+ * @param sessionDetails
9375
+ */
9125
9376
  function initSession(sessionDetails) {
9126
9377
  sessionInfo = sessionDetails;
9127
9378
  initMixpanel(sessionInfo);
9128
9379
  sessionInfoResolver(sessionInfo);
9129
9380
  }
9130
- const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.' +
9131
- 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
9381
+ const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
9382
+ + 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
9132
9383
  let prevAuthToken = null;
9384
+ /**
9385
+ *
9386
+ * @param authtoken
9387
+ */
9133
9388
  function alertForDuplicateToken(authtoken) {
9134
9389
  if (prevAuthToken === authtoken) {
9135
9390
  // eslint-disable-next-line no-alert
@@ -9149,9 +9404,10 @@ function isAtSSORedirectUrl() {
9149
9404
  */
9150
9405
  function removeSSORedirectUrlMarker() {
9151
9406
  // Note (sunny): This will leave a # around even if it was not in the URL
9152
- // to begin with. Trying to remove the hash by changing window.location will reload
9153
- // the page which we don't want. We'll live with adding an unnecessary hash to the
9154
- // parent page URL until we find any use case where that creates an issue.
9407
+ // to begin with. Trying to remove the hash by changing window.location will
9408
+ // reload the page which we don't want. We'll live with adding an
9409
+ // unnecessary hash to the parent page URL until we find any use case where
9410
+ // that creates an issue.
9155
9411
  window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
9156
9412
  }
9157
9413
  const getAuthenticaionToken = async (embedConfig) => {
@@ -9169,6 +9425,7 @@ const getAuthenticaionToken = async (embedConfig) => {
9169
9425
  };
9170
9426
  /**
9171
9427
  * Perform token based authentication
9428
+ *
9172
9429
  * @param embedConfig The embed configuration
9173
9430
  */
9174
9431
  const doTokenAuth = async (embedConfig) => {
@@ -9189,8 +9446,8 @@ const doTokenAuth = async (embedConfig) => {
9189
9446
  // token login issues a 302 when successful
9190
9447
  loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
9191
9448
  if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
9192
- // When 3rd party cookie access is blocked, this will fail because cookies will
9193
- // not be sent with the call.
9449
+ // When 3rd party cookie access is blocked, this will fail because
9450
+ // cookies will not be sent with the call.
9194
9451
  loggedInStatus = await isLoggedIn(thoughtSpotHost);
9195
9452
  }
9196
9453
  }
@@ -9198,6 +9455,7 @@ const doTokenAuth = async (embedConfig) => {
9198
9455
  };
9199
9456
  /**
9200
9457
  * Validate embedConfig parameters required for cookielessTokenAuth
9458
+ *
9201
9459
  * @param embedConfig The embed configuration
9202
9460
  */
9203
9461
  const doCookielessTokenAuth = async (embedConfig) => {
@@ -9213,6 +9471,7 @@ const doCookielessTokenAuth = async (embedConfig) => {
9213
9471
  *
9214
9472
  * Warning: This feature is primarily intended for developer testing. It is
9215
9473
  * strongly advised not to use this authentication method in production.
9474
+ *
9216
9475
  * @param embedConfig The embed configuration
9217
9476
  */
9218
9477
  const doBasicAuth = async (embedConfig) => {
@@ -9230,6 +9489,12 @@ const doBasicAuth = async (embedConfig) => {
9230
9489
  }
9231
9490
  return loggedInStatus;
9232
9491
  };
9492
+ /**
9493
+ *
9494
+ * @param ssoURL
9495
+ * @param triggerContainer
9496
+ * @param triggerText
9497
+ */
9233
9498
  async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
9234
9499
  const openPopup = () => {
9235
9500
  if (samlAuthWindow === null || samlAuthWindow.closed) {
@@ -9242,28 +9507,28 @@ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
9242
9507
  authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
9243
9508
  const containerEl = getDOMNode(triggerContainer);
9244
9509
  if (containerEl) {
9245
- containerEl.innerHTML =
9246
- '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
9510
+ containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
9247
9511
  const authElem = document.getElementById('ts-auth-btn');
9248
9512
  authElem.textContent = triggerText;
9249
9513
  authElem.addEventListener('click', openPopup, { once: true });
9250
9514
  }
9251
- samlCompletionPromise =
9252
- samlCompletionPromise ||
9253
- new Promise((resolve, reject) => {
9254
- window.addEventListener('message', (e) => {
9255
- if (e.data.type === EmbedEvent.SAMLComplete) {
9256
- e.source.close();
9257
- resolve();
9258
- }
9259
- });
9515
+ samlCompletionPromise = samlCompletionPromise
9516
+ || new Promise((resolve, reject) => {
9517
+ window.addEventListener('message', (e) => {
9518
+ if (e.data.type === EmbedEvent.SAMLComplete) {
9519
+ e.source.close();
9520
+ resolve();
9521
+ }
9260
9522
  });
9523
+ });
9261
9524
  authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
9262
9525
  return samlCompletionPromise;
9263
9526
  }
9264
9527
  /**
9265
9528
  * Perform SAML authentication
9529
+ *
9266
9530
  * @param embedConfig The embed configuration
9531
+ * @param ssoEndPoint
9267
9532
  */
9268
9533
  const doSSOAuth = async (embedConfig, ssoEndPoint) => {
9269
9534
  const { thoughtSpotHost } = embedConfig;
@@ -9292,8 +9557,8 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
9292
9557
  };
9293
9558
  const doSamlAuth = async (embedConfig) => {
9294
9559
  const { thoughtSpotHost } = embedConfig;
9295
- // redirect for SSO, when the SSO authentication is done, this page will be loaded
9296
- // again and the same JS will execute again.
9560
+ // redirect for SSO, when the SSO authentication is done, this page will be
9561
+ // loaded again and the same JS will execute again.
9297
9562
  const ssoRedirectUrl = embedConfig.inPopup
9298
9563
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9299
9564
  : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
@@ -9304,8 +9569,8 @@ const doSamlAuth = async (embedConfig) => {
9304
9569
  };
9305
9570
  const doOIDCAuth = async (embedConfig) => {
9306
9571
  const { thoughtSpotHost } = embedConfig;
9307
- // redirect for SSO, when the SSO authentication is done, this page will be loaded
9308
- // again and the same JS will execute again.
9572
+ // redirect for SSO, when the SSO authentication is done, this page will be
9573
+ // loaded again and the same JS will execute again.
9309
9574
  const ssoRedirectUrl = embedConfig.noRedirect || embedConfig.inPopup
9310
9575
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9311
9576
  : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
@@ -9322,6 +9587,7 @@ const logout = async (embedConfig) => {
9322
9587
  };
9323
9588
  /**
9324
9589
  * Perform authentication on the ThoughtSpot cluster
9590
+ *
9325
9591
  * @param embedConfig The embed configuration
9326
9592
  */
9327
9593
  const authenticate = async (embedConfig) => {
@@ -9387,7 +9653,10 @@ const hostUrlToFeatureUrl = {
9387
9653
  [PrefetchFeatures.VizEmbed]: (url) => url,
9388
9654
  };
9389
9655
  /**
9390
- * 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.
9656
+ * Prefetches static resources from the specified URL. Web browsers can then cache the
9657
+ * prefetched resources and serve them from the user's local disk to provide faster access
9658
+ * to your app.
9659
+ *
9391
9660
  * @param url The URL provided for prefetch
9392
9661
  * @param prefetchFeatures Specify features which needs to be prefetched.
9393
9662
  * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
@@ -9414,6 +9683,10 @@ const prefetch = (url, prefetchFeatures) => {
9414
9683
  });
9415
9684
  }
9416
9685
  };
9686
+ /**
9687
+ *
9688
+ * @param embedConfig
9689
+ */
9417
9690
  function sanity(embedConfig) {
9418
9691
  if (embedConfig.thoughtSpotHost === undefined) {
9419
9692
  throw new Error('ThoughtSpot host not provided');
@@ -9422,16 +9695,18 @@ function sanity(embedConfig) {
9422
9695
  if (!embedConfig.username) {
9423
9696
  throw new Error('Username not provided with Trusted auth');
9424
9697
  }
9425
- if (!embedConfig.authEndpoint &&
9426
- typeof embedConfig.getAuthToken !== 'function') {
9698
+ if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
9427
9699
  throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
9428
9700
  }
9429
9701
  }
9430
9702
  }
9703
+ /**
9704
+ *
9705
+ * @param embedConfig
9706
+ */
9431
9707
  function backwardCompat(embedConfig) {
9432
9708
  const newConfig = { ...embedConfig };
9433
- if (embedConfig.noRedirect !== undefined &&
9434
- embedConfig.inPopup === undefined) {
9709
+ if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
9435
9710
  newConfig.inPopup = embedConfig.noRedirect;
9436
9711
  }
9437
9712
  return newConfig;
@@ -9439,9 +9714,9 @@ function backwardCompat(embedConfig) {
9439
9714
  /**
9440
9715
  * Initializes the Visual Embed SDK globally and perform
9441
9716
  * authentication if applicable.
9717
+ *
9442
9718
  * @param embedConfig The configuration object containing ThoughtSpot host,
9443
9719
  * authentication mechanism and so on.
9444
- *
9445
9720
  * @example
9446
9721
  * ```js
9447
9722
  * const authStatus = init({
@@ -9450,8 +9725,8 @@ function backwardCompat(embedConfig) {
9450
9725
  * });
9451
9726
  * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
9452
9727
  * ```
9453
- *
9454
- * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success, failure and logout. See {@link AuthStatus}
9728
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
9729
+ * failure and logout. See {@link AuthStatus}
9455
9730
  * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
9456
9731
  * @group Authentication / Init
9457
9732
  */
@@ -9472,8 +9747,7 @@ const init = (embedConfig) => {
9472
9747
  host: config.thoughtSpotHost,
9473
9748
  usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
9474
9749
  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,
9475
- 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) !=
9476
- null,
9750
+ 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,
9477
9751
  usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
9478
9752
  usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
9479
9753
  });
@@ -9482,15 +9756,18 @@ const init = (embedConfig) => {
9482
9756
  }
9483
9757
  return authEE;
9484
9758
  };
9759
+ /**
9760
+ *
9761
+ */
9485
9762
  function disableAutoLogin() {
9486
9763
  config.autoLogin = false;
9487
9764
  }
9488
9765
  /**
9489
- * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
9490
- * the SDK from automatically logging in again.
9766
+ * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
9767
+ * prevent the SDK from automatically logging in again.
9491
9768
  *
9492
- * You can call the `init` method again to re login, if autoLogin is set to true in this
9493
- * second call it will be honored.
9769
+ * You can call the `init` method again to re login, if autoLogin is set to
9770
+ * true in this second call it will be honored.
9494
9771
  *
9495
9772
  * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
9496
9773
  * @returns Promise which resolves when logout completes.
@@ -9508,7 +9785,9 @@ const logout$1 = (doNotDisableAutoLogin = false) => {
9508
9785
  };
9509
9786
  let renderQueue = Promise.resolve();
9510
9787
  /**
9511
- * Renders functions in a queue, resolves to next function only after the callback next is called
9788
+ * Renders functions in a queue, resolves to next function only after the callback next
9789
+ * is called
9790
+ *
9512
9791
  * @param fn The function being registered
9513
9792
  */
9514
9793
  const renderInQueue = (fn) => {
@@ -9521,6 +9800,13 @@ const renderInQueue = (fn) => {
9521
9800
  return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
9522
9801
  };
9523
9802
 
9803
+ /**
9804
+ *
9805
+ * @param session
9806
+ * @param query
9807
+ * @param operation
9808
+ * @param thoughtSpotHost
9809
+ */
9524
9810
  function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
9525
9811
  let variable;
9526
9812
  const fetchQuery = async (variables) => {
@@ -9570,12 +9856,14 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
9570
9856
  };
9571
9857
  }
9572
9858
 
9859
+ /**
9860
+ *
9861
+ * @param e
9862
+ * @param thoughtSpotHost
9863
+ */
9573
9864
  function processCustomAction(e, thoughtSpotHost) {
9574
9865
  var _a;
9575
- if ([
9576
- OperationType.GetChartWithData,
9577
- OperationType.GetTableWithHeadlineData,
9578
- ].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
9866
+ if ([OperationType.GetChartWithData, OperationType.GetTableWithHeadlineData].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
9579
9867
  const { session, query, operation } = e.data;
9580
9868
  const answerService = getAnswerServiceInstance(session, query, operation, thoughtSpotHost);
9581
9869
  return {
@@ -9585,6 +9873,10 @@ function processCustomAction(e, thoughtSpotHost) {
9585
9873
  }
9586
9874
  return e;
9587
9875
  }
9876
+ /**
9877
+ *
9878
+ * @param e
9879
+ */
9588
9880
  function processAuthInit(e) {
9589
9881
  var _a, _b;
9590
9882
  // Store user session details sent by app.
@@ -9598,8 +9890,13 @@ function processAuthInit(e) {
9598
9890
  },
9599
9891
  };
9600
9892
  }
9893
+ /**
9894
+ *
9895
+ * @param e
9896
+ * @param containerEl
9897
+ */
9601
9898
  function processNoCookieAccess(e, containerEl) {
9602
- const { loginFailedMessage, suppressNoCookieAccessAlert, } = getEmbedConfig();
9899
+ const { loginFailedMessage, suppressNoCookieAccessAlert } = getEmbedConfig();
9603
9900
  if (!suppressNoCookieAccessAlert) {
9604
9901
  // eslint-disable-next-line no-alert
9605
9902
  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.');
@@ -9609,6 +9906,11 @@ function processNoCookieAccess(e, containerEl) {
9609
9906
  notifyAuthFailure(AuthFailureType.NO_COOKIE_ACCESS);
9610
9907
  return e;
9611
9908
  }
9909
+ /**
9910
+ *
9911
+ * @param e
9912
+ * @param containerEl
9913
+ */
9612
9914
  function processAuthFailure(e, containerEl) {
9613
9915
  const { loginFailedMessage, authType } = getEmbedConfig();
9614
9916
  if (authType !== AuthType.None) {
@@ -9618,6 +9920,11 @@ function processAuthFailure(e, containerEl) {
9618
9920
  }
9619
9921
  return e;
9620
9922
  }
9923
+ /**
9924
+ *
9925
+ * @param e
9926
+ * @param containerEl
9927
+ */
9621
9928
  function processAuthLogout(e, containerEl) {
9622
9929
  const { loginFailedMessage } = getEmbedConfig();
9623
9930
  // eslint-disable-next-line no-param-reassign
@@ -9626,6 +9933,13 @@ function processAuthLogout(e, containerEl) {
9626
9933
  notifyLogout();
9627
9934
  return e;
9628
9935
  }
9936
+ /**
9937
+ *
9938
+ * @param type
9939
+ * @param e
9940
+ * @param thoughtSpotHost
9941
+ * @param containerEl
9942
+ */
9629
9943
  function processEventData(type, e, thoughtSpotHost, containerEl) {
9630
9944
  switch (type) {
9631
9945
  case EmbedEvent.CustomAction:
@@ -9644,6 +9958,8 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
9644
9958
 
9645
9959
  /**
9646
9960
  * Reloads the ThoughtSpot iframe.
9961
+ *
9962
+ * @param iFrame
9647
9963
  */
9648
9964
  function reload(iFrame) {
9649
9965
  const oldFrame = iFrame.cloneNode();
@@ -9653,13 +9969,25 @@ function reload(iFrame) {
9653
9969
  }
9654
9970
  /**
9655
9971
  * Post Iframe message.
9972
+ *
9973
+ * @param iFrame
9974
+ * @param message
9975
+ * @param message.type
9976
+ * @param message.data
9977
+ * @param thoughtSpotHost
9978
+ * @param channel
9656
9979
  */
9657
9980
  function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
9658
- return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [
9659
- channel === null || channel === void 0 ? void 0 : channel.port2,
9660
- ]);
9981
+ return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
9661
9982
  }
9662
9983
  const TRIGGER_TIMEOUT = 30000;
9984
+ /**
9985
+ *
9986
+ * @param iFrame
9987
+ * @param messageType
9988
+ * @param thoughtSpotHost
9989
+ * @param data
9990
+ */
9663
9991
  function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
9664
9992
  return new Promise((res, rej) => {
9665
9993
  if (messageType === HostEvent.Reload) {
@@ -9685,7 +10013,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
9685
10013
  });
9686
10014
  }
9687
10015
 
9688
- var name="@thoughtspot/visual-embed-sdk";var version="1.20.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
10016
+ var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-alpha.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
9689
10017
 
9690
10018
  /**
9691
10019
  * Copyright (c) 2022
@@ -9705,6 +10033,7 @@ const TS_EMBED_ID = '_thoughtspot-embed';
9705
10033
  * The event id map from v2 event names to v1 event id
9706
10034
  * v1 events are the classic embed events implemented in Blink v1
9707
10035
  * We cannot rename v1 event types to maintain backward compatibility
10036
+ *
9708
10037
  * @internal
9709
10038
  */
9710
10039
  const V1EventMap = {};
@@ -9715,22 +10044,28 @@ const V1EventMap = {};
9715
10044
  */
9716
10045
  class TsEmbed {
9717
10046
  constructor(domSelector, viewConfig) {
10047
+ this.isAppInitialized = false;
9718
10048
  /**
9719
10049
  * Should we encode URL Query Params using base64 encoding which thoughtspot
9720
10050
  * will generate for embedding. This provides additional security to
9721
10051
  * thoughtspot clusters against Cross site scripting attacks.
10052
+ *
9722
10053
  * @default false
9723
10054
  */
9724
10055
  this.shouldEncodeUrlQueryParams = false;
9725
10056
  this.defaultHiddenActions = [Action.ReportError];
9726
10057
  /**
9727
10058
  * Send Custom style as part of payload of APP_INIT
10059
+ *
10060
+ * @param _
10061
+ * @param responder
9728
10062
  */
9729
10063
  this.appInitCb = async (_, responder) => {
9730
10064
  let authToken = '';
9731
10065
  if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
9732
10066
  authToken = await getAuthenticaionToken(this.embedConfig);
9733
10067
  }
10068
+ this.isAppInitialized = true;
9734
10069
  responder({
9735
10070
  type: EmbedEvent.APP_INIT,
9736
10071
  data: {
@@ -9741,6 +10076,9 @@ class TsEmbed {
9741
10076
  };
9742
10077
  /**
9743
10078
  * Sends updated auth token to the iFrame to avoid user logout
10079
+ *
10080
+ * @param _
10081
+ * @param responder
9744
10082
  */
9745
10083
  this.updateAuthToken = async (_, responder) => {
9746
10084
  const { autoLogin = false, authType } = this.embedConfig; // Set autoLogin default to false
@@ -9782,6 +10120,7 @@ class TsEmbed {
9782
10120
  }
9783
10121
  /**
9784
10122
  * Handles errors within the SDK
10123
+ *
9785
10124
  * @param error The error message or object
9786
10125
  */
9787
10126
  handleError(error) {
@@ -9794,6 +10133,7 @@ class TsEmbed {
9794
10133
  }
9795
10134
  /**
9796
10135
  * Extracts the type field from the event payload
10136
+ *
9797
10137
  * @param event The window message event
9798
10138
  */
9799
10139
  getEventType(event) {
@@ -9803,6 +10143,7 @@ class TsEmbed {
9803
10143
  }
9804
10144
  /**
9805
10145
  * Extracts the port field from the event payload
10146
+ *
9806
10147
  * @param event The window message event
9807
10148
  * @returns
9808
10149
  */
@@ -9815,6 +10156,9 @@ class TsEmbed {
9815
10156
  /**
9816
10157
  * fix for ts7.sep.cl
9817
10158
  * will be removed for ts7.oct.cl
10159
+ *
10160
+ * @param event
10161
+ * @param eventType
9818
10162
  * @hidden
9819
10163
  */
9820
10164
  formatEventData(event, eventType) {
@@ -9845,33 +10189,31 @@ class TsEmbed {
9845
10189
  }
9846
10190
  /**
9847
10191
  * Constructs the base URL string to load the ThoughtSpot app.
10192
+ *
10193
+ * @param query
9848
10194
  */
9849
10195
  getEmbedBasePath(query) {
9850
10196
  let queryString = query;
9851
10197
  if (this.shouldEncodeUrlQueryParams) {
9852
10198
  queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString.substr(1))}`;
9853
10199
  }
9854
- const basePath = [
9855
- this.thoughtSpotHost,
9856
- this.thoughtSpotV2Base,
9857
- queryString,
9858
- ]
10200
+ const basePath = [this.thoughtSpotHost, this.thoughtSpotV2Base, queryString]
9859
10201
  .filter((x) => x.length > 0)
9860
10202
  .join('/');
9861
- return `${basePath}#/embed`;
10203
+ return `${basePath}#`;
9862
10204
  }
9863
10205
  /**
9864
10206
  * Common query params set for all the embed modes.
10207
+ *
10208
+ * @param queryParams
9865
10209
  * @returns queryParams
9866
10210
  */
9867
- getBaseQueryParams() {
9868
- var _a, _b;
9869
- const queryParams = {};
10211
+ getBaseQueryParams(queryParams = {}) {
10212
+ var _a, _b, _c;
9870
10213
  let hostAppUrl = ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '';
9871
- // The below check is needed because TS Cloud firewall, blocks localhost/127.0.0.1
9872
- // in any url param.
9873
- if (hostAppUrl.includes('localhost') ||
9874
- hostAppUrl.includes('127.0.0.1')) {
10214
+ // The below check is needed because TS Cloud firewall, blocks
10215
+ // localhost/127.0.0.1 in any url param.
10216
+ if (hostAppUrl.includes('localhost') || hostAppUrl.includes('127.0.0.1')) {
9875
10217
  hostAppUrl = 'local-host';
9876
10218
  }
9877
10219
  queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
@@ -9879,8 +10221,7 @@ class TsEmbed {
9879
10221
  queryParams[Param.ViewPortWidth] = window.innerWidth;
9880
10222
  queryParams[Param.Version] = version$1;
9881
10223
  queryParams[Param.AuthType] = this.embedConfig.authType;
9882
- if (this.embedConfig.disableLoginRedirect === true ||
9883
- this.embedConfig.autoLogin === true) {
10224
+ if (this.embedConfig.disableLoginRedirect === true || this.embedConfig.autoLogin === true) {
9884
10225
  queryParams[Param.DisableLoginRedirect] = true;
9885
10226
  }
9886
10227
  if (this.embedConfig.authType === AuthType.EmbeddedSSO) {
@@ -9895,8 +10236,7 @@ class TsEmbed {
9895
10236
  return queryParams;
9896
10237
  }
9897
10238
  // TODO remove embedConfig.customCssUrl
9898
- const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) ||
9899
- this.embedConfig.customCssUrl;
10239
+ const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) || this.embedConfig.customCssUrl;
9900
10240
  if (cssUrlParam) {
9901
10241
  queryParams[Param.CustomCSSUrl] = cssUrlParam;
9902
10242
  }
@@ -9906,15 +10246,14 @@ class TsEmbed {
9906
10246
  if (disabledActionReason) {
9907
10247
  queryParams[Param.DisableActionReason] = disabledActionReason;
9908
10248
  }
9909
- queryParams[Param.HideActions] = [
9910
- ...this.defaultHiddenActions,
9911
- ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
9912
- ];
10249
+ queryParams[Param.HideActions] = [...this.defaultHiddenActions, ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : [])];
9913
10250
  if (Array.isArray(visibleActions)) {
9914
10251
  queryParams[Param.VisibleActions] = visibleActions;
9915
10252
  }
9916
- /** Default behavior for context menu will be left-click
9917
- * from version 9.2.0.cl the user have an option to override context menu click
10253
+ /**
10254
+ * Default behavior for context menu will be left-click
10255
+ * from version 9.2.0.cl the user have an option to override context
10256
+ * menu click
9918
10257
  */
9919
10258
  if (contextMenuTrigger === ContextMenuTriggerOptions.LEFT_CLICK) {
9920
10259
  queryParams[Param.ContextMenuTrigger] = true;
@@ -9922,7 +10261,8 @@ class TsEmbed {
9922
10261
  else if (contextMenuTrigger === ContextMenuTriggerOptions.RIGHT_CLICK) {
9923
10262
  queryParams[Param.ContextMenuTrigger] = false;
9924
10263
  }
9925
- const spriteUrl = customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl;
10264
+ const spriteUrl = (customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl)
10265
+ || ((_c = this.embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.iconSpriteUrl);
9926
10266
  if (spriteUrl) {
9927
10267
  queryParams[Param.IconSpriteUrl] = spriteUrl.replace('https://', '');
9928
10268
  }
@@ -9946,32 +10286,61 @@ class TsEmbed {
9946
10286
  /**
9947
10287
  * Constructs the base URL string to load v1 of the ThoughtSpot app.
9948
10288
  * This is used for embedding Liveboards, visualizations, and full application.
10289
+ *
9949
10290
  * @param queryString The query string to append to the URL.
9950
10291
  * @param isAppEmbed A Boolean parameter to specify if you are embedding
9951
10292
  * the full application.
9952
10293
  */
9953
- getV1EmbedBasePath(queryString, showPrimaryNavbar = false, disableProfileAndHelp = false, isAppEmbed = false, enableSearchAssist = false) {
9954
- const queryStringFrag = queryString ? `&${queryString}` : '';
9955
- const primaryNavParam = `&primaryNavHidden=${!showPrimaryNavbar}`;
9956
- const disableProfileAndHelpParam = `&profileAndHelpInNavBarHidden=${disableProfileAndHelp}`;
9957
- const enableSearchAssistParam = `&${Param.EnableSearchAssist}=${enableSearchAssist}`;
9958
- let queryParams = `?embedApp=true${isAppEmbed ? primaryNavParam : ''}${isAppEmbed ? disableProfileAndHelpParam : ''}${enableSearchAssist ? enableSearchAssistParam : ''}${queryStringFrag}`;
9959
- if (this.shouldEncodeUrlQueryParams) {
9960
- queryParams = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryParams.substr(1))}`;
9961
- }
9962
- let path = `${this.thoughtSpotHost}/${queryParams}#`;
9963
- if (!isAppEmbed) {
9964
- path = `${path}/embed`;
9965
- }
10294
+ getV1EmbedBasePath(queryString) {
10295
+ const queryParams = this.shouldEncodeUrlQueryParams
10296
+ ? `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString)}`
10297
+ : `?${queryString}`;
10298
+ const path = `${this.thoughtSpotHost}/${queryParams}#`;
9966
10299
  return path;
9967
10300
  }
10301
+ getEmbedParams() {
10302
+ const queryParams = this.getBaseQueryParams();
10303
+ return getQueryParamString(queryParams);
10304
+ }
10305
+ getRootIframeSrc() {
10306
+ const query = this.getEmbedParams();
10307
+ return this.getEmbedBasePath(query);
10308
+ }
10309
+ createIframeEl(frameSrc) {
10310
+ const iFrame = document.createElement('iframe');
10311
+ iFrame.src = frameSrc;
10312
+ iFrame.id = TS_EMBED_ID;
10313
+ // according to screenfull.js documentation
10314
+ // allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be
10315
+ // true
10316
+ iFrame.allowFullscreen = true;
10317
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10318
+ // @ts-ignore
10319
+ iFrame.webkitallowfullscreen = true;
10320
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10321
+ // @ts-ignore
10322
+ iFrame.mozallowfullscreen = true;
10323
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10324
+ // @ts-ignore
10325
+ iFrame.allow = 'clipboard-read; clipboard-write';
10326
+ const { height: frameHeight, width: frameWidth, ...restParams } = this.viewConfig.frameParams || {};
10327
+ const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
10328
+ const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
10329
+ setAttributes(iFrame, restParams);
10330
+ iFrame.style.width = `${width}`;
10331
+ iFrame.style.height = `${height}`;
10332
+ iFrame.style.border = '0';
10333
+ iFrame.name = 'ThoughtSpot Embedded Analytics';
10334
+ return iFrame;
10335
+ }
9968
10336
  /**
9969
10337
  * Renders the embedded ThoughtSpot app in an iframe and sets up
9970
10338
  * event listeners.
10339
+ *
9971
10340
  * @param url
9972
10341
  * @param frameOptions
9973
10342
  */
9974
- async renderIFrame(url, frameOptions = {}) {
10343
+ async renderIFrame(url) {
9975
10344
  if (this.isError) {
9976
10345
  return null;
9977
10346
  }
@@ -9995,30 +10364,7 @@ class TsEmbed {
9995
10364
  return;
9996
10365
  }
9997
10366
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
9998
- this.iFrame =
9999
- this.iFrame || document.createElement('iframe');
10000
- this.iFrame.src = url;
10001
- this.iFrame.id = TS_EMBED_ID;
10002
- // according to screenfull.js documentation
10003
- // allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be true
10004
- this.iFrame.allowFullscreen = true;
10005
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10006
- // @ts-ignore
10007
- this.iFrame.webkitallowfullscreen = true;
10008
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10009
- // @ts-ignore
10010
- this.iFrame.mozallowfullscreen = true;
10011
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10012
- // @ts-ignore
10013
- this.iFrame.allow = 'clipboard-read; clipboard-write';
10014
- const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
10015
- const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
10016
- const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
10017
- setAttributes(this.iFrame, restParams);
10018
- this.iFrame.style.width = `${width}`;
10019
- this.iFrame.style.height = `${height}`;
10020
- this.iFrame.style.border = '0';
10021
- this.iFrame.name = 'ThoughtSpot Embedded Analytics';
10367
+ this.iFrame = this.iFrame || this.createIframeEl(url);
10022
10368
  this.iFrame.addEventListener('load', () => {
10023
10369
  nextInQueue();
10024
10370
  const loadTimestamp = Date.now();
@@ -10045,7 +10391,9 @@ class TsEmbed {
10045
10391
  this.subscribeToEvents();
10046
10392
  }).catch((error) => {
10047
10393
  nextInQueue();
10048
- uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, { error: JSON.stringify(error) });
10394
+ uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
10395
+ error: JSON.stringify(error),
10396
+ });
10049
10397
  this.insertIntoDOM(this.embedConfig.loginFailedMessage);
10050
10398
  this.handleError(error);
10051
10399
  });
@@ -10079,6 +10427,7 @@ class TsEmbed {
10079
10427
  }
10080
10428
  /**
10081
10429
  * Sets the height of the iframe
10430
+ *
10082
10431
  * @param height The height in pixels
10083
10432
  */
10084
10433
  setIFrameHeight(height) {
@@ -10086,21 +10435,24 @@ class TsEmbed {
10086
10435
  }
10087
10436
  /**
10088
10437
  * Executes all registered event handlers for a particular event type
10438
+ *
10089
10439
  * @param eventType The event type
10090
10440
  * @param data The payload invoked with the event handler
10091
10441
  * @param eventPort The event Port for a specific MessageChannel
10092
10442
  */
10093
10443
  executeCallbacks(eventType, data, eventPort) {
10094
- const callbacks = this.eventHandlerMap.get(eventType) || [];
10444
+ const eventHandlers = this.eventHandlerMap.get(eventType) || [];
10095
10445
  const allHandlers = this.eventHandlerMap.get(EmbedEvent.ALL) || [];
10096
- callbacks.push(...allHandlers);
10446
+ const callbacks = [...eventHandlers, ...allHandlers];
10097
10447
  const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
10098
10448
  callbacks.forEach((callbackObj) => {
10099
- if ((callbackObj.options.start &&
10100
- dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
10101
- (!callbackObj.options.start &&
10102
- dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
10103
- ) {
10449
+ if (
10450
+ // When start status is true it trigger only start releated
10451
+ // payload
10452
+ (callbackObj.options.start && dataStatus === embedEventStatus.START)
10453
+ // When start status is false it trigger only end releated
10454
+ // payload
10455
+ || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
10104
10456
  callbackObj.callback(data, (payload) => {
10105
10457
  this.triggerEventOnPort(eventPort, payload);
10106
10458
  });
@@ -10115,6 +10467,7 @@ class TsEmbed {
10115
10467
  }
10116
10468
  /**
10117
10469
  * Gets the v1 event type (if applicable) for the EmbedEvent type
10470
+ *
10118
10471
  * @param eventType The v2 event type
10119
10472
  * @returns The corresponding v1 event type if one exists
10120
10473
  * or else the v2 event type itself
@@ -10126,6 +10479,7 @@ class TsEmbed {
10126
10479
  * Calculates the iframe center for the current visible viewPort
10127
10480
  * of iframe using Scroll position of Host App, offsetTop for iframe
10128
10481
  * in Host app. ViewPort height of the tab.
10482
+ *
10129
10483
  * @returns iframe Center in visible viewport,
10130
10484
  * Iframe height,
10131
10485
  * View port height.
@@ -10139,8 +10493,7 @@ class TsEmbed {
10139
10493
  let iframeVisibleViewPort;
10140
10494
  let iframeOffset;
10141
10495
  if (iframeScrolled < 0) {
10142
- iframeVisibleViewPort =
10143
- viewPortHeight - (offsetTopClient - scrollTopClient);
10496
+ iframeVisibleViewPort = viewPortHeight - (offsetTopClient - scrollTopClient);
10144
10497
  iframeVisibleViewPort = Math.min(iframeHeight, iframeVisibleViewPort);
10145
10498
  iframeOffset = 0;
10146
10499
  }
@@ -10188,11 +10541,34 @@ class TsEmbed {
10188
10541
  this.eventHandlerMap.set(messageType, callbacks);
10189
10542
  return this;
10190
10543
  }
10544
+ /**
10545
+ * Removes an event listener for a particular event type.
10546
+ *
10547
+ * @param messageType The message type
10548
+ * @param callback The callback to remove
10549
+ * @example
10550
+ * ```js
10551
+ * const errorHandler = (data) => { console.error(data); };
10552
+ * tsEmbed.on(EmbedEvent.Error, errorHandler);
10553
+ * tsEmbed.off(EmbedEvent.Error, errorHandler);
10554
+ * ```
10555
+ */
10556
+ off(messageType, callback) {
10557
+ const callbacks = this.eventHandlerMap.get(messageType) || [];
10558
+ const index = callbacks.findIndex((cb) => cb.callback === callback);
10559
+ if (index > -1) {
10560
+ callbacks.splice(index, 1);
10561
+ }
10562
+ return this;
10563
+ }
10191
10564
  /**
10192
10565
  * Triggers an event on specific Port registered against
10193
10566
  * for the EmbedEvent
10567
+ *
10194
10568
  * @param eventType The message type
10195
10569
  * @param data The payload to send
10570
+ * @param eventPort
10571
+ * @param payload
10196
10572
  */
10197
10573
  triggerEventOnPort(eventPort, payload) {
10198
10574
  if (eventPort) {
@@ -10213,6 +10589,7 @@ class TsEmbed {
10213
10589
  }
10214
10590
  /**
10215
10591
  * Triggers an event to the embedded app
10592
+ *
10216
10593
  * @param messageType The event type
10217
10594
  * @param data The payload to send with the message
10218
10595
  */
@@ -10224,6 +10601,7 @@ class TsEmbed {
10224
10601
  * Marks the ThoughtSpot object to have been rendered
10225
10602
  * Needs to be overridden by subclasses to do the actual
10226
10603
  * rendering of the iframe.
10604
+ *
10227
10605
  * @param args
10228
10606
  */
10229
10607
  render() {
@@ -10234,6 +10612,7 @@ class TsEmbed {
10234
10612
  * Get the Post Url Params for THOUGHTSPOT from the current
10235
10613
  * host app URL.
10236
10614
  * THOUGHTSPOT URL params starts with a prefix "ts-"
10615
+ *
10237
10616
  * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
10238
10617
  */
10239
10618
  getThoughtSpotPostUrlParams() {
@@ -10257,6 +10636,7 @@ class TsEmbed {
10257
10636
  }
10258
10637
  /**
10259
10638
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
10639
+ *
10260
10640
  * @version SDK: 1.19.1 | ThoughtSpot: *
10261
10641
  */
10262
10642
  destroy() {
@@ -10267,6 +10647,21 @@ class TsEmbed {
10267
10647
  console.log('Error destroying TS Embed', e);
10268
10648
  }
10269
10649
  }
10650
+ getUnderlyingFrameElement() {
10651
+ return this.iFrame;
10652
+ }
10653
+ /**
10654
+ * Prerenders a generic instance of the TS component.
10655
+ * This means without the path but with the flags already applied.
10656
+ * This is useful for prerendering the component in the background.
10657
+ *
10658
+ * @version SDK: 1.21.0 | ThoughtSpot: * / Search: 9.3.0.cl
10659
+ * @returns
10660
+ */
10661
+ async prerenderGeneric() {
10662
+ const prerenderFrameSrc = this.getRootIframeSrc();
10663
+ return this.renderIFrame(prerenderFrameSrc);
10664
+ }
10270
10665
  }
10271
10666
  /**
10272
10667
  * Base class for embedding v1 experience
@@ -10282,14 +10677,21 @@ class V1Embed extends TsEmbed {
10282
10677
  }
10283
10678
  /**
10284
10679
  * Render the ap p in an iframe and set up event handlers
10680
+ *
10285
10681
  * @param iframeSrc
10286
10682
  */
10287
10683
  renderV1Embed(iframeSrc) {
10288
- return this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
10684
+ return this.renderIFrame(iframeSrc);
10685
+ }
10686
+ getRootIframeSrc() {
10687
+ const runtimeFilters = this.viewConfig.runtimeFilters;
10688
+ const filterQuery = getFilterQuery(runtimeFilters || []);
10689
+ const queryParams = this.getEmbedParams();
10690
+ const queryString = [filterQuery, queryParams].filter(Boolean).join('&');
10691
+ return this.getV1EmbedBasePath(queryString);
10289
10692
  }
10290
10693
  /**
10291
- * @inheritdoc TsEmbed.on
10292
- *
10694
+ * @inheritdoc
10293
10695
  * @example
10294
10696
  * ```js
10295
10697
  * tsEmbed.on(EmbedEvent.Error, (data) => {
@@ -10359,6 +10761,7 @@ var Page;
10359
10761
  })(Page || (Page = {}));
10360
10762
  /**
10361
10763
  * Embeds full ThoughtSpot experience in a host application.
10764
+ *
10362
10765
  * @group Embed components
10363
10766
  */
10364
10767
  class AppEmbed extends V1Embed {
@@ -10371,8 +10774,12 @@ class AppEmbed extends V1Embed {
10371
10774
  * embedded Liveboard or visualization.
10372
10775
  */
10373
10776
  getEmbedParams() {
10374
- const params = this.getBaseQueryParams();
10375
- const { tag, hideObjects, liveboardV2 } = this.viewConfig;
10777
+ const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, enableSearchAssist, } = this.viewConfig;
10778
+ let params = {};
10779
+ params[Param.EmbedApp] = true;
10780
+ params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
10781
+ params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
10782
+ params = this.getBaseQueryParams(params);
10376
10783
  if (tag) {
10377
10784
  params[Param.Tag] = tag;
10378
10785
  }
@@ -10382,26 +10789,28 @@ class AppEmbed extends V1Embed {
10382
10789
  if (liveboardV2 !== undefined) {
10383
10790
  params[Param.LiveboardV2Enabled] = liveboardV2;
10384
10791
  }
10792
+ if (enableSearchAssist !== undefined) {
10793
+ params[Param.EnableSearchAssist] = enableSearchAssist;
10794
+ }
10385
10795
  const queryParams = getQueryParamString(params, true);
10386
10796
  return queryParams;
10387
10797
  }
10388
10798
  /**
10389
10799
  * Constructs the URL of the ThoughtSpot app page to be rendered.
10800
+ *
10390
10801
  * @param pageId The ID of the page to be embedded.
10391
10802
  */
10392
- getIFrameSrc(pageId, runtimeFilters) {
10393
- const filterQuery = getFilterQuery(runtimeFilters || []);
10394
- const queryParams = this.getEmbedParams();
10395
- const queryString = [filterQuery, queryParams]
10396
- .filter(Boolean)
10397
- .join('&');
10398
- let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true, this.viewConfig.enableSearchAssist)}/${pageId}`;
10803
+ getIFrameSrc() {
10804
+ const { pageId, path } = this.viewConfig;
10805
+ const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
10806
+ let url = `${this.getRootIframeSrc()}/${pageRoute}`;
10399
10807
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10400
10808
  url = `${url}${tsPostHashParams}`;
10401
10809
  return url;
10402
10810
  }
10403
10811
  /**
10404
10812
  * Gets the ThoughtSpot route of the page for a particular page ID.
10813
+ *
10405
10814
  * @param pageId The identifier for a page in the ThoughtSpot app.
10406
10815
  */
10407
10816
  getPageRoute(pageId) {
@@ -10425,6 +10834,7 @@ class AppEmbed extends V1Embed {
10425
10834
  }
10426
10835
  /**
10427
10836
  * Formats the path provided by the user.
10837
+ *
10428
10838
  * @param path The URL path.
10429
10839
  * @returns The URL path that the embedded app understands.
10430
10840
  */
@@ -10440,10 +10850,13 @@ class AppEmbed extends V1Embed {
10440
10850
  }
10441
10851
  /**
10442
10852
  * Navigate to particular page for app embed. eg:answers/pinboards/home
10443
- * This is used for embedding answers, pinboards, visualizations and full application only.
10853
+ * This is used for embedding answers, pinboards, visualizations and full application
10854
+ * only.
10855
+ *
10444
10856
  * @param path string | number The string, set to iframe src and navigate to new page
10445
10857
  * eg: appEmbed.navigateToPage('pinboards')
10446
- * When used with `noReload` this can also be a number like 1/-1 to go forward/back.
10858
+ * When used with `noReload` (default: true) this can also be a number
10859
+ * like 1/-1 to go forward/back.
10447
10860
  * @param noReload boolean Trigger the navigation without reloading the page
10448
10861
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
10449
10862
  */
@@ -10468,14 +10881,13 @@ class AppEmbed extends V1Embed {
10468
10881
  }
10469
10882
  /**
10470
10883
  * Renders the embedded application pages in the ThoughtSpot app.
10884
+ *
10471
10885
  * @param renderOptions An object containing the page ID
10472
10886
  * to be embedded.
10473
10887
  */
10474
10888
  render() {
10475
10889
  super.render();
10476
- const { pageId, runtimeFilters, path } = this.viewConfig;
10477
- const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
10478
- const src = this.getIFrameSrc(pageRoute, runtimeFilters);
10890
+ const src = this.getIFrameSrc();
10479
10891
  this.renderV1Embed(src);
10480
10892
  return this;
10481
10893
  }
@@ -10493,6 +10905,7 @@ class AppEmbed extends V1Embed {
10493
10905
  */
10494
10906
  /**
10495
10907
  * Embed a ThoughtSpot Liveboard or visualization
10908
+ *
10496
10909
  * @group Embed components
10497
10910
  */
10498
10911
  class LiveboardEmbed extends V1Embed {
@@ -10503,6 +10916,7 @@ class LiveboardEmbed extends V1Embed {
10503
10916
  /**
10504
10917
  * Set the iframe height as per the computed height received
10505
10918
  * from the ThoughtSpot app.
10919
+ *
10506
10920
  * @param data The event payload
10507
10921
  */
10508
10922
  this.updateIFrameHeight = (data) => {
@@ -10517,16 +10931,23 @@ class LiveboardEmbed extends V1Embed {
10517
10931
  this.setIFrameHeight(this.defaultHeight);
10518
10932
  }
10519
10933
  };
10934
+ if (this.viewConfig.fullHeight === true) {
10935
+ this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
10936
+ this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
10937
+ this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
10938
+ }
10520
10939
  }
10521
10940
  /**
10522
10941
  * Construct a map of params to be passed on to the
10523
10942
  * embedded Liveboard or visualization.
10524
10943
  */
10525
10944
  getEmbedParams() {
10526
- const params = this.getBaseQueryParams();
10945
+ let params = {};
10946
+ params[Param.EmbedApp] = true;
10947
+ params = this.getBaseQueryParams(params);
10527
10948
  const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, activeTabId, } = this.viewConfig;
10528
- const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
10529
- this.viewConfig.preventPinboardFilterRemoval;
10949
+ const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
10950
+ || this.viewConfig.preventPinboardFilterRemoval;
10530
10951
  if (fullHeight === true) {
10531
10952
  params[Param.fullHeight] = true;
10532
10953
  }
@@ -10552,65 +10973,68 @@ class LiveboardEmbed extends V1Embed {
10552
10973
  const queryParams = getQueryParamString(params, true);
10553
10974
  return queryParams;
10554
10975
  }
10555
- /**
10556
- * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
10557
- * to be loaded within the iframe.
10558
- * @param liveboardId The GUID of the Liveboard.
10559
- * @param vizId The optional GUID of a visualization within the Liveboard.
10560
- * @param runtimeFilters A list of runtime filters to be applied to
10561
- * the Liveboard or visualization on load.
10562
- */
10563
- getIFrameSrc(liveboardId, vizId, runtimeFilters, activeTabId) {
10564
- const filterQuery = getFilterQuery(runtimeFilters || []);
10565
- const queryParams = this.getEmbedParams();
10566
- const queryString = [filterQuery, queryParams]
10567
- .filter(Boolean)
10568
- .join('&');
10569
- let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${liveboardId}`;
10976
+ getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
10977
+ let suffix = `/embed/viz/${liveboardId}`;
10570
10978
  if (activeTabId) {
10571
- url = `${url}/tab/${activeTabId}`;
10979
+ suffix = `${suffix}/tab/${activeTabId} `;
10572
10980
  }
10573
10981
  if (vizId) {
10574
- url = `${url}/${vizId}`;
10982
+ suffix = `${suffix}/${vizId}`;
10575
10983
  }
10576
10984
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10577
- url = `${url}${tsPostHashParams}`;
10578
- return url;
10985
+ suffix = `${suffix}${tsPostHashParams}`;
10986
+ return suffix;
10987
+ }
10988
+ /**
10989
+ * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
10990
+ * to be loaded within the iframe.
10991
+ */
10992
+ getIFrameSrc() {
10993
+ var _a;
10994
+ const { vizId, activeTabId } = this.viewConfig;
10995
+ const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
10996
+ if (!liveboardId) {
10997
+ this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
10998
+ }
10999
+ return `${this.getRootIframeSrc()}${this.getIframeSuffixSrc(liveboardId, vizId, activeTabId)}`;
10579
11000
  }
10580
11001
  /**
10581
11002
  * Triggers an event to the embedded app
11003
+ *
10582
11004
  * @param messageType The event type
10583
11005
  * @param data The payload to send with the message
10584
11006
  */
10585
11007
  trigger(messageType, data = {}) {
10586
11008
  const dataWithVizId = data;
10587
- if (this.viewConfig.vizId) {
11009
+ if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
10588
11010
  dataWithVizId.vizId = this.viewConfig.vizId;
10589
11011
  }
10590
11012
  return super.trigger(messageType, dataWithVizId);
10591
11013
  }
10592
11014
  /**
10593
11015
  * Render an embedded ThoughtSpot Liveboard or visualization
11016
+ *
10594
11017
  * @param renderOptions An object specifying the Liveboard ID,
10595
11018
  * visualization ID and the runtime filters.
10596
11019
  */
10597
11020
  render() {
10598
- var _a;
10599
- const { vizId, activeTabId, runtimeFilters } = this.viewConfig;
10600
- const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
10601
- if (!liveboardId) {
10602
- this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
10603
- }
10604
- if (this.viewConfig.fullHeight === true) {
10605
- this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
10606
- this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
10607
- this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
10608
- }
10609
11021
  super.render();
10610
- const src = this.getIFrameSrc(liveboardId, vizId, runtimeFilters, activeTabId);
11022
+ const src = this.getIFrameSrc();
10611
11023
  this.renderV1Embed(src);
10612
11024
  return this;
10613
11025
  }
11026
+ navigateToLiveboard(liveboardId, vizId, activeTabId) {
11027
+ const path = this.getIframeSuffixSrc(liveboardId, vizId, activeTabId);
11028
+ this.viewConfig.liveboardId = liveboardId;
11029
+ this.viewConfig.activeTabId = activeTabId;
11030
+ this.viewConfig.vizId = vizId;
11031
+ if (this.isAppInitialized) {
11032
+ this.trigger(HostEvent.Navigate, path.substring(1));
11033
+ }
11034
+ else {
11035
+ this.render();
11036
+ }
11037
+ }
10614
11038
  }
10615
11039
  /**
10616
11040
  * @hidden
@@ -10657,16 +11081,9 @@ class SearchEmbed extends TsEmbed {
10657
11081
  }
10658
11082
  return dataSourceMode;
10659
11083
  }
10660
- /**
10661
- * Construct the URL of the embedded ThoughtSpot search to be
10662
- * loaded in the iframe
10663
- * @param answerId The GUID of a saved answer
10664
- * @param dataSources A list of data source GUIDs
10665
- */
10666
- getIFrameSrc(answerId, dataSources) {
11084
+ getEmbedParams() {
10667
11085
  var _a;
10668
- const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, } = this.viewConfig;
10669
- const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
11086
+ const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, } = this.viewConfig;
10670
11087
  const queryParams = this.getBaseQueryParams();
10671
11088
  queryParams[Param.HideActions] = [
10672
11089
  ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
@@ -10705,17 +11122,28 @@ class SearchEmbed extends TsEmbed {
10705
11122
  if (filterQuery) {
10706
11123
  query += `&${filterQuery}`;
10707
11124
  }
11125
+ return query;
11126
+ }
11127
+ /**
11128
+ * Construct the URL of the embedded ThoughtSpot search to be
11129
+ * loaded in the iframe
11130
+ *
11131
+ * @param answerId The GUID of a saved answer
11132
+ * @param dataSources A list of data source GUIDs
11133
+ */
11134
+ getIFrameSrc(answerId) {
11135
+ const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
10708
11136
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10709
- return `${this.getEmbedBasePath(query)}/${answerPath}${tsPostHashParams}`;
11137
+ return `${this.getRootIframeSrc()}/embed/${answerPath}${tsPostHashParams}`;
10710
11138
  }
10711
11139
  /**
10712
11140
  * Render the embedded ThoughtSpot search
10713
11141
  */
10714
11142
  render() {
10715
11143
  super.render();
10716
- const { answerId, dataSources } = this.viewConfig;
10717
- const src = this.getIFrameSrc(answerId, dataSources);
10718
- this.renderIFrame(src, this.viewConfig.frameParams);
11144
+ const { answerId } = this.viewConfig;
11145
+ const src = this.getIFrameSrc(answerId);
11146
+ this.renderIFrame(src);
10719
11147
  getAuthPromise().then(() => {
10720
11148
  if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
10721
11149
  alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
@@ -10739,6 +11167,7 @@ class SearchBarEmbed extends TsEmbed {
10739
11167
  /**
10740
11168
  * Construct the URL of the embedded ThoughtSpot search to be
10741
11169
  * loaded in the iframe
11170
+ *
10742
11171
  * @param dataSources A list of data source GUIDs
10743
11172
  */
10744
11173
  getIFrameSrc() {
@@ -10746,9 +11175,7 @@ class SearchBarEmbed extends TsEmbed {
10746
11175
  const { searchOptions, dataSource, dataSources } = this.viewConfig;
10747
11176
  const path = 'search-bar-embed';
10748
11177
  const queryParams = this.getBaseQueryParams();
10749
- queryParams[Param.HideActions] = [
10750
- ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
10751
- ];
11178
+ queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
10752
11179
  if (dataSources && dataSources.length) {
10753
11180
  queryParams[Param.DataSources] = JSON.stringify(dataSources);
10754
11181
  }
@@ -10769,7 +11196,7 @@ class SearchBarEmbed extends TsEmbed {
10769
11196
  query = `?${queryParamsString}`;
10770
11197
  }
10771
11198
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
10772
- return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
11199
+ return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
10773
11200
  }
10774
11201
  /**
10775
11202
  * Render the embedded ThoughtSpot search
@@ -10777,7 +11204,7 @@ class SearchBarEmbed extends TsEmbed {
10777
11204
  render() {
10778
11205
  super.render();
10779
11206
  const src = this.getIFrameSrc();
10780
- this.renderIFrame(src, this.viewConfig.frameParams);
11207
+ this.renderIFrame(src);
10781
11208
  return this;
10782
11209
  }
10783
11210
  }