@thoughtspot/visual-embed-sdk 1.23.1 → 1.23.3

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 (141) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +8 -7
  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 +8 -0
  7. package/cjs/src/embed/app.d.ts.map +1 -1
  8. package/cjs/src/embed/app.js +2 -1
  9. package/cjs/src/embed/app.js.map +1 -1
  10. package/cjs/src/embed/app.spec.js +10 -0
  11. package/cjs/src/embed/app.spec.js.map +1 -1
  12. package/cjs/src/embed/base.d.ts +2 -0
  13. package/cjs/src/embed/base.d.ts.map +1 -1
  14. package/cjs/src/embed/base.js +4 -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 +11 -4
  33. package/cjs/src/embed/ts-embed.js.map +1 -1
  34. package/cjs/src/mixpanel-service.d.ts +1 -0
  35. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  36. package/cjs/src/mixpanel-service.js +10 -3
  37. package/cjs/src/mixpanel-service.js.map +1 -1
  38. package/cjs/src/mixpanel-service.spec.js +12 -3
  39. package/cjs/src/mixpanel-service.spec.js.map +1 -1
  40. package/cjs/src/react/index.d.ts +14 -14
  41. package/cjs/src/react/index.d.ts.map +1 -1
  42. package/cjs/src/react/index.js +4 -2
  43. package/cjs/src/react/index.js.map +1 -1
  44. package/cjs/src/react/index.spec.js +1 -1
  45. package/cjs/src/react/index.spec.js.map +1 -1
  46. package/cjs/src/types.d.ts +18 -3
  47. package/cjs/src/types.d.ts.map +1 -1
  48. package/cjs/src/types.js +17 -2
  49. package/cjs/src/types.js.map +1 -1
  50. package/dist/src/auth.d.ts.map +1 -1
  51. package/dist/src/embed/app.d.ts +8 -0
  52. package/dist/src/embed/app.d.ts.map +1 -1
  53. package/dist/src/embed/base.d.ts +2 -0
  54. package/dist/src/embed/base.d.ts.map +1 -1
  55. package/dist/src/embed/sage.d.ts +25 -2
  56. package/dist/src/embed/sage.d.ts.map +1 -1
  57. package/dist/src/embed/search-bar.d.ts +1 -1
  58. package/dist/src/embed/search-bar.d.ts.map +1 -1
  59. package/dist/src/embed/search.d.ts +8 -0
  60. package/dist/src/embed/search.d.ts.map +1 -1
  61. package/dist/src/embed/ts-embed.d.ts +3 -1
  62. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  63. package/dist/src/mixpanel-service.d.ts +1 -0
  64. package/dist/src/mixpanel-service.d.ts.map +1 -1
  65. package/dist/src/react/index.d.ts +14 -14
  66. package/dist/src/react/index.d.ts.map +1 -1
  67. package/dist/src/types.d.ts +18 -3
  68. package/dist/src/types.d.ts.map +1 -1
  69. package/dist/tsembed-react.es.js +143 -17301
  70. package/dist/tsembed-react.js +143 -17301
  71. package/dist/tsembed.es.js +156 -17314
  72. package/dist/tsembed.js +156 -17314
  73. package/dist/visual-embed-sdk-react-full.d.ts +300 -241
  74. package/dist/visual-embed-sdk-react.d.ts +300 -241
  75. package/dist/visual-embed-sdk.d.ts +65 -7
  76. package/lib/package.json +8 -7
  77. package/lib/src/.index.d.ts.swp +0 -0
  78. package/lib/src/auth.d.ts.map +1 -1
  79. package/lib/src/auth.js +4 -2
  80. package/lib/src/auth.js.map +1 -1
  81. package/lib/src/embed/app.d.ts +8 -0
  82. package/lib/src/embed/app.d.ts.map +1 -1
  83. package/lib/src/embed/app.js +2 -1
  84. package/lib/src/embed/app.js.map +1 -1
  85. package/lib/src/embed/app.spec.js +10 -0
  86. package/lib/src/embed/app.spec.js.map +1 -1
  87. package/lib/src/embed/base.d.ts +2 -0
  88. package/lib/src/embed/base.d.ts.map +1 -1
  89. package/lib/src/embed/base.js +4 -2
  90. package/lib/src/embed/base.js.map +1 -1
  91. package/lib/src/embed/sage.d.ts +25 -2
  92. package/lib/src/embed/sage.d.ts.map +1 -1
  93. package/lib/src/embed/sage.js +10 -5
  94. package/lib/src/embed/sage.js.map +1 -1
  95. package/lib/src/embed/sage.spec.js +26 -0
  96. package/lib/src/embed/sage.spec.js.map +1 -1
  97. package/lib/src/embed/search-bar.d.ts +1 -1
  98. package/lib/src/embed/search-bar.d.ts.map +1 -1
  99. package/lib/src/embed/search.d.ts +8 -0
  100. package/lib/src/embed/search.d.ts.map +1 -1
  101. package/lib/src/embed/search.js +2 -1
  102. package/lib/src/embed/search.js.map +1 -1
  103. package/lib/src/embed/search.spec.js +11 -1
  104. package/lib/src/embed/search.spec.js.map +1 -1
  105. package/lib/src/embed/ts-embed.d.ts +3 -1
  106. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  107. package/lib/src/embed/ts-embed.js +11 -4
  108. package/lib/src/embed/ts-embed.js.map +1 -1
  109. package/lib/src/mixpanel-service.d.ts +1 -0
  110. package/lib/src/mixpanel-service.d.ts.map +1 -1
  111. package/lib/src/mixpanel-service.js +10 -3
  112. package/lib/src/mixpanel-service.js.map +1 -1
  113. package/lib/src/mixpanel-service.spec.js +12 -3
  114. package/lib/src/mixpanel-service.spec.js.map +1 -1
  115. package/lib/src/react/index.d.ts +14 -14
  116. package/lib/src/react/index.d.ts.map +1 -1
  117. package/lib/src/react/index.js +4 -2
  118. package/lib/src/react/index.js.map +1 -1
  119. package/lib/src/react/index.spec.js +2 -2
  120. package/lib/src/react/index.spec.js.map +1 -1
  121. package/lib/src/types.d.ts +18 -3
  122. package/lib/src/types.d.ts.map +1 -1
  123. package/lib/src/types.js +17 -2
  124. package/lib/src/types.js.map +1 -1
  125. package/lib/src/visual-embed-sdk.d.ts +65 -7
  126. package/package.json +8 -7
  127. package/src/auth.ts +7 -5
  128. package/src/embed/app.spec.ts +15 -0
  129. package/src/embed/app.ts +10 -0
  130. package/src/embed/base.ts +7 -5
  131. package/src/embed/sage.spec.ts +32 -0
  132. package/src/embed/sage.ts +38 -5
  133. package/src/embed/search-bar.tsx +1 -1
  134. package/src/embed/search.spec.ts +15 -1
  135. package/src/embed/search.ts +10 -0
  136. package/src/embed/ts-embed.ts +15 -3
  137. package/src/mixpanel-service.spec.ts +12 -3
  138. package/src/mixpanel-service.ts +10 -3
  139. package/src/react/index.spec.tsx +5 -3
  140. package/src/react/index.tsx +35 -26
  141. package/src/types.ts +17 -2
@@ -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
  /**
@@ -330,6 +354,14 @@ export interface SearchViewConfig extends ViewConfig {
330
354
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
331
355
  */
332
356
  hideSearchBar?: boolean;
357
+ /**
358
+ * Flag to control Data panel experience
359
+ *
360
+ * @default false
361
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
362
+ * @hidden
363
+ */
364
+ dataPanelV2?: boolean;
333
365
  }
334
366
  export declare const HiddenActionItemByDefaultForSearchEmbed: Action[];
335
367
  /**
@@ -461,6 +493,14 @@ export interface AppViewConfig extends ViewConfig {
461
493
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
462
494
  */
463
495
  fullHeight?: boolean;
496
+ /**
497
+ * Flag to control Data panel experience
498
+ *
499
+ * @default false
500
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
501
+ * @hidden
502
+ */
503
+ dataPanelV2?: boolean;
464
504
  }
465
505
  /**
466
506
  * Embeds full ThoughtSpot experience in a host application.
@@ -642,233 +682,6 @@ export declare class LiveboardEmbed extends V1Embed {
642
682
  export declare class PinboardEmbed extends LiveboardEmbed {
643
683
  }
644
684
 
645
- /**
646
- * Copyright (c) 2022
647
- *
648
- * Base classes
649
- *
650
- * @summary Base classes
651
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
652
- */
653
- /**
654
- * Global prefix for all Thoughtspot postHash Params.
655
- */
656
- export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
657
- /**
658
- * Base class for embedding v2 experience
659
- * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
660
- * React+GraphQL
661
- */
662
- export declare class TsEmbed {
663
- protected isAppInitialized: boolean;
664
- /**
665
- * A reference to the iframe within which the ThoughtSpot app
666
- * will be rendered.
667
- */
668
- protected iFrame: HTMLIFrameElement;
669
- protected viewConfig: ViewConfig;
670
- protected embedConfig: EmbedConfig;
671
- /**
672
- * The ThoughtSpot hostname or IP address
673
- */
674
- protected thoughtSpotHost: string;
675
- protected thoughtSpotV2Base: string;
676
- constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
677
- /**
678
- * Handles errors within the SDK
679
- *
680
- * @param error The error message or object
681
- */
682
- protected handleError(error: string | Record<string, unknown>): void;
683
- /**
684
- * Constructs the base URL string to load the ThoughtSpot app.
685
- *
686
- * @param query
687
- */
688
- protected getEmbedBasePath(query: string): string;
689
- /**
690
- * Common query params set for all the embed modes.
691
- *
692
- * @param queryParams
693
- * @returns queryParams
694
- */
695
- protected getBaseQueryParams(queryParams?: {}): {};
696
- /**
697
- * Constructs the base URL string to load v1 of the ThoughtSpot app.
698
- * This is used for embedding Liveboards, visualizations, and full application.
699
- *
700
- * @param queryString The query string to append to the URL.
701
- * @param isAppEmbed A Boolean parameter to specify if you are embedding
702
- * the full application.
703
- */
704
- protected getV1EmbedBasePath(queryString: string): string;
705
- protected getEmbedParams(): string;
706
- protected getRootIframeSrc(): string;
707
- protected createIframeEl(frameSrc: string): HTMLIFrameElement;
708
- /**
709
- * Renders the embedded ThoughtSpot app in an iframe and sets up
710
- * event listeners.
711
- *
712
- * @param url
713
- * @param frameOptions
714
- */
715
- protected renderIFrame(url: string): Promise<any>;
716
- protected insertIntoDOM(child: string | Node): void;
717
- /**
718
- * Sets the height of the iframe
719
- *
720
- * @param height The height in pixels
721
- */
722
- protected setIFrameHeight(height: number | string): void;
723
- /**
724
- * Executes all registered event handlers for a particular event type
725
- *
726
- * @param eventType The event type
727
- * @param data The payload invoked with the event handler
728
- * @param eventPort The event Port for a specific MessageChannel
729
- */
730
- protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
731
- /**
732
- * Returns the ThoughtSpot hostname or IP address.
733
- */
734
- protected getThoughtSpotHost(): string;
735
- /**
736
- * Gets the v1 event type (if applicable) for the EmbedEvent type
737
- *
738
- * @param eventType The v2 event type
739
- * @returns The corresponding v1 event type if one exists
740
- * or else the v2 event type itself
741
- */
742
- protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
743
- /**
744
- * Calculates the iframe center for the current visible viewPort
745
- * of iframe using Scroll position of Host App, offsetTop for iframe
746
- * in Host app. ViewPort height of the tab.
747
- *
748
- * @returns iframe Center in visible viewport,
749
- * Iframe height,
750
- * View port height.
751
- */
752
- protected getIframeCenter(): {
753
- iframeCenter: number;
754
- iframeScrolled: number;
755
- iframeHeight: number;
756
- viewPortHeight: number;
757
- iframeVisibleViewPort: number;
758
- };
759
- /**
760
- * Registers an event listener to trigger an alert when the ThoughtSpot app
761
- * sends an event of a particular message type to the host application.
762
- *
763
- * @param messageType The message type
764
- * @param callback A callback as a function
765
- * @param options The message options
766
- * @example
767
- * ```js
768
- * tsEmbed.on(EmbedEvent.Error, (data) => {
769
- * console.error(data);
770
- * });
771
- * ```
772
- * @example
773
- * ```js
774
- * tsEmbed.on(EmbedEvent.Save, (data) => {
775
- * console.log("Answer save clicked", data);
776
- * }, {
777
- * start: true // This will trigger the callback on start of save
778
- * });
779
- * ```
780
- */
781
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
782
- /**
783
- * Removes an event listener for a particular event type.
784
- *
785
- * @param messageType The message type
786
- * @param callback The callback to remove
787
- * @example
788
- * ```js
789
- * const errorHandler = (data) => { console.error(data); };
790
- * tsEmbed.on(EmbedEvent.Error, errorHandler);
791
- * tsEmbed.off(EmbedEvent.Error, errorHandler);
792
- * ```
793
- */
794
- off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
795
- /**
796
- * Triggers an event to the embedded app
797
- *
798
- * @param messageType The event type
799
- * @param data The payload to send with the message
800
- */
801
- trigger(messageType: HostEvent, data?: any): Promise<any>;
802
- /**
803
- * Marks the ThoughtSpot object to have been rendered
804
- * Needs to be overridden by subclasses to do the actual
805
- * rendering of the iframe.
806
- *
807
- * @param args
808
- */
809
- render(): TsEmbed;
810
- /**
811
- * Get the Post Url Params for THOUGHTSPOT from the current
812
- * host app URL.
813
- * THOUGHTSPOT URL params starts with a prefix "ts-"
814
- *
815
- * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
816
- */
817
- getThoughtSpotPostUrlParams(): string;
818
- /**
819
- * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
820
- *
821
- * @version SDK: 1.19.1 | ThoughtSpot: *
822
- */
823
- destroy(): void;
824
- getUnderlyingFrameElement(): HTMLIFrameElement;
825
- /**
826
- * Prerenders a generic instance of the TS component.
827
- * This means without the path but with the flags already applied.
828
- * This is useful for prerendering the component in the background.
829
- *
830
- * @version SDK: 1.22.0
831
- * @returns
832
- */
833
- prerenderGeneric(): Promise<any>;
834
- }
835
- /**
836
- * Base class for embedding v1 experience
837
- * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
838
- * which is currently under migration to v2
839
- *
840
- * @inheritdoc
841
- */
842
- export declare class V1Embed extends TsEmbed {
843
- protected viewConfig: ViewConfig;
844
- constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
845
- /**
846
- * Render the app in an iframe and set up event handlers
847
- *
848
- * @param iframeSrc
849
- */
850
- protected renderV1Embed(iframeSrc: string): any;
851
- protected getRootIframeSrc(): string;
852
- /**
853
- * @inheritdoc
854
- * @example
855
- * ```js
856
- * tsEmbed.on(EmbedEvent.Error, (data) => {
857
- * console.error(data);
858
- * });
859
- * ```
860
- * @example
861
- * ```js
862
- * tsEmbed.on(EmbedEvent.Save, (data) => {
863
- * console.log("Answer save clicked", data);
864
- * }, {
865
- * start: true // This will trigger the callback on start of save
866
- * });
867
- * ```
868
- */
869
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
870
- }
871
-
872
685
  export type EmbedEventHandlers = {
873
686
  [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
874
687
  };
@@ -974,11 +787,13 @@ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolea
974
787
  */
975
788
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
976
789
  /**
790
+ * Imports TML representation of the metadata objects into ThoughtSpot.
977
791
  * @param data
978
792
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
979
793
  */
980
794
  export declare const executeTML: (data: executeTMLInput) => Promise<any>;
981
795
  /**
796
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
982
797
  * @param data
983
798
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
984
799
  */
@@ -3165,7 +2980,21 @@ export declare enum HostEvent {
3165
2980
  * ```
3166
2981
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
3167
2982
  */
3168
- SetHiddenTabs = "SetPinboardHiddenTabs"
2983
+ SetHiddenTabs = "SetPinboardHiddenTabs",
2984
+ /**
2985
+ * Updates the search query for sage embed.
2986
+ *
2987
+ * @param - searchOptions: an object queryString and option to execute the query.
2988
+ * @example
2989
+ * ```js
2990
+ * sageEmbed.trigger(HostEvent.UpdateSageQuery, {
2991
+ * queryString: 'revenue per year',
2992
+ * executeSearch: true,
2993
+ * })
2994
+ * ```
2995
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2996
+ */
2997
+ UpdateSageQuery = "updateSageQuery"
3169
2998
  }
3170
2999
  /**
3171
3000
  * The different visual modes that the data sources panel within
@@ -3220,6 +3049,7 @@ export declare enum Param {
3220
3049
  DisableLoginRedirect = "disableLoginRedirect",
3221
3050
  visibleVizs = "pinboardVisibleVizs",
3222
3051
  LiveboardV2Enabled = "isPinboardV2Enabled",
3052
+ DataPanelV2Enabled = "enableDataPanelV2",
3223
3053
  ShowAlerts = "showAlerts",
3224
3054
  Locale = "locale",
3225
3055
  CustomStyle = "customStyle",
@@ -3247,8 +3077,8 @@ export declare enum Param {
3247
3077
  VisibleTabs = "visibleTabs",
3248
3078
  HideTabPanel = "hideTabPanel",
3249
3079
  HideSampleQuestions = "hideSampleQuestions",
3250
- WorksheetId = "worksheetId",
3251
- Query = "query,"
3080
+ WorksheetId = "worksheet",
3081
+ Query = "query"
3252
3082
  }
3253
3083
  /**
3254
3084
  * ThoughtSpot application pages include actions and menu commands
@@ -4389,3 +4219,232 @@ export interface CustomCssVariables {
4389
4219
  '--ts-var-dialog-footer-background'?: string;
4390
4220
  }
4391
4221
 
4222
+ /**
4223
+ * Copyright (c) 2022
4224
+ *
4225
+ * Base classes
4226
+ *
4227
+ * @summary Base classes
4228
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
4229
+ */
4230
+ /**
4231
+ * Global prefix for all Thoughtspot postHash Params.
4232
+ */
4233
+ export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
4234
+ /**
4235
+ * Base class for embedding v2 experience
4236
+ * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
4237
+ * React+GraphQL
4238
+ */
4239
+ export declare class TsEmbed {
4240
+ protected isAppInitialized: boolean;
4241
+ /**
4242
+ * A reference to the iframe within which the ThoughtSpot app
4243
+ * will be rendered.
4244
+ */
4245
+ protected iFrame: HTMLIFrameElement;
4246
+ protected viewConfig: ViewConfig;
4247
+ protected embedConfig: EmbedConfig;
4248
+ /**
4249
+ * The ThoughtSpot hostname or IP address
4250
+ */
4251
+ protected thoughtSpotHost: string;
4252
+ protected thoughtSpotV2Base: string;
4253
+ constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
4254
+ /**
4255
+ * Handles errors within the SDK
4256
+ *
4257
+ * @param error The error message or object
4258
+ */
4259
+ protected handleError(error: string | Record<string, unknown>): void;
4260
+ /**
4261
+ * Constructs the base URL string to load the ThoughtSpot app.
4262
+ *
4263
+ * @param query
4264
+ */
4265
+ protected getEmbedBasePath(query: string): string;
4266
+ /**
4267
+ * Common query params set for all the embed modes.
4268
+ *
4269
+ * @param queryParams
4270
+ * @returns queryParams
4271
+ */
4272
+ protected getBaseQueryParams(queryParams?: {}): {};
4273
+ /**
4274
+ * Constructs the base URL string to load v1 of the ThoughtSpot app.
4275
+ * This is used for embedding Liveboards, visualizations, and full application.
4276
+ *
4277
+ * @param queryString The query string to append to the URL.
4278
+ * @param isAppEmbed A Boolean parameter to specify if you are embedding
4279
+ * the full application.
4280
+ */
4281
+ protected getV1EmbedBasePath(queryString: string): string;
4282
+ protected getEmbedParams(): string;
4283
+ protected getRootIframeSrc(): string;
4284
+ protected createIframeEl(frameSrc: string): HTMLIFrameElement;
4285
+ /**
4286
+ * Renders the embedded ThoughtSpot app in an iframe and sets up
4287
+ * event listeners.
4288
+ *
4289
+ * @param url
4290
+ * @param frameOptions
4291
+ */
4292
+ protected renderIFrame(url: string): Promise<any>;
4293
+ protected insertIntoDOM(child: string | Node): void;
4294
+ /**
4295
+ * Sets the height of the iframe
4296
+ *
4297
+ * @param height The height in pixels
4298
+ */
4299
+ protected setIFrameHeight(height: number | string): void;
4300
+ /**
4301
+ * Executes all registered event handlers for a particular event type
4302
+ *
4303
+ * @param eventType The event type
4304
+ * @param data The payload invoked with the event handler
4305
+ * @param eventPort The event Port for a specific MessageChannel
4306
+ */
4307
+ protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
4308
+ /**
4309
+ * Returns the ThoughtSpot hostname or IP address.
4310
+ */
4311
+ protected getThoughtSpotHost(): string;
4312
+ /**
4313
+ * Gets the v1 event type (if applicable) for the EmbedEvent type
4314
+ *
4315
+ * @param eventType The v2 event type
4316
+ * @returns The corresponding v1 event type if one exists
4317
+ * or else the v2 event type itself
4318
+ */
4319
+ protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
4320
+ /**
4321
+ * Calculates the iframe center for the current visible viewPort
4322
+ * of iframe using Scroll position of Host App, offsetTop for iframe
4323
+ * in Host app. ViewPort height of the tab.
4324
+ *
4325
+ * @returns iframe Center in visible viewport,
4326
+ * Iframe height,
4327
+ * View port height.
4328
+ */
4329
+ protected getIframeCenter(): {
4330
+ iframeCenter: number;
4331
+ iframeScrolled: number;
4332
+ iframeHeight: number;
4333
+ viewPortHeight: number;
4334
+ iframeVisibleViewPort: number;
4335
+ };
4336
+ /**
4337
+ * Registers an event listener to trigger an alert when the ThoughtSpot app
4338
+ * sends an event of a particular message type to the host application.
4339
+ *
4340
+ * @param messageType The message type
4341
+ * @param callback A callback as a function
4342
+ * @param options The message options
4343
+ * @param isSelf
4344
+ * @param isRegisteredBySDK
4345
+ * @example
4346
+ * ```js
4347
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
4348
+ * console.error(data);
4349
+ * });
4350
+ * ```
4351
+ * @example
4352
+ * ```js
4353
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
4354
+ * console.log("Answer save clicked", data);
4355
+ * }, {
4356
+ * start: true // This will trigger the callback on start of save
4357
+ * });
4358
+ * ```
4359
+ */
4360
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions, isRegisteredBySDK?: boolean): typeof TsEmbed.prototype;
4361
+ /**
4362
+ * Removes an event listener for a particular event type.
4363
+ *
4364
+ * @param messageType The message type
4365
+ * @param callback The callback to remove
4366
+ * @example
4367
+ * ```js
4368
+ * const errorHandler = (data) => { console.error(data); };
4369
+ * tsEmbed.on(EmbedEvent.Error, errorHandler);
4370
+ * tsEmbed.off(EmbedEvent.Error, errorHandler);
4371
+ * ```
4372
+ */
4373
+ off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
4374
+ /**
4375
+ * Triggers an event to the embedded app
4376
+ *
4377
+ * @param messageType The event type
4378
+ * @param data The payload to send with the message
4379
+ */
4380
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
4381
+ /**
4382
+ * Marks the ThoughtSpot object to have been rendered
4383
+ * Needs to be overridden by subclasses to do the actual
4384
+ * rendering of the iframe.
4385
+ *
4386
+ * @param args
4387
+ */
4388
+ render(): TsEmbed;
4389
+ /**
4390
+ * Get the Post Url Params for THOUGHTSPOT from the current
4391
+ * host app URL.
4392
+ * THOUGHTSPOT URL params starts with a prefix "ts-"
4393
+ *
4394
+ * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
4395
+ */
4396
+ getThoughtSpotPostUrlParams(): string;
4397
+ /**
4398
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
4399
+ *
4400
+ * @version SDK: 1.19.1 | ThoughtSpot: *
4401
+ */
4402
+ destroy(): void;
4403
+ getUnderlyingFrameElement(): HTMLIFrameElement;
4404
+ /**
4405
+ * Prerenders a generic instance of the TS component.
4406
+ * This means without the path but with the flags already applied.
4407
+ * This is useful for prerendering the component in the background.
4408
+ *
4409
+ * @version SDK: 1.22.0
4410
+ * @returns
4411
+ */
4412
+ prerenderGeneric(): Promise<any>;
4413
+ }
4414
+ /**
4415
+ * Base class for embedding v1 experience
4416
+ * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
4417
+ * which is currently under migration to v2
4418
+ *
4419
+ * @inheritdoc
4420
+ */
4421
+ export declare class V1Embed extends TsEmbed {
4422
+ protected viewConfig: ViewConfig;
4423
+ constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
4424
+ /**
4425
+ * Render the app in an iframe and set up event handlers
4426
+ *
4427
+ * @param iframeSrc
4428
+ */
4429
+ protected renderV1Embed(iframeSrc: string): any;
4430
+ protected getRootIframeSrc(): string;
4431
+ /**
4432
+ * @inheritdoc
4433
+ * @example
4434
+ * ```js
4435
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
4436
+ * console.error(data);
4437
+ * });
4438
+ * ```
4439
+ * @example
4440
+ * ```js
4441
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
4442
+ * console.log("Answer save clicked", data);
4443
+ * }, {
4444
+ * start: true // This will trigger the callback on start of save
4445
+ * });
4446
+ * ```
4447
+ */
4448
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
4449
+ }
4450
+