Current File : /home/kelaby89/muzza.fit/wp-content/plugins/woo-stripe-payment/assets/build/checkout-modules.js
/*! For license information please see checkout-modules.js.LICENSE.txt */
(()=>{"use strict";var e,t={780:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(705),o=l(n(428)),a=n(619),s=l(n(334));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(){u=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),s=new M(r||[]);return o(a,"_invoke",{value:I(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var d="suspendedStart",y="suspendedYield",m="executing",v="completed",_={};function g(){}function b(){}function w(){}var k={};h(k,s,(function(){return this}));var O=Object.getPrototypeOf,P=O&&O(O(T([])));P&&P!==n&&i.call(P,s)&&(k=P);var E=w.prototype=g.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function n(o,a,s,l){var c=p(e[o],e,a);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==r(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function I(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=S(s,r);if(l){if(l===_)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=p(t,n,r);if("normal"===c.type){if(i=r.done?v:y,c.arg===_)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=v,r.method="throw",r.arg=c.arg)}}}function S(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var o=p(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,_;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,_):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(r(t)+" is not iterable")}return b.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=h(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},x(j.prototype),h(j.prototype,l,(function(){return this})),t.AsyncIterator=j,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new j(f(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(E),h(E,c,"Generator"),h(E,s,(function(){return this})),h(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),_}},t}function h(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function f(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){h(o,r,i,a,s,"next",e)}function s(e){h(o,r,i,a,s,"throw",e)}a(void 0)}))}}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){var r,i,o;r=e,i=t,o=n[t],(i=m(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,m(r.key),r)}}function m(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function v(e,t,n){return t=b(t),function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_()?Reflect.construct(t,n||[],b(e).constructor):t.apply(e,n))}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_=function(){return!!e})()}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},g.apply(this,arguments)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function k(e,t){this.elementSelector=t,i.BaseGateway.call(this,e),i.CheckoutGateway.call(this)}k.prototype=Object.assign(k.prototype,i.BaseGateway.prototype,i.CheckoutGateway.prototype);var O=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=v(this,t,[e,n])).setupIntent=null,r.paymentMethodType=null,r.paymentElementComplete=!1,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){window.addEventListener("hashchange",this.handleHashChange.bind(this)),(0,o.default)(document.body).on("click","#place_order",this.handlePlaceOrder.bind(this)),(0,o.default)(document.body).on("change",'[name="'.concat(this.gateway_id,'_saved_method_key"]'),(0,s.default)(this.maybeInitializeInstallments.bind(this),250)),(0,o.default)(document.body).on("wc_stripe_saved_method_".concat(this.gateway_id),(0,s.default)(this.maybeInitializeInstallments.bind(this),250)),(0,o.default)(document.body).on("change",'[name="billing_email"], [name="billing_phone"], [name="billing_first_name"], [name="billing_last_name"]',this.onFieldChange.bind(this)),(0,o.default)(document.body).on("change","#createaccount",this.onCreateAccountChange.bind(this)),(0,o.default)(document.body).on("change",'[name="'.concat(this.gateway_id,'_save_source_key"]'),this.onChangeSavePayment.bind(this)),this.createPaymentElement(),this.mountPaymentElement(),this.initializeSetupIntent(),this.onCreateAccountChange()}},{key:"disable_payment_button",value:function(){(0,o.default)("#place_order").prop("disabled",!0)}},{key:"enable_payment_button",value:function(){(0,o.default)("#place_order").prop("disabled",!1)}},{key:"createPaymentElement",value:function(){this.elements&&!this.paymentElement&&(this.paymentElement=this.elements.create("payment",d({fields:{billingDetails:this.is_current_page("checkout")?{address:"never",name:(0,o.default)("#billing_first_name").length?"never":"auto",email:(0,o.default)("#billing_email").length?"never":"auto",phone:(0,o.default)("#billing_phone").length?"never":"auto"}:"auto"},wallets:{applePay:"never",googlePay:"never"},defaultValues:{billingDetails:{name:this.fields.get("billing_first_name")+" "+this.fields.get("billing_last_name"),email:this.fields.get("billing_email"),phone:this.fields.get("billing_phone")}}},this.params.paymentElementOptions)),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onPaymentElementLoadError.bind(this)))}},{key:"mountPaymentElement",value:function(){try{this.paymentElement&&(0,o.default)(this.elementSelector).length&&0===(0,o.default)(this.elementSelector).find("iframe").length&&(this.paymentElement.unmount(),this.paymentElement.mount(this.elementSelector))}catch(e){}}},{key:"isPaymentMode",value:function(){return"payment"===this.params.elementOptions.mode}},{key:"isSubscriptionMode",value:function(){return"subscription"===this.params.elementOptions.mode}},{key:"isSetupMode",value:function(){return"setup"===this.params.elementOptions.mode}},{key:"shouldCreatePaymentMethod",value:function(){return(0,a.applyFilters)("wc_stripe_should_create_payment_method",["card","link"].includes(this.paymentMethodType),this)}},{key:"get_element_options",value:function(){var e=d(d({},(this.isPaymentMode()||this.isSubscriptionMode())&&{amount:100}),{},{currency:this.params.currency.toLowerCase()},this.params.elementOptions),t={};return this.has_gateway_data()&&(t.currency=this.get_currency().toLowerCase(),(this.isPaymentMode()||this.isSubscriptionMode())&&(t.amount=this.get_total_price_cents(),t.amount<=0&&(t.amount=100))),d(d({},e),t)}},{key:"updated_checkout",value:function(e,t){this.updatePaymentElement(t),this.mountPaymentElement(),this.handleInstallments(),this.initializeSetupIntent()}},{key:"onPaymentElementChange",value:function(e){var t=e.value,n=void 0===t?null:t,r=e.complete,i=void 0!==r&&r;this.paymentElementComplete=i,null!=n&&n.type&&(this.paymentMethodType=n.type,this.setPaymentMethodType(n.type)),this.handleInstallments(),this.onCreateAccountChange()}},{key:"isPaymentElementComplete",value:function(){return this.paymentElementComplete}},{key:"updatePaymentElement",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(t&&null!=t&&null!==(e=t.fragments)&&void 0!==e&&e[".wc-stripe-element-options"])try{var n=JSON.parse(window.atob(decodeURIComponent(t.fragments[".wc-stripe-element-options"])));this.params.elementOptions.mode!==n.mode&&(this.params.elementOptions=d(d({},this.params.elementOptions),n)),this.elements&&this.elements.update(this.get_element_options())}catch(e){}}},{key:"getHashParameterArgs",value:function(){var e=window.location.hash.match(/#response=(.+)/),t=null;return e&&(t=JSON.parse(window.atob(decodeURIComponent(e[1])))),t}},{key:"handleHashChange",value:function(e){var t=window.location.hash.match(/response=(.*)/);if(t)try{var n=JSON.parse(window.atob(decodeURIComponent(t[1])));n&&n.hasOwnProperty("client_secret")&&this.is_gateway_selected()&&(history.pushState({},"",window.location.pathname),"payment_intent"===n.type?this.processPaymentIntent(n):this.processSetupIntent(n))}catch(e){}return!0}},{key:"handlePlaceOrder",value:function(e){var t=this;this.is_gateway_selected()&&(this.is_saved_method_selected()||(e.preventDefault(),this.disable_payment_button(),this.fields.syncCheckoutFieldsWithDOM(),this.elements.submit().then(function(){var e=f(u().mark((function e(n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.error){e.next=2;break}return e.abrupt("return",t.submit_error(n.error));case 2:if(!t.isPaymentMode()&&!t.isSubscriptionMode()||!t.shouldCreatePaymentMethod()){e.next=8;break}if(t.validateCheckoutFields()){e.next=5;break}return e.abrupt("return",t.submit_error(t.validationErrors));case 5:return e.abrupt("return",t.stripe.createPaymentMethod({elements:t.elements,params:{billing_details:d({name:"",phone:"",email:""},t.get_billing_details())}}).then((function(e){if(e.error)return t.submit_error(e.error);t.is_current_page("order_pay")?(t.set_nonce(e.paymentMethod.id),t.process_order_pay()):t.on_token_received(e.paymentMethod)})).catch((function(e){return null!=e&&e.message&&e.message.indexOf("fields.billing_details")>-1?e.message.indexOf("fields.billing_details.phone")>-1?t.submit_error({code:"billing_details.phone.required"}):t.submit_error({code:"required_fields"}):t.submit_error(e)})));case 8:if(!t.isSetupMode()){e.next=16;break}if(!t.shouldCreatePaymentMethod()||t.validateCheckoutFields()){e.next=11;break}return e.abrupt("return",t.submit_error(t.validationErrors));case 11:if(t.setupIntent){e.next=14;break}return e.next=14,t.initializeSetupIntent(!0);case 14:if("succeeded"===t.setupIntent.status){e.next=16;break}return e.abrupt("return",t.processSetupIntent({client_secret:t.setupIntent.client_secret,confirmParams:t.params.confirmParams}));case 16:if(!t.is_current_page("order_pay")){e.next=18;break}return e.abrupt("return",t.process_order_pay());case 18:t.payment_token_received=!0,t.get_form().trigger("submit");case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){return t.enable_payment_button(),t.submit_error(e)})).finally((function(){t.enable_payment_button()}))))}},{key:"on_token_received",value:function(e){this.payment_token_received=!0,this.set_nonce(e.id),this.setPaymentMethodType(e.type),this.get_form().trigger("submit")}},{key:"setPaymentMethodType",value:function(e){(0,o.default)("#_stripe_payment_method_type").val(e)}},{key:"handle_next_action",value:function(e){"payment_intent"===e.type?this.processPaymentIntent(e):this.processSetupIntent(e)}},{key:"processPaymentIntent",value:function(e){var t=this;this.stripe.confirmPayment(d(d({},!this.is_saved_method_selected()&&{elements:this.elements}),{},{clientSecret:e.client_secret,redirect:"if_required",confirmParams:d({return_url:e.return_url,payment_method_data:{billing_details:e.billing_details||this.get_billing_details()}},e.confirmation_args&&e.confirmation_args)})).then((function(n){if(n.error)return t.payment_token_received=!1,t.submit_error(n.error);var r=decodeURI(e.return_url);if(r+="&"+o.default.param({_stripe_local_payment:t.gateway_id,payment_intent:n.paymentIntent.id,payment_intent_client_secret:n.paymentIntent.client_secret}),["promptpay","swish","paynow","cashapp"].includes(t.paymentMethodType)){if("requires_action"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing");if("requires_payment_method"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing"),t.submit_error({code:n.paymentIntent.last_payment_error.code})}window.location.href=r})).catch((function(e){return t.submit_error(e)}))}},{key:"processSetupIntent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.stripe.confirmSetup(d({elements:this.elements,clientSecret:t.client_secret,redirect:"if_required"},t&&{confirmParams:d(d({},t.return_url&&{return_url:t.return_url}),{},{payment_method_data:{billing_details:this.get_billing_details()}},t.confirmParams&&t.confirmParams)})).then((function(t){if(t.error)return e.payment_token_received=!1,e.submit_error(t.error);e.setupIntent=t.setupIntent,e.payment_token_received=!0,e.set_nonce(t.setupIntent.payment_method),e.set_intent(t.setupIntent.id),e.get_form().trigger("submit")})).catch((function(t){return e.submit_error(t)}))}},{key:"handleInstallments",value:function(){this.installmentsEnabled()&&(this.maybeShowInstallments(),this.paymentElementComplete&&this.isCardPaymentType()&&this.initializeInstallments())}},{key:"isCardPaymentType",value:function(){return"card"===this.paymentMethodType}},{key:"maybeShowInstallments",value:function(){this.is_saved_method_selected()?"stripe_cc"===this.savedPaymentTokenGatewayId?this.showInstallments():this.hideInstallments():this.isCardPaymentType()?this.showInstallments():this.hideInstallments()}},{key:"showInstallments",value:function(){(0,o.default)(this.container).find(".wc-stripe-installment-container").show()}},{key:"hideInstallments",value:function(){(0,o.default)(this.container).find(".wc-stripe-installment-container").hide()}},{key:"installmentsEnabled",value:function(){if(this.has_gateway_data()){var e,t=this.get_gateway_data();return!(null==t||null===(e=t.installments)||void 0===e||!e.enabled)}return!1}},{key:"maybeInitializeInstallments",value:function(){this.installmentsEnabled()&&this.is_saved_method_selected()&&(this.savedPaymentTokenGatewayId=(0,o.default)("".concat(this.saved_method_selector," option:selected")).data("gateway"),"stripe_cc"===this.savedPaymentTokenGatewayId&&this.initializeInstallments(this.get_selected_payment_method()),this.maybeShowInstallments())}},{key:"initializeInstallments",value:(l=f(u().mark((function e(){var t,n,r=arguments;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=r.length>0&&void 0!==r[0]?r[0]:null)){e.next=16;break}return this.showInstallmentLoader(),e.prev=3,e.next=6,this.fetchInstallmentPlans(t);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(3),console.log(e.t0);case 11:return e.prev=11,this.hideInstallmentLoader(),e.finish(11);case 14:e.next=32;break;case 16:return e.prev=16,e.next=19,this.elements.submit();case 19:return e.next=21,this.stripe.createPaymentMethod({elements:this.elements,params:{billing_details:this.get_billing_details()}});case 21:if((n=e.sent).error){e.next=25;break}return e.next=25,this.initializeInstallments(n.paymentMethod.id);case 25:e.next=30;break;case 27:e.prev=27,e.t1=e.catch(16),this.hideInstallmentLoader();case 30:return e.prev=30,e.finish(30);case 32:case"end":return e.stop()}}),e,this,[[3,8,11,14],[16,27,30,32]])}))),function(){return l.apply(this,arguments)})},{key:"fetchPaymentIntent",value:function(e){var t=this;return new Promise((function(n,r){var i=t.params.routes.create_payment_intent,a=!1;t.is_current_page("order_pay")&&(i=t.params.routes.order_create_payment_intent,a=!0),o.default.ajax({url:i,method:"POST",dataType:"json",data:a?{payment_method_id:e,payment_method:"stripe_cc",order_id:t.get_gateway_data().order.id,order_key:t.get_gateway_data().order.key}:d(d({},t.serialize_fields()),{},{payment_method_id:e,payment_method:"stripe_cc",page_id:t.get_page()}),beforeSend:t.ajax_before_send.bind(t)}).done((function(e){e.code?r(e):n(e)})).fail((function(e){r()}))}))}},{key:"fetchInstallmentPlans",value:(i=f(u().mark((function e(t){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.fetchPaymentIntent(t);case 3:(n=e.sent).installments_html&&(0,o.default)(".wc-stripe-installment-container").replaceWith(n.installments_html),e.next=10;break;case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",this.submit_error(e.t0));case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return i.apply(this,arguments)})},{key:"showInstallmentLoader",value:function(){(0,o.default)(".wc-stripe-installment-options").addClass("loading-installments"),(0,o.default)('[name="_stripe_installment_plan"] option:selected').eq(0).text(this.params.installments.loading),(0,o.default)(".wc-stripe-installment-loader").show()}},{key:"hideInstallmentLoader",value:function(){(0,o.default)(".wc-stripe-installment-options").removeClass("loading-installments"),(0,o.default)(".wc-stripe-installment-loader").hide()}},{key:"initializeSetupIntent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isSetupMode()&&!this.setupIntent)return this.create_setup_intent({context:this.get_page()}).then((function(t){t.intent&&(e.setupIntent=t.intent)})).catch((function(e){if(t)throw e}))}},{key:"show_payment_button",value:function(){this.show_place_order()}},{key:"hide_place_order",value:function(){}},{key:"onFieldChange",value:function(e){this.paymentElement&&this.paymentElement.update({defaultValues:{billingDetails:{name:(0,o.default)("#billing_first_name").val()+" "+(0,o.default)("#billing_last_name").val(),email:(0,o.default)("#billing_email").val(),phone:(0,o.default)("#billing_phone").val()}}})}},{key:"validateCheckoutFields",value:function(){return this.validationErrors=[],0===this.validationErrors.length&&(0,o.default)('[name="terms"]').length&&(0,o.default)('[name="terms"]').is(":visible")&&((0,o.default)('[name="terms"]').is(":checked")||this.validationErrors.push(this.params.messages.terms)),0===this.validationErrors.length}},{key:"validateAddressFields",value:function(){var e,t=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}((0,o.default)("form.checkout .validate-required").filter(":visible"));try{for(t.s();!(e=t.n()).done;){var n=e.value,r=(0,o.default)(n).find("input.input-text");"terms"!==r.attr("name")&&("checkbox"===r.attr("type")?r.is(":checked")||this.validationErrors.push(this.getRequiredFieldError(r)):""===r.val()&&this.validationErrors.push(this.getRequiredFieldError(r)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"getRequiredFieldError",value:function(e){var t=e.attr("name");if(t in wc_stripe_checkout_fields&&wc_stripe_checkout_fields[t].label){var n=wc_stripe_checkout_fields[t].label,r=t.match(/^(billing)|^(shipping)/);if(r&&r[0]){var i="".concat(r[0],"_label");n=wc_stripe_messages[i].replace("%s",n)}return wc_stripe_messages.required_field.replace("%s","<strong>".concat(n,"</strong>"))}}},{key:"onCreateAccountChange",value:function(){(0,o.default)("#createaccount").length&&((0,o.default)("#createaccount").is(":checked")&&["card","link","sepa","us_bank_account","ideal"].includes(this.paymentMethodType)?this.show_save_card():this.hide_save_card())}},{key:"onChangeSavePayment",value:function(e){var t=(0,o.default)(e.currentTarget),n=this.params.elementOptions.mode;n=t.is(":checked")?"subscription":"payment",this.elements&&n!==this.params.elementOptions.mode&&(this.params.elementOptions.mode=n,this.elements.update({mode:n}))}},{key:"process_order_pay",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.is_gateway_selected()&&!this.is_saved_method_selected())return e&&e.preventDefault(),g(b(t.prototype),"process_order_pay",this).call(this,e)}},{key:"onPaymentElementLoadError",value:function(e){var t=e.error,n=void 0===t?null:t;n&&console.log("".concat(this.gateway_id," could not load: Reason: "),n.message)}}],r&&y(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,l}(k);t.default=O},327:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={CheckoutGateway:!0,LocalCheckoutGateway:!0};Object.defineProperty(t,"CheckoutGateway",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"LocalCheckoutGateway",{enumerable:!0,get:function(){return o.default}});var i=s(n(780)),o=s(n(330)),a=n(914);function s(e){return e&&e.__esModule?e:{default:e}}Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}))},330:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n(428));function o(e){return e&&e.__esModule?e:{default:e}}function a(){a=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),s=new M(r||[]);return o(a,"_invoke",{value:I(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var d="suspendedStart",y="suspendedYield",m="executing",v="completed",_={};function g(){}function b(){}function w(){}var k={};h(k,l,(function(){return this}));var O=Object.getPrototypeOf,P=O&&O(O(T([])));P&&P!==n&&i.call(P,l)&&(k=P);var E=w.prototype=g.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function n(o,a,s,l){var c=p(e[o],e,a);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==r(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function I(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=S(s,r);if(l){if(l===_)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=p(t,n,r);if("normal"===c.type){if(i=r.done?v:y,c.arg===_)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=v,r.method="throw",r.arg=c.arg)}}}function S(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var o=p(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,_;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,_):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(r(t)+" is not iterable")}return b.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},x(j.prototype),h(j.prototype,c,(function(){return this})),t.AsyncIterator=j,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new j(f(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(E),h(E,u,"Generator"),h(E,l,(function(){return this})),h(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),_}},t}function s(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function u(e,t,n){return t=p(t),function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},f.apply(this,arguments)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var y=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=u(this,t,[].concat(r))).maybeHideGateway(),e.processRedirectParams(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"create_stripe_elements",value:function(){if(!this.elements){if(!this.isActive())return null;this.elements=f(p(t.prototype),"create_stripe_elements",this).call(this)}return this.elements}},{key:"maybeHideGateway",value:function(){this.isActive()?(0,i.default)(this.container).show():((0,i.default)(this.container).hide(),this.is_gateway_selected()&&(0,i.default)('li[class*="payment_method_stripe_"]').filter(":visible").eq(0).find('[name="payment_method"]').prop("checked",!0).trigger("click"))}},{key:"isActive",value:function(){return(0,i.default)("#wc_stripe_local_payment_"+this.gateway_id).data("active")}},{key:"updated_checkout",value:function(e,n){this.create_stripe_elements(),this.createPaymentElement(),f(p(t.prototype),"updated_checkout",this).call(this,e,n),this.maybeHideGateway()}},{key:"onPaymentElementLoadError",value:function(e){var t=e.error;(0,i.default)(this.elementSelector).append(t.message),this.paymentElement=null}},{key:"processRedirectParams",value:(o=a().mark((function e(){var t,n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this.getHashParameterArgs())){e.next=14;break}if(n=t.client_secret,r=t.gateway_id,e.prev=3,this.gateway_id!==r&&!this.is_gateway_selected()){e.next=9;break}return e.next=7,this.stripe.retrievePaymentIntent(n);case 7:(i=e.sent).paymentIntent&&"requires_action"===i.paymentIntent.status&&"redirect_to_url"===(null===(o=i.paymentIntent.next_action)||void 0===o?void 0:o.type)&&(window.location=i.paymentIntent.next_action.redirect_to_url.url);case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),console.log(e.t0);case 14:case"end":return e.stop()}}),e,this,[[3,11]])})),c=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){s(i,n,r,a,l,"next",e)}function l(e){s(i,n,r,a,l,"throw",e)}a(void 0)}))},function(){return c.apply(this,arguments)})}],r&&l(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,c}(o(n(780)).default);t.default=y},914:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.registerPaymentMethod=t.getPaymentMethods=t.getPaymentMethod=void 0;var n={};t.registerPaymentMethod=function(e){n[e.gateway_id]=e},t.getPaymentMethods=function(){return n},t.getPaymentMethod=function(e){return n[e]?n[e]:null}},428:e=>{e.exports=window.jQuery},705:e=>{e.exports=window.wc_stripe},619:e=>{e.exports=window.wp.hooks}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,i,o)=>{if(!n){var a=1/0;for(u=0;u<e.length;u++){for(var[n,i,o]=e[u],s=!0,l=0;l<n.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(s=!1,o<a&&(a=o));if(s){e.splice(u--,1);var c=i();void 0!==c&&(t=c)}}return t}o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,i,o]},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={682:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var i,o,[a,s,l]=n,c=0;if(a.some((t=>0!==e[t]))){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(l)var u=l(r)}for(t&&t(n);c<a.length;c++)o=a[c],r.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return r.O(u)},n=self.webpackChunkwcStripeModules=self.webpackChunkwcStripeModules||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var i=r.O(void 0,[96],(()=>r(327)));i=r.O(i),(this.wcStripeModules=this.wcStripeModules||{}).checkoutModules=i})();
//# sourceMappingURL=checkout-modules.js.map
Hello World !