@thoughtspot/visual-embed-sdk 1.28.4 → 1.28.5-alpha-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/cjs/package.json +1 -1
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +2 -2
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts +1 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +9 -2
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/embed/app.d.ts +12 -6
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +2 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +6 -6
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +1 -1
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +8 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/search.d.ts +11 -5
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +4 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +6 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +9 -18
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/react/index.spec.js +0 -12
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +28 -10
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +1 -3
- package/cjs/src/types.js.map +1 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +1 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +12 -6
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +8 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +11 -5
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +28 -10
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +6911 -6907
- package/dist/tsembed-react.js +6930 -6926
- package/dist/tsembed.es.js +7193 -7189
- package/dist/tsembed.js +15449 -15445
- package/dist/visual-embed-sdk-react-full.d.ts +58 -22
- package/dist/visual-embed-sdk-react.d.ts +58 -22
- package/dist/visual-embed-sdk.d.ts +58 -22
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -3
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +9 -2
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/embed/app.d.ts +12 -6
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +2 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +5 -5
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +2 -2
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +8 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/search.d.ts +11 -5
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +5 -5
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +9 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +9 -18
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/react/index.spec.js +0 -12
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +28 -10
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +1 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +1 -1
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +62 -26
- package/package.json +1 -1
- package/src/auth.ts +6 -6
- package/src/authToken.ts +9 -2
- package/src/embed/app.ts +19 -8
- package/src/embed/base.spec.ts +3 -3
- package/src/embed/base.ts +14 -14
- package/src/embed/liveboard.ts +16 -3
- package/src/embed/search.ts +19 -10
- package/src/embed/ts-embed.spec.ts +26 -34
- package/src/embed/ts-embed.ts +43 -39
- package/src/react/index.spec.tsx +0 -29
- package/src/types.ts +29 -11
- package/src/utils/authService/authService.spec.ts +4 -4
package/src/embed/base.spec.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
3
3
|
import EventEmitter from 'eventemitter3';
|
|
4
|
+
import { EmbedConfig } from '../index';
|
|
4
5
|
import * as auth from '../auth';
|
|
6
|
+
import * as authService from '../utils/authService/authService';
|
|
5
7
|
import * as authTokenService from '../authToken';
|
|
6
8
|
import * as index from '../index';
|
|
7
|
-
import { EmbedConfig } from '../index';
|
|
8
|
-
import * as authService from '../utils/authService/authService';
|
|
9
9
|
import * as base from './base';
|
|
10
10
|
import * as embedConfigInstance from './embedConfig';
|
|
11
11
|
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
executeAfterWait,
|
|
14
14
|
getAllIframeEl,
|
|
15
15
|
getDocumentBody,
|
|
16
|
-
getIFrameSrc,
|
|
17
16
|
getRootEl,
|
|
17
|
+
getIFrameSrc,
|
|
18
18
|
} from '../test/test-utils';
|
|
19
19
|
import * as tokenizedFetchInstance from '../tokenizedFetch';
|
|
20
20
|
import { logger } from '../utils/logger';
|
package/src/embed/base.ts
CHANGED
|
@@ -10,28 +10,28 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import EventEmitter from 'eventemitter3';
|
|
12
12
|
import uniq from 'lodash/uniq';
|
|
13
|
+
import { resetCachedAuthToken } from '../authToken';
|
|
14
|
+
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
15
|
+
import { tokenizedFetch } from '../tokenizedFetch';
|
|
16
|
+
import { EndPoints } from '../utils/authService/authService';
|
|
17
|
+
import { getThoughtSpotHost } from '../config';
|
|
13
18
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
20
|
+
} from '../types';
|
|
21
|
+
import {
|
|
22
|
+
authenticate,
|
|
23
|
+
logout as _logout,
|
|
16
24
|
AuthFailureType,
|
|
17
25
|
AuthStatus,
|
|
18
|
-
|
|
19
|
-
authenticate,
|
|
26
|
+
AuthEvent,
|
|
20
27
|
notifyAuthFailure,
|
|
21
28
|
notifyAuthSDKSuccess,
|
|
22
29
|
notifyAuthSuccess,
|
|
23
30
|
notifyLogout,
|
|
24
31
|
setAuthEE,
|
|
32
|
+
AuthEventEmitter,
|
|
25
33
|
} from '../auth';
|
|
26
|
-
import {
|
|
27
|
-
import { getThoughtSpotHost } from '../config';
|
|
28
|
-
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
29
|
-
import { tokenizedFetch } from '../tokenizedFetch';
|
|
30
|
-
import {
|
|
31
|
-
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
32
|
-
} from '../types';
|
|
33
|
-
import { EndPoints } from '../utils/authService/authService';
|
|
34
|
-
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
34
|
+
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
35
35
|
import { getEmbedConfig, setEmbedConfig } from './embedConfig';
|
|
36
36
|
|
|
37
37
|
const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
|
|
@@ -251,7 +251,7 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
251
251
|
return renderQueue;
|
|
252
252
|
}
|
|
253
253
|
// Sending an empty function to keep it consistent with the above usage.
|
|
254
|
-
return fn(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
254
|
+
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
255
255
|
};
|
|
256
256
|
|
|
257
257
|
/**
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -11,9 +11,16 @@
|
|
|
11
11
|
|
|
12
12
|
import { ERROR_MESSAGE } from '../errors';
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
EmbedEvent,
|
|
15
|
+
MessagePayload,
|
|
16
|
+
Param,
|
|
17
|
+
RuntimeFilter,
|
|
18
|
+
DOMSelector,
|
|
19
|
+
HostEvent,
|
|
20
|
+
ViewConfig,
|
|
15
21
|
} from '../types';
|
|
16
22
|
import { getQueryParamString, isUndefined } from '../utils';
|
|
23
|
+
import { getAuthPromise } from './base';
|
|
17
24
|
import { V1Embed } from './ts-embed';
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -37,6 +44,7 @@ export interface LiveboardViewConfig
|
|
|
37
44
|
* incrementally as users scroll the page to view the charts and tables.
|
|
38
45
|
*
|
|
39
46
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
|
|
47
|
+
*
|
|
40
48
|
* @example
|
|
41
49
|
* ```js
|
|
42
50
|
* const embed = new LiveboardEmbed('#embed', {
|
|
@@ -65,6 +73,7 @@ export interface LiveboardViewConfig
|
|
|
65
73
|
defaultHeight?: number;
|
|
66
74
|
/**
|
|
67
75
|
* @Deprecated If set to true, the context menu in visualizations will be enabled.
|
|
76
|
+
*
|
|
68
77
|
* @example
|
|
69
78
|
* ```js
|
|
70
79
|
* const embed = new LiveboardEmbed('#tsEmbed', {
|
|
@@ -72,6 +81,7 @@ export interface LiveboardViewConfig
|
|
|
72
81
|
* enableVizTransformations:true,
|
|
73
82
|
* })
|
|
74
83
|
* ```
|
|
84
|
+
*
|
|
75
85
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
76
86
|
*/
|
|
77
87
|
enableVizTransformations?: boolean;
|
|
@@ -98,6 +108,7 @@ export interface LiveboardViewConfig
|
|
|
98
108
|
* The visualization within the Liveboard to display.
|
|
99
109
|
*
|
|
100
110
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
111
|
+
*
|
|
101
112
|
* @example
|
|
102
113
|
* ```js
|
|
103
114
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -127,6 +138,7 @@ export interface LiveboardViewConfig
|
|
|
127
138
|
* event.
|
|
128
139
|
*
|
|
129
140
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
141
|
+
*
|
|
130
142
|
* @example
|
|
131
143
|
* ```js
|
|
132
144
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -176,6 +188,7 @@ export interface LiveboardViewConfig
|
|
|
176
188
|
* Show or hide the tab panel of the embedded Liveboard.
|
|
177
189
|
*
|
|
178
190
|
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl, 9.8.0.sw
|
|
191
|
+
*
|
|
179
192
|
* @example
|
|
180
193
|
* ```js
|
|
181
194
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -201,9 +214,9 @@ export interface LiveboardViewConfig
|
|
|
201
214
|
hideLiveboardHeader?: boolean;
|
|
202
215
|
/**
|
|
203
216
|
* Show or hide the Liveboard title.
|
|
204
|
-
*
|
|
205
217
|
* @default false
|
|
206
218
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
|
|
219
|
+
*
|
|
207
220
|
* @example
|
|
208
221
|
* ```js
|
|
209
222
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -215,9 +228,9 @@ export interface LiveboardViewConfig
|
|
|
215
228
|
showLiveboardTitle?: boolean;
|
|
216
229
|
/**
|
|
217
230
|
* Show or hide the Liveboard description.
|
|
218
|
-
*
|
|
219
231
|
* @default false
|
|
220
232
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
|
|
233
|
+
*
|
|
221
234
|
* @example
|
|
222
235
|
* ```js
|
|
223
236
|
* const embed = new LiveboardEmbed('#embed-container', {
|
package/src/embed/search.ts
CHANGED
|
@@ -7,20 +7,24 @@
|
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { getReleaseVersion } from '../auth';
|
|
11
|
-
import { ERROR_MESSAGE } from '../errors';
|
|
12
10
|
import {
|
|
13
|
-
|
|
11
|
+
DataSourceVisualMode,
|
|
12
|
+
DOMSelector,
|
|
13
|
+
Param,
|
|
14
|
+
Action,
|
|
15
|
+
ViewConfig,
|
|
14
16
|
} from '../types';
|
|
15
17
|
import {
|
|
18
|
+
getQueryParamString,
|
|
16
19
|
checkReleaseVersionInBeta,
|
|
17
20
|
getFilterQuery,
|
|
18
|
-
getQueryParamString,
|
|
19
21
|
getRuntimeParameters,
|
|
20
22
|
} from '../utils';
|
|
23
|
+
import { TsEmbed } from './ts-embed';
|
|
24
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
21
25
|
import { getAuthPromise } from './base';
|
|
26
|
+
import { getReleaseVersion } from '../auth';
|
|
22
27
|
import { getEmbedConfig } from './embedConfig';
|
|
23
|
-
import { TsEmbed } from './ts-embed';
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* Configuration for search options.
|
|
@@ -59,6 +63,7 @@ export interface SearchViewConfig
|
|
|
59
63
|
* but can be expanded manually.
|
|
60
64
|
*
|
|
61
65
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
66
|
+
*
|
|
62
67
|
* @example
|
|
63
68
|
* ```js
|
|
64
69
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -72,6 +77,7 @@ export interface SearchViewConfig
|
|
|
72
77
|
* Show or hide the data sources panel.
|
|
73
78
|
*
|
|
74
79
|
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
|
|
80
|
+
*
|
|
75
81
|
* @example
|
|
76
82
|
* ```js
|
|
77
83
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -87,6 +93,7 @@ export interface SearchViewConfig
|
|
|
87
93
|
* using raw answer data.
|
|
88
94
|
*
|
|
89
95
|
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
|
|
96
|
+
*
|
|
90
97
|
* @example
|
|
91
98
|
* ```js
|
|
92
99
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -96,14 +103,11 @@ export interface SearchViewConfig
|
|
|
96
103
|
* ```
|
|
97
104
|
*/
|
|
98
105
|
hideResults?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* If set to true, expands all the data sources panel.
|
|
101
|
-
*/
|
|
102
|
-
expandAllDataSource?: boolean;
|
|
103
106
|
/**
|
|
104
107
|
* If set to true, the Search Assist feature is enabled.
|
|
105
108
|
*
|
|
106
109
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
110
|
+
*
|
|
107
111
|
* @example
|
|
108
112
|
* ```js
|
|
109
113
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -118,6 +122,7 @@ export interface SearchViewConfig
|
|
|
118
122
|
* format for presenting search data.
|
|
119
123
|
*
|
|
120
124
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
125
|
+
*
|
|
121
126
|
* @example
|
|
122
127
|
* ```js
|
|
123
128
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -131,6 +136,7 @@ export interface SearchViewConfig
|
|
|
131
136
|
* Only a single data source is supported currently.
|
|
132
137
|
*
|
|
133
138
|
* @deprecated Use `dataSource` instead.
|
|
139
|
+
*
|
|
134
140
|
* @example
|
|
135
141
|
* ```js
|
|
136
142
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -144,6 +150,7 @@ export interface SearchViewConfig
|
|
|
144
150
|
* The array of data source GUIDs to set on load.
|
|
145
151
|
*
|
|
146
152
|
* @version: SDK: 1.19.0
|
|
153
|
+
*
|
|
147
154
|
* @example
|
|
148
155
|
* ```js
|
|
149
156
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -185,6 +192,7 @@ export interface SearchViewConfig
|
|
|
185
192
|
* The GUID of a saved answer to load initially.
|
|
186
193
|
*
|
|
187
194
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
195
|
+
*
|
|
188
196
|
* @example
|
|
189
197
|
* ```js
|
|
190
198
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -199,6 +207,7 @@ export interface SearchViewConfig
|
|
|
199
207
|
* The chart/table should still be visible.
|
|
200
208
|
*
|
|
201
209
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
|
|
210
|
+
*
|
|
202
211
|
* @example
|
|
203
212
|
* ```js
|
|
204
213
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -213,6 +222,7 @@ export interface SearchViewConfig
|
|
|
213
222
|
*
|
|
214
223
|
* @default false
|
|
215
224
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
225
|
+
*
|
|
216
226
|
* @example
|
|
217
227
|
* ```js
|
|
218
228
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -295,7 +305,6 @@ export class SearchEmbed extends TsEmbed {
|
|
|
295
305
|
protected getEmbedParams(): string {
|
|
296
306
|
const {
|
|
297
307
|
hideResults,
|
|
298
|
-
expandAllDataSource,
|
|
299
308
|
enableSearchAssist,
|
|
300
309
|
forceTable,
|
|
301
310
|
searchOptions,
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/* eslint-disable dot-notation */
|
|
2
|
-
import * as authInstance from '../auth';
|
|
3
2
|
import { resetCachedAuthToken } from '../authToken';
|
|
4
|
-
import * as config from '../config';
|
|
5
3
|
import {
|
|
6
|
-
AppEmbed,
|
|
7
4
|
AuthType,
|
|
5
|
+
init,
|
|
8
6
|
EmbedEvent,
|
|
9
|
-
LiveboardEmbed,
|
|
10
|
-
LiveboardViewConfig,
|
|
11
|
-
PinboardEmbed,
|
|
12
7
|
SearchEmbed,
|
|
13
|
-
|
|
8
|
+
PinboardEmbed,
|
|
9
|
+
LiveboardViewConfig,
|
|
10
|
+
AppEmbed,
|
|
11
|
+
LiveboardEmbed,
|
|
14
12
|
} from '../index';
|
|
15
|
-
import * as mixpanelInstance from '../mixpanel-service';
|
|
16
|
-
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
17
13
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
|
|
15
|
+
} from '../types';
|
|
16
|
+
import {
|
|
20
17
|
executeAfterWait,
|
|
21
|
-
expectUrlMatchesWithParams,
|
|
22
18
|
getDocumentBody,
|
|
23
19
|
getIFrameEl,
|
|
24
20
|
getIFrameSrc,
|
|
25
21
|
getRootEl,
|
|
26
|
-
mockMessageChannel,
|
|
27
22
|
postMessageToParent,
|
|
23
|
+
defaultParamsForPinboardEmbed,
|
|
28
24
|
waitFor,
|
|
25
|
+
expectUrlMatchesWithParams,
|
|
26
|
+
mockMessageChannel,
|
|
27
|
+
createRootEleForEmbed,
|
|
29
28
|
} from '../test/test-utils';
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
import * as config from '../config';
|
|
30
|
+
import * as tsEmbedInstance from './ts-embed';
|
|
31
|
+
import * as mixpanelInstance from '../mixpanel-service';
|
|
32
|
+
import * as authInstance from '../auth';
|
|
33
|
+
import * as baseInstance from './base';
|
|
34
|
+
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
33
35
|
import * as authService from '../utils/authService/authService';
|
|
34
36
|
import { logger } from '../utils/logger';
|
|
35
|
-
import * as baseInstance from './base';
|
|
36
|
-
import * as tsEmbedInstance from './ts-embed';
|
|
37
37
|
|
|
38
38
|
const defaultViewConfig = {
|
|
39
39
|
frameParams: {
|
|
@@ -417,10 +417,8 @@ describe('Unit test case for ts embed', () => {
|
|
|
417
417
|
authToken: '',
|
|
418
418
|
hostConfig: undefined,
|
|
419
419
|
runtimeFilterParams: null,
|
|
420
|
-
hiddenHomeLeftNavItems:
|
|
421
|
-
HomeLeftNavItem.Home,
|
|
422
|
-
HomeLeftNavItem.MonitorSubscription,
|
|
423
|
-
],
|
|
420
|
+
hiddenHomeLeftNavItems:
|
|
421
|
+
[HomeLeftNavItem.Home, HomeLeftNavItem.MonitorSubscription],
|
|
424
422
|
hiddenHomepageModules: [],
|
|
425
423
|
reorderedHomepageModules: [],
|
|
426
424
|
},
|
|
@@ -649,10 +647,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
649
647
|
type: EmbedEvent.APP_INIT,
|
|
650
648
|
data: {},
|
|
651
649
|
};
|
|
652
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
653
|
-
...defaultViewConfig,
|
|
654
|
-
preRenderId: 'test',
|
|
655
|
-
});
|
|
650
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
656
651
|
searchEmbed.preRender();
|
|
657
652
|
const mockPort: any = {
|
|
658
653
|
postMessage: jest.fn(),
|
|
@@ -709,10 +704,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
709
704
|
type: EmbedEvent.AuthExpire,
|
|
710
705
|
data: {},
|
|
711
706
|
};
|
|
712
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
713
|
-
...defaultViewConfig,
|
|
714
|
-
preRenderId: 'test',
|
|
715
|
-
});
|
|
707
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
716
708
|
jest.spyOn(baseInstance, 'notifyAuthFailure');
|
|
717
709
|
searchEmbed.preRender();
|
|
718
710
|
const mockPort: any = {
|
|
@@ -1216,7 +1208,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1216
1208
|
expectUrlMatchesWithParams(
|
|
1217
1209
|
getIFrameSrc(),
|
|
1218
1210
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1219
|
-
|
|
1211
|
+
+ `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
|
|
1220
1212
|
);
|
|
1221
1213
|
});
|
|
1222
1214
|
|
|
@@ -1232,7 +1224,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1232
1224
|
expectUrlMatchesWithParams(
|
|
1233
1225
|
getIFrameSrc(),
|
|
1234
1226
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1235
|
-
|
|
1227
|
+
+ `&showAlerts=true${defaultParamsPost}#/home`,
|
|
1236
1228
|
);
|
|
1237
1229
|
});
|
|
1238
1230
|
it('Sets the locale param', async () => {
|
|
@@ -1247,7 +1239,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1247
1239
|
expectUrlMatchesWithParams(
|
|
1248
1240
|
getIFrameSrc(),
|
|
1249
1241
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1250
|
-
|
|
1242
|
+
+ `&locale=ja-JP${defaultParamsPost}#/home`,
|
|
1251
1243
|
);
|
|
1252
1244
|
});
|
|
1253
1245
|
it('Sets the iconSprite url', async () => {
|
|
@@ -1264,7 +1256,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1264
1256
|
expectUrlMatchesWithParams(
|
|
1265
1257
|
getIFrameSrc(),
|
|
1266
1258
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1267
|
-
|
|
1259
|
+
+ `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
|
|
1268
1260
|
);
|
|
1269
1261
|
});
|
|
1270
1262
|
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -8,54 +8,57 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import isEqual from 'lodash/isEqual';
|
|
11
|
-
import
|
|
12
|
-
import { AuthFailureType } from '../auth';
|
|
11
|
+
import { logger } from '../utils/logger';
|
|
13
12
|
import { getAuthenticationToken } from '../authToken';
|
|
13
|
+
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
14
|
+
import {
|
|
15
|
+
getEncodedQueryParamsString,
|
|
16
|
+
getCssDimension,
|
|
17
|
+
getOffsetTop,
|
|
18
|
+
embedEventStatus,
|
|
19
|
+
setAttributes,
|
|
20
|
+
getCustomisations,
|
|
21
|
+
getRuntimeFilters,
|
|
22
|
+
getDOMNode,
|
|
23
|
+
getFilterQuery,
|
|
24
|
+
getQueryParamString,
|
|
25
|
+
getRuntimeParameters,
|
|
26
|
+
setStyleProperties,
|
|
27
|
+
removeStyleProperties,
|
|
28
|
+
isUndefined,
|
|
29
|
+
} from '../utils';
|
|
14
30
|
import {
|
|
15
|
-
DEFAULT_EMBED_HEIGHT,
|
|
16
|
-
DEFAULT_EMBED_WIDTH,
|
|
17
|
-
URL_MAX_LENGTH,
|
|
18
31
|
getThoughtSpotHost,
|
|
32
|
+
URL_MAX_LENGTH,
|
|
33
|
+
DEFAULT_EMBED_WIDTH,
|
|
34
|
+
DEFAULT_EMBED_HEIGHT,
|
|
19
35
|
getV2BasePath,
|
|
20
36
|
} from '../config';
|
|
21
|
-
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
22
37
|
import {
|
|
23
|
-
Action,
|
|
24
38
|
AuthType,
|
|
25
|
-
ContextMenuTriggerOptions,
|
|
26
39
|
DOMSelector,
|
|
27
|
-
EmbedConfig,
|
|
28
|
-
EmbedEvent,
|
|
29
40
|
HostEvent,
|
|
41
|
+
EmbedEvent,
|
|
30
42
|
MessageCallback,
|
|
31
|
-
|
|
32
|
-
MessageOptions,
|
|
43
|
+
Action,
|
|
33
44
|
Param,
|
|
45
|
+
EmbedConfig,
|
|
46
|
+
MessageOptions,
|
|
47
|
+
MessagePayload,
|
|
48
|
+
MessageCallbackObj,
|
|
34
49
|
ViewConfig,
|
|
50
|
+
FrameParams,
|
|
51
|
+
ContextMenuTriggerOptions,
|
|
52
|
+
RuntimeFilter,
|
|
35
53
|
} from '../types';
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
getCssDimension,
|
|
39
|
-
getCustomisations,
|
|
40
|
-
getDOMNode,
|
|
41
|
-
getEncodedQueryParamsString,
|
|
42
|
-
getFilterQuery,
|
|
43
|
-
getOffsetTop,
|
|
44
|
-
getQueryParamString,
|
|
45
|
-
getRuntimeFilters,
|
|
46
|
-
getRuntimeParameters,
|
|
47
|
-
isUndefined,
|
|
48
|
-
removeStyleProperties,
|
|
49
|
-
setAttributes,
|
|
50
|
-
setStyleProperties,
|
|
51
|
-
} from '../utils';
|
|
52
|
-
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
53
|
-
import { logger } from '../utils/logger';
|
|
54
|
-
import { processAuthFailure, processEventData } from '../utils/processData';
|
|
54
|
+
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
55
|
+
import { processEventData, processAuthFailure } from '../utils/processData';
|
|
55
56
|
import { processTrigger } from '../utils/processTrigger';
|
|
57
|
+
import pkgInfo from '../../package.json';
|
|
56
58
|
import {
|
|
57
|
-
getAuthPromise, handleAuth, notifyAuthFailure,
|
|
59
|
+
getAuthPromise, renderInQueue, handleAuth, notifyAuthFailure,
|
|
58
60
|
} from './base';
|
|
61
|
+
import { AuthFailureType } from '../auth';
|
|
59
62
|
import { getEmbedConfig } from './embedConfig';
|
|
60
63
|
|
|
61
64
|
const { version } = pkgInfo;
|
|
@@ -562,7 +565,8 @@ export class TsEmbed {
|
|
|
562
565
|
|
|
563
566
|
const {
|
|
564
567
|
height: frameHeight,
|
|
565
|
-
width: frameWidth,
|
|
568
|
+
width: frameWidth,
|
|
569
|
+
...restParams
|
|
566
570
|
} = this.viewConfig.frameParams || {};
|
|
567
571
|
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
568
572
|
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
@@ -684,7 +688,7 @@ export class TsEmbed {
|
|
|
684
688
|
protected connectPreRendered(): boolean {
|
|
685
689
|
const preRenderIds = this.getPreRenderIds();
|
|
686
690
|
this.preRenderWrapper = this.preRenderWrapper
|
|
687
|
-
|
|
691
|
+
|| document.getElementById(preRenderIds.wrapper);
|
|
688
692
|
|
|
689
693
|
this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
|
|
690
694
|
|
|
@@ -1102,11 +1106,11 @@ export class TsEmbed {
|
|
|
1102
1106
|
) {
|
|
1103
1107
|
logger.warn(
|
|
1104
1108
|
`${viewConfig.embedComponentType || 'Component'} was pre-rendered with `
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1109
|
+
+ `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
|
|
1110
|
+
+ `but a different value "${JSON.stringify(viewConfig[key])}" `
|
|
1111
|
+
+ 'was passed to the Embed component. '
|
|
1112
|
+
+ 'The new value provided is ignored, the value provided during '
|
|
1113
|
+
+ 'preRender is used.',
|
|
1110
1114
|
);
|
|
1111
1115
|
}
|
|
1112
1116
|
});
|
package/src/react/index.spec.tsx
CHANGED
|
@@ -200,35 +200,6 @@ describe('React Components', () => {
|
|
|
200
200
|
).toBe(true);
|
|
201
201
|
expect(containerSibling.querySelector('div')).toBe(null);
|
|
202
202
|
});
|
|
203
|
-
|
|
204
|
-
it('Should have the correct container element', async () => {
|
|
205
|
-
const { container } = render(
|
|
206
|
-
<LiveboardEmbed liveboardId="abcd" className="def" />,
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
await waitFor(() => getIFrameEl(container));
|
|
210
|
-
expect(container.querySelector('div')).not.toBe(null);
|
|
211
|
-
expect(
|
|
212
|
-
container.querySelector('div').classList.contains('def'),
|
|
213
|
-
).toBe(true);
|
|
214
|
-
|
|
215
|
-
const { container: containerSibling } = render(
|
|
216
|
-
<LiveboardEmbed
|
|
217
|
-
liveboardId="abcd"
|
|
218
|
-
className="def"
|
|
219
|
-
insertAsSibling={true}
|
|
220
|
-
/>,
|
|
221
|
-
);
|
|
222
|
-
await waitFor(() => getIFrameEl(containerSibling));
|
|
223
|
-
expect(containerSibling.querySelector('span')).not.toBe(null);
|
|
224
|
-
expect(containerSibling.querySelector('span').style.position).toBe(
|
|
225
|
-
'absolute',
|
|
226
|
-
);
|
|
227
|
-
expect(
|
|
228
|
-
getIFrameEl(containerSibling).classList.contains('def'),
|
|
229
|
-
).toBe(true);
|
|
230
|
-
expect(containerSibling.querySelector('div')).toBe(null);
|
|
231
|
-
});
|
|
232
203
|
});
|
|
233
204
|
|
|
234
205
|
describe('SearchBarEmbed', () => {
|