@thoughtspot/visual-embed-sdk 1.44.3 → 1.44.4

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 (82) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +1 -1
  3. package/cjs/src/embed/app.d.ts +44 -32
  4. package/cjs/src/embed/app.d.ts.map +1 -1
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/liveboard.d.ts +1 -1
  7. package/cjs/src/embed/ts-embed.d.ts +1 -1
  8. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  9. package/cjs/src/embed/ts-embed.js +24 -6
  10. package/cjs/src/embed/ts-embed.js.map +1 -1
  11. package/cjs/src/embed/ts-embed.spec.js +145 -13
  12. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  13. package/cjs/src/errors.d.ts +1 -0
  14. package/cjs/src/errors.d.ts.map +1 -1
  15. package/cjs/src/errors.js +1 -0
  16. package/cjs/src/errors.js.map +1 -1
  17. package/cjs/src/index.d.ts +2 -2
  18. package/cjs/src/index.d.ts.map +1 -1
  19. package/cjs/src/index.js +4 -1
  20. package/cjs/src/index.js.map +1 -1
  21. package/cjs/src/types.d.ts +100 -44
  22. package/cjs/src/types.d.ts.map +1 -1
  23. package/cjs/src/types.js +74 -15
  24. package/cjs/src/types.js.map +1 -1
  25. package/cjs/src/utils.d.ts.map +1 -1
  26. package/cjs/src/utils.js +2 -1
  27. package/cjs/src/utils.js.map +1 -1
  28. package/dist/{index-D0n5LIka.js → index-C5FAW929.js} +1 -1
  29. package/dist/src/embed/app.d.ts +44 -32
  30. package/dist/src/embed/app.d.ts.map +1 -1
  31. package/dist/src/embed/liveboard.d.ts +1 -1
  32. package/dist/src/embed/ts-embed.d.ts +1 -1
  33. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  34. package/dist/src/errors.d.ts +1 -0
  35. package/dist/src/errors.d.ts.map +1 -1
  36. package/dist/src/index.d.ts +2 -2
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/types.d.ts +100 -44
  39. package/dist/src/types.d.ts.map +1 -1
  40. package/dist/src/utils.d.ts.map +1 -1
  41. package/dist/tsembed-react.es.js +104 -25
  42. package/dist/tsembed-react.js +103 -24
  43. package/dist/tsembed.es.js +105 -26
  44. package/dist/tsembed.js +130 -51
  45. package/dist/visual-embed-sdk-react-full.d.ts +140 -70
  46. package/dist/visual-embed-sdk-react.d.ts +146 -78
  47. package/dist/visual-embed-sdk.d.ts +193 -80
  48. package/lib/package.json +1 -1
  49. package/lib/src/embed/app.d.ts +44 -32
  50. package/lib/src/embed/app.d.ts.map +1 -1
  51. package/lib/src/embed/app.js.map +1 -1
  52. package/lib/src/embed/liveboard.d.ts +1 -1
  53. package/lib/src/embed/ts-embed.d.ts +1 -1
  54. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  55. package/lib/src/embed/ts-embed.js +24 -6
  56. package/lib/src/embed/ts-embed.js.map +1 -1
  57. package/lib/src/embed/ts-embed.spec.js +145 -13
  58. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  59. package/lib/src/errors.d.ts +1 -0
  60. package/lib/src/errors.d.ts.map +1 -1
  61. package/lib/src/errors.js +1 -0
  62. package/lib/src/errors.js.map +1 -1
  63. package/lib/src/index.d.ts +2 -2
  64. package/lib/src/index.d.ts.map +1 -1
  65. package/lib/src/index.js +2 -2
  66. package/lib/src/index.js.map +1 -1
  67. package/lib/src/types.d.ts +100 -44
  68. package/lib/src/types.d.ts.map +1 -1
  69. package/lib/src/types.js +74 -15
  70. package/lib/src/types.js.map +1 -1
  71. package/lib/src/utils.d.ts.map +1 -1
  72. package/lib/src/utils.js +2 -1
  73. package/lib/src/utils.js.map +1 -1
  74. package/package.json +1 -1
  75. package/src/embed/app.ts +44 -32
  76. package/src/embed/liveboard.ts +1 -1
  77. package/src/embed/ts-embed.spec.ts +190 -15
  78. package/src/embed/ts-embed.ts +24 -6
  79. package/src/errors.ts +1 -0
  80. package/src/index.ts +4 -0
  81. package/src/types.ts +100 -43
  82. package/src/utils.ts +2 -1
@@ -2483,6 +2483,44 @@ describe('Unit test case for ts embed', () => {
2483
2483
  expect(libEmbed.preRender).toHaveBeenCalledTimes(0);
2484
2484
  });
2485
2485
 
2486
+ it('should set overflow:hidden when hidePreRender and remove when showPreRender', async () => {
2487
+ createRootEleForEmbed();
2488
+
2489
+ (window as any).ResizeObserver = window.ResizeObserver
2490
+ || jest.fn().mockImplementation(() => ({
2491
+ disconnect: jest.fn(),
2492
+ observe: jest.fn(),
2493
+ unobserve: jest.fn(),
2494
+ }));
2495
+
2496
+ const libEmbed = new LiveboardEmbed('#tsEmbedDiv', {
2497
+ preRenderId: 'overflow-test',
2498
+ liveboardId: 'myLiveboardId',
2499
+ });
2500
+
2501
+ await libEmbed.preRender();
2502
+ await waitFor(() => !!getIFrameEl());
2503
+
2504
+ const preRenderIds = libEmbed.getPreRenderIds();
2505
+ const preRenderWrapper = document.getElementById(preRenderIds.wrapper);
2506
+
2507
+ // After preRender (calls hidePreRender by default)
2508
+ // should have overflow:hidden
2509
+ expect(preRenderWrapper.style.overflow).toBe('hidden');
2510
+ expect(preRenderWrapper.style.opacity).toBe('0');
2511
+
2512
+ // After showPreRender, overflow should be removed
2513
+ // to inherit from CSS
2514
+ libEmbed.showPreRender();
2515
+ expect(preRenderWrapper.style.overflow).toBe('');
2516
+ expect(preRenderWrapper.style.opacity).toBe('');
2517
+
2518
+ // After hidePreRender again, overflow should be hidden
2519
+ libEmbed.hidePreRender();
2520
+ expect(preRenderWrapper.style.overflow).toBe('hidden');
2521
+ expect(preRenderWrapper.style.opacity).toBe('0');
2522
+ });
2523
+
2486
2524
  it('it should connect with another object', async () => {
2487
2525
  createRootEleForEmbed();
2488
2526
  mockMessageChannel();
@@ -4107,19 +4145,7 @@ describe('Fullscreen change handler behavior', () => {
4107
4145
  });
4108
4146
 
4109
4147
  describe('ShowPreRender with UpdateEmbedParams', () => {
4110
- beforeAll(() => {
4111
- init({
4112
- thoughtSpotHost: 'tshost',
4113
- authType: AuthType.None,
4114
- });
4115
- });
4116
-
4117
- afterEach(() => {
4118
- const rootEle = document.getElementById('myRoot');
4119
- rootEle?.remove();
4120
- });
4121
-
4122
- test('should trigger UpdateEmbedParams when showPreRender connects to existing prerendered component', async () => {
4148
+ const setupPreRenderTest = async (preRenderId: string, initialConfig: Partial<LiveboardViewConfig>) => {
4123
4149
  createRootEleForEmbed();
4124
4150
  mockMessageChannel();
4125
4151
 
@@ -4131,8 +4157,8 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
4131
4157
  }));
4132
4158
 
4133
4159
  const embed1 = new LiveboardEmbed('#tsEmbedDiv', {
4134
- preRenderId: 'update-params-test',
4135
- liveboardId: 'original-lb',
4160
+ preRenderId,
4161
+ ...initialConfig,
4136
4162
  });
4137
4163
 
4138
4164
  await embed1.preRender();
@@ -4143,6 +4169,24 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
4143
4169
  mockProcessTrigger.mockClear();
4144
4170
  mockProcessTrigger.mockResolvedValue({});
4145
4171
 
4172
+ return embed1;
4173
+ };
4174
+
4175
+ beforeAll(() => {
4176
+ init({
4177
+ thoughtSpotHost: 'tshost',
4178
+ authType: AuthType.None,
4179
+ });
4180
+ });
4181
+
4182
+ afterEach(() => {
4183
+ const rootEle = document.getElementById('myRoot');
4184
+ rootEle?.remove();
4185
+ });
4186
+
4187
+ test('should trigger UpdateEmbedParams when showPreRender connects to existing prerendered component', async () => {
4188
+ await setupPreRenderTest('update-params-test', { liveboardId: 'original-lb' });
4189
+
4146
4190
  const embed2 = new LiveboardEmbed('#tsEmbedDiv', {
4147
4191
  preRenderId: 'update-params-test',
4148
4192
  liveboardId: 'updated-lb',
@@ -4161,4 +4205,135 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
4161
4205
  );
4162
4206
  });
4163
4207
  });
4208
+
4209
+ test('should trigger UpdateEmbedParams with runtime filters and visible vizs', async () => {
4210
+ await setupPreRenderTest('url-param-test', { liveboardId: 'original-lb' });
4211
+
4212
+ const embed2 = new LiveboardEmbed('#tsEmbedDiv', {
4213
+ preRenderId: 'url-param-test',
4214
+ liveboardId: 'original-lb',
4215
+ visibleVizs: ['viz-1'],
4216
+ runtimeFilters: [
4217
+ {
4218
+ columnName: 'Color',
4219
+ operator: RuntimeFilterOp.IN,
4220
+ values: ['red', 'blue'],
4221
+ },
4222
+ {
4223
+ columnName: 'Region',
4224
+ operator: RuntimeFilterOp.EQ,
4225
+ values: ['North'],
4226
+ },
4227
+ ],
4228
+ });
4229
+
4230
+ embed2.showPreRender();
4231
+
4232
+ await executeAfterWait(() => {
4233
+ expect(mockProcessTrigger).toHaveBeenCalledWith(
4234
+ expect.any(Object),
4235
+ HostEvent.UpdateEmbedParams,
4236
+ expect.any(String),
4237
+ expect.objectContaining({
4238
+ liveboardId: 'original-lb',
4239
+ visibleVizs: ['viz-1'],
4240
+ runtimeFilters: [
4241
+ {
4242
+ columnName: 'Color',
4243
+ operator: RuntimeFilterOp.IN,
4244
+ values: ['red', 'blue'],
4245
+ },
4246
+ {
4247
+ columnName: 'Region',
4248
+ operator: RuntimeFilterOp.EQ,
4249
+ values: ['North'],
4250
+ },
4251
+ ],
4252
+ }),
4253
+ );
4254
+ });
4255
+ });
4256
+
4257
+ test('should trigger UpdateEmbedParams with updated config', async () => {
4258
+ await setupPreRenderTest('preserve-config-test', {
4259
+ liveboardId: 'original-lb',
4260
+ runtimeFilters: [
4261
+ {
4262
+ columnName: 'Color',
4263
+ operator: RuntimeFilterOp.IN,
4264
+ values: ['red', 'blue'],
4265
+ },
4266
+ ],
4267
+ });
4268
+
4269
+ const embed2 = new LiveboardEmbed('#tsEmbedDiv', {
4270
+ preRenderId: 'preserve-config-test',
4271
+ liveboardId: 'original-lb',
4272
+ visibleVizs: ['viz-1', 'viz-2'],
4273
+ runtimeFilters: [
4274
+ {
4275
+ columnName: 'Region',
4276
+ operator: RuntimeFilterOp.EQ,
4277
+ values: ['North'],
4278
+ },
4279
+ ],
4280
+ });
4281
+
4282
+ embed2.showPreRender();
4283
+
4284
+ await executeAfterWait(() => {
4285
+ expect(mockProcessTrigger).toHaveBeenCalledWith(
4286
+ expect.any(Object),
4287
+ HostEvent.UpdateEmbedParams,
4288
+ expect.any(String),
4289
+ expect.objectContaining({
4290
+ liveboardId: 'original-lb',
4291
+ visibleVizs: ['viz-1', 'viz-2'],
4292
+ runtimeFilters: [
4293
+ {
4294
+ columnName: 'Region',
4295
+ operator: RuntimeFilterOp.EQ,
4296
+ values: ['North'],
4297
+ },
4298
+ ],
4299
+ }),
4300
+ );
4301
+ });
4302
+ });
4303
+
4304
+ test('should handle error when getUpdateEmbedParamsObject fails during showPreRender', async () => {
4305
+ await setupPreRenderTest('error-test', { liveboardId: 'original-lb' });
4306
+
4307
+ const handleErrorSpy = jest.spyOn(LiveboardEmbed.prototype as any, 'handleError');
4308
+
4309
+ const embed2 = new LiveboardEmbed('#tsEmbedDiv', {
4310
+ preRenderId: 'error-test',
4311
+ liveboardId: 'updated-lb',
4312
+ });
4313
+
4314
+ const mockError = new Error('Failed to get params');
4315
+ jest.spyOn(embed2 as any, 'getUpdateEmbedParamsObject').mockRejectedValue(mockError);
4316
+
4317
+ embed2.showPreRender();
4318
+
4319
+ await executeAfterWait(() => {
4320
+ expect(handleErrorSpy).toHaveBeenCalledWith(
4321
+ expect.objectContaining({
4322
+ errorType: ErrorDetailsTypes.API,
4323
+ message: 'Failed to get params',
4324
+ code: EmbedErrorCodes.UPDATE_PARAMS_FAILED,
4325
+ error: 'Failed to get params',
4326
+ }),
4327
+ );
4328
+
4329
+ expect(mockProcessTrigger).not.toHaveBeenCalledWith(
4330
+ expect.any(Object),
4331
+ HostEvent.UpdateEmbedParams,
4332
+ expect.any(String),
4333
+ expect.any(Object),
4334
+ );
4335
+ });
4336
+
4337
+ handleErrorSpy.mockRestore();
4338
+ });
4164
4339
  });
@@ -592,9 +592,11 @@ export class TsEmbed {
592
592
  return `${basePath}#`;
593
593
  }
594
594
 
595
- protected getUpdateEmbedParamsObject() {
595
+ protected async getUpdateEmbedParamsObject() {
596
596
  let queryParams = this.getEmbedParamsObject();
597
- queryParams = { ...this.viewConfig, ...queryParams, ...this.getAppInitData() };
597
+ const appInitData = await this.getAppInitData();
598
+ queryParams = { ...this.viewConfig, ...queryParams, ...appInitData };
599
+
598
600
  return queryParams;
599
601
  }
600
602
 
@@ -957,6 +959,8 @@ export class TsEmbed {
957
959
  preRenderWrapper.id = preRenderIds.wrapper;
958
960
  const initialPreRenderWrapperStyle = {
959
961
  position: 'absolute',
962
+ top: '0',
963
+ left: '0',
960
964
  width: '100vw',
961
965
  height: '100vh',
962
966
  };
@@ -1574,8 +1578,19 @@ export class TsEmbed {
1574
1578
  }
1575
1579
  this.validatePreRenderViewConfig(this.viewConfig);
1576
1580
  logger.debug('triggering UpdateEmbedParams', this.viewConfig);
1577
- this.executeAfterEmbedContainerLoaded(() => {
1578
- this.trigger(HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
1581
+ this.executeAfterEmbedContainerLoaded(async () => {
1582
+ try {
1583
+ const params = await this.getUpdateEmbedParamsObject();
1584
+ this.trigger(HostEvent.UpdateEmbedParams, params);
1585
+ } catch (error) {
1586
+ logger.error(ERROR_MESSAGE.UPDATE_PARAMS_FAILED, error);
1587
+ this.handleError({
1588
+ errorType: ErrorDetailsTypes.API,
1589
+ message: error?.message || ERROR_MESSAGE.UPDATE_PARAMS_FAILED,
1590
+ code: EmbedErrorCodes.UPDATE_PARAMS_FAILED,
1591
+ error: error?.message || error,
1592
+ });
1593
+ }
1579
1594
  });
1580
1595
  }
1581
1596
 
@@ -1598,7 +1613,7 @@ export class TsEmbed {
1598
1613
  }
1599
1614
  }
1600
1615
 
1601
- removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
1616
+ removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events', 'overflow']);
1602
1617
 
1603
1618
  this.subscribeToEvents();
1604
1619
 
@@ -1647,7 +1662,10 @@ export class TsEmbed {
1647
1662
  opacity: '0',
1648
1663
  pointerEvents: 'none',
1649
1664
  zIndex: '-1000',
1650
- position: 'absolute ',
1665
+ position: 'absolute',
1666
+ top: '0',
1667
+ left: '0',
1668
+ overflow: 'hidden',
1651
1669
  };
1652
1670
  setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
1653
1671
 
package/src/errors.ts CHANGED
@@ -28,6 +28,7 @@ export const ERROR_MESSAGE = {
28
28
  LOGIN_FAILED: 'Login failed',
29
29
  ERROR_PARSING_API_INTERCEPT_BODY: 'Error parsing api intercept body',
30
30
  SSR_ENVIRONMENT_ERROR: 'SSR environment detected. This function cannot be called in SSR environment.',
31
+ UPDATE_PARAMS_FAILED: 'Failed to update embed parameters',
31
32
  };
32
33
 
33
34
  export const CUSTOM_ACTIONS_ERROR_MESSAGE = {
package/src/index.ts CHANGED
@@ -66,6 +66,8 @@ import {
66
66
  CustomActionsPosition,
67
67
  CustomActionTarget,
68
68
  InterceptedApiType,
69
+ EmbedErrorCodes,
70
+ ErrorDetailsTypes,
69
71
  } from './types';
70
72
  import { CustomCssVariables } from './css-variables';
71
73
  import { SageEmbed, SageViewConfig } from './embed/sage';
@@ -156,6 +158,8 @@ export {
156
158
  CustomActionsPosition,
157
159
  CustomActionTarget,
158
160
  InterceptedApiType,
161
+ EmbedErrorCodes,
162
+ ErrorDetailsTypes,
159
163
  };
160
164
 
161
165
  export { resetCachedAuthToken } from './authToken';
package/src/types.ts CHANGED
@@ -169,57 +169,71 @@ export enum AuthType {
169
169
  }
170
170
  /**
171
171
  *
172
- * This option does not apply to the classic homepage experience.
173
- * To access the updated modular homepage,
174
- * set `modularHomeExperience` to `true`
175
- * (available as Early Access feature in 9.12.5.cl).
172
+ * **Note**: This attribute is not supported in the classic (V1) homepage experience.
176
173
  *
177
174
  */
178
175
 
179
176
  export enum HomeLeftNavItem {
180
177
  /**
178
+ * The *Search data* option in
179
+ * the *Insights* left navigation panel.
181
180
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
182
181
  */
183
182
  SearchData = 'search-data',
184
183
  /**
184
+ * The *Home* menu option in
185
+ * the *Insights* left navigation panel.
185
186
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
186
187
  */
187
188
  Home = 'insights-home',
188
189
  /**
190
+ * The *Liveboards* menu option in
191
+ * the *Insights* left navigation panel.
189
192
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
190
193
  */
191
194
  Liveboards = 'liveboards',
192
195
  /**
196
+ * The *Answers* menu option in
197
+ * the *Insights* left navigation panel.
193
198
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
194
199
  */
195
200
  Answers = 'answers',
196
201
  /**
202
+ * The *Monitor subscriptions* menu option in
203
+ * the *Insights* left navigation panel.
197
204
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
198
205
  */
199
206
  MonitorSubscription = 'monitor-alerts',
200
207
  /**
208
+ * The *SpotIQ analysis* menu option in
209
+ * the *Insights* left navigation panel.
201
210
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
202
211
  */
203
212
  SpotIQAnalysis = 'spotiq-analysis',
204
213
  /**
214
+ * The *Liveboard schedules* menu option in
215
+ * the *Insights* left navigation panel.
205
216
  * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
206
217
  */
207
218
  LiveboardSchedules = 'liveboard-schedules',
208
219
  /**
209
- * Create new options in the insights left navigation,
210
- * available when new navigation V3 is enabled.
220
+ * The create option in the *Insights*
221
+ * left navigation panel.
222
+ * Available in the V3 navigation experience.
211
223
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
212
224
  */
213
225
  Create = 'create',
214
226
  /**
215
- * Spotter option in the insights left navigation,
216
- * available when new navigation V3 is enabled.
227
+ * The *Spotter* menu option in the *Insights*
228
+ * left navigation panel.
229
+ * Available in the V3 navigation experience.
217
230
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
218
231
  */
219
232
  Spotter = 'spotter',
220
233
  /**
221
- * Favorites option in the insights left navigation,
222
- * available when new navigation V3 is enabled.
234
+ * The *Favorites* section in the *Insights*
235
+ * left navigation panel.
236
+ * Available in the V3 navigation experience.
223
237
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
224
238
  */
225
239
  Favorites = 'favorites',
@@ -1113,11 +1127,13 @@ export interface BaseViewConfig extends ApiInterceptFlags {
1113
1127
  */
1114
1128
  export interface HomePageConfig {
1115
1129
  /**
1116
- * Hide list page columns
1117
- * For example: hiddenListColumns = [ListPageColumns.Author]
1130
+ * Hide columns on list pages such as
1131
+ * *Liveboards* and *Answers*.
1132
+ * For example: `hiddenListColumns = [ListPageColumns.Author]`
1118
1133
  *
1119
- * **Note**: This option is currently available only in full app embedding and requires importing the ListPageColumns enum.
1120
- * At present, it can be used with Liveboard and Answer list pages, and starting with version 10.14.0.cl, it will also be supported for the Home page.
1134
+ * **Note**: This option is available only in full app embedding and requires importing the `ListPageColumns` enum.
1135
+ * Starting with version 10.14.0.cl, you can use this attribute to
1136
+ * hide the columns on all list pages in the *Insights* section.
1121
1137
  *
1122
1138
  * Supported embed types: `AppEmbed`
1123
1139
  * @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
@@ -1133,13 +1149,11 @@ export interface HomePageConfig {
1133
1149
  */
1134
1150
  hiddenListColumns?: ListPageColumns[];
1135
1151
  /**
1136
- * Hide the home page modules
1137
- * For example: hiddenHomepageModules = [HomepageModule.MyLibrary]
1152
+ * Control the visibility of home page modules.
1153
+ * To specify the modules, import the `HomepageModule` enum.
1154
+ * For example: `hiddenHomepageModules = [HomepageModule.MyLibrary]`
1138
1155
  *
1139
- * **Note**: This option does not apply to the classic homepage.
1140
- * To access the updated modular homepage, set
1141
- * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
1142
- * To use it, you need to import `HomepageModule` enum.
1156
+ * **Note**: This attribute is not supported in the classic (v1) experience.
1143
1157
  *
1144
1158
  * Supported embed types: `AppEmbed`
1145
1159
  * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
@@ -1148,20 +1162,18 @@ export interface HomePageConfig {
1148
1162
  * import { HomepageModule } from '@thoughtspot/visual-embed-sdk';
1149
1163
  *
1150
1164
  * const embed = new AppEmbed('#tsEmbed', {
1151
- * ... //other embed view config
1165
+ * ... // V2/V3 navigation and home page experience attributes
1152
1166
  * hiddenHomepageModules : [HomepageModule.Favorite,HomepageModule.Learning],
1167
+ * //...other embed view configuration attributes
1153
1168
  * })
1154
1169
  * ```
1155
1170
  */
1156
1171
  hiddenHomepageModules?: HomepageModule[];
1157
1172
  /**
1158
- * reordering the home page modules
1159
- * eg: reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]
1160
- *
1161
- * **Note**: This option does not apply to the classic homepage.
1162
- * To access the updated modular homepage, set
1163
- * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
1164
- * To use it, you need to import `HomepageModule` enum.
1173
+ * Reorder home page modules.
1174
+ * To specify the modules, import the `HomepageModule` enum.
1175
+ * For example: `reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]`
1176
+ * **Note**: This attribute is not supported in the classic (v1) homepage.
1165
1177
  *
1166
1178
  * Supported embed types: `AppEmbed`
1167
1179
  * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl, 10.1.0.sw
@@ -1170,16 +1182,19 @@ export interface HomePageConfig {
1170
1182
  * import { HomepageModule } from '@thoughtspot/visual-embed-sdk';
1171
1183
  *
1172
1184
  * const embed = new AppEmbed('#tsEmbed', {
1173
- * ... //other embed view config
1185
+ * ...//V2/V3 navigation and home page experience attributes
1174
1186
  * reorderedHomepageModules:[HomepageModule.Favorite,HomepageModule.MyLibrary],
1187
+ * //... other embed view configuration attributes
1175
1188
  * })
1176
1189
  * ```
1177
1190
  */
1178
1191
  reorderedHomepageModules?: HomepageModule[];
1179
1192
  /**
1180
- * homepageLeftNavItems : Show or hide the left navigation bar items.
1181
- * There are 8 eight home navigation list items.
1182
- * To hide these items, specify the string in the array.
1193
+ * Controls the visibility of the menu items
1194
+ * on the home page left navigation panel.
1195
+ * To specify the menu items, import the `HomeLeftNavItem` enum.
1196
+ *
1197
+ * **Note**: This attribute is not supported in the classic (v1) homepage.
1183
1198
  *
1184
1199
  * Supported embed types: `AppEmbed`
1185
1200
  * @example
@@ -1187,15 +1202,11 @@ export interface HomePageConfig {
1187
1202
  * import { HomeLeftNavItem } from '@thoughtspot/visual-embed-sdk';
1188
1203
  *
1189
1204
  * const embed = new AppEmbed('#tsEmbed', {
1190
- * ... //other embed view config
1205
+ * //... V2/V3 experience attributes
1191
1206
  * hiddenHomeLeftNavItems : [HomeLeftNavItem.Home,HomeLeftNavItem.Answers],
1207
+ * ... //other embed view configuration attributes
1192
1208
  * })
1193
1209
  * ```
1194
- *
1195
- * **Note**: This option does not apply to the classic homepage.
1196
- * To access the updated modular homepage, set
1197
- * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
1198
- * To use it, you need to import `HomeLeftNavItem` enum.
1199
1210
  * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
1200
1211
  */
1201
1212
  hiddenHomeLeftNavItems?: HomeLeftNavItem[];
@@ -1748,10 +1759,11 @@ export enum RuntimeFilterOp {
1748
1759
  }
1749
1760
 
1750
1761
  /**
1751
- * Home page module that can be hidden.
1752
- * **Note**: This option does not apply to the classic homepage.
1753
- * To access the updated modular homepage, set
1754
- * `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
1762
+ * Home page modules that can be hidden
1763
+ * via `hiddenHomepageModules` and reordered via
1764
+ * `reorderedHomepageModules`.
1765
+ *
1766
+ * **Note**: This option is not supported in the classic (v1) experience.
1755
1767
  * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
1756
1768
  */
1757
1769
 
@@ -1765,7 +1777,7 @@ export enum HomepageModule {
1765
1777
  */
1766
1778
  Watchlist = 'WATCHLIST',
1767
1779
  /**
1768
- * favorite objects
1780
+ * Favorite module
1769
1781
  */
1770
1782
  Favorite = 'FAVORITE',
1771
1783
  /**
@@ -2960,6 +2972,28 @@ export enum EmbedEvent {
2960
2972
  * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
2961
2973
  */
2962
2974
  PreviewSpotterData = 'PreviewSpotterData',
2975
+ /**
2976
+ * Emitted when user opens up the Add to Coaching modal on any visualization in Spotter Embed.
2977
+ * @example
2978
+ * ```js
2979
+ * spotterEmbed.on(EmbedEvent.AddToCoaching, (payload) => {
2980
+ * console.log('payload', payload);
2981
+ * })
2982
+ *```
2983
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
2984
+ */
2985
+ AddToCoaching = 'addToCoaching',
2986
+ /**
2987
+ * Emitted when user opens up the data model instructions modal in Spotter embed.
2988
+ * @example
2989
+ * ```js
2990
+ * spotterEmbed.on(EmbedEvent.DataModelInstructions, (payload) => {
2991
+ * console.log('payload', payload);
2992
+ * })
2993
+ * ```
2994
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
2995
+ */
2996
+ DataModelInstructions = 'DataModelInstructions',
2963
2997
  /**
2964
2998
  * Emitted when the Spotter query is triggered in Spotter embed.
2965
2999
  * @example
@@ -4385,6 +4419,26 @@ export enum HostEvent {
4385
4419
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
4386
4420
  */
4387
4421
  PreviewSpotterData = 'PreviewSpotterData',
4422
+ /**
4423
+ * Opens the Add to Coaching modal from a visualization in Spotter Embed.
4424
+ * @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
4425
+ * @example
4426
+ * ```js
4427
+ * spotterEmbed.trigger(HostEvent.AddToCoaching, { vizId: '730496d6-6903-4601-937e-2c691821af3c' });
4428
+ *
4429
+ *```
4430
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
4431
+ */
4432
+ AddToCoaching = 'addToCoaching',
4433
+ /**
4434
+ * Opens the data model instructions modal in Spotter Embed.
4435
+ * @example
4436
+ * ```js
4437
+ * spotterEmbed.trigger(HostEvent.DataModelInstructions);
4438
+ * ```
4439
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
4440
+ */
4441
+ DataModelInstructions = 'DataModelInstructions',
4388
4442
  /**
4389
4443
  * Resets the Spotter Embed Conversation.
4390
4444
  * @example
@@ -6298,6 +6352,9 @@ export enum EmbedErrorCodes {
6298
6352
 
6299
6353
  /** Error parsing api intercept body */
6300
6354
  PARSING_API_INTERCEPT_BODY_ERROR = 'PARSING_API_INTERCEPT_BODY_ERROR',
6355
+
6356
+ /** Failed to update embed parameters during pre-render */
6357
+ UPDATE_PARAMS_FAILED = 'UPDATE_PARAMS_FAILED',
6301
6358
  }
6302
6359
 
6303
6360
  /**
package/src/utils.ts CHANGED
@@ -147,7 +147,8 @@ export const isValidCssMargin = (value: string): boolean => {
147
147
  return false;
148
148
  }
149
149
 
150
- // This pattern allows for an optional negative sign, and numbers that can be integers or decimals (including leading dot).
150
+ // This pattern allows for an optional negative sign, and numbers
151
+ // that can be integers or decimals (including leading dot).
151
152
  const cssUnitPattern = /^-?(\d+(\.\d*)?|\.\d+)(px|em|rem|%|vh|vw)$/i;
152
153
  const parts = value.trim().split(/\s+/);
153
154