@prosopo/procaptcha-bundle 2.4.1 → 2.5.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.
Files changed (28) hide show
  1. package/dist/bundle/{ProcaptchaWidget-DOETad4N.js → ProcaptchaWidget-CAyH6qD7.js} +33 -31
  2. package/dist/bundle/{ProcaptchaWidget-79FRw4Va.js → ProcaptchaWidget-CY3qomFu.js} +153 -149
  3. package/dist/bundle/{asU8a-2GgUBNjQ.js → asU8a-Br9wz334.js} +1 -1
  4. package/dist/bundle/{bip39-C01p7UHO.js → bip39-BtaWByKg.js} +7 -7
  5. package/dist/bundle/browser-ponyfill-Ck_bwPOY.js +339 -0
  6. package/dist/bundle/{hash-0yoKUuST.js → hash-KElfghPn.js} +7 -7
  7. package/dist/bundle/{index-Ckreqz7Q.js → index-B0trzdT2.js} +3 -3
  8. package/dist/bundle/index-Cb-XcaMX.js +4372 -0
  9. package/dist/bundle/index-VYSrdSle.js +11587 -0
  10. package/dist/bundle/{index-DlBTo0Xd.js → index-n-2hvBzo.js} +405 -405
  11. package/dist/bundle/locales/de/translation.json +405 -0
  12. package/dist/bundle/locales/en/translation.json +405 -0
  13. package/dist/bundle/locales/es/translation.json +405 -0
  14. package/dist/bundle/locales/fr/translation.json +405 -0
  15. package/dist/bundle/locales/it/translation.json +405 -0
  16. package/dist/bundle/locales/pt/translation.json +405 -0
  17. package/dist/bundle/locales/pt-BR/translation.json +405 -0
  18. package/dist/bundle/procaptcha.bundle.js +1 -1
  19. package/dist/bundle/useTranslation-CcYxvTxi.js +2435 -0
  20. package/package.json +11 -11
  21. package/stats.html +1 -1
  22. package/vite.cjs.config.ts +1 -1
  23. package/vite.config.ts +32 -1
  24. package/vite.test.config.ts +1 -1
  25. package/webpack.config.cjs +1 -1
  26. package/dist/bundle/index-C8sSamyh.js +0 -6521
  27. package/dist/bundle/index-DOFIggts.js +0 -17295
  28. package/dist/bundle/useTranslation-CgamIJ5S.js +0 -550
@@ -1,5 +1,5 @@
1
- import { p as k, e as w, g as U, h as O, A as r, f as M, i as j, k as S, E as F, r as h, m as B, j as t, W as G, n as X, C as K, o as Y, a as W, q, s as z, t as V, u as $, v as J, L as Q, w as Z, x as ee, y as ne, z as ae, l as te, d as oe } from "./index-DOFIggts.js";
2
- import { s as re, a as se, b as P, u as ce, c as ie } from "./useTranslation-CgamIJ5S.js";
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-VYSrdSle.js";
2
+ import { b as P, a as oe, s as re, u as se, c as ce, l as ie } from "./useTranslation-CcYxvTxi.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 = j(d), A = () => ({
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
- }, x = () => {
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
- }, g = () => {
32
+ }, h = () => {
33
33
  const a = {
34
34
  userAccountAddress: "",
35
35
  ...c
36
36
  };
37
- return e.account && (a.userAccountAddress = e.account.account.address), S.parse(a);
38
- }, m = () => {
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
- }, f = () => {
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(A()), i.onReset(), a && a();
49
+ u(), T(), o(x()), i.onReset(), a && a();
50
50
  }, L = () => {
51
- const a = g().captchas.pow.solutionTimeout, b = setTimeout(() => {
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 k(async () => {
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 = g(), D = await (async () => n ? n.userAccount : new (await F(a.web2))().getAccount(a))(), v = D.account.address;
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 re(100), !a.web2 && !a.userAccountAddress)
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 U(g());
74
- const _ = E.provider.url, R = new O(_, f()), l = await R.getPowCaptchaChallenge(v, f(), n == null ? void 0 : n.sessionId);
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: se(l[r.timestamp].toString()),
90
+ data: re(l[r.timestamp].toString()),
91
91
  type: "bytes"
92
92
  });
93
- (await R.submitPowCaptchaSolution(l, m().account.account.address, f(), y, H.signature.toString(), a.captchas.pow.verifiedTimeout))[r.verified] ? (o({
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(M({
96
+ }), i.onHuman(j({
97
97
  [r.providerUrl]: _,
98
- [r.user]: m().account.account.address,
99
- [r.dapp]: f(),
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()) : x();
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 } = ce(), s = c.config, d = s.theme === "light" ? "light" : "dark", n = c.frictionlessState, i = c.config.theme === "light" ? te : oe, A = c.callbacks || {}, [u, x] = ie(h.useState, h.useRef), T = P(u, x), g = h.useRef(ge(s, u, T, A, n)), m = h.useRef(null);
121
- return h.useEffect(() => {
122
- s.language && B.changeLanguage(s.language);
123
- }, [s.language]), t("div", { ref: m, style: { width: "100%", minHeight: G }, children: t("div", { style: {
124
- maxWidth: X,
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(K, { children: t(Y, { children: W("div", { style: q, "data-cy": "button-human", children: [" ", W("div", { style: {
131
- padding: z,
132
- border: V,
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: `${J}px`,
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: g.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: ee, target: "_blank", "aria-label": ne, children: t("div", { style: { flex: 1 }, children: t(ae, { themeColor: d, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
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