@arcblock/ux 3.1.33 → 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.
package/lib/NavMenu/products.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
2
|
-
import { useRef as
|
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
|
19
|
-
import
|
20
|
-
import
|
21
|
-
import
|
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
|
-
|
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
|
-
},
|
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
|
-
`,
|
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(
|
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
|
481
|
-
const { mode: u } = L(), k = G(), { locale: r = "en" } = _() || {}, l =
|
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(
|
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(
|
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(
|
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(
|
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
|
-
|
722
|
+
Fe as default
|
722
723
|
};
|
package/lib/package.json.js
CHANGED
@@ -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.
|
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": "
|
71
|
+
"gitHead": "c4810edc1f51b25c0e9bd55b2021f284d378ecb1",
|
72
72
|
"dependencies": {
|
73
|
-
"@arcblock/bridge": "3.1.
|
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.
|
77
|
-
"@arcblock/nft-display": "3.1.
|
78
|
-
"@arcblock/react-hooks": "3.1.
|
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.
|
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",
|
package/src/NavMenu/products.tsx
CHANGED
@@ -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
|
);
|
@@ -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
|
+
}
|