@thoughtspot/visual-embed-sdk 1.28.1 → 1.29.0-alpha.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 (141) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +1 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +2 -2
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/authToken.d.ts +10 -0
  7. package/cjs/src/authToken.d.ts.map +1 -1
  8. package/cjs/src/authToken.js +10 -0
  9. package/cjs/src/authToken.js.map +1 -1
  10. package/cjs/src/embed/app.d.ts +19 -6
  11. package/cjs/src/embed/app.d.ts.map +1 -1
  12. package/cjs/src/embed/app.js +4 -3
  13. package/cjs/src/embed/app.js.map +1 -1
  14. package/cjs/src/embed/base.d.ts +1 -1
  15. package/cjs/src/embed/base.d.ts.map +1 -1
  16. package/cjs/src/embed/base.js +7 -5
  17. package/cjs/src/embed/base.js.map +1 -1
  18. package/cjs/src/embed/base.spec.js +1 -1
  19. package/cjs/src/embed/base.spec.js.map +1 -1
  20. package/cjs/src/embed/liveboard.d.ts +8 -2
  21. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  22. package/cjs/src/embed/liveboard.js.map +1 -1
  23. package/cjs/src/embed/search.d.ts +18 -5
  24. package/cjs/src/embed/search.d.ts.map +1 -1
  25. package/cjs/src/embed/search.js +5 -4
  26. package/cjs/src/embed/search.js.map +1 -1
  27. package/cjs/src/embed/search.spec.js +2 -1
  28. package/cjs/src/embed/search.spec.js.map +1 -1
  29. package/cjs/src/embed/ts-embed.d.ts +1 -1
  30. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  31. package/cjs/src/embed/ts-embed.js +6 -6
  32. package/cjs/src/embed/ts-embed.js.map +1 -1
  33. package/cjs/src/embed/ts-embed.spec.js +9 -18
  34. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  35. package/cjs/src/index.d.ts +1 -0
  36. package/cjs/src/index.d.ts.map +1 -1
  37. package/cjs/src/index.js +3 -1
  38. package/cjs/src/index.js.map +1 -1
  39. package/cjs/src/react/all-types-export.d.ts +1 -1
  40. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  41. package/cjs/src/react/all-types-export.js +2 -1
  42. package/cjs/src/react/all-types-export.js.map +1 -1
  43. package/cjs/src/react/index.spec.js +1 -13
  44. package/cjs/src/react/index.spec.js.map +1 -1
  45. package/cjs/src/types.d.ts +99 -15
  46. package/cjs/src/types.d.ts.map +1 -1
  47. package/cjs/src/types.js +88 -3
  48. package/cjs/src/types.js.map +1 -1
  49. package/dist/src/auth.d.ts.map +1 -1
  50. package/dist/src/authToken.d.ts +10 -0
  51. package/dist/src/authToken.d.ts.map +1 -1
  52. package/dist/src/embed/app.d.ts +19 -6
  53. package/dist/src/embed/app.d.ts.map +1 -1
  54. package/dist/src/embed/base.d.ts +1 -1
  55. package/dist/src/embed/base.d.ts.map +1 -1
  56. package/dist/src/embed/liveboard.d.ts +8 -2
  57. package/dist/src/embed/liveboard.d.ts.map +1 -1
  58. package/dist/src/embed/search.d.ts +18 -5
  59. package/dist/src/embed/search.d.ts.map +1 -1
  60. package/dist/src/embed/ts-embed.d.ts +1 -1
  61. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  62. package/dist/src/index.d.ts +1 -0
  63. package/dist/src/index.d.ts.map +1 -1
  64. package/dist/src/react/all-types-export.d.ts +1 -1
  65. package/dist/src/react/all-types-export.d.ts.map +1 -1
  66. package/dist/src/types.d.ts +99 -15
  67. package/dist/src/types.d.ts.map +1 -1
  68. package/dist/tsembed-react.es.js +7004 -6907
  69. package/dist/tsembed-react.js +1735 -1638
  70. package/dist/tsembed.es.js +7352 -7254
  71. package/dist/tsembed.js +15445 -15346
  72. package/dist/visual-embed-sdk-react-full.d.ts +155 -26
  73. package/dist/visual-embed-sdk-react.d.ts +155 -26
  74. package/dist/visual-embed-sdk.d.ts +155 -26
  75. package/lib/package.json +1 -1
  76. package/lib/src/auth.d.ts.map +1 -1
  77. package/lib/src/auth.js +3 -3
  78. package/lib/src/auth.js.map +1 -1
  79. package/lib/src/authToken.d.ts +10 -0
  80. package/lib/src/authToken.d.ts.map +1 -1
  81. package/lib/src/authToken.js +10 -0
  82. package/lib/src/authToken.js.map +1 -1
  83. package/lib/src/embed/app.d.ts +19 -6
  84. package/lib/src/embed/app.d.ts.map +1 -1
  85. package/lib/src/embed/app.js +4 -3
  86. package/lib/src/embed/app.js.map +1 -1
  87. package/lib/src/embed/base.d.ts +1 -1
  88. package/lib/src/embed/base.d.ts.map +1 -1
  89. package/lib/src/embed/base.js +7 -5
  90. package/lib/src/embed/base.js.map +1 -1
  91. package/lib/src/embed/base.spec.js +2 -2
  92. package/lib/src/embed/base.spec.js.map +1 -1
  93. package/lib/src/embed/liveboard.d.ts +8 -2
  94. package/lib/src/embed/liveboard.d.ts.map +1 -1
  95. package/lib/src/embed/liveboard.js +1 -1
  96. package/lib/src/embed/liveboard.js.map +1 -1
  97. package/lib/src/embed/search.d.ts +18 -5
  98. package/lib/src/embed/search.d.ts.map +1 -1
  99. package/lib/src/embed/search.js +6 -5
  100. package/lib/src/embed/search.js.map +1 -1
  101. package/lib/src/embed/search.spec.js +2 -1
  102. package/lib/src/embed/search.spec.js.map +1 -1
  103. package/lib/src/embed/ts-embed.d.ts +1 -1
  104. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  105. package/lib/src/embed/ts-embed.js +9 -9
  106. package/lib/src/embed/ts-embed.js.map +1 -1
  107. package/lib/src/embed/ts-embed.spec.js +9 -18
  108. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  109. package/lib/src/index.d.ts +1 -0
  110. package/lib/src/index.d.ts.map +1 -1
  111. package/lib/src/index.js +1 -0
  112. package/lib/src/index.js.map +1 -1
  113. package/lib/src/react/all-types-export.d.ts +1 -1
  114. package/lib/src/react/all-types-export.d.ts.map +1 -1
  115. package/lib/src/react/all-types-export.js +1 -1
  116. package/lib/src/react/all-types-export.js.map +1 -1
  117. package/lib/src/react/index.spec.js +1 -13
  118. package/lib/src/react/index.spec.js.map +1 -1
  119. package/lib/src/types.d.ts +99 -15
  120. package/lib/src/types.d.ts.map +1 -1
  121. package/lib/src/types.js +88 -3
  122. package/lib/src/types.js.map +1 -1
  123. package/lib/src/utils/authService/authService.spec.js +1 -1
  124. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  125. package/lib/src/visual-embed-sdk.d.ts +163 -30
  126. package/package.json +1 -1
  127. package/src/auth.ts +6 -6
  128. package/src/authToken.ts +10 -0
  129. package/src/embed/app.ts +28 -8
  130. package/src/embed/base.spec.ts +3 -3
  131. package/src/embed/base.ts +14 -12
  132. package/src/embed/liveboard.ts +16 -3
  133. package/src/embed/search.spec.ts +2 -1
  134. package/src/embed/search.ts +28 -10
  135. package/src/embed/ts-embed.spec.ts +26 -34
  136. package/src/embed/ts-embed.ts +43 -39
  137. package/src/index.ts +2 -0
  138. package/src/react/all-types-export.ts +1 -0
  139. package/src/react/index.spec.tsx +1 -30
  140. package/src/types.ts +100 -15
  141. package/src/utils/authService/authService.spec.ts +4 -4
package/src/embed/app.ts CHANGED
@@ -9,11 +9,16 @@
9
9
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
10
10
  */
11
11
 
12
+ import { logger } from '../utils/logger';
13
+ import { getQueryParamString } from '../utils';
12
14
  import {
13
- DOMSelector, EmbedEvent, HostEvent, MessagePayload, Param, ViewConfig,
15
+ Param,
16
+ DOMSelector,
17
+ HostEvent,
18
+ ViewConfig,
19
+ EmbedEvent,
20
+ MessagePayload,
14
21
  } from '../types';
15
- import { getQueryParamString } from '../utils';
16
- import { logger } from '../utils/logger';
17
22
  import { V1Embed } from './ts-embed';
18
23
 
19
24
  /**
@@ -64,6 +69,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
64
69
  *
65
70
  * @default true
66
71
  * @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
72
+ *
67
73
  * @example
68
74
  * ```js
69
75
  * const embed = new AppEmbed('#tsEmbed', {
@@ -79,7 +85,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
79
85
  * nav-bars are visible, this flag will only hide the homepage left nav-bar.
80
86
  * The showPrimaryNavbar flag takes precedence over the hideHomepageLeftNav.
81
87
  *
82
- *
83
88
  * **Note**: This option does not apply to the classic homepage.
84
89
  * To access the updated modular homepage, set
85
90
  * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
@@ -99,9 +104,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
99
104
  /**
100
105
  * Control the visibility of the help (?) and profile buttons on the
101
106
  * Global nav-bar. By default, these buttons are visible on the nav-bar.
102
- *
103
107
  * @default false
104
108
  * @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
109
+ *
105
110
  * @example
106
111
  * ```js
107
112
  * const embed = new AppEmbed('#tsEmbed', {
@@ -115,7 +120,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
115
120
  * Control the visibility of the application switcher button on the nav-bar.
116
121
  * By default, the application switcher is shown.
117
122
  *
118
- *
119
123
  * **Note**: This option does not apply to the classic homepage.
120
124
  * To access the updated modular homepage, set
121
125
  * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
@@ -136,7 +140,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
136
140
  * Control the visibility of the Org switcher button on the nav-bar.
137
141
  * By default, the Org switcher button is shown.
138
142
  *
139
- *
140
143
  * **Note**: This option does not apply to the classic homepage.
141
144
  * To access the updated modular homepage, set
142
145
  * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
@@ -163,6 +166,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
163
166
  * you could set the path to `pinboard/<liveboardId>/tab/<tabId>`.
164
167
  *
165
168
  * @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
169
+ *
166
170
  * @example
167
171
  * ```js
168
172
  * const embed = new AppEmbed('#tsEmbed', {
@@ -180,6 +184,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
180
184
  * path within the app, use the `path` attribute which is more flexible.
181
185
  *
182
186
  * @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
187
+ *
183
188
  * @example
184
189
  * ```js
185
190
  * const embed = new AppEmbed('#tsEmbed', {
@@ -208,6 +213,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
208
213
  * The array of GUIDs to be hidden
209
214
  *
210
215
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
216
+ *
211
217
  * @example
212
218
  * ```js
213
219
  * const embed = new AppEmbed('#tsEmbed', {
@@ -230,9 +236,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
230
236
  liveboardV2?: boolean;
231
237
  /**
232
238
  * If set to true, the Search Assist feature is enabled.
233
- *
234
239
  * @default true
240
+ *
235
241
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
242
+ *
236
243
  * @example
237
244
  * ```js
238
245
  * const embed = new AppEmbed('#tsEmbed', {
@@ -247,6 +254,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
247
254
  * according to the height of the pages which support fullHeight mode.
248
255
  *
249
256
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
257
+ *
250
258
  * @example
251
259
  * ```js
252
260
  * const embed = new AppEmbed('#tsEmbed', {
@@ -269,6 +277,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
269
277
  *
270
278
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
271
279
  * @default false
280
+ *
272
281
  * @example
273
282
  * ```js
274
283
  * const embed = new AppEmbed('#tsEmbed', {
@@ -283,6 +292,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
283
292
  *
284
293
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
285
294
  * @default false
295
+ *
286
296
  * @example
287
297
  * ```js
288
298
  * const embed = new AppEmbed('#tsEmbed', {
@@ -297,6 +307,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
297
307
  *
298
308
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
299
309
  * @default false
310
+ *
300
311
  * @example
301
312
  * ```js
302
313
  * const embed = new AppEmbed('#tsEmbed', {
@@ -341,6 +352,13 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
341
352
  * @default false
342
353
  */
343
354
  enableAskSage?: boolean;
355
+ /**
356
+ * To set the initial state of the search bar in case of saved-answers.
357
+ *
358
+ * @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
359
+ * @default false
360
+ */
361
+ collapseSearchBarInitially?: boolean;
344
362
  }
345
363
 
346
364
  /**
@@ -387,6 +405,7 @@ export class AppEmbed extends V1Embed {
387
405
  modularHomeExperience = false,
388
406
  isLiveboardHeaderSticky = true,
389
407
  enableAskSage,
408
+ collapseSearchBarInitially = false,
390
409
  } = this.viewConfig;
391
410
 
392
411
  let params = {};
@@ -427,6 +446,7 @@ export class AppEmbed extends V1Embed {
427
446
  params[Param.DataPanelV2Enabled] = dataPanelV2;
428
447
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
429
448
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
449
+ params[Param.CollapseSearchBarInitially] = collapseSearchBarInitially;
430
450
  const queryParams = getQueryParamString(params, true);
431
451
 
432
452
  return queryParams;
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable no-console */
2
2
  /* eslint-disable @typescript-eslint/no-shadow */
3
3
  import EventEmitter from 'eventemitter3';
4
+ import { EmbedConfig } from '../index';
4
5
  import * as auth from '../auth';
6
+ import * as authService from '../utils/authService/authService';
5
7
  import * as authTokenService from '../authToken';
6
8
  import * as index from '../index';
7
- import { EmbedConfig } from '../index';
8
- import * as authService from '../utils/authService/authService';
9
9
  import * as base from './base';
10
10
  import * as embedConfigInstance from './embedConfig';
11
11
 
@@ -13,8 +13,8 @@ import {
13
13
  executeAfterWait,
14
14
  getAllIframeEl,
15
15
  getDocumentBody,
16
- getIFrameSrc,
17
16
  getRootEl,
17
+ getIFrameSrc,
18
18
  } from '../test/test-utils';
19
19
  import * as tokenizedFetchInstance from '../tokenizedFetch';
20
20
  import { logger } from '../utils/logger';
package/src/embed/base.ts CHANGED
@@ -10,27 +10,28 @@
10
10
  */
11
11
  import EventEmitter from 'eventemitter3';
12
12
  import uniq from 'lodash/uniq';
13
+ import { resetCachedAuthToken } from '../authToken';
14
+ import { logger, setGlobalLogLevelOverride } from '../utils/logger';
15
+ import { tokenizedFetch } from '../tokenizedFetch';
16
+ import { EndPoints } from '../utils/authService/authService';
17
+ import { getThoughtSpotHost } from '../config';
13
18
  import {
14
- AuthEvent,
15
- AuthEventEmitter,
19
+ AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
20
+ } from '../types';
21
+ import {
22
+ authenticate,
23
+ logout as _logout,
16
24
  AuthFailureType,
17
25
  AuthStatus,
18
- logout as _logout,
19
- authenticate,
26
+ AuthEvent,
20
27
  notifyAuthFailure,
21
28
  notifyAuthSDKSuccess,
22
29
  notifyAuthSuccess,
23
30
  notifyLogout,
24
31
  setAuthEE,
32
+ AuthEventEmitter,
25
33
  } from '../auth';
26
- import { getThoughtSpotHost } from '../config';
27
- import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
28
- import { tokenizedFetch } from '../tokenizedFetch';
29
- import {
30
- AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
31
- } from '../types';
32
- import { EndPoints } from '../utils/authService/authService';
33
- import { logger, setGlobalLogLevelOverride } from '../utils/logger';
34
+ import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
34
35
  import { getEmbedConfig, setEmbedConfig } from './embedConfig';
35
36
 
36
37
  const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
@@ -174,6 +175,7 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
174
175
  */
175
176
  export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
176
177
  sanity(embedConfig);
178
+ resetCachedAuthToken();
177
179
  embedConfig = setEmbedConfig(
178
180
  backwardCompat({
179
181
  ...CONFIG_DEFAULTS,
@@ -11,9 +11,16 @@
11
11
 
12
12
  import { ERROR_MESSAGE } from '../errors';
13
13
  import {
14
- DOMSelector, EmbedEvent, HostEvent, MessagePayload, Param, ViewConfig,
14
+ EmbedEvent,
15
+ MessagePayload,
16
+ Param,
17
+ RuntimeFilter,
18
+ DOMSelector,
19
+ HostEvent,
20
+ ViewConfig,
15
21
  } from '../types';
16
22
  import { getQueryParamString, isUndefined } from '../utils';
23
+ import { getAuthPromise } from './base';
17
24
  import { V1Embed } from './ts-embed';
18
25
 
19
26
  /**
@@ -37,6 +44,7 @@ export interface LiveboardViewConfig
37
44
  * incrementally as users scroll the page to view the charts and tables.
38
45
  *
39
46
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
47
+ *
40
48
  * @example
41
49
  * ```js
42
50
  * const embed = new LiveboardEmbed('#embed', {
@@ -65,6 +73,7 @@ export interface LiveboardViewConfig
65
73
  defaultHeight?: number;
66
74
  /**
67
75
  * @Deprecated If set to true, the context menu in visualizations will be enabled.
76
+ *
68
77
  * @example
69
78
  * ```js
70
79
  * const embed = new LiveboardEmbed('#tsEmbed', {
@@ -72,6 +81,7 @@ export interface LiveboardViewConfig
72
81
  * enableVizTransformations:true,
73
82
  * })
74
83
  * ```
84
+ *
75
85
  * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
76
86
  */
77
87
  enableVizTransformations?: boolean;
@@ -98,6 +108,7 @@ export interface LiveboardViewConfig
98
108
  * The visualization within the Liveboard to display.
99
109
  *
100
110
  * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
111
+ *
101
112
  * @example
102
113
  * ```js
103
114
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -127,6 +138,7 @@ export interface LiveboardViewConfig
127
138
  * event.
128
139
  *
129
140
  * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
141
+ *
130
142
  * @example
131
143
  * ```js
132
144
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -176,6 +188,7 @@ export interface LiveboardViewConfig
176
188
  * Show or hide the tab panel of the embedded Liveboard.
177
189
  *
178
190
  * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl, 9.8.0.sw
191
+ *
179
192
  * @example
180
193
  * ```js
181
194
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -201,9 +214,9 @@ export interface LiveboardViewConfig
201
214
  hideLiveboardHeader?: boolean;
202
215
  /**
203
216
  * Show or hide the Liveboard title.
204
- *
205
217
  * @default false
206
218
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
219
+ *
207
220
  * @example
208
221
  * ```js
209
222
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -215,9 +228,9 @@ export interface LiveboardViewConfig
215
228
  showLiveboardTitle?: boolean;
216
229
  /**
217
230
  * Show or hide the Liveboard description.
218
- *
219
231
  * @default false
220
232
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
233
+ *
221
234
  * @example
222
235
  * ```js
223
236
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -356,12 +356,13 @@ describe('Search embed tests', () => {
356
356
  const searchEmbed = new SearchEmbed(getRootEl(), {
357
357
  ...defaultViewConfig,
358
358
  answerId,
359
+ collapseSearchBarInitially: true,
359
360
  });
360
361
  searchEmbed.render();
361
362
  await executeAfterWait(() => {
362
363
  expectUrlMatchesWithParams(
363
364
  getIFrameSrc(),
364
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
365
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false&collapseSearchBarInitially=true${prefixParams}#/embed/saved-answer/${answerId}`,
365
366
  );
366
367
  });
367
368
  });
@@ -7,20 +7,24 @@
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
9
 
10
- import { getReleaseVersion } from '../auth';
11
- import { ERROR_MESSAGE } from '../errors';
12
10
  import {
13
- Action, DOMSelector, DataSourceVisualMode, Param, ViewConfig,
11
+ DataSourceVisualMode,
12
+ DOMSelector,
13
+ Param,
14
+ Action,
15
+ ViewConfig,
14
16
  } from '../types';
15
17
  import {
18
+ getQueryParamString,
16
19
  checkReleaseVersionInBeta,
17
20
  getFilterQuery,
18
- getQueryParamString,
19
21
  getRuntimeParameters,
20
22
  } from '../utils';
23
+ import { TsEmbed } from './ts-embed';
24
+ import { ERROR_MESSAGE } from '../errors';
21
25
  import { getAuthPromise } from './base';
26
+ import { getReleaseVersion } from '../auth';
22
27
  import { getEmbedConfig } from './embedConfig';
23
- import { TsEmbed } from './ts-embed';
24
28
 
25
29
  /**
26
30
  * Configuration for search options.
@@ -59,6 +63,7 @@ export interface SearchViewConfig
59
63
  * but can be expanded manually.
60
64
  *
61
65
  * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
66
+ *
62
67
  * @example
63
68
  * ```js
64
69
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -72,6 +77,7 @@ export interface SearchViewConfig
72
77
  * Show or hide the data sources panel.
73
78
  *
74
79
  * @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
80
+ *
75
81
  * @example
76
82
  * ```js
77
83
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -87,6 +93,7 @@ export interface SearchViewConfig
87
93
  * using raw answer data.
88
94
  *
89
95
  * @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
96
+ *
90
97
  * @example
91
98
  * ```js
92
99
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -96,14 +103,11 @@ export interface SearchViewConfig
96
103
  * ```
97
104
  */
98
105
  hideResults?: boolean;
99
- /**
100
- * If set to true, expands all the data sources panel.
101
- */
102
- expandAllDataSource?: boolean;
103
106
  /**
104
107
  * If set to true, the Search Assist feature is enabled.
105
108
  *
106
109
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
110
+ *
107
111
  * @example
108
112
  * ```js
109
113
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -118,6 +122,7 @@ export interface SearchViewConfig
118
122
  * format for presenting search data.
119
123
  *
120
124
  * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
125
+ *
121
126
  * @example
122
127
  * ```js
123
128
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -131,6 +136,7 @@ export interface SearchViewConfig
131
136
  * Only a single data source is supported currently.
132
137
  *
133
138
  * @deprecated Use `dataSource` instead.
139
+ *
134
140
  * @example
135
141
  * ```js
136
142
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -144,6 +150,7 @@ export interface SearchViewConfig
144
150
  * The array of data source GUIDs to set on load.
145
151
  *
146
152
  * @version: SDK: 1.19.0
153
+ *
147
154
  * @example
148
155
  * ```js
149
156
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -185,6 +192,7 @@ export interface SearchViewConfig
185
192
  * The GUID of a saved answer to load initially.
186
193
  *
187
194
  * @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
195
+ *
188
196
  * @example
189
197
  * ```js
190
198
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -199,6 +207,7 @@ export interface SearchViewConfig
199
207
  * The chart/table should still be visible.
200
208
  *
201
209
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
210
+ *
202
211
  * @example
203
212
  * ```js
204
213
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -213,6 +222,7 @@ export interface SearchViewConfig
213
222
  *
214
223
  * @default false
215
224
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
225
+ *
216
226
  * @example
217
227
  * ```js
218
228
  * const embed = new SearchEmbed('#tsEmbed', {
@@ -228,6 +238,13 @@ export interface SearchViewConfig
228
238
  * @version: SDK: 1.24.0
229
239
  */
230
240
  useLastSelectedSources?: boolean;
241
+ /**
242
+ * To set the initial state of the search bar in case of saved-answers.
243
+ *
244
+ * @default false
245
+ * @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
246
+ */
247
+ collapseSearchBarInitially?: boolean;
231
248
  }
232
249
 
233
250
  export const HiddenActionItemByDefaultForSearchEmbed = [
@@ -273,7 +290,6 @@ export class SearchEmbed extends TsEmbed {
273
290
  protected getEmbedParams(): string {
274
291
  const {
275
292
  hideResults,
276
- expandAllDataSource,
277
293
  enableSearchAssist,
278
294
  forceTable,
279
295
  searchOptions,
@@ -285,6 +301,7 @@ export class SearchEmbed extends TsEmbed {
285
301
  dataPanelV2 = false,
286
302
  useLastSelectedSources = false,
287
303
  runtimeParameters,
304
+ collapseSearchBarInitially = false,
288
305
  } = this.viewConfig;
289
306
  const queryParams = this.getBaseQueryParams();
290
307
 
@@ -331,6 +348,7 @@ export class SearchEmbed extends TsEmbed {
331
348
  }
332
349
 
333
350
  queryParams[Param.searchEmbed] = true;
351
+ queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially;
334
352
  let query = '';
335
353
  const queryParamsString = getQueryParamString(queryParams, true);
336
354
  if (queryParamsString) {
@@ -1,39 +1,39 @@
1
1
  /* eslint-disable dot-notation */
2
- import * as authInstance from '../auth';
3
2
  import { resetCachedAuthToken } from '../authToken';
4
- import * as config from '../config';
5
3
  import {
6
- AppEmbed,
7
4
  AuthType,
5
+ init,
8
6
  EmbedEvent,
9
- LiveboardEmbed,
10
- LiveboardViewConfig,
11
- PinboardEmbed,
12
7
  SearchEmbed,
13
- init,
8
+ PinboardEmbed,
9
+ LiveboardViewConfig,
10
+ AppEmbed,
11
+ LiveboardEmbed,
14
12
  } from '../index';
15
- import * as mixpanelInstance from '../mixpanel-service';
16
- import { MIXPANEL_EVENT } from '../mixpanel-service';
17
13
  import {
18
- createRootEleForEmbed,
19
- defaultParamsForPinboardEmbed,
14
+ Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
15
+ } from '../types';
16
+ import {
20
17
  executeAfterWait,
21
- expectUrlMatchesWithParams,
22
18
  getDocumentBody,
23
19
  getIFrameEl,
24
20
  getIFrameSrc,
25
21
  getRootEl,
26
- mockMessageChannel,
27
22
  postMessageToParent,
23
+ defaultParamsForPinboardEmbed,
28
24
  waitFor,
25
+ expectUrlMatchesWithParams,
26
+ mockMessageChannel,
27
+ createRootEleForEmbed,
29
28
  } from '../test/test-utils';
30
- import {
31
- Action, HomeLeftNavItem, HomepageModule, RuntimeFilter, RuntimeFilterOp,
32
- } from '../types';
29
+ import * as config from '../config';
30
+ import * as tsEmbedInstance from './ts-embed';
31
+ import * as mixpanelInstance from '../mixpanel-service';
32
+ import * as authInstance from '../auth';
33
+ import * as baseInstance from './base';
34
+ import { MIXPANEL_EVENT } from '../mixpanel-service';
33
35
  import * as authService from '../utils/authService/authService';
34
36
  import { logger } from '../utils/logger';
35
- import * as baseInstance from './base';
36
- import * as tsEmbedInstance from './ts-embed';
37
37
 
38
38
  const defaultViewConfig = {
39
39
  frameParams: {
@@ -417,10 +417,8 @@ describe('Unit test case for ts embed', () => {
417
417
  authToken: '',
418
418
  hostConfig: undefined,
419
419
  runtimeFilterParams: null,
420
- hiddenHomeLeftNavItems: [
421
- HomeLeftNavItem.Home,
422
- HomeLeftNavItem.MonitorSubscription,
423
- ],
420
+ hiddenHomeLeftNavItems:
421
+ [HomeLeftNavItem.Home, HomeLeftNavItem.MonitorSubscription],
424
422
  hiddenHomepageModules: [],
425
423
  reorderedHomepageModules: [],
426
424
  },
@@ -649,10 +647,7 @@ describe('Unit test case for ts embed', () => {
649
647
  type: EmbedEvent.APP_INIT,
650
648
  data: {},
651
649
  };
652
- const searchEmbed = new SearchEmbed(getRootEl(), {
653
- ...defaultViewConfig,
654
- preRenderId: 'test',
655
- });
650
+ const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
656
651
  searchEmbed.preRender();
657
652
  const mockPort: any = {
658
653
  postMessage: jest.fn(),
@@ -709,10 +704,7 @@ describe('Unit test case for ts embed', () => {
709
704
  type: EmbedEvent.AuthExpire,
710
705
  data: {},
711
706
  };
712
- const searchEmbed = new SearchEmbed(getRootEl(), {
713
- ...defaultViewConfig,
714
- preRenderId: 'test',
715
- });
707
+ const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
716
708
  jest.spyOn(baseInstance, 'notifyAuthFailure');
717
709
  searchEmbed.preRender();
718
710
  const mockPort: any = {
@@ -1216,7 +1208,7 @@ describe('Unit test case for ts embed', () => {
1216
1208
  expectUrlMatchesWithParams(
1217
1209
  getIFrameSrc(),
1218
1210
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
1219
- + `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
1211
+ + `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
1220
1212
  );
1221
1213
  });
1222
1214
 
@@ -1232,7 +1224,7 @@ describe('Unit test case for ts embed', () => {
1232
1224
  expectUrlMatchesWithParams(
1233
1225
  getIFrameSrc(),
1234
1226
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
1235
- + `&showAlerts=true${defaultParamsPost}#/home`,
1227
+ + `&showAlerts=true${defaultParamsPost}#/home`,
1236
1228
  );
1237
1229
  });
1238
1230
  it('Sets the locale param', async () => {
@@ -1247,7 +1239,7 @@ describe('Unit test case for ts embed', () => {
1247
1239
  expectUrlMatchesWithParams(
1248
1240
  getIFrameSrc(),
1249
1241
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
1250
- + `&locale=ja-JP${defaultParamsPost}#/home`,
1242
+ + `&locale=ja-JP${defaultParamsPost}#/home`,
1251
1243
  );
1252
1244
  });
1253
1245
  it('Sets the iconSprite url', async () => {
@@ -1264,7 +1256,7 @@ describe('Unit test case for ts embed', () => {
1264
1256
  expectUrlMatchesWithParams(
1265
1257
  getIFrameSrc(),
1266
1258
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
1267
- + `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
1259
+ + `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
1268
1260
  );
1269
1261
  });
1270
1262