@blocklet/discuss-kit-ux 1.6.256 → 1.6.257

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.
@@ -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-CzK57e8k.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-Dn-NpJW2.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
- const init = async () => {
3602
- if (session.user && !preferences.disableNotificationBadge) {
3603
- const unreadState = await update();
3604
- setInitialState(unreadState);
3605
- }
3606
- };
3607
- init();
3599
+ if (session.user && !preferences.disableNotificationBadge) {
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, initialUnread]
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 { initialUnread } = useUnreadNotification();
5274
+ const { unread } = useUnreadNotification();
5282
5275
  const { navigateToChatList, updateUnreadState } = useChatInWallet();
5283
5276
  useEffect(() => {
5284
- if (typeof initialUnread === "boolean") {
5285
- updateUnreadState(initialUnread);
5286
- }
5287
- }, [initialUnread, updateUnreadState]);
5277
+ updateUnreadState(unread);
5278
+ }, [unread, updateUnreadState]);
5288
5279
  if (!initialized) {
5289
5280
  return /* @__PURE__ */ jsx(CircularProgress, {});
5290
5281
  }
@@ -5612,7 +5603,7 @@ function Pagination({
5612
5603
  }
5613
5604
  );
5614
5605
  }
5615
- const Editor = lazy(() => import("./editor-o1MMShzH.mjs"));
5606
+ const Editor = lazy(() => import("./editor-BYYdot9H.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-CzK57e8k.mjs";
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-Dn-NpJW2.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
- const init = async () => {
3531
- if (session.user && !preferences.disableNotificationBadge) {
3532
- const unreadState = await update();
3533
- setInitialState(unreadState);
3534
- }
3535
- };
3536
- init();
3528
+ if (session.user && !preferences.disableNotificationBadge) {
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, initialUnread]
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 { initialUnread } = useUnreadNotification();
5203
+ const { unread } = useUnreadNotification();
5211
5204
  const { navigateToChatList, updateUnreadState } = useChatInWallet();
5212
5205
  react.useEffect(() => {
5213
- if (typeof initialUnread === "boolean") {
5214
- updateUnreadState(initialUnread);
5215
- }
5216
- }, [initialUnread, updateUnreadState]);
5206
+ updateUnreadState(unread);
5207
+ }, [unread, updateUnreadState]);
5217
5208
  if (!initialized) {
5218
5209
  return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
5219
5210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.6.256",
3
+ "version": "1.6.257",
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.256",
35
- "@blocklet/labels": "1.6.256",
34
+ "@blocklet/editor": "1.6.257",
35
+ "@blocklet/labels": "1.6.257",
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": "4facfc228b66e7e2b783fd75d5e3d2d8e53b117b"
102
+ "gitHead": "427c78b7cf9dbaaab2f6576e8da87d761156e280"
103
103
  }