@thoughtspot/visual-embed-sdk 1.32.7 → 1.32.9

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 (61) hide show
  1. package/cjs/package.json +3 -3
  2. package/cjs/src/css-variables.d.ts +18 -3
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/base.d.ts +34 -32
  5. package/cjs/src/embed/base.d.ts.map +1 -1
  6. package/cjs/src/embed/base.js +40 -37
  7. package/cjs/src/embed/base.js.map +1 -1
  8. package/cjs/src/tokenizedFetch.d.ts.map +1 -1
  9. package/cjs/src/tokenizedFetch.js +5 -1
  10. package/cjs/src/tokenizedFetch.js.map +1 -1
  11. package/cjs/src/types.d.ts +80 -8
  12. package/cjs/src/types.d.ts.map +1 -1
  13. package/cjs/src/types.js +76 -6
  14. package/cjs/src/types.js.map +1 -1
  15. package/cjs/src/utils/authService/authService.spec.js +3 -1
  16. package/cjs/src/utils/authService/authService.spec.js.map +1 -1
  17. package/cjs/src/utils.d.ts.map +1 -1
  18. package/cjs/src/utils.js +3 -1
  19. package/cjs/src/utils.js.map +1 -1
  20. package/dist/src/css-variables.d.ts +18 -3
  21. package/dist/src/css-variables.d.ts.map +1 -1
  22. package/dist/src/embed/base.d.ts +34 -32
  23. package/dist/src/embed/base.d.ts.map +1 -1
  24. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  25. package/dist/src/types.d.ts +80 -8
  26. package/dist/src/types.d.ts.map +1 -1
  27. package/dist/src/utils.d.ts.map +1 -1
  28. package/dist/tsembed-react.es.js +314 -82
  29. package/dist/tsembed-react.js +257 -81
  30. package/dist/tsembed.es.js +354 -119
  31. package/dist/tsembed.js +297 -118
  32. package/dist/visual-embed-sdk-react-full.d.ts +132 -43
  33. package/dist/visual-embed-sdk-react.d.ts +132 -43
  34. package/dist/visual-embed-sdk.d.ts +132 -43
  35. package/lib/package.json +3 -3
  36. package/lib/src/css-variables.d.ts +18 -3
  37. package/lib/src/css-variables.d.ts.map +1 -1
  38. package/lib/src/embed/base.d.ts +34 -32
  39. package/lib/src/embed/base.d.ts.map +1 -1
  40. package/lib/src/embed/base.js +40 -37
  41. package/lib/src/embed/base.js.map +1 -1
  42. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  43. package/lib/src/tokenizedFetch.js +5 -1
  44. package/lib/src/tokenizedFetch.js.map +1 -1
  45. package/lib/src/types.d.ts +80 -8
  46. package/lib/src/types.d.ts.map +1 -1
  47. package/lib/src/types.js +76 -6
  48. package/lib/src/types.js.map +1 -1
  49. package/lib/src/utils/authService/authService.spec.js +3 -1
  50. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  51. package/lib/src/utils.d.ts.map +1 -1
  52. package/lib/src/utils.js +3 -1
  53. package/lib/src/utils.js.map +1 -1
  54. package/lib/src/visual-embed-sdk.d.ts +132 -43
  55. package/package.json +3 -3
  56. package/src/css-variables.ts +21 -3
  57. package/src/embed/base.ts +35 -32
  58. package/src/tokenizedFetch.ts +5 -1
  59. package/src/types.ts +80 -8
  60. package/src/utils/authService/authService.spec.ts +3 -1
  61. package/src/utils.ts +3 -0
@@ -587,21 +587,22 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
587
587
  /**
588
588
  * Imports TML representation of the metadata objects into ThoughtSpot.
589
589
  * @param data
590
+ * @returns imports TML data into ThoughtSpot
590
591
  * @example
591
592
  * ```js
592
- * executeTML({
593
- * //Array of metadata Tmls
594
- metadata_tmls: [
595
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
596
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
597
- ],
598
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
599
- create_new: false, // If selected, creates TML objects with new GUIDs.
600
- }).then(result => {
601
- console.log(result);
602
- }).catch(error => {
603
- console.error(error);
604
- });
593
+ * executeTML({
594
+ * //Array of metadata Tmls in string format
595
+ * metadata_tmls: [
596
+ * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
597
+ * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
598
+ * ],
599
+ * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
600
+ * create_new: false, // If selected, creates TML objects with new GUIDs.
601
+ * }).then(result => {
602
+ * console.log(result);
603
+ * }).catch(error => {
604
+ * console.error(error);
605
+ * });
605
606
  *```
606
607
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
607
608
  * @group Global methods
@@ -611,27 +612,28 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
611
612
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
612
613
  * format.
613
614
  * @param data
615
+ * @returns exports TML data
614
616
  * @example
615
617
  * ```js
616
- exportTML({
617
- metadata: [
618
- {
619
- type: "LIVEBOARD", //Metadata Type
620
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
621
- }
622
- ],
623
- export_associated: false,//indicates whether to export associated metadata objects
624
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
625
- //exporting a Liveboard and its associated objects, the API
626
- //returns the Liveboard TML data with the FQNs of the referenced
627
- //worksheet. If the exported TML data includes FQNs, you don't need
628
- //to manually add FQNs of the referenced objects during TML import.
629
- edoc_format: "JSON" //It takes JSON or YAML value
630
- }).then(result => {
631
- console.log(result);
632
- }).catch(error => {
633
- console.error(error);
634
- });
618
+ * exportTML({
619
+ * metadata: [
620
+ * {
621
+ * type: "LIVEBOARD", //Metadata Type
622
+ * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
623
+ * }
624
+ * ],
625
+ * export_associated: false,//indicates whether to export associated metadata objects
626
+ * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
627
+ * //exporting a Liveboard and its associated objects, the API
628
+ * //returns the Liveboard TML data with the FQNs of the referenced
629
+ * //worksheet. If the exported TML data includes FQNs, you don't need
630
+ * //to manually add FQNs of the referenced objects during TML import.
631
+ * edoc_format: "JSON" //It takes JSON or YAML value
632
+ * }).then(result => {
633
+ * console.log(result);
634
+ * }).catch(error => {
635
+ * console.error(error);
636
+ * });
635
637
  * ```
636
638
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
637
639
  * @group Global methods
@@ -1875,6 +1877,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1875
1877
  * Styles within the {@link CustomisationsInterface}.
1876
1878
  */
1877
1879
  export interface CustomStyles {
1880
+ customCSSUrl?: string;
1878
1881
  customCSS?: customCssInterface;
1879
1882
  }
1880
1883
  /**
@@ -2308,11 +2311,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2308
2311
  */
2309
2312
  visibleActions?: Action[];
2310
2313
  /**
2311
- * Show alert messages and toast messages in the embedded view.
2314
+ * Show alert messages and toast messages in the embedded
2315
+ * view in full app embed.
2312
2316
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
2313
2317
  * @example
2314
2318
  * ```js
2315
- * const embed = new LiveboardEmbed('#embed-container', {
2319
+ * const embed = new AppEmbed('#embed-container', {
2316
2320
  * ... // other options
2317
2321
  * showAlerts:true,
2318
2322
  * })
@@ -2842,6 +2846,28 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2842
2846
  * console.log('Drilldown event', drilldown);
2843
2847
  * }));
2844
2848
  * ```
2849
+ *
2850
+ * If you are using React components for embedding, you can register to any
2851
+ * events from the `EmbedEvent` list by using the `on<EventName>` convention.
2852
+ * For example,`onAlert`, `onCopyToClipboard` and so on.
2853
+ *
2854
+ * @example
2855
+ * ```js
2856
+ * // ...
2857
+ * const MyComponent = ({ dataSources }) => {
2858
+ * const onLoad = () => {
2859
+ * console.log(EmbedEvent.Load, {});
2860
+ * };
2861
+ *
2862
+ * return (
2863
+ * <SearchEmbed
2864
+ * dataSources={dataSources}
2865
+ * onLoad = {logEvent("Load")}
2866
+ * />
2867
+ * );
2868
+ * };
2869
+ * ```
2870
+ *
2845
2871
  * @group Events
2846
2872
  */
2847
2873
  export enum EmbedEvent {
@@ -3716,8 +3742,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3716
3742
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
3717
3743
  * for this embed event to get emitted.
3718
3744
  *
3719
- * Parameter: payload
3720
- * Parameter: responder
3745
+ * @param: payload
3746
+ * @param: responder
3721
3747
  * Contains elements that lets developers define whether ThoughtSpot
3722
3748
  * will run the search or not, and if not, which error message to provide.
3723
3749
  *
@@ -3729,6 +3755,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3729
3755
  *
3730
3756
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
3731
3757
  *
3758
+ * @example
3732
3759
  *```js
3733
3760
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
3734
3761
  * (payload, responder) => {
@@ -3764,7 +3791,6 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3764
3791
  * }})
3765
3792
  * })
3766
3793
  *```
3767
- *
3768
3794
  */
3769
3795
  OnBeforeGetVizDataIntercept = "onBeforeGetVizDataIntercept",
3770
3796
  /**
@@ -3782,7 +3808,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3782
3808
  }
3783
3809
  /**
3784
3810
  * Event types that can be triggered by the host application
3785
- * to the embedded ThoughtSpot app
3811
+ * to the embedded ThoughtSpot app.
3786
3812
  *
3787
3813
  * To trigger an event use the corresponding
3788
3814
  * {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
@@ -3799,6 +3825,40 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3799
3825
  * { columnName: 'state, operator: RuntimeFilterOp.EQ, values: ['california']}
3800
3826
  * ]);
3801
3827
  * ```
3828
+ * @example
3829
+ * If using React components to embed, use the format shown in this example:
3830
+ *
3831
+ * ```js
3832
+ * const selectVizs = () => {
3833
+ * embedRef.current.trigger(HostEvent.SetVisibleVizs, [
3834
+ * "715e4613-c891-4884-be44-aa8d13701c06",
3835
+ * "3f84d633-e325-44b2-be25-c6650e5a49cf"
3836
+ * ]);
3837
+ * };
3838
+ * ```
3839
+ *
3840
+ *
3841
+ * You can also attach an Embed event to a Host event to trigger
3842
+ * a specific action as shown in this example:
3843
+ *
3844
+ * @example
3845
+ * ```js
3846
+ * const EmbeddedComponent = () => {
3847
+ * const embedRef = useRef(null); // import { useRef } from react
3848
+ * const onLiveboardRendered = () => {
3849
+ * embedRef.current.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
3850
+ * };
3851
+ *
3852
+ * return (
3853
+ * <LiveboardEmbed
3854
+ * ref={embedRef}
3855
+ * liveboardId="<liveboard-guid>"
3856
+ * onLiveboardRendered={onLiveboardRendered}
3857
+ * />
3858
+ * );
3859
+ * }
3860
+ * ```
3861
+ *
3802
3862
  * @group Events
3803
3863
  */
3804
3864
  export enum HostEvent {
@@ -4492,10 +4552,23 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4492
4552
  * filter: {
4493
4553
  * column: "item type",
4494
4554
  * oper: "IN",
4495
- * values: ["bags","shirts"],
4555
+ * values: ["bags","shirts"]
4556
+ * }
4557
+ * });
4558
+ * ```
4559
+ * @example
4560
+ * ```js
4561
+ *
4562
+ * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
4563
+ * filter: {
4564
+ * column: "date",
4565
+ * oper: "EQ",
4566
+ * values: ["JULY","2023"],
4567
+ * type: "MONTH_YEAR"
4496
4568
  * }
4497
4569
  * });
4498
4570
  * ```
4571
+ *
4499
4572
  * @example
4500
4573
  *
4501
4574
  * ```js
@@ -4513,7 +4586,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4513
4586
  * {
4514
4587
  * column: "Date",
4515
4588
  * oper: 'EQ',
4516
- * values: ["1656680400"]
4589
+ * values: ["2023-07-31"],
4590
+ * types: "EXACT_DATE"
4517
4591
  * }]
4518
4592
  * });
4519
4593
  * ```
@@ -5956,9 +6030,12 @@ declare module '@thoughtspot/visual-embed-sdk/css-variables' {
5956
6030
  */
5957
6031
  '--ts-var-root-text-transform'?: string;
5958
6032
  /**
5959
- * application color, it replaces #2770EF which is rd-color(blue,base) and
5960
- * its similar colors like rd-color(blue,60), rd-color(accent, base) and
5961
- * rd-color(text, accent) in the app.
6033
+ * Font color of the text on toggle buttons such as
6034
+ * **All**, **Answers**, and **Liveboards** on the Home page (Classic experience),
6035
+ * the text color of the chart and table tiles on Home page (New modular Homepage experience),
6036
+ * and title text on the AI-generated charts and tables.
6037
+ * The default color code is #2770EF.
6038
+ *
5962
6039
  */
5963
6040
  '--ts-var-application-color'?: string;
5964
6041
  /**
@@ -6069,6 +6146,10 @@ declare module '@thoughtspot/visual-embed-sdk/css-variables' {
6069
6146
  * Background color of the primary buttons on hover.
6070
6147
  */
6071
6148
  '--ts-var-button--primary--hover-background'?: string;
6149
+ /**
6150
+ * Backgroud color of the primary buttons when active.
6151
+ */
6152
+ '--ts-var-button--primary--active-background'?: string;
6072
6153
  /**
6073
6154
  * Font color of the text on the secondary buttons.
6074
6155
  */
@@ -6085,6 +6166,10 @@ declare module '@thoughtspot/visual-embed-sdk/css-variables' {
6085
6166
  * Background color of the secondary button on hover.
6086
6167
  */
6087
6168
  '--ts-var-button--secondary--hover-background'?: string;
6169
+ /**
6170
+ * Backgroud color of the secondary buttons when active.
6171
+ */
6172
+ '--ts-var-button--secondary--active-background'?: string;
6088
6173
  /**
6089
6174
  * Font color of the tertiary button. For example, the *Undo*, *Redo*, and *Reset*
6090
6175
  * buttons on the *Search* page.
@@ -6098,6 +6183,10 @@ declare module '@thoughtspot/visual-embed-sdk/css-variables' {
6098
6183
  * Background color of the tertiary button when a user hovers over these buttons.
6099
6184
  */
6100
6185
  '--ts-var-button--tertiary--hover-background'?: string;
6186
+ /**
6187
+ * Backgroud color of the tertiary buttons when active.
6188
+ */
6189
+ '--ts-var-button--tertiary--active-background'?: string;
6101
6190
  /**
6102
6191
  * Font color of the title text of a visualization or Answer.
6103
6192
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.32.7",
3
+ "version": "1.32.9",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -38,7 +38,7 @@
38
38
  "size-limit": [
39
39
  {
40
40
  "path": "dist/tsembed.js",
41
- "limit": "48 kB"
41
+ "limit": "49 kB"
42
42
  }
43
43
  ],
44
44
  "scripts": {
@@ -77,7 +77,7 @@
77
77
  "gatsby-plugin-vercel": "^1.0.3",
78
78
  "html-react-parser": "^1.4.12",
79
79
  "lodash": "^4.17.21",
80
- "mixpanel-browser": "^2.45.0",
80
+ "mixpanel-browser": "2.47.0",
81
81
  "ts-deepmerge": "^6.0.2",
82
82
  "tslib": "^2.5.3",
83
83
  "use-deep-compare-effect": "^1.8.1"
@@ -24,9 +24,12 @@ export interface CustomCssVariables {
24
24
  '--ts-var-root-text-transform'?: string;
25
25
 
26
26
  /**
27
- * application color, it replaces #2770EF which is rd-color(blue,base) and
28
- * its similar colors like rd-color(blue,60), rd-color(accent, base) and
29
- * rd-color(text, accent) in the app.
27
+ * Font color of the text on toggle buttons such as
28
+ * **All**, **Answers**, and **Liveboards** on the Home page (Classic experience),
29
+ * the text color of the chart and table tiles on Home page (New modular Homepage experience),
30
+ * and title text on the AI-generated charts and tables.
31
+ * The default color code is #2770EF.
32
+ *
30
33
  */
31
34
  '--ts-var-application-color'?: string;
32
35
 
@@ -163,6 +166,11 @@ export interface CustomCssVariables {
163
166
  */
164
167
  '--ts-var-button--primary--hover-background'?: string;
165
168
 
169
+ /**
170
+ * Backgroud color of the primary buttons when active.
171
+ */
172
+ '--ts-var-button--primary--active-background'?: string;
173
+
166
174
  /**
167
175
  * Font color of the text on the secondary buttons.
168
176
  */
@@ -183,6 +191,11 @@ export interface CustomCssVariables {
183
191
  */
184
192
  '--ts-var-button--secondary--hover-background'?: string;
185
193
 
194
+ /**
195
+ * Backgroud color of the secondary buttons when active.
196
+ */
197
+ '--ts-var-button--secondary--active-background'?: string;
198
+
186
199
  /**
187
200
  * Font color of the tertiary button. For example, the *Undo*, *Redo*, and *Reset*
188
201
  * buttons on the *Search* page.
@@ -199,6 +212,11 @@ export interface CustomCssVariables {
199
212
  */
200
213
  '--ts-var-button--tertiary--hover-background'?: string;
201
214
 
215
+ /**
216
+ * Backgroud color of the tertiary buttons when active.
217
+ */
218
+ '--ts-var-button--tertiary--active-background'?: string;
219
+
202
220
  /**
203
221
  * Font color of the title text of a visualization or Answer.
204
222
  */
package/src/embed/base.ts CHANGED
@@ -198,6 +198,7 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
198
198
  const { password, ...configToTrack } = getEmbedConfig();
199
199
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
200
200
  ...configToTrack,
201
+ usedCustomizationSheet: embedConfig.customizations?.style?.customCSSUrl != null,
201
202
  usedCustomizationVariables: embedConfig.customizations?.style?.customCSS?.variables != null,
202
203
  usedCustomizationRules:
203
204
  embedConfig.customizations?.style?.customCSS?.rules_UNSTABLE != null,
@@ -259,21 +260,22 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
259
260
  /**
260
261
  * Imports TML representation of the metadata objects into ThoughtSpot.
261
262
  * @param data
263
+ * @returns imports TML data into ThoughtSpot
262
264
  * @example
263
265
  * ```js
264
- * executeTML({
265
- * //Array of metadata Tmls
266
- metadata_tmls: [
267
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
268
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
269
- ],
270
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
271
- create_new: false, // If selected, creates TML objects with new GUIDs.
272
- }).then(result => {
273
- console.log(result);
274
- }).catch(error => {
275
- console.error(error);
276
- });
266
+ * executeTML({
267
+ * //Array of metadata Tmls in string format
268
+ * metadata_tmls: [
269
+ * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
270
+ * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
271
+ * ],
272
+ * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
273
+ * create_new: false, // If selected, creates TML objects with new GUIDs.
274
+ * }).then(result => {
275
+ * console.log(result);
276
+ * }).catch(error => {
277
+ * console.error(error);
278
+ * });
277
279
  *```
278
280
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
279
281
  * @group Global methods
@@ -319,27 +321,28 @@ export const executeTML = async (data: executeTMLInput): Promise<any> => {
319
321
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
320
322
  * format.
321
323
  * @param data
324
+ * @returns exports TML data
322
325
  * @example
323
326
  * ```js
324
- exportTML({
325
- metadata: [
326
- {
327
- type: "LIVEBOARD", //Metadata Type
328
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
329
- }
330
- ],
331
- export_associated: false,//indicates whether to export associated metadata objects
332
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
333
- //exporting a Liveboard and its associated objects, the API
334
- //returns the Liveboard TML data with the FQNs of the referenced
335
- //worksheet. If the exported TML data includes FQNs, you don't need
336
- //to manually add FQNs of the referenced objects during TML import.
337
- edoc_format: "JSON" //It takes JSON or YAML value
338
- }).then(result => {
339
- console.log(result);
340
- }).catch(error => {
341
- console.error(error);
342
- });
327
+ * exportTML({
328
+ * metadata: [
329
+ * {
330
+ * type: "LIVEBOARD", //Metadata Type
331
+ * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
332
+ * }
333
+ * ],
334
+ * export_associated: false,//indicates whether to export associated metadata objects
335
+ * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
336
+ * //exporting a Liveboard and its associated objects, the API
337
+ * //returns the Liveboard TML data with the FQNs of the referenced
338
+ * //worksheet. If the exported TML data includes FQNs, you don't need
339
+ * //to manually add FQNs of the referenced objects during TML import.
340
+ * edoc_format: "JSON" //It takes JSON or YAML value
341
+ * }).then(result => {
342
+ * console.log(result);
343
+ * }).catch(error => {
344
+ * console.error(error);
345
+ * });
343
346
  * ```
344
347
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
345
348
  * @group Global methods
@@ -22,7 +22,11 @@ import { AuthType } from './types';
22
22
  export const tokenizedFetch: typeof fetch = async (input, init): Promise<Response> => {
23
23
  const embedConfig = getEmbedConfig();
24
24
  if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
25
- return fetch(input, init);
25
+ return fetch(input, {
26
+ // ensure cookies are included for the non cookie-less api calls.
27
+ credentials: 'include',
28
+ ...init,
29
+ });
26
30
  }
27
31
 
28
32
  const req = new Request(input, init);
package/src/types.ts CHANGED
@@ -255,6 +255,7 @@ export interface customCssInterface {
255
255
  * Styles within the {@link CustomisationsInterface}.
256
256
  */
257
257
  export interface CustomStyles {
258
+ customCSSUrl?: string;
258
259
  customCSS?: customCssInterface;
259
260
  }
260
261
 
@@ -714,11 +715,12 @@ export interface ViewConfig {
714
715
  */
715
716
  visibleActions?: Action[];
716
717
  /**
717
- * Show alert messages and toast messages in the embedded view.
718
+ * Show alert messages and toast messages in the embedded
719
+ * view in full app embed.
718
720
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
719
721
  * @example
720
722
  * ```js
721
- * const embed = new LiveboardEmbed('#embed-container', {
723
+ * const embed = new AppEmbed('#embed-container', {
722
724
  * ... // other options
723
725
  * showAlerts:true,
724
726
  * })
@@ -1264,6 +1266,28 @@ export interface RuntimeParameter {
1264
1266
  * console.log('Drilldown event', drilldown);
1265
1267
  * }));
1266
1268
  * ```
1269
+ *
1270
+ * If you are using React components for embedding, you can register to any
1271
+ * events from the `EmbedEvent` list by using the `on<EventName>` convention.
1272
+ * For example,`onAlert`, `onCopyToClipboard` and so on.
1273
+ *
1274
+ * @example
1275
+ * ```js
1276
+ * // ...
1277
+ * const MyComponent = ({ dataSources }) => {
1278
+ * const onLoad = () => {
1279
+ * console.log(EmbedEvent.Load, {});
1280
+ * };
1281
+ *
1282
+ * return (
1283
+ * <SearchEmbed
1284
+ * dataSources={dataSources}
1285
+ * onLoad = {logEvent("Load")}
1286
+ * />
1287
+ * );
1288
+ * };
1289
+ * ```
1290
+ *
1267
1291
  * @group Events
1268
1292
  */
1269
1293
  // eslint-disable-next-line no-shadow
@@ -2139,8 +2163,8 @@ export enum EmbedEvent {
2139
2163
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
2140
2164
  * for this embed event to get emitted.
2141
2165
  *
2142
- * Parameter: payload
2143
- * Parameter: responder
2166
+ * @param: payload
2167
+ * @param: responder
2144
2168
  * Contains elements that lets developers define whether ThoughtSpot
2145
2169
  * will run the search or not, and if not, which error message to provide.
2146
2170
  *
@@ -2152,6 +2176,7 @@ export enum EmbedEvent {
2152
2176
  *
2153
2177
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
2154
2178
  *
2179
+ * @example
2155
2180
  *```js
2156
2181
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
2157
2182
  * (payload, responder) => {
@@ -2187,7 +2212,6 @@ export enum EmbedEvent {
2187
2212
  * }})
2188
2213
  * })
2189
2214
  *```
2190
- *
2191
2215
  */
2192
2216
  OnBeforeGetVizDataIntercept = 'onBeforeGetVizDataIntercept',
2193
2217
  /**
@@ -2206,7 +2230,7 @@ export enum EmbedEvent {
2206
2230
 
2207
2231
  /**
2208
2232
  * Event types that can be triggered by the host application
2209
- * to the embedded ThoughtSpot app
2233
+ * to the embedded ThoughtSpot app.
2210
2234
  *
2211
2235
  * To trigger an event use the corresponding
2212
2236
  * {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
@@ -2223,6 +2247,40 @@ export enum EmbedEvent {
2223
2247
  * { columnName: 'state, operator: RuntimeFilterOp.EQ, values: ['california']}
2224
2248
  * ]);
2225
2249
  * ```
2250
+ * @example
2251
+ * If using React components to embed, use the format shown in this example:
2252
+ *
2253
+ * ```js
2254
+ * const selectVizs = () => {
2255
+ * embedRef.current.trigger(HostEvent.SetVisibleVizs, [
2256
+ * "715e4613-c891-4884-be44-aa8d13701c06",
2257
+ * "3f84d633-e325-44b2-be25-c6650e5a49cf"
2258
+ * ]);
2259
+ * };
2260
+ * ```
2261
+ *
2262
+ *
2263
+ * You can also attach an Embed event to a Host event to trigger
2264
+ * a specific action as shown in this example:
2265
+ *
2266
+ * @example
2267
+ * ```js
2268
+ * const EmbeddedComponent = () => {
2269
+ * const embedRef = useRef(null); // import { useRef } from react
2270
+ * const onLiveboardRendered = () => {
2271
+ * embedRef.current.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
2272
+ * };
2273
+ *
2274
+ * return (
2275
+ * <LiveboardEmbed
2276
+ * ref={embedRef}
2277
+ * liveboardId="<liveboard-guid>"
2278
+ * onLiveboardRendered={onLiveboardRendered}
2279
+ * />
2280
+ * );
2281
+ * }
2282
+ * ```
2283
+ *
2226
2284
  * @group Events
2227
2285
  */
2228
2286
  // eslint-disable-next-line no-shadow
@@ -2917,11 +2975,24 @@ export enum HostEvent {
2917
2975
  * filter: {
2918
2976
  * column: "item type",
2919
2977
  * oper: "IN",
2920
- * values: ["bags","shirts"],
2978
+ * values: ["bags","shirts"]
2921
2979
  * }
2922
2980
  * });
2923
2981
  * ```
2924
2982
  * @example
2983
+ * ```js
2984
+ *
2985
+ * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
2986
+ * filter: {
2987
+ * column: "date",
2988
+ * oper: "EQ",
2989
+ * values: ["JULY","2023"],
2990
+ * type: "MONTH_YEAR"
2991
+ * }
2992
+ * });
2993
+ * ```
2994
+ *
2995
+ * @example
2925
2996
  *
2926
2997
  * ```js
2927
2998
  * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
@@ -2938,7 +3009,8 @@ export enum HostEvent {
2938
3009
  * {
2939
3010
  * column: "Date",
2940
3011
  * oper: 'EQ',
2941
- * values: ["1656680400"]
3012
+ * values: ["2023-07-31"],
3013
+ * types: "EXACT_DATE"
2942
3014
  * }]
2943
3015
  * });
2944
3016
  * ```
@@ -29,7 +29,9 @@ describe('Unit test for authService', () => {
29
29
  const response = await fetchSessionInfoService(thoughtSpotHost);
30
30
  expect(response.success).toBe(true);
31
31
  expect(fetch).toHaveBeenCalledTimes(1);
32
- expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {});
32
+ expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {
33
+ credentials: 'include',
34
+ });
33
35
  });
34
36
 
35
37
  test('fetchAuthTokenService', async () => {
package/src/utils.ts CHANGED
@@ -218,6 +218,9 @@ export const getCustomisations = (
218
218
  ...customizationsFromEmbedConfig?.style?.customCSS,
219
219
  ...customizationsFromViewConfig?.style?.customCSS,
220
220
  },
221
+ customCSSUrl:
222
+ customizationsFromViewConfig?.style?.customCSSUrl
223
+ || customizationsFromEmbedConfig?.style?.customCSSUrl,
221
224
  },
222
225
  content: {
223
226
  ...customizationsFromEmbedConfig?.content,