@prosopo/procaptcha-bundle 3.0.13 → 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 (60) hide show
  1. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +19 -9
  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 +347 -0
  19. package/dist/bundle/{ProcaptchaWidget-BIt2pcrz.js → ProcaptchaWidget-CJ-4hVS1.js} +24 -24
  20. package/dist/bundle/{ProcaptchaWidget-CXxnCzl2.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-CqnUYyKY.js → captchaRenderer-s4QuLEen.js} +23 -22
  24. package/dist/bundle/{commonChunk-BKceWhtS.js → commonChunk-BjvuHlB1.js} +62 -68
  25. package/dist/bundle/{emotion-element-5486c51c.browser.esm-CimrRZxS.js → emotion-element-c39617d8.browser.esm-BNNnmykm.js} +343 -345
  26. package/dist/bundle/index-BuQg3Zno.js +1884 -0
  27. package/dist/bundle/{index-KHTbPva_.js → index-DIdd2cUz.js} +1 -1
  28. package/dist/bundle/{index-hrOz2CPm.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/{utilCryptoChunk-BKe3CKqn.js → utilCryptoChunk-D6ZLkbFV.js} +252 -243
  39. package/dist/bundle/{web2Chunk-Cqw91v-J.js → web2Chunk-CNoojUDK.js} +1067 -977
  40. package/dist/bundle/web3Chunk-BlYvY4Ea.js +525 -0
  41. package/dist/bundle/{zodChunk-wTu9ZHzV.js → zodChunk-aEfPZzrp.js} +3 -3
  42. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +3 -2
  43. package/dist/cjs/util/captcha/captchaRenderer.cjs +4 -3
  44. package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +4 -3
  45. package/dist/cjs/util/captcha/components/imageCaptcha.cjs +1 -1
  46. package/dist/cjs/util/captcha/components/powCaptcha.cjs +1 -1
  47. package/dist/cjs/util/widgetFactory.cjs +7 -2
  48. package/dist/util/captcha/captchaComponentProvider.js +3 -2
  49. package/dist/util/captcha/captchaRenderer.js +4 -3
  50. package/dist/util/captcha/components/frictionlessCaptcha.js +4 -3
  51. package/dist/util/captcha/components/imageCaptcha.js +1 -1
  52. package/dist/util/captcha/components/powCaptcha.js +1 -1
  53. package/dist/util/widgetFactory.js +7 -2
  54. package/package.json +19 -20
  55. package/stats.html +1 -1
  56. package/vite.test.config.ts +3 -2
  57. package/dist/bundle/captchaComponentProvider-BGEAkC9Y.js +0 -968
  58. package/dist/bundle/index-7Xh-Mf8v.js +0 -1318
  59. package/dist/bundle/nobleChunk-CQ4ENyKh.js +0 -3769
  60. package/dist/bundle/web3Chunk-BcwDKvjL.js +0 -517
@@ -1,11 +1,11 @@
1
- import { c as d, j as C, C as v } from "./emotion-element-5486c51c.browser.esm-CimrRZxS.js";
2
- import { r as f } from "./index-KHTbPva_.js";
3
- import { P as A, b, L as i } from "./web2Chunk-Cqw91v-J.js";
4
- var l, R = f;
5
- l = R.createRoot;
6
- function y(o, e = "light", t, a = !0, c = !1, r) {
7
- return o || (o = ""), A.parse({
8
- defaultEnvironment: b.parse("production"),
1
+ import { c as C, j as v, C as f } from "./emotion-element-c39617d8.browser.esm-BNNnmykm.js";
2
+ import { r as A } from "./index-DIdd2cUz.js";
3
+ import { P as b, b as R, L as i } from "./web2Chunk-CNoojUDK.js";
4
+ var l, y = A;
5
+ l = y.createRoot;
6
+ function E(o, e = "light", t, a = !0, c = !1, r) {
7
+ return o || (o = ""), b.parse({
8
+ defaultEnvironment: R.parse("production"),
9
9
  userAccountAddress: r || "",
10
10
  account: {
11
11
  address: o
@@ -19,38 +19,39 @@ function y(o, e = "light", t, a = !0, c = !1, r) {
19
19
  language: t
20
20
  });
21
21
  }
22
- const E = (o, e, t) => {
22
+ const x = (o, e, t) => {
23
23
  const a = (o == null ? void 0 : o.language) || e.getAttribute("data-language");
24
- a && (t.language = x(a));
25
- }, x = (o) => {
24
+ a && (t.language = L(a));
25
+ }, L = (o) => {
26
26
  try {
27
27
  return i.parse(o);
28
28
  } catch {
29
29
  return console.error("Invalid language attribute: ".concat(o)), i.parse("en");
30
30
  }
31
- }, L = (o, e, t) => {
31
+ }, P = (o, e, t) => {
32
32
  const a = (o == null ? void 0 : o["challenge-valid-length"]) || e.getAttribute("data-challenge-valid-length");
33
33
  a && (t.captchas.image.solutionTimeout = Number.parseInt(a), t.captchas.pow.solutionTimeout = Number.parseInt(a));
34
34
  };
35
- class V {
35
+ class j {
36
36
  constructor(e) {
37
37
  this.captchaComponentProvider = e;
38
38
  }
39
- renderCaptcha(e, t, a, c, r, h, u = !1) {
40
- const m = (a == null ? void 0 : a.captchaType) || e.defaultCaptchaType, n = y(a.siteKey, a.theme, a.language, r, u, a.userAccountAddress);
39
+ renderCaptcha(e, t, a, c, r, h, u, m) {
40
+ const g = (a == null ? void 0 : a.captchaType) || e.defaultCaptchaType, n = E(a.siteKey, a.theme, a.language, r, u, a.userAccountAddress);
41
41
  this.readAndValidateSettings(t, n, a);
42
- const s = this.createReactRoot(t, e.identifierPrefix), g = this.makeEmotionCache(e.emotionCacheKey, t), p = this.captchaComponentProvider.getCaptchaComponent(m, {
42
+ const s = this.createReactRoot(t, e.identifierPrefix), p = this.makeEmotionCache(e.emotionCacheKey, t), d = this.captchaComponentProvider.getCaptchaComponent(g, {
43
43
  config: n,
44
44
  i18n: h,
45
- callbacks: c
45
+ callbacks: c,
46
+ container: m
46
47
  });
47
- return this.renderCaptchaComponent(s, g, p), s;
48
+ return this.renderCaptchaComponent(s, p, d), s;
48
49
  }
49
50
  readAndValidateSettings(e, t, a) {
50
- L(a, e, t), E(a, e, t);
51
+ P(a, e, t), x(a, e, t);
51
52
  }
52
53
  makeEmotionCache(e, t) {
53
- return d({
54
+ return C({
54
55
  key: e,
55
56
  prepend: !0,
56
57
  container: t
@@ -62,9 +63,9 @@ class V {
62
63
  });
63
64
  }
64
65
  renderCaptchaComponent(e, t, a) {
65
- e.render(C.jsx(v, { value: t, children: a }));
66
+ e.render(v.jsx(f, { value: t, children: a }));
66
67
  }
67
68
  }
68
69
  export {
69
- V as CaptchaRenderer
70
+ j as CaptchaRenderer
70
71
  };
@@ -1,31 +1,30 @@
1
- import { z as L } from "./zodChunk-wTu9ZHzV.js";
2
- import { b as y } from "./utilCryptoChunk-BKe3CKqn.js";
3
- const f = "info", m = "debug", d = "trace", v = "warn", b = "error", k = "fatal";
1
+ import { z as L } from "./zodChunk-aEfPZzrp.js";
2
+ const h = "info", d = "debug", m = "trace", b = "warn", k = "error", w = "fatal";
4
3
  L.enum([
5
- f,
6
- m,
4
+ h,
7
5
  d,
8
- v,
6
+ m,
9
7
  b,
10
- k
8
+ k,
9
+ w
11
10
  ]);
12
- const x = {
13
- [d]: 5,
14
- [m]: 4,
15
- [f]: 3,
16
- [v]: 2,
17
- [b]: 1,
18
- [k]: 0
11
+ const P = {
12
+ [m]: 5,
13
+ [d]: 4,
14
+ [h]: 3,
15
+ [b]: 2,
16
+ [k]: 1,
17
+ [w]: 0
19
18
  };
20
- function P(a, t) {
19
+ function S(s, t) {
21
20
  const e = new E(t);
22
- return e.setLogLevel(a), e;
21
+ return e.setLogLevel(s), e;
23
22
  }
24
- const S = typeof window < "u" && typeof window.document < "u", g = "json", D = "plain";
25
- L.enum([g, D]);
23
+ const D = typeof window < "u" && typeof window.document < "u", g = "json", M = "plain";
24
+ L.enum([g, M]);
26
25
  class E {
27
- constructor(t, e = x) {
28
- this.scope = t, this.levelMap = e, this.pretty = 0, this.printStack = !1, this.format = g, this.level = f, this.levelNum = this.levelMap[this.level];
26
+ constructor(t, e = P) {
27
+ this.scope = t, this.levelMap = e, this.pretty = 0, this.printStack = !1, this.format = g, this.level = h, this.levelNum = this.levelMap[this.level];
29
28
  }
30
29
  setFormat(t) {
31
30
  if (this.format = t, this.format !== g)
@@ -62,49 +61,49 @@ class E {
62
61
  unpackError(t) {
63
62
  const e = t, r = { ...t };
64
63
  r.name = e.name || "Error", this.printStack && (e.stack && (r.stack = e.stack), e.stacktrace && (r.stacktrace = e.stacktrace)), e.cause && (r.cause = e.cause), e.code && (r.code = e.code), e.details && (r.details = e.details), e.context && (r.context = e.context), e.data && (r.data = e.data), e.info && (r.info = e.info), e.metadata && (r.metadata = e.metadata), e.status && (r.status = e.status), e.statusCode && (r.statusCode = e.statusCode), e.cause && (e.cause instanceof Error ? r.cause = this.unpackError(e.cause) : r.cause = e.cause);
65
- const s = e.message || e.msg || "";
64
+ const a = e.message || e.msg || "";
66
65
  return e.message && e.msg && (r.msg = e.msg), {
67
- msg: s,
66
+ msg: a,
68
67
  data: r
69
68
  };
70
69
  }
71
70
  print(t, e, r) {
72
71
  if (this.levelMap[r] > this.levelNum)
73
72
  return;
74
- const s = (/* @__PURE__ */ new Date()).toISOString();
75
- let { data: c, msg: i, err: o } = e(), l, h;
76
- if (o)
77
- if (o instanceof Error || typeof o == "object") {
78
- const u = this.unpackError(o);
79
- l = u.msg, h = u.data;
73
+ const a = (/* @__PURE__ */ new Date()).toISOString();
74
+ let { data: c, msg: i, err: l } = e(), o, u;
75
+ if (l)
76
+ if (l instanceof Error || typeof l == "object") {
77
+ const f = this.unpackError(l);
78
+ o = f.msg, u = f.data;
80
79
  } else
81
- l = String(o);
80
+ o = String(l);
82
81
  this.defaultData && (c = { ...this.defaultData, ...c });
83
- const n = { scope: this.scope, ts: s, level: this.level };
84
- if (c && (n.data = c), i && (n.msg = i), l && (n.err = l), h && (n.errData = h), S)
85
- i || l ? t(i || l, n) : t(n);
82
+ const n = { scope: this.scope, ts: a, level: this.level };
83
+ if (c && (n.data = c), i && (n.msg = i), o && (n.err = o), u && (n.errData = u), D)
84
+ i || o ? t(i || o, n) : t(n);
86
85
  else {
87
- const u = JSON.stringify(n, null, this.pretty);
88
- t(u);
86
+ const f = v(n), x = JSON.stringify(f, null, this.pretty);
87
+ t(x);
89
88
  }
90
89
  }
91
90
  info(t) {
92
- this.print(console.info.bind(console), t, f);
91
+ this.print(console.info.bind(console), t, h);
93
92
  }
94
93
  debug(t) {
95
- this.print(console.debug.bind(console), t, m);
94
+ this.print(console.debug.bind(console), t, d);
96
95
  }
97
96
  trace(t) {
98
- this.print(console.trace.bind(console), t, d);
97
+ this.print(console.trace.bind(console), t, m);
99
98
  }
100
99
  warn(t) {
101
- this.print(console.warn.bind(console), t, v);
100
+ this.print(console.warn.bind(console), t, b);
102
101
  }
103
102
  error(t) {
104
- this.print(console.error.bind(console), t, b);
103
+ this.print(console.error.bind(console), t, k);
105
104
  }
106
105
  fatal(t) {
107
- this.print(console.error.bind(console), t, k);
106
+ this.print(console.error.bind(console), t, w);
108
107
  }
109
108
  log(t, e) {
110
109
  switch (t) {
@@ -131,17 +130,24 @@ class E {
131
130
  }
132
131
  }
133
132
  }
134
- const N = { t: (a) => a };
135
- class w extends Error {
133
+ const v = (s) => {
134
+ if (typeof s == "bigint")
135
+ return s.toString();
136
+ if (N(s))
137
+ for (const t of Object.keys(s))
138
+ s[t] = v(s[t]);
139
+ return s;
140
+ }, N = (s) => Object === (s == null ? void 0 : s.constructor), O = { t: (s) => s };
141
+ class y extends Error {
136
142
  constructor(t, e) {
137
- const r = (e == null ? void 0 : e.logger) || P("info", import.meta.url), s = (e == null ? void 0 : e.logLevel) || "error", c = (e == null ? void 0 : e.i18n) || N;
143
+ const r = (e == null ? void 0 : e.logger) || S("info", import.meta.url), a = (e == null ? void 0 : e.logLevel) || "error", c = (e == null ? void 0 : e.i18n) || O;
138
144
  t instanceof Error ? (super(c.t(t.message)), this.translationKey = e == null ? void 0 : e.translationKey, this.context = {
139
145
  ...e == null ? void 0 : e.context,
140
146
  ...e != null && e.translationKey ? { translationMessage: c.t(e.translationKey) } : {}
141
- }) : (super(c.t(t)), this.translationKey = t, this.context = e == null ? void 0 : e.context), e != null && e.silent || this.logError(r, s, e == null ? void 0 : e.name);
147
+ }) : (super(c.t(t)), this.translationKey = t, this.context = e == null ? void 0 : e.context), e != null && e.silent || this.logError(r, a, e == null ? void 0 : e.name);
142
148
  }
143
149
  logError(t, e, r) {
144
- const s = { error: this.message, context: this.context }, c = { errorType: r || this.name, errorParams: s };
150
+ const a = { error: this.message, context: this.context }, c = { errorType: r || this.name, errorParams: a };
145
151
  if (e === "debug") {
146
152
  t.debug(() => ({ data: { ...c, stack: this.stack } }));
147
153
  return;
@@ -149,38 +155,26 @@ class w extends Error {
149
155
  t.error(() => ({ data: { ...c } }));
150
156
  }
151
157
  }
152
- class J extends w {
158
+ class F extends y {
153
159
  constructor(t, e) {
154
- const r = (e == null ? void 0 : e.name) || "ProsopoError", s = { ...e, name: r };
155
- super(t, s);
160
+ const r = (e == null ? void 0 : e.name) || "ProsopoError", a = { ...e, name: r };
161
+ super(t, a);
156
162
  }
157
163
  }
158
- class K extends w {
164
+ class K extends y {
159
165
  constructor(t, e) {
160
- const r = (e == null ? void 0 : e.name) || "ProsopoEnvError", s = { ...e, name: r };
161
- super(t, s);
166
+ const r = (e == null ? void 0 : e.name) || "ProsopoEnvError", a = { ...e, name: r };
167
+ super(t, a);
162
168
  }
163
169
  }
164
- class R extends w {
170
+ class A extends y {
165
171
  constructor(t, e) {
166
- const r = (e == null ? void 0 : e.name) || "ProsopoDatasetError", s = { ...e, name: r };
167
- super(t, s);
172
+ const r = (e == null ? void 0 : e.name) || "ProsopoDatasetError", a = { ...e, name: r };
173
+ super(t, a);
168
174
  }
169
175
  }
170
- const M = "";
171
- function A(a, t) {
172
- return a.join(M);
173
- }
174
- function O(a, t) {
175
- return y(a, t);
176
- }
177
- function C(a) {
178
- return O(A(a));
179
- }
180
176
  export {
181
- J as P,
177
+ F as P,
182
178
  K as a,
183
- R as b,
184
- C as c,
185
- O as h
179
+ A as b
186
180
  };