@thoughtspot/visual-embed-sdk 1.41.0 → 1.42.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 (217) hide show
  1. package/README.md +2 -4
  2. package/cjs/package.json +8 -8
  3. package/cjs/src/authToken.d.ts +1 -0
  4. package/cjs/src/authToken.d.ts.map +1 -1
  5. package/cjs/src/authToken.js +13 -3
  6. package/cjs/src/authToken.js.map +1 -1
  7. package/cjs/src/authToken.spec.js +29 -0
  8. package/cjs/src/authToken.spec.js.map +1 -1
  9. package/cjs/src/css-variables.d.ts +54 -15
  10. package/cjs/src/css-variables.d.ts.map +1 -1
  11. package/cjs/src/embed/app.d.ts +16 -0
  12. package/cjs/src/embed/app.d.ts.map +1 -1
  13. package/cjs/src/embed/app.js +4 -1
  14. package/cjs/src/embed/app.js.map +1 -1
  15. package/cjs/src/embed/app.spec.js +10 -0
  16. package/cjs/src/embed/app.spec.js.map +1 -1
  17. package/cjs/src/embed/bodyless-conversation.d.ts +1 -0
  18. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  19. package/cjs/src/embed/bodyless-conversation.js +7 -3
  20. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  21. package/cjs/src/embed/conversation.d.ts +3 -2
  22. package/cjs/src/embed/conversation.d.ts.map +1 -1
  23. package/cjs/src/embed/conversation.js +7 -2
  24. package/cjs/src/embed/conversation.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 -2
  28. package/cjs/src/embed/liveboard.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +98 -11
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/sage.d.ts +1 -0
  32. package/cjs/src/embed/sage.d.ts.map +1 -1
  33. package/cjs/src/embed/sage.js +10 -6
  34. package/cjs/src/embed/sage.js.map +1 -1
  35. package/cjs/src/embed/sage.spec.js +20 -10
  36. package/cjs/src/embed/sage.spec.js.map +1 -1
  37. package/cjs/src/embed/search-bar.d.ts +1 -0
  38. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  39. package/cjs/src/embed/search-bar.js +11 -7
  40. package/cjs/src/embed/search-bar.js.map +1 -1
  41. package/cjs/src/embed/search.d.ts +1 -0
  42. package/cjs/src/embed/search.d.ts.map +1 -1
  43. package/cjs/src/embed/search.js +7 -8
  44. package/cjs/src/embed/search.js.map +1 -1
  45. package/cjs/src/embed/search.spec.js +10 -10
  46. package/cjs/src/embed/search.spec.js.map +1 -1
  47. package/cjs/src/embed/ts-embed.d.ts +7 -5
  48. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  49. package/cjs/src/embed/ts-embed.js +26 -9
  50. package/cjs/src/embed/ts-embed.js.map +1 -1
  51. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  52. package/cjs/src/errors.d.ts +1 -0
  53. package/cjs/src/errors.d.ts.map +1 -1
  54. package/cjs/src/errors.js +1 -0
  55. package/cjs/src/errors.js.map +1 -1
  56. package/cjs/src/react/all-types-export.spec.js +1 -1
  57. package/cjs/src/react/all-types-export.spec.js.map +1 -1
  58. package/cjs/src/react/index.d.ts.map +1 -1
  59. package/cjs/src/react/index.js +2 -1
  60. package/cjs/src/react/index.js.map +1 -1
  61. package/cjs/src/react/index.spec.js +1 -1
  62. package/cjs/src/react/index.spec.js.map +1 -1
  63. package/cjs/src/react/util.js.map +1 -1
  64. package/cjs/src/react/util.spec.d.ts +2 -0
  65. package/cjs/src/react/util.spec.d.ts.map +1 -0
  66. package/cjs/src/react/util.spec.js +78 -0
  67. package/cjs/src/react/util.spec.js.map +1 -0
  68. package/cjs/src/types.d.ts +64 -9
  69. package/cjs/src/types.d.ts.map +1 -1
  70. package/cjs/src/types.js +59 -4
  71. package/cjs/src/types.js.map +1 -1
  72. package/cjs/src/utils.d.ts +14 -0
  73. package/cjs/src/utils.d.ts.map +1 -1
  74. package/cjs/src/utils.js +22 -1
  75. package/cjs/src/utils.js.map +1 -1
  76. package/cjs/src/utils.spec.js +10 -0
  77. package/cjs/src/utils.spec.js.map +1 -1
  78. package/dist/{index-B_mxAan8.js → index-BpSohedu.js} +1 -1
  79. package/dist/src/authToken.d.ts +1 -0
  80. package/dist/src/authToken.d.ts.map +1 -1
  81. package/dist/src/css-variables.d.ts +54 -15
  82. package/dist/src/css-variables.d.ts.map +1 -1
  83. package/dist/src/embed/app.d.ts +16 -0
  84. package/dist/src/embed/app.d.ts.map +1 -1
  85. package/dist/src/embed/bodyless-conversation.d.ts +1 -0
  86. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  87. package/dist/src/embed/conversation.d.ts +3 -2
  88. package/dist/src/embed/conversation.d.ts.map +1 -1
  89. package/dist/src/embed/liveboard.d.ts +33 -0
  90. package/dist/src/embed/liveboard.d.ts.map +1 -1
  91. package/dist/src/embed/sage.d.ts +1 -0
  92. package/dist/src/embed/sage.d.ts.map +1 -1
  93. package/dist/src/embed/search-bar.d.ts +1 -0
  94. package/dist/src/embed/search-bar.d.ts.map +1 -1
  95. package/dist/src/embed/search.d.ts +1 -0
  96. package/dist/src/embed/search.d.ts.map +1 -1
  97. package/dist/src/embed/ts-embed.d.ts +7 -5
  98. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  99. package/dist/src/errors.d.ts +1 -0
  100. package/dist/src/errors.d.ts.map +1 -1
  101. package/dist/src/react/index.d.ts.map +1 -1
  102. package/dist/src/react/util.spec.d.ts +2 -0
  103. package/dist/src/react/util.spec.d.ts.map +1 -0
  104. package/dist/src/types.d.ts +64 -9
  105. package/dist/src/types.d.ts.map +1 -1
  106. package/dist/src/utils.d.ts +14 -0
  107. package/dist/src/utils.d.ts.map +1 -1
  108. package/dist/tsembed-react.es.js +180 -47
  109. package/dist/tsembed-react.js +179 -46
  110. package/dist/tsembed.es.js +178 -46
  111. package/dist/tsembed.js +177 -45
  112. package/dist/visual-embed-sdk-react-full.d.ts +9312 -9842
  113. package/dist/visual-embed-sdk-react.d.ts +9184 -9848
  114. package/dist/visual-embed-sdk.d.ts +9351 -9459
  115. package/lib/package.json +8 -8
  116. package/lib/src/authToken.d.ts +1 -0
  117. package/lib/src/authToken.d.ts.map +1 -1
  118. package/lib/src/authToken.js +11 -2
  119. package/lib/src/authToken.js.map +1 -1
  120. package/lib/src/authToken.spec.js +30 -1
  121. package/lib/src/authToken.spec.js.map +1 -1
  122. package/lib/src/css-variables.d.ts +54 -15
  123. package/lib/src/css-variables.d.ts.map +1 -1
  124. package/lib/src/embed/app.d.ts +16 -0
  125. package/lib/src/embed/app.d.ts.map +1 -1
  126. package/lib/src/embed/app.js +4 -1
  127. package/lib/src/embed/app.js.map +1 -1
  128. package/lib/src/embed/app.spec.js +10 -0
  129. package/lib/src/embed/app.spec.js.map +1 -1
  130. package/lib/src/embed/bodyless-conversation.d.ts +1 -0
  131. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  132. package/lib/src/embed/bodyless-conversation.js +7 -3
  133. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  134. package/lib/src/embed/conversation.d.ts +3 -2
  135. package/lib/src/embed/conversation.d.ts.map +1 -1
  136. package/lib/src/embed/conversation.js +7 -2
  137. package/lib/src/embed/conversation.js.map +1 -1
  138. package/lib/src/embed/liveboard.d.ts +33 -0
  139. package/lib/src/embed/liveboard.d.ts.map +1 -1
  140. package/lib/src/embed/liveboard.js +13 -2
  141. package/lib/src/embed/liveboard.js.map +1 -1
  142. package/lib/src/embed/liveboard.spec.js +98 -11
  143. package/lib/src/embed/liveboard.spec.js.map +1 -1
  144. package/lib/src/embed/sage.d.ts +1 -0
  145. package/lib/src/embed/sage.d.ts.map +1 -1
  146. package/lib/src/embed/sage.js +10 -6
  147. package/lib/src/embed/sage.js.map +1 -1
  148. package/lib/src/embed/sage.spec.js +20 -10
  149. package/lib/src/embed/sage.spec.js.map +1 -1
  150. package/lib/src/embed/search-bar.d.ts +1 -0
  151. package/lib/src/embed/search-bar.d.ts.map +1 -1
  152. package/lib/src/embed/search-bar.js +11 -7
  153. package/lib/src/embed/search-bar.js.map +1 -1
  154. package/lib/src/embed/search.d.ts +1 -0
  155. package/lib/src/embed/search.d.ts.map +1 -1
  156. package/lib/src/embed/search.js +7 -8
  157. package/lib/src/embed/search.js.map +1 -1
  158. package/lib/src/embed/search.spec.js +11 -11
  159. package/lib/src/embed/search.spec.js.map +1 -1
  160. package/lib/src/embed/ts-embed.d.ts +7 -5
  161. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  162. package/lib/src/embed/ts-embed.js +26 -9
  163. package/lib/src/embed/ts-embed.js.map +1 -1
  164. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  165. package/lib/src/errors.d.ts +1 -0
  166. package/lib/src/errors.d.ts.map +1 -1
  167. package/lib/src/errors.js +1 -0
  168. package/lib/src/errors.js.map +1 -1
  169. package/lib/src/react/all-types-export.spec.js +1 -1
  170. package/lib/src/react/all-types-export.spec.js.map +1 -1
  171. package/lib/src/react/index.d.ts.map +1 -1
  172. package/lib/src/react/index.js +2 -1
  173. package/lib/src/react/index.js.map +1 -1
  174. package/lib/src/react/index.spec.js +1 -1
  175. package/lib/src/react/index.spec.js.map +1 -1
  176. package/lib/src/react/util.js.map +1 -1
  177. package/lib/src/react/util.spec.d.ts +2 -0
  178. package/lib/src/react/util.spec.d.ts.map +1 -0
  179. package/lib/src/react/util.spec.js +76 -0
  180. package/lib/src/react/util.spec.js.map +1 -0
  181. package/lib/src/types.d.ts +64 -9
  182. package/lib/src/types.d.ts.map +1 -1
  183. package/lib/src/types.js +59 -4
  184. package/lib/src/types.js.map +1 -1
  185. package/lib/src/utils.d.ts +14 -0
  186. package/lib/src/utils.d.ts.map +1 -1
  187. package/lib/src/utils.js +20 -0
  188. package/lib/src/utils.js.map +1 -1
  189. package/lib/src/utils.spec.js +11 -1
  190. package/lib/src/utils.spec.js.map +1 -1
  191. package/package.json +8 -8
  192. package/src/authToken.spec.ts +48 -1
  193. package/src/authToken.ts +13 -2
  194. package/src/css-variables.ts +55 -17
  195. package/src/embed/app.spec.ts +14 -0
  196. package/src/embed/app.ts +23 -1
  197. package/src/embed/bodyless-conversation.ts +8 -3
  198. package/src/embed/conversation.ts +19 -4
  199. package/src/embed/liveboard.spec.ts +126 -14
  200. package/src/embed/liveboard.ts +72 -24
  201. package/src/embed/sage.spec.ts +24 -10
  202. package/src/embed/sage.ts +14 -9
  203. package/src/embed/search-bar.tsx +14 -7
  204. package/src/embed/search.spec.ts +13 -14
  205. package/src/embed/search.ts +19 -8
  206. package/src/embed/ts-embed.spec.ts +1 -1
  207. package/src/embed/ts-embed.ts +35 -13
  208. package/src/errors.ts +1 -0
  209. package/src/react/all-types-export.spec.ts +1 -1
  210. package/src/react/index.spec.tsx +1 -1
  211. package/src/react/index.tsx +4 -2
  212. package/src/react/util.spec.tsx +88 -0
  213. package/src/react/util.ts +3 -3
  214. package/src/types.ts +125 -69
  215. package/src/utils.spec.ts +18 -0
  216. package/src/utils.ts +21 -0
  217. package/lib/src/visual-embed-sdk.d.ts +0 -9705
@@ -344,6 +344,20 @@ describe('App embed tests', () => {
344
344
  });
345
345
  });
346
346
 
347
+ test('should set isPNGInScheduledEmailsEnabled to true in url', async () => {
348
+ const appEmbed = new AppEmbed(getRootEl(), {
349
+ ...defaultViewConfig,
350
+ isPNGInScheduledEmailsEnabled: true,
351
+ } as AppViewConfig);
352
+ appEmbed.render();
353
+ await executeAfterWait(() => {
354
+ expectUrlMatchesWithParams(
355
+ getIFrameSrc(),
356
+ `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&isPNGInScheduledEmailsEnabled=true${defaultParamsPost}#/home`,
357
+ );
358
+ });
359
+ });
360
+
347
361
  test('should set liveboardXLSXCSVDownload to true in url', async () => {
348
362
  const appEmbed = new AppEmbed(getRootEl(), {
349
363
  ...defaultViewConfig,
package/src/embed/app.ts CHANGED
@@ -537,6 +537,23 @@ export interface AppViewConfig extends AllEmbedViewConfig {
537
537
  */
538
538
  isLiveboardStylingAndGroupingEnabled?: boolean;
539
539
 
540
+ /**
541
+ * This flag is used to enable/disable the png embedding of liveboard in scheduled mails
542
+ *
543
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`
544
+ * @type {boolean}
545
+ * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
546
+ * @example
547
+ * ```js
548
+ * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
549
+ * const embed = new <EmbedComponent>('#tsEmbed', {
550
+ * ... // other embed view config
551
+ * isPNGInScheduledEmailsEnabled: true,
552
+ * })
553
+ * ```
554
+ */
555
+ isPNGInScheduledEmailsEnabled?: boolean;
556
+
540
557
  /**
541
558
  * This flag is used to enable the full height lazy load data.
542
559
  *
@@ -619,7 +636,7 @@ export class AppEmbed extends V1Embed {
619
636
  hideOrgSwitcher,
620
637
  enableSearchAssist,
621
638
  fullHeight,
622
- dataPanelV2 = false,
639
+ dataPanelV2 = true,
623
640
  hideLiveboardHeader = false,
624
641
  showLiveboardTitle = true,
625
642
  showLiveboardDescription = true,
@@ -645,6 +662,7 @@ export class AppEmbed extends V1Embed {
645
662
  coverAndFilterOptionInPDF = false,
646
663
  liveboardXLSXCSVDownload = false,
647
664
  isLiveboardStylingAndGroupingEnabled,
665
+ isPNGInScheduledEmailsEnabled = false,
648
666
  } = this.viewConfig;
649
667
 
650
668
  let params: any = {};
@@ -728,6 +746,10 @@ export class AppEmbed extends V1Embed {
728
746
  params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
729
747
  }
730
748
 
749
+ if (isPNGInScheduledEmailsEnabled !== undefined) {
750
+ params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
751
+ }
752
+
731
753
  params[Param.DataPanelV2Enabled] = dataPanelV2;
732
754
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
733
755
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
@@ -39,6 +39,13 @@ export class ConversationMessage extends TsEmbed {
39
39
  super(container, viewConfig);
40
40
  }
41
41
 
42
+ protected getEmbedParamsObject() {
43
+ const queryParams = this.getBaseQueryParams();
44
+ queryParams[Param.HideActions] = [...(queryParams[Param.HideActions] ?? [])];
45
+ queryParams[Param.isSpotterAgentEmbed] = true;
46
+ return queryParams;
47
+ }
48
+
42
49
  public getIframeSrc() {
43
50
  const {
44
51
  sessionId,
@@ -49,10 +56,8 @@ export class ConversationMessage extends TsEmbed {
49
56
  messageId,
50
57
  } = this.viewConfig;
51
58
  const path = 'conv-assist-answer';
52
- const queryParams = this.getBaseQueryParams();
59
+ const queryParams = this.getEmbedParamsObject();
53
60
 
54
- queryParams[Param.HideActions] = [...(queryParams[Param.HideActions] ?? [])];
55
- queryParams[Param.isSpotterAgentEmbed] = true;
56
61
  let query = '';
57
62
  const queryParamsString = getQueryParamString(queryParams, true);
58
63
  if (queryParamsString) {
@@ -61,8 +61,8 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
61
61
  * Flag to control Data panel experience
62
62
  *
63
63
  * Supported embed types: `SageEmbed`, `AppEmbed`, `SearchBarEmbed`, `LiveboardEmbed`, `SearchEmbed`
64
- * @default false
65
- * @version SDK: 1.36.0 | ThoughtSpot Cloud: 10.4.0.cl
64
+ * @default true
65
+ * @version SDK: 1.43.0 | ThoughtSpot Cloud: 10.14.0.cl
66
66
  * @example
67
67
  * ```js
68
68
  * // Replace <EmbedComponent> with embed component name. For example, SageEmbed, AppEmbed, or SearchBarEmbed
@@ -196,7 +196,7 @@ export class SpotterEmbed extends TsEmbed {
196
196
  super(container, viewConfig);
197
197
  }
198
198
 
199
- public getIframeSrc(): string {
199
+ protected getEmbedParamsObject() {
200
200
  const {
201
201
  worksheetId,
202
202
  searchOptions,
@@ -210,7 +210,7 @@ export class SpotterEmbed extends TsEmbed {
210
210
  runtimeParameters,
211
211
  excludeRuntimeParametersfromURL,
212
212
  } = this.viewConfig;
213
- const path = 'insights/conv-assist';
213
+
214
214
  if (!worksheetId) {
215
215
  this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
216
216
  }
@@ -235,6 +235,21 @@ export class SpotterEmbed extends TsEmbed {
235
235
  queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
236
236
  }
237
237
 
238
+ return queryParams;
239
+ }
240
+
241
+ public getIframeSrc(): string {
242
+ const {
243
+ worksheetId,
244
+ searchOptions,
245
+ runtimeFilters,
246
+ excludeRuntimeFiltersfromURL,
247
+ runtimeParameters,
248
+ excludeRuntimeParametersfromURL,
249
+ } = this.viewConfig;
250
+ const path = 'insights/conv-assist';
251
+ const queryParams = this.getEmbedParamsObject();
252
+
238
253
  let query = '';
239
254
  const queryParamsString = getQueryParamString(queryParams, true);
240
255
  if (queryParamsString) {
@@ -41,6 +41,16 @@ const thoughtSpotHost = 'tshost';
41
41
  const prefixParams = '&isLiveboardEmbed=true';
42
42
  const prefixParamsVizEmbed = '&isLiveboardEmbed=true&isVizEmbed=true';
43
43
 
44
+ const mockGetSessionInfo = (mockSessionInfo?: any) => {
45
+ jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue(mockSessionInfo || {
46
+ releaseVersion: '1.0.0',
47
+ userGUID: '1234567890',
48
+ currentOrgId: 1,
49
+ privileges: [],
50
+ mixpanelToken: '1234567890',
51
+ })
52
+ };
53
+
44
54
  beforeAll(() => {
45
55
  init({
46
56
  thoughtSpotHost,
@@ -77,7 +87,7 @@ describe('Liveboard/viz embed tests', () => {
77
87
  await executeAfterWait(() => {
78
88
  expectUrlMatchesWithParams(
79
89
  getIFrameSrc(),
80
- `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=false#/embed/viz/${liveboardId}`,
90
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=true#/embed/viz/${liveboardId}`,
81
91
  );
82
92
  });
83
93
  });
@@ -158,6 +168,21 @@ describe('Liveboard/viz embed tests', () => {
158
168
  });
159
169
  });
160
170
 
171
+ test('should set isPNGInScheduledEmailsEnabled to true in url', async () => {
172
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
173
+ isPNGInScheduledEmailsEnabled: true,
174
+ ...defaultViewConfig,
175
+ liveboardId,
176
+ } as LiveboardViewConfig);
177
+ liveboardEmbed.render();
178
+ await executeAfterWait(() => {
179
+ expectUrlMatchesWithParams(
180
+ getIFrameSrc(),
181
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isPNGInScheduledEmailsEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
182
+ );
183
+ });
184
+ });
185
+
161
186
  test('should set visible actions as empty array', async () => {
162
187
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
163
188
  visibleActions: [],
@@ -631,6 +656,9 @@ describe('Liveboard/viz embed tests', () => {
631
656
 
632
657
  test('navigateToLiveboard should trigger the navigate event with the correct path', async (done) => {
633
658
  mockMessageChannel();
659
+ // mock getSessionInfo
660
+
661
+ mockGetSessionInfo();
634
662
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
635
663
  ...defaultViewConfig,
636
664
  } as LiveboardViewConfig);
@@ -641,16 +669,31 @@ describe('Liveboard/viz embed tests', () => {
641
669
  postMessageToParent(iframe.contentWindow, {
642
670
  type: EmbedEvent.APP_INIT,
643
671
  });
672
+ postMessageToParent(iframe.contentWindow, {
673
+ type: EmbedEvent.AuthInit,
674
+ });
675
+ liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
644
676
  });
677
+
645
678
  executeAfterWait(() => {
646
- liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
647
679
  expect(onSpy).toHaveBeenCalledWith(HostEvent.Navigate, 'embed/viz/lb1/viz1');
648
680
  done();
649
- });
681
+ }, 1002);
650
682
  });
651
683
 
652
684
  test('navigateToLiveboard with preRender', async (done) => {
653
685
  mockMessageChannel();
686
+
687
+ // mock getSessionInfo
688
+ jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue({
689
+ releaseVersion: '1.0.0',
690
+ userGUID: '1234567890',
691
+ currentOrgId: 1,
692
+ privileges: [],
693
+ mixpanelToken: '1234567890',
694
+ });
695
+ mockGetSessionInfo();
696
+
654
697
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
655
698
  ...defaultViewConfig,
656
699
  preRenderId: 'test',
@@ -662,12 +705,15 @@ describe('Liveboard/viz embed tests', () => {
662
705
  postMessageToParent(iframe.contentWindow, {
663
706
  type: EmbedEvent.APP_INIT,
664
707
  });
708
+ postMessageToParent(iframe.contentWindow, {
709
+ type: EmbedEvent.AuthInit,
710
+ });
665
711
  });
666
712
  executeAfterWait(() => {
667
713
  liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
668
714
  expect(onSpy).toHaveBeenCalledWith(HostEvent.Navigate, 'embed/viz/lb1/viz1');
669
715
  done();
670
- });
716
+ }, 1002);
671
717
  });
672
718
  test('should set runtime parametere values in url params', async () => {
673
719
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
@@ -689,6 +735,21 @@ describe('Liveboard/viz embed tests', () => {
689
735
  });
690
736
  });
691
737
 
738
+ test('should set showSpotterLimitations parameter in url params', async () => {
739
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
740
+ ...defaultViewConfig,
741
+ liveboardId,
742
+ showSpotterLimitations: true,
743
+ } as LiveboardViewConfig);
744
+ await liveboardEmbed.render();
745
+ await executeAfterWait(() => {
746
+ expectUrlMatchesWithParams(
747
+ getIFrameSrc(),
748
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&showSpotterLimitations=true#/embed/viz/${liveboardId}`,
749
+ );
750
+ });
751
+ });
752
+
692
753
  test('SetActiveTab Hostevent should not trigger the navigate event with the correct path, for vizEmbed', async () => {
693
754
  const mockProcessTrigger = jest.spyOn(tsEmbed.TsEmbed.prototype, 'trigger');
694
755
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
@@ -726,6 +787,12 @@ describe('Liveboard/viz embed tests', () => {
726
787
  });
727
788
 
728
789
  describe('PreRender flow for liveboard embed', () => {
790
+ beforeAll(() => {
791
+ init({
792
+ thoughtSpotHost: "http://tshost",
793
+ authType: AuthType.None,
794
+ });
795
+ });
729
796
  test('it should preRender generic with liveboard id is not passed', async (done) => {
730
797
  const consoleSpy = jest.spyOn(console, 'error');
731
798
  const libEmbed = new LiveboardEmbed(getRootEl(), {
@@ -820,7 +887,6 @@ describe('Liveboard/viz embed tests', () => {
820
887
  expect((document.getElementById(libEmbed.getPreRenderIds().wrapper) as any)[ts]).toEqual(
821
888
  libEmbed,
822
889
  );
823
-
824
890
  await executeAfterWait(() => {
825
891
  const iframe = getIFrameEl();
826
892
  postMessageToParent(iframe.contentWindow, {
@@ -852,7 +918,7 @@ describe('Liveboard/viz embed tests', () => {
852
918
  done();
853
919
  });
854
920
  });
855
-
921
+
856
922
  test('it should navigateToLiveboard with liveboard id is not passed with AuthInit event', async (done) => {
857
923
  mockMessageChannel();
858
924
  const consoleSpy = jest.spyOn(console, 'error');
@@ -861,13 +927,7 @@ describe('Liveboard/viz embed tests', () => {
861
927
  preRenderId: testPreRenderId,
862
928
  });
863
929
 
864
- jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue({
865
- releaseVersion: '1.0.0',
866
- userGUID: '1234567890',
867
- currentOrgId: 1,
868
- privileges: [],
869
- mixpanelToken: '1234567890',
870
- });
930
+ mockGetSessionInfo();
871
931
  let resizeObserverCb: any;
872
932
  (window as any).ResizeObserver =
873
933
  window.ResizeObserver ||
@@ -905,7 +965,6 @@ describe('Liveboard/viz embed tests', () => {
905
965
  });
906
966
  });
907
967
 
908
-
909
968
  await executeAfterWait(() => {
910
969
  const iFrame = document.getElementById(
911
970
  libEmbed.getPreRenderIds().child,
@@ -918,6 +977,59 @@ describe('Liveboard/viz embed tests', () => {
918
977
  }, 1005);
919
978
  });
920
979
 
980
+
981
+ test('should replace existing preRender when replaceExistingPreRender is true', async () => {
982
+ const testPreRenderId = 'testReplacePreRender';
983
+
984
+ // Stub ResizeObserver for JSDOM
985
+ (window as any).ResizeObserver = (window as any).ResizeObserver
986
+ || jest.fn().mockImplementation(() => ({
987
+ disconnect: jest.fn(),
988
+ observe: jest.fn(),
989
+ unobserve: jest.fn(),
990
+ }));
991
+
992
+ // Create initial embed and show preRender (this will create the
993
+ // preRender wrapper/child)
994
+ const embedA = new LiveboardEmbed(getRootEl(), {
995
+ preRenderId: testPreRenderId,
996
+ });
997
+
998
+ await embedA.showPreRender();
999
+
1000
+ await waitFor(() => !!getIFrameEl());
1001
+
1002
+ const ids = embedA.getPreRenderIds();
1003
+ const oldWrapper = document.getElementById(ids.wrapper);
1004
+ const oldChild = document.getElementById(ids.child);
1005
+
1006
+ const tsKey = '__tsEmbed';
1007
+ expect((oldWrapper as any)[tsKey]).toBe(embedA);
1008
+
1009
+ // Create a new embed instance and preRender with
1010
+ // replaceExistingPreRender = true
1011
+ const embedB = new LiveboardEmbed(getRootEl(), {
1012
+ preRenderId: testPreRenderId,
1013
+ });
1014
+ const prerenderGenericSpy = jest.spyOn(embedB, 'prerenderGeneric');
1015
+
1016
+ await embedB.preRender(false, true);
1017
+
1018
+ await waitFor(() => (document.getElementById(ids.wrapper) as any)?.[tsKey] === embedB);
1019
+
1020
+ const newWrapper = document.getElementById(ids.wrapper);
1021
+ const newChild = document.getElementById(ids.child);
1022
+
1023
+ // Should have called prerenderGeneric for the new embed instance
1024
+ expect(prerenderGenericSpy).toHaveBeenCalledTimes(1);
1025
+
1026
+ // Wrapper should be replaced (new wrapper element), child iframe
1027
+ // may be reused
1028
+ expect(newWrapper).not.toBe(oldWrapper);
1029
+
1030
+ // __tsEmbed on wrapper should now point to the new embed instance
1031
+ expect((newWrapper as any)[tsKey]).toBe(embedB);
1032
+ });
921
1033
  });
922
1034
 
923
1035
  describe('LazyLoadingForFullHeight functionality', () => {
@@ -46,7 +46,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
46
46
  * incrementally as users scroll the page to view the charts and tables.
47
47
  *
48
48
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
49
- *
49
+ *
50
50
  * Supported embed types: `LiveboardEmbed`
51
51
  * @example
52
52
  * ```js
@@ -61,7 +61,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
61
61
  * This is the minimum height(in pixels) for a full-height Liveboard.
62
62
  * Setting this height helps resolve issues with empty Liveboards and
63
63
  * other screens navigable from a Liveboard.
64
- *
64
+ *
65
65
  * Supported embed types: `LiveboardEmbed`
66
66
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
67
67
  * @default 500
@@ -90,7 +90,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
90
90
  /**
91
91
  * The Liveboard to display in the embedded view.
92
92
  * Use either liveboardId or pinboardId to reference the Liveboard to embed.
93
- *
93
+ *
94
94
  * Supported embed types: `LiveboardEmbed`
95
95
  * @version SDK: 1.3.0 | ThoughtSpot ts7.aug.cl, 7.2.1
96
96
  * @example
@@ -108,7 +108,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
108
108
  pinboardId?: string;
109
109
  /**
110
110
  * The visualization within the Liveboard to display.
111
- *
111
+ *
112
112
  * Supported embed types: `LiveboardEmbed`
113
113
  * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
114
114
  * @example
@@ -123,7 +123,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
123
123
  /**
124
124
  * If set to true, all filter chips from a
125
125
  * Liveboard page will be read-only (no X buttons)
126
- *
126
+ *
127
127
  * Supported embed types: `LiveboardEmbed`
128
128
  * @version SDK: 1.3.0 | ThoughtSpot ts7.aug.cl, 7.2.1.sw
129
129
  * @example
@@ -139,7 +139,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
139
139
  * Array of visualization IDs which should be visible when the Liveboard
140
140
  * renders. This can be changed by triggering the `SetVisibleVizs`
141
141
  * event.
142
- *
142
+ *
143
143
  * Supported embed types: `LiveboardEmbed`
144
144
  * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
145
145
  * @example
@@ -161,7 +161,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
161
161
  /**
162
162
  * Render embedded Liveboards and visualizations in the
163
163
  * new Liveboard experience mode.
164
- *
164
+ *
165
165
  * Supported embed types: `LiveboardEmbed`
166
166
  * @version SDK: 1.14.0 | ThoughtSpot: 8.6.0.cl, 8.8.1-sw
167
167
  * @example
@@ -176,7 +176,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
176
176
  /**
177
177
  * Set a Liveboard tab as an active tab.
178
178
  * Specify the tab ID.
179
- *
179
+ *
180
180
  * Supported embed types: `LiveboardEmbed`
181
181
  * @example
182
182
  * ```js
@@ -190,7 +190,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
190
190
  activeTabId?: string;
191
191
  /**
192
192
  * Show or hide the tab panel of the embedded Liveboard.
193
- *
193
+ *
194
194
  * Supported embed types: `LiveboardEmbed`
195
195
  * @version SDK: 1.25.0 | ThoughtSpot: 9.6.0.cl, 9.8.0.sw
196
196
  * @example
@@ -211,7 +211,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
211
211
  *
212
212
  * Since, this will show preview images, be careful that it may show
213
213
  * undesired data to the user when using row level security.
214
- *
214
+ *
215
215
  * Supported embed types: `LiveboardEmbed`
216
216
  * @example
217
217
  * ```js
@@ -227,8 +227,8 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
227
227
  showPreviewLoader?: boolean;
228
228
  /**
229
229
  * The Liveboard to run on regular intervals to fetch the cdw token.
230
- *
231
- * Supported embed types: `LiveboardEmbed`
230
+ *
231
+ * Supported embed types: `LiveboardEmbed`
232
232
  * @hidden
233
233
  * @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
234
234
  * @example
@@ -242,7 +242,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
242
242
 
243
243
  /**
244
244
  * The Liveboard is set to force a token fetch during the initial load.
245
- *
245
+ *
246
246
  * Supported embed types: `LiveboardEmbed`
247
247
  * @hidden
248
248
  * @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
@@ -259,7 +259,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
259
259
  * The source connection ID for authentication.
260
260
  * @hidden
261
261
  * @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
262
- *
262
+ *
263
263
  * Supported embed types: `LiveboardEmbed`
264
264
  * @example
265
265
  * ```js
@@ -273,7 +273,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
273
273
  * The list of tab IDs to hide from the embedded.
274
274
  * This Tabs will be hidden from their respective LBs.
275
275
  * Use this to hide an tabID.
276
- *
276
+ *
277
277
  * Supported embed types: `LiveboardEmbed`
278
278
  * @example
279
279
  * ```js
@@ -293,7 +293,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
293
293
  * Only the tabs specified in the array will be shown in the Liveboard.
294
294
  *
295
295
  * Use either `visibleTabs` or `hiddenTabs`.
296
- *
296
+ *
297
297
  * Supported embed types: `LiveboardEmbed`
298
298
  * @version SDK: 1.26.0 | ThoughtSpot: 9.7.0.cl, 10.1.0.sw
299
299
  * @example
@@ -310,7 +310,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
310
310
  visibleTabs?: string[];
311
311
  /**
312
312
  * This flag is used to enable/disable the styling and grouping in a Liveboard
313
- *
313
+ *
314
314
  * Supported embed types: `LiveboardEmbed`, `AppEmbed`
315
315
  * @type {boolean}
316
316
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
@@ -324,9 +324,25 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
324
324
  * ```
325
325
  */
326
326
  isLiveboardStylingAndGroupingEnabled?: boolean;
327
+ /**
328
+ * This flag is used to enable/disable the png embedding of liveboard in scheduled mails
329
+ *
330
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`
331
+ * @type {boolean}
332
+ * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
333
+ * @example
334
+ * ```js
335
+ * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
336
+ * const embed = new <EmbedComponent>('#tsEmbed', {
337
+ * ... // other embed view config
338
+ * isPNGInScheduledEmailsEnabled: true,
339
+ * })
340
+ * ```
341
+ */
342
+ isPNGInScheduledEmailsEnabled?: boolean;
327
343
  /**
328
344
  * This flag is used to enable the full height lazy load data.
329
- *
345
+ *
330
346
  * @example
331
347
  * ```js
332
348
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -335,7 +351,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
335
351
  * lazyLoadingForFullHeight: true,
336
352
  * })
337
353
  * ```
338
- *
354
+ *
339
355
  * @type {boolean}
340
356
  * @default false
341
357
  * @version SDK: 1.40.0 | ThoughtSpot:10.12.0.cl
@@ -343,13 +359,13 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
343
359
  lazyLoadingForFullHeight?: boolean;
344
360
  /**
345
361
  * The margin to be used for lazy loading.
346
- *
362
+ *
347
363
  * For example, if the margin is set to '10px',
348
364
  * the visualization will be loaded 10px before the its top edge is visible in the
349
365
  * viewport.
350
- *
366
+ *
351
367
  * The format is similar to CSS margin.
352
- *
368
+ *
353
369
  * @example
354
370
  * ```js
355
371
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -364,6 +380,22 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
364
380
  * @version SDK: 1.40.0 | ThoughtSpot:10.12.0.cl
365
381
  */
366
382
  lazyLoadingMargin?: string;
383
+ /**
384
+ * showSpotterLimitations : show limitation text
385
+ * of the spotter underneath the chat input.
386
+ * default is false.
387
+ *
388
+ * @example
389
+ * ```js
390
+ * const embed = new LiveboardEmbed('#embed-container', {
391
+ * // ...other options
392
+ * showSpotterLimitations: true,
393
+ * })
394
+ * ```
395
+ * @type {boolean}
396
+ * @version SDK: 1.41.1 | ThoughtSpot: 10.5.0.cl
397
+ */
398
+ showSpotterLimitations?: boolean;
367
399
  }
368
400
 
369
401
  /**
@@ -408,6 +440,12 @@ export class LiveboardEmbed extends V1Embed {
408
440
  * embedded Liveboard or visualization.
409
441
  */
410
442
  protected getEmbedParams() {
443
+ const params = this.getEmbedParamsObject();
444
+ const queryParams = getQueryParamString(params, true);
445
+ return queryParams;
446
+ }
447
+
448
+ protected getEmbedParamsObject() {
411
449
  let params: any = {};
412
450
  params = this.getBaseQueryParams(params);
413
451
  const {
@@ -429,7 +467,7 @@ export class LiveboardEmbed extends V1Embed {
429
467
  hideIrrelevantChipsInLiveboardTabs = false,
430
468
  enableAskSage,
431
469
  enable2ColumnLayout,
432
- dataPanelV2 = false,
470
+ dataPanelV2 = true,
433
471
  enableCustomColumnGroups = false,
434
472
  oAuthPollingInterval,
435
473
  isForceRedirect,
@@ -437,6 +475,8 @@ export class LiveboardEmbed extends V1Embed {
437
475
  coverAndFilterOptionInPDF = false,
438
476
  liveboardXLSXCSVDownload = false,
439
477
  isLiveboardStylingAndGroupingEnabled,
478
+ isPNGInScheduledEmailsEnabled = false,
479
+ showSpotterLimitations,
440
480
  } = this.viewConfig;
441
481
 
442
482
  const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
@@ -504,6 +544,14 @@ export class LiveboardEmbed extends V1Embed {
504
544
  params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
505
545
  }
506
546
 
547
+ if (isPNGInScheduledEmailsEnabled !== undefined) {
548
+ params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
549
+ }
550
+
551
+ if (showSpotterLimitations !== undefined) {
552
+ params[Param.ShowSpotterLimitations] = showSpotterLimitations;
553
+ }
554
+
507
555
  params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
508
556
  params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
509
557
  params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
@@ -515,7 +563,7 @@ export class LiveboardEmbed extends V1Embed {
515
563
  params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
516
564
  const queryParams = getQueryParamString(params, true);
517
565
 
518
- return queryParams;
566
+ return params;
519
567
  }
520
568
 
521
569
  private getIframeSuffixSrc(liveboardId: string, vizId: string, activeTabId: string) {