@arcblock/ux 3.1.32 → 3.1.34

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { useRef as $, useState as T, useEffect as S } from "react";
2
+ import { useRef as T, useState as $, useEffect as S } from "react";
3
3
  import { Link as p } from "react-router-dom";
4
4
  import { useMemoizedFn as A, useCreation as F } from "ahooks";
5
5
  import { Box as w, useTheme as G } from "@mui/material";
@@ -15,17 +15,18 @@ import P from "./images/blocklet-launcher.svg.js";
15
15
  import H from "./images/blocklet-store.svg.js";
16
16
  import R from "./images/web3-kit.svg.js";
17
17
  import z from "./images/blocklet-framework.svg.js";
18
- import j from "./images/abt-network.svg.js";
19
- import V from "./images/blocklet-server.svg.js";
20
- import q from "./images/OCAP.svg.js";
21
- import U from "./images/did.svg.js";
18
+ import U from "./images/abt-network.svg.js";
19
+ import j from "./images/blocklet-server.svg.js";
20
+ import V from "./images/OCAP.svg.js";
21
+ import q from "./images/did.svg.js";
22
22
  import J from "./images/did-wallet.svg.js";
23
23
  import Q from "./images/vc.svg.js";
24
24
  import X from "./images/payment-kit.png";
25
25
  import Y from "./images/aigne.svg.js";
26
26
  import I from "./images/arcsphere.svg.js";
27
27
  import Z from "./images/aistro.png";
28
- const v = 260, ee = {
28
+ import { getUTMUrl as ee } from "../withTracker/libs/utm.js";
29
+ const v = 260, ie = {
29
30
  en: {
30
31
  groups: {
31
32
  applications: "Applications",
@@ -410,7 +411,7 @@ const v = 260, ee = {
410
411
  }
411
412
  }
412
413
  }
413
- }, ie = C(w)`
414
+ }, oe = C(w)`
414
415
  padding: 8px;
415
416
  background: ${({ theme: t }) => t.palette.grey[100]};
416
417
  border-radius: 8px;
@@ -431,7 +432,7 @@ const v = 260, ee = {
431
432
  .MuiGrid-container + .MuiGrid-container {
432
433
  margin-top: 0px;
433
434
  }
434
- `, oe = C(w, { shouldForwardProp: (t) => t !== "maxContent" })(
435
+ `, te = C(w, { shouldForwardProp: (t) => t !== "maxContent" })(
435
436
  ({ theme: t, maxContent: c }) => ({
436
437
  display: "grid",
437
438
  gap: t.spacing(1),
@@ -462,7 +463,7 @@ function y({ color: t = "black", backgroundColor: c = "transparent", children: a
462
463
  );
463
464
  }
464
465
  function h({ color: t = "black", backgroundColor: c = "transparent" }) {
465
- return /* @__PURE__ */ e(y, { color: t, backgroundColor: c, children: /* @__PURE__ */ e(U, { style: { width: "100%" } }) });
466
+ return /* @__PURE__ */ e(y, { color: t, backgroundColor: c, children: /* @__PURE__ */ e(q, { style: { width: "100%" } }) });
466
467
  }
467
468
  function s({ color: t = "black", backgroundColor: c = "transparent" }) {
468
469
  return /* @__PURE__ */ e(y, { color: t, backgroundColor: c, children: /* @__PURE__ */ e(Y, { style: { width: "100%", height: "100%" } }) });
@@ -475,10 +476,10 @@ const W = (t) => {
475
476
  }
476
477
  };
477
478
  function o({ to: t, children: c, className: a = "", ...u }) {
478
- return W(t) ? /* @__PURE__ */ e(p, { to: t, target: "_blank", rel: "noreferrer noopener", className: a, ...u, children: c }) : /* @__PURE__ */ e(p, { to: t, className: a, ...u, children: c });
479
+ return W(t) ? /* @__PURE__ */ e(p, { to: ee(t, "header"), target: "_blank", rel: "noreferrer noopener", className: a, ...u, children: c }) : /* @__PURE__ */ e(p, { to: t, className: a, ...u, children: c });
479
480
  }
480
- function $e({ className: t = "", type: c, ...a }) {
481
- const { mode: u } = L(), k = G(), { locale: r = "en" } = _() || {}, l = $(null), { palette: f } = k, i = A((n, d = {}) => E(ee, n, r, "en", d)), [N, D] = T(v), m = A(() => {
481
+ function Fe({ className: t = "", type: c, ...a }) {
482
+ const { mode: u } = L(), k = G(), { locale: r = "en" } = _() || {}, l = T(null), { palette: f } = k, i = A((n, d = {}) => E(ie, n, r, "en", d)), [N, D] = $(v), m = A(() => {
482
483
  if (!l.current) return;
483
484
  const n = l.current.querySelectorAll(".navmenu-item__content");
484
485
  let d = v;
@@ -588,17 +589,17 @@ function $e({ className: t = "", type: c, ...a }) {
588
589
  {
589
590
  label: /* @__PURE__ */ e(p, { to: "https://main.abtnetwork.io/", target: "_blank", rel: "noreferrer noopener", children: "ABT Network" }),
590
591
  description: i("products.abtNetwork.description"),
591
- icon: /* @__PURE__ */ e(j, {})
592
+ icon: /* @__PURE__ */ e(U, {})
592
593
  },
593
594
  {
594
595
  label: /* @__PURE__ */ e(o, { to: `https://www.blocklet.io/${r}/blocklet-server`, children: "Blocklet Server" }),
595
596
  description: i("products.blockletServer.description"),
596
- icon: /* @__PURE__ */ e(V, {})
597
+ icon: /* @__PURE__ */ e(j, {})
597
598
  },
598
599
  {
599
600
  label: /* @__PURE__ */ e(o, { to: `https://www.arcblock.io/content/collections/${r}/ocap`, children: "ОСАР" }),
600
601
  description: i("products.ocap.description"),
601
- icon: /* @__PURE__ */ e(q, {})
602
+ icon: /* @__PURE__ */ e(V, {})
602
603
  }
603
604
  ]
604
605
  },
@@ -715,8 +716,8 @@ function $e({ className: t = "", type: c, ...a }) {
715
716
  }
716
717
  return [];
717
718
  }, [i, r, f]);
718
- return /* @__PURE__ */ e(ie, { ref: l, className: `nav-menu-products is-${u} ${t}`, ...a, children: x.map((n) => /* @__PURE__ */ e(B, { label: n.label, children: /* @__PURE__ */ e(oe, { maxContent: N, children: n.children.map((d) => /* @__PURE__ */ e(K, { variant: "panel", style: { padding: "8px" }, ...d })) }) }, n.label)) });
719
+ return /* @__PURE__ */ e(oe, { ref: l, className: `nav-menu-products is-${u} ${t}`, ...a, children: x.map((n) => /* @__PURE__ */ e(B, { label: n.label, children: /* @__PURE__ */ e(te, { maxContent: N, children: n.children.map((d) => /* @__PURE__ */ e(K, { variant: "panel", style: { padding: "8px" }, ...d })) }) }, n.label)) });
719
720
  }
720
721
  export {
721
- $e as default
722
+ Fe as default
722
723
  };
@@ -2,12 +2,12 @@ import { jsxs as m, jsx as s } from "react/jsx-runtime";
2
2
  import { useMemo as r } from "react";
3
3
  import { styled as C, Button as F, Box as M } from "@mui/material";
4
4
  import { useMemoizedFn as u } from "ahooks";
5
- import { joinURL as N } from "ufo";
5
+ import { joinURL as z } from "ufo";
6
6
  import w from "lodash/noop";
7
- import { Icon as U } from "@iconify/react";
8
- import k from "@mui/icons-material/Notifications";
9
- import v from "@mui/icons-material/NotificationsOff";
10
- import z from "../use-follow.js";
7
+ import { Icon as N } from "@iconify/react";
8
+ import U from "@mui/icons-material/Notifications";
9
+ import k from "@mui/icons-material/NotificationsOff";
10
+ import v from "../use-follow.js";
11
11
  import { useLocaleContext as h } from "../../Locale/context.js";
12
12
  import { translate as g } from "../../Locale/util.js";
13
13
  import { isSupportFollow as L } from "../../Util/index.js";
@@ -43,17 +43,18 @@ function j({
43
43
  });
44
44
  return;
45
45
  }
46
- window.open(N(l, `/chat/dm/${o?.did}`), "_blank");
46
+ window.open(z(l, `/chat/dm/${o?.did}`), "_blank");
47
47
  });
48
48
  return r(() => (typeof t == "boolean" ? !!t : t?.chat) && !!l, [t, l]) ? /* @__PURE__ */ m(
49
49
  x,
50
50
  {
51
51
  className: "user-card__social-actions-chat",
52
52
  variant: "outlined",
53
- color: "inherit",
53
+ color: "primary",
54
+ size: "small",
54
55
  onClick: c,
55
56
  children: [
56
- /* @__PURE__ */ s(U, { icon: "tabler:message-dots", style: { marginRight: 4 } }),
57
+ /* @__PURE__ */ s(N, { icon: "tabler:message-dots", style: { marginRight: 4 } }),
57
58
  e("chat")
58
59
  ]
59
60
  }
@@ -64,7 +65,7 @@ function B({
64
65
  showSocialActions: t,
65
66
  session: n
66
67
  }) {
67
- const { locale: i } = h() || { locale: "en" }, e = u((b, y = {}) => g(_, b, i, "en", y)), d = r(() => !!n?.user?.did, [n?.user?.did]), l = r(() => typeof t == "boolean" ? !!t : t?.follow, [t]), { followed: c, followUser: p, unfollowUser: a } = z({
68
+ const { locale: i } = h() || { locale: "en" }, e = u((y, b = {}) => g(_, y, i, "en", b)), d = r(() => !!n?.user?.did, [n?.user?.did]), l = r(() => typeof t == "boolean" ? !!t : t?.follow, [t]), { followed: c, followUser: p, unfollowUser: a } = v({
68
69
  user: o,
69
70
  t: e,
70
71
  isMySelf: !1,
@@ -84,10 +85,11 @@ function B({
84
85
  {
85
86
  className: "user-card__social-actions-follow",
86
87
  variant: "outlined",
87
- color: "inherit",
88
+ color: "primary",
89
+ size: "small",
88
90
  onClick: f,
89
91
  children: [
90
- c ? /* @__PURE__ */ s(v, { sx: { fontSize: 14, mr: 0.5 } }) : /* @__PURE__ */ s(k, { sx: { fontSize: 14, mr: 0.5 } }),
92
+ c ? /* @__PURE__ */ s(k, { sx: { fontSize: 14, mr: 0.5 } }) : /* @__PURE__ */ s(U, { sx: { fontSize: 14, mr: 0.5 } }),
91
93
  e(c ? "unfollow" : "follow")
92
94
  ]
93
95
  }
@@ -1,28 +1,28 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import { memo as u } from "react";
3
- import { Box as r, Typography as g } from "@mui/material";
4
- import { DID as y } from "../../DID/index.js";
5
- import C from "./tooltip-avatar.js";
6
- import { renderTopRight as b } from "../components.js";
7
- import S from "./shorten-label.js";
8
- import v from "../Cards/social-actions.js";
9
- function w({ ...a }) {
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { memo as g } from "react";
3
+ import { useMediaQuery as y, Box as o, Typography as w, Divider as C } from "@mui/material";
4
+ import { DID as S } from "../../DID/index.js";
5
+ import b from "./tooltip-avatar.js";
6
+ import { renderTopRight as v } from "../components.js";
7
+ import W from "./shorten-label.js";
8
+ import j from "../Cards/social-actions.js";
9
+ function D({ ...s }) {
10
10
  const {
11
11
  user: e,
12
- showDid: s,
13
- didProps: l,
14
- avatarSize: d,
15
- shouldShowHoverCard: m,
16
- renderCardContent: c,
17
- renderTopRightContent: p,
18
- topRightMaxWidth: f,
19
- avatarProps: h,
20
- shortenLabelProps: x,
21
- renderName: n,
22
- ...i
23
- } = a;
24
- return /* @__PURE__ */ o(
25
- r,
12
+ showDid: d,
13
+ didProps: m,
14
+ avatarSize: c,
15
+ shouldShowHoverCard: p,
16
+ renderCardContent: f,
17
+ renderTopRightContent: a,
18
+ topRightMaxWidth: h,
19
+ avatarProps: x,
20
+ shortenLabelProps: u,
21
+ renderName: l,
22
+ ...n
23
+ } = s, r = y("(max-width:500px)");
24
+ return /* @__PURE__ */ i(
25
+ o,
26
26
  {
27
27
  className: "user-card__avatar-content",
28
28
  sx: {
@@ -31,33 +31,35 @@ function w({ ...a }) {
31
31
  alignItems: "center"
32
32
  },
33
33
  children: [
34
- /* @__PURE__ */ o(
35
- r,
34
+ /* @__PURE__ */ i(
35
+ o,
36
36
  {
37
37
  sx: {
38
38
  display: "flex",
39
39
  justifyContent: "space-between",
40
- alignItems: "center",
41
- gap: 1,
40
+ flexDirection: r ? "column" : "row",
41
+ alignItems: r ? "flex-start" : "center",
42
+ gap: r ? 2 : 1,
42
43
  flex: 1,
43
- minWidth: 0
44
+ minWidth: 0,
45
+ flexWrap: "wrap"
44
46
  },
45
47
  children: [
46
- /* @__PURE__ */ o(r, { sx: { display: "flex", justifyContent: "flex-start", alignItems: "center", gap: 1, flex: 1 }, children: [
48
+ /* @__PURE__ */ i(o, { sx: { display: "flex", justifyContent: "flex-start", alignItems: "center", gap: 1, flex: 1 }, children: [
47
49
  /* @__PURE__ */ t(
48
- C,
50
+ b,
49
51
  {
50
52
  user: e,
51
- avatarSize: d,
52
- shouldShowHoverCard: m,
53
- renderCardContent: c,
54
- avatarProps: h,
55
- ...i
53
+ avatarSize: c,
54
+ shouldShowHoverCard: p,
55
+ renderCardContent: f,
56
+ avatarProps: x,
57
+ ...n
56
58
  }
57
59
  ),
58
- /* @__PURE__ */ o(r, { children: [
60
+ /* @__PURE__ */ i(o, { children: [
59
61
  /* @__PURE__ */ t(
60
- g,
62
+ w,
61
63
  {
62
64
  variant: "subtitle1",
63
65
  className: "user-card__full-name-label",
@@ -68,11 +70,11 @@ function w({ ...a }) {
68
70
  fontSize: 18,
69
71
  lineHeight: 1.1
70
72
  },
71
- children: n ? n(e) : /* @__PURE__ */ t(S, { sx: { fontWeight: 500 }, ...x, children: e.fullName || e.email || e.did })
73
+ children: l ? l(e) : /* @__PURE__ */ t(W, { sx: { fontWeight: 500 }, ...u, children: e.fullName || e.email || e.did })
72
74
  }
73
75
  ),
74
- s && e.did ? /* @__PURE__ */ t(
75
- y,
76
+ d && e.did ? /* @__PURE__ */ t(
77
+ S,
76
78
  {
77
79
  did: e.did,
78
80
  size: 14,
@@ -80,21 +82,22 @@ function w({ ...a }) {
80
82
  compact: !0,
81
83
  locale: "en",
82
84
  sx: { lineHeight: 1.5 },
83
- ...l ?? {}
85
+ ...m ?? {}
84
86
  }
85
87
  ) : null
86
88
  ] })
87
89
  ] }),
88
- /* @__PURE__ */ t(v, { showSocialActions: i.showSocialActions, user: e, session: i.session })
90
+ r ? /* @__PURE__ */ t(C, { sx: { width: "100%" } }) : null,
91
+ a ? null : /* @__PURE__ */ t(j, { showSocialActions: n.showSocialActions, user: e, session: n.session })
89
92
  ]
90
93
  }
91
94
  ),
92
- b(p, f)
95
+ v(a, h)
93
96
  ]
94
97
  }
95
98
  );
96
99
  }
97
- const D = u(w);
100
+ const P = g(D);
98
101
  export {
99
- D as default
102
+ P as default
100
103
  };
package/lib/Util/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { lazy as j } from "react";
2
- import u from "lodash/padStart";
2
+ import l from "lodash/padStart";
3
3
  import { colors as w, getDIDMotifInfo as x } from "@arcblock/did-motif";
4
4
  import { mergeAllThemeOptions as Ke } from "@blocklet/theme";
5
5
  import I from "lodash/isNil";
6
6
  import E from "lodash/omitBy";
7
- import U from "p-retry";
7
+ import v from "p-retry";
8
8
  import m from "js-cookie";
9
- import v from "color-convert";
9
+ import O from "color-convert";
10
10
  import a from "dayjs";
11
11
  import "dayjs/locale/zh-cn";
12
- import F from "dayjs/plugin/utc";
13
- import O from "dayjs/plugin/timezone";
12
+ import U from "dayjs/plugin/utc";
13
+ import F from "dayjs/plugin/timezone";
14
14
  import A from "dayjs/plugin/relativeTime";
15
15
  import P from "dayjs/plugin/updateLocale";
16
16
  import R from "dayjs/plugin/localizedFormat";
@@ -18,15 +18,15 @@ import W from "semver";
18
18
  import { DID_PREFIX as L, BLOCKLET_SERVICE_PATH_PREFIX as C } from "./constant.js";
19
19
  import b from "../package.json.js";
20
20
  import { getFederatedEnabled as M } from "./federated.js";
21
- let l = null;
22
- const _ = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, z = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), B = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
23
- function N(e) {
21
+ let u = null;
22
+ const _ = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, z = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), N = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
23
+ function B(e) {
24
24
  if (!e)
25
25
  return !1;
26
26
  const t = e.split(".");
27
27
  if (t.length < 2) return !1;
28
28
  const o = t[t.length - 2], n = t[t.length - 1];
29
- return z.has(o) && B.has(n);
29
+ return z.has(o) && N.has(n);
30
30
  }
31
31
  function ye() {
32
32
  const { host: e } = window.location;
@@ -37,7 +37,7 @@ function ye() {
37
37
  return "";
38
38
  if (o.length > 2) {
39
39
  const n = o.slice(-2).join(".");
40
- if (N(n))
40
+ if (B(n))
41
41
  return `.${o.slice(-3).join(".")}`;
42
42
  }
43
43
  return `.${o.slice(-2).join(".")}`;
@@ -51,7 +51,7 @@ function Ie(e) {
51
51
  function be(e = {}) {
52
52
  return new URLSearchParams(e).toString();
53
53
  }
54
- function Se(e = 1) {
54
+ function De(e = 1) {
55
55
  let t = e;
56
56
  typeof t == "number" && (t = { expireInDays: t }), t.path === void 0 && (t.path = "/"), t.expireInDays || (t.expireInDays = 1);
57
57
  const o = {
@@ -64,7 +64,7 @@ function Se(e = 1) {
64
64
  };
65
65
  return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete o.domain, o;
66
66
  }
67
- const De = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, ke = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
67
+ const Se = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, ke = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
68
68
  function Ve(e, t, o = []) {
69
69
  const n = Object.assign({}, e), i = t.defaultProps || {};
70
70
  return Object.keys(i).forEach((r) => {
@@ -95,16 +95,16 @@ const Te = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "funct
95
95
  return o;
96
96
  }, xe = (e) => {
97
97
  const t = Math.round(e / 1e3), o = Math.floor(t / 3600), n = Math.floor((t - o * 3600) / 60), i = t % 60;
98
- return `${u(o, 2, "0")}:${u(n, 2, "0")}:${u(i, 2, "0")}`;
98
+ return `${l(o, 2, "0")}:${l(n, 2, "0")}:${l(i, 2, "0")}`;
99
99
  };
100
100
  function X(e) {
101
- l = e;
101
+ u = e;
102
102
  }
103
103
  function Ee() {
104
- return l;
104
+ return u;
105
105
  }
106
- const S = (e) => (t, { locale: o, tz: n, isUtc: i } = {}) => {
107
- if (l === null && (a.extend(R), a.extend(F), a.extend(O), a.extend(P), a.extend(A), a.updateLocale("zh-cn", {
106
+ const D = (e) => (t, { locale: o, tz: n, isUtc: i } = {}) => {
107
+ if (u === null && (a.extend(R), a.extend(U), a.extend(F), a.extend(P), a.extend(A), a.updateLocale("zh-cn", {
108
108
  // copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
109
109
  relativeTime: {
110
110
  future: "%s后",
@@ -123,25 +123,25 @@ const S = (e) => (t, { locale: o, tz: n, isUtc: i } = {}) => {
123
123
  }
124
124
  }), X(a)), I(t) || t === "")
125
125
  return "-";
126
- let r = l(t);
126
+ let r = u(t);
127
127
  return n && (r = r.tz(n)), i && (r = r.utc()), typeof o < "u" && (r = r.locale(o)), r.format(e);
128
128
  };
129
- function Ue(e, { locale: t = "en", tz: o } = {}) {
130
- return S("ll")(e, { locale: t, tz: o });
129
+ function ve(e, { locale: t = "en", tz: o } = {}) {
130
+ return D("ll")(e, { locale: t, tz: o });
131
131
  }
132
- function ve(e, {
132
+ function Oe(e, {
133
133
  locale: t = "en",
134
134
  tz: o,
135
135
  isUtc: n = !1,
136
136
  format: i = "lll"
137
137
  } = {}) {
138
- return S(i)(e, { locale: t, tz: o, isUtc: n });
138
+ return D(i)(e, { locale: t, tz: o, isUtc: n });
139
139
  }
140
140
  function K() {
141
141
  const e = window?.ABT_DEV || window.ABT;
142
142
  return e && typeof e.open == "function" ? e : null;
143
143
  }
144
- function Fe({
144
+ function Ue({
145
145
  webWalletUrl: e,
146
146
  action: t = "login",
147
147
  locale: o = "en",
@@ -163,7 +163,7 @@ function Fe({
163
163
  ...f
164
164
  }
165
165
  }), { type: "extension" };
166
- const D = {
166
+ const S = {
167
167
  toolbar: "no",
168
168
  location: "no",
169
169
  status: "no",
@@ -173,7 +173,7 @@ function Fe({
173
173
  // iphone 8plus size
174
174
  width: 414,
175
175
  height: 736
176
- }, k = `${e}?action=${t}&locale=${o}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), V = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
176
+ }, k = `${e}?action=${t}&locale=${o}&url=${encodeURIComponent(n)}`, c = Object.assign({}, S, i), V = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
177
177
  if (!("left" in c)) {
178
178
  const s = V(window.top || window), T = window.screenLeft || window.screenX;
179
179
  c.left = s + T - c.width;
@@ -185,7 +185,7 @@ function Fe({
185
185
  const $ = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
186
186
  return window.open(k, "targetWindow", $), { type: "web" };
187
187
  }
188
- const Oe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) => {
188
+ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) => {
189
189
  const t = e.replace(L, "");
190
190
  return !!/^(0x)?[0-9a-f]{40}$/i.test(t);
191
191
  }, Q = (e, t) => {
@@ -263,7 +263,7 @@ const Oe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
263
263
  let r;
264
264
  return t && (r = e[t]), (!r || typeof r != "string") && (r = e[n]), (!r || typeof r != "string") && (r = i), r;
265
265
  }, Me = (e) => j(
266
- () => U(
266
+ () => v(
267
267
  async () => {
268
268
  try {
269
269
  return await e();
@@ -276,7 +276,7 @@ const Oe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
276
276
  )
277
277
  ), _e = (e) => E(e, I);
278
278
  function ze(e, t = 1) {
279
- const [o, n, i] = v.hex.rgb(e);
279
+ const [o, n, i] = O.hex.rgb(e);
280
280
  return `rgba(${o}, ${n}, ${i}, ${t})`;
281
281
  }
282
282
  const G = () => window.blocklet?.serverVersion || "", H = () => b.version, Z = () => (b.dependencies?.["@blocklet/js-sdk"]).replace(/^[\^~>=<]+/, ""), d = (e, t) => {
@@ -285,7 +285,9 @@ const G = () => window.blocklet?.serverVersion || "", H = () => b.version, Z = (
285
285
  return f ? f[1] : r;
286
286
  }, n = o(e), i = o(t);
287
287
  return n === i && e !== t ? !1 : W.gte(n, i);
288
- }, Be = () => {
288
+ }, Ne = () => {
289
+ if (process.env.NODE_ENV === "development")
290
+ return !0;
289
291
  const e = G(), t = H(), o = Z();
290
292
  if (!e || !t || !o)
291
293
  return !1;
@@ -299,16 +301,16 @@ export {
299
301
  Ke as deepmergeAll,
300
302
  K as detectWalletExtension,
301
303
  We as ensureVisitorId,
302
- Ue as formatToDate,
303
- ve as formatToDatetime,
304
+ ve as formatToDate,
305
+ Oe as formatToDatetime,
304
306
  xe as formatUptime,
305
307
  ke as getBackground,
306
- De as getColor,
307
- Se as getCookieOptions,
308
+ Se as getColor,
309
+ De as getCookieOptions,
308
310
  $e as getCopyright,
309
311
  Le as getDIDColor,
310
312
  Ee as getDateTool,
311
- Oe as getFontSize,
313
+ Fe as getFontSize,
312
314
  Z as getJsSdkVersion,
313
315
  G as getServerVersion,
314
316
  Te as getTimezone,
@@ -318,12 +320,12 @@ export {
318
320
  Y as getVisitorId,
319
321
  ze as hexToRgba,
320
322
  J as isEthereumDid,
321
- Be as isSupportFollow,
322
- N as isTwoSegmentTLD,
323
+ Ne as isSupportFollow,
324
+ B as isTwoSegmentTLD,
323
325
  Re as isUrl,
324
326
  Me as lazyRetry,
325
327
  Ve as mergeProps,
326
- Fe as openWebWallet,
328
+ Ue as openWebWallet,
327
329
  Ie as parseQuery,
328
330
  ye as resolveRootDomain,
329
331
  X as setDateTool,
@@ -1,4 +1,4 @@
1
- const e = "3.1.32", s = { "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473" }, t = {
1
+ const e = "3.1.34", s = { "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473" }, t = {
2
2
  version: e,
3
3
  dependencies: s
4
4
  };
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * 为外部 URL 添加 UTM 追踪参数
4
+ * @param url - 原始 URL 地址
5
+ * @param section - 导航区域,可选值为 'header' 或 'footer'
6
+ * @returns 添加 UTM 参数后的 URL
7
+ * @see https://team.arcblock.io/comment/discussions/7504c5ce-7453-4223-a539-27620efcf38e/#189d3749-e4bb-4588-9b7c-9b006fc3ef35
8
+ *
9
+ */
10
+ export declare function getUTMUrl(url: string, section: 'header' | 'footer'): string;
@@ -0,0 +1,31 @@
1
+ import { getQuery as o, withQuery as a } from "ufo";
2
+ function i(t) {
3
+ try {
4
+ return new URL(t).origin !== window.location.origin;
5
+ } catch {
6
+ return !1;
7
+ }
8
+ }
9
+ function c(t, e) {
10
+ try {
11
+ if (!i(t))
12
+ return t;
13
+ const n = o(t), r = {
14
+ // 自身站点的 hostname
15
+ utm_source: window.location.hostname,
16
+ // 标记导航点击
17
+ utm_medium: `${e}_nav`,
18
+ // 全局导航统一标签
19
+ utm_campaign: `global_${e}_menu`,
20
+ // 目标站点标识
21
+ utm_content: new URL(t).hostname,
22
+ ...n
23
+ };
24
+ return a(t, r);
25
+ } catch (n) {
26
+ return console.error("Failed to generate UTM URL:", n), t;
27
+ }
28
+ }
29
+ export {
30
+ c as getUTMUrl
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.1.32",
3
+ "version": "3.1.34",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -68,16 +68,16 @@
68
68
  "react": "^19.0.0",
69
69
  "react-router-dom": "^6.22.3"
70
70
  },
71
- "gitHead": "8ec0dc442d3ca3f15ca233ac096af5163963fcb0",
71
+ "gitHead": "c4810edc1f51b25c0e9bd55b2021f284d378ecb1",
72
72
  "dependencies": {
73
- "@arcblock/bridge": "3.1.32",
73
+ "@arcblock/bridge": "3.1.34",
74
74
  "@arcblock/did": "^1.21.3",
75
75
  "@arcblock/did-motif": "^1.1.14",
76
- "@arcblock/icons": "3.1.32",
77
- "@arcblock/nft-display": "3.1.32",
78
- "@arcblock/react-hooks": "3.1.32",
76
+ "@arcblock/icons": "3.1.34",
77
+ "@arcblock/nft-display": "3.1.34",
78
+ "@arcblock/react-hooks": "3.1.34",
79
79
  "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473",
80
- "@blocklet/theme": "3.1.32",
80
+ "@blocklet/theme": "3.1.34",
81
81
  "@fontsource/roboto": "~5.1.1",
82
82
  "@fontsource/ubuntu-mono": "^5.2.6",
83
83
  "@iconify-icons/logos": "^1.2.36",
@@ -26,6 +26,7 @@ import PaymentKitPng from './images/payment-kit.png';
26
26
  import AigneSvg from './images/aigne.svg?react';
27
27
  import ArcSphereSvg from './images/arcsphere.svg?react';
28
28
  import AistroPng from './images/aistro.png';
29
+ import { getUTMUrl } from '../withTracker/libs/utm';
29
30
 
30
31
  const MIN_ITEM_CONTENT_WIDTH = 260;
31
32
 
@@ -512,7 +513,7 @@ interface SmartLinkProps extends LinkProps {
512
513
  function SmartLink({ to, children, className = '', ...restProps }: SmartLinkProps) {
513
514
  if (isExternal(to)) {
514
515
  return (
515
- <Link to={to} target="_blank" rel="noreferrer noopener" className={className} {...restProps}>
516
+ <Link to={getUTMUrl(to, 'header')} target="_blank" rel="noreferrer noopener" className={className} {...restProps}>
516
517
  {children}
517
518
  </Link>
518
519
  );
@@ -67,7 +67,7 @@ function Chat({
67
67
  session?.login(noop, {
68
68
  openMode: 'redirect',
69
69
  redirect: window.location.href,
70
- }); // TODO: 需要确认使用是否正确
70
+ });
71
71
  return;
72
72
  }
73
73
  window.open(joinURL(discussKitMountPoint, `/chat/dm/${user?.did}`), '_blank');
@@ -87,7 +87,8 @@ function Chat({
87
87
  <ButtonWrapper
88
88
  className="user-card__social-actions-chat"
89
89
  variant="outlined"
90
- color="inherit"
90
+ color="primary"
91
+ size="small"
91
92
  onClick={onNavigateToChat}>
92
93
  <Icon icon="tabler:message-dots" style={{ marginRight: 4 }} />
93
94
  {t('chat')}
@@ -148,7 +149,8 @@ function Follow({
148
149
  <ButtonWrapper
149
150
  className="user-card__social-actions-follow"
150
151
  variant="outlined"
151
- color="inherit"
152
+ color="primary"
153
+ size="small"
152
154
  onClick={handleFollowAction}>
153
155
  {followed ? (
154
156
  <NotificationsOffIcon sx={{ fontSize: 14, mr: 0.5 }} />
@@ -1,5 +1,5 @@
1
1
  import React, { memo } from 'react';
2
- import { Typography, Box } from '@mui/material';
2
+ import { Typography, Box, useMediaQuery, Divider } from '@mui/material';
3
3
  import { DID } from '../../DID';
4
4
  import { User, UserCardProps } from '../types';
5
5
  import TooltipAvatar from './tooltip-avatar';
@@ -31,7 +31,7 @@ function MinimalContent({ ...props }: MinimalContentProps) {
31
31
  renderName,
32
32
  ...rest
33
33
  } = props;
34
-
34
+ const isSmallScreen = useMediaQuery('(max-width:500px)');
35
35
  return (
36
36
  <Box
37
37
  className="user-card__avatar-content"
@@ -44,10 +44,12 @@ function MinimalContent({ ...props }: MinimalContentProps) {
44
44
  sx={{
45
45
  display: 'flex',
46
46
  justifyContent: 'space-between',
47
- alignItems: 'center',
48
- gap: 1,
47
+ flexDirection: isSmallScreen ? 'column' : 'row',
48
+ alignItems: isSmallScreen ? 'flex-start' : 'center',
49
+ gap: isSmallScreen ? 2 : 1,
49
50
  flex: 1,
50
51
  minWidth: 0,
52
+ flexWrap: 'wrap',
51
53
  }}>
52
54
  <Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', gap: 1, flex: 1 }}>
53
55
  <TooltipAvatar
@@ -91,7 +93,10 @@ function MinimalContent({ ...props }: MinimalContentProps) {
91
93
  ) : null}
92
94
  </Box>
93
95
  </Box>
94
- <SocialActions showSocialActions={rest.showSocialActions} user={user!} session={rest.session} />
96
+ {isSmallScreen ? <Divider sx={{ width: '100%' }} /> : null}
97
+ {!renderTopRightContent ? (
98
+ <SocialActions showSocialActions={rest.showSocialActions} user={user!} session={rest.session} />
99
+ ) : null}
95
100
  </Box>
96
101
  {renderTopRight(renderTopRightContent, topRightMaxWidth)}
97
102
  </Box>
package/src/Util/index.ts CHANGED
@@ -710,6 +710,10 @@ export const compareVersions = (version1: string, version2: string) => {
710
710
  * 通过 server 的版本和 ux 的版本共同决定
711
711
  */
712
712
  export const isSupportFollow = () => {
713
+ // HACK: 本地开发时,为了测试方便,暂时放开限制
714
+ if (process.env.NODE_ENV === 'development') {
715
+ return true;
716
+ }
713
717
  const serverVersion = getServerVersion();
714
718
  const uxVersion = getUxPackageVersion();
715
719
  const jsSdkVersion = getJsSdkVersion();
@@ -0,0 +1,46 @@
1
+ import { withQuery, getQuery } from 'ufo';
2
+
3
+ function isExternal(url: string): boolean {
4
+ try {
5
+ const u = new URL(url);
6
+ return u.origin !== window.location.origin;
7
+ } catch {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ /**
13
+ *
14
+ * 为外部 URL 添加 UTM 追踪参数
15
+ * @param url - 原始 URL 地址
16
+ * @param section - 导航区域,可选值为 'header' 或 'footer'
17
+ * @returns 添加 UTM 参数后的 URL
18
+ * @see https://team.arcblock.io/comment/discussions/7504c5ce-7453-4223-a539-27620efcf38e/#189d3749-e4bb-4588-9b7c-9b006fc3ef35
19
+ *
20
+ */
21
+ export function getUTMUrl(url: string, section: 'header' | 'footer'): string {
22
+ try {
23
+ if (!isExternal(url)) {
24
+ return url;
25
+ }
26
+
27
+ const existsQueryParams = getQuery(url);
28
+
29
+ const queryParams = {
30
+ // 自身站点的 hostname
31
+ utm_source: window.location.hostname,
32
+ // 标记导航点击
33
+ utm_medium: `${section}_nav`,
34
+ // 全局导航统一标签
35
+ utm_campaign: `global_${section}_menu`,
36
+ // 目标站点标识
37
+ utm_content: new URL(url).hostname,
38
+ ...existsQueryParams,
39
+ };
40
+
41
+ return withQuery(url, queryParams);
42
+ } catch (error) {
43
+ console.error('Failed to generate UTM URL:', error);
44
+ return url;
45
+ }
46
+ }