@myrasec/eu-captcha 0.0.10 → 0.0.11

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.

Potentially problematic release.


This version of @myrasec/eu-captcha might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,82 +1,101 @@
1
- This package provides an easy integration of Myra Security's EU Captcha.
1
+ This package provides an easy integration of EU Captcha from Myra Security.
2
2
 
3
- You can use it with or without react.
3
+ The package can be use with and without react.
4
4
 
5
- ## with react
5
+ ## With react
6
6
 
7
- How to use with react:
7
+ Proceed as follows:
8
8
 
9
- (0) npm i @myrasec/eu-captcha
9
+ (1) Install the package.
10
+ ```
11
+ npm i @myrasec/eu-captcha
12
+ ```
10
13
 
11
- (1) In your code add:
14
+ (2) Add the code below in your code:
12
15
 
13
- ```
14
- import { EuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
16
+ ```
17
+ import { EuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
15
18
 
16
- // use the public sitekey you find in the customer's backend here.
17
- const captchaSitekey = "YOUR-SITEKEY-HERE";
18
- ```
19
+ // Here use the public site key which can be found in the backend of the customer.
20
+ const captchaSitekey = "YOUR-SITEKEY-HERE";
21
+ ```
19
22
 
20
- (2) And then render the widget using the following syntax:
23
+ (3) Render the widget with the syntax below.
21
24
 
22
- ```
23
- <EuCaptcha sitekey={captchaSitekey} />
24
- ```
25
+ ```
26
+ <EuCaptcha sitekey={captchaSitekey} />
27
+ ```
25
28
 
26
- You can test the integration using any fake sitekey. If a sitekey
27
- does not exist, then the captcha runs with default parameters which
28
- allow traffic to pass.
29
+ You can test the integration using any fake site key.
30
+ If a site key does not exist, the captcha runs with default parameters and all traffic will be passed.
29
31
 
30
- ## without react
32
+ You can also set additional properties: theme, width
31
33
 
32
- Without react, you can use the library like this:
34
+ To switch between light/dark theme:
33
35
 
34
- (0) npm i @myrasec/eu-captcha
36
+ ```
37
+ <EuCaptcha sitekey={captchaSitekey} theme="dark" />
38
+ ```
35
39
 
36
- (1) Load the JS components asynchronously:
40
+ To define the width of the widget (default is 330). Please specify a number.
37
41
 
38
- ```
39
- import { loadEuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
42
+ ```
43
+ <EuCaptcha sitekey={captchaSitekey} width=280 />
44
+ ```
40
45
 
41
- loadEuCaptcha();
42
- ```
46
+ ## Without react
43
47
 
44
- (2) Create the &lt;div&gt; inside your &lt;form&gt;..&lt;/form&gt; manually.
48
+ To use the package without react, you can use the libary as described below.
45
49
 
46
- ```
47
- <div class="eu-captcha" data-sitekey="YOUR-SITEKEY-HERE"></div>
48
- ```
50
+ Proceed as follows:
51
+
52
+ (1) Install the package.
53
+ ```
54
+ npm i @myrasec/eu-captcha
55
+ ```
56
+
57
+ (1) Load the JS components asynchronously as descibe below.
58
+
59
+ ```
60
+ import { loadEuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
61
+
62
+ loadEuCaptcha();
63
+ ```
64
+
65
+ (2) Add the &lt;div&gt; tag to a form of your website manually where the EU CAPTCHA should appear.
66
+
67
+ ```
68
+ <div class="eu-captcha" data-sitekey="YOUR-SITEKEY-HERE"></div>
69
+ ```
49
70
 
50
71
  ## Querying state
51
72
 
52
- Before submitting a form to a server, please ensure that EuCaptcha is done.
73
+ Make sure that EU Captcha is done before submitting a form to a server.
53
74
 
54
- ```
55
- import { isEuCaptchaDone } from "@myrasec/eu-captcha";
75
+ ```
76
+ import { isEuCaptchaDone } from "@myrasec/eu-captcha";
56
77
 
57
- function onSubmit(e) {
58
- e.preventDefault();
78
+ function onSubmit(e) {
79
+ e.preventDefault();
59
80
 
60
- if (!isEuCaptchaDone()) {
61
- // computation has not been completed
81
+ if (!isEuCaptchaDone()) {
82
+ // computation has not been completed
62
83
 
63
- return;
84
+ return;
85
+ }
64
86
  }
65
- }
66
- ```
87
+ ```
67
88
 
68
89
  ## Listening to state change
69
90
 
70
- Additionally, a message will be posted to the main window with msg.data.type
71
- set to 'euCaptchaDone', in case you want to be informed actively to change
72
- e.g. the state of a button.
91
+ Additionally, in case you want to be informed actively to changes, such as the status of a button, a message can be displayed in the main window with msg.data.type set to 'euCaptchaDone'.
73
92
 
74
- ```
75
- function listenForCaptchaDone(msg: MessageEvent) {
76
- if (msg.data.type === 'euCaptchaDone') {
77
- // change the state of the form, etc.
93
+ ```
94
+ function listenForCaptchaDone(msg: MessageEvent) {
95
+ if (msg.data.type === 'euCaptchaDone') {
96
+ // Changes the status of the form, etc.
97
+ }
78
98
  }
79
- }
80
99
 
81
- window.addEventListener("message", listenForCaptchaDone, false);
82
- ```
100
+ window.addEventListener("message", listenForCaptchaDone, false);
101
+ ```
@@ -1,11 +1,11 @@
1
1
  import ae, { useState as oe, useEffect as le } from "react";
2
- var b = { exports: {} }, E = {};
2
+ var v = { exports: {} }, E = {};
3
3
  var M;
4
4
  function se() {
5
5
  if (M) return E;
6
6
  M = 1;
7
- var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), l = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function c(s, u, i) {
7
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function c(l, u, i) {
9
9
  var d = null;
10
10
  if (i !== void 0 && (d = "" + i), u.key !== void 0 && (d = "" + u.key), "key" in u) {
11
11
  i = {};
@@ -14,13 +14,13 @@ function se() {
14
14
  } else i = u;
15
15
  return u = i.ref, {
16
16
  $$typeof: t,
17
- type: s,
17
+ type: l,
18
18
  key: d,
19
19
  ref: u !== void 0 ? u : null,
20
20
  props: i
21
21
  };
22
22
  }
23
- return E.Fragment = l, E.jsx = c, E.jsxs = c, E;
23
+ return E.Fragment = s, E.jsx = c, E.jsxs = c, E;
24
24
  }
25
25
  var _ = {};
26
26
  var W;
@@ -32,7 +32,7 @@ function ue() {
32
32
  return e.$$typeof === re ? null : e.displayName || e.name || null;
33
33
  if (typeof e == "string") return e;
34
34
  switch (e) {
35
- case y:
35
+ case k:
36
36
  return "Fragment";
37
37
  case G:
38
38
  return "Profiler";
@@ -60,7 +60,7 @@ function ue() {
60
60
  return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
61
  case K:
62
62
  return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
63
- case h:
63
+ case y:
64
64
  r = e._payload, e = e._init;
65
65
  try {
66
66
  return t(e(r));
@@ -69,12 +69,12 @@ function ue() {
69
69
  }
70
70
  return null;
71
71
  }
72
- function l(e) {
72
+ function s(e) {
73
73
  return "" + e;
74
74
  }
75
75
  function c(e) {
76
76
  try {
77
- l(e);
77
+ s(e);
78
78
  var r = !1;
79
79
  } catch {
80
80
  r = !0;
@@ -86,12 +86,12 @@ function ue() {
86
86
  r,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
88
  a
89
- ), l(e);
89
+ ), s(e);
90
90
  }
91
91
  }
92
- function s(e) {
93
- if (e === y) return "<>";
94
- if (typeof e == "object" && e !== null && e.$$typeof === h)
92
+ function l(e) {
93
+ if (e === k) return "<>";
94
+ if (typeof e == "object" && e !== null && e.$$typeof === y)
95
95
  return "<...>";
96
96
  try {
97
97
  var r = t(e);
@@ -132,7 +132,7 @@ function ue() {
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
133
  )), e = this.props.ref, e !== void 0 ? e : null;
134
134
  }
135
- function J(e, r, n, a, R, w) {
135
+ function J(e, r, n, a, p, S) {
136
136
  var o = n.ref;
137
137
  return e = {
138
138
  $$typeof: N,
@@ -157,15 +157,15 @@ function ue() {
157
157
  configurable: !1,
158
158
  enumerable: !1,
159
159
  writable: !0,
160
- value: R
160
+ value: p
161
161
  }), Object.defineProperty(e, "_debugTask", {
162
162
  configurable: !1,
163
163
  enumerable: !1,
164
164
  writable: !0,
165
- value: w
165
+ value: S
166
166
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
167
  }
168
- function j(e, r, n, a, R, w) {
168
+ function j(e, r, n, a, p, S) {
169
169
  var o = r.children;
170
170
  if (o !== void 0)
171
171
  if (a)
@@ -209,29 +209,29 @@ React keys must be passed directly to JSX without using spread:
209
209
  o,
210
210
  n,
211
211
  u(),
212
- R,
213
- w
212
+ p,
213
+ S
214
214
  );
215
215
  }
216
216
  function x(e) {
217
- C(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === h && (e._payload.status === "fulfilled" ? C(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
217
+ C(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === y && (e._payload.status === "fulfilled" ? C(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
218
  }
219
219
  function C(e) {
220
220
  return typeof e == "object" && e !== null && e.$$typeof === N;
221
221
  }
222
- var p = ae, N = /* @__PURE__ */ Symbol.for("react.transitional.element"), V = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), z = /* @__PURE__ */ Symbol.for("react.strict_mode"), G = /* @__PURE__ */ Symbol.for("react.profiler"), X = /* @__PURE__ */ Symbol.for("react.consumer"), H = /* @__PURE__ */ Symbol.for("react.context"), B = /* @__PURE__ */ Symbol.for("react.forward_ref"), Z = /* @__PURE__ */ Symbol.for("react.suspense"), Q = /* @__PURE__ */ Symbol.for("react.suspense_list"), K = /* @__PURE__ */ Symbol.for("react.memo"), h = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), re = /* @__PURE__ */ Symbol.for("react.client.reference"), g = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, te = Array.isArray, S = console.createTask ? console.createTask : function() {
222
+ var b = ae, N = /* @__PURE__ */ Symbol.for("react.transitional.element"), V = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__PURE__ */ Symbol.for("react.fragment"), z = /* @__PURE__ */ Symbol.for("react.strict_mode"), G = /* @__PURE__ */ Symbol.for("react.profiler"), X = /* @__PURE__ */ Symbol.for("react.consumer"), H = /* @__PURE__ */ Symbol.for("react.context"), B = /* @__PURE__ */ Symbol.for("react.forward_ref"), Z = /* @__PURE__ */ Symbol.for("react.suspense"), Q = /* @__PURE__ */ Symbol.for("react.suspense_list"), K = /* @__PURE__ */ Symbol.for("react.memo"), y = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), re = /* @__PURE__ */ Symbol.for("react.client.reference"), g = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, te = Array.isArray, w = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
- p = {
225
+ b = {
226
226
  react_stack_bottom_frame: function(e) {
227
227
  return e();
228
228
  }
229
229
  };
230
- var $, F = {}, I = p.react_stack_bottom_frame.bind(
231
- p,
230
+ var $, F = {}, I = b.react_stack_bottom_frame.bind(
231
+ b,
232
232
  i
233
- )(), L = S(s(i)), D = {};
234
- _.Fragment = y, _.jsx = function(e, r, n) {
233
+ )(), L = w(l(i)), D = {};
234
+ _.Fragment = k, _.jsx = function(e, r, n) {
235
235
  var a = 1e4 > g.recentlyCreatedOwnerStacks++;
236
236
  return j(
237
237
  e,
@@ -239,7 +239,7 @@ React keys must be passed directly to JSX without using spread:
239
239
  n,
240
240
  !1,
241
241
  a ? Error("react-stack-top-frame") : I,
242
- a ? S(s(e)) : L
242
+ a ? w(l(e)) : L
243
243
  );
244
244
  }, _.jsxs = function(e, r, n) {
245
245
  var a = 1e4 > g.recentlyCreatedOwnerStacks++;
@@ -249,51 +249,55 @@ React keys must be passed directly to JSX without using spread:
249
249
  n,
250
250
  !0,
251
251
  a ? Error("react-stack-top-frame") : I,
252
- a ? S(s(e)) : L
252
+ a ? w(l(e)) : L
253
253
  );
254
254
  };
255
255
  })()), _;
256
256
  }
257
257
  var U;
258
258
  function ie() {
259
- return U || (U = 1, process.env.NODE_ENV === "production" ? b.exports = se() : b.exports = ue()), b.exports;
259
+ return U || (U = 1, process.env.NODE_ENV === "production" ? v.exports = se() : v.exports = ue()), v.exports;
260
260
  }
261
261
  var P = ie();
262
- let k = {
262
+ let R = {
263
263
  done: !1,
264
264
  registered: !1
265
- }, v = !1, A = null, T = null;
265
+ }, T = !1, A = null, h = null;
266
266
  function ce(t) {
267
- return typeof window > "u" ? Promise.reject("Cannot load script on server") : T || (T = new Promise((l, c) => {
267
+ return typeof window > "u" ? Promise.reject("Cannot load script on server") : h || (h = new Promise((s, c) => {
268
268
  if (document.querySelector(`script[src="${t}"]`)) {
269
- l();
269
+ s();
270
270
  return;
271
271
  }
272
- const s = document.createElement("script");
273
- s.src = t, s.async = !0, s.onload = () => l(), s.onerror = () => c(new Error(`Failed to load ${t}`)), document.head.appendChild(s);
274
- }), T);
272
+ const l = document.createElement("script");
273
+ l.src = t, l.async = !0, l.onload = () => s(), l.onerror = () => c(new Error(`Failed to load ${t}`)), document.head.appendChild(l);
274
+ }), h);
275
275
  }
276
276
  function fe(t) {
277
- t.data.type === "euCaptchaCompleted" && (k.done = !0);
277
+ t.data.type === "euCaptchaCompleted" && (R.done = !0);
278
+ }
279
+ function Ee() {
280
+ return R.done;
278
281
  }
279
282
  function de(t) {
280
283
  t = t || {}, typeof t.sitekey == "string" && t.sitekey, typeof t.locale == "string" && t.locale, ce("https://cdn.eu-captcha.eu/verify.js").then(() => {
281
- A && A(!0), k.registered || (k.registered = !0, window.addEventListener("message", fe, !1));
282
- }).catch((l) => {
283
- console.error("error during load of eu captcha library: " + l);
284
+ A && A(!0), R.registered || (R.registered = !0, window.addEventListener("message", fe, !1));
285
+ }).catch((s) => {
286
+ console.error("error during load of eu captcha library: " + s);
284
287
  });
285
288
  }
286
- function Ee(t) {
287
- if ([v, A] = oe(v), t && t.sitekey && de({
289
+ function _e(t) {
290
+ if ([T, A] = oe(T), t && t.sitekey && de({
288
291
  sitekey: t.sitekey
289
292
  }), le(() => {
290
- }, [v]), !v)
293
+ }, [T]), !T)
291
294
  return /* @__PURE__ */ P.jsx(P.Fragment, { children: " " });
292
- k.done = !1;
293
- const l = t.theme ?? "light", c = window.getEuCaptchaElement(t.sitekey, l);
294
- return /* @__PURE__ */ P.jsx("div", { dangerouslySetInnerHTML: { __html: c } });
295
+ R.done = !1;
296
+ const s = t.theme ?? "light", c = t.width ?? "330", l = window.getEuCaptchaElement(t.sitekey, s, c);
297
+ return /* @__PURE__ */ P.jsx("div", { dangerouslySetInnerHTML: { __html: l } });
295
298
  }
296
299
  export {
297
- Ee as EuCaptcha,
300
+ _e as EuCaptcha,
301
+ Ee as isEuCaptchaDone,
298
302
  de as loadEuCaptcha
299
303
  };
@@ -1,6 +1,6 @@
1
- (function(f,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(f=typeof globalThis<"u"?globalThis:f||self,d(f["@myra/eu-captcha"]={},f.React))})(this,(function(f,d){"use strict";var R={exports:{}},E={};var C;function z(){if(C)return E;C=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function c(l,u,i){var p=null;if(i!==void 0&&(p=""+i),u.key!==void 0&&(p=""+u.key),"key"in u){i={};for(var b in u)b!=="key"&&(i[b]=u[b])}else i=u;return u=i.ref,{$$typeof:t,type:l,key:p,ref:u!==void 0?u:null,props:i}}return E.Fragment=s,E.jsx=c,E.jsxs=c,E}var _={};var N;function G(){return N||(N=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case te:return"Profiler";case re:return"StrictMode";case se:return"Suspense";case le:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ee:return"Portal";case ae:return e.displayName||"Context";case ne:return(e._context.displayName||"Context")+".Consumer";case oe:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ue:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function s(e){return""+e}function c(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),s(e)}}function l(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function u(){var e=P.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function p(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function n(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function Q(){var e=t(this.type);return U[e]||(U[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function K(e,r,n,a,k,A){var o=n.ref;return e={$$typeof:D,type:e,key:r,props:n,_owner:a},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:Q}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function I(e,r,n,a,k,A){var o=r.children;if(o!==void 0)if(a)if(fe(o)){for(a=0;a<o.length;a++)L(o[a]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else L(o);if($.call(r,"key")){o=t(e);var m=Object.keys(r).filter(function(de){return de!=="key"});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",q[o+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(c,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(c=typeof globalThis<"u"?globalThis:c||self,d(c["@myra/eu-captcha"]={},c.React))})(this,(function(c,d){"use strict";var v={exports:{}},E={};var C;function z(){if(C)return E;C=1;var t=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function f(s,l,i){var b=null;if(i!==void 0&&(b=""+i),l.key!==void 0&&(b=""+l.key),"key"in l){i={};for(var R in l)R!=="key"&&(i[R]=l[R])}else i=l;return l=i.ref,{$$typeof:t,type:s,key:b,ref:l!==void 0?l:null,props:i}}return E.Fragment=u,E.jsx=f,E.jsxs=f,E}var _={};var N;function G(){return N||(N=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case ne:return"Profiler";case te:return"StrictMode";case ue:return"Suspense";case le:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case re:return"Portal";case oe:return e.displayName||"Context";case ae:return(e._context.displayName||"Context")+".Consumer";case se:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function u(e){return""+e}function f(e){try{u(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),u(e)}}function s(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=P.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function b(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function R(e,r){function n(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function K(){var e=t(this.type);return U[e]||(U[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function ee(e,r,n,a,k,A){var o=n.ref;return e={$$typeof:M,type:e,key:r,props:n,_owner:a},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:K}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function I(e,r,n,a,k,A){var o=r.children;if(o!==void 0)if(a)if(de(o)){for(a=0;a<o.length;a++)D(o[a]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else D(o);if($.call(r,"key")){o=t(e);var m=Object.keys(r).filter(function(me){return me!=="key"});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",q[o+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,a,o,m,o),q[o+a]=!0)}if(o=null,n!==void 0&&(c(n),o=""+n),p(r)&&(c(r.key),o=""+r.key),"key"in r){n={};for(var x in r)x!=="key"&&(n[x]=r[x])}else n=r;return o&&b(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),K(e,o,n,u(),k,A)}function L(e){M(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?M(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function M(e){return typeof e=="object"&&e!==null&&e.$$typeof===D}var h=d,D=Symbol.for("react.transitional.element"),ee=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),re=Symbol.for("react.strict_mode"),te=Symbol.for("react.profiler"),ne=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),oe=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ue=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),P=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,fe=Array.isArray,j=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(e){return e()}};var W,U={},J=h.react_stack_bottom_frame.bind(h,i)(),V=j(l(i)),q={};_.Fragment=w,_.jsx=function(e,r,n){var a=1e4>P.recentlyCreatedOwnerStacks++;return I(e,r,n,!1,a?Error("react-stack-top-frame"):J,a?j(l(e)):V)},_.jsxs=function(e,r,n){var a=1e4>P.recentlyCreatedOwnerStacks++;return I(e,r,n,!0,a?Error("react-stack-top-frame"):J,a?j(l(e)):V)}})()),_}var Y;function X(){return Y||(Y=1,process.env.NODE_ENV==="production"?R.exports=z():R.exports=G()),R.exports}var S=X();let v={done:!1,registered:!1},T=!1,g=null,y=null;function H(t){return typeof window>"u"?Promise.reject("Cannot load script on server"):y||(y=new Promise((s,c)=>{if(document.querySelector(`script[src="${t}"]`)){s();return}const l=document.createElement("script");l.src=t,l.async=!0,l.onload=()=>s(),l.onerror=()=>c(new Error(`Failed to load ${t}`)),document.head.appendChild(l)}),y)}function B(t){t.data.type==="euCaptchaCompleted"&&(v.done=!0)}function F(t){t=t||{},typeof t.sitekey=="string"&&t.sitekey,typeof t.locale=="string"&&t.locale,H("https://cdn.eu-captcha.eu/verify.js").then(()=>{g&&g(!0),v.registered||(v.registered=!0,window.addEventListener("message",B,!1))}).catch(s=>{console.error("error during load of eu captcha library: "+s)})}function Z(t){if([T,g]=d.useState(T),t&&t.sitekey&&F({sitekey:t.sitekey}),d.useEffect(()=>{},[T]),!T)return S.jsx(S.Fragment,{children:" "});v.done=!1;const s=t.theme??"light",c=window.getEuCaptchaElement(t.sitekey,s);return S.jsx("div",{dangerouslySetInnerHTML:{__html:c}})}f.EuCaptcha=Z,f.loadEuCaptcha=F,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,a,o,m,o),q[o+a]=!0)}if(o=null,n!==void 0&&(f(n),o=""+n),b(r)&&(f(r.key),o=""+r.key),"key"in r){n={};for(var x in r)x!=="key"&&(n[x]=r[x])}else n=r;return o&&R(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),ee(e,o,n,l(),k,A)}function D(e){L(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?L(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function L(e){return typeof e=="object"&&e!==null&&e.$$typeof===M}var y=d,M=Symbol.for("react.transitional.element"),re=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),oe=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),fe=Symbol.for("react.client.reference"),P=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,de=Array.isArray,j=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var W,U={},J=y.react_stack_bottom_frame.bind(y,i)(),V=j(s(i)),q={};_.Fragment=w,_.jsx=function(e,r,n){var a=1e4>P.recentlyCreatedOwnerStacks++;return I(e,r,n,!1,a?Error("react-stack-top-frame"):J,a?j(s(e)):V)},_.jsxs=function(e,r,n){var a=1e4>P.recentlyCreatedOwnerStacks++;return I(e,r,n,!0,a?Error("react-stack-top-frame"):J,a?j(s(e)):V)}})()),_}var Y;function X(){return Y||(Y=1,process.env.NODE_ENV==="production"?v.exports=z():v.exports=G()),v.exports}var S=X();let p={done:!1,registered:!1},T=!1,g=null,h=null;function H(t){return typeof window>"u"?Promise.reject("Cannot load script on server"):h||(h=new Promise((u,f)=>{if(document.querySelector(`script[src="${t}"]`)){u();return}const s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>u(),s.onerror=()=>f(new Error(`Failed to load ${t}`)),document.head.appendChild(s)}),h)}function B(t){t.data.type==="euCaptchaCompleted"&&(p.done=!0)}function Z(){return p.done}function F(t){t=t||{},typeof t.sitekey=="string"&&t.sitekey,typeof t.locale=="string"&&t.locale,H("https://cdn.eu-captcha.eu/verify.js").then(()=>{g&&g(!0),p.registered||(p.registered=!0,window.addEventListener("message",B,!1))}).catch(u=>{console.error("error during load of eu captcha library: "+u)})}function Q(t){if([T,g]=d.useState(T),t&&t.sitekey&&F({sitekey:t.sitekey}),d.useEffect(()=>{},[T]),!T)return S.jsx(S.Fragment,{children:" "});p.done=!1;const u=t.theme??"light",f=t.width??"330",s=window.getEuCaptchaElement(t.sitekey,u,f);return S.jsx("div",{dangerouslySetInnerHTML:{__html:s}})}c.EuCaptcha=Q,c.isEuCaptchaDone=Z,c.loadEuCaptcha=F,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myrasec/eu-captcha",
3
3
  "private": false,
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "type": "module",
6
6
  "main": "./dist/eu-captcha.umd.cjs",
7
7
  "module": "./dist/eu-captcha.js",