@myrasec/eu-captcha 0.0.8 → 0.0.10

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
@@ -2,6 +2,8 @@ This package provides an easy integration of Myra Security's EU Captcha.
2
2
 
3
3
  You can use it with or without react.
4
4
 
5
+ ## with react
6
+
5
7
  How to use with react:
6
8
 
7
9
  (0) npm i @myrasec/eu-captcha
@@ -9,7 +11,7 @@ How to use with react:
9
11
  (1) In your code add:
10
12
 
11
13
  ```
12
- import { EuCaptcha } from "@myrasec/eu-captcha";
14
+ import { EuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
13
15
 
14
16
  // use the public sitekey you find in the customer's backend here.
15
17
  const captchaSitekey = "YOUR-SITEKEY-HERE";
@@ -25,6 +27,8 @@ You can test the integration using any fake sitekey. If a sitekey
25
27
  does not exist, then the captcha runs with default parameters which
26
28
  allow traffic to pass.
27
29
 
30
+ ## without react
31
+
28
32
  Without react, you can use the library like this:
29
33
 
30
34
  (0) npm i @myrasec/eu-captcha
@@ -32,7 +36,7 @@ Without react, you can use the library like this:
32
36
  (1) Load the JS components asynchronously:
33
37
 
34
38
  ```
35
- import { loadEuCaptcha } from "@myrasec/eu-captcha";
39
+ import { loadEuCaptcha, isEuCaptchaDone } from "@myrasec/eu-captcha";
36
40
 
37
41
  loadEuCaptcha();
38
42
  ```
@@ -42,3 +46,37 @@ loadEuCaptcha();
42
46
  ```
43
47
  <div class="eu-captcha" data-sitekey="YOUR-SITEKEY-HERE"></div>
44
48
  ```
49
+
50
+ ## Querying state
51
+
52
+ Before submitting a form to a server, please ensure that EuCaptcha is done.
53
+
54
+ ```
55
+ import { isEuCaptchaDone } from "@myrasec/eu-captcha";
56
+
57
+ function onSubmit(e) {
58
+ e.preventDefault();
59
+
60
+ if (!isEuCaptchaDone()) {
61
+ // computation has not been completed
62
+
63
+ return;
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Listening to state change
69
+
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.
73
+
74
+ ```
75
+ function listenForCaptchaDone(msg: MessageEvent) {
76
+ if (msg.data.type === 'euCaptchaDone') {
77
+ // change the state of the form, etc.
78
+ }
79
+ }
80
+
81
+ window.addEventListener("message", listenForCaptchaDone, false);
82
+ ```
@@ -1,66 +1,66 @@
1
- import re from "react";
1
+ import ae, { useState as oe, useEffect as le } from "react";
2
2
  var b = { exports: {} }, E = {};
3
- var I;
4
- function te() {
5
- if (I) return E;
6
- I = 1;
7
- var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), c = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function i(l, s, u) {
3
+ var M;
4
+ function se() {
5
+ if (M) return E;
6
+ M = 1;
7
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), l = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function c(s, u, i) {
9
9
  var d = null;
10
- if (u !== void 0 && (d = "" + u), s.key !== void 0 && (d = "" + s.key), "key" in s) {
11
- u = {};
12
- for (var m in s)
13
- m !== "key" && (u[m] = s[m]);
14
- } else u = s;
15
- return s = u.ref, {
10
+ if (i !== void 0 && (d = "" + i), u.key !== void 0 && (d = "" + u.key), "key" in u) {
11
+ i = {};
12
+ for (var m in u)
13
+ m !== "key" && (i[m] = u[m]);
14
+ } else i = u;
15
+ return u = i.ref, {
16
16
  $$typeof: t,
17
- type: l,
17
+ type: s,
18
18
  key: d,
19
- ref: s !== void 0 ? s : null,
20
- props: u
19
+ ref: u !== void 0 ? u : null,
20
+ props: i
21
21
  };
22
22
  }
23
- return E.Fragment = c, E.jsx = i, E.jsxs = i, E;
23
+ return E.Fragment = l, E.jsx = c, E.jsxs = c, E;
24
24
  }
25
25
  var _ = {};
26
- var D;
27
- function ne() {
28
- return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
26
+ var W;
27
+ function ue() {
28
+ return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
29
29
  function t(e) {
30
30
  if (e == null) return null;
31
31
  if (typeof e == "function")
32
- return e.$$typeof === Q ? null : e.displayName || e.name || null;
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 T:
35
+ case y:
36
36
  return "Fragment";
37
- case J:
37
+ case G:
38
38
  return "Profiler";
39
- case q:
39
+ case z:
40
40
  return "StrictMode";
41
- case X:
41
+ case Z:
42
42
  return "Suspense";
43
- case B:
43
+ case Q:
44
44
  return "SuspenseList";
45
- case Z:
45
+ case ee:
46
46
  return "Activity";
47
47
  }
48
48
  if (typeof e == "object")
49
49
  switch (typeof e.tag == "number" && console.error(
50
50
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
51
  ), e.$$typeof) {
52
- case U:
52
+ case V:
53
53
  return "Portal";
54
- case z:
54
+ case H:
55
55
  return e.displayName || "Context";
56
- case V:
56
+ case X:
57
57
  return (e._context.displayName || "Context") + ".Consumer";
58
- case G:
58
+ case B:
59
59
  var r = e.render;
60
60
  return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
- case H:
61
+ case K:
62
62
  return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
63
- case k:
63
+ case h:
64
64
  r = e._payload, e = e._init;
65
65
  try {
66
66
  return t(e(r));
@@ -69,12 +69,12 @@ function ne() {
69
69
  }
70
70
  return null;
71
71
  }
72
- function c(e) {
72
+ function l(e) {
73
73
  return "" + e;
74
74
  }
75
- function i(e) {
75
+ function c(e) {
76
76
  try {
77
- c(e);
77
+ l(e);
78
78
  var r = !1;
79
79
  } catch {
80
80
  r = !0;
@@ -86,12 +86,12 @@ function ne() {
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
- ), c(e);
89
+ ), l(e);
90
90
  }
91
91
  }
92
- function l(e) {
93
- if (e === T) return "<>";
94
- if (typeof e == "object" && e !== null && e.$$typeof === k)
92
+ function s(e) {
93
+ if (e === y) return "<>";
94
+ if (typeof e == "object" && e !== null && e.$$typeof === h)
95
95
  return "<...>";
96
96
  try {
97
97
  var r = t(e);
@@ -100,15 +100,15 @@ function ne() {
100
100
  return "<...>";
101
101
  }
102
102
  }
103
- function s() {
104
- var e = y.A;
103
+ function u() {
104
+ var e = g.A;
105
105
  return e === null ? null : e.getOwner();
106
106
  }
107
- function u() {
107
+ function i() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
110
  function d(e) {
111
- if (x.call(e, "key")) {
111
+ if (Y.call(e, "key")) {
112
112
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
113
  if (r && r.isReactWarning) return !1;
114
114
  }
@@ -116,7 +116,7 @@ function ne() {
116
116
  }
117
117
  function m(e, r) {
118
118
  function n() {
119
- N || (N = !0, console.error(
119
+ $ || ($ = !0, console.error(
120
120
  "%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)",
121
121
  r
122
122
  ));
@@ -126,23 +126,23 @@ function ne() {
126
126
  configurable: !0
127
127
  });
128
128
  }
129
- function M() {
129
+ function q() {
130
130
  var e = t(this.type);
131
- return C[e] || (C[e] = !0, console.error(
131
+ return F[e] || (F[e] = !0, console.error(
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 W(e, r, n, a, R, h) {
135
+ function J(e, r, n, a, R, w) {
136
136
  var o = n.ref;
137
137
  return e = {
138
- $$typeof: j,
138
+ $$typeof: N,
139
139
  type: e,
140
140
  key: r,
141
141
  props: n,
142
142
  _owner: a
143
143
  }, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
144
144
  enumerable: !1,
145
- get: M
145
+ get: q
146
146
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
147
  configurable: !1,
148
148
  enumerable: !1,
@@ -162,28 +162,28 @@ function ne() {
162
162
  configurable: !1,
163
163
  enumerable: !1,
164
164
  writable: !0,
165
- value: h
165
+ value: w
166
166
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
167
  }
168
- function w(e, r, n, a, R, h) {
168
+ function j(e, r, n, a, R, w) {
169
169
  var o = r.children;
170
170
  if (o !== void 0)
171
171
  if (a)
172
- if (K(o)) {
172
+ if (te(o)) {
173
173
  for (a = 0; a < o.length; a++)
174
- A(o[a]);
174
+ x(o[a]);
175
175
  Object.freeze && Object.freeze(o);
176
176
  } else
177
177
  console.error(
178
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
179
  );
180
- else A(o);
181
- if (x.call(r, "key")) {
180
+ else x(o);
181
+ if (Y.call(r, "key")) {
182
182
  o = t(e);
183
- var f = Object.keys(r).filter(function(ee) {
184
- return ee !== "key";
183
+ var f = Object.keys(r).filter(function(ne) {
184
+ return ne !== "key";
185
185
  });
186
- a = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", F[o + a] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ a = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", D[o + a] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
188
188
  let props = %s;
189
189
  <%s {...props} />
@@ -194,32 +194,32 @@ React keys must be passed directly to JSX without using spread:
194
194
  o,
195
195
  f,
196
196
  o
197
- ), F[o + a] = !0);
197
+ ), D[o + a] = !0);
198
198
  }
199
- if (o = null, n !== void 0 && (i(n), o = "" + n), d(r) && (i(r.key), o = "" + r.key), "key" in r) {
199
+ if (o = null, n !== void 0 && (c(n), o = "" + n), d(r) && (c(r.key), o = "" + r.key), "key" in r) {
200
200
  n = {};
201
- for (var P in r)
202
- P !== "key" && (n[P] = r[P]);
201
+ for (var O in r)
202
+ O !== "key" && (n[O] = r[O]);
203
203
  } else n = r;
204
204
  return o && m(
205
205
  n,
206
206
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
- ), W(
207
+ ), J(
208
208
  e,
209
209
  o,
210
210
  n,
211
- s(),
211
+ u(),
212
212
  R,
213
- h
213
+ w
214
214
  );
215
215
  }
216
- function A(e) {
217
- g(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? g(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
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));
218
218
  }
219
- function g(e) {
220
- return typeof e == "object" && e !== null && e.$$typeof === j;
219
+ function C(e) {
220
+ return typeof e == "object" && e !== null && e.$$typeof === N;
221
221
  }
222
- var p = re, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), U = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), q = /* @__PURE__ */ Symbol.for("react.strict_mode"), J = /* @__PURE__ */ Symbol.for("react.profiler"), V = /* @__PURE__ */ Symbol.for("react.consumer"), z = /* @__PURE__ */ Symbol.for("react.context"), G = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), y = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, K = Array.isArray, O = console.createTask ? console.createTask : function() {
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() {
223
223
  return null;
224
224
  };
225
225
  p = {
@@ -227,63 +227,73 @@ React keys must be passed directly to JSX without using spread:
227
227
  return e();
228
228
  }
229
229
  };
230
- var N, C = {}, Y = p.react_stack_bottom_frame.bind(
230
+ var $, F = {}, I = p.react_stack_bottom_frame.bind(
231
231
  p,
232
- u
233
- )(), $ = O(l(u)), F = {};
234
- _.Fragment = T, _.jsx = function(e, r, n) {
235
- var a = 1e4 > y.recentlyCreatedOwnerStacks++;
236
- return w(
232
+ i
233
+ )(), L = S(s(i)), D = {};
234
+ _.Fragment = y, _.jsx = function(e, r, n) {
235
+ var a = 1e4 > g.recentlyCreatedOwnerStacks++;
236
+ return j(
237
237
  e,
238
238
  r,
239
239
  n,
240
240
  !1,
241
- a ? Error("react-stack-top-frame") : Y,
242
- a ? O(l(e)) : $
241
+ a ? Error("react-stack-top-frame") : I,
242
+ a ? S(s(e)) : L
243
243
  );
244
244
  }, _.jsxs = function(e, r, n) {
245
- var a = 1e4 > y.recentlyCreatedOwnerStacks++;
246
- return w(
245
+ var a = 1e4 > g.recentlyCreatedOwnerStacks++;
246
+ return j(
247
247
  e,
248
248
  r,
249
249
  n,
250
250
  !0,
251
- a ? Error("react-stack-top-frame") : Y,
252
- a ? O(l(e)) : $
251
+ a ? Error("react-stack-top-frame") : I,
252
+ a ? S(s(e)) : L
253
253
  );
254
254
  };
255
255
  })()), _;
256
256
  }
257
- var L;
258
- function ae() {
259
- return L || (L = 1, process.env.NODE_ENV === "production" ? b.exports = te() : b.exports = ne()), b.exports;
257
+ var U;
258
+ function ie() {
259
+ return U || (U = 1, process.env.NODE_ENV === "production" ? b.exports = se() : b.exports = ue()), b.exports;
260
260
  }
261
- var oe = ae();
262
- let S = {
263
- sitekey: "",
264
- locale: ""
265
- }, v = null;
266
- function le(t) {
267
- return typeof window > "u" ? Promise.reject("Cannot load script on server") : v || (v = new Promise((c, i) => {
261
+ var P = ie();
262
+ let k = {
263
+ done: !1,
264
+ registered: !1
265
+ }, v = !1, A = null, T = null;
266
+ function ce(t) {
267
+ return typeof window > "u" ? Promise.reject("Cannot load script on server") : T || (T = new Promise((l, c) => {
268
268
  if (document.querySelector(`script[src="${t}"]`)) {
269
- c();
269
+ l();
270
270
  return;
271
271
  }
272
- const l = document.createElement("script");
273
- l.src = t, l.async = !0, l.onload = () => c(), l.onerror = () => i(new Error(`Failed to load ${t}`)), document.head.appendChild(l);
274
- }), v);
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);
275
+ }
276
+ function fe(t) {
277
+ t.data.type === "euCaptchaCompleted" && (k.done = !0);
275
278
  }
276
- function se(t) {
277
- t = t || {}, typeof t.sitekey == "string" && (S.sitekey = t.sitekey), typeof t.locale == "string" && (S.locale = t.locale), le("https://cdn.eu-captcha.eu/verify.js").then(() => {
278
- console.log("loaded successfully myra eu captcha library");
279
- }, (c) => {
280
- console.log("error occured: " + c);
279
+ function de(t) {
280
+ 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);
281
284
  });
282
285
  }
283
- function ce(t) {
284
- return t && t.sitekey && se({ sitekey: t.sitekey }), /* @__PURE__ */ oe.jsx("div", { className: "eu-captcha", "data-sitekey": S.sitekey });
286
+ function Ee(t) {
287
+ if ([v, A] = oe(v), t && t.sitekey && de({
288
+ sitekey: t.sitekey
289
+ }), le(() => {
290
+ }, [v]), !v)
291
+ 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 } });
285
295
  }
286
296
  export {
287
- ce as EuCaptcha,
288
- se as loadEuCaptcha
297
+ Ee as EuCaptcha,
298
+ de as loadEuCaptcha
289
299
  };
@@ -1,6 +1,6 @@
1
- (function(i,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(i=typeof globalThis<"u"?globalThis:i||self,m(i["@myra/eu-captcha"]={},i.React))})(this,(function(i,m){"use strict";var b={exports:{}},E={};var g;function q(){if(g)return E;g=1;var t=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(s,u,l){var _=null;if(l!==void 0&&(_=""+l),u.key!==void 0&&(_=""+u.key),"key"in u){l={};for(var R in u)R!=="key"&&(l[R]=u[R])}else l=u;return u=l.ref,{$$typeof:t,type:s,key:_,ref:u!==void 0?u:null,props:l}}return E.Fragment=c,E.jsx=f,E.jsxs=f,E}var p={};var j;function J(){return j||(j=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case K:return"Profiler";case Q:return"StrictMode";case ne:return"Suspense";case ae:return"SuspenseList";case se: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 Z:return"Portal";case re:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case te:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case oe: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 c(e){return""+e}function f(e){try{c(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),c(e)}}function s(e){if(e===h)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=S.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function _(e){if(I.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(){D||(D=!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 B(){var e=t(this.type);return M[e]||(M[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 H(e,r,n,a,y,w){var o=n.ref;return e={$$typeof:F,type:e,key:r,props:n,_owner:a},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:B}):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:y}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function C(e,r,n,a,y,w){var o=r.children;if(o!==void 0)if(a)if(le(o)){for(a=0;a<o.length;a++)Y(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 Y(o);if(I.call(r,"key")){o=t(e);var d=Object.keys(r).filter(function(ce){return ce!=="key"});a=0<d.length?"{key: someKey, "+d.join(": ..., ")+": ...}":"{key: someKey}",U[o+a]||(d=0<d.length?"{"+d.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
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:
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,d,o),U[o+a]=!0)}if(o=null,n!==void 0&&(f(n),o=""+n),_(r)&&(f(r.key),o=""+r.key),"key"in r){n={};for(var A in r)A!=="key"&&(n[A]=r[A])}else n=r;return o&&R(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),H(e,o,n,u(),y,w)}function Y(e){$(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?$(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function $(e){return typeof e=="object"&&e!==null&&e.$$typeof===F}var T=m,F=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),re=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),oe=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),S=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=Object.prototype.hasOwnProperty,le=Array.isArray,P=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(e){return e()}};var D,M={},L=T.react_stack_bottom_frame.bind(T,l)(),W=P(s(l)),U={};p.Fragment=h,p.jsx=function(e,r,n){var a=1e4>S.recentlyCreatedOwnerStacks++;return C(e,r,n,!1,a?Error("react-stack-top-frame"):L,a?P(s(e)):W)},p.jsxs=function(e,r,n){var a=1e4>S.recentlyCreatedOwnerStacks++;return C(e,r,n,!0,a?Error("react-stack-top-frame"):L,a?P(s(e)):W)}})()),p}var x;function V(){return x||(x=1,process.env.NODE_ENV==="production"?b.exports=q():b.exports=J()),b.exports}var z=V();let k={sitekey:"",locale:""},v=null;function G(t){return typeof window>"u"?Promise.reject("Cannot load script on server"):v||(v=new Promise((c,f)=>{if(document.querySelector(`script[src="${t}"]`)){c();return}const s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>c(),s.onerror=()=>f(new Error(`Failed to load ${t}`)),document.head.appendChild(s)}),v)}function N(t){t=t||{},typeof t.sitekey=="string"&&(k.sitekey=t.sitekey),typeof t.locale=="string"&&(k.locale=t.locale),G("https://cdn.eu-captcha.eu/verify.js").then(()=>{console.log("loaded successfully myra eu captcha library")},c=>{console.log("error occured: "+c)})}function X(t){return t&&t.sitekey&&N({sitekey:t.sitekey}),z.jsx("div",{className:"eu-captcha","data-sitekey":k.sitekey})}i.EuCaptcha=X,i.loadEuCaptcha=N,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
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"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myrasec/eu-captcha",
3
3
  "private": false,
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
6
  "main": "./dist/eu-captcha.umd.cjs",
7
7
  "module": "./dist/eu-captcha.js",
package/publish.sh ADDED
@@ -0,0 +1,5 @@
1
+ #! /bin/sh
2
+
3
+ npm run build || exit 1
4
+
5
+ npm publish --public