@mushi-mushi/web 1.7.6 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3690,6 +3690,7 @@ var DEFAULT_REDACT_SELECTORS = [
3690
3690
  ];
3691
3691
  function buildPrivacySafeDocument(privacy) {
3692
3692
  const clone = document.documentElement.cloneNode(true);
3693
+ clone.querySelector("#mushi-mushi-widget")?.remove();
3693
3694
  const redactSelectors = privacy?.redactSelectors !== void 0 ? privacy.redactSelectors : DEFAULT_REDACT_SELECTORS;
3694
3695
  for (const selector of redactSelectors) {
3695
3696
  for (const el of safeQueryAll(clone, selector)) {
@@ -4779,7 +4780,7 @@ function createProactiveManager(config = {}) {
4779
4780
 
4780
4781
  // src/version.ts
4781
4782
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
4782
- var MUSHI_SDK_VERSION = "1.7.6" ;
4783
+ var MUSHI_SDK_VERSION = "1.7.7" ;
4783
4784
 
4784
4785
  // src/mushi.ts
4785
4786
  var instance = null;
@@ -4960,13 +4961,30 @@ function createInstance(config) {
4960
4961
  });
4961
4962
  let detachAutoBreadcrumbs = null;
4962
4963
  detachAutoBreadcrumbs = installAutoBreadcrumbs(breadcrumbs);
4964
+ async function takeScreenshotWithoutChrome() {
4965
+ if (!screenshotCap) return null;
4966
+ const panelWasVisible = widget.getIsOpen();
4967
+ if (panelWasVisible) widget.hidePanel();
4968
+ const host = document.getElementById("mushi-mushi-widget");
4969
+ const prevVisibility = host?.style.visibility ?? "";
4970
+ if (host) host.style.visibility = "hidden";
4971
+ await new Promise((resolve) => {
4972
+ requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
4973
+ });
4974
+ try {
4975
+ return await screenshotCap.take();
4976
+ } finally {
4977
+ if (host) host.style.visibility = prevVisibility;
4978
+ if (panelWasVisible) widget.showPanel();
4979
+ }
4980
+ }
4963
4981
  async function autoCaptureScreenshot(when) {
4964
4982
  const mode = activeConfig.capture?.screenshot;
4965
4983
  if (!screenshotCap || mode === "off" || pendingScreenshot) return;
4966
4984
  if (when === "open" && mode !== "auto") return;
4967
4985
  if (when === "submit" && mode !== "on-report" && mode !== "auto") return;
4968
4986
  log.debug("Auto-capturing screenshot", { when, mode });
4969
- pendingScreenshot = await screenshotCap.take();
4987
+ pendingScreenshot = await takeScreenshotWithoutChrome();
4970
4988
  widget.setScreenshotAttached(pendingScreenshot !== null);
4971
4989
  }
4972
4990
  widget = new MushiWidget(bootstrapConfig.widget, {
@@ -4996,7 +5014,7 @@ function createInstance(config) {
4996
5014
  onScreenshotRequest: async () => {
4997
5015
  if (!screenshotCap || activeConfig.capture?.screenshot === "off") return;
4998
5016
  log.debug("Taking screenshot");
4999
- pendingScreenshot = await screenshotCap.take();
5017
+ pendingScreenshot = await takeScreenshotWithoutChrome();
5000
5018
  widget.setScreenshotAttached(pendingScreenshot !== null);
5001
5019
  },
5002
5020
  onScreenshotRemove: () => {