@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.es.js
CHANGED
|
@@ -4998,6 +4998,201 @@ function isEqual(value, other) {
|
|
|
4998
4998
|
|
|
4999
4999
|
var isEqual_1 = isEqual;
|
|
5000
5000
|
|
|
5001
|
+
const EndPoints = {
|
|
5002
|
+
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5003
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5004
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5005
|
+
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
5006
|
+
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
5007
|
+
LOGOUT: '/callosum/v1/session/logout',
|
|
5008
|
+
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
5009
|
+
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
5010
|
+
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
5011
|
+
};
|
|
5012
|
+
/**
|
|
5013
|
+
*
|
|
5014
|
+
* @param url
|
|
5015
|
+
* @param options
|
|
5016
|
+
*/
|
|
5017
|
+
function failureLoggedFetch(url, options = {}) {
|
|
5018
|
+
return fetch(url, options).then(async (r) => {
|
|
5019
|
+
var _a;
|
|
5020
|
+
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
5021
|
+
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
5022
|
+
}
|
|
5023
|
+
return r;
|
|
5024
|
+
});
|
|
5025
|
+
}
|
|
5026
|
+
/**
|
|
5027
|
+
* Service to validate a auth token against a ThoughtSpot host.
|
|
5028
|
+
*
|
|
5029
|
+
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
5030
|
+
* @param authToken : Auth token to verify.
|
|
5031
|
+
*/
|
|
5032
|
+
async function verifyTokenService(thoughtSpotHost, authToken) {
|
|
5033
|
+
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
5034
|
+
try {
|
|
5035
|
+
const res = await fetch(authVerificationUrl, {
|
|
5036
|
+
headers: {
|
|
5037
|
+
Authorization: `Bearer ${authToken}`,
|
|
5038
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5039
|
+
},
|
|
5040
|
+
credentials: 'omit',
|
|
5041
|
+
});
|
|
5042
|
+
return res.ok;
|
|
5043
|
+
}
|
|
5044
|
+
catch (e) {
|
|
5045
|
+
console.error(`Token Verification Service failed : ${e.message}`);
|
|
5046
|
+
}
|
|
5047
|
+
return false;
|
|
5048
|
+
}
|
|
5049
|
+
/**
|
|
5050
|
+
*
|
|
5051
|
+
* @param authEndpoint
|
|
5052
|
+
*/
|
|
5053
|
+
async function fetchAuthTokenService(authEndpoint) {
|
|
5054
|
+
return fetch(authEndpoint);
|
|
5055
|
+
}
|
|
5056
|
+
/**
|
|
5057
|
+
*
|
|
5058
|
+
* @param thoughtSpotHost
|
|
5059
|
+
* @param username
|
|
5060
|
+
* @param authToken
|
|
5061
|
+
*/
|
|
5062
|
+
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
5063
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
5064
|
+
credentials: 'include',
|
|
5065
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5066
|
+
// error
|
|
5067
|
+
redirect: 'manual',
|
|
5068
|
+
});
|
|
5069
|
+
}
|
|
5070
|
+
/**
|
|
5071
|
+
*
|
|
5072
|
+
* @param thoughtSpotHost
|
|
5073
|
+
* @param username
|
|
5074
|
+
* @param authToken
|
|
5075
|
+
*/
|
|
5076
|
+
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
5077
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
5078
|
+
method: 'POST',
|
|
5079
|
+
headers: {
|
|
5080
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5081
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5082
|
+
},
|
|
5083
|
+
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
5084
|
+
credentials: 'include',
|
|
5085
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5086
|
+
// error
|
|
5087
|
+
redirect: 'manual',
|
|
5088
|
+
});
|
|
5089
|
+
}
|
|
5090
|
+
/**
|
|
5091
|
+
*
|
|
5092
|
+
* @param thoughtSpotHost
|
|
5093
|
+
* @param username
|
|
5094
|
+
* @param password
|
|
5095
|
+
*/
|
|
5096
|
+
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
5097
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
5098
|
+
method: 'POST',
|
|
5099
|
+
headers: {
|
|
5100
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5101
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5102
|
+
},
|
|
5103
|
+
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
5104
|
+
credentials: 'include',
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
|
|
5108
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
5109
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
5110
|
+
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
5111
|
+
let cachedAuthToken = null;
|
|
5112
|
+
// This method can be used to get the authToken using the embedConfig
|
|
5113
|
+
const getAuthenticationToken = async (embedConfig) => {
|
|
5114
|
+
if (cachedAuthToken) {
|
|
5115
|
+
let isCachedTokenStillValid;
|
|
5116
|
+
try {
|
|
5117
|
+
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
5118
|
+
}
|
|
5119
|
+
catch {
|
|
5120
|
+
isCachedTokenStillValid = false;
|
|
5121
|
+
}
|
|
5122
|
+
if (isCachedTokenStillValid)
|
|
5123
|
+
return cachedAuthToken;
|
|
5124
|
+
}
|
|
5125
|
+
const { authEndpoint, getAuthToken } = embedConfig;
|
|
5126
|
+
let authToken = null;
|
|
5127
|
+
if (getAuthToken) {
|
|
5128
|
+
authToken = await getAuthToken();
|
|
5129
|
+
}
|
|
5130
|
+
else {
|
|
5131
|
+
const response = await fetchAuthTokenService(authEndpoint);
|
|
5132
|
+
authToken = await response.text();
|
|
5133
|
+
}
|
|
5134
|
+
// this will throw error if the token is not valid
|
|
5135
|
+
await validateAuthToken(embedConfig, authToken);
|
|
5136
|
+
cachedAuthToken = authToken;
|
|
5137
|
+
return authToken;
|
|
5138
|
+
};
|
|
5139
|
+
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
5140
|
+
try {
|
|
5141
|
+
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
5142
|
+
if (isTokenValid)
|
|
5143
|
+
return true;
|
|
5144
|
+
}
|
|
5145
|
+
catch {
|
|
5146
|
+
return false;
|
|
5147
|
+
}
|
|
5148
|
+
if (cachedAuthToken && cachedAuthToken === authToken) {
|
|
5149
|
+
if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
|
|
5150
|
+
// eslint-disable-next-line no-alert
|
|
5151
|
+
alert(DUPLICATE_TOKEN_ERR);
|
|
5152
|
+
}
|
|
5153
|
+
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
5154
|
+
}
|
|
5155
|
+
else {
|
|
5156
|
+
throw new Error(INVALID_TOKEN_ERR);
|
|
5157
|
+
}
|
|
5158
|
+
};
|
|
5159
|
+
const resetCachedAuthToken = () => {
|
|
5160
|
+
cachedAuthToken = null;
|
|
5161
|
+
};
|
|
5162
|
+
|
|
5163
|
+
let config = {};
|
|
5164
|
+
/**
|
|
5165
|
+
* Gets the configuration embed was initialized with.
|
|
5166
|
+
*
|
|
5167
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
5168
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
5169
|
+
* @group Global methods
|
|
5170
|
+
*/
|
|
5171
|
+
const getEmbedConfig = () => config;
|
|
5172
|
+
/**
|
|
5173
|
+
* Sets the configuration embed was initialized with.
|
|
5174
|
+
*
|
|
5175
|
+
* @param newConfig The configuration to set.
|
|
5176
|
+
* @version SDK: 1.27.0 | ThoughtSpot: *
|
|
5177
|
+
* @group Global methods
|
|
5178
|
+
*/
|
|
5179
|
+
const setEmbedConfig = (newConfig) => {
|
|
5180
|
+
config = newConfig;
|
|
5181
|
+
};
|
|
5182
|
+
|
|
5183
|
+
const tokenizedFetch = async (input, init) => {
|
|
5184
|
+
const embedConfig = getEmbedConfig();
|
|
5185
|
+
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
5186
|
+
return fetch(input, init);
|
|
5187
|
+
}
|
|
5188
|
+
const req = new Request(input, init);
|
|
5189
|
+
const authToken = await getAuthenticationToken(embedConfig);
|
|
5190
|
+
if (authToken) {
|
|
5191
|
+
req.headers.append('Authorization', `Bearer ${authToken}`);
|
|
5192
|
+
}
|
|
5193
|
+
return fetch(req);
|
|
5194
|
+
};
|
|
5195
|
+
|
|
5001
5196
|
/**
|
|
5002
5197
|
*
|
|
5003
5198
|
* @param root0
|
|
@@ -5246,7 +5441,7 @@ class AnswerService {
|
|
|
5246
5441
|
*/
|
|
5247
5442
|
async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
|
|
5248
5443
|
const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
|
|
5249
|
-
return
|
|
5444
|
+
return tokenizedFetch(fetchUrl, {
|
|
5250
5445
|
credentials: 'include',
|
|
5251
5446
|
});
|
|
5252
5447
|
}
|
|
@@ -12090,14 +12285,13 @@ function uniq(array) {
|
|
|
12090
12285
|
|
|
12091
12286
|
var uniq_1 = uniq;
|
|
12092
12287
|
|
|
12093
|
-
// eslint-disable-next-line import/no-cycle
|
|
12094
12288
|
/**
|
|
12095
12289
|
*
|
|
12096
12290
|
* @param url
|
|
12097
12291
|
* @param options
|
|
12098
12292
|
*/
|
|
12099
|
-
function
|
|
12100
|
-
return
|
|
12293
|
+
function tokenisedFailureLoggedFetch(url, options = {}) {
|
|
12294
|
+
return tokenizedFetch(url, options).then(async (r) => {
|
|
12101
12295
|
var _a;
|
|
12102
12296
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
12103
12297
|
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
@@ -12110,81 +12304,7 @@ function failureLoggedFetch(url, options = {}) {
|
|
|
12110
12304
|
* @param authVerificationUrl
|
|
12111
12305
|
*/
|
|
12112
12306
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
12113
|
-
return
|
|
12114
|
-
credentials: 'include',
|
|
12115
|
-
});
|
|
12116
|
-
}
|
|
12117
|
-
/**
|
|
12118
|
-
* Service to validate a auth token against a ThoughtSpot host.
|
|
12119
|
-
*
|
|
12120
|
-
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
12121
|
-
* @param authToken : Auth token to verify.
|
|
12122
|
-
*/
|
|
12123
|
-
function verifyTokenService(thoughtSpotHost, authToken) {
|
|
12124
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
12125
|
-
return fetch(authVerificationUrl, {
|
|
12126
|
-
headers: {
|
|
12127
|
-
Authorization: `Bearer ${authToken}`,
|
|
12128
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12129
|
-
},
|
|
12130
|
-
credentials: 'omit',
|
|
12131
|
-
});
|
|
12132
|
-
}
|
|
12133
|
-
/**
|
|
12134
|
-
*
|
|
12135
|
-
* @param authEndpoint
|
|
12136
|
-
*/
|
|
12137
|
-
async function fetchAuthTokenService(authEndpoint) {
|
|
12138
|
-
return fetch(authEndpoint);
|
|
12139
|
-
}
|
|
12140
|
-
/**
|
|
12141
|
-
*
|
|
12142
|
-
* @param thoughtSpotHost
|
|
12143
|
-
* @param username
|
|
12144
|
-
* @param authToken
|
|
12145
|
-
*/
|
|
12146
|
-
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
12147
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
12148
|
-
credentials: 'include',
|
|
12149
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12150
|
-
// error
|
|
12151
|
-
redirect: 'manual',
|
|
12152
|
-
});
|
|
12153
|
-
}
|
|
12154
|
-
/**
|
|
12155
|
-
*
|
|
12156
|
-
* @param thoughtSpotHost
|
|
12157
|
-
* @param username
|
|
12158
|
-
* @param authToken
|
|
12159
|
-
*/
|
|
12160
|
-
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
12161
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
12162
|
-
method: 'POST',
|
|
12163
|
-
headers: {
|
|
12164
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12165
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12166
|
-
},
|
|
12167
|
-
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
12168
|
-
credentials: 'include',
|
|
12169
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12170
|
-
// error
|
|
12171
|
-
redirect: 'manual',
|
|
12172
|
-
});
|
|
12173
|
-
}
|
|
12174
|
-
/**
|
|
12175
|
-
*
|
|
12176
|
-
* @param thoughtSpotHost
|
|
12177
|
-
* @param username
|
|
12178
|
-
* @param password
|
|
12179
|
-
*/
|
|
12180
|
-
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
12181
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
12182
|
-
method: 'POST',
|
|
12183
|
-
headers: {
|
|
12184
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12185
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12186
|
-
},
|
|
12187
|
-
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
12307
|
+
return tokenisedFailureLoggedFetch(authVerificationUrl, {
|
|
12188
12308
|
credentials: 'include',
|
|
12189
12309
|
});
|
|
12190
12310
|
}
|
|
@@ -12193,7 +12313,7 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
|
12193
12313
|
* @param thoughtSpotHost
|
|
12194
12314
|
*/
|
|
12195
12315
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
12196
|
-
return
|
|
12316
|
+
return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
12197
12317
|
credentials: 'include',
|
|
12198
12318
|
method: 'POST',
|
|
12199
12319
|
headers: {
|
|
@@ -12215,17 +12335,6 @@ const sessionInfoPromise = new Promise((resolve) => {
|
|
|
12215
12335
|
});
|
|
12216
12336
|
let releaseVersion = '';
|
|
12217
12337
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
12218
|
-
const EndPoints = {
|
|
12219
|
-
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
12220
|
-
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
12221
|
-
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
12222
|
-
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
12223
|
-
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
12224
|
-
LOGOUT: '/callosum/v1/session/logout',
|
|
12225
|
-
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
12226
|
-
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
12227
|
-
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
12228
|
-
};
|
|
12229
12338
|
/**
|
|
12230
12339
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
12231
12340
|
* of {@link AuthStatus.FAILURE}.
|
|
@@ -12392,21 +12501,6 @@ function getReleaseVersion() {
|
|
|
12392
12501
|
function getSessionInfo() {
|
|
12393
12502
|
return sessionInfoPromise;
|
|
12394
12503
|
}
|
|
12395
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
12396
|
-
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
12397
|
-
let prevAuthToken = null;
|
|
12398
|
-
/**
|
|
12399
|
-
*
|
|
12400
|
-
* @param authtoken
|
|
12401
|
-
*/
|
|
12402
|
-
function alertForDuplicateToken(authtoken) {
|
|
12403
|
-
if (prevAuthToken === authtoken) {
|
|
12404
|
-
// eslint-disable-next-line no-alert
|
|
12405
|
-
alert(DUPLICATE_TOKEN_ERR);
|
|
12406
|
-
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
12407
|
-
}
|
|
12408
|
-
prevAuthToken = authtoken;
|
|
12409
|
-
}
|
|
12410
12504
|
/**
|
|
12411
12505
|
* Check if we are stuck at the SSO redirect URL
|
|
12412
12506
|
*/
|
|
@@ -12424,19 +12518,6 @@ function removeSSORedirectUrlMarker() {
|
|
|
12424
12518
|
// that creates an issue.
|
|
12425
12519
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
12426
12520
|
}
|
|
12427
|
-
const getAuthenticationToken = async (embedConfig) => {
|
|
12428
|
-
const { authEndpoint, getAuthToken } = embedConfig;
|
|
12429
|
-
let authToken = null;
|
|
12430
|
-
if (getAuthToken) {
|
|
12431
|
-
authToken = await getAuthToken();
|
|
12432
|
-
alertForDuplicateToken(authToken);
|
|
12433
|
-
}
|
|
12434
|
-
else {
|
|
12435
|
-
const response = await fetchAuthTokenService(authEndpoint);
|
|
12436
|
-
authToken = await response.text();
|
|
12437
|
-
}
|
|
12438
|
-
return authToken;
|
|
12439
|
-
};
|
|
12440
12521
|
/**
|
|
12441
12522
|
* Perform token based authentication
|
|
12442
12523
|
*
|
|
@@ -12477,16 +12558,17 @@ const doCookielessTokenAuth = async (embedConfig) => {
|
|
|
12477
12558
|
if (!authEndpoint && !getAuthToken) {
|
|
12478
12559
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
12479
12560
|
}
|
|
12561
|
+
let authSuccess = false;
|
|
12480
12562
|
try {
|
|
12481
12563
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12564
|
+
if (authToken) {
|
|
12565
|
+
authSuccess = true;
|
|
12566
|
+
}
|
|
12485
12567
|
}
|
|
12486
|
-
catch
|
|
12487
|
-
|
|
12568
|
+
catch {
|
|
12569
|
+
authSuccess = false;
|
|
12488
12570
|
}
|
|
12489
|
-
return
|
|
12571
|
+
return authSuccess;
|
|
12490
12572
|
};
|
|
12491
12573
|
/**
|
|
12492
12574
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -12604,7 +12686,8 @@ const doOIDCAuth = async (embedConfig) => {
|
|
|
12604
12686
|
};
|
|
12605
12687
|
const logout = async (embedConfig) => {
|
|
12606
12688
|
const { thoughtSpotHost } = embedConfig;
|
|
12607
|
-
|
|
12689
|
+
await fetchLogoutService(thoughtSpotHost);
|
|
12690
|
+
resetCachedAuthToken();
|
|
12608
12691
|
loggedInStatus = false;
|
|
12609
12692
|
return loggedInStatus;
|
|
12610
12693
|
};
|
|
@@ -12636,27 +12719,18 @@ const authenticate = async (embedConfig) => {
|
|
|
12636
12719
|
};
|
|
12637
12720
|
|
|
12638
12721
|
/* eslint-disable camelcase */
|
|
12639
|
-
let config = {};
|
|
12640
12722
|
const CONFIG_DEFAULTS = {
|
|
12641
12723
|
loginFailedMessage: 'Not logged in',
|
|
12642
12724
|
authTriggerText: 'Authorize',
|
|
12643
12725
|
authType: AuthType.None,
|
|
12644
12726
|
};
|
|
12645
12727
|
let authPromise;
|
|
12646
|
-
/**
|
|
12647
|
-
* Gets the configuration embed was initialized with.
|
|
12648
|
-
*
|
|
12649
|
-
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
12650
|
-
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
12651
|
-
* @group Global methods
|
|
12652
|
-
*/
|
|
12653
|
-
const getEmbedConfig = () => config;
|
|
12654
12728
|
const getAuthPromise = () => authPromise;
|
|
12655
12729
|
/**
|
|
12656
12730
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
12657
12731
|
*/
|
|
12658
12732
|
const handleAuth = () => {
|
|
12659
|
-
authPromise = authenticate(
|
|
12733
|
+
authPromise = authenticate(getEmbedConfig());
|
|
12660
12734
|
authPromise.then((isLoggedIn) => {
|
|
12661
12735
|
if (!isLoggedIn) {
|
|
12662
12736
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -12692,7 +12766,7 @@ const prefetch = (url, prefetchFeatures) => {
|
|
|
12692
12766
|
}
|
|
12693
12767
|
else {
|
|
12694
12768
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
12695
|
-
let hostUrl = url ||
|
|
12769
|
+
let hostUrl = url || getEmbedConfig().thoughtSpotHost;
|
|
12696
12770
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
12697
12771
|
uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
12698
12772
|
const iFrame = document.createElement('iframe');
|
|
@@ -12758,16 +12832,15 @@ function backwardCompat(embedConfig) {
|
|
|
12758
12832
|
const init = (embedConfig) => {
|
|
12759
12833
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
12760
12834
|
sanity(embedConfig);
|
|
12761
|
-
|
|
12835
|
+
setEmbedConfig(backwardCompat({
|
|
12762
12836
|
...CONFIG_DEFAULTS,
|
|
12763
12837
|
...embedConfig,
|
|
12764
12838
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
12765
|
-
};
|
|
12766
|
-
config = backwardCompat(config);
|
|
12839
|
+
}));
|
|
12767
12840
|
const authEE = new eventemitter3();
|
|
12768
12841
|
setAuthEE(authEE);
|
|
12769
12842
|
handleAuth();
|
|
12770
|
-
const { password, ...configToTrack } =
|
|
12843
|
+
const { password, ...configToTrack } = getEmbedConfig();
|
|
12771
12844
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
12772
12845
|
...configToTrack,
|
|
12773
12846
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
@@ -12776,8 +12849,8 @@ const init = (embedConfig) => {
|
|
|
12776
12849
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
12777
12850
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
12778
12851
|
});
|
|
12779
|
-
if (
|
|
12780
|
-
prefetch(
|
|
12852
|
+
if (getEmbedConfig().callPrefetch) {
|
|
12853
|
+
prefetch(getEmbedConfig().thoughtSpotHost);
|
|
12781
12854
|
}
|
|
12782
12855
|
return authEE;
|
|
12783
12856
|
};
|
|
@@ -12785,7 +12858,7 @@ const init = (embedConfig) => {
|
|
|
12785
12858
|
*
|
|
12786
12859
|
*/
|
|
12787
12860
|
function disableAutoLogin() {
|
|
12788
|
-
|
|
12861
|
+
getEmbedConfig().autoLogin = false;
|
|
12789
12862
|
}
|
|
12790
12863
|
/**
|
|
12791
12864
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -12803,7 +12876,7 @@ const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
|
12803
12876
|
if (!doNotDisableAutoLogin) {
|
|
12804
12877
|
disableAutoLogin();
|
|
12805
12878
|
}
|
|
12806
|
-
return logout(
|
|
12879
|
+
return logout(getEmbedConfig()).then((isLoggedIn) => {
|
|
12807
12880
|
notifyLogout();
|
|
12808
12881
|
return isLoggedIn;
|
|
12809
12882
|
});
|
|
@@ -12816,7 +12889,7 @@ let renderQueue = Promise.resolve();
|
|
|
12816
12889
|
* @param fn The function being registered
|
|
12817
12890
|
*/
|
|
12818
12891
|
const renderInQueue = (fn) => {
|
|
12819
|
-
const { queueMultiRenders = false } =
|
|
12892
|
+
const { queueMultiRenders = false } = getEmbedConfig();
|
|
12820
12893
|
if (queueMultiRenders) {
|
|
12821
12894
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
12822
12895
|
return renderQueue;
|
|
@@ -12848,30 +12921,23 @@ const renderInQueue = (fn) => {
|
|
|
12848
12921
|
* @group Global methods
|
|
12849
12922
|
*/
|
|
12850
12923
|
const executeTML = async (data) => {
|
|
12851
|
-
const { thoughtSpotHost, authType } = config;
|
|
12852
12924
|
try {
|
|
12853
|
-
sanity(
|
|
12925
|
+
sanity(getEmbedConfig());
|
|
12854
12926
|
}
|
|
12855
12927
|
catch (err) {
|
|
12856
12928
|
return Promise.reject(err);
|
|
12857
12929
|
}
|
|
12858
|
-
|
|
12859
|
-
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
12860
|
-
authToken = await getAuthenticationToken(config);
|
|
12861
|
-
}
|
|
12930
|
+
const { thoughtSpotHost, authType } = getEmbedConfig();
|
|
12862
12931
|
const headers = {
|
|
12863
12932
|
'Content-Type': 'application/json',
|
|
12864
12933
|
'x-requested-by': 'ThoughtSpot',
|
|
12865
12934
|
};
|
|
12866
|
-
if (authToken) {
|
|
12867
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
12868
|
-
}
|
|
12869
12935
|
const payload = {
|
|
12870
12936
|
metadata_tmls: data.metadata_tmls,
|
|
12871
12937
|
import_policy: data.import_policy || 'PARTIAL',
|
|
12872
12938
|
create_new: data.create_new || false,
|
|
12873
12939
|
};
|
|
12874
|
-
return
|
|
12940
|
+
return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXECUTE_TML}`, {
|
|
12875
12941
|
method: 'POST',
|
|
12876
12942
|
headers,
|
|
12877
12943
|
body: JSON.stringify(payload),
|
|
@@ -12914,14 +12980,13 @@ const executeTML = async (data) => {
|
|
|
12914
12980
|
console.error(error);
|
|
12915
12981
|
});
|
|
12916
12982
|
* ```
|
|
12917
|
-
*
|
|
12918
12983
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
12919
12984
|
* @group Global methods
|
|
12920
12985
|
*/
|
|
12921
12986
|
const exportTML = async (data) => {
|
|
12922
|
-
const { thoughtSpotHost, authType } =
|
|
12987
|
+
const { thoughtSpotHost, authType } = getEmbedConfig();
|
|
12923
12988
|
try {
|
|
12924
|
-
sanity(
|
|
12989
|
+
sanity(getEmbedConfig());
|
|
12925
12990
|
}
|
|
12926
12991
|
catch (err) {
|
|
12927
12992
|
return Promise.reject(err);
|
|
@@ -12932,18 +12997,11 @@ const exportTML = async (data) => {
|
|
|
12932
12997
|
export_fqn: data.export_fqn || false,
|
|
12933
12998
|
edoc_format: data.edoc_format || 'YAML',
|
|
12934
12999
|
};
|
|
12935
|
-
let authToken = '';
|
|
12936
|
-
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
12937
|
-
authToken = await getAuthenticationToken(config);
|
|
12938
|
-
}
|
|
12939
13000
|
const headers = {
|
|
12940
13001
|
'Content-Type': 'application/json',
|
|
12941
13002
|
'x-requested-by': 'ThoughtSpot',
|
|
12942
13003
|
};
|
|
12943
|
-
|
|
12944
|
-
headers.Authorization = `Bearer ${authToken}`;
|
|
12945
|
-
}
|
|
12946
|
-
return fetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
|
|
13004
|
+
return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
|
|
12947
13005
|
method: 'POST',
|
|
12948
13006
|
headers,
|
|
12949
13007
|
body: JSON.stringify(payload),
|
|
@@ -12996,9 +13054,9 @@ function processAuthInit(e) {
|
|
|
12996
13054
|
* @param containerEl
|
|
12997
13055
|
*/
|
|
12998
13056
|
function processNoCookieAccess(e, containerEl) {
|
|
12999
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
|
|
13057
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
|
|
13000
13058
|
if (!ignoreNoCookieAccess) {
|
|
13001
|
-
if (!suppressNoCookieAccessAlert) {
|
|
13059
|
+
if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
|
|
13002
13060
|
// eslint-disable-next-line no-alert
|
|
13003
13061
|
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.');
|
|
13004
13062
|
}
|
|
@@ -13116,7 +13174,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
13116
13174
|
});
|
|
13117
13175
|
}
|
|
13118
13176
|
|
|
13119
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.26.
|
|
13177
|
+
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={".":{"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,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};
|
|
13120
13178
|
|
|
13121
13179
|
/**
|
|
13122
13180
|
* Copyright (c) 2022
|
|
@@ -14665,7 +14723,8 @@ class SearchEmbed extends TsEmbed {
|
|
|
14665
14723
|
const src = this.getIFrameSrc(answerId);
|
|
14666
14724
|
this.renderIFrame(src);
|
|
14667
14725
|
getAuthPromise().then(() => {
|
|
14668
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14726
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14727
|
+
|| getEmbedConfig().suppressErrorAlerts)) {
|
|
14669
14728
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
14670
14729
|
}
|
|
14671
14730
|
});
|