@thoughtspot/visual-embed-sdk 1.19.0-alpha.2 → 1.19.0-alpha.4
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/dist/src/auth.d.ts +21 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +2 -5
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +6 -0
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -0
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +3 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +1 -1
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +1 -1
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/types.d.ts +19 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed.es.js +114 -68
- package/dist/tsembed.js +112 -67
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +21 -1
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +66 -12
- package/lib/src/auth.js.map +1 -1
- package/lib/src/embed/base.d.ts +2 -5
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +8 -36
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +0 -9
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +6 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +23 -5
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +15 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +3 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +18 -15
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +20 -4
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +8 -4
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +3 -3
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/react/util.d.ts +1 -1
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/test/test-utils.d.ts +1 -1
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/types.d.ts +19 -8
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +7 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils.d.ts +1 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +11 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +44 -9
- package/package.json +1 -1
- package/src/auth.ts +78 -19
- package/src/embed/base.spec.ts +0 -10
- package/src/embed/base.ts +18 -37
- package/src/embed/search.ts +6 -0
- package/src/embed/ts-embed.spec.ts +15 -0
- package/src/embed/ts-embed.ts +22 -5
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +26 -5
- package/src/mixpanel-service.ts +19 -20
- package/src/react/index.spec.tsx +3 -7
- package/src/react/index.tsx +16 -6
- package/src/types.ts +11 -0
- package/src/utils.ts +13 -0
package/dist/tsembed.es.js
CHANGED
|
@@ -953,6 +953,13 @@ var HostEvent;
|
|
|
953
953
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
954
954
|
*/
|
|
955
955
|
HostEvent["ManagePipelines"] = "manage-pipeline";
|
|
956
|
+
/**
|
|
957
|
+
* Triggers the Reset search in answer
|
|
958
|
+
* @example
|
|
959
|
+
* searchEmbed.trigger(HostEvent.SearchReset
|
|
960
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.2.0.cl, 9.0.1-sw
|
|
961
|
+
*/
|
|
962
|
+
HostEvent["ResetSearch"] = "resetSearch";
|
|
956
963
|
})(HostEvent || (HostEvent = {}));
|
|
957
964
|
/**
|
|
958
965
|
* The different visual modes that the data sources panel within
|
|
@@ -7242,32 +7249,31 @@ const MIXPANEL_EVENT = {
|
|
|
7242
7249
|
VISUAL_SDK_RENDER_COMPLETE: 'visual-sdk-render-complete',
|
|
7243
7250
|
VISUAL_SDK_RENDER_FAILED: 'visual-sdk-render-failed',
|
|
7244
7251
|
VISUAL_SDK_TRIGGER: 'visual-sdk-trigger',
|
|
7252
|
+
VISUAL_SDK_ON: 'visual-sdk-on',
|
|
7245
7253
|
VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
|
|
7246
7254
|
};
|
|
7247
|
-
let
|
|
7248
|
-
|
|
7249
|
-
function setEventCollectorOn() {
|
|
7250
|
-
isEventCollectorOn = true;
|
|
7251
|
-
}
|
|
7252
|
-
function getEventCollectorOnValue() {
|
|
7253
|
-
return isEventCollectorOn;
|
|
7254
|
-
}
|
|
7255
|
+
let isMixpanelInitialized = false;
|
|
7256
|
+
let eventQueue = [];
|
|
7255
7257
|
/**
|
|
7256
7258
|
* Pushes the event with its Property key-value map to mixpanel.
|
|
7257
7259
|
* @param eventId
|
|
7258
7260
|
* @param eventProps
|
|
7259
7261
|
*/
|
|
7260
|
-
|
|
7261
|
-
if (!
|
|
7262
|
-
|
|
7263
|
-
return
|
|
7262
|
+
function uploadMixpanelEvent(eventId, eventProps = {}) {
|
|
7263
|
+
if (!isMixpanelInitialized) {
|
|
7264
|
+
eventQueue.push({ eventId, eventProps });
|
|
7265
|
+
return;
|
|
7264
7266
|
}
|
|
7265
|
-
|
|
7267
|
+
mixpanel_cjs.track(eventId, eventProps);
|
|
7266
7268
|
}
|
|
7267
7269
|
function emptyQueue() {
|
|
7268
|
-
|
|
7270
|
+
if (!isMixpanelInitialized) {
|
|
7271
|
+
return;
|
|
7272
|
+
}
|
|
7273
|
+
eventQueue.forEach((event) => {
|
|
7269
7274
|
uploadMixpanelEvent(event.eventId, event.eventProps);
|
|
7270
7275
|
});
|
|
7276
|
+
eventQueue = [];
|
|
7271
7277
|
}
|
|
7272
7278
|
function initMixpanel(sessionInfo) {
|
|
7273
7279
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
@@ -7281,7 +7287,7 @@ function initMixpanel(sessionInfo) {
|
|
|
7281
7287
|
if (!isPublicCluster) {
|
|
7282
7288
|
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7283
7289
|
}
|
|
7284
|
-
|
|
7290
|
+
isMixpanelInitialized = true;
|
|
7285
7291
|
emptyQueue();
|
|
7286
7292
|
}
|
|
7287
7293
|
}
|
|
@@ -8852,7 +8858,53 @@ var AuthStatus;
|
|
|
8852
8858
|
* Emits when a user logs out
|
|
8853
8859
|
*/
|
|
8854
8860
|
AuthStatus["LOGOUT"] = "LOGOUT";
|
|
8861
|
+
/**
|
|
8862
|
+
* Emitted when inPopup: true in the SAMLRedirect flow.
|
|
8863
|
+
* And, we are waiting for popup to be triggered either programatically
|
|
8864
|
+
* or by the trigger button.
|
|
8865
|
+
* @version SDK: 1.19.0
|
|
8866
|
+
*/
|
|
8867
|
+
AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
|
|
8855
8868
|
})(AuthStatus || (AuthStatus = {}));
|
|
8869
|
+
var AuthEvent;
|
|
8870
|
+
(function (AuthEvent) {
|
|
8871
|
+
/**
|
|
8872
|
+
* Manually trigger the SSO popup.
|
|
8873
|
+
*/
|
|
8874
|
+
AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
|
|
8875
|
+
})(AuthEvent || (AuthEvent = {}));
|
|
8876
|
+
let authEE;
|
|
8877
|
+
function setAuthEE(eventEmitter) {
|
|
8878
|
+
authEE = eventEmitter;
|
|
8879
|
+
}
|
|
8880
|
+
function notifyAuthSDKSuccess() {
|
|
8881
|
+
if (!authEE) {
|
|
8882
|
+
console.error('SDK not initialized');
|
|
8883
|
+
return;
|
|
8884
|
+
}
|
|
8885
|
+
authEE.emit(AuthStatus.SDK_SUCCESS);
|
|
8886
|
+
}
|
|
8887
|
+
function notifyAuthSuccess() {
|
|
8888
|
+
if (!authEE) {
|
|
8889
|
+
console.error('SDK not initialized');
|
|
8890
|
+
return;
|
|
8891
|
+
}
|
|
8892
|
+
authEE.emit(AuthStatus.SUCCESS);
|
|
8893
|
+
}
|
|
8894
|
+
function notifyAuthFailure(failureType) {
|
|
8895
|
+
if (!authEE) {
|
|
8896
|
+
console.error('SDK not initialized');
|
|
8897
|
+
return;
|
|
8898
|
+
}
|
|
8899
|
+
authEE.emit(AuthStatus.FAILURE, failureType);
|
|
8900
|
+
}
|
|
8901
|
+
function notifyLogout() {
|
|
8902
|
+
if (!authEE) {
|
|
8903
|
+
console.error('SDK not initialized');
|
|
8904
|
+
return;
|
|
8905
|
+
}
|
|
8906
|
+
authEE.emit(AuthStatus.LOGOUT);
|
|
8907
|
+
}
|
|
8856
8908
|
/**
|
|
8857
8909
|
* Check if we are logged into the ThoughtSpot cluster
|
|
8858
8910
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
@@ -8968,11 +9020,23 @@ const doBasicAuth = async (embedConfig) => {
|
|
|
8968
9020
|
return loggedInStatus;
|
|
8969
9021
|
};
|
|
8970
9022
|
async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
9023
|
+
const openPopup = () => {
|
|
9024
|
+
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
9025
|
+
samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
|
|
9026
|
+
}
|
|
9027
|
+
else {
|
|
9028
|
+
samlAuthWindow.focus();
|
|
9029
|
+
}
|
|
9030
|
+
};
|
|
9031
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
|
|
8971
9032
|
const containerEl = getDOMNode(triggerContainer);
|
|
8972
|
-
containerEl
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
9033
|
+
if (containerEl) {
|
|
9034
|
+
containerEl.innerHTML =
|
|
9035
|
+
'<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9036
|
+
const authElem = document.getElementById('ts-auth-btn');
|
|
9037
|
+
authElem.textContent = triggerText;
|
|
9038
|
+
authElem.addEventListener('click', openPopup, { once: true });
|
|
9039
|
+
}
|
|
8976
9040
|
samlCompletionPromise =
|
|
8977
9041
|
samlCompletionPromise ||
|
|
8978
9042
|
new Promise((resolve, reject) => {
|
|
@@ -8983,14 +9047,7 @@ async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
|
8983
9047
|
}
|
|
8984
9048
|
});
|
|
8985
9049
|
});
|
|
8986
|
-
|
|
8987
|
-
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
8988
|
-
samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
|
|
8989
|
-
}
|
|
8990
|
-
else {
|
|
8991
|
-
samlAuthWindow.focus();
|
|
8992
|
-
}
|
|
8993
|
-
}, { once: true });
|
|
9050
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
|
|
8994
9051
|
return samlCompletionPromise;
|
|
8995
9052
|
}
|
|
8996
9053
|
/**
|
|
@@ -9086,35 +9143,6 @@ const CONFIG_DEFAULTS = {
|
|
|
9086
9143
|
let authPromise;
|
|
9087
9144
|
const getEmbedConfig = () => config;
|
|
9088
9145
|
const getAuthPromise = () => authPromise;
|
|
9089
|
-
let authEE;
|
|
9090
|
-
function notifyAuthSDKSuccess() {
|
|
9091
|
-
if (!authEE) {
|
|
9092
|
-
console.error('SDK not initialized');
|
|
9093
|
-
return;
|
|
9094
|
-
}
|
|
9095
|
-
authEE.emit(AuthStatus.SDK_SUCCESS);
|
|
9096
|
-
}
|
|
9097
|
-
function notifyAuthSuccess() {
|
|
9098
|
-
if (!authEE) {
|
|
9099
|
-
console.error('SDK not initialized');
|
|
9100
|
-
return;
|
|
9101
|
-
}
|
|
9102
|
-
authEE.emit(AuthStatus.SUCCESS);
|
|
9103
|
-
}
|
|
9104
|
-
function notifyAuthFailure(failureType) {
|
|
9105
|
-
if (!authEE) {
|
|
9106
|
-
console.error('SDK not initialized');
|
|
9107
|
-
return;
|
|
9108
|
-
}
|
|
9109
|
-
authEE.emit(AuthStatus.FAILURE, failureType);
|
|
9110
|
-
}
|
|
9111
|
-
function notifyLogout() {
|
|
9112
|
-
if (!authEE) {
|
|
9113
|
-
console.error('SDK not initialized');
|
|
9114
|
-
return;
|
|
9115
|
-
}
|
|
9116
|
-
authEE.emit(AuthStatus.LOGOUT);
|
|
9117
|
-
}
|
|
9118
9146
|
/**
|
|
9119
9147
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
9120
9148
|
*/
|
|
@@ -9178,9 +9206,6 @@ function sanity(embedConfig) {
|
|
|
9178
9206
|
throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
|
|
9179
9207
|
}
|
|
9180
9208
|
}
|
|
9181
|
-
if (embedConfig.noRedirect && !embedConfig.authTriggerContainer) {
|
|
9182
|
-
throw new Error('authTriggerContainer not provided with noRedirect');
|
|
9183
|
-
}
|
|
9184
9209
|
}
|
|
9185
9210
|
/**
|
|
9186
9211
|
* Initializes the Visual Embed SDK globally and perform
|
|
@@ -9193,14 +9218,15 @@ function sanity(embedConfig) {
|
|
|
9193
9218
|
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
9194
9219
|
*/
|
|
9195
9220
|
const init = (embedConfig) => {
|
|
9196
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9197
9222
|
sanity(embedConfig);
|
|
9198
9223
|
config = {
|
|
9199
9224
|
...CONFIG_DEFAULTS,
|
|
9200
9225
|
...embedConfig,
|
|
9201
9226
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
9202
9227
|
};
|
|
9203
|
-
authEE = new eventemitter3();
|
|
9228
|
+
const authEE = new eventemitter3();
|
|
9229
|
+
setAuthEE(authEE);
|
|
9204
9230
|
handleAuth();
|
|
9205
9231
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
9206
9232
|
authType: config.authType,
|
|
@@ -9209,6 +9235,8 @@ const init = (embedConfig) => {
|
|
|
9209
9235
|
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,
|
|
9210
9236
|
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) !=
|
|
9211
9237
|
null,
|
|
9238
|
+
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
9239
|
+
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
9212
9240
|
});
|
|
9213
9241
|
if (config.callPrefetch) {
|
|
9214
9242
|
prefetch(config.thoughtSpotHost);
|
|
@@ -9427,7 +9455,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
9427
9455
|
});
|
|
9428
9456
|
}
|
|
9429
9457
|
|
|
9430
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.19.0-alpha.
|
|
9458
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.19.0-alpha.4";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/**"];var exports={".":"./lib/src/index.js","./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.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 @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",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 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",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","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","@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":"4.1.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":"^4.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-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",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};
|
|
9431
9459
|
|
|
9432
9460
|
/**
|
|
9433
9461
|
* Copyright (c) 2022
|
|
@@ -9691,7 +9719,7 @@ class TsEmbed {
|
|
|
9691
9719
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9692
9720
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
9693
9721
|
if (!isLoggedIn) {
|
|
9694
|
-
this.
|
|
9722
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9695
9723
|
return;
|
|
9696
9724
|
}
|
|
9697
9725
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
@@ -9734,8 +9762,7 @@ class TsEmbed {
|
|
|
9734
9762
|
this.iFrame.addEventListener('error', () => {
|
|
9735
9763
|
nextInQueue();
|
|
9736
9764
|
});
|
|
9737
|
-
this.
|
|
9738
|
-
this.el.appendChild(this.iFrame);
|
|
9765
|
+
this.insertIntoDOM(this.iFrame);
|
|
9739
9766
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
9740
9767
|
if (prefetchIframe.length) {
|
|
9741
9768
|
prefetchIframe.forEach((el) => {
|
|
@@ -9745,12 +9772,30 @@ class TsEmbed {
|
|
|
9745
9772
|
this.subscribeToEvents();
|
|
9746
9773
|
}).catch((error) => {
|
|
9747
9774
|
nextInQueue();
|
|
9748
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED);
|
|
9749
|
-
this.
|
|
9775
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, { error: JSON.stringify(error) });
|
|
9776
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9750
9777
|
this.handleError(error);
|
|
9751
9778
|
});
|
|
9752
9779
|
});
|
|
9753
9780
|
}
|
|
9781
|
+
insertIntoDOM(child) {
|
|
9782
|
+
if (this.viewConfig.insertAsSibling) {
|
|
9783
|
+
if (typeof child === 'string') {
|
|
9784
|
+
const div = document.createElement('div');
|
|
9785
|
+
div.innerHTML = child;
|
|
9786
|
+
// eslint-disable-next-line no-param-reassign
|
|
9787
|
+
child = div;
|
|
9788
|
+
}
|
|
9789
|
+
this.el.parentElement.insertBefore(child, this.el.nextSibling);
|
|
9790
|
+
}
|
|
9791
|
+
else if (typeof child === 'string') {
|
|
9792
|
+
this.el.innerHTML = child;
|
|
9793
|
+
}
|
|
9794
|
+
else {
|
|
9795
|
+
this.el.innerHTML = '';
|
|
9796
|
+
this.el.appendChild(child);
|
|
9797
|
+
}
|
|
9798
|
+
}
|
|
9754
9799
|
/**
|
|
9755
9800
|
* Sets the height of the iframe
|
|
9756
9801
|
* @param height The height in pixels
|
|
@@ -9936,6 +9981,7 @@ class V1Embed extends TsEmbed {
|
|
|
9936
9981
|
// @override
|
|
9937
9982
|
on(messageType, callback, options = { start: false }) {
|
|
9938
9983
|
const eventType = this.getCompatibleEventType(messageType);
|
|
9984
|
+
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
9939
9985
|
return super.on(eventType, callback, options);
|
|
9940
9986
|
}
|
|
9941
9987
|
}
|
|
@@ -10410,4 +10456,4 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
10410
10456
|
}
|
|
10411
10457
|
}
|
|
10412
10458
|
|
|
10413
|
-
export { Action, AppEmbed, AuthFailureType, AuthStatus, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SearchBarEmbed, SearchEmbed, init, logout$1 as logout, prefetch };
|
|
10459
|
+
export { Action, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SearchBarEmbed, SearchEmbed, init, logout$1 as logout, prefetch };
|
package/dist/tsembed.js
CHANGED
|
@@ -934,6 +934,13 @@
|
|
|
934
934
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
935
935
|
*/
|
|
936
936
|
HostEvent["ManagePipelines"] = "manage-pipeline";
|
|
937
|
+
/**
|
|
938
|
+
* Triggers the Reset search in answer
|
|
939
|
+
* @example
|
|
940
|
+
* searchEmbed.trigger(HostEvent.SearchReset
|
|
941
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.2.0.cl, 9.0.1-sw
|
|
942
|
+
*/
|
|
943
|
+
HostEvent["ResetSearch"] = "resetSearch";
|
|
937
944
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
938
945
|
(function (DataSourceVisualMode) {
|
|
939
946
|
/**
|
|
@@ -7210,32 +7217,31 @@
|
|
|
7210
7217
|
VISUAL_SDK_RENDER_COMPLETE: 'visual-sdk-render-complete',
|
|
7211
7218
|
VISUAL_SDK_RENDER_FAILED: 'visual-sdk-render-failed',
|
|
7212
7219
|
VISUAL_SDK_TRIGGER: 'visual-sdk-trigger',
|
|
7220
|
+
VISUAL_SDK_ON: 'visual-sdk-on',
|
|
7213
7221
|
VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
|
|
7214
7222
|
};
|
|
7215
|
-
let
|
|
7216
|
-
|
|
7217
|
-
function setEventCollectorOn() {
|
|
7218
|
-
isEventCollectorOn = true;
|
|
7219
|
-
}
|
|
7220
|
-
function getEventCollectorOnValue() {
|
|
7221
|
-
return isEventCollectorOn;
|
|
7222
|
-
}
|
|
7223
|
+
let isMixpanelInitialized = false;
|
|
7224
|
+
let eventQueue = [];
|
|
7223
7225
|
/**
|
|
7224
7226
|
* Pushes the event with its Property key-value map to mixpanel.
|
|
7225
7227
|
* @param eventId
|
|
7226
7228
|
* @param eventProps
|
|
7227
7229
|
*/
|
|
7228
|
-
|
|
7229
|
-
if (!
|
|
7230
|
-
|
|
7231
|
-
return
|
|
7230
|
+
function uploadMixpanelEvent(eventId, eventProps = {}) {
|
|
7231
|
+
if (!isMixpanelInitialized) {
|
|
7232
|
+
eventQueue.push({ eventId, eventProps });
|
|
7233
|
+
return;
|
|
7232
7234
|
}
|
|
7233
|
-
|
|
7235
|
+
mixpanel_cjs.track(eventId, eventProps);
|
|
7234
7236
|
}
|
|
7235
7237
|
function emptyQueue() {
|
|
7236
|
-
|
|
7238
|
+
if (!isMixpanelInitialized) {
|
|
7239
|
+
return;
|
|
7240
|
+
}
|
|
7241
|
+
eventQueue.forEach((event) => {
|
|
7237
7242
|
uploadMixpanelEvent(event.eventId, event.eventProps);
|
|
7238
7243
|
});
|
|
7244
|
+
eventQueue = [];
|
|
7239
7245
|
}
|
|
7240
7246
|
function initMixpanel(sessionInfo) {
|
|
7241
7247
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
@@ -7249,7 +7255,7 @@
|
|
|
7249
7255
|
if (!isPublicCluster) {
|
|
7250
7256
|
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7251
7257
|
}
|
|
7252
|
-
|
|
7258
|
+
isMixpanelInitialized = true;
|
|
7253
7259
|
emptyQueue();
|
|
7254
7260
|
}
|
|
7255
7261
|
}
|
|
@@ -8818,7 +8824,52 @@
|
|
|
8818
8824
|
* Emits when a user logs out
|
|
8819
8825
|
*/
|
|
8820
8826
|
AuthStatus["LOGOUT"] = "LOGOUT";
|
|
8827
|
+
/**
|
|
8828
|
+
* Emitted when inPopup: true in the SAMLRedirect flow.
|
|
8829
|
+
* And, we are waiting for popup to be triggered either programatically
|
|
8830
|
+
* or by the trigger button.
|
|
8831
|
+
* @version SDK: 1.19.0
|
|
8832
|
+
*/
|
|
8833
|
+
AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
|
|
8821
8834
|
})(exports.AuthStatus || (exports.AuthStatus = {}));
|
|
8835
|
+
(function (AuthEvent) {
|
|
8836
|
+
/**
|
|
8837
|
+
* Manually trigger the SSO popup.
|
|
8838
|
+
*/
|
|
8839
|
+
AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
|
|
8840
|
+
})(exports.AuthEvent || (exports.AuthEvent = {}));
|
|
8841
|
+
let authEE;
|
|
8842
|
+
function setAuthEE(eventEmitter) {
|
|
8843
|
+
authEE = eventEmitter;
|
|
8844
|
+
}
|
|
8845
|
+
function notifyAuthSDKSuccess() {
|
|
8846
|
+
if (!authEE) {
|
|
8847
|
+
console.error('SDK not initialized');
|
|
8848
|
+
return;
|
|
8849
|
+
}
|
|
8850
|
+
authEE.emit(exports.AuthStatus.SDK_SUCCESS);
|
|
8851
|
+
}
|
|
8852
|
+
function notifyAuthSuccess() {
|
|
8853
|
+
if (!authEE) {
|
|
8854
|
+
console.error('SDK not initialized');
|
|
8855
|
+
return;
|
|
8856
|
+
}
|
|
8857
|
+
authEE.emit(exports.AuthStatus.SUCCESS);
|
|
8858
|
+
}
|
|
8859
|
+
function notifyAuthFailure(failureType) {
|
|
8860
|
+
if (!authEE) {
|
|
8861
|
+
console.error('SDK not initialized');
|
|
8862
|
+
return;
|
|
8863
|
+
}
|
|
8864
|
+
authEE.emit(exports.AuthStatus.FAILURE, failureType);
|
|
8865
|
+
}
|
|
8866
|
+
function notifyLogout() {
|
|
8867
|
+
if (!authEE) {
|
|
8868
|
+
console.error('SDK not initialized');
|
|
8869
|
+
return;
|
|
8870
|
+
}
|
|
8871
|
+
authEE.emit(exports.AuthStatus.LOGOUT);
|
|
8872
|
+
}
|
|
8822
8873
|
/**
|
|
8823
8874
|
* Check if we are logged into the ThoughtSpot cluster
|
|
8824
8875
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
@@ -8934,11 +8985,23 @@
|
|
|
8934
8985
|
return loggedInStatus;
|
|
8935
8986
|
};
|
|
8936
8987
|
async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
|
|
8988
|
+
const openPopup = () => {
|
|
8989
|
+
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
8990
|
+
samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
|
|
8991
|
+
}
|
|
8992
|
+
else {
|
|
8993
|
+
samlAuthWindow.focus();
|
|
8994
|
+
}
|
|
8995
|
+
};
|
|
8996
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.emit(exports.AuthStatus.WAITING_FOR_POPUP);
|
|
8937
8997
|
const containerEl = getDOMNode(triggerContainer);
|
|
8938
|
-
containerEl
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8998
|
+
if (containerEl) {
|
|
8999
|
+
containerEl.innerHTML =
|
|
9000
|
+
'<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
9001
|
+
const authElem = document.getElementById('ts-auth-btn');
|
|
9002
|
+
authElem.textContent = triggerText;
|
|
9003
|
+
authElem.addEventListener('click', openPopup, { once: true });
|
|
9004
|
+
}
|
|
8942
9005
|
samlCompletionPromise =
|
|
8943
9006
|
samlCompletionPromise ||
|
|
8944
9007
|
new Promise((resolve, reject) => {
|
|
@@ -8949,14 +9012,7 @@
|
|
|
8949
9012
|
}
|
|
8950
9013
|
});
|
|
8951
9014
|
});
|
|
8952
|
-
|
|
8953
|
-
if (samlAuthWindow === null || samlAuthWindow.closed) {
|
|
8954
|
-
samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
|
|
8955
|
-
}
|
|
8956
|
-
else {
|
|
8957
|
-
samlAuthWindow.focus();
|
|
8958
|
-
}
|
|
8959
|
-
}, { once: true });
|
|
9015
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.once(exports.AuthEvent.TRIGGER_SSO_POPUP, openPopup);
|
|
8960
9016
|
return samlCompletionPromise;
|
|
8961
9017
|
}
|
|
8962
9018
|
/**
|
|
@@ -9052,35 +9108,6 @@
|
|
|
9052
9108
|
let authPromise;
|
|
9053
9109
|
const getEmbedConfig = () => config;
|
|
9054
9110
|
const getAuthPromise = () => authPromise;
|
|
9055
|
-
let authEE;
|
|
9056
|
-
function notifyAuthSDKSuccess() {
|
|
9057
|
-
if (!authEE) {
|
|
9058
|
-
console.error('SDK not initialized');
|
|
9059
|
-
return;
|
|
9060
|
-
}
|
|
9061
|
-
authEE.emit(exports.AuthStatus.SDK_SUCCESS);
|
|
9062
|
-
}
|
|
9063
|
-
function notifyAuthSuccess() {
|
|
9064
|
-
if (!authEE) {
|
|
9065
|
-
console.error('SDK not initialized');
|
|
9066
|
-
return;
|
|
9067
|
-
}
|
|
9068
|
-
authEE.emit(exports.AuthStatus.SUCCESS);
|
|
9069
|
-
}
|
|
9070
|
-
function notifyAuthFailure(failureType) {
|
|
9071
|
-
if (!authEE) {
|
|
9072
|
-
console.error('SDK not initialized');
|
|
9073
|
-
return;
|
|
9074
|
-
}
|
|
9075
|
-
authEE.emit(exports.AuthStatus.FAILURE, failureType);
|
|
9076
|
-
}
|
|
9077
|
-
function notifyLogout() {
|
|
9078
|
-
if (!authEE) {
|
|
9079
|
-
console.error('SDK not initialized');
|
|
9080
|
-
return;
|
|
9081
|
-
}
|
|
9082
|
-
authEE.emit(exports.AuthStatus.LOGOUT);
|
|
9083
|
-
}
|
|
9084
9111
|
/**
|
|
9085
9112
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
9086
9113
|
*/
|
|
@@ -9144,9 +9171,6 @@
|
|
|
9144
9171
|
throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
|
|
9145
9172
|
}
|
|
9146
9173
|
}
|
|
9147
|
-
if (embedConfig.noRedirect && !embedConfig.authTriggerContainer) {
|
|
9148
|
-
throw new Error('authTriggerContainer not provided with noRedirect');
|
|
9149
|
-
}
|
|
9150
9174
|
}
|
|
9151
9175
|
/**
|
|
9152
9176
|
* Initializes the Visual Embed SDK globally and perform
|
|
@@ -9159,14 +9183,15 @@
|
|
|
9159
9183
|
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
9160
9184
|
*/
|
|
9161
9185
|
const init = (embedConfig) => {
|
|
9162
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9163
9187
|
sanity(embedConfig);
|
|
9164
9188
|
config = {
|
|
9165
9189
|
...CONFIG_DEFAULTS,
|
|
9166
9190
|
...embedConfig,
|
|
9167
9191
|
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
9168
9192
|
};
|
|
9169
|
-
authEE = new eventemitter3();
|
|
9193
|
+
const authEE = new eventemitter3();
|
|
9194
|
+
setAuthEE(authEE);
|
|
9170
9195
|
handleAuth();
|
|
9171
9196
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
9172
9197
|
authType: config.authType,
|
|
@@ -9175,6 +9200,8 @@
|
|
|
9175
9200
|
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,
|
|
9176
9201
|
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) !=
|
|
9177
9202
|
null,
|
|
9203
|
+
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
9204
|
+
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
9178
9205
|
});
|
|
9179
9206
|
if (config.callPrefetch) {
|
|
9180
9207
|
prefetch(config.thoughtSpotHost);
|
|
@@ -9393,7 +9420,7 @@
|
|
|
9393
9420
|
});
|
|
9394
9421
|
}
|
|
9395
9422
|
|
|
9396
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.19.0-alpha.
|
|
9423
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.19.0-alpha.4";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/**"];var exports$1={".":"./lib/src/index.js","./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.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 @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",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 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",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","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","@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":"4.1.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":"^4.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-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",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};
|
|
9397
9424
|
|
|
9398
9425
|
/**
|
|
9399
9426
|
* Copyright (c) 2022
|
|
@@ -9657,7 +9684,7 @@
|
|
|
9657
9684
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9658
9685
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
9659
9686
|
if (!isLoggedIn) {
|
|
9660
|
-
this.
|
|
9687
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9661
9688
|
return;
|
|
9662
9689
|
}
|
|
9663
9690
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
@@ -9700,8 +9727,7 @@
|
|
|
9700
9727
|
this.iFrame.addEventListener('error', () => {
|
|
9701
9728
|
nextInQueue();
|
|
9702
9729
|
});
|
|
9703
|
-
this.
|
|
9704
|
-
this.el.appendChild(this.iFrame);
|
|
9730
|
+
this.insertIntoDOM(this.iFrame);
|
|
9705
9731
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
9706
9732
|
if (prefetchIframe.length) {
|
|
9707
9733
|
prefetchIframe.forEach((el) => {
|
|
@@ -9711,12 +9737,30 @@
|
|
|
9711
9737
|
this.subscribeToEvents();
|
|
9712
9738
|
}).catch((error) => {
|
|
9713
9739
|
nextInQueue();
|
|
9714
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED);
|
|
9715
|
-
this.
|
|
9740
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, { error: JSON.stringify(error) });
|
|
9741
|
+
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
9716
9742
|
this.handleError(error);
|
|
9717
9743
|
});
|
|
9718
9744
|
});
|
|
9719
9745
|
}
|
|
9746
|
+
insertIntoDOM(child) {
|
|
9747
|
+
if (this.viewConfig.insertAsSibling) {
|
|
9748
|
+
if (typeof child === 'string') {
|
|
9749
|
+
const div = document.createElement('div');
|
|
9750
|
+
div.innerHTML = child;
|
|
9751
|
+
// eslint-disable-next-line no-param-reassign
|
|
9752
|
+
child = div;
|
|
9753
|
+
}
|
|
9754
|
+
this.el.parentElement.insertBefore(child, this.el.nextSibling);
|
|
9755
|
+
}
|
|
9756
|
+
else if (typeof child === 'string') {
|
|
9757
|
+
this.el.innerHTML = child;
|
|
9758
|
+
}
|
|
9759
|
+
else {
|
|
9760
|
+
this.el.innerHTML = '';
|
|
9761
|
+
this.el.appendChild(child);
|
|
9762
|
+
}
|
|
9763
|
+
}
|
|
9720
9764
|
/**
|
|
9721
9765
|
* Sets the height of the iframe
|
|
9722
9766
|
* @param height The height in pixels
|
|
@@ -9902,6 +9946,7 @@
|
|
|
9902
9946
|
// @override
|
|
9903
9947
|
on(messageType, callback, options = { start: false }) {
|
|
9904
9948
|
const eventType = this.getCompatibleEventType(messageType);
|
|
9949
|
+
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
9905
9950
|
return super.on(eventType, callback, options);
|
|
9906
9951
|
}
|
|
9907
9952
|
}
|