@prosopo/client-bundle-example 2.5.3 → 2.5.5

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 +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")}});
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("Challenge passed")}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 t=document.getElementById("messageContainer");t.style.color=e?"red":"black",t.style.display="block"},window.setMessage=e=>{document.getElementById("message").innerText=e},window.onLoggedIn=e=>{const t=new URL("/private",config.serverUrl).href;console.log("getting private resource with token ",e,"at",t),fetch(t,{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 t=e[0].value,n={email:document.getElementById("email").value,name:document.getElementById("name").value,password:document.getElementById("password").value,"procaptcha-response":t},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(o=>new Promise(a=>o.json().then(l=>a({status:o.status,ok:o.ok,json:l})))).then(async({status:o,json:a,ok:l})=>{console.log("status",o,"json",a.message,"ok",l),console.log("json",a);try{o!==200?(setIsError(!0),setMessage(a.message)):(setIsError(!1),setMessage(a.message))}catch(c){console.log(c)}}).catch(o=>{console.log(o),setIsError(!0),setMessage("Error: "+o)})}});window.onCaptchaFailed=function(){console.log("Challenge failed")};window.onCaptchaVerified=e=>{console.log("Challenge passed")};
@@ -1 +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))}
1
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import{C as p}from"./captchaType-CYBmmAZe.js";const y="modulepreload",w=function(o){return"/"+o},d={},E=function(i,c,C){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=w(n),n in d)return;d[n]=!0;const a=n.endsWith(".css"),f=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${f}`))return;const r=document.createElement("link");if(r.rel=a?"stylesheet":y,a||(r.as="script"),r.crossOrigin="",r.href=n,t&&r.setAttribute("nonce",t),document.head.appendChild(r),a)return new Promise((h,m)=>{r.addEventListener("load",h),r.addEventListener("error",()=>m(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:u,captchaType:p.pow})}window.captchaLoaded=v;function u(o){console.log("Captcha verified, output: "+JSON.stringify(o))}window.onCaptchaVerified=u;
@@ -156,7 +156,7 @@
156
156
  }
157
157
  }
158
158
  </style>
159
- <script type="module" crossorigin src="/assets/frictionless-xzpEe3JN.js"></script>
159
+ <script type="module" crossorigin src="/assets/frictionless-BVSPLzWe.js"></script>
160
160
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
161
161
  <link rel="modulepreload" crossorigin href="/assets/captchaType-CYBmmAZe.js">
162
162
  </head>
package/dist/index.html CHANGED
@@ -3,12 +3,9 @@
3
3
  <head>
4
4
  <link href="https://cdn.muicss.com/mui-0.10.3/css/mui.min.css" rel="stylesheet" type="text/css"/>
5
5
  <title>Procaptcha demo: Implicit Rendering</title>
6
- <script id="procaptchaScript" type="module" src="https://staging-js.prosopo.io/js/procaptcha.bundle.js" async defer></script>
7
- <script type="text/javascript">
8
- window.onCaptchaFailed = function () {
9
- console.log('Challenge failed')
10
- }
11
- </script>
6
+ <script id="procaptchaScript" type="module" src="https://staging-js.prosopo.io/js/procaptcha.bundle.js"></script>
7
+
8
+
12
9
 
13
10
 
14
11
  <style>
@@ -157,7 +154,7 @@
157
154
  }
158
155
  }
159
156
  </style>
160
- <script type="module" crossorigin src="/assets/index-DN-EY_8b.js"></script>
157
+ <script type="module" crossorigin src="/assets/index-BWsu-rGU.js"></script>
161
158
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
162
159
  </head>
163
160
  <body>
@@ -278,6 +275,7 @@
278
275
  data-theme="light"
279
276
  data-sitekey="undefined"
280
277
  data-failed-callback="onCaptchaFailed"
278
+ data-callback="onCaptchaVerified"
281
279
  data-captcha-type="image"
282
280
  ></div>
283
281
  </div>
package/dist/pow.html CHANGED
@@ -156,7 +156,7 @@
156
156
  }
157
157
  }
158
158
  </style>
159
- <script type="module" crossorigin src="/assets/pow-DpBboekQ.js"></script>
159
+ <script type="module" crossorigin src="/assets/pow-O0V5Dqo9.js"></script>
160
160
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
161
161
  <link rel="modulepreload" crossorigin href="/assets/captchaType-CYBmmAZe.js">
162
162
  </head>
package/package.json CHANGED
@@ -13,18 +13,18 @@
13
13
  "start": "vite serve ./src --port 9232 --config vite.config.ts",
14
14
  "clean": "echo 'nothing to clean'"
15
15
  },
16
- "version": "2.5.3",
16
+ "version": "2.5.5",
17
17
  "devDependencies": {
18
- "@prosopo/dotenv": "2.5.3",
18
+ "@prosopo/dotenv": "2.5.5",
19
19
  "@types/node": "22.5.5",
20
- "@vitest/coverage-v8": "2.1.1",
20
+ "@vitest/coverage-v8": "3.0.9",
21
21
  "concurrently": "9.0.1",
22
22
  "del-cli": "6.0.0",
23
23
  "npm-run-all": "2.1.0",
24
24
  "tslib": "2.7.0",
25
25
  "tsx": "4.19.1",
26
26
  "typescript": "5.6.2",
27
- "vite": "5.4.6",
28
- "vitest": "2.1.1"
27
+ "vite": "6.2.3",
28
+ "vitest": "3.0.9"
29
29
  }
30
30
  }
@@ -1 +0,0 @@
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")});