@thoughtspot/visual-embed-sdk 1.21.0-react.2 → 1.21.0-react.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 +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +20 -20
- package/cjs/src/embed/base.js.map +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +6 -6
- package/dist/tsembed-react.js +6 -6
- package/dist/tsembed.es.js +20 -20
- package/dist/tsembed.js +20 -20
- package/lib/package.json +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +20 -20
- package/lib/src/embed/base.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/base.ts +21 -20
package/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAMH,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAGnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAMH,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAGnB,MAAM,SAAS,CAAC;AAWjB,MAAM,WAAW,eAAe;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,eAAe,CAAC;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC3B,QA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I5B"}
|
package/cjs/src/embed/base.js
CHANGED
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "notifyAuthSDKSuccess", { enumerable: true, get:
|
|
|
22
22
|
Object.defineProperty(exports, "notifyAuthSuccess", { enumerable: true, get: function () { return auth_1.notifyAuthSuccess; } });
|
|
23
23
|
Object.defineProperty(exports, "notifyLogout", { enumerable: true, get: function () { return auth_1.notifyLogout; } });
|
|
24
24
|
const mixpanel_service_1 = require("../mixpanel-service");
|
|
25
|
-
|
|
25
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
26
26
|
const CONFIG_DEFAULTS = {
|
|
27
27
|
loginFailedMessage: 'Not logged in',
|
|
28
28
|
authTriggerText: 'Authorize',
|
|
@@ -35,7 +35,7 @@ const CONFIG_DEFAULTS = {
|
|
|
35
35
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
36
36
|
* @group Global methods
|
|
37
37
|
*/
|
|
38
|
-
const getEmbedConfig = () =>
|
|
38
|
+
const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
39
39
|
exports.getEmbedConfig = getEmbedConfig;
|
|
40
40
|
const getAuthPromise = () => exports.authPromise;
|
|
41
41
|
exports.getAuthPromise = getAuthPromise;
|
|
@@ -43,7 +43,7 @@ exports.getAuthPromise = getAuthPromise;
|
|
|
43
43
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
44
44
|
*/
|
|
45
45
|
const handleAuth = () => {
|
|
46
|
-
exports.authPromise = (0, auth_1.authenticate)(
|
|
46
|
+
exports.authPromise = (0, auth_1.authenticate)(window.thoughtSpotConfig);
|
|
47
47
|
exports.authPromise.then((isLoggedIn) => {
|
|
48
48
|
if (!isLoggedIn) {
|
|
49
49
|
(0, auth_1.notifyAuthFailure)(auth_1.AuthFailureType.SDK);
|
|
@@ -80,7 +80,7 @@ const prefetch = (url, prefetchFeatures) => {
|
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
const features = prefetchFeatures || [types_1.PrefetchFeatures.FullApp];
|
|
83
|
-
let hostUrl = url ||
|
|
83
|
+
let hostUrl = url || window.thoughtSpotConfig.thoughtSpotHost;
|
|
84
84
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
85
85
|
(0, uniq_1.default)(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
86
86
|
const iFrame = document.createElement('iframe');
|
|
@@ -147,26 +147,26 @@ function backwardCompat(embedConfig) {
|
|
|
147
147
|
const init = (embedConfig) => {
|
|
148
148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
149
149
|
sanity(embedConfig);
|
|
150
|
-
|
|
150
|
+
window.thoughtSpotConfig = {
|
|
151
151
|
...CONFIG_DEFAULTS,
|
|
152
152
|
...embedConfig,
|
|
153
153
|
thoughtSpotHost: (0, config_1.getThoughtSpotHost)(embedConfig),
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
window.thoughtSpotConfig = backwardCompat(window.thoughtSpotConfig);
|
|
156
156
|
const authEE = new eventemitter3_1.default();
|
|
157
157
|
(0, auth_1.setAuthEE)(authEE);
|
|
158
158
|
(0, exports.handleAuth)();
|
|
159
159
|
(0, mixpanel_service_1.uploadMixpanelEvent)(mixpanel_service_1.MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
160
|
-
authType:
|
|
161
|
-
host:
|
|
160
|
+
authType: window.thoughtSpotConfig.authType,
|
|
161
|
+
host: window.thoughtSpotConfig.thoughtSpotHost,
|
|
162
162
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
163
163
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
164
164
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
165
165
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
166
166
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
167
167
|
});
|
|
168
|
-
if (
|
|
169
|
-
(0, exports.prefetch)(
|
|
168
|
+
if (window.thoughtSpotConfig.callPrefetch) {
|
|
169
|
+
(0, exports.prefetch)(window.thoughtSpotConfig.thoughtSpotHost);
|
|
170
170
|
}
|
|
171
171
|
return authEE;
|
|
172
172
|
};
|
|
@@ -175,7 +175,7 @@ exports.init = init;
|
|
|
175
175
|
*
|
|
176
176
|
*/
|
|
177
177
|
function disableAutoLogin() {
|
|
178
|
-
|
|
178
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
179
179
|
}
|
|
180
180
|
exports.disableAutoLogin = disableAutoLogin;
|
|
181
181
|
/**
|
|
@@ -194,7 +194,7 @@ const logout = (doNotDisableAutoLogin = false) => {
|
|
|
194
194
|
if (!doNotDisableAutoLogin) {
|
|
195
195
|
disableAutoLogin();
|
|
196
196
|
}
|
|
197
|
-
return (0, auth_1.logout)(
|
|
197
|
+
return (0, auth_1.logout)(window.thoughtSpotConfig).then((isLoggedIn) => {
|
|
198
198
|
(0, auth_1.notifyLogout)();
|
|
199
199
|
return isLoggedIn;
|
|
200
200
|
});
|
|
@@ -208,7 +208,7 @@ let renderQueue = Promise.resolve();
|
|
|
208
208
|
* @param fn The function being registered
|
|
209
209
|
*/
|
|
210
210
|
const renderInQueue = (fn) => {
|
|
211
|
-
const { queueMultiRenders = false } =
|
|
211
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
212
212
|
if (queueMultiRenders) {
|
|
213
213
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
214
214
|
return renderQueue;
|
|
@@ -218,16 +218,16 @@ const renderInQueue = (fn) => {
|
|
|
218
218
|
};
|
|
219
219
|
exports.renderInQueue = renderInQueue;
|
|
220
220
|
const executeTML = async (data) => {
|
|
221
|
-
const { thoughtSpotHost, authType } =
|
|
221
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
222
222
|
try {
|
|
223
|
-
sanity(
|
|
223
|
+
sanity(window.thoughtSpotConfig);
|
|
224
224
|
}
|
|
225
225
|
catch (err) {
|
|
226
226
|
return Promise.reject(err);
|
|
227
227
|
}
|
|
228
228
|
let authToken = '';
|
|
229
229
|
if (authType === types_1.AuthType.TrustedAuthTokenCookieless) {
|
|
230
|
-
authToken = await (0, auth_1.getAuthenticaionToken)(
|
|
230
|
+
authToken = await (0, auth_1.getAuthenticaionToken)(window.thoughtSpotConfig);
|
|
231
231
|
}
|
|
232
232
|
const headers = {
|
|
233
233
|
'Content-Type': 'application/json',
|
|
@@ -259,9 +259,9 @@ const executeTML = async (data) => {
|
|
|
259
259
|
};
|
|
260
260
|
exports.executeTML = executeTML;
|
|
261
261
|
const exportTML = async (data) => {
|
|
262
|
-
const { thoughtSpotHost, authType } =
|
|
262
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
263
263
|
try {
|
|
264
|
-
sanity(
|
|
264
|
+
sanity(window.thoughtSpotConfig);
|
|
265
265
|
}
|
|
266
266
|
catch (err) {
|
|
267
267
|
return Promise.reject(err);
|
|
@@ -274,7 +274,7 @@ const exportTML = async (data) => {
|
|
|
274
274
|
};
|
|
275
275
|
let authToken = '';
|
|
276
276
|
if (authType === types_1.AuthType.TrustedAuthTokenCookieless) {
|
|
277
|
-
authToken = await (0, auth_1.getAuthenticaionToken)(
|
|
277
|
+
authToken = await (0, auth_1.getAuthenticaionToken)(window.thoughtSpotConfig);
|
|
278
278
|
}
|
|
279
279
|
const headers = {
|
|
280
280
|
'Content-Type': 'application/json',
|
|
@@ -305,7 +305,7 @@ exports.exportTML = exportTML;
|
|
|
305
305
|
*
|
|
306
306
|
*/
|
|
307
307
|
function reset() {
|
|
308
|
-
|
|
308
|
+
window.thoughtSpotConfig = {};
|
|
309
309
|
(0, auth_1.setAuthEE)(null);
|
|
310
310
|
exports.authPromise = null;
|
|
311
311
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":";;;;AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,0EAAyC;AACzC,+DAA+B;AAC/B,sCAA+C;AAC/C,oCAAmE;AACnE,kCAciB;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":";;;;AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,0EAAyC;AACzC,+DAA+B;AAC/B,sCAA+C;AAC/C,oCAAmE;AACnE,kCAciB;AAwCb,kGAhDA,wBAAiB,OAgDA;AAAE,qGA/CnB,2BAAoB,OA+CmB;AAAE,kGA9CzC,wBAAiB,OA8CyC;AAAE,6FA7C5D,mBAAY,OA6C4D;AAvC5E,0DAA0E;AAGzE,MAAc,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,IAAI,EAAiB,CAAC;AAClF,MAAM,eAAe,GAAyB;IAC1C,kBAAkB,EAAE,eAAe;IACnC,eAAe,EAAE,WAAW;IAC5B,QAAQ,EAAE,gBAAQ,CAAC,IAAI;CAC1B,CAAC;AAmBF;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,GAAgB,EAAE,CAAE,MAAc,CAAC,iBAAiB,CAAC;AAAtE,QAAA,cAAc,kBAAwD;AAE5E,MAAM,cAAc,GAAG,GAAqB,EAAE,CAAC,mBAAW,CAAC;AAArD,QAAA,cAAc,kBAAuC;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AE;QACX,OAAO,CAAC,aAAa,GAAG,UAAU,SAAS,EAAE,CAAC;KACjD;IAED,OAAO,KAAK,CAAC,GAAG,eAAe,GAAG,gBAAS,CAAC,UAAU,EAAE,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7B,WAAW,EAAE,SAAS;KACzB,CAAC;SACG,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACf,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;SACxF;QACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,KAAK,CAAC;IAChB,CAAC,CAAC,CAAC;AACX,CAAC,CAAC;AA3CW,QAAA,SAAS,aA2CpB;AAEF,4BAA4B;AAC5B;;GAEG;AACH,SAAgB,KAAK;IACjB,MAAM,CAAC,iBAAiB,GAAG,EAAS,CAAC;IACrC,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAChB,mBAAW,GAAG,IAAI,CAAC;AACvB,CAAC;AAJD,sBAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAMH,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAGnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;A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;;GAKG;AACH,eAAO,MAAM,aAAa,sBAAuB,GAAG,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC,KAAG,QAAQ,GAAG,CAQ3F,CAAC;AAEF,eAAO,MAAM,UAAU,SAAgB,eAAe,KAAG,QAAQ,GAAG,CAyCnE,CAAC;AAEF,eAAO,MAAM,SAAS,SAAgB,cAAc,KAAG,QAAQ,GAAG,CA2CjE,CAAC;AAGF;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
package/dist/tsembed-react.es.js
CHANGED
|
@@ -26386,7 +26386,7 @@ const authenticate = async (embedConfig) => {
|
|
|
26386
26386
|
};
|
|
26387
26387
|
|
|
26388
26388
|
/* eslint-disable camelcase */
|
|
26389
|
-
|
|
26389
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
26390
26390
|
const CONFIG_DEFAULTS = {
|
|
26391
26391
|
loginFailedMessage: 'Not logged in',
|
|
26392
26392
|
authTriggerText: 'Authorize',
|
|
@@ -26400,13 +26400,13 @@ let authPromise;
|
|
|
26400
26400
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
26401
26401
|
* @group Global methods
|
|
26402
26402
|
*/
|
|
26403
|
-
const getEmbedConfig = () =>
|
|
26403
|
+
const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
26404
26404
|
const getAuthPromise = () => authPromise;
|
|
26405
26405
|
/**
|
|
26406
26406
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
26407
26407
|
*/
|
|
26408
26408
|
const handleAuth = () => {
|
|
26409
|
-
authPromise = authenticate(
|
|
26409
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
26410
26410
|
authPromise.then((isLoggedIn) => {
|
|
26411
26411
|
if (!isLoggedIn) {
|
|
26412
26412
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -26429,7 +26429,7 @@ const hostUrlToFeatureUrl = {
|
|
|
26429
26429
|
*
|
|
26430
26430
|
*/
|
|
26431
26431
|
function disableAutoLogin() {
|
|
26432
|
-
|
|
26432
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
26433
26433
|
}
|
|
26434
26434
|
let renderQueue = Promise.resolve();
|
|
26435
26435
|
/**
|
|
@@ -26439,7 +26439,7 @@ let renderQueue = Promise.resolve();
|
|
|
26439
26439
|
* @param fn The function being registered
|
|
26440
26440
|
*/
|
|
26441
26441
|
const renderInQueue = (fn) => {
|
|
26442
|
-
const { queueMultiRenders = false } =
|
|
26442
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
26443
26443
|
if (queueMultiRenders) {
|
|
26444
26444
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
26445
26445
|
return renderQueue;
|
|
@@ -26662,7 +26662,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
26662
26662
|
});
|
|
26663
26663
|
}
|
|
26664
26664
|
|
|
26665
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.
|
|
26665
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.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:"./dist/tsembed.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"}};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":"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",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; npm run build","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":"^40.1.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","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","@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","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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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,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};
|
|
26666
26666
|
|
|
26667
26667
|
/**
|
|
26668
26668
|
* Copyright (c) 2022
|
package/dist/tsembed-react.js
CHANGED
|
@@ -26324,7 +26324,7 @@
|
|
|
26324
26324
|
};
|
|
26325
26325
|
|
|
26326
26326
|
/* eslint-disable camelcase */
|
|
26327
|
-
|
|
26327
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
26328
26328
|
const CONFIG_DEFAULTS = {
|
|
26329
26329
|
loginFailedMessage: 'Not logged in',
|
|
26330
26330
|
authTriggerText: 'Authorize',
|
|
@@ -26338,13 +26338,13 @@
|
|
|
26338
26338
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
26339
26339
|
* @group Global methods
|
|
26340
26340
|
*/
|
|
26341
|
-
const getEmbedConfig = () =>
|
|
26341
|
+
const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
26342
26342
|
const getAuthPromise = () => authPromise;
|
|
26343
26343
|
/**
|
|
26344
26344
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
26345
26345
|
*/
|
|
26346
26346
|
const handleAuth = () => {
|
|
26347
|
-
authPromise = authenticate(
|
|
26347
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
26348
26348
|
authPromise.then((isLoggedIn) => {
|
|
26349
26349
|
if (!isLoggedIn) {
|
|
26350
26350
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -26367,7 +26367,7 @@
|
|
|
26367
26367
|
*
|
|
26368
26368
|
*/
|
|
26369
26369
|
function disableAutoLogin() {
|
|
26370
|
-
|
|
26370
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
26371
26371
|
}
|
|
26372
26372
|
let renderQueue = Promise.resolve();
|
|
26373
26373
|
/**
|
|
@@ -26377,7 +26377,7 @@
|
|
|
26377
26377
|
* @param fn The function being registered
|
|
26378
26378
|
*/
|
|
26379
26379
|
const renderInQueue = (fn) => {
|
|
26380
|
-
const { queueMultiRenders = false } =
|
|
26380
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
26381
26381
|
if (queueMultiRenders) {
|
|
26382
26382
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
26383
26383
|
return renderQueue;
|
|
@@ -26600,7 +26600,7 @@
|
|
|
26600
26600
|
});
|
|
26601
26601
|
}
|
|
26602
26602
|
|
|
26603
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.
|
|
26603
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.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:"./dist/tsembed.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"}};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":"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",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; npm run build","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":"^40.1.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","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","@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","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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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,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};
|
|
26604
26604
|
|
|
26605
26605
|
/**
|
|
26606
26606
|
* Copyright (c) 2022
|
package/dist/tsembed.es.js
CHANGED
|
@@ -27025,7 +27025,7 @@ const authenticate = async (embedConfig) => {
|
|
|
27025
27025
|
};
|
|
27026
27026
|
|
|
27027
27027
|
/* eslint-disable camelcase */
|
|
27028
|
-
|
|
27028
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
27029
27029
|
const CONFIG_DEFAULTS = {
|
|
27030
27030
|
loginFailedMessage: 'Not logged in',
|
|
27031
27031
|
authTriggerText: 'Authorize',
|
|
@@ -27039,13 +27039,13 @@ let authPromise;
|
|
|
27039
27039
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
27040
27040
|
* @group Global methods
|
|
27041
27041
|
*/
|
|
27042
|
-
const getEmbedConfig = () =>
|
|
27042
|
+
const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
27043
27043
|
const getAuthPromise = () => authPromise;
|
|
27044
27044
|
/**
|
|
27045
27045
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
27046
27046
|
*/
|
|
27047
27047
|
const handleAuth = () => {
|
|
27048
|
-
authPromise = authenticate(
|
|
27048
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
27049
27049
|
authPromise.then((isLoggedIn) => {
|
|
27050
27050
|
if (!isLoggedIn) {
|
|
27051
27051
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -27081,7 +27081,7 @@ const prefetch = (url, prefetchFeatures) => {
|
|
|
27081
27081
|
}
|
|
27082
27082
|
else {
|
|
27083
27083
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
27084
|
-
let hostUrl = url ||
|
|
27084
|
+
let hostUrl = url || window.thoughtSpotConfig.thoughtSpotHost;
|
|
27085
27085
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
27086
27086
|
uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
27087
27087
|
const iFrame = document.createElement('iframe');
|
|
@@ -27147,26 +27147,26 @@ function backwardCompat(embedConfig) {
|
|
|
27147
27147
|
const init = (embedConfig) => {
|
|
27148
27148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
27149
27149
|
sanity(embedConfig);
|
|
27150
|
-
|
|
27150
|
+
window.thoughtSpotConfig = {
|
|
27151
27151
|
...CONFIG_DEFAULTS,
|
|
27152
27152
|
...embedConfig,
|
|
27153
27153
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
27154
27154
|
};
|
|
27155
|
-
|
|
27155
|
+
window.thoughtSpotConfig = backwardCompat(window.thoughtSpotConfig);
|
|
27156
27156
|
const authEE = new eventemitter3();
|
|
27157
27157
|
setAuthEE(authEE);
|
|
27158
27158
|
handleAuth();
|
|
27159
27159
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
27160
|
-
authType:
|
|
27161
|
-
host:
|
|
27160
|
+
authType: window.thoughtSpotConfig.authType,
|
|
27161
|
+
host: window.thoughtSpotConfig.thoughtSpotHost,
|
|
27162
27162
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
27163
27163
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
27164
27164
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
27165
27165
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
27166
27166
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
27167
27167
|
});
|
|
27168
|
-
if (
|
|
27169
|
-
prefetch(
|
|
27168
|
+
if (window.thoughtSpotConfig.callPrefetch) {
|
|
27169
|
+
prefetch(window.thoughtSpotConfig.thoughtSpotHost);
|
|
27170
27170
|
}
|
|
27171
27171
|
return authEE;
|
|
27172
27172
|
};
|
|
@@ -27174,7 +27174,7 @@ const init = (embedConfig) => {
|
|
|
27174
27174
|
*
|
|
27175
27175
|
*/
|
|
27176
27176
|
function disableAutoLogin() {
|
|
27177
|
-
|
|
27177
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
27178
27178
|
}
|
|
27179
27179
|
/**
|
|
27180
27180
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -27192,7 +27192,7 @@ const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
|
27192
27192
|
if (!doNotDisableAutoLogin) {
|
|
27193
27193
|
disableAutoLogin();
|
|
27194
27194
|
}
|
|
27195
|
-
return logout(
|
|
27195
|
+
return logout(window.thoughtSpotConfig).then((isLoggedIn) => {
|
|
27196
27196
|
notifyLogout();
|
|
27197
27197
|
return isLoggedIn;
|
|
27198
27198
|
});
|
|
@@ -27205,7 +27205,7 @@ let renderQueue = Promise.resolve();
|
|
|
27205
27205
|
* @param fn The function being registered
|
|
27206
27206
|
*/
|
|
27207
27207
|
const renderInQueue = (fn) => {
|
|
27208
|
-
const { queueMultiRenders = false } =
|
|
27208
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
27209
27209
|
if (queueMultiRenders) {
|
|
27210
27210
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
27211
27211
|
return renderQueue;
|
|
@@ -27214,16 +27214,16 @@ const renderInQueue = (fn) => {
|
|
|
27214
27214
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
27215
27215
|
};
|
|
27216
27216
|
const executeTML = async (data) => {
|
|
27217
|
-
const { thoughtSpotHost, authType } =
|
|
27217
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
27218
27218
|
try {
|
|
27219
|
-
sanity(
|
|
27219
|
+
sanity(window.thoughtSpotConfig);
|
|
27220
27220
|
}
|
|
27221
27221
|
catch (err) {
|
|
27222
27222
|
return Promise.reject(err);
|
|
27223
27223
|
}
|
|
27224
27224
|
let authToken = '';
|
|
27225
27225
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
27226
|
-
authToken = await getAuthenticaionToken(
|
|
27226
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
27227
27227
|
}
|
|
27228
27228
|
const headers = {
|
|
27229
27229
|
'Content-Type': 'application/json',
|
|
@@ -27254,9 +27254,9 @@ const executeTML = async (data) => {
|
|
|
27254
27254
|
});
|
|
27255
27255
|
};
|
|
27256
27256
|
const exportTML = async (data) => {
|
|
27257
|
-
const { thoughtSpotHost, authType } =
|
|
27257
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
27258
27258
|
try {
|
|
27259
|
-
sanity(
|
|
27259
|
+
sanity(window.thoughtSpotConfig);
|
|
27260
27260
|
}
|
|
27261
27261
|
catch (err) {
|
|
27262
27262
|
return Promise.reject(err);
|
|
@@ -27269,7 +27269,7 @@ const exportTML = async (data) => {
|
|
|
27269
27269
|
};
|
|
27270
27270
|
let authToken = '';
|
|
27271
27271
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
27272
|
-
authToken = await getAuthenticaionToken(
|
|
27272
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
27273
27273
|
}
|
|
27274
27274
|
const headers = {
|
|
27275
27275
|
'Content-Type': 'application/json',
|
|
@@ -27509,7 +27509,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
27509
27509
|
});
|
|
27510
27510
|
}
|
|
27511
27511
|
|
|
27512
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.
|
|
27512
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.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:"./dist/tsembed.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"}};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":"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",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; npm run build","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":"^40.1.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","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","@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","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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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,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};
|
|
27513
27513
|
|
|
27514
27514
|
/**
|
|
27515
27515
|
* Copyright (c) 2022
|
package/dist/tsembed.js
CHANGED
|
@@ -26923,7 +26923,7 @@
|
|
|
26923
26923
|
};
|
|
26924
26924
|
|
|
26925
26925
|
/* eslint-disable camelcase */
|
|
26926
|
-
|
|
26926
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
26927
26927
|
const CONFIG_DEFAULTS = {
|
|
26928
26928
|
loginFailedMessage: 'Not logged in',
|
|
26929
26929
|
authTriggerText: 'Authorize',
|
|
@@ -26937,13 +26937,13 @@
|
|
|
26937
26937
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
26938
26938
|
* @group Global methods
|
|
26939
26939
|
*/
|
|
26940
|
-
const getEmbedConfig = () =>
|
|
26940
|
+
const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
26941
26941
|
const getAuthPromise = () => authPromise;
|
|
26942
26942
|
/**
|
|
26943
26943
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
26944
26944
|
*/
|
|
26945
26945
|
const handleAuth = () => {
|
|
26946
|
-
authPromise = authenticate(
|
|
26946
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
26947
26947
|
authPromise.then((isLoggedIn) => {
|
|
26948
26948
|
if (!isLoggedIn) {
|
|
26949
26949
|
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
@@ -26979,7 +26979,7 @@
|
|
|
26979
26979
|
}
|
|
26980
26980
|
else {
|
|
26981
26981
|
const features = prefetchFeatures || [exports.PrefetchFeatures.FullApp];
|
|
26982
|
-
let hostUrl = url ||
|
|
26982
|
+
let hostUrl = url || window.thoughtSpotConfig.thoughtSpotHost;
|
|
26983
26983
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
26984
26984
|
uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
26985
26985
|
const iFrame = document.createElement('iframe');
|
|
@@ -27045,26 +27045,26 @@
|
|
|
27045
27045
|
const init = (embedConfig) => {
|
|
27046
27046
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
27047
27047
|
sanity(embedConfig);
|
|
27048
|
-
|
|
27048
|
+
window.thoughtSpotConfig = {
|
|
27049
27049
|
...CONFIG_DEFAULTS,
|
|
27050
27050
|
...embedConfig,
|
|
27051
27051
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
27052
27052
|
};
|
|
27053
|
-
|
|
27053
|
+
window.thoughtSpotConfig = backwardCompat(window.thoughtSpotConfig);
|
|
27054
27054
|
const authEE = new eventemitter3();
|
|
27055
27055
|
setAuthEE(authEE);
|
|
27056
27056
|
handleAuth();
|
|
27057
27057
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
27058
|
-
authType:
|
|
27059
|
-
host:
|
|
27058
|
+
authType: window.thoughtSpotConfig.authType,
|
|
27059
|
+
host: window.thoughtSpotConfig.thoughtSpotHost,
|
|
27060
27060
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
27061
27061
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
27062
27062
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
27063
27063
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
27064
27064
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
27065
27065
|
});
|
|
27066
|
-
if (
|
|
27067
|
-
prefetch(
|
|
27066
|
+
if (window.thoughtSpotConfig.callPrefetch) {
|
|
27067
|
+
prefetch(window.thoughtSpotConfig.thoughtSpotHost);
|
|
27068
27068
|
}
|
|
27069
27069
|
return authEE;
|
|
27070
27070
|
};
|
|
@@ -27072,7 +27072,7 @@
|
|
|
27072
27072
|
*
|
|
27073
27073
|
*/
|
|
27074
27074
|
function disableAutoLogin() {
|
|
27075
|
-
|
|
27075
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
27076
27076
|
}
|
|
27077
27077
|
/**
|
|
27078
27078
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -27090,7 +27090,7 @@
|
|
|
27090
27090
|
if (!doNotDisableAutoLogin) {
|
|
27091
27091
|
disableAutoLogin();
|
|
27092
27092
|
}
|
|
27093
|
-
return logout(
|
|
27093
|
+
return logout(window.thoughtSpotConfig).then((isLoggedIn) => {
|
|
27094
27094
|
notifyLogout();
|
|
27095
27095
|
return isLoggedIn;
|
|
27096
27096
|
});
|
|
@@ -27103,7 +27103,7 @@
|
|
|
27103
27103
|
* @param fn The function being registered
|
|
27104
27104
|
*/
|
|
27105
27105
|
const renderInQueue = (fn) => {
|
|
27106
|
-
const { queueMultiRenders = false } =
|
|
27106
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
27107
27107
|
if (queueMultiRenders) {
|
|
27108
27108
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
27109
27109
|
return renderQueue;
|
|
@@ -27112,16 +27112,16 @@
|
|
|
27112
27112
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
27113
27113
|
};
|
|
27114
27114
|
const executeTML = async (data) => {
|
|
27115
|
-
const { thoughtSpotHost, authType } =
|
|
27115
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
27116
27116
|
try {
|
|
27117
|
-
sanity(
|
|
27117
|
+
sanity(window.thoughtSpotConfig);
|
|
27118
27118
|
}
|
|
27119
27119
|
catch (err) {
|
|
27120
27120
|
return Promise.reject(err);
|
|
27121
27121
|
}
|
|
27122
27122
|
let authToken = '';
|
|
27123
27123
|
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
27124
|
-
authToken = await getAuthenticaionToken(
|
|
27124
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
27125
27125
|
}
|
|
27126
27126
|
const headers = {
|
|
27127
27127
|
'Content-Type': 'application/json',
|
|
@@ -27152,9 +27152,9 @@
|
|
|
27152
27152
|
});
|
|
27153
27153
|
};
|
|
27154
27154
|
const exportTML = async (data) => {
|
|
27155
|
-
const { thoughtSpotHost, authType } =
|
|
27155
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
27156
27156
|
try {
|
|
27157
|
-
sanity(
|
|
27157
|
+
sanity(window.thoughtSpotConfig);
|
|
27158
27158
|
}
|
|
27159
27159
|
catch (err) {
|
|
27160
27160
|
return Promise.reject(err);
|
|
@@ -27167,7 +27167,7 @@
|
|
|
27167
27167
|
};
|
|
27168
27168
|
let authToken = '';
|
|
27169
27169
|
if (authType === exports.AuthType.TrustedAuthTokenCookieless) {
|
|
27170
|
-
authToken = await getAuthenticaionToken(
|
|
27170
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
27171
27171
|
}
|
|
27172
27172
|
const headers = {
|
|
27173
27173
|
'Content-Type': 'application/json',
|
|
@@ -27407,7 +27407,7 @@
|
|
|
27407
27407
|
});
|
|
27408
27408
|
}
|
|
27409
27409
|
|
|
27410
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.
|
|
27410
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-react.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:"./dist/tsembed.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"}};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":"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",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; npm run build","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":"^40.1.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","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","@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","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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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,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};
|
|
27411
27411
|
|
|
27412
27412
|
/**
|
|
27413
27413
|
* Copyright (c) 2022
|
package/lib/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAMH,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAGnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAMH,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAGnB,MAAM,SAAS,CAAC;AAWjB,MAAM,WAAW,eAAe;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC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;AAEF,eAAO,MAAM,SAAS,SAAgB,cAAc,KAAG,QAAQ,GAAG,CA2CjE,CAAC;AAGF;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
package/lib/src/embed/base.js
CHANGED
|
@@ -14,7 +14,7 @@ import { getThoughtSpotHost } from '../config';
|
|
|
14
14
|
import { AuthType, PrefetchFeatures } from '../types';
|
|
15
15
|
import { authenticate, logout as _logout, AuthFailureType, notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, setAuthEE, EndPoints, getAuthenticaionToken, } from '../auth';
|
|
16
16
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
17
|
-
|
|
17
|
+
window.thoughtSpotConfig = window.thoughtSpotConfig || {};
|
|
18
18
|
const CONFIG_DEFAULTS = {
|
|
19
19
|
loginFailedMessage: 'Not logged in',
|
|
20
20
|
authTriggerText: 'Authorize',
|
|
@@ -28,14 +28,14 @@ export let authPromise;
|
|
|
28
28
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
29
29
|
* @group Global methods
|
|
30
30
|
*/
|
|
31
|
-
export const getEmbedConfig = () =>
|
|
31
|
+
export const getEmbedConfig = () => window.thoughtSpotConfig;
|
|
32
32
|
export const getAuthPromise = () => authPromise;
|
|
33
33
|
export { notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout, };
|
|
34
34
|
/**
|
|
35
35
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
36
36
|
*/
|
|
37
37
|
export const handleAuth = () => {
|
|
38
|
-
authPromise = authenticate(
|
|
38
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
39
39
|
authPromise.then((isLoggedIn) => {
|
|
40
40
|
if (!isLoggedIn) {
|
|
41
41
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
@@ -71,7 +71,7 @@ export const prefetch = (url, prefetchFeatures) => {
|
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
74
|
-
let hostUrl = url ||
|
|
74
|
+
let hostUrl = url || window.thoughtSpotConfig.thoughtSpotHost;
|
|
75
75
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
76
76
|
uniq(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
|
|
77
77
|
const iFrame = document.createElement('iframe');
|
|
@@ -137,26 +137,26 @@ function backwardCompat(embedConfig) {
|
|
|
137
137
|
export const init = (embedConfig) => {
|
|
138
138
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
139
139
|
sanity(embedConfig);
|
|
140
|
-
|
|
140
|
+
window.thoughtSpotConfig = {
|
|
141
141
|
...CONFIG_DEFAULTS,
|
|
142
142
|
...embedConfig,
|
|
143
143
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
144
144
|
};
|
|
145
|
-
|
|
145
|
+
window.thoughtSpotConfig = backwardCompat(window.thoughtSpotConfig);
|
|
146
146
|
const authEE = new EventEmitter();
|
|
147
147
|
setAuthEE(authEE);
|
|
148
148
|
handleAuth();
|
|
149
149
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
150
|
-
authType:
|
|
151
|
-
host:
|
|
150
|
+
authType: window.thoughtSpotConfig.authType,
|
|
151
|
+
host: window.thoughtSpotConfig.thoughtSpotHost,
|
|
152
152
|
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
153
153
|
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
154
154
|
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
155
155
|
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
156
156
|
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
157
157
|
});
|
|
158
|
-
if (
|
|
159
|
-
prefetch(
|
|
158
|
+
if (window.thoughtSpotConfig.callPrefetch) {
|
|
159
|
+
prefetch(window.thoughtSpotConfig.thoughtSpotHost);
|
|
160
160
|
}
|
|
161
161
|
return authEE;
|
|
162
162
|
};
|
|
@@ -164,7 +164,7 @@ export const init = (embedConfig) => {
|
|
|
164
164
|
*
|
|
165
165
|
*/
|
|
166
166
|
export function disableAutoLogin() {
|
|
167
|
-
|
|
167
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
|
|
@@ -182,7 +182,7 @@ export const logout = (doNotDisableAutoLogin = false) => {
|
|
|
182
182
|
if (!doNotDisableAutoLogin) {
|
|
183
183
|
disableAutoLogin();
|
|
184
184
|
}
|
|
185
|
-
return _logout(
|
|
185
|
+
return _logout(window.thoughtSpotConfig).then((isLoggedIn) => {
|
|
186
186
|
notifyLogout();
|
|
187
187
|
return isLoggedIn;
|
|
188
188
|
});
|
|
@@ -195,7 +195,7 @@ let renderQueue = Promise.resolve();
|
|
|
195
195
|
* @param fn The function being registered
|
|
196
196
|
*/
|
|
197
197
|
export const renderInQueue = (fn) => {
|
|
198
|
-
const { queueMultiRenders = false } =
|
|
198
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
199
199
|
if (queueMultiRenders) {
|
|
200
200
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
201
201
|
return renderQueue;
|
|
@@ -204,16 +204,16 @@ export const renderInQueue = (fn) => {
|
|
|
204
204
|
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
205
205
|
};
|
|
206
206
|
export const executeTML = async (data) => {
|
|
207
|
-
const { thoughtSpotHost, authType } =
|
|
207
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
208
208
|
try {
|
|
209
|
-
sanity(
|
|
209
|
+
sanity(window.thoughtSpotConfig);
|
|
210
210
|
}
|
|
211
211
|
catch (err) {
|
|
212
212
|
return Promise.reject(err);
|
|
213
213
|
}
|
|
214
214
|
let authToken = '';
|
|
215
215
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
216
|
-
authToken = await getAuthenticaionToken(
|
|
216
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
217
217
|
}
|
|
218
218
|
const headers = {
|
|
219
219
|
'Content-Type': 'application/json',
|
|
@@ -244,9 +244,9 @@ export const executeTML = async (data) => {
|
|
|
244
244
|
});
|
|
245
245
|
};
|
|
246
246
|
export const exportTML = async (data) => {
|
|
247
|
-
const { thoughtSpotHost, authType } =
|
|
247
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
248
248
|
try {
|
|
249
|
-
sanity(
|
|
249
|
+
sanity(window.thoughtSpotConfig);
|
|
250
250
|
}
|
|
251
251
|
catch (err) {
|
|
252
252
|
return Promise.reject(err);
|
|
@@ -259,7 +259,7 @@ export const exportTML = async (data) => {
|
|
|
259
259
|
};
|
|
260
260
|
let authToken = '';
|
|
261
261
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
262
|
-
authToken = await getAuthenticaionToken(
|
|
262
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
263
263
|
}
|
|
264
264
|
const headers = {
|
|
265
265
|
'Content-Type': 'application/json',
|
|
@@ -289,7 +289,7 @@ export const exportTML = async (data) => {
|
|
|
289
289
|
*
|
|
290
290
|
*/
|
|
291
291
|
export function reset() {
|
|
292
|
-
|
|
292
|
+
window.thoughtSpotConfig = {};
|
|
293
293
|
setAuthEE(null);
|
|
294
294
|
authPromise = null;
|
|
295
295
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAe,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,OAAO,EACjB,eAAe,EAGf,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EAET,SAAS,EACT,qBAAqB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/embed/base.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,8CAA8C;AAC9C;;;;;;;GAOG;AACH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAe,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,OAAO,EACjB,eAAe,EAGf,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EAET,SAAS,EACT,qBAAqB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc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anelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
31
31
|
|
|
32
|
-
let
|
|
32
|
+
declare let window: any;
|
|
33
|
+
(window as any).thoughtSpotConfig = window.thoughtSpotConfig || {} as EmbedConfig;
|
|
33
34
|
const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
|
|
34
35
|
loginFailedMessage: 'Not logged in',
|
|
35
36
|
authTriggerText: 'Authorize',
|
|
@@ -60,7 +61,7 @@ export let authPromise: Promise<boolean>;
|
|
|
60
61
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
61
62
|
* @group Global methods
|
|
62
63
|
*/
|
|
63
|
-
export const getEmbedConfig = (): EmbedConfig =>
|
|
64
|
+
export const getEmbedConfig = (): EmbedConfig => (window as any).thoughtSpotConfig;
|
|
64
65
|
|
|
65
66
|
export const getAuthPromise = (): Promise<boolean> => authPromise;
|
|
66
67
|
|
|
@@ -72,7 +73,7 @@ export {
|
|
|
72
73
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
73
74
|
*/
|
|
74
75
|
export const handleAuth = (): Promise<boolean> => {
|
|
75
|
-
authPromise = authenticate(
|
|
76
|
+
authPromise = authenticate(window.thoughtSpotConfig);
|
|
76
77
|
authPromise.then(
|
|
77
78
|
(isLoggedIn) => {
|
|
78
79
|
if (!isLoggedIn) {
|
|
@@ -111,7 +112,7 @@ export const prefetch = (url?: string, prefetchFeatures?: PrefetchFeatures[]): v
|
|
|
111
112
|
console.warn('The prefetch method does not have a valid URL');
|
|
112
113
|
} else {
|
|
113
114
|
const features = prefetchFeatures || [PrefetchFeatures.FullApp];
|
|
114
|
-
let hostUrl = url ||
|
|
115
|
+
let hostUrl = url || window.thoughtSpotConfig.thoughtSpotHost;
|
|
115
116
|
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
116
117
|
uniq(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach(
|
|
117
118
|
(prefetchUrl, index) => {
|
|
@@ -182,19 +183,19 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
|
|
|
182
183
|
*/
|
|
183
184
|
export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
184
185
|
sanity(embedConfig);
|
|
185
|
-
|
|
186
|
+
window.thoughtSpotConfig = {
|
|
186
187
|
...CONFIG_DEFAULTS,
|
|
187
188
|
...embedConfig,
|
|
188
189
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
+
window.thoughtSpotConfig = backwardCompat(window.thoughtSpotConfig);
|
|
191
192
|
const authEE = new EventEmitter<AuthStatus | AuthEvent>();
|
|
192
193
|
setAuthEE(authEE);
|
|
193
194
|
handleAuth();
|
|
194
195
|
|
|
195
196
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
196
|
-
authType:
|
|
197
|
-
host:
|
|
197
|
+
authType: window.thoughtSpotConfig.authType,
|
|
198
|
+
host: window.thoughtSpotConfig.thoughtSpotHost,
|
|
198
199
|
usedCustomizationSheet: embedConfig.customizations?.style?.customCSSUrl != null,
|
|
199
200
|
usedCustomizationVariables: embedConfig.customizations?.style?.customCSS?.variables != null,
|
|
200
201
|
usedCustomizationRules:
|
|
@@ -203,8 +204,8 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
|
203
204
|
usedCustomizationIconSprite: !!embedConfig.customizations?.iconSpriteUrl,
|
|
204
205
|
});
|
|
205
206
|
|
|
206
|
-
if (
|
|
207
|
-
prefetch(
|
|
207
|
+
if (window.thoughtSpotConfig.callPrefetch) {
|
|
208
|
+
prefetch(window.thoughtSpotConfig.thoughtSpotHost);
|
|
208
209
|
}
|
|
209
210
|
return authEE as AuthEventEmitter;
|
|
210
211
|
};
|
|
@@ -213,7 +214,7 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
|
213
214
|
*
|
|
214
215
|
*/
|
|
215
216
|
export function disableAutoLogin(): void {
|
|
216
|
-
|
|
217
|
+
window.thoughtSpotConfig.autoLogin = false;
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
/**
|
|
@@ -232,7 +233,7 @@ export const logout = (doNotDisableAutoLogin = false): Promise<boolean> => {
|
|
|
232
233
|
if (!doNotDisableAutoLogin) {
|
|
233
234
|
disableAutoLogin();
|
|
234
235
|
}
|
|
235
|
-
return _logout(
|
|
236
|
+
return _logout(window.thoughtSpotConfig).then((isLoggedIn) => {
|
|
236
237
|
notifyLogout();
|
|
237
238
|
return isLoggedIn;
|
|
238
239
|
});
|
|
@@ -247,7 +248,7 @@ let renderQueue: Promise<any> = Promise.resolve();
|
|
|
247
248
|
* @param fn The function being registered
|
|
248
249
|
*/
|
|
249
250
|
export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>): Promise<any> => {
|
|
250
|
-
const { queueMultiRenders = false } =
|
|
251
|
+
const { queueMultiRenders = false } = window.thoughtSpotConfig;
|
|
251
252
|
if (queueMultiRenders) {
|
|
252
253
|
renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
|
|
253
254
|
return renderQueue;
|
|
@@ -257,15 +258,15 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
257
258
|
};
|
|
258
259
|
|
|
259
260
|
export const executeTML = async (data: executeTMLInput): Promise<any> => {
|
|
260
|
-
const { thoughtSpotHost, authType } =
|
|
261
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
261
262
|
try {
|
|
262
|
-
sanity(
|
|
263
|
+
sanity(window.thoughtSpotConfig);
|
|
263
264
|
} catch (err) {
|
|
264
265
|
return Promise.reject(err);
|
|
265
266
|
}
|
|
266
267
|
let authToken = '';
|
|
267
268
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
268
|
-
authToken = await getAuthenticaionToken(
|
|
269
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
const headers: Record<string, string | undefined> = {
|
|
@@ -300,9 +301,9 @@ export const executeTML = async (data: executeTMLInput): Promise<any> => {
|
|
|
300
301
|
};
|
|
301
302
|
|
|
302
303
|
export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
303
|
-
const { thoughtSpotHost, authType } =
|
|
304
|
+
const { thoughtSpotHost, authType } = window.thoughtSpotConfig;
|
|
304
305
|
try {
|
|
305
|
-
sanity(
|
|
306
|
+
sanity(window.thoughtSpotConfig);
|
|
306
307
|
} catch (err) {
|
|
307
308
|
return Promise.reject(err);
|
|
308
309
|
}
|
|
@@ -315,7 +316,7 @@ export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
|
315
316
|
|
|
316
317
|
let authToken = '';
|
|
317
318
|
if (authType === AuthType.TrustedAuthTokenCookieless) {
|
|
318
|
-
authToken = await getAuthenticaionToken(
|
|
319
|
+
authToken = await getAuthenticaionToken(window.thoughtSpotConfig);
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
const headers: Record<string, string | undefined> = {
|
|
@@ -349,7 +350,7 @@ export const exportTML = async (data: exportTMLInput): Promise<any> => {
|
|
|
349
350
|
*
|
|
350
351
|
*/
|
|
351
352
|
export function reset(): void {
|
|
352
|
-
|
|
353
|
+
window.thoughtSpotConfig = {} as any;
|
|
353
354
|
setAuthEE(null);
|
|
354
355
|
authPromise = null;
|
|
355
356
|
}
|