@thoughtspot/visual-embed-sdk 1.36.0 → 1.36.1

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 (109) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +8 -0
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  5. package/cjs/src/embed/hostEventClient/host-event-client.js +8 -3
  6. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  7. package/cjs/src/embed/hostEventClient/host-event-client.spec.js +54 -0
  8. package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  9. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  10. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  11. package/cjs/src/embed/searchEmbed-basic-auth.spec.js +104 -0
  12. package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  13. package/cjs/src/hostEventsTypeMapping.d.ts +2 -0
  14. package/cjs/src/hostEventsTypeMapping.d.ts.map +1 -0
  15. package/cjs/src/hostEventsTypeMapping.js +4 -0
  16. package/cjs/src/hostEventsTypeMapping.js.map +1 -0
  17. package/cjs/src/types.d.ts +72 -8
  18. package/cjs/src/types.d.ts.map +1 -1
  19. package/cjs/src/types.js +72 -8
  20. package/cjs/src/types.js.map +1 -1
  21. package/cjs/src/utils/embedApi/contracts.d.ts +101 -0
  22. package/cjs/src/utils/embedApi/contracts.d.ts.map +1 -0
  23. package/cjs/src/utils/embedApi/contracts.js +17 -0
  24. package/cjs/src/utils/embedApi/contracts.js.map +1 -0
  25. package/cjs/src/utils/embedApi/embedApiClient.d.ts +12 -0
  26. package/cjs/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  27. package/cjs/src/utils/embedApi/embedApiClient.js +46 -0
  28. package/cjs/src/utils/embedApi/embedApiClient.js.map +1 -0
  29. package/cjs/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  30. package/cjs/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  31. package/cjs/src/utils/embedApi/processEmbedApi.js +18 -0
  32. package/cjs/src/utils/embedApi/processEmbedApi.js.map +1 -0
  33. package/dist/{index-V2oBuwy6.js → index-B3hd6DTM.js} +1 -1
  34. package/dist/index-BBBimG1x.js +7370 -0
  35. package/dist/index-BGnxP5NY.js +7370 -0
  36. package/dist/index-CENLvayL.js +7370 -0
  37. package/dist/index-CR5u7BMC.js +7370 -0
  38. package/dist/index-CbltIawo.js +7370 -0
  39. package/dist/index-CoQfqaHj.js +7370 -0
  40. package/dist/index-CzwzS0P4.js +7370 -0
  41. package/dist/index-D-9WUCUl.js +7370 -0
  42. package/dist/index-DFwi_pV_.js +7370 -0
  43. package/dist/index-DOIjN0N_.js +7370 -0
  44. package/dist/index-DYBx8SuE.js +7370 -0
  45. package/dist/index-DaLHJaLd.js +7370 -0
  46. package/dist/index-DnJX-gN2.js +7370 -0
  47. package/dist/index-IDmSUe93.js +7370 -0
  48. package/dist/index-nWevLycs.js +7370 -0
  49. package/dist/index-vxW97_xb.js +7370 -0
  50. package/dist/src/css-variables.d.ts +8 -0
  51. package/dist/src/css-variables.d.ts.map +1 -1
  52. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  53. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  54. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  55. package/dist/src/hostEventsTypeMapping.d.ts +2 -0
  56. package/dist/src/hostEventsTypeMapping.d.ts.map +1 -0
  57. package/dist/src/types.d.ts +72 -8
  58. package/dist/src/types.d.ts.map +1 -1
  59. package/dist/src/utils/embedApi/contracts.d.ts +101 -0
  60. package/dist/src/utils/embedApi/contracts.d.ts.map +1 -0
  61. package/dist/src/utils/embedApi/embedApiClient.d.ts +12 -0
  62. package/dist/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  63. package/dist/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  64. package/dist/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  65. package/dist/tsembed-react.es.js +83 -14
  66. package/dist/tsembed-react.js +82 -13
  67. package/dist/tsembed.es.js +83 -14
  68. package/dist/tsembed.js +82 -13
  69. package/dist/visual-embed-sdk-react-full.d.ts +80 -8
  70. package/dist/visual-embed-sdk-react.d.ts +80 -8
  71. package/dist/visual-embed-sdk.d.ts +80 -8
  72. package/lib/package.json +1 -1
  73. package/lib/src/css-variables.d.ts +8 -0
  74. package/lib/src/css-variables.d.ts.map +1 -1
  75. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  76. package/lib/src/embed/hostEventClient/host-event-client.js +8 -3
  77. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  78. package/lib/src/embed/hostEventClient/host-event-client.spec.js +54 -0
  79. package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  80. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  81. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  82. package/lib/src/embed/searchEmbed-basic-auth.spec.js +101 -0
  83. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  84. package/lib/src/hostEventsTypeMapping.d.ts +2 -0
  85. package/lib/src/hostEventsTypeMapping.d.ts.map +1 -0
  86. package/lib/src/hostEventsTypeMapping.js +2 -0
  87. package/lib/src/hostEventsTypeMapping.js.map +1 -0
  88. package/lib/src/types.d.ts +72 -8
  89. package/lib/src/types.d.ts.map +1 -1
  90. package/lib/src/types.js +72 -8
  91. package/lib/src/types.js.map +1 -1
  92. package/lib/src/utils/embedApi/contracts.d.ts +101 -0
  93. package/lib/src/utils/embedApi/contracts.d.ts.map +1 -0
  94. package/lib/src/utils/embedApi/contracts.js +14 -0
  95. package/lib/src/utils/embedApi/contracts.js.map +1 -0
  96. package/lib/src/utils/embedApi/embedApiClient.d.ts +12 -0
  97. package/lib/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  98. package/lib/src/utils/embedApi/embedApiClient.js +42 -0
  99. package/lib/src/utils/embedApi/embedApiClient.js.map +1 -0
  100. package/lib/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  101. package/lib/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  102. package/lib/src/utils/embedApi/processEmbedApi.js +14 -0
  103. package/lib/src/utils/embedApi/processEmbedApi.js.map +1 -0
  104. package/lib/src/visual-embed-sdk.d.ts +80 -8
  105. package/package.json +1 -1
  106. package/src/css-variables.ts +10 -0
  107. package/src/embed/hostEventClient/host-event-client.spec.ts +61 -0
  108. package/src/embed/hostEventClient/host-event-client.ts +8 -3
  109. package/src/types.ts +72 -8
@@ -4505,16 +4505,63 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4505
4505
  */
4506
4506
  getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
4507
4507
  /**
4508
- * Trigger the **Pin** action on an embedded object
4509
- * @param - Liveboard embed takes the `vizId` as a
4510
- * key. Can be left undefined when embedding Search, full app, or
4511
- * a visualization.
4508
+ * Trigger **Pin** action on an embedded object.
4509
+ * If no parameters are defined, the pin action is triggered
4510
+ * for the Answer that the user is currently on
4511
+ * and a modal opens for Liveboard selection.
4512
+ * To add an Answer or visualization to a Liveboard programmatically without
4513
+ * showing requiring additional user input via *Pin to Liveboard* modal, define
4514
+ * the following parameters:
4515
+ *
4516
+ * @param
4517
+ * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
4518
+ * Optional when pinning a new chart or table generated from a Search query.
4519
+ * @param
4520
+ * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
4521
+ * specify the `newLiveboardName` parameter to create a new Liveboard.
4522
+ * @param
4523
+ * `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
4524
+ * specified in the code.
4525
+ * @param
4526
+ * `newVizName` - Name string for the Answer or visualization. If defined,
4527
+ * this parameter adds a new visualization object or creates a copy of the
4528
+ * Answer or visualization specified in `vizId`.
4529
+ * Required attribute.
4530
+ * @param
4531
+ * `newLiveboardName` - Name string for the Liveboard.
4532
+ * Creates a new Liveboard object with the specified name.
4533
+ * @param
4534
+ * `newTabName` - Name of the tab. Adds a new tab Liveboard specified
4535
+ * in the code.
4536
+ *
4512
4537
  * @example
4513
4538
  * ```js
4514
- * appEmbed.trigger(HostEvent.Pin)
4539
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
4540
+ * vizId: "123",
4541
+ * newVizName: "Sales by region",
4542
+ * liveboardId: "123",
4543
+ * tabId: "123"
4544
+ * });
4515
4545
  * ```
4546
+ * @example
4516
4547
  * ```js
4517
- * searchEmbed.trigger(HostEvent.Pin)
4548
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
4549
+ * newVizName: "Total sales of Jackets",
4550
+ * liveboardId: "123"
4551
+ * });
4552
+ * ```
4553
+ *
4554
+ * @example
4555
+ * ```js
4556
+ * const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
4557
+ * newVizName: "Sales by state",
4558
+ * newLiveboardName: "Sales",
4559
+ * newTabName: "Products"
4560
+ * });
4561
+ * ```
4562
+ * @example
4563
+ * ```js
4564
+ * appEmbed.trigger(HostEvent.Pin)
4518
4565
  * ```
4519
4566
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
4520
4567
  */
@@ -5170,8 +5217,25 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5170
5217
  */
5171
5218
  InfoSuccess = "InfoSuccess",
5172
5219
  /**
5173
- * Triggers the action to get the current view of the liveboard
5174
- * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
5220
+ * Trigger the save action for an Answer.
5221
+ * To programmatically save an answer without opening the
5222
+ * *Describe your Answer* modal, define the `name` and `description`
5223
+ * properties.
5224
+ * If no parameters are specified, the save action is
5225
+ * triggered with a modal to prompt users to
5226
+ * add a name and description for the Answer.
5227
+ * @param - optional attributes to set Answer properties.
5228
+ * `name` - Name string for the Answer.
5229
+ * `description` - Description text for the Answer.
5230
+ *
5231
+ * @example
5232
+ * ```js
5233
+ * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
5234
+ * name: "Sales by states",
5235
+ * description: "Total sales by states in MidWest"
5236
+ * });
5237
+ * ```
5238
+ * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
5175
5239
  */
5176
5240
  SaveAnswer = "saveAnswer",
5177
5241
  /**
@@ -6756,6 +6820,14 @@ declare module '@thoughtspot/visual-embed-sdk/css-variables' {
6756
6820
  * panel.
6757
6821
  */
6758
6822
  '--ts-var-search-auto-complete-subtext-font-color'?: string;
6823
+ /**
6824
+ * Background color of the input box in the Spotter page.
6825
+ */
6826
+ '--ts-var-spotter-input-background'?: string;
6827
+ /**
6828
+ * Background color of the previously asked prompt message in the Spotter page.
6829
+ */
6830
+ '--ts-var-spotter-prompt-background': string;
6759
6831
  /**
6760
6832
  * Background color of the data panel.
6761
6833
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.36.0",
3
+ "version": "1.36.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -111,6 +111,16 @@ export interface CustomCssVariables {
111
111
  */
112
112
  '--ts-var-search-auto-complete-subtext-font-color'?: string;
113
113
 
114
+ /**
115
+ * Background color of the input box in the Spotter page.
116
+ */
117
+ '--ts-var-spotter-input-background'?: string;
118
+
119
+ /**
120
+ * Background color of the previously asked prompt message in the Spotter page.
121
+ */
122
+ '--ts-var-spotter-prompt-background': string;
123
+
114
124
  /**
115
125
  * Background color of the data panel.
116
126
  */
@@ -133,6 +133,7 @@ describe('HostEventClient', () => {
133
133
  const mockResponse = {
134
134
  value: {
135
135
  pinboardId: 'testPinboard',
136
+ liveboardId: 'testPinboard',
136
137
  tabId: 'testTab',
137
138
  vizId: 'testVizId',
138
139
  },
@@ -250,5 +251,65 @@ describe('HostEventClient', () => {
250
251
  );
251
252
  expect(result).toEqual([mockResponse]);
252
253
  });
254
+
255
+ it('Pin response support pinboardId as well', async () => {
256
+ const { client, mockIframe } = createHostEventClient();
257
+ const hostEvent = HostEvent.Pin;
258
+ const payload: HostEventRequest<typeof hostEvent> = {
259
+ newVizDescription: 'Test Description',
260
+ vizId: 'testVizId',
261
+ newVizName: 'Test Answer',
262
+ newLiveboardName: 'testLiveboard',
263
+ } as any;
264
+ const mockResponse = [{
265
+ value: {
266
+ pinboardId: 'testLiveboard',
267
+ liveboardId: 'testPinboard',
268
+ tabId: 'testTab',
269
+ vizId: 'testVizId',
270
+ },
271
+ refId: 'testVizId',
272
+ }];
273
+ mockProcessTrigger.mockResolvedValue(mockResponse);
274
+ const result = await client.triggerHostEvent(hostEvent, payload);
275
+ expect(result.liveboardId).toBe('testLiveboard');
276
+ });
277
+
278
+ it('should request liveboardId as well', async () => {
279
+ const { client, mockIframe } = createHostEventClient();
280
+ const hostEvent = HostEvent.Pin;
281
+ const payload: HostEventRequest<typeof hostEvent> = {
282
+ liveboardId: 'test',
283
+ newVizName: 'Test Answer',
284
+ newPinboardName: 'testLiveboard1',
285
+ newLiveboardName: 'testLiveboard',
286
+ } as any;
287
+ const mockResponse = [{
288
+ value: {
289
+ pinboardId: 'testLiveboard',
290
+ tabId: 'testTab',
291
+ vizId: 'testVizId',
292
+ },
293
+ refId: 'testVizId',
294
+ }];
295
+ mockProcessTrigger.mockResolvedValue(mockResponse);
296
+ const result = await client.triggerHostEvent(hostEvent, payload);
297
+ expect(result.liveboardId).toBe('testLiveboard');
298
+ expect(mockProcessTrigger).toHaveBeenCalledWith(
299
+ mockIframe,
300
+ HostEvent.UIPassthrough,
301
+ mockThoughtSpotHost,
302
+ {
303
+ parameters: { ...payload, pinboardId: 'test', newPinboardName: 'testLiveboard' },
304
+ type: 'addVizToPinboard',
305
+ },
306
+ );
307
+ expect(result).toEqual({
308
+ pinboardId: 'testLiveboard',
309
+ tabId: 'testTab',
310
+ vizId: 'testVizId',
311
+ liveboardId: 'testLiveboard',
312
+ });
313
+ });
253
314
  });
254
315
  });
@@ -98,13 +98,18 @@ export class HostEventClient {
98
98
 
99
99
  const formattedPayload = {
100
100
  ...payload,
101
- pinboardId: payload.liveboardId,
102
- newPinboardName: payload.newLiveboardName,
101
+ pinboardId: payload.liveboardId ?? (payload as any).pinboardId,
102
+ newPinboardName: payload.newLiveboardName ?? (payload as any).newPinboardName,
103
103
  };
104
104
 
105
- return this.handleHostEventWithParam(
105
+ const data = await this.handleHostEventWithParam(
106
106
  UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload,
107
107
  );
108
+
109
+ return {
110
+ ...data,
111
+ liveboardId: (data as any).pinboardId,
112
+ };
108
113
  }
109
114
 
110
115
  protected async handleSaveAnswerEvent(
package/src/types.ts CHANGED
@@ -2615,16 +2615,63 @@ export enum HostEvent {
2615
2615
  */
2616
2616
  getExportRequestForCurrentPinboard = 'getExportRequestForCurrentPinboard',
2617
2617
  /**
2618
- * Trigger the **Pin** action on an embedded object
2619
- * @param - Liveboard embed takes the `vizId` as a
2620
- * key. Can be left undefined when embedding Search, full app, or
2621
- * a visualization.
2618
+ * Trigger **Pin** action on an embedded object.
2619
+ * If no parameters are defined, the pin action is triggered
2620
+ * for the Answer that the user is currently on
2621
+ * and a modal opens for Liveboard selection.
2622
+ * To add an Answer or visualization to a Liveboard programmatically without
2623
+ * showing requiring additional user input via *Pin to Liveboard* modal, define
2624
+ * the following parameters:
2625
+ *
2626
+ * @param
2627
+ * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2628
+ * Optional when pinning a new chart or table generated from a Search query.
2629
+ * @param
2630
+ * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
2631
+ * specify the `newLiveboardName` parameter to create a new Liveboard.
2632
+ * @param
2633
+ * `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
2634
+ * specified in the code.
2635
+ * @param
2636
+ * `newVizName` - Name string for the Answer or visualization. If defined,
2637
+ * this parameter adds a new visualization object or creates a copy of the
2638
+ * Answer or visualization specified in `vizId`.
2639
+ * Required attribute.
2640
+ * @param
2641
+ * `newLiveboardName` - Name string for the Liveboard.
2642
+ * Creates a new Liveboard object with the specified name.
2643
+ * @param
2644
+ * `newTabName` - Name of the tab. Adds a new tab Liveboard specified
2645
+ * in the code.
2646
+ *
2622
2647
  * @example
2623
2648
  * ```js
2624
- * appEmbed.trigger(HostEvent.Pin)
2649
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2650
+ * vizId: "123",
2651
+ * newVizName: "Sales by region",
2652
+ * liveboardId: "123",
2653
+ * tabId: "123"
2654
+ * });
2625
2655
  * ```
2656
+ * @example
2626
2657
  * ```js
2627
- * searchEmbed.trigger(HostEvent.Pin)
2658
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2659
+ * newVizName: "Total sales of Jackets",
2660
+ * liveboardId: "123"
2661
+ * });
2662
+ * ```
2663
+ *
2664
+ * @example
2665
+ * ```js
2666
+ * const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
2667
+ * newVizName: "Sales by state",
2668
+ * newLiveboardName: "Sales",
2669
+ * newTabName: "Products"
2670
+ * });
2671
+ * ```
2672
+ * @example
2673
+ * ```js
2674
+ * appEmbed.trigger(HostEvent.Pin)
2628
2675
  * ```
2629
2676
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2630
2677
  */
@@ -3280,8 +3327,25 @@ export enum HostEvent {
3280
3327
  */
3281
3328
  InfoSuccess = 'InfoSuccess',
3282
3329
  /**
3283
- * Triggers the action to get the current view of the liveboard
3284
- * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
3330
+ * Trigger the save action for an Answer.
3331
+ * To programmatically save an answer without opening the
3332
+ * *Describe your Answer* modal, define the `name` and `description`
3333
+ * properties.
3334
+ * If no parameters are specified, the save action is
3335
+ * triggered with a modal to prompt users to
3336
+ * add a name and description for the Answer.
3337
+ * @param - optional attributes to set Answer properties.
3338
+ * `name` - Name string for the Answer.
3339
+ * `description` - Description text for the Answer.
3340
+ *
3341
+ * @example
3342
+ * ```js
3343
+ * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
3344
+ * name: "Sales by states",
3345
+ * description: "Total sales by states in MidWest"
3346
+ * });
3347
+ * ```
3348
+ * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
3285
3349
  */
3286
3350
  SaveAnswer = 'saveAnswer',
3287
3351
  /**