@deepfrog/pangents-widget 2.1.0 → 2.1.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 +5 -1
- package/dist/preview.html +4 -2
- package/dist/widget.js +16 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ function App() {
|
|
|
38
38
|
bubbleIcon: 'https://app.ultrashiptms.ai/icon.ico?25f91bedca5c761d',
|
|
39
39
|
}}
|
|
40
40
|
position="bottom-right"
|
|
41
|
+
margin="20px" // Optional: adjust bubble margin
|
|
41
42
|
/>
|
|
42
43
|
);
|
|
43
44
|
}
|
|
@@ -62,6 +63,7 @@ function App() {
|
|
|
62
63
|
bubbleIcon: 'https://app.ultrashiptms.ai/icon.ico?25f91bedca5c761d',
|
|
63
64
|
},
|
|
64
65
|
position: 'bottom-right',
|
|
66
|
+
margin: '10px 20px', // Optional: adjust bubble margin
|
|
65
67
|
});
|
|
66
68
|
</script>
|
|
67
69
|
```
|
|
@@ -85,6 +87,7 @@ function App() {
|
|
|
85
87
|
bubbleIcon: 'https://app.ultrashiptms.ai/icon.ico?25f91bedca5c761d',
|
|
86
88
|
},
|
|
87
89
|
position: 'bottom-right',
|
|
90
|
+
margin: '10px 20px 30px 40px', // Optional: adjust bubble margin
|
|
88
91
|
});
|
|
89
92
|
</script>
|
|
90
93
|
```
|
|
@@ -97,7 +100,8 @@ function App() {
|
|
|
97
100
|
| `tenantId` | `string` | Yes | Your tenant ID |
|
|
98
101
|
| `email` | `string` | No | Optional email to pre-fill the login form |
|
|
99
102
|
| `theme` | `object` | No | Theme customization options |
|
|
100
|
-
| `position` | `string` | No | Widget position: `'bottom-right'`, `'bottom-left'`, `'top-right'`, `'top-left'
|
|
103
|
+
| `position` | `string` | No | Widget position: `'bottom-right'`, `'bottom-left'`, `'top-right'`, `'top-left'`. The popup will slide in from the corresponding side. |
|
|
104
|
+
| `margin` | `string` | No | CSS margin for the bubble button. Supports all CSS margin formats: `'10px'`, `'10px 20px'`, `'10px 20px 30px'`, `'10px 20px 30px 40px'` |
|
|
101
105
|
| `zIndex` | `number` | No | CSS z-index for the widget (default: 9999) |
|
|
102
106
|
|
|
103
107
|
### Theme Options
|
package/dist/preview.html
CHANGED
|
@@ -210,7 +210,8 @@ import Chatbot from "https://chat-widget-gamma-azure.vercel.app/widget.js";
|
|
|
210
210
|
headerLogo: "<logo_url>",
|
|
211
211
|
bubbleIcon: "<logo_url>",
|
|
212
212
|
},
|
|
213
|
-
position: "bottom-right",
|
|
213
|
+
position: "bottom-right", // Widget position: bottom-right, bottom-left, top-right, top-left
|
|
214
|
+
margin: "20px", // Optional: CSS margin for bubble (e.g., "10px", "10px 20px 30px 40px")
|
|
214
215
|
});
|
|
215
216
|
</script></code></pre>
|
|
216
217
|
</div>
|
|
@@ -237,7 +238,8 @@ import Chatbot from "https://chat-widget-gamma-azure.vercel.app/widget.js";
|
|
|
237
238
|
headerLogo: null,
|
|
238
239
|
bubbleIcon: "https://app.ultrashiptms.ai/icon.ico?25f91bedca5c761d",
|
|
239
240
|
},
|
|
240
|
-
position: "bottom-
|
|
241
|
+
position: "bottom-left",
|
|
242
|
+
margin: "20px",
|
|
241
243
|
});
|
|
242
244
|
</script>
|
|
243
245
|
</body>
|
package/dist/widget.js
CHANGED
|
@@ -24702,7 +24702,7 @@ const useEmailLeadsStore = create()(
|
|
|
24702
24702
|
}
|
|
24703
24703
|
}))
|
|
24704
24704
|
);
|
|
24705
|
-
function WidgetBubble({ position = "bottom-right" }) {
|
|
24705
|
+
function WidgetBubble({ position = "bottom-right", margin }) {
|
|
24706
24706
|
const { openWidget, theme, isOpen, isAuthenticated } = useChatContext();
|
|
24707
24707
|
const { hasNewLeads, newLeadsCount, startPolling, stopPolling, clearNewLeadsNotification } = useEmailLeadsStore();
|
|
24708
24708
|
reactExports.useEffect(() => {
|
|
@@ -24731,7 +24731,7 @@ function WidgetBubble({ position = "bottom-right" }) {
|
|
|
24731
24731
|
return "fixed bottom-6 right-6 z-50";
|
|
24732
24732
|
}
|
|
24733
24733
|
};
|
|
24734
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: getPositionClasses(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
24734
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: getPositionClasses(), style: { margin: margin || void 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
24735
24735
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
24736
24736
|
Button,
|
|
24737
24737
|
{
|
|
@@ -36201,8 +36201,9 @@ function WidgetContent() {
|
|
|
36201
36201
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PoweredByFooter, {})
|
|
36202
36202
|
] });
|
|
36203
36203
|
}
|
|
36204
|
-
function WidgetPopup() {
|
|
36204
|
+
function WidgetPopup({ position = "bottom-right" }) {
|
|
36205
36205
|
const { isOpen, theme, closeWidget, isAuthenticated } = useChatContext();
|
|
36206
|
+
const isLeftPosition = position === "bottom-left" || position === "top-left";
|
|
36206
36207
|
const containerRef = reactExports.useRef(null);
|
|
36207
36208
|
const [dimensions, setDimensions] = reactExports.useState(() => ({ width: Math.min(window.innerWidth * 0.38, 650), height: window.innerHeight }));
|
|
36208
36209
|
const initialRoute = reactExports.useMemo(() => {
|
|
@@ -36344,10 +36345,10 @@ function WidgetPopup() {
|
|
|
36344
36345
|
{
|
|
36345
36346
|
ref: containerRef,
|
|
36346
36347
|
id: "pangents-widget-container",
|
|
36347
|
-
className:
|
|
36348
|
-
initial: { x: "100%" },
|
|
36348
|
+
className: `fixed top-0 ${isLeftPosition ? "left-0" : "right-0"}`,
|
|
36349
|
+
initial: { x: isLeftPosition ? "-100%" : "100%" },
|
|
36349
36350
|
animate: { x: 0 },
|
|
36350
|
-
exit: { x: "100%" },
|
|
36351
|
+
exit: { x: isLeftPosition ? "-100%" : "100%" },
|
|
36351
36352
|
transition: { type: "spring", stiffness: 300, damping: 30 },
|
|
36352
36353
|
role: "dialog",
|
|
36353
36354
|
"aria-modal": "true",
|
|
@@ -36493,10 +36494,10 @@ function WidgetPopup() {
|
|
|
36493
36494
|
}
|
|
36494
36495
|
) });
|
|
36495
36496
|
}
|
|
36496
|
-
function Widget({ theme, className, position, pangentsApiKey, tenantId, email }) {
|
|
36497
|
+
function Widget({ theme, className, position, margin, pangentsApiKey, tenantId, email }) {
|
|
36497
36498
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className, children: /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ChatProvider, { initialTheme: theme, apiKey: pangentsApiKey, tenantId, email, children: [
|
|
36498
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetBubble, { position }),
|
|
36499
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetPopup, {})
|
|
36499
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetBubble, { position, margin }),
|
|
36500
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(WidgetPopup, { position })
|
|
36500
36501
|
] }) }) });
|
|
36501
36502
|
}
|
|
36502
36503
|
class ChatbotWidget {
|
|
@@ -36510,12 +36511,13 @@ class ChatbotWidget {
|
|
|
36510
36511
|
if (this.container && this.root) {
|
|
36511
36512
|
const themeChanged = JSON.stringify(this.config.theme) !== JSON.stringify(newConfig.theme);
|
|
36512
36513
|
const positionChanged = this.config.position !== newConfig.position;
|
|
36514
|
+
const marginChanged = this.config.margin !== newConfig.margin;
|
|
36513
36515
|
const zIndexChanged = this.config.zIndex !== newConfig.zIndex;
|
|
36514
|
-
if (themeChanged && !positionChanged && !zIndexChanged) {
|
|
36516
|
+
if (themeChanged && !positionChanged && !marginChanged && !zIndexChanged) {
|
|
36515
36517
|
this.config = newConfig;
|
|
36516
36518
|
this.render();
|
|
36517
36519
|
return;
|
|
36518
|
-
} else if (positionChanged || zIndexChanged) {
|
|
36520
|
+
} else if (positionChanged || marginChanged || zIndexChanged) {
|
|
36519
36521
|
this.config = newConfig;
|
|
36520
36522
|
this.createContainer();
|
|
36521
36523
|
this.render();
|
|
@@ -36546,6 +36548,7 @@ class ChatbotWidget {
|
|
|
36546
36548
|
{
|
|
36547
36549
|
theme: this.config.theme,
|
|
36548
36550
|
position: this.config.position,
|
|
36551
|
+
margin: this.config.margin,
|
|
36549
36552
|
pangentsApiKey: this.config.pangentsApiKey,
|
|
36550
36553
|
tenantId: this.config.tenantId,
|
|
36551
36554
|
email: this.config.email
|
|
@@ -36568,9 +36571,10 @@ class ChatbotWidget {
|
|
|
36568
36571
|
const updatedConfig = { ...this.config, ...newConfig };
|
|
36569
36572
|
JSON.stringify(this.config.theme) !== JSON.stringify(updatedConfig.theme);
|
|
36570
36573
|
const positionChanged = this.config.position !== updatedConfig.position;
|
|
36574
|
+
const marginChanged = this.config.margin !== updatedConfig.margin;
|
|
36571
36575
|
const zIndexChanged = this.config.zIndex !== updatedConfig.zIndex;
|
|
36572
36576
|
this.config = updatedConfig;
|
|
36573
|
-
if (positionChanged || zIndexChanged) {
|
|
36577
|
+
if (positionChanged || marginChanged || zIndexChanged) {
|
|
36574
36578
|
this.createContainer();
|
|
36575
36579
|
this.render();
|
|
36576
36580
|
} else {
|