@thoughtspot/visual-embed-sdk 1.43.1 → 1.44.1-test

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 (151) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/api-intercept.d.ts.map +1 -1
  3. package/cjs/src/api-intercept.js +8 -3
  4. package/cjs/src/api-intercept.js.map +1 -1
  5. package/cjs/src/api-intercept.spec.js +19 -3
  6. package/cjs/src/api-intercept.spec.js.map +1 -1
  7. package/cjs/src/embed/app.d.ts +32 -0
  8. package/cjs/src/embed/app.d.ts.map +1 -1
  9. package/cjs/src/embed/app.js +9 -4
  10. package/cjs/src/embed/app.js.map +1 -1
  11. package/cjs/src/embed/app.spec.js +104 -1
  12. package/cjs/src/embed/app.spec.js.map +1 -1
  13. package/cjs/src/embed/base.d.ts +7 -0
  14. package/cjs/src/embed/base.d.ts.map +1 -1
  15. package/cjs/src/embed/base.js +16 -1
  16. package/cjs/src/embed/base.js.map +1 -1
  17. package/cjs/src/embed/base.spec.js +21 -0
  18. package/cjs/src/embed/base.spec.js.map +1 -1
  19. package/cjs/src/embed/conversation.d.ts +15 -0
  20. package/cjs/src/embed/conversation.d.ts.map +1 -1
  21. package/cjs/src/embed/conversation.js +10 -2
  22. package/cjs/src/embed/conversation.js.map +1 -1
  23. package/cjs/src/embed/conversation.spec.js +30 -1
  24. package/cjs/src/embed/conversation.spec.js.map +1 -1
  25. package/cjs/src/embed/liveboard.d.ts +33 -0
  26. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  27. package/cjs/src/embed/liveboard.js +13 -5
  28. package/cjs/src/embed/liveboard.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +108 -0
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/ts-embed.d.ts +3 -2
  32. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  33. package/cjs/src/embed/ts-embed.js +51 -17
  34. package/cjs/src/embed/ts-embed.js.map +1 -1
  35. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  36. package/cjs/src/embed/ts-embed.spec.js +93 -5
  37. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  38. package/cjs/src/errors.d.ts +7 -0
  39. package/cjs/src/errors.d.ts.map +1 -1
  40. package/cjs/src/errors.js +7 -0
  41. package/cjs/src/errors.js.map +1 -1
  42. package/cjs/src/index.d.ts +2 -2
  43. package/cjs/src/index.d.ts.map +1 -1
  44. package/cjs/src/index.js +2 -1
  45. package/cjs/src/index.js.map +1 -1
  46. package/cjs/src/react/all-types-export.d.ts +1 -1
  47. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  48. package/cjs/src/react/all-types-export.js +2 -1
  49. package/cjs/src/react/all-types-export.js.map +1 -1
  50. package/cjs/src/types.d.ts +250 -7
  51. package/cjs/src/types.d.ts.map +1 -1
  52. package/cjs/src/types.js +135 -2
  53. package/cjs/src/types.js.map +1 -1
  54. package/dist/{index-CpkMygsc.js → index-BXCUJ09L.js} +1 -1
  55. package/dist/src/api-intercept.d.ts.map +1 -1
  56. package/dist/src/embed/app.d.ts +32 -0
  57. package/dist/src/embed/app.d.ts.map +1 -1
  58. package/dist/src/embed/base.d.ts +7 -0
  59. package/dist/src/embed/base.d.ts.map +1 -1
  60. package/dist/src/embed/conversation.d.ts +15 -0
  61. package/dist/src/embed/conversation.d.ts.map +1 -1
  62. package/dist/src/embed/liveboard.d.ts +33 -0
  63. package/dist/src/embed/liveboard.d.ts.map +1 -1
  64. package/dist/src/embed/ts-embed.d.ts +3 -2
  65. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  66. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  67. package/dist/src/errors.d.ts +7 -0
  68. package/dist/src/errors.d.ts.map +1 -1
  69. package/dist/src/index.d.ts +2 -2
  70. package/dist/src/index.d.ts.map +1 -1
  71. package/dist/src/react/all-types-export.d.ts +1 -1
  72. package/dist/src/react/all-types-export.d.ts.map +1 -1
  73. package/dist/src/types.d.ts +250 -7
  74. package/dist/src/types.d.ts.map +1 -1
  75. package/dist/tsembed-react.es.js +304 -105
  76. package/dist/tsembed-react.js +303 -104
  77. package/dist/tsembed.es.js +318 -106
  78. package/dist/tsembed.js +317 -104
  79. package/dist/visual-embed-sdk-react-full.d.ts +290 -7
  80. package/dist/visual-embed-sdk-react.d.ts +283 -7
  81. package/dist/visual-embed-sdk.d.ts +290 -7
  82. package/lib/package.json +1 -1
  83. package/lib/src/api-intercept.d.ts.map +1 -1
  84. package/lib/src/api-intercept.js +9 -4
  85. package/lib/src/api-intercept.js.map +1 -1
  86. package/lib/src/api-intercept.spec.js +20 -4
  87. package/lib/src/api-intercept.spec.js.map +1 -1
  88. package/lib/src/embed/app.d.ts +32 -0
  89. package/lib/src/embed/app.d.ts.map +1 -1
  90. package/lib/src/embed/app.js +10 -5
  91. package/lib/src/embed/app.js.map +1 -1
  92. package/lib/src/embed/app.spec.js +104 -1
  93. package/lib/src/embed/app.spec.js.map +1 -1
  94. package/lib/src/embed/base.d.ts +7 -0
  95. package/lib/src/embed/base.d.ts.map +1 -1
  96. package/lib/src/embed/base.js +14 -0
  97. package/lib/src/embed/base.js.map +1 -1
  98. package/lib/src/embed/base.spec.js +21 -0
  99. package/lib/src/embed/base.spec.js.map +1 -1
  100. package/lib/src/embed/conversation.d.ts +15 -0
  101. package/lib/src/embed/conversation.d.ts.map +1 -1
  102. package/lib/src/embed/conversation.js +11 -3
  103. package/lib/src/embed/conversation.js.map +1 -1
  104. package/lib/src/embed/conversation.spec.js +31 -2
  105. package/lib/src/embed/conversation.spec.js.map +1 -1
  106. package/lib/src/embed/liveboard.d.ts +33 -0
  107. package/lib/src/embed/liveboard.d.ts.map +1 -1
  108. package/lib/src/embed/liveboard.js +14 -6
  109. package/lib/src/embed/liveboard.js.map +1 -1
  110. package/lib/src/embed/liveboard.spec.js +108 -0
  111. package/lib/src/embed/liveboard.spec.js.map +1 -1
  112. package/lib/src/embed/ts-embed.d.ts +3 -2
  113. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  114. package/lib/src/embed/ts-embed.js +52 -18
  115. package/lib/src/embed/ts-embed.js.map +1 -1
  116. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  117. package/lib/src/embed/ts-embed.spec.js +94 -6
  118. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  119. package/lib/src/errors.d.ts +7 -0
  120. package/lib/src/errors.d.ts.map +1 -1
  121. package/lib/src/errors.js +7 -0
  122. package/lib/src/errors.js.map +1 -1
  123. package/lib/src/index.d.ts +2 -2
  124. package/lib/src/index.d.ts.map +1 -1
  125. package/lib/src/index.js +2 -2
  126. package/lib/src/index.js.map +1 -1
  127. package/lib/src/react/all-types-export.d.ts +1 -1
  128. package/lib/src/react/all-types-export.d.ts.map +1 -1
  129. package/lib/src/react/all-types-export.js +1 -1
  130. package/lib/src/react/all-types-export.js.map +1 -1
  131. package/lib/src/types.d.ts +250 -7
  132. package/lib/src/types.d.ts.map +1 -1
  133. package/lib/src/types.js +134 -1
  134. package/lib/src/types.js.map +1 -1
  135. package/package.json +1 -1
  136. package/src/api-intercept.spec.ts +23 -10
  137. package/src/api-intercept.ts +9 -4
  138. package/src/embed/app.spec.ts +146 -4
  139. package/src/embed/app.ts +69 -24
  140. package/src/embed/base.spec.ts +28 -0
  141. package/src/embed/base.ts +15 -0
  142. package/src/embed/conversation.spec.ts +39 -2
  143. package/src/embed/conversation.ts +28 -2
  144. package/src/embed/liveboard.spec.ts +136 -0
  145. package/src/embed/liveboard.ts +51 -4
  146. package/src/embed/ts-embed.spec.ts +107 -15
  147. package/src/embed/ts-embed.ts +56 -19
  148. package/src/errors.ts +7 -0
  149. package/src/index.ts +2 -0
  150. package/src/react/all-types-export.ts +1 -0
  151. package/src/types.ts +260 -6
package/src/embed/app.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import { logger } from '../utils/logger';
12
- import { calculateVisibleElementData, getQueryParamString } from '../utils';
12
+ import { calculateVisibleElementData, getQueryParamString, isUndefined } from '../utils';
13
13
  import {
14
14
  Param,
15
15
  DOMSelector,
@@ -158,7 +158,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
158
158
  * If true, the top navigation bar within the ThoughtSpot app
159
159
  * is displayed. By default, the navigation bar is hidden.
160
160
  * This flag also controls the homepage left navigation bar.
161
- *
161
+ *
162
162
  * Supported embed types: `AppEmbed`
163
163
  * @default true
164
164
  * @version SDK: 1.2.0 | ThoughtSpot: 8.4.0.cl
@@ -180,7 +180,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
180
180
  * **Note**: This option does not apply to the classic homepage.
181
181
  * To access the updated modular homepage, set
182
182
  * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
183
- *
183
+ *
184
184
  * Supported embed types: `AppEmbed`
185
185
  * @default false
186
186
  * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl
@@ -196,7 +196,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
196
196
  /**
197
197
  * Control the visibility of the help (?) and profile buttons on the
198
198
  * Global nav-bar. By default, these buttons are visible on the nav-bar.
199
- *
199
+ *
200
200
  * Supported embed types: `AppEmbed`
201
201
  * @default false
202
202
  * @version SDK: 1.2.0 | ThoughtSpot: 8.4.0.cl
@@ -214,7 +214,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
214
214
  * @default true
215
215
  * Whether the help menu in the top nav bar should be served
216
216
  * from Pendo or ThoughtSpot's internal help items.
217
- *
217
+ *
218
218
  * Supported embed types: `AppEmbed`
219
219
  * @example
220
220
  * ```js
@@ -371,7 +371,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
371
371
  * Hide tag filter chips that appear when content is filtered by tags.
372
372
  * When enabled, this automatically:
373
373
  * - Hides tag filter indicators/chips from the UI
374
- *
374
+ *
375
375
  * This provides a clean interface without tag-related UI elements.
376
376
  *
377
377
  * Supported embed types: `AppEmbed`
@@ -389,7 +389,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
389
389
  hideTagFilterChips?: boolean;
390
390
  /**
391
391
  * The array of GUIDs to be hidden
392
- *
392
+ *
393
393
  * Supported embed types: `AppEmbed`
394
394
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
395
395
  * @example
@@ -407,7 +407,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
407
407
  /**
408
408
  * Render liveboards using the new v2 rendering mode
409
409
  * This is a transient flag which is primarily meant for internal use
410
- *
410
+ *
411
411
  * Supported embed types: `AppEmbed`
412
412
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
413
413
  * @hidden
@@ -415,7 +415,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
415
415
  liveboardV2?: boolean;
416
416
  /**
417
417
  * If set to true, the Search Assist feature is enabled.
418
- *
418
+ *
419
419
  * Supported embed types: `AppEmbed`
420
420
  * @default true
421
421
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
@@ -453,7 +453,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
453
453
  fullHeight?: boolean;
454
454
  /**
455
455
  * Flag to control new Modular Home experience.
456
- *
456
+ *
457
457
  * Supported embed types: `AppEmbed`
458
458
  * @default false
459
459
  * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl
@@ -498,10 +498,10 @@ export interface AppViewConfig extends AllEmbedViewConfig {
498
498
  * - EXPAND_ALL: Expand all the accordion initially in data panel v2.
499
499
  * - COLLAPSE_ALL: Collapse all the accordions initially in data panel v2.
500
500
  * - EXPAND_FIRST: Expand the first accordion and collapse the rest.
501
- *
501
+ *
502
502
  * Supported embed types: `AppEmbed`
503
503
  * @version SDK: 1.32.0 | ThoughtSpot: 10.0.0.cl
504
- * @default DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL
504
+ * @default DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL
505
505
  * @example
506
506
  * ```js
507
507
  * const embed = new AppEmbed('#embed', {
@@ -514,14 +514,14 @@ export interface AppViewConfig extends AllEmbedViewConfig {
514
514
  dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
515
515
  /**
516
516
  * Flag to use home page search bar mode
517
- *
517
+ *
518
518
  * Supported embed types: `AppEmbed`
519
519
  * @version SDK : 1.33.0 | ThoughtSpot: 10.3.0.cl
520
520
  */
521
521
  homePageSearchBarMode?: HomePageSearchBarMode;
522
522
  /**
523
523
  * This flag is used to enable unified search experience for full app embed.
524
- *
524
+ *
525
525
  * Supported embed types: `AppEmbed`
526
526
  * @version SDK: 1.34.0 | ThoughtSpot:10.5.0.cl
527
527
  * @default true
@@ -537,7 +537,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
537
537
 
538
538
  /**
539
539
  * This flag is used to enable/disable the styling and grouping in a Liveboard
540
- *
540
+ *
541
541
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`
542
542
  * @type {boolean}
543
543
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
@@ -554,7 +554,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
554
554
 
555
555
  /**
556
556
  * This flag is used to enable/disable the png embedding of liveboard in scheduled mails
557
- *
557
+ *
558
558
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`
559
559
  * @type {boolean}
560
560
  * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
@@ -571,7 +571,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
571
571
 
572
572
  /**
573
573
  * This flag is used to enable the full height lazy load data.
574
- *
574
+ *
575
575
  * @example
576
576
  * ```js
577
577
  * const embed = new AppEmbed('#embed-container', {
@@ -580,7 +580,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
580
580
  * lazyLoadingForFullHeight: true,
581
581
  * })
582
582
  * ```
583
- *
583
+ *
584
584
  * @type {boolean}
585
585
  * @default false
586
586
  * @version SDK: 1.40.0 | ThoughtSpot:10.12.0.cl
@@ -589,13 +589,13 @@ export interface AppViewConfig extends AllEmbedViewConfig {
589
589
 
590
590
  /**
591
591
  * The margin to be used for lazy loading.
592
- *
592
+ *
593
593
  * For example, if the margin is set to '10px',
594
594
  * the visualization will be loaded 10px before the its top edge is visible in the
595
595
  * viewport.
596
- *
596
+ *
597
597
  * The format is similar to CSS margin.
598
- *
598
+ *
599
599
  * @example
600
600
  * ```js
601
601
  * const embed = new AppEmbed('#embed-container', {
@@ -610,6 +610,39 @@ export interface AppViewConfig extends AllEmbedViewConfig {
610
610
  * @version SDK: 1.40.0 | ThoughtSpot:10.12.0.cl
611
611
  */
612
612
  lazyLoadingMargin?: string;
613
+
614
+ /**
615
+ * updatedSpotterChatPrompt : Controls the updated spotter chat prompt.
616
+ *
617
+ * Supported embed types: `AppEmbed`
618
+ * @default false
619
+ * @example
620
+ * ```js
621
+ * const embed = new AppEmbed('#tsEmbed', {
622
+ * ... //other embed view config
623
+ * updatedSpotterChatPrompt : true,
624
+ * })
625
+ * ```
626
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
627
+ */
628
+ updatedSpotterChatPrompt?: boolean;
629
+ /**
630
+ * This is the minimum height (in pixels) for a full-height App.
631
+ * Setting this height helps resolve issues with empty Apps and
632
+ * other screens navigable from an App.
633
+ *
634
+ * @version SDK: 1.44.2 | ThoughtSpot: 26.0.2.cl
635
+ * @default 500
636
+ * @example
637
+ * ```js
638
+ * const embed = new AppEmbed('#embed', {
639
+ * ... // other app view config
640
+ * fullHeight: true,
641
+ * minimumHeight: 600,
642
+ * });
643
+ * ```
644
+ */
645
+ minimumHeight?: number;
613
646
  }
614
647
 
615
648
  /**
@@ -619,7 +652,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
619
652
  export class AppEmbed extends V1Embed {
620
653
  protected viewConfig: AppViewConfig;
621
654
 
622
- private defaultHeight = '100%';
655
+ private defaultHeight = 500;
623
656
 
624
657
 
625
658
  constructor(domSelector: DOMSelector, viewConfig: AppViewConfig) {
@@ -656,6 +689,8 @@ export class AppEmbed extends V1Embed {
656
689
  hideLiveboardHeader = false,
657
690
  showLiveboardTitle = true,
658
691
  showLiveboardDescription = true,
692
+ showMaskedFilterChip = false,
693
+ isLiveboardMasterpiecesEnabled = false,
659
694
  hideHomepageLeftNav = false,
660
695
  modularHomeExperience = false,
661
696
  isLiveboardHeaderSticky = true,
@@ -680,6 +715,8 @@ export class AppEmbed extends V1Embed {
680
715
  isPNGInScheduledEmailsEnabled = false,
681
716
  isCentralizedLiveboardFilterUXEnabled = false,
682
717
  isLinkParametersEnabled,
718
+ updatedSpotterChatPrompt,
719
+ minimumHeight,
683
720
  } = this.viewConfig;
684
721
 
685
722
  let params: any = {};
@@ -690,6 +727,8 @@ export class AppEmbed extends V1Embed {
690
727
  params[Param.HideLiveboardHeader] = hideLiveboardHeader;
691
728
  params[Param.ShowLiveboardTitle] = showLiveboardTitle;
692
729
  params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
730
+ params[Param.ShowMaskedFilterChip] = showMaskedFilterChip;
731
+ params[Param.IsLiveboardMasterpiecesEnabled] = isLiveboardMasterpiecesEnabled;
693
732
  params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
694
733
  params[Param.IsFullAppEmbed] = true;
695
734
  params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
@@ -702,6 +741,10 @@ export class AppEmbed extends V1Embed {
702
741
 
703
742
  params = this.getBaseQueryParams(params);
704
743
 
744
+ if (!isUndefined(updatedSpotterChatPrompt)) {
745
+ params[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt;
746
+ }
747
+
705
748
  if (hideObjectSearch) {
706
749
  params[Param.HideObjectSearch] = !!hideObjectSearch;
707
750
  }
@@ -763,7 +806,7 @@ export class AppEmbed extends V1Embed {
763
806
  if (isPNGInScheduledEmailsEnabled !== undefined) {
764
807
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
765
808
  }
766
-
809
+
767
810
  if (hideTagFilterChips !== undefined) {
768
811
  params[Param.HideTagFilterChips] = hideTagFilterChips;
769
812
  }
@@ -778,6 +821,8 @@ export class AppEmbed extends V1Embed {
778
821
  ] = isCentralizedLiveboardFilterUXEnabled;
779
822
  }
780
823
 
824
+ this.defaultHeight = minimumHeight || this.defaultHeight;
825
+
781
826
  params[Param.DataPanelV2Enabled] = dataPanelV2;
782
827
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
783
828
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
@@ -879,7 +924,7 @@ export class AppEmbed extends V1Embed {
879
924
  * @param data The event payload
880
925
  */
881
926
  protected updateIFrameHeight = (data: MessagePayload) => {
882
- this.setIFrameHeight(Math.max(data.data, this.iFrame?.scrollHeight));
927
+ this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
883
928
  this.sendFullHeightLazyLoadData();
884
929
  };
885
930
 
@@ -10,6 +10,8 @@ import * as index from '../index';
10
10
  import * as base from './base';
11
11
  import * as embedConfigInstance from './embedConfig';
12
12
  import * as resetService from '../utils/resetServices';
13
+ import * as processTrigger from '../utils/processTrigger';
14
+ import { reloadIframe } from './base';
13
15
 
14
16
  import {
15
17
  executeAfterWait,
@@ -128,6 +130,32 @@ describe('Base TS Embed', () => {
128
130
  );
129
131
  });
130
132
 
133
+ test('should call reload with the provided iframe', () => {
134
+ // Arrange
135
+ const iFrameElement = document.createElement('iframe');
136
+ const html = '<body>Foo</body>';
137
+ iFrameElement.src = `data:text/html;charset=utf-8,${encodeURI(html)}`;
138
+ const spyReload = jest.spyOn(processTrigger, 'reload');
139
+
140
+ // Act
141
+ reloadIframe(iFrameElement);
142
+
143
+ // Assert
144
+ expect(spyReload).toHaveBeenCalledWith(iFrameElement);
145
+ });
146
+
147
+ test('should warn when called without an iframe element', () => {
148
+ // Arrange
149
+ const warnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
150
+
151
+ // Act
152
+ (reloadIframe as any)(undefined);
153
+
154
+ // Assert
155
+ expect(warnSpy).toHaveBeenCalledWith('reloadIframe called with no iFrame element.');
156
+ });
157
+
158
+
131
159
  test('should call the executeTML API and import TML for cookiless auth', async () => {
132
160
  jest.spyOn(authTokenService, 'getAuthenticationToken').mockResolvedValue('mockAuthToken');
133
161
  jest.spyOn(tokenizedFetchInstance, 'tokenizedFetch').mockResolvedValueOnce({
package/src/embed/base.ts CHANGED
@@ -35,6 +35,7 @@ import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
35
35
  import { getEmbedConfig, setEmbedConfig } from './embedConfig';
36
36
  import { getQueryParamString, getValueFromWindow, storeValueInWindow } from '../utils';
37
37
  import { resetAllCachedServices } from '../utils/resetServices';
38
+ import { reload } from '../utils/processTrigger';
38
39
 
39
40
  const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
40
41
  loginFailedMessage: 'Not logged in',
@@ -459,3 +460,17 @@ export function reset(): void {
459
460
  setAuthEE(null);
460
461
  authPromise = null;
461
462
  }
463
+
464
+ /**
465
+ * Reloads the ThoughtSpot iframe.
466
+ * @param iFrame
467
+ * @group Global methods
468
+ * @version SDK: 1.43.1
469
+ */
470
+ export const reloadIframe = (iFrame: HTMLIFrameElement) => {
471
+ if (!iFrame) {
472
+ logger.warn('reloadIframe called with no iFrame element.');
473
+ return;
474
+ }
475
+ reload(iFrame);
476
+ };
@@ -2,7 +2,7 @@ import { SpotterEmbed, SpotterEmbedViewConfig, ConversationEmbed } from './conve
2
2
  import { TsEmbed } from './ts-embed';
3
3
  import * as authInstance from '../auth';
4
4
  import { Action, init } from '../index';
5
- import { AuthType, Param, RuntimeFilterOp } from '../types';
5
+ import { AuthType, Param, RuntimeFilterOp, ErrorDetailsTypes, EmbedErrorCodes } from '../types';
6
6
  import {
7
7
  getDocumentBody,
8
8
  getIFrameSrc,
@@ -120,7 +120,12 @@ describe('ConversationEmbed', () => {
120
120
  (conversationEmbed as any).handleError = jest.fn();
121
121
  await conversationEmbed.render();
122
122
  expect((conversationEmbed as any).handleError).toHaveBeenCalledWith(
123
- ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
123
+ {
124
+ errorType: ErrorDetailsTypes.VALIDATION_ERROR,
125
+ message: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
126
+ code: EmbedErrorCodes.WORKSHEET_ID_NOT_FOUND,
127
+ error: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
128
+ },
124
129
  );
125
130
  });
126
131
 
@@ -362,4 +367,36 @@ describe('ConversationEmbed', () => {
362
367
  `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&param1=Date%20Range&paramVal1=30#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
363
368
  );
364
369
  });
370
+
371
+ it('should render the conversation embed with updated spotter chat prompt', async () => {
372
+ const viewConfig: SpotterEmbedViewConfig = {
373
+ worksheetId: 'worksheetId',
374
+ searchOptions: {
375
+ searchQuery: 'searchQuery',
376
+ },
377
+ updatedSpotterChatPrompt: true,
378
+ };
379
+ const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
380
+ await conversationEmbed.render();
381
+ expectUrlMatchesWithParams(
382
+ getIFrameSrc(),
383
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&updatedSpotterChatPrompt=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
384
+ );
385
+ });
386
+
387
+ it('should render the conversation embed with updated spotter chat prompt disabled', async () => {
388
+ const viewConfig: SpotterEmbedViewConfig = {
389
+ worksheetId: 'worksheetId',
390
+ searchOptions: {
391
+ searchQuery: 'searchQuery',
392
+ },
393
+ updatedSpotterChatPrompt: false,
394
+ };
395
+ const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
396
+ await conversationEmbed.render();
397
+ expectUrlMatchesWithParams(
398
+ getIFrameSrc(),
399
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&updatedSpotterChatPrompt=false#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
400
+ );
401
+ });
365
402
  });
@@ -1,6 +1,6 @@
1
1
  import isUndefined from 'lodash/isUndefined';
2
2
  import { ERROR_MESSAGE } from '../errors';
3
- import { Param, BaseViewConfig, RuntimeFilter, RuntimeParameter } from '../types';
3
+ import { Param, BaseViewConfig, RuntimeFilter, RuntimeParameter, ErrorDetailsTypes, EmbedErrorCodes } from '../types';
4
4
  import { TsEmbed } from './ts-embed';
5
5
  import { getQueryParamString, getFilterQuery, getRuntimeParameters } from '../utils';
6
6
 
@@ -180,6 +180,22 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
180
180
  * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
181
181
  */
182
182
  enablePastConversationsSidebar?: boolean;
183
+
184
+ /**
185
+ * updatedSpotterChatPrompt : Controls the updated spotter chat prompt.
186
+ *
187
+ * Supported embed types: `SpotterEmbed`
188
+ * @default false
189
+ * @example
190
+ * ```js
191
+ * const embed = new SpotterEmbed('#tsEmbed', {
192
+ * ... //other embed view config
193
+ * updatedSpotterChatPrompt : true,
194
+ * })
195
+ * ```
196
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
197
+ */
198
+ updatedSpotterChatPrompt?: boolean;
183
199
  }
184
200
 
185
201
  /**
@@ -226,10 +242,16 @@ export class SpotterEmbed extends TsEmbed {
226
242
  excludeRuntimeFiltersfromURL,
227
243
  runtimeParameters,
228
244
  excludeRuntimeParametersfromURL,
245
+ updatedSpotterChatPrompt,
229
246
  } = this.viewConfig;
230
247
 
231
248
  if (!worksheetId) {
232
- this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
249
+ this.handleError({
250
+ errorType: ErrorDetailsTypes.VALIDATION_ERROR,
251
+ message: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
252
+ code: EmbedErrorCodes.WORKSHEET_ID_NOT_FOUND,
253
+ error: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
254
+ });
233
255
  }
234
256
  const queryParams = this.getBaseQueryParams();
235
257
  queryParams[Param.SpotterEnabled] = true;
@@ -252,6 +274,10 @@ export class SpotterEmbed extends TsEmbed {
252
274
  queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
253
275
  }
254
276
 
277
+ if (!isUndefined(updatedSpotterChatPrompt)) {
278
+ queryParams[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt;
279
+ }
280
+
255
281
  return queryParams;
256
282
  }
257
283
 
@@ -407,6 +407,70 @@ describe('Liveboard/viz embed tests', () => {
407
407
  });
408
408
  });
409
409
 
410
+ test('Should add showMaskedFilterChip flag set to true to the iframe src', async () => {
411
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
412
+ ...defaultViewConfig,
413
+ liveboardId,
414
+ showMaskedFilterChip: true,
415
+ } as LiveboardViewConfig);
416
+
417
+ liveboardEmbed.render();
418
+ await executeAfterWait(() => {
419
+ expectUrlMatchesWithParams(
420
+ getIFrameSrc(),
421
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&showMaskedFilterChip=true${prefixParams}#/embed/viz/${liveboardId}`,
422
+ );
423
+ });
424
+ });
425
+
426
+ test('Should add showMaskedFilterChip flag set to false to the iframe src', async () => {
427
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
428
+ ...defaultViewConfig,
429
+ liveboardId,
430
+ showMaskedFilterChip: false,
431
+ } as LiveboardViewConfig);
432
+
433
+ liveboardEmbed.render();
434
+ await executeAfterWait(() => {
435
+ expectUrlMatchesWithParams(
436
+ getIFrameSrc(),
437
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&showMaskedFilterChip=false${prefixParams}#/embed/viz/${liveboardId}`,
438
+ );
439
+ });
440
+ });
441
+
442
+ test('Should add isLiveboardMasterpiecesEnabled flag set to true to the iframe src', async () => {
443
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
444
+ ...defaultViewConfig,
445
+ liveboardId,
446
+ isLiveboardMasterpiecesEnabled: true,
447
+ } as LiveboardViewConfig);
448
+
449
+ liveboardEmbed.render();
450
+ await executeAfterWait(() => {
451
+ expectUrlMatchesWithParams(
452
+ getIFrameSrc(),
453
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardMasterpiecesEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
454
+ );
455
+ });
456
+ });
457
+
458
+ test('Should add isLiveboardMasterpiecesEnabled flag set to false to the iframe src', async () => {
459
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
460
+ ...defaultViewConfig,
461
+ liveboardId,
462
+ isLiveboardMasterpiecesEnabled: false,
463
+ } as LiveboardViewConfig);
464
+
465
+ liveboardEmbed.render();
466
+ await executeAfterWait(() => {
467
+ expectUrlMatchesWithParams(
468
+ getIFrameSrc(),
469
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardMasterpiecesEnabled=false${prefixParams}#/embed/viz/${liveboardId}`,
470
+ );
471
+ });
472
+ });
473
+
410
474
  test('Should add hideIrrelevantFiltersAtTabLevel flag to the iframe src', async () => {
411
475
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
412
476
  ...defaultViewConfig,
@@ -852,6 +916,35 @@ describe('Liveboard/viz embed tests', () => {
852
916
  });
853
917
  });
854
918
 
919
+ test('should render the liveboard embed with updatedSpotterChatPrompt', async () => {
920
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
921
+ ...defaultViewConfig,
922
+ liveboardId,
923
+ updatedSpotterChatPrompt: true,
924
+ } as LiveboardViewConfig);
925
+ await liveboardEmbed.render();
926
+ await executeAfterWait(() => {
927
+ expectUrlMatchesWithParams(
928
+ getIFrameSrc(),
929
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&updatedSpotterChatPrompt=true#/embed/viz/${liveboardId}`,
930
+ );
931
+ });
932
+ });
933
+ test('should render the liveboard embed with updatedSpotterChatPrompt disabled', async () => {
934
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
935
+ ...defaultViewConfig,
936
+ liveboardId,
937
+ updatedSpotterChatPrompt: false,
938
+ } as LiveboardViewConfig);
939
+ await liveboardEmbed.render();
940
+ await executeAfterWait(() => {
941
+ expectUrlMatchesWithParams(
942
+ getIFrameSrc(),
943
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&updatedSpotterChatPrompt=false#/embed/viz/${liveboardId}`,
944
+ );
945
+ });
946
+ });
947
+
855
948
  test('SetActiveTab Hostevent should not trigger the navigate event with the correct path, for vizEmbed', async () => {
856
949
  const mockProcessTrigger = jest.spyOn(tsEmbed.TsEmbed.prototype, 'trigger');
857
950
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
@@ -1558,4 +1651,47 @@ describe('Liveboard/viz embed tests', () => {
1558
1651
  expect(navigateToLiveboardSpy).toHaveBeenCalledWith(liveboardId, undefined, undefined);
1559
1652
  });
1560
1653
  });
1654
+
1655
+ describe('Liveboard Embed Default Height and Minimum Height Handling', () => {
1656
+ test('should set default height to 800 when minimum height is provided', async () => {
1657
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1658
+ liveboardId,
1659
+ ...defaultViewConfig,
1660
+ fullHeight: true,
1661
+ defaultHeight: 700,
1662
+ minimumHeight: 800,
1663
+ });
1664
+ await liveboardEmbed.render();
1665
+ expect(liveboardEmbed['defaultHeight']).toBe(800);
1666
+ });
1667
+ test('should set default height to 700 when default height is provided', async () => {
1668
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1669
+ liveboardId,
1670
+ ...defaultViewConfig,
1671
+ fullHeight: true,
1672
+ defaultHeight: 700,
1673
+ });
1674
+ await liveboardEmbed.render();
1675
+ expect(liveboardEmbed['defaultHeight']).toBe(700);
1676
+ });
1677
+ test('should set default height to 800 when minimum height is provided but default height is not', async () => {
1678
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1679
+ liveboardId,
1680
+ ...defaultViewConfig,
1681
+ fullHeight: true,
1682
+ minimumHeight: 800,
1683
+ });
1684
+ await liveboardEmbed.render();
1685
+ expect(liveboardEmbed['defaultHeight']).toBe(800);
1686
+ });
1687
+ test('should set default height to 500 when neither default height nor minimum height is provided', async () => {
1688
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1689
+ liveboardId,
1690
+ ...defaultViewConfig,
1691
+ fullHeight: true,
1692
+ });
1693
+ await liveboardEmbed.render();
1694
+ expect(liveboardEmbed['defaultHeight']).toBe(500);
1695
+ });
1696
+ });
1561
1697
  });