@prosopo/procaptcha-frictionless 2.13.15 → 2.13.17
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 +4 -4
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +28 -0
- package/dist/ProcaptchaFrictionless.d.ts +1 -1
- package/dist/ProcaptchaFrictionless.d.ts.map +1 -1
- package/dist/ProcaptchaFrictionless.js +19 -6
- package/dist/ProcaptchaFrictionless.js.map +1 -1
- package/dist/cjs/ProcaptchaFrictionless.cjs +18 -5
- package/dist/cjs/sessionInvalidatedRecovery.cjs +21 -10
- package/dist/sessionInvalidatedRecovery.d.ts +1 -0
- package/dist/sessionInvalidatedRecovery.d.ts.map +1 -1
- package/dist/sessionInvalidatedRecovery.js +21 -11
- package/dist/sessionInvalidatedRecovery.js.map +1 -1
- package/dist/tests/sessionInvalidatedRecovery.test.js +19 -1
- package/dist/tests/sessionInvalidatedRecovery.test.js.map +1 -1
- package/package.json +11 -11
- package/src/ProcaptchaFrictionless.tsx +36 -1
- package/src/sessionInvalidatedRecovery.ts +21 -9
- package/src/tests/sessionInvalidatedRecovery.test.ts +24 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.17 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -59,9 +59,9 @@ computing gzip size...
|
|
|
59
59
|
dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
|
|
60
60
|
dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
|
|
61
61
|
dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
|
|
62
|
-
dist/cjs/sessionInvalidatedRecovery.cjs 2.
|
|
62
|
+
dist/cjs/sessionInvalidatedRecovery.cjs 2.35 kB │ gzip: 1.07 kB
|
|
63
63
|
dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
|
|
64
64
|
dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
|
|
65
|
-
dist/cjs/ProcaptchaFrictionless.cjs 7.
|
|
65
|
+
dist/cjs/ProcaptchaFrictionless.cjs 7.68 kB │ gzip: 2.17 kB
|
|
66
66
|
|
|
67
|
-
[32m✓ built in
|
|
67
|
+
[32m✓ built in 49ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.17 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
12:
|
|
5
|
+
12:32:47 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
@@ -25,47 +25,47 @@
|
|
|
25
25
|
* ../procaptcha-react/tsconfig.json
|
|
26
26
|
* tsconfig.json
|
|
27
27
|
|
|
28
|
-
12:
|
|
28
|
+
12:32:47 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'
|
|
29
29
|
|
|
30
|
-
12:
|
|
30
|
+
12:32:47 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
31
31
|
|
|
32
|
-
12:
|
|
32
|
+
12:32:47 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
33
33
|
|
|
34
|
-
12:
|
|
34
|
+
12:32:47 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'
|
|
35
35
|
|
|
36
|
-
12:
|
|
36
|
+
12:32:47 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
37
37
|
|
|
38
|
-
12:
|
|
38
|
+
12:32:47 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
39
39
|
|
|
40
|
-
12:
|
|
40
|
+
12:32:47 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/tests/loggerBrowser.unit.test.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
41
41
|
|
|
42
|
-
12:
|
|
42
|
+
12:32:47 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/objectUtils.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
43
43
|
|
|
44
|
-
12:
|
|
44
|
+
12:32:47 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
45
45
|
|
|
46
|
-
12:
|
|
46
|
+
12:32:47 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
47
47
|
|
|
48
|
-
12:
|
|
48
|
+
12:32:47 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'
|
|
49
49
|
|
|
50
|
-
12:
|
|
50
|
+
12:32:47 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/webComponent/createWidget.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
|
|
51
51
|
|
|
52
|
-
12:
|
|
52
|
+
12:32:47 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/pair/decode.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
53
53
|
|
|
54
|
-
12:
|
|
54
|
+
12:32:47 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
55
55
|
|
|
56
|
-
12:
|
|
56
|
+
12:32:47 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'
|
|
57
57
|
|
|
58
|
-
12:
|
|
58
|
+
12:32:47 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/index.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
|
|
59
59
|
|
|
60
|
-
12:
|
|
60
|
+
12:32:47 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/tests/managerHarness.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
|
|
61
61
|
|
|
62
|
-
12:
|
|
62
|
+
12:32:47 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/dataset.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
63
63
|
|
|
64
|
-
12:
|
|
64
|
+
12:32:47 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/ProsopoCaptchaApi.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
|
|
65
65
|
|
|
66
|
-
12:
|
|
66
|
+
12:32:47 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/index.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
|
|
67
67
|
|
|
68
|
-
12:
|
|
68
|
+
12:32:47 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
69
69
|
|
|
70
|
-
12:
|
|
70
|
+
12:32:47 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
71
71
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.17 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
6
|
+
> @prosopo/procaptcha-frictionless@2.13.17 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -64,9 +64,9 @@ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
|
64
64
|
dist/index.js 0.32 kB │ gzip: 0.15 kB
|
|
65
65
|
dist/detectorLoader.js 0.60 kB │ gzip: 0.39 kB
|
|
66
66
|
dist/frictionlessResultGuard.js 1.48 kB │ gzip: 0.80 kB
|
|
67
|
-
dist/sessionInvalidatedRecovery.js 2.
|
|
67
|
+
dist/sessionInvalidatedRecovery.js 2.26 kB │ gzip: 1.05 kB
|
|
68
68
|
dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
|
|
69
69
|
dist/customDetectBot.js 5.37 kB │ gzip: 1.67 kB
|
|
70
|
-
dist/ProcaptchaFrictionless.js
|
|
70
|
+
dist/ProcaptchaFrictionless.js 7.09 kB │ gzip: 2.12 kB
|
|
71
71
|
|
|
72
|
-
[32m✓ built in
|
|
72
|
+
[32m✓ built in 43ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.13.17
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [b30ad41]
|
|
7
|
+
- @prosopo/types@5.3.0
|
|
8
|
+
- @prosopo/api@4.0.15
|
|
9
|
+
- @prosopo/procaptcha-common@2.11.35
|
|
10
|
+
- @prosopo/procaptcha-pow@2.10.42
|
|
11
|
+
- @prosopo/procaptcha-puzzle@2.10.58
|
|
12
|
+
- @prosopo/procaptcha-react@2.9.115
|
|
13
|
+
|
|
14
|
+
## 2.13.16
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 68a9b41: chore(deps): bump react and @types/react
|
|
18
|
+
- ce5a3d7: Fix the reload button on the image captcha closing the challenge instead of loading a new one. Reload now asks the frictionless wrapper for a fresh session and re-mounts the widget so a new challenge opens straight away, and the checkbox click position is carried over to the replacement solve
|
|
19
|
+
- Updated dependencies [68a9b41]
|
|
20
|
+
- Updated dependencies [68a9b41]
|
|
21
|
+
- Updated dependencies [ce5a3d7]
|
|
22
|
+
- @prosopo/locale@3.3.1
|
|
23
|
+
- @prosopo/procaptcha-common@2.11.34
|
|
24
|
+
- @prosopo/procaptcha-pow@2.10.41
|
|
25
|
+
- @prosopo/procaptcha-puzzle@2.10.57
|
|
26
|
+
- @prosopo/procaptcha-react@2.9.114
|
|
27
|
+
- @prosopo/types@5.2.6
|
|
28
|
+
- @prosopo/api@4.0.14
|
|
29
|
+
- @prosopo/common@3.1.51
|
|
30
|
+
|
|
3
31
|
## 2.13.15
|
|
4
32
|
### Patch Changes
|
|
5
33
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ProcaptchaFrictionlessProps } from "@prosopo/types";
|
|
2
|
-
export declare const ProcaptchaFrictionless: ({ config, callbacks, restart, i18n, detectBot, container, }: ProcaptchaFrictionlessProps) => import("react
|
|
2
|
+
export declare const ProcaptchaFrictionless: ({ config, callbacks, restart, i18n, detectBot, container, }: ProcaptchaFrictionlessProps) => import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ProcaptchaFrictionless.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,2BAA2B,EAChC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,2BAA2B,EAChC,MAAM,gBAAgB,CAAC;AA4DxB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,gCA2T7B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import customDetectBot from "./customDetectBot.js";
|
|
2
2
|
import { evaluateFrictionlessResult } from "./frictionlessResultGuard.js";
|
|
3
|
-
import { consumeRetryMountProps, handleSessionInvalidated } from "./sessionInvalidatedRecovery.js";
|
|
3
|
+
import { consumeRetryMountProps, handleSessionInvalidated, normaliseRetryCoords } from "./sessionInvalidatedRecovery.js";
|
|
4
4
|
import { loadI18next } from "@prosopo/locale";
|
|
5
5
|
import { Checkbox, TestModeBanner, getDefaultEvents, isSecureBrowserContext, providerRetry } from "@prosopo/procaptcha-common";
|
|
6
6
|
import { CaptchaType, ProcaptchaConfigSchema } from "@prosopo/types";
|
|
@@ -33,6 +33,8 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
33
33
|
const events = getDefaultEvents(callbacks);
|
|
34
34
|
const pendingRetryCoordsRef = useRef(null);
|
|
35
35
|
const sessionInvalidatedFiredRef = useRef(false);
|
|
36
|
+
const mountCountRef = useRef(0);
|
|
37
|
+
const nextMountAutoStartRef = useRef(false);
|
|
36
38
|
useEffect(() => {
|
|
37
39
|
if (!config.language) return;
|
|
38
40
|
if (i18n) {
|
|
@@ -71,8 +73,18 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
71
73
|
resetState(0);
|
|
72
74
|
start();
|
|
73
75
|
};
|
|
74
|
-
const
|
|
76
|
+
const onReload = (x, y) => {
|
|
77
|
+
pendingRetryCoordsRef.current = normaliseRetryCoords(x, y);
|
|
78
|
+
nextMountAutoStartRef.current = true;
|
|
79
|
+
resetState(0);
|
|
80
|
+
start();
|
|
81
|
+
};
|
|
82
|
+
const forcedAutoStart = nextMountAutoStartRef.current;
|
|
83
|
+
nextMountAutoStartRef.current = false;
|
|
84
|
+
const { autoStart: resumedAutoStart, startCoords: retryStartCoords } = consumeRetryMountProps(pendingRetryCoordsRef, autoStart || forcedAutoStart);
|
|
75
85
|
const startCoords = escalationCoords ?? retryStartCoords;
|
|
86
|
+
mountCountRef.current += 1;
|
|
87
|
+
const mountKey = mountCountRef.current;
|
|
76
88
|
if (captchaType === CaptchaType.image) {
|
|
77
89
|
const Procaptcha = await ProcaptchaLoader();
|
|
78
90
|
setComponentToRender(/* @__PURE__ */ jsx(Procaptcha, {
|
|
@@ -82,8 +94,9 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
82
94
|
i18n,
|
|
83
95
|
autoStart: resumedAutoStart,
|
|
84
96
|
startCoords,
|
|
85
|
-
onSessionInvalidated
|
|
86
|
-
|
|
97
|
+
onSessionInvalidated,
|
|
98
|
+
onReload
|
|
99
|
+
}, mountKey));
|
|
87
100
|
} else if (captchaType === CaptchaType.puzzle) {
|
|
88
101
|
const ProcaptchaPuzzle = await ProcaptchaPuzzleLoader();
|
|
89
102
|
setComponentToRender(/* @__PURE__ */ jsx(ProcaptchaPuzzle, {
|
|
@@ -94,7 +107,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
94
107
|
autoStart: resumedAutoStart,
|
|
95
108
|
startCoords,
|
|
96
109
|
onSessionInvalidated
|
|
97
|
-
}));
|
|
110
|
+
}, mountKey));
|
|
98
111
|
} else {
|
|
99
112
|
const ProcaptchaPow = await ProcaptchaPowLoader();
|
|
100
113
|
setComponentToRender(/* @__PURE__ */ jsx(ProcaptchaPow, {
|
|
@@ -106,7 +119,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
106
119
|
autoStart: resumedAutoStart,
|
|
107
120
|
startCoords,
|
|
108
121
|
onSessionInvalidated
|
|
109
|
-
}));
|
|
122
|
+
}, mountKey));
|
|
110
123
|
}
|
|
111
124
|
};
|
|
112
125
|
const start = async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,WAAW,EAGX,sBAAsB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAEN,sBAAsB,EACtB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,WAAW,EAGX,sBAAsB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,U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AAG,QAAQ,CAAC,OAAO;gBACnB,OAAO,EAAE,KAAK;aACd,CAAC;QACH,CAAC,EACD,KAAK,EACL,UAAU,EACV,QAAQ,CAAC,OAAO,CAAC,YAAY,EAC7B,CAAC,CACD,CAAC,OAAO,CAAC,GAAG,EAAE;YACd,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,EAAE,CAAC;gBACxC,iBAAiB,EAAE,CAAC;gBACpB,uBAAuB,EAAE,CAAC;YAC3B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAmBF,MAAM,gBAAgB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAErD,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,IACpE,MAAM,CAAC,IAAI,IAAI,EAChB,EAAE,CAAC;QACH,IAAI,gBAAgB,CAAC,OAAO,KAAK,GAAG;YAAE,OAAO;QAC7C,gBAAgB,CAAC,OAAO,GAAG,GAAG,CAAC;QAC/B,KAAK,KAAK,EAAE,CAAC;IACd,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5D,OAAO,CACN,8BACC,KAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,GAAI,EACzD,iBAAiB,IAChB,CACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -33,6 +33,8 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
33
33
|
const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
|
|
34
34
|
const pendingRetryCoordsRef = (0, react.useRef)(null);
|
|
35
35
|
const sessionInvalidatedFiredRef = (0, react.useRef)(false);
|
|
36
|
+
const mountCountRef = (0, react.useRef)(0);
|
|
37
|
+
const nextMountAutoStartRef = (0, react.useRef)(false);
|
|
36
38
|
(0, react.useEffect)(() => {
|
|
37
39
|
if (!config.language) return;
|
|
38
40
|
if (i18n) {
|
|
@@ -71,8 +73,18 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
71
73
|
resetState(0);
|
|
72
74
|
start();
|
|
73
75
|
};
|
|
74
|
-
const
|
|
76
|
+
const onReload = (x, y) => {
|
|
77
|
+
pendingRetryCoordsRef.current = require_sessionInvalidatedRecovery.normaliseRetryCoords(x, y);
|
|
78
|
+
nextMountAutoStartRef.current = true;
|
|
79
|
+
resetState(0);
|
|
80
|
+
start();
|
|
81
|
+
};
|
|
82
|
+
const forcedAutoStart = nextMountAutoStartRef.current;
|
|
83
|
+
nextMountAutoStartRef.current = false;
|
|
84
|
+
const { autoStart: resumedAutoStart, startCoords: retryStartCoords } = require_sessionInvalidatedRecovery.consumeRetryMountProps(pendingRetryCoordsRef, autoStart || forcedAutoStart);
|
|
75
85
|
const startCoords = escalationCoords ?? retryStartCoords;
|
|
86
|
+
mountCountRef.current += 1;
|
|
87
|
+
const mountKey = mountCountRef.current;
|
|
76
88
|
if (captchaType === _prosopo_types.CaptchaType.image) {
|
|
77
89
|
const Procaptcha = await ProcaptchaLoader();
|
|
78
90
|
setComponentToRender(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Procaptcha, {
|
|
@@ -82,8 +94,9 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
82
94
|
i18n,
|
|
83
95
|
autoStart: resumedAutoStart,
|
|
84
96
|
startCoords,
|
|
85
|
-
onSessionInvalidated
|
|
86
|
-
|
|
97
|
+
onSessionInvalidated,
|
|
98
|
+
onReload
|
|
99
|
+
}, mountKey));
|
|
87
100
|
} else if (captchaType === _prosopo_types.CaptchaType.puzzle) {
|
|
88
101
|
const ProcaptchaPuzzle = await ProcaptchaPuzzleLoader();
|
|
89
102
|
setComponentToRender(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProcaptchaPuzzle, {
|
|
@@ -94,7 +107,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
94
107
|
autoStart: resumedAutoStart,
|
|
95
108
|
startCoords,
|
|
96
109
|
onSessionInvalidated
|
|
97
|
-
}));
|
|
110
|
+
}, mountKey));
|
|
98
111
|
} else {
|
|
99
112
|
const ProcaptchaPow = await ProcaptchaPowLoader();
|
|
100
113
|
setComponentToRender(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProcaptchaPow, {
|
|
@@ -106,7 +119,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
106
119
|
autoStart: resumedAutoStart,
|
|
107
120
|
startCoords,
|
|
108
121
|
onSessionInvalidated
|
|
109
|
-
}));
|
|
122
|
+
}, mountKey));
|
|
110
123
|
}
|
|
111
124
|
};
|
|
112
125
|
const start = async () => {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
//#region src/sessionInvalidatedRecovery.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the passed refs to record the one-shot fire + pending coords.
|
|
3
|
+
* The checkbox click position a re-mounted widget should start from, or
|
|
4
|
+
* `null` when there isn't a real one to carry over.
|
|
6
5
|
*
|
|
7
|
-
* -
|
|
8
|
-
* persistently broken session doesn't loop.
|
|
9
|
-
* - Coords are recorded only for a real trusted checkbox click. A partial
|
|
6
|
+
* - Coords are kept only for a real trusted checkbox click. A partial
|
|
10
7
|
* pair (only x or only y numeric) is treated as "no coords" so we
|
|
11
8
|
* never accidentally embed `NaN` into the solution salt.
|
|
12
9
|
* - `(0, 0)` is treated as "no coords" too — that's what the widgets
|
|
@@ -16,13 +13,26 @@
|
|
|
16
13
|
* is identical; we discard the pair here so future readers can tell
|
|
17
14
|
* the two apart.
|
|
18
15
|
*/
|
|
16
|
+
var normaliseRetryCoords = (x, y) => {
|
|
17
|
+
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
18
|
+
if (x === 0 && y === 0) return null;
|
|
19
|
+
return {
|
|
20
|
+
x,
|
|
21
|
+
y
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Semantics of the outer recovery handler. Returns whether the caller
|
|
26
|
+
* should proceed to re-run the frictionless flow (`start()`), and mutates
|
|
27
|
+
* the passed refs to record the one-shot fire + pending coords.
|
|
28
|
+
*
|
|
29
|
+
* Second calls are ignored (one-shot per outer widget lifetime) so a
|
|
30
|
+
* persistently broken session doesn't loop.
|
|
31
|
+
*/
|
|
19
32
|
var handleSessionInvalidated = (x, y, firedRef, pendingCoordsRef) => {
|
|
20
33
|
if (firedRef.current) return { shouldRestart: false };
|
|
21
34
|
firedRef.current = true;
|
|
22
|
-
pendingCoordsRef.current =
|
|
23
|
-
x,
|
|
24
|
-
y
|
|
25
|
-
} : null;
|
|
35
|
+
pendingCoordsRef.current = normaliseRetryCoords(x, y);
|
|
26
36
|
return { shouldRestart: true };
|
|
27
37
|
};
|
|
28
38
|
/**
|
|
@@ -45,3 +55,4 @@ var consumeRetryMountProps = (pendingCoordsRef, escalationAutoStart) => {
|
|
|
45
55
|
//#endregion
|
|
46
56
|
exports.consumeRetryMountProps = consumeRetryMountProps;
|
|
47
57
|
exports.handleSessionInvalidated = handleSessionInvalidated;
|
|
58
|
+
exports.normaliseRetryCoords = normaliseRetryCoords;
|
|
@@ -5,6 +5,7 @@ export type RetryCoords = {
|
|
|
5
5
|
export type MutableRef<T> = {
|
|
6
6
|
current: T;
|
|
7
7
|
};
|
|
8
|
+
export declare const normaliseRetryCoords: (x: number | undefined, y: number | undefined) => RetryCoords | null;
|
|
8
9
|
export declare const handleSessionInvalidated: (x: number | undefined, y: number | undefined, firedRef: MutableRef<boolean>, pendingCoordsRef: MutableRef<RetryCoords | null>) => {
|
|
9
10
|
shouldRestart: boolean;
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInvalidatedRecovery.d.ts","sourceRoot":"","sources":["../src/sessionInvalidatedRecovery.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAMnD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"sessionInvalidatedRecovery.d.ts","sourceRoot":"","sources":["../src/sessionInvalidatedRecovery.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAMnD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AAgB3C,eAAO,MAAM,oBAAoB,MAC7B,MAAM,GAAG,SAAS,KAClB,MAAM,GAAG,SAAS,KACnB,WAAW,GAAG,IAIhB,CAAC;AAUF,eAAO,MAAM,wBAAwB,MACjC,MAAM,GAAG,SAAS,KAClB,MAAM,GAAG,SAAS,YACX,UAAU,CAAC,OAAO,CAAC,oBACX,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,KAC9C;IAAE,aAAa,EAAE,OAAO,CAAA;CAK1B,CAAC;AAWF,eAAO,MAAM,sBAAsB,qBAChB,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,uBAC3B,OAAO,KAC1B;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAA;CAO5D,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
//#region src/sessionInvalidatedRecovery.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the passed refs to record the one-shot fire + pending coords.
|
|
3
|
+
* The checkbox click position a re-mounted widget should start from, or
|
|
4
|
+
* `null` when there isn't a real one to carry over.
|
|
6
5
|
*
|
|
7
|
-
* -
|
|
8
|
-
* persistently broken session doesn't loop.
|
|
9
|
-
* - Coords are recorded only for a real trusted checkbox click. A partial
|
|
6
|
+
* - Coords are kept only for a real trusted checkbox click. A partial
|
|
10
7
|
* pair (only x or only y numeric) is treated as "no coords" so we
|
|
11
8
|
* never accidentally embed `NaN` into the solution salt.
|
|
12
9
|
* - `(0, 0)` is treated as "no coords" too — that's what the widgets
|
|
@@ -16,13 +13,26 @@
|
|
|
16
13
|
* is identical; we discard the pair here so future readers can tell
|
|
17
14
|
* the two apart.
|
|
18
15
|
*/
|
|
16
|
+
var normaliseRetryCoords = (x, y) => {
|
|
17
|
+
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
18
|
+
if (x === 0 && y === 0) return null;
|
|
19
|
+
return {
|
|
20
|
+
x,
|
|
21
|
+
y
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Semantics of the outer recovery handler. Returns whether the caller
|
|
26
|
+
* should proceed to re-run the frictionless flow (`start()`), and mutates
|
|
27
|
+
* the passed refs to record the one-shot fire + pending coords.
|
|
28
|
+
*
|
|
29
|
+
* Second calls are ignored (one-shot per outer widget lifetime) so a
|
|
30
|
+
* persistently broken session doesn't loop.
|
|
31
|
+
*/
|
|
19
32
|
var handleSessionInvalidated = (x, y, firedRef, pendingCoordsRef) => {
|
|
20
33
|
if (firedRef.current) return { shouldRestart: false };
|
|
21
34
|
firedRef.current = true;
|
|
22
|
-
pendingCoordsRef.current =
|
|
23
|
-
x,
|
|
24
|
-
y
|
|
25
|
-
} : null;
|
|
35
|
+
pendingCoordsRef.current = normaliseRetryCoords(x, y);
|
|
26
36
|
return { shouldRestart: true };
|
|
27
37
|
};
|
|
28
38
|
/**
|
|
@@ -43,4 +53,4 @@ var consumeRetryMountProps = (pendingCoordsRef, escalationAutoStart) => {
|
|
|
43
53
|
};
|
|
44
54
|
};
|
|
45
55
|
//#endregion
|
|
46
|
-
export { consumeRetryMountProps, handleSessionInvalidated };
|
|
56
|
+
export { consumeRetryMountProps, handleSessionInvalidated, normaliseRetryCoords };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInvalidatedRecovery.js","sourceRoot":"","sources":["../src/sessionInvalidatedRecovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sessionInvalidatedRecovery.js","sourceRoot":"","sources":["../src/sessionInvalidatedRecovery.ts"],"names":[],"mappings":"AAyCA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CACnC,CAAqB,EACrB,CAAqB,EACA,EAAE;IACvB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACjB,CAAC,CAAC;AAUF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACvC,CAAqB,EACrB,CAAqB,EACrB,QAA6B,EAC7B,gBAAgD,EACnB,EAAE;IAC/B,IAAI,QAAQ,CAAC,OAAO;QAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACtD,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,gBAAgB,CAAC,OAAO,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAChC,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,gBAAgD,EAChD,mBAA4B,EACmC,EAAE;IACjE,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,IAAI,SAAS,CAAC;IAC1D,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;IAChC,OAAO;QACN,SAAS,EAAE,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;QACtD,WAAW;KACX,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { consumeRetryMountProps, handleSessionInvalidated, } from "../sessionInvalidatedRecovery.js";
|
|
2
|
+
import { consumeRetryMountProps, handleSessionInvalidated, normaliseRetryCoords, } from "../sessionInvalidatedRecovery.js";
|
|
3
3
|
const ref = (initial) => ({ current: initial });
|
|
4
4
|
describe("handleSessionInvalidated", () => {
|
|
5
5
|
it("records both coords and signals a restart on the first fire", () => {
|
|
@@ -71,4 +71,22 @@ describe("consumeRetryMountProps", () => {
|
|
|
71
71
|
expect(mount).toEqual({ autoStart: false, startCoords: undefined });
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
|
+
describe("normaliseRetryCoords", () => {
|
|
75
|
+
it("keeps a real click", () => {
|
|
76
|
+
expect(normaliseRetryCoords(120, 340)).toEqual({ x: 120, y: 340 });
|
|
77
|
+
});
|
|
78
|
+
it("keeps a click that sits on one axis", () => {
|
|
79
|
+
expect(normaliseRetryCoords(0, 340)).toEqual({ x: 0, y: 340 });
|
|
80
|
+
});
|
|
81
|
+
it("drops (0, 0) — the autoStart / untrusted-event default, not a click", () => {
|
|
82
|
+
expect(normaliseRetryCoords(0, 0)).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
it("drops a half-pair rather than letting NaN reach the salt", () => {
|
|
85
|
+
expect(normaliseRetryCoords(120, undefined)).toBeNull();
|
|
86
|
+
expect(normaliseRetryCoords(undefined, 340)).toBeNull();
|
|
87
|
+
});
|
|
88
|
+
it("drops a missing pair", () => {
|
|
89
|
+
expect(normaliseRetryCoords(undefined, undefined)).toBeNull();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
74
92
|
//# sourceMappingURL=sessionInvalidatedRecovery.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionInvalidatedRecovery.test.js","sourceRoot":"","sources":["../../src/tests/sessionInvalidatedRecovery.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAGN,sBAAsB,EACtB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"sessionInvalidatedRecovery.test.js","sourceRoot":"","sources":["../../src/tests/sessionInvalidatedRecovery.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAGN,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,GACpB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,GAAG,GAAG,CAAI,OAAU,EAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AAErE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACtE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,SAAS,GAAG,GAAG,CAAqB,IAAI,CAAC,CAAC;QAEhD,MAAM,MAAM,GAAG,wBAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEvE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAA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ist/index.js",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"browserslist": ["> 0.5%, last 2 versions, not dead"],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@prosopo/api": "4.0.
|
|
34
|
-
"@prosopo/common": "3.1.
|
|
35
|
-
"@prosopo/locale": "3.3.
|
|
36
|
-
"@prosopo/procaptcha-common": "2.11.
|
|
37
|
-
"@prosopo/procaptcha-pow": "2.10.
|
|
38
|
-
"@prosopo/procaptcha-puzzle": "2.10.
|
|
39
|
-
"@prosopo/procaptcha-react": "2.9.
|
|
40
|
-
"@prosopo/types": "5.
|
|
33
|
+
"@prosopo/api": "4.0.15",
|
|
34
|
+
"@prosopo/common": "3.1.51",
|
|
35
|
+
"@prosopo/locale": "3.3.1",
|
|
36
|
+
"@prosopo/procaptcha-common": "2.11.35",
|
|
37
|
+
"@prosopo/procaptcha-pow": "2.10.42",
|
|
38
|
+
"@prosopo/procaptcha-puzzle": "2.10.58",
|
|
39
|
+
"@prosopo/procaptcha-react": "2.9.115",
|
|
40
|
+
"@prosopo/types": "5.3.0",
|
|
41
41
|
"@prosopo/widget-skeleton": "2.8.6",
|
|
42
42
|
"dotenv": "16.4.5",
|
|
43
|
-
"react": "
|
|
43
|
+
"react": "19.2.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@prosopo/config": "3.3.
|
|
46
|
+
"@prosopo/config": "3.3.12",
|
|
47
47
|
"@types/node": "22.10.2",
|
|
48
48
|
"@vitest/coverage-v8": "4.1.10",
|
|
49
49
|
"concurrently": "9.0.1",
|