@thoughtspot/visual-embed-sdk 1.36.3 → 1.36.4

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 (167) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/embed/app.d.ts.map +1 -1
  3. package/cjs/src/embed/app.js +1 -1
  4. package/cjs/src/embed/app.js.map +1 -1
  5. package/cjs/src/embed/base.d.ts +4 -0
  6. package/cjs/src/embed/base.d.ts.map +1 -1
  7. package/cjs/src/embed/base.js +27 -1
  8. package/cjs/src/embed/base.js.map +1 -1
  9. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  10. package/cjs/src/embed/bodyless-conversation.js +1 -1
  11. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  12. package/cjs/src/embed/conversation.d.ts.map +1 -1
  13. package/cjs/src/embed/conversation.js +1 -1
  14. package/cjs/src/embed/conversation.js.map +1 -1
  15. package/cjs/src/embed/embedConfig.d.ts.map +1 -1
  16. package/cjs/src/embed/embedConfig.js.map +1 -1
  17. package/cjs/src/embed/liveboard.d.ts +2 -2
  18. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  19. package/cjs/src/embed/liveboard.js +4 -5
  20. package/cjs/src/embed/liveboard.js.map +1 -1
  21. package/cjs/src/embed/liveboard.spec.js +11 -11
  22. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  23. package/cjs/src/embed/sage.d.ts.map +1 -1
  24. package/cjs/src/embed/sage.js +1 -1
  25. package/cjs/src/embed/sage.js.map +1 -1
  26. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  27. package/cjs/src/embed/search-bar.js +1 -1
  28. package/cjs/src/embed/search-bar.js.map +1 -1
  29. package/cjs/src/embed/search.d.ts.map +1 -1
  30. package/cjs/src/embed/search.js +1 -1
  31. package/cjs/src/embed/search.js.map +1 -1
  32. package/cjs/src/embed/ts-embed.d.ts +4 -3
  33. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  34. package/cjs/src/embed/ts-embed.js +25 -16
  35. package/cjs/src/embed/ts-embed.js.map +1 -1
  36. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  37. package/cjs/src/embed/ts-embed.spec.js +71 -5
  38. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  39. package/cjs/src/errors.d.ts +1 -0
  40. package/cjs/src/errors.d.ts.map +1 -1
  41. package/cjs/src/errors.js +1 -0
  42. package/cjs/src/errors.js.map +1 -1
  43. package/cjs/src/react/all-types-export.d.ts +1 -1
  44. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  45. package/cjs/src/react/all-types-export.js +2 -1
  46. package/cjs/src/react/all-types-export.js.map +1 -1
  47. package/cjs/src/react/index.d.ts +16 -0
  48. package/cjs/src/react/index.d.ts.map +1 -1
  49. package/cjs/src/react/index.js +25 -2
  50. package/cjs/src/react/index.js.map +1 -1
  51. package/cjs/src/utils/with-resolvers-polyfill.d.ts +1 -0
  52. package/cjs/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  53. package/cjs/src/utils/with-resolvers-polyfill.js +12 -0
  54. package/cjs/src/utils/with-resolvers-polyfill.js.map +1 -0
  55. package/cjs/src/utils.d.ts +17 -2
  56. package/cjs/src/utils.d.ts.map +1 -1
  57. package/cjs/src/utils.js +27 -3
  58. package/cjs/src/utils.js.map +1 -1
  59. package/dist/{index-BJx3m5_V.js → index-NZYq1Tu3.js} +1 -1
  60. package/dist/src/embed/app.d.ts.map +1 -1
  61. package/dist/src/embed/base.d.ts +4 -0
  62. package/dist/src/embed/base.d.ts.map +1 -1
  63. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  64. package/dist/src/embed/conversation.d.ts.map +1 -1
  65. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  66. package/dist/src/embed/liveboard.d.ts +2 -2
  67. package/dist/src/embed/liveboard.d.ts.map +1 -1
  68. package/dist/src/embed/sage.d.ts.map +1 -1
  69. package/dist/src/embed/search-bar.d.ts.map +1 -1
  70. package/dist/src/embed/search.d.ts.map +1 -1
  71. package/dist/src/embed/ts-embed.d.ts +4 -3
  72. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  73. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  74. package/dist/src/errors.d.ts +1 -0
  75. package/dist/src/errors.d.ts.map +1 -1
  76. package/dist/src/react/all-types-export.d.ts +1 -1
  77. package/dist/src/react/all-types-export.d.ts.map +1 -1
  78. package/dist/src/react/index.d.ts +16 -0
  79. package/dist/src/react/index.d.ts.map +1 -1
  80. package/dist/src/utils/with-resolvers-polyfill.d.ts +1 -0
  81. package/dist/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  82. package/dist/src/utils.d.ts +17 -2
  83. package/dist/src/utils.d.ts.map +1 -1
  84. package/dist/tsembed-react.es.js +349 -45
  85. package/dist/tsembed-react.js +347 -42
  86. package/dist/tsembed.es.js +85 -32
  87. package/dist/tsembed.js +84 -31
  88. package/dist/visual-embed-sdk-react-full.d.ts +1233 -1214
  89. package/dist/visual-embed-sdk-react.d.ts +668 -649
  90. package/dist/visual-embed-sdk.d.ts +9 -4
  91. package/lib/package.json +1 -1
  92. package/lib/src/embed/app.d.ts.map +1 -1
  93. package/lib/src/embed/app.js +1 -1
  94. package/lib/src/embed/app.js.map +1 -1
  95. package/lib/src/embed/base.d.ts +4 -0
  96. package/lib/src/embed/base.d.ts.map +1 -1
  97. package/lib/src/embed/base.js +24 -1
  98. package/lib/src/embed/base.js.map +1 -1
  99. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  100. package/lib/src/embed/bodyless-conversation.js +1 -1
  101. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  102. package/lib/src/embed/conversation.d.ts.map +1 -1
  103. package/lib/src/embed/conversation.js +1 -1
  104. package/lib/src/embed/conversation.js.map +1 -1
  105. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  106. package/lib/src/embed/embedConfig.js.map +1 -1
  107. package/lib/src/embed/liveboard.d.ts +2 -2
  108. package/lib/src/embed/liveboard.d.ts.map +1 -1
  109. package/lib/src/embed/liveboard.js +4 -5
  110. package/lib/src/embed/liveboard.js.map +1 -1
  111. package/lib/src/embed/liveboard.spec.js +11 -11
  112. package/lib/src/embed/liveboard.spec.js.map +1 -1
  113. package/lib/src/embed/sage.d.ts.map +1 -1
  114. package/lib/src/embed/sage.js +1 -1
  115. package/lib/src/embed/sage.js.map +1 -1
  116. package/lib/src/embed/search-bar.d.ts.map +1 -1
  117. package/lib/src/embed/search-bar.js +1 -1
  118. package/lib/src/embed/search-bar.js.map +1 -1
  119. package/lib/src/embed/search.d.ts.map +1 -1
  120. package/lib/src/embed/search.js +1 -1
  121. package/lib/src/embed/search.js.map +1 -1
  122. package/lib/src/embed/ts-embed.d.ts +4 -3
  123. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  124. package/lib/src/embed/ts-embed.js +26 -17
  125. package/lib/src/embed/ts-embed.js.map +1 -1
  126. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  127. package/lib/src/embed/ts-embed.spec.js +71 -5
  128. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  129. package/lib/src/errors.d.ts +1 -0
  130. package/lib/src/errors.d.ts.map +1 -1
  131. package/lib/src/errors.js +1 -0
  132. package/lib/src/errors.js.map +1 -1
  133. package/lib/src/react/all-types-export.d.ts +1 -1
  134. package/lib/src/react/all-types-export.d.ts.map +1 -1
  135. package/lib/src/react/all-types-export.js +1 -1
  136. package/lib/src/react/all-types-export.js.map +1 -1
  137. package/lib/src/react/index.d.ts +16 -0
  138. package/lib/src/react/index.d.ts.map +1 -1
  139. package/lib/src/react/index.js +23 -1
  140. package/lib/src/react/index.js.map +1 -1
  141. package/lib/src/utils/with-resolvers-polyfill.d.ts +1 -0
  142. package/lib/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  143. package/lib/src/utils/with-resolvers-polyfill.js +12 -0
  144. package/lib/src/utils/with-resolvers-polyfill.js.map +1 -0
  145. package/lib/src/utils.d.ts +17 -2
  146. package/lib/src/utils.d.ts.map +1 -1
  147. package/lib/src/utils.js +25 -2
  148. package/lib/src/utils.js.map +1 -1
  149. package/lib/src/visual-embed-sdk.d.ts +10 -5
  150. package/package.json +1 -1
  151. package/src/embed/app.ts +2 -1
  152. package/src/embed/base.ts +41 -1
  153. package/src/embed/bodyless-conversation.ts +2 -1
  154. package/src/embed/conversation.ts +2 -1
  155. package/src/embed/embedConfig.ts +1 -1
  156. package/src/embed/liveboard.spec.ts +11 -11
  157. package/src/embed/liveboard.ts +5 -6
  158. package/src/embed/sage.ts +1 -2
  159. package/src/embed/search-bar.tsx +1 -2
  160. package/src/embed/search.ts +1 -2
  161. package/src/embed/ts-embed.spec.ts +83 -5
  162. package/src/embed/ts-embed.ts +33 -17
  163. package/src/errors.ts +1 -0
  164. package/src/react/all-types-export.ts +1 -0
  165. package/src/react/index.tsx +27 -2
  166. package/src/utils/with-resolvers-polyfill.ts +11 -0
  167. package/src/utils.ts +35 -4
@@ -250,6 +250,20 @@ type EmbedComponent = typeof SearchEmbed | typeof AppEmbed | typeof LiveboardEmb
250
250
  * @returns {React.MutableRefObject<T extends TsEmbed>} ref
251
251
  */
252
252
  export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<React.ComponentRef<T>>;
253
+ /**
254
+ *
255
+ * @param config - EmbedConfig
256
+ * @returns AuthEventEmitter
257
+ * @example
258
+ * ```
259
+ * function Component() {
260
+ * const authEE = useInit({ ...initConfig });
261
+ * return <LiveboardEmbed ref={ref} liveboardId={<id>} />
262
+ * }
263
+ * ```
264
+ * @version SDK: 1.36.2 | ThoughtSpot: *
265
+ */
266
+ export function useInit(config: EmbedConfig): React.MutableRefObject<AuthEventEmitter>;
253
267
 
254
268
  /**
255
269
  * Copyright (c) 2023
@@ -261,6 +275,181 @@ export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<
261
275
  */
262
276
  export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload, UIPassthroughEvent, };
263
277
 
278
+ export declare let loggedInStatus: boolean;
279
+ export declare let samlAuthWindow: Window;
280
+ export declare let samlCompletionPromise: Promise<void>;
281
+ export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
282
+ /**
283
+ * Enum for auth failure types. This is the parameter passed to the listner
284
+ * of {@link AuthStatus.FAILURE}.
285
+ * @group Authentication / Init
286
+ */
287
+ export declare enum AuthFailureType {
288
+ SDK = "SDK",
289
+ NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
290
+ EXPIRY = "EXPIRY",
291
+ OTHER = "OTHER",
292
+ IDLE_SESSION_TIMEOUT = "IDLE_SESSION_TIMEOUT"
293
+ }
294
+ /**
295
+ * Enum for auth status emitted by the emitter returned from {@link init}.
296
+ * @group Authentication / Init
297
+ */
298
+ export declare enum AuthStatus {
299
+ /**
300
+ * Emits when the SDK fails to authenticate
301
+ */
302
+ FAILURE = "FAILURE",
303
+ /**
304
+ * Emits when the SDK authenticates successfully
305
+ */
306
+ SDK_SUCCESS = "SDK_SUCCESS",
307
+ /**
308
+ * @hidden
309
+ * Emits when iframe is loaded and session info is available
310
+ */
311
+ SESSION_INFO_SUCCESS = "SESSION_INFO_SUCCESS",
312
+ /**
313
+ * Emits when the app sends an authentication success message
314
+ */
315
+ SUCCESS = "SUCCESS",
316
+ /**
317
+ * Emits when a user logs out
318
+ */
319
+ LOGOUT = "LOGOUT",
320
+ /**
321
+ * Emitted when inPopup is true in the SAMLRedirect flow and the
322
+ * popup is waiting to be triggered either programmatically
323
+ * or by the trigger button.
324
+ * @version SDK: 1.19.0
325
+ */
326
+ WAITING_FOR_POPUP = "WAITING_FOR_POPUP"
327
+ }
328
+ /**
329
+ * Event emitter returned from {@link init}.
330
+ * @group Authentication / Init
331
+ */
332
+ export interface AuthEventEmitter {
333
+ /**
334
+ * Register a listener on Auth failure.
335
+ * @param event
336
+ * @param listener
337
+ */
338
+ on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
339
+ /**
340
+ * Register a listener on Auth SDK success.
341
+ * @param event
342
+ * @param listener
343
+ */
344
+ on(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
345
+ on(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
346
+ once(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
347
+ once(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
348
+ once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
349
+ /**
350
+ * Trigger an event on the emitter returned from init.
351
+ * @param {@link AuthEvent}
352
+ */
353
+ emit(event: AuthEvent, ...args: any[]): boolean;
354
+ /**
355
+ * Remove listener from the emitter returned from init.
356
+ * @param event
357
+ * @param listener
358
+ * @param context
359
+ * @param once
360
+ */
361
+ off(event: AuthStatus, listener: (...args: any[]) => void, context: any, once: boolean): this;
362
+ /**
363
+ * Remove all the event listeners
364
+ * @param event
365
+ */
366
+ removeAllListeners(event: AuthStatus): this;
367
+ }
368
+ /**
369
+ * Events which can be triggered on the emitter returned from {@link init}.
370
+ * @group Authentication / Init
371
+ */
372
+ export declare enum AuthEvent {
373
+ /**
374
+ * Manually trigger the SSO popup. This is useful when
375
+ * authStatus is SAMLRedirect/OIDCRedirect and inPopup is set to true
376
+ */
377
+ TRIGGER_SSO_POPUP = "TRIGGER_SSO_POPUP"
378
+ }
379
+ /**
380
+ *
381
+ */
382
+ export declare function getAuthEE(): EventEmitter<AuthStatus | AuthEvent>;
383
+ /**
384
+ *
385
+ * @param eventEmitter
386
+ */
387
+ export declare function setAuthEE(eventEmitter: EventEmitter<AuthStatus | AuthEvent>): void;
388
+ /**
389
+ *
390
+ */
391
+ export declare function notifyAuthSDKSuccess(): void;
392
+ /**
393
+ *
394
+ */
395
+ export declare function notifyAuthSuccess(): Promise<void>;
396
+ /**
397
+ *
398
+ * @param failureType
399
+ */
400
+ export declare function notifyAuthFailure(failureType: AuthFailureType): void;
401
+ /**
402
+ *
403
+ */
404
+ export declare function notifyLogout(): void;
405
+ /**
406
+ * Services to be called after the login is successful,
407
+ * This should be called after the cookie is set for cookie auth or
408
+ * after the token is set for cookieless.
409
+ * @return {Promise<void>}
410
+ * @example
411
+ * ```js
412
+ * await postLoginService();
413
+ * ```
414
+ * @version SDK: 1.28.3 | ThoughtSpot: *
415
+ */
416
+ export declare function postLoginService(): Promise<void>;
417
+ /**
418
+ * Return releaseVersion if available
419
+ */
420
+ export declare function getReleaseVersion(): string;
421
+ /**
422
+ * Perform token based authentication
423
+ * @param embedConfig The embed configuration
424
+ */
425
+ export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
426
+ /**
427
+ * Validate embedConfig parameters required for cookielessTokenAuth
428
+ * @param embedConfig The embed configuration
429
+ */
430
+ export declare const doCookielessTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
431
+ /**
432
+ * Perform basic authentication to the ThoughtSpot cluster using the cluster
433
+ * credentials.
434
+ *
435
+ * Warning: This feature is primarily intended for developer testing. It is
436
+ * strongly advised not to use this authentication method in production.
437
+ * @param embedConfig The embed configuration
438
+ */
439
+ export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
440
+ export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
441
+ export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
442
+ export declare const logout: (embedConfig: EmbedConfig) => Promise<boolean>;
443
+ /**
444
+ * Perform authentication on the ThoughtSpot cluster
445
+ * @param embedConfig The embed configuration
446
+ */
447
+ export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean>;
448
+ /**
449
+ * Check if we are authenticated to the ThoughtSpot cluster
450
+ */
451
+ export declare const isAuthenticated: () => boolean;
452
+
264
453
  /**
265
454
  * @group Embed components
266
455
  */
@@ -1712,7 +1901,7 @@ export declare class LiveboardEmbed extends V1Embed {
1712
1901
  */
1713
1902
  protected getEmbedParams(): string;
1714
1903
  protected beforePrerenderVisible(): void;
1715
- protected handleRenderForPrerender(): void;
1904
+ protected handleRenderForPrerender(): Promise<TsEmbed>;
1716
1905
  /**
1717
1906
  * Triggers an event to the embedded app
1718
1907
  * @param {HostEvent} messageType The event type
@@ -1740,1159 +1929,798 @@ export declare class LiveboardEmbed extends V1Embed {
1740
1929
  export declare class PinboardEmbed extends LiveboardEmbed {
1741
1930
  }
1742
1931
 
1743
- export type EmbedEventHandlers = {
1744
- [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
1745
- };
1746
- export interface EmbedProps extends ViewConfig, EmbedEventHandlers {
1747
- className?: string;
1748
- }
1749
- export interface ViewConfigAndListeners<T extends ViewConfig> {
1750
- viewConfig: T;
1751
- listeners: {
1752
- [key in EmbedEvent]?: MessageCallback;
1753
- };
1754
- }
1755
- /**
1756
- *
1757
- * @param props
1758
- */
1759
- export function getViewPropsAndListeners<T extends EmbedProps, U extends ViewConfig>(props: T): ViewConfigAndListeners<U>;
1760
-
1761
1932
  /**
1762
- * Configuration for search options
1933
+ * Copyright (c) 2023
1934
+ *
1935
+ * TypeScript type definitions for ThoughtSpot Visual Embed SDK
1936
+ * @summary Type definitions for Embed SDK
1937
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
1763
1938
  */
1764
- export interface SearchOptions {
1765
- /**
1766
- * The query string to pass to start the Conversation.
1767
- */
1768
- searchQuery: string;
1769
- }
1770
1939
  /**
1771
- * The configuration for the embedded conversationEmbed options.
1772
- * @group Embed components
1940
+ * The authentication mechanism for allowing access to the
1941
+ * the embedded app
1942
+ * @group Authentication / Init
1773
1943
  */
1774
- export interface ConversationViewConfig extends ViewConfig {
1775
- /**
1776
- * The ID of the worksheet to use for the conversation.
1777
- */
1778
- worksheetId: string;
1779
- /**
1780
- * Ability to pass a starting search query to the conversation.
1781
- */
1782
- searchOptions?: SearchOptions;
1944
+ export declare enum AuthType {
1783
1945
  /**
1784
- * disableSourceSelection : Disables data source selection
1785
- * but still display the selected data source.
1946
+ * No authentication on the SDK. Pass-through to the embedded App. Alias for
1947
+ * `Passthrough`.
1786
1948
  * @example
1787
1949
  * ```js
1788
- * const embed = new ConversationEmbed('#tsEmbed', {
1789
- * ... // other options
1790
- * disableSourceSelection : true,
1791
- * })
1950
+ * init({
1951
+ * // ...
1952
+ * authType: AuthType.None,
1953
+ * });
1792
1954
  * ```
1793
- * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
1794
1955
  */
1795
- disableSourceSelection?: boolean;
1956
+ None = "None",
1796
1957
  /**
1797
- * hideSourceSelection : Hide data source selection
1958
+ * Passthrough SSO to the embedded application within the iframe. Requires least
1959
+ * configuration, but may not be supported by all IDPs. This will behave like `None`
1960
+ * if SSO is not configured on ThoughtSpot.
1961
+ *
1962
+ * To use this:
1963
+ * Your SAML or OpenID provider must allow iframe redirects.
1964
+ * For example, if you are using Okta as IdP, you can enable iframe embedding.
1798
1965
  * @example
1799
1966
  * ```js
1800
- * const embed = new ConversationEmbed('#tsEmbed', {
1801
- * ... // other options
1802
- * hideSourceSelection : true,
1803
- * })
1804
- * ```
1805
- * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
1967
+ * init({
1968
+ * // ...
1969
+ * authType: AuthType.EmbeddedSSO,
1970
+ * });
1971
+ * ```
1972
+ * @version: SDK: 1.15.0 | ThoughtSpot: 8.8.0.cl
1806
1973
  */
1807
- hideSourceSelection?: boolean;
1974
+ EmbeddedSSO = "EmbeddedSSO",
1808
1975
  /**
1809
- * Flag to control Data panel experience
1810
- * @default false
1811
- * @version SDK: 1.36.0 | ThoughtSpot Cloud: 10.4.0.cl
1976
+ * SSO using SAML
1977
+ * @deprecated Use {@link SAMLRedirect} instead
1978
+ * @hidden
1979
+ */
1980
+ SSO = "SSO_SAML",
1981
+ /**
1982
+ * SSO using SAML
1983
+ * @deprecated Use {@link SAMLRedirect} instead
1984
+ * @hidden
1985
+ */
1986
+ SAML = "SSO_SAML",
1987
+ /**
1988
+ * SSO using SAML
1989
+ * Makes the host application redirect to the SAML IdP. Use this
1990
+ * if your IdP does not allow itself to be embedded.
1991
+ *
1992
+ * This redirects the host application to the SAML IdP. The host application
1993
+ * will be redirected back to the ThoughtSpot app after authentication.
1812
1994
  * @example
1813
1995
  * ```js
1814
- * const embed = new AppEmbed('#tsEmbed', {
1815
- * ... // other options
1816
- * dataPanelV2: true,
1817
- * })
1996
+ * init({
1997
+ * // ...
1998
+ * authType: AuthType.SAMLRedirect,
1999
+ * });
2000
+ * ```
2001
+ *
2002
+ * This opens the SAML IdP in a popup window. The popup is triggered
2003
+ * when the user clicks the trigger button. The popup window will be
2004
+ * closed automatically after authentication.
2005
+ * @example
2006
+ * ```js
2007
+ * init({
2008
+ * // ...
2009
+ * authType: AuthType.SAMLRedirect,
2010
+ * authTriggerText: 'Login with SAML',
2011
+ * authTriggerContainer: '#embed-container',
2012
+ * inPopup: true,
2013
+ * });
2014
+ * ```
2015
+ *
2016
+ * Can also use the event to trigger the popup flow. Works the same
2017
+ * as the above example.
2018
+ * @example
2019
+ * ```js
2020
+ * const authEE = init({
2021
+ * // ...
2022
+ * authType: AuthType.SAMLRedirect,
2023
+ * inPopup: true,
2024
+ * });
2025
+ *
2026
+ * someButtonOnYourPage.addEventListener('click', () => {
2027
+ * authEE.emit(AuthEvent.TRIGGER_SSO_POPUP);
2028
+ * });
1818
2029
  * ```
1819
2030
  */
1820
- dataPanelV2?: boolean;
2031
+ SAMLRedirect = "SSO_SAML",
1821
2032
  /**
1822
- * showSpotterLimitations : show limitation text
1823
- * of the spotter underneath the chat input.
1824
- * default is false.
2033
+ * SSO using OIDC
2034
+ * @hidden
2035
+ * @deprecated Use {@link OIDCRedirect} instead
2036
+ */
2037
+ OIDC = "SSO_OIDC",
2038
+ /**
2039
+ * SSO using OIDC
2040
+ * Will make the host application redirect to the OIDC IdP.
2041
+ * See code samples in {@link SAMLRedirect}.
2042
+ */
2043
+ OIDCRedirect = "SSO_OIDC",
2044
+ /**
2045
+ * Trusted authentication server
2046
+ * @hidden
2047
+ * @deprecated Use {@link TrustedAuth} instead
2048
+ */
2049
+ AuthServer = "AuthServer",
2050
+ /**
2051
+ * Trusted authentication server. Use your own authentication server
2052
+ * which returns a bearer token, generated using the `secret_key` obtained
2053
+ * from ThoughtSpot.
1825
2054
  * @example
1826
2055
  * ```js
1827
- * const embed = new ConversationEmbed('#tsEmbed', {
1828
- * ... // other options
1829
- * showSpotterLimitations : true,
1830
- * })
2056
+ * init({
2057
+ * // ...
2058
+ * authType: AuthType.TrustedAuthToken,
2059
+ * getAuthToken: () => {
2060
+ * return fetch('https://my-backend.app/ts-token')
2061
+ * .then((response) => response.json())
2062
+ * .then((data) => data.token);
2063
+ * }
2064
+ * });
1831
2065
  * ```
1832
- * @version SDK: 1.36.0 | Thoughtspot: 10.5.0.cl
1833
2066
  */
1834
- showSpotterLimitations?: boolean;
2067
+ TrustedAuthToken = "AuthServer",
1835
2068
  /**
1836
- * hideSampleQuestions : Hide sample questions on
1837
- * the initial screen of the conversation.
2069
+ * Trusted authentication server Cookieless, Use your own authentication
2070
+ * server which returns a bearer token, generated using the `secret_key`
2071
+ * obtained from ThoughtSpot. This uses a cookieless authentication
2072
+ * approach, recommended to bypass the third-party cookie-blocking restriction
2073
+ * implemented by some browsers.
1838
2074
  * @example
1839
2075
  * ```js
1840
- * const embed = new ConversationEmbed('#tsEmbed', {
1841
- * ... // other options
1842
- * hideSampleQuestions : true,
1843
- * })
2076
+ * init({
2077
+ * // ...
2078
+ * authType: AuthType.TrustedAuthTokenCookieless,
2079
+ * getAuthToken: () => {
2080
+ * return fetch('https://my-backend.app/ts-token')
2081
+ * .then((response) => response.json())
2082
+ * .then((data) => data.token);
2083
+ * }
1844
2084
  * ```
1845
- * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
2085
+ * @version SDK: 1.22.0| ThoughtSpot: 9.3.0.cl, 9.5.1.sw
1846
2086
  */
1847
- hideSampleQuestions?: boolean;
2087
+ TrustedAuthTokenCookieless = "AuthServerCookieless",
2088
+ /**
2089
+ * Use the ThoughtSpot login API to authenticate to the cluster directly.
2090
+ *
2091
+ * Warning: This feature is primarily intended for developer testing. It is
2092
+ * strongly advised not to use this authentication method in production.
2093
+ */
2094
+ Basic = "Basic"
1848
2095
  }
1849
2096
  /**
1850
- * Embed ThoughtSpot AI Conversation.
1851
- * @group Embed components
1852
- * @example
1853
- * ```js
1854
- * const conversation = new ConversationEmbed('#tsEmbed', {
1855
- * worksheetId: 'worksheetId',
1856
- * searchOptions: {
1857
- * searchQuery: 'searchQuery',
1858
- * },
1859
- * });
1860
- * conversation.render();
1861
- * ```
1862
- * @version SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl
2097
+ *
2098
+ * This option does not apply to the classic homepage experience.
2099
+ * To access the updated modular homepage,
2100
+ * set `modularHomeExperience` to `true`
2101
+ * (available as Early Access feature in 9.12.5.cl).
2102
+ *
1863
2103
  */
1864
- export declare class ConversationEmbed extends TsEmbed {
1865
- protected viewConfig: ConversationViewConfig;
1866
- constructor(container: HTMLElement, viewConfig: ConversationViewConfig);
1867
- getIframeSrc(): string;
1868
- render(): Promise<ConversationEmbed>;
1869
- }
1870
-
1871
- export interface executeTMLInput {
1872
- metadata_tmls: string[];
1873
- import_policy?: 'PARTIAL' | 'ALL_OR_NONE' | 'VALIDATE_ONLY';
1874
- create_new?: boolean;
1875
- }
1876
- export interface exportTMLInput {
1877
- metadata: {
1878
- identifier: string;
1879
- type?: 'LIVEBOARD' | 'ANSWER' | 'LOGICAL_TABLE' | 'CONNECTION';
1880
- }[];
1881
- export_associated?: boolean;
1882
- export_fqn?: boolean;
1883
- edoc_format?: 'YAML' | 'JSON';
2104
+ export declare enum HomeLeftNavItem {
2105
+ /**
2106
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2107
+ */
2108
+ SearchData = "search-data",
2109
+ /**
2110
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2111
+ */
2112
+ Home = "insights-home",
2113
+ /**
2114
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2115
+ */
2116
+ Liveboards = "liveboards",
2117
+ /**
2118
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2119
+ */
2120
+ Answers = "answers",
2121
+ /**
2122
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2123
+ */
2124
+ MonitorSubscription = "monitor-alerts",
2125
+ /**
2126
+ * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2127
+ */
2128
+ SpotIQAnalysis = "spotiq-analysis",
2129
+ /**
2130
+ * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
2131
+ */
2132
+ LiveboardSchedules = "liveboard-schedules"
1884
2133
  }
1885
- export declare let authPromise: Promise<boolean>;
1886
- export declare const getAuthPromise: () => Promise<boolean>;
1887
- export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
2134
+ export type DOMSelector = string | HTMLElement;
1888
2135
  /**
1889
- * Perform authentication on the ThoughtSpot app as applicable.
2136
+ * inline customCSS within the {@link CustomisationsInterface}.
2137
+ * Use {@link CustomCssVariables} or css rules.
1890
2138
  */
1891
- export declare const handleAuth: () => Promise<boolean>;
2139
+ export interface customCssInterface {
2140
+ /**
2141
+ * The custom css variables, which can be set.
2142
+ * The variables are available in the {@link CustomCssVariables}
2143
+ * interface. For more information, see
2144
+ * link:https://developers.thoughtspot.com/docs/css-variables-reference[CSS variable reference].
2145
+ */
2146
+ variables?: CustomCssVariables;
2147
+ /**
2148
+ * Can be used to define a custom font face
2149
+ * like:
2150
+ * @example
2151
+ * ```js
2152
+ * rules_UNSTABLE?: {
2153
+ * "@font-face": {
2154
+ * "font-family": "custom-font",
2155
+ * "src": url("/path/")
2156
+ * };
2157
+ * };
2158
+ * ```
2159
+ *
2160
+ * Also, custom css rules outside of variables.
2161
+ * @example
2162
+ * ```js
2163
+ * rules_UNSTABLE?: {
2164
+ * ".thoughtspot_class_name": {
2165
+ * "border-radius": "10px",
2166
+ * margin: "20px"
2167
+ * };
2168
+ * };
2169
+ * ```
2170
+ */
2171
+ rules_UNSTABLE?: {
2172
+ [selector: string]: {
2173
+ [declaration: string]: string;
2174
+ };
2175
+ };
2176
+ }
1892
2177
  /**
1893
- * Prefetches static resources from the specified URL. Web browsers can then cache the
1894
- * prefetched resources and serve them from the user's local disk to provide faster access
1895
- * to your app.
1896
- * @param url The URL provided for prefetch
1897
- * @param prefetchFeatures Specify features which needs to be prefetched.
1898
- * @param additionalFlags This can be used to add any URL flag.
1899
- * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
1900
- * @group Global methods
1901
- */
1902
- export declare const prefetch: (url?: string, prefetchFeatures?: PrefetchFeatures[], additionalFlags?: {
1903
- [key: string]: string | number | boolean;
1904
- }) => void;
1905
- /**
1906
- * Initializes the Visual Embed SDK globally and perform
1907
- * authentication if applicable. This function needs to be called before any ThoughtSpot
1908
- * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
1909
- * to actually embed. That is handled internally.
1910
- * @param embedConfig The configuration object containing ThoughtSpot host,
1911
- * authentication mechanism and so on.
1912
- * @example
1913
- * ```js
1914
- * const authStatus = init({
1915
- * thoughtSpotHost: 'https://my.thoughtspot.cloud',
1916
- * authType: AuthType.None,
1917
- * });
1918
- * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
1919
- * ```
1920
- * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
1921
- * failure and logout. See {@link AuthStatus}
1922
- * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
1923
- * @group Authentication / Init
1924
- */
1925
- export declare const init: (embedConfig: EmbedConfig) => AuthEventEmitter;
1926
- /**
1927
- *
1928
- */
1929
- export declare function disableAutoLogin(): void;
1930
- /**
1931
- * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
1932
- * prevent the SDK from automatically logging in again.
1933
- *
1934
- * You can call the `init` method again to re login, if autoLogin is set to
1935
- * true in this second call it will be honored.
1936
- * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
1937
- * @returns Promise which resolves when logout completes.
1938
- * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
1939
- * @group Global methods
1940
- */
1941
- export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
1942
- /**
1943
- * Renders functions in a queue, resolves to next function only after the callback next
1944
- * is called
1945
- * @param fn The function being registered
1946
- */
1947
- export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
1948
- /**
1949
- * Imports TML representation of the metadata objects into ThoughtSpot.
1950
- * @param data
1951
- * @returns imports TML data into ThoughtSpot
1952
- * @example
1953
- * ```js
1954
- * executeTML({
1955
- * //Array of metadata Tmls in string format
1956
- * metadata_tmls: [
1957
- * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
1958
- * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
1959
- * ],
1960
- * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
1961
- * create_new: false, // If selected, creates TML objects with new GUIDs.
1962
- * }).then(result => {
1963
- * console.log(result);
1964
- * }).catch(error => {
1965
- * console.error(error);
1966
- * });
1967
- *```
1968
- * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
1969
- * @group Global methods
1970
- */
1971
- export declare const executeTML: (data: executeTMLInput) => Promise<any>;
1972
- /**
1973
- * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
1974
- * format.
1975
- * @param data
1976
- * @returns exports TML data
1977
- * @example
1978
- * ```js
1979
- * exportTML({
1980
- * metadata: [
1981
- * {
1982
- * type: "LIVEBOARD", //Metadata Type
1983
- * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
1984
- * }
1985
- * ],
1986
- * export_associated: false,//indicates whether to export associated metadata objects
1987
- * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
1988
- * //exporting a Liveboard and its associated objects, the API
1989
- * //returns the Liveboard TML data with the FQNs of the referenced
1990
- * //worksheet. If the exported TML data includes FQNs, you don't need
1991
- * //to manually add FQNs of the referenced objects during TML import.
1992
- * edoc_format: "JSON" //It takes JSON or YAML value
1993
- * }).then(result => {
1994
- * console.log(result);
1995
- * }).catch(error => {
1996
- * console.error(error);
1997
- * });
1998
- * ```
1999
- * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
2000
- * @group Global methods
2001
- */
2002
- export declare const exportTML: (data: exportTMLInput) => Promise<any>;
2003
- /**
2004
- *
2005
- */
2006
- export declare function reset(): void;
2007
-
2008
- /**
2009
- * Configuration for bodyless conversation options.
2010
- * @group Embed components
2178
+ * Styles within the {@link CustomisationsInterface}.
2011
2179
  */
2012
- export interface BodylessConversationViewConfig extends ViewConfig {
2013
- /**
2014
- * The ID of the worksheet to use for the conversation.
2015
- */
2016
- worksheetId: string;
2180
+ export interface CustomStyles {
2181
+ customCSSUrl?: string;
2182
+ customCSS?: customCssInterface;
2017
2183
  }
2018
2184
  /**
2019
- * Create a conversation embed, which can be integrated inside
2020
- * chatbots or other conversational interfaces.
2185
+ * Configuration to define the customization on the Embedded
2186
+ * ThoughtSpot components.
2187
+ * You can customize styles, text strings, and icons.
2188
+ * For more information, see https://developers.thoughtspot.com/docs/custom-css.
2021
2189
  * @example
2022
2190
  * ```js
2023
- * import { BodylessConversation } from '@thoughtspot/visual-embed-sdk';
2024
- *
2025
- * const conversation = new BodylessConversation({
2026
- * worksheetId: 'worksheetId',
2027
- * });
2028
- *
2029
- * const { container, error } = await conversation.sendMessage('show me sales by region');
2030
- *
2031
- * // append the container to the DOM
2032
- * document.body.appendChild(container); // or to any other element
2191
+ * init({
2192
+ * // ...
2193
+ * customizations: {
2194
+ * style: {
2195
+ * customCSS: {
2196
+ * variables: {},
2197
+ * rules_UNSTABLE: {}
2198
+ * }
2199
+ * },
2200
+ * content: {
2201
+ * strings: {
2202
+ * 'LIVEBOARDS': 'Dashboards',
2203
+ * 'ANSWERS': 'Visualizations',
2204
+ * 'Edit': 'Modify',
2205
+ * 'Show underlying data': 'Show source data',
2206
+ * 'SpotIQ': 'Insights',
2207
+ * 'Monitor': 'Alerts',
2208
+ * }
2209
+ * },
2210
+ * iconSpriteUrl: 'https://my-custom-icon-sprite.svg'
2211
+ * }
2212
+ * })
2033
2213
  * ```
2034
- * @group Embed components
2035
- * @version SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl
2036
- */
2037
- export declare class BodylessConversation {
2038
- constructor(viewConfig: BodylessConversationViewConfig);
2039
- sendMessage(userMessage: string): Promise<{
2040
- error: any;
2041
- container?: undefined;
2042
- } | {
2043
- container: HTMLDivElement;
2044
- error?: undefined;
2045
- }>;
2046
- }
2047
-
2048
- export declare let loggedInStatus: boolean;
2049
- export declare let samlAuthWindow: Window;
2050
- export declare let samlCompletionPromise: Promise<void>;
2051
- export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
2052
- /**
2053
- * Enum for auth failure types. This is the parameter passed to the listner
2054
- * of {@link AuthStatus.FAILURE}.
2055
- * @group Authentication / Init
2056
2214
  */
2057
- export declare enum AuthFailureType {
2058
- SDK = "SDK",
2059
- NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
2060
- EXPIRY = "EXPIRY",
2061
- OTHER = "OTHER",
2062
- IDLE_SESSION_TIMEOUT = "IDLE_SESSION_TIMEOUT"
2215
+ export interface CustomisationsInterface {
2216
+ style?: CustomStyles;
2217
+ content?: {
2218
+ /**
2219
+ * @version SDK: 1.26.0 | 9.7.0.cl
2220
+ */
2221
+ strings?: Record<string, any>;
2222
+ [key: string]: any;
2223
+ };
2224
+ iconSpriteUrl?: string;
2063
2225
  }
2064
2226
  /**
2065
- * Enum for auth status emitted by the emitter returned from {@link init}.
2227
+ * The configuration object for embedding ThoughtSpot content.
2228
+ * It includes the ThoughtSpot hostname or IP address,
2229
+ * the type of authentication, and the authentication endpoint
2230
+ * if a trusted authentication server is used.
2066
2231
  * @group Authentication / Init
2067
2232
  */
2068
- export declare enum AuthStatus {
2233
+ export interface EmbedConfig {
2069
2234
  /**
2070
- * Emits when the SDK fails to authenticate
2235
+ * The ThoughtSpot cluster hostname or IP address.
2071
2236
  */
2072
- FAILURE = "FAILURE",
2237
+ thoughtSpotHost: string;
2073
2238
  /**
2074
- * Emits when the SDK authenticates successfully
2239
+ * The authentication mechanism to use.
2075
2240
  */
2076
- SDK_SUCCESS = "SDK_SUCCESS",
2241
+ authType: AuthType;
2077
2242
  /**
2078
- * @hidden
2079
- * Emits when iframe is loaded and session info is available
2243
+ * [AuthServer] The trusted authentication endpoint to use to get the
2244
+ * authentication token. A `GET` request is made to the
2245
+ * authentication API endpoint, which returns the token
2246
+ * as a plaintext response. For trusted authentication,
2247
+ * the `authEndpoint` or `getAuthToken` attribute is required.
2080
2248
  */
2081
- SESSION_INFO_SUCCESS = "SESSION_INFO_SUCCESS",
2249
+ authEndpoint?: string;
2082
2250
  /**
2083
- * Emits when the app sends an authentication success message
2251
+ * [AuthServer] A function that invokes the trusted authentication endpoint
2252
+ * and returns a Promise that resolves to the `auth token` string.
2253
+ * For trusted authentication, the `authEndpoint` or `getAuthToken`
2254
+ * attribute is required.
2255
+ *
2256
+ * It is advisable to fetch a new token inside this method and not
2257
+ * reuse the old issued token. When auth expires this method is
2258
+ * called again and if it is called with an older token, the authentication
2259
+ * will not succeed.
2084
2260
  */
2085
- SUCCESS = "SUCCESS",
2261
+ getAuthToken?: () => Promise<string>;
2086
2262
  /**
2087
- * Emits when a user logs out
2263
+ * [AuthServer / Basic] The user name of the ThoughtSpot user. This
2264
+ * attribute is required for trusted authentication.
2088
2265
  */
2089
- LOGOUT = "LOGOUT",
2266
+ username?: string;
2090
2267
  /**
2091
- * Emitted when inPopup is true in the SAMLRedirect flow and the
2092
- * popup is waiting to be triggered either programmatically
2093
- * or by the trigger button.
2094
- * @version SDK: 1.19.0
2268
+ * [Basic] The ThoughtSpot login password corresponding to the username
2269
+ *
2270
+ * Warning: This feature is primarily intended for developer testing. It is
2271
+ * strongly advised not to use this authentication method in production.
2095
2272
  */
2096
- WAITING_FOR_POPUP = "WAITING_FOR_POPUP"
2097
- }
2098
- /**
2099
- * Event emitter returned from {@link init}.
2100
- * @group Authentication / Init
2101
- */
2102
- export interface AuthEventEmitter {
2273
+ password?: string;
2103
2274
  /**
2104
- * Register a listener on Auth failure.
2105
- * @param event
2106
- * @param listener
2275
+ * [SSO] For SSO Authentication, if `noRedirect` is set to true, it will
2276
+ * open the SAML auth flow in a popup, instead of redirecting the browser in
2277
+ * place.
2278
+ * @default false
2279
+ * @deprecated
2107
2280
  */
2108
- on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
2281
+ noRedirect?: boolean;
2109
2282
  /**
2110
- * Register a listener on Auth SDK success.
2111
- * @param event
2112
- * @param listener
2283
+ * [SSO] For SSO Authentication, if `inPopup` is set to true, it will open
2284
+ * the SAML auth flow in a popup, instead of redirecting the browser in place.
2285
+ *
2286
+ * Need to use this with `authTriggerContainer`. Or manually trigger
2287
+ * the `AuthEvent.TRIGGER_SSO_POPUP` event on a user interaction.
2288
+ * @default false
2289
+ * @version SDK: 1.18.0
2113
2290
  */
2114
- on(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
2115
- on(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
2116
- once(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
2117
- once(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
2118
- once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
2291
+ inPopup?: boolean;
2119
2292
  /**
2120
- * Trigger an event on the emitter returned from init.
2121
- * @param {@link AuthEvent}
2293
+ * [SSO] For SSO Authentication, one can supply an optional path param;
2294
+ * This will be the path on the host origin where the SAML flow will be
2295
+ * terminated.
2296
+ *
2297
+ * Eg: "/dashboard", "#/foo" [Do not include the host]
2298
+ * @version SDK: 1.10.2 | ThoughtSpot 8.2.0.cl, 8.4.1.sw
2122
2299
  */
2123
- emit(event: AuthEvent, ...args: any[]): boolean;
2300
+ redirectPath?: string;
2301
+ /** @internal */
2302
+ basepath?: string;
2124
2303
  /**
2125
- * Remove listener from the emitter returned from init.
2126
- * @param event
2127
- * @param listener
2128
- * @param context
2129
- * @param once
2304
+ * Boolean to define if the query parameters in the ThoughtSpot URL
2305
+ * should be encoded in base64. This provides additional security to
2306
+ * ThoughtSpot clusters against cross-site scripting attacks.
2307
+ * @default false
2130
2308
  */
2131
- off(event: AuthStatus, listener: (...args: any[]) => void, context: any, once: boolean): this;
2309
+ shouldEncodeUrlQueryParams?: boolean;
2132
2310
  /**
2133
- * Remove all the event listeners
2134
- * @param event
2311
+ * Suppress cookie access alert when third-party cookies are blocked by the
2312
+ * user's browser. Third-party cookie blocking is the default behaviour on
2313
+ * some web browsers like Safari. If you set this attribute to `true`,
2314
+ * you are encouraged to handle `noCookieAccess` event, to show your own treatment
2315
+ * in this case.
2316
+ * @default false
2135
2317
  */
2136
- removeAllListeners(event: AuthStatus): this;
2137
- }
2138
- /**
2139
- * Events which can be triggered on the emitter returned from {@link init}.
2140
- * @group Authentication / Init
2141
- */
2142
- export declare enum AuthEvent {
2318
+ suppressNoCookieAccessAlert?: boolean;
2143
2319
  /**
2144
- * Manually trigger the SSO popup. This is useful when
2145
- * authStatus is SAMLRedirect/OIDCRedirect and inPopup is set to true
2320
+ * Ignore the cookie access alert when third-party cookies are blocked by the
2321
+ * user's browser. If you set this to `true`, the embedded iframe behaviour
2322
+ * persists even in the case of a non-logged-in user.
2323
+ * @default false
2146
2324
  */
2147
- TRIGGER_SSO_POPUP = "TRIGGER_SSO_POPUP"
2148
- }
2149
- /**
2150
- *
2151
- */
2152
- export declare function getAuthEE(): EventEmitter<AuthStatus | AuthEvent>;
2153
- /**
2154
- *
2155
- * @param eventEmitter
2156
- */
2157
- export declare function setAuthEE(eventEmitter: EventEmitter<AuthStatus | AuthEvent>): void;
2158
- /**
2159
- *
2160
- */
2161
- export declare function notifyAuthSDKSuccess(): void;
2162
- /**
2163
- *
2164
- */
2165
- export declare function notifyAuthSuccess(): Promise<void>;
2166
- /**
2167
- *
2168
- * @param failureType
2169
- */
2170
- export declare function notifyAuthFailure(failureType: AuthFailureType): void;
2171
- /**
2172
- *
2173
- */
2174
- export declare function notifyLogout(): void;
2175
- /**
2176
- * Services to be called after the login is successful,
2177
- * This should be called after the cookie is set for cookie auth or
2178
- * after the token is set for cookieless.
2179
- * @return {Promise<void>}
2180
- * @example
2181
- * ```js
2182
- * await postLoginService();
2183
- * ```
2184
- * @version SDK: 1.28.3 | ThoughtSpot: *
2185
- */
2186
- export declare function postLoginService(): Promise<void>;
2187
- /**
2188
- * Return releaseVersion if available
2189
- */
2190
- export declare function getReleaseVersion(): string;
2191
- /**
2192
- * Perform token based authentication
2193
- * @param embedConfig The embed configuration
2194
- */
2195
- export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
2196
- /**
2197
- * Validate embedConfig parameters required for cookielessTokenAuth
2198
- * @param embedConfig The embed configuration
2199
- */
2200
- export declare const doCookielessTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
2201
- /**
2202
- * Perform basic authentication to the ThoughtSpot cluster using the cluster
2203
- * credentials.
2204
- *
2205
- * Warning: This feature is primarily intended for developer testing. It is
2206
- * strongly advised not to use this authentication method in production.
2207
- * @param embedConfig The embed configuration
2208
- */
2209
- export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
2210
- export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
2211
- export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
2212
- export declare const logout: (embedConfig: EmbedConfig) => Promise<boolean>;
2213
- /**
2214
- * Perform authentication on the ThoughtSpot cluster
2215
- * @param embedConfig The embed configuration
2216
- */
2217
- export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean>;
2218
- /**
2219
- * Check if we are authenticated to the ThoughtSpot cluster
2220
- */
2221
- export declare const isAuthenticated: () => boolean;
2222
-
2223
- export type SessionInfo = {
2224
- releaseVersion: string;
2225
- userGUID: string;
2226
- currentOrgId: number;
2227
- privileges: string[];
2228
- mixpanelToken: string;
2229
- isPublicUser: boolean;
2230
- clusterId: string;
2231
- clusterName: string;
2232
- [key: string]: any;
2233
- };
2234
- export type PreauthInfo = {
2235
- info?: SessionInfo;
2236
- headers: Record<string, string>;
2237
- status: number;
2238
- [key: string]: any;
2239
- };
2240
- /**
2241
- * Processes the session info response and returns the session info object.
2242
- * @param preauthInfoResp {any} Response from the session info API.
2243
- * @returns {PreauthInfo} The session info object.
2244
- * @example ```js
2245
- * const preauthInfoResp = await fetch(sessionInfoPath);
2246
- * const sessionInfo = await formatPreauthInfo(preauthInfoResp);
2247
- * console.log(sessionInfo);
2248
- * ```
2249
- * @version SDK: 1.28.3 | ThoughtSpot: *
2250
- */
2251
- export declare const formatPreauthInfo: (preauthInfoResp: any) => Promise<PreauthInfo>;
2252
- /**
2253
- * Returns the session info object and caches it for future use.
2254
- * Once fetched the session info object is cached and returned from the cache on
2255
- * subsequent calls.
2256
- * @example ```js
2257
- * const preauthInfo = await getPreauthInfo();
2258
- * console.log(preauthInfo);
2259
- * ```
2260
- * @version SDK: 1.28.3 | ThoughtSpot: *
2261
- * @returns {Promise<SessionInfo>} The session info object.
2262
- */
2263
- export declare function getPreauthInfo(allowCache?: boolean): Promise<PreauthInfo>;
2264
- /**
2265
- * Returns the cached session info object and caches it for future use.
2266
- * Once fetched the session info object is cached and returned from the cache on
2267
- * subsequent calls.
2268
- * This cache is cleared when inti is called OR resetCachedSessionInfo is called.
2269
- * @example ```js
2270
- * const sessionInfo = await getSessionInfo();
2271
- * console.log(sessionInfo);
2272
- * ```
2273
- * @version SDK: 1.28.3 | ThoughtSpot: *
2274
- * @returns {Promise<SessionInfo>} The session info object.
2275
- */
2276
- export declare function getSessionInfo(): Promise<SessionInfo>;
2277
- /**
2278
- * Returns the cached session info object. If the client is not authenticated the
2279
- * function will return null.
2280
- * @example ```js
2281
- * const sessionInfo = getCachedSessionInfo();
2282
- * if (sessionInfo) {
2283
- * console.log(sessionInfo);
2284
- * } else {
2285
- * console.log('Not authenticated');
2286
- * }
2287
- * ```
2288
- * @returns {SessionInfo | null} The session info object.
2289
- * @version SDK: 1.28.3 | ThoughtSpot: *
2290
- */
2291
- export declare function getCachedSessionInfo(): SessionInfo | null;
2292
- /**
2293
- * Processes the session info response and returns the session info object.
2294
- * @param sessionInfoResp {any} Response from the session info API.
2295
- * @returns {SessionInfo} The session info object.
2296
- * @example ```js
2297
- * const sessionInfoResp = await fetch(sessionInfoPath);
2298
- * const sessionInfo = getSessionDetails(sessionInfoResp);
2299
- * console.log(sessionInfo);
2300
- * ```
2301
- * @version SDK: 1.28.3 | ThoughtSpot: *
2302
- */
2303
- export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
2304
- /**
2305
- * Resets the cached session info object and forces a new fetch on the next call.
2306
- * @example ```js
2307
- * resetCachedSessionInfo();
2308
- * const sessionInfo = await getSessionInfo();
2309
- * console.log(sessionInfo);
2310
- * ```
2311
- * @version SDK: 1.28.3 | ThoughtSpot: *
2312
- * @returns {void}
2313
- */
2314
- export declare function resetCachedSessionInfo(): void;
2315
- /**
2316
- * Resets the cached preauth info object and forces a new fetch on the next call.
2317
- * @example ```js
2318
- * resetCachedPreauthInfo();
2319
- * const preauthInfo = await getPreauthInfo();
2320
- * console.log(preauthInfo);
2321
- * ```
2322
- * @version SDK: 1.28.3 | ThoughtSpot: *
2323
- * @returns {void}
2324
- */
2325
- export declare function resetCachedPreauthInfo(): void;
2326
-
2327
- /**
2328
- * Copyright (c) 2023
2329
- *
2330
- * TypeScript type definitions for ThoughtSpot Visual Embed SDK
2331
- * @summary Type definitions for Embed SDK
2332
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
2333
- */
2334
- /**
2335
- * The authentication mechanism for allowing access to the
2336
- * the embedded app
2337
- * @group Authentication / Init
2338
- */
2339
- export declare enum AuthType {
2325
+ ignoreNoCookieAccess?: boolean;
2340
2326
  /**
2341
- * No authentication on the SDK. Pass-through to the embedded App. Alias for
2342
- * `Passthrough`.
2343
- * @example
2344
- * ```js
2345
- * init({
2346
- * // ...
2347
- * authType: AuthType.None,
2348
- * });
2349
- * ```
2327
+ * Re-login a user with the previous login options
2328
+ * when a user session expires.
2329
+ * @default false
2350
2330
  */
2351
- None = "None",
2331
+ autoLogin?: boolean;
2352
2332
  /**
2353
- * Passthrough SSO to the embedded application within the iframe. Requires least
2354
- * configuration, but may not be supported by all IDPs. This will behave like `None`
2355
- * if SSO is not configured on ThoughtSpot.
2356
- *
2357
- * To use this:
2358
- * Your SAML or OpenID provider must allow iframe redirects.
2359
- * For example, if you are using Okta as IdP, you can enable iframe embedding.
2360
- * @example
2361
- * ```js
2362
- * init({
2363
- * // ...
2364
- * authType: AuthType.EmbeddedSSO,
2365
- * });
2366
- * ```
2367
- * @version: SDK: 1.15.0 | ThoughtSpot: 8.8.0.cl
2333
+ * Disable redirection to the login page when the embedded session expires
2334
+ * This flag is typically used alongside the combination of authentication modes such
2335
+ * as {@link AuthType.AuthServer} and auto-login behavior {@link
2336
+ * EmbedConfig.autoLogin}
2337
+ * @version SDK: 1.9.3 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
2338
+ * @default false
2368
2339
  */
2369
- EmbeddedSSO = "EmbeddedSSO",
2340
+ disableLoginRedirect?: boolean;
2370
2341
  /**
2371
- * SSO using SAML
2372
- * @deprecated Use {@link SAMLRedirect} instead
2373
- * @hidden
2342
+ * This message is displayed in the embedded view when a user login fails.
2343
+ * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
2374
2344
  */
2375
- SSO = "SSO_SAML",
2345
+ loginFailedMessage?: string;
2376
2346
  /**
2377
- * SSO using SAML
2378
- * @deprecated Use {@link SAMLRedirect} instead
2379
- * @hidden
2347
+ * Calls the prefetch method internally when set to `true`
2348
+ * @default false
2380
2349
  */
2381
- SAML = "SSO_SAML",
2350
+ callPrefetch?: boolean;
2382
2351
  /**
2383
- * SSO using SAML
2384
- * Makes the host application redirect to the SAML IdP. Use this
2385
- * if your IdP does not allow itself to be embedded.
2352
+ * When there are multiple objects embedded, queue the rendering of embedded objects
2353
+ * to start after the previous embed's render is complete. This helps improve
2354
+ * performance by decreasing the load on the browser.
2355
+ * @Version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
2356
+ * @default false
2357
+ */
2358
+ queueMultiRenders?: boolean;
2359
+ /**
2360
+ * [AuthServer|Basic] Detect if third-party party cookies are enabled by doing an
2361
+ * additional call. This is slower and should be avoided. Listen to the
2362
+ * `NO_COOKIE_ACCESS` event to handle the situation.
2386
2363
  *
2387
- * This redirects the host application to the SAML IdP. The host application
2388
- * will be redirected back to the ThoughtSpot app after authentication.
2389
- * @example
2390
- * ```js
2391
- * init({
2392
- * // ...
2393
- * authType: AuthType.SAMLRedirect,
2394
- * });
2395
- * ```
2364
+ * This is slightly slower than letting the browser handle the cookie check, as it
2365
+ * involves an extra network call.
2366
+ * @version SDK: 1.10.4 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
2367
+ */
2368
+ detectCookieAccessSlow?: boolean;
2369
+ /**
2370
+ * Hide the `beta` alert warning message for SearchEmbed.
2371
+ * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
2372
+ */
2373
+ suppressSearchEmbedBetaWarning?: boolean;
2374
+ /**
2375
+ * Hide `beta` alert warning message for SageEmbed.
2396
2376
  *
2397
- * This opens the SAML IdP in a popup window. The popup is triggered
2398
- * when the user clicks the trigger button. The popup window will be
2399
- * closed automatically after authentication.
2377
+ */
2378
+ suppressSageEmbedBetaWarning?: boolean;
2379
+ /**
2380
+ * Custom style params for embed Config.
2381
+ * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2382
+ */
2383
+ customizations?: CustomisationsInterface;
2384
+ /**
2385
+ * For `inPopup` SAMLRedirect or OIDCRedirect authentication, we need a
2386
+ * button that the user can click to trigger the flow.
2387
+ * This attribute sets a containing element for that button.
2400
2388
  * @example
2401
2389
  * ```js
2402
2390
  * init({
2403
- * // ...
2404
2391
  * authType: AuthType.SAMLRedirect,
2405
- * authTriggerText: 'Login with SAML',
2406
- * authTriggerContainer: '#embed-container',
2407
2392
  * inPopup: true,
2408
- * });
2393
+ * authTriggerContainer: '#auth-trigger-container'
2394
+ * })
2409
2395
  * ```
2396
+ * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2397
+ */
2398
+ authTriggerContainer?: string | HTMLElement;
2399
+ /**
2400
+ * Specify that we want to use the `AuthEvent.TRIGGER_SSO_POPUP` event to trigger
2401
+ * SAML popup. This is useful when you want to trigger the popup on a custom user
2402
+ * action.
2410
2403
  *
2411
- * Can also use the event to trigger the popup flow. Works the same
2412
- * as the above example.
2413
- * @example
2414
- * ```js
2415
- * const authEE = init({
2416
- * // ...
2417
- * authType: AuthType.SAMLRedirect,
2418
- * inPopup: true,
2419
- * });
2420
- *
2421
- * someButtonOnYourPage.addEventListener('click', () => {
2422
- * authEE.emit(AuthEvent.TRIGGER_SSO_POPUP);
2423
- * });
2424
- * ```
2425
2404
  */
2426
- SAMLRedirect = "SSO_SAML",
2405
+ useEventForSAMLPopup?: boolean;
2427
2406
  /**
2428
- * SSO using OIDC
2429
- * @hidden
2430
- * @deprecated Use {@link OIDCRedirect} instead
2407
+ * Text to show in the button which triggers the popup auth flow.
2408
+ * Default: `Authorize`.
2409
+ * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2431
2410
  */
2432
- OIDC = "SSO_OIDC",
2411
+ authTriggerText?: string;
2433
2412
  /**
2434
- * SSO using OIDC
2435
- * Will make the host application redirect to the OIDC IdP.
2436
- * See code samples in {@link SAMLRedirect}.
2413
+ * Prevent users from accessing the full application or ThoughtSpot application pages
2414
+ * access to the embedded application users
2415
+ * outside of the iframe.
2416
+ * @default true
2417
+ * @version SDK: 1.22.0 | ThoughtSpot: 9.3.0.cl, 9.5.1.sw
2437
2418
  */
2438
- OIDCRedirect = "SSO_OIDC",
2419
+ blockNonEmbedFullAppAccess?: boolean;
2439
2420
  /**
2440
- * Trusted authentication server
2421
+ * Host config in case embedded app is inside TS app itself
2441
2422
  * @hidden
2442
- * @deprecated Use {@link TrustedAuth} instead
2443
2423
  */
2444
- AuthServer = "AuthServer",
2424
+ hostConfig?: {
2425
+ hostUserGuid: string;
2426
+ hostClusterId: string;
2427
+ hostClusterName: string;
2428
+ };
2445
2429
  /**
2446
- * Trusted authentication server. Use your own authentication server
2447
- * which returns a bearer token, generated using the `secret_key` obtained
2448
- * from ThoughtSpot.
2449
- * @example
2450
- * ```js
2451
- * init({
2452
- * // ...
2453
- * authType: AuthType.TrustedAuthToken,
2454
- * getAuthToken: () => {
2455
- * return fetch('https://my-backend.app/ts-token')
2456
- * .then((response) => response.json())
2457
- * .then((data) => data.token);
2458
- * }
2459
- * });
2460
- * ```
2430
+ * Pendo API key to enable Pendo tracking to your own subscription, the key
2431
+ * is added as an additional key to the embed, as per this link:https://support.pendo.io/hc/en-us/articles/360032201951-Send-data-to-multiple-subscriptions[document].
2432
+ * @version SDK: 1.27.0 | ThoughtSpot: 9.8.0.cl
2461
2433
  */
2462
- TrustedAuthToken = "AuthServer",
2434
+ pendoTrackingKey?: string;
2463
2435
  /**
2464
- * Trusted authentication server Cookieless, Use your own authentication
2465
- * server which returns a bearer token, generated using the `secret_key`
2466
- * obtained from ThoughtSpot. This uses a cookieless authentication
2467
- * approach, recommended to bypass the third-party cookie-blocking restriction
2468
- * implemented by some browsers.
2436
+ * If passed as true all alerts will be suppressed in the embedded app.
2437
+ * @version SDK: 1.26.2 | ThoughtSpot: *
2438
+ */
2439
+ suppressErrorAlerts?: boolean;
2440
+ /**
2441
+ * Suppress or show specific types of logs in the console output.
2442
+ * For example, `LogLevel.ERROR` shows only Visual Embed SDK and
2443
+ * ThoughtSpot application errors and suppresses
2444
+ * other logs such as warnings, information alerts,
2445
+ * and debug messages in the console output.
2446
+ *
2447
+ * @default LogLevel.ERROR
2469
2448
  * @example
2470
2449
  * ```js
2471
2450
  * init({
2472
- * // ...
2473
- * authType: AuthType.TrustedAuthTokenCookieless,
2474
- * getAuthToken: () => {
2475
- * return fetch('https://my-backend.app/ts-token')
2476
- * .then((response) => response.json())
2477
- * .then((data) => data.token);
2478
- * }
2451
+ * ...embedConfig,
2452
+ * logLevel: LogLevel.SILENT
2453
+ * })
2479
2454
  * ```
2480
- * @version SDK: 1.22.0| ThoughtSpot: 9.3.0.cl, 9.5.1.sw
2481
- */
2482
- TrustedAuthTokenCookieless = "AuthServerCookieless",
2483
- /**
2484
- * Use the ThoughtSpot login API to authenticate to the cluster directly.
2485
- *
2486
- * Warning: This feature is primarily intended for developer testing. It is
2487
- * strongly advised not to use this authentication method in production.
2455
+ * @version SDK: 1.26.7 | ThoughtSpot: 9.10.0.cl
2488
2456
  */
2489
- Basic = "Basic"
2490
- }
2491
- /**
2492
- *
2493
- * This option does not apply to the classic homepage experience.
2494
- * To access the updated modular homepage,
2495
- * set `modularHomeExperience` to `true`
2496
- * (available as Early Access feature in 9.12.5.cl).
2497
- *
2498
- */
2499
- export declare enum HomeLeftNavItem {
2457
+ logLevel?: LogLevel;
2500
2458
  /**
2501
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2459
+ * Disables the Mixpanel tracking from the SDK.
2460
+ * @version SDK: 1.27.9
2502
2461
  */
2503
- SearchData = "search-data",
2462
+ disableSDKTracking?: boolean;
2504
2463
  /**
2505
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2464
+ * Overrides default/user preferred locale for date formatting
2465
+ * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2506
2466
  */
2507
- Home = "insights-home",
2467
+ dateFormatLocale?: string;
2508
2468
  /**
2509
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2469
+ * Overrides default/user preferred locale for number formatting
2470
+ * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2510
2471
  */
2511
- Liveboards = "liveboards",
2472
+ numberFormatLocale?: string;
2512
2473
  /**
2513
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2474
+ * Format to be used for currency when currency format is set to infer from browser
2475
+ * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2514
2476
  */
2515
- Answers = "answers",
2477
+ currencyFormat?: string;
2516
2478
  /**
2517
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2518
- */
2519
- MonitorSubscription = "monitor-alerts",
2520
- /**
2521
- * @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
2522
- */
2523
- SpotIQAnalysis = "spotiq-analysis",
2524
- /**
2525
- * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
2479
+ * This flag is used to disable the token verification in the SDK.
2480
+ * Enabling this flag will also disable the caching of the token.
2481
+ * @hidden
2482
+ * @example
2483
+ * ```js
2484
+ * init({
2485
+ * ...embedConfig,
2486
+ * disableTokenVerification : true
2487
+ * })
2488
+ * ```
2489
+ * @version SDK: 1.28.5 | ThoughtSpot: 9.10.0.cl, 10.1.0.sw
2526
2490
  */
2527
- LiveboardSchedules = "liveboard-schedules"
2528
- }
2529
- export type DOMSelector = string | HTMLElement;
2530
- /**
2531
- * inline customCSS within the {@link CustomisationsInterface}.
2532
- * Use {@link CustomCssVariables} or css rules.
2533
- */
2534
- export interface customCssInterface {
2491
+ disableTokenVerification?: boolean;
2535
2492
  /**
2536
- * The custom css variables, which can be set.
2537
- * The variables are available in the {@link CustomCssVariables}
2538
- * interface. For more information, see
2539
- * link:https://developers.thoughtspot.com/docs/css-variables-reference[CSS variable reference].
2493
+ * This flag is used to disable showing the login failure page in the embedded app.
2494
+ * @version SDK 1.32.3 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
2540
2495
  */
2541
- variables?: CustomCssVariables;
2496
+ disableLoginFailurePage?: boolean;
2542
2497
  /**
2543
- * Can be used to define a custom font face
2544
- * like:
2498
+ * This is an object (key/val) of override flags which will be applied
2499
+ * to the internal embedded object. This can be used to add any
2500
+ * URL flag.
2501
+ * Warning: This option is for advanced use only and is used internally
2502
+ * to control embed behavior in non-regular ways. We do not publish the
2503
+ * list of supported keys and values associated with each.
2545
2504
  * @example
2546
2505
  * ```js
2547
- * rules_UNSTABLE?: {
2548
- * "@font-face": {
2549
- * "font-family": "custom-font",
2550
- * "src": url("/path/")
2551
- * };
2552
- * };
2506
+ * const embed = new LiveboardEmbed('#embed', {
2507
+ * ... // other liveboard view config
2508
+ * additionalFlags: {
2509
+ * flag1: 'value1',
2510
+ * flag2: 'value2'
2511
+ * }
2512
+ * });
2553
2513
  * ```
2554
- *
2555
- * Also, custom css rules outside of variables.
2514
+ * @version SDK: 1.33.5 | ThoughtSpot: *
2515
+ */
2516
+ additionalFlags?: {
2517
+ [key: string]: string | number | boolean;
2518
+ };
2519
+ /**
2520
+ * This is an object (key/val) for customVariables being
2521
+ * used by the third party tool's script.
2556
2522
  * @example
2557
2523
  * ```js
2558
- * rules_UNSTABLE?: {
2559
- * ".thoughtspot_class_name": {
2560
- * "border-radius": "10px",
2561
- * margin: "20px"
2562
- * };
2563
- * };
2524
+ * const embed = new LiveboardEmbed('#embed', {
2525
+ * ... // other liveboard view config
2526
+ * customVariablesForThirdPartyTools: {
2527
+ * key1: 'value1',
2528
+ * key2: 'value2'
2529
+ * }
2530
+ * });
2564
2531
  * ```
2532
+ * @version SDK 1.37.0 | ThoughtSpot: 10.7.0.cl
2565
2533
  */
2566
- rules_UNSTABLE?: {
2567
- [selector: string]: {
2568
- [declaration: string]: string;
2569
- };
2570
- };
2571
- }
2572
- /**
2573
- * Styles within the {@link CustomisationsInterface}.
2574
- */
2575
- export interface CustomStyles {
2576
- customCSSUrl?: string;
2577
- customCSS?: customCssInterface;
2534
+ customVariablesForThirdPartyTools?: Record<string, any>;
2535
+ disablePreauthCache?: boolean;
2578
2536
  }
2579
- /**
2580
- * Configuration to define the customization on the Embedded
2581
- * ThoughtSpot components.
2582
- * You can customize styles, text strings, and icons.
2583
- * For more information, see https://developers.thoughtspot.com/docs/custom-css.
2584
- * @example
2585
- * ```js
2586
- * init({
2587
- * // ...
2588
- * customizations: {
2589
- * style: {
2590
- * customCSS: {
2591
- * variables: {},
2592
- * rules_UNSTABLE: {}
2593
- * }
2594
- * },
2595
- * content: {
2596
- * strings: {
2597
- * 'LIVEBOARDS': 'Dashboards',
2598
- * 'ANSWERS': 'Visualizations',
2599
- * 'Edit': 'Modify',
2600
- * 'Show underlying data': 'Show source data',
2601
- * 'SpotIQ': 'Insights',
2602
- * 'Monitor': 'Alerts',
2603
- * }
2604
- * },
2605
- * iconSpriteUrl: 'https://my-custom-icon-sprite.svg'
2606
- * }
2607
- * })
2608
- * ```
2609
- */
2610
- export interface CustomisationsInterface {
2611
- style?: CustomStyles;
2612
- content?: {
2613
- /**
2614
- * @version SDK: 1.26.0 | 9.7.0.cl
2615
- */
2616
- strings?: Record<string, any>;
2617
- [key: string]: any;
2618
- };
2619
- iconSpriteUrl?: string;
2537
+ export interface LayoutConfig {
2620
2538
  }
2621
2539
  /**
2622
- * The configuration object for embedding ThoughtSpot content.
2623
- * It includes the ThoughtSpot hostname or IP address,
2624
- * the type of authentication, and the authentication endpoint
2625
- * if a trusted authentication server is used.
2626
- * @group Authentication / Init
2540
+ * Embedded iframe configuration
2541
+ * @group Embed components
2627
2542
  */
2628
- export interface EmbedConfig {
2629
- /**
2630
- * The ThoughtSpot cluster hostname or IP address.
2631
- */
2632
- thoughtSpotHost: string;
2543
+ export interface FrameParams {
2633
2544
  /**
2634
- * The authentication mechanism to use.
2545
+ * The width of the iframe (unit is pixels if numeric).
2635
2546
  */
2636
- authType: AuthType;
2547
+ width?: number | string;
2637
2548
  /**
2638
- * [AuthServer] The trusted authentication endpoint to use to get the
2639
- * authentication token. A `GET` request is made to the
2640
- * authentication API endpoint, which returns the token
2641
- * as a plaintext response. For trusted authentication,
2642
- * the `authEndpoint` or `getAuthToken` attribute is required.
2549
+ * The height of the iframe (unit is pixels if numeric).
2643
2550
  */
2644
- authEndpoint?: string;
2551
+ height?: number | string;
2645
2552
  /**
2646
- * [AuthServer] A function that invokes the trusted authentication endpoint
2647
- * and returns a Promise that resolves to the `auth token` string.
2648
- * For trusted authentication, the `authEndpoint` or `getAuthToken`
2649
- * attribute is required.
2650
- *
2651
- * It is advisable to fetch a new token inside this method and not
2652
- * reuse the old issued token. When auth expires this method is
2653
- * called again and if it is called with an older token, the authentication
2654
- * will not succeed.
2553
+ * Set to 'lazy' to enable lazy loading of the embedded TS frame.
2554
+ * This will defer loading of the frame until it comes into the
2555
+ * viewport. This is useful for performance optimization.
2655
2556
  */
2656
- getAuthToken?: () => Promise<string>;
2557
+ loading?: 'lazy' | 'eager' | 'auto';
2657
2558
  /**
2658
- * [AuthServer / Basic] The user name of the ThoughtSpot user. This
2659
- * attribute is required for trusted authentication.
2559
+ * This parameters will be passed on the iframe
2560
+ * as is.
2660
2561
  */
2661
- username?: string;
2562
+ [key: string]: string | number | boolean | undefined;
2563
+ }
2564
+ /**
2565
+ * The configuration object for an embedded view.
2566
+ */
2567
+ export interface ViewConfig {
2662
2568
  /**
2663
- * [Basic] The ThoughtSpot login password corresponding to the username
2664
- *
2665
- * Warning: This feature is primarily intended for developer testing. It is
2666
- * strongly advised not to use this authentication method in production.
2569
+ * @hidden
2667
2570
  */
2668
- password?: string;
2571
+ layoutConfig?: LayoutConfig;
2669
2572
  /**
2670
- * [SSO] For SSO Authentication, if `noRedirect` is set to true, it will
2671
- * open the SAML auth flow in a popup, instead of redirecting the browser in
2672
- * place.
2673
- * @default false
2674
- * @deprecated
2573
+ * The width and height dimensions to render an embedded
2574
+ * object inside your app. Specify the values in pixels or percentage.
2575
+ * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
2576
+ * @example
2577
+ * ```js
2578
+ * const embed = new LiveboardEmbed('#embed', {
2579
+ * ... // other liveboard view config
2580
+ * frameParams: {
2581
+ * width: '500px' | '50%',
2582
+ * height: '400px' | '60%',
2583
+ * },
2584
+ * });
2585
+ * ```
2675
2586
  */
2676
- noRedirect?: boolean;
2587
+ frameParams?: FrameParams;
2677
2588
  /**
2678
- * [SSO] For SSO Authentication, if `inPopup` is set to true, it will open
2679
- * the SAML auth flow in a popup, instead of redirecting the browser in place.
2680
- *
2681
- * Need to use this with `authTriggerContainer`. Or manually trigger
2682
- * the `AuthEvent.TRIGGER_SSO_POPUP` event on a user interaction.
2683
- * @default false
2684
- * @version SDK: 1.18.0
2589
+ * @hidden
2685
2590
  */
2686
- inPopup?: boolean;
2591
+ theme?: string;
2687
2592
  /**
2688
- * [SSO] For SSO Authentication, one can supply an optional path param;
2689
- * This will be the path on the host origin where the SAML flow will be
2690
- * terminated.
2691
- *
2692
- * Eg: "/dashboard", "#/foo" [Do not include the host]
2693
- * @version SDK: 1.10.2 | ThoughtSpot 8.2.0.cl, 8.4.1.sw
2593
+ * @hidden
2694
2594
  */
2695
- redirectPath?: string;
2696
- /** @internal */
2697
- basepath?: string;
2595
+ styleSheet__unstable?: string;
2698
2596
  /**
2699
- * Boolean to define if the query parameters in the ThoughtSpot URL
2700
- * should be encoded in base64. This provides additional security to
2701
- * ThoughtSpot clusters against cross-site scripting attacks.
2702
- * @default false
2597
+ * The list of actions to disable from the primary menu, more menu
2598
+ * (...), and the contextual menu. These actions will be disabled
2599
+ * for the user.
2600
+ * Use this to disable actions.
2601
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
2602
+ * @example
2603
+ * ```js
2604
+ * const embed = new LiveboardEmbed('#embed', {
2605
+ * ... // other liveboard view config
2606
+ * disabledActions: [Action.Download, Action.Save]
2607
+ * });
2608
+ * ```
2703
2609
  */
2704
- shouldEncodeUrlQueryParams?: boolean;
2610
+ disabledActions?: Action[];
2705
2611
  /**
2706
- * Suppress cookie access alert when third-party cookies are blocked by the
2707
- * user's browser. Third-party cookie blocking is the default behaviour on
2708
- * some web browsers like Safari. If you set this attribute to `true`,
2709
- * you are encouraged to handle `noCookieAccess` event, to show your own treatment
2710
- * in this case.
2711
- * @default false
2712
- */
2713
- suppressNoCookieAccessAlert?: boolean;
2714
- /**
2715
- * Ignore the cookie access alert when third-party cookies are blocked by the
2716
- * user's browser. If you set this to `true`, the embedded iframe behaviour
2717
- * persists even in the case of a non-logged-in user.
2718
- * @default false
2719
- */
2720
- ignoreNoCookieAccess?: boolean;
2721
- /**
2722
- * Re-login a user with the previous login options
2723
- * when a user session expires.
2724
- * @default false
2725
- */
2726
- autoLogin?: boolean;
2727
- /**
2728
- * Disable redirection to the login page when the embedded session expires
2729
- * This flag is typically used alongside the combination of authentication modes such
2730
- * as {@link AuthType.AuthServer} and auto-login behavior {@link
2731
- * EmbedConfig.autoLogin}
2732
- * @version SDK: 1.9.3 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
2733
- * @default false
2734
- */
2735
- disableLoginRedirect?: boolean;
2736
- /**
2737
- * This message is displayed in the embedded view when a user login fails.
2738
- * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
2739
- */
2740
- loginFailedMessage?: string;
2741
- /**
2742
- * Calls the prefetch method internally when set to `true`
2743
- * @default false
2744
- */
2745
- callPrefetch?: boolean;
2746
- /**
2747
- * When there are multiple objects embedded, queue the rendering of embedded objects
2748
- * to start after the previous embed's render is complete. This helps improve
2749
- * performance by decreasing the load on the browser.
2750
- * @Version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
2751
- * @default false
2752
- */
2753
- queueMultiRenders?: boolean;
2754
- /**
2755
- * [AuthServer|Basic] Detect if third-party party cookies are enabled by doing an
2756
- * additional call. This is slower and should be avoided. Listen to the
2757
- * `NO_COOKIE_ACCESS` event to handle the situation.
2758
- *
2759
- * This is slightly slower than letting the browser handle the cookie check, as it
2760
- * involves an extra network call.
2761
- * @version SDK: 1.10.4 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
2612
+ * The tooltip to display for disabled actions.
2613
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
2614
+ * @example
2615
+ * ```js
2616
+ * const embed = new LiveboardEmbed('#embed', {
2617
+ * ... // other liveboard view config
2618
+ * disabledActions: [Action.Download, Action.Save]
2619
+ * disabledActionReason: "Reason for disabling",
2620
+ * });
2621
+ * ```
2762
2622
  */
2763
- detectCookieAccessSlow?: boolean;
2623
+ disabledActionReason?: string;
2764
2624
  /**
2765
- * Hide the `beta` alert warning message for SearchEmbed.
2766
- * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
2625
+ * The list of actions to hide from the embedded.
2626
+ * This actions will be hidden from the user.
2627
+ * Use this to hide an action.
2628
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
2629
+ * @example
2630
+ * ```js
2631
+ * const embed = new LiveboardEmbed('#embed', {
2632
+ * ... // other liveboard view config
2633
+ * hiddenActions: [Action.Download, Action.Export]
2634
+ * });
2635
+ * ```
2636
+ * @important
2767
2637
  */
2768
- suppressSearchEmbedBetaWarning?: boolean;
2638
+ hiddenActions?: Action[];
2769
2639
  /**
2770
- * Hide `beta` alert warning message for SageEmbed.
2640
+ * The list of actions to display from the primary menu, more menu
2641
+ * (...), and the contextual menu. These will be only actions that
2642
+ * are visible to the user.
2643
+ * Use this to hide all actions except the ones you want to show.
2771
2644
  *
2645
+ * Use either this or hiddenActions.
2646
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
2647
+ * @important
2648
+ * @example
2649
+ * ```js
2650
+ * const embed = new LiveboardEmbed('#embed', {
2651
+ * ... // other liveboard view config
2652
+ * visibleActions: [Action.Download, Action.Export]
2653
+ * });
2654
+ * ```
2772
2655
  */
2773
- suppressSageEmbedBetaWarning?: boolean;
2774
- /**
2775
- * Custom style params for embed Config.
2776
- * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2777
- */
2778
- customizations?: CustomisationsInterface;
2656
+ visibleActions?: Action[];
2779
2657
  /**
2780
- * For `inPopup` SAMLRedirect or OIDCRedirect authentication, we need a
2781
- * button that the user can click to trigger the flow.
2782
- * This attribute sets a containing element for that button.
2658
+ * Show alert messages and toast messages in the embedded
2659
+ * view in full app embed.
2660
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
2783
2661
  * @example
2784
2662
  * ```js
2785
- * init({
2786
- * authType: AuthType.SAMLRedirect,
2787
- * inPopup: true,
2788
- * authTriggerContainer: '#auth-trigger-container'
2663
+ * const embed = new AppEmbed('#embed-container', {
2664
+ * ... // other options
2665
+ * showAlerts:true,
2789
2666
  * })
2790
2667
  * ```
2791
- * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2792
- */
2793
- authTriggerContainer?: string | HTMLElement;
2794
- /**
2795
- * Specify that we want to use the `AuthEvent.TRIGGER_SSO_POPUP` event to trigger
2796
- * SAML popup. This is useful when you want to trigger the popup on a custom user
2797
- * action.
2798
- *
2799
- */
2800
- useEventForSAMLPopup?: boolean;
2801
- /**
2802
- * Text to show in the button which triggers the popup auth flow.
2803
- * Default: `Authorize`.
2804
- * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl, 9.0.1.sw
2805
- */
2806
- authTriggerText?: string;
2807
- /**
2808
- * Prevent users from accessing the full application or ThoughtSpot application pages
2809
- * access to the embedded application users
2810
- * outside of the iframe.
2811
- * @default true
2812
- * @version SDK: 1.22.0 | ThoughtSpot: 9.3.0.cl, 9.5.1.sw
2813
- */
2814
- blockNonEmbedFullAppAccess?: boolean;
2815
- /**
2816
- * Host config in case embedded app is inside TS app itself
2817
- * @hidden
2818
- */
2819
- hostConfig?: {
2820
- hostUserGuid: string;
2821
- hostClusterId: string;
2822
- hostClusterName: string;
2823
- };
2824
- /**
2825
- * Pendo API key to enable Pendo tracking to your own subscription, the key
2826
- * is added as an additional key to the embed, as per this link:https://support.pendo.io/hc/en-us/articles/360032201951-Send-data-to-multiple-subscriptions[document].
2827
- * @version SDK: 1.27.0 | ThoughtSpot: 9.8.0.cl
2828
2668
  */
2829
- pendoTrackingKey?: string;
2830
- /**
2831
- * If passed as true all alerts will be suppressed in the embedded app.
2832
- * @version SDK: 1.26.2 | ThoughtSpot: *
2833
- */
2834
- suppressErrorAlerts?: boolean;
2669
+ showAlerts?: boolean;
2835
2670
  /**
2836
- * Suppress or show specific types of logs in the console output.
2837
- * For example, `LogLevel.ERROR` shows only Visual Embed SDK and
2838
- * ThoughtSpot application errors and suppresses
2839
- * other logs such as warnings, information alerts,
2840
- * and debug messages in the console output.
2841
- *
2842
- * @default LogLevel.ERROR
2671
+ * The list of runtime filters to apply to a search Answer,
2672
+ * visualization, or Liveboard.
2673
+ * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
2843
2674
  * @example
2844
2675
  * ```js
2845
- * init({
2846
- * ...embedConfig,
2847
- * logLevel: LogLevel.SILENT
2676
+ * const embed = new LiveboardEmbed('#embed-container', {
2677
+ * ... // other options
2678
+ * runtimeFilters: [
2679
+ * {
2680
+ * columnName: 'value',
2681
+ * operator: RuntimeFilterOp.EQ,
2682
+ * values: ['string' | 123 | true],
2683
+ * },
2684
+ * ],
2848
2685
  * })
2849
2686
  * ```
2850
- * @version SDK: 1.26.7 | ThoughtSpot: 9.10.0.cl
2851
- */
2852
- logLevel?: LogLevel;
2853
- /**
2854
- * Disables the Mixpanel tracking from the SDK.
2855
- * @version SDK: 1.27.9
2856
- */
2857
- disableSDKTracking?: boolean;
2858
- /**
2859
- * Overrides default/user preferred locale for date formatting
2860
- * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2861
2687
  */
2862
- dateFormatLocale?: string;
2863
- /**
2864
- * Overrides default/user preferred locale for number formatting
2865
- * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2866
- */
2867
- numberFormatLocale?: string;
2868
- /**
2869
- * Format to be used for currency when currency format is set to infer from browser
2870
- * @version SDK: 1.28.4 | ThoughtSpot: 10.0.0.cl, 9.5.0.sw
2871
- */
2872
- currencyFormat?: string;
2688
+ runtimeFilters?: RuntimeFilter[];
2873
2689
  /**
2874
- * This flag is used to disable the token verification in the SDK.
2875
- * Enabling this flag will also disable the caching of the token.
2876
- * @hidden
2690
+ * The list of parameter override to apply to a search Answer,
2691
+ * visualization, or Liveboard.
2692
+ * @version SDK : 1.25.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
2877
2693
  * @example
2878
2694
  * ```js
2879
- * init({
2880
- * ...embedConfig,
2881
- * disableTokenVerification : true
2695
+ * const embed = new LiveboardEmbed('#embed-container', {
2696
+ * ... // other options
2697
+ * runtimeParameters: [
2698
+ * {
2699
+ * name: 'value',
2700
+ * value: 'string' | 123 | true,
2701
+ * },
2702
+ * ],
2882
2703
  * })
2883
2704
  * ```
2884
- * @version SDK: 1.28.5 | ThoughtSpot: 9.10.0.cl, 10.1.0.sw
2885
2705
  */
2886
- disableTokenVerification?: boolean;
2706
+ runtimeParameters?: RuntimeParameter[];
2887
2707
  /**
2888
- * This flag is used to disable showing the login failure page in the embedded app.
2889
- * @version SDK 1.32.3 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
2708
+ * The locale settings to apply to the embedded view.
2709
+ * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
2710
+ * @example
2711
+ * ```js
2712
+ * const embed = new LiveboardEmbed('#embed-container', {
2713
+ * ... // other options
2714
+ * locale:'en',
2715
+ * })
2716
+ * ```
2890
2717
  */
2891
- disableLoginFailurePage?: boolean;
2718
+ locale?: string;
2892
2719
  /**
2893
2720
  * This is an object (key/val) of override flags which will be applied
2894
2721
  * to the internal embedded object. This can be used to add any
2895
2722
  * URL flag.
2723
+ * If the same flags are passed in init, they will be overriden by the values here.
2896
2724
  * Warning: This option is for advanced use only and is used internally
2897
2725
  * to control embed behavior in non-regular ways. We do not publish the
2898
2726
  * list of supported keys and values associated with each.
@@ -2906,245 +2734,22 @@ export interface EmbedConfig {
2906
2734
  * }
2907
2735
  * });
2908
2736
  * ```
2909
- * @version SDK: 1.33.5 | ThoughtSpot: *
2737
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
2910
2738
  */
2911
2739
  additionalFlags?: {
2912
2740
  [key: string]: string | number | boolean;
2913
2741
  };
2914
2742
  /**
2915
- * This is an object (key/val) for customVariables being
2916
- * used by the third party tool's script.
2917
- * @example
2918
- * ```js
2919
- * const embed = new LiveboardEmbed('#embed', {
2920
- * ... // other liveboard view config
2921
- * customVariablesForThirdPartyTools: {
2922
- * key1: 'value1',
2923
- * key2: 'value2'
2924
- * }
2925
- * });
2926
- * ```
2927
- * @version SDK 1.37.0 | ThoughtSpot: 10.7.0.cl
2928
- */
2929
- customVariablesForThirdPartyTools?: Record<string, any>;
2930
- disablePreauthCache?: boolean;
2931
- }
2932
- export interface LayoutConfig {
2933
- }
2934
- /**
2935
- * Embedded iframe configuration
2936
- * @group Embed components
2937
- */
2938
- export interface FrameParams {
2939
- /**
2940
- * The width of the iframe (unit is pixels if numeric).
2941
- */
2942
- width?: number | string;
2943
- /**
2944
- * The height of the iframe (unit is pixels if numeric).
2945
- */
2946
- height?: number | string;
2947
- /**
2948
- * Set to 'lazy' to enable lazy loading of the embedded TS frame.
2949
- * This will defer loading of the frame until it comes into the
2950
- * viewport. This is useful for performance optimization.
2951
- */
2952
- loading?: 'lazy' | 'eager' | 'auto';
2953
- /**
2954
- * This parameters will be passed on the iframe
2955
- * as is.
2956
- */
2957
- [key: string]: string | number | boolean | undefined;
2958
- }
2959
- /**
2960
- * The configuration object for an embedded view.
2961
- */
2962
- export interface ViewConfig {
2963
- /**
2964
- * @hidden
2965
- */
2966
- layoutConfig?: LayoutConfig;
2967
- /**
2968
- * The width and height dimensions to render an embedded
2969
- * object inside your app. Specify the values in pixels or percentage.
2970
- * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
2971
- * @example
2972
- * ```js
2973
- * const embed = new LiveboardEmbed('#embed', {
2974
- * ... // other liveboard view config
2975
- * frameParams: {
2976
- * width: '500px' | '50%',
2977
- * height: '400px' | '60%',
2978
- * },
2979
- * });
2980
- * ```
2981
- */
2982
- frameParams?: FrameParams;
2983
- /**
2984
- * @hidden
2985
- */
2986
- theme?: string;
2987
- /**
2988
- * @hidden
2989
- */
2990
- styleSheet__unstable?: string;
2991
- /**
2992
- * The list of actions to disable from the primary menu, more menu
2993
- * (...), and the contextual menu. These actions will be disabled
2994
- * for the user.
2995
- * Use this to disable actions.
2996
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
2997
- * @example
2998
- * ```js
2999
- * const embed = new LiveboardEmbed('#embed', {
3000
- * ... // other liveboard view config
3001
- * disabledActions: [Action.Download, Action.Save]
3002
- * });
3003
- * ```
3004
- */
3005
- disabledActions?: Action[];
3006
- /**
3007
- * The tooltip to display for disabled actions.
3008
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
3009
- * @example
3010
- * ```js
3011
- * const embed = new LiveboardEmbed('#embed', {
3012
- * ... // other liveboard view config
3013
- * disabledActions: [Action.Download, Action.Save]
3014
- * disabledActionReason: "Reason for disabling",
3015
- * });
3016
- * ```
3017
- */
3018
- disabledActionReason?: string;
3019
- /**
3020
- * The list of actions to hide from the embedded.
3021
- * This actions will be hidden from the user.
3022
- * Use this to hide an action.
3023
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
3024
- * @example
3025
- * ```js
3026
- * const embed = new LiveboardEmbed('#embed', {
3027
- * ... // other liveboard view config
3028
- * hiddenActions: [Action.Download, Action.Export]
3029
- * });
3030
- * ```
3031
- * @important
3032
- */
3033
- hiddenActions?: Action[];
3034
- /**
3035
- * The list of actions to display from the primary menu, more menu
3036
- * (...), and the contextual menu. These will be only actions that
3037
- * are visible to the user.
3038
- * Use this to hide all actions except the ones you want to show.
3039
- *
3040
- * Use either this or hiddenActions.
3041
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
3042
- * @important
3043
- * @example
3044
- * ```js
3045
- * const embed = new LiveboardEmbed('#embed', {
3046
- * ... // other liveboard view config
3047
- * visibleActions: [Action.Download, Action.Export]
3048
- * });
3049
- * ```
3050
- */
3051
- visibleActions?: Action[];
3052
- /**
3053
- * Show alert messages and toast messages in the embedded
3054
- * view in full app embed.
3055
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3056
- * @example
3057
- * ```js
3058
- * const embed = new AppEmbed('#embed-container', {
3059
- * ... // other options
3060
- * showAlerts:true,
3061
- * })
3062
- * ```
3063
- */
3064
- showAlerts?: boolean;
3065
- /**
3066
- * The list of runtime filters to apply to a search Answer,
3067
- * visualization, or Liveboard.
3068
- * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
3069
- * @example
3070
- * ```js
3071
- * const embed = new LiveboardEmbed('#embed-container', {
3072
- * ... // other options
3073
- * runtimeFilters: [
3074
- * {
3075
- * columnName: 'value',
3076
- * operator: RuntimeFilterOp.EQ,
3077
- * values: ['string' | 123 | true],
3078
- * },
3079
- * ],
3080
- * })
3081
- * ```
3082
- */
3083
- runtimeFilters?: RuntimeFilter[];
3084
- /**
3085
- * The list of parameter override to apply to a search Answer,
3086
- * visualization, or Liveboard.
3087
- * @version SDK : 1.25.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
3088
- * @example
3089
- * ```js
3090
- * const embed = new LiveboardEmbed('#embed-container', {
3091
- * ... // other options
3092
- * runtimeParameters: [
3093
- * {
3094
- * name: 'value',
3095
- * value: 'string' | 123 | true,
3096
- * },
3097
- * ],
3098
- * })
3099
- * ```
3100
- */
3101
- runtimeParameters?: RuntimeParameter[];
3102
- /**
3103
- * The locale settings to apply to the embedded view.
3104
- * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
3105
- * @example
3106
- * ```js
3107
- * const embed = new LiveboardEmbed('#embed-container', {
3108
- * ... // other options
3109
- * locale:'en',
3110
- * })
3111
- * ```
3112
- */
3113
- locale?: string;
3114
- /**
3115
- * This is an object (key/val) of override flags which will be applied
3116
- * to the internal embedded object. This can be used to add any
3117
- * URL flag.
3118
- * If the same flags are passed in init, they will be overriden by the values here.
3119
- * Warning: This option is for advanced use only and is used internally
3120
- * to control embed behavior in non-regular ways. We do not publish the
3121
- * list of supported keys and values associated with each.
3122
- * @example
3123
- * ```js
3124
- * const embed = new LiveboardEmbed('#embed', {
3125
- * ... // other liveboard view config
3126
- * additionalFlags: {
3127
- * flag1: 'value1',
3128
- * flag2: 'value2'
3129
- * }
3130
- * });
3131
- * ```
3132
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
3133
- */
3134
- additionalFlags?: {
3135
- [key: string]: string | number | boolean;
3136
- };
3137
- /**
3138
- * Dynamic CSSUrl and customCSS to be injected in the loaded application.
3139
- * You would also need to set `style-src` in the CSP settings.
3140
- * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1.sw, 8.4.0.cl
3141
- * @default ''
3142
- */
3143
- customizations?: CustomisationsInterface;
3144
- /**
3145
- * Insert as a sibling of the target container, instead of appending to a
3146
- * child inside it.
3147
- * @version SDK: 1.2.0 | ThoughtSpot: 9.0.0.cl, 9.0.0.sw
2743
+ * Dynamic CSSUrl and customCSS to be injected in the loaded application.
2744
+ * You would also need to set `style-src` in the CSP settings.
2745
+ * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1.sw, 8.4.0.cl
2746
+ * @default ''
2747
+ */
2748
+ customizations?: CustomisationsInterface;
2749
+ /**
2750
+ * Insert as a sibling of the target container, instead of appending to a
2751
+ * child inside it.
2752
+ * @version SDK: 1.2.0 | ThoughtSpot: 9.0.0.cl, 9.0.0.sw
3148
2753
  * @example
3149
2754
  * ```js
3150
2755
  * const embed = new LiveboardEmbed('#embed-container', {
@@ -7126,6 +6731,419 @@ export interface DefaultAppInitData {
7126
6731
  customVariablesForThirdPartyTools: Record<string, any>;
7127
6732
  }
7128
6733
 
6734
+ export type EmbedEventHandlers = {
6735
+ [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
6736
+ };
6737
+ export interface EmbedProps extends ViewConfig, EmbedEventHandlers {
6738
+ className?: string;
6739
+ }
6740
+ export interface ViewConfigAndListeners<T extends ViewConfig> {
6741
+ viewConfig: T;
6742
+ listeners: {
6743
+ [key in EmbedEvent]?: MessageCallback;
6744
+ };
6745
+ }
6746
+ /**
6747
+ *
6748
+ * @param props
6749
+ */
6750
+ export function getViewPropsAndListeners<T extends EmbedProps, U extends ViewConfig>(props: T): ViewConfigAndListeners<U>;
6751
+
6752
+ /**
6753
+ * Configuration for search options
6754
+ */
6755
+ export interface SearchOptions {
6756
+ /**
6757
+ * The query string to pass to start the Conversation.
6758
+ */
6759
+ searchQuery: string;
6760
+ }
6761
+ /**
6762
+ * The configuration for the embedded conversationEmbed options.
6763
+ * @group Embed components
6764
+ */
6765
+ export interface ConversationViewConfig extends ViewConfig {
6766
+ /**
6767
+ * The ID of the worksheet to use for the conversation.
6768
+ */
6769
+ worksheetId: string;
6770
+ /**
6771
+ * Ability to pass a starting search query to the conversation.
6772
+ */
6773
+ searchOptions?: SearchOptions;
6774
+ /**
6775
+ * disableSourceSelection : Disables data source selection
6776
+ * but still display the selected data source.
6777
+ * @example
6778
+ * ```js
6779
+ * const embed = new ConversationEmbed('#tsEmbed', {
6780
+ * ... // other options
6781
+ * disableSourceSelection : true,
6782
+ * })
6783
+ * ```
6784
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
6785
+ */
6786
+ disableSourceSelection?: boolean;
6787
+ /**
6788
+ * hideSourceSelection : Hide data source selection
6789
+ * @example
6790
+ * ```js
6791
+ * const embed = new ConversationEmbed('#tsEmbed', {
6792
+ * ... // other options
6793
+ * hideSourceSelection : true,
6794
+ * })
6795
+ * ```
6796
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
6797
+ */
6798
+ hideSourceSelection?: boolean;
6799
+ /**
6800
+ * Flag to control Data panel experience
6801
+ * @default false
6802
+ * @version SDK: 1.36.0 | ThoughtSpot Cloud: 10.4.0.cl
6803
+ * @example
6804
+ * ```js
6805
+ * const embed = new AppEmbed('#tsEmbed', {
6806
+ * ... // other options
6807
+ * dataPanelV2: true,
6808
+ * })
6809
+ * ```
6810
+ */
6811
+ dataPanelV2?: boolean;
6812
+ /**
6813
+ * showSpotterLimitations : show limitation text
6814
+ * of the spotter underneath the chat input.
6815
+ * default is false.
6816
+ * @example
6817
+ * ```js
6818
+ * const embed = new ConversationEmbed('#tsEmbed', {
6819
+ * ... // other options
6820
+ * showSpotterLimitations : true,
6821
+ * })
6822
+ * ```
6823
+ * @version SDK: 1.36.0 | Thoughtspot: 10.5.0.cl
6824
+ */
6825
+ showSpotterLimitations?: boolean;
6826
+ /**
6827
+ * hideSampleQuestions : Hide sample questions on
6828
+ * the initial screen of the conversation.
6829
+ * @example
6830
+ * ```js
6831
+ * const embed = new ConversationEmbed('#tsEmbed', {
6832
+ * ... // other options
6833
+ * hideSampleQuestions : true,
6834
+ * })
6835
+ * ```
6836
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
6837
+ */
6838
+ hideSampleQuestions?: boolean;
6839
+ }
6840
+ /**
6841
+ * Embed ThoughtSpot AI Conversation.
6842
+ * @group Embed components
6843
+ * @example
6844
+ * ```js
6845
+ * const conversation = new ConversationEmbed('#tsEmbed', {
6846
+ * worksheetId: 'worksheetId',
6847
+ * searchOptions: {
6848
+ * searchQuery: 'searchQuery',
6849
+ * },
6850
+ * });
6851
+ * conversation.render();
6852
+ * ```
6853
+ * @version SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl
6854
+ */
6855
+ export declare class ConversationEmbed extends TsEmbed {
6856
+ protected viewConfig: ConversationViewConfig;
6857
+ constructor(container: HTMLElement, viewConfig: ConversationViewConfig);
6858
+ getIframeSrc(): string;
6859
+ render(): Promise<ConversationEmbed>;
6860
+ }
6861
+
6862
+ import '../utils/with-resolvers-polyfill';
6863
+ export interface executeTMLInput {
6864
+ metadata_tmls: string[];
6865
+ import_policy?: 'PARTIAL' | 'ALL_OR_NONE' | 'VALIDATE_ONLY';
6866
+ create_new?: boolean;
6867
+ }
6868
+ export interface exportTMLInput {
6869
+ metadata: {
6870
+ identifier: string;
6871
+ type?: 'LIVEBOARD' | 'ANSWER' | 'LOGICAL_TABLE' | 'CONNECTION';
6872
+ }[];
6873
+ export_associated?: boolean;
6874
+ export_fqn?: boolean;
6875
+ edoc_format?: 'YAML' | 'JSON';
6876
+ }
6877
+ export declare let authPromise: Promise<boolean>;
6878
+ export declare const getAuthPromise: () => Promise<boolean>;
6879
+ export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
6880
+ /**
6881
+ * Perform authentication on the ThoughtSpot app as applicable.
6882
+ */
6883
+ export declare const handleAuth: () => Promise<boolean>;
6884
+ /**
6885
+ * Prefetches static resources from the specified URL. Web browsers can then cache the
6886
+ * prefetched resources and serve them from the user's local disk to provide faster access
6887
+ * to your app.
6888
+ * @param url The URL provided for prefetch
6889
+ * @param prefetchFeatures Specify features which needs to be prefetched.
6890
+ * @param additionalFlags This can be used to add any URL flag.
6891
+ * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
6892
+ * @group Global methods
6893
+ */
6894
+ export declare const prefetch: (url?: string, prefetchFeatures?: PrefetchFeatures[], additionalFlags?: {
6895
+ [key: string]: string | number | boolean;
6896
+ }) => void;
6897
+ export declare const createAndSetInitPromise: () => void;
6898
+ export declare const getInitPromise: () => Promise<ReturnType<typeof init>>;
6899
+ export declare const getIsInitCalled: () => boolean;
6900
+ /**
6901
+ * Initializes the Visual Embed SDK globally and perform
6902
+ * authentication if applicable. This function needs to be called before any ThoughtSpot
6903
+ * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
6904
+ * to actually embed. That is handled internally.
6905
+ * @param embedConfig The configuration object containing ThoughtSpot host,
6906
+ * authentication mechanism and so on.
6907
+ * @example
6908
+ * ```js
6909
+ * const authStatus = init({
6910
+ * thoughtSpotHost: 'https://my.thoughtspot.cloud',
6911
+ * authType: AuthType.None,
6912
+ * });
6913
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
6914
+ * ```
6915
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
6916
+ * failure and logout. See {@link AuthStatus}
6917
+ * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
6918
+ * @group Authentication / Init
6919
+ */
6920
+ export declare const init: (embedConfig: EmbedConfig) => AuthEventEmitter;
6921
+ /**
6922
+ *
6923
+ */
6924
+ export declare function disableAutoLogin(): void;
6925
+ /**
6926
+ * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
6927
+ * prevent the SDK from automatically logging in again.
6928
+ *
6929
+ * You can call the `init` method again to re login, if autoLogin is set to
6930
+ * true in this second call it will be honored.
6931
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
6932
+ * @returns Promise which resolves when logout completes.
6933
+ * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
6934
+ * @group Global methods
6935
+ */
6936
+ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
6937
+ /**
6938
+ * Renders functions in a queue, resolves to next function only after the callback next
6939
+ * is called
6940
+ * @param fn The function being registered
6941
+ */
6942
+ export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
6943
+ /**
6944
+ * Imports TML representation of the metadata objects into ThoughtSpot.
6945
+ * @param data
6946
+ * @returns imports TML data into ThoughtSpot
6947
+ * @example
6948
+ * ```js
6949
+ * executeTML({
6950
+ * //Array of metadata Tmls in string format
6951
+ * metadata_tmls: [
6952
+ * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
6953
+ * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
6954
+ * ],
6955
+ * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
6956
+ * create_new: false, // If selected, creates TML objects with new GUIDs.
6957
+ * }).then(result => {
6958
+ * console.log(result);
6959
+ * }).catch(error => {
6960
+ * console.error(error);
6961
+ * });
6962
+ *```
6963
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
6964
+ * @group Global methods
6965
+ */
6966
+ export declare const executeTML: (data: executeTMLInput) => Promise<any>;
6967
+ /**
6968
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
6969
+ * format.
6970
+ * @param data
6971
+ * @returns exports TML data
6972
+ * @example
6973
+ * ```js
6974
+ * exportTML({
6975
+ * metadata: [
6976
+ * {
6977
+ * type: "LIVEBOARD", //Metadata Type
6978
+ * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
6979
+ * }
6980
+ * ],
6981
+ * export_associated: false,//indicates whether to export associated metadata objects
6982
+ * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
6983
+ * //exporting a Liveboard and its associated objects, the API
6984
+ * //returns the Liveboard TML data with the FQNs of the referenced
6985
+ * //worksheet. If the exported TML data includes FQNs, you don't need
6986
+ * //to manually add FQNs of the referenced objects during TML import.
6987
+ * edoc_format: "JSON" //It takes JSON or YAML value
6988
+ * }).then(result => {
6989
+ * console.log(result);
6990
+ * }).catch(error => {
6991
+ * console.error(error);
6992
+ * });
6993
+ * ```
6994
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
6995
+ * @group Global methods
6996
+ */
6997
+ export declare const exportTML: (data: exportTMLInput) => Promise<any>;
6998
+ /**
6999
+ *
7000
+ */
7001
+ export declare function reset(): void;
7002
+
7003
+ /**
7004
+ * Configuration for bodyless conversation options.
7005
+ * @group Embed components
7006
+ */
7007
+ export interface BodylessConversationViewConfig extends ViewConfig {
7008
+ /**
7009
+ * The ID of the worksheet to use for the conversation.
7010
+ */
7011
+ worksheetId: string;
7012
+ }
7013
+ /**
7014
+ * Create a conversation embed, which can be integrated inside
7015
+ * chatbots or other conversational interfaces.
7016
+ * @example
7017
+ * ```js
7018
+ * import { BodylessConversation } from '@thoughtspot/visual-embed-sdk';
7019
+ *
7020
+ * const conversation = new BodylessConversation({
7021
+ * worksheetId: 'worksheetId',
7022
+ * });
7023
+ *
7024
+ * const { container, error } = await conversation.sendMessage('show me sales by region');
7025
+ *
7026
+ * // append the container to the DOM
7027
+ * document.body.appendChild(container); // or to any other element
7028
+ * ```
7029
+ * @group Embed components
7030
+ * @version SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl
7031
+ */
7032
+ export declare class BodylessConversation {
7033
+ constructor(viewConfig: BodylessConversationViewConfig);
7034
+ sendMessage(userMessage: string): Promise<{
7035
+ error: any;
7036
+ container?: undefined;
7037
+ } | {
7038
+ container: HTMLDivElement;
7039
+ error?: undefined;
7040
+ }>;
7041
+ }
7042
+
7043
+ export type SessionInfo = {
7044
+ releaseVersion: string;
7045
+ userGUID: string;
7046
+ currentOrgId: number;
7047
+ privileges: string[];
7048
+ mixpanelToken: string;
7049
+ isPublicUser: boolean;
7050
+ clusterId: string;
7051
+ clusterName: string;
7052
+ [key: string]: any;
7053
+ };
7054
+ export type PreauthInfo = {
7055
+ info?: SessionInfo;
7056
+ headers: Record<string, string>;
7057
+ status: number;
7058
+ [key: string]: any;
7059
+ };
7060
+ /**
7061
+ * Processes the session info response and returns the session info object.
7062
+ * @param preauthInfoResp {any} Response from the session info API.
7063
+ * @returns {PreauthInfo} The session info object.
7064
+ * @example ```js
7065
+ * const preauthInfoResp = await fetch(sessionInfoPath);
7066
+ * const sessionInfo = await formatPreauthInfo(preauthInfoResp);
7067
+ * console.log(sessionInfo);
7068
+ * ```
7069
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7070
+ */
7071
+ export declare const formatPreauthInfo: (preauthInfoResp: any) => Promise<PreauthInfo>;
7072
+ /**
7073
+ * Returns the session info object and caches it for future use.
7074
+ * Once fetched the session info object is cached and returned from the cache on
7075
+ * subsequent calls.
7076
+ * @example ```js
7077
+ * const preauthInfo = await getPreauthInfo();
7078
+ * console.log(preauthInfo);
7079
+ * ```
7080
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7081
+ * @returns {Promise<SessionInfo>} The session info object.
7082
+ */
7083
+ export declare function getPreauthInfo(allowCache?: boolean): Promise<PreauthInfo>;
7084
+ /**
7085
+ * Returns the cached session info object and caches it for future use.
7086
+ * Once fetched the session info object is cached and returned from the cache on
7087
+ * subsequent calls.
7088
+ * This cache is cleared when inti is called OR resetCachedSessionInfo is called.
7089
+ * @example ```js
7090
+ * const sessionInfo = await getSessionInfo();
7091
+ * console.log(sessionInfo);
7092
+ * ```
7093
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7094
+ * @returns {Promise<SessionInfo>} The session info object.
7095
+ */
7096
+ export declare function getSessionInfo(): Promise<SessionInfo>;
7097
+ /**
7098
+ * Returns the cached session info object. If the client is not authenticated the
7099
+ * function will return null.
7100
+ * @example ```js
7101
+ * const sessionInfo = getCachedSessionInfo();
7102
+ * if (sessionInfo) {
7103
+ * console.log(sessionInfo);
7104
+ * } else {
7105
+ * console.log('Not authenticated');
7106
+ * }
7107
+ * ```
7108
+ * @returns {SessionInfo | null} The session info object.
7109
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7110
+ */
7111
+ export declare function getCachedSessionInfo(): SessionInfo | null;
7112
+ /**
7113
+ * Processes the session info response and returns the session info object.
7114
+ * @param sessionInfoResp {any} Response from the session info API.
7115
+ * @returns {SessionInfo} The session info object.
7116
+ * @example ```js
7117
+ * const sessionInfoResp = await fetch(sessionInfoPath);
7118
+ * const sessionInfo = getSessionDetails(sessionInfoResp);
7119
+ * console.log(sessionInfo);
7120
+ * ```
7121
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7122
+ */
7123
+ export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
7124
+ /**
7125
+ * Resets the cached session info object and forces a new fetch on the next call.
7126
+ * @example ```js
7127
+ * resetCachedSessionInfo();
7128
+ * const sessionInfo = await getSessionInfo();
7129
+ * console.log(sessionInfo);
7130
+ * ```
7131
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7132
+ * @returns {void}
7133
+ */
7134
+ export declare function resetCachedSessionInfo(): void;
7135
+ /**
7136
+ * Resets the cached preauth info object and forces a new fetch on the next call.
7137
+ * @example ```js
7138
+ * resetCachedPreauthInfo();
7139
+ * const preauthInfo = await getPreauthInfo();
7140
+ * console.log(preauthInfo);
7141
+ * ```
7142
+ * @version SDK: 1.28.3 | ThoughtSpot: *
7143
+ * @returns {void}
7144
+ */
7145
+ export declare function resetCachedPreauthInfo(): void;
7146
+
7129
7147
  /**
7130
7148
  * The list of customization css variables. These
7131
7149
  * are the only allowed variables possible.
@@ -7939,6 +7957,7 @@ export declare class TsEmbed {
7939
7957
  */
7940
7958
  protected isRendered: boolean;
7941
7959
  protected hostEventClient: HostEventClient;
7960
+ protected isReadyForRenderPromise: Promise<void>;
7942
7961
  constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
7943
7962
  /**
7944
7963
  * Handles errors within the SDK
@@ -8082,12 +8101,12 @@ export declare class TsEmbed {
8082
8101
  */
8083
8102
  render(): Promise<TsEmbed>;
8084
8103
  getIframeSrc(): string;
8085
- protected handleRenderForPrerender(): void;
8104
+ protected handleRenderForPrerender(): Promise<TsEmbed>;
8086
8105
  /**
8087
8106
  * Creates the preRender shell
8088
8107
  * @param showPreRenderByDefault - Show the preRender after render, hidden by default
8089
8108
  */
8090
- preRender(showPreRenderByDefault?: boolean): TsEmbed;
8109
+ preRender(showPreRenderByDefault?: boolean): Promise<TsEmbed>;
8091
8110
  /**
8092
8111
  * Get the Post Url Params for THOUGHTSPOT from the current
8093
8112
  * host app URL.
@@ -8118,7 +8137,7 @@ export declare class TsEmbed {
8118
8137
  * Also, synchronizes the style of the PreRender component with the embedding
8119
8138
  * element.
8120
8139
  */
8121
- showPreRender(): void;
8140
+ showPreRender(): Promise<TsEmbed>;
8122
8141
  /**
8123
8142
  * Synchronizes the style properties of the PreRender component with the embedding
8124
8143
  * element. This function adjusts the position, width, and height of the PreRender