@arcblock/did-connect-react 3.3.3 → 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.
@@ -1,160 +1,162 @@
1
- import { jsx as t, jsxs as p, Fragment as Le } from "react/jsx-runtime";
2
- import { use as Be, useRef as re, useState as Fe, useEffect as ne } from "react";
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 Ne, Divider as je } from "@mui/material";
5
- import { useUpdate as He, useSize as Ve, useCreation as d, useMount as ie, useMemoizedFn as U, useDebounceFn as qe, usePrevious as Ye, useUpdateEffect as Ge } from "ahooks";
6
- import b from "lodash/noop";
7
- import Ke from "lodash/isUndefined";
8
- import Qe from "@arcblock/ux/lib/CloseButton";
9
- import { LOGIN_PROVIDER as Xe, OAUTH_PROVIDER as M, DID_CONNECT_MEDIUM_WIDTH as z, LOGIN_PROVIDER_NAME as Je, DID_CONNECT_SMALL_WIDTH as Ze } from "@arcblock/ux/lib/Util/constant";
10
- import $e from "@arcblock/ux/lib/QRCode";
11
- import { withUxTheme as et, withContainer as tt, DIDConnectFooter as ot } from "@arcblock/ux/lib/DIDConnect";
12
- import { useTheme as rt } from "@arcblock/ux/lib/Theme";
13
- import nt from "@arcblock/ux/lib/DIDConnect/provider-icon";
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 it from "./with-blocklet.js";
17
- import st from "./with-bridge-call.js";
18
- import { default as co } from "./hooks/security.js";
19
- import { SessionContext as ct } from "../Session/context.js";
20
- import { StateProvider as at, useStateContext as lt } from "./contexts/state.js";
21
- import ut from "./components/login-item/connect-provider-list.js";
22
- import dt from "./components/auto-height.js";
23
- import ft from "./hooks/token.js";
24
- import { useOAuth as mt } from "../OAuth/context.js";
25
- import pt from "./components/connect-status.js";
26
- import { usePasskey as ht } from "../Passkey/context.js";
27
- import { CHECK_STATUS_INTERVAL as xt, API_DID_PREFIX as bt, BUSY_STATUS as k, DEFAULT_TIMEOUT as gt } from "../constant.js";
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 Ct from "./components/did-connect-title.js";
30
- import yt from "./components/download-tips.js";
31
- import kt from "./hooks/provider-list.js";
32
- import wt from "./hooks/auth-url.js";
33
- import { getWalletDid as St } from "../User/use-did.js";
34
- import { getWebWalletUrl as It } from "@arcblock/ux/lib/Util/wallet";
35
- function se({
36
- hideCloseButton: g = !1,
37
- mode: f = "dialog",
38
- action: w,
39
- baseUrl: h = "",
40
- checkFn: S,
41
- checkInterval: I = xt,
42
- checkTimeout: v = gt * 1e3,
43
- prefix: D = bt,
44
- tokenKey: L = "_t_",
45
- locale: B = "en",
46
- encKey: ae = "_ek_",
47
- autoConnect: le = !0,
48
- forceConnected: F = !0,
49
- saveConnect: ue = !0,
50
- useSocket: de = !0,
51
- allowWallet: N = !0,
52
- provider: fe = "",
53
- messages: u = {},
54
- passkeyBehavior: j = "none",
55
- webWalletUrl: me = It(),
56
- enabledConnectTypes: pe = ["web", "mobile", ...Object.keys(M)],
57
- extraContent: H = null,
58
- disableSwitchApp: T = !1,
59
- magicToken: V = void 0,
60
- customItems: he = [],
61
- onClose: P = b,
62
- onError: q = b,
63
- onSuccess: _ = b,
64
- onRecreateSession: Y = b,
65
- setColor: xe = b
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 R = rt(), G = He(), be = Be(ct), ge = St(be?.session?.user), {
68
- t: K,
69
- staticState: Ce,
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: ye,
72
- currentAppInfo: ke,
73
- currentAppColor: O,
71
+ extraParams: De,
72
+ currentAppInfo: Te,
73
+ currentAppColor: W,
74
74
  // 插件相关
75
75
  selectedPlugin: c,
76
- blocklet: Q,
77
- masterBlocklet: we
78
- } = lt(), { state: o, generate: X, cancelWhenScanned: Se } = ft({
79
- action: w,
80
- baseUrl: h,
81
- checkFn: S,
82
- checkInterval: I,
83
- checkTimeout: v,
84
- extraParams: ye,
85
- prefix: D,
86
- onError: q,
87
- onSuccess: _,
88
- locale: B,
89
- tokenKey: L,
90
- encKey: ae,
91
- autoConnect: le,
92
- forceConnected: F === !0 ? ge || !0 : F,
93
- saveConnect: ue,
94
- useSocket: de,
95
- provider: fe
96
- }), A = re(!1), J = re(null), x = Ve(J), Z = d(() => x ? x.width < z - 50 : !0, [x, x?.width]), [$, Ie] = Fe(!1);
97
- ie(() => {
98
- Ie(x?.width < z - 50);
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: ve } = mt(), { passkeyState: l, setTargetAppPid: De } = ht();
101
- ie(() => {
102
- ve(h), De(Q?.appPid), o.reset(), a.reset(), l.reset();
103
- }), ne(() => {
104
- xe(O);
105
- }, [O]);
106
- const Te = d(() => ({
107
- confirm: u.confirm,
108
- success: u.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
- u.confirm,
112
- u.success,
113
+ d.confirm,
114
+ d.success,
113
115
  o.error,
114
116
  a.error,
115
117
  l.error,
116
118
  c?.state?.error
117
- ]), C = d(() => 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]), ee = U(async () => {
118
- Y(), a.reset(), l.reset(), await X(!1);
119
- }), Pe = U(() => {
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
- }), _e = U(() => {
122
- Y(), a.reset(), l.reset(), c?.state?.reset(), Ce.current.cancelCount++, Se();
123
- }), { run: Re } = qe(
123
+ }), Ue = L(() => {
124
+ X(), a.reset(), l.reset(), c?.state?.reset(), ve.current.cancelCount++, Oe();
125
+ }), { run: Me } = Xe(
124
126
  () => {
125
- A.current || o.status === "timeout" && (A.current = !0, o.reset(), ee(), A.current = !1);
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
- ne(Re, [o.status]);
130
- const Oe = d(() => Je[s.chooseMethod] || "DID Wallet", [s.chooseMethod]), { providerList: Ae, hideQRCode: m, hideChooseList: n } = kt({
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: N,
134
- passkeyBehavior: j,
135
- mode: f,
136
- blocklet: s?.sourceAppPid ? we : Q,
137
- isSmallView: Z
138
- }), We = Ye(s?.sourceAppPid);
139
- Ge(() => {
140
- Ke(We) || X();
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 r = (y) => {
143
- const Me = R.spacing(y);
144
- return parseInt(Me, 10);
145
- }, Ee = d(() => g ? null : /* @__PURE__ */ t(
146
- Qe,
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: P,
150
+ onClose: O,
149
151
  sx: {
150
152
  position: "absolute",
151
153
  right: 14,
152
154
  top: 14
153
155
  }
154
156
  }
155
- ), [g, P]);
156
- let te = null;
157
- C && (te = /* @__PURE__ */ t(
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
- pt,
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: _e,
173
- onRetry: Pe,
174
- onClose: P,
175
- messages: Te,
176
- locale: B,
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(nt, { provider: s.chooseMethod, sx: { color: "text.primary" } }) : null,
179
- chooseMethod: Oe,
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: !!V
183
+ hideBack: !!K
182
184
  }
183
185
  ) })
184
186
  }
185
187
  ));
186
- const oe = wt({ disableSwitchApp: T, tokenState: o }), Ue = d(() => {
187
- const y = R.mode === "dark" ? R.palette.grey[600] : "white";
188
- return /* @__PURE__ */ t(
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: n ? 3 : 2,
193
- width: (n ? 240 : 196) + r(1) * 2,
194
- height: (n ? 240 : 196) + r(1) * 2
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
- $e,
201
+ nt,
198
202
  {
199
- data: oe,
200
- size: n ? 240 - r(3) * 2 : 196 - r(2) * 2,
203
+ data: se,
204
+ size: h,
201
205
  sx: {
202
- width: (n ? 240 - r(3) * 2 : 196 - r(2) * 2) + r(1) * 2,
203
- height: (n ? 240 - r(3) * 2 : 196 - r(2) * 2) + r(1) * 2,
206
+ width: h + n(1) * 2,
207
+ height: h + n(1) * 2,
204
208
  flex: 1,
205
- backgroundColor: y,
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: y
220
+ color: S
217
221
  }
218
222
  }
219
223
  }
220
224
  ) : /* @__PURE__ */ t(
221
- Ne,
225
+ Ye,
222
226
  {
223
227
  animation: "wave",
224
228
  variant: "rectangular",
225
229
  sx: {
226
230
  position: "absolute",
227
- left: r(2) + 1,
228
- right: r(2) + 1,
229
- top: r(2) + 1,
230
- bottom: r(2) + 1,
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
- }, [oe, n]), ze = d(() => n ? "column-reverse" : !m && $ ? "column" : "row", [n, $, m]), W = /* @__PURE__ */ p(
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: ze,
310
+ flexDirection: je,
247
311
  justifyContent: "center",
248
312
  alignItems: "stretch",
249
313
  flex: 1,
250
- gap: !m && Z ? 0 : 1.5,
314
+ gap: !p && oe ? 0 : 1.5,
251
315
  overflow: "visible",
252
- px: n ? 2 : 0
316
+ px: r ? 2 : 0
253
317
  },
254
318
  children: [
255
- !C && !m ? /* @__PURE__ */ p(Le, { children: [
256
- /* @__PURE__ */ t(
257
- i,
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__ */ p(
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
- te,
344
+ ie,
328
345
  /* @__PURE__ */ t(
329
- ut,
346
+ ht,
330
347
  {
331
348
  slotProps: {
332
349
  root: {
333
- sx: [C ? { display: "none" } : {}]
350
+ sx: [y ? { display: "none" } : {}]
334
351
  }
335
352
  },
336
- allowWallet: N,
337
- size: m && f !== "dialog" ? "normal" : "small",
353
+ allowWallet: V,
354
+ size: p && m !== "dialog" ? "normal" : "small",
338
355
  tokenState: o,
339
- messages: u,
340
- tokenKey: L,
341
- onSuccess: _,
342
- passkeyBehavior: j,
343
- webWalletUrl: me,
344
- extraContent: H,
345
- enabledConnectTypes: pe,
346
- onReset: ee,
347
- disableSwitchApp: T,
348
- forceUpdate: G,
349
- magicToken: V,
350
- baseUrl: h,
351
- customItems: he,
352
- providerList: Ae
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 E = W;
362
- return c ? E = c.renderPlaceholder({
363
- fallback: W,
364
- forceUpdate: G,
365
- onSuccess: _,
366
- onError: q
367
- }) : E = W, /* @__PURE__ */ p(
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: J,
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
- f === "drawer" ? "100%" : m || C ? Ze : z
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
- Ct,
412
+ It,
393
413
  {
394
- title: u.title,
395
- description: u.scan,
396
- extraContent: H,
397
- disableSwitchApp: T
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(dt, { initHeight: 72, children: E }),
401
- /* @__PURE__ */ t(ot, { currentAppInfo: ke, currentAppColor: O }),
402
- Ee
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
- se.propTypes = {
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(M)])),
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([Xe.WALLET, ...Object.keys(M), ""]),
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 ce({ testOnlyBorderColor: g = void 0, ...f }) {
441
- const { checkFn: w, extraParams: h = {}, blocklet: S, masterBlocklet: I, action: v, locale: D = "en" } = f;
442
- if (typeof w != "function")
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
- at,
467
+ mt,
446
468
  {
447
- blocklet: S,
448
- masterBlocklet: I,
449
- action: v,
450
- locale: D,
451
- extraParams: h,
452
- testOnlyBorderColor: g,
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(se, { ...f })
487
+ children: /* @__PURE__ */ t(fe, { ...m })
466
488
  }
467
489
  );
468
490
  }
469
- ce.propTypes = {
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 no = et(st(it(tt(ce))));
500
+ const lo = it(dt(ut(st(me))));
479
501
  export {
480
- no as default,
481
- co as useSecurity
502
+ lo as default,
503
+ mo as useSecurity
482
504
  };