@paynext/sdk 0.0.72 → 0.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +69 -37
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<%s {...props} />
|
|
38
38
|
React keys must be passed directly to JSX without using spread:
|
|
39
39
|
let props = %s;
|
|
40
|
-
<%s key={someKey} {...props} />`,b,w,j,w),E[w+b]=!0)}if(w=null,V!==void 0&&(e(V),w=""+V),o(P)&&(e(P.key),w=""+P.key),"key"in P){V={};for(var Q in P)Q!=="key"&&(V[Q]=P[Q])}else V=P;return w&&s(V,typeof g=="function"?g.displayName||g.name||"Unknown":g),c(g,w,_,T,a(),V,O,M)}function u(g){typeof g=="object"&&g!==null&&g.$$typeof===p&&g._store&&(g._store.validated=1)}var h=ie,p=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),x=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),$=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,z=Array.isArray,B=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(g){return g()}};var J,D={},Y=h.react_stack_bottom_frame.bind(h,i)(),H=B(n(i)),E={};bt.Fragment=m,bt.jsx=function(g,P,V,b,T){var _=1e4>$.recentlyCreatedOwnerStacks++;return d(g,P,V,!1,b,T,_?Error("react-stack-top-frame"):Y,_?B(n(g)):H)},bt.jsxs=function(g,P,V,b,T){var _=1e4>$.recentlyCreatedOwnerStacks++;return d(g,P,V,!0,b,T,_?Error("react-stack-top-frame"):Y,_?B(n(g)):H)}}()),bt}var Oi;function kl(){return Oi||(Oi=1,process.env.NODE_ENV==="production"?Ot.exports=xl():Ot.exports=Nl()),Ot.exports}kl();const Ol=[ce.DinersClub,ce.DinersClub,ce.Discover,ce.JCB,ce.Mastercard,ce.Visa,ce.UnionPay,ce.Maestro],Se=r=>{const t=r.errors;return{[ye.INSUFFICIENT_FUNDS]:t==null?void 0:t.insufficientFunds,[ye.AUTHENTICATION_REQUIRED]:t==null?void 0:t.cardholderAuthenticationRequired,[ye.CARD_ISSUER_DECLINE]:t==null?void 0:t.declined,[ye.GENERIC_DECLINE]:t==null?void 0:t.declined,[ye.WITHDRAWAL_LIMIT_EXCEEDED]:t==null?void 0:t.limitExceeded,[ye.DO_NOT_HONOR]:t==null?void 0:t.doNotHonor,[ye.EXPIRED_CARD]:t==null?void 0:t.expiredCard,[ye.SUSPECTED_FRAUD]:t==null?void 0:t.processorDeclinedFraudSuspected,[ye.INCORRECT_CVC]:(t==null?void 0:t.invalidSecurePaymentData)||(t==null?void 0:t.invalidCreditCardNumber),[ye.INVALID_CARD_NUMBER]:t==null?void 0:t.invalidCreditCardNumber,[ye.ISSUER_UNAVAILABLE]:t==null?void 0:t.offlineIssuerDeclined,[ye.CARD_LOST_OR_STOLEN]:t==null?void 0:t.cardReportedAsLostOrStolen,[ye.CARD_DECLINED]:t==null?void 0:t.declined,errorText:t==null?void 0:t.errorText,"Frame closed before tokenization could occur.":t==null?void 0:t.venmoClosed,"Window is closed, can not determine type":t==null?void 0:t.paypalClosed,"Detected popup close":t==null?void 0:t.paypalPopupClosed,Cancelled:t==null?void 0:t.applePayClosed}},Ze=(r,t)=>{var i,o;const e=Se(t),n=((o=(i=t==null?void 0:t.card)==null?void 0:i.status)==null?void 0:o.error)||t.status.error,a=s=>s&&e[s]?e[s]:n;if(r&&typeof r=="object"){const s=r,l=s&&typeof s.status_reason=="object"&&s.status_reason?s.status_reason:s,c=l&&typeof l.decline_code=="string"?l.decline_code:void 0,d=l&&typeof l.message=="string"?l.message:void 0,u=typeof s.message=="string"?s.message:void 0;return c?a(c):d&&e[d]?e[d]:u&&e[u]?e[u]:n}return r instanceof Error?a(r.message):typeof r=="string"?a(r):n};class Ll{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"ev");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t;const e=this.config.state.styles.getState().ApplePayButton;this.ev=this.config.service.ev,this.customButtonStyles=e,this.error=new Te(this.config.state.translate),this.element=document.createElement("div"),this.element.classList.add(Er.applePay,Er.hidden),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.translate.locale(),a=Cl(e);if(!a)return!1;const i=t?ee(K({},t),{onError:o=>{var u,h;if(!this.isInitialized){console.error("Apple Pay error:",o);return}const s=this.config.state.translate.messages(),l=Ze(o,s),c=Se(s)[l],d=((u=this.config.state.translate.messages().errors)==null?void 0:u.errorText)||"Error";this.error.setMessage(`Apple Pay ${d.toLowerCase()}: ${c!=null?c:l}`),this.error.render().style.display="",(h=t.onError)==null||h.call(t,o)},onCancel:t.onCancel,onSuccess:o=>{var s;this.error.render().style.display="none",(s=t.onSuccess)==null||s.call(t,o)}}):void 0;return yield this.ev.initApple(ee(K({},i),{transaction:a,supportedCardTypes:wl(Ol),locale:Al(n||"en")}),this.customButtonStyles),this.ev.isAppleAvailable()?(yield this.ev.renderApple(this.element),this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.isInitialized=!0,this.element.classList.remove(Er.hidden),this.events.ready.emit(),!0):!1})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("Apple Pay error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=this.config.state.translate.messages().errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`Apple Pay ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.element}}const Pl=[{type:re.PAYPAL,is_active:!0,order:1},{type:re.APPLE_PAY,is_active:!0,order:2},{type:re.GOOGLE_PAY,is_active:!0,order:3},{type:re.VENMO,is_active:!0,order:4},{type:re.CARD,is_active:!0,order:5}],Xe={open:{y:0,opacity:1},close:{y:100,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Lt={open:{y:0,opacity:1},close:{y:-100,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},me={open:{y:0,opacity:1},close:{y:15,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Ce={open:{y:0,opacity:1,height:"auto"},close:{y:-15,opacity:0,height:0},transition:{duration:.25,type:"spring",bounce:0}},Ir={googlePay:"_googlePay_gmreq_1",hidden:"_hidden_gmreq_20"};class Rl{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"ev");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.ev=this.config.service.ev,this.customButtonStyles=this.config.state.styles.getState().GooglePayButton,this.element=document.createElement("div"),this.element.classList.add(Ir.googlePay,Ir.hidden),this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.translate.locale(),a=El(e);if(!a)return!1;const i=t?ee(K({},t),{onError:o=>{var c,d;if(!this.isInitialized){console.error("Google Pay error:",o);return}const s=Ze(o,this.config.state.translate.messages()),l=((c=this.config.state.translate.messages().errors)==null?void 0:c.errorText)||"Error";this.error.setMessage(`Google Pay ${l.toLowerCase()}: ${s}`),this.error.render().style.display="",(d=t.onError)==null||d.call(t,o)},onCancel:t.onCancel,onSuccess:o=>{var s;this.error.render().style.display="none",(s=t.onSuccess)==null||s.call(t,o)}}):void 0;return yield this.ev.initGoogle(ee(K({},i),{transaction:a,locale:Tl(n||"en")}),this.customButtonStyles),yield this.ev.renderGoogle(this.element),this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.element.classList.remove(Ir.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var n;if(!this.isInitialized){console.error("Google Pay error:",t);return}const e=((n=this.config.state.translate.messages().errors)==null?void 0:n.errorText)||"Error";this.error.setMessage(`Google Pay ${e.toLowerCase()}: ${t}`),this.error.render().style.display=""}render(){return this.element}}const xr={paypal:"_paypal_90mm5_1",hidden:"_hidden_90mm5_12"};class Sl{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"paypal");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.paypal=this.config.service.paypal,this.customButtonStyles=this.config.state.styles.getState().PayPalButton,this.element=document.createElement("div"),this.element.classList.add(xr.paypal,xr.hidden),this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){var o,s,l;if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.checkout.getState(),a=()=>W(this,null,function*(){return yield bl(n.clientToken,n.environment,n.apiVersion)});if(!e||Object.keys(e).length===0)return console.error("PayPal transaction data is empty or invalid"),!1;yield this.paypal.init({clientId:((o=e==null?void 0:e.paypal_info)==null?void 0:o.client_id)||"",environment:((s=e==null?void 0:e.paypal_info)==null?void 0:s.environment)||"sandbox",vault:!0,locale:Il(this.config.state.translate.locale())});const i=t?ee(K({},t),{onError:c=>{var f,m;if(!this.isInitialized){console.error("PayPal error:",c);return}const d=this.config.state.translate.messages(),u=Ze(c,d),h=Se(d)[u],p=((f=this.config.state.translate.messages().errors)==null?void 0:f.errorText)||"Error";this.error.setMessage(`PayPal ${p.toLowerCase()}: ${h!=null?h:u}`),this.error.render().style.display="",(m=t.onError)==null||m.call(t,c)},onCancel:t.onCancel,onSuccess:c=>{var d;this.error.render().style.display="none",(d=t.onSuccess)==null||d.call(t,c)}}):void 0;return yield this.paypal.render(this.element,ee(K({},i),{createBillingAgreement:a,onApprove:d=>W(this,[d],function*({billingToken:c}){var u;(u=i==null?void 0:i.onSuccess)==null||u.call(i,c||"")}),style:(l=this.customButtonStyles)==null?void 0:l.styles,onCancel:i==null?void 0:i.onCancel,onError:i==null?void 0:i.onError})),this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.element.classList.remove(xr.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("PayPal error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=this.config.state.translate.messages().errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`PayPal ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.element}}class Dl{constructor(){C(this,"template",`
|
|
40
|
+
<%s key={someKey} {...props} />`,b,w,j,w),E[w+b]=!0)}if(w=null,V!==void 0&&(e(V),w=""+V),o(P)&&(e(P.key),w=""+P.key),"key"in P){V={};for(var Q in P)Q!=="key"&&(V[Q]=P[Q])}else V=P;return w&&s(V,typeof g=="function"?g.displayName||g.name||"Unknown":g),c(g,w,_,T,a(),V,O,M)}function u(g){typeof g=="object"&&g!==null&&g.$$typeof===p&&g._store&&(g._store.validated=1)}var h=ie,p=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),x=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),$=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,z=Array.isArray,B=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(g){return g()}};var J,D={},Y=h.react_stack_bottom_frame.bind(h,i)(),H=B(n(i)),E={};bt.Fragment=m,bt.jsx=function(g,P,V,b,T){var _=1e4>$.recentlyCreatedOwnerStacks++;return d(g,P,V,!1,b,T,_?Error("react-stack-top-frame"):Y,_?B(n(g)):H)},bt.jsxs=function(g,P,V,b,T){var _=1e4>$.recentlyCreatedOwnerStacks++;return d(g,P,V,!0,b,T,_?Error("react-stack-top-frame"):Y,_?B(n(g)):H)}}()),bt}var Oi;function kl(){return Oi||(Oi=1,process.env.NODE_ENV==="production"?Ot.exports=xl():Ot.exports=Nl()),Ot.exports}kl();const Ol=[ce.DinersClub,ce.DinersClub,ce.Discover,ce.JCB,ce.Mastercard,ce.Visa,ce.UnionPay,ce.Maestro],Se=r=>{const t=r.errors;return{[ye.INSUFFICIENT_FUNDS]:t==null?void 0:t.insufficientFunds,[ye.AUTHENTICATION_REQUIRED]:t==null?void 0:t.cardholderAuthenticationRequired,[ye.CARD_ISSUER_DECLINE]:t==null?void 0:t.declined,[ye.GENERIC_DECLINE]:t==null?void 0:t.declined,[ye.WITHDRAWAL_LIMIT_EXCEEDED]:t==null?void 0:t.limitExceeded,[ye.DO_NOT_HONOR]:t==null?void 0:t.doNotHonor,[ye.EXPIRED_CARD]:t==null?void 0:t.expiredCard,[ye.SUSPECTED_FRAUD]:t==null?void 0:t.processorDeclinedFraudSuspected,[ye.INCORRECT_CVC]:(t==null?void 0:t.invalidSecurePaymentData)||(t==null?void 0:t.invalidCreditCardNumber),[ye.INVALID_CARD_NUMBER]:t==null?void 0:t.invalidCreditCardNumber,[ye.ISSUER_UNAVAILABLE]:t==null?void 0:t.offlineIssuerDeclined,[ye.CARD_LOST_OR_STOLEN]:t==null?void 0:t.cardReportedAsLostOrStolen,[ye.CARD_DECLINED]:t==null?void 0:t.declined,errorText:t==null?void 0:t.errorText,"Frame closed before tokenization could occur.":t==null?void 0:t.venmoClosed,"Window is closed, can not determine type":t==null?void 0:t.paypalClosed,"Detected popup close":t==null?void 0:t.paypalPopupClosed,Cancelled:t==null?void 0:t.applePayClosed}},Ze=(r,t)=>{var i,o;const e=Se(t),n=((o=(i=t==null?void 0:t.card)==null?void 0:i.status)==null?void 0:o.error)||t.status.error,a=s=>s&&e[s]?e[s]:n;if(r&&typeof r=="object"){const s=r,l=s&&typeof s.status_reason=="object"&&s.status_reason?s.status_reason:s,c=l&&typeof l.decline_code=="string"?l.decline_code:void 0,d=l&&typeof l.message=="string"?l.message:void 0,u=typeof s.message=="string"?s.message:void 0;return c?a(c):d&&e[d]?e[d]:u&&e[u]?e[u]:n}return r instanceof Error?a(r.message):typeof r=="string"?a(r):n};class Ll{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"ev");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t;const e=this.config.state.styles.getState().ApplePayButton;this.ev=this.config.service.ev,this.customButtonStyles=e,this.error=new Te(this.config.state.translate),this.element=document.createElement("div"),this.element.classList.add(Er.applePay,Er.hidden),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.translate.locale(),a=Cl(e);if(!a)return!1;const i=t?ee(K({},t),{onError:o=>{var u,h;if(!this.isInitialized){console.error("Apple Pay error:",o);return}const s=this.config.state.translate.messages(),l=Ze(o,s),c=Se(s)[l],d=((u=this.config.state.translate.messages().errors)==null?void 0:u.errorText)||"Error";this.error.setMessage(`Apple Pay ${d.toLowerCase()}: ${c!=null?c:l}`),this.error.render().style.display="",(h=t.onError)==null||h.call(t,o)},onCancel:t.onCancel,onSuccess:o=>{var s;this.error.render().style.display="none",(s=t.onSuccess)==null||s.call(t,o)}}):void 0;return yield this.ev.initApple(ee(K({},i),{transaction:a,supportedCardTypes:wl(Ol),locale:Al(n||"en")}),this.customButtonStyles),this.ev.isAppleAvailable()?(yield this.ev.renderApple(this.element),this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.isInitialized=!0,this.element.classList.remove(Er.hidden),this.events.ready.emit(),!0):!1})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("Apple Pay error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=this.config.state.translate.messages().errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`Apple Pay ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.element}}const Pl=[{type:re.PAYPAL,is_active:!0,order:1},{type:re.APPLE_PAY,is_active:!0,order:2},{type:re.GOOGLE_PAY,is_active:!0,order:3},{type:re.VENMO,is_active:!0,order:4},{type:re.CARD,is_active:!0,order:5}],Xe={open:{y:0,opacity:1},close:{y:100,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Lt={open:{y:0,opacity:1},close:{y:-100,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},me={open:{y:0,opacity:1},close:{y:15,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Ce={open:{y:0,opacity:1,height:"auto"},close:{y:-15,opacity:0,height:0},transition:{duration:.25,type:"spring",bounce:0}},Ir={googlePay:"_googlePay_gmreq_1",hidden:"_hidden_gmreq_20"};class Rl{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"ev");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.ev=this.config.service.ev,this.customButtonStyles=this.config.state.styles.getState().GooglePayButton,this.element=document.createElement("div"),this.element.classList.add(Ir.googlePay,Ir.hidden),this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.translate.locale(),a=El(e);if(!a)return!1;const i=t?ee(K({},t),{onError:o=>{var c,d;if(!this.isInitialized){console.error("Google Pay error:",o);return}const s=Ze(o,this.config.state.translate.messages()),l=((c=this.config.state.translate.messages().errors)==null?void 0:c.errorText)||"Error";this.error.setMessage(`Google Pay ${l.toLowerCase()}: ${s}`),this.error.render().style.display="",(d=t.onError)==null||d.call(t,o)},onCancel:t.onCancel,onSuccess:o=>{var s;this.error.render().style.display="none",(s=t.onSuccess)==null||s.call(t,o)}}):void 0;return yield this.ev.initGoogle(ee(K({},i),{transaction:a,locale:Tl(n||"en")}),this.customButtonStyles),yield this.ev.renderGoogle(this.element),this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.element.classList.remove(Ir.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var n;if(!this.isInitialized){console.error("Google Pay error:",t);return}const e=((n=this.config.state.translate.messages().errors)==null?void 0:n.errorText)||"Error";this.error.setMessage(`Google Pay ${e.toLowerCase()}: ${t}`),this.error.render().style.display=""}render(){return this.element}}const xr={paypal:"_paypal_90mm5_1",hidden:"_hidden_90mm5_12"};class Sl{constructor(t){C(this,"element");C(this,"events",{ready:new he});C(this,"paypal");C(this,"customButtonStyles");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.paypal=this.config.service.paypal,this.customButtonStyles=this.config.state.styles.getState().PayPalButton,this.element=document.createElement("div"),this.element.classList.add(xr.paypal,xr.hidden),this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none"}init(t){return W(this,null,function*(){var o,s;if(!this.config)return!1;const e=this.config.state.transaction.getState(),n=this.config.state.checkout.getState(),a=()=>W(this,null,function*(){try{return yield bl(n.clientToken,n.environment,n.apiVersion)}catch(l){throw l}});if(!e||Object.keys(e).length===0)return console.error("PayPal transaction data is empty or invalid"),!1;if(!((o=e==null?void 0:e.paypal_info)!=null&&o.client_id))return!1;try{if(yield this.paypal.init({clientId:e.paypal_info.client_id,environment:e.paypal_info.environment||"sandbox",vault:!0,locale:Il(this.config.state.translate.locale())}),!this.paypal.isLoaded())return!1}catch(l){return!1}const i=t?ee(K({},t),{onError:l=>{var p,f;if(!this.isInitialized){console.error("PayPal error:",l);return}const c=this.config.state.translate.messages(),d=Ze(l,c),u=Se(c)[d],h=((p=this.config.state.translate.messages().errors)==null?void 0:p.errorText)||"Error";this.error.setMessage(`PayPal ${h.toLowerCase()}: ${u!=null?u:d}`),this.error.render().style.display="",(f=t.onError)==null||f.call(t,l)},onCancel:t.onCancel,onSuccess:l=>{var c;this.error.render().style.display="none",(c=t.onSuccess)==null||c.call(t,l)}}):void 0;try{yield this.paypal.render(this.element,ee(K({},i),{createBillingAgreement:a,onApprove:c=>W(this,[c],function*({billingToken:l}){var d;(d=i==null?void 0:i.onSuccess)==null||d.call(i,l||"")}),style:(s=this.customButtonStyles)==null?void 0:s.styles,onCancel:()=>{var l;(l=i==null?void 0:i.onCancel)==null||l.call(i)},onError:l=>{var c;(c=i==null?void 0:i.onError)==null||c.call(i,l)}}))}catch(l){return!1}return this.element.addEventListener("click",()=>Te.hideAll()),this.element.append(this.error.render()),this.element.classList.remove(xr.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("PayPal error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=this.config.state.translate.messages().errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`PayPal ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.element}}class Dl{constructor(){C(this,"template",`
|
|
41
41
|
<svg
|
|
42
42
|
xmlns='http://www.w3.org/2000/svg'
|
|
43
43
|
fill='none'
|
|
@@ -55,7 +55,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
55
55
|
`);C(this,"element",document.createElement("div"));this.element.classList.add(X.card),this.element.innerHTML=this.template}render(){return this.element}}const Li={button:"_button_13xr0_1"};class Ml{constructor(t){C(this,"element");C(this,"icon",new Dl);this.config=t;const e=this.config.state.styles.getState().WalletButton,n=this.config.state.translate;this.element=document.createElement("button"),this.element.classList.add(Li.button,Li.press),e!=null&&e.className&&this.element.classList.add(e.className),e!=null&&e.styles&&Object.assign(this.element.style,e.styles);const a=document.createElement("span");a.textContent=n.getState().messages.card.compact.button,this.element.append(this.icon.render(),a),n.subscribe(({messages:i})=>{a.textContent=i.card.compact.button})}addEventListener(t){return this.element.addEventListener("click",t)}render(){return this.element}}const Vl=(r,t,e)=>t.concat(r.filter(n=>t.every(a=>!e(n,a)))),Pt={conteiner:"_conteiner_1j5pe_2",venmo:"_venmo_1j5pe_8",hidden:"_hidden_1j5pe_33"},Fl={display:"flex",height:40,borderRadius:12},Ul=`<svg viewBox="2.3 484.3 611.9 117.80000000000001" xmlns="http://www.w3.org/2000/svg">
|
|
56
56
|
<path d="M103.1 485.8c4.2 7 5.7 14 5.7 22.4 0 28-23.8 65.9-43.4 91.1H20.5L2.3 491.5l40.6-2.8 9.8 77.1c8.4-14 19.7-37.9 19.7-53.2 0-8.4-1.4-14-4.2-19.7zm51.8 47.7c7 0 25.2-2.8 25.2-14 0-5.7-2.8-7-7-7-8.3 0-18.2 8.4-18.2 21zm-1.3 21c0 12.7 7 18.2 16.8 18.2s19.7-2.8 32.2-8.4l-5.7 30.8c-8.4 4.2-22.4 7-36.4 7-33.5 0-46.2-21-46.2-46.2 0-33.5 19.7-68.6 60.2-68.6 22.4 0 35 12.7 35 30.8 1.5 26.6-35 36.4-55.9 36.4zM324.4 511c0 4.2 0 9.8-1.4 14l-11.2 74.2H274l11.2-68.6c0-1.4 1.4-5.7 1.4-7 0-5.7-2.8-5.7-7-5.7-5.7 0-9.8 2.8-12.7 4.2l-14 77.1H215l16.8-112.1h33.5v8.4c8.4-5.7 18.2-11.2 32.2-11.2 19.9 3 26.9 12.7 26.9 26.7zm113.4-12.5c11.2-8.4 21-12.7 35-12.7 19.7 0 26.7 9.8 26.7 25.2 0 4.2 0 9.8-1.4 14L487 599.3h-37.9l11.2-70v-5.7c0-5.7-2.8-7-7-7s-9.8 1.4-12.7 4.2L428 599.2h-37.9l11.2-70v-5.7c0-5.7-2.8-7-7-7-5.7 0-9.8 2.8-12.7 4.2L369 599h-37.9L348 487h32.2l1.4 9.8c7-5.7 18.2-11.2 32.2-11.2 11.4 1.7 19.7 5.9 24 12.9zM575 532.1c0-9.8-2.8-15.4-9.8-15.4-15.4 0-18.2 26.7-18.2 40.6 0 9.8 2.8 16.8 9.8 16.8 15.5-1.4 18.2-29.4 18.2-42zm-65.8 22.4c0-35 18.2-68.6 61.6-68.6 32.2 0 43.4 19.7 43.4 44.9 0 35-18.2 70-61.6 70-32.2 1.3-43.4-19.7-43.4-46.3z"
|
|
57
57
|
fill="currentColor"/>
|
|
58
|
-
</svg>`;class jl{constructor(t){C(this,"isProcessing",!1);C(this,"container");C(this,"venmoButton");C(this,"events",{ready:new he});C(this,"braintree");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.braintree=this.config.service.braintree;const e=this.config.state.styles.getState().BraintreeButton;this.container=document.createElement("div"),this.container.classList.add(Pt.conteiner),this.venmoButton=document.createElement("button"),this.venmoButton.classList.add(Pt.venmo,Pt.hidden),e!=null&&e.className&&this.venmoButton.classList.add(e.className),e!=null&&e.styles&&Object.assign(this.venmoButton.style,e.styles),this.venmoButton.setAttribute("aria-label","Venmo"),this.venmoButton.innerHTML=Ul,this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none",this.container.append(this.venmoButton)}init(t){return W(this,null,function*(){var n;if(!this.config)return!1;const e=this.config.state.transaction.getState();if(console.log("----- init braintree venmo: ",e),!e||Object.keys(e).length===0)return console.error("Braintree Venmo transaction data is empty or invalid"),!1;try{return yield this.braintree.init({authorization:((n=e==null?void 0:e.brain_tree_info)==null?void 0:n.client_token)||""}),yield this.braintree.createVenmo({}),this.braintree.isBrowserSupported()?(this.displayVenmoButton(t),this.braintree.hasTokenizationResult()?(yield this.handleExistingTokenization(t),!1):(this.venmoButton.classList.remove(Pt.hidden),this.container.append(this.error.render()),this.isInitialized=!0,this.events.ready.emit(),!0)):(console.log("Browser does not support Venmo"),this.handleVenmoError(new Error("Browser does not support Venmo")),!1)}catch(a){return console.error("Error initializing Venmo:",a),this.handleVenmoError(a),!1}})}displayVenmoButton(t){Object.assign(this.venmoButton.style,Fl),this.venmoButton.addEventListener("click",()=>W(this,null,function*(){if(Te.hideAll(),!this.isProcessing){this.isProcessing=!0,this.venmoButton.disabled=!0;try{const e=yield this.braintree.tokenize();this.handleVenmoSuccess(e,t)}catch(e){this.handleVenmoError(e,t)}finally{this.isProcessing=!1,this.venmoButton.disabled=!1}}}))}handleExistingTokenization(t){return W(this,null,function*(){try{const e=yield this.braintree.tokenize();this.handleVenmoSuccess(e,t)}catch(e){this.handleVenmoError(e,t)}})}handleVenmoSuccess(t,e){var n;console.log("Venmo payment successful:",t),this.error.render().style.display="none",(n=e.onSuccess)==null||n.call(e,t)}handleVenmoError(t,e){var s,l;if(console.error("Venmo error:",t),!this.isInitialized)return;const n=this.config.state.translate.messages(),a=Ze(t,n),i=Se(n)[a],o=((s=n.errors)==null?void 0:s.errorText)||"Error";this.error.setMessage(`Venmo ${o.toLowerCase()}: ${i!=null?i:a}`),this.error.render().style.display="",(l=e==null?void 0:e.onError)==null||l.call(e,t)}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("Venmo error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=e.errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`Venmo ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.container}}class zl{constructor(t){C(this,"isAppleReady",!0);C(this,"isGoogleReady",!0);C(this,"isPayPalReady",!0);C(this,"isBraintreeReady",!0);C(this,"buttons");C(this,"applePay");C(this,"googlePay");C(this,"paypal");C(this,"card");C(this,"braintree");C(this,"lastInteracted",null);C(this,"events",{ready:new he,open:new he,error:new he,cancel:new he,success:new he});this.config=t,this.buttons=document.createElement("div"),this.buttons.classList.add(_r.buttons,_r.hidden)}init(){return W(this,null,function*(){this.config.state.transaction.subscribe(()=>{this.config.service.ev.isReady&&this.initPaymentMethods().catch(console.error)}),this.config.state.checkout.subscribe(()=>{this.config.service.ev.isReady&&this.initPaymentMethods().catch(console.error)}),this.config.service.ev.addEventListener("ready",()=>{this.initPaymentMethods().catch(console.error)})})}initApple(t){return W(this,null,function*(){if(this.applePay){this.isAppleReady=!1;try{(yield this.applePay.init({onError:n=>this.events.error.emit(n),onCancel:()=>this.events.cancel.emit(),onSuccess:n=>{this.lastInteracted="apple",this.events.success.emit(ee(K({},n),{type:"apple"}))}}))?t==null||t.appendChild(this.applePay.render()):t==null||t.remove()}catch(e){console.error(e),t==null||t.remove()}finally{this.isAppleReady=!0}}})}initGoogle(t){return W(this,null,function*(){if(this.googlePay){this.isGoogleReady=!1;try{(yield this.googlePay.init({onError:n=>this.events.error.emit(n),onCancel:()=>this.events.cancel.emit(),onSuccess:n=>{this.lastInteracted="google",this.events.success.emit(ee(K({},n),{type:"google"}))}}))?t==null||t.appendChild(this.googlePay.render()):t==null||t.remove()}catch(e){console.error(e),t==null||t.remove()}finally{this.isGoogleReady=!0}}})}initPayPal(t){return W(this,null,function*(){if(this.paypal){this.isPayPalReady=!1;try{(yield this.paypal.init({onError:
|
|
58
|
+
</svg>`;class jl{constructor(t){C(this,"isProcessing",!1);C(this,"container");C(this,"venmoButton");C(this,"events",{ready:new he});C(this,"braintree");C(this,"error");C(this,"isInitialized",!1);this.config=t,this.braintree=this.config.service.braintree;const e=this.config.state.styles.getState().BraintreeButton;this.container=document.createElement("div"),this.container.classList.add(Pt.conteiner),this.venmoButton=document.createElement("button"),this.venmoButton.classList.add(Pt.venmo,Pt.hidden),e!=null&&e.className&&this.venmoButton.classList.add(e.className),e!=null&&e.styles&&Object.assign(this.venmoButton.style,e.styles),this.venmoButton.setAttribute("aria-label","Venmo"),this.venmoButton.innerHTML=Ul,this.error=new Te(this.config.state.translate),this.error.setMessage(""),this.error.render().style.display="none",this.container.append(this.venmoButton)}init(t){return W(this,null,function*(){var n;if(!this.config)return!1;const e=this.config.state.transaction.getState();if(console.log("----- init braintree venmo: ",e),!e||Object.keys(e).length===0)return console.error("Braintree Venmo transaction data is empty or invalid"),!1;try{return yield this.braintree.init({authorization:((n=e==null?void 0:e.brain_tree_info)==null?void 0:n.client_token)||""}),yield this.braintree.createVenmo({}),this.braintree.isBrowserSupported()?(this.displayVenmoButton(t),this.braintree.hasTokenizationResult()?(yield this.handleExistingTokenization(t),!1):(this.venmoButton.classList.remove(Pt.hidden),this.container.append(this.error.render()),this.isInitialized=!0,this.events.ready.emit(),!0)):(console.log("Browser does not support Venmo"),this.handleVenmoError(new Error("Browser does not support Venmo")),!1)}catch(a){return console.error("Error initializing Venmo:",a),this.handleVenmoError(a),!1}})}displayVenmoButton(t){Object.assign(this.venmoButton.style,Fl),this.venmoButton.addEventListener("click",()=>W(this,null,function*(){if(Te.hideAll(),!this.isProcessing){this.isProcessing=!0,this.venmoButton.disabled=!0;try{const e=yield this.braintree.tokenize();this.handleVenmoSuccess(e,t)}catch(e){this.handleVenmoError(e,t)}finally{this.isProcessing=!1,this.venmoButton.disabled=!1}}}))}handleExistingTokenization(t){return W(this,null,function*(){try{const e=yield this.braintree.tokenize();this.handleVenmoSuccess(e,t)}catch(e){this.handleVenmoError(e,t)}})}handleVenmoSuccess(t,e){var n;console.log("Venmo payment successful:",t),this.error.render().style.display="none",(n=e.onSuccess)==null||n.call(e,t)}handleVenmoError(t,e){var s,l;if(console.error("Venmo error:",t),!this.isInitialized)return;const n=this.config.state.translate.messages(),a=Ze(t,n),i=Se(n)[a],o=((s=n.errors)==null?void 0:s.errorText)||"Error";this.error.setMessage(`Venmo ${o.toLowerCase()}: ${i!=null?i:a}`),this.error.render().style.display="",(l=e==null?void 0:e.onError)==null||l.call(e,t)}addEventListener(t,e){return this.events[t].addListener(e)}showExternalError(t){var i;if(!this.isInitialized){console.error("Venmo error:",t);return}const e=this.config.state.translate.messages(),n=Se(e)[t],a=((i=e.errors)==null?void 0:i.errorText)||"Error";this.error.setMessage(`Venmo ${a.toLowerCase()}: ${n!=null?n:t}`),this.error.render().style.display=""}render(){return this.container}}class zl{constructor(t){C(this,"isAppleReady",!0);C(this,"isGoogleReady",!0);C(this,"isPayPalReady",!0);C(this,"isBraintreeReady",!0);C(this,"buttons");C(this,"applePay");C(this,"googlePay");C(this,"paypal");C(this,"card");C(this,"braintree");C(this,"lastInteracted",null);C(this,"events",{ready:new he,open:new he,error:new he,cancel:new he,success:new he});this.config=t,this.buttons=document.createElement("div"),this.buttons.classList.add(_r.buttons,_r.hidden)}init(){return W(this,null,function*(){this.config.state.transaction.subscribe(()=>{this.config.service.ev.isReady&&this.initPaymentMethods().catch(console.error)}),this.config.state.checkout.subscribe(()=>{this.config.service.ev.isReady&&this.initPaymentMethods().catch(console.error)}),this.config.service.ev.addEventListener("ready",()=>{this.initPaymentMethods().catch(console.error)})})}initApple(t){return W(this,null,function*(){if(this.applePay){this.isAppleReady=!1;try{(yield this.applePay.init({onError:n=>this.events.error.emit(n),onCancel:()=>this.events.cancel.emit(),onSuccess:n=>{this.lastInteracted="apple",this.events.success.emit(ee(K({},n),{type:"apple"}))}}))?t==null||t.appendChild(this.applePay.render()):t==null||t.remove()}catch(e){console.error(e),t==null||t.remove()}finally{this.isAppleReady=!0}}})}initGoogle(t){return W(this,null,function*(){if(this.googlePay){this.isGoogleReady=!1;try{(yield this.googlePay.init({onError:n=>this.events.error.emit(n),onCancel:()=>this.events.cancel.emit(),onSuccess:n=>{this.lastInteracted="google",this.events.success.emit(ee(K({},n),{type:"google"}))}}))?t==null||t.appendChild(this.googlePay.render()):t==null||t.remove()}catch(e){console.error(e),t==null||t.remove()}finally{this.isGoogleReady=!0}}})}initPayPal(t){return W(this,null,function*(){if(this.paypal){this.isPayPalReady=!1;try{const e=this.paypal.render();t==null||t.appendChild(e),(yield this.paypal.init({onError:a=>this.events.error.emit(a),onCancel:()=>this.events.cancel.emit(),onSuccess:a=>{this.lastInteracted="paypal",this.events.success.emit({paypalId:a,type:"paypal"})}}))||t==null||t.remove()}catch(e){t==null||t.remove()}finally{this.isPayPalReady=!0}}})}initBraintreeVenmo(t){return W(this,null,function*(){if(this.braintree){this.isBraintreeReady=!1;try{(yield this.braintree.init({onError:n=>this.events.error.emit(n),onCancel:()=>this.events.cancel.emit(),onSuccess:n=>{this.lastInteracted="venmo",this.events.success.emit({nonce:n==null?void 0:n.nonce,type:"venmo"})}}))?t==null||t.appendChild(this.braintree.render()):t==null||t.remove()}catch(e){console.error(e),t==null||t.remove()}finally{this.isBraintreeReady=!0}}})}initCard(t){return W(this,null,function*(){this.card&&(t==null||t.appendChild(this.card.render()))})}initPaymentMethods(){return W(this,null,function*(){const t=this.config.state.transaction.getState(),e=Vl(Pl,(t==null?void 0:t.checkout_config)||[],(l,c)=>l.type===c.type),n=this.config.state.checkout.getState();let a=e.filter(({is_active:l})=>l);(n==null?void 0:n.variant)==="default"&&(a=a.filter(({type:l})=>l!==re.CARD)),this.initializeButtonInstances(a),this.buttons.innerHTML="";const i=a.sort((l,c)=>l.order-c.order),o=new Map;for(const{type:l}of i){const c=document.createElement("div");this.buttons.appendChild(c),o.set(l,c)}const s=i.map(({type:l})=>{const c=o.get(l);switch(l){case re.APPLE_PAY:return this.initApple(c);case re.GOOGLE_PAY:return this.initGoogle(c);case re.PAYPAL:return this.initPayPal(c);case re.VENMO:return this.initBraintreeVenmo(c);case re.CARD:return this.initCard(c);default:throw new Error("Unknown button type")}});yield Promise.all(s),this.handleReady()})}initializeButtonInstances(t){const e=t.map(({type:n})=>n);e.includes(re.APPLE_PAY)&&!this.applePay&&(this.applePay=new Ll(this.config)),e.includes(re.GOOGLE_PAY)&&!this.googlePay&&(this.googlePay=new Rl(this.config)),e.includes(re.PAYPAL)&&!this.paypal&&(this.paypal=new Sl(this.config)),e.includes(re.VENMO)&&!this.braintree&&(this.braintree=new jl(this.config)),e.includes(re.CARD)&&!this.card&&(this.card=new Ml(this.config),this.card.addEventListener(()=>{this.lastInteracted="card",this.events.open.emit()}))}handleReady(){this.isAppleReady&&this.isGoogleReady&&this.isPayPalReady&&this.isBraintreeReady&&this.events.ready.emit()}addEventListener(t,e){return this.events[t].addListener(e)}showButton(){this.buttons.classList.remove(_r.hidden)}render(){return this.buttons}showExternalError(t){var e,n,a,i;switch(this.lastInteracted){case"apple":(e=this.applePay)==null||e.showExternalError(t);break;case"google":(n=this.googlePay)==null||n.showExternalError(t);break;case"paypal":(a=this.paypal)==null||a.showExternalError(t);break;case"venmo":(i=this.braintree)==null||i.showExternalError(t);break}}}class Bl{constructor(){C(this,"template",`
|
|
59
59
|
<svg
|
|
60
60
|
xmlns='http://www.w3.org/2000/svg'
|
|
61
61
|
width='24'
|
|
@@ -371,7 +371,7 @@ ${m}::-ms-input-placeholder{${f}}
|
|
|
371
371
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
372
372
|
* See the License for the specific language governing permissions and
|
|
373
373
|
* limitations under the License.
|
|
374
|
-
*/function Ec(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(r);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(r,n[a])&&(e[n[a]]=r[n[a]]);return e}typeof SuppressedError=="function"&&SuppressedError;function Cc(r,t){var e=document.querySelector('script[src="'.concat(r,'"]'));if(e===null)return null;var n=Di(r,t),a=e.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(n.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach(function(o){a.dataset[o]!==n.dataset[o]&&(i=!1)}),i?e:null}function wc(r){var t=r.url,e=r.attributes,n=r.onSuccess,a=r.onError,i=Di(t,e);i.onerror=a,i.onload=n,document.head.insertBefore(i,document.head.firstElementChild)}function Ac(r){var t=r.sdkBaseUrl,e=r.environment,n=Ec(r,["sdkBaseUrl","environment"]),a=t||xc(e),i=n,o=Object.keys(i).filter(function(c){return typeof i[c]!="undefined"&&i[c]!==null&&i[c]!==""}).reduce(function(c,d){var u=i[d].toString();return d=Tc(d),d.substring(0,4)==="data"||d==="crossorigin"?c.attributes[d]=u:c.queryParams[d]=u,c},{queryParams:{},attributes:{}}),s=o.queryParams,l=o.attributes;return s["merchant-id"]&&s["merchant-id"].indexOf(",")!==-1&&(l["data-merchant-id"]=s["merchant-id"],s["merchant-id"]="*"),{url:"".concat(a,"?").concat(Ic(s)),attributes:l}}function Tc(r){var t=function(e,n){return(n?"-":"")+e.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,t)}function Ic(r){var t="";return Object.keys(r).forEach(function(e){t.length!==0&&(t+="&"),t+=e+"="+r[e]}),t}function xc(r){return r==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function Di(r,t){t===void 0&&(t={});var e=document.createElement("script");return e.src=r,Object.keys(t).forEach(function(n){e.setAttribute(n,t[n]),n==="data-csp-nonce"&&e.setAttribute("nonce",t["data-csp-nonce"])}),e}function Nc(r,t){if(t===void 0&&(t=Promise),Vi(r,t),typeof document=="undefined")return t.resolve(null);var e=Ac(r),n=e.url,a=e.attributes,i=a["data-namespace"]||"paypal",o=Mi(i);return a["data-js-sdk-library"]||(a["data-js-sdk-library"]="paypal-js"),Cc(n,a)&&o?t.resolve(o):kc({url:n,attributes:a},t).then(function(){var s=Mi(i);if(s)return s;throw new Error("The window.".concat(i," global variable is not available."))})}function kc(r,t){t===void 0&&(t=Promise),Vi(r,t);var e=r.url,n=r.attributes;if(typeof e!="string"||e.length===0)throw new Error("Invalid url.");if(typeof n!="undefined"&&typeof n!="object")throw new Error("Expected attributes to be an object.");return new t(function(a,i){if(typeof document=="undefined")return a();wc({url:e,attributes:n,onSuccess:function(){return a()},onError:function(){var o=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return i(o)}})})}function Mi(r){return window[r]}function Vi(r,t){if(typeof r!="object"||r===null)throw new Error("Expected an options object.");var e=r.environment;if(e&&e!=="production"&&e!=="sandbox")throw new Error('The `environment` option must be either "production" or "sandbox".');if(typeof t!="undefined"&&typeof t!="function")throw new Error("Expected PromisePonyfill to be a function.")}const Oc={layout:"vertical",tagline:!1,height:40,borderRadius:12};class Lc{constructor(){C(this,"paypal",null)}init(t){return W(this,null,function*(){try{this.paypal=yield Nc(t)}catch(e){
|
|
374
|
+
*/function Ec(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(r);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(r,n[a])&&(e[n[a]]=r[n[a]]);return e}typeof SuppressedError=="function"&&SuppressedError;function Cc(r,t){var e=document.querySelector('script[src="'.concat(r,'"]'));if(e===null)return null;var n=Di(r,t),a=e.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(n.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach(function(o){a.dataset[o]!==n.dataset[o]&&(i=!1)}),i?e:null}function wc(r){var t=r.url,e=r.attributes,n=r.onSuccess,a=r.onError,i=Di(t,e);i.onerror=a,i.onload=n,document.head.insertBefore(i,document.head.firstElementChild)}function Ac(r){var t=r.sdkBaseUrl,e=r.environment,n=Ec(r,["sdkBaseUrl","environment"]),a=t||xc(e),i=n,o=Object.keys(i).filter(function(c){return typeof i[c]!="undefined"&&i[c]!==null&&i[c]!==""}).reduce(function(c,d){var u=i[d].toString();return d=Tc(d),d.substring(0,4)==="data"||d==="crossorigin"?c.attributes[d]=u:c.queryParams[d]=u,c},{queryParams:{},attributes:{}}),s=o.queryParams,l=o.attributes;return s["merchant-id"]&&s["merchant-id"].indexOf(",")!==-1&&(l["data-merchant-id"]=s["merchant-id"],s["merchant-id"]="*"),{url:"".concat(a,"?").concat(Ic(s)),attributes:l}}function Tc(r){var t=function(e,n){return(n?"-":"")+e.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,t)}function Ic(r){var t="";return Object.keys(r).forEach(function(e){t.length!==0&&(t+="&"),t+=e+"="+r[e]}),t}function xc(r){return r==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function Di(r,t){t===void 0&&(t={});var e=document.createElement("script");return e.src=r,Object.keys(t).forEach(function(n){e.setAttribute(n,t[n]),n==="data-csp-nonce"&&e.setAttribute("nonce",t["data-csp-nonce"])}),e}function Nc(r,t){if(t===void 0&&(t=Promise),Vi(r,t),typeof document=="undefined")return t.resolve(null);var e=Ac(r),n=e.url,a=e.attributes,i=a["data-namespace"]||"paypal",o=Mi(i);return a["data-js-sdk-library"]||(a["data-js-sdk-library"]="paypal-js"),Cc(n,a)&&o?t.resolve(o):kc({url:n,attributes:a},t).then(function(){var s=Mi(i);if(s)return s;throw new Error("The window.".concat(i," global variable is not available."))})}function kc(r,t){t===void 0&&(t=Promise),Vi(r,t);var e=r.url,n=r.attributes;if(typeof e!="string"||e.length===0)throw new Error("Invalid url.");if(typeof n!="undefined"&&typeof n!="object")throw new Error("Expected attributes to be an object.");return new t(function(a,i){if(typeof document=="undefined")return a();wc({url:e,attributes:n,onSuccess:function(){return a()},onError:function(){var o=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return i(o)}})})}function Mi(r){return window[r]}function Vi(r,t){if(typeof r!="object"||r===null)throw new Error("Expected an options object.");var e=r.environment;if(e&&e!=="production"&&e!=="sandbox")throw new Error('The `environment` option must be either "production" or "sandbox".');if(typeof t!="undefined"&&typeof t!="function")throw new Error("Expected PromisePonyfill to be a function.")}const Oc={layout:"vertical",tagline:!1,height:40,borderRadius:12};class Lc{constructor(){C(this,"paypal",null)}init(t){return W(this,null,function*(){try{this.paypal=yield Nc(t)}catch(e){throw this.paypal=null,e}})}isLoaded(){return this.paypal!==null&&this.paypal.Buttons!==void 0}render(t,e){return W(this,null,function*(){var n,a;if(!t.isConnected)throw new Error("PayPal parent element must be connected to DOM before render()");if(this.paypal){const i=K(K({},Oc),(e==null?void 0:e.style)||{}),o=ee(K({fundingSource:"paypal"},e),{style:i}),s=(a=(n=this.paypal).Buttons)==null?void 0:a.call(n,o);if(!s)throw new Error("PayPal Buttons instance is null");console.log("PayPalService: Buttons instance created, calling render()..."),yield s.render(t)}})}}function we(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Or={exports:{}},Fi;function Pc(){return Fi||(Fi=1,function(r,t){(function(e){r.exports=e()})(function(){return function(){function e(n,a,i){function o(c,d){if(!a[c]){if(!n[c]){var u=typeof we=="function"&&we;if(!d&&u)return u(c,!0);if(s)return s(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var p=a[c]={exports:{}};n[c][0].call(p.exports,function(f){var m=n[c][1][f];return o(m||f)},p,p.exports,e,n,a,i)}return a[c].exports}for(var s=typeof we=="function"&&we,l=0;l<i.length;l++)o(i[l]);return o}return e}()({1:[function(e,n,a){var i={};function o(s){var l,c=JSON.stringify(s);if(!s.forceScriptReload&&(l=i[c],l))return l;var d=document.createElement("script"),u=s.dataAttributes||{},h=s.container||document.head;return d.src=s.src,d.id=s.id||"",d.async=!0,s.type&&d.setAttribute("type","".concat(s.type)),s.crossorigin&&d.setAttribute("crossorigin","".concat(s.crossorigin)),s.integrity&&d.setAttribute("integrity","".concat(s.integrity)),Object.keys(u).forEach(function(p){d.setAttribute("data-".concat(p),"".concat(u[p]))}),l=new Promise(function(p,f){d.addEventListener("load",function(){p(d)}),d.addEventListener("error",function(){f(new Error("".concat(s.src," failed to load.")))}),d.addEventListener("abort",function(){f(new Error("".concat(s.src," has aborted.")))}),h.appendChild(d)}),i[c]=l,l}o.clearCache=function(){i={}},n.exports=o},{}],2:[function(e,n,a){n.exports=e("./dist/load-script")},{"./dist/load-script":1}],3:[function(e,n,a){function i(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var s=Math.random()*16|0,l=o==="x"?s:s&3|8;return l.toString(16)})}n.exports=i},{}],4:[function(e,n,a){Object.defineProperty(a,"__esModule",{value:!0});function i(o){return function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];setTimeout(function(){try{o.apply(void 0,s)}catch(c){console.log("Error in callback function"),console.log(c)}},1)}}a.deferred=i},{}],5:[function(e,n,a){Object.defineProperty(a,"__esModule",{value:!0});function i(o){var s=!1;return function(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];s||(s=!0,o.apply(void 0,l))}}a.once=i},{}],6:[function(e,n,a){Object.defineProperty(a,"__esModule",{value:!0});function i(o,s){if(!s)return o;o.then(function(l){return s(null,l)}).catch(function(l){return s(l)})}a.promiseOrCallback=i},{}],7:[function(e,n,a){var i=e("./lib/deferred"),o=e("./lib/once"),s=e("./lib/promise-or-callback");function l(c){return function(){for(var d=[],u=0;u<arguments.length;u++)d[u]=arguments[u];var h,p=d[d.length-1];return typeof p=="function"&&(h=d.pop(),h=o.once(i.deferred(h))),s.promiseOrCallback(c.apply(this,d),h)}}l.wrapPrototype=function(c,d){d===void 0&&(d={});var u=d.ignoreMethods||[],h=d.transformPrivateMethods===!0,p=Object.getOwnPropertyNames(c.prototype).filter(function(f){var m,v=f!=="constructor"&&typeof c.prototype[f]=="function",y=u.indexOf(f)===-1;return h?m=!0:m=f.charAt(0)!=="_",v&&m&&y});return p.forEach(function(f){var m=c.prototype[f];c.prototype[f]=l(m)}),c},n.exports=l},{"./lib/deferred":4,"./lib/once":5,"./lib/promise-or-callback":6}],8:[function(e,n,a){(function(i,o){typeof a=="object"&&typeof n!="undefined"?o(a):(i=typeof globalThis!="undefined"?globalThis:i||self,o(i.loadAxo={}))})(this,function(i){/*! *****************************************************************************
|
|
375
375
|
Copyright (c) Microsoft Corporation.
|
|
376
376
|
|
|
377
377
|
Permission to use, copy, modify, and/or distribute this software for any
|