@prosopo/client-bundle-example 2.7.0 → 2.8.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 (56) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/assets/{ProcaptchaWidget-3gKvjeiH.js → ProcaptchaWidget-DrBDhP6X.js} +7 -7
  3. package/dist/assets/{ProcaptchaWidget-D6-M7iAv.js → ProcaptchaWidget-rAM-9Rap.js} +4 -4
  4. package/dist/assets/{asU8a-DCECA0Qe.js → asU8a-CJdNkNEq.js} +1 -1
  5. package/dist/assets/{bip39-BQoZog_M.js → bip39-Du2cANEV.js} +2 -2
  6. package/dist/assets/captcha-BhkVCEXM.css +1 -0
  7. package/dist/assets/{captchaComponentProvider-BW2eXmc3.js → captchaComponentProvider-DmV1WTrT.js} +4 -4
  8. package/dist/assets/{captchaRenderer-B_MgGzr9.js → captchaRenderer-RIsSZXCC.js} +2 -2
  9. package/dist/assets/{emotion-element-5486c51c.browser.esm-CCAJ8JId.js → emotion-element-5486c51c.browser.esm-C3u8NMUC.js} +127 -125
  10. package/dist/assets/frictionless-explicit-Dq_sNGRK.js +1 -0
  11. package/dist/assets/frictionless-implicit-Dq_sNGRK.js +1 -0
  12. package/dist/assets/{hash-BR0YLxPF.js → hash-_rWungeW.js} +1 -1
  13. package/dist/assets/image-explicit-DQvfVB7-.js +4 -0
  14. package/dist/assets/image-implicit-Bwa9QJO5.js +1 -0
  15. package/dist/assets/{index-WqEmiYQ_.js → index-BVr9fC_3.js} +4 -4
  16. package/dist/assets/{index-BYUYvvuq.js → index-Cu5oL_7b.js} +4 -4
  17. package/dist/assets/index-Dpt_5E72.js +1 -0
  18. package/dist/assets/{index-BCjHZ8o6.js → index-DxIFpl6U.js} +1 -1
  19. package/dist/assets/{index-2or4-1WF.js → index-Wgw2GQWq.js} +2 -2
  20. package/dist/assets/invisible-frictionless-explicit-DugBtRe4.js +4 -0
  21. package/dist/assets/invisible-frictionless-implicit-DYYos8W9.js +1 -0
  22. package/dist/assets/invisible-image-explicit-C5Z4gSb1.js +4 -0
  23. package/dist/assets/invisible-image-implicit-DfNFNlFj.js +1 -0
  24. package/dist/assets/invisible-pow-explicit-DjqGWFUb.js +4 -0
  25. package/dist/assets/invisible-pow-implicit-BRXL14FH.js +4 -0
  26. package/dist/assets/pow-explicit-BexxbnHM.js +4 -0
  27. package/dist/assets/pow-implicit-Dpt_5E72.js +1 -0
  28. package/dist/assets/procaptcha.bundle.js +1 -1
  29. package/dist/assets/{useTranslation-BPbGzrhj.js → useTranslation-CJplXtqb.js} +1 -1
  30. package/dist/frictionless-explicit.html +881 -0
  31. package/dist/frictionless-implicit.html +874 -0
  32. package/dist/image-explicit.html +877 -0
  33. package/dist/index.html +575 -74
  34. package/dist/invisible-frictionless-explicit.html +626 -283
  35. package/dist/invisible-frictionless-implicit.html +631 -173
  36. package/dist/invisible-image-explicit.html +627 -284
  37. package/dist/invisible-image-implicit.html +631 -173
  38. package/dist/invisible-pow-explicit.html +627 -284
  39. package/dist/invisible-pow-implicit.html +629 -177
  40. package/dist/plugins/explanation-injector.ts +250 -0
  41. package/dist/plugins/form-filler-injector.ts +233 -0
  42. package/dist/plugins/navigation-injector.ts +237 -89
  43. package/dist/plugins/status-log-injector.ts +199 -0
  44. package/dist/pow-explicit.html +877 -0
  45. package/dist/pow-implicit.html +881 -0
  46. package/package.json +1 -1
  47. package/vite.config.ts +32 -3
  48. package/dist/assets/frictionless-ZgzyuneX.js +0 -1
  49. package/dist/assets/index-BWsu-rGU.js +0 -1
  50. package/dist/assets/invisible-frictionless-explicit-DgCaJtPg.js +0 -1
  51. package/dist/assets/invisible-image-explicit-DgCaJtPg.js +0 -1
  52. package/dist/assets/invisible-pow-explicit-DgCaJtPg.js +0 -1
  53. package/dist/assets/pow-BW3QYcgP.js +0 -1
  54. package/dist/frictionless.html +0 -343
  55. package/dist/pow.html +0 -323
  56. /package/dist/assets/{modulepreload-polyfill-B5Qt9EMX.js → captcha-ByKnSsbG.js} +0 -0
@@ -12,7 +12,6 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  // Vite plugin to inject navigation into HTML files
15
-
16
15
  import path from "node:path";
17
16
  import {
18
17
  type IndexHtmlTransformContext,
@@ -25,10 +24,12 @@ interface CaptchaTypeDetails {
25
24
  exists: boolean;
26
25
  }
27
26
 
27
+ interface CaptchaType {
28
+ [key: string]: CaptchaTypeDetails;
29
+ }
30
+
28
31
  interface CaptchaTypes {
29
- [key: string]: {
30
- [key: string]: CaptchaTypeDetails;
31
- };
32
+ [key: string]: CaptchaType;
32
33
  }
33
34
 
34
35
  export default function navigationInjector(): Plugin {
@@ -36,20 +37,21 @@ export default function navigationInjector(): Plugin {
36
37
  const pageDefinitions = {
37
38
  standard: {
38
39
  image: {
39
- implicit: { path: "index.html", exists: true },
40
- explicit: { path: "image-explicit.html", exists: false },
40
+ implicit: { path: "image-implicit.html", exists: true },
41
+ explicit: { path: "image-explicit.html", exists: true },
41
42
  },
42
43
  pow: {
43
- implicit: { path: "pow-implicit.html", exists: false },
44
- explicit: { path: "pow-explicit.html", exists: false },
44
+ implicit: { path: "pow-implicit.html", exists: true },
45
+ explicit: { path: "pow-explicit.html", exists: true },
45
46
  },
46
47
  frictionless: {
47
- implicit: {
48
- path: "frictionless-implicit.html",
49
- exists: false,
50
- },
48
+ implicit: { path: "frictionless-implicit.html", exists: true },
51
49
  explicit: { path: "frictionless-explicit.html", exists: true },
52
50
  },
51
+ // slider: {
52
+ // implicit: { path: "slider-implicit.html", exists: true },
53
+ // explicit: { path: "slider-explicit.html", exists: true },
54
+ // },
53
55
  },
54
56
  invisible: {
55
57
  image: {
@@ -70,6 +72,10 @@ export default function navigationInjector(): Plugin {
70
72
  exists: true,
71
73
  },
72
74
  },
75
+ // slider: {
76
+ // implicit: { path: "invisible-slider-implicit.html", exists: true },
77
+ // explicit: { path: "invisible-slider-explicit.html", exists: true },
78
+ // },
73
79
  },
74
80
  };
75
81
 
@@ -82,60 +88,64 @@ export default function navigationInjector(): Plugin {
82
88
  margin-bottom: 20px;
83
89
  transition: all 0.3s ease;
84
90
  overflow: hidden;
85
- max-height: 500px; /* Initial state - visible */
91
+ max-height: 500px;
86
92
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
93
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
87
94
  }
88
95
  .nav-topbar.collapsed {
89
- max-height: 50px; /* Collapsed state - only show toggle button and title */
96
+ max-height: 60px;
90
97
  }
91
98
  .nav-container {
92
99
  max-width: 1200px;
93
100
  margin: 0 auto;
94
- padding: 0 15px;
101
+ padding: 0 20px;
95
102
  position: relative;
96
103
  }
97
104
  .nav-header {
98
105
  display: flex;
99
106
  justify-content: space-between;
100
107
  align-items: center;
101
- padding: 10px 0;
108
+ padding: 12px 0;
102
109
  position: relative;
103
110
  z-index: 20;
104
111
  }
105
112
  .nav-title {
106
113
  color: white;
107
- font-size: 18px;
108
- font-weight: bold;
114
+ font-size: 1.25rem;
115
+ font-weight: 600;
109
116
  margin: 0;
110
117
  display: flex;
111
118
  align-items: center;
119
+ gap: 8px;
112
120
  }
113
121
  .nav-title-text {
114
- margin-right: 10px;
122
+ margin-right: 8px;
115
123
  }
116
124
  .nav-title-hint {
117
- font-size: 14px;
125
+ font-size: 0.875rem;
118
126
  font-weight: normal;
119
127
  opacity: 0;
120
128
  transition: opacity 0.3s ease;
129
+ color: rgba(255,255,255,0.8);
121
130
  }
122
131
  .collapsed .nav-title-hint {
123
132
  opacity: 0.8;
124
133
  }
125
134
  .nav-toggle {
126
- background-color: rgba(0,0,0,0.1);
135
+ background-color: rgba(255,255,255,0.1);
127
136
  color: white;
128
137
  border: none;
129
- padding: 5px 10px;
138
+ padding: 8px 12px;
130
139
  cursor: pointer;
131
- border-radius: 4px;
140
+ border-radius: 6px;
132
141
  z-index: 10;
133
142
  display: flex;
134
143
  align-items: center;
135
144
  justify-content: center;
145
+ transition: background-color 0.2s ease;
136
146
  }
137
147
  .nav-toggle:hover {
138
- background-color: rgba(0,0,0,0.2);
148
+ background-color: rgba(255,255,255,0.2);
139
149
  }
140
150
  .nav-toggle-icon {
141
151
  width: 24px;
@@ -162,29 +172,42 @@ export default function navigationInjector(): Plugin {
162
172
  opacity: 1;
163
173
  }
164
174
  .nav-content {
165
- padding: 0 0 15px 0;
175
+ padding: 0 0 20px 0;
166
176
  transition: opacity 0.3s ease;
167
177
  }
168
178
  .collapsed .nav-content {
169
179
  opacity: 0;
170
180
  }
171
- .nav-row {
181
+ .nav-sections {
172
182
  display: flex;
173
183
  flex-wrap: wrap;
174
- margin-bottom: 15px;
184
+ gap: 20px;
175
185
  }
176
- .nav-group {
186
+ .nav-section {
177
187
  flex: 1;
178
- min-width: 250px;
179
- margin-bottom: 10px;
180
- margin-right: 20px;
188
+ min-width: 280px;
189
+ }
190
+ .nav-section h3 {
191
+ color: white;
192
+ font-size: 1rem;
193
+ font-weight: 600;
194
+ margin: 0 0 12px 0;
195
+ padding-bottom: 8px;
196
+ border-bottom: 1px solid rgba(255,255,255,0.2);
197
+ }
198
+ .nav-group {
199
+ background: rgba(255,255,255,0.1);
200
+ border-radius: 8px;
201
+ padding: 12px;
202
+ margin-bottom: 12px;
181
203
  }
182
204
  .nav-group-title {
183
- color: rgba(255,255,255,0.8);
184
- font-size: 0.9em;
185
- margin: 0 0 5px 0;
186
- text-transform: uppercase;
205
+ color: rgba(255,255,255,0.9);
206
+ font-size: 0.875rem;
187
207
  font-weight: 500;
208
+ margin: 0 0 8px 0;
209
+ text-transform: uppercase;
210
+ letter-spacing: 0.5px;
188
211
  }
189
212
  .nav-group-links {
190
213
  list-style: none;
@@ -192,33 +215,150 @@ export default function navigationInjector(): Plugin {
192
215
  padding: 0;
193
216
  }
194
217
  .nav-group-links li {
195
- margin: 5px 0;
218
+ margin: 6px 0;
196
219
  }
197
220
  .nav-group-links a {
198
221
  color: white;
199
222
  text-decoration: none;
200
- font-weight: bold;
201
- padding: 5px 0;
223
+ font-weight: 500;
224
+ padding: 6px 8px;
202
225
  display: inline-block;
226
+ border-radius: 4px;
227
+ transition: background-color 0.2s ease;
203
228
  }
204
229
  .nav-group-links a:hover {
205
- text-decoration: underline;
230
+ background-color: rgba(255,255,255,0.2);
206
231
  }
207
232
  .nav-group-links .active {
208
- border-bottom: 2px solid white;
233
+ background-color: rgba(255,255,255,0.2);
234
+ font-weight: 600;
209
235
  }
210
236
  .nav-group-links .disabled {
211
237
  color: rgba(255,255,255,0.5);
212
238
  cursor: not-allowed;
239
+ opacity: 0.7;
213
240
  }
214
241
 
215
242
  @media (max-width: 768px) {
216
- .nav-row {
217
- flex-direction: column;
243
+ .nav-container {
244
+ padding: 0 16px;
245
+ }
246
+ .nav-title {
247
+ font-size: 1.125rem;
218
248
  }
219
249
  .nav-title-hint {
220
250
  display: none;
221
251
  }
252
+ .nav-sections {
253
+ flex-direction: column;
254
+ gap: 16px;
255
+ }
256
+ .nav-section {
257
+ min-width: 100%;
258
+ }
259
+ .nav-section h3 {
260
+ font-size: 0.875rem;
261
+ }
262
+ .nav-group {
263
+ padding: 10px;
264
+ }
265
+ .nav-group-title {
266
+ font-size: 0.8125rem;
267
+ }
268
+ .nav-group-links a {
269
+ padding: 8px 10px;
270
+ width: 100%;
271
+ }
272
+ }
273
+
274
+ @media (max-width: 480px) {
275
+ .nav-topbar {
276
+ max-height: 60px;
277
+ }
278
+ .nav-topbar.collapsed {
279
+ max-height: 60px;
280
+ }
281
+ .nav-title {
282
+ font-size: 1rem;
283
+ }
284
+ .nav-toggle {
285
+ padding: 6px 10px;
286
+ }
287
+ }
288
+
289
+ .nav-group-dropdown {
290
+ position: relative;
291
+ display: inline-block;
292
+ }
293
+
294
+ .nav-group-dropdown-btn {
295
+ background: none;
296
+ border: none;
297
+ color: white;
298
+ font-weight: 500;
299
+ padding: 6px 8px;
300
+ cursor: pointer;
301
+ display: flex;
302
+ align-items: center;
303
+ gap: 4px;
304
+ border-radius: 4px;
305
+ transition: background-color 0.2s ease;
306
+ }
307
+
308
+ .nav-group-dropdown-btn:hover {
309
+ background-color: rgba(255,255,255,0.2);
310
+ }
311
+
312
+ .nav-group-dropdown-btn svg {
313
+ width: 16px;
314
+ height: 16px;
315
+ transition: transform 0.2s ease;
316
+ }
317
+
318
+ .nav-group-dropdown-btn.open svg {
319
+ transform: rotate(180deg);
320
+ }
321
+
322
+ .nav-group-dropdown-content {
323
+ display: none;
324
+ position: absolute;
325
+ background-color: rgba(33, 150, 243, 0.95);
326
+ min-width: 160px;
327
+ box-shadow: 0 8px 16px rgba(0,0,0,0.2);
328
+ z-index: 1;
329
+ border-radius: 4px;
330
+ padding: 8px 0;
331
+ margin-top: 4px;
332
+ }
333
+
334
+ .nav-group-dropdown-btn.open + .nav-group-dropdown-content {
335
+ display: block;
336
+ }
337
+
338
+ .nav-group-dropdown-content a {
339
+ color: white;
340
+ padding: 8px 16px;
341
+ text-decoration: none;
342
+ display: block;
343
+ transition: background-color 0.2s ease;
344
+ }
345
+
346
+ .nav-group-dropdown-content a:hover {
347
+ background-color: rgba(255,255,255,0.2);
348
+ }
349
+
350
+ .nav-group-dropdown-content a.active {
351
+ background-color: rgba(255,255,255,0.2);
352
+ font-weight: 600;
353
+ }
354
+
355
+ @media (max-width: 768px) {
356
+ .nav-group-dropdown-content {
357
+ position: static;
358
+ box-shadow: none;
359
+ background-color: rgba(255,255,255,0.1);
360
+ margin-top: 8px;
361
+ }
222
362
  }
223
363
  </style>
224
364
  `;
@@ -230,6 +370,7 @@ export default function navigationInjector(): Plugin {
230
370
  const toggleBtn = document.getElementById('nav-toggle');
231
371
  const navBar = document.getElementById('nav-topbar');
232
372
  const navHeader = document.getElementById('nav-header');
373
+ const isMobile = window.innerWidth <= 768;
233
374
 
234
375
  // Check if navigation was previously collapsed
235
376
  const navCollapsed = localStorage.getItem('navCollapsed') === 'true';
@@ -261,20 +402,21 @@ export default function navigationInjector(): Plugin {
261
402
 
262
403
  // Toggle on button click
263
404
  toggleBtn.addEventListener('click', function(e) {
264
- e.stopPropagation(); // Prevent header click from firing
405
+ e.stopPropagation();
265
406
  toggleNav();
266
407
  });
267
408
 
268
- // Expand on toggle button hover when collapsed
269
- toggleBtn.addEventListener('mouseenter', function() {
270
- if (navBar.classList.contains('collapsed')) {
271
- expandNav();
272
- }
273
- });
409
+ // Expand on toggle button hover when collapsed (desktop only)
410
+ if (!isMobile) {
411
+ toggleBtn.addEventListener('mouseenter', function() {
412
+ if (navBar.classList.contains('collapsed')) {
413
+ expandNav();
414
+ }
415
+ });
416
+ }
274
417
 
275
418
  // Toggle on header click
276
419
  navHeader.addEventListener('click', function(e) {
277
- // Don't toggle if a link within the header was clicked
278
420
  if (e.target.tagName === 'A') {
279
421
  return;
280
422
  }
@@ -283,6 +425,37 @@ export default function navigationInjector(): Plugin {
283
425
 
284
426
  // Make the header appear clickable with cursor style
285
427
  navHeader.style.cursor = 'pointer';
428
+
429
+ // Handle window resize
430
+ window.addEventListener('resize', function() {
431
+ const newIsMobile = window.innerWidth <= 768;
432
+ if (newIsMobile !== isMobile) {
433
+ if (newIsMobile) {
434
+ // On mobile, collapse the nav by default
435
+ collapseNav();
436
+ } else {
437
+ // On desktop, expand the nav by default
438
+ expandNav();
439
+ }
440
+ }
441
+ });
442
+
443
+ // Handle dropdown toggles
444
+ document.querySelectorAll('.nav-group-dropdown-btn').forEach(button => {
445
+ button.addEventListener('click', function(e) {
446
+ e.stopPropagation();
447
+ this.classList.toggle('open');
448
+ });
449
+ });
450
+
451
+ // Close dropdowns when clicking outside
452
+ document.addEventListener('click', function(e) {
453
+ if (!e.target.closest('.nav-group-dropdown')) {
454
+ document.querySelectorAll('.nav-group-dropdown-btn').forEach(button => {
455
+ button.classList.remove('open');
456
+ });
457
+ }
458
+ });
286
459
  });
287
460
  </script>
288
461
  `;
@@ -346,7 +519,7 @@ export default function navigationInjector(): Plugin {
346
519
  </button>
347
520
  </div>
348
521
  <div class="nav-content">
349
- <div class="nav-row">
522
+ <div class="nav-sections">
350
523
  ${standardNav}
351
524
  ${invisibleNav}
352
525
  </div>
@@ -355,28 +528,6 @@ export default function navigationInjector(): Plugin {
355
528
  </div>
356
529
  `;
357
530
 
358
- // Replace environment variables
359
- const bundleUrl =
360
- process.env.VITE_BUNDLE_URL ||
361
- "https://staging-js.prosopo.io/js/procaptcha.bundle.js";
362
-
363
- console.log(`Using bundle URL: ${bundleUrl}`);
364
- html = html.replace(/%VITE_BUNDLE_URL%/g, bundleUrl);
365
-
366
- // Replace other environment variables
367
- if (process.env.PROSOPO_SITE_KEY) {
368
- html = html.replace(
369
- /%PROSOPO_SITE_KEY%/g,
370
- process.env.PROSOPO_SITE_KEY,
371
- );
372
- }
373
- if (process.env.PROSOPO_SERVER_URL) {
374
- html = html.replace(
375
- /%PROSOPO_SERVER_URL%/g,
376
- process.env.PROSOPO_SERVER_URL,
377
- );
378
- }
379
-
380
531
  // Inject navigation after <body> tag and script before </body>
381
532
  if (html.includes("<body>") && html.includes("</body>")) {
382
533
  return html
@@ -402,49 +553,46 @@ export default function navigationInjector(): Plugin {
402
553
  const typeTitle = typeName.charAt(0).toUpperCase() + typeName.slice(1);
403
554
  const links: string[] = [];
404
555
 
405
- for (const [implName, implDetails] of Object.entries(captchaType)) {
556
+ // Create simple buttons for each implementation
557
+ for (const [implName, implDetails] of Object.entries(
558
+ captchaType as CaptchaType,
559
+ )) {
406
560
  const pagePath = implDetails.path;
407
561
  const pageExists = implDetails.exists;
562
+ const implTitle = implName.charAt(0).toUpperCase() + implName.slice(1);
408
563
 
409
564
  // Calculate relative path
410
565
  let href: string;
411
566
  if (currentPath.includes("/")) {
412
- // We're in a subdirectory
413
567
  const depth = (currentPath.match(/\//g) || []).length;
414
568
  href = "../".repeat(depth) + pagePath;
415
569
  } else {
416
- // We're in the src root
417
570
  href = pagePath;
418
571
  }
419
572
 
420
- // Mark current page as active and check if the file exists
421
- const isActive = currentPath === pagePath;
422
- const implTitle = implName.charAt(0).toUpperCase() + implName.slice(1);
423
-
424
- let linkHtml: string;
425
573
  if (pageExists) {
426
- const activeClass = isActive ? ' class="active"' : "";
427
- linkHtml = `<a href="${href}"${activeClass}>${implTitle}</a>`;
574
+ const activeClass = currentPath === pagePath ? ' class="active"' : "";
575
+ links.push(`<a href="${href}"${activeClass}>${implTitle}</a>`);
428
576
  } else {
429
- linkHtml = `<span class="disabled" title="Coming Soon">${implTitle}</span>`;
577
+ links.push(
578
+ `<span class="disabled" title="Coming Soon">${implTitle}</span>`,
579
+ );
430
580
  }
431
-
432
- links.push(`<li>${linkHtml}</li>`);
433
581
  }
434
582
 
435
583
  navGroups.push(`
436
584
  <div class="nav-group">
437
585
  <div class="nav-group-title">${typeTitle}</div>
438
- <ul class="nav-group-links">
586
+ <div class="nav-group-links">
439
587
  ${links.join("\n ")}
440
- </ul>
588
+ </div>
441
589
  </div>
442
590
  `);
443
591
  }
444
592
 
445
593
  return `
446
594
  <div class="nav-section">
447
- <h3 style="color: white; margin: 0 0 10px 0;">${title}</h3>
595
+ <h3>${title}</h3>
448
596
  <div class="nav-row">
449
597
  ${navGroups.join("\n ")}
450
598
  </div>