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

@everfund/js-sdk

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@everfund/js-sdk - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

dist/js-sdk.global.js

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

"use strict";(()=>{function Q(o){if(Array.isArray(o)){for(var e=0,t=Array(o.length);e<o.length;e++)t[e]=o[e];return t}else return Array.from(o)}var L=!1;typeof window<"u"&&(P={get passive(){L=!0}},window.addEventListener("testPassive",null,P),window.removeEventListener("testPassive",null,P));var P,b=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),m=[],w=!1,k=-1,S=void 0,y=void 0,x=void 0,F=function(e){return m.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))})},E=function(e){var t=e||window.event;return F(t.target)||t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)},Y=function(e){if(x===void 0){var t=!!e&&e.reserveScrollBarGap===!0,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var a=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);x=document.body.style.paddingRight,document.body.style.paddingRight=a+n+"px"}}S===void 0&&(S=document.body.style.overflow,document.body.style.overflow="hidden")},$=function(){x!==void 0&&(document.body.style.paddingRight=x,x=void 0),S!==void 0&&(document.body.style.overflow=S,S=void 0)},V=function(){return window.requestAnimationFrame(function(){if(y===void 0){y={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,a=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout(function(){return window.requestAnimationFrame(function(){var r=a-window.innerHeight;r&&t>=a&&(document.body.style.top=-(t+r))})},300)}})},D=function(){if(y!==void 0){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=y.position,document.body.style.top=y.top,document.body.style.left=y.left,window.scrollTo(t,e),y=void 0}},Z=function(e){return e?e.scrollHeight-e.scrollTop<=e.clientHeight:!1},J=function(e,t){var n=e.targetTouches[0].clientY-k;return F(e.target)?!1:t&&t.scrollTop===0&&n>0||Z(t)&&n<0?E(e):(e.stopPropagation(),!0)},j=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!m.some(function(a){return a.targetElement===e})){var n={targetElement:e,options:t||{}};m=[].concat(Q(m),[n]),b?V():Y(t),b&&(e.ontouchstart=function(a){a.targetTouches.length===1&&(k=a.targetTouches[0].clientY)},e.ontouchmove=function(a){a.targetTouches.length===1&&J(a,e)},w||(document.addEventListener("touchmove",E,L?{passive:!1}:void 0),w=!0))}},T=function(){b&&(m.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),w&&(document.removeEventListener("touchmove",E,L?{passive:!1}:void 0),w=!1),k=-1),b?D():$(),m=[]},q=function(e){if(!e){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}m=m.filter(function(t){return t.targetElement!==e}),b&&(e.ontouchstart=null,e.ontouchmove=null,w&&m.length===0&&(document.removeEventListener("touchmove",E,L?{passive:!1}:void 0),w=!1)),b?D():$()};var O="3.0.1";var U={data:""},X=o=>typeof window=="object"?((o?o.querySelector("#_goober"):window._goober)||Object.assign((o||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:o||U;var G=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ee=/\/\*[^]*?\*\/| +/g,z=/\n+/g,g=(o,e)=>{let t="",n="",a="";for(let r in o){let l=o[r];r[0]=="@"?r[1]=="i"?t=r+" "+l+";":n+=r[1]=="f"?g(l,r):r+"{"+g(l,r[1]=="k"?"":e)+"}":typeof l=="object"?n+=g(l,e?e.replace(/([^,])+/g,s=>r.replace(/(^:.*)|([^,])+/g,i=>/&/.test(i)?i.replace(/&/g,s):s?s+" "+i:i)):r):l!=null&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=g.p?g.p(r,l):r+":"+l+";")}return t+(e&&a?e+"{"+a+"}":a)+n},p={},H=o=>{if(typeof o=="object"){let e="";for(let t in o)e+=t+H(o[t]);return e}return o},te=(o,e,t,n,a)=>{let r=H(o),l=p[r]||(p[r]=(i=>{let c=0,d=11;for(;c<i.length;)d=101*d+i.charCodeAt(c++)>>>0;return"go"+d})(r));if(!p[l]){let i=r!==o?o:(c=>{let d,v,u=[{}];for(;d=G.exec(c.replace(ee,""));)d[4]?u.shift():d[3]?(v=d[3].replace(z," ").trim(),u.unshift(u[0][v]=u[0][v]||{})):u[0][d[1]]=d[2].replace(z," ").trim();return u[0]})(o);p[l]=g(a?{["@keyframes "+l]:i}:i,t?"":"."+l)}let s=t&&p.g?p.g:null;return t&&(p.g=p[l]),((i,c,d,v)=>{v?c.data=c.data.replace(v,i):c.data.indexOf(i)===-1&&(c.data=d?i+c.data:c.data+i)})(p[l],e,n,s),l},oe=(o,e,t)=>o.reduce((n,a,r)=>{let l=e[r];if(l&&l.call){let s=l(t),i=s&&s.props&&s.props.className||/^go/.test(s)&&s;l=i?"."+i:s&&typeof s=="object"?s.props?"":g(s,""):s===!1?"":s}return n+a+(l??"")},"");function h(o){let e=this||{},t=o.call?o(e.p):o;return te(t.unshift?t.raw?oe(t,[].slice.call(arguments,1),e.p):t.reduce((n,a)=>Object.assign(n,a&&a.call?a(e.p):a),{}):t,X(e.target),e.g,e.o,e.k)}var ae=h.bind({g:1}),I=h.bind({k:1});function A(o){return Object.keys(o).reduce((t,n,a)=>{let r=o[n];if(r==null)return t;let l=a===0?"?":"&",s=Array.isArray(r)?r.join(","):r.toString();return`${t}${l}${n}=${s}`},"")}var B=class{donationWidgetOpen=!1;onSuccess=()=>{};onFailure=()=>{};onClose=()=>{};version;constructor(){this.version=O,typeof window<"u"&&(this.setupButtonListeners(),this.setupIframeListeners())}modal({code:e,domain:t,closeOnSuccess:n,onSuccess:a,onFailure:r,onClose:l}){a&&(this.onSuccess=a),r&&(this.onFailure=r),l&&(this.onClose=l);let s=window.location.origin;try{let i=document.createElement("iframe");i.src=`${t||"https://evr.fund"}/${e}/modal${A({embed_origin:s,embeded:!0,close_on_success:n})}`,i.allowPaymentRequest=!0;let c=h({border:"none",width:"100%",margin:0,height:"100%"});i.id="ef-modal",i.className=c,i.ariaModal="true",i.ariaLabel="Everfund Donation Modal",i.setAttribute("role","donation-modal"),i.addEventListener("load",function(){let M=document.querySelector(".ldsRing"),K=document.querySelector(".embedModal");M==null||M.remove(),K.style.transform="opacity(1)"});let d=document.createElement("div"),v=h({pointerEvents:"all",zIndex:"9999999",display:"flex",width:"100%",transform:"opacity(0)",transition:"transform 0.3s ease",overflowY:"auto","-webkit-overflow-scrolling":"touch",height:"100%"});d.className=`embedModal ${v}`,d.appendChild(i);let u=document.createElement("div");j(u);let C=document.createElement("div"),W=I({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),R=h({display:"inline-block",position:"absolute",left:"calc(50% - 32px)",top:"calc(50% - 32px)",width:"64px",height:"64px","& div":{boxSizing:"border-box",display:"block",position:"absolute",width:"51px",height:"51px",margin:"6px",border:"6px solid white",borderRadius:"50%",animation:`${W} 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite`,borderColor:"white transparent transparent transparent"},"& div:nth-child(1)":{animationDelay:" -0.45s"},"& div:nth-child(2)":{animationDelay:" -0.3s"},"& div:nth-child(3)":{animationDelay:" -0.15s"}});C.className=`ldsRing ${R}`;let _=document.createElement("div");Array(4).fill(4).forEach(function(){C.appendChild(_)});let N=h({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0, 0, 0, 0.7)",zIndex:"9999998",display:"flex",justifyContent:"space-around",alignItems:"stretch",backdropFilter:"blur(8px)"});u.className=`embedContainer ${N}`,u.appendChild(C),u.appendChild(d),document.body.appendChild(u),i.setAttribute("tabindex","0"),i.focus()}catch(i){console.log(i),window.location.replace(`https://${t||"evr.fund"}/${e}/modal${A({return_url:s})}`)}}setupButtonListeners(){document.addEventListener("click",function(e){let t=e.target.closest("[data-ef-modal]");if(!t||f.donationWidgetOpen)return;e.preventDefault(),e.stopPropagation();let n=t.getAttribute("data-ef-modal");if(!n){console.error('Everfund: data-ef-modal is required! eg <button data-ef-modal="j1q16MvJl5lqfji06bVFKei3HZkW"> modal </button>');return}new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(n)&&(console.warn("Everfund: url's are deprecated please use a code instead"),n=new URL(n).pathname.replace("/","")),f.donationWidgetOpen=!0,f.modal({code:n,onSuccess:()=>{},onFailure:()=>{},onClose:()=>{T()}})},!1)}setupIframeListeners(){window.addEventListener("message",function(e){let t=document.querySelector(".embedContainer");switch(e.data.message){case"everfund:ready":{let n=document.querySelector("#ldsRing"),a=document.querySelector(".embedModal");n==null||n.remove(),a.style.transform="opacity(1)";break}case"everfund:success":{let n=e.data.content;f.onSuccess&&f.onSuccess(n);break}case"everfund:failure":{f.onFailure&&f.onFailure(e.data.content);break}case"everfund:close":{t&&q(t),t&&t.remove(),f.donationWidgetOpen=!1,f.onClose&&f.onClose(),T();break}}},!1)}},f=new B;var pe=f;})();
"use strict";(()=>{function Q(o){if(Array.isArray(o)){for(var e=0,t=Array(o.length);e<o.length;e++)t[e]=o[e];return t}else return Array.from(o)}var L=!1;typeof window<"u"&&(P={get passive(){L=!0}},window.addEventListener("testPassive",null,P),window.removeEventListener("testPassive",null,P));var P,b=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),m=[],w=!1,k=-1,S=void 0,y=void 0,x=void 0,F=function(e){return m.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))})},E=function(e){var t=e||window.event;return F(t.target)||t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)},Y=function(e){if(x===void 0){var t=!!e&&e.reserveScrollBarGap===!0,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var a=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);x=document.body.style.paddingRight,document.body.style.paddingRight=a+n+"px"}}S===void 0&&(S=document.body.style.overflow,document.body.style.overflow="hidden")},$=function(){x!==void 0&&(document.body.style.paddingRight=x,x=void 0),S!==void 0&&(document.body.style.overflow=S,S=void 0)},V=function(){return window.requestAnimationFrame(function(){if(y===void 0){y={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,a=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout(function(){return window.requestAnimationFrame(function(){var r=a-window.innerHeight;r&&t>=a&&(document.body.style.top=-(t+r))})},300)}})},D=function(){if(y!==void 0){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=y.position,document.body.style.top=y.top,document.body.style.left=y.left,window.scrollTo(t,e),y=void 0}},Z=function(e){return e?e.scrollHeight-e.scrollTop<=e.clientHeight:!1},J=function(e,t){var n=e.targetTouches[0].clientY-k;return F(e.target)?!1:t&&t.scrollTop===0&&n>0||Z(t)&&n<0?E(e):(e.stopPropagation(),!0)},j=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!m.some(function(a){return a.targetElement===e})){var n={targetElement:e,options:t||{}};m=[].concat(Q(m),[n]),b?V():Y(t),b&&(e.ontouchstart=function(a){a.targetTouches.length===1&&(k=a.targetTouches[0].clientY)},e.ontouchmove=function(a){a.targetTouches.length===1&&J(a,e)},w||(document.addEventListener("touchmove",E,L?{passive:!1}:void 0),w=!0))}},T=function(){b&&(m.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),w&&(document.removeEventListener("touchmove",E,L?{passive:!1}:void 0),w=!1),k=-1),b?D():$(),m=[]},q=function(e){if(!e){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}m=m.filter(function(t){return t.targetElement!==e}),b&&(e.ontouchstart=null,e.ontouchmove=null,w&&m.length===0&&(document.removeEventListener("touchmove",E,L?{passive:!1}:void 0),w=!1)),b?D():$()};var O="3.0.1";var U={data:""},X=o=>typeof window=="object"?((o?o.querySelector("#_goober"):window._goober)||Object.assign((o||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:o||U;var G=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ee=/\/\*[^]*?\*\/| +/g,z=/\n+/g,g=(o,e)=>{let t="",n="",a="";for(let r in o){let l=o[r];r[0]=="@"?r[1]=="i"?t=r+" "+l+";":n+=r[1]=="f"?g(l,r):r+"{"+g(l,r[1]=="k"?"":e)+"}":typeof l=="object"?n+=g(l,e?e.replace(/([^,])+/g,s=>r.replace(/(^:.*)|([^,])+/g,i=>/&/.test(i)?i.replace(/&/g,s):s?s+" "+i:i)):r):l!=null&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=g.p?g.p(r,l):r+":"+l+";")}return t+(e&&a?e+"{"+a+"}":a)+n},p={},H=o=>{if(typeof o=="object"){let e="";for(let t in o)e+=t+H(o[t]);return e}return o},te=(o,e,t,n,a)=>{let r=H(o),l=p[r]||(p[r]=(i=>{let c=0,d=11;for(;c<i.length;)d=101*d+i.charCodeAt(c++)>>>0;return"go"+d})(r));if(!p[l]){let i=r!==o?o:(c=>{let d,v,u=[{}];for(;d=G.exec(c.replace(ee,""));)d[4]?u.shift():d[3]?(v=d[3].replace(z," ").trim(),u.unshift(u[0][v]=u[0][v]||{})):u[0][d[1]]=d[2].replace(z," ").trim();return u[0]})(o);p[l]=g(a?{["@keyframes "+l]:i}:i,t?"":"."+l)}let s=t&&p.g?p.g:null;return t&&(p.g=p[l]),((i,c,d,v)=>{v?c.data=c.data.replace(v,i):c.data.indexOf(i)===-1&&(c.data=d?i+c.data:c.data+i)})(p[l],e,n,s),l},oe=(o,e,t)=>o.reduce((n,a,r)=>{let l=e[r];if(l&&l.call){let s=l(t),i=s&&s.props&&s.props.className||/^go/.test(s)&&s;l=i?"."+i:s&&typeof s=="object"?s.props?"":g(s,""):s===!1?"":s}return n+a+(l??"")},"");function h(o){let e=this||{},t=o.call?o(e.p):o;return te(t.unshift?t.raw?oe(t,[].slice.call(arguments,1),e.p):t.reduce((n,a)=>Object.assign(n,a&&a.call?a(e.p):a),{}):t,X(e.target),e.g,e.o,e.k)}var ae=h.bind({g:1}),I=h.bind({k:1});function A(o){return Object.keys(o).reduce((t,n,a)=>{let r=o[n];if(r==null)return t;let l=a===0?"?":"&",s=Array.isArray(r)?r.join(","):r.toString();return`${t}${l}${n}=${s}`},"")}var B=class{donationWidgetOpen=!1;onSuccess=()=>{};onFailure=()=>{};onClose=()=>{};version;constructor(){this.version=O,typeof window<"u"&&(this.setupButtonListeners(),this.setupIframeListeners())}modal({code:e,domain:t,closeOnSuccess:n,onSuccess:a,onFailure:r,onClose:l}){a&&(this.onSuccess=a),r&&(this.onFailure=r),l&&(this.onClose=l);let s=window.location.origin;try{let i=document.createElement("iframe");i.src=`${t||"https://evr.fund"}/${e}/modal${A({embed_origin:s,embeded:!0,close_on_success:n})}`,i.allow="payment",i.allowPaymentRequest=!0;let c=h({border:"none",width:"100%",margin:0,height:"100%"});i.id="ef-modal",i.className=c,i.ariaModal="true",i.ariaLabel="Everfund Donation Modal",i.setAttribute("role","donation-modal"),i.addEventListener("load",function(){let M=document.querySelector(".ldsRing"),K=document.querySelector(".embedModal");M==null||M.remove(),K.style.transform="opacity(1)"});let d=document.createElement("div"),v=h({pointerEvents:"all",zIndex:"9999999",display:"flex",width:"100%",transform:"opacity(0)",transition:"transform 0.3s ease",overflowY:"auto","-webkit-overflow-scrolling":"touch",height:"100%"});d.className=`embedModal ${v}`,d.appendChild(i);let u=document.createElement("div");j(u);let C=document.createElement("div"),W=I({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),R=h({display:"inline-block",position:"absolute",left:"calc(50% - 32px)",top:"calc(50% - 32px)",width:"64px",height:"64px","& div":{boxSizing:"border-box",display:"block",position:"absolute",width:"51px",height:"51px",margin:"6px",border:"6px solid white",borderRadius:"50%",animation:`${W} 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite`,borderColor:"white transparent transparent transparent"},"& div:nth-child(1)":{animationDelay:" -0.45s"},"& div:nth-child(2)":{animationDelay:" -0.3s"},"& div:nth-child(3)":{animationDelay:" -0.15s"}});C.className=`ldsRing ${R}`;let _=document.createElement("div");Array(4).fill(4).forEach(function(){C.appendChild(_)});let N=h({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0, 0, 0, 0.7)",zIndex:"9999998",display:"flex",justifyContent:"space-around",alignItems:"stretch",backdropFilter:"blur(8px)"});u.className=`embedContainer ${N}`,u.appendChild(C),u.appendChild(d),document.body.appendChild(u),i.setAttribute("tabindex","0"),i.focus()}catch(i){console.log(i),window.location.replace(`https://${t||"evr.fund"}/${e}/modal${A({return_url:s})}`)}}setupButtonListeners(){document.addEventListener("click",function(e){let t=e.target.closest("[data-ef-modal]");if(!t||f.donationWidgetOpen)return;e.preventDefault(),e.stopPropagation();let n=t.getAttribute("data-ef-modal");if(!n){console.error('Everfund: data-ef-modal is required! eg <button data-ef-modal="j1q16MvJl5lqfji06bVFKei3HZkW"> modal </button>');return}new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(n)&&(console.warn("Everfund: url's are deprecated please use a code instead"),n=new URL(n).pathname.replace("/","")),f.donationWidgetOpen=!0,f.modal({code:n,onSuccess:()=>{},onFailure:()=>{},onClose:()=>{T()}})},!1)}setupIframeListeners(){window.addEventListener("message",function(e){let t=document.querySelector(".embedContainer");switch(e.data.message){case"everfund:ready":{let n=document.querySelector("#ldsRing"),a=document.querySelector(".embedModal");n==null||n.remove(),a.style.transform="opacity(1)";break}case"everfund:success":{let n=e.data.content;f.onSuccess&&f.onSuccess(n);break}case"everfund:failure":{f.onFailure&&f.onFailure(e.data.content);break}case"everfund:close":{t&&q(t),t&&t.remove(),f.donationWidgetOpen=!1,f.onClose&&f.onClose(),T();break}}},!1)}},f=new B;var pe=f;})();
//# sourceMappingURL=js-sdk.global.js.map

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

"use strict";var v=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(s,e)=>{for(var o in e)v(s,o,{get:e[o],enumerable:!0})},q=(s,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of $(e))!z.call(s,r)&&r!==o&&v(s,r,{get:()=>e[r],enumerable:!(t=S(e,r))||t.enumerable});return s};var W=s=>q(v({},"__esModule",{value:!0}),s);var F={};P(F,{checkoutModal:()=>a,default:()=>D});module.exports=W(F);var l=require("body-scroll-lock");var g="3.0.1";var d=require("goober");function h(s){return Object.keys(s).reduce((o,t,r)=>{let i=s[t];if(i==null)return o;let u=r===0?"?":"&",m=Array.isArray(i)?i.join(","):i.toString();return`${o}${u}${t}=${m}`},"")}var y=class{donationWidgetOpen=!1;onSuccess=()=>{};onFailure=()=>{};onClose=()=>{};version;constructor(){this.version=g,typeof window<"u"&&(this.setupButtonListeners(),this.setupIframeListeners())}modal({code:e,domain:o,closeOnSuccess:t,onSuccess:r,onFailure:i,onClose:u}){r&&(this.onSuccess=r),i&&(this.onFailure=i),u&&(this.onClose=u);let m=window.location.origin;try{let n=document.createElement("iframe");n.src=`${o||"https://evr.fund"}/${e}/modal${h({embed_origin:m,embeded:!0,close_on_success:t})}`,n.allowPaymentRequest=!0;let w=(0,d.css)({border:"none",width:"100%",margin:0,height:"100%"});n.id="ef-modal",n.className=w,n.ariaModal="true",n.ariaLabel="Everfund Donation Modal",n.setAttribute("role","donation-modal"),n.addEventListener("load",function(){let b=document.querySelector(".ldsRing"),L=document.querySelector(".embedModal");b==null||b.remove(),L.style.transform="opacity(1)"});let p=document.createElement("div"),x=(0,d.css)({pointerEvents:"all",zIndex:"9999999",display:"flex",width:"100%",transform:"opacity(0)",transition:"transform 0.3s ease",overflowY:"auto","-webkit-overflow-scrolling":"touch",height:"100%"});p.className=`embedModal ${x}`,p.appendChild(n);let c=document.createElement("div");(0,l.disableBodyScroll)(c);let f=document.createElement("div"),E=(0,d.keyframes)({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),M=(0,d.css)({display:"inline-block",position:"absolute",left:"calc(50% - 32px)",top:"calc(50% - 32px)",width:"64px",height:"64px","& div":{boxSizing:"border-box",display:"block",position:"absolute",width:"51px",height:"51px",margin:"6px",border:"6px solid white",borderRadius:"50%",animation:`${E} 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite`,borderColor:"white transparent transparent transparent"},"& div:nth-child(1)":{animationDelay:" -0.45s"},"& div:nth-child(2)":{animationDelay:" -0.3s"},"& div:nth-child(3)":{animationDelay:" -0.15s"}});f.className=`ldsRing ${M}`;let C=document.createElement("div");Array(4).fill(4).forEach(function(){f.appendChild(C)});let k=(0,d.css)({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0, 0, 0, 0.7)",zIndex:"9999998",display:"flex",justifyContent:"space-around",alignItems:"stretch",backdropFilter:"blur(8px)"});c.className=`embedContainer ${k}`,c.appendChild(f),c.appendChild(p),document.body.appendChild(c),n.setAttribute("tabindex","0"),n.focus()}catch(n){console.log(n),window.location.replace(`https://${o||"evr.fund"}/${e}/modal${h({return_url:m})}`)}}setupButtonListeners(){document.addEventListener("click",function(e){let o=e.target.closest("[data-ef-modal]");if(!o||a.donationWidgetOpen)return;e.preventDefault(),e.stopPropagation();let t=o.getAttribute("data-ef-modal");if(!t){console.error('Everfund: data-ef-modal is required! eg <button data-ef-modal="j1q16MvJl5lqfji06bVFKei3HZkW"> modal </button>');return}new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(t)&&(console.warn("Everfund: url's are deprecated please use a code instead"),t=new URL(t).pathname.replace("/","")),a.donationWidgetOpen=!0,a.modal({code:t,onSuccess:()=>{},onFailure:()=>{},onClose:()=>{(0,l.clearAllBodyScrollLocks)()}})},!1)}setupIframeListeners(){window.addEventListener("message",function(e){let o=document.querySelector(".embedContainer");switch(e.data.message){case"everfund:ready":{let t=document.querySelector("#ldsRing"),r=document.querySelector(".embedModal");t==null||t.remove(),r.style.transform="opacity(1)";break}case"everfund:success":{let t=e.data.content;a.onSuccess&&a.onSuccess(t);break}case"everfund:failure":{a.onFailure&&a.onFailure(e.data.content);break}case"everfund:close":{o&&(0,l.enableBodyScroll)(o),o&&o.remove(),a.donationWidgetOpen=!1,a.onClose&&a.onClose(),(0,l.clearAllBodyScrollLocks)();break}}},!1)}},a=new y;var D=a;0&&(module.exports={checkoutModal});
"use strict";var v=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(s,e)=>{for(var o in e)v(s,o,{get:e[o],enumerable:!0})},q=(s,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of $(e))!z.call(s,r)&&r!==o&&v(s,r,{get:()=>e[r],enumerable:!(t=S(e,r))||t.enumerable});return s};var W=s=>q(v({},"__esModule",{value:!0}),s);var F={};P(F,{checkoutModal:()=>a,default:()=>D});module.exports=W(F);var l=require("body-scroll-lock");var g="3.0.1";var d=require("goober");function h(s){return Object.keys(s).reduce((o,t,r)=>{let i=s[t];if(i==null)return o;let m=r===0?"?":"&",u=Array.isArray(i)?i.join(","):i.toString();return`${o}${m}${t}=${u}`},"")}var y=class{donationWidgetOpen=!1;onSuccess=()=>{};onFailure=()=>{};onClose=()=>{};version;constructor(){this.version=g,typeof window<"u"&&(this.setupButtonListeners(),this.setupIframeListeners())}modal({code:e,domain:o,closeOnSuccess:t,onSuccess:r,onFailure:i,onClose:m}){r&&(this.onSuccess=r),i&&(this.onFailure=i),m&&(this.onClose=m);let u=window.location.origin;try{let n=document.createElement("iframe");n.src=`${o||"https://evr.fund"}/${e}/modal${h({embed_origin:u,embeded:!0,close_on_success:t})}`,n.allow="payment",n.allowPaymentRequest=!0;let w=(0,d.css)({border:"none",width:"100%",margin:0,height:"100%"});n.id="ef-modal",n.className=w,n.ariaModal="true",n.ariaLabel="Everfund Donation Modal",n.setAttribute("role","donation-modal"),n.addEventListener("load",function(){let b=document.querySelector(".ldsRing"),L=document.querySelector(".embedModal");b==null||b.remove(),L.style.transform="opacity(1)"});let p=document.createElement("div"),x=(0,d.css)({pointerEvents:"all",zIndex:"9999999",display:"flex",width:"100%",transform:"opacity(0)",transition:"transform 0.3s ease",overflowY:"auto","-webkit-overflow-scrolling":"touch",height:"100%"});p.className=`embedModal ${x}`,p.appendChild(n);let c=document.createElement("div");(0,l.disableBodyScroll)(c);let f=document.createElement("div"),E=(0,d.keyframes)({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),M=(0,d.css)({display:"inline-block",position:"absolute",left:"calc(50% - 32px)",top:"calc(50% - 32px)",width:"64px",height:"64px","& div":{boxSizing:"border-box",display:"block",position:"absolute",width:"51px",height:"51px",margin:"6px",border:"6px solid white",borderRadius:"50%",animation:`${E} 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite`,borderColor:"white transparent transparent transparent"},"& div:nth-child(1)":{animationDelay:" -0.45s"},"& div:nth-child(2)":{animationDelay:" -0.3s"},"& div:nth-child(3)":{animationDelay:" -0.15s"}});f.className=`ldsRing ${M}`;let C=document.createElement("div");Array(4).fill(4).forEach(function(){f.appendChild(C)});let k=(0,d.css)({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0, 0, 0, 0.7)",zIndex:"9999998",display:"flex",justifyContent:"space-around",alignItems:"stretch",backdropFilter:"blur(8px)"});c.className=`embedContainer ${k}`,c.appendChild(f),c.appendChild(p),document.body.appendChild(c),n.setAttribute("tabindex","0"),n.focus()}catch(n){console.log(n),window.location.replace(`https://${o||"evr.fund"}/${e}/modal${h({return_url:u})}`)}}setupButtonListeners(){document.addEventListener("click",function(e){let o=e.target.closest("[data-ef-modal]");if(!o||a.donationWidgetOpen)return;e.preventDefault(),e.stopPropagation();let t=o.getAttribute("data-ef-modal");if(!t){console.error('Everfund: data-ef-modal is required! eg <button data-ef-modal="j1q16MvJl5lqfji06bVFKei3HZkW"> modal </button>');return}new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(t)&&(console.warn("Everfund: url's are deprecated please use a code instead"),t=new URL(t).pathname.replace("/","")),a.donationWidgetOpen=!0,a.modal({code:t,onSuccess:()=>{},onFailure:()=>{},onClose:()=>{(0,l.clearAllBodyScrollLocks)()}})},!1)}setupIframeListeners(){window.addEventListener("message",function(e){let o=document.querySelector(".embedContainer");switch(e.data.message){case"everfund:ready":{let t=document.querySelector("#ldsRing"),r=document.querySelector(".embedModal");t==null||t.remove(),r.style.transform="opacity(1)";break}case"everfund:success":{let t=e.data.content;a.onSuccess&&a.onSuccess(t);break}case"everfund:failure":{a.onFailure&&a.onFailure(e.data.content);break}case"everfund:close":{o&&(0,l.enableBodyScroll)(o),o&&o.remove(),a.donationWidgetOpen=!1,a.onClose&&a.onClose(),(0,l.clearAllBodyScrollLocks)();break}}},!1)}},a=new y;var D=a;0&&(module.exports={checkoutModal});
//# sourceMappingURL=js-sdk.js.map
{
"name": "@everfund/js-sdk",
"version": "3.0.1",
"version": "3.0.2",
"description": "Plug and Play Donation System",

@@ -18,3 +18,4 @@ "author": "Christopher Burns <christopher@everfund.co.uk>",

"scripts": {
"build": "tsup --config ./tsup.config.json --dts",
"build:sdks": "tsup --config ./tsup.config.json",
"dev": "tsup --config ./tsup.config.json --watch",
"lint": "eslint \"**/*.ts\"",

@@ -21,0 +22,0 @@ "test": "vitest"

@@ -62,2 +62,3 @@ import {

})}`;
modalFrame.allow = 'payment';

@@ -64,0 +65,0 @@ // deperciated

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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