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

@moneyhash/js-sdk

Package Overview
Dependencies
Maintainers
0
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@moneyhash/js-sdk - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

dist/warnIf-5a113081.cjs

2

dist/headless.cjs.js

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

"use strict";var le=Object.defineProperty,pe=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var N=(o,e,t)=>e in o?le(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,E=(o,e)=>{for(var t in e||(e={}))he.call(e,t)&&N(o,t,e[t]);if(X)for(var t of X(e))me.call(e,t)&&N(o,t,e[t]);return o},Z=(o,e)=>pe(o,ue(e));var f=(o,e,t)=>(N(o,typeof e!="symbol"?e+"":e,t),t),ge=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var k=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)};var y=(o,e,t)=>(ge(o,e,"access private method"),t);var g=(o,e,t)=>new Promise((s,r)=>{var n=a=>{try{i(t.next(a))}catch(d){r(d)}},l=a=>{try{i(t.throw(a))}catch(d){r(d)}},i=a=>a.done?s(a.value):Promise.resolve(a.value).then(n,l);i((t=t.apply(o,e)).next())});const u=require("./warnIf-c28a6074.cjs");function fe(){return typeof window!="undefined"}const b=class{constructor(){fe()&&this.initSDKCommunicationIframe()}initSDKCommunicationIframe(){if(document.getElementById("moneyhash-headless-sdk"))return;const e=u.getIframeUrl(),t=new URL(`${e}/embed/headless-sdk`);t.searchParams.set("sdk","true"),t.searchParams.set("parent",window.location.origin),t.searchParams.set("version","js@1.6.0");const s=document.createElement("iframe");s.id="moneyhash-headless-sdk",s.src=t.toString(),s.hidden=!0,document.body.appendChild(s),b.messagingService=new u.MessagingService({target:s.contentWindow,targetOrigin:e}),b.isCommunicationReady=new Promise(r=>{var l;const n=i=>{var a;i.data.type==="headlessSDK:init"&&(r(),(a=b.messagingService)==null||a.removeListener(n))};(l=b.messagingService)==null||l.onReceive(n)})}request(s){return g(this,arguments,function*({api:e,payload:t}){return yield b.isCommunicationReady,new Promise((r,n)=>{var i,a;(i=b.messagingService)==null||i.send({type:e,data:t});const l=d=>{var m;const{type:c,data:p}=d.data;c===e&&(p.status==="resolved"?r(p.payload):n(p.payload),(m=b.messagingService)==null||m.removeListener(l))};(a=b.messagingService)==null||a.onReceive(l)})})}postMessage(e){var t;(t=b.messagingService)==null||t.send({type:e})}};let S=b;f(S,"messagingService",null),f(S,"isCommunicationReady");class ee{constructor(){f(this,"promise");f(this,"resolve");f(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function ye(){var e;return(e=window.MONEYHASH_VAULT_API_URL)!=null?e:"https://vault.moneyhash.io"}function I(){var e;return(e=window.MONEYHASH_VAULT_INPUT_IFRAME_URL)!=null?e:"https://vault-form.moneyhash.io"}function te(){var e;return(e=window.API_URL)!=null?e:"https://web.moneyhash.io"}function we(o){const e=["cardNumber","cardCvv","cardExpiryMonth","cardExpiryYear"];for(const t of e)if(!o.includes(t))return t;return null}function be(o){return(Array.isArray(o)?o.length:Object.keys(o).length)===0}function ve(o,e){return new Promise((t,s)=>{if(document.getElementById(e)){t(void 0);return}const n=document.createElement("script");n.src=o,n.id=e,n.addEventListener("load",()=>{t(void 0)}),n.addEventListener("error",()=>{s(new Error("Script failed to load"))}),document.body.appendChild(n)})}function ke(o){return new Promise(e=>{setTimeout(()=>{e("done")},o*1e3)})}const re=new Set(["method","customerBalance","savedCard"]);var L,D,U,ae,R,ne,M,se,C,W,$,ie,_,oe,F,de,q,ce;class Ee{constructor(e){k(this,L);k(this,U);k(this,R);k(this,M);k(this,C);k(this,$);k(this,_);k(this,F);k(this,q);f(this,"options");f(this,"sdkApiHandler",new S);f(this,"sdkEmbed");f(this,"vaultSubmitListener",{current:null});f(this,"mountedCardElements",[]);f(this,"cardForm",{collect:()=>g(this,null,function*(){u.throwIf(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to collect card!");const e=yield this.sdkApiHandler.request({api:"sdk:generateAccessToken",payload:{publicApiKey:this.options.publicApiKey}});return y(this,L,D).call(this,{accessToken:e})}),pay:l=>g(this,[l],function*({intentId:e,cardData:t,saveCard:s,billingData:r,shippingData:n}){return this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",billingData:r,shippingData:n,cardEmbed:t,saveCard:s}})}),createCardToken:s=>g(this,[s],function*({cardIntentId:e,cardData:t}){return this.sdkApiHandler.request({api:"sdk:createCardToken",payload:{cardIntentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",cardEmbed:t}})})});this.options=e,this.sdkEmbed=new u.SDKEmbed(Z(E({},e),{headless:!0})),y(this,_,oe).call(this,this.vaultSubmitListener)}getIntentDetails(e){return this.sdkApiHandler.request({api:"sdk:getIntentDetails",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getIntentMethods(e){return this.sdkApiHandler.request({api:"sdk:getIntentMethods",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getMethods(e){return"intentId"in e?this.getIntentMethods(e.intentId):(u.throwIf(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to get methods!"),u.throwIf(this.options.type==="payout","getMethods is not allowed for payout!"),this.sdkApiHandler.request({api:"sdk:getMethods",payload:E({intentType:this.options.type,lang:this.sdkEmbed.lang,publicApiKey:this.options.publicApiKey},e)}))}proceedWith({intentId:e,type:t,id:s,metaData:r}){return u.throwIf(!re.has(t),`type must be a valid one (${[...re].join(" | ")})`),this.sdkApiHandler.request({api:"sdk:proceedWith",payload:{proceedWith:t,intentType:this.options.type,intentId:e,id:s,lang:this.sdkEmbed.lang,metaData:r}})}resetSelectedMethod(e){return this.sdkApiHandler.request({api:"sdk:resetSelectedMethod",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}deleteCard({cardId:e,intentSecret:t}){return u.throwIf(this.options.type==="payout","deleteCard is allowed only for payment intent!"),this.sdkApiHandler.request({api:"sdk:deleteCard",payload:{cardId:e,intentSecret:t,lang:this.sdkEmbed.lang}})}payWithApplePay(d){return g(this,arguments,function*({intentId:e,currency:t,amount:s,countryCode:r,onCancel:n=()=>{},onError:l,onComplete:i,billingData:a={}}){if(yield ve("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js","moneyHash-apple-pay-sdk"),!ApplePaySession)return;const c=new ApplePaySession(3,{countryCode:r,currencyCode:t,supportedNetworks:["visa","masterCard","amex","discover","mada"],merchantCapabilities:["supports3DS"],total:{label:"Apple Pay",type:"final",amount:`${s}`}}),{state:p,intent:m}=yield this.proceedWith({intentId:e,type:"method",id:"APPLE_PAY"});try{if(p==="INTENT_FORM"){if(be(a))throw new Error("Billing data is missing while calling payWithApplePay");yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:"APPLE_PAY",lang:this.sdkEmbed.lang,billingData:a}})}}catch(w){throw yield this.resetSelectedMethod(e),w}c.onvalidatemerchant=w=>{fetch(`${te()}/api/v1/providers/applepay/session/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:m.secret,validation_url:w.validationURL})}).then(v=>v.ok?v.json():Promise.reject()).then(v=>c.completeMerchantValidation(v)).catch(l)},c.onpaymentauthorized=w=>{fetch(`${te()}/api/v1/providers/applepay/token/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({token_data:{token:w.payment.token},secret:m.secret})}).then(v=>v.ok?v.json():Promise.reject()).then(()=>{c.completePayment(ApplePaySession.STATUS_SUCCESS),i()}).catch(()=>{c.completePayment(ApplePaySession.STATUS_FAILURE),l()})},c.oncancel=n,c.begin()})}renderForm({selector:e,intentId:t}){return u.throwIf(!e,"selector is required for renderForm"),u.throwIf(!t,"intentId is required for renderForm"),this.sdkEmbed.render({selector:e,intentId:t})}setLocale(e){u.warnIf(!!e&&!u.supportedLanguages.has(e),`Invalid locale. Supported languages (${[...u.supportedLanguages].join(" | ")})`);const t=u.supportedLanguages.has(e)?e:"en";return this.sdkEmbed.setLocale(t)}removeEventListeners(){return this.sdkEmbed.abortService()}updateIntentDiscount({intentId:e,discount:t}){return u.throwIf(!t.title.en,"English discount title is required!"),this.sdkApiHandler.request({api:"sdk:updateIntentDiscount",payload:{intentId:e,discount:t,lang:this.sdkEmbed.lang}})}updateIntentFees({intentId:e,fees:t}){return t.forEach(s=>{u.throwIf(!s.title.en,"English fee title is required!")}),this.sdkApiHandler.request({api:"sdk:updateIntentFees",payload:{intentId:e,fees:t,lang:this.sdkEmbed.lang}})}elements({styles:e,classes:t,fontSourceCss:s}){const r=[],n={},l=new Map;let i=!1;return y(this,$,ie).call(this,r),{create:({elementType:a,elementOptions:d})=>{var j,T;const c=new Map;let p=null;const m=E(E({},t),d.classes),w=((j=m==null?void 0:m.focus)==null?void 0:j.split(" "))||["MoneyHashElement--focus"],v=((T=m==null?void 0:m.error)==null?void 0:T.split(" "))||["MoneyHashElement--error"];return{mount:()=>{const h=document.querySelector(d.selector);u.throwIf(!h,`Couldn't find an element with selector ${d.selector}!`),h.classList.add("MoneyHashElement"),r.push(H=>{var x,K,B,Y,O,z,J,G,Q;const{type:P,data:A}=H.data;if(P===`${a}@mount`&&(n[a]=A.isValid,(x=c.get(`${a}@mount`))==null||x()),P===`${a}@focus`){h.classList.add(...w),(K=c.get(`${a}@focus`))==null||K();return}if(P===`${a}@blur`){h.classList.remove(...w),(B=c.get(`${a}@blur`))==null||B();return}if(P===`${a}@error`){A.isValid?h.classList.remove(...v):h.classList.add(...v),(Y=c.get(`${a}@error`))==null||Y(A);return}if(P===`${a}@changeInput`){if((O=c.get(`${a}@changeInput`))==null||O({isValid:A.isValid,length:A.length}),n[a]=A.isValid,l.get("validityChange")){const V=Object.values(n).every(Boolean);V!==i&&((z=l.get("validityChange"))==null||z(V),i=V)}return}if(P===`${a}@cardNumberChange`){(J=c.get(`${a}@cardNumberChange`))==null||J(A);return}if(P===`${a}@key:Backspace`){(G=c.get(`${a}@key:Backspace`))==null||G();return}P===`${a}@key:Enter`&&((Q=c.get(`${a}@key:Enter`))==null||Q())}),p=y(this,F,de).call(this,{container:h,elementType:a,elementOptions:d,styles:E(E({},e),d.styles),fontSourceCss:s}),this.mountedCardElements.push(a)},on:(h,H)=>{c.set(`${a}@${h}`,H)},off:h=>c.delete(`${a}@${h}`),focus:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"focus"},I())},blur:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"blur"},I())},clear:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"clear"},I())}}},on:(a,d)=>{l.set(a,d)}}}submitForm(i){return g(this,arguments,function*({intentId:e,accessToken:t,billingData:s,shippingData:r,saveCard:n,paymentMethod:l="CARD"}){const a=we(this.mountedCardElements);u.throwIf(!!a,`You must mount ${a} element!`);let d;return t&&(d=yield y(this,L,D).call(this,{accessToken:t})),yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:l,lang:this.sdkEmbed.lang,billingData:s,shippingData:r,cardEmbed:d,saveCard:n}})})}submitCvv(s){return g(this,arguments,function*({intentId:e,cvv:t}){return this.sdkApiHandler.request({api:"sdk:submitCardCvv",payload:{intentId:e,cvv:t,lang:this.sdkEmbed.lang}})})}renderUrl(n){return g(this,arguments,function*({intentId:e,url:t,renderStrategy:s,options:r}){switch(this.sdkApiHandler.postMessage("SDKRenderUrl"),s){case"IFRAME":return y(this,U,ae).call(this,{url:t,intentId:e});case"POPUP_IFRAME":return y(this,R,ne).call(this,{url:t,intentId:e,options:r});case"REDIRECT":return y(this,M,se).call(this,{url:t,options:r});default:return null}})}onExpiration(e,t){if(!e)return()=>{};const s=new Date(e),r=setInterval(()=>g(this,null,function*(){const n=new Date;s<n&&(clearInterval(r),t())}),1e3);return()=>clearInterval(r)}}L=new WeakSet,D=function(t){return g(this,arguments,function*({accessToken:e}){const s=new ee;this.vaultSubmitListener.current=l=>{const{type:i,data:a}=l.data;i==="vaultSubmit:success"&&s.resolve(a),i==="vaultSubmit:error"&&s.reject(a)};const r=y(this,q,ce).call(this,{accessToken:e}),n=yield s.promise;return r.remove(),n})},U=new WeakSet,ae=function(s){return g(this,arguments,function*({intentId:e,url:t}){const r=document.querySelector("#rendered-url-iframe-container");u.throwIf(!r,"Couldn't find an element with id rendered-url-iframe-container to render the iframe!");const n=document.createElement("iframe");n.src=t,n.style.setProperty("border","0","important"),n.style.setProperty("width","100%","important"),n.style.setProperty("height","100%","important"),r==null||r.replaceChildren(n),yield y(this,C,W).call(this,{intentId:e}),n.remove()})},R=new WeakSet,ne=function(r){return g(this,arguments,function*({intentId:e,url:t,options:s={}}){const{width:n=600,height:l=400,left:i=200,top:a=200}=s.window||{},d=window.open(t,"",`width=${n},height=${l},left=${i},top=${a}`);u.throwIf(!d,"Popup blocked by browser!"),yield y(this,C,W).call(this,{intentId:e,isUsingPopUp:!0}),d==null||d.close()})},M=new WeakSet,se=function(s){return g(this,arguments,function*({url:e,options:t}){if(!t||!t.redirectToNewWindow){window.location.href=e;return}window.open(e,"_blank")})},C=new WeakSet,W=function(s){return g(this,arguments,function*({intentId:e,isUsingPopUp:t=!1}){const r=new ee,n=l=>g(this,null,function*(){var a,d,c,p;if(l.origin!==u.getIframeUrl())return;const{type:i}=l.data;if(i==="intentResult"){t&&this.sdkApiHandler.postMessage("EmbedResultClose");const[m]=yield Promise.all([this.getIntentDetails(e),ke(2)]),w=m.transaction.status.split(".")[1];w==="successful"||w.startsWith("pending")?(d=(a=this.options).onComplete)==null||d.call(a,E({type:this.options.type},m)):(p=(c=this.options).onFail)==null||p.call(c,E({type:this.options.type},m)),r.resolve(()=>null),window.removeEventListener("message",n)}});return window.addEventListener("message",n),r.promise})},$=new WeakSet,ie=function(e){const t=s=>{s.origin===I()&&e.forEach(r=>{r(s)})};window.addEventListener("message",t)},_=new WeakSet,oe=function(e){const t=s=>{e.current&&e.current(s)};window.addEventListener("message",t)},F=new WeakSet,de=function({container:e,elementType:t,elementOptions:s,styles:r,fontSourceCss:n}){var d,c,p,m;const l=I(),i=new URL(`${l}/vaultField/vaultField.html`);n&&i.searchParams.set("fontSourceCss",n),i.searchParams.set("host",btoa(window.location.origin)),i.searchParams.set("type",t),((d=s.validation)==null?void 0:d.required)!==void 0&&i.searchParams.set("required",`${(c=s.validation)==null?void 0:c.required}`),i.searchParams.set("placeholder",(p=s.placeholder)!=null?p:""),i.searchParams.set("lang",this.sdkEmbed.lang),i.searchParams.set("direction",(r==null?void 0:r.direction)||""),i.searchParams.set("color",JSON.stringify(r!=null&&r.color?r.color:"#000")),i.searchParams.set("placeholderColor",(r==null?void 0:r.placeholderColor)||"#ccc"),i.searchParams.set("backgroundColor",(r==null?void 0:r.backgroundColor)||"transparent"),i.searchParams.set("fontSize",(r==null?void 0:r.fontSize)||""),i.searchParams.set("fontFamily",(r==null?void 0:r.fontFamily)||""),i.searchParams.set("fontWeight",`${r==null?void 0:r.fontWeight}`),i.searchParams.set("fontStyle",(r==null?void 0:r.fontStyle)||""),i.searchParams.set("padding",(r==null?void 0:r.padding)||"");const a=document.createElement("iframe");return a.src=i.toString(),a.style.height=(m=r==null?void 0:r.height)!=null?m:"40px",a.style.setProperty("overflow","hidden","important"),a.style.setProperty("display","block","important"),a.style.setProperty("width","100%","important"),a.style.setProperty("maxWidth","100%","important"),a.style.setProperty("border","0","important"),a.style.setProperty("margin","0","important"),a.style.setProperty("padding","0","important"),a.style.setProperty("userSelect","none","important"),a.style.setProperty("colorScheme","light only","important"),e.replaceChildren(a),a},q=new WeakSet,ce=function({accessToken:e}){const t=I(),s=ye(),r=new URL(`${t}/vaultSubmit/vaultSubmit.html`);r.searchParams.set("host",btoa(window.location.origin)),r.searchParams.set("vault_api_url",`${s}/api/v1/tokens/`),r.searchParams.set("access_token",e),r.searchParams.set("lang",this.sdkEmbed.lang);const n=document.createElement("iframe");return n.id="moneyhash-submit-iframe",n.src=r.toString(),n.hidden=!0,document.body.appendChild(n),n};module.exports=Ee;
"use strict";var pe=Object.defineProperty,ue=Object.defineProperties;var he=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var N=(o,e,t)=>e in o?pe(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,E=(o,e)=>{for(var t in e||(e={}))me.call(e,t)&&N(o,t,e[t]);if(X)for(var t of X(e))ge.call(e,t)&&N(o,t,e[t]);return o},Z=(o,e)=>ue(o,he(e));var f=(o,e,t)=>(N(o,typeof e!="symbol"?e+"":e,t),t),fe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var k=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)};var y=(o,e,t)=>(fe(o,e,"access private method"),t);var g=(o,e,t)=>new Promise((s,r)=>{var a=n=>{try{i(t.next(n))}catch(l){r(l)}},c=n=>{try{i(t.throw(n))}catch(l){r(l)}},i=n=>n.done?s(n.value):Promise.resolve(n.value).then(a,c);i((t=t.apply(o,e)).next())});const u=require("./warnIf-5a113081.cjs");function ye(){return typeof window!="undefined"}const b=class{constructor(){ye()&&this.initSDKCommunicationIframe()}initSDKCommunicationIframe(){if(document.getElementById("moneyhash-headless-sdk"))return;const e=u.getIframeUrl(),t=new URL(`${e}/embed/headless-sdk`);t.searchParams.set("sdk","true"),t.searchParams.set("parent",window.location.origin),t.searchParams.set("version","js@1.6.1");const s=document.createElement("iframe");s.id="moneyhash-headless-sdk",s.src=t.toString(),s.hidden=!0,document.body.appendChild(s),b.messagingService=new u.MessagingService({target:s.contentWindow,targetOrigin:e}),b.isCommunicationReady=new Promise(r=>{var c;const a=i=>{var n;i.data.type==="headlessSDK:init"&&(r(),(n=b.messagingService)==null||n.removeListener(a))};(c=b.messagingService)==null||c.onReceive(a)})}request(s){return g(this,arguments,function*({api:e,payload:t}){return yield b.isCommunicationReady,new Promise((r,a)=>{var i,n;(i=b.messagingService)==null||i.send({type:e,data:t});const c=l=>{var m;const{type:d,data:p}=l.data;d===e&&(p.status==="resolved"?r(p.payload):a(p.payload),(m=b.messagingService)==null||m.removeListener(c))};(n=b.messagingService)==null||n.onReceive(c)})})}postMessage(e){var t;(t=b.messagingService)==null||t.send({type:e})}};let S=b;f(S,"messagingService",null),f(S,"isCommunicationReady");class ee{constructor(){f(this,"promise");f(this,"resolve");f(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function we(){var e;return(e=window.MONEYHASH_VAULT_API_URL)!=null?e:"https://vault.moneyhash.io"}function I(){var e;return(e=window.MONEYHASH_VAULT_INPUT_IFRAME_URL)!=null?e:"https://vault-form.moneyhash.io"}function te(){var e;return(e=window.API_URL)!=null?e:"https://web.moneyhash.io"}function re(o){const e=["cardNumber","cardCvv","cardExpiryMonth","cardExpiryYear"];for(const t of e)if(!o.includes(t))return t;return null}function be(o){return(Array.isArray(o)?o.length:Object.keys(o).length)===0}function ve(o,e){return new Promise((t,s)=>{if(document.getElementById(e)){t(void 0);return}const a=document.createElement("script");a.src=o,a.id=e,a.addEventListener("load",()=>{t(void 0)}),a.addEventListener("error",()=>{s(new Error("Script failed to load"))}),document.body.appendChild(a)})}function ke(o){return new Promise(e=>{setTimeout(()=>{e("done")},o*1e3)})}const ne=new Set(["method","customerBalance","savedCard"]);var L,D,U,ae,R,se,M,ie,C,W,$,oe,_,de,F,ce,q,le;class Ee{constructor(e){k(this,L);k(this,U);k(this,R);k(this,M);k(this,C);k(this,$);k(this,_);k(this,F);k(this,q);f(this,"options");f(this,"sdkApiHandler",new S);f(this,"sdkEmbed");f(this,"vaultSubmitListener",{current:null});f(this,"mountedCardElements",[]);f(this,"cardForm",{collect:()=>g(this,null,function*(){u.throwIf(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to collect card!");const e=re(this.mountedCardElements);u.throwIf(!!e,`You must mount ${e} element!`);const t=yield this.sdkApiHandler.request({api:"sdk:generateAccessToken",payload:{publicApiKey:this.options.publicApiKey}});return y(this,L,D).call(this,{accessToken:t})}),pay:c=>g(this,[c],function*({intentId:e,cardData:t,saveCard:s,billingData:r,shippingData:a}){return this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",billingData:r,shippingData:a,cardEmbed:t,saveCard:s}})}),createCardToken:s=>g(this,[s],function*({cardIntentId:e,cardData:t}){return this.sdkApiHandler.request({api:"sdk:createCardToken",payload:{cardIntentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",cardEmbed:t}})})});this.options=e,this.sdkEmbed=new u.SDKEmbed(Z(E({},e),{headless:!0})),y(this,_,de).call(this,this.vaultSubmitListener)}getIntentDetails(e){return this.sdkApiHandler.request({api:"sdk:getIntentDetails",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getIntentMethods(e){return this.sdkApiHandler.request({api:"sdk:getIntentMethods",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getMethods(e){return"intentId"in e?this.getIntentMethods(e.intentId):(u.throwIf(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to get methods!"),u.throwIf(this.options.type==="payout","getMethods is not allowed for payout!"),this.sdkApiHandler.request({api:"sdk:getMethods",payload:E({intentType:this.options.type,lang:this.sdkEmbed.lang,publicApiKey:this.options.publicApiKey},e)}))}proceedWith({intentId:e,type:t,id:s,metaData:r}){return u.throwIf(!ne.has(t),`type must be a valid one (${[...ne].join(" | ")})`),this.sdkApiHandler.request({api:"sdk:proceedWith",payload:{proceedWith:t,intentType:this.options.type,intentId:e,id:s,lang:this.sdkEmbed.lang,metaData:r}})}resetSelectedMethod(e){return this.sdkApiHandler.request({api:"sdk:resetSelectedMethod",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}deleteCard({cardId:e,intentSecret:t}){return u.throwIf(this.options.type==="payout","deleteCard is allowed only for payment intent!"),this.sdkApiHandler.request({api:"sdk:deleteCard",payload:{cardId:e,intentSecret:t,lang:this.sdkEmbed.lang}})}payWithApplePay(l){return g(this,arguments,function*({intentId:e,currency:t,amount:s,countryCode:r,onCancel:a=()=>{},onError:c,onComplete:i,billingData:n={}}){if(yield ve("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js","moneyHash-apple-pay-sdk"),!ApplePaySession)return;const d=new ApplePaySession(3,{countryCode:r,currencyCode:t,supportedNetworks:["visa","masterCard","amex","discover","mada"],merchantCapabilities:["supports3DS"],total:{label:"Apple Pay",type:"final",amount:`${s}`}}),{state:p,intent:m}=yield this.proceedWith({intentId:e,type:"method",id:"APPLE_PAY"});try{if(p==="INTENT_FORM"){if(be(n))throw new Error("Billing data is missing while calling payWithApplePay");yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:"APPLE_PAY",lang:this.sdkEmbed.lang,billingData:n}})}}catch(w){throw yield this.resetSelectedMethod(e),w}d.onvalidatemerchant=w=>{fetch(`${te()}/api/v1/providers/applepay/session/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:m.secret,validation_url:w.validationURL})}).then(v=>v.ok?v.json():Promise.reject()).then(v=>d.completeMerchantValidation(v)).catch(c)},d.onpaymentauthorized=w=>{fetch(`${te()}/api/v1/providers/applepay/token/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({token_data:{token:w.payment.token},secret:m.secret})}).then(v=>v.ok?v.json():Promise.reject()).then(()=>{d.completePayment(ApplePaySession.STATUS_SUCCESS),i()}).catch(()=>{d.completePayment(ApplePaySession.STATUS_FAILURE),c()})},d.oncancel=a,d.begin()})}renderForm({selector:e,intentId:t}){return u.throwIf(!e,"selector is required for renderForm"),u.throwIf(!t,"intentId is required for renderForm"),this.sdkEmbed.render({selector:e,intentId:t})}setLocale(e){u.warnIf(!!e&&!u.supportedLanguages.has(e),`Invalid locale. Supported languages (${[...u.supportedLanguages].join(" | ")})`);const t=u.supportedLanguages.has(e)?e:"en";return this.sdkEmbed.setLocale(t)}removeEventListeners(){return this.sdkEmbed.abortService()}updateIntentDiscount({intentId:e,discount:t}){return u.throwIf(!t.title.en,"English discount title is required!"),this.sdkApiHandler.request({api:"sdk:updateIntentDiscount",payload:{intentId:e,discount:t,lang:this.sdkEmbed.lang}})}updateIntentFees({intentId:e,fees:t}){return t.forEach(s=>{u.throwIf(!s.title.en,"English fee title is required!")}),this.sdkApiHandler.request({api:"sdk:updateIntentFees",payload:{intentId:e,fees:t,lang:this.sdkEmbed.lang}})}elements({styles:e,classes:t,fontSourceCss:s}){const r=[],a={},c=new Map;let i=!1;return y(this,$,oe).call(this,r),{create:({elementType:n,elementOptions:l})=>{var j,T;const d=new Map;let p=null;const m=E(E({},t),l.classes),w=((j=m==null?void 0:m.focus)==null?void 0:j.split(" "))||["MoneyHashElement--focus"],v=((T=m==null?void 0:m.error)==null?void 0:T.split(" "))||["MoneyHashElement--error"];return{mount:()=>{const h=document.querySelector(l.selector);u.throwIf(!h,`Couldn't find an element with selector ${l.selector}!`),h.classList.add("MoneyHashElement"),r.push(H=>{var x,K,B,Y,O,z,J,G,Q;const{type:P,data:A}=H.data;if(P===`${n}@mount`&&(a[n]=A.isValid,(x=d.get(`${n}@mount`))==null||x()),P===`${n}@focus`){h.classList.add(...w),(K=d.get(`${n}@focus`))==null||K();return}if(P===`${n}@blur`){h.classList.remove(...w),(B=d.get(`${n}@blur`))==null||B();return}if(P===`${n}@error`){A.isValid?h.classList.remove(...v):h.classList.add(...v),(Y=d.get(`${n}@error`))==null||Y(A);return}if(P===`${n}@changeInput`){if((O=d.get(`${n}@changeInput`))==null||O({isValid:A.isValid,length:A.length}),a[n]=A.isValid,c.get("validityChange")){const V=Object.values(a).every(Boolean);V!==i&&((z=c.get("validityChange"))==null||z(V),i=V)}return}if(P===`${n}@cardNumberChange`){(J=d.get(`${n}@cardNumberChange`))==null||J(A);return}if(P===`${n}@key:Backspace`){(G=d.get(`${n}@key:Backspace`))==null||G();return}P===`${n}@key:Enter`&&((Q=d.get(`${n}@key:Enter`))==null||Q())}),p=y(this,F,ce).call(this,{container:h,elementType:n,elementOptions:l,styles:E(E({},e),l.styles),fontSourceCss:s}),this.mountedCardElements.push(n)},on:(h,H)=>{d.set(`${n}@${h}`,H)},off:h=>d.delete(`${n}@${h}`),focus:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"focus"},I())},blur:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"blur"},I())},clear:()=>{var h;(h=p==null?void 0:p.contentWindow)==null||h.postMessage({type:"clear"},I())}}},on:(n,l)=>{c.set(n,l)}}}submitForm(i){return g(this,arguments,function*({intentId:e,accessToken:t,billingData:s,shippingData:r,saveCard:a,paymentMethod:c="CARD"}){let n;if(t){const d=re(this.mountedCardElements);u.throwIf(!!d,`You must mount ${d} element!`),n=yield y(this,L,D).call(this,{accessToken:t})}return yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:c,lang:this.sdkEmbed.lang,billingData:s,shippingData:r,cardEmbed:n,saveCard:a}})})}submitCvv(s){return g(this,arguments,function*({intentId:e,cvv:t}){return this.sdkApiHandler.request({api:"sdk:submitCardCvv",payload:{intentId:e,cvv:t,lang:this.sdkEmbed.lang}})})}renderUrl(a){return g(this,arguments,function*({intentId:e,url:t,renderStrategy:s,options:r}){switch(this.sdkApiHandler.postMessage("SDKRenderUrl"),s){case"IFRAME":return y(this,U,ae).call(this,{url:t,intentId:e});case"POPUP_IFRAME":return y(this,R,se).call(this,{url:t,intentId:e,options:r});case"REDIRECT":return y(this,M,ie).call(this,{url:t,options:r});default:return null}})}onExpiration(e,t){if(!e)return()=>{};const s=new Date(e),r=setInterval(()=>g(this,null,function*(){const a=new Date;s<a&&(clearInterval(r),t())}),1e3);return()=>clearInterval(r)}}L=new WeakSet,D=function(t){return g(this,arguments,function*({accessToken:e}){const s=new ee;this.vaultSubmitListener.current=c=>{const{type:i,data:n}=c.data;i==="vaultSubmit:success"&&s.resolve(n),i==="vaultSubmit:error"&&s.reject(n)};const r=y(this,q,le).call(this,{accessToken:e}),a=yield s.promise;return r.remove(),a})},U=new WeakSet,ae=function(s){return g(this,arguments,function*({intentId:e,url:t}){const r=document.querySelector("#rendered-url-iframe-container");u.throwIf(!r,"Couldn't find an element with id rendered-url-iframe-container to render the iframe!");const a=document.createElement("iframe");a.src=t,a.style.setProperty("border","0","important"),a.style.setProperty("width","100%","important"),a.style.setProperty("height","100%","important"),r==null||r.replaceChildren(a),yield y(this,C,W).call(this,{intentId:e}),a.remove()})},R=new WeakSet,se=function(r){return g(this,arguments,function*({intentId:e,url:t,options:s={}}){const{width:a=600,height:c=400,left:i=200,top:n=200}=s.window||{},l=window.open(t,"",`width=${a},height=${c},left=${i},top=${n}`);u.throwIf(!l,"Popup blocked by browser!"),yield y(this,C,W).call(this,{intentId:e,isUsingPopUp:!0}),l==null||l.close()})},M=new WeakSet,ie=function(s){return g(this,arguments,function*({url:e,options:t}){if(!t||!t.redirectToNewWindow){window.location.href=e;return}window.open(e,"_blank")})},C=new WeakSet,W=function(s){return g(this,arguments,function*({intentId:e,isUsingPopUp:t=!1}){const r=new ee,a=c=>g(this,null,function*(){var n,l,d,p;if(c.origin!==u.getIframeUrl())return;const{type:i}=c.data;if(i==="intentResult"){t&&this.sdkApiHandler.postMessage("EmbedResultClose");const[m]=yield Promise.all([this.getIntentDetails(e),ke(2)]),w=m.transaction.status.split(".")[1];w==="successful"||w.startsWith("pending")?(l=(n=this.options).onComplete)==null||l.call(n,E({type:this.options.type},m)):(p=(d=this.options).onFail)==null||p.call(d,E({type:this.options.type},m)),r.resolve(()=>null),window.removeEventListener("message",a)}});return window.addEventListener("message",a),r.promise})},$=new WeakSet,oe=function(e){const t=s=>{s.origin===I()&&e.forEach(r=>{r(s)})};window.addEventListener("message",t)},_=new WeakSet,de=function(e){const t=s=>{e.current&&e.current(s)};window.addEventListener("message",t)},F=new WeakSet,ce=function({container:e,elementType:t,elementOptions:s,styles:r,fontSourceCss:a}){var l,d,p,m;const c=I(),i=new URL(`${c}/vaultField/vaultField.html`);a&&i.searchParams.set("fontSourceCss",a),i.searchParams.set("host",btoa(window.location.origin)),i.searchParams.set("type",t),((l=s.validation)==null?void 0:l.required)!==void 0&&i.searchParams.set("required",`${(d=s.validation)==null?void 0:d.required}`),i.searchParams.set("placeholder",(p=s.placeholder)!=null?p:""),i.searchParams.set("lang",this.sdkEmbed.lang),i.searchParams.set("direction",(r==null?void 0:r.direction)||""),i.searchParams.set("color",JSON.stringify(r!=null&&r.color?r.color:"#000")),i.searchParams.set("placeholderColor",(r==null?void 0:r.placeholderColor)||"#ccc"),i.searchParams.set("backgroundColor",(r==null?void 0:r.backgroundColor)||"transparent"),i.searchParams.set("fontSize",(r==null?void 0:r.fontSize)||""),i.searchParams.set("fontFamily",(r==null?void 0:r.fontFamily)||""),i.searchParams.set("fontWeight",`${r==null?void 0:r.fontWeight}`),i.searchParams.set("fontStyle",(r==null?void 0:r.fontStyle)||""),i.searchParams.set("padding",(r==null?void 0:r.padding)||"");const n=document.createElement("iframe");return n.src=i.toString(),n.style.height=(m=r==null?void 0:r.height)!=null?m:"40px",n.style.setProperty("overflow","hidden","important"),n.style.setProperty("display","block","important"),n.style.setProperty("width","100%","important"),n.style.setProperty("maxWidth","100%","important"),n.style.setProperty("border","0","important"),n.style.setProperty("margin","0","important"),n.style.setProperty("padding","0","important"),n.style.setProperty("userSelect","none","important"),n.style.setProperty("colorScheme","light only","important"),e.replaceChildren(n),n},q=new WeakSet,le=function({accessToken:e}){const t=I(),s=we(),r=new URL(`${t}/vaultSubmit/vaultSubmit.html`);r.searchParams.set("host",btoa(window.location.origin)),r.searchParams.set("vault_api_url",`${s}/api/v1/tokens/`),r.searchParams.set("access_token",e),r.searchParams.set("lang",this.sdkEmbed.lang);const a=document.createElement("iframe");return a.id="moneyhash-submit-iframe",a.src=r.toString(),a.hidden=!0,document.body.appendChild(a),a};module.exports=Ee;

@@ -1,14 +0,14 @@

var ue = Object.defineProperty, he = Object.defineProperties;
var me = Object.getOwnPropertyDescriptors;
var he = Object.defineProperty, me = Object.defineProperties;
var ge = Object.getOwnPropertyDescriptors;
var Z = Object.getOwnPropertySymbols;
var ge = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
var N = (o, e, t) => e in o ? ue(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, E = (o, e) => {
var fe = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable;
var N = (o, e, t) => e in o ? he(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, E = (o, e) => {
for (var t in e || (e = {}))
ge.call(e, t) && N(o, t, e[t]);
fe.call(e, t) && N(o, t, e[t]);
if (Z)
for (var t of Z(e))
fe.call(e, t) && N(o, t, e[t]);
ye.call(e, t) && N(o, t, e[t]);
return o;
}, ee = (o, e) => he(o, me(e));
var f = (o, e, t) => (N(o, typeof e != "symbol" ? e + "" : e, t), t), ye = (o, e, t) => {
}, ee = (o, e) => me(o, ge(e));
var f = (o, e, t) => (N(o, typeof e != "symbol" ? e + "" : e, t), t), be = (o, e, t) => {
if (!e.has(o))

@@ -22,21 +22,21 @@ throw TypeError("Cannot " + t);

};
var y = (o, e, t) => (ye(o, e, "access private method"), t);
var y = (o, e, t) => (be(o, e, "access private method"), t);
var m = (o, e, t) => new Promise((s, a) => {
var n = (r) => {
var r = (n) => {
try {
i(t.next(r));
} catch (d) {
a(d);
i(t.next(n));
} catch (l) {
a(l);
}
}, l = (r) => {
}, c = (n) => {
try {
i(t.throw(r));
} catch (d) {
a(d);
i(t.throw(n));
} catch (l) {
a(l);
}
}, i = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, l);
}, i = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(r, c);
i((t = t.apply(o, e)).next());
});
import { M as be, g as ne, S as we, t as g, w as ve, s as D } from "./warnIf-5ce36408.js";
function ke() {
import { M as we, g as se, S as ve, t as g, w as ke, s as D } from "./warnIf-c94d7bcb.js";
function Ee() {
return typeof window != "undefined";

@@ -46,3 +46,3 @@ }

constructor() {
ke() && this.initSDKCommunicationIframe();
Ee() && this.initSDKCommunicationIframe();
}

@@ -52,15 +52,15 @@ initSDKCommunicationIframe() {

return;
const e = ne(), t = new URL(`${e}/embed/headless-sdk`);
t.searchParams.set("sdk", "true"), t.searchParams.set("parent", window.location.origin), t.searchParams.set("version", "js@1.6.0");
const e = se(), t = new URL(`${e}/embed/headless-sdk`);
t.searchParams.set("sdk", "true"), t.searchParams.set("parent", window.location.origin), t.searchParams.set("version", "js@1.6.1");
const s = document.createElement("iframe");
s.id = "moneyhash-headless-sdk", s.src = t.toString(), s.hidden = !0, document.body.appendChild(s), w.messagingService = new be({
s.id = "moneyhash-headless-sdk", s.src = t.toString(), s.hidden = !0, document.body.appendChild(s), w.messagingService = new we({
target: s.contentWindow,
targetOrigin: e
}), w.isCommunicationReady = new Promise((a) => {
var l;
const n = (i) => {
var r;
i.data.type === "headlessSDK:init" && (a(), (r = w.messagingService) == null || r.removeListener(n));
var c;
const r = (i) => {
var n;
i.data.type === "headlessSDK:init" && (a(), (n = w.messagingService) == null || n.removeListener(r));
};
(l = w.messagingService) == null || l.onReceive(n);
(c = w.messagingService) == null || c.onReceive(r);
});

@@ -73,4 +73,4 @@ }

}) {
return yield w.isCommunicationReady, new Promise((a, n) => {
var i, r;
return yield w.isCommunicationReady, new Promise((a, r) => {
var i, n;
(i = w.messagingService) == null || i.send({

@@ -80,8 +80,8 @@ type: e,

});
const l = (d) => {
const c = (l) => {
var h;
const { type: c, data: p } = d.data;
c === e && (p.status === "resolved" ? a(p.payload) : n(p.payload), (h = w.messagingService) == null || h.removeListener(l));
const { type: d, data: p } = l.data;
d === e && (p.status === "resolved" ? a(p.payload) : r(p.payload), (h = w.messagingService) == null || h.removeListener(c));
};
(r = w.messagingService) == null || r.onReceive(l);
(n = w.messagingService) == null || n.onReceive(c);
});

@@ -95,4 +95,4 @@ });

};
let L = w;
f(L, "messagingService", null), f(L, "isCommunicationReady");
let C = w;
f(C, "messagingService", null), f(C, "isCommunicationReady");
class te {

@@ -108,3 +108,3 @@ constructor() {

}
function Ee() {
function Pe() {
var e;

@@ -121,3 +121,3 @@ return (e = window.MONEYHASH_VAULT_API_URL) != null ? e : "https://vault.moneyhash.io";

}
function Pe(o) {
function ne(o) {
const e = [

@@ -143,11 +143,11 @@ "cardNumber",

}
const n = document.createElement("script");
n.src = o, n.id = e, n.addEventListener("load", () => {
const r = document.createElement("script");
r.src = o, r.id = e, r.addEventListener("load", () => {
t(void 0);
}), n.addEventListener("error", () => {
}), r.addEventListener("error", () => {
s(new Error("Script failed to load"));
}), document.body.appendChild(n);
}), document.body.appendChild(r);
});
}
function Le(o) {
function Ce(o) {
return new Promise((e) => {

@@ -164,6 +164,6 @@ setTimeout(() => {

]);
var C, W, U, se, R, ie, M, oe, I, j, $, de, _, ce, F, le, q, pe;
var L, W, U, ie, R, oe, M, de, I, j, $, ce, _, le, F, pe, q, ue;
class Re {
constructor(e) {
k(this, C);
k(this, L);
k(this, U);

@@ -178,3 +178,3 @@ k(this, R);

f(this, "options");
f(this, "sdkApiHandler", new L());
f(this, "sdkApiHandler", new C());
f(this, "sdkEmbed");

@@ -191,3 +191,10 @@ f(this, "vaultSubmitListener", {

);
const e = yield this.sdkApiHandler.request({
const e = ne(
this.mountedCardElements
);
g(
!!e,
`You must mount ${e} element!`
);
const t = yield this.sdkApiHandler.request({
api: "sdk:generateAccessToken",

@@ -198,5 +205,5 @@ payload: {

});
return y(this, C, W).call(this, { accessToken: e });
return y(this, L, W).call(this, { accessToken: t });
}),
pay: (l) => m(this, [l], function* ({
pay: (c) => m(this, [c], function* ({
intentId: e,

@@ -206,3 +213,3 @@ cardData: t,

billingData: a,
shippingData: n
shippingData: r
}) {

@@ -216,3 +223,3 @@ return this.sdkApiHandler.request({

billingData: a,
shippingData: n,
shippingData: r,
cardEmbed: t,

@@ -238,3 +245,3 @@ saveCard: s

});
this.options = e, this.sdkEmbed = new we(ee(E({}, e), { headless: !0 })), y(this, _, ce).call(this, this.vaultSubmitListener);
this.options = e, this.sdkEmbed = new ve(ee(E({}, e), { headless: !0 })), y(this, _, le).call(this, this.vaultSubmitListener);
}

@@ -459,3 +466,3 @@ /**

*/
payWithApplePay(d) {
payWithApplePay(l) {
return m(this, arguments, function* ({

@@ -466,7 +473,7 @@ intentId: e,

countryCode: a,
onCancel: n = () => {
onCancel: r = () => {
},
onError: l,
onError: c,
onComplete: i,
billingData: r = {}
billingData: n = {}
}) {

@@ -478,3 +485,3 @@ if (yield Se(

return;
const c = new ApplePaySession(3, {
const d = new ApplePaySession(3, {
countryCode: a,

@@ -496,3 +503,3 @@ currencyCode: t,

if (p === "INTENT_FORM") {
if (Ae(r))
if (Ae(n))
throw new Error(

@@ -507,3 +514,3 @@ "Billing data is missing while calling payWithApplePay"

lang: this.sdkEmbed.lang,
billingData: r
billingData: n
}

@@ -515,3 +522,3 @@ });

}
c.onvalidatemerchant = (b) => {
d.onvalidatemerchant = (b) => {
fetch(`${ae()}/api/v1/providers/applepay/session/`, {

@@ -527,5 +534,5 @@ method: "post",

}).then((v) => v.ok ? v.json() : Promise.reject()).then(
(v) => c.completeMerchantValidation(v)
).catch(l);
}, c.onpaymentauthorized = (b) => {
(v) => d.completeMerchantValidation(v)
).catch(c);
}, d.onpaymentauthorized = (b) => {
fetch(`${ae()}/api/v1/providers/applepay/token/`, {

@@ -543,7 +550,7 @@ method: "post",

}).then((v) => v.ok ? v.json() : Promise.reject()).then(() => {
c.completePayment(ApplePaySession.STATUS_SUCCESS), i();
d.completePayment(ApplePaySession.STATUS_SUCCESS), i();
}).catch(() => {
c.completePayment(ApplePaySession.STATUS_FAILURE), l();
d.completePayment(ApplePaySession.STATUS_FAILURE), c();
});
}, c.oncancel = n, c.begin();
}, d.oncancel = r, d.begin();
});

@@ -583,3 +590,3 @@ }

setLocale(e) {
ve(
ke(
!!e && !D.has(e),

@@ -668,5 +675,5 @@ `Invalid locale. Supported languages (${[...D].join(

elements({ styles: e, classes: t, fontSourceCss: s }) {
const a = [], n = {}, l = /* @__PURE__ */ new Map();
const a = [], r = {}, c = /* @__PURE__ */ new Map();
let i = !1;
return y(this, $, de).call(this, a), {
return y(this, $, ce).call(this, a), {
/**

@@ -693,7 +700,7 @@ * Creates card field element

*/
create: ({ elementType: r, elementOptions: d }) => {
create: ({ elementType: n, elementOptions: l }) => {
var T, x;
const c = /* @__PURE__ */ new Map();
const d = /* @__PURE__ */ new Map();
let p = null;
const h = E(E({}, t), d.classes), b = ((T = h == null ? void 0 : h.focus) == null ? void 0 : T.split(" ")) || [
const h = E(E({}, t), l.classes), b = ((T = h == null ? void 0 : h.focus) == null ? void 0 : T.split(" ")) || [
"MoneyHashElement--focus"

@@ -706,29 +713,29 @@ ], v = ((x = h == null ? void 0 : h.error) == null ? void 0 : x.split(" ")) || [

const u = document.querySelector(
d.selector
l.selector
);
g(
!u,
`Couldn't find an element with selector ${d.selector}!`
`Couldn't find an element with selector ${l.selector}!`
), u.classList.add("MoneyHashElement"), a.push((H) => {
var K, B, Y, O, z, J, G, Q, X;
const { type: P, data: A } = H.data;
if (P === `${r}@mount` && (n[r] = A.isValid, (K = c.get(`${r}@mount`)) == null || K()), P === `${r}@focus`) {
u.classList.add(...b), (B = c.get(`${r}@focus`)) == null || B();
if (P === `${n}@mount` && (r[n] = A.isValid, (K = d.get(`${n}@mount`)) == null || K()), P === `${n}@focus`) {
u.classList.add(...b), (B = d.get(`${n}@focus`)) == null || B();
return;
}
if (P === `${r}@blur`) {
u.classList.remove(...b), (Y = c.get(`${r}@blur`)) == null || Y();
if (P === `${n}@blur`) {
u.classList.remove(...b), (Y = d.get(`${n}@blur`)) == null || Y();
return;
}
if (P === `${r}@error`) {
A.isValid ? u.classList.remove(...v) : u.classList.add(...v), (O = c.get(`${r}@error`)) == null || O(A);
if (P === `${n}@error`) {
A.isValid ? u.classList.remove(...v) : u.classList.add(...v), (O = d.get(`${n}@error`)) == null || O(A);
return;
}
if (P === `${r}@changeInput`) {
if ((z = c.get(`${r}@changeInput`)) == null || z({
if (P === `${n}@changeInput`) {
if ((z = d.get(`${n}@changeInput`)) == null || z({
isValid: A.isValid,
length: A.length
}), n[r] = A.isValid, l.get("validityChange")) {
const V = Object.values(n).every(Boolean);
V !== i && ((J = l.get("validityChange")) == null || J(
}), r[n] = A.isValid, c.get("validityChange")) {
const V = Object.values(r).every(Boolean);
V !== i && ((J = c.get("validityChange")) == null || J(
V

@@ -739,4 +746,4 @@ ), i = V);

}
if (P === `${r}@cardNumberChange`) {
(G = c.get(`${r}@cardNumberChange`)) == null || G(
if (P === `${n}@cardNumberChange`) {
(G = d.get(`${n}@cardNumberChange`)) == null || G(
A

@@ -746,19 +753,19 @@ );

}
if (P === `${r}@key:Backspace`) {
(Q = c.get(`${r}@key:Backspace`)) == null || Q();
if (P === `${n}@key:Backspace`) {
(Q = d.get(`${n}@key:Backspace`)) == null || Q();
return;
}
P === `${r}@key:Enter` && ((X = c.get(`${r}@key:Enter`)) == null || X());
}), p = y(this, F, le).call(this, {
P === `${n}@key:Enter` && ((X = d.get(`${n}@key:Enter`)) == null || X());
}), p = y(this, F, pe).call(this, {
container: u,
elementType: r,
elementOptions: d,
styles: E(E({}, e), d.styles),
elementType: n,
elementOptions: l,
styles: E(E({}, e), l.styles),
fontSourceCss: s
}), this.mountedCardElements.push(r);
}), this.mountedCardElements.push(n);
},
on: (u, H) => {
c.set(`${r}@${u}`, H);
d.set(`${n}@${u}`, H);
},
off: (u) => c.delete(`${r}@${u}`),
off: (u) => d.delete(`${n}@${u}`),
focus: () => {

@@ -787,4 +794,4 @@ var u;

},
on: (r, d) => {
l.set(r, d);
on: (n, l) => {
c.set(n, l);
}

@@ -813,23 +820,27 @@ };

shippingData: a,
saveCard: n,
paymentMethod: l = "CARD"
saveCard: r,
paymentMethod: c = "CARD"
}) {
const r = Pe(this.mountedCardElements);
g(
!!r,
`You must mount ${r} element!`
);
let d;
return t && (d = yield y(this, C, W).call(this, {
accessToken: t
})), yield this.sdkApiHandler.request({
let n;
if (t) {
const d = ne(
this.mountedCardElements
);
g(
!!d,
`You must mount ${d} element!`
), n = yield y(this, L, W).call(this, {
accessToken: t
});
}
return yield this.sdkApiHandler.request({
api: "sdk:submitNativeForm",
payload: {
intentId: e,
paymentMethod: l,
paymentMethod: c,
lang: this.sdkEmbed.lang,
billingData: s,
shippingData: a,
cardEmbed: d,
saveCard: n
cardEmbed: n,
saveCard: r
}

@@ -873,3 +884,3 @@ });

*/
renderUrl(n) {
renderUrl(r) {
return m(this, arguments, function* ({

@@ -883,7 +894,7 @@ intentId: e,

case "IFRAME":
return y(this, U, se).call(this, { url: t, intentId: e });
return y(this, U, ie).call(this, { url: t, intentId: e });
case "POPUP_IFRAME":
return y(this, R, ie).call(this, { url: t, intentId: e, options: a });
return y(this, R, oe).call(this, { url: t, intentId: e, options: a });
case "REDIRECT":
return y(this, M, oe).call(this, { url: t, options: a });
return y(this, M, de).call(this, { url: t, options: a });
default:

@@ -910,4 +921,4 @@ return null;

const s = new Date(e), a = setInterval(() => m(this, null, function* () {
const n = new Date();
s < n && (clearInterval(a), t());
const r = new Date();
s < r && (clearInterval(a), t());
}), 1e3);

@@ -917,15 +928,15 @@ return () => clearInterval(a);

}
C = new WeakSet(), W = function(t) {
L = new WeakSet(), W = function(t) {
return m(this, arguments, function* ({ accessToken: e }) {
const s = new te();
this.vaultSubmitListener.current = (l) => {
const { type: i, data: r } = l.data;
i === "vaultSubmit:success" && s.resolve(r), i === "vaultSubmit:error" && s.reject(r);
this.vaultSubmitListener.current = (c) => {
const { type: i, data: n } = c.data;
i === "vaultSubmit:success" && s.resolve(n), i === "vaultSubmit:error" && s.reject(n);
};
const a = y(this, q, pe).call(this, {
const a = y(this, q, ue).call(this, {
accessToken: e
}), n = yield s.promise;
return a.remove(), n;
}), r = yield s.promise;
return a.remove(), r;
});
}, U = new WeakSet(), se = function(s) {
}, U = new WeakSet(), ie = function(s) {
return m(this, arguments, function* ({

@@ -940,6 +951,6 @@ intentId: e,

);
const n = document.createElement("iframe");
n.src = t, n.style.setProperty("border", "0", "important"), n.style.setProperty("width", "100%", "important"), n.style.setProperty("height", "100%", "important"), a == null || a.replaceChildren(n), yield y(this, I, j).call(this, { intentId: e }), n.remove();
const r = document.createElement("iframe");
r.src = t, r.style.setProperty("border", "0", "important"), r.style.setProperty("width", "100%", "important"), r.style.setProperty("height", "100%", "important"), a == null || a.replaceChildren(r), yield y(this, I, j).call(this, { intentId: e }), r.remove();
});
}, R = new WeakSet(), ie = function(a) {
}, R = new WeakSet(), oe = function(a) {
return m(this, arguments, function* ({

@@ -951,14 +962,14 @@ intentId: e,

const {
width: n = 600,
height: l = 400,
width: r = 600,
height: c = 400,
left: i = 200,
top: r = 200
} = s.window || {}, d = window.open(
top: n = 200
} = s.window || {}, l = window.open(
t,
"",
`width=${n},height=${l},left=${i},top=${r}`
`width=${r},height=${c},left=${i},top=${n}`
);
g(!d, "Popup blocked by browser!"), yield y(this, I, j).call(this, { intentId: e, isUsingPopUp: !0 }), d == null || d.close();
g(!l, "Popup blocked by browser!"), yield y(this, I, j).call(this, { intentId: e, isUsingPopUp: !0 }), l == null || l.close();
});
}, M = new WeakSet(), oe = function(s) {
}, M = new WeakSet(), de = function(s) {
return m(this, arguments, function* ({

@@ -979,7 +990,7 @@ url: e,

}) {
const a = new te(), n = (l) => m(this, null, function* () {
var r, d, c, p;
if (l.origin !== ne())
const a = new te(), r = (c) => m(this, null, function* () {
var n, l, d, p;
if (c.origin !== se())
return;
const { type: i } = l.data;
const { type: i } = c.data;
if (i === "intentResult") {

@@ -989,14 +1000,14 @@ t && this.sdkApiHandler.postMessage("EmbedResultClose");

this.getIntentDetails(e),
Le(2)
Ce(2)
]), b = h.transaction.status.split(".")[1];
b === "successful" || b.startsWith("pending") ? (d = (r = this.options).onComplete) == null || d.call(r, E({
b === "successful" || b.startsWith("pending") ? (l = (n = this.options).onComplete) == null || l.call(n, E({
type: this.options.type
}, h)) : (p = (c = this.options).onFail) == null || p.call(c, E({
}, h)) : (p = (d = this.options).onFail) == null || p.call(d, E({
type: this.options.type
}, h)), a.resolve(() => null), window.removeEventListener("message", n);
}, h)), a.resolve(() => null), window.removeEventListener("message", r);
}
});
return window.addEventListener("message", n), a.promise;
return window.addEventListener("message", r), a.promise;
});
}, $ = new WeakSet(), de = function(e) {
}, $ = new WeakSet(), ce = function(e) {
const t = (s) => {

@@ -1008,3 +1019,3 @@ s.origin === S() && e.forEach((a) => {

window.addEventListener("message", t);
}, _ = new WeakSet(), ce = function(e) {
}, _ = new WeakSet(), le = function(e) {
const t = (s) => {

@@ -1014,3 +1025,3 @@ e.current && e.current(s);

window.addEventListener("message", t);
}, F = new WeakSet(), le = function({
}, F = new WeakSet(), pe = function({
container: e,

@@ -1020,9 +1031,9 @@ elementType: t,

styles: a,
fontSourceCss: n
fontSourceCss: r
}) {
var d, c, p, h;
const l = S(), i = new URL(`${l}/vaultField/vaultField.html`);
n && i.searchParams.set("fontSourceCss", n), i.searchParams.set("host", btoa(window.location.origin)), i.searchParams.set("type", t), ((d = s.validation) == null ? void 0 : d.required) !== void 0 && i.searchParams.set(
var l, d, p, h;
const c = S(), i = new URL(`${c}/vaultField/vaultField.html`);
r && i.searchParams.set("fontSourceCss", r), i.searchParams.set("host", btoa(window.location.origin)), i.searchParams.set("type", t), ((l = s.validation) == null ? void 0 : l.required) !== void 0 && i.searchParams.set(
"required",
`${(c = s.validation) == null ? void 0 : c.required}`
`${(d = s.validation) == null ? void 0 : d.required}`
), i.searchParams.set("placeholder", (p = s.placeholder) != null ? p : ""), i.searchParams.set("lang", this.sdkEmbed.lang), i.searchParams.set("direction", (a == null ? void 0 : a.direction) || ""), i.searchParams.set(

@@ -1038,11 +1049,11 @@ "color",

), i.searchParams.set("fontSize", (a == null ? void 0 : a.fontSize) || ""), i.searchParams.set("fontFamily", (a == null ? void 0 : a.fontFamily) || ""), i.searchParams.set("fontWeight", `${a == null ? void 0 : a.fontWeight}`), i.searchParams.set("fontStyle", (a == null ? void 0 : a.fontStyle) || ""), i.searchParams.set("padding", (a == null ? void 0 : a.padding) || "");
const r = document.createElement("iframe");
return r.src = i.toString(), r.style.height = (h = a == null ? void 0 : a.height) != null ? h : "40px", r.style.setProperty("overflow", "hidden", "important"), r.style.setProperty("display", "block", "important"), r.style.setProperty("width", "100%", "important"), r.style.setProperty("maxWidth", "100%", "important"), r.style.setProperty("border", "0", "important"), r.style.setProperty("margin", "0", "important"), r.style.setProperty("padding", "0", "important"), r.style.setProperty("userSelect", "none", "important"), r.style.setProperty("colorScheme", "light only", "important"), e.replaceChildren(r), r;
}, q = new WeakSet(), pe = function({ accessToken: e }) {
const t = S(), s = Ee(), a = new URL(
const n = document.createElement("iframe");
return n.src = i.toString(), n.style.height = (h = a == null ? void 0 : a.height) != null ? h : "40px", n.style.setProperty("overflow", "hidden", "important"), n.style.setProperty("display", "block", "important"), n.style.setProperty("width", "100%", "important"), n.style.setProperty("maxWidth", "100%", "important"), n.style.setProperty("border", "0", "important"), n.style.setProperty("margin", "0", "important"), n.style.setProperty("padding", "0", "important"), n.style.setProperty("userSelect", "none", "important"), n.style.setProperty("colorScheme", "light only", "important"), e.replaceChildren(n), n;
}, q = new WeakSet(), ue = function({ accessToken: e }) {
const t = S(), s = Pe(), a = new URL(
`${t}/vaultSubmit/vaultSubmit.html`
);
a.searchParams.set("host", btoa(window.location.origin)), a.searchParams.set("vault_api_url", `${s}/api/v1/tokens/`), a.searchParams.set("access_token", e), a.searchParams.set("lang", this.sdkEmbed.lang);
const n = document.createElement("iframe");
return n.id = "moneyhash-submit-iframe", n.src = a.toString(), n.hidden = !0, document.body.appendChild(n), n;
const r = document.createElement("iframe");
return r.id = "moneyhash-submit-iframe", r.src = a.toString(), r.hidden = !0, document.body.appendChild(r), r;
};

@@ -1049,0 +1060,0 @@ export {

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

(function(c,o){typeof exports=="object"&&typeof module!="undefined"?module.exports=o():typeof define=="function"&&define.amd?define(o):(c=typeof globalThis!="undefined"?globalThis:c||self,c.MoneyHash=o())})(this,function(){var _,J,j,le,D,he,W,pe,H,G,T,ue,B,me,x,ge,O,fe;"use strict";var Pe=Object.defineProperty,Se=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var de=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var z=(c,o,p)=>o in c?Pe(c,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[o]=p,S=(c,o)=>{for(var p in o||(o={}))Le.call(o,p)&&z(c,p,o[p]);if(de)for(var p of de(o))Re.call(o,p)&&z(c,p,o[p]);return c},ce=(c,o)=>Se(c,Ae(o));var y=(c,o,p)=>(z(c,typeof o!="symbol"?o+"":o,p),p),Ce=(c,o,p)=>{if(!o.has(c))throw TypeError("Cannot "+p)};var L=(c,o,p)=>{if(o.has(c))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(c):o.set(c,p)};var E=(c,o,p)=>(Ce(c,o,"access private method"),p);var v=(c,o,p)=>new Promise((C,w)=>{var N=A=>{try{$(p.next(A))}catch(F){w(F)}},U=A=>{try{$(p.throw(A))}catch(F){w(F)}},$=A=>A.done?C(A.value):Promise.resolve(A.value).then(N,U);$((p=p.apply(c,o)).next())});class c{constructor(e){y(this,"target");y(this,"targetOrigin");y(this,"listeners");y(this,"onIncomingMessageBind",this.onIncomingMessage.bind(this));this.target=e.target,this.targetOrigin=e.targetOrigin,this.listeners=[],window.addEventListener("message",this.onIncomingMessageBind)}send(e){this.target.postMessage(e,this.targetOrigin)}onReceive(e){this.listeners.push(e)}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}onIncomingMessage(e){e.origin===this.targetOrigin&&this.listeners.forEach(t=>{t(e,this.send.bind(this))})}abortService(){window.removeEventListener("message",this.onIncomingMessageBind)}}function o(){var e;return(e=window.MONEYHASH_IFRAME_URL)!=null?e:"https://embed.moneyhash.io"}function p(){return typeof window!="undefined"}const P=class{constructor(){p()&&this.initSDKCommunicationIframe()}initSDKCommunicationIframe(){if(document.getElementById("moneyhash-headless-sdk"))return;const e=o(),t=new URL(`${e}/embed/headless-sdk`);t.searchParams.set("sdk","true"),t.searchParams.set("parent",window.location.origin),t.searchParams.set("version","js@1.6.0");const a=document.createElement("iframe");a.id="moneyhash-headless-sdk",a.src=t.toString(),a.hidden=!0,document.body.appendChild(a),P.messagingService=new c({target:a.contentWindow,targetOrigin:e}),P.isCommunicationReady=new Promise(i=>{var u;const n=r=>{var s;r.data.type==="headlessSDK:init"&&(i(),(s=P.messagingService)==null||s.removeListener(n))};(u=P.messagingService)==null||u.onReceive(n)})}request(a){return v(this,arguments,function*({api:e,payload:t}){return yield P.isCommunicationReady,new Promise((i,n)=>{var r,s;(r=P.messagingService)==null||r.send({type:e,data:t});const u=l=>{var m;const{type:d,data:h}=l.data;d===e&&(h.status==="resolved"?i(h.payload):n(h.payload),(m=P.messagingService)==null||m.removeListener(u))};(s=P.messagingService)==null||s.onReceive(u)})})}postMessage(e){var t;(t=P.messagingService)==null||t.send({type:e})}};let C=P;y(C,"messagingService",null),y(C,"isCommunicationReady");function w(g,e){if(g)throw new Error(e)}const N=new Set(["payment","payout"]),U=new Set(["en","fr","ar"]);class ${constructor(e){y(this,"options");y(this,"messagingService",null);y(this,"iframe",null);y(this,"isCommunicationReady",null);w(!N.has(e.type),`MoneyHash constructor must be called with valid type (${[...N].join(" | ")})!`),this.options=e}get lang(){var t;return((t=this.options.locale)==null?void 0:t.split("-")[0])||"en"}render({selector:e,intentId:t}){var r,s;(r=this.messagingService)==null||r.abortService();const a=o(),i=new URL(`${a}/embed/${this.options.type}/${t}`);i.searchParams.set("sdk","true"),i.searchParams.set("parent",window.location.origin),i.searchParams.set("version","js@1.6.0");const n=(s=this.options.locale)==null?void 0:s.split("-")[0];n&&i.searchParams.set("lang",n),this.iframe=document.createElement("iframe"),this.iframe.src=i.toString(),this.iframe.style.height="100%",this.iframe.style.width="100%",this.iframe.style.border="0";const u=document.querySelector(e);return w(!u,`Couldn't find an element with selector ${e}!`),u.replaceChildren(this.iframe),this.messagingService=new c({target:this.iframe.contentWindow,targetOrigin:a}),this.isCommunicationReady=new Promise(l=>{var h;const d=m=>{var b;m.data.type==="sdk:init"&&(l(),(b=this.messagingService)==null||b.removeListener(d))};(h=this.messagingService)==null||h.onReceive(d)}),this.messagingService.onReceive((l,d)=>{var b,k,q,V;const{type:h,data:m}=l.data;switch(h){case"sdk:init":{d({type:"sdk:init",data:{headless:Boolean(this.options.headless),styles:this.options.styles}});break}case"onComplete":{(k=(b=this.options).onComplete)==null||k.call(b,S({type:this.options.type},m)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}case"onFail":{(V=(q=this.options).onFail)==null||V.call(q,S({type:this.options.type},m)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}}}),this.isCommunicationReady}setLocale(e){return v(this,null,function*(){var t;yield this==null?void 0:this.isCommunicationReady,this.options.locale=e,(t=this.messagingService)==null||t.send({type:"changeLanguage",data:{locale:e}})})}abortService(){return v(this,null,function*(){var e;yield this==null?void 0:this.isCommunicationReady,(e=this.messagingService)==null||e.abortService()})}}class A{constructor(){y(this,"promise");y(this,"resolve");y(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function F(){var e;return(e=window.MONEYHASH_VAULT_API_URL)!=null?e:"https://vault.moneyhash.io"}function M(){var e;return(e=window.MONEYHASH_VAULT_INPUT_IFRAME_URL)!=null?e:"https://vault-form.moneyhash.io"}function Q(){var e;return(e=window.API_URL)!=null?e:"https://web.moneyhash.io"}function ye(g){const e=["cardNumber","cardCvv","cardExpiryMonth","cardExpiryYear"];for(const t of e)if(!g.includes(t))return t;return null}function we(g){return(Array.isArray(g)?g.length:Object.keys(g).length)===0}function ve(g,e){return new Promise((t,a)=>{if(document.getElementById(e)){t(void 0);return}const n=document.createElement("script");n.src=g,n.id=e,n.addEventListener("load",()=>{t(void 0)}),n.addEventListener("error",()=>{a(new Error("Script failed to load"))}),document.body.appendChild(n)})}function be(g){return new Promise(e=>{setTimeout(()=>{e("done")},g*1e3)})}function ke(g,e){g&&console.warn(e)}const X=new Set(["method","customerBalance","savedCard"]);class Ee{constructor(e){L(this,_);L(this,j);L(this,D);L(this,W);L(this,H);L(this,T);L(this,B);L(this,x);L(this,O);y(this,"options");y(this,"sdkApiHandler",new C);y(this,"sdkEmbed");y(this,"vaultSubmitListener",{current:null});y(this,"mountedCardElements",[]);y(this,"cardForm",{collect:()=>v(this,null,function*(){w(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to collect card!");const e=yield this.sdkApiHandler.request({api:"sdk:generateAccessToken",payload:{publicApiKey:this.options.publicApiKey}});return E(this,_,J).call(this,{accessToken:e})}),pay:u=>v(this,[u],function*({intentId:e,cardData:t,saveCard:a,billingData:i,shippingData:n}){return this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",billingData:i,shippingData:n,cardEmbed:t,saveCard:a}})}),createCardToken:a=>v(this,[a],function*({cardIntentId:e,cardData:t}){return this.sdkApiHandler.request({api:"sdk:createCardToken",payload:{cardIntentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",cardEmbed:t}})})});this.options=e,this.sdkEmbed=new $(ce(S({},e),{headless:!0})),E(this,B,me).call(this,this.vaultSubmitListener)}getIntentDetails(e){return this.sdkApiHandler.request({api:"sdk:getIntentDetails",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getIntentMethods(e){return this.sdkApiHandler.request({api:"sdk:getIntentMethods",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getMethods(e){return"intentId"in e?this.getIntentMethods(e.intentId):(w(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to get methods!"),w(this.options.type==="payout","getMethods is not allowed for payout!"),this.sdkApiHandler.request({api:"sdk:getMethods",payload:S({intentType:this.options.type,lang:this.sdkEmbed.lang,publicApiKey:this.options.publicApiKey},e)}))}proceedWith({intentId:e,type:t,id:a,metaData:i}){return w(!X.has(t),`type must be a valid one (${[...X].join(" | ")})`),this.sdkApiHandler.request({api:"sdk:proceedWith",payload:{proceedWith:t,intentType:this.options.type,intentId:e,id:a,lang:this.sdkEmbed.lang,metaData:i}})}resetSelectedMethod(e){return this.sdkApiHandler.request({api:"sdk:resetSelectedMethod",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}deleteCard({cardId:e,intentSecret:t}){return w(this.options.type==="payout","deleteCard is allowed only for payment intent!"),this.sdkApiHandler.request({api:"sdk:deleteCard",payload:{cardId:e,intentSecret:t,lang:this.sdkEmbed.lang}})}payWithApplePay(l){return v(this,arguments,function*({intentId:e,currency:t,amount:a,countryCode:i,onCancel:n=()=>{},onError:u,onComplete:r,billingData:s={}}){if(yield ve("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js","moneyHash-apple-pay-sdk"),!ApplePaySession)return;const d=new ApplePaySession(3,{countryCode:i,currencyCode:t,supportedNetworks:["visa","masterCard","amex","discover","mada"],merchantCapabilities:["supports3DS"],total:{label:"Apple Pay",type:"final",amount:`${a}`}}),{state:h,intent:m}=yield this.proceedWith({intentId:e,type:"method",id:"APPLE_PAY"});try{if(h==="INTENT_FORM"){if(we(s))throw new Error("Billing data is missing while calling payWithApplePay");yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:"APPLE_PAY",lang:this.sdkEmbed.lang,billingData:s}})}}catch(b){throw yield this.resetSelectedMethod(e),b}d.onvalidatemerchant=b=>{fetch(`${Q()}/api/v1/providers/applepay/session/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:m.secret,validation_url:b.validationURL})}).then(k=>k.ok?k.json():Promise.reject()).then(k=>d.completeMerchantValidation(k)).catch(u)},d.onpaymentauthorized=b=>{fetch(`${Q()}/api/v1/providers/applepay/token/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({token_data:{token:b.payment.token},secret:m.secret})}).then(k=>k.ok?k.json():Promise.reject()).then(()=>{d.completePayment(ApplePaySession.STATUS_SUCCESS),r()}).catch(()=>{d.completePayment(ApplePaySession.STATUS_FAILURE),u()})},d.oncancel=n,d.begin()})}renderForm({selector:e,intentId:t}){return w(!e,"selector is required for renderForm"),w(!t,"intentId is required for renderForm"),this.sdkEmbed.render({selector:e,intentId:t})}setLocale(e){ke(!!e&&!U.has(e),`Invalid locale. Supported languages (${[...U].join(" | ")})`);const t=U.has(e)?e:"en";return this.sdkEmbed.setLocale(t)}removeEventListeners(){return this.sdkEmbed.abortService()}updateIntentDiscount({intentId:e,discount:t}){return w(!t.title.en,"English discount title is required!"),this.sdkApiHandler.request({api:"sdk:updateIntentDiscount",payload:{intentId:e,discount:t,lang:this.sdkEmbed.lang}})}updateIntentFees({intentId:e,fees:t}){return t.forEach(a=>{w(!a.title.en,"English fee title is required!")}),this.sdkApiHandler.request({api:"sdk:updateIntentFees",payload:{intentId:e,fees:t,lang:this.sdkEmbed.lang}})}elements({styles:e,classes:t,fontSourceCss:a}){const i=[],n={},u=new Map;let r=!1;return E(this,T,ue).call(this,i),{create:({elementType:s,elementOptions:l})=>{var q,V;const d=new Map;let h=null;const m=S(S({},t),l.classes),b=((q=m==null?void 0:m.focus)==null?void 0:q.split(" "))||["MoneyHashElement--focus"],k=((V=m==null?void 0:m.error)==null?void 0:V.split(" "))||["MoneyHashElement--error"];return{mount:()=>{const f=document.querySelector(l.selector);w(!f,`Couldn't find an element with selector ${l.selector}!`),f.classList.add("MoneyHashElement"),i.push(K=>{var Z,ee,te,ie,se,ne,ae,re,oe;const{type:R,data:I}=K.data;if(R===`${s}@mount`&&(n[s]=I.isValid,(Z=d.get(`${s}@mount`))==null||Z()),R===`${s}@focus`){f.classList.add(...b),(ee=d.get(`${s}@focus`))==null||ee();return}if(R===`${s}@blur`){f.classList.remove(...b),(te=d.get(`${s}@blur`))==null||te();return}if(R===`${s}@error`){I.isValid?f.classList.remove(...k):f.classList.add(...k),(ie=d.get(`${s}@error`))==null||ie(I);return}if(R===`${s}@changeInput`){if((se=d.get(`${s}@changeInput`))==null||se({isValid:I.isValid,length:I.length}),n[s]=I.isValid,u.get("validityChange")){const Y=Object.values(n).every(Boolean);Y!==r&&((ne=u.get("validityChange"))==null||ne(Y),r=Y)}return}if(R===`${s}@cardNumberChange`){(ae=d.get(`${s}@cardNumberChange`))==null||ae(I);return}if(R===`${s}@key:Backspace`){(re=d.get(`${s}@key:Backspace`))==null||re();return}R===`${s}@key:Enter`&&((oe=d.get(`${s}@key:Enter`))==null||oe())}),h=E(this,x,ge).call(this,{container:f,elementType:s,elementOptions:l,styles:S(S({},e),l.styles),fontSourceCss:a}),this.mountedCardElements.push(s)},on:(f,K)=>{d.set(`${s}@${f}`,K)},off:f=>d.delete(`${s}@${f}`),focus:()=>{var f;(f=h==null?void 0:h.contentWindow)==null||f.postMessage({type:"focus"},M())},blur:()=>{var f;(f=h==null?void 0:h.contentWindow)==null||f.postMessage({type:"blur"},M())},clear:()=>{var f;(f=h==null?void 0:h.contentWindow)==null||f.postMessage({type:"clear"},M())}}},on:(s,l)=>{u.set(s,l)}}}submitForm(r){return v(this,arguments,function*({intentId:e,accessToken:t,billingData:a,shippingData:i,saveCard:n,paymentMethod:u="CARD"}){const s=ye(this.mountedCardElements);w(!!s,`You must mount ${s} element!`);let l;return t&&(l=yield E(this,_,J).call(this,{accessToken:t})),yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:u,lang:this.sdkEmbed.lang,billingData:a,shippingData:i,cardEmbed:l,saveCard:n}})})}submitCvv(a){return v(this,arguments,function*({intentId:e,cvv:t}){return this.sdkApiHandler.request({api:"sdk:submitCardCvv",payload:{intentId:e,cvv:t,lang:this.sdkEmbed.lang}})})}renderUrl(n){return v(this,arguments,function*({intentId:e,url:t,renderStrategy:a,options:i}){switch(this.sdkApiHandler.postMessage("SDKRenderUrl"),a){case"IFRAME":return E(this,j,le).call(this,{url:t,intentId:e});case"POPUP_IFRAME":return E(this,D,he).call(this,{url:t,intentId:e,options:i});case"REDIRECT":return E(this,W,pe).call(this,{url:t,options:i});default:return null}})}onExpiration(e,t){if(!e)return()=>{};const a=new Date(e),i=setInterval(()=>v(this,null,function*(){const n=new Date;a<n&&(clearInterval(i),t())}),1e3);return()=>clearInterval(i)}}return _=new WeakSet,J=function(t){return v(this,arguments,function*({accessToken:e}){const a=new A;this.vaultSubmitListener.current=u=>{const{type:r,data:s}=u.data;r==="vaultSubmit:success"&&a.resolve(s),r==="vaultSubmit:error"&&a.reject(s)};const i=E(this,O,fe).call(this,{accessToken:e}),n=yield a.promise;return i.remove(),n})},j=new WeakSet,le=function(a){return v(this,arguments,function*({intentId:e,url:t}){const i=document.querySelector("#rendered-url-iframe-container");w(!i,"Couldn't find an element with id rendered-url-iframe-container to render the iframe!");const n=document.createElement("iframe");n.src=t,n.style.setProperty("border","0","important"),n.style.setProperty("width","100%","important"),n.style.setProperty("height","100%","important"),i==null||i.replaceChildren(n),yield E(this,H,G).call(this,{intentId:e}),n.remove()})},D=new WeakSet,he=function(i){return v(this,arguments,function*({intentId:e,url:t,options:a={}}){const{width:n=600,height:u=400,left:r=200,top:s=200}=a.window||{},l=window.open(t,"",`width=${n},height=${u},left=${r},top=${s}`);w(!l,"Popup blocked by browser!"),yield E(this,H,G).call(this,{intentId:e,isUsingPopUp:!0}),l==null||l.close()})},W=new WeakSet,pe=function(a){return v(this,arguments,function*({url:e,options:t}){if(!t||!t.redirectToNewWindow){window.location.href=e;return}window.open(e,"_blank")})},H=new WeakSet,G=function(a){return v(this,arguments,function*({intentId:e,isUsingPopUp:t=!1}){const i=new A,n=u=>v(this,null,function*(){var s,l,d,h;if(u.origin!==o())return;const{type:r}=u.data;if(r==="intentResult"){t&&this.sdkApiHandler.postMessage("EmbedResultClose");const[m]=yield Promise.all([this.getIntentDetails(e),be(2)]),b=m.transaction.status.split(".")[1];b==="successful"||b.startsWith("pending")?(l=(s=this.options).onComplete)==null||l.call(s,S({type:this.options.type},m)):(h=(d=this.options).onFail)==null||h.call(d,S({type:this.options.type},m)),i.resolve(()=>null),window.removeEventListener("message",n)}});return window.addEventListener("message",n),i.promise})},T=new WeakSet,ue=function(e){const t=a=>{a.origin===M()&&e.forEach(i=>{i(a)})};window.addEventListener("message",t)},B=new WeakSet,me=function(e){const t=a=>{e.current&&e.current(a)};window.addEventListener("message",t)},x=new WeakSet,ge=function({container:e,elementType:t,elementOptions:a,styles:i,fontSourceCss:n}){var l,d,h,m;const u=M(),r=new URL(`${u}/vaultField/vaultField.html`);n&&r.searchParams.set("fontSourceCss",n),r.searchParams.set("host",btoa(window.location.origin)),r.searchParams.set("type",t),((l=a.validation)==null?void 0:l.required)!==void 0&&r.searchParams.set("required",`${(d=a.validation)==null?void 0:d.required}`),r.searchParams.set("placeholder",(h=a.placeholder)!=null?h:""),r.searchParams.set("lang",this.sdkEmbed.lang),r.searchParams.set("direction",(i==null?void 0:i.direction)||""),r.searchParams.set("color",JSON.stringify(i!=null&&i.color?i.color:"#000")),r.searchParams.set("placeholderColor",(i==null?void 0:i.placeholderColor)||"#ccc"),r.searchParams.set("backgroundColor",(i==null?void 0:i.backgroundColor)||"transparent"),r.searchParams.set("fontSize",(i==null?void 0:i.fontSize)||""),r.searchParams.set("fontFamily",(i==null?void 0:i.fontFamily)||""),r.searchParams.set("fontWeight",`${i==null?void 0:i.fontWeight}`),r.searchParams.set("fontStyle",(i==null?void 0:i.fontStyle)||""),r.searchParams.set("padding",(i==null?void 0:i.padding)||"");const s=document.createElement("iframe");return s.src=r.toString(),s.style.height=(m=i==null?void 0:i.height)!=null?m:"40px",s.style.setProperty("overflow","hidden","important"),s.style.setProperty("display","block","important"),s.style.setProperty("width","100%","important"),s.style.setProperty("maxWidth","100%","important"),s.style.setProperty("border","0","important"),s.style.setProperty("margin","0","important"),s.style.setProperty("padding","0","important"),s.style.setProperty("userSelect","none","important"),s.style.setProperty("colorScheme","light only","important"),e.replaceChildren(s),s},O=new WeakSet,fe=function({accessToken:e}){const t=M(),a=F(),i=new URL(`${t}/vaultSubmit/vaultSubmit.html`);i.searchParams.set("host",btoa(window.location.origin)),i.searchParams.set("vault_api_url",`${a}/api/v1/tokens/`),i.searchParams.set("access_token",e),i.searchParams.set("lang",this.sdkEmbed.lang);const n=document.createElement("iframe");return n.id="moneyhash-submit-iframe",n.src=i.toString(),n.hidden=!0,document.body.appendChild(n),n},Ee});
(function(c,o){typeof exports=="object"&&typeof module!="undefined"?module.exports=o():typeof define=="function"&&define.amd?define(o):(c=typeof globalThis!="undefined"?globalThis:c||self,c.MoneyHash=o())})(this,function(){var _,J,j,he,D,pe,W,ue,H,G,T,me,B,ge,x,fe,O,ye;"use strict";var Pe=Object.defineProperty,Se=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable;var z=(c,o,h)=>o in c?Pe(c,o,{enumerable:!0,configurable:!0,writable:!0,value:h}):c[o]=h,S=(c,o)=>{for(var h in o||(o={}))Le.call(o,h)&&z(c,h,o[h]);if(ce)for(var h of ce(o))Ce.call(o,h)&&z(c,h,o[h]);return c},le=(c,o)=>Se(c,Ae(o));var y=(c,o,h)=>(z(c,typeof o!="symbol"?o+"":o,h),h),Re=(c,o,h)=>{if(!o.has(c))throw TypeError("Cannot "+h)};var L=(c,o,h)=>{if(o.has(c))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(c):o.set(c,h)};var k=(c,o,h)=>(Re(c,o,"access private method"),h);var v=(c,o,h)=>new Promise((R,w)=>{var N=A=>{try{$(h.next(A))}catch(F){w(F)}},U=A=>{try{$(h.throw(A))}catch(F){w(F)}},$=A=>A.done?R(A.value):Promise.resolve(A.value).then(N,U);$((h=h.apply(c,o)).next())});class c{constructor(e){y(this,"target");y(this,"targetOrigin");y(this,"listeners");y(this,"onIncomingMessageBind",this.onIncomingMessage.bind(this));this.target=e.target,this.targetOrigin=e.targetOrigin,this.listeners=[],window.addEventListener("message",this.onIncomingMessageBind)}send(e){this.target.postMessage(e,this.targetOrigin)}onReceive(e){this.listeners.push(e)}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}onIncomingMessage(e){e.origin===this.targetOrigin&&this.listeners.forEach(t=>{t(e,this.send.bind(this))})}abortService(){window.removeEventListener("message",this.onIncomingMessageBind)}}function o(){var e;return(e=window.MONEYHASH_IFRAME_URL)!=null?e:"https://embed.moneyhash.io"}function h(){return typeof window!="undefined"}const P=class{constructor(){h()&&this.initSDKCommunicationIframe()}initSDKCommunicationIframe(){if(document.getElementById("moneyhash-headless-sdk"))return;const e=o(),t=new URL(`${e}/embed/headless-sdk`);t.searchParams.set("sdk","true"),t.searchParams.set("parent",window.location.origin),t.searchParams.set("version","js@1.6.1");const a=document.createElement("iframe");a.id="moneyhash-headless-sdk",a.src=t.toString(),a.hidden=!0,document.body.appendChild(a),P.messagingService=new c({target:a.contentWindow,targetOrigin:e}),P.isCommunicationReady=new Promise(i=>{var p;const n=r=>{var s;r.data.type==="headlessSDK:init"&&(i(),(s=P.messagingService)==null||s.removeListener(n))};(p=P.messagingService)==null||p.onReceive(n)})}request(a){return v(this,arguments,function*({api:e,payload:t}){return yield P.isCommunicationReady,new Promise((i,n)=>{var r,s;(r=P.messagingService)==null||r.send({type:e,data:t});const p=u=>{var m;const{type:d,data:l}=u.data;d===e&&(l.status==="resolved"?i(l.payload):n(l.payload),(m=P.messagingService)==null||m.removeListener(p))};(s=P.messagingService)==null||s.onReceive(p)})})}postMessage(e){var t;(t=P.messagingService)==null||t.send({type:e})}};let R=P;y(R,"messagingService",null),y(R,"isCommunicationReady");function w(g,e){if(g)throw new Error(e)}const N=new Set(["payment","payout"]),U=new Set(["en","fr","ar"]);class ${constructor(e){y(this,"options");y(this,"messagingService",null);y(this,"iframe",null);y(this,"isCommunicationReady",null);w(!N.has(e.type),`MoneyHash constructor must be called with valid type (${[...N].join(" | ")})!`),this.options=e}get lang(){var t;return((t=this.options.locale)==null?void 0:t.split("-")[0])||"en"}render({selector:e,intentId:t}){var r,s;(r=this.messagingService)==null||r.abortService();const a=o(),i=new URL(`${a}/embed/${this.options.type}/${t}`);i.searchParams.set("sdk","true"),i.searchParams.set("parent",window.location.origin),i.searchParams.set("version","js@1.6.1");const n=(s=this.options.locale)==null?void 0:s.split("-")[0];n&&i.searchParams.set("lang",n),this.iframe=document.createElement("iframe"),this.iframe.src=i.toString(),this.iframe.style.height="100%",this.iframe.style.width="100%",this.iframe.style.border="0";const p=document.querySelector(e);return w(!p,`Couldn't find an element with selector ${e}!`),p.replaceChildren(this.iframe),this.messagingService=new c({target:this.iframe.contentWindow,targetOrigin:a}),this.isCommunicationReady=new Promise(u=>{var l;const d=m=>{var b;m.data.type==="sdk:init"&&(u(),(b=this.messagingService)==null||b.removeListener(d))};(l=this.messagingService)==null||l.onReceive(d)}),this.messagingService.onReceive((u,d)=>{var b,E,q,V;const{type:l,data:m}=u.data;switch(l){case"sdk:init":{d({type:"sdk:init",data:{headless:Boolean(this.options.headless),styles:this.options.styles}});break}case"onComplete":{(E=(b=this.options).onComplete)==null||E.call(b,S({type:this.options.type},m)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}case"onFail":{(V=(q=this.options).onFail)==null||V.call(q,S({type:this.options.type},m)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}}}),this.isCommunicationReady}setLocale(e){return v(this,null,function*(){var t;yield this==null?void 0:this.isCommunicationReady,this.options.locale=e,(t=this.messagingService)==null||t.send({type:"changeLanguage",data:{locale:e}})})}abortService(){return v(this,null,function*(){var e;yield this==null?void 0:this.isCommunicationReady,(e=this.messagingService)==null||e.abortService()})}}class A{constructor(){y(this,"promise");y(this,"resolve");y(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function F(){var e;return(e=window.MONEYHASH_VAULT_API_URL)!=null?e:"https://vault.moneyhash.io"}function M(){var e;return(e=window.MONEYHASH_VAULT_INPUT_IFRAME_URL)!=null?e:"https://vault-form.moneyhash.io"}function Q(){var e;return(e=window.API_URL)!=null?e:"https://web.moneyhash.io"}function X(g){const e=["cardNumber","cardCvv","cardExpiryMonth","cardExpiryYear"];for(const t of e)if(!g.includes(t))return t;return null}function we(g){return(Array.isArray(g)?g.length:Object.keys(g).length)===0}function ve(g,e){return new Promise((t,a)=>{if(document.getElementById(e)){t(void 0);return}const n=document.createElement("script");n.src=g,n.id=e,n.addEventListener("load",()=>{t(void 0)}),n.addEventListener("error",()=>{a(new Error("Script failed to load"))}),document.body.appendChild(n)})}function be(g){return new Promise(e=>{setTimeout(()=>{e("done")},g*1e3)})}function Ee(g,e){g&&console.warn(e)}const Z=new Set(["method","customerBalance","savedCard"]);class ke{constructor(e){L(this,_);L(this,j);L(this,D);L(this,W);L(this,H);L(this,T);L(this,B);L(this,x);L(this,O);y(this,"options");y(this,"sdkApiHandler",new R);y(this,"sdkEmbed");y(this,"vaultSubmitListener",{current:null});y(this,"mountedCardElements",[]);y(this,"cardForm",{collect:()=>v(this,null,function*(){w(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to collect card!");const e=X(this.mountedCardElements);w(!!e,`You must mount ${e} element!`);const t=yield this.sdkApiHandler.request({api:"sdk:generateAccessToken",payload:{publicApiKey:this.options.publicApiKey}});return k(this,_,J).call(this,{accessToken:t})}),pay:p=>v(this,[p],function*({intentId:e,cardData:t,saveCard:a,billingData:i,shippingData:n}){return this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",billingData:i,shippingData:n,cardEmbed:t,saveCard:a}})}),createCardToken:a=>v(this,[a],function*({cardIntentId:e,cardData:t}){return this.sdkApiHandler.request({api:"sdk:createCardToken",payload:{cardIntentId:e,lang:this.sdkEmbed.lang,paymentMethod:"CARD",cardEmbed:t}})})});this.options=e,this.sdkEmbed=new $(le(S({},e),{headless:!0})),k(this,B,ge).call(this,this.vaultSubmitListener)}getIntentDetails(e){return this.sdkApiHandler.request({api:"sdk:getIntentDetails",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getIntentMethods(e){return this.sdkApiHandler.request({api:"sdk:getIntentMethods",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}getMethods(e){return"intentId"in e?this.getIntentMethods(e.intentId):(w(!this.options.publicApiKey,"publicApiKey on MoneyHash instance is required to get methods!"),w(this.options.type==="payout","getMethods is not allowed for payout!"),this.sdkApiHandler.request({api:"sdk:getMethods",payload:S({intentType:this.options.type,lang:this.sdkEmbed.lang,publicApiKey:this.options.publicApiKey},e)}))}proceedWith({intentId:e,type:t,id:a,metaData:i}){return w(!Z.has(t),`type must be a valid one (${[...Z].join(" | ")})`),this.sdkApiHandler.request({api:"sdk:proceedWith",payload:{proceedWith:t,intentType:this.options.type,intentId:e,id:a,lang:this.sdkEmbed.lang,metaData:i}})}resetSelectedMethod(e){return this.sdkApiHandler.request({api:"sdk:resetSelectedMethod",payload:{intentType:this.options.type,intentId:e,lang:this.sdkEmbed.lang}})}deleteCard({cardId:e,intentSecret:t}){return w(this.options.type==="payout","deleteCard is allowed only for payment intent!"),this.sdkApiHandler.request({api:"sdk:deleteCard",payload:{cardId:e,intentSecret:t,lang:this.sdkEmbed.lang}})}payWithApplePay(u){return v(this,arguments,function*({intentId:e,currency:t,amount:a,countryCode:i,onCancel:n=()=>{},onError:p,onComplete:r,billingData:s={}}){if(yield ve("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js","moneyHash-apple-pay-sdk"),!ApplePaySession)return;const d=new ApplePaySession(3,{countryCode:i,currencyCode:t,supportedNetworks:["visa","masterCard","amex","discover","mada"],merchantCapabilities:["supports3DS"],total:{label:"Apple Pay",type:"final",amount:`${a}`}}),{state:l,intent:m}=yield this.proceedWith({intentId:e,type:"method",id:"APPLE_PAY"});try{if(l==="INTENT_FORM"){if(we(s))throw new Error("Billing data is missing while calling payWithApplePay");yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:"APPLE_PAY",lang:this.sdkEmbed.lang,billingData:s}})}}catch(b){throw yield this.resetSelectedMethod(e),b}d.onvalidatemerchant=b=>{fetch(`${Q()}/api/v1/providers/applepay/session/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:m.secret,validation_url:b.validationURL})}).then(E=>E.ok?E.json():Promise.reject()).then(E=>d.completeMerchantValidation(E)).catch(p)},d.onpaymentauthorized=b=>{fetch(`${Q()}/api/v1/providers/applepay/token/`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({token_data:{token:b.payment.token},secret:m.secret})}).then(E=>E.ok?E.json():Promise.reject()).then(()=>{d.completePayment(ApplePaySession.STATUS_SUCCESS),r()}).catch(()=>{d.completePayment(ApplePaySession.STATUS_FAILURE),p()})},d.oncancel=n,d.begin()})}renderForm({selector:e,intentId:t}){return w(!e,"selector is required for renderForm"),w(!t,"intentId is required for renderForm"),this.sdkEmbed.render({selector:e,intentId:t})}setLocale(e){Ee(!!e&&!U.has(e),`Invalid locale. Supported languages (${[...U].join(" | ")})`);const t=U.has(e)?e:"en";return this.sdkEmbed.setLocale(t)}removeEventListeners(){return this.sdkEmbed.abortService()}updateIntentDiscount({intentId:e,discount:t}){return w(!t.title.en,"English discount title is required!"),this.sdkApiHandler.request({api:"sdk:updateIntentDiscount",payload:{intentId:e,discount:t,lang:this.sdkEmbed.lang}})}updateIntentFees({intentId:e,fees:t}){return t.forEach(a=>{w(!a.title.en,"English fee title is required!")}),this.sdkApiHandler.request({api:"sdk:updateIntentFees",payload:{intentId:e,fees:t,lang:this.sdkEmbed.lang}})}elements({styles:e,classes:t,fontSourceCss:a}){const i=[],n={},p=new Map;let r=!1;return k(this,T,me).call(this,i),{create:({elementType:s,elementOptions:u})=>{var q,V;const d=new Map;let l=null;const m=S(S({},t),u.classes),b=((q=m==null?void 0:m.focus)==null?void 0:q.split(" "))||["MoneyHashElement--focus"],E=((V=m==null?void 0:m.error)==null?void 0:V.split(" "))||["MoneyHashElement--error"];return{mount:()=>{const f=document.querySelector(u.selector);w(!f,`Couldn't find an element with selector ${u.selector}!`),f.classList.add("MoneyHashElement"),i.push(K=>{var ee,te,ie,se,ne,ae,re,oe,de;const{type:C,data:I}=K.data;if(C===`${s}@mount`&&(n[s]=I.isValid,(ee=d.get(`${s}@mount`))==null||ee()),C===`${s}@focus`){f.classList.add(...b),(te=d.get(`${s}@focus`))==null||te();return}if(C===`${s}@blur`){f.classList.remove(...b),(ie=d.get(`${s}@blur`))==null||ie();return}if(C===`${s}@error`){I.isValid?f.classList.remove(...E):f.classList.add(...E),(se=d.get(`${s}@error`))==null||se(I);return}if(C===`${s}@changeInput`){if((ne=d.get(`${s}@changeInput`))==null||ne({isValid:I.isValid,length:I.length}),n[s]=I.isValid,p.get("validityChange")){const Y=Object.values(n).every(Boolean);Y!==r&&((ae=p.get("validityChange"))==null||ae(Y),r=Y)}return}if(C===`${s}@cardNumberChange`){(re=d.get(`${s}@cardNumberChange`))==null||re(I);return}if(C===`${s}@key:Backspace`){(oe=d.get(`${s}@key:Backspace`))==null||oe();return}C===`${s}@key:Enter`&&((de=d.get(`${s}@key:Enter`))==null||de())}),l=k(this,x,fe).call(this,{container:f,elementType:s,elementOptions:u,styles:S(S({},e),u.styles),fontSourceCss:a}),this.mountedCardElements.push(s)},on:(f,K)=>{d.set(`${s}@${f}`,K)},off:f=>d.delete(`${s}@${f}`),focus:()=>{var f;(f=l==null?void 0:l.contentWindow)==null||f.postMessage({type:"focus"},M())},blur:()=>{var f;(f=l==null?void 0:l.contentWindow)==null||f.postMessage({type:"blur"},M())},clear:()=>{var f;(f=l==null?void 0:l.contentWindow)==null||f.postMessage({type:"clear"},M())}}},on:(s,u)=>{p.set(s,u)}}}submitForm(r){return v(this,arguments,function*({intentId:e,accessToken:t,billingData:a,shippingData:i,saveCard:n,paymentMethod:p="CARD"}){let s;if(t){const d=X(this.mountedCardElements);w(!!d,`You must mount ${d} element!`),s=yield k(this,_,J).call(this,{accessToken:t})}return yield this.sdkApiHandler.request({api:"sdk:submitNativeForm",payload:{intentId:e,paymentMethod:p,lang:this.sdkEmbed.lang,billingData:a,shippingData:i,cardEmbed:s,saveCard:n}})})}submitCvv(a){return v(this,arguments,function*({intentId:e,cvv:t}){return this.sdkApiHandler.request({api:"sdk:submitCardCvv",payload:{intentId:e,cvv:t,lang:this.sdkEmbed.lang}})})}renderUrl(n){return v(this,arguments,function*({intentId:e,url:t,renderStrategy:a,options:i}){switch(this.sdkApiHandler.postMessage("SDKRenderUrl"),a){case"IFRAME":return k(this,j,he).call(this,{url:t,intentId:e});case"POPUP_IFRAME":return k(this,D,pe).call(this,{url:t,intentId:e,options:i});case"REDIRECT":return k(this,W,ue).call(this,{url:t,options:i});default:return null}})}onExpiration(e,t){if(!e)return()=>{};const a=new Date(e),i=setInterval(()=>v(this,null,function*(){const n=new Date;a<n&&(clearInterval(i),t())}),1e3);return()=>clearInterval(i)}}return _=new WeakSet,J=function(t){return v(this,arguments,function*({accessToken:e}){const a=new A;this.vaultSubmitListener.current=p=>{const{type:r,data:s}=p.data;r==="vaultSubmit:success"&&a.resolve(s),r==="vaultSubmit:error"&&a.reject(s)};const i=k(this,O,ye).call(this,{accessToken:e}),n=yield a.promise;return i.remove(),n})},j=new WeakSet,he=function(a){return v(this,arguments,function*({intentId:e,url:t}){const i=document.querySelector("#rendered-url-iframe-container");w(!i,"Couldn't find an element with id rendered-url-iframe-container to render the iframe!");const n=document.createElement("iframe");n.src=t,n.style.setProperty("border","0","important"),n.style.setProperty("width","100%","important"),n.style.setProperty("height","100%","important"),i==null||i.replaceChildren(n),yield k(this,H,G).call(this,{intentId:e}),n.remove()})},D=new WeakSet,pe=function(i){return v(this,arguments,function*({intentId:e,url:t,options:a={}}){const{width:n=600,height:p=400,left:r=200,top:s=200}=a.window||{},u=window.open(t,"",`width=${n},height=${p},left=${r},top=${s}`);w(!u,"Popup blocked by browser!"),yield k(this,H,G).call(this,{intentId:e,isUsingPopUp:!0}),u==null||u.close()})},W=new WeakSet,ue=function(a){return v(this,arguments,function*({url:e,options:t}){if(!t||!t.redirectToNewWindow){window.location.href=e;return}window.open(e,"_blank")})},H=new WeakSet,G=function(a){return v(this,arguments,function*({intentId:e,isUsingPopUp:t=!1}){const i=new A,n=p=>v(this,null,function*(){var s,u,d,l;if(p.origin!==o())return;const{type:r}=p.data;if(r==="intentResult"){t&&this.sdkApiHandler.postMessage("EmbedResultClose");const[m]=yield Promise.all([this.getIntentDetails(e),be(2)]),b=m.transaction.status.split(".")[1];b==="successful"||b.startsWith("pending")?(u=(s=this.options).onComplete)==null||u.call(s,S({type:this.options.type},m)):(l=(d=this.options).onFail)==null||l.call(d,S({type:this.options.type},m)),i.resolve(()=>null),window.removeEventListener("message",n)}});return window.addEventListener("message",n),i.promise})},T=new WeakSet,me=function(e){const t=a=>{a.origin===M()&&e.forEach(i=>{i(a)})};window.addEventListener("message",t)},B=new WeakSet,ge=function(e){const t=a=>{e.current&&e.current(a)};window.addEventListener("message",t)},x=new WeakSet,fe=function({container:e,elementType:t,elementOptions:a,styles:i,fontSourceCss:n}){var u,d,l,m;const p=M(),r=new URL(`${p}/vaultField/vaultField.html`);n&&r.searchParams.set("fontSourceCss",n),r.searchParams.set("host",btoa(window.location.origin)),r.searchParams.set("type",t),((u=a.validation)==null?void 0:u.required)!==void 0&&r.searchParams.set("required",`${(d=a.validation)==null?void 0:d.required}`),r.searchParams.set("placeholder",(l=a.placeholder)!=null?l:""),r.searchParams.set("lang",this.sdkEmbed.lang),r.searchParams.set("direction",(i==null?void 0:i.direction)||""),r.searchParams.set("color",JSON.stringify(i!=null&&i.color?i.color:"#000")),r.searchParams.set("placeholderColor",(i==null?void 0:i.placeholderColor)||"#ccc"),r.searchParams.set("backgroundColor",(i==null?void 0:i.backgroundColor)||"transparent"),r.searchParams.set("fontSize",(i==null?void 0:i.fontSize)||""),r.searchParams.set("fontFamily",(i==null?void 0:i.fontFamily)||""),r.searchParams.set("fontWeight",`${i==null?void 0:i.fontWeight}`),r.searchParams.set("fontStyle",(i==null?void 0:i.fontStyle)||""),r.searchParams.set("padding",(i==null?void 0:i.padding)||"");const s=document.createElement("iframe");return s.src=r.toString(),s.style.height=(m=i==null?void 0:i.height)!=null?m:"40px",s.style.setProperty("overflow","hidden","important"),s.style.setProperty("display","block","important"),s.style.setProperty("width","100%","important"),s.style.setProperty("maxWidth","100%","important"),s.style.setProperty("border","0","important"),s.style.setProperty("margin","0","important"),s.style.setProperty("padding","0","important"),s.style.setProperty("userSelect","none","important"),s.style.setProperty("colorScheme","light only","important"),e.replaceChildren(s),s},O=new WeakSet,ye=function({accessToken:e}){const t=M(),a=F(),i=new URL(`${t}/vaultSubmit/vaultSubmit.html`);i.searchParams.set("host",btoa(window.location.origin)),i.searchParams.set("vault_api_url",`${a}/api/v1/tokens/`),i.searchParams.set("access_token",e),i.searchParams.set("lang",this.sdkEmbed.lang);const n=document.createElement("iframe");return n.id="moneyhash-submit-iframe",n.src=i.toString(),n.hidden=!0,document.body.appendChild(n),n},ke});

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

"use strict";var n=Object.defineProperty;var d=(t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var a=(t,e,s)=>(d(t,typeof e!="symbol"?e+"":e,s),s);const r=require("./warnIf-c28a6074.cjs");class o{constructor(e){a(this,"options");a(this,"sdkEmbed");this.options=e,this.sdkEmbed=new r.SDKEmbed(e)}start({selector:e,intentId:s}){return r.throwIf(!e,"selector is required for start"),r.throwIf(!s,"intentId is required for start"),this.sdkEmbed.render({selector:e,intentId:s})}setLocale(e){r.warnIf(!!e&&!r.supportedLanguages.has(e),`Invalid locale. Supported languages (${[...r.supportedLanguages].join(" | ")})`);const s=r.supportedLanguages.has(e)?e:"en";return this.sdkEmbed.setLocale(s)}removeEventListeners(){return this.sdkEmbed.abortService()}}module.exports=o;
"use strict";var n=Object.defineProperty;var d=(t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var a=(t,e,s)=>(d(t,typeof e!="symbol"?e+"":e,s),s);const r=require("./warnIf-5a113081.cjs");class o{constructor(e){a(this,"options");a(this,"sdkEmbed");this.options=e,this.sdkEmbed=new r.SDKEmbed(e)}start({selector:e,intentId:s}){return r.throwIf(!e,"selector is required for start"),r.throwIf(!s,"intentId is required for start"),this.sdkEmbed.render({selector:e,intentId:s})}setLocale(e){r.warnIf(!!e&&!r.supportedLanguages.has(e),`Invalid locale. Supported languages (${[...r.supportedLanguages].join(" | ")})`);const s=r.supportedLanguages.has(e)?e:"en";return this.sdkEmbed.setLocale(s)}removeEventListeners(){return this.sdkEmbed.abortService()}}module.exports=o;
var o = Object.defineProperty;
var n = (r, s, e) => s in r ? o(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
var t = (r, s, e) => (n(r, typeof s != "symbol" ? s + "" : s, e), e);
import { S as i, t as d, w as u, s as a } from "./warnIf-5ce36408.js";
import { S as i, t as d, w as u, s as a } from "./warnIf-c94d7bcb.js";
class b {

@@ -6,0 +6,0 @@ constructor(s) {

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

(function(i,s){typeof exports=="object"&&typeof module!="undefined"?module.exports=s():typeof define=="function"&&define.amd?define(s):(i=typeof globalThis!="undefined"?globalThis:i||self,i.MoneyHash=s())})(this,function(){"use strict";var F=Object.defineProperty;var O=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var v=(i,s,t)=>s in i?F(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t,w=(i,s)=>{for(var t in s||(s={}))U.call(s,t)&&v(i,t,s[t]);if(O)for(var t of O(s))$.call(s,t)&&v(i,t,s[t]);return i};var a=(i,s,t)=>(v(i,typeof s!="symbol"?s+"":s,t),t);var b=(i,s,t)=>new Promise((g,o)=>{var p=r=>{try{h(t.next(r))}catch(e){o(e)}},f=r=>{try{h(t.throw(r))}catch(e){o(e)}},h=r=>r.done?g(r.value):Promise.resolve(r.value).then(p,f);h((t=t.apply(i,s)).next())});class i{constructor(e){a(this,"target");a(this,"targetOrigin");a(this,"listeners");a(this,"onIncomingMessageBind",this.onIncomingMessage.bind(this));this.target=e.target,this.targetOrigin=e.targetOrigin,this.listeners=[],window.addEventListener("message",this.onIncomingMessageBind)}send(e){this.target.postMessage(e,this.targetOrigin)}onReceive(e){this.listeners.push(e)}removeListener(e){this.listeners=this.listeners.filter(n=>n!==e)}onIncomingMessage(e){e.origin===this.targetOrigin&&this.listeners.forEach(n=>{n(e,this.send.bind(this))})}abortService(){window.removeEventListener("message",this.onIncomingMessageBind)}}function s(){var e;return(e=window.MONEYHASH_IFRAME_URL)!=null?e:"https://embed.moneyhash.io"}function t(r,e){if(r)throw new Error(e)}const g=new Set(["payment","payout"]),o=new Set(["en","fr","ar"]);class p{constructor(e){a(this,"options");a(this,"messagingService",null);a(this,"iframe",null);a(this,"isCommunicationReady",null);t(!g.has(e.type),`MoneyHash constructor must be called with valid type (${[...g].join(" | ")})!`),this.options=e}get lang(){var n;return((n=this.options.locale)==null?void 0:n.split("-")[0])||"en"}render({selector:e,intentId:n}){var L,M;(L=this.messagingService)==null||L.abortService();const S=s(),c=new URL(`${S}/embed/${this.options.type}/${n}`);c.searchParams.set("sdk","true"),c.searchParams.set("parent",window.location.origin),c.searchParams.set("version","js@1.6.0");const R=(M=this.options.locale)==null?void 0:M.split("-")[0];R&&c.searchParams.set("lang",R),this.iframe=document.createElement("iframe"),this.iframe.src=c.toString(),this.iframe.style.height="100%",this.iframe.style.width="100%",this.iframe.style.border="0";const E=document.querySelector(e);return t(!E,`Couldn't find an element with selector ${e}!`),E.replaceChildren(this.iframe),this.messagingService=new i({target:this.iframe.contentWindow,targetOrigin:S}),this.isCommunicationReady=new Promise(y=>{var l;const m=u=>{var d;u.data.type==="sdk:init"&&(y(),(d=this.messagingService)==null||d.removeListener(m))};(l=this.messagingService)==null||l.onReceive(m)}),this.messagingService.onReceive((y,m)=>{var d,I,k,C;const{type:l,data:u}=y.data;switch(l){case"sdk:init":{m({type:"sdk:init",data:{headless:Boolean(this.options.headless),styles:this.options.styles}});break}case"onComplete":{(I=(d=this.options).onComplete)==null||I.call(d,w({type:this.options.type},u)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}case"onFail":{(C=(k=this.options).onFail)==null||C.call(k,w({type:this.options.type},u)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}}}),this.isCommunicationReady}setLocale(e){return b(this,null,function*(){var n;yield this==null?void 0:this.isCommunicationReady,this.options.locale=e,(n=this.messagingService)==null||n.send({type:"changeLanguage",data:{locale:e}})})}abortService(){return b(this,null,function*(){var e;yield this==null?void 0:this.isCommunicationReady,(e=this.messagingService)==null||e.abortService()})}}function f(r,e){r&&console.warn(e)}class h{constructor(e){a(this,"options");a(this,"sdkEmbed");this.options=e,this.sdkEmbed=new p(e)}start({selector:e,intentId:n}){return t(!e,"selector is required for start"),t(!n,"intentId is required for start"),this.sdkEmbed.render({selector:e,intentId:n})}setLocale(e){f(!!e&&!o.has(e),`Invalid locale. Supported languages (${[...o].join(" | ")})`);const n=o.has(e)?e:"en";return this.sdkEmbed.setLocale(n)}removeEventListeners(){return this.sdkEmbed.abortService()}}return h});
(function(i,s){typeof exports=="object"&&typeof module!="undefined"?module.exports=s():typeof define=="function"&&define.amd?define(s):(i=typeof globalThis!="undefined"?globalThis:i||self,i.MoneyHash=s())})(this,function(){"use strict";var F=Object.defineProperty;var O=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var v=(i,s,t)=>s in i?F(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t,w=(i,s)=>{for(var t in s||(s={}))U.call(s,t)&&v(i,t,s[t]);if(O)for(var t of O(s))$.call(s,t)&&v(i,t,s[t]);return i};var a=(i,s,t)=>(v(i,typeof s!="symbol"?s+"":s,t),t);var b=(i,s,t)=>new Promise((g,o)=>{var p=r=>{try{h(t.next(r))}catch(e){o(e)}},f=r=>{try{h(t.throw(r))}catch(e){o(e)}},h=r=>r.done?g(r.value):Promise.resolve(r.value).then(p,f);h((t=t.apply(i,s)).next())});class i{constructor(e){a(this,"target");a(this,"targetOrigin");a(this,"listeners");a(this,"onIncomingMessageBind",this.onIncomingMessage.bind(this));this.target=e.target,this.targetOrigin=e.targetOrigin,this.listeners=[],window.addEventListener("message",this.onIncomingMessageBind)}send(e){this.target.postMessage(e,this.targetOrigin)}onReceive(e){this.listeners.push(e)}removeListener(e){this.listeners=this.listeners.filter(n=>n!==e)}onIncomingMessage(e){e.origin===this.targetOrigin&&this.listeners.forEach(n=>{n(e,this.send.bind(this))})}abortService(){window.removeEventListener("message",this.onIncomingMessageBind)}}function s(){var e;return(e=window.MONEYHASH_IFRAME_URL)!=null?e:"https://embed.moneyhash.io"}function t(r,e){if(r)throw new Error(e)}const g=new Set(["payment","payout"]),o=new Set(["en","fr","ar"]);class p{constructor(e){a(this,"options");a(this,"messagingService",null);a(this,"iframe",null);a(this,"isCommunicationReady",null);t(!g.has(e.type),`MoneyHash constructor must be called with valid type (${[...g].join(" | ")})!`),this.options=e}get lang(){var n;return((n=this.options.locale)==null?void 0:n.split("-")[0])||"en"}render({selector:e,intentId:n}){var L,M;(L=this.messagingService)==null||L.abortService();const S=s(),c=new URL(`${S}/embed/${this.options.type}/${n}`);c.searchParams.set("sdk","true"),c.searchParams.set("parent",window.location.origin),c.searchParams.set("version","js@1.6.1");const R=(M=this.options.locale)==null?void 0:M.split("-")[0];R&&c.searchParams.set("lang",R),this.iframe=document.createElement("iframe"),this.iframe.src=c.toString(),this.iframe.style.height="100%",this.iframe.style.width="100%",this.iframe.style.border="0";const E=document.querySelector(e);return t(!E,`Couldn't find an element with selector ${e}!`),E.replaceChildren(this.iframe),this.messagingService=new i({target:this.iframe.contentWindow,targetOrigin:S}),this.isCommunicationReady=new Promise(y=>{var l;const m=u=>{var d;u.data.type==="sdk:init"&&(y(),(d=this.messagingService)==null||d.removeListener(m))};(l=this.messagingService)==null||l.onReceive(m)}),this.messagingService.onReceive((y,m)=>{var d,I,k,C;const{type:l,data:u}=y.data;switch(l){case"sdk:init":{m({type:"sdk:init",data:{headless:Boolean(this.options.headless),styles:this.options.styles}});break}case"onComplete":{(I=(d=this.options).onComplete)==null||I.call(d,w({type:this.options.type},u)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}case"onFail":{(C=(k=this.options).onFail)==null||C.call(k,w({type:this.options.type},u)),this.options.headless&&this.iframe&&(this.iframe.hidden=!0);break}}}),this.isCommunicationReady}setLocale(e){return b(this,null,function*(){var n;yield this==null?void 0:this.isCommunicationReady,this.options.locale=e,(n=this.messagingService)==null||n.send({type:"changeLanguage",data:{locale:e}})})}abortService(){return b(this,null,function*(){var e;yield this==null?void 0:this.isCommunicationReady,(e=this.messagingService)==null||e.abortService()})}}function f(r,e){r&&console.warn(e)}class h{constructor(e){a(this,"options");a(this,"sdkEmbed");this.options=e,this.sdkEmbed=new p(e)}start({selector:e,intentId:n}){return t(!e,"selector is required for start"),t(!n,"intentId is required for start"),this.sdkEmbed.render({selector:e,intentId:n})}setLocale(e){f(!!e&&!o.has(e),`Invalid locale. Supported languages (${[...o].join(" | ")})`);const n=o.has(e)?e:"en";return this.sdkEmbed.setLocale(n)}removeEventListeners(){return this.sdkEmbed.abortService()}}return h});
{
"name": "@moneyhash/js-sdk",
"version": "1.6.0",
"version": "1.6.1",
"description": "MoneyHash JavaScript SDK",

@@ -5,0 +5,0 @@ "type": "module",

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