@arcblock/did-connect-react 3.4.14 → 3.5.0

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.
Files changed (208) hide show
  1. package/dist/standalone/did-connect-react.css +1 -0
  2. package/dist/standalone/index.js +133700 -0
  3. package/lib/Connect/components/login-item/connect-choose-list.js +111 -111
  4. package/lib/Connect/components/login-item/connect-provider-list.js +180 -180
  5. package/lib/Connect/components/login-item/mobile-login-item.js +56 -56
  6. package/lib/Connect/components/login-item/passkey-login-item.js +27 -29
  7. package/lib/Connect/components/login-item/web-login-item.js +31 -29
  8. package/lib/Connect/connect.js +202 -197
  9. package/lib/Connect/contexts/state.js +19 -17
  10. package/lib/Connect/hooks/provider-list.js +33 -33
  11. package/lib/Connect/plugins/email/list-item.js +14 -14
  12. package/lib/Connect/plugins/email/placeholder.js +77 -76
  13. package/lib/package.json.js +1 -1
  14. package/package.json +14 -9
  15. package/.aigne/doc-smith/config.yaml +0 -85
  16. package/.aigne/doc-smith/history.yaml +0 -6
  17. package/.aigne/doc-smith/output/structure-plan.json +0 -204
  18. package/.aigne/doc-smith/translation-cache.yaml +0 -11
  19. package/.aigne/doc-smith/upload-cache.yaml +0 -213
  20. package/docs/_sidebar.md +0 -18
  21. package/docs/advanced-authentication-methods.ja.md +0 -261
  22. package/docs/advanced-authentication-methods.md +0 -261
  23. package/docs/advanced-authentication-methods.zh-TW.md +0 -261
  24. package/docs/advanced-authentication-methods.zh.md +0 -261
  25. package/docs/advanced-utilities.ja.md +0 -132
  26. package/docs/advanced-utilities.md +0 -132
  27. package/docs/advanced-utilities.zh-TW.md +0 -132
  28. package/docs/advanced-utilities.zh.md +0 -132
  29. package/docs/advanced.ja.md +0 -95
  30. package/docs/advanced.md +0 -95
  31. package/docs/advanced.zh-TW.md +0 -95
  32. package/docs/advanced.zh.md +0 -95
  33. package/docs/api-reference.ja.md +0 -178
  34. package/docs/api-reference.md +0 -178
  35. package/docs/api-reference.zh-TW.md +0 -178
  36. package/docs/api-reference.zh.md +0 -178
  37. package/docs/assets/diagram/core-components-session-provider-01.ja.jpg +0 -0
  38. package/docs/assets/diagram/core-components-session-provider-01.jpg +0 -0
  39. package/docs/assets/diagram/core-components-session-provider-01.zh-TW.jpg +0 -0
  40. package/docs/assets/diagram/core-components-session-provider-01.zh.jpg +0 -0
  41. package/docs/assets/diagram/did-connect-diagram-0.ja.jpg +0 -0
  42. package/docs/assets/diagram/did-connect-diagram-0.jpg +0 -0
  43. package/docs/assets/diagram/did-connect-diagram-0.zh-TW.jpg +0 -0
  44. package/docs/assets/diagram/did-connect-diagram-0.zh.jpg +0 -0
  45. package/docs/assets/diagram/overview-01.ja.jpg +0 -0
  46. package/docs/assets/diagram/overview-01.jpg +0 -0
  47. package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
  48. package/docs/assets/diagram/overview-01.zh.jpg +0 -0
  49. package/docs/assets/diagram/use-connect-diagram-0.ja.jpg +0 -0
  50. package/docs/assets/diagram/use-connect-diagram-0.jpg +0 -0
  51. package/docs/assets/diagram/use-connect-diagram-0.zh-TW.jpg +0 -0
  52. package/docs/assets/diagram/use-connect-diagram-0.zh.jpg +0 -0
  53. package/docs/core-components-did-connect.ja.md +0 -166
  54. package/docs/core-components-did-connect.md +0 -166
  55. package/docs/core-components-did-connect.zh-TW.md +0 -166
  56. package/docs/core-components-did-connect.zh.md +0 -166
  57. package/docs/core-components-session-provider.ja.md +0 -197
  58. package/docs/core-components-session-provider.md +0 -197
  59. package/docs/core-components-session-provider.zh-TW.md +0 -197
  60. package/docs/core-components-session-provider.zh.md +0 -197
  61. package/docs/core-components.ja.md +0 -16
  62. package/docs/core-components.md +0 -16
  63. package/docs/core-components.zh-TW.md +0 -16
  64. package/docs/core-components.zh.md +0 -16
  65. package/docs/getting-started.ja.md +0 -138
  66. package/docs/getting-started.md +0 -138
  67. package/docs/getting-started.zh-TW.md +0 -138
  68. package/docs/getting-started.zh.md +0 -138
  69. package/docs/hooks-use-connect.ja.md +0 -178
  70. package/docs/hooks-use-connect.md +0 -178
  71. package/docs/hooks-use-connect.zh-TW.md +0 -178
  72. package/docs/hooks-use-connect.zh.md +0 -178
  73. package/docs/hooks-use-did.ja.md +0 -107
  74. package/docs/hooks-use-did.md +0 -107
  75. package/docs/hooks-use-did.zh-TW.md +0 -107
  76. package/docs/hooks-use-did.zh.md +0 -107
  77. package/docs/hooks-use-oauth-passkey.ja.md +0 -188
  78. package/docs/hooks-use-oauth-passkey.md +0 -188
  79. package/docs/hooks-use-oauth-passkey.zh-TW.md +0 -188
  80. package/docs/hooks-use-oauth-passkey.zh.md +0 -188
  81. package/docs/hooks.ja.md +0 -23
  82. package/docs/hooks.md +0 -23
  83. package/docs/hooks.zh-TW.md +0 -23
  84. package/docs/hooks.zh.md +0 -23
  85. package/docs/overview.ja.md +0 -119
  86. package/docs/overview.md +0 -119
  87. package/docs/overview.zh-TW.md +0 -119
  88. package/docs/overview.zh.md +0 -119
  89. package/docs/ui-components-address.ja.md +0 -121
  90. package/docs/ui-components-address.md +0 -121
  91. package/docs/ui-components-address.zh-TW.md +0 -121
  92. package/docs/ui-components-address.zh.md +0 -121
  93. package/docs/ui-components-avatar.ja.md +0 -65
  94. package/docs/ui-components-avatar.md +0 -65
  95. package/docs/ui-components-avatar.zh-TW.md +0 -65
  96. package/docs/ui-components-avatar.zh.md +0 -65
  97. package/docs/ui-components-button.ja.md +0 -99
  98. package/docs/ui-components-button.md +0 -99
  99. package/docs/ui-components-button.zh-TW.md +0 -99
  100. package/docs/ui-components-button.zh.md +0 -99
  101. package/docs/ui-components-logo.ja.md +0 -52
  102. package/docs/ui-components-logo.md +0 -52
  103. package/docs/ui-components-logo.zh-TW.md +0 -52
  104. package/docs/ui-components-logo.zh.md +0 -52
  105. package/docs/ui-components.ja.md +0 -57
  106. package/docs/ui-components.md +0 -57
  107. package/docs/ui-components.zh-TW.md +0 -57
  108. package/docs/ui-components.zh.md +0 -57
  109. package/glossary.md +0 -1
  110. package/src/Address/index.jsx +0 -2
  111. package/src/Avatar/index.jsx +0 -2
  112. package/src/Button/Button.stories.jsx +0 -7
  113. package/src/Button/index.jsx +0 -21
  114. package/src/Connect/Connect.stories.jsx +0 -34
  115. package/src/Connect/assets/locale.js +0 -149
  116. package/src/Connect/assets/login-bg.png +0 -0
  117. package/src/Connect/assets/login-slogan.js +0 -7
  118. package/src/Connect/components/action-button.jsx +0 -22
  119. package/src/Connect/components/app-tips.jsx +0 -156
  120. package/src/Connect/components/auto-height.jsx +0 -38
  121. package/src/Connect/components/back-button.jsx +0 -24
  122. package/src/Connect/components/connect-status.jsx +0 -259
  123. package/src/Connect/components/did-connect-title.jsx +0 -107
  124. package/src/Connect/components/download-tips.jsx +0 -55
  125. package/src/Connect/components/loading.jsx +0 -25
  126. package/src/Connect/components/login-item/connect-choose-list.jsx +0 -317
  127. package/src/Connect/components/login-item/connect-provider-list.jsx +0 -462
  128. package/src/Connect/components/login-item/login-method-item.jsx +0 -139
  129. package/src/Connect/components/login-item/mobile-login-item.jsx +0 -181
  130. package/src/Connect/components/login-item/passkey-login-item.jsx +0 -54
  131. package/src/Connect/components/login-item/wallet-login-options.jsx +0 -129
  132. package/src/Connect/components/login-item/web-login-item.jsx +0 -157
  133. package/src/Connect/components/mask-overlay.jsx +0 -32
  134. package/src/Connect/components/refresh-overlay.jsx +0 -52
  135. package/src/Connect/components/switch-app.jsx +0 -69
  136. package/src/Connect/connect.jsx +0 -617
  137. package/src/Connect/contexts/state.jsx +0 -234
  138. package/src/Connect/fallback-connect.jsx +0 -47
  139. package/src/Connect/fullpage.jsx +0 -3
  140. package/src/Connect/hooks/auth-url.js +0 -31
  141. package/src/Connect/hooks/method-list.js +0 -121
  142. package/src/Connect/hooks/page-show.js +0 -24
  143. package/src/Connect/hooks/provider-list.js +0 -165
  144. package/src/Connect/hooks/security.js +0 -40
  145. package/src/Connect/hooks/token.js +0 -627
  146. package/src/Connect/hooks/use-apps.js +0 -69
  147. package/src/Connect/hooks/use-quick-connect.js +0 -119
  148. package/src/Connect/index.jsx +0 -21
  149. package/src/Connect/landing-page.jsx +0 -3
  150. package/src/Connect/plugins/email/index.jsx +0 -85
  151. package/src/Connect/plugins/email/list-item.jsx +0 -34
  152. package/src/Connect/plugins/email/placeholder.jsx +0 -365
  153. package/src/Connect/plugins/index.js +0 -2
  154. package/src/Connect/use-connect.jsx +0 -321
  155. package/src/Connect/with-blocklet.jsx +0 -26
  156. package/src/Connect/with-bridge-call.jsx +0 -138
  157. package/src/Federated/context.jsx +0 -93
  158. package/src/Federated/index.jsx +0 -1
  159. package/src/Logo/index.jsx +0 -2
  160. package/src/OAuth/bind-conflict-alert.jsx +0 -37
  161. package/src/OAuth/context.jsx +0 -407
  162. package/src/OAuth/guest.svg +0 -20
  163. package/src/OAuth/index.jsx +0 -1
  164. package/src/OAuth/passport-switcher.jsx +0 -2
  165. package/src/Passkey/actions.jsx +0 -217
  166. package/src/Passkey/constants.js +0 -2
  167. package/src/Passkey/context.jsx +0 -395
  168. package/src/Passkey/dialog.jsx +0 -401
  169. package/src/Passkey/icon.jsx +0 -10
  170. package/src/Passkey/index.jsx +0 -2
  171. package/src/Service/index.jsx +0 -96
  172. package/src/Session/assets/did-spaces-guide-cover.svg +0 -1
  173. package/src/Session/assets/did-spaces-guide-icon.svg +0 -7
  174. package/src/Session/context.jsx +0 -7
  175. package/src/Session/did-spaces-guide.jsx +0 -173
  176. package/src/Session/handler.jsx +0 -98
  177. package/src/Session/hooks/use-federated.js +0 -91
  178. package/src/Session/hooks/use-mobile.jsx +0 -6
  179. package/src/Session/hooks/use-protected-routes.js +0 -16
  180. package/src/Session/hooks/use-session-token.js +0 -400
  181. package/src/Session/hooks/use-verify.jsx +0 -76
  182. package/src/Session/index.jsx +0 -1789
  183. package/src/Session/libs/constants.js +0 -17
  184. package/src/Session/libs/did-spaces.js +0 -38
  185. package/src/Session/libs/federated.js +0 -82
  186. package/src/Session/libs/index.js +0 -5
  187. package/src/Session/libs/locales.js +0 -160
  188. package/src/Session/libs/login-mobile.js +0 -80
  189. package/src/Session/window-focus-aware.jsx +0 -28
  190. package/src/SessionManager/index.jsx +0 -2
  191. package/src/Storage/engine/cookie.js +0 -25
  192. package/src/Storage/engine/local-storage.js +0 -57
  193. package/src/Storage/index.js +0 -25
  194. package/src/User/index.js +0 -4
  195. package/src/User/use-did.js +0 -80
  196. package/src/User/wrap-did.jsx +0 -18
  197. package/src/WebWalletSWKeeper/index.jsx +0 -3
  198. package/src/components/PassportSwitcher.jsx +0 -160
  199. package/src/constant.js +0 -27
  200. package/src/error.js +0 -6
  201. package/src/hooks/use-locale.jsx +0 -6
  202. package/src/index.js +0 -32
  203. package/src/locales/en.jsx +0 -15
  204. package/src/locales/index.jsx +0 -13
  205. package/src/locales/zh.jsx +0 -15
  206. package/src/types.d.ts +0 -355
  207. package/src/utils.js +0 -413
  208. package/vite.config.mjs +0 -29
@@ -1,180 +1,180 @@
1
- import { jsx as l, jsxs as po } from "react/jsx-runtime";
2
- import n from "prop-types";
3
- import { Box as A } from "@mui/material";
4
- import { LOGIN_PROVIDER as e, LOGIN_PROVIDER_ICON_SIZE as E, LOGIN_PROVIDER_NAME as uo } from "@arcblock/ux/lib/Util/constant";
5
- import { checkSameProtocol as go, getWebWalletUrl as ho } from "@arcblock/ux/lib/Util/wallet";
6
- import b from "lodash/noop";
7
- import { useMemoizedFn as a, useCreation as fo } from "ahooks";
8
- import O from "js-cookie";
9
- import { detectWalletExtension as yo, getCookieOptions as Lo } from "@arcblock/ux/lib/Util";
10
- import { useRef as w, useEffect as J } from "react";
11
- import { mergeSx as Io } from "@arcblock/ux/lib/Util/style";
12
- import Ao from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
- import { GA_LAST_LOGIN_METHOD as y } from "@arcblock/ux/lib/withTracker/constant";
14
- import { translate as Eo } from "@arcblock/ux/lib/Locale/util";
15
- import bo from "@arcblock/ux/lib/Empty";
16
- import { useBrowser as xo } from "@arcblock/react-hooks";
1
+ import { jsx as l, jsxs as ho } from "react/jsx-runtime";
2
+ import e from "prop-types";
3
+ import { Box as E } from "@mui/material";
4
+ import { LAST_USED_LOGIN_METHOD as uo, LOGIN_PROVIDER as t, WALLET_LOGIN_METHOD as J, LOGIN_PROVIDER_ICON_SIZE as A, LOGIN_PROVIDER_NAME as go } from "@arcblock/ux/lib/Util/constant";
5
+ import { checkSameProtocol as fo, getWebWalletUrl as Lo } from "@arcblock/ux/lib/Util/wallet";
6
+ import M from "lodash/noop";
7
+ import { useMemoizedFn as c, useCreation as yo } from "ahooks";
8
+ import v from "js-cookie";
9
+ import { detectWalletExtension as Io, getCookieOptions as Eo } from "@arcblock/ux/lib/Util";
10
+ import { useRef as w, useEffect as X } from "react";
11
+ import { mergeSx as Ao } from "@arcblock/ux/lib/Util/style";
12
+ import Mo from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
+ import { GA_LAST_LOGIN_METHOD as L } from "@arcblock/ux/lib/withTracker/constant";
14
+ import { translate as bo } from "@arcblock/ux/lib/Locale/util";
15
+ import xo from "@arcblock/ux/lib/Empty";
16
+ import { useBrowser as _o } from "@arcblock/react-hooks";
17
17
  import Co from "./mobile-login-item.js";
18
- import Po from "./web-login-item.js";
19
- import Mo from "./login-method-item.js";
18
+ import Oo from "./web-login-item.js";
19
+ import Po from "./login-method-item.js";
20
20
  import vo from "./wallet-login-options.js";
21
- import { useOAuth as _o } from "../../../OAuth/context.js";
22
- import { useStateContext as Oo } from "../../contexts/state.js";
23
- import { getAppId as wo, logger as Wo, getApiErrorMessage as To } from "../../../utils.js";
24
- import ko from "./passkey-login-item.js";
25
- import { usePasskey as So } from "../../../Passkey/context.js";
21
+ import { useOAuth as wo } from "../../../OAuth/context.js";
22
+ import { useStateContext as To } from "../../contexts/state.js";
23
+ import { getAppId as Wo, logger as So, getApiErrorMessage as ko } from "../../../utils.js";
24
+ import Do from "./passkey-login-item.js";
25
+ import { usePasskey as No } from "../../../Passkey/context.js";
26
26
  import "../../../Passkey/actions.js";
27
27
  import Ro from "../../plugins/email/index.js";
28
28
  import jo from "../../assets/locale.js";
29
- function No({
30
- onSuccess: W = b,
31
- onError: T = b,
29
+ function Bo({
30
+ onSuccess: T = M,
31
+ onError: W = M,
32
32
  size: m = "small",
33
- tokenState: t,
34
- webWalletUrl: x = ho(),
35
- tokenKey: k,
36
- passkeyBehavior: S = "none",
37
- onReset: C = b,
38
- providerList: p = [],
39
- slotProps: X = {},
40
- disableSwitchApp: P = !1,
41
- forceUpdate: z = b,
42
- magicToken: R = void 0,
43
- baseUrl: Q = "/",
44
- customItems: oo = [],
45
- qrcode: eo = null,
46
- hideQRCode: d = !1
33
+ tokenState: n,
34
+ webWalletUrl: b = Lo(),
35
+ tokenKey: S,
36
+ passkeyBehavior: k = "none",
37
+ onReset: x = M,
38
+ providerList: d = [],
39
+ slotProps: z = {},
40
+ disableSwitchApp: _ = !1,
41
+ forceUpdate: Q = M,
42
+ magicToken: D = void 0,
43
+ baseUrl: oo = "/",
44
+ customItems: eo = [],
45
+ qrcode: to = null,
46
+ hideQRCode: p = !1
47
47
  }) {
48
- const M = w(null), v = w(null), j = w(null), no = go(x), N = yo(), u = xo(), { loginOAuth: to, logoutOAuth: ro, t: io, oauthState: s } = _o(), { passkeyState: D } = So(), {
49
- extraParams: F,
50
- locale: B,
51
- connectState: i,
52
- plugins: G,
53
- setPlugins: lo,
54
- setSelectedPlugin: so,
48
+ const C = w(null), O = w(null), N = w(null), no = fo(b), R = Io(), h = _o(), { loginOAuth: ro, logoutOAuth: io, t: lo, oauthState: s } = wo(), { passkeyState: j } = No(), {
49
+ extraParams: B,
50
+ locale: G,
51
+ connectState: r,
52
+ plugins: F,
53
+ setPlugins: so,
54
+ setSelectedPlugin: ao,
55
55
  getPlugin: U,
56
56
  showWalletOptions: f,
57
- setShowWalletOptions: L,
58
- lastLoginMethod: g
59
- } = Oo(), I = a((o, r = {}) => Eo(jo, o, B, "en", r)), q = a(async (o) => {
60
- localStorage.setItem(y, o.provider), t.reset(), s.reset({
57
+ setShowWalletOptions: y,
58
+ lastLoginMethod: u
59
+ } = To(), I = c((o, i = {}) => bo(jo, o, G, "en", i)), q = c(async (o) => {
60
+ localStorage.setItem(L, o.provider), n.reset(), s.reset({
61
61
  status: "scanned"
62
- }), D.reset(), i.chooseMethod = o.provider;
63
- const r = F?.sourceAppPid;
62
+ }), j.reset(), r.chooseMethod = o.provider, r.walletMethod = "";
63
+ const i = B?.sourceAppPid;
64
64
  try {
65
65
  s.loading = !0, s.status = "scanned";
66
- const c = await to(o, {
67
- action: t.action,
68
- ...F
69
- }), h = Lo({ returnDomain: !1 });
70
- O.remove("connected_did", h), O.remove("connected_pk", h), O.remove("connected_wallet_os", h), c?.sessionToken && (await W(
66
+ const a = await ro(o, {
67
+ action: n.action,
68
+ ...B
69
+ }), g = Eo({ returnDomain: !1 });
70
+ v.remove("connected_did", g), v.remove("connected_pk", g), v.remove("connected_wallet_os", g), a?.sessionToken && (localStorage.setItem(uo, o.provider), await T(
71
71
  {
72
- ...c,
72
+ ...a,
73
73
  encrypted: !1
74
74
  },
75
- (mo) => mo,
75
+ (po) => po,
76
76
  {
77
- sourceAppPid: r,
78
- connected_app: wo(t.appInfo, t.memberAppInfo)
77
+ sourceAppPid: i,
78
+ connected_app: Wo(n.appInfo, n.memberAppInfo)
79
79
  }
80
80
  ), s.loading = !1, s.status = "succeed");
81
- } catch (c) {
82
- Wo.error(`Failed login OAuth: ${o.provider}`, c);
83
- const h = To(c, io("loginOAuthFailed"));
84
- s.loading = !1, s.error = h, s.status = "error", await ro({ provider: o.provider }), T(new Error(h));
81
+ } catch (a) {
82
+ So.error(`Failed login OAuth: ${o.provider}`, a);
83
+ const g = ko(a, lo("loginOAuthFailed"));
84
+ s.loading = !1, s.error = g, s.status = "error", await io({ provider: o.provider }), W(new Error(g));
85
85
  }
86
- }), K = a(async () => {
87
- t.reset(), await C(), t.status = "created", i.chooseMethod = "wallet";
88
- }), V = a(async () => {
89
- localStorage.setItem(y, e.WALLET), t.reset(), await C(), t.status = "created", i.chooseMethod = "wallet";
90
- const o = M.current?.connect;
91
- i.retryConnect = () => {
92
- o(K);
86
+ }), H = c(async () => {
87
+ n.reset(), await x(), n.status = "created", r.chooseMethod = "wallet", r.walletMethod = "";
88
+ }), K = c(async () => {
89
+ localStorage.setItem(L, t.WALLET), n.reset(), await x(), n.status = "created", r.chooseMethod = "wallet";
90
+ const o = C.current?.connect;
91
+ r.retryConnect = () => {
92
+ o(H);
93
93
  };
94
- }), Y = a(() => {
95
- localStorage.setItem(y, e.WALLET), t.status = "scanned", i.chooseMethod = "wallet-web";
96
- const o = v.current.connect;
97
- i.retryConnect = async () => {
98
- await C(), t.error = "", t.status = "scanned", o();
94
+ }), V = c(() => {
95
+ localStorage.setItem(L, t.WALLET), n.status = "scanned", r.chooseMethod = "wallet-web";
96
+ const o = O.current.connect;
97
+ r.retryConnect = async () => {
98
+ await x(), n.error = "", n.status = "scanned", o();
99
99
  };
100
- }), co = a(() => {
101
- L(!1);
102
- }), _ = fo(() => p.length === 1 && p[0].provider === e.WALLET, [p]);
103
- J(() => {
104
- d && _ && !u.mobile.any && !f && L(!0);
105
- }, [d, _, u.mobile.any, L, f]);
106
- const H = p.some((o) => o.provider === e.EMAIL), Z = Ro({ baseUrl: Q }), ao = a(() => {
107
- if (R && p.some((o) => o.name === e.EMAIL) && G.some((o) => o.name === e.EMAIL)) {
108
- const o = U(e.EMAIL);
109
- o.state.status === "idle" && (localStorage.setItem(y, e.EMAIL), o.state.reset(), o.state.magicToken = R, i.chooseMethod = e.EMAIL, so(o), z());
100
+ }), co = c(() => {
101
+ y(!1);
102
+ }), P = yo(() => d.length === 1 && d[0].provider === t.WALLET, [d]);
103
+ X(() => {
104
+ p && P && !h.mobile.any && !f && y(!0);
105
+ }, [p, P, h.mobile.any, y, f]);
106
+ const Y = d.some((o) => o.provider === t.EMAIL), Z = Ro({ baseUrl: oo }), mo = c(() => {
107
+ if (D && d.some((o) => o.name === t.EMAIL) && F.some((o) => o.name === t.EMAIL)) {
108
+ const o = U(t.EMAIL);
109
+ o.state.status === "idle" && (localStorage.setItem(L, t.EMAIL), o.state.reset(), o.state.magicToken = D, r.chooseMethod = t.EMAIL, ao(o), Q());
110
110
  }
111
111
  });
112
- J(() => {
112
+ X(() => {
113
113
  const o = [];
114
- if (H) {
115
- const r = U(e.EMAIL);
116
- r && r.baseUrl === Z.baseUrl ? o.push(r) : o.push(Z);
114
+ if (Y) {
115
+ const i = U(t.EMAIL);
116
+ i && i.baseUrl === Z.baseUrl ? o.push(i) : o.push(Z);
117
117
  }
118
- lo(o), i.retryConnect = K, setTimeout(() => {
119
- ao();
118
+ so(o), r.retryConnect = H, setTimeout(() => {
119
+ mo();
120
120
  }, 100);
121
- }, [H]);
122
- const $ = p.map((o) => {
123
- if (o.provider === e.WALLET)
124
- return u.mobile.any && !f ? /* @__PURE__ */ l(
121
+ }, [Y]);
122
+ const $ = d.map((o) => {
123
+ if (o.provider === t.WALLET)
124
+ return h.mobile.any && !f ? /* @__PURE__ */ l(
125
125
  Co,
126
126
  {
127
127
  t: I,
128
- isLatest: g && g === e.WALLET,
129
- ref: M,
130
- tokenState: t,
128
+ isLatest: u && u === J.MOBILE,
129
+ ref: C,
130
+ tokenState: n,
131
131
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
132
- locale: B,
133
- tokenKey: k,
134
- disableSwitchApp: P,
135
- onClick: V
132
+ locale: G,
133
+ tokenKey: S,
134
+ disableSwitchApp: _,
135
+ onClick: K
136
136
  },
137
- e.WALLET
138
- ) : d || !d && (no || N) && (!u.mobile.any || N) ? /* @__PURE__ */ l(
139
- Po,
137
+ t.WALLET
138
+ ) : p || !p && (no || R) && (!h.mobile.any || R) ? /* @__PURE__ */ l(
139
+ Oo,
140
140
  {
141
141
  t: I,
142
- isLatest: g && g === e.WALLET,
143
- ref: v,
144
- tokenState: t,
145
- webWalletUrl: x,
142
+ isLatest: u && u === J.WEB,
143
+ ref: O,
144
+ tokenState: n,
145
+ webWalletUrl: b,
146
146
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
147
- disableSwitchApp: P,
148
- autoConnect: !d,
147
+ disableSwitchApp: _,
148
+ autoConnect: !p,
149
149
  onClick: () => {
150
- d ? L(!0) : Y();
150
+ p ? y(!0) : V();
151
151
  }
152
152
  },
153
- e.WALLET
153
+ t.WALLET
154
154
  ) : null;
155
- if (o.provider === e.PASSKEY)
156
- return S === "none" ? null : /* @__PURE__ */ l(
157
- ko,
155
+ if (o.provider === t.PASSKEY)
156
+ return k === "none" ? null : /* @__PURE__ */ l(
157
+ Do,
158
158
  {
159
- ref: j,
160
- onSuccess: W,
161
- onError: T,
162
- tokenState: t,
163
- behavior: S,
159
+ ref: N,
160
+ onSuccess: T,
161
+ onError: W,
162
+ tokenState: n,
163
+ behavior: k,
164
164
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
165
165
  onClick: () => {
166
- localStorage.setItem(y, e.PASSKEY);
167
- const r = j.current.connect;
168
- i.chooseMethod = "passkey", i.retryConnect = () => {
169
- D.verifying = !0, i.chooseMethod = "passkey", r();
166
+ localStorage.setItem(L, t.PASSKEY);
167
+ const i = N.current.connect;
168
+ r.chooseMethod = "passkey", r.walletMethod = "", r.retryConnect = () => {
169
+ j.verifying = !0, r.chooseMethod = "passkey", i();
170
170
  };
171
171
  },
172
172
  slotProps: {
173
173
  icon: {
174
174
  sx: {
175
- fontSize: E,
175
+ fontSize: A,
176
176
  "& svg": {
177
- fontSize: E,
177
+ fontSize: A,
178
178
  width: "1em",
179
179
  height: "1em"
180
180
  }
@@ -182,36 +182,36 @@ function No({
182
182
  }
183
183
  }
184
184
  },
185
- e.PASSKEY
185
+ t.PASSKEY
186
186
  );
187
- if (o.provider === e.EMAIL) {
188
- const r = G.find((c) => c.name === e.EMAIL);
189
- return r ? r?.renderListItem({
190
- key: r.name,
187
+ if (o.provider === t.EMAIL) {
188
+ const i = F.find((a) => a.name === t.EMAIL);
189
+ return i ? i?.renderListItem({
190
+ key: i.name,
191
191
  sx: [m === "small" ? { p: 1 } : { p: 2 }]
192
192
  // forceUpdate,
193
193
  }) : null;
194
194
  }
195
195
  return o.type === "oauth" ? /* @__PURE__ */ l(
196
- Mo,
196
+ Po,
197
197
  {
198
198
  t: I,
199
- isLatest: g && g === o.provider,
200
- title: uo[o.provider],
199
+ isLatest: u && u === o.provider,
200
+ title: go[o.provider],
201
201
  icon: /* @__PURE__ */ l(
202
- Ao,
202
+ Mo,
203
203
  {
204
204
  provider: o.provider,
205
205
  sx: {
206
206
  transform: "scale(0.95)",
207
- width: E,
208
- height: E,
207
+ width: A,
208
+ height: A,
209
209
  color: "text.primary"
210
210
  }
211
211
  }
212
212
  ),
213
213
  onClick: () => {
214
- q(o), i.retryConnect = () => {
214
+ q(o), r.retryConnect = () => {
215
215
  q(o);
216
216
  };
217
217
  },
@@ -220,42 +220,42 @@ function No({
220
220
  o.provider
221
221
  ) : null;
222
222
  }).filter(Boolean);
223
- return /* @__PURE__ */ l(A, { className: "did-connect__choose", sx: Io({ flex: 1 }, X?.root?.sx), children: /* @__PURE__ */ l(
224
- A,
223
+ return /* @__PURE__ */ l(E, { className: "did-connect__choose", sx: Ao({ flex: 1 }, z?.root?.sx), children: /* @__PURE__ */ l(
224
+ E,
225
225
  {
226
226
  sx: {
227
227
  display: "flex",
228
228
  flexDirection: "column",
229
229
  gap: 2
230
230
  },
231
- children: /* @__PURE__ */ po(
232
- A,
231
+ children: /* @__PURE__ */ ho(
232
+ E,
233
233
  {
234
234
  sx: [
235
235
  {
236
236
  display: "flex",
237
237
  flexDirection: "column",
238
- ...f && !u.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
238
+ ...f && !h.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
239
239
  }
240
240
  ],
241
241
  children: [
242
- f && !u.mobile.any ? /* @__PURE__ */ l(
242
+ f && !h.mobile.any ? /* @__PURE__ */ l(
243
243
  vo,
244
244
  {
245
- qrcode: eo,
246
- tokenState: t,
247
- webWalletUrl: x,
245
+ qrcode: to,
246
+ tokenState: n,
247
+ webWalletUrl: b,
248
248
  size: m,
249
- disableSwitchApp: P,
250
- tokenKey: k,
251
- walletLoginRef: M,
252
- webLoginRef: v,
253
- onMobileLoginClick: V,
254
- onWebLoginClick: Y,
255
- onBack: _ ? void 0 : co
249
+ disableSwitchApp: _,
250
+ tokenKey: S,
251
+ walletLoginRef: C,
252
+ webLoginRef: O,
253
+ onMobileLoginClick: K,
254
+ onWebLoginClick: V,
255
+ onBack: P ? void 0 : co
256
256
  }
257
257
  ) : /* @__PURE__ */ l(
258
- A,
258
+ E,
259
259
  {
260
260
  sx: {
261
261
  display: "grid",
@@ -301,7 +301,7 @@ function No({
301
301
  }
302
302
  },
303
303
  children: $.length > 0 ? $ : /* @__PURE__ */ l(
304
- bo,
304
+ xo,
305
305
  {
306
306
  className: "arc-login-item",
307
307
  sx: {
@@ -314,32 +314,32 @@ function No({
314
314
  )
315
315
  }
316
316
  ),
317
- oo.map((o) => o || null)
317
+ eo.map((o) => o || null)
318
318
  ]
319
319
  }
320
320
  )
321
321
  }
322
322
  ) });
323
323
  }
324
- No.propTypes = {
325
- onSuccess: n.func,
326
- onError: n.func,
327
- size: n.oneOf(["small", "normal", "large"]),
328
- tokenState: n.object.isRequired,
329
- webWalletUrl: n.string,
330
- tokenKey: n.string.isRequired,
331
- passkeyBehavior: n.oneOf(["none", "both", "only-existing", "only-new"]),
332
- onReset: n.func,
333
- providerList: n.array,
334
- slotProps: n.object,
335
- disableSwitchApp: n.bool,
336
- forceUpdate: n.func,
337
- magicToken: n.string,
338
- baseUrl: n.string,
339
- customItems: n.arrayOf(n.node),
340
- qrcode: n.node,
341
- hideQRCode: n.bool
324
+ Bo.propTypes = {
325
+ onSuccess: e.func,
326
+ onError: e.func,
327
+ size: e.oneOf(["small", "normal", "large"]),
328
+ tokenState: e.object.isRequired,
329
+ webWalletUrl: e.string,
330
+ tokenKey: e.string.isRequired,
331
+ passkeyBehavior: e.oneOf(["none", "both", "only-existing", "only-new"]),
332
+ onReset: e.func,
333
+ providerList: e.array,
334
+ slotProps: e.object,
335
+ disableSwitchApp: e.bool,
336
+ forceUpdate: e.func,
337
+ magicToken: e.string,
338
+ baseUrl: e.string,
339
+ customItems: e.arrayOf(e.node),
340
+ qrcode: e.node,
341
+ hideQRCode: e.bool
342
342
  };
343
343
  export {
344
- No as default
344
+ Bo as default
345
345
  };
@@ -1,104 +1,104 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as p } from "react/jsx-runtime";
2
2
  import n from "prop-types";
3
- import { CircularProgress as T } from "@mui/material";
4
- import { useReactive as E, useCreation as W, useMemoizedFn as a } from "ahooks";
5
- import _ from "@arcblock/bridge";
6
- import { useBrowser as N } from "@arcblock/react-hooks";
7
- import q from "lodash/noop";
3
+ import { CircularProgress as _ } from "@mui/material";
4
+ import { useReactive as v, useCreation as N, useMemoizedFn as l } from "ahooks";
5
+ import W from "@arcblock/bridge";
6
+ import { useBrowser as q } from "@arcblock/react-hooks";
7
+ import B from "lodash/noop";
8
8
  import { useImperativeHandle as F } from "react";
9
- import { mergeSx as M } from "@arcblock/ux/lib/Util/style";
9
+ import { mergeSx as G } from "@arcblock/ux/lib/Util/style";
10
10
  import j from "@arcblock/ux/lib/DIDConnect/provider-icon";
11
- import { LOGIN_PROVIDER_ICON_SIZE as p, LOGIN_PROVIDER as z } from "@arcblock/ux/lib/Util/constant";
12
- import { useStateContext as G } from "../../contexts/state.js";
11
+ import { WALLET_LOGIN_METHOD as f, LOGIN_PROVIDER_ICON_SIZE as d, LOGIN_PROVIDER as z } from "@arcblock/ux/lib/Util/constant";
12
+ import { useStateContext as H } from "../../contexts/state.js";
13
13
  import J from "./login-method-item.js";
14
- import { logger as b } from "../../../utils.js";
14
+ import { logger as L } from "../../../utils.js";
15
15
  import K from "../../hooks/auth-url.js";
16
16
  function V({
17
- isTablet: w = !1,
18
- ref: C = null,
17
+ isTablet: C = !1,
18
+ ref: A = null,
19
19
  tokenState: e,
20
20
  locale: P,
21
21
  tokenKey: y,
22
- onClick: R = q,
23
- disableSwitchApp: A = !1,
24
- ...f
22
+ onClick: R = B,
23
+ disableSwitchApp: O = !1,
24
+ ...h
25
25
  }) {
26
- const l = E({
26
+ const a = v({
27
27
  loading: !1
28
- }), { isWalletWebview: d } = G(), L = "DID Wallet", c = N(), h = new URL(window.location.href), x = K({ disableSwitchApp: A, tokenState: e }), u = W(() => {
28
+ }), { isWalletWebview: u, connectState: c } = H(), x = "DID Wallet", m = q(), I = new URL(window.location.href), E = K({ disableSwitchApp: O, tokenState: e }), g = N(() => {
29
29
  if (!e.url)
30
30
  return "";
31
- h.searchParams.set("tokenKey", e.token);
32
- const o = new URL(x);
33
- c.wallet || (o.searchParams.set("callback", encodeURIComponent(h)), o.searchParams.set("callback_delay", 1500)), o.searchParams.set("locale", P);
34
- const g = new TextEncoder(), D = o.href.length;
35
- let r = "", i = "";
31
+ I.searchParams.set("tokenKey", e.token);
32
+ const o = new URL(E);
33
+ m.wallet || (o.searchParams.set("callback", encodeURIComponent(I)), o.searchParams.set("callback_delay", 1500)), o.searchParams.set("locale", P);
34
+ const w = new TextEncoder(), U = o.href.length;
35
+ let r = "", s = "";
36
36
  try {
37
37
  if (e.appInfo) {
38
- const t = g.encode(JSON.stringify(e.appInfo));
39
- r = btoa(String.fromCharCode(...t));
38
+ const i = w.encode(JSON.stringify(e.appInfo));
39
+ r = btoa(String.fromCharCode(...i));
40
40
  }
41
41
  if (e.memberAppInfo) {
42
- const t = g.encode(JSON.stringify(e.memberAppInfo));
43
- i = btoa(String.fromCharCode(...t));
42
+ const i = w.encode(JSON.stringify(e.memberAppInfo));
43
+ s = btoa(String.fromCharCode(...i));
44
44
  }
45
- if (D + 8 + r.length + 14 + i.length > 2e3)
46
- throw b.warn("URL too long, drop appInfo & memberAppInfo", { appInfo: r, memberAppInfo: i }), new Error("URL too long");
47
- i ? r && (o.searchParams.set("appInfo", r), o.searchParams.set("memberAppInfo", i)) : r && o.searchParams.set("appInfo", r);
48
- } catch (t) {
49
- b.warn("Failed to convert appInfo & memberAppInfo", t);
45
+ if (U + 8 + r.length + 14 + s.length > 2e3)
46
+ throw L.warn("URL too long, drop appInfo & memberAppInfo", { appInfo: r, memberAppInfo: s }), new Error("URL too long");
47
+ s ? r && (o.searchParams.set("appInfo", r), o.searchParams.set("memberAppInfo", s)) : r && o.searchParams.set("appInfo", r);
48
+ } catch (i) {
49
+ L.warn("Failed to convert appInfo & memberAppInfo", i);
50
50
  }
51
51
  return o.href.replace(/^https?:\/\//, "abt://");
52
- }, [y, e.token, e.appInfo, e.memberAppInfo, e.url]), O = a(() => {
53
- l.loading = !0, setTimeout(() => {
54
- _.call("authAction", { action: "auth", deepLink: u });
52
+ }, [y, e.token, e.appInfo, e.memberAppInfo, e.url]), M = l(() => {
53
+ a.loading = !0, setTimeout(() => {
54
+ W.call("authAction", { action: "auth", deepLink: g });
55
55
  }, 600), setTimeout(() => {
56
- l.loading = !1;
56
+ a.loading = !1;
57
57
  }, 2e3);
58
- }), U = a(() => {
58
+ }), T = l(() => {
59
59
  e.checking = !0, e.status = "scanned";
60
- }), s = {};
61
- !d && c.mobile.any && (s.component = "a", s.href = u), e.url || (s.sx = {
60
+ }), t = {};
61
+ !u && m.mobile.any && (t.component = "a", t.href = g), e.url || (t.sx = {
62
62
  cursor: "not-allowed"
63
63
  });
64
- const I = a((o) => {
65
- e.url && (d ? O() : c.mobile.any || w ? U() : o());
66
- }), v = a(() => {
67
- I(R);
64
+ const b = l((o) => {
65
+ e.url && (u ? (c.walletMethod = f.MOBILE, M()) : m.mobile.any || C ? (c.walletMethod = f.MOBILE, T()) : (c.walletMethod = f.SCAN, o()));
66
+ }), D = l(() => {
67
+ b(R);
68
68
  });
69
- return F(C, () => ({
70
- connect: I
71
- })), /* @__PURE__ */ m(
69
+ return F(A, () => ({
70
+ connect: b
71
+ })), /* @__PURE__ */ p(
72
72
  J,
73
73
  {
74
- ...f,
75
- ...s,
76
- sx: M(f?.sx, s?.sx),
77
- title: L,
78
- icon: l.loading || !e.url ? /* @__PURE__ */ m(
79
- T,
74
+ ...h,
75
+ ...t,
76
+ sx: G(h?.sx, t?.sx),
77
+ title: x,
78
+ icon: a.loading || !e.url ? /* @__PURE__ */ p(
79
+ _,
80
80
  {
81
81
  color: "primary",
82
- size: p,
82
+ size: d,
83
83
  sx: {
84
84
  "& svg": {
85
85
  transform: "scale(0.75)"
86
86
  }
87
87
  }
88
88
  }
89
- ) : /* @__PURE__ */ m(
89
+ ) : /* @__PURE__ */ p(
90
90
  j,
91
91
  {
92
92
  provider: z.DID_WALLET,
93
93
  sx: {
94
- width: p,
95
- height: p,
94
+ width: d,
95
+ height: d,
96
96
  transform: "scale(0.9)"
97
97
  }
98
98
  }
99
99
  ),
100
100
  iconScale: 1,
101
- onClick: v
101
+ onClick: D
102
102
  }
103
103
  );
104
104
  }