@prosopo/client-bundle-example 2.11.2 → 2.11.3

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/client-bundle-example@2.11.2 build:cjs
2
+ > @prosopo/client-bundle-example@2.11.3 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -16,7 +16,6 @@ ViteCommonJSConfig: .
16
16
  {
17
17
  externals: [
18
18
  '@prosopo/dotenv',
19
- 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.
20
19
  '@prosopo/logger',
21
20
  '@prosopo/util',
22
21
  '@prosopo/locale',
@@ -24,6 +23,7 @@ ViteCommonJSConfig: .
24
23
  '@prosopo/util-crypto'
25
24
  ]
26
25
  }
26
+ 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.
27
27
  vite v8.1.5 building ssr environment for production...
28
28
  Bundle build started
29
29
  
@@ -33,4 +33,4 @@ computing gzip size...
33
33
  dist/cjs/index.cjs 0.71 kB │ gzip: 0.27 kB
34
34
  dist/cjs/plugins/pages.cjs 4.63 kB │ gzip: 1.20 kB
35
35
 
36
- ✓ built in 60ms
36
+ ✓ built in 52ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/client-bundle-example@2.11.2 build:tsc
2
+ > @prosopo/client-bundle-example@2.11.3 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 9:56:19 AM - Projects in this build:
5
+ 12:38:23 PM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../../packages/util/tsconfig.json
8
8
  * ../../packages/logger/tsconfig.json
@@ -12,21 +12,21 @@
12
12
  * ../../packages/types/tsconfig.json
13
13
  * tsconfig.json
14
14
 
15
- 9:56:19 AM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/vite/vite.frontend.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
15
+ 12:38:23 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'
16
16
 
17
- 9:56:19 AM - Project '../../packages/util/tsconfig.json' is up to date because newest input '../../packages/util/src/verifyRecency.ts' is older than output '../../packages/util/tsconfig.tsbuildinfo'
17
+ 12:38:23 PM - Project '../../packages/util/tsconfig.json' is up to date because newest input '../../packages/util/src/url.ts' is older than output '../../packages/util/tsconfig.tsbuildinfo'
18
18
 
19
- 9:56:19 AM - Project '../../packages/logger/tsconfig.json' is up to date because newest input '../../packages/logger/src/tests/loggerBrowser.unit.test.ts' is older than output '../../packages/logger/tsconfig.tsbuildinfo'
19
+ 12:38:23 PM - Project '../../packages/logger/tsconfig.json' is up to date because newest input '../../packages/logger/src/index.ts' is older than output '../../packages/logger/tsconfig.tsbuildinfo'
20
20
 
21
- 9:56:19 AM - Project '../../packages/dotenv/tsconfig.json' is up to date because newest input '../../packages/dotenv/src/index.ts' is older than output '../../packages/dotenv/tsconfig.tsbuildinfo'
21
+ 12:38:23 PM - Project '../../packages/dotenv/tsconfig.json' is up to date because newest input '../../packages/dotenv/src/env.ts' is older than output '../../packages/dotenv/tsconfig.tsbuildinfo'
22
22
 
23
- 9:56:19 AM - Project '../../packages/locale/tsconfig.json' is up to date because newest input '../../packages/locale/src/util.ts' is older than output '../../packages/locale/tsconfig.tsbuildinfo'
23
+ 12:38:23 PM - Project '../../packages/locale/tsconfig.json' is up to date because newest input '../../packages/locale/src/translationKey.ts' is older than output '../../packages/locale/tsconfig.tsbuildinfo'
24
24
 
25
- 9:56:19 AM - Project '../../packages/util-crypto/tsconfig.json' is up to date because newest input '../../packages/util-crypto/src/types.ts' is older than output '../../packages/util-crypto/tsconfig.tsbuildinfo'
25
+ 12:38:23 PM - Project '../../packages/util-crypto/tsconfig.json' is up to date because newest input '../../packages/util-crypto/src/types.ts' is older than output '../../packages/util-crypto/tsconfig.tsbuildinfo'
26
26
 
27
- 9:56:20 AM - Project '../../packages/types/tsconfig.json' is up to date because newest input '../../packages/types/src/types.test-d.ts' is older than output '../../packages/types/tsconfig.tsbuildinfo'
27
+ 12:38:23 PM - Project '../../packages/types/tsconfig.json' is up to date because newest input '../../packages/types/src/types.test-d.ts' is older than output '../../packages/types/tsconfig.tsbuildinfo'
28
28
 
29
- 9:56:20 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
29
+ 12:38:23 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
30
30
 
31
- 9:56:20 AM - Building project '/home/runner/work/captcha/captcha/demos/client-bundle-example/tsconfig.json'...
31
+ 12:38:23 PM - Building project '/home/runner/work/captcha/captcha/demos/client-bundle-example/tsconfig.json'...
32
32
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/client-bundle-example@2.11.2 build
2
+ > @prosopo/client-bundle-example@2.11.3 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/client-bundle-example@2.11.2 build:cross-env
6
+ > @prosopo/client-bundle-example@2.11.3 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -38,4 +38,4 @@ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
38
38
  dist/index.js 0.42 kB │ gzip: 0.19 kB
39
39
  dist/plugins/pages.js 4.04 kB │ gzip: 1.15 kB
40
40
 
41
- ✓ built in 59ms
41
+ ✓ built in 124ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @prosopo/client-bundle-example
2
2
 
3
+ ## 2.11.3
4
+ ### Patch Changes
5
+
6
+ - 8178ab2: The explicit-render demo pages now wait for `render()` before logging, so they show the real widget id instead of `widget ID: [object Promise]`. The two frictionless explicit pages log the id as well. A test checks that every demo page waits for `render()`.
7
+
3
8
  ## 2.11.2
4
9
  ### Patch Changes
5
10
 
package/package.json CHANGED
@@ -25,13 +25,13 @@
25
25
  "start": "NODE_ENV=${NODE_ENV:-development}; vite serve ./src --port 9232 --config vite.config.ts --mode=$NODE_ENV",
26
26
  "test": "NODE_ENV=${NODE_ENV:-test}; npx vitest run --config ./vite.test.config.ts"
27
27
  },
28
- "version": "2.11.2",
28
+ "version": "2.11.3",
29
29
  "devDependencies": {
30
30
  "@emotion/cache": "11.14.0",
31
31
  "@prosopo/config": "3.4.2",
32
- "@prosopo/dotenv": "3.0.58",
33
- "@prosopo/locale": "3.6.1",
34
- "@prosopo/types": "5.11.0",
32
+ "@prosopo/dotenv": "3.0.59",
33
+ "@prosopo/locale": "3.6.2",
34
+ "@prosopo/types": "5.12.0",
35
35
  "@types/node": "22.5.5",
36
36
  "@vitest/coverage-v8": "4.1.11",
37
37
  "concurrently": "9.0.1",
@@ -219,7 +219,7 @@
219
219
  const captchaContainer = document.getElementById('procaptcha-container');
220
220
 
221
221
  // Render the CAPTCHA
222
- const widgetId = render(captchaContainer, {
222
+ const widgetId = await render(captchaContainer, {
223
223
  siteKey: import.meta.env.PROSOPO_SITE_KEY_FRICTIONLESS,
224
224
  callback: onCaptchaVerified,
225
225
  "failed-callback": function () {
@@ -229,6 +229,7 @@
229
229
  web3: true,
230
230
  userAccountAddress: account
231
231
  });
232
+ window.updateCaptchaStatus('CAPTCHA render function called with widget ID: ' + widgetId, 'info');
232
233
  })
233
234
 
234
235
  </script>
@@ -189,7 +189,7 @@
189
189
  window.updateCaptchaStatus('Challenge placement: ' + placement, 'info');
190
190
 
191
191
  // Render the CAPTCHA
192
- const widgetId = render(captchaContainer, {
192
+ const widgetId = await render(captchaContainer, {
193
193
  siteKey: import.meta.env.PROSOPO_SITE_KEY_FRICTIONLESS,
194
194
  placement,
195
195
  callback: onCaptchaVerified,
@@ -198,6 +198,7 @@
198
198
  window.updateCaptchaStatus('Challenge failed - CAPTCHA verification could not be completed', 'error');
199
199
  }
200
200
  });
201
+ window.updateCaptchaStatus('CAPTCHA render function called with widget ID: ' + widgetId, 'info');
201
202
 
202
203
  </script>
203
204
  </body>
@@ -157,7 +157,7 @@
157
157
 
158
158
  // Render the CAPTCHA
159
159
 
160
- const widgetId = render(document.getElementById('procaptcha-container'), {
160
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
161
161
  siteKey: import.meta.env.PROSOPO_SITE_KEY_IMAGE,
162
162
  callback: handleCaptchaResponse,
163
163
  "failed-callback": handleCaptchaFailed,
@@ -116,7 +116,7 @@
116
116
  }
117
117
 
118
118
  // Wait for DOM content to be loaded
119
- document.addEventListener('DOMContentLoaded', function() {
119
+ document.addEventListener('DOMContentLoaded', async function() {
120
120
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
121
121
 
122
122
  // Render the CAPTCHA
@@ -127,7 +127,7 @@
127
127
  : "popup";
128
128
  window.updateCaptchaStatus('Challenge placement: ' + placement, 'info');
129
129
 
130
- const widgetId = render(document.getElementById('procaptcha-container'), {
130
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
131
131
  siteKey: import.meta.env.PROSOPO_SITE_KEY_IMAGE,
132
132
  placement,
133
133
  callback: handleCaptchaResponse,
@@ -93,11 +93,11 @@
93
93
  }
94
94
 
95
95
  // Wait for DOM content to be loaded
96
- document.addEventListener('DOMContentLoaded', function() {
96
+ document.addEventListener('DOMContentLoaded', async function() {
97
97
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
98
98
 
99
99
  // Render the CAPTCHA
100
- const widgetId = render(document.getElementById('procaptcha-container'), {
100
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
101
101
  siteKey: import.meta.env.PROSOPO_SITE_KEY_FRICTIONLESS,
102
102
  callback: handleCaptchaResponse,
103
103
  "failed-callback": handleCaptchaFailed,
@@ -117,11 +117,11 @@
117
117
  }
118
118
 
119
119
  // Wait for DOM content to be loaded
120
- document.addEventListener('DOMContentLoaded', function() {
120
+ document.addEventListener('DOMContentLoaded', async function() {
121
121
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
122
122
 
123
123
  // Render the CAPTCHA
124
- const widgetId = render(document.getElementById('procaptcha-container'), {
124
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
125
125
  siteKey: import.meta.env.PROSOPO_SITE_KEY_IMAGE,
126
126
  callback: handleCaptchaResponse,
127
127
  "failed-callback": handleCaptchaFailed,
@@ -117,11 +117,11 @@
117
117
  }
118
118
 
119
119
  // Wait for DOM content to be loaded
120
- document.addEventListener('DOMContentLoaded', function() {
120
+ document.addEventListener('DOMContentLoaded', async function() {
121
121
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
122
122
 
123
123
  // Render the CAPTCHA
124
- const widgetId = render(document.getElementById('procaptcha-container'), {
124
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
125
125
  siteKey: import.meta.env.PROSOPO_SITE_KEY_POW,
126
126
  callback: handleCaptchaResponse,
127
127
  "failed-callback": handleCaptchaFailed,
@@ -116,11 +116,11 @@
116
116
  }
117
117
 
118
118
  // Wait for DOM content to be loaded
119
- document.addEventListener('DOMContentLoaded', function() {
119
+ document.addEventListener('DOMContentLoaded', async function() {
120
120
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
121
121
 
122
122
  // Render the CAPTCHA
123
- const widgetId = render(document.getElementById('procaptcha-container'), {
123
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
124
124
  siteKey: import.meta.env.PROSOPO_SITE_KEY_PUZZLE,
125
125
  callback: handleCaptchaResponse,
126
126
  "failed-callback": handleCaptchaFailed,
@@ -154,7 +154,7 @@
154
154
  // Render the CAPTCHA
155
155
  const account = document.getElementById('account-select') ? document.getElementById('account-select').value : null;
156
156
  window.updateCaptchaStatus(`Rendering the CAPTCHA for account ${account}`, 'info');
157
- const widgetId = render(document.getElementById('procaptcha-container'), {
157
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
158
158
  siteKey: import.meta.env.PROSOPO_SITE_KEY_POW,
159
159
  callback: handleCaptchaResponse,
160
160
  "failed-callback": handleCaptchaFailed,
@@ -116,11 +116,11 @@
116
116
  }
117
117
 
118
118
  // Wait for DOM content to be loaded
119
- document.addEventListener('DOMContentLoaded', function() {
119
+ document.addEventListener('DOMContentLoaded', async function() {
120
120
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
121
121
 
122
122
  // Render the CAPTCHA
123
- const widgetId = render(document.getElementById('procaptcha-container'), {
123
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
124
124
  siteKey: import.meta.env.PROSOPO_SITE_KEY_POW,
125
125
  callback: handleCaptchaResponse,
126
126
  "failed-callback": handleCaptchaFailed
@@ -116,7 +116,7 @@
116
116
  }
117
117
 
118
118
  // Wait for DOM content to be loaded
119
- document.addEventListener('DOMContentLoaded', function() {
119
+ document.addEventListener('DOMContentLoaded', async function() {
120
120
  window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info');
121
121
 
122
122
  // Render the CAPTCHA
@@ -127,7 +127,7 @@
127
127
  : "popup";
128
128
  window.updateCaptchaStatus('Challenge placement: ' + placement, 'info');
129
129
 
130
- const widgetId = render(document.getElementById('procaptcha-container'), {
130
+ const widgetId = await render(document.getElementById('procaptcha-container'), {
131
131
  siteKey: import.meta.env.PROSOPO_SITE_KEY_PUZZLE,
132
132
  placement,
133
133
  callback: handleCaptchaResponse,
@@ -0,0 +1,49 @@
1
+ // Copyright 2021-2026 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import fs from "node:fs";
16
+ import path from "node:path";
17
+ import { fileURLToPath } from "node:url";
18
+ import { describe, expect, it } from "vitest";
19
+
20
+ // `render()` resolves to the widget id; a demo that uses its return value
21
+ // without awaiting it prints "[object Promise]" instead of the id.
22
+ const srcDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
23
+
24
+ const pagesCallingRender: string[] = fs
25
+ .readdirSync(srcDir)
26
+ .filter((file: string) => file.endsWith(".html"))
27
+ .filter((file: string) =>
28
+ /\brender\(/.test(fs.readFileSync(path.join(srcDir, file), "utf8")),
29
+ );
30
+
31
+ describe("explicit-render demo pages", () => {
32
+ it("finds pages to check", () => {
33
+ expect(pagesCallingRender.length).toBeGreaterThan(0);
34
+ });
35
+
36
+ it.each(pagesCallingRender)("%s awaits render()", (file: string) => {
37
+ const html = fs.readFileSync(path.join(srcDir, file), "utf8");
38
+ const unawaited: string[] = html
39
+ .split("\n")
40
+ .filter(
41
+ (line: string) =>
42
+ /(?<![.\w])render\(/.test(line) &&
43
+ !/await\s+render\(/.test(line) &&
44
+ !/function\s+render\(/.test(line),
45
+ )
46
+ .map((line: string) => line.trim());
47
+ expect(unawaited).toEqual([]);
48
+ });
49
+ });