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