@arcblock/did-connect-react 3.4.0 → 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.
@@ -1,44 +1,44 @@
1
- import { jsx as t, jsxs as b, Fragment as qe } from "react/jsx-runtime";
2
- import { use as He, useRef as le, useState as Ve, useEffect as ue } from "react";
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
3
  import e from "prop-types";
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 F, useDebounceFn as Xe, usePrevious as Je, useUpdateEffect as Ze } from "ahooks";
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
6
  import C from "lodash/noop";
7
- import $e from "lodash/isUndefined";
8
- import et from "@arcblock/ux/lib/CloseButton";
9
- import { DID_CONNECT_MEDIUM_WIDTH as N, LOGIN_PROVIDER_NAME as tt, DID_CONNECT_SMALL_WIDTH as ot, OAUTH_PROVIDER as j, LOGIN_PROVIDER as rt } from "@arcblock/ux/lib/Util/constant";
10
- import nt from "@arcblock/ux/lib/QRCode";
11
- import { DIDConnectFooter as it } from "@arcblock/ux/lib/DIDConnect";
12
- import { useTheme as st } from "@arcblock/ux/lib/Theme";
13
- import at from "@arcblock/ux/lib/DIDConnect/provider-icon";
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
14
  import "@fontsource/lexend/400.css";
15
15
  import "@fontsource/lexend/600.css";
16
- import { SessionContext as ct } from "../Session/context.js";
17
- import { StateProvider as lt, useStateContext as ut } from "./contexts/state.js";
18
- import dt from "./components/login-item/connect-provider-list.js";
19
- import ft from "./components/auto-height.js";
20
- import mt from "./hooks/token.js";
21
- import { useOAuth as pt } from "../OAuth/context.js";
22
- import ht from "./components/connect-status.js";
23
- import { usePasskey as bt } from "../Passkey/context.js";
24
- import { CHECK_STATUS_INTERVAL as gt, API_DID_PREFIX as xt, BUSY_STATUS as w, DEFAULT_TIMEOUT as Ct } from "../constant.js";
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
25
  import "../utils.js";
26
- import yt from "./components/did-connect-title.js";
27
- import St from "./components/download-tips.js";
28
- import kt from "./hooks/provider-list.js";
29
- import wt from "./hooks/auth-url.js";
30
- import { getWalletDid as It } from "../User/use-did.js";
31
- import vt from "./fallback-connect.js";
32
- import { getWebWalletUrl as Pt } from "@arcblock/ux/lib/Util/wallet";
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
33
  function fe({
34
34
  hideCloseButton: y = !1,
35
35
  mode: p = "dialog",
36
36
  action: I,
37
37
  baseUrl: g = "",
38
38
  checkFn: v,
39
- checkInterval: P = gt,
40
- checkTimeout: _ = Ct * 1e3,
41
- prefix: D = xt,
39
+ checkInterval: P = xt,
40
+ checkTimeout: _ = yt * 1e3,
41
+ prefix: D = Ct,
42
42
  tokenKey: B = "_t_",
43
43
  locale: q = "en",
44
44
  encKey: me = "_ek_",
@@ -50,7 +50,7 @@ function fe({
50
50
  provider: ge = "",
51
51
  messages: d = {},
52
52
  passkeyBehavior: Y = "none",
53
- webWalletUrl: xe = Pt(),
53
+ webWalletUrl: xe = _t(),
54
54
  enabledConnectTypes: Ce = ["web", "mobile", ...Object.keys(j)],
55
55
  extraContent: G = null,
56
56
  disableSwitchApp: T = !1,
@@ -62,7 +62,7 @@ function fe({
62
62
  onRecreateSession: X = C,
63
63
  setColor: Se = C
64
64
  }) {
65
- const A = st(), J = Ke(), ke = He(ct), we = It(ke?.session?.user), {
65
+ const A = at(), J = Qe(), ke = Ve(lt), we = vt(ke?.session?.user), {
66
66
  t: Z,
67
67
  staticState: Ie,
68
68
  connectState: s,
@@ -74,8 +74,9 @@ function fe({
74
74
  blocklet: $,
75
75
  masterBlocklet: _e,
76
76
  showWalletOptions: f,
77
- setShowWalletOptions: De
78
- } = ut(), { state: o, generate: ee, cancelWhenScanned: Te } = mt({
77
+ setShowWalletOptions: De,
78
+ lastLoginMethod: Te
79
+ } = dt(), { state: o, generate: ee, cancelWhenScanned: Oe } = pt({
79
80
  action: I,
80
81
  baseUrl: g,
81
82
  checkFn: v,
@@ -93,17 +94,17 @@ function fe({
93
94
  saveConnect: he,
94
95
  useSocket: be,
95
96
  provider: ge
96
- }), z = le(!1), te = le(null), x = Qe(te), oe = u(() => x ? x.width < N - 50 : !0, [x, x?.width]), [re, Oe] = Ve(!1);
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);
97
98
  de(() => {
98
- Oe(x?.width < N - 50);
99
+ Re(x?.width < N - 50);
99
100
  });
100
- const { oauthState: c, setBaseUrl: Re } = pt(), { passkeyState: l, setTargetAppPid: Ae } = bt();
101
+ const { oauthState: c, setBaseUrl: Ae } = ht(), { passkeyState: l, setTargetAppPid: We } = gt();
101
102
  de(() => {
102
- Re(g), Ae($?.appPid), o.reset(), c.reset(), l.reset();
103
+ Ae(g), We($?.appPid), o.reset(), c.reset(), l.reset();
103
104
  }), ue(() => {
104
105
  Se(W);
105
106
  }, [W]);
106
- const We = u(() => ({
107
+ const ze = u(() => ({
107
108
  confirm: d.confirm,
108
109
  success: d.success,
109
110
  error: a?.state?.error || o.error || l.error || c.error || ""
@@ -116,34 +117,35 @@ function fe({
116
117
  a?.state?.error
117
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 () => {
118
119
  X(), c.reset(), l.reset(), await ee(!1);
119
- }), ze = F(() => {
120
- s?.retryConnect();
121
120
  }), Ee = F(() => {
122
- X(), c.reset(), l.reset(), a?.state?.reset(), Ie.current.cancelCount++, Te();
123
- }), { run: Ue } = Xe(
121
+ s?.retryConnect();
122
+ }), Le = F(() => {
123
+ X(), c.reset(), l.reset(), a?.state?.reset(), Ie.current.cancelCount++, Oe();
124
+ }), { run: Me } = Je(
124
125
  () => {
125
126
  z.current || o.status === "timeout" && (z.current = !0, o.reset(), ne(), z.current = !1);
126
127
  },
127
128
  { leading: !0, trailing: !1 }
128
129
  );
129
- ue(Ue, [o.status]);
130
- const Le = u(() => tt[s.chooseMethod] || "DID Wallet", [s.chooseMethod]), { providerList: Me, hideQRCode: m, hideChooseList: r, loadingProviderList: Fe } = kt({
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({
131
132
  action: o.action,
132
133
  sourceAppPid: s?.sourceAppPid,
133
134
  allowWallet: V,
134
135
  passkeyBehavior: Y,
135
136
  mode: p,
136
137
  blocklet: s?.sourceAppPid ? _e : $,
137
- isSmallView: oe
138
- }), Ne = Je(s?.sourceAppPid);
139
- Ze(() => {
140
- $e(Ne) || ee();
138
+ isSmallView: oe,
139
+ lastLoginMethod: Te
140
+ }), je = Ze(s?.sourceAppPid);
141
+ $e(() => {
142
+ et(je) || ee();
141
143
  }, [s?.sourceAppPid]);
142
144
  const n = (k) => {
143
145
  const h = A.spacing(k);
144
146
  return parseInt(h, 10);
145
- }, je = u(() => y ? null : /* @__PURE__ */ t(
146
- et,
147
+ }, Be = u(() => y ? null : /* @__PURE__ */ t(
148
+ tt,
147
149
  {
148
150
  onClose: O,
149
151
  sx: {
@@ -164,39 +166,39 @@ function fe({
164
166
  justifyContent: "center"
165
167
  },
166
168
  children: /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(
167
- ht,
169
+ bt,
168
170
  {
169
171
  status: a?.state?.computedStatus || c.status || l.status || o.status,
170
172
  nextWorkflow: o.nextWorkflow,
171
173
  mfaCode: o.mfaCode,
172
- onCancel: Ee,
173
- onRetry: ze,
174
+ onCancel: Le,
175
+ onRetry: Ee,
174
176
  onClose: O,
175
- messages: We,
177
+ messages: ze,
176
178
  locale: q,
177
179
  className: "did-connect__auth-status auth-status",
178
- loadingIcon: s.chooseMethod ? /* @__PURE__ */ t(at, { provider: s.chooseMethod, sx: { color: "text.primary" } }) : null,
179
- chooseMethod: Le,
180
+ loadingIcon: s.chooseMethod ? /* @__PURE__ */ t(ct, { provider: s.chooseMethod, sx: { color: "text.primary" } }) : null,
181
+ chooseMethod: Ue,
180
182
  hideRetry: s.chooseMethod === "email",
181
183
  hideBack: !!K
182
184
  }
183
185
  ) })
184
186
  }
185
187
  ));
186
- const se = wt({ disableSwitchApp: T, tokenState: o }), E = u(() => {
188
+ const se = It({ disableSwitchApp: T, tokenState: o }), E = u(() => {
187
189
  const k = A.mode === "dark" ? A.palette.grey[600] : "white";
188
- let h = r ? 240 - n(3) * 2 : 196 - n(2) * 2, M = r ? 3 : 2;
189
- return f && (M = 1, h += n(M) * 2), /* @__PURE__ */ t(
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(
190
192
  i,
191
193
  {
192
194
  className: "did-connect__qrcode",
193
195
  sx: {
194
- p: M,
196
+ p: U,
195
197
  width: (r ? 240 : 196) + n(1) * 2,
196
198
  height: (r ? 240 : 196) + n(1) * 2
197
199
  },
198
200
  children: o.url ? /* @__PURE__ */ t(
199
- nt,
201
+ it,
200
202
  {
201
203
  data: se,
202
204
  size: h,
@@ -220,7 +222,7 @@ function fe({
220
222
  }
221
223
  }
222
224
  ) : /* @__PURE__ */ t(
223
- Ye,
225
+ Ge,
224
226
  {
225
227
  animation: "wave",
226
228
  variant: "rectangular",
@@ -239,7 +241,7 @@ function fe({
239
241
  )
240
242
  }
241
243
  );
242
- }, [se, r, f]), Be = u(() => r ? "column-reverse" : !m && re ? "column" : "row", [r, re, m]), ae = u(() => E ? /* @__PURE__ */ t(
244
+ }, [se, r, f]), qe = u(() => r ? "column-reverse" : !m && re ? "column" : "row", [r, re, m]), ae = u(() => E ? /* @__PURE__ */ t(
243
245
  i,
244
246
  {
245
247
  sx: {
@@ -289,7 +291,7 @@ function fe({
289
291
  children: [
290
292
  Z("scanWithWallet1"),
291
293
  " ",
292
- /* @__PURE__ */ t(St, {}),
294
+ /* @__PURE__ */ t(kt, {}),
293
295
  " ",
294
296
  Z("scanWithWallet2")
295
297
  ]
@@ -299,13 +301,13 @@ function fe({
299
301
  }
300
302
  )
301
303
  }
302
- ) : null, [E, r, f]), U = /* @__PURE__ */ b(
304
+ ) : null, [E, r, f]), L = /* @__PURE__ */ b(
303
305
  i,
304
306
  {
305
307
  className: "did-connect__body",
306
308
  sx: {
307
309
  display: "flex",
308
- flexDirection: Be,
310
+ flexDirection: qe,
309
311
  justifyContent: "center",
310
312
  alignItems: "stretch",
311
313
  flex: 1,
@@ -314,10 +316,10 @@ function fe({
314
316
  px: r ? 2 : 0
315
317
  },
316
318
  children: [
317
- !S && !m ? /* @__PURE__ */ b(qe, { children: [
319
+ !S && !m ? /* @__PURE__ */ b(He, { children: [
318
320
  ae,
319
321
  r ? null : /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(
320
- Ge,
322
+ Ke,
321
323
  {
322
324
  orientation: "vertical",
323
325
  sx: {
@@ -341,7 +343,7 @@ function fe({
341
343
  children: [
342
344
  ie,
343
345
  /* @__PURE__ */ t(
344
- dt,
346
+ ft,
345
347
  {
346
348
  slotProps: {
347
349
  root: {
@@ -365,7 +367,7 @@ function fe({
365
367
  magicToken: K,
366
368
  baseUrl: g,
367
369
  customItems: ye,
368
- providerList: Me,
370
+ providerList: Fe,
369
371
  qrcode: ae
370
372
  }
371
373
  )
@@ -375,15 +377,15 @@ function fe({
375
377
  ]
376
378
  }
377
379
  );
378
- let L = U;
379
- a ? L = a.renderPlaceholder({
380
- fallback: U,
380
+ let M = L;
381
+ a ? M = a.renderPlaceholder({
382
+ fallback: L,
381
383
  forceUpdate: J,
382
384
  onSuccess: R,
383
385
  onError: Q
384
- }) : L = U;
385
- const ce = m || S ? ot : N;
386
- return Fe ? /* @__PURE__ */ t(vt, {}) : /* @__PURE__ */ b(
386
+ }) : M = L;
387
+ const ce = m || S ? rt : N;
388
+ return Ne ? /* @__PURE__ */ t(Pt, {}) : /* @__PURE__ */ b(
387
389
  i,
388
390
  {
389
391
  ref: te,
@@ -408,7 +410,7 @@ function fe({
408
410
  children: [
409
411
  /* @__PURE__ */ t(i, { "data-did-auth-url": o.url, sx: { display: "none" } }),
410
412
  /* @__PURE__ */ t(
411
- yt,
413
+ St,
412
414
  {
413
415
  title: d.title,
414
416
  description: d.scan,
@@ -418,9 +420,9 @@ function fe({
418
420
  onBack: () => De(!1)
419
421
  }
420
422
  ),
421
- /* @__PURE__ */ t(ft, { initHeight: 72, children: L }),
422
- /* @__PURE__ */ t(it, { currentAppInfo: Pe, currentAppColor: W }),
423
- je
423
+ /* @__PURE__ */ t(mt, { initHeight: 72, children: M }),
424
+ /* @__PURE__ */ t(st, { currentAppInfo: Pe, currentAppColor: W }),
425
+ Be
424
426
  ]
425
427
  }
426
428
  );
@@ -447,7 +449,7 @@ fe.propTypes = {
447
449
  enabledConnectTypes: e.arrayOf(e.oneOf(["web", "mobile", ...Object.keys(j)])),
448
450
  webWalletUrl: e.string,
449
451
  allowWallet: e.bool,
450
- provider: e.oneOf([rt.WALLET, ...Object.keys(j), ""]),
452
+ provider: e.oneOf([nt.WALLET, ...Object.keys(j), ""]),
451
453
  hideCloseButton: e.bool,
452
454
  disableSwitchApp: e.bool,
453
455
  onClose: e.func,
@@ -458,12 +460,12 @@ fe.propTypes = {
458
460
  magicToken: e.string,
459
461
  customItems: e.arrayOf(e.node)
460
462
  };
461
- function _t({ testOnlyBorderColor: y = void 0, ...p }) {
463
+ function Dt({ testOnlyBorderColor: y = void 0, ...p }) {
462
464
  const { checkFn: I, extraParams: g = {}, blocklet: v, masterBlocklet: P, action: _, locale: D = "en" } = p;
463
465
  if (typeof I != "function")
464
466
  throw new Error("Cannot initialize did connect component without a fetchFn");
465
467
  return /* @__PURE__ */ t(
466
- lt,
468
+ ut,
467
469
  {
468
470
  blocklet: v,
469
471
  masterBlocklet: P,
@@ -487,7 +489,7 @@ function _t({ testOnlyBorderColor: y = void 0, ...p }) {
487
489
  }
488
490
  );
489
491
  }
490
- _t.propTypes = {
492
+ Dt.propTypes = {
491
493
  checkFn: e.func.isRequired,
492
494
  extraParams: e.object,
493
495
  blocklet: e.object.isRequired,
@@ -497,5 +499,5 @@ _t.propTypes = {
497
499
  testOnlyBorderColor: e.string
498
500
  };
499
501
  export {
500
- _t as default
502
+ Dt as default
501
503
  };
@@ -1,57 +1,64 @@
1
1
  import { jsx as O } from "react/jsx-runtime";
2
2
  import r from "prop-types";
3
- import { useState as S, use as E, useRef as W, useEffect as V, createContext as X } from "react";
3
+ import { useState as S, use as W, useRef as D, useEffect as V, createContext as X } from "react";
4
4
  import Y from "@arcblock/react-hooks/lib/useBrowser";
5
- import { useUpdate as Z, useCreation as i, useMemoizedFn as h, useLatest as _, useReactive as $, useSize as ee } from "ahooks";
6
- import x from "lodash/isUndefined";
7
- import te from "lodash/noop";
8
- import { Box as oe } from "@mui/material";
9
- import { translate as re } from "@arcblock/ux/lib/Locale/util";
10
- import { getMaster as D, getCurrentApp as ne } from "@arcblock/ux/lib/Util/federated";
11
- import { getDIDMotifInfo as se } from "@arcblock/did-motif";
12
- import { isEthereumDid as ie, getDIDColor as pe } from "@arcblock/ux/lib/Util";
13
- import ce from "../hooks/use-apps.js";
14
- import { SessionContext as ue } from "../../Session/context.js";
15
- import de from "../assets/locale.js";
16
- const R = X({
5
+ import { useUpdate as Z, useCreation as n, useMemoizedFn as h, useLatest as $, useReactive as ee, useSize as te } from "ahooks";
6
+ import E from "lodash/isUndefined";
7
+ import oe from "lodash/noop";
8
+ import { Box as re } from "@mui/material";
9
+ import { translate as ne } from "@arcblock/ux/lib/Locale/util";
10
+ import { getMaster as T, getCurrentApp as se } from "@arcblock/ux/lib/Util/federated";
11
+ import { getDIDMotifInfo as ie } from "@arcblock/did-motif";
12
+ import { isEthereumDid as ce, getDIDColor as pe } from "@arcblock/ux/lib/Util";
13
+ import { GA_LAST_LOGIN_METHOD as ue } from "@arcblock/ux/lib/withTracker/constant";
14
+ import ae from "../hooks/use-apps.js";
15
+ import { SessionContext as de } from "../../Session/context.js";
16
+ import le from "../assets/locale.js";
17
+ const x = X({
17
18
  isWalletWebview: !1,
18
19
  isMobile: !1,
19
20
  matchSmallScreen: !1,
20
21
  blocklet: null
21
- }), { Provider: ae, Consumer: We } = R;
22
- function le({
23
- children: T,
24
- blocklet: p,
22
+ }), { Provider: fe, Consumer: We } = x;
23
+ function me({
24
+ children: R,
25
+ blocklet: c,
25
26
  masterBlocklet: P = void 0,
26
- action: d,
27
+ action: a,
27
28
  extraParams: t = {},
28
- locale: a = "en",
29
+ locale: d = "en",
29
30
  testOnlyBorderColor: l = void 0,
30
- ...j
31
+ ...L
31
32
  }) {
32
- const w = Z(), [f, q] = S([]), [z, J] = S(!1), [m, N] = S(""), U = i(() => new Map(f.map((e) => [e.name, e])), [f]), k = h((e) => U.get(e)), B = _(m), L = h((e, s = {}) => re(de, e, a, "en", s)), g = E(ue), o = $({
33
+ const w = Z(), [f, j] = S([]), [N, q] = S(!1), [m, z] = S(""), G = n(() => new Map(f.map((e) => [e.name, e])), [f]), J = h((e) => G.get(e)), U = $(m), _ = h((e, i = {}) => ne(le, e, d, "en", i)), g = W(de), o = ee({
33
34
  sourceAppPid: void 0,
34
35
  status: "created",
35
36
  autoActiveWebview: !0,
36
37
  deeplink: void 0,
37
38
  chooseMethod: "",
38
- retryConnect: te
39
- }), F = W({
39
+ retryConnect: oe
40
+ }), k = D({
40
41
  cancelCount: 0
41
- }), n = Y(), { appInfoList: b, autoGenerateSourceAppPid: A, canSwitchApp: v } = ce({
42
- blocklet: p,
42
+ }), s = Y(), { appInfoList: b, autoGenerateSourceAppPid: A, canSwitchApp: v } = ae({
43
+ blocklet: c,
43
44
  connectState: o,
44
- action: d,
45
+ action: a,
45
46
  sourceAppPid: t?.sourceAppPid,
46
47
  enableSwitchApp: t?.forceSwitch || t?.enableSwitchApp
47
- }), C = W(null), M = ee(C), y = i(() => (M?.width || 0) < 500, [M?.width]), c = i(() => {
48
+ }), B = n(() => {
49
+ try {
50
+ return localStorage.getItem(ue);
51
+ } catch {
52
+ return "";
53
+ }
54
+ }, []), C = D(null), M = te(C), y = n(() => (M?.width || 0) < 500, [M?.width]), p = n(() => {
48
55
  if (v)
49
56
  return {
50
57
  ...t,
51
- sourceAppPid: x(o.sourceAppPid) ? A : o.sourceAppPid
58
+ sourceAppPid: E(o.sourceAppPid) ? A : o.sourceAppPid
52
59
  };
53
- const e = D(p)?.appPid, s = D(globalThis.blocklet)?.appPid;
54
- return g?.session?.user && (e === s || !e) ? x(t?.sourceAppPid) ? {
60
+ const e = T(c)?.appPid, i = T(globalThis.blocklet)?.appPid;
61
+ return g?.session?.user && (e === i || !e) ? E(t?.sourceAppPid) ? {
55
62
  ...t,
56
63
  sourceAppPid: g.session.user?.sourceAppPid
57
64
  } : t : {
@@ -62,70 +69,72 @@ function le({
62
69
  v,
63
70
  t,
64
71
  o.sourceAppPid,
65
- d,
72
+ a,
66
73
  A,
67
74
  g?.session?.user
68
- ]), G = i(() => {
75
+ ]), F = n(() => {
69
76
  const e = window?.navigator?.userAgent;
70
77
  return e.indexOf("Edge") > -1 || e.indexOf("Edg") > -1 ? "edge" : e.indexOf("Chrome") > -1 ? "chrome" : "unknown";
71
78
  }, []);
72
79
  V(() => {
73
- o.sourceAppPid = c.sourceAppPid;
74
- }, [c.sourceAppPid]);
80
+ o.sourceAppPid = p.sourceAppPid;
81
+ }, [p.sourceAppPid]);
75
82
  const H = h((e) => {
76
83
  o.status = e || "created";
77
- }), u = globalThis.blocklet ? ne(p) : globalThis.env, I = i(() => {
84
+ }), u = globalThis.blocklet ? se(c) : globalThis.env, I = n(() => {
78
85
  if (l)
79
86
  return l;
80
- const e = u.appPid, s = ie(e), Q = s ? void 0 : se(e);
81
- return s ? pe(e) : Q.color;
82
- }, [u.appId, l]), K = i(() => ({
83
- isWalletWebview: n.wallet || n.arcSphere,
84
- isMobile: n.mobile.any,
87
+ const e = u.appPid, i = ce(e), Q = i ? void 0 : ie(e);
88
+ return i ? pe(e) : Q.color;
89
+ }, [u.appId, l]), K = n(() => ({
90
+ isWalletWebview: s.wallet || s.arcSphere,
91
+ isMobile: s.mobile.any,
85
92
  matchSmallScreen: y,
86
93
  connectState: o,
87
- staticState: F,
94
+ staticState: k,
88
95
  reactiveState: o,
89
96
  appInfoList: b,
90
- extraParams: c,
91
- blocklet: p,
97
+ extraParams: p,
98
+ blocklet: c,
92
99
  masterBlocklet: P,
93
- browserBrand: G,
100
+ browserBrand: F,
94
101
  currentAppInfo: u,
95
102
  currentAppColor: I,
96
- t: L,
97
- locale: a,
98
- action: d,
103
+ t: _,
104
+ locale: d,
105
+ action: a,
99
106
  changeStatus: H,
100
- getPlugin: k,
101
- latestActivePlugin: B,
107
+ getPlugin: J,
108
+ latestActivePlugin: U,
102
109
  plugins: f,
103
- setPlugins: q,
110
+ setPlugins: j,
104
111
  selectedPlugin: m,
105
- setSelectedPlugin: N,
112
+ setSelectedPlugin: z,
106
113
  forceUpdate: w,
107
114
  // 控制钱包登录的显示
108
- showWalletOptions: z,
109
- setShowWalletOptions: J
115
+ showWalletOptions: N,
116
+ setShowWalletOptions: q,
117
+ // 用于记录上一次登录方式
118
+ lastLoginMethod: B
110
119
  }), [
111
- n.wallet,
112
- n.arcSphere,
113
- n.mobile.any,
120
+ s.wallet,
121
+ s.arcSphere,
122
+ s.mobile.any,
114
123
  y,
115
124
  JSON.stringify(o),
116
125
  JSON.stringify(b),
117
- JSON.stringify(c),
118
- p,
126
+ JSON.stringify(p),
127
+ c,
119
128
  P,
120
- a,
129
+ d,
121
130
  m,
122
131
  w,
123
132
  u,
124
133
  I
125
134
  ]);
126
- return /* @__PURE__ */ O(ae, { value: K, children: /* @__PURE__ */ O(oe, { ...j, ref: C, children: T }) });
135
+ return /* @__PURE__ */ O(fe, { value: K, children: /* @__PURE__ */ O(re, { ...L, ref: C, children: R }) });
127
136
  }
128
- le.propTypes = {
137
+ me.propTypes = {
129
138
  children: r.any.isRequired,
130
139
  blocklet: r.object.isRequired,
131
140
  masterBlocklet: r.object,
@@ -135,11 +144,11 @@ le.propTypes = {
135
144
  testOnlyBorderColor: r.string
136
145
  };
137
146
  function xe() {
138
- return E(R);
147
+ return W(x);
139
148
  }
140
149
  export {
141
150
  We as StateConsumer,
142
- R as StateContext,
143
- le as StateProvider,
151
+ x as StateContext,
152
+ me as StateProvider,
144
153
  xe as useStateContext
145
154
  };