@thoughtspot/visual-embed-sdk 1.26.1 → 1.26.3
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/app.d.ts +0 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- 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/liveboard.d.ts +0 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +0 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -1
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search.d.ts +0 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +5 -4
- 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 +0 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +6 -6
- 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 +12 -0
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/{authService.d.ts → authService/authService.d.ts} +12 -11
- package/cjs/src/utils/authService/authService.d.ts.map +1 -0
- package/cjs/src/utils/{authService.js → authService/authService.js} +31 -39
- package/cjs/src/utils/authService/authService.js.map +1 -0
- package/cjs/src/utils/authService/authService.spec.d.ts.map +1 -0
- package/cjs/src/utils/{authService.spec.js → authService/authService.spec.js} +11 -12
- 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/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/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/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/app.d.ts +0 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- 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/liveboard.d.ts +0 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +0 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +0 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +0 -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 +12 -0
- package/dist/src/types.d.ts.map +1 -1
- package/{lib/src/utils → dist/src/utils/authService}/authService.d.ts +44 -43
- package/dist/src/utils/authService/authService.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/tokenizedAuthService.d.ts +11 -0
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
- 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 +207 -149
- package/dist/tsembed-react.js +207 -149
- package/dist/tsembed.es.js +236 -180
- package/dist/tsembed.js +236 -180
- package/dist/visual-embed-sdk-react-full.d.ts +29 -26
- package/dist/visual-embed-sdk-react.d.ts +29 -26
- package/dist/visual-embed-sdk.d.ts +29 -26
- 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/app.d.ts +0 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- 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/liveboard.d.ts +0 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/sage.d.ts +0 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -1
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search.d.ts +0 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +6 -5
- 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 +0 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +5 -5
- 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 +12 -0
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js.map +1 -1
- package/{dist/src/utils → lib/src/utils/authService}/authService.d.ts +44 -43
- package/lib/src/utils/authService/authService.d.ts.map +1 -0
- package/lib/src/utils/{authService.js → authService/authService.js} +26 -32
- package/lib/src/utils/authService/authService.js.map +1 -0
- package/lib/src/utils/authService/authService.spec.d.ts.map +1 -0
- package/lib/src/utils/{authService.spec.js → authService/authService.spec.js} +1 -2
- 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/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/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/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 +34 -27
- 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/app.ts +1 -2
- 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/liveboard.ts +1 -2
- package/src/embed/sage.ts +1 -2
- package/src/embed/search.ts +12 -14
- 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 +7 -19
- package/src/index.ts +8 -2
- package/src/tokenizedFetch.ts +18 -0
- package/src/types.ts +36 -19
- 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/cjs/src/utils/authService.d.ts.map +0 -1
- package/cjs/src/utils/authService.js.map +0 -1
- package/cjs/src/utils/authService.spec.d.ts.map +0 -1
- package/cjs/src/utils/authService.spec.js.map +0 -1
- package/dist/src/utils/authService.d.ts.map +0 -1
- package/lib/src/utils/authService.d.ts.map +0 -1
- package/lib/src/utils/authService.js.map +0 -1
- package/lib/src/utils/authService.spec.d.ts.map +0 -1
- package/lib/src/utils/authService.spec.js.map +0 -1
- /package/cjs/src/utils/{authService.spec.d.ts → authService/authService.spec.d.ts} +0 -0
- /package/dist/src/utils/{authService.spec.d.ts → authService/authService.spec.d.ts} +0 -0
- /package/dist/src/utils/{authService.spec.d.ts.map → authService/authService.spec.d.ts.map} +0 -0
- /package/lib/src/utils/{authService.spec.d.ts → authService/authService.spec.d.ts} +0 -0
package/dist/tsembed-react.js
CHANGED
|
@@ -5034,6 +5034,188 @@
|
|
|
5034
5034
|
|
|
5035
5035
|
var isEqual_1 = isEqual;
|
|
5036
5036
|
|
|
5037
|
+
const EndPoints = {
|
|
5038
|
+
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5039
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5040
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5041
|
+
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
5042
|
+
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
5043
|
+
LOGOUT: '/callosum/v1/session/logout',
|
|
5044
|
+
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
5045
|
+
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
5046
|
+
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
5047
|
+
};
|
|
5048
|
+
/**
|
|
5049
|
+
*
|
|
5050
|
+
* @param url
|
|
5051
|
+
* @param options
|
|
5052
|
+
*/
|
|
5053
|
+
function failureLoggedFetch(url, options = {}) {
|
|
5054
|
+
return fetch(url, options).then(async (r) => {
|
|
5055
|
+
var _a;
|
|
5056
|
+
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
5057
|
+
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
5058
|
+
}
|
|
5059
|
+
return r;
|
|
5060
|
+
});
|
|
5061
|
+
}
|
|
5062
|
+
/**
|
|
5063
|
+
* Service to validate a auth token against a ThoughtSpot host.
|
|
5064
|
+
*
|
|
5065
|
+
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
5066
|
+
* @param authToken : Auth token to verify.
|
|
5067
|
+
*/
|
|
5068
|
+
async function verifyTokenService(thoughtSpotHost, authToken) {
|
|
5069
|
+
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
5070
|
+
try {
|
|
5071
|
+
const res = await fetch(authVerificationUrl, {
|
|
5072
|
+
headers: {
|
|
5073
|
+
Authorization: `Bearer ${authToken}`,
|
|
5074
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5075
|
+
},
|
|
5076
|
+
credentials: 'omit',
|
|
5077
|
+
});
|
|
5078
|
+
return res.ok;
|
|
5079
|
+
}
|
|
5080
|
+
catch (e) {
|
|
5081
|
+
console.error(`Token Verification Service failed : ${e.message}`);
|
|
5082
|
+
}
|
|
5083
|
+
return false;
|
|
5084
|
+
}
|
|
5085
|
+
/**
|
|
5086
|
+
*
|
|
5087
|
+
* @param authEndpoint
|
|
5088
|
+
*/
|
|
5089
|
+
async function fetchAuthTokenService(authEndpoint) {
|
|
5090
|
+
return fetch(authEndpoint);
|
|
5091
|
+
}
|
|
5092
|
+
/**
|
|
5093
|
+
*
|
|
5094
|
+
* @param thoughtSpotHost
|
|
5095
|
+
* @param username
|
|
5096
|
+
* @param authToken
|
|
5097
|
+
*/
|
|
5098
|
+
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
5099
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
5100
|
+
credentials: 'include',
|
|
5101
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5102
|
+
// error
|
|
5103
|
+
redirect: 'manual',
|
|
5104
|
+
});
|
|
5105
|
+
}
|
|
5106
|
+
/**
|
|
5107
|
+
*
|
|
5108
|
+
* @param thoughtSpotHost
|
|
5109
|
+
* @param username
|
|
5110
|
+
* @param authToken
|
|
5111
|
+
*/
|
|
5112
|
+
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
5113
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
5114
|
+
method: 'POST',
|
|
5115
|
+
headers: {
|
|
5116
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5117
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5118
|
+
},
|
|
5119
|
+
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
5120
|
+
credentials: 'include',
|
|
5121
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5122
|
+
// error
|
|
5123
|
+
redirect: 'manual',
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5126
|
+
/**
|
|
5127
|
+
*
|
|
5128
|
+
* @param thoughtSpotHost
|
|
5129
|
+
* @param username
|
|
5130
|
+
* @param password
|
|
5131
|
+
*/
|
|
5132
|
+
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
5133
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
5134
|
+
method: 'POST',
|
|
5135
|
+
headers: {
|
|
5136
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5137
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5138
|
+
},
|
|
5139
|
+
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
5140
|
+
credentials: 'include',
|
|
5141
|
+
});
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5144
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
5145
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
5146
|
+
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
5147
|
+
let cachedAuthToken = null;
|
|
5148
|
+
// This method can be used to get the authToken using the embedConfig
|
|
5149
|
+
const getAuthenticationToken = async (embedConfig) => {
|
|
5150
|
+
if (cachedAuthToken) {
|
|
5151
|
+
let isCachedTokenStillValid;
|
|
5152
|
+
try {
|
|
5153
|
+
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
5154
|
+
}
|
|
5155
|
+
catch {
|
|
5156
|
+
isCachedTokenStillValid = false;
|
|
5157
|
+
}
|
|
5158
|
+
if (isCachedTokenStillValid)
|
|
5159
|
+
return cachedAuthToken;
|
|
5160
|
+
}
|
|
5161
|
+
const { authEndpoint, getAuthToken } = embedConfig;
|
|
5162
|
+
let authToken = null;
|
|
5163
|
+
if (getAuthToken) {
|
|
5164
|
+
authToken = await getAuthToken();
|
|
5165
|
+
}
|
|
5166
|
+
else {
|
|
5167
|
+
const response = await fetchAuthTokenService(authEndpoint);
|
|
5168
|
+
authToken = await response.text();
|
|
5169
|
+
}
|
|
5170
|
+
// this will throw error if the token is not valid
|
|
5171
|
+
await validateAuthToken(embedConfig, authToken);
|
|
5172
|
+
cachedAuthToken = authToken;
|
|
5173
|
+
return authToken;
|
|
5174
|
+
};
|
|
5175
|
+
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
5176
|
+
try {
|
|
5177
|
+
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
5178
|
+
if (isTokenValid)
|
|
5179
|
+
return true;
|
|
5180
|
+
}
|
|
5181
|
+
catch {
|
|
5182
|
+
return false;
|
|
5183
|
+
}
|
|
5184
|
+
if (cachedAuthToken && cachedAuthToken === authToken) {
|
|
5185
|
+
if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
|
|
5186
|
+
// eslint-disable-next-line no-alert
|
|
5187
|
+
alert(DUPLICATE_TOKEN_ERR);
|
|
5188
|
+
}
|
|
5189
|
+
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
5190
|
+
}
|
|
5191
|
+
else {
|
|
5192
|
+
throw new Error(INVALID_TOKEN_ERR);
|
|
5193
|
+
}
|
|
5194
|
+
};
|
|
5195
|
+
|
|
5196
|
+
let config = {};
|
|
5197
|
+
/**
|
|
5198
|
+
* Gets the configuration embed was initialized with.
|
|
5199
|
+
*
|
|
5200
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
5201
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
5202
|
+
* @group Global methods
|
|
5203
|
+
*/
|
|
5204
|
+
const getEmbedConfig = () => config;
|
|
5205
|
+
|
|
5206
|
+
const tokenizedFetch = async (input, init) => {
|
|
5207
|
+
const embedConfig = getEmbedConfig();
|
|
5208
|
+
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
5209
|
+
return fetch(input, init);
|
|
5210
|
+
}
|
|
5211
|
+
const req = new Request(input, init);
|
|
5212
|
+
const authToken = await getAuthenticationToken(embedConfig);
|
|
5213
|
+
if (authToken) {
|
|
5214
|
+
req.headers.append('Authorization', `Bearer ${authToken}`);
|
|
5215
|
+
}
|
|
5216
|
+
return fetch(req);
|
|
5217
|
+
};
|
|
5218
|
+
|
|
5037
5219
|
/**
|
|
5038
5220
|
*
|
|
5039
5221
|
* @param root0
|
|
@@ -5282,7 +5464,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
5282
5464
|
*/
|
|
5283
5465
|
async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
|
|
5284
5466
|
const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
|
|
5285
|
-
return
|
|
5467
|
+
return tokenizedFetch(fetchUrl, {
|
|
5286
5468
|
credentials: 'include',
|
|
5287
5469
|
});
|
|
5288
5470
|
}
|
|
@@ -11916,14 +12098,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
11916
12098
|
return new _Set(values);
|
|
11917
12099
|
};
|
|
11918
12100
|
|
|
11919
|
-
// eslint-disable-next-line import/no-cycle
|
|
11920
12101
|
/**
|
|
11921
12102
|
*
|
|
11922
12103
|
* @param url
|
|
11923
12104
|
* @param options
|
|
11924
12105
|
*/
|
|
11925
|
-
function
|
|
11926
|
-
return
|
|
12106
|
+
function tokenisedFailureLoggedFetch(url, options = {}) {
|
|
12107
|
+
return tokenizedFetch(url, options).then(async (r) => {
|
|
11927
12108
|
var _a;
|
|
11928
12109
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
11929
12110
|
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
@@ -11936,81 +12117,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
11936
12117
|
* @param authVerificationUrl
|
|
11937
12118
|
*/
|
|
11938
12119
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
11939
|
-
return
|
|
11940
|
-
credentials: 'include',
|
|
11941
|
-
});
|
|
11942
|
-
}
|
|
11943
|
-
/**
|
|
11944
|
-
* Service to validate a auth token against a ThoughtSpot host.
|
|
11945
|
-
*
|
|
11946
|
-
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
11947
|
-
* @param authToken : Auth token to verify.
|
|
11948
|
-
*/
|
|
11949
|
-
function verifyTokenService(thoughtSpotHost, authToken) {
|
|
11950
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
11951
|
-
return fetch(authVerificationUrl, {
|
|
11952
|
-
headers: {
|
|
11953
|
-
Authorization: `Bearer ${authToken}`,
|
|
11954
|
-
'x-requested-by': 'ThoughtSpot',
|
|
11955
|
-
},
|
|
11956
|
-
credentials: 'omit',
|
|
11957
|
-
});
|
|
11958
|
-
}
|
|
11959
|
-
/**
|
|
11960
|
-
*
|
|
11961
|
-
* @param authEndpoint
|
|
11962
|
-
*/
|
|
11963
|
-
async function fetchAuthTokenService(authEndpoint) {
|
|
11964
|
-
return fetch(authEndpoint);
|
|
11965
|
-
}
|
|
11966
|
-
/**
|
|
11967
|
-
*
|
|
11968
|
-
* @param thoughtSpotHost
|
|
11969
|
-
* @param username
|
|
11970
|
-
* @param authToken
|
|
11971
|
-
*/
|
|
11972
|
-
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
11973
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
11974
|
-
credentials: 'include',
|
|
11975
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
11976
|
-
// error
|
|
11977
|
-
redirect: 'manual',
|
|
11978
|
-
});
|
|
11979
|
-
}
|
|
11980
|
-
/**
|
|
11981
|
-
*
|
|
11982
|
-
* @param thoughtSpotHost
|
|
11983
|
-
* @param username
|
|
11984
|
-
* @param authToken
|
|
11985
|
-
*/
|
|
11986
|
-
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
11987
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
11988
|
-
method: 'POST',
|
|
11989
|
-
headers: {
|
|
11990
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
11991
|
-
'x-requested-by': 'ThoughtSpot',
|
|
11992
|
-
},
|
|
11993
|
-
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
11994
|
-
credentials: 'include',
|
|
11995
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
11996
|
-
// error
|
|
11997
|
-
redirect: 'manual',
|
|
11998
|
-
});
|
|
11999
|
-
}
|
|
12000
|
-
/**
|
|
12001
|
-
*
|
|
12002
|
-
* @param thoughtSpotHost
|
|
12003
|
-
* @param username
|
|
12004
|
-
* @param password
|
|
12005
|
-
*/
|
|
12006
|
-
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
12007
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
12008
|
-
method: 'POST',
|
|
12009
|
-
headers: {
|
|
12010
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12011
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12012
|
-
},
|
|
12013
|
-
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
12120
|
+
return tokenisedFailureLoggedFetch(authVerificationUrl, {
|
|
12014
12121
|
credentials: 'include',
|
|
12015
12122
|
});
|
|
12016
12123
|
}
|
|
@@ -12028,17 +12135,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12028
12135
|
});
|
|
12029
12136
|
let releaseVersion = '';
|
|
12030
12137
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
12031
|
-
const EndPoints = {
|
|
12032
|
-
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
12033
|
-
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
12034
|
-
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
12035
|
-
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
12036
|
-
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
12037
|
-
LOGOUT: '/callosum/v1/session/logout',
|
|
12038
|
-
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
12039
|
-
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
12040
|
-
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
12041
|
-
};
|
|
12042
12138
|
/**
|
|
12043
12139
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
12044
12140
|
* of {@link AuthStatus.FAILURE}.
|
|
@@ -12184,21 +12280,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12184
12280
|
function getReleaseVersion() {
|
|
12185
12281
|
return releaseVersion;
|
|
12186
12282
|
}
|
|
12187
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
12188
|
-
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
12189
|
-
let prevAuthToken = null;
|
|
12190
|
-
/**
|
|
12191
|
-
*
|
|
12192
|
-
* @param authtoken
|
|
12193
|
-
*/
|
|
12194
|
-
function alertForDuplicateToken(authtoken) {
|
|
12195
|
-
if (prevAuthToken === authtoken) {
|
|
12196
|
-
// eslint-disable-next-line no-alert
|
|
12197
|
-
alert(DUPLICATE_TOKEN_ERR);
|
|
12198
|
-
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
12199
|
-
}
|
|
12200
|
-
prevAuthToken = authtoken;
|
|
12201
|
-
}
|
|
12202
12283
|
/**
|
|
12203
12284
|
* Check if we are stuck at the SSO redirect URL
|
|
12204
12285
|
*/
|
|
@@ -12216,19 +12297,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12216
12297
|
// that creates an issue.
|
|
12217
12298
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
12218
12299
|
}
|
|
12219
|
-
const getAuthenticationToken = async (embedConfig) => {
|
|
12220
|
-
const { authEndpoint, getAuthToken } = embedConfig;
|
|
12221
|
-
let authToken = null;
|
|
12222
|
-
if (getAuthToken) {
|
|
12223
|
-
authToken = await getAuthToken();
|
|
12224
|
-
alertForDuplicateToken(authToken);
|
|
12225
|
-
}
|
|
12226
|
-
else {
|
|
12227
|
-
const response = await fetchAuthTokenService(authEndpoint);
|
|
12228
|
-
authToken = await response.text();
|
|
12229
|
-
}
|
|
12230
|
-
return authToken;
|
|
12231
|
-
};
|
|
12232
12300
|
/**
|
|
12233
12301
|
* Perform token based authentication
|
|
12234
12302
|
*
|
|
@@ -12269,16 +12337,17 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12269
12337
|
if (!authEndpoint && !getAuthToken) {
|
|
12270
12338
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
12271
12339
|
}
|
|
12340
|
+
let authSuccess = false;
|
|
12272
12341
|
try {
|
|
12273
12342
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12343
|
+
if (authToken) {
|
|
12344
|
+
authSuccess = true;
|
|
12345
|
+
}
|
|
12277
12346
|
}
|
|
12278
|
-
catch
|
|
12279
|
-
|
|
12347
|
+
catch {
|
|
12348
|
+
authSuccess = false;
|
|
12280
12349
|
}
|
|
12281
|
-
return
|
|
12350
|
+
return authSuccess;
|
|
12282
12351
|
};
|
|
12283
12352
|
/**
|
|
12284
12353
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -12420,27 +12489,18 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12420
12489
|
};
|
|
12421
12490
|
|
|
12422
12491
|
/* eslint-disable camelcase */
|
|
12423
|
-
let config = {};
|
|
12424
12492
|
const CONFIG_DEFAULTS = {
|
|
12425
12493
|
loginFailedMessage: 'Not logged in',
|
|
12426
12494
|
authTriggerText: 'Authorize',
|
|
12427
12495
|
authType: AuthType.None,
|
|
12428
12496
|
};
|
|
12429
12497
|
let authPromise;
|
|
12430
|
-
/**
|
|
12431
|
-
* Gets the configuration embed was initialized with.
|
|
12432
|
-
*
|
|
12433
|
-
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
12434
|
-
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
12435
|
-
* @group Global methods
|
|
12436
|
-
*/
|
|
12437
|
-
const getEmbedConfig = () => config;
|
|
12438
12498
|
const getAuthPromise = () => authPromise;
|
|
12439
12499
|
/**
|
|
12440
12500
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
12441
12501
|
*/
|
|
12442
12502
|
const handleAuth = () => {
|
|
12443
|
-
authPromise = authenticate(
|
|
12503
|
+
authPromise = authenticate(getEmbedConfig());
|
|
12444
12504
|
authPromise.then((isLoggedIn) => {
|
|
12445
12505
|
if (!isLoggedIn) {
|
|
12446
12506
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -12463,7 +12523,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12463
12523
|
*
|
|
12464
12524
|
*/
|
|
12465
12525
|
function disableAutoLogin() {
|
|
12466
|
-
|
|
12526
|
+
getEmbedConfig().autoLogin = false;
|
|
12467
12527
|
}
|
|
12468
12528
|
let renderQueue = Promise.resolve();
|
|
12469
12529
|
/**
|
|
@@ -12473,7 +12533,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12473
12533
|
* @param fn The function being registered
|
|
12474
12534
|
*/
|
|
12475
12535
|
const renderInQueue = (fn) => {
|
|
12476
|
-
const { queueMultiRenders = false } =
|
|
12536
|
+
const { queueMultiRenders = false } = getEmbedConfig();
|
|
12477
12537
|
if (queueMultiRenders) {
|
|
12478
12538
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
12479
12539
|
return renderQueue;
|
|
@@ -12518,9 +12578,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12518
12578
|
* @param containerEl
|
|
12519
12579
|
*/
|
|
12520
12580
|
function processNoCookieAccess(e, containerEl) {
|
|
12521
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
|
|
12581
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
|
|
12522
12582
|
if (!ignoreNoCookieAccess) {
|
|
12523
|
-
if (!suppressNoCookieAccessAlert) {
|
|
12583
|
+
if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
|
|
12524
12584
|
// eslint-disable-next-line no-alert
|
|
12525
12585
|
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.');
|
|
12526
12586
|
}
|
|
@@ -12638,7 +12698,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12638
12698
|
});
|
|
12639
12699
|
}
|
|
12640
12700
|
|
|
12641
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.26.
|
|
12701
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.26.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"44 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
12642
12702
|
|
|
12643
12703
|
/**
|
|
12644
12704
|
* Copyright (c) 2022
|
|
@@ -12674,7 +12734,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12674
12734
|
*/
|
|
12675
12735
|
this.embedNodeKey = '__tsEmbed';
|
|
12676
12736
|
this.isAppInitialized = false;
|
|
12677
|
-
this.embedComponentType = 'TsEmbed';
|
|
12678
12737
|
/**
|
|
12679
12738
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
12680
12739
|
* will generate for embedding. This provides additional security to
|
|
@@ -12754,7 +12813,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12754
12813
|
allOtherKeys.forEach((key) => {
|
|
12755
12814
|
if (!isUndefined(viewConfig[key])
|
|
12756
12815
|
&& !isEqual_1(viewConfig[key], preRenderedObject.viewConfig[key])) {
|
|
12757
|
-
console.warn(
|
|
12816
|
+
console.warn('TS Embed component was pre-rendered with '
|
|
12758
12817
|
+ `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
|
|
12759
12818
|
+ `but a different value "${JSON.stringify(viewConfig[key])}" `
|
|
12760
12819
|
+ 'was passed to the Embed component. '
|
|
@@ -12779,7 +12838,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12779
12838
|
this.registerAppInit();
|
|
12780
12839
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
12781
12840
|
...viewConfig,
|
|
12782
|
-
embedComponentType: this.embedComponentType,
|
|
12783
12841
|
});
|
|
12784
12842
|
}
|
|
12785
12843
|
/**
|
|
@@ -13738,8 +13796,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13738
13796
|
class SageEmbed extends V1Embed {
|
|
13739
13797
|
// eslint-disable-next-line no-useless-constructor
|
|
13740
13798
|
constructor(domSelector, viewConfig) {
|
|
13799
|
+
viewConfig.embedComponentType = 'SageEmbed';
|
|
13741
13800
|
super(domSelector, viewConfig);
|
|
13742
|
-
this.embedComponentType = 'SageEmbed';
|
|
13743
13801
|
}
|
|
13744
13802
|
/**
|
|
13745
13803
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -13829,9 +13887,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13829
13887
|
*/
|
|
13830
13888
|
class SearchEmbed extends TsEmbed {
|
|
13831
13889
|
constructor(domSelector, viewConfig) {
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
this.viewConfig = viewConfig;
|
|
13890
|
+
viewConfig.embedComponentType = 'SearchEmbed';
|
|
13891
|
+
super(domSelector, viewConfig);
|
|
13835
13892
|
}
|
|
13836
13893
|
/**
|
|
13837
13894
|
* Get the state of the data sources panel that the embedded
|
|
@@ -13918,7 +13975,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13918
13975
|
const src = this.getIFrameSrc(answerId);
|
|
13919
13976
|
this.renderIFrame(src);
|
|
13920
13977
|
getAuthPromise().then(() => {
|
|
13921
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
13978
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
13979
|
+
|| getEmbedConfig().suppressErrorAlerts)) {
|
|
13922
13980
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
13923
13981
|
}
|
|
13924
13982
|
});
|
|
@@ -13974,9 +14032,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13974
14032
|
class AppEmbed extends V1Embed {
|
|
13975
14033
|
// eslint-disable-next-line no-useless-constructor
|
|
13976
14034
|
constructor(domSelector, viewConfig) {
|
|
14035
|
+
viewConfig.embedComponentType = 'AppEmbed';
|
|
13977
14036
|
super(domSelector, viewConfig);
|
|
13978
14037
|
this.defaultHeight = '100%';
|
|
13979
|
-
this.embedComponentType = 'AppEmbed';
|
|
13980
14038
|
/**
|
|
13981
14039
|
* Set the iframe height as per the computed height received
|
|
13982
14040
|
* from the ThoughtSpot app.
|
|
@@ -14168,9 +14226,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14168
14226
|
class LiveboardEmbed extends V1Embed {
|
|
14169
14227
|
// eslint-disable-next-line no-useless-constructor
|
|
14170
14228
|
constructor(domSelector, viewConfig) {
|
|
14229
|
+
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
14171
14230
|
super(domSelector, viewConfig);
|
|
14172
14231
|
this.defaultHeight = 500;
|
|
14173
|
-
this.embedComponentType = 'LiveboardEmbed';
|
|
14174
14232
|
/**
|
|
14175
14233
|
* Set the iframe height as per the computed height received
|
|
14176
14234
|
* from the ThoughtSpot app.
|