@thoughtspot/visual-embed-sdk 1.39.3 → 1.40.1-alpha.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 (93) hide show
  1. package/cjs/src/embed/app.d.ts +56 -0
  2. package/cjs/src/embed/app.d.ts.map +1 -1
  3. package/cjs/src/embed/app.js +47 -8
  4. package/cjs/src/embed/app.js.map +1 -1
  5. package/cjs/src/embed/app.spec.js +322 -7
  6. package/cjs/src/embed/app.spec.js.map +1 -1
  7. package/cjs/src/embed/liveboard.d.ts +58 -1
  8. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  9. package/cjs/src/embed/liveboard.js +59 -8
  10. package/cjs/src/embed/liveboard.js.map +1 -1
  11. package/cjs/src/embed/liveboard.spec.js +206 -0
  12. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  13. package/cjs/src/embed/ts-embed.d.ts +7 -0
  14. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  15. package/cjs/src/embed/ts-embed.js +61 -7
  16. package/cjs/src/embed/ts-embed.js.map +1 -1
  17. package/cjs/src/types.d.ts +37 -6
  18. package/cjs/src/types.d.ts.map +1 -1
  19. package/cjs/src/types.js +35 -4
  20. package/cjs/src/types.js.map +1 -1
  21. package/cjs/src/utils/processTrigger.js +2 -1
  22. package/cjs/src/utils/processTrigger.js.map +1 -1
  23. package/cjs/src/utils.d.ts +6 -0
  24. package/cjs/src/utils.d.ts.map +1 -1
  25. package/cjs/src/utils.js +23 -3
  26. package/cjs/src/utils.js.map +1 -1
  27. package/cjs/src/utils.spec.js +212 -1
  28. package/cjs/src/utils.spec.js.map +1 -1
  29. package/dist/{index-ZrE8YYq8.js → index-CmEQfuE3.js} +1 -1
  30. package/dist/index-D1pyb7RG.js +7371 -0
  31. package/dist/index-DeFzsyFF.js +7371 -0
  32. package/dist/index-Dpf0rd6w.js +7371 -0
  33. package/dist/index-UuEbsISo.js +7447 -0
  34. package/dist/index-e3Uw3YFO.js +7371 -0
  35. package/dist/src/embed/app.d.ts +56 -0
  36. package/dist/src/embed/app.d.ts.map +1 -1
  37. package/dist/src/embed/bodyless-conversation.d.ts +0 -4
  38. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  39. package/dist/src/embed/liveboard.d.ts +56 -0
  40. package/dist/src/embed/liveboard.d.ts.map +1 -1
  41. package/dist/src/react/index.d.ts +0 -2
  42. package/dist/src/react/index.d.ts.map +1 -1
  43. package/dist/src/types.d.ts +16 -198
  44. package/dist/src/types.d.ts.map +1 -1
  45. package/dist/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
  46. package/dist/src/utils.d.ts +6 -0
  47. package/dist/src/utils.d.ts.map +1 -1
  48. package/dist/tsembed-react.es.js +137 -224
  49. package/dist/tsembed-react.js +136 -223
  50. package/dist/tsembed.es.js +137 -224
  51. package/dist/tsembed.js +136 -223
  52. package/dist/visual-embed-sdk-react-full.d.ts +106 -204
  53. package/dist/visual-embed-sdk-react.d.ts +106 -204
  54. package/dist/visual-embed-sdk.d.ts +106 -202
  55. package/lib/src/embed/app.d.ts +56 -0
  56. package/lib/src/embed/app.d.ts.map +1 -1
  57. package/lib/src/embed/app.js +48 -9
  58. package/lib/src/embed/app.js.map +1 -1
  59. package/lib/src/embed/app.spec.js +322 -7
  60. package/lib/src/embed/app.spec.js.map +1 -1
  61. package/lib/src/embed/liveboard.d.ts +58 -1
  62. package/lib/src/embed/liveboard.d.ts.map +1 -1
  63. package/lib/src/embed/liveboard.js +60 -9
  64. package/lib/src/embed/liveboard.js.map +1 -1
  65. package/lib/src/embed/liveboard.spec.js +206 -0
  66. package/lib/src/embed/liveboard.spec.js.map +1 -1
  67. package/lib/src/embed/ts-embed.d.ts +7 -0
  68. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  69. package/lib/src/embed/ts-embed.js +61 -7
  70. package/lib/src/embed/ts-embed.js.map +1 -1
  71. package/lib/src/types.d.ts +37 -6
  72. package/lib/src/types.d.ts.map +1 -1
  73. package/lib/src/types.js +35 -4
  74. package/lib/src/types.js.map +1 -1
  75. package/lib/src/utils/processTrigger.js +2 -1
  76. package/lib/src/utils/processTrigger.js.map +1 -1
  77. package/lib/src/utils.d.ts +6 -0
  78. package/lib/src/utils.d.ts.map +1 -1
  79. package/lib/src/utils.js +21 -2
  80. package/lib/src/utils.js.map +1 -1
  81. package/lib/src/utils.spec.js +213 -2
  82. package/lib/src/utils.spec.js.map +1 -1
  83. package/lib/src/visual-embed-sdk.d.ts +106 -202
  84. package/package.json +1 -2
  85. package/src/embed/app.spec.ts +397 -8
  86. package/src/embed/app.ts +106 -12
  87. package/src/embed/liveboard.spec.ts +254 -1
  88. package/src/embed/liveboard.ts +109 -11
  89. package/src/embed/ts-embed.ts +84 -21
  90. package/src/types.ts +36 -5
  91. package/src/utils/processTrigger.ts +1 -1
  92. package/src/utils.spec.ts +250 -2
  93. package/src/utils.ts +28 -2
package/dist/tsembed.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.39.3 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.39.2-alpha.3 */
2
2
  'use client';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -284,7 +284,6 @@
284
284
  function removeTypename(obj) {
285
285
  if (!obj || typeof obj !== 'object')
286
286
  return obj;
287
- // eslint-disable-next-line no-restricted-syntax
288
287
  for (const key in obj) {
289
288
  if (key === '__typename') {
290
289
  delete obj[key];
@@ -313,7 +312,11 @@
313
312
  if (!(element === null || element === void 0 ? void 0 : element.style))
314
313
  return;
315
314
  Object.keys(styleProperties).forEach((styleProperty) => {
316
- element.style[styleProperty] = styleProperties[styleProperty].toString();
315
+ const styleKey = styleProperty;
316
+ const value = styleProperties[styleKey];
317
+ if (value !== undefined) {
318
+ element.style[styleKey] = value.toString();
319
+ }
317
320
  });
318
321
  };
319
322
  /**
@@ -441,6 +444,22 @@
441
444
  }
442
445
  }
443
446
  logger$3.warn('Exit fullscreen API is not supported by this browser.');
447
+ };
448
+ const calculateVisibleElementData = (element) => {
449
+ const rect = element.getBoundingClientRect();
450
+ const windowHeight = window.innerHeight;
451
+ const windowWidth = window.innerWidth;
452
+ const frameRelativeTop = Math.max(rect.top, 0);
453
+ const frameRelativeLeft = Math.max(rect.left, 0);
454
+ const frameRelativeBottom = Math.min(windowHeight, rect.bottom);
455
+ const frameRelativeRight = Math.min(windowWidth, rect.right);
456
+ const data = {
457
+ top: Math.max(0, rect.top * -1),
458
+ height: Math.max(0, frameRelativeBottom - frameRelativeTop),
459
+ left: Math.max(0, rect.left * -1),
460
+ width: Math.max(0, frameRelativeRight - frameRelativeLeft),
461
+ };
462
+ return data;
444
463
  };
445
464
 
446
465
  /**
@@ -1852,82 +1871,11 @@
1852
1871
  */
1853
1872
  EmbedEvent["ExitPresentMode"] = "exitPresentMode";
1854
1873
  /**
1855
- * Emitted when spotter response is text data
1856
- * @example
1857
- * ```js
1858
- * spotterEmbed.on(EmbedEvent.SpotterData, (payload) => {
1859
- * console.log('payload', payload);
1860
- * })
1861
- *```
1862
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1863
- */
1864
- EmbedEvent["SpotterData"] = "SpotterData";
1865
- /**
1866
- * Emitted when user opens up the worksheet preview modal in spotter embed.
1867
- * @example
1868
- * ```js
1869
- * spotterEmbed.on(EmbedEvent.PreviewSpotterData, (payload) => {
1870
- * console.log('payload', payload);
1871
- * })
1872
- *```
1873
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1874
- */
1875
- EmbedEvent["PreviewSpotterData"] = "PreviewSpotterData";
1876
- /**
1877
- * Emitted when the spotter query is triggered in spotter embed.
1878
- * @example
1879
- * ```js
1880
- * spotterEmbed.on(EmbedEvent.SpotterQueryTriggered, (payload) => {
1881
- * console.log('payload', payload);
1882
- * })
1883
- *```
1884
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1885
- */
1886
- EmbedEvent["SpotterQueryTriggered"] = "SpotterQueryTriggered";
1887
- /**
1888
- * Emitted when the last spotter query is edited in spotter embed.
1889
- * @example
1890
- * ```js
1891
- * spotterEmbed.on(EmbedEvent.LastPromptEdited, (payload) => {
1892
- * console.log('payload', payload);
1893
- * })
1894
- *```
1895
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1896
- */
1897
- EmbedEvent["LastPromptEdited"] = "LastPromptEdited";
1898
- /**
1899
- * Emitted when the last spotter query is deleted in spotter embed.
1900
- * @example
1901
- * ```js
1902
- * spotterEmbed.on(EmbedEvent.LastPromptDeleted, (payload) => {
1903
- * console.log('payload', payload);
1904
- * })
1905
- *```
1906
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1907
- */
1908
- EmbedEvent["LastPromptDeleted"] = "LastPromptDeleted";
1909
- /**
1910
- * Emitted when the coversation is reset in spotter embed.
1911
- * @example
1912
- * ```js
1913
- * spotterEmbed.on(EmbedEvent.ResetSpotterConversation, (payload) => {
1914
- * console.log('payload', payload);
1915
- * })
1916
- *```
1917
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1918
- */
1919
- EmbedEvent["ResetSpotterConversation"] = "ResetSpotterConversation";
1920
- /**
1921
- * Emitted when the *Spotter* is initialized.
1922
- * @example
1923
- * ```js
1924
- * spotterEmbed.on(EmbedEvent.SpotterInit, (payload) => {
1925
- * console.log('payload', payload);
1926
- * })
1927
- *```
1928
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1874
+ * Emitted when a user requests the full height lazy load data.
1875
+ * @version SDK : 1.39.0 | ThoughtSpot : 10.10.0.cl
1876
+ * @hidden
1929
1877
  */
1930
- EmbedEvent["SpotterInit"] = "SpotterInit";
1878
+ EmbedEvent["RequestVisibleEmbedCoordinates"] = "requestVisibleEmbedCoordinates";
1931
1879
  })(exports.EmbedEvent || (exports.EmbedEvent = {}));
1932
1880
  /**
1933
1881
  * Event types that can be triggered by the host application
@@ -2218,7 +2166,6 @@
2218
2166
  * @param
2219
2167
  * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2220
2168
  * Optional when pinning a new chart or table generated from a Search query.
2221
- * **Required** in Spotter Embed.
2222
2169
  * @param
2223
2170
  * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
2224
2171
  * specify the `newLiveboardName` parameter to create a new Liveboard.
@@ -2266,12 +2213,6 @@
2266
2213
  * ```js
2267
2214
  * appEmbed.trigger(HostEvent.Pin)
2268
2215
  * ```
2269
- * @example
2270
- * ```js
2271
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Pin, {
2272
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2273
- * });
2274
- * ```
2275
2216
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2276
2217
  */
2277
2218
  HostEvent["Pin"] = "pin";
@@ -2365,12 +2306,6 @@
2365
2306
  * ```js
2366
2307
  * searchEmbed.trigger(HostEvent.MakeACopy)
2367
2308
  * ```
2368
- * @example
2369
- * ```js
2370
- * const pinResponse = await spotterEmbed.trigger(HostEvent.MakeACopy, {
2371
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2372
- * });
2373
- * ```
2374
2309
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2375
2310
  */
2376
2311
  HostEvent["MakeACopy"] = "makeACopy";
@@ -2443,7 +2378,6 @@
2443
2378
  * This event is not supported in visualization embed and search embed.
2444
2379
  * @param - object - To trigger the action for a specific visualization
2445
2380
  * in Liveboard embed, pass in `vizId` as a key.
2446
- * **Required** in Spotter embed.
2447
2381
  * @example
2448
2382
  * ```js
2449
2383
  * liveboardEmbed.trigger(HostEvent.Edit)
@@ -2452,12 +2386,6 @@
2452
2386
  * liveboardEmbed.trigger(HostEvent.Edit, {vizId:
2453
2387
  * '730496d6-6903-4601-937e-2c691821af3c'})
2454
2388
  * ```
2455
- * @example
2456
- * ```js
2457
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2458
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2459
- * });
2460
- * ```
2461
2389
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2462
2390
  */
2463
2391
  HostEvent["Edit"] = "edit";
@@ -2505,16 +2433,6 @@
2505
2433
  * );
2506
2434
  * })
2507
2435
  * ```
2508
- * @example
2509
- * ```js
2510
- * spotterEmbed.trigger(HostEvent.GetTML, {
2511
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2512
- * }).then((tml) => {
2513
- * console.log(
2514
- * tml.answer.search_query // TML representation of the search query
2515
- * );
2516
- * })
2517
- * ```
2518
2436
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
2519
2437
  * @important
2520
2438
  */
@@ -2602,12 +2520,7 @@
2602
2520
  * vizEmbed.trigger(HostEvent.DownloadAsPng)
2603
2521
  *
2604
2522
  * searchEmbed.trigger(HostEvent.DownloadAsPng)
2605
- *
2606
- * spotterEmbed.trigger(HostEvent.DownloadAsPng, {
2607
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2608
- * })
2609
2523
  * ```
2610
- *
2611
2524
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
2612
2525
  */
2613
2526
  HostEvent["DownloadAsPng"] = "downloadAsPng";
@@ -2625,11 +2538,6 @@
2625
2538
  * ```js
2626
2539
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
2627
2540
  * ```
2628
- * ```js
2629
- * spotterEmbed.trigger(HostEvent.DownloadAsCsv, {
2630
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2631
- * })
2632
- * ```
2633
2541
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2634
2542
  */
2635
2543
  HostEvent["DownloadAsCsv"] = "downloadAsCSV";
@@ -2647,11 +2555,6 @@
2647
2555
  * ```js
2648
2556
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
2649
2557
  * ```
2650
- * ```js
2651
- * spotterEmbed.trigger(HostEvent.downloadAsXLSX, {
2652
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2653
- * })
2654
- * ```
2655
2558
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2656
2559
  */
2657
2560
  HostEvent["DownloadAsXlsx"] = "downloadAsXLSX";
@@ -2671,7 +2574,6 @@
2671
2574
  /**
2672
2575
  * Trigger the **Save** action on a Liveboard or Answer.
2673
2576
  * Saves the changes.
2674
- * @param - `vizId` is required in Spotter Embed.
2675
2577
  * @example
2676
2578
  * ```js
2677
2579
  * liveboardEmbed.trigger(HostEvent.Save)
@@ -2679,11 +2581,6 @@
2679
2581
  * ```js
2680
2582
  * searchEmbed.trigger(HostEvent.Save)
2681
2583
  * ```
2682
- * ```js
2683
- * spotterEmbed.trigger(HostEvent.Save, {
2684
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2685
- * })
2686
- * ```
2687
2584
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2688
2585
  */
2689
2586
  HostEvent["Save"] = "save";
@@ -2967,7 +2864,7 @@
2967
2864
  HostEvent["ResetLiveboardPersonalisedView"] = "ResetLiveboardPersonalisedView";
2968
2865
  /**
2969
2866
  * Triggers an action to update Parameter values on embedded
2970
- * Answers, Liveboard and Spotter answer in Edit mode.
2867
+ * Answers and Liveboard.
2971
2868
  *
2972
2869
  * @example
2973
2870
  * ```js
@@ -2986,13 +2883,6 @@
2986
2883
  * console.log('parameters', parameter);
2987
2884
  * });
2988
2885
  *```
2989
- *```js
2990
- * spotterEmbed.trigger(HostEvent.GetParameters, {
2991
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2992
- * }).then((parameter) => {
2993
- * console.log('parameters', parameter);
2994
- * });
2995
- *```
2996
2886
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
2997
2887
  */
2998
2888
  HostEvent["GetParameters"] = "GetParameters";
@@ -3060,64 +2950,6 @@
3060
2950
  * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl
3061
2951
  */
3062
2952
  HostEvent["TransformTableVizData"] = "TransformTableVizData";
3063
- /**
3064
- * Triggers a search operation with the search tokens specified in
3065
- * the search query string in spotter embed.
3066
- * @param - `queryString`: Text string in Natural Language format
3067
- * @param - `executeSearch`: Boolean to execute search and update search query
3068
- * @example
3069
- * ```js
3070
- * spotterEmbed.trigger(HostEvent.SpotterSearch, {
3071
- * query: 'revenue per year',
3072
- * executeSearch: true,
3073
- * })
3074
- * ```
3075
- */
3076
- HostEvent["SpotterSearch"] = "SpotterSearch";
3077
- /**
3078
- * Edits the last prompt in spotter embed.
3079
- * @param - `query`: Text string
3080
- * @example
3081
- * ```js
3082
- * spotterEmbed.trigger(HostEvent.EditLastPrompt, "revenue per year");
3083
- * ```
3084
- */
3085
- HostEvent["EditLastPrompt"] = "EditLastPrompt";
3086
- /**
3087
- * Opens the Worksheet preview modal in Spotter Embed.
3088
- * @example
3089
- * ```js
3090
- * spotterEmbed.trigger(HostEvent.PreviewSpotterData);
3091
- * ```
3092
- */
3093
- HostEvent["PreviewSpotterData"] = "PreviewSpotterData";
3094
- /**
3095
- * Resets the Spotter Embed Conversation.
3096
- * @example
3097
- * ```js
3098
- * spotterEmbed.trigger(HostEvent.ResetSpotterConversation);
3099
- * ```
3100
- */
3101
- HostEvent["ResetSpotterConversation"] = "ResetSpotterConversation";
3102
- /**
3103
- * Deletes the last prompt in spotter embed.
3104
- * @example
3105
- * ```js
3106
- * spotterEmbed.trigger(HostEvent.DeleteLastPrompt);
3107
- * ```
3108
- */
3109
- HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
3110
- /**
3111
- * Toggle the visualization to chart or table view.
3112
- * @param - `vizId ` In Spotter Embed, vizId is required.
3113
- * @example
3114
- * ```js
3115
- * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, {
3116
- * vizId:"'b535c760-8bbe-4e6f-bb26-af56b4129a1e'"
3117
- * });
3118
- *```
3119
- */
3120
- HostEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
3121
2953
  /**
3122
2954
  * @hidden
3123
2955
  * Trigger exit from presentation mode when user exits fullscreen.
@@ -3129,15 +2961,18 @@
3129
2961
  */
3130
2962
  HostEvent["ExitPresentMode"] = "exitPresentMode";
3131
2963
  /**
3132
- * Trigger the *Ask Sage* action for visualizations
2964
+ * Triggers the full height lazy load data.
3133
2965
  * @example
3134
2966
  * ```js
3135
- * liveboardEmbed.trigger(HostEvent.AskSpotter,
3136
- * {containerId:'730496d6-6903-4601-937e-2c691821af3c'})
2967
+ * liveboardEmbed.on(EmbedEvent.RequestVisibleEmbedCoordinates, (payload) => {
2968
+ * console.log(payload);
2969
+ * });
3137
2970
  * ```
3138
- * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
2971
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
2972
+ *
2973
+ * @hidden
3139
2974
  */
3140
- HostEvent["AskSpotter"] = "askSpotter";
2975
+ HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
3141
2976
  })(exports.HostEvent || (exports.HostEvent = {}));
3142
2977
  /**
3143
2978
  * The different visual modes that the data sources panel within
@@ -3282,6 +3117,8 @@
3282
3117
  Param["PrimaryAction"] = "primaryAction";
3283
3118
  Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
3284
3119
  Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
3120
+ Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
3121
+ Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
3285
3122
  })(Param || (Param = {}));
3286
3123
  /**
3287
3124
  * ThoughtSpot application pages include actions and menu commands
@@ -15777,7 +15614,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15777
15614
  return e;
15778
15615
  }
15779
15616
 
15780
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
15617
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.2-alpha.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
15781
15618
 
15782
15619
  /**
15783
15620
  * Reloads the ThoughtSpot iframe.
@@ -15800,7 +15637,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15800
15637
  * @param channel
15801
15638
  */
15802
15639
  function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
15803
- return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
15640
+ var _a;
15641
+ return (_a = iFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
15804
15642
  }
15805
15643
  const TRIGGER_TIMEOUT = 30000;
15806
15644
  /**
@@ -17185,7 +17023,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17185
17023
  /**
17186
17024
  * Pages within the ThoughtSpot app that can be embedded.
17187
17025
  */
17188
- // eslint-disable-next-line no-shadow
17189
17026
  exports.Page = void 0;
17190
17027
  (function (Page) {
17191
17028
  /**
@@ -17292,11 +17129,25 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17292
17129
  * @group Embed components
17293
17130
  */
17294
17131
  class AppEmbed extends V1Embed {
17295
- // eslint-disable-next-line no-useless-constructor
17296
17132
  constructor(domSelector, viewConfig) {
17297
17133
  viewConfig.embedComponentType = 'AppEmbed';
17298
17134
  super(domSelector, viewConfig);
17299
17135
  this.defaultHeight = '100%';
17136
+ this.sendFullHeightLazyLoadData = () => {
17137
+ const data = calculateVisibleElementData(this.iFrame);
17138
+ this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
17139
+ };
17140
+ /**
17141
+ * This is a handler for the RequestVisibleEmbedCoordinates event.
17142
+ * It is used to send the visible coordinates data to the host application.
17143
+ * @param data The event payload
17144
+ * @param responder The responder function
17145
+ */
17146
+ this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
17147
+ logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
17148
+ const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
17149
+ responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
17150
+ };
17300
17151
  /**
17301
17152
  * Set the iframe height as per the computed height received
17302
17153
  * from the ThoughtSpot app.
@@ -17305,6 +17156,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17305
17156
  this.updateIFrameHeight = (data) => {
17306
17157
  var _a;
17307
17158
  this.setIFrameHeight(Math.max(data.data, (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.scrollHeight));
17159
+ this.sendFullHeightLazyLoadData();
17308
17160
  };
17309
17161
  this.embedIframeCenter = (data, responder) => {
17310
17162
  const obj = this.getIframeCenter();
@@ -17334,6 +17186,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17334
17186
  this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
17335
17187
  this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
17336
17188
  this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
17189
+ this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
17337
17190
  }
17338
17191
  }
17339
17192
  /**
@@ -17341,9 +17194,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17341
17194
  * embedded Liveboard or visualization.
17342
17195
  */
17343
17196
  getEmbedParams() {
17344
- const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
17345
- /* eslint-disable-next-line max-len */
17346
- dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
17197
+ const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
17347
17198
  let params = {};
17348
17199
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
17349
17200
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -17372,6 +17223,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17372
17223
  }
17373
17224
  if (fullHeight === true) {
17374
17225
  params[Param.fullHeight] = true;
17226
+ if (this.viewConfig.lazyLoadingForFullHeight) {
17227
+ params[Param.IsLazyLoadingForEmbedEnabled] = true;
17228
+ params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
17229
+ }
17375
17230
  }
17376
17231
  if (tag) {
17377
17232
  params[Param.Tag] = tag;
@@ -17392,7 +17247,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17392
17247
  params[Param.enableAskSage] = enableAskSage;
17393
17248
  }
17394
17249
  if (isOnBeforeGetVizDataInterceptEnabled) {
17395
- /* eslint-disable-next-line max-len */
17396
17250
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
17397
17251
  }
17398
17252
  if (homePageSearchBarMode) {
@@ -17413,11 +17267,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17413
17267
  === exports.DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
17414
17268
  || dataPanelCustomGroupsAccordionInitialState
17415
17269
  === exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
17416
- /* eslint-disable-next-line max-len */
17417
17270
  params[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
17418
17271
  }
17419
17272
  else {
17420
- /* eslint-disable-next-line max-len */
17421
17273
  params[Param.DataPanelCustomGroupsAccordionInitialState] = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
17422
17274
  }
17423
17275
  if (discoveryExperience) {
@@ -17521,6 +17373,30 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17521
17373
  this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
17522
17374
  }
17523
17375
  }
17376
+ /**
17377
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
17378
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
17379
+ */
17380
+ destroy() {
17381
+ super.destroy();
17382
+ this.unregisterLazyLoadEvents();
17383
+ }
17384
+ postRender() {
17385
+ this.registerLazyLoadEvents();
17386
+ }
17387
+ registerLazyLoadEvents() {
17388
+ if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
17389
+ // TODO: Use passive: true, install modernizr to check for passive
17390
+ window.addEventListener('resize', this.sendFullHeightLazyLoadData);
17391
+ window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
17392
+ }
17393
+ }
17394
+ unregisterLazyLoadEvents() {
17395
+ if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
17396
+ window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
17397
+ window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
17398
+ }
17399
+ }
17524
17400
  /**
17525
17401
  * Renders the embedded application pages in the ThoughtSpot app.
17526
17402
  * @param renderOptions An object containing the page ID
@@ -17530,6 +17406,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17530
17406
  await super.render();
17531
17407
  const src = this.getIFrameSrc();
17532
17408
  await this.renderV1Embed(src);
17409
+ this.postRender();
17533
17410
  return this;
17534
17411
  }
17535
17412
  }
@@ -17571,7 +17448,7 @@ query GetEurekaVizSnapshots(
17571
17448
  return;
17572
17449
  }
17573
17450
  const previewStyles = `
17574
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community@32.0.2/styles/ag-grid.min.css" integrity="sha384-PvEsKa6emq5KYa9mf+Q7eYF5C2OCacYzZ+hBngp21NA4o1A9iU9smnytEmqUFbEZ" crossorigin="anonymous">
17451
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community@32.0.2/styles/ag-grid.min.css">
17575
17452
  <style id="ts-preview-style">
17576
17453
  .ts-viz-preview-loader {
17577
17454
  position: absolute;
@@ -17634,6 +17511,21 @@ query GetEurekaVizSnapshots(
17634
17511
  viewConfig.embedComponentType = 'LiveboardEmbed';
17635
17512
  super(domSelector, viewConfig);
17636
17513
  this.defaultHeight = 500;
17514
+ this.sendFullHeightLazyLoadData = () => {
17515
+ const data = calculateVisibleElementData(this.iFrame);
17516
+ this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
17517
+ };
17518
+ /**
17519
+ * This is a handler for the RequestVisibleEmbedCoordinates event.
17520
+ * It is used to send the visible coordinates data to the host application.
17521
+ * @param data The event payload
17522
+ * @param responder The responder function
17523
+ */
17524
+ this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
17525
+ logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
17526
+ const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
17527
+ responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
17528
+ };
17637
17529
  /**
17638
17530
  * Set the iframe height as per the computed height received
17639
17531
  * from the ThoughtSpot app.
@@ -17641,6 +17533,7 @@ query GetEurekaVizSnapshots(
17641
17533
  */
17642
17534
  this.updateIFrameHeight = (data) => {
17643
17535
  this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
17536
+ this.sendFullHeightLazyLoadData();
17644
17537
  };
17645
17538
  this.embedIframeCenter = (data, responder) => {
17646
17539
  const obj = this.getIframeCenter();
@@ -17674,6 +17567,7 @@ query GetEurekaVizSnapshots(
17674
17567
  this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
17675
17568
  this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
17676
17569
  this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
17570
+ this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
17677
17571
  }
17678
17572
  }
17679
17573
  /**
@@ -17688,6 +17582,10 @@ query GetEurekaVizSnapshots(
17688
17582
  || this.viewConfig.preventPinboardFilterRemoval;
17689
17583
  if (fullHeight === true) {
17690
17584
  params[Param.fullHeight] = true;
17585
+ if (this.viewConfig.lazyLoadingForFullHeight) {
17586
+ params[Param.IsLazyLoadingForEmbedEnabled] = true;
17587
+ params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
17588
+ }
17691
17589
  }
17692
17590
  if (defaultHeight) {
17693
17591
  this.defaultHeight = defaultHeight;
@@ -17843,6 +17741,30 @@ query GetEurekaVizSnapshots(
17843
17741
  }
17844
17742
  return super.trigger(messageType, dataWithVizId);
17845
17743
  }
17744
+ /**
17745
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
17746
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
17747
+ */
17748
+ destroy() {
17749
+ super.destroy();
17750
+ this.unregisterLazyLoadEvents();
17751
+ }
17752
+ postRender() {
17753
+ this.registerLazyLoadEvents();
17754
+ }
17755
+ registerLazyLoadEvents() {
17756
+ if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
17757
+ // TODO: Use passive: true, install modernizr to check for passive
17758
+ window.addEventListener('resize', this.sendFullHeightLazyLoadData);
17759
+ window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
17760
+ }
17761
+ }
17762
+ unregisterLazyLoadEvents() {
17763
+ if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
17764
+ window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
17765
+ window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
17766
+ }
17767
+ }
17846
17768
  /**
17847
17769
  * Render an embedded ThoughtSpot Liveboard or visualization
17848
17770
  * @param renderOptions An object specifying the Liveboard ID,
@@ -17853,6 +17775,7 @@ query GetEurekaVizSnapshots(
17853
17775
  const src = this.getIFrameSrc();
17854
17776
  await this.renderV1Embed(src);
17855
17777
  this.showPreviewLoader();
17778
+ this.postRender();
17856
17779
  return this;
17857
17780
  }
17858
17781
  navigateToLiveboard(liveboardId, vizId, activeTabId) {
@@ -18506,11 +18429,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
18506
18429
  return {
18507
18430
  convId: this.conversationId,
18508
18431
  messageId: responses[0].msgId,
18509
- data: {
18510
- ...data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
18511
- convId: this.conversationId,
18512
- messageId: responses[0].msgId,
18513
- },
18432
+ data: data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
18514
18433
  error: null,
18515
18434
  };
18516
18435
  }
@@ -18536,7 +18455,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
18536
18455
  }
18537
18456
  getIframeSrc() {
18538
18457
  var _a;
18539
- const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
18458
+ const { sessionId, genNo, acSessionId, acGenNo, } = this.viewConfig;
18540
18459
  const path = 'conv-assist-answer';
18541
18460
  const queryParams = this.getBaseQueryParams();
18542
18461
  queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
@@ -18551,8 +18470,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
18551
18470
  genNo,
18552
18471
  acSessionId,
18553
18472
  acGenNo,
18554
- convId,
18555
- messageId,
18556
18473
  });
18557
18474
  return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
18558
18475
  }
@@ -18596,8 +18513,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
18596
18513
  const container = document.createElement('div');
18597
18514
  const embed = new ConversationMessage(container, {
18598
18515
  ...this.viewConfig,
18599
- convId: data.convId,
18600
- messageId: data.messageId,
18601
18516
  sessionId: data.sessionId,
18602
18517
  genNo: data.genNo,
18603
18518
  acSessionId: data.stateKey.transactionId,
@@ -18618,8 +18533,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
18618
18533
  return { error };
18619
18534
  }
18620
18535
  return { data: {
18621
- convId: data.convId,
18622
- messageId: data.messageId,
18623
18536
  sessionId: data.sessionId,
18624
18537
  genNo: data.genNo,
18625
18538
  acSessionId: data.stateKey.transactionId,