@thoughtspot/visual-embed-sdk 1.24.0-preRender.1 → 1.24.0-preRender.2

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.
Files changed (46) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/embed/liveboard.d.ts +1 -0
  3. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  4. package/cjs/src/embed/liveboard.js +2 -1
  5. package/cjs/src/embed/liveboard.js.map +1 -1
  6. package/cjs/src/embed/search.js +1 -1
  7. package/cjs/src/embed/search.js.map +1 -1
  8. package/cjs/src/embed/ts-embed.d.ts +3 -3
  9. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  10. package/cjs/src/embed/ts-embed.js +57 -32
  11. package/cjs/src/embed/ts-embed.js.map +1 -1
  12. package/cjs/src/utils.d.ts.map +1 -1
  13. package/cjs/src/utils.js +0 -4
  14. package/cjs/src/utils.js.map +1 -1
  15. package/dist/src/embed/liveboard.d.ts +1 -0
  16. package/dist/src/embed/liveboard.d.ts.map +1 -1
  17. package/dist/src/embed/ts-embed.d.ts +3 -3
  18. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  19. package/dist/src/utils.d.ts.map +1 -1
  20. package/dist/tsembed-react.es.js +61 -39
  21. package/dist/tsembed-react.js +61 -39
  22. package/dist/tsembed.es.js +61 -39
  23. package/dist/tsembed.js +61 -39
  24. package/dist/visual-embed-sdk-react-full.d.ts +4 -3
  25. package/dist/visual-embed-sdk-react.d.ts +4 -3
  26. package/dist/visual-embed-sdk.d.ts +4 -3
  27. package/lib/package.json +1 -1
  28. package/lib/src/embed/liveboard.d.ts +1 -0
  29. package/lib/src/embed/liveboard.d.ts.map +1 -1
  30. package/lib/src/embed/liveboard.js +2 -1
  31. package/lib/src/embed/liveboard.js.map +1 -1
  32. package/lib/src/embed/search.js +1 -1
  33. package/lib/src/embed/search.js.map +1 -1
  34. package/lib/src/embed/ts-embed.d.ts +3 -3
  35. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  36. package/lib/src/embed/ts-embed.js +57 -32
  37. package/lib/src/embed/ts-embed.js.map +1 -1
  38. package/lib/src/utils.d.ts.map +1 -1
  39. package/lib/src/utils.js +0 -4
  40. package/lib/src/utils.js.map +1 -1
  41. package/lib/src/visual-embed-sdk.d.ts +4 -3
  42. package/package.json +1 -1
  43. package/src/embed/liveboard.ts +2 -1
  44. package/src/embed/search.ts +1 -1
  45. package/src/embed/ts-embed.ts +72 -49
  46. package/src/utils.ts +1 -6
@@ -377,15 +377,11 @@ function removeTypename(obj) {
377
377
  return obj;
378
378
  }
379
379
  const setStyleProperties = (element, styleProperties) => {
380
- if (!element || !styleProperties)
381
- return;
382
380
  Object.keys(styleProperties).forEach((styleProperty) => {
383
381
  element.style[styleProperty] = styleProperties[styleProperty].toString();
384
382
  });
385
383
  };
386
384
  const removeStyleProperties = (element, styleProperties) => {
387
- if (!element || !styleProperties)
388
- return;
389
385
  styleProperties.forEach((styleProperty) => {
390
386
  element.style.removeProperty(styleProperty);
391
387
  });
@@ -10718,7 +10714,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
10718
10714
  });
10719
10715
  }
10720
10716
 
10721
- var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^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",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
10717
+ var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^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",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
10722
10718
 
10723
10719
  /**
10724
10720
  * Copyright (c) 2022
@@ -11023,8 +11019,7 @@ class TsEmbed {
11023
11019
  else if (contextMenuTrigger === ContextMenuTriggerOptions.RIGHT_CLICK) {
11024
11020
  queryParams[Param.ContextMenuTrigger] = false;
11025
11021
  }
11026
- const spriteUrl = (customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl)
11027
- || ((_d = this.embedConfig.customizations) === null || _d === void 0 ? void 0 : _d.iconSpriteUrl);
11022
+ const spriteUrl = (customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl) || ((_d = this.embedConfig.customizations) === null || _d === void 0 ? void 0 : _d.iconSpriteUrl);
11028
11023
  if (spriteUrl) {
11029
11024
  queryParams[Param.IconSpriteUrl] = spriteUrl.replace('https://', '');
11030
11025
  }
@@ -11106,10 +11101,13 @@ class TsEmbed {
11106
11101
  }
11107
11102
  handleInsertionIntoDOM(child, showPreRenderByDefault = false) {
11108
11103
  if (this.isPreRendered) {
11109
- this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
11104
+ if (!this.viewConfig.preRenderId) {
11105
+ throw Error('PreRender id is required for preRender');
11106
+ }
11107
+ this.insertIntoDOMForPreRender(child, showPreRenderByDefault);
11110
11108
  }
11111
11109
  else {
11112
- this.insertIntoDOM(this.embedConfig.loginFailedMessage);
11110
+ this.insertIntoDOM(child);
11113
11111
  }
11114
11112
  }
11115
11113
  /**
@@ -11182,32 +11180,34 @@ class TsEmbed {
11182
11180
  getPreRenderIds() {
11183
11181
  return {
11184
11182
  wrapper: `tsEmbed-pre-render-wrapper-${this.viewConfig.preRenderId}`,
11185
- shield: `tsEmbed-pre-render-shield-${this.viewConfig.preRenderId}`,
11183
+ // shield:
11184
+ // `tsEmbed-pre-render-shield-${this.viewConfig.preRenderId}`,
11186
11185
  child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
11187
11186
  };
11188
11187
  }
11189
- createPreRenderWrapper(child) {
11188
+ createPreRenderWrapper() {
11189
+ var _a;
11190
11190
  if (!this.viewConfig.preRenderId) {
11191
- throw new Error('PreRender id is required');
11191
+ throw new Error('PreRender id is required to create PreRender wrapper');
11192
11192
  }
11193
11193
  const preRenderIds = this.getPreRenderIds();
11194
- [preRenderIds.wrapper, preRenderIds.shield, preRenderIds.child]
11195
- .map((id) => document.getElementById(id))
11196
- .filter((element) => element)
11197
- .forEach((existingElement) => existingElement.remove());
11194
+ (_a = document.getElementById(preRenderIds.wrapper)) === null || _a === void 0 ? void 0 : _a.remove();
11198
11195
  const preRenderWrapper = document.createElement('div');
11199
11196
  preRenderWrapper.id = preRenderIds.wrapper;
11200
- setStyleProperties(preRenderWrapper, { position: 'absolute', width: '100vw', height: '100vh' });
11197
+ const initialPreRenderWrapperStyle = {
11198
+ position: 'absolute',
11199
+ width: '100vw',
11200
+ height: '100vh',
11201
+ };
11202
+ setStyleProperties(preRenderWrapper, initialPreRenderWrapperStyle);
11201
11203
  // const preRenderShield = document.createElement('div');
11202
11204
  // preRenderShield.id = preRenderIds.shield;
11203
11205
  // setStyleProperties(preRenderShield, { position: 'absolute',
11204
11206
  // width: '100%', height: '100%' });
11205
- child.id = preRenderIds.child;
11206
- preRenderWrapper.appendChild(child);
11207
11207
  // preRenderWrapper.appendChild(preRenderShield);
11208
- this.preRenderWrapper = preRenderWrapper;
11208
+ // this.preRenderWrapper = preRenderWrapper;
11209
11209
  // this.preRenderShield = preRenderShield;
11210
- this.preRenderChild = child;
11210
+ // this.preRenderChild = child;
11211
11211
  return preRenderWrapper;
11212
11212
  }
11213
11213
  connectPreRendered() {
@@ -11216,8 +11216,7 @@ class TsEmbed {
11216
11216
  || document.getElementById(preRenderIds.wrapper);
11217
11217
  // this.preRenderShield = this.preRenderShield
11218
11218
  // || document.getElementById(preRenderIds.shield);
11219
- this.preRenderChild = this.preRenderChild
11220
- || document.getElementById(preRenderIds.child);
11219
+ this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
11221
11220
  if (this.preRenderWrapper && this.preRenderChild) {
11222
11221
  this.isPreRendered = true;
11223
11222
  this.iFrame = this.preRenderChild;
@@ -11227,17 +11226,34 @@ class TsEmbed {
11227
11226
  isPreRenderAvailable() {
11228
11227
  return this.isPreRendered;
11229
11228
  }
11230
- insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
11231
- let childNode;
11229
+ createPreRenderChild(child) {
11230
+ var _a;
11231
+ const preRenderIds = this.getPreRenderIds();
11232
+ (_a = document.getElementById(preRenderIds.child)) === null || _a === void 0 ? void 0 : _a.remove();
11233
+ if (child instanceof HTMLElement) {
11234
+ child.id = preRenderIds.child;
11235
+ return child;
11236
+ }
11237
+ const divChildNode = document.createElement('div');
11238
+ setStyleProperties(divChildNode, { width: '100%', height: '100%' });
11239
+ divChildNode.id = preRenderIds.child;
11232
11240
  if (typeof child === 'string') {
11233
- const divChildNode = document.createElement('div');
11234
11241
  divChildNode.innerHTML = child;
11235
- childNode = divChildNode;
11236
11242
  }
11237
11243
  else {
11238
- childNode = child;
11244
+ divChildNode.appendChild(child);
11245
+ }
11246
+ return divChildNode;
11247
+ }
11248
+ insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
11249
+ const preRenderChild = this.createPreRenderChild(child);
11250
+ const preRenderWrapper = this.createPreRenderWrapper();
11251
+ preRenderWrapper.appendChild(preRenderChild);
11252
+ this.preRenderChild = preRenderChild;
11253
+ this.preRenderWrapper = preRenderWrapper;
11254
+ if (preRenderChild instanceof HTMLIFrameElement) {
11255
+ this.iFrame = preRenderChild;
11239
11256
  }
11240
- const preRenderWrapper = this.createPreRenderWrapper(childNode);
11241
11257
  if (showPreRenderByDefault) {
11242
11258
  this.showPreRender();
11243
11259
  }
@@ -11249,18 +11265,20 @@ class TsEmbed {
11249
11265
  hidePreRender() {
11250
11266
  if (!this.isPreRenderAvailable()) {
11251
11267
  // if the embed component is not preRendered , nothing to hide
11252
- console.log('No preRender found, not hiding ');
11268
+ console.warn('Warning: You should call PreRender before hiding it using hidePreRender.');
11253
11269
  return;
11254
11270
  }
11255
- setStyleProperties(this.preRenderWrapper, {
11271
+ const preRenderHideStyles = {
11256
11272
  opacity: '0',
11257
11273
  pointerEvents: 'none',
11258
11274
  zIndex: '-1000',
11259
11275
  position: 'absolute ',
11260
11276
  top: '0',
11261
11277
  left: '0',
11262
- });
11263
- const childBoundingRect = this.preRenderChild.getBoundingClientRect();
11278
+ };
11279
+ setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
11280
+ // const childBoundingRect = this.preRenderChild.getBoundingClientRect();
11281
+ //
11264
11282
  // setStyleProperties(this.preRenderShield, {
11265
11283
  // opacity: '0',
11266
11284
  // pointerEvents: 'none',
@@ -11277,10 +11295,10 @@ class TsEmbed {
11277
11295
  if (!this.isPreRenderAvailable()) {
11278
11296
  const isAvailable = this.connectPreRendered();
11279
11297
  if (!isAvailable) {
11280
- // if the Embed component is nor preRendered , Render it now and
11281
- // show it (hide is defalt behaviour)
11282
- console.log('No preRender found, creating new ');
11298
+ // if the Embed component is not preRendered , Render it now and
11283
11299
  this.preRender(true);
11300
+ // show it (hide is defalt behaviour)
11301
+ // console.log('No preRender found, creating new ');
11284
11302
  return;
11285
11303
  }
11286
11304
  }
@@ -11295,7 +11313,10 @@ class TsEmbed {
11295
11313
  }
11296
11314
  const elBoundingClient = this.el.getBoundingClientRect();
11297
11315
  setStyleProperties(this.preRenderWrapper, {
11298
- top: `${elBoundingClient.y}px`, left: `${elBoundingClient.x}px`, width: `${elBoundingClient.width}px`, height: `${elBoundingClient.height}px`,
11316
+ top: `${elBoundingClient.y}px`,
11317
+ left: `${elBoundingClient.x}px`,
11318
+ width: `${elBoundingClient.width}px`,
11319
+ height: `${elBoundingClient.height}px`,
11299
11320
  });
11300
11321
  }
11301
11322
  insertIntoDOM(child) {
@@ -11910,7 +11931,7 @@ class SearchEmbed extends TsEmbed {
11910
11931
  return this;
11911
11932
  }
11912
11933
  preRender(showPreRenderByDefault = false) {
11913
- super.preRender(showPreRenderByDefault);
11934
+ super.preRender();
11914
11935
  this.render(showPreRenderByDefault);
11915
11936
  return this;
11916
11937
  }
@@ -12288,6 +12309,7 @@ class LiveboardEmbed extends V1Embed {
12288
12309
  *
12289
12310
  * @param renderOptions An object specifying the Liveboard ID,
12290
12311
  * visualization ID and the runtime filters.
12312
+ * @param showPreRenderByDefault
12291
12313
  */
12292
12314
  render(showPreRenderByDefault = false) {
12293
12315
  super.render();
@@ -12296,7 +12318,7 @@ class LiveboardEmbed extends V1Embed {
12296
12318
  return this;
12297
12319
  }
12298
12320
  preRender(showPreRenderByDefault = false) {
12299
- super.preRender(showPreRenderByDefault);
12321
+ super.preRender();
12300
12322
  this.render(showPreRenderByDefault);
12301
12323
  return this;
12302
12324
  }
@@ -385,15 +385,11 @@
385
385
  return obj;
386
386
  }
387
387
  const setStyleProperties = (element, styleProperties) => {
388
- if (!element || !styleProperties)
389
- return;
390
388
  Object.keys(styleProperties).forEach((styleProperty) => {
391
389
  element.style[styleProperty] = styleProperties[styleProperty].toString();
392
390
  });
393
391
  };
394
392
  const removeStyleProperties = (element, styleProperties) => {
395
- if (!element || !styleProperties)
396
- return;
397
393
  styleProperties.forEach((styleProperty) => {
398
394
  element.style.removeProperty(styleProperty);
399
395
  });
@@ -10640,7 +10636,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10640
10636
  });
10641
10637
  }
10642
10638
 
10643
- var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^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",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
10639
+ var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^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",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
10644
10640
 
10645
10641
  /**
10646
10642
  * Copyright (c) 2022
@@ -10945,8 +10941,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10945
10941
  else if (contextMenuTrigger === ContextMenuTriggerOptions.RIGHT_CLICK) {
10946
10942
  queryParams[Param.ContextMenuTrigger] = false;
10947
10943
  }
10948
- const spriteUrl = (customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl)
10949
- || ((_d = this.embedConfig.customizations) === null || _d === void 0 ? void 0 : _d.iconSpriteUrl);
10944
+ const spriteUrl = (customizations === null || customizations === void 0 ? void 0 : customizations.iconSpriteUrl) || ((_d = this.embedConfig.customizations) === null || _d === void 0 ? void 0 : _d.iconSpriteUrl);
10950
10945
  if (spriteUrl) {
10951
10946
  queryParams[Param.IconSpriteUrl] = spriteUrl.replace('https://', '');
10952
10947
  }
@@ -11028,10 +11023,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11028
11023
  }
11029
11024
  handleInsertionIntoDOM(child, showPreRenderByDefault = false) {
11030
11025
  if (this.isPreRendered) {
11031
- this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
11026
+ if (!this.viewConfig.preRenderId) {
11027
+ throw Error('PreRender id is required for preRender');
11028
+ }
11029
+ this.insertIntoDOMForPreRender(child, showPreRenderByDefault);
11032
11030
  }
11033
11031
  else {
11034
- this.insertIntoDOM(this.embedConfig.loginFailedMessage);
11032
+ this.insertIntoDOM(child);
11035
11033
  }
11036
11034
  }
11037
11035
  /**
@@ -11104,32 +11102,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11104
11102
  getPreRenderIds() {
11105
11103
  return {
11106
11104
  wrapper: `tsEmbed-pre-render-wrapper-${this.viewConfig.preRenderId}`,
11107
- shield: `tsEmbed-pre-render-shield-${this.viewConfig.preRenderId}`,
11105
+ // shield:
11106
+ // `tsEmbed-pre-render-shield-${this.viewConfig.preRenderId}`,
11108
11107
  child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
11109
11108
  };
11110
11109
  }
11111
- createPreRenderWrapper(child) {
11110
+ createPreRenderWrapper() {
11111
+ var _a;
11112
11112
  if (!this.viewConfig.preRenderId) {
11113
- throw new Error('PreRender id is required');
11113
+ throw new Error('PreRender id is required to create PreRender wrapper');
11114
11114
  }
11115
11115
  const preRenderIds = this.getPreRenderIds();
11116
- [preRenderIds.wrapper, preRenderIds.shield, preRenderIds.child]
11117
- .map((id) => document.getElementById(id))
11118
- .filter((element) => element)
11119
- .forEach((existingElement) => existingElement.remove());
11116
+ (_a = document.getElementById(preRenderIds.wrapper)) === null || _a === void 0 ? void 0 : _a.remove();
11120
11117
  const preRenderWrapper = document.createElement('div');
11121
11118
  preRenderWrapper.id = preRenderIds.wrapper;
11122
- setStyleProperties(preRenderWrapper, { position: 'absolute', width: '100vw', height: '100vh' });
11119
+ const initialPreRenderWrapperStyle = {
11120
+ position: 'absolute',
11121
+ width: '100vw',
11122
+ height: '100vh',
11123
+ };
11124
+ setStyleProperties(preRenderWrapper, initialPreRenderWrapperStyle);
11123
11125
  // const preRenderShield = document.createElement('div');
11124
11126
  // preRenderShield.id = preRenderIds.shield;
11125
11127
  // setStyleProperties(preRenderShield, { position: 'absolute',
11126
11128
  // width: '100%', height: '100%' });
11127
- child.id = preRenderIds.child;
11128
- preRenderWrapper.appendChild(child);
11129
11129
  // preRenderWrapper.appendChild(preRenderShield);
11130
- this.preRenderWrapper = preRenderWrapper;
11130
+ // this.preRenderWrapper = preRenderWrapper;
11131
11131
  // this.preRenderShield = preRenderShield;
11132
- this.preRenderChild = child;
11132
+ // this.preRenderChild = child;
11133
11133
  return preRenderWrapper;
11134
11134
  }
11135
11135
  connectPreRendered() {
@@ -11138,8 +11138,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11138
11138
  || document.getElementById(preRenderIds.wrapper);
11139
11139
  // this.preRenderShield = this.preRenderShield
11140
11140
  // || document.getElementById(preRenderIds.shield);
11141
- this.preRenderChild = this.preRenderChild
11142
- || document.getElementById(preRenderIds.child);
11141
+ this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
11143
11142
  if (this.preRenderWrapper && this.preRenderChild) {
11144
11143
  this.isPreRendered = true;
11145
11144
  this.iFrame = this.preRenderChild;
@@ -11149,17 +11148,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11149
11148
  isPreRenderAvailable() {
11150
11149
  return this.isPreRendered;
11151
11150
  }
11152
- insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
11153
- let childNode;
11151
+ createPreRenderChild(child) {
11152
+ var _a;
11153
+ const preRenderIds = this.getPreRenderIds();
11154
+ (_a = document.getElementById(preRenderIds.child)) === null || _a === void 0 ? void 0 : _a.remove();
11155
+ if (child instanceof HTMLElement) {
11156
+ child.id = preRenderIds.child;
11157
+ return child;
11158
+ }
11159
+ const divChildNode = document.createElement('div');
11160
+ setStyleProperties(divChildNode, { width: '100%', height: '100%' });
11161
+ divChildNode.id = preRenderIds.child;
11154
11162
  if (typeof child === 'string') {
11155
- const divChildNode = document.createElement('div');
11156
11163
  divChildNode.innerHTML = child;
11157
- childNode = divChildNode;
11158
11164
  }
11159
11165
  else {
11160
- childNode = child;
11166
+ divChildNode.appendChild(child);
11167
+ }
11168
+ return divChildNode;
11169
+ }
11170
+ insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
11171
+ const preRenderChild = this.createPreRenderChild(child);
11172
+ const preRenderWrapper = this.createPreRenderWrapper();
11173
+ preRenderWrapper.appendChild(preRenderChild);
11174
+ this.preRenderChild = preRenderChild;
11175
+ this.preRenderWrapper = preRenderWrapper;
11176
+ if (preRenderChild instanceof HTMLIFrameElement) {
11177
+ this.iFrame = preRenderChild;
11161
11178
  }
11162
- const preRenderWrapper = this.createPreRenderWrapper(childNode);
11163
11179
  if (showPreRenderByDefault) {
11164
11180
  this.showPreRender();
11165
11181
  }
@@ -11171,18 +11187,20 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11171
11187
  hidePreRender() {
11172
11188
  if (!this.isPreRenderAvailable()) {
11173
11189
  // if the embed component is not preRendered , nothing to hide
11174
- console.log('No preRender found, not hiding ');
11190
+ console.warn('Warning: You should call PreRender before hiding it using hidePreRender.');
11175
11191
  return;
11176
11192
  }
11177
- setStyleProperties(this.preRenderWrapper, {
11193
+ const preRenderHideStyles = {
11178
11194
  opacity: '0',
11179
11195
  pointerEvents: 'none',
11180
11196
  zIndex: '-1000',
11181
11197
  position: 'absolute ',
11182
11198
  top: '0',
11183
11199
  left: '0',
11184
- });
11185
- const childBoundingRect = this.preRenderChild.getBoundingClientRect();
11200
+ };
11201
+ setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
11202
+ // const childBoundingRect = this.preRenderChild.getBoundingClientRect();
11203
+ //
11186
11204
  // setStyleProperties(this.preRenderShield, {
11187
11205
  // opacity: '0',
11188
11206
  // pointerEvents: 'none',
@@ -11199,10 +11217,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11199
11217
  if (!this.isPreRenderAvailable()) {
11200
11218
  const isAvailable = this.connectPreRendered();
11201
11219
  if (!isAvailable) {
11202
- // if the Embed component is nor preRendered , Render it now and
11203
- // show it (hide is defalt behaviour)
11204
- console.log('No preRender found, creating new ');
11220
+ // if the Embed component is not preRendered , Render it now and
11205
11221
  this.preRender(true);
11222
+ // show it (hide is defalt behaviour)
11223
+ // console.log('No preRender found, creating new ');
11206
11224
  return;
11207
11225
  }
11208
11226
  }
@@ -11217,7 +11235,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11217
11235
  }
11218
11236
  const elBoundingClient = this.el.getBoundingClientRect();
11219
11237
  setStyleProperties(this.preRenderWrapper, {
11220
- top: `${elBoundingClient.y}px`, left: `${elBoundingClient.x}px`, width: `${elBoundingClient.width}px`, height: `${elBoundingClient.height}px`,
11238
+ top: `${elBoundingClient.y}px`,
11239
+ left: `${elBoundingClient.x}px`,
11240
+ width: `${elBoundingClient.width}px`,
11241
+ height: `${elBoundingClient.height}px`,
11221
11242
  });
11222
11243
  }
11223
11244
  insertIntoDOM(child) {
@@ -11832,7 +11853,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11832
11853
  return this;
11833
11854
  }
11834
11855
  preRender(showPreRenderByDefault = false) {
11835
- super.preRender(showPreRenderByDefault);
11856
+ super.preRender();
11836
11857
  this.render(showPreRenderByDefault);
11837
11858
  return this;
11838
11859
  }
@@ -12205,6 +12226,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12205
12226
  *
12206
12227
  * @param renderOptions An object specifying the Liveboard ID,
12207
12228
  * visualization ID and the runtime filters.
12229
+ * @param showPreRenderByDefault
12208
12230
  */
12209
12231
  render(showPreRenderByDefault = false) {
12210
12232
  super.render();
@@ -12213,7 +12235,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12213
12235
  return this;
12214
12236
  }
12215
12237
  preRender(showPreRenderByDefault = false) {
12216
- super.preRender(showPreRenderByDefault);
12238
+ super.preRender();
12217
12239
  this.render(showPreRenderByDefault);
12218
12240
  return this;
12219
12241
  }