@thoughtspot/visual-embed-sdk 1.36.3 → 1.36.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/cjs/package.json +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +4 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +27 -1
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +1 -1
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +2 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -5
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +11 -11
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -1
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +1 -1
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +4 -3
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +25 -16
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +71 -5
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +1 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +1 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +16 -0
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +25 -2
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/cjs/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/cjs/src/utils/with-resolvers-polyfill.js +12 -0
- package/cjs/src/utils/with-resolvers-polyfill.js.map +1 -0
- package/cjs/src/utils.d.ts +17 -2
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +27 -3
- package/cjs/src/utils.js.map +1 -1
- package/dist/{index-BJx3m5_V.js → index-NZYq1Tu3.js} +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +4 -0
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +2 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -3
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +16 -0
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/dist/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/dist/src/utils.d.ts +17 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +349 -45
- package/dist/tsembed-react.js +347 -42
- package/dist/tsembed.es.js +85 -32
- package/dist/tsembed.js +84 -31
- package/dist/visual-embed-sdk-react-full.d.ts +1233 -1214
- package/dist/visual-embed-sdk-react.d.ts +668 -649
- package/dist/visual-embed-sdk.d.ts +9 -4
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +4 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +24 -1
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +1 -1
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +2 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -5
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +11 -11
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -1
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +1 -1
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -3
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +26 -17
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +71 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/index.d.ts +16 -0
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +23 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/lib/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/lib/src/utils/with-resolvers-polyfill.js +12 -0
- package/lib/src/utils/with-resolvers-polyfill.js.map +1 -0
- package/lib/src/utils.d.ts +17 -2
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +25 -2
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +10 -5
- package/package.json +1 -1
- package/src/embed/app.ts +2 -1
- package/src/embed/base.ts +41 -1
- package/src/embed/bodyless-conversation.ts +2 -1
- package/src/embed/conversation.ts +2 -1
- package/src/embed/embedConfig.ts +1 -1
- package/src/embed/liveboard.spec.ts +11 -11
- package/src/embed/liveboard.ts +5 -6
- package/src/embed/sage.ts +1 -2
- package/src/embed/search-bar.tsx +1 -2
- package/src/embed/search.ts +1 -2
- package/src/embed/ts-embed.spec.ts +83 -5
- package/src/embed/ts-embed.ts +33 -17
- package/src/errors.ts +1 -0
- package/src/react/all-types-export.ts +1 -0
- package/src/react/index.tsx +27 -2
- package/src/utils/with-resolvers-polyfill.ts +11 -0
- package/src/utils.ts +35 -4
package/dist/tsembed.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.36.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.36.4 */
|
|
2
2
|
function _mergeNamespaces(n, m) {
|
|
3
3
|
m.forEach(function (e) {
|
|
4
4
|
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
@@ -346,13 +346,23 @@ const sdkWindowKey = '_tsEmbedSDK';
|
|
|
346
346
|
* Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
|
|
347
347
|
* @param key - The key under which the value will be stored.
|
|
348
348
|
* @param value - The value to store.
|
|
349
|
+
* @param options - Additional options.
|
|
350
|
+
* @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
|
|
351
|
+
*
|
|
352
|
+
* @returns The stored value.
|
|
353
|
+
*
|
|
354
|
+
* @version SDK: 1.36.2 | ThoughtSpot: *
|
|
349
355
|
*/
|
|
350
|
-
|
|
356
|
+
function storeValueInWindow(key, value, options = {}) {
|
|
351
357
|
if (!window[sdkWindowKey]) {
|
|
352
358
|
window[sdkWindowKey] = {};
|
|
353
359
|
}
|
|
360
|
+
if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
|
|
361
|
+
return window[sdkWindowKey][key];
|
|
362
|
+
}
|
|
354
363
|
window[sdkWindowKey][key] = value;
|
|
355
|
-
|
|
364
|
+
return value;
|
|
365
|
+
}
|
|
356
366
|
/**
|
|
357
367
|
* Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
|
|
358
368
|
* @param key - The key whose value needs to be retrieved.
|
|
@@ -6521,6 +6531,7 @@ const ERROR_MESSAGE = {
|
|
|
6521
6531
|
CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
|
|
6522
6532
|
CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
|
|
6523
6533
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6534
|
+
RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
|
|
6524
6535
|
};
|
|
6525
6536
|
|
|
6526
6537
|
const EndPoints = {
|
|
@@ -7345,7 +7356,7 @@ class AnswerService {
|
|
|
7345
7356
|
async getTML() {
|
|
7346
7357
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
7347
7358
|
const edoc = object[0].edoc;
|
|
7348
|
-
const YAML = await import('./index-
|
|
7359
|
+
const YAML = await import('./index-NZYq1Tu3.js');
|
|
7349
7360
|
const parsedDoc = YAML.parse(edoc);
|
|
7350
7361
|
return {
|
|
7351
7362
|
answer: {
|
|
@@ -14745,6 +14756,18 @@ const authenticate = async (embedConfig) => {
|
|
|
14745
14756
|
}
|
|
14746
14757
|
};
|
|
14747
14758
|
|
|
14759
|
+
if (typeof Promise.withResolvers === 'undefined') {
|
|
14760
|
+
Promise.withResolvers = () => {
|
|
14761
|
+
let resolve;
|
|
14762
|
+
let reject;
|
|
14763
|
+
const promise = new Promise((res, rej) => {
|
|
14764
|
+
resolve = res;
|
|
14765
|
+
reject = rej;
|
|
14766
|
+
});
|
|
14767
|
+
return { promise, resolve, reject };
|
|
14768
|
+
};
|
|
14769
|
+
}
|
|
14770
|
+
|
|
14748
14771
|
/* eslint-disable camelcase */
|
|
14749
14772
|
/* eslint-disable import/no-mutable-exports */
|
|
14750
14773
|
/**
|
|
@@ -14851,6 +14874,25 @@ function backwardCompat(embedConfig) {
|
|
|
14851
14874
|
}
|
|
14852
14875
|
return newConfig;
|
|
14853
14876
|
}
|
|
14877
|
+
const initFlagKey = 'initFlagKey';
|
|
14878
|
+
const createAndSetInitPromise = () => {
|
|
14879
|
+
const { promise: initPromise, resolve: initPromiseResolve,
|
|
14880
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14881
|
+
// @ts-ignore
|
|
14882
|
+
} = Promise.withResolvers();
|
|
14883
|
+
const initFlagStore = {
|
|
14884
|
+
initPromise,
|
|
14885
|
+
isInitCalled: false,
|
|
14886
|
+
initPromiseResolve,
|
|
14887
|
+
};
|
|
14888
|
+
storeValueInWindow(initFlagKey, initFlagStore, {
|
|
14889
|
+
// In case of diff imports the promise might be already set
|
|
14890
|
+
ignoreIfAlreadyExists: true,
|
|
14891
|
+
});
|
|
14892
|
+
};
|
|
14893
|
+
createAndSetInitPromise();
|
|
14894
|
+
const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
|
|
14895
|
+
const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
|
|
14854
14896
|
/**
|
|
14855
14897
|
* Initializes the Visual Embed SDK globally and perform
|
|
14856
14898
|
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
@@ -14897,6 +14939,9 @@ const init = (embedConfig) => {
|
|
|
14897
14939
|
if (getEmbedConfig().callPrefetch) {
|
|
14898
14940
|
prefetch(getEmbedConfig().thoughtSpotHost);
|
|
14899
14941
|
}
|
|
14942
|
+
// Resolves the promise created in the initPromiseKey
|
|
14943
|
+
getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
|
|
14944
|
+
getValueFromWindow(initFlagKey).isInitCalled = true;
|
|
14900
14945
|
return authEE;
|
|
14901
14946
|
};
|
|
14902
14947
|
/**
|
|
@@ -15167,7 +15212,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
15167
15212
|
return e;
|
|
15168
15213
|
}
|
|
15169
15214
|
|
|
15170
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.
|
|
15215
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};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",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@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",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"6.3.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.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",vite:"^5.3.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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
15171
15216
|
|
|
15172
15217
|
/**
|
|
15173
15218
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15476,13 +15521,6 @@ class TsEmbed {
|
|
|
15476
15521
|
}
|
|
15477
15522
|
};
|
|
15478
15523
|
this.el = getDOMNode(domSelector);
|
|
15479
|
-
// TODO: handle error
|
|
15480
|
-
this.embedConfig = getEmbedConfig();
|
|
15481
|
-
if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
|
|
15482
|
-
this.embedConfig.authTriggerContainer = domSelector;
|
|
15483
|
-
}
|
|
15484
|
-
this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
|
|
15485
|
-
this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
|
|
15486
15524
|
this.eventHandlerMap = new Map();
|
|
15487
15525
|
this.isError = false;
|
|
15488
15526
|
this.viewConfig = {
|
|
@@ -15490,12 +15528,21 @@ class TsEmbed {
|
|
|
15490
15528
|
excludeRuntimeParametersfromURL: false,
|
|
15491
15529
|
...viewConfig,
|
|
15492
15530
|
};
|
|
15493
|
-
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
15494
15531
|
this.registerAppInit();
|
|
15495
15532
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15496
15533
|
...viewConfig,
|
|
15497
15534
|
});
|
|
15498
15535
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15536
|
+
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
15537
|
+
const embedConfig = getEmbedConfig();
|
|
15538
|
+
this.embedConfig = embedConfig;
|
|
15539
|
+
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
15540
|
+
this.embedConfig.authTriggerContainer = domSelector;
|
|
15541
|
+
}
|
|
15542
|
+
this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
|
|
15543
|
+
this.thoughtSpotV2Base = getV2BasePath(embedConfig);
|
|
15544
|
+
this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
|
|
15545
|
+
});
|
|
15499
15546
|
}
|
|
15500
15547
|
/**
|
|
15501
15548
|
* Throws error encountered during initialization.
|
|
@@ -16213,6 +16260,10 @@ class TsEmbed {
|
|
|
16213
16260
|
* @param args
|
|
16214
16261
|
*/
|
|
16215
16262
|
async render() {
|
|
16263
|
+
if (!getIsInitCalled()) {
|
|
16264
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16265
|
+
}
|
|
16266
|
+
await this.isReadyForRenderPromise;
|
|
16216
16267
|
this.isRendered = true;
|
|
16217
16268
|
return this;
|
|
16218
16269
|
}
|
|
@@ -16220,21 +16271,20 @@ class TsEmbed {
|
|
|
16220
16271
|
return '';
|
|
16221
16272
|
}
|
|
16222
16273
|
handleRenderForPrerender() {
|
|
16223
|
-
this.render();
|
|
16274
|
+
return this.render();
|
|
16224
16275
|
}
|
|
16225
16276
|
/**
|
|
16226
16277
|
* Creates the preRender shell
|
|
16227
16278
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
16228
16279
|
*/
|
|
16229
|
-
preRender(showPreRenderByDefault = false) {
|
|
16280
|
+
async preRender(showPreRenderByDefault = false) {
|
|
16230
16281
|
if (!this.viewConfig.preRenderId) {
|
|
16231
16282
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
16232
16283
|
return this;
|
|
16233
16284
|
}
|
|
16234
16285
|
this.isPreRendered = true;
|
|
16235
16286
|
this.showPreRenderByDefault = showPreRenderByDefault;
|
|
16236
|
-
this.handleRenderForPrerender();
|
|
16237
|
-
return this;
|
|
16287
|
+
return this.handleRenderForPrerender();
|
|
16238
16288
|
}
|
|
16239
16289
|
/**
|
|
16240
16290
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
@@ -16287,6 +16337,10 @@ class TsEmbed {
|
|
|
16287
16337
|
* @returns
|
|
16288
16338
|
*/
|
|
16289
16339
|
async prerenderGeneric() {
|
|
16340
|
+
if (!getIsInitCalled()) {
|
|
16341
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16342
|
+
}
|
|
16343
|
+
await this.isReadyForRenderPromise;
|
|
16290
16344
|
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
16291
16345
|
this.isRendered = true;
|
|
16292
16346
|
return this.renderIFrame(prerenderFrameSrc);
|
|
@@ -16300,17 +16354,16 @@ class TsEmbed {
|
|
|
16300
16354
|
* Also, synchronizes the style of the PreRender component with the embedding
|
|
16301
16355
|
* element.
|
|
16302
16356
|
*/
|
|
16303
|
-
showPreRender() {
|
|
16357
|
+
async showPreRender() {
|
|
16304
16358
|
if (!this.viewConfig.preRenderId) {
|
|
16305
16359
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
16306
|
-
return;
|
|
16360
|
+
return this;
|
|
16307
16361
|
}
|
|
16308
16362
|
if (!this.isPreRenderAvailable()) {
|
|
16309
16363
|
const isAvailable = this.connectPreRendered();
|
|
16310
16364
|
if (!isAvailable) {
|
|
16311
16365
|
// if the Embed component is not preRendered , Render it now and
|
|
16312
|
-
this.preRender(true);
|
|
16313
|
-
return;
|
|
16366
|
+
return this.preRender(true);
|
|
16314
16367
|
}
|
|
16315
16368
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
16316
16369
|
}
|
|
@@ -16333,6 +16386,7 @@ class TsEmbed {
|
|
|
16333
16386
|
this.beforePrerenderVisible();
|
|
16334
16387
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
16335
16388
|
this.subscribeToEvents();
|
|
16389
|
+
return this;
|
|
16336
16390
|
}
|
|
16337
16391
|
/**
|
|
16338
16392
|
* Synchronizes the style properties of the PreRender component with the embedding
|
|
@@ -16750,7 +16804,7 @@ class AppEmbed extends V1Embed {
|
|
|
16750
16804
|
* to be embedded.
|
|
16751
16805
|
*/
|
|
16752
16806
|
async render() {
|
|
16753
|
-
super.render();
|
|
16807
|
+
await super.render();
|
|
16754
16808
|
const src = this.getIFrameSrc();
|
|
16755
16809
|
await this.renderV1Embed(src);
|
|
16756
16810
|
return this;
|
|
@@ -17029,12 +17083,11 @@ class LiveboardEmbed extends V1Embed {
|
|
|
17029
17083
|
this.navigateToLiveboard(libId);
|
|
17030
17084
|
}
|
|
17031
17085
|
}
|
|
17032
|
-
handleRenderForPrerender() {
|
|
17086
|
+
async handleRenderForPrerender() {
|
|
17033
17087
|
if (isUndefined$1(this.viewConfig.liveboardId)) {
|
|
17034
|
-
this.prerenderGeneric();
|
|
17035
|
-
return;
|
|
17088
|
+
return this.prerenderGeneric();
|
|
17036
17089
|
}
|
|
17037
|
-
super.handleRenderForPrerender();
|
|
17090
|
+
return super.handleRenderForPrerender();
|
|
17038
17091
|
}
|
|
17039
17092
|
/**
|
|
17040
17093
|
* Triggers an event to the embedded app
|
|
@@ -17059,7 +17112,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
17059
17112
|
* visualization ID and the runtime filters.
|
|
17060
17113
|
*/
|
|
17061
17114
|
async render() {
|
|
17062
|
-
super.render();
|
|
17115
|
+
await super.render();
|
|
17063
17116
|
const src = this.getIFrameSrc();
|
|
17064
17117
|
await this.renderV1Embed(src);
|
|
17065
17118
|
this.showPreviewLoader();
|
|
@@ -17267,7 +17320,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
17267
17320
|
* Render the embedded ThoughtSpot search
|
|
17268
17321
|
*/
|
|
17269
17322
|
async render() {
|
|
17270
|
-
super.render();
|
|
17323
|
+
await super.render();
|
|
17271
17324
|
this.viewConfig;
|
|
17272
17325
|
const src = this.getIFrameSrc();
|
|
17273
17326
|
await this.renderIFrame(src);
|
|
@@ -17334,7 +17387,7 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
17334
17387
|
* Render the embedded ThoughtSpot search
|
|
17335
17388
|
*/
|
|
17336
17389
|
async render() {
|
|
17337
|
-
super.render();
|
|
17390
|
+
await super.render();
|
|
17338
17391
|
const src = this.getIFrameSrc();
|
|
17339
17392
|
await this.renderIFrame(src);
|
|
17340
17393
|
return this;
|
|
@@ -17758,7 +17811,7 @@ class ConversationMessage extends TsEmbed {
|
|
|
17758
17811
|
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
17759
17812
|
}
|
|
17760
17813
|
async render() {
|
|
17761
|
-
super.render();
|
|
17814
|
+
await super.render();
|
|
17762
17815
|
const src = this.getIframeSrc();
|
|
17763
17816
|
await this.renderIFrame(src);
|
|
17764
17817
|
return this;
|
|
@@ -17886,7 +17939,7 @@ class ConversationEmbed extends TsEmbed {
|
|
|
17886
17939
|
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
17887
17940
|
}
|
|
17888
17941
|
async render() {
|
|
17889
|
-
super.render();
|
|
17942
|
+
await super.render();
|
|
17890
17943
|
const src = this.getIframeSrc();
|
|
17891
17944
|
await this.renderIFrame(src);
|
|
17892
17945
|
return this;
|
|
@@ -17962,7 +18015,7 @@ class SageEmbed extends V1Embed {
|
|
|
17962
18015
|
* @returns {SageEmbed} Eureka/Sage embed
|
|
17963
18016
|
*/
|
|
17964
18017
|
async render() {
|
|
17965
|
-
super.render();
|
|
18018
|
+
await super.render();
|
|
17966
18019
|
const src = this.getIFrameSrc();
|
|
17967
18020
|
await this.renderV1Embed(src);
|
|
17968
18021
|
return this;
|
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.36.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.36.4 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -352,13 +352,23 @@
|
|
|
352
352
|
* Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
|
|
353
353
|
* @param key - The key under which the value will be stored.
|
|
354
354
|
* @param value - The value to store.
|
|
355
|
+
* @param options - Additional options.
|
|
356
|
+
* @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
|
|
357
|
+
*
|
|
358
|
+
* @returns The stored value.
|
|
359
|
+
*
|
|
360
|
+
* @version SDK: 1.36.2 | ThoughtSpot: *
|
|
355
361
|
*/
|
|
356
|
-
|
|
362
|
+
function storeValueInWindow(key, value, options = {}) {
|
|
357
363
|
if (!window[sdkWindowKey]) {
|
|
358
364
|
window[sdkWindowKey] = {};
|
|
359
365
|
}
|
|
366
|
+
if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
|
|
367
|
+
return window[sdkWindowKey][key];
|
|
368
|
+
}
|
|
360
369
|
window[sdkWindowKey][key] = value;
|
|
361
|
-
|
|
370
|
+
return value;
|
|
371
|
+
}
|
|
362
372
|
/**
|
|
363
373
|
* Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
|
|
364
374
|
* @param key - The key whose value needs to be retrieved.
|
|
@@ -6527,6 +6537,7 @@
|
|
|
6527
6537
|
CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
|
|
6528
6538
|
CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
|
|
6529
6539
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6540
|
+
RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
|
|
6530
6541
|
};
|
|
6531
6542
|
|
|
6532
6543
|
const EndPoints = {
|
|
@@ -14751,6 +14762,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14751
14762
|
}
|
|
14752
14763
|
};
|
|
14753
14764
|
|
|
14765
|
+
if (typeof Promise.withResolvers === 'undefined') {
|
|
14766
|
+
Promise.withResolvers = () => {
|
|
14767
|
+
let resolve;
|
|
14768
|
+
let reject;
|
|
14769
|
+
const promise = new Promise((res, rej) => {
|
|
14770
|
+
resolve = res;
|
|
14771
|
+
reject = rej;
|
|
14772
|
+
});
|
|
14773
|
+
return { promise, resolve, reject };
|
|
14774
|
+
};
|
|
14775
|
+
}
|
|
14776
|
+
|
|
14754
14777
|
/* eslint-disable camelcase */
|
|
14755
14778
|
/* eslint-disable import/no-mutable-exports */
|
|
14756
14779
|
/**
|
|
@@ -14857,6 +14880,25 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14857
14880
|
}
|
|
14858
14881
|
return newConfig;
|
|
14859
14882
|
}
|
|
14883
|
+
const initFlagKey = 'initFlagKey';
|
|
14884
|
+
const createAndSetInitPromise = () => {
|
|
14885
|
+
const { promise: initPromise, resolve: initPromiseResolve,
|
|
14886
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14887
|
+
// @ts-ignore
|
|
14888
|
+
} = Promise.withResolvers();
|
|
14889
|
+
const initFlagStore = {
|
|
14890
|
+
initPromise,
|
|
14891
|
+
isInitCalled: false,
|
|
14892
|
+
initPromiseResolve,
|
|
14893
|
+
};
|
|
14894
|
+
storeValueInWindow(initFlagKey, initFlagStore, {
|
|
14895
|
+
// In case of diff imports the promise might be already set
|
|
14896
|
+
ignoreIfAlreadyExists: true,
|
|
14897
|
+
});
|
|
14898
|
+
};
|
|
14899
|
+
createAndSetInitPromise();
|
|
14900
|
+
const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
|
|
14901
|
+
const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
|
|
14860
14902
|
/**
|
|
14861
14903
|
* Initializes the Visual Embed SDK globally and perform
|
|
14862
14904
|
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
@@ -14903,6 +14945,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14903
14945
|
if (getEmbedConfig().callPrefetch) {
|
|
14904
14946
|
prefetch(getEmbedConfig().thoughtSpotHost);
|
|
14905
14947
|
}
|
|
14948
|
+
// Resolves the promise created in the initPromiseKey
|
|
14949
|
+
getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
|
|
14950
|
+
getValueFromWindow(initFlagKey).isInitCalled = true;
|
|
14906
14951
|
return authEE;
|
|
14907
14952
|
};
|
|
14908
14953
|
/**
|
|
@@ -15173,7 +15218,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15173
15218
|
return e;
|
|
15174
15219
|
}
|
|
15175
15220
|
|
|
15176
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.
|
|
15221
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.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/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};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",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@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",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"6.3.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.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",vite:"^5.3.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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
15177
15222
|
|
|
15178
15223
|
/**
|
|
15179
15224
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15482,13 +15527,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15482
15527
|
}
|
|
15483
15528
|
};
|
|
15484
15529
|
this.el = getDOMNode(domSelector);
|
|
15485
|
-
// TODO: handle error
|
|
15486
|
-
this.embedConfig = getEmbedConfig();
|
|
15487
|
-
if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
|
|
15488
|
-
this.embedConfig.authTriggerContainer = domSelector;
|
|
15489
|
-
}
|
|
15490
|
-
this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
|
|
15491
|
-
this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
|
|
15492
15530
|
this.eventHandlerMap = new Map();
|
|
15493
15531
|
this.isError = false;
|
|
15494
15532
|
this.viewConfig = {
|
|
@@ -15496,12 +15534,21 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15496
15534
|
excludeRuntimeParametersfromURL: false,
|
|
15497
15535
|
...viewConfig,
|
|
15498
15536
|
};
|
|
15499
|
-
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
15500
15537
|
this.registerAppInit();
|
|
15501
15538
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15502
15539
|
...viewConfig,
|
|
15503
15540
|
});
|
|
15504
15541
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15542
|
+
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
15543
|
+
const embedConfig = getEmbedConfig();
|
|
15544
|
+
this.embedConfig = embedConfig;
|
|
15545
|
+
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
15546
|
+
this.embedConfig.authTriggerContainer = domSelector;
|
|
15547
|
+
}
|
|
15548
|
+
this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
|
|
15549
|
+
this.thoughtSpotV2Base = getV2BasePath(embedConfig);
|
|
15550
|
+
this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
|
|
15551
|
+
});
|
|
15505
15552
|
}
|
|
15506
15553
|
/**
|
|
15507
15554
|
* Throws error encountered during initialization.
|
|
@@ -16219,6 +16266,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16219
16266
|
* @param args
|
|
16220
16267
|
*/
|
|
16221
16268
|
async render() {
|
|
16269
|
+
if (!getIsInitCalled()) {
|
|
16270
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16271
|
+
}
|
|
16272
|
+
await this.isReadyForRenderPromise;
|
|
16222
16273
|
this.isRendered = true;
|
|
16223
16274
|
return this;
|
|
16224
16275
|
}
|
|
@@ -16226,21 +16277,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16226
16277
|
return '';
|
|
16227
16278
|
}
|
|
16228
16279
|
handleRenderForPrerender() {
|
|
16229
|
-
this.render();
|
|
16280
|
+
return this.render();
|
|
16230
16281
|
}
|
|
16231
16282
|
/**
|
|
16232
16283
|
* Creates the preRender shell
|
|
16233
16284
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
16234
16285
|
*/
|
|
16235
|
-
preRender(showPreRenderByDefault = false) {
|
|
16286
|
+
async preRender(showPreRenderByDefault = false) {
|
|
16236
16287
|
if (!this.viewConfig.preRenderId) {
|
|
16237
16288
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
16238
16289
|
return this;
|
|
16239
16290
|
}
|
|
16240
16291
|
this.isPreRendered = true;
|
|
16241
16292
|
this.showPreRenderByDefault = showPreRenderByDefault;
|
|
16242
|
-
this.handleRenderForPrerender();
|
|
16243
|
-
return this;
|
|
16293
|
+
return this.handleRenderForPrerender();
|
|
16244
16294
|
}
|
|
16245
16295
|
/**
|
|
16246
16296
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
@@ -16293,6 +16343,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16293
16343
|
* @returns
|
|
16294
16344
|
*/
|
|
16295
16345
|
async prerenderGeneric() {
|
|
16346
|
+
if (!getIsInitCalled()) {
|
|
16347
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16348
|
+
}
|
|
16349
|
+
await this.isReadyForRenderPromise;
|
|
16296
16350
|
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
16297
16351
|
this.isRendered = true;
|
|
16298
16352
|
return this.renderIFrame(prerenderFrameSrc);
|
|
@@ -16306,17 +16360,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16306
16360
|
* Also, synchronizes the style of the PreRender component with the embedding
|
|
16307
16361
|
* element.
|
|
16308
16362
|
*/
|
|
16309
|
-
showPreRender() {
|
|
16363
|
+
async showPreRender() {
|
|
16310
16364
|
if (!this.viewConfig.preRenderId) {
|
|
16311
16365
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
16312
|
-
return;
|
|
16366
|
+
return this;
|
|
16313
16367
|
}
|
|
16314
16368
|
if (!this.isPreRenderAvailable()) {
|
|
16315
16369
|
const isAvailable = this.connectPreRendered();
|
|
16316
16370
|
if (!isAvailable) {
|
|
16317
16371
|
// if the Embed component is not preRendered , Render it now and
|
|
16318
|
-
this.preRender(true);
|
|
16319
|
-
return;
|
|
16372
|
+
return this.preRender(true);
|
|
16320
16373
|
}
|
|
16321
16374
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
16322
16375
|
}
|
|
@@ -16339,6 +16392,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16339
16392
|
this.beforePrerenderVisible();
|
|
16340
16393
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
16341
16394
|
this.subscribeToEvents();
|
|
16395
|
+
return this;
|
|
16342
16396
|
}
|
|
16343
16397
|
/**
|
|
16344
16398
|
* Synchronizes the style properties of the PreRender component with the embedding
|
|
@@ -16756,7 +16810,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16756
16810
|
* to be embedded.
|
|
16757
16811
|
*/
|
|
16758
16812
|
async render() {
|
|
16759
|
-
super.render();
|
|
16813
|
+
await super.render();
|
|
16760
16814
|
const src = this.getIFrameSrc();
|
|
16761
16815
|
await this.renderV1Embed(src);
|
|
16762
16816
|
return this;
|
|
@@ -17035,12 +17089,11 @@ query GetEurekaVizSnapshots(
|
|
|
17035
17089
|
this.navigateToLiveboard(libId);
|
|
17036
17090
|
}
|
|
17037
17091
|
}
|
|
17038
|
-
handleRenderForPrerender() {
|
|
17092
|
+
async handleRenderForPrerender() {
|
|
17039
17093
|
if (isUndefined$1(this.viewConfig.liveboardId)) {
|
|
17040
|
-
this.prerenderGeneric();
|
|
17041
|
-
return;
|
|
17094
|
+
return this.prerenderGeneric();
|
|
17042
17095
|
}
|
|
17043
|
-
super.handleRenderForPrerender();
|
|
17096
|
+
return super.handleRenderForPrerender();
|
|
17044
17097
|
}
|
|
17045
17098
|
/**
|
|
17046
17099
|
* Triggers an event to the embedded app
|
|
@@ -17065,7 +17118,7 @@ query GetEurekaVizSnapshots(
|
|
|
17065
17118
|
* visualization ID and the runtime filters.
|
|
17066
17119
|
*/
|
|
17067
17120
|
async render() {
|
|
17068
|
-
super.render();
|
|
17121
|
+
await super.render();
|
|
17069
17122
|
const src = this.getIFrameSrc();
|
|
17070
17123
|
await this.renderV1Embed(src);
|
|
17071
17124
|
this.showPreviewLoader();
|
|
@@ -17273,7 +17326,7 @@ query GetEurekaVizSnapshots(
|
|
|
17273
17326
|
* Render the embedded ThoughtSpot search
|
|
17274
17327
|
*/
|
|
17275
17328
|
async render() {
|
|
17276
|
-
super.render();
|
|
17329
|
+
await super.render();
|
|
17277
17330
|
this.viewConfig;
|
|
17278
17331
|
const src = this.getIFrameSrc();
|
|
17279
17332
|
await this.renderIFrame(src);
|
|
@@ -17340,7 +17393,7 @@ query GetEurekaVizSnapshots(
|
|
|
17340
17393
|
* Render the embedded ThoughtSpot search
|
|
17341
17394
|
*/
|
|
17342
17395
|
async render() {
|
|
17343
|
-
super.render();
|
|
17396
|
+
await super.render();
|
|
17344
17397
|
const src = this.getIFrameSrc();
|
|
17345
17398
|
await this.renderIFrame(src);
|
|
17346
17399
|
return this;
|
|
@@ -17764,7 +17817,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
17764
17817
|
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
17765
17818
|
}
|
|
17766
17819
|
async render() {
|
|
17767
|
-
super.render();
|
|
17820
|
+
await super.render();
|
|
17768
17821
|
const src = this.getIframeSrc();
|
|
17769
17822
|
await this.renderIFrame(src);
|
|
17770
17823
|
return this;
|
|
@@ -17892,7 +17945,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
17892
17945
|
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
17893
17946
|
}
|
|
17894
17947
|
async render() {
|
|
17895
|
-
super.render();
|
|
17948
|
+
await super.render();
|
|
17896
17949
|
const src = this.getIframeSrc();
|
|
17897
17950
|
await this.renderIFrame(src);
|
|
17898
17951
|
return this;
|
|
@@ -17968,7 +18021,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
17968
18021
|
* @returns {SageEmbed} Eureka/Sage embed
|
|
17969
18022
|
*/
|
|
17970
18023
|
async render() {
|
|
17971
|
-
super.render();
|
|
18024
|
+
await super.render();
|
|
17972
18025
|
const src = this.getIFrameSrc();
|
|
17973
18026
|
await this.renderV1Embed(src);
|
|
17974
18027
|
return this;
|