@dialtribe/chat-client 0.5.0 → 0.5.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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1623,7 +1623,7 @@ function groupRows(items) {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
return rows;
|
|
1625
1625
|
}
|
|
1626
|
-
function NotificationsPanel({ labels, onClose, onOpen }) {
|
|
1626
|
+
function NotificationsPanel({ labels, onClose, onOpen, onOpened }) {
|
|
1627
1627
|
const n = useDialtribeNotifications();
|
|
1628
1628
|
const rows = useMemo(() => groupRows(n.items), [n.items]);
|
|
1629
1629
|
const { status, markSeen } = n;
|
|
@@ -1632,10 +1632,16 @@ function NotificationsPanel({ labels, onClose, onOpen }) {
|
|
|
1632
1632
|
});
|
|
1633
1633
|
}, [status, markSeen]);
|
|
1634
1634
|
const open = (row) => {
|
|
1635
|
+
if (!row.lead.url) {
|
|
1636
|
+
if (row.unread) void n.markRead(row.ids).catch(() => {
|
|
1637
|
+
});
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1635
1640
|
void n.click(row.ids).catch(() => {
|
|
1636
1641
|
});
|
|
1637
1642
|
const handled = onOpen?.(row.lead);
|
|
1638
|
-
|
|
1643
|
+
onOpened?.(row.lead);
|
|
1644
|
+
if (!handled) window.location.assign(row.lead.url);
|
|
1639
1645
|
};
|
|
1640
1646
|
return /* @__PURE__ */ jsxs("div", { className: "dtc-notif", children: [
|
|
1641
1647
|
/* @__PURE__ */ jsxs("div", { className: "dtc-panel-header", children: [
|
|
@@ -1652,7 +1658,7 @@ function NotificationsPanel({ labels, onClose, onOpen }) {
|
|
|
1652
1658
|
"button",
|
|
1653
1659
|
{
|
|
1654
1660
|
type: "button",
|
|
1655
|
-
className: `dtc-notif-row ${row.unread ? "dtc-notif-row-unread" : ""}`,
|
|
1661
|
+
className: `dtc-notif-row ${row.unread ? "dtc-notif-row-unread" : ""} ${row.lead.url ? "" : "dtc-notif-row-static"}`,
|
|
1656
1662
|
onClick: () => open(row),
|
|
1657
1663
|
children: [
|
|
1658
1664
|
/* @__PURE__ */ jsx(
|
|
@@ -1790,7 +1796,17 @@ function DialtribeMessages({
|
|
|
1790
1796
|
rollup > 0 && /* @__PURE__ */ jsx("span", { className: "dtc-badge-count dtc-badge-float", children: badgeText(rollup) })
|
|
1791
1797
|
] }),
|
|
1792
1798
|
isOpen && /* @__PURE__ */ jsxs("div", { className: "dtc-messages-panel", role: "dialog", "aria-label": activeItem?.label ?? labels.messages, children: [
|
|
1793
|
-
view.kind === "notifications" && notifications !== false ? /* @__PURE__ */ jsx(
|
|
1799
|
+
view.kind === "notifications" && notifications !== false ? /* @__PURE__ */ jsx(
|
|
1800
|
+
NotificationsPanel,
|
|
1801
|
+
{
|
|
1802
|
+
labels,
|
|
1803
|
+
onClose: ui.close,
|
|
1804
|
+
onOpen: notifOnOpen,
|
|
1805
|
+
onOpened: () => {
|
|
1806
|
+
if (isMobile) ui.close();
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
) : activeItem ? /* @__PURE__ */ jsx("div", { className: "dtc-item-panel", children: typeof activeItem.panel === "function" ? activeItem.panel({ close: ui.close }) : activeItem.panel }) : view.kind !== "room" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1794
1810
|
/* @__PURE__ */ jsxs("div", { className: "dtc-panel-header", children: [
|
|
1795
1811
|
/* @__PURE__ */ jsx("span", { className: "dtc-panel-title", children: labels.messages }),
|
|
1796
1812
|
/* @__PURE__ */ jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.close, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsx(CloseIcon2, {}) })
|