@prosopo/client-bundle-example 2.5.0 → 2.5.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.
@@ -0,0 +1 @@
1
+ var o;(function(i){i.image="image",i.pow="pow",i.frictionless="frictionless"})(o||(o={}));export{o as C};
File without changes
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import{render as l}from"https://staging-js.prosopo.io/js/procaptcha.bundle.js";import{C as i}from"./captchaType-CYBmmAZe.js";window.addEventListener("load",()=>{window.setIsError=e=>{const o=document.getElementById("messageContainer");o.style.color=e?"red":"black",o.style.display="block"},window.setMessage=e=>{document.getElementById("message").innerText=e},window.onLoggedIn=e=>{const o=new URL("/private",config.serverUrl).href;console.log("getting private resource with token ",e,"at",o),fetch(o,{method:"GET",headers:{Origin:"http://localhost:9232","Content-Type":"application/json",Authorization:`Bearer ${e}`}}).then(async n=>{try{const s=await n.json();n.status===200&&setMessage(s.message)}catch(s){console.log(s)}}).catch(n=>{console.log(n)})},window.onActionHandler=()=>{const e=document.getElementsByName("procaptcha-response");if(!e.length){alert("Must complete captcha");return}const o=e[0].value,n={email:document.getElementById("email").value,name:document.getElementById("name").value,password:document.getElementById("password").value,"procaptcha-response":o},s=new URL("signup",void 0).href;console.log("posting to",s,"with payload",n),fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),contentType:"application/json"}).then(t=>new Promise(a=>t.json().then(c=>a({status:t.status,ok:t.ok,json:c})))).then(async({status:t,json:a,ok:c})=>{console.log("status",t,"json",a.message,"ok",c),console.log("json",a);try{t!==200?(setIsError(!0),setMessage(a.message)):(setIsError(!1),setMessage(a.message))}catch(r){console.log(r)}}).catch(t=>{console.log(t),setIsError(!0),setMessage("Error: "+t)})},console.log("here")});function d(e){console.log("Captcha verified, output: "+JSON.stringify(e))}const g=document.getElementById("procaptcha-container");l(g,{siteKey:void 0,captchaType:i.frictionless,theme:"dark",callback:d,"failed-callback":function(){console.log("Challenge failed")}});
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";window.addEventListener("load",()=>{window.setIsError=e=>{const o=document.getElementById("messageContainer");o.style.color=e?"red":"black",o.style.display="block"},window.setMessage=e=>{document.getElementById("message").innerText=e},window.onLoggedIn=e=>{const o=new URL("/private",config.serverUrl).href;console.log("getting private resource with token ",e,"at",o),fetch(o,{method:"GET",headers:{Origin:"http://localhost:9232","Content-Type":"application/json",Authorization:`Bearer ${e}`}}).then(async s=>{try{const n=await s.json();s.status===200&&setMessage(n.message)}catch(n){console.log(n)}}).catch(s=>{console.log(s)})},window.onActionHandler=()=>{const e=document.getElementsByName("procaptcha-response");if(!e.length){alert("Must complete captcha");return}const o=e[0].value,s={email:document.getElementById("email").value,name:document.getElementById("name").value,password:document.getElementById("password").value,"procaptcha-response":o},n=new URL("signup",void 0).href;console.log("posting to",n,"with payload",s),fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),contentType:"application/json"}).then(t=>new Promise(a=>t.json().then(r=>a({status:t.status,ok:t.ok,json:r})))).then(async({status:t,json:a,ok:r})=>{console.log("status",t,"json",a.message,"ok",r),console.log("json",a);try{t!==200?(setIsError(!0),setMessage(a.message)):(setIsError(!1),setMessage(a.message))}catch(c){console.log(c)}}).catch(t=>{console.log(t),setIsError(!0),setMessage("Error: "+t)})},console.log("here")});
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import"https://staging-js.prosopo.io/js/procaptcha.bundle.js";document.addEventListener("DOMContentLoaded",function(){if(window.procaptcha&&typeof window.procaptcha.render=="function")onloadCallback();else{const o=document.querySelector('script[src*="procaptcha.bundle.js"]');o&&o.addEventListener("load",onloadCallback)}});
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import"https://staging-js.prosopo.io/js/procaptcha.bundle.js";document.addEventListener("DOMContentLoaded",function(){if(window.procaptcha&&typeof window.procaptcha.render=="function")onloadCallback();else{const o=document.querySelector('script[src*="procaptcha.bundle.js"]');o&&o.addEventListener("load",onloadCallback)}});
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import"https://staging-js.prosopo.io/js/procaptcha.bundle.js";document.addEventListener("DOMContentLoaded",function(){if(window.procaptcha&&typeof window.procaptcha.render=="function")onloadCallback();else{const o=document.querySelector('script[src*="procaptcha.bundle.js"]');o&&o.addEventListener("load",onloadCallback)}});
@@ -0,0 +1 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();
@@ -0,0 +1 @@
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import{C as h}from"./captchaType-CYBmmAZe.js";const p="modulepreload",y=function(o){return"/"+o},d={},E=function(i,c,g){let s=Promise.resolve();if(c&&c.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),t=(e==null?void 0:e.nonce)||(e==null?void 0:e.getAttribute("nonce"));s=Promise.allSettled(c.map(n=>{if(n=y(n),n in d)return;d[n]=!0;const a=n.endsWith(".css"),u=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${u}`))return;const r=document.createElement("link");if(r.rel=a?"stylesheet":p,a||(r.as="script"),r.crossOrigin="",r.href=n,t&&r.setAttribute("nonce",t),document.head.appendChild(r),a)return new Promise((m,f)=>{r.addEventListener("load",m),r.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${n}`)))})}))}function l(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(const t of e||[])t.status==="rejected"&&l(t.reason);return i().catch(l)})};async function v(){const o=(await E(async()=>{const{render:c}=await import("https://staging-js.prosopo.io/js/procaptcha.bundle.js");return{render:c}},[])).render;console.log("Captcha loaded");const i=document.getElementById("procaptcha-container");o(i,{siteKey:void 0,theme:"dark",callback:w,captchaType:h.pow})}window.captchaLoaded=v;function w(o){console.log("Captcha verified, output: "+JSON.stringify(o))}
@@ -0,0 +1,344 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
+ <title>Procaptcha demo: Simple page</title>
6
+ <script type="text/javascript">
7
+ window.onCaptchaFailed = function () {
8
+ console.log('Challenge failed')
9
+ }
10
+ </script>
11
+
12
+
13
+ <style>
14
+ .nav-topbar {
15
+ background-color: #2196F3;
16
+ padding: 0;
17
+ margin-bottom: 20px;
18
+ transition: all 0.3s ease;
19
+ overflow: hidden;
20
+ max-height: 500px; /* Initial state - visible */
21
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
22
+ }
23
+ .nav-topbar.collapsed {
24
+ max-height: 50px; /* Collapsed state - only show toggle button and title */
25
+ }
26
+ .nav-container {
27
+ max-width: 1200px;
28
+ margin: 0 auto;
29
+ padding: 0 15px;
30
+ position: relative;
31
+ }
32
+ .nav-header {
33
+ display: flex;
34
+ justify-content: space-between;
35
+ align-items: center;
36
+ padding: 10px 0;
37
+ position: relative;
38
+ z-index: 20;
39
+ }
40
+ .nav-title {
41
+ color: white;
42
+ font-size: 18px;
43
+ font-weight: bold;
44
+ margin: 0;
45
+ display: flex;
46
+ align-items: center;
47
+ }
48
+ .nav-title-text {
49
+ margin-right: 10px;
50
+ }
51
+ .nav-title-hint {
52
+ font-size: 14px;
53
+ font-weight: normal;
54
+ opacity: 0;
55
+ transition: opacity 0.3s ease;
56
+ }
57
+ .collapsed .nav-title-hint {
58
+ opacity: 0.8;
59
+ }
60
+ .nav-toggle {
61
+ background-color: rgba(0,0,0,0.1);
62
+ color: white;
63
+ border: none;
64
+ padding: 5px 10px;
65
+ cursor: pointer;
66
+ border-radius: 4px;
67
+ z-index: 10;
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ }
72
+ .nav-toggle:hover {
73
+ background-color: rgba(0,0,0,0.2);
74
+ }
75
+ .nav-toggle-icon {
76
+ width: 24px;
77
+ height: 24px;
78
+ display: inline-block;
79
+ position: relative;
80
+ }
81
+ .nav-toggle-icon svg {
82
+ position: absolute;
83
+ top: 0;
84
+ left: 0;
85
+ transition: opacity 0.3s ease;
86
+ }
87
+ .nav-toggle-icon .icon-collapse {
88
+ opacity: 1;
89
+ }
90
+ .nav-toggle-icon .icon-expand {
91
+ opacity: 0;
92
+ }
93
+ .collapsed .nav-toggle-icon .icon-collapse {
94
+ opacity: 0;
95
+ }
96
+ .collapsed .nav-toggle-icon .icon-expand {
97
+ opacity: 1;
98
+ }
99
+ .nav-content {
100
+ padding: 0 0 15px 0;
101
+ transition: opacity 0.3s ease;
102
+ }
103
+ .collapsed .nav-content {
104
+ opacity: 0;
105
+ }
106
+ .nav-row {
107
+ display: flex;
108
+ flex-wrap: wrap;
109
+ margin-bottom: 15px;
110
+ }
111
+ .nav-group {
112
+ flex: 1;
113
+ min-width: 250px;
114
+ margin-bottom: 10px;
115
+ margin-right: 20px;
116
+ }
117
+ .nav-group-title {
118
+ color: rgba(255,255,255,0.8);
119
+ font-size: 0.9em;
120
+ margin: 0 0 5px 0;
121
+ text-transform: uppercase;
122
+ font-weight: 500;
123
+ }
124
+ .nav-group-links {
125
+ list-style: none;
126
+ margin: 0;
127
+ padding: 0;
128
+ }
129
+ .nav-group-links li {
130
+ margin: 5px 0;
131
+ }
132
+ .nav-group-links a {
133
+ color: white;
134
+ text-decoration: none;
135
+ font-weight: bold;
136
+ padding: 5px 0;
137
+ display: inline-block;
138
+ }
139
+ .nav-group-links a:hover {
140
+ text-decoration: underline;
141
+ }
142
+ .nav-group-links .active {
143
+ border-bottom: 2px solid white;
144
+ }
145
+ .nav-group-links .disabled {
146
+ color: rgba(255,255,255,0.5);
147
+ cursor: not-allowed;
148
+ }
149
+
150
+ @media (max-width: 768px) {
151
+ .nav-row {
152
+ flex-direction: column;
153
+ }
154
+ .nav-title-hint {
155
+ display: none;
156
+ }
157
+ }
158
+ </style>
159
+ <script type="module" crossorigin src="/assets/frictionless-xzpEe3JN.js"></script>
160
+ <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
161
+ <link rel="modulepreload" crossorigin href="/assets/captchaType-CYBmmAZe.js">
162
+ </head>
163
+ <body>
164
+
165
+ <div id="nav-topbar" class="nav-topbar">
166
+ <div class="nav-container">
167
+ <div id="nav-header" class="nav-header">
168
+ <h1 class="nav-title">
169
+ <span class="nav-title-text">Procaptcha Demo Playground</span>
170
+ <span class="nav-title-hint">(Click anywhere to see more examples)</span>
171
+ </h1>
172
+ <button id="nav-toggle" class="nav-toggle" aria-label="Toggle navigation">
173
+ <span class="nav-toggle-icon">
174
+ <svg class="icon-collapse" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
175
+ <polyline points="18 15 12 9 6 15"></polyline>
176
+ </svg>
177
+ <svg class="icon-expand" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
178
+ <polyline points="6 9 12 15 18 9"></polyline>
179
+ </svg>
180
+ </span>
181
+ </button>
182
+ </div>
183
+ <div class="nav-content">
184
+ <div class="nav-row">
185
+
186
+ <div class="nav-section">
187
+ <h3 style="color: white; margin: 0 0 10px 0;">Standard Captchas</h3>
188
+ <div class="nav-row">
189
+
190
+ <div class="nav-group">
191
+ <div class="nav-group-title">Image</div>
192
+ <ul class="nav-group-links">
193
+ <li><a href="index.html">Implicit</a></li>
194
+ <li><span class="disabled" title="Coming Soon">Explicit</span></li>
195
+ </ul>
196
+ </div>
197
+
198
+
199
+ <div class="nav-group">
200
+ <div class="nav-group-title">Pow</div>
201
+ <ul class="nav-group-links">
202
+ <li><span class="disabled" title="Coming Soon">Implicit</span></li>
203
+ <li><span class="disabled" title="Coming Soon">Explicit</span></li>
204
+ </ul>
205
+ </div>
206
+
207
+
208
+ <div class="nav-group">
209
+ <div class="nav-group-title">Frictionless</div>
210
+ <ul class="nav-group-links">
211
+ <li><span class="disabled" title="Coming Soon">Implicit</span></li>
212
+ <li><a href="frictionless-explicit.html">Explicit</a></li>
213
+ </ul>
214
+ </div>
215
+
216
+ </div>
217
+ </div>
218
+
219
+
220
+ <div class="nav-section">
221
+ <h3 style="color: white; margin: 0 0 10px 0;">Invisible Captchas</h3>
222
+ <div class="nav-row">
223
+
224
+ <div class="nav-group">
225
+ <div class="nav-group-title">Image</div>
226
+ <ul class="nav-group-links">
227
+ <li><a href="invisible-image-implicit.html">Implicit</a></li>
228
+ <li><a href="invisible-image-explicit.html">Explicit</a></li>
229
+ </ul>
230
+ </div>
231
+
232
+
233
+ <div class="nav-group">
234
+ <div class="nav-group-title">Pow</div>
235
+ <ul class="nav-group-links">
236
+ <li><a href="invisible-pow-implicit.html">Implicit</a></li>
237
+ <li><a href="invisible-pow-explicit.html">Explicit</a></li>
238
+ </ul>
239
+ </div>
240
+
241
+
242
+ <div class="nav-group">
243
+ <div class="nav-group-title">Frictionless</div>
244
+ <ul class="nav-group-links">
245
+ <li><a href="invisible-frictionless-implicit.html">Implicit</a></li>
246
+ <li><a href="invisible-frictionless-explicit.html">Explicit</a></li>
247
+ </ul>
248
+ </div>
249
+
250
+ </div>
251
+ </div>
252
+
253
+ </div>
254
+ </div>
255
+ </div>
256
+ </div>
257
+
258
+
259
+ <div class="mui-container">
260
+ <form action="undefined/signup" method="POST" class="mui-form">
261
+ <h1>Example Login Form</h1>
262
+ <div class="mui-textfield mui-textfield--float-label">
263
+ <label for="name">Name</label>
264
+ <input id="name" type="text" name="name" required/>
265
+ </div>
266
+ <div class="mui-textfield mui-textfield--float-label">
267
+ <label for="email">Email Address</label>
268
+ <input id="email" type="email" name="email" required/>
269
+ </div>
270
+ <div class="mui-textfield mui-textfield--float-label">
271
+ <label for="password">Password</label>
272
+ <input id="password" type="password" name="password" required/>
273
+ </div>
274
+ <div class="mui-textfield mui-textfield--float-label">
275
+ <div id="procaptcha-container"></div>
276
+ </div>
277
+ <div id="messageContainer" style="display: none; color: black;"><span id="message"></span></div>
278
+ <button type="button" class="mui-btn mui-btn--raised" onclick="onActionHandler()" data-cy="submit-button">Submit</button>
279
+ </form>
280
+ </div>
281
+
282
+ <script>
283
+ document.addEventListener('DOMContentLoaded', function() {
284
+ const toggleBtn = document.getElementById('nav-toggle');
285
+ const navBar = document.getElementById('nav-topbar');
286
+ const navHeader = document.getElementById('nav-header');
287
+
288
+ // Check if navigation was previously collapsed
289
+ const navCollapsed = localStorage.getItem('navCollapsed') === 'true';
290
+ if (navCollapsed) {
291
+ navBar.classList.add('collapsed');
292
+ }
293
+
294
+ // Function to expand the navigation
295
+ function expandNav() {
296
+ if (navBar.classList.contains('collapsed')) {
297
+ navBar.classList.remove('collapsed');
298
+ localStorage.setItem('navCollapsed', 'false');
299
+ }
300
+ }
301
+
302
+ // Function to collapse the navigation
303
+ function collapseNav() {
304
+ if (!navBar.classList.contains('collapsed')) {
305
+ navBar.classList.add('collapsed');
306
+ localStorage.setItem('navCollapsed', 'true');
307
+ }
308
+ }
309
+
310
+ // Function to toggle the navigation
311
+ function toggleNav() {
312
+ navBar.classList.toggle('collapsed');
313
+ localStorage.setItem('navCollapsed', navBar.classList.contains('collapsed'));
314
+ }
315
+
316
+ // Toggle on button click
317
+ toggleBtn.addEventListener('click', function(e) {
318
+ e.stopPropagation(); // Prevent header click from firing
319
+ toggleNav();
320
+ });
321
+
322
+ // Expand on toggle button hover when collapsed
323
+ toggleBtn.addEventListener('mouseenter', function() {
324
+ if (navBar.classList.contains('collapsed')) {
325
+ expandNav();
326
+ }
327
+ });
328
+
329
+ // Toggle on header click
330
+ navHeader.addEventListener('click', function(e) {
331
+ // Don't toggle if a link within the header was clicked
332
+ if (e.target.tagName === 'A') {
333
+ return;
334
+ }
335
+ toggleNav();
336
+ });
337
+
338
+ // Make the header appear clickable with cursor style
339
+ navHeader.style.cursor = 'pointer';
340
+ });
341
+ </script>
342
+
343
+ </body>
344
+ </html>