@prosopo/procaptcha-bundle 0.3.2 → 0.3.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/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/dist/bundle/Captcha-CX9JR4o1.js +108 -0
- package/dist/bundle/ProcaptchaWidget-Boodb_xG.js +895 -0
- package/dist/bundle/{index-D_tmH38V.js → index-DNBOJlnJ.js} +2177 -2133
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/{interface-B2_ap_kR.js → utils-wnaO-SHm.js} +5222 -5074
- package/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/procaptcha-pow/dist/Services/Manager.cjs +98 -26
- package/dist/cjs/procaptcha-pow/dist/components/Captcha.cjs +12 -19
- package/dist/cjs/procaptcha-pow/dist/components/ProcaptchaPoW.cjs +1 -1
- package/dist/cjs/web-components/dist/CaptchaPlaceholder.cjs +4 -6
- package/dist/cjs/web-components/dist/WidgetConstants.cjs +6 -0
- package/dist/cjs/web-components/dist/index.cjs +3 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/stats.html +1 -1
- package/vite.config.ts +1 -1
- package/dist/bundle/Captcha-ymSK23DO.js +0 -73
- package/dist/bundle/ProcaptchaWidget-a74LJVtB.js +0 -940
package/vite.config.ts
CHANGED
|
@@ -23,7 +23,7 @@ loadEnv()
|
|
|
23
23
|
process.env.TS_NODE_PROJECT = path.resolve('./tsconfig.json')
|
|
24
24
|
|
|
25
25
|
// Package specific config
|
|
26
|
-
const copyTo = ['../../demos/client-bundle-example/src']
|
|
26
|
+
const copyTo = ['../../demos/client-bundle-example/src/assets']
|
|
27
27
|
const bundleName = 'procaptcha'
|
|
28
28
|
const packageName = '@prosopo/procaptcha-bundle'
|
|
29
29
|
const entry = './src/index.tsx'
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { P as C, r as g, l as E, d as b, j as e, C as k, W as A, a as x, c as P, e as S, L as T, f as W, g as N, h as D } from "./index-D_tmH38V.js";
|
|
2
|
-
import { v as _, h as v, n as R, w as O, t as I, m as L, A as j, W as H, K as U, q as G, C as F, u as M } from "./interface-B2_ap_kR.js";
|
|
3
|
-
const q = (t, o) => {
|
|
4
|
-
let n = 0;
|
|
5
|
-
const i = "0".repeat(o);
|
|
6
|
-
for (; ; ) {
|
|
7
|
-
const r = new TextEncoder().encode(n + t);
|
|
8
|
-
if (K(_(r)).startsWith(i))
|
|
9
|
-
return n;
|
|
10
|
-
n += 1;
|
|
11
|
-
}
|
|
12
|
-
}, K = (t) => Array.from(t).map((o) => o.toString(16).padStart(2, "0")).join(""), X = async (t) => {
|
|
13
|
-
const o = () => {
|
|
14
|
-
const a = {
|
|
15
|
-
userAccountAddress: "",
|
|
16
|
-
...t
|
|
17
|
-
};
|
|
18
|
-
return C.parse(a);
|
|
19
|
-
}, n = (a) => {
|
|
20
|
-
const h = a.networks[a.defaultNetwork];
|
|
21
|
-
if (!h)
|
|
22
|
-
throw new v("DEVELOPER.NETWORK_NOT_FOUND", {
|
|
23
|
-
context: { error: `No network found for environment ${a.defaultEnvironment}` }
|
|
24
|
-
});
|
|
25
|
-
return h;
|
|
26
|
-
}, i = async () => {
|
|
27
|
-
const a = n(o()), h = await j.create({ provider: new H(a.endpoint), initWasm: !1 }), w = "sr25519", y = new U({ type: w, ss58Format: h.registry.chainSS58 });
|
|
28
|
-
return new G(h, JSON.parse(F), a.contract.address, "prosopo", 0, y.addFromAddress(o().account.address || ""));
|
|
29
|
-
}, r = o();
|
|
30
|
-
if (!r.web2 && !r.userAccountAddress)
|
|
31
|
-
throw new v("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
32
|
-
context: { error: "Account address has not been set for web3 mode" }
|
|
33
|
-
});
|
|
34
|
-
const s = await new R().getAccount(r), d = await i(), u = await O(d.query.getRandomActiveProvider, d.query)(s.account.address, t.account.address || ""), f = I(u.provider.url.toString()), p = new L(n(o()), f, t.account.address || ""), c = await p.getPowCaptchaChallenge(s.account.address, t.account.address || "");
|
|
35
|
-
c.challenge, c.difficulty;
|
|
36
|
-
const m = q(c.challenge, c.difficulty);
|
|
37
|
-
return await p.submitPowCaptchaSolution(c, s.account.address, t.account.address || "", u, m);
|
|
38
|
-
}, Q = (t) => {
|
|
39
|
-
const [o, n] = g.useState(!1), [i, r] = g.useState(!1), l = t.config.theme, s = l ? "light" : "dark", d = g.useMemo(() => l === "light" ? E : b, [l]), u = async () => {
|
|
40
|
-
r(!0), X(t.config).then((f) => {
|
|
41
|
-
f.verified && n(!0), r(!1);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
return e("div", { children: e("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: e(k, { children: e(A, { children: x("div", { style: P, "data-cy": "button-human", children: [" ", x("div", { style: {
|
|
45
|
-
padding: "2px",
|
|
46
|
-
border: "1px solid",
|
|
47
|
-
backgroundColor: d.palette.background.default,
|
|
48
|
-
borderColor: d.palette.grey[300],
|
|
49
|
-
borderRadius: "4px",
|
|
50
|
-
display: "flex",
|
|
51
|
-
alignItems: "center",
|
|
52
|
-
flexWrap: "wrap",
|
|
53
|
-
justifyContent: "space-between",
|
|
54
|
-
minHeight: `${S}px`,
|
|
55
|
-
overflow: "hidden"
|
|
56
|
-
}, children: [e("div", { style: { display: "inline-flex", flexDirection: "column" }, children: e("div", { style: {
|
|
57
|
-
display: "flex",
|
|
58
|
-
justifyContent: "flex-start",
|
|
59
|
-
alignItems: "center",
|
|
60
|
-
flexWrap: "wrap"
|
|
61
|
-
}, children: e("div", { style: {
|
|
62
|
-
display: "flex",
|
|
63
|
-
alignItems: "center",
|
|
64
|
-
justifyContent: "center",
|
|
65
|
-
flexDirection: "column",
|
|
66
|
-
verticalAlign: "middle"
|
|
67
|
-
}, children: e("div", { style: {
|
|
68
|
-
display: "flex"
|
|
69
|
-
}, children: e("div", { style: { flex: 1 }, children: i ? e(T, { themeColor: s }) : e(M, { checked: o, onChange: u, themeColor: s, labelText: "I am human" }) }) }) }) }) }), e("div", { style: { display: "inline-flex", flexDirection: "column" }, children: e("a", { href: W, target: "_blank", "aria-label": N, children: e("div", { style: { flex: 1 }, children: e(D, { themeColor: s }) }) }) })] })] }) }) }) }) });
|
|
70
|
-
};
|
|
71
|
-
export {
|
|
72
|
-
Q as default
|
|
73
|
-
};
|