@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.
- package/lib/Connect/components/login-item/connect-provider-list.js +34 -34
- package/lib/Connect/hooks/provider-list.js +29 -29
- package/lib/Passkey/context.js +65 -62
- package/lib/Session/index.js +425 -421
- package/lib/package.json.js +1 -1
- package/package.json +5 -5
- package/src/Connect/components/login-item/connect-provider-list.jsx +2 -2
- package/src/Connect/hooks/provider-list.js +7 -6
- package/src/Passkey/context.jsx +3 -0
- package/src/Session/index.jsx +15 -2
package/lib/Session/index.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m, jsxs as K, Fragment as Vo } from "react/jsx-runtime";
|
|
2
2
|
import S from "prop-types";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useTheme as
|
|
13
|
-
import { getVisitorId as q, isUrl as
|
|
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
|
|
16
|
-
import { useReactive as Ie, useCreation as Le, useMemoizedFn as f, usePrevious as
|
|
17
|
-
import { joinURL as
|
|
18
|
-
import { Icon as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
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
|
|
25
|
-
import { translate as
|
|
26
|
-
import { getBlockletSDK as
|
|
27
|
-
import
|
|
28
|
-
import { getFederatedEnabled as
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import { ReactGA as
|
|
32
|
-
import { useState as
|
|
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
|
|
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
|
|
37
|
-
import { PasskeyContext as
|
|
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
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
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
|
|
46
|
-
import { EVENTS as
|
|
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
|
|
49
|
-
import { SESSION_TOKEN_STORAGE_KEY as Xe, REFRESH_TOKEN_STORAGE_KEY as Qe, CSRF_TOKEN_STORAGE_KEY as
|
|
50
|
-
import { getMobileVisitorId as
|
|
51
|
-
import
|
|
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
|
|
54
|
-
import { FederatedProvider as
|
|
55
|
-
import
|
|
56
|
-
import { gaLoginSuccessHandler as Be, gaLoginFailedHandler as Ue, gaSwitchPassportSuccessHandler as
|
|
57
|
-
import { loginFederatedMaster as
|
|
58
|
-
const { Provider:
|
|
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",
|
|
65
|
+
function $e(X = Xe, Q = "ls", te = {}, k = {}) {
|
|
66
66
|
let D = "/";
|
|
67
|
-
globalThis?.blocklet?.prefix && (D = globalThis.blocklet.prefix), typeof
|
|
68
|
-
appendAuthServicePrefix:
|
|
67
|
+
globalThis?.blocklet?.prefix && (D = globalThis.blocklet.prefix), typeof k == "boolean" && (k = {
|
|
68
|
+
appendAuthServicePrefix: k,
|
|
69
69
|
extraParams: {}
|
|
70
|
-
}),
|
|
70
|
+
}), $o(k, {
|
|
71
71
|
rolling: !0,
|
|
72
72
|
appendAuthServicePrefix: !1,
|
|
73
73
|
extraParams: {},
|
|
74
74
|
refreshTokenStorageKey: Qe
|
|
75
75
|
});
|
|
76
|
-
function O(
|
|
76
|
+
function O(L) {
|
|
77
77
|
if (globalThis.blocklet)
|
|
78
|
-
if (
|
|
78
|
+
if (L?.user) {
|
|
79
79
|
const v = {
|
|
80
|
-
did:
|
|
80
|
+
did: L.user.did,
|
|
81
81
|
host: window.location.host,
|
|
82
82
|
appPid: globalThis.blocklet.appPid,
|
|
83
83
|
visitorId: q(),
|
|
84
|
-
sourceAppPid:
|
|
85
|
-
fullName:
|
|
84
|
+
sourceAppPid: L.user.sourceAppPid,
|
|
85
|
+
fullName: L.user.fullName
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
h("bridge callArc: onLogin", v), b.callArc("onLogin", { ...v, user: v });
|
|
88
88
|
} else
|
|
89
|
-
|
|
89
|
+
b.callArc("onLogin", { error: "no user", code: 400 }), h("notifyBridge failed", { sessionState: L });
|
|
90
90
|
}
|
|
91
|
-
const Y = de(X, Q,
|
|
91
|
+
const Y = de(X, Q, te), z = de(Rt, "cookie", {
|
|
92
92
|
secure: !0,
|
|
93
93
|
sameSite: "strict"
|
|
94
|
-
}), Ye = de(
|
|
95
|
-
function pe({ ...
|
|
96
|
-
const v =
|
|
97
|
-
|
|
98
|
-
const { connectApi:
|
|
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:
|
|
101
|
+
currentLocale: n.locale,
|
|
102
102
|
allowWallet: void 0,
|
|
103
103
|
openMode: "window",
|
|
104
104
|
get autoConnect() {
|
|
105
|
-
return typeof
|
|
105
|
+
return typeof n.autoConnect == "boolean" ? n.autoConnect : !!n.autoLogin;
|
|
106
106
|
},
|
|
107
107
|
get prefix() {
|
|
108
|
-
return
|
|
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
|
|
112
|
+
return k.appendAuthServicePrefix || n.appendAuthServicePrefix ? H(G, e) : e;
|
|
113
113
|
}
|
|
114
|
-
}),
|
|
115
|
-
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
|
-
}),
|
|
127
|
-
if (
|
|
128
|
-
const e = Ke[
|
|
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
|
|
132
|
-
|
|
133
|
-
d.off(
|
|
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
|
|
136
|
-
const
|
|
137
|
-
login: [
|
|
138
|
-
"bind-wallet": [
|
|
139
|
-
"switch-passport": [
|
|
140
|
-
"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": [
|
|
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": [
|
|
144
|
+
"did-space-connected": [a.DID_SPACE_CONNECTED]
|
|
145
145
|
};
|
|
146
|
-
if (!Object.keys(
|
|
146
|
+
if (!Object.keys(s).includes(e))
|
|
147
147
|
return;
|
|
148
|
-
const l = async (...
|
|
149
|
-
Z(o) && await o(...
|
|
148
|
+
const l = async (...p) => {
|
|
149
|
+
Z(o) && await o(...p), d.emit(e, ...p);
|
|
150
150
|
};
|
|
151
|
-
d.once(
|
|
152
|
-
Z(l) && d.off(
|
|
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 =
|
|
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
|
-
} =
|
|
168
|
-
state:
|
|
169
|
-
pageState:
|
|
167
|
+
} = Et({
|
|
168
|
+
state: i,
|
|
169
|
+
pageState: c,
|
|
170
170
|
sessionTokenStorage: Y,
|
|
171
171
|
refreshTokenStorage: Ye,
|
|
172
172
|
csrfTokenStorage: z,
|
|
173
|
-
serviceHost:
|
|
174
|
-
apiOptions:
|
|
175
|
-
lazyRefreshToken:
|
|
176
|
-
onRefresh({ type: e, sessionToken: o, refreshToken:
|
|
177
|
-
if (
|
|
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:
|
|
179
|
+
did: s.did,
|
|
180
180
|
host: window.location.host,
|
|
181
181
|
appPid: globalThis.blocklet.appPid,
|
|
182
182
|
visitorId: q(),
|
|
183
|
-
sourceAppPid:
|
|
184
|
-
fullName:
|
|
183
|
+
sourceAppPid: s.sourceAppPid,
|
|
184
|
+
fullName: s.fullName
|
|
185
185
|
};
|
|
186
|
-
e === "refreshToken" ? (
|
|
186
|
+
e === "refreshToken" ? (h("bridge callArc: onRefreshToken"), b.callArc("onRefreshToken", {
|
|
187
187
|
sessionToken: o,
|
|
188
|
-
refreshToken:
|
|
188
|
+
refreshToken: t,
|
|
189
189
|
user: l
|
|
190
|
-
})) : e === "refreshUser" && (
|
|
190
|
+
})) : e === "refreshUser" && (h("bridge callArc: onRefreshUser"), b.callArc("onRefreshUser", {
|
|
191
191
|
sessionToken: o,
|
|
192
|
-
refreshToken:
|
|
192
|
+
refreshToken: t,
|
|
193
193
|
user: l
|
|
194
194
|
}));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
}), ho =
|
|
197
|
+
}), ho = jt({ state: i, connectApi: y }), we = f((e, o = {}, t = {}) => {
|
|
198
198
|
R();
|
|
199
|
-
const
|
|
200
|
-
typeof
|
|
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
|
|
202
|
+
const t = e;
|
|
203
203
|
return function(...l) {
|
|
204
|
-
const
|
|
204
|
+
const p = this;
|
|
205
205
|
return (async () => {
|
|
206
206
|
try {
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
207
|
+
const g = await ho(o);
|
|
208
|
+
if (!g.sessionId)
|
|
209
209
|
throw new Error("Authentication failed");
|
|
210
|
-
return await
|
|
211
|
-
} catch (
|
|
212
|
-
throw console.error("Authentication failed",
|
|
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
|
-
}),
|
|
216
|
+
}), ie = f(async (e, o = {}, t = {}) => {
|
|
217
217
|
R();
|
|
218
|
-
const
|
|
219
|
-
typeof
|
|
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 (
|
|
222
|
-
const
|
|
223
|
-
|
|
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
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
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((
|
|
235
|
-
console.warn("Failed to logout remote",
|
|
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
|
|
237
|
+
const t = {
|
|
238
238
|
visitorId: o,
|
|
239
239
|
appPid: globalThis.blocklet.appPid,
|
|
240
|
-
userDid:
|
|
240
|
+
userDid: i.user.did
|
|
241
241
|
};
|
|
242
|
-
|
|
242
|
+
h("bridge callArc: onLogout", t), b.callArc("onLogout", t);
|
|
243
243
|
}
|
|
244
|
-
xe("[clearSession] createSessionContext -> logout:"), ue(), j(),
|
|
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
|
-
} =
|
|
253
|
-
appPid:
|
|
252
|
+
} = Ht({
|
|
253
|
+
appPid: lt(i.user),
|
|
254
254
|
loginAppPid: globalThis?.blocklet?.appPid,
|
|
255
|
-
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
|
-
|
|
260
|
-
|
|
263
|
+
i?.user || await new Promise((e) => {
|
|
264
|
+
ie(() => {
|
|
261
265
|
e();
|
|
262
266
|
});
|
|
263
267
|
});
|
|
264
|
-
}), ne = f((e, o = {},
|
|
268
|
+
}), ne = f((e, o = {}, t = {}) => {
|
|
265
269
|
R();
|
|
266
|
-
const
|
|
267
|
-
typeof
|
|
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:
|
|
271
|
-
connected_pk:
|
|
272
|
-
connected_wallet_os:
|
|
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
|
-
),
|
|
277
|
-
await E(200), d.emit(
|
|
278
|
-
}).catch((
|
|
279
|
-
throw d.emit(
|
|
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
|
-
}) : (
|
|
282
|
-
}),
|
|
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
|
|
291
|
-
typeof
|
|
292
|
-
}), To = f(async (
|
|
293
|
-
|
|
294
|
-
|
|
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
|
-
},
|
|
304
|
+
}, c.options = {}, i.action = "connect-to-did-spaces-for-user", F({
|
|
301
305
|
hideCloseButton: !0,
|
|
302
306
|
onSuccess: o,
|
|
303
|
-
...
|
|
307
|
+
...t
|
|
304
308
|
});
|
|
305
309
|
}), me = f(async ({ extraParams: e = {}, onSuccess: o = {} } = {}) => {
|
|
306
|
-
await N(),
|
|
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:
|
|
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(
|
|
320
|
-
const
|
|
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,
|
|
335
|
-
const
|
|
336
|
-
await v.user.updateDidSpace({ spaceGateway:
|
|
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(),
|
|
343
|
+
console.error(l), ae.error(l.message), J.close(), t(!1);
|
|
340
344
|
},
|
|
341
345
|
onClose: () => {
|
|
342
|
-
|
|
346
|
+
t();
|
|
343
347
|
}
|
|
344
348
|
};
|
|
345
|
-
|
|
346
|
-
baseUrl:
|
|
349
|
+
y.openPopup(s, {
|
|
350
|
+
baseUrl: Ft
|
|
347
351
|
});
|
|
348
352
|
}));
|
|
349
353
|
}, ge = f(async (e, o = {}) => {
|
|
350
|
-
if (await N(),
|
|
351
|
-
e({}, _,
|
|
354
|
+
if (await N(), Lt(i.user)) {
|
|
355
|
+
e({}, _, A.current);
|
|
352
356
|
return;
|
|
353
357
|
}
|
|
354
358
|
R();
|
|
355
|
-
const
|
|
356
|
-
typeof
|
|
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
|
-
|
|
359
|
-
}),
|
|
360
|
-
d.emit(
|
|
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 (
|
|
366
|
+
if (i.action === "switch-passport") {
|
|
363
367
|
se(e);
|
|
364
368
|
return;
|
|
365
369
|
}
|
|
366
|
-
|
|
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
|
-
|
|
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
|
-
|
|
375
|
-
|
|
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
|
-
|
|
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:
|
|
383
|
-
"switch-profile":
|
|
384
|
-
"switch-passport":
|
|
385
|
-
"bind-wallet":
|
|
386
|
-
},
|
|
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 && (
|
|
393
|
-
}),
|
|
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 (
|
|
400
|
+
} catch (t) {
|
|
397
401
|
Oe.error("Catch error in onSuccess", {
|
|
398
402
|
action: e,
|
|
399
403
|
args: o,
|
|
400
|
-
err:
|
|
401
|
-
}), ce[`${e}-failed`]?.(
|
|
404
|
+
err: t
|
|
405
|
+
}), ce[`${e}-failed`]?.(t, ...o);
|
|
402
406
|
}
|
|
403
|
-
}),
|
|
404
|
-
ce[`${e}-failed`]?.(o, ...
|
|
407
|
+
}), Oo = f((e, o, ...t) => {
|
|
408
|
+
ce[`${e}-failed`]?.(o, ...t);
|
|
405
409
|
}), {
|
|
406
|
-
federatedMaster:
|
|
407
|
-
federatedEnabled:
|
|
408
|
-
master:
|
|
409
|
-
} =
|
|
410
|
-
locale:
|
|
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:
|
|
418
|
-
|
|
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 =
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
...
|
|
424
|
-
...
|
|
425
|
-
...
|
|
426
|
-
previousUserDid:
|
|
427
|
-
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" &&
|
|
430
|
-
const
|
|
431
|
-
|
|
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
|
|
434
|
-
const
|
|
435
|
-
action:
|
|
436
|
-
locale:
|
|
437
|
+
delete p?.openMode;
|
|
438
|
+
const g = {
|
|
439
|
+
action: i.action,
|
|
440
|
+
locale: P,
|
|
437
441
|
hideCloseButton: e?.hideCloseButton,
|
|
438
|
-
extraParams:
|
|
439
|
-
options: { ...
|
|
440
|
-
checkTimeout:
|
|
441
|
-
webWalletUrl:
|
|
442
|
-
messages:
|
|
443
|
-
useSocket:
|
|
444
|
-
...
|
|
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
|
-
...
|
|
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:
|
|
473
|
-
allowWallet:
|
|
474
|
-
onSuccess: async (...
|
|
475
|
-
|
|
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(...
|
|
478
|
-
|
|
481
|
+
onClose(...r) {
|
|
482
|
+
vo(i.action, ...r);
|
|
479
483
|
},
|
|
480
|
-
onError(
|
|
481
|
-
console.error(
|
|
484
|
+
onError(r) {
|
|
485
|
+
console.error(i.action, r), Oo(i.action, r, A.current);
|
|
482
486
|
}
|
|
483
487
|
};
|
|
484
|
-
if (
|
|
488
|
+
if (i.open = !0, ["login"].includes(i.action) && c.openMode === "window" && !(I.wallet || I.arcSphere))
|
|
485
489
|
try {
|
|
486
|
-
const
|
|
487
|
-
...
|
|
490
|
+
const r = {
|
|
491
|
+
...g,
|
|
488
492
|
baseUrl: window.location.origin
|
|
489
493
|
};
|
|
490
|
-
|
|
491
|
-
} catch (
|
|
492
|
-
|
|
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
|
-
|
|
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:
|
|
500
|
-
|
|
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:
|
|
506
|
-
}) :
|
|
507
|
-
title: B.switchAccountDialog[
|
|
508
|
-
content: /* @__PURE__ */ K(
|
|
509
|
-
/* @__PURE__ */
|
|
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__ */
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
B.switchAccountDialog[
|
|
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__ */
|
|
532
|
+
/* @__PURE__ */ m($, { sx: { display: "flex", justifyContent: "center", px: 2 }, children: /* @__PURE__ */ m(
|
|
529
533
|
$,
|
|
530
534
|
{
|
|
531
|
-
component:
|
|
532
|
-
icon:
|
|
535
|
+
component: nt,
|
|
536
|
+
icon: st,
|
|
533
537
|
sx: {
|
|
534
538
|
fontSize: 24,
|
|
535
|
-
color:
|
|
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__ */
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
B.switchAccountDialog[
|
|
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:
|
|
578
|
+
showCloseButton: p,
|
|
575
579
|
showCancelButton: !1,
|
|
576
|
-
confirmButtonText: B.switchAccountDialog[
|
|
577
|
-
async onConfirm(
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
re(
|
|
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:
|
|
584
|
-
connected_pk:
|
|
585
|
-
connected_wallet_os:
|
|
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({ ...
|
|
590
|
-
await E(200), d.emit(
|
|
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(
|
|
596
|
+
throw d.emit(a.LOGIN_FAILED, Ce), Ce;
|
|
593
597
|
});
|
|
594
|
-
}),
|
|
598
|
+
}), g();
|
|
595
599
|
return;
|
|
596
600
|
}
|
|
597
601
|
ne(
|
|
598
602
|
() => {
|
|
599
|
-
|
|
603
|
+
g(), window.location.replace(o);
|
|
600
604
|
},
|
|
601
|
-
{ sourceAppPid: l, forceConnected:
|
|
605
|
+
{ sourceAppPid: l, forceConnected: s, enableSwitchApp: !1 },
|
|
602
606
|
{ showQuickConnect: !0 }
|
|
603
607
|
);
|
|
604
608
|
}
|
|
605
609
|
});
|
|
606
610
|
}
|
|
607
|
-
}),
|
|
608
|
-
const
|
|
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
|
-
),
|
|
616
|
-
|
|
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
|
-
}),
|
|
621
|
-
|
|
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
|
-
}) :
|
|
629
|
+
}) : t.bindDidSpaces === "read" && me({
|
|
626
630
|
onSuccess() {
|
|
627
631
|
l();
|
|
628
632
|
}
|
|
629
633
|
});
|
|
630
|
-
})),
|
|
634
|
+
})), s === "window" ? y.openPopup(e, o) : s === "popup" && y.open(e);
|
|
631
635
|
});
|
|
632
636
|
le(() => {
|
|
633
|
-
const e = Number(
|
|
637
|
+
const e = Number(i.unReadCount || 0);
|
|
634
638
|
fe(e);
|
|
635
|
-
}, [
|
|
636
|
-
const
|
|
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,
|
|
639
|
-
|
|
642
|
+
}), Ae = f((e) => new Promise((o, t) => {
|
|
643
|
+
y.open({
|
|
640
644
|
action: "login",
|
|
641
|
-
locale:
|
|
642
|
-
prefix:
|
|
645
|
+
locale: P,
|
|
646
|
+
prefix: c.prefix,
|
|
643
647
|
useSocket: !1,
|
|
644
648
|
messages: {
|
|
645
|
-
title:
|
|
649
|
+
title: P === "zh" ? "验证 MagicLink Token" : "Verify MagicLink Token"
|
|
646
650
|
},
|
|
647
651
|
magicToken: e,
|
|
648
|
-
onSuccess(...
|
|
649
|
-
V(...
|
|
652
|
+
onSuccess(...s) {
|
|
653
|
+
V(...s), Mo(), o();
|
|
650
654
|
},
|
|
651
|
-
onError(
|
|
652
|
-
d.emit(
|
|
655
|
+
onError(s) {
|
|
656
|
+
d.emit(a.LOGIN_FAILED, s), t(s);
|
|
653
657
|
}
|
|
654
658
|
});
|
|
655
659
|
})), Ho = {
|
|
656
|
-
...
|
|
657
|
-
loading:
|
|
658
|
-
openDidConnect:
|
|
659
|
-
login:
|
|
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:
|
|
664
|
-
switchProfile:
|
|
665
|
-
switchPassport:
|
|
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:
|
|
676
|
+
federatedMaster: Ro,
|
|
673
677
|
// oauth relates
|
|
674
|
-
useOAuth:
|
|
678
|
+
useOAuth: Ct,
|
|
675
679
|
OAuthProvider: Ne,
|
|
676
|
-
OAuthConsumer:
|
|
677
|
-
OAuthContext:
|
|
680
|
+
OAuthConsumer: bt,
|
|
681
|
+
OAuthContext: At,
|
|
678
682
|
// passkey relates
|
|
679
|
-
usePasskey:
|
|
683
|
+
usePasskey: yt,
|
|
680
684
|
PasskeyProvider: We,
|
|
681
|
-
PasskeyConsumer:
|
|
682
|
-
PasskeyContext:
|
|
685
|
+
PasskeyConsumer: kt,
|
|
686
|
+
PasskeyContext: Tt,
|
|
683
687
|
// user related
|
|
684
|
-
useDid:
|
|
685
|
-
WrapDid:
|
|
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(
|
|
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(
|
|
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
|
-
},
|
|
712
|
+
}, A = De(Ho), Go = {
|
|
709
713
|
api: lo,
|
|
710
714
|
events: d,
|
|
711
715
|
storage: Y,
|
|
712
|
-
connectApi:
|
|
713
|
-
session:
|
|
716
|
+
connectApi: y,
|
|
717
|
+
session: A.current
|
|
714
718
|
}, ce = {
|
|
715
719
|
login: V,
|
|
716
|
-
"switch-profile":
|
|
720
|
+
"switch-profile": Eo,
|
|
717
721
|
"switch-passport": se,
|
|
718
|
-
"switch-passport-failed":
|
|
719
|
-
"bind-wallet":
|
|
720
|
-
"bind-wallet-failed":
|
|
721
|
-
"login-failed":
|
|
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 (
|
|
728
|
+
if (i.initialized) {
|
|
725
729
|
const e = !no;
|
|
726
|
-
if (d.emit("change", { user: Te(
|
|
730
|
+
if (d.emit("change", { user: Te(i.user), isFirst: e }), i.user && globalThis.blocklet) {
|
|
727
731
|
const o = {
|
|
728
|
-
did:
|
|
732
|
+
did: i.user.did,
|
|
729
733
|
host: window.location.host,
|
|
730
734
|
appPid: globalThis.blocklet.appPid,
|
|
731
735
|
visitorId: q(),
|
|
732
|
-
sourceAppPid:
|
|
733
|
-
fullName:
|
|
736
|
+
sourceAppPid: i.user.sourceAppPid,
|
|
737
|
+
fullName: i.user.fullName
|
|
734
738
|
};
|
|
735
|
-
|
|
739
|
+
h("bridge callArc: onChange", {
|
|
736
740
|
isFirst: e,
|
|
737
741
|
user: o
|
|
738
|
-
}),
|
|
742
|
+
}), b.callArc("onChange", {
|
|
739
743
|
...o,
|
|
740
744
|
user: o,
|
|
741
745
|
isFirst: e
|
|
742
746
|
});
|
|
743
747
|
}
|
|
744
748
|
}
|
|
745
|
-
}, [
|
|
746
|
-
|
|
747
|
-
}, [
|
|
748
|
-
const e = (
|
|
749
|
-
|
|
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 (
|
|
752
|
-
|
|
753
|
-
...
|
|
755
|
+
if (b.registerBlocklet("callLoginOAuth", (r) => {
|
|
756
|
+
h("bridge registerBlocklet: callLoginOAuth", r), y.loginOAuth({
|
|
757
|
+
...r,
|
|
754
758
|
onLogin: e
|
|
755
759
|
});
|
|
756
|
-
}),
|
|
757
|
-
|
|
758
|
-
}),
|
|
759
|
-
if (
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
} else if (
|
|
764
|
-
const
|
|
765
|
-
ke(
|
|
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
|
|
769
|
-
if (
|
|
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:
|
|
772
|
-
connectedApp:
|
|
773
|
-
actualApp:
|
|
774
|
-
}), ue(),
|
|
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
|
|
780
|
-
if (
|
|
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
|
-
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
786
|
+
i.loading = !0;
|
|
787
|
+
const w = await Mt();
|
|
788
|
+
if (w) {
|
|
785
789
|
await V({
|
|
786
|
-
sessionToken:
|
|
787
|
-
refreshToken:
|
|
788
|
-
csrfToken:
|
|
789
|
-
visitorId:
|
|
790
|
+
sessionToken: w.sessionToken,
|
|
791
|
+
refreshToken: w.refreshToken,
|
|
792
|
+
csrfToken: w.csrfToken,
|
|
793
|
+
visitorId: w.visitorId,
|
|
790
794
|
encrypted: !1
|
|
791
|
-
}),
|
|
795
|
+
}), i.initialized = !0;
|
|
792
796
|
return;
|
|
793
797
|
}
|
|
794
|
-
} catch (
|
|
795
|
-
throw d.emit(
|
|
798
|
+
} catch (w) {
|
|
799
|
+
throw d.emit(a.LOGIN_FAILED, w), w;
|
|
796
800
|
} finally {
|
|
797
|
-
|
|
801
|
+
i.loading = !1;
|
|
798
802
|
}
|
|
799
803
|
}
|
|
800
|
-
const
|
|
801
|
-
if (
|
|
804
|
+
const p = U.get("magicToken");
|
|
805
|
+
if (p)
|
|
802
806
|
try {
|
|
803
|
-
|
|
804
|
-
} catch (
|
|
805
|
-
console.error("verifyMagicToken failed",
|
|
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 }),
|
|
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
|
|
813
|
-
if (
|
|
814
|
-
x({ loginToken:
|
|
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),
|
|
823
|
+
await co(!0), i.initialized = !0;
|
|
820
824
|
return;
|
|
821
825
|
}
|
|
822
|
-
if (
|
|
826
|
+
if (i.initialized = !0, c.autoConnect ? F() : j(), I.arcSphere && ![
|
|
823
827
|
// 不应该唤起自动登录的路由
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
828
|
+
H(G, "login"),
|
|
829
|
+
H(G, "connect"),
|
|
830
|
+
H(G, "lost-passport")
|
|
827
831
|
].includes(window.location.pathname) && !l)
|
|
828
832
|
try {
|
|
829
|
-
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
sessionToken:
|
|
833
|
-
refreshToken:
|
|
834
|
-
csrfToken:
|
|
835
|
-
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 (
|
|
839
|
-
d.emit(
|
|
842
|
+
} catch (r) {
|
|
843
|
+
d.emit(a.LOGIN_FAILED, r), Oe.error("Failed to autoLogin ArcSphere", r);
|
|
840
844
|
}
|
|
841
845
|
});
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
-
return /* @__PURE__ */
|
|
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:
|
|
847
|
-
onSwitchPassport: ({ sessionToken: e, refreshToken: o, csrfToken:
|
|
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:
|
|
856
|
+
session: A.current
|
|
853
857
|
};
|
|
854
|
-
return /* @__PURE__ */
|
|
855
|
-
!
|
|
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
|
-
|
|
859
|
-
|
|
860
|
-
/* @__PURE__ */
|
|
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(
|
|
885
|
-
return function(
|
|
886
|
-
return /* @__PURE__ */
|
|
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: (
|
|
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
|
|
897
|
-
const Q = Xe,
|
|
898
|
-
let
|
|
899
|
-
if (typeof window < "u" && (
|
|
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 =
|
|
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:
|
|
916
|
-
refreshTokenStorageKey:
|
|
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
|
-
|
|
929
|
+
a as EVENTS,
|
|
926
930
|
qe as SessionContext,
|
|
927
|
-
|
|
928
|
-
|
|
931
|
+
Ut as checkEnableAutoLogin,
|
|
932
|
+
Xi as createAuthServiceSessionContext,
|
|
929
933
|
$e as createSessionContext,
|
|
930
934
|
$e as default,
|
|
931
935
|
Fe as didSpacesIsRequired,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
+
Bt as getMobileVisitorId,
|
|
937
|
+
Mt as login,
|
|
938
|
+
Ji as loginFederatedMaster,
|
|
939
|
+
Zi as mountFederatedIframe,
|
|
936
940
|
B as translations
|
|
937
941
|
};
|