@arcblock/did-connect-react 3.4.9 → 3.4.11
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,34 +1,37 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import o from "prop-types";
|
|
3
|
-
import { Box as
|
|
3
|
+
import { Box as i, Divider as q } from "@mui/material";
|
|
4
4
|
import { LOGIN_PROVIDER as u } from "@arcblock/ux/lib/Util/constant";
|
|
5
|
-
import { checkSameProtocol as
|
|
6
|
-
import { detectWalletExtension as
|
|
7
|
-
import { useCreation as
|
|
8
|
-
import { useBrowser as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useStateContext as
|
|
13
|
-
function
|
|
14
|
-
qrcode:
|
|
5
|
+
import { checkSameProtocol as T, getWebWalletUrl as j } from "@arcblock/ux/lib/Util/wallet";
|
|
6
|
+
import { detectWalletExtension as v } from "@arcblock/ux/lib/Util";
|
|
7
|
+
import { useCreation as I } from "ahooks";
|
|
8
|
+
import { useBrowser as P } from "@arcblock/react-hooks";
|
|
9
|
+
import A from "./mobile-login-item.js";
|
|
10
|
+
import B from "./web-login-item.js";
|
|
11
|
+
import E from "../back-button.js";
|
|
12
|
+
import { useStateContext as O } from "../../contexts/state.js";
|
|
13
|
+
function S({
|
|
14
|
+
qrcode: g,
|
|
15
15
|
tokenState: r,
|
|
16
|
-
webWalletUrl: n =
|
|
16
|
+
webWalletUrl: n = j(),
|
|
17
17
|
size: l = "small",
|
|
18
|
-
disableSwitchApp:
|
|
18
|
+
disableSwitchApp: s = !1,
|
|
19
19
|
tokenKey: x,
|
|
20
|
-
walletLoginRef:
|
|
20
|
+
walletLoginRef: b = null,
|
|
21
21
|
webLoginRef: h = null,
|
|
22
22
|
onMobileLoginClick: L,
|
|
23
|
-
onWebLoginClick:
|
|
24
|
-
onBack:
|
|
23
|
+
onWebLoginClick: C,
|
|
24
|
+
onBack: a
|
|
25
25
|
}) {
|
|
26
|
-
const { t:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const { t: c, locale: R } = O(), w = P(), k = T(n), m = v(), d = I(() => {
|
|
27
|
+
const t = navigator.userAgent.toLowerCase(), y = /ipad/.test(t) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, W = /android/.test(t) && !/mobile/.test(t);
|
|
28
|
+
return !!(y || W);
|
|
29
|
+
}, []);
|
|
30
|
+
return /* @__PURE__ */ f(p, { children: [
|
|
31
|
+
g,
|
|
32
|
+
/* @__PURE__ */ f(i, { sx: { width: "100%", display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
33
|
+
/* @__PURE__ */ e(i, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
34
|
+
q,
|
|
32
35
|
{
|
|
33
36
|
orientation: "horizontal",
|
|
34
37
|
sx: {
|
|
@@ -42,7 +45,7 @@ function I({
|
|
|
42
45
|
}
|
|
43
46
|
) }),
|
|
44
47
|
/* @__PURE__ */ e(
|
|
45
|
-
|
|
48
|
+
i,
|
|
46
49
|
{
|
|
47
50
|
sx: {
|
|
48
51
|
width: "100%",
|
|
@@ -57,43 +60,43 @@ function I({
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
|
-
children:
|
|
61
|
-
|
|
63
|
+
children: d ? /* @__PURE__ */ e(
|
|
64
|
+
A,
|
|
62
65
|
{
|
|
63
|
-
t:
|
|
64
|
-
ref:
|
|
66
|
+
t: c,
|
|
67
|
+
ref: b,
|
|
65
68
|
tokenState: r,
|
|
66
|
-
isTablet:
|
|
69
|
+
isTablet: d,
|
|
67
70
|
sx: [l === "small" ? { p: 1 } : { p: 2 }],
|
|
68
|
-
locale:
|
|
71
|
+
locale: R,
|
|
69
72
|
tokenKey: x,
|
|
70
|
-
disableSwitchApp:
|
|
73
|
+
disableSwitchApp: s,
|
|
71
74
|
onClick: L
|
|
72
75
|
},
|
|
73
76
|
u.WALLET
|
|
74
77
|
) : (
|
|
75
78
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
76
|
-
/* @__PURE__ */ e(p, { children: (
|
|
77
|
-
|
|
79
|
+
/* @__PURE__ */ e(p, { children: (k || m) && (!w.mobile.any || m) ? /* @__PURE__ */ e(
|
|
80
|
+
B,
|
|
78
81
|
{
|
|
79
|
-
t:
|
|
82
|
+
t: c,
|
|
80
83
|
ref: h,
|
|
81
84
|
tokenState: r,
|
|
82
85
|
webWalletUrl: n,
|
|
83
86
|
sx: [l === "small" ? { p: 1 } : { p: 2 }],
|
|
84
|
-
disableSwitchApp:
|
|
85
|
-
onClick:
|
|
87
|
+
disableSwitchApp: s,
|
|
88
|
+
onClick: C
|
|
86
89
|
},
|
|
87
90
|
u.WALLET
|
|
88
91
|
) : null })
|
|
89
92
|
)
|
|
90
93
|
}
|
|
91
94
|
),
|
|
92
|
-
|
|
95
|
+
a && /* @__PURE__ */ e(E, { variant: "text", onClick: a })
|
|
93
96
|
] })
|
|
94
97
|
] });
|
|
95
98
|
}
|
|
96
|
-
|
|
99
|
+
S.propTypes = {
|
|
97
100
|
qrcode: o.node.isRequired,
|
|
98
101
|
tokenState: o.object.isRequired,
|
|
99
102
|
webWalletUrl: o.string,
|
|
@@ -107,5 +110,5 @@ I.propTypes = {
|
|
|
107
110
|
onBack: o.func.isRequired
|
|
108
111
|
};
|
|
109
112
|
export {
|
|
110
|
-
|
|
113
|
+
S as default
|
|
111
114
|
};
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-connect-react",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.11",
|
|
4
4
|
"description": "Client side library to work with DID Connect by ArcBlock.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@arcblock/bridge": "3.4.
|
|
35
|
+
"@arcblock/bridge": "3.4.11",
|
|
36
36
|
"@arcblock/did": "^1.28.6",
|
|
37
|
-
"@arcblock/icons": "3.4.
|
|
38
|
-
"@arcblock/react-hooks": "3.4.
|
|
37
|
+
"@arcblock/icons": "3.4.11",
|
|
38
|
+
"@arcblock/react-hooks": "3.4.11",
|
|
39
39
|
"@arcblock/ws": "^1.28.6",
|
|
40
40
|
"@blocklet/constant": "^1.17.7",
|
|
41
41
|
"@fontsource/lexend": "^5.2.9",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
86
86
|
"jest": "^29.7.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "1cc263e80cb7b98f6ebb02bb8d151fee552e6c76"
|
|
89
89
|
}
|
|
@@ -30,8 +30,20 @@ export default function WalletLoginOptions({
|
|
|
30
30
|
const extension = detectWalletExtension();
|
|
31
31
|
|
|
32
32
|
const isTablet = useCreation(() => {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
34
|
+
|
|
35
|
+
// 1. 判断是否是 iPad (iOS 13+ 可能会显示为 Macintosh,需要结合触控点判断)
|
|
36
|
+
const isIpad = /ipad/.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
|
37
|
+
|
|
38
|
+
// 2. 判断是否是 Android 平板 (即 User Agent 包含 Android 但不包含 Mobile)
|
|
39
|
+
const isAndroidTablet = /android/.test(ua) && !/mobile/.test(ua);
|
|
40
|
+
|
|
41
|
+
// 3. 综合判断平板
|
|
42
|
+
if (isIpad || isAndroidTablet) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}, []);
|
|
35
47
|
return (
|
|
36
48
|
<>
|
|
37
49
|
{qrcode}
|