@brokr/sdk 2.0.0 → 2.1.0
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/react-notifications.js +63 -50
- package/dist/react-notifications.mjs +63 -50
- package/dist/react-styles.js +113 -75
- package/dist/react-styles.mjs +113 -75
- package/dist/react-theme.js +6 -4
- package/dist/react-theme.mjs +6 -4
- package/dist/react.js +325 -246
- package/dist/react.mjs +360 -281
- package/dist/src/react/account/AccountPanel.d.ts.map +1 -1
- package/dist/src/react/account/UserButton.d.ts.map +1 -1
- package/dist/src/react/chat/AIChat.d.ts.map +1 -1
- package/dist/src/react/chat/ChatInput.d.ts.map +1 -1
- package/dist/src/react/chat/MessagePane.d.ts.map +1 -1
- package/dist/src/react/chat/ModelSelector.d.ts.map +1 -1
- package/dist/src/react/chat/ThreadSidebar.d.ts.map +1 -1
- package/dist/src/react/composites/FabAI.d.ts.map +1 -1
- package/dist/src/react/css/account.d.ts +1 -1
- package/dist/src/react/css/account.d.ts.map +1 -1
- package/dist/src/react/css/auth.d.ts +1 -1
- package/dist/src/react/css/auth.d.ts.map +1 -1
- package/dist/src/react/css/chat-extras.d.ts +1 -1
- package/dist/src/react/css/chat-extras.d.ts.map +1 -1
- package/dist/src/react/css/chat.d.ts +1 -1
- package/dist/src/react/css/chat.d.ts.map +1 -1
- package/dist/src/react/css/composites.d.ts +1 -1
- package/dist/src/react/css/composites.d.ts.map +1 -1
- package/dist/src/react/css/markdown.d.ts +1 -1
- package/dist/src/react/css/markdown.d.ts.map +1 -1
- package/dist/src/react/css/notifications.d.ts +1 -1
- package/dist/src/react/css/notifications.d.ts.map +1 -1
- package/dist/src/react/css/tokens.d.ts +1 -1
- package/dist/src/react/css/tokens.d.ts.map +1 -1
- package/dist/src/react/notifications/NotificationBell.d.ts.map +1 -1
- package/dist/src/react/notifications/NotificationList.d.ts.map +1 -1
- package/dist/src/react/notifications/Toast.d.ts.map +1 -1
- package/dist/src/react/payments/Plans.d.ts.map +1 -1
- package/dist/src/react/theme.d.ts.map +1 -1
- package/dist/src/react/types.d.ts +4 -4
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -109,6 +109,28 @@ function timeAgo(iso) {
|
|
|
109
109
|
const days = Math.floor(hours / 24);
|
|
110
110
|
return `${days}d ago`;
|
|
111
111
|
}
|
|
112
|
+
function NotifDropdownItem({
|
|
113
|
+
notif,
|
|
114
|
+
registry,
|
|
115
|
+
onClick
|
|
116
|
+
}) {
|
|
117
|
+
const handleClick = (0, import_react4.useCallback)(() => onClick(notif), [notif, onClick]);
|
|
118
|
+
const notifData = notif.data ?? {};
|
|
119
|
+
const notifType = notifData.type ?? "default";
|
|
120
|
+
const resolved = resolveNotificationType(registry, notifType, notifData);
|
|
121
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
className: `brokr-notif-item${notif.read ? "" : " brokr-notif-item--unread"}`,
|
|
126
|
+
onClick: handleClick,
|
|
127
|
+
role: "menuitem"
|
|
128
|
+
},
|
|
129
|
+
resolved.image ? /* @__PURE__ */ import_react4.default.createElement("img", { src: resolved.image.url, alt: resolved.image.alt, className: "brokr-notif-item-logo" }) : /* @__PURE__ */ import_react4.default.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
130
|
+
/* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
131
|
+
/* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-time" }, timeAgo(notif.createdAt))
|
|
132
|
+
);
|
|
133
|
+
}
|
|
112
134
|
function NotificationBell() {
|
|
113
135
|
const { notifications, unreadCount, markRead, markAllRead, isLoading, registry } = useNotifications();
|
|
114
136
|
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
@@ -173,7 +195,8 @@ function NotificationBell() {
|
|
|
173
195
|
className: "brokr-notif-bell",
|
|
174
196
|
onClick: toggle,
|
|
175
197
|
"aria-label": `Notifications${unreadCount > 0 ? ` (${unreadCount} unread)` : ""}`,
|
|
176
|
-
"aria-expanded": open
|
|
198
|
+
"aria-expanded": open,
|
|
199
|
+
"aria-haspopup": "menu"
|
|
177
200
|
},
|
|
178
201
|
/* @__PURE__ */ import_react4.default.createElement("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react4.default.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })),
|
|
179
202
|
unreadCount > 0 && /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-badge" }, unreadCount > 99 ? "99+" : unreadCount)
|
|
@@ -185,31 +208,15 @@ function NotificationBell() {
|
|
|
185
208
|
onClick: markAllRead
|
|
186
209
|
},
|
|
187
210
|
"Mark all read"
|
|
188
|
-
)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-dropdown-list" }, isLoading ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-empty-text" }, "Loading\u2026")) : sorted.length === 0 ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : sorted.map((notif) =>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
className: `brokr-notif-item${notif.read ? "" : " brokr-notif-item--unread"}`,
|
|
198
|
-
onClick: () => handleItemClick(notif),
|
|
199
|
-
role: "menuitem"
|
|
200
|
-
},
|
|
201
|
-
resolved.image ? /* @__PURE__ */ import_react4.default.createElement(
|
|
202
|
-
"img",
|
|
203
|
-
{
|
|
204
|
-
src: resolved.image.url,
|
|
205
|
-
alt: resolved.image.alt,
|
|
206
|
-
className: "brokr-notif-item-logo"
|
|
207
|
-
}
|
|
208
|
-
) : /* @__PURE__ */ import_react4.default.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
209
|
-
/* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
210
|
-
/* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-item-time" }, timeAgo(notif.createdAt))
|
|
211
|
-
);
|
|
212
|
-
}))));
|
|
211
|
+
)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-dropdown-list" }, isLoading ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-empty-text" }, "Loading\u2026")) : sorted.length === 0 ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : sorted.map((notif) => /* @__PURE__ */ import_react4.default.createElement(
|
|
212
|
+
NotifDropdownItem,
|
|
213
|
+
{
|
|
214
|
+
key: notif.id,
|
|
215
|
+
notif,
|
|
216
|
+
registry,
|
|
217
|
+
onClick: handleItemClick
|
|
218
|
+
}
|
|
219
|
+
)))));
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
// src/react/notifications/NotificationList.tsx
|
|
@@ -226,6 +233,27 @@ function formatTimestamp(iso) {
|
|
|
226
233
|
function NotificationListSkeleton() {
|
|
227
234
|
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-list-items" }, [1, 2, 3].map((i) => /* @__PURE__ */ import_react5.default.createElement("div", { key: i, className: "brokr-notif-list-row brokr-notif-list-row--skeleton" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-dot brokr-notif-item-dot--skeleton" }), /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-title brokr-skeleton-line", style: { width: "60%" } }), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-message brokr-skeleton-line", style: { width: "80%" } })), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-time brokr-skeleton-line", style: { width: 48 } }))));
|
|
228
235
|
}
|
|
236
|
+
function NotifListItem({
|
|
237
|
+
notif,
|
|
238
|
+
registry,
|
|
239
|
+
onClick
|
|
240
|
+
}) {
|
|
241
|
+
const handleClick = (0, import_react5.useCallback)(() => onClick(notif), [notif, onClick]);
|
|
242
|
+
const notifData = notif.data ?? {};
|
|
243
|
+
const notifType = notif.type ?? notifData.type ?? "default";
|
|
244
|
+
const resolved = resolveNotificationType(registry, notifType, notifData);
|
|
245
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
className: `brokr-notif-list-row${notif.read ? "" : " brokr-notif-list-row--unread"}`,
|
|
250
|
+
onClick: handleClick
|
|
251
|
+
},
|
|
252
|
+
resolved.image ? /* @__PURE__ */ import_react5.default.createElement("img", { src: resolved.image.url, alt: resolved.image.alt, className: "brokr-notif-item-logo" }) : /* @__PURE__ */ import_react5.default.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
253
|
+
/* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
254
|
+
/* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-time" }, formatTimestamp(notif.createdAt))
|
|
255
|
+
);
|
|
256
|
+
}
|
|
229
257
|
function NotificationList() {
|
|
230
258
|
const { notifications, unreadCount, markRead, markAllRead, isLoading, registry } = useNotifications();
|
|
231
259
|
const sorted = (0, import_react5.useMemo)(
|
|
@@ -252,30 +280,15 @@ function NotificationList() {
|
|
|
252
280
|
onClick: markAllRead
|
|
253
281
|
},
|
|
254
282
|
"Mark all read"
|
|
255
|
-
)), isLoading ? /* @__PURE__ */ import_react5.default.createElement(NotificationListSkeleton, null) : sorted.length === 0 ? /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react5.default.createElement("svg", { "aria-hidden": "true", width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.3 } }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-list-items" }, sorted.map((notif) =>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
className: `brokr-notif-list-row${notif.read ? "" : " brokr-notif-list-row--unread"}`,
|
|
265
|
-
onClick: () => handleClick(notif)
|
|
266
|
-
},
|
|
267
|
-
resolved.image ? /* @__PURE__ */ import_react5.default.createElement(
|
|
268
|
-
"img",
|
|
269
|
-
{
|
|
270
|
-
src: resolved.image.url,
|
|
271
|
-
alt: resolved.image.alt,
|
|
272
|
-
className: "brokr-notif-item-logo"
|
|
273
|
-
}
|
|
274
|
-
) : /* @__PURE__ */ import_react5.default.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
275
|
-
/* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
276
|
-
/* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-item-time" }, formatTimestamp(notif.createdAt))
|
|
277
|
-
);
|
|
278
|
-
})));
|
|
283
|
+
)), isLoading ? /* @__PURE__ */ import_react5.default.createElement(NotificationListSkeleton, null) : sorted.length === 0 ? /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ import_react5.default.createElement("svg", { "aria-hidden": "true", width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.3 } }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })), /* @__PURE__ */ import_react5.default.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : /* @__PURE__ */ import_react5.default.createElement("div", { className: "brokr-notif-list-items" }, sorted.map((notif) => /* @__PURE__ */ import_react5.default.createElement(
|
|
284
|
+
NotifListItem,
|
|
285
|
+
{
|
|
286
|
+
key: notif.id,
|
|
287
|
+
notif,
|
|
288
|
+
registry,
|
|
289
|
+
onClick: handleClick
|
|
290
|
+
}
|
|
291
|
+
))));
|
|
279
292
|
}
|
|
280
293
|
// Annotate the CommonJS export names for ESM import in node:
|
|
281
294
|
0 && (module.exports = {
|
|
@@ -78,6 +78,28 @@ function timeAgo(iso) {
|
|
|
78
78
|
const days = Math.floor(hours / 24);
|
|
79
79
|
return `${days}d ago`;
|
|
80
80
|
}
|
|
81
|
+
function NotifDropdownItem({
|
|
82
|
+
notif,
|
|
83
|
+
registry,
|
|
84
|
+
onClick
|
|
85
|
+
}) {
|
|
86
|
+
const handleClick = useCallback3(() => onClick(notif), [notif, onClick]);
|
|
87
|
+
const notifData = notif.data ?? {};
|
|
88
|
+
const notifType = notifData.type ?? "default";
|
|
89
|
+
const resolved = resolveNotificationType(registry, notifType, notifData);
|
|
90
|
+
return /* @__PURE__ */ React3.createElement(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
className: `brokr-notif-item${notif.read ? "" : " brokr-notif-item--unread"}`,
|
|
95
|
+
onClick: handleClick,
|
|
96
|
+
role: "menuitem"
|
|
97
|
+
},
|
|
98
|
+
resolved.image ? /* @__PURE__ */ React3.createElement("img", { src: resolved.image.url, alt: resolved.image.alt, className: "brokr-notif-item-logo" }) : /* @__PURE__ */ React3.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
99
|
+
/* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
100
|
+
/* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-time" }, timeAgo(notif.createdAt))
|
|
101
|
+
);
|
|
102
|
+
}
|
|
81
103
|
function NotificationBell() {
|
|
82
104
|
const { notifications, unreadCount, markRead, markAllRead, isLoading, registry } = useNotifications();
|
|
83
105
|
const [open, setOpen] = useState3(false);
|
|
@@ -142,7 +164,8 @@ function NotificationBell() {
|
|
|
142
164
|
className: "brokr-notif-bell",
|
|
143
165
|
onClick: toggle,
|
|
144
166
|
"aria-label": `Notifications${unreadCount > 0 ? ` (${unreadCount} unread)` : ""}`,
|
|
145
|
-
"aria-expanded": open
|
|
167
|
+
"aria-expanded": open,
|
|
168
|
+
"aria-haspopup": "menu"
|
|
146
169
|
},
|
|
147
170
|
/* @__PURE__ */ React3.createElement("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React3.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ React3.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })),
|
|
148
171
|
unreadCount > 0 && /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-badge" }, unreadCount > 99 ? "99+" : unreadCount)
|
|
@@ -154,31 +177,15 @@ function NotificationBell() {
|
|
|
154
177
|
onClick: markAllRead
|
|
155
178
|
},
|
|
156
179
|
"Mark all read"
|
|
157
|
-
)), /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-dropdown-list" }, isLoading ? /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-empty-text" }, "Loading\u2026")) : sorted.length === 0 ? /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : sorted.map((notif) =>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
className: `brokr-notif-item${notif.read ? "" : " brokr-notif-item--unread"}`,
|
|
167
|
-
onClick: () => handleItemClick(notif),
|
|
168
|
-
role: "menuitem"
|
|
169
|
-
},
|
|
170
|
-
resolved.image ? /* @__PURE__ */ React3.createElement(
|
|
171
|
-
"img",
|
|
172
|
-
{
|
|
173
|
-
src: resolved.image.url,
|
|
174
|
-
alt: resolved.image.alt,
|
|
175
|
-
className: "brokr-notif-item-logo"
|
|
176
|
-
}
|
|
177
|
-
) : /* @__PURE__ */ React3.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
178
|
-
/* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
179
|
-
/* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-item-time" }, timeAgo(notif.createdAt))
|
|
180
|
-
);
|
|
181
|
-
}))));
|
|
180
|
+
)), /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-dropdown-list" }, isLoading ? /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-empty-text" }, "Loading\u2026")) : sorted.length === 0 ? /* @__PURE__ */ React3.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React3.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : sorted.map((notif) => /* @__PURE__ */ React3.createElement(
|
|
181
|
+
NotifDropdownItem,
|
|
182
|
+
{
|
|
183
|
+
key: notif.id,
|
|
184
|
+
notif,
|
|
185
|
+
registry,
|
|
186
|
+
onClick: handleItemClick
|
|
187
|
+
}
|
|
188
|
+
)))));
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
// src/react/notifications/NotificationList.tsx
|
|
@@ -195,6 +202,27 @@ function formatTimestamp(iso) {
|
|
|
195
202
|
function NotificationListSkeleton() {
|
|
196
203
|
return /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-list-items" }, [1, 2, 3].map((i) => /* @__PURE__ */ React4.createElement("div", { key: i, className: "brokr-notif-list-row brokr-notif-list-row--skeleton" }, /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-dot brokr-notif-item-dot--skeleton" }), /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-title brokr-skeleton-line", style: { width: "60%" } }), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-message brokr-skeleton-line", style: { width: "80%" } })), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-time brokr-skeleton-line", style: { width: 48 } }))));
|
|
197
204
|
}
|
|
205
|
+
function NotifListItem({
|
|
206
|
+
notif,
|
|
207
|
+
registry,
|
|
208
|
+
onClick
|
|
209
|
+
}) {
|
|
210
|
+
const handleClick = useCallback4(() => onClick(notif), [notif, onClick]);
|
|
211
|
+
const notifData = notif.data ?? {};
|
|
212
|
+
const notifType = notif.type ?? notifData.type ?? "default";
|
|
213
|
+
const resolved = resolveNotificationType(registry, notifType, notifData);
|
|
214
|
+
return /* @__PURE__ */ React4.createElement(
|
|
215
|
+
"button",
|
|
216
|
+
{
|
|
217
|
+
type: "button",
|
|
218
|
+
className: `brokr-notif-list-row${notif.read ? "" : " brokr-notif-list-row--unread"}`,
|
|
219
|
+
onClick: handleClick
|
|
220
|
+
},
|
|
221
|
+
resolved.image ? /* @__PURE__ */ React4.createElement("img", { src: resolved.image.url, alt: resolved.image.alt, className: "brokr-notif-item-logo" }) : /* @__PURE__ */ React4.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
222
|
+
/* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
223
|
+
/* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-time" }, formatTimestamp(notif.createdAt))
|
|
224
|
+
);
|
|
225
|
+
}
|
|
198
226
|
function NotificationList() {
|
|
199
227
|
const { notifications, unreadCount, markRead, markAllRead, isLoading, registry } = useNotifications();
|
|
200
228
|
const sorted = useMemo4(
|
|
@@ -221,30 +249,15 @@ function NotificationList() {
|
|
|
221
249
|
onClick: markAllRead
|
|
222
250
|
},
|
|
223
251
|
"Mark all read"
|
|
224
|
-
)), isLoading ? /* @__PURE__ */ React4.createElement(NotificationListSkeleton, null) : sorted.length === 0 ? /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React4.createElement("svg", { "aria-hidden": "true", width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.3 } }, /* @__PURE__ */ React4.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ React4.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-list-items" }, sorted.map((notif) =>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
className: `brokr-notif-list-row${notif.read ? "" : " brokr-notif-list-row--unread"}`,
|
|
234
|
-
onClick: () => handleClick(notif)
|
|
235
|
-
},
|
|
236
|
-
resolved.image ? /* @__PURE__ */ React4.createElement(
|
|
237
|
-
"img",
|
|
238
|
-
{
|
|
239
|
-
src: resolved.image.url,
|
|
240
|
-
alt: resolved.image.alt,
|
|
241
|
-
className: "brokr-notif-item-logo"
|
|
242
|
-
}
|
|
243
|
-
) : /* @__PURE__ */ React4.createElement("span", { className: `brokr-notif-item-dot brokr-notif-item-dot--${notif.variant}` }),
|
|
244
|
-
/* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-item-body" }, /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-title" }, notif.title), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-message" }, notif.message)),
|
|
245
|
-
/* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-item-time" }, formatTimestamp(notif.createdAt))
|
|
246
|
-
);
|
|
247
|
-
})));
|
|
252
|
+
)), isLoading ? /* @__PURE__ */ React4.createElement(NotificationListSkeleton, null) : sorted.length === 0 ? /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-empty" }, /* @__PURE__ */ React4.createElement("svg", { "aria-hidden": "true", width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.3 } }, /* @__PURE__ */ React4.createElement("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }), /* @__PURE__ */ React4.createElement("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })), /* @__PURE__ */ React4.createElement("span", { className: "brokr-notif-empty-text" }, "No notifications yet")) : /* @__PURE__ */ React4.createElement("div", { className: "brokr-notif-list-items" }, sorted.map((notif) => /* @__PURE__ */ React4.createElement(
|
|
253
|
+
NotifListItem,
|
|
254
|
+
{
|
|
255
|
+
key: notif.id,
|
|
256
|
+
notif,
|
|
257
|
+
registry,
|
|
258
|
+
onClick: handleClick
|
|
259
|
+
}
|
|
260
|
+
))));
|
|
248
261
|
}
|
|
249
262
|
export {
|
|
250
263
|
NotificationBell,
|