@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 d, Fragment as p, jsx as e } from "react/jsx-runtime";
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 t, Divider as C } from "@mui/material";
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 k, getWebWalletUrl as W } from "@arcblock/ux/lib/Util/wallet";
6
- import { detectWalletExtension as q } from "@arcblock/ux/lib/Util";
7
- import { useCreation as j } from "ahooks";
8
- import { useBrowser as T } from "@arcblock/react-hooks";
9
- import P from "./mobile-login-item.js";
10
- import v from "./web-login-item.js";
11
- import B from "../back-button.js";
12
- import { useStateContext as E } from "../../contexts/state.js";
13
- function I({
14
- qrcode: b,
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 = W(),
16
+ webWalletUrl: n = j(),
17
17
  size: l = "small",
18
- disableSwitchApp: m = !1,
18
+ disableSwitchApp: s = !1,
19
19
  tokenKey: x,
20
- walletLoginRef: g = null,
20
+ walletLoginRef: b = null,
21
21
  webLoginRef: h = null,
22
22
  onMobileLoginClick: L,
23
- onWebLoginClick: w,
24
- onBack: s
23
+ onWebLoginClick: C,
24
+ onBack: a
25
25
  }) {
26
- const { t: a, locale: y } = E(), i = T(), R = k(n), c = q(), f = j(() => i.mobile.tablet || !i.mobile.any && window?.navigator?.maxTouchPoints > 0, [i.mobile.tablet, i.mobile.any]);
27
- return /* @__PURE__ */ d(p, { children: [
28
- b,
29
- /* @__PURE__ */ d(t, { sx: { width: "100%", display: "flex", flexDirection: "column", gap: 1.5 }, children: [
30
- /* @__PURE__ */ e(t, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
31
- C,
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
- t,
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: f ? /* @__PURE__ */ e(
61
- P,
63
+ children: d ? /* @__PURE__ */ e(
64
+ A,
62
65
  {
63
- t: a,
64
- ref: g,
66
+ t: c,
67
+ ref: b,
65
68
  tokenState: r,
66
- isTablet: f,
69
+ isTablet: d,
67
70
  sx: [l === "small" ? { p: 1 } : { p: 2 }],
68
- locale: y,
71
+ locale: R,
69
72
  tokenKey: x,
70
- disableSwitchApp: m,
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: (R || c) && (!i.mobile.any || c) ? /* @__PURE__ */ e(
77
- v,
79
+ /* @__PURE__ */ e(p, { children: (k || m) && (!w.mobile.any || m) ? /* @__PURE__ */ e(
80
+ B,
78
81
  {
79
- t: a,
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: m,
85
- onClick: w
87
+ disableSwitchApp: s,
88
+ onClick: C
86
89
  },
87
90
  u.WALLET
88
91
  ) : null })
89
92
  )
90
93
  }
91
94
  ),
92
- s && /* @__PURE__ */ e(B, { variant: "text", onClick: s })
95
+ a && /* @__PURE__ */ e(E, { variant: "text", onClick: a })
93
96
  ] })
94
97
  ] });
95
98
  }
96
- I.propTypes = {
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
- I as default
113
+ S as default
111
114
  };
@@ -1,4 +1,4 @@
1
- const o = "3.4.9", s = {
1
+ const o = "3.4.11", s = {
2
2
  version: o
3
3
  };
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/did-connect-react",
3
- "version": "3.4.9",
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.9",
35
+ "@arcblock/bridge": "3.4.11",
36
36
  "@arcblock/did": "^1.28.6",
37
- "@arcblock/icons": "3.4.9",
38
- "@arcblock/react-hooks": "3.4.9",
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": "e01324f3084f688f514eed2b5fb8d1c4b3e4247e"
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
- return browser.mobile.tablet || (!browser.mobile.any && window?.navigator?.maxTouchPoints > 0);
34
- }, [browser.mobile.tablet, browser.mobile.any]);
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}