@blocklet/ui-react 3.0.26 → 3.0.28
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,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useState as S, useMemo as d, useCallback as u } from "react";
|
|
3
3
|
import p from "prop-types";
|
|
4
|
-
import { Dialog as T, DialogContent as
|
|
5
|
-
import { useMemoizedFn as
|
|
6
|
-
import { translate as
|
|
7
|
-
import { joinURL as
|
|
4
|
+
import { Dialog as T, DialogContent as C, Typography as c, Box as W, DialogActions as v, Button as f } from "@mui/material";
|
|
5
|
+
import { useMemoizedFn as M } from "ahooks";
|
|
6
|
+
import { translate as O } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { joinURL as A } from "ufo";
|
|
8
8
|
import j from "../hooks/use-mobile.js";
|
|
9
|
-
const z = ["admin", "owner"], I = (
|
|
9
|
+
const z = ["admin", "owner"], I = (i) => i.endsWith(".ip.abtnet.io"), E = (i) => i.endsWith(".did.abtnet.io"), H = {
|
|
10
10
|
en: {
|
|
11
11
|
guest: {
|
|
12
12
|
title: "Notice: You are using a temporary domain",
|
|
@@ -42,13 +42,13 @@ const z = ["admin", "owner"], I = (t) => t.endsWith(".ip.abtnet.io"), E = (t) =>
|
|
|
42
42
|
bindDomain: "配置域名"
|
|
43
43
|
}
|
|
44
44
|
}, N = 1e3 * 60 * 60 * 24 * 30, w = ".well-known/service/admin/domains";
|
|
45
|
-
function P({ locale:
|
|
45
|
+
function P({ locale: i = "en", session: h = {} }) {
|
|
46
46
|
const l = h?.user, b = j(), [g, s] = S(() => {
|
|
47
47
|
const e = window.localStorage.getItem("domain-warning-skip");
|
|
48
48
|
if (!e) return !0;
|
|
49
|
-
const r = +/* @__PURE__ */ new Date(),
|
|
50
|
-
return r -
|
|
51
|
-
}), n =
|
|
49
|
+
const r = +/* @__PURE__ */ new Date(), k = +new Date(e);
|
|
50
|
+
return r - k > N;
|
|
51
|
+
}), n = M((e, r = {}) => O(H, e, i, "en", r)), m = d(() => {
|
|
52
52
|
try {
|
|
53
53
|
const { hostname: e } = new URL(window.location.href);
|
|
54
54
|
return e;
|
|
@@ -66,13 +66,13 @@ function P({ locale: t = "en", session: h = {} }) {
|
|
|
66
66
|
[n]
|
|
67
67
|
), D = u(() => {
|
|
68
68
|
window.localStorage.setItem("domain-warning-skip", (/* @__PURE__ */ new Date()).toISOString()), s(!1);
|
|
69
|
-
}, []),
|
|
70
|
-
const e =
|
|
69
|
+
}, []), y = u(() => {
|
|
70
|
+
const e = A(window.location.origin, w);
|
|
71
71
|
e.startsWith("http") && window.open(e, "_blank"), s(!1);
|
|
72
72
|
}, []), o = l?.role && z.includes(l.role);
|
|
73
73
|
return window.location.href.includes(w) || b || !I(m) && !E(m) ? null : /* @__PURE__ */ a(T, { open: g, disableEscapeKeyDown: !0, fullWidth: !0, maxWidth: "sm", onClose: () => s(!1), children: [
|
|
74
|
-
/* @__PURE__ */ a(
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ a(C, { sx: { padding: "20px !important" }, children: [
|
|
75
|
+
/* @__PURE__ */ t(
|
|
76
76
|
c,
|
|
77
77
|
{
|
|
78
78
|
sx: {
|
|
@@ -82,33 +82,33 @@ function P({ locale: t = "en", session: h = {} }) {
|
|
|
82
82
|
children: n(o ? "owner.title" : "guest.title")
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ t(
|
|
86
86
|
c,
|
|
87
87
|
{
|
|
88
88
|
sx: {
|
|
89
89
|
marginTop: "20px",
|
|
90
90
|
fontSize: "14px",
|
|
91
|
-
color: "
|
|
91
|
+
color: "text.secondary"
|
|
92
92
|
},
|
|
93
93
|
children: n(o ? "owner.description" : "guest.description")
|
|
94
94
|
}
|
|
95
95
|
),
|
|
96
|
-
o && /* @__PURE__ */
|
|
96
|
+
o && /* @__PURE__ */ t(W, { component: "ul", children: x.map((e) => /* @__PURE__ */ t(
|
|
97
97
|
c,
|
|
98
98
|
{
|
|
99
99
|
component: "li",
|
|
100
100
|
sx: {
|
|
101
101
|
fontSize: "14px",
|
|
102
|
-
color: "
|
|
102
|
+
color: "text.secondary"
|
|
103
103
|
},
|
|
104
104
|
children: e
|
|
105
105
|
},
|
|
106
106
|
e
|
|
107
107
|
)) })
|
|
108
108
|
] }),
|
|
109
|
-
/* @__PURE__ */ a(
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
o && /* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ a(v, { sx: { px: "12px !important" }, children: [
|
|
110
|
+
/* @__PURE__ */ t(f, { onClick: D, children: n("skip") }),
|
|
111
|
+
o && /* @__PURE__ */ t(f, { variant: "contained", onClick: y, children: n("bindDomain") })
|
|
112
112
|
] })
|
|
113
113
|
] });
|
|
114
114
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.28",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@abtnode/constant": "^1.16.46",
|
|
37
37
|
"@abtnode/util": "^1.16.46",
|
|
38
|
-
"@arcblock/bridge": "3.0.
|
|
39
|
-
"@arcblock/icons": "3.0.
|
|
40
|
-
"@arcblock/react-hooks": "3.0.
|
|
38
|
+
"@arcblock/bridge": "3.0.28",
|
|
39
|
+
"@arcblock/icons": "3.0.28",
|
|
40
|
+
"@arcblock/react-hooks": "3.0.28",
|
|
41
41
|
"@arcblock/ws": "^1.20.15",
|
|
42
42
|
"@blocklet/constant": "^1.16.46",
|
|
43
43
|
"@blocklet/did-space-react": "^1.1.6",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"jest": "^29.7.0",
|
|
91
91
|
"unbuild": "^2.0.0"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "a2d0c2d51c4a6f4fd301e59104fa5811bf4bd4ab"
|
|
94
94
|
}
|
|
@@ -138,7 +138,7 @@ export default function DomainWarning({ locale = 'en', session = {} }) {
|
|
|
138
138
|
sx={{
|
|
139
139
|
marginTop: '20px',
|
|
140
140
|
fontSize: '14px',
|
|
141
|
-
color: '
|
|
141
|
+
color: 'text.secondary',
|
|
142
142
|
}}>
|
|
143
143
|
{isOwner ? t('owner.description') : t('guest.description')}
|
|
144
144
|
</Typography>
|
|
@@ -151,7 +151,7 @@ export default function DomainWarning({ locale = 'en', session = {} }) {
|
|
|
151
151
|
key={benefit}
|
|
152
152
|
sx={{
|
|
153
153
|
fontSize: '14px',
|
|
154
|
-
color: '
|
|
154
|
+
color: 'text.secondary',
|
|
155
155
|
}}>
|
|
156
156
|
{benefit}
|
|
157
157
|
</Typography>
|