@prosopo/procaptcha-common 2.11.17 → 2.11.19
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.
- package/.turbo/turbo-build$colon$cjs.log +22 -20
- package/.turbo/turbo-build$colon$tsc.log +18 -18
- package/.turbo/turbo-build.log +23 -19
- package/CHANGELOG.md +33 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/callbacks/defaultCallbacks.js +100 -152
- package/dist/callbacks/defaultEvents.js +6 -6
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/callbacks/defaultCallbacks.cjs +100 -151
- package/dist/cjs/callbacks/defaultEvents.cjs +6 -6
- package/dist/cjs/elements/form.cjs +10 -17
- package/dist/cjs/elements/window.cjs +17 -15
- package/dist/cjs/extensionLoader.cjs +3 -25
- package/dist/cjs/index.cjs +29 -27
- package/dist/cjs/providers.cjs +29 -42
- package/dist/cjs/reactComponents/Checkbox.cjs +102 -121
- package/dist/cjs/reactComponents/Honeypot.cjs +54 -62
- package/dist/cjs/reactComponents/Reload.cjs +59 -80
- package/dist/cjs/reactComponents/TestModeBanner.cjs +31 -44
- package/dist/cjs/simdReadings.cjs +24 -0
- package/dist/cjs/state/builder.cjs +70 -83
- package/dist/elements/form.js +10 -18
- package/dist/elements/window.js +18 -17
- package/dist/extensionLoader.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -19
- package/dist/index.js.map +1 -1
- package/dist/providers.js +29 -45
- package/dist/reactComponents/Checkbox.js +99 -121
- package/dist/reactComponents/Honeypot.js +53 -61
- package/dist/reactComponents/Reload.js +58 -80
- package/dist/reactComponents/TestModeBanner.js +30 -45
- package/dist/simdReadings.d.ts +6 -0
- package/dist/simdReadings.d.ts.map +1 -0
- package/dist/simdReadings.js +23 -0
- package/dist/simdReadings.js.map +1 -0
- package/dist/state/builder.js +71 -85
- package/dist/tests/simdReadings.test.d.ts +2 -0
- package/dist/tests/simdReadings.test.d.ts.map +1 -0
- package/dist/tests/simdReadings.test.js +76 -0
- package/dist/tests/simdReadings.test.js.map +1 -0
- package/package.json +8 -8
- package/src/index.ts +1 -0
- package/src/simdReadings.ts +45 -0
- package/src/tests/simdReadings.test.ts +149 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-common@2.11.
|
|
2
|
+
> @prosopo/procaptcha-common@2.11.19 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -35,24 +35,26 @@ ViteCommonJSConfig: .
|
|
|
35
35
|
'@prosopo/keyring'
|
|
36
36
|
]
|
|
37
37
|
}
|
|
38
|
-
[
|
|
38
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
39
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
39
40
|
Bundle build started
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[32m✓[39m 12 modules transformed.
|
|
43
|
-
[33mEntry module "src/reactComponents/Checkbox.tsx" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
44
|
-
[33mEntry module "src/reactComponents/TestModeBanner.tsx" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
41
|
+
[2K
|
|
42
|
+
✓ 14 modules transformed.
|
|
45
43
|
rendering chunks...
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
computing gzip size...
|
|
45
|
+
dist/cjs/extensionLoader.cjs 0.27 kB │ gzip: 0.16 kB
|
|
46
|
+
dist/cjs/callbacks/defaultEvents.cjs 0.28 kB │ gzip: 0.16 kB
|
|
47
|
+
dist/cjs/elements/form.cjs 0.62 kB │ gzip: 0.31 kB
|
|
48
|
+
dist/cjs/simdReadings.cjs 0.79 kB │ gzip: 0.36 kB
|
|
49
|
+
dist/cjs/elements/window.cjs 0.96 kB │ gzip: 0.54 kB
|
|
50
|
+
dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
|
|
51
|
+
dist/cjs/reactComponents/TestModeBanner.cjs 1.36 kB │ gzip: 0.75 kB
|
|
52
|
+
dist/cjs/providers.cjs 1.54 kB │ gzip: 0.64 kB
|
|
53
|
+
dist/cjs/index.cjs 1.97 kB │ gzip: 0.54 kB
|
|
54
|
+
dist/cjs/reactComponents/Honeypot.cjs 2.03 kB │ gzip: 0.91 kB
|
|
55
|
+
dist/cjs/reactComponents/Reload.cjs 2.89 kB │ gzip: 1.25 kB
|
|
56
|
+
dist/cjs/state/builder.cjs 3.13 kB │ gzip: 0.84 kB
|
|
57
|
+
dist/cjs/callbacks/defaultCallbacks.cjs 3.84 kB │ gzip: 1.03 kB
|
|
58
|
+
dist/cjs/reactComponents/Checkbox.cjs 4.06 kB │ gzip: 1.59 kB
|
|
59
|
+
|
|
60
|
+
[32m✓ built in 70ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-common@2.11.
|
|
2
|
+
> @prosopo/procaptcha-common@2.11.19 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
11:41:00 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
@@ -18,35 +18,35 @@
|
|
|
18
18
|
* ../account/tsconfig.json
|
|
19
19
|
* tsconfig.json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
11:41:00 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'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
11:41:00 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
11:41:00 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
11:41:00 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
11:41:00 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
|
-
|
|
31
|
+
11:41:00 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/procaptcha/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
11:41:00 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
11:41:00 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'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
11:41:00 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'
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
11:41:00 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
|
-
|
|
41
|
+
11:41:00 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
|
-
|
|
43
|
+
11:41:00 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
11:41:00 PM - Project '../account/tsconfig.json' is out of date because output file '../account/tsconfig.tsbuildinfo' does not exist
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
11:41:00 PM - Building project '/home/runner/work/captcha/captcha/packages/account/tsconfig.json'...
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
11:41:02 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
11:41:02 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json'...
|
|
52
52
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-common@2.11.
|
|
2
|
+
> @prosopo/procaptcha-common@2.11.19 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/procaptcha-common@2.11.
|
|
6
|
+
> @prosopo/procaptcha-common@2.11.19 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -39,22 +39,26 @@ ViteEsmConfig: .
|
|
|
39
39
|
'@prosopo/keyring'
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
|
-
[
|
|
42
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
43
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
43
44
|
Bundle build started
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[32m✓[39m 12 modules transformed.
|
|
45
|
+
[2K
|
|
46
|
+
✓ 14 modules transformed.
|
|
47
47
|
rendering chunks...
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
computing gzip size...
|
|
49
|
+
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
50
|
+
dist/callbacks/defaultEvents.js 0.23 kB │ gzip: 0.15 kB
|
|
51
|
+
dist/extensionLoader.js 0.25 kB │ gzip: 0.16 kB
|
|
52
|
+
dist/elements/form.js 0.56 kB │ gzip: 0.30 kB
|
|
53
|
+
dist/simdReadings.js 0.72 kB │ gzip: 0.35 kB
|
|
54
|
+
dist/elements/window.js 0.91 kB │ gzip: 0.53 kB
|
|
55
|
+
dist/index.js 1.20 kB │ gzip: 0.42 kB
|
|
56
|
+
dist/reactComponents/TestModeBanner.js 1.23 kB │ gzip: 0.71 kB
|
|
57
|
+
dist/providers.js 1.41 kB │ gzip: 0.62 kB
|
|
58
|
+
dist/reactComponents/Honeypot.js 1.86 kB │ gzip: 0.89 kB
|
|
59
|
+
dist/reactComponents/Reload.js 2.64 kB │ gzip: 1.22 kB
|
|
60
|
+
dist/state/builder.js 3.09 kB │ gzip: 0.84 kB
|
|
61
|
+
dist/reactComponents/Checkbox.js 3.62 kB │ gzip: 1.51 kB
|
|
62
|
+
dist/callbacks/defaultCallbacks.js 3.64 kB │ gzip: 1.00 kB
|
|
63
|
+
|
|
64
|
+
[32m✓ built in 47ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @prosopo/procaptcha-common
|
|
2
2
|
|
|
3
|
+
## 2.11.19
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- @prosopo/account@2.8.65
|
|
7
|
+
|
|
8
|
+
## 2.11.18
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ab3499c: feat(procaptcha): block on SIMD readings at solution submit
|
|
12
|
+
|
|
13
|
+
Solution submit is the last hop the client controls, so it's the last chance to
|
|
14
|
+
attach the catcher's WASM SIMD readings for a session. The image, PoW and puzzle
|
|
15
|
+
managers now wait for the benchmark there via a shared
|
|
16
|
+
`getSimdReadingsForSubmit` helper, capped at 5s, instead of attaching only
|
|
17
|
+
whatever the prefetch happened to have resolved.
|
|
18
|
+
|
|
19
|
+
The helper passes the budget down to the detector *and* races it locally — the
|
|
20
|
+
detector ships prebuilt, so a bundle that ignores `timeoutMs` (or a benchmark
|
|
21
|
+
wedged on a busy main thread) can't hang the submission. It never rejects: a
|
|
22
|
+
missing accessor, a rejection, a synchronous throw and a timeout all resolve to
|
|
23
|
+
`undefined` and the solution is submitted without readings, so a user is never
|
|
24
|
+
failed over telemetry.
|
|
25
|
+
|
|
26
|
+
The earlier frictionless POST and challenge GET hops are unchanged and remain
|
|
27
|
+
non-blocking.
|
|
28
|
+
- 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
|
|
29
|
+
- Updated dependencies [103318c]
|
|
30
|
+
- Updated dependencies [270a8d8]
|
|
31
|
+
- Updated dependencies [e14fce6]
|
|
32
|
+
- @prosopo/types@4.10.0
|
|
33
|
+
- @prosopo/account@2.8.64
|
|
34
|
+
- @prosopo/load-balancer@2.10.16
|
|
35
|
+
|
|
3
36
|
## 2.11.17
|
|
4
37
|
### Patch Changes
|
|
5
38
|
|
|
@@ -1,158 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { removeProcaptchaResponse, getParentForm } from "../elements/form.js";
|
|
1
|
+
import { getParentForm, removeProcaptchaResponse } from "../elements/form.js";
|
|
3
2
|
import { getWindowCallback } from "../elements/window.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
3
|
+
import { ApiParams } from "@prosopo/types";
|
|
4
|
+
//#region src/callbacks/defaultCallbacks.ts
|
|
5
|
+
var getDefaultCallbacks = (element) => ({
|
|
6
|
+
onHuman: (token) => handleOnHuman(token, element),
|
|
7
|
+
onChallengeExpired: () => {
|
|
8
|
+
removeProcaptchaResponse();
|
|
9
|
+
console.log("Challenge expired");
|
|
10
|
+
},
|
|
11
|
+
onExtensionNotFound: () => {
|
|
12
|
+
console.error("Extension not found");
|
|
13
|
+
},
|
|
14
|
+
onExpired: () => {
|
|
15
|
+
removeProcaptchaResponse();
|
|
16
|
+
},
|
|
17
|
+
onError: (error) => {
|
|
18
|
+
removeProcaptchaResponse();
|
|
19
|
+
console.error(error);
|
|
20
|
+
},
|
|
21
|
+
onClose: () => {
|
|
22
|
+
console.log("Challenge closed");
|
|
23
|
+
},
|
|
24
|
+
onOpen: () => {
|
|
25
|
+
console.log("Challenge opened");
|
|
26
|
+
},
|
|
27
|
+
onFailed: () => {
|
|
28
|
+
alert("Captcha challenge failed. Please try again");
|
|
29
|
+
console.log("Challenge failed");
|
|
30
|
+
},
|
|
31
|
+
onReset: () => {
|
|
32
|
+
removeProcaptchaResponse();
|
|
33
|
+
console.log("Captcha widget reset");
|
|
34
|
+
},
|
|
35
|
+
onReload: () => {
|
|
36
|
+
console.log("Challenge reloaded");
|
|
37
|
+
}
|
|
37
38
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (typeof callbackFnOrName === "string") {
|
|
50
|
-
return getWindowCallback(callbackFnOrName);
|
|
51
|
-
}
|
|
39
|
+
/**
|
|
40
|
+
* Set the a user callback function for an element. Data tags take precedence over renderOptions.
|
|
41
|
+
*/
|
|
42
|
+
var getUserCallback = (callback, element, callbackFnOrName) => {
|
|
43
|
+
const callbackFnName = element.getAttribute(`data-${callback}`);
|
|
44
|
+
if (callbackFnName) {
|
|
45
|
+
const callbackFn = getWindowCallback(callbackFnName);
|
|
46
|
+
if (callbackFn) return callbackFn;
|
|
47
|
+
}
|
|
48
|
+
if (typeof callbackFnOrName === "function") return callbackFnOrName;
|
|
49
|
+
if (typeof callbackFnOrName === "string") return getWindowCallback(callbackFnOrName);
|
|
52
50
|
};
|
|
53
51
|
function setUserCallbacks(renderOptions, callbacks, element) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
);
|
|
92
|
-
if (errorCallback) {
|
|
93
|
-
callbacks.onError = (error) => {
|
|
94
|
-
removeProcaptchaResponse();
|
|
95
|
-
errorCallback(error);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const closeCallback = getUserCallback(
|
|
99
|
-
"close-callback",
|
|
100
|
-
element,
|
|
101
|
-
renderOptions?.["close-callback"]
|
|
102
|
-
);
|
|
103
|
-
if (closeCallback) {
|
|
104
|
-
callbacks.onClose = () => {
|
|
105
|
-
closeCallback();
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const openCallback = getUserCallback(
|
|
109
|
-
"open-callback",
|
|
110
|
-
element,
|
|
111
|
-
renderOptions?.["open-callback"]
|
|
112
|
-
);
|
|
113
|
-
if (openCallback) {
|
|
114
|
-
callbacks.onOpen = () => {
|
|
115
|
-
openCallback();
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const failedCallback = getUserCallback(
|
|
119
|
-
"failed-callback",
|
|
120
|
-
element,
|
|
121
|
-
renderOptions?.["failed-callback"]
|
|
122
|
-
);
|
|
123
|
-
if (failedCallback) {
|
|
124
|
-
callbacks.onFailed = () => {
|
|
125
|
-
failedCallback();
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
const resetCallback = getUserCallback(
|
|
129
|
-
"reset-callback",
|
|
130
|
-
element,
|
|
131
|
-
renderOptions?.["reset-callback"]
|
|
132
|
-
);
|
|
133
|
-
if (resetCallback) {
|
|
134
|
-
callbacks.onReset = () => {
|
|
135
|
-
removeProcaptchaResponse();
|
|
136
|
-
resetCallback();
|
|
137
|
-
};
|
|
138
|
-
}
|
|
52
|
+
const humanCallback = getUserCallback("callback", element, renderOptions?.callback);
|
|
53
|
+
if (humanCallback) callbacks.onHuman = (token) => {
|
|
54
|
+
handleOnHuman(token, element);
|
|
55
|
+
humanCallback(token);
|
|
56
|
+
};
|
|
57
|
+
const chalExpiredCallback = getUserCallback("chalexpired-callback", element, renderOptions?.["chalexpired-callback"]);
|
|
58
|
+
if (chalExpiredCallback) callbacks.onChallengeExpired = () => {
|
|
59
|
+
removeProcaptchaResponse();
|
|
60
|
+
chalExpiredCallback();
|
|
61
|
+
};
|
|
62
|
+
const expiredCallback = getUserCallback("expired-callback", element, renderOptions?.["expired-callback"]);
|
|
63
|
+
if (expiredCallback) callbacks.onExpired = () => {
|
|
64
|
+
removeProcaptchaResponse();
|
|
65
|
+
expiredCallback();
|
|
66
|
+
};
|
|
67
|
+
const errorCallback = getUserCallback("error-callback", element, renderOptions?.["error-callback"]);
|
|
68
|
+
if (errorCallback) callbacks.onError = (error) => {
|
|
69
|
+
removeProcaptchaResponse();
|
|
70
|
+
errorCallback(error);
|
|
71
|
+
};
|
|
72
|
+
const closeCallback = getUserCallback("close-callback", element, renderOptions?.["close-callback"]);
|
|
73
|
+
if (closeCallback) callbacks.onClose = () => {
|
|
74
|
+
closeCallback();
|
|
75
|
+
};
|
|
76
|
+
const openCallback = getUserCallback("open-callback", element, renderOptions?.["open-callback"]);
|
|
77
|
+
if (openCallback) callbacks.onOpen = () => {
|
|
78
|
+
openCallback();
|
|
79
|
+
};
|
|
80
|
+
const failedCallback = getUserCallback("failed-callback", element, renderOptions?.["failed-callback"]);
|
|
81
|
+
if (failedCallback) callbacks.onFailed = () => {
|
|
82
|
+
failedCallback();
|
|
83
|
+
};
|
|
84
|
+
const resetCallback = getUserCallback("reset-callback", element, renderOptions?.["reset-callback"]);
|
|
85
|
+
if (resetCallback) callbacks.onReset = () => {
|
|
86
|
+
removeProcaptchaResponse();
|
|
87
|
+
resetCallback();
|
|
88
|
+
};
|
|
139
89
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
export {
|
|
156
|
-
getDefaultCallbacks,
|
|
157
|
-
setUserCallbacks
|
|
90
|
+
var handleOnHuman = (token, element) => {
|
|
91
|
+
removeProcaptchaResponse();
|
|
92
|
+
if (element) {
|
|
93
|
+
const form = getParentForm(element);
|
|
94
|
+
if (!form) {
|
|
95
|
+
console.error("Parent form not found for the element:", element);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const input = document.createElement("input");
|
|
99
|
+
input.type = "hidden";
|
|
100
|
+
input.name = ApiParams.procaptchaResponse;
|
|
101
|
+
input.value = token;
|
|
102
|
+
form.appendChild(input);
|
|
103
|
+
}
|
|
158
104
|
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { getDefaultCallbacks, setUserCallbacks };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultCallbacks } from "./defaultCallbacks.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
//#region src/callbacks/defaultEvents.ts
|
|
3
|
+
var getDefaultEvents = (callbacks) => ({
|
|
4
|
+
...getDefaultCallbacks(void 0),
|
|
5
|
+
...callbacks
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getDefaultEvents };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|