@thoughtspot/visual-embed-sdk 1.22.0 → 1.23.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 (69) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +1 -1
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/liveboard.d.ts +6 -0
  5. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  6. package/cjs/src/embed/liveboard.js +4 -1
  7. package/cjs/src/embed/liveboard.js.map +1 -1
  8. package/cjs/src/embed/liveboard.spec.js +12 -0
  9. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  10. package/cjs/src/embed/sage.d.ts +1 -0
  11. package/cjs/src/embed/sage.d.ts.map +1 -1
  12. package/cjs/src/embed/sage.js +1 -0
  13. package/cjs/src/embed/sage.js.map +1 -1
  14. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  15. package/cjs/src/embed/ts-embed.js +20 -1
  16. package/cjs/src/embed/ts-embed.js.map +1 -1
  17. package/cjs/src/embed/ts-embed.spec.js +69 -0
  18. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  19. package/cjs/src/types.d.ts +890 -210
  20. package/cjs/src/types.d.ts.map +1 -1
  21. package/cjs/src/types.js +830 -194
  22. package/cjs/src/types.js.map +1 -1
  23. package/dist/src/css-variables.d.ts +1 -1
  24. package/dist/src/css-variables.d.ts.map +1 -1
  25. package/dist/src/embed/liveboard.d.ts +6 -0
  26. package/dist/src/embed/liveboard.d.ts.map +1 -1
  27. package/dist/src/embed/sage.d.ts +1 -0
  28. package/dist/src/embed/sage.d.ts.map +1 -1
  29. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  30. package/dist/src/types.d.ts +890 -210
  31. package/dist/src/types.d.ts.map +1 -1
  32. package/dist/tsembed-react.es.js +856 -197
  33. package/dist/tsembed-react.js +837 -188
  34. package/dist/tsembed.es.js +856 -197
  35. package/dist/tsembed.js +837 -188
  36. package/dist/visual-embed-sdk-react-full.d.ts +898 -211
  37. package/dist/visual-embed-sdk-react.d.ts +898 -211
  38. package/dist/visual-embed-sdk.d.ts +898 -211
  39. package/lib/package.json +1 -1
  40. package/lib/src/css-variables.d.ts +1 -1
  41. package/lib/src/css-variables.d.ts.map +1 -1
  42. package/lib/src/embed/liveboard.d.ts +6 -0
  43. package/lib/src/embed/liveboard.d.ts.map +1 -1
  44. package/lib/src/embed/liveboard.js +4 -1
  45. package/lib/src/embed/liveboard.js.map +1 -1
  46. package/lib/src/embed/liveboard.spec.js +12 -0
  47. package/lib/src/embed/liveboard.spec.js.map +1 -1
  48. package/lib/src/embed/sage.d.ts +1 -0
  49. package/lib/src/embed/sage.d.ts.map +1 -1
  50. package/lib/src/embed/sage.js +1 -0
  51. package/lib/src/embed/sage.js.map +1 -1
  52. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  53. package/lib/src/embed/ts-embed.js +20 -1
  54. package/lib/src/embed/ts-embed.js.map +1 -1
  55. package/lib/src/embed/ts-embed.spec.js +69 -0
  56. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  57. package/lib/src/types.d.ts +890 -210
  58. package/lib/src/types.d.ts.map +1 -1
  59. package/lib/src/types.js +830 -194
  60. package/lib/src/types.js.map +1 -1
  61. package/lib/src/visual-embed-sdk.d.ts +898 -211
  62. package/package.json +1 -1
  63. package/src/css-variables.ts +1 -1
  64. package/src/embed/liveboard.spec.ts +16 -0
  65. package/src/embed/liveboard.ts +10 -0
  66. package/src/embed/sage.ts +1 -0
  67. package/src/embed/ts-embed.spec.ts +79 -0
  68. package/src/embed/ts-embed.ts +26 -1
  69. package/src/types.ts +903 -210
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -149,7 +149,7 @@ export interface CustomCssVariables {
149
149
  * Background color of the primary buttons. For example, the primary buttons such as
150
150
  * Pin* and *Save*.
151
151
  */
152
- '---ts-var-button--primary-background'?: string;
152
+ '--ts-var-button--primary-background'?: string;
153
153
 
154
154
  /**
155
155
  * Background color of the primary buttons on hover.
@@ -302,6 +302,22 @@ describe('Liveboard/viz embed tests', () => {
302
302
  });
303
303
  });
304
304
 
305
+ test('Should set hideTabPanel option', async () => {
306
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
307
+ liveboardId,
308
+ activeTabId,
309
+ liveboardV2: true,
310
+ hideTabPanel: true,
311
+ } as LiveboardViewConfig);
312
+ liveboardEmbed.render();
313
+ await executeAfterWait(() => {
314
+ expectUrlMatchesWithParams(
315
+ getIFrameSrc(),
316
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&hideTabPanel=true&isLiveboardEmbed=true&isPinboardV2Enabled=true#/embed/viz/${liveboardId}/tab/${activeTabId}`,
317
+ );
318
+ });
319
+ });
320
+
305
321
  test('navigateToLiveboard should trigger the navigate event with the correct path', (done) => {
306
322
  mockMessageChannel();
307
323
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
@@ -99,6 +99,12 @@ export interface LiveboardViewConfig extends ViewConfig {
99
99
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
100
100
  */
101
101
  activeTabId?: string;
102
+ /**
103
+ * Hide tab Panel of embedded LB
104
+ *
105
+ * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
106
+ */
107
+ hideTabPanel?: boolean;
102
108
  }
103
109
 
104
110
  /**
@@ -146,6 +152,7 @@ export class LiveboardEmbed extends V1Embed {
146
152
  visibleVizs,
147
153
  liveboardV2,
148
154
  vizId,
155
+ hideTabPanel,
149
156
  activeTabId,
150
157
  } = this.viewConfig;
151
158
 
@@ -174,6 +181,9 @@ export class LiveboardEmbed extends V1Embed {
174
181
  if (liveboardV2 !== undefined) {
175
182
  params[Param.LiveboardV2Enabled] = liveboardV2;
176
183
  }
184
+ if (hideTabPanel) {
185
+ params[Param.HideTabPanel] = hideTabPanel;
186
+ }
177
187
  const queryParams = getQueryParamString(params, true);
178
188
 
179
189
  return queryParams;
package/src/embed/sage.ts CHANGED
@@ -51,6 +51,7 @@ export const HiddenActionItemByDefaultForSageEmbed = [
51
51
  /**
52
52
  * Embed ThoughtSpot LLM and GPT based natural language search component.
53
53
  *
54
+ * @version: SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl, 9.5.1-sw
54
55
  * @group Embed components
55
56
  */
56
57
  export class SageEmbed extends V1Embed {
@@ -36,6 +36,8 @@ const defaultViewConfig = {
36
36
  };
37
37
  const pinboardId = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
38
38
  const liveboardId = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
39
+ const tabId1 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
40
+ const tabId2 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
39
41
  const thoughtSpotHost = 'tshost';
40
42
  const defaultParamsPost = '';
41
43
 
@@ -582,6 +584,83 @@ describe('Unit test case for ts embed', () => {
582
584
  });
583
585
  });
584
586
 
587
+ describe('when visible Tabs are set', () => {
588
+ test('should throw error when there are both visible and hidden Tabs - pinboard', async () => {
589
+ spyOn(console, 'error');
590
+ const pinboardEmbed = new PinboardEmbed(getRootEl(), {
591
+ visibleTabs: [tabId1],
592
+ hiddenTabs: [tabId2],
593
+ ...defaultViewConfig,
594
+ pinboardId,
595
+ } as LiveboardViewConfig);
596
+ await pinboardEmbed.render();
597
+ expect(pinboardEmbed['isError']).toBe(true);
598
+ expect(console.error).toHaveBeenCalledWith(
599
+ 'You cannot have both hidden Tabs and visible Tabs',
600
+ );
601
+ });
602
+ test('should not throw error when there are only visible or hidden Tabs - pinboard', async () => {
603
+ const pinboardEmbed = new PinboardEmbed(getRootEl(), {
604
+ hiddenTabs: [tabId1],
605
+ ...defaultViewConfig,
606
+ pinboardId,
607
+ } as LiveboardViewConfig);
608
+ pinboardEmbed.render();
609
+ expect(pinboardEmbed['isError']).toBe(false);
610
+ });
611
+
612
+ /**
613
+ *
614
+ * @param hiddenTabs
615
+ * @param visibleTabs
616
+ */
617
+ async function testTabsForLiveboards(
618
+ hiddenTabs: Array<string>,
619
+ visibleTabs: Array<string>,
620
+ ) {
621
+ spyOn(console, 'error');
622
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
623
+ hiddenTabs,
624
+ visibleTabs,
625
+ ...defaultViewConfig,
626
+ liveboardId,
627
+ } as LiveboardViewConfig);
628
+ await liveboardEmbed.render();
629
+ expect(liveboardEmbed['isError']).toBe(true);
630
+ expect(console.error).toHaveBeenCalledWith(
631
+ 'You cannot have both hidden Tabs and visible Tabs',
632
+ );
633
+ }
634
+ test('should throw error when there are both visible and hidden Tab arrays', async () => {
635
+ await testTabsForLiveboards([tabId1], [tabId2]);
636
+ });
637
+ test('should throw error when there are both visible and hidden Tab arrays as empty', async () => {
638
+ await testTabsForLiveboards([], []);
639
+ });
640
+ test('should throw error when there are both visible and hidden Tabs - one of them is an empty array', async () => {
641
+ await testTabsForLiveboards([], [tabId2]);
642
+ });
643
+
644
+ test('should not throw error when there are only visible or hidden Tab', async () => {
645
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
646
+ hiddenTabs: [tabId2],
647
+ ...defaultViewConfig,
648
+ liveboardId,
649
+ } as LiveboardViewConfig);
650
+ liveboardEmbed.render();
651
+ expect(liveboardEmbed['isError']).toBe(false);
652
+ });
653
+ test('should not throw error when there are only visible or hidden Tabs', async () => {
654
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
655
+ visibleTabs: [tabId1],
656
+ ...defaultViewConfig,
657
+ liveboardId,
658
+ } as LiveboardViewConfig);
659
+ liveboardEmbed.render();
660
+ expect(liveboardEmbed['isError']).toBe(false);
661
+ });
662
+ });
663
+
585
664
  describe('when thoughtSpotHost is empty', () => {
586
665
  beforeAll(() => {
587
666
  jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => '');
@@ -358,6 +358,8 @@ export class TsEmbed {
358
358
  disabledActionReason,
359
359
  hiddenActions,
360
360
  visibleActions,
361
+ hiddenTabs,
362
+ visibleTabs,
361
363
  showAlerts,
362
364
  additionalFlags,
363
365
  locale,
@@ -365,6 +367,9 @@ export class TsEmbed {
365
367
  contextMenuTrigger,
366
368
  linkOverride,
367
369
  insertInToSlide,
370
+ hideLiveboardHeader,
371
+ showLiveboardDescription,
372
+ showLiveboardTitle,
368
373
  } = this.viewConfig;
369
374
 
370
375
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
@@ -372,6 +377,11 @@ export class TsEmbed {
372
377
  return queryParams;
373
378
  }
374
379
 
380
+ if (Array.isArray(visibleTabs) && Array.isArray(hiddenTabs)) {
381
+ this.handleError('You cannot have both hidden Tabs and visible Tabs');
382
+ return queryParams;
383
+ }
384
+
375
385
  // TODO remove embedConfig.customCssUrl
376
386
  const cssUrlParam = customizations?.style?.customCSSUrl || this.embedConfig.customCssUrl;
377
387
 
@@ -389,7 +399,12 @@ export class TsEmbed {
389
399
  if (Array.isArray(visibleActions)) {
390
400
  queryParams[Param.VisibleActions] = visibleActions;
391
401
  }
392
-
402
+ if (Array.isArray(hiddenTabs)) {
403
+ queryParams[Param.HiddenTabs] = hiddenTabs;
404
+ }
405
+ if (Array.isArray(visibleTabs)) {
406
+ queryParams[Param.VisibleTabs] = visibleTabs;
407
+ }
393
408
  /**
394
409
  * Default behavior for context menu will be left-click
395
410
  * from version 9.2.0.cl the user have an option to override context
@@ -422,6 +437,16 @@ export class TsEmbed {
422
437
  if (insertInToSlide) {
423
438
  queryParams[Param.ShowInsertToSlide] = insertInToSlide;
424
439
  }
440
+ if (hideLiveboardHeader) {
441
+ queryParams[Param.HideLiveboardHeader] = hideLiveboardHeader;
442
+ }
443
+ if (showLiveboardDescription) {
444
+ queryParams[Param.ShowLiveboardDescription] = showLiveboardDescription;
445
+ }
446
+ if (showLiveboardTitle) {
447
+ queryParams[Param.ShowLiveboardTitle] = showLiveboardTitle;
448
+ }
449
+
425
450
  return queryParams;
426
451
  }
427
452