@prosopo/procaptcha-pow 2.10.22 → 2.10.24

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-pow@2.10.22 build:cjs
2
+ > @prosopo/procaptcha-pow@2.10.24 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -39,14 +39,16 @@ ViteCommonJSConfig: .
39
39
  '@prosopo/keyring'
40
40
  ]
41
41
  }
42
- vite v6.4.1 building SSR bundle for production...
42
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
43
+ vite v8.1.5 building ssr environment for production...
43
44
  Bundle build started
44
- transforming...
45
- Build end
46
- ✓ 4 modules transformed.
45
+ 
46
+ ✓ 5 modules transformed.
47
47
  rendering chunks...
48
- dist/cjs/index.cjs  0.25 kB
49
- dist/cjs/components/ProcaptchaPoW.cjs  0.70 kB
50
- dist/cjs/components/ProcaptchaWidget.cjs  4.57 kB
51
- dist/cjs/services/Manager.cjs 10.78 kB
52
- ✓ built in 213ms
48
+ computing gzip size...
49
+ dist/cjs/index.cjs 0.20 kB │ gzip: 0.15 kB
50
+ dist/cjs/components/ProcaptchaPoW.cjs 0.51 kB │ gzip: 0.27 kB
51
+ dist/cjs/components/ProcaptchaWidget.cjs 4.43 kB │ gzip: 1.47 kB
52
+ dist/cjs/services/Manager.cjs 9.18 kB │ gzip: 2.61 kB
53
+
54
+ ✓ built in 59ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-pow@2.10.22 build:tsc
2
+ > @prosopo/procaptcha-pow@2.10.24 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 12:17:43 PM - Projects in this build:
5
+ 8:59:31 PM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../locale/tsconfig.json
8
8
  * ../util/tsconfig.json
@@ -20,37 +20,37 @@
20
20
  * ../procaptcha-common/tsconfig.json
21
21
  * tsconfig.json
22
22
 
23
- 12:17:43 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
23
+ 8:59:31 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
24
24
 
25
- 12:17:43 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
25
+ 8:59:31 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
26
26
 
27
- 12:17:43 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
27
+ 8:59:31 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
28
28
 
29
- 12:17:43 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
29
+ 8:59:31 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
30
30
 
31
- 12:17:43 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
31
+ 8:59:31 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
32
32
 
33
- 12:17:43 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
33
+ 8:59:31 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
34
34
 
35
- 12:17:43 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
35
+ 8:59:31 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
36
36
 
37
- 12:17:43 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
37
+ 8:59:31 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/batches.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
38
38
 
39
- 12:17:43 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
39
+ 8:59:31 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
40
40
 
41
- 12:17:44 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
41
+ 8:59:31 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
42
42
 
43
- 12:17:44 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/balancer.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
43
+ 8:59:31 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/tests/providers.unit.test.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
44
44
 
45
- 12:17:44 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/index.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
45
+ 8:59:31 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/index.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
46
46
 
47
- 12:17:44 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
47
+ 8:59:31 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
48
48
 
49
- 12:17:44 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
49
+ 8:59:31 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/tests/cryptoWorker.unit.test.ts' is older than output '../account/tsconfig.tsbuildinfo'
50
50
 
51
- 12:17:44 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/reactComponents/Honeypot.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
51
+ 8:59:31 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/defaultEvents.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
52
52
 
53
- 12:17:44 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
53
+ 8:59:31 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
54
54
 
55
- 12:17:44 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json'...
55
+ 8:59:31 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json'...
56
56
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-pow@2.10.22 build
2
+ > @prosopo/procaptcha-pow@2.10.24 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-pow@2.10.22 build:cross-env
6
+ > @prosopo/procaptcha-pow@2.10.24 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -43,14 +43,17 @@ ViteEsmConfig: .
43
43
  '@prosopo/keyring'
44
44
  ]
45
45
  }
46
- vite v6.4.1 building SSR bundle for production...
46
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
47
+ vite v8.1.5 building ssr environment for production...
47
48
  Bundle build started
48
- transforming...
49
- Build end
50
- ✓ 4 modules transformed.
49
+ 
50
+ ✓ 5 modules transformed.
51
51
  rendering chunks...
52
- dist/index.js  0.13 kB
53
- dist/components/ProcaptchaPoW.js  0.33 kB
54
- dist/components/ProcaptchaWidget.js  4.41 kB
55
- dist/services/Manager.js 10.61 kB
56
- ✓ built in 206ms
52
+ computing gzip size...
53
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
54
+ dist/index.js 0.13 kB │ gzip: 0.11 kB
55
+ dist/components/ProcaptchaPoW.js 0.37 kB │ gzip: 0.23 kB
56
+ dist/components/ProcaptchaWidget.js 4.02 kB │ gzip: 1.45 kB
57
+ dist/services/Manager.js 8.52 kB │ gzip: 2.56 kB
58
+
59
+ ✓ built in 73ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @prosopo/procaptcha-pow
2
2
 
3
+ ## 2.10.24
4
+ ### Patch Changes
5
+
6
+ - ab3499c: feat(procaptcha): block on SIMD readings at solution submit
7
+
8
+ Solution submit is the last hop the client controls, so it's the last chance to
9
+ attach the catcher's WASM SIMD readings for a session. The image, PoW and puzzle
10
+ managers now wait for the benchmark there via a shared
11
+ `getSimdReadingsForSubmit` helper, capped at 5s, instead of attaching only
12
+ whatever the prefetch happened to have resolved.
13
+
14
+ The helper passes the budget down to the detector *and* races it locally — the
15
+ detector ships prebuilt, so a bundle that ignores `timeoutMs` (or a benchmark
16
+ wedged on a busy main thread) can't hang the submission. It never rejects: a
17
+ missing accessor, a rejection, a synchronous throw and a timeout all resolve to
18
+ `undefined` and the solution is submitted without readings, so a user is never
19
+ failed over telemetry.
20
+
21
+ The earlier frictionless POST and challenge GET hops are unchanged and remain
22
+ non-blocking.
23
+ - e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
24
+ - Updated dependencies [2c47bb7]
25
+ - Updated dependencies [ab3499c]
26
+ - Updated dependencies [0e1171c]
27
+ - Updated dependencies [103318c]
28
+ - Updated dependencies [270a8d8]
29
+ - Updated dependencies [e14fce6]
30
+ - @prosopo/util@3.3.5
31
+ - @prosopo/procaptcha-common@2.11.18
32
+ - @prosopo/locale@3.2.8
33
+ - @prosopo/types@4.10.0
34
+ - @prosopo/api@3.5.20
35
+ - @prosopo/common@3.1.48
36
+ - @prosopo/fingerprint@2.7.19
37
+
38
+ ## 2.10.23
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [a0cb39e]
42
+ - @prosopo/types@4.9.12
43
+ - @prosopo/api@3.5.19
44
+ - @prosopo/fingerprint@2.7.18
45
+ - @prosopo/procaptcha-common@2.11.17
46
+
3
47
  ## 2.10.22
4
48
  ### Patch Changes
5
49
 
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const _interopNamespaceDefaultOnly = (e) => Object.freeze(Object.defineProperty({ __proto__: null, default: e }, Symbol.toStringTag, { value: "Module" }));
6
- const ProcaptchaWidget = react.lazy(
7
- async () => Promise.resolve().then(() => /* @__PURE__ */ _interopNamespaceDefaultOnly(require("./ProcaptchaWidget.cjs")))
8
- );
9
- const ProcaptchaPow = (props) => /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsx(ProcaptchaWidget, { ...props }) });
1
+ let react = require("react");
2
+ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
3
+ //#region src/components/ProcaptchaPoW.tsx
4
+ var ProcaptchaWidget = (0, react.lazy)(async () => Promise.resolve().then(() => require("./ProcaptchaWidget.cjs")));
5
+ var ProcaptchaPow = (props) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ProcaptchaWidget, { ...props }) });
6
+ //#endregion
10
7
  exports.ProcaptchaPow = ProcaptchaPow;
@@ -1,128 +1,110 @@
1
- "use strict";
2
- const jsxRuntime = require("@emotion/react/jsx-runtime");
3
- const locale = require("@prosopo/locale");
4
- const procaptchaCommon = require("@prosopo/procaptcha-common");
5
- const types = require("@prosopo/types");
6
- const widgetSkeleton = require("@prosopo/widget-skeleton");
7
- const react = require("react");
8
- const Manager = require("../services/Manager.cjs");
9
- const PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
10
- const Procaptcha = (props) => {
11
- const { t, ready: isTranslationReady } = locale.useTranslation();
12
- const config = props.config;
13
- const i18n = props.i18n;
14
- const theme = "light" === config.theme ? widgetSkeleton.lightTheme : widgetSkeleton.darkTheme;
15
- const frictionlessState = props.frictionlessState;
16
- const callbacks = props.callbacks || {};
17
- const [state, _updateState] = procaptchaCommon.useProcaptcha(react.useState, react.useRef);
18
- const [loading, setLoading] = react.useState(false);
19
- const updateState = procaptchaCommon.buildUpdateState(state, _updateState);
20
- const hpRef = react.useRef(null);
21
- const manager = react.useRef(
22
- Manager.Manager(
23
- config,
24
- state,
25
- updateState,
26
- callbacks,
27
- frictionlessState,
28
- props.onEscalate,
29
- () => hpRef.current?.value || void 0
30
- )
31
- );
32
- const lastCoordsRef = react.useRef(null);
33
- const sessionInvalidatedFiredRef = react.useRef(false);
34
- react.useEffect(() => {
35
- if (!config.language) return;
36
- if (i18n) {
37
- if (i18n.language !== config.language) {
38
- void i18n.changeLanguage(config.language);
39
- }
40
- return;
41
- }
42
- void locale.loadI18next(false, config.language);
43
- }, [i18n, config.language]);
44
- react.useEffect(() => {
45
- if (!props.autoStart) return;
46
- setLoading(true);
47
- const coords = props.startCoords;
48
- lastCoordsRef.current = coords ?? null;
49
- manager.current.start(coords?.x ?? 0, coords?.y ?? 0).finally(() => {
50
- setLoading(false);
51
- });
52
- }, [props.autoStart, props.startCoords]);
53
- react.useEffect(() => {
54
- if (!state.error) return;
55
- setLoading(false);
56
- if (state.error.key !== "CAPTCHA.NO_SESSION_FOUND") return;
57
- if (props.onSessionInvalidated && !sessionInvalidatedFiredRef.current) {
58
- sessionInvalidatedFiredRef.current = true;
59
- const coords = lastCoordsRef.current;
60
- props.onSessionInvalidated(coords?.x, coords?.y);
61
- return;
62
- }
63
- if (frictionlessState) {
64
- setTimeout(() => {
65
- frictionlessState.restart();
66
- }, 100);
67
- }
68
- }, [state.error, frictionlessState, props.onSessionInvalidated]);
69
- react.useEffect(() => {
70
- if (config.mode === types.ModeEnum.invisible) {
71
- const handleExecuteEvent = (event) => {
72
- try {
73
- manager.current.start();
74
- } catch (error) {
75
- console.error("Error starting PoW verification:", error);
76
- }
77
- };
78
- document.addEventListener(PROCAPTCHA_EXECUTE_EVENT, handleExecuteEvent);
79
- return () => {
80
- document.removeEventListener(
81
- PROCAPTCHA_EXECUTE_EVENT,
82
- handleExecuteEvent
83
- );
84
- };
85
- }
86
- return () => {
87
- };
88
- }, [config.mode]);
89
- const honeypot = frictionlessState?.hp ? /* @__PURE__ */ jsxRuntime.jsx(procaptchaCommon.Honeypot, { ref: hpRef, encodedQuestion: frictionlessState.hp }) : null;
90
- if (config.mode === types.ModeEnum.invisible) {
91
- return honeypot;
92
- }
93
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
94
- honeypot,
95
- /* @__PURE__ */ jsxRuntime.jsx(
96
- procaptchaCommon.Checkbox,
97
- {
98
- checked: state.isHuman,
99
- theme,
100
- onChange: async (event) => {
101
- if (loading) {
102
- return;
103
- }
104
- setLoading(true);
105
- let x = 0;
106
- let y = 0;
107
- const mouseOrTouchEvent = event.nativeEvent;
108
- if (!mouseOrTouchEvent.isTrusted) {
109
- } else if ("touches" in mouseOrTouchEvent && mouseOrTouchEvent.touches.length > 0 && mouseOrTouchEvent.touches[0]) {
110
- x = mouseOrTouchEvent.touches[0].clientX;
111
- y = mouseOrTouchEvent.touches[0].clientY;
112
- } else if ("clientX" in mouseOrTouchEvent && "clientY" in mouseOrTouchEvent) {
113
- x = mouseOrTouchEvent.clientX;
114
- y = mouseOrTouchEvent.clientY;
115
- }
116
- lastCoordsRef.current = { x, y };
117
- await manager.current.start(x, y);
118
- setLoading(false);
119
- },
120
- labelText: isTranslationReady ? t("WIDGET.I_AM_HUMAN") : "",
121
- error: state.error?.message,
122
- "aria-label": "human checkbox",
123
- loading
124
- }
125
- )
126
- ] });
1
+ const require_Manager = require("../services/Manager.cjs");
2
+ let _prosopo_locale = require("@prosopo/locale");
3
+ let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
4
+ let _prosopo_types = require("@prosopo/types");
5
+ let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
6
+ let react = require("react");
7
+ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
8
+ //#region src/components/ProcaptchaWidget.tsx
9
+ var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
10
+ var Procaptcha = (props) => {
11
+ const { t, ready: isTranslationReady } = (0, _prosopo_locale.useTranslation)();
12
+ const config = props.config;
13
+ const i18n = props.i18n;
14
+ const theme = "light" === config.theme ? _prosopo_widget_skeleton.lightTheme : _prosopo_widget_skeleton.darkTheme;
15
+ const frictionlessState = props.frictionlessState;
16
+ const callbacks = props.callbacks || {};
17
+ const [state, _updateState] = (0, _prosopo_procaptcha_common.useProcaptcha)(react.useState, react.useRef);
18
+ const [loading, setLoading] = (0, react.useState)(false);
19
+ const updateState = (0, _prosopo_procaptcha_common.buildUpdateState)(state, _updateState);
20
+ const hpRef = (0, react.useRef)(null);
21
+ const manager = (0, react.useRef)(require_Manager.Manager(config, state, updateState, callbacks, frictionlessState, props.onEscalate, () => hpRef.current?.value || void 0));
22
+ const lastCoordsRef = (0, react.useRef)(null);
23
+ const sessionInvalidatedFiredRef = (0, react.useRef)(false);
24
+ (0, react.useEffect)(() => {
25
+ if (!config.language) return;
26
+ if (i18n) {
27
+ if (i18n.language !== config.language) i18n.changeLanguage(config.language);
28
+ return;
29
+ }
30
+ (0, _prosopo_locale.loadI18next)(false, config.language);
31
+ }, [i18n, config.language]);
32
+ (0, react.useEffect)(() => {
33
+ if (!props.autoStart) return;
34
+ setLoading(true);
35
+ const coords = props.startCoords;
36
+ lastCoordsRef.current = coords ?? null;
37
+ manager.current.start(coords?.x ?? 0, coords?.y ?? 0).finally(() => {
38
+ setLoading(false);
39
+ });
40
+ }, [props.autoStart, props.startCoords]);
41
+ (0, react.useEffect)(() => {
42
+ if (!state.error) return;
43
+ setLoading(false);
44
+ if (state.error.key !== "CAPTCHA.NO_SESSION_FOUND") return;
45
+ if (props.onSessionInvalidated && !sessionInvalidatedFiredRef.current) {
46
+ sessionInvalidatedFiredRef.current = true;
47
+ const coords = lastCoordsRef.current;
48
+ props.onSessionInvalidated(coords?.x, coords?.y);
49
+ return;
50
+ }
51
+ if (frictionlessState) setTimeout(() => {
52
+ frictionlessState.restart();
53
+ }, 100);
54
+ }, [
55
+ state.error,
56
+ frictionlessState,
57
+ props.onSessionInvalidated
58
+ ]);
59
+ (0, react.useEffect)(() => {
60
+ if (config.mode === _prosopo_types.ModeEnum.invisible) {
61
+ const handleExecuteEvent = (event) => {
62
+ try {
63
+ manager.current.start();
64
+ } catch (error) {
65
+ console.error("Error starting PoW verification:", error);
66
+ }
67
+ };
68
+ document.addEventListener(PROCAPTCHA_EXECUTE_EVENT, handleExecuteEvent);
69
+ return () => {
70
+ document.removeEventListener(PROCAPTCHA_EXECUTE_EVENT, handleExecuteEvent);
71
+ };
72
+ }
73
+ return () => {};
74
+ }, [config.mode]);
75
+ const honeypot = frictionlessState?.hp ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_prosopo_procaptcha_common.Honeypot, {
76
+ ref: hpRef,
77
+ encodedQuestion: frictionlessState.hp
78
+ }) : null;
79
+ if (config.mode === _prosopo_types.ModeEnum.invisible) return honeypot;
80
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [honeypot, /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_prosopo_procaptcha_common.Checkbox, {
81
+ checked: state.isHuman,
82
+ theme,
83
+ onChange: async (event) => {
84
+ if (loading) return;
85
+ setLoading(true);
86
+ let x = 0;
87
+ let y = 0;
88
+ const mouseOrTouchEvent = event.nativeEvent;
89
+ if (!mouseOrTouchEvent.isTrusted) {} else if ("touches" in mouseOrTouchEvent && mouseOrTouchEvent.touches.length > 0 && mouseOrTouchEvent.touches[0]) {
90
+ x = mouseOrTouchEvent.touches[0].clientX;
91
+ y = mouseOrTouchEvent.touches[0].clientY;
92
+ } else if ("clientX" in mouseOrTouchEvent && "clientY" in mouseOrTouchEvent) {
93
+ x = mouseOrTouchEvent.clientX;
94
+ y = mouseOrTouchEvent.clientY;
95
+ }
96
+ lastCoordsRef.current = {
97
+ x,
98
+ y
99
+ };
100
+ await manager.current.start(x, y);
101
+ setLoading(false);
102
+ },
103
+ labelText: isTranslationReady ? t("WIDGET.I_AM_HUMAN") : "",
104
+ error: state.error?.message,
105
+ "aria-label": "human checkbox",
106
+ loading
107
+ })] });
127
108
  };
128
- module.exports = Procaptcha;
109
+ //#endregion
110
+ exports.default = Procaptcha;
@@ -1,5 +1,3 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./components/ProcaptchaWidget.cjs");
4
- const ProcaptchaPoW = require("./components/ProcaptchaPoW.cjs");
5
- exports.ProcaptchaPow = ProcaptchaPoW.ProcaptchaPow;
2
+ const require_ProcaptchaPoW = require("./components/ProcaptchaPoW.cjs");
3
+ exports.ProcaptchaPow = require_ProcaptchaPoW.ProcaptchaPow;