@onefootprint/footprint-js
Advanced tools
Comparing version 0.3.1-beta.2 to 0.3.1-beta.3
@@ -74,3 +74,3 @@ 'use strict'; | ||
} | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var lt=M;/** | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var ut=M;/** | ||
postmate - A powerful, simple, promise-based postMessage library | ||
@@ -83,2 +83,2 @@ @version v1.5.2 | ||
module.exports = lt; | ||
module.exports = ut; |
@@ -72,3 +72,3 @@ var p="application/x-postmate-v1+json",V=5,S=0,T=function(){return ++S};var R=function(t){var e=document.createElement("a");e.href=t;var r=e.protocol.length>4?e.protocol:window.location.protocol,o=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||r+"//"+o},B={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},m=function(t,e){return !(typeof e=="string"&&t.origin!==e||!t.data||typeof t.data=="object"&&!("postmate"in t.data)||t.data.type!==p||!B[t.data.postmate])},H=function(t,e){var r=typeof t[e]=="function"?t[e]():t[e];return c.Promise.resolve(r)},j=function(){function n(e){var r=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},this.listener=function(o){if(!m(o,r.childOrigin))return !1;var a=((o||{}).data||{}).value||{},i=a.data,s=a.name;o.data.postmate==="emit"&&s in r.events&&r.events[s].call(r,i);},this.parent.addEventListener("message",this.listener,!1);}var t=n.prototype;return t.get=function(r){var o=this;return new c.Promise(function(a){var i=T(),s=function d(l){l.data.uid===i&&l.data.postmate==="reply"&&(o.parent.removeEventListener("message",d,!1),a(l.data.value));};o.parent.addEventListener("message",s,!1),o.child.postMessage({postmate:"request",type:p,property:r,uid:i},o.childOrigin);})},t.call=function(r,o){this.child.postMessage({postmate:"call",type:p,property:r,data:o},this.childOrigin);},t.on=function(r,o){this.events[r]=o;},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame);},n}(),$=function(){function n(e){var r=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.child.addEventListener("message",function(o){if(!!m(o,r.parentOrigin)){var a=o.data,i=a.property,s=a.uid,d=a.data;if(o.data.postmate==="call"){i in r.model&&typeof r.model[i]=="function"&&r.model[i](d);return}H(r.model,i).then(function(l){return o.source.postMessage({property:i,postmate:"reply",type:p,uid:s,value:l},o.origin)});}});}var t=n.prototype;return t.emit=function(r,o){this.parent.postMessage({postmate:"emit",type:p,value:{name:r,data:o}},this.parentOrigin);},n}(),c=function(){function n(e){var r=e.container,o=r===void 0?typeof o<"u"?o:document.body:r,a=e.model,i=e.url,s=e.name,d=e.classListArray,l=d===void 0?[]:d;return this.parent=window,this.frame=document.createElement("iframe"),this.frame.name=s||"",this.frame.classList.add.apply(this.frame.classList,l),o.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(i)}var t=n.prototype;return t.sendHandshake=function(r){var o=this,a=R(r),i=0,s;return new n.Promise(function(d,l){var u=function h(f){return m(f,a)?f.data.postmate==="handshake-reply"?(clearInterval(s),o.parent.removeEventListener("message",h,!1),o.childOrigin=f.origin,d(new j(o))):l("Failed handshake"):!1};o.parent.addEventListener("message",u,!1);var w=function(){i++,o.child.postMessage({postmate:"handshake",type:p,model:o.model},a),i===V&&clearInterval(s);},E=function(){w(),s=setInterval(w,500);};o.frame.attachEvent?o.frame.attachEvent("onload",E):o.frame.onload=E,o.frame.src=r;})},n}();c.debug=!1;c.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}();c.Model=function(){function n(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=n.prototype;return t.sendHandshakeReply=function(){var r=this;return new c.Promise(function(o,a){var i=function s(d){if(!!d.data.postmate){if(d.data.postmate==="handshake"){r.child.removeEventListener("message",s,!1),d.source.postMessage({postmate:"handshake-reply",type:p},d.origin),r.parentOrigin=d.origin;var l=d.data.model;return l&&Object.keys(l).forEach(function(u){r.model[u]=l[u];}),o(new $(r))}return a("Handshake Reply Failed")}};r.child.addEventListener("message",i,!1);})},n}();var b=c;var x="footprint-container",O="footprint-overlay",C="footprint-loading-indicator",L=n=>{let t=g();return n.appendChild(t),t},N=n=>{document.body.classList.add("footprint-body-locked");let t=document.createElement("div");t.setAttribute("id",O);let e=z(C);t.appendChild(e),t.classList.add("footprint-overlay"),n.appendChild(t);},_=()=>{let n=document.getElementById(C);n&&n.remove();},k=()=>{document.body.classList.remove("footprint-body-locked");let n=document.getElementById(O);n&&n.remove();},P=()=>{let n=document.getElementById(x);if(n)return n;let t=document.createElement("div");return t.setAttribute("id",x),document.body.appendChild(t),t},z=n=>{let t=document.createElement("div");t.setAttribute("id",n),t.classList.add("footprint-loading-indicator");let e=document.createElement("div");e.classList.add("footprint-loading-spin");let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("width","24px"),r.setAttribute("height","24px"),r.setAttribute("fill","none"),r.setAttribute("aria-hidden","true");let o=document.createElementNS("http://www.w3.org/2000/svg","path");return o.setAttribute("d","M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"),o.setAttribute("fill","#FFFFFF"),r.appendChild(o),e.appendChild(r),t.appendChild(e),t},U=()=>{let n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("width","24px"),n.setAttribute("height","24px"),n.setAttribute("fill","none"),n.setAttribute("aria-hidden","true");let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M14.66 14h2.666v-2.36a2.666 2.666 0 1 1 0-4.614V4H6.66v16h4.666v-2.666A3.333 3.333 0 0 1 14.66 14Z"),t.setAttribute("fill","#76fb8f"),n.appendChild(t),n},g=()=>{let n=U(),t=document.createElement("button");t.appendChild(n);let e=document.createElement("span");return e.innerText="Verify with Footprint",t.appendChild(e),t.classList.add("footprint-button"),t},A=()=>{let n=document.createElement("style");n.type="text/css",n.innerHTML=` | ||
} | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var lt=M;/** | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var ut=M;/** | ||
postmate - A powerful, simple, promise-based postMessage library | ||
@@ -81,2 +81,2 @@ @version v1.5.2 | ||
export { lt as default }; | ||
export { ut as default }; |
@@ -75,3 +75,3 @@ (function () { | ||
} | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var lt=M;/** | ||
`,document.head.appendChild(n);};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let o=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});o.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),o.on("closed",()=>this.hide()),this.child=o;}on(t,e){if(!this.child)throw new Error("Footprint should be open in order to listen events");return this.child.on(t,e)}hide(){k(),this.child&&this.child.destroy();}createButton(t){let e=g();return t.appendChild(e),e}},I=v;var y=new I;typeof window<"u"&&A();var q=n=>{let t=r=>y.on("completed",o=>{o&&typeof o=="string"&&r(o);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:o,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${n}?${i.toString()}`}),o&&t(o),a&&e(a);}}},D=q;var G=typeof window>"u",W=n=>{window.setTimeout(n,0);},X=n=>{let t=async a=>{await n.show({publicKey:a,onUserCanceled:()=>{var i;(i=window.onFootprintCanceled)==null||i.call(window);},onCompleted:i=>{var s;(s=window.onFootprintCompleted)==null||s.call(window,i);}});},e=()=>{let a=document.getElementById("footprint-button");if(!a)return;let i=a.getAttribute("data-public-key");if(!i)throw Error("A public key must be passed as `data-public-key` in the #footprint-button element");r(i,a);},r=(a,i)=>{W(()=>{L(i).addEventListener("click",()=>{t(a);});});},o=()=>{G||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{o();}},F=X;var Z=(n="production",t)=>n==="local"?"http://localhost:3000/":n==="development"?"https://id.preview.onefootprint.com":n==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",K=Z("production",""),M=D(K);F(M)();var ut=M;/** | ||
postmate - A powerful, simple, promise-based postMessage library | ||
@@ -84,4 +84,4 @@ @version v1.5.2 | ||
return lt; | ||
return ut; | ||
})(); |
{ | ||
"name": "@onefootprint/footprint-js", | ||
"private": false, | ||
"version": "0.3.1-beta.2", | ||
"version": "0.3.1-beta.3", | ||
"main": "./dist/footprint-js.umd.js", | ||
@@ -6,0 +6,0 @@ "module": "./dist/footprint-js.esm.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32981
6
343
0