@thoughtspot/visual-embed-sdk 1.42.3 → 1.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -1881,7 +1881,7 @@ export enum EmbedEvent {
1881
1881
  */
1882
1882
  Load = 'load',
1883
1883
  /**
1884
- * Data pertaining to an Answer or Liveboard is received.
1884
+ * Data pertaining to an Answer, Liveboard or Spotter visualization is received.
1885
1885
  * The event payload includes the raw data of the object.
1886
1886
  * @return data - Answer of Liveboard data
1887
1887
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
@@ -2302,6 +2302,17 @@ export enum EmbedEvent {
2302
2302
  *```
2303
2303
  */
2304
2304
  AnswerDelete = 'answerDelete',
2305
+ /**
2306
+ * Emitted when the AI Highlights action is triggered on a Liveboard
2307
+ * @version SDK: 1.44.0 | ThoughtSpot: 10.15.0.cl
2308
+ * @example
2309
+ *```js
2310
+ * liveboardEmbed.on(EmbedEvent.AIHighlights, (payload) => {
2311
+ * console.log('AI Highlights', payload);
2312
+ * })
2313
+ *```
2314
+ */
2315
+ AIHighlights = 'AIHighlights',
2305
2316
  /**
2306
2317
  * Emitted when a user initiates the Pin action to
2307
2318
  * add an Answer to a Liveboard.
@@ -3253,7 +3264,7 @@ export enum HostEvent {
3253
3264
  * the following parameters:
3254
3265
  *
3255
3266
  * @param
3256
- * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
3267
+ * `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
3257
3268
  * Optional when pinning a new chart or table generated from a Search query.
3258
3269
  * **Required** in Spotter Embed.
3259
3270
  * @param
@@ -3305,10 +3316,16 @@ export enum HostEvent {
3305
3316
  * ```
3306
3317
  * @example
3307
3318
  * ```js
3308
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Pin, {
3309
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3310
- * });
3311
- * ```
3319
+
3320
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
3321
+ * let latestSpotterVizId = '';
3322
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3323
+ * latestSpotterVizId = payload.data.id;
3324
+ * });
3325
+ *
3326
+ * spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
3327
+ * ```
3328
+ *
3312
3329
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
3313
3330
  */
3314
3331
  Pin = 'pin',
@@ -3383,14 +3400,29 @@ export enum HostEvent {
3383
3400
  * ```
3384
3401
  * @example
3385
3402
  * ```js
3386
- * spotterEmbed.trigger(HostEvent.DownloadAsPdf, {
3387
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3388
- * });
3389
- * ```
3403
+
3404
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
3405
+ * let latestSpotterVizId = '';
3406
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3407
+ * latestSpotterVizId = payload.data.id;
3408
+ * });
3409
+ *
3410
+ * spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
3411
+ * ```
3390
3412
  *
3391
3413
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
3392
3414
  */
3393
3415
  DownloadAsPdf = 'downloadAsPdf',
3416
+ /**
3417
+ * Trigger the **AI Highlights** action on an embedded Liveboard
3418
+ *
3419
+ * @example
3420
+ * ```js
3421
+ * liveboardEmbed.trigger(HostEvent.AIHighlights)
3422
+ * ```
3423
+ * @version SDK: 1.44.0 | ThoughtSpot: 10.15.0.cl
3424
+ */
3425
+ AIHighlights = 'AIHighlights',
3394
3426
  /**
3395
3427
  * Trigger the **Make a copy** action on a Liveboard,
3396
3428
  * visualization, or Answer page.
@@ -3413,10 +3445,14 @@ export enum HostEvent {
3413
3445
  * ```
3414
3446
  * @example
3415
3447
  * ```js
3416
- * const pinResponse = await spotterEmbed.trigger(HostEvent.MakeACopy, {
3417
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3418
- * });
3419
- * ```
3448
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
3449
+ * let latestSpotterVizId = '';
3450
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3451
+ * latestSpotterVizId = payload.data.id;
3452
+ * });
3453
+ *
3454
+ * spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
3455
+ * ```
3420
3456
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
3421
3457
  */
3422
3458
  MakeACopy = 'makeACopy',
@@ -3501,15 +3537,7 @@ export enum HostEvent {
3501
3537
  * ```
3502
3538
  * @example
3503
3539
  * ```js
3504
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Edit, {
3505
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3506
- * });
3507
- * ```
3508
- * @example
3509
- * ```js
3510
- * const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
3511
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3512
- * });
3540
+ * spotterEmbed.trigger(HostEvent.Edit);
3513
3541
  * ```
3514
3542
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
3515
3543
  */
@@ -3558,16 +3586,23 @@ export enum HostEvent {
3558
3586
  * );
3559
3587
  * })
3560
3588
  * ```
3561
- * @example
3589
+ * * @example
3562
3590
  * ```js
3563
- * spotterEmbed.trigger(HostEvent.GetTML, {
3564
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
3591
+
3592
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
3593
+ * let latestSpotterVizId = '';
3594
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3595
+ * latestSpotterVizId = payload.data.id;
3596
+ * });
3597
+ *
3598
+ * spotterEmbed.trigger(HostEvent.GetTML, {
3599
+ * vizId: latestSpotterVizId
3565
3600
  * }).then((tml) => {
3566
3601
  * console.log(
3567
3602
  * tml.answer.search_query // TML representation of the search query
3568
3603
  * );
3569
3604
  * })
3570
- * ```
3605
+ * ```
3571
3606
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
3572
3607
  * @important
3573
3608
  */
@@ -3631,7 +3666,7 @@ export enum HostEvent {
3631
3666
  /**
3632
3667
  * Trigger the **Download** action on charts in
3633
3668
  * the embedded view.
3634
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3669
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
3635
3670
  * @example
3636
3671
  * ```js
3637
3672
  * liveboardEmbed.trigger(HostEvent.Download, {vizId:
@@ -3641,10 +3676,14 @@ export enum HostEvent {
3641
3676
  * embed.trigger(HostEvent.Download)
3642
3677
  * ```
3643
3678
  * ```js
3644
- * spotterEmbed.trigger(HostEvent.Download, {
3645
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
3646
- * });
3647
- * ```
3679
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
3680
+ * let latestSpotterVizId = '';
3681
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3682
+ * latestSpotterVizId = payload.data.id;
3683
+ * });
3684
+ *
3685
+ * spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
3686
+ * ```
3648
3687
  * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
3649
3688
  * Use {@link DownloadAsPng}
3650
3689
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
@@ -3662,9 +3701,13 @@ export enum HostEvent {
3662
3701
  *
3663
3702
  * searchEmbed.trigger(HostEvent.DownloadAsPng)
3664
3703
  *
3665
- * spotterEmbed.trigger(HostEvent.DownloadAsPng, {
3666
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
3667
- * })
3704
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
3705
+ * let latestSpotterVizId = '';
3706
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3707
+ * latestSpotterVizId = payload.data.id;
3708
+ * });
3709
+ *
3710
+ * spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
3668
3711
  * ```
3669
3712
  *
3670
3713
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
@@ -3673,7 +3716,7 @@ export enum HostEvent {
3673
3716
  /**
3674
3717
  * Trigger the **Download** > **CSV** action on tables in
3675
3718
  * the embedded view.
3676
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3719
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
3677
3720
  * @example
3678
3721
  * ```js
3679
3722
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
@@ -3686,9 +3729,13 @@ export enum HostEvent {
3686
3729
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
3687
3730
  * ```
3688
3731
  * ```js
3689
- * spotterEmbed.trigger(HostEvent.DownloadAsCsv, {
3690
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
3691
- * })
3732
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
3733
+ * let latestSpotterVizId = '';
3734
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3735
+ * latestSpotterVizId = payload.data.id;
3736
+ * });
3737
+ *
3738
+ * spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
3692
3739
  * ```
3693
3740
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
3694
3741
  */
@@ -3696,7 +3743,7 @@ export enum HostEvent {
3696
3743
  /**
3697
3744
  * Trigger the **Download** > **XLSX** action on tables
3698
3745
  * in the embedded view.
3699
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3746
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
3700
3747
  * @example
3701
3748
  * ```js
3702
3749
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
@@ -3709,9 +3756,13 @@ export enum HostEvent {
3709
3756
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
3710
3757
  * ```
3711
3758
  * ```js
3712
- * spotterEmbed.trigger(HostEvent.downloadAsXLSX, {
3713
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
3714
- * })
3759
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
3760
+ * let latestSpotterVizId = '';
3761
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3762
+ * latestSpotterVizId = payload.data.id;
3763
+ * });
3764
+ *
3765
+ * spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
3715
3766
  * ```
3716
3767
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
3717
3768
  */
@@ -3748,7 +3799,7 @@ export enum HostEvent {
3748
3799
  * ```
3749
3800
  *
3750
3801
  * ```js
3751
- * // Save an Answer in Spotter (requires vizId)
3802
+ * // Save a Visualization in Spotter (requires vizId)
3752
3803
  * spotterEmbed.trigger(HostEvent.Save, {
3753
3804
  * vizId: "730496d6-6903-4601-937e-2c691821af3c"
3754
3805
  * })
@@ -4049,15 +4100,21 @@ export enum HostEvent {
4049
4100
  ResetLiveboardPersonalisedView = 'ResetLiveboardPersonalisedView',
4050
4101
  /**
4051
4102
  * Triggers an action to update Parameter values on embedded
4052
- * Answers, Liveboard and Spotter answer in Edit mode.
4103
+ * Answers, Liveboard, and Spotter answer in Edit mode.
4104
+ * @param - `name` - Name of the Parameter
4105
+ * @param - `value` - The value to set for the Parameter.
4106
+ *
4107
+ * Optionally, to control the visibility of the Parameter chip,
4108
+ * use the `isVisibleToUser` attribute when applying an override.
4053
4109
  *
4054
4110
  * @example
4055
4111
  * ```js
4056
4112
  * liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
4057
- * name: "Color",
4058
- * value: "almond"
4113
+ * name: "Integer Range Param",
4114
+ * value: 10,
4115
+ * isVisibleToUser: false
4059
4116
  * }])
4060
- *
4117
+ * ```
4061
4118
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
4062
4119
  */
4063
4120
  UpdateParameters = 'UpdateParameters',
@@ -4070,11 +4127,13 @@ export enum HostEvent {
4070
4127
  * });
4071
4128
  *```
4072
4129
  *```js
4073
- * spotterEmbed.trigger(HostEvent.GetParameters, {
4074
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
4075
- * }).then((parameter) => {
4076
- * console.log('parameters', parameter);
4077
- * });
4130
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
4131
+ * let latestSpotterVizId = '';
4132
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
4133
+ * latestSpotterVizId = payload.data.id;
4134
+ * });
4135
+ *
4136
+ * spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
4078
4137
  *```
4079
4138
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
4080
4139
  */
@@ -4104,10 +4163,11 @@ export enum HostEvent {
4104
4163
  * If no parameters are specified, the save action is
4105
4164
  * triggered with a modal to prompt users to
4106
4165
  * add a name and description for the Answer.
4107
- * @param - optional attributes to set Answer properties.
4108
- * `name` - Name string for the Answer.
4109
- * `description` - Description text for the Answer.
4110
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
4166
+ * @param - `vizId` refers to the Answer ID in Spotter embed
4167
+ * and is required in Spotter embed.
4168
+ * Optional attributes to set Answer properties include:
4169
+ * @param - `name` - Name string for the Answer.
4170
+ * @param - `description` - Description text for the Answer.
4111
4171
  * @example
4112
4172
  * ```js
4113
4173
  * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
@@ -4117,11 +4177,13 @@ export enum HostEvent {
4117
4177
  * ```
4118
4178
  * @example
4119
4179
  * ```js
4120
- * const saveAnswerResponse = await spotterEmbed.trigger(HostEvent.SaveAnswer, {
4121
- * vizId: '730496d6-6903-4601-937e-2c691821af3c',
4122
- * name: "Sales by states",
4123
- * description: "Total sales by states in MidWest"
4180
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
4181
+ * let latestSpotterVizId = '';
4182
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
4183
+ * latestSpotterVizId = payload.data.id;
4124
4184
  * });
4185
+ *
4186
+ * spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
4125
4187
  * ```
4126
4188
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
4127
4189
  */
@@ -4205,12 +4267,15 @@ export enum HostEvent {
4205
4267
  DeleteLastPrompt = 'DeleteLastPrompt',
4206
4268
  /**
4207
4269
  * Toggle the visualization to chart or table view.
4208
- * @param - `vizId ` refers to the answer id in spotter Embed, it is required in spotter Embed.
4270
+ * @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
4209
4271
  * @example
4210
4272
  * ```js
4211
- * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, {
4212
- * vizId:'b535c760-8bbe-4e6f-bb26-af56b4129a1e'
4273
+ * let latestSpotterVizId = '';
4274
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
4275
+ * latestSpotterVizId = payload.data.id;
4213
4276
  * });
4277
+ *
4278
+ * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
4214
4279
  *```
4215
4280
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
4216
4281
  */
@@ -4239,12 +4304,16 @@ export enum HostEvent {
4239
4304
  */
4240
4305
  VisibleEmbedCoordinates = 'visibleEmbedCoordinates',
4241
4306
  /**
4242
- * Trigger the *Ask Spotter* action for visualizations
4243
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
4307
+ * Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
4308
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
4244
4309
  * @example
4245
4310
  * ```js
4246
- * spotterEmbed.trigger(HostEvent.AskSpotter,
4247
- * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
4311
+ * let latestSpotterVizId = '';
4312
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
4313
+ * latestSpotterVizId = payload.data.id;
4314
+ * });
4315
+ *
4316
+ * spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
4248
4317
  * ```
4249
4318
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
4250
4319
  */