@thoughtspot/visual-embed-sdk 1.52.2-beta.2 → 1.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/contracts/contracts.spec.js +4 -0
  3. package/cjs/src/contracts/contracts.spec.js.map +1 -1
  4. package/cjs/src/contracts/host-event-contracts.d.ts +10 -0
  5. package/cjs/src/contracts/host-event-contracts.d.ts.map +1 -1
  6. package/cjs/src/css-variables.d.ts +373 -5
  7. package/cjs/src/css-variables.d.ts.map +1 -1
  8. package/cjs/src/embed/app.d.ts +15 -0
  9. package/cjs/src/embed/app.d.ts.map +1 -1
  10. package/cjs/src/embed/app.js +6 -3
  11. package/cjs/src/embed/app.js.map +1 -1
  12. package/cjs/src/embed/app.spec.js +28 -0
  13. package/cjs/src/embed/app.spec.js.map +1 -1
  14. package/cjs/src/embed/auto-frame-renderer.d.ts.map +1 -1
  15. package/cjs/src/embed/auto-frame-renderer.js +244 -4
  16. package/cjs/src/embed/auto-frame-renderer.js.map +1 -1
  17. package/cjs/src/embed/auto-frame-renderer.spec.js +389 -0
  18. package/cjs/src/embed/auto-frame-renderer.spec.js.map +1 -1
  19. package/cjs/src/embed/bodyless-conversation.js +1 -1
  20. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  21. package/cjs/src/embed/conversation.d.ts +29 -0
  22. package/cjs/src/embed/conversation.d.ts.map +1 -1
  23. package/cjs/src/embed/conversation.js +7 -3
  24. package/cjs/src/embed/conversation.js.map +1 -1
  25. package/cjs/src/embed/conversation.spec.js +88 -0
  26. package/cjs/src/embed/conversation.spec.js.map +1 -1
  27. package/cjs/src/embed/host-events.spec.js +32 -0
  28. package/cjs/src/embed/host-events.spec.js.map +1 -1
  29. package/cjs/src/embed/liveboard-override-utils.d.ts +59 -0
  30. package/cjs/src/embed/liveboard-override-utils.d.ts.map +1 -0
  31. package/cjs/src/embed/liveboard-override-utils.js +19 -0
  32. package/cjs/src/embed/liveboard-override-utils.js.map +1 -0
  33. package/cjs/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  34. package/cjs/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  35. package/cjs/src/embed/liveboard-override-utils.spec.js +34 -0
  36. package/cjs/src/embed/liveboard-override-utils.spec.js.map +1 -0
  37. package/cjs/src/embed/liveboard.d.ts +44 -13
  38. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  39. package/cjs/src/embed/liveboard.js +19 -23
  40. package/cjs/src/embed/liveboard.js.map +1 -1
  41. package/cjs/src/embed/liveboard.spec.js +122 -0
  42. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  43. package/cjs/src/embed/search-bar.js +1 -1
  44. package/cjs/src/embed/search-bar.js.map +1 -1
  45. package/cjs/src/embed/search.js +1 -1
  46. package/cjs/src/embed/search.js.map +1 -1
  47. package/cjs/src/embed/search.spec.js +20 -0
  48. package/cjs/src/embed/search.spec.js.map +1 -1
  49. package/cjs/src/embed/spotter-utils.d.ts +12 -0
  50. package/cjs/src/embed/spotter-utils.d.ts.map +1 -1
  51. package/cjs/src/embed/spotter-utils.js +20 -2
  52. package/cjs/src/embed/spotter-utils.js.map +1 -1
  53. package/cjs/src/embed/spotter-utils.spec.js +19 -0
  54. package/cjs/src/embed/spotter-utils.spec.js.map +1 -1
  55. package/cjs/src/embed/spotter-viz-utils.d.ts +15 -0
  56. package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
  57. package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
  58. package/cjs/src/embed/spotter-viz-utils.spec.js +11 -0
  59. package/cjs/src/embed/spotter-viz-utils.spec.js.map +1 -1
  60. package/cjs/src/embed/ts-embed.d.ts +18 -20
  61. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  62. package/cjs/src/embed/ts-embed.js +181 -45
  63. package/cjs/src/embed/ts-embed.js.map +1 -1
  64. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  65. package/cjs/src/embed/ts-embed.spec.js +610 -0
  66. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  67. package/cjs/src/index.d.ts +5 -3
  68. package/cjs/src/index.d.ts.map +1 -1
  69. package/cjs/src/index.js +4 -2
  70. package/cjs/src/index.js.map +1 -1
  71. package/cjs/src/mixpanel-service.d.ts +1 -0
  72. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  73. package/cjs/src/mixpanel-service.js +1 -0
  74. package/cjs/src/mixpanel-service.js.map +1 -1
  75. package/cjs/src/react/all-types-export.d.ts +1 -1
  76. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  77. package/cjs/src/react/all-types-export.js +2 -1
  78. package/cjs/src/react/all-types-export.js.map +1 -1
  79. package/cjs/src/types.d.ts +251 -4
  80. package/cjs/src/types.d.ts.map +1 -1
  81. package/cjs/src/types.js +176 -0
  82. package/cjs/src/types.js.map +1 -1
  83. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  84. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  85. package/cjs/src/utils/graphql/answerService/answer-queries.js +8 -1
  86. package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  87. package/cjs/src/utils/graphql/answerService/answerService.d.ts +28 -4
  88. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  89. package/cjs/src/utils/graphql/answerService/answerService.js +39 -4
  90. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  91. package/cjs/src/utils/graphql/answerService/answerService.spec.js +124 -0
  92. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  93. package/cjs/src/utils/runtimeTelemetry.d.ts +11 -0
  94. package/cjs/src/utils/runtimeTelemetry.d.ts.map +1 -0
  95. package/cjs/src/utils/runtimeTelemetry.js +34 -0
  96. package/cjs/src/utils/runtimeTelemetry.js.map +1 -0
  97. package/cjs/src/utils/runtimeTelemetry.spec.d.ts +2 -0
  98. package/cjs/src/utils/runtimeTelemetry.spec.d.ts.map +1 -0
  99. package/cjs/src/utils/runtimeTelemetry.spec.js +124 -0
  100. package/cjs/src/utils/runtimeTelemetry.spec.js.map +1 -0
  101. package/dist/{index-CnHREfvN.js → index-CrBnZBZv.js} +1 -1
  102. package/dist/src/contracts/host-event-contracts.d.ts +10 -0
  103. package/dist/src/contracts/host-event-contracts.d.ts.map +1 -1
  104. package/dist/src/css-variables.d.ts +373 -5
  105. package/dist/src/css-variables.d.ts.map +1 -1
  106. package/dist/src/embed/app.d.ts +15 -0
  107. package/dist/src/embed/app.d.ts.map +1 -1
  108. package/dist/src/embed/auto-frame-renderer.d.ts.map +1 -1
  109. package/dist/src/embed/conversation.d.ts +29 -0
  110. package/dist/src/embed/conversation.d.ts.map +1 -1
  111. package/dist/src/embed/liveboard-override-utils.d.ts +59 -0
  112. package/dist/src/embed/liveboard-override-utils.d.ts.map +1 -0
  113. package/dist/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  114. package/dist/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  115. package/dist/src/embed/liveboard.d.ts +44 -13
  116. package/dist/src/embed/liveboard.d.ts.map +1 -1
  117. package/dist/src/embed/spotter-utils.d.ts +12 -0
  118. package/dist/src/embed/spotter-utils.d.ts.map +1 -1
  119. package/dist/src/embed/spotter-viz-utils.d.ts +15 -0
  120. package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
  121. package/dist/src/embed/ts-embed.d.ts +18 -20
  122. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  123. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  124. package/dist/src/index.d.ts +5 -3
  125. package/dist/src/index.d.ts.map +1 -1
  126. package/dist/src/mixpanel-service.d.ts +1 -0
  127. package/dist/src/mixpanel-service.d.ts.map +1 -1
  128. package/dist/src/react/all-types-export.d.ts +1 -1
  129. package/dist/src/react/all-types-export.d.ts.map +1 -1
  130. package/dist/src/types.d.ts +251 -4
  131. package/dist/src/types.d.ts.map +1 -1
  132. package/dist/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  133. package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  134. package/dist/src/utils/graphql/answerService/answerService.d.ts +28 -4
  135. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  136. package/dist/src/utils/runtimeTelemetry.d.ts +11 -0
  137. package/dist/src/utils/runtimeTelemetry.d.ts.map +1 -0
  138. package/dist/src/utils/runtimeTelemetry.spec.d.ts +2 -0
  139. package/dist/src/utils/runtimeTelemetry.spec.d.ts.map +1 -0
  140. package/dist/tsembed-react.es.js +500 -85
  141. package/dist/tsembed-react.js +499 -84
  142. package/dist/tsembed.es.js +743 -90
  143. package/dist/tsembed.js +741 -88
  144. package/dist/visual-embed-sdk-react-full.d.ts +788 -44
  145. package/dist/visual-embed-sdk-react.d.ts +783 -44
  146. package/dist/visual-embed-sdk.d.ts +815 -45
  147. package/lib/package.json +1 -1
  148. package/lib/src/contracts/contracts.spec.js +4 -0
  149. package/lib/src/contracts/contracts.spec.js.map +1 -1
  150. package/lib/src/contracts/host-event-contracts.d.ts +10 -0
  151. package/lib/src/contracts/host-event-contracts.d.ts.map +1 -1
  152. package/lib/src/css-variables.d.ts +373 -5
  153. package/lib/src/css-variables.d.ts.map +1 -1
  154. package/lib/src/embed/app.d.ts +15 -0
  155. package/lib/src/embed/app.d.ts.map +1 -1
  156. package/lib/src/embed/app.js +7 -4
  157. package/lib/src/embed/app.js.map +1 -1
  158. package/lib/src/embed/app.spec.js +28 -0
  159. package/lib/src/embed/app.spec.js.map +1 -1
  160. package/lib/src/embed/auto-frame-renderer.d.ts.map +1 -1
  161. package/lib/src/embed/auto-frame-renderer.js +244 -4
  162. package/lib/src/embed/auto-frame-renderer.js.map +1 -1
  163. package/lib/src/embed/auto-frame-renderer.spec.js +389 -0
  164. package/lib/src/embed/auto-frame-renderer.spec.js.map +1 -1
  165. package/lib/src/embed/bodyless-conversation.js +1 -1
  166. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  167. package/lib/src/embed/conversation.d.ts +29 -0
  168. package/lib/src/embed/conversation.d.ts.map +1 -1
  169. package/lib/src/embed/conversation.js +8 -4
  170. package/lib/src/embed/conversation.js.map +1 -1
  171. package/lib/src/embed/conversation.spec.js +89 -1
  172. package/lib/src/embed/conversation.spec.js.map +1 -1
  173. package/lib/src/embed/host-events.spec.js +32 -0
  174. package/lib/src/embed/host-events.spec.js.map +1 -1
  175. package/lib/src/embed/liveboard-override-utils.d.ts +59 -0
  176. package/lib/src/embed/liveboard-override-utils.d.ts.map +1 -0
  177. package/lib/src/embed/liveboard-override-utils.js +15 -0
  178. package/lib/src/embed/liveboard-override-utils.js.map +1 -0
  179. package/lib/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  180. package/lib/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  181. package/lib/src/embed/liveboard-override-utils.spec.js +32 -0
  182. package/lib/src/embed/liveboard-override-utils.spec.js.map +1 -0
  183. package/lib/src/embed/liveboard.d.ts +44 -13
  184. package/lib/src/embed/liveboard.d.ts.map +1 -1
  185. package/lib/src/embed/liveboard.js +19 -23
  186. package/lib/src/embed/liveboard.js.map +1 -1
  187. package/lib/src/embed/liveboard.spec.js +122 -0
  188. package/lib/src/embed/liveboard.spec.js.map +1 -1
  189. package/lib/src/embed/search-bar.js +1 -1
  190. package/lib/src/embed/search-bar.js.map +1 -1
  191. package/lib/src/embed/search.js +1 -1
  192. package/lib/src/embed/search.js.map +1 -1
  193. package/lib/src/embed/search.spec.js +20 -0
  194. package/lib/src/embed/search.spec.js.map +1 -1
  195. package/lib/src/embed/spotter-utils.d.ts +12 -0
  196. package/lib/src/embed/spotter-utils.d.ts.map +1 -1
  197. package/lib/src/embed/spotter-utils.js +19 -1
  198. package/lib/src/embed/spotter-utils.js.map +1 -1
  199. package/lib/src/embed/spotter-utils.spec.js +19 -0
  200. package/lib/src/embed/spotter-utils.spec.js.map +1 -1
  201. package/lib/src/embed/spotter-viz-utils.d.ts +15 -0
  202. package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
  203. package/lib/src/embed/spotter-viz-utils.js.map +1 -1
  204. package/lib/src/embed/spotter-viz-utils.spec.js +11 -0
  205. package/lib/src/embed/spotter-viz-utils.spec.js.map +1 -1
  206. package/lib/src/embed/ts-embed.d.ts +18 -20
  207. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  208. package/lib/src/embed/ts-embed.js +181 -45
  209. package/lib/src/embed/ts-embed.js.map +1 -1
  210. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  211. package/lib/src/embed/ts-embed.spec.js +611 -1
  212. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  213. package/lib/src/index.d.ts +5 -3
  214. package/lib/src/index.d.ts.map +1 -1
  215. package/lib/src/index.js +3 -2
  216. package/lib/src/index.js.map +1 -1
  217. package/lib/src/mixpanel-service.d.ts +1 -0
  218. package/lib/src/mixpanel-service.d.ts.map +1 -1
  219. package/lib/src/mixpanel-service.js +1 -0
  220. package/lib/src/mixpanel-service.js.map +1 -1
  221. package/lib/src/react/all-types-export.d.ts +1 -1
  222. package/lib/src/react/all-types-export.d.ts.map +1 -1
  223. package/lib/src/react/all-types-export.js +1 -1
  224. package/lib/src/react/all-types-export.js.map +1 -1
  225. package/lib/src/types.d.ts +251 -4
  226. package/lib/src/types.d.ts.map +1 -1
  227. package/lib/src/types.js +176 -0
  228. package/lib/src/types.js.map +1 -1
  229. package/lib/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  230. package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  231. package/lib/src/utils/graphql/answerService/answer-queries.js +7 -0
  232. package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  233. package/lib/src/utils/graphql/answerService/answerService.d.ts +28 -4
  234. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  235. package/lib/src/utils/graphql/answerService/answerService.js +39 -4
  236. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  237. package/lib/src/utils/graphql/answerService/answerService.spec.js +125 -1
  238. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  239. package/lib/src/utils/runtimeTelemetry.d.ts +11 -0
  240. package/lib/src/utils/runtimeTelemetry.d.ts.map +1 -0
  241. package/lib/src/utils/runtimeTelemetry.js +28 -0
  242. package/lib/src/utils/runtimeTelemetry.js.map +1 -0
  243. package/lib/src/utils/runtimeTelemetry.spec.d.ts +2 -0
  244. package/lib/src/utils/runtimeTelemetry.spec.d.ts.map +1 -0
  245. package/lib/src/utils/runtimeTelemetry.spec.js +122 -0
  246. package/lib/src/utils/runtimeTelemetry.spec.js.map +1 -0
  247. package/lib/src/visual-embed-sdk.d.ts +815 -45
  248. package/package.json +1 -1
  249. package/src/contracts/contracts.spec.ts +4 -0
  250. package/src/contracts/host-event-contracts.ts +13 -0
  251. package/src/css-variables.ts +475 -26
  252. package/src/embed/app.spec.ts +32 -0
  253. package/src/embed/app.ts +29 -4
  254. package/src/embed/auto-frame-renderer.spec.ts +464 -0
  255. package/src/embed/auto-frame-renderer.ts +305 -6
  256. package/src/embed/bodyless-conversation.ts +1 -1
  257. package/src/embed/conversation.spec.ts +118 -1
  258. package/src/embed/conversation.ts +42 -3
  259. package/src/embed/host-events.spec.ts +44 -0
  260. package/src/embed/liveboard-override-utils.spec.ts +38 -0
  261. package/src/embed/liveboard-override-utils.ts +71 -0
  262. package/src/embed/liveboard.spec.ts +138 -0
  263. package/src/embed/liveboard.ts +64 -24
  264. package/src/embed/search-bar.tsx +1 -1
  265. package/src/embed/search.spec.ts +23 -0
  266. package/src/embed/search.ts +1 -1
  267. package/src/embed/spotter-utils.spec.ts +20 -0
  268. package/src/embed/spotter-utils.ts +24 -1
  269. package/src/embed/spotter-viz-utils.spec.ts +11 -0
  270. package/src/embed/spotter-viz-utils.ts +15 -0
  271. package/src/embed/ts-embed.spec.ts +767 -0
  272. package/src/embed/ts-embed.ts +186 -41
  273. package/src/index.ts +18 -1
  274. package/src/mixpanel-service.ts +1 -0
  275. package/src/react/all-types-export.ts +7 -0
  276. package/src/types.ts +254 -5
  277. package/src/utils/graphql/answerService/answer-queries.ts +8 -0
  278. package/src/utils/graphql/answerService/answerService.spec.ts +145 -1
  279. package/src/utils/graphql/answerService/answerService.ts +65 -3
  280. package/src/utils/runtimeTelemetry.spec.ts +148 -0
  281. package/src/utils/runtimeTelemetry.ts +50 -0
package/src/types.ts CHANGED
@@ -557,6 +557,28 @@ export interface EmbedConfig {
557
557
  */
558
558
  blockNonEmbedFullAppAccess?: boolean;
559
559
 
560
+ /**
561
+ * Render the embedded application in dark appearance when `true`, and in
562
+ * its default appearance when `false` or unset.
563
+ *
564
+ * The host application owns the appearance of an embed, so this overrides
565
+ * the appearance preference of the signed-in user and the color scheme of
566
+ * their operating system. If your application has light and dark themes,
567
+ * pass `true` while it shows the dark theme and `false` while it shows
568
+ * the light theme.
569
+ * @version SDK: 1.55.0 | ThoughtSpot Cloud: 26.12.0.cl
570
+ * @example
571
+ * ```js
572
+ * // Your application's current theme, 'light' or 'dark'
573
+ * const appTheme = 'dark';
574
+ * init({
575
+ * ...embedConfig,
576
+ * isDarkMode: appTheme === 'dark',
577
+ * });
578
+ * ```
579
+ */
580
+ isDarkMode?: boolean;
581
+
560
582
  /**
561
583
  * Host config in case embedded app is inside TS app itself
562
584
  * @hidden
@@ -1139,6 +1161,31 @@ export interface BaseViewConfig extends ApiInterceptFlags {
1139
1161
  * @default ''
1140
1162
  */
1141
1163
  customizations?: CustomisationsInterface;
1164
+ /**
1165
+ * Render this embed in dark appearance when `true`, and in its default
1166
+ * appearance when `false`, overriding the `isDarkMode` value passed to
1167
+ * `init`.
1168
+ *
1169
+ * The host application owns the appearance of an embed, so this overrides
1170
+ * the appearance preference of the signed-in user and the color scheme of
1171
+ * their operating system. If your application has light and dark themes,
1172
+ * pass `true` while it shows the dark theme and `false` while it shows
1173
+ * the light theme. Leave it unset to inherit the `init` value.
1174
+ *
1175
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
1176
+ * @version SDK: 1.55.0 | ThoughtSpot Cloud: 26.12.0.cl
1177
+ * @example
1178
+ * ```js
1179
+ * // Your application's current theme, 'light' or 'dark'
1180
+ * const appTheme = 'dark';
1181
+ * // Replace AppEmbed with a specific embed component like SearchEmbed or LiveboardEmbed
1182
+ * const embed = new AppEmbed('#tsEmbed', {
1183
+ * ... // other embed view config
1184
+ * isDarkMode: appTheme === 'dark',
1185
+ * });
1186
+ * ```
1187
+ */
1188
+ isDarkMode?: boolean;
1142
1189
  /**
1143
1190
  * Insert as a sibling of the target container, instead of appending to a
1144
1191
  * child inside it.
@@ -1695,7 +1742,32 @@ export type AutoMCPFrameRendererViewConfig = Omit<
1695
1742
  | 'insertAsSibling'
1696
1743
  | 'primaryAction'
1697
1744
  | 'enableV2Shell_experimental'
1698
- >;
1745
+ > & {
1746
+ /**
1747
+ * Suppress the notice shown on answers re-resolved from a stored
1748
+ * conversation. Those answers are re-run against current data, so by
1749
+ * default the renderer marks them with a tooltip explaining that the
1750
+ * numbers may differ from what the user originally saw. Set this to
1751
+ * `true` to render them without any notice.
1752
+ *
1753
+ * Only affects frames carrying {@link Param.TsmcpConversationId}; frames
1754
+ * that already contain their own session parameters are never marked.
1755
+ * @default false
1756
+ * @version SDK: 1.51.3
1757
+ * @example
1758
+ * ```js
1759
+ * startAutoMCPFrameRenderer({ suppressStaleAnswerNotice: true });
1760
+ * ```
1761
+ */
1762
+ suppressStaleAnswerNotice?: boolean;
1763
+ /**
1764
+ * Text of the notice described in {@link suppressStaleAnswerNotice}.
1765
+ * Override it to translate the message or match your own product voice.
1766
+ * @default 'This data may have changed since the last time you had a chat.'
1767
+ * @version SDK: 1.51.3
1768
+ */
1769
+ staleAnswerNoticeText?: string;
1770
+ };
1699
1771
 
1700
1772
  /**
1701
1773
  * The configuration object for Home page embeds configs.
@@ -3347,6 +3419,36 @@ export enum EmbedEvent {
3347
3419
  * ```
3348
3420
  */
3349
3421
  Edit = 'edit',
3422
+ /**
3423
+ * Emitted when a user clicks **Edit** on a Liveboard.
3424
+ *
3425
+ * Fired alongside {@link EmbedEvent.Edit} for backward compatibility;
3426
+ * listen to this instead of `Edit` to target the Liveboard surface only.
3427
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
3428
+ * @example
3429
+ * ```js
3430
+ * liveboardEmbed.on(EmbedEvent.EditLiveboard, payload => {
3431
+ * console.log('Liveboard edit', payload);
3432
+ * })
3433
+ * ```
3434
+ */
3435
+ EditLiveboard = 'editLiveboard',
3436
+ /**
3437
+ * Emitted when a user clicks **Edit** on a visualization inside a
3438
+ * Liveboard.
3439
+ *
3440
+ * Fired alongside {@link EmbedEvent.Edit} for backward compatibility;
3441
+ * listen to this instead of `Edit` to target the visualization surface
3442
+ * only.
3443
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
3444
+ * @example
3445
+ * ```js
3446
+ * liveboardEmbed.on(EmbedEvent.EditVisualization, payload => {
3447
+ * console.log('visualization edit', payload);
3448
+ * })
3449
+ * ```
3450
+ */
3451
+ EditVisualization = 'editVisualization',
3350
3452
  /**
3351
3453
  * Emitted when a user clicks *Make a copy* on a Liveboard
3352
3454
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
@@ -4221,7 +4323,7 @@ export enum EmbedEvent {
4221
4323
  * // make action
4222
4324
  * });
4223
4325
  * ```
4224
- *
4326
+ *
4225
4327
  * @example
4226
4328
  * ```js
4227
4329
  * embed.on(subscribedEvent(HostEvent.Save), () => {
@@ -4231,7 +4333,7 @@ export enum EmbedEvent {
4231
4333
  * @version SDK: 1.48.0 | ThoughtSpot: 26.4.0.cl
4232
4334
  */
4233
4335
  Subscribed = 'Subscribed',
4234
-
4336
+
4235
4337
  /**
4236
4338
  * Emitted when a user clicks the **Send Test Email** button in the
4237
4339
  * Liveboard schedule modal. Requires `isSendNowLiveboardSchedulingEnabled`
@@ -4348,7 +4450,7 @@ export enum EmbedEvent {
4348
4450
  * ```
4349
4451
  * @version SDK: 1.49.0 | ThoughtSpot Cloud: 26.6.0.cl
4350
4452
  */
4351
- RefreshLiveboardBrowserCache = 'refreshLiveboardBrowserCache',
4453
+ RefreshLiveboardBrowserCache = 'refreshLiveboardBrowserCache',
4352
4454
  }
4353
4455
 
4354
4456
  /**
@@ -4665,7 +4767,7 @@ export enum HostEvent {
4665
4767
  * ```js
4666
4768
  * // Preferred: use navigateToPage directly
4667
4769
  * appEmbed.navigateToPage(-1);
4668
- *
4770
+ *
4669
4771
  * // Numeric delta — go back one step
4670
4772
  * appEmbed.trigger(HostEvent.Navigate, -1);
4671
4773
  *
@@ -5331,6 +5433,46 @@ export enum HostEvent {
5331
5433
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
5332
5434
  */
5333
5435
  Edit = 'edit',
5436
+ /**
5437
+ * Trigger the **Edit** action on a Liveboard only — does not affect a
5438
+ * visualization's edit surface.
5439
+ *
5440
+ * Behaves like {@link HostEvent.Edit} restricted to the Liveboard
5441
+ * surface. Use {@link HostEvent.EditVisualization} to target a
5442
+ * visualization instead, or `HostEvent.Edit` to control whichever
5443
+ * surface applies contextually (unchanged, existing behavior).
5444
+ * @example
5445
+ * ```js
5446
+ * liveboardEmbed.trigger(HostEvent.EditLiveboard)
5447
+ * ```
5448
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
5449
+ */
5450
+ EditLiveboard = 'editLiveboard',
5451
+ /**
5452
+ * Trigger the **Edit** action on a specific visualization inside a
5453
+ * Liveboard only — does not affect the Liveboard-level edit surface.
5454
+ * @param - Object parameter. Includes the following keys:
5455
+ * - `vizId`: **Required.** The visualization to edit.
5456
+ *
5457
+ * @example
5458
+ * ```js
5459
+ * liveboardEmbed.trigger(HostEvent.EditVisualization, {vizId:
5460
+ * '730496d6-6903-4601-937e-2c691821af3c'})
5461
+ * ```
5462
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
5463
+ */
5464
+ EditVisualization = 'editVisualization',
5465
+ /**
5466
+ * Exits Liveboard edit mode , equivalent to clicking the
5467
+ * *Cancel* button in the Liveboard edit header. The Liveboard returns to
5468
+ * view mode and the embedded app emits the {@link EmbedEvent.Cancel} event.
5469
+ * @version SDK: 1.55.0 | ThoughtSpot Cloud: 26.12.0.cl
5470
+ * @example
5471
+ * ```js
5472
+ * liveboardEmbed.trigger(HostEvent.ExitEditMode);
5473
+ * ```
5474
+ */
5475
+ ExitEditMode = 'exitEditMode',
5334
5476
  /**
5335
5477
  * Trigger the **Copy link** action on a Liveboard or visualization
5336
5478
  * Payload: {@link VizScopedRequest}.
@@ -6875,6 +7017,40 @@ export enum HostEvent {
6875
7017
  * @version SDK: 1.49.0 | ThoughtSpot Cloud: 26.6.0.cl
6876
7018
  */
6877
7019
  RefreshLiveboardBrowserCache = 'refreshLiveboardBrowserCache',
7020
+
7021
+ /**
7022
+ * Switch the embed between dark appearance and its default appearance
7023
+ * while it is open, without reloading it.
7024
+ * Payload: {@link UpdateThemeRequest}.
7025
+ *
7026
+ * Use it to keep the embed in step with a theme switch in your
7027
+ * application; the appearance the embed loads with is set by `isDarkMode`.
7028
+ * The event resolves with the applied value, such as `{ isDarkMode: true }`.
7029
+ * When dark appearance is not available in the embed, the embed does not
7030
+ * change and the event rejects with an error message instead.
7031
+ * @version SDK: 1.55.0 | ThoughtSpot Cloud: 26.12.0.cl
7032
+ * @param - `isDarkMode` - `true` for dark appearance, `false` for the
7033
+ * default appearance.
7034
+ * @example
7035
+ * ```js
7036
+ * appEmbed.trigger(HostEvent.UpdateTheme, { isDarkMode: true });
7037
+ * ```
7038
+ * @example
7039
+ * ```js
7040
+ * // Follow a theme switch in your application
7041
+ * const themeSwitch = document.querySelector('#theme-switch');
7042
+ * themeSwitch.addEventListener('change', async (event) => {
7043
+ * try {
7044
+ * await appEmbed.trigger(HostEvent.UpdateTheme, {
7045
+ * isDarkMode: event.target.checked,
7046
+ * });
7047
+ * } catch (error) {
7048
+ * console.warn(error);
7049
+ * }
7050
+ * });
7051
+ * ```
7052
+ */
7053
+ UpdateTheme = 'UpdateTheme',
6878
7054
  }
6879
7055
 
6880
7056
  /**
@@ -6904,6 +7080,22 @@ export enum DataSourceVisualMode {
6904
7080
 
6905
7081
  export enum Param {
6906
7082
  Tsmcp = 'tsmcp',
7083
+ /**
7084
+ * Marker added by a host app replaying a stored conversation. Carries the
7085
+ * analytical session (conversation) identifier, from which the renderer
7086
+ * resolves the answer's current session parameters. Stripped before the
7087
+ * URL reaches the ThoughtSpot application.
7088
+ * @version SDK: 1.52.2 | ThoughtSpot Cloud: 26.9.0.cl
7089
+ */
7090
+ TsmcpConversationId = 'tsmcpConversationId',
7091
+ /**
7092
+ * Zero-based position of the answer within the conversation, counting only
7093
+ * non-thinking answer items in message order. Accompanies
7094
+ * {@link TsmcpConversationId}; defaults to 0 when absent. Stripped before
7095
+ * the URL reaches the ThoughtSpot application.
7096
+ * @version SDK: 1.52.2 | ThoughtSpot Cloud: 26.9.0.cl
7097
+ */
7098
+ TsmcpAnswerIndex = 'tsmcpAnswerIndex',
6907
7099
  EmbedApp = 'embedApp',
6908
7100
  DataSources = 'dataSources',
6909
7101
  DataSourceMode = 'dataSourceMode',
@@ -7067,6 +7259,9 @@ export enum Param {
7067
7259
  SpotterDataSources = 'spotterDataSources',
7068
7260
  OpenSpotterOnLiveboardByDefault = 'openSpotterOnLiveboardByDefault',
7069
7261
  ShowAnswerEditPanel = 'showAnswerEditPanel',
7262
+ IsDarkMode = 'isDarkMode',
7263
+ RadiantThemeEnabled = 'radiantThemeEnabled',
7264
+ SpotterExperienceVersion = 'spotterExperienceVersion',
7070
7265
  }
7071
7266
 
7072
7267
  /**
@@ -7530,12 +7725,43 @@ export enum Action {
7530
7725
  * The *Edit* action on the Liveboard page and in the
7531
7726
  * visualization menu.
7532
7727
  * Opens a Liveboard or visualization in edit mode.
7728
+ *
7729
+ * Controls both surfaces together. To target one surface only, use
7730
+ * {@link Action.EditLiveboard} or {@link Action.EditVisualization}.
7533
7731
  * @example
7534
7732
  * ```js
7535
7733
  * disabledActions: [Action.Edit]
7536
7734
  * ```
7537
7735
  */
7538
7736
  Edit = 'edit',
7737
+ /**
7738
+ * The *Edit* action on the Liveboard page only.
7739
+ * Opens a Liveboard in edit mode.
7740
+ *
7741
+ * Does not affect the *Edit* action in the visualization menu; use
7742
+ * {@link Action.EditVisualization} for that, or {@link Action.Edit} to
7743
+ * control both surfaces together.
7744
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
7745
+ * @example
7746
+ * ```js
7747
+ * disabledActions: [Action.EditLiveboard]
7748
+ * ```
7749
+ */
7750
+ EditLiveboard = 'editLiveboard',
7751
+ /**
7752
+ * The *Edit* action in the visualization `...` menu only.
7753
+ * Opens a visualization in the editor.
7754
+ *
7755
+ * Does not affect the *Edit* action on the Liveboard page; use
7756
+ * {@link Action.EditLiveboard} for that, or {@link Action.Edit} to
7757
+ * control both surfaces together.
7758
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
7759
+ * @example
7760
+ * ```js
7761
+ * disabledActions: [Action.EditVisualization]
7762
+ * ```
7763
+ */
7764
+ EditVisualization = 'editVisualization',
7539
7765
  /**
7540
7766
  * The text edit option for Liveboard and visualization titles.
7541
7767
  * @example
@@ -9334,6 +9560,29 @@ export enum Action {
9334
9560
  * ```
9335
9561
  */
9336
9562
  CustomizeHomepage = 'customizeHomepage',
9563
+ /**
9564
+ * Controls the visibility and disabled state of the *Cancel* button in the
9565
+ * Liveboard edit header, the button that discards the changes made in edit
9566
+ * mode and returns the Liveboard to view mode. The button is shown only
9567
+ * while the Liveboard is in edit mode.
9568
+ * @version SDK: 1.55.0 | ThoughtSpot Cloud: 26.12.0.cl
9569
+ * @example
9570
+ * ```js
9571
+ * const liveboardEmbed = new LiveboardEmbed('#tsEmbed', {
9572
+ * ... // other embed view config
9573
+ * hiddenActions: [Action.Cancel],
9574
+ * });
9575
+ * ```
9576
+ * @example
9577
+ * ```js
9578
+ * const liveboardEmbed = new LiveboardEmbed('#tsEmbed', {
9579
+ * ... // other embed view config
9580
+ * disabledActions: [Action.Cancel],
9581
+ * disabledActionReason: 'Save your changes to leave edit mode',
9582
+ * });
9583
+ * ```
9584
+ */
9585
+ Cancel = 'cancel',
9337
9586
  }
9338
9587
  export interface AnswerServiceType {
9339
9588
  getAnswer?: (offset: number, batchSize: number) => any;
@@ -61,6 +61,14 @@ export const addFilter = `
61
61
  }
62
62
  `;
63
63
 
64
+ export const updateSort = `
65
+ mutation UpdateSort($session: BachSessionIdInput!, $sortOrder: [AnswerColumnSortInput!]!) {
66
+ Answer__updateSort(session: $session, sortOrder: $sortOrder) {
67
+ ${bachSessionId}
68
+ }
69
+ }
70
+ `;
71
+
64
72
  export const getAnswer = `
65
73
  query GetAnswer($session: BachSessionIdInput!) {
66
74
  getAnswer(session: $session) {
@@ -3,7 +3,7 @@ import { AuthType, RuntimeFilterOp, VizPoint } from '../../../types';
3
3
  import { AnswerService } from './answerService';
4
4
  import {
5
5
  getAnswerData, removeColumns, addFilter, addColumns,
6
- getSQLQuery,
6
+ getSQLQuery, updateSort,
7
7
  } from './answer-queries';
8
8
  import * as queries from './answer-queries';
9
9
  import * as authTokenInstance from '../../../authToken';
@@ -430,6 +430,150 @@ describe('Answer service tests', () => {
430
430
  );
431
431
  });
432
432
 
433
+ test('getUnderlyingDataForPoint should apply sort in order with mapped answer column ids and directions', async () => {
434
+ fetchMock.mockResponses(
435
+ JSON.stringify({
436
+ data: {
437
+ getSourceDetailById: [{
438
+ columns: [{ id: 'id1', name: 'col1' }, { id: 'id2', name: 'col2' }],
439
+ }],
440
+ },
441
+ }),
442
+ JSON.stringify({
443
+ data: {
444
+ Answer__getUnaggregatedAnswer: {
445
+ id: { ...defaultSession },
446
+ answer: {
447
+ visualizations: [{
448
+ columns: [{
449
+ column: {
450
+ id: 'oid1',
451
+ name: 'col1',
452
+ referencedColumns: [{ guid: 'id1' }],
453
+ },
454
+ }, {
455
+ column: {
456
+ id: 'oid2',
457
+ name: 'col2',
458
+ referencedColumns: [{ guid: 'id2' }],
459
+ },
460
+ }],
461
+ }],
462
+ },
463
+ },
464
+ },
465
+ }),
466
+ JSON.stringify({
467
+ data: {
468
+ getAnswer: {
469
+ id: { genNo: 2 },
470
+ answer: {
471
+ visualizations: [{
472
+ columns: [{
473
+ column: {
474
+ id: 'oid1',
475
+ name: 'col1',
476
+ referencedColumns: [{ guid: 'id1' }],
477
+ },
478
+ }, {
479
+ column: {
480
+ id: 'oid2',
481
+ name: 'col2',
482
+ referencedColumns: [{ guid: 'id2' }],
483
+ },
484
+ }],
485
+ }],
486
+ },
487
+ },
488
+ },
489
+ }),
490
+ JSON.stringify({
491
+ data: {
492
+ Answer__updateSort: {
493
+ id: { genNo: 3 },
494
+ },
495
+ },
496
+ }),
497
+ );
498
+ const answerService = createAnswerService({
499
+ sources: [{ header: { guid: 'sortUnderlyingSource' } }],
500
+ }, [{
501
+ selectedAttributes: [{
502
+ column: { id: 'oid1', name: 'col1', dataType: 'CHAR' },
503
+ value: '1',
504
+ }],
505
+ selectedMeasures: [],
506
+ }]);
507
+ await answerService.getUnderlyingDataForPoint(
508
+ ['col1', 'col2'],
509
+ undefined,
510
+ [{ columnName: 'col2', ascending: true }, { columnName: 'col1', ascending: false }],
511
+ );
512
+ expect(fetchMock).toHaveBeenCalledWith(
513
+ 'https://tshost/prism/?op=UpdateSort',
514
+ expect.objectContaining({
515
+ body: JSON.stringify({
516
+ operationName: 'UpdateSort',
517
+ query: updateSort,
518
+ variables: {
519
+ session: { ...defaultSession, genNo: 2 },
520
+ sortOrder: [{
521
+ columnId: 'oid2',
522
+ sortType: 'ASCENDING',
523
+ }, {
524
+ columnId: 'oid1',
525
+ sortType: 'DESCENDING',
526
+ }],
527
+ },
528
+ }),
529
+ }),
530
+ );
531
+ });
532
+
533
+ test('getUnderlyingDataForPoint should not call sort when sortOptions omitted', async () => {
534
+ fetchMock.mockResponses(
535
+ JSON.stringify({
536
+ data: {
537
+ getSourceDetailById: [{
538
+ columns: [{ id: 'id1', name: 'col1' }],
539
+ }],
540
+ },
541
+ }),
542
+ JSON.stringify({
543
+ data: {
544
+ Answer__getUnaggregatedAnswer: {
545
+ id: { ...defaultSession },
546
+ answer: {
547
+ visualizations: [{
548
+ columns: [{
549
+ column: {
550
+ id: 'oid1',
551
+ name: 'col1',
552
+ referencedColumns: [{ guid: 'id1' }],
553
+ },
554
+ }],
555
+ }],
556
+ },
557
+ },
558
+ },
559
+ }),
560
+ );
561
+ const answerService = createAnswerService({
562
+ sources: [{ header: { guid: 'noSortSource' } }],
563
+ }, [{
564
+ selectedAttributes: [{
565
+ column: { id: 'oid1', name: 'col1', dataType: 'CHAR' },
566
+ value: '1',
567
+ }],
568
+ selectedMeasures: [],
569
+ }]);
570
+ await answerService.getUnderlyingDataForPoint(['col1']);
571
+ expect(fetchMock).not.toHaveBeenCalledWith(
572
+ 'https://tshost/prism/?op=UpdateSort',
573
+ expect.anything(),
574
+ );
575
+ });
576
+
433
577
  test('Should fetch answer if not passed', async () => {
434
578
  fetchMock.mockResponses(JSON.stringify({
435
579
  data: {
@@ -24,6 +24,22 @@ export interface UnderlyingDataPoint {
24
24
  dataValue: any;
25
25
  }
26
26
 
27
+ /**
28
+ * Describes how to sort a column when fetching data. Pass an array of these to
29
+ * sort by multiple columns, in priority order.
30
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.12.0.cl
31
+ */
32
+ export interface SortOptions {
33
+ /**
34
+ * Name of the column to sort by. The column must exist in the data source.
35
+ */
36
+ columnName: string;
37
+ /**
38
+ * Sort direction. `true` sorts ascending, `false` sorts descending.
39
+ */
40
+ ascending: boolean;
41
+ }
42
+
27
43
  export const DATA_TYPES = ['DATE', 'DATE_TIME', 'TIME'];
28
44
 
29
45
  /**
@@ -195,6 +211,30 @@ export class AnswerService {
195
211
  );
196
212
  }
197
213
 
214
+ /**
215
+ * Adapt the sort options into the `updateSort` payload and send it.
216
+ * @param sortOptions Columns to sort by, each with a direction.
217
+ * @param sourceDetail
218
+ */
219
+ private async adaptSorting(sortOptions: SortOptions[], sourceDetail: any) {
220
+ const { answer } = await this.executeQuery(queries.getAnswer, {});
221
+ const guidToColumnId = getGuidToColumnIdMap(answer);
222
+ const sortOrder = sortOptions.map((sort) => {
223
+ const guid = getGuidsFromColumnNames(sourceDetail, [sort.columnName])
224
+ .values().next().value;
225
+ return {
226
+ columnId: guidToColumnId.get(guid),
227
+ sortType: sort.ascending ? 'ASCENDING' : 'DESCENDING',
228
+ };
229
+ });
230
+ return this.executeQuery(
231
+ queries.updateSort,
232
+ {
233
+ sortOrder,
234
+ },
235
+ );
236
+ }
237
+
198
238
  public async updateDisplayMode(displayMode = "TABLE_MODE") {
199
239
  return this.executeQuery(
200
240
  queries.updateDisplayMode,
@@ -304,12 +344,15 @@ export class AnswerService {
304
344
  * automatically passed.
305
345
  * @param outputColumnNames
306
346
  * @param selectedPoints
347
+ * @param sortOptions Optional columns to sort the underlying data by.
307
348
  * @example
308
349
  * ```js
309
350
  * embed.on(EmbedEvent.CustomAction, e => {
310
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
311
- * 'col name 1' // The column should exist in the data source.
312
- * ]);
351
+ * const underlying = await e.answerService.getUnderlyingDataForPoint(
352
+ * ['col name 1'], // The column should exist in the data source.
353
+ * undefined,
354
+ * [{ columnName: 'col name 1', ascending: true }],
355
+ * );
313
356
  * const data = await underlying.fetchData(0, 100);
314
357
  * })
315
358
  * ```
@@ -318,6 +361,7 @@ export class AnswerService {
318
361
  public async getUnderlyingDataForPoint(
319
362
  outputColumnNames: string[],
320
363
  selectedPoints?: UnderlyingDataPoint[],
364
+ sortOptions?: SortOptions[],
321
365
  ): Promise<AnswerService> {
322
366
  if (!selectedPoints && !this.selectedPoints) {
323
367
  throw new Error('Needs to be triggered in context of a point');
@@ -361,6 +405,10 @@ export class AnswerService {
361
405
  await unaggAnswerSession.removeColumns(columnsToRemove);
362
406
  }
363
407
 
408
+ if (sortOptions?.length) {
409
+ await unaggAnswerSession.adaptSorting(sortOptions, sourceDetail);
410
+ }
411
+
364
412
  return unaggAnswerSession;
365
413
  }
366
414
 
@@ -437,6 +485,20 @@ export class AnswerService {
437
485
  }
438
486
  }
439
487
 
488
+ /**
489
+ * Build a map from a source column guid to the answer's viz column id, using
490
+ * the `referencedColumns` link on each viz column.
491
+ * @param answer
492
+ */
493
+ function getGuidToColumnIdMap(answer: any): Map<string, string> {
494
+ const tableViz = answer.visualizations.find((viz: any) => viz.columns);
495
+ return new Map(
496
+ tableViz.columns.map(
497
+ (col: any) => [col.column.referencedColumns[0].guid, col.column.id],
498
+ ),
499
+ );
500
+ }
501
+
440
502
  /**
441
503
  *
442
504
  * @param sourceDetail