@thoughtspot/visual-embed-sdk 1.21.0 → 1.21.1

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.
@@ -102,7 +102,7 @@ export const useEmbedRef: () => React.MutableRefObject<TsEmbed>;
102
102
  * @summary ThoughtSpot Visual Embed SDK
103
103
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
104
104
  */
105
- export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, };
105
+ export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, };
106
106
 
107
107
  /**
108
108
  * @group Embed components
@@ -1243,9 +1243,40 @@ export declare enum AuthType {
1243
1243
  export type DOMSelector = string | HTMLElement;
1244
1244
  /**
1245
1245
  * inline customCSS within the {@link CustomisationsInterface}.
1246
+ * Use {@link CustomCssVariables} or css rules.
1246
1247
  */
1247
1248
  export interface customCssInterface {
1249
+ /**
1250
+ * The custom css variables, which can be set.
1251
+ * The allowed list is in the CustomCssVariables
1252
+ * interface.
1253
+ * Or here: https://try-everywhere.thoughtspot.cloud/resources/static/css/custom_variables.css
1254
+ */
1248
1255
  variables?: CustomCssVariables;
1256
+ /**
1257
+ * Can be used to define a custom font face
1258
+ * like:
1259
+ * @example
1260
+ * ```js
1261
+ * rules_UNSTABLE?: {
1262
+ * "@font-face": {
1263
+ * "font-family": "custom-font",
1264
+ * "src": url("/path/")
1265
+ * * };
1266
+ * };
1267
+ * ```
1268
+ *
1269
+ * * Also, custom css rules outside of variables.
1270
+ * @example
1271
+ * ```js
1272
+ * rules_UNSTABLE?: {
1273
+ * ".thoughtspot_class_name": {
1274
+ * "border-radius": "10px",
1275
+ * margin: "20px"
1276
+ * };
1277
+ * };
1278
+ * ```
1279
+ */
1249
1280
  rules_UNSTABLE?: {
1250
1281
  [selector: string]: {
1251
1282
  [declaration: string]: string;
@@ -3128,6 +3159,10 @@ export declare enum ContextMenuTriggerOptions {
3128
3159
  RIGHT_CLICK = "right-click"
3129
3160
  }
3130
3161
 
3162
+ /**
3163
+ * The list of customization css variables. These
3164
+ * are the only allowed variables possible.
3165
+ */
3131
3166
  export interface CustomCssVariables {
3132
3167
  /**
3133
3168
  * Background color of the Liveboard, visualization, Search, and Answer pages.
@@ -3425,6 +3460,5 @@ export interface CustomCssVariables {
3425
3460
  * Background color of the footer area on dialogs.
3426
3461
  */
3427
3462
  '--ts-var-dialog-footer-background'?: string;
3428
- [key: string]: string;
3429
3463
  }
3430
3464
 
@@ -787,7 +787,7 @@ export function getViewPropsAndListeners<T extends EmbedProps, U extends ViewCon
787
787
  * @summary ThoughtSpot Visual Embed SDK
788
788
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
789
789
  */
790
- export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, };
790
+ export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, };
791
791
 
792
792
  /**
793
793
  * Copyright (c) 2023
@@ -967,9 +967,40 @@ export declare enum AuthType {
967
967
  export type DOMSelector = string | HTMLElement;
968
968
  /**
969
969
  * inline customCSS within the {@link CustomisationsInterface}.
970
+ * Use {@link CustomCssVariables} or css rules.
970
971
  */
971
972
  export interface customCssInterface {
973
+ /**
974
+ * The custom css variables, which can be set.
975
+ * The allowed list is in the CustomCssVariables
976
+ * interface.
977
+ * Or here: https://try-everywhere.thoughtspot.cloud/resources/static/css/custom_variables.css
978
+ */
972
979
  variables?: CustomCssVariables;
980
+ /**
981
+ * Can be used to define a custom font face
982
+ * like:
983
+ * @example
984
+ * ```js
985
+ * rules_UNSTABLE?: {
986
+ * "@font-face": {
987
+ * "font-family": "custom-font",
988
+ * "src": url("/path/")
989
+ * * };
990
+ * };
991
+ * ```
992
+ *
993
+ * * Also, custom css rules outside of variables.
994
+ * @example
995
+ * ```js
996
+ * rules_UNSTABLE?: {
997
+ * ".thoughtspot_class_name": {
998
+ * "border-radius": "10px",
999
+ * margin: "20px"
1000
+ * };
1001
+ * };
1002
+ * ```
1003
+ */
973
1004
  rules_UNSTABLE?: {
974
1005
  [selector: string]: {
975
1006
  [declaration: string]: string;
@@ -3128,6 +3159,10 @@ export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean
3128
3159
  export declare const isAuthenticated: () => boolean;
3129
3160
  export {};
3130
3161
 
3162
+ /**
3163
+ * The list of customization css variables. These
3164
+ * are the only allowed variables possible.
3165
+ */
3131
3166
  export interface CustomCssVariables {
3132
3167
  /**
3133
3168
  * Background color of the Liveboard, visualization, Search, and Answer pages.
@@ -3425,6 +3460,5 @@ export interface CustomCssVariables {
3425
3460
  * Background color of the footer area on dialogs.
3426
3461
  */
3427
3462
  '--ts-var-dialog-footer-background'?: string;
3428
- [key: string]: string;
3429
3463
  }
3430
3464
 
@@ -13,7 +13,7 @@ import EventEmitter from 'eventemitter3';
13
13
  * @summary ThoughtSpot Visual Embed SDK
14
14
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
15
15
  */
16
- export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, };
16
+ export { init, logout, prefetch, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, };
17
17
 
18
18
  /**
19
19
  * Copyright (c) 2022
@@ -909,9 +909,40 @@ export enum AuthType {
909
909
  export type DOMSelector = string | HTMLElement;
910
910
  /**
911
911
  * inline customCSS within the {@link CustomisationsInterface}.
912
+ * Use {@link CustomCssVariables} or css rules.
912
913
  */
913
914
  export interface customCssInterface {
915
+ /**
916
+ * The custom css variables, which can be set.
917
+ * The allowed list is in the CustomCssVariables
918
+ * interface.
919
+ * Or here: https://try-everywhere.thoughtspot.cloud/resources/static/css/custom_variables.css
920
+ */
914
921
  variables?: CustomCssVariables;
922
+ /**
923
+ * Can be used to define a custom font face
924
+ * like:
925
+ * @example
926
+ * ```js
927
+ * rules_UNSTABLE?: {
928
+ * "@font-face": {
929
+ * "font-family": "custom-font",
930
+ * "src": url("/path/")
931
+ * * };
932
+ * };
933
+ * ```
934
+ *
935
+ * * Also, custom css rules outside of variables.
936
+ * @example
937
+ * ```js
938
+ * rules_UNSTABLE?: {
939
+ * ".thoughtspot_class_name": {
940
+ * "border-radius": "10px",
941
+ * margin: "20px"
942
+ * };
943
+ * };
944
+ * ```
945
+ */
915
946
  rules_UNSTABLE?: {
916
947
  [selector: string]: {
917
948
  [declaration: string]: string;
@@ -2795,232 +2826,9 @@ export enum ContextMenuTriggerOptions {
2795
2826
  }
2796
2827
 
2797
2828
  /**
2798
- * Copyright (c) 2022
2799
- *
2800
- * Base classes
2801
- *
2802
- * @summary Base classes
2803
- * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
2804
- */
2805
- /**
2806
- * Global prefix for all Thoughtspot postHash Params.
2807
- */
2808
- export const THOUGHTSPOT_PARAM_PREFIX = "ts-";
2809
- /**
2810
- * Base class for embedding v2 experience
2811
- * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
2812
- * React+GraphQL
2813
- */
2814
- export class TsEmbed {
2815
- protected isAppInitialized: boolean;
2816
- /**
2817
- * A reference to the iframe within which the ThoughtSpot app
2818
- * will be rendered.
2819
- */
2820
- protected iFrame: HTMLIFrameElement;
2821
- protected viewConfig: ViewConfig;
2822
- protected embedConfig: EmbedConfig;
2823
- /**
2824
- * The ThoughtSpot hostname or IP address
2825
- */
2826
- protected thoughtSpotHost: string;
2827
- protected thoughtSpotV2Base: string;
2828
- constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
2829
- /**
2830
- * Handles errors within the SDK
2831
- *
2832
- * @param error The error message or object
2833
- */
2834
- protected handleError(error: string | Record<string, unknown>): void;
2835
- /**
2836
- * Constructs the base URL string to load the ThoughtSpot app.
2837
- *
2838
- * @param query
2839
- */
2840
- protected getEmbedBasePath(query: string): string;
2841
- /**
2842
- * Common query params set for all the embed modes.
2843
- *
2844
- * @param queryParams
2845
- * @returns queryParams
2846
- */
2847
- protected getBaseQueryParams(queryParams?: {}): {};
2848
- /**
2849
- * Constructs the base URL string to load v1 of the ThoughtSpot app.
2850
- * This is used for embedding Liveboards, visualizations, and full application.
2851
- *
2852
- * @param queryString The query string to append to the URL.
2853
- * @param isAppEmbed A Boolean parameter to specify if you are embedding
2854
- * the full application.
2855
- */
2856
- protected getV1EmbedBasePath(queryString: string): string;
2857
- protected getEmbedParams(): string;
2858
- protected getRootIframeSrc(): string;
2859
- protected createIframeEl(frameSrc: string): HTMLIFrameElement;
2860
- /**
2861
- * Renders the embedded ThoughtSpot app in an iframe and sets up
2862
- * event listeners.
2863
- *
2864
- * @param url
2865
- * @param frameOptions
2866
- */
2867
- protected renderIFrame(url: string): Promise<any>;
2868
- protected insertIntoDOM(child: string | Node): void;
2869
- /**
2870
- * Sets the height of the iframe
2871
- *
2872
- * @param height The height in pixels
2873
- */
2874
- protected setIFrameHeight(height: number | string): void;
2875
- /**
2876
- * Executes all registered event handlers for a particular event type
2877
- *
2878
- * @param eventType The event type
2879
- * @param data The payload invoked with the event handler
2880
- * @param eventPort The event Port for a specific MessageChannel
2881
- */
2882
- protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
2883
- /**
2884
- * Returns the ThoughtSpot hostname or IP address.
2885
- */
2886
- protected getThoughtSpotHost(): string;
2887
- /**
2888
- * Gets the v1 event type (if applicable) for the EmbedEvent type
2889
- *
2890
- * @param eventType The v2 event type
2891
- * @returns The corresponding v1 event type if one exists
2892
- * or else the v2 event type itself
2893
- */
2894
- protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
2895
- /**
2896
- * Calculates the iframe center for the current visible viewPort
2897
- * of iframe using Scroll position of Host App, offsetTop for iframe
2898
- * in Host app. ViewPort height of the tab.
2899
- *
2900
- * @returns iframe Center in visible viewport,
2901
- * Iframe height,
2902
- * View port height.
2903
- */
2904
- protected getIframeCenter(): {
2905
- iframeCenter: number;
2906
- iframeScrolled: number;
2907
- iframeHeight: number;
2908
- viewPortHeight: number;
2909
- iframeVisibleViewPort: number;
2910
- };
2911
- /**
2912
- * Registers an event listener to trigger an alert when the ThoughtSpot app
2913
- * sends an event of a particular message type to the host application.
2914
- *
2915
- * @param messageType The message type
2916
- * @param callback A callback as a function
2917
- * @param options The message options
2918
- * @example
2919
- * ```js
2920
- * tsEmbed.on(EmbedEvent.Error, (data) => {
2921
- * console.error(data);
2922
- * });
2923
- * ```
2924
- * @example
2925
- * ```js
2926
- * tsEmbed.on(EmbedEvent.Save, (data) => {
2927
- * console.log("Answer save clicked", data);
2928
- * }, {
2929
- * start: true // This will trigger the callback on start of save
2930
- * });
2931
- * ```
2932
- */
2933
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
2934
- /**
2935
- * Removes an event listener for a particular event type.
2936
- *
2937
- * @param messageType The message type
2938
- * @param callback The callback to remove
2939
- * @example
2940
- * ```js
2941
- * const errorHandler = (data) => { console.error(data); };
2942
- * tsEmbed.on(EmbedEvent.Error, errorHandler);
2943
- * tsEmbed.off(EmbedEvent.Error, errorHandler);
2944
- * ```
2945
- */
2946
- off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
2947
- /**
2948
- * Triggers an event to the embedded app
2949
- *
2950
- * @param messageType The event type
2951
- * @param data The payload to send with the message
2952
- */
2953
- trigger(messageType: HostEvent, data?: any): Promise<any>;
2954
- /**
2955
- * Marks the ThoughtSpot object to have been rendered
2956
- * Needs to be overridden by subclasses to do the actual
2957
- * rendering of the iframe.
2958
- *
2959
- * @param args
2960
- */
2961
- render(): TsEmbed;
2962
- /**
2963
- * Get the Post Url Params for THOUGHTSPOT from the current
2964
- * host app URL.
2965
- * THOUGHTSPOT URL params starts with a prefix "ts-"
2966
- *
2967
- * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
2968
- */
2969
- getThoughtSpotPostUrlParams(): string;
2970
- /**
2971
- * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
2972
- *
2973
- * @version SDK: 1.19.1 | ThoughtSpot: *
2974
- */
2975
- destroy(): void;
2976
- getUnderlyingFrameElement(): HTMLIFrameElement;
2977
- /**
2978
- * Prerenders a generic instance of the TS component.
2979
- * This means without the path but with the flags already applied.
2980
- * This is useful for prerendering the component in the background.
2981
- *
2982
- * @version SDK: 1.22.0
2983
- * @returns
2984
- */
2985
- prerenderGeneric(): Promise<any>;
2986
- }
2987
- /**
2988
- * Base class for embedding v1 experience
2989
- * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
2990
- * which is currently under migration to v2
2991
- *
2992
- * @inheritdoc
2829
+ * The list of customization css variables. These
2830
+ * are the only allowed variables possible.
2993
2831
  */
2994
- export class V1Embed extends TsEmbed {
2995
- protected viewConfig: ViewConfig;
2996
- constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
2997
- /**
2998
- * Render the app in an iframe and set up event handlers
2999
- *
3000
- * @param iframeSrc
3001
- */
3002
- protected renderV1Embed(iframeSrc: string): any;
3003
- protected getRootIframeSrc(): string;
3004
- /**
3005
- * @inheritdoc
3006
- * @example
3007
- * ```js
3008
- * tsEmbed.on(EmbedEvent.Error, (data) => {
3009
- * console.error(data);
3010
- * });
3011
- * ```
3012
- * @example
3013
- * ```js
3014
- * tsEmbed.on(EmbedEvent.Save, (data) => {
3015
- * console.log("Answer save clicked", data);
3016
- * }, {
3017
- * start: true // This will trigger the callback on start of save
3018
- * });
3019
- * ```
3020
- */
3021
- on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
3022
- }
3023
-
3024
2832
  export interface CustomCssVariables {
3025
2833
  /**
3026
2834
  * Background color of the Liveboard, visualization, Search, and Answer pages.
@@ -3318,6 +3126,232 @@ export interface CustomCssVariables {
3318
3126
  * Background color of the footer area on dialogs.
3319
3127
  */
3320
3128
  '--ts-var-dialog-footer-background'?: string;
3321
- [key: string]: string;
3129
+ }
3130
+
3131
+ /**
3132
+ * Copyright (c) 2022
3133
+ *
3134
+ * Base classes
3135
+ *
3136
+ * @summary Base classes
3137
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
3138
+ */
3139
+ /**
3140
+ * Global prefix for all Thoughtspot postHash Params.
3141
+ */
3142
+ export const THOUGHTSPOT_PARAM_PREFIX = "ts-";
3143
+ /**
3144
+ * Base class for embedding v2 experience
3145
+ * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
3146
+ * React+GraphQL
3147
+ */
3148
+ export class TsEmbed {
3149
+ protected isAppInitialized: boolean;
3150
+ /**
3151
+ * A reference to the iframe within which the ThoughtSpot app
3152
+ * will be rendered.
3153
+ */
3154
+ protected iFrame: HTMLIFrameElement;
3155
+ protected viewConfig: ViewConfig;
3156
+ protected embedConfig: EmbedConfig;
3157
+ /**
3158
+ * The ThoughtSpot hostname or IP address
3159
+ */
3160
+ protected thoughtSpotHost: string;
3161
+ protected thoughtSpotV2Base: string;
3162
+ constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
3163
+ /**
3164
+ * Handles errors within the SDK
3165
+ *
3166
+ * @param error The error message or object
3167
+ */
3168
+ protected handleError(error: string | Record<string, unknown>): void;
3169
+ /**
3170
+ * Constructs the base URL string to load the ThoughtSpot app.
3171
+ *
3172
+ * @param query
3173
+ */
3174
+ protected getEmbedBasePath(query: string): string;
3175
+ /**
3176
+ * Common query params set for all the embed modes.
3177
+ *
3178
+ * @param queryParams
3179
+ * @returns queryParams
3180
+ */
3181
+ protected getBaseQueryParams(queryParams?: {}): {};
3182
+ /**
3183
+ * Constructs the base URL string to load v1 of the ThoughtSpot app.
3184
+ * This is used for embedding Liveboards, visualizations, and full application.
3185
+ *
3186
+ * @param queryString The query string to append to the URL.
3187
+ * @param isAppEmbed A Boolean parameter to specify if you are embedding
3188
+ * the full application.
3189
+ */
3190
+ protected getV1EmbedBasePath(queryString: string): string;
3191
+ protected getEmbedParams(): string;
3192
+ protected getRootIframeSrc(): string;
3193
+ protected createIframeEl(frameSrc: string): HTMLIFrameElement;
3194
+ /**
3195
+ * Renders the embedded ThoughtSpot app in an iframe and sets up
3196
+ * event listeners.
3197
+ *
3198
+ * @param url
3199
+ * @param frameOptions
3200
+ */
3201
+ protected renderIFrame(url: string): Promise<any>;
3202
+ protected insertIntoDOM(child: string | Node): void;
3203
+ /**
3204
+ * Sets the height of the iframe
3205
+ *
3206
+ * @param height The height in pixels
3207
+ */
3208
+ protected setIFrameHeight(height: number | string): void;
3209
+ /**
3210
+ * Executes all registered event handlers for a particular event type
3211
+ *
3212
+ * @param eventType The event type
3213
+ * @param data The payload invoked with the event handler
3214
+ * @param eventPort The event Port for a specific MessageChannel
3215
+ */
3216
+ protected executeCallbacks(eventType: EmbedEvent, data: any, eventPort?: MessagePort | void): void;
3217
+ /**
3218
+ * Returns the ThoughtSpot hostname or IP address.
3219
+ */
3220
+ protected getThoughtSpotHost(): string;
3221
+ /**
3222
+ * Gets the v1 event type (if applicable) for the EmbedEvent type
3223
+ *
3224
+ * @param eventType The v2 event type
3225
+ * @returns The corresponding v1 event type if one exists
3226
+ * or else the v2 event type itself
3227
+ */
3228
+ protected getCompatibleEventType(eventType: EmbedEvent): EmbedEvent;
3229
+ /**
3230
+ * Calculates the iframe center for the current visible viewPort
3231
+ * of iframe using Scroll position of Host App, offsetTop for iframe
3232
+ * in Host app. ViewPort height of the tab.
3233
+ *
3234
+ * @returns iframe Center in visible viewport,
3235
+ * Iframe height,
3236
+ * View port height.
3237
+ */
3238
+ protected getIframeCenter(): {
3239
+ iframeCenter: number;
3240
+ iframeScrolled: number;
3241
+ iframeHeight: number;
3242
+ viewPortHeight: number;
3243
+ iframeVisibleViewPort: number;
3244
+ };
3245
+ /**
3246
+ * Registers an event listener to trigger an alert when the ThoughtSpot app
3247
+ * sends an event of a particular message type to the host application.
3248
+ *
3249
+ * @param messageType The message type
3250
+ * @param callback A callback as a function
3251
+ * @param options The message options
3252
+ * @example
3253
+ * ```js
3254
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
3255
+ * console.error(data);
3256
+ * });
3257
+ * ```
3258
+ * @example
3259
+ * ```js
3260
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
3261
+ * console.log("Answer save clicked", data);
3262
+ * }, {
3263
+ * start: true // This will trigger the callback on start of save
3264
+ * });
3265
+ * ```
3266
+ */
3267
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
3268
+ /**
3269
+ * Removes an event listener for a particular event type.
3270
+ *
3271
+ * @param messageType The message type
3272
+ * @param callback The callback to remove
3273
+ * @example
3274
+ * ```js
3275
+ * const errorHandler = (data) => { console.error(data); };
3276
+ * tsEmbed.on(EmbedEvent.Error, errorHandler);
3277
+ * tsEmbed.off(EmbedEvent.Error, errorHandler);
3278
+ * ```
3279
+ */
3280
+ off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
3281
+ /**
3282
+ * Triggers an event to the embedded app
3283
+ *
3284
+ * @param messageType The event type
3285
+ * @param data The payload to send with the message
3286
+ */
3287
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
3288
+ /**
3289
+ * Marks the ThoughtSpot object to have been rendered
3290
+ * Needs to be overridden by subclasses to do the actual
3291
+ * rendering of the iframe.
3292
+ *
3293
+ * @param args
3294
+ */
3295
+ render(): TsEmbed;
3296
+ /**
3297
+ * Get the Post Url Params for THOUGHTSPOT from the current
3298
+ * host app URL.
3299
+ * THOUGHTSPOT URL params starts with a prefix "ts-"
3300
+ *
3301
+ * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
3302
+ */
3303
+ getThoughtSpotPostUrlParams(): string;
3304
+ /**
3305
+ * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
3306
+ *
3307
+ * @version SDK: 1.19.1 | ThoughtSpot: *
3308
+ */
3309
+ destroy(): void;
3310
+ getUnderlyingFrameElement(): HTMLIFrameElement;
3311
+ /**
3312
+ * Prerenders a generic instance of the TS component.
3313
+ * This means without the path but with the flags already applied.
3314
+ * This is useful for prerendering the component in the background.
3315
+ *
3316
+ * @version SDK: 1.22.0
3317
+ * @returns
3318
+ */
3319
+ prerenderGeneric(): Promise<any>;
3320
+ }
3321
+ /**
3322
+ * Base class for embedding v1 experience
3323
+ * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
3324
+ * which is currently under migration to v2
3325
+ *
3326
+ * @inheritdoc
3327
+ */
3328
+ export class V1Embed extends TsEmbed {
3329
+ protected viewConfig: ViewConfig;
3330
+ constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
3331
+ /**
3332
+ * Render the app in an iframe and set up event handlers
3333
+ *
3334
+ * @param iframeSrc
3335
+ */
3336
+ protected renderV1Embed(iframeSrc: string): any;
3337
+ protected getRootIframeSrc(): string;
3338
+ /**
3339
+ * @inheritdoc
3340
+ * @example
3341
+ * ```js
3342
+ * tsEmbed.on(EmbedEvent.Error, (data) => {
3343
+ * console.error(data);
3344
+ * });
3345
+ * ```
3346
+ * @example
3347
+ * ```js
3348
+ * tsEmbed.on(EmbedEvent.Save, (data) => {
3349
+ * console.log("Answer save clicked", data);
3350
+ * }, {
3351
+ * start: true // This will trigger the callback on start of save
3352
+ * });
3353
+ * ```
3354
+ */
3355
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
3322
3356
  }
3323
3357
 
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.21.0",
3
+ "version": "1.21.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -84,6 +84,7 @@
84
84
  "lodash": "^4.17.21",
85
85
  "mixpanel-browser": "^2.45.0",
86
86
  "ts-deepmerge": "^6.0.2",
87
+ "tslib": "^2.5.3",
87
88
  "use-deep-compare-effect": "^1.8.1"
88
89
  },
89
90
  "devDependencies": {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * The list of customization css variables. These
3
+ * are the only allowed variables possible.
4
+ */
1
5
  export interface CustomCssVariables {
2
6
  /**
3
7
  * Background color of the Liveboard, visualization, Search, and Answer pages.
@@ -295,6 +299,5 @@ export interface CustomCssVariables {
295
299
  * Background color of the footer area on dialogs.
296
300
  */
297
301
  '--ts-var-dialog-footer-background'?: string;
298
- [key: string]: string;
299
302
  }
300
303
  //# sourceMappingURL=css-variables.d.ts.map