@prosopo/procaptcha-frictionless 2.15.0 → 2.15.1

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.
Files changed (30) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +9 -9
  2. package/.turbo/turbo-build$colon$tsc.log +24 -24
  3. package/.turbo/turbo-build.log +5 -5
  4. package/CHANGELOG.md +31 -0
  5. package/dist/ProcaptchaFrictionless.d.ts.map +1 -1
  6. package/dist/ProcaptchaFrictionless.js +17 -7
  7. package/dist/ProcaptchaFrictionless.js.map +1 -1
  8. package/dist/cjs/ProcaptchaFrictionless.cjs +17 -7
  9. package/dist/cjs/sessionInvalidatedRecovery.cjs +16 -9
  10. package/dist/sessionInvalidatedRecovery.d.ts +3 -1
  11. package/dist/sessionInvalidatedRecovery.d.ts.map +1 -1
  12. package/dist/sessionInvalidatedRecovery.js +16 -9
  13. package/dist/sessionInvalidatedRecovery.js.map +1 -1
  14. package/dist/tests/escalationHandoff.integration.test.d.ts +5 -0
  15. package/dist/tests/escalationHandoff.integration.test.d.ts.map +1 -0
  16. package/dist/tests/escalationHandoff.integration.test.js +216 -0
  17. package/dist/tests/escalationHandoff.integration.test.js.map +1 -0
  18. package/dist/tests/sessionInvalidatedRecovery.test.js +41 -21
  19. package/dist/tests/sessionInvalidatedRecovery.test.js.map +1 -1
  20. package/dist/tests/sessionInvalidatedRemint.test.d.ts +5 -0
  21. package/dist/tests/sessionInvalidatedRemint.test.d.ts.map +1 -0
  22. package/dist/tests/sessionInvalidatedRemint.test.js +150 -0
  23. package/dist/tests/sessionInvalidatedRemint.test.js.map +1 -0
  24. package/package.json +2 -2
  25. package/src/ProcaptchaFrictionless.tsx +58 -15
  26. package/src/sessionInvalidatedRecovery.ts +30 -10
  27. package/src/tests/escalationHandoff.integration.test.tsx +354 -0
  28. package/src/tests/sessionInvalidatedRecovery.test.ts +49 -21
  29. package/src/tests/sessionInvalidatedRemint.test.tsx +245 -0
  30. package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build:cjs
2
+ > @prosopo/procaptcha-frictionless@2.15.1 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -56,12 +56,12 @@ Bundle build started
56
56
  ✓ 8 modules transformed.
57
57
  rendering chunks...
58
58
  computing gzip size...
59
- dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
60
- dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
61
- dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
62
- dist/cjs/sessionInvalidatedRecovery.cjs 2.35 kB │ gzip: 1.07 kB
63
- dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
64
- dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
65
- dist/cjs/ProcaptchaFrictionless.cjs 9.55 kB │ gzip: 2.59 kB
59
+ dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
60
+ dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
61
+ dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
62
+ dist/cjs/sessionInvalidatedRecovery.cjs 2.50 kB │ gzip: 1.14 kB
63
+ dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
64
+ dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
65
+ dist/cjs/ProcaptchaFrictionless.cjs 10.03 kB │ gzip: 2.69 kB
66
66
 
67
- ✓ built in 48ms
67
+ ✓ built in 32ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build:tsc
2
+ > @prosopo/procaptcha-frictionless@2.15.1 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 1:15:48 PM - Projects in this build:
5
+ 8:02:20 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
- 1:15:48 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'
28
+ 8:02:20 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/vite/NodejsPolarsNativeFilePlugin.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
29
29
 
30
- 1:15:48 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
30
+ 8:02:20 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
- 1:15:48 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
32
+ 8:02:20 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
- 1:15:48 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'
34
+ 8:02:20 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
- 1:15:48 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'
36
+ 8:02:20 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
- 1:15:48 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/tests/apiHarness.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
+ 8:02:20 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
- 1:15:48 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
40
+ 8:02:20 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
41
41
 
42
- 1:15:48 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/utils/batches.ts' is older than output '../common/tsconfig.tsbuildinfo'
42
+ 8:02:20 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
43
43
 
44
- 1:15:48 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
44
+ 8:02:20 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
- 1:15:48 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
46
+ 8:02:20 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
- 1:15:48 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'
48
+ 8:02:20 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'
49
49
 
50
- 1:15:48 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'
50
+ 8:02:20 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
- 1:15:48 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
52
+ 8:02:20 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
53
53
 
54
- 1:15:48 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
54
+ 8:02:20 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/index.ts' is older than output '../account/tsconfig.tsbuildinfo'
55
55
 
56
- 1:15:48 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/challengeSurfaceRender.unit.test.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
56
+ 8:02:20 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/clientMetaData.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
57
57
 
58
- 1:15:48 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/managerHarness.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
58
+ 8:02:20 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/managerHarness.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
59
59
 
60
- 1:15:48 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
60
+ 8:02:20 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
61
61
 
62
- 1:15:48 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'
62
+ 8:02:20 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/index.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
63
63
 
64
- 1:15:48 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
64
+ 8:02:20 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
65
65
 
66
- 1:15:49 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'
66
+ 8:02:20 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.tsx' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
67
67
 
68
- 1:15:49 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
68
+ 8:02:20 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
69
69
 
70
- 1:15:49 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
70
+ 8:02:20 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
71
71
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build
2
+ > @prosopo/procaptcha-frictionless@2.15.1 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-frictionless@2.15.0 build:cross-env
6
+ > @prosopo/procaptcha-frictionless@2.15.1 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.26 kB │ gzip: 1.05 kB
67
+ dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 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 8.89 kB │ gzip: 2.55 kB
70
+ dist/ProcaptchaFrictionless.js 9.36 kB │ gzip: 2.65 kB
71
71
 
72
- ✓ built in 61ms
72
+ ✓ built in 28ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.15.1
4
+ ### Patch Changes
5
+
6
+ - 46cca63: Make the post-PoW escalation handoff idempotent.
7
+
8
+ Follow-up to the `CAPTCHA.NO_SESSION_FOUND` recovery fix: this is the other producer of the duplicate `/captcha/image` POST that fix had to recover from.
9
+
10
+ Production, 2026-09-07, the same affected user:
11
+
12
+ ```
13
+ 11:27:49.910 POST /pow/solution 200 escalation envelope returned
14
+ 11:27:50.263 POST /captcha/image 200 escalation session issued
15
+ 11:27:55.030 POST /captcha/image 400 CAPTCHA.NO_SESSION_FOUND, same session
16
+ ```
17
+
18
+ The provider mints exactly one escalation session per PoW solution and consumes it on the first challenge fetch. The PoW manager fires `onEscalate` from inside its `providerRetry`-wrapped `submit()`, so a throw anywhere after the handoff re-runs `submit()` and escalates a second time on the same envelope — mounting a second image widget against a session the first one already spent. `onEscalate` now ignores a repeat handoff for a sessionId it has already mounted; a genuinely new escalation session is still followed.
19
+
20
+ Adds `escalationHandoff.integration.test.tsx`, which drives the real `ProcaptchaFrictionless` wrapper into the real image widget and its real `Manager` with only the network stubbed. The stub enforces the provider's one-shot session contract and returns the `NO_SESSION_FOUND` envelope in the response body rather than throwing — `HttpClientBase` only throws when a failure isn't JSON, so a 400 from the provider arrives as `challenge.error`, which is what the widget's recovery path keys off.
21
+ - 9e06d72: Stop `CAPTCHA.NO_SESSION_FOUND` leaving the widget on a dead checkbox.
22
+
23
+ Users reported a checkbox reading "No session found" that never recovered, usually after pressing the image-challenge reload button. Provider logs show the shape clearly: `POST /captcha/image` returns 200 and issues a challenge, then 2-6 seconds later the *same* sessionId is POSTed again and the provider answers 400 `CAPTCHA.NO_SESSION_FOUND` — `checkAndRemoveSession` consumed the session when it issued the first challenge, so a second challenge fetch on that id can never succeed.
24
+
25
+ Three defects combined to turn that into a permanent dead end.
26
+
27
+ - **The manager re-sent a sessionId it had already spent.** `defaultState()` doesn't clear `sessionId` and `buildUpdateState` skips `undefined`, so a stale id survives `resetState()` and any path that re-enters `start()` re-sends it. `Manager` now remembers the id it exchanged for a challenge and, rather than making a request it knows the provider will reject, routes straight to the `CAPTCHA.NO_SESSION_FOUND` state the wrapper already listens for.
28
+
29
+ - **Recovery was one-shot per outer widget lifetime and had no terminal branch.** `ProcaptchaWidget` always takes the `onSessionInvalidated` branch and returns before its own `frictionlessState.restart()` fallback, and its guard ref is fresh on every re-mount because the wrapper bumps the mount key. So once the wrapper's one-shot was spent, the second failure was handled by nobody: no re-mint, no restart, no message — just a stuck checkbox. `handleSessionInvalidated` is now a bounded counter (`MAX_SESSION_INVALIDATED_RETRIES`) rather than a boolean, it reports `exhausted` to the caller, a reload press clears it (a reload mints a genuinely new session, so it shouldn't spend the budget for the old one), and exhaustion falls over visibly through `fallOverWithStyle` — which schedules the existing 10-second full restart, so there is always a way back.
30
+
31
+ - **`resetState(0)` never reset anything.** `0 || stateRef.current.attemptCount` kept the old count, so `attemptCount` accumulated across every re-mint and `start()`'s own `attemptCount >= 5` fall-over fired after five *cumulative* runs in a widget lifetime. Five successful reload presses were enough to drop the user onto the error placeholder. Now `??`, so callers passing literal `0` get the reset they asked for.
32
+ - @prosopo/procaptcha-react@2.10.1
33
+
3
34
  ## 2.15.0
4
35
  ### Minor Changes
5
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAMN,KAAK,2BAA2B,EAGhC,MAAM,gBAAgB,CAAC;AAoExB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,gCA2X7B,CAAC"}
1
+ {"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAMN,KAAK,2BAA2B,EAGhC,MAAM,gBAAgB,CAAC;AAsExB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,gCAoa7B,CAAC"}
@@ -8,6 +8,7 @@ import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
8
8
  import { useEffect, useRef, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  //#region src/ProcaptchaFrictionless.tsx
11
+ var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
11
12
  var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).Procaptcha;
12
13
  var ProcaptchaPuzzleLoader = async () => (await import("@prosopo/procaptcha-puzzle")).ProcaptchaPuzzle;
13
14
  var ProcaptchaPowLoader = async () => (await import("@prosopo/procaptcha-pow")).ProcaptchaPow;
@@ -28,13 +29,14 @@ var renderPlaceholder = (theme, mode, errorMessage, isTranslationLoaded, transla
28
29
  };
29
30
  var defaultLoadingState = (attemptCount) => ({
30
31
  loading: false,
31
- attemptCount: attemptCount || 0
32
+ attemptCount
32
33
  });
33
34
  var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = customDetectBot, container }) => {
34
35
  const stateRef = useRef(defaultLoadingState(0));
35
36
  const events = getDefaultEvents(callbacks);
36
37
  const pendingRetryCoordsRef = useRef(null);
37
- const sessionInvalidatedFiredRef = useRef(false);
38
+ const sessionInvalidatedAttemptsRef = useRef(0);
39
+ const escalatedSessionIdsRef = useRef(/* @__PURE__ */ new Set());
38
40
  const mountCountRef = useRef(0);
39
41
  const nextMountAutoStartRef = useRef(false);
40
42
  const manualStart = config.startMode === StartModeEnum.manual;
@@ -50,7 +52,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
50
52
  }, [i18n, config.language]);
51
53
  const [componentToRender, setComponentToRender] = useState(renderPlaceholder(config.theme, config.mode, stateRef.current.errorMessage, i18n.isInitialized, i18n.t, !manualStart, manualStart ? (event) => manualCheckboxHandlerRef.current(event) : void 0));
52
54
  const resetState = (attemptCount) => {
53
- stateRef.current = defaultLoadingState(attemptCount || stateRef.current.attemptCount);
55
+ stateRef.current = defaultLoadingState(attemptCount ?? stateRef.current.attemptCount);
54
56
  };
55
57
  const fallOverWithStyle = (errorMessage, errorKey) => {
56
58
  if (errorKey === "CAPTCHA.NO_SESSION_FOUND") setTimeout(() => {
@@ -67,20 +69,28 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
67
69
  };
68
70
  const renderForCaptchaType = async (captchaType, frictionlessState, autoStart = false, escalationCoords) => {
69
71
  const onEscalate = (next, newSessionId, coords) => {
72
+ if (escalatedSessionIdsRef.current.has(newSessionId)) return;
73
+ escalatedSessionIdsRef.current.add(newSessionId);
70
74
  renderForCaptchaType(next, {
71
75
  ...frictionlessState,
72
76
  sessionId: newSessionId
73
77
  }, true, coords);
74
78
  };
75
79
  const onSessionInvalidated = (x, y) => {
76
- const { shouldRestart } = handleSessionInvalidated(x, y, sessionInvalidatedFiredRef, pendingRetryCoordsRef);
77
- if (!shouldRestart) return;
78
- resetState(0);
79
- start();
80
+ const { shouldRestart } = handleSessionInvalidated(x, y, sessionInvalidatedAttemptsRef, pendingRetryCoordsRef);
81
+ if (shouldRestart) {
82
+ resetState(0);
83
+ start();
84
+ return;
85
+ }
86
+ const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
87
+ events.onError(new Error(message));
88
+ fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
80
89
  };
81
90
  const onReload = (x, y) => {
82
91
  pendingRetryCoordsRef.current = normaliseRetryCoords(x, y);
83
92
  nextMountAutoStartRef.current = true;
93
+ sessionInvalidatedAttemptsRef.current = 0;
84
94
  resetState(0);
85
95
  start();
86
96
  };
@@ -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,EACtB,sBAAsB,EAGtB,aAAa,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEjE,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,EACxB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE,CACnC,CAAC,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC,UAAU,CAAC;AACxD,MAAM,sBAAsB,GAAG,KAAK,IAAI,EAAE,CACzC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,C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c,CAAC,CAAC;QACpE,OAAO,GAAG,EAAE;YACX,QAAQ,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;YACnE,QAAQ,CAAC,mBAAmB,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC;QACxE,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAmB7B,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,IAAI,WAAW;YAAE,OAAO;QACxB,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"}
@@ -8,6 +8,7 @@ let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
8
8
  let react = require("react");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  //#region src/ProcaptchaFrictionless.tsx
11
+ var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
11
12
  var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).Procaptcha;
12
13
  var ProcaptchaPuzzleLoader = async () => (await import("@prosopo/procaptcha-puzzle")).ProcaptchaPuzzle;
13
14
  var ProcaptchaPowLoader = async () => (await import("@prosopo/procaptcha-pow")).ProcaptchaPow;
@@ -28,13 +29,14 @@ var renderPlaceholder = (theme, mode, errorMessage, isTranslationLoaded, transla
28
29
  };
29
30
  var defaultLoadingState = (attemptCount) => ({
30
31
  loading: false,
31
- attemptCount: attemptCount || 0
32
+ attemptCount
32
33
  });
33
34
  var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = require_customDetectBot.default, container }) => {
34
35
  const stateRef = (0, react.useRef)(defaultLoadingState(0));
35
36
  const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
36
37
  const pendingRetryCoordsRef = (0, react.useRef)(null);
37
- const sessionInvalidatedFiredRef = (0, react.useRef)(false);
38
+ const sessionInvalidatedAttemptsRef = (0, react.useRef)(0);
39
+ const escalatedSessionIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
38
40
  const mountCountRef = (0, react.useRef)(0);
39
41
  const nextMountAutoStartRef = (0, react.useRef)(false);
40
42
  const manualStart = config.startMode === _prosopo_types.StartModeEnum.manual;
@@ -50,7 +52,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
50
52
  }, [i18n, config.language]);
51
53
  const [componentToRender, setComponentToRender] = (0, react.useState)(renderPlaceholder(config.theme, config.mode, stateRef.current.errorMessage, i18n.isInitialized, i18n.t, !manualStart, manualStart ? (event) => manualCheckboxHandlerRef.current(event) : void 0));
52
54
  const resetState = (attemptCount) => {
53
- stateRef.current = defaultLoadingState(attemptCount || stateRef.current.attemptCount);
55
+ stateRef.current = defaultLoadingState(attemptCount ?? stateRef.current.attemptCount);
54
56
  };
55
57
  const fallOverWithStyle = (errorMessage, errorKey) => {
56
58
  if (errorKey === "CAPTCHA.NO_SESSION_FOUND") setTimeout(() => {
@@ -67,20 +69,28 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
67
69
  };
68
70
  const renderForCaptchaType = async (captchaType, frictionlessState, autoStart = false, escalationCoords) => {
69
71
  const onEscalate = (next, newSessionId, coords) => {
72
+ if (escalatedSessionIdsRef.current.has(newSessionId)) return;
73
+ escalatedSessionIdsRef.current.add(newSessionId);
70
74
  renderForCaptchaType(next, {
71
75
  ...frictionlessState,
72
76
  sessionId: newSessionId
73
77
  }, true, coords);
74
78
  };
75
79
  const onSessionInvalidated = (x, y) => {
76
- const { shouldRestart } = require_sessionInvalidatedRecovery.handleSessionInvalidated(x, y, sessionInvalidatedFiredRef, pendingRetryCoordsRef);
77
- if (!shouldRestart) return;
78
- resetState(0);
79
- start();
80
+ const { shouldRestart } = require_sessionInvalidatedRecovery.handleSessionInvalidated(x, y, sessionInvalidatedAttemptsRef, pendingRetryCoordsRef);
81
+ if (shouldRestart) {
82
+ resetState(0);
83
+ start();
84
+ return;
85
+ }
86
+ const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
87
+ events.onError(new Error(message));
88
+ fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
80
89
  };
81
90
  const onReload = (x, y) => {
82
91
  pendingRetryCoordsRef.current = require_sessionInvalidatedRecovery.normaliseRetryCoords(x, y);
83
92
  nextMountAutoStartRef.current = true;
93
+ sessionInvalidatedAttemptsRef.current = 0;
84
94
  resetState(0);
85
95
  start();
86
96
  };
@@ -22,18 +22,25 @@ var normaliseRetryCoords = (x, y) => {
22
22
  };
23
23
  };
24
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.
25
+ * Semantics of the outer recovery handler. Returns whether the caller should
26
+ * proceed to re-run the frictionless flow (`start()`), and mutates the passed
27
+ * refs to record the attempt + pending coords.
28
28
  *
29
- * Second calls are ignored (one-shot per outer widget lifetime) so a
30
- * persistently broken session doesn't loop.
29
+ * Bounded rather than one-shot: a persistently broken session still stops
30
+ * looping, but the caller is told (`exhausted`) so it can fall back visibly
31
+ * instead of silently doing nothing.
31
32
  */
32
- var handleSessionInvalidated = (x, y, firedRef, pendingCoordsRef) => {
33
- if (firedRef.current) return { shouldRestart: false };
34
- firedRef.current = true;
33
+ var handleSessionInvalidated = (x, y, attemptsRef, pendingCoordsRef, maxAttempts = 3) => {
34
+ if (attemptsRef.current >= maxAttempts) return {
35
+ shouldRestart: false,
36
+ exhausted: true
37
+ };
38
+ attemptsRef.current += 1;
35
39
  pendingCoordsRef.current = normaliseRetryCoords(x, y);
36
- return { shouldRestart: true };
40
+ return {
41
+ shouldRestart: true,
42
+ exhausted: false
43
+ };
37
44
  };
38
45
  /**
39
46
  * Compute the props a resumed inner widget mounts with. Consumes the
@@ -6,8 +6,10 @@ export type MutableRef<T> = {
6
6
  current: T;
7
7
  };
8
8
  export declare const normaliseRetryCoords: (x: number | undefined, y: number | undefined) => RetryCoords | null;
9
- export declare const handleSessionInvalidated: (x: number | undefined, y: number | undefined, firedRef: MutableRef<boolean>, pendingCoordsRef: MutableRef<RetryCoords | null>) => {
9
+ export declare const MAX_SESSION_INVALIDATED_RETRIES = 3;
10
+ export declare const handleSessionInvalidated: (x: number | undefined, y: number | undefined, attemptsRef: MutableRef<number>, pendingCoordsRef: MutableRef<RetryCoords | null>, maxAttempts?: number) => {
10
11
  shouldRestart: boolean;
12
+ exhausted: boolean;
11
13
  };
12
14
  export declare const consumeRetryMountProps: (pendingCoordsRef: MutableRef<RetryCoords | null>, escalationAutoStart: boolean) => {
13
15
  autoStart: boolean;
@@ -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;AAgB3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O,KAC1B;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAA;CAO5D,CAAC"}
@@ -22,18 +22,25 @@ var normaliseRetryCoords = (x, y) => {
22
22
  };
23
23
  };
24
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.
25
+ * Semantics of the outer recovery handler. Returns whether the caller should
26
+ * proceed to re-run the frictionless flow (`start()`), and mutates the passed
27
+ * refs to record the attempt + pending coords.
28
28
  *
29
- * Second calls are ignored (one-shot per outer widget lifetime) so a
30
- * persistently broken session doesn't loop.
29
+ * Bounded rather than one-shot: a persistently broken session still stops
30
+ * looping, but the caller is told (`exhausted`) so it can fall back visibly
31
+ * instead of silently doing nothing.
31
32
  */
32
- var handleSessionInvalidated = (x, y, firedRef, pendingCoordsRef) => {
33
- if (firedRef.current) return { shouldRestart: false };
34
- firedRef.current = true;
33
+ var handleSessionInvalidated = (x, y, attemptsRef, pendingCoordsRef, maxAttempts = 3) => {
34
+ if (attemptsRef.current >= maxAttempts) return {
35
+ shouldRestart: false,
36
+ exhausted: true
37
+ };
38
+ attemptsRef.current += 1;
35
39
  pendingCoordsRef.current = normaliseRetryCoords(x, y);
36
- return { shouldRestart: true };
40
+ return {
41
+ shouldRestart: true,
42
+ exhausted: false
43
+ };
37
44
  };
38
45
  /**
39
46
  * Compute the props a resumed inner widget mounts with. Consumes the
@@ -1 +1 @@
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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AC,CAAC;AAWjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACvC,CAAqB,EACrB,CAAqB,EACrB,WAA+B,EAC/B,gBAAgD,EAChD,cAAsB,+BAA+B,EACJ,EAAE;IACnD,IAAI,WAAW,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;QACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,CAAC;IACD,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;IACzB,gBAAgB,CAAC,OAAO,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAClD,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"}
@@ -0,0 +1,5 @@
1
+ declare global {
2
+ var IS_REACT_ACT_ENVIRONMENT: boolean;
3
+ }
4
+ export {};
5
+ //# sourceMappingURL=escalationHandoff.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalationHandoff.integration.test.d.ts","sourceRoot":"","sources":["../../src/tests/escalationHandoff.integration.test.tsx"],"names":[],"mappings":"AAyDA,OAAO,CAAC,MAAM,CAAC;IACd,IAAI,wBAAwB,EAAE,OAAO,CAAC;CACtC"}