@thoughtspot/visual-embed-sdk 1.42.1-alpha.6 → 1.42.2

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 (202) hide show
  1. package/cjs/package.json +3 -2
  2. package/cjs/src/css-variables.d.ts +0 -48
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/app.d.ts +20 -0
  5. package/cjs/src/embed/app.d.ts.map +1 -1
  6. package/cjs/src/embed/app.js +9 -4
  7. package/cjs/src/embed/app.js.map +1 -1
  8. package/cjs/src/embed/app.spec.js +62 -0
  9. package/cjs/src/embed/app.spec.js.map +1 -1
  10. package/cjs/src/embed/bodyless-conversation.d.ts +1 -1
  11. package/cjs/src/embed/conversation.d.ts +16 -0
  12. package/cjs/src/embed/conversation.d.ts.map +1 -1
  13. package/cjs/src/embed/conversation.js +5 -2
  14. package/cjs/src/embed/conversation.js.map +1 -1
  15. package/cjs/src/embed/conversation.spec.js +25 -1
  16. package/cjs/src/embed/conversation.spec.js.map +1 -1
  17. package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
  18. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  19. package/cjs/src/embed/hostEventClient/contracts.js +0 -1
  20. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
  21. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  22. package/cjs/src/embed/liveboard.js +5 -1
  23. package/cjs/src/embed/liveboard.js.map +1 -1
  24. package/cjs/src/embed/liveboard.spec.js +46 -0
  25. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  26. package/cjs/src/embed/sage.d.ts +4 -4
  27. package/cjs/src/embed/search.d.ts.map +1 -1
  28. package/cjs/src/embed/search.js +1 -3
  29. package/cjs/src/embed/search.js.map +1 -1
  30. package/cjs/src/embed/ts-embed.d.ts +0 -2
  31. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  32. package/cjs/src/embed/ts-embed.js +14 -42
  33. package/cjs/src/embed/ts-embed.js.map +1 -1
  34. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  35. package/cjs/src/errors.js +1 -1
  36. package/cjs/src/errors.js.map +1 -1
  37. package/cjs/src/index.d.ts +2 -2
  38. package/cjs/src/index.d.ts.map +1 -1
  39. package/cjs/src/index.js +1 -2
  40. package/cjs/src/index.js.map +1 -1
  41. package/cjs/src/react/all-types-export.d.ts +1 -1
  42. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  43. package/cjs/src/react/all-types-export.js +3 -2
  44. package/cjs/src/react/all-types-export.js.map +1 -1
  45. package/cjs/src/react/util.d.ts +1 -0
  46. package/cjs/src/react/util.d.ts.map +1 -1
  47. package/cjs/src/types.d.ts +58 -93
  48. package/cjs/src/types.d.ts.map +1 -1
  49. package/cjs/src/types.js +21 -46
  50. package/cjs/src/types.js.map +1 -1
  51. package/cjs/src/utils/custom-actions.d.ts.map +1 -1
  52. package/cjs/src/utils/custom-actions.js +9 -0
  53. package/cjs/src/utils/custom-actions.js.map +1 -1
  54. package/cjs/src/utils/custom-actions.spec.js +20 -0
  55. package/cjs/src/utils/custom-actions.spec.js.map +1 -1
  56. package/cjs/src/utils/processData.d.ts +1 -1
  57. package/cjs/src/utils/processData.d.ts.map +1 -1
  58. package/cjs/src/utils/processData.js +8 -8
  59. package/cjs/src/utils/processData.js.map +1 -1
  60. package/cjs/src/utils/processData.spec.js.map +1 -1
  61. package/dist/{index-DvNA626T.js → index-CjbriUI0.js} +1 -1
  62. package/dist/src/css-variables.d.ts +0 -48
  63. package/dist/src/css-variables.d.ts.map +1 -1
  64. package/dist/src/embed/app.d.ts +20 -0
  65. package/dist/src/embed/app.d.ts.map +1 -1
  66. package/dist/src/embed/bodyless-conversation.d.ts +1 -1
  67. package/dist/src/embed/conversation.d.ts +16 -0
  68. package/dist/src/embed/conversation.d.ts.map +1 -1
  69. package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
  70. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  71. package/dist/src/embed/liveboard.d.ts.map +1 -1
  72. package/dist/src/embed/sage.d.ts +4 -4
  73. package/dist/src/embed/search.d.ts.map +1 -1
  74. package/dist/src/embed/ts-embed.d.ts +0 -2
  75. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  76. package/dist/src/index.d.ts +2 -2
  77. package/dist/src/index.d.ts.map +1 -1
  78. package/dist/src/react/all-types-export.d.ts +1 -1
  79. package/dist/src/react/all-types-export.d.ts.map +1 -1
  80. package/dist/src/react/util.d.ts +1 -0
  81. package/dist/src/react/util.d.ts.map +1 -1
  82. package/dist/src/types.d.ts +58 -93
  83. package/dist/src/types.d.ts.map +1 -1
  84. package/dist/src/utils/custom-actions.d.ts.map +1 -1
  85. package/dist/src/utils/processData.d.ts +1 -1
  86. package/dist/src/utils/processData.d.ts.map +1 -1
  87. package/dist/tsembed-react.es.js +84 -219
  88. package/dist/tsembed-react.js +228 -439
  89. package/dist/tsembed.es.js +85 -220
  90. package/dist/tsembed.js +228 -439
  91. package/dist/visual-embed-sdk-react-full.d.ts +104 -160
  92. package/dist/visual-embed-sdk-react.d.ts +95 -155
  93. package/dist/visual-embed-sdk.d.ts +95 -158
  94. package/lib/package.json +3 -2
  95. package/lib/src/css-variables.d.ts +0 -48
  96. package/lib/src/css-variables.d.ts.map +1 -1
  97. package/lib/src/embed/app.d.ts +20 -0
  98. package/lib/src/embed/app.d.ts.map +1 -1
  99. package/lib/src/embed/app.js +9 -4
  100. package/lib/src/embed/app.js.map +1 -1
  101. package/lib/src/embed/app.spec.js +62 -0
  102. package/lib/src/embed/app.spec.js.map +1 -1
  103. package/lib/src/embed/bodyless-conversation.d.ts +1 -1
  104. package/lib/src/embed/conversation.d.ts +16 -0
  105. package/lib/src/embed/conversation.d.ts.map +1 -1
  106. package/lib/src/embed/conversation.js +5 -2
  107. package/lib/src/embed/conversation.js.map +1 -1
  108. package/lib/src/embed/conversation.spec.js +25 -1
  109. package/lib/src/embed/conversation.spec.js.map +1 -1
  110. package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
  111. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  112. package/lib/src/embed/hostEventClient/contracts.js +0 -1
  113. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  114. package/lib/src/embed/liveboard.d.ts.map +1 -1
  115. package/lib/src/embed/liveboard.js +5 -1
  116. package/lib/src/embed/liveboard.js.map +1 -1
  117. package/lib/src/embed/liveboard.spec.js +47 -1
  118. package/lib/src/embed/liveboard.spec.js.map +1 -1
  119. package/lib/src/embed/sage.d.ts +4 -4
  120. package/lib/src/embed/search.d.ts.map +1 -1
  121. package/lib/src/embed/search.js +1 -3
  122. package/lib/src/embed/search.js.map +1 -1
  123. package/lib/src/embed/ts-embed.d.ts +0 -2
  124. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  125. package/lib/src/embed/ts-embed.js +14 -42
  126. package/lib/src/embed/ts-embed.js.map +1 -1
  127. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  128. package/lib/src/errors.js +1 -1
  129. package/lib/src/errors.js.map +1 -1
  130. package/lib/src/index.d.ts +2 -2
  131. package/lib/src/index.d.ts.map +1 -1
  132. package/lib/src/index.js +2 -2
  133. package/lib/src/index.js.map +1 -1
  134. package/lib/src/react/all-types-export.d.ts +1 -1
  135. package/lib/src/react/all-types-export.d.ts.map +1 -1
  136. package/lib/src/react/all-types-export.js +1 -1
  137. package/lib/src/react/all-types-export.js.map +1 -1
  138. package/lib/src/react/util.d.ts +1 -0
  139. package/lib/src/react/util.d.ts.map +1 -1
  140. package/lib/src/types.d.ts +58 -93
  141. package/lib/src/types.d.ts.map +1 -1
  142. package/lib/src/types.js +20 -45
  143. package/lib/src/types.js.map +1 -1
  144. package/lib/src/utils/custom-actions.d.ts.map +1 -1
  145. package/lib/src/utils/custom-actions.js +9 -0
  146. package/lib/src/utils/custom-actions.js.map +1 -1
  147. package/lib/src/utils/custom-actions.spec.js +20 -0
  148. package/lib/src/utils/custom-actions.spec.js.map +1 -1
  149. package/lib/src/utils/processData.d.ts +1 -1
  150. package/lib/src/utils/processData.d.ts.map +1 -1
  151. package/lib/src/utils/processData.js +8 -8
  152. package/lib/src/utils/processData.js.map +1 -1
  153. package/lib/src/utils/processData.spec.js.map +1 -1
  154. package/package.json +3 -2
  155. package/src/css-variables.ts +0 -58
  156. package/src/embed/app.spec.ts +87 -0
  157. package/src/embed/app.ts +35 -4
  158. package/src/embed/bodyless-conversation.ts +1 -1
  159. package/src/embed/conversation.spec.ts +35 -1
  160. package/src/embed/conversation.ts +22 -0
  161. package/src/embed/hostEventClient/contracts.ts +0 -10
  162. package/src/embed/liveboard.spec.ts +60 -0
  163. package/src/embed/liveboard.ts +9 -0
  164. package/src/embed/sage.ts +4 -4
  165. package/src/embed/search.ts +1 -3
  166. package/src/embed/ts-embed.spec.ts +7 -7
  167. package/src/embed/ts-embed.ts +31 -67
  168. package/src/errors.ts +1 -1
  169. package/src/index.ts +0 -2
  170. package/src/react/all-types-export.ts +2 -1
  171. package/src/types.ts +56 -94
  172. package/src/utils/custom-actions.spec.ts +22 -0
  173. package/src/utils/custom-actions.ts +11 -0
  174. package/src/utils/processData.spec.ts +1 -0
  175. package/src/utils/processData.ts +11 -11
  176. package/cjs/src/api-intercept.d.ts +0 -31
  177. package/cjs/src/api-intercept.d.ts.map +0 -1
  178. package/cjs/src/api-intercept.js +0 -117
  179. package/cjs/src/api-intercept.js.map +0 -1
  180. package/cjs/src/api-intercept.spec.d.ts +0 -2
  181. package/cjs/src/api-intercept.spec.d.ts.map +0 -1
  182. package/cjs/src/api-intercept.spec.js +0 -122
  183. package/cjs/src/api-intercept.spec.js.map +0 -1
  184. package/dist/index-BCC3Z072.js +0 -7371
  185. package/dist/index-BEzW4MDA.js +0 -7371
  186. package/dist/index-BaESA9rq.js +0 -7371
  187. package/dist/index-CFNZIcKr.js +0 -7447
  188. package/dist/index-DFnPKcjZ.js +0 -7447
  189. package/dist/index-DhFH7b7U.js +0 -7447
  190. package/dist/src/api-intercept.d.ts +0 -31
  191. package/dist/src/api-intercept.d.ts.map +0 -1
  192. package/dist/src/api-intercept.spec.d.ts +0 -2
  193. package/dist/src/api-intercept.spec.d.ts.map +0 -1
  194. package/lib/src/api-intercept.d.ts +0 -31
  195. package/lib/src/api-intercept.d.ts.map +0 -1
  196. package/lib/src/api-intercept.js +0 -110
  197. package/lib/src/api-intercept.js.map +0 -1
  198. package/lib/src/api-intercept.spec.d.ts +0 -2
  199. package/lib/src/api-intercept.spec.d.ts.map +0 -1
  200. package/lib/src/api-intercept.spec.js +0 -119
  201. package/lib/src/api-intercept.spec.js.map +0 -1
  202. package/src/api-intercept.ts +0 -136
@@ -164,6 +164,22 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
164
164
  * @version SDK: 1.41.0 | ThoughtSpot: 10.13.0.cl
165
165
  */
166
166
  excludeRuntimeParametersfromURL?: boolean;
167
+ /**
168
+ * enablePastConversationsSidebar : Controls the visibility of the past conversations
169
+ * sidebar.
170
+ *
171
+ * Supported embed types: `SpotterEmbed`
172
+ * @default false
173
+ * @example
174
+ * ```js
175
+ * const embed = new SpotterEmbed('#tsEmbed', {
176
+ * ... //other embed view config
177
+ * enablePastConversationsSidebar : true,
178
+ * })
179
+ * ```
180
+ * @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
181
+ */
182
+ enablePastConversationsSidebar?: boolean;
167
183
  }
168
184
 
169
185
  /**
@@ -205,6 +221,7 @@ export class SpotterEmbed extends TsEmbed {
205
221
  dataPanelV2,
206
222
  showSpotterLimitations,
207
223
  hideSampleQuestions,
224
+ enablePastConversationsSidebar,
208
225
  runtimeFilters,
209
226
  excludeRuntimeFiltersfromURL,
210
227
  runtimeParameters,
@@ -246,10 +263,15 @@ export class SpotterEmbed extends TsEmbed {
246
263
  excludeRuntimeFiltersfromURL,
247
264
  runtimeParameters,
248
265
  excludeRuntimeParametersfromURL,
266
+ enablePastConversationsSidebar
249
267
  } = this.viewConfig;
250
268
  const path = 'insights/conv-assist';
251
269
  const queryParams = this.getEmbedParamsObject();
252
270
 
271
+ if (!isUndefined(enablePastConversationsSidebar)) {
272
+ queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar;
273
+ }
274
+
253
275
  let query = '';
254
276
  const queryParamsString = getQueryParamString(queryParams, true);
255
277
  if (queryParamsString) {
@@ -7,7 +7,6 @@ export enum UIPassthroughEvent {
7
7
  GetAvailableUIPassthroughs = 'getAvailableUiPassthroughs',
8
8
  GetAnswerConfig = 'getAnswerPageConfig',
9
9
  GetLiveboardConfig = 'getPinboardPageConfig',
10
- GetUnsavedAnswerTML = 'getUnsavedAnswerTML',
11
10
  }
12
11
 
13
12
  // UI Passthrough Contract
@@ -64,15 +63,6 @@ export type UIPassthroughContractBase = {
64
63
  request: any;
65
64
  response: any;
66
65
  };
67
- [UIPassthroughEvent.GetUnsavedAnswerTML]: {
68
- request: {
69
- sessionId?: string;
70
- vizId?: string;
71
- };
72
- response: {
73
- tml: string;
74
- };
75
- };
76
66
  };
77
67
 
78
68
  // UI Passthrough Request and Response
@@ -16,6 +16,7 @@ import {
16
16
  defaultParams,
17
17
  defaultParamsWithoutHiddenActions,
18
18
  expectUrlMatchesWithParams,
19
+ expectUrlToHaveParamsWithValues,
19
20
  postMessageToParent,
20
21
  getIFrameEl,
21
22
  mockMessageChannel,
@@ -138,6 +139,20 @@ describe('Liveboard/viz embed tests', () => {
138
139
  });
139
140
  });
140
141
 
142
+ test('should set LiveboardStylePanel in visible actions', async () => {
143
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
144
+ visibleActions: [Action.LiveboardStylePanel],
145
+ ...defaultViewConfig,
146
+ liveboardId,
147
+ } as LiveboardViewConfig);
148
+ liveboardEmbed.render();
149
+ await executeAfterWait(() => {
150
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
151
+ visibleAction: JSON.stringify([Action.LiveboardStylePanel]),
152
+ });
153
+ });
154
+ });
155
+
141
156
  test('should set enable2ColumnLayout to true in url', async () => {
142
157
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
143
158
  enable2ColumnLayout: true,
@@ -168,6 +183,21 @@ describe('Liveboard/viz embed tests', () => {
168
183
  });
169
184
  });
170
185
 
186
+ test('should set isLiveboardPermissionV2Enabled to true in url', async () => {
187
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
188
+ isEnhancedFilterInteractivityEnabled: true,
189
+ ...defaultViewConfig,
190
+ liveboardId,
191
+ } as LiveboardViewConfig);
192
+ liveboardEmbed.render();
193
+ await executeAfterWait(() => {
194
+ expectUrlMatchesWithParams(
195
+ getIFrameSrc(),
196
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardPermissionV2Enabled=true${prefixParams}#/embed/viz/${liveboardId}`,
197
+ );
198
+ });
199
+ });
200
+
171
201
  test('should set isPNGInScheduledEmailsEnabled to true in url', async () => {
172
202
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
173
203
  isPNGInScheduledEmailsEnabled: true,
@@ -453,6 +483,36 @@ describe('Liveboard/viz embed tests', () => {
453
483
  });
454
484
  });
455
485
 
486
+ test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to true to the iframe src', async () => {
487
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
488
+ ...defaultViewConfig,
489
+ liveboardId,
490
+ isCentralizedLiveboardFilterUXEnabled: true,
491
+ } as LiveboardViewConfig);
492
+ liveboardEmbed.render();
493
+ await executeAfterWait(() => {
494
+ expectUrlMatchesWithParams(
495
+ getIFrameSrc(),
496
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isCentralizedLiveboardFilterUXEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
497
+ );
498
+ });
499
+ });
500
+
501
+ test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to false to the iframe src', async () => {
502
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
503
+ ...defaultViewConfig,
504
+ liveboardId,
505
+ isCentralizedLiveboardFilterUXEnabled: false,
506
+ } as LiveboardViewConfig);
507
+ liveboardEmbed.render();
508
+ await executeAfterWait(() => {
509
+ expectUrlMatchesWithParams(
510
+ getIFrameSrc(),
511
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isCentralizedLiveboardFilterUXEnabled=false${prefixParams}#/embed/viz/${liveboardId}`,
512
+ );
513
+ });
514
+ });
515
+
456
516
  test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
457
517
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
458
518
  ...defaultViewConfig,
@@ -465,6 +465,7 @@ export class LiveboardEmbed extends V1Embed {
465
465
  showLiveboardVerifiedBadge = true,
466
466
  showLiveboardReverifyBanner = true,
467
467
  hideIrrelevantChipsInLiveboardTabs = false,
468
+ isEnhancedFilterInteractivityEnabled = false,
468
469
  enableAskSage,
469
470
  enable2ColumnLayout,
470
471
  dataPanelV2 = true,
@@ -477,6 +478,7 @@ export class LiveboardEmbed extends V1Embed {
477
478
  isLiveboardStylingAndGroupingEnabled,
478
479
  isPNGInScheduledEmailsEnabled = false,
479
480
  showSpotterLimitations,
481
+ isCentralizedLiveboardFilterUXEnabled = false,
480
482
  isLinkParametersEnabled,
481
483
  } = this.viewConfig;
482
484
 
@@ -557,11 +559,18 @@ export class LiveboardEmbed extends V1Embed {
557
559
  params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
558
560
  }
559
561
 
562
+ if (isCentralizedLiveboardFilterUXEnabled !== undefined) {
563
+ params[
564
+ Param.isCentralizedLiveboardFilterUXEnabled
565
+ ] = isCentralizedLiveboardFilterUXEnabled;
566
+ }
567
+
560
568
  params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
561
569
  params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
562
570
  params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
563
571
  params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
564
572
  params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
573
+ params[Param.IsEnhancedFilterInteractivityEnabled] = isEnhancedFilterInteractivityEnabled;
565
574
  params[Param.DataPanelV2Enabled] = dataPanelV2;
566
575
  params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
567
576
  params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
package/src/embed/sage.ts CHANGED
@@ -69,12 +69,12 @@ export interface SageViewConfig
69
69
  */
70
70
  hideSageAnswerHeader?: boolean;
71
71
  /**
72
- * Disable the worksheet selection option.
72
+ * Disable the data source selection option.
73
73
  * @version SDK: 1.26.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
74
74
  */
75
75
  disableWorksheetChange?: boolean;
76
76
  /**
77
- * Hide the worksheet selection panel.
77
+ * Hide the data source selection panel.
78
78
  * @version SDK: 1.26.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
79
79
  */
80
80
  hideWorksheetSelector?: boolean;
@@ -92,7 +92,7 @@ export interface SageViewConfig
92
92
  showObjectSuggestions?: boolean;
93
93
  /**
94
94
  * Show or hide sample questions.
95
- * The sample questions are autogenerated based on the worksheet
95
+ * The sample questions are autogenerated based on the data Model.
96
96
  * selected for the search operation.
97
97
  *
98
98
  * Supported embed types: `SageEmbed`
@@ -107,7 +107,7 @@ export interface SageViewConfig
107
107
  */
108
108
  hideSampleQuestions?: boolean;
109
109
  /**
110
- * The data source GUID (Worksheet GUID) to set on load.
110
+ * The data source GUID (Model GUID) to set on load.
111
111
  */
112
112
  dataSource?: string;
113
113
  /**
@@ -26,7 +26,6 @@ import { ERROR_MESSAGE } from '../errors';
26
26
  import { getAuthPromise } from './base';
27
27
  import { getReleaseVersion } from '../auth';
28
28
  import { getEmbedConfig } from './embedConfig';
29
- import { getInterceptInitData } from '../api-intercept';
30
29
 
31
30
  /**
32
31
  * Configuration for search options.
@@ -443,8 +442,7 @@ export class SearchEmbed extends TsEmbed {
443
442
  queryParams[Param.HideSearchBar] = true;
444
443
  }
445
444
 
446
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
447
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
445
+ if (isOnBeforeGetVizDataInterceptEnabled) {
448
446
 
449
447
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
450
448
  }
@@ -1045,7 +1045,7 @@ describe('Unit test case for ts embed', () => {
1045
1045
  type: EmbedEvent.APP_INIT,
1046
1046
  data: {},
1047
1047
  };
1048
-
1048
+
1049
1049
  // Create a SearchEmbed with valid custom actions to test
1050
1050
  // CustomActionsValidationResult
1051
1051
  const searchEmbed = new SearchEmbed(getRootEl(), {
@@ -1067,7 +1067,7 @@ describe('Unit test case for ts embed', () => {
1067
1067
  }
1068
1068
  ]
1069
1069
  });
1070
-
1070
+
1071
1071
  searchEmbed.render();
1072
1072
  const mockPort: any = {
1073
1073
  postMessage: jest.fn(),
@@ -1116,7 +1116,7 @@ describe('Unit test case for ts embed', () => {
1116
1116
  customVariablesForThirdPartyTools: {},
1117
1117
  },
1118
1118
  });
1119
-
1119
+
1120
1120
  // Verify that CustomActionsValidationResult structure is
1121
1121
  // correct
1122
1122
  const appInitData = mockPort.postMessage.mock.calls[0][0].data;
@@ -1137,7 +1137,7 @@ describe('Unit test case for ts embed', () => {
1137
1137
  })
1138
1138
  ])
1139
1139
  );
1140
-
1140
+
1141
1141
  // Verify actions are sorted by name (alphabetically)
1142
1142
  expect(appInitData.customActions[0].name).toBe('Another Valid Action');
1143
1143
  expect(appInitData.customActions[1].name).toBe('Valid Action');
@@ -2488,7 +2488,7 @@ describe('Unit test case for ts embed', () => {
2488
2488
  });
2489
2489
 
2490
2490
  afterAll((): void => {
2491
- (window.location as any) = location;
2491
+ window.location = location as any;
2492
2492
  });
2493
2493
 
2494
2494
  it('get url params for TS', () => {
@@ -3406,7 +3406,7 @@ describe('Unit test case for ts embed', () => {
3406
3406
  new Error('Auth failed'),
3407
3407
  );
3408
3408
  const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
3409
- const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
3409
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
3410
3410
  await searchEmbed.render();
3411
3411
  await executeAfterWait(() => {
3412
3412
  expect(getRootEl().innerHTML).toContain('Not logged in');
@@ -3415,7 +3415,7 @@ describe('Unit test case for ts embed', () => {
3415
3415
  window.dispatchEvent(onlineEvent);
3416
3416
  }).not.toThrow();
3417
3417
  });
3418
-
3418
+
3419
3419
  errorSpy.mockReset();
3420
3420
  });
3421
3421
 
@@ -71,7 +71,6 @@ import { getEmbedConfig } from './embedConfig';
71
71
  import { ERROR_MESSAGE } from '../errors';
72
72
  import { getPreauthInfo } from '../utils/sessionInfoService';
73
73
  import { HostEventClient } from './hostEventClient/host-event-client';
74
- import { getInterceptInitData, handleInterceptEvent, processLegacyInterceptResponse } from '../api-intercept';
75
74
 
76
75
  const { version } = pkgInfo;
77
76
 
@@ -202,7 +201,7 @@ export class TsEmbed {
202
201
  });
203
202
  const embedConfig = getEmbedConfig();
204
203
  this.embedConfig = embedConfig;
205
-
204
+
206
205
  this.hostEventClient = new HostEventClient(this.iFrame);
207
206
  this.isReadyForRenderPromise = getInitPromise().then(async () => {
208
207
  if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
@@ -337,50 +336,33 @@ export class TsEmbed {
337
336
  this.subscribedListeners.offline = offlineEventListener;
338
337
  }
339
338
 
340
- private messageEventListener = async (event: MessageEvent<any>) => {
341
- const eventType = this.getEventType(event);
342
- const eventPort = this.getEventPort(event);
343
- const eventData = this.formatEventData(event, eventType);
344
- if (event.source === this.iFrame.contentWindow) {
345
- const processedEventData = await processEventData(
346
- eventType,
347
- eventData,
348
- this.thoughtSpotHost,
349
- this.isPreRendered ? this.preRenderWrapper : this.el,
350
- );
351
-
352
- const executeEvent = (_eventType: EmbedEvent, data: any) => {
353
- this.executeCallbacks(_eventType, data, eventPort);
354
- }
355
-
356
- if (eventType === EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
357
- const getUnsavedAnswerTml = async (props: { sessionId?: string, vizId?: string }) => {
358
- const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
359
- return response[0]?.value;
360
- }
361
- handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
362
- return;
363
- }
364
-
365
- this.executeCallbacks(
366
- eventType,
367
- processedEventData,
368
- eventPort,
369
- );
370
- }
371
- };
372
339
  /**
373
340
  * Subscribe to message events that depend on successful iframe setup
374
341
  */
375
342
  private subscribeToMessageEvents() {
376
343
  this.unsubscribeToMessageEvents();
377
344
 
378
- window.addEventListener('message', this.messageEventListener);
345
+ const messageEventListener = (event: MessageEvent<any>) => {
346
+ const eventType = this.getEventType(event);
347
+ const eventPort = this.getEventPort(event);
348
+ const eventData = this.formatEventData(event, eventType);
349
+ if (event.source === this.iFrame.contentWindow) {
350
+ this.executeCallbacks(
351
+ eventType,
352
+ processEventData(
353
+ eventType,
354
+ eventData,
355
+ this.thoughtSpotHost,
356
+ this.isPreRendered ? this.preRenderWrapper : this.el,
357
+ ),
358
+ eventPort,
359
+ );
360
+ }
361
+ };
362
+ window.addEventListener('message', messageEventListener);
379
363
 
380
- this.subscribedListeners.message = this.messageEventListener;
364
+ this.subscribedListeners.message = messageEventListener;
381
365
  }
382
-
383
-
384
366
  /**
385
367
  * Adds event listeners for both network and message events.
386
368
  * This maintains backward compatibility with the existing method.
@@ -394,7 +376,6 @@ export class TsEmbed {
394
376
  this.subscribeToMessageEvents();
395
377
  }
396
378
 
397
-
398
379
  private unsubscribeToNetworkEvents() {
399
380
  if (this.subscribedListeners.online) {
400
381
  window.removeEventListener('online', this.subscribedListeners.online);
@@ -445,7 +426,7 @@ export class TsEmbed {
445
426
  message: customActionsResult.errors,
446
427
  });
447
428
  }
448
- const baseInitData = {
429
+ return {
449
430
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
450
431
  authToken,
451
432
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -464,10 +445,7 @@ export class TsEmbed {
464
445
  this.embedConfig.customVariablesForThirdPartyTools || {},
465
446
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
466
447
  customActions: customActionsResult.actions,
467
- ...getInterceptInitData(this.embedConfig, this.viewConfig),
468
448
  };
469
-
470
- return baseInitData;
471
449
  }
472
450
 
473
451
  protected async getAppInitData() {
@@ -1045,21 +1023,6 @@ export class TsEmbed {
1045
1023
  this.iFrame.style.height = getCssDimension(height);
1046
1024
  }
1047
1025
 
1048
- protected createEmbedEventResponder = (eventPort: MessagePort | void, eventType: EmbedEvent) => {
1049
-
1050
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
1051
- if (eventType === EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
1052
- return (payload: any) => {
1053
- const payloadToSend = processLegacyInterceptResponse(payload);
1054
- this.triggerEventOnPort(eventPort, payloadToSend);
1055
- }
1056
- }
1057
-
1058
- return (payload: any) => {
1059
- this.triggerEventOnPort(eventPort, payload);
1060
- }
1061
- }
1062
-
1063
1026
  /**
1064
1027
  * Executes all registered event handlers for a particular event type
1065
1028
  * @param eventType The event type
@@ -1084,8 +1047,9 @@ export class TsEmbed {
1084
1047
  // payload
1085
1048
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)
1086
1049
  ) {
1087
- const responder = this.createEmbedEventResponder(eventPort, eventType);
1088
- callbackObj.callback(data, responder);
1050
+ callbackObj.callback(data, (payload) => {
1051
+ this.triggerEventOnPort(eventPort, payload);
1052
+ });
1089
1053
  }
1090
1054
  });
1091
1055
  }
@@ -1227,12 +1191,12 @@ export class TsEmbed {
1227
1191
  }
1228
1192
  }
1229
1193
 
1230
- /**
1231
- * @hidden
1232
- * Internal state to track if the embed container is loaded.
1233
- * This is used to trigger events after the embed container is loaded.
1234
- */
1235
- public isEmbedContainerLoaded = false;
1194
+ /**
1195
+ * @hidden
1196
+ * Internal state to track if the embed container is loaded.
1197
+ * This is used to trigger events after the embed container is loaded.
1198
+ */
1199
+ public isEmbedContainerLoaded = false;
1236
1200
 
1237
1201
  /**
1238
1202
  * @hidden
@@ -1384,7 +1348,7 @@ export class TsEmbed {
1384
1348
  }
1385
1349
  this.isPreRendered = true;
1386
1350
  this.showPreRenderByDefault = showPreRenderByDefault;
1387
-
1351
+
1388
1352
  const isAlreadyRendered = this.connectPreRendered();
1389
1353
  if (isAlreadyRendered && !replaceExistingPreRender) {
1390
1354
  return this;
package/src/errors.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export const ERROR_MESSAGE = {
2
2
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
3
- SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
3
+ SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a Model to get started',
4
4
  LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a Liveboard to embed.',
5
5
  TRIGGER_TIMED_OUT: 'Trigger timed-out in getting a response',
6
6
  SEARCHEMBED_BETA_WRANING_MESSAGE: 'SearchEmbed is in Beta in this release.',
package/src/index.ts CHANGED
@@ -64,7 +64,6 @@ import {
64
64
  ListPageColumns,
65
65
  CustomActionsPosition,
66
66
  CustomActionTarget,
67
- InterceptedApiType,
68
67
  } from './types';
69
68
  import { CustomCssVariables } from './css-variables';
70
69
  import { SageEmbed, SageViewConfig } from './embed/sage';
@@ -153,7 +152,6 @@ export {
153
152
  DataPanelCustomColumnGroupsAccordionState,
154
153
  CustomActionsPosition,
155
154
  CustomActionTarget,
156
- InterceptedApiType,
157
155
  };
158
156
 
159
157
  export { resetCachedAuthToken } from './authToken';
@@ -59,5 +59,6 @@ export {
59
59
  resetCachedAuthToken,
60
60
  UIPassthroughEvent,
61
61
  DataPanelCustomColumnGroupsAccordionState,
62
- InterceptedApiType,
62
+ CustomActionsPosition,
63
+ CustomActionTarget,
63
64
  } from '../index';