@thoughtspot/visual-embed-sdk 1.20.0 → 1.20.1

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 (70) hide show
  1. package/dist/src/auth.d.ts +38 -4
  2. package/dist/src/auth.d.ts.map +1 -1
  3. package/dist/src/embed/app.d.ts +2 -2
  4. package/dist/src/embed/base.d.ts +22 -13
  5. package/dist/src/embed/base.d.ts.map +1 -1
  6. package/dist/src/embed/liveboard.d.ts +2 -2
  7. package/dist/src/embed/search-bar.d.ts +4 -1
  8. package/dist/src/embed/search-bar.d.ts.map +1 -1
  9. package/dist/src/embed/search.d.ts +2 -2
  10. package/dist/src/embed/ts-embed.d.ts +35 -1
  11. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  12. package/dist/src/index.d.ts +3 -3
  13. package/dist/src/index.d.ts.map +1 -1
  14. package/dist/src/react/index.d.ts.map +1 -1
  15. package/dist/src/types.d.ts +161 -26
  16. package/dist/src/types.d.ts.map +1 -1
  17. package/dist/tsembed.es.js +193 -35
  18. package/dist/tsembed.js +174 -35
  19. package/lib/package.json +2 -3
  20. package/lib/src/auth.d.ts +38 -4
  21. package/lib/src/auth.d.ts.map +1 -1
  22. package/lib/src/auth.js +17 -2
  23. package/lib/src/auth.js.map +1 -1
  24. package/lib/src/embed/app.d.ts +2 -2
  25. package/lib/src/embed/app.js +1 -1
  26. package/lib/src/embed/base.d.ts +22 -13
  27. package/lib/src/embed/base.d.ts.map +1 -1
  28. package/lib/src/embed/base.js +21 -3
  29. package/lib/src/embed/base.js.map +1 -1
  30. package/lib/src/embed/base.spec.js +2 -2
  31. package/lib/src/embed/base.spec.js.map +1 -1
  32. package/lib/src/embed/liveboard.d.ts +2 -2
  33. package/lib/src/embed/liveboard.js +1 -1
  34. package/lib/src/embed/search-bar.d.ts +4 -1
  35. package/lib/src/embed/search-bar.d.ts.map +1 -1
  36. package/lib/src/embed/search-bar.js +1 -1
  37. package/lib/src/embed/search-bar.js.map +1 -1
  38. package/lib/src/embed/search.d.ts +2 -2
  39. package/lib/src/embed/search.js +1 -1
  40. package/lib/src/embed/ts-embed.d.ts +35 -1
  41. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  42. package/lib/src/embed/ts-embed.js +35 -2
  43. package/lib/src/embed/ts-embed.js.map +1 -1
  44. package/lib/src/index.d.ts +3 -3
  45. package/lib/src/index.d.ts.map +1 -1
  46. package/lib/src/index.js +1 -1
  47. package/lib/src/index.js.map +1 -1
  48. package/lib/src/react/index.d.ts.map +1 -1
  49. package/lib/src/react/index.js +4 -2
  50. package/lib/src/react/index.js.map +1 -1
  51. package/lib/src/react/index.spec.js +14 -2
  52. package/lib/src/react/index.spec.js.map +1 -1
  53. package/lib/src/types.d.ts +161 -26
  54. package/lib/src/types.d.ts.map +1 -1
  55. package/lib/src/types.js +115 -23
  56. package/lib/src/types.js.map +1 -1
  57. package/lib/src/visual-embed-sdk.d.ts +269 -54
  58. package/package.json +2 -3
  59. package/src/auth.ts +51 -5
  60. package/src/embed/app.ts +2 -2
  61. package/src/embed/base.spec.ts +3 -3
  62. package/src/embed/base.ts +26 -7
  63. package/src/embed/liveboard.ts +2 -2
  64. package/src/embed/search-bar.tsx +4 -1
  65. package/src/embed/search.ts +2 -2
  66. package/src/embed/ts-embed.ts +35 -2
  67. package/src/index.ts +24 -2
  68. package/src/react/index.spec.tsx +35 -2
  69. package/src/react/index.tsx +10 -2
  70. package/src/types.ts +162 -25
@@ -17,9 +17,9 @@ declare module '@thoughtspot/visual-embed-sdk' {
17
17
  import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from '@thoughtspot/visual-embed-sdk/embed/liveboard';
18
18
  import { SearchEmbed, SearchViewConfig } from '@thoughtspot/visual-embed-sdk/embed/search';
19
19
  import { SearchBarEmbed, SearchBarViewConfig } from '@thoughtspot/visual-embed-sdk/embed/search-bar';
20
- import { AuthFailureType, AuthStatus, AuthEvent, getSessionInfo } from '@thoughtspot/visual-embed-sdk/auth';
21
- import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, PrefetchFeatures } from '@thoughtspot/visual-embed-sdk/types';
22
- export { init, logout, prefetch, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, };
20
+ import { AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, getSessionInfo } from '@thoughtspot/visual-embed-sdk/auth';
21
+ import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface } from '@thoughtspot/visual-embed-sdk/types';
22
+ export { init, logout, prefetch, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, };
23
23
  }
24
24
 
25
25
  declare module '@thoughtspot/visual-embed-sdk/embed/app' {
@@ -70,7 +70,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
70
70
  }
71
71
  /**
72
72
  * The view configuration for full app embedding.
73
- * @Category App Embed
73
+ * @group Embed components
74
74
  */
75
75
  export interface AppViewConfig extends ViewConfig {
76
76
  /**
@@ -118,7 +118,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
118
118
  }
119
119
  /**
120
120
  * Embeds full ThoughtSpot experience in a host application.
121
- * @Category App Embed
121
+ * @group Embed components
122
122
  */
123
123
  export class AppEmbed extends V1Embed {
124
124
  protected viewConfig: AppViewConfig;
@@ -143,18 +143,16 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
143
143
  }
144
144
 
145
145
  declare module '@thoughtspot/visual-embed-sdk/embed/base' {
146
+ import { EmbedConfig, PrefetchFeatures } from '@thoughtspot/visual-embed-sdk/types';
147
+ import { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, AuthEventEmitter } from '@thoughtspot/visual-embed-sdk/auth';
148
+ export let authPromise: Promise<boolean>;
146
149
  /**
147
- * Copyright (c) 2022
148
- *
149
- * Base classes
150
+ * Gets the configuration embed was initialized with.
150
151
  *
151
- * @summary Base classes
152
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
152
+ * @returns {@link EmbedConfig} The configuration embed was initialized with.
153
+ * @version SDK: 1.19.0 | ThoughtSpot: *
154
+ * @group Global methods
153
155
  */
154
- import EventEmitter from 'eventemitter3';
155
- import { EmbedConfig, PrefetchFeatures } from '@thoughtspot/visual-embed-sdk/types';
156
- import { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout } from '@thoughtspot/visual-embed-sdk/auth';
157
- export let authPromise: Promise<boolean>;
158
156
  export const getEmbedConfig: () => EmbedConfig;
159
157
  export const getAuthPromise: () => Promise<boolean>;
160
158
  export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
@@ -167,6 +165,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
167
165
  * @param url The URL provided for prefetch
168
166
  * @param prefetchFeatures Specify features which needs to be prefetched.
169
167
  * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
168
+ * @group Global methods
170
169
  */
171
170
  export const prefetch: (url?: string, prefetchFeatures?: PrefetchFeatures[]) => void;
172
171
  /**
@@ -174,12 +173,21 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
174
173
  * authentication if applicable.
175
174
  * @param embedConfig The configuration object containing ThoughtSpot host,
176
175
  * authentication mechanism and so on.
177
- * example: authStatus = init(config);
178
- * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
179
- * @returns event emitter which emits events on authentication success, failure and logout. See {@link AuthStatus}
176
+ *
177
+ * @example
178
+ * ```js
179
+ * const authStatus = init({
180
+ * thoughtSpotHost: 'https://my.thoughtspot.cloud',
181
+ * authType: AuthType.None,
182
+ * });
183
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
184
+ * ```
185
+ *
186
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success, failure and logout. See {@link AuthStatus}
180
187
  * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
188
+ * @group Authentication / Init
181
189
  */
182
- export const init: (embedConfig: EmbedConfig) => EventEmitter;
190
+ export const init: (embedConfig: EmbedConfig) => AuthEventEmitter;
183
191
  export function disableAutoLogin(): void;
184
192
  /**
185
193
  * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
@@ -191,6 +199,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
191
199
  * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
192
200
  * @returns Promise which resolves when logout completes.
193
201
  * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
202
+ * @group Global methods
194
203
  */
195
204
  export const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
196
205
  /**
@@ -216,7 +225,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
216
225
  import { V1Embed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
217
226
  /**
218
227
  * The configuration for the embedded Liveboard or visualization page view.
219
- * @Category Liveboards and Charts
228
+ * @group Embed components
220
229
  */
221
230
  export interface LiveboardViewConfig extends ViewConfig {
222
231
  /**
@@ -283,7 +292,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
283
292
  }
284
293
  /**
285
294
  * Embed a ThoughtSpot Liveboard or visualization
286
- * @Category Liveboards and Charts
295
+ * @group Embed components
287
296
  */
288
297
  export class LiveboardEmbed extends V1Embed {
289
298
  protected viewConfig: LiveboardViewConfig;
@@ -337,7 +346,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
337
346
  /**
338
347
  * The configuration attributes for the embedded search view.
339
348
  *
340
- * @Category Search Embed
349
+ * @group Embed components
341
350
  */
342
351
  export interface SearchViewConfig extends ViewConfig {
343
352
  /**
@@ -404,7 +413,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
404
413
  /**
405
414
  * Embed ThoughtSpot search
406
415
  *
407
- * @Category Search Embed
416
+ * @group Embed components
408
417
  */
409
418
  export class SearchEmbed extends TsEmbed {
410
419
  /**
@@ -423,6 +432,9 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search-bar' {
423
432
  import { ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
424
433
  import { TsEmbed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
425
434
  import { SearchOptions } from '@thoughtspot/visual-embed-sdk/embed/search';
435
+ /**
436
+ * @group Embed components
437
+ */
426
438
  export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts'> {
427
439
  /**
428
440
  * The array of data source GUIDs to set on load.
@@ -443,8 +455,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search-bar' {
443
455
  /**
444
456
  * Embed ThoughtSpot search bar
445
457
  *
446
- * @Category Search Embed
447
458
  * @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
459
+ * @group Embed components
448
460
  */
449
461
  export class SearchBarEmbed extends TsEmbed {
450
462
  /**
@@ -474,12 +486,21 @@ declare module '@thoughtspot/visual-embed-sdk/auth' {
474
486
  BASIC_LOGIN: string;
475
487
  LOGOUT: string;
476
488
  };
489
+ /**
490
+ * Enum for auth failure types. This is the parameter passed to the listner
491
+ * of {@link AuthStatus.FAILURE}.
492
+ * @group Authentication / Init
493
+ */
477
494
  export enum AuthFailureType {
478
495
  SDK = "SDK",
479
496
  NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
480
497
  EXPIRY = "EXPIRY",
481
498
  OTHER = "OTHER"
482
499
  }
500
+ /**
501
+ * Enum for auth status emitted by the emitter returned from {@link init}.
502
+ * @group Authentication / Init
503
+ */
483
504
  export enum AuthStatus {
484
505
  /**
485
506
  * Emits when the SDK fails to authenticate
@@ -505,14 +526,38 @@ declare module '@thoughtspot/visual-embed-sdk/auth' {
505
526
  */
506
527
  WAITING_FOR_POPUP = "WAITING_FOR_POPUP"
507
528
  }
529
+ /**
530
+ * Event emitter returned from {@link init}.
531
+ * @group Authentication / Init
532
+ */
533
+ export interface AuthEventEmitter {
534
+ /**
535
+ * Registed a listener on Auth failure.
536
+ * @param event
537
+ * @param listener
538
+ */
539
+ on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
540
+ on(event: AuthStatus.SDK_SUCCESS | AuthStatus.LOGOUT | AuthStatus.WAITING_FOR_POPUP, listener: () => void): this;
541
+ on(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
542
+ /**
543
+ * Trigger an event on the emitter returned from init.
544
+ * @param {@link AuthEvent}
545
+ */
546
+ emit(event: AuthEvent): void;
547
+ }
548
+ /**
549
+ * Events which can be triggered on the emitter returned from {@link init}.
550
+ * @group Authentication / Init
551
+ */
508
552
  export enum AuthEvent {
509
553
  /**
510
- * Manually trigger the SSO popup.
554
+ * Manually trigger the SSO popup. This is useful with
555
+ * authStatus: SAMLRedirect/OIDCRedicre and inPopup: true
511
556
  */
512
557
  TRIGGER_SSO_POPUP = "TRIGGER_SSO_POPUP"
513
558
  }
514
- export function getAuthEE(): EventEmitter;
515
- export function setAuthEE(eventEmitter: EventEmitter): void;
559
+ export function getAuthEE(): EventEmitter<AuthStatus | AuthEvent>;
560
+ export function setAuthEE(eventEmitter: EventEmitter<AuthStatus | AuthEvent>): void;
516
561
  export function notifyAuthSDKSuccess(): void;
517
562
  export function notifyAuthSuccess(): void;
518
563
  export function notifyAuthFailure(failureType: AuthFailureType): void;
@@ -522,8 +567,9 @@ declare module '@thoughtspot/visual-embed-sdk/auth' {
522
567
  */
523
568
  export function getReleaseVersion(): string;
524
569
  /**
525
- * Return a promise that resolves with the session info when authentication is
570
+ * Return a promise that resolves with the session information when authentication is
526
571
  * successful. And info is available.
572
+ * @group Global methods
527
573
  */
528
574
  export function getSessionInfo(): Promise<any>;
529
575
  export function initSession(sessionDetails: any): void;
@@ -565,6 +611,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
565
611
  /**
566
612
  * The authentication mechanism for allowing access to the
567
613
  * the embedded app
614
+ * @group Authentication / Init
568
615
  */
569
616
  export enum AuthType {
570
617
  /**
@@ -592,6 +639,15 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
592
639
  /**
593
640
  * SSO using SAML
594
641
  * Will make the host application redirect to the SAML Idp.
642
+ * @example
643
+ * ```js
644
+ * init({
645
+ * // ...
646
+ * authType: AuthType.SAMLRedirect,
647
+ * authTriggerText: 'Login with SAML',
648
+ * authTriggerContainer: '#embed-container',
649
+ * });
650
+ * ```
595
651
  */
596
652
  SAMLRedirect = "SSO_SAML",
597
653
  /**
@@ -615,6 +671,18 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
615
671
  * Trusted authentication server, Use your own authentication server
616
672
  * which returns a bearer token, generated using the secret_key obtained from
617
673
  * ThoughtSpot.
674
+ *
675
+ * @example
676
+ * ```js
677
+ * init({
678
+ * // ...
679
+ * authType: AuthType.TrustedAuthToken,
680
+ * getAuthToken: () => {
681
+ * return fetch('https://my-backend.app/ts-token')
682
+ * .then((response) => response.json())
683
+ * .then((data) => data.token);
684
+ * }
685
+ * ```
618
686
  */
619
687
  TrustedAuthToken = "AuthServer",
620
688
  /**
@@ -633,7 +701,10 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
633
701
  Basic = "Basic"
634
702
  }
635
703
  export type DOMSelector = string | HTMLElement;
636
- interface customCssInterface {
704
+ /**
705
+ * inline customCSS within the {@link CustomisationsInterface}.
706
+ */
707
+ export interface customCssInterface {
637
708
  variables?: {
638
709
  [variableName: string]: string;
639
710
  };
@@ -643,10 +714,38 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
643
714
  };
644
715
  };
645
716
  }
646
- interface CustomStyles {
717
+ /**
718
+ * Styles within the {@link CustomisationsInterface}.
719
+ */
720
+ export interface CustomStyles {
647
721
  customCSSUrl?: string;
648
722
  customCSS?: customCssInterface;
649
723
  }
724
+ /**
725
+ * Configuration to define the customization on the Embedded
726
+ * Thoughtspot components.
727
+ *
728
+ * @example
729
+ * ```js
730
+ * init({
731
+ * // ...
732
+ * customizations: {
733
+ * style: {
734
+ * customCSS: {
735
+ * variables: {},
736
+ * rules_UNSTABLE: {}
737
+ * }
738
+ * },
739
+ * content: {
740
+ * strings: {
741
+ * 'LIVEBOARDS': 'Dashboards'
742
+ * }
743
+ * },
744
+ * iconSpriteUrl: 'https://my-custom-icon-sprite.svg'
745
+ * }
746
+ * })
747
+ * ```
748
+ */
650
749
  export interface CustomisationsInterface {
651
750
  style?: CustomStyles;
652
751
  content?: {
@@ -660,6 +759,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
660
759
  * It includes the ThoughtSpot hostname or IP address,
661
760
  * the type of authentication, and the authentication endpoint
662
761
  * if a trusted authentication server is used.
762
+ *
763
+ * @group Authentication / Init
663
764
  */
664
765
  export interface EmbedConfig {
665
766
  /**
@@ -820,6 +921,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
820
921
  }
821
922
  /**
822
923
  * Embedded iFrame configuration
924
+ *
925
+ * @group Embed components
823
926
  */
824
927
  export interface FrameParams {
825
928
  /**
@@ -830,6 +933,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
830
933
  * The height of the iFrame (unit is pixels if numeric).
831
934
  */
832
935
  height?: number | string;
936
+ /**
937
+ * Set to 'lazy' to enable lazy loading of the embedded TS frame.
938
+ * This will defer loading of the frame until it comes into the
939
+ * viewport. This is useful for performance optimization.
940
+ */
941
+ loading?: 'lazy' | 'eager' | 'auto';
833
942
  /**
834
943
  * This parameters will be passed on the iframe
835
944
  * as is.
@@ -933,6 +1042,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
933
1042
  }
934
1043
  /**
935
1044
  * MessagePayload: Embed event payload: message type, data and status (start/end)
1045
+ * @group Events
936
1046
  */
937
1047
  export type MessagePayload = {
938
1048
  type: string;
@@ -941,12 +1051,14 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
941
1051
  };
942
1052
  /**
943
1053
  * MessageOptions: By Providing options, getting specific event start / end based on option
1054
+ * @group Events
944
1055
  */
945
1056
  export type MessageOptions = {
946
1057
  start?: boolean;
947
1058
  };
948
1059
  /**
949
1060
  * MessageCallback: Embed event message callback
1061
+ * @group Events
950
1062
  */
951
1063
  export type MessageCallback = (payload: MessagePayload, responder?: (data: any) => void) => void;
952
1064
  /**
@@ -1042,6 +1154,10 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1042
1154
  }
1043
1155
  /**
1044
1156
  * Event types emitted by the embedded ThoughtSpot application.
1157
+ *
1158
+ * To add an event listener use the corresponding
1159
+ * {@link LiveboardEmbed.on} or {@link AppEmbed.on} or {@link SearchEmbed.on} method.
1160
+ * @group Events
1045
1161
  */
1046
1162
  export enum EmbedEvent {
1047
1163
  /**
@@ -1368,6 +1484,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1368
1484
  *
1369
1485
  * To trigger an event use the corresponding
1370
1486
  * {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link SearchEmbed.trigger} method.
1487
+ * @group Events
1371
1488
  */
1372
1489
  export enum HostEvent {
1373
1490
  /**
@@ -1378,11 +1495,13 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1378
1495
  * @param - searchQuery - The search query
1379
1496
  * @param - execute - execute the existing / updated query
1380
1497
  * @example
1498
+ * ```js
1381
1499
  * searchEmbed.trigger(HostEvent.Search, {
1382
- * searchQuery: "[sales] by [item type],
1383
- * "dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
1384
- * "execute": true
1500
+ * searchQuery: "[sales] by [item type],
1501
+ * dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
1502
+ * execute: true
1385
1503
  * })
1504
+ * ```
1386
1505
  */
1387
1506
  Search = "search",
1388
1507
  /**
@@ -1391,10 +1510,14 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1391
1510
  * eg. { selectedPoints: []}
1392
1511
  * @param - columnGuid - a string guid of the column to drill by. This is optional,
1393
1512
  * if not provided it will auto drill by the configured column.
1394
- * @example searchEmbed.trigger(HostEvent.DrillDown, {
1395
- * points: clickedPointData,
1396
- * autoDrillDown: true,
1513
+ * @example
1514
+ * ```js
1515
+ * searchEmbed.trigger(HostEvent.DrillDown, {
1516
+ * points: clickedPointData,
1517
+ * autoDrillDown: true,
1397
1518
  * })
1519
+ * ```
1520
+ *
1398
1521
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
1399
1522
  */
1400
1523
  DrillDown = "triggerDrillDown",
@@ -1433,7 +1556,10 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1433
1556
  * Navigate to a specific page in App embed without any reload.
1434
1557
  * This is the same as calling `appEmbed.navigateToPage(path, true)`
1435
1558
  * @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
1436
- * @example appEmbed.navigateToPage(-1)
1559
+ * @example
1560
+ * ```js
1561
+ * appEmbed.navigateToPage(-1)
1562
+ * ```
1437
1563
  * @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
1438
1564
  */
1439
1565
  Navigate = "Navigate",
@@ -1441,27 +1567,39 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1441
1567
  * Opens the filter panel for a particular column.
1442
1568
  * Works with Search embed.
1443
1569
  * @param - { columnId: string, name: string, type: INT64/CHAR/DATE, dataType: ATTRIBUTE/MEASURE }
1444
- * @example searchEmbed.trigger(HostEvent.OpenFilter, { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
1570
+ * @example
1571
+ * ```js
1572
+ * searchEmbed.trigger(HostEvent.OpenFilter, { columnId: '123', name: 'column name', type: 'INT64', dataType: 'ATTRIBUTE' })
1573
+ * ```
1445
1574
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
1446
1575
  */
1447
1576
  OpenFilter = "openFilter",
1448
1577
  /**
1449
1578
  * Adds the columns to the current Search.
1450
1579
  * @param - { columnIds: string[] }
1451
- * @example searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['123', '456'] })
1580
+ * @example
1581
+ * ```js
1582
+ * searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['123', '456'] })
1583
+ * ```
1452
1584
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
1453
1585
  */
1454
1586
  AddColumns = "addColumns",
1455
1587
  /**
1456
1588
  * Removes a column from the current Search.
1457
1589
  * @param - { columnId: string }
1458
- * @example - searchEmbed.trigger(HostEvent.RemoveColumn, { columnId: '123' })
1590
+ * @example
1591
+ * ```js
1592
+ * searchEmbed.trigger(HostEvent.RemoveColumn, { columnId: '123' })
1593
+ * ```
1459
1594
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
1460
1595
  */
1461
1596
  RemoveColumn = "removeColumn",
1462
1597
  /**
1463
1598
  * Gets the current pinboard content.
1464
- * @example liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
1599
+ * @example
1600
+ * ```js
1601
+ * liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
1602
+ * ```
1465
1603
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
1466
1604
  */
1467
1605
  getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
@@ -1470,87 +1608,124 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1470
1608
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
1471
1609
  * can be left empty for search and visualization embeds
1472
1610
  * @example
1611
+ * ```js
1473
1612
  * liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1474
1613
  * vizEmbed.trigger(HostEvent.Pin)
1475
1614
  * searchEmbed.trigger(HostEvent.Pin)
1615
+ * ```
1476
1616
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1477
1617
  */
1478
1618
  Pin = "pin",
1479
1619
  /**
1480
1620
  * Triggers the Show Liveboard details action on a Liveboard
1481
- * @example liveboardEmbed.trigger(HostEvent.LiveboardInfo)
1621
+ * @example
1622
+ * ```js
1623
+ * liveboardEmbed.trigger(HostEvent.LiveboardInfo)
1624
+ * ```
1482
1625
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1483
1626
  */
1484
1627
  LiveboardInfo = "pinboardInfo",
1485
1628
  /**
1486
1629
  * Triggers the Schedule action on a Liveboard
1487
- * @example liveboardEmbed.trigger(HostEvent.Schedule)
1630
+ * @example
1631
+ * ```js
1632
+ * liveboardEmbed.trigger(HostEvent.Schedule)
1633
+ * ```
1488
1634
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1489
1635
  */
1490
1636
  Schedule = "subscription",
1491
1637
  /**
1492
1638
  * Triggers the Manage schedule action on a Liveboard
1493
- * @example liveboardEmbed.trigger(HostEvent.ScheduleList)
1639
+ * @example
1640
+ * ```js
1641
+ * liveboardEmbed.trigger(HostEvent.ScheduleList)
1642
+ * ```
1494
1643
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1495
1644
  */
1496
1645
  SchedulesList = "schedule-list",
1497
1646
  /**
1498
1647
  * Triggers the Export TML action on a Liveboard
1499
- * @example liveboardEmbed.trigger(HostEvent.ExportTML)
1648
+ * @example
1649
+ * ```js
1650
+ * liveboardEmbed.trigger(HostEvent.ExportTML)
1651
+ * ```
1500
1652
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1501
1653
  */
1502
1654
  ExportTML = "exportTSL",
1503
1655
  /**
1504
1656
  * Triggers the Edit TML action on a Liveboard
1505
- * @example liveboardEmbed.trigger(HostEvent.EditTML)
1657
+ * @example
1658
+ * ```js
1659
+ * liveboardEmbed.trigger(HostEvent.EditTML)
1660
+ * ```
1506
1661
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1507
1662
  */
1508
1663
  EditTML = "editTSL",
1509
1664
  /**
1510
1665
  * Triggers the Update TML action on a Liveboard
1511
- * @example liveboardEmbed.trigger(HostEvent.UpdateTML)
1666
+ * @example
1667
+ * ```js
1668
+ * liveboardEmbed.trigger(HostEvent.UpdateTML)
1669
+ * ```
1512
1670
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1513
1671
  */
1514
1672
  UpdateTML = "updateTSL",
1515
1673
  /**
1516
1674
  * Triggers the Download PDF action on a Liveboard
1517
- * @example liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
1675
+ * @example
1676
+ * ```js
1677
+ * liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
1678
+ * ```
1518
1679
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1519
1680
  */
1520
1681
  DownloadAsPdf = "downloadAsPdf",
1521
1682
  /**
1522
1683
  * Triggers the Make a copy action on a Liveboard, search or visualization
1523
1684
  * @example
1685
+ * ```js
1524
1686
  * liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1525
1687
  * vizEmbed.trigger(HostEvent.MakeACopy)
1526
1688
  * searchEmbed.trigger(HostEvent.MakeACopy)
1689
+ * ```
1527
1690
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1528
1691
  */
1529
1692
  MakeACopy = "makeACopy",
1530
1693
  /**
1531
1694
  * Triggers the Delete action on a Liveboard
1532
- * @example appEmbed.trigger(HostEvent.Remove)
1695
+ * @example
1696
+ * ```js
1697
+ * appEmbed.trigger(HostEvent.Remove)
1698
+ * ```
1533
1699
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1534
1700
  */
1535
1701
  Remove = "delete",
1536
1702
  /**
1537
1703
  * Triggers the Explore action on a visualization
1538
1704
  * @param - an object with vizId as a key
1539
- * @example liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1705
+ * @example
1706
+ * ```js
1707
+ * liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1708
+ * ```
1540
1709
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1541
1710
  */
1542
1711
  Explore = "explore",
1543
1712
  /**
1544
1713
  * Triggers the Create alert action on a visualization
1545
1714
  * @param - an object with vizId as a key
1546
- * @example liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1715
+ * @example
1716
+ * ```js
1717
+ * liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1718
+ * ```
1547
1719
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1548
1720
  */
1549
1721
  CreateMonitor = "createMonitor",
1550
1722
  /**
1551
1723
  * Triggers the Manage alert action on a visualization
1552
1724
  * @param - an object with vizId as a key
1553
- * @example liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1725
+ * @example
1726
+ * ```js
1727
+ * liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1728
+ * ```
1554
1729
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1555
1730
  */
1556
1731
  ManageMonitor = "manageMonitor",
@@ -1568,9 +1743,11 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1568
1743
  * Triggers the Copy link action on a Liveboard or visualization
1569
1744
  * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1570
1745
  * @example
1746
+ * ```js
1571
1747
  * liveboardEmbed.trigger(HostEvent.CopyLink)
1572
1748
  * liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1573
1749
  * vizEmbed.trigger((HostEvent.CopyLink)
1750
+ * ```
1574
1751
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1575
1752
  */
1576
1753
  CopyLink = "embedDocument",
@@ -1578,15 +1755,20 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1578
1755
  * Triggers the Present action on a Liveboard or visualization
1579
1756
  * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1580
1757
  * @example
1758
+ * ```js
1581
1759
  * liveboardEmbed.trigger(HostEvent.Present)
1582
1760
  * liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1583
1761
  * vizEmbed.trigger((HostEvent.Present)
1762
+ * ```
1584
1763
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1585
1764
  */
1586
1765
  Present = "present",
1587
1766
  /**
1588
1767
  * Get TML for the current search.
1589
- * @example searchEmbed.trigger(HostEvent.GetTML)
1768
+ * @example
1769
+ * ```js
1770
+ * searchEmbed.trigger(HostEvent.GetTML)
1771
+ * ```
1590
1772
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
1591
1773
  */
1592
1774
  GetTML = "getTML",
@@ -1995,7 +2177,6 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1995
2177
  LEFT_CLICK = "left-click",
1996
2178
  RIGHT_CLICK = "right-click"
1997
2179
  }
1998
- export {};
1999
2180
  }
2000
2181
 
2001
2182
  declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
@@ -2106,6 +2287,20 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
2106
2287
  * @param messageType The message type
2107
2288
  * @param callback A callback as a function
2108
2289
  * @param options The message options
2290
+ * @example
2291
+ * ```js
2292
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
2293
+ * console.error(data);
2294
+ * });
2295
+ * ```
2296
+ * @example
2297
+ * ```js
2298
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
2299
+ * console.log("Answer save clicked", data);
2300
+ * }, {
2301
+ * start: true // This will trigger the callback on start of save
2302
+ * });
2303
+ * ```
2109
2304
  */
2110
2305
  on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
2111
2306
  /**
@@ -2138,15 +2333,35 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
2138
2333
  * Base class for embedding v1 experience
2139
2334
  * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
2140
2335
  * which is currently under migration to v2
2336
+ *
2337
+ * @inheritdoc
2141
2338
  */
2142
2339
  export class V1Embed extends TsEmbed {
2143
2340
  protected viewConfig: ViewConfig;
2144
2341
  constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
2145
2342
  /**
2146
- * Render the app in an iframe and set up event handlers
2343
+ * Render the ap p in an iframe and set up event handlers
2147
2344
  * @param iframeSrc
2148
2345
  */
2149
2346
  protected renderV1Embed(iframeSrc: string): any;
2347
+ /**
2348
+ * @inheritdoc TsEmbed.on
2349
+ *
2350
+ * @example
2351
+ * ```js
2352
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
2353
+ * console.error(data);
2354
+ * });
2355
+ * ```
2356
+ * @example
2357
+ * ```js
2358
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
2359
+ * console.log("Answer save clicked", data);
2360
+ * }, {
2361
+ * start: true // This will trigger the callback on start of save
2362
+ * });
2363
+ * ```
2364
+ */
2150
2365
  on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
2151
2366
  }
2152
2367
  }