@prosopo/client-bundle-example 2.10.24 → 2.11.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.
Files changed (51) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +5 -4
  2. package/.turbo/turbo-build$colon$tsc.log +11 -11
  3. package/.turbo/turbo-build.log +6 -5
  4. package/CHANGELOG.md +16 -0
  5. package/dist/cjs/index.cjs +13 -41
  6. package/dist/cjs/plugins/pages.cjs +113 -0
  7. package/dist/index.js +2 -42
  8. package/dist/plugins/pages.js +103 -0
  9. package/package.json +2 -2
  10. package/src/frictionless-explicit-web3.html +10 -23
  11. package/src/frictionless-explicit.html +10 -22
  12. package/src/frictionless-implicit.html +60 -86
  13. package/src/frictionless-manual-start.html +13 -33
  14. package/src/image-explicit-web3.html +8 -24
  15. package/src/image-explicit.html +8 -23
  16. package/src/image-implicit.html +192 -0
  17. package/src/index.html +11 -26
  18. package/src/index.ts +1 -62
  19. package/src/invisible-frictionless-explicit.html +8 -17
  20. package/src/invisible-frictionless-implicit.html +8 -25
  21. package/src/invisible-image-explicit.html +8 -23
  22. package/src/invisible-image-implicit.html +8 -24
  23. package/src/invisible-pow-explicit.html +8 -23
  24. package/src/invisible-pow-implicit.html +9 -21
  25. package/src/invisible-puzzle-explicit.html +8 -23
  26. package/src/invisible-puzzle-implicit.html +9 -21
  27. package/src/plugins/code-snippet-injector.ts +179 -0
  28. package/src/plugins/form-filler-injector.ts +36 -121
  29. package/src/plugins/layout-injector.ts +238 -0
  30. package/src/plugins/logo.ts +15 -0
  31. package/src/plugins/pages.ts +219 -0
  32. package/src/plugins/placement-injector.ts +25 -64
  33. package/src/plugins/slots.ts +32 -0
  34. package/src/plugins/status-log-injector.ts +35 -114
  35. package/src/pow-explicit-web3.html +8 -24
  36. package/src/pow-explicit.html +8 -23
  37. package/src/pow-implicit-sessionid.html +10 -24
  38. package/src/pow-implicit.html +9 -24
  39. package/src/puzzle-bind-explicit.html +9 -24
  40. package/src/puzzle-explicit.html +8 -23
  41. package/src/puzzle-implicit.html +9 -24
  42. package/src/styles/demo.css +803 -0
  43. package/src/tests/plugins.unit.test.ts +285 -118
  44. package/tsconfig.tsbuildinfo +1 -1
  45. package/vite.config.ts +5 -5
  46. package/src/plugins/explanation-injector.ts +0 -294
  47. package/src/plugins/navigation-injector.ts +0 -606
  48. package/src/styles/captcha.css +0 -78
  49. package/src/styles/field.css +0 -12
  50. package/src/tests/floatLabel.unit.test.ts +0 -195
  51. package/src/tests/floatLabelReady.unit.test.ts +0 -36
@@ -11,82 +11,40 @@
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
- // Vite plugin to inject CAPTCHA status log into HTML files
14
+
15
+ // Vite plugin that adds the event log. Demo pages report what the widget is
16
+ // doing through window.updateCaptchaStatus.
15
17
  import type { IndexHtmlTransformContext, Plugin } from "vite";
18
+ import { fillSlot } from "./slots.js";
16
19
 
17
20
  export default function statusLogInjector(): Plugin {
18
- // CSS for status log styling
19
- const statusLogCss = `
20
- <style>
21
- .captcha-status {
22
- margin-top: 20px;
23
- padding: 15px;
24
- background-color: #f0f8ff;
25
- border: 2px solid #2196F3;
26
- border-radius: 5px;
27
- font-family: monospace;
28
- font-size: 14px;
29
- }
30
- .status-item {
31
- margin: 5px 0;
32
- padding: 5px;
33
- }
34
- .status-success {
35
- color: #4CAF50;
36
- font-weight: bold;
37
- }
38
- .status-error {
39
- color: #F44336;
40
- font-weight: bold;
41
- }
42
- .status-info {
43
- color: #2196F3;
44
- }
45
- .status-warning {
46
- color: #FF9800;
47
- }
48
- .status-title {
49
- font-weight: bold;
50
- margin-bottom: 10px;
51
- border-bottom: 1px solid #2196F3;
52
- padding-bottom: 5px;
53
- }
54
- .console-output {
55
- margin-top: 20px;
56
- padding: 10px;
57
- background-color: #f5f5f5;
58
- border: 1px solid #ddd;
59
- border-radius: 4px;
60
- font-family: monospace;
61
- white-space: pre-wrap;
62
- max-height: 200px;
63
- overflow-y: auto;
64
- }
65
- </style>
66
- `;
67
-
68
- // JavaScript for status log functionality
69
21
  const statusLogJs = `
70
22
  <script type="module">
71
- // Function to update CAPTCHA status display
72
23
  function updateCaptchaStatus(message, type = 'info') {
73
24
  const statusContainer = document.getElementById('captcha-status');
74
25
  if (!statusContainer) return;
75
-
76
- const timestamp = new Date().toLocaleTimeString();
26
+
27
+ const time = document.createElement('span');
28
+ time.className = 'status-item__time';
29
+ time.textContent = new Date().toLocaleTimeString();
30
+ const dot = document.createElement('span');
31
+ dot.className = 'status-item__dot';
32
+ const text = document.createElement('span');
33
+ text.className = 'status-item__message';
34
+ text.textContent = message;
35
+
77
36
  const statusItem = document.createElement('div');
78
37
  statusItem.className = \`status-item status-\${type}\`;
79
- statusItem.innerHTML = \`[\${timestamp}] \${message}\`;
38
+ statusItem.append(time, dot, text);
80
39
  statusContainer.appendChild(statusItem);
81
-
82
- // Also log to console
40
+ statusContainer.scrollTop = statusContainer.scrollHeight;
41
+
83
42
  console.log(\`CAPTCHA Status: \${message}\`);
84
43
  }
85
44
 
86
- // Make updateCaptchaStatus available globally
87
45
  window.updateCaptchaStatus = updateCaptchaStatus;
88
46
 
89
- // Override the original callbacks with enhanced versions that use status logging
47
+ // Wrap the page's own callbacks so every page logs the same events.
90
48
  const originalOnCaptchaFailed = window.onCaptchaFailed;
91
49
  window.onCaptchaFailed = function() {
92
50
  updateCaptchaStatus('Challenge failed - CAPTCHA verification could not be completed', 'error');
@@ -101,98 +59,61 @@ export default function statusLogInjector(): Plugin {
101
59
  };
102
60
 
103
61
  const originalOnActionHandler = window.onActionHandler;
104
- window.onActionHandler = function() {
62
+ window.onActionHandler = function(token) {
105
63
  const procaptchaElements = document.getElementsByName('procaptcha-response');
106
-
64
+
107
65
  if (!procaptchaElements.length) {
108
66
  updateCaptchaStatus('Error: No CAPTCHA response token found', 'error');
109
67
  alert("Must complete captcha");
110
68
  return;
111
69
  }
112
-
70
+
113
71
  updateCaptchaStatus('Form submission initiated with valid CAPTCHA token', 'info');
114
- if (originalOnActionHandler) originalOnActionHandler();
72
+ if (originalOnActionHandler) originalOnActionHandler(token);
115
73
  };
116
74
 
117
- document.addEventListener('DOMContentLoaded', function() {
118
- updateCaptchaStatus('Page loaded - Initializing CAPTCHA system', 'info');
119
-
120
- // Monitor DOM for CAPTCHA initialization
121
- const observer = new MutationObserver((mutations) => {
122
- mutations.forEach((mutation) => {
123
- if (mutation.addedNodes.length) {
124
- for (let i = 0; i < mutation.addedNodes.length; i++) {
125
- const node = mutation.addedNodes[i];
126
- if (node.classList && (node.classList.contains('procaptcha') ||
127
- node.querySelector && node.querySelector('.procaptcha'))) {
128
- updateCaptchaStatus('CAPTCHA DOM elements initialized', 'info');
129
- observer.disconnect();
130
- break;
131
- }
132
- }
133
- }
134
- });
135
- });
136
-
137
- observer.observe(document.body, { childList: true, subtree: true });
138
- });
139
-
140
- // Create a method to show CAPTCHA execution events
141
75
  document.addEventListener('procaptcha:execute', function(e) {
142
- // Determine captcha type from the page URL
143
76
  const url = window.location.pathname;
144
77
  const isFrictionless = url.includes('frictionless');
145
78
  const isImage = url.includes('image');
146
79
  const isPow = url.includes('pow');
147
-
80
+
148
81
  let captchaType = 'unknown';
149
82
  if (isFrictionless) captchaType = 'frictionless';
150
83
  else if (isImage) captchaType = 'image';
151
84
  else if (isPow) captchaType = 'pow';
152
-
85
+
153
86
  updateCaptchaStatus(\`CAPTCHA execution started: type=\${captchaType}\`, 'info');
154
87
  updateCaptchaStatus(\`Container: \${e.detail.containerId}, timestamp: \${new Date(e.detail.timestamp).toLocaleTimeString()}\`, 'info');
155
88
  });
156
89
  </script>
157
90
  `;
158
91
 
159
- // HTML for status log container
160
- const statusLogHtml = `
161
- <!-- CAPTCHA Status Display -->
162
- <div id="captcha-status" class="captcha-status">
163
- <div class="status-title">CAPTCHA Status Log</div>
164
- </div>
165
-
166
- <!-- Console output display area -->
167
- <div id="console-output" class="console-output" style="display: none;"></div>
168
- `;
92
+ const statusLogHtml = `<div id="captcha-status" class="captcha-status" aria-live="polite"></div>`;
169
93
 
170
94
  return {
171
95
  name: "status-log-injector",
172
96
  transformIndexHtml: {
173
- order: "post", // Run after other HTML transforms
174
- handler(html: string, ctx: IndexHtmlTransformContext): string {
175
- // Skip if no HTML body is found
97
+ order: "post",
98
+ handler(html: string, _ctx: IndexHtmlTransformContext): string {
176
99
  if (!html.includes("<body") || !html.includes("</body>")) {
177
100
  return html;
178
101
  }
179
102
 
180
- // Skip if status log already exists
181
103
  if (html.includes('id="captcha-status"')) {
182
104
  return html;
183
105
  }
184
106
 
185
- // Add CSS to head
186
- let updatedHtml = html.replace("</head>", `${statusLogCss}</head>`);
107
+ const withJs = html.replace("</head>", () => `${statusLogJs}</head>`);
187
108
 
188
- // Add JavaScript to head
189
- updatedHtml = updatedHtml.replace("</head>", `${statusLogJs}</head>`);
190
-
191
- // Add status log container after the form or before the closing body if no form
192
- if (updatedHtml.includes("</form>")) {
193
- return updatedHtml.replace("</form>", `</form>${statusLogHtml}`);
109
+ const inSlot = fillSlot(withJs, "events", statusLogHtml);
110
+ if (inSlot) {
111
+ return inSlot;
112
+ }
113
+ if (withJs.includes("</form>")) {
114
+ return withJs.replace("</form>", () => `</form>${statusLogHtml}`);
194
115
  }
195
- return updatedHtml.replace("</body>", `${statusLogHtml}</body>`);
116
+ return withJs.replace("</body>", () => `${statusLogHtml}</body>`);
196
117
  },
197
118
  },
198
119
  };
@@ -1,14 +1,9 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha Proof of Work Mode - Explicit Rendering</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Proof of Work, explicit rendering, web3</title>
10
6
  <script type="module">
11
- // Function to update CAPTCHA status display is now provided by status-log-injector
12
7
 
13
8
  document.addEventListener('DOMContentLoaded', function() {
14
9
  updateCaptchaStatus('Page loaded - Initializing CAPTCHA system', 'info');
@@ -33,43 +28,33 @@
33
28
  observer.observe(document.body, { childList: true, subtree: true });
34
29
  });
35
30
 
36
- // updateCaptchaStatus is now provided by status-log-injector
37
31
  </script>
38
32
  </head>
39
33
  <body>
40
- <div class="mui-container">
41
- <h1>Procaptcha Proof of Work Mode - Explicit Rendering</h1>
42
- <p>This example demonstrates how to use Procaptcha in Proof of Work mode with explicit rendering.</p>
34
+ <div class="demo-card">
43
35
 
44
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
36
+ <form id="demo-form" class="demo-form">
37
+ <h2>Create an account</h2>
45
38
 
46
- <form id="demo-form" class="mui-form">
47
- <h2>Example Form</h2>
48
-
49
- <div class="mui-textfield mui-textfield--float-label">
39
+ <div class="demo-field">
50
40
  <label for="name">Name</label>
51
41
  <input type="text" id="name" name="name" required />
52
42
  </div>
53
43
 
54
- <div class="mui-textfield mui-textfield--float-label">
44
+ <div class="demo-field">
55
45
  <label for="email">Email</label>
56
46
  <input type="email" id="email" name="email" required />
57
47
  </div>
58
48
 
59
- <!-- The container for the CAPTCHA -->
60
49
  <div id="procaptcha-container"></div>
61
50
 
62
- <button type="submit" class="mui-btn mui-btn--raised">Submit</button>
51
+ <button type="submit" class="demo-button">Submit</button>
63
52
 
64
53
  <div id="error"></div>
65
54
  </form>
66
55
 
67
- <div id="result" class="info-box" style="display: none;"></div>
68
-
69
- <!-- Console output display area -->
70
- <div id="console-output" class="console-output" style="display: none;"></div>
56
+ <div id="result" class="demo-result" style="display: none;"></div>
71
57
 
72
- <!-- Explanation will be injected by the explanation-injector plugin -->
73
58
  </div>
74
59
 
75
60
  <script type="module">
@@ -141,7 +126,6 @@
141
126
  // render a modal and get the user to select 1 account
142
127
  const accountSelect = document.createElement('select');
143
128
  accountSelect.id = 'account-select';
144
- accountSelect.classList.add('mui-select');
145
129
  accountSelect.classList.add('account-select');
146
130
  accounts.forEach((account) => {
147
131
  const option = document.createElement('option');
@@ -1,14 +1,9 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha Proof of Work Mode - Explicit Rendering</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Proof of Work, explicit rendering</title>
10
6
  <script type="module">
11
- // Function to update CAPTCHA status display is now provided by status-log-injector
12
7
 
13
8
  document.addEventListener('DOMContentLoaded', function() {
14
9
  updateCaptchaStatus('Page loaded - Initializing CAPTCHA system', 'info');
@@ -33,43 +28,33 @@
33
28
  observer.observe(document.body, { childList: true, subtree: true });
34
29
  });
35
30
 
36
- // updateCaptchaStatus is now provided by status-log-injector
37
31
  </script>
38
32
  </head>
39
33
  <body>
40
- <div class="mui-container">
41
- <h1>Procaptcha Proof of Work Mode - Explicit Rendering</h1>
42
- <p>This example demonstrates how to use Procaptcha in Proof of Work mode with explicit rendering.</p>
34
+ <div class="demo-card">
43
35
 
44
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
36
+ <form id="demo-form" class="demo-form">
37
+ <h2>Create an account</h2>
45
38
 
46
- <form id="demo-form" class="mui-form">
47
- <h2>Example Form</h2>
48
-
49
- <div class="mui-textfield mui-textfield--float-label">
39
+ <div class="demo-field">
50
40
  <label for="name">Name</label>
51
41
  <input type="text" id="name" name="name" required />
52
42
  </div>
53
43
 
54
- <div class="mui-textfield mui-textfield--float-label">
44
+ <div class="demo-field">
55
45
  <label for="email">Email</label>
56
46
  <input type="email" id="email" name="email" required />
57
47
  </div>
58
48
 
59
- <!-- The container for the CAPTCHA -->
60
49
  <div id="procaptcha-container"></div>
61
50
 
62
- <button type="submit" class="mui-btn mui-btn--raised">Submit</button>
51
+ <button type="submit" class="demo-button">Submit</button>
63
52
 
64
53
  <div id="error"></div>
65
54
  </form>
66
55
 
67
- <div id="result" class="info-box" style="display: none;"></div>
68
-
69
- <!-- Console output display area -->
70
- <div id="console-output" class="console-output" style="display: none;"></div>
56
+ <div id="result" class="demo-result" style="display: none;"></div>
71
57
 
72
- <!-- Explanation will be injected by the explanation-injector plugin -->
73
58
  </div>
74
59
 
75
60
  <script type="module">
@@ -1,14 +1,9 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha demo: PoW - Client Session Id</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Proof of Work, client session id</title>
10
6
  <script type="module">
11
- // Function to update CAPTCHA status display is now provided by status-log-injector
12
7
 
13
8
  // The site's own per-user session id. Rendered onto the widget via
14
9
  // data-sessionid and sent again at verify as clientSessionId; the
@@ -155,7 +150,6 @@
155
150
  observer.observe(document.body, { childList: true, subtree: true });
156
151
  });
157
152
 
158
-
159
153
  window.onCaptchaFailed = function () {
160
154
  console.log('Challenge failed');
161
155
  updateCaptchaStatus('Challenge failed - CAPTCHA verification could not be completed', 'error');
@@ -179,28 +173,24 @@
179
173
  </head>
180
174
  <body>
181
175
 
182
- <div class="mui-container">
183
- <h1>Proof of Work CAPTCHA - Client Session Id</h1>
184
- <p>Renders with <code>data-sessionid</code> and verifies with the same <code>clientSessionId</code>.</p>
185
-
186
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
176
+ <div class="demo-card">
187
177
 
188
- <form action="%PROSOPO_SERVER_URL%/signup" method="POST" class="mui-form">
189
- <h2>Example Login Form</h2>
190
- <div class="mui-textfield mui-textfield--float-label">
178
+ <form action="%PROSOPO_SERVER_URL%/signup" method="POST" class="demo-form">
179
+ <h2>Create an account</h2>
180
+ <p class="demo-note">Renders with <code>data-sessionid</code> and verifies with the same <code>clientSessionId</code>.</p>
181
+ <div class="demo-field">
191
182
  <label for="name">Name</label>
192
183
  <input id="name" type="text" name="name" required/>
193
184
  </div>
194
- <div class="mui-textfield mui-textfield--float-label">
185
+ <div class="demo-field">
195
186
  <label for="email">Email Address</label>
196
187
  <input id="email" type="email" name="email" required/>
197
188
  </div>
198
- <div class="mui-textfield mui-textfield--float-label">
189
+ <div class="demo-field">
199
190
  <label for="password">Password</label>
200
191
  <input id="password" type="password" name="password" required/>
201
192
  </div>
202
- <div class="mui-textfield mui-textfield--float-label">
203
- <!-- Dev sitekey -->
193
+ <div class="demo-field">
204
194
  <div
205
195
  class="procaptcha"
206
196
  data-theme="light"
@@ -211,13 +201,9 @@
211
201
  ></div>
212
202
  </div>
213
203
  <div id="messageContainer" style="display: none; color: black;"><span id="message"></span></div>
214
- <button type="button" class="mui-btn mui-btn--raised" onclick="onActionHandler()" data-cy="submit-button">Submit</button>
204
+ <button type="button" class="demo-button" onclick="onActionHandler()" data-cy="submit-button">Submit</button>
215
205
  </form>
216
206
 
217
- <!-- Console output display area -->
218
- <div id="console-output" class="console-output" style="display: none;"></div>
219
-
220
- <!-- Explanation will be injected by the explanation-injector plugin -->
221
207
  </div>
222
208
  </body>
223
209
  </html>
@@ -1,14 +1,9 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha demo: PoW - Implicit Rendering</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Proof of Work, implicit rendering</title>
10
6
  <script type="module">
11
- // Function to update CAPTCHA status display is now provided by status-log-injector
12
7
 
13
8
  window.addEventListener('load', () => {
14
9
 
@@ -140,7 +135,6 @@
140
135
  observer.observe(document.body, { childList: true, subtree: true });
141
136
  });
142
137
 
143
-
144
138
  window.onCaptchaFailed = function () {
145
139
  console.log('Challenge failed');
146
140
  updateCaptchaStatus('Challenge failed - CAPTCHA verification could not be completed', 'error');
@@ -164,28 +158,23 @@
164
158
  </head>
165
159
  <body>
166
160
 
167
- <div class="mui-container">
168
- <h1>Proof of Work CAPTCHA - Implicit Rendering</h1>
169
- <p>This example demonstrates how to use Procaptcha in Proof of Work mode with implicit rendering.</p>
170
-
171
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
161
+ <div class="demo-card">
172
162
 
173
- <form action="%PROSOPO_SERVER_URL%/signup" method="POST" class="mui-form">
174
- <h2>Example Login Form</h2>
175
- <div class="mui-textfield mui-textfield--float-label">
163
+ <form action="%PROSOPO_SERVER_URL%/signup" method="POST" class="demo-form">
164
+ <h2>Create an account</h2>
165
+ <div class="demo-field">
176
166
  <label for="name">Name</label>
177
167
  <input id="name" type="text" name="name" required/>
178
168
  </div>
179
- <div class="mui-textfield mui-textfield--float-label">
169
+ <div class="demo-field">
180
170
  <label for="email">Email Address</label>
181
171
  <input id="email" type="email" name="email" required/>
182
172
  </div>
183
- <div class="mui-textfield mui-textfield--float-label">
173
+ <div class="demo-field">
184
174
  <label for="password">Password</label>
185
175
  <input id="password" type="password" name="password" required/>
186
176
  </div>
187
- <div class="mui-textfield mui-textfield--float-label">
188
- <!-- Dev sitekey -->
177
+ <div class="demo-field">
189
178
  <div
190
179
  class="procaptcha"
191
180
  data-theme="light"
@@ -195,13 +184,9 @@
195
184
  ></div>
196
185
  </div>
197
186
  <div id="messageContainer" style="display: none; color: black;"><span id="message"></span></div>
198
- <button type="button" class="mui-btn mui-btn--raised" onclick="onActionHandler()" data-cy="submit-button">Submit</button>
187
+ <button type="button" class="demo-button" onclick="onActionHandler()" data-cy="submit-button">Submit</button>
199
188
  </form>
200
189
 
201
- <!-- Console output display area -->
202
- <div id="console-output" class="console-output" style="display: none;"></div>
203
-
204
- <!-- Explanation will be injected by the explanation-injector plugin -->
205
190
  </div>
206
191
  </body>
207
192
  </html>
@@ -1,50 +1,35 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha Puzzle Mode - Bound Button</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Puzzle, bound button</title>
10
6
  </head>
11
7
  <body>
12
- <div class="mui-container">
13
- <h1>Procaptcha Puzzle Mode - Bound Button</h1>
14
- <p>
15
- The widget is rendered once and bound to the form's own submit button with
16
- <code>bind: "#verify-btn"</code>. Clicking the button triggers that widget's challenge
17
- without ticking the checkbox. Add <code>?placement=float</code> to anchor the
18
- challenge to the widget instead of centring it.
19
- </p>
8
+ <div class="demo-card">
20
9
 
21
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
10
+ <form id="demo-form" class="demo-form">
11
+ <h2>Create an account</h2>
12
+ <p class="demo-note">The widget is bound to the submit button, so pressing it opens the challenge.</p>
22
13
 
23
- <form id="demo-form" class="mui-form">
24
- <h2>Example Form</h2>
25
-
26
- <div class="mui-textfield mui-textfield--float-label">
14
+ <div class="demo-field">
27
15
  <label for="name">Name</label>
28
16
  <input type="text" id="name" name="name" required />
29
17
  </div>
30
18
 
31
- <div class="mui-textfield mui-textfield--float-label">
19
+ <div class="demo-field">
32
20
  <label for="email">Email</label>
33
21
  <input type="email" id="email" name="email" required />
34
22
  </div>
35
23
 
36
- <!-- The container for the CAPTCHA -->
37
24
  <div id="procaptcha-container"></div>
38
25
 
39
- <button type="submit" id="verify-btn" class="mui-btn mui-btn--raised mui-btn--primary">Verify &amp; submit</button>
26
+ <button type="submit" id="verify-btn" class="demo-button">Verify &amp; submit</button>
40
27
 
41
28
  <div id="error"></div>
42
29
  </form>
43
30
 
44
- <div id="result" class="info-box" style="display: none;"></div>
31
+ <div id="result" class="demo-result" style="display: none;"></div>
45
32
 
46
- <!-- Console output display area -->
47
- <div id="console-output" class="console-output" style="display: none;"></div>
48
33
  </div>
49
34
 
50
35
  <script type="module">
@@ -1,14 +1,9 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
- <link href="styles/field.css" rel="stylesheet" type="text/css"/>
6
4
 
7
- <script src="index.js"></script>
8
- <title>Procaptcha Puzzle Mode - Explicit Rendering</title>
9
- <link href="styles/captcha.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Puzzle, explicit rendering</title>
10
6
  <script type="module">
11
- // Function to update CAPTCHA status display is now provided by status-log-injector
12
7
 
13
8
  document.addEventListener('DOMContentLoaded', function() {
14
9
  updateCaptchaStatus('Page loaded - Initializing CAPTCHA system', 'info');
@@ -33,43 +28,33 @@
33
28
  observer.observe(document.body, { childList: true, subtree: true });
34
29
  });
35
30
 
36
- // updateCaptchaStatus is now provided by status-log-injector
37
31
  </script>
38
32
  </head>
39
33
  <body>
40
- <div class="mui-container">
41
- <h1>Procaptcha Puzzle Mode - Explicit Rendering</h1>
42
- <p>This example demonstrates how to use Procaptcha in Puzzle mode with explicit rendering.</p>
34
+ <div class="demo-card">
43
35
 
44
- <!-- CAPTCHA Status Display will be injected by the status-log-injector plugin -->
36
+ <form id="demo-form" class="demo-form">
37
+ <h2>Create an account</h2>
45
38
 
46
- <form id="demo-form" class="mui-form">
47
- <h2>Example Form</h2>
48
-
49
- <div class="mui-textfield mui-textfield--float-label">
39
+ <div class="demo-field">
50
40
  <label for="name">Name</label>
51
41
  <input type="text" id="name" name="name" required />
52
42
  </div>
53
43
 
54
- <div class="mui-textfield mui-textfield--float-label">
44
+ <div class="demo-field">
55
45
  <label for="email">Email</label>
56
46
  <input type="email" id="email" name="email" required />
57
47
  </div>
58
48
 
59
- <!-- The container for the CAPTCHA -->
60
49
  <div id="procaptcha-container"></div>
61
50
 
62
- <button type="submit" class="mui-btn mui-btn--raised">Submit</button>
51
+ <button type="submit" class="demo-button">Submit</button>
63
52
 
64
53
  <div id="error"></div>
65
54
  </form>
66
55
 
67
- <div id="result" class="info-box" style="display: none;"></div>
68
-
69
- <!-- Console output display area -->
70
- <div id="console-output" class="console-output" style="display: none;"></div>
56
+ <div id="result" class="demo-result" style="display: none;"></div>
71
57
 
72
- <!-- Explanation will be injected by the explanation-injector plugin -->
73
58
  </div>
74
59
 
75
60
  <script type="module">