@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
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
const require_authenticatedBadge = require("./authenticatedBadge.cjs");
|
|
2
|
+
const require_customDetectBot = require("./customDetectBot.cjs");
|
|
3
|
+
const require_frictionlessResultGuard = require("./frictionlessResultGuard.cjs");
|
|
4
|
+
const require_sessionInvalidatedRecovery = require("./sessionInvalidatedRecovery.cjs");
|
|
5
|
+
let _prosopo_locale = require("@prosopo/locale");
|
|
6
|
+
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
7
|
+
let _prosopo_types = require("@prosopo/types");
|
|
8
|
+
let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
|
|
9
|
+
//#region src/procaptchaFrictionless.ts
|
|
10
|
+
var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
|
|
11
|
+
var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
|
|
12
|
+
var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).mountProcaptchaImageWidget;
|
|
13
|
+
var ProcaptchaPuzzleLoader = async () => (await import("@prosopo/procaptcha-puzzle")).mountProcaptchaPuzzleWidget;
|
|
14
|
+
var ProcaptchaPowLoader = async () => (await import("@prosopo/procaptcha-pow")).mountProcaptchaPowWidget;
|
|
15
|
+
var defaultLoadingState = (attemptCount) => ({
|
|
16
|
+
loading: false,
|
|
17
|
+
attemptCount
|
|
18
|
+
});
|
|
19
|
+
var mountProcaptchaFrictionless = (container, props) => {
|
|
20
|
+
const { config, callbacks, restart, i18n, detectBot = require_customDetectBot.default, container: widgetContainer } = props;
|
|
21
|
+
const teardown = new _prosopo_procaptcha_common.Teardown();
|
|
22
|
+
const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
|
|
23
|
+
let state = defaultLoadingState(0);
|
|
24
|
+
let destroyed = false;
|
|
25
|
+
const pendingRetryCoords = { current: null };
|
|
26
|
+
const sessionInvalidatedAttempts = { current: 0 };
|
|
27
|
+
const escalatedSessionIds = /* @__PURE__ */ new Set();
|
|
28
|
+
let nextMountAutoStart = false;
|
|
29
|
+
const manualStart = _prosopo_types.StartModeEnum.manual === config.startMode;
|
|
30
|
+
let manualStarted = false;
|
|
31
|
+
let pendingExecute = false;
|
|
32
|
+
const banner = (0, _prosopo_procaptcha_common.mountTestModeBanner)(container, { siteKey: config.account?.address ?? "" });
|
|
33
|
+
const slot = (0, _prosopo_procaptcha_common.createElement)("div");
|
|
34
|
+
container.appendChild(slot);
|
|
35
|
+
let solver;
|
|
36
|
+
let placeholder;
|
|
37
|
+
const clearSlot = () => {
|
|
38
|
+
solver?.destroy();
|
|
39
|
+
solver = void 0;
|
|
40
|
+
placeholder?.destroy();
|
|
41
|
+
placeholder = void 0;
|
|
42
|
+
(0, _prosopo_procaptcha_common.clearElement)(slot);
|
|
43
|
+
};
|
|
44
|
+
const renderPlaceholder = (mode, errorMessage, loading, onChange) => {
|
|
45
|
+
clearSlot();
|
|
46
|
+
if ("invisible" === mode) return;
|
|
47
|
+
placeholder = (0, _prosopo_procaptcha_common.mountCheckbox)(slot, {
|
|
48
|
+
theme: "light" === config.theme ? _prosopo_widget_skeleton.lightTheme : _prosopo_widget_skeleton.darkTheme,
|
|
49
|
+
onChange: onChange ?? (() => void 0),
|
|
50
|
+
checked: false,
|
|
51
|
+
labelText: i18n.isInitialized ? i18n.t("WIDGET.I_AM_HUMAN") : "",
|
|
52
|
+
error: errorMessage,
|
|
53
|
+
loadingText: i18n.isInitialized ? i18n.t("WIDGET.CHECKING") : void 0,
|
|
54
|
+
loading
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const resetState = (attemptCount) => {
|
|
58
|
+
state = defaultLoadingState(attemptCount ?? state.attemptCount);
|
|
59
|
+
};
|
|
60
|
+
const restartComponentTimeout = () => {
|
|
61
|
+
const timer = setTimeout(() => {
|
|
62
|
+
resetState(0);
|
|
63
|
+
events.onReset();
|
|
64
|
+
restart();
|
|
65
|
+
}, 1e4);
|
|
66
|
+
teardown.add(() => clearTimeout(timer));
|
|
67
|
+
};
|
|
68
|
+
const fallOverWithStyle = (errorMessage, errorKey) => {
|
|
69
|
+
if ("CAPTCHA.NO_SESSION_FOUND" === errorKey) {
|
|
70
|
+
const timer = setTimeout(() => {
|
|
71
|
+
restartComponentTimeout();
|
|
72
|
+
}, 0);
|
|
73
|
+
teardown.add(() => clearTimeout(timer));
|
|
74
|
+
}
|
|
75
|
+
renderPlaceholder(config.mode, errorMessage || "Cannot load CAPTCHA", false);
|
|
76
|
+
};
|
|
77
|
+
const replayPendingExecute = () => {
|
|
78
|
+
if (!pendingExecute) return;
|
|
79
|
+
pendingExecute = false;
|
|
80
|
+
(widgetContainer ?? document).dispatchEvent(new CustomEvent(PROCAPTCHA_EXECUTE_EVENT));
|
|
81
|
+
};
|
|
82
|
+
const renderForCaptchaType = async (captchaType, frictionlessState, autoStart = false, escalationCoords) => {
|
|
83
|
+
const onEscalate = (next, newSessionId, coords) => {
|
|
84
|
+
if (escalatedSessionIds.has(newSessionId)) return;
|
|
85
|
+
escalatedSessionIds.add(newSessionId);
|
|
86
|
+
renderForCaptchaType(next, {
|
|
87
|
+
...frictionlessState,
|
|
88
|
+
sessionId: newSessionId
|
|
89
|
+
}, true, coords);
|
|
90
|
+
};
|
|
91
|
+
const onSessionInvalidated = (x, y) => {
|
|
92
|
+
const { shouldRestart } = require_sessionInvalidatedRecovery.handleSessionInvalidated(x, y, sessionInvalidatedAttempts, pendingRetryCoords);
|
|
93
|
+
if (shouldRestart) {
|
|
94
|
+
resetState(0);
|
|
95
|
+
start();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
|
|
99
|
+
events.onError(new Error(message));
|
|
100
|
+
fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
|
|
101
|
+
};
|
|
102
|
+
const onReload = (x, y) => {
|
|
103
|
+
pendingRetryCoords.current = require_sessionInvalidatedRecovery.normaliseRetryCoords(x, y);
|
|
104
|
+
nextMountAutoStart = true;
|
|
105
|
+
sessionInvalidatedAttempts.current = 0;
|
|
106
|
+
resetState(0);
|
|
107
|
+
start();
|
|
108
|
+
};
|
|
109
|
+
const forcedAutoStart = nextMountAutoStart;
|
|
110
|
+
nextMountAutoStart = false;
|
|
111
|
+
const { autoStart: resumedAutoStart, startCoords: retryStartCoords } = require_sessionInvalidatedRecovery.consumeRetryMountProps(pendingRetryCoords, autoStart || forcedAutoStart);
|
|
112
|
+
const widgetProps = {
|
|
113
|
+
config,
|
|
114
|
+
callbacks,
|
|
115
|
+
frictionlessState,
|
|
116
|
+
i18n,
|
|
117
|
+
autoStart: resumedAutoStart,
|
|
118
|
+
startCoords: escalationCoords ?? retryStartCoords,
|
|
119
|
+
onSessionInvalidated,
|
|
120
|
+
container: widgetContainer
|
|
121
|
+
};
|
|
122
|
+
if (_prosopo_types.CaptchaType.authenticated === captchaType) {
|
|
123
|
+
if (!frictionlessState.sessionId) {
|
|
124
|
+
events.onError(/* @__PURE__ */ new Error("authenticated captcha response missing sessionId — provider is misbehaving"));
|
|
125
|
+
fallOverWithStyle();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
clearSlot();
|
|
129
|
+
solver = require_authenticatedBadge.mountAuthenticatedBadge(slot, {
|
|
130
|
+
sessionId: frictionlessState.sessionId,
|
|
131
|
+
agent: frictionlessState.agent,
|
|
132
|
+
dapp: config.account.address ?? "",
|
|
133
|
+
userAccount: frictionlessState.userAccount,
|
|
134
|
+
provider: frictionlessState.provider,
|
|
135
|
+
callbacks
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (_prosopo_types.CaptchaType.image === captchaType) {
|
|
140
|
+
const mount = await ProcaptchaLoader();
|
|
141
|
+
if (destroyed) return;
|
|
142
|
+
clearSlot();
|
|
143
|
+
solver = mount(slot, {
|
|
144
|
+
...widgetProps,
|
|
145
|
+
onReload
|
|
146
|
+
});
|
|
147
|
+
replayPendingExecute();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (_prosopo_types.CaptchaType.puzzle === captchaType) {
|
|
151
|
+
const mount = await ProcaptchaPuzzleLoader();
|
|
152
|
+
if (destroyed) return;
|
|
153
|
+
clearSlot();
|
|
154
|
+
solver = mount(slot, widgetProps);
|
|
155
|
+
replayPendingExecute();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const mount = await ProcaptchaPowLoader();
|
|
159
|
+
if (destroyed) return;
|
|
160
|
+
clearSlot();
|
|
161
|
+
solver = mount(slot, {
|
|
162
|
+
...widgetProps,
|
|
163
|
+
onEscalate
|
|
164
|
+
});
|
|
165
|
+
replayPendingExecute();
|
|
166
|
+
};
|
|
167
|
+
const start = async () => {
|
|
168
|
+
if (!(0, _prosopo_procaptcha_common.isSecureBrowserContext)()) {
|
|
169
|
+
const errorMessage = i18n.isInitialized ? i18n.t("WIDGET.INSECURE_CONTEXT") : "Procaptcha requires a secure (HTTPS) connection";
|
|
170
|
+
events.onError(new Error(errorMessage));
|
|
171
|
+
fallOverWithStyle(errorMessage, "WIDGET.INSECURE_CONTEXT");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
await (0, _prosopo_procaptcha_common.providerRetry)(async () => {
|
|
175
|
+
state.attemptCount += 1;
|
|
176
|
+
const configOutput = _prosopo_types.ProcaptchaConfigSchema.parse(config);
|
|
177
|
+
const result = await detectBot(configOutput, widgetContainer, restart, { attempt: state.attemptCount });
|
|
178
|
+
const guard = require_frictionlessResultGuard.evaluateFrictionlessResult(result);
|
|
179
|
+
if ("error" === guard.kind) {
|
|
180
|
+
if (guard.retryable) throw new Error(guard.message);
|
|
181
|
+
state = {
|
|
182
|
+
...state,
|
|
183
|
+
loading: false,
|
|
184
|
+
errorMessage: guard.message
|
|
185
|
+
};
|
|
186
|
+
events.onError(new Error(guard.message));
|
|
187
|
+
fallOverWithStyle(guard.message, guard.key);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const frictionlessState = {
|
|
191
|
+
provider: result.provider,
|
|
192
|
+
sessionId: result.sessionId,
|
|
193
|
+
userAccount: result.userAccount,
|
|
194
|
+
restart,
|
|
195
|
+
behaviorCollector1: result.behaviorCollector1,
|
|
196
|
+
behaviorCollector2: result.behaviorCollector2,
|
|
197
|
+
behaviorCollector3: result.behaviorCollector3,
|
|
198
|
+
deviceCapability: result.deviceCapability,
|
|
199
|
+
encryptBehavioralData: result.encryptBehavioralData,
|
|
200
|
+
getSimdReadings: result.getSimdReadings,
|
|
201
|
+
hp: result.hp,
|
|
202
|
+
agent: result.agent
|
|
203
|
+
};
|
|
204
|
+
await renderForCaptchaType(result.captchaType, frictionlessState);
|
|
205
|
+
state = {
|
|
206
|
+
...state,
|
|
207
|
+
loading: false
|
|
208
|
+
};
|
|
209
|
+
}, start, resetState, state.attemptCount, 5).finally(() => {
|
|
210
|
+
if (state.attemptCount >= 5) {
|
|
211
|
+
events.onError(/* @__PURE__ */ new Error("Cannot load CAPTCHA"));
|
|
212
|
+
fallOverWithStyle();
|
|
213
|
+
restartComponentTimeout();
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* `startMode: "manual"` defers the whole frictionless flow until the site
|
|
219
|
+
* (or the user, via the placeholder checkbox) asks for it. One-shot: the
|
|
220
|
+
* flow runs at most once per widget lifetime, however many triggers fire.
|
|
221
|
+
*/
|
|
222
|
+
const startManually = async (autoStart, coords) => {
|
|
223
|
+
if (manualStarted) return;
|
|
224
|
+
manualStarted = true;
|
|
225
|
+
pendingRetryCoords.current = coords ?? null;
|
|
226
|
+
nextMountAutoStart = autoStart;
|
|
227
|
+
renderPlaceholder(config.mode, state.errorMessage, true);
|
|
228
|
+
await start();
|
|
229
|
+
};
|
|
230
|
+
if (config.language) if (i18n) {
|
|
231
|
+
if (i18n.language !== config.language) i18n.changeLanguage(config.language);
|
|
232
|
+
} else (0, _prosopo_locale.loadI18next)(false, config.language);
|
|
233
|
+
const manualCheckboxHandler = async (event) => {
|
|
234
|
+
let x = 0;
|
|
235
|
+
let y = 0;
|
|
236
|
+
if ("clientX" in event && "clientY" in event) {
|
|
237
|
+
x = event.clientX;
|
|
238
|
+
y = event.clientY;
|
|
239
|
+
}
|
|
240
|
+
await startManually(true, require_sessionInvalidatedRecovery.normaliseRetryCoords(x, y) ?? void 0);
|
|
241
|
+
};
|
|
242
|
+
renderPlaceholder(config.mode, state.errorMessage, !manualStart, manualStart ? manualCheckboxHandler : void 0);
|
|
243
|
+
if (manualStart) {
|
|
244
|
+
teardown.addEventListener(document, _prosopo_types.PROCAPTCHA_START_EVENT, (event) => {
|
|
245
|
+
const detail = event.detail;
|
|
246
|
+
if (detail?.element && widgetContainer && !detail.element.contains(widgetContainer)) return;
|
|
247
|
+
startManually(false);
|
|
248
|
+
});
|
|
249
|
+
teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, () => {
|
|
250
|
+
startManually(true);
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
const holdExecute = () => {
|
|
254
|
+
if (!solver) pendingExecute = true;
|
|
255
|
+
};
|
|
256
|
+
if (widgetContainer) teardown.addEventListener(widgetContainer, PROCAPTCHA_EXECUTE_EVENT, holdExecute);
|
|
257
|
+
if (_prosopo_types.ModeEnum.invisible === config.mode) teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, holdExecute);
|
|
258
|
+
start();
|
|
259
|
+
}
|
|
260
|
+
return { destroy: () => {
|
|
261
|
+
destroyed = true;
|
|
262
|
+
teardown.run();
|
|
263
|
+
clearSlot();
|
|
264
|
+
banner.destroy();
|
|
265
|
+
slot.parentNode?.removeChild(slot);
|
|
266
|
+
} };
|
|
267
|
+
};
|
|
268
|
+
//#endregion
|
|
269
|
+
exports.mountProcaptchaFrictionless = mountProcaptchaFrictionless;
|
package/dist/detectorPrefetch.js
CHANGED
|
@@ -6,12 +6,12 @@ import { ProviderApi } from "@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/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { clearPrefetchedDetectors, prefetchDetector, takePrefetchedDetector } from "./detectorPrefetch.js";
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { mountProcaptchaFrictionless } from "./procaptchaFrictionless.js";
|
|
4
|
+
export { clearPrefetchedDetectors, mountProcaptchaFrictionless, prefetchDetector, takePrefetchedDetector };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ProcaptchaFrictionlessProps } from "@prosopo/types";
|
|
2
|
+
export interface ProcaptchaFrictionlessHandle {
|
|
3
|
+
destroy(): void;
|
|
4
|
+
}
|
|
5
|
+
export declare const mountProcaptchaFrictionless: (container: HTMLElement, props: ProcaptchaFrictionlessProps) => ProcaptchaFrictionlessHandle;
|
|
6
|
+
//# sourceMappingURL=procaptchaFrictionless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/procaptchaFrictionless.ts"],"names":[],"mappings":"AA4BA,OAAO,EAON,KAAK,2BAA2B,EAIhC,MAAM,gBAAgB,CAAC;AA8BxB,MAAM,WAAW,4BAA4B;IAC5C,OAAO,IAAI,IAAI,CAAC;CAChB;AAeD,eAAO,MAAM,2BAA2B,cAC5B,WAAW,SACf,2BAA2B,KAChC,4BAgfF,CAAC"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { mountAuthenticatedBadge } from "./authenticatedBadge.js";
|
|
2
|
+
import customDetectBot from "./customDetectBot.js";
|
|
3
|
+
import { evaluateFrictionlessResult } from "./frictionlessResultGuard.js";
|
|
4
|
+
import { consumeRetryMountProps, handleSessionInvalidated, normaliseRetryCoords } from "./sessionInvalidatedRecovery.js";
|
|
5
|
+
import { loadI18next } from "@prosopo/locale";
|
|
6
|
+
import { Teardown, clearElement, createElement, getDefaultEvents, isSecureBrowserContext, mountCheckbox, mountTestModeBanner, providerRetry } from "@prosopo/procaptcha-common";
|
|
7
|
+
import { CaptchaType, ModeEnum, PROCAPTCHA_START_EVENT, ProcaptchaConfigSchema, StartModeEnum } from "@prosopo/types";
|
|
8
|
+
import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
|
|
9
|
+
//#region src/procaptchaFrictionless.ts
|
|
10
|
+
var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
|
|
11
|
+
var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
|
|
12
|
+
var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).mountProcaptchaImageWidget;
|
|
13
|
+
var ProcaptchaPuzzleLoader = async () => (await import("@prosopo/procaptcha-puzzle")).mountProcaptchaPuzzleWidget;
|
|
14
|
+
var ProcaptchaPowLoader = async () => (await import("@prosopo/procaptcha-pow")).mountProcaptchaPowWidget;
|
|
15
|
+
var defaultLoadingState = (attemptCount) => ({
|
|
16
|
+
loading: false,
|
|
17
|
+
attemptCount
|
|
18
|
+
});
|
|
19
|
+
var mountProcaptchaFrictionless = (container, props) => {
|
|
20
|
+
const { config, callbacks, restart, i18n, detectBot = customDetectBot, container: widgetContainer } = props;
|
|
21
|
+
const teardown = new Teardown();
|
|
22
|
+
const events = getDefaultEvents(callbacks);
|
|
23
|
+
let state = defaultLoadingState(0);
|
|
24
|
+
let destroyed = false;
|
|
25
|
+
const pendingRetryCoords = { current: null };
|
|
26
|
+
const sessionInvalidatedAttempts = { current: 0 };
|
|
27
|
+
const escalatedSessionIds = /* @__PURE__ */ new Set();
|
|
28
|
+
let nextMountAutoStart = false;
|
|
29
|
+
const manualStart = StartModeEnum.manual === config.startMode;
|
|
30
|
+
let manualStarted = false;
|
|
31
|
+
let pendingExecute = false;
|
|
32
|
+
const banner = mountTestModeBanner(container, { siteKey: config.account?.address ?? "" });
|
|
33
|
+
const slot = createElement("div");
|
|
34
|
+
container.appendChild(slot);
|
|
35
|
+
let solver;
|
|
36
|
+
let placeholder;
|
|
37
|
+
const clearSlot = () => {
|
|
38
|
+
solver?.destroy();
|
|
39
|
+
solver = void 0;
|
|
40
|
+
placeholder?.destroy();
|
|
41
|
+
placeholder = void 0;
|
|
42
|
+
clearElement(slot);
|
|
43
|
+
};
|
|
44
|
+
const renderPlaceholder = (mode, errorMessage, loading, onChange) => {
|
|
45
|
+
clearSlot();
|
|
46
|
+
if ("invisible" === mode) return;
|
|
47
|
+
placeholder = mountCheckbox(slot, {
|
|
48
|
+
theme: "light" === config.theme ? lightTheme : darkTheme,
|
|
49
|
+
onChange: onChange ?? (() => void 0),
|
|
50
|
+
checked: false,
|
|
51
|
+
labelText: i18n.isInitialized ? i18n.t("WIDGET.I_AM_HUMAN") : "",
|
|
52
|
+
error: errorMessage,
|
|
53
|
+
loadingText: i18n.isInitialized ? i18n.t("WIDGET.CHECKING") : void 0,
|
|
54
|
+
loading
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const resetState = (attemptCount) => {
|
|
58
|
+
state = defaultLoadingState(attemptCount ?? state.attemptCount);
|
|
59
|
+
};
|
|
60
|
+
const restartComponentTimeout = () => {
|
|
61
|
+
const timer = setTimeout(() => {
|
|
62
|
+
resetState(0);
|
|
63
|
+
events.onReset();
|
|
64
|
+
restart();
|
|
65
|
+
}, 1e4);
|
|
66
|
+
teardown.add(() => clearTimeout(timer));
|
|
67
|
+
};
|
|
68
|
+
const fallOverWithStyle = (errorMessage, errorKey) => {
|
|
69
|
+
if ("CAPTCHA.NO_SESSION_FOUND" === errorKey) {
|
|
70
|
+
const timer = setTimeout(() => {
|
|
71
|
+
restartComponentTimeout();
|
|
72
|
+
}, 0);
|
|
73
|
+
teardown.add(() => clearTimeout(timer));
|
|
74
|
+
}
|
|
75
|
+
renderPlaceholder(config.mode, errorMessage || "Cannot load CAPTCHA", false);
|
|
76
|
+
};
|
|
77
|
+
const replayPendingExecute = () => {
|
|
78
|
+
if (!pendingExecute) return;
|
|
79
|
+
pendingExecute = false;
|
|
80
|
+
(widgetContainer ?? document).dispatchEvent(new CustomEvent(PROCAPTCHA_EXECUTE_EVENT));
|
|
81
|
+
};
|
|
82
|
+
const renderForCaptchaType = async (captchaType, frictionlessState, autoStart = false, escalationCoords) => {
|
|
83
|
+
const onEscalate = (next, newSessionId, coords) => {
|
|
84
|
+
if (escalatedSessionIds.has(newSessionId)) return;
|
|
85
|
+
escalatedSessionIds.add(newSessionId);
|
|
86
|
+
renderForCaptchaType(next, {
|
|
87
|
+
...frictionlessState,
|
|
88
|
+
sessionId: newSessionId
|
|
89
|
+
}, true, coords);
|
|
90
|
+
};
|
|
91
|
+
const onSessionInvalidated = (x, y) => {
|
|
92
|
+
const { shouldRestart } = handleSessionInvalidated(x, y, sessionInvalidatedAttempts, pendingRetryCoords);
|
|
93
|
+
if (shouldRestart) {
|
|
94
|
+
resetState(0);
|
|
95
|
+
start();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
|
|
99
|
+
events.onError(new Error(message));
|
|
100
|
+
fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
|
|
101
|
+
};
|
|
102
|
+
const onReload = (x, y) => {
|
|
103
|
+
pendingRetryCoords.current = normaliseRetryCoords(x, y);
|
|
104
|
+
nextMountAutoStart = true;
|
|
105
|
+
sessionInvalidatedAttempts.current = 0;
|
|
106
|
+
resetState(0);
|
|
107
|
+
start();
|
|
108
|
+
};
|
|
109
|
+
const forcedAutoStart = nextMountAutoStart;
|
|
110
|
+
nextMountAutoStart = false;
|
|
111
|
+
const { autoStart: resumedAutoStart, startCoords: retryStartCoords } = consumeRetryMountProps(pendingRetryCoords, autoStart || forcedAutoStart);
|
|
112
|
+
const widgetProps = {
|
|
113
|
+
config,
|
|
114
|
+
callbacks,
|
|
115
|
+
frictionlessState,
|
|
116
|
+
i18n,
|
|
117
|
+
autoStart: resumedAutoStart,
|
|
118
|
+
startCoords: escalationCoords ?? retryStartCoords,
|
|
119
|
+
onSessionInvalidated,
|
|
120
|
+
container: widgetContainer
|
|
121
|
+
};
|
|
122
|
+
if (CaptchaType.authenticated === captchaType) {
|
|
123
|
+
if (!frictionlessState.sessionId) {
|
|
124
|
+
events.onError(/* @__PURE__ */ new Error("authenticated captcha response missing sessionId — provider is misbehaving"));
|
|
125
|
+
fallOverWithStyle();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
clearSlot();
|
|
129
|
+
solver = mountAuthenticatedBadge(slot, {
|
|
130
|
+
sessionId: frictionlessState.sessionId,
|
|
131
|
+
agent: frictionlessState.agent,
|
|
132
|
+
dapp: config.account.address ?? "",
|
|
133
|
+
userAccount: frictionlessState.userAccount,
|
|
134
|
+
provider: frictionlessState.provider,
|
|
135
|
+
callbacks
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (CaptchaType.image === captchaType) {
|
|
140
|
+
const mount = await ProcaptchaLoader();
|
|
141
|
+
if (destroyed) return;
|
|
142
|
+
clearSlot();
|
|
143
|
+
solver = mount(slot, {
|
|
144
|
+
...widgetProps,
|
|
145
|
+
onReload
|
|
146
|
+
});
|
|
147
|
+
replayPendingExecute();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (CaptchaType.puzzle === captchaType) {
|
|
151
|
+
const mount = await ProcaptchaPuzzleLoader();
|
|
152
|
+
if (destroyed) return;
|
|
153
|
+
clearSlot();
|
|
154
|
+
solver = mount(slot, widgetProps);
|
|
155
|
+
replayPendingExecute();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const mount = await ProcaptchaPowLoader();
|
|
159
|
+
if (destroyed) return;
|
|
160
|
+
clearSlot();
|
|
161
|
+
solver = mount(slot, {
|
|
162
|
+
...widgetProps,
|
|
163
|
+
onEscalate
|
|
164
|
+
});
|
|
165
|
+
replayPendingExecute();
|
|
166
|
+
};
|
|
167
|
+
const start = async () => {
|
|
168
|
+
if (!isSecureBrowserContext()) {
|
|
169
|
+
const errorMessage = i18n.isInitialized ? i18n.t("WIDGET.INSECURE_CONTEXT") : "Procaptcha requires a secure (HTTPS) connection";
|
|
170
|
+
events.onError(new Error(errorMessage));
|
|
171
|
+
fallOverWithStyle(errorMessage, "WIDGET.INSECURE_CONTEXT");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
await providerRetry(async () => {
|
|
175
|
+
state.attemptCount += 1;
|
|
176
|
+
const configOutput = ProcaptchaConfigSchema.parse(config);
|
|
177
|
+
const result = await detectBot(configOutput, widgetContainer, restart, { attempt: state.attemptCount });
|
|
178
|
+
const guard = evaluateFrictionlessResult(result);
|
|
179
|
+
if ("error" === guard.kind) {
|
|
180
|
+
if (guard.retryable) throw new Error(guard.message);
|
|
181
|
+
state = {
|
|
182
|
+
...state,
|
|
183
|
+
loading: false,
|
|
184
|
+
errorMessage: guard.message
|
|
185
|
+
};
|
|
186
|
+
events.onError(new Error(guard.message));
|
|
187
|
+
fallOverWithStyle(guard.message, guard.key);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const frictionlessState = {
|
|
191
|
+
provider: result.provider,
|
|
192
|
+
sessionId: result.sessionId,
|
|
193
|
+
userAccount: result.userAccount,
|
|
194
|
+
restart,
|
|
195
|
+
behaviorCollector1: result.behaviorCollector1,
|
|
196
|
+
behaviorCollector2: result.behaviorCollector2,
|
|
197
|
+
behaviorCollector3: result.behaviorCollector3,
|
|
198
|
+
deviceCapability: result.deviceCapability,
|
|
199
|
+
encryptBehavioralData: result.encryptBehavioralData,
|
|
200
|
+
getSimdReadings: result.getSimdReadings,
|
|
201
|
+
hp: result.hp,
|
|
202
|
+
agent: result.agent
|
|
203
|
+
};
|
|
204
|
+
await renderForCaptchaType(result.captchaType, frictionlessState);
|
|
205
|
+
state = {
|
|
206
|
+
...state,
|
|
207
|
+
loading: false
|
|
208
|
+
};
|
|
209
|
+
}, start, resetState, state.attemptCount, 5).finally(() => {
|
|
210
|
+
if (state.attemptCount >= 5) {
|
|
211
|
+
events.onError(/* @__PURE__ */ new Error("Cannot load CAPTCHA"));
|
|
212
|
+
fallOverWithStyle();
|
|
213
|
+
restartComponentTimeout();
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* `startMode: "manual"` defers the whole frictionless flow until the site
|
|
219
|
+
* (or the user, via the placeholder checkbox) asks for it. One-shot: the
|
|
220
|
+
* flow runs at most once per widget lifetime, however many triggers fire.
|
|
221
|
+
*/
|
|
222
|
+
const startManually = async (autoStart, coords) => {
|
|
223
|
+
if (manualStarted) return;
|
|
224
|
+
manualStarted = true;
|
|
225
|
+
pendingRetryCoords.current = coords ?? null;
|
|
226
|
+
nextMountAutoStart = autoStart;
|
|
227
|
+
renderPlaceholder(config.mode, state.errorMessage, true);
|
|
228
|
+
await start();
|
|
229
|
+
};
|
|
230
|
+
if (config.language) if (i18n) {
|
|
231
|
+
if (i18n.language !== config.language) i18n.changeLanguage(config.language);
|
|
232
|
+
} else loadI18next(false, config.language);
|
|
233
|
+
const manualCheckboxHandler = async (event) => {
|
|
234
|
+
let x = 0;
|
|
235
|
+
let y = 0;
|
|
236
|
+
if ("clientX" in event && "clientY" in event) {
|
|
237
|
+
x = event.clientX;
|
|
238
|
+
y = event.clientY;
|
|
239
|
+
}
|
|
240
|
+
await startManually(true, normaliseRetryCoords(x, y) ?? void 0);
|
|
241
|
+
};
|
|
242
|
+
renderPlaceholder(config.mode, state.errorMessage, !manualStart, manualStart ? manualCheckboxHandler : void 0);
|
|
243
|
+
if (manualStart) {
|
|
244
|
+
teardown.addEventListener(document, PROCAPTCHA_START_EVENT, (event) => {
|
|
245
|
+
const detail = event.detail;
|
|
246
|
+
if (detail?.element && widgetContainer && !detail.element.contains(widgetContainer)) return;
|
|
247
|
+
startManually(false);
|
|
248
|
+
});
|
|
249
|
+
teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, () => {
|
|
250
|
+
startManually(true);
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
const holdExecute = () => {
|
|
254
|
+
if (!solver) pendingExecute = true;
|
|
255
|
+
};
|
|
256
|
+
if (widgetContainer) teardown.addEventListener(widgetContainer, PROCAPTCHA_EXECUTE_EVENT, holdExecute);
|
|
257
|
+
if (ModeEnum.invisible === config.mode) teardown.addEventListener(document, PROCAPTCHA_EXECUTE_EVENT, holdExecute);
|
|
258
|
+
start();
|
|
259
|
+
}
|
|
260
|
+
return { destroy: () => {
|
|
261
|
+
destroyed = true;
|
|
262
|
+
teardown.run();
|
|
263
|
+
clearSlot();
|
|
264
|
+
banner.destroy();
|
|
265
|
+
slot.parentNode?.removeChild(slot);
|
|
266
|
+
} };
|
|
267
|
+
};
|
|
268
|
+
//#endregion
|
|
269
|
+
export { mountProcaptchaFrictionless };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procaptchaFrictionless.js","sourceRoot":"","sources":["../src/procaptchaFrictionless.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAIN,QAAQ,EACR,YAAY,EAC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H,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,GAAG,EAAE;YAClE,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QAIP,MAAM,WAAW,GAAG,GAAG,EAAE;YACxB,IAAI,CAAC,MAAM;gBAAE,cAAc,GAAG,IAAI,CAAC;QACpC,CAAC,CAAC;QACF,IAAI,eAAe,EAAE,CAAC;YACrB,QAAQ,CAAC,gBAAgB,CACxB,eAAe,EACf,wBAAwB,EACxB,WAAW,CACX,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,CAAC,SAAS,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;YACxC,QAAQ,CAAC,gBAAgB,CACxB,QAAQ,EACR,wBAAwB,EACxB,WAAW,CACX,CAAC;QACH,CAAC;QAOD,KAAK,KAAK,EAAE,CAAC;IACd,CAAC;IAED,OAAO;QACN,OAAO,EAAE,GAAG,EAAE;YACb,SAAS,GAAG,IAAI,CAAC;YACjB,QAAQ,CAAC,GAAG,EAAE,CAAC;YACf,SAAS,EAAE,CAAC;YACZ,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escalationClientSession.test.d.ts","sourceRoot":"","sources":["../../src/tests/escalationClientSession.test.
|
|
1
|
+
{"version":3,"file":"escalationClientSession.test.d.ts","sourceRoot":"","sources":["../../src/tests/escalationClientSession.test.ts"],"names":[],"mappings":""}
|