@arcblock/did-connect-react 3.3.9 → 3.4.0
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/connect.js +501 -0
- package/lib/Connect/contexts/state.js +3 -3
- package/lib/Connect/fallback-connect.js +53 -0
- package/lib/Connect/hooks/provider-list.js +25 -19
- package/lib/Connect/hooks/token.js +128 -136
- package/lib/Connect/index.js +13 -502
- package/lib/Connect/use-connect.js +10 -10
- package/lib/OAuth/context.js +3 -3
- package/lib/Passkey/context.js +3 -3
- package/lib/Passkey/dialog.js +7 -7
- package/lib/Session/assets/did-spaces-guide-cover.svg.js +74 -98
- package/lib/Session/index.js +189 -189
- package/lib/index.js +47 -46
- package/lib/package.json.js +1 -1
- package/lib/utils.js +97 -88
- package/package.json +8 -8
- package/src/Connect/connect.jsx +616 -0
- package/src/Connect/fallback-connect.jsx +47 -0
- package/src/Connect/hooks/provider-list.js +5 -0
- package/src/Connect/hooks/token.js +1 -13
- package/src/Connect/index.jsx +8 -605
- package/src/Connect/use-connect.jsx +1 -1
- package/src/Session/assets/did-spaces-guide-cover.svg +1 -128
- package/src/Session/index.jsx +3 -4
- package/src/utils.js +19 -3
package/lib/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { default as t, default as r, default as s } from "./Connect/index.js";
|
|
2
2
|
import { default as n, default as d } from "./Button/index.js";
|
|
3
3
|
import { default as f, default as p } from "@arcblock/ux/lib/DIDLogo";
|
|
4
|
-
import { createSessionContext as _, createAuthServiceSessionContext as
|
|
4
|
+
import { createSessionContext as _, createAuthServiceSessionContext as x, createSessionContext as m } from "./Session/index.js";
|
|
5
5
|
import { OAuthConsumer as C, OAuthContext as T, OAuthProvider as i, useOAuth as I } from "./OAuth/context.js";
|
|
6
|
-
import { PasskeyConsumer as S, PasskeyContext as c, PasskeyProvider as O, usePasskey as
|
|
6
|
+
import { PasskeyConsumer as S, PasskeyContext as c, PasskeyProvider as O, usePasskey as g } from "./Passkey/context.js";
|
|
7
7
|
import { default as R } from "./Passkey/actions.js";
|
|
8
8
|
import { default as N } from "./User/use-did.js";
|
|
9
9
|
import { default as F } from "./User/wrap-did.js";
|
|
10
10
|
import { FederatedConsumer as K, FederatedContext as M, FederatedProvider as y, useFederatedContext as h } from "./Federated/context.js";
|
|
11
|
-
import { API_DID_PREFIX as V, BLOCKLET_SERVICE_PATH_PREFIX as v, BUSY_STATUS as b, CHECK_INTERVAL_TIME as B, CHECK_STATUS_INTERVAL as
|
|
12
|
-
import { createAxios as oe, debug as te, debugTmp as re, debugTmpInterval as se, decodeConnectUrl as ae, decodeKey as ne, decodeUrlParams as de, decrypt as Ee, encodeConnectUrl as fe, encodeKey as pe, encrypt as ue, formatCacheTtl as _e, getApiErrorMessage as
|
|
13
|
-
import { NotOpenError as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
18
|
-
import { EVENTS as
|
|
19
|
-
import { didSpacesIsRequired as
|
|
11
|
+
import { API_DID_PREFIX as V, BLOCKLET_SERVICE_PATH_PREFIX as v, BUSY_STATUS as b, CHECK_INTERVAL_TIME as B, CHECK_STATUS_INTERVAL as H, CSRF_TOKEN_STORAGE_KEY as W, DEFAULT_NAME as Y, DEFAULT_TIMEOUT as G, DEFAULT_WINDOW_TIMEOUT as X, DID_CONNECT_URL_PARAMS_NAME as w, DID_SPACES_BASE_URL as q, EXT_DOWNLOAD_URL as j, LANG_COOKIE_NAME as z, REFRESH_TOKEN_STORAGE_KEY as J, RELAY_SOCKET_PREFIX as Q, SESSION_TOKEN_STORAGE_KEY as Z, VERIFY_CODE_LENGTH as $ } from "./constant.js";
|
|
12
|
+
import { createAxios as oe, debug as te, debugTmp as re, debugTmpInterval as se, decodeConnectUrl as ae, decodeKey as ne, decodeUrlParams as de, decrypt as Ee, encodeConnectUrl as fe, encodeKey as pe, encrypt as ue, formatCacheTtl as _e, getApiErrorMessage as xe, getAppId as me, getBrowserLang as Ae, getConnectedInfo as Ce, getExtraHeaders as Te, getWebAuthnErrorMessage as ie, logger as Ie, openPopup as le, parseNextWorkflow as Se, parseTokenFromConnectUrl as ce, runPopup as Oe, sleep as ge, updateConnectedInfo as De, version as Re } from "./utils.js";
|
|
13
|
+
import { NotOpenError as Ne } from "./error.js";
|
|
14
|
+
import { default as Fe } from "@arcblock/ux/lib/SessionManager";
|
|
15
|
+
import { default as Ke } from "@arcblock/ux/lib/Address";
|
|
16
|
+
import { default as ye } from "@arcblock/ux/lib/Avatar";
|
|
17
|
+
import { default as ke } from "./Connect/use-connect.js";
|
|
18
|
+
import { EVENTS as ve } from "./Session/libs/constants.js";
|
|
19
|
+
import { didSpacesIsRequired as Be } from "./Session/libs/did-spaces.js";
|
|
20
20
|
import { loginFederatedMaster as We, mountFederatedIframe as Ye } from "./Session/libs/federated.js";
|
|
21
|
-
import { translations as
|
|
22
|
-
import { checkEnableAutoLogin as
|
|
23
|
-
import { SessionContext as
|
|
21
|
+
import { translations as Xe } from "./Session/libs/locales.js";
|
|
22
|
+
import { checkEnableAutoLogin as qe, getMobileVisitorId as je, login as ze } from "./Session/libs/login-mobile.js";
|
|
23
|
+
import { SessionContext as Qe } from "./Session/context.js";
|
|
24
24
|
export * from "@arcblock/ux/lib/Util/wallet";
|
|
25
|
-
import { getVisitorId as
|
|
25
|
+
import { getVisitorId as eo, setVisitorId as oo } from "@arcblock/ux/lib/Util";
|
|
26
26
|
export {
|
|
27
27
|
V as API_DID_PREFIX,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Ke as Address,
|
|
29
|
+
ye as Avatar,
|
|
30
30
|
v as BLOCKLET_SERVICE_PATH_PREFIX,
|
|
31
31
|
b as BUSY_STATUS,
|
|
32
32
|
n as Button,
|
|
33
33
|
B as CHECK_INTERVAL_TIME,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
H as CHECK_STATUS_INTERVAL,
|
|
35
|
+
W as CSRF_TOKEN_STORAGE_KEY,
|
|
36
36
|
t as Connect,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Y as DEFAULT_NAME,
|
|
38
|
+
G as DEFAULT_TIMEOUT,
|
|
39
39
|
X as DEFAULT_WINDOW_TIMEOUT,
|
|
40
40
|
d as DIDButton,
|
|
41
41
|
r as DIDConnect,
|
|
@@ -43,14 +43,14 @@ export {
|
|
|
43
43
|
w as DID_CONNECT_URL_PARAMS_NAME,
|
|
44
44
|
q as DID_SPACES_BASE_URL,
|
|
45
45
|
s as DidConnect,
|
|
46
|
-
|
|
46
|
+
ve as EVENTS,
|
|
47
47
|
j as EXT_DOWNLOAD_URL,
|
|
48
48
|
K as FederatedConsumer,
|
|
49
49
|
M as FederatedContext,
|
|
50
50
|
y as FederatedProvider,
|
|
51
51
|
z as LANG_COOKIE_NAME,
|
|
52
52
|
p as Logo,
|
|
53
|
-
|
|
53
|
+
Ne as NotOpenError,
|
|
54
54
|
C as OAuthConsumer,
|
|
55
55
|
T as OAuthContext,
|
|
56
56
|
i as OAuthProvider,
|
|
@@ -62,14 +62,14 @@ export {
|
|
|
62
62
|
Q as RELAY_SOCKET_PREFIX,
|
|
63
63
|
Z as SESSION_TOKEN_STORAGE_KEY,
|
|
64
64
|
_ as Session,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
Qe as SessionContext,
|
|
66
|
+
Fe as SessionManager,
|
|
67
67
|
$ as VERIFY_CODE_LENGTH,
|
|
68
68
|
F as WrapDid,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
qe as checkEnableAutoLogin,
|
|
70
|
+
x as createAuthServiceSessionContext,
|
|
71
71
|
oe as createAxios,
|
|
72
|
-
|
|
72
|
+
m as createSessionContext,
|
|
73
73
|
te as debug,
|
|
74
74
|
re as debugTmp,
|
|
75
75
|
se as debugTmpInterval,
|
|
@@ -77,34 +77,35 @@ export {
|
|
|
77
77
|
ne as decodeKey,
|
|
78
78
|
de as decodeUrlParams,
|
|
79
79
|
Ee as decrypt,
|
|
80
|
-
|
|
80
|
+
Be as didSpacesIsRequired,
|
|
81
81
|
fe as encodeConnectUrl,
|
|
82
82
|
pe as encodeKey,
|
|
83
83
|
ue as encrypt,
|
|
84
84
|
_e as formatCacheTtl,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
xe as getApiErrorMessage,
|
|
86
|
+
me as getAppId,
|
|
87
87
|
Ae as getBrowserLang,
|
|
88
88
|
Ce as getConnectedInfo,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
ie as
|
|
93
|
-
|
|
89
|
+
Te as getExtraHeaders,
|
|
90
|
+
je as getMobileVisitorId,
|
|
91
|
+
eo as getVisitorId,
|
|
92
|
+
ie as getWebAuthnErrorMessage,
|
|
93
|
+
Ie as logger,
|
|
94
|
+
ze as login,
|
|
94
95
|
We as loginFederatedMaster,
|
|
95
96
|
Ye as mountFederatedIframe,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
le as openPopup,
|
|
98
|
+
Se as parseNextWorkflow,
|
|
99
|
+
ce as parseTokenFromConnectUrl,
|
|
100
|
+
Oe as runPopup,
|
|
101
|
+
oo as setVisitorId,
|
|
102
|
+
ge as sleep,
|
|
103
|
+
Xe as translations,
|
|
103
104
|
De as updateConnectedInfo,
|
|
104
|
-
|
|
105
|
+
ke as useConnect,
|
|
105
106
|
N as useDid,
|
|
106
107
|
h as useFederatedContext,
|
|
107
108
|
I as useOAuth,
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
g as usePasskey,
|
|
110
|
+
Re as version
|
|
110
111
|
};
|
package/lib/package.json.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { Buffer as a } from "buffer";
|
|
2
2
|
import h from "tweetnacl-sealedbox-js";
|
|
3
|
-
import { getCookieOptions as A, getVisitorId as
|
|
4
|
-
import { getVisitorId as
|
|
3
|
+
import { isUrl as U, getCookieOptions as A, getVisitorId as E } from "@arcblock/ux/lib/Util";
|
|
4
|
+
import { getVisitorId as Ue, setVisitorId as Ae } from "@arcblock/ux/lib/Util";
|
|
5
5
|
import c from "js-cookie";
|
|
6
|
-
import
|
|
6
|
+
import l from "lodash/isNil";
|
|
7
7
|
import T from "lodash/isString";
|
|
8
8
|
import m from "lodash/isUndefined";
|
|
9
|
-
import { createAxios as
|
|
9
|
+
import { createAxios as P, getBlockletSDK as x } from "@blocklet/js-sdk";
|
|
10
10
|
import { withQuery as L } from "ufo";
|
|
11
11
|
import { isValid as w, isFromPublicKey as S } from "@arcblock/did";
|
|
12
|
-
import { getSafeUrl as
|
|
13
|
-
import { createDebug as u, createLogger as
|
|
14
|
-
import
|
|
15
|
-
import { DID_CONNECT_URL_PARAMS_NAME as f, DEFAULT_WINDOW_TIMEOUT as
|
|
16
|
-
import { NotOpenError as
|
|
12
|
+
import { getSafeUrl as C } from "@arcblock/ux/lib/Util/security";
|
|
13
|
+
import { createDebug as u, createLogger as I } from "@arcblock/ux/lib/Util/logger";
|
|
14
|
+
import N from "./package.json.js";
|
|
15
|
+
import { DID_CONNECT_URL_PARAMS_NAME as f, DEFAULT_WINDOW_TIMEOUT as D } from "./constant.js";
|
|
16
|
+
import { NotOpenError as W } from "./error.js";
|
|
17
17
|
export * from "@arcblock/ux/lib/Util/wallet";
|
|
18
|
-
const { version: O } =
|
|
18
|
+
const { version: O } = N, re = u("did-connect"), oe = u("did-connect:tmp"), te = u("did-connect:tmp-interval"), ne = I("did-connect");
|
|
19
19
|
function b(e) {
|
|
20
20
|
return (e + "===".slice((e.length + 3) % 4)).replace(/-/g, "+").replace(/_/g, "/");
|
|
21
21
|
}
|
|
22
22
|
function _(e) {
|
|
23
23
|
return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const se = (e) => _(window.btoa(e)), ie = (e) => window.atob(b(e)), ae = (e) => {
|
|
26
26
|
const o = new URL(e), r = decodeURIComponent(o.searchParams.get("url"));
|
|
27
27
|
return new URL(r).searchParams.get("_t_");
|
|
28
|
-
},
|
|
28
|
+
}, R = (e, o) => {
|
|
29
29
|
let r = o?.publisher;
|
|
30
30
|
if (!r) {
|
|
31
31
|
if (e?.agentDid)
|
|
@@ -37,40 +37,40 @@ const ne = (e) => _(window.btoa(e)), te = (e) => window.atob(b(e)), se = (e) =>
|
|
|
37
37
|
const o = {
|
|
38
38
|
connected_did: e.did || "",
|
|
39
39
|
connected_pk: e.pk || "",
|
|
40
|
-
connected_app:
|
|
40
|
+
connected_app: R(e.appInfo, e.memberAppInfo)
|
|
41
41
|
};
|
|
42
42
|
return e?.connectedWallet?.os && (o.connected_wallet_os = e.connectedWallet.os), o;
|
|
43
|
-
},
|
|
43
|
+
}, ce = (e, o = !1) => {
|
|
44
44
|
if (!e) return;
|
|
45
45
|
o || (e = z(e));
|
|
46
46
|
const r = A({
|
|
47
47
|
expireInDays: 7,
|
|
48
48
|
returnDomain: !1
|
|
49
49
|
});
|
|
50
|
-
!
|
|
51
|
-
},
|
|
52
|
-
const
|
|
50
|
+
!l(e.connected_did) && !l(e.connected_pk) && w(e.connected_did) && S(e.connected_did, e.connected_pk) && (c.set("connected_did", e.connected_did, r), c.set("connected_pk", e.connected_pk, r)), !l(e.connected_app) && w(e.connected_app) && c.set("connected_app", e.connected_app, r), e.connected_wallet_os && c.set("connected_wallet_os", e.connected_wallet_os, r);
|
|
51
|
+
}, pe = (e) => _(a.from(e).toString("base64")), d = (e) => Uint8Array.from(a.from(b(e), "base64")), le = (e, o, r) => {
|
|
52
|
+
const t = h.open(
|
|
53
53
|
Uint8Array.from(a.from(e, "base64")),
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
d(o),
|
|
55
|
+
d(r)
|
|
56
56
|
);
|
|
57
|
-
return JSON.parse(a.from(
|
|
58
|
-
},
|
|
59
|
-
const r = new URL(e),
|
|
57
|
+
return JSON.parse(a.from(t).toString("utf8"));
|
|
58
|
+
}, de = (e, o) => a.from(h.seal(Uint8Array.from(a.from(e)), d(o))).toString("base64"), ue = (e, o = "_t_") => {
|
|
59
|
+
const r = new URL(e), t = {
|
|
60
60
|
baseUrl: r.origin,
|
|
61
61
|
prefix: r.pathname.replace(/\/auth$/, ""),
|
|
62
62
|
token: r.searchParams.get(o) || ""
|
|
63
63
|
};
|
|
64
|
-
if (!
|
|
64
|
+
if (!t.baseUrl)
|
|
65
65
|
throw new Error("Invalid next workflow: origin empty");
|
|
66
|
-
if (!
|
|
66
|
+
if (!t.token)
|
|
67
67
|
throw new Error("Invalid next workflow: token not found");
|
|
68
|
-
return
|
|
68
|
+
return t;
|
|
69
69
|
}, g = (e, o) => {
|
|
70
70
|
let r = e.message;
|
|
71
|
-
const { response:
|
|
72
|
-
return
|
|
73
|
-
},
|
|
71
|
+
const { response: t } = e;
|
|
72
|
+
return t && (r = t.data?.error || t.data?.message || t.data || o, r = typeof r == "object" ? o : r), r;
|
|
73
|
+
}, me = (e, o, r) => {
|
|
74
74
|
if (!e)
|
|
75
75
|
return e;
|
|
76
76
|
if (!e.name)
|
|
@@ -87,27 +87,35 @@ const ne = (e) => _(window.btoa(e)), te = (e) => window.atob(b(e)), se = (e) =>
|
|
|
87
87
|
default:
|
|
88
88
|
return console.warn("Unhandled WebAuthn error type:", e.name), g(e, o);
|
|
89
89
|
}
|
|
90
|
-
},
|
|
91
|
-
const
|
|
90
|
+
}, M = (e) => {
|
|
91
|
+
const o = {}, r = U(e) ? e : window.location.href;
|
|
92
|
+
if (r) {
|
|
93
|
+
const { hostname: t, protocol: n, port: s } = new URL(r);
|
|
94
|
+
o["x-real-hostname"] = t, o["x-real-port"] = s, o["x-real-protocol"] = n.endsWith(":") ? n.substring(0, n.length - 1) : n;
|
|
95
|
+
}
|
|
96
|
+
return o;
|
|
97
|
+
}, we = (e = {}, { lazy: o = !1, lazyTime: r = 300 } = {}) => {
|
|
98
|
+
const t = {
|
|
99
|
+
...M(e.baseURL),
|
|
92
100
|
...e.headers,
|
|
93
101
|
"x-did-connect-version": O
|
|
94
|
-
},
|
|
102
|
+
}, n = P(
|
|
95
103
|
{
|
|
96
104
|
...e,
|
|
97
|
-
headers:
|
|
105
|
+
headers: t
|
|
98
106
|
},
|
|
99
107
|
{ lazy: o, lazyTime: r }
|
|
100
108
|
);
|
|
101
|
-
return
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
109
|
+
return n.interceptors.request.use((s) => {
|
|
110
|
+
const i = E();
|
|
111
|
+
return i && (s.headers["x-blocklet-visitor-id"] = i), s;
|
|
112
|
+
}), n;
|
|
113
|
+
}, fe = (e = 0) => new Promise((o) => {
|
|
106
114
|
setTimeout(() => {
|
|
107
115
|
o();
|
|
108
116
|
}, e);
|
|
109
117
|
});
|
|
110
|
-
function
|
|
118
|
+
function ge() {
|
|
111
119
|
if (typeof window > "u")
|
|
112
120
|
return null;
|
|
113
121
|
const e = window.navigator.languages && window.navigator.languages[0] || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage || window.navigator.systemLanguage || null;
|
|
@@ -118,22 +126,22 @@ function we() {
|
|
|
118
126
|
en: "en"
|
|
119
127
|
}[e] || "en";
|
|
120
128
|
}
|
|
121
|
-
function
|
|
129
|
+
function he(e, o) {
|
|
122
130
|
return [void 0, null, ""].includes(e) ? o : e / 86400;
|
|
123
131
|
}
|
|
124
|
-
async function
|
|
132
|
+
async function be() {
|
|
125
133
|
const e = window.location.href;
|
|
126
134
|
try {
|
|
127
135
|
const o = new URL(e), r = o.searchParams.get(f);
|
|
128
136
|
if (r) {
|
|
129
137
|
o.searchParams.delete(f);
|
|
130
|
-
const
|
|
131
|
-
if (T(
|
|
132
|
-
const
|
|
133
|
-
m(
|
|
138
|
+
const t = JSON.parse(a.from(r, "base64").toString("utf-8"));
|
|
139
|
+
if (T(t.forceConnected) && m(t.sourceAppPid)) {
|
|
140
|
+
const s = await x().user.getUserPublicInfo({ did: t.forceConnected });
|
|
141
|
+
m(s?.sourceAppPid) || (t.sourceAppPid = s.sourceAppPid);
|
|
134
142
|
}
|
|
135
143
|
return {
|
|
136
|
-
params:
|
|
144
|
+
params: t,
|
|
137
145
|
url: o.href
|
|
138
146
|
};
|
|
139
147
|
}
|
|
@@ -145,8 +153,8 @@ async function ge() {
|
|
|
145
153
|
url: e
|
|
146
154
|
};
|
|
147
155
|
}
|
|
148
|
-
const
|
|
149
|
-
const
|
|
156
|
+
const _e = (e, { width: o = 680, height: r = 720, name: t = "did-connect:popup", offsetX: n = 0, offsetY: s = 0 } = {}) => {
|
|
157
|
+
const i = C(e, { allowDomains: null }), v = window.screenX + (window.innerWidth - o) / 2 + n, k = window.screenY + (window.innerHeight - r) / 2 + s, y = [
|
|
150
158
|
`left=${v}`,
|
|
151
159
|
`top=${k}`,
|
|
152
160
|
`width=${o}`,
|
|
@@ -156,61 +164,62 @@ const he = (e, { width: o = 680, height: r = 720, name: n = "did-connect:popup",
|
|
|
156
164
|
"scrollbars=yes",
|
|
157
165
|
"status=yes",
|
|
158
166
|
"popup=yes"
|
|
159
|
-
], p = window.open("",
|
|
167
|
+
], p = window.open("", t, y.join(","));
|
|
160
168
|
if (p === null)
|
|
161
|
-
throw new
|
|
162
|
-
return p.location.href = L(
|
|
169
|
+
throw new W();
|
|
170
|
+
return p.location.href = L(i, {
|
|
163
171
|
// NOTICE: 携带当前页面的 origin,用于在 popup 中通过该参数判断是否可以发送 postMessage,即使该参数被伪造,最终也只有该域名能接收到消息,所以没有关系
|
|
164
172
|
opener: window.location.origin
|
|
165
173
|
}), p;
|
|
166
|
-
},
|
|
167
|
-
let
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
if (
|
|
171
|
-
console.error(
|
|
174
|
+
}, ve = (e) => new Promise((o, r) => {
|
|
175
|
+
let t, n;
|
|
176
|
+
const s = ({ data: i }) => {
|
|
177
|
+
if (i && i.type === "authorization_response") {
|
|
178
|
+
if (i?.error) {
|
|
179
|
+
console.error(i.error);
|
|
172
180
|
return;
|
|
173
181
|
}
|
|
174
182
|
setTimeout(() => {
|
|
175
|
-
e.popup?.close(), clearTimeout(
|
|
176
|
-
}, e.closeTimeout || 0), o(
|
|
183
|
+
e.popup?.close(), clearTimeout(n), clearInterval(t), window.removeEventListener("message", s, !1);
|
|
184
|
+
}, e.closeTimeout || 0), o(i);
|
|
177
185
|
}
|
|
178
186
|
};
|
|
179
|
-
|
|
187
|
+
n = setTimeout(
|
|
180
188
|
() => {
|
|
181
|
-
clearInterval(
|
|
189
|
+
clearInterval(t), r(new Error("Timeout")), window.removeEventListener("message", s, !1);
|
|
182
190
|
},
|
|
183
|
-
(e.timeoutInSeconds ||
|
|
184
|
-
),
|
|
185
|
-
e.popup?.closed && (clearInterval(
|
|
186
|
-
}, 1e3), window.addEventListener("message",
|
|
191
|
+
(e.timeoutInSeconds || D) * 1e3
|
|
192
|
+
), t = setInterval(() => {
|
|
193
|
+
e.popup?.closed && (clearInterval(t), clearTimeout(n), window.removeEventListener("message", s, !1), r(new Error("Popup closed")));
|
|
194
|
+
}, 1e3), window.addEventListener("message", s);
|
|
187
195
|
});
|
|
188
196
|
export {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
we as createAxios,
|
|
198
|
+
re as debug,
|
|
199
|
+
oe as debugTmp,
|
|
200
|
+
te as debugTmpInterval,
|
|
201
|
+
ie as decodeConnectUrl,
|
|
202
|
+
d as decodeKey,
|
|
203
|
+
be as decodeUrlParams,
|
|
204
|
+
le as decrypt,
|
|
205
|
+
se as encodeConnectUrl,
|
|
206
|
+
pe as encodeKey,
|
|
207
|
+
de as encrypt,
|
|
208
|
+
he as formatCacheTtl,
|
|
201
209
|
g as getApiErrorMessage,
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
R as getAppId,
|
|
211
|
+
ge as getBrowserLang,
|
|
204
212
|
z as getConnectedInfo,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
M as getExtraHeaders,
|
|
214
|
+
Ue as getVisitorId,
|
|
215
|
+
me as getWebAuthnErrorMessage,
|
|
216
|
+
ne as logger,
|
|
217
|
+
_e as openPopup,
|
|
218
|
+
ue as parseNextWorkflow,
|
|
219
|
+
ae as parseTokenFromConnectUrl,
|
|
220
|
+
ve as runPopup,
|
|
221
|
+
Ae as setVisitorId,
|
|
222
|
+
fe as sleep,
|
|
223
|
+
ce as updateConnectedInfo,
|
|
215
224
|
O as version
|
|
216
225
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-connect-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Client side library to work with DID Connect by ArcBlock.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@arcblock/bridge": "3.
|
|
36
|
-
"@arcblock/did": "^1.
|
|
37
|
-
"@arcblock/icons": "3.
|
|
38
|
-
"@arcblock/react-hooks": "3.
|
|
39
|
-
"@arcblock/ws": "^1.
|
|
35
|
+
"@arcblock/bridge": "3.4.0",
|
|
36
|
+
"@arcblock/did": "^1.28.1",
|
|
37
|
+
"@arcblock/icons": "3.4.0",
|
|
38
|
+
"@arcblock/react-hooks": "3.4.0",
|
|
39
|
+
"@arcblock/ws": "^1.28.1",
|
|
40
40
|
"@blocklet/constant": "^1.17.7",
|
|
41
41
|
"@fontsource/lexend": "^5.2.9",
|
|
42
42
|
"@iconify-icons/logos": "^1.2.36",
|
|
43
43
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
44
44
|
"@iconify/react": "^5.2.1",
|
|
45
|
-
"@ocap/util": "^1.
|
|
45
|
+
"@ocap/util": "^1.28.1",
|
|
46
46
|
"@simplewebauthn/browser": "^13.1.0",
|
|
47
47
|
"ahooks": "^3.8.5",
|
|
48
48
|
"axios": "^1.10.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
82
82
|
"jest": "^29.7.0"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "bbf3a178a14a767aef0da795ea31abe8dfb858c1"
|
|
85
85
|
}
|