@thoughtspot/visual-embed-sdk 1.26.1-alpha.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cjs/package.json +3 -3
- package/cjs/src/auth.d.ts +12 -0
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +54 -16
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/auth.spec.d.ts.map +1 -1
- package/cjs/src/auth.spec.js +32 -42
- package/cjs/src/auth.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +9 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +44 -21
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +14 -15
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts +4 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +2 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/searchEmbed-basic-auth.spec.js +2 -3
- 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 +3 -5
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +49 -58
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +1 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +1 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +12 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +0 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService.d.ts +1 -12
- package/cjs/src/utils/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService.js +16 -32
- package/cjs/src/utils/authService.js.map +1 -1
- package/cjs/src/utils/authService.spec.js +4 -3
- 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 +1 -2
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +3 -15
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +4 -5
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +7 -8
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/src/auth.d.ts +12 -0
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/auth.spec.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +9 -0
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +4 -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 +1 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +0 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService.d.ts +1 -12
- 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/processData.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +141 -202
- package/dist/tsembed-react.js +141 -202
- package/dist/tsembed.es.js +172 -231
- package/dist/tsembed.js +172 -231
- package/dist/visual-embed-sdk-react-full.d.ts +25 -23
- package/dist/visual-embed-sdk-react.d.ts +25 -23
- package/dist/visual-embed-sdk.d.ts +25 -23
- package/lib/package.json +3 -3
- package/lib/src/auth.d.ts +12 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +48 -11
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts.map +1 -1
- package/lib/src/auth.spec.js +32 -42
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +9 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +43 -21
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +14 -15
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +4 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +3 -5
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +2 -3
- 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 +2 -4
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +49 -58
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +1 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +1 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.spec.js +12 -0
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +0 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService.d.ts +1 -12
- package/lib/src/utils/authService.d.ts.map +1 -1
- package/lib/src/utils/authService.js +10 -26
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js +2 -1
- 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 +1 -2
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +3 -14
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +3 -4
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +7 -8
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +26 -28
- package/package.json +3 -3
- package/src/auth.spec.ts +63 -77
- package/src/auth.ts +55 -12
- package/src/embed/base.spec.ts +17 -18
- package/src/embed/base.ts +51 -26
- package/src/embed/search.ts +15 -10
- package/src/embed/searchEmbed-basic-auth.spec.ts +2 -3
- package/src/embed/ts-embed.spec.ts +75 -87
- package/src/embed/ts-embed.ts +20 -11
- package/src/index.ts +2 -8
- package/src/react/index.spec.tsx +29 -0
- package/src/types.ts +24 -34
- package/src/utils/{authService/authService.spec.ts → authService.spec.ts} +3 -2
- package/src/utils/{authService/authService.ts → authService.ts} +34 -29
- package/src/utils/graphql/answerService/answerService.spec.ts +4 -16
- package/src/utils/graphql/answerService/answerService.ts +1 -2
- package/src/utils/processData.spec.ts +16 -19
- package/src/utils/processData.ts +2 -3
- package/cjs/src/authToken.d.ts +0 -4
- package/cjs/src/authToken.d.ts.map +0 -1
- package/cjs/src/authToken.js +0 -61
- package/cjs/src/authToken.js.map +0 -1
- package/cjs/src/embed/TsEmbed.d.ts +0 -302
- package/cjs/src/embed/TsEmbed.d.ts.map +0 -1
- package/cjs/src/embed/TsEmbed.js +0 -851
- package/cjs/src/embed/TsEmbed.js.map +0 -1
- package/cjs/src/embed/embedConfig.d.ts +0 -18
- package/cjs/src/embed/embedConfig.d.ts.map +0 -1
- package/cjs/src/embed/embedConfig.js +0 -25
- package/cjs/src/embed/embedConfig.js.map +0 -1
- package/cjs/src/tokenizedFetch.d.ts +0 -2
- package/cjs/src/tokenizedFetch.d.ts.map +0 -1
- package/cjs/src/tokenizedFetch.js +0 -20
- package/cjs/src/tokenizedFetch.js.map +0 -1
- package/cjs/src/utils/answerService.d.ts +0 -10
- package/cjs/src/utils/answerService.d.ts.map +0 -1
- package/cjs/src/utils/answerService.js +0 -61
- package/cjs/src/utils/answerService.js.map +0 -1
- package/cjs/src/utils/answerService.spec.d.ts +0 -2
- package/cjs/src/utils/answerService.spec.d.ts.map +0 -1
- package/cjs/src/utils/answerService.spec.js +0 -31
- package/cjs/src/utils/answerService.spec.js.map +0 -1
- package/cjs/src/utils/authService/authService.d.ts +0 -45
- package/cjs/src/utils/authService/authService.d.ts.map +0 -1
- package/cjs/src/utils/authService/authService.js +0 -115
- package/cjs/src/utils/authService/authService.js.map +0 -1
- package/cjs/src/utils/authService/authService.spec.d.ts +0 -2
- package/cjs/src/utils/authService/authService.spec.d.ts.map +0 -1
- package/cjs/src/utils/authService/authService.spec.js +0 -82
- package/cjs/src/utils/authService/authService.spec.js.map +0 -1
- package/cjs/src/utils/authService/index.d.ts +0 -3
- package/cjs/src/utils/authService/index.d.ts.map +0 -1
- package/cjs/src/utils/authService/index.js +0 -14
- package/cjs/src/utils/authService/index.js.map +0 -1
- package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts +0 -11
- package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts.map +0 -1
- package/cjs/src/utils/authService/tokenisedAuthSerice.js +0 -44
- package/cjs/src/utils/authService/tokenisedAuthSerice.js.map +0 -1
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts +0 -11
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +0 -1
- package/cjs/src/utils/authService/tokenizedAuthService.js +0 -44
- package/cjs/src/utils/authService/tokenizedAuthService.js.map +0 -1
- package/cjs/src/utils/graphql/graphql-request.spec.d.ts +0 -2
- package/cjs/src/utils/graphql/graphql-request.spec.d.ts.map +0 -1
- package/cjs/src/utils/graphql/graphql-request.spec.js +0 -39
- package/cjs/src/utils/graphql/graphql-request.spec.js.map +0 -1
- package/cjs/src/utils/logger.d.ts +0 -28
- package/cjs/src/utils/logger.d.ts.map +0 -1
- package/cjs/src/utils/logger.js +0 -82
- package/cjs/src/utils/logger.js.map +0 -1
- package/dist/src/authToken.d.ts +0 -4
- package/dist/src/authToken.d.ts.map +0 -1
- package/dist/src/embed/embedConfig.d.ts +0 -18
- package/dist/src/embed/embedConfig.d.ts.map +0 -1
- package/dist/src/tokenizedFetch.d.ts +0 -2
- package/dist/src/tokenizedFetch.d.ts.map +0 -1
- package/dist/src/utils/answerService.d.ts +0 -10
- package/dist/src/utils/answerService.d.ts.map +0 -1
- package/dist/src/utils/answerService.spec.d.ts +0 -2
- package/dist/src/utils/answerService.spec.d.ts.map +0 -1
- package/dist/src/utils/authService/authService.d.ts +0 -45
- package/dist/src/utils/authService/authService.d.ts.map +0 -1
- package/dist/src/utils/authService/authService.spec.d.ts +0 -2
- package/dist/src/utils/authService/authService.spec.d.ts.map +0 -1
- package/dist/src/utils/authService/index.d.ts +0 -3
- package/dist/src/utils/authService/index.d.ts.map +0 -1
- package/dist/src/utils/authService/tokenisedAuthSerice.d.ts +0 -11
- package/dist/src/utils/authService/tokenisedAuthSerice.d.ts.map +0 -1
- package/dist/src/utils/authService/tokenizedAuthService.d.ts +0 -11
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +0 -1
- package/dist/src/utils/graphql/graphql-request.spec.d.ts +0 -2
- package/dist/src/utils/graphql/graphql-request.spec.d.ts.map +0 -1
- package/dist/src/utils/logger.d.ts +0 -28
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/lib/src/authToken.d.ts +0 -4
- package/lib/src/authToken.d.ts.map +0 -1
- package/lib/src/authToken.js +0 -56
- package/lib/src/authToken.js.map +0 -1
- package/lib/src/embed/TsEmbed.d.ts +0 -302
- package/lib/src/embed/TsEmbed.d.ts.map +0 -1
- package/lib/src/embed/TsEmbed.js +0 -847
- package/lib/src/embed/TsEmbed.js.map +0 -1
- package/lib/src/embed/embedConfig.d.ts +0 -18
- package/lib/src/embed/embedConfig.d.ts.map +0 -1
- package/lib/src/embed/embedConfig.js +0 -20
- package/lib/src/embed/embedConfig.js.map +0 -1
- package/lib/src/tokenizedFetch.d.ts +0 -2
- package/lib/src/tokenizedFetch.d.ts.map +0 -1
- package/lib/src/tokenizedFetch.js +0 -16
- package/lib/src/tokenizedFetch.js.map +0 -1
- package/lib/src/utils/answerService.d.ts +0 -10
- package/lib/src/utils/answerService.d.ts.map +0 -1
- package/lib/src/utils/answerService.js +0 -57
- package/lib/src/utils/answerService.js.map +0 -1
- package/lib/src/utils/answerService.spec.d.ts +0 -2
- package/lib/src/utils/answerService.spec.d.ts.map +0 -1
- package/lib/src/utils/answerService.spec.js +0 -29
- package/lib/src/utils/answerService.spec.js.map +0 -1
- package/lib/src/utils/authService/authService.d.ts +0 -45
- package/lib/src/utils/authService/authService.d.ts.map +0 -1
- package/lib/src/utils/authService/authService.js +0 -107
- package/lib/src/utils/authService/authService.js.map +0 -1
- package/lib/src/utils/authService/authService.spec.d.ts +0 -2
- package/lib/src/utils/authService/authService.spec.d.ts.map +0 -1
- package/lib/src/utils/authService/authService.spec.js +0 -80
- package/lib/src/utils/authService/authService.spec.js.map +0 -1
- package/lib/src/utils/authService/index.d.ts +0 -3
- package/lib/src/utils/authService/index.d.ts.map +0 -1
- package/lib/src/utils/authService/index.js +0 -3
- package/lib/src/utils/authService/index.js.map +0 -1
- package/lib/src/utils/authService/tokenisedAuthSerice.d.ts +0 -11
- package/lib/src/utils/authService/tokenisedAuthSerice.d.ts.map +0 -1
- package/lib/src/utils/authService/tokenisedAuthSerice.js +0 -39
- package/lib/src/utils/authService/tokenisedAuthSerice.js.map +0 -1
- package/lib/src/utils/authService/tokenizedAuthService.d.ts +0 -11
- package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +0 -1
- package/lib/src/utils/authService/tokenizedAuthService.js +0 -39
- package/lib/src/utils/authService/tokenizedAuthService.js.map +0 -1
- package/lib/src/utils/graphql/graphql-request.spec.d.ts +0 -2
- package/lib/src/utils/graphql/graphql-request.spec.d.ts.map +0 -1
- package/lib/src/utils/graphql/graphql-request.spec.js +0 -36
- package/lib/src/utils/graphql/graphql-request.spec.js.map +0 -1
- package/lib/src/utils/logger.d.ts +0 -28
- package/lib/src/utils/logger.d.ts.map +0 -1
- package/lib/src/utils/logger.js +0 -75
- package/lib/src/utils/logger.js.map +0 -1
- package/src/authToken.ts +0 -66
- package/src/embed/embedConfig.ts +0 -23
- package/src/tokenizedFetch.ts +0 -18
- package/src/utils/authService/index.ts +0 -9
- package/src/utils/authService/tokenizedAuthService.ts +0 -40
package/dist/tsembed.js
CHANGED
|
@@ -4899,201 +4899,6 @@
|
|
|
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
|
-
|
|
5097
4902
|
/**
|
|
5098
4903
|
*
|
|
5099
4904
|
* @param root0
|
|
@@ -5342,7 +5147,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
5342
5147
|
*/
|
|
5343
5148
|
async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
|
|
5344
5149
|
const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
|
|
5345
|
-
return
|
|
5150
|
+
return fetch(fetchUrl, {
|
|
5346
5151
|
credentials: 'include',
|
|
5347
5152
|
});
|
|
5348
5153
|
}
|
|
@@ -12186,13 +11991,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12186
11991
|
|
|
12187
11992
|
var uniq_1 = uniq;
|
|
12188
11993
|
|
|
11994
|
+
// eslint-disable-next-line import/no-cycle
|
|
12189
11995
|
/**
|
|
12190
11996
|
*
|
|
12191
11997
|
* @param url
|
|
12192
11998
|
* @param options
|
|
12193
11999
|
*/
|
|
12194
|
-
function
|
|
12195
|
-
return
|
|
12000
|
+
function failureLoggedFetch(url, options = {}) {
|
|
12001
|
+
return fetch(url, options).then(async (r) => {
|
|
12196
12002
|
var _a;
|
|
12197
12003
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
12198
12004
|
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
@@ -12205,7 +12011,81 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12205
12011
|
* @param authVerificationUrl
|
|
12206
12012
|
*/
|
|
12207
12013
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
12208
|
-
return
|
|
12014
|
+
return failureLoggedFetch(authVerificationUrl, {
|
|
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)}`,
|
|
12209
12089
|
credentials: 'include',
|
|
12210
12090
|
});
|
|
12211
12091
|
}
|
|
@@ -12214,7 +12094,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12214
12094
|
* @param thoughtSpotHost
|
|
12215
12095
|
*/
|
|
12216
12096
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
12217
|
-
return
|
|
12097
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
12218
12098
|
credentials: 'include',
|
|
12219
12099
|
method: 'POST',
|
|
12220
12100
|
headers: {
|
|
@@ -12236,6 +12116,17 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12236
12116
|
});
|
|
12237
12117
|
let releaseVersion = '';
|
|
12238
12118
|
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
|
+
};
|
|
12239
12130
|
(function (AuthFailureType) {
|
|
12240
12131
|
AuthFailureType["SDK"] = "SDK";
|
|
12241
12132
|
AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
|
|
@@ -12383,6 +12274,21 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12383
12274
|
function getSessionInfo() {
|
|
12384
12275
|
return sessionInfoPromise;
|
|
12385
12276
|
}
|
|
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
|
+
}
|
|
12386
12292
|
/**
|
|
12387
12293
|
* Check if we are stuck at the SSO redirect URL
|
|
12388
12294
|
*/
|
|
@@ -12400,6 +12306,19 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12400
12306
|
// that creates an issue.
|
|
12401
12307
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
12402
12308
|
}
|
|
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
|
+
};
|
|
12403
12322
|
/**
|
|
12404
12323
|
* Perform token based authentication
|
|
12405
12324
|
*
|
|
@@ -12440,17 +12359,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12440
12359
|
if (!authEndpoint && !getAuthToken) {
|
|
12441
12360
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
12442
12361
|
}
|
|
12443
|
-
let authSuccess = false;
|
|
12444
12362
|
try {
|
|
12445
12363
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12364
|
+
const response = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
12365
|
+
if (!response.ok)
|
|
12366
|
+
return false;
|
|
12449
12367
|
}
|
|
12450
|
-
catch {
|
|
12451
|
-
|
|
12368
|
+
catch (e) {
|
|
12369
|
+
return false;
|
|
12452
12370
|
}
|
|
12453
|
-
return
|
|
12371
|
+
return true;
|
|
12454
12372
|
};
|
|
12455
12373
|
/**
|
|
12456
12374
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -12568,8 +12486,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12568
12486
|
};
|
|
12569
12487
|
const logout = async (embedConfig) => {
|
|
12570
12488
|
const { thoughtSpotHost } = embedConfig;
|
|
12571
|
-
await fetchLogoutService(thoughtSpotHost);
|
|
12572
|
-
resetCachedAuthToken();
|
|
12489
|
+
const response = await fetchLogoutService(thoughtSpotHost);
|
|
12573
12490
|
loggedInStatus = false;
|
|
12574
12491
|
return loggedInStatus;
|
|
12575
12492
|
};
|
|
@@ -12601,18 +12518,27 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12601
12518
|
};
|
|
12602
12519
|
|
|
12603
12520
|
/* eslint-disable camelcase */
|
|
12521
|
+
let config = {};
|
|
12604
12522
|
const CONFIG_DEFAULTS = {
|
|
12605
12523
|
loginFailedMessage: 'Not logged in',
|
|
12606
12524
|
authTriggerText: 'Authorize',
|
|
12607
12525
|
authType: exports.AuthType.None,
|
|
12608
12526
|
};
|
|
12609
12527
|
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;
|
|
12610
12536
|
const getAuthPromise = () => authPromise;
|
|
12611
12537
|
/**
|
|
12612
12538
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
12613
12539
|
*/
|
|
12614
12540
|
const handleAuth = () => {
|
|
12615
|
-
authPromise = authenticate(
|
|
12541
|
+
authPromise = authenticate(config);
|
|
12616
12542
|
authPromise.then((isLoggedIn) => {
|
|
12617
12543
|
if (!isLoggedIn) {
|
|
12618
12544
|
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
@@ -12648,7 +12574,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12648
12574
|
}
|
|
12649
12575
|
else {
|
|
12650
12576
|
const features = prefetchFeatures || [exports.PrefetchFeatures.FullApp];
|
|
12651
|
-
let hostUrl = url ||
|
|
12577
|
+
let hostUrl = url || config.thoughtSpotHost;
|
|
12652
12578
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
12653
12579
|
uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
12654
12580
|
const iFrame = document.createElement('iframe');
|
|
@@ -12714,15 +12640,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12714
12640
|
const init = (embedConfig) => {
|
|
12715
12641
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
12716
12642
|
sanity(embedConfig);
|
|
12717
|
-
|
|
12643
|
+
config = {
|
|
12718
12644
|
...CONFIG_DEFAULTS,
|
|
12719
12645
|
...embedConfig,
|
|
12720
12646
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
12721
|
-
}
|
|
12647
|
+
};
|
|
12648
|
+
config = backwardCompat(config);
|
|
12722
12649
|
const authEE = new eventemitter3();
|
|
12723
12650
|
setAuthEE(authEE);
|
|
12724
12651
|
handleAuth();
|
|
12725
|
-
const { password, ...configToTrack } =
|
|
12652
|
+
const { password, ...configToTrack } = config;
|
|
12726
12653
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
12727
12654
|
...configToTrack,
|
|
12728
12655
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
@@ -12731,8 +12658,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12731
12658
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
12732
12659
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
12733
12660
|
});
|
|
12734
|
-
if (
|
|
12735
|
-
prefetch(
|
|
12661
|
+
if (config.callPrefetch) {
|
|
12662
|
+
prefetch(config.thoughtSpotHost);
|
|
12736
12663
|
}
|
|
12737
12664
|
return authEE;
|
|
12738
12665
|
};
|
|
@@ -12740,7 +12667,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12740
12667
|
*
|
|
12741
12668
|
*/
|
|
12742
12669
|
function disableAutoLogin() {
|
|
12743
|
-
|
|
12670
|
+
config.autoLogin = false;
|
|
12744
12671
|
}
|
|
12745
12672
|
/**
|
|
12746
12673
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -12758,7 +12685,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12758
12685
|
if (!doNotDisableAutoLogin) {
|
|
12759
12686
|
disableAutoLogin();
|
|
12760
12687
|
}
|
|
12761
|
-
return logout(
|
|
12688
|
+
return logout(config).then((isLoggedIn) => {
|
|
12762
12689
|
notifyLogout();
|
|
12763
12690
|
return isLoggedIn;
|
|
12764
12691
|
});
|
|
@@ -12771,7 +12698,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12771
12698
|
* @param fn The function being registered
|
|
12772
12699
|
*/
|
|
12773
12700
|
const renderInQueue = (fn) => {
|
|
12774
|
-
const { queueMultiRenders = false } =
|
|
12701
|
+
const { queueMultiRenders = false } = config;
|
|
12775
12702
|
if (queueMultiRenders) {
|
|
12776
12703
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
12777
12704
|
return renderQueue;
|
|
@@ -12803,23 +12730,30 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12803
12730
|
* @group Global methods
|
|
12804
12731
|
*/
|
|
12805
12732
|
const executeTML = async (data) => {
|
|
12733
|
+
const { thoughtSpotHost, authType } = config;
|
|
12806
12734
|
try {
|
|
12807
|
-
sanity(
|
|
12735
|
+
sanity(config);
|
|
12808
12736
|
}
|
|
12809
12737
|
catch (err) {
|
|
12810
12738
|
return Promise.reject(err);
|
|
12811
12739
|
}
|
|
12812
|
-
|
|
12740
|
+
let authToken = '';
|
|
12741
|
+
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
12742
|
+
authToken = await getAuthenticationToken(config);
|
|
12743
|
+
}
|
|
12813
12744
|
const headers = {
|
|
12814
12745
|
'Content-Type': 'application/json',
|
|
12815
12746
|
'x-requested-by': 'ThoughtSpot',
|
|
12816
12747
|
};
|
|
12748
|
+
if (authToken) {
|
|
12749
|
+
headers.Authorization = `Bearer ${authToken}`;
|
|
12750
|
+
}
|
|
12817
12751
|
const payload = {
|
|
12818
12752
|
metadata_tmls: data.metadata_tmls,
|
|
12819
12753
|
import_policy: data.import_policy || 'PARTIAL',
|
|
12820
12754
|
create_new: data.create_new || false,
|
|
12821
12755
|
};
|
|
12822
|
-
return
|
|
12756
|
+
return fetch(`${thoughtSpotHost}${EndPoints.EXECUTE_TML}`, {
|
|
12823
12757
|
method: 'POST',
|
|
12824
12758
|
headers,
|
|
12825
12759
|
body: JSON.stringify(payload),
|
|
@@ -12862,13 +12796,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12862
12796
|
console.error(error);
|
|
12863
12797
|
});
|
|
12864
12798
|
* ```
|
|
12799
|
+
*
|
|
12865
12800
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
12866
12801
|
* @group Global methods
|
|
12867
12802
|
*/
|
|
12868
12803
|
const exportTML = async (data) => {
|
|
12869
|
-
const { thoughtSpotHost, authType } =
|
|
12804
|
+
const { thoughtSpotHost, authType } = config;
|
|
12870
12805
|
try {
|
|
12871
|
-
sanity(
|
|
12806
|
+
sanity(config);
|
|
12872
12807
|
}
|
|
12873
12808
|
catch (err) {
|
|
12874
12809
|
return Promise.reject(err);
|
|
@@ -12879,11 +12814,18 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12879
12814
|
export_fqn: data.export_fqn || false,
|
|
12880
12815
|
edoc_format: data.edoc_format || 'YAML',
|
|
12881
12816
|
};
|
|
12817
|
+
let authToken = '';
|
|
12818
|
+
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
12819
|
+
authToken = await getAuthenticationToken(config);
|
|
12820
|
+
}
|
|
12882
12821
|
const headers = {
|
|
12883
12822
|
'Content-Type': 'application/json',
|
|
12884
12823
|
'x-requested-by': 'ThoughtSpot',
|
|
12885
12824
|
};
|
|
12886
|
-
|
|
12825
|
+
if (authToken) {
|
|
12826
|
+
headers.Authorization = `Bearer ${authToken}`;
|
|
12827
|
+
}
|
|
12828
|
+
return fetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
|
|
12887
12829
|
method: 'POST',
|
|
12888
12830
|
headers,
|
|
12889
12831
|
body: JSON.stringify(payload),
|
|
@@ -12936,9 +12878,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12936
12878
|
* @param containerEl
|
|
12937
12879
|
*/
|
|
12938
12880
|
function processNoCookieAccess(e, containerEl) {
|
|
12939
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess,
|
|
12881
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
|
|
12940
12882
|
if (!ignoreNoCookieAccess) {
|
|
12941
|
-
if (!suppressNoCookieAccessAlert
|
|
12883
|
+
if (!suppressNoCookieAccessAlert) {
|
|
12942
12884
|
// eslint-disable-next-line no-alert
|
|
12943
12885
|
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.');
|
|
12944
12886
|
}
|
|
@@ -13056,7 +12998,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13056
12998
|
});
|
|
13057
12999
|
}
|
|
13058
13000
|
|
|
13059
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.26.1
|
|
13001
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.26.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","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:"43 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};
|
|
13060
13002
|
|
|
13061
13003
|
/**
|
|
13062
13004
|
* Copyright (c) 2022
|
|
@@ -14531,7 +14473,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14531
14473
|
}
|
|
14532
14474
|
getEmbedParams() {
|
|
14533
14475
|
var _a;
|
|
14534
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
|
|
14476
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
|
|
14535
14477
|
const queryParams = this.getBaseQueryParams();
|
|
14536
14478
|
queryParams[Param.HideActions] = [
|
|
14537
14479
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -14600,8 +14542,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14600
14542
|
const src = this.getIFrameSrc(answerId);
|
|
14601
14543
|
this.renderIFrame(src);
|
|
14602
14544
|
getAuthPromise().then(() => {
|
|
14603
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14604
|
-
|| getEmbedConfig().suppressErrorAlerts)) {
|
|
14545
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
14605
14546
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
14606
14547
|
}
|
|
14607
14548
|
});
|