@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.es.js
CHANGED
|
@@ -5112,6 +5112,188 @@ function isEqual(value, other) {
|
|
|
5112
5112
|
|
|
5113
5113
|
var isEqual_1 = isEqual;
|
|
5114
5114
|
|
|
5115
|
+
const EndPoints = {
|
|
5116
|
+
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5117
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5118
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5119
|
+
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
5120
|
+
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
5121
|
+
LOGOUT: '/callosum/v1/session/logout',
|
|
5122
|
+
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
5123
|
+
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
5124
|
+
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
5125
|
+
};
|
|
5126
|
+
/**
|
|
5127
|
+
*
|
|
5128
|
+
* @param url
|
|
5129
|
+
* @param options
|
|
5130
|
+
*/
|
|
5131
|
+
function failureLoggedFetch(url, options = {}) {
|
|
5132
|
+
return fetch(url, options).then(async (r) => {
|
|
5133
|
+
var _a;
|
|
5134
|
+
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
5135
|
+
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
5136
|
+
}
|
|
5137
|
+
return r;
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5140
|
+
/**
|
|
5141
|
+
* Service to validate a auth token against a ThoughtSpot host.
|
|
5142
|
+
*
|
|
5143
|
+
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
5144
|
+
* @param authToken : Auth token to verify.
|
|
5145
|
+
*/
|
|
5146
|
+
async function verifyTokenService(thoughtSpotHost, authToken) {
|
|
5147
|
+
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
5148
|
+
try {
|
|
5149
|
+
const res = await fetch(authVerificationUrl, {
|
|
5150
|
+
headers: {
|
|
5151
|
+
Authorization: `Bearer ${authToken}`,
|
|
5152
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5153
|
+
},
|
|
5154
|
+
credentials: 'omit',
|
|
5155
|
+
});
|
|
5156
|
+
return res.ok;
|
|
5157
|
+
}
|
|
5158
|
+
catch (e) {
|
|
5159
|
+
console.error(`Token Verification Service failed : ${e.message}`);
|
|
5160
|
+
}
|
|
5161
|
+
return false;
|
|
5162
|
+
}
|
|
5163
|
+
/**
|
|
5164
|
+
*
|
|
5165
|
+
* @param authEndpoint
|
|
5166
|
+
*/
|
|
5167
|
+
async function fetchAuthTokenService(authEndpoint) {
|
|
5168
|
+
return fetch(authEndpoint);
|
|
5169
|
+
}
|
|
5170
|
+
/**
|
|
5171
|
+
*
|
|
5172
|
+
* @param thoughtSpotHost
|
|
5173
|
+
* @param username
|
|
5174
|
+
* @param authToken
|
|
5175
|
+
*/
|
|
5176
|
+
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
5177
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
5178
|
+
credentials: 'include',
|
|
5179
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5180
|
+
// error
|
|
5181
|
+
redirect: 'manual',
|
|
5182
|
+
});
|
|
5183
|
+
}
|
|
5184
|
+
/**
|
|
5185
|
+
*
|
|
5186
|
+
* @param thoughtSpotHost
|
|
5187
|
+
* @param username
|
|
5188
|
+
* @param authToken
|
|
5189
|
+
*/
|
|
5190
|
+
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
5191
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
5192
|
+
method: 'POST',
|
|
5193
|
+
headers: {
|
|
5194
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5195
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5196
|
+
},
|
|
5197
|
+
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
5198
|
+
credentials: 'include',
|
|
5199
|
+
// We do not want to follow the redirect, as it starts giving a CORS
|
|
5200
|
+
// error
|
|
5201
|
+
redirect: 'manual',
|
|
5202
|
+
});
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
*
|
|
5206
|
+
* @param thoughtSpotHost
|
|
5207
|
+
* @param username
|
|
5208
|
+
* @param password
|
|
5209
|
+
*/
|
|
5210
|
+
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
5211
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
5212
|
+
method: 'POST',
|
|
5213
|
+
headers: {
|
|
5214
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
5215
|
+
'x-requested-by': 'ThoughtSpot',
|
|
5216
|
+
},
|
|
5217
|
+
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
5218
|
+
credentials: 'include',
|
|
5219
|
+
});
|
|
5220
|
+
}
|
|
5221
|
+
|
|
5222
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
5223
|
+
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
5224
|
+
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
5225
|
+
let cachedAuthToken = null;
|
|
5226
|
+
// This method can be used to get the authToken using the embedConfig
|
|
5227
|
+
const getAuthenticationToken = async (embedConfig) => {
|
|
5228
|
+
if (cachedAuthToken) {
|
|
5229
|
+
let isCachedTokenStillValid;
|
|
5230
|
+
try {
|
|
5231
|
+
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
5232
|
+
}
|
|
5233
|
+
catch {
|
|
5234
|
+
isCachedTokenStillValid = false;
|
|
5235
|
+
}
|
|
5236
|
+
if (isCachedTokenStillValid)
|
|
5237
|
+
return cachedAuthToken;
|
|
5238
|
+
}
|
|
5239
|
+
const { authEndpoint, getAuthToken } = embedConfig;
|
|
5240
|
+
let authToken = null;
|
|
5241
|
+
if (getAuthToken) {
|
|
5242
|
+
authToken = await getAuthToken();
|
|
5243
|
+
}
|
|
5244
|
+
else {
|
|
5245
|
+
const response = await fetchAuthTokenService(authEndpoint);
|
|
5246
|
+
authToken = await response.text();
|
|
5247
|
+
}
|
|
5248
|
+
// this will throw error if the token is not valid
|
|
5249
|
+
await validateAuthToken(embedConfig, authToken);
|
|
5250
|
+
cachedAuthToken = authToken;
|
|
5251
|
+
return authToken;
|
|
5252
|
+
};
|
|
5253
|
+
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
5254
|
+
try {
|
|
5255
|
+
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
5256
|
+
if (isTokenValid)
|
|
5257
|
+
return true;
|
|
5258
|
+
}
|
|
5259
|
+
catch {
|
|
5260
|
+
return false;
|
|
5261
|
+
}
|
|
5262
|
+
if (cachedAuthToken && cachedAuthToken === authToken) {
|
|
5263
|
+
if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
|
|
5264
|
+
// eslint-disable-next-line no-alert
|
|
5265
|
+
alert(DUPLICATE_TOKEN_ERR);
|
|
5266
|
+
}
|
|
5267
|
+
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
5268
|
+
}
|
|
5269
|
+
else {
|
|
5270
|
+
throw new Error(INVALID_TOKEN_ERR);
|
|
5271
|
+
}
|
|
5272
|
+
};
|
|
5273
|
+
|
|
5274
|
+
let config = {};
|
|
5275
|
+
/**
|
|
5276
|
+
* Gets the configuration embed was initialized with.
|
|
5277
|
+
*
|
|
5278
|
+
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
5279
|
+
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
5280
|
+
* @group Global methods
|
|
5281
|
+
*/
|
|
5282
|
+
const getEmbedConfig = () => config;
|
|
5283
|
+
|
|
5284
|
+
const tokenizedFetch = async (input, init) => {
|
|
5285
|
+
const embedConfig = getEmbedConfig();
|
|
5286
|
+
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
5287
|
+
return fetch(input, init);
|
|
5288
|
+
}
|
|
5289
|
+
const req = new Request(input, init);
|
|
5290
|
+
const authToken = await getAuthenticationToken(embedConfig);
|
|
5291
|
+
if (authToken) {
|
|
5292
|
+
req.headers.append('Authorization', `Bearer ${authToken}`);
|
|
5293
|
+
}
|
|
5294
|
+
return fetch(req);
|
|
5295
|
+
};
|
|
5296
|
+
|
|
5115
5297
|
/**
|
|
5116
5298
|
*
|
|
5117
5299
|
* @param root0
|
|
@@ -5360,7 +5542,7 @@ class AnswerService {
|
|
|
5360
5542
|
*/
|
|
5361
5543
|
async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
|
|
5362
5544
|
const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
|
|
5363
|
-
return
|
|
5545
|
+
return tokenizedFetch(fetchUrl, {
|
|
5364
5546
|
credentials: 'include',
|
|
5365
5547
|
});
|
|
5366
5548
|
}
|
|
@@ -11994,14 +12176,13 @@ var createSet = !(_Set && (1 / _setToArray(new _Set([,-0]))[1]) == INFINITY) ? n
|
|
|
11994
12176
|
return new _Set(values);
|
|
11995
12177
|
};
|
|
11996
12178
|
|
|
11997
|
-
// eslint-disable-next-line import/no-cycle
|
|
11998
12179
|
/**
|
|
11999
12180
|
*
|
|
12000
12181
|
* @param url
|
|
12001
12182
|
* @param options
|
|
12002
12183
|
*/
|
|
12003
|
-
function
|
|
12004
|
-
return
|
|
12184
|
+
function tokenisedFailureLoggedFetch(url, options = {}) {
|
|
12185
|
+
return tokenizedFetch(url, options).then(async (r) => {
|
|
12005
12186
|
var _a;
|
|
12006
12187
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
12007
12188
|
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
@@ -12014,81 +12195,7 @@ function failureLoggedFetch(url, options = {}) {
|
|
|
12014
12195
|
* @param authVerificationUrl
|
|
12015
12196
|
*/
|
|
12016
12197
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
12017
|
-
return
|
|
12018
|
-
credentials: 'include',
|
|
12019
|
-
});
|
|
12020
|
-
}
|
|
12021
|
-
/**
|
|
12022
|
-
* Service to validate a auth token against a ThoughtSpot host.
|
|
12023
|
-
*
|
|
12024
|
-
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
12025
|
-
* @param authToken : Auth token to verify.
|
|
12026
|
-
*/
|
|
12027
|
-
function verifyTokenService(thoughtSpotHost, authToken) {
|
|
12028
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
12029
|
-
return fetch(authVerificationUrl, {
|
|
12030
|
-
headers: {
|
|
12031
|
-
Authorization: `Bearer ${authToken}`,
|
|
12032
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12033
|
-
},
|
|
12034
|
-
credentials: 'omit',
|
|
12035
|
-
});
|
|
12036
|
-
}
|
|
12037
|
-
/**
|
|
12038
|
-
*
|
|
12039
|
-
* @param authEndpoint
|
|
12040
|
-
*/
|
|
12041
|
-
async function fetchAuthTokenService(authEndpoint) {
|
|
12042
|
-
return fetch(authEndpoint);
|
|
12043
|
-
}
|
|
12044
|
-
/**
|
|
12045
|
-
*
|
|
12046
|
-
* @param thoughtSpotHost
|
|
12047
|
-
* @param username
|
|
12048
|
-
* @param authToken
|
|
12049
|
-
*/
|
|
12050
|
-
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
12051
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
12052
|
-
credentials: 'include',
|
|
12053
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12054
|
-
// error
|
|
12055
|
-
redirect: 'manual',
|
|
12056
|
-
});
|
|
12057
|
-
}
|
|
12058
|
-
/**
|
|
12059
|
-
*
|
|
12060
|
-
* @param thoughtSpotHost
|
|
12061
|
-
* @param username
|
|
12062
|
-
* @param authToken
|
|
12063
|
-
*/
|
|
12064
|
-
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
12065
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
12066
|
-
method: 'POST',
|
|
12067
|
-
headers: {
|
|
12068
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12069
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12070
|
-
},
|
|
12071
|
-
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
12072
|
-
credentials: 'include',
|
|
12073
|
-
// We do not want to follow the redirect, as it starts giving a CORS
|
|
12074
|
-
// error
|
|
12075
|
-
redirect: 'manual',
|
|
12076
|
-
});
|
|
12077
|
-
}
|
|
12078
|
-
/**
|
|
12079
|
-
*
|
|
12080
|
-
* @param thoughtSpotHost
|
|
12081
|
-
* @param username
|
|
12082
|
-
* @param password
|
|
12083
|
-
*/
|
|
12084
|
-
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
12085
|
-
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
12086
|
-
method: 'POST',
|
|
12087
|
-
headers: {
|
|
12088
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
12089
|
-
'x-requested-by': 'ThoughtSpot',
|
|
12090
|
-
},
|
|
12091
|
-
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
12198
|
+
return tokenisedFailureLoggedFetch(authVerificationUrl, {
|
|
12092
12199
|
credentials: 'include',
|
|
12093
12200
|
});
|
|
12094
12201
|
}
|
|
@@ -12106,17 +12213,6 @@ const sessionInfoPromise = new Promise((resolve) => {
|
|
|
12106
12213
|
});
|
|
12107
12214
|
let releaseVersion = '';
|
|
12108
12215
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
12109
|
-
const EndPoints = {
|
|
12110
|
-
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
12111
|
-
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
12112
|
-
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
12113
|
-
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
12114
|
-
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
12115
|
-
LOGOUT: '/callosum/v1/session/logout',
|
|
12116
|
-
EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
|
|
12117
|
-
EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
|
|
12118
|
-
IS_ACTIVE: '/callosum/v1/session/isactive',
|
|
12119
|
-
};
|
|
12120
12216
|
/**
|
|
12121
12217
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
12122
12218
|
* of {@link AuthStatus.FAILURE}.
|
|
@@ -12262,21 +12358,6 @@ async function isLoggedIn(thoughtSpotHost) {
|
|
|
12262
12358
|
function getReleaseVersion() {
|
|
12263
12359
|
return releaseVersion;
|
|
12264
12360
|
}
|
|
12265
|
-
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
12266
|
-
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
12267
|
-
let prevAuthToken = null;
|
|
12268
|
-
/**
|
|
12269
|
-
*
|
|
12270
|
-
* @param authtoken
|
|
12271
|
-
*/
|
|
12272
|
-
function alertForDuplicateToken(authtoken) {
|
|
12273
|
-
if (prevAuthToken === authtoken) {
|
|
12274
|
-
// eslint-disable-next-line no-alert
|
|
12275
|
-
alert(DUPLICATE_TOKEN_ERR);
|
|
12276
|
-
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
12277
|
-
}
|
|
12278
|
-
prevAuthToken = authtoken;
|
|
12279
|
-
}
|
|
12280
12361
|
/**
|
|
12281
12362
|
* Check if we are stuck at the SSO redirect URL
|
|
12282
12363
|
*/
|
|
@@ -12294,19 +12375,6 @@ function removeSSORedirectUrlMarker() {
|
|
|
12294
12375
|
// that creates an issue.
|
|
12295
12376
|
window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
|
|
12296
12377
|
}
|
|
12297
|
-
const getAuthenticationToken = async (embedConfig) => {
|
|
12298
|
-
const { authEndpoint, getAuthToken } = embedConfig;
|
|
12299
|
-
let authToken = null;
|
|
12300
|
-
if (getAuthToken) {
|
|
12301
|
-
authToken = await getAuthToken();
|
|
12302
|
-
alertForDuplicateToken(authToken);
|
|
12303
|
-
}
|
|
12304
|
-
else {
|
|
12305
|
-
const response = await fetchAuthTokenService(authEndpoint);
|
|
12306
|
-
authToken = await response.text();
|
|
12307
|
-
}
|
|
12308
|
-
return authToken;
|
|
12309
|
-
};
|
|
12310
12378
|
/**
|
|
12311
12379
|
* Perform token based authentication
|
|
12312
12380
|
*
|
|
@@ -12347,16 +12415,17 @@ const doCookielessTokenAuth = async (embedConfig) => {
|
|
|
12347
12415
|
if (!authEndpoint && !getAuthToken) {
|
|
12348
12416
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
12349
12417
|
}
|
|
12418
|
+
let authSuccess = false;
|
|
12350
12419
|
try {
|
|
12351
12420
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12421
|
+
if (authToken) {
|
|
12422
|
+
authSuccess = true;
|
|
12423
|
+
}
|
|
12355
12424
|
}
|
|
12356
|
-
catch
|
|
12357
|
-
|
|
12425
|
+
catch {
|
|
12426
|
+
authSuccess = false;
|
|
12358
12427
|
}
|
|
12359
|
-
return
|
|
12428
|
+
return authSuccess;
|
|
12360
12429
|
};
|
|
12361
12430
|
/**
|
|
12362
12431
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -12498,27 +12567,18 @@ const authenticate = async (embedConfig) => {
|
|
|
12498
12567
|
};
|
|
12499
12568
|
|
|
12500
12569
|
/* eslint-disable camelcase */
|
|
12501
|
-
let config = {};
|
|
12502
12570
|
const CONFIG_DEFAULTS = {
|
|
12503
12571
|
loginFailedMessage: 'Not logged in',
|
|
12504
12572
|
authTriggerText: 'Authorize',
|
|
12505
12573
|
authType: AuthType.None,
|
|
12506
12574
|
};
|
|
12507
12575
|
let authPromise;
|
|
12508
|
-
/**
|
|
12509
|
-
* Gets the configuration embed was initialized with.
|
|
12510
|
-
*
|
|
12511
|
-
* @returns {@link EmbedConfig} The configuration embed was initialized with.
|
|
12512
|
-
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
12513
|
-
* @group Global methods
|
|
12514
|
-
*/
|
|
12515
|
-
const getEmbedConfig = () => config;
|
|
12516
12576
|
const getAuthPromise = () => authPromise;
|
|
12517
12577
|
/**
|
|
12518
12578
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
12519
12579
|
*/
|
|
12520
12580
|
const handleAuth = () => {
|
|
12521
|
-
authPromise = authenticate(
|
|
12581
|
+
authPromise = authenticate(getEmbedConfig());
|
|
12522
12582
|
authPromise.then((isLoggedIn) => {
|
|
12523
12583
|
if (!isLoggedIn) {
|
|
12524
12584
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -12541,7 +12601,7 @@ const hostUrlToFeatureUrl = {
|
|
|
12541
12601
|
*
|
|
12542
12602
|
*/
|
|
12543
12603
|
function disableAutoLogin() {
|
|
12544
|
-
|
|
12604
|
+
getEmbedConfig().autoLogin = false;
|
|
12545
12605
|
}
|
|
12546
12606
|
let renderQueue = Promise.resolve();
|
|
12547
12607
|
/**
|
|
@@ -12551,7 +12611,7 @@ let renderQueue = Promise.resolve();
|
|
|
12551
12611
|
* @param fn The function being registered
|
|
12552
12612
|
*/
|
|
12553
12613
|
const renderInQueue = (fn) => {
|
|
12554
|
-
const { queueMultiRenders = false } =
|
|
12614
|
+
const { queueMultiRenders = false } = getEmbedConfig();
|
|
12555
12615
|
if (queueMultiRenders) {
|
|
12556
12616
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
12557
12617
|
return renderQueue;
|
|
@@ -12596,9 +12656,9 @@ function processAuthInit(e) {
|
|
|
12596
12656
|
* @param containerEl
|
|
12597
12657
|
*/
|
|
12598
12658
|
function processNoCookieAccess(e, containerEl) {
|
|
12599
|
-
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
|
|
12659
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
|
|
12600
12660
|
if (!ignoreNoCookieAccess) {
|
|
12601
|
-
if (!suppressNoCookieAccessAlert) {
|
|
12661
|
+
if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
|
|
12602
12662
|
// eslint-disable-next-line no-alert
|
|
12603
12663
|
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.');
|
|
12604
12664
|
}
|
|
@@ -12716,7 +12776,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
12716
12776
|
});
|
|
12717
12777
|
}
|
|
12718
12778
|
|
|
12719
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.26.
|
|
12779
|
+
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={".":{"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};
|
|
12720
12780
|
|
|
12721
12781
|
/**
|
|
12722
12782
|
* Copyright (c) 2022
|
|
@@ -12752,7 +12812,6 @@ class TsEmbed {
|
|
|
12752
12812
|
*/
|
|
12753
12813
|
this.embedNodeKey = '__tsEmbed';
|
|
12754
12814
|
this.isAppInitialized = false;
|
|
12755
|
-
this.embedComponentType = 'TsEmbed';
|
|
12756
12815
|
/**
|
|
12757
12816
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
12758
12817
|
* will generate for embedding. This provides additional security to
|
|
@@ -12832,7 +12891,7 @@ class TsEmbed {
|
|
|
12832
12891
|
allOtherKeys.forEach((key) => {
|
|
12833
12892
|
if (!isUndefined(viewConfig[key])
|
|
12834
12893
|
&& !isEqual_1(viewConfig[key], preRenderedObject.viewConfig[key])) {
|
|
12835
|
-
console.warn(
|
|
12894
|
+
console.warn('TS Embed component was pre-rendered with '
|
|
12836
12895
|
+ `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
|
|
12837
12896
|
+ `but a different value "${JSON.stringify(viewConfig[key])}" `
|
|
12838
12897
|
+ 'was passed to the Embed component. '
|
|
@@ -12857,7 +12916,6 @@ class TsEmbed {
|
|
|
12857
12916
|
this.registerAppInit();
|
|
12858
12917
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
12859
12918
|
...viewConfig,
|
|
12860
|
-
embedComponentType: this.embedComponentType,
|
|
12861
12919
|
});
|
|
12862
12920
|
}
|
|
12863
12921
|
/**
|
|
@@ -13816,8 +13874,8 @@ const HiddenActionItemByDefaultForSageEmbed = [
|
|
|
13816
13874
|
class SageEmbed extends V1Embed {
|
|
13817
13875
|
// eslint-disable-next-line no-useless-constructor
|
|
13818
13876
|
constructor(domSelector, viewConfig) {
|
|
13877
|
+
viewConfig.embedComponentType = 'SageEmbed';
|
|
13819
13878
|
super(domSelector, viewConfig);
|
|
13820
|
-
this.embedComponentType = 'SageEmbed';
|
|
13821
13879
|
}
|
|
13822
13880
|
/**
|
|
13823
13881
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -13907,9 +13965,8 @@ const HiddenActionItemByDefaultForSearchEmbed = [
|
|
|
13907
13965
|
*/
|
|
13908
13966
|
class SearchEmbed extends TsEmbed {
|
|
13909
13967
|
constructor(domSelector, viewConfig) {
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
this.viewConfig = viewConfig;
|
|
13968
|
+
viewConfig.embedComponentType = 'SearchEmbed';
|
|
13969
|
+
super(domSelector, viewConfig);
|
|
13913
13970
|
}
|
|
13914
13971
|
/**
|
|
13915
13972
|
* Get the state of the data sources panel that the embedded
|
|
@@ -13996,7 +14053,8 @@ class SearchEmbed extends TsEmbed {
|
|
|
13996
14053
|
const src = this.getIFrameSrc(answerId);
|
|
13997
14054
|
this.renderIFrame(src);
|
|
13998
14055
|
getAuthPromise().then(() => {
|
|
13999
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14056
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
14057
|
+
|| getEmbedConfig().suppressErrorAlerts)) {
|
|
14000
14058
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
14001
14059
|
}
|
|
14002
14060
|
});
|
|
@@ -14057,9 +14115,9 @@ var Page;
|
|
|
14057
14115
|
class AppEmbed extends V1Embed {
|
|
14058
14116
|
// eslint-disable-next-line no-useless-constructor
|
|
14059
14117
|
constructor(domSelector, viewConfig) {
|
|
14118
|
+
viewConfig.embedComponentType = 'AppEmbed';
|
|
14060
14119
|
super(domSelector, viewConfig);
|
|
14061
14120
|
this.defaultHeight = '100%';
|
|
14062
|
-
this.embedComponentType = 'AppEmbed';
|
|
14063
14121
|
/**
|
|
14064
14122
|
* Set the iframe height as per the computed height received
|
|
14065
14123
|
* from the ThoughtSpot app.
|
|
@@ -14251,9 +14309,9 @@ class AppEmbed extends V1Embed {
|
|
|
14251
14309
|
class LiveboardEmbed extends V1Embed {
|
|
14252
14310
|
// eslint-disable-next-line no-useless-constructor
|
|
14253
14311
|
constructor(domSelector, viewConfig) {
|
|
14312
|
+
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
14254
14313
|
super(domSelector, viewConfig);
|
|
14255
14314
|
this.defaultHeight = 500;
|
|
14256
|
-
this.embedComponentType = 'LiveboardEmbed';
|
|
14257
14315
|
/**
|
|
14258
14316
|
* Set the iframe height as per the computed height received
|
|
14259
14317
|
* from the ThoughtSpot app.
|