@prosopo/procaptcha-bundle 0.3.40 → 0.3.41
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/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +2 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/dist/bundle/Captcha-DV7UgvdK.js +118 -0
- package/dist/bundle/{ProcaptchaWidget-_HWtKMzl.js → ProcaptchaWidget-Df9IA3Z1.js} +59 -59
- package/dist/bundle/{index-JnXKn793.js → index-q4wiV8mV.js} +2333 -2299
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/{utils-DQmE4Xe8.js → utils-DvyeJwNo.js} +2005 -1997
- package/dist/cjs/index.cjs +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/stats.html +1 -1
- package/dist/bundle/Captcha-BmWwpHsi.js +0 -113
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { A as p, P as I, j as n, C as W, W as _, a as C, c as k, e as P, f as R, g as O, i as G, L as H, k as U, m as L, n as j, l as F, d as B, r as b } from "./index-JnXKn793.js";
|
|
2
|
-
import { B as K, u as M, p as q, h as w, m as X, w as $, t as z, q as J, A as Q, W as V, K as Y, x as Z, C as ee, n as D, y as te, z as ne } from "./utils-DQmE4Xe8.js";
|
|
3
|
-
const oe = (a, e) => {
|
|
4
|
-
let o = 0;
|
|
5
|
-
const c = "0".repeat(e);
|
|
6
|
-
for (; ; ) {
|
|
7
|
-
const l = new TextEncoder().encode(o + a);
|
|
8
|
-
if (ae(K(l)).startsWith(c))
|
|
9
|
-
return o;
|
|
10
|
-
o += 1;
|
|
11
|
-
}
|
|
12
|
-
}, ae = (a) => Array.from(a).map((e) => e.toString(16).padStart(2, "0")).join(""), re = (a, e, o, c) => {
|
|
13
|
-
const l = () => ({
|
|
14
|
-
showModal: !1,
|
|
15
|
-
loading: !1,
|
|
16
|
-
index: 0,
|
|
17
|
-
challenge: void 0,
|
|
18
|
-
solutions: void 0,
|
|
19
|
-
isHuman: !1,
|
|
20
|
-
captchaApi: void 0,
|
|
21
|
-
account: void 0
|
|
22
|
-
}), r = () => {
|
|
23
|
-
window.clearTimeout(e.timeout), d({ timeout: void 0 });
|
|
24
|
-
}, i = () => {
|
|
25
|
-
const t = {
|
|
26
|
-
userAccountAddress: "",
|
|
27
|
-
...a
|
|
28
|
-
};
|
|
29
|
-
return I.parse(t);
|
|
30
|
-
}, f = (t) => {
|
|
31
|
-
const s = t.networks[t.defaultNetwork];
|
|
32
|
-
if (!s)
|
|
33
|
-
throw new w("DEVELOPER.NETWORK_NOT_FOUND", {
|
|
34
|
-
context: { error: `No network found for environment ${t.defaultEnvironment}` }
|
|
35
|
-
});
|
|
36
|
-
return s;
|
|
37
|
-
}, A = async () => {
|
|
38
|
-
const t = f(i()), s = await Q.create({
|
|
39
|
-
provider: new V(t.endpoint),
|
|
40
|
-
initWasm: !1,
|
|
41
|
-
noInitWarn: !0
|
|
42
|
-
}), h = "sr25519", m = new Y({ type: h, ss58Format: s.registry.chainSS58 });
|
|
43
|
-
return new Z(s, JSON.parse(ee), t.contract.address, "prosopo", 0, m.addFromAddress(i().account.address || ""));
|
|
44
|
-
}, x = () => {
|
|
45
|
-
if (!e.account)
|
|
46
|
-
throw new w("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
|
|
47
|
-
return e.account;
|
|
48
|
-
}, u = () => {
|
|
49
|
-
if (!e.dappAccount)
|
|
50
|
-
throw new w("GENERAL.SITE_KEY_MISSING");
|
|
51
|
-
return e.dappAccount;
|
|
52
|
-
}, d = D(e, o), N = () => {
|
|
53
|
-
r(), d(l());
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
start: async () => {
|
|
57
|
-
if (e.loading || e.isHuman)
|
|
58
|
-
return;
|
|
59
|
-
N(), d({
|
|
60
|
-
loading: !0
|
|
61
|
-
});
|
|
62
|
-
const t = i(), s = new M(), h = t.userAccountAddress || (await s.getAccount(t)).account.address;
|
|
63
|
-
if (d({
|
|
64
|
-
account: { account: { address: h } }
|
|
65
|
-
}), d({ dappAccount: t.account.address }), await q(100), !t.web2 && !t.userAccountAddress)
|
|
66
|
-
throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
67
|
-
context: { error: "Account address has not been set for web3 mode" }
|
|
68
|
-
});
|
|
69
|
-
const m = await A(), S = X(o, e, c), v = await $(m.query.getRandomActiveProvider, m.query)(h, u()), y = z(v.provider.url.toString()), E = new J(f(i()), y, u()), g = await E.getPowCaptchaChallenge(h, u()), T = oe(g.challenge, g.difficulty);
|
|
70
|
-
(await E.submitPowCaptchaSolution(g, x().account.address, u(), v, T))[p.verified] && (d({
|
|
71
|
-
isHuman: !0,
|
|
72
|
-
loading: !1
|
|
73
|
-
}), S.onHuman({
|
|
74
|
-
providerUrl: y,
|
|
75
|
-
[p.user]: x().account.address,
|
|
76
|
-
[p.dapp]: u(),
|
|
77
|
-
[p.challenge]: g.challenge,
|
|
78
|
-
[p.blockNumber]: v.blockNumber
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}, le = (a) => {
|
|
83
|
-
const e = a.config, o = e.theme === "light" ? "light" : "dark", c = a.config.theme === "light" ? F : B, l = a.callbacks || {}, [r, i] = te(b.useState, b.useRef), f = D(r, i), A = re(e, r, f, l);
|
|
84
|
-
return n("div", { children: n("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: n(W, { children: n(_, { children: C("div", { style: k, "data-cy": "button-human", children: [" ", C("div", { style: {
|
|
85
|
-
padding: P,
|
|
86
|
-
border: R,
|
|
87
|
-
backgroundColor: c.palette.background.default,
|
|
88
|
-
borderColor: c.palette.grey[300],
|
|
89
|
-
borderRadius: O,
|
|
90
|
-
display: "flex",
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
flexWrap: "wrap",
|
|
93
|
-
justifyContent: "space-between",
|
|
94
|
-
minHeight: `${G}px`,
|
|
95
|
-
overflow: "hidden"
|
|
96
|
-
}, children: [n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("div", { style: {
|
|
97
|
-
display: "flex",
|
|
98
|
-
justifyContent: "flex-start",
|
|
99
|
-
alignItems: "center",
|
|
100
|
-
flexWrap: "wrap"
|
|
101
|
-
}, children: n("div", { style: {
|
|
102
|
-
display: "flex",
|
|
103
|
-
alignItems: "center",
|
|
104
|
-
justifyContent: "center",
|
|
105
|
-
flexDirection: "column",
|
|
106
|
-
verticalAlign: "middle"
|
|
107
|
-
}, children: n("div", { style: {
|
|
108
|
-
display: "flex"
|
|
109
|
-
}, children: n("div", { style: { flex: 1 }, children: r.loading ? n(H, { themeColor: o }) : n(ne, { checked: r.isHuman, onChange: A.start, themeColor: o, labelText: "I am human" }) }) }) }) }) }), n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("a", { href: U, target: "_blank", "aria-label": L, children: n("div", { style: { flex: 1 }, children: n(j, { themeColor: o }) }) }) })] })] }) }) }) }) });
|
|
110
|
-
};
|
|
111
|
-
export {
|
|
112
|
-
le as default
|
|
113
|
-
};
|