@deepfrog/pangents-widget 2.1.6 → 2.2.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/README.md +55 -0
- package/dist/Widget.d.ts +2 -1
- package/dist/components/WidgetBubble.d.ts +2 -1
- package/dist/components/WidgetPopup.d.ts +2 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/{widget-embed-LzSoeVtX.es.js → widget-embed-B3A5H6pf.es.js} +40 -24
- package/dist/widget-embed-B3A5H6pf.es.js.map +1 -0
- package/dist/{widget-embed-9DdEqVMP.cjs.js → widget-embed-DgFZhnDu.cjs.js} +3 -3
- package/dist/widget-embed-DgFZhnDu.cjs.js.map +1 -0
- package/dist/widget-embed.cjs.js +1 -1
- package/dist/widget-embed.es.js +1 -1
- package/dist/widget.js +38 -22
- package/package.json +2 -2
- package/dist/widget-embed-9DdEqVMP.cjs.js.map +0 -1
- package/dist/widget-embed-LzSoeVtX.es.js.map +0 -1
package/dist/widget-embed.cjs.js
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
}
|
|
7
7
|
} catch (error) {}
|
|
8
8
|
})();
|
|
9
|
-
"use strict";require("react/jsx-runtime"),require("react");const e=require("./widget-embed-
|
|
9
|
+
"use strict";require("react/jsx-runtime"),require("react");const e=require("./widget-embed-DgFZhnDu.cjs.js");module.exports=e.Chatbot;
|
|
10
10
|
//# sourceMappingURL=widget-embed.cjs.js.map
|
package/dist/widget-embed.es.js
CHANGED
package/dist/widget.js
CHANGED
|
@@ -23700,7 +23700,7 @@ class EnhancedErrorHandler {
|
|
|
23700
23700
|
// 30 seconds
|
|
23701
23701
|
constructor() {
|
|
23702
23702
|
__publicField(this, "errorQueue", []);
|
|
23703
|
-
__publicField(this, "isOnline", navigator.onLine);
|
|
23703
|
+
__publicField(this, "isOnline", typeof navigator !== "undefined" ? navigator.onLine : true);
|
|
23704
23704
|
__publicField(this, "maxQueueSize", 50);
|
|
23705
23705
|
// Reduced from 100
|
|
23706
23706
|
__publicField(this, "retryAttempts", 2);
|
|
@@ -23716,6 +23716,7 @@ class EnhancedErrorHandler {
|
|
|
23716
23716
|
}
|
|
23717
23717
|
// Setup event listeners for online/offline status
|
|
23718
23718
|
setupEventListeners() {
|
|
23719
|
+
if (typeof window === "undefined") return;
|
|
23719
23720
|
window.addEventListener("online", () => {
|
|
23720
23721
|
this.isOnline = true;
|
|
23721
23722
|
this.flushErrorQueue();
|
|
@@ -23782,8 +23783,8 @@ class EnhancedErrorHandler {
|
|
|
23782
23783
|
action: (context == null ? void 0 : context.action) || "Unknown",
|
|
23783
23784
|
userId: context == null ? void 0 : context.userId,
|
|
23784
23785
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23785
|
-
userAgent: navigator.userAgent,
|
|
23786
|
-
url: window.location.href,
|
|
23786
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "server",
|
|
23787
|
+
url: typeof window !== "undefined" ? window.location.href : "",
|
|
23787
23788
|
apiKey: (context == null ? void 0 : context.apiKey) ? context.apiKey.substring(0, 20) + "..." : void 0
|
|
23788
23789
|
};
|
|
23789
23790
|
const severity = this.determineSeverity(apiError);
|
|
@@ -23816,8 +23817,8 @@ class EnhancedErrorHandler {
|
|
|
23816
23817
|
action: (context == null ? void 0 : context.action) || "Runtime",
|
|
23817
23818
|
userId: context == null ? void 0 : context.userId,
|
|
23818
23819
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23819
|
-
userAgent: navigator.userAgent,
|
|
23820
|
-
url: window.location.href
|
|
23820
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "server",
|
|
23821
|
+
url: typeof window !== "undefined" ? window.location.href : ""
|
|
23821
23822
|
};
|
|
23822
23823
|
const errorReport = {
|
|
23823
23824
|
error: apiError,
|
|
@@ -23896,9 +23897,9 @@ class EnhancedErrorHandler {
|
|
|
23896
23897
|
await api2.post("/errors/report", {
|
|
23897
23898
|
errors: errorsToSend,
|
|
23898
23899
|
clientInfo: {
|
|
23899
|
-
userAgent: navigator.userAgent,
|
|
23900
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "server",
|
|
23900
23901
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23901
|
-
url: window.location.href,
|
|
23902
|
+
url: typeof window !== "undefined" ? window.location.href : "",
|
|
23902
23903
|
circuitBreakerState: this.circuitBreaker.getState(),
|
|
23903
23904
|
remainingRateLimit: this.rateLimiter.getRemainingRequests()
|
|
23904
23905
|
}
|
|
@@ -23933,15 +23934,17 @@ class EnhancedErrorHandler {
|
|
|
23933
23934
|
// Show user notification based on error severity
|
|
23934
23935
|
showUserNotification(error, severity) {
|
|
23935
23936
|
const message = this.getUserFriendlyMessage(error);
|
|
23936
|
-
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23937
|
+
if (typeof window !== "undefined") {
|
|
23938
|
+
window.dispatchEvent(new CustomEvent("error:notification", {
|
|
23939
|
+
detail: {
|
|
23940
|
+
message,
|
|
23941
|
+
severity,
|
|
23942
|
+
error,
|
|
23943
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23944
|
+
canRetry: this.canRetryError(error)
|
|
23945
|
+
}
|
|
23946
|
+
}));
|
|
23947
|
+
}
|
|
23945
23948
|
}
|
|
23946
23949
|
// Determine if error can be retried
|
|
23947
23950
|
canRetryError(error) {
|
|
@@ -24723,7 +24726,7 @@ const useEmailLeadsStore = create()(
|
|
|
24723
24726
|
}
|
|
24724
24727
|
}))
|
|
24725
24728
|
);
|
|
24726
|
-
function WidgetBubble({ position = "bottom-right", margin }) {
|
|
24729
|
+
function WidgetBubble({ position = "bottom-right", margin, zIndex }) {
|
|
24727
24730
|
const { openWidget, theme, isOpen, isAuthenticated } = useChatContext();
|
|
24728
24731
|
const { hasNewLeads, newLeadsCount, startPolling, stopPolling, clearNewLeadsNotification } = useEmailLeadsStore();
|
|
24729
24732
|
reactExports.useEffect(() => {
|
|
@@ -24752,7 +24755,7 @@ function WidgetBubble({ position = "bottom-right", margin }) {
|
|
|
24752
24755
|
return "fixed bottom-6 right-6 z-50";
|
|
24753
24756
|
}
|
|
24754
24757
|
};
|
|
24755
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: getPositionClasses(), style: { margin: margin || void 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
24758
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: getPositionClasses(), style: { margin: margin || void 0, zIndex: zIndex || void 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
24756
24759
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
24757
24760
|
Button,
|
|
24758
24761
|
{
|
|
@@ -36260,7 +36263,7 @@ function WidgetContent() {
|
|
|
36260
36263
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PoweredByFooter, {})
|
|
36261
36264
|
] });
|
|
36262
36265
|
}
|
|
36263
|
-
function WidgetPopup({ position = "bottom-right" }) {
|
|
36266
|
+
function WidgetPopup({ position = "bottom-right", zIndex }) {
|
|
36264
36267
|
const { isOpen, theme, closeWidget, isAuthenticated } = useChatContext();
|
|
36265
36268
|
const isLeftPosition = position === "bottom-left" || position === "top-left";
|
|
36266
36269
|
const containerRef = reactExports.useRef(null);
|
|
@@ -36384,6 +36387,7 @@ function WidgetPopup({ position = "bottom-right" }) {
|
|
|
36384
36387
|
motion.div,
|
|
36385
36388
|
{
|
|
36386
36389
|
className: "fixed inset-0 z-50",
|
|
36390
|
+
style: { zIndex: zIndex ?? 50 },
|
|
36387
36391
|
initial: { opacity: 0 },
|
|
36388
36392
|
animate: { opacity: 1 },
|
|
36389
36393
|
exit: { opacity: 0 },
|
|
@@ -36553,10 +36557,22 @@ function WidgetPopup({ position = "bottom-right" }) {
|
|
|
36553
36557
|
}
|
|
36554
36558
|
) });
|
|
36555
36559
|
}
|
|
36556
|
-
function Widget({ theme, className, position, margin, pangentsApiKey, tenantId, email }) {
|
|
36560
|
+
function Widget({ theme, className, position, margin, pangentsApiKey, tenantId, email, zIndex }) {
|
|
36561
|
+
reactExports.useEffect(() => {
|
|
36562
|
+
try {
|
|
36563
|
+
const css = window.__PANGENTS_WIDGET_CSS;
|
|
36564
|
+
if (css && !document.getElementById("pangents-widget-styles")) {
|
|
36565
|
+
const style = document.createElement("style");
|
|
36566
|
+
style.id = "pangents-widget-styles";
|
|
36567
|
+
style.textContent = css;
|
|
36568
|
+
document.head.appendChild(style);
|
|
36569
|
+
}
|
|
36570
|
+
} catch {
|
|
36571
|
+
}
|
|
36572
|
+
}, []);
|
|
36557
36573
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className ? `pg-widget-root ${className}` : "pg-widget-root", children: /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ChatProvider, { initialTheme: theme, apiKey: pangentsApiKey, tenantId, email, children: [
|
|
36558
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetBubble, { position, margin }),
|
|
36559
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetPopup, { position })
|
|
36574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetBubble, { position, margin, zIndex }),
|
|
36575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetPopup, { position, zIndex })
|
|
36560
36576
|
] }) }) });
|
|
36561
36577
|
}
|
|
36562
36578
|
class ChatbotWidget {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepfrog/pangents-widget",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"description": "Pangents AI - Embeddable AI widget for web applications",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md",
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
|
-
"sideEffects":
|
|
27
|
+
"sideEffects": true,
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "git+https://github.com/deepfrog/pangents-widget.git"
|