@paynext/sdk 0.0.135 → 0.0.136

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.umd.js CHANGED
@@ -26,7 +26,7 @@
26
26
  <%s {...props} />
27
27
  React keys must be passed directly to JSX without using spread:
28
28
  let props = %s;
29
- <%s key={someKey} {...props} />`,S,x,X,x),E[x+S]=!0)}if(x=null,W!==void 0&&(n(W),x=""+W),o(P)&&(n(P.key),x=""+P.key),"key"in P){W={};for(var ne in P)ne!=="key"&&(W[ne]=P[ne])}else W=P;return x&&a(W,typeof v=="function"?v.displayName||v.name||"Unknown":v),u(v,x,T,R,i(),W,F,G)}function l(v){typeof v=="object"&&v!==null&&v.$$typeof===p&&v._store&&(v._store.validated=1)}var f=ge,p=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),C=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),Y=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,U=Array.isArray,z=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(v){return v()}};var Q,B={},K=f.react_stack_bottom_frame.bind(f,s)(),H=z(r(s)),E={};Ai.Fragment=m,Ai.jsx=function(v,P,W,S,R){var T=1e4>Y.recentlyCreatedOwnerStacks++;return d(v,P,W,!1,S,R,T?Error("react-stack-top-frame"):K,T?z(r(v)):H)},Ai.jsxs=function(v,P,W,S,R){var T=1e4>Y.recentlyCreatedOwnerStacks++;return d(v,P,W,!0,S,R,T?Error("react-stack-top-frame"):K,T?z(r(v)):H)}}()),Ai}var Gf;function b1(){return Gf||(Gf=1,process.env.NODE_ENV==="production"?Es.exports=_1():Es.exports=y1()),Es.exports}b1();const v1=[Hn.Mastercard,Hn.Visa],Ss=(t,e)=>(console.error("Error: ",t),e.status.error);class E1{constructor(e){N(this,"element");N(this,"events",{ready:new qe});N(this,"ev");N(this,"customButtonStyles");N(this,"isInitialized",!1);N(this,"onPaymentAttempt");this.config=e;const n=this.config.state.styles.getState().ApplePayButton;this.onPaymentAttempt=this.config.state.checkout.getState().onCheckoutAttempt,this.ev=this.config.service.ev,this.customButtonStyles=n,this.element=document.createElement("div"),this.element.classList.add(Qa.applePay,Qa.hidden)}init(e){return j(this,null,function*(){if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.translate.locale(),i=f1(n);if(!i)return!1;const s=e?$(y({},e),{onError:o=>{var c,u,d;if(!this.isInitialized){console.error("Apple Pay error:",o);return}const a=this.config.state.translate.messages();(c=o==null?void 0:o.toLowerCase())!=null&&c.includes("cancelled")?(u=e.onCancel)==null||u.call(e):(Ss(o,a),(d=e.onError)==null||d.call(e,{e:o,paymentMethod:J.APPLE_PAY}))},onSuccess:o=>{var a;(a=e.onSuccess)==null||a.call(e,o)}}):void 0;return yield this.ev.initApple($(y({},s),{transaction:i,supportedCardTypes:p1(v1),locale:h1(r||"en"),onPaymentAttempt:this.onPaymentAttempt}),this.customButtonStyles),this.ev.isAppleAvailable()?(yield this.ev.renderApple(this.element),this.isInitialized=!0,this.element.classList.remove(Qa.hidden),this.events.ready.emit(),!0):!1})}addEventListener(e,n){return this.events[e].addListener(n)}render(){return this.element}}const S1=[{type:J.PAYPAL,is_active:!1,order:1},{type:J.APPLE_PAY,is_active:!1,order:2},{type:J.GOOGLE_PAY,is_active:!1,order:3},{type:J.VENMO,is_active:!1,order:4},{type:J.CARD,is_active:!0,order:5}],Ir={open:{y:0,opacity:1},close:{y:100,opacity:0},transition:{duration:.25,ease:"easeOut"}},ws={open:{y:0,opacity:1},close:{y:-100,opacity:0},transition:{duration:.25,ease:"easeOut"}},st={open:{y:0,opacity:1},close:{y:15,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Tt={open:{y:0,opacity:1,height:"auto"},close:{y:-15,opacity:0,height:0},transition:{duration:.25,type:"spring",bounce:0}},ec={googlePay:"_googlePay_17y0j_1",hidden:"_hidden_17y0j_19"};class w1{constructor(e){N(this,"element");N(this,"events",{ready:new qe});N(this,"ev");N(this,"customButtonStyles");N(this,"isInitialized",!1);N(this,"onPaymentAttempt");this.config=e,this.ev=this.config.service.ev,this.customButtonStyles=this.config.state.styles.getState().GooglePayButton,this.onPaymentAttempt=this.config.state.checkout.getState().onCheckoutAttempt,this.element=document.createElement("div"),this.element.classList.add(ec.googlePay,ec.hidden)}init(e){return j(this,null,function*(){if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.translate.locale(),i=d1(n);if(!i)return!1;const s=e?$(y({},e),{onError:o=>{var a;if(!this.isInitialized){console.error("Google Pay error:",o);return}Ss(o,this.config.state.translate.messages()),(a=e.onError)==null||a.call(e,{e:o,paymentMethod:J.GOOGLE_PAY})},onSuccess:o=>{var a;(a=e.onSuccess)==null||a.call(e,o)}}):void 0;return yield this.ev.initGoogle($(y({},s),{transaction:i,locale:m1(r||"en"),onPaymentAttempt:this.onPaymentAttempt}),this.customButtonStyles),yield this.ev.renderGoogle(this.element),this.element.classList.remove(ec.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(e,n){return this.events[e].addListener(n)}render(){return this.element}}const tc={paypal:"_paypal_iyh6g_1",hidden:"_hidden_iyh6g_7"};class C1{constructor(e){N(this,"element");N(this,"events",{ready:new qe,onPaymentAttempt:new qe});N(this,"paypal");N(this,"customButtonStyles");N(this,"isInitialized",!1);this.config=e,this.paypal=this.config.service.paypal,this.customButtonStyles=this.config.state.styles.getState().PayPalButton,this.element=document.createElement("div"),this.element.classList.add(tc.paypal,tc.hidden)}init(e){return j(this,null,function*(){var o,a;if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.checkout.getState(),i=()=>j(this,null,function*(){try{return yield Bb(r.clientToken,r.environment,r.apiVersion)}catch(c){throw c}});if(!n||Object.keys(n).length===0)return console.error("PayPal transaction data is empty or invalid"),!1;if(!((o=n==null?void 0:n.paypal_info)!=null&&o.client_id))return!1;try{if(yield this.paypal.init({clientId:n.paypal_info.client_id,environment:n.paypal_info.environment||"sandbox",vault:!0,locale:g1(this.config.state.translate.locale()),intent:"tokenize"}),!this.paypal.isLoaded())return!1}catch(c){return!1}const s=e?$(y({},e),{onError:c=>{var d,l;if(!this.isInitialized){console.error("PayPal error:",c);return}!this.isUserCancellationError(c)&&c?(d=e.onError)==null||d.call(e,{e:c,paymentMethod:J.PAYPAL}):(l=e.onCancel)==null||l.call(e)},onCancel:()=>{var c;(c=e.onCancel)==null||c.call(e)},onSuccess:c=>{var u;(u=e.onSuccess)==null||u.call(e,c)}}):void 0;try{yield this.paypal.render(this.element,$(y({},s),{createBillingAgreement:i,onApprove:u=>j(this,[u],function*({billingToken:c}){var d;this.events.onPaymentAttempt.emit(J.PAYPAL),(d=s==null?void 0:s.onSuccess)==null||d.call(s,c||"")}),style:(a=this.customButtonStyles)==null?void 0:a.styles,onCancel:()=>{var c;(c=s==null?void 0:s.onCancel)==null||c.call(s)},onError:c=>{var d,l;const u=this.isUserCancellationError(c);!u&&c?(d=s==null?void 0:s.onError)==null||d.call(s,c):u&&((l=s==null?void 0:s.onCancel)==null||l.call(s))}}))}catch(c){return!1}return this.element.classList.remove(tc.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(e,n){return this.events[e].addListener(n)}isUserCancellationError(e){var i;if(!e)return!1;const n=typeof e=="string"?e:(e==null?void 0:e.message)||((i=e==null?void 0:e.status_reason)==null?void 0:i.message)||"";return["window is closed","window closed","popup closed","user closed","cancelled by user","user cancelled","popup close"].some(s=>{var o;return(o=n==null?void 0:n.toLowerCase())==null?void 0:o.includes(s)})}render(){return this.element}}class T1{constructor(){N(this,"template",`
29
+ <%s key={someKey} {...props} />`,S,x,X,x),E[x+S]=!0)}if(x=null,W!==void 0&&(n(W),x=""+W),o(P)&&(n(P.key),x=""+P.key),"key"in P){W={};for(var ne in P)ne!=="key"&&(W[ne]=P[ne])}else W=P;return x&&a(W,typeof v=="function"?v.displayName||v.name||"Unknown":v),u(v,x,T,R,i(),W,F,G)}function l(v){typeof v=="object"&&v!==null&&v.$$typeof===p&&v._store&&(v._store.validated=1)}var f=ge,p=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),C=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),Y=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,U=Array.isArray,z=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(v){return v()}};var Q,B={},K=f.react_stack_bottom_frame.bind(f,s)(),H=z(r(s)),E={};Ai.Fragment=m,Ai.jsx=function(v,P,W,S,R){var T=1e4>Y.recentlyCreatedOwnerStacks++;return d(v,P,W,!1,S,R,T?Error("react-stack-top-frame"):K,T?z(r(v)):H)},Ai.jsxs=function(v,P,W,S,R){var T=1e4>Y.recentlyCreatedOwnerStacks++;return d(v,P,W,!0,S,R,T?Error("react-stack-top-frame"):K,T?z(r(v)):H)}}()),Ai}var Gf;function b1(){return Gf||(Gf=1,process.env.NODE_ENV==="production"?Es.exports=_1():Es.exports=y1()),Es.exports}b1();const v1=[Hn.Mastercard,Hn.Visa],Ss=(t,e)=>(console.error("Error: ",t),e.status.error);class E1{constructor(e){N(this,"element");N(this,"events",{ready:new qe});N(this,"ev");N(this,"customButtonStyles");N(this,"isInitialized",!1);N(this,"onPaymentAttempt");this.config=e;const n=this.config.state.styles.getState().ApplePayButton;this.onPaymentAttempt=this.config.state.checkout.getState().onCheckoutAttempt,this.ev=this.config.service.ev,this.customButtonStyles=n,this.element=document.createElement("div"),this.element.classList.add(Qa.applePay,Qa.hidden)}init(e){return j(this,null,function*(){if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.translate.locale(),i=f1(n);if(!i)return!1;const s=e?$(y({},e),{onError:o=>{var u,d;if(!this.isInitialized){console.error("Apple Pay error:",o);return}const a=this.config.state.translate.messages();(typeof o=="string"?o:(o==null?void 0:o.message)||"").toLowerCase().includes("cancelled")?(u=e.onCancel)==null||u.call(e):(Ss(o,a),(d=e.onError)==null||d.call(e,{e:o,paymentMethod:J.APPLE_PAY}))},onSuccess:o=>{var a;(a=e.onSuccess)==null||a.call(e,o)}}):void 0;return yield this.ev.initApple($(y({},s),{transaction:i,supportedCardTypes:p1(v1),locale:h1(r||"en"),onPaymentAttempt:this.onPaymentAttempt}),this.customButtonStyles),this.ev.isAppleAvailable()?(yield this.ev.renderApple(this.element),this.isInitialized=!0,this.element.classList.remove(Qa.hidden),this.events.ready.emit(),!0):!1})}addEventListener(e,n){return this.events[e].addListener(n)}render(){return this.element}}const S1=[{type:J.PAYPAL,is_active:!1,order:1},{type:J.APPLE_PAY,is_active:!1,order:2},{type:J.GOOGLE_PAY,is_active:!1,order:3},{type:J.VENMO,is_active:!1,order:4},{type:J.CARD,is_active:!0,order:5}],Ir={open:{y:0,opacity:1},close:{y:100,opacity:0},transition:{duration:.25,ease:"easeOut"}},ws={open:{y:0,opacity:1},close:{y:-100,opacity:0},transition:{duration:.25,ease:"easeOut"}},st={open:{y:0,opacity:1},close:{y:15,opacity:0},transition:{duration:.25,type:"spring",bounce:0}},Tt={open:{y:0,opacity:1,height:"auto"},close:{y:-15,opacity:0,height:0},transition:{duration:.25,type:"spring",bounce:0}},ec={googlePay:"_googlePay_17y0j_1",hidden:"_hidden_17y0j_19"};class w1{constructor(e){N(this,"element");N(this,"events",{ready:new qe});N(this,"ev");N(this,"customButtonStyles");N(this,"isInitialized",!1);N(this,"onPaymentAttempt");this.config=e,this.ev=this.config.service.ev,this.customButtonStyles=this.config.state.styles.getState().GooglePayButton,this.onPaymentAttempt=this.config.state.checkout.getState().onCheckoutAttempt,this.element=document.createElement("div"),this.element.classList.add(ec.googlePay,ec.hidden)}init(e){return j(this,null,function*(){if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.translate.locale(),i=d1(n);if(!i)return!1;const s=e?$(y({},e),{onError:o=>{var a;if(!this.isInitialized){console.error("Google Pay error:",o);return}Ss(o,this.config.state.translate.messages()),(a=e.onError)==null||a.call(e,{e:o,paymentMethod:J.GOOGLE_PAY})},onSuccess:o=>{var a;(a=e.onSuccess)==null||a.call(e,o)}}):void 0;return yield this.ev.initGoogle($(y({},s),{transaction:i,locale:m1(r||"en"),onPaymentAttempt:this.onPaymentAttempt}),this.customButtonStyles),yield this.ev.renderGoogle(this.element),this.element.classList.remove(ec.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(e,n){return this.events[e].addListener(n)}render(){return this.element}}const tc={paypal:"_paypal_iyh6g_1",hidden:"_hidden_iyh6g_7"};class C1{constructor(e){N(this,"element");N(this,"events",{ready:new qe,onPaymentAttempt:new qe});N(this,"paypal");N(this,"customButtonStyles");N(this,"isInitialized",!1);this.config=e,this.paypal=this.config.service.paypal,this.customButtonStyles=this.config.state.styles.getState().PayPalButton,this.element=document.createElement("div"),this.element.classList.add(tc.paypal,tc.hidden)}init(e){return j(this,null,function*(){var o,a;if(!this.config)return!1;const n=this.config.state.transaction.getState(),r=this.config.state.checkout.getState(),i=()=>j(this,null,function*(){try{return yield Bb(r.clientToken,r.environment,r.apiVersion)}catch(c){throw c}});if(!n||Object.keys(n).length===0)return console.error("PayPal transaction data is empty or invalid"),!1;if(!((o=n==null?void 0:n.paypal_info)!=null&&o.client_id))return!1;try{if(yield this.paypal.init({clientId:n.paypal_info.client_id,environment:n.paypal_info.environment||"sandbox",vault:!0,locale:g1(this.config.state.translate.locale()),intent:"tokenize"}),!this.paypal.isLoaded())return!1}catch(c){return!1}const s=e?$(y({},e),{onError:c=>{var d,l;if(!this.isInitialized){console.error("PayPal error:",c);return}!this.isUserCancellationError(c)&&c?(d=e.onError)==null||d.call(e,{e:c,paymentMethod:J.PAYPAL}):(l=e.onCancel)==null||l.call(e)},onCancel:()=>{var c;(c=e.onCancel)==null||c.call(e)},onSuccess:c=>{var u;(u=e.onSuccess)==null||u.call(e,c)}}):void 0;try{yield this.paypal.render(this.element,$(y({},s),{createBillingAgreement:i,onApprove:u=>j(this,[u],function*({billingToken:c}){var d;this.events.onPaymentAttempt.emit(J.PAYPAL),(d=s==null?void 0:s.onSuccess)==null||d.call(s,c||"")}),style:(a=this.customButtonStyles)==null?void 0:a.styles,onCancel:()=>{var c;(c=s==null?void 0:s.onCancel)==null||c.call(s)},onError:c=>{var d,l;const u=this.isUserCancellationError(c);!u&&c?(d=s==null?void 0:s.onError)==null||d.call(s,c):u&&((l=s==null?void 0:s.onCancel)==null||l.call(s))}}))}catch(c){return!1}return this.element.classList.remove(tc.hidden),this.isInitialized=!0,this.events.ready.emit(),!0})}addEventListener(e,n){return this.events[e].addListener(n)}isUserCancellationError(e){var i;if(!e)return!1;const n=typeof e=="string"?e:(e==null?void 0:e.message)||((i=e==null?void 0:e.status_reason)==null?void 0:i.message)||"";return["window is closed","window closed","popup closed","user closed","cancelled by user","user cancelled","popup close"].some(s=>{var o;return(o=n==null?void 0:n.toLowerCase())==null?void 0:o.includes(s)})}render(){return this.element}}class T1{constructor(){N(this,"template",`
30
30
  <svg xmlns="http://www.w3.org/2000/svg"
31
31
  width="24"
32
32
  height="24"