@thoughtspot/visual-embed-sdk 1.49.1 → 1.49.3

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 (151) hide show
  1. package/cjs/package.json +4 -10
  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 +7 -1
  5. package/cjs/src/embed/app.d.ts.map +1 -1
  6. package/cjs/src/embed/app.js +4 -1
  7. package/cjs/src/embed/app.js.map +1 -1
  8. package/cjs/src/embed/app.spec.js +97 -0
  9. package/cjs/src/embed/app.spec.js.map +1 -1
  10. package/cjs/src/embed/conversation.d.ts +8 -0
  11. package/cjs/src/embed/conversation.d.ts.map +1 -1
  12. package/cjs/src/embed/conversation.js +2 -1
  13. package/cjs/src/embed/conversation.js.map +1 -1
  14. package/cjs/src/embed/conversation.spec.js +12 -0
  15. package/cjs/src/embed/conversation.spec.js.map +1 -1
  16. package/cjs/src/embed/events.spec.js +5 -0
  17. package/cjs/src/embed/events.spec.js.map +1 -1
  18. package/cjs/src/embed/liveboard.d.ts +6 -0
  19. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  20. package/cjs/src/embed/liveboard.js +4 -1
  21. package/cjs/src/embed/liveboard.js.map +1 -1
  22. package/cjs/src/embed/liveboard.spec.js +11 -0
  23. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  24. package/cjs/src/embed/spotter-viz-utils.d.ts +29 -0
  25. package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
  26. package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
  27. package/cjs/src/embed/ts-embed.d.ts +38 -0
  28. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  29. package/cjs/src/embed/ts-embed.js +166 -9
  30. package/cjs/src/embed/ts-embed.js.map +1 -1
  31. package/cjs/src/embed/ts-embed.spec.js +237 -0
  32. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  33. package/cjs/src/index.d.ts +2 -2
  34. package/cjs/src/index.d.ts.map +1 -1
  35. package/cjs/src/index.js.map +1 -1
  36. package/cjs/src/types.d.ts +87 -4
  37. package/cjs/src/types.d.ts.map +1 -1
  38. package/cjs/src/types.js +47 -3
  39. package/cjs/src/types.js.map +1 -1
  40. package/cjs/src/utils/graphql/answerService/answerService.spec.js +15 -0
  41. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  42. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  43. package/cjs/src/utils/processTrigger.js +6 -5
  44. package/cjs/src/utils/processTrigger.js.map +1 -1
  45. package/cjs/src/utils/processTrigger.spec.js +13 -0
  46. package/cjs/src/utils/processTrigger.spec.js.map +1 -1
  47. package/cjs/src/utils.d.ts +10 -0
  48. package/cjs/src/utils.d.ts.map +1 -1
  49. package/cjs/src/utils.js +25 -4
  50. package/cjs/src/utils.js.map +1 -1
  51. package/cjs/src/utils.spec.js +48 -0
  52. package/cjs/src/utils.spec.js.map +1 -1
  53. package/dist/{index-B6Rn561t.js → index-DsSQndIB.js} +303 -187
  54. package/dist/src/css-variables.d.ts +17 -0
  55. package/dist/src/css-variables.d.ts.map +1 -1
  56. package/dist/src/embed/app.d.ts +7 -1
  57. package/dist/src/embed/app.d.ts.map +1 -1
  58. package/dist/src/embed/conversation.d.ts +8 -0
  59. package/dist/src/embed/conversation.d.ts.map +1 -1
  60. package/dist/src/embed/liveboard.d.ts +6 -0
  61. package/dist/src/embed/liveboard.d.ts.map +1 -1
  62. package/dist/src/embed/spotter-viz-utils.d.ts +29 -0
  63. package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
  64. package/dist/src/embed/ts-embed.d.ts +38 -0
  65. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  66. package/dist/src/index.d.ts +2 -2
  67. package/dist/src/index.d.ts.map +1 -1
  68. package/dist/src/types.d.ts +87 -4
  69. package/dist/src/types.d.ts.map +1 -1
  70. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  71. package/dist/src/utils.d.ts +10 -0
  72. package/dist/src/utils.d.ts.map +1 -1
  73. package/dist/tsembed-react.es.js +282 -35
  74. package/dist/tsembed-react.js +583 -220
  75. package/dist/tsembed.es.js +282 -35
  76. package/dist/tsembed.js +583 -220
  77. package/dist/visual-embed-sdk-react-full.d.ts +190 -4
  78. package/dist/visual-embed-sdk-react.d.ts +190 -4
  79. package/dist/visual-embed-sdk.d.ts +190 -4
  80. package/lib/package.json +4 -10
  81. package/lib/src/css-variables.d.ts +17 -0
  82. package/lib/src/css-variables.d.ts.map +1 -1
  83. package/lib/src/embed/app.d.ts +7 -1
  84. package/lib/src/embed/app.d.ts.map +1 -1
  85. package/lib/src/embed/app.js +4 -1
  86. package/lib/src/embed/app.js.map +1 -1
  87. package/lib/src/embed/app.spec.js +97 -0
  88. package/lib/src/embed/app.spec.js.map +1 -1
  89. package/lib/src/embed/conversation.d.ts +8 -0
  90. package/lib/src/embed/conversation.d.ts.map +1 -1
  91. package/lib/src/embed/conversation.js +2 -1
  92. package/lib/src/embed/conversation.js.map +1 -1
  93. package/lib/src/embed/conversation.spec.js +12 -0
  94. package/lib/src/embed/conversation.spec.js.map +1 -1
  95. package/lib/src/embed/events.spec.js +5 -0
  96. package/lib/src/embed/events.spec.js.map +1 -1
  97. package/lib/src/embed/liveboard.d.ts +6 -0
  98. package/lib/src/embed/liveboard.d.ts.map +1 -1
  99. package/lib/src/embed/liveboard.js +4 -1
  100. package/lib/src/embed/liveboard.js.map +1 -1
  101. package/lib/src/embed/liveboard.spec.js +11 -0
  102. package/lib/src/embed/liveboard.spec.js.map +1 -1
  103. package/lib/src/embed/spotter-viz-utils.d.ts +29 -0
  104. package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
  105. package/lib/src/embed/spotter-viz-utils.js.map +1 -1
  106. package/lib/src/embed/ts-embed.d.ts +38 -0
  107. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  108. package/lib/src/embed/ts-embed.js +167 -10
  109. package/lib/src/embed/ts-embed.js.map +1 -1
  110. package/lib/src/embed/ts-embed.spec.js +237 -0
  111. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  112. package/lib/src/index.d.ts +2 -2
  113. package/lib/src/index.d.ts.map +1 -1
  114. package/lib/src/index.js.map +1 -1
  115. package/lib/src/types.d.ts +87 -4
  116. package/lib/src/types.d.ts.map +1 -1
  117. package/lib/src/types.js +47 -3
  118. package/lib/src/types.js.map +1 -1
  119. package/lib/src/utils/graphql/answerService/answerService.spec.js +15 -0
  120. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  121. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  122. package/lib/src/utils/processTrigger.js +6 -5
  123. package/lib/src/utils/processTrigger.js.map +1 -1
  124. package/lib/src/utils/processTrigger.spec.js +13 -0
  125. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  126. package/lib/src/utils.d.ts +10 -0
  127. package/lib/src/utils.d.ts.map +1 -1
  128. package/lib/src/utils.js +22 -1
  129. package/lib/src/utils.js.map +1 -1
  130. package/lib/src/utils.spec.js +49 -1
  131. package/lib/src/utils.spec.js.map +1 -1
  132. package/lib/src/visual-embed-sdk.d.ts +190 -4
  133. package/package.json +4 -10
  134. package/src/css-variables.ts +20 -0
  135. package/src/embed/app.spec.ts +109 -0
  136. package/src/embed/app.ts +11 -1
  137. package/src/embed/conversation.spec.ts +17 -0
  138. package/src/embed/conversation.ts +10 -0
  139. package/src/embed/events.spec.ts +7 -0
  140. package/src/embed/liveboard.spec.ts +15 -0
  141. package/src/embed/liveboard.ts +10 -0
  142. package/src/embed/spotter-viz-utils.ts +30 -0
  143. package/src/embed/ts-embed.spec.ts +294 -0
  144. package/src/embed/ts-embed.ts +180 -9
  145. package/src/index.ts +2 -1
  146. package/src/types.ts +86 -3
  147. package/src/utils/graphql/answerService/answerService.spec.ts +18 -0
  148. package/src/utils/processTrigger.spec.ts +23 -0
  149. package/src/utils/processTrigger.ts +8 -6
  150. package/src/utils.spec.ts +63 -0
  151. package/src/utils.ts +25 -1
@@ -960,6 +960,23 @@ export interface CustomCssVariables {
960
960
  * header underline, left panel border, thinking step connector and dots.
961
961
  */
962
962
  "--ts-var-spotterviz-border-color"?: string;
963
+ /**
964
+ * Background color of the reference-mode toggle button in the SpotterViz
965
+ * chat input when it is unselected and the user hovers over it.
966
+ */
967
+ "--ts-var-spotterviz-reference-icon-hover-background"?: string;
968
+ /**
969
+ * Icon color for the reference-mode selected state — applies to
970
+ * both the toggle button when active and the icon badge on each
971
+ * referenced-entity chip in the chat input.
972
+ */
973
+ "--ts-var-spotterviz-reference-icon-selected-color"?: string;
974
+ /**
975
+ * Background color for the reference-mode selected state — applies to
976
+ * both the reference mode toggle button when active and the icon badge
977
+ * on each referenced-entity chip in the chat input.
978
+ */
979
+ "--ts-var-spotterviz-reference-icon-selected-background"?: string;
963
980
  }
964
981
  export interface SessionInterface {
965
982
  sessionId: string;
@@ -2225,6 +2242,45 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2225
2242
  * ```
2226
2243
  */
2227
2244
  doNotTrackPreRenderSize?: boolean;
2245
+ /**
2246
+ * The DOM element or CSS selector string specifying the container into which
2247
+ * the pre-rendered wrapper is inserted. Defaults to `document.body` when not
2248
+ * specified.
2249
+ *
2250
+ * **When to use a target container:** set this when the pre-render should
2251
+ * live somewhere other than `document.body` — for example when `<body>` has
2252
+ * `overflow: hidden` and scrolling is handled by an inner element, or when
2253
+ * you need the wrapper to sit inside a specific stacking/positioning context.
2254
+ * The wrapper is positioned to track the embedding element within this
2255
+ * container, so choose the scrollable/positioned ancestor you want it
2256
+ * aligned to.
2257
+ *
2258
+ * **Pass a stable container:** the wrapper is mounted into the resolved
2259
+ * container once, during `preRender()`. The container must stay mounted for
2260
+ * the lifetime of the pre-render — if the host app unmounts and remounts it
2261
+ * (for example React replacing the node), the wrapper is orphaned on the
2262
+ * detached node. Mount the container above the part of the tree that
2263
+ * re-renders so its identity is stable. Prefer a CSS selector string over a
2264
+ * raw element: a selector can be re-resolved to the fresh node on the next
2265
+ * reposition, whereas an element reference cannot be recovered once detached.
2266
+ *
2267
+ * When the embed host lives inside a Shadow DOM, a selector string is
2268
+ * resolved against that shadow root as well (since `document.querySelector`
2269
+ * cannot pierce shadow boundaries); pass the element directly if the
2270
+ * container lives in a different root.
2271
+ *
2272
+ * @type {string | HTMLElement}
2273
+ * @version SDK: 1.49.2 | ThoughtSpot: *
2274
+ * @example
2275
+ * ```js
2276
+ * const embed = new LiveboardEmbed('#tsEmbed', {
2277
+ * preRenderId: 'my-liveboard',
2278
+ * // Prefer a selector for a stable, scrollable container.
2279
+ * preRenderContainer: '#my-scroll-container',
2280
+ * });
2281
+ * ```
2282
+ */
2283
+ preRenderContainer?: string | HTMLElement;
2228
2284
  /**
2229
2285
  * Enable the V2 shell. This can provide performance benefits
2230
2286
  * due to a lighter-weight shell.
@@ -5198,11 +5254,30 @@ export enum HostEvent {
5198
5254
  /**
5199
5255
  * Navigate to a specific page in the embedded ThoughtSpot application.
5200
5256
  * This is the same as calling `appEmbed.navigateToPage(path, true)`.
5201
- * @param - `path` - the path to navigate to go forward or back. The path value can
5202
- * be a number; for example, `1`, `-1`.
5257
+ *
5258
+ * Accepts either a plain value or an object with `path`
5259
+ * and an optional `replace` flag.
5260
+ *
5261
+ * @param data - A string path, a numeric history delta, or an object
5262
+ * `{ path: string | number, replace?: boolean }`.
5263
+ * - `path` — the route to navigate to, or a history delta such as `1`
5264
+ * or `-1` (calls `window.history.go()`).
5265
+ * - `replace` — when `true`, replaces the current history entry instead
5266
+ * of pushing a new one (uses `window.location.replace`).
5267
+ *
5203
5268
  * @example
5204
5269
  * ```js
5205
- * appEmbed.navigateToPage(-1)
5270
+ * // Preferred: use navigateToPage directly
5271
+ * appEmbed.navigateToPage(-1);
5272
+ *
5273
+ * // Numeric delta — go back one step
5274
+ * appEmbed.trigger(HostEvent.Navigate, -1);
5275
+ *
5276
+ * // String path — push a new history entry
5277
+ * appEmbed.trigger(HostEvent.Navigate, 'home');
5278
+ *
5279
+ * // Object format — replace current history entry
5280
+ * appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
5206
5281
  * ```
5207
5282
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
5208
5283
  */
@@ -7675,6 +7750,16 @@ export enum Action {
7675
7750
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
7676
7751
  */
7677
7752
  AddToFavorites = "addToFavorites",
7753
+ /**
7754
+ * Remove from Favorites option in home page v3 sidebar.
7755
+ * Allows removing an object from the user's favorites list from home-page v3 sidebar.
7756
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
7757
+ * @example
7758
+ * ```js
7759
+ * disabledActions: [Action.RemoveFromFavorites]
7760
+ * ```
7761
+ */
7762
+ RemoveFromFavorites = "removeFromFavorites",
7678
7763
  /**
7679
7764
  * The edit icon on Liveboards (Classic experience).
7680
7765
  * @example
@@ -8732,6 +8817,20 @@ export enum Action {
8732
8817
  * ```
8733
8818
  */
8734
8819
  SpotterViz = "spotterViz",
8820
+ /**
8821
+ * The reference-mode toggle button inside the SpotterViz chat input.
8822
+ * When users enable reference mode, clicking tiles, filters, or
8823
+ * parameters adds them as chat context. Hide this action to remove
8824
+ * the reference-mode capability entirely.
8825
+ * Visible by default.
8826
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
8827
+ * @example
8828
+ * ```js
8829
+ * hiddenActions: [Action.SpotterVizReferenceMode]
8830
+ * disabledActions: [Action.SpotterVizReferenceMode]
8831
+ * ```
8832
+ */
8833
+ SpotterVizReferenceMode = "spotterVizReferenceMode",
8735
8834
  /**
8736
8835
  * Clears browser cache and fetches new data for liveboard ChartViz Containers.
8737
8836
  * Requires `enableLiveboardDataCache` to be enabled.
@@ -10027,6 +10126,8 @@ class TsEmbed {
10027
10126
  private shouldEncodeUrlQueryParams;
10028
10127
  private defaultHiddenActions;
10029
10128
  private resizeObserver;
10129
+ private preRenderContainerEl;
10130
+ private containerScrollListener;
10030
10131
  protected hostEventClient: HostEventClient;
10031
10132
  protected isReadyForRenderPromise: Promise<void>;
10032
10133
  protected shouldWaitForRenderPromise: boolean;
@@ -10194,6 +10295,29 @@ class TsEmbed {
10194
10295
  * aligned with the host layout.
10195
10296
  */
10196
10297
  private createPreRenderPlaceholder;
10298
+ /**
10299
+ * Resolves the configured preRenderContainer to a live element, falling
10300
+ * back to `document.body`. A string selector is re-queried on every call so
10301
+ * a remounted container (E.g.: React replacing the node) resolves to the
10302
+ * fresh element; an element passed directly cannot be re-resolved.
10303
+ */
10304
+ private resolvePreRenderContainerTarget;
10305
+ /**
10306
+ * Makes the container a positioning context for the absolutely positioned
10307
+ * wrapper, stashing the original inline `position` on the element (once) so
10308
+ * destroy() can restore it exactly, leaving no trace. Recording it on the
10309
+ * element rather than per-instance lets the override be reverted even when
10310
+ * embeds share the same container.
10311
+ */
10312
+ private applyPreRenderContainerPositioning;
10313
+ /**
10314
+ * Re-attaches the wrapper to a live container when the previously resolved
10315
+ * one has been detached or no longer holds the wrapper — e.g. the host app
10316
+ * remounted a custom preRenderContainer, which would otherwise leave a stale
10317
+ * reference and collapse the wrapper. Only string selectors can be
10318
+ * re-resolved; a container passed as an element is left untouched.
10319
+ */
10320
+ private reconcilePreRenderContainer;
10197
10321
  protected insertIntoDOMForPreRender(child: string | Node): void;
10198
10322
  private showPreRenderByDefault;
10199
10323
  protected insertIntoDOM(child: string | Node): void;
@@ -10406,6 +10530,19 @@ class TsEmbed {
10406
10530
  getThoughtSpotPostUrlParams(additionalParams?: {
10407
10531
  [key: string]: string | number;
10408
10532
  }): string;
10533
+ /**
10534
+ * Reverts the custom preRenderContainer's `position` to the value it had
10535
+ * before we overrode it to `relative` (see insertIntoDOMForPreRender).
10536
+ *
10537
+ * We restore the original inline value rather than forcing `static`, and we
10538
+ * skip the restore if another preRender wrapper is still mounted inside the
10539
+ * same container — a shared container still needs the positioning context.
10540
+ */
10541
+ private restorePreRenderContainerPosition;
10542
+ /**
10543
+ * Detaches and clears the container scroll listener, if one is attached.
10544
+ */
10545
+ private removeContainerScrollListener;
10409
10546
  /**
10410
10547
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
10411
10548
  * @version SDK: 1.19.1 | ThoughtSpot: *
@@ -10626,6 +10763,14 @@ export interface SpotterChatViewConfig {
10626
10763
  * @version SDK: 1.49.0 | ThoughtSpot: 26.6.0.cl
10627
10764
  */
10628
10765
  spotterFileUploadFileTypes?: SpotterFileUploadFileTypes;
10766
+ /**
10767
+ * Enables starter prompts in the Spotter chat interface.
10768
+ *
10769
+ * Supported embed types: SpotterEmbed, LiveboardEmbed, AppEmbed
10770
+ * @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
10771
+ * @default false
10772
+ */
10773
+ enableStarterPrompts?: boolean;
10629
10774
  }
10630
10775
  /**
10631
10776
  * The configuration for the embedded spotterEmbed options.
@@ -10960,6 +11105,12 @@ export interface SpotterVizStarterPrompt {
10960
11105
  * customStarterPrompts: [
10961
11106
  * { id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }
10962
11107
  * ],
11108
+ * // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
11109
+ * loaderHeadline: 'Crunching the numbers...',
11110
+ * loaderTips: [
11111
+ * { label: 'Tip', text: 'try asking about revenue by region' },
11112
+ * { label: 'Tip', text: 'use natural language' },
11113
+ * ],
10963
11114
  * },
10964
11115
  * })
10965
11116
  * ```
@@ -11004,6 +11155,29 @@ export interface SpotterVizConfig {
11004
11155
  * @version SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl
11005
11156
  */
11006
11157
  inputChatPlaceholder?: string;
11158
+ /**
11159
+ * Custom headline text shown in the SpotterViz loading state.
11160
+ * Replaces the default loading headline.
11161
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
11162
+ */
11163
+ loaderHeadline?: string;
11164
+ /**
11165
+ * Custom tips shown in the SpotterViz loading state.
11166
+ * Replaces the default loading tips with the provided list.
11167
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
11168
+ */
11169
+ loaderTips?: SpotterVizLoaderTip[];
11170
+ }
11171
+ /**
11172
+ * A single tip shown in the SpotterViz loading state.
11173
+ * @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
11174
+ * @group Embed components
11175
+ */
11176
+ export interface SpotterVizLoaderTip {
11177
+ /** Short label rendered alongside the tip (e.g. "Tip"). */
11178
+ label: string;
11179
+ /** Tip body text. */
11180
+ text: string;
11007
11181
  }
11008
11182
  /**
11009
11183
  * Pages within the ThoughtSpot app that can be embedded.
@@ -11760,7 +11934,13 @@ export interface AppViewConfig extends AllEmbedViewConfig {
11760
11934
  * description: 'Ask questions about your data',
11761
11935
  * inputChatPlaceholder: 'Ask a question...',
11762
11936
  * hideStarterPrompts: false,
11763
- * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }]
11937
+ * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }],
11938
+ * // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
11939
+ * loaderHeadline: 'Crunching the numbers...',
11940
+ * loaderTips: [
11941
+ * { label: 'Tip', text: 'try asking about revenue by region' },
11942
+ * { label: 'Tip', text: 'use natural language' },
11943
+ * ],
11764
11944
  * },
11765
11945
  * })
11766
11946
  * ```
@@ -12744,6 +12924,12 @@ export interface LiveboardViewConfig extends BaseViewConfig, SearchLiveboardComm
12744
12924
  * inputChatPlaceholder: 'Ask a question...',
12745
12925
  * hideStarterPrompts: false,
12746
12926
  * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }],
12927
+ * // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
12928
+ * loaderHeadline: 'Crunching the numbers...',
12929
+ * loaderTips: [
12930
+ * { label: 'Tip', text: 'try asking about revenue by region' },
12931
+ * { label: 'Tip', text: 'use natural language' },
12932
+ * ],
12747
12933
  * },
12748
12934
  * })
12749
12935
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.49.1",
3
+ "version": "1.49.3",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -45,7 +45,6 @@
45
45
  "lint": "eslint 'src/**'",
46
46
  "lint:fix": "eslint 'src/**/*.*' --fix",
47
47
  "tsc": "tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs",
48
- "build-and-publish": "npm run build:gatsby && npm run publish",
49
48
  "bundle-dts-file": "dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js && node dts-config/wrap-ambient-module.mjs",
50
49
  "bundle-dts": "dts-bundle-generator --config ./dts-config/dts-bundle.config.js",
51
50
  "bundle-dts-react": "dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js",
@@ -72,14 +71,12 @@
72
71
  "eventemitter3": "^4.0.7",
73
72
  "lodash": "^4.18.1",
74
73
  "mixpanel-browser": "2.47.0",
75
- "ts-deepmerge": "^6.0.2",
74
+ "ts-deepmerge": "^8.0.0",
76
75
  "tslib": "^2.5.3",
77
76
  "use-deep-compare-effect": "^1.8.1",
78
- "yaml": "^2.5.1"
77
+ "yaml": "^2.9.0"
79
78
  },
80
79
  "devDependencies": {
81
- "@mdx-js/mdx": "^1.6.22",
82
- "@mdx-js/react": "^1.6.22",
83
80
  "@react-icons/all-files": "^4.1.0",
84
81
  "@rollup/plugin-commonjs": "^18.0.0",
85
82
  "@rollup/plugin-json": "^4.1.0",
@@ -99,8 +96,6 @@
99
96
  "ajv": "^8.17.1",
100
97
  "asciidoctor": "^2.2.1",
101
98
  "babel-jest": "^30.2.0",
102
- "babel-preset-gatsby": "^1.10.0",
103
- "command-line-args": "^5.1.1",
104
99
  "coveralls-next": "^5.0.0",
105
100
  "crypto": "^1.0.1",
106
101
  "current-git-branch": "^1.1.0",
@@ -125,7 +120,6 @@
125
120
  "jest": "^30.2.0",
126
121
  "jest-environment-jsdom": "^29.7.0",
127
122
  "jest-fetch-mock": "^3.0.3",
128
- "jsdom": "^17.0.0",
129
123
  "prettier": "3.8.1",
130
124
  "react": "^16.14.0",
131
125
  "react-dom": "^16.14.0",
@@ -143,7 +137,7 @@
143
137
  "typescript-eslint": "^8.29.1",
144
138
  "url-search-params-polyfill": "^8.1.0",
145
139
  "util": "^0.12.4",
146
- "vite": "^6.3.5"
140
+ "vite": "^6.4.3"
147
141
  },
148
142
  "author": "ThoughtSpot",
149
143
  "email": "support@thoughtspot.com",
@@ -1165,4 +1165,24 @@ export interface CustomCssVariables {
1165
1165
  * header underline, left panel border, thinking step connector and dots.
1166
1166
  */
1167
1167
  '--ts-var-spotterviz-border-color'?: string;
1168
+
1169
+ /**
1170
+ * Background color of the reference-mode toggle button in the SpotterViz
1171
+ * chat input when it is unselected and the user hovers over it.
1172
+ */
1173
+ '--ts-var-spotterviz-reference-icon-hover-background'?: string;
1174
+
1175
+ /**
1176
+ * Icon color for the reference-mode selected state — applies to
1177
+ * both the toggle button when active and the icon badge on each
1178
+ * referenced-entity chip in the chat input.
1179
+ */
1180
+ '--ts-var-spotterviz-reference-icon-selected-color'?: string;
1181
+
1182
+ /**
1183
+ * Background color for the reference-mode selected state — applies to
1184
+ * both the reference mode toggle button when active and the icon badge
1185
+ * on each referenced-entity chip in the chat input.
1186
+ */
1187
+ '--ts-var-spotterviz-reference-icon-selected-background'?: string;
1168
1188
  }
@@ -757,6 +757,20 @@ describe('App embed tests', () => {
757
757
  });
758
758
  });
759
759
 
760
+ test('should set enableStarterPrompts to true in url', async () => {
761
+ const appEmbed = new AppEmbed(getRootEl(), {
762
+ ...defaultViewConfig,
763
+ spotterChatConfig: { enableStarterPrompts: true },
764
+ } as AppViewConfig);
765
+ appEmbed.render();
766
+ await executeAfterWait(() => {
767
+ expectUrlMatchesWithParams(
768
+ getIFrameSrc(),
769
+ `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&enableStarterPrompts=true${defaultParamsPost}#/home`,
770
+ );
771
+ });
772
+ });
773
+
760
774
  test('should set spotterFileUploadFileTypes in url', async () => {
761
775
  const appEmbed = new AppEmbed(getRootEl(), {
762
776
  ...defaultViewConfig,
@@ -2120,6 +2134,101 @@ describe('App Embed Default Height and Minimum Height Handling', () => {
2120
2134
  });
2121
2135
  });
2122
2136
 
2137
+ describe('AppEmbed uncovered branch tests', () => {
2138
+ beforeEach(() => {
2139
+ document.body.innerHTML = getDocumentBody();
2140
+ });
2141
+
2142
+ test('should set enableStopAnswerGenerationEmbed param when provided', async () => {
2143
+ const appEmbed = new AppEmbed(getRootEl(), {
2144
+ ...defaultViewConfig,
2145
+ enableStopAnswerGenerationEmbed: true,
2146
+ } as AppViewConfig);
2147
+ appEmbed.render();
2148
+ await executeAfterWait(() => {
2149
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
2150
+ enableStopAnswerGenerationEmbed: 'true',
2151
+ });
2152
+ });
2153
+ });
2154
+
2155
+ test('should set enableStopAnswerGenerationEmbed=false when set to false', async () => {
2156
+ const appEmbed = new AppEmbed(getRootEl(), {
2157
+ ...defaultViewConfig,
2158
+ enableStopAnswerGenerationEmbed: false,
2159
+ } as AppViewConfig);
2160
+ appEmbed.render();
2161
+ await executeAfterWait(() => {
2162
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
2163
+ enableStopAnswerGenerationEmbed: 'false',
2164
+ });
2165
+ });
2166
+ });
2167
+
2168
+ test('should set hideObjects param when non-empty array is provided', async () => {
2169
+ const appEmbed = new AppEmbed(getRootEl(), {
2170
+ ...defaultViewConfig,
2171
+ hideObjects: ['guid-123', 'guid-456'],
2172
+ } as AppViewConfig);
2173
+ appEmbed.render();
2174
+ await executeAfterWait(() => {
2175
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
2176
+ hideObjects: JSON.stringify(['guid-123', 'guid-456']),
2177
+ });
2178
+ });
2179
+ });
2180
+
2181
+ test('should not set hideObjects param when array is empty', async () => {
2182
+ const appEmbed = new AppEmbed(getRootEl(), {
2183
+ ...defaultViewConfig,
2184
+ hideObjects: [],
2185
+ } as AppViewConfig);
2186
+ appEmbed.render();
2187
+ await executeAfterWait(() => {
2188
+ const src = getIFrameSrc();
2189
+ expect(src).not.toContain('hideObjects');
2190
+ });
2191
+ });
2192
+
2193
+ test('should set liveboardV2 param when provided', async () => {
2194
+ const appEmbed = new AppEmbed(getRootEl(), {
2195
+ ...defaultViewConfig,
2196
+ liveboardV2: true,
2197
+ } as AppViewConfig);
2198
+ appEmbed.render();
2199
+ await executeAfterWait(() => {
2200
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
2201
+ isPinboardV2Enabled: 'true',
2202
+ });
2203
+ });
2204
+ });
2205
+
2206
+ test('should strip leading slash from path in getIFrameSrc', async () => {
2207
+ const appEmbed = new AppEmbed(getRootEl(), {
2208
+ ...defaultViewConfig,
2209
+ path: '/pinboards',
2210
+ } as AppViewConfig);
2211
+ appEmbed.render();
2212
+ await executeAfterWait(() => {
2213
+ const src = getIFrameSrc();
2214
+ expect(src).toContain('#/pinboards');
2215
+ expect(src).not.toContain('#//pinboards');
2216
+ });
2217
+ });
2218
+
2219
+ test('registerLazyLoadEvents should return early when iFrame is not set', () => {
2220
+ const appEmbed = new AppEmbed(getRootEl(), {
2221
+ ...defaultViewConfig,
2222
+ fullHeight: true,
2223
+ lazyLoadingForFullHeight: true,
2224
+ } as AppViewConfig);
2225
+ // iFrame is not set (render not called), should not throw
2226
+ expect(() => {
2227
+ (appEmbed as any).registerLazyLoadEvents();
2228
+ }).not.toThrow();
2229
+ });
2230
+ });
2231
+
2123
2232
  describe('AppEmbed visualOverrides tests', () => {
2124
2233
  test('should include visualOverridesParams in APP_INIT when visualOverrides config is provided', async () => {
2125
2234
  const visualOverrides = {
package/src/embed/app.ts CHANGED
@@ -798,7 +798,13 @@ export interface AppViewConfig extends AllEmbedViewConfig {
798
798
  * description: 'Ask questions about your data',
799
799
  * inputChatPlaceholder: 'Ask a question...',
800
800
  * hideStarterPrompts: false,
801
- * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }]
801
+ * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }],
802
+ * // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
803
+ * loaderHeadline: 'Crunching the numbers...',
804
+ * loaderTips: [
805
+ * { label: 'Tip', text: 'try asking about revenue by region' },
806
+ * { label: 'Tip', text: 'use natural language' },
807
+ * ],
802
808
  * },
803
809
  * })
804
810
  * ```
@@ -1030,6 +1036,7 @@ export class AppEmbed extends V1Embed {
1030
1036
  toolResponseCardBrandingLabel,
1031
1037
  spotterFileUploadEnabled,
1032
1038
  spotterFileUploadFileTypes,
1039
+ enableStarterPrompts,
1033
1040
  } = spotterChatConfig;
1034
1041
 
1035
1042
  setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
@@ -1037,6 +1044,9 @@ export class AppEmbed extends V1Embed {
1037
1044
  if (spotterFileUploadEnabled !== undefined) {
1038
1045
  params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
1039
1046
  }
1047
+ if (enableStarterPrompts !== undefined) {
1048
+ params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
1049
+ }
1040
1050
  if (spotterFileUploadFileTypes !== undefined) {
1041
1051
  params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
1042
1052
  }
@@ -369,6 +369,23 @@ describe('ConversationEmbed', () => {
369
369
  );
370
370
  });
371
371
 
372
+ it('should render the conversation embed with enableStarterPrompts', async () => {
373
+ const viewConfig: SpotterEmbedViewConfig = {
374
+ worksheetId: 'worksheetId',
375
+ searchOptions: {
376
+ searchQuery: 'searchQuery',
377
+ },
378
+ spotterChatConfig: { enableStarterPrompts: true },
379
+ };
380
+
381
+ const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
382
+ await conversationEmbed.render();
383
+ expectUrlMatchesWithParams(
384
+ getIFrameSrc(),
385
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enableStarterPrompts=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
386
+ );
387
+ });
388
+
372
389
  it('should render the conversation embed with spotterFileUploadFileTypes', async () => {
373
390
  const viewConfig: SpotterEmbedViewConfig = {
374
391
  worksheetId: 'worksheetId',
@@ -128,6 +128,14 @@ export interface SpotterChatViewConfig {
128
128
  * @version SDK: 1.49.0 | ThoughtSpot: 26.6.0.cl
129
129
  */
130
130
  spotterFileUploadFileTypes?: SpotterFileUploadFileTypes;
131
+ /**
132
+ * Enables starter prompts in the Spotter chat interface.
133
+ *
134
+ * Supported embed types: SpotterEmbed, LiveboardEmbed, AppEmbed
135
+ * @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
136
+ * @default false
137
+ */
138
+ enableStarterPrompts?: boolean;
131
139
  }
132
140
 
133
141
  /**
@@ -467,11 +475,13 @@ export class SpotterEmbed extends TsEmbed {
467
475
  toolResponseCardBrandingLabel,
468
476
  spotterFileUploadEnabled,
469
477
  spotterFileUploadFileTypes,
478
+ enableStarterPrompts,
470
479
  } = spotterChatConfig;
471
480
 
472
481
  setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
473
482
  setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
474
483
  setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
484
+ setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
475
485
  if (spotterFileUploadFileTypes !== undefined) {
476
486
  queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
477
487
  }
@@ -374,3 +374,10 @@ describe('Americanized enum alias values', () => {
374
374
  expect(Action.OrganizeFavorites).toBe(Action.OrganiseFavourites);
375
375
  });
376
376
  });
377
+
378
+ describe('Action enum values', () => {
379
+
380
+ test('RemoveFromFavorites should resolve to its string value', () => {
381
+ expect(Action.RemoveFromFavorites).toBe('removeFromFavorites');
382
+ });
383
+ });
@@ -1281,6 +1281,21 @@ describe('Liveboard/viz embed tests', () => {
1281
1281
  });
1282
1282
  });
1283
1283
 
1284
+ test('should set enableStarterPrompts parameter in url params', async () => {
1285
+ const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1286
+ ...defaultViewConfig,
1287
+ liveboardId,
1288
+ spotterChatConfig: { enableStarterPrompts: true },
1289
+ } as LiveboardViewConfig);
1290
+ await liveboardEmbed.render();
1291
+ await executeAfterWait(() => {
1292
+ expectUrlMatchesWithParams(
1293
+ getIFrameSrc(),
1294
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableStarterPrompts=true#/embed/viz/${liveboardId}`,
1295
+ );
1296
+ });
1297
+ });
1298
+
1284
1299
  test('should set spotterFileUploadFileTypes parameter in url params', async () => {
1285
1300
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1286
1301
  ...defaultViewConfig,
@@ -574,6 +574,12 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
574
574
  * inputChatPlaceholder: 'Ask a question...',
575
575
  * hideStarterPrompts: false,
576
576
  * customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }],
577
+ * // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
578
+ * loaderHeadline: 'Crunching the numbers...',
579
+ * loaderTips: [
580
+ * { label: 'Tip', text: 'try asking about revenue by region' },
581
+ * { label: 'Tip', text: 'use natural language' },
582
+ * ],
577
583
  * },
578
584
  * })
579
585
  * ```
@@ -791,6 +797,7 @@ export class LiveboardEmbed extends V1Embed {
791
797
  toolResponseCardBrandingLabel,
792
798
  spotterFileUploadEnabled,
793
799
  spotterFileUploadFileTypes,
800
+ enableStarterPrompts,
794
801
  } = spotterChatConfig;
795
802
 
796
803
  setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
@@ -798,6 +805,9 @@ export class LiveboardEmbed extends V1Embed {
798
805
  if (spotterFileUploadEnabled !== undefined) {
799
806
  params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
800
807
  }
808
+ if (enableStarterPrompts !== undefined) {
809
+ params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
810
+ }
801
811
  if (spotterFileUploadFileTypes !== undefined) {
802
812
  params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
803
813
  }