@xapp/chat-widget 1.79.0 → 1.79.1

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
@@ -31565,8 +31565,8 @@ var safeStringify = function (arg) {
31565
31565
  return "[Object: ".concat(Object.prototype.toString.call(arg), "]");
31566
31566
  }
31567
31567
  };
31568
- var ErrorOverlay = function () {
31569
- var _a;
31568
+ var ErrorOverlay = function (_a) {
31569
+ var enableErrorOverlay = _a.enableErrorOverlay;
31570
31570
  var _b = React$1.useState([]), errors = _b[0], setErrors = _b[1];
31571
31571
  var _c = React$1.useState(false), isMinimized = _c[0], setIsMinimized = _c[1];
31572
31572
  var _d = React$1.useState(true), isVisible = _d[0], setIsVisible = _d[1];
@@ -31579,7 +31579,7 @@ var ErrorOverlay = function () {
31579
31579
  var _a;
31580
31580
  if (typeof window === "undefined")
31581
31581
  return false;
31582
- // Check localStorage
31582
+ // 1. Check localStorage (highest priority)
31583
31583
  var localStorageSetting = (_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem("xaErrorOverlay");
31584
31584
  if (localStorageSetting === "enabled") {
31585
31585
  console.log("[ErrorOverlay] Enabled via localStorage");
@@ -31589,11 +31589,17 @@ var ErrorOverlay = function () {
31589
31589
  console.log("[ErrorOverlay] Disabled via localStorage");
31590
31590
  return false;
31591
31591
  }
31592
- // Check for React Native dev mode
31592
+ // 2. Check widget configuration
31593
+ if (enableErrorOverlay !== undefined) {
31594
+ console.log("[ErrorOverlay] Using config setting:", enableErrorOverlay);
31595
+ return enableErrorOverlay;
31596
+ }
31597
+ // 3. Check for React Native dev mode
31593
31598
  if (typeof globalThis.__DEV__ !== "undefined" && globalThis.__DEV__) {
31594
31599
  console.log("[ErrorOverlay] Enabled via __DEV__");
31595
31600
  return true;
31596
31601
  }
31602
+ // 4. Default: disabled
31597
31603
  return false;
31598
31604
  };
31599
31605
  var enabled = checkEnabled();
@@ -31604,7 +31610,7 @@ var ErrorOverlay = function () {
31604
31610
  setPosition(savedPosition);
31605
31611
  }
31606
31612
  console.log("[ErrorOverlay] Component mounted, enabled:", enabled, "position:", savedPosition || "bottom");
31607
- }, []);
31613
+ }, [enableErrorOverlay]);
31608
31614
  // Define addError with useCallback to prevent stale closures
31609
31615
  var addError = React$1.useCallback(function (error) {
31610
31616
  console.log("[ErrorOverlay] Adding error:", error);
@@ -31757,30 +31763,9 @@ var ErrorOverlay = function () {
31757
31763
  window.localStorage.setItem("xaErrorOverlayPosition", newPosition);
31758
31764
  }
31759
31765
  };
31760
- // Don't render if not enabled
31766
+ // Don't render anything if not enabled
31761
31767
  if (!isEnabled) {
31762
- // Show a small, subtle toggle button to enable (only visible on hover)
31763
- return (React$1.createElement("button", { onClick: toggleEnabled, style: (_a = {
31764
- position: "fixed"
31765
- },
31766
- _a[position] = "10px",
31767
- _a.right = "10px",
31768
- _a.zIndex = 999999,
31769
- _a.background = "#ff6b6b",
31770
- _a.color = "white",
31771
- _a.border = "none",
31772
- _a.borderRadius = "6px",
31773
- _a.padding = "8px 12px",
31774
- _a.fontSize = "20px",
31775
- _a.cursor = "pointer",
31776
- _a.opacity = 0.1, // Very subtle by default
31777
- _a.transition = "opacity 0.2s",
31778
- _a.minWidth = "44px",
31779
- _a.minHeight = "44px",
31780
- _a.display = "flex",
31781
- _a.alignItems = "center",
31782
- _a.justifyContent = "center",
31783
- _a), onMouseEnter: function (e) { return (e.currentTarget.style.opacity = "0.8"); }, onMouseLeave: function (e) { return (e.currentTarget.style.opacity = "0.1"); }, title: "Enable Error Overlay (for debugging)" }, "\uD83D\uDC1B"));
31768
+ return null;
31784
31769
  }
31785
31770
  // If enabled but not visible (user closed it), don't render
31786
31771
  if (!isVisible) {
@@ -32167,7 +32152,7 @@ var ChatWidget = function (props) {
32167
32152
  React$1.createElement("div", { className: "restartModal", ref: modalRef, onClick: handleRestartModalCloseClick },
32168
32153
  React$1.createElement(ModalContent, { onClose: handleRestartModalCloseClick, onReset: handleReset }))),
32169
32154
  React$1.createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: config === null || config === void 0 ? void 0 : config.cta, imageUrl: (_6 = config === null || config === void 0 ? void 0 : config.chatButton) === null || _6 === void 0 ? void 0 : _6.imageUrl, visible: visible, hasInteracted: (_7 = chatState.visuals) === null || _7 === void 0 ? void 0 : _7.hasInteracted, onCtaDismiss: handleCtaDismiss }),
32170
- React$1.createElement(ErrorOverlay, null)));
32155
+ React$1.createElement(ErrorOverlay, { enableErrorOverlay: config === null || config === void 0 ? void 0 : config.enableErrorOverlay })));
32171
32156
  };
32172
32157
 
32173
32158
  // src/utils/formatProdErrorMessage.ts