@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.
- package/.turbo/turbo-build$colon$cjs.log +7 -7
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +69 -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/customDetectBot.cjs +3 -2
- package/dist/cjs/detectorPrefetch.cjs +2 -2
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/procaptchaFrictionless.cjs +269 -0
- package/dist/customDetectBot.d.ts.map +1 -1
- package/dist/customDetectBot.js +4 -3
- package/dist/customDetectBot.js.map +1 -1
- 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/customDetectBotAssignTimeout.test.js +1 -0
- package/dist/tests/customDetectBotAssignTimeout.test.js.map +1 -1
- package/dist/tests/customDetectBotSimd.test.js +1 -0
- package/dist/tests/customDetectBotSimd.test.js.map +1 -1
- 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 +11 -2
- package/src/detectorPrefetch.ts +2 -2
- package/src/index.ts +1 -1
- package/src/{ProcaptchaFrictionless.tsx → procaptchaFrictionless.ts} +285 -314
- package/src/tests/customDetectBotAssignTimeout.test.ts +5 -0
- package/src/tests/customDetectBotSimd.test.ts +5 -0
- 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
package/src/customDetectBot.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ExtensionLoader,
|
|
19
19
|
getProcaptchaRandomActiveProvider,
|
|
20
20
|
pickIpMode,
|
|
21
|
+
resolveClientSessionId,
|
|
21
22
|
} from "@prosopo/procaptcha-common";
|
|
22
23
|
import type {
|
|
23
24
|
BotDetectionFunction,
|
|
@@ -175,8 +176,8 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
175
176
|
// same stack. Resolved up front — before detection rather than alongside it —
|
|
176
177
|
// because the detector bundle is served BY this provider.
|
|
177
178
|
// The bundle entry starts provider resolution + assign as soon as it has read
|
|
178
|
-
// the site key off the DOM, which is well before
|
|
179
|
-
//
|
|
179
|
+
// the site key off the DOM, which is well before this widget has mounted.
|
|
180
|
+
// Claim that in-flight work if it exists rather than repeating it.
|
|
180
181
|
// Only valid on a first attempt: a retry is retrying *because* the pinned
|
|
181
182
|
// pronode failed, so it must re-resolve.
|
|
182
183
|
const isFirstAttempt = !retryContext || retryContext.attempt <= 1;
|
|
@@ -261,6 +262,12 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
261
262
|
const ExtClass = await extClassPromise;
|
|
262
263
|
const ext = new ExtClass();
|
|
263
264
|
|
|
265
|
+
// Sent on this hop as well as on solution submit, so a session that is
|
|
266
|
+
// allowed frictionlessly — or abandoned before a solve — still correlates
|
|
267
|
+
// back to the site's (or Protect's) session. Undefined when Protect has not
|
|
268
|
+
// finished initialising yet; the solve-time read then supplies it.
|
|
269
|
+
const clientSessionId = resolveClientSessionId(config.clientSessionId);
|
|
270
|
+
|
|
264
271
|
// No provider detector ⇒ no detection is possible, so there is nothing to
|
|
265
272
|
// send. The request goes out with an empty token and the provider decides
|
|
266
273
|
// what to serve; the client gets no say in that.
|
|
@@ -279,6 +286,7 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
279
286
|
undefined,
|
|
280
287
|
fallbackUrl,
|
|
281
288
|
fallbackIframeUrl,
|
|
289
|
+
clientSessionId,
|
|
282
290
|
),
|
|
283
291
|
10000,
|
|
284
292
|
);
|
|
@@ -335,6 +343,7 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
335
343
|
detectorSessionId,
|
|
336
344
|
currentUrl,
|
|
337
345
|
iframeUrl,
|
|
346
|
+
clientSessionId,
|
|
338
347
|
);
|
|
339
348
|
if (detectionResult.getSimdReadings) {
|
|
340
349
|
// Fire-and-forget: triggers the memoised prefetch inside the catcher
|
package/src/detectorPrefetch.ts
CHANGED
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Since the detector moved into the provider-served pool, the frictionless flow
|
|
19
19
|
* cannot start until `/detector/assign` has returned. That request is issued by
|
|
20
|
-
* `customDetectBot`, which only runs once
|
|
20
|
+
* `customDetectBot`, which only runs once the widget has mounted — and
|
|
21
21
|
* that mount sits behind the bundle's dynamic-import chain. Measured on a
|
|
22
22
|
* staging demo page the assign request did not leave the browser until 1513 ms,
|
|
23
23
|
* of which ~700 ms was purely waiting for chunks to arrive in sequence.
|
|
24
24
|
*
|
|
25
|
-
* Nothing in the request depends on
|
|
25
|
+
* Nothing in the request depends on the widget, i18n or its config: it needs
|
|
26
26
|
* the site key (a DOM attribute, readable immediately), the environment (a
|
|
27
27
|
* build-time constant) and the IP-mode flags (DOM attributes). So the entry
|
|
28
28
|
* point kicks it off as soon as it has read those, and `customDetectBot` picks
|
package/src/index.ts
CHANGED
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
export * from "./
|
|
14
|
+
export * from "./procaptchaFrictionless.js";
|
|
15
15
|
export * from "./detectorPrefetch.js";
|