@arcblock/did-connect-react 3.5.1 → 4.0.0-beta.1

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 (170) hide show
  1. package/dist/ConnectContext.d.ts +13 -0
  2. package/dist/ConnectContext.d.ts.map +1 -0
  3. package/dist/ConnectContext.js +14 -0
  4. package/dist/ConnectContext.js.map +1 -0
  5. package/dist/ConnectProvider.d.ts +11 -0
  6. package/dist/ConnectProvider.d.ts.map +1 -0
  7. package/dist/ConnectProvider.js +23 -0
  8. package/dist/ConnectProvider.js.map +1 -0
  9. package/dist/compat/SessionProvider.d.ts +22 -0
  10. package/dist/compat/SessionProvider.d.ts.map +1 -0
  11. package/dist/compat/SessionProvider.js +17 -0
  12. package/dist/compat/SessionProvider.js.map +1 -0
  13. package/dist/compat/index.d.ts +4 -0
  14. package/dist/compat/index.d.ts.map +1 -0
  15. package/dist/compat/index.js +3 -0
  16. package/dist/compat/index.js.map +1 -0
  17. package/dist/compat/useSessionContext.d.ts +14 -0
  18. package/dist/compat/useSessionContext.d.ts.map +1 -0
  19. package/dist/compat/useSessionContext.js +20 -0
  20. package/dist/compat/useSessionContext.js.map +1 -0
  21. package/dist/components/LoginPage.d.ts +15 -0
  22. package/dist/components/LoginPage.d.ts.map +1 -0
  23. package/dist/components/LoginPage.js +33 -0
  24. package/dist/components/LoginPage.js.map +1 -0
  25. package/dist/components/UserAvatar.d.ts +19 -0
  26. package/dist/components/UserAvatar.d.ts.map +1 -0
  27. package/dist/components/UserAvatar.js +45 -0
  28. package/dist/components/UserAvatar.js.map +1 -0
  29. package/dist/hooks/index.d.ts +11 -0
  30. package/dist/hooks/index.d.ts.map +1 -0
  31. package/dist/hooks/index.js +6 -0
  32. package/dist/hooks/index.js.map +1 -0
  33. package/dist/hooks/useConnect.d.ts +15 -0
  34. package/dist/hooks/useConnect.d.ts.map +1 -0
  35. package/dist/hooks/useConnect.js +19 -0
  36. package/dist/hooks/useConnect.js.map +1 -0
  37. package/dist/hooks/useEmail.d.ts +11 -0
  38. package/dist/hooks/useEmail.d.ts.map +1 -0
  39. package/dist/hooks/useEmail.js +47 -0
  40. package/dist/hooks/useEmail.js.map +1 -0
  41. package/dist/hooks/useOAuth.d.ts +12 -0
  42. package/dist/hooks/useOAuth.d.ts.map +1 -0
  43. package/dist/hooks/useOAuth.js +75 -0
  44. package/dist/hooks/useOAuth.js.map +1 -0
  45. package/dist/hooks/usePasskey.d.ts +14 -0
  46. package/dist/hooks/usePasskey.d.ts.map +1 -0
  47. package/dist/hooks/usePasskey.js +35 -0
  48. package/dist/hooks/usePasskey.js.map +1 -0
  49. package/dist/hooks/useSession.d.ts +12 -0
  50. package/dist/hooks/useSession.d.ts.map +1 -0
  51. package/dist/hooks/useSession.js +30 -0
  52. package/dist/hooks/useSession.js.map +1 -0
  53. package/dist/index.d.ts +13 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +11 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/internals/blocklet-config.d.ts +22 -0
  58. package/dist/internals/blocklet-config.d.ts.map +1 -0
  59. package/dist/internals/blocklet-config.js +26 -0
  60. package/dist/internals/blocklet-config.js.map +1 -0
  61. package/dist/internals/local-storage-adapter.d.ts +12 -0
  62. package/dist/internals/local-storage-adapter.d.ts.map +1 -0
  63. package/dist/internals/local-storage-adapter.js +32 -0
  64. package/dist/internals/local-storage-adapter.js.map +1 -0
  65. package/dist/internals/use-sync-state.d.ts +18 -0
  66. package/dist/internals/use-sync-state.d.ts.map +1 -0
  67. package/dist/internals/use-sync-state.js +38 -0
  68. package/dist/internals/use-sync-state.js.map +1 -0
  69. package/package.json +33 -79
  70. package/LICENSE +0 -13
  71. package/README.md +0 -134
  72. package/dist/standalone/did-connect-react.css +0 -1
  73. package/dist/standalone/index.js +0 -133700
  74. package/lib/Address/index.js +0 -4
  75. package/lib/Avatar/index.js +0 -4
  76. package/lib/Button/index.js +0 -17
  77. package/lib/Connect/assets/locale.js +0 -147
  78. package/lib/Connect/assets/login-bg.png +0 -0
  79. package/lib/Connect/assets/login-slogan.js +0 -9
  80. package/lib/Connect/components/action-button.js +0 -26
  81. package/lib/Connect/components/app-tips.js +0 -132
  82. package/lib/Connect/components/auto-height.js +0 -31
  83. package/lib/Connect/components/back-button.js +0 -25
  84. package/lib/Connect/components/connect-status.js +0 -263
  85. package/lib/Connect/components/did-connect-title.js +0 -127
  86. package/lib/Connect/components/download-tips.js +0 -52
  87. package/lib/Connect/components/loading.js +0 -26
  88. package/lib/Connect/components/login-item/connect-choose-list.js +0 -257
  89. package/lib/Connect/components/login-item/connect-provider-list.js +0 -345
  90. package/lib/Connect/components/login-item/login-method-item.js +0 -147
  91. package/lib/Connect/components/login-item/mobile-login-item.js +0 -116
  92. package/lib/Connect/components/login-item/passkey-login-item.js +0 -44
  93. package/lib/Connect/components/login-item/wallet-login-options.js +0 -114
  94. package/lib/Connect/components/login-item/web-login-item.js +0 -104
  95. package/lib/Connect/components/mask-overlay.js +0 -34
  96. package/lib/Connect/components/refresh-overlay.js +0 -57
  97. package/lib/Connect/components/switch-app.js +0 -70
  98. package/lib/Connect/connect.js +0 -505
  99. package/lib/Connect/contexts/state.js +0 -156
  100. package/lib/Connect/fallback-connect.js +0 -53
  101. package/lib/Connect/fullpage.js +0 -5
  102. package/lib/Connect/hooks/auth-url.js +0 -23
  103. package/lib/Connect/hooks/method-list.js +0 -46
  104. package/lib/Connect/hooks/page-show.js +0 -17
  105. package/lib/Connect/hooks/provider-list.js +0 -69
  106. package/lib/Connect/hooks/security.js +0 -27
  107. package/lib/Connect/hooks/token.js +0 -296
  108. package/lib/Connect/hooks/use-apps.js +0 -19
  109. package/lib/Connect/hooks/use-quick-connect.js +0 -86
  110. package/lib/Connect/index.js +0 -16
  111. package/lib/Connect/landing-page.js +0 -5
  112. package/lib/Connect/plugins/email/index.js +0 -65
  113. package/lib/Connect/plugins/email/list-item.js +0 -31
  114. package/lib/Connect/plugins/email/placeholder.js +0 -284
  115. package/lib/Connect/plugins/index.js +0 -4
  116. package/lib/Connect/use-connect.js +0 -164
  117. package/lib/Connect/with-blocklet.js +0 -15
  118. package/lib/Connect/with-bridge-call.js +0 -108
  119. package/lib/Federated/context.js +0 -61
  120. package/lib/Federated/index.js +0 -7
  121. package/lib/Logo/index.js +0 -4
  122. package/lib/OAuth/bind-conflict-alert.js +0 -29
  123. package/lib/OAuth/context.js +0 -277
  124. package/lib/OAuth/guest.svg.js +0 -5
  125. package/lib/OAuth/index.js +0 -7
  126. package/lib/OAuth/passport-switcher.js +0 -5
  127. package/lib/Passkey/actions.js +0 -170
  128. package/lib/Passkey/constants.js +0 -4
  129. package/lib/Passkey/context.js +0 -281
  130. package/lib/Passkey/dialog.js +0 -280
  131. package/lib/Passkey/icon.js +0 -13
  132. package/lib/Passkey/index.js +0 -9
  133. package/lib/Service/index.js +0 -62
  134. package/lib/Session/assets/did-spaces-guide-cover.svg.js +0 -111
  135. package/lib/Session/assets/did-spaces-guide-icon.svg.js +0 -9
  136. package/lib/Session/context.js +0 -5
  137. package/lib/Session/did-spaces-guide.js +0 -136
  138. package/lib/Session/handler.js +0 -55
  139. package/lib/Session/hooks/use-federated.js +0 -64
  140. package/lib/Session/hooks/use-mobile.js +0 -8
  141. package/lib/Session/hooks/use-protected-routes.js +0 -11
  142. package/lib/Session/hooks/use-session-token.js +0 -181
  143. package/lib/Session/hooks/use-verify.js +0 -45
  144. package/lib/Session/index.js +0 -941
  145. package/lib/Session/libs/constants.js +0 -18
  146. package/lib/Session/libs/did-spaces.js +0 -10
  147. package/lib/Session/libs/federated.js +0 -42
  148. package/lib/Session/libs/index.js +0 -15
  149. package/lib/Session/libs/locales.js +0 -161
  150. package/lib/Session/libs/login-mobile.js +0 -55
  151. package/lib/Session/window-focus-aware.js +0 -17
  152. package/lib/SessionManager/index.js +0 -4
  153. package/lib/Storage/engine/cookie.js +0 -22
  154. package/lib/Storage/engine/local-storage.js +0 -37
  155. package/lib/Storage/index.js +0 -23
  156. package/lib/User/index.js +0 -6
  157. package/lib/User/use-did.js +0 -59
  158. package/lib/User/wrap-did.js +0 -13
  159. package/lib/WebWalletSWKeeper/index.js +0 -5
  160. package/lib/components/PassportSwitcher.js +0 -128
  161. package/lib/constant.js +0 -23
  162. package/lib/error.js +0 -8
  163. package/lib/hooks/use-locale.js +0 -7
  164. package/lib/index.js +0 -111
  165. package/lib/locales/en.js +0 -17
  166. package/lib/locales/index.js +0 -10
  167. package/lib/locales/zh.js +0 -17
  168. package/lib/package.json.js +0 -7
  169. package/lib/types.d.ts +0 -355
  170. package/lib/utils.js +0 -225
@@ -1,263 +0,0 @@
1
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import { isValidElement as v } from "react";
3
- import o from "prop-types";
4
- import { useTheme as I, Box as n, Typography as y, Tooltip as q } from "@mui/material";
5
- import { Icon as B } from "@iconify/react";
6
- import j from "@iconify-icons/material-symbols/close-rounded";
7
- import A from "@iconify-icons/material-symbols/hourglass-empty-rounded";
8
- import E from "@iconify-icons/material-symbols/rule-settings-rounded";
9
- import L from "@arcblock/ux/lib/LoadingMask";
10
- import M from "@arcblock/ux/lib/Success";
11
- import g from "lodash/noop";
12
- import { useMemoizedFn as N } from "ahooks";
13
- import { translate as O } from "@arcblock/ux/lib/Locale/util";
14
- import P from "@arcblock/ux/lib/DIDConnect/provider-icon";
15
- import { LOGIN_PROVIDER as F } from "@arcblock/ux/lib/Util/constant";
16
- import H from "../assets/locale.js";
17
- import k from "./action-button.js";
18
- import f from "./back-button.js";
19
- function a({ icon: t = null, title: l = "", color: s = "", description: i = "", extraContent: x = null, actions: h = null }) {
20
- const { palette: c } = I(), m = s || c.grey[700];
21
- return /* @__PURE__ */ p(
22
- n,
23
- {
24
- sx: {
25
- display: "flex",
26
- flexDirection: "column",
27
- alignItems: "center",
28
- justifyContent: "center",
29
- gap: 1.5
30
- },
31
- children: [
32
- v(t) ? t : /* @__PURE__ */ e(
33
- n,
34
- {
35
- sx: {
36
- backgroundColor: m,
37
- borderRadius: "100%",
38
- fontSize: 0
39
- },
40
- children: /* @__PURE__ */ e(
41
- B,
42
- {
43
- icon: t,
44
- fontSize: 52,
45
- style: {
46
- transform: "scale(0.7)",
47
- color: c.primary.contrastText
48
- }
49
- }
50
- )
51
- }
52
- ),
53
- /* @__PURE__ */ p(n, { sx: { textAlign: "center" }, children: [
54
- /* @__PURE__ */ e(
55
- y,
56
- {
57
- variant: "h6",
58
- sx: {
59
- fontWeight: 500,
60
- color: m
61
- },
62
- children: l
63
- }
64
- ),
65
- /* @__PURE__ */ e(q, { title: i, placement: "top", children: /* @__PURE__ */ e(
66
- y,
67
- {
68
- variant: "body2",
69
- sx: {
70
- color: "text.secondary",
71
- overflow: "hidden",
72
- display: "-webkit-box",
73
- "-webkit-box-orient": "vertical",
74
- "-webkit-line-clamp": "3",
75
- whiteSpace: "pre-wrap",
76
- wordBreak: "break-word"
77
- },
78
- children: i
79
- }
80
- ) })
81
- ] }),
82
- x,
83
- /* @__PURE__ */ e(n, { children: h })
84
- ]
85
- }
86
- );
87
- }
88
- a.propTypes = {
89
- icon: o.any,
90
- title: o.string,
91
- color: o.string,
92
- description: o.string,
93
- extraContent: o.node,
94
- actions: o.node
95
- };
96
- function b({ title: t = "", mfaCode: l = 0 }) {
97
- return /* @__PURE__ */ p(
98
- n,
99
- {
100
- className: "status-mfa",
101
- sx: {
102
- display: "flex",
103
- flexDirection: "column",
104
- justifyContent: "center",
105
- alignItems: "center",
106
- border: "1px solid",
107
- borderColor: "grey.200",
108
- borderRadius: 1,
109
- maxWidth: "360px",
110
- backgroundColor: "transparent",
111
- p: 1
112
- },
113
- children: [
114
- /* @__PURE__ */ e(
115
- n,
116
- {
117
- className: "status-mfa-tip",
118
- sx: {
119
- textAlign: "center",
120
- textWrap: "balance"
121
- },
122
- children: t
123
- }
124
- ),
125
- /* @__PURE__ */ e(
126
- y,
127
- {
128
- className: "status-mfa-code",
129
- sx: {
130
- mt: 1,
131
- lineHeight: 1,
132
- fontSize: "36px",
133
- fontWeight: 700,
134
- letterSpacing: 1
135
- },
136
- children: l
137
- }
138
- )
139
- ]
140
- }
141
- );
142
- }
143
- b.propTypes = {
144
- title: o.string,
145
- mfaCode: o.number
146
- };
147
- function V({
148
- status: t = "",
149
- nextWorkflow: l = "",
150
- mfaCode: s = 0,
151
- onCancel: i = g,
152
- onRetry: x = g,
153
- onClose: h = g,
154
- messages: c,
155
- locale: m = "en",
156
- isFullScreen: w = !1,
157
- loadingIcon: S = null,
158
- chooseMethod: T = "DID Wallet",
159
- hideRetry: D = !1,
160
- hideBack: u = !1,
161
- ...C
162
- }) {
163
- const r = N((W, z = {}) => O(H, W, m, "en", z)), { palette: R } = I(), d = /* @__PURE__ */ e(k, { sx: { color: "text.secondary" }, onClick: h, children: r("close") });
164
- return /* @__PURE__ */ p(
165
- n,
166
- {
167
- ...C,
168
- sx: {
169
- p: 2,
170
- minHeight: 200,
171
- ...C.sx
172
- },
173
- children: [
174
- t === "scanned" && !l && /* @__PURE__ */ e(
175
- a,
176
- {
177
- icon: /* @__PURE__ */ e(L, { size: 52, borderRadius: 12, children: S || /* @__PURE__ */ e(P, { provider: F.DID_WALLET, width: "100%", height: "100%" }) }),
178
- title: r("requestConnect"),
179
- description: r("continueInWallet", { method: T }),
180
- extraContent: s > 0 && /* @__PURE__ */ e(b, { mfaCode: s, title: r("mfaCode") }),
181
- actions: u ? d : /* @__PURE__ */ e(f, { onClick: i })
182
- }
183
- ),
184
- t === "scanned" && !!l && /* @__PURE__ */ e(
185
- a,
186
- {
187
- color: R.secondary.main,
188
- icon: A,
189
- title: r("wait"),
190
- description: r("waiting"),
191
- extraContent: s > 0 && /* @__PURE__ */ e(b, { mfaCode: s, title: r("mfaCode") }),
192
- actions: u ? d : /* @__PURE__ */ e(f, { onClick: i })
193
- }
194
- ),
195
- t === "succeed" && /* @__PURE__ */ e(
196
- a,
197
- {
198
- color: "success.light",
199
- icon: /* @__PURE__ */ e(M, { size: 52, borderWidth: 3 }),
200
- title: r("success"),
201
- description: c.success,
202
- actions: w ? null : d
203
- }
204
- ),
205
- t === "error" && /* @__PURE__ */ e(
206
- a,
207
- {
208
- color: R.error.main,
209
- icon: j,
210
- title: r("failed"),
211
- description: c.error || r("error"),
212
- actions: /* @__PURE__ */ p(n, { sx: { display: "flex", gap: 1 }, children: [
213
- u ? d : /* @__PURE__ */ e(f, { onClick: i }),
214
- D ? null : /* @__PURE__ */ e(
215
- k,
216
- {
217
- onClick: x,
218
- sx: {
219
- color: "primary.main",
220
- borderColor: "primary.light"
221
- },
222
- children: r("retry")
223
- }
224
- )
225
- ] })
226
- }
227
- ),
228
- t === "busy" && /* @__PURE__ */ e(
229
- a,
230
- {
231
- color: "warning.main",
232
- icon: E,
233
- title: r("busyTitle"),
234
- description: c.error || r("busyDesc"),
235
- actions: u ? d : /* @__PURE__ */ e(f, { onClick: i })
236
- }
237
- )
238
- ]
239
- }
240
- );
241
- }
242
- V.propTypes = {
243
- status: o.string,
244
- nextWorkflow: o.string,
245
- mfaCode: o.number,
246
- onCancel: o.func,
247
- onRetry: o.func,
248
- onClose: o.func,
249
- messages: o.shape({
250
- confirm: o.string.isRequired,
251
- success: o.any.isRequired,
252
- error: o.any.isRequired
253
- }).isRequired,
254
- locale: o.oneOf(["en", "zh"]),
255
- isFullScreen: o.bool,
256
- loadingIcon: o.any,
257
- chooseMethod: o.string,
258
- hideRetry: o.bool,
259
- hideBack: o.bool
260
- };
261
- export {
262
- V as default
263
- };
@@ -1,127 +0,0 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { useState as d } from "react";
3
- import { Icon as r } from "@iconify/react";
4
- import { Box as n, Typography as l, Tooltip as x } from "@mui/material";
5
- import y from "@iconify-icons/material-symbols/info-outline-rounded";
6
- import u from "@iconify-icons/material-symbols/swap-horiz-rounded";
7
- import t from "prop-types";
8
- import h from "./switch-app.js";
9
- function S({ title: p, description: s, extraContent: e = null, disableSwitchApp: a = !1 }) {
10
- const [c, f] = d(!1);
11
- return /* @__PURE__ */ i(
12
- n,
13
- {
14
- sx: {
15
- display: "flex",
16
- flexDirection: "column",
17
- gap: 0.5
18
- },
19
- children: [
20
- /* @__PURE__ */ i(
21
- l,
22
- {
23
- component: "h1",
24
- variant: "h4",
25
- sx: {
26
- color: "text.primary",
27
- fontWeight: 700,
28
- fontFamily: "Lexend",
29
- display: "flex",
30
- alignItems: "center",
31
- gap: 0.5
32
- },
33
- onClick: (m) => {
34
- a || m.detail > 2 && f(!0);
35
- },
36
- children: [
37
- p,
38
- /* @__PURE__ */ o(
39
- h,
40
- {
41
- sx: {
42
- fontSize: 0,
43
- display: c ? "block" : "none"
44
- },
45
- children: /* @__PURE__ */ o(
46
- r,
47
- {
48
- icon: u,
49
- style: {
50
- fontSize: "14px"
51
- }
52
- }
53
- )
54
- }
55
- )
56
- ]
57
- }
58
- ),
59
- /* @__PURE__ */ i(
60
- l,
61
- {
62
- variant: "body2",
63
- sx: {
64
- color: "text.secondary",
65
- fontFamily: "Lexend",
66
- fontSize: 13
67
- },
68
- children: [
69
- s,
70
- e ? /* @__PURE__ */ o(
71
- x,
72
- {
73
- title: e,
74
- arrow: !0,
75
- slotProps: {
76
- tooltip: {
77
- sx: {
78
- "&>.MuiTypography-root": {
79
- color: "primary.contrastText",
80
- fontFamily: "Lexend"
81
- }
82
- }
83
- },
84
- popper: {
85
- modifiers: [
86
- {
87
- name: "offset",
88
- options: {
89
- offset: [0, -8]
90
- }
91
- }
92
- ]
93
- }
94
- },
95
- children: /* @__PURE__ */ o(
96
- n,
97
- {
98
- component: r,
99
- icon: y,
100
- sx: {
101
- fontSize: 14,
102
- display: "inline-block",
103
- verticalAlign: "middle",
104
- ml: 0.5,
105
- cursor: "pointer",
106
- transform: "translateY(-1px)"
107
- }
108
- }
109
- )
110
- }
111
- ) : null
112
- ]
113
- }
114
- )
115
- ]
116
- }
117
- );
118
- }
119
- S.propTypes = {
120
- title: t.string.isRequired,
121
- description: t.string.isRequired,
122
- extraContent: t.any,
123
- disableSwitchApp: t.bool
124
- };
125
- export {
126
- S as default
127
- };
@@ -1,52 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Tooltip as l, Box as a } from "@mui/material";
3
- import { useCreation as p } from "ahooks";
4
- import { mergeSx as s } from "@arcblock/ux/lib/Util/style";
5
- import { useStateContext as d } from "../contexts/state.js";
6
- function x({ ...o }) {
7
- const { t: r, locale: t } = d(), n = p(() => ["zh", "en"].includes ? `https://www.didwallet.io/${t}` : "https://www.didwallet.io/en", [t]), i = r("downloadTips");
8
- return /* @__PURE__ */ e(
9
- l,
10
- {
11
- title: i,
12
- arrow: !0,
13
- placement: "top",
14
- slotProps: {
15
- popper: {
16
- modifiers: [
17
- {
18
- name: "offset",
19
- options: {
20
- offset: [0, -8]
21
- }
22
- }
23
- ]
24
- }
25
- },
26
- children: /* @__PURE__ */ e(
27
- a,
28
- {
29
- component: "a",
30
- href: n,
31
- target: "_blank",
32
- rel: "noopener",
33
- ...o,
34
- sx: s(
35
- {
36
- color: "primary.main",
37
- textDecoration: "none",
38
- "&:hover": {
39
- textDecoration: "dashed underline"
40
- }
41
- },
42
- o?.sx
43
- ),
44
- children: "DID Wallet"
45
- }
46
- )
47
- }
48
- );
49
- }
50
- export {
51
- x as default
52
- };
@@ -1,26 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Box as n, CircularProgress as t } from "@mui/material";
3
- import i from "prop-types";
4
- function s({ size: r = 92.5, loadingSize: o = 30 }) {
5
- return /* @__PURE__ */ e(
6
- n,
7
- {
8
- sx: {
9
- height: "100%",
10
- minWidth: r,
11
- minHeight: r,
12
- display: "flex",
13
- justifyContent: "center",
14
- alignItems: "center"
15
- },
16
- children: /* @__PURE__ */ e(t, { size: o, sx: { color: "secondary.main" } })
17
- }
18
- );
19
- }
20
- s.propTypes = {
21
- size: i.number,
22
- loadingSize: i.number
23
- };
24
- export {
25
- s as default
26
- };