@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,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.36.2 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.36.4 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -477,7 +477,35 @@
477
477
  return ['boolean', 'boolean'];
478
478
  }
479
479
  return ['', ''];
480
- };
480
+ };
481
+ const sdkWindowKey = '_tsEmbedSDK';
482
+ /**
483
+ * Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
484
+ * @param key - The key under which the value will be stored.
485
+ * @param value - The value to store.
486
+ * @param options - Additional options.
487
+ * @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
488
+ *
489
+ * @returns The stored value.
490
+ *
491
+ * @version SDK: 1.36.2 | ThoughtSpot: *
492
+ */
493
+ function storeValueInWindow(key, value, options = {}) {
494
+ if (!window[sdkWindowKey]) {
495
+ window[sdkWindowKey] = {};
496
+ }
497
+ if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
498
+ return window[sdkWindowKey][key];
499
+ }
500
+ window[sdkWindowKey][key] = value;
501
+ return value;
502
+ }
503
+ /**
504
+ * Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
505
+ * @param key - The key whose value needs to be retrieved.
506
+ * @returns The stored value or `undefined` if the key is not found.
507
+ */
508
+ const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
481
509
 
482
510
  /**
483
511
  * Copyright (c) 2023
@@ -868,8 +896,8 @@
868
896
  */
869
897
  EmbedEvent["Load"] = "load";
870
898
  /**
871
- * Data pertaining to answer or Liveboard is received
872
- * @return data - The answer or Liveboard data
899
+ * Data pertaining to an Answer or Liveboard is received
900
+ * @return data - The Answer or Liveboard data
873
901
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
874
902
  * @example
875
903
  *```js
@@ -1043,7 +1071,7 @@
1043
1071
  */
1044
1072
  EmbedEvent["Alert"] = "alert";
1045
1073
  /**
1046
- * The ThoughtSpot auth session has expired.
1074
+ * The ThoughtSpot authentication session has expired.
1047
1075
  * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
1048
1076
  * @example
1049
1077
  *```js
@@ -1113,7 +1141,7 @@
1113
1141
  /**
1114
1142
  * Emitted when the embed does not have cookie access. This happens
1115
1143
  * when Safari and other Web browsers block third-party cookies
1116
- * are blocked by default. `NoCookieAccess` can trigger
1144
+ * are blocked by default. `NoCookieAccess` can trigger.
1117
1145
  * @example
1118
1146
  *```js
1119
1147
  * appEmbed.on(EmbedEvent.NoCookieAccess)
@@ -1201,7 +1229,7 @@
1201
1229
  */
1202
1230
  EmbedEvent["Save"] = "save";
1203
1231
  /**
1204
- * Emitted when the download action is triggered on an answer
1232
+ * Emitted when the download action is triggered on an Answer.
1205
1233
  *
1206
1234
  * **Note**: This event is deprecated in v1.21.0.
1207
1235
  * To fire an event when a download action is initiated on a chart or table,
@@ -1217,7 +1245,7 @@
1217
1245
  */
1218
1246
  EmbedEvent["Download"] = "download";
1219
1247
  /**
1220
- * Emitted when the download action is triggered on an answer
1248
+ * Emitted when the download action is triggered on an Answer.
1221
1249
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
1222
1250
  * @example
1223
1251
  *```js
@@ -1231,7 +1259,7 @@
1231
1259
  */
1232
1260
  EmbedEvent["DownloadAsPng"] = "downloadAsPng";
1233
1261
  /**
1234
- * Emitted when the Download as PDF action is triggered on an answer
1262
+ * Emitted when the Download as PDF action is triggered on an Answer
1235
1263
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1236
1264
  * @example
1237
1265
  *```js
@@ -1245,7 +1273,7 @@
1245
1273
  */
1246
1274
  EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
1247
1275
  /**
1248
- * Emitted when the Download as CSV action is triggered on an answer
1276
+ * Emitted when the Download as CSV action is triggered on an Answer.
1249
1277
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1250
1278
  * @example
1251
1279
  *```js
@@ -1259,7 +1287,7 @@
1259
1287
  */
1260
1288
  EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
1261
1289
  /**
1262
- * Emitted when the Download as XLSX action is triggered on an answer
1290
+ * Emitted when the Download as XLSX action is triggered on an Answer.
1263
1291
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1264
1292
  * @example
1265
1293
  *```js
@@ -1287,7 +1315,8 @@
1287
1315
  */
1288
1316
  EmbedEvent["AnswerDelete"] = "answerDelete";
1289
1317
  /**
1290
- * Emitted when an answer is pinned to a Liveboard
1318
+ * Emitted when a user initiates the Pin action to
1319
+ * add an Answer to a Liveboard.
1291
1320
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1292
1321
  * @example
1293
1322
  *```js
@@ -1425,7 +1454,7 @@
1425
1454
  */
1426
1455
  EmbedEvent["SaveAsView"] = "saveAsView";
1427
1456
  /**
1428
- * Emitted when the user creates a copy of an Answer
1457
+ * Emitted when the user creates a copy of an Answer.
1429
1458
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1430
1459
  * @example
1431
1460
  *```js
@@ -1439,7 +1468,7 @@
1439
1468
  */
1440
1469
  EmbedEvent["CopyAEdit"] = "copyAEdit";
1441
1470
  /**
1442
- * Emitted when a user clicks Show underlying data on an Answer
1471
+ * Emitted when a user clicks *Show underlying data* on an Answer.
1443
1472
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1444
1473
  * @example
1445
1474
  *```js
@@ -1450,7 +1479,7 @@
1450
1479
  */
1451
1480
  EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
1452
1481
  /**
1453
- * Emitted when an answer is switched to a chart or table view.
1482
+ * Emitted when an Answer is switched to a chart or table view.
1454
1483
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1455
1484
  * @example
1456
1485
  *```js
@@ -1584,11 +1613,12 @@
1584
1613
  */
1585
1614
  EmbedEvent["CopyLink"] = "embedDocument";
1586
1615
  /**
1587
- * Emitted when a user interacts with cross filters on a visualization or Liveboard
1616
+ * Emitted when a user interacts with cross filters on a
1617
+ * visualization or Liveboard.
1588
1618
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
1589
1619
  * @example
1590
1620
  *```js
1591
- * liveboardEmbed.trigger(HostEvent.CrossFilterChanged, {
1621
+ * liveboardEmbed.on(EmbedEvent.CrossFilterChanged, {
1592
1622
  * vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1593
1623
  *```
1594
1624
  */
@@ -1682,8 +1712,8 @@
1682
1712
  */
1683
1713
  EmbedEvent["DeletePersonalisedView"] = "deletePersonalisedView";
1684
1714
  /**
1685
- * Emitted when a user creates a new worksheet
1686
- * @version SDK : 1.27.0 | ThoughtSpot Cloud: 9.8.0.cl
1715
+ * Emitted when a user creates a Worksheet.
1716
+ * @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
1687
1717
  */
1688
1718
  EmbedEvent["CreateWorksheet"] = "createWorksheet";
1689
1719
  /**
@@ -1696,8 +1726,8 @@
1696
1726
  */
1697
1727
  EmbedEvent["AskSageInit"] = "AskSageInit";
1698
1728
  /**
1699
- * Emitted when a LB/viz is renamed
1700
- * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl
1729
+ * Emitted when a Liveboard or visualization is renamed.
1730
+ * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl, 10.1.0.sw
1701
1731
  */
1702
1732
  EmbedEvent["Rename"] = "rename";
1703
1733
  /**
@@ -1761,8 +1791,7 @@
1761
1791
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1762
1792
  /**
1763
1793
  * Emitted when parameter changes in an Answer
1764
- * or Liveboard
1765
- *
1794
+ * or Liveboard.
1766
1795
  * ```js
1767
1796
  * liveboardEmbed.on(EmbedEvent.ParameterChanged, (payload) => {
1768
1797
  * console.log('payload', payload);
@@ -1789,7 +1818,7 @@
1789
1818
  */
1790
1819
  EmbedEvent["TableVizRendered"] = "TableVizRendered";
1791
1820
  /**
1792
- * Emitted when the liveboard is created from pin modal or liveboard list page.
1821
+ * Emitted when the liveboard is created from pin modal or Liveboard list page.
1793
1822
  * You can use this event as a hook to trigger
1794
1823
  * other events on liveboard creation.
1795
1824
  *
@@ -1934,7 +1963,7 @@
1934
1963
  */
1935
1964
  HostEvent["Filter"] = "filter";
1936
1965
  /**
1937
- * Reload the answer or visualization
1966
+ * Reload the Answer or visualization
1938
1967
  * @hidden
1939
1968
  */
1940
1969
  HostEvent["Reload"] = "reload";
@@ -1984,12 +2013,10 @@
1984
2013
  * and `AppEmbed` only. In full application embedding, this event updates
1985
2014
  * the runtime filters applied on the Liveboard and saved Answer objects.
1986
2015
  *
1987
- *
1988
- * Pass an array of runtime filters with the following attributes:
1989
- *
2016
+ * @param - Pass an array of {@link RuntimeFilter} with the following attributes:
1990
2017
  * `columnName` - _String_. The name of the column to filter on.
1991
2018
  *
1992
- * `operator` - Runtime filter operator to apply. For more information,
2019
+ * `operator` - {@link RuntimeFilterOp} to apply. For more information,
1993
2020
  * see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
1994
2021
  *
1995
2022
  * `values` - List of operands. Some operators such as EQ and LE allow a
@@ -2001,7 +2028,7 @@
2001
2028
  * will be cleared, restoring the original visualization
2002
2029
  * with the updated filters.
2003
2030
  *
2004
- * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
2031
+
2005
2032
  * @example
2006
2033
  * ```js
2007
2034
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
@@ -2240,6 +2267,11 @@
2240
2267
  * appEmbed.trigger(HostEvent.Remove)
2241
2268
  * ```
2242
2269
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2270
+ * * @example
2271
+ * ```js
2272
+ * liveboardEmbed.trigger(HostEvent.Remove)
2273
+ * ```
2274
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl, 10.10.0.sw
2243
2275
  */
2244
2276
  HostEvent["Remove"] = "delete";
2245
2277
  /**
@@ -2650,7 +2682,7 @@
2650
2682
  * ```js
2651
2683
  * liveboardEmbed.trigger(HostEvent.GetTabs).then((tabDetails) => {
2652
2684
  * console.log(
2653
- * tabDetails // TabDetails of current LB
2685
+ * tabDetails // TabDetails of current Liveboard
2654
2686
  * );
2655
2687
  * })
2656
2688
  * ```
@@ -2698,7 +2730,7 @@
2698
2730
  */
2699
2731
  HostEvent["UpdateSageQuery"] = "updateSageQuery";
2700
2732
  /**
2701
- * Get the answer session for a Search or
2733
+ * Get the Answer session for a Search or
2702
2734
  * Liveboard visualization.
2703
2735
  * @example
2704
2736
  * ```js
@@ -2877,6 +2909,7 @@
2877
2909
  Param["HostAppUrl"] = "hostAppUrl";
2878
2910
  Param["EnableVizTransformations"] = "enableVizTransform";
2879
2911
  Param["EnableSearchAssist"] = "enableSearchAssist";
2912
+ Param["EnablePendoHelp"] = "enablePendoHelp";
2880
2913
  Param["HideResult"] = "hideResult";
2881
2914
  Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
2882
2915
  Param["Tag"] = "tag";
@@ -3109,9 +3142,10 @@
3109
3142
  */
3110
3143
  Action["AddDataPanelObjects"] = "addDataPanelObjects";
3111
3144
  /**
3112
- * Filter configuration options on a Liveboard page.
3113
- * Allows configuring filters on a
3114
- * Liveboard.
3145
+ * The filter configuration options for a Liveboard.
3146
+ * The configuration options are available when adding
3147
+ * filters on a Liveboard.
3148
+ *
3115
3149
  * @example
3116
3150
  * ```js
3117
3151
  * disabledActions: [Action.ConfigureFilter]
@@ -3209,14 +3243,17 @@
3209
3243
  * @hidden
3210
3244
  */
3211
3245
  Action["SpotIQFollow"] = "spotIQFollow";
3246
+ /**
3247
+ * The Share action for a Liveboard visualization.
3248
+ */
3212
3249
  Action["ShareViz"] = "shareViz";
3213
3250
  /**
3214
3251
  * @hidden
3215
3252
  */
3216
3253
  Action["ReplaySearch"] = "replaySearch";
3217
3254
  /**
3218
- * The **Show underlying data** menu action on a visualization or
3219
- * Answer page.
3255
+ * The **Show underlying data** menu action on a
3256
+ * visualization or Answer page.
3220
3257
  * Displays detailed information and raw data
3221
3258
  * for a given visualization.
3222
3259
  * @example
@@ -3226,8 +3263,8 @@
3226
3263
  */
3227
3264
  Action["ShowUnderlyingData"] = "showUnderlyingData";
3228
3265
  /**
3229
- * The **Download** menu action on Liveboard visualizations
3230
- * and Answers.
3266
+ * The **Download** menu action on Liveboard
3267
+ * visualizations and Answers.
3231
3268
  * Allows downloading a visualization or Answer.
3232
3269
  * @example
3233
3270
  * ```js
@@ -3248,11 +3285,10 @@
3248
3285
  /**
3249
3286
  *
3250
3287
  *The **Download PDF** action that downloads a Liveboard,
3251
- *visualization, or Answer as a PDF file.
3252
- *
3288
+ * visualization, or Answer as a PDF file.
3253
3289
  *
3254
- ***NOTE**: The **Download** > **PDF** action is available on
3255
- *visualizations and Answers if the data is in tabular format.
3290
+ * **NOTE**: The **Download** > **PDF** option is available for
3291
+ * tables in visualizations and Answers.
3256
3292
  * @example
3257
3293
  * ```js
3258
3294
  * disabledActions: [Action.DownloadAsPdf]
@@ -3284,9 +3320,11 @@
3284
3320
  */
3285
3321
  Action["DownloadTrace"] = "downloadTrace";
3286
3322
  /**
3287
- * The **Export TML** menu action on Liveboard, Answers
3288
- * Worksheets and Data Connections page.
3289
- * Exports an object as a TML file.
3323
+ * The **Export TML** menu action on a Liveboard, Answer, and
3324
+ * the Data Workspace pages for data objects and connections.
3325
+ *
3326
+ * Allows exporting an object as a TML file.
3327
+ *
3290
3328
  * @example
3291
3329
  * ```js
3292
3330
  * disabledActions: [Action.ExportTML]
@@ -3294,7 +3332,8 @@
3294
3332
  */
3295
3333
  Action["ExportTML"] = "exportTSL";
3296
3334
  /**
3297
- * The **Import TML** menu action for Liveboards and Answers.
3335
+ * The **Import TML** menu action on the
3336
+ * *Data Workspace* > *Utilities* page.
3298
3337
  * Imports TML representation of ThoughtSpot objects.
3299
3338
  * @example
3300
3339
  * ```js
@@ -3304,7 +3343,7 @@
3304
3343
  Action["ImportTML"] = "importTSL";
3305
3344
  /**
3306
3345
  * The **Update TML** menu action for Liveboards and Answers.
3307
- * Update TML representation of ThoughtSpot objects.
3346
+ * Updates TML representation of ThoughtSpot objects.
3308
3347
  * @example
3309
3348
  * ```js
3310
3349
  * disabledActions: [Action.UpdateTML]
@@ -3331,8 +3370,11 @@
3331
3370
  */
3332
3371
  Action["Present"] = "present";
3333
3372
  /**
3334
- * The tile resize options in the visualization menu.
3335
- * Allows switching between different preset layouts.
3373
+ * The visualization tile resize option.
3374
+ * Also available via More `...` options menu on a visualization.
3375
+ * Allows resizing visualization tiles and switching
3376
+ * between different preset layout option.
3377
+ *
3336
3378
  * @example
3337
3379
  * ```js
3338
3380
  * disabledActions: [Action.ToggleSize]
@@ -3358,8 +3400,9 @@
3358
3400
  */
3359
3401
  Action["EditTitle"] = "editTitle";
3360
3402
  /**
3361
- * The **Delete** menu action on Liveboards and visualizations.
3362
- * Deletes a Liveboard or a visualization from a Liveboard.
3403
+ * The **Delete** action on a Liveboard, *Liveboards* and
3404
+ * *Answers* list pages in full application embedding.
3405
+ *
3363
3406
  * @example
3364
3407
  * ```js
3365
3408
  * disabledActions: [Action.Remove]
@@ -3436,8 +3479,9 @@
3436
3479
  */
3437
3480
  Action["Explore"] = "explore";
3438
3481
  /**
3439
- * The action to include data points on a drilled-down Answer
3440
- * or visualization
3482
+ * The contextual menu action to include a specific data point
3483
+ * when drilling down a table or chart on an Answer.
3484
+ *
3441
3485
  * @example
3442
3486
  * ```js
3443
3487
  * disabledActions: [Action.DrillInclude]
@@ -3445,8 +3489,8 @@
3445
3489
  */
3446
3490
  Action["DrillInclude"] = "context-menu-item-include";
3447
3491
  /**
3448
- * The action to exclude data points on a drilled-down Answer
3449
- * or visualization
3492
+ * The contextual menu action to exclude a specific data point
3493
+ * when drilling down a table or chart on an Answer.
3450
3494
  * @example
3451
3495
  * ```js
3452
3496
  * disabledActions: [Action.DrillInclude]
@@ -3593,7 +3637,7 @@
3593
3637
  * Allows users to manage data sync pipelines to third-party apps.
3594
3638
  * @example
3595
3639
  * ```js
3596
- * disabledActions: [Action.SyncToOtherApps]
3640
+ * disabledActions: [Action.ManagePipelines]
3597
3641
  * ```
3598
3642
  * @version SDK: 1.18.0| ThoughtSpot: 8.10.0.cl, 9.0.1.sw
3599
3643
  */
@@ -3912,7 +3956,7 @@
3912
3956
  /**
3913
3957
  * Action ID for the Parent TML action
3914
3958
  * The parent action **TML** must be included to access TML-related options
3915
- * within the cascading menu (specific to the answer page)
3959
+ * within the cascading menu (specific to the Answer page)
3916
3960
  * @example
3917
3961
  * ```js
3918
3962
  * // to include specific TML actions
@@ -3951,8 +3995,10 @@
3951
3995
  */
3952
3996
  Action["VerifiedLiveboard"] = "verifiedLiveboard";
3953
3997
  /**
3954
- * The *Ask Sage* action for Answers and visualizations.
3955
- * Allows initiating a Natural Language Search query.
3998
+ * Action ID for the *Ask Sage* In Natural Language Search embed,
3999
+ * *Spotter* in Liveboard, full app, and Spotter embed.
4000
+ *
4001
+ * Allows initiating a conversation with ThoughtSpot AI analyst.
3956
4002
  *
3957
4003
  * @example
3958
4004
  * ```js
@@ -4148,7 +4194,8 @@
4148
4194
  */
4149
4195
  Action["DeletePreviousPrompt"] = "deletePreviousPrompt";
4150
4196
  /**
4151
- * Action ID for hide/disable edit of tokens on spotter results.
4197
+ * Action ID for hide or disable editing tokens generated from
4198
+ * Spotter results.
4152
4199
  * @example
4153
4200
  * ```js
4154
4201
  * hiddenAction: [Action.EditTokens]
@@ -6542,6 +6589,9 @@
6542
6589
  [exports.LogLevel.TRACE]: console.trace,
6543
6590
  };
6544
6591
  let globalLogLevelOverride = exports.LogLevel.TRACE;
6592
+ const setGlobalLogLevelOverride = (logLevel) => {
6593
+ globalLogLevelOverride = logLevel;
6594
+ };
6545
6595
  const logLevelToNumber = {
6546
6596
  [exports.LogLevel.SILENT]: 0,
6547
6597
  [exports.LogLevel.ERROR]: 1,
@@ -6618,6 +6668,7 @@
6618
6668
  CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
6619
6669
  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',
6620
6670
  MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
6671
+ 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',
6621
6672
  };
6622
6673
 
6623
6674
  const EndPoints = {
@@ -6734,13 +6785,18 @@
6734
6785
  });
6735
6786
  }
6736
6787
 
6737
- let cachedAuthToken = null;
6788
+ const cacheAuthTokenKey = 'cachedAuthToken';
6789
+ const getCacheAuthToken = () => getValueFromWindow(cacheAuthTokenKey);
6790
+ const storeAuthTokenInCache = (token) => {
6791
+ storeValueInWindow(cacheAuthTokenKey, token);
6792
+ };
6738
6793
  // This method can be used to get the authToken using the embedConfig
6739
6794
  /**
6740
6795
  *
6741
6796
  * @param embedConfig
6742
6797
  */
6743
6798
  async function getAuthenticationToken(embedConfig) {
6799
+ const cachedAuthToken = getCacheAuthToken();
6744
6800
  // Since we don't have token validation enabled , we cannot tell if the
6745
6801
  // cached token is valid or not. So we will always fetch a new token.
6746
6802
  if (cachedAuthToken && !embedConfig.disableTokenVerification) {
@@ -6771,10 +6827,11 @@
6771
6827
  logger$3.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e.message}`);
6772
6828
  throw e;
6773
6829
  }
6774
- cachedAuthToken = authToken;
6830
+ storeAuthTokenInCache(authToken);
6775
6831
  return authToken;
6776
6832
  }
6777
6833
  const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
6834
+ const cachedAuthToken = getCacheAuthToken();
6778
6835
  if (embedConfig.disableTokenVerification) {
6779
6836
  logger$3.info('Token verification is disabled. Assuming token is valid.');
6780
6837
  return true;
@@ -6808,17 +6865,28 @@
6808
6865
  * @group Authentication / Init
6809
6866
  */
6810
6867
  const resetCachedAuthToken = () => {
6811
- cachedAuthToken = null;
6868
+ storeAuthTokenInCache(null);
6812
6869
  };
6813
6870
 
6814
- let config = {};
6871
+ const configKey = 'embedConfig';
6815
6872
  /**
6816
6873
  * Gets the configuration embed was initialized with.
6817
6874
  * @returns {@link EmbedConfig} The configuration embed was initialized with.
6818
6875
  * @version SDK: 1.19.0 | ThoughtSpot: *
6819
6876
  * @group Global methods
6820
6877
  */
6821
- const getEmbedConfig = () => config;
6878
+ const getEmbedConfig = () => getValueFromWindow(configKey) || {};
6879
+ /**
6880
+ * Sets the configuration embed was initialized with.
6881
+ * And returns the new configuration.
6882
+ * @param newConfig The configuration to set.
6883
+ * @version SDK: 1.27.0 | ThoughtSpot: *
6884
+ * @group Global methods
6885
+ */
6886
+ const setEmbedConfig = (newConfig) => {
6887
+ storeValueInWindow(configKey, newConfig);
6888
+ return getValueFromWindow(configKey);
6889
+ };
6822
6890
 
6823
6891
  /**
6824
6892
  * Fetch wrapper that adds the authentication token to the request.
@@ -13806,7 +13874,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
13806
13874
  }
13807
13875
  }
13808
13876
 
13809
- createCommonjsModule(function (module) {
13877
+ var eventemitter3 = createCommonjsModule(function (module) {
13810
13878
 
13811
13879
  var has = Object.prototype.hasOwnProperty
13812
13880
  , prefix = '~';
@@ -14149,7 +14217,52 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14149
14217
  ReportType["CSP_VIOLATION"] = "csp-violation";
14150
14218
  ReportType["DEPRECATION"] = "deprecation";
14151
14219
  ReportType["INTERVENTION"] = "intervention";
14152
- })(ReportType || (ReportType = {}));
14220
+ })(ReportType || (ReportType = {}));
14221
+ let globalObserver = null;
14222
+ /**
14223
+ * Register a global ReportingObserver to capture all unhandled errors
14224
+ * @param overrideExisting boolean to override existing observer
14225
+ * @returns ReportingObserver | null
14226
+ */
14227
+ function registerReportingObserver(overrideExisting = false) {
14228
+ if (!(window.ReportingObserver)) {
14229
+ logger$3.warn(ERROR_MESSAGE.MISSING_REPORTING_OBSERVER);
14230
+ return null;
14231
+ }
14232
+ if (overrideExisting) {
14233
+ resetGlobalReportingObserver();
14234
+ }
14235
+ if (globalObserver) {
14236
+ return globalObserver;
14237
+ }
14238
+ const embedConfig = getEmbedConfig();
14239
+ globalObserver = new ReportingObserver((reports) => {
14240
+ reports.forEach((report) => {
14241
+ const { type, url, body } = report;
14242
+ const reportBody = body;
14243
+ const isThoughtSpotHost = url
14244
+ && url.startsWith(embedConfig.thoughtSpotHost);
14245
+ const isFrameHostError = type === ReportType.CSP_VIOLATION
14246
+ && reportBody.effectiveDirective === 'frame-ancestors';
14247
+ if (isThoughtSpotHost && isFrameHostError) {
14248
+ if (!embedConfig.suppressErrorAlerts) {
14249
+ alert(ERROR_MESSAGE.CSP_VIOLATION_ALERT);
14250
+ }
14251
+ logger$3.error(ERROR_MESSAGE.CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE);
14252
+ }
14253
+ });
14254
+ }, { buffered: true });
14255
+ globalObserver.observe();
14256
+ return globalObserver;
14257
+ }
14258
+ /**
14259
+ * Resets the global ReportingObserver
14260
+ */
14261
+ function resetGlobalReportingObserver() {
14262
+ if (globalObserver)
14263
+ globalObserver.disconnect();
14264
+ globalObserver = null;
14265
+ }
14153
14266
 
14154
14267
  /**
14155
14268
  *
@@ -14331,7 +14444,45 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14331
14444
  clusterName: sessionInfoResp.configInfo.selfClusterName,
14332
14445
  ...sessionInfoResp,
14333
14446
  };
14334
- };
14447
+ };
14448
+ /**
14449
+ * Resets the cached session info object and forces a new fetch on the next call.
14450
+ * @example ```js
14451
+ * resetCachedSessionInfo();
14452
+ * const sessionInfo = await getSessionInfo();
14453
+ * console.log(sessionInfo);
14454
+ * ```
14455
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14456
+ * @returns {void}
14457
+ */
14458
+ function resetCachedSessionInfo() {
14459
+ sessionInfo = null;
14460
+ }
14461
+ /**
14462
+ * Resets the cached preauth info object and forces a new fetch on the next call.
14463
+ * @example ```js
14464
+ * resetCachedPreauthInfo();
14465
+ * const preauthInfo = await getPreauthInfo();
14466
+ * console.log(preauthInfo);
14467
+ * ```
14468
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14469
+ * @returns {void}
14470
+ */
14471
+ function resetCachedPreauthInfo() {
14472
+ preauthInfo = null;
14473
+ }
14474
+
14475
+ /**
14476
+ * This function resets all the services that are cached in the SDK.
14477
+ * This is to be called when the user logs out of the application and also
14478
+ * when init is called again.
14479
+ * @version SDK: 1.30.2 | ThoughtSpot: *
14480
+ */
14481
+ function resetAllCachedServices() {
14482
+ resetCachedAuthToken();
14483
+ resetCachedSessionInfo();
14484
+ resetCachedPreauthInfo();
14485
+ }
14335
14486
 
14336
14487
  // eslint-disable-next-line import/no-mutable-exports
14337
14488
  let loggedInStatus = false;
@@ -14401,42 +14552,61 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14401
14552
  */
14402
14553
  AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
14403
14554
  })(AuthEvent || (AuthEvent = {}));
14555
+ let authEE;
14556
+ /**
14557
+ *
14558
+ * @param eventEmitter
14559
+ */
14560
+ function setAuthEE(eventEmitter) {
14561
+ authEE = eventEmitter;
14562
+ }
14404
14563
  /**
14405
14564
  *
14406
14565
  */
14407
14566
  function notifyAuthSDKSuccess() {
14408
- {
14567
+ if (!authEE) {
14409
14568
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14410
14569
  return;
14411
14570
  }
14571
+ authEE.emit(AuthStatus.SDK_SUCCESS);
14412
14572
  }
14413
14573
  /**
14414
14574
  *
14415
14575
  */
14416
14576
  async function notifyAuthSuccess() {
14417
- {
14577
+ if (!authEE) {
14418
14578
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14419
14579
  return;
14420
14580
  }
14581
+ try {
14582
+ getPreauthInfo();
14583
+ const sessionInfo = await getSessionInfo();
14584
+ authEE.emit(AuthStatus.SUCCESS, sessionInfo);
14585
+ }
14586
+ catch (e) {
14587
+ logger$3.error(ERROR_MESSAGE.SESSION_INFO_FAILED);
14588
+ }
14421
14589
  }
14422
14590
  /**
14423
14591
  *
14424
14592
  * @param failureType
14425
14593
  */
14426
14594
  function notifyAuthFailure(failureType) {
14427
- {
14595
+ if (!authEE) {
14428
14596
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14429
14597
  return;
14430
14598
  }
14599
+ authEE.emit(AuthStatus.FAILURE, failureType);
14431
14600
  }
14432
14601
  /**
14433
14602
  *
14434
14603
  */
14435
14604
  function notifyLogout() {
14436
- {
14605
+ if (!authEE) {
14437
14606
  logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
14438
14607
  return;
14439
14608
  }
14609
+ authEE.emit(AuthStatus.LOGOUT);
14440
14610
  }
14441
14611
  /**
14442
14612
  * Check if we are logged into the ThoughtSpot cluster
@@ -14597,6 +14767,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14597
14767
  samlAuthWindow.focus();
14598
14768
  }
14599
14769
  };
14770
+ authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
14600
14771
  const containerEl = getDOMNode(triggerContainer);
14601
14772
  if (containerEl) {
14602
14773
  containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
@@ -14612,6 +14783,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14612
14783
  }
14613
14784
  });
14614
14785
  });
14786
+ authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
14615
14787
  return samlCompletionPromise;
14616
14788
  }
14617
14789
  /**
@@ -14695,6 +14867,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14695
14867
  }
14696
14868
  };
14697
14869
 
14870
+ if (typeof Promise.withResolvers === 'undefined') {
14871
+ Promise.withResolvers = () => {
14872
+ let resolve;
14873
+ let reject;
14874
+ const promise = new Promise((res, rej) => {
14875
+ resolve = res;
14876
+ reject = rej;
14877
+ });
14878
+ return { promise, resolve, reject };
14879
+ };
14880
+ }
14881
+
14698
14882
  /* eslint-disable camelcase */
14699
14883
  /* eslint-disable import/no-mutable-exports */
14700
14884
  /**
@@ -14704,12 +14888,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14704
14888
  * @summary Base classes
14705
14889
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
14706
14890
  */
14707
- ({
14891
+ const CONFIG_DEFAULTS = {
14708
14892
  loginFailedMessage: 'Not logged in',
14709
14893
  authTriggerText: 'Authorize',
14710
14894
  authType: AuthType.None,
14711
14895
  logLevel: exports.LogLevel.ERROR,
14712
- });
14896
+ };
14713
14897
  let authPromise;
14714
14898
  const getAuthPromise = () => authPromise;
14715
14899
  /**
@@ -14731,12 +14915,146 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14731
14915
  });
14732
14916
  return authPromise;
14733
14917
  };
14734
- ({
14918
+ const hostUrlToFeatureUrl = {
14735
14919
  [PrefetchFeatures.SearchEmbed]: (url, flags) => `${url}v2/?${flags}#/embed/answer`,
14736
14920
  [PrefetchFeatures.LiveboardEmbed]: (url, flags) => `${url}?${flags}`,
14737
14921
  [PrefetchFeatures.FullApp]: (url, flags) => `${url}?${flags}`,
14738
14922
  [PrefetchFeatures.VizEmbed]: (url, flags) => `${url}?${flags}`,
14739
- });
14923
+ };
14924
+ /**
14925
+ * Prefetches static resources from the specified URL. Web browsers can then cache the
14926
+ * prefetched resources and serve them from the user's local disk to provide faster access
14927
+ * to your app.
14928
+ * @param url The URL provided for prefetch
14929
+ * @param prefetchFeatures Specify features which needs to be prefetched.
14930
+ * @param additionalFlags This can be used to add any URL flag.
14931
+ * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
14932
+ * @group Global methods
14933
+ */
14934
+ const prefetch = (url, prefetchFeatures, additionalFlags) => {
14935
+ var _a;
14936
+ if (url === '') {
14937
+ // eslint-disable-next-line no-console
14938
+ logger$3.warn('The prefetch method does not have a valid URL');
14939
+ }
14940
+ else {
14941
+ const features = [PrefetchFeatures.FullApp];
14942
+ let hostUrl = url || getEmbedConfig().thoughtSpotHost;
14943
+ const prefetchFlags = {
14944
+ [Param.EmbedApp]: true,
14945
+ ...(_a = getEmbedConfig()) === null || _a === void 0 ? void 0 : _a.additionalFlags,
14946
+ ...additionalFlags,
14947
+ };
14948
+ hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
14949
+ Array.from(new Set(features
14950
+ .map((feature) => hostUrlToFeatureUrl[feature](hostUrl, getQueryParamString(prefetchFlags)))))
14951
+ .forEach((prefetchUrl, index) => {
14952
+ const iFrame = document.createElement('iframe');
14953
+ iFrame.src = prefetchUrl;
14954
+ iFrame.style.width = '0';
14955
+ iFrame.style.height = '0';
14956
+ iFrame.style.border = '0';
14957
+ iFrame.classList.add('prefetchIframe');
14958
+ iFrame.classList.add(`prefetchIframeNum-${index}`);
14959
+ document.body.appendChild(iFrame);
14960
+ });
14961
+ }
14962
+ };
14963
+ /**
14964
+ *
14965
+ * @param embedConfig
14966
+ */
14967
+ function sanity(embedConfig) {
14968
+ if (embedConfig.thoughtSpotHost === undefined) {
14969
+ throw new Error('ThoughtSpot host not provided');
14970
+ }
14971
+ if (embedConfig.authType === AuthType.TrustedAuthToken) {
14972
+ if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
14973
+ throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
14974
+ }
14975
+ }
14976
+ }
14977
+ /**
14978
+ *
14979
+ * @param embedConfig
14980
+ */
14981
+ function backwardCompat(embedConfig) {
14982
+ const newConfig = { ...embedConfig };
14983
+ if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
14984
+ newConfig.inPopup = embedConfig.noRedirect;
14985
+ }
14986
+ return newConfig;
14987
+ }
14988
+ const initFlagKey = 'initFlagKey';
14989
+ const createAndSetInitPromise = () => {
14990
+ const { promise: initPromise, resolve: initPromiseResolve,
14991
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14992
+ // @ts-ignore
14993
+ } = Promise.withResolvers();
14994
+ const initFlagStore = {
14995
+ initPromise,
14996
+ isInitCalled: false,
14997
+ initPromiseResolve,
14998
+ };
14999
+ storeValueInWindow(initFlagKey, initFlagStore, {
15000
+ // In case of diff imports the promise might be already set
15001
+ ignoreIfAlreadyExists: true,
15002
+ });
15003
+ };
15004
+ createAndSetInitPromise();
15005
+ const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
15006
+ const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
15007
+ /**
15008
+ * Initializes the Visual Embed SDK globally and perform
15009
+ * authentication if applicable. This function needs to be called before any ThoughtSpot
15010
+ * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
15011
+ * to actually embed. That is handled internally.
15012
+ * @param embedConfig The configuration object containing ThoughtSpot host,
15013
+ * authentication mechanism and so on.
15014
+ * @example
15015
+ * ```js
15016
+ * const authStatus = init({
15017
+ * thoughtSpotHost: 'https://my.thoughtspot.cloud',
15018
+ * authType: AuthType.None,
15019
+ * });
15020
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
15021
+ * ```
15022
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
15023
+ * failure and logout. See {@link AuthStatus}
15024
+ * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
15025
+ * @group Authentication / Init
15026
+ */
15027
+ const init = (embedConfig) => {
15028
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15029
+ sanity(embedConfig);
15030
+ resetAllCachedServices();
15031
+ embedConfig = setEmbedConfig(backwardCompat({
15032
+ ...CONFIG_DEFAULTS,
15033
+ ...embedConfig,
15034
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
15035
+ }));
15036
+ setGlobalLogLevelOverride(embedConfig.logLevel);
15037
+ registerReportingObserver();
15038
+ const authEE = new eventemitter3();
15039
+ setAuthEE(authEE);
15040
+ handleAuth();
15041
+ const { password, ...configToTrack } = getEmbedConfig();
15042
+ uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
15043
+ ...configToTrack,
15044
+ usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
15045
+ 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,
15046
+ 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,
15047
+ usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
15048
+ usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
15049
+ });
15050
+ if (getEmbedConfig().callPrefetch) {
15051
+ prefetch(getEmbedConfig().thoughtSpotHost);
15052
+ }
15053
+ // Resolves the promise created in the initPromiseKey
15054
+ getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
15055
+ getValueFromWindow(initFlagKey).isInitCalled = true;
15056
+ return authEE;
15057
+ };
14740
15058
  /**
14741
15059
  *
14742
15060
  */
@@ -14865,7 +15183,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14865
15183
  return e;
14866
15184
  }
14867
15185
 
14868
- 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$1={".":{"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$1,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};
15186
+ 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$1={".":{"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$1,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};
14869
15187
 
14870
15188
  /**
14871
15189
  * Reloads the ThoughtSpot iframe.
@@ -15174,13 +15492,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15174
15492
  }
15175
15493
  };
15176
15494
  this.el = getDOMNode(domSelector);
15177
- // TODO: handle error
15178
- this.embedConfig = getEmbedConfig();
15179
- if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
15180
- this.embedConfig.authTriggerContainer = domSelector;
15181
- }
15182
- this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
15183
- this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
15184
15495
  this.eventHandlerMap = new Map();
15185
15496
  this.isError = false;
15186
15497
  this.viewConfig = {
@@ -15188,12 +15499,21 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15188
15499
  excludeRuntimeParametersfromURL: false,
15189
15500
  ...viewConfig,
15190
15501
  };
15191
- this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
15192
15502
  this.registerAppInit();
15193
15503
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
15194
15504
  ...viewConfig,
15195
15505
  });
15196
15506
  this.hostEventClient = new HostEventClient(this.iFrame);
15507
+ this.isReadyForRenderPromise = getInitPromise().then(async () => {
15508
+ const embedConfig = getEmbedConfig();
15509
+ this.embedConfig = embedConfig;
15510
+ if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
15511
+ this.embedConfig.authTriggerContainer = domSelector;
15512
+ }
15513
+ this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
15514
+ this.thoughtSpotV2Base = getV2BasePath(embedConfig);
15515
+ this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
15516
+ });
15197
15517
  }
15198
15518
  /**
15199
15519
  * Throws error encountered during initialization.
@@ -15911,6 +16231,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15911
16231
  * @param args
15912
16232
  */
15913
16233
  async render() {
16234
+ if (!getIsInitCalled()) {
16235
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16236
+ }
16237
+ await this.isReadyForRenderPromise;
15914
16238
  this.isRendered = true;
15915
16239
  return this;
15916
16240
  }
@@ -15918,21 +16242,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15918
16242
  return '';
15919
16243
  }
15920
16244
  handleRenderForPrerender() {
15921
- this.render();
16245
+ return this.render();
15922
16246
  }
15923
16247
  /**
15924
16248
  * Creates the preRender shell
15925
16249
  * @param showPreRenderByDefault - Show the preRender after render, hidden by default
15926
16250
  */
15927
- preRender(showPreRenderByDefault = false) {
16251
+ async preRender(showPreRenderByDefault = false) {
15928
16252
  if (!this.viewConfig.preRenderId) {
15929
16253
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
15930
16254
  return this;
15931
16255
  }
15932
16256
  this.isPreRendered = true;
15933
16257
  this.showPreRenderByDefault = showPreRenderByDefault;
15934
- this.handleRenderForPrerender();
15935
- return this;
16258
+ return this.handleRenderForPrerender();
15936
16259
  }
15937
16260
  /**
15938
16261
  * Get the Post Url Params for THOUGHTSPOT from the current
@@ -15985,6 +16308,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15985
16308
  * @returns
15986
16309
  */
15987
16310
  async prerenderGeneric() {
16311
+ if (!getIsInitCalled()) {
16312
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16313
+ }
16314
+ await this.isReadyForRenderPromise;
15988
16315
  const prerenderFrameSrc = this.getRootIframeSrc();
15989
16316
  this.isRendered = true;
15990
16317
  return this.renderIFrame(prerenderFrameSrc);
@@ -15998,17 +16325,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15998
16325
  * Also, synchronizes the style of the PreRender component with the embedding
15999
16326
  * element.
16000
16327
  */
16001
- showPreRender() {
16328
+ async showPreRender() {
16002
16329
  if (!this.viewConfig.preRenderId) {
16003
16330
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
16004
- return;
16331
+ return this;
16005
16332
  }
16006
16333
  if (!this.isPreRenderAvailable()) {
16007
16334
  const isAvailable = this.connectPreRendered();
16008
16335
  if (!isAvailable) {
16009
16336
  // if the Embed component is not preRendered , Render it now and
16010
- this.preRender(true);
16011
- return;
16337
+ return this.preRender(true);
16012
16338
  }
16013
16339
  this.validatePreRenderViewConfig(this.viewConfig);
16014
16340
  }
@@ -16031,6 +16357,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16031
16357
  this.beforePrerenderVisible();
16032
16358
  removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
16033
16359
  this.subscribeToEvents();
16360
+ return this;
16034
16361
  }
16035
16362
  /**
16036
16363
  * Synchronizes the style properties of the PreRender component with the embedding
@@ -16216,7 +16543,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16216
16543
  * Render the embedded ThoughtSpot search
16217
16544
  */
16218
16545
  async render() {
16219
- super.render();
16546
+ await super.render();
16220
16547
  const src = this.getIFrameSrc();
16221
16548
  await this.renderIFrame(src);
16222
16549
  return this;
@@ -16303,7 +16630,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16303
16630
  * @returns {SageEmbed} Eureka/Sage embed
16304
16631
  */
16305
16632
  async render() {
16306
- super.render();
16633
+ await super.render();
16307
16634
  const src = this.getIFrameSrc();
16308
16635
  await this.renderV1Embed(src);
16309
16636
  return this;
@@ -16475,7 +16802,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16475
16802
  * Render the embedded ThoughtSpot search
16476
16803
  */
16477
16804
  async render() {
16478
- super.render();
16805
+ await super.render();
16479
16806
  this.viewConfig;
16480
16807
  const src = this.getIFrameSrc();
16481
16808
  await this.renderIFrame(src);
@@ -16618,7 +16945,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16618
16945
  getEmbedParams() {
16619
16946
  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,
16620
16947
  /* eslint-disable-next-line max-len */
16621
- dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, } = this.viewConfig;
16948
+ dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, } = this.viewConfig;
16622
16949
  let params = {};
16623
16950
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
16624
16951
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -16663,6 +16990,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16663
16990
  if (homePageSearchBarMode) {
16664
16991
  params[Param.HomePageSearchBarMode] = homePageSearchBarMode;
16665
16992
  }
16993
+ if (enablePendoHelp !== undefined) {
16994
+ params[Param.EnablePendoHelp] = enablePendoHelp;
16995
+ }
16666
16996
  params[Param.DataPanelV2Enabled] = dataPanelV2;
16667
16997
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
16668
16998
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
@@ -16771,7 +17101,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
16771
17101
  * to be embedded.
16772
17102
  */
16773
17103
  async render() {
16774
- super.render();
17104
+ await super.render();
16775
17105
  const src = this.getIFrameSrc();
16776
17106
  await this.renderV1Embed(src);
16777
17107
  return this;
@@ -17050,12 +17380,11 @@ query GetEurekaVizSnapshots(
17050
17380
  this.navigateToLiveboard(libId);
17051
17381
  }
17052
17382
  }
17053
- handleRenderForPrerender() {
17383
+ async handleRenderForPrerender() {
17054
17384
  if (isUndefined$1(this.viewConfig.liveboardId)) {
17055
- this.prerenderGeneric();
17056
- return;
17385
+ return this.prerenderGeneric();
17057
17386
  }
17058
- super.handleRenderForPrerender();
17387
+ return super.handleRenderForPrerender();
17059
17388
  }
17060
17389
  /**
17061
17390
  * Triggers an event to the embedded app
@@ -17080,7 +17409,7 @@ query GetEurekaVizSnapshots(
17080
17409
  * visualization ID and the runtime filters.
17081
17410
  */
17082
17411
  async render() {
17083
- super.render();
17412
+ await super.render();
17084
17413
  const src = this.getIFrameSrc();
17085
17414
  await this.renderV1Embed(src);
17086
17415
  this.showPreviewLoader();
@@ -17217,7 +17546,7 @@ query GetEurekaVizSnapshots(
17217
17546
  return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
17218
17547
  }
17219
17548
  async render() {
17220
- super.render();
17549
+ await super.render();
17221
17550
  const src = this.getIframeSrc();
17222
17551
  await this.renderIFrame(src);
17223
17552
  return this;
@@ -17486,6 +17815,27 @@ query GetEurekaVizSnapshots(
17486
17815
  */
17487
17816
  function useEmbedRef() {
17488
17817
  return React.useRef(null);
17818
+ }
17819
+ /**
17820
+ *
17821
+ * @param config - EmbedConfig
17822
+ * @returns AuthEventEmitter
17823
+ * @example
17824
+ * ```
17825
+ * function Component() {
17826
+ * const authEE = useInit({ ...initConfig });
17827
+ * return <LiveboardEmbed ref={ref} liveboardId={<id>} />
17828
+ * }
17829
+ * ```
17830
+ * @version SDK: 1.36.2 | ThoughtSpot: *
17831
+ */
17832
+ function useInit(config) {
17833
+ const ref = React.useRef(null);
17834
+ useDeepCompareEffect(() => {
17835
+ const authEE = init(config);
17836
+ ref.current = authEE;
17837
+ }, [config]);
17838
+ return ref;
17489
17839
  }
17490
17840
 
17491
17841
  const ALIAS = Symbol.for('yaml.alias');
@@ -24906,5 +25256,6 @@ query GetEurekaVizSnapshots(
24906
25256
  exports.SearchEmbed = SearchEmbed;
24907
25257
  exports.getSessionInfo = getSessionInfo;
24908
25258
  exports.useEmbedRef = useEmbedRef;
25259
+ exports.useInit = useInit;
24909
25260
 
24910
25261
  }));