@thoughtspot/visual-embed-sdk 1.28.0-preRender → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +3 -4
  3. package/cjs/src/auth.d.ts +16 -1
  4. package/cjs/src/auth.d.ts.map +1 -1
  5. package/cjs/src/auth.js +7 -3
  6. package/cjs/src/auth.js.map +1 -1
  7. package/cjs/src/auth.spec.d.ts.map +1 -1
  8. package/cjs/src/auth.spec.js +9 -0
  9. package/cjs/src/auth.spec.js.map +1 -1
  10. package/cjs/src/embed/app.d.ts +150 -7
  11. package/cjs/src/embed/app.d.ts.map +1 -1
  12. package/cjs/src/embed/app.js +5 -5
  13. package/cjs/src/embed/app.js.map +1 -1
  14. package/cjs/src/embed/app.spec.js +19 -1
  15. package/cjs/src/embed/app.spec.js.map +1 -1
  16. package/cjs/src/embed/base.d.ts +1 -1
  17. package/cjs/src/embed/base.d.ts.map +1 -1
  18. package/cjs/src/embed/base.js +5 -8
  19. package/cjs/src/embed/base.js.map +1 -1
  20. package/cjs/src/embed/base.spec.js +1 -1
  21. package/cjs/src/embed/base.spec.js.map +1 -1
  22. package/cjs/src/embed/embed.spec.js +0 -15
  23. package/cjs/src/embed/embed.spec.js.map +1 -1
  24. package/cjs/src/embed/liveboard.d.ts +113 -4
  25. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  26. package/cjs/src/embed/liveboard.js +2 -2
  27. package/cjs/src/embed/liveboard.js.map +1 -1
  28. package/cjs/src/embed/liveboard.spec.js +20 -1
  29. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  30. package/cjs/src/embed/pinboard.spec.js +20 -1
  31. package/cjs/src/embed/pinboard.spec.js.map +1 -1
  32. package/cjs/src/embed/sage.d.ts +1 -1
  33. package/cjs/src/embed/sage.d.ts.map +1 -1
  34. package/cjs/src/embed/sage.js +2 -2
  35. package/cjs/src/embed/sage.js.map +1 -1
  36. package/cjs/src/embed/search-bar.d.ts +37 -6
  37. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  38. package/cjs/src/embed/search-bar.js +2 -2
  39. package/cjs/src/embed/search-bar.js.map +1 -1
  40. package/cjs/src/embed/search.d.ts +85 -2
  41. package/cjs/src/embed/search.d.ts.map +1 -1
  42. package/cjs/src/embed/search.js +6 -6
  43. package/cjs/src/embed/search.js.map +1 -1
  44. package/cjs/src/embed/search.spec.js +25 -1
  45. package/cjs/src/embed/search.spec.js.map +1 -1
  46. package/cjs/src/embed/ts-embed-trigger.spec.d.ts +2 -0
  47. package/cjs/src/embed/ts-embed-trigger.spec.d.ts.map +1 -0
  48. package/cjs/src/embed/ts-embed-trigger.spec.js +34 -0
  49. package/cjs/src/embed/ts-embed-trigger.spec.js.map +1 -0
  50. package/cjs/src/embed/ts-embed.d.ts +2 -2
  51. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  52. package/cjs/src/embed/ts-embed.js +18 -13
  53. package/cjs/src/embed/ts-embed.js.map +1 -1
  54. package/cjs/src/embed/ts-embed.spec.js +64 -25
  55. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  56. package/cjs/src/index.d.ts +2 -1
  57. package/cjs/src/index.d.ts.map +1 -1
  58. package/cjs/src/index.js +3 -1
  59. package/cjs/src/index.js.map +1 -1
  60. package/cjs/src/react/index.spec.js +13 -1
  61. package/cjs/src/react/index.spec.js.map +1 -1
  62. package/cjs/src/test/test-utils.d.ts +1 -0
  63. package/cjs/src/test/test-utils.d.ts.map +1 -1
  64. package/cjs/src/test/test-utils.js +10 -1
  65. package/cjs/src/test/test-utils.js.map +1 -1
  66. package/cjs/src/tokenizedFetch.d.ts +9 -0
  67. package/cjs/src/tokenizedFetch.d.ts.map +1 -1
  68. package/cjs/src/tokenizedFetch.js +9 -0
  69. package/cjs/src/tokenizedFetch.js.map +1 -1
  70. package/cjs/src/types.d.ts +279 -43
  71. package/cjs/src/types.d.ts.map +1 -1
  72. package/cjs/src/types.js +95 -20
  73. package/cjs/src/types.js.map +1 -1
  74. package/cjs/src/utils/authService/authService.d.ts.map +1 -1
  75. package/cjs/src/utils/authService/authService.js +9 -3
  76. package/cjs/src/utils/authService/authService.js.map +1 -1
  77. package/cjs/src/utils/authService/authService.spec.js +22 -0
  78. package/cjs/src/utils/authService/authService.spec.js.map +1 -1
  79. package/dist/src/auth.d.ts +16 -1
  80. package/dist/src/auth.d.ts.map +1 -1
  81. package/dist/src/auth.spec.d.ts.map +1 -1
  82. package/dist/src/embed/app.d.ts +150 -7
  83. package/dist/src/embed/app.d.ts.map +1 -1
  84. package/dist/src/embed/base.d.ts +1 -1
  85. package/dist/src/embed/base.d.ts.map +1 -1
  86. package/dist/src/embed/liveboard.d.ts +113 -4
  87. package/dist/src/embed/liveboard.d.ts.map +1 -1
  88. package/dist/src/embed/sage.d.ts +1 -1
  89. package/dist/src/embed/sage.d.ts.map +1 -1
  90. package/dist/src/embed/search-bar.d.ts +37 -6
  91. package/dist/src/embed/search-bar.d.ts.map +1 -1
  92. package/dist/src/embed/search.d.ts +85 -2
  93. package/dist/src/embed/search.d.ts.map +1 -1
  94. package/dist/src/embed/ts-embed-trigger.spec.d.ts +2 -0
  95. package/dist/src/embed/ts-embed-trigger.spec.d.ts.map +1 -0
  96. package/dist/src/embed/ts-embed.d.ts +2 -2
  97. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  98. package/dist/src/index.d.ts +2 -1
  99. package/dist/src/index.d.ts.map +1 -1
  100. package/dist/src/test/test-utils.d.ts +1 -0
  101. package/dist/src/test/test-utils.d.ts.map +1 -1
  102. package/dist/src/tokenizedFetch.d.ts +9 -0
  103. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  104. package/dist/src/types.d.ts +279 -43
  105. package/dist/src/types.d.ts.map +1 -1
  106. package/dist/src/utils/authService/authService.d.ts.map +1 -1
  107. package/dist/tsembed-react.es.js +1543 -1445
  108. package/dist/tsembed-react.js +6614 -6529
  109. package/dist/tsembed.es.js +1921 -1826
  110. package/dist/tsembed.js +15342 -15259
  111. package/dist/visual-embed-sdk-react-full.d.ts +692 -64
  112. package/dist/visual-embed-sdk-react.d.ts +692 -64
  113. package/dist/visual-embed-sdk.d.ts +692 -64
  114. package/lib/package.json +3 -4
  115. package/lib/src/auth.d.ts +16 -1
  116. package/lib/src/auth.d.ts.map +1 -1
  117. package/lib/src/auth.js +8 -4
  118. package/lib/src/auth.js.map +1 -1
  119. package/lib/src/auth.spec.d.ts.map +1 -1
  120. package/lib/src/auth.spec.js +9 -0
  121. package/lib/src/auth.spec.js.map +1 -1
  122. package/lib/src/embed/app.d.ts +150 -7
  123. package/lib/src/embed/app.d.ts.map +1 -1
  124. package/lib/src/embed/app.js +5 -5
  125. package/lib/src/embed/app.js.map +1 -1
  126. package/lib/src/embed/app.spec.js +19 -1
  127. package/lib/src/embed/app.spec.js.map +1 -1
  128. package/lib/src/embed/base.d.ts +1 -1
  129. package/lib/src/embed/base.d.ts.map +1 -1
  130. package/lib/src/embed/base.js +5 -8
  131. package/lib/src/embed/base.js.map +1 -1
  132. package/lib/src/embed/base.spec.js +2 -2
  133. package/lib/src/embed/base.spec.js.map +1 -1
  134. package/lib/src/embed/embed.spec.js +2 -17
  135. package/lib/src/embed/embed.spec.js.map +1 -1
  136. package/lib/src/embed/liveboard.d.ts +113 -4
  137. package/lib/src/embed/liveboard.d.ts.map +1 -1
  138. package/lib/src/embed/liveboard.js +3 -3
  139. package/lib/src/embed/liveboard.js.map +1 -1
  140. package/lib/src/embed/liveboard.spec.js +20 -1
  141. package/lib/src/embed/liveboard.spec.js.map +1 -1
  142. package/lib/src/embed/pinboard.spec.js +20 -1
  143. package/lib/src/embed/pinboard.spec.js.map +1 -1
  144. package/lib/src/embed/sage.d.ts +1 -1
  145. package/lib/src/embed/sage.d.ts.map +1 -1
  146. package/lib/src/embed/sage.js +2 -2
  147. package/lib/src/embed/sage.js.map +1 -1
  148. package/lib/src/embed/search-bar.d.ts +37 -6
  149. package/lib/src/embed/search-bar.d.ts.map +1 -1
  150. package/lib/src/embed/search-bar.js +2 -2
  151. package/lib/src/embed/search-bar.js.map +1 -1
  152. package/lib/src/embed/search.d.ts +85 -2
  153. package/lib/src/embed/search.d.ts.map +1 -1
  154. package/lib/src/embed/search.js +7 -7
  155. package/lib/src/embed/search.js.map +1 -1
  156. package/lib/src/embed/search.spec.js +25 -1
  157. package/lib/src/embed/search.spec.js.map +1 -1
  158. package/lib/src/embed/ts-embed-trigger.spec.d.ts +2 -0
  159. package/lib/src/embed/ts-embed-trigger.spec.d.ts.map +1 -0
  160. package/lib/src/embed/ts-embed-trigger.spec.js +32 -0
  161. package/lib/src/embed/ts-embed-trigger.spec.js.map +1 -0
  162. package/lib/src/embed/ts-embed.d.ts +2 -2
  163. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  164. package/lib/src/embed/ts-embed.js +21 -16
  165. package/lib/src/embed/ts-embed.js.map +1 -1
  166. package/lib/src/embed/ts-embed.spec.js +57 -18
  167. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  168. package/lib/src/index.d.ts +2 -1
  169. package/lib/src/index.d.ts.map +1 -1
  170. package/lib/src/index.js +2 -1
  171. package/lib/src/index.js.map +1 -1
  172. package/lib/src/react/index.spec.js +13 -1
  173. package/lib/src/react/index.spec.js.map +1 -1
  174. package/lib/src/test/test-utils.d.ts +1 -0
  175. package/lib/src/test/test-utils.d.ts.map +1 -1
  176. package/lib/src/test/test-utils.js +8 -0
  177. package/lib/src/test/test-utils.js.map +1 -1
  178. package/lib/src/tokenizedFetch.d.ts +9 -0
  179. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  180. package/lib/src/tokenizedFetch.js +9 -0
  181. package/lib/src/tokenizedFetch.js.map +1 -1
  182. package/lib/src/types.d.ts +279 -43
  183. package/lib/src/types.d.ts.map +1 -1
  184. package/lib/src/types.js +95 -20
  185. package/lib/src/types.js.map +1 -1
  186. package/lib/src/utils/authService/authService.d.ts.map +1 -1
  187. package/lib/src/utils/authService/authService.js +9 -3
  188. package/lib/src/utils/authService/authService.js.map +1 -1
  189. package/lib/src/utils/authService/authService.spec.js +23 -1
  190. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  191. package/lib/src/visual-embed-sdk.d.ts +699 -68
  192. package/package.json +3 -4
  193. package/src/auth.spec.ts +10 -0
  194. package/src/auth.ts +27 -8
  195. package/src/embed/app.spec.ts +24 -1
  196. package/src/embed/app.ts +154 -13
  197. package/src/embed/base.spec.ts +3 -3
  198. package/src/embed/base.ts +13 -17
  199. package/src/embed/embed.spec.ts +0 -18
  200. package/src/embed/liveboard.spec.ts +24 -1
  201. package/src/embed/liveboard.ts +121 -15
  202. package/src/embed/pinboard.spec.ts +24 -1
  203. package/src/embed/sage.ts +2 -2
  204. package/src/embed/search-bar.tsx +38 -7
  205. package/src/embed/search.spec.ts +29 -1
  206. package/src/embed/search.ts +93 -9
  207. package/src/embed/ts-embed-trigger.spec.ts +39 -0
  208. package/src/embed/ts-embed.spec.ts +71 -30
  209. package/src/embed/ts-embed.ts +48 -45
  210. package/src/index.ts +2 -0
  211. package/src/react/index.spec.tsx +30 -0
  212. package/src/test/test-utils.ts +9 -0
  213. package/src/tokenizedFetch.ts +9 -0
  214. package/src/types.ts +288 -50
  215. package/src/utils/authService/authService.spec.ts +31 -4
  216. package/src/utils/authService/authService.ts +14 -13
@@ -1,44 +1,3 @@
1
- /**
2
- * Checks if `value` is `undefined`.
3
- *
4
- * @static
5
- * @since 0.1.0
6
- * @memberOf _
7
- * @category Lang
8
- * @param {*} value The value to check.
9
- * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
10
- * @example
11
- *
12
- * _.isUndefined(void 0);
13
- * // => true
14
- *
15
- * _.isUndefined(null);
16
- * // => false
17
- */
18
- function isUndefined(value) {
19
- return value === undefined;
20
- }
21
-
22
- var isUndefined_1 = isUndefined;
23
-
24
- /**
25
- * This method returns `undefined`.
26
- *
27
- * @static
28
- * @memberOf _
29
- * @since 2.3.0
30
- * @category Util
31
- * @example
32
- *
33
- * _.times(2, _.noop);
34
- * // => [undefined, undefined]
35
- */
36
- function noop() {
37
- // No operation performed.
38
- }
39
-
40
- var noop_1 = noop;
41
-
42
1
  /**
43
2
  * Copyright (c) 2023
44
3
  *
@@ -184,6 +143,7 @@ var AuthType;
184
143
  * .then((data) => data.token);
185
144
  * }
186
145
  * });
146
+ * });
187
147
  * ```
188
148
  */
189
149
  AuthType["TrustedAuthToken"] = "AuthServer";
@@ -216,17 +176,40 @@ var AuthType;
216
176
  */
217
177
  AuthType["Basic"] = "Basic";
218
178
  })(AuthType || (AuthType = {}));
179
+ /**
180
+ *
181
+ * This option does not apply to the classic homepage experience.
182
+ * To access the updated modular homepage,
183
+ * set `modularHomeExperience` to `true`
184
+ * (available as Early Access feature in 9.12.5.cl).
185
+ *
186
+ */
219
187
  var HomeLeftNavItem;
220
188
  (function (HomeLeftNavItem) {
221
- HomeLeftNavItem["QueryBuilder"] = "query-builder";
189
+ /**
190
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
191
+ */
192
+ HomeLeftNavItem["SearchData"] = "search-data";
193
+ /**
194
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
195
+ */
222
196
  HomeLeftNavItem["Home"] = "insights-home";
197
+ /**
198
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
199
+ */
223
200
  HomeLeftNavItem["Liveboards"] = "liveboards";
201
+ /**
202
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
203
+ */
224
204
  HomeLeftNavItem["Answers"] = "answers";
205
+ /**
206
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
207
+ */
225
208
  HomeLeftNavItem["MonitorSubscription"] = "monitor-alerts";
209
+ /**
210
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
211
+ */
226
212
  HomeLeftNavItem["SpotIQAnalysis"] = "spotiq-analysis";
227
- HomeLeftNavItem["Tutorials"] = "tutorials";
228
- HomeLeftNavItem["Documentation"] = "documentation";
229
- HomeLeftNavItem["Community"] = "community";
230
213
  })(HomeLeftNavItem || (HomeLeftNavItem = {}));
231
214
  /**
232
215
  * A map of the supported runtime filter operations
@@ -292,7 +275,12 @@ var RuntimeFilterOp;
292
275
  RuntimeFilterOp["IN"] = "IN";
293
276
  })(RuntimeFilterOp || (RuntimeFilterOp = {}));
294
277
  /**
295
- * Home page module that can be hidden
278
+ * Home page module that can be hidden.
279
+ * **Note**: This option does not apply to the classic homepage.
280
+ * To access the updated modular homepage, set
281
+ * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
282
+ *
283
+ * @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
296
284
  */
297
285
  // eslint-disable-next-line no-shadow
298
286
  var HomepageModule;
@@ -421,7 +409,7 @@ var EmbedEvent;
421
409
  * @returns nonFilteredColumns - The columns that were not filtered
422
410
  * @example
423
411
  *```js
424
- * searchEmbed.trigger(HostEvent.DrillDown, {
412
+ * searchEmbed.trigger(EmbedEvent.DrillDown, {
425
413
  * points: {
426
414
  * clickedPoint,
427
415
  * selectedPoints: selectedPoint
@@ -513,7 +501,7 @@ var EmbedEvent;
513
501
  * @important
514
502
  * @example
515
503
  * ```js
516
- * embed.on(ThoughtSpotEmbed.Event.VizPointClick, ({data}) => {
504
+ * embed.on(EmbedEvent.VizPointClick, ({data}) => {
517
505
  * console.log(
518
506
  * data.vizId, // viz id
519
507
  * data.clickedPoint.selectedAttributes[0].value,
@@ -528,19 +516,21 @@ var EmbedEvent;
528
516
  /**
529
517
  * An error has occurred. This event is fired for the following error types:
530
518
  *
531
- * `API` - API call failure error.
519
+ * API - API call failure error.
532
520
  *
533
- * `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
521
+ * FULLSCREEN - Error when presenting a Liveboard or visualization in full screen
522
+ * mode.
534
523
  *
535
- * `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
524
+ * SINGLE_VALUE_FILTER - Error due to multiple values in the single value filter.
536
525
  *
537
- * `NON_EXIST_FILTER` - Error due to a non-existent filter.
526
+ * NON_EXIST_FILTER - Error due to a non-existent filter.
538
527
  *
539
- * `INVALID_DATE_VALUE` - Invalid date value error.
528
+ * INVALID_DATE_VALUE - Invalid date value error.
540
529
  *
541
- * `INVALID_OPERATOR` - Use of invalid operator during filter application.
530
+ * INVALID_OPERATOR - Use of invalid operator during filter application.
542
531
  *
543
532
  * For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
533
+ *
544
534
  * @returns error - An error object or message
545
535
  * @example
546
536
  * ```js
@@ -1105,7 +1095,7 @@ var EmbedEvent;
1105
1095
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1106
1096
  * @example
1107
1097
  *```js
1108
- * liveboardEmbed.trigger(HostEvent.Delete,
1098
+ * liveboardEmbed.trigger(EmbedEvent.Delete,
1109
1099
  * {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1110
1100
  *```
1111
1101
  */
@@ -1116,7 +1106,7 @@ var EmbedEvent;
1116
1106
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1117
1107
  * @example
1118
1108
  *```js
1119
- * liveboardEmbed.trigger(HostEvent.SchedulesList)
1109
+ * liveboardEmbed.trigger(EmbedEvent.SchedulesList)
1120
1110
  *```
1121
1111
  */
1122
1112
  EmbedEvent["SchedulesList"] = "schedule-list";
@@ -1126,7 +1116,7 @@ var EmbedEvent;
1126
1116
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1127
1117
  * @example
1128
1118
  *```js
1129
- * liveboardEmbed.trigger(HostEvent.Cancel)
1119
+ * liveboardEmbed.trigger(EmbedEvent.Cancel)
1130
1120
  *```
1131
1121
  */
1132
1122
  EmbedEvent["Cancel"] = "cancel";
@@ -1136,7 +1126,7 @@ var EmbedEvent;
1136
1126
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1137
1127
  * @example
1138
1128
  *```js
1139
- * liveboardEmbed.trigger(HostEvent.Explore, {
1129
+ * liveboardEmbed.trigger(EmbedEvent.Explore, {
1140
1130
  * vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1141
1131
  *```
1142
1132
  */
@@ -1147,7 +1137,7 @@ var EmbedEvent;
1147
1137
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1148
1138
  * @example
1149
1139
  *```js
1150
- * liveboardEmbed.trigger(HostEvent.CopyLink, {
1140
+ * liveboardEmbed.trigger(EmbedEvent.CopyLink, {
1151
1141
  * vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1152
1142
  *```
1153
1143
  */
@@ -1418,10 +1408,13 @@ var HostEvent;
1418
1408
  * _String_. The name of the column to filter on.
1419
1409
  * `operator`
1420
1410
  * Runtime filter operator to apply. For information,
1421
- * see [Runtime filter operators](https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator).
1411
+ * see https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator.
1422
1412
  * `values`
1423
1413
  * List of operands. Some operators such as EQ, LE allow a single value, whereas
1424
1414
  * operators such as BW and IN accept multiple operands.
1415
+ * **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
1416
+ * Search embedding (SearchEmbed) and Natural Language Search
1417
+ * embedding (SageEmbed).
1425
1418
  *
1426
1419
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
1427
1420
  * @example
@@ -1946,6 +1939,7 @@ var HostEvent;
1946
1939
  /**
1947
1940
  *
1948
1941
  * Get the currents visible and runtime filters applied on a Liveboard
1942
+ *
1949
1943
  * @example
1950
1944
  * liveboardEmbed.trigger(HostEvent.GetFilters)
1951
1945
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
@@ -1954,12 +1948,13 @@ var HostEvent;
1954
1948
  /**
1955
1949
  *
1956
1950
  * Update the visible filters on the Liveboard.
1951
+ *
1957
1952
  * @param - filter: filter object containing column name and filter operation and values
1958
1953
  * @example
1959
1954
  *
1960
1955
  * ```js
1961
1956
  * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
1962
- * filter: { column: 'column name', oper: 'in', values: [1,2,3], is_mandatory: false }
1957
+ * filter: { column: 'column name', oper: 'IN', values: [1,2,3], is_mandatory: false }
1963
1958
  * })
1964
1959
  * ```
1965
1960
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
@@ -2046,6 +2041,32 @@ var HostEvent;
2046
2041
  * @version SDK: 1.29.0 | Thoughtspot: 9.12.0.cl
2047
2042
  */
2048
2043
  HostEvent["AskSage"] = "AskSage";
2044
+ /**
2045
+ * Trigger UpdateCrossFilter for Liveboard
2046
+ *
2047
+ * @example
2048
+ * ```js
2049
+ * liveboardEmbed.trigger(HostEvent.UpdateCrossFilter, {
2050
+ * vizId: 'b535c760-8bbe-4e6f-bb26-af56b4129a1e',
2051
+ * conditions: [
2052
+ * { columnName: 'Category', values: ['mfgr#12','mfgr#14'] },
2053
+ * { columnName: 'color', values: ['mint','hot'] },
2054
+ * ],
2055
+ * });
2056
+ * ```
2057
+ * @version SDK: 1.29.0 | Thoughtspot: 10.0.0.cl
2058
+ */
2059
+ HostEvent["UpdateCrossFilter"] = "UpdateCrossFilter";
2060
+ /**
2061
+ * Trigger ResetLiveboardPersonalisedView for Liveboard
2062
+ *
2063
+ * @example
2064
+ * ```js
2065
+ * liveboardEmbed.trigger(HostEvent.ResetLiveboardPersonalisedView);
2066
+ * ```
2067
+ * @version SDK: 1.29.0 | Thoughtspot: 10.1.0.cl
2068
+ */
2069
+ HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
2049
2070
  })(HostEvent || (HostEvent = {}));
2050
2071
  /**
2051
2072
  * The different visual modes that the data sources panel within
@@ -3020,6 +3041,7 @@ var Action;
3020
3041
  Action["AskAi"] = "AskAi";
3021
3042
  /**
3022
3043
  * The **Add KPI to Watchlist** action on Home page watchlist.
3044
+ *
3023
3045
  * @example
3024
3046
  * ```js
3025
3047
  * disabledActions: [Action.AddToWatchlist]
@@ -3029,6 +3051,7 @@ var Action;
3029
3051
  Action["AddToWatchlist"] = "addToWatchlist";
3030
3052
  /**
3031
3053
  * The **Remove from watchlist** menu action on KPI watchlist.
3054
+ *
3032
3055
  * @example
3033
3056
  * ```js
3034
3057
  * disabledActions: [Action.RemoveFromWatchlist]
@@ -3038,6 +3061,7 @@ var Action;
3038
3061
  Action["RemoveFromWatchlist"] = "removeFromWatchlist";
3039
3062
  /**
3040
3063
  * The **Copy KPI Link** menu action on KPI watchlist.
3064
+ *
3041
3065
  * @example
3042
3066
  * ```js
3043
3067
  * disabledActions: [Action.CopyKpiLink]
@@ -3045,6 +3069,16 @@ var Action;
3045
3069
  * @version SDK : 1.27.9 | Thoughtspot: 9.12.5.cl
3046
3070
  */
3047
3071
  Action["CopyKpiLink"] = "copyKpiLink";
3072
+ /**
3073
+ * Action ID for AI Highlights button
3074
+ *
3075
+ * @example
3076
+ * ```js
3077
+ * hiddenAction: [Action.AIHighlights]
3078
+ * ```
3079
+ * @version SDK: 1.27.10 | Thoughtspot: 9.12.5.cl
3080
+ */
3081
+ Action["AIHighlights"] = "AIHighlights";
3048
3082
  })(Action || (Action = {}));
3049
3083
  var PrefetchFeatures;
3050
3084
  (function (PrefetchFeatures) {
@@ -3143,76 +3177,6 @@ var LogLevel;
3143
3177
  LogLevel["TRACE"] = "TRACE";
3144
3178
  })(LogLevel || (LogLevel = {}));
3145
3179
 
3146
- const logFunctions = {
3147
- [LogLevel.SILENT]: noop_1,
3148
- [LogLevel.ERROR]: console.error,
3149
- [LogLevel.WARN]: console.warn,
3150
- [LogLevel.INFO]: console.info,
3151
- [LogLevel.DEBUG]: console.debug,
3152
- [LogLevel.TRACE]: console.trace,
3153
- };
3154
- let globalLogLevelOverride = LogLevel.TRACE;
3155
- const setGlobalLogLevelOverride = (logLevel) => {
3156
- globalLogLevelOverride = logLevel;
3157
- };
3158
- const logLevelToNumber = {
3159
- [LogLevel.SILENT]: 0,
3160
- [LogLevel.ERROR]: 1,
3161
- [LogLevel.WARN]: 2,
3162
- [LogLevel.INFO]: 3,
3163
- [LogLevel.DEBUG]: 4,
3164
- [LogLevel.TRACE]: 5,
3165
- };
3166
- const compareLogLevels = (logLevel1, logLevel2) => {
3167
- const logLevel1Index = logLevelToNumber[logLevel1];
3168
- const logLevel2Index = logLevelToNumber[logLevel2];
3169
- return logLevel1Index - logLevel2Index;
3170
- };
3171
- class Logger {
3172
- constructor() {
3173
- this.logLevel = LogLevel.ERROR;
3174
- this.setLogLevel = (newLogLevel) => {
3175
- this.logLevel = newLogLevel;
3176
- };
3177
- this.getLogLevel = () => this.logLevel;
3178
- }
3179
- canLog(logLevel) {
3180
- if (logLevel === LogLevel.SILENT)
3181
- return false;
3182
- if (!isUndefined_1(globalLogLevelOverride)) {
3183
- return compareLogLevels(globalLogLevelOverride, logLevel) >= 0;
3184
- }
3185
- return compareLogLevels(this.logLevel, logLevel) >= 0;
3186
- }
3187
- logMessages(args, logLevel) {
3188
- if (this.canLog(logLevel)) {
3189
- const logFn = logFunctions[logLevel];
3190
- if (logFn) {
3191
- logFn(...args);
3192
- }
3193
- }
3194
- }
3195
- log(...args) {
3196
- this.info(args);
3197
- }
3198
- info(...args) {
3199
- this.logMessages(args, LogLevel.INFO);
3200
- }
3201
- debug(...args) {
3202
- this.logMessages(args, LogLevel.DEBUG);
3203
- }
3204
- trace(...args) {
3205
- this.logMessages(args, LogLevel.TRACE);
3206
- }
3207
- error(...args) {
3208
- this.logMessages(args, LogLevel.ERROR);
3209
- }
3210
- warn(...args) {
3211
- this.logMessages(args, LogLevel.WARN);
3212
- }
3213
- }
3214
- const logger = new Logger();
3215
-
3216
3180
  // istanbul ignore next
3217
3181
  const isObject = (obj) => {
3218
3182
  if (typeof obj === "object" && obj !== null) {
@@ -3518,115 +3482,226 @@ const removeStyleProperties = (element, styleProperties) => {
3518
3482
  element.style.removeProperty(styleProperty);
3519
3483
  });
3520
3484
  };
3521
- const isUndefined$1 = (value) => value === undefined;
3522
-
3523
- /**
3524
- * Removes all key-value entries from the list cache.
3525
- *
3526
- * @private
3527
- * @name clear
3528
- * @memberOf ListCache
3529
- */
3530
- function listCacheClear() {
3531
- this.__data__ = [];
3532
- this.size = 0;
3533
- }
3534
-
3535
- var _listCacheClear = listCacheClear;
3485
+ const isUndefined = (value) => value === undefined;
3536
3486
 
3537
3487
  /**
3538
- * Performs a
3539
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3540
- * comparison between two values to determine if they are equivalent.
3488
+ * Checks if `value` is `undefined`.
3541
3489
  *
3542
3490
  * @static
3491
+ * @since 0.1.0
3543
3492
  * @memberOf _
3544
- * @since 4.0.0
3545
3493
  * @category Lang
3546
- * @param {*} value The value to compare.
3547
- * @param {*} other The other value to compare.
3548
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3494
+ * @param {*} value The value to check.
3495
+ * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
3549
3496
  * @example
3550
3497
  *
3551
- * var object = { 'a': 1 };
3552
- * var other = { 'a': 1 };
3553
- *
3554
- * _.eq(object, object);
3555
- * // => true
3556
- *
3557
- * _.eq(object, other);
3558
- * // => false
3559
- *
3560
- * _.eq('a', 'a');
3498
+ * _.isUndefined(void 0);
3561
3499
  * // => true
3562
3500
  *
3563
- * _.eq('a', Object('a'));
3501
+ * _.isUndefined(null);
3564
3502
  * // => false
3565
- *
3566
- * _.eq(NaN, NaN);
3567
- * // => true
3568
3503
  */
3569
- function eq(value, other) {
3570
- return value === other || (value !== value && other !== other);
3504
+ function isUndefined$1(value) {
3505
+ return value === undefined;
3571
3506
  }
3572
3507
 
3573
- var eq_1 = eq;
3508
+ var isUndefined_1 = isUndefined$1;
3574
3509
 
3575
3510
  /**
3576
- * Gets the index at which the `key` is found in `array` of key-value pairs.
3511
+ * This method returns `undefined`.
3577
3512
  *
3578
- * @private
3579
- * @param {Array} array The array to inspect.
3580
- * @param {*} key The key to search for.
3581
- * @returns {number} Returns the index of the matched value, else `-1`.
3582
- */
3583
- function assocIndexOf(array, key) {
3584
- var length = array.length;
3585
- while (length--) {
3586
- if (eq_1(array[length][0], key)) {
3587
- return length;
3588
- }
3589
- }
3590
- return -1;
3591
- }
3592
-
3593
- var _assocIndexOf = assocIndexOf;
3594
-
3595
- /** Used for built-in method references. */
3596
- var arrayProto = Array.prototype;
3597
-
3598
- /** Built-in value references. */
3599
- var splice = arrayProto.splice;
3600
-
3601
- /**
3602
- * Removes `key` and its value from the list cache.
3513
+ * @static
3514
+ * @memberOf _
3515
+ * @since 2.3.0
3516
+ * @category Util
3517
+ * @example
3603
3518
  *
3604
- * @private
3605
- * @name delete
3606
- * @memberOf ListCache
3607
- * @param {string} key The key of the value to remove.
3608
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3519
+ * _.times(2, _.noop);
3520
+ * // => [undefined, undefined]
3609
3521
  */
3610
- function listCacheDelete(key) {
3611
- var data = this.__data__,
3612
- index = _assocIndexOf(data, key);
3613
-
3614
- if (index < 0) {
3615
- return false;
3616
- }
3617
- var lastIndex = data.length - 1;
3618
- if (index == lastIndex) {
3619
- data.pop();
3620
- } else {
3621
- splice.call(data, index, 1);
3622
- }
3623
- --this.size;
3624
- return true;
3522
+ function noop() {
3523
+ // No operation performed.
3625
3524
  }
3626
3525
 
3627
- var _listCacheDelete = listCacheDelete;
3526
+ var noop_1 = noop;
3628
3527
 
3629
- /**
3528
+ const logFunctions = {
3529
+ [LogLevel.SILENT]: noop_1,
3530
+ [LogLevel.ERROR]: console.error,
3531
+ [LogLevel.WARN]: console.warn,
3532
+ [LogLevel.INFO]: console.info,
3533
+ [LogLevel.DEBUG]: console.debug,
3534
+ [LogLevel.TRACE]: console.trace,
3535
+ };
3536
+ let globalLogLevelOverride = LogLevel.TRACE;
3537
+ const setGlobalLogLevelOverride = (logLevel) => {
3538
+ globalLogLevelOverride = logLevel;
3539
+ };
3540
+ const logLevelToNumber = {
3541
+ [LogLevel.SILENT]: 0,
3542
+ [LogLevel.ERROR]: 1,
3543
+ [LogLevel.WARN]: 2,
3544
+ [LogLevel.INFO]: 3,
3545
+ [LogLevel.DEBUG]: 4,
3546
+ [LogLevel.TRACE]: 5,
3547
+ };
3548
+ const compareLogLevels = (logLevel1, logLevel2) => {
3549
+ const logLevel1Index = logLevelToNumber[logLevel1];
3550
+ const logLevel2Index = logLevelToNumber[logLevel2];
3551
+ return logLevel1Index - logLevel2Index;
3552
+ };
3553
+ class Logger {
3554
+ constructor() {
3555
+ this.logLevel = LogLevel.ERROR;
3556
+ this.setLogLevel = (newLogLevel) => {
3557
+ this.logLevel = newLogLevel;
3558
+ };
3559
+ this.getLogLevel = () => this.logLevel;
3560
+ }
3561
+ canLog(logLevel) {
3562
+ if (logLevel === LogLevel.SILENT)
3563
+ return false;
3564
+ if (!isUndefined_1(globalLogLevelOverride)) {
3565
+ return compareLogLevels(globalLogLevelOverride, logLevel) >= 0;
3566
+ }
3567
+ return compareLogLevels(this.logLevel, logLevel) >= 0;
3568
+ }
3569
+ logMessages(args, logLevel) {
3570
+ if (this.canLog(logLevel)) {
3571
+ const logFn = logFunctions[logLevel];
3572
+ if (logFn) {
3573
+ logFn(...args);
3574
+ }
3575
+ }
3576
+ }
3577
+ log(...args) {
3578
+ this.info(args);
3579
+ }
3580
+ info(...args) {
3581
+ this.logMessages(args, LogLevel.INFO);
3582
+ }
3583
+ debug(...args) {
3584
+ this.logMessages(args, LogLevel.DEBUG);
3585
+ }
3586
+ trace(...args) {
3587
+ this.logMessages(args, LogLevel.TRACE);
3588
+ }
3589
+ error(...args) {
3590
+ this.logMessages(args, LogLevel.ERROR);
3591
+ }
3592
+ warn(...args) {
3593
+ this.logMessages(args, LogLevel.WARN);
3594
+ }
3595
+ }
3596
+ const logger = new Logger();
3597
+
3598
+ /**
3599
+ * Removes all key-value entries from the list cache.
3600
+ *
3601
+ * @private
3602
+ * @name clear
3603
+ * @memberOf ListCache
3604
+ */
3605
+ function listCacheClear() {
3606
+ this.__data__ = [];
3607
+ this.size = 0;
3608
+ }
3609
+
3610
+ var _listCacheClear = listCacheClear;
3611
+
3612
+ /**
3613
+ * Performs a
3614
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3615
+ * comparison between two values to determine if they are equivalent.
3616
+ *
3617
+ * @static
3618
+ * @memberOf _
3619
+ * @since 4.0.0
3620
+ * @category Lang
3621
+ * @param {*} value The value to compare.
3622
+ * @param {*} other The other value to compare.
3623
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3624
+ * @example
3625
+ *
3626
+ * var object = { 'a': 1 };
3627
+ * var other = { 'a': 1 };
3628
+ *
3629
+ * _.eq(object, object);
3630
+ * // => true
3631
+ *
3632
+ * _.eq(object, other);
3633
+ * // => false
3634
+ *
3635
+ * _.eq('a', 'a');
3636
+ * // => true
3637
+ *
3638
+ * _.eq('a', Object('a'));
3639
+ * // => false
3640
+ *
3641
+ * _.eq(NaN, NaN);
3642
+ * // => true
3643
+ */
3644
+ function eq(value, other) {
3645
+ return value === other || (value !== value && other !== other);
3646
+ }
3647
+
3648
+ var eq_1 = eq;
3649
+
3650
+ /**
3651
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
3652
+ *
3653
+ * @private
3654
+ * @param {Array} array The array to inspect.
3655
+ * @param {*} key The key to search for.
3656
+ * @returns {number} Returns the index of the matched value, else `-1`.
3657
+ */
3658
+ function assocIndexOf(array, key) {
3659
+ var length = array.length;
3660
+ while (length--) {
3661
+ if (eq_1(array[length][0], key)) {
3662
+ return length;
3663
+ }
3664
+ }
3665
+ return -1;
3666
+ }
3667
+
3668
+ var _assocIndexOf = assocIndexOf;
3669
+
3670
+ /** Used for built-in method references. */
3671
+ var arrayProto = Array.prototype;
3672
+
3673
+ /** Built-in value references. */
3674
+ var splice = arrayProto.splice;
3675
+
3676
+ /**
3677
+ * Removes `key` and its value from the list cache.
3678
+ *
3679
+ * @private
3680
+ * @name delete
3681
+ * @memberOf ListCache
3682
+ * @param {string} key The key of the value to remove.
3683
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3684
+ */
3685
+ function listCacheDelete(key) {
3686
+ var data = this.__data__,
3687
+ index = _assocIndexOf(data, key);
3688
+
3689
+ if (index < 0) {
3690
+ return false;
3691
+ }
3692
+ var lastIndex = data.length - 1;
3693
+ if (index == lastIndex) {
3694
+ data.pop();
3695
+ } else {
3696
+ splice.call(data, index, 1);
3697
+ }
3698
+ --this.size;
3699
+ return true;
3700
+ }
3701
+
3702
+ var _listCacheDelete = listCacheDelete;
3703
+
3704
+ /**
3630
3705
  * Gets the list cache value for `key`.
3631
3706
  *
3632
3707
  * @private
@@ -5725,6 +5800,8 @@ function isEqual(value, other) {
5725
5800
 
5726
5801
  var isEqual_1 = isEqual;
5727
5802
 
5803
+ var name="@thoughtspot/visual-embed-sdk";var version="1.28.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"45 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
5804
+
5728
5805
  const EndPoints = {
5729
5806
  AUTH_VERIFICATION: '/callosum/v1/session/info',
5730
5807
  SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
@@ -5769,7 +5846,7 @@ async function verifyTokenService(thoughtSpotHost, authToken) {
5769
5846
  return res.ok;
5770
5847
  }
5771
5848
  catch (e) {
5772
- logger.error(`Token Verification Service failed : ${e.message}`);
5849
+ logger.warn(`Token Verification Service failed : ${e.message}`);
5773
5850
  }
5774
5851
  return false;
5775
5852
  }
@@ -5787,7 +5864,10 @@ async function fetchAuthTokenService(authEndpoint) {
5787
5864
  * @param authToken
5788
5865
  */
5789
5866
  async function fetchAuthService(thoughtSpotHost, username, authToken) {
5790
- return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
5867
+ const fetchUrlParams = username
5868
+ ? `username=${username}&auth_token=${authToken}`
5869
+ : `auth_token=${authToken}`;
5870
+ return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?${fetchUrlParams}`, {
5791
5871
  credentials: 'include',
5792
5872
  // We do not want to follow the redirect, as it starts giving a CORS
5793
5873
  // error
@@ -5801,13 +5881,16 @@ async function fetchAuthService(thoughtSpotHost, username, authToken) {
5801
5881
  * @param authToken
5802
5882
  */
5803
5883
  async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
5884
+ const bodyPrams = username
5885
+ ? `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`
5886
+ : `auth_token=${encodeURIComponent(authToken)}`;
5804
5887
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
5805
5888
  method: 'POST',
5806
5889
  headers: {
5807
5890
  'content-type': 'application/x-www-form-urlencoded',
5808
5891
  'x-requested-by': 'ThoughtSpot',
5809
5892
  },
5810
- body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
5893
+ body: bodyPrams,
5811
5894
  credentials: 'include',
5812
5895
  // We do not want to follow the redirect, as it starts giving a CORS
5813
5896
  // error
@@ -5887,671 +5970,127 @@ const resetCachedAuthToken = () => {
5887
5970
  cachedAuthToken = null;
5888
5971
  };
5889
5972
 
5890
- let config = {};
5891
- /**
5892
- * Gets the configuration embed was initialized with.
5893
- *
5894
- * @returns {@link EmbedConfig} The configuration embed was initialized with.
5895
- * @version SDK: 1.19.0 | ThoughtSpot: *
5896
- * @group Global methods
5897
- */
5898
- const getEmbedConfig = () => config;
5899
- /**
5900
- * Sets the configuration embed was initialized with.
5901
- * And returns the new configuration.
5902
- *
5903
- * @param newConfig The configuration to set.
5904
- * @version SDK: 1.27.0 | ThoughtSpot: *
5905
- * @group Global methods
5906
- */
5907
- const setEmbedConfig = (newConfig) => {
5908
- config = newConfig;
5909
- return newConfig;
5973
+ var Config = {
5974
+ DEBUG: false,
5975
+ LIB_VERSION: '2.45.0'
5910
5976
  };
5911
5977
 
5912
- const tokenizedFetch = async (input, init) => {
5913
- const embedConfig = getEmbedConfig();
5914
- if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
5915
- return fetch(input, init);
5916
- }
5917
- const req = new Request(input, init);
5918
- const authToken = await getAuthenticationToken(embedConfig);
5919
- if (authToken) {
5920
- req.headers.append('Authorization', `Bearer ${authToken}`);
5921
- }
5922
- return fetch(req);
5923
- };
5978
+ // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
5979
+ var window$1;
5980
+ if (typeof(window) === 'undefined') {
5981
+ var loc = {
5982
+ hostname: ''
5983
+ };
5984
+ window$1 = {
5985
+ navigator: { userAgent: '' },
5986
+ document: {
5987
+ location: loc,
5988
+ referrer: ''
5989
+ },
5990
+ screen: { width: 0, height: 0 },
5991
+ location: loc
5992
+ };
5993
+ } else {
5994
+ window$1 = window;
5995
+ }
5924
5996
 
5925
- /**
5926
- *
5927
- * @param root0
5928
- * @param root0.query
5929
- * @param root0.variables
5930
- * @param root0.thoughtSpotHost
5931
- * @param root0.isCompositeQuery
5932
- */
5933
- async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
5934
- const operationName = getOperationNameFromQuery(query);
5935
- try {
5936
- const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
5937
- method: 'POST',
5938
- headers: {
5939
- 'content-type': 'application/json;charset=UTF-8',
5940
- 'x-requested-by': 'ThoughtSpot',
5941
- accept: '*/*',
5942
- 'accept-language': 'en-us',
5943
- },
5944
- body: JSON.stringify({
5945
- operationName,
5946
- query,
5947
- variables,
5948
- }),
5949
- credentials: 'include',
5950
- });
5951
- const result = await response.json();
5952
- const dataValues = Object.values(result.data);
5953
- return (isCompositeQuery) ? result.data : dataValues[0];
5954
- }
5955
- catch (error) {
5956
- return error;
5957
- }
5958
- }
5997
+ /*
5998
+ * Saved references to long variable names, so that closure compiler can
5999
+ * minimize file size.
6000
+ */
5959
6001
 
5960
- const getSourceDetailQuery = `
5961
- query GetSourceDetail($ids: [GUID!]!) {
5962
- getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
5963
- id
5964
- name
5965
- description
5966
- authorName
5967
- authorDisplayName
5968
- isExternal
5969
- type
5970
- created
5971
- modified
5972
- columns {
5973
- id
5974
- name
5975
- author
5976
- authorDisplayName
5977
- description
5978
- dataType
5979
- type
5980
- modified
5981
- ownerName
5982
- owner
5983
- dataRecency
5984
- sources {
5985
- tableId
5986
- tableName
5987
- columnId
5988
- columnName
5989
- __typename
6002
+ var ArrayProto = Array.prototype;
6003
+ var FuncProto = Function.prototype;
6004
+ var ObjProto = Object.prototype;
6005
+ var slice = ArrayProto.slice;
6006
+ var toString = ObjProto.toString;
6007
+ var hasOwnProperty$9 = ObjProto.hasOwnProperty;
6008
+ var windowConsole = window$1.console;
6009
+ var navigator = window$1.navigator;
6010
+ var document$1 = window$1.document;
6011
+ var windowOpera = window$1.opera;
6012
+ var screen = window$1.screen;
6013
+ var userAgent = navigator.userAgent;
6014
+ var nativeBind = FuncProto.bind;
6015
+ var nativeForEach = ArrayProto.forEach;
6016
+ var nativeIndexOf = ArrayProto.indexOf;
6017
+ var nativeMap = ArrayProto.map;
6018
+ var nativeIsArray = Array.isArray;
6019
+ var breaker = {};
6020
+ var _ = {
6021
+ trim: function(str) {
6022
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
6023
+ return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
6024
+ }
6025
+ };
6026
+
6027
+ // Console override
6028
+ var console$1 = {
6029
+ /** @type {function(...*)} */
6030
+ log: function() {
6031
+ if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6032
+ try {
6033
+ windowConsole.log.apply(windowConsole, arguments);
6034
+ } catch (err) {
6035
+ _.each(arguments, function(arg) {
6036
+ windowConsole.log(arg);
6037
+ });
5990
6038
  }
5991
- synonyms
5992
- cohortAnswerId
5993
- __typename
5994
- }
5995
- relationships
5996
- destinationRelationships
5997
- dataSourceId
5998
- __typename
5999
6039
  }
6000
- }
6001
- `;
6002
- const sourceDetailCache = new Map();
6003
- /**
6004
- *
6005
- * @param thoughtSpotHost
6006
- * @param sourceId
6007
- */
6008
- async function getSourceDetail(thoughtSpotHost, sourceId) {
6009
- if (sourceDetailCache.get(sourceId)) {
6010
- return sourceDetailCache.get(sourceId);
6011
- }
6012
- const details = await graphqlQuery({
6013
- query: getSourceDetailQuery,
6014
- variables: {
6015
- ids: [sourceId],
6016
- },
6017
- thoughtSpotHost,
6018
- });
6019
- const souceDetails = details[0];
6020
- if (souceDetails) {
6021
- sourceDetailCache.set(sourceId, souceDetails);
6022
- }
6023
- return souceDetails;
6024
- }
6025
-
6026
- const bachSessionId = `
6027
- id {
6028
- sessionId
6029
- genNo
6030
- acSession {
6031
- sessionId
6032
- genNo
6033
- }
6034
- }
6035
- `;
6036
- const getUnaggregatedAnswerSession = `
6037
- mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
6038
- Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
6039
- ${bachSessionId}
6040
- answer {
6041
- visualizations {
6042
- ... on TableViz {
6043
- columns {
6044
- column {
6045
- id
6046
- name
6047
- referencedColumns {
6048
- guid
6049
- displayName
6050
- }
6051
- }
6052
- }
6053
- }
6040
+ },
6041
+ /** @type {function(...*)} */
6042
+ warn: function() {
6043
+ if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6044
+ var args = ['Mixpanel warning:'].concat(_.toArray(arguments));
6045
+ try {
6046
+ windowConsole.warn.apply(windowConsole, args);
6047
+ } catch (err) {
6048
+ _.each(args, function(arg) {
6049
+ windowConsole.warn(arg);
6050
+ });
6054
6051
  }
6055
6052
  }
6056
- }
6057
- }
6058
- `;
6059
- const removeColumns = `
6060
- mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
6061
- Answer__removeColumns(
6062
- session: $session
6063
- logicalColumnIds: $logicalColumnIds
6064
- columnIds: $columnIds
6065
- ) {
6066
- ${bachSessionId}
6067
- }
6068
- }
6069
- `;
6070
- const addColumns = `
6071
- mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
6072
- Answer__addColumn(session: $session, columns: $columns) {
6073
- ${bachSessionId}
6053
+ },
6054
+ /** @type {function(...*)} */
6055
+ error: function() {
6056
+ if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6057
+ var args = ['Mixpanel error:'].concat(_.toArray(arguments));
6058
+ try {
6059
+ windowConsole.error.apply(windowConsole, args);
6060
+ } catch (err) {
6061
+ _.each(args, function(arg) {
6062
+ windowConsole.error(arg);
6063
+ });
6064
+ }
6074
6065
  }
6075
- }
6076
- `;
6077
- const getAnswerData = `
6078
- query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
6079
- getAnswer(session: $session) {
6080
- ${bachSessionId}
6081
- answer {
6082
- id
6083
- visualizations {
6084
- id
6085
- ... on TableViz {
6086
- columns {
6087
- column {
6088
- id
6089
- name
6090
- type
6091
- aggregationType
6092
- dataType
6093
- }
6094
- }
6095
- data(deadline: $deadline, pagination: $dataPaginationParams)
6096
- }
6097
- }
6066
+ },
6067
+ /** @type {function(...*)} */
6068
+ critical: function() {
6069
+ if (!_.isUndefined(windowConsole) && windowConsole) {
6070
+ var args = ['Mixpanel error:'].concat(_.toArray(arguments));
6071
+ try {
6072
+ windowConsole.error.apply(windowConsole, args);
6073
+ } catch (err) {
6074
+ _.each(args, function(arg) {
6075
+ windowConsole.error(arg);
6076
+ });
6098
6077
  }
6099
6078
  }
6100
6079
  }
6101
- `;
6080
+ };
6102
6081
 
6103
- // eslint-disable-next-line no-shadow
6104
- var OperationType;
6105
- (function (OperationType) {
6106
- OperationType["GetChartWithData"] = "GetChartWithData";
6107
- OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
6108
- })(OperationType || (OperationType = {}));
6109
- /**
6110
- * Class representing the answer service provided with the
6111
- * custom action payload. This service could be used to run
6112
- * graphql queries in the context of the answer on which the
6113
- * custom action was triggered.
6114
- *
6115
- * @example
6116
- * ```js
6117
- * embed.on(EmbedEvent.CustomAction, e => {
6118
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
6119
- * 'col name 1'
6120
- * ]);
6121
- * const data = await underlying.fetchData(0, 100);
6122
- * })
6123
- * ```
6124
- * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
6125
- * @group Events
6126
- */
6127
- class AnswerService {
6128
- /**
6129
- * Should not need to be called directly.
6130
- *
6131
- * @param session
6132
- * @param answer
6133
- * @param thoughtSpotHost
6134
- * @param selectedPoints
6135
- */
6136
- constructor(session, answer, thoughtSpotHost, selectedPoints) {
6137
- this.session = session;
6138
- this.answer = answer;
6139
- this.thoughtSpotHost = thoughtSpotHost;
6140
- this.selectedPoints = selectedPoints;
6141
- this.session = removeTypename(session);
6142
- }
6143
- /**
6144
- * Get the details about the source used in the answer.
6145
- * This can be used to get the list of all columns in the data source for example.
6146
- */
6147
- async getSourceDetail() {
6148
- const sourceId = this.answer.sources[0].header.guid;
6149
- return getSourceDetail(this.thoughtSpotHost, sourceId);
6150
- }
6151
- /**
6152
- * Remove columnIds and return updated answer session.
6153
- *
6154
- * @param columnIds
6155
- * @returns
6156
- */
6157
- async removeColumns(columnIds) {
6158
- return this.executeQuery(removeColumns, {
6159
- logicalColumnIds: columnIds,
6160
- });
6161
- }
6162
- /**
6163
- * Add columnIds and return updated answer session.
6164
- *
6165
- * @param columnIds
6166
- * @returns
6167
- */
6168
- async addColumns(columnIds) {
6169
- return this.executeQuery(addColumns, {
6170
- columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
6171
- });
6172
- }
6173
- /**
6174
- * Fetch data from the answer.
6175
- *
6176
- * @param offset
6177
- * @param size
6178
- * @returns
6179
- */
6180
- async fetchData(offset = 0, size = 1000) {
6181
- const { answer } = await this.executeQuery(getAnswerData, {
6182
- deadline: 0,
6183
- dataPaginationParams: {
6184
- isClientPaginated: true,
6185
- offset,
6186
- size,
6187
- },
6188
- });
6189
- const { columns, data } = answer.visualizations.find((viz) => !!viz.data) || {};
6190
- return {
6191
- columns,
6192
- data,
6193
- };
6194
- }
6195
- /**
6196
- * Fetch the data for the answer as a CSV blob. This might be
6197
- * quicker for larger data.
6198
- *
6199
- * @param userLocale
6200
- * @param includeInfo Include the CSV header in the output
6201
- * @returns Response
6202
- */
6203
- async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
6204
- const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
6205
- return tokenizedFetch(fetchUrl, {
6206
- credentials: 'include',
6207
- });
6208
- }
6209
- /**
6210
- * Just get the internal URL for this answer's data
6211
- * as a CSV blob.
6212
- *
6213
- * @param userLocale
6214
- * @param includeInfo
6215
- * @returns
6216
- */
6217
- getFetchCSVBlobUrl(userLocale = 'en-us', includeInfo = false) {
6218
- return `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&hideCsvHeader=${!includeInfo}`;
6219
- }
6220
- /**
6221
- * Get underlying data given a point and the output column names.
6222
- * In case of a context menu action, the selectedPoints are
6223
- * automatically passed.
6224
- *
6225
- * @param outputColumnNames
6226
- * @param selectedPoints
6227
- * @example
6228
- * ```js
6229
- * embed.on(EmbedEvent.CustomAction, e => {
6230
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
6231
- * 'col name 1' // The column should exist in the data source.
6232
- * ]);
6233
- * const data = await underlying.fetchData(0, 100);
6234
- * })
6235
- * ```
6236
- * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
6237
- */
6238
- async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
6239
- if (!selectedPoints && !this.selectedPoints) {
6240
- throw new Error('Needs to be triggered in context of a point');
6241
- }
6242
- if (!selectedPoints) {
6243
- selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
6244
- }
6245
- const sourceDetail = await this.getSourceDetail();
6246
- const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
6247
- const unAggAnswer = await graphqlQuery({
6248
- query: getUnaggregatedAnswerSession,
6249
- variables: {
6250
- session: this.session,
6251
- columns: selectedPoints,
6252
- },
6253
- thoughtSpotHost: this.thoughtSpotHost,
6254
- });
6255
- const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
6256
- const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
6257
- .map((c) => c.column.referencedColumns[0].guid));
6258
- const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
6259
- if (columnsToAdd.length) {
6260
- await unaggAnswerSession.addColumns(columnsToAdd);
6261
- }
6262
- const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
6263
- if (columnsToRemove.length) {
6264
- await unaggAnswerSession.removeColumns(columnsToRemove);
6265
- }
6266
- return unaggAnswerSession;
6267
- }
6268
- /**
6269
- * Execute a custom graphql query in the context of the answer.
6270
- *
6271
- * @param query graphql query
6272
- * @param variables graphql variables
6273
- * @returns
6274
- */
6275
- async executeQuery(query, variables) {
6276
- const data = await graphqlQuery({
6277
- query,
6278
- variables: {
6279
- session: this.session,
6280
- ...variables,
6281
- },
6282
- thoughtSpotHost: this.thoughtSpotHost,
6283
- isCompositeQuery: false,
6284
- });
6285
- this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
6286
- return data;
6287
- }
6288
- /**
6289
- * Get the internal session details for the answer.
6290
- *
6291
- * @returns
6292
- */
6293
- getSession() {
6294
- return this.session;
6295
- }
6296
- }
6297
- /**
6298
- *
6299
- * @param sourceDetail
6300
- * @param colNames
6301
- */
6302
- function getGuidsFromColumnNames(sourceDetail, colNames) {
6303
- const cols = sourceDetail.columns.reduce((colSet, col) => {
6304
- colSet[col.name] = col;
6305
- return colSet;
6306
- }, {});
6307
- return new Set(colNames.map((colName) => {
6308
- const col = cols[colName];
6309
- return col.id;
6310
- }));
6311
- }
6312
- /**
6313
- *
6314
- * @param selectedPoints
6315
- */
6316
- function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
6317
- const underlyingDataPoint = [];
6318
- /**
6319
- *
6320
- * @param colVal
6321
- */
6322
- function addPointFromColVal(colVal) {
6323
- var _a;
6324
- const dataType = colVal.column.dataType;
6325
- const id = colVal.column.id;
6326
- let dataValue;
6327
- if (dataType === 'DATE') {
6328
- if (Number.isFinite(colVal.value)) {
6329
- dataValue = [{
6330
- epochRange: {
6331
- startEpoch: colVal.value,
6332
- },
6333
- }];
6334
- // Case for custom calendar.
6335
- }
6336
- else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
6337
- dataValue = [{
6338
- epochRange: {
6339
- startEpoch: colVal.value.v.s,
6340
- endEpoch: colVal.value.v.e,
6341
- },
6342
- }];
6343
- }
6344
- }
6345
- else {
6346
- dataValue = [{ value: colVal.value }];
6347
- }
6348
- underlyingDataPoint.push({
6349
- columnId: colVal.column.id,
6350
- dataValue,
6351
- });
6352
- }
6353
- selectedPoints.forEach((p) => {
6354
- p.selectedAttributes.forEach(addPointFromColVal);
6355
- });
6356
- return underlyingDataPoint;
6357
- }
6358
-
6359
- const ERROR_MESSAGE = {
6360
- INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
6361
- LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
6362
- TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
6363
- SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
6364
- SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
6365
- };
6366
-
6367
- /**
6368
- * Copyright (c) 2023
6369
- *
6370
- * Utilities related to reading configuration objects
6371
- *
6372
- * @summary Config-related utils
6373
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
6374
- */
6375
- const urlRegex = new RegExp([
6376
- '(^(https?:)//)?',
6377
- '(([^:/?#]*)(?::([0-9]+))?)',
6378
- '(/{0,1}[^?#]*)',
6379
- '(\\?[^#]*|)',
6380
- '(#.*|)$', // hash
6381
- ].join(''));
6382
- /**
6383
- * Parse and construct the ThoughtSpot hostname or IP address
6384
- * from the embed configuration object.
6385
- *
6386
- * @param config
6387
- */
6388
- const getThoughtSpotHost = (config) => {
6389
- if (!config.thoughtSpotHost) {
6390
- throw new Error(ERROR_MESSAGE.INVALID_THOUGHTSPOT_HOST);
6391
- }
6392
- const urlParts = config.thoughtSpotHost.match(urlRegex);
6393
- if (!urlParts) {
6394
- throw new Error(ERROR_MESSAGE.INVALID_THOUGHTSPOT_HOST);
6395
- }
6396
- const protocol = urlParts[2] || window.location.protocol;
6397
- const host = urlParts[3];
6398
- let path = urlParts[6];
6399
- // Lose the trailing / if any
6400
- if (path.charAt(path.length - 1) === '/') {
6401
- path = path.substring(0, path.length - 1);
6402
- }
6403
- // const urlParams = urlParts[7];
6404
- // const hash = urlParts[8];
6405
- return `${protocol}//${host}${path}`;
6406
- };
6407
- const getV2BasePath = (config) => {
6408
- if (config.basepath) {
6409
- return config.basepath;
6410
- }
6411
- const tsHost = getThoughtSpotHost(config);
6412
- // This is to handle when e2e's. Search is run on pods for
6413
- // comp-blink-test-pipeline with baseUrl=https://localhost:8443.
6414
- // This is to handle when the developer is developing in their local
6415
- // environment.
6416
- if (tsHost.includes('://localhost') && !tsHost.includes(':8443')) {
6417
- return '';
6418
- }
6419
- return 'v2';
6420
- };
6421
- /**
6422
- * It is a good idea to keep URLs under 2000 chars.
6423
- * If this is ever breached, since we pass view configuration through
6424
- * URL params, we would like to log a warning.
6425
- * Reference: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
6426
- */
6427
- const URL_MAX_LENGTH = 2000;
6428
- /**
6429
- * The default CSS dimensions of the embedded app
6430
- */
6431
- const DEFAULT_EMBED_WIDTH = '100%';
6432
- const DEFAULT_EMBED_HEIGHT = '100%';
6433
-
6434
- var Config = {
6435
- DEBUG: false,
6436
- LIB_VERSION: '2.45.0'
6437
- };
6438
-
6439
- // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
6440
- var window$1;
6441
- if (typeof(window) === 'undefined') {
6442
- var loc = {
6443
- hostname: ''
6444
- };
6445
- window$1 = {
6446
- navigator: { userAgent: '' },
6447
- document: {
6448
- location: loc,
6449
- referrer: ''
6450
- },
6451
- screen: { width: 0, height: 0 },
6452
- location: loc
6453
- };
6454
- } else {
6455
- window$1 = window;
6456
- }
6457
-
6458
- /*
6459
- * Saved references to long variable names, so that closure compiler can
6460
- * minimize file size.
6461
- */
6462
-
6463
- var ArrayProto = Array.prototype;
6464
- var FuncProto = Function.prototype;
6465
- var ObjProto = Object.prototype;
6466
- var slice = ArrayProto.slice;
6467
- var toString = ObjProto.toString;
6468
- var hasOwnProperty$9 = ObjProto.hasOwnProperty;
6469
- var windowConsole = window$1.console;
6470
- var navigator = window$1.navigator;
6471
- var document$1 = window$1.document;
6472
- var windowOpera = window$1.opera;
6473
- var screen = window$1.screen;
6474
- var userAgent = navigator.userAgent;
6475
- var nativeBind = FuncProto.bind;
6476
- var nativeForEach = ArrayProto.forEach;
6477
- var nativeIndexOf = ArrayProto.indexOf;
6478
- var nativeMap = ArrayProto.map;
6479
- var nativeIsArray = Array.isArray;
6480
- var breaker = {};
6481
- var _ = {
6482
- trim: function(str) {
6483
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
6484
- return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
6485
- }
6486
- };
6487
-
6488
- // Console override
6489
- var console$1 = {
6490
- /** @type {function(...*)} */
6491
- log: function() {
6492
- if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6493
- try {
6494
- windowConsole.log.apply(windowConsole, arguments);
6495
- } catch (err) {
6496
- _.each(arguments, function(arg) {
6497
- windowConsole.log(arg);
6498
- });
6499
- }
6500
- }
6501
- },
6502
- /** @type {function(...*)} */
6503
- warn: function() {
6504
- if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6505
- var args = ['Mixpanel warning:'].concat(_.toArray(arguments));
6506
- try {
6507
- windowConsole.warn.apply(windowConsole, args);
6508
- } catch (err) {
6509
- _.each(args, function(arg) {
6510
- windowConsole.warn(arg);
6511
- });
6512
- }
6513
- }
6514
- },
6515
- /** @type {function(...*)} */
6516
- error: function() {
6517
- if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
6518
- var args = ['Mixpanel error:'].concat(_.toArray(arguments));
6519
- try {
6520
- windowConsole.error.apply(windowConsole, args);
6521
- } catch (err) {
6522
- _.each(args, function(arg) {
6523
- windowConsole.error(arg);
6524
- });
6525
- }
6526
- }
6527
- },
6528
- /** @type {function(...*)} */
6529
- critical: function() {
6530
- if (!_.isUndefined(windowConsole) && windowConsole) {
6531
- var args = ['Mixpanel error:'].concat(_.toArray(arguments));
6532
- try {
6533
- windowConsole.error.apply(windowConsole, args);
6534
- } catch (err) {
6535
- _.each(args, function(arg) {
6536
- windowConsole.error(arg);
6537
- });
6538
- }
6539
- }
6540
- }
6541
- };
6542
-
6543
- var log_func_with_prefix = function(func, prefix) {
6544
- return function() {
6545
- arguments[0] = '[' + prefix + '] ' + arguments[0];
6546
- return func.apply(console$1, arguments);
6547
- };
6548
- };
6549
- var console_with_prefix = function(prefix) {
6550
- return {
6551
- log: log_func_with_prefix(console$1.log, prefix),
6552
- error: log_func_with_prefix(console$1.error, prefix),
6553
- critical: log_func_with_prefix(console$1.critical, prefix)
6554
- };
6082
+ var log_func_with_prefix = function(func, prefix) {
6083
+ return function() {
6084
+ arguments[0] = '[' + prefix + '] ' + arguments[0];
6085
+ return func.apply(console$1, arguments);
6086
+ };
6087
+ };
6088
+ var console_with_prefix = function(prefix) {
6089
+ return {
6090
+ log: log_func_with_prefix(console$1.log, prefix),
6091
+ error: log_func_with_prefix(console$1.error, prefix),
6092
+ critical: log_func_with_prefix(console$1.critical, prefix)
6093
+ };
6555
6094
  };
6556
6095
 
6557
6096
 
@@ -12410,7 +11949,7 @@ var mixpanel = init_as_module();
12410
11949
  var mixpanel_cjs = mixpanel;
12411
11950
 
12412
11951
  var mixpanel$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), mixpanel_cjs, {
12413
- 'default': mixpanel_cjs
11952
+ 'default': mixpanel_cjs
12414
11953
  }));
12415
11954
 
12416
11955
  // Needed to avoid error in CJS builds on some bundlers.
@@ -12488,604 +12027,86 @@ function initMixpanel(sessionInfo) {
12488
12027
  }
12489
12028
  }
12490
12029
 
12491
- var eventemitter3 = createCommonjsModule(function (module) {
12030
+ let config = {};
12031
+ /**
12032
+ * Gets the configuration embed was initialized with.
12033
+ *
12034
+ * @returns {@link EmbedConfig} The configuration embed was initialized with.
12035
+ * @version SDK: 1.19.0 | ThoughtSpot: *
12036
+ * @group Global methods
12037
+ */
12038
+ const getEmbedConfig = () => config;
12039
+ /**
12040
+ * Sets the configuration embed was initialized with.
12041
+ * And returns the new configuration.
12042
+ *
12043
+ * @param newConfig The configuration to set.
12044
+ * @version SDK: 1.27.0 | ThoughtSpot: *
12045
+ * @group Global methods
12046
+ */
12047
+ const setEmbedConfig = (newConfig) => {
12048
+ config = newConfig;
12049
+ return newConfig;
12050
+ };
12492
12051
 
12493
- var has = Object.prototype.hasOwnProperty
12494
- , prefix = '~';
12052
+ /**
12053
+ * Fetch wrapper that adds the authentication token to the request.
12054
+ * Use this to call the ThoughtSpot APIs when using the visual embed sdk.
12055
+ *
12056
+ * @param input
12057
+ * @param init
12058
+ * @version SDK: 1.28.0
12059
+ * @group Global methods
12060
+ */
12061
+ const tokenizedFetch = async (input, init) => {
12062
+ const embedConfig = getEmbedConfig();
12063
+ if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
12064
+ return fetch(input, init);
12065
+ }
12066
+ const req = new Request(input, init);
12067
+ const authToken = await getAuthenticationToken(embedConfig);
12068
+ if (authToken) {
12069
+ req.headers.append('Authorization', `Bearer ${authToken}`);
12070
+ }
12071
+ return fetch(req);
12072
+ };
12495
12073
 
12496
- /**
12497
- * Constructor to create a storage for our `EE` objects.
12498
- * An `Events` instance is a plain object whose properties are event names.
12499
- *
12500
- * @constructor
12501
- * @private
12502
- */
12503
- function Events() {}
12504
-
12505
- //
12506
- // We try to not inherit from `Object.prototype`. In some engines creating an
12507
- // instance in this way is faster than calling `Object.create(null)` directly.
12508
- // If `Object.create(null)` is not supported we prefix the event names with a
12509
- // character to make sure that the built-in object properties are not
12510
- // overridden or used as an attack vector.
12511
- //
12512
- if (Object.create) {
12513
- Events.prototype = Object.create(null);
12514
-
12515
- //
12516
- // This hack is needed because the `__proto__` property is still inherited in
12517
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
12518
- //
12519
- if (!new Events().__proto__) prefix = false;
12520
- }
12521
-
12522
- /**
12523
- * Representation of a single event listener.
12524
- *
12525
- * @param {Function} fn The listener function.
12526
- * @param {*} context The context to invoke the listener with.
12527
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
12528
- * @constructor
12529
- * @private
12530
- */
12531
- function EE(fn, context, once) {
12532
- this.fn = fn;
12533
- this.context = context;
12534
- this.once = once || false;
12535
- }
12536
-
12537
- /**
12538
- * Add a listener for a given event.
12539
- *
12540
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
12541
- * @param {(String|Symbol)} event The event name.
12542
- * @param {Function} fn The listener function.
12543
- * @param {*} context The context to invoke the listener with.
12544
- * @param {Boolean} once Specify if the listener is a one-time listener.
12545
- * @returns {EventEmitter}
12546
- * @private
12547
- */
12548
- function addListener(emitter, event, fn, context, once) {
12549
- if (typeof fn !== 'function') {
12550
- throw new TypeError('The listener must be a function');
12551
- }
12552
-
12553
- var listener = new EE(fn, context || emitter, once)
12554
- , evt = prefix ? prefix + event : event;
12555
-
12556
- if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
12557
- else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
12558
- else emitter._events[evt] = [emitter._events[evt], listener];
12559
-
12560
- return emitter;
12561
- }
12562
-
12563
- /**
12564
- * Clear event by name.
12565
- *
12566
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
12567
- * @param {(String|Symbol)} evt The Event name.
12568
- * @private
12569
- */
12570
- function clearEvent(emitter, evt) {
12571
- if (--emitter._eventsCount === 0) emitter._events = new Events();
12572
- else delete emitter._events[evt];
12573
- }
12574
-
12575
- /**
12576
- * Minimal `EventEmitter` interface that is molded against the Node.js
12577
- * `EventEmitter` interface.
12578
- *
12579
- * @constructor
12580
- * @public
12581
- */
12582
- function EventEmitter() {
12583
- this._events = new Events();
12584
- this._eventsCount = 0;
12585
- }
12586
-
12587
- /**
12588
- * Return an array listing the events for which the emitter has registered
12589
- * listeners.
12590
- *
12591
- * @returns {Array}
12592
- * @public
12593
- */
12594
- EventEmitter.prototype.eventNames = function eventNames() {
12595
- var names = []
12596
- , events
12597
- , name;
12598
-
12599
- if (this._eventsCount === 0) return names;
12600
-
12601
- for (name in (events = this._events)) {
12602
- if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
12603
- }
12604
-
12605
- if (Object.getOwnPropertySymbols) {
12606
- return names.concat(Object.getOwnPropertySymbols(events));
12607
- }
12608
-
12609
- return names;
12610
- };
12611
-
12612
- /**
12613
- * Return the listeners registered for a given event.
12614
- *
12615
- * @param {(String|Symbol)} event The event name.
12616
- * @returns {Array} The registered listeners.
12617
- * @public
12618
- */
12619
- EventEmitter.prototype.listeners = function listeners(event) {
12620
- var evt = prefix ? prefix + event : event
12621
- , handlers = this._events[evt];
12622
-
12623
- if (!handlers) return [];
12624
- if (handlers.fn) return [handlers.fn];
12625
-
12626
- for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
12627
- ee[i] = handlers[i].fn;
12628
- }
12629
-
12630
- return ee;
12631
- };
12632
-
12633
- /**
12634
- * Return the number of listeners listening to a given event.
12635
- *
12636
- * @param {(String|Symbol)} event The event name.
12637
- * @returns {Number} The number of listeners.
12638
- * @public
12639
- */
12640
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
12641
- var evt = prefix ? prefix + event : event
12642
- , listeners = this._events[evt];
12643
-
12644
- if (!listeners) return 0;
12645
- if (listeners.fn) return 1;
12646
- return listeners.length;
12647
- };
12648
-
12649
- /**
12650
- * Calls each of the listeners registered for a given event.
12651
- *
12652
- * @param {(String|Symbol)} event The event name.
12653
- * @returns {Boolean} `true` if the event had listeners, else `false`.
12654
- * @public
12655
- */
12656
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
12657
- var evt = prefix ? prefix + event : event;
12658
-
12659
- if (!this._events[evt]) return false;
12660
-
12661
- var listeners = this._events[evt]
12662
- , len = arguments.length
12663
- , args
12664
- , i;
12665
-
12666
- if (listeners.fn) {
12667
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
12668
-
12669
- switch (len) {
12670
- case 1: return listeners.fn.call(listeners.context), true;
12671
- case 2: return listeners.fn.call(listeners.context, a1), true;
12672
- case 3: return listeners.fn.call(listeners.context, a1, a2), true;
12673
- case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
12674
- case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
12675
- case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
12676
- }
12677
-
12678
- for (i = 1, args = new Array(len -1); i < len; i++) {
12679
- args[i - 1] = arguments[i];
12680
- }
12681
-
12682
- listeners.fn.apply(listeners.context, args);
12683
- } else {
12684
- var length = listeners.length
12685
- , j;
12686
-
12687
- for (i = 0; i < length; i++) {
12688
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
12689
-
12690
- switch (len) {
12691
- case 1: listeners[i].fn.call(listeners[i].context); break;
12692
- case 2: listeners[i].fn.call(listeners[i].context, a1); break;
12693
- case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
12694
- case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
12695
- default:
12696
- if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
12697
- args[j - 1] = arguments[j];
12698
- }
12699
-
12700
- listeners[i].fn.apply(listeners[i].context, args);
12701
- }
12702
- }
12703
- }
12704
-
12705
- return true;
12706
- };
12707
-
12708
- /**
12709
- * Add a listener for a given event.
12710
- *
12711
- * @param {(String|Symbol)} event The event name.
12712
- * @param {Function} fn The listener function.
12713
- * @param {*} [context=this] The context to invoke the listener with.
12714
- * @returns {EventEmitter} `this`.
12715
- * @public
12716
- */
12717
- EventEmitter.prototype.on = function on(event, fn, context) {
12718
- return addListener(this, event, fn, context, false);
12719
- };
12720
-
12721
- /**
12722
- * Add a one-time listener for a given event.
12723
- *
12724
- * @param {(String|Symbol)} event The event name.
12725
- * @param {Function} fn The listener function.
12726
- * @param {*} [context=this] The context to invoke the listener with.
12727
- * @returns {EventEmitter} `this`.
12728
- * @public
12729
- */
12730
- EventEmitter.prototype.once = function once(event, fn, context) {
12731
- return addListener(this, event, fn, context, true);
12732
- };
12733
-
12734
- /**
12735
- * Remove the listeners of a given event.
12736
- *
12737
- * @param {(String|Symbol)} event The event name.
12738
- * @param {Function} fn Only remove the listeners that match this function.
12739
- * @param {*} context Only remove the listeners that have this context.
12740
- * @param {Boolean} once Only remove one-time listeners.
12741
- * @returns {EventEmitter} `this`.
12742
- * @public
12743
- */
12744
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
12745
- var evt = prefix ? prefix + event : event;
12746
-
12747
- if (!this._events[evt]) return this;
12748
- if (!fn) {
12749
- clearEvent(this, evt);
12750
- return this;
12751
- }
12752
-
12753
- var listeners = this._events[evt];
12754
-
12755
- if (listeners.fn) {
12756
- if (
12757
- listeners.fn === fn &&
12758
- (!once || listeners.once) &&
12759
- (!context || listeners.context === context)
12760
- ) {
12761
- clearEvent(this, evt);
12762
- }
12763
- } else {
12764
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
12765
- if (
12766
- listeners[i].fn !== fn ||
12767
- (once && !listeners[i].once) ||
12768
- (context && listeners[i].context !== context)
12769
- ) {
12770
- events.push(listeners[i]);
12771
- }
12772
- }
12773
-
12774
- //
12775
- // Reset the array, or remove it completely if we have no more listeners.
12776
- //
12777
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
12778
- else clearEvent(this, evt);
12779
- }
12780
-
12781
- return this;
12782
- };
12783
-
12784
- /**
12785
- * Remove all listeners, or those of the specified event.
12786
- *
12787
- * @param {(String|Symbol)} [event] The event name.
12788
- * @returns {EventEmitter} `this`.
12789
- * @public
12790
- */
12791
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
12792
- var evt;
12793
-
12794
- if (event) {
12795
- evt = prefix ? prefix + event : event;
12796
- if (this._events[evt]) clearEvent(this, evt);
12797
- } else {
12798
- this._events = new Events();
12799
- this._eventsCount = 0;
12800
- }
12801
-
12802
- return this;
12803
- };
12804
-
12805
- //
12806
- // Alias methods names because people roll like that.
12807
- //
12808
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
12809
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
12810
-
12811
- //
12812
- // Expose the prefix.
12813
- //
12814
- EventEmitter.prefixed = prefix;
12815
-
12816
- //
12817
- // Allow `EventEmitter` to be imported as module namespace.
12818
- //
12819
- EventEmitter.EventEmitter = EventEmitter;
12820
-
12821
- //
12822
- // Expose the module.
12823
- //
12824
- {
12825
- module.exports = EventEmitter;
12826
- }
12827
- });
12828
-
12829
- /**
12830
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
12831
- * support for iteratee shorthands.
12832
- *
12833
- * @private
12834
- * @param {Array} array The array to inspect.
12835
- * @param {Function} predicate The function invoked per iteration.
12836
- * @param {number} fromIndex The index to search from.
12837
- * @param {boolean} [fromRight] Specify iterating from right to left.
12838
- * @returns {number} Returns the index of the matched value, else `-1`.
12839
- */
12840
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
12841
- var length = array.length,
12842
- index = fromIndex + (fromRight ? 1 : -1);
12843
-
12844
- while ((fromRight ? index-- : ++index < length)) {
12845
- if (predicate(array[index], index, array)) {
12846
- return index;
12847
- }
12848
- }
12849
- return -1;
12850
- }
12851
-
12852
- var _baseFindIndex = baseFindIndex;
12853
-
12854
- /**
12855
- * The base implementation of `_.isNaN` without support for number objects.
12856
- *
12857
- * @private
12858
- * @param {*} value The value to check.
12859
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
12860
- */
12861
- function baseIsNaN(value) {
12862
- return value !== value;
12863
- }
12864
-
12865
- var _baseIsNaN = baseIsNaN;
12866
-
12867
- /**
12868
- * A specialized version of `_.indexOf` which performs strict equality
12869
- * comparisons of values, i.e. `===`.
12870
- *
12871
- * @private
12872
- * @param {Array} array The array to inspect.
12873
- * @param {*} value The value to search for.
12874
- * @param {number} fromIndex The index to search from.
12875
- * @returns {number} Returns the index of the matched value, else `-1`.
12876
- */
12877
- function strictIndexOf(array, value, fromIndex) {
12878
- var index = fromIndex - 1,
12879
- length = array.length;
12880
-
12881
- while (++index < length) {
12882
- if (array[index] === value) {
12883
- return index;
12884
- }
12885
- }
12886
- return -1;
12887
- }
12888
-
12889
- var _strictIndexOf = strictIndexOf;
12890
-
12891
- /**
12892
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
12893
- *
12894
- * @private
12895
- * @param {Array} array The array to inspect.
12896
- * @param {*} value The value to search for.
12897
- * @param {number} fromIndex The index to search from.
12898
- * @returns {number} Returns the index of the matched value, else `-1`.
12899
- */
12900
- function baseIndexOf(array, value, fromIndex) {
12901
- return value === value
12902
- ? _strictIndexOf(array, value, fromIndex)
12903
- : _baseFindIndex(array, _baseIsNaN, fromIndex);
12904
- }
12905
-
12906
- var _baseIndexOf = baseIndexOf;
12907
-
12908
- /**
12909
- * A specialized version of `_.includes` for arrays without support for
12910
- * specifying an index to search from.
12911
- *
12912
- * @private
12913
- * @param {Array} [array] The array to inspect.
12914
- * @param {*} target The value to search for.
12915
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
12916
- */
12917
- function arrayIncludes(array, value) {
12918
- var length = array == null ? 0 : array.length;
12919
- return !!length && _baseIndexOf(array, value, 0) > -1;
12920
- }
12921
-
12922
- var _arrayIncludes = arrayIncludes;
12923
-
12924
- /**
12925
- * This function is like `arrayIncludes` except that it accepts a comparator.
12926
- *
12927
- * @private
12928
- * @param {Array} [array] The array to inspect.
12929
- * @param {*} target The value to search for.
12930
- * @param {Function} comparator The comparator invoked per element.
12931
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
12932
- */
12933
- function arrayIncludesWith(array, value, comparator) {
12934
- var index = -1,
12935
- length = array == null ? 0 : array.length;
12936
-
12937
- while (++index < length) {
12938
- if (comparator(value, array[index])) {
12939
- return true;
12940
- }
12941
- }
12942
- return false;
12943
- }
12944
-
12945
- var _arrayIncludesWith = arrayIncludesWith;
12946
-
12947
- /** Used as references for various `Number` constants. */
12948
- var INFINITY = 1 / 0;
12949
-
12950
- /**
12951
- * Creates a set object of `values`.
12952
- *
12953
- * @private
12954
- * @param {Array} values The values to add to the set.
12955
- * @returns {Object} Returns the new set.
12956
- */
12957
- var createSet = !(_Set && (1 / _setToArray(new _Set([,-0]))[1]) == INFINITY) ? noop_1 : function(values) {
12958
- return new _Set(values);
12959
- };
12960
-
12961
- var _createSet = createSet;
12962
-
12963
- /** Used as the size to enable large array optimizations. */
12964
- var LARGE_ARRAY_SIZE$1 = 200;
12965
-
12966
- /**
12967
- * The base implementation of `_.uniqBy` without support for iteratee shorthands.
12968
- *
12969
- * @private
12970
- * @param {Array} array The array to inspect.
12971
- * @param {Function} [iteratee] The iteratee invoked per element.
12972
- * @param {Function} [comparator] The comparator invoked per element.
12973
- * @returns {Array} Returns the new duplicate free array.
12974
- */
12975
- function baseUniq(array, iteratee, comparator) {
12976
- var index = -1,
12977
- includes = _arrayIncludes,
12978
- length = array.length,
12979
- isCommon = true,
12980
- result = [],
12981
- seen = result;
12982
-
12983
- if (comparator) {
12984
- isCommon = false;
12985
- includes = _arrayIncludesWith;
12986
- }
12987
- else if (length >= LARGE_ARRAY_SIZE$1) {
12988
- var set = iteratee ? null : _createSet(array);
12989
- if (set) {
12990
- return _setToArray(set);
12991
- }
12992
- isCommon = false;
12993
- includes = _cacheHas;
12994
- seen = new _SetCache;
12995
- }
12996
- else {
12997
- seen = iteratee ? [] : result;
12998
- }
12999
- outer:
13000
- while (++index < length) {
13001
- var value = array[index],
13002
- computed = iteratee ? iteratee(value) : value;
13003
-
13004
- value = (comparator || value !== 0) ? value : 0;
13005
- if (isCommon && computed === computed) {
13006
- var seenIndex = seen.length;
13007
- while (seenIndex--) {
13008
- if (seen[seenIndex] === computed) {
13009
- continue outer;
13010
- }
13011
- }
13012
- if (iteratee) {
13013
- seen.push(computed);
13014
- }
13015
- result.push(value);
13016
- }
13017
- else if (!includes(seen, computed, comparator)) {
13018
- if (seen !== result) {
13019
- seen.push(computed);
13020
- }
13021
- result.push(value);
13022
- }
13023
- }
13024
- return result;
13025
- }
13026
-
13027
- var _baseUniq = baseUniq;
13028
-
13029
- /**
13030
- * Creates a duplicate-free version of an array, using
13031
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
13032
- * for equality comparisons, in which only the first occurrence of each element
13033
- * is kept. The order of result values is determined by the order they occur
13034
- * in the array.
13035
- *
13036
- * @static
13037
- * @memberOf _
13038
- * @since 0.1.0
13039
- * @category Array
13040
- * @param {Array} array The array to inspect.
13041
- * @returns {Array} Returns the new duplicate free array.
13042
- * @example
13043
- *
13044
- * _.uniq([2, 1, 2]);
13045
- * // => [2, 1]
13046
- */
13047
- function uniq(array) {
13048
- return (array && array.length) ? _baseUniq(array) : [];
13049
- }
13050
-
13051
- var uniq_1 = uniq;
13052
-
13053
- /**
13054
- *
13055
- * @param url
13056
- * @param options
13057
- */
13058
- function tokenisedFailureLoggedFetch(url, options = {}) {
13059
- return tokenizedFetch(url, options).then(async (r) => {
13060
- var _a;
13061
- if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
13062
- logger.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
13063
- }
13064
- return r;
13065
- });
13066
- }
13067
- /**
13068
- *
13069
- * @param authVerificationUrl
13070
- */
13071
- function fetchSessionInfoService(authVerificationUrl) {
13072
- return tokenisedFailureLoggedFetch(authVerificationUrl, {
13073
- credentials: 'include',
13074
- });
13075
- }
13076
- /**
13077
- *
13078
- * @param thoughtSpotHost
13079
- */
13080
- async function fetchLogoutService(thoughtSpotHost) {
13081
- return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
13082
- credentials: 'include',
13083
- method: 'POST',
13084
- headers: {
13085
- 'x-requested-by': 'ThoughtSpot',
13086
- },
13087
- });
13088
- }
12074
+ /**
12075
+ *
12076
+ * @param url
12077
+ * @param options
12078
+ */
12079
+ function tokenisedFailureLoggedFetch(url, options = {}) {
12080
+ return tokenizedFetch(url, options).then(async (r) => {
12081
+ var _a;
12082
+ if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
12083
+ logger.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
12084
+ }
12085
+ return r;
12086
+ });
12087
+ }
12088
+ /**
12089
+ *
12090
+ * @param authVerificationUrl
12091
+ */
12092
+ function fetchSessionInfoService(authVerificationUrl) {
12093
+ return tokenisedFailureLoggedFetch(authVerificationUrl, {
12094
+ credentials: 'include',
12095
+ });
12096
+ }
12097
+ /**
12098
+ *
12099
+ * @param thoughtSpotHost
12100
+ */
12101
+ async function fetchLogoutService(thoughtSpotHost) {
12102
+ return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
12103
+ credentials: 'include',
12104
+ method: 'POST',
12105
+ headers: {
12106
+ 'x-requested-by': 'ThoughtSpot',
12107
+ },
12108
+ });
12109
+ }
13089
12110
 
13090
12111
  // eslint-disable-next-line import/no-mutable-exports
13091
12112
  let loggedInStatus = false;
@@ -13101,394 +12122,1468 @@ const sessionInfoPromise = new Promise((resolve) => {
13101
12122
  let releaseVersion = '';
13102
12123
  const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
13103
12124
  /**
13104
- * Enum for auth failure types. This is the parameter passed to the listner
13105
- * of {@link AuthStatus.FAILURE}.
12125
+ * Enum for auth failure types. This is the parameter passed to the listner
12126
+ * of {@link AuthStatus.FAILURE}.
12127
+ *
12128
+ * @group Authentication / Init
12129
+ */
12130
+ var AuthFailureType;
12131
+ (function (AuthFailureType) {
12132
+ AuthFailureType["SDK"] = "SDK";
12133
+ AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
12134
+ AuthFailureType["EXPIRY"] = "EXPIRY";
12135
+ AuthFailureType["OTHER"] = "OTHER";
12136
+ })(AuthFailureType || (AuthFailureType = {}));
12137
+ /**
12138
+ * Enum for auth status emitted by the emitter returned from {@link init}.
12139
+ *
12140
+ * @group Authentication / Init
12141
+ */
12142
+ var AuthStatus;
12143
+ (function (AuthStatus) {
12144
+ /**
12145
+ * Emits when the SDK fails to authenticate
12146
+ */
12147
+ AuthStatus["FAILURE"] = "FAILURE";
12148
+ /**
12149
+ * Emits when the SDK authenticates successfully
12150
+ */
12151
+ AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
12152
+ /**
12153
+ * Emits when the app sends an authentication success message
12154
+ */
12155
+ AuthStatus["SUCCESS"] = "SUCCESS";
12156
+ /**
12157
+ * Emits when a user logs out
12158
+ */
12159
+ AuthStatus["LOGOUT"] = "LOGOUT";
12160
+ /**
12161
+ * Emitted when inPopup is true in the SAMLRedirect flow and the
12162
+ * popup is waiting to be triggered either programmatically
12163
+ * or by the trigger button.
12164
+ *
12165
+ * @version SDK: 1.19.0
12166
+ */
12167
+ AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
12168
+ })(AuthStatus || (AuthStatus = {}));
12169
+ /**
12170
+ * Events which can be triggered on the emitter returned from {@link init}.
12171
+ *
12172
+ * @group Authentication / Init
12173
+ */
12174
+ var AuthEvent;
12175
+ (function (AuthEvent) {
12176
+ /**
12177
+ * Manually trigger the SSO popup. This is useful when
12178
+ * authStatus is SAMLRedirect/OIDCRedirect and inPopup is set to true
12179
+ */
12180
+ AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
12181
+ })(AuthEvent || (AuthEvent = {}));
12182
+ let authEE;
12183
+ /**
12184
+ *
12185
+ * @param eventEmitter
12186
+ */
12187
+ function setAuthEE(eventEmitter) {
12188
+ authEE = eventEmitter;
12189
+ }
12190
+ /**
12191
+ *
12192
+ */
12193
+ function notifyAuthSDKSuccess() {
12194
+ if (!authEE) {
12195
+ logger.error('SDK not initialized');
12196
+ return;
12197
+ }
12198
+ authEE.emit(AuthStatus.SDK_SUCCESS);
12199
+ }
12200
+ /**
12201
+ *
12202
+ */
12203
+ function notifyAuthSuccess() {
12204
+ if (!authEE) {
12205
+ logger.error('SDK not initialized');
12206
+ return;
12207
+ }
12208
+ authEE.emit(AuthStatus.SUCCESS, sessionInfo);
12209
+ }
12210
+ /**
12211
+ *
12212
+ * @param failureType
12213
+ */
12214
+ function notifyAuthFailure(failureType) {
12215
+ if (!authEE) {
12216
+ logger.error('SDK not initialized');
12217
+ return;
12218
+ }
12219
+ authEE.emit(AuthStatus.FAILURE, failureType);
12220
+ }
12221
+ /**
12222
+ *
12223
+ */
12224
+ function notifyLogout() {
12225
+ if (!authEE) {
12226
+ logger.error('SDK not initialized');
12227
+ return;
12228
+ }
12229
+ authEE.emit(AuthStatus.LOGOUT);
12230
+ }
12231
+ const initSession = (sessionDetails) => {
12232
+ const embedConfig = getEmbedConfig();
12233
+ if (sessionInfo == null) {
12234
+ sessionInfo = sessionDetails;
12235
+ if (!embedConfig.disableSDKTracking) {
12236
+ initMixpanel(sessionInfo);
12237
+ }
12238
+ sessionInfoResolver(sessionInfo);
12239
+ }
12240
+ };
12241
+ const getSessionDetails = (sessionInfoResp) => {
12242
+ const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
12243
+ const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
12244
+ const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
12245
+ ? prodMixpanelToken
12246
+ : devMixpanelToken;
12247
+ return {
12248
+ userGUID: sessionInfoResp.userGUID,
12249
+ mixpanelToken,
12250
+ isPublicUser: sessionInfoResp.configInfo.isPublicUser,
12251
+ releaseVersion: sessionInfoResp.releaseVersion,
12252
+ clusterId: sessionInfoResp.configInfo.selfClusterId,
12253
+ clusterName: sessionInfoResp.configInfo.selfClusterName,
12254
+ ...sessionInfoResp,
12255
+ };
12256
+ };
12257
+ /**
12258
+ * Check if we are logged into the ThoughtSpot cluster
12259
+ *
12260
+ * @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
12261
+ */
12262
+ async function isLoggedIn(thoughtSpotHost) {
12263
+ const authVerificationUrl = `${thoughtSpotHost}${EndPoints.AUTH_VERIFICATION}`;
12264
+ let response = null;
12265
+ try {
12266
+ response = await fetchSessionInfoService(authVerificationUrl);
12267
+ const sessionInfoResp = await response.json();
12268
+ const sessionDetails = getSessionDetails(sessionInfoResp);
12269
+ // Store user session details from session info
12270
+ initSession(sessionDetails);
12271
+ releaseVersion = sessionInfoResp.releaseVersion;
12272
+ }
12273
+ catch (e) {
12274
+ return false;
12275
+ }
12276
+ return response.status === 200;
12277
+ }
12278
+ /**
12279
+ * Return releaseVersion if available
12280
+ */
12281
+ function getReleaseVersion() {
12282
+ return releaseVersion;
12283
+ }
12284
+ /**
12285
+ * Return a promise that resolves with the session information when
12286
+ * authentication is successful. And info is available.
12287
+ *
12288
+ * @group Global methods
12289
+ */
12290
+ function getSessionInfo() {
12291
+ return sessionInfoPromise;
12292
+ }
12293
+ /**
12294
+ * Check if we are stuck at the SSO redirect URL
12295
+ */
12296
+ function isAtSSORedirectUrl() {
12297
+ return window.location.href.indexOf(SSO_REDIRECTION_MARKER_GUID) >= 0;
12298
+ }
12299
+ /**
12300
+ * Remove the SSO redirect URL marker
12301
+ */
12302
+ function removeSSORedirectUrlMarker() {
12303
+ // Note (sunny): This will leave a # around even if it was not in the URL
12304
+ // to begin with. Trying to remove the hash by changing window.location will
12305
+ // reload the page which we don't want. We'll live with adding an
12306
+ // unnecessary hash to the parent page URL until we find any use case where
12307
+ // that creates an issue.
12308
+ window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
12309
+ }
12310
+ /**
12311
+ * Perform token based authentication
12312
+ *
12313
+ * @param embedConfig The embed configuration
12314
+ */
12315
+ const doTokenAuth = async (embedConfig) => {
12316
+ const { thoughtSpotHost, username, authEndpoint, getAuthToken, } = embedConfig;
12317
+ if (!authEndpoint && !getAuthToken) {
12318
+ throw new Error('Either auth endpoint or getAuthToken function must be provided');
12319
+ }
12320
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
12321
+ if (!loggedInStatus) {
12322
+ const authToken = await getAuthenticationToken(embedConfig);
12323
+ let resp;
12324
+ try {
12325
+ resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
12326
+ }
12327
+ catch (e) {
12328
+ resp = await fetchAuthService(thoughtSpotHost, username, authToken);
12329
+ }
12330
+ // token login issues a 302 when successful
12331
+ loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
12332
+ if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
12333
+ // When 3rd party cookie access is blocked, this will fail because
12334
+ // cookies will not be sent with the call.
12335
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
12336
+ }
12337
+ }
12338
+ return loggedInStatus;
12339
+ };
12340
+ /**
12341
+ * Validate embedConfig parameters required for cookielessTokenAuth
13106
12342
  *
13107
- * @group Authentication / Init
12343
+ * @param embedConfig The embed configuration
13108
12344
  */
13109
- var AuthFailureType;
13110
- (function (AuthFailureType) {
13111
- AuthFailureType["SDK"] = "SDK";
13112
- AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
13113
- AuthFailureType["EXPIRY"] = "EXPIRY";
13114
- AuthFailureType["OTHER"] = "OTHER";
13115
- })(AuthFailureType || (AuthFailureType = {}));
12345
+ const doCookielessTokenAuth = async (embedConfig) => {
12346
+ const { authEndpoint, getAuthToken } = embedConfig;
12347
+ if (!authEndpoint && !getAuthToken) {
12348
+ throw new Error('Either auth endpoint or getAuthToken function must be provided');
12349
+ }
12350
+ let authSuccess = false;
12351
+ try {
12352
+ const authToken = await getAuthenticationToken(embedConfig);
12353
+ if (authToken) {
12354
+ authSuccess = true;
12355
+ }
12356
+ }
12357
+ catch {
12358
+ authSuccess = false;
12359
+ }
12360
+ return authSuccess;
12361
+ };
13116
12362
  /**
13117
- * Enum for auth status emitted by the emitter returned from {@link init}.
12363
+ * Perform basic authentication to the ThoughtSpot cluster using the cluster
12364
+ * credentials.
13118
12365
  *
13119
- * @group Authentication / Init
13120
- */
13121
- var AuthStatus;
13122
- (function (AuthStatus) {
13123
- /**
13124
- * Emits when the SDK fails to authenticate
13125
- */
13126
- AuthStatus["FAILURE"] = "FAILURE";
13127
- /**
13128
- * Emits when the SDK authenticates successfully
13129
- */
13130
- AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
13131
- /**
13132
- * Emits when the app sends an authentication success message
13133
- */
13134
- AuthStatus["SUCCESS"] = "SUCCESS";
13135
- /**
13136
- * Emits when a user logs out
13137
- */
13138
- AuthStatus["LOGOUT"] = "LOGOUT";
13139
- /**
13140
- * Emitted when inPopup is true in the SAMLRedirect flow and the
13141
- * popup is waiting to be triggered either programmatically
13142
- * or by the trigger button.
13143
- *
13144
- * @version SDK: 1.19.0
13145
- */
13146
- AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
13147
- })(AuthStatus || (AuthStatus = {}));
13148
- /**
13149
- * Events which can be triggered on the emitter returned from {@link init}.
12366
+ * Warning: This feature is primarily intended for developer testing. It is
12367
+ * strongly advised not to use this authentication method in production.
13150
12368
  *
13151
- * @group Authentication / Init
12369
+ * @param embedConfig The embed configuration
13152
12370
  */
13153
- var AuthEvent;
13154
- (function (AuthEvent) {
13155
- /**
13156
- * Manually trigger the SSO popup. This is useful when
13157
- * authStatus is SAMLRedirect/OIDCRedirect and inPopup is set to true
13158
- */
13159
- AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
13160
- })(AuthEvent || (AuthEvent = {}));
13161
- let authEE;
12371
+ const doBasicAuth = async (embedConfig) => {
12372
+ const { thoughtSpotHost, username, password } = embedConfig;
12373
+ const loggedIn = await isLoggedIn(thoughtSpotHost);
12374
+ if (!loggedIn) {
12375
+ const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
12376
+ loggedInStatus = response.ok;
12377
+ if (embedConfig.detectCookieAccessSlow) {
12378
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
12379
+ }
12380
+ }
12381
+ else {
12382
+ loggedInStatus = true;
12383
+ }
12384
+ return loggedInStatus;
12385
+ };
13162
12386
  /**
13163
12387
  *
13164
- * @param eventEmitter
12388
+ * @param ssoURL
12389
+ * @param triggerContainer
12390
+ * @param triggerText
13165
12391
  */
13166
- function setAuthEE(eventEmitter) {
13167
- authEE = eventEmitter;
12392
+ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
12393
+ const openPopup = () => {
12394
+ if (samlAuthWindow === null || samlAuthWindow.closed) {
12395
+ samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
12396
+ }
12397
+ else {
12398
+ samlAuthWindow.focus();
12399
+ }
12400
+ };
12401
+ authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
12402
+ const containerEl = getDOMNode(triggerContainer);
12403
+ if (containerEl) {
12404
+ containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
12405
+ const authElem = document.getElementById('ts-auth-btn');
12406
+ authElem.textContent = triggerText;
12407
+ authElem.addEventListener('click', openPopup, { once: true });
12408
+ }
12409
+ samlCompletionPromise = samlCompletionPromise
12410
+ || new Promise((resolve, reject) => {
12411
+ window.addEventListener('message', (e) => {
12412
+ if (e.data.type === EmbedEvent.SAMLComplete) {
12413
+ e.source.close();
12414
+ resolve();
12415
+ }
12416
+ });
12417
+ });
12418
+ authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
12419
+ return samlCompletionPromise;
13168
12420
  }
13169
12421
  /**
12422
+ * Perform SAML authentication
13170
12423
  *
12424
+ * @param embedConfig The embed configuration
12425
+ * @param ssoEndPoint
13171
12426
  */
13172
- function notifyAuthSDKSuccess() {
13173
- if (!authEE) {
13174
- logger.error('SDK not initialized');
12427
+ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
12428
+ const { thoughtSpotHost } = embedConfig;
12429
+ const loggedIn = await isLoggedIn(thoughtSpotHost);
12430
+ if (loggedIn) {
12431
+ if (isAtSSORedirectUrl()) {
12432
+ removeSSORedirectUrlMarker();
12433
+ }
12434
+ loggedInStatus = true;
13175
12435
  return;
13176
12436
  }
13177
- authEE.emit(AuthStatus.SDK_SUCCESS);
13178
- }
12437
+ // we have already tried authentication and it did not succeed, restore
12438
+ // the current URL to the original one and invoke the callback.
12439
+ if (isAtSSORedirectUrl()) {
12440
+ removeSSORedirectUrlMarker();
12441
+ loggedInStatus = false;
12442
+ return;
12443
+ }
12444
+ const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
12445
+ if (embedConfig.inPopup) {
12446
+ await samlPopupFlow(ssoURL, embedConfig.authTriggerContainer, embedConfig.authTriggerText);
12447
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
12448
+ return;
12449
+ }
12450
+ window.location.href = ssoURL;
12451
+ };
12452
+ const doSamlAuth = async (embedConfig) => {
12453
+ const { thoughtSpotHost } = embedConfig;
12454
+ // redirect for SSO, when the SSO authentication is done, this page will be
12455
+ // loaded again and the same JS will execute again.
12456
+ const ssoRedirectUrl = embedConfig.inPopup
12457
+ ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
12458
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
12459
+ // bring back the page to the same URL
12460
+ const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
12461
+ await doSSOAuth(embedConfig, ssoEndPoint);
12462
+ return loggedInStatus;
12463
+ };
12464
+ const doOIDCAuth = async (embedConfig) => {
12465
+ const { thoughtSpotHost } = embedConfig;
12466
+ // redirect for SSO, when the SSO authentication is done, this page will be
12467
+ // loaded again and the same JS will execute again.
12468
+ const ssoRedirectUrl = embedConfig.noRedirect || embedConfig.inPopup
12469
+ ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
12470
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
12471
+ // bring back the page to the same URL
12472
+ const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
12473
+ await doSSOAuth(embedConfig, ssoEndPoint);
12474
+ return loggedInStatus;
12475
+ };
12476
+ const logout = async (embedConfig) => {
12477
+ const { thoughtSpotHost } = embedConfig;
12478
+ await fetchLogoutService(thoughtSpotHost);
12479
+ resetCachedAuthToken();
12480
+ const thoughtspotIframes = document.querySelectorAll("[data-ts-iframe='true']");
12481
+ if (thoughtspotIframes === null || thoughtspotIframes === void 0 ? void 0 : thoughtspotIframes.length) {
12482
+ thoughtspotIframes.forEach((el) => {
12483
+ el.parentElement.innerHTML = embedConfig.loginFailedMessage;
12484
+ });
12485
+ }
12486
+ loggedInStatus = false;
12487
+ return loggedInStatus;
12488
+ };
13179
12489
  /**
12490
+ * Perform authentication on the ThoughtSpot cluster
13180
12491
  *
12492
+ * @param embedConfig The embed configuration
13181
12493
  */
13182
- function notifyAuthSuccess() {
13183
- if (!authEE) {
13184
- logger.error('SDK not initialized');
13185
- return;
12494
+ const authenticate = async (embedConfig) => {
12495
+ const { authType } = embedConfig;
12496
+ switch (authType) {
12497
+ case AuthType.SSO:
12498
+ case AuthType.SAMLRedirect:
12499
+ case AuthType.SAML:
12500
+ return doSamlAuth(embedConfig);
12501
+ case AuthType.OIDC:
12502
+ case AuthType.OIDCRedirect:
12503
+ return doOIDCAuth(embedConfig);
12504
+ case AuthType.AuthServer:
12505
+ case AuthType.TrustedAuthToken:
12506
+ return doTokenAuth(embedConfig);
12507
+ case AuthType.TrustedAuthTokenCookieless:
12508
+ return doCookielessTokenAuth(embedConfig);
12509
+ case AuthType.Basic:
12510
+ return doBasicAuth(embedConfig);
12511
+ default:
12512
+ return Promise.resolve(true);
13186
12513
  }
13187
- authEE.emit(AuthStatus.SUCCESS, sessionInfo);
13188
- }
12514
+ };
12515
+
12516
+ const ERROR_MESSAGE = {
12517
+ INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
12518
+ LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
12519
+ TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
12520
+ SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
12521
+ SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
12522
+ };
12523
+
12524
+ /**
12525
+ * Copyright (c) 2023
12526
+ *
12527
+ * Utilities related to reading configuration objects
12528
+ *
12529
+ * @summary Config-related utils
12530
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
12531
+ */
12532
+ const urlRegex = new RegExp([
12533
+ '(^(https?:)//)?',
12534
+ '(([^:/?#]*)(?::([0-9]+))?)',
12535
+ '(/{0,1}[^?#]*)',
12536
+ '(\\?[^#]*|)',
12537
+ '(#.*|)$', // hash
12538
+ ].join(''));
13189
12539
  /**
12540
+ * Parse and construct the ThoughtSpot hostname or IP address
12541
+ * from the embed configuration object.
13190
12542
  *
13191
- * @param failureType
12543
+ * @param config
13192
12544
  */
13193
- function notifyAuthFailure(failureType) {
13194
- if (!authEE) {
13195
- logger.error('SDK not initialized');
13196
- return;
12545
+ const getThoughtSpotHost = (config) => {
12546
+ if (!config.thoughtSpotHost) {
12547
+ throw new Error(ERROR_MESSAGE.INVALID_THOUGHTSPOT_HOST);
13197
12548
  }
13198
- authEE.emit(AuthStatus.FAILURE, failureType);
13199
- }
13200
- /**
13201
- *
13202
- */
13203
- function notifyLogout() {
13204
- if (!authEE) {
13205
- logger.error('SDK not initialized');
13206
- return;
12549
+ const urlParts = config.thoughtSpotHost.match(urlRegex);
12550
+ if (!urlParts) {
12551
+ throw new Error(ERROR_MESSAGE.INVALID_THOUGHTSPOT_HOST);
13207
12552
  }
13208
- authEE.emit(AuthStatus.LOGOUT);
13209
- }
13210
- const initSession = (sessionDetails) => {
13211
- if (sessionInfo == null) {
13212
- sessionInfo = sessionDetails;
13213
- initMixpanel(sessionInfo);
13214
- sessionInfoResolver(sessionInfo);
12553
+ const protocol = urlParts[2] || window.location.protocol;
12554
+ const host = urlParts[3];
12555
+ let path = urlParts[6];
12556
+ // Lose the trailing / if any
12557
+ if (path.charAt(path.length - 1) === '/') {
12558
+ path = path.substring(0, path.length - 1);
13215
12559
  }
12560
+ // const urlParams = urlParts[7];
12561
+ // const hash = urlParts[8];
12562
+ return `${protocol}//${host}${path}`;
13216
12563
  };
13217
- const getSessionDetails = (sessionInfoResp) => {
13218
- const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
13219
- const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
13220
- const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
13221
- ? prodMixpanelToken
13222
- : devMixpanelToken;
13223
- return {
13224
- userGUID: sessionInfoResp.userGUID,
13225
- mixpanelToken,
13226
- isPublicUser: sessionInfoResp.configInfo.isPublicUser,
13227
- releaseVersion: sessionInfoResp.releaseVersion,
13228
- clusterId: sessionInfoResp.configInfo.selfClusterId,
13229
- clusterName: sessionInfoResp.configInfo.selfClusterName,
13230
- ...sessionInfoResp,
13231
- };
13232
- };
13233
- /**
13234
- * Check if we are logged into the ThoughtSpot cluster
13235
- *
13236
- * @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
13237
- */
13238
- async function isLoggedIn(thoughtSpotHost) {
13239
- const authVerificationUrl = `${thoughtSpotHost}${EndPoints.AUTH_VERIFICATION}`;
13240
- let response = null;
13241
- try {
13242
- response = await fetchSessionInfoService(authVerificationUrl);
13243
- const sessionInfoResp = await response.json();
13244
- const sessionDetails = getSessionDetails(sessionInfoResp);
13245
- // Store user session details from session info
13246
- initSession(sessionDetails);
13247
- releaseVersion = sessionInfoResp.releaseVersion;
12564
+ const getV2BasePath = (config) => {
12565
+ if (config.basepath) {
12566
+ return config.basepath;
13248
12567
  }
13249
- catch (e) {
13250
- return false;
12568
+ const tsHost = getThoughtSpotHost(config);
12569
+ // This is to handle when e2e's. Search is run on pods for
12570
+ // comp-blink-test-pipeline with baseUrl=https://localhost:8443.
12571
+ // This is to handle when the developer is developing in their local
12572
+ // environment.
12573
+ if (tsHost.includes('://localhost') && !tsHost.includes(':8443')) {
12574
+ return '';
13251
12575
  }
13252
- return response.status === 200;
13253
- }
12576
+ return 'v2';
12577
+ };
13254
12578
  /**
13255
- * Return releaseVersion if available
12579
+ * It is a good idea to keep URLs under 2000 chars.
12580
+ * If this is ever breached, since we pass view configuration through
12581
+ * URL params, we would like to log a warning.
12582
+ * Reference: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
13256
12583
  */
13257
- function getReleaseVersion() {
13258
- return releaseVersion;
13259
- }
12584
+ const URL_MAX_LENGTH = 2000;
13260
12585
  /**
13261
- * Return a promise that resolves with the session information when
13262
- * authentication is successful. And info is available.
13263
- *
13264
- * @group Global methods
12586
+ * The default CSS dimensions of the embedded app
13265
12587
  */
13266
- function getSessionInfo() {
13267
- return sessionInfoPromise;
13268
- }
12588
+ const DEFAULT_EMBED_WIDTH = '100%';
12589
+ const DEFAULT_EMBED_HEIGHT = '100%';
12590
+
13269
12591
  /**
13270
- * Check if we are stuck at the SSO redirect URL
12592
+ *
12593
+ * @param root0
12594
+ * @param root0.query
12595
+ * @param root0.variables
12596
+ * @param root0.thoughtSpotHost
12597
+ * @param root0.isCompositeQuery
13271
12598
  */
13272
- function isAtSSORedirectUrl() {
13273
- return window.location.href.indexOf(SSO_REDIRECTION_MARKER_GUID) >= 0;
13274
- }
12599
+ async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
12600
+ const operationName = getOperationNameFromQuery(query);
12601
+ try {
12602
+ const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
12603
+ method: 'POST',
12604
+ headers: {
12605
+ 'content-type': 'application/json;charset=UTF-8',
12606
+ 'x-requested-by': 'ThoughtSpot',
12607
+ accept: '*/*',
12608
+ 'accept-language': 'en-us',
12609
+ },
12610
+ body: JSON.stringify({
12611
+ operationName,
12612
+ query,
12613
+ variables,
12614
+ }),
12615
+ credentials: 'include',
12616
+ });
12617
+ const result = await response.json();
12618
+ const dataValues = Object.values(result.data);
12619
+ return (isCompositeQuery) ? result.data : dataValues[0];
12620
+ }
12621
+ catch (error) {
12622
+ return error;
12623
+ }
12624
+ }
12625
+
12626
+ const getSourceDetailQuery = `
12627
+ query GetSourceDetail($ids: [GUID!]!) {
12628
+ getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
12629
+ id
12630
+ name
12631
+ description
12632
+ authorName
12633
+ authorDisplayName
12634
+ isExternal
12635
+ type
12636
+ created
12637
+ modified
12638
+ columns {
12639
+ id
12640
+ name
12641
+ author
12642
+ authorDisplayName
12643
+ description
12644
+ dataType
12645
+ type
12646
+ modified
12647
+ ownerName
12648
+ owner
12649
+ dataRecency
12650
+ sources {
12651
+ tableId
12652
+ tableName
12653
+ columnId
12654
+ columnName
12655
+ __typename
12656
+ }
12657
+ synonyms
12658
+ cohortAnswerId
12659
+ __typename
12660
+ }
12661
+ relationships
12662
+ destinationRelationships
12663
+ dataSourceId
12664
+ __typename
12665
+ }
12666
+ }
12667
+ `;
12668
+ const sourceDetailCache = new Map();
13275
12669
  /**
13276
- * Remove the SSO redirect URL marker
12670
+ *
12671
+ * @param thoughtSpotHost
12672
+ * @param sourceId
13277
12673
  */
13278
- function removeSSORedirectUrlMarker() {
13279
- // Note (sunny): This will leave a # around even if it was not in the URL
13280
- // to begin with. Trying to remove the hash by changing window.location will
13281
- // reload the page which we don't want. We'll live with adding an
13282
- // unnecessary hash to the parent page URL until we find any use case where
13283
- // that creates an issue.
13284
- window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
13285
- }
12674
+ async function getSourceDetail(thoughtSpotHost, sourceId) {
12675
+ if (sourceDetailCache.get(sourceId)) {
12676
+ return sourceDetailCache.get(sourceId);
12677
+ }
12678
+ const details = await graphqlQuery({
12679
+ query: getSourceDetailQuery,
12680
+ variables: {
12681
+ ids: [sourceId],
12682
+ },
12683
+ thoughtSpotHost,
12684
+ });
12685
+ const souceDetails = details[0];
12686
+ if (souceDetails) {
12687
+ sourceDetailCache.set(sourceId, souceDetails);
12688
+ }
12689
+ return souceDetails;
12690
+ }
12691
+
12692
+ const bachSessionId = `
12693
+ id {
12694
+ sessionId
12695
+ genNo
12696
+ acSession {
12697
+ sessionId
12698
+ genNo
12699
+ }
12700
+ }
12701
+ `;
12702
+ const getUnaggregatedAnswerSession = `
12703
+ mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
12704
+ Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
12705
+ ${bachSessionId}
12706
+ answer {
12707
+ visualizations {
12708
+ ... on TableViz {
12709
+ columns {
12710
+ column {
12711
+ id
12712
+ name
12713
+ referencedColumns {
12714
+ guid
12715
+ displayName
12716
+ }
12717
+ }
12718
+ }
12719
+ }
12720
+ }
12721
+ }
12722
+ }
12723
+ }
12724
+ `;
12725
+ const removeColumns = `
12726
+ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
12727
+ Answer__removeColumns(
12728
+ session: $session
12729
+ logicalColumnIds: $logicalColumnIds
12730
+ columnIds: $columnIds
12731
+ ) {
12732
+ ${bachSessionId}
12733
+ }
12734
+ }
12735
+ `;
12736
+ const addColumns = `
12737
+ mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
12738
+ Answer__addColumn(session: $session, columns: $columns) {
12739
+ ${bachSessionId}
12740
+ }
12741
+ }
12742
+ `;
12743
+ const getAnswerData = `
12744
+ query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
12745
+ getAnswer(session: $session) {
12746
+ ${bachSessionId}
12747
+ answer {
12748
+ id
12749
+ visualizations {
12750
+ id
12751
+ ... on TableViz {
12752
+ columns {
12753
+ column {
12754
+ id
12755
+ name
12756
+ type
12757
+ aggregationType
12758
+ dataType
12759
+ }
12760
+ }
12761
+ data(deadline: $deadline, pagination: $dataPaginationParams)
12762
+ }
12763
+ }
12764
+ }
12765
+ }
12766
+ }
12767
+ `;
12768
+
12769
+ // eslint-disable-next-line no-shadow
12770
+ var OperationType;
12771
+ (function (OperationType) {
12772
+ OperationType["GetChartWithData"] = "GetChartWithData";
12773
+ OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
12774
+ })(OperationType || (OperationType = {}));
13286
12775
  /**
13287
- * Perform token based authentication
12776
+ * Class representing the answer service provided with the
12777
+ * custom action payload. This service could be used to run
12778
+ * graphql queries in the context of the answer on which the
12779
+ * custom action was triggered.
13288
12780
  *
13289
- * @param embedConfig The embed configuration
12781
+ * @example
12782
+ * ```js
12783
+ * embed.on(EmbedEvent.CustomAction, e => {
12784
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
12785
+ * 'col name 1'
12786
+ * ]);
12787
+ * const data = await underlying.fetchData(0, 100);
12788
+ * })
12789
+ * ```
12790
+ * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
12791
+ * @group Events
13290
12792
  */
13291
- const doTokenAuth = async (embedConfig) => {
13292
- const { thoughtSpotHost, username, authEndpoint, getAuthToken, } = embedConfig;
13293
- if (!authEndpoint && !getAuthToken) {
13294
- throw new Error('Either auth endpoint or getAuthToken function must be provided');
12793
+ class AnswerService {
12794
+ /**
12795
+ * Should not need to be called directly.
12796
+ *
12797
+ * @param session
12798
+ * @param answer
12799
+ * @param thoughtSpotHost
12800
+ * @param selectedPoints
12801
+ */
12802
+ constructor(session, answer, thoughtSpotHost, selectedPoints) {
12803
+ this.session = session;
12804
+ this.answer = answer;
12805
+ this.thoughtSpotHost = thoughtSpotHost;
12806
+ this.selectedPoints = selectedPoints;
12807
+ this.session = removeTypename(session);
13295
12808
  }
13296
- loggedInStatus = await isLoggedIn(thoughtSpotHost);
13297
- if (!loggedInStatus) {
13298
- const authToken = await getAuthenticationToken(embedConfig);
13299
- let resp;
13300
- try {
13301
- resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
13302
- }
13303
- catch (e) {
13304
- resp = await fetchAuthService(thoughtSpotHost, username, authToken);
13305
- }
13306
- // token login issues a 302 when successful
13307
- loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
13308
- if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
13309
- // When 3rd party cookie access is blocked, this will fail because
13310
- // cookies will not be sent with the call.
13311
- loggedInStatus = await isLoggedIn(thoughtSpotHost);
13312
- }
12809
+ /**
12810
+ * Get the details about the source used in the answer.
12811
+ * This can be used to get the list of all columns in the data source for example.
12812
+ */
12813
+ async getSourceDetail() {
12814
+ const sourceId = this.answer.sources[0].header.guid;
12815
+ return getSourceDetail(this.thoughtSpotHost, sourceId);
13313
12816
  }
13314
- return loggedInStatus;
13315
- };
13316
- /**
13317
- * Validate embedConfig parameters required for cookielessTokenAuth
13318
- *
13319
- * @param embedConfig The embed configuration
13320
- */
13321
- const doCookielessTokenAuth = async (embedConfig) => {
13322
- const { authEndpoint, getAuthToken } = embedConfig;
13323
- if (!authEndpoint && !getAuthToken) {
13324
- throw new Error('Either auth endpoint or getAuthToken function must be provided');
12817
+ /**
12818
+ * Remove columnIds and return updated answer session.
12819
+ *
12820
+ * @param columnIds
12821
+ * @returns
12822
+ */
12823
+ async removeColumns(columnIds) {
12824
+ return this.executeQuery(removeColumns, {
12825
+ logicalColumnIds: columnIds,
12826
+ });
13325
12827
  }
13326
- let authSuccess = false;
13327
- try {
13328
- const authToken = await getAuthenticationToken(embedConfig);
13329
- if (authToken) {
13330
- authSuccess = true;
13331
- }
12828
+ /**
12829
+ * Add columnIds and return updated answer session.
12830
+ *
12831
+ * @param columnIds
12832
+ * @returns
12833
+ */
12834
+ async addColumns(columnIds) {
12835
+ return this.executeQuery(addColumns, {
12836
+ columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
12837
+ });
13332
12838
  }
13333
- catch {
13334
- authSuccess = false;
12839
+ /**
12840
+ * Fetch data from the answer.
12841
+ *
12842
+ * @param offset
12843
+ * @param size
12844
+ * @returns
12845
+ */
12846
+ async fetchData(offset = 0, size = 1000) {
12847
+ const { answer } = await this.executeQuery(getAnswerData, {
12848
+ deadline: 0,
12849
+ dataPaginationParams: {
12850
+ isClientPaginated: true,
12851
+ offset,
12852
+ size,
12853
+ },
12854
+ });
12855
+ const { columns, data } = answer.visualizations.find((viz) => !!viz.data) || {};
12856
+ return {
12857
+ columns,
12858
+ data,
12859
+ };
13335
12860
  }
13336
- return authSuccess;
13337
- };
13338
- /**
13339
- * Perform basic authentication to the ThoughtSpot cluster using the cluster
13340
- * credentials.
13341
- *
13342
- * Warning: This feature is primarily intended for developer testing. It is
13343
- * strongly advised not to use this authentication method in production.
13344
- *
13345
- * @param embedConfig The embed configuration
13346
- */
13347
- const doBasicAuth = async (embedConfig) => {
13348
- const { thoughtSpotHost, username, password } = embedConfig;
13349
- const loggedIn = await isLoggedIn(thoughtSpotHost);
13350
- if (!loggedIn) {
13351
- const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
13352
- loggedInStatus = response.ok;
13353
- if (embedConfig.detectCookieAccessSlow) {
13354
- loggedInStatus = await isLoggedIn(thoughtSpotHost);
13355
- }
12861
+ /**
12862
+ * Fetch the data for the answer as a CSV blob. This might be
12863
+ * quicker for larger data.
12864
+ *
12865
+ * @param userLocale
12866
+ * @param includeInfo Include the CSV header in the output
12867
+ * @returns Response
12868
+ */
12869
+ async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
12870
+ const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
12871
+ return tokenizedFetch(fetchUrl, {
12872
+ credentials: 'include',
12873
+ });
13356
12874
  }
13357
- else {
13358
- loggedInStatus = true;
12875
+ /**
12876
+ * Just get the internal URL for this answer's data
12877
+ * as a CSV blob.
12878
+ *
12879
+ * @param userLocale
12880
+ * @param includeInfo
12881
+ * @returns
12882
+ */
12883
+ getFetchCSVBlobUrl(userLocale = 'en-us', includeInfo = false) {
12884
+ return `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&hideCsvHeader=${!includeInfo}`;
13359
12885
  }
13360
- return loggedInStatus;
13361
- };
13362
- /**
13363
- *
13364
- * @param ssoURL
13365
- * @param triggerContainer
13366
- * @param triggerText
13367
- */
13368
- async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
13369
- const openPopup = () => {
13370
- if (samlAuthWindow === null || samlAuthWindow.closed) {
13371
- samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
12886
+ /**
12887
+ * Get underlying data given a point and the output column names.
12888
+ * In case of a context menu action, the selectedPoints are
12889
+ * automatically passed.
12890
+ *
12891
+ * @param outputColumnNames
12892
+ * @param selectedPoints
12893
+ * @example
12894
+ * ```js
12895
+ * embed.on(EmbedEvent.CustomAction, e => {
12896
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
12897
+ * 'col name 1' // The column should exist in the data source.
12898
+ * ]);
12899
+ * const data = await underlying.fetchData(0, 100);
12900
+ * })
12901
+ * ```
12902
+ * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
12903
+ */
12904
+ async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
12905
+ if (!selectedPoints && !this.selectedPoints) {
12906
+ throw new Error('Needs to be triggered in context of a point');
12907
+ }
12908
+ if (!selectedPoints) {
12909
+ selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
12910
+ }
12911
+ const sourceDetail = await this.getSourceDetail();
12912
+ const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
12913
+ const unAggAnswer = await graphqlQuery({
12914
+ query: getUnaggregatedAnswerSession,
12915
+ variables: {
12916
+ session: this.session,
12917
+ columns: selectedPoints,
12918
+ },
12919
+ thoughtSpotHost: this.thoughtSpotHost,
12920
+ });
12921
+ const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
12922
+ const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
12923
+ .map((c) => c.column.referencedColumns[0].guid));
12924
+ const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
12925
+ if (columnsToAdd.length) {
12926
+ await unaggAnswerSession.addColumns(columnsToAdd);
13372
12927
  }
13373
- else {
13374
- samlAuthWindow.focus();
12928
+ const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
12929
+ if (columnsToRemove.length) {
12930
+ await unaggAnswerSession.removeColumns(columnsToRemove);
13375
12931
  }
13376
- };
13377
- authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
13378
- const containerEl = getDOMNode(triggerContainer);
13379
- if (containerEl) {
13380
- containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
13381
- const authElem = document.getElementById('ts-auth-btn');
13382
- authElem.textContent = triggerText;
13383
- authElem.addEventListener('click', openPopup, { once: true });
12932
+ return unaggAnswerSession;
13384
12933
  }
13385
- samlCompletionPromise = samlCompletionPromise
13386
- || new Promise((resolve, reject) => {
13387
- window.addEventListener('message', (e) => {
13388
- if (e.data.type === EmbedEvent.SAMLComplete) {
13389
- e.source.close();
13390
- resolve();
13391
- }
13392
- });
12934
+ /**
12935
+ * Execute a custom graphql query in the context of the answer.
12936
+ *
12937
+ * @param query graphql query
12938
+ * @param variables graphql variables
12939
+ * @returns
12940
+ */
12941
+ async executeQuery(query, variables) {
12942
+ const data = await graphqlQuery({
12943
+ query,
12944
+ variables: {
12945
+ session: this.session,
12946
+ ...variables,
12947
+ },
12948
+ thoughtSpotHost: this.thoughtSpotHost,
12949
+ isCompositeQuery: false,
13393
12950
  });
13394
- authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
13395
- return samlCompletionPromise;
12951
+ this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
12952
+ return data;
12953
+ }
12954
+ /**
12955
+ * Get the internal session details for the answer.
12956
+ *
12957
+ * @returns
12958
+ */
12959
+ getSession() {
12960
+ return this.session;
12961
+ }
13396
12962
  }
13397
12963
  /**
13398
- * Perform SAML authentication
13399
12964
  *
13400
- * @param embedConfig The embed configuration
13401
- * @param ssoEndPoint
12965
+ * @param sourceDetail
12966
+ * @param colNames
13402
12967
  */
13403
- const doSSOAuth = async (embedConfig, ssoEndPoint) => {
13404
- const { thoughtSpotHost } = embedConfig;
13405
- const loggedIn = await isLoggedIn(thoughtSpotHost);
13406
- if (loggedIn) {
13407
- if (isAtSSORedirectUrl()) {
13408
- removeSSORedirectUrlMarker();
13409
- }
13410
- loggedInStatus = true;
13411
- return;
13412
- }
13413
- // we have already tried authentication and it did not succeed, restore
13414
- // the current URL to the original one and invoke the callback.
13415
- if (isAtSSORedirectUrl()) {
13416
- removeSSORedirectUrlMarker();
13417
- loggedInStatus = false;
13418
- return;
13419
- }
13420
- const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
13421
- if (embedConfig.inPopup) {
13422
- await samlPopupFlow(ssoURL, embedConfig.authTriggerContainer, embedConfig.authTriggerText);
13423
- loggedInStatus = await isLoggedIn(thoughtSpotHost);
13424
- return;
13425
- }
13426
- window.location.href = ssoURL;
13427
- };
13428
- const doSamlAuth = async (embedConfig) => {
13429
- const { thoughtSpotHost } = embedConfig;
13430
- // redirect for SSO, when the SSO authentication is done, this page will be
13431
- // loaded again and the same JS will execute again.
13432
- const ssoRedirectUrl = embedConfig.inPopup
13433
- ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
13434
- : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
13435
- // bring back the page to the same URL
13436
- const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
13437
- await doSSOAuth(embedConfig, ssoEndPoint);
13438
- return loggedInStatus;
13439
- };
13440
- const doOIDCAuth = async (embedConfig) => {
13441
- const { thoughtSpotHost } = embedConfig;
13442
- // redirect for SSO, when the SSO authentication is done, this page will be
13443
- // loaded again and the same JS will execute again.
13444
- const ssoRedirectUrl = embedConfig.noRedirect || embedConfig.inPopup
13445
- ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
13446
- : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
13447
- // bring back the page to the same URL
13448
- const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
13449
- await doSSOAuth(embedConfig, ssoEndPoint);
13450
- return loggedInStatus;
13451
- };
13452
- const logout = async (embedConfig) => {
13453
- const { thoughtSpotHost } = embedConfig;
13454
- await fetchLogoutService(thoughtSpotHost);
13455
- resetCachedAuthToken();
13456
- const thoughtspotIframes = document.querySelectorAll('[data-ts-iframe=\'true\']');
13457
- if (thoughtspotIframes === null || thoughtspotIframes === void 0 ? void 0 : thoughtspotIframes.length) {
13458
- thoughtspotIframes.forEach((el) => {
13459
- el.parentElement.innerHTML = embedConfig.loginFailedMessage;
13460
- });
13461
- }
13462
- loggedInStatus = false;
13463
- return loggedInStatus;
13464
- };
12968
+ function getGuidsFromColumnNames(sourceDetail, colNames) {
12969
+ const cols = sourceDetail.columns.reduce((colSet, col) => {
12970
+ colSet[col.name] = col;
12971
+ return colSet;
12972
+ }, {});
12973
+ return new Set(colNames.map((colName) => {
12974
+ const col = cols[colName];
12975
+ return col.id;
12976
+ }));
12977
+ }
13465
12978
  /**
13466
- * Perform authentication on the ThoughtSpot cluster
13467
12979
  *
13468
- * @param embedConfig The embed configuration
12980
+ * @param selectedPoints
13469
12981
  */
13470
- const authenticate = async (embedConfig) => {
13471
- const { authType } = embedConfig;
13472
- switch (authType) {
13473
- case AuthType.SSO:
13474
- case AuthType.SAMLRedirect:
13475
- case AuthType.SAML:
13476
- return doSamlAuth(embedConfig);
13477
- case AuthType.OIDC:
13478
- case AuthType.OIDCRedirect:
13479
- return doOIDCAuth(embedConfig);
13480
- case AuthType.AuthServer:
13481
- case AuthType.TrustedAuthToken:
13482
- return doTokenAuth(embedConfig);
13483
- case AuthType.TrustedAuthTokenCookieless:
13484
- return doCookielessTokenAuth(embedConfig);
13485
- case AuthType.Basic:
13486
- return doBasicAuth(embedConfig);
13487
- default:
13488
- return Promise.resolve(true);
12982
+ function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
12983
+ const underlyingDataPoint = [];
12984
+ /**
12985
+ *
12986
+ * @param colVal
12987
+ */
12988
+ function addPointFromColVal(colVal) {
12989
+ var _a;
12990
+ const dataType = colVal.column.dataType;
12991
+ const id = colVal.column.id;
12992
+ let dataValue;
12993
+ if (dataType === 'DATE') {
12994
+ if (Number.isFinite(colVal.value)) {
12995
+ dataValue = [{
12996
+ epochRange: {
12997
+ startEpoch: colVal.value,
12998
+ },
12999
+ }];
13000
+ // Case for custom calendar.
13001
+ }
13002
+ else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
13003
+ dataValue = [{
13004
+ epochRange: {
13005
+ startEpoch: colVal.value.v.s,
13006
+ endEpoch: colVal.value.v.e,
13007
+ },
13008
+ }];
13009
+ }
13010
+ }
13011
+ else {
13012
+ dataValue = [{ value: colVal.value }];
13013
+ }
13014
+ underlyingDataPoint.push({
13015
+ columnId: colVal.column.id,
13016
+ dataValue,
13017
+ });
13489
13018
  }
13019
+ selectedPoints.forEach((p) => {
13020
+ p.selectedAttributes.forEach(addPointFromColVal);
13021
+ });
13022
+ return underlyingDataPoint;
13023
+ }
13024
+
13025
+ var eventemitter3 = createCommonjsModule(function (module) {
13026
+
13027
+ var has = Object.prototype.hasOwnProperty
13028
+ , prefix = '~';
13029
+
13030
+ /**
13031
+ * Constructor to create a storage for our `EE` objects.
13032
+ * An `Events` instance is a plain object whose properties are event names.
13033
+ *
13034
+ * @constructor
13035
+ * @private
13036
+ */
13037
+ function Events() {}
13038
+
13039
+ //
13040
+ // We try to not inherit from `Object.prototype`. In some engines creating an
13041
+ // instance in this way is faster than calling `Object.create(null)` directly.
13042
+ // If `Object.create(null)` is not supported we prefix the event names with a
13043
+ // character to make sure that the built-in object properties are not
13044
+ // overridden or used as an attack vector.
13045
+ //
13046
+ if (Object.create) {
13047
+ Events.prototype = Object.create(null);
13048
+
13049
+ //
13050
+ // This hack is needed because the `__proto__` property is still inherited in
13051
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
13052
+ //
13053
+ if (!new Events().__proto__) prefix = false;
13054
+ }
13055
+
13056
+ /**
13057
+ * Representation of a single event listener.
13058
+ *
13059
+ * @param {Function} fn The listener function.
13060
+ * @param {*} context The context to invoke the listener with.
13061
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
13062
+ * @constructor
13063
+ * @private
13064
+ */
13065
+ function EE(fn, context, once) {
13066
+ this.fn = fn;
13067
+ this.context = context;
13068
+ this.once = once || false;
13069
+ }
13070
+
13071
+ /**
13072
+ * Add a listener for a given event.
13073
+ *
13074
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
13075
+ * @param {(String|Symbol)} event The event name.
13076
+ * @param {Function} fn The listener function.
13077
+ * @param {*} context The context to invoke the listener with.
13078
+ * @param {Boolean} once Specify if the listener is a one-time listener.
13079
+ * @returns {EventEmitter}
13080
+ * @private
13081
+ */
13082
+ function addListener(emitter, event, fn, context, once) {
13083
+ if (typeof fn !== 'function') {
13084
+ throw new TypeError('The listener must be a function');
13085
+ }
13086
+
13087
+ var listener = new EE(fn, context || emitter, once)
13088
+ , evt = prefix ? prefix + event : event;
13089
+
13090
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
13091
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
13092
+ else emitter._events[evt] = [emitter._events[evt], listener];
13093
+
13094
+ return emitter;
13095
+ }
13096
+
13097
+ /**
13098
+ * Clear event by name.
13099
+ *
13100
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
13101
+ * @param {(String|Symbol)} evt The Event name.
13102
+ * @private
13103
+ */
13104
+ function clearEvent(emitter, evt) {
13105
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
13106
+ else delete emitter._events[evt];
13107
+ }
13108
+
13109
+ /**
13110
+ * Minimal `EventEmitter` interface that is molded against the Node.js
13111
+ * `EventEmitter` interface.
13112
+ *
13113
+ * @constructor
13114
+ * @public
13115
+ */
13116
+ function EventEmitter() {
13117
+ this._events = new Events();
13118
+ this._eventsCount = 0;
13119
+ }
13120
+
13121
+ /**
13122
+ * Return an array listing the events for which the emitter has registered
13123
+ * listeners.
13124
+ *
13125
+ * @returns {Array}
13126
+ * @public
13127
+ */
13128
+ EventEmitter.prototype.eventNames = function eventNames() {
13129
+ var names = []
13130
+ , events
13131
+ , name;
13132
+
13133
+ if (this._eventsCount === 0) return names;
13134
+
13135
+ for (name in (events = this._events)) {
13136
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
13137
+ }
13138
+
13139
+ if (Object.getOwnPropertySymbols) {
13140
+ return names.concat(Object.getOwnPropertySymbols(events));
13141
+ }
13142
+
13143
+ return names;
13144
+ };
13145
+
13146
+ /**
13147
+ * Return the listeners registered for a given event.
13148
+ *
13149
+ * @param {(String|Symbol)} event The event name.
13150
+ * @returns {Array} The registered listeners.
13151
+ * @public
13152
+ */
13153
+ EventEmitter.prototype.listeners = function listeners(event) {
13154
+ var evt = prefix ? prefix + event : event
13155
+ , handlers = this._events[evt];
13156
+
13157
+ if (!handlers) return [];
13158
+ if (handlers.fn) return [handlers.fn];
13159
+
13160
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
13161
+ ee[i] = handlers[i].fn;
13162
+ }
13163
+
13164
+ return ee;
13165
+ };
13166
+
13167
+ /**
13168
+ * Return the number of listeners listening to a given event.
13169
+ *
13170
+ * @param {(String|Symbol)} event The event name.
13171
+ * @returns {Number} The number of listeners.
13172
+ * @public
13173
+ */
13174
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
13175
+ var evt = prefix ? prefix + event : event
13176
+ , listeners = this._events[evt];
13177
+
13178
+ if (!listeners) return 0;
13179
+ if (listeners.fn) return 1;
13180
+ return listeners.length;
13181
+ };
13182
+
13183
+ /**
13184
+ * Calls each of the listeners registered for a given event.
13185
+ *
13186
+ * @param {(String|Symbol)} event The event name.
13187
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
13188
+ * @public
13189
+ */
13190
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
13191
+ var evt = prefix ? prefix + event : event;
13192
+
13193
+ if (!this._events[evt]) return false;
13194
+
13195
+ var listeners = this._events[evt]
13196
+ , len = arguments.length
13197
+ , args
13198
+ , i;
13199
+
13200
+ if (listeners.fn) {
13201
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
13202
+
13203
+ switch (len) {
13204
+ case 1: return listeners.fn.call(listeners.context), true;
13205
+ case 2: return listeners.fn.call(listeners.context, a1), true;
13206
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
13207
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
13208
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
13209
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
13210
+ }
13211
+
13212
+ for (i = 1, args = new Array(len -1); i < len; i++) {
13213
+ args[i - 1] = arguments[i];
13214
+ }
13215
+
13216
+ listeners.fn.apply(listeners.context, args);
13217
+ } else {
13218
+ var length = listeners.length
13219
+ , j;
13220
+
13221
+ for (i = 0; i < length; i++) {
13222
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
13223
+
13224
+ switch (len) {
13225
+ case 1: listeners[i].fn.call(listeners[i].context); break;
13226
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
13227
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
13228
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
13229
+ default:
13230
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
13231
+ args[j - 1] = arguments[j];
13232
+ }
13233
+
13234
+ listeners[i].fn.apply(listeners[i].context, args);
13235
+ }
13236
+ }
13237
+ }
13238
+
13239
+ return true;
13240
+ };
13241
+
13242
+ /**
13243
+ * Add a listener for a given event.
13244
+ *
13245
+ * @param {(String|Symbol)} event The event name.
13246
+ * @param {Function} fn The listener function.
13247
+ * @param {*} [context=this] The context to invoke the listener with.
13248
+ * @returns {EventEmitter} `this`.
13249
+ * @public
13250
+ */
13251
+ EventEmitter.prototype.on = function on(event, fn, context) {
13252
+ return addListener(this, event, fn, context, false);
13253
+ };
13254
+
13255
+ /**
13256
+ * Add a one-time listener for a given event.
13257
+ *
13258
+ * @param {(String|Symbol)} event The event name.
13259
+ * @param {Function} fn The listener function.
13260
+ * @param {*} [context=this] The context to invoke the listener with.
13261
+ * @returns {EventEmitter} `this`.
13262
+ * @public
13263
+ */
13264
+ EventEmitter.prototype.once = function once(event, fn, context) {
13265
+ return addListener(this, event, fn, context, true);
13266
+ };
13267
+
13268
+ /**
13269
+ * Remove the listeners of a given event.
13270
+ *
13271
+ * @param {(String|Symbol)} event The event name.
13272
+ * @param {Function} fn Only remove the listeners that match this function.
13273
+ * @param {*} context Only remove the listeners that have this context.
13274
+ * @param {Boolean} once Only remove one-time listeners.
13275
+ * @returns {EventEmitter} `this`.
13276
+ * @public
13277
+ */
13278
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
13279
+ var evt = prefix ? prefix + event : event;
13280
+
13281
+ if (!this._events[evt]) return this;
13282
+ if (!fn) {
13283
+ clearEvent(this, evt);
13284
+ return this;
13285
+ }
13286
+
13287
+ var listeners = this._events[evt];
13288
+
13289
+ if (listeners.fn) {
13290
+ if (
13291
+ listeners.fn === fn &&
13292
+ (!once || listeners.once) &&
13293
+ (!context || listeners.context === context)
13294
+ ) {
13295
+ clearEvent(this, evt);
13296
+ }
13297
+ } else {
13298
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
13299
+ if (
13300
+ listeners[i].fn !== fn ||
13301
+ (once && !listeners[i].once) ||
13302
+ (context && listeners[i].context !== context)
13303
+ ) {
13304
+ events.push(listeners[i]);
13305
+ }
13306
+ }
13307
+
13308
+ //
13309
+ // Reset the array, or remove it completely if we have no more listeners.
13310
+ //
13311
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
13312
+ else clearEvent(this, evt);
13313
+ }
13314
+
13315
+ return this;
13316
+ };
13317
+
13318
+ /**
13319
+ * Remove all listeners, or those of the specified event.
13320
+ *
13321
+ * @param {(String|Symbol)} [event] The event name.
13322
+ * @returns {EventEmitter} `this`.
13323
+ * @public
13324
+ */
13325
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
13326
+ var evt;
13327
+
13328
+ if (event) {
13329
+ evt = prefix ? prefix + event : event;
13330
+ if (this._events[evt]) clearEvent(this, evt);
13331
+ } else {
13332
+ this._events = new Events();
13333
+ this._eventsCount = 0;
13334
+ }
13335
+
13336
+ return this;
13337
+ };
13338
+
13339
+ //
13340
+ // Alias methods names because people roll like that.
13341
+ //
13342
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
13343
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
13344
+
13345
+ //
13346
+ // Expose the prefix.
13347
+ //
13348
+ EventEmitter.prefixed = prefix;
13349
+
13350
+ //
13351
+ // Allow `EventEmitter` to be imported as module namespace.
13352
+ //
13353
+ EventEmitter.EventEmitter = EventEmitter;
13354
+
13355
+ //
13356
+ // Expose the module.
13357
+ //
13358
+ {
13359
+ module.exports = EventEmitter;
13360
+ }
13361
+ });
13362
+
13363
+ /**
13364
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
13365
+ * support for iteratee shorthands.
13366
+ *
13367
+ * @private
13368
+ * @param {Array} array The array to inspect.
13369
+ * @param {Function} predicate The function invoked per iteration.
13370
+ * @param {number} fromIndex The index to search from.
13371
+ * @param {boolean} [fromRight] Specify iterating from right to left.
13372
+ * @returns {number} Returns the index of the matched value, else `-1`.
13373
+ */
13374
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
13375
+ var length = array.length,
13376
+ index = fromIndex + (fromRight ? 1 : -1);
13377
+
13378
+ while ((fromRight ? index-- : ++index < length)) {
13379
+ if (predicate(array[index], index, array)) {
13380
+ return index;
13381
+ }
13382
+ }
13383
+ return -1;
13384
+ }
13385
+
13386
+ var _baseFindIndex = baseFindIndex;
13387
+
13388
+ /**
13389
+ * The base implementation of `_.isNaN` without support for number objects.
13390
+ *
13391
+ * @private
13392
+ * @param {*} value The value to check.
13393
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
13394
+ */
13395
+ function baseIsNaN(value) {
13396
+ return value !== value;
13397
+ }
13398
+
13399
+ var _baseIsNaN = baseIsNaN;
13400
+
13401
+ /**
13402
+ * A specialized version of `_.indexOf` which performs strict equality
13403
+ * comparisons of values, i.e. `===`.
13404
+ *
13405
+ * @private
13406
+ * @param {Array} array The array to inspect.
13407
+ * @param {*} value The value to search for.
13408
+ * @param {number} fromIndex The index to search from.
13409
+ * @returns {number} Returns the index of the matched value, else `-1`.
13410
+ */
13411
+ function strictIndexOf(array, value, fromIndex) {
13412
+ var index = fromIndex - 1,
13413
+ length = array.length;
13414
+
13415
+ while (++index < length) {
13416
+ if (array[index] === value) {
13417
+ return index;
13418
+ }
13419
+ }
13420
+ return -1;
13421
+ }
13422
+
13423
+ var _strictIndexOf = strictIndexOf;
13424
+
13425
+ /**
13426
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
13427
+ *
13428
+ * @private
13429
+ * @param {Array} array The array to inspect.
13430
+ * @param {*} value The value to search for.
13431
+ * @param {number} fromIndex The index to search from.
13432
+ * @returns {number} Returns the index of the matched value, else `-1`.
13433
+ */
13434
+ function baseIndexOf(array, value, fromIndex) {
13435
+ return value === value
13436
+ ? _strictIndexOf(array, value, fromIndex)
13437
+ : _baseFindIndex(array, _baseIsNaN, fromIndex);
13438
+ }
13439
+
13440
+ var _baseIndexOf = baseIndexOf;
13441
+
13442
+ /**
13443
+ * A specialized version of `_.includes` for arrays without support for
13444
+ * specifying an index to search from.
13445
+ *
13446
+ * @private
13447
+ * @param {Array} [array] The array to inspect.
13448
+ * @param {*} target The value to search for.
13449
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
13450
+ */
13451
+ function arrayIncludes(array, value) {
13452
+ var length = array == null ? 0 : array.length;
13453
+ return !!length && _baseIndexOf(array, value, 0) > -1;
13454
+ }
13455
+
13456
+ var _arrayIncludes = arrayIncludes;
13457
+
13458
+ /**
13459
+ * This function is like `arrayIncludes` except that it accepts a comparator.
13460
+ *
13461
+ * @private
13462
+ * @param {Array} [array] The array to inspect.
13463
+ * @param {*} target The value to search for.
13464
+ * @param {Function} comparator The comparator invoked per element.
13465
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
13466
+ */
13467
+ function arrayIncludesWith(array, value, comparator) {
13468
+ var index = -1,
13469
+ length = array == null ? 0 : array.length;
13470
+
13471
+ while (++index < length) {
13472
+ if (comparator(value, array[index])) {
13473
+ return true;
13474
+ }
13475
+ }
13476
+ return false;
13477
+ }
13478
+
13479
+ var _arrayIncludesWith = arrayIncludesWith;
13480
+
13481
+ /** Used as references for various `Number` constants. */
13482
+ var INFINITY = 1 / 0;
13483
+
13484
+ /**
13485
+ * Creates a set object of `values`.
13486
+ *
13487
+ * @private
13488
+ * @param {Array} values The values to add to the set.
13489
+ * @returns {Object} Returns the new set.
13490
+ */
13491
+ var createSet = !(_Set && (1 / _setToArray(new _Set([,-0]))[1]) == INFINITY) ? noop_1 : function(values) {
13492
+ return new _Set(values);
13490
13493
  };
13491
13494
 
13495
+ var _createSet = createSet;
13496
+
13497
+ /** Used as the size to enable large array optimizations. */
13498
+ var LARGE_ARRAY_SIZE$1 = 200;
13499
+
13500
+ /**
13501
+ * The base implementation of `_.uniqBy` without support for iteratee shorthands.
13502
+ *
13503
+ * @private
13504
+ * @param {Array} array The array to inspect.
13505
+ * @param {Function} [iteratee] The iteratee invoked per element.
13506
+ * @param {Function} [comparator] The comparator invoked per element.
13507
+ * @returns {Array} Returns the new duplicate free array.
13508
+ */
13509
+ function baseUniq(array, iteratee, comparator) {
13510
+ var index = -1,
13511
+ includes = _arrayIncludes,
13512
+ length = array.length,
13513
+ isCommon = true,
13514
+ result = [],
13515
+ seen = result;
13516
+
13517
+ if (comparator) {
13518
+ isCommon = false;
13519
+ includes = _arrayIncludesWith;
13520
+ }
13521
+ else if (length >= LARGE_ARRAY_SIZE$1) {
13522
+ var set = iteratee ? null : _createSet(array);
13523
+ if (set) {
13524
+ return _setToArray(set);
13525
+ }
13526
+ isCommon = false;
13527
+ includes = _cacheHas;
13528
+ seen = new _SetCache;
13529
+ }
13530
+ else {
13531
+ seen = iteratee ? [] : result;
13532
+ }
13533
+ outer:
13534
+ while (++index < length) {
13535
+ var value = array[index],
13536
+ computed = iteratee ? iteratee(value) : value;
13537
+
13538
+ value = (comparator || value !== 0) ? value : 0;
13539
+ if (isCommon && computed === computed) {
13540
+ var seenIndex = seen.length;
13541
+ while (seenIndex--) {
13542
+ if (seen[seenIndex] === computed) {
13543
+ continue outer;
13544
+ }
13545
+ }
13546
+ if (iteratee) {
13547
+ seen.push(computed);
13548
+ }
13549
+ result.push(value);
13550
+ }
13551
+ else if (!includes(seen, computed, comparator)) {
13552
+ if (seen !== result) {
13553
+ seen.push(computed);
13554
+ }
13555
+ result.push(value);
13556
+ }
13557
+ }
13558
+ return result;
13559
+ }
13560
+
13561
+ var _baseUniq = baseUniq;
13562
+
13563
+ /**
13564
+ * Creates a duplicate-free version of an array, using
13565
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
13566
+ * for equality comparisons, in which only the first occurrence of each element
13567
+ * is kept. The order of result values is determined by the order they occur
13568
+ * in the array.
13569
+ *
13570
+ * @static
13571
+ * @memberOf _
13572
+ * @since 0.1.0
13573
+ * @category Array
13574
+ * @param {Array} array The array to inspect.
13575
+ * @returns {Array} Returns the new duplicate free array.
13576
+ * @example
13577
+ *
13578
+ * _.uniq([2, 1, 2]);
13579
+ * // => [2, 1]
13580
+ */
13581
+ function uniq(array) {
13582
+ return (array && array.length) ? _baseUniq(array) : [];
13583
+ }
13584
+
13585
+ var uniq_1 = uniq;
13586
+
13492
13587
  /* eslint-disable camelcase */
13493
13588
  const CONFIG_DEFAULTS = {
13494
13589
  loginFailedMessage: 'Not logged in',
@@ -13561,9 +13656,6 @@ function sanity(embedConfig) {
13561
13656
  throw new Error('ThoughtSpot host not provided');
13562
13657
  }
13563
13658
  if (embedConfig.authType === AuthType.TrustedAuthToken) {
13564
- if (!embedConfig.username) {
13565
- throw new Error('Username not provided with Trusted auth');
13566
- }
13567
13659
  if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
13568
13660
  throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
13569
13661
  }
@@ -13949,8 +14041,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
13949
14041
  });
13950
14042
  }
13951
14043
 
13952
- var name="@thoughtspot/visual-embed-sdk";var version="1.28.0-preRender";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",nirmay:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build"};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":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"44 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
13953
-
13954
14044
  /**
13955
14045
  * Copyright (c) 2022
13956
14046
  *
@@ -14074,7 +14164,7 @@ class TsEmbed {
14074
14164
  if (viewConfig.preRenderId) {
14075
14165
  const allOtherKeys = Object.keys(viewConfig).filter((key) => !preRenderAllowedKeys.includes(key) && !key.startsWith('on'));
14076
14166
  allOtherKeys.forEach((key) => {
14077
- if (!isUndefined$1(viewConfig[key])
14167
+ if (!isUndefined(viewConfig[key])
14078
14168
  && !isEqual_1(viewConfig[key], preRenderedObject.viewConfig[key])) {
14079
14169
  logger.warn(`${viewConfig.embedComponentType || 'Component'} was pre-rendered with `
14080
14170
  + `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
@@ -14096,7 +14186,7 @@ class TsEmbed {
14096
14186
  this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
14097
14187
  this.eventHandlerMap = new Map();
14098
14188
  this.isError = false;
14099
- this.viewConfig = viewConfig;
14189
+ this.viewConfig = { excludeRuntimeFiltersfromURL: true, ...viewConfig };
14100
14190
  this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
14101
14191
  this.registerAppInit();
14102
14192
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
@@ -14326,10 +14416,7 @@ class TsEmbed {
14326
14416
  const queryParams = this.shouldEncodeUrlQueryParams
14327
14417
  ? `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString)}`
14328
14418
  : `?${queryString}`;
14329
- let host = this.thoughtSpotHost;
14330
- if (!isUndefined$1(this.embedConfig.enableReactShell)) {
14331
- host = this.embedConfig.enableReactShell ? '/v2' : '/v1';
14332
- }
14419
+ const host = this.thoughtSpotHost;
14333
14420
  const path = `${host}/${queryParams}#`;
14334
14421
  return path;
14335
14422
  }
@@ -14718,6 +14805,14 @@ class TsEmbed {
14718
14805
  */
14719
14806
  trigger(messageType, data = {}) {
14720
14807
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
14808
+ if (!this.isRendered) {
14809
+ this.handleError('Please call render before triggering events');
14810
+ return null;
14811
+ }
14812
+ if (!messageType) {
14813
+ this.handleError('Host event type is undefined');
14814
+ return null;
14815
+ }
14721
14816
  return processTrigger(this.iFrame, messageType, this.thoughtSpotHost, data);
14722
14817
  }
14723
14818
  /**
@@ -14727,7 +14822,7 @@ class TsEmbed {
14727
14822
  *
14728
14823
  * @param args
14729
14824
  */
14730
- render() {
14825
+ async render() {
14731
14826
  this.isRendered = true;
14732
14827
  return this;
14733
14828
  }
@@ -14932,7 +15027,7 @@ class TsEmbed {
14932
15027
  class V1Embed extends TsEmbed {
14933
15028
  constructor(domSelector, viewConfig) {
14934
15029
  super(domSelector, viewConfig);
14935
- this.viewConfig = viewConfig;
15030
+ this.viewConfig = { excludeRuntimeFiltersfromURL: true, ...viewConfig };
14936
15031
  }
14937
15032
  /**
14938
15033
  * Render the app in an iframe and set up event handlers
@@ -15109,7 +15204,7 @@ class AppEmbed extends V1Embed {
15109
15204
  * @param pageId The ID of the page to be embedded.
15110
15205
  */
15111
15206
  getIFrameSrc() {
15112
- const { pageId, path, modularHomeExperience, } = this.viewConfig;
15207
+ const { pageId, path, modularHomeExperience } = this.viewConfig;
15113
15208
  const pageRoute = this.formatPath(path) || this.getPageRoute(pageId, modularHomeExperience);
15114
15209
  let url = `${this.getRootIframeSrc()}/${pageRoute}`;
15115
15210
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
@@ -15194,10 +15289,10 @@ class AppEmbed extends V1Embed {
15194
15289
  * @param renderOptions An object containing the page ID
15195
15290
  * to be embedded.
15196
15291
  */
15197
- render() {
15292
+ async render() {
15198
15293
  super.render();
15199
15294
  const src = this.getIFrameSrc();
15200
- this.renderV1Embed(src);
15295
+ await this.renderV1Embed(src);
15201
15296
  return this;
15202
15297
  }
15203
15298
  }
@@ -15345,7 +15440,7 @@ class LiveboardEmbed extends V1Embed {
15345
15440
  beforePrerenderVisible() {
15346
15441
  var _a;
15347
15442
  const embedObj = (_a = this.insertedDomEl) === null || _a === void 0 ? void 0 : _a[this.embedNodeKey];
15348
- if (isUndefined$1(embedObj))
15443
+ if (isUndefined(embedObj))
15349
15444
  return;
15350
15445
  const showDifferentLib = this.viewConfig.liveboardId
15351
15446
  && embedObj.viewConfig.liveboardId !== this.viewConfig.liveboardId;
@@ -15355,7 +15450,7 @@ class LiveboardEmbed extends V1Embed {
15355
15450
  }
15356
15451
  }
15357
15452
  handleRenderForPrerender() {
15358
- if (isUndefined$1(this.viewConfig.liveboardId)) {
15453
+ if (isUndefined(this.viewConfig.liveboardId)) {
15359
15454
  this.prerenderGeneric();
15360
15455
  return;
15361
15456
  }
@@ -15384,10 +15479,10 @@ class LiveboardEmbed extends V1Embed {
15384
15479
  * @param renderOptions An object specifying the Liveboard ID,
15385
15480
  * visualization ID and the runtime filters.
15386
15481
  */
15387
- render() {
15482
+ async render() {
15388
15483
  super.render();
15389
15484
  const src = this.getIFrameSrc();
15390
- this.renderV1Embed(src);
15485
+ await this.renderV1Embed(src);
15391
15486
  return this;
15392
15487
  }
15393
15488
  navigateToLiveboard(liveboardId, vizId, activeTabId) {
@@ -15453,7 +15548,7 @@ class SearchEmbed extends TsEmbed {
15453
15548
  }
15454
15549
  getEmbedParams() {
15455
15550
  var _a;
15456
- const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
15551
+ const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL = true, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
15457
15552
  const queryParams = this.getBaseQueryParams();
15458
15553
  queryParams[Param.HideActions] = [
15459
15554
  ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
@@ -15520,11 +15615,11 @@ class SearchEmbed extends TsEmbed {
15520
15615
  /**
15521
15616
  * Render the embedded ThoughtSpot search
15522
15617
  */
15523
- render() {
15618
+ async render() {
15524
15619
  super.render();
15525
15620
  const { answerId } = this.viewConfig;
15526
15621
  const src = this.getIFrameSrc();
15527
- this.renderIFrame(src);
15622
+ await this.renderIFrame(src);
15528
15623
  getAuthPromise().then(() => {
15529
15624
  if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
15530
15625
  || getEmbedConfig().suppressErrorAlerts)) {
@@ -15587,10 +15682,10 @@ class SearchBarEmbed extends TsEmbed {
15587
15682
  /**
15588
15683
  * Render the embedded ThoughtSpot search
15589
15684
  */
15590
- render() {
15685
+ async render() {
15591
15686
  super.render();
15592
15687
  const src = this.getIFrameSrc();
15593
- this.renderIFrame(src);
15688
+ await this.renderIFrame(src);
15594
15689
  return this;
15595
15690
  }
15596
15691
  }
@@ -15684,12 +15779,12 @@ class SageEmbed extends V1Embed {
15684
15779
  *
15685
15780
  * @returns {SageEmbed} Eureka/Sage embed
15686
15781
  */
15687
- render() {
15782
+ async render() {
15688
15783
  super.render();
15689
15784
  const src = this.getIFrameSrc();
15690
- this.renderV1Embed(src);
15785
+ await this.renderV1Embed(src);
15691
15786
  return this;
15692
15787
  }
15693
15788
  }
15694
15789
 
15695
- export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch, uploadMixpanelEvent };
15790
+ export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch, tokenizedFetch, uploadMixpanelEvent };