@blocklet/discuss-kit-ux 2.0.3 → 2.0.5
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/hooks.d.ts +1 -0
- package/dist/components/utils.d.ts +2 -0
- package/dist/{editor-BkMaHMub.mjs → editor-D74w8-L_.mjs} +1 -1
- package/dist/{index-CEuSe9YY.mjs → index-51C5AuVf.mjs} +156 -87
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +149 -81
- package/package.json +5 -4
|
@@ -16,3 +16,5 @@ export declare const inferDiscussKitApiPrefix: () => any;
|
|
|
16
16
|
export declare const getDraftSessionKeyPrefix: () => string;
|
|
17
17
|
export declare const getExcerptFromLexicalContent: (content: any, size?: number) => string;
|
|
18
18
|
export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<Theme>) => any[];
|
|
19
|
+
export declare const discussKitMountPoint: string | undefined;
|
|
20
|
+
export declare const openProfileInNewTab: (did: string) => void;
|
|
@@ -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-51C5AuVf.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -4,18 +4,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
var _a, _b;
|
|
7
|
+
var _a, _b, _c;
|
|
8
8
|
import { Labels2, LabelPicker } from "@blocklet/labels";
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { useTheme, ThemeProvider, styled } from "@mui/material/styles";
|
|
11
11
|
import { create as create$1, styled as styled$1 } from "@arcblock/ux/lib/Theme";
|
|
12
|
-
import { useEffect, useRef, useState, createElement, useContext, useMemo, isValidElement, lazy, Suspense, createContext, Fragment as Fragment$1, forwardRef
|
|
12
|
+
import { useEffect, useRef, useState, createElement, useContext, useMemo, useCallback, isValidElement, lazy, Suspense, createContext, Fragment as Fragment$1, forwardRef } from "react";
|
|
13
13
|
import { Box, useTheme as useTheme$1, useMediaQuery, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Backdrop, Autocomplete, Typography as Typography$1, TextField as TextField$1, InputAdornment, SwipeableDrawer, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
14
14
|
import isNil from "lodash/isNil";
|
|
15
15
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
16
16
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
17
|
-
import { $getRoot, $createParagraphNode, $createTextNode, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection
|
|
17
|
+
import { $getRoot, $createParagraphNode, $createTextNode, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection } from "lexical";
|
|
18
18
|
import { $isRootTextContentEmpty } from "@lexical/text";
|
|
19
|
+
import { resolvePath, Link, useNavigate, useMatch, useLocation, useParams, Outlet, useSearchParams, useBlocker } from "react-router-dom";
|
|
20
|
+
import { joinURL } from "ufo";
|
|
19
21
|
import joinUrl from "url-join";
|
|
20
22
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
21
23
|
import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
@@ -34,7 +36,7 @@ import { grey, green, amber } from "@mui/material/colors";
|
|
|
34
36
|
import useMediaQuery$1 from "@mui/material/useMediaQuery";
|
|
35
37
|
import DID from "@arcblock/ux/lib/DID";
|
|
36
38
|
import Tooltip, { tooltipClasses } from "@mui/material/Tooltip";
|
|
37
|
-
import {
|
|
39
|
+
import { useBrowser } from "@arcblock/react-hooks";
|
|
38
40
|
import UxRelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
39
41
|
import Chip from "@mui/material/Chip";
|
|
40
42
|
import Stack from "@mui/material/Stack";
|
|
@@ -47,6 +49,8 @@ import BrokenImageIcon from "@mui/icons-material/BrokenImage";
|
|
|
47
49
|
import { Icon } from "@iconify/react";
|
|
48
50
|
import Empty$3 from "@arcblock/ux/lib/Empty";
|
|
49
51
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
52
|
+
import cmp from "semver-compare";
|
|
53
|
+
import bridge from "@arcblock/bridge";
|
|
50
54
|
import NotificationsActiveOutlinedIcon from "@mui/icons-material/NotificationsActiveOutlined";
|
|
51
55
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
52
56
|
import DIDAddress from "@arcblock/did-connect/lib/Address";
|
|
@@ -66,15 +70,12 @@ import CircularProgress from "@mui/material/CircularProgress";
|
|
|
66
70
|
import { Helmet } from "react-helmet";
|
|
67
71
|
import { Flipper, Flipped } from "react-flip-toolkit";
|
|
68
72
|
import grey$1 from "@mui/material/colors/grey";
|
|
69
|
-
import
|
|
70
|
-
import bridge from "@arcblock/bridge";
|
|
71
|
-
import { useBrowser } from "@arcblock/react-hooks";
|
|
73
|
+
import { EditorConfigProvider as EditorConfigProvider$1 } from "@blocklet/editor";
|
|
72
74
|
import Fab from "@mui/material/Fab";
|
|
73
75
|
import debounce from "lodash/debounce";
|
|
74
76
|
import { useIsFocused } from "@blocklet/editor/lib/main/hooks/useIsFocused";
|
|
75
77
|
import TextField from "@mui/material/TextField";
|
|
76
78
|
import AddIcon from "@mui/icons-material/Add";
|
|
77
|
-
import SessionManager from "@arcblock/did-connect/lib/SessionManager";
|
|
78
79
|
import { AxiosError } from "axios";
|
|
79
80
|
import Toast from "@arcblock/ux/lib/Toast";
|
|
80
81
|
import MuiPagination from "@mui/material/Pagination";
|
|
@@ -341,10 +342,18 @@ const mergeSx = (initial, sx) => {
|
|
|
341
342
|
const mergedSx = [initial, ...Array.isArray(sx) ? sx : [sx]];
|
|
342
343
|
return mergedSx;
|
|
343
344
|
};
|
|
345
|
+
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
346
|
+
const openProfileInNewTab = (did) => {
|
|
347
|
+
if (did) {
|
|
348
|
+
const { pathname } = resolvePath(`/profile/${did}`);
|
|
349
|
+
window.open(joinURL(discussKitMountPoint || "/", pathname), "_blank");
|
|
350
|
+
}
|
|
351
|
+
};
|
|
344
352
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
345
353
|
__proto__: null,
|
|
346
354
|
blockletExists,
|
|
347
355
|
copy,
|
|
356
|
+
discussKitMountPoint,
|
|
348
357
|
getBlockletMountPointInfo,
|
|
349
358
|
getDraftSessionKeyPrefix,
|
|
350
359
|
getExcerptFromLexicalContent,
|
|
@@ -354,6 +363,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
354
363
|
inferDiscussKitApiPrefix,
|
|
355
364
|
mergeSx,
|
|
356
365
|
minDelay,
|
|
366
|
+
openProfileInNewTab,
|
|
357
367
|
protectLogin,
|
|
358
368
|
repairBase64Avatar,
|
|
359
369
|
sleep,
|
|
@@ -889,7 +899,7 @@ const formatKey = (key) => {
|
|
|
889
899
|
return "";
|
|
890
900
|
};
|
|
891
901
|
const badgeList = flatMap(
|
|
892
|
-
(((
|
|
902
|
+
(((_c = (_b = window == null ? void 0 : window.blocklet) == null ? void 0 : _b.preferences) == null ? void 0 : _c.badgeList) || []).filter((item) => [true, "true"].includes(item.enabled)).map((item) => {
|
|
893
903
|
var _a2;
|
|
894
904
|
return {
|
|
895
905
|
...item,
|
|
@@ -1034,13 +1044,13 @@ function Badge({
|
|
|
1034
1044
|
] }) : null;
|
|
1035
1045
|
}
|
|
1036
1046
|
const useSessionContext = () => {
|
|
1037
|
-
var _a2, _b2,
|
|
1047
|
+
var _a2, _b2, _c2, _d;
|
|
1038
1048
|
const ctx = useContext(SessionContext) || {};
|
|
1039
1049
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
1040
1050
|
const permissionSet = useMemo(() => {
|
|
1041
1051
|
var _a3, _b3;
|
|
1042
1052
|
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
1043
|
-
}, [(_d = (
|
|
1053
|
+
}, [(_d = (_c2 = ctx.session) == null ? void 0 : _c2.user) == null ? void 0 : _d.permissions]);
|
|
1044
1054
|
return {
|
|
1045
1055
|
...ctx,
|
|
1046
1056
|
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
@@ -1120,7 +1130,7 @@ const useResponsiveValue = (values2) => {
|
|
|
1120
1130
|
return r(values2);
|
|
1121
1131
|
};
|
|
1122
1132
|
function ProfileCard({ user, click, ...rest }) {
|
|
1123
|
-
var _a2, _b2,
|
|
1133
|
+
var _a2, _b2, _c2;
|
|
1124
1134
|
const { session } = useSessionContext();
|
|
1125
1135
|
const { t } = useLocaleContext();
|
|
1126
1136
|
let chatUrl = (user == null ? void 0 : user.did) && `/chat/dm/${user == null ? void 0 : user.did}`;
|
|
@@ -1189,7 +1199,7 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1189
1199
|
/* @__PURE__ */ jsx(Box$1, { sx: { mt: 1 }, children: /* @__PURE__ */ jsx(Badge, { passports: (user == null ? void 0 : user.passports) || [], pointInfo: (user == null ? void 0 : user.pointInfo) || {}, did: user == null ? void 0 : user.did }) })
|
|
1190
1200
|
] })
|
|
1191
1201
|
] }),
|
|
1192
|
-
chatUrl && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((
|
|
1202
|
+
chatUrl && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.did) !== user.did && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1193
1203
|
/* @__PURE__ */ jsx(Box$1, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1194
1204
|
/* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(
|
|
1195
1205
|
Button,
|
|
@@ -1208,6 +1218,50 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1208
1218
|
}
|
|
1209
1219
|
);
|
|
1210
1220
|
}
|
|
1221
|
+
const useChatInWallet = () => {
|
|
1222
|
+
const navigate = useNavigate();
|
|
1223
|
+
const { walletVersion, mobile } = useBrowser();
|
|
1224
|
+
const chatInWallet = useMatch("/chat-in-wallet/:chatId?");
|
|
1225
|
+
const isChatInWalletV2 = useMemo(() => {
|
|
1226
|
+
try {
|
|
1227
|
+
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
1228
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1229
|
+
} catch (e) {
|
|
1230
|
+
console.error(e);
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
1233
|
+
}, [walletVersion, mobile]);
|
|
1234
|
+
const isWebNavbar = useMemo(() => {
|
|
1235
|
+
try {
|
|
1236
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1237
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1238
|
+
} catch (e) {
|
|
1239
|
+
console.error(e);
|
|
1240
|
+
return false;
|
|
1241
|
+
}
|
|
1242
|
+
}, [walletVersion, mobile]);
|
|
1243
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
1244
|
+
if (isChatInWalletV2) {
|
|
1245
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
1246
|
+
} else {
|
|
1247
|
+
bridge.call("clickChat", { id: id2, title });
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
const navigateToChatList = () => {
|
|
1251
|
+
navigate("/chat-in-wallet");
|
|
1252
|
+
};
|
|
1253
|
+
const updateUnreadState = useCallback((unread) => {
|
|
1254
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
1255
|
+
}, []);
|
|
1256
|
+
return {
|
|
1257
|
+
navigateToChat,
|
|
1258
|
+
navigateToChatList,
|
|
1259
|
+
isChatInWalletV2,
|
|
1260
|
+
isWebNavbar,
|
|
1261
|
+
updateUnreadState,
|
|
1262
|
+
chatInWallet
|
|
1263
|
+
};
|
|
1264
|
+
};
|
|
1211
1265
|
const HtmlTooltip$1 = styled(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1212
1266
|
Tooltip,
|
|
1213
1267
|
{
|
|
@@ -1242,6 +1296,8 @@ function AuthorInfo({
|
|
|
1242
1296
|
const downMd = useMediaQuery$1(theme.breakpoints.down("md"));
|
|
1243
1297
|
const navigate = useNavigate();
|
|
1244
1298
|
const [open, setOpen] = useState(false);
|
|
1299
|
+
const { mobile } = useBrowser();
|
|
1300
|
+
const { chatInWallet } = useChatInWallet();
|
|
1245
1301
|
const sm = size === "sm";
|
|
1246
1302
|
let fontSize = sm ? 12 : 14;
|
|
1247
1303
|
let avatarSize = profileUse ? 24 : sm ? 40 : 48;
|
|
@@ -1267,12 +1323,16 @@ function AuthorInfo({
|
|
|
1267
1323
|
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1268
1324
|
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1269
1325
|
setOpen(false);
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1326
|
+
if (chatInWallet) {
|
|
1327
|
+
openProfileInNewTab(user == null ? void 0 : user.did);
|
|
1328
|
+
} else {
|
|
1329
|
+
setTimeout(() => {
|
|
1330
|
+
navigate(`/profile/${user == null ? void 0 : user.did}`);
|
|
1331
|
+
}, 100);
|
|
1332
|
+
}
|
|
1273
1333
|
};
|
|
1274
1334
|
const renderAvatar = () => {
|
|
1275
|
-
if (showProfileCard) {
|
|
1335
|
+
if (showProfileCard && !mobile.any) {
|
|
1276
1336
|
return /* @__PURE__ */ jsx(
|
|
1277
1337
|
HtmlTooltip$1,
|
|
1278
1338
|
{
|
|
@@ -3923,42 +3983,6 @@ function ChannelGroup({ size = "normal", chat, children, ...rest }) {
|
|
|
3923
3983
|
] })
|
|
3924
3984
|
] });
|
|
3925
3985
|
}
|
|
3926
|
-
const useChatInWallet = () => {
|
|
3927
|
-
const navigate = useNavigate();
|
|
3928
|
-
const { walletVersion, mobile } = useBrowser();
|
|
3929
|
-
const isChatInWalletV2 = useMemo(() => {
|
|
3930
|
-
try {
|
|
3931
|
-
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
3932
|
-
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3933
|
-
} catch (e) {
|
|
3934
|
-
console.error(e);
|
|
3935
|
-
return false;
|
|
3936
|
-
}
|
|
3937
|
-
}, [walletVersion, mobile]);
|
|
3938
|
-
const isWebNavbar = useMemo(() => {
|
|
3939
|
-
try {
|
|
3940
|
-
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
3941
|
-
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3942
|
-
} catch (e) {
|
|
3943
|
-
console.error(e);
|
|
3944
|
-
return false;
|
|
3945
|
-
}
|
|
3946
|
-
}, [walletVersion, mobile]);
|
|
3947
|
-
const navigateToChat = ({ id: id2, title }) => {
|
|
3948
|
-
if (isChatInWalletV2) {
|
|
3949
|
-
navigate(`/chat-in-wallet/${id2}`);
|
|
3950
|
-
} else {
|
|
3951
|
-
bridge.call("clickChat", { id: id2, title });
|
|
3952
|
-
}
|
|
3953
|
-
};
|
|
3954
|
-
const navigateToChatList = () => {
|
|
3955
|
-
navigate("/chat-in-wallet");
|
|
3956
|
-
};
|
|
3957
|
-
const updateUnreadState = useCallback((unread) => {
|
|
3958
|
-
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
3959
|
-
}, []);
|
|
3960
|
-
return { navigateToChat, navigateToChatList, isChatInWalletV2, isWebNavbar, updateUnreadState };
|
|
3961
|
-
};
|
|
3962
3986
|
function ChatList({ inWallet, ...rest }) {
|
|
3963
3987
|
const { t } = useLocaleContext();
|
|
3964
3988
|
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
@@ -4219,7 +4243,7 @@ function NotificationMessage({ chat, message, prevMessage }) {
|
|
|
4219
4243
|
return null;
|
|
4220
4244
|
};
|
|
4221
4245
|
const render = () => {
|
|
4222
|
-
var _a2, _b2,
|
|
4246
|
+
var _a2, _b2, _c2, _d;
|
|
4223
4247
|
const baseCardSx = {
|
|
4224
4248
|
py: 1.5,
|
|
4225
4249
|
px: 2,
|
|
@@ -4362,7 +4386,7 @@ function NotificationMessage({ chat, message, prevMessage }) {
|
|
|
4362
4386
|
]
|
|
4363
4387
|
}
|
|
4364
4388
|
),
|
|
4365
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_d = (_b2 = message == null ? void 0 : message.comment) == null ? void 0 : _b2.excerpt) == null ? void 0 : _d.replace((
|
|
4389
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_d = (_b2 = message == null ? void 0 : message.comment) == null ? void 0 : _b2.excerpt) == null ? void 0 : _d.replace((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.fullName, "") }),
|
|
4366
4390
|
renderQuote(message.post)
|
|
4367
4391
|
]
|
|
4368
4392
|
}
|
|
@@ -4679,7 +4703,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4679
4703
|
}
|
|
4680
4704
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
4681
4705
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
4682
|
-
const Editor = lazy(() => import("./editor-
|
|
4706
|
+
const Editor = lazy(() => import("./editor-D74w8-L_.mjs"));
|
|
4683
4707
|
function LazyEditor(props) {
|
|
4684
4708
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4685
4709
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -4719,7 +4743,12 @@ function AutoClearPlugin({ clearKey }) {
|
|
|
4719
4743
|
if (editor && clearKey) {
|
|
4720
4744
|
editor.update(() => {
|
|
4721
4745
|
const root = $getRoot();
|
|
4746
|
+
const paragraph = $createParagraphNode();
|
|
4722
4747
|
root.clear();
|
|
4748
|
+
root.append(paragraph);
|
|
4749
|
+
if ($getSelection() !== null) {
|
|
4750
|
+
paragraph.select();
|
|
4751
|
+
}
|
|
4723
4752
|
});
|
|
4724
4753
|
}
|
|
4725
4754
|
}, [editor, clearKey]);
|
|
@@ -4738,6 +4767,39 @@ function DraggerPlugin() {
|
|
|
4738
4767
|
const hasFocus = useIsFocused();
|
|
4739
4768
|
const selection = editor.getEditorState().read($getSelection);
|
|
4740
4769
|
const enabled = mobile.any && hasFocus && selection;
|
|
4770
|
+
const detectSwipe = (node, callback) => {
|
|
4771
|
+
let touchstartY = 0;
|
|
4772
|
+
let touchendY = 0;
|
|
4773
|
+
function handleSwipe() {
|
|
4774
|
+
if (touchstartY - touchendY > 10 || touchendY - touchstartY > 10) {
|
|
4775
|
+
callback();
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
const onTouchStart = (event) => {
|
|
4779
|
+
touchstartY = event.changedTouches[0].screenY;
|
|
4780
|
+
};
|
|
4781
|
+
const onTouchEnd = (event) => {
|
|
4782
|
+
touchendY = event.changedTouches[0].screenY;
|
|
4783
|
+
handleSwipe();
|
|
4784
|
+
};
|
|
4785
|
+
node.addEventListener("touchstart", onTouchStart, false);
|
|
4786
|
+
node.addEventListener("touchend", onTouchEnd, false);
|
|
4787
|
+
return () => {
|
|
4788
|
+
node.removeEventListener("touchstart", onTouchStart, false);
|
|
4789
|
+
node.removeEventListener("touchend", onTouchEnd, false);
|
|
4790
|
+
};
|
|
4791
|
+
};
|
|
4792
|
+
useEffect(() => {
|
|
4793
|
+
const root = editor.getRootElement();
|
|
4794
|
+
if (enabled && root) {
|
|
4795
|
+
const cleanup = [detectSwipe(document.body, () => editor.blur()), detectSwipe(root, () => editor.blur())];
|
|
4796
|
+
return () => {
|
|
4797
|
+
cleanup.forEach((fn) => fn());
|
|
4798
|
+
};
|
|
4799
|
+
}
|
|
4800
|
+
return () => {
|
|
4801
|
+
};
|
|
4802
|
+
}, [editor, enabled]);
|
|
4741
4803
|
if (enabled) {
|
|
4742
4804
|
return /* @__PURE__ */ jsx(
|
|
4743
4805
|
Box,
|
|
@@ -4761,32 +4823,17 @@ function ShortcutPlugin({ callback }) {
|
|
|
4761
4823
|
const [editor] = useLexicalComposerContext();
|
|
4762
4824
|
const { mobile } = useBrowser();
|
|
4763
4825
|
useEffect(() => {
|
|
4764
|
-
let dispatching = false;
|
|
4765
4826
|
return editor.registerCommand(
|
|
4766
4827
|
KEY_ENTER_COMMAND,
|
|
4767
4828
|
(e) => {
|
|
4768
|
-
if (
|
|
4769
|
-
dispatching = false;
|
|
4829
|
+
if (mobile.any || e.shiftKey) {
|
|
4770
4830
|
return false;
|
|
4771
4831
|
}
|
|
4772
|
-
if (e.shiftKey) {
|
|
4773
|
-
dispatching = true;
|
|
4774
|
-
const keyboardEvent = new KeyboardEvent("keydown", {
|
|
4775
|
-
code: "Enter",
|
|
4776
|
-
key: "Enter",
|
|
4777
|
-
charCode: 13,
|
|
4778
|
-
keyCode: 13,
|
|
4779
|
-
view: window,
|
|
4780
|
-
bubbles: true
|
|
4781
|
-
});
|
|
4782
|
-
e.preventDefault();
|
|
4783
|
-
editor.dispatchCommand(KEY_ENTER_COMMAND, keyboardEvent);
|
|
4784
|
-
return true;
|
|
4785
|
-
}
|
|
4786
4832
|
callback();
|
|
4833
|
+
e.preventDefault();
|
|
4787
4834
|
return true;
|
|
4788
4835
|
},
|
|
4789
|
-
|
|
4836
|
+
COMMAND_PRIORITY_LOW
|
|
4790
4837
|
);
|
|
4791
4838
|
}, [editor, callback, mobile.any]);
|
|
4792
4839
|
return null;
|
|
@@ -4802,6 +4849,9 @@ function ChatInput({ initialContent, send, onContentChange }) {
|
|
|
4802
4849
|
const [focused, setFocused] = useState(false);
|
|
4803
4850
|
const compactView = mobile.any && !focused;
|
|
4804
4851
|
const handleSend = () => {
|
|
4852
|
+
if (!content) {
|
|
4853
|
+
return;
|
|
4854
|
+
}
|
|
4805
4855
|
send(content);
|
|
4806
4856
|
setContent("");
|
|
4807
4857
|
setLastSent(Date.now());
|
|
@@ -4864,7 +4914,7 @@ function ChatInput({ initialContent, send, onContentChange }) {
|
|
|
4864
4914
|
children: /* @__PURE__ */ jsx(Box, { component: tablerSend, sx: { fontSize: 13, color: "text.secondary" } })
|
|
4865
4915
|
}
|
|
4866
4916
|
),
|
|
4867
|
-
/* @__PURE__ */ jsxs(
|
|
4917
|
+
/* @__PURE__ */ jsx(EditorConfigProvider$1, { value: { minimalMode: true }, children: /* @__PURE__ */ jsxs(
|
|
4868
4918
|
LazyEditor,
|
|
4869
4919
|
{
|
|
4870
4920
|
enableSaveAreaPlugin: false,
|
|
@@ -4884,7 +4934,7 @@ function ChatInput({ initialContent, send, onContentChange }) {
|
|
|
4884
4934
|
/* @__PURE__ */ jsx(FocusPlugin, { callback: (v2) => setFocused(v2) })
|
|
4885
4935
|
]
|
|
4886
4936
|
}
|
|
4887
|
-
)
|
|
4937
|
+
) })
|
|
4888
4938
|
]
|
|
4889
4939
|
}
|
|
4890
4940
|
),
|
|
@@ -5074,7 +5124,7 @@ function ChatRoom({ chat, inWallet, ...rest }) {
|
|
|
5074
5124
|
]
|
|
5075
5125
|
}
|
|
5076
5126
|
),
|
|
5077
|
-
/* @__PURE__ */ jsx(Box$1, { sx: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsx(MessageList, { chat }) }),
|
|
5127
|
+
/* @__PURE__ */ jsx(Box$1, { sx: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsx(EditorConfigProvider$1, { value: { openLinkInNewTab: !!inWallet }, children: /* @__PURE__ */ jsx(MessageList, { chat }) }) }),
|
|
5078
5128
|
/* @__PURE__ */ jsxs(Box$1, { sx: { position: "relative" }, children: [
|
|
5079
5129
|
chat.isActivated && chat.type !== "notification" && /* @__PURE__ */ jsx(Box$1, { sx: { px: { xs: 0, sm: 2.5 }, pb: { xs: 0, sm: 2.5 } }, children: /* @__PURE__ */ jsx(
|
|
5080
5130
|
ChatInput,
|
|
@@ -5529,7 +5579,7 @@ function Empty({ sx }) {
|
|
|
5529
5579
|
] });
|
|
5530
5580
|
}
|
|
5531
5581
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5532
|
-
var _a2, _b2;
|
|
5582
|
+
var _a2, _b2, _c2, _d;
|
|
5533
5583
|
const { session } = useSessionContext();
|
|
5534
5584
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5535
5585
|
const { unread } = useUnreadNotification();
|
|
@@ -5568,7 +5618,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5568
5618
|
sx: {
|
|
5569
5619
|
display: "flex",
|
|
5570
5620
|
justifyContent: "space-between",
|
|
5571
|
-
|
|
5621
|
+
alignItems: "center",
|
|
5572
5622
|
mb: 1
|
|
5573
5623
|
},
|
|
5574
5624
|
children: [
|
|
@@ -5581,12 +5631,31 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5581
5631
|
sx: { display: "flex", alignItems: "center", gap: 1 },
|
|
5582
5632
|
children: [
|
|
5583
5633
|
/* @__PURE__ */ jsx(Box$1, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5584
|
-
/* @__PURE__ */ jsx(Box$1, { component: "span", sx: { typography: "h5", fontWeight: "
|
|
5585
|
-
/* @__PURE__ */ jsx(
|
|
5634
|
+
/* @__PURE__ */ jsx(Box$1, { component: "span", sx: { typography: "h5", fontWeight: "bold" }, children: window.blocklet.appName }),
|
|
5635
|
+
/* @__PURE__ */ jsx(
|
|
5636
|
+
Box$1,
|
|
5637
|
+
{
|
|
5638
|
+
component: tablerSwitchHorizontal,
|
|
5639
|
+
sx: { fontSize: 15, color: "grey.600", "& [stroke-width='2']": { strokeWidth: "2!important" } }
|
|
5640
|
+
}
|
|
5641
|
+
)
|
|
5586
5642
|
]
|
|
5587
5643
|
}
|
|
5588
5644
|
),
|
|
5589
|
-
/* @__PURE__ */ jsx(
|
|
5645
|
+
/* @__PURE__ */ jsx(
|
|
5646
|
+
Avatar,
|
|
5647
|
+
{
|
|
5648
|
+
did: (_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did,
|
|
5649
|
+
src: (_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.avatar,
|
|
5650
|
+
size: 20,
|
|
5651
|
+
shape: "circle",
|
|
5652
|
+
variant: "circle",
|
|
5653
|
+
onClick: () => {
|
|
5654
|
+
var _a3;
|
|
5655
|
+
return openProfileInNewTab((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did);
|
|
5656
|
+
}
|
|
5657
|
+
}
|
|
5658
|
+
)
|
|
5590
5659
|
]
|
|
5591
5660
|
}
|
|
5592
5661
|
),
|
|
@@ -5611,7 +5680,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5611
5680
|
sx: {
|
|
5612
5681
|
width: 1,
|
|
5613
5682
|
height: 1,
|
|
5614
|
-
...((
|
|
5683
|
+
...((_d = window.chatInWallet) == null ? void 0 : _d.safeAreaInsetTop) && {
|
|
5615
5684
|
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5616
5685
|
}
|
|
5617
5686
|
},
|
|
@@ -11674,14 +11743,14 @@ function create(prefix2) {
|
|
|
11674
11743
|
}
|
|
11675
11744
|
});
|
|
11676
11745
|
}
|
|
11677
|
-
function getWsClient(prefix2 = ((
|
|
11746
|
+
function getWsClient(prefix2 = ((_d) => (_d = window.blocklet) == null ? void 0 : _d.prefix)() || "/") {
|
|
11678
11747
|
if (!client) {
|
|
11679
11748
|
client = create(prefix2);
|
|
11680
11749
|
}
|
|
11681
11750
|
return client;
|
|
11682
11751
|
}
|
|
11683
11752
|
const useSubscription = (event, cb = () => {
|
|
11684
|
-
}, deps = [], prefix2 = ((
|
|
11753
|
+
}, deps = [], prefix2 = ((_e) => (_e = window.blocklet) == null ? void 0 : _e.prefix)() || "/") => {
|
|
11685
11754
|
useEffect(() => {
|
|
11686
11755
|
if (event) {
|
|
11687
11756
|
if (!client) {
|
|
@@ -11748,7 +11817,7 @@ function PointUp({ points }) {
|
|
|
11748
11817
|
);
|
|
11749
11818
|
}
|
|
11750
11819
|
function PointUpProvider({ children }) {
|
|
11751
|
-
var _a2, _b2,
|
|
11820
|
+
var _a2, _b2, _c2, _d;
|
|
11752
11821
|
const state = useReactive({
|
|
11753
11822
|
pointsList: [],
|
|
11754
11823
|
visible: false,
|
|
@@ -11759,7 +11828,7 @@ function PointUpProvider({ children }) {
|
|
|
11759
11828
|
const pointUp = useCallback(({ points }) => {
|
|
11760
11829
|
state.pointsList.push(points);
|
|
11761
11830
|
}, []);
|
|
11762
|
-
const pointUpComponent = (
|
|
11831
|
+
const pointUpComponent = (_c2 = (_b2 = (_a2 = window.blocklet) == null ? void 0 : _a2.componentMountPoints) == null ? void 0 : _b2.find) == null ? void 0 : _c2.call(
|
|
11763
11832
|
_b2,
|
|
11764
11833
|
(item) => item.did === "z2qa2ZST7Frp8w1XGqyw9v85u12R3mBbB2oaA"
|
|
11765
11834
|
);
|
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-51C5AuVf.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("ufo"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "ufo", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ufo, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, ReactDOM, joinUrl, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, editor$1, Fab, debounce, useIsFocused, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ufo, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
12
|
const typography = {
|
|
13
13
|
h1: {
|
|
14
14
|
fontSize: "1.875rem",
|
|
@@ -268,10 +268,18 @@ var __publicField = (obj, key, value) => {
|
|
|
268
268
|
const mergedSx = [initial, ...Array.isArray(sx) ? sx : [sx]];
|
|
269
269
|
return mergedSx;
|
|
270
270
|
};
|
|
271
|
+
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
272
|
+
const openProfileInNewTab = (did) => {
|
|
273
|
+
if (did) {
|
|
274
|
+
const { pathname } = reactRouterDom.resolvePath(`/profile/${did}`);
|
|
275
|
+
window.open(ufo.joinURL(discussKitMountPoint || "/", pathname), "_blank");
|
|
276
|
+
}
|
|
277
|
+
};
|
|
271
278
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
272
279
|
__proto__: null,
|
|
273
280
|
blockletExists,
|
|
274
281
|
copy,
|
|
282
|
+
discussKitMountPoint,
|
|
275
283
|
getBlockletMountPointInfo,
|
|
276
284
|
getDraftSessionKeyPrefix,
|
|
277
285
|
getExcerptFromLexicalContent,
|
|
@@ -281,6 +289,7 @@ var __publicField = (obj, key, value) => {
|
|
|
281
289
|
inferDiscussKitApiPrefix,
|
|
282
290
|
mergeSx,
|
|
283
291
|
minDelay,
|
|
292
|
+
openProfileInNewTab,
|
|
284
293
|
protectLogin,
|
|
285
294
|
repairBase64Avatar,
|
|
286
295
|
sleep,
|
|
@@ -816,7 +825,7 @@ var __publicField = (obj, key, value) => {
|
|
|
816
825
|
return "";
|
|
817
826
|
};
|
|
818
827
|
const badgeList = flatMap(
|
|
819
|
-
(((
|
|
828
|
+
(((_c = (_b = window == null ? void 0 : window.blocklet) == null ? void 0 : _b.preferences) == null ? void 0 : _c.badgeList) || []).filter((item) => [true, "true"].includes(item.enabled)).map((item) => {
|
|
820
829
|
var _a2;
|
|
821
830
|
return {
|
|
822
831
|
...item,
|
|
@@ -961,13 +970,13 @@ var __publicField = (obj, key, value) => {
|
|
|
961
970
|
] }) : null;
|
|
962
971
|
}
|
|
963
972
|
const useSessionContext = () => {
|
|
964
|
-
var _a2, _b2,
|
|
973
|
+
var _a2, _b2, _c2, _d;
|
|
965
974
|
const ctx = react.useContext(Session.SessionContext) || {};
|
|
966
975
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
967
976
|
const permissionSet = react.useMemo(() => {
|
|
968
977
|
var _a3, _b3;
|
|
969
978
|
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
970
|
-
}, [(_d = (
|
|
979
|
+
}, [(_d = (_c2 = ctx.session) == null ? void 0 : _c2.user) == null ? void 0 : _d.permissions]);
|
|
971
980
|
return {
|
|
972
981
|
...ctx,
|
|
973
982
|
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
@@ -1047,7 +1056,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1047
1056
|
return r(values2);
|
|
1048
1057
|
};
|
|
1049
1058
|
function ProfileCard({ user, click, ...rest }) {
|
|
1050
|
-
var _a2, _b2,
|
|
1059
|
+
var _a2, _b2, _c2;
|
|
1051
1060
|
const { session } = useSessionContext();
|
|
1052
1061
|
const { t } = context.useLocaleContext();
|
|
1053
1062
|
let chatUrl = (user == null ? void 0 : user.did) && `/chat/dm/${user == null ? void 0 : user.did}`;
|
|
@@ -1116,7 +1125,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1116
1125
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { passports: (user == null ? void 0 : user.passports) || [], pointInfo: (user == null ? void 0 : user.pointInfo) || {}, did: user == null ? void 0 : user.did }) })
|
|
1117
1126
|
] })
|
|
1118
1127
|
] }),
|
|
1119
|
-
chatUrl && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((
|
|
1128
|
+
chatUrl && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.did) !== user.did && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1120
1129
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1121
1130
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1122
1131
|
Button,
|
|
@@ -1135,6 +1144,50 @@ var __publicField = (obj, key, value) => {
|
|
|
1135
1144
|
}
|
|
1136
1145
|
);
|
|
1137
1146
|
}
|
|
1147
|
+
const useChatInWallet = () => {
|
|
1148
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1149
|
+
const { walletVersion, mobile } = reactHooks.useBrowser();
|
|
1150
|
+
const chatInWallet = reactRouterDom.useMatch("/chat-in-wallet/:chatId?");
|
|
1151
|
+
const isChatInWalletV2 = react.useMemo(() => {
|
|
1152
|
+
try {
|
|
1153
|
+
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
1154
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1155
|
+
} catch (e) {
|
|
1156
|
+
console.error(e);
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}, [walletVersion, mobile]);
|
|
1160
|
+
const isWebNavbar = react.useMemo(() => {
|
|
1161
|
+
try {
|
|
1162
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1163
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1164
|
+
} catch (e) {
|
|
1165
|
+
console.error(e);
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
}, [walletVersion, mobile]);
|
|
1169
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
1170
|
+
if (isChatInWalletV2) {
|
|
1171
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
1172
|
+
} else {
|
|
1173
|
+
bridge.call("clickChat", { id: id2, title });
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
const navigateToChatList = () => {
|
|
1177
|
+
navigate("/chat-in-wallet");
|
|
1178
|
+
};
|
|
1179
|
+
const updateUnreadState = react.useCallback((unread) => {
|
|
1180
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
1181
|
+
}, []);
|
|
1182
|
+
return {
|
|
1183
|
+
navigateToChat,
|
|
1184
|
+
navigateToChatList,
|
|
1185
|
+
isChatInWalletV2,
|
|
1186
|
+
isWebNavbar,
|
|
1187
|
+
updateUnreadState,
|
|
1188
|
+
chatInWallet
|
|
1189
|
+
};
|
|
1190
|
+
};
|
|
1138
1191
|
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1139
1192
|
Tooltip,
|
|
1140
1193
|
{
|
|
@@ -1169,6 +1222,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1169
1222
|
const downMd = useMediaQuery(theme.breakpoints.down("md"));
|
|
1170
1223
|
const navigate = reactRouterDom.useNavigate();
|
|
1171
1224
|
const [open, setOpen] = react.useState(false);
|
|
1225
|
+
const { mobile } = reactHooks.useBrowser();
|
|
1226
|
+
const { chatInWallet } = useChatInWallet();
|
|
1172
1227
|
const sm = size === "sm";
|
|
1173
1228
|
let fontSize = sm ? 12 : 14;
|
|
1174
1229
|
let avatarSize = profileUse ? 24 : sm ? 40 : 48;
|
|
@@ -1194,12 +1249,16 @@ var __publicField = (obj, key, value) => {
|
|
|
1194
1249
|
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1195
1250
|
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1196
1251
|
setOpen(false);
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1252
|
+
if (chatInWallet) {
|
|
1253
|
+
openProfileInNewTab(user == null ? void 0 : user.did);
|
|
1254
|
+
} else {
|
|
1255
|
+
setTimeout(() => {
|
|
1256
|
+
navigate(`/profile/${user == null ? void 0 : user.did}`);
|
|
1257
|
+
}, 100);
|
|
1258
|
+
}
|
|
1200
1259
|
};
|
|
1201
1260
|
const renderAvatar = () => {
|
|
1202
|
-
if (showProfileCard) {
|
|
1261
|
+
if (showProfileCard && !mobile.any) {
|
|
1203
1262
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1204
1263
|
HtmlTooltip$1,
|
|
1205
1264
|
{
|
|
@@ -3850,42 +3909,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3850
3909
|
] })
|
|
3851
3910
|
] });
|
|
3852
3911
|
}
|
|
3853
|
-
const useChatInWallet = () => {
|
|
3854
|
-
const navigate = reactRouterDom.useNavigate();
|
|
3855
|
-
const { walletVersion, mobile } = reactHooks.useBrowser();
|
|
3856
|
-
const isChatInWalletV2 = react.useMemo(() => {
|
|
3857
|
-
try {
|
|
3858
|
-
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
3859
|
-
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3860
|
-
} catch (e) {
|
|
3861
|
-
console.error(e);
|
|
3862
|
-
return false;
|
|
3863
|
-
}
|
|
3864
|
-
}, [walletVersion, mobile]);
|
|
3865
|
-
const isWebNavbar = react.useMemo(() => {
|
|
3866
|
-
try {
|
|
3867
|
-
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
3868
|
-
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3869
|
-
} catch (e) {
|
|
3870
|
-
console.error(e);
|
|
3871
|
-
return false;
|
|
3872
|
-
}
|
|
3873
|
-
}, [walletVersion, mobile]);
|
|
3874
|
-
const navigateToChat = ({ id: id2, title }) => {
|
|
3875
|
-
if (isChatInWalletV2) {
|
|
3876
|
-
navigate(`/chat-in-wallet/${id2}`);
|
|
3877
|
-
} else {
|
|
3878
|
-
bridge.call("clickChat", { id: id2, title });
|
|
3879
|
-
}
|
|
3880
|
-
};
|
|
3881
|
-
const navigateToChatList = () => {
|
|
3882
|
-
navigate("/chat-in-wallet");
|
|
3883
|
-
};
|
|
3884
|
-
const updateUnreadState = react.useCallback((unread) => {
|
|
3885
|
-
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
3886
|
-
}, []);
|
|
3887
|
-
return { navigateToChat, navigateToChatList, isChatInWalletV2, isWebNavbar, updateUnreadState };
|
|
3888
|
-
};
|
|
3889
3912
|
function ChatList({ inWallet, ...rest }) {
|
|
3890
3913
|
const { t } = context.useLocaleContext();
|
|
3891
3914
|
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
@@ -4146,7 +4169,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4146
4169
|
return null;
|
|
4147
4170
|
};
|
|
4148
4171
|
const render = () => {
|
|
4149
|
-
var _a2, _b2,
|
|
4172
|
+
var _a2, _b2, _c2, _d;
|
|
4150
4173
|
const baseCardSx = {
|
|
4151
4174
|
py: 1.5,
|
|
4152
4175
|
px: 2,
|
|
@@ -4289,7 +4312,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4289
4312
|
]
|
|
4290
4313
|
}
|
|
4291
4314
|
),
|
|
4292
|
-
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_d = (_b2 = message == null ? void 0 : message.comment) == null ? void 0 : _b2.excerpt) == null ? void 0 : _d.replace((
|
|
4315
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_d = (_b2 = message == null ? void 0 : message.comment) == null ? void 0 : _b2.excerpt) == null ? void 0 : _d.replace((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.fullName, "") }),
|
|
4293
4316
|
renderQuote(message.post)
|
|
4294
4317
|
]
|
|
4295
4318
|
}
|
|
@@ -4646,7 +4669,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4646
4669
|
if (editor2 && clearKey) {
|
|
4647
4670
|
editor2.update(() => {
|
|
4648
4671
|
const root = lexical$1.$getRoot();
|
|
4672
|
+
const paragraph = lexical$1.$createParagraphNode();
|
|
4649
4673
|
root.clear();
|
|
4674
|
+
root.append(paragraph);
|
|
4675
|
+
if (lexical$1.$getSelection() !== null) {
|
|
4676
|
+
paragraph.select();
|
|
4677
|
+
}
|
|
4650
4678
|
});
|
|
4651
4679
|
}
|
|
4652
4680
|
}, [editor2, clearKey]);
|
|
@@ -4665,6 +4693,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4665
4693
|
const hasFocus = useIsFocused.useIsFocused();
|
|
4666
4694
|
const selection = editor2.getEditorState().read(lexical$1.$getSelection);
|
|
4667
4695
|
const enabled = mobile.any && hasFocus && selection;
|
|
4696
|
+
const detectSwipe = (node, callback) => {
|
|
4697
|
+
let touchstartY = 0;
|
|
4698
|
+
let touchendY = 0;
|
|
4699
|
+
function handleSwipe() {
|
|
4700
|
+
if (touchstartY - touchendY > 10 || touchendY - touchstartY > 10) {
|
|
4701
|
+
callback();
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
const onTouchStart = (event) => {
|
|
4705
|
+
touchstartY = event.changedTouches[0].screenY;
|
|
4706
|
+
};
|
|
4707
|
+
const onTouchEnd = (event) => {
|
|
4708
|
+
touchendY = event.changedTouches[0].screenY;
|
|
4709
|
+
handleSwipe();
|
|
4710
|
+
};
|
|
4711
|
+
node.addEventListener("touchstart", onTouchStart, false);
|
|
4712
|
+
node.addEventListener("touchend", onTouchEnd, false);
|
|
4713
|
+
return () => {
|
|
4714
|
+
node.removeEventListener("touchstart", onTouchStart, false);
|
|
4715
|
+
node.removeEventListener("touchend", onTouchEnd, false);
|
|
4716
|
+
};
|
|
4717
|
+
};
|
|
4718
|
+
react.useEffect(() => {
|
|
4719
|
+
const root = editor2.getRootElement();
|
|
4720
|
+
if (enabled && root) {
|
|
4721
|
+
const cleanup = [detectSwipe(document.body, () => editor2.blur()), detectSwipe(root, () => editor2.blur())];
|
|
4722
|
+
return () => {
|
|
4723
|
+
cleanup.forEach((fn) => fn());
|
|
4724
|
+
};
|
|
4725
|
+
}
|
|
4726
|
+
return () => {
|
|
4727
|
+
};
|
|
4728
|
+
}, [editor2, enabled]);
|
|
4668
4729
|
if (enabled) {
|
|
4669
4730
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4670
4731
|
material.Box,
|
|
@@ -4688,32 +4749,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4688
4749
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
4689
4750
|
const { mobile } = reactHooks.useBrowser();
|
|
4690
4751
|
react.useEffect(() => {
|
|
4691
|
-
let dispatching = false;
|
|
4692
4752
|
return editor2.registerCommand(
|
|
4693
4753
|
lexical$1.KEY_ENTER_COMMAND,
|
|
4694
4754
|
(e) => {
|
|
4695
|
-
if (
|
|
4696
|
-
dispatching = false;
|
|
4755
|
+
if (mobile.any || e.shiftKey) {
|
|
4697
4756
|
return false;
|
|
4698
4757
|
}
|
|
4699
|
-
if (e.shiftKey) {
|
|
4700
|
-
dispatching = true;
|
|
4701
|
-
const keyboardEvent = new KeyboardEvent("keydown", {
|
|
4702
|
-
code: "Enter",
|
|
4703
|
-
key: "Enter",
|
|
4704
|
-
charCode: 13,
|
|
4705
|
-
keyCode: 13,
|
|
4706
|
-
view: window,
|
|
4707
|
-
bubbles: true
|
|
4708
|
-
});
|
|
4709
|
-
e.preventDefault();
|
|
4710
|
-
editor2.dispatchCommand(lexical$1.KEY_ENTER_COMMAND, keyboardEvent);
|
|
4711
|
-
return true;
|
|
4712
|
-
}
|
|
4713
4758
|
callback();
|
|
4759
|
+
e.preventDefault();
|
|
4714
4760
|
return true;
|
|
4715
4761
|
},
|
|
4716
|
-
lexical$1.
|
|
4762
|
+
lexical$1.COMMAND_PRIORITY_LOW
|
|
4717
4763
|
);
|
|
4718
4764
|
}, [editor2, callback, mobile.any]);
|
|
4719
4765
|
return null;
|
|
@@ -4729,6 +4775,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4729
4775
|
const [focused, setFocused] = react.useState(false);
|
|
4730
4776
|
const compactView = mobile.any && !focused;
|
|
4731
4777
|
const handleSend = () => {
|
|
4778
|
+
if (!content) {
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4732
4781
|
send(content);
|
|
4733
4782
|
setContent("");
|
|
4734
4783
|
setLastSent(Date.now());
|
|
@@ -4791,7 +4840,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4791
4840
|
children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerSend, sx: { fontSize: 13, color: "text.secondary" } })
|
|
4792
4841
|
}
|
|
4793
4842
|
),
|
|
4794
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4843
|
+
/* @__PURE__ */ jsxRuntime.jsx(editor$1.EditorConfigProvider, { value: { minimalMode: true }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4795
4844
|
LazyEditor,
|
|
4796
4845
|
{
|
|
4797
4846
|
enableSaveAreaPlugin: false,
|
|
@@ -4811,7 +4860,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4811
4860
|
/* @__PURE__ */ jsxRuntime.jsx(FocusPlugin, { callback: (v2) => setFocused(v2) })
|
|
4812
4861
|
]
|
|
4813
4862
|
}
|
|
4814
|
-
)
|
|
4863
|
+
) })
|
|
4815
4864
|
]
|
|
4816
4865
|
}
|
|
4817
4866
|
),
|
|
@@ -5001,7 +5050,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5001
5050
|
]
|
|
5002
5051
|
}
|
|
5003
5052
|
),
|
|
5004
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(MessageList, { chat }) }),
|
|
5053
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(editor$1.EditorConfigProvider, { value: { openLinkInNewTab: !!inWallet }, children: /* @__PURE__ */ jsxRuntime.jsx(MessageList, { chat }) }) }),
|
|
5005
5054
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { position: "relative" }, children: [
|
|
5006
5055
|
chat.isActivated && chat.type !== "notification" && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { px: { xs: 0, sm: 2.5 }, pb: { xs: 0, sm: 2.5 } }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5007
5056
|
ChatInput,
|
|
@@ -5456,7 +5505,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5456
5505
|
] });
|
|
5457
5506
|
}
|
|
5458
5507
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5459
|
-
var _a2, _b2;
|
|
5508
|
+
var _a2, _b2, _c2, _d;
|
|
5460
5509
|
const { session } = useSessionContext();
|
|
5461
5510
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5462
5511
|
const { unread } = useUnreadNotification();
|
|
@@ -5495,7 +5544,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5495
5544
|
sx: {
|
|
5496
5545
|
display: "flex",
|
|
5497
5546
|
justifyContent: "space-between",
|
|
5498
|
-
|
|
5547
|
+
alignItems: "center",
|
|
5499
5548
|
mb: 1
|
|
5500
5549
|
},
|
|
5501
5550
|
children: [
|
|
@@ -5508,12 +5557,31 @@ var __publicField = (obj, key, value) => {
|
|
|
5508
5557
|
sx: { display: "flex", alignItems: "center", gap: 1 },
|
|
5509
5558
|
children: [
|
|
5510
5559
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5511
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { typography: "h5", fontWeight: "
|
|
5512
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5560
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { typography: "h5", fontWeight: "bold" }, children: window.blocklet.appName }),
|
|
5561
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5562
|
+
Box,
|
|
5563
|
+
{
|
|
5564
|
+
component: tablerSwitchHorizontal,
|
|
5565
|
+
sx: { fontSize: 15, color: "grey.600", "& [stroke-width='2']": { strokeWidth: "2!important" } }
|
|
5566
|
+
}
|
|
5567
|
+
)
|
|
5513
5568
|
]
|
|
5514
5569
|
}
|
|
5515
5570
|
),
|
|
5516
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5571
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5572
|
+
Avatar,
|
|
5573
|
+
{
|
|
5574
|
+
did: (_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did,
|
|
5575
|
+
src: (_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.avatar,
|
|
5576
|
+
size: 20,
|
|
5577
|
+
shape: "circle",
|
|
5578
|
+
variant: "circle",
|
|
5579
|
+
onClick: () => {
|
|
5580
|
+
var _a3;
|
|
5581
|
+
return openProfileInNewTab((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did);
|
|
5582
|
+
}
|
|
5583
|
+
}
|
|
5584
|
+
)
|
|
5517
5585
|
]
|
|
5518
5586
|
}
|
|
5519
5587
|
),
|
|
@@ -5538,7 +5606,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5538
5606
|
sx: {
|
|
5539
5607
|
width: 1,
|
|
5540
5608
|
height: 1,
|
|
5541
|
-
...((
|
|
5609
|
+
...((_d = window.chatInWallet) == null ? void 0 : _d.safeAreaInsetTop) && {
|
|
5542
5610
|
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5543
5611
|
}
|
|
5544
5612
|
},
|
|
@@ -11601,14 +11669,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11601
11669
|
}
|
|
11602
11670
|
});
|
|
11603
11671
|
}
|
|
11604
|
-
function getWsClient(prefix2 = ((
|
|
11672
|
+
function getWsClient(prefix2 = ((_d) => (_d = window.blocklet) == null ? void 0 : _d.prefix)() || "/") {
|
|
11605
11673
|
if (!client) {
|
|
11606
11674
|
client = create(prefix2);
|
|
11607
11675
|
}
|
|
11608
11676
|
return client;
|
|
11609
11677
|
}
|
|
11610
11678
|
const useSubscription = (event, cb = () => {
|
|
11611
|
-
}, deps = [], prefix2 = ((
|
|
11679
|
+
}, deps = [], prefix2 = ((_e) => (_e = window.blocklet) == null ? void 0 : _e.prefix)() || "/") => {
|
|
11612
11680
|
react.useEffect(() => {
|
|
11613
11681
|
if (event) {
|
|
11614
11682
|
if (!client) {
|
|
@@ -11675,7 +11743,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11675
11743
|
);
|
|
11676
11744
|
}
|
|
11677
11745
|
function PointUpProvider({ children }) {
|
|
11678
|
-
var _a2, _b2,
|
|
11746
|
+
var _a2, _b2, _c2, _d;
|
|
11679
11747
|
const state = ahooks.useReactive({
|
|
11680
11748
|
pointsList: [],
|
|
11681
11749
|
visible: false,
|
|
@@ -11686,7 +11754,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11686
11754
|
const pointUp = react.useCallback(({ points }) => {
|
|
11687
11755
|
state.pointsList.push(points);
|
|
11688
11756
|
}, []);
|
|
11689
|
-
const pointUpComponent = (
|
|
11757
|
+
const pointUpComponent = (_c2 = (_b2 = (_a2 = window.blocklet) == null ? void 0 : _a2.componentMountPoints) == null ? void 0 : _b2.find) == null ? void 0 : _c2.call(
|
|
11690
11758
|
_b2,
|
|
11691
11759
|
(item) => item.did === "z2qa2ZST7Frp8w1XGqyw9v85u12R3mBbB2oaA"
|
|
11692
11760
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
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": "2.0.
|
|
35
|
-
"@blocklet/labels": "2.0.
|
|
34
|
+
"@blocklet/editor": "2.0.5",
|
|
35
|
+
"@blocklet/labels": "2.0.5",
|
|
36
36
|
"@blocklet/uploader": "^0.1.2",
|
|
37
37
|
"@emotion/css": "^11.10.5",
|
|
38
38
|
"@emotion/react": "^11.10.5",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"react-lazy-with-preload": "^2.2.1",
|
|
53
53
|
"react-select": "^5.6.0",
|
|
54
54
|
"semver-compare": "^1.0.0",
|
|
55
|
+
"ufo": "^1.3.1",
|
|
55
56
|
"unstated-next": "^1.1.0",
|
|
56
57
|
"url-join": "^4.0.1"
|
|
57
58
|
},
|
|
@@ -99,5 +100,5 @@
|
|
|
99
100
|
"resolutions": {
|
|
100
101
|
"react": "^18.2.0"
|
|
101
102
|
},
|
|
102
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "34f54a1df7a4c726e126305abfc423595777ddb8"
|
|
103
104
|
}
|