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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/embed/app.d.ts +1 -3
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +2 -8
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/liveboard.d.ts +1 -2
  7. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  8. package/cjs/src/embed/liveboard.js +2 -7
  9. package/cjs/src/embed/liveboard.js.map +1 -1
  10. package/cjs/src/embed/sage.d.ts +1 -3
  11. package/cjs/src/embed/sage.d.ts.map +1 -1
  12. package/cjs/src/embed/sage.js +2 -8
  13. package/cjs/src/embed/sage.js.map +1 -1
  14. package/cjs/src/embed/search.d.ts +1 -4
  15. package/cjs/src/embed/search.d.ts.map +1 -1
  16. package/cjs/src/embed/search.js +2 -9
  17. package/cjs/src/embed/search.js.map +1 -1
  18. package/cjs/src/embed/ts-embed.d.ts +47 -17
  19. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  20. package/cjs/src/embed/ts-embed.js +144 -99
  21. package/cjs/src/embed/ts-embed.js.map +1 -1
  22. package/cjs/src/embed/ts-embed.spec.js +102 -0
  23. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  24. package/cjs/src/react/all-types-export.d.ts +1 -1
  25. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  26. package/cjs/src/react/all-types-export.js +6 -2
  27. package/cjs/src/react/all-types-export.js.map +1 -1
  28. package/cjs/src/react/index.d.ts +103 -5
  29. package/cjs/src/react/index.d.ts.map +1 -1
  30. package/cjs/src/react/index.js +81 -1
  31. package/cjs/src/react/index.js.map +1 -1
  32. package/cjs/src/react/index.spec.js +22 -0
  33. package/cjs/src/react/index.spec.js.map +1 -1
  34. package/cjs/src/types.d.ts +18 -0
  35. package/cjs/src/types.d.ts.map +1 -1
  36. package/cjs/src/types.js.map +1 -1
  37. package/cjs/src/utils.d.ts +27 -0
  38. package/cjs/src/utils.d.ts.map +1 -1
  39. package/cjs/src/utils.js +29 -2
  40. package/cjs/src/utils.js.map +1 -1
  41. package/cjs/src/utils.spec.d.ts +0 -3
  42. package/cjs/src/utils.spec.d.ts.map +1 -1
  43. package/cjs/src/utils.spec.js +59 -6
  44. package/cjs/src/utils.spec.js.map +1 -1
  45. package/dist/src/embed/app.d.ts +1 -3
  46. package/dist/src/embed/app.d.ts.map +1 -1
  47. package/dist/src/embed/liveboard.d.ts +1 -2
  48. package/dist/src/embed/liveboard.d.ts.map +1 -1
  49. package/dist/src/embed/sage.d.ts +1 -3
  50. package/dist/src/embed/sage.d.ts.map +1 -1
  51. package/dist/src/embed/search.d.ts +1 -4
  52. package/dist/src/embed/search.d.ts.map +1 -1
  53. package/dist/src/embed/ts-embed.d.ts +47 -17
  54. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  55. package/dist/src/react/all-types-export.d.ts +1 -1
  56. package/dist/src/react/all-types-export.d.ts.map +1 -1
  57. package/dist/src/react/index.d.ts +103 -5
  58. package/dist/src/react/index.d.ts.map +1 -1
  59. package/dist/src/types.d.ts +18 -0
  60. package/dist/src/types.d.ts.map +1 -1
  61. package/dist/src/utils.d.ts +27 -0
  62. package/dist/src/utils.d.ts.map +1 -1
  63. package/dist/src/utils.spec.d.ts +0 -3
  64. package/dist/src/utils.spec.d.ts.map +1 -1
  65. package/dist/tsembed-react.es.js +263 -135
  66. package/dist/tsembed-react.js +263 -134
  67. package/dist/tsembed.es.js +182 -134
  68. package/dist/tsembed.js +182 -134
  69. package/dist/visual-embed-sdk-react-full.d.ts +166 -33
  70. package/dist/visual-embed-sdk-react.d.ts +166 -33
  71. package/dist/visual-embed-sdk.d.ts +63 -28
  72. package/lib/package.json +1 -1
  73. package/lib/src/embed/app.d.ts +1 -3
  74. package/lib/src/embed/app.d.ts.map +1 -1
  75. package/lib/src/embed/app.js +2 -8
  76. package/lib/src/embed/app.js.map +1 -1
  77. package/lib/src/embed/liveboard.d.ts +1 -2
  78. package/lib/src/embed/liveboard.d.ts.map +1 -1
  79. package/lib/src/embed/liveboard.js +2 -7
  80. package/lib/src/embed/liveboard.js.map +1 -1
  81. package/lib/src/embed/sage.d.ts +1 -3
  82. package/lib/src/embed/sage.d.ts.map +1 -1
  83. package/lib/src/embed/sage.js +2 -8
  84. package/lib/src/embed/sage.js.map +1 -1
  85. package/lib/src/embed/search.d.ts +1 -4
  86. package/lib/src/embed/search.d.ts.map +1 -1
  87. package/lib/src/embed/search.js +2 -9
  88. package/lib/src/embed/search.js.map +1 -1
  89. package/lib/src/embed/ts-embed.d.ts +47 -17
  90. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  91. package/lib/src/embed/ts-embed.js +144 -99
  92. package/lib/src/embed/ts-embed.js.map +1 -1
  93. package/lib/src/embed/ts-embed.spec.js +102 -0
  94. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  95. package/lib/src/react/all-types-export.d.ts +1 -1
  96. package/lib/src/react/all-types-export.d.ts.map +1 -1
  97. package/lib/src/react/all-types-export.js +1 -1
  98. package/lib/src/react/all-types-export.js.map +1 -1
  99. package/lib/src/react/index.d.ts +103 -5
  100. package/lib/src/react/index.d.ts.map +1 -1
  101. package/lib/src/react/index.js +80 -0
  102. package/lib/src/react/index.js.map +1 -1
  103. package/lib/src/react/index.spec.js +23 -1
  104. package/lib/src/react/index.spec.js.map +1 -1
  105. package/lib/src/types.d.ts +18 -0
  106. package/lib/src/types.d.ts.map +1 -1
  107. package/lib/src/types.js.map +1 -1
  108. package/lib/src/utils.d.ts +27 -0
  109. package/lib/src/utils.d.ts.map +1 -1
  110. package/lib/src/utils.js +29 -2
  111. package/lib/src/utils.js.map +1 -1
  112. package/lib/src/utils.spec.d.ts +0 -3
  113. package/lib/src/utils.spec.d.ts.map +1 -1
  114. package/lib/src/utils.spec.js +60 -7
  115. package/lib/src/utils.spec.js.map +1 -1
  116. package/lib/src/visual-embed-sdk.d.ts +63 -28
  117. package/package.json +1 -1
  118. package/src/embed/app.ts +6 -11
  119. package/src/embed/liveboard.ts +2 -10
  120. package/src/embed/sage.ts +2 -11
  121. package/src/embed/search.ts +2 -12
  122. package/src/embed/ts-embed.spec.ts +127 -0
  123. package/src/embed/ts-embed.ts +170 -128
  124. package/src/react/all-types-export.ts +5 -1
  125. package/src/react/index.spec.tsx +42 -1
  126. package/src/react/index.tsx +120 -17
  127. package/src/types.ts +19 -0
  128. package/src/utils.spec.ts +78 -7
  129. package/src/utils.ts +30 -7
package/dist/tsembed.js CHANGED
@@ -268,15 +268,42 @@
268
268
  }
269
269
  return obj;
270
270
  }
271
+ /**
272
+ * Sets the specified style properties on an HTML element.
273
+ *
274
+ * @param {HTMLElement} element - The HTML element to which the styles should be applied.
275
+ * @param {Partial<CSSStyleDeclaration>} styleProperties - An object containing style
276
+ * property names and their values.
277
+ * @example
278
+ * // Apply styles to an element
279
+ * const element = document.getElementById('myElement');
280
+ * const styles = {
281
+ * backgroundColor: 'red',
282
+ * fontSize: '16px',
283
+ * };
284
+ * setStyleProperties(element, styles);
285
+ */
271
286
  const setStyleProperties = (element, styleProperties) => {
272
- if (!element || !styleProperties)
287
+ if (!(element === null || element === void 0 ? void 0 : element.style))
273
288
  return;
274
289
  Object.keys(styleProperties).forEach((styleProperty) => {
275
290
  element.style[styleProperty] = styleProperties[styleProperty].toString();
276
291
  });
277
292
  };
293
+ /**
294
+ * Removes specified style properties from an HTML element.
295
+ *
296
+ * @param {HTMLElement} element - The HTML element from which the styles should be removed.
297
+ * @param {string[]} styleProperties - An array of style property names to be removed.
298
+ * @example
299
+ * // Remove styles from an element
300
+ * const element = document.getElementById('myElement');
301
+ * element.style.backgroundColor = 'red';
302
+ * const propertiesToRemove = ['backgroundColor'];
303
+ * removeStyleProperties(element, propertiesToRemove);
304
+ */
278
305
  const removeStyleProperties = (element, styleProperties) => {
279
- if (!element || !styleProperties)
306
+ if (!(element === null || element === void 0 ? void 0 : element.style))
280
307
  return;
281
308
  styleProperties.forEach((styleProperty) => {
282
309
  element.style.removeProperty(styleProperty);
@@ -11507,7 +11534,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11507
11534
  });
11508
11535
  }
11509
11536
 
11510
- 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};
11537
+ var name="@thoughtspot/visual-embed-sdk";var version="1.24.0-preRender.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./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};
11511
11538
 
11512
11539
  /**
11513
11540
  * Copyright (c) 2022
@@ -11607,6 +11634,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11607
11634
  this.on(exports.EmbedEvent.APP_INIT, this.appInitCb, { start: false }, true);
11608
11635
  this.on(exports.EmbedEvent.AuthExpire, this.updateAuthToken, { start: false }, true);
11609
11636
  };
11637
+ this.showPreRenderByDefault = false;
11610
11638
  this.el = getDOMNode(domSelector);
11611
11639
  // TODO: handle error
11612
11640
  this.embedConfig = getEmbedConfig();
@@ -11893,12 +11921,12 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11893
11921
  iFrame.name = 'ThoughtSpot Embedded Analytics';
11894
11922
  return iFrame;
11895
11923
  }
11896
- handleInsertionIntoDOM(child, showPreRenderByDefault = false) {
11924
+ handleInsertionIntoDOM(child) {
11897
11925
  if (this.isPreRendered) {
11898
- this.insertIntoDOMForPreRender(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
11926
+ this.insertIntoDOMForPreRender(child);
11899
11927
  }
11900
11928
  else {
11901
- this.insertIntoDOM(this.embedConfig.loginFailedMessage);
11929
+ this.insertIntoDOM(child);
11902
11930
  }
11903
11931
  }
11904
11932
  /**
@@ -11906,9 +11934,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11906
11934
  * event listeners.
11907
11935
  *
11908
11936
  * @param url - The URL of the embedded ThoughtSpot app.
11909
- * @param showPreRenderByDefault - The flag to show the preRender by default.
11910
11937
  */
11911
- async renderIFrame(url, showPreRenderByDefault = false) {
11938
+ async renderIFrame(url) {
11912
11939
  if (this.isError) {
11913
11940
  return null;
11914
11941
  }
@@ -11928,7 +11955,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11928
11955
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
11929
11956
  return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
11930
11957
  if (!isLoggedIn) {
11931
- this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage, showPreRenderByDefault);
11958
+ this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
11932
11959
  return;
11933
11960
  }
11934
11961
  this.iFrame = this.iFrame || this.createIframeEl(url);
@@ -11950,7 +11977,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11950
11977
  this.iFrame.addEventListener('error', () => {
11951
11978
  nextInQueue();
11952
11979
  });
11953
- this.handleInsertionIntoDOM(this.iFrame, showPreRenderByDefault);
11980
+ this.handleInsertionIntoDOM(this.iFrame);
11954
11981
  const prefetchIframe = document.querySelectorAll('.prefetchIframe');
11955
11982
  if (prefetchIframe.length) {
11956
11983
  prefetchIframe.forEach((el) => {
@@ -11968,45 +11995,28 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11968
11995
  });
11969
11996
  });
11970
11997
  }
11971
- getPreRenderIds() {
11972
- return {
11973
- wrapper: `tsEmbed-pre-render-wrapper-${this.viewConfig.preRenderId}`,
11974
- shield: `tsEmbed-pre-render-shield-${this.viewConfig.preRenderId}`,
11975
- child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
11976
- };
11977
- }
11978
- createPreRenderWrapper(child) {
11998
+ createPreRenderWrapper() {
11999
+ var _a;
11979
12000
  if (!this.viewConfig.preRenderId) {
11980
- throw new Error('PreRender id is required');
12001
+ throw new Error('PreRender id is required to create PreRender wrapper');
11981
12002
  }
11982
12003
  const preRenderIds = this.getPreRenderIds();
11983
- [preRenderIds.wrapper, preRenderIds.shield, preRenderIds.child]
11984
- .map((id) => document.getElementById(id))
11985
- .filter((element) => element)
11986
- .forEach((existingElement) => existingElement.remove());
12004
+ (_a = document.getElementById(preRenderIds.wrapper)) === null || _a === void 0 ? void 0 : _a.remove();
11987
12005
  const preRenderWrapper = document.createElement('div');
11988
12006
  preRenderWrapper.id = preRenderIds.wrapper;
11989
- setStyleProperties(preRenderWrapper, { position: 'absolute', width: '100vw', height: '100vh' });
11990
- // const preRenderShield = document.createElement('div');
11991
- // preRenderShield.id = preRenderIds.shield;
11992
- // setStyleProperties(preRenderShield, { position: 'absolute',
11993
- // width: '100%', height: '100%' });
11994
- child.id = preRenderIds.child;
11995
- preRenderWrapper.appendChild(child);
11996
- // preRenderWrapper.appendChild(preRenderShield);
11997
- this.preRenderWrapper = preRenderWrapper;
11998
- // this.preRenderShield = preRenderShield;
11999
- this.preRenderChild = child;
12007
+ const initialPreRenderWrapperStyle = {
12008
+ position: 'absolute',
12009
+ width: '100vw',
12010
+ height: '100vh',
12011
+ };
12012
+ setStyleProperties(preRenderWrapper, initialPreRenderWrapperStyle);
12000
12013
  return preRenderWrapper;
12001
12014
  }
12002
12015
  connectPreRendered() {
12003
12016
  const preRenderIds = this.getPreRenderIds();
12004
12017
  this.preRenderWrapper = this.preRenderWrapper
12005
12018
  || document.getElementById(preRenderIds.wrapper);
12006
- // this.preRenderShield = this.preRenderShield
12007
- // || document.getElementById(preRenderIds.shield);
12008
- this.preRenderChild = this.preRenderChild
12009
- || document.getElementById(preRenderIds.child);
12019
+ this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
12010
12020
  if (this.preRenderWrapper && this.preRenderChild) {
12011
12021
  this.isPreRendered = true;
12012
12022
  this.iFrame = this.preRenderChild;
@@ -12014,79 +12024,45 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12014
12024
  return this.isPreRenderAvailable();
12015
12025
  }
12016
12026
  isPreRenderAvailable() {
12017
- return this.isPreRendered;
12027
+ return this.isPreRendered && Boolean(this.preRenderWrapper && this.preRenderChild);
12018
12028
  }
12019
- insertIntoDOMForPreRender(child, showPreRenderByDefault = false) {
12020
- let childNode;
12029
+ createPreRenderChild(child) {
12030
+ var _a;
12031
+ const preRenderIds = this.getPreRenderIds();
12032
+ (_a = document.getElementById(preRenderIds.child)) === null || _a === void 0 ? void 0 : _a.remove();
12033
+ if (child instanceof HTMLElement) {
12034
+ child.id = preRenderIds.child;
12035
+ return child;
12036
+ }
12037
+ const divChildNode = document.createElement('div');
12038
+ setStyleProperties(divChildNode, { width: '100%', height: '100%' });
12039
+ divChildNode.id = preRenderIds.child;
12021
12040
  if (typeof child === 'string') {
12022
- const divChildNode = document.createElement('div');
12023
12041
  divChildNode.innerHTML = child;
12024
- childNode = divChildNode;
12025
12042
  }
12026
12043
  else {
12027
- childNode = child;
12044
+ divChildNode.appendChild(child);
12045
+ }
12046
+ return divChildNode;
12047
+ }
12048
+ insertIntoDOMForPreRender(child) {
12049
+ const preRenderChild = this.createPreRenderChild(child);
12050
+ const preRenderWrapper = this.createPreRenderWrapper();
12051
+ preRenderWrapper.appendChild(preRenderChild);
12052
+ this.preRenderChild = preRenderChild;
12053
+ this.preRenderWrapper = preRenderWrapper;
12054
+ if (preRenderChild instanceof HTMLIFrameElement) {
12055
+ this.iFrame = preRenderChild;
12028
12056
  }
12029
- const preRenderWrapper = this.createPreRenderWrapper(childNode);
12030
- if (showPreRenderByDefault) {
12057
+ if (this.showPreRenderByDefault) {
12031
12058
  this.showPreRender();
12032
12059
  }
12033
12060
  else {
12034
12061
  this.hidePreRender();
12035
12062
  }
12063
+ this.insertedDomEl = preRenderWrapper;
12036
12064
  document.body.appendChild(preRenderWrapper);
12037
12065
  }
12038
- hidePreRender() {
12039
- if (!this.isPreRenderAvailable()) {
12040
- // if the embed component is not preRendered , nothing to hide
12041
- console.log('No preRender found, not hiding ');
12042
- return;
12043
- }
12044
- setStyleProperties(this.preRenderWrapper, {
12045
- opacity: '0',
12046
- pointerEvents: 'none',
12047
- zIndex: '-1000',
12048
- position: 'absolute ',
12049
- top: '0',
12050
- left: '0',
12051
- });
12052
- const childBoundingRect = this.preRenderChild.getBoundingClientRect();
12053
- // setStyleProperties(this.preRenderShield, {
12054
- // opacity: '0',
12055
- // pointerEvents: 'none',
12056
- // zIndex: '1',
12057
- // width: `${childBoundingRect.width}px`,
12058
- // height: `${childBoundingRect.height}px`,
12059
- // position: 'absolute',
12060
- // top: '0',
12061
- // left: '0',
12062
- // });
12063
- this.unsubscribeToEvents();
12064
- }
12065
- showPreRender() {
12066
- if (!this.isPreRenderAvailable()) {
12067
- const isAvailable = this.connectPreRendered();
12068
- if (!isAvailable) {
12069
- // if the Embed component is nor preRendered , Render it now and
12070
- // show it (hide is defalt behaviour)
12071
- console.log('No preRender found, creating new ');
12072
- this.preRender(true);
12073
- return;
12074
- }
12075
- }
12076
- this.syncPreRenderStyle();
12077
- removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
12078
- // setStyleProperties(this.preRenderShield, { zIndex: '-1' });
12079
- this.subscribeToEvents();
12080
- }
12081
- syncPreRenderStyle() {
12082
- if (!this.el) {
12083
- throw new Error('Embed element is not defined');
12084
- }
12085
- const elBoundingClient = this.el.getBoundingClientRect();
12086
- setStyleProperties(this.preRenderWrapper, {
12087
- top: `${elBoundingClient.y}px`, left: `${elBoundingClient.x}px`, width: `${elBoundingClient.width}px`, height: `${elBoundingClient.height}px`,
12088
- });
12089
- }
12090
12066
  insertIntoDOM(child) {
12091
12067
  var _a;
12092
12068
  if (this.viewConfig.insertAsSibling) {
@@ -12304,10 +12280,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12304
12280
  /**
12305
12281
  * Creates the preRender shell
12306
12282
  *
12307
- * @param showPreRenderByDefault
12283
+ * @param showPreRenderByDefault - Show the preRender after render, hidden by default
12308
12284
  */
12309
12285
  preRender(showPreRenderByDefault = false) {
12286
+ if (!this.viewConfig.preRenderId) {
12287
+ console.error('PreRender id is required for preRender');
12288
+ return this;
12289
+ }
12310
12290
  this.isPreRendered = true;
12291
+ this.showPreRenderByDefault = showPreRenderByDefault;
12292
+ this.render();
12311
12293
  return this;
12312
12294
  }
12313
12295
  /**
@@ -12366,6 +12348,97 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12366
12348
  const prerenderFrameSrc = this.getRootIframeSrc();
12367
12349
  return this.renderIFrame(prerenderFrameSrc);
12368
12350
  }
12351
+ /**
12352
+ * Displays the PreRender component.
12353
+ * If the component is not preRendered, it attempts to create and render it.
12354
+ * Also, synchronizes the style of the PreRender component with the embedding
12355
+ * element.
12356
+ */
12357
+ showPreRender() {
12358
+ if (!this.isPreRenderAvailable()) {
12359
+ const isAvailable = this.connectPreRendered();
12360
+ if (!isAvailable) {
12361
+ // if the Embed component is not preRendered , Render it now and
12362
+ this.preRender(true);
12363
+ return;
12364
+ }
12365
+ }
12366
+ if (this.el) {
12367
+ this.syncPreRenderStyle();
12368
+ this.resizeObserver = new ResizeObserver((entries) => {
12369
+ entries.forEach((entry) => {
12370
+ if (entry.contentRect && entry.target === this.el) {
12371
+ setStyleProperties(this.preRenderWrapper, {
12372
+ width: `${entry.contentRect.width}px`,
12373
+ height: `${entry.contentRect.height}px`,
12374
+ });
12375
+ }
12376
+ });
12377
+ });
12378
+ this.resizeObserver.observe(this.el);
12379
+ }
12380
+ removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
12381
+ this.subscribeToEvents();
12382
+ }
12383
+ /**
12384
+ * Synchronizes the style properties of the PreRender component with the embedding
12385
+ * element. This function adjusts the position, width, and height of the PreRender
12386
+ * component
12387
+ * to match the dimensions and position of the embedding element.
12388
+ *
12389
+ * @throws {Error} Throws an error if the embedding element (passed as domSelector)
12390
+ * is not defined or not found.
12391
+ */
12392
+ syncPreRenderStyle() {
12393
+ if (!this.el) {
12394
+ throw new Error('Embed element is not defined');
12395
+ }
12396
+ const elBoundingClient = this.el.getBoundingClientRect();
12397
+ setStyleProperties(this.preRenderWrapper, {
12398
+ top: `${elBoundingClient.y}px`,
12399
+ left: `${elBoundingClient.x}px`,
12400
+ width: `${elBoundingClient.width}px`,
12401
+ height: `${elBoundingClient.height}px`,
12402
+ });
12403
+ }
12404
+ /**
12405
+ * Hides the PreRender component if it is available.
12406
+ * If the component is not preRendered, it issues a warning.
12407
+ */
12408
+ hidePreRender() {
12409
+ if (!this.isPreRenderAvailable()) {
12410
+ // if the embed component is not preRendered , nothing to hide
12411
+ console.warn('Warning: You should call PreRender before hiding it using hidePreRender.');
12412
+ return;
12413
+ }
12414
+ const preRenderHideStyles = {
12415
+ opacity: '0',
12416
+ pointerEvents: 'none',
12417
+ zIndex: '-1000',
12418
+ position: 'absolute ',
12419
+ top: '0',
12420
+ left: '0',
12421
+ };
12422
+ setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
12423
+ if (this.resizeObserver) {
12424
+ this.resizeObserver.disconnect();
12425
+ }
12426
+ this.unsubscribeToEvents();
12427
+ }
12428
+ /**
12429
+ * Retrieves unique HTML element IDs for PreRender-related elements.
12430
+ * These IDs are constructed based on the provided 'preRenderId' from 'viewConfig'.
12431
+ *
12432
+ * @returns {object} An object containing the IDs for the PreRender elements.
12433
+ * @property {string} wrapper - The HTML element ID for the PreRender wrapper.
12434
+ * @property {string} child - The HTML element ID for the PreRender child.
12435
+ */
12436
+ getPreRenderIds() {
12437
+ return {
12438
+ wrapper: `tsEmbed-pre-render-wrapper-${this.viewConfig.preRenderId}`,
12439
+ child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
12440
+ };
12441
+ }
12369
12442
  }
12370
12443
  /**
12371
12444
  * Base class for embedding v1 experience
@@ -12383,10 +12456,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12383
12456
  * Render the app in an iframe and set up event handlers
12384
12457
  *
12385
12458
  * @param iframeSrc
12386
- * @param showPreRenderByDefault - if true the preRender will be shown by default
12387
12459
  */
12388
- renderV1Embed(iframeSrc, showPreRenderByDefault = false) {
12389
- return this.renderIFrame(iframeSrc, showPreRenderByDefault);
12460
+ renderV1Embed(iframeSrc) {
12461
+ return this.renderIFrame(iframeSrc);
12390
12462
  }
12391
12463
  getRootIframeSrc() {
12392
12464
  const queryParams = this.getEmbedParams();
@@ -12624,17 +12696,11 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12624
12696
  *
12625
12697
  * @param renderOptions An object containing the page ID
12626
12698
  * to be embedded.
12627
- * @param showPreRenderByDefault
12628
12699
  */
12629
- render(showPreRenderByDefault = false) {
12700
+ render() {
12630
12701
  super.render();
12631
12702
  const src = this.getIFrameSrc();
12632
- this.renderV1Embed(src, showPreRenderByDefault);
12633
- return this;
12634
- }
12635
- preRender(showPreRenderByDefault = false) {
12636
- super.preRender(showPreRenderByDefault);
12637
- this.render(showPreRenderByDefault);
12703
+ this.renderV1Embed(src);
12638
12704
  return this;
12639
12705
  }
12640
12706
  }
@@ -12791,15 +12857,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12791
12857
  * @param renderOptions An object specifying the Liveboard ID,
12792
12858
  * visualization ID and the runtime filters.
12793
12859
  */
12794
- render(showPreRenderByDefault = false) {
12860
+ render() {
12795
12861
  super.render();
12796
12862
  const src = this.getIFrameSrc();
12797
- this.renderV1Embed(src, showPreRenderByDefault);
12798
- return this;
12799
- }
12800
- preRender(showPreRenderByDefault = false) {
12801
- super.preRender(showPreRenderByDefault);
12802
- this.render(showPreRenderByDefault);
12863
+ this.renderV1Embed(src);
12803
12864
  return this;
12804
12865
  }
12805
12866
  navigateToLiveboard(liveboardId, vizId, activeTabId) {
@@ -12925,14 +12986,12 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12925
12986
  }
12926
12987
  /**
12927
12988
  * Render the embedded ThoughtSpot search
12928
- *
12929
- * @param showPreRenderByDefault
12930
12989
  */
12931
- render(showPreRenderByDefault = false) {
12990
+ render() {
12932
12991
  super.render();
12933
12992
  const { answerId } = this.viewConfig;
12934
12993
  const src = this.getIFrameSrc(answerId);
12935
- this.renderIFrame(src, showPreRenderByDefault);
12994
+ this.renderIFrame(src);
12936
12995
  getAuthPromise().then(() => {
12937
12996
  if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
12938
12997
  alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
@@ -12940,11 +12999,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12940
12999
  });
12941
13000
  return this;
12942
13001
  }
12943
- preRender(showPreRenderByDefault = false) {
12944
- super.preRender(showPreRenderByDefault);
12945
- this.render(showPreRenderByDefault);
12946
- return this;
12947
- }
12948
13002
  }
12949
13003
 
12950
13004
  /**
@@ -13087,18 +13141,12 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13087
13141
  /**
13088
13142
  * Render the embedded ThoughtSpot Sage
13089
13143
  *
13090
- * @param showPreRenderByDefault
13091
13144
  * @returns {SageEmbed} Eureka/Sage embed
13092
13145
  */
13093
- render(showPreRenderByDefault = false) {
13146
+ render() {
13094
13147
  super.render();
13095
13148
  const src = this.getIFrameSrc();
13096
- this.renderV1Embed(src, showPreRenderByDefault);
13097
- return this;
13098
- }
13099
- preRender(showPreRenderByDefault = false) {
13100
- super.preRender(showPreRenderByDefault);
13101
- this.render(showPreRenderByDefault);
13149
+ this.renderV1Embed(src);
13102
13150
  return this;
13103
13151
  }
13104
13152
  }