@thoughtspot/visual-embed-sdk 1.23.2 → 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.
- package/cjs/package.json +8 -7
- 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/base.d.ts +2 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +4 -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 +11 -4
- package/cjs/src/embed/ts-embed.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/dist/src/auth.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +2 -0
- 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/tsembed-react.es.js +29 -10
- package/dist/tsembed-react.js +29 -10
- package/dist/tsembed.es.js +29 -10
- package/dist/tsembed.js +29 -10
- package/dist/visual-embed-sdk-react-full.d.ts +240 -235
- package/dist/visual-embed-sdk-react.d.ts +240 -235
- package/dist/visual-embed-sdk.d.ts +5 -1
- package/lib/package.json +8 -7
- 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/base.d.ts +2 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +4 -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 +11 -4
- package/lib/src/embed/ts-embed.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/visual-embed-sdk.d.ts +5 -1
- package/package.json +8 -7
- package/src/auth.ts +6 -3
- package/src/embed/base.ts +7 -5
- package/src/embed/ts-embed.ts +15 -3
- 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
|
@@ -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
|
* @group Embed components
|
|
@@ -670,233 +671,6 @@ export declare class LiveboardEmbed extends V1Embed {
|
|
|
670
671
|
export declare class PinboardEmbed extends LiveboardEmbed {
|
|
671
672
|
}
|
|
672
673
|
|
|
673
|
-
/**
|
|
674
|
-
* Copyright (c) 2022
|
|
675
|
-
*
|
|
676
|
-
* Base classes
|
|
677
|
-
*
|
|
678
|
-
* @summary Base classes
|
|
679
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
680
|
-
*/
|
|
681
|
-
/**
|
|
682
|
-
* Global prefix for all Thoughtspot postHash Params.
|
|
683
|
-
*/
|
|
684
|
-
export declare const THOUGHTSPOT_PARAM_PREFIX = "ts-";
|
|
685
|
-
/**
|
|
686
|
-
* Base class for embedding v2 experience
|
|
687
|
-
* Note: the v2 version of ThoughtSpot Blink is built on the new stack:
|
|
688
|
-
* React+GraphQL
|
|
689
|
-
*/
|
|
690
|
-
export declare class TsEmbed {
|
|
691
|
-
protected isAppInitialized: boolean;
|
|
692
|
-
/**
|
|
693
|
-
* A reference to the iframe within which the ThoughtSpot app
|
|
694
|
-
* will be rendered.
|
|
695
|
-
*/
|
|
696
|
-
protected iFrame: HTMLIFrameElement;
|
|
697
|
-
protected viewConfig: ViewConfig;
|
|
698
|
-
protected embedConfig: EmbedConfig;
|
|
699
|
-
/**
|
|
700
|
-
* The ThoughtSpot hostname or IP address
|
|
701
|
-
*/
|
|
702
|
-
protected thoughtSpotHost: string;
|
|
703
|
-
protected thoughtSpotV2Base: string;
|
|
704
|
-
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
705
|
-
/**
|
|
706
|
-
* Handles errors within the SDK
|
|
707
|
-
*
|
|
708
|
-
* @param error The error message or object
|
|
709
|
-
*/
|
|
710
|
-
protected handleError(error: string | Record<string, unknown>): void;
|
|
711
|
-
/**
|
|
712
|
-
* Constructs the base URL string to load the ThoughtSpot app.
|
|
713
|
-
*
|
|
714
|
-
* @param query
|
|
715
|
-
*/
|
|
716
|
-
protected getEmbedBasePath(query: string): string;
|
|
717
|
-
/**
|
|
718
|
-
* Common query params set for all the embed modes.
|
|
719
|
-
*
|
|
720
|
-
* @param queryParams
|
|
721
|
-
* @returns queryParams
|
|
722
|
-
*/
|
|
723
|
-
protected getBaseQueryParams(queryParams?: {}): {};
|
|
724
|
-
/**
|
|
725
|
-
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
726
|
-
* This is used for embedding Liveboards, visualizations, and full application.
|
|
727
|
-
*
|
|
728
|
-
* @param queryString The query string to append to the URL.
|
|
729
|
-
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
730
|
-
* the full application.
|
|
731
|
-
*/
|
|
732
|
-
protected getV1EmbedBasePath(queryString: string): string;
|
|
733
|
-
protected getEmbedParams(): string;
|
|
734
|
-
protected getRootIframeSrc(): string;
|
|
735
|
-
protected createIframeEl(frameSrc: string): HTMLIFrameElement;
|
|
736
|
-
/**
|
|
737
|
-
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
738
|
-
* event listeners.
|
|
739
|
-
*
|
|
740
|
-
* @param url
|
|
741
|
-
* @param frameOptions
|
|
742
|
-
*/
|
|
743
|
-
protected renderIFrame(url: string): Promise<any>;
|
|
744
|
-
protected insertIntoDOM(child: string | Node): void;
|
|
745
|
-
/**
|
|
746
|
-
* Sets the height of the iframe
|
|
747
|
-
*
|
|
748
|
-
* @param height The height in pixels
|
|
749
|
-
*/
|
|
750
|
-
protected setIFrameHeight(height: number | string): void;
|
|
751
|
-
/**
|
|
752
|
-
* Executes all registered event handlers for a particular event type
|
|
753
|
-
*
|
|
754
|
-
* @param eventType The event type
|
|
755
|
-
* @param data The payload invoked with the event handler
|
|
756
|
-
* @param eventPort The event Port for a specific MessageChannel
|
|
757
|
-
*/
|
|
758
|
-
protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
|
|
759
|
-
/**
|
|
760
|
-
* Returns the ThoughtSpot hostname or IP address.
|
|
761
|
-
*/
|
|
762
|
-
protected getThoughtSpotHost(): string;
|
|
763
|
-
/**
|
|
764
|
-
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
765
|
-
*
|
|
766
|
-
* @param eventType The v2 event type
|
|
767
|
-
* @returns The corresponding v1 event type if one exists
|
|
768
|
-
* or else the v2 event type itself
|
|
769
|
-
*/
|
|
770
|
-
protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
|
|
771
|
-
/**
|
|
772
|
-
* Calculates the iframe center for the current visible viewPort
|
|
773
|
-
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
774
|
-
* in Host app. ViewPort height of the tab.
|
|
775
|
-
*
|
|
776
|
-
* @returns iframe Center in visible viewport,
|
|
777
|
-
* Iframe height,
|
|
778
|
-
* View port height.
|
|
779
|
-
*/
|
|
780
|
-
protected getIframeCenter(): {
|
|
781
|
-
iframeCenter: number;
|
|
782
|
-
iframeScrolled: number;
|
|
783
|
-
iframeHeight: number;
|
|
784
|
-
viewPortHeight: number;
|
|
785
|
-
iframeVisibleViewPort: number;
|
|
786
|
-
};
|
|
787
|
-
/**
|
|
788
|
-
* Registers an event listener to trigger an alert when the ThoughtSpot app
|
|
789
|
-
* sends an event of a particular message type to the host application.
|
|
790
|
-
*
|
|
791
|
-
* @param messageType The message type
|
|
792
|
-
* @param callback A callback as a function
|
|
793
|
-
* @param options The message options
|
|
794
|
-
* @example
|
|
795
|
-
* ```js
|
|
796
|
-
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
797
|
-
* console.error(data);
|
|
798
|
-
* });
|
|
799
|
-
* ```
|
|
800
|
-
* @example
|
|
801
|
-
* ```js
|
|
802
|
-
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
803
|
-
* console.log("Answer save clicked", data);
|
|
804
|
-
* }, {
|
|
805
|
-
* start: true // This will trigger the callback on start of save
|
|
806
|
-
* });
|
|
807
|
-
* ```
|
|
808
|
-
*/
|
|
809
|
-
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
810
|
-
/**
|
|
811
|
-
* Removes an event listener for a particular event type.
|
|
812
|
-
*
|
|
813
|
-
* @param messageType The message type
|
|
814
|
-
* @param callback The callback to remove
|
|
815
|
-
* @example
|
|
816
|
-
* ```js
|
|
817
|
-
* const errorHandler = (data) => { console.error(data); };
|
|
818
|
-
* tsEmbed.on(EmbedEvent.Error, errorHandler);
|
|
819
|
-
* tsEmbed.off(EmbedEvent.Error, errorHandler);
|
|
820
|
-
* ```
|
|
821
|
-
*/
|
|
822
|
-
off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
|
|
823
|
-
/**
|
|
824
|
-
* Triggers an event to the embedded app
|
|
825
|
-
*
|
|
826
|
-
* @param messageType The event type
|
|
827
|
-
* @param data The payload to send with the message
|
|
828
|
-
*/
|
|
829
|
-
trigger(messageType: HostEvent, data?: any): Promise<any>;
|
|
830
|
-
/**
|
|
831
|
-
* Marks the ThoughtSpot object to have been rendered
|
|
832
|
-
* Needs to be overridden by subclasses to do the actual
|
|
833
|
-
* rendering of the iframe.
|
|
834
|
-
*
|
|
835
|
-
* @param args
|
|
836
|
-
*/
|
|
837
|
-
render(): TsEmbed;
|
|
838
|
-
/**
|
|
839
|
-
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
840
|
-
* host app URL.
|
|
841
|
-
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
842
|
-
*
|
|
843
|
-
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
844
|
-
*/
|
|
845
|
-
getThoughtSpotPostUrlParams(): string;
|
|
846
|
-
/**
|
|
847
|
-
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
848
|
-
*
|
|
849
|
-
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
850
|
-
*/
|
|
851
|
-
destroy(): void;
|
|
852
|
-
getUnderlyingFrameElement(): HTMLIFrameElement;
|
|
853
|
-
/**
|
|
854
|
-
* Prerenders a generic instance of the TS component.
|
|
855
|
-
* This means without the path but with the flags already applied.
|
|
856
|
-
* This is useful for prerendering the component in the background.
|
|
857
|
-
*
|
|
858
|
-
* @version SDK: 1.22.0
|
|
859
|
-
* @returns
|
|
860
|
-
*/
|
|
861
|
-
prerenderGeneric(): Promise<any>;
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Base class for embedding v1 experience
|
|
865
|
-
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
866
|
-
* which is currently under migration to v2
|
|
867
|
-
*
|
|
868
|
-
* @inheritdoc
|
|
869
|
-
*/
|
|
870
|
-
export declare class V1Embed extends TsEmbed {
|
|
871
|
-
protected viewConfig: ViewConfig;
|
|
872
|
-
constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
|
|
873
|
-
/**
|
|
874
|
-
* Render the app in an iframe and set up event handlers
|
|
875
|
-
*
|
|
876
|
-
* @param iframeSrc
|
|
877
|
-
*/
|
|
878
|
-
protected renderV1Embed(iframeSrc: string): any;
|
|
879
|
-
protected getRootIframeSrc(): string;
|
|
880
|
-
/**
|
|
881
|
-
* @inheritdoc
|
|
882
|
-
* @example
|
|
883
|
-
* ```js
|
|
884
|
-
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
885
|
-
* console.error(data);
|
|
886
|
-
* });
|
|
887
|
-
* ```
|
|
888
|
-
* @example
|
|
889
|
-
* ```js
|
|
890
|
-
* tsEmbed.on(EmbedEvent.Save, (data) => {
|
|
891
|
-
* console.log("Answer save clicked", data);
|
|
892
|
-
* }, {
|
|
893
|
-
* start: true // This will trigger the callback on start of save
|
|
894
|
-
* });
|
|
895
|
-
* ```
|
|
896
|
-
*/
|
|
897
|
-
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
674
|
export type EmbedEventHandlers = {
|
|
901
675
|
[key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback;
|
|
902
676
|
};
|
|
@@ -3856,6 +3630,235 @@ export declare enum ContextMenuTriggerOptions {
|
|
|
3856
3630
|
RIGHT_CLICK = "right-click"
|
|
3857
3631
|
}
|
|
3858
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
|
+
|
|
3859
3862
|
export interface executeTMLInput {
|
|
3860
3863
|
metadata_tmls: string[];
|
|
3861
3864
|
import_policy?: 'PARTIAL' | 'ALL_OR_NONE' | 'VALIDATE_ONLY';
|
|
@@ -3943,11 +3946,13 @@ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolea
|
|
|
3943
3946
|
*/
|
|
3944
3947
|
export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
|
|
3945
3948
|
/**
|
|
3949
|
+
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
3946
3950
|
* @param data
|
|
3947
3951
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
3948
3952
|
*/
|
|
3949
3953
|
export declare const executeTML: (data: executeTMLInput) => Promise<any>;
|
|
3950
3954
|
/**
|
|
3955
|
+
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
|
|
3951
3956
|
* @param data
|
|
3952
3957
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
3953
3958
|
*/
|
|
@@ -264,11 +264,13 @@ export const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
|
|
|
264
264
|
*/
|
|
265
265
|
export const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
|
|
266
266
|
/**
|
|
267
|
+
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
267
268
|
* @param data
|
|
268
269
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
269
270
|
*/
|
|
270
271
|
export const executeTML: (data: executeTMLInput) => Promise<any>;
|
|
271
272
|
/**
|
|
273
|
+
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML format.
|
|
272
274
|
* @param data
|
|
273
275
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
274
276
|
*/
|
|
@@ -4214,6 +4216,8 @@ export class TsEmbed {
|
|
|
4214
4216
|
* @param messageType The message type
|
|
4215
4217
|
* @param callback A callback as a function
|
|
4216
4218
|
* @param options The message options
|
|
4219
|
+
* @param isSelf
|
|
4220
|
+
* @param isRegisteredBySDK
|
|
4217
4221
|
* @example
|
|
4218
4222
|
* ```js
|
|
4219
4223
|
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
@@ -4229,7 +4233,7 @@ export class TsEmbed {
|
|
|
4229
4233
|
* });
|
|
4230
4234
|
* ```
|
|
4231
4235
|
*/
|
|
4232
|
-
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
4236
|
+
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions, isRegisteredBySDK?: boolean): typeof TsEmbed.prototype;
|
|
4233
4237
|
/**
|
|
4234
4238
|
* Removes an event listener for a particular event type.
|
|
4235
4239
|
*
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.3",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -35,13 +35,12 @@
|
|
|
35
35
|
]
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
]
|
|
38
|
+
"size-limit": [
|
|
39
|
+
{
|
|
40
|
+
"path": "dist/tsembed.js",
|
|
41
|
+
"limit": "40 kB"
|
|
43
42
|
}
|
|
44
|
-
|
|
43
|
+
],
|
|
45
44
|
"scripts": {
|
|
46
45
|
"lint": "eslint 'src/**'",
|
|
47
46
|
"lint:fix": "eslint 'src/**/*.*' --fix",
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
"posttest": "cat ./coverage/sdk/lcov.info | coveralls",
|
|
67
66
|
"is-publish-allowed": "node scripts/is-publish-allowed.js",
|
|
68
67
|
"prepublishOnly": "npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build",
|
|
68
|
+
"check-size": "npm run build && size-limit",
|
|
69
69
|
"publish-dev": "npm publish --tag dev",
|
|
70
70
|
"publish-prod": "npm publish --tag latest"
|
|
71
71
|
},
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@rollup/plugin-json": "^4.1.0",
|
|
97
97
|
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
98
98
|
"@rollup/plugin-replace": "^5.0.2",
|
|
99
|
+
"@size-limit/preset-big-lib": "^8.2.6",
|
|
99
100
|
"@testing-library/dom": "^7.31.0",
|
|
100
101
|
"@testing-library/jest-dom": "^5.14.1",
|
|
101
102
|
"@testing-library/react": "^11.2.7",
|
|
Binary file
|
package/lib/src/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EACoB,WAAW,EACrC,MAAM,SAAS,CAAC;AAajB,eAAO,IAAI,cAAc,SAAQ,CAAC;AAElC,eAAO,IAAI,cAAc,EAAE,MAAa,CAAC;AAEzC,eAAO,IAAI,qBAAqB,EAAE,OAAO,CAAC,IAAI,CAAQ,CAAC;AAQvD,eAAO,MAAM,2BAA2B,yCAAyC,CAAC;AAElF,eAAO,MAAM,SAAS;;qCAEe,MAAM;qCACN,MAAM;;;;;;CAM1C,CAAC;AAEF,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,GAAG,CAAC;IAClB,aAAa,EAAE,GAAG,CAAC;IACnB,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EACoB,WAAW,EACrC,MAAM,SAAS,CAAC;AAajB,eAAO,IAAI,cAAc,SAAQ,CAAC;AAElC,eAAO,IAAI,cAAc,EAAE,MAAa,CAAC;AAEzC,eAAO,IAAI,qBAAqB,EAAE,OAAO,CAAC,IAAI,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B,gBAAuB,WAAW,KAAG,QAAQ,OAAO,CAMrF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,gBAAuB,WAAW,KAAG,QAAQ,OAAO,CAa3E,CAAC;AAiFF,eAAO,MAAM,UAAU,gBAAuB,WAAW,qBAiBxD,CAAC;AAEF,eAAO,MAAM,UAAU,gBAAuB,WAAW,qBAiBxD,CAAC;AAEF,eAAO,MAAM,MAAM,gBAAuB,WAAW,KAAG,QAAQ,OAAO,CAKtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,gBAAuB,WAAW,KAAG,QAAQ,OAAO,CAoB5E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,OAAyB,CAAC"}
|
package/lib/src/auth.js
CHANGED
|
@@ -156,6 +156,9 @@ export const getSessionDetails = (sessionInfoResp) => {
|
|
|
156
156
|
userGUID: sessionInfoResp.userGUID,
|
|
157
157
|
mixpanelToken,
|
|
158
158
|
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
159
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
160
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
161
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
159
162
|
...sessionInfoResp,
|
|
160
163
|
};
|
|
161
164
|
};
|