@thoughtspot/visual-embed-sdk 1.41.0-pre-render-1 → 1.41.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 (220) hide show
  1. package/cjs/package.json +3 -3
  2. package/cjs/src/embed/app.d.ts +6 -1
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +19 -1
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/app.spec.js +60 -3
  7. package/cjs/src/embed/app.spec.js.map +1 -1
  8. package/cjs/src/embed/bodyless-conversation.d.ts +0 -1
  9. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  10. package/cjs/src/embed/bodyless-conversation.js +3 -7
  11. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  12. package/cjs/src/embed/conversation.d.ts +0 -1
  13. package/cjs/src/embed/conversation.d.ts.map +1 -1
  14. package/cjs/src/embed/conversation.js +2 -7
  15. package/cjs/src/embed/conversation.js.map +1 -1
  16. package/cjs/src/embed/liveboard.d.ts +0 -1
  17. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  18. package/cjs/src/embed/liveboard.js +4 -27
  19. package/cjs/src/embed/liveboard.js.map +1 -1
  20. package/cjs/src/embed/liveboard.spec.js +25 -31
  21. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  22. package/cjs/src/embed/sage.d.ts +0 -1
  23. package/cjs/src/embed/sage.d.ts.map +1 -1
  24. package/cjs/src/embed/sage.js +6 -10
  25. package/cjs/src/embed/sage.js.map +1 -1
  26. package/cjs/src/embed/search-bar.d.ts +0 -1
  27. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  28. package/cjs/src/embed/search-bar.js +7 -11
  29. package/cjs/src/embed/search-bar.js.map +1 -1
  30. package/cjs/src/embed/search.d.ts +0 -1
  31. package/cjs/src/embed/search.d.ts.map +1 -1
  32. package/cjs/src/embed/search.js +8 -7
  33. package/cjs/src/embed/search.js.map +1 -1
  34. package/cjs/src/embed/ts-embed.d.ts +4 -6
  35. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  36. package/cjs/src/embed/ts-embed.js +20 -21
  37. package/cjs/src/embed/ts-embed.js.map +1 -1
  38. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  39. package/cjs/src/embed/ts-embed.spec.js +122 -0
  40. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  41. package/cjs/src/errors.d.ts +10 -0
  42. package/cjs/src/errors.d.ts.map +1 -1
  43. package/cjs/src/errors.js +11 -1
  44. package/cjs/src/errors.js.map +1 -1
  45. package/cjs/src/index.d.ts +2 -2
  46. package/cjs/src/index.d.ts.map +1 -1
  47. package/cjs/src/index.js +3 -1
  48. package/cjs/src/index.js.map +1 -1
  49. package/cjs/src/react/index.d.ts +1 -1
  50. package/cjs/src/react/index.d.ts.map +1 -1
  51. package/cjs/src/react/index.js +2 -1
  52. package/cjs/src/react/index.js.map +1 -1
  53. package/cjs/src/types.d.ts +135 -17
  54. package/cjs/src/types.d.ts.map +1 -1
  55. package/cjs/src/types.js +40 -21
  56. package/cjs/src/types.js.map +1 -1
  57. package/cjs/src/utils/custom-actions.d.ts +12 -0
  58. package/cjs/src/utils/custom-actions.d.ts.map +1 -0
  59. package/cjs/src/utils/custom-actions.js +180 -0
  60. package/cjs/src/utils/custom-actions.js.map +1 -0
  61. package/cjs/src/utils/custom-actions.spec.d.ts +2 -0
  62. package/cjs/src/utils/custom-actions.spec.d.ts.map +1 -0
  63. package/cjs/src/utils/custom-actions.spec.js +399 -0
  64. package/cjs/src/utils/custom-actions.spec.js.map +1 -0
  65. package/cjs/src/utils/processData.d.ts.map +1 -1
  66. package/cjs/src/utils/processData.js +10 -0
  67. package/cjs/src/utils/processData.js.map +1 -1
  68. package/cjs/src/utils/processData.spec.js +11 -0
  69. package/cjs/src/utils/processData.spec.js.map +1 -1
  70. package/cjs/src/utils.d.ts +7 -0
  71. package/cjs/src/utils.d.ts.map +1 -1
  72. package/cjs/src/utils.js +11 -1
  73. package/cjs/src/utils.js.map +1 -1
  74. package/cjs/src/utils.spec.js +28 -0
  75. package/cjs/src/utils.spec.js.map +1 -1
  76. package/dist/{index-CmEQfuE3.js → index-B_mxAan8.js} +1 -1
  77. package/dist/src/embed/app.d.ts +6 -1
  78. package/dist/src/embed/app.d.ts.map +1 -1
  79. package/dist/src/embed/bodyless-conversation.d.ts +0 -1
  80. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  81. package/dist/src/embed/conversation.d.ts +0 -1
  82. package/dist/src/embed/conversation.d.ts.map +1 -1
  83. package/dist/src/embed/liveboard.d.ts +0 -1
  84. package/dist/src/embed/liveboard.d.ts.map +1 -1
  85. package/dist/src/embed/sage.d.ts +0 -1
  86. package/dist/src/embed/sage.d.ts.map +1 -1
  87. package/dist/src/embed/search-bar.d.ts +0 -1
  88. package/dist/src/embed/search-bar.d.ts.map +1 -1
  89. package/dist/src/embed/search.d.ts +0 -1
  90. package/dist/src/embed/search.d.ts.map +1 -1
  91. package/dist/src/embed/ts-embed.d.ts +4 -6
  92. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  93. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  94. package/dist/src/errors.d.ts +10 -0
  95. package/dist/src/errors.d.ts.map +1 -1
  96. package/dist/src/index.d.ts +2 -2
  97. package/dist/src/index.d.ts.map +1 -1
  98. package/dist/src/react/index.d.ts +1 -1
  99. package/dist/src/react/index.d.ts.map +1 -1
  100. package/dist/src/types.d.ts +135 -17
  101. package/dist/src/types.d.ts.map +1 -1
  102. package/dist/src/utils/custom-actions.d.ts +12 -0
  103. package/dist/src/utils/custom-actions.d.ts.map +1 -0
  104. package/dist/src/utils/custom-actions.spec.d.ts +2 -0
  105. package/dist/src/utils/custom-actions.spec.d.ts.map +1 -0
  106. package/dist/src/utils/processData.d.ts.map +1 -1
  107. package/dist/src/utils.d.ts +7 -0
  108. package/dist/src/utils.d.ts.map +1 -1
  109. package/dist/tsembed-react.es.js +1704 -250
  110. package/dist/tsembed-react.js +1703 -249
  111. package/dist/tsembed.es.js +1704 -250
  112. package/dist/tsembed.js +1703 -249
  113. package/dist/visual-embed-sdk-react-full.d.ts +146 -31
  114. package/dist/visual-embed-sdk-react.d.ts +146 -31
  115. package/dist/visual-embed-sdk.d.ts +146 -31
  116. package/lib/package.json +3 -3
  117. package/lib/src/embed/app.d.ts +6 -1
  118. package/lib/src/embed/app.d.ts.map +1 -1
  119. package/lib/src/embed/app.js +19 -1
  120. package/lib/src/embed/app.js.map +1 -1
  121. package/lib/src/embed/app.spec.js +60 -3
  122. package/lib/src/embed/app.spec.js.map +1 -1
  123. package/lib/src/embed/bodyless-conversation.d.ts +0 -1
  124. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  125. package/lib/src/embed/bodyless-conversation.js +3 -7
  126. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  127. package/lib/src/embed/conversation.d.ts +0 -1
  128. package/lib/src/embed/conversation.d.ts.map +1 -1
  129. package/lib/src/embed/conversation.js +2 -7
  130. package/lib/src/embed/conversation.js.map +1 -1
  131. package/lib/src/embed/liveboard.d.ts +0 -1
  132. package/lib/src/embed/liveboard.d.ts.map +1 -1
  133. package/lib/src/embed/liveboard.js +4 -27
  134. package/lib/src/embed/liveboard.js.map +1 -1
  135. package/lib/src/embed/liveboard.spec.js +25 -31
  136. package/lib/src/embed/liveboard.spec.js.map +1 -1
  137. package/lib/src/embed/sage.d.ts +0 -1
  138. package/lib/src/embed/sage.d.ts.map +1 -1
  139. package/lib/src/embed/sage.js +6 -10
  140. package/lib/src/embed/sage.js.map +1 -1
  141. package/lib/src/embed/search-bar.d.ts +0 -1
  142. package/lib/src/embed/search-bar.d.ts.map +1 -1
  143. package/lib/src/embed/search-bar.js +7 -11
  144. package/lib/src/embed/search-bar.js.map +1 -1
  145. package/lib/src/embed/search.d.ts +0 -1
  146. package/lib/src/embed/search.d.ts.map +1 -1
  147. package/lib/src/embed/search.js +8 -7
  148. package/lib/src/embed/search.js.map +1 -1
  149. package/lib/src/embed/ts-embed.d.ts +4 -6
  150. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  151. package/lib/src/embed/ts-embed.js +20 -21
  152. package/lib/src/embed/ts-embed.js.map +1 -1
  153. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  154. package/lib/src/embed/ts-embed.spec.js +123 -1
  155. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  156. package/lib/src/errors.d.ts +10 -0
  157. package/lib/src/errors.d.ts.map +1 -1
  158. package/lib/src/errors.js +10 -0
  159. package/lib/src/errors.js.map +1 -1
  160. package/lib/src/index.d.ts +2 -2
  161. package/lib/src/index.d.ts.map +1 -1
  162. package/lib/src/index.js +2 -2
  163. package/lib/src/index.js.map +1 -1
  164. package/lib/src/react/index.d.ts +1 -1
  165. package/lib/src/react/index.d.ts.map +1 -1
  166. package/lib/src/react/index.js +1 -1
  167. package/lib/src/react/index.js.map +1 -1
  168. package/lib/src/types.d.ts +135 -17
  169. package/lib/src/types.d.ts.map +1 -1
  170. package/lib/src/types.js +39 -20
  171. package/lib/src/types.js.map +1 -1
  172. package/lib/src/utils/custom-actions.d.ts +12 -0
  173. package/lib/src/utils/custom-actions.d.ts.map +1 -0
  174. package/lib/src/utils/custom-actions.js +175 -0
  175. package/lib/src/utils/custom-actions.js.map +1 -0
  176. package/lib/src/utils/custom-actions.spec.d.ts +2 -0
  177. package/lib/src/utils/custom-actions.spec.d.ts.map +1 -0
  178. package/lib/src/utils/custom-actions.spec.js +397 -0
  179. package/lib/src/utils/custom-actions.spec.js.map +1 -0
  180. package/lib/src/utils/processData.d.ts.map +1 -1
  181. package/lib/src/utils/processData.js +10 -0
  182. package/lib/src/utils/processData.js.map +1 -1
  183. package/lib/src/utils/processData.spec.js +11 -0
  184. package/lib/src/utils/processData.spec.js.map +1 -1
  185. package/lib/src/utils.d.ts +7 -0
  186. package/lib/src/utils.d.ts.map +1 -1
  187. package/lib/src/utils.js +9 -0
  188. package/lib/src/utils.js.map +1 -1
  189. package/lib/src/utils.spec.js +29 -1
  190. package/lib/src/utils.spec.js.map +1 -1
  191. package/lib/src/visual-embed-sdk.d.ts +147 -32
  192. package/package.json +3 -3
  193. package/src/embed/app.spec.ts +85 -3
  194. package/src/embed/app.ts +21 -0
  195. package/src/embed/bodyless-conversation.ts +3 -8
  196. package/src/embed/conversation.ts +2 -17
  197. package/src/embed/liveboard.spec.ts +35 -35
  198. package/src/embed/liveboard.ts +4 -32
  199. package/src/embed/sage.ts +7 -12
  200. package/src/embed/search-bar.tsx +7 -14
  201. package/src/embed/search.ts +7 -18
  202. package/src/embed/ts-embed.spec.ts +136 -2
  203. package/src/embed/ts-embed.ts +25 -28
  204. package/src/errors.ts +11 -0
  205. package/src/index.ts +4 -0
  206. package/src/react/index.tsx +1 -0
  207. package/src/types.ts +198 -76
  208. package/src/utils/custom-actions.spec.ts +431 -0
  209. package/src/utils/custom-actions.ts +217 -0
  210. package/src/utils/processData.spec.ts +12 -0
  211. package/src/utils/processData.ts +10 -0
  212. package/src/utils.spec.ts +34 -0
  213. package/src/utils.ts +10 -0
  214. package/dist/index-BDlM0f0T.js +0 -7371
  215. package/dist/index-D1pyb7RG.js +0 -7371
  216. package/dist/index-DeFzsyFF.js +0 -7371
  217. package/dist/index-Dpf0rd6w.js +0 -7371
  218. package/dist/index-UuEbsISo.js +0 -7447
  219. package/dist/index-e3Uw3YFO.js +0 -7371
  220. package/dist/index-k7pkZMhx.js +0 -7371
@@ -368,6 +368,36 @@ describe('Liveboard/viz embed tests', () => {
368
368
  });
369
369
  });
370
370
 
371
+ test('should add liveboardXLSXCSVDownload flag and set value to true to the iframe src', async () => {
372
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
373
+ ...defaultViewConfig,
374
+ liveboardId,
375
+ liveboardXLSXCSVDownload: true,
376
+ } as LiveboardViewConfig);
377
+ liveboardEmbed.render();
378
+ await executeAfterWait(() => {
379
+ expectUrlMatchesWithParams(
380
+ getIFrameSrc(),
381
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardXLSXCSVDownloadEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
382
+ );
383
+ });
384
+ });
385
+
386
+ test('should add liveboardXLSXCSVDownload flag and set value to false to the iframe src', async () => {
387
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
388
+ ...defaultViewConfig,
389
+ liveboardId,
390
+ liveboardXLSXCSVDownload: false,
391
+ } as LiveboardViewConfig);
392
+ liveboardEmbed.render();
393
+ await executeAfterWait(() => {
394
+ expectUrlMatchesWithParams(
395
+ getIFrameSrc(),
396
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardXLSXCSVDownloadEnabled=false&${prefixParams}#/embed/viz/${liveboardId}`,
397
+ );
398
+ });
399
+ });
400
+
371
401
  test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
372
402
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
373
403
  ...defaultViewConfig,
@@ -601,14 +631,6 @@ describe('Liveboard/viz embed tests', () => {
601
631
 
602
632
  test('navigateToLiveboard should trigger the navigate event with the correct path', async (done) => {
603
633
  mockMessageChannel();
604
- // mock getSessionInfo
605
- jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue({
606
- releaseVersion: '1.0.0',
607
- userGUID: '1234567890',
608
- currentOrgId: 1,
609
- privileges: [],
610
- mixpanelToken: '1234567890',
611
- });
612
634
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
613
635
  ...defaultViewConfig,
614
636
  } as LiveboardViewConfig);
@@ -619,30 +641,16 @@ describe('Liveboard/viz embed tests', () => {
619
641
  postMessageToParent(iframe.contentWindow, {
620
642
  type: EmbedEvent.APP_INIT,
621
643
  });
622
- postMessageToParent(iframe.contentWindow, {
623
- type: EmbedEvent.AuthInit,
624
- });
625
- liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
626
644
  });
627
-
628
645
  executeAfterWait(() => {
646
+ liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
629
647
  expect(onSpy).toHaveBeenCalledWith(HostEvent.Navigate, 'embed/viz/lb1/viz1');
630
648
  done();
631
- }, 1002);
649
+ });
632
650
  });
633
651
 
634
652
  test('navigateToLiveboard with preRender', async (done) => {
635
653
  mockMessageChannel();
636
-
637
- // mock getSessionInfo
638
- jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue({
639
- releaseVersion: '1.0.0',
640
- userGUID: '1234567890',
641
- currentOrgId: 1,
642
- privileges: [],
643
- mixpanelToken: '1234567890',
644
- });
645
-
646
654
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
647
655
  ...defaultViewConfig,
648
656
  preRenderId: 'test',
@@ -654,15 +662,12 @@ describe('Liveboard/viz embed tests', () => {
654
662
  postMessageToParent(iframe.contentWindow, {
655
663
  type: EmbedEvent.APP_INIT,
656
664
  });
657
- postMessageToParent(iframe.contentWindow, {
658
- type: EmbedEvent.AuthInit,
659
- });
660
665
  });
661
666
  executeAfterWait(() => {
662
667
  liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
663
668
  expect(onSpy).toHaveBeenCalledWith(HostEvent.Navigate, 'embed/viz/lb1/viz1');
664
669
  done();
665
- }, 1002);
670
+ });
666
671
  });
667
672
  test('should set runtime parametere values in url params', async () => {
668
673
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
@@ -721,12 +726,6 @@ describe('Liveboard/viz embed tests', () => {
721
726
  });
722
727
 
723
728
  describe('PreRender flow for liveboard embed', () => {
724
- beforeAll(() => {
725
- init({
726
- thoughtSpotHost: "http://tshost",
727
- authType: AuthType.None,
728
- });
729
- });
730
729
  test('it should preRender generic with liveboard id is not passed', async (done) => {
731
730
  const consoleSpy = jest.spyOn(console, 'error');
732
731
  const libEmbed = new LiveboardEmbed(getRootEl(), {
@@ -853,7 +852,7 @@ describe('Liveboard/viz embed tests', () => {
853
852
  done();
854
853
  });
855
854
  });
856
-
855
+
857
856
  test('it should navigateToLiveboard with liveboard id is not passed with AuthInit event', async (done) => {
858
857
  mockMessageChannel();
859
858
  const consoleSpy = jest.spyOn(console, 'error');
@@ -918,6 +917,7 @@ describe('Liveboard/viz embed tests', () => {
918
917
  done();
919
918
  }, 1005);
920
919
  });
920
+
921
921
  });
922
922
 
923
923
  describe('LazyLoadingForFullHeight functionality', () => {
@@ -408,12 +408,6 @@ export class LiveboardEmbed extends V1Embed {
408
408
  * embedded Liveboard or visualization.
409
409
  */
410
410
  protected getEmbedParams() {
411
- const params = this.getEmbedParamsObject();
412
- const queryParams = getQueryParamString(params, true);
413
- return queryParams;
414
- }
415
-
416
- protected getEmbedParamsObject() {
417
411
  let params: any = {};
418
412
  params = this.getBaseQueryParams(params);
419
413
  const {
@@ -441,6 +435,7 @@ export class LiveboardEmbed extends V1Embed {
441
435
  isForceRedirect,
442
436
  dataSourceId,
443
437
  coverAndFilterOptionInPDF = false,
438
+ liveboardXLSXCSVDownload = false,
444
439
  isLiveboardStylingAndGroupingEnabled,
445
440
  } = this.viewConfig;
446
441
 
@@ -517,33 +512,10 @@ export class LiveboardEmbed extends V1Embed {
517
512
  params[Param.DataPanelV2Enabled] = dataPanelV2;
518
513
  params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
519
514
  params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
515
+ params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
516
+ const queryParams = getQueryParamString(params, true);
520
517
 
521
- if (oAuthPollingInterval !== undefined) {
522
- params[Param.OauthPollingInterval] = oAuthPollingInterval;
523
- }
524
-
525
- if (isForceRedirect) {
526
- params[Param.IsForceRedirect] = isForceRedirect;
527
- }
528
-
529
- if (dataSourceId !== undefined) {
530
- params[Param.DataSourceId] = dataSourceId;
531
- }
532
-
533
-
534
- if (isLiveboardStylingAndGroupingEnabled !== undefined) {
535
- params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
536
- }
537
-
538
- params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
539
- params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
540
- params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
541
- params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
542
- params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
543
- params[Param.DataPanelV2Enabled] = dataPanelV2;
544
- params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
545
- params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
546
- return params;
518
+ return queryParams;
547
519
  }
548
520
 
549
521
  private getIframeSuffixSrc(liveboardId: string, vizId: string, activeTabId: string) {
package/src/embed/sage.ts CHANGED
@@ -153,7 +153,12 @@ export class SageEmbed extends V1Embed {
153
153
  super(domSelector, viewConfig);
154
154
  }
155
155
 
156
- protected getEmbedParamsObject() {
156
+ /**
157
+ * Constructs a map of parameters to be passed on to the
158
+ * embedded Eureka or Sage search page.
159
+ * @returns {string} query string
160
+ */
161
+ protected getEmbedParams(): string {
157
162
  const {
158
163
  disableWorksheetChange,
159
164
  hideWorksheetSelector,
@@ -179,16 +184,6 @@ export class SageEmbed extends V1Embed {
179
184
  params[Param.IsProductTour] = !!isProductTour;
180
185
  params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
181
186
 
182
- return params;
183
- }
184
-
185
- /**
186
- * Constructs a map of parameters to be passed on to the
187
- * embedded Eureka or Sage search page.
188
- * @returns {string} query string
189
- */
190
- protected getEmbedParams(): string {
191
- const params = this.getEmbedParamsObject();
192
187
  return getQueryParamString(params, true);
193
188
  }
194
189
 
@@ -199,7 +194,7 @@ export class SageEmbed extends V1Embed {
199
194
  */
200
195
  public getIFrameSrc(): string {
201
196
  const path = 'eureka';
202
- const postHashObj: Record<string, any> = {};
197
+ const postHashObj = {};
203
198
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
204
199
  const {
205
200
  dataSource, searchOptions,
@@ -118,7 +118,12 @@ export class SearchBarEmbed extends TsEmbed {
118
118
  this.viewConfig = viewConfig;
119
119
  }
120
120
 
121
- protected getEmbedParamsObject() {
121
+ /**
122
+ * Construct the URL of the embedded ThoughtSpot search to be
123
+ * loaded in the iframe
124
+ * @param dataSources A list of data source GUIDs
125
+ */
126
+ private getIFrameSrc() {
122
127
  const {
123
128
  searchOptions,
124
129
  dataSource,
@@ -126,6 +131,7 @@ export class SearchBarEmbed extends TsEmbed {
126
131
  useLastSelectedSources = false,
127
132
  excludeSearchTokenStringFromURL,
128
133
  } = this.viewConfig;
134
+ const path = 'search-bar-embed';
129
135
  const queryParams = this.getBaseQueryParams();
130
136
 
131
137
  queryParams[Param.HideActions] = [...(queryParams[Param.HideActions] ?? [])];
@@ -153,19 +159,6 @@ export class SearchBarEmbed extends TsEmbed {
153
159
  queryParams[Param.UseLastSelectedDataSource] = false;
154
160
  }
155
161
  queryParams[Param.searchEmbed] = true;
156
-
157
- return queryParams;
158
- }
159
-
160
- /**
161
- * Construct the URL of the embedded ThoughtSpot search to be
162
- * loaded in the iframe
163
- * @param dataSources A list of data source GUIDs
164
- */
165
- private getIFrameSrc() {
166
- const queryParams = this.getEmbedParamsObject();
167
- const path = 'search-bar-embed';
168
-
169
162
  let query = '';
170
163
  const queryParamsString = getQueryParamString(queryParams, true);
171
164
  if (queryParamsString) {
@@ -331,7 +331,7 @@ export const HiddenActionItemByDefaultForSearchEmbed = [
331
331
  ];
332
332
 
333
333
  export interface SearchAppInitData extends DefaultAppInitData {
334
- searchOptions?: SearchOptions;
334
+ searchOptions?: SearchOptions;
335
335
  }
336
336
 
337
337
  /**
@@ -381,7 +381,7 @@ export class SearchEmbed extends TsEmbed {
381
381
  return { ...defaultAppInitData, ...this.getSearchInitData() };
382
382
  }
383
383
 
384
- protected getEmbedParamsObject() {
384
+ protected getEmbedParams(): string {
385
385
  const {
386
386
  hideResults,
387
387
  enableSearchAssist,
@@ -398,7 +398,7 @@ export class SearchEmbed extends TsEmbed {
398
398
  collapseSearchBarInitially = false,
399
399
  enableCustomColumnGroups = false,
400
400
  isOnBeforeGetVizDataInterceptEnabled = false,
401
-
401
+ /* eslint-disable-next-line max-len */
402
402
  dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
403
403
  focusSearchBarOnRender = true,
404
404
  excludeRuntimeParametersfromURL,
@@ -443,7 +443,7 @@ export class SearchEmbed extends TsEmbed {
443
443
  }
444
444
 
445
445
  if (isOnBeforeGetVizDataInterceptEnabled) {
446
-
446
+ /* eslint-disable-next-line max-len */
447
447
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
448
448
  }
449
449
 
@@ -460,7 +460,7 @@ export class SearchEmbed extends TsEmbed {
460
460
  }
461
461
 
462
462
  queryParams[Param.searchEmbed] = true;
463
-
463
+ /* eslint-disable-next-line max-len */
464
464
  queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
465
465
  queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
466
466
  if (dataPanelCustomGroupsAccordionInitialState
@@ -468,23 +468,12 @@ export class SearchEmbed extends TsEmbed {
468
468
  || dataPanelCustomGroupsAccordionInitialState
469
469
  === DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST
470
470
  ) {
471
-
471
+ /* eslint-disable-next-line max-len */
472
472
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
473
473
  } else {
474
-
474
+ /* eslint-disable-next-line max-len */
475
475
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
476
476
  }
477
- return queryParams;
478
- }
479
-
480
- protected getEmbedParams() {
481
- const {
482
- runtimeParameters,
483
- runtimeFilters,
484
- excludeRuntimeParametersfromURL,
485
- excludeRuntimeFiltersfromURL,
486
- } = this.viewConfig;
487
- const queryParams = this.getEmbedParamsObject();
488
477
  let query = '';
489
478
  const queryParamsString = getQueryParamString(queryParams, true);
490
479
  if (queryParamsString) {
@@ -1,4 +1,3 @@
1
-
2
1
  import { resetValueFromWindow } from '../utils';
3
2
  import { ERROR_MESSAGE } from '../errors';
4
3
  import { resetCachedAuthToken } from '../authToken';
@@ -27,6 +26,8 @@ import {
27
26
  RuntimeParameter,
28
27
  Param,
29
28
  ContextMenuTriggerOptions,
29
+ CustomActionTarget,
30
+ CustomActionsPosition,
30
31
  } from '../types';
31
32
  import {
32
33
  executeAfterWait,
@@ -346,6 +347,7 @@ describe('Unit test case for ts embed', () => {
346
347
  hiddenHomeLeftNavItems: [],
347
348
  hiddenHomepageModules: [],
348
349
  hiddenListColumns: [],
350
+ customActions: [],
349
351
  hostConfig: undefined,
350
352
  reorderedHomepageModules: [],
351
353
  customVariablesForThirdPartyTools,
@@ -382,6 +384,7 @@ describe('Unit test case for ts embed', () => {
382
384
  hiddenHomeLeftNavItems: [],
383
385
  hiddenHomepageModules: [],
384
386
  hiddenListColumns: [],
387
+ customActions: [],
385
388
  hostConfig: undefined,
386
389
  reorderedHomepageModules: [],
387
390
  customVariablesForThirdPartyTools,
@@ -424,6 +427,7 @@ describe('Unit test case for ts embed', () => {
424
427
  hiddenHomeLeftNavItems: [],
425
428
  hiddenHomepageModules: [HomepageModule.MyLibrary, HomepageModule.Learning],
426
429
  hiddenListColumns: [],
430
+ customActions: [],
427
431
  reorderedHomepageModules: [],
428
432
  customVariablesForThirdPartyTools,
429
433
  },
@@ -462,6 +466,7 @@ describe('Unit test case for ts embed', () => {
462
466
  hiddenHomeLeftNavItems: [],
463
467
  hiddenHomepageModules: [],
464
468
  hiddenListColumns: [],
469
+ customActions: [],
465
470
  reorderedHomepageModules: [],
466
471
  customVariablesForThirdPartyTools,
467
472
  },
@@ -503,6 +508,7 @@ describe('Unit test case for ts embed', () => {
503
508
  hiddenHomeLeftNavItems: [],
504
509
  hiddenHomepageModules: [],
505
510
  hiddenListColumns: [],
511
+ customActions: [],
506
512
  reorderedHomepageModules:
507
513
  [HomepageModule.MyLibrary, HomepageModule.Watchlist],
508
514
  customVariablesForThirdPartyTools,
@@ -547,6 +553,7 @@ describe('Unit test case for ts embed', () => {
547
553
  hiddenHomeLeftNavItems: [],
548
554
  hiddenHomepageModules: [],
549
555
  hiddenListColumns: [],
556
+ customActions: [],
550
557
  hostConfig: undefined,
551
558
  reorderedHomepageModules: [],
552
559
  customVariablesForThirdPartyTools,
@@ -592,6 +599,7 @@ describe('Unit test case for ts embed', () => {
592
599
  hiddenHomeLeftNavItems: [],
593
600
  hiddenHomepageModules: [],
594
601
  hiddenListColumns: [],
602
+ customActions: [],
595
603
  hostConfig: undefined,
596
604
  reorderedHomepageModules: [],
597
605
  customVariablesForThirdPartyTools,
@@ -636,6 +644,7 @@ describe('Unit test case for ts embed', () => {
636
644
  hiddenHomeLeftNavItems: [],
637
645
  hiddenHomepageModules: [],
638
646
  hiddenListColumns: [],
647
+ customActions: [],
639
648
  hostConfig: undefined,
640
649
  reorderedHomepageModules: [],
641
650
  customVariablesForThirdPartyTools,
@@ -681,6 +690,7 @@ describe('Unit test case for ts embed', () => {
681
690
  hiddenHomeLeftNavItems: [],
682
691
  hiddenHomepageModules: [],
683
692
  hiddenListColumns: [],
693
+ customActions: [],
684
694
  hostConfig: undefined,
685
695
  reorderedHomepageModules: [],
686
696
  customVariablesForThirdPartyTools,
@@ -725,6 +735,7 @@ describe('Unit test case for ts embed', () => {
725
735
  [HomeLeftNavItem.Home, HomeLeftNavItem.MonitorSubscription],
726
736
  hiddenHomepageModules: [],
727
737
  hiddenListColumns: [],
738
+ customActions: [],
728
739
  reorderedHomepageModules: [],
729
740
  customVariablesForThirdPartyTools,
730
741
  },
@@ -893,6 +904,7 @@ describe('Unit test case for ts embed', () => {
893
904
  hiddenHomeLeftNavItems: [],
894
905
  hiddenHomepageModules: [],
895
906
  hiddenListColumns: [],
907
+ customActions: [],
896
908
  hostConfig: undefined,
897
909
  reorderedHomepageModules: [],
898
910
  customVariablesForThirdPartyTools: {},
@@ -977,6 +989,7 @@ describe('Unit test case for ts embed', () => {
977
989
  hiddenHomeLeftNavItems: [],
978
990
  hiddenHomepageModules: [],
979
991
  hiddenListColumns: [],
992
+ customActions: [],
980
993
  hostConfig: undefined,
981
994
  reorderedHomepageModules: [],
982
995
  customVariablesForThirdPartyTools: {},
@@ -1011,6 +1024,127 @@ describe('Unit test case for ts embed', () => {
1011
1024
  });
1012
1025
  });
1013
1026
 
1027
+ describe('getDefaultAppInitData with CustomActionsValidationResult', () => {
1028
+ beforeEach(() => {
1029
+ jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
1030
+ jest.spyOn(authService, 'verifyTokenService').mockResolvedValue(true);
1031
+ init({
1032
+ thoughtSpotHost: 'tshost',
1033
+ authType: AuthType.TrustedAuthTokenCookieless,
1034
+ getAuthToken: () => Promise.resolve('test_auth_token1'),
1035
+ });
1036
+ });
1037
+
1038
+ afterEach(() => {
1039
+ baseInstance.reset();
1040
+ jest.clearAllMocks();
1041
+ });
1042
+
1043
+ test('should handle valid custom actions and sort them by name in getDefaultAppInitData', async () => {
1044
+ const mockEmbedEventPayload = {
1045
+ type: EmbedEvent.APP_INIT,
1046
+ data: {},
1047
+ };
1048
+
1049
+ // Create a SearchEmbed with valid custom actions to test
1050
+ // CustomActionsValidationResult
1051
+ const searchEmbed = new SearchEmbed(getRootEl(), {
1052
+ ...defaultViewConfig,
1053
+ customActions: [
1054
+ {
1055
+ id: 'action1',
1056
+ name: 'Valid Action',
1057
+ target: CustomActionTarget.LIVEBOARD,
1058
+ position: CustomActionsPosition.PRIMARY,
1059
+ metadataIds: { liveboardIds: ['lb123'] }
1060
+ },
1061
+ {
1062
+ id: 'action2',
1063
+ name: 'Another Valid Action',
1064
+ target: CustomActionTarget.VIZ,
1065
+ position: CustomActionsPosition.MENU,
1066
+ metadataIds: { vizIds: ['viz456'] }
1067
+ }
1068
+ ]
1069
+ });
1070
+
1071
+ searchEmbed.render();
1072
+ const mockPort: any = {
1073
+ postMessage: jest.fn(),
1074
+ };
1075
+
1076
+ await executeAfterWait(() => {
1077
+ const iframe = getIFrameEl();
1078
+ postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
1079
+ });
1080
+
1081
+ await executeAfterWait(() => {
1082
+ expect(mockPort.postMessage).toHaveBeenCalledWith({
1083
+ type: EmbedEvent.APP_INIT,
1084
+ data: {
1085
+ customisations: {
1086
+ content: {},
1087
+ style: {
1088
+ customCSS: {},
1089
+ customCSSUrl: undefined,
1090
+ },
1091
+ },
1092
+ authToken: 'test_auth_token1',
1093
+ runtimeFilterParams: null,
1094
+ runtimeParameterParams: null,
1095
+ hiddenHomeLeftNavItems: [],
1096
+ hiddenHomepageModules: [],
1097
+ hiddenListColumns: [],
1098
+ customActions: [
1099
+ {
1100
+ id: 'action2',
1101
+ name: 'Another Valid Action',
1102
+ target: CustomActionTarget.VIZ,
1103
+ position: CustomActionsPosition.MENU,
1104
+ metadataIds: { vizIds: ['viz456'] }
1105
+ },
1106
+ {
1107
+ id: 'action1',
1108
+ name: 'Valid Action',
1109
+ target: CustomActionTarget.LIVEBOARD,
1110
+ position: CustomActionsPosition.PRIMARY,
1111
+ metadataIds: { liveboardIds: ['lb123'] }
1112
+ }
1113
+ ], // Actions should be sorted by name
1114
+ hostConfig: undefined,
1115
+ reorderedHomepageModules: [],
1116
+ customVariablesForThirdPartyTools: {},
1117
+ },
1118
+ });
1119
+
1120
+ // Verify that CustomActionsValidationResult structure is
1121
+ // correct
1122
+ const appInitData = mockPort.postMessage.mock.calls[0][0].data;
1123
+ expect(appInitData.customActions).toHaveLength(2);
1124
+ expect(appInitData.customActions).toEqual(
1125
+ expect.arrayContaining([
1126
+ expect.objectContaining({
1127
+ id: 'action1',
1128
+ name: 'Valid Action',
1129
+ target: CustomActionTarget.LIVEBOARD,
1130
+ position: CustomActionsPosition.PRIMARY
1131
+ }),
1132
+ expect.objectContaining({
1133
+ id: 'action2',
1134
+ name: 'Another Valid Action',
1135
+ target: CustomActionTarget.VIZ,
1136
+ position: CustomActionsPosition.MENU
1137
+ })
1138
+ ])
1139
+ );
1140
+
1141
+ // Verify actions are sorted by name (alphabetically)
1142
+ expect(appInitData.customActions[0].name).toBe('Another Valid Action');
1143
+ expect(appInitData.customActions[1].name).toBe('Valid Action');
1144
+ });
1145
+ });
1146
+ });
1147
+
1014
1148
  describe('Token fetch fails in cookieless authentication authType', () => {
1015
1149
  beforeEach(() => {
1016
1150
  jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
@@ -2354,7 +2488,7 @@ describe('Unit test case for ts embed', () => {
2354
2488
  });
2355
2489
 
2356
2490
  afterAll((): void => {
2357
- window.location = location as any;
2491
+ window.location = location;
2358
2492
  });
2359
2493
 
2360
2494
  it('get url params for TS', () => {