@prosopo/procaptcha-bundle 2.4.1 → 2.4.2
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/dist/bundle/{ProcaptchaWidget-DOETad4N.js → ProcaptchaWidget-CWr3QJxQ.js} +33 -31
- package/dist/bundle/{ProcaptchaWidget-79FRw4Va.js → ProcaptchaWidget-DNDHo0wy.js} +153 -149
- package/dist/bundle/{asU8a-2GgUBNjQ.js → asU8a-CzXEWKM2.js} +1 -1
- package/dist/bundle/{bip39-C01p7UHO.js → bip39-BY0qXKlh.js} +7 -7
- package/dist/bundle/browser-ponyfill-QubLHHEB.js +339 -0
- package/dist/bundle/{hash-0yoKUuST.js → hash-BtiXKZG7.js} +7 -7
- package/dist/bundle/index-5BQn0RdY.js +11576 -0
- package/dist/bundle/{index-Ckreqz7Q.js → index-CUmhpcqe.js} +3 -3
- package/dist/bundle/{index-DlBTo0Xd.js → index-n-2hvBzo.js} +405 -405
- package/dist/bundle/index-vKa71Rut.js +4372 -0
- package/dist/bundle/locales/de/translation.json +405 -0
- package/dist/bundle/locales/en/translation.json +405 -0
- package/dist/bundle/locales/es/translation.json +405 -0
- package/dist/bundle/locales/fr/translation.json +405 -0
- package/dist/bundle/locales/it/translation.json +405 -0
- package/dist/bundle/locales/pt/translation.json +405 -0
- package/dist/bundle/locales/pt-BR/translation.json +405 -0
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/useTranslation-2VGhZyNk.js +2435 -0
- package/package.json +10 -10
- package/stats.html +1 -1
- package/vite.cjs.config.ts +1 -1
- package/vite.config.ts +32 -1
- package/vite.test.config.ts +1 -1
- package/webpack.config.cjs +1 -1
- package/dist/bundle/index-C8sSamyh.js +0 -6521
- package/dist/bundle/index-DOFIggts.js +0 -17295
- package/dist/bundle/useTranslation-CgamIJ5S.js +0 -550
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as k, p as U, e as w, h as O, k as M, A as r, f as j, E as S, i as F, r as m, j as t, W as G, l as B, d as X, m as K, C as Y, n as q, a as W, q as V, s as $, t as z, u as J, L as Q, v as Z, w as ee, x as ne, y as ae, o as te } from "./index-5BQn0RdY.js";
|
|
2
|
+
import { b as P, a as oe, s as re, u as se, c as ce, l as ie } from "./useTranslation-2VGhZyNk.js";
|
|
3
3
|
import { s as le } from "./sha256-Cxc9Hrlx.js";
|
|
4
4
|
const de = (c, e) => {
|
|
5
5
|
let s = 0;
|
|
@@ -11,7 +11,7 @@ const de = (c, e) => {
|
|
|
11
11
|
s += 1;
|
|
12
12
|
}
|
|
13
13
|
}, ue = (c) => Array.from(c).map((e) => e.toString(16).padStart(2, "0")).join(""), ge = (c, e, s, d, n) => {
|
|
14
|
-
const i =
|
|
14
|
+
const i = k(d), x = () => ({
|
|
15
15
|
showModal: !1,
|
|
16
16
|
loading: !1,
|
|
17
17
|
index: 0,
|
|
@@ -22,56 +22,56 @@ const de = (c, e) => {
|
|
|
22
22
|
account: void 0
|
|
23
23
|
}), u = () => {
|
|
24
24
|
window.clearTimeout(Number(e.timeout)), o({ timeout: void 0 });
|
|
25
|
-
},
|
|
25
|
+
}, A = () => {
|
|
26
26
|
o({
|
|
27
27
|
isHuman: !1,
|
|
28
28
|
loading: !1
|
|
29
29
|
}), i.onFailed(), p(n == null ? void 0 : n.restart);
|
|
30
30
|
}, T = () => {
|
|
31
31
|
window.clearTimeout(Number(e.successfullChallengeTimeout)), o({ successfullChallengeTimeout: void 0 });
|
|
32
|
-
},
|
|
32
|
+
}, h = () => {
|
|
33
33
|
const a = {
|
|
34
34
|
userAccountAddress: "",
|
|
35
35
|
...c
|
|
36
36
|
};
|
|
37
|
-
return e.account && (a.userAccountAddress = e.account.account.address),
|
|
38
|
-
},
|
|
37
|
+
return e.account && (a.userAccountAddress = e.account.account.address), F.parse(a);
|
|
38
|
+
}, f = () => {
|
|
39
39
|
if (!e.account)
|
|
40
40
|
throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
41
41
|
context: { error: "Account not loaded" }
|
|
42
42
|
});
|
|
43
43
|
return { account: e.account };
|
|
44
|
-
},
|
|
44
|
+
}, g = () => {
|
|
45
45
|
if (!e.dappAccount)
|
|
46
46
|
throw new w("GENERAL.SITE_KEY_MISSING");
|
|
47
47
|
return e.dappAccount;
|
|
48
48
|
}, o = P(e, s), p = (a) => {
|
|
49
|
-
u(), T(), o(
|
|
49
|
+
u(), T(), o(x()), i.onReset(), a && a();
|
|
50
50
|
}, L = () => {
|
|
51
|
-
const a =
|
|
51
|
+
const a = h().captchas.pow.solutionTimeout, b = setTimeout(() => {
|
|
52
52
|
o({ isHuman: !1 }), i.onExpired(), p(n == null ? void 0 : n.restart);
|
|
53
53
|
}, a);
|
|
54
54
|
o({ successfullChallengeTimeout: b });
|
|
55
55
|
}, I = async () => {
|
|
56
|
-
await
|
|
56
|
+
await U(async () => {
|
|
57
57
|
var N;
|
|
58
58
|
if (e.loading || e.isHuman)
|
|
59
59
|
return;
|
|
60
60
|
p(), o({
|
|
61
61
|
loading: !0
|
|
62
62
|
}), o({ attemptCount: e.attemptCount + 1 });
|
|
63
|
-
const a =
|
|
63
|
+
const a = h(), D = await (async () => n ? n.userAccount : new (await S(a.web2))().getAccount(a))(), v = D.account.address;
|
|
64
64
|
if (o({
|
|
65
65
|
account: { account: { address: v } }
|
|
66
|
-
}), o({ dappAccount: a.account.address }), await
|
|
66
|
+
}), o({ dappAccount: a.account.address }), await oe(100), !a.web2 && !a.userAccountAddress)
|
|
67
67
|
throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
68
68
|
context: {
|
|
69
69
|
error: "Account address has not been set for web3 mode"
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
let E;
|
|
73
|
-
n != null && n.provider ? E = n.provider : E = await
|
|
74
|
-
const _ = E.provider.url, R = new
|
|
73
|
+
n != null && n.provider ? E = n.provider : E = await O(h());
|
|
74
|
+
const _ = E.provider.url, R = new M(_, g()), l = await R.getPowCaptchaChallenge(v, g(), n == null ? void 0 : n.sessionId);
|
|
75
75
|
if (l.error)
|
|
76
76
|
o({
|
|
77
77
|
loading: !1,
|
|
@@ -87,16 +87,16 @@ const de = (c, e) => {
|
|
|
87
87
|
});
|
|
88
88
|
const H = await C.signRaw({
|
|
89
89
|
address: v,
|
|
90
|
-
data:
|
|
90
|
+
data: re(l[r.timestamp].toString()),
|
|
91
91
|
type: "bytes"
|
|
92
92
|
});
|
|
93
|
-
(await R.submitPowCaptchaSolution(l,
|
|
93
|
+
(await R.submitPowCaptchaSolution(l, f().account.account.address, g(), y, H.signature.toString(), a.captchas.pow.verifiedTimeout))[r.verified] ? (o({
|
|
94
94
|
isHuman: !0,
|
|
95
95
|
loading: !1
|
|
96
|
-
}), i.onHuman(
|
|
96
|
+
}), i.onHuman(j({
|
|
97
97
|
[r.providerUrl]: _,
|
|
98
|
-
[r.user]:
|
|
99
|
-
[r.dapp]:
|
|
98
|
+
[r.user]: f().account.account.address,
|
|
99
|
+
[r.dapp]: g(),
|
|
100
100
|
[r.challenge]: l.challenge,
|
|
101
101
|
[r.nonce]: y,
|
|
102
102
|
[r.timestamp]: l.timestamp,
|
|
@@ -106,7 +106,7 @@ const de = (c, e) => {
|
|
|
106
106
|
[r.timestamp]: H.signature.toString()
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
})), L()) :
|
|
109
|
+
})), L()) : A();
|
|
110
110
|
}
|
|
111
111
|
}, I, () => {
|
|
112
112
|
p();
|
|
@@ -117,19 +117,21 @@ const de = (c, e) => {
|
|
|
117
117
|
resetState: p
|
|
118
118
|
};
|
|
119
119
|
}, we = (c) => {
|
|
120
|
-
const { t: e } =
|
|
121
|
-
return
|
|
122
|
-
s.language &&
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
const { t: e } = se(), s = c.config, d = s.theme === "light" ? "light" : "dark", n = c.frictionlessState, i = c.config.theme === "light" ? B : X, x = c.callbacks || {}, [u, A] = ce(m.useState, m.useRef), T = P(u, A), h = m.useRef(ge(s, u, T, x, n)), f = m.useRef(null);
|
|
121
|
+
return m.useEffect(() => {
|
|
122
|
+
s.language && ie().then((g) => {
|
|
123
|
+
g.changeLanguage(s.language).then((o) => o);
|
|
124
|
+
});
|
|
125
|
+
}, [s.language]), t("div", { ref: f, style: { width: "100%", minHeight: G }, children: t("div", { style: {
|
|
126
|
+
maxWidth: K,
|
|
125
127
|
minHeight: G,
|
|
126
128
|
maxHeight: "100%",
|
|
127
129
|
overflowX: "auto",
|
|
128
130
|
width: "100%",
|
|
129
131
|
...i.font
|
|
130
|
-
}, children: t(
|
|
131
|
-
padding:
|
|
132
|
-
border:
|
|
132
|
+
}, children: t(Y, { children: t(q, { children: W("div", { style: te, "data-cy": "button-human", children: [" ", W("div", { style: {
|
|
133
|
+
padding: J,
|
|
134
|
+
border: z,
|
|
133
135
|
backgroundColor: i.palette.background.default,
|
|
134
136
|
borderColor: i.palette.grey[300],
|
|
135
137
|
borderRadius: $,
|
|
@@ -137,7 +139,7 @@ const de = (c, e) => {
|
|
|
137
139
|
alignItems: "center",
|
|
138
140
|
flexWrap: "wrap",
|
|
139
141
|
justifyContent: "space-between",
|
|
140
|
-
minHeight: `${
|
|
142
|
+
minHeight: `${V}px`,
|
|
141
143
|
overflow: "hidden"
|
|
142
144
|
}, children: [t("div", { style: { display: "inline-flex", flexDirection: "column" }, children: t("div", { style: {
|
|
143
145
|
display: "flex",
|
|
@@ -152,7 +154,7 @@ const de = (c, e) => {
|
|
|
152
154
|
verticalAlign: "middle"
|
|
153
155
|
}, children: t("div", { style: {
|
|
154
156
|
display: "flex"
|
|
155
|
-
}, children: t("div", { style: { flex: 1 }, children: u.loading ? t(Q, { themeColor: d, "aria-label": "Loading spinner" }) : t(Z, { checked: u.isHuman, onChange:
|
|
157
|
+
}, children: t("div", { style: { flex: 1 }, children: u.loading ? t(Q, { themeColor: d, "aria-label": "Loading spinner" }) : t(Z, { checked: u.isHuman, onChange: h.current.start, themeColor: d, labelText: e("WIDGET.I_AM_HUMAN"), error: u.error, "aria-label": "human checkbox" }) }) }) }) }) }), t("div", { style: { display: "inline-flex", flexDirection: "column" }, children: t("a", { href: ne, target: "_blank", "aria-label": ee, children: t("div", { style: { flex: 1 }, children: t(ae, { themeColor: d, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
|
|
156
158
|
};
|
|
157
159
|
export {
|
|
158
160
|
we as default
|