@thoughtspot/visual-embed-sdk 1.24.0-alpha.1 → 1.24.0-alpha.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.
- package/cjs/package.json +9 -1
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +3 -0
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/embed/app.d.ts +20 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +2 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +10 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -2
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +3 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +14 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +4 -1
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +1 -0
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +10 -3
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +12 -3
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +14 -14
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +4 -2
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +2 -1
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +1 -0
- package/cjs/src/types.js.map +1 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +20 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +3 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +1 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +14 -14
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +35 -13
- package/dist/tsembed-react.js +35 -13
- package/dist/tsembed.es.js +33 -13
- package/dist/tsembed.js +33 -13
- package/dist/visual-embed-sdk-react-full.d.ts +260 -237
- package/dist/visual-embed-sdk-react.d.ts +260 -237
- package/dist/visual-embed-sdk.d.ts +25 -3
- package/lib/package.json +9 -1
- package/lib/src/.index.d.ts.swp +0 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -0
- package/lib/src/auth.js.map +1 -1
- package/lib/src/embed/app.d.ts +20 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +2 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +10 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +2 -2
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +3 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +14 -6
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +4 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +1 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +10 -3
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +12 -3
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +14 -14
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +4 -2
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +1 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +2 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +1 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +25 -3
- package/package.json +9 -1
- package/src/auth.ts +6 -3
- package/src/embed/app.spec.ts +15 -0
- package/src/embed/app.ts +29 -8
- package/src/embed/base.ts +5 -5
- package/src/embed/ts-embed.spec.ts +11 -5
- package/src/embed/ts-embed.ts +18 -5
- package/src/mixpanel-service.spec.ts +12 -3
- package/src/mixpanel-service.ts +10 -3
- package/src/react/index.spec.tsx +4 -2
- package/src/react/index.tsx +35 -26
- package/src/types.ts +2 -1
|
@@ -21,7 +21,7 @@ interface SearchProps extends EmbedProps, SearchViewConfig {
|
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<
|
|
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<
|
|
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<
|
|
60
|
-
export const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<
|
|
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<
|
|
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<
|
|
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
|
|
111
|
+
export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<React.ComponentRef<T>>;
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* Copyright (c) 2023
|
|
@@ -449,12 +450,24 @@ export interface AppViewConfig extends ViewConfig {
|
|
|
449
450
|
/**
|
|
450
451
|
* A URL path within the app that is to be embedded.
|
|
451
452
|
* If both path and pageId attributes are defined, the path definition
|
|
452
|
-
* takes precedence.
|
|
453
|
+
* takes precedence. This is the path post the `#/` in the URL of the standalone
|
|
454
|
+
* ThoughtSpot app. Use this to open the embedded view to a specific path.
|
|
455
|
+
*
|
|
456
|
+
* For eg, if you want the component to open to a specific liveboard
|
|
457
|
+
* you could set the path to `pinboard/<liveboardId>/tab/<tabId>`.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```
|
|
461
|
+
* <AppEmbed path="pinboard/1234/tab/7464" />
|
|
462
|
+
* ```
|
|
453
463
|
*/
|
|
454
464
|
path?: string;
|
|
455
465
|
/**
|
|
456
466
|
* The application page to set as the start page
|
|
457
467
|
* in the embedded view.
|
|
468
|
+
*
|
|
469
|
+
* Use this to open to particular page in the app. To open to a specific
|
|
470
|
+
* path within the app, use the `path` attribute which is more flexible.
|
|
458
471
|
*/
|
|
459
472
|
pageId?: Page;
|
|
460
473
|
/**
|
|
@@ -496,6 +509,13 @@ export interface AppViewConfig extends ViewConfig {
|
|
|
496
509
|
* @hidden
|
|
497
510
|
*/
|
|
498
511
|
dataPanelV2?: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Flag to control new Modular Home experience
|
|
514
|
+
*
|
|
515
|
+
* @default false
|
|
516
|
+
* @version SDK: 1.27.0 | Thoughtspot: 9.8.0.cl
|
|
517
|
+
*/
|
|
518
|
+
modularHomeExperience?: boolean;
|
|
499
519
|
}
|
|
500
520
|
/**
|
|
501
521
|
* Embeds full ThoughtSpot experience in a host application.
|
|
@@ -677,233 +697,6 @@ export declare class LiveboardEmbed extends V1Embed {
|
|
|
677
697
|
export declare class PinboardEmbed extends LiveboardEmbed {
|
|
678
698
|
}
|
|
679
699
|
|
|
680
|
-
/**
|
|
681
|
-
* Copyright (c) 2022
|
|
682
|
-
*
|
|
683
|
-
* Base classes
|
|
684
|
-
*
|
|
685
|
-
* @summary Base classes
|
|
686
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
687
|
-
*/
|
|
688
|
-
/**
|
|
689
|
-
* Global prefix for all Thoughtspot postHash Params.
|
|
690
|
-
*/
|
|
691
|
-
export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
|
|
692
|
-
/**
|
|
693
|
-
* Base class for embedding v2 experience
|
|
694
|
-
* Note: the v2 version of ThoughtSpot Blink is built on the new stack:
|
|
695
|
-
* React+GraphQL
|
|
696
|
-
*/
|
|
697
|
-
export declare class TsEmbed {
|
|
698
|
-
protected isAppInitialized: boolean;
|
|
699
|
-
/**
|
|
700
|
-
* A reference to the iframe within which the ThoughtSpot app
|
|
701
|
-
* will be rendered.
|
|
702
|
-
*/
|
|
703
|
-
protected iFrame: HTMLIFrameElement;
|
|
704
|
-
protected viewConfig: ViewConfig;
|
|
705
|
-
protected embedConfig: EmbedConfig;
|
|
706
|
-
/**
|
|
707
|
-
* The ThoughtSpot hostname or IP address
|
|
708
|
-
*/
|
|
709
|
-
protected thoughtSpotHost: string;
|
|
710
|
-
protected thoughtSpotV2Base: string;
|
|
711
|
-
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
712
|
-
/**
|
|
713
|
-
* Handles errors within the SDK
|
|
714
|
-
*
|
|
715
|
-
* @param error The error message or object
|
|
716
|
-
*/
|
|
717
|
-
protected handleError(error: string | Record<string, unknown>): void;
|
|
718
|
-
/**
|
|
719
|
-
* Constructs the base URL string to load the ThoughtSpot app.
|
|
720
|
-
*
|
|
721
|
-
* @param query
|
|
722
|
-
*/
|
|
723
|
-
protected getEmbedBasePath(query: string): string;
|
|
724
|
-
/**
|
|
725
|
-
* Common query params set for all the embed modes.
|
|
726
|
-
*
|
|
727
|
-
* @param queryParams
|
|
728
|
-
* @returns queryParams
|
|
729
|
-
*/
|
|
730
|
-
protected getBaseQueryParams(queryParams?: {}): {};
|
|
731
|
-
/**
|
|
732
|
-
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
733
|
-
* This is used for embedding Liveboards, visualizations, and full application.
|
|
734
|
-
*
|
|
735
|
-
* @param queryString The query string to append to the URL.
|
|
736
|
-
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
737
|
-
* the full application.
|
|
738
|
-
*/
|
|
739
|
-
protected getV1EmbedBasePath(queryString: string): string;
|
|
740
|
-
protected getEmbedParams(): string;
|
|
741
|
-
protected getRootIframeSrc(): string;
|
|
742
|
-
protected createIframeEl(frameSrc: string): HTMLIFrameElement;
|
|
743
|
-
/**
|
|
744
|
-
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
745
|
-
* event listeners.
|
|
746
|
-
*
|
|
747
|
-
* @param url
|
|
748
|
-
* @param frameOptions
|
|
749
|
-
*/
|
|
750
|
-
protected renderIFrame(url: string): Promise<any>;
|
|
751
|
-
protected insertIntoDOM(child: string | Node): void;
|
|
752
|
-
/**
|
|
753
|
-
* Sets the height of the iframe
|
|
754
|
-
*
|
|
755
|
-
* @param height The height in pixels
|
|
756
|
-
*/
|
|
757
|
-
protected setIFrameHeight(height: number | string): void;
|
|
758
|
-
/**
|
|
759
|
-
* Executes all registered event handlers for a particular event type
|
|
760
|
-
*
|
|
761
|
-
* @param eventType The event type
|
|
762
|
-
* @param data The payload invoked with the event handler
|
|
763
|
-
* @param eventPort The event Port for a specific MessageChannel
|
|
764
|
-
*/
|
|
765
|
-
protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
|
|
766
|
-
/**
|
|
767
|
-
* Returns the ThoughtSpot hostname or IP address.
|
|
768
|
-
*/
|
|
769
|
-
protected getThoughtSpotHost(): string;
|
|
770
|
-
/**
|
|
771
|
-
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
772
|
-
*
|
|
773
|
-
* @param eventType The v2 event type
|
|
774
|
-
* @returns The corresponding v1 event type if one exists
|
|
775
|
-
* or else the v2 event type itself
|
|
776
|
-
*/
|
|
777
|
-
protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
|
|
778
|
-
/**
|
|
779
|
-
* Calculates the iframe center for the current visible viewPort
|
|
780
|
-
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
781
|
-
* in Host app. ViewPort height of the tab.
|
|
782
|
-
*
|
|
783
|
-
* @returns iframe Center in visible viewport,
|
|
784
|
-
* Iframe height,
|
|
785
|
-
* View port height.
|
|
786
|
-
*/
|
|
787
|
-
protected getIframeCenter(): {
|
|
788
|
-
iframeCenter: number;
|
|
789
|
-
iframeScrolled: number;
|
|
790
|
-
iframeHeight: number;
|
|
791
|
-
viewPortHeight: number;
|
|
792
|
-
iframeVisibleViewPort: number;
|
|
793
|
-
};
|
|
794
|
-
/**
|
|
795
|
-
* Registers an event listener to trigger an alert when the ThoughtSpot app
|
|
796
|
-
* sends an event of a particular message type to the host application.
|
|
797
|
-
*
|
|
798
|
-
* @param messageType The message type
|
|
799
|
-
* @param callback A callback as a function
|
|
800
|
-
* @param options The message options
|
|
801
|
-
* @example
|
|
802
|
-
* ```js
|
|
803
|
-
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
804
|
-
* console.error(data);
|
|
805
|
-
* });
|
|
806
|
-
* ```
|
|
807
|
-
* @example
|
|
808
|
-
* ```js
|
|
809
|
-
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
810
|
-
* console.log("Answer save clicked", data);
|
|
811
|
-
* }, {
|
|
812
|
-
* start: true // This will trigger the callback on start of save
|
|
813
|
-
* });
|
|
814
|
-
* ```
|
|
815
|
-
*/
|
|
816
|
-
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
817
|
-
/**
|
|
818
|
-
* Removes an event listener for a particular event type.
|
|
819
|
-
*
|
|
820
|
-
* @param messageType The message type
|
|
821
|
-
* @param callback The callback to remove
|
|
822
|
-
* @example
|
|
823
|
-
* ```js
|
|
824
|
-
* const errorHandler = (data) => { console.error(data); };
|
|
825
|
-
* tsEmbed.on(EmbedEvent.Error, errorHandler);
|
|
826
|
-
* tsEmbed.off(EmbedEvent.Error, errorHandler);
|
|
827
|
-
* ```
|
|
828
|
-
*/
|
|
829
|
-
off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
|
|
830
|
-
/**
|
|
831
|
-
* Triggers an event to the embedded app
|
|
832
|
-
*
|
|
833
|
-
* @param messageType The event type
|
|
834
|
-
* @param data The payload to send with the message
|
|
835
|
-
*/
|
|
836
|
-
trigger(messageType: HostEvent, data?: any): Promise<any>;
|
|
837
|
-
/**
|
|
838
|
-
* Marks the ThoughtSpot object to have been rendered
|
|
839
|
-
* Needs to be overridden by subclasses to do the actual
|
|
840
|
-
* rendering of the iframe.
|
|
841
|
-
*
|
|
842
|
-
* @param args
|
|
843
|
-
*/
|
|
844
|
-
render(): TsEmbed;
|
|
845
|
-
/**
|
|
846
|
-
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
847
|
-
* host app URL.
|
|
848
|
-
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
849
|
-
*
|
|
850
|
-
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
851
|
-
*/
|
|
852
|
-
getThoughtSpotPostUrlParams(): string;
|
|
853
|
-
/**
|
|
854
|
-
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
855
|
-
*
|
|
856
|
-
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
857
|
-
*/
|
|
858
|
-
destroy(): void;
|
|
859
|
-
getUnderlyingFrameElement(): HTMLIFrameElement;
|
|
860
|
-
/**
|
|
861
|
-
* Prerenders a generic instance of the TS component.
|
|
862
|
-
* This means without the path but with the flags already applied.
|
|
863
|
-
* This is useful for prerendering the component in the background.
|
|
864
|
-
*
|
|
865
|
-
* @version SDK: 1.22.0
|
|
866
|
-
* @returns
|
|
867
|
-
*/
|
|
868
|
-
prerenderGeneric(): Promise<any>;
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* Base class for embedding v1 experience
|
|
872
|
-
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
873
|
-
* which is currently under migration to v2
|
|
874
|
-
*
|
|
875
|
-
* @inheritdoc
|
|
876
|
-
*/
|
|
877
|
-
export declare class V1Embed extends TsEmbed {
|
|
878
|
-
protected viewConfig: ViewConfig;
|
|
879
|
-
constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
|
|
880
|
-
/**
|
|
881
|
-
* Render the app in an iframe and set up event handlers
|
|
882
|
-
*
|
|
883
|
-
* @param iframeSrc
|
|
884
|
-
*/
|
|
885
|
-
protected renderV1Embed(iframeSrc: string): any;
|
|
886
|
-
protected getRootIframeSrc(): string;
|
|
887
|
-
/**
|
|
888
|
-
* @inheritdoc
|
|
889
|
-
* @example
|
|
890
|
-
* ```js
|
|
891
|
-
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
892
|
-
* console.error(data);
|
|
893
|
-
* });
|
|
894
|
-
* ```
|
|
895
|
-
* @example
|
|
896
|
-
* ```js
|
|
897
|
-
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
898
|
-
* console.log("Answer save clicked", data);
|
|
899
|
-
* }, {
|
|
900
|
-
* start: true // This will trigger the callback on start of save
|
|
901
|
-
* });
|
|
902
|
-
* ```
|
|
903
|
-
*/
|
|
904
|
-
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
700
|
export type EmbedEventHandlers = {
|
|
908
701
|
[key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
|
|
909
702
|
};
|
|
@@ -3300,7 +3093,8 @@ export declare enum Param {
|
|
|
3300
3093
|
HideTabPanel = "hideTabPanel",
|
|
3301
3094
|
HideSampleQuestions = "hideSampleQuestions",
|
|
3302
3095
|
WorksheetId = "worksheet",
|
|
3303
|
-
Query = "query"
|
|
3096
|
+
Query = "query",
|
|
3097
|
+
ModularHomeExperienceEnabled = "modularHomeExperience"
|
|
3304
3098
|
}
|
|
3305
3099
|
/**
|
|
3306
3100
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -4441,3 +4235,232 @@ export interface CustomCssVariables {
|
|
|
4441
4235
|
'--ts-var-dialog-footer-background'?: string;
|
|
4442
4236
|
}
|
|
4443
4237
|
|
|
4238
|
+
/**
|
|
4239
|
+
* Copyright (c) 2022
|
|
4240
|
+
*
|
|
4241
|
+
* Base classes
|
|
4242
|
+
*
|
|
4243
|
+
* @summary Base classes
|
|
4244
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
4245
|
+
*/
|
|
4246
|
+
/**
|
|
4247
|
+
* Global prefix for all Thoughtspot postHash Params.
|
|
4248
|
+
*/
|
|
4249
|
+
export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
|
|
4250
|
+
/**
|
|
4251
|
+
* Base class for embedding v2 experience
|
|
4252
|
+
* Note: the v2 version of ThoughtSpot Blink is built on the new stack:
|
|
4253
|
+
* React+GraphQL
|
|
4254
|
+
*/
|
|
4255
|
+
export declare class TsEmbed {
|
|
4256
|
+
protected isAppInitialized: boolean;
|
|
4257
|
+
/**
|
|
4258
|
+
* A reference to the iframe within which the ThoughtSpot app
|
|
4259
|
+
* will be rendered.
|
|
4260
|
+
*/
|
|
4261
|
+
protected iFrame: HTMLIFrameElement;
|
|
4262
|
+
protected viewConfig: ViewConfig;
|
|
4263
|
+
protected embedConfig: EmbedConfig;
|
|
4264
|
+
/**
|
|
4265
|
+
* The ThoughtSpot hostname or IP address
|
|
4266
|
+
*/
|
|
4267
|
+
protected thoughtSpotHost: string;
|
|
4268
|
+
protected thoughtSpotV2Base: string;
|
|
4269
|
+
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
4270
|
+
/**
|
|
4271
|
+
* Handles errors within the SDK
|
|
4272
|
+
*
|
|
4273
|
+
* @param error The error message or object
|
|
4274
|
+
*/
|
|
4275
|
+
protected handleError(error: string | Record<string, unknown>): void;
|
|
4276
|
+
/**
|
|
4277
|
+
* Constructs the base URL string to load the ThoughtSpot app.
|
|
4278
|
+
*
|
|
4279
|
+
* @param query
|
|
4280
|
+
*/
|
|
4281
|
+
protected getEmbedBasePath(query: string): string;
|
|
4282
|
+
/**
|
|
4283
|
+
* Common query params set for all the embed modes.
|
|
4284
|
+
*
|
|
4285
|
+
* @param queryParams
|
|
4286
|
+
* @returns queryParams
|
|
4287
|
+
*/
|
|
4288
|
+
protected getBaseQueryParams(queryParams?: {}): {};
|
|
4289
|
+
/**
|
|
4290
|
+
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
4291
|
+
* This is used for embedding Liveboards, visualizations, and full application.
|
|
4292
|
+
*
|
|
4293
|
+
* @param queryString The query string to append to the URL.
|
|
4294
|
+
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
4295
|
+
* the full application.
|
|
4296
|
+
*/
|
|
4297
|
+
protected getV1EmbedBasePath(queryString: string): string;
|
|
4298
|
+
protected getEmbedParams(): string;
|
|
4299
|
+
protected getRootIframeSrc(): string;
|
|
4300
|
+
protected createIframeEl(frameSrc: string): HTMLIFrameElement;
|
|
4301
|
+
/**
|
|
4302
|
+
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
4303
|
+
* event listeners.
|
|
4304
|
+
*
|
|
4305
|
+
* @param url
|
|
4306
|
+
* @param frameOptions
|
|
4307
|
+
*/
|
|
4308
|
+
protected renderIFrame(url: string): Promise<any>;
|
|
4309
|
+
protected insertIntoDOM(child: string | Node): void;
|
|
4310
|
+
/**
|
|
4311
|
+
* Sets the height of the iframe
|
|
4312
|
+
*
|
|
4313
|
+
* @param height The height in pixels
|
|
4314
|
+
*/
|
|
4315
|
+
protected setIFrameHeight(height: number | string): void;
|
|
4316
|
+
/**
|
|
4317
|
+
* Executes all registered event handlers for a particular event type
|
|
4318
|
+
*
|
|
4319
|
+
* @param eventType The event type
|
|
4320
|
+
* @param data The payload invoked with the event handler
|
|
4321
|
+
* @param eventPort The event Port for a specific MessageChannel
|
|
4322
|
+
*/
|
|
4323
|
+
protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
|
|
4324
|
+
/**
|
|
4325
|
+
* Returns the ThoughtSpot hostname or IP address.
|
|
4326
|
+
*/
|
|
4327
|
+
protected getThoughtSpotHost(): string;
|
|
4328
|
+
/**
|
|
4329
|
+
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
4330
|
+
*
|
|
4331
|
+
* @param eventType The v2 event type
|
|
4332
|
+
* @returns The corresponding v1 event type if one exists
|
|
4333
|
+
* or else the v2 event type itself
|
|
4334
|
+
*/
|
|
4335
|
+
protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
|
|
4336
|
+
/**
|
|
4337
|
+
* Calculates the iframe center for the current visible viewPort
|
|
4338
|
+
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
4339
|
+
* in Host app. ViewPort height of the tab.
|
|
4340
|
+
*
|
|
4341
|
+
* @returns iframe Center in visible viewport,
|
|
4342
|
+
* Iframe height,
|
|
4343
|
+
* View port height.
|
|
4344
|
+
*/
|
|
4345
|
+
protected getIframeCenter(): {
|
|
4346
|
+
iframeCenter: number;
|
|
4347
|
+
iframeScrolled: number;
|
|
4348
|
+
iframeHeight: number;
|
|
4349
|
+
viewPortHeight: number;
|
|
4350
|
+
iframeVisibleViewPort: number;
|
|
4351
|
+
};
|
|
4352
|
+
/**
|
|
4353
|
+
* Registers an event listener to trigger an alert when the ThoughtSpot app
|
|
4354
|
+
* sends an event of a particular message type to the host application.
|
|
4355
|
+
*
|
|
4356
|
+
* @param messageType The message type
|
|
4357
|
+
* @param callback A callback as a function
|
|
4358
|
+
* @param options The message options
|
|
4359
|
+
* @param isSelf
|
|
4360
|
+
* @param isRegisteredBySDK
|
|
4361
|
+
* @example
|
|
4362
|
+
* ```js
|
|
4363
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
4364
|
+
* console.error(data);
|
|
4365
|
+
* });
|
|
4366
|
+
* ```
|
|
4367
|
+
* @example
|
|
4368
|
+
* ```js
|
|
4369
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
4370
|
+
* console.log("Answer save clicked", data);
|
|
4371
|
+
* }, {
|
|
4372
|
+
* start: true // This will trigger the callback on start of save
|
|
4373
|
+
* });
|
|
4374
|
+
* ```
|
|
4375
|
+
*/
|
|
4376
|
+
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions, isRegisteredBySDK?: boolean): typeof TsEmbed.prototype;
|
|
4377
|
+
/**
|
|
4378
|
+
* Removes an event listener for a particular event type.
|
|
4379
|
+
*
|
|
4380
|
+
* @param messageType The message type
|
|
4381
|
+
* @param callback The callback to remove
|
|
4382
|
+
* @example
|
|
4383
|
+
* ```js
|
|
4384
|
+
* const errorHandler = (data) => { console.error(data); };
|
|
4385
|
+
* tsEmbed.on(EmbedEvent.Error, errorHandler);
|
|
4386
|
+
* tsEmbed.off(EmbedEvent.Error, errorHandler);
|
|
4387
|
+
* ```
|
|
4388
|
+
*/
|
|
4389
|
+
off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
|
|
4390
|
+
/**
|
|
4391
|
+
* Triggers an event to the embedded app
|
|
4392
|
+
*
|
|
4393
|
+
* @param messageType The event type
|
|
4394
|
+
* @param data The payload to send with the message
|
|
4395
|
+
*/
|
|
4396
|
+
trigger(messageType: HostEvent, data?: any): Promise<any>;
|
|
4397
|
+
/**
|
|
4398
|
+
* Marks the ThoughtSpot object to have been rendered
|
|
4399
|
+
* Needs to be overridden by subclasses to do the actual
|
|
4400
|
+
* rendering of the iframe.
|
|
4401
|
+
*
|
|
4402
|
+
* @param args
|
|
4403
|
+
*/
|
|
4404
|
+
render(): TsEmbed;
|
|
4405
|
+
/**
|
|
4406
|
+
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
4407
|
+
* host app URL.
|
|
4408
|
+
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
4409
|
+
*
|
|
4410
|
+
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
4411
|
+
*/
|
|
4412
|
+
getThoughtSpotPostUrlParams(): string;
|
|
4413
|
+
/**
|
|
4414
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
4415
|
+
*
|
|
4416
|
+
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
4417
|
+
*/
|
|
4418
|
+
destroy(): void;
|
|
4419
|
+
getUnderlyingFrameElement(): HTMLIFrameElement;
|
|
4420
|
+
/**
|
|
4421
|
+
* Prerenders a generic instance of the TS component.
|
|
4422
|
+
* This means without the path but with the flags already applied.
|
|
4423
|
+
* This is useful for prerendering the component in the background.
|
|
4424
|
+
*
|
|
4425
|
+
* @version SDK: 1.22.0
|
|
4426
|
+
* @returns
|
|
4427
|
+
*/
|
|
4428
|
+
prerenderGeneric(): Promise<any>;
|
|
4429
|
+
}
|
|
4430
|
+
/**
|
|
4431
|
+
* Base class for embedding v1 experience
|
|
4432
|
+
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
4433
|
+
* which is currently under migration to v2
|
|
4434
|
+
*
|
|
4435
|
+
* @inheritdoc
|
|
4436
|
+
*/
|
|
4437
|
+
export declare class V1Embed extends TsEmbed {
|
|
4438
|
+
protected viewConfig: ViewConfig;
|
|
4439
|
+
constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
|
|
4440
|
+
/**
|
|
4441
|
+
* Render the app in an iframe and set up event handlers
|
|
4442
|
+
*
|
|
4443
|
+
* @param iframeSrc
|
|
4444
|
+
*/
|
|
4445
|
+
protected renderV1Embed(iframeSrc: string): any;
|
|
4446
|
+
protected getRootIframeSrc(): string;
|
|
4447
|
+
/**
|
|
4448
|
+
* @inheritdoc
|
|
4449
|
+
* @example
|
|
4450
|
+
* ```js
|
|
4451
|
+
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
4452
|
+
* console.error(data);
|
|
4453
|
+
* });
|
|
4454
|
+
* ```
|
|
4455
|
+
* @example
|
|
4456
|
+
* ```js
|
|
4457
|
+
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
4458
|
+
* console.log("Answer save clicked", data);
|
|
4459
|
+
* }, {
|
|
4460
|
+
* start: true // This will trigger the callback on start of save
|
|
4461
|
+
* });
|
|
4462
|
+
* ```
|
|
4463
|
+
*/
|
|
4464
|
+
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
4465
|
+
}
|
|
4466
|
+
|