@thoughtspot/visual-embed-sdk 1.52.2-beta.1 → 1.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +373 -5
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/app.d.ts +14 -0
  5. package/cjs/src/embed/app.d.ts.map +1 -1
  6. package/cjs/src/embed/app.js +6 -3
  7. package/cjs/src/embed/app.js.map +1 -1
  8. package/cjs/src/embed/app.spec.js +28 -0
  9. package/cjs/src/embed/app.spec.js.map +1 -1
  10. package/cjs/src/embed/auto-frame-renderer.d.ts.map +1 -1
  11. package/cjs/src/embed/auto-frame-renderer.js +244 -4
  12. package/cjs/src/embed/auto-frame-renderer.js.map +1 -1
  13. package/cjs/src/embed/auto-frame-renderer.spec.js +389 -0
  14. package/cjs/src/embed/auto-frame-renderer.spec.js.map +1 -1
  15. package/cjs/src/embed/bodyless-conversation.js +1 -1
  16. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  17. package/cjs/src/embed/conversation.d.ts +15 -0
  18. package/cjs/src/embed/conversation.d.ts.map +1 -1
  19. package/cjs/src/embed/conversation.js +7 -3
  20. package/cjs/src/embed/conversation.js.map +1 -1
  21. package/cjs/src/embed/conversation.spec.js +66 -0
  22. package/cjs/src/embed/conversation.spec.js.map +1 -1
  23. package/cjs/src/embed/liveboard-override-utils.d.ts +59 -0
  24. package/cjs/src/embed/liveboard-override-utils.d.ts.map +1 -0
  25. package/cjs/src/embed/liveboard-override-utils.js +19 -0
  26. package/cjs/src/embed/liveboard-override-utils.js.map +1 -0
  27. package/cjs/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  28. package/cjs/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  29. package/cjs/src/embed/liveboard-override-utils.spec.js +34 -0
  30. package/cjs/src/embed/liveboard-override-utils.spec.js.map +1 -0
  31. package/cjs/src/embed/liveboard.d.ts +43 -1
  32. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  33. package/cjs/src/embed/liveboard.js +11 -18
  34. package/cjs/src/embed/liveboard.js.map +1 -1
  35. package/cjs/src/embed/liveboard.spec.js +104 -54
  36. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  37. package/cjs/src/embed/search-bar.js +1 -1
  38. package/cjs/src/embed/search-bar.js.map +1 -1
  39. package/cjs/src/embed/search.js +1 -1
  40. package/cjs/src/embed/search.js.map +1 -1
  41. package/cjs/src/embed/search.spec.js +20 -0
  42. package/cjs/src/embed/search.spec.js.map +1 -1
  43. package/cjs/src/embed/spotter-utils.d.ts +11 -0
  44. package/cjs/src/embed/spotter-utils.d.ts.map +1 -1
  45. package/cjs/src/embed/spotter-utils.js +13 -1
  46. package/cjs/src/embed/spotter-utils.js.map +1 -1
  47. package/cjs/src/embed/spotter-viz-utils.d.ts +15 -0
  48. package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
  49. package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
  50. package/cjs/src/embed/spotter-viz-utils.spec.js +11 -0
  51. package/cjs/src/embed/spotter-viz-utils.spec.js.map +1 -1
  52. package/cjs/src/embed/ts-embed.d.ts +27 -34
  53. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  54. package/cjs/src/embed/ts-embed.js +224 -102
  55. package/cjs/src/embed/ts-embed.js.map +1 -1
  56. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  57. package/cjs/src/embed/ts-embed.spec.js +543 -171
  58. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  59. package/cjs/src/index.d.ts +4 -2
  60. package/cjs/src/index.d.ts.map +1 -1
  61. package/cjs/src/index.js +4 -2
  62. package/cjs/src/index.js.map +1 -1
  63. package/cjs/src/mixpanel-service.d.ts +1 -0
  64. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  65. package/cjs/src/mixpanel-service.js +1 -0
  66. package/cjs/src/mixpanel-service.js.map +1 -1
  67. package/cjs/src/react/all-types-export.d.ts +1 -1
  68. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  69. package/cjs/src/react/all-types-export.js +2 -1
  70. package/cjs/src/react/all-types-export.js.map +1 -1
  71. package/cjs/src/types.d.ts +182 -2
  72. package/cjs/src/types.d.ts.map +1 -1
  73. package/cjs/src/types.js +109 -0
  74. package/cjs/src/types.js.map +1 -1
  75. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  76. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  77. package/cjs/src/utils/graphql/answerService/answer-queries.js +8 -1
  78. package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  79. package/cjs/src/utils/graphql/answerService/answerService.d.ts +28 -4
  80. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  81. package/cjs/src/utils/graphql/answerService/answerService.js +39 -4
  82. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  83. package/cjs/src/utils/graphql/answerService/answerService.spec.js +124 -0
  84. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  85. package/dist/{index-Bt56pC82.js → index-CyDR8j_0.js} +1 -1
  86. package/dist/src/css-variables.d.ts +373 -5
  87. package/dist/src/css-variables.d.ts.map +1 -1
  88. package/dist/src/embed/app.d.ts +14 -0
  89. package/dist/src/embed/app.d.ts.map +1 -1
  90. package/dist/src/embed/auto-frame-renderer.d.ts.map +1 -1
  91. package/dist/src/embed/conversation.d.ts +15 -0
  92. package/dist/src/embed/conversation.d.ts.map +1 -1
  93. package/dist/src/embed/liveboard-override-utils.d.ts +59 -0
  94. package/dist/src/embed/liveboard-override-utils.d.ts.map +1 -0
  95. package/dist/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  96. package/dist/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  97. package/dist/src/embed/liveboard.d.ts +43 -1
  98. package/dist/src/embed/liveboard.d.ts.map +1 -1
  99. package/dist/src/embed/spotter-utils.d.ts +11 -0
  100. package/dist/src/embed/spotter-utils.d.ts.map +1 -1
  101. package/dist/src/embed/spotter-viz-utils.d.ts +15 -0
  102. package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
  103. package/dist/src/embed/ts-embed.d.ts +27 -34
  104. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  105. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  106. package/dist/src/index.d.ts +4 -2
  107. package/dist/src/index.d.ts.map +1 -1
  108. package/dist/src/mixpanel-service.d.ts +1 -0
  109. package/dist/src/mixpanel-service.d.ts.map +1 -1
  110. package/dist/src/react/all-types-export.d.ts +1 -1
  111. package/dist/src/react/all-types-export.d.ts.map +1 -1
  112. package/dist/src/types.d.ts +182 -2
  113. package/dist/src/types.d.ts.map +1 -1
  114. package/dist/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  115. package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  116. package/dist/src/utils/graphql/answerService/answerService.d.ts +28 -4
  117. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  118. package/dist/tsembed-react.es.js +437 -175
  119. package/dist/tsembed-react.js +436 -174
  120. package/dist/tsembed.es.js +680 -180
  121. package/dist/tsembed.js +678 -178
  122. package/dist/visual-embed-sdk-react-full.d.ts +702 -44
  123. package/dist/visual-embed-sdk-react.d.ts +697 -44
  124. package/dist/visual-embed-sdk.d.ts +729 -45
  125. package/lib/package.json +1 -1
  126. package/lib/src/css-variables.d.ts +373 -5
  127. package/lib/src/css-variables.d.ts.map +1 -1
  128. package/lib/src/embed/app.d.ts +14 -0
  129. package/lib/src/embed/app.d.ts.map +1 -1
  130. package/lib/src/embed/app.js +7 -4
  131. package/lib/src/embed/app.js.map +1 -1
  132. package/lib/src/embed/app.spec.js +28 -0
  133. package/lib/src/embed/app.spec.js.map +1 -1
  134. package/lib/src/embed/auto-frame-renderer.d.ts.map +1 -1
  135. package/lib/src/embed/auto-frame-renderer.js +244 -4
  136. package/lib/src/embed/auto-frame-renderer.js.map +1 -1
  137. package/lib/src/embed/auto-frame-renderer.spec.js +389 -0
  138. package/lib/src/embed/auto-frame-renderer.spec.js.map +1 -1
  139. package/lib/src/embed/bodyless-conversation.js +1 -1
  140. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  141. package/lib/src/embed/conversation.d.ts +15 -0
  142. package/lib/src/embed/conversation.d.ts.map +1 -1
  143. package/lib/src/embed/conversation.js +8 -4
  144. package/lib/src/embed/conversation.js.map +1 -1
  145. package/lib/src/embed/conversation.spec.js +67 -1
  146. package/lib/src/embed/conversation.spec.js.map +1 -1
  147. package/lib/src/embed/liveboard-override-utils.d.ts +59 -0
  148. package/lib/src/embed/liveboard-override-utils.d.ts.map +1 -0
  149. package/lib/src/embed/liveboard-override-utils.js +15 -0
  150. package/lib/src/embed/liveboard-override-utils.js.map +1 -0
  151. package/lib/src/embed/liveboard-override-utils.spec.d.ts +2 -0
  152. package/lib/src/embed/liveboard-override-utils.spec.d.ts.map +1 -0
  153. package/lib/src/embed/liveboard-override-utils.spec.js +32 -0
  154. package/lib/src/embed/liveboard-override-utils.spec.js.map +1 -0
  155. package/lib/src/embed/liveboard.d.ts +43 -1
  156. package/lib/src/embed/liveboard.d.ts.map +1 -1
  157. package/lib/src/embed/liveboard.js +11 -17
  158. package/lib/src/embed/liveboard.js.map +1 -1
  159. package/lib/src/embed/liveboard.spec.js +104 -54
  160. package/lib/src/embed/liveboard.spec.js.map +1 -1
  161. package/lib/src/embed/search-bar.js +1 -1
  162. package/lib/src/embed/search-bar.js.map +1 -1
  163. package/lib/src/embed/search.js +1 -1
  164. package/lib/src/embed/search.js.map +1 -1
  165. package/lib/src/embed/search.spec.js +20 -0
  166. package/lib/src/embed/search.spec.js.map +1 -1
  167. package/lib/src/embed/spotter-utils.d.ts +11 -0
  168. package/lib/src/embed/spotter-utils.d.ts.map +1 -1
  169. package/lib/src/embed/spotter-utils.js +12 -0
  170. package/lib/src/embed/spotter-utils.js.map +1 -1
  171. package/lib/src/embed/spotter-viz-utils.d.ts +15 -0
  172. package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
  173. package/lib/src/embed/spotter-viz-utils.js.map +1 -1
  174. package/lib/src/embed/spotter-viz-utils.spec.js +11 -0
  175. package/lib/src/embed/spotter-viz-utils.spec.js.map +1 -1
  176. package/lib/src/embed/ts-embed.d.ts +27 -34
  177. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  178. package/lib/src/embed/ts-embed.js +224 -102
  179. package/lib/src/embed/ts-embed.js.map +1 -1
  180. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  181. package/lib/src/embed/ts-embed.spec.js +544 -172
  182. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  183. package/lib/src/index.d.ts +4 -2
  184. package/lib/src/index.d.ts.map +1 -1
  185. package/lib/src/index.js +3 -2
  186. package/lib/src/index.js.map +1 -1
  187. package/lib/src/mixpanel-service.d.ts +1 -0
  188. package/lib/src/mixpanel-service.d.ts.map +1 -1
  189. package/lib/src/mixpanel-service.js +1 -0
  190. package/lib/src/mixpanel-service.js.map +1 -1
  191. package/lib/src/react/all-types-export.d.ts +1 -1
  192. package/lib/src/react/all-types-export.d.ts.map +1 -1
  193. package/lib/src/react/all-types-export.js +1 -1
  194. package/lib/src/react/all-types-export.js.map +1 -1
  195. package/lib/src/types.d.ts +182 -2
  196. package/lib/src/types.d.ts.map +1 -1
  197. package/lib/src/types.js +109 -0
  198. package/lib/src/types.js.map +1 -1
  199. package/lib/src/utils/graphql/answerService/answer-queries.d.ts +1 -0
  200. package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  201. package/lib/src/utils/graphql/answerService/answer-queries.js +7 -0
  202. package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  203. package/lib/src/utils/graphql/answerService/answerService.d.ts +28 -4
  204. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  205. package/lib/src/utils/graphql/answerService/answerService.js +39 -4
  206. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  207. package/lib/src/utils/graphql/answerService/answerService.spec.js +125 -1
  208. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  209. package/lib/src/visual-embed-sdk.d.ts +729 -45
  210. package/package.json +1 -1
  211. package/src/css-variables.ts +475 -26
  212. package/src/embed/app.spec.ts +32 -0
  213. package/src/embed/app.ts +28 -4
  214. package/src/embed/auto-frame-renderer.spec.ts +464 -0
  215. package/src/embed/auto-frame-renderer.ts +305 -6
  216. package/src/embed/bodyless-conversation.ts +1 -1
  217. package/src/embed/conversation.spec.ts +94 -1
  218. package/src/embed/conversation.ts +28 -3
  219. package/src/embed/liveboard-override-utils.spec.ts +38 -0
  220. package/src/embed/liveboard-override-utils.ts +71 -0
  221. package/src/embed/liveboard.spec.ts +119 -62
  222. package/src/embed/liveboard.ts +56 -21
  223. package/src/embed/search-bar.tsx +1 -1
  224. package/src/embed/search.spec.ts +23 -0
  225. package/src/embed/search.ts +1 -1
  226. package/src/embed/spotter-utils.ts +12 -0
  227. package/src/embed/spotter-viz-utils.spec.ts +11 -0
  228. package/src/embed/spotter-viz-utils.ts +15 -0
  229. package/src/embed/ts-embed.spec.ts +684 -213
  230. package/src/embed/ts-embed.ts +227 -97
  231. package/src/index.ts +16 -1
  232. package/src/mixpanel-service.ts +1 -0
  233. package/src/react/all-types-export.ts +6 -0
  234. package/src/types.ts +186 -5
  235. package/src/utils/graphql/answerService/answer-queries.ts +8 -0
  236. package/src/utils/graphql/answerService/answerService.spec.ts +145 -1
  237. package/src/utils/graphql/answerService/answerService.ts +65 -3
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,35 @@ 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',
5334
5465
  /**
5335
5466
  * Trigger the **Copy link** action on a Liveboard or visualization
5336
5467
  * Payload: {@link VizScopedRequest}.
@@ -6904,6 +7035,22 @@ export enum DataSourceVisualMode {
6904
7035
 
6905
7036
  export enum Param {
6906
7037
  Tsmcp = 'tsmcp',
7038
+ /**
7039
+ * Marker added by a host app replaying a stored conversation. Carries the
7040
+ * analytical session (conversation) identifier, from which the renderer
7041
+ * resolves the answer's current session parameters. Stripped before the
7042
+ * URL reaches the ThoughtSpot application.
7043
+ * @version SDK: 1.52.2 | ThoughtSpot Cloud: 26.9.0.cl
7044
+ */
7045
+ TsmcpConversationId = 'tsmcpConversationId',
7046
+ /**
7047
+ * Zero-based position of the answer within the conversation, counting only
7048
+ * non-thinking answer items in message order. Accompanies
7049
+ * {@link TsmcpConversationId}; defaults to 0 when absent. Stripped before
7050
+ * the URL reaches the ThoughtSpot application.
7051
+ * @version SDK: 1.52.2 | ThoughtSpot Cloud: 26.9.0.cl
7052
+ */
7053
+ TsmcpAnswerIndex = 'tsmcpAnswerIndex',
6907
7054
  EmbedApp = 'embedApp',
6908
7055
  DataSources = 'dataSources',
6909
7056
  DataSourceMode = 'dataSourceMode',
@@ -7067,6 +7214,9 @@ export enum Param {
7067
7214
  SpotterDataSources = 'spotterDataSources',
7068
7215
  OpenSpotterOnLiveboardByDefault = 'openSpotterOnLiveboardByDefault',
7069
7216
  ShowAnswerEditPanel = 'showAnswerEditPanel',
7217
+ IsDarkMode = 'isDarkMode',
7218
+ RadiantThemeEnabled = 'radiantThemeEnabled',
7219
+ SpotterExperienceVersion = 'spotterExperienceVersion',
7070
7220
  }
7071
7221
 
7072
7222
  /**
@@ -7530,12 +7680,43 @@ export enum Action {
7530
7680
  * The *Edit* action on the Liveboard page and in the
7531
7681
  * visualization menu.
7532
7682
  * Opens a Liveboard or visualization in edit mode.
7683
+ *
7684
+ * Controls both surfaces together. To target one surface only, use
7685
+ * {@link Action.EditLiveboard} or {@link Action.EditVisualization}.
7533
7686
  * @example
7534
7687
  * ```js
7535
7688
  * disabledActions: [Action.Edit]
7536
7689
  * ```
7537
7690
  */
7538
7691
  Edit = 'edit',
7692
+ /**
7693
+ * The *Edit* action on the Liveboard page only.
7694
+ * Opens a Liveboard in edit mode.
7695
+ *
7696
+ * Does not affect the *Edit* action in the visualization menu; use
7697
+ * {@link Action.EditVisualization} for that, or {@link Action.Edit} to
7698
+ * control both surfaces together.
7699
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
7700
+ * @example
7701
+ * ```js
7702
+ * disabledActions: [Action.EditLiveboard]
7703
+ * ```
7704
+ */
7705
+ EditLiveboard = 'editLiveboard',
7706
+ /**
7707
+ * The *Edit* action in the visualization `...` menu only.
7708
+ * Opens a visualization in the editor.
7709
+ *
7710
+ * Does not affect the *Edit* action on the Liveboard page; use
7711
+ * {@link Action.EditLiveboard} for that, or {@link Action.Edit} to
7712
+ * control both surfaces together.
7713
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
7714
+ * @example
7715
+ * ```js
7716
+ * disabledActions: [Action.EditVisualization]
7717
+ * ```
7718
+ */
7719
+ EditVisualization = 'editVisualization',
7539
7720
  /**
7540
7721
  * The text edit option for Liveboard and visualization titles.
7541
7722
  * @example
@@ -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