@thoughtspot/visual-embed-sdk 1.51.1 → 1.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/api-intercept.d.ts.map +1 -1
  3. package/cjs/src/api-intercept.js +1 -0
  4. package/cjs/src/api-intercept.js.map +1 -1
  5. package/cjs/src/css-variables.d.ts +1 -1
  6. package/cjs/src/embed/conversation.d.ts +5 -5
  7. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  8. package/cjs/src/embed/liveboard.js +2 -1
  9. package/cjs/src/embed/liveboard.js.map +1 -1
  10. package/cjs/src/embed/liveboard.spec.js +4 -4
  11. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  12. package/cjs/src/embed/search.spec.js +28 -0
  13. package/cjs/src/embed/search.spec.js.map +1 -1
  14. package/cjs/src/embed/ts-embed.d.ts +86 -5
  15. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  16. package/cjs/src/embed/ts-embed.js +30 -19
  17. package/cjs/src/embed/ts-embed.js.map +1 -1
  18. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  19. package/cjs/src/embed/ts-embed.spec.js +55 -16
  20. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  21. package/cjs/src/index.d.ts +2 -2
  22. package/cjs/src/index.d.ts.map +1 -1
  23. package/cjs/src/index.js +2 -1
  24. package/cjs/src/index.js.map +1 -1
  25. package/cjs/src/react/all-types-export.d.ts +1 -1
  26. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  27. package/cjs/src/react/all-types-export.js +2 -1
  28. package/cjs/src/react/all-types-export.js.map +1 -1
  29. package/cjs/src/react/index.d.ts +8 -8
  30. package/cjs/src/react/index.d.ts.map +1 -1
  31. package/cjs/src/react/index.js +1 -1
  32. package/cjs/src/react/index.js.map +1 -1
  33. package/cjs/src/react/index.spec.js +7 -7
  34. package/cjs/src/react/index.spec.js.map +1 -1
  35. package/cjs/src/types.d.ts +124 -36
  36. package/cjs/src/types.d.ts.map +1 -1
  37. package/cjs/src/types.js +80 -12
  38. package/cjs/src/types.js.map +1 -1
  39. package/cjs/src/utils.d.ts +5 -0
  40. package/cjs/src/utils.d.ts.map +1 -1
  41. package/cjs/src/utils.js +19 -1
  42. package/cjs/src/utils.js.map +1 -1
  43. package/cjs/src/utils.spec.js +33 -0
  44. package/cjs/src/utils.spec.js.map +1 -1
  45. package/dist/{index-DxLfQxoT.js → index-BMppCU63.js} +1 -1
  46. package/dist/src/api-intercept.d.ts.map +1 -1
  47. package/dist/src/css-variables.d.ts +1 -1
  48. package/dist/src/embed/conversation.d.ts +5 -5
  49. package/dist/src/embed/liveboard.d.ts.map +1 -1
  50. package/dist/src/embed/ts-embed.d.ts +86 -5
  51. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  52. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  53. package/dist/src/index.d.ts +2 -2
  54. package/dist/src/index.d.ts.map +1 -1
  55. package/dist/src/react/all-types-export.d.ts +1 -1
  56. package/dist/src/react/all-types-export.d.ts.map +1 -1
  57. package/dist/src/react/index.d.ts +8 -8
  58. package/dist/src/react/index.d.ts.map +1 -1
  59. package/dist/src/types.d.ts +124 -36
  60. package/dist/src/types.d.ts.map +1 -1
  61. package/dist/src/utils.d.ts +5 -0
  62. package/dist/src/utils.d.ts.map +1 -1
  63. package/dist/tsembed-react.es.js +133 -35
  64. package/dist/tsembed-react.js +132 -34
  65. package/dist/tsembed.es.js +133 -35
  66. package/dist/tsembed.js +131 -33
  67. package/dist/visual-embed-sdk-react-full.d.ts +223 -54
  68. package/dist/visual-embed-sdk-react.d.ts +199 -53
  69. package/dist/visual-embed-sdk.d.ts +215 -46
  70. package/lib/package.json +1 -1
  71. package/lib/src/api-intercept.d.ts.map +1 -1
  72. package/lib/src/api-intercept.js +2 -1
  73. package/lib/src/api-intercept.js.map +1 -1
  74. package/lib/src/css-variables.d.ts +1 -1
  75. package/lib/src/embed/conversation.d.ts +5 -5
  76. package/lib/src/embed/liveboard.d.ts.map +1 -1
  77. package/lib/src/embed/liveboard.js +3 -2
  78. package/lib/src/embed/liveboard.js.map +1 -1
  79. package/lib/src/embed/liveboard.spec.js +4 -4
  80. package/lib/src/embed/liveboard.spec.js.map +1 -1
  81. package/lib/src/embed/search.spec.js +28 -0
  82. package/lib/src/embed/search.spec.js.map +1 -1
  83. package/lib/src/embed/ts-embed.d.ts +86 -5
  84. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  85. package/lib/src/embed/ts-embed.js +32 -21
  86. package/lib/src/embed/ts-embed.js.map +1 -1
  87. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  88. package/lib/src/embed/ts-embed.spec.js +56 -17
  89. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  90. package/lib/src/index.d.ts +2 -2
  91. package/lib/src/index.d.ts.map +1 -1
  92. package/lib/src/index.js +2 -2
  93. package/lib/src/index.js.map +1 -1
  94. package/lib/src/react/all-types-export.d.ts +1 -1
  95. package/lib/src/react/all-types-export.d.ts.map +1 -1
  96. package/lib/src/react/all-types-export.js +1 -1
  97. package/lib/src/react/all-types-export.js.map +1 -1
  98. package/lib/src/react/index.d.ts +8 -8
  99. package/lib/src/react/index.d.ts.map +1 -1
  100. package/lib/src/react/index.js +1 -1
  101. package/lib/src/react/index.js.map +1 -1
  102. package/lib/src/react/index.spec.js +7 -7
  103. package/lib/src/react/index.spec.js.map +1 -1
  104. package/lib/src/types.d.ts +124 -36
  105. package/lib/src/types.d.ts.map +1 -1
  106. package/lib/src/types.js +79 -11
  107. package/lib/src/types.js.map +1 -1
  108. package/lib/src/utils.d.ts +5 -0
  109. package/lib/src/utils.d.ts.map +1 -1
  110. package/lib/src/utils.js +17 -0
  111. package/lib/src/utils.js.map +1 -1
  112. package/lib/src/utils.spec.js +34 -1
  113. package/lib/src/utils.spec.js.map +1 -1
  114. package/lib/src/visual-embed-sdk.d.ts +215 -46
  115. package/package.json +1 -1
  116. package/src/api-intercept.ts +2 -1
  117. package/src/css-variables.ts +1 -1
  118. package/src/embed/conversation.ts +5 -5
  119. package/src/embed/liveboard.spec.ts +4 -4
  120. package/src/embed/liveboard.ts +3 -1
  121. package/src/embed/search.spec.ts +31 -0
  122. package/src/embed/ts-embed.spec.ts +70 -16
  123. package/src/embed/ts-embed.ts +32 -20
  124. package/src/index.ts +2 -0
  125. package/src/react/all-types-export.ts +1 -0
  126. package/src/react/index.spec.tsx +7 -7
  127. package/src/react/index.tsx +9 -9
  128. package/src/types.ts +125 -36
  129. package/src/utils.spec.ts +44 -0
  130. package/src/utils.ts +16 -0
@@ -444,7 +444,7 @@ export interface CustomCssVariables {
444
444
  * Left and right margin of the header and the tab/filter section of an
445
445
  * embedded Liveboard. Use alongside the `liveboardGutter` view config to
446
446
  * keep the header aligned with a custom tile-grid gutter.
447
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
447
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
448
448
  */
449
449
  "--ts-var-liveboard-header-horizontal-margin"?: string;
450
450
  /**
@@ -2155,9 +2155,11 @@ export interface FrameParams {
2155
2155
  }
2156
2156
  /**
2157
2157
  * Configuration for the pre-render wrapper element.
2158
- * All properties here mirror the top-level preRender properties on
2159
- * {@link BaseViewConfig} and take precedence over them when both are set,
2160
- * so existing top-level usage continues to work without any changes.
2158
+ * Each property here supersedes its deprecated top-level counterpart on
2159
+ * {@link BaseViewConfig} `id` over `preRenderId`, `containerSelector` over
2160
+ * `preRenderContainer` and `doNotTrackSize` over `doNotTrackPreRenderSize`
2161
+ * and takes precedence when both are set, so existing top-level usage continues
2162
+ * to work without any changes.
2161
2163
  *
2162
2164
  * @version SDK: 1.52.0
2163
2165
  * @example
@@ -2165,9 +2167,9 @@ export interface FrameParams {
2165
2167
  * init({ thoughtSpotHost: '...', authType: AuthType.None });
2166
2168
  * const embed = new LiveboardEmbed('#tsEmbed', {
2167
2169
  * preRenderConfig: {
2168
- * preRenderId: 'my-liveboard',
2169
- * preRenderContainer: '#my-scroll-container',
2170
- * doNotTrackPreRenderSize: false,
2170
+ * id: 'my-liveboard',
2171
+ * containerSelector: '#my-scroll-container',
2172
+ * doNotTrackSize: false,
2171
2173
  * zIndex: -10,
2172
2174
  * },
2173
2175
  * });
@@ -2188,7 +2190,7 @@ export interface PreRenderConfig {
2188
2190
  *
2189
2191
  * @default undefined
2190
2192
  */
2191
- preRenderId?: string;
2193
+ id?: string;
2192
2194
  /**
2193
2195
  * The DOM element or CSS selector string specifying the container into
2194
2196
  * which the pre-rendered wrapper is inserted.
@@ -2204,7 +2206,7 @@ export interface PreRenderConfig {
2204
2206
  *
2205
2207
  * @default document.body
2206
2208
  */
2207
- preRenderContainer?: string | HTMLElement;
2209
+ containerSelector?: string | HTMLElement;
2208
2210
  /**
2209
2211
  * Disables the `ResizeObserver` that keeps the wrapper sized to the
2210
2212
  * placeholder element.
@@ -2216,7 +2218,7 @@ export interface PreRenderConfig {
2216
2218
  *
2217
2219
  * @default false
2218
2220
  */
2219
- doNotTrackPreRenderSize?: boolean;
2221
+ doNotTrackSize?: boolean;
2220
2222
  /**
2221
2223
  * CSS `z-index` value applied to the pre-render wrapper when hidden.
2222
2224
  * Override this when the host page's stacking context does not reach `-1000`
@@ -2423,7 +2425,7 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2423
2425
  *
2424
2426
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
2425
2427
  * @version SDK: 1.25.0 | ThoughtSpot: 9.6.0.cl, 9.8.0.sw
2426
- * @deprecated Use {@link PreRenderConfig.preRenderId} via `preRenderConfig` instead.
2428
+ * @deprecated Use {@link PreRenderConfig.id} via `preRenderConfig` instead.
2427
2429
  * @example
2428
2430
  * ```js
2429
2431
  * // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
@@ -2443,7 +2445,7 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2443
2445
  * @type {boolean}
2444
2446
  * @default false
2445
2447
  * @version SDK: 1.24.0 | ThoughtSpot: 9.4.0.cl, 9.4.0.sw
2446
- * @deprecated Use {@link PreRenderConfig.doNotTrackPreRenderSize} via `preRenderConfig` instead.
2448
+ * @deprecated Use {@link PreRenderConfig.doNotTrackSize} via `preRenderConfig` instead.
2447
2449
  * @example
2448
2450
  * ```js
2449
2451
  * // Disable tracking PreRender size in the configuration
@@ -2485,7 +2487,7 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2485
2487
  *
2486
2488
  * @type {string | HTMLElement}
2487
2489
  * @version SDK: 1.49.2 | ThoughtSpot: *
2488
- * @deprecated Use {@link PreRenderConfig.preRenderContainer} via `preRenderConfig` instead.
2490
+ * @deprecated Use {@link PreRenderConfig.containerSelector} via `preRenderConfig` instead.
2489
2491
  * @example
2490
2492
  * ```js
2491
2493
  * const embed = new LiveboardEmbed('#tsEmbed', {
@@ -2498,9 +2500,11 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2498
2500
  preRenderContainer?: string | HTMLElement;
2499
2501
  /**
2500
2502
  * Configuration for the pre-render wrapper element.
2501
- * All properties here mirror the top-level preRender properties on
2502
- * `BaseViewConfig` and take precedence over them when both are set,
2503
- * so existing top-level usage continues to work without any changes.
2503
+ * Each property here supersedes its deprecated top-level counterpart on
2504
+ * `BaseViewConfig` `id` over `preRenderId`, `containerSelector` over
2505
+ * `preRenderContainer` and `doNotTrackSize` over `doNotTrackPreRenderSize`
2506
+ * and takes precedence when both are set, so existing top-level usage
2507
+ * continues to work without any changes.
2504
2508
  * See {@link PreRenderConfig} for available options.
2505
2509
  *
2506
2510
  * @version SDK: 1.52.0
@@ -2508,7 +2512,7 @@ export interface BaseViewConfig extends ApiInterceptFlags {
2508
2512
  * ```js
2509
2513
  * const embed = new LiveboardEmbed('#tsEmbed', {
2510
2514
  * preRenderConfig: {
2511
- * preRenderId: 'my-liveboard',
2515
+ * id: 'my-liveboard',
2512
2516
  * zIndex: -10,
2513
2517
  * },
2514
2518
  * });
@@ -3275,7 +3279,7 @@ export interface LiveboardAppEmbedViewConfig {
3275
3279
  *
3276
3280
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`
3277
3281
  * @type {boolean}
3278
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
3282
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
3279
3283
  * @default false
3280
3284
  * @example
3281
3285
  * ```js
@@ -3400,7 +3404,7 @@ export interface LiveboardAppEmbedViewConfig {
3400
3404
  *
3401
3405
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`
3402
3406
  * @type {number}
3403
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
3407
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
3404
3408
  * @example
3405
3409
  * ```js
3406
3410
  * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
@@ -5048,7 +5052,32 @@ export enum EmbedEvent {
5048
5052
  */
5049
5053
  OrgSwitched = "orgSwitched",
5050
5054
  /**
5051
- * Emitted when the user intercepts a URL.
5055
+ * Emitted before the embedded ThoughtSpot app sends a network request whose
5056
+ * fully resolved URL matches one of the `interceptUrls` in the view config.
5057
+ * The request is held until you call `responder`, which decides whether the
5058
+ * real request goes out or a response you supply is used in its place.
5059
+ *
5060
+ * Setting `interceptUrls` is what enables this; there is no separate enable
5061
+ * flag. If `responder` is not called within `interceptTimeout` (30000 ms by
5062
+ * default) the request fails and `EmbedEvent.Error` is emitted.
5063
+ *
5064
+ * The payload is `{ input, init, urlType }`, where `input` is the request
5065
+ * URL and `init` is the `fetch` init object, with `init.body` parsed into an
5066
+ * object when it is valid JSON. `urlType` is the matching
5067
+ * `InterceptedApiType`; it is `InterceptedApiType.ALL` for any URL outside
5068
+ * the recognized API groups.
5069
+ *
5070
+ * Interception wraps the outermost layer of `fetch`, so `init` holds the
5071
+ * request as the application composed it, before ThoughtSpot attaches its
5072
+ * authentication headers. Those headers, and any token refresh and retry,
5073
+ * are applied afterwards and only when you pass `execute: true`. Only
5074
+ * requests made through `fetch` are intercepted.
5075
+ *
5076
+ * Pass `execute: true` to let the original request proceed untouched, in
5077
+ * which case any `response` you supply alongside it is ignored. With
5078
+ * `execute: false` the request is never sent, and your `response.body` is
5079
+ * returned to the app as JSON, defaulting to status 200 and a
5080
+ * `Content-Type: application/json` header.
5052
5081
  *
5053
5082
  * Supported on all embed types.
5054
5083
  *
@@ -5857,7 +5886,7 @@ export enum HostEvent {
5857
5886
  *
5858
5887
  * Unlike {@link HostEvent.OpenFilter}, which opens the panel of an
5859
5888
  * existing filter, this event starts the creation of a new filter.
5860
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
5889
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
5861
5890
  * @example
5862
5891
  * ```js
5863
5892
  * liveboardEmbed.trigger(HostEvent.OpenAddFilterModal);
@@ -5873,7 +5902,7 @@ export enum HostEvent {
5873
5902
  * Hiding the *Add parameter* button with `hiddenActions:
5874
5903
  * [Action.AddParameter]` does not block this event, but disabling it
5875
5904
  * with `disabledActions` does.
5876
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
5905
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
5877
5906
  * @example
5878
5907
  * ```js
5879
5908
  * liveboardEmbed.trigger(HostEvent.OpenAddParameterModal);
@@ -7750,7 +7779,13 @@ export enum HostEvent {
7750
7779
  */
7751
7780
  UpdateEmbedParams = "updateEmbedParams",
7752
7781
  /**
7753
- * Triggered when the embed needs to be destroyed. This is used to clean up any embed-related resources internally.
7782
+ * Notifies the embedded ThoughtSpot app that the embed is being torn down, so that
7783
+ * it can release any resources it holds before the iframe is removed from the DOM.
7784
+ *
7785
+ * This is triggered for you by `embed.destroy()`; you rarely need to trigger it
7786
+ * directly. If `waitForCleanupOnDestroy` is set in the embed config, `destroy()`
7787
+ * waits for the app to acknowledge this event (up to `cleanupTimeout`) before
7788
+ * removing the iframe.
7754
7789
  * @example
7755
7790
  * ```js
7756
7791
  * liveboardEmbed.trigger(HostEvent.DestroyEmbed);
@@ -9700,7 +9735,7 @@ export enum Action {
9700
9735
  * ```js
9701
9736
  * hiddenActions: [Action.QuickSearchPill]
9702
9737
  * ```
9703
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
9738
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
9704
9739
  */
9705
9740
  QuickSearchPill = "quickSearchPill",
9706
9741
  /**
@@ -9715,7 +9750,7 @@ export enum Action {
9715
9750
  * ```js
9716
9751
  * hiddenActions: [Action.DeepAnalysisPill]
9717
9752
  * ```
9718
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
9753
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
9719
9754
  */
9720
9755
  DeepAnalysisPill = "deepAnalysisPill",
9721
9756
  /**
@@ -9730,7 +9765,7 @@ export enum Action {
9730
9765
  * ```js
9731
9766
  * hiddenActions: [Action.DataLiteracyPill]
9732
9767
  * ```
9733
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
9768
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
9734
9769
  */
9735
9770
  DataLiteracyPill = "dataLiteracyPill",
9736
9771
  /**
@@ -10311,9 +10346,40 @@ export interface EmbedErrorDetailsEvent {
10311
10346
  message: string | string[];
10312
10347
  /** Machine-readable error code for programmatic error handling */
10313
10348
  code: EmbedErrorCodes;
10349
+ /** How badly the embed is affected. Defaults to {@link EmbedErrorSeverity.SEV3}. */
10350
+ severity?: EmbedErrorSeverity;
10314
10351
  /** Additional context-specific for backward compatibility */
10315
10352
  [key: string]: any;
10316
10353
  }
10354
+ /**
10355
+ * How badly an error affects the embed, so the host can decide whether it is
10356
+ * worth surfacing to the end user.
10357
+ *
10358
+ * Mirrors the severity that ThoughtSpot itself stamps on errors raised inside
10359
+ * the embedded app, so a host can apply one rule to both sources.
10360
+ *
10361
+ * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
10362
+ * @group Error Handling
10363
+ *
10364
+ * @example
10365
+ * Only surface errors that took the embed down
10366
+ *
10367
+ * ```js
10368
+ * embed.on(EmbedEvent.Error, (error) => {
10369
+ * if (error.severity === EmbedErrorSeverity.SEV1) {
10370
+ * showBanner(error.message);
10371
+ * }
10372
+ * });
10373
+ * ```
10374
+ */
10375
+ export enum EmbedErrorSeverity {
10376
+ /** The embed cannot render. Nothing usable is on screen. */
10377
+ SEV1 = 1,
10378
+ /** Something is degraded but the embed still works. */
10379
+ SEV2 = 2,
10380
+ /** Everything else, including validation of the embedder's own input. */
10381
+ SEV3 = 3
10382
+ }
10317
10383
  /**
10318
10384
  * Context types for specifying the page context when triggering host events.
10319
10385
  * Used as the third parameter in the `trigger` method to help ThoughtSpot
@@ -10371,25 +10437,40 @@ export interface DefaultAppInitData {
10371
10437
  useHostEventsV2?: boolean;
10372
10438
  }
10373
10439
  /**
10374
- * Enum for the type of API intercepted
10440
+ * Named groups of ThoughtSpot APIs that can be intercepted, for use in
10441
+ * `interceptUrls`. Each group expands to the underlying request URLs, so you do
10442
+ * not have to list them individually.
10375
10443
  */
10376
10444
  export enum InterceptedApiType {
10377
10445
  /**
10378
- * The apis that are use to get the data for the embed
10446
+ * The APIs that fetch the data backing an Answer, including its chart,
10447
+ * table, and headline data.
10379
10448
  */
10380
10449
  AnswerData = "AnswerData",
10381
10450
  /**
10382
- * This will intercept all the apis
10451
+ * Intercepts every `fetch` request the embedded application makes, not only
10452
+ * the data APIs. This includes authentication, session, and metadata calls,
10453
+ * so the handler must respond to requests it does not recognize by passing
10454
+ * `execute: true`. Listing this alongside other entries in `interceptUrls`
10455
+ * supersedes them.
10383
10456
  */
10384
10457
  ALL = "ALL",
10385
10458
  /**
10386
- * The apis that are use to get the data for the liveboard
10459
+ * The APIs that fetch the data backing a Liveboard.
10387
10460
  */
10388
10461
  LiveboardData = "LiveboardData"
10389
10462
  }
10390
10463
  export type ApiInterceptFlags = {
10391
10464
  /**
10392
- * Flag that allows using `EmbedEvent.OnBeforeGetVizDataIntercept`.
10465
+ * Emits `EmbedEvent.OnBeforeGetVizDataIntercept` before the Answer data
10466
+ * APIs are called. This is the earlier, narrower form of interception, kept
10467
+ * for backward compatibility and implemented on top of
10468
+ * `EmbedEvent.ApiIntercept`. Prefer `interceptUrls` with
10469
+ * `InterceptedApiType.AnswerData` in new code.
10470
+ *
10471
+ * Setting this also intercepts the Answer data APIs, so both
10472
+ * `EmbedEvent.OnBeforeGetVizDataIntercept` and `EmbedEvent.ApiIntercept`
10473
+ * are emitted for those requests.
10393
10474
  *
10394
10475
  * Can be used for Search and App Embed from SDK 1.29.0
10395
10476
  *
@@ -10397,14 +10478,21 @@ export type ApiInterceptFlags = {
10397
10478
  */
10398
10479
  isOnBeforeGetVizDataInterceptEnabled?: boolean;
10399
10480
  /**
10400
- * This allows to intercept the urls passed, once intercepted the api will only
10401
- * run based on the response from the responder of ApiIntercept event.
10481
+ * The requests to intercept, given as `InterceptedApiType` groups, absolute
10482
+ * URLs, or paths beginning with `/` that are resolved against the
10483
+ * ThoughtSpot host. Setting this is what turns interception on.
10484
+ *
10485
+ * A URL matches only on exact equality with the request's fully resolved
10486
+ * URL, query string included, so prefer an `InterceptedApiType` group where
10487
+ * one covers the API you need.
10488
+ *
10489
+ * Each intercepted request pauses and emits `EmbedEvent.ApiIntercept`, then
10490
+ * proceeds according to the response passed to that event's responder.
10402
10491
  *
10403
10492
  * @example
10404
10493
  * ```js
10405
10494
  * const embed = new LiveboardEmbed('#embed', {
10406
10495
  * ...viewConfig,
10407
- * enableApiIntercept: true,
10408
10496
  * interceptUrls: [InterceptedApiType.LiveboardData],
10409
10497
  * })
10410
10498
  * ```
@@ -10413,14 +10501,14 @@ export type ApiInterceptFlags = {
10413
10501
  */
10414
10502
  interceptUrls?: (string | InterceptedApiType)[];
10415
10503
  /**
10416
- * The timeout for the intercept, default is 30000ms
10417
- * the api will error out if the timeout is reached
10504
+ * How long, in milliseconds, an intercepted request waits for the
10505
+ * `EmbedEvent.ApiIntercept` responder before it is abandoned. Defaults to
10506
+ * 30000. On timeout the request fails and `EmbedEvent.Error` is emitted.
10418
10507
  *
10419
10508
  * @example
10420
10509
  * ```js
10421
10510
  * const embed = new LiveboardEmbed('#embed', {
10422
10511
  * ...viewConfig,
10423
- * enableApiIntercept: true,
10424
10512
  * interceptUrls: [InterceptedApiType.ALL],
10425
10513
  * interceptTimeout: 1000,
10426
10514
  * })
@@ -11356,7 +11444,87 @@ class TsEmbed {
11356
11444
  * @param query
11357
11445
  */
11358
11446
  protected getEmbedBasePath(query: string): string;
11359
- protected getUpdateEmbedParamsObject(): Promise<Record<any, any>>;
11447
+ protected getUpdateEmbedParamsObject(): Promise<{
11448
+ customisations: CustomisationsInterface;
11449
+ authToken: string;
11450
+ runtimeFilterParams: string;
11451
+ runtimeParameterParams: string;
11452
+ hiddenHomepageModules: HomepageModule[];
11453
+ reorderedHomepageModules: string[];
11454
+ hostConfig: Record<string, any>;
11455
+ hiddenHomeLeftNavItems: string[];
11456
+ customVariablesForThirdPartyTools: Record<string, any>;
11457
+ hiddenListColumns: ListPageColumns[];
11458
+ customActions: CustomAction[];
11459
+ interceptTimeout: number;
11460
+ interceptUrls: string[];
11461
+ embedExpiryInAuthToken: boolean;
11462
+ shouldBypassPayloadValidation?: boolean;
11463
+ useHostEventsV2?: boolean;
11464
+ layoutConfig?: LayoutConfig;
11465
+ frameParams?: FrameParams;
11466
+ theme?: string;
11467
+ styleSheet__unstable?: string;
11468
+ disabledActions?: Action[];
11469
+ disabledActionReason?: string;
11470
+ hiddenActions?: Action[];
11471
+ visibleActions?: Action[];
11472
+ locale?: string;
11473
+ additionalFlags?: {
11474
+ [key: string]: string | number | boolean;
11475
+ };
11476
+ customizations?: CustomisationsInterface;
11477
+ insertAsSibling?: boolean;
11478
+ usePrerenderedIfAvailable?: boolean;
11479
+ preRenderId?: string;
11480
+ doNotTrackPreRenderSize?: boolean;
11481
+ preRenderContainer?: string | HTMLElement;
11482
+ preRenderConfig?: PreRenderConfig;
11483
+ enableV2Shell_experimental?: boolean;
11484
+ embedComponentType?: string;
11485
+ exposeTranslationIDs?: boolean;
11486
+ disableRedirectionLinksInNewTab?: boolean;
11487
+ overrideOrgId?: number;
11488
+ overrideHistoryState?: boolean;
11489
+ linkOverride?: boolean;
11490
+ enableLinkOverridesV2?: boolean;
11491
+ primaryAction?: string;
11492
+ insertInToSlide?: boolean;
11493
+ showAlerts?: boolean;
11494
+ refreshAuthTokenOnNearExpiry?: boolean;
11495
+ isOnBeforeGetVizDataInterceptEnabled?: boolean;
11496
+ runtimeFilters?: RuntimeFilter[];
11497
+ runtimeParameters?: RuntimeParameter[];
11498
+ contextMenuTrigger?: ContextMenuTriggerOptions;
11499
+ excludeRuntimeFiltersfromURL?: boolean;
11500
+ excludeRuntimeParametersfromURL?: boolean;
11501
+ collapseSearchBar?: boolean;
11502
+ dataPanelV2?: boolean;
11503
+ enableCustomColumnGroups?: boolean;
11504
+ isThisPeriodInDateFiltersEnabled?: boolean;
11505
+ hideLiveboardHeader?: boolean;
11506
+ showLiveboardTitle?: boolean;
11507
+ showLiveboardDescription?: boolean;
11508
+ isLiveboardHeaderSticky?: boolean;
11509
+ enable2ColumnLayout?: boolean;
11510
+ isLiveboardAlwaysOn12ColLayout?: boolean;
11511
+ isLiveboardCompactHeaderEnabled?: boolean;
11512
+ showLiveboardVerifiedBadge?: boolean;
11513
+ hideIrrelevantChipsInLiveboardTabs?: boolean;
11514
+ showLiveboardReverifyBanner?: boolean;
11515
+ enableAskSage?: boolean;
11516
+ coverAndFilterOptionInPDF?: boolean;
11517
+ liveboardGutter?: number;
11518
+ isCentralizedLiveboardFilterUXEnabled?: boolean;
11519
+ isScopedLiveboardFilteringEnabled?: boolean;
11520
+ isLinkParametersEnabled?: boolean;
11521
+ isEnhancedFilterInteractivityEnabled?: boolean;
11522
+ showMaskedFilterChip?: boolean;
11523
+ isLiveboardMasterpiecesEnabled?: boolean;
11524
+ newChartsLibrary?: boolean;
11525
+ visibleTabs?: string[];
11526
+ hiddenTabs?: string[];
11527
+ }>;
11360
11528
  /**
11361
11529
  * Common query params set for all the embed modes.
11362
11530
  * @param queryParams
@@ -11376,9 +11544,10 @@ class TsEmbed {
11376
11544
  protected getRootIframeSrc(): string;
11377
11545
  protected createIframeEl(frameSrc: string): HTMLIFrameElement;
11378
11546
  /**
11379
- * Returns a merged {@link PreRenderConfig} object where each shared key
11380
- * prefers `preRenderConfig.key` over the top-level `viewConfig.key` for
11381
- * backward compatibility.
11547
+ * Returns a merged {@link PreRenderConfig} object where each key prefers the
11548
+ * value from `preRenderConfig` over its deprecated top-level `viewConfig`
11549
+ * counterpart (`id`/`preRenderId`, `containerSelector`/`preRenderContainer`,
11550
+ * `doNotTrackSize`/`doNotTrackPreRenderSize`) for backward compatibility.
11382
11551
  */
11383
11552
  protected getPreRenderConfig(): PreRenderConfig;
11384
11553
  /**
@@ -11982,7 +12151,7 @@ export interface SpotterShareConversationConfig {
11982
12151
  }
11983
12152
  /**
11984
12153
  * A single starter prompt question shown under a category pill.
11985
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
12154
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
11986
12155
  * @group Embed components
11987
12156
  */
11988
12157
  export interface StarterPromptQuestion {
@@ -12000,7 +12169,7 @@ export interface StarterPromptQuestion {
12000
12169
  /**
12001
12170
  * Configuration for a starter prompt category with questions
12002
12171
  * (`quick` and `research`).
12003
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
12172
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
12004
12173
  * @group Embed components
12005
12174
  */
12006
12175
  export interface StarterPromptCategory {
@@ -12018,7 +12187,7 @@ export interface StarterPromptCategory {
12018
12187
  /**
12019
12188
  * Configuration for the Data Literacy starter prompt category.
12020
12189
  * Only the label is customizable; the prompt text comes from the backend.
12021
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
12190
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
12022
12191
  * @group Embed components
12023
12192
  */
12024
12193
  export interface StarterPreviewDataCategory {
@@ -12036,7 +12205,7 @@ export interface StarterPreviewDataCategory {
12036
12205
  * Note: this controls the Spotter chat interface only. The starter prompts on
12037
12206
  * the Liveboard SpotterViz surface are configured separately through
12038
12207
  * {@link SpotterVizConfig.customStarterPrompts}.
12039
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
12208
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
12040
12209
  * @group Embed components
12041
12210
  */
12042
12211
  export interface StarterPromptsConfig {
@@ -12116,7 +12285,7 @@ export interface SpotterChatViewConfig {
12116
12285
  * `Action.DeepAnalysisPill` and `Action.DataLiteracyPill`.
12117
12286
  *
12118
12287
  * Supported embed types: `SpotterEmbed`, `LiveboardEmbed`, `AppEmbed`
12119
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
12288
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
12120
12289
  * @example
12121
12290
  * ```js
12122
12291
  * const embed = new SpotterEmbed('#tsEmbed', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.51.1",
3
+ "version": "1.52.0",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -1,7 +1,7 @@
1
1
  import { getThoughtSpotHost } from "./config";
2
2
  import { getEmbedConfig } from "./embed/embedConfig";
3
3
  import { ERROR_MESSAGE } from "./errors";
4
- import { InterceptedApiType, BaseViewConfig, ApiInterceptFlags, EmbedEvent, EmbedErrorCodes, ErrorDetailsTypes, EmbedErrorDetailsEvent } from "./types";
4
+ import { InterceptedApiType, BaseViewConfig, ApiInterceptFlags, EmbedEvent, EmbedErrorCodes, ErrorDetailsTypes, EmbedErrorDetailsEvent, EmbedErrorSeverity } from "./types";
5
5
  import { embedEventStatus } from "./utils";
6
6
  import { logger } from "./utils/logger";
7
7
 
@@ -134,6 +134,7 @@ export const handleInterceptEvent = async (params: {
134
134
  errorType: ErrorDetailsTypes.API,
135
135
  message: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
136
136
  code: EmbedErrorCodes.PARSING_API_INTERCEPT_BODY_ERROR,
137
+ severity: EmbedErrorSeverity.SEV3,
137
138
  error: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
138
139
  };
139
140
  executeEvent(EmbedEvent.Error, errorDetails);
@@ -538,7 +538,7 @@ export interface CustomCssVariables {
538
538
  * Left and right margin of the header and the tab/filter section of an
539
539
  * embedded Liveboard. Use alongside the `liveboardGutter` view config to
540
540
  * keep the header aligned with a custom tile-grid gutter.
541
- * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
541
+ * @version SDK: 1.51.1 | ThoughtSpot Cloud: 26.8.0.cl
542
542
  */
543
543
  '--ts-var-liveboard-header-horizontal-margin'?: string;
544
544
 
@@ -229,7 +229,7 @@ export interface SpotterShareConversationConfig {
229
229
 
230
230
  /**
231
231
  * A single starter prompt question shown under a category pill.
232
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
232
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
233
233
  * @group Embed components
234
234
  */
235
235
  export interface StarterPromptQuestion {
@@ -248,7 +248,7 @@ export interface StarterPromptQuestion {
248
248
  /**
249
249
  * Configuration for a starter prompt category with questions
250
250
  * (`quick` and `research`).
251
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
251
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
252
252
  * @group Embed components
253
253
  */
254
254
  export interface StarterPromptCategory {
@@ -267,7 +267,7 @@ export interface StarterPromptCategory {
267
267
  /**
268
268
  * Configuration for the Data Literacy starter prompt category.
269
269
  * Only the label is customizable; the prompt text comes from the backend.
270
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
270
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
271
271
  * @group Embed components
272
272
  */
273
273
  export interface StarterPreviewDataCategory {
@@ -286,7 +286,7 @@ export interface StarterPreviewDataCategory {
286
286
  * Note: this controls the Spotter chat interface only. The starter prompts on
287
287
  * the Liveboard SpotterViz surface are configured separately through
288
288
  * {@link SpotterVizConfig.customStarterPrompts}.
289
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
289
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
290
290
  * @group Embed components
291
291
  */
292
292
  export interface StarterPromptsConfig {
@@ -367,7 +367,7 @@ export interface SpotterChatViewConfig {
367
367
  * `Action.DeepAnalysisPill` and `Action.DataLiteracyPill`.
368
368
  *
369
369
  * Supported embed types: `SpotterEmbed`, `LiveboardEmbed`, `AppEmbed`
370
- * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
370
+ * @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl
371
371
  * @example
372
372
  * ```js
373
373
  * const embed = new SpotterEmbed('#tsEmbed', {
@@ -1335,12 +1335,12 @@ describe('Liveboard/viz embed tests', () => {
1335
1335
  }, 1002);
1336
1336
  });
1337
1337
 
1338
- test('navigateToLiveboard should call preRender when preRenderConfig.preRenderId is set', () => {
1338
+ test('navigateToLiveboard should call preRender when preRenderConfig.id is set', () => {
1339
1339
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1340
1340
  ...defaultViewConfig,
1341
1341
  liveboardId,
1342
1342
  preRenderConfig: {
1343
- preRenderId: 'config-pre-render-id',
1343
+ id: 'config-pre-render-id',
1344
1344
  },
1345
1345
  } as LiveboardViewConfig);
1346
1346
 
@@ -1353,13 +1353,13 @@ describe('Liveboard/viz embed tests', () => {
1353
1353
  expect(preRenderSpy).toHaveBeenCalledWith(true);
1354
1354
  });
1355
1355
 
1356
- test('navigateToLiveboard should prefer preRenderConfig.preRenderId over top-level preRenderId', () => {
1356
+ test('navigateToLiveboard should prefer preRenderConfig.id over top-level preRenderId', () => {
1357
1357
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
1358
1358
  ...defaultViewConfig,
1359
1359
  liveboardId,
1360
1360
  preRenderId: 'top-level-id',
1361
1361
  preRenderConfig: {
1362
- preRenderId: 'config-level-id',
1362
+ id: 'config-level-id',
1363
1363
  },
1364
1364
  } as LiveboardViewConfig);
1365
1365
 
@@ -22,6 +22,7 @@ import {
22
22
  LiveboardAppEmbedViewConfig,
23
23
  ErrorDetailsTypes,
24
24
  EmbedErrorCodes,
25
+ EmbedErrorSeverity,
25
26
  ContextType,
26
27
  DefaultAppInitData,
27
28
  } from '../types';
@@ -1056,6 +1057,7 @@ export class LiveboardEmbed extends V1Embed {
1056
1057
  errorType: ErrorDetailsTypes.VALIDATION_ERROR,
1057
1058
  message: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
1058
1059
  code: EmbedErrorCodes.LIVEBOARD_ID_MISSING,
1060
+ severity: EmbedErrorSeverity.SEV1,
1059
1061
  error: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
1060
1062
  });
1061
1063
  }
@@ -1299,7 +1301,7 @@ export class LiveboardEmbed extends V1Embed {
1299
1301
  this.viewConfig.personalizedViewId = personalizedViewId;
1300
1302
  if (this.isRendered) {
1301
1303
  this.trigger(HostEvent.Navigate, path.substring(1));
1302
- } else if (this.getPreRenderConfig().preRenderId) {
1304
+ } else if (this.getPreRenderConfig().id) {
1303
1305
  this.preRender(true);
1304
1306
  } else {
1305
1307
  this.render();
@@ -77,6 +77,37 @@ describe('Search embed tests', () => {
77
77
  });
78
78
  });
79
79
 
80
+ test('getUpdateEmbedParamsObject sends dataSources as a real ARRAY, not the URL-encoded string', async () => {
81
+ // The iframe URL correctly carries dataSources as a JSON-encoded
82
+ // string (asserted above), but the UpdateEmbedParams postMessage
83
+ // payload is spread into app state unparsed — a string there reaches
84
+ // the $sources GraphQL variable ([GUID!]) and fails GUID coercion
85
+ // (SCAL-334713, fired from beforePrerenderVisible on prerender-show).
86
+ const dataSources = ['4dd30af7-9ed7-4847-8f28-b65b44a841d8'];
87
+ const searchEmbed = new SearchEmbed(getRootEl(), {
88
+ ...defaultViewConfig,
89
+ dataSources,
90
+ });
91
+ const params = await (searchEmbed as any).getUpdateEmbedParamsObject();
92
+ expect(params.dataSources).toEqual(dataSources);
93
+
94
+ // Single-GUID `dataSource` prop (the customer's shape) normalizes to
95
+ // a one-element array the same way the app's URL parser would.
96
+ const singleSourceEmbed = new SearchEmbed(getRootEl(), {
97
+ ...defaultViewConfig,
98
+ dataSource: '4dd30af7-9ed7-4847-8f28-b65b44a841d8',
99
+ });
100
+ const singleParams = await (singleSourceEmbed as any).getUpdateEmbedParamsObject();
101
+ expect(singleParams.dataSources).toEqual([
102
+ '4dd30af7-9ed7-4847-8f28-b65b44a841d8',
103
+ ]);
104
+
105
+ // The normalization only reverses JSON serialization: non-JSON
106
+ // strings and already-structured values pass through untouched.
107
+ expect(singleParams.embedApp).toBe(true);
108
+ expect(singleParams.authType).toBe('None');
109
+ });
110
+
80
111
  test('should pass in search query', async () => {
81
112
  const dataSources = ['data-source-1'];
82
113
  const searchOptions = {