@prosopo/procaptcha-bundle 3.0.12 → 3.1.6

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 (61) hide show
  1. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +17 -7
  2. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -1
  3. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +1 -1
  5. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
  6. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +2 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +2 -2
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +1 -1
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  16. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +6 -2
  17. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -1
  18. package/CHANGELOG.md +374 -0
  19. package/dist/bundle/{ProcaptchaWidget-48FxVPQd.js → ProcaptchaWidget-CJ-4hVS1.js} +25 -25
  20. package/dist/bundle/{ProcaptchaWidget-B2BzhXLv.js → ProcaptchaWidget-Cw3s7cGX.js} +290 -268
  21. package/dist/bundle/{builder-DNHtDoNG.js → builder-ByZ5z580.js} +3 -1
  22. package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +1002 -0
  23. package/dist/bundle/{captchaRenderer-DdOlOCKw.js → captchaRenderer-s4QuLEen.js} +23 -22
  24. package/dist/bundle/{commonChunk-HCVkoCqn.js → commonChunk-BjvuHlB1.js} +62 -68
  25. package/dist/bundle/{emotion-element-5486c51c.browser.esm-D7qvHZDV.js → emotion-element-c39617d8.browser.esm-BNNnmykm.js} +343 -345
  26. package/dist/bundle/index-BuQg3Zno.js +1884 -0
  27. package/dist/bundle/{index-DyYmvHVN.js → index-DIdd2cUz.js} +1 -1
  28. package/dist/bundle/{index-C00_J7av.js → index-IgqrmVIs.js} +61 -59
  29. package/dist/bundle/nobleChunk-Bbltwf44.js +2728 -0
  30. package/dist/bundle/procaptcha.bundle.js +2 -2
  31. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  32. package/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
  33. package/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
  34. package/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
  35. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  36. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
  37. package/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  38. package/dist/bundle/{utilChunk-sqstc6C5.js → utilChunk-DPr6oTOj.js} +22 -22
  39. package/dist/bundle/{utilCryptoChunk-qm-BM2eT.js → utilCryptoChunk-D6ZLkbFV.js} +176 -167
  40. package/dist/bundle/{web2Chunk-DCsWA5PR.js → web2Chunk-CNoojUDK.js} +1083 -983
  41. package/dist/bundle/web3Chunk-BlYvY4Ea.js +525 -0
  42. package/dist/bundle/{zodChunk-wTu9ZHzV.js → zodChunk-aEfPZzrp.js} +3 -3
  43. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +3 -2
  44. package/dist/cjs/util/captcha/captchaRenderer.cjs +4 -3
  45. package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +4 -3
  46. package/dist/cjs/util/captcha/components/imageCaptcha.cjs +1 -1
  47. package/dist/cjs/util/captcha/components/powCaptcha.cjs +1 -1
  48. package/dist/cjs/util/widgetFactory.cjs +7 -2
  49. package/dist/util/captcha/captchaComponentProvider.js +3 -2
  50. package/dist/util/captcha/captchaRenderer.js +4 -3
  51. package/dist/util/captcha/components/frictionlessCaptcha.js +4 -3
  52. package/dist/util/captcha/components/imageCaptcha.js +1 -1
  53. package/dist/util/captcha/components/powCaptcha.js +1 -1
  54. package/dist/util/widgetFactory.js +7 -2
  55. package/package.json +25 -26
  56. package/stats.html +1 -1
  57. package/vite.test.config.ts +3 -2
  58. package/dist/bundle/captchaComponentProvider-B7Vxx339.js +0 -968
  59. package/dist/bundle/index-7Xh-Mf8v.js +0 -1318
  60. package/dist/bundle/nobleChunk-Qozzkbsq.js +0 -3648
  61. package/dist/bundle/web3Chunk-B8txCqUJ.js +0 -517
@@ -1,5 +1,5 @@
1
1
  import { g as Dc } from "./bnChunk-DRlDxTFg.js";
2
- import { r as _a } from "./web2Chunk-DCsWA5PR.js";
2
+ import { r as _a } from "./web2Chunk-CNoojUDK.js";
3
3
  var Co = { exports: {} }, ve = {}, xo = { exports: {} }, _o = {};
4
4
  (function(e) {
5
5
  function t(C, z) {
@@ -1,4 +1,4 @@
1
- import { A, a as _, C as W, l as $ } from "./web2Chunk-DCsWA5PR.js";
1
+ import { A, a as v, C as W, l as $ } from "./web2Chunk-CNoojUDK.js";
2
2
  function N(e) {
3
3
  const t = e.getRootNode();
4
4
  return (t instanceof ShadowRoot ? t.host : e).closest("form");
@@ -40,7 +40,7 @@ const l = () => {
40
40
  },
41
41
  onReload: () => {
42
42
  }
43
- }), s = (e, t, o) => {
43
+ }), d = (e, t, o) => {
44
44
  const a = t.getAttribute(`data-${e}`);
45
45
  if (a) {
46
46
  const n = u(a);
@@ -53,15 +53,15 @@ const l = () => {
53
53
  return u(o);
54
54
  };
55
55
  function H(e, t, o) {
56
- const a = s(
56
+ const a = d(
57
57
  "callback",
58
58
  o,
59
59
  e == null ? void 0 : e.callback
60
60
  );
61
- a && (t.onHuman = (f) => {
62
- I(f, o), a(f);
61
+ a && (t.onHuman = (r) => {
62
+ I(r, o), a(r);
63
63
  });
64
- const n = s(
64
+ const n = d(
65
65
  "chalexpired-callback",
66
66
  o,
67
67
  e == null ? void 0 : e["chalexpired-callback"]
@@ -69,7 +69,7 @@ function H(e, t, o) {
69
69
  n && (t.onChallengeExpired = () => {
70
70
  l(), n();
71
71
  });
72
- const c = s(
72
+ const c = d(
73
73
  "expired-callback",
74
74
  o,
75
75
  e == null ? void 0 : e["expired-callback"]
@@ -77,45 +77,45 @@ function H(e, t, o) {
77
77
  c && (t.onExpired = () => {
78
78
  l(), c();
79
79
  });
80
- const i = s(
80
+ const i = d(
81
81
  "error-callback",
82
82
  o,
83
83
  e == null ? void 0 : e["error-callback"]
84
84
  );
85
- i && (t.onError = (f) => {
86
- l(), i(f);
85
+ i && (t.onError = (r) => {
86
+ l(), i(r);
87
87
  });
88
- const r = s(
88
+ const s = d(
89
89
  "close-callback",
90
90
  o,
91
91
  e == null ? void 0 : e["close-callback"]
92
92
  );
93
- r && (t.onClose = () => {
94
- r();
93
+ s && (t.onClose = () => {
94
+ s();
95
95
  });
96
- const y = s(
96
+ const p = d(
97
97
  "open-callback",
98
98
  o,
99
99
  e == null ? void 0 : e["open-callback"]
100
100
  );
101
- y && (t.onOpen = () => {
102
- y();
101
+ p && (t.onOpen = () => {
102
+ p();
103
103
  });
104
- const w = s(
104
+ const y = d(
105
105
  "failed-callback",
106
106
  o,
107
107
  e == null ? void 0 : e["failed-callback"]
108
108
  );
109
- w && (t.onFailed = () => {
110
- w();
109
+ y && (t.onFailed = () => {
110
+ y();
111
111
  });
112
- const h = s(
112
+ const w = d(
113
113
  "reset-callback",
114
114
  o,
115
115
  e == null ? void 0 : e["reset-callback"]
116
116
  );
117
- h && (t.onReset = () => {
118
- l(), h();
117
+ w && (t.onReset = () => {
118
+ l(), w();
119
119
  });
120
120
  }
121
121
  const I = (e, t) => {
@@ -128,7 +128,7 @@ const I = (e, t) => {
128
128
  const a = document.createElement("input");
129
129
  a.type = "hidden", a.name = A.procaptchaResponse, a.value = e, o.appendChild(a);
130
130
  }
131
- }, P = "https://prosopo.io", T = "Visit prosopo.io to learn more about the service and its accessibility options.", U = 74, x = 80, F = "80px", v = "302px", G = "8px", j = "2px", z = "1px solid", E = "checkbox__loading-spinner";
131
+ }, P = "https://prosopo.io", T = "Visit prosopo.io to learn more about the service and its accessibility options.", U = 74, x = 80, F = "80px", _ = "302px", G = "8px", j = "2px", z = "1px solid", E = "checkbox__loading-spinner";
132
132
  function B(e) {
133
133
  const t = document.createElement("div");
134
134
  return t.className = "checkbox", t.innerHTML = X(e) + q, t;
@@ -291,7 +291,7 @@ function O(e) {
291
291
  }
292
292
 
293
293
  .widget__outer {
294
- max-width: ${v};
294
+ max-width: ${_};
295
295
  min-height: 100%;
296
296
  overflow-x: auto;
297
297
  width: 100%;
@@ -318,7 +318,7 @@ function O(e) {
318
318
  }
319
319
 
320
320
  .widget__dimensions {
321
- max-width: ${v};
321
+ max-width: ${_};
322
322
  min-height: ${x}px;
323
323
  }
324
324
 
@@ -358,17 +358,17 @@ const ne = (e) => `
358
358
  ${e}
359
359
  </style>
360
360
  `, ce = (e) => {
361
- e.style.display = "flex", e.style.flexDirection = "column", e.style.width = "100%", e.style.maxWidth = v;
361
+ e.style.display = "flex", e.style.flexDirection = "column", e.style.width = "100%", e.style.maxWidth = _;
362
362
  };
363
363
  function ie(e, t, o) {
364
364
  const a = J(t), n = ae(o);
365
- le(n).appendChild(a), e.innerHTML = "", e.appendChild(n);
365
+ re(n).appendChild(a), e.innerHTML = "", e.appendChild(n);
366
366
  const i = K(n);
367
367
  if (!(i instanceof HTMLElement))
368
368
  throw new Error("Fail to initialize widget: interactive area is not found");
369
- return i;
369
+ return { widgetInteractiveArea: i, webComponent: n };
370
370
  }
371
- const le = (e) => e.shadowRoot || e, g = {
371
+ const re = (e) => e.shadowRoot || e, g = {
372
372
  0: "#fff",
373
373
  100: "#f5f5f5",
374
374
  200: "#eeeeee",
@@ -379,7 +379,7 @@ const le = (e) => e.shadowRoot || e, g = {
379
379
  700: "#616161",
380
380
  800: "#424242",
381
381
  900: "#212121"
382
- }, m = 10, re = {
382
+ }, m = 10, le = {
383
383
  palette: {
384
384
  mode: "light",
385
385
  primary: {
@@ -433,7 +433,7 @@ const le = (e) => e.shadowRoot || e, g = {
433
433
  }
434
434
  };
435
435
  function R(e) {
436
- return Object.values(W).find((a) => a === _(e, 0).getAttribute("data-captcha-type")) || "frictionless";
436
+ return Object.values(W).find((a) => a === v(e, 0).getAttribute("data-captcha-type")) || "frictionless";
437
437
  }
438
438
  const k = (e) => document.querySelector('script[src*="'.concat(e, '"]')), de = (e) => {
439
439
  const t = k(e);
@@ -446,7 +446,7 @@ const k = (e) => document.querySelector('script[src*="'.concat(e, '"]')), de = (
446
446
  }
447
447
  return { onloadUrlCallback: void 0, renderExplicit: void 0 };
448
448
  };
449
- class he {
449
+ class pe {
450
450
  constructor(t) {
451
451
  this.widgetThemeResolver = t, this.captchaRenderer = null, this._i18n = null;
452
452
  }
@@ -463,29 +463,31 @@ class he {
463
463
  }
464
464
  async createWidget(t, o, a, n = !0, c = !1) {
465
465
  o.theme = this.widgetThemeResolver.resolveWidgetTheme(t, o);
466
- const i = o.theme === "light" ? re : se;
467
- let r;
466
+ const i = o.theme === "light" ? le : se;
467
+ let s, p;
468
468
  if (c) {
469
- const h = document.createElement("div");
470
- t.appendChild(h), r = h;
471
- } else
472
- r = ie(t, i, "prosopo-procaptcha");
469
+ const r = document.createElement("div");
470
+ t.appendChild(r), s = r, p = r;
471
+ } else {
472
+ const r = ie(t, i, "prosopo-procaptcha");
473
+ s = r.widgetInteractiveArea, p = r.webComponent;
474
+ }
473
475
  return (await this.getCaptchaRenderer()).renderCaptcha({
474
476
  identifierPrefix: "procaptcha-",
475
477
  emotionCacheKey: "procaptcha",
476
478
  webComponentTag: "prosopo-procaptcha",
477
479
  defaultCaptchaType: W.frictionless
478
- }, r, o, a, n, this.i18n, c);
480
+ }, s, o, a, n, this.i18n, c, p);
479
481
  }
480
482
  async getCaptchaRenderer() {
481
483
  return this._i18n === null && (this._i18n = await $()), this.captchaRenderer === null && (this.captchaRenderer = await this.createCaptchaRenderer()), this.captchaRenderer;
482
484
  }
483
485
  async createCaptchaRenderer() {
484
- const t = (await import("./captchaRenderer-DdOlOCKw.js")).CaptchaRenderer, o = (await import("./captchaComponentProvider-B7Vxx339.js").then((a) => a.d)).CaptchaComponentProvider;
486
+ const t = (await import("./captchaRenderer-s4QuLEen.js")).CaptchaRenderer, o = (await import("./captchaComponentProvider-Cn75EmSH.js").then((a) => a.d)).CaptchaComponentProvider;
485
487
  return new t(new o());
486
488
  }
487
489
  }
488
- class pe {
490
+ class he {
489
491
  constructor() {
490
492
  this.themesSet = /* @__PURE__ */ new Set(["light", "dark"]), this.defaultTheme = "light";
491
493
  }
@@ -498,11 +500,11 @@ class pe {
498
500
  }
499
501
  }
500
502
  const C = "procaptcha.bundle.js";
501
- let d = [];
502
- const b = new he(new pe()), fe = "procaptcha:execute", S = async () => {
503
+ let h = [];
504
+ const b = new pe(new he()), fe = "procaptcha:execute", S = async () => {
503
505
  const e = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() !== "button");
504
506
  if (e.length) {
505
- const o = _(e, 0).getAttribute("data-sitekey"), a = _(e, 0).getAttribute("data-web3");
507
+ const o = v(e, 0).getAttribute("data-sitekey"), a = v(e, 0).getAttribute("data-web3");
506
508
  if (!o) {
507
509
  console.error("No siteKey found");
508
510
  return;
@@ -511,7 +513,7 @@ const b = new he(new pe()), fe = "procaptcha:execute", S = async () => {
511
513
  captchaType: n,
512
514
  siteKey: o
513
515
  }, a !== "true");
514
- d.push(...c);
516
+ h.push(...c);
515
517
  }
516
518
  const t = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() === "button");
517
519
  if (t.length)
@@ -521,21 +523,21 @@ const b = new he(new pe()), fe = "procaptcha:execute", S = async () => {
521
523
  siteKey: a,
522
524
  callback: n
523
525
  }, !0, !0);
524
- d.push(...i), o.addEventListener("click", async (r) => {
525
- r.preventDefault(), D();
526
+ h.push(...i), o.addEventListener("click", async (s) => {
527
+ s.preventDefault(), D();
526
528
  });
527
529
  }
528
530
  }, ue = async (e, t) => {
529
531
  const o = Object.prototype.hasOwnProperty.call(t, "size") && t.size === "invisible", a = !t.web3;
530
532
  if (o || e.tagName.toLowerCase() === "button") {
531
533
  const c = await b.createWidgets([e], t, a, !0);
532
- d.push(...c);
534
+ h.push(...c);
533
535
  return;
534
536
  }
535
537
  const n = await b.createWidgets([e], t, a, !1);
536
- d.push(...n);
538
+ h.push(...n);
537
539
  };
538
- function p(e) {
540
+ function f(e) {
539
541
  document && document.readyState !== "loading" ? e() : document.addEventListener("DOMContentLoaded", () => {
540
542
  e();
541
543
  });
@@ -572,28 +574,28 @@ const L = () => {
572
574
  const { onloadUrlCallback: o, renderExplicit: a } = de(C);
573
575
  let n = !1;
574
576
  if (a !== "explicit" && ((e = k(C)) == null || e.addEventListener("load", () => {
575
- p(S), n = !0;
576
- }), document.readyState === "complete" && !n && p(S)), o && ((t = k(C)) == null || t.addEventListener("load", () => {
577
+ f(S), n = !0;
578
+ }), document.readyState === "complete" && !n && f(S)), o && ((t = k(C)) == null || t.addEventListener("load", () => {
577
579
  const c = u(o);
578
- p(c);
580
+ f(c);
579
581
  }), document.readyState === "complete" && !n)) {
580
582
  const c = u(o);
581
- p(c);
583
+ f(c);
582
584
  }
583
585
  }, me = () => {
584
- for (const e of d)
586
+ for (const e of h)
585
587
  e.unmount();
586
- d = [], L();
588
+ h = [], L();
587
589
  };
588
- window.procaptcha = { ready: p, render: ue, reset: me, execute: D };
590
+ window.procaptcha = { ready: f, render: ue, reset: me, execute: D };
589
591
  L();
590
592
  export {
591
593
  E as W,
592
- p as a,
594
+ f as a,
593
595
  me as b,
594
596
  se as d,
595
597
  D as e,
596
598
  M as g,
597
- re as l,
599
+ le as l,
598
600
  ue as r
599
601
  };