@prosopo/procaptcha-frictionless 2.21.5 → 2.21.6

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.
@@ -8,7 +8,6 @@ ViteCommonJSConfig: .
8
8
  '/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
9
9
  '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
10
10
  '/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
11
- '/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
12
11
  '/home/runner/work/captcha/captcha/packages/procaptcha-audio/tsconfig.json',
13
12
  '/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
14
13
  '/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
@@ -22,7 +21,8 @@ ViteCommonJSConfig: .
22
21
  '/home/runner/work/captcha/captcha/packages/procaptcha-puzzle/tsconfig.json',
23
22
  '/home/runner/work/captcha/captcha/packages/procaptcha-react/tsconfig.json',
24
23
  '/home/runner/work/captcha/captcha/packages/procaptcha/tsconfig.json',
25
- '/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json'
24
+ '/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json',
25
+ '/home/runner/work/captcha/captcha/packages/logger/tsconfig.json'
26
26
  ]
27
27
  }
28
28
  {
@@ -33,7 +33,6 @@ ViteCommonJSConfig: .
33
33
  '@prosopo/util',
34
34
  '@prosopo/util-crypto',
35
35
  '@prosopo/common',
36
- '@prosopo/logger',
37
36
  '@prosopo/procaptcha-audio',
38
37
  '@prosopo/procaptcha-common',
39
38
  '@prosopo/load-balancer',
@@ -47,11 +46,12 @@ ViteCommonJSConfig: .
47
46
  '@prosopo/procaptcha-puzzle',
48
47
  '@prosopo/procaptcha-react',
49
48
  '@prosopo/procaptcha',
50
- '@prosopo/datasets'
49
+ '@prosopo/datasets',
50
+ '@prosopo/logger'
51
51
  ]
52
52
  }
53
53
  The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
54
- vite v8.1.5 building ssr environment for production...
54
+ vite v8.1.6 building ssr environment for production...
55
55
  Bundle build started
56
56
  
57
57
  ✓ 9 modules transformed.
@@ -60,10 +60,10 @@ computing gzip size...
60
60
  dist/cjs/index.cjs 0.55 kB │ gzip: 0.21 kB
61
61
  dist/cjs/detectorLoader.cjs 1.65 kB │ gzip: 0.90 kB
62
62
  dist/cjs/sessionInvalidatedRecovery.cjs 2.50 kB │ gzip: 1.14 kB
63
- dist/cjs/frictionlessResultGuard.cjs 2.75 kB │ gzip: 1.39 kB
63
+ dist/cjs/frictionlessResultGuard.cjs 2.78 kB │ gzip: 1.42 kB
64
64
  dist/cjs/detectorPrefetch.cjs 3.12 kB │ gzip: 1.40 kB
65
65
  dist/cjs/authenticatedBadge.cjs 3.81 kB │ gzip: 1.45 kB
66
- dist/cjs/customDetectBot.cjs 6.26 kB │ gzip: 1.87 kB
67
- dist/cjs/procaptchaFrictionless.cjs 13.80 kB │ gzip: 3.84 kB
66
+ dist/cjs/customDetectBot.cjs 6.35 kB │ gzip: 1.91 kB
67
+ dist/cjs/procaptchaFrictionless.cjs 13.84 kB │ gzip: 3.84 kB
68
68
 
69
- ✓ built in 38ms
69
+ ✓ built in 60ms
@@ -1,12 +1,11 @@
1
1
  $ tsc --build --verbose
2
- 2:44:07 PM - Projects in this build:
2
+ 5:08:38 PM - Projects in this build:
3
3
  * ../../dev/config/tsconfig.json
4
4
  * ../util/tsconfig.json
5
5
  * ../locale/tsconfig.json
6
6
  * ../util-crypto/tsconfig.json
7
7
  * ../types/tsconfig.json
8
8
  * ../api/tsconfig.json
9
- * ../logger/tsconfig.json
10
9
  * ../common/tsconfig.json
11
10
  * ../load-balancer/tsconfig.json
12
11
  * ../widget-skeleton/tsconfig.json
@@ -19,56 +18,57 @@ $ tsc --build --verbose
19
18
  * ../procaptcha-icon-order/tsconfig.json
20
19
  * ../procaptcha-pow/tsconfig.json
21
20
  * ../procaptcha-puzzle/tsconfig.json
21
+ * ../logger/tsconfig.json
22
22
  * ../datasets/tsconfig.json
23
23
  * ../procaptcha/tsconfig.json
24
24
  * ../procaptcha-react/tsconfig.json
25
25
  * tsconfig.json
26
26
 
27
- 2:44:07 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'
27
+ 5:08:38 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'
28
28
 
29
- 2:44:07 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
29
+ 5:08:38 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
30
30
 
31
- 2:44:07 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/process.ts' is older than output '../locale/tsconfig.tsbuildinfo'
31
+ 5:08:38 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
32
32
 
33
- 2:44:07 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'
33
+ 5:08:38 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'
34
34
 
35
- 2:44:07 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'
35
+ 5:08:38 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'
36
36
 
37
- 2:44:07 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/tests/apiHarness.ts' is older than output '../api/tsconfig.tsbuildinfo'
37
+ 5:08:38 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
38
 
39
- 2:44:07 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
39
+ 5:08:38 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/errorCodes.ts' is older than output '../common/tsconfig.tsbuildinfo'
40
40
 
41
- 2:44:07 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
41
+ 5:08:38 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/developmentProviderUrl.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
42
42
 
43
- 2:44:07 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'
43
+ 5:08:38 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'
44
44
 
45
- 2:44:07 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/webComponent/createWidget.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
45
+ 5:08:38 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
46
46
 
47
- 2:44:07 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
47
+ 5:08:38 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.test.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
48
48
 
49
- 2:44:07 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
49
+ 5:08:38 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
50
50
 
51
- 2:44:07 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
51
+ 5:08:39 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/workers/cryptoWorker.ts' is older than output '../account/tsconfig.tsbuildinfo'
52
52
 
53
- 2:44:07 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/tests/cryptoWorker.unit.test.ts' is older than output '../account/tsconfig.tsbuildinfo'
53
+ 5:08:39 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/reload.unit.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
54
54
 
55
- 2:44:07 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/audioAlternative.unit.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
55
+ 5:08:39 PM - Project '../procaptcha-audio/tsconfig.json' is up to date because newest input '../procaptcha-audio/src/errorSites.ts' is older than output '../procaptcha-audio/tsconfig.tsbuildinfo'
56
56
 
57
- 2:44:07 PM - Project '../procaptcha-audio/tsconfig.json' is up to date because newest input '../procaptcha-audio/src/tests/domHarness.ts' is older than output '../procaptcha-audio/tsconfig.tsbuildinfo'
57
+ 5:08:39 PM - Project '../procaptcha-icon-order/tsconfig.json' is up to date because newest input '../procaptcha-icon-order/src/errorSites.ts' is older than output '../procaptcha-icon-order/tsconfig.tsbuildinfo'
58
58
 
59
- 2:44:07 PM - Project '../procaptcha-icon-order/tsconfig.json' is up to date because newest input '../procaptcha-icon-order/src/index.ts' is older than output '../procaptcha-icon-order/tsconfig.tsbuildinfo'
59
+ 5:08:39 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/errorSites.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
60
60
 
61
- 2:44:07 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'
61
+ 5:08:39 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/tests/invisibleCanvasVisibility.unit.test.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
62
62
 
63
- 2:44:07 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'
63
+ 5:08:39 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
64
64
 
65
- 2:44:07 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/captcha.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
65
+ 5:08:39 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/errorSites.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
66
66
 
67
- 2:44:07 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/ProsopoCaptchaApi.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
67
+ 5:08:39 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/ProsopoCaptchaApi.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
68
68
 
69
- 2:44:07 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
69
+ 5:08:39 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
70
70
 
71
- 2:44:07 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
71
+ 5:08:39 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
72
72
 
73
- 2:44:07 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
73
+ 5:08:39 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
74
74
 
@@ -9,7 +9,6 @@ ViteEsmConfig: .
9
9
  '/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
10
10
  '/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
11
11
  '/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
12
- '/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
13
12
  '/home/runner/work/captcha/captcha/packages/procaptcha-audio/tsconfig.json',
14
13
  '/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
15
14
  '/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
@@ -23,7 +22,8 @@ ViteEsmConfig: .
23
22
  '/home/runner/work/captcha/captcha/packages/procaptcha-puzzle/tsconfig.json',
24
23
  '/home/runner/work/captcha/captcha/packages/procaptcha-react/tsconfig.json',
25
24
  '/home/runner/work/captcha/captcha/packages/procaptcha/tsconfig.json',
26
- '/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json'
25
+ '/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json',
26
+ '/home/runner/work/captcha/captcha/packages/logger/tsconfig.json'
27
27
  ]
28
28
  }
29
29
  {
@@ -34,7 +34,6 @@ ViteEsmConfig: .
34
34
  '@prosopo/util',
35
35
  '@prosopo/util-crypto',
36
36
  '@prosopo/common',
37
- '@prosopo/logger',
38
37
  '@prosopo/procaptcha-audio',
39
38
  '@prosopo/procaptcha-common',
40
39
  '@prosopo/load-balancer',
@@ -48,11 +47,12 @@ ViteEsmConfig: .
48
47
  '@prosopo/procaptcha-puzzle',
49
48
  '@prosopo/procaptcha-react',
50
49
  '@prosopo/procaptcha',
51
- '@prosopo/datasets'
50
+ '@prosopo/datasets',
51
+ '@prosopo/logger'
52
52
  ]
53
53
  }
54
54
  The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
55
- vite v8.1.5 building ssr environment for production...
55
+ vite v8.1.6 building ssr environment for production...
56
56
  Bundle build started
57
57
  
58
58
  ✓ 9 modules transformed.
@@ -62,10 +62,10 @@ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
62
62
  dist/index.js 0.33 kB │ gzip: 0.15 kB
63
63
  dist/detectorLoader.js 1.63 kB │ gzip: 0.90 kB
64
64
  dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 kB
65
- dist/frictionlessResultGuard.js 2.68 kB │ gzip: 1.39 kB
65
+ dist/frictionlessResultGuard.js 2.71 kB │ gzip: 1.41 kB
66
66
  dist/detectorPrefetch.js 2.98 kB │ gzip: 1.37 kB
67
67
  dist/authenticatedBadge.js 3.30 kB │ gzip: 1.42 kB
68
- dist/customDetectBot.js 6.06 kB │ gzip: 1.85 kB
69
- dist/procaptchaFrictionless.js 13.20 kB │ gzip: 3.82 kB
68
+ dist/customDetectBot.js 6.15 kB │ gzip: 1.88 kB
69
+ dist/procaptchaFrictionless.js 13.15 kB │ gzip: 3.81 kB
70
70
 
71
- ✓ built in 43ms
71
+ ✓ built in 410ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.21.6
4
+ ### Patch Changes
5
+
6
+ - 46b97b7: Roll up the open Dependabot updates: express 5 (with `@types/express` 5), dotenv 18, undici 8, geolib 4, vitest 5, vite 8.1.6 everywhere, 17 minor and patch bumps (Babel, mongoose, i18next, ip-address, turbo and others), `@angular/router` in the Angular demo, and a GitHub Actions bump.
7
+
8
+ The whole vitest family moves to 5.0.4, including `@vitest/coverage-v8`, because `@vitest/browser-playwright` 5 only works with vitest 5. The `@types/express-serve-static-core` override moves to 5.1.3 to match `@types/express` 5.
9
+
10
+ `@prosopo/dotenv` now loads env files with `quiet: true`. Since dotenv 17, every load prints an "injected env" line to stderr unless told not to.
11
+ - d2148c8: Errors now carry a fixed code and a site instead of a translation key.
12
+
13
+ Every error is a `ProsopoError` with a `code` from one list in
14
+ `@prosopo/common` (`ERROR_CODES`) and an `errorSite` such as `PROV-12`, which
15
+ names the one place it was thrown. Together they make the `errorId`, e.g.
16
+ `SITE_KEY_INVALID:PROV-31`, which the widget shows after the message so a
17
+ screenshot is enough to find the throw.
18
+
19
+ What a client sees:
20
+
21
+ - A public error (bad site key, blocked network, and so on) sends its code,
22
+ English message, data and errorId.
23
+ - Anything else sends only `BACKEND_ERROR:<site>` (or `FRONTEND_ERROR:<site>`
24
+ from the widget) and a status. Internal details never leave the server.
25
+
26
+ The provider no longer translates errors. The widget looks up
27
+ `ERRORS.<CODE>` in its catalogue and falls back to the English message. The
28
+ old error classes (`ProsopoApiError`, `ProsopoEnvError` and the rest), the
29
+ `key`/`messageEn` fields and `localiseErrorMessage` are gone.
30
+
31
+ Other changes in behaviour:
32
+
33
+ - An error with no specific code is a hidden 500.
34
+ - Errors no longer log themselves when they are created. The server logs each
35
+ unhandled one once: 5xx as errors, 4xx at debug.
36
+ - An invalid PoW signature is a 401 instead of a 500.
37
+ - `stringifyBigInts` returns a copy instead of changing its input, so frozen
38
+ error context can be logged.
39
+ - The provider's last hand-written error replies now use the same error body.
40
+ These were the missing-header 401s, the access-policy block, autoBan, the
41
+ metrics 401/403 and the rate limiter. The rate limiter answers with a new
42
+ public `RATE_LIMITED` (429) code.
43
+ - Updated dependencies [f31f0d5]
44
+ - Updated dependencies [46b97b7]
45
+ - Updated dependencies [d2148c8]
46
+ - Updated dependencies [2bcf2fe]
47
+ - @prosopo/widget-skeleton@2.10.3
48
+ - @prosopo/api@4.7.4
49
+ - @prosopo/common@3.3.0
50
+ - @prosopo/locale@3.12.0
51
+ - @prosopo/procaptcha-audio@0.2.7
52
+ - @prosopo/procaptcha-common@2.21.6
53
+ - @prosopo/procaptcha-icon-order@0.2.7
54
+ - @prosopo/procaptcha-pow@2.13.16
55
+ - @prosopo/procaptcha-puzzle@2.17.6
56
+ - @prosopo/procaptcha-react@2.14.7
57
+ - @prosopo/types@5.17.0
58
+
3
59
  ## 2.21.5
4
60
  ### Patch Changes
5
61
 
@@ -1,9 +1,9 @@
1
1
  const require_detectorLoader = require("./detectorLoader.cjs");
2
2
  const require_detectorPrefetch = require("./detectorPrefetch.cjs");
3
+ let _prosopo_common = require("@prosopo/common");
3
4
  let _prosopo_locale = require("@prosopo/locale");
4
5
  let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
5
6
  let _prosopo_api = require("@prosopo/api");
6
- let _prosopo_common = require("@prosopo/common");
7
7
  //#region src/customDetectBot.ts
8
8
  var ASSIGN_TIMEOUT_MS = 1e4;
9
9
  var sanitiseHref = (href) => {
@@ -53,7 +53,11 @@ var withTimeout = async (promise, ms) => {
53
53
  let timeoutId;
54
54
  const timeoutPromise = new Promise((_, reject) => {
55
55
  timeoutId = setTimeout(() => {
56
- reject(new _prosopo_common.ProsopoEnvError("API.UNKNOWN"));
56
+ reject(new _prosopo_common.ProsopoError({
57
+ code: "UNEXPECTED",
58
+ errorSite: "FRIC-1",
59
+ message: "Unknown API error"
60
+ }));
57
61
  }, ms);
58
62
  });
59
63
  try {
@@ -66,7 +70,10 @@ var withTimeout = async (promise, ms) => {
66
70
  }
67
71
  };
68
72
  var customDetectBot = async (config, container, restartFn, retryContext, refreshOf, switchToImage) => {
69
- if (!config.account.address) throw new _prosopo_common.ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
73
+ if (!config.account.address) throw new _prosopo_common.ProsopoError({
74
+ code: "SITE_KEY_MISSING",
75
+ errorSite: "FRIC-2"
76
+ });
70
77
  const ipMode = (0, _prosopo_procaptcha_common.pickIpMode)(config);
71
78
  const extClassPromise = (0, _prosopo_procaptcha_common.ExtensionLoader)(config.web2);
72
79
  const prefetched = !retryContext || retryContext.attempt <= 1 ? require_detectorPrefetch.takePrefetchedDetector(config.defaultEnvironment, ipMode, config.account.address) : void 0;
@@ -1,6 +1,6 @@
1
1
  //#region src/frictionlessResultGuard.ts
2
2
  /**
3
- * Error keys that describe the caller's situation rather than the provider's
3
+ * Error codes that describe the caller's situation rather than the provider's
4
4
  * health, so re-rolling onto another provider would return the same answer.
5
5
  *
6
6
  * Two groups. Integration faults (site key, origin, captcha type) need the
@@ -12,31 +12,31 @@
12
12
  * Anything outside this list is treated as the provider failing, not the
13
13
  * caller: see {@link evaluateFrictionlessResult}.
14
14
  */
15
- var TERMINAL_ERROR_KEYS = /* @__PURE__ */ new Set([
16
- "API.SITE_KEY_NOT_REGISTERED",
17
- "API.INVALID_SITE_KEY",
18
- "API.UNAUTHORIZED_ORIGIN_URL",
19
- "API.INCORRECT_CAPTCHA_TYPE",
20
- "API.ACCESS_POLICY_BLOCK",
21
- "API.ABUSER_BLOCKED",
22
- "API.CRAWLER_BLOCKED",
23
- "API.DATACENTER_BLOCKED",
24
- "API.DISALLOWED_WEBVIEW",
25
- "API.MOBILE_BLOCKED",
26
- "API.PROXY_BLOCKED",
27
- "API.SATELLITE_BLOCKED",
28
- "API.TOR_BLOCKED",
29
- "API.VPN_BLOCKED",
30
- "API.FORBIDDEN",
31
- "API.UNAUTHORIZED",
32
- "CAPTCHA.NO_SESSION_FOUND"
15
+ var TERMINAL_ERROR_CODES = /* @__PURE__ */ new Set([
16
+ "SITE_KEY_NOT_REGISTERED",
17
+ "SITE_KEY_INVALID",
18
+ "ORIGIN_NOT_ALLOWED",
19
+ "INCORRECT_CAPTCHA_TYPE",
20
+ "ACCESS_POLICY_BLOCK",
21
+ "ABUSER_BLOCKED",
22
+ "CRAWLER_BLOCKED",
23
+ "DATACENTER_BLOCKED",
24
+ "DISALLOWED_WEBVIEW",
25
+ "MOBILE_BLOCKED",
26
+ "PROXY_BLOCKED",
27
+ "SATELLITE_BLOCKED",
28
+ "TOR_BLOCKED",
29
+ "VPN_BLOCKED",
30
+ "FORBIDDEN",
31
+ "UNAUTHORIZED",
32
+ "NO_SESSION_FOUND"
33
33
  ]);
34
34
  var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
35
35
  /**
36
36
  * Decide whether a `/frictionless` response is safe to mount an inner widget
37
37
  * against.
38
38
  *
39
- * `result.error?.message` catches the well-formed error shape emitted when
39
+ * `result.error?.code` catches the well-formed error shape emitted when
40
40
  * the provider surfaces a normal captcha error. A response with no
41
41
  * `captchaType` is the other failure mode: request-time short-circuits
42
42
  * (access-policy hard-block, decision-machine autoBan, domain / header
@@ -51,13 +51,19 @@ var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; h
51
51
  * is frictionless-configured, so a direct pow call isn't allowed).
52
52
  */
53
53
  var evaluateFrictionlessResult = (result) => {
54
- if (result.error?.message) {
55
- const key = result.error.key;
54
+ const code = result.error?.code;
55
+ if (code) {
56
+ const errorId = result.error?.errorId ?? code;
57
+ const message = result.error?.message;
56
58
  return {
57
59
  kind: "error",
58
- message: result.error.message,
59
- ...key !== void 0 && { key },
60
- retryable: key !== void 0 && !TERMINAL_ERROR_KEYS.has(key)
60
+ message: message ?? errorId,
61
+ error: {
62
+ code,
63
+ errorId,
64
+ ...message !== void 0 && { message }
65
+ },
66
+ retryable: !TERMINAL_ERROR_CODES.has(code)
61
67
  };
62
68
  }
63
69
  if (!result.captchaType) return {
@@ -2,12 +2,13 @@ const require_authenticatedBadge = require("./authenticatedBadge.cjs");
2
2
  const require_customDetectBot = require("./customDetectBot.cjs");
3
3
  const require_frictionlessResultGuard = require("./frictionlessResultGuard.cjs");
4
4
  const require_sessionInvalidatedRecovery = require("./sessionInvalidatedRecovery.cjs");
5
+ let _prosopo_common = require("@prosopo/common");
5
6
  let _prosopo_locale = require("@prosopo/locale");
6
7
  let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
7
8
  let _prosopo_types = require("@prosopo/types");
8
9
  let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
9
10
  //#region src/procaptchaFrictionless.ts
10
- var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
11
+ var frontendError = (error) => (0, _prosopo_common.toPublicError)(error, "FRONTEND_ERROR");
11
12
  var MAX_PRESS_HOLD_MS = 1e3;
12
13
  var PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
13
14
  var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).mountProcaptchaImageWidget;
@@ -101,16 +102,13 @@ var mountProcaptchaFrictionless = (container, props) => {
101
102
  teardown.add(() => clearTimeout(timer));
102
103
  };
103
104
  const cannotLoadText = () => i18n.isInitialized ? i18n.t("WIDGET.CANNOT_LOAD") : "Cannot load CAPTCHA";
104
- const fallOverWithStyle = (errorMessage, errorKey) => {
105
- if ("CAPTCHA.NO_SESSION_FOUND" === errorKey) {
105
+ const fallOverWithStyle = (error) => {
106
+ if (error?.code === "NO_SESSION_FOUND") {
106
107
  restartComponentTimeout();
107
108
  renderPlaceholder(config.mode, void 0, true);
108
109
  return;
109
110
  }
110
- renderPlaceholder(config.mode, errorMessage ? (0, _prosopo_locale.localiseErrorMessage)(i18n, {
111
- message: errorMessage,
112
- key: errorKey
113
- }) : cannotLoadText(), false);
111
+ renderPlaceholder(config.mode, error ? (0, _prosopo_locale.localiseError)(i18n, error) : cannotLoadText(), false);
114
112
  };
115
113
  const replayPendingExecute = () => {
116
114
  if (!pendingExecute) return;
@@ -134,9 +132,12 @@ var mountProcaptchaFrictionless = (container, props) => {
134
132
  start();
135
133
  return;
136
134
  }
137
- const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
138
- events.onError(new Error(message));
139
- fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
135
+ const error = frontendError(new _prosopo_common.ProsopoError({
136
+ code: "NO_SESSION_FOUND",
137
+ errorSite: "FRIC-3"
138
+ }));
139
+ events.onError(new Error((0, _prosopo_locale.localiseError)(i18n, error)));
140
+ fallOverWithStyle(error);
140
141
  };
141
142
  const onReload = (x, y, options) => {
142
143
  pendingRetryCoords.current = require_sessionInvalidatedRecovery.normaliseRetryCoords(x, y);
@@ -232,9 +233,12 @@ var mountProcaptchaFrictionless = (container, props) => {
232
233
  };
233
234
  const start = async () => {
234
235
  if (!(0, _prosopo_procaptcha_common.isSecureBrowserContext)()) {
235
- const errorMessage = i18n.isInitialized ? i18n.t("WIDGET.INSECURE_CONTEXT") : "Procaptcha requires a secure (HTTPS) connection";
236
- events.onError(new Error(errorMessage));
237
- fallOverWithStyle(errorMessage, "WIDGET.INSECURE_CONTEXT");
236
+ const error = frontendError(new _prosopo_common.ProsopoError({
237
+ code: "INSECURE_CONTEXT",
238
+ errorSite: "FRIC-4"
239
+ }));
240
+ events.onError(new Error((0, _prosopo_locale.localiseError)(i18n, error)));
241
+ fallOverWithStyle(error);
238
242
  return;
239
243
  }
240
244
  await (0, _prosopo_procaptcha_common.providerRetry)(async () => {
@@ -250,7 +254,7 @@ var mountProcaptchaFrictionless = (container, props) => {
250
254
  errorMessage: guard.message
251
255
  };
252
256
  events.onError(new Error(guard.message));
253
- fallOverWithStyle(guard.message, guard.key);
257
+ fallOverWithStyle(guard.error);
254
258
  return;
255
259
  }
256
260
  nextRefreshOf = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AA0FxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAkQtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AA0FxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CA0BX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAkQtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { DetectorLoaderFromScript } from "./detectorLoader.js";
2
2
  import { takePrefetchedDetector } from "./detectorPrefetch.js";
3
+ import { ProsopoError } from "@prosopo/common";
3
4
  import { widgetLanguageHeaders } from "@prosopo/locale";
4
5
  import { ExtensionLoader, getProcaptchaRandomActiveProvider, pickIpMode, resolveClientSessionId } from "@prosopo/procaptcha-common";
5
6
  import { ProviderApi } from "@prosopo/api";
6
- import { ProsopoEnvError } from "@prosopo/common";
7
7
  //#region src/customDetectBot.ts
8
8
  var ASSIGN_TIMEOUT_MS = 1e4;
9
9
  var sanitiseHref = (href) => {
@@ -53,7 +53,11 @@ var withTimeout = async (promise, ms) => {
53
53
  let timeoutId;
54
54
  const timeoutPromise = new Promise((_, reject) => {
55
55
  timeoutId = setTimeout(() => {
56
- reject(new ProsopoEnvError("API.UNKNOWN"));
56
+ reject(new ProsopoError({
57
+ code: "UNEXPECTED",
58
+ errorSite: "FRIC-1",
59
+ message: "Unknown API error"
60
+ }));
57
61
  }, ms);
58
62
  });
59
63
  try {
@@ -66,7 +70,10 @@ var withTimeout = async (promise, ms) => {
66
70
  }
67
71
  };
68
72
  var customDetectBot = async (config, container, restartFn, retryContext, refreshOf, switchToImage) => {
69
- if (!config.account.address) throw new ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
73
+ if (!config.account.address) throw new ProsopoError({
74
+ code: "SITE_KEY_MISSING",
75
+ errorSite: "FRIC-2"
76
+ });
70
77
  const ipMode = pickIpMode(config);
71
78
  const extClassPromise = ExtensionLoader(config.web2);
72
79
  const prefetched = !retryContext || retryContext.attempt <= 1 ? takePrefetchedDetector(config.defaultEnvironment, ipMode, config.account.address) : void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACN,eAAe,EACf,iCAAiC,EACjC,UAAU,EACV,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EACN,wBAAwB,GAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,sBAAsB,GACtB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAqBjC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IACzD,IAAI,CAAC;QACJ,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,SAAS,CAAC;QACvD,OAAO,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC,CAAC;AAOF,MAAM,kBAAkB,GAAG,GAAa,EAAE;IACzC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAA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C,kBAAkB;QACtD,eAAe,EAAE,eAAe,CAAC,eAAe;KAChD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,10 @@
1
+ declare module "@prosopo/common" {
2
+ interface ErrorSites {
3
+ "FRIC-1": true;
4
+ "FRIC-2": true;
5
+ "FRIC-3": true;
6
+ "FRIC-4": true;
7
+ }
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=errorSites.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorSites.d.ts","sourceRoot":"","sources":["../src/errorSites.ts"],"names":[],"mappings":"AAcA,OAAO,QAAQ,iBAAiB,CAAC;IAChC,UAAU,UAAU;QACnB,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;KACf;CACD;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=errorSites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorSites.js","sourceRoot":"","sources":["../src/errorSites.ts"],"names":[],"mappings":""}
@@ -1,17 +1,15 @@
1
+ import type { WidgetError } from "@prosopo/types";
1
2
  export type FrictionlessGuardOutcome = {
2
3
  kind: "pass";
3
4
  } | {
4
5
  kind: "error";
5
6
  message: string;
6
- key?: string;
7
+ error?: WidgetError;
7
8
  retryable: boolean;
8
9
  };
9
10
  export type FrictionlessGuardInput = {
10
11
  captchaType?: string;
11
- error?: {
12
- message?: string;
13
- key?: string;
14
- };
12
+ error?: Partial<WidgetError>;
15
13
  };
16
14
  declare const MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
17
15
  export declare const evaluateFrictionlessResult: (result: FrictionlessGuardInput) => FrictionlessGuardOutcome;
@@ -1 +1 @@
1
- {"version":3,"file":"frictionlessResultGuard.d.ts","sourceRoot":"","sources":["../src/frictionlessResultGuard.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,wBAAwB,GACjC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAuCxE,MAAM,MAAM,sBAAsB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,4BAA4B,qEACiC,CAAC;AAoBpE,eAAO,MAAM,0BAA0B,WAC9B,sBAAsB,KAC5B,wBAwBF,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"frictionlessResultGuard.d.ts","sourceRoot":"","sources":["../src/frictionlessResultGuard.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,wBAAwB,GACjC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IACA,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CAClB,CAAC;AAuCL,MAAM,MAAM,sBAAsB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAM,4BAA4B,qEACiC,CAAC;AAoBpE,eAAO,MAAM,0BAA0B,WAC9B,sBAAsB,KAC5B,wBAwBF,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC"}