@thoughtspot/visual-embed-sdk 1.20.0-prerender.2 → 1.20.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.
- package/README.md +1 -1
- package/dist/src/auth.d.ts +2 -38
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +5 -17
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +9 -20
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +5 -17
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +0 -3
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +5 -9
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +6 -43
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +0 -8
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +0 -4
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +2 -11
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/types.d.ts +76 -273
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/answerService.d.ts +0 -7
- package/dist/src/utils/answerService.d.ts.map +1 -1
- package/dist/src/utils/authService.d.ts +0 -30
- package/dist/src/utils/authService.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +0 -12
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +0 -7
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +0 -12
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed.es.js +262 -637
- package/dist/tsembed.js +261 -629
- package/lib/package.json +8 -3
- package/lib/src/auth.d.ts +2 -38
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +25 -70
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +5 -14
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/config.d.ts +0 -1
- package/lib/src/config.d.ts.map +1 -1
- package/lib/src/config.js +3 -5
- package/lib/src/config.js.map +1 -1
- package/lib/src/config.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +5 -17
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +15 -25
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +12 -12
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +9 -20
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +15 -31
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +1 -1
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +5 -17
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +37 -49
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +30 -37
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +26 -14
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +0 -3
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +6 -5
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +5 -9
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +14 -18
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +19 -16
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -4
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +6 -43
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +72 -117
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +24 -23
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +0 -8
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +1 -13
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +6 -6
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +6 -15
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/react/util.d.ts +0 -4
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/react/util.js +0 -4
- package/lib/src/react/util.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +2 -11
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/test/test-utils.js +25 -36
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/types.d.ts +76 -273
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +54 -200
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/answerService.d.ts +0 -7
- package/lib/src/utils/answerService.d.ts.map +1 -1
- package/lib/src/utils/answerService.js +0 -7
- package/lib/src/utils/answerService.js.map +1 -1
- package/lib/src/utils/answerService.spec.js.map +1 -1
- package/lib/src/utils/authService.d.ts +0 -30
- package/lib/src/utils/authService.d.ts.map +1 -1
- package/lib/src/utils/authService.js +2 -39
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js.map +1 -1
- package/lib/src/utils/processData.d.ts +0 -12
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +5 -33
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +0 -7
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +3 -17
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils.d.ts +0 -12
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +19 -24
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +102 -406
- package/package.json +8 -3
- package/src/auth.spec.ts +150 -68
- package/src/auth.ts +108 -102
- package/src/config.spec.ts +4 -2
- package/src/config.ts +3 -5
- package/src/embed/app.spec.ts +14 -25
- package/src/embed/app.ts +35 -47
- package/src/embed/base.spec.ts +9 -3
- package/src/embed/base.ts +53 -51
- package/src/embed/embed.spec.ts +6 -5
- package/src/embed/liveboard.spec.ts +37 -56
- package/src/embed/liveboard.ts +64 -66
- package/src/embed/pinboard.spec.ts +29 -26
- package/src/embed/search-bar.tsx +8 -10
- package/src/embed/search.spec.ts +21 -31
- package/src/embed/search.ts +25 -26
- package/src/embed/searchEmbed-basic-auth.spec.ts +28 -22
- package/src/embed/ts-embed.spec.ts +148 -70
- package/src/embed/ts-embed.ts +157 -147
- package/src/errors.ts +6 -3
- package/src/index.ts +10 -4
- package/src/mixpanel-service.spec.ts +3 -1
- package/src/mixpanel-service.ts +1 -13
- package/src/react/index.spec.tsx +13 -37
- package/src/react/index.tsx +57 -38
- package/src/react/util.ts +4 -8
- package/src/test/test-utils.ts +39 -43
- package/src/types.ts +78 -270
- package/src/utils/answerService.spec.ts +5 -3
- package/src/utils/answerService.ts +17 -21
- package/src/utils/authService.spec.ts +41 -26
- package/src/utils/authService.ts +21 -47
- package/src/utils/processData.spec.ts +59 -26
- package/src/utils/processData.ts +14 -36
- package/src/utils/processTrigger.spec.ts +6 -1
- package/src/utils/processTrigger.ts +9 -18
- package/src/utils.spec.ts +12 -8
- package/src/utils.ts +26 -25
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @summary Base classes
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
|
-
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, EmbedConfig, MessageOptions, ViewConfig } from '../types';
|
|
9
|
+
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, EmbedConfig, MessageOptions, ViewConfig, FrameParams } from '../types';
|
|
10
10
|
/**
|
|
11
11
|
* Global prefix for all Thoughtspot postHash Params.
|
|
12
12
|
*/
|
|
@@ -28,7 +28,6 @@ export declare class TsEmbed {
|
|
|
28
28
|
* The DOM node where the ThoughtSpot app is to be embedded.
|
|
29
29
|
*/
|
|
30
30
|
private el;
|
|
31
|
-
protected isAppInitialized: boolean;
|
|
32
31
|
/**
|
|
33
32
|
* A reference to the iframe within which the ThoughtSpot app
|
|
34
33
|
* will be rendered.
|
|
@@ -59,7 +58,6 @@ export declare class TsEmbed {
|
|
|
59
58
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
60
59
|
* will generate for embedding. This provides additional security to
|
|
61
60
|
* thoughtspot clusters against Cross site scripting attacks.
|
|
62
|
-
*
|
|
63
61
|
* @default false
|
|
64
62
|
*/
|
|
65
63
|
private shouldEncodeUrlQueryParams;
|
|
@@ -71,19 +69,16 @@ export declare class TsEmbed {
|
|
|
71
69
|
private throwInitError;
|
|
72
70
|
/**
|
|
73
71
|
* Handles errors within the SDK
|
|
74
|
-
*
|
|
75
72
|
* @param error The error message or object
|
|
76
73
|
*/
|
|
77
74
|
protected handleError(error: string | Record<string, unknown>): void;
|
|
78
75
|
/**
|
|
79
76
|
* Extracts the type field from the event payload
|
|
80
|
-
*
|
|
81
77
|
* @param event The window message event
|
|
82
78
|
*/
|
|
83
79
|
private getEventType;
|
|
84
80
|
/**
|
|
85
81
|
* Extracts the port field from the event payload
|
|
86
|
-
*
|
|
87
82
|
* @param event The window message event
|
|
88
83
|
* @returns
|
|
89
84
|
*/
|
|
@@ -91,9 +86,6 @@ export declare class TsEmbed {
|
|
|
91
86
|
/**
|
|
92
87
|
* fix for ts7.sep.cl
|
|
93
88
|
* will be removed for ts7.oct.cl
|
|
94
|
-
*
|
|
95
|
-
* @param event
|
|
96
|
-
* @param eventType
|
|
97
89
|
* @hidden
|
|
98
90
|
*/
|
|
99
91
|
private formatEventData;
|
|
@@ -106,16 +98,10 @@ export declare class TsEmbed {
|
|
|
106
98
|
private subscribeToEvents;
|
|
107
99
|
/**
|
|
108
100
|
* Send Custom style as part of payload of APP_INIT
|
|
109
|
-
*
|
|
110
|
-
* @param _
|
|
111
|
-
* @param responder
|
|
112
101
|
*/
|
|
113
102
|
private appInitCb;
|
|
114
103
|
/**
|
|
115
104
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
116
|
-
*
|
|
117
|
-
* @param _
|
|
118
|
-
* @param responder
|
|
119
105
|
*/
|
|
120
106
|
private updateAuthToken;
|
|
121
107
|
/**
|
|
@@ -124,47 +110,36 @@ export declare class TsEmbed {
|
|
|
124
110
|
private registerAppInit;
|
|
125
111
|
/**
|
|
126
112
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
127
|
-
*
|
|
128
|
-
* @param query
|
|
129
113
|
*/
|
|
130
114
|
protected getEmbedBasePath(query: string): string;
|
|
131
115
|
/**
|
|
132
116
|
* Common query params set for all the embed modes.
|
|
133
|
-
*
|
|
134
|
-
* @param queryParams
|
|
135
117
|
* @returns queryParams
|
|
136
118
|
*/
|
|
137
|
-
protected getBaseQueryParams(
|
|
119
|
+
protected getBaseQueryParams(): {};
|
|
138
120
|
/**
|
|
139
121
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
140
122
|
* This is used for embedding Liveboards, visualizations, and full application.
|
|
141
|
-
*
|
|
142
123
|
* @param queryString The query string to append to the URL.
|
|
143
124
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
144
125
|
* the full application.
|
|
145
126
|
*/
|
|
146
|
-
protected getV1EmbedBasePath(queryString: string): string;
|
|
147
|
-
protected getEmbedParams(): string;
|
|
148
|
-
protected getRootIframeSrc(): string;
|
|
149
|
-
protected createIframeEl(frameSrc: string): HTMLIFrameElement;
|
|
127
|
+
protected getV1EmbedBasePath(queryString: string, showPrimaryNavbar?: boolean, disableProfileAndHelp?: boolean, isAppEmbed?: boolean, enableSearchAssist?: boolean): string;
|
|
150
128
|
/**
|
|
151
129
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
152
130
|
* event listeners.
|
|
153
|
-
*
|
|
154
131
|
* @param url
|
|
155
132
|
* @param frameOptions
|
|
156
133
|
*/
|
|
157
|
-
protected renderIFrame(url: string): Promise<any>;
|
|
134
|
+
protected renderIFrame(url: string, frameOptions?: FrameParams): Promise<any>;
|
|
158
135
|
protected insertIntoDOM(child: string | Node): void;
|
|
159
136
|
/**
|
|
160
137
|
* Sets the height of the iframe
|
|
161
|
-
*
|
|
162
138
|
* @param height The height in pixels
|
|
163
139
|
*/
|
|
164
140
|
protected setIFrameHeight(height: number): void;
|
|
165
141
|
/**
|
|
166
142
|
* Executes all registered event handlers for a particular event type
|
|
167
|
-
*
|
|
168
143
|
* @param eventType The event type
|
|
169
144
|
* @param data The payload invoked with the event handler
|
|
170
145
|
* @param eventPort The event Port for a specific MessageChannel
|
|
@@ -176,7 +151,6 @@ export declare class TsEmbed {
|
|
|
176
151
|
protected getThoughtSpotHost(): string;
|
|
177
152
|
/**
|
|
178
153
|
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
179
|
-
*
|
|
180
154
|
* @param eventType The v2 event type
|
|
181
155
|
* @returns The corresponding v1 event type if one exists
|
|
182
156
|
* or else the v2 event type itself
|
|
@@ -186,7 +160,6 @@ export declare class TsEmbed {
|
|
|
186
160
|
* Calculates the iframe center for the current visible viewPort
|
|
187
161
|
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
188
162
|
* in Host app. ViewPort height of the tab.
|
|
189
|
-
*
|
|
190
163
|
* @returns iframe Center in visible viewport,
|
|
191
164
|
* Iframe height,
|
|
192
165
|
* View port height.
|
|
@@ -224,16 +197,12 @@ export declare class TsEmbed {
|
|
|
224
197
|
/**
|
|
225
198
|
* Triggers an event on specific Port registered against
|
|
226
199
|
* for the EmbedEvent
|
|
227
|
-
*
|
|
228
200
|
* @param eventType The message type
|
|
229
201
|
* @param data The payload to send
|
|
230
|
-
* @param eventPort
|
|
231
|
-
* @param payload
|
|
232
202
|
*/
|
|
233
203
|
private triggerEventOnPort;
|
|
234
204
|
/**
|
|
235
205
|
* Triggers an event to the embedded app
|
|
236
|
-
*
|
|
237
206
|
* @param messageType The event type
|
|
238
207
|
* @param data The payload to send with the message
|
|
239
208
|
*/
|
|
@@ -242,7 +211,6 @@ export declare class TsEmbed {
|
|
|
242
211
|
* Marks the ThoughtSpot object to have been rendered
|
|
243
212
|
* Needs to be overridden by subclasses to do the actual
|
|
244
213
|
* rendering of the iframe.
|
|
245
|
-
*
|
|
246
214
|
* @param args
|
|
247
215
|
*/
|
|
248
216
|
render(): TsEmbed;
|
|
@@ -250,18 +218,14 @@ export declare class TsEmbed {
|
|
|
250
218
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
251
219
|
* host app URL.
|
|
252
220
|
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
253
|
-
*
|
|
254
221
|
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
255
222
|
*/
|
|
256
223
|
getThoughtSpotPostUrlParams(): string;
|
|
257
224
|
/**
|
|
258
225
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
259
|
-
*
|
|
260
226
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
261
227
|
*/
|
|
262
228
|
destroy(): void;
|
|
263
|
-
getUnderlyingFrameElement(): HTMLIFrameElement;
|
|
264
|
-
prerenderGeneric(): Promise<any>;
|
|
265
229
|
}
|
|
266
230
|
/**
|
|
267
231
|
* Base class for embedding v1 experience
|
|
@@ -275,13 +239,12 @@ export declare class V1Embed extends TsEmbed {
|
|
|
275
239
|
constructor(domSelector: DOMSelector, viewConfig: ViewConfig);
|
|
276
240
|
/**
|
|
277
241
|
* Render the ap p in an iframe and set up event handlers
|
|
278
|
-
*
|
|
279
242
|
* @param iframeSrc
|
|
280
243
|
*/
|
|
281
244
|
protected renderV1Embed(iframeSrc: string): any;
|
|
282
|
-
protected getRootIframeSrc(): string;
|
|
283
245
|
/**
|
|
284
|
-
* @inheritdoc
|
|
246
|
+
* @inheritdoc TsEmbed.on
|
|
247
|
+
*
|
|
285
248
|
* @example
|
|
286
249
|
* ```js
|
|
287
250
|
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-embed.d.ts","sourceRoot":"","sources":["../../../src/embed/ts-embed.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"ts-embed.d.ts","sourceRoot":"","sources":["../../../src/embed/ts-embed.ts"],"names":[],"mappings":"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"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @summary Base classes
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
|
-
import { getEncodedQueryParamsString, getCssDimension, getOffsetTop, embedEventStatus, setAttributes, getCustomisations, getDOMNode,
|
|
9
|
+
import { getEncodedQueryParamsString, getCssDimension, getOffsetTop, embedEventStatus, setAttributes, getCustomisations, getDOMNode, } from '../utils';
|
|
10
10
|
import { getThoughtSpotHost, URL_MAX_LENGTH, DEFAULT_EMBED_WIDTH, DEFAULT_EMBED_HEIGHT, getV2BasePath, } from '../config';
|
|
11
11
|
import { AuthType, EmbedEvent, Action, Param, ContextMenuTriggerOptions, } from '../types';
|
|
12
12
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
@@ -25,7 +25,6 @@ const TS_EMBED_ID = '_thoughtspot-embed';
|
|
|
25
25
|
* The event id map from v2 event names to v1 event id
|
|
26
26
|
* v1 events are the classic embed events implemented in Blink v1
|
|
27
27
|
* We cannot rename v1 event types to maintain backward compatibility
|
|
28
|
-
*
|
|
29
28
|
* @internal
|
|
30
29
|
*/
|
|
31
30
|
const V1EventMap = {};
|
|
@@ -36,28 +35,22 @@ const V1EventMap = {};
|
|
|
36
35
|
*/
|
|
37
36
|
export class TsEmbed {
|
|
38
37
|
constructor(domSelector, viewConfig) {
|
|
39
|
-
this.isAppInitialized = false;
|
|
40
38
|
/**
|
|
41
39
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
42
40
|
* will generate for embedding. This provides additional security to
|
|
43
41
|
* thoughtspot clusters against Cross site scripting attacks.
|
|
44
|
-
*
|
|
45
42
|
* @default false
|
|
46
43
|
*/
|
|
47
44
|
this.shouldEncodeUrlQueryParams = false;
|
|
48
45
|
this.defaultHiddenActions = [Action.ReportError];
|
|
49
46
|
/**
|
|
50
47
|
* Send Custom style as part of payload of APP_INIT
|
|
51
|
-
*
|
|
52
|
-
* @param _
|
|
53
|
-
* @param responder
|
|
54
48
|
*/
|
|
55
49
|
this.appInitCb = async (_, responder) => {
|
|
56
50
|
let authToken = '';
|
|
57
51
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
58
52
|
authToken = await getAuthenticaionToken(this.embedConfig);
|
|
59
53
|
}
|
|
60
|
-
this.isAppInitialized = true;
|
|
61
54
|
responder({
|
|
62
55
|
type: EmbedEvent.APP_INIT,
|
|
63
56
|
data: {
|
|
@@ -68,9 +61,6 @@ export class TsEmbed {
|
|
|
68
61
|
};
|
|
69
62
|
/**
|
|
70
63
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
71
|
-
*
|
|
72
|
-
* @param _
|
|
73
|
-
* @param responder
|
|
74
64
|
*/
|
|
75
65
|
this.updateAuthToken = async (_, responder) => {
|
|
76
66
|
const { autoLogin = false, authType } = this.embedConfig; // Set autoLogin default to false
|
|
@@ -112,7 +102,6 @@ export class TsEmbed {
|
|
|
112
102
|
}
|
|
113
103
|
/**
|
|
114
104
|
* Handles errors within the SDK
|
|
115
|
-
*
|
|
116
105
|
* @param error The error message or object
|
|
117
106
|
*/
|
|
118
107
|
handleError(error) {
|
|
@@ -125,7 +114,6 @@ export class TsEmbed {
|
|
|
125
114
|
}
|
|
126
115
|
/**
|
|
127
116
|
* Extracts the type field from the event payload
|
|
128
|
-
*
|
|
129
117
|
* @param event The window message event
|
|
130
118
|
*/
|
|
131
119
|
getEventType(event) {
|
|
@@ -135,7 +123,6 @@ export class TsEmbed {
|
|
|
135
123
|
}
|
|
136
124
|
/**
|
|
137
125
|
* Extracts the port field from the event payload
|
|
138
|
-
*
|
|
139
126
|
* @param event The window message event
|
|
140
127
|
* @returns
|
|
141
128
|
*/
|
|
@@ -148,9 +135,6 @@ export class TsEmbed {
|
|
|
148
135
|
/**
|
|
149
136
|
* fix for ts7.sep.cl
|
|
150
137
|
* will be removed for ts7.oct.cl
|
|
151
|
-
*
|
|
152
|
-
* @param event
|
|
153
|
-
* @param eventType
|
|
154
138
|
* @hidden
|
|
155
139
|
*/
|
|
156
140
|
formatEventData(event, eventType) {
|
|
@@ -181,31 +165,33 @@ export class TsEmbed {
|
|
|
181
165
|
}
|
|
182
166
|
/**
|
|
183
167
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
184
|
-
*
|
|
185
|
-
* @param query
|
|
186
168
|
*/
|
|
187
169
|
getEmbedBasePath(query) {
|
|
188
170
|
let queryString = query;
|
|
189
171
|
if (this.shouldEncodeUrlQueryParams) {
|
|
190
172
|
queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryString.substr(1))}`;
|
|
191
173
|
}
|
|
192
|
-
const basePath = [
|
|
174
|
+
const basePath = [
|
|
175
|
+
this.thoughtSpotHost,
|
|
176
|
+
this.thoughtSpotV2Base,
|
|
177
|
+
queryString,
|
|
178
|
+
]
|
|
193
179
|
.filter((x) => x.length > 0)
|
|
194
180
|
.join('/');
|
|
195
|
-
return `${basePath}
|
|
181
|
+
return `${basePath}#/embed`;
|
|
196
182
|
}
|
|
197
183
|
/**
|
|
198
184
|
* Common query params set for all the embed modes.
|
|
199
|
-
*
|
|
200
|
-
* @param queryParams
|
|
201
185
|
* @returns queryParams
|
|
202
186
|
*/
|
|
203
|
-
getBaseQueryParams(
|
|
187
|
+
getBaseQueryParams() {
|
|
204
188
|
var _a, _b;
|
|
189
|
+
const queryParams = {};
|
|
205
190
|
let hostAppUrl = ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '';
|
|
206
|
-
// The below check is needed because TS Cloud firewall, blocks
|
|
207
|
-
//
|
|
208
|
-
if (hostAppUrl.includes('localhost') ||
|
|
191
|
+
// The below check is needed because TS Cloud firewall, blocks localhost/127.0.0.1
|
|
192
|
+
// in any url param.
|
|
193
|
+
if (hostAppUrl.includes('localhost') ||
|
|
194
|
+
hostAppUrl.includes('127.0.0.1')) {
|
|
209
195
|
hostAppUrl = 'local-host';
|
|
210
196
|
}
|
|
211
197
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
@@ -213,7 +199,8 @@ export class TsEmbed {
|
|
|
213
199
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
214
200
|
queryParams[Param.Version] = version;
|
|
215
201
|
queryParams[Param.AuthType] = this.embedConfig.authType;
|
|
216
|
-
if (this.embedConfig.disableLoginRedirect === true ||
|
|
202
|
+
if (this.embedConfig.disableLoginRedirect === true ||
|
|
203
|
+
this.embedConfig.autoLogin === true) {
|
|
217
204
|
queryParams[Param.DisableLoginRedirect] = true;
|
|
218
205
|
}
|
|
219
206
|
if (this.embedConfig.authType === AuthType.EmbeddedSSO) {
|
|
@@ -228,7 +215,8 @@ export class TsEmbed {
|
|
|
228
215
|
return queryParams;
|
|
229
216
|
}
|
|
230
217
|
// TODO remove embedConfig.customCssUrl
|
|
231
|
-
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) ||
|
|
218
|
+
const cssUrlParam = ((_b = customizations === null || customizations === void 0 ? void 0 : customizations.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) ||
|
|
219
|
+
this.embedConfig.customCssUrl;
|
|
232
220
|
if (cssUrlParam) {
|
|
233
221
|
queryParams[Param.CustomCSSUrl] = cssUrlParam;
|
|
234
222
|
}
|
|
@@ -238,14 +226,15 @@ export class TsEmbed {
|
|
|
238
226
|
if (disabledActionReason) {
|
|
239
227
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
240
228
|
}
|
|
241
|
-
queryParams[Param.HideActions] = [
|
|
229
|
+
queryParams[Param.HideActions] = [
|
|
230
|
+
...this.defaultHiddenActions,
|
|
231
|
+
...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
|
|
232
|
+
];
|
|
242
233
|
if (Array.isArray(visibleActions)) {
|
|
243
234
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
244
235
|
}
|
|
245
|
-
/**
|
|
246
|
-
*
|
|
247
|
-
* from version 9.2.0.cl the user have an option to override context
|
|
248
|
-
* menu click
|
|
236
|
+
/** Default behavior for context menu will be left-click
|
|
237
|
+
* from version 9.2.0.cl the user have an option to override context menu click
|
|
249
238
|
*/
|
|
250
239
|
if (contextMenuTrigger === ContextMenuTriggerOptions.LEFT_CLICK) {
|
|
251
240
|
queryParams[Param.ContextMenuTrigger] = true;
|
|
@@ -277,61 +266,32 @@ export class TsEmbed {
|
|
|
277
266
|
/**
|
|
278
267
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
279
268
|
* This is used for embedding Liveboards, visualizations, and full application.
|
|
280
|
-
*
|
|
281
269
|
* @param queryString The query string to append to the URL.
|
|
282
270
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
283
271
|
* the full application.
|
|
284
272
|
*/
|
|
285
|
-
getV1EmbedBasePath(queryString) {
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const
|
|
273
|
+
getV1EmbedBasePath(queryString, showPrimaryNavbar = false, disableProfileAndHelp = false, isAppEmbed = false, enableSearchAssist = false) {
|
|
274
|
+
const queryStringFrag = queryString ? `&${queryString}` : '';
|
|
275
|
+
const primaryNavParam = `&primaryNavHidden=${!showPrimaryNavbar}`;
|
|
276
|
+
const disableProfileAndHelpParam = `&profileAndHelpInNavBarHidden=${disableProfileAndHelp}`;
|
|
277
|
+
const enableSearchAssistParam = `&${Param.EnableSearchAssist}=${enableSearchAssist}`;
|
|
278
|
+
let queryParams = `?embedApp=true${isAppEmbed ? primaryNavParam : ''}${isAppEmbed ? disableProfileAndHelpParam : ''}${enableSearchAssist ? enableSearchAssistParam : ''}${queryStringFrag}`;
|
|
279
|
+
if (this.shouldEncodeUrlQueryParams) {
|
|
280
|
+
queryParams = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryParams.substr(1))}`;
|
|
281
|
+
}
|
|
282
|
+
let path = `${this.thoughtSpotHost}/${queryParams}#`;
|
|
283
|
+
if (!isAppEmbed) {
|
|
284
|
+
path = `${path}/embed`;
|
|
285
|
+
}
|
|
290
286
|
return path;
|
|
291
287
|
}
|
|
292
|
-
getEmbedParams() {
|
|
293
|
-
const queryParams = this.getBaseQueryParams();
|
|
294
|
-
return getQueryParamString(queryParams);
|
|
295
|
-
}
|
|
296
|
-
getRootIframeSrc() {
|
|
297
|
-
const query = this.getEmbedParams();
|
|
298
|
-
return this.getEmbedBasePath(query);
|
|
299
|
-
}
|
|
300
|
-
createIframeEl(frameSrc) {
|
|
301
|
-
const iFrame = document.createElement('iframe');
|
|
302
|
-
iFrame.src = frameSrc;
|
|
303
|
-
iFrame.id = TS_EMBED_ID;
|
|
304
|
-
// according to screenfull.js documentation
|
|
305
|
-
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be
|
|
306
|
-
// true
|
|
307
|
-
iFrame.allowFullscreen = true;
|
|
308
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
309
|
-
// @ts-ignore
|
|
310
|
-
iFrame.webkitallowfullscreen = true;
|
|
311
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
312
|
-
// @ts-ignore
|
|
313
|
-
iFrame.mozallowfullscreen = true;
|
|
314
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
315
|
-
// @ts-ignore
|
|
316
|
-
iFrame.allow = 'clipboard-read; clipboard-write';
|
|
317
|
-
const { height: frameHeight, width: frameWidth, ...restParams } = this.viewConfig.frameParams || {};
|
|
318
|
-
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
319
|
-
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
320
|
-
setAttributes(iFrame, restParams);
|
|
321
|
-
iFrame.style.width = `${width}`;
|
|
322
|
-
iFrame.style.height = `${height}`;
|
|
323
|
-
iFrame.style.border = '0';
|
|
324
|
-
iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
325
|
-
return iFrame;
|
|
326
|
-
}
|
|
327
288
|
/**
|
|
328
289
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
329
290
|
* event listeners.
|
|
330
|
-
*
|
|
331
291
|
* @param url
|
|
332
292
|
* @param frameOptions
|
|
333
293
|
*/
|
|
334
|
-
async renderIFrame(url) {
|
|
294
|
+
async renderIFrame(url, frameOptions = {}) {
|
|
335
295
|
if (this.isError) {
|
|
336
296
|
return null;
|
|
337
297
|
}
|
|
@@ -357,7 +317,30 @@ export class TsEmbed {
|
|
|
357
317
|
return;
|
|
358
318
|
}
|
|
359
319
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
360
|
-
this.iFrame =
|
|
320
|
+
this.iFrame =
|
|
321
|
+
this.iFrame || document.createElement('iframe');
|
|
322
|
+
this.iFrame.src = url;
|
|
323
|
+
this.iFrame.id = TS_EMBED_ID;
|
|
324
|
+
// according to screenfull.js documentation
|
|
325
|
+
// allowFullscreen, webkitallowfullscreen and mozallowfullscreen must be true
|
|
326
|
+
this.iFrame.allowFullscreen = true;
|
|
327
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
328
|
+
// @ts-ignore
|
|
329
|
+
this.iFrame.webkitallowfullscreen = true;
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
331
|
+
// @ts-ignore
|
|
332
|
+
this.iFrame.mozallowfullscreen = true;
|
|
333
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
334
|
+
// @ts-ignore
|
|
335
|
+
this.iFrame.allow = 'clipboard-read; clipboard-write';
|
|
336
|
+
const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
|
|
337
|
+
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
338
|
+
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
339
|
+
setAttributes(this.iFrame, restParams);
|
|
340
|
+
this.iFrame.style.width = `${width}`;
|
|
341
|
+
this.iFrame.style.height = `${height}`;
|
|
342
|
+
this.iFrame.style.border = '0';
|
|
343
|
+
this.iFrame.name = 'ThoughtSpot Embedded Analytics';
|
|
361
344
|
this.iFrame.addEventListener('load', () => {
|
|
362
345
|
nextInQueue();
|
|
363
346
|
const loadTimestamp = Date.now();
|
|
@@ -384,9 +367,7 @@ export class TsEmbed {
|
|
|
384
367
|
this.subscribeToEvents();
|
|
385
368
|
}).catch((error) => {
|
|
386
369
|
nextInQueue();
|
|
387
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
|
|
388
|
-
error: JSON.stringify(error),
|
|
389
|
-
});
|
|
370
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, { error: JSON.stringify(error) });
|
|
390
371
|
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
391
372
|
this.handleError(error);
|
|
392
373
|
});
|
|
@@ -420,7 +401,6 @@ export class TsEmbed {
|
|
|
420
401
|
}
|
|
421
402
|
/**
|
|
422
403
|
* Sets the height of the iframe
|
|
423
|
-
*
|
|
424
404
|
* @param height The height in pixels
|
|
425
405
|
*/
|
|
426
406
|
setIFrameHeight(height) {
|
|
@@ -428,7 +408,6 @@ export class TsEmbed {
|
|
|
428
408
|
}
|
|
429
409
|
/**
|
|
430
410
|
* Executes all registered event handlers for a particular event type
|
|
431
|
-
*
|
|
432
411
|
* @param eventType The event type
|
|
433
412
|
* @param data The payload invoked with the event handler
|
|
434
413
|
* @param eventPort The event Port for a specific MessageChannel
|
|
@@ -439,13 +418,11 @@ export class TsEmbed {
|
|
|
439
418
|
callbacks.push(...allHandlers);
|
|
440
419
|
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
441
420
|
callbacks.forEach((callbackObj) => {
|
|
442
|
-
if (
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
// payload
|
|
448
|
-
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
421
|
+
if ((callbackObj.options.start &&
|
|
422
|
+
dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
|
|
423
|
+
(!callbackObj.options.start &&
|
|
424
|
+
dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
|
|
425
|
+
) {
|
|
449
426
|
callbackObj.callback(data, (payload) => {
|
|
450
427
|
this.triggerEventOnPort(eventPort, payload);
|
|
451
428
|
});
|
|
@@ -460,7 +437,6 @@ export class TsEmbed {
|
|
|
460
437
|
}
|
|
461
438
|
/**
|
|
462
439
|
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
463
|
-
*
|
|
464
440
|
* @param eventType The v2 event type
|
|
465
441
|
* @returns The corresponding v1 event type if one exists
|
|
466
442
|
* or else the v2 event type itself
|
|
@@ -472,7 +448,6 @@ export class TsEmbed {
|
|
|
472
448
|
* Calculates the iframe center for the current visible viewPort
|
|
473
449
|
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
474
450
|
* in Host app. ViewPort height of the tab.
|
|
475
|
-
*
|
|
476
451
|
* @returns iframe Center in visible viewport,
|
|
477
452
|
* Iframe height,
|
|
478
453
|
* View port height.
|
|
@@ -486,7 +461,8 @@ export class TsEmbed {
|
|
|
486
461
|
let iframeVisibleViewPort;
|
|
487
462
|
let iframeOffset;
|
|
488
463
|
if (iframeScrolled < 0) {
|
|
489
|
-
iframeVisibleViewPort =
|
|
464
|
+
iframeVisibleViewPort =
|
|
465
|
+
viewPortHeight - (offsetTopClient - scrollTopClient);
|
|
490
466
|
iframeVisibleViewPort = Math.min(iframeHeight, iframeVisibleViewPort);
|
|
491
467
|
iframeOffset = 0;
|
|
492
468
|
}
|
|
@@ -537,11 +513,8 @@ export class TsEmbed {
|
|
|
537
513
|
/**
|
|
538
514
|
* Triggers an event on specific Port registered against
|
|
539
515
|
* for the EmbedEvent
|
|
540
|
-
*
|
|
541
516
|
* @param eventType The message type
|
|
542
517
|
* @param data The payload to send
|
|
543
|
-
* @param eventPort
|
|
544
|
-
* @param payload
|
|
545
518
|
*/
|
|
546
519
|
triggerEventOnPort(eventPort, payload) {
|
|
547
520
|
if (eventPort) {
|
|
@@ -562,7 +535,6 @@ export class TsEmbed {
|
|
|
562
535
|
}
|
|
563
536
|
/**
|
|
564
537
|
* Triggers an event to the embedded app
|
|
565
|
-
*
|
|
566
538
|
* @param messageType The event type
|
|
567
539
|
* @param data The payload to send with the message
|
|
568
540
|
*/
|
|
@@ -574,7 +546,6 @@ export class TsEmbed {
|
|
|
574
546
|
* Marks the ThoughtSpot object to have been rendered
|
|
575
547
|
* Needs to be overridden by subclasses to do the actual
|
|
576
548
|
* rendering of the iframe.
|
|
577
|
-
*
|
|
578
549
|
* @param args
|
|
579
550
|
*/
|
|
580
551
|
render() {
|
|
@@ -585,7 +556,6 @@ export class TsEmbed {
|
|
|
585
556
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
586
557
|
* host app URL.
|
|
587
558
|
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
588
|
-
*
|
|
589
559
|
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
590
560
|
*/
|
|
591
561
|
getThoughtSpotPostUrlParams() {
|
|
@@ -609,7 +579,6 @@ export class TsEmbed {
|
|
|
609
579
|
}
|
|
610
580
|
/**
|
|
611
581
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
612
|
-
*
|
|
613
582
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
614
583
|
*/
|
|
615
584
|
destroy() {
|
|
@@ -620,13 +589,6 @@ export class TsEmbed {
|
|
|
620
589
|
console.log('Error destroying TS Embed', e);
|
|
621
590
|
}
|
|
622
591
|
}
|
|
623
|
-
getUnderlyingFrameElement() {
|
|
624
|
-
return this.iFrame;
|
|
625
|
-
}
|
|
626
|
-
async prerenderGeneric() {
|
|
627
|
-
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
628
|
-
return this.renderIFrame(prerenderFrameSrc);
|
|
629
|
-
}
|
|
630
592
|
}
|
|
631
593
|
/**
|
|
632
594
|
* Base class for embedding v1 experience
|
|
@@ -642,21 +604,14 @@ export class V1Embed extends TsEmbed {
|
|
|
642
604
|
}
|
|
643
605
|
/**
|
|
644
606
|
* Render the ap p in an iframe and set up event handlers
|
|
645
|
-
*
|
|
646
607
|
* @param iframeSrc
|
|
647
608
|
*/
|
|
648
609
|
renderV1Embed(iframeSrc) {
|
|
649
|
-
return this.renderIFrame(iframeSrc);
|
|
650
|
-
}
|
|
651
|
-
getRootIframeSrc() {
|
|
652
|
-
const runtimeFilters = this.viewConfig.runtimeFilters;
|
|
653
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
654
|
-
const queryParams = this.getEmbedParams();
|
|
655
|
-
const queryString = [filterQuery, queryParams].filter(Boolean).join('&');
|
|
656
|
-
return this.getV1EmbedBasePath(queryString);
|
|
610
|
+
return this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
|
|
657
611
|
}
|
|
658
612
|
/**
|
|
659
|
-
* @inheritdoc
|
|
613
|
+
* @inheritdoc TsEmbed.on
|
|
614
|
+
*
|
|
660
615
|
* @example
|
|
661
616
|
* ```js
|
|
662
617
|
* tsEmbed.on(EmbedEvent.Error, (data) => {
|