@thoughtspot/visual-embed-sdk 1.21.0-react.5 → 1.21.0-react.6
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 +1 -1
- package/cjs/src/embed/base.d.ts +1 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +25 -25
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +10 -2
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.d.ts +6 -6
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js.map +1 -1
- package/dist/src/embed/base.d.ts +1 -0
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +6 -6
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +20 -11
- package/dist/tsembed-react.js +20 -11
- package/dist/tsembed.es.js +34 -25
- package/dist/tsembed.js +34 -25
- package/dist/visual-embed-sdk-react-full.d.ts +7 -6
- package/dist/visual-embed-sdk.d.ts +1 -0
- package/lib/package.json +1 -1
- package/lib/src/embed/base.d.ts +1 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +25 -24
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +10 -2
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.d.ts +6 -6
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/base.ts +26 -26
- package/src/mixpanel-service.ts +10 -2
- package/src/react/index.tsx +11 -11
package/lib/src/embed/base.js
CHANGED
|
@@ -14,12 +14,13 @@ import { getThoughtSpotHost } from '../config';
|
|
|
14
14
|
import { AuthType, PrefetchFeatures } from '../types';
|
|
15
15
|
import { authenticate, logout as _logout, AuthFailureType, notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, setAuthEE, EndPoints, getAuthenticaionToken, } from '../auth';
|
|
16
16
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
17
|
-
|
|
17
|
+
let config = {};
|
|
18
18
|
const CONFIG_DEFAULTS = {
|
|
19
19
|
loginFailedMessage: 'Not logged in',
|
|
20
20
|
authTriggerText: 'Authorize',
|
|
21
21
|
authType: AuthType.None,
|
|
22
22
|
};
|
|
23
|
+
export let authPromise;
|
|
23
24
|
/**
|
|
24
25
|
* Gets the configuration embed was initialized with.
|
|
25
26
|
*
|
|
@@ -27,15 +28,15 @@ const CONFIG_DEFAULTS = {
|
|
|
27
28
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
28
29
|
* @group Global methods
|
|
29
30
|
*/
|
|
30
|
-
export const getEmbedConfig = () =>
|
|
31
|
-
export const getAuthPromise = () =>
|
|
31
|
+
export const getEmbedConfig = () => config;
|
|
32
|
+
export const getAuthPromise = () => authPromise;
|
|
32
33
|
export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
|
|
33
34
|
/**
|
|
34
35
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
35
36
|
*/
|
|
36
37
|
export const handleAuth = () => {
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
authPromise = authenticate(config);
|
|
39
|
+
authPromise.then((isLoggedIn) => {
|
|
39
40
|
if (!isLoggedIn) {
|
|
40
41
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
41
42
|
}
|
|
@@ -45,7 +46,7 @@ export const handleAuth = () => {
|
|
|
45
46
|
}, () => {
|
|
46
47
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
47
48
|
});
|
|
48
|
-
return
|
|
49
|
+
return authPromise;
|
|
49
50
|
};
|
|
50
51
|
const hostUrlToFeatureUrl = {
|
|
51
52
|
[PrefetchFeatures.SearchEmbed]: (url) => `${url}v2/#/embed/answer`,
|
|
@@ -70,7 +71,7 @@ export const prefetch = (url, prefetchFeatures) => {
|
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
73
|
-
let hostUrl = url ||
|
|
74
|
+
let hostUrl = url || config.thoughtSpotHost;
|
|
74
75
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
75
76
|
uniq(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
76
77
|
const iFrame = document.createElement('iframe');
|
|
@@ -136,26 +137,26 @@ function backwardCompat(embedConfig) {
|
|
|
136
137
|
export const init = (embedConfig) => {
|
|
137
138
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
138
139
|
sanity(embedConfig);
|
|
139
|
-
|
|
140
|
+
config = {
|
|
140
141
|
...CONFIG_DEFAULTS,
|
|
141
142
|
...embedConfig,
|
|
142
143
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
143
144
|
};
|
|
144
|
-
|
|
145
|
+
config = backwardCompat(config);
|
|
145
146
|
const authEE = new EventEmitter();
|
|
146
147
|
setAuthEE(authEE);
|
|
147
148
|
handleAuth();
|
|
148
149
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
149
|
-
authType:
|
|
150
|
-
host:
|
|
150
|
+
authType: config.authType,
|
|
151
|
+
host: config.thoughtSpotHost,
|
|
151
152
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
152
153
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
153
154
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
154
155
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
155
156
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
156
157
|
});
|
|
157
|
-
if (
|
|
158
|
-
prefetch(
|
|
158
|
+
if (config.callPrefetch) {
|
|
159
|
+
prefetch(config.thoughtSpotHost);
|
|
159
160
|
}
|
|
160
161
|
return authEE;
|
|
161
162
|
};
|
|
@@ -163,7 +164,7 @@ export const init = (embedConfig) => {
|
|
|
163
164
|
*
|
|
164
165
|
*/
|
|
165
166
|
export function disableAutoLogin() {
|
|
166
|
-
|
|
167
|
+
config.autoLogin = false;
|
|
167
168
|
}
|
|
168
169
|
/**
|
|
169
170
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -181,7 +182,7 @@ export const logout = (doNotDisableAutoLogin = false) => {
|
|
|
181
182
|
if (!doNotDisableAutoLogin) {
|
|
182
183
|
disableAutoLogin();
|
|
183
184
|
}
|
|
184
|
-
return _logout(
|
|
185
|
+
return _logout(config).then((isLoggedIn) => {
|
|
185
186
|
notifyLogout();
|
|
186
187
|
return isLoggedIn;
|
|
187
188
|
});
|
|
@@ -194,7 +195,7 @@ let renderQueue = Promise.resolve();
|
|
|
194
195
|
* @param fn The function being registered
|
|
195
196
|
*/
|
|
196
197
|
export const renderInQueue = (fn) => {
|
|
197
|
-
const { queueMultiRenders = false } =
|
|
198
|
+
const { queueMultiRenders = false } = config;
|
|
198
199
|
if (queueMultiRenders) {
|
|
199
200
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
200
201
|
return renderQueue;
|
|
@@ -203,16 +204,16 @@ export const renderInQueue = (fn) => {
|
|
|
203
204
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
204
205
|
};
|
|
205
206
|
export const executeTML = async (data) => {
|
|
206
|
-
const { thoughtSpotHost, authType } =
|
|
207
|
+
const { thoughtSpotHost, authType } = config;
|
|
207
208
|
try {
|
|
208
|
-
sanity(
|
|
209
|
+
sanity(config);
|
|
209
210
|
}
|
|
210
211
|
catch (err) {
|
|
211
212
|
return Promise.reject(err);
|
|
212
213
|
}
|
|
213
214
|
let authToken = '';
|
|
214
215
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
215
|
-
authToken = await getAuthenticaionToken(
|
|
216
|
+
authToken = await getAuthenticaionToken(config);
|
|
216
217
|
}
|
|
217
218
|
const headers = {
|
|
218
219
|
'Content-Type': 'application/json',
|
|
@@ -243,9 +244,9 @@ export const executeTML = async (data) => {
|
|
|
243
244
|
});
|
|
244
245
|
};
|
|
245
246
|
export const exportTML = async (data) => {
|
|
246
|
-
const { thoughtSpotHost, authType } =
|
|
247
|
+
const { thoughtSpotHost, authType } = config;
|
|
247
248
|
try {
|
|
248
|
-
sanity(
|
|
249
|
+
sanity(config);
|
|
249
250
|
}
|
|
250
251
|
catch (err) {
|
|
251
252
|
return Promise.reject(err);
|
|
@@ -258,7 +259,7 @@ export const exportTML = async (data) => {
|
|
|
258
259
|
};
|
|
259
260
|
let authToken = '';
|
|
260
261
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
261
|
-
authToken = await getAuthenticaionToken(
|
|
262
|
+
authToken = await getAuthenticaionToken(config);
|
|
262
263
|
}
|
|
263
264
|
const headers = {
|
|
264
265
|
'Content-Type': 'application/json',
|
|
@@ -288,8 +289,8 @@ export const exportTML = async (data) => {
|
|
|
288
289
|
*
|
|
289
290
|
*/
|
|
290
291
|
export function reset() {
|
|
291
|
-
|
|
292
|
+
config = {};
|
|
292
293
|
setAuthEE(null);
|
|
293
|
-
|
|
294
|
+
authPromise = null;
|
|
294
295
|
}
|
|
295
296
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAe,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,OAAO,EACjB,eAAe,EAGf,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EAET,SAAS,EACT,qBAAqB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAe,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,OAAO,EACjB,eAAe,EAGf,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EAET,SAAS,EACT,qBAAqB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,IAAI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aAAa,GAAG,UAAU,SAAS,EAAE,CAAC;KACjD;IAED,OAAO,KAAK,CAAC,GAAG,eAAe,GAAG,SAAS,CAAC,UAAU,EAAE,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7B,WAAW,EAAE,SAAS;KACzB,CAAC;SACG,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACf,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;SACxF;QACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,KAAK,CAAC;IAChB,CAAC,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,4BAA4B;AAC5B;;GAEG;AACH,MAAM,UAAU,KAAK;IACjB,MAAM,GAAG,EAAS,CAAC;IACnB,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixpanel-service.d.ts","sourceRoot":"","sources":["../../src/mixpanel-service.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;CAQ1B,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,KAAK,GAAG,IAAI,CAM1E;AAeD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"mixpanel-service.d.ts","sourceRoot":"","sources":["../../src/mixpanel-service.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;CAQ1B,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,KAAK,GAAG,IAAI,CAM1E;AAeD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,GAAG,GAAG,IAAI,CA8BnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,SAGhC"}
|
|
@@ -55,8 +55,16 @@ export function initMixpanel(sessionInfo) {
|
|
|
55
55
|
mixpanel.init(token);
|
|
56
56
|
if (!isPublicCluster) {
|
|
57
57
|
// Needed to avoid error in CJS builds on some bundlers.
|
|
58
|
-
const mixpanelIdentify = mixpanel.identify
|
|
59
|
-
|
|
58
|
+
const { mixpanelLib, mixpanelIdentify } = (mixpanel.identify)
|
|
59
|
+
? {
|
|
60
|
+
mixpanelLib: mixpanel,
|
|
61
|
+
mixpanelIdentify: mixpanel.identify
|
|
62
|
+
}
|
|
63
|
+
: {
|
|
64
|
+
mixpanelLib: mixpanel.default,
|
|
65
|
+
mixpanelIdentify: mixpanel.default.identify
|
|
66
|
+
};
|
|
67
|
+
mixpanelIdentify.call(mixpanelLib, sessionInfo.userGUID);
|
|
60
68
|
}
|
|
61
69
|
isMixpanelInitialized = true;
|
|
62
70
|
emptyQueue();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixpanel-service.js","sourceRoot":"","sources":["../../src/mixpanel-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,MAAM,EAAE,4BAA4B;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,uBAAuB,EAAE,yBAAyB;IAClD,sBAAsB,EAAE,wBAAwB;IAChD,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,kBAAkB,EAA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YACP,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,IAAI,CAAC,eAAe,EAAE;gBAClB,wDAAwD;gBACxD,MAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBAC1D,CAAC,CAAC;wBACE,WAAW,EAAE,QAAQ;wBACrB,gBAAgB,EAAE,QAAQ,CAAC,QAAQ;qBACtC;oBACD,CAAC,CAAC;wBACE,WAAW,EAAE,QAAQ,CAAC,OAAO;wBAC7B,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ;qBAC9C,CAAC;gBACN,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;aAC5D;YACD,qBAAqB,GAAG,IAAI,CAAC;YAC7B,UAAU,EAAE,CAAC;SAChB;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;KACnD;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC7B,qBAAqB,GAAG,KAAK,CAAC;IAC9B,UAAU,GAAG,EAAE,CAAC;AACpB,CAAC"}
|
package/lib/src/react/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ interface SearchProps extends EmbedProps, SearchViewConfig {
|
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export declare const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<
|
|
23
|
+
export declare const SearchEmbed: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<_SearchEmbed>>;
|
|
24
24
|
interface AppProps extends EmbedProps, AppViewConfig {
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -37,7 +37,7 @@ interface AppProps extends EmbedProps, AppViewConfig {
|
|
|
37
37
|
* }
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export declare const AppEmbed: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<
|
|
40
|
+
export declare const AppEmbed: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<_AppEmbed>>;
|
|
41
41
|
interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -55,8 +55,8 @@ interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
|
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export declare const LiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<
|
|
59
|
-
export declare const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<
|
|
58
|
+
export declare const LiveboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
|
|
59
|
+
export declare const PinboardEmbed: React.ForwardRefExoticComponent<LiveboardProps & React.RefAttributes<_LiveboardEmbed>>;
|
|
60
60
|
interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -72,7 +72,7 @@ interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
|
|
|
72
72
|
* }
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
export declare const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & React.RefAttributes<
|
|
75
|
+
export declare const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEmbedProps & React.RefAttributes<_SearchBarEmbed>>;
|
|
76
76
|
/**
|
|
77
77
|
* Get a reference to the embed component to trigger events on the component.
|
|
78
78
|
*
|
|
@@ -90,6 +90,6 @@ export declare const SearchBarEmbed: React.ForwardRefExoticComponent<SearchBarEm
|
|
|
90
90
|
* ```
|
|
91
91
|
* @returns {React.MutableRefObject<TsEmbed>} ref
|
|
92
92
|
*/
|
|
93
|
-
export declare const useEmbedRef: () => React.MutableRefObject<
|
|
93
|
+
export declare const useEmbedRef: <T extends TsEmbed>() => React.MutableRefObject<T>;
|
|
94
94
|
export { LiveboardViewConfig, SearchViewConfig, AppViewConfig, Page, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, Action, FrameParams, } from '../index';
|
|
95
95
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAA4B,MAAM,QAAQ,CAAC;AA2D9D,UAAU,WAAY,SAAQ,UAAU,EAAE,gBAAgB;CAAG;AAE7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,IAAI,eAA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M,cAAc,GAAG,gBAAgB,CAI5C,eAAe,CAAC,CAAC;AAEnB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAkD,EAAE,CAAC,KAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;AAEtG,OAAO,EAIH,IAAI,EAEJ,eAAe,EACf,UAAU,EACV,SAAS,EACT,MAAM,GAET,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
package/src/embed/base.ts
CHANGED
|
@@ -29,8 +29,7 @@ import {
|
|
|
29
29
|
} from '../auth';
|
|
30
30
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
(window as any).thoughtSpotConfig = window.thoughtSpotConfig || {} as EmbedConfig;
|
|
32
|
+
let config = {} as EmbedConfig;
|
|
34
33
|
const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
|
|
35
34
|
loginFailedMessage: 'Not logged in',
|
|
36
35
|
authTriggerText: 'Authorize',
|
|
@@ -53,6 +52,7 @@ export interface exportTMLInput {
|
|
|
53
52
|
edoc_format?: 'YAML' | 'JSON';
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
export let authPromise: Promise<boolean>;
|
|
56
56
|
/**
|
|
57
57
|
* Gets the configuration embed was initialized with.
|
|
58
58
|
*
|
|
@@ -60,9 +60,9 @@ export interface exportTMLInput {
|
|
|
60
60
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
61
61
|
* @group Global methods
|
|
62
62
|
*/
|
|
63
|
-
export const getEmbedConfig = (): EmbedConfig =>
|
|
63
|
+
export const getEmbedConfig = (): EmbedConfig => config;
|
|
64
64
|
|
|
65
|
-
export const getAuthPromise = (): Promise<boolean> =>
|
|
65
|
+
export const getAuthPromise = (): Promise<boolean> => authPromise;
|
|
66
66
|
|
|
67
67
|
export {
|
|
68
68
|
notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout,
|
|
@@ -72,9 +72,9 @@ export {
|
|
|
72
72
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
73
73
|
*/
|
|
74
74
|
export const handleAuth = (): Promise<boolean> => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
(isLoggedIn
|
|
75
|
+
authPromise = authenticate(config);
|
|
76
|
+
authPromise.then(
|
|
77
|
+
(isLoggedIn) => {
|
|
78
78
|
if (!isLoggedIn) {
|
|
79
79
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
80
80
|
} else {
|
|
@@ -85,7 +85,7 @@ export const handleAuth = (): Promise<boolean> => {
|
|
|
85
85
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
86
86
|
},
|
|
87
87
|
);
|
|
88
|
-
return
|
|
88
|
+
return authPromise;
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
const hostUrlToFeatureUrl = {
|
|
@@ -111,7 +111,7 @@ export const prefetch = (url?: string, prefetchFeatures?: PrefetchFeatures[]): v
|
|
|
111
111
|
console.warn('The prefetch method does not have a valid URL');
|
|
112
112
|
} else {
|
|
113
113
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
114
|
-
let hostUrl = url ||
|
|
114
|
+
let hostUrl = url || config.thoughtSpotHost;
|
|
115
115
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
116
116
|
uniq(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach(
|
|
117
117
|
(prefetchUrl, index) => {
|
|
@@ -182,19 +182,19 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
|
|
|
182
182
|
*/
|
|
183
183
|
export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
184
184
|
sanity(embedConfig);
|
|
185
|
-
|
|
185
|
+
config = {
|
|
186
186
|
...CONFIG_DEFAULTS,
|
|
187
187
|
...embedConfig,
|
|
188
188
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
config = backwardCompat(config);
|
|
191
191
|
const authEE = new EventEmitter<AuthStatus | AuthEvent>();
|
|
192
192
|
setAuthEE(authEE);
|
|
193
193
|
handleAuth();
|
|
194
194
|
|
|
195
195
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
196
|
-
authType:
|
|
197
|
-
host:
|
|
196
|
+
authType: config.authType,
|
|
197
|
+
host: config.thoughtSpotHost,
|
|
198
198
|
usedCustomizationSheet: embedConfig.customizations?.style?.customCSSUrl != null,
|
|
199
199
|
usedCustomizationVariables: embedConfig.customizations?.style?.customCSS?.variables != null,
|
|
200
200
|
usedCustomizationRules:
|
|
@@ -203,8 +203,8 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
|
203
203
|
usedCustomizationIconSprite: !!embedConfig.customizations?.iconSpriteUrl,
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
if (
|
|
207
|
-
prefetch(
|
|
206
|
+
if (config.callPrefetch) {
|
|
207
|
+
prefetch(config.thoughtSpotHost);
|
|
208
208
|
}
|
|
209
209
|
return authEE as AuthEventEmitter;
|
|
210
210
|
};
|
|
@@ -213,7 +213,7 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
|
213
213
|
*
|
|
214
214
|
*/
|
|
215
215
|
export function disableAutoLogin(): void {
|
|
216
|
-
|
|
216
|
+
config.autoLogin = false;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/**
|
|
@@ -232,7 +232,7 @@ export const logout = (doNotDisableAutoLogin = false): Promise<boolean> => {
|
|
|
232
232
|
if (!doNotDisableAutoLogin) {
|
|
233
233
|
disableAutoLogin();
|
|
234
234
|
}
|
|
235
|
-
return _logout(
|
|
235
|
+
return _logout(config).then((isLoggedIn) => {
|
|
236
236
|
notifyLogout();
|
|
237
237
|
return isLoggedIn;
|
|
238
238
|
});
|
|
@@ -247,7 +247,7 @@ let renderQueue: Promise<any> = Promise.resolve();
|
|
|
247
247
|
* @param fn The function being registered
|
|
248
248
|
*/
|
|
249
249
|
export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>): Promise<any> => {
|
|
250
|
-
const { queueMultiRenders = false } =
|
|
250
|
+
const { queueMultiRenders = false } = config;
|
|
251
251
|
if (queueMultiRenders) {
|
|
252
252
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
253
253
|
return renderQueue;
|
|
@@ -257,15 +257,15 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
257
257
|
};
|
|
258
258
|
|
|
259
259
|
export const executeTML = async (data: executeTMLInput): Promise<any> => {
|
|
260
|
-
const { thoughtSpotHost, authType } =
|
|
260
|
+
const { thoughtSpotHost, authType } = config;
|
|
261
261
|
try {
|
|
262
|
-
sanity(
|
|
262
|
+
sanity(config);
|
|
263
263
|
} catch (err) {
|
|
264
264
|
return Promise.reject(err);
|
|
265
265
|
}
|
|
266
266
|
let authToken = '';
|
|
267
267
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
268
|
-
authToken = await getAuthenticaionToken(
|
|
268
|
+
authToken = await getAuthenticaionToken(config);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
const headers: Record<string, string | undefined> = {
|
|
@@ -300,9 +300,9 @@ export const executeTML = async (data: executeTMLInput): Promise<any> => {
|
|
|
300
300
|
};
|
|
301
301
|
|
|
302
302
|
export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
303
|
-
const { thoughtSpotHost, authType } =
|
|
303
|
+
const { thoughtSpotHost, authType } = config;
|
|
304
304
|
try {
|
|
305
|
-
sanity(
|
|
305
|
+
sanity(config);
|
|
306
306
|
} catch (err) {
|
|
307
307
|
return Promise.reject(err);
|
|
308
308
|
}
|
|
@@ -315,7 +315,7 @@ export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
|
315
315
|
|
|
316
316
|
let authToken = '';
|
|
317
317
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
318
|
-
authToken = await getAuthenticaionToken(
|
|
318
|
+
authToken = await getAuthenticaionToken(config);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
const headers: Record<string, string | undefined> = {
|
|
@@ -349,7 +349,7 @@ export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
|
349
349
|
*
|
|
350
350
|
*/
|
|
351
351
|
export function reset(): void {
|
|
352
|
-
|
|
352
|
+
config = {} as any;
|
|
353
353
|
setAuthEE(null);
|
|
354
|
-
|
|
354
|
+
authPromise = null;
|
|
355
355
|
}
|
package/src/mixpanel-service.ts
CHANGED
|
@@ -61,8 +61,16 @@ export function initMixpanel(sessionInfo: any): void {
|
|
|
61
61
|
mixpanel.init(token);
|
|
62
62
|
if (!isPublicCluster) {
|
|
63
63
|
// Needed to avoid error in CJS builds on some bundlers.
|
|
64
|
-
const mixpanelIdentify = mixpanel.identify
|
|
65
|
-
|
|
64
|
+
const { mixpanelLib, mixpanelIdentify } = (mixpanel.identify)
|
|
65
|
+
? {
|
|
66
|
+
mixpanelLib: mixpanel,
|
|
67
|
+
mixpanelIdentify: mixpanel.identify
|
|
68
|
+
}
|
|
69
|
+
: {
|
|
70
|
+
mixpanelLib: mixpanel.default,
|
|
71
|
+
mixpanelIdentify: mixpanel.default.identify
|
|
72
|
+
};
|
|
73
|
+
mixpanelIdentify.call(mixpanelLib, sessionInfo.userGUID);
|
|
66
74
|
}
|
|
67
75
|
isMixpanelInitialized = true;
|
|
68
76
|
emptyQueue();
|
package/src/react/index.tsx
CHANGED
|
@@ -10,10 +10,10 @@ import { TsEmbed } from '../embed/ts-embed';
|
|
|
10
10
|
import { EmbedEvent, ViewConfig } from '../types';
|
|
11
11
|
import { EmbedProps, getViewPropsAndListeners } from './util';
|
|
12
12
|
|
|
13
|
-
const componentFactory = <T extends
|
|
14
|
-
EmbedConstructor: T,
|
|
15
|
-
) => React.forwardRef<
|
|
16
|
-
(props: U, forwardedRef: React.MutableRefObject<
|
|
13
|
+
const componentFactory = <T extends TsEmbed, U extends EmbedProps, V extends ViewConfig>(
|
|
14
|
+
EmbedConstructor: { new(...args: any[]): T },
|
|
15
|
+
) => React.forwardRef<T, U>(
|
|
16
|
+
(props: U, forwardedRef: React.MutableRefObject<T>) => {
|
|
17
17
|
const ref = React.useRef<HTMLDivElement>(null);
|
|
18
18
|
const { className, ...embedProps } = props;
|
|
19
19
|
const { viewConfig, listeners } = getViewPropsAndListeners<
|
|
@@ -21,7 +21,7 @@ const componentFactory = <T extends typeof TsEmbed, U extends EmbedProps, V exte
|
|
|
21
21
|
V
|
|
22
22
|
>(embedProps);
|
|
23
23
|
useDeepCompareEffect(() => {
|
|
24
|
-
const tsEmbed = new EmbedConstructor(
|
|
24
|
+
const tsEmbed: TsEmbed = new EmbedConstructor(
|
|
25
25
|
ref!.current,
|
|
26
26
|
deepMerge(
|
|
27
27
|
{
|
|
@@ -44,7 +44,7 @@ const componentFactory = <T extends typeof TsEmbed, U extends EmbedProps, V exte
|
|
|
44
44
|
tsEmbed.render();
|
|
45
45
|
if (forwardedRef) {
|
|
46
46
|
// eslint-disable-next-line no-param-reassign
|
|
47
|
-
forwardedRef.current = tsEmbed;
|
|
47
|
+
forwardedRef.current = tsEmbed as T;
|
|
48
48
|
}
|
|
49
49
|
return () => {
|
|
50
50
|
tsEmbed.destroy();
|
|
@@ -82,7 +82,7 @@ interface SearchProps extends EmbedProps, SearchViewConfig {}
|
|
|
82
82
|
* }
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
|
-
export const SearchEmbed = componentFactory<
|
|
85
|
+
export const SearchEmbed = componentFactory<_SearchEmbed, SearchProps, SearchViewConfig>(
|
|
86
86
|
_SearchEmbed,
|
|
87
87
|
);
|
|
88
88
|
|
|
@@ -102,7 +102,7 @@ interface AppProps extends EmbedProps, AppViewConfig {}
|
|
|
102
102
|
* }
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
export const AppEmbed = componentFactory<
|
|
105
|
+
export const AppEmbed = componentFactory<_AppEmbed, AppProps, AppViewConfig>(_AppEmbed);
|
|
106
106
|
|
|
107
107
|
interface LiveboardProps extends EmbedProps, LiveboardViewConfig {}
|
|
108
108
|
|
|
@@ -122,7 +122,7 @@ interface LiveboardProps extends EmbedProps, LiveboardViewConfig {}
|
|
|
122
122
|
* ```
|
|
123
123
|
*/
|
|
124
124
|
export const LiveboardEmbed = componentFactory<
|
|
125
|
-
|
|
125
|
+
_LiveboardEmbed,
|
|
126
126
|
LiveboardProps,
|
|
127
127
|
LiveboardViewConfig
|
|
128
128
|
>(_LiveboardEmbed);
|
|
@@ -145,7 +145,7 @@ interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {}
|
|
|
145
145
|
* ```
|
|
146
146
|
*/
|
|
147
147
|
export const SearchBarEmbed = componentFactory<
|
|
148
|
-
|
|
148
|
+
_SearchBarEmbed,
|
|
149
149
|
SearchBarEmbedProps,
|
|
150
150
|
SearchBarViewConfig
|
|
151
151
|
>(_SearchBarEmbed);
|
|
@@ -167,7 +167,7 @@ export const SearchBarEmbed = componentFactory<
|
|
|
167
167
|
* ```
|
|
168
168
|
* @returns {React.MutableRefObject<TsEmbed>} ref
|
|
169
169
|
*/
|
|
170
|
-
export const useEmbedRef = (): React.MutableRefObject<
|
|
170
|
+
export const useEmbedRef = <T extends TsEmbed,>(): React.MutableRefObject<T> => React.useRef<T>(null);
|
|
171
171
|
|
|
172
172
|
export {
|
|
173
173
|
LiveboardViewConfig,
|