@arcblock/did-connect-react 3.4.3 → 3.4.4

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,118 +1,118 @@
1
- import { jsx as g, jsxs as K, Fragment as zo } from "react/jsx-runtime";
1
+ import { jsx as m, jsxs as K, Fragment as Vo } from "react/jsx-runtime";
2
2
  import S from "prop-types";
3
- import Vo from "lodash/omit";
4
- import jo from "lodash/pick";
3
+ import jo from "lodash/omit";
4
+ import Ko from "lodash/pick";
5
5
  import Te from "lodash/cloneDeep";
6
6
  import Z from "lodash/isFunction";
7
- import w from "lodash/isUndefined";
8
- import Ko from "lodash/defaultsDeep";
9
- import $o from "js-cookie";
10
- import qo from "eventemitter3";
11
- import Xo from "p-wait-for";
12
- import { useTheme as Qo, Typography as Yo, Box as $, CircularProgress as Jo } from "@mui/material";
13
- import { getVisitorId as q, isUrl as Zo, ensureVisitorId as ei, setVisitorId as ke } from "@arcblock/ux/lib/Util";
7
+ import u from "lodash/isUndefined";
8
+ import $o from "lodash/defaultsDeep";
9
+ import qo from "js-cookie";
10
+ import Xo from "eventemitter3";
11
+ import Qo from "p-wait-for";
12
+ import { useTheme as Yo, Typography as Jo, Box as $, CircularProgress as Zo } from "@mui/material";
13
+ import { getVisitorId as q, isUrl as et, ensureVisitorId as ot, setVisitorId as ke } from "@arcblock/ux/lib/Util";
14
14
  import ae, { ToastProvider as ye } from "@arcblock/ux/lib/Toast";
15
- import oi from "@arcblock/ux/lib/Center";
16
- import { useReactive as Ie, useCreation as Le, useMemoizedFn as f, usePrevious as ii, useLatest as De, useUpdateEffect as le, useMount as ti } from "ahooks";
17
- import { joinURL as M } from "ufo";
18
- import { Icon as ri } from "@iconify/react";
19
- import ni from "@iconify-icons/material-symbols/keyboard-double-arrow-right-rounded";
20
- import si from "@arcblock/react-hooks/lib/useBrowser";
21
- import ci from "@arcblock/ux/lib/Dialog/use-confirm";
15
+ import tt from "@arcblock/ux/lib/Center";
16
+ import { useReactive as Ie, useCreation as Le, useMemoizedFn as f, usePrevious as it, useLatest as De, useUpdateEffect as le, useMount as rt } from "ahooks";
17
+ import { joinURL as H } from "ufo";
18
+ import { Icon as nt } from "@iconify/react";
19
+ import st from "@iconify-icons/material-symbols/keyboard-double-arrow-right-rounded";
20
+ import ct from "@arcblock/react-hooks/lib/useBrowser";
21
+ import at from "@arcblock/ux/lib/Dialog/use-confirm";
22
22
  import _e from "@arcblock/ux/lib/DID";
23
23
  import Ee from "@arcblock/ux/lib/Avatar";
24
- import { getCurrentAppPid as ai } from "@arcblock/ux/lib/SessionUser/libs/utils";
25
- import { translate as li } from "@arcblock/ux/lib/Locale/util";
26
- import { getBlockletSDK as di } from "@blocklet/js-sdk";
27
- import A from "@arcblock/bridge";
28
- import { getFederatedEnabled as pi } from "@arcblock/ux/lib/Util/federated";
29
- import fi from "lodash/noop";
30
- import ui from "lodash/isNil";
31
- import { ReactGA as wi } from "@arcblock/ux/lib/withTracker";
32
- import { useState as hi, useEffect as mi } from "react";
24
+ import { getCurrentAppPid as lt } from "@arcblock/ux/lib/SessionUser/libs/utils";
25
+ import { translate as dt } from "@arcblock/ux/lib/Locale/util";
26
+ import { getBlockletSDK as pt } from "@blocklet/js-sdk";
27
+ import b from "@arcblock/bridge";
28
+ import { getFederatedEnabled as ft } from "@arcblock/ux/lib/Util/federated";
29
+ import ut from "lodash/noop";
30
+ import wt from "lodash/isNil";
31
+ import { ReactGA as ht } from "@arcblock/ux/lib/withTracker";
32
+ import { useState as mt, useEffect as gt } from "react";
33
33
  import de from "../Storage/index.js";
34
- import { formatCacheTtl as gi, getBrowserLang as Si, debug as m, decodeUrlParams as ve, sleep as E, debugTmp as xe, updateConnectedInfo as ee, getAppId as oe, logger as Oe } from "../utils.js";
34
+ import { formatCacheTtl as St, getBrowserLang as Pt, debug as h, decodeUrlParams as ve, sleep as E, debugTmp as xe, updateConnectedInfo as ee, getAppId as oe, logger as Oe } from "../utils.js";
35
35
  import Re from "./window-focus-aware.js";
36
- import { OAuthContext as Pi, OAuthConsumer as Ai, OAuthProvider as Ne, useOAuth as bi } from "../OAuth/context.js";
37
- import { PasskeyContext as Ci, PasskeyConsumer as Ti, PasskeyProvider as We, usePasskey as ki } from "../Passkey/context.js";
36
+ import { OAuthContext as At, OAuthConsumer as bt, OAuthProvider as Ne, useOAuth as Ct } from "../OAuth/context.js";
37
+ import { PasskeyContext as Tt, PasskeyConsumer as kt, PasskeyProvider as We, usePasskey as yt } from "../Passkey/context.js";
38
38
  import "../Passkey/actions.js";
39
- import yi, { getWalletDid as Ii } from "../User/use-did.js";
40
- import Li from "../User/wrap-did.js";
41
- import Di from "./hooks/use-federated.js";
42
- import _i from "./hooks/use-session-token.js";
43
- import Ei from "./hooks/use-protected-routes.js";
39
+ import It, { getWalletDid as Lt } from "../User/use-did.js";
40
+ import Dt from "../User/wrap-did.js";
41
+ import _t from "./hooks/use-federated.js";
42
+ import Et from "./hooks/use-session-token.js";
43
+ import vt from "./hooks/use-protected-routes.js";
44
44
  import { SessionContext as qe } from "./context.js";
45
- import vi from "../Connect/use-connect.js";
46
- import { EVENTS as c } from "./libs/constants.js";
45
+ import xt from "../Connect/use-connect.js";
46
+ import { EVENTS as a } from "./libs/constants.js";
47
47
  import { translations as B } from "./libs/locales.js";
48
- import { NotOpenError as xi } from "../error.js";
49
- import { SESSION_TOKEN_STORAGE_KEY as Xe, REFRESH_TOKEN_STORAGE_KEY as Qe, CSRF_TOKEN_STORAGE_KEY as Oi, API_DID_PREFIX as Ri, DEFAULT_TIMEOUT as Ni, BLOCKLET_SERVICE_PATH_PREFIX as G, DID_SPACES_BASE_URL as Wi } from "../constant.js";
50
- import { getMobileVisitorId as Fi, checkEnableAutoLogin as Bi, login as Ui } from "./libs/login-mobile.js";
51
- import Hi from "../Connect/hooks/use-quick-connect.js";
48
+ import { NotOpenError as Ot } from "../error.js";
49
+ import { SESSION_TOKEN_STORAGE_KEY as Xe, REFRESH_TOKEN_STORAGE_KEY as Qe, CSRF_TOKEN_STORAGE_KEY as Rt, API_DID_PREFIX as Nt, DEFAULT_TIMEOUT as Wt, BLOCKLET_SERVICE_PATH_PREFIX as G, DID_SPACES_BASE_URL as Ft } from "../constant.js";
50
+ import { getMobileVisitorId as Bt, checkEnableAutoLogin as Ut, login as Mt } from "./libs/login-mobile.js";
51
+ import Ht from "../Connect/hooks/use-quick-connect.js";
52
52
  import { didSpacesIsRequired as Fe } from "./libs/did-spaces.js";
53
- import Mi from "./did-spaces-guide.js";
54
- import { FederatedProvider as Gi, useFederatedContext as zi } from "../Federated/context.js";
55
- import Vi from "./hooks/use-verify.js";
56
- import { gaLoginSuccessHandler as Be, gaLoginFailedHandler as Ue, gaSwitchPassportSuccessHandler as He, gaSwitchPassportFailedHandler as Me, gaBindWalletSuccessHandler as Ge, gaBindWalletFailedHandler as ze } from "./handler.js";
57
- import { loginFederatedMaster as Yt, mountFederatedIframe as Jt } from "./libs/federated.js";
58
- const { Provider: ji, Consumer: Ve } = qe, je = {
53
+ import Gt from "./did-spaces-guide.js";
54
+ import { FederatedProvider as zt, useFederatedContext as Vt } from "../Federated/context.js";
55
+ import jt from "./hooks/use-verify.js";
56
+ import { gaLoginSuccessHandler as Be, gaLoginFailedHandler as Ue, gaSwitchPassportSuccessHandler as Me, gaSwitchPassportFailedHandler as He, gaBindWalletSuccessHandler as Ge, gaBindWalletFailedHandler as ze } from "./handler.js";
57
+ import { loginFederatedMaster as Ji, mountFederatedIframe as Zi } from "./libs/federated.js";
58
+ const { Provider: Kt, Consumer: Ve } = qe, je = {
59
59
  en: "DID Connect timeout, please reopen DID Connect popup",
60
60
  zh: "DID Connect 超时, 请重新打开 DID Connect"
61
61
  }, Ke = {
62
62
  en: "DID Connect is already opened, please wait for it to complete",
63
63
  zh: "DID Connect 已打开,请等待完成"
64
64
  };
65
- function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
65
+ function $e(X = Xe, Q = "ls", te = {}, k = {}) {
66
66
  let D = "/";
67
- globalThis?.blocklet?.prefix && (D = globalThis.blocklet.prefix), typeof T == "boolean" && (T = {
68
- appendAuthServicePrefix: T,
67
+ globalThis?.blocklet?.prefix && (D = globalThis.blocklet.prefix), typeof k == "boolean" && (k = {
68
+ appendAuthServicePrefix: k,
69
69
  extraParams: {}
70
- }), Ko(T, {
70
+ }), $o(k, {
71
71
  rolling: !0,
72
72
  appendAuthServicePrefix: !1,
73
73
  extraParams: {},
74
74
  refreshTokenStorageKey: Qe
75
75
  });
76
- function O(I) {
76
+ function O(L) {
77
77
  if (globalThis.blocklet)
78
- if (I?.user) {
78
+ if (L?.user) {
79
79
  const v = {
80
- did: I.user.did,
80
+ did: L.user.did,
81
81
  host: window.location.host,
82
82
  appPid: globalThis.blocklet.appPid,
83
83
  visitorId: q(),
84
- sourceAppPid: I.user.sourceAppPid,
85
- fullName: I.user.fullName
84
+ sourceAppPid: L.user.sourceAppPid,
85
+ fullName: L.user.fullName
86
86
  };
87
- m("bridge callArc: onLogin", v), A.callArc("onLogin", { ...v, user: v });
87
+ h("bridge callArc: onLogin", v), b.callArc("onLogin", { ...v, user: v });
88
88
  } else
89
- A.callArc("onLogin", { error: "no user", code: 400 }), m("notifyBridge failed", { sessionState: I });
89
+ b.callArc("onLogin", { error: "no user", code: 400 }), h("notifyBridge failed", { sessionState: L });
90
90
  }
91
- const Y = de(X, Q, ie), z = de(Oi, "cookie", {
91
+ const Y = de(X, Q, te), z = de(Rt, "cookie", {
92
92
  secure: !0,
93
93
  sameSite: "strict"
94
- }), Ye = de(T.refreshTokenStorageKey, "ls");
95
- function pe({ ...I }) {
96
- const v = di(), r = Object.assign({}, I);
97
- w(r.serviceHost) && (r.serviceHost = D), w(r.locale) && (r.locale = ""), w(r.action) && (r.action = "login"), w(r.prefix) && (r.prefix = Ri), w(r.appendAuthServicePrefix) && (r.appendAuthServicePrefix = !1), w(r.extraParams) && (r.extraParams = {}), w(r.options) && (r.options = {}), w(r.autoConnect) && (r.autoConnect = !1), w(r.autoDisconnect) && (r.autoDisconnect = !0), w(r.useSocket) && (r.useSocket = !0), w(r.timeout) && (r.timeout = Ni * 1e3), w(r.webWalletUrl) && (r.webWalletUrl = void 0), w(r.protectedRoutes) && (r.protectedRoutes = ["*"]), w(r.apiOptions) && (r.apiOptions = {}), w(r.lazyRefreshToken) && (r.lazyRefreshToken = !1);
98
- const { connectApi: k, connectHolder: Ze } = vi(), [eo, fe] = hi(0), y = si(), { requestStorageAccess: oo } = zi(), { palette: io } = Qo(), U = new URLSearchParams(window.location.search), s = Ie({
94
+ }), Ye = de(k.refreshTokenStorageKey, "ls");
95
+ function pe({ ...L }) {
96
+ const v = pt(), n = Object.assign({}, L);
97
+ u(n.serviceHost) && (n.serviceHost = D), u(n.locale) && (n.locale = ""), u(n.action) && (n.action = "login"), u(n.prefix) && (n.prefix = Nt), u(n.appendAuthServicePrefix) && (n.appendAuthServicePrefix = !1), u(n.extraParams) && (n.extraParams = {}), u(n.options) && (n.options = {}), u(n.autoConnect) && (n.autoConnect = !1), u(n.autoDisconnect) && (n.autoDisconnect = !0), u(n.useSocket) && (n.useSocket = !0), u(n.timeout) && (n.timeout = Wt * 1e3), u(n.webWalletUrl) && (n.webWalletUrl = void 0), u(n.protectedRoutes) && (n.protectedRoutes = ["*"]), u(n.apiOptions) && (n.apiOptions = {}), u(n.lazyRefreshToken) && (n.lazyRefreshToken = !1);
98
+ const { connectApi: y, connectHolder: Ze } = xt(), [eo, fe] = mt(0), I = ct(), { requestStorageAccess: oo } = Vt(), { palette: to } = Yo(), U = new URLSearchParams(window.location.search), c = Ie({
99
99
  extraParams: {},
100
100
  options: {},
101
- currentLocale: r.locale,
101
+ currentLocale: n.locale,
102
102
  allowWallet: void 0,
103
103
  openMode: "window",
104
104
  get autoConnect() {
105
- return typeof r.autoConnect == "boolean" ? r.autoConnect : !!r.autoLogin;
105
+ return typeof n.autoConnect == "boolean" ? n.autoConnect : !!n.autoLogin;
106
106
  },
107
107
  get prefix() {
108
- return T.appendAuthServicePrefix || r.appendAuthServicePrefix ? M(G, r.prefix) : r.prefix;
108
+ return k.appendAuthServicePrefix || n.appendAuthServicePrefix ? H(G, n.prefix) : n.prefix;
109
109
  },
110
110
  get notificationPrefix() {
111
111
  const e = "/api/notifications";
112
- return T.appendAuthServicePrefix || r.appendAuthServicePrefix ? M(G, e) : e;
112
+ return k.appendAuthServicePrefix || n.appendAuthServicePrefix ? H(G, e) : e;
113
113
  }
114
- }), t = Ie({
115
- action: r.action,
114
+ }), i = Ie({
115
+ action: n.action,
116
116
  error: "",
117
117
  initialized: !1,
118
118
  loading: !1,
@@ -123,35 +123,35 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
123
123
  baseUrl: "",
124
124
  unReadCount: 0
125
125
  // 不可以直接个性 props.autoConnect (readonly)
126
- }), b = Le(() => r.locale || s.currentLocale || Si(), [r.locale, s.currentLocale]), { confirmApi: to, confirmHolder: ro } = ci(), R = f(() => {
127
- if (t.open && !y.arcSphere) {
128
- const e = Ke[b] || Ke.en;
126
+ }), P = Le(() => n.locale || c.currentLocale || Pt(), [n.locale, c.currentLocale]), { confirmApi: io, confirmHolder: ro } = at(), R = f(() => {
127
+ if (i.open && !I.arcSphere) {
128
+ const e = Ke[P] || Ke.en;
129
129
  throw ae.warning(e), new Error(e);
130
130
  }
131
- }), d = Le(() => new qo(), []);
132
- mi(() => (d.on(c.LOGIN, Be), d.on(c.LOGIN_FAILED, Ue), d.on(c.SWITCH_PASSPORT, He), d.on(c.SWITCH_PASSPORT_FAILED, Me), d.on(c.BIND_WALLET, Ge), d.on(c.BIND_WALLET_FAILED, ze), () => {
133
- d.off(c.LOGIN, Be), d.off(c.LOGIN_FAILED, Ue), d.off(c.SWITCH_PASSPORT, He), d.off(c.SWITCH_PASSPORT_FAILED, Me), d.off(c.BIND_WALLET, Ge), d.off(c.BIND_WALLET_FAILED, ze);
131
+ }), d = Le(() => new Xo(), []);
132
+ gt(() => (d.on(a.LOGIN, Be), d.on(a.LOGIN_FAILED, Ue), d.on(a.SWITCH_PASSPORT, Me), d.on(a.SWITCH_PASSPORT_FAILED, He), d.on(a.BIND_WALLET, Ge), d.on(a.BIND_WALLET_FAILED, ze), () => {
133
+ d.off(a.LOGIN, Be), d.off(a.LOGIN_FAILED, Ue), d.off(a.SWITCH_PASSPORT, Me), d.off(a.SWITCH_PASSPORT_FAILED, He), d.off(a.BIND_WALLET, Ge), d.off(a.BIND_WALLET_FAILED, ze);
134
134
  }), [d]);
135
- const H = f((e, o, i) => {
136
- const n = {
137
- login: [c.LOGIN, c.CANCEL_LOGIN],
138
- "bind-wallet": [c.BIND_WALLET, c.CANCEL_BIND_WALLET],
139
- "switch-passport": [c.SWITCH_PASSPORT, c.CANCEL_SWITCH_PASSPORT],
140
- "switch-profile": [c.SWITCH_PROFILE, c.CANCEL_SWITCH_PROFILE],
135
+ const M = f((e, o, t) => {
136
+ const s = {
137
+ login: [a.LOGIN, a.CANCEL_LOGIN],
138
+ "bind-wallet": [a.BIND_WALLET, a.CANCEL_BIND_WALLET],
139
+ "switch-passport": [a.SWITCH_PASSPORT, a.CANCEL_SWITCH_PASSPORT],
140
+ "switch-profile": [a.SWITCH_PROFILE, a.CANCEL_SWITCH_PROFILE],
141
141
  // HACK: 对于内部来说,switch-did 就是 login,所以内部的监听事件仍然是 login
142
- "switch-did": [c.LOGIN, c.CANCEL_LOGIN],
142
+ "switch-did": [a.LOGIN, a.CANCEL_LOGIN],
143
143
  // @FIXME: @zhanghan 整个事件发射的机制需要重构,目前的实现不是很优雅,对于用户来说不是很好用。 https://github.com/ArcBlock/ux/pull/1414#discussion_r1904830954
144
- "did-space-connected": [c.DID_SPACE_CONNECTED]
144
+ "did-space-connected": [a.DID_SPACE_CONNECTED]
145
145
  };
146
- if (!Object.keys(n).includes(e))
146
+ if (!Object.keys(s).includes(e))
147
147
  return;
148
- const l = async (...u) => {
149
- Z(o) && await o(...u), d.emit(e, ...u);
148
+ const l = async (...p) => {
149
+ Z(o) && await o(...p), d.emit(e, ...p);
150
150
  };
151
- d.once(n[e][0], l), d.once(n[e][1], async (...u) => {
152
- Z(l) && d.off(n[e][0], l), Z(i) && await i(...u), d.emit(`cancel-${e}`, ...u);
151
+ d.once(s[e][0], l), d.once(s[e][1], async (...p) => {
152
+ Z(l) && d.off(s[e][0], l), Z(t) && await t(...p), d.emit(`cancel-${e}`, ...p);
153
153
  });
154
- }), no = ii(t.initialized, (e, o) => e !== o || e === !0 && o === !0), {
154
+ }), no = it(i.initialized, (e, o) => e !== o || e === !0 && o === !0), {
155
155
  syncSessionSate: so,
156
156
  handleRefreshUser: C,
157
157
  handleRefreshToken: co,
@@ -164,84 +164,84 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
164
164
  getRefreshToken: fo,
165
165
  setRefreshToken: uo,
166
166
  setSessionToken: wo
167
- } = _i({
168
- state: t,
169
- pageState: s,
167
+ } = Et({
168
+ state: i,
169
+ pageState: c,
170
170
  sessionTokenStorage: Y,
171
171
  refreshTokenStorage: Ye,
172
172
  csrfTokenStorage: z,
173
- serviceHost: r.serviceHost,
174
- apiOptions: r.apiOptions,
175
- lazyRefreshToken: r.lazyRefreshToken,
176
- onRefresh({ type: e, sessionToken: o, refreshToken: i, user: n }) {
177
- if (m("onRefresh", { type: e, user: n }), globalThis.blocklet) {
173
+ serviceHost: n.serviceHost,
174
+ apiOptions: n.apiOptions,
175
+ lazyRefreshToken: n.lazyRefreshToken,
176
+ onRefresh({ type: e, sessionToken: o, refreshToken: t, user: s }) {
177
+ if (h("onRefresh", { type: e, user: s }), globalThis.blocklet) {
178
178
  const l = {
179
- did: n.did,
179
+ did: s.did,
180
180
  host: window.location.host,
181
181
  appPid: globalThis.blocklet.appPid,
182
182
  visitorId: q(),
183
- sourceAppPid: n.sourceAppPid,
184
- fullName: n.fullName
183
+ sourceAppPid: s.sourceAppPid,
184
+ fullName: s.fullName
185
185
  };
186
- e === "refreshToken" ? (m("bridge callArc: onRefreshToken"), A.callArc("onRefreshToken", {
186
+ e === "refreshToken" ? (h("bridge callArc: onRefreshToken"), b.callArc("onRefreshToken", {
187
187
  sessionToken: o,
188
- refreshToken: i,
188
+ refreshToken: t,
189
189
  user: l
190
- })) : e === "refreshUser" && (m("bridge callArc: onRefreshUser"), A.callArc("onRefreshUser", {
190
+ })) : e === "refreshUser" && (h("bridge callArc: onRefreshUser"), b.callArc("onRefreshUser", {
191
191
  sessionToken: o,
192
- refreshToken: i,
192
+ refreshToken: t,
193
193
  user: l
194
194
  }));
195
195
  }
196
196
  }
197
- }), ho = Vi({ state: t, connectApi: k }), we = f((e, o = {}, i = {}) => {
197
+ }), ho = jt({ state: i, connectApi: y }), we = f((e, o = {}, t = {}) => {
198
198
  R();
199
- const n = e;
200
- typeof n == "object" && (e = n.onSuccess, o = n.extraParams || {}, i = n.options || {}, i.origin = n.origin || ""), (!t.user || i.origin === "switch-did") && (i.origin === "switch-did" ? H("switch-did", e, n?.onCancel) : H("login", e, n?.onCancel), s.extraParams = o, s.options = i, t.action = "login", F());
199
+ const s = e;
200
+ typeof s == "object" && (e = s.onSuccess, o = s.extraParams || {}, t = s.options || {}, t.origin = s.origin || ""), (!i.user || t.origin === "switch-did") && (t.origin === "switch-did" ? M("switch-did", e, s?.onCancel) : M("login", e, s?.onCancel), c.extraParams = o, c.options = t, i.action = "login", F());
201
201
  }), mo = f((e, o = {}) => {
202
- const i = e;
202
+ const t = e;
203
203
  return function(...l) {
204
- const u = this;
204
+ const p = this;
205
205
  return (async () => {
206
206
  try {
207
- const p = await ho(o);
208
- if (!p.sessionId)
207
+ const g = await ho(o);
208
+ if (!g.sessionId)
209
209
  throw new Error("Authentication failed");
210
- return await i.call(u, p, ...l);
211
- } catch (p) {
212
- throw console.error("Authentication failed", p), p;
210
+ return await t.call(p, g, ...l);
211
+ } catch (g) {
212
+ throw console.error("Authentication failed", g), g;
213
213
  }
214
214
  })();
215
215
  };
216
- }), te = f(async (e, o = {}, i = {}) => {
216
+ }), ie = f(async (e, o = {}, t = {}) => {
217
217
  R();
218
- const n = e;
219
- typeof n == "object" && (e = n.onSuccess, o = n.extraParams || {}, i = n.options || {}), w(o?.inviter) && window.localStorage.getItem("inviter") && (o.inviter = window.localStorage.getItem("inviter"));
218
+ const s = e;
219
+ typeof s == "object" && (e = s.onSuccess, o = s.extraParams || {}, t = s.options || {}), u(o?.inviter) && window.localStorage.getItem("inviter") && (o.inviter = window.localStorage.getItem("inviter"));
220
220
  const { params: l } = await ve();
221
- if (w(o?.forceConnected) && l?.forceConnected && (o.forceConnected = l.forceConnected, w(i.showQuickConnect) && (i.showQuickConnect = !1)), w(o?.sourceAppPid) && !w(l?.sourceAppPid) && (o.sourceAppPid = l.sourceAppPid), o?.openMode === "redirect") {
222
- const h = o?.redirect || "/", L = new URL(`${G}/login`, window.location.origin);
223
- L.searchParams.set("redirect", h), o?.forceConnected && L.searchParams.set("forceConnected", o?.forceConnected), w(o?.sourceAppPid) || L.searchParams.set("sourceAppPid", o?.sourceAppPid), w(o?.inviter) || L.searchParams.set("inviter", o?.inviter), i?.origin && L.searchParams.set("origin", i.origin), window.location.href = L.href;
221
+ if (u(o?.forceConnected) && l?.forceConnected && (o.forceConnected = l.forceConnected, u(t.showQuickConnect) && (t.showQuickConnect = !1)), u(o?.sourceAppPid) && !u(l?.sourceAppPid) && (o.sourceAppPid = l.sourceAppPid), o?.openMode === "redirect") {
222
+ const w = o?.redirect || "/", T = new URL(`${G}/login`, window.location.origin);
223
+ T.searchParams.set("redirect", w), o?.forceConnected && T.searchParams.set("forceConnected", o?.forceConnected), u(o?.sourceAppPid) || T.searchParams.set("sourceAppPid", o?.sourceAppPid), u(o?.inviter) || T.searchParams.set("inviter", o?.inviter), t?.origin && T.searchParams.set("origin", t.origin), window.location.href = T.href;
224
224
  return;
225
225
  }
226
- let u = o?.sourceAppPid;
227
- w(u) && Ro && (u = No.appPid), await Xo(() => t.initialized), typeof i == "string" && (i = { origin: i });
228
- const p = Te(o);
229
- p.passkeyBehavior = "both", s.allowWallet = void 0;
230
- const a = p?.openMode || r?.extraParams?.openMode;
231
- w(a) ? u ? u !== globalThis.blocklet.appPid && pi(globalThis.blocklet) && (s.openMode = "window") : s.openMode = "popup" : s.openMode = a, s.openMode === "window" && !y.arcSphere && !y.wallet && await oo() && (s.openMode = "popup"), u ? t.baseUrl = globalThis.blocklet.appUrl : t.baseUrl = "", we(e, p, i);
226
+ let p = o?.sourceAppPid;
227
+ u(p) && No && (p = Wo.appPid), await Qo(() => i.initialized), typeof t == "string" && (t = { origin: t });
228
+ const g = Te(o);
229
+ g.passkeyBehavior = "both", c.allowWallet = void 0;
230
+ const r = g?.openMode || n?.extraParams?.openMode;
231
+ u(r) ? p ? p !== globalThis.blocklet.appPid && ft(globalThis.blocklet) && (c.openMode = "window") : c.openMode = "popup" : c.openMode = r, c.openMode === "window" && !I.arcSphere && !I.wallet && await oo() && (c.openMode = "popup"), p ? i.baseUrl = globalThis.blocklet.appUrl : i.baseUrl = "", we(e, g, t);
232
232
  }), he = f(async (e) => {
233
233
  const o = q();
234
- if (globalThis.blocklet && (v.user.logout({ visitorId: o }).catch((i) => {
235
- console.warn("Failed to logout remote", i);
234
+ if (globalThis.blocklet && (v.user.logout({ visitorId: o }).catch((t) => {
235
+ console.warn("Failed to logout remote", t);
236
236
  }), await E(100)), globalThis.blocklet) {
237
- const i = {
237
+ const t = {
238
238
  visitorId: o,
239
239
  appPid: globalThis.blocklet.appPid,
240
- userDid: t.user.did
240
+ userDid: i.user.did
241
241
  };
242
- m("bridge callArc: onLogout", i), A.callArc("onLogout", i);
242
+ h("bridge callArc: onLogout", t), b.callArc("onLogout", t);
243
243
  }
244
- xe("[clearSession] createSessionContext -> logout:"), ue(), j(), t.user = null, t.provider = "", t.walletOS = "", t.error = "", t.loading = !1, d.emit("logout"), wi.set({
244
+ xe("[clearSession] createSessionContext -> logout:"), ue(), j(), i.user = null, i.provider = "", i.walletOS = "", i.error = "", i.loading = !1, d.emit("logout"), ht.set({
245
245
  user_id: void 0
246
246
  }), typeof e == "function" && e();
247
247
  }), {
@@ -249,61 +249,65 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
249
249
  refresh: So,
250
250
  loaded: Po,
251
251
  loginUserSession: re
252
- } = Hi({
253
- appPid: ai(t.user),
252
+ } = Ht({
253
+ appPid: lt(i.user),
254
254
  loginAppPid: globalThis?.blocklet?.appPid,
255
- sourceAppPid: t?.user?.sourceAppPid,
255
+ sourceAppPid: i?.user?.sourceAppPid,
256
256
  autoFetch: !1,
257
257
  fetchAll: !0
258
+ }), Ao = f((e, o) => {
259
+ if (!globalThis.blocklet) return null;
260
+ const t = globalThis.blocklet?.settings?.actionConfig?.[e];
261
+ return t ? t[o] || t.en : null;
258
262
  }), N = f(async () => {
259
- t?.user || await new Promise((e) => {
260
- te(() => {
263
+ i?.user || await new Promise((e) => {
264
+ ie(() => {
261
265
  e();
262
266
  });
263
267
  });
264
- }), ne = f((e, o = {}, i = {}) => {
268
+ }), ne = f((e, o = {}, t = {}) => {
265
269
  R();
266
- const n = e;
267
- typeof n == "object" && (e = n.onSuccess, o = n.extraParams || {}, i = n.options || {}), typeof i == "string" && (i = { origin: i }), i?.userSession ? re(i.userSession).then((l) => {
270
+ const s = e;
271
+ typeof s == "object" && (e = s.onSuccess, o = s.extraParams || {}, t = s.options || {}), typeof t == "string" && (t = { origin: t }), t?.userSession ? re(t.userSession).then((l) => {
268
272
  ee(
269
273
  {
270
- connected_did: i.userSession.user.did,
271
- connected_pk: i.userSession.user.pk,
272
- connected_wallet_os: i.userSession.extra.walletOS,
274
+ connected_did: t.userSession.user.did,
275
+ connected_pk: t.userSession.user.pk,
276
+ connected_wallet_os: t.userSession.extra.walletOS,
273
277
  connected_app: oe()
274
278
  },
275
279
  !0
276
- ), H("switch-did", e), x({ ...l, encrypted: !1 }), C({ showProgress: !0 }).then(async () => {
277
- await E(200), d.emit(c.LOGIN, l, _, P.current), O(P.current), await W();
278
- }).catch((u) => {
279
- throw d.emit(c.LOGIN_FAILED, u), u;
280
+ ), M("switch-did", e), x({ ...l, encrypted: !1 }), C({ showProgress: !0 }).then(async () => {
281
+ await E(200), d.emit(a.LOGIN, l, _, A.current), O(A.current), await W();
282
+ }).catch((p) => {
283
+ throw d.emit(a.LOGIN_FAILED, p), p;
280
284
  });
281
- }) : (w(o?.forceConnected) && (o.forceConnected = !1), o.passkeyBehavior = "both", te(e, o, { ...i, origin: "switch-did" }));
282
- }), Ao = f(async () => {
285
+ }) : (u(o?.forceConnected) && (o.forceConnected = !1), o.passkeyBehavior = "both", ie(e, o, { ...t, origin: "switch-did" }));
286
+ }), bo = f(async () => {
283
287
  await v.user.refreshProfile();
284
- }), bo = f(async (e, o = {}) => {
285
- await N(), R();
286
- const i = e;
287
- typeof i == "object" && (e = i.onSuccess, o = i.extraParams || {}), H("switch-profile", e, i?.onCancel), s.extraParams = o, s.options = {}, t.action = "switch-profile", F();
288
288
  }), Co = f(async (e, o = {}) => {
289
289
  await N(), R();
290
- const i = e;
291
- typeof i == "object" && (e = i.onSuccess, o = i.extraParams || {}), H("switch-passport", e, i?.onCancel), s.extraParams = o, s.options = {}, t.action = "switch-passport", F();
292
- }), To = f(async ({ extraParams: e = {}, onSuccess: o = () => {
293
- }, ...i } = {}) => {
294
- await N(), R(), s.extraParams = {
290
+ const t = e;
291
+ typeof t == "object" && (e = t.onSuccess, o = t.extraParams || {}), M("switch-profile", e, t?.onCancel), c.extraParams = o, c.options = {}, i.action = "switch-profile", F();
292
+ }), To = f(async (e, o = {}) => {
293
+ await N(), R();
294
+ const t = e;
295
+ typeof t == "object" && (e = t.onSuccess, o = t.extraParams || {}), M("switch-passport", e, t?.onCancel), c.extraParams = o, c.options = {}, i.action = "switch-passport", F();
296
+ }), ko = f(async ({ extraParams: e = {}, onSuccess: o = () => {
297
+ }, ...t } = {}) => {
298
+ await N(), R(), c.extraParams = {
295
299
  referrer: window.location.href,
296
300
  purpose: "authorize-for-import",
297
301
  ...e,
298
302
  saveConnect: !1
299
303
  // 连接 spaces 不保存连接信息
300
- }, s.options = {}, t.action = "connect-to-did-spaces-for-user", F({
304
+ }, c.options = {}, i.action = "connect-to-did-spaces-for-user", F({
301
305
  hideCloseButton: !0,
302
306
  onSuccess: o,
303
- ...i
307
+ ...t
304
308
  });
305
309
  }), me = f(async ({ extraParams: e = {}, onSuccess: o = {} } = {}) => {
306
- await N(), To({
310
+ await N(), ko({
307
311
  extraParams: {
308
312
  // service 交互
309
313
  purpose: "authorize-for-import",
@@ -312,12 +316,12 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
312
316
  onSuccess: o,
313
317
  hideCloseButton: !1
314
318
  });
315
- }), { didSpacesGuideApi: J, DidSpacesGuideView: ko } = Mi({
319
+ }), { didSpacesGuideApi: J, DidSpacesGuideView: yo } = Gt({
316
320
  autoClose: !1
317
321
  }), W = async ({ extraParams: e = {}, onSuccess: o = () => {
318
322
  } } = {}) => {
319
- await N(), await Fe(t?.user) && (J.open(), J.onConnect((i = fi) => {
320
- const n = {
323
+ await N(), await Fe(i?.user) && (J.open(), J.onConnect((t = ut) => {
324
+ const s = {
321
325
  prefix: "/connect-to-did-space",
322
326
  custom: !0,
323
327
  extraParams: {
@@ -331,117 +335,117 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
331
335
  connectScope: "user",
332
336
  ...e
333
337
  },
334
- onSuccess: async (l, u) => {
335
- const p = u ? u(l.spaceGateway) : l.spaceGateway;
336
- await v.user.updateDidSpace({ spaceGateway: p }), await C({ showProgress: !0 }), await o(l, u), await J.close(), d.emit(c.DID_SPACE_CONNECTED, l, u), globalThis.blocklet && (m("bridge callArc: onDidSpaceConnected"), A.callArc("onDidSpaceConnected")), i(!0);
338
+ onSuccess: async (l, p) => {
339
+ const g = p ? p(l.spaceGateway) : l.spaceGateway;
340
+ await v.user.updateDidSpace({ spaceGateway: g }), await C({ showProgress: !0 }), await o(l, p), await J.close(), d.emit(a.DID_SPACE_CONNECTED, l, p), globalThis.blocklet && (h("bridge callArc: onDidSpaceConnected"), b.callArc("onDidSpaceConnected")), t(!0);
337
341
  },
338
342
  onError: (l) => {
339
- console.error(l), ae.error(l.message), J.close(), i(!1);
343
+ console.error(l), ae.error(l.message), J.close(), t(!1);
340
344
  },
341
345
  onClose: () => {
342
- i();
346
+ t();
343
347
  }
344
348
  };
345
- k.openPopup(n, {
346
- baseUrl: Wi
349
+ y.openPopup(s, {
350
+ baseUrl: Ft
347
351
  });
348
352
  }));
349
353
  }, ge = f(async (e, o = {}) => {
350
- if (await N(), Ii(t.user)) {
351
- e({}, _, P.current);
354
+ if (await N(), Lt(i.user)) {
355
+ e({}, _, A.current);
352
356
  return;
353
357
  }
354
358
  R();
355
- const i = e;
356
- typeof i == "object" && (e = i.onSuccess), H("bind-wallet", e, i?.onCancel), s.extraParams = o, s.options = {}, t.action = "bind-wallet", F();
359
+ const t = e;
360
+ typeof t == "object" && (e = t.onSuccess), M("bind-wallet", e, t?.onCancel), c.extraParams = o, c.options = {}, i.action = "bind-wallet", F();
357
361
  }), se = f(async (e) => {
358
- m("onSwitchPassport", { result: e }), s.extraParams = {}, s.options = {}, x(e), t.loading = !1, await C({ showProgress: !0 }), await E(200), d.emit(c.SWITCH_PASSPORT, e, _, P.current), globalThis.blocklet && (m("bridge callArc: onSwitchPassport"), A.callArc("onSwitchPassport"));
359
- }), yo = f((e) => {
360
- d.emit(c.SWITCH_PASSPORT_FAILED, e);
362
+ h("onSwitchPassport", { result: e }), c.extraParams = {}, c.options = {}, x(e), i.loading = !1, await C({ showProgress: !0 }), await E(200), d.emit(a.SWITCH_PASSPORT, e, _, A.current), globalThis.blocklet && (h("bridge callArc: onSwitchPassport"), b.callArc("onSwitchPassport"));
363
+ }), Io = f((e) => {
364
+ d.emit(a.SWITCH_PASSPORT_FAILED, e);
361
365
  }), V = f(async (e) => {
362
- if (t.action === "switch-passport") {
366
+ if (i.action === "switch-passport") {
363
367
  se(e);
364
368
  return;
365
369
  }
366
- m("onLogin", { result: e }), s.extraParams = {}, s.options = {}, x(e), t.loading = !1, await C({ showProgress: !0 }), await E(200), t.action === "login" && (m("onLogin: emit LOGIN event", { result: e }), d.emit(c.LOGIN, e, _, P.current), O(P.current), W());
367
- }), Io = f((e) => {
368
- d.emit(c.LOGIN_FAILED, e);
370
+ h("onLogin", { result: e }), c.extraParams = {}, c.options = {}, x(e), i.loading = !1, await C({ showProgress: !0 }), await E(200), i.action === "login" && (h("onLogin: emit LOGIN event", { result: e }), d.emit(a.LOGIN, e, _, A.current), O(A.current), W());
369
371
  }), Lo = f((e) => {
370
- s.extraParams = {}, s.options = {}, x(e), t.loading = !1, C({ showProgress: !0 }).then(async () => {
371
- await E(100), d.emit(c.BIND_WALLET, e, _, P.current), globalThis.blocklet && (m("bridge callArc: onBindWallet"), A.callArc("onBindWallet"));
372
- });
372
+ d.emit(a.LOGIN_FAILED, e);
373
373
  }), Do = f((e) => {
374
- d.emit(c.BIND_WALLET_FAILED, e, P);
375
- }), _o = f((e) => {
376
- m("onSwitchProfile", { result: e }), s.extraParams = {}, s.options = {}, t.loading = !1, C({ showProgress: !0 }).then(async () => {
377
- await E(100), d.emit(c.SWITCH_PROFILE, e, _, P.current), globalThis.blocklet && (m("bridge callArc: onSwitchProfile"), A.callArc("onSwitchProfile"));
374
+ c.extraParams = {}, c.options = {}, x(e), i.loading = !1, C({ showProgress: !0 }).then(async () => {
375
+ await E(100), d.emit(a.BIND_WALLET, e, _, A.current), globalThis.blocklet && (h("bridge callArc: onBindWallet"), b.callArc("onBindWallet"));
378
376
  });
377
+ }), _o = f((e) => {
378
+ d.emit(a.BIND_WALLET_FAILED, e, A);
379
379
  }), Eo = f((e) => {
380
- s.extraParams = {}, s.options = {}, j();
380
+ h("onSwitchProfile", { result: e }), c.extraParams = {}, c.options = {}, i.loading = !1, C({ showProgress: !0 }).then(async () => {
381
+ await E(100), d.emit(a.SWITCH_PROFILE, e, _, A.current), globalThis.blocklet && (h("bridge callArc: onSwitchProfile"), b.callArc("onSwitchProfile"));
382
+ });
383
+ }), vo = f((e) => {
384
+ c.extraParams = {}, c.options = {}, j();
381
385
  const o = {
382
- login: c.CANCEL_LOGIN,
383
- "switch-profile": c.CANCEL_SWITCH_PROFILE,
384
- "switch-passport": c.CANCEL_SWITCH_PASSPORT,
385
- "bind-wallet": c.CANCEL_BIND_WALLET
386
- }, i = {
386
+ login: a.CANCEL_LOGIN,
387
+ "switch-profile": a.CANCEL_SWITCH_PROFILE,
388
+ "switch-passport": a.CANCEL_SWITCH_PASSPORT,
389
+ "bind-wallet": a.CANCEL_BIND_WALLET
390
+ }, t = {
387
391
  login: "offLogin",
388
392
  "switch-profile": "offSwitchProfile",
389
393
  "switch-passport": "offSwitchPassport",
390
394
  "bind-wallet": "offBindWallet"
391
395
  };
392
- d.emit(o[e]), globalThis.blocklet && (m(`bridge callArc: ${i[e]}`), A.callArc(`${i[e]}`));
393
- }), vo = f((e, ...o) => {
396
+ d.emit(o[e]), globalThis.blocklet && (h(`bridge callArc: ${t[e]}`), b.callArc(`${t[e]}`));
397
+ }), xo = f((e, ...o) => {
394
398
  try {
395
399
  ce[e](...o);
396
- } catch (i) {
400
+ } catch (t) {
397
401
  Oe.error("Catch error in onSuccess", {
398
402
  action: e,
399
403
  args: o,
400
- err: i
401
- }), ce[`${e}-failed`]?.(i, ...o);
404
+ err: t
405
+ }), ce[`${e}-failed`]?.(t, ...o);
402
406
  }
403
- }), xo = f((e, o, ...i) => {
404
- ce[`${e}-failed`]?.(o, ...i);
407
+ }), Oo = f((e, o, ...t) => {
408
+ ce[`${e}-failed`]?.(o, ...t);
405
409
  }), {
406
- federatedMaster: Oo,
407
- federatedEnabled: Ro,
408
- master: No
409
- } = Di({
410
- locale: b,
410
+ federatedMaster: Ro,
411
+ federatedEnabled: No,
412
+ master: Wo
413
+ } = _t({
414
+ locale: P,
411
415
  decrypt: _,
412
416
  login: we,
413
417
  handleLoginResult: x,
414
418
  handleRefreshUser: C,
415
419
  setRefreshToken: uo,
416
420
  setSessionToken: wo
417
- }), { checkMatch: Wo } = Ei({ protectedRoutes: r.protectedRoutes || [] }), Fo = De(go), Se = f(async () => (Po || (await So(), await E(100)), Fo.current)), j = f(() => {
418
- t.open = !1, k.close();
421
+ }), { checkMatch: Fo } = vt({ protectedRoutes: n.protectedRoutes || [] }), Bo = De(go), Se = f(async () => (Po || (await So(), await E(100)), Bo.current)), j = f(() => {
422
+ i.open = !1, y.close();
419
423
  }), F = async (e = {}) => {
420
- let o = t.action;
421
- s?.options?.origin === "switch-did" && (o = s?.options?.origin);
422
- const i = B[o], n = i[b] || i.en, l = {
423
- ...T.extraParams,
424
- ...r.extraParams,
425
- ...s.extraParams,
426
- previousUserDid: t?.user?.did,
427
- email: t?.user?.email
424
+ let o = i.action;
425
+ c?.options?.origin === "switch-did" && (o = c?.options?.origin);
426
+ const t = B[o], l = Ao(o, P) || t[P] || t.en, p = {
427
+ ...k.extraParams,
428
+ ...n.extraParams,
429
+ ...c.extraParams,
430
+ previousUserDid: i?.user?.did,
431
+ email: i?.user?.email
428
432
  };
429
- if (o === "switch-did" && l?.forceConnected) {
430
- const p = (a, h = {}) => li(B["switch-specified-did"], a, b, "en", h);
431
- n.title = p("title"), n.scan = p("scan", { did: l.forceConnected }), n.confirm = p("confirm"), n.success = p("success");
433
+ if (o === "switch-did" && p?.forceConnected) {
434
+ const r = (w, T = {}) => dt(B["switch-specified-did"], w, P, "en", T);
435
+ l.title = r("title"), l.scan = r("scan", { did: p.forceConnected }), l.confirm = r("confirm"), l.success = r("success");
432
436
  }
433
- delete l?.openMode;
434
- const u = {
435
- action: t.action,
436
- locale: b,
437
+ delete p?.openMode;
438
+ const g = {
439
+ action: i.action,
440
+ locale: P,
437
441
  hideCloseButton: e?.hideCloseButton,
438
- extraParams: l,
439
- options: { ...r.options || {}, ...s.options },
440
- checkTimeout: r.timeout,
441
- webWalletUrl: r.webWalletUrl,
442
- messages: n,
443
- useSocket: r.useSocket,
444
- ...Vo(r, [
442
+ extraParams: p,
443
+ options: { ...n.options || {}, ...c.options },
444
+ checkTimeout: n.timeout,
445
+ webWalletUrl: n.webWalletUrl,
446
+ messages: l,
447
+ useSocket: n.useSocket,
448
+ ...jo(n, [
445
449
  "action",
446
450
  "locale",
447
451
  // NOTICE: 将 serviceHost 也透传给 DID Connect 组件
@@ -460,7 +464,7 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
460
464
  "protectedRoutes"
461
465
  ]),
462
466
  // 允许 login/switchProfile/switchDid 的时候传入自定义参数
463
- ...jo(s.extraParams || {}, [
467
+ ...Ko(c.extraParams || {}, [
464
468
  "autoConnect",
465
469
  "forceConnected",
466
470
  "saveConnect",
@@ -469,44 +473,44 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
469
473
  ]),
470
474
  // baseUrl: state.baseUrl || props.baseUrl || '',
471
475
  // 注意 prefix 经过了特殊处理, 优先级高于 "...rest", 所以放在其后
472
- prefix: s.prefix,
473
- allowWallet: w(s.allowWallet) ? t.action !== "login" || ["1", "true", void 0, null].includes(globalThis.blocklet?.DID_CONNECT_ALLOW_WALLET) : s.allowWallet,
474
- onSuccess: async (...p) => {
475
- vo(t.action, ...p), Z(e?.onSuccess) && await e.onSuccess(...p), t.open = !1;
476
+ prefix: c.prefix,
477
+ allowWallet: u(c.allowWallet) ? i.action !== "login" || ["1", "true", void 0, null].includes(globalThis.blocklet?.DID_CONNECT_ALLOW_WALLET) : c.allowWallet,
478
+ onSuccess: async (...r) => {
479
+ xo(i.action, ...r), Z(e?.onSuccess) && await e.onSuccess(...r), i.open = !1;
476
480
  },
477
- onClose(...p) {
478
- Eo(t.action, ...p);
481
+ onClose(...r) {
482
+ vo(i.action, ...r);
479
483
  },
480
- onError(p) {
481
- console.error(t.action, p), xo(t.action, p, P.current);
484
+ onError(r) {
485
+ console.error(i.action, r), Oo(i.action, r, A.current);
482
486
  }
483
487
  };
484
- if (t.open = !0, ["login"].includes(t.action) && s.openMode === "window" && !(y.wallet || y.arcSphere))
488
+ if (i.open = !0, ["login"].includes(i.action) && c.openMode === "window" && !(I.wallet || I.arcSphere))
485
489
  try {
486
- const p = {
487
- ...u,
490
+ const r = {
491
+ ...g,
488
492
  baseUrl: window.location.origin
489
493
  };
490
- Zo(s.prefix) || (p.prefix = M(window.location.origin, r.serviceHost, s.prefix)), p.extraParams?.provider || (p.extraParams.provider = t?.user?.provider || "wallet"), await k.openPopup(p, { locale: b });
491
- } catch (p) {
492
- p instanceof xi && j(), p.message === "Timeout" ? ae.error(je[b] || je.en) : console.error(p);
494
+ et(c.prefix) || (r.prefix = H(window.location.origin, n.serviceHost, c.prefix)), r.extraParams?.provider || (r.extraParams.provider = i?.user?.provider || "wallet"), await y.openPopup(r, { locale: P });
495
+ } catch (r) {
496
+ r instanceof Ot && j(), r.message === "Timeout" ? ae.error(je[P] || je.en) : console.error(r);
493
497
  }
494
498
  else
495
- k.open(u);
499
+ y.open(g);
496
500
  }, Pe = f(async () => {
497
501
  const { params: e, url: o } = await ve();
498
502
  if (e) {
499
- const { switchBehavior: i, forceConnected: n, sourceAppPid: l, showClose: u } = e;
500
- n === t.user.did ? window.history.replaceState(null, "trim", o) : i === "required" ? ne(() => {
503
+ const { switchBehavior: t, forceConnected: s, sourceAppPid: l, showClose: p } = e;
504
+ s === i.user.did ? window.history.replaceState(null, "trim", o) : t === "required" ? ne(() => {
501
505
  }, {
502
506
  openMode: "redirect",
503
507
  redirect: o,
504
508
  sourceAppPid: l,
505
- forceConnected: n
506
- }) : i === "disabled" ? window.history.replaceState(null, "trim", o) : to.open({
507
- title: B.switchAccountDialog[b].title,
508
- content: /* @__PURE__ */ K(zo, { children: [
509
- /* @__PURE__ */ g(Yo, { variant: "body1", sx: { textAlign: "center", mb: 2 }, children: B.switchAccountDialog[b].description }),
509
+ forceConnected: s
510
+ }) : t === "disabled" ? window.history.replaceState(null, "trim", o) : io.open({
511
+ title: B.switchAccountDialog[P].title,
512
+ content: /* @__PURE__ */ K(Vo, { children: [
513
+ /* @__PURE__ */ m(Jo, { variant: "body1", sx: { textAlign: "center", mb: 2 }, children: B.switchAccountDialog[P].description }),
510
514
  /* @__PURE__ */ K($, { sx: { display: "flex", alignItems: "center", color: "grey.A700" }, children: [
511
515
  /* @__PURE__ */ K(
512
516
  $,
@@ -519,20 +523,20 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
519
523
  lineHeight: 1
520
524
  },
521
525
  children: [
522
- /* @__PURE__ */ g(Ee, { did: t.user.did, shape: "circle", variant: "circle", size: 80 }),
523
- /* @__PURE__ */ g(_e, { did: t.user.did, showAvatar: !1, compact: !0, responsive: !1 }),
524
- B.switchAccountDialog[b].currentAccount
526
+ /* @__PURE__ */ m(Ee, { did: i.user.did, shape: "circle", variant: "circle", size: 80 }),
527
+ /* @__PURE__ */ m(_e, { did: i.user.did, showAvatar: !1, compact: !0, responsive: !1 }),
528
+ B.switchAccountDialog[P].currentAccount
525
529
  ]
526
530
  }
527
531
  ),
528
- /* @__PURE__ */ g($, { sx: { display: "flex", justifyContent: "center", px: 2 }, children: /* @__PURE__ */ g(
532
+ /* @__PURE__ */ m($, { sx: { display: "flex", justifyContent: "center", px: 2 }, children: /* @__PURE__ */ m(
529
533
  $,
530
534
  {
531
- component: ri,
532
- icon: ni,
535
+ component: nt,
536
+ icon: st,
533
537
  sx: {
534
538
  fontSize: 24,
535
- color: io.grey[400],
539
+ color: to.grey[400],
536
540
  animation: "right 2.5s linear infinite",
537
541
  "@keyframes right": {
538
542
  "0%": {
@@ -563,126 +567,126 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
563
567
  fontWeight: 500
564
568
  },
565
569
  children: [
566
- /* @__PURE__ */ g(Ee, { did: n, shape: "circle", variant: "circle", size: 80 }),
567
- /* @__PURE__ */ g(_e, { did: n, showAvatar: !1, compact: !0, responsive: !1 }),
568
- B.switchAccountDialog[b].nextAccount
570
+ /* @__PURE__ */ m(Ee, { did: s, shape: "circle", variant: "circle", size: 80 }),
571
+ /* @__PURE__ */ m(_e, { did: s, showAvatar: !1, compact: !0, responsive: !1 }),
572
+ B.switchAccountDialog[P].nextAccount
569
573
  ]
570
574
  }
571
575
  )
572
576
  ] })
573
577
  ] }),
574
- showCloseButton: u,
578
+ showCloseButton: p,
575
579
  showCancelButton: !1,
576
- confirmButtonText: B.switchAccountDialog[b].confirm,
577
- async onConfirm(p) {
578
- const h = (await Se()).find((L) => L.userDid === n);
579
- if (h) {
580
- re(h).then((L) => {
580
+ confirmButtonText: B.switchAccountDialog[P].confirm,
581
+ async onConfirm(g) {
582
+ const w = (await Se()).find((T) => T.userDid === s);
583
+ if (w) {
584
+ re(w).then((T) => {
581
585
  ee(
582
586
  {
583
- connected_did: h.user.did,
584
- connected_pk: h.user.pk,
585
- connected_wallet_os: h.extra.walletOS,
587
+ connected_did: w.user.did,
588
+ connected_pk: w.user.pk,
589
+ connected_wallet_os: w.extra.walletOS,
586
590
  connected_app: oe()
587
591
  },
588
592
  !0
589
- ), x({ ...L, encrypted: !1 }), C({ showProgress: !0 }).then(async () => {
590
- await E(200), d.emit(c.LOGIN, L, _, P.current), O(P.current), await W();
593
+ ), x({ ...T, encrypted: !1 }), C({ showProgress: !0 }).then(async () => {
594
+ await E(200), d.emit(a.LOGIN, T, _, A.current), O(A.current), await W();
591
595
  }).catch((Ce) => {
592
- throw d.emit(c.LOGIN_FAILED, Ce), Ce;
596
+ throw d.emit(a.LOGIN_FAILED, Ce), Ce;
593
597
  });
594
- }), p();
598
+ }), g();
595
599
  return;
596
600
  }
597
601
  ne(
598
602
  () => {
599
- p(), window.location.replace(o);
603
+ g(), window.location.replace(o);
600
604
  },
601
- { sourceAppPid: l, forceConnected: n, enableSwitchApp: !1 },
605
+ { sourceAppPid: l, forceConnected: s, enableSwitchApp: !1 },
602
606
  { showQuickConnect: !0 }
603
607
  );
604
608
  }
605
609
  });
606
610
  }
607
- }), Bo = f(async (e, o) => {
608
- const i = Object.assign(
611
+ }), Uo = f(async (e, o) => {
612
+ const t = Object.assign(
609
613
  {
610
614
  login: !0,
611
615
  bindWallet: !0,
612
616
  bindDidSpaces: !1
613
617
  },
614
618
  o?.requirements
615
- ), n = o?.openMode || "popup";
616
- i.login && await N(), i.bindWallet && await new Promise((l) => {
619
+ ), s = o?.openMode || "popup";
620
+ t.login && await N(), t.bindWallet && await new Promise((l) => {
617
621
  ge(() => {
618
622
  l();
619
623
  });
620
- }), i.bindDidSpaces && (await Fe(t?.user) || await new Promise((l) => {
621
- i.bindDidSpaces === "full" ? W({
624
+ }), t.bindDidSpaces && (await Fe(i?.user) || await new Promise((l) => {
625
+ t.bindDidSpaces === "full" ? W({
622
626
  onSuccess() {
623
627
  l();
624
628
  }
625
- }) : i.bindDidSpaces === "read" && me({
629
+ }) : t.bindDidSpaces === "read" && me({
626
630
  onSuccess() {
627
631
  l();
628
632
  }
629
633
  });
630
- })), n === "window" ? k.openPopup(e, o) : n === "popup" && k.open(e);
634
+ })), s === "window" ? y.openPopup(e, o) : s === "popup" && y.open(e);
631
635
  });
632
636
  le(() => {
633
- const e = Number(t.unReadCount || 0);
637
+ const e = Number(i.unReadCount || 0);
634
638
  fe(e);
635
- }, [t.unReadCount]);
636
- const Uo = f(() => {
639
+ }, [i.unReadCount]);
640
+ const Mo = f(() => {
637
641
  U.get("magicToken") && U.delete("magicToken"), U.toString() && window.history.replaceState({}, "", `${window.location.pathname}?${U.toString()}`);
638
- }), Ae = f((e) => new Promise((o, i) => {
639
- k.open({
642
+ }), Ae = f((e) => new Promise((o, t) => {
643
+ y.open({
640
644
  action: "login",
641
- locale: b,
642
- prefix: s.prefix,
645
+ locale: P,
646
+ prefix: c.prefix,
643
647
  useSocket: !1,
644
648
  messages: {
645
- title: b === "zh" ? "验证 MagicLink Token" : "Verify MagicLink Token"
649
+ title: P === "zh" ? "验证 MagicLink Token" : "Verify MagicLink Token"
646
650
  },
647
651
  magicToken: e,
648
- onSuccess(...n) {
649
- V(...n), Uo(), o();
652
+ onSuccess(...s) {
653
+ V(...s), Mo(), o();
650
654
  },
651
- onError(n) {
652
- d.emit(c.LOGIN_FAILED, n), i(n);
655
+ onError(s) {
656
+ d.emit(a.LOGIN_FAILED, s), t(s);
653
657
  }
654
658
  });
655
659
  })), Ho = {
656
- ...t,
657
- loading: s.autoConnect && !t.user || t.loading,
658
- openDidConnect: Bo,
659
- login: te,
660
+ ...i,
661
+ loading: c.autoConnect && !i.user || i.loading,
662
+ openDidConnect: Uo,
663
+ login: ie,
660
664
  logout: he,
661
665
  switchDid: ne,
662
666
  autoSwitchDid: Pe,
663
- refreshProfile: Ao,
664
- switchProfile: bo,
665
- switchPassport: Co,
667
+ refreshProfile: bo,
668
+ switchProfile: Co,
669
+ switchPassport: To,
666
670
  connectToDidSpaceForImport: me,
667
671
  connectToDidSpaceForFullAccess: W,
668
672
  bindWallet: ge,
669
673
  refresh: C,
670
674
  updateConnectedInfo: ee,
671
675
  // federated relates
672
- federatedMaster: Oo,
676
+ federatedMaster: Ro,
673
677
  // oauth relates
674
- useOAuth: bi,
678
+ useOAuth: Ct,
675
679
  OAuthProvider: Ne,
676
- OAuthConsumer: Ai,
677
- OAuthContext: Pi,
680
+ OAuthConsumer: bt,
681
+ OAuthContext: At,
678
682
  // passkey relates
679
- usePasskey: ki,
683
+ usePasskey: yt,
680
684
  PasskeyProvider: We,
681
- PasskeyConsumer: Ti,
682
- PasskeyContext: Ci,
685
+ PasskeyConsumer: kt,
686
+ PasskeyContext: Tt,
683
687
  // user related
684
- useDid: yi,
685
- WrapDid: Li,
688
+ useDid: It,
689
+ WrapDid: Dt,
686
690
  getUserSessions: Se,
687
691
  async loginUserSession(e) {
688
692
  try {
@@ -695,9 +699,9 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
695
699
  connected_app: oe()
696
700
  },
697
701
  !0
698
- ), x({ ...o, encrypted: !1 }), await C({ showProgress: !0 }), await E(200), d.emit(c.LOGIN, o, _, P.current), O(P.current), await W();
702
+ ), x({ ...o, encrypted: !1 }), await C({ showProgress: !0 }), await E(200), d.emit(a.LOGIN, o, _, A.current), O(A.current), await W();
699
703
  } catch (o) {
700
- throw d.emit(c.LOGIN_FAILED, o), o;
704
+ throw d.emit(a.LOGIN_FAILED, o), o;
701
705
  }
702
706
  },
703
707
  unReadCount: eo,
@@ -705,159 +709,159 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
705
709
  verifyMagicToken: Ae,
706
710
  // 二次认证相关方法
707
711
  withSecondaryAuth: mo
708
- }, P = De(Ho), Mo = {
712
+ }, A = De(Ho), Go = {
709
713
  api: lo,
710
714
  events: d,
711
715
  storage: Y,
712
- connectApi: k,
713
- session: P.current
716
+ connectApi: y,
717
+ session: A.current
714
718
  }, ce = {
715
719
  login: V,
716
- "switch-profile": _o,
720
+ "switch-profile": Eo,
717
721
  "switch-passport": se,
718
- "switch-passport-failed": yo,
719
- "bind-wallet": Lo,
720
- "bind-wallet-failed": Do,
721
- "login-failed": Io
722
+ "switch-passport-failed": Io,
723
+ "bind-wallet": Do,
724
+ "bind-wallet-failed": _o,
725
+ "login-failed": Lo
722
726
  };
723
727
  le(() => {
724
- if (t.initialized) {
728
+ if (i.initialized) {
725
729
  const e = !no;
726
- if (d.emit("change", { user: Te(t.user), isFirst: e }), t.user && globalThis.blocklet) {
730
+ if (d.emit("change", { user: Te(i.user), isFirst: e }), i.user && globalThis.blocklet) {
727
731
  const o = {
728
- did: t.user.did,
732
+ did: i.user.did,
729
733
  host: window.location.host,
730
734
  appPid: globalThis.blocklet.appPid,
731
735
  visitorId: q(),
732
- sourceAppPid: t.user.sourceAppPid,
733
- fullName: t.user.fullName
736
+ sourceAppPid: i.user.sourceAppPid,
737
+ fullName: i.user.fullName
734
738
  };
735
- m("bridge callArc: onChange", {
739
+ h("bridge callArc: onChange", {
736
740
  isFirst: e,
737
741
  user: o
738
- }), A.callArc("onChange", {
742
+ }), b.callArc("onChange", {
739
743
  ...o,
740
744
  user: o,
741
745
  isFirst: e
742
746
  });
743
747
  }
744
748
  }
745
- }, [t.user, t.initialized, d]), le(() => {
746
- t.initialized && t.user && Pe();
747
- }, [t.initialized]), ti(async () => {
748
- const e = (a) => {
749
- ui(a.encrypted) && (a.encrypted = !1), window.temporaryDIDConnectOnSuccess instanceof Function ? (m("bridgeOnLogin: temporaryDIDConnectOnSuccess", { result: a }), window.temporaryDIDConnectOnSuccess(a, (h) => h)) : (m("bridgeOnLogin: onLogin", { result: a }), V(a));
749
+ }, [i.user, i.initialized, d]), le(() => {
750
+ i.initialized && i.user && Pe();
751
+ }, [i.initialized]), rt(async () => {
752
+ const e = (r) => {
753
+ wt(r.encrypted) && (r.encrypted = !1), window.temporaryDIDConnectOnSuccess instanceof Function ? (h("bridgeOnLogin: temporaryDIDConnectOnSuccess", { result: r }), window.temporaryDIDConnectOnSuccess(r, (w) => w)) : (h("bridgeOnLogin: onLogin", { result: r }), V(r));
750
754
  };
751
- if (A.registerBlocklet("callLoginOAuth", (a) => {
752
- m("bridge registerBlocklet: callLoginOAuth", a), k.loginOAuth({
753
- ...a,
755
+ if (b.registerBlocklet("callLoginOAuth", (r) => {
756
+ h("bridge registerBlocklet: callLoginOAuth", r), y.loginOAuth({
757
+ ...r,
754
758
  onLogin: e
755
759
  });
756
- }), A.registerBlocklet("logout", he), A.registerBlocklet("login", (a) => {
757
- m("bridge registerBlocklet: login", a), e(a);
758
- }), ei(), !q()) {
759
- if (y.arcSphere) {
760
- m("bridge callArc: getVisitorId");
761
- const a = await A.callArc("getVisitorId");
762
- m("bridge callArc: getVisitorId result", { walletVisitorId: a }), ke(a);
763
- } else if (y.wallet) {
764
- const a = await Fi();
765
- ke(a);
760
+ }), b.registerBlocklet("logout", he), b.registerBlocklet("login", (r) => {
761
+ h("bridge registerBlocklet: login", r), e(r);
762
+ }), ot(), !q()) {
763
+ if (I.arcSphere) {
764
+ h("bridge callArc: getVisitorId");
765
+ const r = await b.callArc("getVisitorId");
766
+ h("bridge callArc: getVisitorId result", { walletVisitorId: r }), ke(r);
767
+ } else if (I.wallet) {
768
+ const r = await Bt();
769
+ ke(r);
766
770
  }
767
771
  }
768
- const i = $o.get("connected_app"), n = oe();
769
- if (r.autoDisconnect && i && n && i !== n) {
772
+ const t = qo.get("connected_app"), s = oe();
773
+ if (n.autoDisconnect && t && s && t !== s) {
770
774
  xe("[clearSession] createSessionContext -> SessionProvider -> useMount: autoDisconnect", {
771
- autoDisconnect: r.autoDisconnect,
772
- connectedApp: i,
773
- actualApp: n
774
- }), ue(), t.initialized = !0, s.autoConnect ? F() : j();
775
+ autoDisconnect: n.autoDisconnect,
776
+ connectedApp: t,
777
+ actualApp: s
778
+ }), ue(), i.initialized = !0, c.autoConnect ? F() : j();
775
779
  return;
776
780
  }
777
781
  const l = po();
778
782
  if (window?.self === window?.parent) {
779
- let a = "web";
780
- if (y.mobile.apple.device ? a = "ios" : y.mobile.android.device && (a = "android"), y.wallet && Bi({ version: y.walletVersion, platform: a }) && !l)
783
+ let r = "web";
784
+ if (I.mobile.apple.device ? r = "ios" : I.mobile.android.device && (r = "android"), I.wallet && Ut({ version: I.walletVersion, platform: r }) && !l)
781
785
  try {
782
- t.loading = !0;
783
- const h = await Ui();
784
- if (h) {
786
+ i.loading = !0;
787
+ const w = await Mt();
788
+ if (w) {
785
789
  await V({
786
- sessionToken: h.sessionToken,
787
- refreshToken: h.refreshToken,
788
- csrfToken: h.csrfToken,
789
- visitorId: h.visitorId,
790
+ sessionToken: w.sessionToken,
791
+ refreshToken: w.refreshToken,
792
+ csrfToken: w.csrfToken,
793
+ visitorId: w.visitorId,
790
794
  encrypted: !1
791
- }), t.initialized = !0;
795
+ }), i.initialized = !0;
792
796
  return;
793
797
  }
794
- } catch (h) {
795
- throw d.emit(c.LOGIN_FAILED, h), h;
798
+ } catch (w) {
799
+ throw d.emit(a.LOGIN_FAILED, w), w;
796
800
  } finally {
797
- t.loading = !1;
801
+ i.loading = !1;
798
802
  }
799
803
  }
800
- const u = U.get("magicToken");
801
- if (u)
804
+ const p = U.get("magicToken");
805
+ if (p)
802
806
  try {
803
- t.initialized = !0, await Ae(u);
804
- } catch (a) {
805
- console.error("verifyMagicToken failed", a);
807
+ i.initialized = !0, await Ae(p);
808
+ } catch (r) {
809
+ console.error("verifyMagicToken failed", r);
806
810
  }
807
811
  if (l) {
808
- await C({ showProgress: !0 }), t.initialized = !0, t.user && await W();
812
+ await C({ showProgress: !0 }), i.initialized = !0, i.user && await W();
809
813
  return;
810
814
  }
811
815
  if (typeof window < "u") {
812
- const a = new URL(window.location.href), h = a.searchParams.get("loginToken");
813
- if (h) {
814
- x({ loginToken: h, encrypted: !1 }), a.searchParams.delete("loginToken"), window.history.replaceState({}, window.title, a.href);
816
+ const r = new URL(window.location.href), w = r.searchParams.get("loginToken");
817
+ if (w) {
818
+ x({ loginToken: w, encrypted: !1 }), r.searchParams.delete("loginToken"), window.history.replaceState({}, window.title, r.href);
815
819
  return;
816
820
  }
817
821
  }
818
822
  if (fo()) {
819
- await co(!0), t.initialized = !0;
823
+ await co(!0), i.initialized = !0;
820
824
  return;
821
825
  }
822
- if (t.initialized = !0, s.autoConnect ? F() : j(), y.arcSphere && ![
826
+ if (i.initialized = !0, c.autoConnect ? F() : j(), I.arcSphere && ![
823
827
  // 不应该唤起自动登录的路由
824
- M(G, "login"),
825
- M(G, "connect"),
826
- M(G, "lost-passport")
828
+ H(G, "login"),
829
+ H(G, "connect"),
830
+ H(G, "lost-passport")
827
831
  ].includes(window.location.pathname) && !l)
828
832
  try {
829
- m("bridge callArc: autoLogin");
830
- const a = await A.callArc("autoLogin");
831
- m("bridgecallArc: autoLogin result", a), a && await V({
832
- sessionToken: a.sessionToken,
833
- refreshToken: a.refreshToken,
834
- csrfToken: a.csrfToken,
835
- visitorId: a.visitorId,
833
+ h("bridge callArc: autoLogin");
834
+ const r = await b.callArc("autoLogin");
835
+ h("bridgecallArc: autoLogin result", r), r && await V({
836
+ sessionToken: r.sessionToken,
837
+ refreshToken: r.refreshToken,
838
+ csrfToken: r.csrfToken,
839
+ visitorId: r.visitorId,
836
840
  encrypted: !1
837
841
  });
838
- } catch (a) {
839
- d.emit(c.LOGIN_FAILED, a), Oe.error("Failed to autoLogin ArcSphere", a);
842
+ } catch (r) {
843
+ d.emit(a.LOGIN_FAILED, r), Oe.error("Failed to autoLogin ArcSphere", r);
840
844
  }
841
845
  });
842
- const Go = U.has("popup");
843
- if (Wo() && !t.initialized)
844
- return /* @__PURE__ */ g(oi, { children: Go ? null : /* @__PURE__ */ g(Jo, {}) });
846
+ const zo = U.has("popup");
847
+ if (Fo() && !i.initialized)
848
+ return /* @__PURE__ */ m(tt, { children: zo ? null : /* @__PURE__ */ m(Zo, {}) });
845
849
  const be = {
846
- locale: b,
847
- onSwitchPassport: ({ sessionToken: e, refreshToken: o, csrfToken: i }) => se({ sessionToken: e, refreshToken: o, csrfToken: i, encrypted: !1 }),
850
+ locale: P,
851
+ onSwitchPassport: ({ sessionToken: e, refreshToken: o, csrfToken: t }) => se({ sessionToken: e, refreshToken: o, csrfToken: t, encrypted: !1 }),
848
852
  onUnbindOAuth: () => C(),
849
853
  onBindOAuth: () => C(),
850
854
  onAddPasskey: () => C(),
851
855
  onRemovePasskey: () => C(),
852
- session: P.current
856
+ session: A.current
853
857
  };
854
- return /* @__PURE__ */ g(ji, { value: Mo, children: /* @__PURE__ */ g(We, { ...be, children: /* @__PURE__ */ K(Ne, { ...be, children: [
855
- !t.open && typeof r.children == "function" ? r.children(t) : r.children,
858
+ return /* @__PURE__ */ m(Kt, { value: Go, children: /* @__PURE__ */ m(We, { ...be, children: /* @__PURE__ */ K(Ne, { ...be, children: [
859
+ !i.open && typeof n.children == "function" ? n.children(i) : n.children,
856
860
  Ze,
857
861
  ro,
858
- ko,
859
- T.rolling && /* @__PURE__ */ g(Re, { callback: () => ao() }),
860
- /* @__PURE__ */ g(Re, { callback: so })
862
+ yo,
863
+ k.rolling && /* @__PURE__ */ m(Re, { callback: () => ao() }),
864
+ /* @__PURE__ */ m(Re, { callback: so })
861
865
  ] }) }) });
862
866
  }
863
867
  pe.propTypes = {
@@ -881,26 +885,26 @@ function $e(X = Xe, Q = "ls", ie = {}, T = {}) {
881
885
  apiOptions: S.object,
882
886
  lazyRefreshToken: S.bool
883
887
  };
884
- function Je(I) {
885
- return function(r) {
886
- return /* @__PURE__ */ g(ye, { children: /* @__PURE__ */ g(Ve, { children: (k) => /* @__PURE__ */ g(I, { ...r, ...k }) }) });
888
+ function Je(L) {
889
+ return function(n) {
890
+ return /* @__PURE__ */ m(ye, { children: /* @__PURE__ */ m(Ve, { children: (y) => /* @__PURE__ */ m(L, { ...n, ...y }) }) });
887
891
  };
888
892
  }
889
893
  return {
890
- SessionProvider: (I) => /* @__PURE__ */ g(ye, { children: /* @__PURE__ */ g(Gi, { children: /* @__PURE__ */ g(pe, { ...I }) }) }),
894
+ SessionProvider: (L) => /* @__PURE__ */ m(ye, { children: /* @__PURE__ */ m(zt, { children: /* @__PURE__ */ m(pe, { ...L }) }) }),
891
895
  SessionConsumer: Ve,
892
896
  SessionContext: qe,
893
897
  withSession: Je
894
898
  };
895
899
  }
896
- function qt({ storageEngine: X = "cookie" } = {}) {
897
- const Q = Xe, ie = Qe;
898
- let T = null;
899
- if (typeof window < "u" && (T = (globalThis.blocklet || {}).componentId), X === "cookie") {
900
+ function Xi({ storageEngine: X = "cookie" } = {}) {
901
+ const Q = Xe, te = Qe;
902
+ let k = null;
903
+ if (typeof window < "u" && (k = (globalThis.blocklet || {}).componentId), X === "cookie") {
900
904
  let D = "/", O = 1;
901
905
  if (typeof window < "u") {
902
906
  const Y = window.env || {}, z = window.blocklet || {};
903
- D = Y.groupPathPrefix || z.groupPrefix || z.prefix || "", D = D.replace(/\/+$/, ""), D = D || "/", z.serverVersion && (O = gi(window.blocklet?.settings?.session?.cacheTtl, 1 / 24));
907
+ D = Y.groupPathPrefix || z.groupPrefix || z.prefix || "", D = D.replace(/\/+$/, ""), D = D || "/", z.serverVersion && (O = St(window.blocklet?.settings?.session?.cacheTtl, 1 / 24));
904
908
  }
905
909
  return $e(
906
910
  Q,
@@ -912,8 +916,8 @@ function qt({ storageEngine: X = "cookie" } = {}) {
912
916
  },
913
917
  {
914
918
  appendAuthServicePrefix: !0,
915
- extraParams: { componentId: T },
916
- refreshTokenStorageKey: ie
919
+ extraParams: { componentId: k },
920
+ refreshTokenStorageKey: te
917
921
  }
918
922
  );
919
923
  }
@@ -922,16 +926,16 @@ function qt({ storageEngine: X = "cookie" } = {}) {
922
926
  throw new Error("storageEngine must be cookie or localStorage");
923
927
  }
924
928
  export {
925
- c as EVENTS,
929
+ a as EVENTS,
926
930
  qe as SessionContext,
927
- Bi as checkEnableAutoLogin,
928
- qt as createAuthServiceSessionContext,
931
+ Ut as checkEnableAutoLogin,
932
+ Xi as createAuthServiceSessionContext,
929
933
  $e as createSessionContext,
930
934
  $e as default,
931
935
  Fe as didSpacesIsRequired,
932
- Fi as getMobileVisitorId,
933
- Ui as login,
934
- Yt as loginFederatedMaster,
935
- Jt as mountFederatedIframe,
936
+ Bt as getMobileVisitorId,
937
+ Mt as login,
938
+ Ji as loginFederatedMaster,
939
+ Zi as mountFederatedIframe,
936
940
  B as translations
937
941
  };