@prosopo/procaptcha-frictionless 2.17.0 → 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.
- package/.turbo/turbo-build$colon$cjs.log +6 -6
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +47 -0
- package/dist/{AuthenticatedBadge.d.ts → authenticatedBadge.d.ts} +3 -3
- package/dist/authenticatedBadge.d.ts.map +1 -0
- package/dist/authenticatedBadge.js +79 -0
- package/dist/authenticatedBadge.js.map +1 -0
- package/dist/cjs/authenticatedBadge.cjs +79 -0
- package/dist/cjs/detectorPrefetch.cjs +2 -2
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/procaptchaFrictionless.cjs +269 -0
- package/dist/detectorPrefetch.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/procaptchaFrictionless.d.ts +6 -0
- package/dist/procaptchaFrictionless.d.ts.map +1 -0
- package/dist/procaptchaFrictionless.js +269 -0
- package/dist/procaptchaFrictionless.js.map +1 -0
- package/dist/tests/escalationClientSession.test.d.ts +0 -3
- package/dist/tests/escalationClientSession.test.d.ts.map +1 -1
- package/dist/tests/escalationClientSession.test.js +52 -61
- package/dist/tests/escalationClientSession.test.js.map +1 -1
- package/dist/tests/escalationHandoff.integration.test.d.ts +0 -3
- package/dist/tests/escalationHandoff.integration.test.d.ts.map +1 -1
- package/dist/tests/escalationHandoff.integration.test.js +62 -61
- package/dist/tests/escalationHandoff.integration.test.js.map +1 -1
- package/dist/tests/executeBeforeMount.test.d.ts +0 -3
- package/dist/tests/executeBeforeMount.test.d.ts.map +1 -1
- package/dist/tests/executeBeforeMount.test.js +53 -49
- package/dist/tests/executeBeforeMount.test.js.map +1 -1
- package/dist/tests/manualStart.test.d.ts +0 -3
- package/dist/tests/manualStart.test.d.ts.map +1 -1
- package/dist/tests/manualStart.test.js +55 -52
- package/dist/tests/manualStart.test.js.map +1 -1
- package/dist/tests/procaptchaFrictionless.test.d.ts +2 -0
- package/dist/tests/procaptchaFrictionless.test.d.ts.map +1 -0
- package/dist/tests/procaptchaFrictionless.test.js +244 -0
- package/dist/tests/procaptchaFrictionless.test.js.map +1 -0
- package/dist/tests/sessionInvalidatedRemint.test.d.ts +0 -3
- package/dist/tests/sessionInvalidatedRemint.test.d.ts.map +1 -1
- package/dist/tests/sessionInvalidatedRemint.test.js +49 -43
- package/dist/tests/sessionInvalidatedRemint.test.js.map +1 -1
- package/package.json +11 -13
- package/src/authenticatedBadge.ts +151 -0
- package/src/customDetectBot.ts +2 -2
- package/src/detectorPrefetch.ts +2 -2
- package/src/index.ts +1 -1
- package/src/{ProcaptchaFrictionless.tsx → procaptchaFrictionless.ts} +285 -314
- package/src/tests/{escalationClientSession.test.tsx → escalationClientSession.test.ts} +83 -92
- package/src/tests/{escalationHandoff.integration.test.tsx → escalationHandoff.integration.test.ts} +110 -108
- package/src/tests/{executeBeforeMount.test.tsx → executeBeforeMount.test.ts} +79 -77
- package/src/tests/{manualStart.test.tsx → manualStart.test.ts} +87 -83
- package/src/tests/procaptchaFrictionless.test.ts +408 -0
- package/src/tests/{sessionInvalidatedRemint.test.tsx → sessionInvalidatedRemint.test.ts} +67 -64
- package/tsconfig.cjs.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/AuthenticatedBadge.d.ts.map +0 -1
- package/dist/AuthenticatedBadge.js +0 -75
- package/dist/AuthenticatedBadge.js.map +0 -1
- package/dist/ProcaptchaFrictionless.d.ts +0 -3
- package/dist/ProcaptchaFrictionless.d.ts.map +0 -1
- package/dist/ProcaptchaFrictionless.js +0 -287
- package/dist/ProcaptchaFrictionless.js.map +0 -1
- package/dist/cjs/AuthenticatedBadge.cjs +0 -75
- package/dist/cjs/ProcaptchaFrictionless.cjs +0 -287
- package/src/AuthenticatedBadge.tsx +0 -141
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
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.
|
|
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/
|
|
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
65
|
dist/cjs/customDetectBot.cjs 5.88 kB │ gzip: 1.78 kB
|
|
66
|
-
dist/cjs/
|
|
66
|
+
dist/cjs/procaptchaFrictionless.cjs 10.27 kB │ gzip: 2.95 kB
|
|
67
67
|
|
|
68
|
-
[32m✓ built in
|
|
68
|
+
[32m✓ built in 55ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.18.0 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
+
11:04:40 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
11:04:40 AM - 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.
|
|
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.
|
|
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
|
|
64
|
-
dist/index.js
|
|
65
|
-
dist/detectorLoader.js
|
|
66
|
-
dist/
|
|
67
|
-
dist/sessionInvalidatedRecovery.js
|
|
68
|
-
dist/frictionlessResultGuard.js
|
|
69
|
-
dist/detectorPrefetch.js
|
|
70
|
-
dist/customDetectBot.js
|
|
71
|
-
dist/
|
|
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
|
-
[32m✓ built in
|
|
73
|
+
[32m✓ built in 57ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
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
|
+
|
|
3
50
|
## 2.17.0
|
|
4
51
|
### Minor Changes
|
|
5
52
|
|
|
@@ -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
|
|
12
|
-
//# sourceMappingURL=
|
|
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/authenticatedBadge.ts"],"names":[],"mappings":"AA2BA,OAAO,EAEN,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEN,SAAS,EACT,WAAW,EAGX,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AAWxB,MAAM,WAAW,GAAG,CAAC,KAAc,EAAU,EAAE;IAC9C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,CAAC;QACJ,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAc,EAAe,EAAE;IAClD,IAAI,CAAC,KAAK,EAAE,CAAC;QAKZ,OAAO,aAAa,CAAC,MAAM,EAAE;YAC5B,QAAQ,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,E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C,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;
|
|
@@ -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
|
|
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
|
|
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
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_detectorPrefetch = require("./detectorPrefetch.cjs");
|
|
3
|
-
const
|
|
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;
|