@thoughtspot/visual-embed-sdk 1.26.1 → 1.26.2
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 +2 -2
- package/cjs/src/auth.d.ts +0 -12
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +16 -54
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/auth.spec.d.ts.map +1 -1
- package/cjs/src/auth.spec.js +42 -32
- package/cjs/src/auth.spec.js.map +1 -1
- package/cjs/src/authToken.d.ts +4 -0
- package/cjs/src/authToken.d.ts.map +1 -0
- package/cjs/src/authToken.js +61 -0
- package/cjs/src/authToken.js.map +1 -0
- package/cjs/src/embed/TsEmbed.d.ts +302 -0
- package/cjs/src/embed/TsEmbed.d.ts.map +1 -0
- package/cjs/src/embed/TsEmbed.js +851 -0
- package/cjs/src/embed/TsEmbed.js.map +1 -0
- package/cjs/src/embed/base.d.ts +0 -9
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +21 -44
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +15 -14
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts +18 -0
- package/cjs/src/embed/embedConfig.d.ts.map +1 -0
- package/cjs/src/embed/embedConfig.js +25 -0
- package/cjs/src/embed/embedConfig.js.map +1 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +3 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/searchEmbed-basic-auth.spec.js +3 -2
- package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +5 -3
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +58 -49
- 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/tokenizedFetch.d.ts +2 -0
- package/cjs/src/tokenizedFetch.d.ts.map +1 -0
- package/cjs/src/tokenizedFetch.js +20 -0
- package/cjs/src/tokenizedFetch.js.map +1 -0
- package/cjs/src/types.d.ts +6 -0
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/answerService.d.ts +10 -0
- package/cjs/src/utils/answerService.d.ts.map +1 -0
- package/cjs/src/utils/answerService.js +61 -0
- package/cjs/src/utils/answerService.js.map +1 -0
- package/cjs/src/utils/answerService.spec.d.ts +2 -0
- package/cjs/src/utils/answerService.spec.d.ts.map +1 -0
- package/cjs/src/utils/answerService.spec.js +31 -0
- package/cjs/src/utils/answerService.spec.js.map +1 -0
- package/cjs/src/utils/authService/authService.d.ts +45 -0
- package/cjs/src/utils/authService/authService.d.ts.map +1 -0
- package/cjs/src/utils/authService/authService.js +115 -0
- package/cjs/src/utils/authService/authService.js.map +1 -0
- package/cjs/src/utils/authService/authService.spec.d.ts +2 -0
- package/cjs/src/utils/authService/authService.spec.d.ts.map +1 -0
- package/cjs/src/utils/authService/authService.spec.js +82 -0
- package/cjs/src/utils/authService/authService.spec.js.map +1 -0
- package/cjs/src/utils/authService/index.d.ts +3 -0
- package/cjs/src/utils/authService/index.d.ts.map +1 -0
- package/cjs/src/utils/authService/index.js +14 -0
- package/cjs/src/utils/authService/index.js.map +1 -0
- package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
- package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
- package/cjs/src/utils/authService/tokenisedAuthSerice.js +44 -0
- package/cjs/src/utils/authService/tokenisedAuthSerice.js.map +1 -0
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts +11 -0
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
- package/cjs/src/utils/authService/tokenizedAuthService.js +44 -0
- package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -0
- package/cjs/src/utils/authService.d.ts +12 -1
- package/cjs/src/utils/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService.js +32 -16
- package/cjs/src/utils/authService.js.map +1 -1
- package/cjs/src/utils/authService.spec.js +3 -4
- package/cjs/src/utils/authService.spec.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +2 -1
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +15 -3
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/graphql/graphql-request.spec.d.ts +2 -0
- package/cjs/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
- package/cjs/src/utils/graphql/graphql-request.spec.js +39 -0
- package/cjs/src/utils/graphql/graphql-request.spec.js.map +1 -0
- package/cjs/src/utils/logger.d.ts +28 -0
- package/cjs/src/utils/logger.d.ts.map +1 -0
- package/cjs/src/utils/logger.js +82 -0
- package/cjs/src/utils/logger.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +5 -4
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +8 -7
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/src/auth.d.ts +0 -12
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/auth.spec.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +4 -0
- package/dist/src/authToken.d.ts.map +1 -0
- package/dist/src/embed/base.d.ts +0 -9
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts +18 -0
- package/dist/src/embed/embedConfig.d.ts.map +1 -0
- package/dist/src/embed/search.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/tokenizedFetch.d.ts +2 -0
- package/dist/src/tokenizedFetch.d.ts.map +1 -0
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/answerService.d.ts +10 -0
- package/dist/src/utils/answerService.d.ts.map +1 -0
- package/dist/src/utils/answerService.spec.d.ts +2 -0
- package/dist/src/utils/answerService.spec.d.ts.map +1 -0
- package/dist/src/utils/authService/authService.d.ts +45 -0
- package/dist/src/utils/authService/authService.d.ts.map +1 -0
- package/dist/src/utils/authService/authService.spec.d.ts +2 -0
- package/dist/src/utils/authService/authService.spec.d.ts.map +1 -0
- package/dist/src/utils/authService/index.d.ts +3 -0
- package/dist/src/utils/authService/index.d.ts.map +1 -0
- package/dist/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
- package/dist/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
- package/dist/src/utils/authService/tokenizedAuthService.d.ts +11 -0
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
- package/dist/src/utils/authService.d.ts +12 -1
- package/dist/src/utils/authService.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/graphql/graphql-request.spec.d.ts +2 -0
- package/dist/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +28 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +201 -140
- package/dist/tsembed-react.js +201 -140
- package/dist/tsembed.es.js +230 -171
- package/dist/tsembed.js +230 -171
- package/dist/visual-embed-sdk-react-full.d.ts +23 -21
- package/dist/visual-embed-sdk-react.d.ts +23 -21
- package/dist/visual-embed-sdk.d.ts +23 -21
- package/lib/package.json +2 -2
- package/lib/src/auth.d.ts +0 -12
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +11 -48
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts.map +1 -1
- package/lib/src/auth.spec.js +42 -32
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/authToken.d.ts +4 -0
- package/lib/src/authToken.d.ts.map +1 -0
- package/lib/src/authToken.js +56 -0
- package/lib/src/authToken.js.map +1 -0
- package/lib/src/embed/TsEmbed.d.ts +302 -0
- package/lib/src/embed/TsEmbed.d.ts.map +1 -0
- package/lib/src/embed/TsEmbed.js +847 -0
- package/lib/src/embed/TsEmbed.js.map +1 -0
- package/lib/src/embed/base.d.ts +0 -9
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +21 -43
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +15 -14
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts +18 -0
- package/lib/src/embed/embedConfig.d.ts.map +1 -0
- package/lib/src/embed/embedConfig.js +20 -0
- package/lib/src/embed/embedConfig.js.map +1 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +4 -2
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +3 -2
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +4 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +58 -49
- 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/tokenizedFetch.d.ts +2 -0
- package/lib/src/tokenizedFetch.d.ts.map +1 -0
- package/lib/src/tokenizedFetch.js +16 -0
- package/lib/src/tokenizedFetch.js.map +1 -0
- package/lib/src/types.d.ts +6 -0
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/answerService.d.ts +10 -0
- package/lib/src/utils/answerService.d.ts.map +1 -0
- package/lib/src/utils/answerService.js +57 -0
- package/lib/src/utils/answerService.js.map +1 -0
- package/lib/src/utils/answerService.spec.d.ts +2 -0
- package/lib/src/utils/answerService.spec.d.ts.map +1 -0
- package/lib/src/utils/answerService.spec.js +29 -0
- package/lib/src/utils/answerService.spec.js.map +1 -0
- package/lib/src/utils/authService/authService.d.ts +45 -0
- package/lib/src/utils/authService/authService.d.ts.map +1 -0
- package/lib/src/utils/authService/authService.js +107 -0
- package/lib/src/utils/authService/authService.js.map +1 -0
- package/lib/src/utils/authService/authService.spec.d.ts +2 -0
- package/lib/src/utils/authService/authService.spec.d.ts.map +1 -0
- package/lib/src/utils/authService/authService.spec.js +80 -0
- package/lib/src/utils/authService/authService.spec.js.map +1 -0
- package/lib/src/utils/authService/index.d.ts +3 -0
- package/lib/src/utils/authService/index.d.ts.map +1 -0
- package/lib/src/utils/authService/index.js +3 -0
- package/lib/src/utils/authService/index.js.map +1 -0
- package/lib/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
- package/lib/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
- package/lib/src/utils/authService/tokenisedAuthSerice.js +39 -0
- package/lib/src/utils/authService/tokenisedAuthSerice.js.map +1 -0
- package/lib/src/utils/authService/tokenizedAuthService.d.ts +11 -0
- package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
- package/lib/src/utils/authService/tokenizedAuthService.js +39 -0
- package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -0
- package/lib/src/utils/authService.d.ts +12 -1
- package/lib/src/utils/authService.d.ts.map +1 -1
- package/lib/src/utils/authService.js +26 -10
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js +1 -2
- package/lib/src/utils/authService.spec.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +2 -1
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +14 -3
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/graphql/graphql-request.spec.d.ts +2 -0
- package/lib/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
- package/lib/src/utils/graphql/graphql-request.spec.js +36 -0
- package/lib/src/utils/graphql/graphql-request.spec.js.map +1 -0
- package/lib/src/utils/logger.d.ts +28 -0
- package/lib/src/utils/logger.d.ts.map +1 -0
- package/lib/src/utils/logger.js +75 -0
- package/lib/src/utils/logger.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +4 -3
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +8 -7
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +28 -22
- package/package.json +2 -2
- package/src/auth.spec.ts +77 -63
- package/src/auth.ts +12 -55
- package/src/authToken.ts +66 -0
- package/src/embed/base.spec.ts +18 -17
- package/src/embed/base.ts +26 -51
- package/src/embed/embedConfig.ts +23 -0
- package/src/embed/search.ts +10 -10
- package/src/embed/searchEmbed-basic-auth.spec.ts +3 -2
- package/src/embed/ts-embed.spec.ts +87 -75
- package/src/embed/ts-embed.ts +11 -20
- package/src/index.ts +8 -2
- package/src/tokenizedFetch.ts +18 -0
- package/src/types.ts +34 -23
- package/src/utils/{authService.spec.ts → authService/authService.spec.ts} +2 -3
- package/src/utils/{authService.ts → authService/authService.ts} +29 -34
- package/src/utils/authService/index.ts +9 -0
- package/src/utils/authService/tokenizedAuthService.ts +40 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +16 -4
- package/src/utils/graphql/answerService/answerService.ts +2 -1
- package/src/utils/processData.spec.ts +19 -16
- package/src/utils/processData.ts +3 -2
package/dist/tsembed.js
CHANGED
|
@@ -4899,6 +4899,201 @@
|
|
|
4899
4899
|
|
|
4900
4900
|
var isEqual_1 = isEqual;
|
|
4901
4901
|
|
|
4902
|
+
const EndPoints = {
|
|
4903
|
+
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
4904
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
4905
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
4906
|
+
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
4907
|
+
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
4908
|
+
LOGOUT: '/callosum/v1/session/logout',
|
|
4909
|
+
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
4910
|
+
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
4911
|
+
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
4912
|
+
};
|
|
4913
|
+
/**
|
|
4914
|
+
*
|
|
4915
|
+
* @param url
|
|
4916
|
+
* @param options
|
|
4917
|
+
*/
|
|
4918
|
+
function failureLoggedFetch(url, options = {}) {
|
|
4919
|
+
return fetch(url, options).then(async (r) => {
|
|
4920
|
+
var _a;
|
|
4921
|
+
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
4922
|
+
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
4923
|
+
}
|
|
4924
|
+
return r;
|
|
4925
|
+
});
|
|
4926
|
+
}
|
|
4927
|
+
/**
|
|
4928
|
+
* Service to validate a auth token against a ThoughtSpot host.
|
|
4929
|
+
*
|
|
4930
|
+
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
4931
|
+
* @param authToken : Auth token to verify.
|
|
4932
|
+
*/
|
|
4933
|
+
async function verifyTokenService(thoughtSpotHost, authToken) {
|
|
4934
|
+
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
4935
|
+
try {
|
|
4936
|
+
const res = await fetch(authVerificationUrl, {
|
|
4937
|
+
headers: {
|
|
4938
|
+
Authorization: `Bearer ${authToken}`,
|
|
4939
|
+
'x-requested-by': 'ThoughtSpot',
|
|
4940
|
+
},
|
|
4941
|
+
credentials: 'omit',
|
|
4942
|
+
});
|
|
4943
|
+
return res.ok;
|
|
4944
|
+
}
|
|
4945
|
+
catch (e) {
|
|
4946
|
+
console.error(`Token Verification Service failed : ${e.message}`);
|
|
4947
|
+
}
|
|
4948
|
+
return false;
|
|
4949
|
+
}
|
|
4950
|
+
/**
|
|
4951
|
+
*
|
|
4952
|
+
* @param authEndpoint
|
|
4953
|
+
*/
|
|
4954
|
+
async function fetchAuthTokenService(authEndpoint) {
|
|
4955
|
+
return fetch(authEndpoint);
|
|
4956
|
+
}
|
|
4957
|
+
/**
|
|
4958
|
+
*
|
|
4959
|
+
* @param thoughtSpotHost
|
|
4960
|
+
* @param username
|
|
4961
|
+
* @param authToken
|
|
4962
|
+
*/
|
|
4963
|
+
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
4964
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
4965
|
+
credentials: 'include',
|
|
4966
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
4967
|
+
// error
|
|
4968
|
+
redirect: 'manual',
|
|
4969
|
+
});
|
|
4970
|
+
}
|
|
4971
|
+
/**
|
|
4972
|
+
*
|
|
4973
|
+
* @param thoughtSpotHost
|
|
4974
|
+
* @param username
|
|
4975
|
+
* @param authToken
|
|
4976
|
+
*/
|
|
4977
|
+
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
4978
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
4979
|
+
method: 'POST',
|
|
4980
|
+
headers: {
|
|
4981
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
4982
|
+
'x-requested-by': 'ThoughtSpot',
|
|
4983
|
+
},
|
|
4984
|
+
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
4985
|
+
credentials: 'include',
|
|
4986
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
4987
|
+
// error
|
|
4988
|
+
redirect: 'manual',
|
|
4989
|
+
});
|
|
4990
|
+
}
|
|
4991
|
+
/**
|
|
4992
|
+
*
|
|
4993
|
+
* @param thoughtSpotHost
|
|
4994
|
+
* @param username
|
|
4995
|
+
* @param password
|
|
4996
|
+
*/
|
|
4997
|
+
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
4998
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
4999
|
+
method: 'POST',
|
|
5000
|
+
headers: {
|
|
5001
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5002
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5003
|
+
},
|
|
5004
|
+
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
5005
|
+
credentials: 'include',
|
|
5006
|
+
});
|
|
5007
|
+
}
|
|
5008
|
+
|
|
5009
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
5010
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
5011
|
+
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
5012
|
+
let cachedAuthToken = null;
|
|
5013
|
+
// This method can be used to get the authToken using the embedConfig
|
|
5014
|
+
const getAuthenticationToken = async (embedConfig) => {
|
|
5015
|
+
if (cachedAuthToken) {
|
|
5016
|
+
let isCachedTokenStillValid;
|
|
5017
|
+
try {
|
|
5018
|
+
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
5019
|
+
}
|
|
5020
|
+
catch {
|
|
5021
|
+
isCachedTokenStillValid = false;
|
|
5022
|
+
}
|
|
5023
|
+
if (isCachedTokenStillValid)
|
|
5024
|
+
return cachedAuthToken;
|
|
5025
|
+
}
|
|
5026
|
+
const { authEndpoint, getAuthToken } = embedConfig;
|
|
5027
|
+
let authToken = null;
|
|
5028
|
+
if (getAuthToken) {
|
|
5029
|
+
authToken = await getAuthToken();
|
|
5030
|
+
}
|
|
5031
|
+
else {
|
|
5032
|
+
const response = await fetchAuthTokenService(authEndpoint);
|
|
5033
|
+
authToken = await response.text();
|
|
5034
|
+
}
|
|
5035
|
+
// this will throw error if the token is not valid
|
|
5036
|
+
await validateAuthToken(embedConfig, authToken);
|
|
5037
|
+
cachedAuthToken = authToken;
|
|
5038
|
+
return authToken;
|
|
5039
|
+
};
|
|
5040
|
+
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
5041
|
+
try {
|
|
5042
|
+
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
5043
|
+
if (isTokenValid)
|
|
5044
|
+
return true;
|
|
5045
|
+
}
|
|
5046
|
+
catch {
|
|
5047
|
+
return false;
|
|
5048
|
+
}
|
|
5049
|
+
if (cachedAuthToken && cachedAuthToken === authToken) {
|
|
5050
|
+
if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
|
|
5051
|
+
// eslint-disable-next-line no-alert
|
|
5052
|
+
alert(DUPLICATE_TOKEN_ERR);
|
|
5053
|
+
}
|
|
5054
|
+
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
5055
|
+
}
|
|
5056
|
+
else {
|
|
5057
|
+
throw new Error(INVALID_TOKEN_ERR);
|
|
5058
|
+
}
|
|
5059
|
+
};
|
|
5060
|
+
const resetCachedAuthToken = () => {
|
|
5061
|
+
cachedAuthToken = null;
|
|
5062
|
+
};
|
|
5063
|
+
|
|
5064
|
+
let config = {};
|
|
5065
|
+
/**
|
|
5066
|
+
* Gets the configuration embed was initialized with.
|
|
5067
|
+
*
|
|
5068
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
5069
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
5070
|
+
* @group Global methods
|
|
5071
|
+
*/
|
|
5072
|
+
const getEmbedConfig = () => config;
|
|
5073
|
+
/**
|
|
5074
|
+
* Sets the configuration embed was initialized with.
|
|
5075
|
+
*
|
|
5076
|
+
* @param newConfig The configuration to set.
|
|
5077
|
+
* @version SDK: 1.27.0 | ThoughtSpot: *
|
|
5078
|
+
* @group Global methods
|
|
5079
|
+
*/
|
|
5080
|
+
const setEmbedConfig = (newConfig) => {
|
|
5081
|
+
config = newConfig;
|
|
5082
|
+
};
|
|
5083
|
+
|
|
5084
|
+
const tokenizedFetch = async (input, init) => {
|
|
5085
|
+
const embedConfig = getEmbedConfig();
|
|
5086
|
+
if (embedConfig.authType !== exports.AuthType.TrustedAuthTokenCookieless) {
|
|
5087
|
+
return fetch(input, init);
|
|
5088
|
+
}
|
|
5089
|
+
const req = new Request(input, init);
|
|
5090
|
+
const authToken = await getAuthenticationToken(embedConfig);
|
|
5091
|
+
if (authToken) {
|
|
5092
|
+
req.headers.append('Authorization', `Bearer ${authToken}`);
|
|
5093
|
+
}
|
|
5094
|
+
return fetch(req);
|
|
5095
|
+
};
|
|
5096
|
+
|
|
4902
5097
|
/**
|
|
4903
5098
|
*
|
|
4904
5099
|
* @param root0
|
|
@@ -5147,7 +5342,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
5147
5342
|
*/
|
|
5148
5343
|
async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
|
|
5149
5344
|
const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
|
|
5150
|
-
return
|
|
5345
|
+
return tokenizedFetch(fetchUrl, {
|
|
5151
5346
|
credentials: 'include',
|
|
5152
5347
|
});
|
|
5153
5348
|
}
|
|
@@ -11991,14 +12186,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
11991
12186
|
|
|
11992
12187
|
var uniq_1 = uniq;
|
|
11993
12188
|
|
|
11994
|
-
// eslint-disable-next-line import/no-cycle
|
|
11995
12189
|
/**
|
|
11996
12190
|
*
|
|
11997
12191
|
* @param url
|
|
11998
12192
|
* @param options
|
|
11999
12193
|
*/
|
|
12000
|
-
function
|
|
12001
|
-
return
|
|
12194
|
+
function tokenisedFailureLoggedFetch(url, options = {}) {
|
|
12195
|
+
return tokenizedFetch(url, options).then(async (r) => {
|
|
12002
12196
|
var _a;
|
|
12003
12197
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
12004
12198
|
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
@@ -12011,81 +12205,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12011
12205
|
* @param authVerificationUrl
|
|
12012
12206
|
*/
|
|
12013
12207
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
12014
|
-
return
|
|
12015
|
-
credentials: 'include',
|
|
12016
|
-
});
|
|
12017
|
-
}
|
|
12018
|
-
/**
|
|
12019
|
-
* Service to validate a auth token against a ThoughtSpot host.
|
|
12020
|
-
*
|
|
12021
|
-
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
12022
|
-
* @param authToken : Auth token to verify.
|
|
12023
|
-
*/
|
|
12024
|
-
function verifyTokenService(thoughtSpotHost, authToken) {
|
|
12025
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
12026
|
-
return fetch(authVerificationUrl, {
|
|
12027
|
-
headers: {
|
|
12028
|
-
Authorization: `Bearer ${authToken}`,
|
|
12029
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12030
|
-
},
|
|
12031
|
-
credentials: 'omit',
|
|
12032
|
-
});
|
|
12033
|
-
}
|
|
12034
|
-
/**
|
|
12035
|
-
*
|
|
12036
|
-
* @param authEndpoint
|
|
12037
|
-
*/
|
|
12038
|
-
async function fetchAuthTokenService(authEndpoint) {
|
|
12039
|
-
return fetch(authEndpoint);
|
|
12040
|
-
}
|
|
12041
|
-
/**
|
|
12042
|
-
*
|
|
12043
|
-
* @param thoughtSpotHost
|
|
12044
|
-
* @param username
|
|
12045
|
-
* @param authToken
|
|
12046
|
-
*/
|
|
12047
|
-
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
12048
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
12049
|
-
credentials: 'include',
|
|
12050
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12051
|
-
// error
|
|
12052
|
-
redirect: 'manual',
|
|
12053
|
-
});
|
|
12054
|
-
}
|
|
12055
|
-
/**
|
|
12056
|
-
*
|
|
12057
|
-
* @param thoughtSpotHost
|
|
12058
|
-
* @param username
|
|
12059
|
-
* @param authToken
|
|
12060
|
-
*/
|
|
12061
|
-
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
12062
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
12063
|
-
method: 'POST',
|
|
12064
|
-
headers: {
|
|
12065
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12066
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12067
|
-
},
|
|
12068
|
-
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
12069
|
-
credentials: 'include',
|
|
12070
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12071
|
-
// error
|
|
12072
|
-
redirect: 'manual',
|
|
12073
|
-
});
|
|
12074
|
-
}
|
|
12075
|
-
/**
|
|
12076
|
-
*
|
|
12077
|
-
* @param thoughtSpotHost
|
|
12078
|
-
* @param username
|
|
12079
|
-
* @param password
|
|
12080
|
-
*/
|
|
12081
|
-
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
12082
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
12083
|
-
method: 'POST',
|
|
12084
|
-
headers: {
|
|
12085
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12086
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12087
|
-
},
|
|
12088
|
-
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
12208
|
+
return tokenisedFailureLoggedFetch(authVerificationUrl, {
|
|
12089
12209
|
credentials: 'include',
|
|
12090
12210
|
});
|
|
12091
12211
|
}
|
|
@@ -12094,7 +12214,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12094
12214
|
* @param thoughtSpotHost
|
|
12095
12215
|
*/
|
|
12096
12216
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
12097
|
-
return
|
|
12217
|
+
return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
12098
12218
|
credentials: 'include',
|
|
12099
12219
|
method: 'POST',
|
|
12100
12220
|
headers: {
|
|
@@ -12116,17 +12236,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12116
12236
|
});
|
|
12117
12237
|
let releaseVersion = '';
|
|
12118
12238
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
12119
|
-
const EndPoints = {
|
|
12120
|
-
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
12121
|
-
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
12122
|
-
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
12123
|
-
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
12124
|
-
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
12125
|
-
LOGOUT: '/callosum/v1/session/logout',
|
|
12126
|
-
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
12127
|
-
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
12128
|
-
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
12129
|
-
};
|
|
12130
12239
|
(function (AuthFailureType) {
|
|
12131
12240
|
AuthFailureType["SDK"] = "SDK";
|
|
12132
12241
|
AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
|
|
@@ -12274,21 +12383,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12274
12383
|
function getSessionInfo() {
|
|
12275
12384
|
return sessionInfoPromise;
|
|
12276
12385
|
}
|
|
12277
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
12278
|
-
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
12279
|
-
let prevAuthToken = null;
|
|
12280
|
-
/**
|
|
12281
|
-
*
|
|
12282
|
-
* @param authtoken
|
|
12283
|
-
*/
|
|
12284
|
-
function alertForDuplicateToken(authtoken) {
|
|
12285
|
-
if (prevAuthToken === authtoken) {
|
|
12286
|
-
// eslint-disable-next-line no-alert
|
|
12287
|
-
alert(DUPLICATE_TOKEN_ERR);
|
|
12288
|
-
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
12289
|
-
}
|
|
12290
|
-
prevAuthToken = authtoken;
|
|
12291
|
-
}
|
|
12292
12386
|
/**
|
|
12293
12387
|
* Check if we are stuck at the SSO redirect URL
|
|
12294
12388
|
*/
|
|
@@ -12306,19 +12400,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12306
12400
|
// that creates an issue.
|
|
12307
12401
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
12308
12402
|
}
|
|
12309
|
-
const getAuthenticationToken = async (embedConfig) => {
|
|
12310
|
-
const { authEndpoint, getAuthToken } = embedConfig;
|
|
12311
|
-
let authToken = null;
|
|
12312
|
-
if (getAuthToken) {
|
|
12313
|
-
authToken = await getAuthToken();
|
|
12314
|
-
alertForDuplicateToken(authToken);
|
|
12315
|
-
}
|
|
12316
|
-
else {
|
|
12317
|
-
const response = await fetchAuthTokenService(authEndpoint);
|
|
12318
|
-
authToken = await response.text();
|
|
12319
|
-
}
|
|
12320
|
-
return authToken;
|
|
12321
|
-
};
|
|
12322
12403
|
/**
|
|
12323
12404
|
* Perform token based authentication
|
|
12324
12405
|
*
|
|
@@ -12359,16 +12440,17 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12359
12440
|
if (!authEndpoint && !getAuthToken) {
|
|
12360
12441
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
12361
12442
|
}
|
|
12443
|
+
let authSuccess = false;
|
|
12362
12444
|
try {
|
|
12363
12445
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12446
|
+
if (authToken) {
|
|
12447
|
+
authSuccess = true;
|
|
12448
|
+
}
|
|
12367
12449
|
}
|
|
12368
|
-
catch
|
|
12369
|
-
|
|
12450
|
+
catch {
|
|
12451
|
+
authSuccess = false;
|
|
12370
12452
|
}
|
|
12371
|
-
return
|
|
12453
|
+
return authSuccess;
|
|
12372
12454
|
};
|
|
12373
12455
|
/**
|
|
12374
12456
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -12486,7 +12568,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12486
12568
|
};
|
|
12487
12569
|
const logout = async (embedConfig) => {
|
|
12488
12570
|
const { thoughtSpotHost } = embedConfig;
|
|
12489
|
-
|
|
12571
|
+
await fetchLogoutService(thoughtSpotHost);
|
|
12572
|
+
resetCachedAuthToken();
|
|
12490
12573
|
loggedInStatus = false;
|
|
12491
12574
|
return loggedInStatus;
|
|
12492
12575
|
};
|
|
@@ -12518,27 +12601,18 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12518
12601
|
};
|
|
12519
12602
|
|
|
12520
12603
|
/* eslint-disable camelcase */
|
|
12521
|
-
let config = {};
|
|
12522
12604
|
const CONFIG_DEFAULTS = {
|
|
12523
12605
|
loginFailedMessage: 'Not logged in',
|
|
12524
12606
|
authTriggerText: 'Authorize',
|
|
12525
12607
|
authType: exports.AuthType.None,
|
|
12526
12608
|
};
|
|
12527
12609
|
let authPromise;
|
|
12528
|
-
/**
|
|
12529
|
-
* Gets the configuration embed was initialized with.
|
|
12530
|
-
*
|
|
12531
|
-
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
12532
|
-
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
12533
|
-
* @group Global methods
|
|
12534
|
-
*/
|
|
12535
|
-
const getEmbedConfig = () => config;
|
|
12536
12610
|
const getAuthPromise = () => authPromise;
|
|
12537
12611
|
/**
|
|
12538
12612
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
12539
12613
|
*/
|
|
12540
12614
|
const handleAuth = () => {
|
|
12541
|
-
authPromise = authenticate(
|
|
12615
|
+
authPromise = authenticate(getEmbedConfig());
|
|
12542
12616
|
authPromise.then((isLoggedIn) => {
|
|
12543
12617
|
if (!isLoggedIn) {
|
|
12544
12618
|
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
@@ -12574,7 +12648,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12574
12648
|
}
|
|
12575
12649
|
else {
|
|
12576
12650
|
const features = prefetchFeatures || [exports.PrefetchFeatures.FullApp];
|
|
12577
|
-
let hostUrl = url ||
|
|
12651
|
+
let hostUrl = url || getEmbedConfig().thoughtSpotHost;
|
|
12578
12652
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
12579
12653
|
uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
12580
12654
|
const iFrame = document.createElement('iframe');
|
|
@@ -12640,16 +12714,15 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12640
12714
|
const init = (embedConfig) => {
|
|
12641
12715
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
12642
12716
|
sanity(embedConfig);
|
|
12643
|
-
|
|
12717
|
+
setEmbedConfig(backwardCompat({
|
|
12644
12718
|
...CONFIG_DEFAULTS,
|
|
12645
12719
|
...embedConfig,
|
|
12646
12720
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
12647
|
-
};
|
|
12648
|
-
config = backwardCompat(config);
|
|
12721
|
+
}));
|
|
12649
12722
|
const authEE = new eventemitter3();
|
|
12650
12723
|
setAuthEE(authEE);
|
|
12651
12724
|
handleAuth();
|
|
12652
|
-
const { password, ...configToTrack } =
|
|
12725
|
+
const { password, ...configToTrack } = getEmbedConfig();
|
|
12653
12726
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
12654
12727
|
...configToTrack,
|
|
12655
12728
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
@@ -12658,8 +12731,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12658
12731
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
12659
12732
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
12660
12733
|
});
|
|
12661
|
-
if (
|
|
12662
|
-
prefetch(
|
|
12734
|
+
if (getEmbedConfig().callPrefetch) {
|
|
12735
|
+
prefetch(getEmbedConfig().thoughtSpotHost);
|
|
12663
12736
|
}
|
|
12664
12737
|
return authEE;
|
|
12665
12738
|
};
|
|
@@ -12667,7 +12740,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12667
12740
|
*
|
|
12668
12741
|
*/
|
|
12669
12742
|
function disableAutoLogin() {
|
|
12670
|
-
|
|
12743
|
+
getEmbedConfig().autoLogin = false;
|
|
12671
12744
|
}
|
|
12672
12745
|
/**
|
|
12673
12746
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -12685,7 +12758,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12685
12758
|
if (!doNotDisableAutoLogin) {
|
|
12686
12759
|
disableAutoLogin();
|
|
12687
12760
|
}
|
|
12688
|
-
return logout(
|
|
12761
|
+
return logout(getEmbedConfig()).then((isLoggedIn) => {
|
|
12689
12762
|
notifyLogout();
|
|
12690
12763
|
return isLoggedIn;
|
|
12691
12764
|
});
|
|
@@ -12698,7 +12771,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12698
12771
|
* @param fn The function being registered
|
|
12699
12772
|
*/
|
|
12700
12773
|
const renderInQueue = (fn) => {
|
|
12701
|
-
const { queueMultiRenders = false } =
|
|
12774
|
+
const { queueMultiRenders = false } = getEmbedConfig();
|
|
12702
12775
|
if (queueMultiRenders) {
|
|
12703
12776
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
12704
12777
|
return renderQueue;
|
|
@@ -12730,30 +12803,23 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12730
12803
|
* @group Global methods
|
|
12731
12804
|
*/
|
|
12732
12805
|
const executeTML = async (data) => {
|
|
12733
|
-
const { thoughtSpotHost, authType } = config;
|
|
12734
12806
|
try {
|
|
12735
|
-
sanity(
|
|
12807
|
+
sanity(getEmbedConfig());
|
|
12736
12808
|
}
|
|
12737
12809
|
catch (err) {
|
|
12738
12810
|
return Promise.reject(err);
|
|
12739
12811
|
}
|
|
12740
|
-
|
|
12741
|
-
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
12742
|
-
authToken = await getAuthenticationToken(config);
|
|
12743
|
-
}
|
|
12812
|
+
const { thoughtSpotHost, authType } = getEmbedConfig();
|
|
12744
12813
|
const headers = {
|
|
12745
12814
|
'Content-Type': 'application/json',
|
|
12746
12815
|
'x-requested-by': 'ThoughtSpot',
|
|
12747
12816
|
};
|
|
12748
|
-
if (authToken) {
|
|
12749
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
12750
|
-
}
|
|
12751
12817
|
const payload = {
|
|
12752
12818
|
metadata_tmls: data.metadata_tmls,
|
|
12753
12819
|
import_policy: data.import_policy || 'PARTIAL',
|
|
12754
12820
|
create_new: data.create_new || false,
|
|
12755
12821
|
};
|
|
12756
|
-
return
|
|
12822
|
+
return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXECUTE_TML}`, {
|
|
12757
12823
|
method: 'POST',
|
|
12758
12824
|
headers,
|
|
12759
12825
|
body: JSON.stringify(payload),
|
|
@@ -12796,14 +12862,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12796
12862
|
console.error(error);
|
|
12797
12863
|
});
|
|
12798
12864
|
* ```
|
|
12799
|
-
*
|
|
12800
12865
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
12801
12866
|
* @group Global methods
|
|
12802
12867
|
*/
|
|
12803
12868
|
const exportTML = async (data) => {
|
|
12804
|
-
const { thoughtSpotHost, authType } =
|
|
12869
|
+
const { thoughtSpotHost, authType } = getEmbedConfig();
|
|
12805
12870
|
try {
|
|
12806
|
-
sanity(
|
|
12871
|
+
sanity(getEmbedConfig());
|
|
12807
12872
|
}
|
|
12808
12873
|
catch (err) {
|
|
12809
12874
|
return Promise.reject(err);
|
|
@@ -12814,18 +12879,11 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12814
12879
|
export_fqn: data.export_fqn || false,
|
|
12815
12880
|
edoc_format: data.edoc_format || 'YAML',
|
|
12816
12881
|
};
|
|
12817
|
-
let authToken = '';
|
|
12818
|
-
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
12819
|
-
authToken = await getAuthenticationToken(config);
|
|
12820
|
-
}
|
|
12821
12882
|
const headers = {
|
|
12822
12883
|
'Content-Type': 'application/json',
|
|
12823
12884
|
'x-requested-by': 'ThoughtSpot',
|
|
12824
12885
|
};
|
|
12825
|
-
|
|
12826
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
12827
|
-
}
|
|
12828
|
-
return fetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
|
|
12886
|
+
return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
|
|
12829
12887
|
method: 'POST',
|
|
12830
12888
|
headers,
|
|
12831
12889
|
body: JSON.stringify(payload),
|
|
@@ -12878,9 +12936,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12878
12936
|
* @param containerEl
|
|
12879
12937
|
*/
|
|
12880
12938
|
function processNoCookieAccess(e, containerEl) {
|
|
12881
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
|
|
12939
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
|
|
12882
12940
|
if (!ignoreNoCookieAccess) {
|
|
12883
|
-
if (!suppressNoCookieAccessAlert) {
|
|
12941
|
+
if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
|
|
12884
12942
|
// eslint-disable-next-line no-alert
|
|
12885
12943
|
alert('Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.');
|
|
12886
12944
|
}
|
|
@@ -12998,7 +13056,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12998
13056
|
});
|
|
12999
13057
|
}
|
|
13000
13058
|
|
|
13001
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.26.
|
|
13059
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.26.2";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","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:"44 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};
|
|
13002
13060
|
|
|
13003
13061
|
/**
|
|
13004
13062
|
* Copyright (c) 2022
|
|
@@ -14542,7 +14600,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14542
14600
|
const src = this.getIFrameSrc(answerId);
|
|
14543
14601
|
this.renderIFrame(src);
|
|
14544
14602
|
getAuthPromise().then(() => {
|
|
14545
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14603
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14604
|
+
|| getEmbedConfig().suppressErrorAlerts)) {
|
|
14546
14605
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
14547
14606
|
}
|
|
14548
14607
|
});
|