@thoughtspot/visual-embed-sdk 1.36.2 → 1.36.4

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 (271) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/authToken.d.ts.map +1 -1
  3. package/cjs/src/authToken.js +10 -3
  4. package/cjs/src/authToken.js.map +1 -1
  5. package/cjs/src/embed/app.d.ts +14 -0
  6. package/cjs/src/embed/app.d.ts.map +1 -1
  7. package/cjs/src/embed/app.js +5 -2
  8. package/cjs/src/embed/app.js.map +1 -1
  9. package/cjs/src/embed/app.spec.js +17 -0
  10. package/cjs/src/embed/app.spec.js.map +1 -1
  11. package/cjs/src/embed/base.d.ts +4 -0
  12. package/cjs/src/embed/base.d.ts.map +1 -1
  13. package/cjs/src/embed/base.js +27 -1
  14. package/cjs/src/embed/base.js.map +1 -1
  15. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  16. package/cjs/src/embed/bodyless-conversation.js +1 -1
  17. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  18. package/cjs/src/embed/conversation.d.ts.map +1 -1
  19. package/cjs/src/embed/conversation.js +1 -1
  20. package/cjs/src/embed/conversation.js.map +1 -1
  21. package/cjs/src/embed/embedConfig.d.ts +1 -1
  22. package/cjs/src/embed/embedConfig.d.ts.map +1 -1
  23. package/cjs/src/embed/embedConfig.js +5 -4
  24. package/cjs/src/embed/embedConfig.js.map +1 -1
  25. package/cjs/src/embed/liveboard.d.ts +6 -3
  26. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  27. package/cjs/src/embed/liveboard.js +4 -5
  28. package/cjs/src/embed/liveboard.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +11 -11
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/sage.d.ts.map +1 -1
  32. package/cjs/src/embed/sage.js +1 -1
  33. package/cjs/src/embed/sage.js.map +1 -1
  34. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  35. package/cjs/src/embed/search-bar.js +1 -1
  36. package/cjs/src/embed/search-bar.js.map +1 -1
  37. package/cjs/src/embed/search.d.ts.map +1 -1
  38. package/cjs/src/embed/search.js +1 -1
  39. package/cjs/src/embed/search.js.map +1 -1
  40. package/cjs/src/embed/ts-embed.d.ts +4 -3
  41. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  42. package/cjs/src/embed/ts-embed.js +25 -16
  43. package/cjs/src/embed/ts-embed.js.map +1 -1
  44. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  45. package/cjs/src/embed/ts-embed.spec.js +71 -5
  46. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  47. package/cjs/src/errors.d.ts +1 -0
  48. package/cjs/src/errors.d.ts.map +1 -1
  49. package/cjs/src/errors.js +1 -0
  50. package/cjs/src/errors.js.map +1 -1
  51. package/cjs/src/react/all-types-export.d.ts +1 -1
  52. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  53. package/cjs/src/react/all-types-export.js +2 -1
  54. package/cjs/src/react/all-types-export.js.map +1 -1
  55. package/cjs/src/react/index.d.ts +16 -0
  56. package/cjs/src/react/index.d.ts.map +1 -1
  57. package/cjs/src/react/index.js +25 -2
  58. package/cjs/src/react/index.js.map +1 -1
  59. package/cjs/src/types.d.ts +85 -66
  60. package/cjs/src/types.d.ts.map +1 -1
  61. package/cjs/src/types.js +78 -59
  62. package/cjs/src/types.js.map +1 -1
  63. package/cjs/src/utils/with-resolvers-polyfill.d.ts +1 -0
  64. package/cjs/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  65. package/cjs/src/utils/with-resolvers-polyfill.js +12 -0
  66. package/cjs/src/utils/with-resolvers-polyfill.js.map +1 -0
  67. package/cjs/src/utils.d.ts +27 -0
  68. package/cjs/src/utils.d.ts.map +1 -1
  69. package/cjs/src/utils.js +45 -1
  70. package/cjs/src/utils.js.map +1 -1
  71. package/cjs/src/utils.spec.js +15 -0
  72. package/cjs/src/utils.spec.js.map +1 -1
  73. package/dist/{index-B3hd6DTM.js → index-NZYq1Tu3.js} +1 -1
  74. package/dist/src/authToken.d.ts.map +1 -1
  75. package/dist/src/embed/app.d.ts +14 -0
  76. package/dist/src/embed/app.d.ts.map +1 -1
  77. package/dist/src/embed/base.d.ts +4 -0
  78. package/dist/src/embed/base.d.ts.map +1 -1
  79. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  80. package/dist/src/embed/conversation.d.ts.map +1 -1
  81. package/dist/src/embed/embedConfig.d.ts +1 -1
  82. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  83. package/dist/src/embed/liveboard.d.ts +6 -3
  84. package/dist/src/embed/liveboard.d.ts.map +1 -1
  85. package/dist/src/embed/sage.d.ts.map +1 -1
  86. package/dist/src/embed/search-bar.d.ts.map +1 -1
  87. package/dist/src/embed/search.d.ts.map +1 -1
  88. package/dist/src/embed/ts-embed.d.ts +4 -3
  89. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  90. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  91. package/dist/src/errors.d.ts +1 -0
  92. package/dist/src/errors.d.ts.map +1 -1
  93. package/dist/src/react/all-types-export.d.ts +1 -1
  94. package/dist/src/react/all-types-export.d.ts.map +1 -1
  95. package/dist/src/react/index.d.ts +16 -0
  96. package/dist/src/react/index.d.ts.map +1 -1
  97. package/dist/src/types.d.ts +85 -66
  98. package/dist/src/types.d.ts.map +1 -1
  99. package/dist/src/utils/with-resolvers-polyfill.d.ts +1 -0
  100. package/dist/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  101. package/dist/src/utils.d.ts +27 -0
  102. package/dist/src/utils.d.ts.map +1 -1
  103. package/dist/tsembed-react.es.js +458 -108
  104. package/dist/tsembed-react.js +456 -105
  105. package/dist/tsembed.es.js +197 -98
  106. package/dist/tsembed.js +196 -97
  107. package/dist/visual-embed-sdk-react-full.d.ts +1324 -1269
  108. package/dist/visual-embed-sdk-react.d.ts +814 -759
  109. package/dist/visual-embed-sdk.d.ts +113 -72
  110. package/lib/package.json +1 -1
  111. package/lib/src/authToken.d.ts.map +1 -1
  112. package/lib/src/authToken.js +10 -3
  113. package/lib/src/authToken.js.map +1 -1
  114. package/lib/src/embed/app.d.ts +14 -0
  115. package/lib/src/embed/app.d.ts.map +1 -1
  116. package/lib/src/embed/app.js +5 -2
  117. package/lib/src/embed/app.js.map +1 -1
  118. package/lib/src/embed/app.spec.js +17 -0
  119. package/lib/src/embed/app.spec.js.map +1 -1
  120. package/lib/src/embed/base.d.ts +4 -0
  121. package/lib/src/embed/base.d.ts.map +1 -1
  122. package/lib/src/embed/base.js +24 -1
  123. package/lib/src/embed/base.js.map +1 -1
  124. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  125. package/lib/src/embed/bodyless-conversation.js +1 -1
  126. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  127. package/lib/src/embed/conversation.d.ts.map +1 -1
  128. package/lib/src/embed/conversation.js +1 -1
  129. package/lib/src/embed/conversation.js.map +1 -1
  130. package/lib/src/embed/embedConfig.d.ts +1 -1
  131. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  132. package/lib/src/embed/embedConfig.js +5 -4
  133. package/lib/src/embed/embedConfig.js.map +1 -1
  134. package/lib/src/embed/liveboard.d.ts +6 -3
  135. package/lib/src/embed/liveboard.d.ts.map +1 -1
  136. package/lib/src/embed/liveboard.js +4 -5
  137. package/lib/src/embed/liveboard.js.map +1 -1
  138. package/lib/src/embed/liveboard.spec.js +11 -11
  139. package/lib/src/embed/liveboard.spec.js.map +1 -1
  140. package/lib/src/embed/sage.d.ts.map +1 -1
  141. package/lib/src/embed/sage.js +1 -1
  142. package/lib/src/embed/sage.js.map +1 -1
  143. package/lib/src/embed/search-bar.d.ts.map +1 -1
  144. package/lib/src/embed/search-bar.js +1 -1
  145. package/lib/src/embed/search-bar.js.map +1 -1
  146. package/lib/src/embed/search.d.ts.map +1 -1
  147. package/lib/src/embed/search.js +1 -1
  148. package/lib/src/embed/search.js.map +1 -1
  149. package/lib/src/embed/ts-embed.d.ts +4 -3
  150. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  151. package/lib/src/embed/ts-embed.js +26 -17
  152. package/lib/src/embed/ts-embed.js.map +1 -1
  153. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  154. package/lib/src/embed/ts-embed.spec.js +71 -5
  155. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  156. package/lib/src/errors.d.ts +1 -0
  157. package/lib/src/errors.d.ts.map +1 -1
  158. package/lib/src/errors.js +1 -0
  159. package/lib/src/errors.js.map +1 -1
  160. package/lib/src/react/all-types-export.d.ts +1 -1
  161. package/lib/src/react/all-types-export.d.ts.map +1 -1
  162. package/lib/src/react/all-types-export.js +1 -1
  163. package/lib/src/react/all-types-export.js.map +1 -1
  164. package/lib/src/react/index.d.ts +16 -0
  165. package/lib/src/react/index.d.ts.map +1 -1
  166. package/lib/src/react/index.js +23 -1
  167. package/lib/src/react/index.js.map +1 -1
  168. package/lib/src/types.d.ts +85 -66
  169. package/lib/src/types.d.ts.map +1 -1
  170. package/lib/src/types.js +78 -59
  171. package/lib/src/types.js.map +1 -1
  172. package/lib/src/utils/with-resolvers-polyfill.d.ts +1 -0
  173. package/lib/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  174. package/lib/src/utils/with-resolvers-polyfill.js +12 -0
  175. package/lib/src/utils/with-resolvers-polyfill.js.map +1 -0
  176. package/lib/src/utils.d.ts +27 -0
  177. package/lib/src/utils.d.ts.map +1 -1
  178. package/lib/src/utils.js +41 -0
  179. package/lib/src/utils.js.map +1 -1
  180. package/lib/src/utils.spec.js +16 -1
  181. package/lib/src/utils.spec.js.map +1 -1
  182. package/lib/src/visual-embed-sdk.d.ts +114 -73
  183. package/package.json +1 -1
  184. package/src/authToken.ts +11 -3
  185. package/src/embed/app.spec.ts +27 -0
  186. package/src/embed/app.ts +21 -1
  187. package/src/embed/base.ts +41 -1
  188. package/src/embed/bodyless-conversation.ts +2 -1
  189. package/src/embed/conversation.ts +2 -1
  190. package/src/embed/embedConfig.ts +5 -4
  191. package/src/embed/liveboard.spec.ts +11 -11
  192. package/src/embed/liveboard.ts +9 -7
  193. package/src/embed/sage.ts +1 -2
  194. package/src/embed/search-bar.tsx +1 -2
  195. package/src/embed/search.ts +1 -2
  196. package/src/embed/ts-embed.spec.ts +83 -5
  197. package/src/embed/ts-embed.ts +33 -17
  198. package/src/errors.ts +1 -0
  199. package/src/react/all-types-export.ts +1 -0
  200. package/src/react/index.tsx +27 -2
  201. package/src/types.ts +89 -70
  202. package/src/utils/with-resolvers-polyfill.ts +11 -0
  203. package/src/utils.spec.ts +21 -0
  204. package/src/utils.ts +52 -0
  205. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
  206. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
  207. package/cjs/src/embed/searchEmbed-basic-auth.spec.js +0 -104
  208. package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +0 -1
  209. package/cjs/src/hostEventsTypeMapping.d.ts +0 -2
  210. package/cjs/src/hostEventsTypeMapping.d.ts.map +0 -1
  211. package/cjs/src/hostEventsTypeMapping.js +0 -4
  212. package/cjs/src/hostEventsTypeMapping.js.map +0 -1
  213. package/cjs/src/utils/embedApi/contracts.d.ts +0 -101
  214. package/cjs/src/utils/embedApi/contracts.d.ts.map +0 -1
  215. package/cjs/src/utils/embedApi/contracts.js +0 -17
  216. package/cjs/src/utils/embedApi/contracts.js.map +0 -1
  217. package/cjs/src/utils/embedApi/embedApiClient.d.ts +0 -12
  218. package/cjs/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
  219. package/cjs/src/utils/embedApi/embedApiClient.js +0 -46
  220. package/cjs/src/utils/embedApi/embedApiClient.js.map +0 -1
  221. package/cjs/src/utils/embedApi/processEmbedApi.d.ts +0 -9
  222. package/cjs/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
  223. package/cjs/src/utils/embedApi/processEmbedApi.js +0 -18
  224. package/cjs/src/utils/embedApi/processEmbedApi.js.map +0 -1
  225. package/dist/index-BBBimG1x.js +0 -7370
  226. package/dist/index-BGnxP5NY.js +0 -7370
  227. package/dist/index-CENLvayL.js +0 -7370
  228. package/dist/index-CR5u7BMC.js +0 -7370
  229. package/dist/index-CbltIawo.js +0 -7370
  230. package/dist/index-CoQfqaHj.js +0 -7370
  231. package/dist/index-CzwzS0P4.js +0 -7370
  232. package/dist/index-D-9WUCUl.js +0 -7370
  233. package/dist/index-DFwi_pV_.js +0 -7370
  234. package/dist/index-DOIjN0N_.js +0 -7370
  235. package/dist/index-DYBx8SuE.js +0 -7370
  236. package/dist/index-DaLHJaLd.js +0 -7370
  237. package/dist/index-DnJX-gN2.js +0 -7370
  238. package/dist/index-DpuhnTj2.js +0 -7370
  239. package/dist/index-IDmSUe93.js +0 -7370
  240. package/dist/index-nWevLycs.js +0 -7370
  241. package/dist/index-vxW97_xb.js +0 -7370
  242. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
  243. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
  244. package/dist/src/hostEventsTypeMapping.d.ts +0 -2
  245. package/dist/src/hostEventsTypeMapping.d.ts.map +0 -1
  246. package/dist/src/utils/embedApi/contracts.d.ts +0 -101
  247. package/dist/src/utils/embedApi/contracts.d.ts.map +0 -1
  248. package/dist/src/utils/embedApi/embedApiClient.d.ts +0 -12
  249. package/dist/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
  250. package/dist/src/utils/embedApi/processEmbedApi.d.ts +0 -9
  251. package/dist/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
  252. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
  253. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
  254. package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -101
  255. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +0 -1
  256. package/lib/src/hostEventsTypeMapping.d.ts +0 -2
  257. package/lib/src/hostEventsTypeMapping.d.ts.map +0 -1
  258. package/lib/src/hostEventsTypeMapping.js +0 -2
  259. package/lib/src/hostEventsTypeMapping.js.map +0 -1
  260. package/lib/src/utils/embedApi/contracts.d.ts +0 -101
  261. package/lib/src/utils/embedApi/contracts.d.ts.map +0 -1
  262. package/lib/src/utils/embedApi/contracts.js +0 -14
  263. package/lib/src/utils/embedApi/contracts.js.map +0 -1
  264. package/lib/src/utils/embedApi/embedApiClient.d.ts +0 -12
  265. package/lib/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
  266. package/lib/src/utils/embedApi/embedApiClient.js +0 -42
  267. package/lib/src/utils/embedApi/embedApiClient.js.map +0 -1
  268. package/lib/src/utils/embedApi/processEmbedApi.d.ts +0 -9
  269. package/lib/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
  270. package/lib/src/utils/embedApi/processEmbedApi.js +0 -14
  271. package/lib/src/utils/embedApi/processEmbedApi.js.map +0 -1
@@ -1,6 +1,6 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.36.2 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.36.4 */
2
2
  import * as React from 'react';
3
- import React__default from 'react';
3
+ import React__default, { useRef } from 'react';
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  m.forEach(function (e) {
@@ -455,7 +455,35 @@ const getTypeFromValue = (value) => {
455
455
  return ['boolean', 'boolean'];
456
456
  }
457
457
  return ['', ''];
458
- };
458
+ };
459
+ const sdkWindowKey = '_tsEmbedSDK';
460
+ /**
461
+ * Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
462
+ * @param key - The key under which the value will be stored.
463
+ * @param value - The value to store.
464
+ * @param options - Additional options.
465
+ * @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
466
+ *
467
+ * @returns The stored value.
468
+ *
469
+ * @version SDK: 1.36.2 | ThoughtSpot: *
470
+ */
471
+ function storeValueInWindow(key, value, options = {}) {
472
+ if (!window[sdkWindowKey]) {
473
+ window[sdkWindowKey] = {};
474
+ }
475
+ if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
476
+ return window[sdkWindowKey][key];
477
+ }
478
+ window[sdkWindowKey][key] = value;
479
+ return value;
480
+ }
481
+ /**
482
+ * Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
483
+ * @param key - The key whose value needs to be retrieved.
484
+ * @returns The stored value or `undefined` if the key is not found.
485
+ */
486
+ const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
459
487
 
460
488
  /**
461
489
  * Copyright (c) 2023
@@ -846,8 +874,8 @@ var EmbedEvent;
846
874
  */
847
875
  EmbedEvent["Load"] = "load";
848
876
  /**
849
- * Data pertaining to answer or Liveboard is received
850
- * @return data - The answer or Liveboard data
877
+ * Data pertaining to an Answer or Liveboard is received
878
+ * @return data - The Answer or Liveboard data
851
879
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
852
880
  * @example
853
881
  *```js
@@ -1021,7 +1049,7 @@ var EmbedEvent;
1021
1049
  */
1022
1050
  EmbedEvent["Alert"] = "alert";
1023
1051
  /**
1024
- * The ThoughtSpot auth session has expired.
1052
+ * The ThoughtSpot authentication session has expired.
1025
1053
  * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
1026
1054
  * @example
1027
1055
  *```js
@@ -1091,7 +1119,7 @@ var EmbedEvent;
1091
1119
  /**
1092
1120
  * Emitted when the embed does not have cookie access. This happens
1093
1121
  * when Safari and other Web browsers block third-party cookies
1094
- * are blocked by default. `NoCookieAccess` can trigger
1122
+ * are blocked by default. `NoCookieAccess` can trigger.
1095
1123
  * @example
1096
1124
  *```js
1097
1125
  * appEmbed.on(EmbedEvent.NoCookieAccess)
@@ -1179,7 +1207,7 @@ var EmbedEvent;
1179
1207
  */
1180
1208
  EmbedEvent["Save"] = "save";
1181
1209
  /**
1182
- * Emitted when the download action is triggered on an answer
1210
+ * Emitted when the download action is triggered on an Answer.
1183
1211
  *
1184
1212
  * **Note**: This event is deprecated in v1.21.0.
1185
1213
  * To fire an event when a download action is initiated on a chart or table,
@@ -1195,7 +1223,7 @@ var EmbedEvent;
1195
1223
  */
1196
1224
  EmbedEvent["Download"] = "download";
1197
1225
  /**
1198
- * Emitted when the download action is triggered on an answer
1226
+ * Emitted when the download action is triggered on an Answer.
1199
1227
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
1200
1228
  * @example
1201
1229
  *```js
@@ -1209,7 +1237,7 @@ var EmbedEvent;
1209
1237
  */
1210
1238
  EmbedEvent["DownloadAsPng"] = "downloadAsPng";
1211
1239
  /**
1212
- * Emitted when the Download as PDF action is triggered on an answer
1240
+ * Emitted when the Download as PDF action is triggered on an Answer
1213
1241
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1214
1242
  * @example
1215
1243
  *```js
@@ -1223,7 +1251,7 @@ var EmbedEvent;
1223
1251
  */
1224
1252
  EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
1225
1253
  /**
1226
- * Emitted when the Download as CSV action is triggered on an answer
1254
+ * Emitted when the Download as CSV action is triggered on an Answer.
1227
1255
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1228
1256
  * @example
1229
1257
  *```js
@@ -1237,7 +1265,7 @@ var EmbedEvent;
1237
1265
  */
1238
1266
  EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
1239
1267
  /**
1240
- * Emitted when the Download as XLSX action is triggered on an answer
1268
+ * Emitted when the Download as XLSX action is triggered on an Answer.
1241
1269
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1242
1270
  * @example
1243
1271
  *```js
@@ -1265,7 +1293,8 @@ var EmbedEvent;
1265
1293
  */
1266
1294
  EmbedEvent["AnswerDelete"] = "answerDelete";
1267
1295
  /**
1268
- * Emitted when an answer is pinned to a Liveboard
1296
+ * Emitted when a user initiates the Pin action to
1297
+ * add an Answer to a Liveboard.
1269
1298
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1270
1299
  * @example
1271
1300
  *```js
@@ -1403,7 +1432,7 @@ var EmbedEvent;
1403
1432
  */
1404
1433
  EmbedEvent["SaveAsView"] = "saveAsView";
1405
1434
  /**
1406
- * Emitted when the user creates a copy of an Answer
1435
+ * Emitted when the user creates a copy of an Answer.
1407
1436
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1408
1437
  * @example
1409
1438
  *```js
@@ -1417,7 +1446,7 @@ var EmbedEvent;
1417
1446
  */
1418
1447
  EmbedEvent["CopyAEdit"] = "copyAEdit";
1419
1448
  /**
1420
- * Emitted when a user clicks Show underlying data on an Answer
1449
+ * Emitted when a user clicks *Show underlying data* on an Answer.
1421
1450
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1422
1451
  * @example
1423
1452
  *```js
@@ -1428,7 +1457,7 @@ var EmbedEvent;
1428
1457
  */
1429
1458
  EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
1430
1459
  /**
1431
- * Emitted when an answer is switched to a chart or table view.
1460
+ * Emitted when an Answer is switched to a chart or table view.
1432
1461
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1433
1462
  * @example
1434
1463
  *```js
@@ -1562,11 +1591,12 @@ var EmbedEvent;
1562
1591
  */
1563
1592
  EmbedEvent["CopyLink"] = "embedDocument";
1564
1593
  /**
1565
- * Emitted when a user interacts with cross filters on a visualization or Liveboard
1594
+ * Emitted when a user interacts with cross filters on a
1595
+ * visualization or Liveboard.
1566
1596
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
1567
1597
  * @example
1568
1598
  *```js
1569
- * liveboardEmbed.trigger(HostEvent.CrossFilterChanged, {
1599
+ * liveboardEmbed.on(EmbedEvent.CrossFilterChanged, {
1570
1600
  * vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1571
1601
  *```
1572
1602
  */
@@ -1660,8 +1690,8 @@ var EmbedEvent;
1660
1690
  */
1661
1691
  EmbedEvent["DeletePersonalisedView"] = "deletePersonalisedView";
1662
1692
  /**
1663
- * Emitted when a user creates a new worksheet
1664
- * @version SDK : 1.27.0 | ThoughtSpot Cloud: 9.8.0.cl
1693
+ * Emitted when a user creates a Worksheet.
1694
+ * @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
1665
1695
  */
1666
1696
  EmbedEvent["CreateWorksheet"] = "createWorksheet";
1667
1697
  /**
@@ -1674,8 +1704,8 @@ var EmbedEvent;
1674
1704
  */
1675
1705
  EmbedEvent["AskSageInit"] = "AskSageInit";
1676
1706
  /**
1677
- * Emitted when a LB/viz is renamed
1678
- * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl
1707
+ * Emitted when a Liveboard or visualization is renamed.
1708
+ * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl, 10.1.0.sw
1679
1709
  */
1680
1710
  EmbedEvent["Rename"] = "rename";
1681
1711
  /**
@@ -1739,8 +1769,7 @@ var EmbedEvent;
1739
1769
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1740
1770
  /**
1741
1771
  * Emitted when parameter changes in an Answer
1742
- * or Liveboard
1743
- *
1772
+ * or Liveboard.
1744
1773
  * ```js
1745
1774
  * liveboardEmbed.on(EmbedEvent.ParameterChanged, (payload) => {
1746
1775
  * console.log('payload', payload);
@@ -1767,7 +1796,7 @@ var EmbedEvent;
1767
1796
  */
1768
1797
  EmbedEvent["TableVizRendered"] = "TableVizRendered";
1769
1798
  /**
1770
- * Emitted when the liveboard is created from pin modal or liveboard list page.
1799
+ * Emitted when the liveboard is created from pin modal or Liveboard list page.
1771
1800
  * You can use this event as a hook to trigger
1772
1801
  * other events on liveboard creation.
1773
1802
  *
@@ -1912,7 +1941,7 @@ var HostEvent;
1912
1941
  */
1913
1942
  HostEvent["Filter"] = "filter";
1914
1943
  /**
1915
- * Reload the answer or visualization
1944
+ * Reload the Answer or visualization
1916
1945
  * @hidden
1917
1946
  */
1918
1947
  HostEvent["Reload"] = "reload";
@@ -1962,12 +1991,10 @@ var HostEvent;
1962
1991
  * and `AppEmbed` only. In full application embedding, this event updates
1963
1992
  * the runtime filters applied on the Liveboard and saved Answer objects.
1964
1993
  *
1965
- *
1966
- * Pass an array of runtime filters with the following attributes:
1967
- *
1994
+ * @param - Pass an array of {@link RuntimeFilter} with the following attributes:
1968
1995
  * `columnName` - _String_. The name of the column to filter on.
1969
1996
  *
1970
- * `operator` - Runtime filter operator to apply. For more information,
1997
+ * `operator` - {@link RuntimeFilterOp} to apply. For more information,
1971
1998
  * see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
1972
1999
  *
1973
2000
  * `values` - List of operands. Some operators such as EQ and LE allow a
@@ -1979,7 +2006,7 @@ var HostEvent;
1979
2006
  * will be cleared, restoring the original visualization
1980
2007
  * with the updated filters.
1981
2008
  *
1982
- * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
2009
+
1983
2010
  * @example
1984
2011
  * ```js
1985
2012
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
@@ -2218,6 +2245,11 @@ var HostEvent;
2218
2245
  * appEmbed.trigger(HostEvent.Remove)
2219
2246
  * ```
2220
2247
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2248
+ * * @example
2249
+ * ```js
2250
+ * liveboardEmbed.trigger(HostEvent.Remove)
2251
+ * ```
2252
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl, 10.10.0.sw
2221
2253
  */
2222
2254
  HostEvent["Remove"] = "delete";
2223
2255
  /**
@@ -2628,7 +2660,7 @@ var HostEvent;
2628
2660
  * ```js
2629
2661
  * liveboardEmbed.trigger(HostEvent.GetTabs).then((tabDetails) => {
2630
2662
  * console.log(
2631
- * tabDetails // TabDetails of current LB
2663
+ * tabDetails // TabDetails of current Liveboard
2632
2664
  * );
2633
2665
  * })
2634
2666
  * ```
@@ -2676,7 +2708,7 @@ var HostEvent;
2676
2708
  */
2677
2709
  HostEvent["UpdateSageQuery"] = "updateSageQuery";
2678
2710
  /**
2679
- * Get the answer session for a Search or
2711
+ * Get the Answer session for a Search or
2680
2712
  * Liveboard visualization.
2681
2713
  * @example
2682
2714
  * ```js
@@ -2855,6 +2887,7 @@ var Param;
2855
2887
  Param["HostAppUrl"] = "hostAppUrl";
2856
2888
  Param["EnableVizTransformations"] = "enableVizTransform";
2857
2889
  Param["EnableSearchAssist"] = "enableSearchAssist";
2890
+ Param["EnablePendoHelp"] = "enablePendoHelp";
2858
2891
  Param["HideResult"] = "hideResult";
2859
2892
  Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
2860
2893
  Param["Tag"] = "tag";
@@ -3087,9 +3120,10 @@ var Action;
3087
3120
  */
3088
3121
  Action["AddDataPanelObjects"] = "addDataPanelObjects";
3089
3122
  /**
3090
- * Filter configuration options on a Liveboard page.
3091
- * Allows configuring filters on a
3092
- * Liveboard.
3123
+ * The filter configuration options for a Liveboard.
3124
+ * The configuration options are available when adding
3125
+ * filters on a Liveboard.
3126
+ *
3093
3127
  * @example
3094
3128
  * ```js
3095
3129
  * disabledActions: [Action.ConfigureFilter]
@@ -3187,14 +3221,17 @@ var Action;
3187
3221
  * @hidden
3188
3222
  */
3189
3223
  Action["SpotIQFollow"] = "spotIQFollow";
3224
+ /**
3225
+ * The Share action for a Liveboard visualization.
3226
+ */
3190
3227
  Action["ShareViz"] = "shareViz";
3191
3228
  /**
3192
3229
  * @hidden
3193
3230
  */
3194
3231
  Action["ReplaySearch"] = "replaySearch";
3195
3232
  /**
3196
- * The **Show underlying data** menu action on a visualization or
3197
- * Answer page.
3233
+ * The **Show underlying data** menu action on a
3234
+ * visualization or Answer page.
3198
3235
  * Displays detailed information and raw data
3199
3236
  * for a given visualization.
3200
3237
  * @example
@@ -3204,8 +3241,8 @@ var Action;
3204
3241
  */
3205
3242
  Action["ShowUnderlyingData"] = "showUnderlyingData";
3206
3243
  /**
3207
- * The **Download** menu action on Liveboard visualizations
3208
- * and Answers.
3244
+ * The **Download** menu action on Liveboard
3245
+ * visualizations and Answers.
3209
3246
  * Allows downloading a visualization or Answer.
3210
3247
  * @example
3211
3248
  * ```js
@@ -3226,11 +3263,10 @@ var Action;
3226
3263
  /**
3227
3264
  *
3228
3265
  *The **Download PDF** action that downloads a Liveboard,
3229
- *visualization, or Answer as a PDF file.
3230
- *
3266
+ * visualization, or Answer as a PDF file.
3231
3267
  *
3232
- ***NOTE**: The **Download** > **PDF** action is available on
3233
- *visualizations and Answers if the data is in tabular format.
3268
+ * **NOTE**: The **Download** > **PDF** option is available for
3269
+ * tables in visualizations and Answers.
3234
3270
  * @example
3235
3271
  * ```js
3236
3272
  * disabledActions: [Action.DownloadAsPdf]
@@ -3262,9 +3298,11 @@ var Action;
3262
3298
  */
3263
3299
  Action["DownloadTrace"] = "downloadTrace";
3264
3300
  /**
3265
- * The **Export TML** menu action on Liveboard, Answers
3266
- * Worksheets and Data Connections page.
3267
- * Exports an object as a TML file.
3301
+ * The **Export TML** menu action on a Liveboard, Answer, and
3302
+ * the Data Workspace pages for data objects and connections.
3303
+ *
3304
+ * Allows exporting an object as a TML file.
3305
+ *
3268
3306
  * @example
3269
3307
  * ```js
3270
3308
  * disabledActions: [Action.ExportTML]
@@ -3272,7 +3310,8 @@ var Action;
3272
3310
  */
3273
3311
  Action["ExportTML"] = "exportTSL";
3274
3312
  /**
3275
- * The **Import TML** menu action for Liveboards and Answers.
3313
+ * The **Import TML** menu action on the
3314
+ * *Data Workspace* > *Utilities* page.
3276
3315
  * Imports TML representation of ThoughtSpot objects.
3277
3316
  * @example
3278
3317
  * ```js
@@ -3282,7 +3321,7 @@ var Action;
3282
3321
  Action["ImportTML"] = "importTSL";
3283
3322
  /**
3284
3323
  * The **Update TML** menu action for Liveboards and Answers.
3285
- * Update TML representation of ThoughtSpot objects.
3324
+ * Updates TML representation of ThoughtSpot objects.
3286
3325
  * @example
3287
3326
  * ```js
3288
3327
  * disabledActions: [Action.UpdateTML]
@@ -3309,8 +3348,11 @@ var Action;
3309
3348
  */
3310
3349
  Action["Present"] = "present";
3311
3350
  /**
3312
- * The tile resize options in the visualization menu.
3313
- * Allows switching between different preset layouts.
3351
+ * The visualization tile resize option.
3352
+ * Also available via More `...` options menu on a visualization.
3353
+ * Allows resizing visualization tiles and switching
3354
+ * between different preset layout option.
3355
+ *
3314
3356
  * @example
3315
3357
  * ```js
3316
3358
  * disabledActions: [Action.ToggleSize]
@@ -3336,8 +3378,9 @@ var Action;
3336
3378
  */
3337
3379
  Action["EditTitle"] = "editTitle";
3338
3380
  /**
3339
- * The **Delete** menu action on Liveboards and visualizations.
3340
- * Deletes a Liveboard or a visualization from a Liveboard.
3381
+ * The **Delete** action on a Liveboard, *Liveboards* and
3382
+ * *Answers* list pages in full application embedding.
3383
+ *
3341
3384
  * @example
3342
3385
  * ```js
3343
3386
  * disabledActions: [Action.Remove]
@@ -3414,8 +3457,9 @@ var Action;
3414
3457
  */
3415
3458
  Action["Explore"] = "explore";
3416
3459
  /**
3417
- * The action to include data points on a drilled-down Answer
3418
- * or visualization
3460
+ * The contextual menu action to include a specific data point
3461
+ * when drilling down a table or chart on an Answer.
3462
+ *
3419
3463
  * @example
3420
3464
  * ```js
3421
3465
  * disabledActions: [Action.DrillInclude]
@@ -3423,8 +3467,8 @@ var Action;
3423
3467
  */
3424
3468
  Action["DrillInclude"] = "context-menu-item-include";
3425
3469
  /**
3426
- * The action to exclude data points on a drilled-down Answer
3427
- * or visualization
3470
+ * The contextual menu action to exclude a specific data point
3471
+ * when drilling down a table or chart on an Answer.
3428
3472
  * @example
3429
3473
  * ```js
3430
3474
  * disabledActions: [Action.DrillInclude]
@@ -3571,7 +3615,7 @@ var Action;
3571
3615
  * Allows users to manage data sync pipelines to third-party apps.
3572
3616
  * @example
3573
3617
  * ```js
3574
- * disabledActions: [Action.SyncToOtherApps]
3618
+ * disabledActions: [Action.ManagePipelines]
3575
3619
  * ```
3576
3620
  * @version SDK: 1.18.0| ThoughtSpot: 8.10.0.cl, 9.0.1.sw
3577
3621
  */
@@ -3890,7 +3934,7 @@ var Action;
3890
3934
  /**
3891
3935
  * Action ID for the Parent TML action
3892
3936
  * The parent action **TML** must be included to access TML-related options
3893
- * within the cascading menu (specific to the answer page)
3937
+ * within the cascading menu (specific to the Answer page)
3894
3938
  * @example
3895
3939
  * ```js
3896
3940
  * // to include specific TML actions
@@ -3929,8 +3973,10 @@ var Action;
3929
3973
  */
3930
3974
  Action["VerifiedLiveboard"] = "verifiedLiveboard";
3931
3975
  /**
3932
- * The *Ask Sage* action for Answers and visualizations.
3933
- * Allows initiating a Natural Language Search query.
3976
+ * Action ID for the *Ask Sage* In Natural Language Search embed,
3977
+ * *Spotter* in Liveboard, full app, and Spotter embed.
3978
+ *
3979
+ * Allows initiating a conversation with ThoughtSpot AI analyst.
3934
3980
  *
3935
3981
  * @example
3936
3982
  * ```js
@@ -4126,7 +4172,8 @@ var Action;
4126
4172
  */
4127
4173
  Action["DeletePreviousPrompt"] = "deletePreviousPrompt";
4128
4174
  /**
4129
- * Action ID for hide/disable edit of tokens on spotter results.
4175
+ * Action ID for hide or disable editing tokens generated from
4176
+ * Spotter results.
4130
4177
  * @example
4131
4178
  * ```js
4132
4179
  * hiddenAction: [Action.EditTokens]
@@ -6520,6 +6567,9 @@ const logFunctions = {
6520
6567
  [LogLevel.TRACE]: console.trace,
6521
6568
  };
6522
6569
  let globalLogLevelOverride = LogLevel.TRACE;
6570
+ const setGlobalLogLevelOverride = (logLevel) => {
6571
+ globalLogLevelOverride = logLevel;
6572
+ };
6523
6573
  const logLevelToNumber = {
6524
6574
  [LogLevel.SILENT]: 0,
6525
6575
  [LogLevel.ERROR]: 1,
@@ -6596,6 +6646,7 @@ const ERROR_MESSAGE = {
6596
6646
  CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
6597
6647
  CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
6598
6648
  MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
6649
+ RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
6599
6650
  };
6600
6651
 
6601
6652
  const EndPoints = {
@@ -6712,13 +6763,18 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
6712
6763
  });
6713
6764
  }
6714
6765
 
6715
- let cachedAuthToken = null;
6766
+ const cacheAuthTokenKey = 'cachedAuthToken';
6767
+ const getCacheAuthToken = () => getValueFromWindow(cacheAuthTokenKey);
6768
+ const storeAuthTokenInCache = (token) => {
6769
+ storeValueInWindow(cacheAuthTokenKey, token);
6770
+ };
6716
6771
  // This method can be used to get the authToken using the embedConfig
6717
6772
  /**
6718
6773
  *
6719
6774
  * @param embedConfig
6720
6775
  */
6721
6776
  async function getAuthenticationToken(embedConfig) {
6777
+ const cachedAuthToken = getCacheAuthToken();
6722
6778
  // Since we don't have token validation enabled , we cannot tell if the
6723
6779
  // cached token is valid or not. So we will always fetch a new token.
6724
6780
  if (cachedAuthToken && !embedConfig.disableTokenVerification) {
@@ -6749,10 +6805,11 @@ async function getAuthenticationToken(embedConfig) {
6749
6805
  logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e.message}`);
6750
6806
  throw e;
6751
6807
  }
6752
- cachedAuthToken = authToken;
6808
+ storeAuthTokenInCache(authToken);
6753
6809
  return authToken;
6754
6810
  }
6755
6811
  const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
6812
+ const cachedAuthToken = getCacheAuthToken();
6756
6813
  if (embedConfig.disableTokenVerification) {
6757
6814
  logger$3.info('Token verification is disabled. Assuming token is valid.');
6758
6815
  return true;
@@ -6786,17 +6843,28 @@ const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
6786
6843
  * @group Authentication / Init
6787
6844
  */
6788
6845
  const resetCachedAuthToken = () => {
6789
- cachedAuthToken = null;
6846
+ storeAuthTokenInCache(null);
6790
6847
  };
6791
6848
 
6792
- let config = {};
6849
+ const configKey = 'embedConfig';
6793
6850
  /**
6794
6851
  * Gets the configuration embed was initialized with.
6795
6852
  * @returns {@link EmbedConfig} The configuration embed was initialized with.
6796
6853
  * @version SDK: 1.19.0 | ThoughtSpot: *
6797
6854
  * @group Global methods
6798
6855
  */
6799
- const getEmbedConfig = () => config;
6856
+ const getEmbedConfig = () => getValueFromWindow(configKey) || {};
6857
+ /**
6858
+ * Sets the configuration embed was initialized with.
6859
+ * And returns the new configuration.
6860
+ * @param newConfig The configuration to set.
6861
+ * @version SDK: 1.27.0 | ThoughtSpot: *
6862
+ * @group Global methods
6863
+ */
6864
+ const setEmbedConfig = (newConfig) => {
6865
+ storeValueInWindow(configKey, newConfig);
6866
+ return getValueFromWindow(configKey);
6867
+ };
6800
6868
 
6801
6869
  /**
6802
6870
  * Fetch wrapper that adds the authentication token to the request.
@@ -7403,7 +7471,7 @@ class AnswerService {
7403
7471
  async getTML() {
7404
7472
  const { object } = await this.executeQuery(getAnswerTML, {});
7405
7473
  const edoc = object[0].edoc;
7406
- const YAML = await import('./index-DpuhnTj2.js');
7474
+ const YAML = await import('./index-NZYq1Tu3.js');
7407
7475
  const parsedDoc = YAML.parse(edoc);
7408
7476
  return {
7409
7477
  answer: {
@@ -13784,7 +13852,7 @@ function initMixpanel(sessionInfo) {
13784
13852
  }
13785
13853
  }
13786
13854
 
13787
- createCommonjsModule(function (module) {
13855
+ var eventemitter3 = createCommonjsModule(function (module) {
13788
13856
 
13789
13857
  var has = Object.prototype.hasOwnProperty
13790
13858
  , prefix = '~';
@@ -14127,7 +14195,52 @@ var ReportType;
14127
14195
  ReportType["CSP_VIOLATION"] = "csp-violation";
14128
14196
  ReportType["DEPRECATION"] = "deprecation";
14129
14197
  ReportType["INTERVENTION"] = "intervention";
14130
- })(ReportType || (ReportType = {}));
14198
+ })(ReportType || (ReportType = {}));
14199
+ let globalObserver = null;
14200
+ /**
14201
+ * Register a global ReportingObserver to capture all unhandled errors
14202
+ * @param overrideExisting boolean to override existing observer
14203
+ * @returns ReportingObserver | null
14204
+ */
14205
+ function registerReportingObserver(overrideExisting = false) {
14206
+ if (!(window.ReportingObserver)) {
14207
+ logger$3.warn(ERROR_MESSAGE.MISSING_REPORTING_OBSERVER);
14208
+ return null;
14209
+ }
14210
+ if (overrideExisting) {
14211
+ resetGlobalReportingObserver();
14212
+ }
14213
+ if (globalObserver) {
14214
+ return globalObserver;
14215
+ }
14216
+ const embedConfig = getEmbedConfig();
14217
+ globalObserver = new ReportingObserver((reports) => {
14218
+ reports.forEach((report) => {
14219
+ const { type, url, body } = report;
14220
+ const reportBody = body;
14221
+ const isThoughtSpotHost = url
14222
+ && url.startsWith(embedConfig.thoughtSpotHost);
14223
+ const isFrameHostError = type === ReportType.CSP_VIOLATION
14224
+ && reportBody.effectiveDirective === 'frame-ancestors';
14225
+ if (isThoughtSpotHost && isFrameHostError) {
14226
+ if (!embedConfig.suppressErrorAlerts) {
14227
+ alert(ERROR_MESSAGE.CSP_VIOLATION_ALERT);
14228
+ }
14229
+ logger$3.error(ERROR_MESSAGE.CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE);
14230
+ }
14231
+ });
14232
+ }, { buffered: true });
14233
+ globalObserver.observe();
14234
+ return globalObserver;
14235
+ }
14236
+ /**
14237
+ * Resets the global ReportingObserver
14238
+ */
14239
+ function resetGlobalReportingObserver() {
14240
+ if (globalObserver)
14241
+ globalObserver.disconnect();
14242
+ globalObserver = null;
14243
+ }
14131
14244
 
14132
14245
  /**
14133
14246
  *
@@ -14309,7 +14422,45 @@ const getSessionDetails = (sessionInfoResp) => {
14309
14422
  clusterName: sessionInfoResp.configInfo.selfClusterName,
14310
14423
  ...sessionInfoResp,
14311
14424
  };
14312
- };
14425
+ };
14426
+ /**
14427
+ * Resets the cached session info object and forces a new fetch on the next call.
14428
+ * @example ```js
14429
+ * resetCachedSessionInfo();
14430
+ * const sessionInfo = await getSessionInfo();
14431
+ * console.log(sessionInfo);
14432
+ * ```
14433
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14434
+ * @returns {void}
14435
+ */
14436
+ function resetCachedSessionInfo() {
14437
+ sessionInfo = null;
14438
+ }
14439
+ /**
14440
+ * Resets the cached preauth info object and forces a new fetch on the next call.
14441
+ * @example ```js
14442
+ * resetCachedPreauthInfo();
14443
+ * const preauthInfo = await getPreauthInfo();
14444
+ * console.log(preauthInfo);
14445
+ * ```
14446
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14447
+ * @returns {void}
14448
+ */
14449
+ function resetCachedPreauthInfo() {
14450
+ preauthInfo = null;
14451
+ }
14452
+
14453
+ /**
14454
+ * This function resets all the services that are cached in the SDK.
14455
+ * This is to be called when the user logs out of the application and also
14456
+ * when init is called again.
14457
+ * @version SDK: 1.30.2 | ThoughtSpot: *
14458
+ */
14459
+ function resetAllCachedServices() {
14460
+ resetCachedAuthToken();
14461
+ resetCachedSessionInfo();
14462
+ resetCachedPreauthInfo();
14463
+ }
14313
14464
 
14314
14465
  // eslint-disable-next-line import/no-mutable-exports
14315
14466
  let loggedInStatus = false;
@@ -14379,42 +14530,61 @@ var AuthEvent;
14379
14530
  */
14380
14531
  AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
14381
14532
  })(AuthEvent || (AuthEvent = {}));
14533
+ let authEE;
14534
+ /**
14535
+ *
14536
+ * @param eventEmitter
14537
+ */
14538
+ function setAuthEE(eventEmitter) {
14539
+ authEE = eventEmitter;
14540
+ }
14382
14541
  /**
14383
14542
  *
14384
14543
  */
14385
14544
  function notifyAuthSDKSuccess() {
14386
- {
14545
+ if (!authEE) {
14387
14546
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14388
14547
  return;
14389
14548
  }
14549
+ authEE.emit(AuthStatus.SDK_SUCCESS);
14390
14550
  }
14391
14551
  /**
14392
14552
  *
14393
14553
  */
14394
14554
  async function notifyAuthSuccess() {
14395
- {
14555
+ if (!authEE) {
14396
14556
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14397
14557
  return;
14398
14558
  }
14559
+ try {
14560
+ getPreauthInfo();
14561
+ const sessionInfo = await getSessionInfo();
14562
+ authEE.emit(AuthStatus.SUCCESS, sessionInfo);
14563
+ }
14564
+ catch (e) {
14565
+ logger$3.error(ERROR_MESSAGE.SESSION_INFO_FAILED);
14566
+ }
14399
14567
  }
14400
14568
  /**
14401
14569
  *
14402
14570
  * @param failureType
14403
14571
  */
14404
14572
  function notifyAuthFailure(failureType) {
14405
- {
14573
+ if (!authEE) {
14406
14574
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14407
14575
  return;
14408
14576
  }
14577
+ authEE.emit(AuthStatus.FAILURE, failureType);
14409
14578
  }
14410
14579
  /**
14411
14580
  *
14412
14581
  */
14413
14582
  function notifyLogout() {
14414
- {
14583
+ if (!authEE) {
14415
14584
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14416
14585
  return;
14417
14586
  }
14587
+ authEE.emit(AuthStatus.LOGOUT);
14418
14588
  }
14419
14589
  /**
14420
14590
  * Check if we are logged into the ThoughtSpot cluster
@@ -14575,6 +14745,7 @@ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
14575
14745
  samlAuthWindow.focus();
14576
14746
  }
14577
14747
  };
14748
+ authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
14578
14749
  const containerEl = getDOMNode(triggerContainer);
14579
14750
  if (containerEl) {
14580
14751
  containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
@@ -14590,6 +14761,7 @@ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
14590
14761
  }
14591
14762
  });
14592
14763
  });
14764
+ authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
14593
14765
  return samlCompletionPromise;
14594
14766
  }
14595
14767
  /**
@@ -14673,6 +14845,18 @@ const authenticate = async (embedConfig) => {
14673
14845
  }
14674
14846
  };
14675
14847
 
14848
+ if (typeof Promise.withResolvers === 'undefined') {
14849
+ Promise.withResolvers = () => {
14850
+ let resolve;
14851
+ let reject;
14852
+ const promise = new Promise((res, rej) => {
14853
+ resolve = res;
14854
+ reject = rej;
14855
+ });
14856
+ return { promise, resolve, reject };
14857
+ };
14858
+ }
14859
+
14676
14860
  /* eslint-disable camelcase */
14677
14861
  /* eslint-disable import/no-mutable-exports */
14678
14862
  /**
@@ -14682,12 +14866,12 @@ const authenticate = async (embedConfig) => {
14682
14866
  * @summary Base classes
14683
14867
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
14684
14868
  */
14685
- ({
14869
+ const CONFIG_DEFAULTS = {
14686
14870
  loginFailedMessage: 'Not logged in',
14687
14871
  authTriggerText: 'Authorize',
14688
14872
  authType: AuthType.None,
14689
14873
  logLevel: LogLevel.ERROR,
14690
- });
14874
+ };
14691
14875
  let authPromise;
14692
14876
  const getAuthPromise = () => authPromise;
14693
14877
  /**
@@ -14709,12 +14893,146 @@ const handleAuth = () => {
14709
14893
  });
14710
14894
  return authPromise;
14711
14895
  };
14712
- ({
14896
+ const hostUrlToFeatureUrl = {
14713
14897
  [PrefetchFeatures.SearchEmbed]: (url, flags) => `${url}v2/?${flags}#/embed/answer`,
14714
14898
  [PrefetchFeatures.LiveboardEmbed]: (url, flags) => `${url}?${flags}`,
14715
14899
  [PrefetchFeatures.FullApp]: (url, flags) => `${url}?${flags}`,
14716
14900
  [PrefetchFeatures.VizEmbed]: (url, flags) => `${url}?${flags}`,
14717
- });
14901
+ };
14902
+ /**
14903
+ * Prefetches static resources from the specified URL. Web browsers can then cache the
14904
+ * prefetched resources and serve them from the user's local disk to provide faster access
14905
+ * to your app.
14906
+ * @param url The URL provided for prefetch
14907
+ * @param prefetchFeatures Specify features which needs to be prefetched.
14908
+ * @param additionalFlags This can be used to add any URL flag.
14909
+ * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
14910
+ * @group Global methods
14911
+ */
14912
+ const prefetch = (url, prefetchFeatures, additionalFlags) => {
14913
+ var _a;
14914
+ if (url === '') {
14915
+ // eslint-disable-next-line no-console
14916
+ logger$3.warn('The prefetch method does not have a valid URL');
14917
+ }
14918
+ else {
14919
+ const features = [PrefetchFeatures.FullApp];
14920
+ let hostUrl = url || getEmbedConfig().thoughtSpotHost;
14921
+ const prefetchFlags = {
14922
+ [Param.EmbedApp]: true,
14923
+ ...(_a = getEmbedConfig()) === null || _a === void 0 ? void 0 : _a.additionalFlags,
14924
+ ...additionalFlags,
14925
+ };
14926
+ hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
14927
+ Array.from(new Set(features
14928
+ .map((feature) => hostUrlToFeatureUrl[feature](hostUrl, getQueryParamString(prefetchFlags)))))
14929
+ .forEach((prefetchUrl, index) => {
14930
+ const iFrame = document.createElement('iframe');
14931
+ iFrame.src = prefetchUrl;
14932
+ iFrame.style.width = '0';
14933
+ iFrame.style.height = '0';
14934
+ iFrame.style.border = '0';
14935
+ iFrame.classList.add('prefetchIframe');
14936
+ iFrame.classList.add(`prefetchIframeNum-${index}`);
14937
+ document.body.appendChild(iFrame);
14938
+ });
14939
+ }
14940
+ };
14941
+ /**
14942
+ *
14943
+ * @param embedConfig
14944
+ */
14945
+ function sanity(embedConfig) {
14946
+ if (embedConfig.thoughtSpotHost === undefined) {
14947
+ throw new Error('ThoughtSpot host not provided');
14948
+ }
14949
+ if (embedConfig.authType === AuthType.TrustedAuthToken) {
14950
+ if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
14951
+ throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
14952
+ }
14953
+ }
14954
+ }
14955
+ /**
14956
+ *
14957
+ * @param embedConfig
14958
+ */
14959
+ function backwardCompat(embedConfig) {
14960
+ const newConfig = { ...embedConfig };
14961
+ if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
14962
+ newConfig.inPopup = embedConfig.noRedirect;
14963
+ }
14964
+ return newConfig;
14965
+ }
14966
+ const initFlagKey = 'initFlagKey';
14967
+ const createAndSetInitPromise = () => {
14968
+ const { promise: initPromise, resolve: initPromiseResolve,
14969
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14970
+ // @ts-ignore
14971
+ } = Promise.withResolvers();
14972
+ const initFlagStore = {
14973
+ initPromise,
14974
+ isInitCalled: false,
14975
+ initPromiseResolve,
14976
+ };
14977
+ storeValueInWindow(initFlagKey, initFlagStore, {
14978
+ // In case of diff imports the promise might be already set
14979
+ ignoreIfAlreadyExists: true,
14980
+ });
14981
+ };
14982
+ createAndSetInitPromise();
14983
+ const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
14984
+ const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
14985
+ /**
14986
+ * Initializes the Visual Embed SDK globally and perform
14987
+ * authentication if applicable. This function needs to be called before any ThoughtSpot
14988
+ * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
14989
+ * to actually embed. That is handled internally.
14990
+ * @param embedConfig The configuration object containing ThoughtSpot host,
14991
+ * authentication mechanism and so on.
14992
+ * @example
14993
+ * ```js
14994
+ * const authStatus = init({
14995
+ * thoughtSpotHost: 'https://my.thoughtspot.cloud',
14996
+ * authType: AuthType.None,
14997
+ * });
14998
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
14999
+ * ```
15000
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
15001
+ * failure and logout. See {@link AuthStatus}
15002
+ * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
15003
+ * @group Authentication / Init
15004
+ */
15005
+ const init = (embedConfig) => {
15006
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15007
+ sanity(embedConfig);
15008
+ resetAllCachedServices();
15009
+ embedConfig = setEmbedConfig(backwardCompat({
15010
+ ...CONFIG_DEFAULTS,
15011
+ ...embedConfig,
15012
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
15013
+ }));
15014
+ setGlobalLogLevelOverride(embedConfig.logLevel);
15015
+ registerReportingObserver();
15016
+ const authEE = new eventemitter3();
15017
+ setAuthEE(authEE);
15018
+ handleAuth();
15019
+ const { password, ...configToTrack } = getEmbedConfig();
15020
+ uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
15021
+ ...configToTrack,
15022
+ usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
15023
+ usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
15024
+ usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
15025
+ usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
15026
+ usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
15027
+ });
15028
+ if (getEmbedConfig().callPrefetch) {
15029
+ prefetch(getEmbedConfig().thoughtSpotHost);
15030
+ }
15031
+ // Resolves the promise created in the initPromiseKey
15032
+ getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
15033
+ getValueFromWindow(initFlagKey).isInitCalled = true;
15034
+ return authEE;
15035
+ };
14718
15036
  /**
14719
15037
  *
14720
15038
  */
@@ -14843,7 +15161,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
14843
15161
  return e;
14844
15162
  }
14845
15163
 
14846
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","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","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",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",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",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.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/lodash":"^4.17.0","@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",crypto:"^1.0.1","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","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"6.3.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:"4.24.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",vite:"^5.3.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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 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};
15164
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.4";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","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",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",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",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.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/lodash":"^4.17.0","@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",crypto:"^1.0.1","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","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"6.3.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:"4.24.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",vite:"^5.3.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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 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};
14847
15165
 
14848
15166
  /**
14849
15167
  * Reloads the ThoughtSpot iframe.
@@ -15152,13 +15470,6 @@ class TsEmbed {
15152
15470
  }
15153
15471
  };
15154
15472
  this.el = getDOMNode(domSelector);
15155
- // TODO: handle error
15156
- this.embedConfig = getEmbedConfig();
15157
- if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
15158
- this.embedConfig.authTriggerContainer = domSelector;
15159
- }
15160
- this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
15161
- this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
15162
15473
  this.eventHandlerMap = new Map();
15163
15474
  this.isError = false;
15164
15475
  this.viewConfig = {
@@ -15166,12 +15477,21 @@ class TsEmbed {
15166
15477
  excludeRuntimeParametersfromURL: false,
15167
15478
  ...viewConfig,
15168
15479
  };
15169
- this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
15170
15480
  this.registerAppInit();
15171
15481
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
15172
15482
  ...viewConfig,
15173
15483
  });
15174
15484
  this.hostEventClient = new HostEventClient(this.iFrame);
15485
+ this.isReadyForRenderPromise = getInitPromise().then(async () => {
15486
+ const embedConfig = getEmbedConfig();
15487
+ this.embedConfig = embedConfig;
15488
+ if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
15489
+ this.embedConfig.authTriggerContainer = domSelector;
15490
+ }
15491
+ this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
15492
+ this.thoughtSpotV2Base = getV2BasePath(embedConfig);
15493
+ this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
15494
+ });
15175
15495
  }
15176
15496
  /**
15177
15497
  * Throws error encountered during initialization.
@@ -15889,6 +16209,10 @@ class TsEmbed {
15889
16209
  * @param args
15890
16210
  */
15891
16211
  async render() {
16212
+ if (!getIsInitCalled()) {
16213
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16214
+ }
16215
+ await this.isReadyForRenderPromise;
15892
16216
  this.isRendered = true;
15893
16217
  return this;
15894
16218
  }
@@ -15896,21 +16220,20 @@ class TsEmbed {
15896
16220
  return '';
15897
16221
  }
15898
16222
  handleRenderForPrerender() {
15899
- this.render();
16223
+ return this.render();
15900
16224
  }
15901
16225
  /**
15902
16226
  * Creates the preRender shell
15903
16227
  * @param showPreRenderByDefault - Show the preRender after render, hidden by default
15904
16228
  */
15905
- preRender(showPreRenderByDefault = false) {
16229
+ async preRender(showPreRenderByDefault = false) {
15906
16230
  if (!this.viewConfig.preRenderId) {
15907
16231
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
15908
16232
  return this;
15909
16233
  }
15910
16234
  this.isPreRendered = true;
15911
16235
  this.showPreRenderByDefault = showPreRenderByDefault;
15912
- this.handleRenderForPrerender();
15913
- return this;
16236
+ return this.handleRenderForPrerender();
15914
16237
  }
15915
16238
  /**
15916
16239
  * Get the Post Url Params for THOUGHTSPOT from the current
@@ -15963,6 +16286,10 @@ class TsEmbed {
15963
16286
  * @returns
15964
16287
  */
15965
16288
  async prerenderGeneric() {
16289
+ if (!getIsInitCalled()) {
16290
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16291
+ }
16292
+ await this.isReadyForRenderPromise;
15966
16293
  const prerenderFrameSrc = this.getRootIframeSrc();
15967
16294
  this.isRendered = true;
15968
16295
  return this.renderIFrame(prerenderFrameSrc);
@@ -15976,17 +16303,16 @@ class TsEmbed {
15976
16303
  * Also, synchronizes the style of the PreRender component with the embedding
15977
16304
  * element.
15978
16305
  */
15979
- showPreRender() {
16306
+ async showPreRender() {
15980
16307
  if (!this.viewConfig.preRenderId) {
15981
16308
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
15982
- return;
16309
+ return this;
15983
16310
  }
15984
16311
  if (!this.isPreRenderAvailable()) {
15985
16312
  const isAvailable = this.connectPreRendered();
15986
16313
  if (!isAvailable) {
15987
16314
  // if the Embed component is not preRendered , Render it now and
15988
- this.preRender(true);
15989
- return;
16315
+ return this.preRender(true);
15990
16316
  }
15991
16317
  this.validatePreRenderViewConfig(this.viewConfig);
15992
16318
  }
@@ -16009,6 +16335,7 @@ class TsEmbed {
16009
16335
  this.beforePrerenderVisible();
16010
16336
  removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
16011
16337
  this.subscribeToEvents();
16338
+ return this;
16012
16339
  }
16013
16340
  /**
16014
16341
  * Synchronizes the style properties of the PreRender component with the embedding
@@ -16194,7 +16521,7 @@ let SearchBarEmbed$1 = class SearchBarEmbed extends TsEmbed {
16194
16521
  * Render the embedded ThoughtSpot search
16195
16522
  */
16196
16523
  async render() {
16197
- super.render();
16524
+ await super.render();
16198
16525
  const src = this.getIFrameSrc();
16199
16526
  await this.renderIFrame(src);
16200
16527
  return this;
@@ -16281,7 +16608,7 @@ let SageEmbed$1 = class SageEmbed extends V1Embed {
16281
16608
  * @returns {SageEmbed} Eureka/Sage embed
16282
16609
  */
16283
16610
  async render() {
16284
- super.render();
16611
+ await super.render();
16285
16612
  const src = this.getIFrameSrc();
16286
16613
  await this.renderV1Embed(src);
16287
16614
  return this;
@@ -16453,7 +16780,7 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
16453
16780
  * Render the embedded ThoughtSpot search
16454
16781
  */
16455
16782
  async render() {
16456
- super.render();
16783
+ await super.render();
16457
16784
  this.viewConfig;
16458
16785
  const src = this.getIFrameSrc();
16459
16786
  await this.renderIFrame(src);
@@ -16596,7 +16923,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
16596
16923
  getEmbedParams() {
16597
16924
  const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
16598
16925
  /* eslint-disable-next-line max-len */
16599
- dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, } = this.viewConfig;
16926
+ dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, } = this.viewConfig;
16600
16927
  let params = {};
16601
16928
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
16602
16929
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -16641,6 +16968,9 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
16641
16968
  if (homePageSearchBarMode) {
16642
16969
  params[Param.HomePageSearchBarMode] = homePageSearchBarMode;
16643
16970
  }
16971
+ if (enablePendoHelp !== undefined) {
16972
+ params[Param.EnablePendoHelp] = enablePendoHelp;
16973
+ }
16644
16974
  params[Param.DataPanelV2Enabled] = dataPanelV2;
16645
16975
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
16646
16976
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
@@ -16749,7 +17079,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
16749
17079
  * to be embedded.
16750
17080
  */
16751
17081
  async render() {
16752
- super.render();
17082
+ await super.render();
16753
17083
  const src = this.getIFrameSrc();
16754
17084
  await this.renderV1Embed(src);
16755
17085
  return this;
@@ -17028,12 +17358,11 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
17028
17358
  this.navigateToLiveboard(libId);
17029
17359
  }
17030
17360
  }
17031
- handleRenderForPrerender() {
17361
+ async handleRenderForPrerender() {
17032
17362
  if (isUndefined$1(this.viewConfig.liveboardId)) {
17033
- this.prerenderGeneric();
17034
- return;
17363
+ return this.prerenderGeneric();
17035
17364
  }
17036
- super.handleRenderForPrerender();
17365
+ return super.handleRenderForPrerender();
17037
17366
  }
17038
17367
  /**
17039
17368
  * Triggers an event to the embedded app
@@ -17058,7 +17387,7 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
17058
17387
  * visualization ID and the runtime filters.
17059
17388
  */
17060
17389
  async render() {
17061
- super.render();
17390
+ await super.render();
17062
17391
  const src = this.getIFrameSrc();
17063
17392
  await this.renderV1Embed(src);
17064
17393
  this.showPreviewLoader();
@@ -17195,7 +17524,7 @@ let ConversationEmbed$1 = class ConversationEmbed extends TsEmbed {
17195
17524
  return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
17196
17525
  }
17197
17526
  async render() {
17198
- super.render();
17527
+ await super.render();
17199
17528
  const src = this.getIframeSrc();
17200
17529
  await this.renderIFrame(src);
17201
17530
  return this;
@@ -17464,6 +17793,27 @@ const PreRenderedConversationEmbed = componentFactory(ConversationEmbed$1, true)
17464
17793
  */
17465
17794
  function useEmbedRef() {
17466
17795
  return React__default.useRef(null);
17796
+ }
17797
+ /**
17798
+ *
17799
+ * @param config - EmbedConfig
17800
+ * @returns AuthEventEmitter
17801
+ * @example
17802
+ * ```
17803
+ * function Component() {
17804
+ * const authEE = useInit({ ...initConfig });
17805
+ * return <LiveboardEmbed ref={ref} liveboardId={<id>} />
17806
+ * }
17807
+ * ```
17808
+ * @version SDK: 1.36.2 | ThoughtSpot: *
17809
+ */
17810
+ function useInit(config) {
17811
+ const ref = useRef(null);
17812
+ useDeepCompareEffect(() => {
17813
+ const authEE = init(config);
17814
+ ref.current = authEE;
17815
+ }, [config]);
17816
+ return ref;
17467
17817
  }
17468
17818
 
17469
- export { Action, AppEmbed, ConversationEmbed, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, getSessionInfo, useEmbedRef };
17819
+ export { Action, AppEmbed, ConversationEmbed, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, getSessionInfo, useEmbedRef, useInit };