@prosopo/procaptcha-frictionless 2.16.5 → 2.18.0

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 (77) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +7 -7
  2. package/.turbo/turbo-build$colon$tsc.log +24 -24
  3. package/.turbo/turbo-build.log +12 -12
  4. package/CHANGELOG.md +69 -0
  5. package/dist/{AuthenticatedBadge.d.ts → authenticatedBadge.d.ts} +3 -3
  6. package/dist/authenticatedBadge.d.ts.map +1 -0
  7. package/dist/authenticatedBadge.js +79 -0
  8. package/dist/authenticatedBadge.js.map +1 -0
  9. package/dist/cjs/authenticatedBadge.cjs +79 -0
  10. package/dist/cjs/customDetectBot.cjs +3 -2
  11. package/dist/cjs/detectorPrefetch.cjs +2 -2
  12. package/dist/cjs/index.cjs +2 -2
  13. package/dist/cjs/procaptchaFrictionless.cjs +269 -0
  14. package/dist/customDetectBot.d.ts.map +1 -1
  15. package/dist/customDetectBot.js +4 -3
  16. package/dist/customDetectBot.js.map +1 -1
  17. package/dist/detectorPrefetch.js +2 -2
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +2 -2
  20. package/dist/procaptchaFrictionless.d.ts +6 -0
  21. package/dist/procaptchaFrictionless.d.ts.map +1 -0
  22. package/dist/procaptchaFrictionless.js +269 -0
  23. package/dist/procaptchaFrictionless.js.map +1 -0
  24. package/dist/tests/customDetectBotAssignTimeout.test.js +1 -0
  25. package/dist/tests/customDetectBotAssignTimeout.test.js.map +1 -1
  26. package/dist/tests/customDetectBotSimd.test.js +1 -0
  27. package/dist/tests/customDetectBotSimd.test.js.map +1 -1
  28. package/dist/tests/escalationClientSession.test.d.ts +0 -3
  29. package/dist/tests/escalationClientSession.test.d.ts.map +1 -1
  30. package/dist/tests/escalationClientSession.test.js +52 -61
  31. package/dist/tests/escalationClientSession.test.js.map +1 -1
  32. package/dist/tests/escalationHandoff.integration.test.d.ts +0 -3
  33. package/dist/tests/escalationHandoff.integration.test.d.ts.map +1 -1
  34. package/dist/tests/escalationHandoff.integration.test.js +62 -61
  35. package/dist/tests/escalationHandoff.integration.test.js.map +1 -1
  36. package/dist/tests/executeBeforeMount.test.d.ts +0 -3
  37. package/dist/tests/executeBeforeMount.test.d.ts.map +1 -1
  38. package/dist/tests/executeBeforeMount.test.js +53 -49
  39. package/dist/tests/executeBeforeMount.test.js.map +1 -1
  40. package/dist/tests/manualStart.test.d.ts +0 -3
  41. package/dist/tests/manualStart.test.d.ts.map +1 -1
  42. package/dist/tests/manualStart.test.js +55 -52
  43. package/dist/tests/manualStart.test.js.map +1 -1
  44. package/dist/tests/procaptchaFrictionless.test.d.ts +2 -0
  45. package/dist/tests/procaptchaFrictionless.test.d.ts.map +1 -0
  46. package/dist/tests/procaptchaFrictionless.test.js +244 -0
  47. package/dist/tests/procaptchaFrictionless.test.js.map +1 -0
  48. package/dist/tests/sessionInvalidatedRemint.test.d.ts +0 -3
  49. package/dist/tests/sessionInvalidatedRemint.test.d.ts.map +1 -1
  50. package/dist/tests/sessionInvalidatedRemint.test.js +49 -43
  51. package/dist/tests/sessionInvalidatedRemint.test.js.map +1 -1
  52. package/package.json +11 -13
  53. package/src/authenticatedBadge.ts +151 -0
  54. package/src/customDetectBot.ts +11 -2
  55. package/src/detectorPrefetch.ts +2 -2
  56. package/src/index.ts +1 -1
  57. package/src/{ProcaptchaFrictionless.tsx → procaptchaFrictionless.ts} +285 -314
  58. package/src/tests/customDetectBotAssignTimeout.test.ts +5 -0
  59. package/src/tests/customDetectBotSimd.test.ts +5 -0
  60. package/src/tests/{escalationClientSession.test.tsx → escalationClientSession.test.ts} +83 -92
  61. package/src/tests/{escalationHandoff.integration.test.tsx → escalationHandoff.integration.test.ts} +110 -108
  62. package/src/tests/{executeBeforeMount.test.tsx → executeBeforeMount.test.ts} +79 -77
  63. package/src/tests/{manualStart.test.tsx → manualStart.test.ts} +87 -83
  64. package/src/tests/procaptchaFrictionless.test.ts +408 -0
  65. package/src/tests/{sessionInvalidatedRemint.test.tsx → sessionInvalidatedRemint.test.ts} +67 -64
  66. package/tsconfig.cjs.json +1 -2
  67. package/tsconfig.tsbuildinfo +1 -1
  68. package/dist/AuthenticatedBadge.d.ts.map +0 -1
  69. package/dist/AuthenticatedBadge.js +0 -75
  70. package/dist/AuthenticatedBadge.js.map +0 -1
  71. package/dist/ProcaptchaFrictionless.d.ts +0 -3
  72. package/dist/ProcaptchaFrictionless.d.ts.map +0 -1
  73. package/dist/ProcaptchaFrictionless.js +0 -287
  74. package/dist/ProcaptchaFrictionless.js.map +0 -1
  75. package/dist/cjs/AuthenticatedBadge.cjs +0 -75
  76. package/dist/cjs/ProcaptchaFrictionless.cjs +0 -287
  77. package/src/AuthenticatedBadge.tsx +0 -141
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.16.5 build:cjs
2
+ > @prosopo/procaptcha-frictionless@2.18.0 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,13 +56,13 @@ Bundle build started
56
56
  ✓ 9 modules transformed.
57
57
  rendering chunks...
58
58
  computing gzip size...
59
- dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
59
+ dist/cjs/index.cjs 0.55 kB │ gzip: 0.21 kB
60
60
  dist/cjs/detectorLoader.cjs 1.65 kB │ gzip: 0.90 kB
61
61
  dist/cjs/sessionInvalidatedRecovery.cjs 2.50 kB │ gzip: 1.14 kB
62
- dist/cjs/AuthenticatedBadge.cjs 2.69 kB │ gzip: 1.08 kB
63
62
  dist/cjs/frictionlessResultGuard.cjs 2.75 kB │ gzip: 1.39 kB
64
- dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
65
- dist/cjs/customDetectBot.cjs 5.74 kB │ gzip: 1.75 kB
66
- dist/cjs/ProcaptchaFrictionless.cjs 12.23 kB │ gzip: 3.05 kB
63
+ dist/cjs/authenticatedBadge.cjs 2.81 kB │ gzip: 1.10 kB
64
+ dist/cjs/detectorPrefetch.cjs 2.97 kB │ gzip: 1.34 kB
65
+ dist/cjs/customDetectBot.cjs 5.88 kB │ gzip: 1.78 kB
66
+ dist/cjs/procaptchaFrictionless.cjs 10.27 kB │ gzip: 2.95 kB
67
67
 
68
- ✓ built in 53ms
68
+ ✓ built in 55ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.16.5 build:tsc
2
+ > @prosopo/procaptcha-frictionless@2.18.0 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 10:46:14 PM - Projects in this build:
5
+ 11:04:39 AM - 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
- 10:46:14 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
+ 11:04:39 AM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/vite/NodejsPolarsDirnamePlugin.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
29
29
 
30
- 10:46:14 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
30
+ 11:04:39 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/process.ts' is older than output '../locale/tsconfig.tsbuildinfo'
31
31
 
32
- 10:46:14 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
32
+ 11:04:39 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/ofLen.ts' is older than output '../util/tsconfig.tsbuildinfo'
33
33
 
34
- 10:46:14 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
+ 11:04:39 AM - 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
- 10:46:14 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
+ 11:04:39 AM - 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
- 10:46:14 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
+ 11:04:39 AM - 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
- 10:46:14 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
40
+ 11:04:39 AM - 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
- 10:46:14 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
42
+ 11:04:39 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/utils/batches.ts' is older than output '../common/tsconfig.tsbuildinfo'
43
43
 
44
- 10:46:14 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
+ 11:04:39 AM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/async.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
45
45
 
46
- 10:46:14 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
46
+ 11:04:40 AM - 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
- 10:46:14 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/developmentProviderUrl.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
48
+ 11:04:40 AM - 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
- 10:46:14 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/theme.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
50
+ 11:04:40 AM - 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'
51
51
 
52
- 10:46:14 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
52
+ 11:04:40 AM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
53
53
 
54
- 10:46:14 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
+ 11:04:40 AM - 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
- 10:46:14 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'
56
+ 11:04:40 AM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/challengeSurfaceRender.unit.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
57
57
 
58
- 10:46:14 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
+ 11:04:40 AM - 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
- 10:46:14 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'
60
+ 11:04:40 AM - 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
- 10:46:14 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/mocks/data/captchas.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
62
+ 11:04:40 AM - 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
- 10:46:14 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
+ 11:04:40 AM - 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
- 10:46:15 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'
66
+ 11:04:40 AM - 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
- 10:46:15 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
68
+ 11:04:40 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
69
69
 
70
- 10:46:15 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
70
+ 11:04:40 AM - 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.16.5 build
2
+ > @prosopo/procaptcha-frictionless@2.18.0 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-frictionless@2.16.5 build:cross-env
6
+ > @prosopo/procaptcha-frictionless@2.18.0 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -60,14 +60,14 @@ Bundle build started
60
60
  ✓ 9 modules transformed.
61
61
  rendering chunks...
62
62
  computing gzip size...
63
- dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
64
- dist/index.js 0.32 kB │ gzip: 0.15 kB
65
- dist/detectorLoader.js 1.63 kB │ gzip: 0.90 kB
66
- dist/AuthenticatedBadge.js 2.28 kB │ gzip: 1.04 kB
67
- dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 kB
68
- dist/frictionlessResultGuard.js 2.68 kB │ gzip: 1.39 kB
69
- dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
70
- dist/customDetectBot.js 5.56 kB │ gzip: 1.73 kB
71
- dist/ProcaptchaFrictionless.js 11.43 kB │ gzip: 3.01 kB
63
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
64
+ dist/index.js 0.33 kB │ gzip: 0.15 kB
65
+ dist/detectorLoader.js 1.63 kB │ gzip: 0.90 kB
66
+ dist/authenticatedBadge.js 2.38 kB │ gzip: 1.08 kB
67
+ dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 kB
68
+ dist/frictionlessResultGuard.js 2.68 kB │ gzip: 1.39 kB
69
+ dist/detectorPrefetch.js 2.85 kB │ gzip: 1.31 kB
70
+ dist/customDetectBot.js 5.70 kB │ gzip: 1.76 kB
71
+ dist/procaptchaFrictionless.js 9.78 kB │ gzip: 2.92 kB
72
72
 
73
- ✓ built in 64ms
73
+ ✓ built in 57ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.18.0
4
+ ### Minor Changes
5
+
6
+ - 59c02da: Replace React with vanilla TS/DOM in the widget.
7
+
8
+ The widget packages no longer depend on react, react-dom, @emotion or
9
+ react-i18next: every component is now a `mount*` function returning a handle
10
+ with `update`/`destroy`. `useTranslation` is replaced by `createTranslator`,
11
+ which exposes i18next's `t` plus the events that used to trigger a re-render.
12
+ The rendered markup, styling and behaviour are unchanged — only the
13
+ implementation is.
14
+
15
+ Everything the widget has gained since this rewrite started is carried over,
16
+ so nothing is lost by dropping React: the shared challenge surface (popup and
17
+ float placement, escape/outside-click dismissal and the dialog focus trap),
18
+ the image-tile and puzzle-piece keyboard paths, the checkbox's focus handover
19
+ across the loading swap, the server-rendered puzzle imagery, `startMode:
20
+ "manual"` with `window.procaptcha.start()`, `data-bind` / targeted
21
+ `execute(widgetId)`, the Web Bot Auth "authenticated" badge, the client
22
+ session id, and the bounded session re-mint and reload handling in the
23
+ frictionless wrapper.
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [59c02da]
28
+ - @prosopo/procaptcha-common@2.16.0
29
+ - @prosopo/procaptcha-puzzle@2.14.0
30
+ - @prosopo/procaptcha-react@2.12.0
31
+ - @prosopo/procaptcha-pow@2.13.0
32
+ - @prosopo/locale@3.5.0
33
+ - @prosopo/common@3.1.58
34
+ - @prosopo/types@5.9.2
35
+ - @prosopo/api@4.3.2
36
+
37
+ ## 2.17.1
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [a22069d]
41
+ - @prosopo/types@5.9.1
42
+ - @prosopo/locale@3.4.4
43
+ - @prosopo/api@4.3.1
44
+ - @prosopo/common@3.1.57
45
+ - @prosopo/procaptcha-common@2.15.1
46
+ - @prosopo/procaptcha-pow@2.12.8
47
+ - @prosopo/procaptcha-puzzle@2.13.4
48
+ - @prosopo/procaptcha-react@2.11.4
49
+
50
+ ## 2.17.0
51
+ ### Minor Changes
52
+
53
+ - 0f23010: Correlate captcha sessions with Prosopo Protect sessions on sites that run both.
54
+
55
+ Protect's challenge page already renders the widget with `data-sessionid=<its session id>`, so captchas served from the interstitial can be matched back to the Protect session. A widget the site embeds itself — on its own pages — had no way to know that id, so those sessions could not be matched to anything.
56
+
57
+ The widget now falls back to reading Protect's session id from the page (`window.prosopo_protect.jti`, or the `prosopo_session` cookie Protect sets on the site's domain) when the site has not supplied a session id of its own. A session id the site does supply always wins, so nothing changes for sites that use the field themselves, and sites without Protect are unaffected. Only the id is read — the session token that shares the cookie never leaves the page.
58
+
59
+ Two gaps in the existing field are closed alongside it: the widget now sends the session id when it first asks for a captcha rather than only when submitting a solution, and the provider records it on the session at that point. Previously a session that was allowed without a challenge, or abandoned before the user solved one, carried no session id at all. An escalated session now inherits the id from the session it escalated from.
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [a606f54]
64
+ - Updated dependencies [0f23010]
65
+ - @prosopo/types@5.9.0
66
+ - @prosopo/procaptcha-common@2.15.0
67
+ - @prosopo/api@4.3.0
68
+ - @prosopo/procaptcha-pow@2.12.7
69
+ - @prosopo/procaptcha-puzzle@2.13.3
70
+ - @prosopo/procaptcha-react@2.11.3
71
+
3
72
  ## 2.16.5
4
73
  ### Patch Changes
5
74
 
@@ -1,5 +1,5 @@
1
+ import { type StaticComponent } from "@prosopo/procaptcha-common";
1
2
  import { type Account, type ProcaptchaCallbacks, type RandomProvider } from "@prosopo/types";
2
- import { type FC } from "react";
3
3
  export type AuthenticatedBadgeProps = {
4
4
  sessionId: string;
5
5
  agent?: string;
@@ -8,5 +8,5 @@ export type AuthenticatedBadgeProps = {
8
8
  provider: RandomProvider;
9
9
  callbacks: ProcaptchaCallbacks;
10
10
  };
11
- export declare const AuthenticatedBadge: FC<AuthenticatedBadgeProps>;
12
- //# sourceMappingURL=AuthenticatedBadge.d.ts.map
11
+ export declare const mountAuthenticatedBadge: (container: HTMLElement, props: AuthenticatedBadgeProps) => StaticComponent;
12
+ //# sourceMappingURL=authenticatedBadge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticatedBadge.d.ts","sourceRoot":"","sources":["../src/authenticatedBadge.ts"],"names":[],"mappings":"AA2BA,OAAO,EACN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,mBAAmB,CAAC;CAC/B,CAAC;AAmDF,eAAO,MAAM,uBAAuB,cACxB,WAAW,SACf,uBAAuB,KAC5B,eA+CF,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { createElement, createSvgElement, getDefaultEvents } from "@prosopo/procaptcha-common";
2
+ import { ApiParams, CaptchaType, encodeProcaptchaOutput } from "@prosopo/types";
3
+ //#region src/authenticatedBadge.ts
4
+ var displayHost = (agent) => {
5
+ if (!agent) return "unknown";
6
+ try {
7
+ return new URL(agent).hostname;
8
+ } catch {
9
+ return agent;
10
+ }
11
+ };
12
+ var buildLabel = (agent) => {
13
+ if (!agent) return createElement("span", { children: [createElement("strong", { text: "Trusted request" })] });
14
+ return createElement("span", { children: [createElement("strong", { text: "Verified agent" }), document.createTextNode(`: ${displayHost(agent)}`)] });
15
+ };
16
+ var buildTick = () => {
17
+ const title = createSvgElement("title");
18
+ title.textContent = "Verified";
19
+ return createSvgElement("svg", {
20
+ attributes: {
21
+ width: "16",
22
+ height: "16",
23
+ viewBox: "0 0 24 24",
24
+ fill: "none",
25
+ stroke: "currentColor",
26
+ "stroke-width": "2.5",
27
+ "stroke-linecap": "round",
28
+ "stroke-linejoin": "round",
29
+ "aria-hidden": "true"
30
+ },
31
+ children: [title, createSvgElement("path", { attributes: { d: "M20 6L9 17l-5-5" } })]
32
+ });
33
+ };
34
+ var mountAuthenticatedBadge = (container, props) => {
35
+ const { sessionId, agent, dapp, userAccount, provider, callbacks } = props;
36
+ const badge = createElement("div", {
37
+ style: {
38
+ display: "inline-flex",
39
+ alignItems: "center",
40
+ gap: "8px",
41
+ padding: "8px 12px",
42
+ borderRadius: "6px",
43
+ background: "#eef2ff",
44
+ border: "1px solid #c7d2fe",
45
+ color: "#3730a3",
46
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
47
+ fontSize: "13px",
48
+ lineHeight: 1.4
49
+ },
50
+ attributes: {
51
+ role: "status",
52
+ "aria-label": "Verified agent"
53
+ },
54
+ children: [buildTick(), buildLabel(agent)]
55
+ });
56
+ container.appendChild(badge);
57
+ const events = getDefaultEvents(callbacks);
58
+ const token = encodeProcaptchaOutput({
59
+ [ApiParams.providerUrl]: provider.provider.url,
60
+ [ApiParams.user]: userAccount.account.address,
61
+ [ApiParams.dapp]: dapp,
62
+ [ApiParams.commitmentId]: sessionId,
63
+ [ApiParams.timestamp]: Date.now().toString(),
64
+ [ApiParams.signature]: {
65
+ [ApiParams.provider]: {},
66
+ [ApiParams.user]: {}
67
+ },
68
+ [ApiParams.captchaType]: CaptchaType.authenticated
69
+ });
70
+ events.onHuman(token);
71
+ return {
72
+ update: () => void 0,
73
+ destroy: () => {
74
+ badge.parentNode?.removeChild(badge);
75
+ }
76
+ };
77
+ };
78
+ //#endregion
79
+ export { mountAuthenticatedBadge };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticatedBadge.js","sourceRoot":"","sources":["../src/authenticated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AAE,WAAW,CAAC,OAAO,CAAC,OAAO;QAC7C,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI;QAGtB,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,SAAS;QACnC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC5C,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;YACtB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE;YACxB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;SACpB;QACD,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEtB,OAAO;QACN,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS;QACvB,OAAO,EAAE,GAAG,EAAE;YACb,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,79 @@
1
+ let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
2
+ let _prosopo_types = require("@prosopo/types");
3
+ //#region src/authenticatedBadge.ts
4
+ var displayHost = (agent) => {
5
+ if (!agent) return "unknown";
6
+ try {
7
+ return new URL(agent).hostname;
8
+ } catch {
9
+ return agent;
10
+ }
11
+ };
12
+ var buildLabel = (agent) => {
13
+ if (!agent) return (0, _prosopo_procaptcha_common.createElement)("span", { children: [(0, _prosopo_procaptcha_common.createElement)("strong", { text: "Trusted request" })] });
14
+ return (0, _prosopo_procaptcha_common.createElement)("span", { children: [(0, _prosopo_procaptcha_common.createElement)("strong", { text: "Verified agent" }), document.createTextNode(`: ${displayHost(agent)}`)] });
15
+ };
16
+ var buildTick = () => {
17
+ const title = (0, _prosopo_procaptcha_common.createSvgElement)("title");
18
+ title.textContent = "Verified";
19
+ return (0, _prosopo_procaptcha_common.createSvgElement)("svg", {
20
+ attributes: {
21
+ width: "16",
22
+ height: "16",
23
+ viewBox: "0 0 24 24",
24
+ fill: "none",
25
+ stroke: "currentColor",
26
+ "stroke-width": "2.5",
27
+ "stroke-linecap": "round",
28
+ "stroke-linejoin": "round",
29
+ "aria-hidden": "true"
30
+ },
31
+ children: [title, (0, _prosopo_procaptcha_common.createSvgElement)("path", { attributes: { d: "M20 6L9 17l-5-5" } })]
32
+ });
33
+ };
34
+ var mountAuthenticatedBadge = (container, props) => {
35
+ const { sessionId, agent, dapp, userAccount, provider, callbacks } = props;
36
+ const badge = (0, _prosopo_procaptcha_common.createElement)("div", {
37
+ style: {
38
+ display: "inline-flex",
39
+ alignItems: "center",
40
+ gap: "8px",
41
+ padding: "8px 12px",
42
+ borderRadius: "6px",
43
+ background: "#eef2ff",
44
+ border: "1px solid #c7d2fe",
45
+ color: "#3730a3",
46
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
47
+ fontSize: "13px",
48
+ lineHeight: 1.4
49
+ },
50
+ attributes: {
51
+ role: "status",
52
+ "aria-label": "Verified agent"
53
+ },
54
+ children: [buildTick(), buildLabel(agent)]
55
+ });
56
+ container.appendChild(badge);
57
+ const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
58
+ const token = (0, _prosopo_types.encodeProcaptchaOutput)({
59
+ [_prosopo_types.ApiParams.providerUrl]: provider.provider.url,
60
+ [_prosopo_types.ApiParams.user]: userAccount.account.address,
61
+ [_prosopo_types.ApiParams.dapp]: dapp,
62
+ [_prosopo_types.ApiParams.commitmentId]: sessionId,
63
+ [_prosopo_types.ApiParams.timestamp]: Date.now().toString(),
64
+ [_prosopo_types.ApiParams.signature]: {
65
+ [_prosopo_types.ApiParams.provider]: {},
66
+ [_prosopo_types.ApiParams.user]: {}
67
+ },
68
+ [_prosopo_types.ApiParams.captchaType]: _prosopo_types.CaptchaType.authenticated
69
+ });
70
+ events.onHuman(token);
71
+ return {
72
+ update: () => void 0,
73
+ destroy: () => {
74
+ badge.parentNode?.removeChild(badge);
75
+ }
76
+ };
77
+ };
78
+ //#endregion
79
+ exports.mountAuthenticatedBadge = mountAuthenticatedBadge;
@@ -94,10 +94,11 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
94
94
  console.error("Procaptcha: no detector bundle available, falling back to a server-chosen captcha:", err);
95
95
  }
96
96
  const ext = new (await extClassPromise)();
97
+ const clientSessionId = (0, _prosopo_procaptcha_common.resolveClientSessionId)(config.clientSessionId);
97
98
  if (providerDetect === void 0) {
98
99
  const userAccount = await ext.getAccount(config);
99
100
  const { currentUrl: fallbackUrl, iframeUrl: fallbackIframeUrl } = getCurrentPageUrls();
100
- const captcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, fallbackUrl, fallbackIframeUrl), 1e4);
101
+ const captcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, fallbackUrl, fallbackIframeUrl, clientSessionId), 1e4);
101
102
  if (captcha.dns_url) try {
102
103
  fetch(captcha.dns_url, {
103
104
  method: "GET",
@@ -121,7 +122,7 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
121
122
  const detectionResult = await providerDetect(container, restartFn, () => ext.getAccount(config), detectorOptions);
122
123
  const userAccount = detectionResult.userAccount;
123
124
  const { currentUrl, iframeUrl } = getCurrentPageUrls();
124
- const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, currentUrl, iframeUrl);
125
+ const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, currentUrl, iframeUrl, clientSessionId);
125
126
  if (detectionResult.getSimdReadings) detectionResult.getSimdReadings(6e4).catch(() => void 0);
126
127
  const captcha = await withTimeout(captchaPromise, 1e4);
127
128
  if (captcha.dns_url) try {
@@ -6,12 +6,12 @@ let _prosopo_api = require("@prosopo/api");
6
6
  *
7
7
  * Since the detector moved into the provider-served pool, the frictionless flow
8
8
  * cannot start until `/detector/assign` has returned. That request is issued by
9
- * `customDetectBot`, which only runs once React has mounted the widget — and
9
+ * `customDetectBot`, which only runs once the widget has mounted — and
10
10
  * that mount sits behind the bundle's dynamic-import chain. Measured on a
11
11
  * staging demo page the assign request did not leave the browser until 1513 ms,
12
12
  * of which ~700 ms was purely waiting for chunks to arrive in sequence.
13
13
  *
14
- * Nothing in the request depends on React, i18n or the widget config: it needs
14
+ * Nothing in the request depends on the widget, i18n or its config: it needs
15
15
  * the site key (a DOM attribute, readable immediately), the environment (a
16
16
  * build-time constant) and the IP-mode flags (DOM attributes). So the entry
17
17
  * point kicks it off as soon as it has read those, and `customDetectBot` picks
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_detectorPrefetch = require("./detectorPrefetch.cjs");
3
- const require_ProcaptchaFrictionless = require("./ProcaptchaFrictionless.cjs");
4
- exports.ProcaptchaFrictionless = require_ProcaptchaFrictionless.ProcaptchaFrictionless;
3
+ const require_procaptchaFrictionless = require("./procaptchaFrictionless.cjs");
5
4
  exports.clearPrefetchedDetectors = require_detectorPrefetch.clearPrefetchedDetectors;
5
+ exports.mountProcaptchaFrictionless = require_procaptchaFrictionless.mountProcaptchaFrictionless;
6
6
  exports.prefetchDetector = require_detectorPrefetch.prefetchDetector;
7
7
  exports.takePrefetchedDetector = require_detectorPrefetch.takePrefetchedDetector;