@thoughtspot/visual-embed-sdk 1.49.1 → 1.49.2

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 (122) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +17 -0
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/app.d.ts.map +1 -1
  5. package/cjs/src/embed/app.js +4 -1
  6. package/cjs/src/embed/app.js.map +1 -1
  7. package/cjs/src/embed/app.spec.js +97 -0
  8. package/cjs/src/embed/app.spec.js.map +1 -1
  9. package/cjs/src/embed/conversation.d.ts +8 -0
  10. package/cjs/src/embed/conversation.d.ts.map +1 -1
  11. package/cjs/src/embed/conversation.js +2 -1
  12. package/cjs/src/embed/conversation.js.map +1 -1
  13. package/cjs/src/embed/conversation.spec.js +12 -0
  14. package/cjs/src/embed/conversation.spec.js.map +1 -1
  15. package/cjs/src/embed/events.spec.js +5 -0
  16. package/cjs/src/embed/events.spec.js.map +1 -1
  17. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  18. package/cjs/src/embed/liveboard.js +4 -1
  19. package/cjs/src/embed/liveboard.js.map +1 -1
  20. package/cjs/src/embed/liveboard.spec.js +11 -0
  21. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  22. package/cjs/src/embed/ts-embed.d.ts +38 -0
  23. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  24. package/cjs/src/embed/ts-embed.js +166 -9
  25. package/cjs/src/embed/ts-embed.js.map +1 -1
  26. package/cjs/src/embed/ts-embed.spec.js +237 -0
  27. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  28. package/cjs/src/types.d.ts +87 -4
  29. package/cjs/src/types.d.ts.map +1 -1
  30. package/cjs/src/types.js +47 -3
  31. package/cjs/src/types.js.map +1 -1
  32. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  33. package/cjs/src/utils/processTrigger.js +6 -5
  34. package/cjs/src/utils/processTrigger.js.map +1 -1
  35. package/cjs/src/utils/processTrigger.spec.js +13 -0
  36. package/cjs/src/utils/processTrigger.spec.js.map +1 -1
  37. package/cjs/src/utils.d.ts +10 -0
  38. package/cjs/src/utils.d.ts.map +1 -1
  39. package/cjs/src/utils.js +23 -1
  40. package/cjs/src/utils.js.map +1 -1
  41. package/cjs/src/utils.spec.js +48 -0
  42. package/cjs/src/utils.spec.js.map +1 -1
  43. package/dist/{index-B6Rn561t.js → index-CS7yJ2Jj.js} +1 -1
  44. package/dist/src/css-variables.d.ts +17 -0
  45. package/dist/src/css-variables.d.ts.map +1 -1
  46. package/dist/src/embed/app.d.ts.map +1 -1
  47. package/dist/src/embed/conversation.d.ts +8 -0
  48. package/dist/src/embed/conversation.d.ts.map +1 -1
  49. package/dist/src/embed/liveboard.d.ts.map +1 -1
  50. package/dist/src/embed/ts-embed.d.ts +38 -0
  51. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  52. package/dist/src/types.d.ts +87 -4
  53. package/dist/src/types.d.ts.map +1 -1
  54. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  55. package/dist/src/utils.d.ts +10 -0
  56. package/dist/src/utils.d.ts.map +1 -1
  57. package/dist/tsembed-react.es.js +253 -23
  58. package/dist/tsembed-react.js +252 -22
  59. package/dist/tsembed.es.js +253 -23
  60. package/dist/tsembed.js +252 -22
  61. package/dist/visual-embed-sdk-react-full.d.ts +148 -3
  62. package/dist/visual-embed-sdk-react.d.ts +148 -3
  63. package/dist/visual-embed-sdk.d.ts +148 -3
  64. package/lib/package.json +1 -1
  65. package/lib/src/css-variables.d.ts +17 -0
  66. package/lib/src/css-variables.d.ts.map +1 -1
  67. package/lib/src/embed/app.d.ts.map +1 -1
  68. package/lib/src/embed/app.js +4 -1
  69. package/lib/src/embed/app.js.map +1 -1
  70. package/lib/src/embed/app.spec.js +97 -0
  71. package/lib/src/embed/app.spec.js.map +1 -1
  72. package/lib/src/embed/conversation.d.ts +8 -0
  73. package/lib/src/embed/conversation.d.ts.map +1 -1
  74. package/lib/src/embed/conversation.js +2 -1
  75. package/lib/src/embed/conversation.js.map +1 -1
  76. package/lib/src/embed/conversation.spec.js +12 -0
  77. package/lib/src/embed/conversation.spec.js.map +1 -1
  78. package/lib/src/embed/events.spec.js +5 -0
  79. package/lib/src/embed/events.spec.js.map +1 -1
  80. package/lib/src/embed/liveboard.d.ts.map +1 -1
  81. package/lib/src/embed/liveboard.js +4 -1
  82. package/lib/src/embed/liveboard.js.map +1 -1
  83. package/lib/src/embed/liveboard.spec.js +11 -0
  84. package/lib/src/embed/liveboard.spec.js.map +1 -1
  85. package/lib/src/embed/ts-embed.d.ts +38 -0
  86. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  87. package/lib/src/embed/ts-embed.js +167 -10
  88. package/lib/src/embed/ts-embed.js.map +1 -1
  89. package/lib/src/embed/ts-embed.spec.js +237 -0
  90. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  91. package/lib/src/types.d.ts +87 -4
  92. package/lib/src/types.d.ts.map +1 -1
  93. package/lib/src/types.js +47 -3
  94. package/lib/src/types.js.map +1 -1
  95. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  96. package/lib/src/utils/processTrigger.js +6 -5
  97. package/lib/src/utils/processTrigger.js.map +1 -1
  98. package/lib/src/utils/processTrigger.spec.js +13 -0
  99. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  100. package/lib/src/utils.d.ts +10 -0
  101. package/lib/src/utils.d.ts.map +1 -1
  102. package/lib/src/utils.js +21 -0
  103. package/lib/src/utils.js.map +1 -1
  104. package/lib/src/utils.spec.js +49 -1
  105. package/lib/src/utils.spec.js.map +1 -1
  106. package/lib/src/visual-embed-sdk.d.ts +148 -3
  107. package/package.json +1 -1
  108. package/src/css-variables.ts +20 -0
  109. package/src/embed/app.spec.ts +109 -0
  110. package/src/embed/app.ts +4 -0
  111. package/src/embed/conversation.spec.ts +17 -0
  112. package/src/embed/conversation.ts +10 -0
  113. package/src/embed/events.spec.ts +7 -0
  114. package/src/embed/liveboard.spec.ts +15 -0
  115. package/src/embed/liveboard.ts +4 -0
  116. package/src/embed/ts-embed.spec.ts +294 -0
  117. package/src/embed/ts-embed.ts +180 -9
  118. package/src/types.ts +86 -3
  119. package/src/utils/processTrigger.spec.ts +23 -0
  120. package/src/utils/processTrigger.ts +8 -6
  121. package/src/utils.spec.ts +63 -0
  122. package/src/utils.ts +24 -0
package/dist/tsembed.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.49.1 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.49.2 */
2
2
  'use client';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -2249,11 +2249,30 @@
2249
2249
  /**
2250
2250
  * Navigate to a specific page in the embedded ThoughtSpot application.
2251
2251
  * This is the same as calling `appEmbed.navigateToPage(path, true)`.
2252
- * @param - `path` - the path to navigate to go forward or back. The path value can
2253
- * be a number; for example, `1`, `-1`.
2252
+ *
2253
+ * Accepts either a plain value or an object with `path`
2254
+ * and an optional `replace` flag.
2255
+ *
2256
+ * @param data - A string path, a numeric history delta, or an object
2257
+ * `{ path: string | number, replace?: boolean }`.
2258
+ * - `path` — the route to navigate to, or a history delta such as `1`
2259
+ * or `-1` (calls `window.history.go()`).
2260
+ * - `replace` — when `true`, replaces the current history entry instead
2261
+ * of pushing a new one (uses `window.location.replace`).
2262
+ *
2254
2263
  * @example
2255
2264
  * ```js
2256
- * appEmbed.navigateToPage(-1)
2265
+ * // Preferred: use navigateToPage directly
2266
+ * appEmbed.navigateToPage(-1);
2267
+ *
2268
+ * // Numeric delta — go back one step
2269
+ * appEmbed.trigger(HostEvent.Navigate, -1);
2270
+ *
2271
+ * // String path — push a new history entry
2272
+ * appEmbed.trigger(HostEvent.Navigate, 'home');
2273
+ *
2274
+ * // Object format — replace current history entry
2275
+ * appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
2257
2276
  * ```
2258
2277
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
2259
2278
  */
@@ -4242,6 +4261,7 @@
4242
4261
  Param["EnableLiveboardDataCache"] = "enableLiveboardDataCache";
4243
4262
  Param["SpotterFileUploadEnabled"] = "spotterFileUploadEnabled";
4244
4263
  Param["SpotterFileUploadFileTypes"] = "spotterFileUploadFileTypes";
4264
+ Param["IsStarterPromptsEnabled"] = "enableStarterPrompts";
4245
4265
  })(Param || (Param = {}));
4246
4266
  /**
4247
4267
  * ThoughtSpot application pages include actions and menu commands
@@ -4884,6 +4904,16 @@
4884
4904
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
4885
4905
  */
4886
4906
  Action["AddToFavorites"] = "addToFavorites";
4907
+ /**
4908
+ * Remove from Favorites option in home page v3 sidebar.
4909
+ * Allows removing an object from the user's favorites list from home-page v3 sidebar.
4910
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
4911
+ * @example
4912
+ * ```js
4913
+ * disabledActions: [Action.RemoveFromFavorites]
4914
+ * ```
4915
+ */
4916
+ Action["RemoveFromFavorites"] = "removeFromFavorites";
4887
4917
  /**
4888
4918
  * The edit icon on Liveboards (Classic experience).
4889
4919
  * @example
@@ -5941,6 +5971,20 @@
5941
5971
  * ```
5942
5972
  */
5943
5973
  Action["SpotterViz"] = "spotterViz";
5974
+ /**
5975
+ * The reference-mode toggle button inside the SpotterViz chat input.
5976
+ * When users enable reference mode, clicking tiles, filters, or
5977
+ * parameters adds them as chat context. Hide this action to remove
5978
+ * the reference-mode capability entirely.
5979
+ * Visible by default.
5980
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
5981
+ * @example
5982
+ * ```js
5983
+ * hiddenActions: [Action.SpotterVizReferenceMode]
5984
+ * disabledActions: [Action.SpotterVizReferenceMode]
5985
+ * ```
5986
+ */
5987
+ Action["SpotterVizReferenceMode"] = "spotterVizReferenceMode";
5944
5988
  /**
5945
5989
  * Clears browser cache and fetches new data for liveboard ChartViz Containers.
5946
5990
  * Requires `enableLiveboardDataCache` to be enabled.
@@ -6417,7 +6461,7 @@
6417
6461
  TableContentDensity["Compact"] = "COMPACT";
6418
6462
  })(exports.TableContentDensity || (exports.TableContentDensity = {}));
6419
6463
 
6420
- var version$1="1.49.1";var pkg = {version:version$1};
6464
+ var version$1="1.49.2";var pkg = {version:version$1};
6421
6465
 
6422
6466
  const { version } = pkg;
6423
6467
 
@@ -6816,6 +6860,27 @@
6816
6860
  function getDOMNode(domSelector) {
6817
6861
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
6818
6862
  }
6863
+ /**
6864
+ * Resolves a CSS selector to an element. `document.querySelector` cannot pierce
6865
+ * shadow boundaries, so when the document lookup misses and a reference node is
6866
+ * provided, this also searches the shadow root the reference node lives in —
6867
+ * letting a selector target an element inside the same shadow root as the embed
6868
+ * instead of silently falling back to the light DOM.
6869
+ * @param selector CSS selector string.
6870
+ * @param referenceNode Node whose shadow root is searched when the document lookup misses.
6871
+ */
6872
+ function querySelectorAcrossShadowRoot(selector, referenceNode) {
6873
+ var _a;
6874
+ const fromDocument = document.querySelector(selector);
6875
+ if (fromDocument) {
6876
+ return fromDocument;
6877
+ }
6878
+ const rootNode = (_a = referenceNode === null || referenceNode === void 0 ? void 0 : referenceNode.getRootNode) === null || _a === void 0 ? void 0 : _a.call(referenceNode);
6879
+ if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
6880
+ return rootNode.querySelector(selector);
6881
+ }
6882
+ return null;
6883
+ }
6819
6884
  const deepMerge = (target, source) => merge(target, source);
6820
6885
  const getOperationNameFromQuery = (query) => {
6821
6886
  const regex = /(?:query|mutation)\s+(\w+)/;
@@ -19358,8 +19423,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19358
19423
  }
19359
19424
  }
19360
19425
  const channel = new MessageChannel();
19426
+ // Close the messageChannel and resolve the promise if timeout.
19427
+ const timeoutId = setTimeout(() => {
19428
+ channel.port1.close();
19429
+ res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
19430
+ }, TRIGGER_TIMEOUT);
19361
19431
  channel.port1.onmessage = ({ data: responseData }) => {
19362
19432
  var _a;
19433
+ clearTimeout(timeoutId);
19363
19434
  channel.port1.close();
19364
19435
  const error = (responseData === null || responseData === void 0 ? void 0 : responseData.error) || ((_a = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _a === void 0 ? void 0 : _a.error);
19365
19436
  if (error) {
@@ -19369,11 +19440,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19369
19440
  res(responseData);
19370
19441
  }
19371
19442
  };
19372
- // Close the messageChannel and resolve the promise if timeout.
19373
- setTimeout(() => {
19374
- channel.port1.close();
19375
- res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
19376
- }, TRIGGER_TIMEOUT);
19377
19443
  return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
19378
19444
  });
19379
19445
  }
@@ -20291,6 +20357,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
20291
20357
  */
20292
20358
  const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
20293
20359
  const TS_EMBED_ID = '_thoughtspot-embed';
20360
+ /**
20361
+ * dataset key used to stash a custom preRenderContainer's original inline
20362
+ * `position` while we override it to `relative`. Stored on the container (not
20363
+ * per-instance) so the override can be reverted on destroy even when multiple
20364
+ * pre-rendered embeds share the same container.
20365
+ */
20366
+ const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
20367
+ const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
20294
20368
  /**
20295
20369
  * The event id map from v2 event names to v1 event id
20296
20370
  * v1 events are the classic embed events implemented in Blink v1
@@ -20326,6 +20400,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
20326
20400
  */
20327
20401
  this.shouldEncodeUrlQueryParams = false;
20328
20402
  this.defaultHiddenActions = [exports.Action.ReportError];
20403
+ this.preRenderContainerEl = null;
20404
+ this.containerScrollListener = null;
20329
20405
  /**
20330
20406
  * Handler for fullscreen change events
20331
20407
  */
@@ -21191,6 +21267,89 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21191
21267
  placeholder.id = id.placeHolder;
21192
21268
  return placeholder;
21193
21269
  }
21270
+ /**
21271
+ * Resolves the configured preRenderContainer to a live element, falling
21272
+ * back to `document.body`. A string selector is re-queried on every call so
21273
+ * a remounted container (E.g.: React replacing the node) resolves to the
21274
+ * fresh element; an element passed directly cannot be re-resolved.
21275
+ */
21276
+ resolvePreRenderContainerTarget() {
21277
+ var _a;
21278
+ const containerConfig = this.viewConfig.preRenderContainer;
21279
+ let container = null;
21280
+ if (typeof containerConfig === 'string') {
21281
+ try {
21282
+ // Resolve against the host's shadow root too, so a selector can
21283
+ // target a container inside the same shadow DOM as the embed —
21284
+ // document.querySelector alone cannot pierce shadow boundaries.
21285
+ container = querySelectorAcrossShadowRoot(containerConfig, this.hostElement);
21286
+ }
21287
+ catch (e) {
21288
+ logger$3.error(`Invalid CSS selector for preRenderContainer: ${containerConfig}`, e);
21289
+ }
21290
+ }
21291
+ else if (containerConfig) {
21292
+ container = containerConfig;
21293
+ }
21294
+ return (_a = container) !== null && _a !== void 0 ? _a : document.body;
21295
+ }
21296
+ /**
21297
+ * Makes the container a positioning context for the absolutely positioned
21298
+ * wrapper, stashing the original inline `position` on the element (once) so
21299
+ * destroy() can restore it exactly, leaving no trace. Recording it on the
21300
+ * element rather than per-instance lets the override be reverted even when
21301
+ * embeds share the same container.
21302
+ */
21303
+ applyPreRenderContainerPositioning(container) {
21304
+ if (container === document.body) {
21305
+ return;
21306
+ }
21307
+ const pos = window.getComputedStyle(container).position;
21308
+ if (pos === 'static') {
21309
+ if (container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] === undefined) {
21310
+ container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] = container.style.position;
21311
+ }
21312
+ container.style.position = 'relative';
21313
+ }
21314
+ }
21315
+ /**
21316
+ * Re-attaches the wrapper to a live container when the previously resolved
21317
+ * one has been detached or no longer holds the wrapper — e.g. the host app
21318
+ * remounted a custom preRenderContainer, which would otherwise leave a stale
21319
+ * reference and collapse the wrapper. Only string selectors can be
21320
+ * re-resolved; a container passed as an element is left untouched.
21321
+ */
21322
+ reconcilePreRenderContainer() {
21323
+ const wrapper = this.preRenderWrapper;
21324
+ const stored = this.preRenderContainerEl;
21325
+ // Nothing to reconcile until this instance resolved its container.
21326
+ if (!wrapper || !stored) {
21327
+ return;
21328
+ }
21329
+ const storedIsLive = stored === document.body || document.contains(stored);
21330
+ if (storedIsLive && stored.contains(wrapper)) {
21331
+ return;
21332
+ }
21333
+ const resolved = this.resolvePreRenderContainerTarget();
21334
+ // Re-resolution yielded the same (still stale) element — nothing we can
21335
+ // do, e.g. a detached container passed as an HTMLElement.
21336
+ if (resolved === stored && stored.contains(wrapper)) {
21337
+ return;
21338
+ }
21339
+ if (this.containerScrollListener && stored !== resolved) {
21340
+ if (stored !== document.body) {
21341
+ stored.removeEventListener('scroll', this.containerScrollListener);
21342
+ }
21343
+ if (resolved !== document.body) {
21344
+ resolved.addEventListener('scroll', this.containerScrollListener);
21345
+ }
21346
+ }
21347
+ this.applyPreRenderContainerPositioning(resolved);
21348
+ if (wrapper.parentNode !== resolved) {
21349
+ resolved.appendChild(wrapper);
21350
+ }
21351
+ this.preRenderContainerEl = resolved;
21352
+ }
21194
21353
  insertIntoDOMForPreRender(child) {
21195
21354
  const preRenderChild = this.createPreRenderChild(child);
21196
21355
  const preRenderWrapper = this.createPreRenderWrapper();
@@ -21210,7 +21369,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21210
21369
  else {
21211
21370
  this.hidePreRender();
21212
21371
  }
21213
- document.body.appendChild(preRenderWrapper);
21372
+ const targetContainer = this.resolvePreRenderContainerTarget();
21373
+ this.preRenderContainerEl = targetContainer;
21374
+ this.applyPreRenderContainerPositioning(targetContainer);
21375
+ targetContainer.appendChild(preRenderWrapper);
21214
21376
  }
21215
21377
  insertIntoDOM(child) {
21216
21378
  var _a;
@@ -21649,6 +21811,50 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21649
21811
  tsParams = tsParams ? `?${tsParams}` : '';
21650
21812
  return tsParams;
21651
21813
  }
21814
+ /**
21815
+ * Reverts the custom preRenderContainer's `position` to the value it had
21816
+ * before we overrode it to `relative` (see insertIntoDOMForPreRender).
21817
+ *
21818
+ * We restore the original inline value rather than forcing `static`, and we
21819
+ * skip the restore if another preRender wrapper is still mounted inside the
21820
+ * same container — a shared container still needs the positioning context.
21821
+ */
21822
+ restorePreRenderContainerPosition() {
21823
+ const container = this.preRenderContainerEl;
21824
+ if (!container || container === document.body) {
21825
+ return;
21826
+ }
21827
+ // Drop our reference up front so a destroyed embed never pins a
21828
+ // detached container in memory; restoration uses the local handle.
21829
+ this.preRenderContainerEl = null;
21830
+ const originalPosition = container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
21831
+ if (originalPosition === undefined) {
21832
+ // We never overrode this container's position; nothing to restore.
21833
+ return;
21834
+ }
21835
+ // This instance's own wrapper has already been removed by now, so any
21836
+ // match here belongs to another embed still sharing the container — it
21837
+ // continues to rely on the positioning context, so leave it in place.
21838
+ const hasOtherWrapper = container.querySelector(`[id^="${PRERENDER_WRAPPER_ID_PREFIX}"]`);
21839
+ if (hasOtherWrapper) {
21840
+ return;
21841
+ }
21842
+ container.style.position = originalPosition;
21843
+ delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
21844
+ }
21845
+ /**
21846
+ * Detaches and clears the container scroll listener, if one is attached.
21847
+ */
21848
+ removeContainerScrollListener() {
21849
+ if (!this.containerScrollListener) {
21850
+ return;
21851
+ }
21852
+ const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
21853
+ ? this.preRenderContainerEl
21854
+ : null;
21855
+ customContainer === null || customContainer === void 0 ? void 0 : customContainer.removeEventListener('scroll', this.containerScrollListener);
21856
+ this.containerScrollListener = null;
21857
+ }
21652
21858
  /**
21653
21859
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
21654
21860
  * @version SDK: 1.19.1 | ThoughtSpot: *
@@ -21657,8 +21863,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21657
21863
  var _a, _b, _c;
21658
21864
  try {
21659
21865
  this.removeFullscreenChangeHandler();
21866
+ this.removeContainerScrollListener();
21660
21867
  this.unsubscribeToEvents();
21661
21868
  (_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
21869
+ this.restorePreRenderContainerPosition();
21662
21870
  if (!this.isRendered) {
21663
21871
  return;
21664
21872
  }
@@ -21768,15 +21976,19 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21768
21976
  }
21769
21977
  this.hostElement.appendChild(this.insertedDomEl);
21770
21978
  this.syncPreRenderStyle();
21979
+ const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
21980
+ ? this.preRenderContainerEl
21981
+ : null;
21982
+ if (customContainer && !this.containerScrollListener) {
21983
+ this.containerScrollListener = () => this.syncPreRenderStyle();
21984
+ customContainer.addEventListener('scroll', this.containerScrollListener);
21985
+ }
21771
21986
  if (!this.viewConfig.doNotTrackPreRenderSize) {
21772
21987
  const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
21773
21988
  this.resizeObserver = new ResizeObserver((entries) => {
21774
21989
  entries.forEach((entry) => {
21775
- if (entry.contentRect && entry.target === observeTarget) {
21776
- setStyleProperties(this.preRenderWrapper, {
21777
- width: `${entry.contentRect.width}px`,
21778
- height: `${entry.contentRect.height}px`,
21779
- });
21990
+ if (entry.target === observeTarget) {
21991
+ this.syncPreRenderStyle();
21780
21992
  }
21781
21993
  });
21782
21994
  });
@@ -21808,14 +22020,24 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21808
22020
  * is not defined or not found.
21809
22021
  */
21810
22022
  syncPreRenderStyle() {
22023
+ var _a;
21811
22024
  if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
21812
22025
  logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
21813
22026
  return;
21814
22027
  }
22028
+ // Self-heal if the resolved container was remounted/detached, so we
22029
+ // never measure a stale node (which would collapse the wrapper).
22030
+ this.reconcilePreRenderContainer();
21815
22031
  const elBoundingClient = this.getPreRenderPlaceHolderElement().getBoundingClientRect();
22032
+ const containerEl = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
22033
+ ? this.preRenderContainerEl
22034
+ : null;
22035
+ const containerRect = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.getBoundingClientRect()) !== null && _a !== void 0 ? _a : { x: 0, y: 0 };
22036
+ const scrollX = containerEl ? containerEl.scrollLeft : window.scrollX;
22037
+ const scrollY = containerEl ? containerEl.scrollTop : window.scrollY;
21816
22038
  setStyleProperties(this.preRenderWrapper, {
21817
- top: `${elBoundingClient.y + window.scrollY}px`,
21818
- left: `${elBoundingClient.x + window.scrollX}px`,
22039
+ top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
22040
+ left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
21819
22041
  width: `${elBoundingClient.width}px`,
21820
22042
  height: `${elBoundingClient.height}px`,
21821
22043
  position: 'absolute',
@@ -21842,6 +22064,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21842
22064
  overflow: 'hidden',
21843
22065
  };
21844
22066
  setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
22067
+ this.removeContainerScrollListener();
21845
22068
  if (this.resizeObserver) {
21846
22069
  this.resizeObserver.disconnect();
21847
22070
  }
@@ -21860,7 +22083,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
21860
22083
  */
21861
22084
  getPreRenderIds() {
21862
22085
  return {
21863
- wrapper: `tsEmbed-pre-render-wrapper-${this.viewConfig.preRenderId}`,
22086
+ wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
21864
22087
  child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
21865
22088
  placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
21866
22089
  };
@@ -22297,12 +22520,15 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
22297
22520
  }
22298
22521
  // Handle spotterChatConfig params
22299
22522
  if (spotterChatConfig) {
22300
- const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
22523
+ const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
22301
22524
  setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
22302
22525
  setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
22303
22526
  if (spotterFileUploadEnabled !== undefined) {
22304
22527
  params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
22305
22528
  }
22529
+ if (enableStarterPrompts !== undefined) {
22530
+ params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
22531
+ }
22306
22532
  if (spotterFileUploadFileTypes !== undefined) {
22307
22533
  params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
22308
22534
  }
@@ -22858,12 +23084,15 @@ query GetEurekaVizSnapshots(
22858
23084
  }
22859
23085
  // Handle spotterChatConfig params
22860
23086
  if (spotterChatConfig) {
22861
- const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
23087
+ const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
22862
23088
  setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
22863
23089
  setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
22864
23090
  if (spotterFileUploadEnabled !== undefined) {
22865
23091
  params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
22866
23092
  }
23093
+ if (enableStarterPrompts !== undefined) {
23094
+ params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
23095
+ }
22867
23096
  if (spotterFileUploadFileTypes !== undefined) {
22868
23097
  params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
22869
23098
  }
@@ -23982,10 +24211,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23982
24211
  setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
23983
24212
  // Handle spotterChatConfig params
23984
24213
  if (spotterChatConfig) {
23985
- const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
24214
+ const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
23986
24215
  setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
23987
24216
  setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
23988
24217
  setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
24218
+ setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
23989
24219
  if (spotterFileUploadFileTypes !== undefined) {
23990
24220
  queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
23991
24221
  }
@@ -961,6 +961,23 @@ export interface CustomCssVariables {
961
961
  * header underline, left panel border, thinking step connector and dots.
962
962
  */
963
963
  "--ts-var-spotterviz-border-color"?: string;
964
+ /**
965
+ * Background color of the reference-mode toggle button in the SpotterViz
966
+ * chat input when it is unselected and the user hovers over it.
967
+ */
968
+ "--ts-var-spotterviz-reference-icon-hover-background"?: string;
969
+ /**
970
+ * Icon color for the reference-mode selected state — applies to
971
+ * both the toggle button when active and the icon badge on each
972
+ * referenced-entity chip in the chat input.
973
+ */
974
+ "--ts-var-spotterviz-reference-icon-selected-color"?: string;
975
+ /**
976
+ * Background color for the reference-mode selected state — applies to
977
+ * both the reference mode toggle button when active and the icon badge
978
+ * on each referenced-entity chip in the chat input.
979
+ */
980
+ "--ts-var-spotterviz-reference-icon-selected-background"?: string;
964
981
  }
965
982
  export interface SessionInterface {
966
983
  sessionId: string;
@@ -2170,6 +2187,45 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2170
2187
  * ```
2171
2188
  */
2172
2189
  doNotTrackPreRenderSize?: boolean;
2190
+ /**
2191
+ * The DOM element or CSS selector string specifying the container into which
2192
+ * the pre-rendered wrapper is inserted. Defaults to `document.body` when not
2193
+ * specified.
2194
+ *
2195
+ * **When to use a target container:** set this when the pre-render should
2196
+ * live somewhere other than `document.body` — for example when `<body>` has
2197
+ * `overflow: hidden` and scrolling is handled by an inner element, or when
2198
+ * you need the wrapper to sit inside a specific stacking/positioning context.
2199
+ * The wrapper is positioned to track the embedding element within this
2200
+ * container, so choose the scrollable/positioned ancestor you want it
2201
+ * aligned to.
2202
+ *
2203
+ * **Pass a stable container:** the wrapper is mounted into the resolved
2204
+ * container once, during `preRender()`. The container must stay mounted for
2205
+ * the lifetime of the pre-render — if the host app unmounts and remounts it
2206
+ * (for example React replacing the node), the wrapper is orphaned on the
2207
+ * detached node. Mount the container above the part of the tree that
2208
+ * re-renders so its identity is stable. Prefer a CSS selector string over a
2209
+ * raw element: a selector can be re-resolved to the fresh node on the next
2210
+ * reposition, whereas an element reference cannot be recovered once detached.
2211
+ *
2212
+ * When the embed host lives inside a Shadow DOM, a selector string is
2213
+ * resolved against that shadow root as well (since `document.querySelector`
2214
+ * cannot pierce shadow boundaries); pass the element directly if the
2215
+ * container lives in a different root.
2216
+ *
2217
+ * @type {string | HTMLElement}
2218
+ * @version SDK: 1.49.2 | ThoughtSpot: *
2219
+ * @example
2220
+ * ```js
2221
+ * const embed = new LiveboardEmbed('#tsEmbed', {
2222
+ * preRenderId: 'my-liveboard',
2223
+ * // Prefer a selector for a stable, scrollable container.
2224
+ * preRenderContainer: '#my-scroll-container',
2225
+ * });
2226
+ * ```
2227
+ */
2228
+ preRenderContainer?: string | HTMLElement;
2173
2229
  /**
2174
2230
  * Enable the V2 shell. This can provide performance benefits
2175
2231
  * due to a lighter-weight shell.
@@ -5115,11 +5171,30 @@ export declare enum HostEvent {
5115
5171
  /**
5116
5172
  * Navigate to a specific page in the embedded ThoughtSpot application.
5117
5173
  * This is the same as calling `appEmbed.navigateToPage(path, true)`.
5118
- * @param - `path` - the path to navigate to go forward or back. The path value can
5119
- * be a number; for example, `1`, `-1`.
5174
+ *
5175
+ * Accepts either a plain value or an object with `path`
5176
+ * and an optional `replace` flag.
5177
+ *
5178
+ * @param data - A string path, a numeric history delta, or an object
5179
+ * `{ path: string | number, replace?: boolean }`.
5180
+ * - `path` — the route to navigate to, or a history delta such as `1`
5181
+ * or `-1` (calls `window.history.go()`).
5182
+ * - `replace` — when `true`, replaces the current history entry instead
5183
+ * of pushing a new one (uses `window.location.replace`).
5184
+ *
5120
5185
  * @example
5121
5186
  * ```js
5122
- * appEmbed.navigateToPage(-1)
5187
+ * // Preferred: use navigateToPage directly
5188
+ * appEmbed.navigateToPage(-1);
5189
+ *
5190
+ * // Numeric delta — go back one step
5191
+ * appEmbed.trigger(HostEvent.Navigate, -1);
5192
+ *
5193
+ * // String path — push a new history entry
5194
+ * appEmbed.trigger(HostEvent.Navigate, 'home');
5195
+ *
5196
+ * // Object format — replace current history entry
5197
+ * appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
5123
5198
  * ```
5124
5199
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
5125
5200
  */
@@ -7592,6 +7667,16 @@ export declare enum Action {
7592
7667
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
7593
7668
  */
7594
7669
  AddToFavorites = "addToFavorites",
7670
+ /**
7671
+ * Remove from Favorites option in home page v3 sidebar.
7672
+ * Allows removing an object from the user's favorites list from home-page v3 sidebar.
7673
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
7674
+ * @example
7675
+ * ```js
7676
+ * disabledActions: [Action.RemoveFromFavorites]
7677
+ * ```
7678
+ */
7679
+ RemoveFromFavorites = "removeFromFavorites",
7595
7680
  /**
7596
7681
  * The edit icon on Liveboards (Classic experience).
7597
7682
  * @example
@@ -8649,6 +8734,20 @@ export declare enum Action {
8649
8734
  * ```
8650
8735
  */
8651
8736
  SpotterViz = "spotterViz",
8737
+ /**
8738
+ * The reference-mode toggle button inside the SpotterViz chat input.
8739
+ * When users enable reference mode, clicking tiles, filters, or
8740
+ * parameters adds them as chat context. Hide this action to remove
8741
+ * the reference-mode capability entirely.
8742
+ * Visible by default.
8743
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
8744
+ * @example
8745
+ * ```js
8746
+ * hiddenActions: [Action.SpotterVizReferenceMode]
8747
+ * disabledActions: [Action.SpotterVizReferenceMode]
8748
+ * ```
8749
+ */
8750
+ SpotterVizReferenceMode = "spotterVizReferenceMode",
8652
8751
  /**
8653
8752
  * Clears browser cache and fetches new data for liveboard ChartViz Containers.
8654
8753
  * Requires `enableLiveboardDataCache` to be enabled.
@@ -9968,6 +10067,8 @@ declare class TsEmbed {
9968
10067
  private shouldEncodeUrlQueryParams;
9969
10068
  private defaultHiddenActions;
9970
10069
  private resizeObserver;
10070
+ private preRenderContainerEl;
10071
+ private containerScrollListener;
9971
10072
  protected hostEventClient: HostEventClient;
9972
10073
  protected isReadyForRenderPromise: Promise<void>;
9973
10074
  protected shouldWaitForRenderPromise: boolean;
@@ -10135,6 +10236,29 @@ declare class TsEmbed {
10135
10236
  * aligned with the host layout.
10136
10237
  */
10137
10238
  private createPreRenderPlaceholder;
10239
+ /**
10240
+ * Resolves the configured preRenderContainer to a live element, falling
10241
+ * back to `document.body`. A string selector is re-queried on every call so
10242
+ * a remounted container (E.g.: React replacing the node) resolves to the
10243
+ * fresh element; an element passed directly cannot be re-resolved.
10244
+ */
10245
+ private resolvePreRenderContainerTarget;
10246
+ /**
10247
+ * Makes the container a positioning context for the absolutely positioned
10248
+ * wrapper, stashing the original inline `position` on the element (once) so
10249
+ * destroy() can restore it exactly, leaving no trace. Recording it on the
10250
+ * element rather than per-instance lets the override be reverted even when
10251
+ * embeds share the same container.
10252
+ */
10253
+ private applyPreRenderContainerPositioning;
10254
+ /**
10255
+ * Re-attaches the wrapper to a live container when the previously resolved
10256
+ * one has been detached or no longer holds the wrapper — e.g. the host app
10257
+ * remounted a custom preRenderContainer, which would otherwise leave a stale
10258
+ * reference and collapse the wrapper. Only string selectors can be
10259
+ * re-resolved; a container passed as an element is left untouched.
10260
+ */
10261
+ private reconcilePreRenderContainer;
10138
10262
  protected insertIntoDOMForPreRender(child: string | Node): void;
10139
10263
  private showPreRenderByDefault;
10140
10264
  protected insertIntoDOM(child: string | Node): void;
@@ -10347,6 +10471,19 @@ declare class TsEmbed {
10347
10471
  getThoughtSpotPostUrlParams(additionalParams?: {
10348
10472
  [key: string]: string | number;
10349
10473
  }): string;
10474
+ /**
10475
+ * Reverts the custom preRenderContainer's `position` to the value it had
10476
+ * before we overrode it to `relative` (see insertIntoDOMForPreRender).
10477
+ *
10478
+ * We restore the original inline value rather than forcing `static`, and we
10479
+ * skip the restore if another preRender wrapper is still mounted inside the
10480
+ * same container — a shared container still needs the positioning context.
10481
+ */
10482
+ private restorePreRenderContainerPosition;
10483
+ /**
10484
+ * Detaches and clears the container scroll listener, if one is attached.
10485
+ */
10486
+ private removeContainerScrollListener;
10350
10487
  /**
10351
10488
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
10352
10489
  * @version SDK: 1.19.1 | ThoughtSpot: *
@@ -11021,6 +11158,14 @@ export interface SpotterChatViewConfig {
11021
11158
  * @version SDK: 1.49.0 | ThoughtSpot: 26.6.0.cl
11022
11159
  */
11023
11160
  spotterFileUploadFileTypes?: SpotterFileUploadFileTypes;
11161
+ /**
11162
+ * Enables starter prompts in the Spotter chat interface.
11163
+ *
11164
+ * Supported embed types: SpotterEmbed, LiveboardEmbed, AppEmbed
11165
+ * @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
11166
+ * @default false
11167
+ */
11168
+ enableStarterPrompts?: boolean;
11024
11169
  }
11025
11170
  /**
11026
11171
  * The configuration for the embedded spotterEmbed options.