@blocklet/discuss-kit-ux 1.6.256 → 1.6.258
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/components/chat/unread-notification.d.ts +0 -1
- package/dist/{editor-o1MMShzH.mjs → editor-BgoCcMOC.mjs} +1 -1
- package/dist/{index-CzK57e8k.mjs → index-B65hdBdO.mjs} +10 -19
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +9 -18
- package/dist/preferences.d.ts +1 -0
- package/package.json +4 -4
|
@@ -6,7 +6,6 @@ interface UnreadNotificationProviderProps {
|
|
|
6
6
|
}
|
|
7
7
|
interface UnreadNotificationContextType {
|
|
8
8
|
unread: boolean;
|
|
9
|
-
initialUnread: boolean | undefined;
|
|
10
9
|
markAsUnread: (value?: boolean) => void;
|
|
11
10
|
}
|
|
12
11
|
export declare const UnreadNotificationContext: import('react').Context<UnreadNotificationContextType>;
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazy } from "react";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-B65hdBdO.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -3590,30 +3590,23 @@ const useUnreadNotification = () => useContext(UnreadNotificationContext);
|
|
|
3590
3590
|
function UnreadNotificationProvider({ fetchUnreadState, children }) {
|
|
3591
3591
|
const { session } = useSessionContext();
|
|
3592
3592
|
const [unread, setUnread] = useState(false);
|
|
3593
|
-
const [initialUnread, setInitialState] = useState(void 0);
|
|
3594
3593
|
const markAsUnread = useCallback((value2 = true) => setUnread(value2), []);
|
|
3595
3594
|
const update = async () => {
|
|
3596
3595
|
const unreadState = await fetchUnreadState();
|
|
3597
3596
|
setUnread(unreadState);
|
|
3598
|
-
return unreadState;
|
|
3599
3597
|
};
|
|
3600
3598
|
useEffect(() => {
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
setInitialState(unreadState);
|
|
3605
|
-
}
|
|
3606
|
-
};
|
|
3607
|
-
init();
|
|
3599
|
+
if (session.user && !preferences.disableNotificationBadge && preferences.chatEnabled) {
|
|
3600
|
+
update();
|
|
3601
|
+
}
|
|
3608
3602
|
}, [session.user]);
|
|
3609
3603
|
const value = useMemo(
|
|
3610
3604
|
() => ({
|
|
3611
3605
|
unread,
|
|
3612
|
-
initialUnread,
|
|
3613
3606
|
markAsUnread
|
|
3614
3607
|
}),
|
|
3615
3608
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3616
|
-
[unread
|
|
3609
|
+
[unread]
|
|
3617
3610
|
);
|
|
3618
3611
|
return /* @__PURE__ */ jsx(UnreadNotificationContext.Provider, { value, children });
|
|
3619
3612
|
}
|
|
@@ -3947,7 +3940,7 @@ const useChatInWallet = () => {
|
|
|
3947
3940
|
navigate("/chat-in-wallet");
|
|
3948
3941
|
};
|
|
3949
3942
|
const updateUnreadState = useCallback((unread) => {
|
|
3950
|
-
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appId });
|
|
3943
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appId, timestamp: /* @__PURE__ */ new Date() });
|
|
3951
3944
|
}, []);
|
|
3952
3945
|
return { navigateToChat, navigateToChatList, isChatInWalletV2, updateUnreadState };
|
|
3953
3946
|
};
|
|
@@ -5278,13 +5271,11 @@ function Empty({ sx }) {
|
|
|
5278
5271
|
}
|
|
5279
5272
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5280
5273
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5281
|
-
const {
|
|
5274
|
+
const { unread } = useUnreadNotification();
|
|
5282
5275
|
const { navigateToChatList, updateUnreadState } = useChatInWallet();
|
|
5283
5276
|
useEffect(() => {
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
}
|
|
5287
|
-
}, [initialUnread, updateUnreadState]);
|
|
5277
|
+
updateUnreadState(unread);
|
|
5278
|
+
}, [unread, updateUnreadState]);
|
|
5288
5279
|
if (!initialized) {
|
|
5289
5280
|
return /* @__PURE__ */ jsx(CircularProgress, {});
|
|
5290
5281
|
}
|
|
@@ -5326,7 +5317,7 @@ const iconoirMessageText = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0
|
|
|
5326
5317
|
] }) });
|
|
5327
5318
|
function ChatHeaderAddon({ ...rest }) {
|
|
5328
5319
|
const { unread } = useUnreadNotification();
|
|
5329
|
-
if (preferences.disableNotificationBadge) {
|
|
5320
|
+
if (preferences.disableNotificationBadge || !preferences.chatEnabled) {
|
|
5330
5321
|
return null;
|
|
5331
5322
|
}
|
|
5332
5323
|
return /* @__PURE__ */ jsx(IconButton$2, { size: "medium", ...rest, component: Link, to: "/chat", children: /* @__PURE__ */ jsx(Badge$1, { color: "error", variant: "dot", invisible: !unread, children: /* @__PURE__ */ jsx(iconoirMessageText, { style: { fontSize: 20 } }) }) });
|
|
@@ -5612,7 +5603,7 @@ function Pagination({
|
|
|
5612
5603
|
}
|
|
5613
5604
|
);
|
|
5614
5605
|
}
|
|
5615
|
-
const Editor = lazy(() => import("./editor-
|
|
5606
|
+
const Editor = lazy(() => import("./editor-BgoCcMOC.mjs"));
|
|
5616
5607
|
function LazyEditor(props) {
|
|
5617
5608
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
5618
5609
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-
|
|
2
|
+
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-B65hdBdO.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -3519,30 +3519,23 @@ var __publicField = (obj, key, value) => {
|
|
|
3519
3519
|
function UnreadNotificationProvider({ fetchUnreadState, children }) {
|
|
3520
3520
|
const { session } = useSessionContext();
|
|
3521
3521
|
const [unread, setUnread] = react.useState(false);
|
|
3522
|
-
const [initialUnread, setInitialState] = react.useState(void 0);
|
|
3523
3522
|
const markAsUnread = react.useCallback((value2 = true) => setUnread(value2), []);
|
|
3524
3523
|
const update = async () => {
|
|
3525
3524
|
const unreadState = await fetchUnreadState();
|
|
3526
3525
|
setUnread(unreadState);
|
|
3527
|
-
return unreadState;
|
|
3528
3526
|
};
|
|
3529
3527
|
react.useEffect(() => {
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
setInitialState(unreadState);
|
|
3534
|
-
}
|
|
3535
|
-
};
|
|
3536
|
-
init();
|
|
3528
|
+
if (session.user && !preferences.disableNotificationBadge && preferences.chatEnabled) {
|
|
3529
|
+
update();
|
|
3530
|
+
}
|
|
3537
3531
|
}, [session.user]);
|
|
3538
3532
|
const value = react.useMemo(
|
|
3539
3533
|
() => ({
|
|
3540
3534
|
unread,
|
|
3541
|
-
initialUnread,
|
|
3542
3535
|
markAsUnread
|
|
3543
3536
|
}),
|
|
3544
3537
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3545
|
-
[unread
|
|
3538
|
+
[unread]
|
|
3546
3539
|
);
|
|
3547
3540
|
return /* @__PURE__ */ jsxRuntime.jsx(UnreadNotificationContext.Provider, { value, children });
|
|
3548
3541
|
}
|
|
@@ -3876,7 +3869,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3876
3869
|
navigate("/chat-in-wallet");
|
|
3877
3870
|
};
|
|
3878
3871
|
const updateUnreadState = react.useCallback((unread) => {
|
|
3879
|
-
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appId });
|
|
3872
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appId, timestamp: /* @__PURE__ */ new Date() });
|
|
3880
3873
|
}, []);
|
|
3881
3874
|
return { navigateToChat, navigateToChatList, isChatInWalletV2, updateUnreadState };
|
|
3882
3875
|
};
|
|
@@ -5207,13 +5200,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5207
5200
|
}
|
|
5208
5201
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5209
5202
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5210
|
-
const {
|
|
5203
|
+
const { unread } = useUnreadNotification();
|
|
5211
5204
|
const { navigateToChatList, updateUnreadState } = useChatInWallet();
|
|
5212
5205
|
react.useEffect(() => {
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
}
|
|
5216
|
-
}, [initialUnread, updateUnreadState]);
|
|
5206
|
+
updateUnreadState(unread);
|
|
5207
|
+
}, [unread, updateUnreadState]);
|
|
5217
5208
|
if (!initialized) {
|
|
5218
5209
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
|
|
5219
5210
|
}
|
|
@@ -5255,7 +5246,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5255
5246
|
] }) });
|
|
5256
5247
|
function ChatHeaderAddon({ ...rest }) {
|
|
5257
5248
|
const { unread } = useUnreadNotification();
|
|
5258
|
-
if (preferences.disableNotificationBadge) {
|
|
5249
|
+
if (preferences.disableNotificationBadge || !preferences.chatEnabled) {
|
|
5259
5250
|
return null;
|
|
5260
5251
|
}
|
|
5261
5252
|
return /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { size: "medium", ...rest, component: reactRouterDom.Link, to: "/chat", children: /* @__PURE__ */ jsxRuntime.jsx(material.Badge, { color: "error", variant: "dot", invisible: !unread, children: /* @__PURE__ */ jsxRuntime.jsx(iconoirMessageText, { style: { fontSize: 20 } }) }) });
|
package/dist/preferences.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.258",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@arcblock/bridge": "^2.9.77",
|
|
32
32
|
"@arcblock/react-hooks": "^2.9.80",
|
|
33
33
|
"@arcblock/ws": "^1.18.116",
|
|
34
|
-
"@blocklet/editor": "1.6.
|
|
35
|
-
"@blocklet/labels": "1.6.
|
|
34
|
+
"@blocklet/editor": "1.6.258",
|
|
35
|
+
"@blocklet/labels": "1.6.258",
|
|
36
36
|
"@blocklet/uploader": "^0.1.2",
|
|
37
37
|
"@emotion/css": "^11.10.5",
|
|
38
38
|
"@emotion/react": "^11.10.5",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"resolutions": {
|
|
100
100
|
"react": "^18.2.0"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "6b5469534e4b90a352a6e9af359e5bf57daac880"
|
|
103
103
|
}
|