@prosopo/procaptcha-bundle 2.5.3 → 2.5.5

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 (60) hide show
  1. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
  2. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js +15 -17
  3. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +23 -27
  5. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -1
  6. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
  7. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  8. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +4 -7
  9. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +2 -2
  11. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +9 -4
  13. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -1
  14. package/dist/bundle/ProcaptchaWidget-CCSN3Dxj.js +636 -0
  15. package/dist/bundle/{ProcaptchaWidget-Dnwno-4N.js → ProcaptchaWidget-Dfex8hc8.js} +4 -4
  16. package/dist/bundle/{asU8a-JliaME7-.js → asU8a-CAsEnbuP.js} +1 -1
  17. package/dist/bundle/{bip39-CFjno8fK.js → bip39-DCaMcFzo.js} +2 -2
  18. package/dist/bundle/{captchaComponentProvider-dcMua0p9.js → captchaComponentProvider-Dm44AMrY.js} +23 -18
  19. package/dist/bundle/captchaRenderer-BBodRhQu.js +70 -0
  20. package/dist/bundle/{emotion-element-5486c51c.browser.esm-Bywq83R5.js → emotion-element-5486c51c.browser.esm-CQHFV-dS.js} +711 -746
  21. package/dist/bundle/{fp.esm-C0kLYOiJ.js → fp.esm-DYWeNGcH.js} +17 -0
  22. package/dist/bundle/{hash-CtL1HOjf.js → hash-D-64Vz5z.js} +1 -1
  23. package/dist/bundle/{captchaRenderer-D-du50M4.js → index-9I1Aae33.js} +1293 -1355
  24. package/dist/bundle/index-DCHEbWAs.js +1242 -0
  25. package/dist/bundle/{index-DcG_c-Na.js → index-DkQ4njKa.js} +12 -12
  26. package/dist/bundle/{index-BTlHNFX8.js → index-DxswvPTy.js} +285 -183
  27. package/dist/bundle/{index-BMjJnq60.js → index-nNwZuute.js} +252 -252
  28. package/dist/bundle/index.d.ts.map +1 -1
  29. package/dist/bundle/locales/de/translation.json +55 -405
  30. package/dist/bundle/locales/en/translation.json +55 -405
  31. package/dist/bundle/locales/es/translation.json +55 -405
  32. package/dist/bundle/locales/fr/translation.json +55 -405
  33. package/dist/bundle/locales/it/translation.json +55 -405
  34. package/dist/bundle/locales/pt/translation.json +55 -405
  35. package/dist/bundle/locales/pt-BR/translation.json +55 -405
  36. package/dist/bundle/procaptcha.bundle.js +1 -1
  37. package/dist/bundle/{useTranslation-7b6JJ18N.js → useTranslation-CEt2t9kE.js} +1 -1
  38. package/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
  39. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  40. package/dist/bundle/util/widgetFactory.d.ts +2 -2
  41. package/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +15 -17
  44. package/dist/index.js.map +1 -1
  45. package/dist/tests/util/renderLogic.test.js +23 -27
  46. package/dist/tests/util/renderLogic.test.js.map +1 -1
  47. package/dist/util/captcha/captchaRenderer.d.ts +2 -2
  48. package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
  49. package/dist/util/captcha/captchaRenderer.js +4 -7
  50. package/dist/util/captcha/captchaRenderer.js.map +1 -1
  51. package/dist/util/widgetFactory.d.ts +2 -2
  52. package/dist/util/widgetFactory.d.ts.map +1 -1
  53. package/dist/util/widgetFactory.js +9 -4
  54. package/dist/util/widgetFactory.js.map +1 -1
  55. package/package.json +20 -14
  56. package/stats.html +1 -1
  57. package/vite.config.ts +18 -3
  58. package/vite.serve.config.ts +24 -0
  59. package/dist/bundle/ProcaptchaWidget-BlWWnPeB.js +0 -615
  60. package/dist/bundle/index-B8oMghZ3.js +0 -1120
@@ -1,6 +1,6 @@
1
- import { g as Se, h as le, j as b, a as ue, b as pe, d as we, w as St, r as v, T as wt, u as xt, i as Pt, e as _t, f as Ct, k as Lt, l as w, A as i, S as xe, m as Pe, n as F, U as te, P as _e } from "./emotion-element-5486c51c.browser.esm-Bywq83R5.js";
2
- import { e as Ce } from "./translations-B0P9axY3.js";
3
- import { a as Le, W as Ee, l as Te, b as Ae, d as Ie, C as R } from "./index-BTlHNFX8.js";
1
+ import { h as le, j as b, a as ue, b as pe, s as Se, w as St, r as v, T as wt, u as xt, i as Pt, d as _t, e as Ct, g as Lt, f as w, S as we, k as xe, A as F, U as te, P as Pe } from "./emotion-element-5486c51c.browser.esm-CQHFV-dS.js";
2
+ import { a as _e, g as Ce, W as Le, A as i, l as Ee, b as Te, d as Ae, C as R } from "./index-DxswvPTy.js";
3
+ import { e as Ie } from "./translations-B0P9axY3.js";
4
4
  import { g as It } from "./_commonjsHelpers-DaMA6jEr.js";
5
5
  const je = { t: (t) => t };
6
6
  class U extends Error {
@@ -373,7 +373,7 @@ function fe(t = {}) {
373
373
  });
374
374
  }
375
375
  fe();
376
- const x = Ce([
376
+ const x = Ie([
377
377
  "trace",
378
378
  "debug",
379
379
  "info",
@@ -479,7 +479,7 @@ const ze = Ke(x.enum.info, "global"), se = (t) => Object.values(t), Ue = async (
479
479
  context: { environment: t }
480
480
  });
481
481
  }, We = async (t) => {
482
- const e = (s, n) => Math.floor(Math.random() * (n - s + 1) + s), r = await Ue(t.defaultEnvironment), o = Le(r, e(0, r.length - 1));
482
+ const e = (s, n) => Math.floor(Math.random() * (n - s + 1) + s), r = await Ue(t.defaultEnvironment), o = _e(r, e(0, r.length - 1));
483
483
  return {
484
484
  providerAccount: o.address,
485
485
  provider: {
@@ -496,9 +496,9 @@ const ze = Ke(x.enum.info, "global"), se = (t) => Object.values(t), Ue = async (
496
496
  console.error(n), r(), await e();
497
497
  }
498
498
  }, C = (t) => ({
499
- ...Se(void 0),
499
+ ...Ce(void 0),
500
500
  ...t
501
- }), Be = async (t) => t ? (await import("./index-DcG_c-Na.js")).ExtensionWeb2 : (await import("./index-DcG_c-Na.js")).ExtensionWeb3;
501
+ }), Be = async (t) => t ? (await import("./index-DkQ4njKa.js")).ExtensionWeb2 : (await import("./index-DkQ4njKa.js")).ExtensionWeb3;
502
502
  var he = { exports: {} }, l = {};
503
503
  var f = typeof Symbol == "function" && Symbol.for, G = f ? Symbol.for("react.element") : 60103, B = f ? Symbol.for("react.portal") : 60106, L = f ? Symbol.for("react.fragment") : 60107, E = f ? Symbol.for("react.strict_mode") : 60108, T = f ? Symbol.for("react.profiler") : 60114, A = f ? Symbol.for("react.provider") : 60109, I = f ? Symbol.for("react.context") : 60110, V = f ? Symbol.for("react.async_mode") : 60111, j = f ? Symbol.for("react.concurrent_mode") : 60111, N = f ? Symbol.for("react.forward_ref") : 60112, O = f ? Symbol.for("react.suspense") : 60113, Ve = f ? Symbol.for("react.suspense_list") : 60120, $ = f ? Symbol.for("react.memo") : 60115, k = f ? Symbol.for("react.lazy") : 60116, qe = f ? Symbol.for("react.block") : 60121, Je = f ? Symbol.for("react.fundamental") : 60117, Ye = f ? Symbol.for("react.responder") : 60118, Qe = f ? Symbol.for("react.scope") : 60119;
504
504
  function m(t) {
@@ -616,7 +616,7 @@ function tt(t, e, r) {
616
616
  function ye() {
617
617
  for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
618
618
  e[r] = arguments[r];
619
- return we(e);
619
+ return Se(e);
620
620
  }
621
621
  const rt = ye`{
622
622
  &:before {
@@ -641,11 +641,15 @@ const rt = ye`{
641
641
  borderWidth: "1px"
642
642
  }, ne = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", st = "https://docs.prosopo.io/en/basics/faq/", nt = () => Array.from({ length: 8 }, () => ne[Math.floor(Math.random() * ne.length)]).join(""), ae = ye`
643
643
  display: none;
644
- @media (min-width: 216px) {
644
+ @media (min-width: 275px) {
645
645
  display: flex;
646
646
  font-size: 12px;
647
647
  }
648
- @media (min-width: 268px) {
648
+ @media (min-width: 300px) {
649
+ display: flex;
650
+ font-size: 14px;
651
+ }
652
+ @media (min-width: 320px) {
649
653
  display: flex;
650
654
  font-size: 16px;
651
655
  }
@@ -666,7 +670,7 @@ const rt = ye`{
666
670
  display: "inline-flex",
667
671
  alignItems: "center",
668
672
  minHeight: "58px"
669
- }, children: [n ? g("div", { className: "checkbox__outer", children: g("div", { className: "checkbox__wrapper", children: g("div", { className: "checkbox__inner", children: g("div", { className: "checkbox__content", children: g("div", { className: Ee, "aria-label": "Loading spinner" }) }) }) }) }) : g("input", { name: P, id: P, onMouseEnter: () => p(!0), onMouseLeave: () => p(!1), css: rt, type: "checkbox", "aria-live": "assertive", "aria-label": o, onChange: (_) => {
673
+ }, children: [n ? g("div", { className: "checkbox__outer", children: g("div", { className: "checkbox__wrapper", children: g("div", { className: "checkbox__inner", children: g("div", { className: "checkbox__content", children: g("div", { className: Le, "aria-label": "Loading spinner" }) }) }) }) }) : g("input", { name: P, id: P, onMouseEnter: () => p(!0), onMouseLeave: () => p(!1), css: rt, type: "checkbox", "aria-live": "assertive", "aria-label": o, onChange: (_) => {
670
674
  _.preventDefault(), _.stopPropagation(), p(!1), e();
671
675
  }, checked: r, style: S, disabled: s !== void 0, className: n ? "checkbox__loading-spinner" : "", "data-cy": "captcha-checkbox" }), s ? g("label", { css: {
672
676
  color: t.palette.error.main,
@@ -804,7 +808,7 @@ class ct extends it {
804
808
  });
805
809
  }
806
810
  submitPowCaptchaSolution(e, r, o, s, n, a) {
807
- const c = xe.parse({
811
+ const c = we.parse({
808
812
  [i.challenge]: e.challenge,
809
813
  [i.difficulty]: e.difficulty,
810
814
  [i.timestamp]: e.timestamp,
@@ -854,7 +858,7 @@ class ct extends it {
854
858
  });
855
859
  }
856
860
  getProviderDetails() {
857
- return this.fetch(Pe.GetProviderDetails, {
861
+ return this.fetch(xe.GetProviderDetails, {
858
862
  headers: {
859
863
  "Prosopo-Site-Key": this.account
860
864
  }
@@ -902,7 +906,7 @@ class ct extends it {
902
906
  });
903
907
  }
904
908
  }
905
- const lt = v.lazy(async () => import("./ProcaptchaWidget-Dnwno-4N.js")), ve = (t) => g(v.Suspense, { children: g(lt, { config: t.config, callbacks: t.callbacks, frictionlessState: t.frictionlessState, i18n: t.i18n }) }), ut = v.lazy(async () => import("./ProcaptchaWidget-BlWWnPeB.js")), be = (t) => g(v.Suspense, { children: g(ut, { config: t.config, callbacks: t.callbacks, frictionlessState: t.frictionlessState }) }), pt = async () => (await import("./index-B8oMghZ3.js")).default, ft = async (t) => {
909
+ const lt = v.lazy(async () => import("./ProcaptchaWidget-Dfex8hc8.js")), ve = (t) => g(v.Suspense, { children: g(lt, { config: t.config, callbacks: t.callbacks, frictionlessState: t.frictionlessState, i18n: t.i18n }) }), ut = v.lazy(async () => import("./ProcaptchaWidget-CCSN3Dxj.js")), be = (t) => g(v.Suspense, { children: g(ut, { ...t }) }), pt = async () => (await import("./index-DCHEbWAs.js")).default, ft = async (t) => {
906
910
  const r = await (await pt())(), s = await new (await Be(t.web2))().getAccount(t);
907
911
  if (!t.account.address)
908
912
  throw new W("GENERAL.SITE_KEY_MISSING");
@@ -916,7 +920,7 @@ const lt = v.lazy(async () => import("./ProcaptchaWidget-Dnwno-4N.js")), ve = (t
916
920
  error: c.error
917
921
  };
918
922
  }, ie = (t, e, r, o, s) => {
919
- const n = t === "light" ? Ae : Ie;
923
+ const n = t === "light" ? Te : Ae;
920
924
  return e === "invisible" ? null : b.jsx(at, { theme: n, onChange: async () => {
921
925
  }, checked: !1, labelText: o("WIDGET.I_AM_HUMAN"), error: r, "aria-label": "human checkbox", loading: s });
922
926
  }, ce = (t) => ({
@@ -925,7 +929,7 @@ const lt = v.lazy(async () => import("./ProcaptchaWidget-Dnwno-4N.js")), ve = (t
925
929
  }), ht = ({ config: t, callbacks: e, restart: r, i18n: o, detectBot: s = ft }) => {
926
930
  const n = v.useRef(ce(0)), a = C(e);
927
931
  v.useEffect(() => {
928
- t.language && (o ? o.language !== t.language && o.changeLanguage(t.language).then((y) => y) : Te().then((y) => {
932
+ t.language && (o ? o.language !== t.language && o.changeLanguage(t.language).then((y) => y) : Ee().then((y) => {
929
933
  y.language !== t.language && y.changeLanguage(t.language).then((d) => d);
930
934
  }));
931
935
  }, [o, t.language]);
@@ -943,7 +947,7 @@ const lt = v.lazy(async () => import("./ProcaptchaWidget-Dnwno-4N.js")), ve = (t
943
947
  await Ge(async () => {
944
948
  var Y, Q, X, Z, ee;
945
949
  n.current.attemptCount += 1;
946
- const y = _e.parse(t), d = await s(y);
950
+ const y = Pe.parse(t), d = await s(y);
947
951
  if ((Y = d.error) != null && Y.message) {
948
952
  n.current = {
949
953
  ...n.current,
@@ -1006,8 +1010,9 @@ export {
1006
1010
  W as c,
1007
1011
  We as d,
1008
1012
  ct as e,
1009
- $t as f,
1013
+ ye as f,
1010
1014
  C as g,
1015
+ $t as h,
1011
1016
  g as j,
1012
1017
  Ge as p
1013
1018
  };
@@ -0,0 +1,70 @@
1
+ import { P as d, E as C, c as v, j as f, C as R } from "./emotion-element-5486c51c.browser.esm-CQHFV-dS.js";
2
+ import { r as b } from "./index-9I1Aae33.js";
3
+ import { L as i } from "./translations-B0P9axY3.js";
4
+ var s, A = b;
5
+ s = A.createRoot;
6
+ function E(o, e = "light", t, a = !0, r = !1) {
7
+ return o || (o = ""), d.parse({
8
+ defaultEnvironment: C.parse("production"),
9
+ userAccountAddress: "",
10
+ account: {
11
+ address: o
12
+ },
13
+ serverUrl: "",
14
+ mongoAtlasUri: "",
15
+ devOnlyWatchEvents: !1,
16
+ web2: a,
17
+ mode: r ? "invisible" : "visible",
18
+ theme: e,
19
+ language: t
20
+ });
21
+ }
22
+ const y = (o, e, t) => {
23
+ const a = (o == null ? void 0 : o.language) || e.getAttribute("data-language");
24
+ a && (t.language = x(a));
25
+ }, x = (o) => {
26
+ try {
27
+ return i.parse(o);
28
+ } catch {
29
+ return console.error("Invalid language attribute: ".concat(o)), i.parse("en");
30
+ }
31
+ }, L = (o, e, t) => {
32
+ const a = (o == null ? void 0 : o["challenge-valid-length"]) || e.getAttribute("data-challenge-valid-length");
33
+ a && (t.captchas.image.solutionTimeout = Number.parseInt(a), t.captchas.pow.solutionTimeout = Number.parseInt(a));
34
+ };
35
+ class V {
36
+ constructor(e) {
37
+ this.captchaComponentProvider = e;
38
+ }
39
+ renderCaptcha(e, t, a, r, l, h, u = !1) {
40
+ const m = (a == null ? void 0 : a.captchaType) || e.defaultCaptchaType, c = E(a.siteKey, a.theme, a.language, l, u);
41
+ this.readAndValidateSettings(t, c, a);
42
+ const n = this.createReactRoot(t, e.identifierPrefix), p = this.makeEmotionCache(e.emotionCacheKey, t), g = this.captchaComponentProvider.getCaptchaComponent(m, {
43
+ config: c,
44
+ i18n: h,
45
+ callbacks: r
46
+ });
47
+ return this.renderCaptchaComponent(n, p, g), n;
48
+ }
49
+ readAndValidateSettings(e, t, a) {
50
+ L(a, e, t), y(a, e, t);
51
+ }
52
+ makeEmotionCache(e, t) {
53
+ return v({
54
+ key: e,
55
+ prepend: !0,
56
+ container: t
57
+ });
58
+ }
59
+ createReactRoot(e, t) {
60
+ return s(e, {
61
+ identifierPrefix: t
62
+ });
63
+ }
64
+ renderCaptchaComponent(e, t, a) {
65
+ e.render(f.jsx(R, { value: t, children: a }));
66
+ }
67
+ }
68
+ export {
69
+ V as CaptchaRenderer
70
+ };