@thoughtspot/visual-embed-sdk 1.29.0-alpha.8 → 1.29.0-alpha.SCAL-205893-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/cjs/package.json +1 -1
- package/cjs/src/auth.d.ts +14 -17
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +45 -59
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/auth.spec.d.ts +12 -0
- package/cjs/src/auth.spec.d.ts.map +1 -1
- package/cjs/src/auth.spec.js +89 -67
- package/cjs/src/auth.spec.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 +10 -4
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/embed/app.spec.js +4 -2
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +1 -0
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embed.spec.js +3 -0
- package/cjs/src/embed/embed.spec.js.map +1 -1
- package/cjs/src/embed/events.spec.js +3 -0
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +2 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/pinboard.spec.js +3 -0
- package/cjs/src/embed/pinboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.spec.js +3 -0
- package/cjs/src/embed/sage.spec.js.map +1 -1
- package/cjs/src/embed/search.spec.js +1 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed-trigger.spec.js +3 -0
- package/cjs/src/embed/ts-embed-trigger.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +7 -0
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +7 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +2 -1
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +2 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +2 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +1 -0
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +7 -0
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +6 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +1 -1
- package/cjs/src/types.js +1 -1
- package/cjs/src/utils/authService/authService.d.ts +1 -0
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +1 -0
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/authService/authService.spec.js +18 -5
- package/cjs/src/utils/authService/authService.spec.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.js +39 -9
- package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js +32 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +10 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/processData.js +2 -2
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +3 -2
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.d.ts +66 -0
- package/cjs/src/utils/sessionInfoService.d.ts.map +1 -0
- package/cjs/src/utils/sessionInfoService.js +92 -0
- package/cjs/src/utils/sessionInfoService.js.map +1 -0
- package/dist/src/auth.d.ts +14 -17
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/auth.spec.d.ts +12 -0
- package/dist/src/auth.spec.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/base.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +2 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/utils/authService/authService.d.ts +1 -0
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.d.ts +66 -0
- package/dist/src/utils/sessionInfoService.d.ts.map +1 -0
- package/dist/tsembed-react.es.js +154 -58
- package/dist/tsembed-react.js +154 -57
- package/dist/tsembed.es.js +162 -69
- package/dist/tsembed.js +162 -69
- package/dist/visual-embed-sdk-react-full.d.ts +93 -20
- package/dist/visual-embed-sdk-react.d.ts +93 -20
- package/dist/visual-embed-sdk.d.ts +93 -20
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +14 -17
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +44 -56
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts +12 -0
- package/lib/src/auth.spec.d.ts.map +1 -1
- package/lib/src/auth.spec.js +88 -66
- package/lib/src/auth.spec.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 +10 -4
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/embed/app.spec.js +4 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +3 -1
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +1 -0
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +2 -0
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +2 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +2 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +2 -0
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/sage.spec.js +2 -0
- package/lib/src/embed/sage.spec.js.map +1 -1
- package/lib/src/embed/search.spec.js +1 -0
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed-trigger.spec.js +2 -0
- package/lib/src/embed/ts-embed-trigger.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +7 -0
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +7 -0
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +2 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +1 -0
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +7 -0
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +6 -0
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +1 -1
- package/lib/src/types.js +1 -1
- package/lib/src/utils/authService/authService.d.ts +1 -0
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +1 -0
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +18 -5
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.js +37 -8
- package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js +29 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +10 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/processData.js +3 -3
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +3 -2
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/sessionInfoService.d.ts +66 -0
- package/lib/src/utils/sessionInfoService.d.ts.map +1 -0
- package/lib/src/utils/sessionInfoService.js +85 -0
- package/lib/src/utils/sessionInfoService.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +98 -21
- package/package.json +1 -1
- package/src/auth.spec.ts +92 -72
- package/src/auth.ts +46 -68
- package/src/authToken.ts +9 -4
- package/src/embed/app.spec.ts +4 -2
- package/src/embed/base.spec.ts +1 -0
- package/src/embed/base.ts +3 -0
- package/src/embed/embed.spec.ts +2 -0
- package/src/embed/events.spec.ts +2 -0
- package/src/embed/liveboard.spec.ts +2 -0
- package/src/embed/pinboard.spec.ts +2 -0
- package/src/embed/sage.spec.ts +3 -0
- package/src/embed/search.spec.ts +1 -0
- package/src/embed/ts-embed-trigger.spec.ts +3 -0
- package/src/embed/ts-embed.spec.ts +8 -0
- package/src/embed/ts-embed.ts +7 -0
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +12 -3
- package/src/mixpanel-service.ts +3 -1
- package/src/react/index.spec.tsx +7 -0
- package/src/react/index.tsx +1 -0
- package/src/types.ts +1 -1
- package/src/utils/authService/authService.spec.ts +18 -5
- package/src/utils/authService/authService.ts +1 -0
- package/src/utils/authService/tokenizedAuthService.spec.ts +36 -0
- package/src/utils/authService/tokenizedAuthService.ts +38 -8
- package/src/utils/graphql/answerService/answerService.ts +10 -0
- package/src/utils/processData.spec.ts +3 -2
- package/src/utils/processData.ts +3 -3
- package/src/utils/sessionInfoService.ts +101 -0
package/dist/tsembed.js
CHANGED
|
@@ -1499,7 +1499,7 @@
|
|
|
1499
1499
|
*
|
|
1500
1500
|
* @example
|
|
1501
1501
|
* ```js
|
|
1502
|
-
* liveboardEmbed.trigger(HostEvent.
|
|
1502
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
1503
1503
|
* data=>console.log(data))
|
|
1504
1504
|
* ```
|
|
1505
1505
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1.sw
|
|
@@ -5827,6 +5827,7 @@
|
|
|
5827
5827
|
|
|
5828
5828
|
const EndPoints = {
|
|
5829
5829
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5830
|
+
SESSION_INFO: '/callosum/v1/session/info',
|
|
5830
5831
|
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5831
5832
|
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5832
5833
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -5943,7 +5944,7 @@
|
|
|
5943
5944
|
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
5944
5945
|
let cachedAuthToken = null;
|
|
5945
5946
|
// This method can be used to get the authToken using the embedConfig
|
|
5946
|
-
|
|
5947
|
+
async function getAuthenticationToken(embedConfig) {
|
|
5947
5948
|
// Since we don't have token validation enabled , we cannot tell if the
|
|
5948
5949
|
// cached token is valid or not. So we will always fetch a new token.
|
|
5949
5950
|
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
@@ -5966,11 +5967,17 @@
|
|
|
5966
5967
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
5967
5968
|
authToken = await response.text();
|
|
5968
5969
|
}
|
|
5969
|
-
|
|
5970
|
-
|
|
5970
|
+
try {
|
|
5971
|
+
// this will throw error if the token is not valid
|
|
5972
|
+
await validateAuthToken(embedConfig, authToken);
|
|
5973
|
+
}
|
|
5974
|
+
catch (e) {
|
|
5975
|
+
logger.error(`Received invalid token from getAuthToken callback or authToken endpoint. Error : ${e.message}`);
|
|
5976
|
+
throw e;
|
|
5977
|
+
}
|
|
5971
5978
|
cachedAuthToken = authToken;
|
|
5972
5979
|
return authToken;
|
|
5973
|
-
}
|
|
5980
|
+
}
|
|
5974
5981
|
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
5975
5982
|
if (embedConfig.disableTokenVerification) {
|
|
5976
5983
|
logger.info('Token verification is disabled. Assuming token is valid.');
|
|
@@ -6252,6 +6259,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
6252
6259
|
* const data = await underlying.fetchData(0, 100);
|
|
6253
6260
|
* })
|
|
6254
6261
|
* ```
|
|
6262
|
+
* @example
|
|
6263
|
+
* ```js
|
|
6264
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
6265
|
+
* const service = await embed.getAnswerService();
|
|
6266
|
+
* await service.addColumns([
|
|
6267
|
+
* "<column guid>"
|
|
6268
|
+
* ]);
|
|
6269
|
+
* console.log(await service.fetchData());
|
|
6270
|
+
* });
|
|
6271
|
+
* ```
|
|
6255
6272
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
6256
6273
|
* @group Events
|
|
6257
6274
|
*/
|
|
@@ -12592,6 +12609,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12592
12609
|
function initMixpanel(sessionInfo) {
|
|
12593
12610
|
var _a;
|
|
12594
12611
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
12612
|
+
logger.error('Mixpanel token not found in session info');
|
|
12595
12613
|
return;
|
|
12596
12614
|
}
|
|
12597
12615
|
// On a public cluster the user is anonymous, so don't set the identify to
|
|
@@ -13186,49 +13204,124 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13186
13204
|
* @param url
|
|
13187
13205
|
* @param options
|
|
13188
13206
|
*/
|
|
13189
|
-
function
|
|
13207
|
+
function tokenizedFailureLoggedFetch(url, options = {}) {
|
|
13190
13208
|
return tokenizedFetch(url, options).then(async (r) => {
|
|
13191
13209
|
var _a;
|
|
13192
13210
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
13193
|
-
logger.error(
|
|
13211
|
+
logger.error(`Failed to fetch ${url}`, await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
13194
13212
|
}
|
|
13195
13213
|
return r;
|
|
13196
13214
|
});
|
|
13197
13215
|
}
|
|
13198
13216
|
/**
|
|
13217
|
+
* Fetches the session info from the ThoughtSpot server.
|
|
13199
13218
|
*
|
|
13200
|
-
* @param
|
|
13219
|
+
* @param thoughtspotHost
|
|
13220
|
+
* @returns {Promise<any>}
|
|
13221
|
+
* @example
|
|
13222
|
+
* ```js
|
|
13223
|
+
* const response = await sessionInfoService();
|
|
13224
|
+
* ```
|
|
13201
13225
|
*/
|
|
13202
|
-
function fetchSessionInfoService(
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13226
|
+
async function fetchSessionInfoService(thoughtspotHost) {
|
|
13227
|
+
const sessionInfoPath = `${thoughtspotHost}${EndPoints.SESSION_INFO}`;
|
|
13228
|
+
const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
|
|
13229
|
+
if (!response.ok) {
|
|
13230
|
+
throw new Error(`Failed to fetch session info: ${response.statusText}`);
|
|
13231
|
+
}
|
|
13232
|
+
const data = await response.json();
|
|
13233
|
+
return data;
|
|
13206
13234
|
}
|
|
13207
13235
|
/**
|
|
13208
13236
|
*
|
|
13209
13237
|
* @param thoughtSpotHost
|
|
13210
13238
|
*/
|
|
13211
13239
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
13212
|
-
return
|
|
13240
|
+
return tokenizedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
13213
13241
|
credentials: 'include',
|
|
13214
13242
|
method: 'POST',
|
|
13215
13243
|
headers: {
|
|
13216
13244
|
'x-requested-by': 'ThoughtSpot',
|
|
13217
13245
|
},
|
|
13218
13246
|
});
|
|
13247
|
+
}
|
|
13248
|
+
/**
|
|
13249
|
+
* Is active service to check if the user is logged in.
|
|
13250
|
+
*
|
|
13251
|
+
* @param thoughtSpotHost
|
|
13252
|
+
* @version SDK: 1.28.4 | ThoughtSpot: *
|
|
13253
|
+
*/
|
|
13254
|
+
async function isActiveService(thoughtSpotHost) {
|
|
13255
|
+
const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
13256
|
+
try {
|
|
13257
|
+
const res = await tokenizedFetch(isActiveUrl, {
|
|
13258
|
+
credentials: 'include',
|
|
13259
|
+
});
|
|
13260
|
+
return res.ok;
|
|
13261
|
+
}
|
|
13262
|
+
catch (e) {
|
|
13263
|
+
logger.warn(`Is Logged In Service failed : ${e.message}`);
|
|
13264
|
+
}
|
|
13265
|
+
return false;
|
|
13219
13266
|
}
|
|
13220
13267
|
|
|
13268
|
+
let sessionInfo = null;
|
|
13269
|
+
/**
|
|
13270
|
+
* Returns the session info object and caches it for future use.
|
|
13271
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
13272
|
+
* subsequent calls.
|
|
13273
|
+
*
|
|
13274
|
+
* @example ```js
|
|
13275
|
+
* const sessionInfo = await getSessionInfo();
|
|
13276
|
+
* console.log(sessionInfo);
|
|
13277
|
+
* ```
|
|
13278
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13279
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
13280
|
+
*/
|
|
13281
|
+
async function getSessionInfo() {
|
|
13282
|
+
if (!sessionInfo) {
|
|
13283
|
+
const host = getEmbedConfig().thoughtSpotHost;
|
|
13284
|
+
const sessionResponse = await fetchSessionInfoService(host);
|
|
13285
|
+
const processedSessionInfo = getSessionDetails(sessionResponse);
|
|
13286
|
+
sessionInfo = processedSessionInfo;
|
|
13287
|
+
}
|
|
13288
|
+
return sessionInfo;
|
|
13289
|
+
}
|
|
13290
|
+
/**
|
|
13291
|
+
* Processes the session info response and returns the session info object.
|
|
13292
|
+
*
|
|
13293
|
+
* @param sessionInfoResp {any} Response from the session info API.
|
|
13294
|
+
* @returns {SessionInfo} The session info object.
|
|
13295
|
+
* @example ```js
|
|
13296
|
+
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
13297
|
+
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
13298
|
+
* console.log(sessionInfo);
|
|
13299
|
+
* ```
|
|
13300
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13301
|
+
*/
|
|
13302
|
+
const getSessionDetails = (sessionInfoResp) => {
|
|
13303
|
+
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13304
|
+
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13305
|
+
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13306
|
+
? prodMixpanelToken
|
|
13307
|
+
: devMixpanelToken;
|
|
13308
|
+
return {
|
|
13309
|
+
userGUID: sessionInfoResp.userGUID,
|
|
13310
|
+
mixpanelToken,
|
|
13311
|
+
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13312
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13313
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13314
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13315
|
+
...sessionInfoResp,
|
|
13316
|
+
};
|
|
13317
|
+
};
|
|
13318
|
+
|
|
13221
13319
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13222
13320
|
let loggedInStatus = false;
|
|
13223
13321
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13224
13322
|
let samlAuthWindow = null;
|
|
13225
13323
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13226
13324
|
let samlCompletionPromise = null;
|
|
13227
|
-
let sessionInfo = null;
|
|
13228
|
-
let sessionInfoResolver = null;
|
|
13229
|
-
const sessionInfoPromise = new Promise((resolve) => {
|
|
13230
|
-
sessionInfoResolver = resolve;
|
|
13231
|
-
});
|
|
13232
13325
|
let releaseVersion = '';
|
|
13233
13326
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
13234
13327
|
(function (AuthFailureType) {
|
|
@@ -13291,12 +13384,18 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13291
13384
|
/**
|
|
13292
13385
|
*
|
|
13293
13386
|
*/
|
|
13294
|
-
function notifyAuthSuccess() {
|
|
13387
|
+
async function notifyAuthSuccess() {
|
|
13295
13388
|
if (!authEE) {
|
|
13296
13389
|
logger.error('SDK not initialized');
|
|
13297
13390
|
return;
|
|
13298
13391
|
}
|
|
13299
|
-
|
|
13392
|
+
try {
|
|
13393
|
+
const sessionInfo = await getSessionInfo();
|
|
13394
|
+
authEE.emit(exports.AuthStatus.SUCCESS, sessionInfo);
|
|
13395
|
+
}
|
|
13396
|
+
catch (e) {
|
|
13397
|
+
logger.error('Failed to get session info');
|
|
13398
|
+
}
|
|
13300
13399
|
}
|
|
13301
13400
|
/**
|
|
13302
13401
|
*
|
|
@@ -13319,67 +13418,45 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13319
13418
|
}
|
|
13320
13419
|
authEE.emit(exports.AuthStatus.LOGOUT);
|
|
13321
13420
|
}
|
|
13322
|
-
const initSession = (sessionDetails) => {
|
|
13323
|
-
const embedConfig = getEmbedConfig();
|
|
13324
|
-
if (sessionInfo == null) {
|
|
13325
|
-
sessionInfo = sessionDetails;
|
|
13326
|
-
if (!embedConfig.disableSDKTracking) {
|
|
13327
|
-
initMixpanel(sessionInfo);
|
|
13328
|
-
}
|
|
13329
|
-
sessionInfoResolver(sessionInfo);
|
|
13330
|
-
}
|
|
13331
|
-
};
|
|
13332
|
-
const getSessionDetails = (sessionInfoResp) => {
|
|
13333
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13334
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13335
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13336
|
-
? prodMixpanelToken
|
|
13337
|
-
: devMixpanelToken;
|
|
13338
|
-
return {
|
|
13339
|
-
userGUID: sessionInfoResp.userGUID,
|
|
13340
|
-
mixpanelToken,
|
|
13341
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13342
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13343
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13344
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13345
|
-
...sessionInfoResp,
|
|
13346
|
-
};
|
|
13347
|
-
};
|
|
13348
13421
|
/**
|
|
13349
13422
|
* Check if we are logged into the ThoughtSpot cluster
|
|
13350
13423
|
*
|
|
13351
13424
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
13352
13425
|
*/
|
|
13353
13426
|
async function isLoggedIn(thoughtSpotHost) {
|
|
13354
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.AUTH_VERIFICATION}`;
|
|
13355
|
-
let response = null;
|
|
13356
13427
|
try {
|
|
13357
|
-
response = await
|
|
13358
|
-
|
|
13359
|
-
const sessionDetails = getSessionDetails(sessionInfoResp);
|
|
13360
|
-
// Store user session details from session info
|
|
13361
|
-
initSession(sessionDetails);
|
|
13362
|
-
releaseVersion = sessionInfoResp.releaseVersion;
|
|
13428
|
+
const response = await isActiveService(thoughtSpotHost);
|
|
13429
|
+
return response;
|
|
13363
13430
|
}
|
|
13364
13431
|
catch (e) {
|
|
13365
13432
|
return false;
|
|
13366
13433
|
}
|
|
13367
|
-
return response.status === 200;
|
|
13368
13434
|
}
|
|
13369
13435
|
/**
|
|
13370
|
-
*
|
|
13436
|
+
* Services to be called after the login is successful,
|
|
13437
|
+
* This should be called after the cookie is set for cookie auth or
|
|
13438
|
+
* after the token is set for cookieless.
|
|
13439
|
+
*
|
|
13440
|
+
* @return {Promise<void>}
|
|
13441
|
+
* @example
|
|
13442
|
+
* ```js
|
|
13443
|
+
* await postLoginService();
|
|
13444
|
+
* ```
|
|
13445
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13371
13446
|
*/
|
|
13372
|
-
function
|
|
13373
|
-
|
|
13447
|
+
async function postLoginService() {
|
|
13448
|
+
const sessionInfo = await getSessionInfo();
|
|
13449
|
+
releaseVersion = sessionInfo.releaseVersion;
|
|
13450
|
+
const embedConfig = getEmbedConfig();
|
|
13451
|
+
if (!embedConfig.disableSDKTracking) {
|
|
13452
|
+
initMixpanel(sessionInfo);
|
|
13453
|
+
}
|
|
13374
13454
|
}
|
|
13375
13455
|
/**
|
|
13376
|
-
* Return
|
|
13377
|
-
* authentication is successful. And info is available.
|
|
13378
|
-
*
|
|
13379
|
-
* @group Global methods
|
|
13456
|
+
* Return releaseVersion if available
|
|
13380
13457
|
*/
|
|
13381
|
-
function
|
|
13382
|
-
return
|
|
13458
|
+
function getReleaseVersion() {
|
|
13459
|
+
return releaseVersion;
|
|
13383
13460
|
}
|
|
13384
13461
|
/**
|
|
13385
13462
|
* Check if we are stuck at the SSO redirect URL
|
|
@@ -13410,7 +13487,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13410
13487
|
}
|
|
13411
13488
|
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
13412
13489
|
if (!loggedInStatus) {
|
|
13413
|
-
|
|
13490
|
+
let authToken;
|
|
13491
|
+
try {
|
|
13492
|
+
authToken = await getAuthenticationToken(embedConfig);
|
|
13493
|
+
}
|
|
13494
|
+
catch (e) {
|
|
13495
|
+
loggedInStatus = false;
|
|
13496
|
+
throw e;
|
|
13497
|
+
}
|
|
13414
13498
|
let resp;
|
|
13415
13499
|
try {
|
|
13416
13500
|
resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
|
|
@@ -13568,7 +13652,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13568
13652
|
const { thoughtSpotHost } = embedConfig;
|
|
13569
13653
|
await fetchLogoutService(thoughtSpotHost);
|
|
13570
13654
|
resetCachedAuthToken();
|
|
13571
|
-
const thoughtspotIframes = document.querySelectorAll(
|
|
13655
|
+
const thoughtspotIframes = document.querySelectorAll("[data-ts-iframe='true']");
|
|
13572
13656
|
if (thoughtspotIframes === null || thoughtspotIframes === void 0 ? void 0 : thoughtspotIframes.length) {
|
|
13573
13657
|
thoughtspotIframes.forEach((el) => {
|
|
13574
13658
|
el.parentElement.innerHTML = embedConfig.loginFailedMessage;
|
|
@@ -13623,6 +13707,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13623
13707
|
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
13624
13708
|
}
|
|
13625
13709
|
else {
|
|
13710
|
+
// Post login service is called after successful login.
|
|
13711
|
+
postLoginService();
|
|
13626
13712
|
notifyAuthSDKSuccess();
|
|
13627
13713
|
}
|
|
13628
13714
|
}, () => {
|
|
@@ -13918,13 +14004,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13918
14004
|
};
|
|
13919
14005
|
}
|
|
13920
14006
|
/**
|
|
14007
|
+
* Responds to AuthInit sent from host signifying successful authentication in host.
|
|
13921
14008
|
*
|
|
13922
14009
|
* @param e
|
|
14010
|
+
* @returns {any}
|
|
13923
14011
|
*/
|
|
13924
14012
|
function processAuthInit(e) {
|
|
13925
14013
|
var _a, _b;
|
|
13926
|
-
// Store user session details sent by app.
|
|
13927
|
-
initSession(e.data);
|
|
13928
14014
|
notifyAuthSuccess();
|
|
13929
14015
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|
|
13930
14016
|
return {
|
|
@@ -14062,7 +14148,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14062
14148
|
});
|
|
14063
14149
|
}
|
|
14064
14150
|
|
|
14065
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.29.0-alpha.
|
|
14151
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.29.0-alpha.SCAL-205893-1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"45 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
14066
14152
|
|
|
14067
14153
|
/**
|
|
14068
14154
|
* Copyright (c) 2022
|
|
@@ -14162,6 +14248,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14162
14248
|
});
|
|
14163
14249
|
}
|
|
14164
14250
|
catch (e) {
|
|
14251
|
+
logger.error(`Received invalid token. Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
14165
14252
|
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
14166
14253
|
}
|
|
14167
14254
|
}
|
|
@@ -14506,6 +14593,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14506
14593
|
* @param url - The URL of the embedded ThoughtSpot app.
|
|
14507
14594
|
*/
|
|
14508
14595
|
async renderIFrame(url) {
|
|
14596
|
+
console.log('here 7');
|
|
14509
14597
|
if (this.isError) {
|
|
14510
14598
|
return null;
|
|
14511
14599
|
}
|
|
@@ -14513,8 +14601,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14513
14601
|
this.throwInitError();
|
|
14514
14602
|
}
|
|
14515
14603
|
if (url.length > URL_MAX_LENGTH) ;
|
|
14604
|
+
console.log('here 8');
|
|
14516
14605
|
return renderInQueue((nextInQueue) => {
|
|
14517
14606
|
var _a;
|
|
14607
|
+
console.log('here 6');
|
|
14518
14608
|
const initTimestamp = Date.now();
|
|
14519
14609
|
this.executeCallbacks(exports.EmbedEvent.Init, {
|
|
14520
14610
|
data: {
|
|
@@ -14524,6 +14614,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14524
14614
|
});
|
|
14525
14615
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
14526
14616
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
14617
|
+
console.log('here 9', isLoggedIn);
|
|
14527
14618
|
if (!isLoggedIn) {
|
|
14528
14619
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
14529
14620
|
return;
|
|
@@ -14547,7 +14638,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14547
14638
|
this.iFrame.addEventListener('error', () => {
|
|
14548
14639
|
nextInQueue();
|
|
14549
14640
|
});
|
|
14641
|
+
console.log('here 10', this.iFrame);
|
|
14550
14642
|
this.handleInsertionIntoDOM(this.iFrame);
|
|
14643
|
+
console.log('here 11', document.body.innerHTML);
|
|
14551
14644
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
14552
14645
|
if (prefetchIframe.length) {
|
|
14553
14646
|
prefetchIframe.forEach((el) => {
|
|
@@ -1746,12 +1746,6 @@ export declare let loggedInStatus: boolean;
|
|
|
1746
1746
|
export declare let samlAuthWindow: Window;
|
|
1747
1747
|
export declare let samlCompletionPromise: Promise<void>;
|
|
1748
1748
|
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
|
|
1749
|
-
interface sessionInfoInterface {
|
|
1750
|
-
userGUID: any;
|
|
1751
|
-
isPublicUser: any;
|
|
1752
|
-
mixpanelToken: any;
|
|
1753
|
-
[key: string]: any;
|
|
1754
|
-
}
|
|
1755
1749
|
/**
|
|
1756
1750
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
1757
1751
|
* of {@link AuthStatus.FAILURE}.
|
|
@@ -1869,7 +1863,7 @@ export declare function notifyAuthSDKSuccess(): void;
|
|
|
1869
1863
|
/**
|
|
1870
1864
|
*
|
|
1871
1865
|
*/
|
|
1872
|
-
export declare function notifyAuthSuccess(): void
|
|
1866
|
+
export declare function notifyAuthSuccess(): Promise<void>;
|
|
1873
1867
|
/**
|
|
1874
1868
|
*
|
|
1875
1869
|
* @param failureType
|
|
@@ -1879,19 +1873,23 @@ export declare function notifyAuthFailure(failureType: AuthFailureType): void;
|
|
|
1879
1873
|
*
|
|
1880
1874
|
*/
|
|
1881
1875
|
export declare function notifyLogout(): void;
|
|
1882
|
-
export declare const initSession: (sessionDetails: sessionInfoInterface) => void;
|
|
1883
|
-
export declare const getSessionDetails: (sessionInfoResp: any) => sessionInfoInterface;
|
|
1884
1876
|
/**
|
|
1885
|
-
*
|
|
1877
|
+
* Services to be called after the login is successful,
|
|
1878
|
+
* This should be called after the cookie is set for cookie auth or
|
|
1879
|
+
* after the token is set for cookieless.
|
|
1880
|
+
*
|
|
1881
|
+
* @return {Promise<void>}
|
|
1882
|
+
* @example
|
|
1883
|
+
* ```js
|
|
1884
|
+
* await postLoginService();
|
|
1885
|
+
* ```
|
|
1886
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
1886
1887
|
*/
|
|
1887
|
-
export declare function
|
|
1888
|
+
export declare function postLoginService(): Promise<void>;
|
|
1888
1889
|
/**
|
|
1889
|
-
* Return
|
|
1890
|
-
* authentication is successful. And info is available.
|
|
1891
|
-
*
|
|
1892
|
-
* @group Global methods
|
|
1890
|
+
* Return releaseVersion if available
|
|
1893
1891
|
*/
|
|
1894
|
-
export declare function
|
|
1892
|
+
export declare function getReleaseVersion(): string;
|
|
1895
1893
|
/**
|
|
1896
1894
|
* Perform token based authentication
|
|
1897
1895
|
*
|
|
@@ -1927,7 +1925,72 @@ export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean
|
|
|
1927
1925
|
* Check if we are authenticated to the ThoughtSpot cluster
|
|
1928
1926
|
*/
|
|
1929
1927
|
export declare const isAuthenticated: () => boolean;
|
|
1930
|
-
|
|
1928
|
+
|
|
1929
|
+
export type SessionInfo = {
|
|
1930
|
+
releaseVersion: string;
|
|
1931
|
+
userGUID: string;
|
|
1932
|
+
currentOrgId: number;
|
|
1933
|
+
privileges: string[];
|
|
1934
|
+
mixpanelToken: string;
|
|
1935
|
+
isPublicUser: boolean;
|
|
1936
|
+
clusterId: string;
|
|
1937
|
+
clusterName: string;
|
|
1938
|
+
[key: string]: any;
|
|
1939
|
+
};
|
|
1940
|
+
/**
|
|
1941
|
+
* Returns the session info object and caches it for future use.
|
|
1942
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
1943
|
+
* subsequent calls.
|
|
1944
|
+
*
|
|
1945
|
+
* @example ```js
|
|
1946
|
+
* const sessionInfo = await getSessionInfo();
|
|
1947
|
+
* console.log(sessionInfo);
|
|
1948
|
+
* ```
|
|
1949
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
1950
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
1951
|
+
*/
|
|
1952
|
+
export declare function getSessionInfo(): Promise<SessionInfo>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Returns the cached session info object. If the client is not authenticated the
|
|
1955
|
+
* function will return null.
|
|
1956
|
+
*
|
|
1957
|
+
* @example ```js
|
|
1958
|
+
* const sessionInfo = getCachedSessionInfo();
|
|
1959
|
+
* if (sessionInfo) {
|
|
1960
|
+
* console.log(sessionInfo);
|
|
1961
|
+
* } else {
|
|
1962
|
+
* console.log('Not authenticated');
|
|
1963
|
+
* }
|
|
1964
|
+
* ```
|
|
1965
|
+
* @returns {SessionInfo | null} The session info object.
|
|
1966
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
1967
|
+
*/
|
|
1968
|
+
export declare function getCachedSessionInfo(): SessionInfo | null;
|
|
1969
|
+
/**
|
|
1970
|
+
* Processes the session info response and returns the session info object.
|
|
1971
|
+
*
|
|
1972
|
+
* @param sessionInfoResp {any} Response from the session info API.
|
|
1973
|
+
* @returns {SessionInfo} The session info object.
|
|
1974
|
+
* @example ```js
|
|
1975
|
+
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
1976
|
+
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
1977
|
+
* console.log(sessionInfo);
|
|
1978
|
+
* ```
|
|
1979
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
1980
|
+
*/
|
|
1981
|
+
export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
|
|
1982
|
+
/**
|
|
1983
|
+
* Resets the cached session info object and forces a new fetch on the next call.
|
|
1984
|
+
*
|
|
1985
|
+
* @example ```js
|
|
1986
|
+
* resetCachedSessionInfo();
|
|
1987
|
+
* const sessionInfo = await getSessionInfo();
|
|
1988
|
+
* console.log(sessionInfo);
|
|
1989
|
+
* ```
|
|
1990
|
+
* @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
1991
|
+
* @returns {void}
|
|
1992
|
+
*/
|
|
1993
|
+
export declare function resetCachedSessionInfo(): void;
|
|
1931
1994
|
|
|
1932
1995
|
/**
|
|
1933
1996
|
* Copyright (c) 2023
|
|
@@ -4362,7 +4425,7 @@ export declare enum HostEvent {
|
|
|
4362
4425
|
*
|
|
4363
4426
|
* @example
|
|
4364
4427
|
* ```js
|
|
4365
|
-
* liveboardEmbed.trigger(HostEvent.
|
|
4428
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
4366
4429
|
* data=>console.log(data))
|
|
4367
4430
|
* ```
|
|
4368
4431
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1.sw
|
|
@@ -6550,6 +6613,16 @@ export interface UnderlyingDataPoint {
|
|
|
6550
6613
|
* const data = await underlying.fetchData(0, 100);
|
|
6551
6614
|
* })
|
|
6552
6615
|
* ```
|
|
6616
|
+
* @example
|
|
6617
|
+
* ```js
|
|
6618
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
6619
|
+
* const service = await embed.getAnswerService();
|
|
6620
|
+
* await service.addColumns([
|
|
6621
|
+
* "<column guid>"
|
|
6622
|
+
* ]);
|
|
6623
|
+
* console.log(await service.fetchData());
|
|
6624
|
+
* });
|
|
6625
|
+
* ```
|
|
6553
6626
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
6554
6627
|
* @group Events
|
|
6555
6628
|
*/
|
|
@@ -6689,7 +6762,7 @@ export declare function uploadMixpanelEvent(eventId: string, eventProps?: {}): v
|
|
|
6689
6762
|
*
|
|
6690
6763
|
* @param sessionInfo
|
|
6691
6764
|
*/
|
|
6692
|
-
export declare function initMixpanel(sessionInfo:
|
|
6765
|
+
export declare function initMixpanel(sessionInfo: SessionInfo): void;
|
|
6693
6766
|
/**
|
|
6694
6767
|
*
|
|
6695
6768
|
*/
|
|
@@ -6706,7 +6779,7 @@ export declare function testResetMixpanel(): void;
|
|
|
6706
6779
|
*/
|
|
6707
6780
|
export declare const tokenizedFetch: typeof fetch;
|
|
6708
6781
|
|
|
6709
|
-
export declare
|
|
6782
|
+
export declare function getAuthenticationToken(embedConfig: EmbedConfig): Promise<string>;
|
|
6710
6783
|
/**
|
|
6711
6784
|
* Resets the auth token and a new token will be fetched on the next request.
|
|
6712
6785
|
*
|