(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{"1TXt":function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return E}));var r=n("o0o1"),a=n.n(r),o=(n("ls82"),n("HaE+")),i=n("zLVn"),s=n("q1tI"),c=n.n(s),u="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",p=null,f=function(e){return null!==p?p:p=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(u,'"]')),t=0;t<e.length;t++){var n=e[t];if(l.test(n.src))return n}return null}();r&&e?console.warn(d):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(u).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n}(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(a){return void n(a)}else t(null)}))},v=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:t})}(r,n),r},w=Promise.resolve().then((function(){return f(null)})),m=!1;w.catch((function(e){m||console.warn(e)}));var b=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];m=!0;var r=Date.now();return w.then((function(e){return v(e,t,r)}))},y=n("Qgyz"),h=n.n(y),S=n("vOnD"),g=n("XZqO"),j=n.n(g),x=n("zGJ3"),k=n("iae6");function E(e){var t=Object(x.mergeProps)(e,E),n=t.payServer;"undefined"===n&&(n="https://pay.arcblock.io/create-session");var r=t.buttonName,u=t.stripePK,l=t.priceId,d=t.payMode,p=Object(i.a)(t,["buttonName","stripePK","priceId","payMode"]);console.log(t);var f=Object(s.useState)(!1),v=f[0],w=f[1],m=function(){var e=Object(o.a)(a.a.mark((function e(t){var r,o,i,s;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.prev=1,e.next=4,b(u);case 4:return r=e.sent,e.next=7,h.a.post(n,{priceId:l,payMode:d});case 7:return o=e.sent,i=o.data,e.next=11,r.redirectToCheckout({sessionId:i.id});case 11:s=e.sent,w(!1),s.error,e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),w(!1);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}();return c.a.createElement(O,Object.assign({variant:"outlined",color:"default",disabled:v,className:"button",size:"small",onClick:m},p),v&&c.a.createElement(k.a,{size:15}),r)}E.defaultProps={buttonName:"Subscribe",payServer:"https://pay.arcblock.io/create-session",stripePK:"pk_live_aDxtzzyDIWNN6naU3RGK4RRf00xWJGGkFA"};var O=Object(S.default)(j.a).withConfig({displayName:"stripe_pay__StyledButton",componentId:"sc-1i0n421-0"})([""])}}]);
//# sourceMappingURL=22-588ec177555d06e5b8a6.js.map