@janovix/blocks 1.2.0-rc.13 → 1.2.0-rc.14
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.cjs +3 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5036,45 +5036,16 @@ function NotificationsWidget({
|
|
|
5036
5036
|
if (!notificationIds.has(id)) {
|
|
5037
5037
|
next.delete(id);
|
|
5038
5038
|
changed = true;
|
|
5039
|
-
console.log(
|
|
5040
|
-
"[NotificationsWidget] Removing stale optimistic ID:",
|
|
5041
|
-
id
|
|
5042
|
-
);
|
|
5043
5039
|
return;
|
|
5044
5040
|
}
|
|
5045
5041
|
if (notification?.read === true) {
|
|
5046
5042
|
next.delete(id);
|
|
5047
5043
|
changed = true;
|
|
5048
|
-
console.log(
|
|
5049
|
-
"[NotificationsWidget] Clearing optimistic state for server-confirmed read:",
|
|
5050
|
-
id
|
|
5051
|
-
);
|
|
5052
5044
|
}
|
|
5053
5045
|
});
|
|
5054
5046
|
return changed ? next : prev;
|
|
5055
5047
|
});
|
|
5056
5048
|
}, [notifications]);
|
|
5057
|
-
React2__namespace.useEffect(() => {
|
|
5058
|
-
console.log(
|
|
5059
|
-
"[NotificationsWidget] Notifications received:",
|
|
5060
|
-
notifications.length
|
|
5061
|
-
);
|
|
5062
|
-
console.log(
|
|
5063
|
-
"[NotificationsWidget] Unread count:",
|
|
5064
|
-
unreadCount,
|
|
5065
|
-
"| Optimistic read IDs:",
|
|
5066
|
-
Array.from(optimisticReadIds)
|
|
5067
|
-
);
|
|
5068
|
-
console.log(
|
|
5069
|
-
"[NotificationsWidget] Notification read states:",
|
|
5070
|
-
notifications.map((n) => ({
|
|
5071
|
-
id: n.id,
|
|
5072
|
-
title: n.title,
|
|
5073
|
-
read: n.read,
|
|
5074
|
-
isRead: getIsRead(n)
|
|
5075
|
-
}))
|
|
5076
|
-
);
|
|
5077
|
-
}, [notifications, unreadCount, optimisticReadIds, getIsRead]);
|
|
5078
5049
|
const sortedNotifications = React2__namespace.useMemo(
|
|
5079
5050
|
() => [...notifications].sort(
|
|
5080
5051
|
(a, b) => b.timestamp.getTime() - a.timestamp.getTime()
|
|
@@ -5085,7 +5056,7 @@ function NotificationsWidget({
|
|
|
5085
5056
|
const maxListHeight = Math.min(maxVisible, 5) * notificationHeight;
|
|
5086
5057
|
const hasMore = sortedNotifications.length > maxVisible;
|
|
5087
5058
|
React2__namespace.useEffect(() => {
|
|
5088
|
-
if (playSound && soundType !== "none" && unreadCount > prevCount
|
|
5059
|
+
if (playSound && soundType !== "none" && unreadCount > prevCount) {
|
|
5089
5060
|
const now = Date.now();
|
|
5090
5061
|
if (now - lastSoundPlayedRef.current >= soundCooldown) {
|
|
5091
5062
|
playNotificationSound(soundType, soundUrl);
|
|
@@ -5102,26 +5073,13 @@ function NotificationsWidget({
|
|
|
5102
5073
|
(n) => n.id === notificationId
|
|
5103
5074
|
);
|
|
5104
5075
|
if (!notification || getIsReadRef.current(notification)) {
|
|
5105
|
-
console.log(
|
|
5106
|
-
"[NotificationsWidget] Skipping handleMarkAsRead - already read or not found:",
|
|
5107
|
-
notificationId
|
|
5108
|
-
);
|
|
5109
5076
|
return;
|
|
5110
5077
|
}
|
|
5111
|
-
console.log("[NotificationsWidget] Marking as read:", notificationId);
|
|
5112
5078
|
processingIdsRef.current.add(notificationId);
|
|
5113
5079
|
setOptimisticReadIds((prev) => new Set(prev).add(notificationId));
|
|
5114
5080
|
try {
|
|
5115
5081
|
await Promise.resolve(onMarkAsRead(notificationId));
|
|
5116
|
-
|
|
5117
|
-
"[NotificationsWidget] Successfully marked as read (keeping optimistic state):",
|
|
5118
|
-
notificationId
|
|
5119
|
-
);
|
|
5120
|
-
} catch (error) {
|
|
5121
|
-
console.error(
|
|
5122
|
-
"[NotificationsWidget] Failed to mark as read, reverting:",
|
|
5123
|
-
error
|
|
5124
|
-
);
|
|
5082
|
+
} catch {
|
|
5125
5083
|
setOptimisticReadIds((prev) => {
|
|
5126
5084
|
const next = new Set(prev);
|
|
5127
5085
|
next.delete(notificationId);
|
|
@@ -5144,11 +5102,7 @@ function NotificationsWidget({
|
|
|
5144
5102
|
});
|
|
5145
5103
|
try {
|
|
5146
5104
|
await Promise.resolve(onMarkAllAsRead());
|
|
5147
|
-
} catch
|
|
5148
|
-
console.error(
|
|
5149
|
-
"[NotificationsWidget] Failed to mark all as read, reverting:",
|
|
5150
|
-
error
|
|
5151
|
-
);
|
|
5105
|
+
} catch {
|
|
5152
5106
|
setOptimisticReadIds((prev) => {
|
|
5153
5107
|
const next = new Set(prev);
|
|
5154
5108
|
unreadIds.forEach((id) => next.delete(id));
|
|
@@ -5159,15 +5113,9 @@ function NotificationsWidget({
|
|
|
5159
5113
|
React2__namespace.useEffect(() => {
|
|
5160
5114
|
if (!isOpen || !onMarkAsRead) return;
|
|
5161
5115
|
intersectedIdsRef.current.clear();
|
|
5162
|
-
console.log(
|
|
5163
|
-
"[NotificationsWidget] Creating IntersectionObserver for popover"
|
|
5164
|
-
);
|
|
5165
5116
|
const timeoutId = setTimeout(() => {
|
|
5166
5117
|
const scrollContainer = scrollContainerRef.current;
|
|
5167
5118
|
if (!scrollContainer) {
|
|
5168
|
-
console.warn(
|
|
5169
|
-
"[NotificationsWidget] Scroll container not found for observer"
|
|
5170
|
-
);
|
|
5171
5119
|
return;
|
|
5172
5120
|
}
|
|
5173
5121
|
const observer = new IntersectionObserver(
|
|
@@ -5184,18 +5132,7 @@ function NotificationsWidget({
|
|
|
5184
5132
|
);
|
|
5185
5133
|
const isRead = notification ? getIsReadRef.current(notification) : false;
|
|
5186
5134
|
if (notification && !isRead) {
|
|
5187
|
-
console.log(
|
|
5188
|
-
"[NotificationsWidget] Marking notification as read via intersection:",
|
|
5189
|
-
notificationId
|
|
5190
|
-
);
|
|
5191
5135
|
handleMarkAsRead(notificationId);
|
|
5192
|
-
} else {
|
|
5193
|
-
console.log(
|
|
5194
|
-
"[NotificationsWidget] Skipping already-read notification:",
|
|
5195
|
-
notificationId,
|
|
5196
|
-
"read=",
|
|
5197
|
-
isRead
|
|
5198
|
-
);
|
|
5199
5136
|
}
|
|
5200
5137
|
}
|
|
5201
5138
|
}
|
|
@@ -5210,14 +5147,8 @@ function NotificationsWidget({
|
|
|
5210
5147
|
const notificationElements = scrollContainer.querySelectorAll(
|
|
5211
5148
|
"[data-notification-id]"
|
|
5212
5149
|
);
|
|
5213
|
-
console.log(
|
|
5214
|
-
"[NotificationsWidget] Observing",
|
|
5215
|
-
notificationElements.length,
|
|
5216
|
-
"notifications"
|
|
5217
|
-
);
|
|
5218
5150
|
notificationElements.forEach((el) => observer.observe(el));
|
|
5219
5151
|
return () => {
|
|
5220
|
-
console.log("[NotificationsWidget] Disconnecting IntersectionObserver");
|
|
5221
5152
|
observer.disconnect();
|
|
5222
5153
|
};
|
|
5223
5154
|
}, 100);
|
|
@@ -5233,16 +5164,6 @@ function NotificationsWidget({
|
|
|
5233
5164
|
onNotificationClick?.(notification);
|
|
5234
5165
|
}
|
|
5235
5166
|
};
|
|
5236
|
-
console.log(
|
|
5237
|
-
"[NotificationsWidget] Rendering bell with unreadCount:",
|
|
5238
|
-
unreadCount,
|
|
5239
|
-
"| showDot:",
|
|
5240
|
-
unreadCount > 0,
|
|
5241
|
-
"| dotBgColor:",
|
|
5242
|
-
dotBgColor,
|
|
5243
|
-
"| styles.dot:",
|
|
5244
|
-
styles.dot
|
|
5245
|
-
);
|
|
5246
5167
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5247
5168
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5248
5169
|
react.motion.button,
|