Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onefootprint/footprint-js

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onefootprint/footprint-js - npm Package Compare versions

Comparing version 0.3.1-beta.1 to 0.3.1-beta.2

75

dist/footprint-js.cjs.js
'use strict';
var p="application/x-postmate-v1+json",M=5,V=0,S=function(){return ++V};var T=function(t){var e=document.createElement("a");e.href=t;var r=e.protocol.length>4?e.protocol:window.location.protocol,n=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||r+"//"+n},R={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||!R[t.data.postmate])},B=function(t,e){var r=typeof t[e]=="function"?t[e]():t[e];return c.Promise.resolve(r)},H=function(){function o(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(n){if(!m(n,r.childOrigin))return !1;var a=((n||{}).data||{}).value||{},i=a.data,s=a.name;n.data.postmate==="emit"&&s in r.events&&r.events[s].call(r,i);},this.parent.addEventListener("message",this.listener,!1);}var t=o.prototype;return t.get=function(r){var n=this;return new c.Promise(function(a){var i=S(),s=function d(l){l.data.uid===i&&l.data.postmate==="reply"&&(n.parent.removeEventListener("message",d,!1),a(l.data.value));};n.parent.addEventListener("message",s,!1),n.child.postMessage({postmate:"request",type:p,property:r,uid:i},n.childOrigin);})},t.call=function(r,n){this.child.postMessage({postmate:"call",type:p,property:r,data:n},this.childOrigin);},t.on=function(r,n){this.events[r]=n;},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame);},o}(),j=function(){function o(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(n){if(!!m(n,r.parentOrigin)){var a=n.data,i=a.property,s=a.uid,d=a.data;if(n.data.postmate==="call"){i in r.model&&typeof r.model[i]=="function"&&r.model[i](d);return}B(r.model,i).then(function(l){return n.source.postMessage({property:i,postmate:"reply",type:p,uid:s,value:l},n.origin)});}});}var t=o.prototype;return t.emit=function(r,n){this.parent.postMessage({postmate:"emit",type:p,value:{name:r,data:n}},this.parentOrigin);},o}(),c=function(){function o(e){var r=e.container,n=r===void 0?typeof n<"u"?n: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),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(i)}var t=o.prototype;return t.sendHandshake=function(r){var n=this,a=T(r),i=0,s;return new o.Promise(function(d,l){var u=function h(f){return m(f,a)?f.data.postmate==="handshake-reply"?(clearInterval(s),n.parent.removeEventListener("message",h,!1),n.childOrigin=f.origin,d(new H(n))):l("Failed handshake"):!1};n.parent.addEventListener("message",u,!1);var w=function(){i++,n.child.postMessage({postmate:"handshake",type:p,model:n.model},a),i===M&&clearInterval(s);},E=function(){w(),s=setInterval(w,500);};n.frame.attachEvent?n.frame.attachEvent("onload",E):n.frame.onload=E,n.frame.src=r;})},o}();c.debug=!1;c.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}();c.Model=function(){function o(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=o.prototype;return t.sendHandshakeReply=function(){var r=this;return new c.Promise(function(n,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];}),n(new j(r))}return a("Handshake Reply Failed")}};r.child.addEventListener("message",i,!1);})},o}();var b=c;var x="footprint-container",O="footprint-overlay",L="footprint-loading-indicator",C=o=>{let t=g();return o.appendChild(t),t},N=o=>{document.body.classList.add("footprint-body-locked");let t=document.createElement("div");t.setAttribute("id",O);let e=$(L);t.appendChild(e),t.classList.add("footprint-overlay"),o.appendChild(t);},_=()=>{let o=document.getElementById(L);o&&o.remove();},k=()=>{document.body.classList.remove("footprint-body-locked");let o=document.getElementById(O);o&&o.remove();},P=()=>{let o=document.getElementById(x);if(o)return o;let t=document.createElement("div");return t.setAttribute("id",x),document.body.appendChild(t),t},$=o=>{let t=document.createElement("div");t.setAttribute("id",o),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 n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"),n.setAttribute("fill","#FFFFFF"),r.appendChild(n),e.appendChild(r),t.appendChild(e),t},z=()=>{let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width","24px"),o.setAttribute("height","24px"),o.setAttribute("fill","none"),o.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"),o.appendChild(t),o},g=()=>{let o=z(),t=document.createElement("button");t.appendChild(o);let e=document.createElement("span");return e.innerText="Verify with Footprint",t.appendChild(e),t.classList.add("footprint-button"),t};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let n=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});n.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),n.on("closed",()=>this.hide()),this.child=n;}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}},A=v;var y=new A,U=o=>{let t=r=>y.on("completed",n=>{n&&typeof n=="string"&&r(n);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:n,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${o}?${i.toString()}`}),n&&t(n),a&&e(a);}}},I=U;var q=typeof window>"u",G=o=>{window.setTimeout(o,0);},W=o=>{let t=async a=>{await o.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)=>{G(()=>{C(i).addEventListener("click",()=>{t(a);});});},n=()=>{q||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{n();}},D=W;var X=(o="production",t)=>o==="local"?"http://localhost:3000/":o==="development"?"https://id.preview.onefootprint.com":o==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",Z=X("production",""),F=I(Z);D(F)();var pt=F;/**
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=`
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500&display=swap');
.footprint-body-locked {
overflow: hidden;
}
.footprint-overlay {
align-items: center;
background: rgba(0, 0, 0, 0.3);
display: flex;
height: 100%;
justify-content: center;
left: 0;
overflow-y: hidden;
position: fixed;
top: 0;
width: 100%;
z-index: 50000;
}
@keyframes footprint-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.footprint-loading-indicator {
background: rgba(0, 0, 0, 0.6);
border-radius: 4px;
padding: 16px;
}
.footprint-loading-spin {
animation: footprint-rotate 0.8s linear infinite;
}
.footprint-modal {
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 50001;
}
.footprint-button {
-webkit-box-align: center;
align-items: center;
background-color: rgb(14, 20, 56);
border-radius: 6px;
border: 0px;
box-shadow: rgb(0 0 0 / 0%) 0px 1px 1px, transparent 0px 0px 0px 1px;
color: rgb(255, 255, 255);
cursor: pointer;
display: flex;
-webkit-box-pack: center;
justify-content: center;
text-decoration: none;
user-select: none;
font-family: "DM Sans";
font-size: 16px;
font-weight: 500;
line-height: 24px;
padding: 12px 24px;
}
.footprint-button:hover {
background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button:active {
background: linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button svg {
margin-right: 8px;
}
`,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;/**
postmate - A powerful, simple, promise-based postMessage library

@@ -11,2 +82,2 @@ @version v1.5.2

module.exports = pt;
module.exports = lt;

@@ -1,2 +0,73 @@

var p="application/x-postmate-v1+json",M=5,V=0,S=function(){return ++V};var T=function(t){var e=document.createElement("a");e.href=t;var r=e.protocol.length>4?e.protocol:window.location.protocol,n=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||r+"//"+n},R={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||!R[t.data.postmate])},B=function(t,e){var r=typeof t[e]=="function"?t[e]():t[e];return c.Promise.resolve(r)},H=function(){function o(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(n){if(!m(n,r.childOrigin))return !1;var a=((n||{}).data||{}).value||{},i=a.data,s=a.name;n.data.postmate==="emit"&&s in r.events&&r.events[s].call(r,i);},this.parent.addEventListener("message",this.listener,!1);}var t=o.prototype;return t.get=function(r){var n=this;return new c.Promise(function(a){var i=S(),s=function d(l){l.data.uid===i&&l.data.postmate==="reply"&&(n.parent.removeEventListener("message",d,!1),a(l.data.value));};n.parent.addEventListener("message",s,!1),n.child.postMessage({postmate:"request",type:p,property:r,uid:i},n.childOrigin);})},t.call=function(r,n){this.child.postMessage({postmate:"call",type:p,property:r,data:n},this.childOrigin);},t.on=function(r,n){this.events[r]=n;},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame);},o}(),j=function(){function o(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(n){if(!!m(n,r.parentOrigin)){var a=n.data,i=a.property,s=a.uid,d=a.data;if(n.data.postmate==="call"){i in r.model&&typeof r.model[i]=="function"&&r.model[i](d);return}B(r.model,i).then(function(l){return n.source.postMessage({property:i,postmate:"reply",type:p,uid:s,value:l},n.origin)});}});}var t=o.prototype;return t.emit=function(r,n){this.parent.postMessage({postmate:"emit",type:p,value:{name:r,data:n}},this.parentOrigin);},o}(),c=function(){function o(e){var r=e.container,n=r===void 0?typeof n<"u"?n: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),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(i)}var t=o.prototype;return t.sendHandshake=function(r){var n=this,a=T(r),i=0,s;return new o.Promise(function(d,l){var u=function h(f){return m(f,a)?f.data.postmate==="handshake-reply"?(clearInterval(s),n.parent.removeEventListener("message",h,!1),n.childOrigin=f.origin,d(new H(n))):l("Failed handshake"):!1};n.parent.addEventListener("message",u,!1);var w=function(){i++,n.child.postMessage({postmate:"handshake",type:p,model:n.model},a),i===M&&clearInterval(s);},E=function(){w(),s=setInterval(w,500);};n.frame.attachEvent?n.frame.attachEvent("onload",E):n.frame.onload=E,n.frame.src=r;})},o}();c.debug=!1;c.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}();c.Model=function(){function o(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=o.prototype;return t.sendHandshakeReply=function(){var r=this;return new c.Promise(function(n,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];}),n(new j(r))}return a("Handshake Reply Failed")}};r.child.addEventListener("message",i,!1);})},o}();var b=c;var x="footprint-container",O="footprint-overlay",L="footprint-loading-indicator",C=o=>{let t=g();return o.appendChild(t),t},N=o=>{document.body.classList.add("footprint-body-locked");let t=document.createElement("div");t.setAttribute("id",O);let e=$(L);t.appendChild(e),t.classList.add("footprint-overlay"),o.appendChild(t);},_=()=>{let o=document.getElementById(L);o&&o.remove();},k=()=>{document.body.classList.remove("footprint-body-locked");let o=document.getElementById(O);o&&o.remove();},P=()=>{let o=document.getElementById(x);if(o)return o;let t=document.createElement("div");return t.setAttribute("id",x),document.body.appendChild(t),t},$=o=>{let t=document.createElement("div");t.setAttribute("id",o),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 n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"),n.setAttribute("fill","#FFFFFF"),r.appendChild(n),e.appendChild(r),t.appendChild(e),t},z=()=>{let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width","24px"),o.setAttribute("height","24px"),o.setAttribute("fill","none"),o.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"),o.appendChild(t),o},g=()=>{let o=z(),t=document.createElement("button");t.appendChild(o);let e=document.createElement("span");return e.innerText="Verify with Footprint",t.appendChild(e),t.classList.add("footprint-button"),t};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let n=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});n.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),n.on("closed",()=>this.hide()),this.child=n;}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}},A=v;var y=new A,U=o=>{let t=r=>y.on("completed",n=>{n&&typeof n=="string"&&r(n);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:n,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${o}?${i.toString()}`}),n&&t(n),a&&e(a);}}},I=U;var q=typeof window>"u",G=o=>{window.setTimeout(o,0);},W=o=>{let t=async a=>{await o.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)=>{G(()=>{C(i).addEventListener("click",()=>{t(a);});});},n=()=>{q||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{n();}},D=W;var X=(o="production",t)=>o==="local"?"http://localhost:3000/":o==="development"?"https://id.preview.onefootprint.com":o==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",Z=X("production",""),F=I(Z);D(F)();var pt=F;/**
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=`
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500&display=swap');
.footprint-body-locked {
overflow: hidden;
}
.footprint-overlay {
align-items: center;
background: rgba(0, 0, 0, 0.3);
display: flex;
height: 100%;
justify-content: center;
left: 0;
overflow-y: hidden;
position: fixed;
top: 0;
width: 100%;
z-index: 50000;
}
@keyframes footprint-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.footprint-loading-indicator {
background: rgba(0, 0, 0, 0.6);
border-radius: 4px;
padding: 16px;
}
.footprint-loading-spin {
animation: footprint-rotate 0.8s linear infinite;
}
.footprint-modal {
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 50001;
}
.footprint-button {
-webkit-box-align: center;
align-items: center;
background-color: rgb(14, 20, 56);
border-radius: 6px;
border: 0px;
box-shadow: rgb(0 0 0 / 0%) 0px 1px 1px, transparent 0px 0px 0px 1px;
color: rgb(255, 255, 255);
cursor: pointer;
display: flex;
-webkit-box-pack: center;
justify-content: center;
text-decoration: none;
user-select: none;
font-family: "DM Sans";
font-size: 16px;
font-weight: 500;
line-height: 24px;
padding: 12px 24px;
}
.footprint-button:hover {
background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button:active {
background: linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button svg {
margin-right: 8px;
}
`,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;/**
postmate - A powerful, simple, promise-based postMessage library

@@ -9,2 +80,2 @@ @version v1.5.2

export { pt as default };
export { lt as default };
(function () {
'use strict';
var p="application/x-postmate-v1+json",M=5,V=0,S=function(){return ++V};var T=function(t){var e=document.createElement("a");e.href=t;var r=e.protocol.length>4?e.protocol:window.location.protocol,n=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||r+"//"+n},R={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||!R[t.data.postmate])},B=function(t,e){var r=typeof t[e]=="function"?t[e]():t[e];return c.Promise.resolve(r)},H=function(){function o(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(n){if(!m(n,r.childOrigin))return !1;var a=((n||{}).data||{}).value||{},i=a.data,s=a.name;n.data.postmate==="emit"&&s in r.events&&r.events[s].call(r,i);},this.parent.addEventListener("message",this.listener,!1);}var t=o.prototype;return t.get=function(r){var n=this;return new c.Promise(function(a){var i=S(),s=function d(l){l.data.uid===i&&l.data.postmate==="reply"&&(n.parent.removeEventListener("message",d,!1),a(l.data.value));};n.parent.addEventListener("message",s,!1),n.child.postMessage({postmate:"request",type:p,property:r,uid:i},n.childOrigin);})},t.call=function(r,n){this.child.postMessage({postmate:"call",type:p,property:r,data:n},this.childOrigin);},t.on=function(r,n){this.events[r]=n;},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame);},o}(),j=function(){function o(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(n){if(!!m(n,r.parentOrigin)){var a=n.data,i=a.property,s=a.uid,d=a.data;if(n.data.postmate==="call"){i in r.model&&typeof r.model[i]=="function"&&r.model[i](d);return}B(r.model,i).then(function(l){return n.source.postMessage({property:i,postmate:"reply",type:p,uid:s,value:l},n.origin)});}});}var t=o.prototype;return t.emit=function(r,n){this.parent.postMessage({postmate:"emit",type:p,value:{name:r,data:n}},this.parentOrigin);},o}(),c=function(){function o(e){var r=e.container,n=r===void 0?typeof n<"u"?n: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),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(i)}var t=o.prototype;return t.sendHandshake=function(r){var n=this,a=T(r),i=0,s;return new o.Promise(function(d,l){var u=function h(f){return m(f,a)?f.data.postmate==="handshake-reply"?(clearInterval(s),n.parent.removeEventListener("message",h,!1),n.childOrigin=f.origin,d(new H(n))):l("Failed handshake"):!1};n.parent.addEventListener("message",u,!1);var w=function(){i++,n.child.postMessage({postmate:"handshake",type:p,model:n.model},a),i===M&&clearInterval(s);},E=function(){w(),s=setInterval(w,500);};n.frame.attachEvent?n.frame.attachEvent("onload",E):n.frame.onload=E,n.frame.src=r;})},o}();c.debug=!1;c.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}();c.Model=function(){function o(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=o.prototype;return t.sendHandshakeReply=function(){var r=this;return new c.Promise(function(n,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];}),n(new j(r))}return a("Handshake Reply Failed")}};r.child.addEventListener("message",i,!1);})},o}();var b=c;var x="footprint-container",O="footprint-overlay",L="footprint-loading-indicator",C=o=>{let t=g();return o.appendChild(t),t},N=o=>{document.body.classList.add("footprint-body-locked");let t=document.createElement("div");t.setAttribute("id",O);let e=$(L);t.appendChild(e),t.classList.add("footprint-overlay"),o.appendChild(t);},_=()=>{let o=document.getElementById(L);o&&o.remove();},k=()=>{document.body.classList.remove("footprint-body-locked");let o=document.getElementById(O);o&&o.remove();},P=()=>{let o=document.getElementById(x);if(o)return o;let t=document.createElement("div");return t.setAttribute("id",x),document.body.appendChild(t),t},$=o=>{let t=document.createElement("div");t.setAttribute("id",o),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 n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"),n.setAttribute("fill","#FFFFFF"),r.appendChild(n),e.appendChild(r),t.appendChild(e),t},z=()=>{let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("width","24px"),o.setAttribute("height","24px"),o.setAttribute("fill","none"),o.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"),o.appendChild(t),o},g=()=>{let o=z(),t=document.createElement("button");t.appendChild(o);let e=document.createElement("span");return e.innerText="Verify with Footprint",t.appendChild(e),t.classList.add("footprint-button"),t};var v=class{constructor(){this.child=null;}async show({url:t}){let e=()=>{_();},r=P();N(r);let n=await new b({classListArray:["footprint-modal"],container:r,name:"footprint-iframe",url:t});n.frame.setAttribute("allow","otp-credentials; publickey-credentials-get *; camera *;"),e(),n.on("closed",()=>this.hide()),this.child=n;}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}},A=v;var y=new A,U=o=>{let t=r=>y.on("completed",n=>{n&&typeof n=="string"&&r(n);}),e=r=>y.on("userCanceled",r);return {show:async({publicKey:r,onCompleted:n,onUserCanceled:a})=>{let i=new URLSearchParams;i.append("flow","onboarding"),i.append("public_key",r),await y.show({url:`${o}?${i.toString()}`}),n&&t(n),a&&e(a);}}},I=U;var q=typeof window>"u",G=o=>{window.setTimeout(o,0);},W=o=>{let t=async a=>{await o.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)=>{G(()=>{C(i).addEventListener("click",()=>{t(a);});});},n=()=>{q||document.addEventListener("DOMContentLoaded",()=>e());};return ()=>{n();}},D=W;var X=(o="production",t)=>o==="local"?"http://localhost:3000/":o==="development"?"https://id.preview.onefootprint.com":o==="preview"&&t?t==="development"?"https://id.preview.onefootprint.com":`https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com`:"https://id.onefootprint.com",Z=X("production",""),F=I(Z);D(F)();var pt=F;/**
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=`
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500&display=swap');
.footprint-body-locked {
overflow: hidden;
}
.footprint-overlay {
align-items: center;
background: rgba(0, 0, 0, 0.3);
display: flex;
height: 100%;
justify-content: center;
left: 0;
overflow-y: hidden;
position: fixed;
top: 0;
width: 100%;
z-index: 50000;
}
@keyframes footprint-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.footprint-loading-indicator {
background: rgba(0, 0, 0, 0.6);
border-radius: 4px;
padding: 16px;
}
.footprint-loading-spin {
animation: footprint-rotate 0.8s linear infinite;
}
.footprint-modal {
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 50001;
}
.footprint-button {
-webkit-box-align: center;
align-items: center;
background-color: rgb(14, 20, 56);
border-radius: 6px;
border: 0px;
box-shadow: rgb(0 0 0 / 0%) 0px 1px 1px, transparent 0px 0px 0px 1px;
color: rgb(255, 255, 255);
cursor: pointer;
display: flex;
-webkit-box-pack: center;
justify-content: center;
text-decoration: none;
user-select: none;
font-family: "DM Sans";
font-size: 16px;
font-weight: 500;
line-height: 24px;
padding: 12px 24px;
}
.footprint-button:hover {
background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button:active {
background: linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)), linear-gradient(rgb(14, 20, 56), rgb(14, 20, 56));
}
.footprint-button svg {
margin-right: 8px;
}
`,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;/**
postmate - A powerful, simple, promise-based postMessage library

@@ -12,4 +83,4 @@ @version v1.5.2

return pt;
return lt;
})();

2

package.json
{
"name": "@onefootprint/footprint-js",
"private": false,
"version": "0.3.1-beta.1",
"version": "0.3.1-beta.2",
"main": "./dist/footprint-js.umd.js",

@@ -6,0 +6,0 @@ "module": "./dist/footprint-js.esm.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc