@thoughtspot/visual-embed-sdk 1.24.0-alpha.0 → 1.24.0-alpha.2

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 (146) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +9 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +4 -3
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/embed/app.d.ts +26 -2
  7. package/cjs/src/embed/app.d.ts.map +1 -1
  8. package/cjs/src/embed/app.js +4 -2
  9. package/cjs/src/embed/app.js.map +1 -1
  10. package/cjs/src/embed/app.spec.js +20 -0
  11. package/cjs/src/embed/app.spec.js.map +1 -1
  12. package/cjs/src/embed/base.d.ts +10 -0
  13. package/cjs/src/embed/base.d.ts.map +1 -1
  14. package/cjs/src/embed/base.js +12 -2
  15. package/cjs/src/embed/base.js.map +1 -1
  16. package/cjs/src/embed/sage.d.ts +25 -2
  17. package/cjs/src/embed/sage.d.ts.map +1 -1
  18. package/cjs/src/embed/sage.js +10 -5
  19. package/cjs/src/embed/sage.js.map +1 -1
  20. package/cjs/src/embed/sage.spec.js +26 -0
  21. package/cjs/src/embed/sage.spec.js.map +1 -1
  22. package/cjs/src/embed/search-bar.d.ts +1 -1
  23. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  24. package/cjs/src/embed/search.d.ts +8 -0
  25. package/cjs/src/embed/search.d.ts.map +1 -1
  26. package/cjs/src/embed/search.js +2 -1
  27. package/cjs/src/embed/search.js.map +1 -1
  28. package/cjs/src/embed/search.spec.js +11 -1
  29. package/cjs/src/embed/search.spec.js.map +1 -1
  30. package/cjs/src/embed/ts-embed.d.ts +3 -1
  31. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  32. package/cjs/src/embed/ts-embed.js +14 -6
  33. package/cjs/src/embed/ts-embed.js.map +1 -1
  34. package/cjs/src/embed/ts-embed.spec.js +4 -1
  35. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  36. package/cjs/src/mixpanel-service.d.ts +1 -0
  37. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  38. package/cjs/src/mixpanel-service.js +10 -3
  39. package/cjs/src/mixpanel-service.js.map +1 -1
  40. package/cjs/src/mixpanel-service.spec.js +12 -3
  41. package/cjs/src/mixpanel-service.spec.js.map +1 -1
  42. package/cjs/src/react/index.d.ts +14 -14
  43. package/cjs/src/react/index.d.ts.map +1 -1
  44. package/cjs/src/react/index.js +4 -2
  45. package/cjs/src/react/index.js.map +1 -1
  46. package/cjs/src/react/index.spec.js +1 -1
  47. package/cjs/src/react/index.spec.js.map +1 -1
  48. package/cjs/src/types.d.ts +43 -11
  49. package/cjs/src/types.d.ts.map +1 -1
  50. package/cjs/src/types.js +23 -7
  51. package/cjs/src/types.js.map +1 -1
  52. package/dist/src/auth.d.ts.map +1 -1
  53. package/dist/src/embed/app.d.ts +26 -2
  54. package/dist/src/embed/app.d.ts.map +1 -1
  55. package/dist/src/embed/base.d.ts +10 -0
  56. package/dist/src/embed/base.d.ts.map +1 -1
  57. package/dist/src/embed/sage.d.ts +25 -2
  58. package/dist/src/embed/sage.d.ts.map +1 -1
  59. package/dist/src/embed/search-bar.d.ts +1 -1
  60. package/dist/src/embed/search-bar.d.ts.map +1 -1
  61. package/dist/src/embed/search.d.ts +8 -0
  62. package/dist/src/embed/search.d.ts.map +1 -1
  63. package/dist/src/embed/ts-embed.d.ts +3 -1
  64. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  65. package/dist/src/mixpanel-service.d.ts +1 -0
  66. package/dist/src/mixpanel-service.d.ts.map +1 -1
  67. package/dist/src/react/index.d.ts +14 -14
  68. package/dist/src/react/index.d.ts.map +1 -1
  69. package/dist/src/types.d.ts +43 -11
  70. package/dist/src/types.d.ts.map +1 -1
  71. package/dist/tsembed-react.es.js +154 -17309
  72. package/dist/tsembed-react.js +154 -17309
  73. package/dist/tsembed.es.js +175 -17322
  74. package/dist/tsembed.js +175 -17322
  75. package/dist/visual-embed-sdk-react-full.d.ts +351 -251
  76. package/dist/visual-embed-sdk-react.d.ts +351 -251
  77. package/dist/visual-embed-sdk.d.ts +116 -17
  78. package/lib/package.json +9 -1
  79. package/lib/src/.index.d.ts.swp +0 -0
  80. package/lib/src/auth.d.ts.map +1 -1
  81. package/lib/src/auth.js +4 -2
  82. package/lib/src/auth.js.map +1 -1
  83. package/lib/src/embed/app.d.ts +26 -2
  84. package/lib/src/embed/app.d.ts.map +1 -1
  85. package/lib/src/embed/app.js +4 -2
  86. package/lib/src/embed/app.js.map +1 -1
  87. package/lib/src/embed/app.spec.js +20 -0
  88. package/lib/src/embed/app.spec.js.map +1 -1
  89. package/lib/src/embed/base.d.ts +10 -0
  90. package/lib/src/embed/base.d.ts.map +1 -1
  91. package/lib/src/embed/base.js +12 -2
  92. package/lib/src/embed/base.js.map +1 -1
  93. package/lib/src/embed/sage.d.ts +25 -2
  94. package/lib/src/embed/sage.d.ts.map +1 -1
  95. package/lib/src/embed/sage.js +10 -5
  96. package/lib/src/embed/sage.js.map +1 -1
  97. package/lib/src/embed/sage.spec.js +26 -0
  98. package/lib/src/embed/sage.spec.js.map +1 -1
  99. package/lib/src/embed/search-bar.d.ts +1 -1
  100. package/lib/src/embed/search-bar.d.ts.map +1 -1
  101. package/lib/src/embed/search.d.ts +8 -0
  102. package/lib/src/embed/search.d.ts.map +1 -1
  103. package/lib/src/embed/search.js +2 -1
  104. package/lib/src/embed/search.js.map +1 -1
  105. package/lib/src/embed/search.spec.js +11 -1
  106. package/lib/src/embed/search.spec.js.map +1 -1
  107. package/lib/src/embed/ts-embed.d.ts +3 -1
  108. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  109. package/lib/src/embed/ts-embed.js +14 -6
  110. package/lib/src/embed/ts-embed.js.map +1 -1
  111. package/lib/src/embed/ts-embed.spec.js +4 -1
  112. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  113. package/lib/src/mixpanel-service.d.ts +1 -0
  114. package/lib/src/mixpanel-service.d.ts.map +1 -1
  115. package/lib/src/mixpanel-service.js +10 -3
  116. package/lib/src/mixpanel-service.js.map +1 -1
  117. package/lib/src/mixpanel-service.spec.js +12 -3
  118. package/lib/src/mixpanel-service.spec.js.map +1 -1
  119. package/lib/src/react/index.d.ts +14 -14
  120. package/lib/src/react/index.d.ts.map +1 -1
  121. package/lib/src/react/index.js +4 -2
  122. package/lib/src/react/index.js.map +1 -1
  123. package/lib/src/react/index.spec.js +2 -2
  124. package/lib/src/react/index.spec.js.map +1 -1
  125. package/lib/src/types.d.ts +43 -11
  126. package/lib/src/types.d.ts.map +1 -1
  127. package/lib/src/types.js +23 -7
  128. package/lib/src/types.js.map +1 -1
  129. package/lib/src/visual-embed-sdk.d.ts +116 -17
  130. package/package.json +9 -1
  131. package/src/auth.ts +7 -5
  132. package/src/embed/app.spec.ts +30 -0
  133. package/src/embed/app.ts +37 -9
  134. package/src/embed/base.ts +15 -5
  135. package/src/embed/sage.spec.ts +32 -0
  136. package/src/embed/sage.ts +38 -5
  137. package/src/embed/search-bar.tsx +1 -1
  138. package/src/embed/search.spec.ts +15 -1
  139. package/src/embed/search.ts +10 -0
  140. package/src/embed/ts-embed.spec.ts +11 -5
  141. package/src/embed/ts-embed.ts +18 -5
  142. package/src/mixpanel-service.spec.ts +12 -3
  143. package/src/mixpanel-service.ts +10 -3
  144. package/src/react/index.spec.tsx +5 -3
  145. package/src/react/index.tsx +35 -26
  146. package/src/types.ts +31 -12
@@ -21,7 +21,7 @@ interface SearchProps extends EmbedProps, SearchViewConfig {
21
21
  * }
22
22
  * ```
23
23
  */
24
- export const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<TsEmbed>>;
24
+ export const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<_SearchEmbed>>;
25
25
  interface AppProps extends EmbedProps, AppViewConfig {
26
26
  }
27
27
  /**
@@ -38,7 +38,7 @@ interface AppProps extends EmbedProps, AppViewConfig {
38
38
  * }
39
39
  * ```
40
40
  */
41
- export const AppEmbed: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<TsEmbed>>;
41
+ export const AppEmbed: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<_AppEmbed>>;
42
42
  interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
43
43
  }
44
44
  /**
@@ -56,8 +56,8 @@ interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
56
56
  * }
57
57
  * ```
58
58
  */
59
- export const LiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<TsEmbed>>;
60
- export const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<TsEmbed>>;
59
+ export const LiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
60
+ export const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
61
61
  interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
62
62
  }
63
63
  /**
@@ -73,7 +73,7 @@ interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
73
73
  * }
74
74
  * ```
75
75
  */
76
- export const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & React.RefAttributes<TsEmbed>>;
76
+ export const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & React.RefAttributes<_SearchBarEmbed>>;
77
77
  interface SageEmbedProps extends EmbedProps, SageViewConfig {
78
78
  }
79
79
  /**
@@ -89,7 +89,8 @@ interface SageEmbedProps extends EmbedProps, SageViewConfig {
89
89
  * }
90
90
  * ```
91
91
  */
92
- export const SageEmbed: React.ForwardRefExoticComponent<SageEmbedProps & React.RefAttributes<TsEmbed>>;
92
+ export const SageEmbed: React.ForwardRefExoticComponent<SageEmbedProps & React.RefAttributes<_SageEmbed>>;
93
+ type EmbedComponent = typeof SearchEmbed | typeof AppEmbed | typeof LiveboardEmbed | typeof SearchBarEmbed | typeof SageEmbed;
93
94
  /**
94
95
  * Get a reference to the embed component to trigger events on the component.
95
96
  *
@@ -105,9 +106,9 @@ export const SageEmbed: React.ForwardRefExoticComponent<SageEmbedProps & React.R
105
106
  * return <LiveboardEmbed ref={ref} liveboardId={<id>} />
106
107
  * }
107
108
  * ```
108
- * @returns {React.MutableRefObject<TsEmbed>} ref
109
+ * @returns {React.MutableRefObject<T extends TsEmbed>} ref
109
110
  */
110
- export const useEmbedRef: () => React.MutableRefObject<TsEmbed>;
111
+ export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<React.ComponentRef<T>>;
111
112
 
112
113
  /**
113
114
  * Copyright (c) 2023
@@ -123,7 +124,7 @@ export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getIni
123
124
  /**
124
125
  * @group Embed components
125
126
  */
126
- export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts'> {
127
+ export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts' | 'dataPanelV2'> {
127
128
  /**
128
129
  * The array of data source GUIDs to set on load.
129
130
  * Only a single dataSource supported currently.
@@ -168,6 +169,22 @@ export declare class SearchBarEmbed extends TsEmbed {
168
169
  * @summary TS Sage embed
169
170
  * @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
170
171
  */
172
+ /**
173
+ * Configuration for search options
174
+ */
175
+ export interface SearchOptions {
176
+ /**
177
+ * The tml string to load the answer
178
+ */
179
+ searchQuery: string;
180
+ /**
181
+ * Boolean to determine if the search should be executed or not.
182
+ * if it is executed, put the focus on the results.
183
+ * if it’s not executed, put the focus in the search bar - at the end of
184
+ * the tokens
185
+ */
186
+ executeSearch?: boolean;
187
+ }
171
188
  /**
172
189
  * The configuration attributes for the embedded Natural language search view. Based on
173
190
  * GPT and LLM.
@@ -177,7 +194,9 @@ export declare class SearchBarEmbed extends TsEmbed {
177
194
  */
178
195
  export interface SageViewConfig extends ViewConfig {
179
196
  /**
180
- * If set to true, object results are shown.
197
+ * If set to true, a list of liveboard and answers related
198
+ * to the natural language search will be shown below the
199
+ * AI generated answer.
181
200
  */
182
201
  showObjectResults?: boolean;
183
202
  /**
@@ -189,7 +208,8 @@ export interface SageViewConfig extends ViewConfig {
189
208
  */
190
209
  hideWorksheetSelector?: boolean;
191
210
  /**
192
- * If set to true, the object search suggestions are not shown
211
+ * If set to true, the search suggestions will contain existing
212
+ * liveboards and answers in addition with the autocomplete
193
213
  *
194
214
  */
195
215
  showObjectSuggestions?: boolean;
@@ -206,6 +226,10 @@ export interface SageViewConfig extends ViewConfig {
206
226
  * The data source GUID to set on load.
207
227
  */
208
228
  dataSource?: string;
229
+ /**
230
+ * Configuration for search options
231
+ */
232
+ searchOptions?: SearchOptions;
209
233
  }
210
234
  export declare const HiddenActionItemByDefaultForSageEmbed: Action[];
211
235
  /**
@@ -326,6 +350,14 @@ export interface SearchViewConfig extends ViewConfig {
326
350
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
327
351
  */
328
352
  hideSearchBar?: boolean;
353
+ /**
354
+ * Flag to control Data panel experience
355
+ *
356
+ * @default false
357
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
358
+ * @hidden
359
+ */
360
+ dataPanelV2?: boolean;
329
361
  }
330
362
  export declare const HiddenActionItemByDefaultForSearchEmbed: Action[];
331
363
  /**
@@ -387,7 +419,7 @@ export declare enum Page {
387
419
  /**
388
420
  * SpotIQ listing page
389
421
  */
390
- SpotIQ = "spotiq"
422
+ SpotIQ = "insights"
391
423
  }
392
424
  /**
393
425
  * The view configuration for full app embedding.
@@ -418,7 +450,16 @@ export interface AppViewConfig extends ViewConfig {
418
450
  /**
419
451
  * A URL path within the app that is to be embedded.
420
452
  * If both path and pageId attributes are defined, the path definition
421
- * takes precedence.
453
+ * takes precedence. This is the path post the `#/` in the URL of the standalone
454
+ * ThoughtSpot app.
455
+ *
456
+ * For eg, if you want the app to open to a particular liveboard
457
+ * you could set the path to `pinboard/1234/tab/8586`.
458
+ *
459
+ * @example
460
+ * ```
461
+ * <AppEmbed path="pinboard/1234/tab/7464" />
462
+ * ```
422
463
  */
423
464
  path?: string;
424
465
  /**
@@ -457,6 +498,21 @@ export interface AppViewConfig extends ViewConfig {
457
498
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
458
499
  */
459
500
  fullHeight?: boolean;
501
+ /**
502
+ * Flag to control Data panel experience
503
+ *
504
+ * @default false
505
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
506
+ * @hidden
507
+ */
508
+ dataPanelV2?: boolean;
509
+ /**
510
+ * Flag to control new Modular Home experience
511
+ *
512
+ * @default false
513
+ * @version SDK: 1.27.0 | Thoughtspot: 9.8.0.cl
514
+ */
515
+ modularHomeExperience?: boolean;
460
516
  }
461
517
  /**
462
518
  * Embeds full ThoughtSpot experience in a host application.
@@ -638,233 +694,6 @@ export declare class LiveboardEmbed extends V1Embed {
638
694
  export declare class PinboardEmbed extends LiveboardEmbed {
639
695
  }
640
696
 
641
- /**
642
- * Copyright (c) 2022
643
- *
644
- * Base classes
645
- *
646
- * @summary Base classes
647
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
648
- */
649
- /**
650
- * Global prefix for all Thoughtspot postHash Params.
651
- */
652
- export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
653
- /**
654
- * Base class for embedding v2 experience
655
- * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
656
- * React+GraphQL
657
- */
658
- export declare class TsEmbed {
659
- protected isAppInitialized: boolean;
660
- /**
661
- * A reference to the iframe within which the ThoughtSpot app
662
- * will be rendered.
663
- */
664
- protected iFrame: HTMLIFrameElement;
665
- protected viewConfig: ViewConfig;
666
- protected embedConfig: EmbedConfig;
667
- /**
668
- * The ThoughtSpot hostname or IP address
669
- */
670
- protected thoughtSpotHost: string;
671
- protected thoughtSpotV2Base: string;
672
- constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
673
- /**
674
- * Handles errors within the SDK
675
- *
676
- * @param error The error message or object
677
- */
678
- protected handleError(error: string | Record<string, unknown>): void;
679
- /**
680
- * Constructs the base URL string to load the ThoughtSpot app.
681
- *
682
- * @param query
683
- */
684
- protected getEmbedBasePath(query: string): string;
685
- /**
686
- * Common query params set for all the embed modes.
687
- *
688
- * @param queryParams
689
- * @returns queryParams
690
- */
691
- protected getBaseQueryParams(queryParams?: {}): {};
692
- /**
693
- * Constructs the base URL string to load v1 of the ThoughtSpot app.
694
- * This is used for embedding Liveboards, visualizations, and full application.
695
- *
696
- * @param queryString The query string to append to the URL.
697
- * @param isAppEmbed A Boolean parameter to specify if you are embedding
698
- * the full application.
699
- */
700
- protected getV1EmbedBasePath(queryString: string): string;
701
- protected getEmbedParams(): string;
702
- protected getRootIframeSrc(): string;
703
- protected createIframeEl(frameSrc: string): HTMLIFrameElement;
704
- /**
705
- * Renders the embedded ThoughtSpot app in an iframe and sets up
706
- * event listeners.
707
- *
708
- * @param url
709
- * @param frameOptions
710
- */
711
- protected renderIFrame(url: string): Promise<any>;
712
- protected insertIntoDOM(child: string | Node): void;
713
- /**
714
- * Sets the height of the iframe
715
- *
716
- * @param height The height in pixels
717
- */
718
- protected setIFrameHeight(height: number | string): void;
719
- /**
720
- * Executes all registered event handlers for a particular event type
721
- *
722
- * @param eventType The event type
723
- * @param data The payload invoked with the event handler
724
- * @param eventPort The event Port for a specific MessageChannel
725
- */
726
- protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
727
- /**
728
- * Returns the ThoughtSpot hostname or IP address.
729
- */
730
- protected getThoughtSpotHost(): string;
731
- /**
732
- * Gets the v1 event type (if applicable) for the EmbedEvent type
733
- *
734
- * @param eventType The v2 event type
735
- * @returns The corresponding v1 event type if one exists
736
- * or else the v2 event type itself
737
- */
738
- protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
739
- /**
740
- * Calculates the iframe center for the current visible viewPort
741
- * of iframe using Scroll position of Host App, offsetTop for iframe
742
- * in Host app. ViewPort height of the tab.
743
- *
744
- * @returns iframe Center in visible viewport,
745
- * Iframe height,
746
- * View port height.
747
- */
748
- protected getIframeCenter(): {
749
- iframeCenter: number;
750
- iframeScrolled: number;
751
- iframeHeight: number;
752
- viewPortHeight: number;
753
- iframeVisibleViewPort: number;
754
- };
755
- /**
756
- * Registers an event listener to trigger an alert when the ThoughtSpot app
757
- * sends an event of a particular message type to the host application.
758
- *
759
- * @param messageType The message type
760
- * @param callback A callback as a function
761
- * @param options The message options
762
- * @example
763
- * ```js
764
- * tsEmbed.on(EmbedEvent.Error, (data) => {
765
- * console.error(data);
766
- * });
767
- * ```
768
- * @example
769
- * ```js
770
- * tsEmbed.on(EmbedEvent.Save, (data) => {
771
- * console.log("Answer save clicked", data);
772
- * }, {
773
- * start: true // This will trigger the callback on start of save
774
- * });
775
- * ```
776
- */
777
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
778
- /**
779
- * Removes an event listener for a particular event type.
780
- *
781
- * @param messageType The message type
782
- * @param callback The callback to remove
783
- * @example
784
- * ```js
785
- * const errorHandler = (data) => { console.error(data); };
786
- * tsEmbed.on(EmbedEvent.Error, errorHandler);
787
- * tsEmbed.off(EmbedEvent.Error, errorHandler);
788
- * ```
789
- */
790
- off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
791
- /**
792
- * Triggers an event to the embedded app
793
- *
794
- * @param messageType The event type
795
- * @param data The payload to send with the message
796
- */
797
- trigger(messageType: HostEvent, data?: any): Promise<any>;
798
- /**
799
- * Marks the ThoughtSpot object to have been rendered
800
- * Needs to be overridden by subclasses to do the actual
801
- * rendering of the iframe.
802
- *
803
- * @param args
804
- */
805
- render(): TsEmbed;
806
- /**
807
- * Get the Post Url Params for THOUGHTSPOT from the current
808
- * host app URL.
809
- * THOUGHTSPOT URL params starts with a prefix "ts-"
810
- *
811
- * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
812
- */
813
- getThoughtSpotPostUrlParams(): string;
814
- /**
815
- * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
816
- *
817
- * @version SDK: 1.19.1 | ThoughtSpot: *
818
- */
819
- destroy(): void;
820
- getUnderlyingFrameElement(): HTMLIFrameElement;
821
- /**
822
- * Prerenders a generic instance of the TS component.
823
- * This means without the path but with the flags already applied.
824
- * This is useful for prerendering the component in the background.
825
- *
826
- * @version SDK: 1.22.0
827
- * @returns
828
- */
829
- prerenderGeneric(): Promise<any>;
830
- }
831
- /**
832
- * Base class for embedding v1 experience
833
- * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
834
- * which is currently under migration to v2
835
- *
836
- * @inheritdoc
837
- */
838
- export declare class V1Embed extends TsEmbed {
839
- protected viewConfig: ViewConfig;
840
- constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
841
- /**
842
- * Render the app in an iframe and set up event handlers
843
- *
844
- * @param iframeSrc
845
- */
846
- protected renderV1Embed(iframeSrc: string): any;
847
- protected getRootIframeSrc(): string;
848
- /**
849
- * @inheritdoc
850
- * @example
851
- * ```js
852
- * tsEmbed.on(EmbedEvent.Error, (data) => {
853
- * console.error(data);
854
- * });
855
- * ```
856
- * @example
857
- * ```js
858
- * tsEmbed.on(EmbedEvent.Save, (data) => {
859
- * console.log("Answer save clicked", data);
860
- * }, {
861
- * start: true // This will trigger the callback on start of save
862
- * });
863
- * ```
864
- */
865
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
866
- }
867
-
868
697
  export type EmbedEventHandlers = {
869
698
  [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
870
699
  };
@@ -969,7 +798,17 @@ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolea
969
798
  * @param fn The function being registered
970
799
  */
971
800
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
801
+ /**
802
+ * Imports TML representation of the metadata objects into ThoughtSpot.
803
+ * @param data
804
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
805
+ */
972
806
  export declare const executeTML: (data: executeTMLInput) => Promise<any>;
807
+ /**
808
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
809
+ * @param data
810
+ * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
811
+ */
973
812
  export declare const exportTML: (data: exportTMLInput) => Promise<any>;
974
813
  /**
975
814
  *
@@ -1413,6 +1252,9 @@ export interface CustomStyles {
1413
1252
  export interface CustomisationsInterface {
1414
1253
  style?: CustomStyles;
1415
1254
  content?: {
1255
+ /**
1256
+ * @version SDK: 1.26.0 | 9.7.0.cl
1257
+ */
1416
1258
  strings?: Record<string, any>;
1417
1259
  [key: string]: any;
1418
1260
  };
@@ -1820,21 +1662,21 @@ export interface ViewConfig {
1820
1662
  /**
1821
1663
  * Boolean to hide liveboard header
1822
1664
  *
1823
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1665
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1824
1666
  * @default false
1825
1667
  */
1826
1668
  hideLiveboardHeader?: boolean;
1827
1669
  /**
1828
1670
  * Boolean to show liveboard title
1829
1671
  *
1830
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1672
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1831
1673
  * @default false
1832
1674
  */
1833
1675
  showLiveboardTitle?: boolean;
1834
1676
  /**
1835
1677
  * Boolean to show liveboard description
1836
1678
  *
1837
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1679
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1838
1680
  * @default false
1839
1681
  */
1840
1682
  showLiveboardDescription?: boolean;
@@ -1852,7 +1694,7 @@ export interface ViewConfig {
1852
1694
  * 'f547ec54-2a37-4516-a222-2b06719af726']
1853
1695
  * });
1854
1696
  * ```
1855
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1697
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1856
1698
  */
1857
1699
  hiddenTabs?: string[];
1858
1700
  /**
@@ -1871,7 +1713,7 @@ export interface ViewConfig {
1871
1713
  * 'f547ec54-2a37-4516-a222-2b06719af726']
1872
1714
  * });
1873
1715
  * ```
1874
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
1716
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
1875
1717
  */
1876
1718
  visibleTabs?: string[];
1877
1719
  }
@@ -3109,6 +2951,19 @@ export declare enum HostEvent {
3109
2951
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
3110
2952
  */
3111
2953
  UpdateFilters = "updateFilters",
2954
+ /**
2955
+ * Get Tab for the current Liveboard.
2956
+ *
2957
+ * @example
2958
+ * ```js
2959
+ * liveboardEmbed.trigger(HostEvent.GetTabs).then((tabDetails) => {
2960
+ * console.log(
2961
+ * tabDetails // TabDetails of current LB
2962
+ * );
2963
+ * })
2964
+ * ```
2965
+ * @version SDK: 1.26.0 | ThoughtSpot: 9.7.0.cl
2966
+ */
3112
2967
  GetTabs = "getTabs",
3113
2968
  /**
3114
2969
  * Set the visible Tabs on a Liveboard.
@@ -3121,7 +2976,7 @@ export declare enum HostEvent {
3121
2976
  * '430496d6-6903-4601-937e-2c691821af3c',
3122
2977
  * 'f547ec54-2a37-4516-a222-2b06719af726'])
3123
2978
  * ```
3124
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
2979
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
3125
2980
  */
3126
2981
  SetVisibleTabs = "SetPinboardVisibleTabs",
3127
2982
  /**
@@ -3135,9 +2990,23 @@ export declare enum HostEvent {
3135
2990
  * '630496d6-6903-4601-937e-2c691821af3c',
3136
2991
  * 'i547ec54-2a37-4516-a222-2b06719af726'])
3137
2992
  * ```
3138
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
2993
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2994
+ */
2995
+ SetHiddenTabs = "SetPinboardHiddenTabs",
2996
+ /**
2997
+ * Updates the search query for sage embed.
2998
+ *
2999
+ * @param - searchOptions: an object queryString and option to execute the query.
3000
+ * @example
3001
+ * ```js
3002
+ * sageEmbed.trigger(HostEvent.UpdateSageQuery, {
3003
+ * queryString: 'revenue per year',
3004
+ * executeSearch: true,
3005
+ * })
3006
+ * ```
3007
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
3139
3008
  */
3140
- SetHiddenTabs = "SetPinboardHiddenTabs"
3009
+ UpdateSageQuery = "updateSageQuery"
3141
3010
  }
3142
3011
  /**
3143
3012
  * The different visual modes that the data sources panel within
@@ -3192,6 +3061,7 @@ export declare enum Param {
3192
3061
  DisableLoginRedirect = "disableLoginRedirect",
3193
3062
  visibleVizs = "pinboardVisibleVizs",
3194
3063
  LiveboardV2Enabled = "isPinboardV2Enabled",
3064
+ DataPanelV2Enabled = "enableDataPanelV2",
3195
3065
  ShowAlerts = "showAlerts",
3196
3066
  Locale = "locale",
3197
3067
  CustomStyle = "customStyle",
@@ -3219,8 +3089,9 @@ export declare enum Param {
3219
3089
  VisibleTabs = "visibleTabs",
3220
3090
  HideTabPanel = "hideTabPanel",
3221
3091
  HideSampleQuestions = "hideSampleQuestions",
3222
- WorksheetId = "worksheetId",
3223
- Query = "query,"
3092
+ WorksheetId = "worksheet",
3093
+ Query = "query",
3094
+ ModularHomeExperienceEnabled = "modularHomeExperience"
3224
3095
  }
3225
3096
  /**
3226
3097
  * ThoughtSpot application pages include actions and menu commands
@@ -4005,7 +3876,7 @@ export declare enum Action {
4005
3876
  */
4006
3877
  MarkAsVerified = "markAsVerified",
4007
3878
  /**
4008
- * @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
3879
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
4009
3880
  */
4010
3881
  AddTab = "addTab",
4011
3882
  /**
@@ -4361,3 +4232,232 @@ export interface CustomCssVariables {
4361
4232
  '--ts-var-dialog-footer-background'?: string;
4362
4233
  }
4363
4234
 
4235
+ /**
4236
+ * Copyright (c) 2022
4237
+ *
4238
+ * Base classes
4239
+ *
4240
+ * @summary Base classes
4241
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
4242
+ */
4243
+ /**
4244
+ * Global prefix for all Thoughtspot postHash Params.
4245
+ */
4246
+ export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
4247
+ /**
4248
+ * Base class for embedding v2 experience
4249
+ * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
4250
+ * React+GraphQL
4251
+ */
4252
+ export declare class TsEmbed {
4253
+ protected isAppInitialized: boolean;
4254
+ /**
4255
+ * A reference to the iframe within which the ThoughtSpot app
4256
+ * will be rendered.
4257
+ */
4258
+ protected iFrame: HTMLIFrameElement;
4259
+ protected viewConfig: ViewConfig;
4260
+ protected embedConfig: EmbedConfig;
4261
+ /**
4262
+ * The ThoughtSpot hostname or IP address
4263
+ */
4264
+ protected thoughtSpotHost: string;
4265
+ protected thoughtSpotV2Base: string;
4266
+ constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
4267
+ /**
4268
+ * Handles errors within the SDK
4269
+ *
4270
+ * @param error The error message or object
4271
+ */
4272
+ protected handleError(error: string | Record<string, unknown>): void;
4273
+ /**
4274
+ * Constructs the base URL string to load the ThoughtSpot app.
4275
+ *
4276
+ * @param query
4277
+ */
4278
+ protected getEmbedBasePath(query: string): string;
4279
+ /**
4280
+ * Common query params set for all the embed modes.
4281
+ *
4282
+ * @param queryParams
4283
+ * @returns queryParams
4284
+ */
4285
+ protected getBaseQueryParams(queryParams?: {}): {};
4286
+ /**
4287
+ * Constructs the base URL string to load v1 of the ThoughtSpot app.
4288
+ * This is used for embedding Liveboards, visualizations, and full application.
4289
+ *
4290
+ * @param queryString The query string to append to the URL.
4291
+ * @param isAppEmbed A Boolean parameter to specify if you are embedding
4292
+ * the full application.
4293
+ */
4294
+ protected getV1EmbedBasePath(queryString: string): string;
4295
+ protected getEmbedParams(): string;
4296
+ protected getRootIframeSrc(): string;
4297
+ protected createIframeEl(frameSrc: string): HTMLIFrameElement;
4298
+ /**
4299
+ * Renders the embedded ThoughtSpot app in an iframe and sets up
4300
+ * event listeners.
4301
+ *
4302
+ * @param url
4303
+ * @param frameOptions
4304
+ */
4305
+ protected renderIFrame(url: string): Promise<any>;
4306
+ protected insertIntoDOM(child: string | Node): void;
4307
+ /**
4308
+ * Sets the height of the iframe
4309
+ *
4310
+ * @param height The height in pixels
4311
+ */
4312
+ protected setIFrameHeight(height: number | string): void;
4313
+ /**
4314
+ * Executes all registered event handlers for a particular event type
4315
+ *
4316
+ * @param eventType The event type
4317
+ * @param data The payload invoked with the event handler
4318
+ * @param eventPort The event Port for a specific MessageChannel
4319
+ */
4320
+ protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
4321
+ /**
4322
+ * Returns the ThoughtSpot hostname or IP address.
4323
+ */
4324
+ protected getThoughtSpotHost(): string;
4325
+ /**
4326
+ * Gets the v1 event type (if applicable) for the EmbedEvent type
4327
+ *
4328
+ * @param eventType The v2 event type
4329
+ * @returns The corresponding v1 event type if one exists
4330
+ * or else the v2 event type itself
4331
+ */
4332
+ protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
4333
+ /**
4334
+ * Calculates the iframe center for the current visible viewPort
4335
+ * of iframe using Scroll position of Host App, offsetTop for iframe
4336
+ * in Host app. ViewPort height of the tab.
4337
+ *
4338
+ * @returns iframe Center in visible viewport,
4339
+ * Iframe height,
4340
+ * View port height.
4341
+ */
4342
+ protected getIframeCenter(): {
4343
+ iframeCenter: number;
4344
+ iframeScrolled: number;
4345
+ iframeHeight: number;
4346
+ viewPortHeight: number;
4347
+ iframeVisibleViewPort: number;
4348
+ };
4349
+ /**
4350
+ * Registers an event listener to trigger an alert when the ThoughtSpot app
4351
+ * sends an event of a particular message type to the host application.
4352
+ *
4353
+ * @param messageType The message type
4354
+ * @param callback A callback as a function
4355
+ * @param options The message options
4356
+ * @param isSelf
4357
+ * @param isRegisteredBySDK
4358
+ * @example
4359
+ * ```js
4360
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
4361
+ * console.error(data);
4362
+ * });
4363
+ * ```
4364
+ * @example
4365
+ * ```js
4366
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
4367
+ * console.log("Answer save clicked", data);
4368
+ * }, {
4369
+ * start: true // This will trigger the callback on start of save
4370
+ * });
4371
+ * ```
4372
+ */
4373
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions, isRegisteredBySDK?: boolean): typeof TsEmbed.prototype;
4374
+ /**
4375
+ * Removes an event listener for a particular event type.
4376
+ *
4377
+ * @param messageType The message type
4378
+ * @param callback The callback to remove
4379
+ * @example
4380
+ * ```js
4381
+ * const errorHandler = (data) => { console.error(data); };
4382
+ * tsEmbed.on(EmbedEvent.Error, errorHandler);
4383
+ * tsEmbed.off(EmbedEvent.Error, errorHandler);
4384
+ * ```
4385
+ */
4386
+ off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
4387
+ /**
4388
+ * Triggers an event to the embedded app
4389
+ *
4390
+ * @param messageType The event type
4391
+ * @param data The payload to send with the message
4392
+ */
4393
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
4394
+ /**
4395
+ * Marks the ThoughtSpot object to have been rendered
4396
+ * Needs to be overridden by subclasses to do the actual
4397
+ * rendering of the iframe.
4398
+ *
4399
+ * @param args
4400
+ */
4401
+ render(): TsEmbed;
4402
+ /**
4403
+ * Get the Post Url Params for THOUGHTSPOT from the current
4404
+ * host app URL.
4405
+ * THOUGHTSPOT URL params starts with a prefix "ts-"
4406
+ *
4407
+ * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
4408
+ */
4409
+ getThoughtSpotPostUrlParams(): string;
4410
+ /**
4411
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
4412
+ *
4413
+ * @version SDK: 1.19.1 | ThoughtSpot: *
4414
+ */
4415
+ destroy(): void;
4416
+ getUnderlyingFrameElement(): HTMLIFrameElement;
4417
+ /**
4418
+ * Prerenders a generic instance of the TS component.
4419
+ * This means without the path but with the flags already applied.
4420
+ * This is useful for prerendering the component in the background.
4421
+ *
4422
+ * @version SDK: 1.22.0
4423
+ * @returns
4424
+ */
4425
+ prerenderGeneric(): Promise<any>;
4426
+ }
4427
+ /**
4428
+ * Base class for embedding v1 experience
4429
+ * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
4430
+ * which is currently under migration to v2
4431
+ *
4432
+ * @inheritdoc
4433
+ */
4434
+ export declare class V1Embed extends TsEmbed {
4435
+ protected viewConfig: ViewConfig;
4436
+ constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
4437
+ /**
4438
+ * Render the app in an iframe and set up event handlers
4439
+ *
4440
+ * @param iframeSrc
4441
+ */
4442
+ protected renderV1Embed(iframeSrc: string): any;
4443
+ protected getRootIframeSrc(): string;
4444
+ /**
4445
+ * @inheritdoc
4446
+ * @example
4447
+ * ```js
4448
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
4449
+ * console.error(data);
4450
+ * });
4451
+ * ```
4452
+ * @example
4453
+ * ```js
4454
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
4455
+ * console.log("Answer save clicked", data);
4456
+ * }, {
4457
+ * start: true // This will trigger the callback on start of save
4458
+ * });
4459
+ * ```
4460
+ */
4461
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
4462
+ }
4463
+