@thoughtspot/visual-embed-sdk 1.24.0-alpha.0 → 1.24.0-alpha.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 (102) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +1 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +1 -3
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/embed/app.d.ts +9 -1
  7. package/cjs/src/embed/app.d.ts.map +1 -1
  8. package/cjs/src/embed/app.js +3 -2
  9. package/cjs/src/embed/app.js.map +1 -1
  10. package/cjs/src/embed/app.spec.js +10 -0
  11. package/cjs/src/embed/app.spec.js.map +1 -1
  12. package/cjs/src/embed/base.d.ts +10 -0
  13. package/cjs/src/embed/base.d.ts.map +1 -1
  14. package/cjs/src/embed/base.js +10 -0
  15. package/cjs/src/embed/base.js.map +1 -1
  16. package/cjs/src/embed/sage.d.ts +25 -2
  17. package/cjs/src/embed/sage.d.ts.map +1 -1
  18. package/cjs/src/embed/sage.js +10 -5
  19. package/cjs/src/embed/sage.js.map +1 -1
  20. package/cjs/src/embed/sage.spec.js +26 -0
  21. package/cjs/src/embed/sage.spec.js.map +1 -1
  22. package/cjs/src/embed/search-bar.d.ts +1 -1
  23. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  24. package/cjs/src/embed/search.d.ts +8 -0
  25. package/cjs/src/embed/search.d.ts.map +1 -1
  26. package/cjs/src/embed/search.js +2 -1
  27. package/cjs/src/embed/search.js.map +1 -1
  28. package/cjs/src/embed/search.spec.js +11 -1
  29. package/cjs/src/embed/search.spec.js.map +1 -1
  30. package/cjs/src/react/index.spec.js +1 -1
  31. package/cjs/src/react/index.spec.js.map +1 -1
  32. package/cjs/src/types.d.ts +42 -11
  33. package/cjs/src/types.d.ts.map +1 -1
  34. package/cjs/src/types.js +22 -7
  35. package/cjs/src/types.js.map +1 -1
  36. package/dist/src/auth.d.ts.map +1 -1
  37. package/dist/src/embed/app.d.ts +9 -1
  38. package/dist/src/embed/app.d.ts.map +1 -1
  39. package/dist/src/embed/base.d.ts +10 -0
  40. package/dist/src/embed/base.d.ts.map +1 -1
  41. package/dist/src/embed/sage.d.ts +25 -2
  42. package/dist/src/embed/sage.d.ts.map +1 -1
  43. package/dist/src/embed/search-bar.d.ts +1 -1
  44. package/dist/src/embed/search-bar.d.ts.map +1 -1
  45. package/dist/src/embed/search.d.ts +8 -0
  46. package/dist/src/embed/search.d.ts.map +1 -1
  47. package/dist/src/types.d.ts +42 -11
  48. package/dist/src/types.d.ts.map +1 -1
  49. package/dist/tsembed-react.es.js +121 -17298
  50. package/dist/tsembed-react.js +121 -17298
  51. package/dist/tsembed.es.js +144 -17311
  52. package/dist/tsembed.js +144 -17311
  53. package/dist/visual-embed-sdk-react-full.d.ts +95 -15
  54. package/dist/visual-embed-sdk-react.d.ts +95 -15
  55. package/dist/visual-embed-sdk.d.ts +95 -15
  56. package/lib/package.json +1 -1
  57. package/lib/src/auth.d.ts.map +1 -1
  58. package/lib/src/auth.js +1 -2
  59. package/lib/src/auth.js.map +1 -1
  60. package/lib/src/embed/app.d.ts +9 -1
  61. package/lib/src/embed/app.d.ts.map +1 -1
  62. package/lib/src/embed/app.js +3 -2
  63. package/lib/src/embed/app.js.map +1 -1
  64. package/lib/src/embed/app.spec.js +10 -0
  65. package/lib/src/embed/app.spec.js.map +1 -1
  66. package/lib/src/embed/base.d.ts +10 -0
  67. package/lib/src/embed/base.d.ts.map +1 -1
  68. package/lib/src/embed/base.js +10 -0
  69. package/lib/src/embed/base.js.map +1 -1
  70. package/lib/src/embed/sage.d.ts +25 -2
  71. package/lib/src/embed/sage.d.ts.map +1 -1
  72. package/lib/src/embed/sage.js +10 -5
  73. package/lib/src/embed/sage.js.map +1 -1
  74. package/lib/src/embed/sage.spec.js +26 -0
  75. package/lib/src/embed/sage.spec.js.map +1 -1
  76. package/lib/src/embed/search-bar.d.ts +1 -1
  77. package/lib/src/embed/search-bar.d.ts.map +1 -1
  78. package/lib/src/embed/search.d.ts +8 -0
  79. package/lib/src/embed/search.d.ts.map +1 -1
  80. package/lib/src/embed/search.js +2 -1
  81. package/lib/src/embed/search.js.map +1 -1
  82. package/lib/src/embed/search.spec.js +11 -1
  83. package/lib/src/embed/search.spec.js.map +1 -1
  84. package/lib/src/react/index.spec.js +1 -1
  85. package/lib/src/react/index.spec.js.map +1 -1
  86. package/lib/src/types.d.ts +42 -11
  87. package/lib/src/types.d.ts.map +1 -1
  88. package/lib/src/types.js +22 -7
  89. package/lib/src/types.js.map +1 -1
  90. package/lib/src/visual-embed-sdk.d.ts +95 -15
  91. package/package.json +1 -1
  92. package/src/auth.ts +1 -2
  93. package/src/embed/app.spec.ts +15 -0
  94. package/src/embed/app.ts +11 -1
  95. package/src/embed/base.ts +10 -0
  96. package/src/embed/sage.spec.ts +32 -0
  97. package/src/embed/sage.ts +38 -5
  98. package/src/embed/search-bar.tsx +1 -1
  99. package/src/embed/search.spec.ts +15 -1
  100. package/src/embed/search.ts +10 -0
  101. package/src/react/index.spec.tsx +1 -1
  102. package/src/types.ts +30 -12
@@ -68,7 +68,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
68
68
  /**
69
69
  * SpotIQ listing page
70
70
  */
71
- SpotIQ = "spotiq"
71
+ SpotIQ = "insights"
72
72
  }
73
73
  /**
74
74
  * The view configuration for full app embedding.
@@ -138,6 +138,14 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
138
138
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
139
139
  */
140
140
  fullHeight?: boolean;
141
+ /**
142
+ * Flag to control Data panel experience
143
+ *
144
+ * @default false
145
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
146
+ * @hidden
147
+ */
148
+ dataPanelV2?: boolean;
141
149
  }
142
150
  /**
143
151
  * Embeds full ThoughtSpot experience in a host application.
@@ -271,7 +279,17 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
271
279
  * @param fn The function being registered
272
280
  */
273
281
  export const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
282
+ /**
283
+ * Imports TML representation of the metadata objects into ThoughtSpot.
284
+ * @param data
285
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
286
+ */
274
287
  export const executeTML: (data: executeTMLInput) => Promise<any>;
288
+ /**
289
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
290
+ * @param data
291
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
292
+ */
275
293
  export const exportTML: (data: exportTMLInput) => Promise<any>;
276
294
  /**
277
295
  *
@@ -514,6 +532,14 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
514
532
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
515
533
  */
516
534
  hideSearchBar?: boolean;
535
+ /**
536
+ * Flag to control Data panel experience
537
+ *
538
+ * @default false
539
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
540
+ * @hidden
541
+ */
542
+ dataPanelV2?: boolean;
517
543
  }
518
544
  export const HiddenActionItemByDefaultForSearchEmbed: Action[];
519
545
  /**
@@ -542,7 +568,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search-bar' {
542
568
  /**
543
569
  * @group Embed components
544
570
  */
545
- export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts'> {
571
+ export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts' | 'dataPanelV2'> {
546
572
  /**
547
573
  * The array of data source GUIDs to set on load.
548
574
  * Only a single dataSource supported currently.
@@ -1023,6 +1049,9 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1023
1049
  export interface CustomisationsInterface {
1024
1050
  style?: CustomStyles;
1025
1051
  content?: {
1052
+ /**
1053
+ * @version SDK: 1.26.0 | 9.7.0.cl
1054
+ */
1026
1055
  strings?: Record<string, any>;
1027
1056
  [key: string]: any;
1028
1057
  };
@@ -1430,21 +1459,21 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1430
1459
  /**
1431
1460
  * Boolean to hide liveboard header
1432
1461
  *
1433
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1462
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1434
1463
  * @default false
1435
1464
  */
1436
1465
  hideLiveboardHeader?: boolean;
1437
1466
  /**
1438
1467
  * Boolean to show liveboard title
1439
1468
  *
1440
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1469
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1441
1470
  * @default false
1442
1471
  */
1443
1472
  showLiveboardTitle?: boolean;
1444
1473
  /**
1445
1474
  * Boolean to show liveboard description
1446
1475
  *
1447
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1476
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1448
1477
  * @default false
1449
1478
  */
1450
1479
  showLiveboardDescription?: boolean;
@@ -1462,7 +1491,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1462
1491
  * 'f547ec54-2a37-4516-a222-2b06719af726']
1463
1492
  * });
1464
1493
  * ```
1465
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1494
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1466
1495
  */
1467
1496
  hiddenTabs?: string[];
1468
1497
  /**
@@ -1481,7 +1510,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1481
1510
  * 'f547ec54-2a37-4516-a222-2b06719af726']
1482
1511
  * });
1483
1512
  * ```
1484
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1513
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1485
1514
  */
1486
1515
  visibleTabs?: string[];
1487
1516
  }
@@ -2719,6 +2748,19 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2719
2748
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
2720
2749
  */
2721
2750
  UpdateFilters = "updateFilters",
2751
+ /**
2752
+ * Get Tab for the current Liveboard.
2753
+ *
2754
+ * @example
2755
+ * ```js
2756
+ * liveboardEmbed.trigger(HostEvent.GetTabs).then((tabDetails) => {
2757
+ * console.log(
2758
+ * tabDetails // TabDetails of current LB
2759
+ * );
2760
+ * })
2761
+ * ```
2762
+ * @version SDK: 1.26.0 | ThoughtSpot: 9.7.0.cl
2763
+ */
2722
2764
  GetTabs = "getTabs",
2723
2765
  /**
2724
2766
  * Set the visible Tabs on a Liveboard.
@@ -2731,7 +2773,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2731
2773
  * '430496d6-6903-4601-937e-2c691821af3c',
2732
2774
  * 'f547ec54-2a37-4516-a222-2b06719af726'])
2733
2775
  * ```
2734
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
2776
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2735
2777
  */
2736
2778
  SetVisibleTabs = "SetPinboardVisibleTabs",
2737
2779
  /**
@@ -2745,9 +2787,23 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2745
2787
  * '630496d6-6903-4601-937e-2c691821af3c',
2746
2788
  * 'i547ec54-2a37-4516-a222-2b06719af726'])
2747
2789
  * ```
2748
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
2790
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2749
2791
  */
2750
- SetHiddenTabs = "SetPinboardHiddenTabs"
2792
+ SetHiddenTabs = "SetPinboardHiddenTabs",
2793
+ /**
2794
+ * Updates the search query for sage embed.
2795
+ *
2796
+ * @param - searchOptions: an object queryString and option to execute the query.
2797
+ * @example
2798
+ * ```js
2799
+ * sageEmbed.trigger(HostEvent.UpdateSageQuery, {
2800
+ * queryString: 'revenue per year',
2801
+ * executeSearch: true,
2802
+ * })
2803
+ * ```
2804
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2805
+ */
2806
+ UpdateSageQuery = "updateSageQuery"
2751
2807
  }
2752
2808
  /**
2753
2809
  * The different visual modes that the data sources panel within
@@ -2802,6 +2858,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2802
2858
  DisableLoginRedirect = "disableLoginRedirect",
2803
2859
  visibleVizs = "pinboardVisibleVizs",
2804
2860
  LiveboardV2Enabled = "isPinboardV2Enabled",
2861
+ DataPanelV2Enabled = "enableDataPanelV2",
2805
2862
  ShowAlerts = "showAlerts",
2806
2863
  Locale = "locale",
2807
2864
  CustomStyle = "customStyle",
@@ -2829,8 +2886,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2829
2886
  VisibleTabs = "visibleTabs",
2830
2887
  HideTabPanel = "hideTabPanel",
2831
2888
  HideSampleQuestions = "hideSampleQuestions",
2832
- WorksheetId = "worksheetId",
2833
- Query = "query,"
2889
+ WorksheetId = "worksheet",
2890
+ Query = "query"
2834
2891
  }
2835
2892
  /**
2836
2893
  * ThoughtSpot application pages include actions and menu commands
@@ -3615,7 +3672,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3615
3672
  */
3616
3673
  MarkAsVerified = "markAsVerified",
3617
3674
  /**
3618
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
3675
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
3619
3676
  */
3620
3677
  AddTab = "addTab",
3621
3678
  /**
@@ -3985,6 +4042,22 @@ declare module '@thoughtspot/visual-embed-sdk/embed/sage' {
3985
4042
  */
3986
4043
  import { Action, DOMSelector, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
3987
4044
  import { V1Embed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
4045
+ /**
4046
+ * Configuration for search options
4047
+ */
4048
+ export interface SearchOptions {
4049
+ /**
4050
+ * The tml string to load the answer
4051
+ */
4052
+ searchQuery: string;
4053
+ /**
4054
+ * Boolean to determine if the search should be executed or not.
4055
+ * if it is executed, put the focus on the results.
4056
+ * if it’s not executed, put the focus in the search bar - at the end of
4057
+ * the tokens
4058
+ */
4059
+ executeSearch?: boolean;
4060
+ }
3988
4061
  /**
3989
4062
  * The configuration attributes for the embedded Natural language search view. Based on
3990
4063
  * GPT and LLM.
@@ -3994,7 +4067,9 @@ declare module '@thoughtspot/visual-embed-sdk/embed/sage' {
3994
4067
  */
3995
4068
  export interface SageViewConfig extends ViewConfig {
3996
4069
  /**
3997
- * If set to true, object results are shown.
4070
+ * If set to true, a list of liveboard and answers related
4071
+ * to the natural language search will be shown below the
4072
+ * AI generated answer.
3998
4073
  */
3999
4074
  showObjectResults?: boolean;
4000
4075
  /**
@@ -4006,7 +4081,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/sage' {
4006
4081
  */
4007
4082
  hideWorksheetSelector?: boolean;
4008
4083
  /**
4009
- * If set to true, the object search suggestions are not shown
4084
+ * If set to true, the search suggestions will contain existing
4085
+ * liveboards and answers in addition with the autocomplete
4010
4086
  *
4011
4087
  */
4012
4088
  showObjectSuggestions?: boolean;
@@ -4023,6 +4099,10 @@ declare module '@thoughtspot/visual-embed-sdk/embed/sage' {
4023
4099
  * The data source GUID to set on load.
4024
4100
  */
4025
4101
  dataSource?: string;
4102
+ /**
4103
+ * Configuration for search options
4104
+ */
4105
+ searchOptions?: SearchOptions;
4026
4106
  }
4027
4107
  export const HiddenActionItemByDefaultForSageEmbed: Action[];
4028
4108
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.24.0-alpha.0",
3
+ "version": "1.24.0-alpha.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
package/src/auth.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import EventEmitter from 'eventemitter3';
2
- import _ from 'lodash';
3
2
  import { initMixpanel } from './mixpanel-service';
4
3
  import {
5
4
  AuthType, DOMSelector, EmbedConfig, EmbedEvent, Param,
@@ -207,7 +206,7 @@ export function notifyLogout(): void {
207
206
  }
208
207
 
209
208
  export const initSession = (sessionDetails: sessionInfoInterface) => {
210
- if (_.isNull(sessionInfo)) {
209
+ if (sessionInfo == null) {
211
210
  sessionInfo = sessionDetails;
212
211
  initMixpanel(sessionInfo);
213
212
  sessionInfoResolver(sessionInfo);
@@ -254,6 +254,21 @@ describe('App embed tests', () => {
254
254
  });
255
255
  });
256
256
 
257
+ test('Should add enableDataPanelV2 flag to the iframe src', async () => {
258
+ const appEmbed = new AppEmbed(getRootEl(), {
259
+ ...defaultViewConfig,
260
+ dataPanelV2: true,
261
+ } as AppViewConfig);
262
+
263
+ appEmbed.render();
264
+ await executeAfterWait(() => {
265
+ expectUrlMatchesWithParams(
266
+ getIFrameSrc(),
267
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&enableDataPanelV2=true${defaultParams}${defaultParamsPost}#/home`,
268
+ );
269
+ });
270
+ });
271
+
257
272
  test('should register event handlers to adjust iframe height', async () => {
258
273
  const onSpy = jest.spyOn(AppEmbed.prototype, 'on')
259
274
  .mockImplementation((event, callback) => {
package/src/embed/app.ts CHANGED
@@ -47,7 +47,7 @@ export enum Page {
47
47
  /**
48
48
  * SpotIQ listing page
49
49
  */
50
- SpotIQ = 'spotiq',
50
+ SpotIQ = 'insights',
51
51
  }
52
52
 
53
53
  /**
@@ -118,6 +118,14 @@ export interface AppViewConfig extends ViewConfig {
118
118
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
119
119
  */
120
120
  fullHeight?:boolean;
121
+ /**
122
+ * Flag to control Data panel experience
123
+ *
124
+ * @default false
125
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
126
+ * @hidden
127
+ */
128
+ dataPanelV2?: boolean;
121
129
  }
122
130
 
123
131
  /**
@@ -155,6 +163,7 @@ export class AppEmbed extends V1Embed {
155
163
  hideOrgSwitcher,
156
164
  enableSearchAssist,
157
165
  fullHeight,
166
+ dataPanelV2 = false,
158
167
  } = this.viewConfig;
159
168
 
160
169
  let params = {};
@@ -184,6 +193,7 @@ export class AppEmbed extends V1Embed {
184
193
  params[Param.EnableSearchAssist] = enableSearchAssist;
185
194
  }
186
195
 
196
+ params[Param.DataPanelV2Enabled] = dataPanelV2;
187
197
  const queryParams = getQueryParamString(params, true);
188
198
 
189
199
  return queryParams;
package/src/embed/base.ts CHANGED
@@ -256,6 +256,11 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
256
256
  return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
257
257
  };
258
258
 
259
+ /**
260
+ * Imports TML representation of the metadata objects into ThoughtSpot.
261
+ * @param data
262
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
263
+ */
259
264
  export const executeTML = async (data: executeTMLInput): Promise<any> => {
260
265
  const { thoughtSpotHost, authType } = config;
261
266
  try {
@@ -299,6 +304,11 @@ export const executeTML = async (data: executeTMLInput): Promise<any> => {
299
304
  });
300
305
  };
301
306
 
307
+ /**
308
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
309
+ * @param data
310
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
311
+ */
302
312
  export const exportTML = async (data: exportTMLInput): Promise<any> => {
303
313
  const { thoughtSpotHost, authType } = config;
304
314
  try {
@@ -41,4 +41,36 @@ describe('Sage embed tests', () => {
41
41
  );
42
42
  });
43
43
  });
44
+ test('embed url include pre-seed dataSource and query', async () => {
45
+ const sageEmbed = new SageEmbed(getRootEl(), {
46
+ ...defaultConfig,
47
+ dataSource: 'worksheet-id',
48
+ searchOptions: {
49
+ searchQuery: 'test-query',
50
+ },
51
+ });
52
+ sageEmbed.render();
53
+ await executeAfterWait(() => {
54
+ expectUrlMatch(
55
+ getIFrameSrc(),
56
+ `http://${thoughtSpotHost}/?embedApp=true&hideEurekaResults=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=true&hideEurekaSuggestions=true&hideAction=%5B"reportError","save","pin","editACopy","saveAsView","updateTSL","editTSL","onDeleteAnswer","share"%5D#/embed/eureka?worksheet=worksheet-id&query=test-query`,
57
+ );
58
+ });
59
+ });
60
+ test('embed url include pre-seed execute flag with query', async () => {
61
+ const sageEmbed = new SageEmbed(getRootEl(), {
62
+ ...defaultConfig,
63
+ searchOptions: {
64
+ searchQuery: 'test-query',
65
+ executeSearch: true,
66
+ },
67
+ });
68
+ sageEmbed.render();
69
+ await executeAfterWait(() => {
70
+ expectUrlMatch(
71
+ getIFrameSrc(),
72
+ `http://${thoughtSpotHost}/?embedApp=true&hideEurekaResults=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=true&hideEurekaSuggestions=true&hideAction=%5B"reportError","save","pin","editACopy","saveAsView","updateTSL","editTSL","onDeleteAnswer","share"%5D#/embed/eureka?query=test-query&executeSearch=true`,
73
+ );
74
+ });
75
+ });
44
76
  });
package/src/embed/sage.ts CHANGED
@@ -13,6 +13,23 @@ import {
13
13
  import { getQueryParamString } from '../utils';
14
14
  import { V1Embed } from './ts-embed';
15
15
 
16
+ /**
17
+ * Configuration for search options
18
+ */
19
+ export interface SearchOptions {
20
+ /**
21
+ * The tml string to load the answer
22
+ */
23
+ searchQuery: string;
24
+ /**
25
+ * Boolean to determine if the search should be executed or not.
26
+ * if it is executed, put the focus on the results.
27
+ * if it’s not executed, put the focus in the search bar - at the end of
28
+ * the tokens
29
+ */
30
+ executeSearch?: boolean;
31
+ }
32
+
16
33
  /**
17
34
  * The configuration attributes for the embedded Natural language search view. Based on
18
35
  * GPT and LLM.
@@ -22,7 +39,9 @@ import { V1Embed } from './ts-embed';
22
39
  */
23
40
  export interface SageViewConfig extends ViewConfig {
24
41
  /**
25
- * If set to true, object results are shown.
42
+ * If set to true, a list of liveboard and answers related
43
+ * to the natural language search will be shown below the
44
+ * AI generated answer.
26
45
  */
27
46
  showObjectResults?: boolean;
28
47
  /**
@@ -34,7 +53,8 @@ export interface SageViewConfig extends ViewConfig {
34
53
  */
35
54
  hideWorksheetSelector?: boolean,
36
55
  /**
37
- * If set to true, the object search suggestions are not shown
56
+ * If set to true, the search suggestions will contain existing
57
+ * liveboards and answers in addition with the autocomplete
38
58
  *
39
59
  */
40
60
  showObjectSuggestions?: boolean;
@@ -51,6 +71,11 @@ export interface SageViewConfig extends ViewConfig {
51
71
  * The data source GUID to set on load.
52
72
  */
53
73
  dataSource?: string;
74
+ /**
75
+ * Configuration for search options
76
+ */
77
+ searchOptions?: SearchOptions;
78
+
54
79
  }
55
80
  export const HiddenActionItemByDefaultForSageEmbed = [
56
81
  Action.Save,
@@ -102,7 +127,7 @@ export class SageEmbed extends V1Embed {
102
127
  params[Param.DisableWorksheetChange] = !!disableWorksheetChange;
103
128
  params[Param.HideWorksheetSelector] = !!hideWorksheetSelector;
104
129
  params[Param.HideEurekaSuggestions] = !showObjectSuggestions;
105
- params[Param.HideSampleQuestions] = !hideSampleQuestions;
130
+ params[Param.HideSampleQuestions] = !!hideSampleQuestions;
106
131
  params[Param.HideActions] = [
107
132
  ...(params[Param.HideActions] ?? []),
108
133
  ...HiddenActionItemByDefaultForSageEmbed,
@@ -121,9 +146,17 @@ export class SageEmbed extends V1Embed {
121
146
  const path = 'eureka';
122
147
  const postHashObj = {};
123
148
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
149
+ const {
150
+ dataSource, searchOptions,
151
+ } = this.viewConfig;
124
152
 
125
- if (this.viewConfig.searchQuery) postHashObj[Param.Query] = this.viewConfig.searchQuery;
126
- if (this.viewConfig.dataSource) postHashObj[Param.WorksheetId] = this.viewConfig.dataSource;
153
+ if (dataSource) postHashObj[Param.WorksheetId] = dataSource;
154
+ if (searchOptions?.searchQuery) {
155
+ postHashObj[Param.Query] = searchOptions?.searchQuery;
156
+ if (searchOptions.executeSearch) {
157
+ postHashObj[Param.executeSearch] = true;
158
+ }
159
+ }
127
160
  let sagePostHashParams = new URLSearchParams(postHashObj).toString();
128
161
  if (sagePostHashParams) sagePostHashParams = `${tsPostHashParams ? '&' : '?'}${sagePostHashParams}`;
129
162
 
@@ -8,7 +8,7 @@ import { SearchOptions } from './search';
8
8
  /**
9
9
  * @group Embed components
10
10
  */
11
- export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts'> {
11
+ export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts' | 'dataPanelV2'> {
12
12
  /**
13
13
  * The array of data source GUIDs to set on load.
14
14
  * Only a single dataSource supported currently.
@@ -47,7 +47,7 @@ describe('Search embed tests', () => {
47
47
  await executeAfterWait(() => {
48
48
  expectUrlMatchesWithParams(
49
49
  getIFrameSrc(),
50
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
50
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=false&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
51
51
  );
52
52
  });
53
53
  });
@@ -336,4 +336,18 @@ describe('Search embed tests', () => {
336
336
  );
337
337
  });
338
338
  });
339
+
340
+ test('should set enableDataPanelV2 to true if data panel v2 flag is true', async () => {
341
+ const searchEmbed = new SearchEmbed(getRootEl(), {
342
+ ...defaultViewConfig,
343
+ dataPanelV2: true,
344
+ });
345
+ searchEmbed.render();
346
+ await executeAfterWait(() => {
347
+ expectUrlMatchesWithParams(
348
+ getIFrameSrc(),
349
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
350
+ );
351
+ });
352
+ });
339
353
  });
@@ -105,6 +105,14 @@ export interface SearchViewConfig extends ViewConfig {
105
105
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
106
106
  */
107
107
  hideSearchBar?: boolean;
108
+ /**
109
+ * Flag to control Data panel experience
110
+ *
111
+ * @default false
112
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
113
+ * @hidden
114
+ */
115
+ dataPanelV2?: boolean;
108
116
  }
109
117
 
110
118
  export const HiddenActionItemByDefaultForSearchEmbed = [
@@ -157,6 +165,7 @@ export class SearchEmbed extends TsEmbed {
157
165
  dataSource,
158
166
  dataSources,
159
167
  excludeRuntimeFiltersfromURL,
168
+ dataPanelV2 = false,
160
169
  } = this.viewConfig;
161
170
  const queryParams = this.getBaseQueryParams();
162
171
 
@@ -190,6 +199,7 @@ export class SearchEmbed extends TsEmbed {
190
199
  queryParams[Param.ForceTable] = true;
191
200
  }
192
201
 
202
+ queryParams[Param.DataPanelV2Enabled] = dataPanelV2;
193
203
  queryParams[Param.DataSourceMode] = this.getDataSourceMode();
194
204
  queryParams[Param.UseLastSelectedDataSource] = false;
195
205
  queryParams[Param.searchEmbed] = true;
@@ -47,7 +47,7 @@ describe('React Components', () => {
47
47
  ),
48
48
  ).toBe(true);
49
49
  expect(getIFrameSrc(container)).toBe(
50
- `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true#/embed/answer`,
50
+ `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true#/embed/answer`,
51
51
  );
52
52
  });
53
53