@thoughtspot/visual-embed-sdk 1.43.1 → 1.44.1-test

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 +1 -1
  2. package/cjs/src/api-intercept.d.ts.map +1 -1
  3. package/cjs/src/api-intercept.js +8 -3
  4. package/cjs/src/api-intercept.js.map +1 -1
  5. package/cjs/src/api-intercept.spec.js +19 -3
  6. package/cjs/src/api-intercept.spec.js.map +1 -1
  7. package/cjs/src/embed/app.d.ts +32 -0
  8. package/cjs/src/embed/app.d.ts.map +1 -1
  9. package/cjs/src/embed/app.js +9 -4
  10. package/cjs/src/embed/app.js.map +1 -1
  11. package/cjs/src/embed/app.spec.js +104 -1
  12. package/cjs/src/embed/app.spec.js.map +1 -1
  13. package/cjs/src/embed/base.d.ts +7 -0
  14. package/cjs/src/embed/base.d.ts.map +1 -1
  15. package/cjs/src/embed/base.js +16 -1
  16. package/cjs/src/embed/base.js.map +1 -1
  17. package/cjs/src/embed/base.spec.js +21 -0
  18. package/cjs/src/embed/base.spec.js.map +1 -1
  19. package/cjs/src/embed/conversation.d.ts +15 -0
  20. package/cjs/src/embed/conversation.d.ts.map +1 -1
  21. package/cjs/src/embed/conversation.js +10 -2
  22. package/cjs/src/embed/conversation.js.map +1 -1
  23. package/cjs/src/embed/conversation.spec.js +30 -1
  24. package/cjs/src/embed/conversation.spec.js.map +1 -1
  25. package/cjs/src/embed/liveboard.d.ts +33 -0
  26. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  27. package/cjs/src/embed/liveboard.js +13 -5
  28. package/cjs/src/embed/liveboard.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +108 -0
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/ts-embed.d.ts +3 -2
  32. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  33. package/cjs/src/embed/ts-embed.js +51 -17
  34. package/cjs/src/embed/ts-embed.js.map +1 -1
  35. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  36. package/cjs/src/embed/ts-embed.spec.js +93 -5
  37. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  38. package/cjs/src/errors.d.ts +7 -0
  39. package/cjs/src/errors.d.ts.map +1 -1
  40. package/cjs/src/errors.js +7 -0
  41. package/cjs/src/errors.js.map +1 -1
  42. package/cjs/src/index.d.ts +2 -2
  43. package/cjs/src/index.d.ts.map +1 -1
  44. package/cjs/src/index.js +2 -1
  45. package/cjs/src/index.js.map +1 -1
  46. package/cjs/src/react/all-types-export.d.ts +1 -1
  47. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  48. package/cjs/src/react/all-types-export.js +2 -1
  49. package/cjs/src/react/all-types-export.js.map +1 -1
  50. package/cjs/src/types.d.ts +250 -7
  51. package/cjs/src/types.d.ts.map +1 -1
  52. package/cjs/src/types.js +135 -2
  53. package/cjs/src/types.js.map +1 -1
  54. package/dist/{index-CpkMygsc.js → index-BXCUJ09L.js} +1 -1
  55. package/dist/src/api-intercept.d.ts.map +1 -1
  56. package/dist/src/embed/app.d.ts +32 -0
  57. package/dist/src/embed/app.d.ts.map +1 -1
  58. package/dist/src/embed/base.d.ts +7 -0
  59. package/dist/src/embed/base.d.ts.map +1 -1
  60. package/dist/src/embed/conversation.d.ts +15 -0
  61. package/dist/src/embed/conversation.d.ts.map +1 -1
  62. package/dist/src/embed/liveboard.d.ts +33 -0
  63. package/dist/src/embed/liveboard.d.ts.map +1 -1
  64. package/dist/src/embed/ts-embed.d.ts +3 -2
  65. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  66. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  67. package/dist/src/errors.d.ts +7 -0
  68. package/dist/src/errors.d.ts.map +1 -1
  69. package/dist/src/index.d.ts +2 -2
  70. package/dist/src/index.d.ts.map +1 -1
  71. package/dist/src/react/all-types-export.d.ts +1 -1
  72. package/dist/src/react/all-types-export.d.ts.map +1 -1
  73. package/dist/src/types.d.ts +250 -7
  74. package/dist/src/types.d.ts.map +1 -1
  75. package/dist/tsembed-react.es.js +304 -105
  76. package/dist/tsembed-react.js +303 -104
  77. package/dist/tsembed.es.js +318 -106
  78. package/dist/tsembed.js +317 -104
  79. package/dist/visual-embed-sdk-react-full.d.ts +290 -7
  80. package/dist/visual-embed-sdk-react.d.ts +283 -7
  81. package/dist/visual-embed-sdk.d.ts +290 -7
  82. package/lib/package.json +1 -1
  83. package/lib/src/api-intercept.d.ts.map +1 -1
  84. package/lib/src/api-intercept.js +9 -4
  85. package/lib/src/api-intercept.js.map +1 -1
  86. package/lib/src/api-intercept.spec.js +20 -4
  87. package/lib/src/api-intercept.spec.js.map +1 -1
  88. package/lib/src/embed/app.d.ts +32 -0
  89. package/lib/src/embed/app.d.ts.map +1 -1
  90. package/lib/src/embed/app.js +10 -5
  91. package/lib/src/embed/app.js.map +1 -1
  92. package/lib/src/embed/app.spec.js +104 -1
  93. package/lib/src/embed/app.spec.js.map +1 -1
  94. package/lib/src/embed/base.d.ts +7 -0
  95. package/lib/src/embed/base.d.ts.map +1 -1
  96. package/lib/src/embed/base.js +14 -0
  97. package/lib/src/embed/base.js.map +1 -1
  98. package/lib/src/embed/base.spec.js +21 -0
  99. package/lib/src/embed/base.spec.js.map +1 -1
  100. package/lib/src/embed/conversation.d.ts +15 -0
  101. package/lib/src/embed/conversation.d.ts.map +1 -1
  102. package/lib/src/embed/conversation.js +11 -3
  103. package/lib/src/embed/conversation.js.map +1 -1
  104. package/lib/src/embed/conversation.spec.js +31 -2
  105. package/lib/src/embed/conversation.spec.js.map +1 -1
  106. package/lib/src/embed/liveboard.d.ts +33 -0
  107. package/lib/src/embed/liveboard.d.ts.map +1 -1
  108. package/lib/src/embed/liveboard.js +14 -6
  109. package/lib/src/embed/liveboard.js.map +1 -1
  110. package/lib/src/embed/liveboard.spec.js +108 -0
  111. package/lib/src/embed/liveboard.spec.js.map +1 -1
  112. package/lib/src/embed/ts-embed.d.ts +3 -2
  113. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  114. package/lib/src/embed/ts-embed.js +52 -18
  115. package/lib/src/embed/ts-embed.js.map +1 -1
  116. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  117. package/lib/src/embed/ts-embed.spec.js +94 -6
  118. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  119. package/lib/src/errors.d.ts +7 -0
  120. package/lib/src/errors.d.ts.map +1 -1
  121. package/lib/src/errors.js +7 -0
  122. package/lib/src/errors.js.map +1 -1
  123. package/lib/src/index.d.ts +2 -2
  124. package/lib/src/index.d.ts.map +1 -1
  125. package/lib/src/index.js +2 -2
  126. package/lib/src/index.js.map +1 -1
  127. package/lib/src/react/all-types-export.d.ts +1 -1
  128. package/lib/src/react/all-types-export.d.ts.map +1 -1
  129. package/lib/src/react/all-types-export.js +1 -1
  130. package/lib/src/react/all-types-export.js.map +1 -1
  131. package/lib/src/types.d.ts +250 -7
  132. package/lib/src/types.d.ts.map +1 -1
  133. package/lib/src/types.js +134 -1
  134. package/lib/src/types.js.map +1 -1
  135. package/package.json +1 -1
  136. package/src/api-intercept.spec.ts +23 -10
  137. package/src/api-intercept.ts +9 -4
  138. package/src/embed/app.spec.ts +146 -4
  139. package/src/embed/app.ts +69 -24
  140. package/src/embed/base.spec.ts +28 -0
  141. package/src/embed/base.ts +15 -0
  142. package/src/embed/conversation.spec.ts +39 -2
  143. package/src/embed/conversation.ts +28 -2
  144. package/src/embed/liveboard.spec.ts +136 -0
  145. package/src/embed/liveboard.ts +51 -4
  146. package/src/embed/ts-embed.spec.ts +107 -15
  147. package/src/embed/ts-embed.ts +56 -19
  148. package/src/errors.ts +7 -0
  149. package/src/index.ts +2 -0
  150. package/src/react/all-types-export.ts +1 -0
  151. package/src/types.ts +260 -6
@@ -1544,7 +1544,7 @@ export interface EmbedConfig {
1544
1544
  * {
1545
1545
  * name: 'customAction',
1546
1546
  * id: 'customAction',
1547
- * target: CustomActionTarget.VISUALIZATION,
1547
+ * target: CustomActionTarget.VIZ,
1548
1548
  * position: CustomActionPosition.PRIMARY,
1549
1549
  * }
1550
1550
  * }
@@ -1935,8 +1935,12 @@ export interface BaseViewConfig extends ApiInterceptFlags {
1935
1935
  * Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SageEmbed`, `SearchEmbed`, `SpotterEmbed`
1936
1936
  * @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
1937
1937
  * @example
1938
- * ```js
1939
- * import { CustomActionPosition, CustomActionTarget } from '@thoughtspot/visual-embed-sdk';
1938
+ * ```ts
1939
+ * import {
1940
+ * CustomActionPayload,
1941
+ * CustomActionPosition,
1942
+ * CustomActionTarget,
1943
+ * } from '@thoughtspot/visual-embed-sdk';
1940
1944
  * // Use supported embed types such as AppEmbed or LiveboardEmbed
1941
1945
  * const embed = new LiveboardEmbed('#tsEmbed', {
1942
1946
  * ... // other embed config options
@@ -1944,12 +1948,17 @@ export interface BaseViewConfig extends ApiInterceptFlags {
1944
1948
  * {
1945
1949
  * name: 'customAction',
1946
1950
  * id: 'customAction',
1947
- * target: CustomActionTarget.VISUALIZATION,
1951
+ * target: CustomActionTarget.VIZ,
1948
1952
  * position: CustomActionPosition.PRIMARY,
1949
1953
  * }
1950
1954
  * }
1951
1955
  * ]
1952
1956
  * })
1957
+ *
1958
+ * // to trigger a custom flow on custom action click listen to Custom action embed event
1959
+ * embed.on(EmbedEvent.CustomAction, (payload: CustomActionPayload) => {
1960
+ * console.log('Custom Action event:', payload);
1961
+ * })
1953
1962
  * ```
1954
1963
  */
1955
1964
  customActions?: CustomAction[];
@@ -2427,6 +2436,38 @@ export interface LiveboardAppEmbedViewConfig {
2427
2436
  * ```
2428
2437
  */
2429
2438
  isEnhancedFilterInteractivityEnabled?: boolean;
2439
+ /**
2440
+ * Show or hide masked filter chips
2441
+ *
2442
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`
2443
+ * @version SDK: 1.45.0 | Thoughtspot: 26.2.0.cl
2444
+ * @default false
2445
+ * @example
2446
+ * ```js
2447
+ * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
2448
+ * const embed = new <EmbedComponent>('#tsEmbed', {
2449
+ * ... // other embed view config
2450
+ * showMaskedFilterChip: true,
2451
+ * })
2452
+ * ```
2453
+ */
2454
+ showMaskedFilterChip?: boolean;
2455
+ /**
2456
+ * Enable or disable Liveboard styling and grouping
2457
+ *
2458
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`
2459
+ * @version SDK: 1.45.0 | Thoughtspot: 26.2.0.cl
2460
+ * @default false
2461
+ * @example
2462
+ * ```js
2463
+ * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
2464
+ * const embed = new <EmbedComponent>('#tsEmbed', {
2465
+ * ... // other embed view config
2466
+ * isLiveboardMasterpiecesEnabled: true,
2467
+ * })
2468
+ * ```
2469
+ */
2470
+ isLiveboardMasterpiecesEnabled?: boolean;
2430
2471
  }
2431
2472
  export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {
2432
2473
  }
@@ -2850,6 +2891,7 @@ export declare enum EmbedEvent {
2850
2891
  * SearchEmbed.on(EmbedEvent.Error, (error) => {
2851
2892
  * console.log(error);
2852
2893
  * // { type: "Error", data: { errorType: "API", error: { message: '...', error: '...' } } }
2894
+ * // { errorType: "API", message: '...', code: '...' } new format
2853
2895
  * });
2854
2896
  * ```
2855
2897
  * @example
@@ -2861,6 +2903,7 @@ export declare enum EmbedEvent {
2861
2903
  * // message: "Fullscreen API is not enabled",
2862
2904
  * // stack: "..."
2863
2905
  * // } }}
2906
+ * // { errorType: "FULLSCREEN", message: "Fullscreen API is not enabled", code: '...' } new format
2864
2907
  * })
2865
2908
  * ```
2866
2909
  */
@@ -3016,7 +3059,8 @@ export declare enum EmbedEvent {
3016
3059
  */
3017
3060
  ALL = "*",
3018
3061
  /**
3019
- * Emitted when an Answer is saved in the app
3062
+ * Emitted when an Answer is saved in the app.
3063
+ * Use start:true to subscribe to when save is initiated, or end:true to subscribe to when save is completed. Default is end:true.
3020
3064
  * @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3021
3065
  * @example
3022
3066
  *```js
@@ -3051,6 +3095,7 @@ export declare enum EmbedEvent {
3051
3095
  Download = "download",
3052
3096
  /**
3053
3097
  * Emitted when the download action is triggered on an Answer.
3098
+ * Use start:true to subscribe to when download is initiated, or end:true to subscribe to when download is completed. Default is end:true.
3054
3099
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
3055
3100
  * @example
3056
3101
  *```js
@@ -3065,6 +3110,7 @@ export declare enum EmbedEvent {
3065
3110
  DownloadAsPng = "downloadAsPng",
3066
3111
  /**
3067
3112
  * Emitted when the Download as PDF action is triggered on an Answer
3113
+ * Use start:true to subscribe to when download as PDF is initiated, or end:true to subscribe to when download as PDF is completed. Default is end:true.
3068
3114
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3069
3115
  * @example
3070
3116
  *```js
@@ -3079,6 +3125,7 @@ export declare enum EmbedEvent {
3079
3125
  DownloadAsPdf = "downloadAsPdf",
3080
3126
  /**
3081
3127
  * Emitted when the Download as CSV action is triggered on an Answer.
3128
+ * Use start:true to subscribe to when download as CSV is initiated, or end:true to subscribe to when download as CSV is completed. Default is end:true.
3082
3129
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3083
3130
  * @example
3084
3131
  *```js
@@ -3093,6 +3140,7 @@ export declare enum EmbedEvent {
3093
3140
  DownloadAsCsv = "downloadAsCsv",
3094
3141
  /**
3095
3142
  * Emitted when the Download as XLSX action is triggered on an Answer.
3143
+ * Use start:true to subscribe to when download as XLSX is initiated, or end:true to subscribe to when download as XLSX is completed. Default is end:true.
3096
3144
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3097
3145
  * @example
3098
3146
  *```js
@@ -3107,6 +3155,7 @@ export declare enum EmbedEvent {
3107
3155
  DownloadAsXlsx = "downloadAsXlsx",
3108
3156
  /**
3109
3157
  * Emitted when an Answer is deleted in the app
3158
+ * Use start:true to subscribe to when delete is initiated, or end:true to subscribe to when delete is completed. Default is end:true.
3110
3159
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3111
3160
  * @example
3112
3161
  *```js
@@ -3133,6 +3182,7 @@ export declare enum EmbedEvent {
3133
3182
  /**
3134
3183
  * Emitted when a user initiates the Pin action to
3135
3184
  * add an Answer to a Liveboard.
3185
+ * Use start:true to subscribe to when pin is initiated, or end:true to subscribe to when pin is completed. Default is end:true.
3136
3186
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3137
3187
  * @example
3138
3188
  *```js
@@ -3246,6 +3296,7 @@ export declare enum EmbedEvent {
3246
3296
  /**
3247
3297
  * Emitted when the **Export TML** action is triggered on an
3248
3298
  * an embedded object in the app
3299
+ * Use start:true to subscribe to when export is initiated, or end:true to subscribe to when export is completed. Default is end:true.
3249
3300
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3250
3301
  * @example
3251
3302
  *```js
@@ -3271,6 +3322,7 @@ export declare enum EmbedEvent {
3271
3322
  SaveAsView = "saveAsView",
3272
3323
  /**
3273
3324
  * Emitted when the user creates a copy of an Answer.
3325
+ * Use start:true to subscribe to when copy and edit is initiated, or end:true to subscribe to when copy and edit is completed. Default is end:true.
3274
3326
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3275
3327
  * @example
3276
3328
  *```js
@@ -6575,7 +6627,47 @@ export declare enum Action {
6575
6627
  * ```
6576
6628
  * @version SDK: 1.43.0 | ThoughtSpot Cloud: 10.15.0.cl
6577
6629
  */
6578
- LiveboardStylePanel = "liveboardStylePanel"
6630
+ LiveboardStylePanel = "liveboardStylePanel",
6631
+ /**
6632
+ * The **Move to Group** menu action on a Liveboard.
6633
+ * Allows moving a visualization to a different group.
6634
+ * @example
6635
+ * ```js
6636
+ * disabledActions: [Action.MoveToGroup]
6637
+ * ```
6638
+ * @version SDK: 1.44.0 | ThoughtSpot Cloud: 26.2.0.cl
6639
+ */
6640
+ MoveToGroup = "moveToGroup",
6641
+ /**
6642
+ * The **Move out of Group** menu action on a Liveboard.
6643
+ * Allows moving a visualization out of a group.
6644
+ * @example
6645
+ * ```js
6646
+ * disabledActions: [Action.MoveOutOfGroup]
6647
+ * ```
6648
+ * @version SDK: 1.44.0 | ThoughtSpot Cloud: 26.2.0.cl
6649
+ */
6650
+ MoveOutOfGroup = "moveOutOfGroup",
6651
+ /**
6652
+ * The **Create Group** menu action on a Liveboard.
6653
+ * Allows creating a new group.
6654
+ * @example
6655
+ * ```js
6656
+ * disabledActions: [Action.CreateGroup]
6657
+ * ```
6658
+ * @version SDK: 1.44.0 | ThoughtSpot Cloud: 26.2.0.cl
6659
+ */
6660
+ CreateGroup = "createGroup",
6661
+ /**
6662
+ * The **Ungroup Liveboard Group** menu action on a Liveboard.
6663
+ * Allows ungrouping a liveboard group.
6664
+ * @example
6665
+ * ```js
6666
+ * disabledActions: [Action.UngroupLiveboardGroup]
6667
+ * ```
6668
+ * @version SDK: 1.44.0 | ThoughtSpot Cloud: 26.2.0.cl
6669
+ */
6670
+ UngroupLiveboardGroup = "ungroupLiveboardGroup"
6579
6671
  }
6580
6672
  export declare enum PrefetchFeatures {
6581
6673
  FullApp = "FullApp",
@@ -6751,6 +6843,109 @@ export declare enum LogLevel {
6751
6843
  */
6752
6844
  TRACE = "TRACE"
6753
6845
  }
6846
+ declare enum ErrorDetailsTypes {
6847
+ /** API call failure */
6848
+ API = "API",
6849
+ /** General validation error */
6850
+ VALIDATION_ERROR = "VALIDATION_ERROR",
6851
+ /** Network connectivity or request error */
6852
+ NETWORK = "NETWORK"
6853
+ }
6854
+ declare enum EmbedErrorCodes {
6855
+ /** Worksheet ID not found or does not exist */
6856
+ WORKSHEET_ID_NOT_FOUND = "WORKSHEET_ID_NOT_FOUND",
6857
+ /** Required Liveboard ID is missing from configuration */
6858
+ LIVEBOARD_ID_MISSING = "LIVEBOARD_ID_MISSING",
6859
+ /** Conflicting action configuration detected (e.g., both hiddenActions and visibleActions specified) */
6860
+ CONFLICTING_ACTIONS_CONFIG = "CONFLICTING_ACTIONS_CONFIG",
6861
+ /** Conflicting tab configuration detected (e.g., both hiddenTabs and visibleTabs specified) */
6862
+ CONFLICTING_TABS_CONFIG = "CONFLICTING_TABS_CONFIG",
6863
+ /** Error during component initialization */
6864
+ INIT_ERROR = "INIT_ERROR",
6865
+ /** Network connectivity or request error */
6866
+ NETWORK_ERROR = "NETWORK_ERROR",
6867
+ /** Custom action validation failed */
6868
+ CUSTOM_ACTION_VALIDATION = "CUSTOM_ACTION_VALIDATION",
6869
+ /** Authentication/login failed */
6870
+ LOGIN_FAILED = "LOGIN_FAILED",
6871
+ /** Render method was not called before attempting to use the component */
6872
+ RENDER_NOT_CALLED = "RENDER_NOT_CALLED",
6873
+ /** Host event type is undefined or invalid */
6874
+ HOST_EVENT_TYPE_UNDEFINED = "HOST_EVENT_TYPE_UNDEFINED",
6875
+ /** Error parsing api intercept body */
6876
+ PARSING_API_INTERCEPT_BODY_ERROR = "PARSING_API_INTERCEPT_BODY_ERROR"
6877
+ }
6878
+ /**
6879
+ * Error event object emitted when an error occurs in an embedded component.
6880
+ *
6881
+ * This interface defines the structure of error objects returned by the {@link EmbedEvent.Error}
6882
+ * event. It provides detailed information about what went wrong, including the error type,
6883
+ * a human-readable message, and a machine-readable error code.
6884
+ *
6885
+ * ## Properties
6886
+ *
6887
+ * - **errorType**: One of the predefined {@link ErrorDetailsTypes} values
6888
+ * - **message**: Human-readable error description (string or array of strings for multiple errors)
6889
+ * - **code**: Machine-readable error identifier for programmatic handling
6890
+ * - **[key: string]**: Additional context-specific for backward compatibility
6891
+ *
6892
+ * ## Usage
6893
+ *
6894
+ * Listen to the {@link EmbedEvent.Error} event to receive instances of this object
6895
+ * and implement appropriate error handling logic based on the `errorType`.
6896
+ *
6897
+ * @version SDK: 1.44.2 | ThoughtSpot: 26.2.0.cl
6898
+ * @group Error Handling
6899
+ * @see {@link ErrorDetailsTypes} - Available error type values
6900
+ * @see {@link EmbedEvent.Error} - The event that emits this object
6901
+ *
6902
+ * @example
6903
+ * Handle specific error types
6904
+ *
6905
+ * embed.on(EmbedEvent.Error, (error) => {
6906
+ * switch (error.code) {
6907
+ * case EmbedErrorCodes.WORKSHEET_ID_NOT_FOUND:
6908
+ * console.error('Worksheet ID not found:', error.message, error.code);
6909
+ * break;
6910
+ * default:
6911
+ * console.error('Unknown error:', error);
6912
+ * }
6913
+ * });
6914
+ * *
6915
+ * @example
6916
+ * Handle multiple error messages
6917
+ *
6918
+ * embed.on(EmbedEvent.Error, (error) => {
6919
+ * const messages = Array.isArray(error.message)
6920
+ * ? error.message
6921
+ * : [error.message];
6922
+ *
6923
+ * messages.forEach(msg => console.error(msg));
6924
+ * });
6925
+ * *
6926
+ * @example
6927
+ * Access additional error context
6928
+ *
6929
+ * embed.on(EmbedEvent.Error, (error) => {
6930
+ * console.error('Error Details:', {
6931
+ * type: error.errorType,
6932
+ * message: error.message,
6933
+ * code: error.code,
6934
+ * // Additional context fields vary by error type
6935
+ * ...error
6936
+ * });
6937
+ * });
6938
+ * */
6939
+ export interface EmbedErrorDetailsEvent {
6940
+ /** The type of error that occurred */
6941
+ errorType: ErrorDetailsTypes;
6942
+ /** Human-readable error message(s) describing what went wrong */
6943
+ message: string | string[];
6944
+ /** Machine-readable error code for programmatic error handling */
6945
+ code: EmbedErrorCodes;
6946
+ /** Additional context-specific for backward compatibility */
6947
+ [key: string]: any;
6948
+ }
6754
6949
  export interface DefaultAppInitData {
6755
6950
  customisations: CustomisationsInterface;
6756
6951
  authToken: string;
@@ -7014,8 +7209,9 @@ declare class TsEmbed {
7014
7209
  /**
7015
7210
  * Handles errors within the SDK
7016
7211
  * @param error The error message or object
7212
+ * @param errorDetails The error details
7017
7213
  */
7018
- protected handleError(error: string | Record<string, unknown>): void;
7214
+ protected handleError(errorDetails: EmbedErrorDetailsEvent): void;
7019
7215
  /**
7020
7216
  * Extracts the type field from the event payload
7021
7217
  * @param event The window message event
@@ -7962,6 +8158,38 @@ export interface AppViewConfig extends AllEmbedViewConfig {
7962
8158
  * @version SDK: 1.40.0 | ThoughtSpot:10.12.0.cl
7963
8159
  */
7964
8160
  lazyLoadingMargin?: string;
8161
+ /**
8162
+ * updatedSpotterChatPrompt : Controls the updated spotter chat prompt.
8163
+ *
8164
+ * Supported embed types: `AppEmbed`
8165
+ * @default false
8166
+ * @example
8167
+ * ```js
8168
+ * const embed = new AppEmbed('#tsEmbed', {
8169
+ * ... //other embed view config
8170
+ * updatedSpotterChatPrompt : true,
8171
+ * })
8172
+ * ```
8173
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
8174
+ */
8175
+ updatedSpotterChatPrompt?: boolean;
8176
+ /**
8177
+ * This is the minimum height (in pixels) for a full-height App.
8178
+ * Setting this height helps resolve issues with empty Apps and
8179
+ * other screens navigable from an App.
8180
+ *
8181
+ * @version SDK: 1.44.2 | ThoughtSpot: 26.0.2.cl
8182
+ * @default 500
8183
+ * @example
8184
+ * ```js
8185
+ * const embed = new AppEmbed('#embed', {
8186
+ * ... // other app view config
8187
+ * fullHeight: true,
8188
+ * minimumHeight: 600,
8189
+ * });
8190
+ * ```
8191
+ */
8192
+ minimumHeight?: number;
7965
8193
  }
7966
8194
  /**
7967
8195
  * Embeds full ThoughtSpot experience in a host application.
@@ -8253,6 +8481,13 @@ export declare const executeTML: (data: executeTMLInput) => Promise<any>;
8253
8481
  * @group Global methods
8254
8482
  */
8255
8483
  export declare const exportTML: (data: exportTMLInput) => Promise<any>;
8484
+ /**
8485
+ * Reloads the ThoughtSpot iframe.
8486
+ * @param iFrame
8487
+ * @group Global methods
8488
+ * @version SDK: 1.43.1
8489
+ */
8490
+ export declare const reloadIframe: (iFrame: HTMLIFrameElement) => void;
8256
8491
  /**
8257
8492
  * The configuration for the embedded Liveboard or visualization page view.
8258
8493
  * @group Embed components
@@ -8289,6 +8524,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, SearchLiveboardComm
8289
8524
  * Supported embed types: `LiveboardEmbed`
8290
8525
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
8291
8526
  * @default 500
8527
+ * @deprecated Use `minimumHeight` instead.
8292
8528
  * @example
8293
8529
  * ```js
8294
8530
  * const embed = new LiveboardEmbed('#embed', {
@@ -8299,6 +8535,23 @@ export interface LiveboardViewConfig extends BaseViewConfig, SearchLiveboardComm
8299
8535
  * ```
8300
8536
  */
8301
8537
  defaultHeight?: number;
8538
+ /**
8539
+ * This is the minimum height (in pixels) for a full-height Liveboard.
8540
+ * Setting this height helps resolve issues with empty Liveboards and
8541
+ * other screens navigable from a Liveboard.
8542
+ *
8543
+ * @version SDK: 1.44.2 | ThoughtSpot: 26.0.2.cl
8544
+ * @default 500
8545
+ * @example
8546
+ * ```js
8547
+ * const embed = new LiveboardEmbed('#embed', {
8548
+ * ... // other liveboard view config
8549
+ * fullHeight: true,
8550
+ * minimumHeight: 600,
8551
+ * });
8552
+ * ```
8553
+ */
8554
+ minimumHeight?: number;
8302
8555
  /**
8303
8556
  * @Deprecated If set to true, the context menu in visualizations will be enabled.
8304
8557
  * @example
@@ -8618,6 +8871,21 @@ export interface LiveboardViewConfig extends BaseViewConfig, SearchLiveboardComm
8618
8871
  * @version SDK: 1.41.1 | ThoughtSpot: 10.5.0.cl
8619
8872
  */
8620
8873
  showSpotterLimitations?: boolean;
8874
+ /**
8875
+ * updatedSpotterChatPrompt : Controls the updated spotter chat prompt.
8876
+ *
8877
+ * Supported embed types: `LiveboardEmbed`
8878
+ * @default false
8879
+ * @example
8880
+ * ```js
8881
+ * const embed = new LiveboardEmbed('#tsEmbed', {
8882
+ * ... //other embed view config
8883
+ * updatedSpotterChatPrompt : true,
8884
+ * })
8885
+ * ```
8886
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
8887
+ */
8888
+ updatedSpotterChatPrompt?: boolean;
8621
8889
  }
8622
8890
  /**
8623
8891
  * Embed a ThoughtSpot Liveboard or visualization. When rendered it already
@@ -9435,6 +9703,21 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, "primaryAct
9435
9703
  * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
9436
9704
  */
9437
9705
  enablePastConversationsSidebar?: boolean;
9706
+ /**
9707
+ * updatedSpotterChatPrompt : Controls the updated spotter chat prompt.
9708
+ *
9709
+ * Supported embed types: `SpotterEmbed`
9710
+ * @default false
9711
+ * @example
9712
+ * ```js
9713
+ * const embed = new SpotterEmbed('#tsEmbed', {
9714
+ * ... //other embed view config
9715
+ * updatedSpotterChatPrompt : true,
9716
+ * })
9717
+ * ```
9718
+ * @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
9719
+ */
9720
+ updatedSpotterChatPrompt?: boolean;
9438
9721
  }
9439
9722
  /**
9440
9723
  * The configuration for the embedded spotterEmbed options.
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.43.1",
3
+ "version": "1.44.1-test",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -1 +1 @@
1
- {"version":3,"file":"api-intercept.d.ts","sourceRoot":"","sources":["../../src/api-intercept.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAwC5F;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,eAAgB,cAAc,KAAG,SAAS,KAAK,iBAAiB,EAAE,sCAAsC,CAAC,CAgBzI,CAAA;AA6CD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;eAClB,GAAG;8BACY,UAAU,QAAQ,GAAG,KAAK,IAAI;gBAC5C,cAAc;iCACG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,QAAQ;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;mBAwCnG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,YAAa,GAAG,QAQvD,CAAA;AAED,eAAO,MAAM,8BAA8B,YAAa,GAAG;;;;;;;;;;;;;;CAuB1D,CAAA"}
1
+ {"version":3,"file":"api-intercept.d.ts","sourceRoot":"","sources":["../../src/api-intercept.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAA8D,MAAM,SAAS,CAAC;AAwCxJ;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,eAAgB,cAAc,KAAG,SAAS,KAAK,iBAAiB,EAAE,sCAAsC,CAAC,CAgBzI,CAAA;AA6CD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;eAClB,GAAG;8BACY,UAAU,QAAQ,GAAG,KAAK,IAAI;gBAC5C,cAAc;iCACG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,QAAQ;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;mBA4CnG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,YAAa,GAAG,QAQvD,CAAA;AAED,eAAO,MAAM,8BAA8B,YAAa,GAAG;;;;;;;;;;;;;;CAuB1D,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { getThoughtSpotHost } from "./config";
2
2
  import { getEmbedConfig } from "./embed/embedConfig";
3
- import { InterceptedApiType, EmbedEvent } from "./types";
3
+ import { ERROR_MESSAGE } from "./errors";
4
+ import { InterceptedApiType, EmbedEvent, EmbedErrorCodes, ErrorDetailsTypes } from "./types";
4
5
  import { embedEventStatus } from "./utils";
5
6
  import { logger } from "./utils/logger";
6
7
  const DefaultInterceptUrlsMap = {
@@ -108,9 +109,13 @@ export const handleInterceptEvent = async (params) => {
108
109
  const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
109
110
  const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
110
111
  if (bodyParseError) {
111
- executeEvent(EmbedEvent.Error, {
112
- error: 'Error parsing api intercept body',
113
- });
112
+ const errorDetails = {
113
+ errorType: ErrorDetailsTypes.API,
114
+ message: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
115
+ code: EmbedErrorCodes.PARSING_API_INTERCEPT_BODY_ERROR,
116
+ error: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
117
+ };
118
+ executeEvent(EmbedEvent.Error, errorDetails);
114
119
  logger.error('Error parsing request body', bodyParseError);
115
120
  return;
116
121
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-intercept.js","sourceRoot":"","sources":["../../src/api-intercept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAqC,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,uBAAuB,GAA0E;IACnG,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE;QAC7B,6BAA6B;QAC7B,qCAAqC;QACrC,6BAA6B;KACpB;IACb,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE;QAChC,4BAA4B;KACnB;CAChB,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IACvC,MAAM,IAAI,GAAG,kBAAkB,CAA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IAGF,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AACnC,CAAC,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import * as apiIntercept from './api-intercept';
2
2
  import * as config from './config';
3
3
  import * as embedConfig from './embed/embedConfig';
4
- import { InterceptedApiType, EmbedEvent } from './types';
4
+ import { ERROR_MESSAGE } from './errors';
5
+ import { InterceptedApiType, EmbedEvent, EmbedErrorCodes, ErrorDetailsTypes } from './types';
5
6
  import { embedEventStatus } from './utils';
6
7
  import { logger } from './utils/logger';
7
8
  jest.mock('./config');
@@ -278,7 +279,12 @@ describe('api-intercept', () => {
278
279
  viewConfig,
279
280
  getUnsavedAnswerTml
280
281
  });
281
- expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, { error: 'Error parsing api intercept body' });
282
+ expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, expect.objectContaining({
283
+ errorType: ErrorDetailsTypes.API,
284
+ message: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
285
+ code: EmbedErrorCodes.PARSING_API_INTERCEPT_BODY_ERROR,
286
+ error: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
287
+ }));
282
288
  expect(mockLogger.error).toHaveBeenCalled();
283
289
  });
284
290
  it('should handle init with non-JSON body', async () => {
@@ -325,7 +331,12 @@ describe('api-intercept', () => {
325
331
  viewConfig,
326
332
  getUnsavedAnswerTml
327
333
  });
328
- expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, { error: 'Error parsing api intercept body' });
334
+ expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, expect.objectContaining({
335
+ errorType: ErrorDetailsTypes.API,
336
+ message: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
337
+ code: EmbedErrorCodes.PARSING_API_INTERCEPT_BODY_ERROR,
338
+ error: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
339
+ }));
329
340
  expect(mockLogger.error).toHaveBeenCalled();
330
341
  // Explicitly restore for this test
331
342
  global.JSON.parse = originalJsonParse;
@@ -377,7 +388,12 @@ describe('api-intercept', () => {
377
388
  getUnsavedAnswerTml
378
389
  });
379
390
  // When init is missing, accessing init.body throws an error
380
- expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, { error: 'Error parsing api intercept body' });
391
+ expect(executeEvent).toHaveBeenCalledWith(EmbedEvent.Error, expect.objectContaining({
392
+ errorType: ErrorDetailsTypes.API,
393
+ message: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
394
+ code: EmbedErrorCodes.PARSING_API_INTERCEPT_BODY_ERROR,
395
+ error: ERROR_MESSAGE.ERROR_PARSING_API_INTERCEPT_BODY,
396
+ }));
381
397
  });
382
398
  it('should handle event data with missing body', async () => {
383
399
  const eventData = {