@arcblock/did-connect-react 3.3.10 → 3.4.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.
- package/lib/Connect/assets/locale.js +4 -2
- package/lib/Connect/components/login-item/connect-choose-list.js +120 -114
- package/lib/Connect/components/login-item/connect-provider-list.js +187 -180
- package/lib/Connect/components/login-item/login-method-item.js +63 -47
- package/lib/Connect/components/login-item/passkey-login-item.js +17 -15
- package/lib/Connect/components/login-item/wallet-login-options.js +42 -40
- package/lib/Connect/connect.js +503 -0
- package/lib/Connect/contexts/state.js +74 -65
- package/lib/Connect/fallback-connect.js +53 -0
- package/lib/Connect/hooks/provider-list.js +45 -29
- package/lib/Connect/index.js +13 -502
- package/lib/Connect/plugins/email/list-item.js +19 -18
- package/lib/Connect/use-connect.js +10 -10
- package/lib/OAuth/context.js +3 -3
- package/lib/Passkey/actions.js +80 -75
- package/lib/Passkey/context.js +3 -3
- package/lib/Passkey/dialog.js +7 -7
- package/lib/Session/assets/did-spaces-guide-cover.svg.js +74 -98
- package/lib/Session/index.js +189 -189
- package/lib/package.json.js +1 -1
- package/lib/utils.js +2 -2
- package/package.json +8 -8
- package/src/Connect/assets/locale.js +2 -0
- package/src/Connect/components/login-item/connect-choose-list.jsx +12 -5
- package/src/Connect/components/login-item/connect-provider-list.jsx +11 -4
- package/src/Connect/components/login-item/login-method-item.jsx +24 -7
- package/src/Connect/components/login-item/passkey-login-item.jsx +3 -1
- package/src/Connect/components/login-item/wallet-login-options.jsx +3 -2
- package/src/Connect/connect.jsx +618 -0
- package/src/Connect/contexts/state.jsx +10 -0
- package/src/Connect/fallback-connect.jsx +47 -0
- package/src/Connect/hooks/provider-list.js +48 -17
- package/src/Connect/index.jsx +8 -605
- package/src/Connect/plugins/email/list-item.jsx +3 -2
- package/src/Connect/use-connect.jsx +1 -1
- package/src/Passkey/actions.jsx +5 -0
- package/src/Session/assets/did-spaces-guide-cover.svg +1 -128
- package/src/Session/index.jsx +3 -4
- package/src/utils.js +2 -2
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { jsx as t, jsxs as b, Fragment as He } from "react/jsx-runtime";
|
|
2
|
+
import { use as Ve, useRef as le, useState as Ye, useEffect as ue } from "react";
|
|
3
|
+
import e from "prop-types";
|
|
4
|
+
import { Box as i, Skeleton as Ge, Divider as Ke } from "@mui/material";
|
|
5
|
+
import { useUpdate as Qe, useSize as Xe, useCreation as u, useMount as de, useMemoizedFn as F, useDebounceFn as Je, usePrevious as Ze, useUpdateEffect as $e } from "ahooks";
|
|
6
|
+
import C from "lodash/noop";
|
|
7
|
+
import et from "lodash/isUndefined";
|
|
8
|
+
import tt from "@arcblock/ux/lib/CloseButton";
|
|
9
|
+
import { DID_CONNECT_MEDIUM_WIDTH as N, LOGIN_PROVIDER_NAME as ot, DID_CONNECT_SMALL_WIDTH as rt, OAUTH_PROVIDER as j, LOGIN_PROVIDER as nt } from "@arcblock/ux/lib/Util/constant";
|
|
10
|
+
import it from "@arcblock/ux/lib/QRCode";
|
|
11
|
+
import { DIDConnectFooter as st } from "@arcblock/ux/lib/DIDConnect";
|
|
12
|
+
import { useTheme as at } from "@arcblock/ux/lib/Theme";
|
|
13
|
+
import ct from "@arcblock/ux/lib/DIDConnect/provider-icon";
|
|
14
|
+
import "@fontsource/lexend/400.css";
|
|
15
|
+
import "@fontsource/lexend/600.css";
|
|
16
|
+
import { SessionContext as lt } from "../Session/context.js";
|
|
17
|
+
import { StateProvider as ut, useStateContext as dt } from "./contexts/state.js";
|
|
18
|
+
import ft from "./components/login-item/connect-provider-list.js";
|
|
19
|
+
import mt from "./components/auto-height.js";
|
|
20
|
+
import pt from "./hooks/token.js";
|
|
21
|
+
import { useOAuth as ht } from "../OAuth/context.js";
|
|
22
|
+
import bt from "./components/connect-status.js";
|
|
23
|
+
import { usePasskey as gt } from "../Passkey/context.js";
|
|
24
|
+
import { CHECK_STATUS_INTERVAL as xt, API_DID_PREFIX as Ct, BUSY_STATUS as w, DEFAULT_TIMEOUT as yt } from "../constant.js";
|
|
25
|
+
import "../utils.js";
|
|
26
|
+
import St from "./components/did-connect-title.js";
|
|
27
|
+
import kt from "./components/download-tips.js";
|
|
28
|
+
import wt from "./hooks/provider-list.js";
|
|
29
|
+
import It from "./hooks/auth-url.js";
|
|
30
|
+
import { getWalletDid as vt } from "../User/use-did.js";
|
|
31
|
+
import Pt from "./fallback-connect.js";
|
|
32
|
+
import { getWebWalletUrl as _t } from "@arcblock/ux/lib/Util/wallet";
|
|
33
|
+
function fe({
|
|
34
|
+
hideCloseButton: y = !1,
|
|
35
|
+
mode: p = "dialog",
|
|
36
|
+
action: I,
|
|
37
|
+
baseUrl: g = "",
|
|
38
|
+
checkFn: v,
|
|
39
|
+
checkInterval: P = xt,
|
|
40
|
+
checkTimeout: _ = yt * 1e3,
|
|
41
|
+
prefix: D = Ct,
|
|
42
|
+
tokenKey: B = "_t_",
|
|
43
|
+
locale: q = "en",
|
|
44
|
+
encKey: me = "_ek_",
|
|
45
|
+
autoConnect: pe = !0,
|
|
46
|
+
forceConnected: H = !0,
|
|
47
|
+
saveConnect: he = !0,
|
|
48
|
+
useSocket: be = !0,
|
|
49
|
+
allowWallet: V = !0,
|
|
50
|
+
provider: ge = "",
|
|
51
|
+
messages: d = {},
|
|
52
|
+
passkeyBehavior: Y = "none",
|
|
53
|
+
webWalletUrl: xe = _t(),
|
|
54
|
+
enabledConnectTypes: Ce = ["web", "mobile", ...Object.keys(j)],
|
|
55
|
+
extraContent: G = null,
|
|
56
|
+
disableSwitchApp: T = !1,
|
|
57
|
+
magicToken: K = void 0,
|
|
58
|
+
customItems: ye = [],
|
|
59
|
+
onClose: O = C,
|
|
60
|
+
onError: Q = C,
|
|
61
|
+
onSuccess: R = C,
|
|
62
|
+
onRecreateSession: X = C,
|
|
63
|
+
setColor: Se = C
|
|
64
|
+
}) {
|
|
65
|
+
const A = at(), J = Qe(), ke = Ve(lt), we = vt(ke?.session?.user), {
|
|
66
|
+
t: Z,
|
|
67
|
+
staticState: Ie,
|
|
68
|
+
connectState: s,
|
|
69
|
+
extraParams: ve,
|
|
70
|
+
currentAppInfo: Pe,
|
|
71
|
+
currentAppColor: W,
|
|
72
|
+
// 插件相关
|
|
73
|
+
selectedPlugin: a,
|
|
74
|
+
blocklet: $,
|
|
75
|
+
masterBlocklet: _e,
|
|
76
|
+
showWalletOptions: f,
|
|
77
|
+
setShowWalletOptions: De,
|
|
78
|
+
lastLoginMethod: Te
|
|
79
|
+
} = dt(), { state: o, generate: ee, cancelWhenScanned: Oe } = pt({
|
|
80
|
+
action: I,
|
|
81
|
+
baseUrl: g,
|
|
82
|
+
checkFn: v,
|
|
83
|
+
checkInterval: P,
|
|
84
|
+
checkTimeout: _,
|
|
85
|
+
extraParams: ve,
|
|
86
|
+
prefix: D,
|
|
87
|
+
onError: Q,
|
|
88
|
+
onSuccess: R,
|
|
89
|
+
locale: q,
|
|
90
|
+
tokenKey: B,
|
|
91
|
+
encKey: me,
|
|
92
|
+
autoConnect: pe,
|
|
93
|
+
forceConnected: H === !0 ? we || !0 : H,
|
|
94
|
+
saveConnect: he,
|
|
95
|
+
useSocket: be,
|
|
96
|
+
provider: ge
|
|
97
|
+
}), z = le(!1), te = le(null), x = Xe(te), oe = u(() => x ? x.width < N - 50 : !0, [x, x?.width]), [re, Re] = Ye(!1);
|
|
98
|
+
de(() => {
|
|
99
|
+
Re(x?.width < N - 50);
|
|
100
|
+
});
|
|
101
|
+
const { oauthState: c, setBaseUrl: Ae } = ht(), { passkeyState: l, setTargetAppPid: We } = gt();
|
|
102
|
+
de(() => {
|
|
103
|
+
Ae(g), We($?.appPid), o.reset(), c.reset(), l.reset();
|
|
104
|
+
}), ue(() => {
|
|
105
|
+
Se(W);
|
|
106
|
+
}, [W]);
|
|
107
|
+
const ze = u(() => ({
|
|
108
|
+
confirm: d.confirm,
|
|
109
|
+
success: d.success,
|
|
110
|
+
error: a?.state?.error || o.error || l.error || c.error || ""
|
|
111
|
+
}), [
|
|
112
|
+
d.confirm,
|
|
113
|
+
d.success,
|
|
114
|
+
o.error,
|
|
115
|
+
c.error,
|
|
116
|
+
l.error,
|
|
117
|
+
a?.state?.error
|
|
118
|
+
]), S = u(() => w.includes(l.status) || w.includes(c.status) || w.includes(o.status) || w.includes(a?.state?.computedStatus), [o.status, c.status, l.status, a?.state?.computedStatus]), ne = F(async () => {
|
|
119
|
+
X(), c.reset(), l.reset(), await ee(!1);
|
|
120
|
+
}), Ee = F(() => {
|
|
121
|
+
s?.retryConnect();
|
|
122
|
+
}), Le = F(() => {
|
|
123
|
+
X(), c.reset(), l.reset(), a?.state?.reset(), Ie.current.cancelCount++, Oe();
|
|
124
|
+
}), { run: Me } = Je(
|
|
125
|
+
() => {
|
|
126
|
+
z.current || o.status === "timeout" && (z.current = !0, o.reset(), ne(), z.current = !1);
|
|
127
|
+
},
|
|
128
|
+
{ leading: !0, trailing: !1 }
|
|
129
|
+
);
|
|
130
|
+
ue(Me, [o.status]);
|
|
131
|
+
const Ue = u(() => ot[s.chooseMethod] || "DID Wallet", [s.chooseMethod]), { providerList: Fe, hideQRCode: m, hideChooseList: r, loadingProviderList: Ne } = wt({
|
|
132
|
+
action: o.action,
|
|
133
|
+
sourceAppPid: s?.sourceAppPid,
|
|
134
|
+
allowWallet: V,
|
|
135
|
+
passkeyBehavior: Y,
|
|
136
|
+
mode: p,
|
|
137
|
+
blocklet: s?.sourceAppPid ? _e : $,
|
|
138
|
+
isSmallView: oe,
|
|
139
|
+
lastLoginMethod: Te
|
|
140
|
+
}), je = Ze(s?.sourceAppPid);
|
|
141
|
+
$e(() => {
|
|
142
|
+
et(je) || ee();
|
|
143
|
+
}, [s?.sourceAppPid]);
|
|
144
|
+
const n = (k) => {
|
|
145
|
+
const h = A.spacing(k);
|
|
146
|
+
return parseInt(h, 10);
|
|
147
|
+
}, Be = u(() => y ? null : /* @__PURE__ */ t(
|
|
148
|
+
tt,
|
|
149
|
+
{
|
|
150
|
+
onClose: O,
|
|
151
|
+
sx: {
|
|
152
|
+
position: "absolute",
|
|
153
|
+
right: 14,
|
|
154
|
+
top: 14
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
), [y, O]);
|
|
158
|
+
let ie = null;
|
|
159
|
+
S && (ie = /* @__PURE__ */ t(
|
|
160
|
+
i,
|
|
161
|
+
{
|
|
162
|
+
sx: {
|
|
163
|
+
flex: 1,
|
|
164
|
+
display: "flex",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
justifyContent: "center"
|
|
167
|
+
},
|
|
168
|
+
children: /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(
|
|
169
|
+
bt,
|
|
170
|
+
{
|
|
171
|
+
status: a?.state?.computedStatus || c.status || l.status || o.status,
|
|
172
|
+
nextWorkflow: o.nextWorkflow,
|
|
173
|
+
mfaCode: o.mfaCode,
|
|
174
|
+
onCancel: Le,
|
|
175
|
+
onRetry: Ee,
|
|
176
|
+
onClose: O,
|
|
177
|
+
messages: ze,
|
|
178
|
+
locale: q,
|
|
179
|
+
className: "did-connect__auth-status auth-status",
|
|
180
|
+
loadingIcon: s.chooseMethod ? /* @__PURE__ */ t(ct, { provider: s.chooseMethod, sx: { color: "text.primary" } }) : null,
|
|
181
|
+
chooseMethod: Ue,
|
|
182
|
+
hideRetry: s.chooseMethod === "email",
|
|
183
|
+
hideBack: !!K
|
|
184
|
+
}
|
|
185
|
+
) })
|
|
186
|
+
}
|
|
187
|
+
));
|
|
188
|
+
const se = It({ disableSwitchApp: T, tokenState: o }), E = u(() => {
|
|
189
|
+
const k = A.mode === "dark" ? A.palette.grey[600] : "white";
|
|
190
|
+
let h = r ? 240 - n(3) * 2 : 196 - n(2) * 2, U = r ? 3 : 2;
|
|
191
|
+
return f && (U = 1, h += n(U) * 2), /* @__PURE__ */ t(
|
|
192
|
+
i,
|
|
193
|
+
{
|
|
194
|
+
className: "did-connect__qrcode",
|
|
195
|
+
sx: {
|
|
196
|
+
p: U,
|
|
197
|
+
width: (r ? 240 : 196) + n(1) * 2,
|
|
198
|
+
height: (r ? 240 : 196) + n(1) * 2
|
|
199
|
+
},
|
|
200
|
+
children: o.url ? /* @__PURE__ */ t(
|
|
201
|
+
it,
|
|
202
|
+
{
|
|
203
|
+
data: se,
|
|
204
|
+
size: h,
|
|
205
|
+
sx: {
|
|
206
|
+
width: h + n(1) * 2,
|
|
207
|
+
height: h + n(1) * 2,
|
|
208
|
+
flex: 1,
|
|
209
|
+
backgroundColor: k,
|
|
210
|
+
p: 1,
|
|
211
|
+
fontSize: 0,
|
|
212
|
+
textAlign: "center",
|
|
213
|
+
boxSizing: "border-box",
|
|
214
|
+
borderRadius: 1,
|
|
215
|
+
border: "1px solid",
|
|
216
|
+
borderColor: "divider"
|
|
217
|
+
},
|
|
218
|
+
config: {
|
|
219
|
+
backgroundOptions: {
|
|
220
|
+
color: k
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
) : /* @__PURE__ */ t(
|
|
225
|
+
Ge,
|
|
226
|
+
{
|
|
227
|
+
animation: "wave",
|
|
228
|
+
variant: "rectangular",
|
|
229
|
+
sx: {
|
|
230
|
+
position: "absolute",
|
|
231
|
+
left: n(2) + 1,
|
|
232
|
+
right: n(2) + 1,
|
|
233
|
+
top: n(2) + 1,
|
|
234
|
+
bottom: n(2) + 1,
|
|
235
|
+
borderRadius: 1,
|
|
236
|
+
zIndex: 1,
|
|
237
|
+
width: "auto",
|
|
238
|
+
height: "auto"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}, [se, r, f]), qe = u(() => r ? "column-reverse" : !m && re ? "column" : "row", [r, re, m]), ae = u(() => E ? /* @__PURE__ */ t(
|
|
245
|
+
i,
|
|
246
|
+
{
|
|
247
|
+
sx: {
|
|
248
|
+
display: "flex",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
overflowX: "auto",
|
|
251
|
+
overflowY: "visible",
|
|
252
|
+
maxWidth: "100%",
|
|
253
|
+
margin: "auto"
|
|
254
|
+
},
|
|
255
|
+
children: /* @__PURE__ */ b(
|
|
256
|
+
i,
|
|
257
|
+
{
|
|
258
|
+
sx: {
|
|
259
|
+
fontSize: 0,
|
|
260
|
+
position: "relative",
|
|
261
|
+
...f ? {
|
|
262
|
+
mt: r ? 4 : 2.5,
|
|
263
|
+
mb: 0
|
|
264
|
+
} : {
|
|
265
|
+
mb: r ? 4 : 2.5,
|
|
266
|
+
mt: 0
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
children: [
|
|
270
|
+
E,
|
|
271
|
+
/* @__PURE__ */ b(
|
|
272
|
+
i,
|
|
273
|
+
{
|
|
274
|
+
sx: {
|
|
275
|
+
position: "absolute",
|
|
276
|
+
color: "text.secondary",
|
|
277
|
+
fontSize: 12,
|
|
278
|
+
zIndex: 1,
|
|
279
|
+
whiteSpace: "nowrap",
|
|
280
|
+
...f ? {
|
|
281
|
+
top: r ? -8 : -4,
|
|
282
|
+
transform: "translateY(-100%)"
|
|
283
|
+
} : {
|
|
284
|
+
bottom: r ? -8 : -4,
|
|
285
|
+
transform: "translateY(100%)"
|
|
286
|
+
},
|
|
287
|
+
left: 0,
|
|
288
|
+
right: 0,
|
|
289
|
+
textAlign: "center"
|
|
290
|
+
},
|
|
291
|
+
children: [
|
|
292
|
+
Z("scanWithWallet1"),
|
|
293
|
+
" ",
|
|
294
|
+
/* @__PURE__ */ t(kt, {}),
|
|
295
|
+
" ",
|
|
296
|
+
Z("scanWithWallet2")
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
) : null, [E, r, f]), L = /* @__PURE__ */ b(
|
|
305
|
+
i,
|
|
306
|
+
{
|
|
307
|
+
className: "did-connect__body",
|
|
308
|
+
sx: {
|
|
309
|
+
display: "flex",
|
|
310
|
+
flexDirection: qe,
|
|
311
|
+
justifyContent: "center",
|
|
312
|
+
alignItems: "stretch",
|
|
313
|
+
flex: 1,
|
|
314
|
+
gap: !m && oe ? 0 : 1.5,
|
|
315
|
+
overflow: "visible",
|
|
316
|
+
px: r ? 2 : 0
|
|
317
|
+
},
|
|
318
|
+
children: [
|
|
319
|
+
!S && !m ? /* @__PURE__ */ b(He, { children: [
|
|
320
|
+
ae,
|
|
321
|
+
r ? null : /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(
|
|
322
|
+
Ke,
|
|
323
|
+
{
|
|
324
|
+
orientation: "vertical",
|
|
325
|
+
sx: {
|
|
326
|
+
fontSize: 12,
|
|
327
|
+
color: "text.hint",
|
|
328
|
+
"&::before, &::after": {
|
|
329
|
+
borderColor: "divider"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
children: "or"
|
|
333
|
+
}
|
|
334
|
+
) })
|
|
335
|
+
] }) : null,
|
|
336
|
+
/* @__PURE__ */ b(
|
|
337
|
+
i,
|
|
338
|
+
{
|
|
339
|
+
sx: {
|
|
340
|
+
display: "flex",
|
|
341
|
+
flex: 1
|
|
342
|
+
},
|
|
343
|
+
children: [
|
|
344
|
+
ie,
|
|
345
|
+
/* @__PURE__ */ t(
|
|
346
|
+
ft,
|
|
347
|
+
{
|
|
348
|
+
slotProps: {
|
|
349
|
+
root: {
|
|
350
|
+
sx: [S ? { display: "none" } : {}]
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
allowWallet: V,
|
|
354
|
+
size: m && p !== "dialog" ? "normal" : "small",
|
|
355
|
+
tokenState: o,
|
|
356
|
+
hideQRCode: m,
|
|
357
|
+
messages: d,
|
|
358
|
+
tokenKey: B,
|
|
359
|
+
onSuccess: R,
|
|
360
|
+
passkeyBehavior: Y,
|
|
361
|
+
webWalletUrl: xe,
|
|
362
|
+
extraContent: G,
|
|
363
|
+
enabledConnectTypes: Ce,
|
|
364
|
+
onReset: ne,
|
|
365
|
+
disableSwitchApp: T,
|
|
366
|
+
forceUpdate: J,
|
|
367
|
+
magicToken: K,
|
|
368
|
+
baseUrl: g,
|
|
369
|
+
customItems: ye,
|
|
370
|
+
providerList: Fe,
|
|
371
|
+
qrcode: ae
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
let M = L;
|
|
381
|
+
a ? M = a.renderPlaceholder({
|
|
382
|
+
fallback: L,
|
|
383
|
+
forceUpdate: J,
|
|
384
|
+
onSuccess: R,
|
|
385
|
+
onError: Q
|
|
386
|
+
}) : M = L;
|
|
387
|
+
const ce = m || S ? rt : N;
|
|
388
|
+
return Ne ? /* @__PURE__ */ t(Pt, {}) : /* @__PURE__ */ b(
|
|
389
|
+
i,
|
|
390
|
+
{
|
|
391
|
+
ref: te,
|
|
392
|
+
className: "did-connect__root",
|
|
393
|
+
sx: {
|
|
394
|
+
backgroundColor: "background.default",
|
|
395
|
+
display: "flex",
|
|
396
|
+
flexDirection: "column",
|
|
397
|
+
height: "100%",
|
|
398
|
+
position: "relative",
|
|
399
|
+
maxWidth: "100%",
|
|
400
|
+
width: (
|
|
401
|
+
// eslint-disable-next-line no-nested-ternary
|
|
402
|
+
p === "drawer" ? "100%" : f ? ce - 20 : ce
|
|
403
|
+
),
|
|
404
|
+
transition: "width 0.2s ease-in-out",
|
|
405
|
+
margin: "auto",
|
|
406
|
+
p: 3,
|
|
407
|
+
pb: 0,
|
|
408
|
+
gap: 2.5
|
|
409
|
+
},
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ t(i, { "data-did-auth-url": o.url, sx: { display: "none" } }),
|
|
412
|
+
/* @__PURE__ */ t(
|
|
413
|
+
St,
|
|
414
|
+
{
|
|
415
|
+
title: d.title,
|
|
416
|
+
description: d.scan,
|
|
417
|
+
extraContent: G,
|
|
418
|
+
disableSwitchApp: T,
|
|
419
|
+
showWalletOptions: f,
|
|
420
|
+
onBack: () => De(!1)
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
/* @__PURE__ */ t(mt, { initHeight: 72, children: M }),
|
|
424
|
+
/* @__PURE__ */ t(st, { currentAppInfo: Pe, currentAppColor: W }),
|
|
425
|
+
Be
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
fe.propTypes = {
|
|
431
|
+
mode: e.oneOf(["dialog", "drawer", "page"]),
|
|
432
|
+
action: e.string.isRequired,
|
|
433
|
+
baseUrl: e.string,
|
|
434
|
+
checkFn: e.func.isRequired,
|
|
435
|
+
checkInterval: e.number,
|
|
436
|
+
checkTimeout: e.number,
|
|
437
|
+
// extraParams: PropTypes.object, // 需要使用 useStateContext 中导出的
|
|
438
|
+
prefix: e.string,
|
|
439
|
+
messages: e.object,
|
|
440
|
+
tokenKey: e.string,
|
|
441
|
+
locale: e.oneOf(["en", "zh", ""]),
|
|
442
|
+
encKey: e.string,
|
|
443
|
+
autoConnect: e.bool,
|
|
444
|
+
forceConnected: e.oneOfType([e.bool, e.string]),
|
|
445
|
+
saveConnect: e.bool,
|
|
446
|
+
useSocket: e.bool,
|
|
447
|
+
extraContent: e.any,
|
|
448
|
+
passkeyBehavior: e.oneOf(["none", "both", "only-existing", "only-new"]),
|
|
449
|
+
enabledConnectTypes: e.arrayOf(e.oneOf(["web", "mobile", ...Object.keys(j)])),
|
|
450
|
+
webWalletUrl: e.string,
|
|
451
|
+
allowWallet: e.bool,
|
|
452
|
+
provider: e.oneOf([nt.WALLET, ...Object.keys(j), ""]),
|
|
453
|
+
hideCloseButton: e.bool,
|
|
454
|
+
disableSwitchApp: e.bool,
|
|
455
|
+
onClose: e.func,
|
|
456
|
+
onError: e.func,
|
|
457
|
+
onSuccess: e.func,
|
|
458
|
+
onRecreateSession: e.func,
|
|
459
|
+
setColor: e.func,
|
|
460
|
+
magicToken: e.string,
|
|
461
|
+
customItems: e.arrayOf(e.node)
|
|
462
|
+
};
|
|
463
|
+
function Dt({ testOnlyBorderColor: y = void 0, ...p }) {
|
|
464
|
+
const { checkFn: I, extraParams: g = {}, blocklet: v, masterBlocklet: P, action: _, locale: D = "en" } = p;
|
|
465
|
+
if (typeof I != "function")
|
|
466
|
+
throw new Error("Cannot initialize did connect component without a fetchFn");
|
|
467
|
+
return /* @__PURE__ */ t(
|
|
468
|
+
ut,
|
|
469
|
+
{
|
|
470
|
+
blocklet: v,
|
|
471
|
+
masterBlocklet: P,
|
|
472
|
+
action: _,
|
|
473
|
+
locale: D,
|
|
474
|
+
extraParams: g,
|
|
475
|
+
testOnlyBorderColor: y,
|
|
476
|
+
sx: {
|
|
477
|
+
position: "relative",
|
|
478
|
+
width: "100%",
|
|
479
|
+
height: "100%",
|
|
480
|
+
lineHeight: 1.2,
|
|
481
|
+
color: "grey.700",
|
|
482
|
+
"&, & *, & *:before, & *:after": {
|
|
483
|
+
fontFamily: "Lexend",
|
|
484
|
+
// 保持跟 DID Wallet 一致
|
|
485
|
+
boxSizing: "border-box"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
children: /* @__PURE__ */ t(fe, { ...p })
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
Dt.propTypes = {
|
|
493
|
+
checkFn: e.func.isRequired,
|
|
494
|
+
extraParams: e.object,
|
|
495
|
+
blocklet: e.object.isRequired,
|
|
496
|
+
masterBlocklet: e.object,
|
|
497
|
+
action: e.string.isRequired,
|
|
498
|
+
locale: e.string,
|
|
499
|
+
testOnlyBorderColor: e.string
|
|
500
|
+
};
|
|
501
|
+
export {
|
|
502
|
+
Dt as default
|
|
503
|
+
};
|