@prosopo/procaptcha-bundle 4.1.43 → 4.1.45

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-bundle@4.1.43 build:cjs
2
+ > @prosopo/procaptcha-bundle@4.1.45 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -10,11 +10,10 @@ ViteCommonJSConfig: .
10
10
  '/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
11
11
  '/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
12
12
  '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json',
13
- '/home/runner/work/captcha/captcha/packages/detector/tsconfig.json',
14
- '/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
15
- '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
16
13
  '/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
17
14
  '/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
15
+ '/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
16
+ '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
18
17
  '/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
19
18
  '/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
20
19
  '/home/runner/work/captcha/captcha/packages/fingerprintjs/tsconfig.json',
@@ -36,11 +35,10 @@ ViteCommonJSConfig: .
36
35
  '@prosopo/util',
37
36
  '@prosopo/locale',
38
37
  '@prosopo/procaptcha-frictionless',
39
- '@prosopo/detector',
40
- '@prosopo/types',
41
- '@prosopo/util-crypto',
42
38
  '@prosopo/procaptcha-pow',
43
39
  '@prosopo/api',
40
+ '@prosopo/types',
41
+ '@prosopo/util-crypto',
44
42
  '@prosopo/common',
45
43
  '@prosopo/fingerprint',
46
44
  '@prosopo/fingerprintjs',
@@ -71,8 +69,8 @@ dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
71
69
  dist/cjs/util/language.cjs 1.08 kB │ gzip: 0.45 kB
72
70
  dist/cjs/util/captcha/captchaRenderer.cjs 2.26 kB │ gzip: 0.78 kB
73
71
  dist/cjs/util/widgetFactory.cjs 2.73 kB │ gzip: 0.89 kB
74
- dist/cjs/index.cjs 5.35 kB │ gzip: 1.66 kB
72
+ dist/cjs/index.cjs 6.28 kB │ gzip: 2.12 kB
75
73
 
76
74
  [MIXED_EXPORTS] Entry module "src/index.ts" is using named (including "default", "execute", "render", "reset") and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
77
75
  
78
- ✓ built in 57ms
76
+ ✓ built in 66ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-bundle@4.1.43 build:tsc
2
+ > @prosopo/procaptcha-bundle@4.1.45 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 11:41:20 PM - Projects in this build:
5
+ 12:44:45 PM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../util/tsconfig.json
8
8
  * ../logger/tsconfig.json
@@ -10,7 +10,6 @@
10
10
  * ../locale/tsconfig.json
11
11
  * ../util-crypto/tsconfig.json
12
12
  * ../types/tsconfig.json
13
- * ../detector/tsconfig.json
14
13
  * ../api/tsconfig.json
15
14
  * ../common/tsconfig.json
16
15
  * ../fingerprintjs/tsconfig.json
@@ -28,53 +27,51 @@
28
27
  * ../procaptcha-frictionless/tsconfig.json
29
28
  * tsconfig.json
30
29
 
31
- 11:41:20 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'
30
+ 12:44:45 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
32
31
 
33
- 11:41:20 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
32
+ 12:44:45 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
34
33
 
35
- 11:41:20 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
34
+ 12:44:45 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
36
35
 
37
- 11:41:20 PM - Project '../dotenv/tsconfig.json' is up to date because newest input '../dotenv/src/env.ts' is older than output '../dotenv/tsconfig.tsbuildinfo'
36
+ 12:44:45 PM - Project '../dotenv/tsconfig.json' is up to date because newest input '../dotenv/src/env.ts' is older than output '../dotenv/tsconfig.tsbuildinfo'
38
37
 
39
- 11:41:20 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
38
+ 12:44:45 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
40
39
 
41
- 11:41:20 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'
40
+ 12:44:45 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'
42
41
 
43
- 11:41:20 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/procaptcha/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
42
+ 12:44:45 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'
44
43
 
45
- 11:41:21 PM - Project '../detector/tsconfig.json' is up to date because newest input '../detector/src/index.js' is older than output '../detector/tsconfig.tsbuildinfo'
44
+ 12:44:45 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
46
45
 
47
- 11:41:21 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
46
+ 12:44:45 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
48
47
 
49
- 11:41:21 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
48
+ 12:44:45 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
50
49
 
51
- 11:41:21 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
50
+ 12:44:45 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
52
51
 
53
- 11:41:21 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
52
+ 12:44:45 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/index.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
54
53
 
55
- 11:41:21 PM - 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'
54
+ 12:44:45 PM - 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'
56
55
 
57
- 11:41:21 PM - 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'
56
+ 12:44:45 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/pair/decode.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
58
57
 
59
- 11:41:21 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
58
+ 12:44:45 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
60
59
 
61
- 11:41:21 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/index.ts' is older than output '../account/tsconfig.tsbuildinfo'
60
+ 12:44:45 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'
62
61
 
63
- 11:41:21 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'
62
+ 12:44:45 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/manager.unit.test.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
64
63
 
65
- 11:41:21 PM - 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'
64
+ 12:44:45 PM - 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'
66
65
 
67
- 11:41:21 PM - 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'
66
+ 12:44:45 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/mocks/data/captchas.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
68
67
 
69
- 11:41:21 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/dataset.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
68
+ 12:44:45 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
70
69
 
71
- 11:41:21 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/index.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
70
+ 12:44:45 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/procaptcha.unit.test.tsx' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
72
71
 
73
- 11:41:21 PM - 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'
72
+ 12:44:45 PM - Project '../procaptcha-frictionless/tsconfig.json' is up to date because newest input '../procaptcha-frictionless/src/ProcaptchaFrictionless.tsx' is older than output '../procaptcha-frictionless/tsconfig.tsbuildinfo'
74
73
 
75
- 11:41:21 PM - Project '../procaptcha-frictionless/tsconfig.json' is up to date because newest input '../procaptcha-frictionless/src/ProcaptchaFrictionless.tsx' is older than output '../procaptcha-frictionless/tsconfig.tsbuildinfo'
74
+ 12:44:45 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
76
75
 
77
- 11:41:21 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
78
-
79
- 11:41:21 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-bundle/tsconfig.json'...
76
+ 12:44:45 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-bundle/tsconfig.json'...
80
77
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-bundle@4.1.43 build
2
+ > @prosopo/procaptcha-bundle@4.1.45 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-bundle@4.1.43 build:cross-env
6
+ > @prosopo/procaptcha-bundle@4.1.45 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -14,11 +14,10 @@ ViteEsmConfig: .
14
14
  '/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
15
15
  '/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
16
16
  '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json',
17
- '/home/runner/work/captcha/captcha/packages/detector/tsconfig.json',
18
- '/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
19
- '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
20
17
  '/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
21
18
  '/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
19
+ '/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
20
+ '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
22
21
  '/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
23
22
  '/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
24
23
  '/home/runner/work/captcha/captcha/packages/fingerprintjs/tsconfig.json',
@@ -40,11 +39,10 @@ ViteEsmConfig: .
40
39
  '@prosopo/util',
41
40
  '@prosopo/locale',
42
41
  '@prosopo/procaptcha-frictionless',
43
- '@prosopo/detector',
44
- '@prosopo/types',
45
- '@prosopo/util-crypto',
46
42
  '@prosopo/procaptcha-pow',
47
43
  '@prosopo/api',
44
+ '@prosopo/types',
45
+ '@prosopo/util-crypto',
48
46
  '@prosopo/common',
49
47
  '@prosopo/fingerprint',
50
48
  '@prosopo/fingerprintjs',
@@ -75,6 +73,6 @@ dist/util/configCreator.js 0.86 kB │ gzip: 0.45 kB
75
73
  dist/util/language.js 1.01 kB │ gzip: 0.44 kB
76
74
  dist/util/captcha/captchaRenderer.js 1.93 kB │ gzip: 0.70 kB
77
75
  dist/util/widgetFactory.js 2.52 kB │ gzip: 0.85 kB
78
- dist/index.js 5.03 kB │ gzip: 1.58 kB
76
+ dist/index.js 5.97 kB │ gzip: 2.04 kB
79
77
 
80
- ✓ built in 34ms
78
+ ✓ built in 65ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @prosopo/procaptcha-bundle
2
2
 
3
+ ## 4.1.45
4
+ ### Patch Changes
5
+
6
+ - fa4fedb: Start the detector-bundle assignment at page load instead of after the widget mounts.
7
+
8
+ Since the detector moved into the provider-served pool, the frictionless flow cannot begin until `/detector/assign` returns. That request was issued by `customDetectBot`, which only runs once React has mounted the widget — so it queued behind the bundle's dynamic-import chain. Measured on the staging demo, `assign` did not leave the browser until **1513 ms**, of which ~700 ms was purely waiting for chunks to arrive in sequence.
9
+
10
+ Nothing in that request depends on React, i18n or the widget config: it needs the site key (a DOM attribute), the environment (a build-time constant) and the IP-mode flags (DOM attributes). The bundle entry now kicks it off as soon as it has read those, and `customDetectBot` claims the in-flight promise instead of starting its own.
11
+
12
+ The prefetch is loaded by dynamic import so the provider selector and API client do not land in the entry chunk and delay first paint; the entry grows by ~400 bytes. It is fire-and-forget — a failed prefetch is indistinguishable from no prefetch, and the existing fallback path still resolves a provider itself.
13
+
14
+ The cache is single-use and keyed on `(environment, ipMode, siteKey)`, so a retry — which is retrying precisely because the pinned pronode failed — re-resolves rather than reusing a stale pin, and a second widget with different flags cannot claim another's assignment.
15
+ - Updated dependencies [fa4fedb]
16
+ - @prosopo/procaptcha-frictionless@2.13.1
17
+
18
+ ## 4.1.44
19
+ ### Patch Changes
20
+
21
+ - 787017b: Keep util-crypto in the shared browser chunk. Split into its own chunk it
22
+ formed a Rolldown chunk cycle with the fingerprint chunk on the detector-pool
23
+ branch, where the detector is no longer bundled into the widget. Whichever
24
+ chunk evaluated first read the other's module-scope bindings before they were
25
+ assigned, so the widget threw on load ("init_dist is not a function", then
26
+ isHex reading `.test` of undefined) and never defined window.procaptcha.
27
+ - Updated dependencies [787017b]
28
+ - Updated dependencies [787017b]
29
+ - Updated dependencies [787017b]
30
+ - Updated dependencies [6f19cde]
31
+ - Updated dependencies [2bc8e73]
32
+ - @prosopo/types@5.0.0
33
+ - @prosopo/procaptcha-frictionless@2.13.0
34
+ - @prosopo/widget-skeleton@2.8.5
35
+ - @prosopo/procaptcha-common@2.11.20
36
+
3
37
  ## 4.1.43
4
38
  ### Patch Changes
5
39
 
@@ -11,6 +11,22 @@ let _prosopo_util = require("@prosopo/util");
11
11
  var BUNDLE_NAMES = ["procaptcha.bundle.iife.js", "procaptcha.bundle.js"];
12
12
  var procaptchaRoots = [];
13
13
  var widgetFactory = new require_widgetFactory.WidgetFactory(new require_widgetThemeResolver.WidgetThemeResolver());
14
+ /**
15
+ * Kick off provider resolution + detector assignment without blocking render.
16
+ *
17
+ * Loaded via dynamic import on purpose: it pulls in the provider selector and
18
+ * the provider API client, and importing those statically would push them into
19
+ * the entry chunk and delay first paint. Firing the import here starts that
20
+ * download in parallel with the widget's own chunks rather than after them.
21
+ *
22
+ * Fire-and-forget by design — a failed prefetch is indistinguishable from no
23
+ * prefetch, and the detection path falls back to resolving a provider itself.
24
+ */
25
+ var startDetectorPrefetch = (siteKey, flags) => {
26
+ Promise.all([import("@prosopo/procaptcha-frictionless"), import("@prosopo/procaptcha-common")]).then(([frictionless, common]) => {
27
+ frictionless.prefetchDetector(process.env.PROSOPO_DEFAULT_ENVIRONMENT, common.pickIpMode(flags), siteKey);
28
+ }).catch(() => void 0);
29
+ };
14
30
  var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
15
31
  var PROCAPTCHA_READY_EVENT = "procaptcha:ready";
16
32
  var implicitRender = async () => {
@@ -25,6 +41,10 @@ var implicitRender = async () => {
25
41
  console.error("No site key found");
26
42
  return;
27
43
  }
44
+ startDetectorPrefetch(siteKey, {
45
+ ipv4,
46
+ ipv6
47
+ });
28
48
  const root = await widgetFactory.createWidgets(elements, {
29
49
  siteKey,
30
50
  ipv4,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAsF9D,eAAO,MAAM,MAAM,YACT,OAAO,iBACD,uBAAuB,kBA2BtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,QAY3C;AAED,eAAO,MAAM,OAAO,YAqBnB,CAAC;AAkCF,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,UAAU,EAAE;YACX,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,MAAM,EAAE,OAAO,MAAM,CAAC;YACtB,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,OAAO,EAAE,OAAO,OAAO,CAAC;SACxB,CAAC;KACF;CACD;AAmCD,eAAO,MAAM,KAAK,YAOjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAoB,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AA0HhF,eAAO,MAAM,MAAM,YACT,OAAO,iBACD,uBAAuB,kBA2BtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,QAY3C;AAED,eAAO,MAAM,OAAO,YAqBnB,CAAC;AAkCF,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,UAAU,EAAE;YACX,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,MAAM,EAAE,OAAO,MAAM,CAAC;YACtB,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,OAAO,EAAE,OAAO,OAAO,CAAC;SACxB,CAAC;KACF;CACD;AAmCD,eAAO,MAAM,KAAK,YAOjB,CAAC"}
package/dist/index.js CHANGED
@@ -8,6 +8,22 @@ import { at } from "@prosopo/util";
8
8
  var BUNDLE_NAMES = ["procaptcha.bundle.iife.js", "procaptcha.bundle.js"];
9
9
  var procaptchaRoots = [];
10
10
  var widgetFactory = new WidgetFactory(new WidgetThemeResolver());
11
+ /**
12
+ * Kick off provider resolution + detector assignment without blocking render.
13
+ *
14
+ * Loaded via dynamic import on purpose: it pulls in the provider selector and
15
+ * the provider API client, and importing those statically would push them into
16
+ * the entry chunk and delay first paint. Firing the import here starts that
17
+ * download in parallel with the widget's own chunks rather than after them.
18
+ *
19
+ * Fire-and-forget by design — a failed prefetch is indistinguishable from no
20
+ * prefetch, and the detection path falls back to resolving a provider itself.
21
+ */
22
+ var startDetectorPrefetch = (siteKey, flags) => {
23
+ Promise.all([import("@prosopo/procaptcha-frictionless"), import("@prosopo/procaptcha-common")]).then(([frictionless, common]) => {
24
+ frictionless.prefetchDetector(process.env.PROSOPO_DEFAULT_ENVIRONMENT, common.pickIpMode(flags), siteKey);
25
+ }).catch(() => void 0);
26
+ };
11
27
  var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
12
28
  var PROCAPTCHA_READY_EVENT = "procaptcha:ready";
13
29
  var implicitRender = async () => {
@@ -22,6 +38,10 @@ var implicitRender = async () => {
22
38
  console.error("No site key found");
23
39
  return;
24
40
  }
41
+ startDetectorPrefetch(siteKey, {
42
+ ipv4,
43
+ ipv6
44
+ });
25
45
  const root = await widgetFactory.createWidgets(elements, {
26
46
  siteKey,
27
47
  ipv4,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MA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AAC,CAAC;AACH,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;AAE7C,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-bundle",
3
- "version": "4.1.43",
3
+ "version": "4.1.45",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -41,11 +41,11 @@
41
41
  "dependencies": {
42
42
  "@prosopo/dotenv": "3.0.50",
43
43
  "@prosopo/locale": "3.2.8",
44
- "@prosopo/procaptcha-common": "2.11.19",
45
- "@prosopo/procaptcha-frictionless": "2.12.24",
46
- "@prosopo/types": "4.10.0",
44
+ "@prosopo/procaptcha-common": "2.11.20",
45
+ "@prosopo/procaptcha-frictionless": "2.13.1",
46
+ "@prosopo/types": "5.0.0",
47
47
  "@prosopo/util": "3.3.5",
48
- "@prosopo/widget-skeleton": "2.8.4",
48
+ "@prosopo/widget-skeleton": "2.8.5",
49
49
  "dotenv": "16.4.5",
50
50
  "fast-glob": "3.3.2",
51
51
  "jsdom": "25.0.0",
@@ -68,7 +68,7 @@
68
68
  "registry": "https://registry.npmjs.org"
69
69
  },
70
70
  "devDependencies": {
71
- "@prosopo/config": "3.3.5",
71
+ "@prosopo/config": "3.3.6",
72
72
  "@types/jsdom": "21.1.7",
73
73
  "@types/node": "22.10.2",
74
74
  "@types/react": "18.3.1",
package/src/index.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  // limitations under the License.
14
14
 
15
15
  import { getWindowCallback } from "@prosopo/procaptcha-common";
16
- import type { ProcaptchaRenderOptions } from "@prosopo/types";
16
+ import type { EnvironmentTypes, ProcaptchaRenderOptions } from "@prosopo/types";
17
17
  import { at } from "@prosopo/util";
18
18
  import type { Root } from "react-dom/client";
19
19
  import { extractParams, getProcaptchaScript } from "./util/config.js";
@@ -25,6 +25,35 @@ let procaptchaRoots: Root[] = [];
25
25
 
26
26
  const widgetFactory = new WidgetFactory(new WidgetThemeResolver());
27
27
 
28
+ /**
29
+ * Kick off provider resolution + detector assignment without blocking render.
30
+ *
31
+ * Loaded via dynamic import on purpose: it pulls in the provider selector and
32
+ * the provider API client, and importing those statically would push them into
33
+ * the entry chunk and delay first paint. Firing the import here starts that
34
+ * download in parallel with the widget's own chunks rather than after them.
35
+ *
36
+ * Fire-and-forget by design — a failed prefetch is indistinguishable from no
37
+ * prefetch, and the detection path falls back to resolving a provider itself.
38
+ */
39
+ const startDetectorPrefetch = (
40
+ siteKey: string,
41
+ flags: { ipv4?: boolean; ipv6?: boolean },
42
+ ): void => {
43
+ void Promise.all([
44
+ import("@prosopo/procaptcha-frictionless"),
45
+ import("@prosopo/procaptcha-common"),
46
+ ])
47
+ .then(([frictionless, common]) => {
48
+ frictionless.prefetchDetector(
49
+ process.env.PROSOPO_DEFAULT_ENVIRONMENT as EnvironmentTypes,
50
+ common.pickIpMode(flags),
51
+ siteKey,
52
+ );
53
+ })
54
+ .catch(() => undefined);
55
+ };
56
+
28
57
  // Define a custom event name for procaptcha execution
29
58
  const PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
30
59
 
@@ -50,6 +79,13 @@ const implicitRender = async () => {
50
79
  return;
51
80
  }
52
81
 
82
+ // Everything the detector assignment needs is known right here: the site
83
+ // key and IP-mode flags come off the DOM, the environment is a build-time
84
+ // constant. Start it now so the round-trip overlaps the widget's own
85
+ // dynamic-import chain instead of queueing behind it —
86
+ // `customDetectBot` claims the in-flight promise when it eventually runs.
87
+ startDetectorPrefetch(siteKey, { ipv4, ipv6 });
88
+
53
89
  const root = await widgetFactory.createWidgets(
54
90
  elements,
55
91
  {