@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,14 +106,14 @@ 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
  * @group Embed components
114
115
  */
115
- export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts'> {
116
+ export interface SearchBarViewConfig extends Omit<ViewConfig, 'runtimeFilters' | 'showAlerts' | 'dataPanelV2'> {
116
117
  /**
117
118
  * The array of data source GUIDs to set on load.
118
119
  * Only a single dataSource supported currently.
@@ -157,6 +158,22 @@ export declare class SearchBarEmbed extends TsEmbed {
157
158
  * @summary TS Sage embed
158
159
  * @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
159
160
  */
161
+ /**
162
+ * Configuration for search options
163
+ */
164
+ export interface SearchOptions {
165
+ /**
166
+ * The tml string to load the answer
167
+ */
168
+ searchQuery: string;
169
+ /**
170
+ * Boolean to determine if the search should be executed or not.
171
+ * if it is executed, put the focus on the results.
172
+ * if it’s not executed, put the focus in the search bar - at the end of
173
+ * the tokens
174
+ */
175
+ executeSearch?: boolean;
176
+ }
160
177
  /**
161
178
  * The configuration attributes for the embedded Natural language search view. Based on
162
179
  * GPT and LLM.
@@ -166,7 +183,9 @@ export declare class SearchBarEmbed extends TsEmbed {
166
183
  */
167
184
  export interface SageViewConfig extends ViewConfig {
168
185
  /**
169
- * If set to true, object results are shown.
186
+ * If set to true, a list of liveboard and answers related
187
+ * to the natural language search will be shown below the
188
+ * AI generated answer.
170
189
  */
171
190
  showObjectResults?: boolean;
172
191
  /**
@@ -178,7 +197,8 @@ export interface SageViewConfig extends ViewConfig {
178
197
  */
179
198
  hideWorksheetSelector?: boolean;
180
199
  /**
181
- * If set to true, the object search suggestions are not shown
200
+ * If set to true, the search suggestions will contain existing
201
+ * liveboards and answers in addition with the autocomplete
182
202
  *
183
203
  */
184
204
  showObjectSuggestions?: boolean;
@@ -195,6 +215,10 @@ export interface SageViewConfig extends ViewConfig {
195
215
  * The data source GUID to set on load.
196
216
  */
197
217
  dataSource?: string;
218
+ /**
219
+ * Configuration for search options
220
+ */
221
+ searchOptions?: SearchOptions;
198
222
  }
199
223
  export declare const HiddenActionItemByDefaultForSageEmbed: Action[];
200
224
  /**
@@ -319,6 +343,14 @@ export interface SearchViewConfig extends ViewConfig {
319
343
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
320
344
  */
321
345
  hideSearchBar?: boolean;
346
+ /**
347
+ * Flag to control Data panel experience
348
+ *
349
+ * @default false
350
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
351
+ * @hidden
352
+ */
353
+ dataPanelV2?: boolean;
322
354
  }
323
355
  export declare const HiddenActionItemByDefaultForSearchEmbed: Action[];
324
356
  /**
@@ -450,6 +482,14 @@ export interface AppViewConfig extends ViewConfig {
450
482
  * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
451
483
  */
452
484
  fullHeight?: boolean;
485
+ /**
486
+ * Flag to control Data panel experience
487
+ *
488
+ * @default false
489
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
490
+ * @hidden
491
+ */
492
+ dataPanelV2?: boolean;
453
493
  }
454
494
  /**
455
495
  * Embeds full ThoughtSpot experience in a host application.
@@ -631,233 +671,6 @@ export declare class LiveboardEmbed extends V1Embed {
631
671
  export declare class PinboardEmbed extends LiveboardEmbed {
632
672
  }
633
673
 
634
- /**
635
- * Copyright (c) 2022
636
- *
637
- * Base classes
638
- *
639
- * @summary Base classes
640
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
641
- */
642
- /**
643
- * Global prefix for all Thoughtspot postHash Params.
644
- */
645
- export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
646
- /**
647
- * Base class for embedding v2 experience
648
- * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
649
- * React+GraphQL
650
- */
651
- export declare class TsEmbed {
652
- protected isAppInitialized: boolean;
653
- /**
654
- * A reference to the iframe within which the ThoughtSpot app
655
- * will be rendered.
656
- */
657
- protected iFrame: HTMLIFrameElement;
658
- protected viewConfig: ViewConfig;
659
- protected embedConfig: EmbedConfig;
660
- /**
661
- * The ThoughtSpot hostname or IP address
662
- */
663
- protected thoughtSpotHost: string;
664
- protected thoughtSpotV2Base: string;
665
- constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
666
- /**
667
- * Handles errors within the SDK
668
- *
669
- * @param error The error message or object
670
- */
671
- protected handleError(error: string | Record<string, unknown>): void;
672
- /**
673
- * Constructs the base URL string to load the ThoughtSpot app.
674
- *
675
- * @param query
676
- */
677
- protected getEmbedBasePath(query: string): string;
678
- /**
679
- * Common query params set for all the embed modes.
680
- *
681
- * @param queryParams
682
- * @returns queryParams
683
- */
684
- protected getBaseQueryParams(queryParams?: {}): {};
685
- /**
686
- * Constructs the base URL string to load v1 of the ThoughtSpot app.
687
- * This is used for embedding Liveboards, visualizations, and full application.
688
- *
689
- * @param queryString The query string to append to the URL.
690
- * @param isAppEmbed A Boolean parameter to specify if you are embedding
691
- * the full application.
692
- */
693
- protected getV1EmbedBasePath(queryString: string): string;
694
- protected getEmbedParams(): string;
695
- protected getRootIframeSrc(): string;
696
- protected createIframeEl(frameSrc: string): HTMLIFrameElement;
697
- /**
698
- * Renders the embedded ThoughtSpot app in an iframe and sets up
699
- * event listeners.
700
- *
701
- * @param url
702
- * @param frameOptions
703
- */
704
- protected renderIFrame(url: string): Promise<any>;
705
- protected insertIntoDOM(child: string | Node): void;
706
- /**
707
- * Sets the height of the iframe
708
- *
709
- * @param height The height in pixels
710
- */
711
- protected setIFrameHeight(height: number | string): void;
712
- /**
713
- * Executes all registered event handlers for a particular event type
714
- *
715
- * @param eventType The event type
716
- * @param data The payload invoked with the event handler
717
- * @param eventPort The event Port for a specific MessageChannel
718
- */
719
- protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
720
- /**
721
- * Returns the ThoughtSpot hostname or IP address.
722
- */
723
- protected getThoughtSpotHost(): string;
724
- /**
725
- * Gets the v1 event type (if applicable) for the EmbedEvent type
726
- *
727
- * @param eventType The v2 event type
728
- * @returns The corresponding v1 event type if one exists
729
- * or else the v2 event type itself
730
- */
731
- protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
732
- /**
733
- * Calculates the iframe center for the current visible viewPort
734
- * of iframe using Scroll position of Host App, offsetTop for iframe
735
- * in Host app. ViewPort height of the tab.
736
- *
737
- * @returns iframe Center in visible viewport,
738
- * Iframe height,
739
- * View port height.
740
- */
741
- protected getIframeCenter(): {
742
- iframeCenter: number;
743
- iframeScrolled: number;
744
- iframeHeight: number;
745
- viewPortHeight: number;
746
- iframeVisibleViewPort: number;
747
- };
748
- /**
749
- * Registers an event listener to trigger an alert when the ThoughtSpot app
750
- * sends an event of a particular message type to the host application.
751
- *
752
- * @param messageType The message type
753
- * @param callback A callback as a function
754
- * @param options The message options
755
- * @example
756
- * ```js
757
- * tsEmbed.on(EmbedEvent.Error, (data) => {
758
- * console.error(data);
759
- * });
760
- * ```
761
- * @example
762
- * ```js
763
- * tsEmbed.on(EmbedEvent.Save, (data) => {
764
- * console.log("Answer save clicked", data);
765
- * }, {
766
- * start: true // This will trigger the callback on start of save
767
- * });
768
- * ```
769
- */
770
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
771
- /**
772
- * Removes an event listener for a particular event type.
773
- *
774
- * @param messageType The message type
775
- * @param callback The callback to remove
776
- * @example
777
- * ```js
778
- * const errorHandler = (data) => { console.error(data); };
779
- * tsEmbed.on(EmbedEvent.Error, errorHandler);
780
- * tsEmbed.off(EmbedEvent.Error, errorHandler);
781
- * ```
782
- */
783
- off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
784
- /**
785
- * Triggers an event to the embedded app
786
- *
787
- * @param messageType The event type
788
- * @param data The payload to send with the message
789
- */
790
- trigger(messageType: HostEvent, data?: any): Promise<any>;
791
- /**
792
- * Marks the ThoughtSpot object to have been rendered
793
- * Needs to be overridden by subclasses to do the actual
794
- * rendering of the iframe.
795
- *
796
- * @param args
797
- */
798
- render(): TsEmbed;
799
- /**
800
- * Get the Post Url Params for THOUGHTSPOT from the current
801
- * host app URL.
802
- * THOUGHTSPOT URL params starts with a prefix "ts-"
803
- *
804
- * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
805
- */
806
- getThoughtSpotPostUrlParams(): string;
807
- /**
808
- * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
809
- *
810
- * @version SDK: 1.19.1 | ThoughtSpot: *
811
- */
812
- destroy(): void;
813
- getUnderlyingFrameElement(): HTMLIFrameElement;
814
- /**
815
- * Prerenders a generic instance of the TS component.
816
- * This means without the path but with the flags already applied.
817
- * This is useful for prerendering the component in the background.
818
- *
819
- * @version SDK: 1.22.0
820
- * @returns
821
- */
822
- prerenderGeneric(): Promise<any>;
823
- }
824
- /**
825
- * Base class for embedding v1 experience
826
- * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
827
- * which is currently under migration to v2
828
- *
829
- * @inheritdoc
830
- */
831
- export declare class V1Embed extends TsEmbed {
832
- protected viewConfig: ViewConfig;
833
- constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
834
- /**
835
- * Render the app in an iframe and set up event handlers
836
- *
837
- * @param iframeSrc
838
- */
839
- protected renderV1Embed(iframeSrc: string): any;
840
- protected getRootIframeSrc(): string;
841
- /**
842
- * @inheritdoc
843
- * @example
844
- * ```js
845
- * tsEmbed.on(EmbedEvent.Error, (data) => {
846
- * console.error(data);
847
- * });
848
- * ```
849
- * @example
850
- * ```js
851
- * tsEmbed.on(EmbedEvent.Save, (data) => {
852
- * console.log("Answer save clicked", data);
853
- * }, {
854
- * start: true // This will trigger the callback on start of save
855
- * });
856
- * ```
857
- */
858
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
859
- }
860
-
861
674
  export type EmbedEventHandlers = {
862
675
  [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
863
676
  };
@@ -2881,7 +2694,21 @@ export declare enum HostEvent {
2881
2694
  * ```
2882
2695
  * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2883
2696
  */
2884
- SetHiddenTabs = "SetPinboardHiddenTabs"
2697
+ SetHiddenTabs = "SetPinboardHiddenTabs",
2698
+ /**
2699
+ * Updates the search query for sage embed.
2700
+ *
2701
+ * @param - searchOptions: an object queryString and option to execute the query.
2702
+ * @example
2703
+ * ```js
2704
+ * sageEmbed.trigger(HostEvent.UpdateSageQuery, {
2705
+ * queryString: 'revenue per year',
2706
+ * executeSearch: true,
2707
+ * })
2708
+ * ```
2709
+ * @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
2710
+ */
2711
+ UpdateSageQuery = "updateSageQuery"
2885
2712
  }
2886
2713
  /**
2887
2714
  * The different visual modes that the data sources panel within
@@ -2936,6 +2763,7 @@ export declare enum Param {
2936
2763
  DisableLoginRedirect = "disableLoginRedirect",
2937
2764
  visibleVizs = "pinboardVisibleVizs",
2938
2765
  LiveboardV2Enabled = "isPinboardV2Enabled",
2766
+ DataPanelV2Enabled = "enableDataPanelV2",
2939
2767
  ShowAlerts = "showAlerts",
2940
2768
  Locale = "locale",
2941
2769
  CustomStyle = "customStyle",
@@ -2963,8 +2791,8 @@ export declare enum Param {
2963
2791
  VisibleTabs = "visibleTabs",
2964
2792
  HideTabPanel = "hideTabPanel",
2965
2793
  HideSampleQuestions = "hideSampleQuestions",
2966
- WorksheetId = "worksheetId",
2967
- Query = "query,"
2794
+ WorksheetId = "worksheet",
2795
+ Query = "query"
2968
2796
  }
2969
2797
  /**
2970
2798
  * ThoughtSpot application pages include actions and menu commands
@@ -3802,6 +3630,235 @@ export declare enum ContextMenuTriggerOptions {
3802
3630
  RIGHT_CLICK = "right-click"
3803
3631
  }
3804
3632
 
3633
+ /**
3634
+ * Copyright (c) 2022
3635
+ *
3636
+ * Base classes
3637
+ *
3638
+ * @summary Base classes
3639
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
3640
+ */
3641
+ /**
3642
+ * Global prefix for all Thoughtspot postHash Params.
3643
+ */
3644
+ export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
3645
+ /**
3646
+ * Base class for embedding v2 experience
3647
+ * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
3648
+ * React+GraphQL
3649
+ */
3650
+ export declare class TsEmbed {
3651
+ protected isAppInitialized: boolean;
3652
+ /**
3653
+ * A reference to the iframe within which the ThoughtSpot app
3654
+ * will be rendered.
3655
+ */
3656
+ protected iFrame: HTMLIFrameElement;
3657
+ protected viewConfig: ViewConfig;
3658
+ protected embedConfig: EmbedConfig;
3659
+ /**
3660
+ * The ThoughtSpot hostname or IP address
3661
+ */
3662
+ protected thoughtSpotHost: string;
3663
+ protected thoughtSpotV2Base: string;
3664
+ constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
3665
+ /**
3666
+ * Handles errors within the SDK
3667
+ *
3668
+ * @param error The error message or object
3669
+ */
3670
+ protected handleError(error: string | Record<string, unknown>): void;
3671
+ /**
3672
+ * Constructs the base URL string to load the ThoughtSpot app.
3673
+ *
3674
+ * @param query
3675
+ */
3676
+ protected getEmbedBasePath(query: string): string;
3677
+ /**
3678
+ * Common query params set for all the embed modes.
3679
+ *
3680
+ * @param queryParams
3681
+ * @returns queryParams
3682
+ */
3683
+ protected getBaseQueryParams(queryParams?: {}): {};
3684
+ /**
3685
+ * Constructs the base URL string to load v1 of the ThoughtSpot app.
3686
+ * This is used for embedding Liveboards, visualizations, and full application.
3687
+ *
3688
+ * @param queryString The query string to append to the URL.
3689
+ * @param isAppEmbed A Boolean parameter to specify if you are embedding
3690
+ * the full application.
3691
+ */
3692
+ protected getV1EmbedBasePath(queryString: string): string;
3693
+ protected getEmbedParams(): string;
3694
+ protected getRootIframeSrc(): string;
3695
+ protected createIframeEl(frameSrc: string): HTMLIFrameElement;
3696
+ /**
3697
+ * Renders the embedded ThoughtSpot app in an iframe and sets up
3698
+ * event listeners.
3699
+ *
3700
+ * @param url
3701
+ * @param frameOptions
3702
+ */
3703
+ protected renderIFrame(url: string): Promise<any>;
3704
+ protected insertIntoDOM(child: string | Node): void;
3705
+ /**
3706
+ * Sets the height of the iframe
3707
+ *
3708
+ * @param height The height in pixels
3709
+ */
3710
+ protected setIFrameHeight(height: number | string): void;
3711
+ /**
3712
+ * Executes all registered event handlers for a particular event type
3713
+ *
3714
+ * @param eventType The event type
3715
+ * @param data The payload invoked with the event handler
3716
+ * @param eventPort The event Port for a specific MessageChannel
3717
+ */
3718
+ protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
3719
+ /**
3720
+ * Returns the ThoughtSpot hostname or IP address.
3721
+ */
3722
+ protected getThoughtSpotHost(): string;
3723
+ /**
3724
+ * Gets the v1 event type (if applicable) for the EmbedEvent type
3725
+ *
3726
+ * @param eventType The v2 event type
3727
+ * @returns The corresponding v1 event type if one exists
3728
+ * or else the v2 event type itself
3729
+ */
3730
+ protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
3731
+ /**
3732
+ * Calculates the iframe center for the current visible viewPort
3733
+ * of iframe using Scroll position of Host App, offsetTop for iframe
3734
+ * in Host app. ViewPort height of the tab.
3735
+ *
3736
+ * @returns iframe Center in visible viewport,
3737
+ * Iframe height,
3738
+ * View port height.
3739
+ */
3740
+ protected getIframeCenter(): {
3741
+ iframeCenter: number;
3742
+ iframeScrolled: number;
3743
+ iframeHeight: number;
3744
+ viewPortHeight: number;
3745
+ iframeVisibleViewPort: number;
3746
+ };
3747
+ /**
3748
+ * Registers an event listener to trigger an alert when the ThoughtSpot app
3749
+ * sends an event of a particular message type to the host application.
3750
+ *
3751
+ * @param messageType The message type
3752
+ * @param callback A callback as a function
3753
+ * @param options The message options
3754
+ * @param isSelf
3755
+ * @param isRegisteredBySDK
3756
+ * @example
3757
+ * ```js
3758
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
3759
+ * console.error(data);
3760
+ * });
3761
+ * ```
3762
+ * @example
3763
+ * ```js
3764
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
3765
+ * console.log("Answer save clicked", data);
3766
+ * }, {
3767
+ * start: true // This will trigger the callback on start of save
3768
+ * });
3769
+ * ```
3770
+ */
3771
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions, isRegisteredBySDK?: boolean): typeof TsEmbed.prototype;
3772
+ /**
3773
+ * Removes an event listener for a particular event type.
3774
+ *
3775
+ * @param messageType The message type
3776
+ * @param callback The callback to remove
3777
+ * @example
3778
+ * ```js
3779
+ * const errorHandler = (data) => { console.error(data); };
3780
+ * tsEmbed.on(EmbedEvent.Error, errorHandler);
3781
+ * tsEmbed.off(EmbedEvent.Error, errorHandler);
3782
+ * ```
3783
+ */
3784
+ off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
3785
+ /**
3786
+ * Triggers an event to the embedded app
3787
+ *
3788
+ * @param messageType The event type
3789
+ * @param data The payload to send with the message
3790
+ */
3791
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
3792
+ /**
3793
+ * Marks the ThoughtSpot object to have been rendered
3794
+ * Needs to be overridden by subclasses to do the actual
3795
+ * rendering of the iframe.
3796
+ *
3797
+ * @param args
3798
+ */
3799
+ render(): TsEmbed;
3800
+ /**
3801
+ * Get the Post Url Params for THOUGHTSPOT from the current
3802
+ * host app URL.
3803
+ * THOUGHTSPOT URL params starts with a prefix "ts-"
3804
+ *
3805
+ * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
3806
+ */
3807
+ getThoughtSpotPostUrlParams(): string;
3808
+ /**
3809
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
3810
+ *
3811
+ * @version SDK: 1.19.1 | ThoughtSpot: *
3812
+ */
3813
+ destroy(): void;
3814
+ getUnderlyingFrameElement(): HTMLIFrameElement;
3815
+ /**
3816
+ * Prerenders a generic instance of the TS component.
3817
+ * This means without the path but with the flags already applied.
3818
+ * This is useful for prerendering the component in the background.
3819
+ *
3820
+ * @version SDK: 1.22.0
3821
+ * @returns
3822
+ */
3823
+ prerenderGeneric(): Promise<any>;
3824
+ }
3825
+ /**
3826
+ * Base class for embedding v1 experience
3827
+ * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
3828
+ * which is currently under migration to v2
3829
+ *
3830
+ * @inheritdoc
3831
+ */
3832
+ export declare class V1Embed extends TsEmbed {
3833
+ protected viewConfig: ViewConfig;
3834
+ constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
3835
+ /**
3836
+ * Render the app in an iframe and set up event handlers
3837
+ *
3838
+ * @param iframeSrc
3839
+ */
3840
+ protected renderV1Embed(iframeSrc: string): any;
3841
+ protected getRootIframeSrc(): string;
3842
+ /**
3843
+ * @inheritdoc
3844
+ * @example
3845
+ * ```js
3846
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
3847
+ * console.error(data);
3848
+ * });
3849
+ * ```
3850
+ * @example
3851
+ * ```js
3852
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
3853
+ * console.log("Answer save clicked", data);
3854
+ * }, {
3855
+ * start: true // This will trigger the callback on start of save
3856
+ * });
3857
+ * ```
3858
+ */
3859
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
3860
+ }
3861
+
3805
3862
  export interface executeTMLInput {
3806
3863
  metadata_tmls: string[];
3807
3864
  import_policy?: 'PARTIAL' | 'ALL_OR_NONE' | 'VALIDATE_ONLY';
@@ -3889,11 +3946,13 @@ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolea
3889
3946
  */
3890
3947
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
3891
3948
  /**
3949
+ * Imports TML representation of the metadata objects into ThoughtSpot.
3892
3950
  * @param data
3893
3951
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
3894
3952
  */
3895
3953
  export declare const executeTML: (data: executeTMLInput) => Promise<any>;
3896
3954
  /**
3955
+ * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
3897
3956
  * @param data
3898
3957
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
3899
3958
  */