@prosopo/procaptcha-pow 2.12.7 → 2.13.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.
- package/.turbo/turbo-build$colon$cjs.log +5 -5
- package/.turbo/turbo-build$colon$tsc.log +20 -20
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +62 -0
- package/dist/cjs/components/procaptchaPoW.cjs +22 -0
- package/dist/cjs/components/procaptchaWidget.cjs +143 -0
- package/dist/cjs/index.cjs +5 -2
- package/dist/components/procaptchaPoW.d.ts +7 -0
- package/dist/components/procaptchaPoW.d.ts.map +1 -0
- package/dist/components/procaptchaPoW.js +21 -0
- package/dist/components/procaptchaPoW.js.map +1 -0
- package/dist/components/procaptchaWidget.d.ts +7 -0
- package/dist/components/procaptchaWidget.d.ts.map +1 -0
- package/dist/components/procaptchaWidget.js +143 -0
- package/dist/components/procaptchaWidget.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/tests/domHarness.d.ts +20 -0
- package/dist/tests/domHarness.d.ts.map +1 -0
- package/dist/tests/domHarness.js +56 -0
- package/dist/tests/domHarness.js.map +1 -0
- package/dist/tests/procaptchaPoW.unit.test.js +46 -30
- package/dist/tests/procaptchaPoW.unit.test.js.map +1 -1
- package/dist/tests/procaptchaPow.test-d.js +5 -5
- package/dist/tests/procaptchaPow.test-d.js.map +1 -1
- package/dist/tests/procaptchaWidget.unit.test.js +79 -137
- package/dist/tests/procaptchaWidget.unit.test.js.map +1 -1
- package/package.json +11 -15
- package/src/components/procaptchaPoW.ts +53 -0
- package/src/components/procaptchaWidget.ts +281 -0
- package/src/index.ts +2 -2
- package/src/tests/domHarness.ts +122 -0
- package/src/tests/procaptchaPoW.unit.test.ts +59 -36
- package/src/tests/procaptchaPow.test-d.ts +15 -9
- package/src/tests/procaptchaWidget.unit.test.ts +105 -171
- package/tsconfig.cjs.json +1 -2
- package/tsconfig.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/components/ProcaptchaPoW.cjs +0 -7
- package/dist/cjs/components/ProcaptchaWidget.cjs +0 -130
- package/dist/components/ProcaptchaPoW.d.ts +0 -3
- package/dist/components/ProcaptchaPoW.d.ts.map +0 -1
- package/dist/components/ProcaptchaPoW.js +0 -7
- package/dist/components/ProcaptchaPoW.js.map +0 -1
- package/dist/components/ProcaptchaWidget.d.ts +0 -4
- package/dist/components/ProcaptchaWidget.d.ts.map +0 -1
- package/dist/components/ProcaptchaWidget.js +0 -131
- package/dist/components/ProcaptchaWidget.js.map +0 -1
- package/src/components/ProcaptchaPoW.tsx +0 -39
- package/src/components/ProcaptchaWidget.tsx +0 -231
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-pow@2.
|
|
2
|
+
> @prosopo/procaptcha-pow@2.13.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: .
|
|
@@ -46,9 +46,9 @@ Bundle build started
|
|
|
46
46
|
✓ 5 modules transformed.
|
|
47
47
|
rendering chunks...
|
|
48
48
|
computing gzip size...
|
|
49
|
-
dist/cjs/index.cjs 0.
|
|
50
|
-
dist/cjs/components/
|
|
51
|
-
dist/cjs/components/
|
|
49
|
+
dist/cjs/index.cjs 0.43 kB │ gzip: 0.19 kB
|
|
50
|
+
dist/cjs/components/procaptchaPoW.cjs 0.71 kB │ gzip: 0.38 kB
|
|
51
|
+
dist/cjs/components/procaptchaWidget.cjs 5.07 kB │ gzip: 1.66 kB
|
|
52
52
|
dist/cjs/services/Manager.cjs 9.22 kB │ gzip: 2.61 kB
|
|
53
53
|
|
|
54
|
-
[32m✓ built in
|
|
54
|
+
[32m✓ built in 51ms[39m
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-pow@2.
|
|
2
|
+
> @prosopo/procaptcha-pow@2.13.1 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
3:28:51 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
|
-
* ../locale/tsconfig.json
|
|
8
7
|
* ../util/tsconfig.json
|
|
8
|
+
* ../locale/tsconfig.json
|
|
9
9
|
* ../util-crypto/tsconfig.json
|
|
10
10
|
* ../types/tsconfig.json
|
|
11
11
|
* ../api/tsconfig.json
|
|
@@ -20,37 +20,37 @@
|
|
|
20
20
|
* ../procaptcha-common/tsconfig.json
|
|
21
21
|
* tsconfig.json
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
3:28:51 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'
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
3:28:52 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
3:28:52 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
3:28:52 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
3:28:52 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'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
3:28:52 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
3:28:52 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/logger.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
3:28:52 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
3:28:52 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
3:28:52 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
3:28:52 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/tests/productionProviderList.unit.test.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
3:28:52 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'
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
3:28:52 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
3:28:52 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/index.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
3:28:52 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/extensionLoader.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
3:28:52 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
3:28:52 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json'...
|
|
56
56
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-pow@2.
|
|
2
|
+
> @prosopo/procaptcha-pow@2.13.1 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/procaptcha-pow@2.
|
|
6
|
+
> @prosopo/procaptcha-pow@2.13.1 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -51,9 +51,9 @@ Bundle build started
|
|
|
51
51
|
rendering chunks...
|
|
52
52
|
computing gzip size...
|
|
53
53
|
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
54
|
-
dist/index.js 0.
|
|
55
|
-
dist/components/
|
|
56
|
-
dist/components/
|
|
54
|
+
dist/index.js 0.27 kB │ gzip: 0.14 kB
|
|
55
|
+
dist/components/procaptchaPoW.js 0.63 kB │ gzip: 0.36 kB
|
|
56
|
+
dist/components/procaptchaWidget.js 4.82 kB │ gzip: 1.66 kB
|
|
57
57
|
dist/services/Manager.js 8.55 kB │ gzip: 2.57 kB
|
|
58
58
|
|
|
59
|
-
[32m✓ built in
|
|
59
|
+
[32m✓ built in 49ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# @prosopo/procaptcha-pow
|
|
2
2
|
|
|
3
|
+
## 2.13.1
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [94929c3]
|
|
7
|
+
- Updated dependencies [a9141c3]
|
|
8
|
+
- Updated dependencies [a9141c3]
|
|
9
|
+
- Updated dependencies [a9141c3]
|
|
10
|
+
- Updated dependencies [e180281]
|
|
11
|
+
- Updated dependencies [5e5fb9e]
|
|
12
|
+
- @prosopo/procaptcha-common@2.17.0
|
|
13
|
+
- @prosopo/locale@3.6.0
|
|
14
|
+
- @prosopo/common@3.1.59
|
|
15
|
+
- @prosopo/types@5.10.0
|
|
16
|
+
- @prosopo/util-crypto@13.5.33
|
|
17
|
+
- @prosopo/util@3.3.11
|
|
18
|
+
- @prosopo/widget-skeleton@2.9.0
|
|
19
|
+
- @prosopo/api@4.3.3
|
|
20
|
+
- @prosopo/fingerprint@2.7.52
|
|
21
|
+
|
|
22
|
+
## 2.13.0
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 59c02da: Replace React with vanilla TS/DOM in the widget.
|
|
26
|
+
|
|
27
|
+
The widget packages no longer depend on react, react-dom, @emotion or
|
|
28
|
+
react-i18next: every component is now a `mount*` function returning a handle
|
|
29
|
+
with `update`/`destroy`. `useTranslation` is replaced by `createTranslator`,
|
|
30
|
+
which exposes i18next's `t` plus the events that used to trigger a re-render.
|
|
31
|
+
The rendered markup, styling and behaviour are unchanged — only the
|
|
32
|
+
implementation is.
|
|
33
|
+
|
|
34
|
+
Everything the widget has gained since this rewrite started is carried over,
|
|
35
|
+
so nothing is lost by dropping React: the shared challenge surface (popup and
|
|
36
|
+
float placement, escape/outside-click dismissal and the dialog focus trap),
|
|
37
|
+
the image-tile and puzzle-piece keyboard paths, the checkbox's focus handover
|
|
38
|
+
across the loading swap, the server-rendered puzzle imagery, `startMode:
|
|
39
|
+
"manual"` with `window.procaptcha.start()`, `data-bind` / targeted
|
|
40
|
+
`execute(widgetId)`, the Web Bot Auth "authenticated" badge, the client
|
|
41
|
+
session id, and the bounded session re-mint and reload handling in the
|
|
42
|
+
frictionless wrapper.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [59c02da]
|
|
47
|
+
- @prosopo/procaptcha-common@2.16.0
|
|
48
|
+
- @prosopo/locale@3.5.0
|
|
49
|
+
- @prosopo/common@3.1.58
|
|
50
|
+
- @prosopo/types@5.9.2
|
|
51
|
+
- @prosopo/api@4.3.2
|
|
52
|
+
- @prosopo/fingerprint@2.7.51
|
|
53
|
+
|
|
54
|
+
## 2.12.8
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [a22069d]
|
|
58
|
+
- @prosopo/types@5.9.1
|
|
59
|
+
- @prosopo/locale@3.4.4
|
|
60
|
+
- @prosopo/api@4.3.1
|
|
61
|
+
- @prosopo/common@3.1.57
|
|
62
|
+
- @prosopo/fingerprint@2.7.50
|
|
63
|
+
- @prosopo/procaptcha-common@2.15.1
|
|
64
|
+
|
|
3
65
|
## 2.12.7
|
|
4
66
|
### Patch Changes
|
|
5
67
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/components/procaptchaPoW.ts
|
|
2
|
+
/**
|
|
3
|
+
* Dynamic import so the PoW widget lands in its own chunk, replacing the
|
|
4
|
+
* `lazy()` + `<Suspense>` pair that used to provide the split.
|
|
5
|
+
*/
|
|
6
|
+
var loadProcaptchaPow = async () => (await Promise.resolve().then(() => require("./procaptchaWidget.cjs"))).mountProcaptchaPowWidget;
|
|
7
|
+
var mountProcaptchaPow = (container, props) => {
|
|
8
|
+
let destroyed = false;
|
|
9
|
+
let inner;
|
|
10
|
+
loadProcaptchaPow().then((mount) => {
|
|
11
|
+
if (destroyed) return;
|
|
12
|
+
inner = mount(container, props);
|
|
13
|
+
});
|
|
14
|
+
return { destroy: () => {
|
|
15
|
+
destroyed = true;
|
|
16
|
+
inner?.destroy();
|
|
17
|
+
inner = void 0;
|
|
18
|
+
} };
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.loadProcaptchaPow = loadProcaptchaPow;
|
|
22
|
+
exports.mountProcaptchaPow = mountProcaptchaPow;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const require_Manager = require("../services/Manager.cjs");
|
|
2
|
+
let _prosopo_locale = require("@prosopo/locale");
|
|
3
|
+
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
4
|
+
let _prosopo_types = require("@prosopo/types");
|
|
5
|
+
let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
|
|
6
|
+
//#region src/components/procaptchaWidget.ts
|
|
7
|
+
var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
|
|
8
|
+
var mountProcaptchaPowWidget = (container, props) => {
|
|
9
|
+
const teardown = new _prosopo_procaptcha_common.Teardown();
|
|
10
|
+
const config = props.config;
|
|
11
|
+
const i18n = props.i18n;
|
|
12
|
+
const frictionlessState = props.frictionlessState;
|
|
13
|
+
const callbacks = props.callbacks || {};
|
|
14
|
+
const translator = (0, _prosopo_locale.createTranslator)(i18n);
|
|
15
|
+
const isInvisible = _prosopo_types.ModeEnum.invisible === config.mode;
|
|
16
|
+
const store = (0, _prosopo_procaptcha_common.createProcaptchaState)();
|
|
17
|
+
let loading = false;
|
|
18
|
+
let lastError = store.state.error;
|
|
19
|
+
let lastCoords = null;
|
|
20
|
+
let sessionInvalidatedFired = false;
|
|
21
|
+
let executeRunning = false;
|
|
22
|
+
let honeypot;
|
|
23
|
+
let checkbox;
|
|
24
|
+
const updateState = (0, _prosopo_procaptcha_common.buildUpdateState)(store.state, store.update);
|
|
25
|
+
const manager = require_Manager.Manager(config, store.state, updateState, callbacks, frictionlessState, props.onEscalate, () => honeypot?.getValue());
|
|
26
|
+
const root = (0, _prosopo_procaptcha_common.createElement)("div");
|
|
27
|
+
container.appendChild(root);
|
|
28
|
+
if (frictionlessState?.hp) honeypot = (0, _prosopo_procaptcha_common.mountHoneypot)(root, { encodedQuestion: frictionlessState.hp });
|
|
29
|
+
const runErrorEffect = () => {
|
|
30
|
+
if (store.state.error === lastError) return;
|
|
31
|
+
lastError = store.state.error;
|
|
32
|
+
if (!store.state.error) return;
|
|
33
|
+
loading = false;
|
|
34
|
+
if ("CAPTCHA.NO_SESSION_FOUND" !== store.state.error.key) return;
|
|
35
|
+
if (props.onSessionInvalidated && !sessionInvalidatedFired) {
|
|
36
|
+
sessionInvalidatedFired = true;
|
|
37
|
+
props.onSessionInvalidated(lastCoords?.x, lastCoords?.y);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (frictionlessState) {
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
frictionlessState.restart();
|
|
43
|
+
}, 100);
|
|
44
|
+
teardown.add(() => clearTimeout(timer));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const render = () => {
|
|
48
|
+
runErrorEffect();
|
|
49
|
+
checkbox?.update(checkboxProps());
|
|
50
|
+
};
|
|
51
|
+
const scheduler = (0, _prosopo_procaptcha_common.createRenderScheduler)(render);
|
|
52
|
+
const checkboxProps = () => ({
|
|
53
|
+
checked: store.state.isHuman,
|
|
54
|
+
theme: "light" === config.theme ? _prosopo_widget_skeleton.lightTheme : _prosopo_widget_skeleton.darkTheme,
|
|
55
|
+
labelText: translator.isReady() ? translator.t("WIDGET.I_AM_HUMAN") : "",
|
|
56
|
+
error: store.state.error?.message,
|
|
57
|
+
loadingText: translator.t("WIDGET.CHECKING", { defaultValue: "Checking that you are human" }),
|
|
58
|
+
loading,
|
|
59
|
+
onChange: async (event) => {
|
|
60
|
+
if (loading) return;
|
|
61
|
+
loading = true;
|
|
62
|
+
scheduler.schedule();
|
|
63
|
+
let x = 0;
|
|
64
|
+
let y = 0;
|
|
65
|
+
if (!(0, _prosopo_procaptcha_common.isEventTrusted)(event)) {} else if ("touches" in event && event.touches.length > 0) {
|
|
66
|
+
const touch = event.touches[0];
|
|
67
|
+
if (touch) {
|
|
68
|
+
x = touch.clientX;
|
|
69
|
+
y = touch.clientY;
|
|
70
|
+
}
|
|
71
|
+
} else if ("clientX" in event && "clientY" in event) {
|
|
72
|
+
x = event.clientX;
|
|
73
|
+
y = event.clientY;
|
|
74
|
+
}
|
|
75
|
+
lastCoords = {
|
|
76
|
+
x,
|
|
77
|
+
y
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
await manager.start(x, y);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error("Error starting PoW verification:", error);
|
|
83
|
+
}
|
|
84
|
+
loading = false;
|
|
85
|
+
scheduler.schedule();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (!isInvisible) checkbox = (0, _prosopo_procaptcha_common.mountCheckbox)(root, checkboxProps());
|
|
89
|
+
teardown.add(scheduler.cancel);
|
|
90
|
+
teardown.add(store.subscribe(scheduler.schedule));
|
|
91
|
+
teardown.add(translator.subscribe(scheduler.schedule));
|
|
92
|
+
const handleExecute = () => {
|
|
93
|
+
if (executeRunning) return;
|
|
94
|
+
executeRunning = true;
|
|
95
|
+
if (!isInvisible) {
|
|
96
|
+
loading = true;
|
|
97
|
+
scheduler.schedule();
|
|
98
|
+
}
|
|
99
|
+
const logError = (error) => {
|
|
100
|
+
console.error("Error starting PoW verification:", error);
|
|
101
|
+
};
|
|
102
|
+
const done = () => {
|
|
103
|
+
executeRunning = false;
|
|
104
|
+
if (!isInvisible) {
|
|
105
|
+
loading = false;
|
|
106
|
+
scheduler.schedule();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
try {
|
|
110
|
+
manager.start().catch(logError).finally(done);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
logError(error);
|
|
113
|
+
done();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
if (props.container) teardown.addEventListener(props.container, PROCAPTCHA_EXECUTE_EVENT, handleExecute);
|
|
117
|
+
if (isInvisible) teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, handleExecute);
|
|
118
|
+
if (config.language) if (i18n) {
|
|
119
|
+
if (i18n.language !== config.language) i18n.changeLanguage(config.language);
|
|
120
|
+
} else (0, _prosopo_locale.loadI18next)(false, config.language);
|
|
121
|
+
if (props.autoStart) {
|
|
122
|
+
loading = true;
|
|
123
|
+
const coords = props.startCoords;
|
|
124
|
+
lastCoords = coords ?? null;
|
|
125
|
+
scheduler.schedule();
|
|
126
|
+
manager.start(coords?.x ?? 0, coords?.y ?? 0).catch((error) => {
|
|
127
|
+
console.error("Error starting PoW verification:", error);
|
|
128
|
+
}).finally(() => {
|
|
129
|
+
loading = false;
|
|
130
|
+
scheduler.schedule();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
render();
|
|
134
|
+
return { destroy: () => {
|
|
135
|
+
teardown.run();
|
|
136
|
+
checkbox?.destroy();
|
|
137
|
+
honeypot?.destroy();
|
|
138
|
+
root.parentNode?.removeChild(root);
|
|
139
|
+
} };
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
exports.default = mountProcaptchaPowWidget;
|
|
143
|
+
exports.mountProcaptchaPowWidget = mountProcaptchaPowWidget;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
2
|
+
const require_procaptchaWidget = require("./components/procaptchaWidget.cjs");
|
|
3
|
+
const require_procaptchaPoW = require("./components/procaptchaPoW.cjs");
|
|
4
|
+
exports.loadProcaptchaPow = require_procaptchaPoW.loadProcaptchaPow;
|
|
5
|
+
exports.mountProcaptchaPow = require_procaptchaPoW.mountProcaptchaPow;
|
|
6
|
+
exports.mountProcaptchaPowWidget = require_procaptchaWidget.default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProcaptchaProps } from "@prosopo/types";
|
|
2
|
+
import type { ProcaptchaPowHandle } from "./procaptchaWidget.js";
|
|
3
|
+
export type { ProcaptchaPowHandle };
|
|
4
|
+
export type ProcaptchaPowMountFn = (container: HTMLElement, props: ProcaptchaProps) => ProcaptchaPowHandle;
|
|
5
|
+
export declare const loadProcaptchaPow: () => Promise<ProcaptchaPowMountFn>;
|
|
6
|
+
export declare const mountProcaptchaPow: (container: HTMLElement, props: ProcaptchaProps) => ProcaptchaPowHandle;
|
|
7
|
+
//# sourceMappingURL=procaptchaPoW.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaPoW.d.ts","sourceRoot":"","sources":["../../src/components/procaptchaPoW.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAAG,CAClC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,eAAe,KAClB,mBAAmB,CAAC;AAMzB,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,oBAAoB,CACN,CAAC;AAElE,eAAO,MAAM,kBAAkB,cACnB,WAAW,SACf,eAAe,KACpB,mBAkBF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/components/procaptchaPoW.ts
|
|
2
|
+
/**
|
|
3
|
+
* Dynamic import so the PoW widget lands in its own chunk, replacing the
|
|
4
|
+
* `lazy()` + `<Suspense>` pair that used to provide the split.
|
|
5
|
+
*/
|
|
6
|
+
var loadProcaptchaPow = async () => (await import("./procaptchaWidget.js")).mountProcaptchaPowWidget;
|
|
7
|
+
var mountProcaptchaPow = (container, props) => {
|
|
8
|
+
let destroyed = false;
|
|
9
|
+
let inner;
|
|
10
|
+
loadProcaptchaPow().then((mount) => {
|
|
11
|
+
if (destroyed) return;
|
|
12
|
+
inner = mount(container, props);
|
|
13
|
+
});
|
|
14
|
+
return { destroy: () => {
|
|
15
|
+
destroyed = true;
|
|
16
|
+
inner?.destroy();
|
|
17
|
+
inner = void 0;
|
|
18
|
+
} };
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { loadProcaptchaPow, mountProcaptchaPow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaPoW.js","sourceRoot":"","sources":["../../src/components/procaptchaPoW.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAmC,EAAE,CAC1E,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC,wBAAwB,CAAC;AAElE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,SAAsB,EACtB,KAAsB,EACA,EAAE;IACxB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,KAAsC,CAAC;IAE3C,KAAK,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,KAA2B,EAAE,EAAE;QAC7D,IAAI,SAAS,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QACD,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,OAAO,EAAE,GAAG,EAAE;YACb,SAAS,GAAG,IAAI,CAAC;YACjB,KAAK,EAAE,OAAO,EAAE,CAAC;YACjB,KAAK,GAAG,SAAS,CAAC;QACnB,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ProcaptchaProps } from "@prosopo/types";
|
|
2
|
+
export interface ProcaptchaPowHandle {
|
|
3
|
+
destroy(): void;
|
|
4
|
+
}
|
|
5
|
+
export declare const mountProcaptchaPowWidget: (container: HTMLElement, props: ProcaptchaProps) => ProcaptchaPowHandle;
|
|
6
|
+
export default mountProcaptchaPowWidget;
|
|
7
|
+
//# sourceMappingURL=procaptchaWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaWidget.d.ts","sourceRoot":"","sources":["../../src/components/procaptchaWidget.ts"],"names":[],"mappings":"AA6BA,OAAO,EAEN,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,mBAAmB;IACnC,OAAO,IAAI,IAAI,CAAC;CAChB;AAED,eAAO,MAAM,wBAAwB,cACzB,WAAW,SACf,eAAe,KACpB,mBAuOF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { Manager } from "../services/Manager.js";
|
|
3
|
+
import { createTranslator, loadI18next } from "@prosopo/locale";
|
|
4
|
+
import { Teardown, buildUpdateState, createElement, createProcaptchaState, createRenderScheduler, isEventTrusted, mountCheckbox, mountHoneypot } from "@prosopo/procaptcha-common";
|
|
5
|
+
import { ModeEnum } from "@prosopo/types";
|
|
6
|
+
import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
|
|
7
|
+
//#region src/components/procaptchaWidget.ts
|
|
8
|
+
var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
|
|
9
|
+
var mountProcaptchaPowWidget = (container, props) => {
|
|
10
|
+
const teardown = new Teardown();
|
|
11
|
+
const config = props.config;
|
|
12
|
+
const i18n = props.i18n;
|
|
13
|
+
const frictionlessState = props.frictionlessState;
|
|
14
|
+
const callbacks = props.callbacks || {};
|
|
15
|
+
const translator = createTranslator(i18n);
|
|
16
|
+
const isInvisible = ModeEnum.invisible === config.mode;
|
|
17
|
+
const store = createProcaptchaState();
|
|
18
|
+
let loading = false;
|
|
19
|
+
let lastError = store.state.error;
|
|
20
|
+
let lastCoords = null;
|
|
21
|
+
let sessionInvalidatedFired = false;
|
|
22
|
+
let executeRunning = false;
|
|
23
|
+
let honeypot;
|
|
24
|
+
let checkbox;
|
|
25
|
+
const updateState = buildUpdateState(store.state, store.update);
|
|
26
|
+
const manager = Manager(config, store.state, updateState, callbacks, frictionlessState, props.onEscalate, () => honeypot?.getValue());
|
|
27
|
+
const root = createElement("div");
|
|
28
|
+
container.appendChild(root);
|
|
29
|
+
if (frictionlessState?.hp) honeypot = mountHoneypot(root, { encodedQuestion: frictionlessState.hp });
|
|
30
|
+
const runErrorEffect = () => {
|
|
31
|
+
if (store.state.error === lastError) return;
|
|
32
|
+
lastError = store.state.error;
|
|
33
|
+
if (!store.state.error) return;
|
|
34
|
+
loading = false;
|
|
35
|
+
if ("CAPTCHA.NO_SESSION_FOUND" !== store.state.error.key) return;
|
|
36
|
+
if (props.onSessionInvalidated && !sessionInvalidatedFired) {
|
|
37
|
+
sessionInvalidatedFired = true;
|
|
38
|
+
props.onSessionInvalidated(lastCoords?.x, lastCoords?.y);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (frictionlessState) {
|
|
42
|
+
const timer = setTimeout(() => {
|
|
43
|
+
frictionlessState.restart();
|
|
44
|
+
}, 100);
|
|
45
|
+
teardown.add(() => clearTimeout(timer));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const render = () => {
|
|
49
|
+
runErrorEffect();
|
|
50
|
+
checkbox?.update(checkboxProps());
|
|
51
|
+
};
|
|
52
|
+
const scheduler = createRenderScheduler(render);
|
|
53
|
+
const checkboxProps = () => ({
|
|
54
|
+
checked: store.state.isHuman,
|
|
55
|
+
theme: "light" === config.theme ? lightTheme : darkTheme,
|
|
56
|
+
labelText: translator.isReady() ? translator.t("WIDGET.I_AM_HUMAN") : "",
|
|
57
|
+
error: store.state.error?.message,
|
|
58
|
+
loadingText: translator.t("WIDGET.CHECKING", { defaultValue: "Checking that you are human" }),
|
|
59
|
+
loading,
|
|
60
|
+
onChange: async (event) => {
|
|
61
|
+
if (loading) return;
|
|
62
|
+
loading = true;
|
|
63
|
+
scheduler.schedule();
|
|
64
|
+
let x = 0;
|
|
65
|
+
let y = 0;
|
|
66
|
+
if (!isEventTrusted(event)) {} else if ("touches" in event && event.touches.length > 0) {
|
|
67
|
+
const touch = event.touches[0];
|
|
68
|
+
if (touch) {
|
|
69
|
+
x = touch.clientX;
|
|
70
|
+
y = touch.clientY;
|
|
71
|
+
}
|
|
72
|
+
} else if ("clientX" in event && "clientY" in event) {
|
|
73
|
+
x = event.clientX;
|
|
74
|
+
y = event.clientY;
|
|
75
|
+
}
|
|
76
|
+
lastCoords = {
|
|
77
|
+
x,
|
|
78
|
+
y
|
|
79
|
+
};
|
|
80
|
+
try {
|
|
81
|
+
await manager.start(x, y);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error("Error starting PoW verification:", error);
|
|
84
|
+
}
|
|
85
|
+
loading = false;
|
|
86
|
+
scheduler.schedule();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if (!isInvisible) checkbox = mountCheckbox(root, checkboxProps());
|
|
90
|
+
teardown.add(scheduler.cancel);
|
|
91
|
+
teardown.add(store.subscribe(scheduler.schedule));
|
|
92
|
+
teardown.add(translator.subscribe(scheduler.schedule));
|
|
93
|
+
const handleExecute = () => {
|
|
94
|
+
if (executeRunning) return;
|
|
95
|
+
executeRunning = true;
|
|
96
|
+
if (!isInvisible) {
|
|
97
|
+
loading = true;
|
|
98
|
+
scheduler.schedule();
|
|
99
|
+
}
|
|
100
|
+
const logError = (error) => {
|
|
101
|
+
console.error("Error starting PoW verification:", error);
|
|
102
|
+
};
|
|
103
|
+
const done = () => {
|
|
104
|
+
executeRunning = false;
|
|
105
|
+
if (!isInvisible) {
|
|
106
|
+
loading = false;
|
|
107
|
+
scheduler.schedule();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
try {
|
|
111
|
+
manager.start().catch(logError).finally(done);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
logError(error);
|
|
114
|
+
done();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
if (props.container) teardown.addEventListener(props.container, PROCAPTCHA_EXECUTE_EVENT, handleExecute);
|
|
118
|
+
if (isInvisible) teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, handleExecute);
|
|
119
|
+
if (config.language) if (i18n) {
|
|
120
|
+
if (i18n.language !== config.language) i18n.changeLanguage(config.language);
|
|
121
|
+
} else loadI18next(false, config.language);
|
|
122
|
+
if (props.autoStart) {
|
|
123
|
+
loading = true;
|
|
124
|
+
const coords = props.startCoords;
|
|
125
|
+
lastCoords = coords ?? null;
|
|
126
|
+
scheduler.schedule();
|
|
127
|
+
manager.start(coords?.x ?? 0, coords?.y ?? 0).catch((error) => {
|
|
128
|
+
console.error("Error starting PoW verification:", error);
|
|
129
|
+
}).finally(() => {
|
|
130
|
+
loading = false;
|
|
131
|
+
scheduler.schedule();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
render();
|
|
135
|
+
return { destroy: () => {
|
|
136
|
+
teardown.run();
|
|
137
|
+
checkbox?.destroy();
|
|
138
|
+
honeypot?.destroy();
|
|
139
|
+
root.parentNode?.removeChild(root);
|
|
140
|
+
} };
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
export { mountProcaptchaPowWidget as default, mountProcaptchaPowWidget };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaWidget.js","sourceRoot":"","sources":["../../src/components/procaptchaWidget.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAKN,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,QAAQ,GAGR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAMtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACvC,SAAsB,EACtB,KAAsB,EACA,EAAE;IACxB,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAC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GAAG,EAAE;YACb,QAAQ,CAAC,GAAG,EAAE,CAAC;YACf,QAAQ,EAAE,OAAO,EAAE,CAAC;YACpB,QAAQ,EAAE,OAAO,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./components/
|
|
2
|
-
export * from "./components/
|
|
1
|
+
export * from "./components/procaptchaWidget.js";
|
|
2
|
+
export * from "./components/procaptchaPoW.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import mountProcaptchaPowWidget from "./components/procaptchaWidget.js";
|
|
3
|
+
import { loadProcaptchaPow, mountProcaptchaPow } from "./components/procaptchaPoW.js";
|
|
4
|
+
export { loadProcaptchaPow, mountProcaptchaPow, mountProcaptchaPowWidget };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Mounted {
|
|
2
|
+
container: HTMLDivElement;
|
|
3
|
+
unmount: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const mount: () => Mounted;
|
|
6
|
+
interface FireOptions {
|
|
7
|
+
trusted?: boolean;
|
|
8
|
+
clientX?: number;
|
|
9
|
+
clientY?: number;
|
|
10
|
+
touches?: {
|
|
11
|
+
clientX: number;
|
|
12
|
+
clientY: number;
|
|
13
|
+
}[];
|
|
14
|
+
key?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const fire: (element: Element, type: string, options?: FireOptions) => void;
|
|
17
|
+
export declare const fireAndReturn: (element: Element, type: string, options?: FireOptions) => Event;
|
|
18
|
+
export declare const settle: () => Promise<void>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=domHarness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domHarness.d.ts","sourceRoot":"","sources":["../../src/tests/domHarness.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,OAAO;IACvB,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,KAAK,QAAO,OASxB,CAAC;AAEF,UAAU,WAAW;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AA8CD,eAAO,MAAM,IAAI,YACP,OAAO,QACV,MAAM,YACH,WAAW,KAClB,IAEF,CAAC;AAIF,eAAO,MAAM,aAAa,YAChB,OAAO,QACV,MAAM,YACH,WAAW,KAClB,KAQF,CAAC;AAMF,eAAO,MAAM,MAAM,QAAa,OAAO,CAAC,IAAI,CAK3C,CAAC"}
|