@thoughtspot/visual-embed-sdk 1.50.0 → 1.50.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 (188) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +59 -0
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/app.d.ts +31 -2
  5. package/cjs/src/embed/app.d.ts.map +1 -1
  6. package/cjs/src/embed/app.js +13 -2
  7. package/cjs/src/embed/app.js.map +1 -1
  8. package/cjs/src/embed/app.spec.js +101 -0
  9. package/cjs/src/embed/app.spec.js.map +1 -1
  10. package/cjs/src/embed/conversation.d.ts +26 -0
  11. package/cjs/src/embed/conversation.d.ts.map +1 -1
  12. package/cjs/src/embed/conversation.js +12 -2
  13. package/cjs/src/embed/conversation.js.map +1 -1
  14. package/cjs/src/embed/conversation.spec.js +23 -0
  15. package/cjs/src/embed/conversation.spec.js.map +1 -1
  16. package/cjs/src/embed/events.spec.js +593 -0
  17. package/cjs/src/embed/events.spec.js.map +1 -1
  18. package/cjs/src/embed/host-events.spec.js +106 -0
  19. package/cjs/src/embed/host-events.spec.js.map +1 -1
  20. package/cjs/src/embed/hostEventClient/contracts.d.ts +36 -14
  21. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  22. package/cjs/src/embed/hostEventClient/contracts.js +10 -1
  23. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
  24. package/cjs/src/embed/hostEventClient/host-event-client.d.ts +1 -0
  25. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  26. package/cjs/src/embed/hostEventClient/host-event-client.js +8 -0
  27. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  28. package/cjs/src/embed/hostEventClient/host-event-client.spec.js +209 -0
  29. package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  30. package/cjs/src/embed/hostEventClient/utils.d.ts +2 -0
  31. package/cjs/src/embed/hostEventClient/utils.d.ts.map +1 -1
  32. package/cjs/src/embed/hostEventClient/utils.js +32 -2
  33. package/cjs/src/embed/hostEventClient/utils.js.map +1 -1
  34. package/cjs/src/embed/hostEventClient/utils.spec.js +178 -0
  35. package/cjs/src/embed/hostEventClient/utils.spec.js.map +1 -1
  36. package/cjs/src/embed/liveboard.d.ts +6 -0
  37. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  38. package/cjs/src/embed/liveboard.js.map +1 -1
  39. package/cjs/src/embed/spotter-viz-utils.d.ts +34 -0
  40. package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
  41. package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
  42. package/cjs/src/embed/spotter-viz-utils.spec.js +17 -0
  43. package/cjs/src/embed/spotter-viz-utils.spec.js.map +1 -1
  44. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  45. package/cjs/src/embed/ts-embed.js +14 -7
  46. package/cjs/src/embed/ts-embed.js.map +1 -1
  47. package/cjs/src/embed/ts-embed.spec.js +146 -0
  48. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  49. package/cjs/src/errors.d.ts +1 -0
  50. package/cjs/src/errors.d.ts.map +1 -1
  51. package/cjs/src/errors.js +1 -0
  52. package/cjs/src/errors.js.map +1 -1
  53. package/cjs/src/index.d.ts +2 -2
  54. package/cjs/src/index.d.ts.map +1 -1
  55. package/cjs/src/index.js +3 -2
  56. package/cjs/src/index.js.map +1 -1
  57. package/cjs/src/react/util.spec.js +251 -0
  58. package/cjs/src/react/util.spec.js.map +1 -1
  59. package/cjs/src/types.d.ts +119 -2
  60. package/cjs/src/types.d.ts.map +1 -1
  61. package/cjs/src/types.js +97 -0
  62. package/cjs/src/types.js.map +1 -1
  63. package/cjs/src/utils/processData.spec.js +93 -0
  64. package/cjs/src/utils/processData.spec.js.map +1 -1
  65. package/cjs/src/utils/processTrigger.spec.js +61 -0
  66. package/cjs/src/utils/processTrigger.spec.js.map +1 -1
  67. package/dist/{index-B5xoN6Cp.js → index-fCne7kmU.js} +1 -1
  68. package/dist/src/css-variables.d.ts +59 -0
  69. package/dist/src/css-variables.d.ts.map +1 -1
  70. package/dist/src/embed/app.d.ts +31 -2
  71. package/dist/src/embed/app.d.ts.map +1 -1
  72. package/dist/src/embed/conversation.d.ts +26 -0
  73. package/dist/src/embed/conversation.d.ts.map +1 -1
  74. package/dist/src/embed/hostEventClient/contracts.d.ts +36 -14
  75. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  76. package/dist/src/embed/hostEventClient/host-event-client.d.ts +1 -0
  77. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  78. package/dist/src/embed/hostEventClient/utils.d.ts +2 -0
  79. package/dist/src/embed/hostEventClient/utils.d.ts.map +1 -1
  80. package/dist/src/embed/liveboard.d.ts +6 -0
  81. package/dist/src/embed/liveboard.d.ts.map +1 -1
  82. package/dist/src/embed/spotter-viz-utils.d.ts +34 -0
  83. package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
  84. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  85. package/dist/src/errors.d.ts +1 -0
  86. package/dist/src/errors.d.ts.map +1 -1
  87. package/dist/src/index.d.ts +2 -2
  88. package/dist/src/index.d.ts.map +1 -1
  89. package/dist/src/types.d.ts +119 -2
  90. package/dist/src/types.d.ts.map +1 -1
  91. package/dist/tsembed-react.es.js +389 -84
  92. package/dist/tsembed-react.js +388 -83
  93. package/dist/tsembed.es.js +390 -85
  94. package/dist/tsembed.js +388 -83
  95. package/dist/visual-embed-sdk-react-full.d.ts +302 -17
  96. package/dist/visual-embed-sdk-react.d.ts +302 -17
  97. package/dist/visual-embed-sdk.d.ts +306 -17
  98. package/lib/package.json +1 -1
  99. package/lib/src/css-variables.d.ts +59 -0
  100. package/lib/src/css-variables.d.ts.map +1 -1
  101. package/lib/src/embed/app.d.ts +31 -2
  102. package/lib/src/embed/app.d.ts.map +1 -1
  103. package/lib/src/embed/app.js +13 -2
  104. package/lib/src/embed/app.js.map +1 -1
  105. package/lib/src/embed/app.spec.js +101 -0
  106. package/lib/src/embed/app.spec.js.map +1 -1
  107. package/lib/src/embed/conversation.d.ts +26 -0
  108. package/lib/src/embed/conversation.d.ts.map +1 -1
  109. package/lib/src/embed/conversation.js +11 -1
  110. package/lib/src/embed/conversation.js.map +1 -1
  111. package/lib/src/embed/conversation.spec.js +24 -1
  112. package/lib/src/embed/conversation.spec.js.map +1 -1
  113. package/lib/src/embed/events.spec.js +593 -0
  114. package/lib/src/embed/events.spec.js.map +1 -1
  115. package/lib/src/embed/host-events.spec.js +107 -1
  116. package/lib/src/embed/host-events.spec.js.map +1 -1
  117. package/lib/src/embed/hostEventClient/contracts.d.ts +36 -14
  118. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  119. package/lib/src/embed/hostEventClient/contracts.js +9 -0
  120. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  121. package/lib/src/embed/hostEventClient/host-event-client.d.ts +1 -0
  122. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  123. package/lib/src/embed/hostEventClient/host-event-client.js +9 -1
  124. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  125. package/lib/src/embed/hostEventClient/host-event-client.spec.js +209 -0
  126. package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  127. package/lib/src/embed/hostEventClient/utils.d.ts +2 -0
  128. package/lib/src/embed/hostEventClient/utils.d.ts.map +1 -1
  129. package/lib/src/embed/hostEventClient/utils.js +28 -1
  130. package/lib/src/embed/hostEventClient/utils.js.map +1 -1
  131. package/lib/src/embed/hostEventClient/utils.spec.js +179 -1
  132. package/lib/src/embed/hostEventClient/utils.spec.js.map +1 -1
  133. package/lib/src/embed/liveboard.d.ts +6 -0
  134. package/lib/src/embed/liveboard.d.ts.map +1 -1
  135. package/lib/src/embed/liveboard.js.map +1 -1
  136. package/lib/src/embed/spotter-viz-utils.d.ts +34 -0
  137. package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
  138. package/lib/src/embed/spotter-viz-utils.js.map +1 -1
  139. package/lib/src/embed/spotter-viz-utils.spec.js +17 -0
  140. package/lib/src/embed/spotter-viz-utils.spec.js.map +1 -1
  141. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  142. package/lib/src/embed/ts-embed.js +14 -7
  143. package/lib/src/embed/ts-embed.js.map +1 -1
  144. package/lib/src/embed/ts-embed.spec.js +146 -0
  145. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  146. package/lib/src/errors.d.ts +1 -0
  147. package/lib/src/errors.d.ts.map +1 -1
  148. package/lib/src/errors.js +1 -0
  149. package/lib/src/errors.js.map +1 -1
  150. package/lib/src/index.d.ts +2 -2
  151. package/lib/src/index.d.ts.map +1 -1
  152. package/lib/src/index.js +2 -2
  153. package/lib/src/index.js.map +1 -1
  154. package/lib/src/react/util.spec.js +251 -0
  155. package/lib/src/react/util.spec.js.map +1 -1
  156. package/lib/src/types.d.ts +119 -2
  157. package/lib/src/types.d.ts.map +1 -1
  158. package/lib/src/types.js +97 -0
  159. package/lib/src/types.js.map +1 -1
  160. package/lib/src/utils/processData.spec.js +93 -0
  161. package/lib/src/utils/processData.spec.js.map +1 -1
  162. package/lib/src/utils/processTrigger.spec.js +61 -0
  163. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  164. package/lib/src/visual-embed-sdk.d.ts +306 -17
  165. package/package.json +1 -1
  166. package/src/css-variables.ts +73 -0
  167. package/src/embed/app.spec.ts +140 -0
  168. package/src/embed/app.ts +38 -2
  169. package/src/embed/conversation.spec.ts +32 -1
  170. package/src/embed/conversation.ts +29 -0
  171. package/src/embed/events.spec.ts +705 -1
  172. package/src/embed/host-events.spec.ts +124 -0
  173. package/src/embed/hostEventClient/contracts.ts +41 -14
  174. package/src/embed/hostEventClient/host-event-client.spec.ts +326 -0
  175. package/src/embed/hostEventClient/host-event-client.ts +15 -0
  176. package/src/embed/hostEventClient/utils.spec.ts +204 -0
  177. package/src/embed/hostEventClient/utils.ts +37 -10
  178. package/src/embed/liveboard.ts +6 -0
  179. package/src/embed/spotter-viz-utils.spec.ts +17 -0
  180. package/src/embed/spotter-viz-utils.ts +34 -0
  181. package/src/embed/ts-embed.spec.ts +186 -0
  182. package/src/embed/ts-embed.ts +12 -4
  183. package/src/errors.ts +1 -0
  184. package/src/index.ts +2 -1
  185. package/src/react/util.spec.tsx +255 -0
  186. package/src/types.ts +119 -0
  187. package/src/utils/processData.spec.ts +97 -0
  188. package/src/utils/processTrigger.spec.ts +91 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.50.0",
3
+ "version": "1.50.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -499,6 +499,16 @@ export interface CustomCssVariables {
499
499
  */
500
500
  '--ts-var-liveboard-tile-background'?: string;
501
501
 
502
+ /**
503
+ * Font color of the insight tiles in the Liveboard.
504
+ */
505
+ '--ts-var-liveboard-insight-tile-font-color'?: string;
506
+
507
+ /**
508
+ * Background color of the insight tiles in the Liveboard.
509
+ */
510
+ '--ts-var-liveboard-insight-tile-background'?: string;
511
+
502
512
  /**
503
513
  * Border radius of the tiles in the Liveboard.
504
514
  */
@@ -1166,6 +1176,11 @@ export interface CustomCssVariables {
1166
1176
  */
1167
1177
  '--ts-var-spotterviz-border-color'?: string;
1168
1178
 
1179
+ /**
1180
+ * Expanded user chat message bubble border color in SpotterViz.
1181
+ */
1182
+ '--ts-var-spotterviz-expanded-border-color'?: string;
1183
+
1169
1184
  /**
1170
1185
  * Background color of the reference-mode toggle button in the SpotterViz
1171
1186
  * chat input when it is unselected and the user hovers over it.
@@ -1185,4 +1200,62 @@ export interface CustomCssVariables {
1185
1200
  * on each referenced-entity chip in the chat input.
1186
1201
  */
1187
1202
  '--ts-var-spotterviz-reference-icon-selected-background'?: string;
1203
+
1204
+ /**
1205
+ * Background color of the shared conversation header (recipient's read-only view).
1206
+ */
1207
+ '--ts-var-shared-conv-header-background'?: string;
1208
+
1209
+ /**
1210
+ * Border color of the shared conversation header.
1211
+ */
1212
+ '--ts-var-shared-conv-header-border-color'?: string;
1213
+
1214
+ /**
1215
+ * Font color of the title text in the shared conversation header.
1216
+ */
1217
+ '--ts-var-shared-conv-title-color'?: string;
1218
+
1219
+ /**
1220
+ * Background gradient color-stop of the share chat header's outer container
1221
+ * (sender's pre-share header). Defaults to transparent.
1222
+ */
1223
+ '--ts-var-share-chat-header-container-background'?: string;
1224
+
1225
+ /**
1226
+ * Background color of the share chat header's inner title/actions row.
1227
+ * Defaults to transparent.
1228
+ */
1229
+ '--ts-var-share-chat-header-background'?: string;
1230
+
1231
+ /**
1232
+ * Font color of the title text in the share chat header.
1233
+ */
1234
+ '--ts-var-share-chat-header-title-color'?: string;
1235
+
1236
+ /**
1237
+ * Font color of the title input field in the share chat header.
1238
+ */
1239
+ '--ts-var-share-chat-header-input-text-color'?: string;
1240
+
1241
+ /**
1242
+ * Background color of the title input field in the share chat header.
1243
+ */
1244
+ '--ts-var-share-chat-header-input-background'?: string;
1245
+
1246
+ /**
1247
+ * Border color of the title input field in the share chat header.
1248
+ */
1249
+ '--ts-var-share-chat-header-input-border-color'?: string;
1250
+
1251
+ /**
1252
+ * Background color of the shimmer loading effect. Also affects the
1253
+ * saved chats sidebar's new-chat shimmer, which shares the same style.
1254
+ */
1255
+ '--ts-var-shimmer-background'?: string;
1256
+
1257
+ /**
1258
+ * Background color of the shimmer sweep animation's gradient mid-stop.
1259
+ */
1260
+ '--ts-var-shimmer-sweep-background'?: string;
1188
1261
  }
@@ -8,6 +8,7 @@ import {
8
8
  HomePage,
9
9
  ListPage,
10
10
  } from './app';
11
+ import { SpotterQueryMode } from './conversation';
11
12
  import { init } from '../index';
12
13
  import { Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp } from '../types';
13
14
  import {
@@ -210,6 +211,7 @@ describe('App embed tests', () => {
210
211
  [Page.Home]: 'home',
211
212
  [Page.SpotIQ]: 'insights/results',
212
213
  [Page.Monitor]: 'insights/monitor-alerts',
214
+ [Page.Collections]: 'collections',
213
215
  };
214
216
 
215
217
  const pageIds = Object.keys(pageRouteMap);
@@ -243,6 +245,7 @@ describe('App embed tests', () => {
243
245
  [Page.Home]: 'home',
244
246
  [Page.SpotIQ]: 'home/spotiq-analysis',
245
247
  [Page.Monitor]: 'home/monitor-alerts',
248
+ [Page.Collections]: 'collections',
246
249
  };
247
250
 
248
251
  const pageIdsForModularHomes = Object.keys(pageRouteMapForModularHome);
@@ -589,6 +592,33 @@ describe('App embed tests', () => {
589
592
  });
590
593
  });
591
594
 
595
+ test('should set defaultQueryMode to research in url', async () => {
596
+ const appEmbed = new AppEmbed(getRootEl(), {
597
+ ...defaultViewConfig,
598
+ defaultQueryMode: SpotterQueryMode.RESEARCH,
599
+ } as AppViewConfig);
600
+ appEmbed.render();
601
+ await executeAfterWait(() => {
602
+ expectUrlMatchesWithParams(
603
+ getIFrameSrc(),
604
+ `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&defaultQueryMode=research${defaultParamsPost}#/home`,
605
+ );
606
+ });
607
+ });
608
+
609
+ test('should not set defaultQueryMode in url when unset', async () => {
610
+ const appEmbed = new AppEmbed(getRootEl(), {
611
+ ...defaultViewConfig,
612
+ } as AppViewConfig);
613
+ appEmbed.render();
614
+ await executeAfterWait(() => {
615
+ expectUrlMatchesWithParams(
616
+ getIFrameSrc(),
617
+ `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false${defaultParamsPost}#/home`,
618
+ );
619
+ });
620
+ });
621
+
592
622
  test('should set hideToolResponseCardBranding to true in url via spotterChatConfig', async () => {
593
623
  const appEmbed = new AppEmbed(getRootEl(), {
594
624
  ...defaultViewConfig,
@@ -1736,6 +1766,116 @@ describe('App embed tests', () => {
1736
1766
  'Please call render before invoking this method',
1737
1767
  );
1738
1768
  });
1769
+
1770
+ describe('overrideHistoryState flag', () => {
1771
+ test('navigateToPage with overrideHistoryState=true should trigger HostEvent.Navigate', async () => {
1772
+ mockMessageChannel();
1773
+ const appEmbed = new AppEmbed(getRootEl(), {
1774
+ frameParams: {
1775
+ width: '100%',
1776
+ height: '100%',
1777
+ },
1778
+ overrideHistoryState: true,
1779
+ });
1780
+ await appEmbed.render();
1781
+
1782
+ const iframe = getIFrameEl();
1783
+ iframe.contentWindow.postMessage = jest.fn();
1784
+ appEmbed.navigateToPage(path, false);
1785
+
1786
+ expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
1787
+ expect.objectContaining({
1788
+ type: HostEvent.Navigate,
1789
+ data: path,
1790
+ }),
1791
+ `http://${thoughtSpotHost}`,
1792
+ expect.anything(),
1793
+ );
1794
+ });
1795
+
1796
+ test('navigateToPage with overrideHistoryState=true and path as number should trigger HostEvent.Navigate', async () => {
1797
+ mockMessageChannel();
1798
+ const appEmbed = new AppEmbed(getRootEl(), {
1799
+ frameParams: {
1800
+ width: '100%',
1801
+ height: '100%',
1802
+ },
1803
+ overrideHistoryState: true,
1804
+ });
1805
+ await appEmbed.render();
1806
+
1807
+ const iframe = getIFrameEl();
1808
+ iframe.contentWindow.postMessage = jest.fn();
1809
+ appEmbed.navigateToPage(-1, false);
1810
+
1811
+ expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
1812
+ expect.objectContaining({
1813
+ type: HostEvent.Navigate,
1814
+ data: -1,
1815
+ }),
1816
+ `http://${thoughtSpotHost}`,
1817
+ expect.anything(),
1818
+ );
1819
+ });
1820
+
1821
+ test('navigateToPage with overrideHistoryState=false and noReload=false should update iframe src', async () => {
1822
+ const appEmbed = new AppEmbed(getRootEl(), {
1823
+ frameParams: {
1824
+ width: '100%',
1825
+ height: '100%',
1826
+ },
1827
+ overrideHistoryState: false,
1828
+ });
1829
+ await appEmbed.render();
1830
+ appEmbed.navigateToPage(path, false);
1831
+
1832
+ expectUrlMatchesWithParams(
1833
+ getIFrameSrc(),
1834
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
1835
+ );
1836
+ });
1837
+
1838
+ test('navigateToPage with overrideHistoryState=undefined and noReload=false should update iframe src', async () => {
1839
+ const appEmbed = new AppEmbed(getRootEl(), {
1840
+ frameParams: {
1841
+ width: '100%',
1842
+ height: '100%',
1843
+ },
1844
+ });
1845
+ await appEmbed.render();
1846
+ appEmbed.navigateToPage(path, false);
1847
+
1848
+ expectUrlMatchesWithParams(
1849
+ getIFrameSrc(),
1850
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
1851
+ );
1852
+ });
1853
+
1854
+ test('navigateToPage respects noReload priority over overrideHistoryState', async () => {
1855
+ mockMessageChannel();
1856
+ const appEmbed = new AppEmbed(getRootEl(), {
1857
+ frameParams: {
1858
+ width: '100%',
1859
+ height: '100%',
1860
+ },
1861
+ overrideHistoryState: false,
1862
+ });
1863
+ await appEmbed.render();
1864
+
1865
+ const iframe = getIFrameEl();
1866
+ iframe.contentWindow.postMessage = jest.fn();
1867
+ appEmbed.navigateToPage(path, true);
1868
+
1869
+ expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
1870
+ expect.objectContaining({
1871
+ type: HostEvent.Navigate,
1872
+ data: path,
1873
+ }),
1874
+ `http://${thoughtSpotHost}`,
1875
+ expect.anything(),
1876
+ );
1877
+ });
1878
+ });
1739
1879
  });
1740
1880
 
1741
1881
  describe('LazyLoadingForFullHeight functionality', () => {
package/src/embed/app.ts CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  SpotterFileUploadFileTypes,
23
23
  } from '../types';
24
24
  import { V1Embed } from './ts-embed';
25
- import { SpotterChatViewConfig, SpotterSidebarViewConfig } from './conversation';
25
+ import { SpotterChatViewConfig, SpotterSidebarViewConfig, SpotterQueryMode } from './conversation';
26
26
  import { buildSpotterSidebarAppInitData } from './spotter-utils';
27
27
  import { SpotterVizConfig, buildSpotterVizAppInitData } from './spotter-viz-utils';
28
28
 
@@ -63,6 +63,10 @@ export enum Page {
63
63
  * Monitor Alerts Page
64
64
  */
65
65
  Monitor = 'monitor',
66
+ /**
67
+ * Collections listing page
68
+ */
69
+ Collections = 'collections',
66
70
  }
67
71
 
68
72
  /**
@@ -733,6 +737,25 @@ export interface AppViewConfig extends AllEmbedViewConfig {
733
737
  * ```
734
738
  */
735
739
  updatedSpotterChatPrompt?: boolean;
740
+ /**
741
+ * Sets the default query mode when Spotter loads — Fast Search or
742
+ * Research Mode. Applies fresh on every new session for this embed
743
+ * instance only; it does not persist as a user preference and does
744
+ * not affect other embeds or native ThoughtSpot usage.
745
+ * Only applicable when navigating to Spotter within the app.
746
+ *
747
+ * Supported embed types: `AppEmbed`
748
+ * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
749
+ * @default SpotterQueryMode.FAST_SEARCH
750
+ * @example
751
+ * ```js
752
+ * const embed = new AppEmbed('#tsEmbed', {
753
+ * ... //other embed view config
754
+ * defaultQueryMode: SpotterQueryMode.RESEARCH,
755
+ * })
756
+ * ```
757
+ */
758
+ defaultQueryMode?: SpotterQueryMode;
736
759
  /**
737
760
  * Controls the visibility of the past conversations sidebar.
738
761
  *
@@ -805,6 +828,12 @@ export interface AppViewConfig extends AllEmbedViewConfig {
805
828
  * { label: 'Tip', text: 'try asking about revenue by region' },
806
829
  * { label: 'Tip', text: 'use natural language' },
807
830
  * ],
831
+ * // liveboardBrandName, spotterBrandName, insightTileBrandName, insightTileViewPlanLabel and insightTileLoaderText require SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
832
+ * liveboardBrandName: 'Reports',
833
+ * spotterBrandName: 'Analyst',
834
+ * insightTileBrandName: 'Insight card',
835
+ * insightTileViewPlanLabel: 'View plan',
836
+ * insightTileLoaderText: 'Generating insight',
808
837
  * },
809
838
  * })
810
839
  * ```
@@ -986,6 +1015,7 @@ export class AppEmbed extends V1Embed {
986
1015
  isCentralizedLiveboardFilterUXEnabled = false,
987
1016
  isLinkParametersEnabled,
988
1017
  updatedSpotterChatPrompt,
1018
+ defaultQueryMode,
989
1019
  enableStopAnswerGenerationEmbed,
990
1020
  spotterChatConfig,
991
1021
  minimumHeight,
@@ -1025,6 +1055,9 @@ export class AppEmbed extends V1Embed {
1025
1055
  if (!isUndefined(updatedSpotterChatPrompt)) {
1026
1056
  params[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt;
1027
1057
  }
1058
+ if (!isUndefined(defaultQueryMode)) {
1059
+ params[Param.DefaultQueryMode] = defaultQueryMode;
1060
+ }
1028
1061
  if (!isUndefined(enableStopAnswerGenerationEmbed)) {
1029
1062
  params[Param.EnableStopAnswerGenerationEmbed] = !!enableStopAnswerGenerationEmbed;
1030
1063
  }
@@ -1332,6 +1365,8 @@ export class AppEmbed extends V1Embed {
1332
1365
  return modularHomeExperience ? 'home/spotiq-analysis' : 'insights/results';
1333
1366
  case Page.Monitor:
1334
1367
  return modularHomeExperience ? 'home/monitor-alerts' : 'insights/monitor-alerts';
1368
+ case Page.Collections:
1369
+ return 'collections';
1335
1370
  case Page.Home:
1336
1371
  default:
1337
1372
  return 'home';
@@ -1372,7 +1407,8 @@ export class AppEmbed extends V1Embed {
1372
1407
  logger.log('Please call render before invoking this method');
1373
1408
  return;
1374
1409
  }
1375
- if (noReload) {
1410
+ const overrideHistoryState = this.viewConfig?.overrideHistoryState;
1411
+ if (noReload || overrideHistoryState) {
1376
1412
  this.trigger(HostEvent.Navigate, path);
1377
1413
  } else {
1378
1414
  if (typeof path !== 'string') {
@@ -1,4 +1,4 @@
1
- import { SpotterEmbed, SpotterEmbedViewConfig, ConversationEmbed } from './conversation';
1
+ import { SpotterEmbed, SpotterEmbedViewConfig, SpotterQueryMode, ConversationEmbed } from './conversation';
2
2
  import { TsEmbed } from './ts-embed';
3
3
  import * as authInstance from '../auth';
4
4
  import { Action, init } from '../index';
@@ -460,6 +460,37 @@ describe('ConversationEmbed', () => {
460
460
  );
461
461
  });
462
462
 
463
+ it('should render the conversation embed with default query mode set to research', async () => {
464
+ const viewConfig: SpotterEmbedViewConfig = {
465
+ worksheetId: 'worksheetId',
466
+ searchOptions: {
467
+ searchQuery: 'searchQuery',
468
+ },
469
+ defaultQueryMode: SpotterQueryMode.RESEARCH,
470
+ };
471
+ const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
472
+ await conversationEmbed.render();
473
+ expectUrlMatchesWithParams(
474
+ getIFrameSrc(),
475
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&defaultQueryMode=research#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
476
+ );
477
+ });
478
+
479
+ it('should render the conversation embed without a default query mode param when unset', async () => {
480
+ const viewConfig: SpotterEmbedViewConfig = {
481
+ worksheetId: 'worksheetId',
482
+ searchOptions: {
483
+ searchQuery: 'searchQuery',
484
+ },
485
+ };
486
+ const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
487
+ await conversationEmbed.render();
488
+ expectUrlMatchesWithParams(
489
+ getIFrameSrc(),
490
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
491
+ );
492
+ });
493
+
463
494
  describe('spotter chat hiddenActions', () => {
464
495
  it.each([
465
496
  ['SpotterChatConnectorResources', Action.SpotterChatConnectorResources],
@@ -15,6 +15,15 @@ export interface SearchOptions {
15
15
  searchQuery: string;
16
16
  }
17
17
 
18
+ /**
19
+ * The query mode Spotter uses when answering a question.
20
+ * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
21
+ */
22
+ export enum SpotterQueryMode {
23
+ FAST_SEARCH = 'fastSearch',
24
+ RESEARCH = 'research',
25
+ }
26
+
18
27
  /**
19
28
  * Configuration for the Spotter sidebar.
20
29
  * Can be used in SpotterEmbed and AppEmbed.
@@ -319,6 +328,24 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
319
328
  * ```
320
329
  */
321
330
  updatedSpotterChatPrompt?: boolean;
331
+ /**
332
+ * Sets the default query mode when Spotter loads — Fast Search or
333
+ * Research Mode. Applies fresh on every new session for this embed
334
+ * instance only; it does not persist as a user preference and does
335
+ * not affect other embeds or native ThoughtSpot usage.
336
+ *
337
+ * Supported embed types: `SpotterEmbed`, `AppEmbed`
338
+ * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
339
+ * @default SpotterQueryMode.FAST_SEARCH
340
+ * @example
341
+ * ```js
342
+ * const embed = new SpotterEmbed('#tsEmbed', {
343
+ * ... //other embed view config
344
+ * defaultQueryMode: SpotterQueryMode.RESEARCH,
345
+ * })
346
+ * ```
347
+ */
348
+ defaultQueryMode?: SpotterQueryMode;
322
349
  /**
323
350
  * Enables the stop answer generation button in the Spotter embed UI,
324
351
  * allowing users to interrupt an ongoing answer generation.
@@ -456,6 +483,7 @@ export class SpotterEmbed extends TsEmbed {
456
483
  runtimeParameters,
457
484
  excludeRuntimeParametersfromURL,
458
485
  updatedSpotterChatPrompt,
486
+ defaultQueryMode,
459
487
  enableStopAnswerGenerationEmbed,
460
488
  spotterChatConfig,
461
489
  } = this.viewConfig;
@@ -478,6 +506,7 @@ export class SpotterEmbed extends TsEmbed {
478
506
  setParamIfDefined(queryParams, Param.ShowSpotterLimitations, showSpotterLimitations, true);
479
507
  setParamIfDefined(queryParams, Param.HideSampleQuestions, hideSampleQuestions, true);
480
508
  setParamIfDefined(queryParams, Param.UpdatedSpotterChatPrompt, updatedSpotterChatPrompt, true);
509
+ setParamIfDefined(queryParams, Param.DefaultQueryMode, defaultQueryMode);
481
510
  setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
482
511
 
483
512
  // Handle spotterChatConfig params