Payment Plugins for Stripe WooCommerce - Version 3.3.3

Version Description

  • Added - Cartflows support added for Credit Cards, Apple Pay, and Google Pay
  • Fixed - Klarna order status remaining as pending in some scenarios and checkout page would not redirect to thank you page
  • Fixed - Klarna WooCommerce Blocks object comparison error
Download this release

Release Info

Developer mr.clayton
Plugin Icon wp plugin Payment Plugins for Stripe WooCommerce
Version 3.3.3
Comparing to
See all releases

Code changes from version 3.3.2 to 3.3.3

Files changed (43) hide show
  1. assets/js/frontend/local-payment.js +23 -21
  2. assets/js/frontend/local-payment.min.js +1 -1
  3. bin/remove-file-plugin.js +0 -28
  4. bin/webpack-helpers.js +0 -64
  5. i18n/languages/woo-stripe-payment.pot +16 -16
  6. includes/abstract/abstract-wc-payment-gateway-stripe.php +1 -1
  7. includes/abstract/abstract-wc-stripe-payment.php +9 -0
  8. includes/class-stripe.php +4 -2
  9. includes/class-wc-stripe-constants.php +13 -0
  10. includes/class-wc-stripe-frontend-scripts.php +1 -1
  11. includes/class-wc-stripe-gateway.php +2 -2
  12. includes/class-wc-stripe-payment-charge-local.php +22 -6
  13. includes/class-wc-stripe-redirect-handler.php +1 -3
  14. includes/controllers/class-wc-stripe-controller-webhook.php +3 -1
  15. includes/gateways/class-wc-payment-gateway-stripe-klarna.php +3 -6
  16. includes/wc-stripe-functions.php +1 -1
  17. includes/wc-stripe-hooks.php +1 -1
  18. includes/wc-stripe-webhook-functions.php +31 -9
  19. packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payment-request.js +1 -1
  20. packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payments-client.js +2 -3
  21. packages/blocks/assets/js/payment-methods/googlepay/util.js +5 -6
  22. packages/blocks/assets/js/payment-methods/local-payment/klarna/categories.js +5 -5
  23. packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-create-source.js +17 -14
  24. packages/blocks/assets/js/payment-methods/local-payment/klarna/index.js +12 -4
  25. packages/blocks/assets/js/payment-methods/util.js +24 -7
  26. packages/blocks/build/commons.js +1 -1
  27. packages/blocks/build/commons.js.map +1 -1
  28. packages/blocks/src/Payments/PaymentsApi.php +1 -1
  29. packages/cartflows/assets/js/index.js +73 -0
  30. packages/cartflows/build/wc-stripe-cartflows.asset.php +1 -0
  31. packages/cartflows/build/wc-stripe-cartflows.js +2 -0
  32. packages/cartflows/build/wc-stripe-cartflows.js.map +1 -0
  33. packages/cartflows/src/Constants.php +10 -0
  34. packages/cartflows/src/Main.php +19 -0
  35. packages/cartflows/src/PaymentGateways/BasePaymentGateway.php +138 -0
  36. packages/cartflows/src/PaymentsApi.php +87 -0
  37. packages/cartflows/src/Routes/AbstractRoute.php +48 -0
  38. packages/cartflows/src/Routes/PaymentIntentRoute.php +62 -0
  39. packages/cartflows/src/RoutesApi.php +29 -0
  40. readme.txt +5 -1
  41. stripe-payments.php +4 -4
  42. vendor/composer/autoload_psr4.php +1 -0
  43. vendor/composer/autoload_static.php +5 -0
assets/js/frontend/local-payment.js CHANGED
@@ -454,27 +454,29 @@
454
 
455
  Klarna.prototype.createSource = function () {
456
  // prevents multiple calls to the createSource function
457
- // from intering with eachother
458
- clearTimeout(this.createSourceTimer);
459
- this.createSourceTimer = setTimeout(function () {
460
- this.show_loader();
461
- this.disable_place_order();
462
- this.stripe.createSource(this.getSourceArgs()).then(function (response) {
463
- // create payment sections
464
- this.hide_loader();
465
- if (response.error) {
466
- return this.submit_error(response.error.message);
467
- }
468
- this.source = response.source;
469
- this.set_nonce(this.source.id);
470
- this.filter_payment_method_categories();
471
- this.processConfirmation(this.source);
472
- }.bind(this)).catch(function (err) {
473
- this.enable_place_order();
474
- this.hide_loader();
475
- this.submit_error(err.message);
476
- }.bind(this));
477
- }.bind(this), 100);
 
 
478
  }
479
 
480
  Klarna.prototype.getSourceArgs = function () {
454
 
455
  Klarna.prototype.createSource = function () {
456
  // prevents multiple calls to the createSource function
457
+ // from interfering with eachother
458
+ if (this.sourceCreated) {
459
+ return;
460
+ }
461
+ this.sourceCreated = true;
462
+ this.show_loader();
463
+ this.disable_place_order();
464
+ this.stripe.createSource(this.getSourceArgs()).then(function (response) {
465
+ // create payment sections
466
+ this.hide_loader();
467
+ if (response.error) {
468
+ return this.submit_error(response.error.message);
469
+ }
470
+ this.source = response.source;
471
+ this.set_nonce(this.source.id);
472
+ this.filter_payment_method_categories();
473
+ this.processConfirmation(this.source);
474
+ }.bind(this)).catch(function (err) {
475
+ this.sourceCreated = false;
476
+ this.enable_place_order();
477
+ this.hide_loader();
478
+ this.submit_error(err.message);
479
+ }.bind(this));
480
  }
481
 
482
  Klarna.prototype.getSourceArgs = function () {
assets/js/frontend/local-payment.min.js CHANGED
@@ -1 +1 @@
1
- !function(o,i){function t(e){i.BaseGateway.call(this,e),i.CheckoutGateway.call(this),o(document.body).on("click","#place_order",this.place_order.bind(this)),this.is_current_page("order_pay")&&o("#order_review").on("submit",this.process_order_pay.bind(this)),this.maybe_hide_gateway()}function e(e){this.elementType="idealBank",this.confirmation_method="confirmIdealPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function s(e){this.elementType="p24Bank",this.confirmation_method="confirmP24Payment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function n(e){this.elementType="iban",t.call(this,e)}function a(e){t.call(this,e),o(document.body).on("change",".wc-stripe-klarna-category",this.category_change.bind(this)),o("form.checkout").on("change",".form-row:not(.address-field):not(#account_password_field) .input-text, .form-row:not(.address-field) select",this.input_change.bind(this))}function r(e){this.elementType="fpxBank",this.confirmation_method="confirmFpxPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function h(e){t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function c(e){this.elementType="auBankAccount",this.confirmation_method="confirmAuBecsDebitPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function p(e){this.confirmation_method="confirmGrabPayPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function l(e){this.confirmation_method="confirmAfterpayClearpayPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}(t.prototype=o.extend({},i.BaseGateway.prototype,i.CheckoutGateway.prototype)).initialize=function(){this.mount_button()},t.prototype.elementType=null,t.prototype.is_active=function(){return o("#wc_stripe_local_payment_"+this.gateway_id).data("active")},t.prototype.maybe_hide_gateway=function(){this.is_active()?o(this.container).show():o(this.container).hide()},t.prototype.createSource=function(){return new Promise(function(t,e){var i=function(e){e.error?this.submit_error(e.error):(this.payment_token_received=!0,this.set_nonce(e.source.id),this.get_form().submit()),t()}.bind(this);if(null!=this.elementType)if(this.confirmation_method){if(!this.isValidElement())return this.submit_error({code:"empty_element_"+this.params.local_payment_type,message:wc_stripe_messages.empty_element});this.payment_token_received=!0,this.get_form().submit()}else this.stripe.createSource(this.element,this.getSourceArgs()).then(i)["catch"](function(e){this.submit_error(e.message)}.bind(this));else this.payment_token_received=!0,this.get_form().submit()}.bind(this))},t.prototype.place_order=function(e){this.is_gateway_selected()&&(this.payment_token_received||this.is_saved_method_selected()||(e.preventDefault(),this.createSource()))},t.prototype.process_order_pay=function(e){var t;this.is_gateway_selected()&&(e.preventDefault(),(t=this.get_form().serializeArray()).push({name:"_wpnonce",value:this.params.rest_nonce}),t.push({name:"order_id",value:this.params.order_id}),e=window.location.search,this.params.routes.order_pay.match(/\?/)&&(e="&"+e.substr(1)),o.ajax({url:this.params.routes.order_pay+e,method:"POST",dataType:"json",data:o.param(t)}).done(function(e){e.success?window.location.href=e.redirect:this.submit_error(e.message)}.bind(this)).fail(function(e,t,i){this.submit_error(i)}.bind(this)))},t.prototype.show_payment_button=function(){this.show_place_order()},t.prototype.hide_place_order=function(){},t.prototype.show_place_order=function(){i.CheckoutGateway.prototype.show_place_order.apply(this,arguments),this.payment_token_received&&o("#place_order").text(o("#place_order").data("value"))},t.prototype.getSourceArgs=function(){return{type:this.params.local_payment_type,amount:this.get_total_price_cents(),currency:this.get_currency(),owner:{name:this.get_customer_name("billing"),email:this.fields.get("billing_email",null)},redirect:{return_url:this.params.return_url}}},t.prototype.updated_checkout=function(){this.mount_button(),this.maybe_hide_gateway()},t.prototype.mount_button=function(){var e="#wc_stripe_local_payment_"+this.gateway_id;o(e).length&&null!=this.elementType&&(o(e).empty(),this.element||(this.element=this.elements.create(this.elementType,this.params.element_params),this.element.on("change",this.handleElementChange.bind(this))),this.elementEmpty=!0,this.element.mount(e))},t.prototype.handleElementChange=function(e){this.elementEmpty=e.empty},t.prototype.load_external_script=function(e){var t=document.createElement("script");t.type="text/javascript",t.src=e,t.onload=function(){this.script_loaded=!0}.bind(this),document.body.appendChild(t)},t.prototype.hashChange=function(e){!this.is_gateway_selected()||(e=e.newURL.match(/response=(.*)/))&&(history.pushState({},"",window.location.pathname),e=JSON.parse(window.atob(decodeURIComponent(e[1]))),this.processConfirmation(e))},t.prototype.processConfirmation=function(e){this.stripe[this.confirmation_method](e.client_secret,this.get_confirmation_args(e)).then(function(e){if(e.error)return this.submit_error(e.error.message);this.get_form().submit()}.bind(this))},t.prototype.get_confirmation_args=function(e){e={payment_method:{billing_details:this.get_billing_details()},return_url:e.return_url};return this.elementType&&(e.payment_method[this.params.local_payment_type]=this.element),e},t.prototype.isValidElement=function(){return!this.element||!this.elementEmpty},t.prototype.delete_order_source=function(){return new Promise(function(t,e){o.ajax({url:this.params.routes.delete_order_source,method:"DELETE",dataType:"json",beforeSend:this.ajax_before_send.bind(this)}).done(function(e){t(e)}.bind(this)).fail(function(){e()}.bind(this))}.bind(this))},t.prototype.update_source=function(i){return new Promise(function(t,e){this.updateSourceXhr&&this.updateSourceXhr.abort(),this.updateSourceXhr=o.ajax({url:this.params.routes.update_source,method:"POST",dataType:"json",data:{_wpnonce:this.params.rest_nonce,updates:i,source_id:this.source.id,client_secret:this.source.client_secret,payment_method:this.gateway_id}}).done(function(e){t(e.source)}.bind(this)).fail(function(){e()})}.bind(this))},a.prototype.disable_place_order=function(){o("#place_order").prop("disabled",!0)},a.prototype.enable_place_order=function(){o("#place_order").prop("disabled",!1)},a.prototype.category_change=function(e){var t=function(){o('[id^="klarna-instance-"]').slideUp();var e=o('[name="klarna_category"]:checked').val();o("#klarna-instance-"+e).slideDown()}.bind(this);e.originalEvent?t():(clearTimeout(this.categoryChangeTimer),this.categoryChangeTimer=setTimeout(t,500))},a.prototype.processConfirmation=function(e){window.Klarna.Payments.init({client_token:e.klarna.client_token},function(e){}.bind(this)),this.payment_categories=e.klarna.payment_method_categories.split(","),this.render_ui(!0).then(function(){this.enable_place_order()}.bind(this))},a.prototype.hashchange=function(){this.is_gateway_selected()&&(history.pushState({},"",window.location.pathname),this.get_form().removeClass("processing"),this.get_form().submit())},a.prototype.render_ui=function(r){return new Promise(function(e){if(0<this.payment_categories.length){o("#place_order").prop("disabled",!0);var t=[];o("#wc_stripe_local_payment_stripe_klarna").show();for(var i=0;i<this.payment_categories.length;i++){var s,n="#klarna-instance-"+this.payment_categories[i];if(o(n).empty(),o("#klarna-category-"+this.payment_categories[i]).length){this.params.translate&&(s=this.source.klarna[this.payment_categories[i]+"_name"],o('label[for="klarna_'+this.payment_categories[i]+'"').text(s)),o("#klarna-category-"+this.payment_categories[i]).show();try{t.push(new Promise(function(t){window.Klarna.Payments.load({container:n,payment_method_category:this.payment_categories[i],instance_id:"klarna-instance-"+this.payment_categories[i]},function(e){e.show_form||(this.source=null),t()}.bind(this))}.bind(this)))}catch(a){window.alert(a),e()}}}Promise.all(t).then(function(){e()}),r&&o('[id^="klarna-category-"]:visible [name="klarna_category"]').first().prop("checked",!0).trigger("change")}else e()}.bind(this))},a.prototype.place_order=function(e){this.is_gateway_selected()&&(e.preventDefault(),this.checkout_fields_valid()&&window.Klarna.Payments.authorize({instance_id:"klarna-instance-"+o('[name="klarna_category"]:checked').val()},function(e){e.approved?(this.set_nonce(this.source.id),this.payment_token_received=!0,this.get_form().submit()):e.error?this.submit_error(e.error):this.submit_error(this.params.messages.klarna_error)}.bind(this)))},a.prototype.klarna_fields_valid=function(){if(this.fields.validateFields("billing"))return!this.needs_shipping()||(!!("billing"===this.get_shipping_prefix()||"shipping"===this.get_shipping_prefix()&&this.fields.validateFields("shipping"))||void 0)},a.prototype.initialize=function(){this.is_gateway_selected()&&this.is_active()&&!this.source&&this.klarna_fields_valid()&&this.createSource()},a.prototype.createSource=function(){clearTimeout(this.createSourceTimer),this.createSourceTimer=setTimeout(function(){this.show_loader(),this.disable_place_order(),this.stripe.createSource(this.getSourceArgs()).then(function(e){if(this.hide_loader(),e.error)return this.submit_error(e.error.message);this.source=e.source,this.set_nonce(this.source.id),this.filter_payment_method_categories(),this.processConfirmation(this.source)}.bind(this))["catch"](function(e){this.enable_place_order(),this.hide_loader(),this.submit_error(e.message)}.bind(this))}.bind(this),100)},a.prototype.getSourceArgs=function(){return o.extend(!0,{},this.get_gateway_data().source_args,function(){var e,t={owner:{name:this.fields.get("billing_first_name")+" "+this.fields.get("billing_last_name"),email:this.fields.get("billing_email"),address:{city:this.fields.get("billing_city"),country:this.fields.get("billing_country"),line1:this.fields.get("billing_address_1"),line2:this.fields.get("billing_address_2"),postal_code:this.fields.get("billing_postcode"),state:this.fields.get("billing_state")}},klarna:{purchase_country:this.fields.get("billing_country"),first_name:this.fields.get("billing_first_name"),last_name:this.fields.get("billing_last_name")}};return this.needs_shipping()&&(e=this.get_shipping_prefix(),t.klarna.shipping_first_name=this.fields.get("first_name",e),t.klarna.shipping_last_name=this.fields.get("last_name",e),t.source_order={shipping:{address:{city:this.fields.get("city",e),country:this.fields.get("country",e),line1:this.fields.get("address_1",e),line2:this.fields.get("address_2",e),postal_code:this.fields.get("postcode",e),state:this.fields.get("state",e)}}}),t}.bind(this)())},a.prototype.updated_checkout=function(){t.prototype.updated_checkout.apply(this,arguments),this.source&&this.is_active()?this.update_source():this.is_gateway_selected()&&this.is_active()&&this.klarna_fields_valid()&&this.createSource()},a.prototype.update_source=function(){var e=this.get_source_update_args(this.getSourceArgs());this.show_loader(),this.disable_place_order(),t.prototype.update_source.call(this,e).then(function(e){this.source=e,this.filter_payment_method_categories(),this.hide_loader(),this.render_ui().then(this.enable_place_order.bind(this))}.bind(this))["catch"](this.enable_place_order.bind(this))},a.prototype.checkout_error=function(){t.prototype.checkout_error.apply(this,arguments),this.is_gateway_selected()&&this.createSource()},a.prototype.show_loader=function(){o(this.container).find(".wc-stripe-klarna-loader").remove(),o(this.container).find('label[for="payment_method_'+this.gateway_id+'" ]').after(this.params.klarna_loader)},a.prototype.hide_loader=function(){o(this.container).find(".wc-stripe-klarna-loader").remove()},a.prototype.filter_payment_method_categories=function(){var e=this.source.klarna.payment_method_categories.split(",");this.source.klarna.payment_method_categories=e.filter(function(e){return-1<this.get_gateway_data().payment_sections.indexOf(e)}.bind(this)).join(",")},a.prototype.get_source_update_args=function(e){return["type","currency","statement_descriptor","redirect","klarna.product","klarna.locale","klarna.custom_payment_methods"].reduce(function(e,t){if(-1<t.indexOf(".")){var i=t.split(".");return delete i.slice(0,i.length-1).reduce(function(e,t){return e[t]},e)[t=i[i.length-1]],e}return delete e[t],e},e)},a.prototype.on_payment_method_selected=function(e,t){t===this.gateway_id&&(this.source||(this.klarna_fields_valid()?this.createSource():this.submit_error(this.params.messages.required_field)),i.CheckoutGateway.prototype.on_payment_method_selected.apply(this,arguments))},a.prototype.input_change=function(){this.is_gateway_selected()&&(this.source?this.update_source():this.klarna_fields_valid()&&this.createSource())},h.prototype.updated_checkout=function(){!this.script_loaded&&o(this.container).length&&this.load_external_script(this.params.qr_script),t.prototype.updated_checkout.apply(this,arguments)},h.prototype.hashChange=function(e){!this.is_gateway_selected()||(e=e.newURL.match(/qrcode=(.*)/))&&(history.pushState({},"",window.location.pathname),this.qrcode=JSON.parse(window.atob(decodeURIComponent(e[1]))),this.get_form().unblock().removeClass("processing").addClass("wechat"),new QRCode("wc_stripe_local_payment_stripe_wechat",{text:this.qrcode.code,width:128,height:128,colorDark:"#424770",colorLight:"#f8fbfd",correctLevel:QRCode.CorrectLevel.H}),o("#wc_stripe_local_payment_stripe_wechat").append('<p class="qrcode-message">'+this.params.qr_message+"</p>"),this.payment_token_received=!0,this.show_place_order())},h.prototype.place_order=function(){this.get_form().is(".wechat")?window.location=this.qrcode.redirect:t.prototype.place_order.apply(this,arguments)},n.prototype.getSourceArgs=function(){var e=o.extend({},t.prototype.getSourceArgs.apply(this,arguments),{mandate:{notification_method:"email",interval:this.cart_contains_subscription()||this.is_change_payment_method()?"scheduled":"one_time"}});return"scheduled"===e.mandate.interval&&delete e.amount,e},l.prototype.add_eligibility=function(){o(this.container).length&&!this.params.msg_options.isEligible&&o("#wc_stripe_local_payment_stripe_afterpay").addClass("ineligible")},l.prototype.updated_checkout=function(){this.maybe_hide_gateway(),this.add_eligibility(),this.msgElement&&o(this.container).length&&(this.elements=this.stripe.elements(this.get_element_options()),this.initialize_messaging())},l.prototype.initialize=function(){this.add_eligibility(),this.initialize_messaging()},l.prototype.initialize_messaging=function(){this.msgElement=this.elements.create("afterpayClearpayMessage",o.extend({},this.params.msg_options,{amount:this.get_total_price_cents(),currency:this.get_currency()})),this.mount_message()},l.prototype.mount_message=function(e){e&&this.msgElement.update({amount:this.get_total_price_cents(),currency:this.get_currency()}),o('label[for="payment_method_stripe_afterpay"]').find("#wc-stripe-afterpay-msg").length||o('label[for="payment_method_stripe_afterpay"]').append('<div id="wc-stripe-afterpay-msg"></div>'),this.msgElement.mount("#wc-stripe-afterpay-msg")},l.prototype.get_element_options=function(){var e=this.params.locale;return"GB"==this.fields.get("billing_country")&&["fr-FR","it-IT","es-ES"].indexOf(e)<0?e="en-GB":this.params.supported_locales.indexOf(this.params.locale)<0&&(e="auto"),{locale:e}},e.prototype=o.extend({},t.prototype,e.prototype),s.prototype=o.extend({},t.prototype,s.prototype),n.prototype=o.extend({},t.prototype,n.prototype),a.prototype=o.extend({},t.prototype,a.prototype),r.prototype=o.extend({},t.prototype,r.prototype),h.prototype=o.extend({},t.prototype,h.prototype),c.prototype=o.extend({},t.prototype,c.prototype),p.prototype=o.extend({},t.prototype,p.prototype),l.prototype=o.extend({},t.prototype,l.prototype);var d,_={ideal:e,p24:s,sepa_debit:n,klarna:a,fpx:r,wechat:h,au_becs_debit:c,grabpay:p,afterpay_clearpay:l};for(d in wc_stripe_local_payment_params.gateways){var u=wc_stripe_local_payment_params.gateways[d];new(_[u.local_payment_type]||t)(u)}}(jQuery,window.wc_stripe);
1
+ !function(o,i){function t(e){i.BaseGateway.call(this,e),i.CheckoutGateway.call(this),o(document.body).on("click","#place_order",this.place_order.bind(this)),this.is_current_page("order_pay")&&o("#order_review").on("submit",this.process_order_pay.bind(this)),this.maybe_hide_gateway()}function e(e){this.elementType="idealBank",this.confirmation_method="confirmIdealPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function s(e){this.elementType="p24Bank",this.confirmation_method="confirmP24Payment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function n(e){this.elementType="iban",t.call(this,e)}function a(e){t.call(this,e),o(document.body).on("change",".wc-stripe-klarna-category",this.category_change.bind(this)),o("form.checkout").on("change",".form-row:not(.address-field):not(#account_password_field) .input-text, .form-row:not(.address-field) select",this.input_change.bind(this))}function r(e){this.elementType="fpxBank",this.confirmation_method="confirmFpxPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function h(e){t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function c(e){this.elementType="auBankAccount",this.confirmation_method="confirmAuBecsDebitPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function p(e){this.confirmation_method="confirmGrabPayPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}function l(e){this.confirmation_method="confirmAfterpayClearpayPayment",t.call(this,e),window.addEventListener("hashchange",this.hashChange.bind(this))}(t.prototype=o.extend({},i.BaseGateway.prototype,i.CheckoutGateway.prototype)).initialize=function(){this.mount_button()},t.prototype.elementType=null,t.prototype.is_active=function(){return o("#wc_stripe_local_payment_"+this.gateway_id).data("active")},t.prototype.maybe_hide_gateway=function(){this.is_active()?o(this.container).show():o(this.container).hide()},t.prototype.createSource=function(){return new Promise(function(t,e){var i=function(e){e.error?this.submit_error(e.error):(this.payment_token_received=!0,this.set_nonce(e.source.id),this.get_form().submit()),t()}.bind(this);if(null!=this.elementType)if(this.confirmation_method){if(!this.isValidElement())return this.submit_error({code:"empty_element_"+this.params.local_payment_type,message:wc_stripe_messages.empty_element});this.payment_token_received=!0,this.get_form().submit()}else this.stripe.createSource(this.element,this.getSourceArgs()).then(i)["catch"](function(e){this.submit_error(e.message)}.bind(this));else this.payment_token_received=!0,this.get_form().submit()}.bind(this))},t.prototype.place_order=function(e){this.is_gateway_selected()&&(this.payment_token_received||this.is_saved_method_selected()||(e.preventDefault(),this.createSource()))},t.prototype.process_order_pay=function(e){var t;this.is_gateway_selected()&&(e.preventDefault(),(t=this.get_form().serializeArray()).push({name:"_wpnonce",value:this.params.rest_nonce}),t.push({name:"order_id",value:this.params.order_id}),e=window.location.search,this.params.routes.order_pay.match(/\?/)&&(e="&"+e.substr(1)),o.ajax({url:this.params.routes.order_pay+e,method:"POST",dataType:"json",data:o.param(t)}).done(function(e){e.success?window.location.href=e.redirect:this.submit_error(e.message)}.bind(this)).fail(function(e,t,i){this.submit_error(i)}.bind(this)))},t.prototype.show_payment_button=function(){this.show_place_order()},t.prototype.hide_place_order=function(){},t.prototype.show_place_order=function(){i.CheckoutGateway.prototype.show_place_order.apply(this,arguments),this.payment_token_received&&o("#place_order").text(o("#place_order").data("value"))},t.prototype.getSourceArgs=function(){return{type:this.params.local_payment_type,amount:this.get_total_price_cents(),currency:this.get_currency(),owner:{name:this.get_customer_name("billing"),email:this.fields.get("billing_email",null)},redirect:{return_url:this.params.return_url}}},t.prototype.updated_checkout=function(){this.mount_button(),this.maybe_hide_gateway()},t.prototype.mount_button=function(){var e="#wc_stripe_local_payment_"+this.gateway_id;o(e).length&&null!=this.elementType&&(o(e).empty(),this.element||(this.element=this.elements.create(this.elementType,this.params.element_params),this.element.on("change",this.handleElementChange.bind(this))),this.elementEmpty=!0,this.element.mount(e))},t.prototype.handleElementChange=function(e){this.elementEmpty=e.empty},t.prototype.load_external_script=function(e){var t=document.createElement("script");t.type="text/javascript",t.src=e,t.onload=function(){this.script_loaded=!0}.bind(this),document.body.appendChild(t)},t.prototype.hashChange=function(e){!this.is_gateway_selected()||(e=e.newURL.match(/response=(.*)/))&&(history.pushState({},"",window.location.pathname),e=JSON.parse(window.atob(decodeURIComponent(e[1]))),this.processConfirmation(e))},t.prototype.processConfirmation=function(e){this.stripe[this.confirmation_method](e.client_secret,this.get_confirmation_args(e)).then(function(e){if(e.error)return this.submit_error(e.error.message);this.get_form().submit()}.bind(this))},t.prototype.get_confirmation_args=function(e){e={payment_method:{billing_details:this.get_billing_details()},return_url:e.return_url};return this.elementType&&(e.payment_method[this.params.local_payment_type]=this.element),e},t.prototype.isValidElement=function(){return!this.element||!this.elementEmpty},t.prototype.delete_order_source=function(){return new Promise(function(t,e){o.ajax({url:this.params.routes.delete_order_source,method:"DELETE",dataType:"json",beforeSend:this.ajax_before_send.bind(this)}).done(function(e){t(e)}.bind(this)).fail(function(){e()}.bind(this))}.bind(this))},t.prototype.update_source=function(i){return new Promise(function(t,e){this.updateSourceXhr&&this.updateSourceXhr.abort(),this.updateSourceXhr=o.ajax({url:this.params.routes.update_source,method:"POST",dataType:"json",data:{_wpnonce:this.params.rest_nonce,updates:i,source_id:this.source.id,client_secret:this.source.client_secret,payment_method:this.gateway_id}}).done(function(e){t(e.source)}.bind(this)).fail(function(){e()})}.bind(this))},a.prototype.disable_place_order=function(){o("#place_order").prop("disabled",!0)},a.prototype.enable_place_order=function(){o("#place_order").prop("disabled",!1)},a.prototype.category_change=function(e){var t=function(){o('[id^="klarna-instance-"]').slideUp();var e=o('[name="klarna_category"]:checked').val();o("#klarna-instance-"+e).slideDown()}.bind(this);e.originalEvent?t():(clearTimeout(this.categoryChangeTimer),this.categoryChangeTimer=setTimeout(t,500))},a.prototype.processConfirmation=function(e){window.Klarna.Payments.init({client_token:e.klarna.client_token},function(e){}.bind(this)),this.payment_categories=e.klarna.payment_method_categories.split(","),this.render_ui(!0).then(function(){this.enable_place_order()}.bind(this))},a.prototype.hashchange=function(){this.is_gateway_selected()&&(history.pushState({},"",window.location.pathname),this.get_form().removeClass("processing"),this.get_form().submit())},a.prototype.render_ui=function(r){return new Promise(function(e){if(0<this.payment_categories.length){o("#place_order").prop("disabled",!0);var t=[];o("#wc_stripe_local_payment_stripe_klarna").show();for(var i=0;i<this.payment_categories.length;i++){var s,n="#klarna-instance-"+this.payment_categories[i];if(o(n).empty(),o("#klarna-category-"+this.payment_categories[i]).length){this.params.translate&&(s=this.source.klarna[this.payment_categories[i]+"_name"],o('label[for="klarna_'+this.payment_categories[i]+'"').text(s)),o("#klarna-category-"+this.payment_categories[i]).show();try{t.push(new Promise(function(t){window.Klarna.Payments.load({container:n,payment_method_category:this.payment_categories[i],instance_id:"klarna-instance-"+this.payment_categories[i]},function(e){e.show_form||(this.source=null),t()}.bind(this))}.bind(this)))}catch(a){window.alert(a),e()}}}Promise.all(t).then(function(){e()}),r&&o('[id^="klarna-category-"]:visible [name="klarna_category"]').first().prop("checked",!0).trigger("change")}else e()}.bind(this))},a.prototype.place_order=function(e){this.is_gateway_selected()&&(e.preventDefault(),this.checkout_fields_valid()&&window.Klarna.Payments.authorize({instance_id:"klarna-instance-"+o('[name="klarna_category"]:checked').val()},function(e){e.approved?(this.set_nonce(this.source.id),this.payment_token_received=!0,this.get_form().submit()):e.error?this.submit_error(e.error):this.submit_error(this.params.messages.klarna_error)}.bind(this)))},a.prototype.klarna_fields_valid=function(){if(this.fields.validateFields("billing"))return!this.needs_shipping()||(!!("billing"===this.get_shipping_prefix()||"shipping"===this.get_shipping_prefix()&&this.fields.validateFields("shipping"))||void 0)},a.prototype.initialize=function(){this.is_gateway_selected()&&this.is_active()&&!this.source&&this.klarna_fields_valid()&&this.createSource()},a.prototype.createSource=function(){this.sourceCreated||(this.sourceCreated=!0,this.show_loader(),this.disable_place_order(),this.stripe.createSource(this.getSourceArgs()).then(function(e){if(this.hide_loader(),e.error)return this.submit_error(e.error.message);this.source=e.source,this.set_nonce(this.source.id),this.filter_payment_method_categories(),this.processConfirmation(this.source)}.bind(this))["catch"](function(e){this.sourceCreated=!1,this.enable_place_order(),this.hide_loader(),this.submit_error(e.message)}.bind(this)))},a.prototype.getSourceArgs=function(){return o.extend(!0,{},this.get_gateway_data().source_args,function(){var e,t={owner:{name:this.fields.get("billing_first_name")+" "+this.fields.get("billing_last_name"),email:this.fields.get("billing_email"),address:{city:this.fields.get("billing_city"),country:this.fields.get("billing_country"),line1:this.fields.get("billing_address_1"),line2:this.fields.get("billing_address_2"),postal_code:this.fields.get("billing_postcode"),state:this.fields.get("billing_state")}},klarna:{purchase_country:this.fields.get("billing_country"),first_name:this.fields.get("billing_first_name"),last_name:this.fields.get("billing_last_name")}};return this.needs_shipping()&&(e=this.get_shipping_prefix(),t.klarna.shipping_first_name=this.fields.get("first_name",e),t.klarna.shipping_last_name=this.fields.get("last_name",e),t.source_order={shipping:{address:{city:this.fields.get("city",e),country:this.fields.get("country",e),line1:this.fields.get("address_1",e),line2:this.fields.get("address_2",e),postal_code:this.fields.get("postcode",e),state:this.fields.get("state",e)}}}),t}.bind(this)())},a.prototype.updated_checkout=function(){t.prototype.updated_checkout.apply(this,arguments),this.source&&this.is_active()?this.update_source():this.is_gateway_selected()&&this.is_active()&&this.klarna_fields_valid()&&this.createSource()},a.prototype.update_source=function(){var e=this.get_source_update_args(this.getSourceArgs());this.show_loader(),this.disable_place_order(),t.prototype.update_source.call(this,e).then(function(e){this.source=e,this.filter_payment_method_categories(),this.hide_loader(),this.render_ui().then(this.enable_place_order.bind(this))}.bind(this))["catch"](this.enable_place_order.bind(this))},a.prototype.checkout_error=function(){t.prototype.checkout_error.apply(this,arguments),this.is_gateway_selected()&&this.createSource()},a.prototype.show_loader=function(){o(this.container).find(".wc-stripe-klarna-loader").remove(),o(this.container).find('label[for="payment_method_'+this.gateway_id+'" ]').after(this.params.klarna_loader)},a.prototype.hide_loader=function(){o(this.container).find(".wc-stripe-klarna-loader").remove()},a.prototype.filter_payment_method_categories=function(){var e=this.source.klarna.payment_method_categories.split(",");this.source.klarna.payment_method_categories=e.filter(function(e){return-1<this.get_gateway_data().payment_sections.indexOf(e)}.bind(this)).join(",")},a.prototype.get_source_update_args=function(e){return["type","currency","statement_descriptor","redirect","klarna.product","klarna.locale","klarna.custom_payment_methods"].reduce(function(e,t){if(-1<t.indexOf(".")){var i=t.split(".");return delete i.slice(0,i.length-1).reduce(function(e,t){return e[t]},e)[t=i[i.length-1]],e}return delete e[t],e},e)},a.prototype.on_payment_method_selected=function(e,t){t===this.gateway_id&&(this.source||(this.klarna_fields_valid()?this.createSource():this.submit_error(this.params.messages.required_field)),i.CheckoutGateway.prototype.on_payment_method_selected.apply(this,arguments))},a.prototype.input_change=function(){this.is_gateway_selected()&&(this.source?this.update_source():this.klarna_fields_valid()&&this.createSource())},h.prototype.updated_checkout=function(){!this.script_loaded&&o(this.container).length&&this.load_external_script(this.params.qr_script),t.prototype.updated_checkout.apply(this,arguments)},h.prototype.hashChange=function(e){!this.is_gateway_selected()||(e=e.newURL.match(/qrcode=(.*)/))&&(history.pushState({},"",window.location.pathname),this.qrcode=JSON.parse(window.atob(decodeURIComponent(e[1]))),this.get_form().unblock().removeClass("processing").addClass("wechat"),new QRCode("wc_stripe_local_payment_stripe_wechat",{text:this.qrcode.code,width:128,height:128,colorDark:"#424770",colorLight:"#f8fbfd",correctLevel:QRCode.CorrectLevel.H}),o("#wc_stripe_local_payment_stripe_wechat").append('<p class="qrcode-message">'+this.params.qr_message+"</p>"),this.payment_token_received=!0,this.show_place_order())},h.prototype.place_order=function(){this.get_form().is(".wechat")?window.location=this.qrcode.redirect:t.prototype.place_order.apply(this,arguments)},n.prototype.getSourceArgs=function(){var e=o.extend({},t.prototype.getSourceArgs.apply(this,arguments),{mandate:{notification_method:"email",interval:this.cart_contains_subscription()||this.is_change_payment_method()?"scheduled":"one_time"}});return"scheduled"===e.mandate.interval&&delete e.amount,e},l.prototype.add_eligibility=function(){o(this.container).length&&!this.params.msg_options.isEligible&&o("#wc_stripe_local_payment_stripe_afterpay").addClass("ineligible")},l.prototype.updated_checkout=function(){this.maybe_hide_gateway(),this.add_eligibility(),this.msgElement&&o(this.container).length&&(this.elements=this.stripe.elements(this.get_element_options()),this.initialize_messaging())},l.prototype.initialize=function(){this.add_eligibility(),this.initialize_messaging()},l.prototype.initialize_messaging=function(){this.msgElement=this.elements.create("afterpayClearpayMessage",o.extend({},this.params.msg_options,{amount:this.get_total_price_cents(),currency:this.get_currency()})),this.mount_message()},l.prototype.mount_message=function(e){e&&this.msgElement.update({amount:this.get_total_price_cents(),currency:this.get_currency()}),o('label[for="payment_method_stripe_afterpay"]').find("#wc-stripe-afterpay-msg").length||o('label[for="payment_method_stripe_afterpay"]').append('<div id="wc-stripe-afterpay-msg"></div>'),this.msgElement.mount("#wc-stripe-afterpay-msg")},l.prototype.get_element_options=function(){var e=this.params.locale;return"GB"==this.fields.get("billing_country")&&["fr-FR","it-IT","es-ES"].indexOf(e)<0?e="en-GB":this.params.supported_locales.indexOf(this.params.locale)<0&&(e="auto"),{locale:e}},e.prototype=o.extend({},t.prototype,e.prototype),s.prototype=o.extend({},t.prototype,s.prototype),n.prototype=o.extend({},t.prototype,n.prototype),a.prototype=o.extend({},t.prototype,a.prototype),r.prototype=o.extend({},t.prototype,r.prototype),h.prototype=o.extend({},t.prototype,h.prototype),c.prototype=o.extend({},t.prototype,c.prototype),p.prototype=o.extend({},t.prototype,p.prototype),l.prototype=o.extend({},t.prototype,l.prototype);var d,_={ideal:e,p24:s,sepa_debit:n,klarna:a,fpx:r,wechat:h,au_becs_debit:c,grabpay:p,afterpay_clearpay:l};for(d in wc_stripe_local_payment_params.gateways){var u=wc_stripe_local_payment_params.gateways[d];new(_[u.local_payment_type]||t)(u)}}(jQuery,window.wc_stripe);
bin/remove-file-plugin.js DELETED
@@ -1,28 +0,0 @@
1
- const fs = require('fs');
2
- const glob = require('glob');
3
-
4
- /**
5
- * Removes files that are generated during the Webpack build process
6
- */
7
- class RemoveFilesPlugin {
8
- constructor(filepath) {
9
- this.filepath = filepath;
10
- }
11
-
12
- apply(compiler) {
13
- compiler.hooks.afterEmit.tap('afterEmit', this.deleteFiles.bind(this));
14
- }
15
-
16
- deleteFiles() {
17
- let files = glob.sync(this.filepath);
18
- files.forEach(file => {
19
- fs.unlink(file, (err) => {
20
- if (err) {
21
- console.log(`error removing file ${file}.`, err);
22
- }
23
- })
24
- })
25
- }
26
- }
27
-
28
- module.exports = RemoveFilesPlugin;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bin/webpack-helpers.js DELETED
@@ -1,64 +0,0 @@
1
- const isDev = () => {
2
- return getEnv() === 'development';
3
- }
4
-
5
- const getEnv = () => {
6
- return process.env.NODE_ENV || 'development';
7
- }
8
-
9
- const requiredPackagesInWPLegacy = [
10
- '@wordpress/compose',
11
- ];
12
-
13
- const wcDepMap = {
14
- '@woocommerce/blocks-registry': ['wc', 'wcBlocksRegistry'],
15
- '@woocommerce/settings': ['wc', 'wcSettings'],
16
- '@woocommerce/block-data': ['wc', 'wcBlocksData'],
17
- '@woocommerce/shared-context': ['wc', 'wcSharedContext'],
18
- '@woocommerce/shared-hocs': ['wc', 'wcSharedHocs'],
19
- '@woocommerce/price-format': ['wc', 'priceFormat'],
20
- '@woocommerce/blocks-checkout': ['wc', 'blocksCheckout'],
21
- '@googlepay': 'google',
22
- 'QRCode': 'QRCode',
23
- '@plaid': 'Plaid'
24
- };
25
-
26
- const wcHandleMap = {
27
- '@woocommerce/blocks-registry': 'wc-blocks-registry',
28
- '@woocommerce/settings': 'wc-settings',
29
- '@woocommerce/block-settings': 'wc-settings',
30
- '@woocommerce/block-data': 'wc-blocks-data-store',
31
- '@woocommerce/shared-context': 'wc-shared-context',
32
- '@woocommerce/shared-hocs': 'wc-shared-hocs',
33
- '@woocommerce/price-format': 'wc-price-format',
34
- '@woocommerce/blocks-checkout': 'wc-blocks-checkout',
35
- '@googlepay': 'wc-stripe-gpay-external',
36
- '@plaid': 'wc-stripe-plaid'
37
- //'QRCode': 'wc-stripe-qrcode'
38
- };
39
-
40
- const requestToHandle = (request) => {
41
- if (requiredPackagesInWPLegacy.includes(request)) {
42
- return false;
43
- }
44
- if (wcHandleMap[request]) {
45
- return wcHandleMap[request];
46
- }
47
- }
48
-
49
- const requestToExternal = (request) => {
50
- if (requiredPackagesInWPLegacy.includes(request)) {
51
- return false;
52
- }
53
- if (wcDepMap[request]) {
54
- return wcDepMap[request];
55
- }
56
- }
57
-
58
- module.exports = {
59
- isDev,
60
- wcDepMap,
61
- wcHandleMap,
62
- requestToHandle,
63
- requestToExternal
64
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Stripe For WooCommerce 3.3.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-05-25T18:21:17+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
@@ -137,7 +137,7 @@ msgid "Error saving payment method. Reason: %s"
137
  msgstr ""
138
 
139
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:535
140
- #: includes/wc-stripe-webhook-functions.php:217
141
  msgid "Order refunded in Stripe. Amount: %s"
142
  msgstr ""
143
 
@@ -730,15 +730,11 @@ msgstr ""
730
  msgid "This request is invalid. Please try again."
731
  msgstr ""
732
 
733
- #: includes/class-wc-stripe-redirect-handler.php:53
734
- msgid "Payment for order was not completed."
735
- msgstr ""
736
-
737
- #: includes/class-wc-stripe-redirect-handler.php:57
738
  msgid "Payment authorization failed. Please select another payment method."
739
  msgstr ""
740
 
741
- #: includes/class-wc-stripe-redirect-handler.php:63
742
  msgid "Payment authorization failed."
743
  msgstr ""
744
 
@@ -851,6 +847,10 @@ msgstr ""
851
  msgid "Invalid signature received. Verify that your webhook secret is correct."
852
  msgstr ""
853
 
 
 
 
 
854
  #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:26
855
  msgid "ACH"
856
  msgstr ""
@@ -1220,23 +1220,23 @@ msgstr ""
1220
  msgid "Fee"
1221
  msgstr ""
1222
 
1223
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:353
1224
  msgid "Pay Now"
1225
  msgstr ""
1226
 
1227
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:354
1228
  msgid "Pay Later"
1229
  msgstr ""
1230
 
1231
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:355
1232
  msgid "Pay Over Time"
1233
  msgstr ""
1234
 
1235
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:368
1236
  msgid "Click %1$shere%2$s for Klarna test payment methods."
1237
  msgstr ""
1238
 
1239
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:374
1240
  msgid "Your purchase is not approved."
1241
  msgstr ""
1242
 
@@ -2111,11 +2111,11 @@ msgstr ""
2111
  msgid "The IBAN you entered is incomplete."
2112
  msgstr ""
2113
 
2114
- #: includes/wc-stripe-webhook-functions.php:92
2115
  msgid "Charge.succeeded webhook received. Payment has been completed."
2116
  msgstr ""
2117
 
2118
- #: includes/wc-stripe-webhook-functions.php:132
2119
  msgid "payment_intent.succeeded webhook received. Payment has been completed."
2120
  msgstr ""
2121
 
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Stripe For WooCommerce 3.3.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-06-02T02:02:47+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
137
  msgstr ""
138
 
139
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:535
140
+ #: includes/wc-stripe-webhook-functions.php:226
141
  msgid "Order refunded in Stripe. Amount: %s"
142
  msgstr ""
143
 
730
  msgid "This request is invalid. Please try again."
731
  msgstr ""
732
 
733
+ #: includes/class-wc-stripe-redirect-handler.php:55
 
 
 
 
734
  msgid "Payment authorization failed. Please select another payment method."
735
  msgstr ""
736
 
737
+ #: includes/class-wc-stripe-redirect-handler.php:61
738
  msgid "Payment authorization failed."
739
  msgstr ""
740
 
847
  msgid "Invalid signature received. Verify that your webhook secret is correct."
848
  msgstr ""
849
 
850
+ #: includes/controllers/class-wc-stripe-controller-webhook.php:54
851
+ msgid "Error processing webhook. Message: %s Exception: %s"
852
+ msgstr ""
853
+
854
  #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:26
855
  msgid "ACH"
856
  msgstr ""
1220
  msgid "Fee"
1221
  msgstr ""
1222
 
1223
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:350
1224
  msgid "Pay Now"
1225
  msgstr ""
1226
 
1227
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:351
1228
  msgid "Pay Later"
1229
  msgstr ""
1230
 
1231
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:352
1232
  msgid "Pay Over Time"
1233
  msgstr ""
1234
 
1235
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:365
1236
  msgid "Click %1$shere%2$s for Klarna test payment methods."
1237
  msgstr ""
1238
 
1239
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:371
1240
  msgid "Your purchase is not approved."
1241
  msgstr ""
1242
 
2111
  msgid "The IBAN you entered is incomplete."
2112
  msgstr ""
2113
 
2114
+ #: includes/wc-stripe-webhook-functions.php:101
2115
  msgid "Charge.succeeded webhook received. Payment has been completed."
2116
  msgstr ""
2117
 
2118
+ #: includes/wc-stripe-webhook-functions.php:141
2119
  msgid "payment_intent.succeeded webhook received. Payment has been completed."
2120
  msgstr ""
2121
 
includes/abstract/abstract-wc-payment-gateway-stripe.php CHANGED
@@ -381,7 +381,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
381
 
382
  return array(
383
  'result' => 'success',
384
- 'redirect' => $order->get_checkout_order_received_url(),
385
  );
386
  } else {
387
  return array(
381
 
382
  return array(
383
  'result' => 'success',
384
+ 'redirect' => $this->get_return_url( $order ),
385
  );
386
  } else {
387
  return array(
includes/abstract/abstract-wc-stripe-payment.php CHANGED
@@ -301,4 +301,13 @@ abstract class WC_Stripe_Payment {
301
  $note = apply_filters( 'wc_stripe_order_failed_note', $note, $error, $this->payment_method );
302
  $order->update_status( 'failed', $note );
303
  }
 
 
 
 
 
 
 
 
 
304
  }
301
  $note = apply_filters( 'wc_stripe_order_failed_note', $note, $error, $this->payment_method );
302
  $order->update_status( 'failed', $note );
303
  }
304
+
305
+ /**
306
+ * @param $payment_method
307
+ *
308
+ * @since 3.3.3
309
+ */
310
+ public function set_payment_method( $payment_method ) {
311
+ $this->payment_method = $payment_method;
312
+ }
313
  }
includes/class-stripe.php CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
25
  *
26
  * @var string
27
  */
28
- public $version = '3.3.2';
29
 
30
  /**
31
  *
@@ -137,6 +137,8 @@ class WC_Stripe_Manager {
137
  }
138
  }
139
  }
 
 
140
  }
141
 
142
  /**
@@ -149,6 +151,7 @@ class WC_Stripe_Manager {
149
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-install.php';
150
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-update.php';
151
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
 
152
 
153
  if ( is_admin() ) {
154
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-menus.php';
@@ -218,7 +221,6 @@ class WC_Stripe_Manager {
218
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-scripts.php';
219
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-field-manager.php';
220
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
221
- include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway.php';
222
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-customer-manager.php';
223
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway-conversions.php';
224
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-redirect-handler.php';
25
  *
26
  * @var string
27
  */
28
+ public $version = '3.3.3';
29
 
30
  /**
31
  *
137
  }
138
  }
139
  }
140
+
141
+ \PaymentPlugins\CartFlows\Stripe\Main::init();
142
  }
143
 
144
  /**
151
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-install.php';
152
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-update.php';
153
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
154
+ include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway.php';
155
 
156
  if ( is_admin() ) {
157
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-menus.php';
221
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-scripts.php';
222
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-field-manager.php';
223
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
 
224
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-customer-manager.php';
225
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway-conversions.php';
226
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-redirect-handler.php';
includes/class-wc-stripe-constants.php CHANGED
@@ -48,4 +48,17 @@ class WC_Stripe_Constants {
48
  * @since 3.2.11
49
  */
50
  const PROCESSING_PAYMENT = 'processing_payment';
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
48
  * @since 3.2.11
49
  */
50
  const PROCESSING_PAYMENT = 'processing_payment';
51
+
52
+ /**
53
+ * @since 3.3.3
54
+ */
55
+ const REQUIRES_CONFIRMATION = 'requires_confirmation';
56
+
57
+ const REQUIRES_ACTION = 'requires_action';
58
+
59
+ const SUCCEEDED = 'succeeded';
60
+
61
+ const REQUIRES_CAPTURE = 'requires_capture';
62
+
63
+ const REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
64
  }
includes/class-wc-stripe-frontend-scripts.php CHANGED
@@ -67,7 +67,7 @@ class WC_Stripe_Frontend_Scripts {
67
  script.setAttribute(\'src\', \'' . $this->assets_url( 'js/frontend/promise-polyfill.min.js' ) . '\');
68
  document.head.appendChild(script);
69
  }
70
- }())' );
71
  }
72
  }
73
 
67
  script.setAttribute(\'src\', \'' . $this->assets_url( 'js/frontend/promise-polyfill.min.js' ) . '\');
68
  document.head.appendChild(script);
69
  }
70
+ }());' );
71
  }
72
  }
73
 
includes/class-wc-stripe-gateway.php CHANGED
@@ -90,6 +90,7 @@ class WC_Stripe_Gateway {
90
  $this->secret_key = $secret_key;
91
  }
92
  $this->client = new \Stripe\StripeClient( array( 'stripe_version' => '2020-08-27' ) );
 
93
  }
94
 
95
  public static function init() {
@@ -430,6 +431,7 @@ class WC_Stripe_Gateway {
430
  /**
431
  *
432
  * @param \Stripe\Exception\ApiErrorException $e
 
433
  *
434
  * @since 3.1.1
435
  * @todo use in future version to replace manual returns of WP_Error in each method
@@ -444,5 +446,3 @@ class WC_Stripe_Gateway {
444
  return new WP_Error( $code, $this->get_error_message( $err ), $err );
445
  }
446
  }
447
-
448
- WC_Stripe_Gateway::init();
90
  $this->secret_key = $secret_key;
91
  }
92
  $this->client = new \Stripe\StripeClient( array( 'stripe_version' => '2020-08-27' ) );
93
+ self::init();
94
  }
95
 
96
  public static function init() {
431
  /**
432
  *
433
  * @param \Stripe\Exception\ApiErrorException $e
434
+ * @param string $code
435
  *
436
  * @since 3.1.1
437
  * @todo use in future version to replace manual returns of WP_Error in each method
446
  return new WP_Error( $code, $this->get_error_message( $err ), $err );
447
  }
448
  }
 
 
includes/class-wc-stripe-payment-charge-local.php CHANGED
@@ -24,7 +24,7 @@ class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
24
  if ( ( $source_id = $this->payment_method->get_new_source_token() ) ) {
25
  // source was created client side.
26
  $source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->retrieve( $source_id );
27
-
28
  if ( is_wp_error( $source ) ) {
29
  return $source;
30
  }
@@ -48,13 +48,19 @@ class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
48
  }
49
 
50
  if ( is_wp_error( $source ) ) {
 
 
 
 
 
 
 
 
 
 
51
  throw new Exception( $source->get_error_message() );
52
  }
53
-
54
- $order->update_meta_data( WC_Stripe_Constants::SOURCE_ID, $source->id );
55
- $order->update_meta_data( WC_Stripe_Constants::MODE, wc_stripe_mode() );
56
-
57
- $order->save();
58
 
59
  /**
60
  * If source is chargeable, then proceed with processing it.
@@ -80,4 +86,14 @@ class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
80
  return parent::process_payment( $order );
81
  }
82
  }
 
 
 
 
 
 
 
 
 
 
83
  }
24
  if ( ( $source_id = $this->payment_method->get_new_source_token() ) ) {
25
  // source was created client side.
26
  $source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->retrieve( $source_id );
27
+ $this->save_order_data( $source_id, $order );
28
  if ( is_wp_error( $source ) ) {
29
  return $source;
30
  }
48
  }
49
 
50
  if ( is_wp_error( $source ) ) {
51
+ // if the error was caused by attempting to update a chargeable source, this means the
52
+ // source status changed in Stripe while plugin code was processing. Redirect to thank you page
53
+ // and let webhook process the order.
54
+ if ( false !== strpos( strtolower( $source->get_error_message() ), 'update of a chargeable source for single use not allowed' ) ) {
55
+
56
+ return (object) array(
57
+ 'complete_payment' => false,
58
+ 'redirect' => $this->payment_method->get_return_url( $order )
59
+ );
60
+ }
61
  throw new Exception( $source->get_error_message() );
62
  }
63
+ $this->save_order_data( $source->id, $order );
 
 
 
 
64
 
65
  /**
66
  * If source is chargeable, then proceed with processing it.
86
  return parent::process_payment( $order );
87
  }
88
  }
89
+
90
+ /**
91
+ * @param string $source_id
92
+ * @param WC_Order $order
93
+ */
94
+ private function save_order_data( $source_id, $order ) {
95
+ $order->update_meta_data( WC_Stripe_Constants::MODE, wc_stripe_mode() );
96
+ $order->update_meta_data( WC_Stripe_Constants::SOURCE_ID, $source_id );
97
+ $order->save();
98
+ }
99
  }
includes/class-wc-stripe-redirect-handler.php CHANGED
@@ -50,9 +50,7 @@ class WC_Stripe_Redirect_Handler {
50
  $redirect = $order->get_checkout_order_received_url();
51
 
52
  if ( in_array( $result->status, array( 'requires_action', 'pending' ) ) ) {
53
- wc_add_notice( __( 'Payment for order was not completed.', 'woo-stripe-payment' ), 'error' );
54
-
55
- return;
56
  } elseif ( in_array( $result->status, array( 'requires_payment_method', 'failed' ) ) ) {
57
  wc_add_notice( __( 'Payment authorization failed. Please select another payment method.', 'woo-stripe-payment' ), 'error' );
58
  if ( $result instanceof \Stripe\PaymentIntent ) {
50
  $redirect = $order->get_checkout_order_received_url();
51
 
52
  if ( in_array( $result->status, array( 'requires_action', 'pending' ) ) ) {
53
+ $order->update_status( 'on-hold' );
 
 
54
  } elseif ( in_array( $result->status, array( 'requires_payment_method', 'failed' ) ) ) {
55
  wc_add_notice( __( 'Payment authorization failed. Please select another payment method.', 'woo-stripe-payment' ), 'error' );
56
  if ( $result instanceof \Stripe\PaymentIntent ) {
includes/controllers/class-wc-stripe-controller-webhook.php CHANGED
@@ -46,11 +46,13 @@ class WC_Stripe_Controller_Webhook extends WC_Stripe_Rest_Controller {
46
  do_action( 'wc_stripe_webhook_' . $type, $event->data->object, $request, $event );
47
 
48
  return rest_ensure_response( apply_filters( 'wc_stripe_webhook_response', array(), $event, $request ) );
49
- } catch ( \Stripe\Error\SignatureVerification $e ) {
50
  wc_stripe_log_info( __( 'Invalid signature received. Verify that your webhook secret is correct.', 'woo-stripe-payment' ) );
51
 
52
  return $this->send_error_response( __( 'Invalid signature received. Verify that your webhook secret is correct.', 'woo-stripe-payment' ), 401 );
53
  } catch ( Exception $e ) {
 
 
54
  return $this->send_error_response( $e->getMessage() );
55
  }
56
  }
46
  do_action( 'wc_stripe_webhook_' . $type, $event->data->object, $request, $event );
47
 
48
  return rest_ensure_response( apply_filters( 'wc_stripe_webhook_response', array(), $event, $request ) );
49
+ } catch ( \Stripe\Exception\SignatureVerificationException $e ) {
50
  wc_stripe_log_info( __( 'Invalid signature received. Verify that your webhook secret is correct.', 'woo-stripe-payment' ) );
51
 
52
  return $this->send_error_response( __( 'Invalid signature received. Verify that your webhook secret is correct.', 'woo-stripe-payment' ), 401 );
53
  } catch ( Exception $e ) {
54
+ wc_stripe_log_info( sprintf( __( 'Error processing webhook. Message: %s Exception: %s', 'woo-stripe-payment' ), $e->getMessage(), get_class( $e ) ) );
55
+
56
  return $this->send_error_response( $e->getMessage() );
57
  }
58
  }
includes/gateways/class-wc-payment-gateway-stripe-klarna.php CHANGED
@@ -121,7 +121,7 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
121
  }
122
 
123
  public function get_update_source_args( $order ) {
124
- $args = $this->get_source_args( $order, true );
125
  unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
126
 
127
  return $args;
@@ -334,12 +334,9 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
334
  * @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
335
  */
336
  public function get_source_redirect_url( $source, $order ) {
337
- $klarna_categories = explode( ',', $source['klarna']['payment_method_categories'] );
338
- $klarna_categories = array_intersect( $klarna_categories, $this->get_option( 'payment_categories' ) );
339
- $source['klarna']['payment_method_categories'] = implode( $klarna_categories, ',' );
340
- $source['redirect'] = add_query_arg( 'source', $order->get_meta( WC_Stripe_Constants::SOURCE_ID ), $this->get_local_payment_return_url( $order ) );
341
 
342
- return '#response=' . base64_encode( wp_json_encode( $source ) );
343
  }
344
 
345
  /**
121
  }
122
 
123
  public function get_update_source_args( $order ) {
124
+ $args = array_merge( parent::get_update_source_args( $order ), $this->get_source_args( $order ) );
125
  unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
126
 
127
  return $args;
334
  * @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
335
  */
336
  public function get_source_redirect_url( $source, $order ) {
337
+ $order->update_status( 'on-hold' );
 
 
 
338
 
339
+ return $order->get_checkout_order_received_url();
340
  }
341
 
342
  /**
includes/wc-stripe-functions.php CHANGED
@@ -1023,7 +1023,7 @@ function wc_stripe_pre_orders_active() {
1023
  */
1024
  function wc_stripe_get_order_from_source_id( $source_id ) {
1025
  global $wpdb;
1026
- $order_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id WHERE meta.meta_key = %s AND meta.meta_value = %s LIMIT 1", '_stripe_source_id', $source_id ) );
1027
 
1028
  return wc_get_order( $order_id );
1029
  }
1023
  */
1024
  function wc_stripe_get_order_from_source_id( $source_id ) {
1025
  global $wpdb;
1026
+ $order_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id WHERE meta.meta_key = %s AND meta.meta_value = %s LIMIT 1", WC_Stripe_Constants::SOURCE_ID, $source_id ) );
1027
 
1028
  return wc_get_order( $order_id );
1029
  }
includes/wc-stripe-hooks.php CHANGED
@@ -8,7 +8,7 @@ add_action( 'woocommerce_payment_token_deleted', 'wc_stripe_woocommerce_payment_
8
  add_action( 'woocommerce_order_status_cancelled', 'wc_stripe_order_cancelled', 10, 2 );
9
  add_action( 'woocommerce_order_status_completed', 'wc_stripe_order_status_completed', 10, 2 );
10
  add_action( 'wc_stripe_remove_order_locks', 'wc_stripe_remove_order_locks' );
11
-
12
  /**
13
  * * Webhook Actions ***
14
  */
8
  add_action( 'woocommerce_order_status_cancelled', 'wc_stripe_order_cancelled', 10, 2 );
9
  add_action( 'woocommerce_order_status_completed', 'wc_stripe_order_status_completed', 10, 2 );
10
  add_action( 'wc_stripe_remove_order_locks', 'wc_stripe_remove_order_locks' );
11
+ add_action( 'wc_stripe_retry_source_chargeable', 'wc_stripe_retry_source_chargeable' );
12
  /**
13
  * * Webhook Actions ***
14
  */
includes/wc-stripe-webhook-functions.php CHANGED
@@ -11,17 +11,26 @@ defined( 'ABSPATH' ) || exit();
11
  * @package Stripe/Functions
12
  */
13
  function wc_stripe_process_source_chargeable( $source, $request ) {
14
- /*
15
- * There is no order ID in the metadata which means this source was created
16
- * client side using stripe.createsource()
17
- * It will be processed via the checkout page.
18
- */
19
- if ( $source->flow === 'none' && ! $source->metadata['order_id'] ) {
20
- return;
21
  }
22
- $order = wc_get_order( wc_stripe_filter_order_id( $source->metadata['order_id'], $source ) );
23
  if ( ! $order ) {
24
- wc_stripe_log_error( sprintf( 'Could not create a charge for source %s. No order ID was found in your WordPress database.', $source->id ) );
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  return;
27
  }
@@ -230,3 +239,16 @@ function wc_stripe_process_create_refund( $charge ) {
230
  wc_stripe_log_error( sprintf( 'Error processing refund webhook. Error: %s', $e->getMessage() ) );
231
  }
232
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  * @package Stripe/Functions
12
  */
13
  function wc_stripe_process_source_chargeable( $source, $request ) {
14
+
15
+ if ( isset( $source->metadata['order_id'] ) ) {
16
+ $order = wc_get_order( wc_stripe_filter_order_id( $source->metadata['order_id'], $source ) );
17
+ } else {
18
+ // try finding order using source.
19
+ $order = wc_stripe_get_order_from_source_id( $source->id );
 
20
  }
 
21
  if ( ! $order ) {
22
+ /**
23
+ * If the order ID metadata is empty, it's possible the source became chargeable before
24
+ * the plugin had a chance to update the order ID. Schedule a cron job to execute in 60 seconds
25
+ * so the plugin can update the order ID and the charge can be processed.
26
+ */
27
+ if ( empty( $source->metadata['order_id'] ) ) {
28
+ if ( method_exists( WC(), 'queue' ) && ! doing_action( 'wc_stripe_retry_source_chargeable' ) ) {
29
+ WC()->queue()->schedule_single( time() + MINUTE_IN_SECONDS, 'wc_stripe_retry_source_chargeable', array( $source->id ) );
30
+ }
31
+ } else {
32
+ wc_stripe_log_error( sprintf( 'Could not create a charge for source %s. No order ID was found in your WordPress database.', $source->id ) );
33
+ }
34
 
35
  return;
36
  }
239
  wc_stripe_log_error( sprintf( 'Error processing refund webhook. Error: %s', $e->getMessage() ) );
240
  }
241
  }
242
+
243
+ /**
244
+ * @param $source_id
245
+ *
246
+ * @throws \Stripe\Exception\ApiErrorException
247
+ */
248
+ function wc_stripe_retry_source_chargeable( $source_id ) {
249
+ $source = WC_Stripe_Gateway::load()->sources->retrieve( $source_id );
250
+ if ( ! is_wp_error( $source ) ) {
251
+ wc_stripe_log_info( sprintf( 'Processing source.chargeable via scheduled action. Source ID %s', $source_id ) );
252
+ wc_stripe_process_source_chargeable( $source, null );
253
+ }
254
+ }
packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payment-request.js CHANGED
@@ -5,7 +5,7 @@ import {getTransactionInfo, getShippingOptionParameters} from "../util";
5
 
6
  export const usePaymentRequest = ({getData, publishableKey, merchantInfo, billing, shippingData}) => {
7
  const {billingData} = billing;
8
- const {shippingRates, shippingAddress} = shippingData;
9
  const {processingCountry, totalPriceLabel} = getData();
10
 
11
  const paymentRequest = useMemo(() => {
5
 
6
  export const usePaymentRequest = ({getData, publishableKey, merchantInfo, billing, shippingData}) => {
7
  const {billingData} = billing;
8
+ const {shippingRates} = shippingData;
9
  const {processingCountry, totalPriceLabel} = getData();
10
 
11
  const paymentRequest = useMemo(() => {
packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payments-client.js CHANGED
@@ -51,7 +51,7 @@ export const usePaymentsClient = (
51
  if (isAddressValid(currentBilling.current.billingData, ['phone', 'email']) && isEmpty(currentBilling.current.billingData?.phone)) {
52
  billingAddress = {phoneNumber: billingAddress.phoneNumber};
53
  }
54
- exportedValues.billingData = toCartAddress(billingAddress, {email: paymentData.email});
55
  }
56
  if (paymentData?.shippingAddress) {
57
  exportedValues.shippingAddress = toCartAddress(paymentData.shippingAddress);
@@ -67,7 +67,6 @@ export const usePaymentsClient = (
67
  onClick();
68
  try {
69
  let paymentData = await paymentsClient.loadPaymentData(paymentRequest);
70
- const {billingData} = currentBilling.current;
71
 
72
  // set the address data so it can be used during the checkout process
73
  setAddressData(paymentData);
@@ -77,7 +76,7 @@ export const usePaymentsClient = (
77
  let result = await stripe.createPaymentMethod({
78
  type: 'card',
79
  card: {token: data.id},
80
- billing_details: getBillingDetailsFromAddress(billingData)
81
  });
82
 
83
  if (result.error) {
51
  if (isAddressValid(currentBilling.current.billingData, ['phone', 'email']) && isEmpty(currentBilling.current.billingData?.phone)) {
52
  billingAddress = {phoneNumber: billingAddress.phoneNumber};
53
  }
54
+ exportedValues.billingData = currentBilling.current.billingData = toCartAddress(billingAddress, {email: paymentData.email});
55
  }
56
  if (paymentData?.shippingAddress) {
57
  exportedValues.shippingAddress = toCartAddress(paymentData.shippingAddress);
67
  onClick();
68
  try {
69
  let paymentData = await paymentsClient.loadPaymentData(paymentRequest);
 
70
 
71
  // set the address data so it can be used during the checkout process
72
  setAddressData(paymentData);
76
  let result = await stripe.createPaymentMethod({
77
  type: 'card',
78
  card: {token: data.id},
79
+ billing_details: getBillingDetailsFromAddress(currentBilling.current.billingData)
80
  });
81
 
82
  if (result.error) {
packages/blocks/assets/js/payment-methods/googlepay/util.js CHANGED
@@ -1,5 +1,8 @@
1
  import {getShippingOptionId, removeNumberPrecision, toCartAddress as mapAddressToCartAddress} from "../util";
2
  import {formatPrice} from '../util';
 
 
 
3
 
4
  const ADDRESS_MAPPINGS = {
5
  name: (address, name) => {
@@ -51,13 +54,9 @@ export const getPaymentRequestUpdate = ({billing, shippingData, processingCountr
51
  */
52
  const getDisplayItems = (cartTotalItems, unit = 2) => {
53
  let items = [];
 
54
  cartTotalItems.forEach(item => {
55
- /**
56
- * @todo when blocks provides the line item type, we can show
57
- * shipping when it's a $0. We currently filter because there's no
58
- * reason to show things like fees if they're $0 to keep the wallet clean.
59
- */
60
- if (0 < item.value) {
61
  items.push({
62
  label: item.label,
63
  type: 'LINE_ITEM',
1
  import {getShippingOptionId, removeNumberPrecision, toCartAddress as mapAddressToCartAddress} from "../util";
2
  import {formatPrice} from '../util';
3
+ import {getSetting} from '@woocommerce/settings'
4
+
5
+ const generalData = getSetting('stripeGeneralData');
6
 
7
  const ADDRESS_MAPPINGS = {
8
  name: (address, name) => {
54
  */
55
  const getDisplayItems = (cartTotalItems, unit = 2) => {
56
  let items = [];
57
+ const keys = ['total_tax', 'total_shipping'];
58
  cartTotalItems.forEach(item => {
59
+ if (0 < item.value || (item.key && keys.includes(item.key))) {
 
 
 
 
 
60
  items.push({
61
  label: item.label,
62
  type: 'LINE_ITEM',
packages/blocks/assets/js/payment-methods/local-payment/klarna/categories.js CHANGED
@@ -1,12 +1,13 @@
1
  import {useEffect} from '@wordpress/element';
2
  import RadioControlAccordion from "../../../components/checkout/radio-control-accordion";
3
 
4
- export const KlarnaPaymentCategories = ({categories, onChange, selected}) => {
5
  return (
6
  <div className={'wc-stripe-blocks-klarna-container'}>
7
  <ul>
8
  {categories.map(category => {
9
  return <KlarnaPaymentCategory
 
10
  key={category.type}
11
  category={category}
12
  onChange={onChange}
@@ -17,15 +18,14 @@ export const KlarnaPaymentCategories = ({categories, onChange, selected}) => {
17
  );
18
  }
19
 
20
- const KlarnaPaymentCategory = ({category, selected, onChange}) => {
21
  const checked = category.type === selected;
22
  useEffect(() => {
23
  Klarna.Payments.load({
24
  container: `#klarna-category-${category.type}`,
25
- payment_method_category: category.type,
26
- //instance_id: `klarna-instance-${category.type}`
27
  });
28
- }, []);
29
  const option = {
30
  label: category.label,
31
  value: category.type,
1
  import {useEffect} from '@wordpress/element';
2
  import RadioControlAccordion from "../../../components/checkout/radio-control-accordion";
3
 
4
+ export const KlarnaPaymentCategories = ({source, categories, onChange, selected}) => {
5
  return (
6
  <div className={'wc-stripe-blocks-klarna-container'}>
7
  <ul>
8
  {categories.map(category => {
9
  return <KlarnaPaymentCategory
10
+ source={source}
11
  key={category.type}
12
  category={category}
13
  onChange={onChange}
18
  );
19
  }
20
 
21
+ const KlarnaPaymentCategory = ({source, category, selected, onChange}) => {
22
  const checked = category.type === selected;
23
  useEffect(() => {
24
  Klarna.Payments.load({
25
  container: `#klarna-category-${category.type}`,
26
+ payment_method_category: category.type
 
27
  });
28
+ }, [source]);
29
  const option = {
30
  label: category.label,
31
  value: category.type,
packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-create-source.js CHANGED
@@ -4,8 +4,6 @@ import {useStripeError} from "../../../hooks";
4
  import {getDefaultSourceArgs, getRoute, isAddressValid, StripeError, storeInCache, getFromCache} from "../../../util";
5
  import apiFetch from "@wordpress/api-fetch";
6
 
7
- let klarnaSource = {};
8
-
9
  export const useCreateSource = (
10
  {
11
  getData,
@@ -96,7 +94,7 @@ export const useCreateSource = (
96
  return ['type', 'currency', 'statement_descriptor', 'redirect', 'klarna.product', 'klarna.locale', 'klarna.custom_payment_methods'].reduce((obj, k) => {
97
  if (k.indexOf('.') > -1) {
98
  let keys = k.split('.');
99
- let obj2 = keys.slice(0, keys.length - 1).reduce(function (obj, k) {
100
  return obj[k];
101
  }, obj);
102
  k = keys[keys.length - 1];
@@ -109,15 +107,20 @@ export const useCreateSource = (
109
  }
110
 
111
  const compareSourceArgs = useCallback((args, args2) => {
112
- const getArgs = (args1, args2) => {
113
- const newArgs = {};
114
- for (let key of Object.keys(args1)) {
115
- if (typeof args1[key] === 'object' && !Array.isArray(args1[key])) {
116
- newArgs[key] = getArgs(args1[key], args2[key]);
117
- } else {
118
- newArgs[key] = args2[key];
 
 
119
  }
 
 
120
  }
 
121
  return newArgs;
122
  }
123
  const newArgs = getArgs(args, args2);
@@ -154,7 +157,7 @@ export const useCreateSource = (
154
  setSource
155
  ]);
156
 
157
- const updateSource = useCallback(async ({source, updates}) => {
158
 
159
  const data = {
160
  updates,
@@ -172,8 +175,8 @@ export const useCreateSource = (
172
  signal: abortController.current.signal
173
  });
174
  if (result.source) {
175
- storeInCache('klarna:source', {source, args: currentSourceArgs.current});
176
- setSource(source);
177
  }
178
  } catch (err) {
179
  console.log('update aborted');
@@ -224,7 +227,7 @@ export const useCreateSource = (
224
  shippingData
225
  }));
226
  if (!compareSourceArgs(updates, oldSourceArgs.current)) {
227
- updateSource({source, updates});
228
  }
229
  }
230
  }, [
4
  import {getDefaultSourceArgs, getRoute, isAddressValid, StripeError, storeInCache, getFromCache} from "../../../util";
5
  import apiFetch from "@wordpress/api-fetch";
6
 
 
 
7
  export const useCreateSource = (
8
  {
9
  getData,
94
  return ['type', 'currency', 'statement_descriptor', 'redirect', 'klarna.product', 'klarna.locale', 'klarna.custom_payment_methods'].reduce((obj, k) => {
95
  if (k.indexOf('.') > -1) {
96
  let keys = k.split('.');
97
+ let obj2 = keys.slice(0, keys.length - 1).reduce((obj, k) => {
98
  return obj[k];
99
  }, obj);
100
  k = keys[keys.length - 1];
107
  }
108
 
109
  const compareSourceArgs = useCallback((args, args2) => {
110
+ const getArgs = (args1, args2, key = false) => {
111
+ let newArgs = {};
112
+ if (args1 && typeof args1 === 'object' && !Array.isArray(args1)) {
113
+ for (let key of Object.keys(args1)) {
114
+ if (typeof args1[key] === 'object' && !Array.isArray(args1[key])) {
115
+ newArgs[key] = getArgs(args1[key], args2[key]);
116
+ } else {
117
+ newArgs[key] = args2[key];
118
+ }
119
  }
120
+ } else {
121
+ newArgs = args1;
122
  }
123
+
124
  return newArgs;
125
  }
126
  const newArgs = getArgs(args, args2);
157
  setSource
158
  ]);
159
 
160
+ const updateSource = useCallback(async ({source, updates, currency}) => {
161
 
162
  const data = {
163
  updates,
175
  signal: abortController.current.signal
176
  });
177
  if (result.source) {
178
+ storeInCache('klarna:source', {[currency]: {source, args: currentSourceArgs.current}});
179
+ setSource(result.source);
180
  }
181
  } catch (err) {
182
  console.log('update aborted');
227
  shippingData
228
  }));
229
  if (!compareSourceArgs(updates, oldSourceArgs.current)) {
230
+ updateSource({source, updates, currency: currency.code});
231
  }
232
  }
233
  }, [
packages/blocks/assets/js/payment-methods/local-payment/klarna/index.js CHANGED
@@ -35,6 +35,7 @@ const KlarnaPaymentMethod = (
35
  const {responseTypes} = emitResponse;
36
  const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;
37
  const [selected, setSelected] = useState('');
 
38
  const getCategoriesFromSource = (source) => {
39
  const paymentMethodCategories = source.klarna.payment_method_categories.split(',');
40
  const categories = [];
@@ -72,13 +73,20 @@ const KlarnaPaymentMethod = (
72
  }
73
  }, [source]);
74
 
75
- if (source) {
76
- Klarna.Payments.init({
77
- client_token: source.klarna.client_token
78
- });
 
 
 
 
 
 
79
  const categories = getCategoriesFromSource(source);
80
  return (
81
  <KlarnaPaymentCategories
 
82
  categories={categories}
83
  selected={!selected && categories.length > 0 ? categories[0].type : selected}
84
  onChange={setSelected}/>
35
  const {responseTypes} = emitResponse;
36
  const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;
37
  const [selected, setSelected] = useState('');
38
+ const [klarnaInitialized, setKlarnaInitialized] = useState(false);
39
  const getCategoriesFromSource = (source) => {
40
  const paymentMethodCategories = source.klarna.payment_method_categories.split(',');
41
  const categories = [];
73
  }
74
  }, [source]);
75
 
76
+ useEffect(() => {
77
+ if (source) {
78
+ Klarna.Payments.init({
79
+ client_token: source.klarna.client_token
80
+ });
81
+ setKlarnaInitialized(true);
82
+ }
83
+ }, [source?.id]);
84
+
85
+ if (source && klarnaInitialized) {
86
  const categories = getCategoriesFromSource(source);
87
  return (
88
  <KlarnaPaymentCategories
89
+ source={source}
90
  categories={categories}
91
  selected={!selected && categories.length > 0 ? categories[0].type : selected}
92
  onChange={setSelected}/>
packages/blocks/assets/js/payment-methods/util.js CHANGED
@@ -107,12 +107,12 @@ export const getBillingDetailsFromAddress = (billingAddress) => {
107
  let billing_details = {
108
  name: `${billingAddress.first_name} ${billingAddress.last_name}`,
109
  address: {
110
- city: billingAddress.city || '',
111
- country: billingAddress.country || '',
112
- line1: billingAddress.address_1 || '',
113
- line2: billingAddress.address_2 || '',
114
- postal_code: billingAddress.postcode || '',
115
- state: billingAddress.state || ''
116
  }
117
  }
118
  if (billingAddress?.phone) {
@@ -383,8 +383,9 @@ export const getShippingOptionId = (packageId, rateId) => `${packageId}:${rateId
383
 
384
  export const getDisplayItems = (cartItems, {minorUnit}) => {
385
  let items = [];
 
386
  cartItems.forEach(item => {
387
- if (0 < item.value) {
388
  items.push({
389
  label: item.label,
390
  pending: false,
@@ -488,6 +489,22 @@ export const deleteFromCache = (key) => {
488
  }
489
  }
490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
  export const isCartPage = () => getSetting('stripeGeneralData').page === 'cart';
492
 
493
  export const isCheckoutPage = () => getSetting('stripeGeneralData').page === 'checkout';
107
  let billing_details = {
108
  name: `${billingAddress.first_name} ${billingAddress.last_name}`,
109
  address: {
110
+ city: billingAddress.city || null,
111
+ country: billingAddress.country || null,
112
+ line1: billingAddress.address_1 || null,
113
+ line2: billingAddress.address_2 || null,
114
+ postal_code: billingAddress.postcode || null,
115
+ state: billingAddress.state || null
116
  }
117
  }
118
  if (billingAddress?.phone) {
383
 
384
  export const getDisplayItems = (cartItems, {minorUnit}) => {
385
  let items = [];
386
+ const keys = ['total_tax', 'total_shipping'];
387
  cartItems.forEach(item => {
388
+ if (0 < item.value || (item.key && keys.includes(item.key))) {
389
  items.push({
390
  label: item.label,
391
  pending: false,
489
  }
490
  }
491
 
492
+ export const versionCompare = (ver1, ver2, compare) => {
493
+ switch (compare) {
494
+ case '<':
495
+ return ver1 < ver2;
496
+ case '>':
497
+ return ver1 > ver2;
498
+ case '<=':
499
+ return ver1 <= ver2;
500
+ case '>=':
501
+ return ver1 >= ver2;
502
+ case '=':
503
+ return ver1 == ver2;
504
+ }
505
+ return false;
506
+ }
507
+
508
  export const isCartPage = () => getSetting('stripeGeneralData').page === 'cart';
509
 
510
  export const isCheckoutPage = () => getSetting('stripeGeneralData').page === 'checkout';
packages/blocks/build/commons.js CHANGED
@@ -1,3 +1,3 @@
1
  /*! For license information please see commons.js.LICENSE.txt */
2
- (self.webpackChunkwc_stripe_name_=self.webpackChunkwc_stripe_name_||[]).push([[351],{7228:e=>{e.exports=function(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}},2858:e=>{e.exports=function(e){if(Array.isArray(e))return e}},3646:(e,t,n)=>{var r=n(7228);e.exports=function(e){if(Array.isArray(e))return r(e)}},1506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8926:e=>{function t(e,t,n,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(a,o){var i=e.apply(n,r);function c(e){t(i,a,o,c,s,"next",e)}function s(e){t(i,a,o,c,s,"throw",e)}c(void 0)}))}}},4575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},9100:(e,t,n)=>{var r=n(9489),a=n(7067);function o(t,n,i){return a()?e.exports=o=Reflect.construct:e.exports=o=function(e,t,n){var a=[null];a.push.apply(a,t);var o=new(Function.bind.apply(e,a));return n&&r(o,n.prototype),o},o.apply(null,arguments)}e.exports=o},3913:e=>{function t(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,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}},9713:e=>{e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},7154:e=>{function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}e.exports=t},9754:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(n)}e.exports=t},2205:(e,t,n)=>{var r=n(9489);e.exports=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}}),t&&r(e,t)}},5318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},430:e=>{e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},7067:e=>{e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},6860:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},3884:e=>{e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return n}}},521:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},8206:e=>{e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},6479:(e,t,n)=>{var r=n(7316);e.exports=function(e,t){if(null==e)return{};var n,a,o=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},7316:e=>{e.exports=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}},8585:(e,t,n)=>{var r=n(8),a=n(1506);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?a(e):t}},9489:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(n,r)}e.exports=t},3038:(e,t,n)=>{var r=n(2858),a=n(3884),o=n(379),i=n(521);e.exports=function(e,t){return r(e)||a(e,t)||o(e,t)||i()}},319:(e,t,n)=>{var r=n(3646),a=n(6860),o=n(379),i=n(8206);e.exports=function(e){return r(e)||a(e)||o(e)||i()}},8:e=>{function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t},379:(e,t,n)=>{var r=n(7228);e.exports=function(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}},5957:(e,t,n)=>{var r=n(9754),a=n(9489),o=n(430),i=n(9100);function c(t){var n="function"==typeof Map?new Map:void 0;return e.exports=c=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return i(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),a(t,e)},c(t)}e.exports=c},6664:function(e,t,n){!function(e,t){"use strict";function n(e){return(n="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})(e)}function r(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(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}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function i(){}function c(){}c.resetWarningCache=i;var s,u=(function(e){e.exports=function(){function e(e,t,n,r,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:i};return n.PropTypes=n,n}()}(s={exports:{}},s.exports),s.exports),l=function(e){return null!==e&&"object"===n(e)},p="[object Object]",d=function e(t,n){if(!l(t)||!l(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var a=Object.prototype.toString.call(t)===p;if(a!==(Object.prototype.toString.call(n)===p))return!1;if(!a&&!r)return!1;var o=Object.keys(t),i=Object.keys(n);if(o.length!==i.length)return!1;for(var c={},s=0;s<o.length;s+=1)c[o[s]]=!0;for(var u=0;u<i.length;u+=1)c[i[u]]=!0;var d=Object.keys(c);if(d.length!==o.length)return!1;var f=t,m=n;return d.every((function(t){return e(f[t],m[t])}))},f=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},m=function(e){if(null===e||l(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},y=function(e){if(function(e){return l(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(m)};var t=m(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},g=t.createContext(null);g.displayName="ElementsContext";var v=function(e){var n=e.stripe,r=e.options,o=e.children,i=t.useRef(!1),c=t.useRef(!0),s=t.useMemo((function(){return y(n)}),[n]),u=a(t.useState((function(){return{stripe:null,elements:null}})),2),l=u[0],p=u[1],m=f(n),v=f(r);return null!==m&&(m!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),d(r,v)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),i.current||("sync"===s.tag&&(i.current=!0,p({stripe:s.stripe,elements:s.stripe.elements(r)})),"async"===s.tag&&(i.current=!0,s.stripePromise.then((function(e){e&&c.current&&p({stripe:e,elements:e.elements(r)})})))),t.useEffect((function(){return function(){c.current=!1}}),[]),t.useEffect((function(){var e=l.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.4.0"})}),[l.stripe]),t.createElement(g.Provider,{value:l},o)};v.propTypes={stripe:u.any,options:u.object};var h=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(g),e)},b=function(e){return(0,e.children)(h("mounts <ElementsConsumer>"))};b.propTypes={children:u.func.isRequired};var P=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},E=function(e){return l(e)?(e.paymentRequest,r(e,["paymentRequest"])):{}},O=function(){},S=function(e,n){var r,a="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),o=n?function(e){h("mounts <".concat(a,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,o=n.className,i=n.options,c=void 0===i?{}:i,s=n.onBlur,u=void 0===s?O:s,l=n.onFocus,p=void 0===l?O:l,f=n.onReady,m=void 0===f?O:f,y=n.onChange,g=void 0===y?O:y,v=n.onEscape,b=void 0===v?O:v,S=n.onClick,_=void 0===S?O:S,w=h("mounts <".concat(a,">")).elements,C=t.useRef(null),k=t.useRef(null),M=P(m),j=P(u),D=P(p),R=P(_),x=P(g),A=P(b);t.useLayoutEffect((function(){if(null==C.current&&w&&null!=k.current){var t=w.create(e,c);C.current=t,t.mount(k.current),t.on("ready",(function(){return M(t)})),t.on("change",x),t.on("blur",j),t.on("focus",D),t.on("escape",A),t.on("click",R)}}));var I=t.useRef(c);return t.useEffect((function(){I.current&&I.current.paymentRequest!==c.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=E(c);0===Object.keys(e).length||d(e,E(I.current))||C.current&&(C.current.update(e),I.current=c)}),[c]),t.useLayoutEffect((function(){return function(){C.current&&C.current.destroy()}}),[]),t.createElement("div",{id:r,className:o,ref:k})};return o.propTypes={id:u.string,className:u.string,onChange:u.func,onBlur:u.func,onFocus:u.func,onReady:u.func,onClick:u.func,options:u.object},o.displayName=a,o.__elementType=e,o},_="undefined"==typeof window,w=S("auBankAccount",_),C=S("card",_),k=S("cardNumber",_),M=S("cardExpiry",_),j=S("cardCvc",_),D=S("fpxBank",_),R=S("iban",_),x=S("idealBank",_),A=S("p24Bank",_),I=S("epsBank",_),T=S("paymentRequestButton",_),L=S("afterpayClearpayMessage",_);e.AfterpayClearpayMessageElement=L,e.AuBankAccountElement=w,e.CardCvcElement=j,e.CardElement=C,e.CardExpiryElement=M,e.CardNumberElement=k,e.Elements=v,e.ElementsConsumer=b,e.EpsBankElement=I,e.FpxBankElement=D,e.IbanElement=R,e.IdealBankElement=x,e.P24BankElement=A,e.PaymentRequestButtonElement=T,e.useElements=function(){return h("calls useElements()").elements},e.useStripe=function(){return h("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(3804))},4465:(e,t,n)=>{"use strict";n.r(t),n.d(t,{loadStripe:()=>l});var r="https://js.stripe.com/v3",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,o="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",i=null,c=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.12.1",startTime:t})}(r,n),r},s=Promise.resolve().then((function(){return e=null,null!==i?i:i=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(o),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(r,'"]')),t=0;t<e.length;t++){var n=e[t];if(a.test(n.src))return n}return null}();i&&e?console.warn(o):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(r).concat(t);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),u=!1;s.catch((function(e){u||console.warn(e)}));var l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];u=!0;var r=Date.now();return s.then((function(e){return c(e,t,r)}))}},8149:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.SavePaymentMethod=void 0;var o=a(n(4184));n(1127),t.SavePaymentMethod=function(e){var t=e.label,n=e.onChange,a=e.checked;return r.createElement("div",{className:"wc-stripe-save-payment-method"},r.createElement("label",null,r.createElement("input",{type:"checkbox",onChange:function(e){return n(e.target.checked)}}),r.createElement("svg",{className:(0,o.default)("wc-stripe-components-checkbox__mark",{checked:a}),"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},r.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))),r.createElement("span",null,t))}},3187:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(2029);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(8149);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(8744);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var i=n(4901);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}))},2029:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentMethodLabel=void 0;var o=a(n(6479));n(7776),t.PaymentMethodLabel=function(e){var t=e.title,n=e.icons,a=e.paymentMethod,i=(0,o.default)(e,["title","icons","paymentMethod"]).components,c=i.PaymentMethodLabel,s=i.PaymentMethodIcons;return Array.isArray(n)||(n=[n]),r.createElement("span",{className:"wc-stripe-label-container ".concat(a)},r.createElement(c,{text:t}),r.createElement(s,{icons:n,align:"left"}))}},4901:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentMethod=void 0;var o=a(n(9713)),i=a(n(6479)),c=n(3027);function s(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.PaymentMethod=function(e){var t=e.getData,n=e.content,a=(0,i.default)(e,["getData","content"]),o=n,s=t("description"),p=(0,c.useRef)(null);return(0,c.useEffect)((function(){p.current&&0==p.current.childNodes.length&&p.current.classList.add("no-content")})),r.createElement(r.Fragment,null,s&&r.createElement(l,{desc:s,payment_method:t("name")}),r.createElement("div",{ref:p,className:"wc-stripe-blocks-payment-method-content"},r.createElement(o,u(u({},a),{},{getData:t}))))};var l=function(e){var t=e.desc,n=e.payment_method;return r.createElement("div",{className:"wc-stripe-blocks-payment-method__desc ".concat(n)},r.createElement("p",null,t))}},6630:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.RadioControlAccordion=void 0;var o=a(n(8744)),i=a(n(4184)),c=function(e){var t=e.option,n=e.checked,a=e.onChange,c=t.label,s=t.value;return r.createElement("div",{className:"wc-stripe-blocks-radio-accordion"},r.createElement(o.default,{checked:n,onChange:a,value:s,label:c}),r.createElement("div",{className:(0,i.default)("wc-stripe-blocks-radio-accordion__content",{"wc-stripe-blocks-radio-accordion__content-visible":n})},t.content))};t.RadioControlAccordion=c;var s=c;t.default=s},8744:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.RadioControlOption=void 0;var o=a(n(4184)),i=function(e){var t=e.checked,n=e.onChange,a=e.value,i=e.label;return r.createElement("label",{className:(0,o.default)("wc-stripe-blocks-radio-control__option",{"wc-stripe-blocks-radio-control__option-checked":t})},r.createElement("input",{className:"wc-stripe-blocks-radio-control__input",type:"radio",value:a,checked:t,onChange:function(e){return n(e.target.value)}}),r.createElement("div",{className:"wc-stripe-blocks-radio-control__label"},r.createElement("span",null,i)))};t.RadioControlOption=i;var c=i;t.default=c},7260:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(1293);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(7150);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(5201);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},1293:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateLinkToken=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(3038)),c=n(3027),s=r(n(7606)),u=n(1134);t.useCreateLinkToken=function(e){var t=e.setValidationError,n=(0,c.useState)(!1),r=(0,i.default)(n,2),l=r[0],p=r[1],d=(0,c.useCallback)((0,o.default)(a.default.mark((function e(){var n;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,s.default)({url:(0,u.getRoute)("create/linkToken"),method:"POST",data:{}});case 3:(n=e.sent).token&&((0,u.storeInCache)("linkToken",n.token),p(n.token)),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),t(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),[]);return(0,c.useEffect)((function(){if(!l){var e=(0,u.getFromCache)("linkToken");e?p(e):d()}}),[l,p]),l}},7150:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useInitializePlaid=void 0;var a=n(3027),o=r(n(2810)),i=n(1134);t.useInitializePlaid=function(e){var t=e.getData,n=e.linkToken,r=(0,a.useRef)(null),c=(0,a.useRef)(null),s=(0,a.useCallback)((function(){return new Promise((function(e,t){c.current={resolve:e,reject:t},r.current.open()}))}),[]);return(0,a.useEffect)((function(){n&&(r.current=o.default.create({clientName:t("clientName"),env:t("plaidEnvironment"),product:["auth"],token:n,selectAccount:!0,countryCodes:["US"],onSuccess:function(e,t){c.current.resolve({publicToken:e,metaData:t})},onExit:function(e){c.current.reject(!!e&&(0,i.getErrorMessage)(e.error_message))}}))}),[n]),s}},5201:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPayment=void 0;var a=r(n(7015)),o=r(n(9713)),i=r(n(8926)),c=n(3027),s=n(1134);t.useProcessPayment=function(e){var t=e.openLinkPopup,n=e.onPaymentProcessing,r=e.responseTypes,u=e.paymentMethod;(0,c.useEffect)((function(){var e=n((0,i.default)(a.default.mark((function e(){var n,i,c,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t();case 3:return i=e.sent,c=i.publicToken,l=i.metaData,(0,s.deleteFromCache)("linkToken"),e.abrupt("return",(0,s.ensureSuccessResponse)(r,{meta:{paymentMethodData:(n={},(0,o.default)(n,"".concat(u,"_token_key"),c),(0,o.default)(n,"".concat(u,"_metadata"),JSON.stringify(l)),n)}}));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",(0,s.ensureErrorResponse)(r,e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,9]])}))));return function(){return e()}}),[n,r,t])}},5605:(e,t,n)=>{n(4836),n(4888)},4888:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(3187),p=a(n(1065)),d=n(7260),f=n(3636),m=n(3163),y=(0,u.getSettings)("stripe_ach_data"),g=function(e){var t=e.getData,n=e.eventRegistration,a=e.components,s=e.emitResponse,l=e.onSubmit,p=((0,i.default)(e,["getData","eventRegistration","components","emitResponse","onSubmit"]),s.responseTypes),m=n.onPaymentProcessing,y=n.onCheckoutAfterProcessingWithError,g=a.ValidationInputError,h=(0,c.useState)(!1),b=(0,o.default)(h,2),P=b[0],E=b[1],O=(0,d.useCreateLinkToken)({setValidationError:E});(0,f.useProcessCheckoutError)({responseTypes:p,subscriber:y});var S=(0,d.useInitializePlaid)({getData:t,linkToken:O,onSubmit:l});return(0,d.useProcessPayment)({openLinkPopup:S,onPaymentProcessing:m,responseTypes:p,paymentMethod:t("name")}),r.createElement(r.Fragment,null,u.isTestMode&&r.createElement(v,null),P&&r.createElement(g,{errorMessage:P}))},v=function(){return r.createElement("div",{className:"wc-stripe-blocks-ach__creds"},r.createElement("label",{className:"wc-stripe-blocks-ach__creds-label"},(0,m.__)("Test Credentials","woo-stripe-payment")),r.createElement("div",{className:"wc-stripe-blocks-ach__username"},r.createElement("div",null,r.createElement("strong",null,(0,m.__)("username","woo-stripe-payment")),": user_good"),r.createElement("div",null,r.createElement("strong",null,(0,m.__)("password","woo-stripe-payment")),": pass_good"),r.createElement("div",null,r.createElement("strong",null,(0,m.__)("pin","woo-stripe-payment")),": credential_good")))};(0,s.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icons")}),ariaLabel:"ACH Payment",canMakePayment:function(e){return"USD"===e.cartTotals.currency_code},content:r.createElement(l.PaymentMethod,{getData:y,content:g}),savedTokenComponent:r.createElement(p.default,{getData:y}),edit:r.createElement(g,{getData:y}),placeOrderButtonLabel:y("placeOrderButtonLabel"),supports:{showSavedCards:y("showSavedCards"),showSaveOption:!1,features:y("features")}})},3846:(e,t,n)=>{n(85),n(660)},660:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(6664),p=a(n(7082)),d=n(3636),f=(0,u.getSettings)("stripe_applepay_data"),m=function(e){return r.createElement(p.default,null,r.createElement("div",{className:"wc-stripe-apple-pay-container"},r.createElement(l.Elements,{stripe:u.initStripe},r.createElement(y,e))))},y=function(e){var t=e.getData,n=e.onClick,a=e.onClose,s=e.billing,u=e.shippingData,p=e.eventRegistration,f=e.emitResponse,m=e.onSubmit,y=e.activePaymentMethod,g=((0,i.default)(e,["getData","onClick","onClose","billing","shippingData","eventRegistration","emitResponse","onSubmit","activePaymentMethod"]),p.onPaymentProcessing),v=f.responseTypes,h=f.noticeContexts,b=(0,l.useStripe)(),P=(0,d.useStripeError)(),E=(0,o.default)(P,1)[0],O=(0,d.useExportedValues)();(0,d.useExpressBreakpointWidth)({payment_method:t("name"),width:300});var S=(0,d.useProcessPaymentIntent)({getData:t,billing:s,shippingData:u,onPaymentProcessing:g,emitResponse:f,error:E,onSubmit:m,activePaymentMethod:y,exportedValues:O}).setPaymentMethod;(0,d.useAfterProcessingPayment)({getData:t,eventRegistration:p,responseTypes:v,activePaymentMethod:y,messageContext:h.EXPRESS_PAYMENTS});var _=(0,d.usePaymentRequest)({getData:t,onClose:a,stripe:b,billing:s,shippingData:u,eventRegistration:p,setPaymentMethod:S,exportedValues:O,canPay:function(e){return null!=e&&e.applePay}}).paymentRequest,w=(0,c.useCallback)((function(){_&&(n(),_.show())}),[_]);return _?r.createElement("button",{className:"apple-pay-button ".concat(t("buttonStyle")),style:{"-apple-pay-button-type":t("buttonType")},onClick:w}):null},g=function(e){var t=e.getData;return(0,i.default)(e,["getData"]),r.createElement("div",{className:"apple-pay-block-editor"},r.createElement("img",{src:t("editorIcon")}))};(0,s.registerExpressPaymentMethod)({name:f("name"),canMakePayment:function(e){var t=e.cartTotals;if((0,i.default)(e,["cartTotals"]),f("isAdmin"))return!0;var n=t.currency_code,r=t.total_price;return(0,u.canMakePayment)({country:f("countryCode"),currency:n.toLowerCase(),total:{label:f("totalLabel"),amount:parseInt(r)}},(function(e){return null!=e&&e.applePay}))},content:r.createElement(m,{getData:f}),edit:r.createElement(g,{getData:f}),supports:{showSavedCards:f("showSavedCards"),showSaveOption:f("showSaveOption"),features:f("features")}})},7354:(e,t,n)=>{var r=n(3027);n(3110);var a=n(1134),o=n(6664),i=n(3163),c=function(e){var t=e.CardIcon,n=e.options,a=e.onChange;return r.createElement("div",{className:"wc-stripe-bootstrap-form"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-md-6 mb-3"},r.createElement(o.CardNumberElement,{className:"md-form md-outline stripe-input",options:n.cardNumber,onChange:a(o.CardNumberElement)}),r.createElement("label",{htmlFor:"stripe-card-number"},(0,i.__)("Card Number","woo-stripe-payment")),t),r.createElement("div",{className:"col-md-3 mb-3"},r.createElement(o.CardExpiryElement,{className:"md-form md-outline stripe-input",options:n.cardExpiry,onChange:a(o.CardExpiryElement)}),r.createElement("label",{htmlFor:"stripe-exp"},(0,i.__)("Exp","woo-stripe-payment"))),r.createElement("div",{className:"col-md-3 mb-3"},r.createElement(o.CardCvcElement,{className:"md-form md-outline stripe-input",options:n.cardCvc,onChange:a(o.CardCvcElement)}),r.createElement("label",{htmlFor:"stripe-cvv"},(0,i.__)("CVV","woo-stripe-payment")))))};(0,a.registerCreditCardForm)({id:"bootstrap",breakpoint:475,component:r.createElement(c,null)})},3329:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(9713)),i=a(n(3038)),c=n(1134),s=n(3027),u=n(6664),l=n(3163),p=n(3636);function d(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 f(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 m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y={focus:"focused",empty:"empty",invalid:"invalid"},g=function(e){var t=e.type,n=e.src;return t?r.createElement("img",{className:"wc-stripe-card ".concat(t),src:n}):null};t.default=function(e){var t=e.getData,n=e.onChange,a=(e.ValidationInputError,(0,s.useState)(window.innerWidth)),o=(0,i.default)(a,2),f=(o[0],o[1],(0,s.useState)("")),v=(0,i.default)(f,2),h=v[0],b=v[1],P=(0,s.useRef)([]),E=(0,s.useState)(null),O=(0,i.default)(E,2),S=O[0],_=O[1],w=(0,u.useElements)(),C=t("customForm"),k=(0,c.getCreditCardForm)(C),M=k.component,j=k.breakpoint,D=void 0===j?475:j,R=t("postalCodeEnabled"),x={};["cardNumber","cardExpiry","cardCvc"].forEach((function(e){x[e]=m(m({classes:y},t("cardOptions")),t("customFieldOptions")[e])}));var A=(0,s.useCallback)((function(e){P.current.includes(e)||P.current.push(e)}),[]);(0,p.useBreakpointWidth)({name:"creditCardForm",width:D,node:S,className:"small-form"});var I=(0,s.useCallback)((function(e){var n,r=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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,i=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}(t("icons"));try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.id===e)return a.src}}catch(e){r.e(e)}finally{r.f()}return""}),[]);return M?r.createElement("div",{className:"wc-stripe-custom-form ".concat(C),ref:_},(0,s.cloneElement)(M,{postalCodeEnabled:R,options:x,onChange:function(e){return A(e),function(t){if(n(t),"cardNumber"===t.elementType&&("unknown"===t.brand?b(""):b(t.brand)),t.complete){var r=P.current.indexOf(e);if(P.current[r+1]){var a=P.current[r+1];w.getElement(a).focus()}}}},CardIcon:r.createElement(g,{type:h,src:I(h)})})):r.createElement("div",{className:"wc-stripe-custom-form-error"},r.createElement("p",null,(0,l.sprintf)((0,l.__)("%s is not a valid blocks Stripe custom form. Please choose another custom form option in the Credit Card Settings.","woo-stripe-payment"),t("customFormLabels")[C])))}},6835:(e,t,n)=>{var r=n(3027);n(8356);var a=n(1134),o=n(6664),i=n(3163),c=n(3027),s=function(e){var t=e.CardIcon,n=e.options,a=e.onChange;return(0,c.useEffect)((function(){}),[]),r.createElement("div",{className:"wc-stripe-simple-form"},r.createElement("div",{className:"row"},r.createElement("div",{className:"field"},r.createElement("div",{className:"field-item"},r.createElement(o.CardNumberElement,{id:"stripe-card-number",className:"input empty",options:n.cardNumber,onChange:a(o.CardNumberElement)}),r.createElement("label",{htmlFor:"stripe-card-number","data-tid":""},(0,i.__)("Card Number","woo-stripe-payment")),r.createElement("div",{className:"baseline"}),t))),r.createElement("div",{className:"row"},r.createElement("div",{className:"field half-width"},r.createElement("div",{className:"field-item"},r.createElement(o.CardExpiryElement,{id:"stripe-exp",className:"input empty",options:n.cardExpiry,onChange:a(o.CardExpiryElement)}),r.createElement("label",{htmlFor:"stripe-exp","data-tid":""},(0,i.__)("Expiration","woo-stripe-payment")),r.createElement("div",{className:"baseline"}))),r.createElement("div",{className:"field half-width cvc"},r.createElement("div",{className:"field-item"},r.createElement(o.CardCvcElement,{id:"stripe-cvv",className:"input empty",options:n.cardCvc,onChange:a(o.CardCvcElement)}),r.createElement("label",{htmlFor:"stripe-cvv","data-tid":""},(0,i.__)("CVV","woo-stripe-payment")),r.createElement("div",{className:"baseline"})))))};(0,a.registerCreditCardForm)({id:"simple",component:r.createElement(s,null),breakpoint:375})},9775:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(9713)),i=n(6664),c=n(1134),s=n(3027);function u(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.default=function(e){var t=e.getData,n=e.billing,a=e.onChange,o=(0,s.useMemo)((function(){var e;return l(l({},{value:{postalCode:null==n||null===(e=n.billingData)||void 0===e?void 0:e.postcode},hidePostalCode:(0,c.isFieldRequired)("postcode"),iconStyle:"default"}),t("cardOptions"))}),[n.billingData]);return r.createElement("div",{className:"wc-stripe-inline-form"},r.createElement(i.CardElement,{options:o,onChange:a}))}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(5773);var r=n(7205);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))})),n(7354),n(6835)},7205:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=n(3027),c=n(4222),s=n(1134),u=n(6664),l=n(3187),p=a(n(1065)),d=a(n(3329)),f=a(n(9775)),m=n(3636),y=(0,s.getSettings)("stripe_cc_data"),g=function(e){return(0,s.isUserLoggedIn)(e)&&y("saveCardEnabled")&&!(0,s.cartContainsSubscription)()&&!(0,s.cartContainsPreOrder)()},v=function(e){var t=(0,i.useState)(!1),n=(0,o.default)(t,2),a=n[0],c=n[1];if((0,i.useEffect)((function(){s.initStripe.catch((function(e){c(e)}))}),[c]),a)throw new Error(a);return r.createElement(u.Elements,{stripe:s.initStripe},r.createElement(h,e))},h=function(e){var t=e.getData,n=e.billing,a=e.shippingData,c=e.emitResponse,s=e.eventRegistration,p=e.activePaymentMethod,y=(0,m.useStripeError)(),v=(0,o.default)(y,2),h=v[0],b=v[1],P=(0,i.useState)(!1),E=(0,o.default)(P,2),O=E[0],S=E[1],_=s.onPaymentProcessing,w=(0,u.useStripe)(),C=(0,u.useElements)(),k=(0,i.useCallback)((function(){var e=t("customFormActive")?u.CardNumberElement:u.CardElement;return{card:C.getElement(e)}}),[w,C]),M=(0,m.useSetupIntent)({getData:t,cartTotal:n.cartTotal,setError:b}),j=M.setupIntent,D=M.removeSetupIntent;(0,m.useProcessPaymentIntent)({getData:t,billing:n,shippingData:a,emitResponse:c,error:h,onPaymentProcessing:_,savePaymentMethod:O,setupIntent:j,removeSetupIntent:D,getPaymentMethodArgs:k,activePaymentMethod:p}),(0,m.useAfterProcessingPayment)({getData:t,eventRegistration:s,responseTypes:c.responseTypes,activePaymentMethod:p,savePaymentMethod:O});var R=t("customFormActive")?d.default:f.default;return r.createElement("div",{className:"wc-stripe-card-container"},r.createElement(R,{getData:t,billing:n,onChange:function(e){e.error?b(e.error):b(!1)}}),g(n.customerId)&&r.createElement(l.SavePaymentMethod,{label:t("savePaymentMethodLabel"),onChange:function(e){return S(e)},checked:O}))};(0,c.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icons")}),ariaLabel:"Credit Cards",canMakePayment:function(){return s.initStripe},content:r.createElement(l.PaymentMethod,{content:v,getData:y}),savedTokenComponent:r.createElement(p.default,{getData:y}),edit:r.createElement(l.PaymentMethod,{content:v,getData:y}),supports:{showSavedCards:y("showSavedCards"),showSaveOption:!1,features:y("features")}})},7082:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(4575)),i=a(n(3913)),c=a(n(2205)),s=a(n(8585)),u=a(n(9754));var l=function(e){(0,c.default)(l,e);var t,n,a=(t=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,u.default)(t);if(n){var a=(0,u.default)(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return(0,s.default)(this,e)});function l(e){var t;return(0,o.default)(this,l),(t=a.call(this,e)).state={hasError:!1,error:null,errorInfo:null},t}return(0,i.default)(l,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0,error:e,errorInfo:t})}},{key:"render",value:function(){return this.state.hasError?r.createElement(r.Fragment,null,this.state.error&&r.createElement("div",{className:"wc-stripe-block-error"},this.state.error.toString()),this.state.errorInfo&&r.createElement("div",{className:"wc-stripe-block-error"},this.state.errorInfo.componentStack)):this.props.children}}]),l}(n(3027).Component);t.default=l},5212:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(5516),u=n(3636),l=(0,n(1134).getSettings)("stripeGeneralData")().publishableKey;t.default=function(e){var t=e.getData,n=e.setErrorMessage,a=e.billing,p=e.shippingData,d=e.canMakePayment,f=e.checkoutStatus,m=e.eventRegistration,y=e.activePaymentMethod,g=e.onClick,v=e.onClose,h=(0,i.default)(e,["getData","setErrorMessage","billing","shippingData","canMakePayment","checkoutStatus","eventRegistration","activePaymentMethod","onClick","onClose"]),b={merchantId:t("merchantId"),merchantName:t("merchantName")},P=(0,u.useStripeError)(),E=(0,o.default)(P,2),O=E[0],S=(E[1],(0,c.useRef)()),_=h.onSubmit,w=h.emitResponse,C=m.onPaymentProcessing,k=(0,u.useExportedValues)(),M="long"===t("buttonStyle").buttonType?390:300,j=(0,u.useProcessPaymentIntent)({getData:t,billing:a,shippingData:p,onPaymentProcessing:C,emitResponse:w,error:O,exportedValues:k,onSubmit:_,checkoutStatus:f,activePaymentMethod:y}).setPaymentMethod,D=(0,s.usePaymentRequest)({getData:t,publishableKey:l,merchantInfo:b,billing:a,shippingData:p}),R=(0,s.usePaymentsClient)({merchantInfo:b,paymentRequest:D,billing:a,shippingData:p,eventRegistration:m,canMakePayment:d,setErrorMessage:n,onSubmit:_,setPaymentMethod:j,exportedValues:k,onClick:g,onClose:v,getData:t}),x=R.button,A=R.removeButton;return(0,u.useExpressBreakpointWidth)({payment_method:t("name"),width:M}),(0,c.useEffect)((function(){x&&(A(S.current),S.current.append(x))}),[x]),r.createElement("div",{className:"wc-stripe-gpay-button-container",ref:S})}},3097:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BASE_PAYMENT_REQUEST=t.BASE_PAYMENT_METHOD=void 0,t.BASE_PAYMENT_METHOD={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],assuranceDetailsRequired:!0}},t.BASE_PAYMENT_REQUEST={apiVersion:2,apiVersionMinor:0}},5516:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(1674);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(1735);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(9808);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},9808:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useErrorMessage=void 0;var a=r(n(3038)),o=n(3027);t.useErrorMessage=function(){var e=(0,o.useState)(!1),t=(0,a.default)(e,2);return{errorMessage:t[0],setErrorMessage:t[1]}}},1735:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentRequest=void 0;var a=r(n(319)),o=r(n(9713)),i=n(3027),c=n(3097),s=n(1134),u=n(8664);function l(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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentRequest=function(e){var t=e.getData,n=e.publishableKey,r=e.merchantInfo,o=e.billing,l=e.shippingData,d=o.billingData,f=l.shippingRates,m=(l.shippingAddress,t()),y=m.processingCountry,g=m.totalPriceLabel;return(0,i.useMemo)((function(){var e=p(p({},{emailRequired:(0,s.isEmpty)(d.email),merchantInfo:r,allowedPaymentMethods:[p(p({},{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":n}}}),c.BASE_PAYMENT_METHOD)],shippingAddressRequired:l.needsShipping,transactionInfo:(0,u.getTransactionInfo)({billing:o,processingCountry:y,totalPriceLabel:g}),callbackIntents:["PAYMENT_AUTHORIZATION"]}),c.BASE_PAYMENT_REQUEST);if(e.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,e.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:(0,s.isFieldRequired)("phone",d.country)&&(0,s.isEmpty)(d.phone)},e.shippingAddressRequired){e.callbackIntents=[].concat((0,a.default)(e.callbackIntents),["SHIPPING_ADDRESS","SHIPPING_OPTION"]),e.shippingOptionRequired=!0;var t=(0,u.getShippingOptionParameters)(f);t.shippingOptions.length>0&&(e=p(p({},e),{},{shippingOptionParameters:t}))}return e}),[o.cartTotal,o.cartTotalItems,d,l])}},1674:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentsClient=void 0;var a=r(n(319)),o=r(n(9713)),i=r(n(7015)),c=r(n(8926)),s=r(n(3038)),u=n(3027),l=r(n(4306)),p=n(1134),d=n(6664),f=n(8664),m=n(3163),y=n(3636);function g(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 v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentsClient=function(e){var t=e.merchantInfo,n=e.paymentRequest,r=e.billing,g=e.shippingData,h=e.eventRegistration,b=e.canMakePayment,P=e.setErrorMessage,E=e.setPaymentMethod,O=e.exportedValues,S=e.onClick,_=e.onClose,w=e.getData,C=w().environment,k=(0,u.useState)(),M=(0,s.default)(k,2),j=M[0],D=M[1],R=(0,u.useState)(null),x=(0,s.default)(R,2),A=x[0],I=x[1],T=(0,u.useRef)(r),L=(0,u.useRef)(g),N=(0,d.useStripe)(),B=(0,y.usePaymentEvents)({billing:r,shippingData:g,eventRegistration:h}).addPaymentEvent;(0,u.useEffect)((function(){T.current=r,L.current=g}));var F=(0,u.useCallback)((function(e){var t,n;if(null!=e&&null!==(t=e.paymentMethodData)&&void 0!==t&&null!==(n=t.info)&&void 0!==n&&n.billingAddress){var r,a=e.paymentMethodData.info.billingAddress;(0,p.isAddressValid)(T.current.billingData,["phone","email"])&&(0,p.isEmpty)(null===(r=T.current.billingData)||void 0===r?void 0:r.phone)&&(a={phoneNumber:a.phoneNumber}),O.billingData=(0,f.toCartAddress)(a,{email:e.email})}null!=e&&e.shippingAddress&&(O.shippingAddress=(0,f.toCartAddress)(e.shippingAddress))}),[O,n]),q=(0,u.useCallback)((function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}),[A]),V=(0,u.useCallback)((0,c.default)(i.default.mark((function e(){var t,r,a,o;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(),e.prev=1,e.next=4,j.loadPaymentData(n);case 4:return t=e.sent,r=T.current.billingData,F(t),a=JSON.parse(t.paymentMethodData.tokenizationData.token),e.next=10,N.createPaymentMethod({type:"card",card:{token:a.id},billing_details:(0,p.getBillingDetailsFromAddress)(r)});case 10:if(!(o=e.sent).error){e.next=13;break}throw new p.StripeError(o.error);case 13:E(o.paymentMethod.id),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),"CANCELED"===(null===e.t0||void 0===e.t0?void 0:e.t0.statusCode)?_():(console.log((0,p.getErrorMessage)(e.t0)),P((0,p.getErrorMessage)(e.t0)));case 19:case"end":return e.stop()}}),e,null,[[1,16]])}))),[N,j,S]),U=(0,u.useCallback)((0,c.default)(i.default.mark((function e(){return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!j||A||!N){e.next=5;break}return e.next=4,b;case 4:I(j.createButton(v({onClick:V},w("buttonStyle"))));case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),[N,A,j]),W=(0,u.useMemo)((function(){var e={environment:C,merchantInfo:t,paymentDataCallbacks:{onPaymentAuthorized:function(){return Promise.resolve({transactionState:"SUCCESS"})}}};return n.shippingAddressRequired&&(e.paymentDataCallbacks.onPaymentDataChanged=function(e){return new Promise((function(t,n){var r,i=L.current,c=e.shippingAddress,s=e.shippingOptionData,u=(0,f.toCartAddress)(c),d=(0,p.getSelectedShippingOption)(s.id),y=(0,l.default)((0,p.getIntermediateAddress)(i.shippingAddress),u),g=(0,l.default)(i.selectedRates,(0,o.default)({},d[1],d[0]));B("onShippingChanged",(function(e,n){var r=n.billing,a=n.shipping;t(e?(0,f.getPaymentRequestUpdate)({billing:r,shippingData:{needsShipping:!0,shippingRates:a.shippingRates},processingCountry:w("processingCountry"),totalPriceLabel:w("totalPriceLabel")}):{error:{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:(0,m.__)("Your shipping address is not serviceable.","woo-stripe-payment"),intent:"SHIPPING_ADDRESS"}})}),y&&g),L.current.setShippingAddress(v(v({},L.current.shippingAddress),u)),"shipping_option_unselected"!==s.id&&(r=L.current).setSelectedRates.apply(r,(0,a.default)(d))}))}),e}),[n]);return(0,u.useEffect)((function(){D(new google.payments.api.PaymentsClient(W))}),[W]),(0,u.useEffect)((function(){U()}),[U]),{button:A,removeButton:q}}},5341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(9509);var r=n(9031);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}))},9031:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(7154)),i=a(n(6479)),c=a(n(9713)),s=n(4222),u=n(1134),l=n(5516),p=a(n(5212)),d=n(3097),f=a(n(3905)),m=n(6664);function y(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 g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){(0,c.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v,h,b=(0,u.getSettings)("stripe_googlepay_data"),P=(v=new f.default.payments.api.PaymentsClient({environment:b("environment"),merchantInfo:{merchantId:b("merchantId"),merchantName:b("merchantName")}}),h=g(g({},d.BASE_PAYMENT_REQUEST),{},{allowedPaymentMethods:[d.BASE_PAYMENT_METHOD]}),v.isReadyToPay(h).then((function(){return!0})).catch((function(e){return console.log(e),!1}))),E=function(e){var t=e.getData,n=e.components,a=(0,i.default)(e,["getData","components"]),c=n.ValidationInputError,s=(0,l.useErrorMessage)(),d=s.errorMessage,f=s.setErrorMessage;return r.createElement("div",{className:"wc-stripe-gpay-container"},r.createElement(m.Elements,{stripe:u.initStripe},r.createElement(p.default,(0,o.default)({getData:t,canMakePayment:P,setErrorMessage:f},a)),d&&r.createElement(c,{errorMessage:d})))},O=function(e){var t,n=e.getData,a=((0,i.default)(e,["getData"]),n("buttonStyle").buttonType),o=(null===(t=n("editorIcons"))||void 0===t?void 0:t[a])||"long";return r.createElement("div",{className:"gpay-block-editor ".concat(a)},r.createElement("img",{src:o}))};(0,s.registerExpressPaymentMethod)({name:b("name"),canMakePayment:function(){return b("isAdmin")?!(0,u.isCartPage)()||b("cartCheckoutEnabled"):!((0,u.isCartPage)()&&!b("cartCheckoutEnabled"))&&u.initStripe.then((function(e){return e.error?e:P}))},content:r.createElement(E,{getData:b}),edit:r.createElement(O,{getData:b}),supports:{showSavedCards:b("showSavedCards"),showSaveOption:b("showSaveOption"),features:b("features")}})},8664:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.toCartAddress=t.getShippingOptions=t.getShippingOptionParameters=t.getPaymentRequestUpdate=t.getTransactionInfo=void 0;var a=r(n(319)),o=n(1134),i=function(e){var t=e.billing,n=e.processingCountry,r=e.totalPriceLabel,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ESTIMATED",i=t.cartTotal,s=t.cartTotalItems,u=t.currency,l={countryCode:n,currencyCode:u.code,totalPriceStatus:a,totalPrice:(0,o.removeNumberPrecision)(i.value,u.minorUnit).toString(),displayItems:c(s,u.minorUnit),totalPriceLabel:r};return l};t.getTransactionInfo=i,t.getPaymentRequestUpdate=function(e){var t=e.billing,n=e.shippingData,r=e.processingCountry,a=e.totalPriceLabel,o=n.needsShipping,c=n.shippingRates,u={newTransactionInfo:i({billing:t,processingCountry:r,totalPriceLabel:a},"FINAL")};return o&&(u.newShippingOptionParameters=s(c)),u};var c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=[];return e.forEach((function(e){0<e.value&&n.push({label:e.label,type:"LINE_ITEM",price:(0,o.removeNumberPrecision)(e.value,t).toString()})})),n},s=function(e){var t=u(e),n=t.map((function(e){return e.id})).slice(0,1).shift();return e.forEach((function(e,t){e.shipping_rates.forEach((function(e){e.selected&&(n=(0,o.getShippingOptionId)(t,e.rate_id))}))})),{shippingOptions:t,defaultSelectedOptionId:n}};t.getShippingOptionParameters=s;var u=function(e){var t=[];return e.forEach((function(e,n){var r=e.shipping_rates.map((function(e){var t=document.createElement("textarea");t.innerHTML=e.name;var r=(0,o.formatPrice)(e.price,e.currency_code);return{id:(0,o.getShippingOptionId)(n,e.rate_id),label:t.value,description:"".concat(r)}}));t=[].concat((0,a.default)(t),(0,a.default)(r))})),t};t.getShippingOptions=u;var l=(0,o.toCartAddress)({name:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},countryCode:"country",address1:"address_1",address2:"address_2",locality:"city",administrativeArea:"state",postalCode:"postcode",email:"email",phoneNumber:"phone"});t.toCartAddress=l},3636:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(4332);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(1261);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(6107);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var i=n(2715);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));var c=n(2343);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===c[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}}))}));var s=n(1500);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var u=n(6095);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}));var l=n(5554);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===l[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}}))}));var p=n(3893);Object.keys(p).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===p[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}}))}))},1261:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useAfterProcessingPayment=void 0;var a=r(n(7015)),o=r(n(8926)),i=n(3027),c=n(6664),s=n(1134),u=n(3893);t.useAfterProcessingPayment=function(e){var t=e.getData,n=e.eventRegistration,r=e.responseTypes,l=e.activePaymentMethod,p=e.savePaymentMethod,d=void 0!==p&&p,f=e.messageContext,m=void 0===f?null:f,y=(0,c.useStripe)(),g=n.onCheckoutAfterProcessingWithSuccess,v=n.onCheckoutAfterProcessingWithError;(0,u.useProcessCheckoutError)({responseTypes:r,subscriber:v,messageContext:m}),(0,i.useEffect)((function(){var e=g(function(){var e=(0,o.default)(a.default.mark((function e(n){var o;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.redirectUrl,t("name")!==l){e.next=5;break}return e.next=4,(0,s.handleCardAction)({redirectUrl:o,responseTypes:r,stripe:y,getData:t,savePaymentMethod:d});case 4:return e.abrupt("return",e.sent);case 5:return e.abrupt("return",null);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());return function(){return e()}}),[y,r,g,l,d])}},5554:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useExpressBreakpointWidth=t.useBreakpointWidth=void 0;var a=r(n(3038)),o=n(3027),i=n(1134),c=function(e){var t=e.name,n=e.width,r=e.node,c=e.className,s=(0,o.useState)(window.innerWidth),u=(0,a.default)(s,2),l=u[0],p=u[1],d=(0,o.useCallback)((function(e){var t=(0,i.getFromCache)(e);return t?parseInt(t):0}),[]),f=(0,o.useCallback)((function(e,t){return(0,i.storeInCache)(e,t)}),[]);(0,o.useEffect)((function(){var e="function"==typeof r?r():r;if(e){var a=d(t);(!a||n>a)&&f(t,n),e.clientWidth<n?e.classList.add(c):e.clientWidth>a&&e.classList.remove(c)}}),[l,r]),(0,o.useEffect)((function(){var e=function(){return p(window.innerWidth)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}))};t.useBreakpointWidth=c,t.useExpressBreakpointWidth=function(e){var t=e.payment_method,n=e.width,r=(0,o.useCallback)((function(){var e=document.getElementById("express-payment-method-".concat(t));return e?e.parentNode:null}),[]);c({name:"expressMaxWidth",width:n,node:r,className:"wc-stripe-express__sm"})}},2343:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useExportedValues=void 0;var r=n(3027);t.useExportedValues=function(){return(0,r.useRef)({}).current}},6095:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentEvents=void 0;var a=r(n(9713)),o=r(n(3038)),i=n(3027),c=n(1134);function s(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentEvents=function(e){var t=e.billing,n=e.shippingData,r=e.eventRegistration,s=r.onShippingRateSuccess,l=r.onShippingRateFail,p=r.onShippingRateSelectSuccess,d=(0,i.useRef)(t),f=(0,i.useRef)(n),m=(0,i.useState)(null),y=(0,o.default)(m,2),g=y[0],v=y[1],h=(0,i.useState)({onShippingChanged:!1}),b=(0,o.default)(h,2),P=b[0],E=b[1],O=(0,i.useCallback)((function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n?v((0,a.default)({},e,t)):E(u(u({},P),{},(0,a.default)({},e,t)))}),[P,E]),S=(0,i.useCallback)((function(e){P[e]&&(delete P[e],E(P))}),[P]),_=(0,i.useCallback)((function(){var e=f.current,t=d.current;if(P.onShippingChanged&&!e.isSelectingRate&&!e.shippingRatesLoading){var n=P.onShippingChanged,r=!0;(0,c.hasShippingRates)(e.shippingRates)||(r=!1),n(r,{billing:t,shipping:e}),S("onShippingChanged")}}),[P,S]);return(0,i.useEffect)((function(){d.current=t,f.current=n})),(0,i.useEffect)((function(){g&&g.onShippingChanged&&(g.onShippingChanged(!0,{billing:d.current,shipping:f.current}),v(null))}),[g]),(0,i.useEffect)((function(){var e=s(_),t=p(_),n=l((function(e){e.hasInvalidAddress,e.hasError,P.onShippingChanged&&((0,P.onShippingChanged)(!1),S("onShippingChanged"))}));return function(){e(),n(),t()}}),[P,s,l,p]),{addPaymentEvent:O,removePaymentEvent:S}}},1500:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentRequest=void 0;var a=r(n(319)),o=r(n(9713)),i=r(n(3038)),c=n(3027),s=n(6095),u=n(1134),l=r(n(4306));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){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f=(0,u.toCartAddress)();t.usePaymentRequest=function(e){var t=e.getData,n=e.onClose,r=e.stripe,o=e.billing,p=e.shippingData,m=e.eventRegistration,y=e.setPaymentMethod,g=e.exportedValues,v=e.canPay,h=(0,s.usePaymentEvents)({billing:o,shippingData:p,eventRegistration:m}).addPaymentEvent,b=p.needsShipping,P=p.shippingRates,E=o.billingData,O=o.cartTotalItems,S=o.currency,_=o.cartTotal,w=(0,c.useState)(null),C=(0,i.default)(w,2),k=C[0],M=C[1],j=(0,c.useRef)({}),D=(0,c.useRef)(p),R=(0,c.useRef)(o);(0,c.useEffect)((function(){D.current=p,R.current=o}),[p]),(0,c.useEffect)((function(){if(r){var e={country:t("countryCode"),currency:null==S?void 0:S.code.toLowerCase(),total:{amount:_.value,label:_.label,pending:!0},requestPayerName:!0,requestPayerEmail:(0,u.isFieldRequired)("email",E.country),requestPayerPhone:(0,u.isFieldRequired)("phone",E.country),requestShipping:b,displayItems:(0,u.getDisplayItems)(O,S)};e.requestShipping&&(e.shippingOptions=(0,u.getShippingOptions)(P)),j.current=e;var n=r.paymentRequest(j.current);n.canMakePayment().then((function(e){v(e)?M(n):M(null)}))}}),[r,E,P,b]),(0,c.useEffect)((function(){k&&(j.current.requestShipping&&(k.on("shippingaddresschange",A),k.on("shippingoptionchange",I)),k.on("cancel",n),k.on("paymentmethod",T))}),[k]);var x=(0,c.useCallback)((function(e){return function(t,n){var r=n.billing,a=n.shipping,o=r.cartTotal,i=r.cartTotalItems,c=r.currency,s=a.shippingRates;t?e.updateWith({status:"success",total:{amount:o.value,label:o.label,pending:!1},displayItems:(0,u.getDisplayItems)(i,c),shippingOptions:(0,u.getShippingOptions)(s)}):e.updateWith({status:"invalid_shipping_address"})}}),[]),A=(0,c.useCallback)((function(e){var t=e.shippingAddress,n=D.current,r=f(t);n.setShippingAddress(d(d({},n.shippingAddress),r));var a=(0,l.default)((0,u.getIntermediateAddress)(n.shippingAddress),r);h("onShippingChanged",x(e),a)}),[h]),I=(0,c.useCallback)((function(e){var t=e.shippingOption,n=D.current;n.setSelectedRates.apply(n,(0,a.default)((0,u.getSelectedShippingOption)(t.id))),h("onShippingChanged",x(e))}),[h]),T=(0,c.useCallback)((function(e){var t=e.paymentMethod,n=e.payerName,r=void 0===n?null:n,a=e.payerEmail,o=void 0===a?null:a,i=e.payerPhone,c={payerName:r,payerEmail:o,payerPhone:void 0===i?null:i};null!=t&&t.billing_details.address&&(c=f(t.billing_details.address,c)),g.billingData=c,e.shippingAddress&&(g.shippingAddress=f(e.shippingAddress)),y(t.id),e.complete("success")}),[y]);return{paymentRequest:k}}},3893:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessCheckoutError=void 0;var r=n(3027);t.useProcessCheckoutError=function(e){var t=e.responseTypes,n=e.subscriber,a=e.messageContext,o=void 0===a?null:a;(0,r.useEffect)((function(){var e=n((function(e){var n;return null!=e&&null!==(n=e.processingResponse.paymentDetails)&&void 0!==n&&n.stripeErrorMessage?{type:t.ERROR,message:e.processingResponse.paymentDetails.stripeErrorMessage,messageContext:o}:null}));return function(){return e()}}),[t,n])}},4332:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPaymentIntent=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(9713)),c=r(n(3038)),s=n(3027),u=n(6664),l=n(1134);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){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useProcessPaymentIntent=function(e){var t=e.getData,n=e.billing,r=e.shippingData,p=e.onPaymentProcessing,f=e.emitResponse,m=e.error,y=e.onSubmit,g=e.activePaymentMethod,v=e.paymentType,h=void 0===v?"card":v,b=e.setupIntent,P=void 0===b?null:b,E=e.removeSetupIntent,O=void 0===E?null:E,S=e.savePaymentMethod,_=void 0!==S&&S,w=e.exportedValues,C=void 0===w?{}:w,k=e.getPaymentMethodArgs,M=void 0===k?function(){return{}}:k,j=n.billingData,D=r.shippingAddress,R=f.responseTypes,x=(0,s.useState)(null),A=(0,c.default)(x,2),I=A[0],T=A[1],L=(0,u.useStripe)(),N=(0,s.useRef)(M);(0,s.useEffect)((function(){N.current=M}),[M]);var B=(0,s.useCallback)((function(){return d(d({},{type:h,billing_details:(0,l.getBillingDetailsFromAddress)(null!=C&&C.billingData?C.billingData:j)}),N.current())}),[j,h,M]),F=(0,s.useCallback)((function(e,n){var r,a={meta:{paymentMethodData:(r={},(0,i.default)(r,"".concat(t("name"),"_token_key"),e),(0,i.default)(r,"".concat(t("name"),"_save_source_key"),n),r)}};return null!=C&&C.billingData&&(a.meta.billingData=C.billingData),null!=C&&C.shippingAddress&&(a.meta.shippingData={address:C.shippingAddress}),a}),[j,D]);return(0,s.useEffect)((function(){I&&"string"==typeof I&&y()}),[I]),(0,s.useEffect)((function(){var e=p((0,o.default)(a.default.mark((function e(){var n,r;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g===t("name")){e.next=2;break}return e.abrupt("return",null);case 2:if(n=null,r=null,e.prev=3,!m){e.next=6;break}throw new l.StripeError(m);case 6:if(!P){e.next=16;break}return e.next=9,L.confirmCardSetup(P.client_secret,{payment_method:B()});case 9:if(!(n=e.sent).error){e.next=12;break}throw new l.StripeError(n.error);case 12:r=n.setupIntent.payment_method,O(),e.next=26;break;case 16:if(!I){e.next=20;break}r=I,e.next=26;break;case 20:return e.next=22,L.createPaymentMethod(B());case 22:if(!(n=e.sent).error){e.next=25;break}throw new l.StripeError(n.error);case 25:r=n.paymentMethod.id;case 26:return e.abrupt("return",(0,l.ensureSuccessResponse)(R,F(r,_)));case 29:return e.prev=29,e.t0=e.catch(3),console.log(e.t0),T(null),e.abrupt("return",(0,l.ensureErrorResponse)(R,e.t0.error));case 34:case"end":return e.stop()}}),e,null,[[3,29]])}))));return function(){return e()}}),[I,j,p,L,P,g,_]),{setPaymentMethod:T}}},6107:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useSetupIntent=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(3038)),c=n(3027),s=r(n(7606)),u=n(1134);t.useSetupIntent=function(e){var t=e.cartTotal,n=e.setError,r=(0,c.useState)((0,u.getFromCache)("setupIntent")),l=(0,i.default)(r,2),p=l[0],d=l[1];(0,c.useEffect)((function(){var e=function(){var e=(0,o.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!p){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,s.default)({url:(0,u.getRoute)("create/setup_intent"),method:"POST"});case 4:(t=e.sent).code?n(t.message):((0,u.storeInCache)("setupIntent",t.intent),d(t.intent));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,u.cartContainsPreOrder)()||(0,u.cartContainsSubscription)()&&0==t.value?p||e():d(null)}),[t.value]);var f=(0,c.useCallback)((function(){(0,u.deleteFromCache)("setupIntent")}),[t.value]);return{setupIntent:p,removeSetupIntent:f}}},2715:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useStripeError=void 0;var a=r(n(3038)),o=n(3027);t.useStripeError=function(){var e=(0,o.useState)(!1),t=(0,a.default)(e,2);return[t[0],t[1]]}},6480:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(6479)),i=a(n(9713)),c=a(n(3038)),s=n(3027),u=n(4222),l=n(1134),p=n(3539),d=n(3187),f=n(6664),m=n(3163);function y(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 g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v,h=(0,l.getSettings)("stripe_afterpay_data"),b=function(e){var t=e.getData,n=(0,s.useState)({amount:t("cartTotal"),currency:t("currency"),isEligible:t("msgOptions").isEligible}),a=(0,c.default)(n,2),o=a[0],i=a[1],u={locale:"auto"};return"GBP"!==o.currency||["fr-FR","it-IT","es-ES"].includes(t("locale"))||(u.locale="en-GB"),v=i,r.createElement(f.Elements,{stripe:l.initStripe,options:u},r.createElement("div",{className:"wc-stripe-blocks-afterpay__label"},r.createElement(f.AfterpayClearpayMessageElement,{options:g(g({},t("msgOptions")),{amount:o.amount,currency:o.currency,isEligible:o.isEligible})})))},P=function(e){var t=e.content,n=e.billing,a=e.shippingData,i=(0,o.default)(e,["content","billing","shippingData"]),c=t,u=n.cartTotal,l=n.currency,p=a.needsShipping;return(0,s.useEffect)((function(){v({amount:u.value,currency:l.code,isEligible:p})}),[u.value,l.code,p]),r.createElement(r.Fragment,null,p&&r.createElement("div",{className:"wc-stripe-blocks-payment-method-content"},r.createElement("div",{className:"wc-stripe-blocks-afterpay-offsite__container"},r.createElement("div",{className:"wc-stripe-blocks-afterpay__offsite"},r.createElement("img",{src:h("offSiteSrc")}),r.createElement("p",null,(0,m.sprintf)((0,m.__)('After clicking "%s", you will be redirected to Afterpay to complete your purchase securely.',"woo-stripe-payment"),h("placeOrderButtonLabel"))))),r.createElement(c,g(g({},i),{},{billing:n,shippingData:a}))))};h()&&(0,u.registerPaymentMethod)({name:h("name"),label:r.createElement(b,{getData:h}),ariaLabel:(0,m.__)("Afterpay","woo-stripe-payment"),placeOrderButtonLabel:h("placeOrderButtonLabel"),canMakePayment:(0,p.canMakePayment)(h,(function(e){var t=e.settings,n=e.billingData,r=e.cartTotals,a=e.cartNeedsShipping,o=n.country,i=r.currency_code,s=t("requiredParams"),u=(0,c.default)(s[i],1)[0];return v&&v({amount:parseInt(r.total_price),currency:i,isEligible:a}),o==u})),content:r.createElement(P,{content:p.LocalPaymentIntentContent,getData:h,confirmationMethod:"confirmAfterpayClearpayPayment"}),edit:r.createElement(d.PaymentMethod,{content:p.LocalPaymentIntentContent,getData:h}),supports:{showSavedCards:!1,showSaveOption:!1,features:h("features")}})},39:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(2029),s=n(3187),u=(0,o.getSettings)("stripe_alipay_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"Alipay",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(s.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:u}),edit:r.createElement(s.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},8641:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_bancontact_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"Bancontact",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},5176:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_becs_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"BECS",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmAuBecsDebitPayment",component:s.AuBankAccountElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},4494:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_eps_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"EPS",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},4031:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_fpx_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"FPX",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmIdealPayment",component:s.FpxBankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},3817:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_giropay_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"Giropay",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},3140:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_grabpay_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"GrabPay",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:s,confirmationMethod:"confirmGrabPayPayment"}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},8522:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(3160);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(3994);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(878);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},3160:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useAfterProcessLocalPayment=void 0;var a=r(n(7015)),o=r(n(9713)),i=r(n(6479)),c=r(n(8926)),s=n(3027),u=n(6664),l=n(1134);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){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useAfterProcessLocalPayment=function(e){var t=e.getData,n=e.billingData,r=e.eventRegistration,o=e.responseTypes,p=e.activePaymentMethod,f=e.confirmationMethod,m=e.getPaymentMethodArgs,y=void 0===m?function(){return{}}:m,g=(0,u.useStripe)(),v=r.onCheckoutAfterProcessingWithSuccess,h=r.onCheckoutAfterProcessingWithError,b=(0,s.useRef)(n),P=(0,s.useRef)(y);(0,s.useEffect)((function(){b.current=n}),[n]),(0,s.useEffect)((function(){P.current=y}),[y]),(0,s.useEffect)((function(){var e=v(function(){var e=(0,c.default)(a.default.mark((function e(n){var r,c,s,u,m,y;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.redirectUrl,t("name")!==p){e.next=17;break}if(e.prev=2,!(c=r.match(/#response=(.+)/))){e.next=11;break}return s=JSON.parse(window.atob(decodeURIComponent(c[1]))),u=s.client_secret,m=s.return_url,(0,i.default)(s,["client_secret","return_url"]),e.next=8,g[f](u,{payment_method:d({billing_details:(0,l.getBillingDetailsFromAddress)(b.current)},P.current()),return_url:m});case 8:if(!(y=e.sent).error){e.next=11;break}throw new l.StripeError(y.error);case 11:e.next=17;break;case 13:return e.prev=13,e.t0=e.catch(2),console.log(e.t0),e.abrupt("return",(0,l.ensureErrorResponse)(o,e.t0.error));case 17:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(t){return e.apply(this,arguments)}}());return function(){return e()}}),[g,v,h])}},878:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateSource=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(9713)),c=r(n(3038)),s=n(3027),u=n(1134),l=n(6664),p=n(3163);t.useCreateSource=function(e){var t=e.getData,n=e.billing,r=e.shippingAddress,d=e.onPaymentProcessing,f=e.responseTypes,m=e.getSourceArgs,y=void 0!==m&&m,g=e.element,v=void 0!==g&&g,h=(0,s.useState)(!1),b=(0,c.default)(h,2),P=b[0],E=b[1],O=(0,s.useState)(!1),S=(0,c.default)(O,2),_=S[0],w=S[1],C=(0,s.useRef)({billing:n,shippingAddress:r}),k=(0,l.useStripe)(),M=(0,l.useElements)();(0,s.useEffect)((function(){C.current={billing:n,shippingAddress:r}}));var j=(0,s.useCallback)((function(){var e=C.current.billing,n=e.cartTotal,r=e.currency,a=e.billingData,o=(0,u.getDefaultSourceArgs)({type:t("paymentType"),amount:n.value,billingData:a,currency:r.code,returnUrl:t("returnUrl")});return y&&(o=y(o,{billingData:a})),o}),[]),D=(0,s.useCallback)((function(e){return{meta:{paymentMethodData:(0,i.default)({},"".concat(t("name"),"_token_key"),e)}}}),[]);return(0,s.useEffect)((function(){var e=d((0,o.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=2;break}return e.abrupt("return",(0,u.ensureSuccessResponse)(f,D(P.id)));case 2:if(e.prev=2,!v){e.next=11;break}if(_){e.next=6;break}throw(0,p.__)("Please enter your payment info before proceeding.","woo-stripe-payment");case 6:return e.next=8,k.createSource(M.getElement(v),j());case 8:t=e.sent,e.next=14;break;case 11:return e.next=13,k.createSource(j());case 13:t=e.sent;case 14:if(!t.error){e.next=16;break}throw new u.StripeError(t.error);case 16:return E(t.source),e.abrupt("return",(0,u.ensureSuccessResponse)(f,D(t.source.id)));case 20:return e.prev=20,e.t0=e.catch(2),console.log(e.t0),e.abrupt("return",(0,u.ensureErrorResponse)(f,e.t0.error||e.t0));case 24:case"end":return e.stop()}}),e,null,[[2,20]])}))));return function(){return e()}}),[P,d,k,f,v,_,w]),{setIsValid:w}}},3994:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useValidateCheckout=void 0;var a=r(n(3038)),o=n(3027),i=n(1134),c=n(3163);t.useValidateCheckout=function(e){var t=e.subscriber,n=e.responseTypes,r=e.component,s=void 0===r?null:r,u=e.msg,l=void 0===u?(0,c.__)("Please enter your payment info before proceeding.","woo-stripe-payment"):u,p=(0,o.useState)(!1),d=(0,a.default)(p,2),f=d[0],m=d[1];return(0,o.useEffect)((function(){var e=t((function(){return!(s&&!f)||(0,i.ensureErrorResponse)(n,l)}));return function(){return e()}}),[t,f,m,n,s]),{isValid:f,setIsValid:m}}},9474:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_ideal_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"Ideal",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmIdealPayment",component:s.IdealBankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},9738:(e,t,n)=>{n(7156),n(9474),n(3868),n(8641),n(3817),n(4494),n(4784),n(1192),n(7894),n(3766),n(4031),n(5176),n(3140),n(39),n(6480)},6867:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.KlarnaPaymentCategories=void 0;var o=n(3027),i=a(n(6630));t.KlarnaPaymentCategories=function(e){var t=e.categories,n=e.onChange,a=e.selected;return r.createElement("div",{className:"wc-stripe-blocks-klarna-container"},r.createElement("ul",null,t.map((function(e){return r.createElement(c,{key:e.type,category:e,onChange:n,selected:a})}))))};var c=function(e){var t=e.category,n=e.selected,a=e.onChange,c=t.type===n;(0,o.useEffect)((function(){Klarna.Payments.load({container:"#klarna-category-".concat(t.type),payment_method_category:t.type})}),[]);var s={label:t.label,value:t.type,content:r.createElement("div",{id:"klarna-category-".concat(t.type)})};return r.createElement("li",{className:"wc-stripe-blocks-klarna__category",key:t.type},r.createElement(i.default,{option:s,checked:c,onChange:a}))}},6028:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(8092);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(437);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}))},8092:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateSource=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(8)),c=r(n(9713)),s=r(n(3038)),u=n(3027),l=n(6664),p=n(3636),d=n(1134),f=r(n(7606));function m(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 y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){(0,c.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useCreateSource=function(e){var t=e.getData,n=e.billing,r=e.shippingData,m=(0,l.useStripe)(),g=(0,p.useStripeError)(),v=(0,s.default)(g,2),h=(v[0],v[1]),b=(0,u.useRef)(new AbortController),P=(0,u.useRef)({}),E=(0,u.useRef)({}),O=(0,u.useState)(!1),S=(0,s.default)(O,2),_=S[0],w=S[1],C=(0,u.useState)(!1),k=(0,s.default)(C,2),M=k[0],j=k[1],D=n.billingData,R=n.cartTotal,x=n.cartTotalItems,A=n.currency,I=(0,u.useCallback)((function(e){var t=e.billingData,n=e.shippingData,r=n.needsShipping,a=n.shippingAddress;return!!(0,d.isAddressValid)(t)&&(!r||(0,d.isAddressValid)(a))}),[]),T=(0,u.useCallback)((function(e,t){var n=[];return e.forEach((function(e){n.push({amount:e.value,currency:t,description:e.label,quantity:1})})),n}),[]),L=(0,u.useCallback)((function(e){var n=e.cartTotal,r=e.cartTotalItems,a=e.billingData,o=e.currency,i=e.shippingData,c=a.first_name,s=a.last_name,u=a.country,l=i.needsShipping,p=i.shippingAddress,f=(0,d.getDefaultSourceArgs)({type:t("paymentType"),amount:n.value,billingData:a,currency:o.code,returnUrl:t("returnUrl")});return f=y(y({},f),{source_order:{items:T(r,o.code)},klarna:{locale:t("locale"),product:"payment",purchase_country:u,first_name:c,last_name:s}}),"US"==u&&(f.klarna.custom_payment_methods="payin4,installments"),l&&(f.klarna=y(y({},f.klarna),{shipping_first_name:p.first_name,shipping_last_name:p.last_name}),f.source_order.shipping={address:{city:p.city||"",country:p.country||"",line1:p.address_1||"",line2:p.address_2||"",postal_code:p.postcode||"",state:p.state||""}}),E.current=P.current,P.current=f,f}),[]),N=(0,u.useCallback)((function(e,t){var n=function e(t,n){for(var r={},a=0,o=Object.keys(t);a<o.length;a++){var c=o[a];"object"!==(0,i.default)(t[c])||Array.isArray(t[c])?r[c]=n[c]:r[c]=e(t[c],n[c])}return r}(e,t);return JSON.stringify(e)==JSON.stringify(n)}),[]),B=(0,u.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(t){var n,r,o,i,s,u,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.billingData,r=t.shippingData,o=t.cartTotal,i=t.cartTotalItems,s=t.currency,u=L({cartTotal:o,cartTotalItems:i,billingData:n,currency:s,shippingData:r}),e.prev=2,e.next=5,m.createSource(u);case 5:if(!(l=e.sent).error){e.next=8;break}throw new d.StripeError(l.error);case 8:(0,d.storeInCache)("klarna:source",(0,c.default)({},s.code,{source:l.source,args:P.current})),j(l.source),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(2),console.log(e.t0),h(e.t0.error);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t){return e.apply(this,arguments)}}(),[m,j]),F=(0,u.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(n){var r,o,i;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.source,o=n.updates,i={updates:o,source_id:r.id,client_secret:r.client_secret,payment_method:t("name")},e.prev=2,b.current.abort(),b.current=new AbortController,e.next=7,(0,f.default)({url:(0,d.getRoute)("update/source"),method:"POST",data:i,signal:b.current.signal});case 7:e.sent.source&&((0,d.storeInCache)("klarna:source",{source:r,args:P.current}),j(r)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(2),console.log("update aborted");case 14:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),[j]);return(0,u.useEffect)((function(){var e;if(!M)if(null!==(e=(0,d.getFromCache)("klarna:source"))&&void 0!==e&&e[A.code]){var t=(0,d.getFromCache)("klarna:source")[A.code],n=t.source,a=t.args;P.current=a,j(n)}else m&&I({billingData:D,shippingData:r})&&(w(!0),B({billingData:D,shippingData:r,cartTotal:R,cartTotalItems:x,currency:A}).then((function(){return w(!1)})))}),[m,null==M?void 0:M.id,B,D,R.value,r,w,x,A.code]),(0,u.useEffect)((function(){if(m&&M){var e=(t=L({billingData:D,cartTotal:R,cartTotalItems:x,currency:A,shippingData:r}),["type","currency","statement_descriptor","redirect","klarna.product","klarna.locale","klarna.custom_payment_methods"].reduce((function(e,t){if(t.indexOf(".")>-1){var n=t.split(".");return delete n.slice(0,n.length-1).reduce((function(e,t){return e[t]}),e)[t=n[n.length-1]],e}return delete e[t],e}),t));N(e,E.current)||F({source:M,updates:e})}var t}),[null==M?void 0:M.id,D,R.value,x,r,A.code]),{source:M,setSource:j,isLoading:_}}},437:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPayment=void 0;var a=r(n(9713)),o=n(3027),i=n(1134),c=n(3163);t.useProcessPayment=function(e){var t=e.payment_method,n=e.source_id,r=e.paymentCategory,s=e.onPaymentProcessing,u=e.responseTypes;(0,o.useEffect)((function(){var e=s((function(){return new Promise((function(e){Klarna.Payments.authorize({payment_method_category:r},(function(r){r.approved?((0,i.deleteFromCache)("klarna:source"),e((0,i.ensureSuccessResponse)(u,{meta:{paymentMethodData:(0,a.default)({},"".concat(t,"_token_key"),n)}}))):e((0,i.ensureErrorResponse)(u,r.error||(0,c.__)("Your purchase is not approved.","woo-stripe-payment")))}))}))}));return function(){return e()}}),[n,r,s])}},7156:(e,t,n)=>{var r=n(3027),a=n(5318)(n(3038)),o=n(3027),i=n(4222),c=n(3163),s=n(3636),u=n(1134),l=n(3187),p=n(3539),d=n(6664),f=n(6867),m=n(8567),y=n(6028);n(1530);var g=(0,u.getSettings)("stripe_klarna_data"),v=function(e){return r.createElement(d.Elements,{stripe:u.initStripe},r.createElement(h,e))},h=function(e){var t=e.getData,n=e.billing,i=e.shippingData,u=e.emitResponse,l=e.eventRegistration,p=u.responseTypes,d=l.onPaymentProcessing,g=l.onCheckoutAfterProcessingWithError,v=(0,o.useState)(""),h=(0,a.default)(v,2),b=h[0],P=h[1],E=function(e){for(var n=e.klarna.payment_method_categories.split(","),r=[],a=0,o=Object.keys(t("categories"));a<o.length;a++){var i=o[a];n.includes(i)&&r.push({type:i,label:t("categories")[i]})}return r},O=(0,y.useCreateSource)({getData:t,billing:n,shippingData:i}),S=O.source,_=O.isLoading;if((0,y.useProcessPayment)({payment_method:t("name"),source_id:S.id,paymentCategory:b,onPaymentProcessing:d,responseTypes:p}),(0,s.useProcessCheckoutError)({responseTypes:p,subscriber:g}),(0,o.useEffect)((function(){if(!b&&S){var e=E(S);e.length&&P(e.shift().type)}}),[S]),S){Klarna.Payments.init({client_token:S.klarna.client_token});var w=E(S);return r.createElement(f.KlarnaPaymentCategories,{categories:w,selected:!b&&w.length>0?w[0].type:b,onChange:P})}return _?r.createElement(m.KlarnaLoader,null):r.createElement("div",{className:"wc-stripe-blocks-klarna__notice"},(0,c.__)("Please fill out all required fields before paying with Klarna.","woo-stripe-payment"))};g()&&(0,i.registerPaymentMethod)({name:g("name"),label:r.createElement(l.PaymentMethodLabel,{title:g("title"),paymentMethod:g("name"),icons:g("icon")}),ariaLabel:"Klarna",placeOrderButtonLabel:g("placeOrderButtonLabel"),canMakePayment:(0,p.canMakePayment)(g,(function(e){var t=e.settings,n=e.billingData,r=e.cartTotals,a=n.country,o=r.currency_code,i=t("requiredParams");return[o]in i&&i[o].includes(a)})),content:r.createElement(l.PaymentMethod,{getData:g,content:v}),edit:r.createElement(l.PaymentMethod,{getData:g,content:v}),supports:{showSavedCards:!1,showSaveOption:!1,features:g("features")}})},8567:(e,t,n)=>{var r=n(3027);Object.defineProperty(t,"__esModule",{value:!0}),t.KlarnaLoader=void 0,t.KlarnaLoader=function(){return r.createElement("div",{className:"wc-stripe-klarna-loader"},r.createElement("div",null),r.createElement("div",null),r.createElement("div",null))}},3539:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.LocalPaymentSourceContent=t.LocalPaymentIntentContent=t.canMakePayment=void 0;var o=a(n(9713)),i=a(n(6479)),c=n(3027),s=n(6664),u=n(1134),l=n(8522),p=n(3636);function d(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.canMakePayment=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n){var r=n.billingData,a=n.cartTotals,o=(0,i.default)(n,["billingData","cartTotals"]),c=a.currency_code,s=r.country,l=e("countries"),p=e("allowedCountries"),d=e("features"),m=!1;if(e("isAdmin"))m=!0;else{if((0,u.cartContainsSubscription)()&&!d.includes("subscriptions"))return!1;if((0,u.cartContainsPreOrder)()&&!d.includes("pre-orders"))return!1;e("currencies").includes(c)&&(m="all_except"===p?!e("exceptCountries").includes(s):"specific"===p?e("specificCountries").includes(s):!(l.length>0)||l.includes(s)),t&&m&&(m=t(f({settings:e,billingData:r,cartTotals:a},o)))}return m}},t.LocalPaymentIntentContent=function(e){return r.createElement(s.Elements,{stripe:u.initStripe},r.createElement(y,e))},t.LocalPaymentSourceContent=function(e){return r.createElement(s.Elements,{stripe:u.initStripe},r.createElement(m,e))};var m=function(e){var t=e.getData,n=e.billing,a=e.shippingData,o=e.emitResponse,i=e.eventRegistration,c=e.getSourceArgs,s=void 0!==c&&c,u=e.element,p=void 0!==u&&u,d=a.shippingAddress,f=i.onPaymentProcessing,m=(i.onCheckoutAfterProcessingWithError,o.responseTypes),y=(o.noticeContexts,(0,l.useCreateSource)({getData:t,billing:n,shippingAddress:d,onPaymentProcessing:f,responseTypes:m,getSourceArgs:s,element:p}).setIsValid);return p?r.createElement(g,{name:t("name"),options:t("elementOptions"),onChange:function(e){y(e.complete)},element:p}):null},y=function(e){var t=e.getData,n=e.billing,a=e.emitResponse,i=e.eventRegistration,u=e.activePaymentMethod,d=e.confirmationMethod,f=void 0===d?null:d,m=e.component,y=void 0===m?null:m,v=(0,s.useElements)(),h=n.billingData,b=i.onPaymentProcessing,P=i.onCheckoutAfterProcessingWithError,E=a.responseTypes,O=a.noticeContexts,S=(0,c.useCallback)((function(){return y?(0,o.default)({},t("paymentType"),v.getElement(y)):{}}),[v]),_=(0,l.useValidateCheckout)({subscriber:b,responseTypes:E,component:y}).setIsValid;return(0,l.useAfterProcessLocalPayment)({getData:t,billingData:h,eventRegistration:i,responseTypes:E,activePaymentMethod:u,confirmationMethod:f,getPaymentMethodArgs:S}),(0,p.useProcessCheckoutError)({responseTypes:E,subscriber:P,messageContext:O.PAYMENT}),y?r.createElement(g,{name:t("name"),options:t("elementOptions"),onChange:function(e){return _(!e.empty)},element:y}):null},g=function(e){var t=e.name,n=e.onChange,a=e.element,o=e.options,i=a;return r.createElement("div",{className:"wc-stripe-local-payment-container ".concat(t," ").concat(i.displayName)},r.createElement(i,{options:o,onChange:n}))}},4784:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_multibanco_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"MultiBanco",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},3868:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_p24_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"P24",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmP24Payment",component:s.P24BankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},1192:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(9713)),i=a(n(6479)),c=n(4222),s=n(1134),u=n(3539),l=n(3187),p=n(6664);function d(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var m,y=(0,s.getSettings)("stripe_sepa_data"),g=(m=l.PaymentMethod,function(e){var t=e.getData,n=(0,i.default)(e,["getData"]);return r.createElement(r.Fragment,null,r.createElement(m,f(f({},n),{},{getData:t})),r.createElement("div",{className:"wc-stripe-blocks-sepa__mandate"},t("mandate")))});y()&&(0,c.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icon")}),ariaLabel:"SEPA",placeOrderButtonLabel:y("placeOrderButtonLabel"),canMakePayment:(0,u.canMakePayment)(y),content:r.createElement(g,{content:u.LocalPaymentSourceContent,getData:y,element:p.IbanElement,getSourceArgs:function(e,t){var n=t.billingData;return e.mandate={notification_method:n.email?"email":"manual",interval:(0,s.cartContainsSubscription)()||(0,s.cartContainsPreOrder)()?"scheduled":"one_time"},"scheduled"===e.mandate.interval&&delete e.amount,e}}),edit:r.createElement(u.LocalPaymentSourceContent,{getData:y}),supports:{showSavedCards:!1,showSaveOption:!1,features:y("features")}})},7894:(e,t,n)=>{var r=n(3027),a=n(5318)(n(9713)),o=n(4222),i=n(1134),c=n(3539),s=n(3187);function u(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=(0,i.getSettings)("stripe_sofort_data");p()&&(0,o.registerPaymentMethod)({name:p("name"),label:r.createElement(s.PaymentMethodLabel,{title:p("title"),paymentMethod:p("name"),icons:p("icon")}),ariaLabel:"Sofort",placeOrderButtonLabel:p("placeOrderButtonLabel"),canMakePayment:(0,c.canMakePayment)(p),content:r.createElement(s.PaymentMethod,{content:c.LocalPaymentSourceContent,getData:p,getSourceArgs:function(e,t){var n=t.billingData;return l(l({},e),{},{sofort:{country:n.country}})}}),edit:r.createElement(s.PaymentMethod,{content:c.LocalPaymentSourceContent,getData:p}),supports:{showSavedCards:!1,showSaveOption:!1,features:p("features")}})},3766:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(7015)),i=a(n(8926)),c=a(n(9713)),s=a(n(3038)),u=n(3027),l=n(4222),p=n(1134),d=n(3187),f=n(3539),m=n(6664),y=n(8522),g=n(3163),v=n(3636),h=(0,p.getSettings)("stripe_wechat_data"),b=function(e){return r.createElement(m.Elements,{stripe:p.initStripe},r.createElement(P,e))},P=function(e){var t=e.getData,n=e.billing,a=(e.shippingData,e.emitResponse),o=e.eventRegistration,i=e.components,c=a.responseTypes,s=o.onPaymentProcessing,l=o.onCheckoutAfterProcessingWithSuccess,d=i.ValidationInputError,f=(0,y.useValidateCheckout)({subscriber:o.onPaymentProcessing,responseTypes:a.responseTypes,msg:(0,g.__)("Please scan your QR code to continue with payment.","woo-stripe-payment")}),m=(f.isValid,f.setIsValid),v=O({getData:t,billing:n,responseTypes:c,subscriber:s}),h=v.source,b=v.error,P=v.deleteSourceFromStorage;return(0,u.useEffect)((function(){var e=l((function(){return P(),(0,p.ensureSuccessResponse)(c)}));return function(){return e()}}),[h,l,P]),(0,u.useEffect)((function(){h&&m(!0)}),[h]),h?r.createElement(E,{text:h.wechat.qr_code_url}):b?r.createElement("div",{className:"wechat-validation-error"},r.createElement(d,{errorMessage:(0,p.getErrorMessage)(b)})):(0,p.isAddressValid)(n.billingData)?null:(0,g.__)("Please fill out all the required fields in order to complete the WeChat payment.","woo-stripe-payment")},E=function(e){var t=e.text,n=e.width,a=void 0===n?128:n,o=e.height,i=void 0===o?128:o,c=e.colorDark,s=void 0===c?"#424770":c,l=e.colorLight,d=void 0===l?"#f8fbfd":l,f=e.correctLevel,m=void 0===f?QRCode.CorrectLevel.H:f,y=(0,u.useRef)();return(0,u.useEffect)((function(){new QRCode(y.current,{text:t,width:a,height:i,colorDark:s,colorLight:d,correctLevel:m})}),[y]),r.createElement(r.Fragment,null,r.createElement("div",{id:"wc-stripe-block-qrcode",ref:y}),(0,p.isTestMode)()&&r.createElement("p",null,(0,g.__)("Test mode: Click the Place Order button to proceed.","woo-stripe-payment")),!(0,p.isTestMode)()&&r.createElement("p",null,(0,g.__)("Scan the QR code using your WeChat app. Once scanned click the Place Order button.","woo-stripe-payment")))},O=function(e){var t=e.getData,n=e.billing,r=e.responseTypes,a=e.subscriber,l=(0,m.useStripe)(),d=(0,v.useStripeError)(),f=(0,s.default)(d,2),y=f[0],g=f[1],h=(0,u.useState)((0,p.getFromCache)("wechat:source")),b=(0,s.default)(h,2),P=b[0],E=b[1],O=(0,u.useRef)(null),S=n.cartTotal,_=n.billingData,w=n.currency;(0,u.useEffect)((function(){var e=a((function(){return(0,p.ensureSuccessResponse)(r,{meta:{paymentMethodData:(0,c.default)({},"".concat(t("name"),"_token_key"),P.id)}})}));return function(){return e()}}),[P,a]);var C=(0,u.useCallback)((0,i.default)(o.default.mark((function e(){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,y||!(0,p.isAddressValid)(_)){e.next=9;break}return e.next=4,l.createSource((0,p.getDefaultSourceArgs)({type:t("paymentType"),amount:S.value,billingData:_,currency:w.code,returnUrl:t("returnUrl")}));case 4:if(!(n=e.sent).error){e.next=7;break}throw new p.StripeError(n.error);case 7:E(n.source),(0,p.storeInCache)("wechat:source",n.source);case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.log("error: ",e.t0),g(e.t0.error);case 15:case"end":return e.stop()}}),e,null,[[0,11]])}))),[l,P,S.value,_,w,y]),k=(0,u.useCallback)((function(){(0,p.deleteFromCache)("wechat:source")}),[]);return(0,u.useEffect)((function(){l&&!P&&(clearTimeout(O.current),O.current=setTimeout(C,1e3))}),[l,P]),{source:P,setSource:E,error:y,deleteSourceFromStorage:k}};h()&&(0,l.registerPaymentMethod)({name:h("name"),label:r.createElement(d.PaymentMethodLabel,{title:h("title"),paymentMethod:h("name"),icons:h("icon")}),ariaLabel:"WeChat",canMakePayment:(0,f.canMakePayment)(h),content:r.createElement(d.PaymentMethod,{content:b,getData:h}),edit:r.createElement(d.PaymentMethod,{content:b,getData:h}),supports:{showSavedCards:!1,showSaveOption:!1,features:h("features")}})},5180:(e,t,n)=>{n(3139),n(3726)},3726:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(3636),p=n(6664),d=(0,u.getSettings)("stripe_payment_request_data"),f=function(e){return r.createElement("div",{className:"wc-stripe-payment-request-container"},r.createElement(p.Elements,{stripe:u.initStripe},r.createElement(m,e)))},m=function(e){var t=e.getData,n=e.onClick,a=e.onClose,s=e.billing,u=e.shippingData,d=e.eventRegistration,f=e.emitResponse,m=e.onSubmit,y=e.activePaymentMethod,g=((0,i.default)(e,["getData","onClick","onClose","billing","shippingData","eventRegistration","emitResponse","onSubmit","activePaymentMethod"]),d.onPaymentProcessing),v=f.responseTypes,h=f.noticeContexts,b=(0,p.useStripe)(),P=(0,l.useStripeError)(),E=(0,o.default)(P,1)[0],O=(0,l.useExportedValues)();(0,l.useExpressBreakpointWidth)({payment_method:t("name"),width:300});var S=(0,l.useProcessPaymentIntent)({getData:t,billing:s,shippingData:u,onPaymentProcessing:g,emitResponse:f,error:E,onSubmit:m,activePaymentMethod:y,exportedValues:O}).setPaymentMethod;(0,l.useAfterProcessingPayment)({getData:t,eventRegistration:d,responseTypes:v,activePaymentMethod:y,messageContext:h.EXPRESS_PAYMENTS});var _=(0,l.usePaymentRequest)({getData:t,onClose:a,stripe:b,billing:s,shippingData:u,eventRegistration:d,setPaymentMethod:S,exportedValues:O,canPay:function(e){return null!=e&&!e.applePay}}).paymentRequest,w=(0,c.useMemo)((function(){return{paymentRequest:_,style:{paymentRequestButton:t("paymentRequestButton")}}}),[_]);return _?r.createElement(p.PaymentRequestButtonElement,{options:w,onClick:n}):null},y=function(e){e.getData,(0,i.default)(e,["getData"]);var t=(0,c.useRef)();return(0,c.useEffect)((function(){var e=window.devicePixelRatio;t.current.width=20*e,t.current.height=20*e;var n=t.current.getContext("2d");n.scale(e,e),n.beginPath(),n.arc(10,10,10,0,2*Math.PI),n.fillStyle="#986fff",n.fill()})),r.createElement("div",{className:"payment-request-block-editor"},r.createElement("div",{className:"icon-container"},r.createElement("span",null,"Buy now"),r.createElement("canvas",{className:"PaymentRequestButton-icon",ref:t}),r.createElement("i",{className:"payment-request-arrow"})))};(0,s.registerExpressPaymentMethod)({name:d("name"),canMakePayment:function(e){var t=e.cartTotals;if(d("isAdmin"))return!0;var n=t.currency_code,r=t.total_price;return(0,u.canMakePayment)({country:d("countryCode"),currency:n.toLowerCase(),total:{label:d("totalLabel"),amount:parseInt(r)}},(function(e){return null!=e&&!e.applePay}))},content:r.createElement(f,{getData:d}),edit:r.createElement(y,{getData:d}),supports:{showSavedCards:d("showSavedCards"),showSaveOption:d("showSaveOption"),features:d("features")}})},1065:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(7015)),o=r(n(8926)),i=n(3027),c=n(1134);t.default=function(e){var t=e.eventRegistration,n=e.emitResponse,r=e.getData,s=t.onCheckoutAfterProcessingWithSuccess,u=n.responseTypes,l=(0,i.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(t){var n,o;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.redirectUrl,e.next=3,c.initStripe;case 3:return o=e.sent,e.next=6,(0,c.handleCardAction)({redirectUrl:n,getData:r,stripe:o,responseTypes:u});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[s]);return(0,i.useEffect)((function(){var e=s(l);return function(){return e()}}),[s]),null}},1134:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.isCheckoutPage=t.isCartPage=t.deleteFromCache=t.getFromCache=t.storeInCache=t.isTestMode=t.getDefaultSourceArgs=t.cartContainsSubscription=t.cartContainsPreOrder=t.getLocalPaymentMethods=t.registerLocalPaymentMethod=t.canMakePayment=t.getDisplayItems=t.getShippingOptionId=t.getShippingOptions=t.formatPrice=t.filterEmptyValues=t.getIntermediateAddress=t.toCartAddress=t.handleCardAction=t.isUserLoggedIn=t.hasShippingRates=t.getSelectedShippingOption=t.isFieldRequired=t.getLocaleFields=t.isAddressValid=t.removeNumberPrecision=t.isEmpty=t.StripeError=t.getSettings=t.getBillingDetailsFromAddress=t.getErrorMessage=t.ensureErrorResponse=t.ensureSuccessResponse=t.getRoute=t.getCreditCardForm=t.registerCreditCardForm=t.initStripe=void 0;var a=r(n(319)),o=r(n(7015)),i=r(n(8926)),c=r(n(3038)),s=r(n(8)),u=r(n(4575)),l=r(n(2205)),p=r(n(8585)),d=r(n(9754)),f=r(n(5957)),m=r(n(9713)),y=r(n(6479)),g=n(4465),v=n(2492),h=r(n(7606)),b=n(8419);function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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,i=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}function E(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 O(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 S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){(0,m.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _=(0,v.getSetting)("stripeGeneralData"),w=_.publishableKey,C=_.account,k=(0,v.getSetting)("stripeErrorMessages"),M=(0,v.getSetting)("countryLocale",{}),j=/^([\w]+)\:(.+)$/,D=(0,v.getSetting)("stripeGeneralData").routes,R={},x=[],A={recipient:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},payerName:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},country:"country",addressLine:function(e,t){return t[0]&&(e.address_1=t[0]),t[1]&&(e.address_2=t[1]),e},line1:"address_1",line2:"address_2",city:"city",region:"state",postalCode:"postcode",postal_code:"postcode",payerEmail:"email",payerPhone:"phone"},I=new Promise((function(e,t){(0,g.loadStripe)(w,C?{stripeAccount:C}:{}).then((function(t){e(t)})).catch((function(t){e({error:t})}))}));t.initStripe=I,t.registerCreditCardForm=function(e){var t=e.id,n=(0,y.default)(e,["id"]);R[t]=n},t.getCreditCardForm=function(e){return R[e]};var T=function(e){return null!=D&&D[e]?D[e]:console.log("".concat(e," is not a valid route"))};t.getRoute=T;var L=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S({type:e.SUCCESS},t)};t.ensureSuccessResponse=L;var N=function(e,t){return{type:e.ERROR,message:B(t)}};t.ensureErrorResponse=N;var B=function(e){return"string"==typeof e?e:null!=e&&e.code&&null!=k&&k[e.code]?k[e.code]:null!=e&&e.statusCode?null!=k&&k[e.statusCode]?k[e.statusCode]:e.statusMessage:e.message};t.getErrorMessage=B;var F=function(e){var t={name:"".concat(e.first_name," ").concat(e.last_name),address:{city:e.city||"",country:e.country||"",line1:e.address_1||"",line2:e.address_2||"",postal_code:e.postcode||"",state:e.state||""}};return null!=e&&e.phone&&(t.phone=e.phone),null!=e&&e.email&&(t.email=e.email),t};t.getBillingDetailsFromAddress=F,t.getSettings=function(e){return function(t){return t?(0,v.getSetting)(e)[t]:(0,v.getSetting)(e)}};var q=function(e){(0,l.default)(a,e);var t,n,r=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,d.default)(t);if(n){var a=(0,d.default)(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return(0,p.default)(this,e)});function a(e){var t;return(0,u.default)(this,a),(t=r.call(this,e.message)).error=e,t}return a}((0,f.default)(Error));t.StripeError=q;var V=function(e){return"string"==typeof e?0==e.length||""==e:Array.isArray(e)?0==array.length:"object"!==(0,s.default)(e)||0==Object.keys(e).length};t.isEmpty=V,t.removeNumberPrecision=function(e,t){return e/Math.pow(10,t)},t.isAddressValid=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=U(e.country),r=0,a=Object.entries(e);r<a.length;r++){var o=(0,c.default)(a[r],2),i=o[0],s=o[1];if(!t.includes(i)&&null!=n&&n[i]&&n[i].required&&V(s))return!1}return!0};var U=function(e){var t=S({},M.default);return e&&null!=M&&M[e]&&(t=Object.entries(M[e]).reduce((function(e,t){var n=(0,c.default)(t,2),r=n[0],a=n[1];return e[r]=S(S({},e[r]),a),e}),t),["phone","email"].forEach((function(e){var n=document.getElementById(e);n&&(t[e]={required:n.required})}))),t};t.getLocaleFields=U,t.isFieldRequired=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=U(t);return[e]in n&&n[e].required},t.getSelectedShippingOption=function(e){var t=e.match(j);if(t){var n=t[1];return[t[2],n]}return[]},t.hasShippingRates=function(e){return e.map((function(e){return e.shipping_rates.length>0})).filter(Boolean).length>0},t.isUserLoggedIn=function(e){return e>0};var W=function(){var e=(0,i.default)(o.default.mark((function e(t,n){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.default)({url:D["sync/intent"],method:"POST",data:{order_id:t,client_secret:n}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.log(e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t,n){return e.apply(this,arguments)}}(),Y=function(){var e=(0,i.default)(o.default.mark((function e(t){var n,r,a,i,c,s,u,l,p,d,f,y,g,v;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.redirectUrl,r=t.responseTypes,a=t.stripe,i=t.getData,c=t.savePaymentMethod,s=void 0!==c&&c,e.prev=1,!(u=n.match(/#response=(.+)/))){e.next=20;break}return l=JSON.parse(window.atob(decodeURIComponent(u[1]))),p=l.client_secret,d=l.order_id,f=l.order_key,e.next=7,a.handleCardAction(p);case 7:if(!(y=e.sent).error){e.next=11;break}return W(d,p),e.abrupt("return",N(r,y.error));case 11:return g=(0,m.default)({order_id:d,order_key:f},"".concat(i("name"),"_save_source_key"),s),e.next=14,(0,h.default)({url:T("process/payment"),method:"POST",data:g});case 14:if(!(v=e.sent).messages){e.next=17;break}return e.abrupt("return",N(r,v.messages));case 17:return e.abrupt("return",L(r,{redirectUrl:v.redirect}));case 20:return e.abrupt("return",L(r));case 21:e.next=27;break;case 23:return e.prev=23,e.t0=e.catch(1),console.log(e.t0),e.abrupt("return",N(r,e.t0));case 27:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(t){return e.apply(this,arguments)}}();t.handleCardAction=Y,t.toCartAddress=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};t=S(S({},t),G(n));for(var a=0,o=Object.entries(e);a<o.length;a++){var i,s=(0,c.default)(o[a],2),u=s[0],l=s[1];null!==(i=t)&&void 0!==i&&i[u]&&("function"==typeof l?l(r,t[u]):r[l]=t[u])}return r}},t.getIntermediateAddress=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["city","postcode","state","country"],r={},a=P(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r[o]=e[o]}}catch(e){a.e(e)}finally{a.f()}return r};var G=function(e){return Object.keys(e).filter((function(t){return Boolean(e[t])})).reduce((function(t,n){return S(S({},t),{},(0,m.default)({},n,e[n]))}),{})};t.filterEmptyValues=G;var K=function(e,t){var n=(0,b.getCurrency)(t),r=n.prefix,a=n.suffix,o=n.decimalSeparator,i=n.minorUnit,c=n.thousandSeparator;if(""==e||void 0===e)return e;e="string"==typeof e?parseInt(e,10):e;var s,u=(e=(e/=Math.pow(10,i)).toString().replace(".",o)).indexOf(o);if(u<0)e+="".concat(o).concat(new Array(i+1).join("0"));else{var l=e.substr(u+1);l.length<i&&(e+=new Array(i-l.length+1).join("0"))}var p=e.match(new RegExp("(\\d+)\\".concat(o,"(\\d+)")));return e=p[1],s=p[2],r+(e=(e=e.replace(new RegExp("\\B(?=(\\d{3})+(?!\\d))","g"),"".concat(c)))+o+s)+a};t.formatPrice=K,t.getShippingOptions=function(e){var t=[];return e.forEach((function(e,n){e.shipping_rates.sort((function(e){return e.selected?-1:1}));var r=e.shipping_rates.map((function(e){var t=document.createElement("textarea");return t.innerHTML=e.name,K(e.price,e.currency_code),{id:H(n,e.rate_id),label:t.value,amount:parseInt(e.price,10)}}));t=[].concat((0,a.default)(t),(0,a.default)(r))})),t};var H=function(e,t){return"".concat(e,":").concat(t)};t.getShippingOptionId=H,t.getDisplayItems=function(e,t){t.minorUnit;var n=[];return e.forEach((function(e){0<e.value&&n.push({label:e.label,pending:!1,amount:e.value})})),n};var z={};t.canMakePayment=function(e,t){var n=e.country,r=e.currency,a=e.total;return new Promise((function(e,o){var i=[n,r,a.amount].reduce((function(e,t){return"".concat(e,"-").concat(t)}));return r?i in z?e(z[i]):I.then((function(c){if(c.error)return o(c.error);c.paymentRequest({country:n,currency:r,total:a}).canMakePayment().then((function(n){return z[i]=t(n),e(z[i])}))})).catch(o):e(!1)}))},t.registerLocalPaymentMethod=function(e){x.push(e)},t.getLocalPaymentMethods=function(){return x},t.cartContainsPreOrder=function(){var e=(0,v.getSetting)("stripePaymentData");return e&&e.pre_order},t.cartContainsSubscription=function(){var e=(0,v.getSetting)("stripePaymentData");return e&&e.subscription},t.getDefaultSourceArgs=function(e){var t=e.type,n=e.amount,r=e.billingData,a=e.currency,o=e.returnUrl;return{type:t,amount:n,currency:a,owner:F(r),redirect:{return_url:o}}},t.isTestMode=function(){return"test"===(0,v.getSetting)("stripeGeneralData").mode};var J=function(e){return"".concat("stripe:").concat(e)};t.storeInCache=function(e,t){var n=Math.floor((new Date).getTime()/1e3)+900;"sessionStorage"in window&&sessionStorage.setItem(J(e),JSON.stringify({value:t,exp:n}))},t.getFromCache=function(e){if("sessionStorage"in window)try{var t=JSON.parse(sessionStorage.getItem(J(e)));if(t){var n=t.value,r=t.exp;if(!(Math.floor((new Date).getTime()/1e3)>r))return n;Q(J(e))}}catch(e){}return null};var Q=function(e){"sessionStorage"in window&&sessionStorage.removeItem(J(e))};t.deleteFromCache=Q,t.isCartPage=function(){return"cart"===(0,v.getSetting)("stripeGeneralData").page},t.isCheckoutPage=function(){return"checkout"===(0,v.getSetting)("stripeGeneralData").page}},4184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)&&n.length){var i=a.apply(null,n);i&&e.push(i)}else if("object"===o)for(var c in n)r.call(n,c)&&n[c]&&e.push(c)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},1127:()=>{},7776:()=>{},4836:()=>{},85:()=>{},3110:()=>{},8356:()=>{},5773:()=>{},9509:()=>{},1530:()=>{},3139:()=>{}}]);
3
  //# sourceMappingURL=commons.js.map
1
  /*! For license information please see commons.js.LICENSE.txt */
2
+ (self.webpackChunkwc_stripe_name_=self.webpackChunkwc_stripe_name_||[]).push([[351],{7228:e=>{e.exports=function(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}},2858:e=>{e.exports=function(e){if(Array.isArray(e))return e}},3646:(e,t,n)=>{var r=n(7228);e.exports=function(e){if(Array.isArray(e))return r(e)}},1506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8926:e=>{function t(e,t,n,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(a,o){var i=e.apply(n,r);function c(e){t(i,a,o,c,s,"next",e)}function s(e){t(i,a,o,c,s,"throw",e)}c(void 0)}))}}},4575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},9100:(e,t,n)=>{var r=n(9489),a=n(7067);function o(t,n,i){return a()?e.exports=o=Reflect.construct:e.exports=o=function(e,t,n){var a=[null];a.push.apply(a,t);var o=new(Function.bind.apply(e,a));return n&&r(o,n.prototype),o},o.apply(null,arguments)}e.exports=o},3913:e=>{function t(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,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}},9713:e=>{e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},7154:e=>{function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}e.exports=t},9754:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(n)}e.exports=t},2205:(e,t,n)=>{var r=n(9489);e.exports=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}}),t&&r(e,t)}},5318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},430:e=>{e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},7067:e=>{e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},6860:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},3884:e=>{e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return n}}},521:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},8206:e=>{e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},6479:(e,t,n)=>{var r=n(7316);e.exports=function(e,t){if(null==e)return{};var n,a,o=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},7316:e=>{e.exports=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}},8585:(e,t,n)=>{var r=n(8),a=n(1506);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?a(e):t}},9489:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(n,r)}e.exports=t},3038:(e,t,n)=>{var r=n(2858),a=n(3884),o=n(379),i=n(521);e.exports=function(e,t){return r(e)||a(e,t)||o(e,t)||i()}},319:(e,t,n)=>{var r=n(3646),a=n(6860),o=n(379),i=n(8206);e.exports=function(e){return r(e)||a(e)||o(e)||i()}},8:e=>{function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t},379:(e,t,n)=>{var r=n(7228);e.exports=function(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}},5957:(e,t,n)=>{var r=n(9754),a=n(9489),o=n(430),i=n(9100);function c(t){var n="function"==typeof Map?new Map:void 0;return e.exports=c=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return i(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),a(t,e)},c(t)}e.exports=c},6664:function(e,t,n){!function(e,t){"use strict";function n(e){return(n="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})(e)}function r(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(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}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function i(){}function c(){}c.resetWarningCache=i;var s,u=(function(e){e.exports=function(){function e(e,t,n,r,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:i};return n.PropTypes=n,n}()}(s={exports:{}},s.exports),s.exports),l=function(e){return null!==e&&"object"===n(e)},p="[object Object]",d=function e(t,n){if(!l(t)||!l(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var a=Object.prototype.toString.call(t)===p;if(a!==(Object.prototype.toString.call(n)===p))return!1;if(!a&&!r)return!1;var o=Object.keys(t),i=Object.keys(n);if(o.length!==i.length)return!1;for(var c={},s=0;s<o.length;s+=1)c[o[s]]=!0;for(var u=0;u<i.length;u+=1)c[i[u]]=!0;var d=Object.keys(c);if(d.length!==o.length)return!1;var f=t,m=n;return d.every((function(t){return e(f[t],m[t])}))},f=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},m=function(e){if(null===e||l(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},y=function(e){if(function(e){return l(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(m)};var t=m(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},g=t.createContext(null);g.displayName="ElementsContext";var v=function(e){var n=e.stripe,r=e.options,o=e.children,i=t.useRef(!1),c=t.useRef(!0),s=t.useMemo((function(){return y(n)}),[n]),u=a(t.useState((function(){return{stripe:null,elements:null}})),2),l=u[0],p=u[1],m=f(n),v=f(r);return null!==m&&(m!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),d(r,v)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),i.current||("sync"===s.tag&&(i.current=!0,p({stripe:s.stripe,elements:s.stripe.elements(r)})),"async"===s.tag&&(i.current=!0,s.stripePromise.then((function(e){e&&c.current&&p({stripe:e,elements:e.elements(r)})})))),t.useEffect((function(){return function(){c.current=!1}}),[]),t.useEffect((function(){var e=l.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.4.0"})}),[l.stripe]),t.createElement(g.Provider,{value:l},o)};v.propTypes={stripe:u.any,options:u.object};var h=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(g),e)},b=function(e){return(0,e.children)(h("mounts <ElementsConsumer>"))};b.propTypes={children:u.func.isRequired};var P=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},E=function(e){return l(e)?(e.paymentRequest,r(e,["paymentRequest"])):{}},O=function(){},S=function(e,n){var r,a="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),o=n?function(e){h("mounts <".concat(a,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,o=n.className,i=n.options,c=void 0===i?{}:i,s=n.onBlur,u=void 0===s?O:s,l=n.onFocus,p=void 0===l?O:l,f=n.onReady,m=void 0===f?O:f,y=n.onChange,g=void 0===y?O:y,v=n.onEscape,b=void 0===v?O:v,S=n.onClick,_=void 0===S?O:S,w=h("mounts <".concat(a,">")).elements,C=t.useRef(null),k=t.useRef(null),M=P(m),j=P(u),D=P(p),R=P(_),x=P(g),A=P(b);t.useLayoutEffect((function(){if(null==C.current&&w&&null!=k.current){var t=w.create(e,c);C.current=t,t.mount(k.current),t.on("ready",(function(){return M(t)})),t.on("change",x),t.on("blur",j),t.on("focus",D),t.on("escape",A),t.on("click",R)}}));var I=t.useRef(c);return t.useEffect((function(){I.current&&I.current.paymentRequest!==c.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=E(c);0===Object.keys(e).length||d(e,E(I.current))||C.current&&(C.current.update(e),I.current=c)}),[c]),t.useLayoutEffect((function(){return function(){C.current&&C.current.destroy()}}),[]),t.createElement("div",{id:r,className:o,ref:k})};return o.propTypes={id:u.string,className:u.string,onChange:u.func,onBlur:u.func,onFocus:u.func,onReady:u.func,onClick:u.func,options:u.object},o.displayName=a,o.__elementType=e,o},_="undefined"==typeof window,w=S("auBankAccount",_),C=S("card",_),k=S("cardNumber",_),M=S("cardExpiry",_),j=S("cardCvc",_),D=S("fpxBank",_),R=S("iban",_),x=S("idealBank",_),A=S("p24Bank",_),I=S("epsBank",_),T=S("paymentRequestButton",_),L=S("afterpayClearpayMessage",_);e.AfterpayClearpayMessageElement=L,e.AuBankAccountElement=w,e.CardCvcElement=j,e.CardElement=C,e.CardExpiryElement=M,e.CardNumberElement=k,e.Elements=v,e.ElementsConsumer=b,e.EpsBankElement=I,e.FpxBankElement=D,e.IbanElement=R,e.IdealBankElement=x,e.P24BankElement=A,e.PaymentRequestButtonElement=T,e.useElements=function(){return h("calls useElements()").elements},e.useStripe=function(){return h("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(3804))},4465:(e,t,n)=>{"use strict";n.r(t),n.d(t,{loadStripe:()=>l});var r="https://js.stripe.com/v3",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,o="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",i=null,c=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.12.1",startTime:t})}(r,n),r},s=Promise.resolve().then((function(){return e=null,null!==i?i:i=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(o),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(r,'"]')),t=0;t<e.length;t++){var n=e[t];if(a.test(n.src))return n}return null}();i&&e?console.warn(o):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(r).concat(t);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),u=!1;s.catch((function(e){u||console.warn(e)}));var l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];u=!0;var r=Date.now();return s.then((function(e){return c(e,t,r)}))}},8149:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.SavePaymentMethod=void 0;var o=a(n(4184));n(1127),t.SavePaymentMethod=function(e){var t=e.label,n=e.onChange,a=e.checked;return r.createElement("div",{className:"wc-stripe-save-payment-method"},r.createElement("label",null,r.createElement("input",{type:"checkbox",onChange:function(e){return n(e.target.checked)}}),r.createElement("svg",{className:(0,o.default)("wc-stripe-components-checkbox__mark",{checked:a}),"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},r.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))),r.createElement("span",null,t))}},3187:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(2029);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(8149);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(8744);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var i=n(4901);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}))},2029:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentMethodLabel=void 0;var o=a(n(6479));n(7776),t.PaymentMethodLabel=function(e){var t=e.title,n=e.icons,a=e.paymentMethod,i=(0,o.default)(e,["title","icons","paymentMethod"]).components,c=i.PaymentMethodLabel,s=i.PaymentMethodIcons;return Array.isArray(n)||(n=[n]),r.createElement("span",{className:"wc-stripe-label-container ".concat(a)},r.createElement(c,{text:t}),r.createElement(s,{icons:n,align:"left"}))}},4901:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentMethod=void 0;var o=a(n(9713)),i=a(n(6479)),c=n(3027);function s(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.PaymentMethod=function(e){var t=e.getData,n=e.content,a=(0,i.default)(e,["getData","content"]),o=n,s=t("description"),p=(0,c.useRef)(null);return(0,c.useEffect)((function(){p.current&&0==p.current.childNodes.length&&p.current.classList.add("no-content")})),r.createElement(r.Fragment,null,s&&r.createElement(l,{desc:s,payment_method:t("name")}),r.createElement("div",{ref:p,className:"wc-stripe-blocks-payment-method-content"},r.createElement(o,u(u({},a),{},{getData:t}))))};var l=function(e){var t=e.desc,n=e.payment_method;return r.createElement("div",{className:"wc-stripe-blocks-payment-method__desc ".concat(n)},r.createElement("p",null,t))}},6630:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.RadioControlAccordion=void 0;var o=a(n(8744)),i=a(n(4184)),c=function(e){var t=e.option,n=e.checked,a=e.onChange,c=t.label,s=t.value;return r.createElement("div",{className:"wc-stripe-blocks-radio-accordion"},r.createElement(o.default,{checked:n,onChange:a,value:s,label:c}),r.createElement("div",{className:(0,i.default)("wc-stripe-blocks-radio-accordion__content",{"wc-stripe-blocks-radio-accordion__content-visible":n})},t.content))};t.RadioControlAccordion=c;var s=c;t.default=s},8744:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.RadioControlOption=void 0;var o=a(n(4184)),i=function(e){var t=e.checked,n=e.onChange,a=e.value,i=e.label;return r.createElement("label",{className:(0,o.default)("wc-stripe-blocks-radio-control__option",{"wc-stripe-blocks-radio-control__option-checked":t})},r.createElement("input",{className:"wc-stripe-blocks-radio-control__input",type:"radio",value:a,checked:t,onChange:function(e){return n(e.target.value)}}),r.createElement("div",{className:"wc-stripe-blocks-radio-control__label"},r.createElement("span",null,i)))};t.RadioControlOption=i;var c=i;t.default=c},7260:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(1293);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(7150);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(5201);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},1293:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateLinkToken=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(3038)),c=n(3027),s=r(n(7606)),u=n(1134);t.useCreateLinkToken=function(e){var t=e.setValidationError,n=(0,c.useState)(!1),r=(0,i.default)(n,2),l=r[0],p=r[1],d=(0,c.useCallback)((0,o.default)(a.default.mark((function e(){var n;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,s.default)({url:(0,u.getRoute)("create/linkToken"),method:"POST",data:{}});case 3:(n=e.sent).token&&((0,u.storeInCache)("linkToken",n.token),p(n.token)),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),t(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),[]);return(0,c.useEffect)((function(){if(!l){var e=(0,u.getFromCache)("linkToken");e?p(e):d()}}),[l,p]),l}},7150:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useInitializePlaid=void 0;var a=n(3027),o=r(n(2810)),i=n(1134);t.useInitializePlaid=function(e){var t=e.getData,n=e.linkToken,r=(0,a.useRef)(null),c=(0,a.useRef)(null),s=(0,a.useCallback)((function(){return new Promise((function(e,t){c.current={resolve:e,reject:t},r.current.open()}))}),[]);return(0,a.useEffect)((function(){n&&(r.current=o.default.create({clientName:t("clientName"),env:t("plaidEnvironment"),product:["auth"],token:n,selectAccount:!0,countryCodes:["US"],onSuccess:function(e,t){c.current.resolve({publicToken:e,metaData:t})},onExit:function(e){c.current.reject(!!e&&(0,i.getErrorMessage)(e.error_message))}}))}),[n]),s}},5201:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPayment=void 0;var a=r(n(7015)),o=r(n(9713)),i=r(n(8926)),c=n(3027),s=n(1134);t.useProcessPayment=function(e){var t=e.openLinkPopup,n=e.onPaymentProcessing,r=e.responseTypes,u=e.paymentMethod;(0,c.useEffect)((function(){var e=n((0,i.default)(a.default.mark((function e(){var n,i,c,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t();case 3:return i=e.sent,c=i.publicToken,l=i.metaData,(0,s.deleteFromCache)("linkToken"),e.abrupt("return",(0,s.ensureSuccessResponse)(r,{meta:{paymentMethodData:(n={},(0,o.default)(n,"".concat(u,"_token_key"),c),(0,o.default)(n,"".concat(u,"_metadata"),JSON.stringify(l)),n)}}));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",(0,s.ensureErrorResponse)(r,e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,9]])}))));return function(){return e()}}),[n,r,t])}},5605:(e,t,n)=>{n(4836),n(4888)},4888:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(3187),p=a(n(1065)),d=n(7260),f=n(3636),m=n(3163),y=(0,u.getSettings)("stripe_ach_data"),g=function(e){var t=e.getData,n=e.eventRegistration,a=e.components,s=e.emitResponse,l=e.onSubmit,p=((0,i.default)(e,["getData","eventRegistration","components","emitResponse","onSubmit"]),s.responseTypes),m=n.onPaymentProcessing,y=n.onCheckoutAfterProcessingWithError,g=a.ValidationInputError,h=(0,c.useState)(!1),b=(0,o.default)(h,2),P=b[0],E=b[1],O=(0,d.useCreateLinkToken)({setValidationError:E});(0,f.useProcessCheckoutError)({responseTypes:p,subscriber:y});var S=(0,d.useInitializePlaid)({getData:t,linkToken:O,onSubmit:l});return(0,d.useProcessPayment)({openLinkPopup:S,onPaymentProcessing:m,responseTypes:p,paymentMethod:t("name")}),r.createElement(r.Fragment,null,u.isTestMode&&r.createElement(v,null),P&&r.createElement(g,{errorMessage:P}))},v=function(){return r.createElement("div",{className:"wc-stripe-blocks-ach__creds"},r.createElement("label",{className:"wc-stripe-blocks-ach__creds-label"},(0,m.__)("Test Credentials","woo-stripe-payment")),r.createElement("div",{className:"wc-stripe-blocks-ach__username"},r.createElement("div",null,r.createElement("strong",null,(0,m.__)("username","woo-stripe-payment")),": user_good"),r.createElement("div",null,r.createElement("strong",null,(0,m.__)("password","woo-stripe-payment")),": pass_good"),r.createElement("div",null,r.createElement("strong",null,(0,m.__)("pin","woo-stripe-payment")),": credential_good")))};(0,s.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icons")}),ariaLabel:"ACH Payment",canMakePayment:function(e){return"USD"===e.cartTotals.currency_code},content:r.createElement(l.PaymentMethod,{getData:y,content:g}),savedTokenComponent:r.createElement(p.default,{getData:y}),edit:r.createElement(g,{getData:y}),placeOrderButtonLabel:y("placeOrderButtonLabel"),supports:{showSavedCards:y("showSavedCards"),showSaveOption:!1,features:y("features")}})},3846:(e,t,n)=>{n(85),n(660)},660:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(6664),p=a(n(7082)),d=n(3636),f=(0,u.getSettings)("stripe_applepay_data"),m=function(e){return r.createElement(p.default,null,r.createElement("div",{className:"wc-stripe-apple-pay-container"},r.createElement(l.Elements,{stripe:u.initStripe},r.createElement(y,e))))},y=function(e){var t=e.getData,n=e.onClick,a=e.onClose,s=e.billing,u=e.shippingData,p=e.eventRegistration,f=e.emitResponse,m=e.onSubmit,y=e.activePaymentMethod,g=((0,i.default)(e,["getData","onClick","onClose","billing","shippingData","eventRegistration","emitResponse","onSubmit","activePaymentMethod"]),p.onPaymentProcessing),v=f.responseTypes,h=f.noticeContexts,b=(0,l.useStripe)(),P=(0,d.useStripeError)(),E=(0,o.default)(P,1)[0],O=(0,d.useExportedValues)();(0,d.useExpressBreakpointWidth)({payment_method:t("name"),width:300});var S=(0,d.useProcessPaymentIntent)({getData:t,billing:s,shippingData:u,onPaymentProcessing:g,emitResponse:f,error:E,onSubmit:m,activePaymentMethod:y,exportedValues:O}).setPaymentMethod;(0,d.useAfterProcessingPayment)({getData:t,eventRegistration:p,responseTypes:v,activePaymentMethod:y,messageContext:h.EXPRESS_PAYMENTS});var _=(0,d.usePaymentRequest)({getData:t,onClose:a,stripe:b,billing:s,shippingData:u,eventRegistration:p,setPaymentMethod:S,exportedValues:O,canPay:function(e){return null!=e&&e.applePay}}).paymentRequest,w=(0,c.useCallback)((function(){_&&(n(),_.show())}),[_]);return _?r.createElement("button",{className:"apple-pay-button ".concat(t("buttonStyle")),style:{"-apple-pay-button-type":t("buttonType")},onClick:w}):null},g=function(e){var t=e.getData;return(0,i.default)(e,["getData"]),r.createElement("div",{className:"apple-pay-block-editor"},r.createElement("img",{src:t("editorIcon")}))};(0,s.registerExpressPaymentMethod)({name:f("name"),canMakePayment:function(e){var t=e.cartTotals;if((0,i.default)(e,["cartTotals"]),f("isAdmin"))return!0;var n=t.currency_code,r=t.total_price;return(0,u.canMakePayment)({country:f("countryCode"),currency:n.toLowerCase(),total:{label:f("totalLabel"),amount:parseInt(r)}},(function(e){return null!=e&&e.applePay}))},content:r.createElement(m,{getData:f}),edit:r.createElement(g,{getData:f}),supports:{showSavedCards:f("showSavedCards"),showSaveOption:f("showSaveOption"),features:f("features")}})},7354:(e,t,n)=>{var r=n(3027);n(3110);var a=n(1134),o=n(6664),i=n(3163),c=function(e){var t=e.CardIcon,n=e.options,a=e.onChange;return r.createElement("div",{className:"wc-stripe-bootstrap-form"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-md-6 mb-3"},r.createElement(o.CardNumberElement,{className:"md-form md-outline stripe-input",options:n.cardNumber,onChange:a(o.CardNumberElement)}),r.createElement("label",{htmlFor:"stripe-card-number"},(0,i.__)("Card Number","woo-stripe-payment")),t),r.createElement("div",{className:"col-md-3 mb-3"},r.createElement(o.CardExpiryElement,{className:"md-form md-outline stripe-input",options:n.cardExpiry,onChange:a(o.CardExpiryElement)}),r.createElement("label",{htmlFor:"stripe-exp"},(0,i.__)("Exp","woo-stripe-payment"))),r.createElement("div",{className:"col-md-3 mb-3"},r.createElement(o.CardCvcElement,{className:"md-form md-outline stripe-input",options:n.cardCvc,onChange:a(o.CardCvcElement)}),r.createElement("label",{htmlFor:"stripe-cvv"},(0,i.__)("CVV","woo-stripe-payment")))))};(0,a.registerCreditCardForm)({id:"bootstrap",breakpoint:475,component:r.createElement(c,null)})},3329:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(9713)),i=a(n(3038)),c=n(1134),s=n(3027),u=n(6664),l=n(3163),p=n(3636);function d(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 f(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 m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y={focus:"focused",empty:"empty",invalid:"invalid"},g=function(e){var t=e.type,n=e.src;return t?r.createElement("img",{className:"wc-stripe-card ".concat(t),src:n}):null};t.default=function(e){var t=e.getData,n=e.onChange,a=(e.ValidationInputError,(0,s.useState)(window.innerWidth)),o=(0,i.default)(a,2),f=(o[0],o[1],(0,s.useState)("")),v=(0,i.default)(f,2),h=v[0],b=v[1],P=(0,s.useRef)([]),E=(0,s.useState)(null),O=(0,i.default)(E,2),S=O[0],_=O[1],w=(0,u.useElements)(),C=t("customForm"),k=(0,c.getCreditCardForm)(C),M=k.component,j=k.breakpoint,D=void 0===j?475:j,R=t("postalCodeEnabled"),x={};["cardNumber","cardExpiry","cardCvc"].forEach((function(e){x[e]=m(m({classes:y},t("cardOptions")),t("customFieldOptions")[e])}));var A=(0,s.useCallback)((function(e){P.current.includes(e)||P.current.push(e)}),[]);(0,p.useBreakpointWidth)({name:"creditCardForm",width:D,node:S,className:"small-form"});var I=(0,s.useCallback)((function(e){var n,r=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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,i=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}(t("icons"));try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.id===e)return a.src}}catch(e){r.e(e)}finally{r.f()}return""}),[]);return M?r.createElement("div",{className:"wc-stripe-custom-form ".concat(C),ref:_},(0,s.cloneElement)(M,{postalCodeEnabled:R,options:x,onChange:function(e){return A(e),function(t){if(n(t),"cardNumber"===t.elementType&&("unknown"===t.brand?b(""):b(t.brand)),t.complete){var r=P.current.indexOf(e);if(P.current[r+1]){var a=P.current[r+1];w.getElement(a).focus()}}}},CardIcon:r.createElement(g,{type:h,src:I(h)})})):r.createElement("div",{className:"wc-stripe-custom-form-error"},r.createElement("p",null,(0,l.sprintf)((0,l.__)("%s is not a valid blocks Stripe custom form. Please choose another custom form option in the Credit Card Settings.","woo-stripe-payment"),t("customFormLabels")[C])))}},6835:(e,t,n)=>{var r=n(3027);n(8356);var a=n(1134),o=n(6664),i=n(3163),c=n(3027),s=function(e){var t=e.CardIcon,n=e.options,a=e.onChange;return(0,c.useEffect)((function(){}),[]),r.createElement("div",{className:"wc-stripe-simple-form"},r.createElement("div",{className:"row"},r.createElement("div",{className:"field"},r.createElement("div",{className:"field-item"},r.createElement(o.CardNumberElement,{id:"stripe-card-number",className:"input empty",options:n.cardNumber,onChange:a(o.CardNumberElement)}),r.createElement("label",{htmlFor:"stripe-card-number","data-tid":""},(0,i.__)("Card Number","woo-stripe-payment")),r.createElement("div",{className:"baseline"}),t))),r.createElement("div",{className:"row"},r.createElement("div",{className:"field half-width"},r.createElement("div",{className:"field-item"},r.createElement(o.CardExpiryElement,{id:"stripe-exp",className:"input empty",options:n.cardExpiry,onChange:a(o.CardExpiryElement)}),r.createElement("label",{htmlFor:"stripe-exp","data-tid":""},(0,i.__)("Expiration","woo-stripe-payment")),r.createElement("div",{className:"baseline"}))),r.createElement("div",{className:"field half-width cvc"},r.createElement("div",{className:"field-item"},r.createElement(o.CardCvcElement,{id:"stripe-cvv",className:"input empty",options:n.cardCvc,onChange:a(o.CardCvcElement)}),r.createElement("label",{htmlFor:"stripe-cvv","data-tid":""},(0,i.__)("CVV","woo-stripe-payment")),r.createElement("div",{className:"baseline"})))))};(0,a.registerCreditCardForm)({id:"simple",component:r.createElement(s,null),breakpoint:375})},9775:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(9713)),i=n(6664),c=n(1134),s=n(3027);function u(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.default=function(e){var t=e.getData,n=e.billing,a=e.onChange,o=(0,s.useMemo)((function(){var e;return l(l({},{value:{postalCode:null==n||null===(e=n.billingData)||void 0===e?void 0:e.postcode},hidePostalCode:(0,c.isFieldRequired)("postcode"),iconStyle:"default"}),t("cardOptions"))}),[n.billingData]);return r.createElement("div",{className:"wc-stripe-inline-form"},r.createElement(i.CardElement,{options:o,onChange:a}))}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(5773);var r=n(7205);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))})),n(7354),n(6835)},7205:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=n(3027),c=n(4222),s=n(1134),u=n(6664),l=n(3187),p=a(n(1065)),d=a(n(3329)),f=a(n(9775)),m=n(3636),y=(0,s.getSettings)("stripe_cc_data"),g=function(e){return(0,s.isUserLoggedIn)(e)&&y("saveCardEnabled")&&!(0,s.cartContainsSubscription)()&&!(0,s.cartContainsPreOrder)()},v=function(e){var t=(0,i.useState)(!1),n=(0,o.default)(t,2),a=n[0],c=n[1];if((0,i.useEffect)((function(){s.initStripe.catch((function(e){c(e)}))}),[c]),a)throw new Error(a);return r.createElement(u.Elements,{stripe:s.initStripe},r.createElement(h,e))},h=function(e){var t=e.getData,n=e.billing,a=e.shippingData,c=e.emitResponse,s=e.eventRegistration,p=e.activePaymentMethod,y=(0,m.useStripeError)(),v=(0,o.default)(y,2),h=v[0],b=v[1],P=(0,i.useState)(!1),E=(0,o.default)(P,2),O=E[0],S=E[1],_=s.onPaymentProcessing,w=(0,u.useStripe)(),C=(0,u.useElements)(),k=(0,i.useCallback)((function(){var e=t("customFormActive")?u.CardNumberElement:u.CardElement;return{card:C.getElement(e)}}),[w,C]),M=(0,m.useSetupIntent)({getData:t,cartTotal:n.cartTotal,setError:b}),j=M.setupIntent,D=M.removeSetupIntent;(0,m.useProcessPaymentIntent)({getData:t,billing:n,shippingData:a,emitResponse:c,error:h,onPaymentProcessing:_,savePaymentMethod:O,setupIntent:j,removeSetupIntent:D,getPaymentMethodArgs:k,activePaymentMethod:p}),(0,m.useAfterProcessingPayment)({getData:t,eventRegistration:s,responseTypes:c.responseTypes,activePaymentMethod:p,savePaymentMethod:O});var R=t("customFormActive")?d.default:f.default;return r.createElement("div",{className:"wc-stripe-card-container"},r.createElement(R,{getData:t,billing:n,onChange:function(e){e.error?b(e.error):b(!1)}}),g(n.customerId)&&r.createElement(l.SavePaymentMethod,{label:t("savePaymentMethodLabel"),onChange:function(e){return S(e)},checked:O}))};(0,c.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icons")}),ariaLabel:"Credit Cards",canMakePayment:function(){return s.initStripe},content:r.createElement(l.PaymentMethod,{content:v,getData:y}),savedTokenComponent:r.createElement(p.default,{getData:y}),edit:r.createElement(l.PaymentMethod,{content:v,getData:y}),supports:{showSavedCards:y("showSavedCards"),showSaveOption:!1,features:y("features")}})},7082:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(4575)),i=a(n(3913)),c=a(n(2205)),s=a(n(8585)),u=a(n(9754));var l=function(e){(0,c.default)(l,e);var t,n,a=(t=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,u.default)(t);if(n){var a=(0,u.default)(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return(0,s.default)(this,e)});function l(e){var t;return(0,o.default)(this,l),(t=a.call(this,e)).state={hasError:!1,error:null,errorInfo:null},t}return(0,i.default)(l,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0,error:e,errorInfo:t})}},{key:"render",value:function(){return this.state.hasError?r.createElement(r.Fragment,null,this.state.error&&r.createElement("div",{className:"wc-stripe-block-error"},this.state.error.toString()),this.state.errorInfo&&r.createElement("div",{className:"wc-stripe-block-error"},this.state.errorInfo.componentStack)):this.props.children}}]),l}(n(3027).Component);t.default=l},5212:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(5516),u=n(3636),l=(0,n(1134).getSettings)("stripeGeneralData")().publishableKey;t.default=function(e){var t=e.getData,n=e.setErrorMessage,a=e.billing,p=e.shippingData,d=e.canMakePayment,f=e.checkoutStatus,m=e.eventRegistration,y=e.activePaymentMethod,g=e.onClick,v=e.onClose,h=(0,i.default)(e,["getData","setErrorMessage","billing","shippingData","canMakePayment","checkoutStatus","eventRegistration","activePaymentMethod","onClick","onClose"]),b={merchantId:t("merchantId"),merchantName:t("merchantName")},P=(0,u.useStripeError)(),E=(0,o.default)(P,2),O=E[0],S=(E[1],(0,c.useRef)()),_=h.onSubmit,w=h.emitResponse,C=m.onPaymentProcessing,k=(0,u.useExportedValues)(),M="long"===t("buttonStyle").buttonType?390:300,j=(0,u.useProcessPaymentIntent)({getData:t,billing:a,shippingData:p,onPaymentProcessing:C,emitResponse:w,error:O,exportedValues:k,onSubmit:_,checkoutStatus:f,activePaymentMethod:y}).setPaymentMethod,D=(0,s.usePaymentRequest)({getData:t,publishableKey:l,merchantInfo:b,billing:a,shippingData:p}),R=(0,s.usePaymentsClient)({merchantInfo:b,paymentRequest:D,billing:a,shippingData:p,eventRegistration:m,canMakePayment:d,setErrorMessage:n,onSubmit:_,setPaymentMethod:j,exportedValues:k,onClick:g,onClose:v,getData:t}),x=R.button,A=R.removeButton;return(0,u.useExpressBreakpointWidth)({payment_method:t("name"),width:M}),(0,c.useEffect)((function(){x&&(A(S.current),S.current.append(x))}),[x]),r.createElement("div",{className:"wc-stripe-gpay-button-container",ref:S})}},3097:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BASE_PAYMENT_REQUEST=t.BASE_PAYMENT_METHOD=void 0,t.BASE_PAYMENT_METHOD={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],assuranceDetailsRequired:!0}},t.BASE_PAYMENT_REQUEST={apiVersion:2,apiVersionMinor:0}},5516:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(1674);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(1735);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(9808);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},9808:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useErrorMessage=void 0;var a=r(n(3038)),o=n(3027);t.useErrorMessage=function(){var e=(0,o.useState)(!1),t=(0,a.default)(e,2);return{errorMessage:t[0],setErrorMessage:t[1]}}},1735:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentRequest=void 0;var a=r(n(319)),o=r(n(9713)),i=n(3027),c=n(3097),s=n(1134),u=n(8664);function l(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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentRequest=function(e){var t=e.getData,n=e.publishableKey,r=e.merchantInfo,o=e.billing,l=e.shippingData,d=o.billingData,f=l.shippingRates,m=t(),y=m.processingCountry,g=m.totalPriceLabel;return(0,i.useMemo)((function(){var e=p(p({},{emailRequired:(0,s.isEmpty)(d.email),merchantInfo:r,allowedPaymentMethods:[p(p({},{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":n}}}),c.BASE_PAYMENT_METHOD)],shippingAddressRequired:l.needsShipping,transactionInfo:(0,u.getTransactionInfo)({billing:o,processingCountry:y,totalPriceLabel:g}),callbackIntents:["PAYMENT_AUTHORIZATION"]}),c.BASE_PAYMENT_REQUEST);if(e.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,e.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:(0,s.isFieldRequired)("phone",d.country)&&(0,s.isEmpty)(d.phone)},e.shippingAddressRequired){e.callbackIntents=[].concat((0,a.default)(e.callbackIntents),["SHIPPING_ADDRESS","SHIPPING_OPTION"]),e.shippingOptionRequired=!0;var t=(0,u.getShippingOptionParameters)(f);t.shippingOptions.length>0&&(e=p(p({},e),{},{shippingOptionParameters:t}))}return e}),[o.cartTotal,o.cartTotalItems,d,l])}},1674:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentsClient=void 0;var a=r(n(319)),o=r(n(9713)),i=r(n(7015)),c=r(n(8926)),s=r(n(3038)),u=n(3027),l=r(n(4306)),p=n(1134),d=n(6664),f=n(8664),m=n(3163),y=n(3636);function g(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 v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentsClient=function(e){var t=e.merchantInfo,n=e.paymentRequest,r=e.billing,g=e.shippingData,h=e.eventRegistration,b=e.canMakePayment,P=e.setErrorMessage,E=e.setPaymentMethod,O=e.exportedValues,S=e.onClick,_=e.onClose,w=e.getData,C=w().environment,k=(0,u.useState)(),M=(0,s.default)(k,2),j=M[0],D=M[1],R=(0,u.useState)(null),x=(0,s.default)(R,2),A=x[0],I=x[1],T=(0,u.useRef)(r),L=(0,u.useRef)(g),N=(0,d.useStripe)(),B=(0,y.usePaymentEvents)({billing:r,shippingData:g,eventRegistration:h}).addPaymentEvent;(0,u.useEffect)((function(){T.current=r,L.current=g}));var F=(0,u.useCallback)((function(e){var t,n;if(null!=e&&null!==(t=e.paymentMethodData)&&void 0!==t&&null!==(n=t.info)&&void 0!==n&&n.billingAddress){var r,a=e.paymentMethodData.info.billingAddress;(0,p.isAddressValid)(T.current.billingData,["phone","email"])&&(0,p.isEmpty)(null===(r=T.current.billingData)||void 0===r?void 0:r.phone)&&(a={phoneNumber:a.phoneNumber}),O.billingData=T.current.billingData=(0,f.toCartAddress)(a,{email:e.email})}null!=e&&e.shippingAddress&&(O.shippingAddress=(0,f.toCartAddress)(e.shippingAddress))}),[O,n]),q=(0,u.useCallback)((function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}),[A]),V=(0,u.useCallback)((0,c.default)(i.default.mark((function e(){var t,r,a;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(),e.prev=1,e.next=4,j.loadPaymentData(n);case 4:return t=e.sent,F(t),r=JSON.parse(t.paymentMethodData.tokenizationData.token),e.next=9,N.createPaymentMethod({type:"card",card:{token:r.id},billing_details:(0,p.getBillingDetailsFromAddress)(T.current.billingData)});case 9:if(!(a=e.sent).error){e.next=12;break}throw new p.StripeError(a.error);case 12:E(a.paymentMethod.id),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(1),"CANCELED"===(null===e.t0||void 0===e.t0?void 0:e.t0.statusCode)?_():(console.log((0,p.getErrorMessage)(e.t0)),P((0,p.getErrorMessage)(e.t0)));case 18:case"end":return e.stop()}}),e,null,[[1,15]])}))),[N,j,S]),U=(0,u.useCallback)((0,c.default)(i.default.mark((function e(){return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!j||A||!N){e.next=5;break}return e.next=4,b;case 4:I(j.createButton(v({onClick:V},w("buttonStyle"))));case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),[N,A,j]),W=(0,u.useMemo)((function(){var e={environment:C,merchantInfo:t,paymentDataCallbacks:{onPaymentAuthorized:function(){return Promise.resolve({transactionState:"SUCCESS"})}}};return n.shippingAddressRequired&&(e.paymentDataCallbacks.onPaymentDataChanged=function(e){return new Promise((function(t,n){var r,i=L.current,c=e.shippingAddress,s=e.shippingOptionData,u=(0,f.toCartAddress)(c),d=(0,p.getSelectedShippingOption)(s.id),y=(0,l.default)((0,p.getIntermediateAddress)(i.shippingAddress),u),g=(0,l.default)(i.selectedRates,(0,o.default)({},d[1],d[0]));B("onShippingChanged",(function(e,n){var r=n.billing,a=n.shipping;t(e?(0,f.getPaymentRequestUpdate)({billing:r,shippingData:{needsShipping:!0,shippingRates:a.shippingRates},processingCountry:w("processingCountry"),totalPriceLabel:w("totalPriceLabel")}):{error:{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:(0,m.__)("Your shipping address is not serviceable.","woo-stripe-payment"),intent:"SHIPPING_ADDRESS"}})}),y&&g),L.current.setShippingAddress(v(v({},L.current.shippingAddress),u)),"shipping_option_unselected"!==s.id&&(r=L.current).setSelectedRates.apply(r,(0,a.default)(d))}))}),e}),[n]);return(0,u.useEffect)((function(){D(new google.payments.api.PaymentsClient(W))}),[W]),(0,u.useEffect)((function(){U()}),[U]),{button:A,removeButton:q}}},5341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(9509);var r=n(9031);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}))},9031:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(7154)),i=a(n(6479)),c=a(n(9713)),s=n(4222),u=n(1134),l=n(5516),p=a(n(5212)),d=n(3097),f=a(n(3905)),m=n(6664);function y(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 g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){(0,c.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v,h,b=(0,u.getSettings)("stripe_googlepay_data"),P=(v=new f.default.payments.api.PaymentsClient({environment:b("environment"),merchantInfo:{merchantId:b("merchantId"),merchantName:b("merchantName")}}),h=g(g({},d.BASE_PAYMENT_REQUEST),{},{allowedPaymentMethods:[d.BASE_PAYMENT_METHOD]}),v.isReadyToPay(h).then((function(){return!0})).catch((function(e){return console.log(e),!1}))),E=function(e){var t=e.getData,n=e.components,a=(0,i.default)(e,["getData","components"]),c=n.ValidationInputError,s=(0,l.useErrorMessage)(),d=s.errorMessage,f=s.setErrorMessage;return r.createElement("div",{className:"wc-stripe-gpay-container"},r.createElement(m.Elements,{stripe:u.initStripe},r.createElement(p.default,(0,o.default)({getData:t,canMakePayment:P,setErrorMessage:f},a)),d&&r.createElement(c,{errorMessage:d})))},O=function(e){var t,n=e.getData,a=((0,i.default)(e,["getData"]),n("buttonStyle").buttonType),o=(null===(t=n("editorIcons"))||void 0===t?void 0:t[a])||"long";return r.createElement("div",{className:"gpay-block-editor ".concat(a)},r.createElement("img",{src:o}))};(0,s.registerExpressPaymentMethod)({name:b("name"),canMakePayment:function(){return b("isAdmin")?!(0,u.isCartPage)()||b("cartCheckoutEnabled"):!((0,u.isCartPage)()&&!b("cartCheckoutEnabled"))&&u.initStripe.then((function(e){return e.error?e:P}))},content:r.createElement(E,{getData:b}),edit:r.createElement(O,{getData:b}),supports:{showSavedCards:b("showSavedCards"),showSaveOption:b("showSaveOption"),features:b("features")}})},8664:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.toCartAddress=t.getShippingOptions=t.getShippingOptionParameters=t.getPaymentRequestUpdate=t.getTransactionInfo=void 0;var a=r(n(319)),o=n(1134),i=((0,n(2492).getSetting)("stripeGeneralData"),function(e){var t=e.billing,n=e.processingCountry,r=e.totalPriceLabel,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ESTIMATED",i=t.cartTotal,s=t.cartTotalItems,u=t.currency,l={countryCode:n,currencyCode:u.code,totalPriceStatus:a,totalPrice:(0,o.removeNumberPrecision)(i.value,u.minorUnit).toString(),displayItems:c(s,u.minorUnit),totalPriceLabel:r};return l});t.getTransactionInfo=i,t.getPaymentRequestUpdate=function(e){var t=e.billing,n=e.shippingData,r=e.processingCountry,a=e.totalPriceLabel,o=n.needsShipping,c=n.shippingRates,u={newTransactionInfo:i({billing:t,processingCountry:r,totalPriceLabel:a},"FINAL")};return o&&(u.newShippingOptionParameters=s(c)),u};var c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=[],r=["total_tax","total_shipping"];return e.forEach((function(e){(0<e.value||e.key&&r.includes(e.key))&&n.push({label:e.label,type:"LINE_ITEM",price:(0,o.removeNumberPrecision)(e.value,t).toString()})})),n},s=function(e){var t=u(e),n=t.map((function(e){return e.id})).slice(0,1).shift();return e.forEach((function(e,t){e.shipping_rates.forEach((function(e){e.selected&&(n=(0,o.getShippingOptionId)(t,e.rate_id))}))})),{shippingOptions:t,defaultSelectedOptionId:n}};t.getShippingOptionParameters=s;var u=function(e){var t=[];return e.forEach((function(e,n){var r=e.shipping_rates.map((function(e){var t=document.createElement("textarea");t.innerHTML=e.name;var r=(0,o.formatPrice)(e.price,e.currency_code);return{id:(0,o.getShippingOptionId)(n,e.rate_id),label:t.value,description:"".concat(r)}}));t=[].concat((0,a.default)(t),(0,a.default)(r))})),t};t.getShippingOptions=u;var l=(0,o.toCartAddress)({name:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},countryCode:"country",address1:"address_1",address2:"address_2",locality:"city",administrativeArea:"state",postalCode:"postcode",email:"email",phoneNumber:"phone"});t.toCartAddress=l},3636:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(4332);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(1261);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(6107);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var i=n(2715);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));var c=n(2343);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===c[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}}))}));var s=n(1500);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var u=n(6095);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}));var l=n(5554);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===l[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}}))}));var p=n(3893);Object.keys(p).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===p[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}}))}))},1261:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useAfterProcessingPayment=void 0;var a=r(n(7015)),o=r(n(8926)),i=n(3027),c=n(6664),s=n(1134),u=n(3893);t.useAfterProcessingPayment=function(e){var t=e.getData,n=e.eventRegistration,r=e.responseTypes,l=e.activePaymentMethod,p=e.savePaymentMethod,d=void 0!==p&&p,f=e.messageContext,m=void 0===f?null:f,y=(0,c.useStripe)(),g=n.onCheckoutAfterProcessingWithSuccess,v=n.onCheckoutAfterProcessingWithError;(0,u.useProcessCheckoutError)({responseTypes:r,subscriber:v,messageContext:m}),(0,i.useEffect)((function(){var e=g(function(){var e=(0,o.default)(a.default.mark((function e(n){var o;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.redirectUrl,t("name")!==l){e.next=5;break}return e.next=4,(0,s.handleCardAction)({redirectUrl:o,responseTypes:r,stripe:y,getData:t,savePaymentMethod:d});case 4:return e.abrupt("return",e.sent);case 5:return e.abrupt("return",null);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());return function(){return e()}}),[y,r,g,l,d])}},5554:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useExpressBreakpointWidth=t.useBreakpointWidth=void 0;var a=r(n(3038)),o=n(3027),i=n(1134),c=function(e){var t=e.name,n=e.width,r=e.node,c=e.className,s=(0,o.useState)(window.innerWidth),u=(0,a.default)(s,2),l=u[0],p=u[1],d=(0,o.useCallback)((function(e){var t=(0,i.getFromCache)(e);return t?parseInt(t):0}),[]),f=(0,o.useCallback)((function(e,t){return(0,i.storeInCache)(e,t)}),[]);(0,o.useEffect)((function(){var e="function"==typeof r?r():r;if(e){var a=d(t);(!a||n>a)&&f(t,n),e.clientWidth<n?e.classList.add(c):e.clientWidth>a&&e.classList.remove(c)}}),[l,r]),(0,o.useEffect)((function(){var e=function(){return p(window.innerWidth)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}))};t.useBreakpointWidth=c,t.useExpressBreakpointWidth=function(e){var t=e.payment_method,n=e.width,r=(0,o.useCallback)((function(){var e=document.getElementById("express-payment-method-".concat(t));return e?e.parentNode:null}),[]);c({name:"expressMaxWidth",width:n,node:r,className:"wc-stripe-express__sm"})}},2343:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useExportedValues=void 0;var r=n(3027);t.useExportedValues=function(){return(0,r.useRef)({}).current}},6095:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentEvents=void 0;var a=r(n(9713)),o=r(n(3038)),i=n(3027),c=n(1134);function s(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.usePaymentEvents=function(e){var t=e.billing,n=e.shippingData,r=e.eventRegistration,s=r.onShippingRateSuccess,l=r.onShippingRateFail,p=r.onShippingRateSelectSuccess,d=(0,i.useRef)(t),f=(0,i.useRef)(n),m=(0,i.useState)(null),y=(0,o.default)(m,2),g=y[0],v=y[1],h=(0,i.useState)({onShippingChanged:!1}),b=(0,o.default)(h,2),P=b[0],E=b[1],O=(0,i.useCallback)((function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n?v((0,a.default)({},e,t)):E(u(u({},P),{},(0,a.default)({},e,t)))}),[P,E]),S=(0,i.useCallback)((function(e){P[e]&&(delete P[e],E(P))}),[P]),_=(0,i.useCallback)((function(){var e=f.current,t=d.current;if(P.onShippingChanged&&!e.isSelectingRate&&!e.shippingRatesLoading){var n=P.onShippingChanged,r=!0;(0,c.hasShippingRates)(e.shippingRates)||(r=!1),n(r,{billing:t,shipping:e}),S("onShippingChanged")}}),[P,S]);return(0,i.useEffect)((function(){d.current=t,f.current=n})),(0,i.useEffect)((function(){g&&g.onShippingChanged&&(g.onShippingChanged(!0,{billing:d.current,shipping:f.current}),v(null))}),[g]),(0,i.useEffect)((function(){var e=s(_),t=p(_),n=l((function(e){e.hasInvalidAddress,e.hasError,P.onShippingChanged&&((0,P.onShippingChanged)(!1),S("onShippingChanged"))}));return function(){e(),n(),t()}}),[P,s,l,p]),{addPaymentEvent:O,removePaymentEvent:S}}},1500:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.usePaymentRequest=void 0;var a=r(n(319)),o=r(n(9713)),i=r(n(3038)),c=n(3027),s=n(6095),u=n(1134),l=r(n(4306));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){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f=(0,u.toCartAddress)();t.usePaymentRequest=function(e){var t=e.getData,n=e.onClose,r=e.stripe,o=e.billing,p=e.shippingData,m=e.eventRegistration,y=e.setPaymentMethod,g=e.exportedValues,v=e.canPay,h=(0,s.usePaymentEvents)({billing:o,shippingData:p,eventRegistration:m}).addPaymentEvent,b=p.needsShipping,P=p.shippingRates,E=o.billingData,O=o.cartTotalItems,S=o.currency,_=o.cartTotal,w=(0,c.useState)(null),C=(0,i.default)(w,2),k=C[0],M=C[1],j=(0,c.useRef)({}),D=(0,c.useRef)(p),R=(0,c.useRef)(o);(0,c.useEffect)((function(){D.current=p,R.current=o}),[p]),(0,c.useEffect)((function(){if(r){var e={country:t("countryCode"),currency:null==S?void 0:S.code.toLowerCase(),total:{amount:_.value,label:_.label,pending:!0},requestPayerName:!0,requestPayerEmail:(0,u.isFieldRequired)("email",E.country),requestPayerPhone:(0,u.isFieldRequired)("phone",E.country),requestShipping:b,displayItems:(0,u.getDisplayItems)(O,S)};e.requestShipping&&(e.shippingOptions=(0,u.getShippingOptions)(P)),j.current=e;var n=r.paymentRequest(j.current);n.canMakePayment().then((function(e){v(e)?M(n):M(null)}))}}),[r,E,P,b]),(0,c.useEffect)((function(){k&&(j.current.requestShipping&&(k.on("shippingaddresschange",A),k.on("shippingoptionchange",I)),k.on("cancel",n),k.on("paymentmethod",T))}),[k]);var x=(0,c.useCallback)((function(e){return function(t,n){var r=n.billing,a=n.shipping,o=r.cartTotal,i=r.cartTotalItems,c=r.currency,s=a.shippingRates;t?e.updateWith({status:"success",total:{amount:o.value,label:o.label,pending:!1},displayItems:(0,u.getDisplayItems)(i,c),shippingOptions:(0,u.getShippingOptions)(s)}):e.updateWith({status:"invalid_shipping_address"})}}),[]),A=(0,c.useCallback)((function(e){var t=e.shippingAddress,n=D.current,r=f(t);n.setShippingAddress(d(d({},n.shippingAddress),r));var a=(0,l.default)((0,u.getIntermediateAddress)(n.shippingAddress),r);h("onShippingChanged",x(e),a)}),[h]),I=(0,c.useCallback)((function(e){var t=e.shippingOption,n=D.current;n.setSelectedRates.apply(n,(0,a.default)((0,u.getSelectedShippingOption)(t.id))),h("onShippingChanged",x(e))}),[h]),T=(0,c.useCallback)((function(e){var t=e.paymentMethod,n=e.payerName,r=void 0===n?null:n,a=e.payerEmail,o=void 0===a?null:a,i=e.payerPhone,c={payerName:r,payerEmail:o,payerPhone:void 0===i?null:i};null!=t&&t.billing_details.address&&(c=f(t.billing_details.address,c)),g.billingData=c,e.shippingAddress&&(g.shippingAddress=f(e.shippingAddress)),y(t.id),e.complete("success")}),[y]);return{paymentRequest:k}}},3893:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessCheckoutError=void 0;var r=n(3027);t.useProcessCheckoutError=function(e){var t=e.responseTypes,n=e.subscriber,a=e.messageContext,o=void 0===a?null:a;(0,r.useEffect)((function(){var e=n((function(e){var n;return null!=e&&null!==(n=e.processingResponse.paymentDetails)&&void 0!==n&&n.stripeErrorMessage?{type:t.ERROR,message:e.processingResponse.paymentDetails.stripeErrorMessage,messageContext:o}:null}));return function(){return e()}}),[t,n])}},4332:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPaymentIntent=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(9713)),c=r(n(3038)),s=n(3027),u=n(6664),l=n(1134);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){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useProcessPaymentIntent=function(e){var t=e.getData,n=e.billing,r=e.shippingData,p=e.onPaymentProcessing,f=e.emitResponse,m=e.error,y=e.onSubmit,g=e.activePaymentMethod,v=e.paymentType,h=void 0===v?"card":v,b=e.setupIntent,P=void 0===b?null:b,E=e.removeSetupIntent,O=void 0===E?null:E,S=e.savePaymentMethod,_=void 0!==S&&S,w=e.exportedValues,C=void 0===w?{}:w,k=e.getPaymentMethodArgs,M=void 0===k?function(){return{}}:k,j=n.billingData,D=r.shippingAddress,R=f.responseTypes,x=(0,s.useState)(null),A=(0,c.default)(x,2),I=A[0],T=A[1],L=(0,u.useStripe)(),N=(0,s.useRef)(M);(0,s.useEffect)((function(){N.current=M}),[M]);var B=(0,s.useCallback)((function(){return d(d({},{type:h,billing_details:(0,l.getBillingDetailsFromAddress)(null!=C&&C.billingData?C.billingData:j)}),N.current())}),[j,h,M]),F=(0,s.useCallback)((function(e,n){var r,a={meta:{paymentMethodData:(r={},(0,i.default)(r,"".concat(t("name"),"_token_key"),e),(0,i.default)(r,"".concat(t("name"),"_save_source_key"),n),r)}};return null!=C&&C.billingData&&(a.meta.billingData=C.billingData),null!=C&&C.shippingAddress&&(a.meta.shippingData={address:C.shippingAddress}),a}),[j,D]);return(0,s.useEffect)((function(){I&&"string"==typeof I&&y()}),[I]),(0,s.useEffect)((function(){var e=p((0,o.default)(a.default.mark((function e(){var n,r;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g===t("name")){e.next=2;break}return e.abrupt("return",null);case 2:if(n=null,r=null,e.prev=3,!m){e.next=6;break}throw new l.StripeError(m);case 6:if(!P){e.next=16;break}return e.next=9,L.confirmCardSetup(P.client_secret,{payment_method:B()});case 9:if(!(n=e.sent).error){e.next=12;break}throw new l.StripeError(n.error);case 12:r=n.setupIntent.payment_method,O(),e.next=26;break;case 16:if(!I){e.next=20;break}r=I,e.next=26;break;case 20:return e.next=22,L.createPaymentMethod(B());case 22:if(!(n=e.sent).error){e.next=25;break}throw new l.StripeError(n.error);case 25:r=n.paymentMethod.id;case 26:return e.abrupt("return",(0,l.ensureSuccessResponse)(R,F(r,_)));case 29:return e.prev=29,e.t0=e.catch(3),console.log(e.t0),T(null),e.abrupt("return",(0,l.ensureErrorResponse)(R,e.t0.error));case 34:case"end":return e.stop()}}),e,null,[[3,29]])}))));return function(){return e()}}),[I,j,p,L,P,g,_]),{setPaymentMethod:T}}},6107:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useSetupIntent=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(3038)),c=n(3027),s=r(n(7606)),u=n(1134);t.useSetupIntent=function(e){var t=e.cartTotal,n=e.setError,r=(0,c.useState)((0,u.getFromCache)("setupIntent")),l=(0,i.default)(r,2),p=l[0],d=l[1];(0,c.useEffect)((function(){var e=function(){var e=(0,o.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!p){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,s.default)({url:(0,u.getRoute)("create/setup_intent"),method:"POST"});case 4:(t=e.sent).code?n(t.message):((0,u.storeInCache)("setupIntent",t.intent),d(t.intent));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,u.cartContainsPreOrder)()||(0,u.cartContainsSubscription)()&&0==t.value?p||e():d(null)}),[t.value]);var f=(0,c.useCallback)((function(){(0,u.deleteFromCache)("setupIntent")}),[t.value]);return{setupIntent:p,removeSetupIntent:f}}},2715:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useStripeError=void 0;var a=r(n(3038)),o=n(3027);t.useStripeError=function(){var e=(0,o.useState)(!1),t=(0,a.default)(e,2);return[t[0],t[1]]}},6480:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(6479)),i=a(n(9713)),c=a(n(3038)),s=n(3027),u=n(4222),l=n(1134),p=n(3539),d=n(3187),f=n(6664),m=n(3163);function y(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 g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v,h=(0,l.getSettings)("stripe_afterpay_data"),b=function(e){var t=e.getData,n=(0,s.useState)({amount:t("cartTotal"),currency:t("currency"),isEligible:t("msgOptions").isEligible}),a=(0,c.default)(n,2),o=a[0],i=a[1],u={locale:"auto"};return"GBP"!==o.currency||["fr-FR","it-IT","es-ES"].includes(t("locale"))||(u.locale="en-GB"),v=i,r.createElement(f.Elements,{stripe:l.initStripe,options:u},r.createElement("div",{className:"wc-stripe-blocks-afterpay__label"},r.createElement(f.AfterpayClearpayMessageElement,{options:g(g({},t("msgOptions")),{amount:o.amount,currency:o.currency,isEligible:o.isEligible})})))},P=function(e){var t=e.content,n=e.billing,a=e.shippingData,i=(0,o.default)(e,["content","billing","shippingData"]),c=t,u=n.cartTotal,l=n.currency,p=a.needsShipping;return(0,s.useEffect)((function(){v({amount:u.value,currency:l.code,isEligible:p})}),[u.value,l.code,p]),r.createElement(r.Fragment,null,p&&r.createElement("div",{className:"wc-stripe-blocks-payment-method-content"},r.createElement("div",{className:"wc-stripe-blocks-afterpay-offsite__container"},r.createElement("div",{className:"wc-stripe-blocks-afterpay__offsite"},r.createElement("img",{src:h("offSiteSrc")}),r.createElement("p",null,(0,m.sprintf)((0,m.__)('After clicking "%s", you will be redirected to Afterpay to complete your purchase securely.',"woo-stripe-payment"),h("placeOrderButtonLabel"))))),r.createElement(c,g(g({},i),{},{billing:n,shippingData:a}))))};h()&&(0,u.registerPaymentMethod)({name:h("name"),label:r.createElement(b,{getData:h}),ariaLabel:(0,m.__)("Afterpay","woo-stripe-payment"),placeOrderButtonLabel:h("placeOrderButtonLabel"),canMakePayment:(0,p.canMakePayment)(h,(function(e){var t=e.settings,n=e.billingData,r=e.cartTotals,a=e.cartNeedsShipping,o=n.country,i=r.currency_code,s=t("requiredParams"),u=(0,c.default)(s[i],1)[0];return v&&v({amount:parseInt(r.total_price),currency:i,isEligible:a}),o==u})),content:r.createElement(P,{content:p.LocalPaymentIntentContent,getData:h,confirmationMethod:"confirmAfterpayClearpayPayment"}),edit:r.createElement(d.PaymentMethod,{content:p.LocalPaymentIntentContent,getData:h}),supports:{showSavedCards:!1,showSaveOption:!1,features:h("features")}})},39:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(2029),s=n(3187),u=(0,o.getSettings)("stripe_alipay_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"Alipay",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(s.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:u}),edit:r.createElement(s.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},8641:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_bancontact_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"Bancontact",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},5176:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_becs_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"BECS",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmAuBecsDebitPayment",component:s.AuBankAccountElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},4494:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_eps_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"EPS",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},4031:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_fpx_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"FPX",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmIdealPayment",component:s.FpxBankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},3817:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_giropay_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"Giropay",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},3140:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_grabpay_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"GrabPay",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:s,confirmationMethod:"confirmGrabPayPayment"}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},8522:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(3160);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(3994);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=n(878);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},3160:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useAfterProcessLocalPayment=void 0;var a=r(n(7015)),o=r(n(9713)),i=r(n(6479)),c=r(n(8926)),s=n(3027),u=n(6664),l=n(1134);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){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useAfterProcessLocalPayment=function(e){var t=e.getData,n=e.billingData,r=e.eventRegistration,o=e.responseTypes,p=e.activePaymentMethod,f=e.confirmationMethod,m=e.getPaymentMethodArgs,y=void 0===m?function(){return{}}:m,g=(0,u.useStripe)(),v=r.onCheckoutAfterProcessingWithSuccess,h=r.onCheckoutAfterProcessingWithError,b=(0,s.useRef)(n),P=(0,s.useRef)(y);(0,s.useEffect)((function(){b.current=n}),[n]),(0,s.useEffect)((function(){P.current=y}),[y]),(0,s.useEffect)((function(){var e=v(function(){var e=(0,c.default)(a.default.mark((function e(n){var r,c,s,u,m,y;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.redirectUrl,t("name")!==p){e.next=17;break}if(e.prev=2,!(c=r.match(/#response=(.+)/))){e.next=11;break}return s=JSON.parse(window.atob(decodeURIComponent(c[1]))),u=s.client_secret,m=s.return_url,(0,i.default)(s,["client_secret","return_url"]),e.next=8,g[f](u,{payment_method:d({billing_details:(0,l.getBillingDetailsFromAddress)(b.current)},P.current()),return_url:m});case 8:if(!(y=e.sent).error){e.next=11;break}throw new l.StripeError(y.error);case 11:e.next=17;break;case 13:return e.prev=13,e.t0=e.catch(2),console.log(e.t0),e.abrupt("return",(0,l.ensureErrorResponse)(o,e.t0.error));case 17:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(t){return e.apply(this,arguments)}}());return function(){return e()}}),[g,v,h])}},878:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateSource=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(9713)),c=r(n(3038)),s=n(3027),u=n(1134),l=n(6664),p=n(3163);t.useCreateSource=function(e){var t=e.getData,n=e.billing,r=e.shippingAddress,d=e.onPaymentProcessing,f=e.responseTypes,m=e.getSourceArgs,y=void 0!==m&&m,g=e.element,v=void 0!==g&&g,h=(0,s.useState)(!1),b=(0,c.default)(h,2),P=b[0],E=b[1],O=(0,s.useState)(!1),S=(0,c.default)(O,2),_=S[0],w=S[1],C=(0,s.useRef)({billing:n,shippingAddress:r}),k=(0,l.useStripe)(),M=(0,l.useElements)();(0,s.useEffect)((function(){C.current={billing:n,shippingAddress:r}}));var j=(0,s.useCallback)((function(){var e=C.current.billing,n=e.cartTotal,r=e.currency,a=e.billingData,o=(0,u.getDefaultSourceArgs)({type:t("paymentType"),amount:n.value,billingData:a,currency:r.code,returnUrl:t("returnUrl")});return y&&(o=y(o,{billingData:a})),o}),[]),D=(0,s.useCallback)((function(e){return{meta:{paymentMethodData:(0,i.default)({},"".concat(t("name"),"_token_key"),e)}}}),[]);return(0,s.useEffect)((function(){var e=d((0,o.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=2;break}return e.abrupt("return",(0,u.ensureSuccessResponse)(f,D(P.id)));case 2:if(e.prev=2,!v){e.next=11;break}if(_){e.next=6;break}throw(0,p.__)("Please enter your payment info before proceeding.","woo-stripe-payment");case 6:return e.next=8,k.createSource(M.getElement(v),j());case 8:t=e.sent,e.next=14;break;case 11:return e.next=13,k.createSource(j());case 13:t=e.sent;case 14:if(!t.error){e.next=16;break}throw new u.StripeError(t.error);case 16:return E(t.source),e.abrupt("return",(0,u.ensureSuccessResponse)(f,D(t.source.id)));case 20:return e.prev=20,e.t0=e.catch(2),console.log(e.t0),e.abrupt("return",(0,u.ensureErrorResponse)(f,e.t0.error||e.t0));case 24:case"end":return e.stop()}}),e,null,[[2,20]])}))));return function(){return e()}}),[P,d,k,f,v,_,w]),{setIsValid:w}}},3994:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useValidateCheckout=void 0;var a=r(n(3038)),o=n(3027),i=n(1134),c=n(3163);t.useValidateCheckout=function(e){var t=e.subscriber,n=e.responseTypes,r=e.component,s=void 0===r?null:r,u=e.msg,l=void 0===u?(0,c.__)("Please enter your payment info before proceeding.","woo-stripe-payment"):u,p=(0,o.useState)(!1),d=(0,a.default)(p,2),f=d[0],m=d[1];return(0,o.useEffect)((function(){var e=t((function(){return!(s&&!f)||(0,i.ensureErrorResponse)(n,l)}));return function(){return e()}}),[t,f,m,n,s]),{isValid:f,setIsValid:m}}},9474:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_ideal_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"Ideal",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmIdealPayment",component:s.IdealBankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},9738:(e,t,n)=>{n(7156),n(9474),n(3868),n(8641),n(3817),n(4494),n(4784),n(1192),n(7894),n(3766),n(4031),n(5176),n(3140),n(39),n(6480)},6867:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.KlarnaPaymentCategories=void 0;var o=n(3027),i=a(n(6630));t.KlarnaPaymentCategories=function(e){var t=e.source,n=e.categories,a=e.onChange,o=e.selected;return r.createElement("div",{className:"wc-stripe-blocks-klarna-container"},r.createElement("ul",null,n.map((function(e){return r.createElement(c,{source:t,key:e.type,category:e,onChange:a,selected:o})}))))};var c=function(e){var t=e.source,n=e.category,a=e.selected,c=e.onChange,s=n.type===a;(0,o.useEffect)((function(){Klarna.Payments.load({container:"#klarna-category-".concat(n.type),payment_method_category:n.type})}),[t]);var u={label:n.label,value:n.type,content:r.createElement("div",{id:"klarna-category-".concat(n.type)})};return r.createElement("li",{className:"wc-stripe-blocks-klarna__category",key:n.type},r.createElement(i.default,{option:u,checked:s,onChange:c}))}},6028:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(8092);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var a=n(437);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}))},8092:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useCreateSource=void 0;var a=r(n(7015)),o=r(n(8926)),i=r(n(8)),c=r(n(9713)),s=r(n(3038)),u=n(3027),l=n(6664),p=n(3636),d=n(1134),f=r(n(7606));function m(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 y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){(0,c.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.useCreateSource=function(e){var t=e.getData,n=e.billing,r=e.shippingData,m=(0,l.useStripe)(),g=(0,p.useStripeError)(),v=(0,s.default)(g,2),h=(v[0],v[1]),b=(0,u.useRef)(new AbortController),P=(0,u.useRef)({}),E=(0,u.useRef)({}),O=(0,u.useState)(!1),S=(0,s.default)(O,2),_=S[0],w=S[1],C=(0,u.useState)(!1),k=(0,s.default)(C,2),M=k[0],j=k[1],D=n.billingData,R=n.cartTotal,x=n.cartTotalItems,A=n.currency,I=(0,u.useCallback)((function(e){var t=e.billingData,n=e.shippingData,r=n.needsShipping,a=n.shippingAddress;return!!(0,d.isAddressValid)(t)&&(!r||(0,d.isAddressValid)(a))}),[]),T=(0,u.useCallback)((function(e,t){var n=[];return e.forEach((function(e){n.push({amount:e.value,currency:t,description:e.label,quantity:1})})),n}),[]),L=(0,u.useCallback)((function(e){var n=e.cartTotal,r=e.cartTotalItems,a=e.billingData,o=e.currency,i=e.shippingData,c=a.first_name,s=a.last_name,u=a.country,l=i.needsShipping,p=i.shippingAddress,f=(0,d.getDefaultSourceArgs)({type:t("paymentType"),amount:n.value,billingData:a,currency:o.code,returnUrl:t("returnUrl")});return f=y(y({},f),{source_order:{items:T(r,o.code)},klarna:{locale:t("locale"),product:"payment",purchase_country:u,first_name:c,last_name:s}}),"US"==u&&(f.klarna.custom_payment_methods="payin4,installments"),l&&(f.klarna=y(y({},f.klarna),{shipping_first_name:p.first_name,shipping_last_name:p.last_name}),f.source_order.shipping={address:{city:p.city||"",country:p.country||"",line1:p.address_1||"",line2:p.address_2||"",postal_code:p.postcode||"",state:p.state||""}}),E.current=P.current,P.current=f,f}),[]),N=(0,u.useCallback)((function(e,t){var n=function e(t,n){var r={};if(t&&"object"===(0,i.default)(t)&&!Array.isArray(t))for(var a=0,o=Object.keys(t);a<o.length;a++){var c=o[a];"object"!==(0,i.default)(t[c])||Array.isArray(t[c])?r[c]=n[c]:r[c]=e(t[c],n[c])}else r=t;return r}(e,t);return JSON.stringify(e)==JSON.stringify(n)}),[]),B=(0,u.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(t){var n,r,o,i,s,u,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.billingData,r=t.shippingData,o=t.cartTotal,i=t.cartTotalItems,s=t.currency,u=L({cartTotal:o,cartTotalItems:i,billingData:n,currency:s,shippingData:r}),e.prev=2,e.next=5,m.createSource(u);case 5:if(!(l=e.sent).error){e.next=8;break}throw new d.StripeError(l.error);case 8:(0,d.storeInCache)("klarna:source",(0,c.default)({},s.code,{source:l.source,args:P.current})),j(l.source),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(2),console.log(e.t0),h(e.t0.error);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t){return e.apply(this,arguments)}}(),[m,j]),F=(0,u.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(n){var r,o,i,s,u;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.source,o=n.updates,i=n.currency,s={updates:o,source_id:r.id,client_secret:r.client_secret,payment_method:t("name")},e.prev=2,b.current.abort(),b.current=new AbortController,e.next=7,(0,f.default)({url:(0,d.getRoute)("update/source"),method:"POST",data:s,signal:b.current.signal});case 7:(u=e.sent).source&&((0,d.storeInCache)("klarna:source",(0,c.default)({},i,{source:r,args:P.current})),j(u.source)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(2),console.log("update aborted");case 14:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),[j]);return(0,u.useEffect)((function(){var e;if(!M)if(null!==(e=(0,d.getFromCache)("klarna:source"))&&void 0!==e&&e[A.code]){var t=(0,d.getFromCache)("klarna:source")[A.code],n=t.source,a=t.args;P.current=a,j(n)}else m&&I({billingData:D,shippingData:r})&&(w(!0),B({billingData:D,shippingData:r,cartTotal:R,cartTotalItems:x,currency:A}).then((function(){return w(!1)})))}),[m,null==M?void 0:M.id,B,D,R.value,r,w,x,A.code]),(0,u.useEffect)((function(){if(m&&M){var e=(t=L({billingData:D,cartTotal:R,cartTotalItems:x,currency:A,shippingData:r}),["type","currency","statement_descriptor","redirect","klarna.product","klarna.locale","klarna.custom_payment_methods"].reduce((function(e,t){if(t.indexOf(".")>-1){var n=t.split(".");return delete n.slice(0,n.length-1).reduce((function(e,t){return e[t]}),e)[t=n[n.length-1]],e}return delete e[t],e}),t));N(e,E.current)||F({source:M,updates:e,currency:A.code})}var t}),[null==M?void 0:M.id,D,R.value,x,r,A.code]),{source:M,setSource:j,isLoading:_}}},437:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.useProcessPayment=void 0;var a=r(n(9713)),o=n(3027),i=n(1134),c=n(3163);t.useProcessPayment=function(e){var t=e.payment_method,n=e.source_id,r=e.paymentCategory,s=e.onPaymentProcessing,u=e.responseTypes;(0,o.useEffect)((function(){var e=s((function(){return new Promise((function(e){Klarna.Payments.authorize({payment_method_category:r},(function(r){r.approved?((0,i.deleteFromCache)("klarna:source"),e((0,i.ensureSuccessResponse)(u,{meta:{paymentMethodData:(0,a.default)({},"".concat(t,"_token_key"),n)}}))):e((0,i.ensureErrorResponse)(u,r.error||(0,c.__)("Your purchase is not approved.","woo-stripe-payment")))}))}))}));return function(){return e()}}),[n,r,s])}},7156:(e,t,n)=>{var r=n(3027),a=n(5318)(n(3038)),o=n(3027),i=n(4222),c=n(3163),s=n(3636),u=n(1134),l=n(3187),p=n(3539),d=n(6664),f=n(6867),m=n(8567),y=n(6028);n(1530);var g=(0,u.getSettings)("stripe_klarna_data"),v=function(e){return r.createElement(d.Elements,{stripe:u.initStripe},r.createElement(h,e))},h=function(e){var t=e.getData,n=e.billing,i=e.shippingData,u=e.emitResponse,l=e.eventRegistration,p=u.responseTypes,d=l.onPaymentProcessing,g=l.onCheckoutAfterProcessingWithError,v=(0,o.useState)(""),h=(0,a.default)(v,2),b=h[0],P=h[1],E=(0,o.useState)(!1),O=(0,a.default)(E,2),S=O[0],_=O[1],w=function(e){for(var n=e.klarna.payment_method_categories.split(","),r=[],a=0,o=Object.keys(t("categories"));a<o.length;a++){var i=o[a];n.includes(i)&&r.push({type:i,label:t("categories")[i]})}return r},C=(0,y.useCreateSource)({getData:t,billing:n,shippingData:i}),k=C.source,M=C.isLoading;if((0,y.useProcessPayment)({payment_method:t("name"),source_id:k.id,paymentCategory:b,onPaymentProcessing:d,responseTypes:p}),(0,s.useProcessCheckoutError)({responseTypes:p,subscriber:g}),(0,o.useEffect)((function(){if(!b&&k){var e=w(k);e.length&&P(e.shift().type)}}),[k]),(0,o.useEffect)((function(){k&&(Klarna.Payments.init({client_token:k.klarna.client_token}),_(!0))}),[null==k?void 0:k.id]),k&&S){var j=w(k);return r.createElement(f.KlarnaPaymentCategories,{source:k,categories:j,selected:!b&&j.length>0?j[0].type:b,onChange:P})}return M?r.createElement(m.KlarnaLoader,null):r.createElement("div",{className:"wc-stripe-blocks-klarna__notice"},(0,c.__)("Please fill out all required fields before paying with Klarna.","woo-stripe-payment"))};g()&&(0,i.registerPaymentMethod)({name:g("name"),label:r.createElement(l.PaymentMethodLabel,{title:g("title"),paymentMethod:g("name"),icons:g("icon")}),ariaLabel:"Klarna",placeOrderButtonLabel:g("placeOrderButtonLabel"),canMakePayment:(0,p.canMakePayment)(g,(function(e){var t=e.settings,n=e.billingData,r=e.cartTotals,a=n.country,o=r.currency_code,i=t("requiredParams");return[o]in i&&i[o].includes(a)})),content:r.createElement(l.PaymentMethod,{getData:g,content:v}),edit:r.createElement(l.PaymentMethod,{getData:g,content:v}),supports:{showSavedCards:!1,showSaveOption:!1,features:g("features")}})},8567:(e,t,n)=>{var r=n(3027);Object.defineProperty(t,"__esModule",{value:!0}),t.KlarnaLoader=void 0,t.KlarnaLoader=function(){return r.createElement("div",{className:"wc-stripe-klarna-loader"},r.createElement("div",null),r.createElement("div",null),r.createElement("div",null))}},3539:(e,t,n)=>{var r=n(3027),a=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.LocalPaymentSourceContent=t.LocalPaymentIntentContent=t.canMakePayment=void 0;var o=a(n(9713)),i=a(n(6479)),c=n(3027),s=n(6664),u=n(1134),l=n(8522),p=n(3636);function d(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.canMakePayment=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n){var r=n.billingData,a=n.cartTotals,o=(0,i.default)(n,["billingData","cartTotals"]),c=a.currency_code,s=r.country,l=e("countries"),p=e("allowedCountries"),d=e("features"),m=!1;if(e("isAdmin"))m=!0;else{if((0,u.cartContainsSubscription)()&&!d.includes("subscriptions"))return!1;if((0,u.cartContainsPreOrder)()&&!d.includes("pre-orders"))return!1;e("currencies").includes(c)&&(m="all_except"===p?!e("exceptCountries").includes(s):"specific"===p?e("specificCountries").includes(s):!(l.length>0)||l.includes(s)),t&&m&&(m=t(f({settings:e,billingData:r,cartTotals:a},o)))}return m}},t.LocalPaymentIntentContent=function(e){return r.createElement(s.Elements,{stripe:u.initStripe},r.createElement(y,e))},t.LocalPaymentSourceContent=function(e){return r.createElement(s.Elements,{stripe:u.initStripe},r.createElement(m,e))};var m=function(e){var t=e.getData,n=e.billing,a=e.shippingData,o=e.emitResponse,i=e.eventRegistration,c=e.getSourceArgs,s=void 0!==c&&c,u=e.element,p=void 0!==u&&u,d=a.shippingAddress,f=i.onPaymentProcessing,m=(i.onCheckoutAfterProcessingWithError,o.responseTypes),y=(o.noticeContexts,(0,l.useCreateSource)({getData:t,billing:n,shippingAddress:d,onPaymentProcessing:f,responseTypes:m,getSourceArgs:s,element:p}).setIsValid);return p?r.createElement(g,{name:t("name"),options:t("elementOptions"),onChange:function(e){y(e.complete)},element:p}):null},y=function(e){var t=e.getData,n=e.billing,a=e.emitResponse,i=e.eventRegistration,u=e.activePaymentMethod,d=e.confirmationMethod,f=void 0===d?null:d,m=e.component,y=void 0===m?null:m,v=(0,s.useElements)(),h=n.billingData,b=i.onPaymentProcessing,P=i.onCheckoutAfterProcessingWithError,E=a.responseTypes,O=a.noticeContexts,S=(0,c.useCallback)((function(){return y?(0,o.default)({},t("paymentType"),v.getElement(y)):{}}),[v]),_=(0,l.useValidateCheckout)({subscriber:b,responseTypes:E,component:y}).setIsValid;return(0,l.useAfterProcessLocalPayment)({getData:t,billingData:h,eventRegistration:i,responseTypes:E,activePaymentMethod:u,confirmationMethod:f,getPaymentMethodArgs:S}),(0,p.useProcessCheckoutError)({responseTypes:E,subscriber:P,messageContext:O.PAYMENT}),y?r.createElement(g,{name:t("name"),options:t("elementOptions"),onChange:function(e){return _(!e.empty)},element:y}):null},g=function(e){var t=e.name,n=e.onChange,a=e.element,o=e.options,i=a;return r.createElement("div",{className:"wc-stripe-local-payment-container ".concat(t," ").concat(i.displayName)},r.createElement(i,{options:o,onChange:n}))}},4784:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=(0,o.getSettings)("stripe_multibanco_data");s()&&(0,a.registerPaymentMethod)({name:s("name"),label:r.createElement(c.PaymentMethodLabel,{title:s("title"),paymentMethod:s("name"),icons:s("icon")}),ariaLabel:"MultiBanco",placeOrderButtonLabel:s("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(s),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentSourceContent,getData:s}),supports:{showSavedCards:!1,showSaveOption:!1,features:s("features")}})},3868:(e,t,n)=>{var r=n(3027),a=n(4222),o=n(1134),i=n(3539),c=n(3187),s=n(6664),u=(0,o.getSettings)("stripe_p24_data");u()&&(0,a.registerPaymentMethod)({name:u("name"),label:r.createElement(c.PaymentMethodLabel,{title:u("title"),paymentMethod:u("name"),icons:u("icon")}),ariaLabel:"P24",placeOrderButtonLabel:u("placeOrderButtonLabel"),canMakePayment:(0,i.canMakePayment)(u),content:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u,confirmationMethod:"confirmP24Payment",component:s.P24BankElement}),edit:r.createElement(c.PaymentMethod,{content:i.LocalPaymentIntentContent,getData:u}),supports:{showSavedCards:!1,showSaveOption:!1,features:u("features")}})},1192:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(9713)),i=a(n(6479)),c=n(4222),s=n(1134),u=n(3539),l=n(3187),p=n(6664);function d(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var m,y=(0,s.getSettings)("stripe_sepa_data"),g=(m=l.PaymentMethod,function(e){var t=e.getData,n=(0,i.default)(e,["getData"]);return r.createElement(r.Fragment,null,r.createElement(m,f(f({},n),{},{getData:t})),r.createElement("div",{className:"wc-stripe-blocks-sepa__mandate"},t("mandate")))});y()&&(0,c.registerPaymentMethod)({name:y("name"),label:r.createElement(l.PaymentMethodLabel,{title:y("title"),paymentMethod:y("name"),icons:y("icon")}),ariaLabel:"SEPA",placeOrderButtonLabel:y("placeOrderButtonLabel"),canMakePayment:(0,u.canMakePayment)(y),content:r.createElement(g,{content:u.LocalPaymentSourceContent,getData:y,element:p.IbanElement,getSourceArgs:function(e,t){var n=t.billingData;return e.mandate={notification_method:n.email?"email":"manual",interval:(0,s.cartContainsSubscription)()||(0,s.cartContainsPreOrder)()?"scheduled":"one_time"},"scheduled"===e.mandate.interval&&delete e.amount,e}}),edit:r.createElement(u.LocalPaymentSourceContent,{getData:y}),supports:{showSavedCards:!1,showSaveOption:!1,features:y("features")}})},7894:(e,t,n)=>{var r=n(3027),a=n(5318)(n(9713)),o=n(4222),i=n(1134),c=n(3539),s=n(3187);function u(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=(0,i.getSettings)("stripe_sofort_data");p()&&(0,o.registerPaymentMethod)({name:p("name"),label:r.createElement(s.PaymentMethodLabel,{title:p("title"),paymentMethod:p("name"),icons:p("icon")}),ariaLabel:"Sofort",placeOrderButtonLabel:p("placeOrderButtonLabel"),canMakePayment:(0,c.canMakePayment)(p),content:r.createElement(s.PaymentMethod,{content:c.LocalPaymentSourceContent,getData:p,getSourceArgs:function(e,t){var n=t.billingData;return l(l({},e),{},{sofort:{country:n.country}})}}),edit:r.createElement(s.PaymentMethod,{content:c.LocalPaymentSourceContent,getData:p}),supports:{showSavedCards:!1,showSaveOption:!1,features:p("features")}})},3766:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(7015)),i=a(n(8926)),c=a(n(9713)),s=a(n(3038)),u=n(3027),l=n(4222),p=n(1134),d=n(3187),f=n(3539),m=n(6664),y=n(8522),g=n(3163),v=n(3636),h=(0,p.getSettings)("stripe_wechat_data"),b=function(e){return r.createElement(m.Elements,{stripe:p.initStripe},r.createElement(P,e))},P=function(e){var t=e.getData,n=e.billing,a=(e.shippingData,e.emitResponse),o=e.eventRegistration,i=e.components,c=a.responseTypes,s=o.onPaymentProcessing,l=o.onCheckoutAfterProcessingWithSuccess,d=i.ValidationInputError,f=(0,y.useValidateCheckout)({subscriber:o.onPaymentProcessing,responseTypes:a.responseTypes,msg:(0,g.__)("Please scan your QR code to continue with payment.","woo-stripe-payment")}),m=(f.isValid,f.setIsValid),v=O({getData:t,billing:n,responseTypes:c,subscriber:s}),h=v.source,b=v.error,P=v.deleteSourceFromStorage;return(0,u.useEffect)((function(){var e=l((function(){return P(),(0,p.ensureSuccessResponse)(c)}));return function(){return e()}}),[h,l,P]),(0,u.useEffect)((function(){h&&m(!0)}),[h]),h?r.createElement(E,{text:h.wechat.qr_code_url}):b?r.createElement("div",{className:"wechat-validation-error"},r.createElement(d,{errorMessage:(0,p.getErrorMessage)(b)})):(0,p.isAddressValid)(n.billingData)?null:(0,g.__)("Please fill out all the required fields in order to complete the WeChat payment.","woo-stripe-payment")},E=function(e){var t=e.text,n=e.width,a=void 0===n?128:n,o=e.height,i=void 0===o?128:o,c=e.colorDark,s=void 0===c?"#424770":c,l=e.colorLight,d=void 0===l?"#f8fbfd":l,f=e.correctLevel,m=void 0===f?QRCode.CorrectLevel.H:f,y=(0,u.useRef)();return(0,u.useEffect)((function(){new QRCode(y.current,{text:t,width:a,height:i,colorDark:s,colorLight:d,correctLevel:m})}),[y]),r.createElement(r.Fragment,null,r.createElement("div",{id:"wc-stripe-block-qrcode",ref:y}),(0,p.isTestMode)()&&r.createElement("p",null,(0,g.__)("Test mode: Click the Place Order button to proceed.","woo-stripe-payment")),!(0,p.isTestMode)()&&r.createElement("p",null,(0,g.__)("Scan the QR code using your WeChat app. Once scanned click the Place Order button.","woo-stripe-payment")))},O=function(e){var t=e.getData,n=e.billing,r=e.responseTypes,a=e.subscriber,l=(0,m.useStripe)(),d=(0,v.useStripeError)(),f=(0,s.default)(d,2),y=f[0],g=f[1],h=(0,u.useState)((0,p.getFromCache)("wechat:source")),b=(0,s.default)(h,2),P=b[0],E=b[1],O=(0,u.useRef)(null),S=n.cartTotal,_=n.billingData,w=n.currency;(0,u.useEffect)((function(){var e=a((function(){return(0,p.ensureSuccessResponse)(r,{meta:{paymentMethodData:(0,c.default)({},"".concat(t("name"),"_token_key"),P.id)}})}));return function(){return e()}}),[P,a]);var C=(0,u.useCallback)((0,i.default)(o.default.mark((function e(){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,y||!(0,p.isAddressValid)(_)){e.next=9;break}return e.next=4,l.createSource((0,p.getDefaultSourceArgs)({type:t("paymentType"),amount:S.value,billingData:_,currency:w.code,returnUrl:t("returnUrl")}));case 4:if(!(n=e.sent).error){e.next=7;break}throw new p.StripeError(n.error);case 7:E(n.source),(0,p.storeInCache)("wechat:source",n.source);case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.log("error: ",e.t0),g(e.t0.error);case 15:case"end":return e.stop()}}),e,null,[[0,11]])}))),[l,P,S.value,_,w,y]),k=(0,u.useCallback)((function(){(0,p.deleteFromCache)("wechat:source")}),[]);return(0,u.useEffect)((function(){l&&!P&&(clearTimeout(O.current),O.current=setTimeout(C,1e3))}),[l,P]),{source:P,setSource:E,error:y,deleteSourceFromStorage:k}};h()&&(0,l.registerPaymentMethod)({name:h("name"),label:r.createElement(d.PaymentMethodLabel,{title:h("title"),paymentMethod:h("name"),icons:h("icon")}),ariaLabel:"WeChat",canMakePayment:(0,f.canMakePayment)(h),content:r.createElement(d.PaymentMethod,{content:b,getData:h}),edit:r.createElement(d.PaymentMethod,{content:b,getData:h}),supports:{showSavedCards:!1,showSaveOption:!1,features:h("features")}})},5180:(e,t,n)=>{n(3139),n(3726)},3726:(e,t,n)=>{var r=n(3027),a=n(5318),o=a(n(3038)),i=a(n(6479)),c=n(3027),s=n(4222),u=n(1134),l=n(3636),p=n(6664),d=(0,u.getSettings)("stripe_payment_request_data"),f=function(e){return r.createElement("div",{className:"wc-stripe-payment-request-container"},r.createElement(p.Elements,{stripe:u.initStripe},r.createElement(m,e)))},m=function(e){var t=e.getData,n=e.onClick,a=e.onClose,s=e.billing,u=e.shippingData,d=e.eventRegistration,f=e.emitResponse,m=e.onSubmit,y=e.activePaymentMethod,g=((0,i.default)(e,["getData","onClick","onClose","billing","shippingData","eventRegistration","emitResponse","onSubmit","activePaymentMethod"]),d.onPaymentProcessing),v=f.responseTypes,h=f.noticeContexts,b=(0,p.useStripe)(),P=(0,l.useStripeError)(),E=(0,o.default)(P,1)[0],O=(0,l.useExportedValues)();(0,l.useExpressBreakpointWidth)({payment_method:t("name"),width:300});var S=(0,l.useProcessPaymentIntent)({getData:t,billing:s,shippingData:u,onPaymentProcessing:g,emitResponse:f,error:E,onSubmit:m,activePaymentMethod:y,exportedValues:O}).setPaymentMethod;(0,l.useAfterProcessingPayment)({getData:t,eventRegistration:d,responseTypes:v,activePaymentMethod:y,messageContext:h.EXPRESS_PAYMENTS});var _=(0,l.usePaymentRequest)({getData:t,onClose:a,stripe:b,billing:s,shippingData:u,eventRegistration:d,setPaymentMethod:S,exportedValues:O,canPay:function(e){return null!=e&&!e.applePay}}).paymentRequest,w=(0,c.useMemo)((function(){return{paymentRequest:_,style:{paymentRequestButton:t("paymentRequestButton")}}}),[_]);return _?r.createElement(p.PaymentRequestButtonElement,{options:w,onClick:n}):null},y=function(e){e.getData,(0,i.default)(e,["getData"]);var t=(0,c.useRef)();return(0,c.useEffect)((function(){var e=window.devicePixelRatio;t.current.width=20*e,t.current.height=20*e;var n=t.current.getContext("2d");n.scale(e,e),n.beginPath(),n.arc(10,10,10,0,2*Math.PI),n.fillStyle="#986fff",n.fill()})),r.createElement("div",{className:"payment-request-block-editor"},r.createElement("div",{className:"icon-container"},r.createElement("span",null,"Buy now"),r.createElement("canvas",{className:"PaymentRequestButton-icon",ref:t}),r.createElement("i",{className:"payment-request-arrow"})))};(0,s.registerExpressPaymentMethod)({name:d("name"),canMakePayment:function(e){var t=e.cartTotals;if(d("isAdmin"))return!0;var n=t.currency_code,r=t.total_price;return(0,u.canMakePayment)({country:d("countryCode"),currency:n.toLowerCase(),total:{label:d("totalLabel"),amount:parseInt(r)}},(function(e){return null!=e&&!e.applePay}))},content:r.createElement(f,{getData:d}),edit:r.createElement(y,{getData:d}),supports:{showSavedCards:d("showSavedCards"),showSaveOption:d("showSaveOption"),features:d("features")}})},1065:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(7015)),o=r(n(8926)),i=n(3027),c=n(1134);t.default=function(e){var t=e.eventRegistration,n=e.emitResponse,r=e.getData,s=t.onCheckoutAfterProcessingWithSuccess,u=n.responseTypes,l=(0,i.useCallback)(function(){var e=(0,o.default)(a.default.mark((function e(t){var n,o;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.redirectUrl,e.next=3,c.initStripe;case 3:return o=e.sent,e.next=6,(0,c.handleCardAction)({redirectUrl:n,getData:r,stripe:o,responseTypes:u});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[s]);return(0,i.useEffect)((function(){var e=s(l);return function(){return e()}}),[s]),null}},1134:(e,t,n)=>{var r=n(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.isCheckoutPage=t.isCartPage=t.versionCompare=t.deleteFromCache=t.getFromCache=t.storeInCache=t.isTestMode=t.getDefaultSourceArgs=t.cartContainsSubscription=t.cartContainsPreOrder=t.getLocalPaymentMethods=t.registerLocalPaymentMethod=t.canMakePayment=t.getDisplayItems=t.getShippingOptionId=t.getShippingOptions=t.formatPrice=t.filterEmptyValues=t.getIntermediateAddress=t.toCartAddress=t.handleCardAction=t.isUserLoggedIn=t.hasShippingRates=t.getSelectedShippingOption=t.isFieldRequired=t.getLocaleFields=t.isAddressValid=t.removeNumberPrecision=t.isEmpty=t.StripeError=t.getSettings=t.getBillingDetailsFromAddress=t.getErrorMessage=t.ensureErrorResponse=t.ensureSuccessResponse=t.getRoute=t.getCreditCardForm=t.registerCreditCardForm=t.initStripe=void 0;var a=r(n(319)),o=r(n(7015)),i=r(n(8926)),c=r(n(3038)),s=r(n(8)),u=r(n(4575)),l=r(n(2205)),p=r(n(8585)),d=r(n(9754)),f=r(n(5957)),m=r(n(9713)),y=r(n(6479)),g=n(4465),v=n(2492),h=r(n(7606)),b=n(8419);function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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,i=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}function E(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 O(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 S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){(0,m.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _=(0,v.getSetting)("stripeGeneralData"),w=_.publishableKey,C=_.account,k=(0,v.getSetting)("stripeErrorMessages"),M=(0,v.getSetting)("countryLocale",{}),j=/^([\w]+)\:(.+)$/,D=(0,v.getSetting)("stripeGeneralData").routes,R={},x=[],A={recipient:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},payerName:function(e,t){return e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e},country:"country",addressLine:function(e,t){return t[0]&&(e.address_1=t[0]),t[1]&&(e.address_2=t[1]),e},line1:"address_1",line2:"address_2",city:"city",region:"state",postalCode:"postcode",postal_code:"postcode",payerEmail:"email",payerPhone:"phone"},I=new Promise((function(e,t){(0,g.loadStripe)(w,C?{stripeAccount:C}:{}).then((function(t){e(t)})).catch((function(t){e({error:t})}))}));t.initStripe=I,t.registerCreditCardForm=function(e){var t=e.id,n=(0,y.default)(e,["id"]);R[t]=n},t.getCreditCardForm=function(e){return R[e]};var T=function(e){return null!=D&&D[e]?D[e]:console.log("".concat(e," is not a valid route"))};t.getRoute=T;var L=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S({type:e.SUCCESS},t)};t.ensureSuccessResponse=L;var N=function(e,t){return{type:e.ERROR,message:B(t)}};t.ensureErrorResponse=N;var B=function(e){return"string"==typeof e?e:null!=e&&e.code&&null!=k&&k[e.code]?k[e.code]:null!=e&&e.statusCode?null!=k&&k[e.statusCode]?k[e.statusCode]:e.statusMessage:e.message};t.getErrorMessage=B;var F=function(e){var t={name:"".concat(e.first_name," ").concat(e.last_name),address:{city:e.city||null,country:e.country||null,line1:e.address_1||null,line2:e.address_2||null,postal_code:e.postcode||null,state:e.state||null}};return null!=e&&e.phone&&(t.phone=e.phone),null!=e&&e.email&&(t.email=e.email),t};t.getBillingDetailsFromAddress=F,t.getSettings=function(e){return function(t){return t?(0,v.getSetting)(e)[t]:(0,v.getSetting)(e)}};var q=function(e){(0,l.default)(a,e);var t,n,r=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,d.default)(t);if(n){var a=(0,d.default)(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return(0,p.default)(this,e)});function a(e){var t;return(0,u.default)(this,a),(t=r.call(this,e.message)).error=e,t}return a}((0,f.default)(Error));t.StripeError=q;var V=function(e){return"string"==typeof e?0==e.length||""==e:Array.isArray(e)?0==array.length:"object"!==(0,s.default)(e)||0==Object.keys(e).length};t.isEmpty=V,t.removeNumberPrecision=function(e,t){return e/Math.pow(10,t)},t.isAddressValid=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=U(e.country),r=0,a=Object.entries(e);r<a.length;r++){var o=(0,c.default)(a[r],2),i=o[0],s=o[1];if(!t.includes(i)&&null!=n&&n[i]&&n[i].required&&V(s))return!1}return!0};var U=function(e){var t=S({},M.default);return e&&null!=M&&M[e]&&(t=Object.entries(M[e]).reduce((function(e,t){var n=(0,c.default)(t,2),r=n[0],a=n[1];return e[r]=S(S({},e[r]),a),e}),t),["phone","email"].forEach((function(e){var n=document.getElementById(e);n&&(t[e]={required:n.required})}))),t};t.getLocaleFields=U,t.isFieldRequired=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=U(t);return[e]in n&&n[e].required},t.getSelectedShippingOption=function(e){var t=e.match(j);if(t){var n=t[1];return[t[2],n]}return[]},t.hasShippingRates=function(e){return e.map((function(e){return e.shipping_rates.length>0})).filter(Boolean).length>0},t.isUserLoggedIn=function(e){return e>0};var W=function(){var e=(0,i.default)(o.default.mark((function e(t,n){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.default)({url:D["sync/intent"],method:"POST",data:{order_id:t,client_secret:n}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.log(e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t,n){return e.apply(this,arguments)}}(),Y=function(){var e=(0,i.default)(o.default.mark((function e(t){var n,r,a,i,c,s,u,l,p,d,f,y,g,v;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.redirectUrl,r=t.responseTypes,a=t.stripe,i=t.getData,c=t.savePaymentMethod,s=void 0!==c&&c,e.prev=1,!(u=n.match(/#response=(.+)/))){e.next=20;break}return l=JSON.parse(window.atob(decodeURIComponent(u[1]))),p=l.client_secret,d=l.order_id,f=l.order_key,e.next=7,a.handleCardAction(p);case 7:if(!(y=e.sent).error){e.next=11;break}return W(d,p),e.abrupt("return",N(r,y.error));case 11:return g=(0,m.default)({order_id:d,order_key:f},"".concat(i("name"),"_save_source_key"),s),e.next=14,(0,h.default)({url:T("process/payment"),method:"POST",data:g});case 14:if(!(v=e.sent).messages){e.next=17;break}return e.abrupt("return",N(r,v.messages));case 17:return e.abrupt("return",L(r,{redirectUrl:v.redirect}));case 20:return e.abrupt("return",L(r));case 21:e.next=27;break;case 23:return e.prev=23,e.t0=e.catch(1),console.log(e.t0),e.abrupt("return",N(r,e.t0));case 27:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(t){return e.apply(this,arguments)}}();t.handleCardAction=Y,t.toCartAddress=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};t=S(S({},t),G(n));for(var a=0,o=Object.entries(e);a<o.length;a++){var i,s=(0,c.default)(o[a],2),u=s[0],l=s[1];null!==(i=t)&&void 0!==i&&i[u]&&("function"==typeof l?l(r,t[u]):r[l]=t[u])}return r}},t.getIntermediateAddress=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["city","postcode","state","country"],r={},a=P(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r[o]=e[o]}}catch(e){a.e(e)}finally{a.f()}return r};var G=function(e){return Object.keys(e).filter((function(t){return Boolean(e[t])})).reduce((function(t,n){return S(S({},t),{},(0,m.default)({},n,e[n]))}),{})};t.filterEmptyValues=G;var K=function(e,t){var n=(0,b.getCurrency)(t),r=n.prefix,a=n.suffix,o=n.decimalSeparator,i=n.minorUnit,c=n.thousandSeparator;if(""==e||void 0===e)return e;e="string"==typeof e?parseInt(e,10):e;var s,u=(e=(e/=Math.pow(10,i)).toString().replace(".",o)).indexOf(o);if(u<0)e+="".concat(o).concat(new Array(i+1).join("0"));else{var l=e.substr(u+1);l.length<i&&(e+=new Array(i-l.length+1).join("0"))}var p=e.match(new RegExp("(\\d+)\\".concat(o,"(\\d+)")));return e=p[1],s=p[2],r+(e=(e=e.replace(new RegExp("\\B(?=(\\d{3})+(?!\\d))","g"),"".concat(c)))+o+s)+a};t.formatPrice=K,t.getShippingOptions=function(e){var t=[];return e.forEach((function(e,n){e.shipping_rates.sort((function(e){return e.selected?-1:1}));var r=e.shipping_rates.map((function(e){var t=document.createElement("textarea");return t.innerHTML=e.name,K(e.price,e.currency_code),{id:H(n,e.rate_id),label:t.value,amount:parseInt(e.price,10)}}));t=[].concat((0,a.default)(t),(0,a.default)(r))})),t};var H=function(e,t){return"".concat(e,":").concat(t)};t.getShippingOptionId=H,t.getDisplayItems=function(e,t){t.minorUnit;var n=[],r=["total_tax","total_shipping"];return e.forEach((function(e){(0<e.value||e.key&&r.includes(e.key))&&n.push({label:e.label,pending:!1,amount:e.value})})),n};var z={};t.canMakePayment=function(e,t){var n=e.country,r=e.currency,a=e.total;return new Promise((function(e,o){var i=[n,r,a.amount].reduce((function(e,t){return"".concat(e,"-").concat(t)}));return r?i in z?e(z[i]):I.then((function(c){if(c.error)return o(c.error);c.paymentRequest({country:n,currency:r,total:a}).canMakePayment().then((function(n){return z[i]=t(n),e(z[i])}))})).catch(o):e(!1)}))},t.registerLocalPaymentMethod=function(e){x.push(e)},t.getLocalPaymentMethods=function(){return x},t.cartContainsPreOrder=function(){var e=(0,v.getSetting)("stripePaymentData");return e&&e.pre_order},t.cartContainsSubscription=function(){var e=(0,v.getSetting)("stripePaymentData");return e&&e.subscription},t.getDefaultSourceArgs=function(e){var t=e.type,n=e.amount,r=e.billingData,a=e.currency,o=e.returnUrl;return{type:t,amount:n,currency:a,owner:F(r),redirect:{return_url:o}}},t.isTestMode=function(){return"test"===(0,v.getSetting)("stripeGeneralData").mode};var J=function(e){return"".concat("stripe:").concat(e)};t.storeInCache=function(e,t){var n=Math.floor((new Date).getTime()/1e3)+900;"sessionStorage"in window&&sessionStorage.setItem(J(e),JSON.stringify({value:t,exp:n}))},t.getFromCache=function(e){if("sessionStorage"in window)try{var t=JSON.parse(sessionStorage.getItem(J(e)));if(t){var n=t.value,r=t.exp;if(!(Math.floor((new Date).getTime()/1e3)>r))return n;Q(J(e))}}catch(e){}return null};var Q=function(e){"sessionStorage"in window&&sessionStorage.removeItem(J(e))};t.deleteFromCache=Q,t.versionCompare=function(e,t,n){switch(n){case"<":return e<t;case">":return e>t;case"<=":return e<=t;case">=":return e>=t;case"=":return e==t}return!1},t.isCartPage=function(){return"cart"===(0,v.getSetting)("stripeGeneralData").page},t.isCheckoutPage=function(){return"checkout"===(0,v.getSetting)("stripeGeneralData").page}},4184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)&&n.length){var i=a.apply(null,n);i&&e.push(i)}else if("object"===o)for(var c in n)r.call(n,c)&&n[c]&&e.push(c)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},1127:()=>{},7776:()=>{},4836:()=>{},85:()=>{},3110:()=>{},8356:()=>{},5773:()=>{},9509:()=>{},1530:()=>{},3139:()=>{}}]);
3
  //# sourceMappingURL=commons.js.map
packages/blocks/build/commons.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayLikeToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayWithHoles.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/construct.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/createClass.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/extends.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/getPrototypeOf.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/inherits.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/isNativeFunction.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/iterableToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/nonIterableRest.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/nonIterableSpread.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutProperties.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/slicedToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/toConsumableArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/typeof.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/wrapNativeSuper.js","webpack://wc_stripe.[name]/./node_modules/@stripe/react-stripe-js/dist/react-stripe.umd.js","webpack://wc_stripe.[name]/./node_modules/@stripe/stripe-js/dist/stripe.esm.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/checkbox/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/payment-method-label/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/payment-method/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/radio-control-accordion/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/radio-option/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-create-link-token.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-initialize-plaid.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/applepay/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/applepay/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/bootstrap/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/custom-card-form.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/simple/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/stripe-card-form.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/error-boundary.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/button.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/constants.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-error-message.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payment-request.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payments-client.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/util.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-after-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-breakpoint-width.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-exported-values.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-payment-events.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-payment-request.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-process-checkout-error.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-process-payment-intent.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-setup-intent.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-stripe-error.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/afterpay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/alipay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/bancontact.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/becs.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/eps.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/fpx.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/giropay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/grabpay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-after-process-local-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-create-source.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-validate-checkout.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/ideal.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/categories.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-create-source.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/loader.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/local-payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/multibanco.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/p24.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/sepa.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/sofort.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/wechat.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/payment-request/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/payment-request/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/saved-card-component.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/util.js","webpack://wc_stripe.[name]/./node_modules/classnames/index.js"],"names":["module","exports","arr","len","length","i","arr2","Array","isArray","arrayLikeToArray","self","ReferenceError","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","fn","this","args","arguments","apply","err","undefined","instance","Constructor","TypeError","setPrototypeOf","isNativeReflectConstruct","_construct","Parent","Class","Reflect","construct","a","push","Function","bind","prototype","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","protoProps","staticProps","obj","_extends","assign","source","hasOwnProperty","call","_getPrototypeOf","o","getPrototypeOf","__proto__","subClass","superClass","create","constructor","__esModule","toString","indexOf","sham","Proxy","Date","e","iter","Symbol","iterator","from","_arr","_n","_d","_e","_s","_i","next","objectWithoutPropertiesLoose","excluded","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","sourceKeys","keys","_typeof","assertThisInitialized","_setPrototypeOf","p","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","arrayWithoutHoles","iterableToArray","nonIterableSpread","minLen","n","slice","name","test","isNativeFunction","_wrapNativeSuper","_cache","Map","has","get","set","Wrapper","React","_objectWithoutProperties","_objectWithoutPropertiesLoose","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_arrayLikeToArray","_unsupportedIterableToArray","_nonIterableRest","emptyFunction","emptyFunctionWithReset","resetWarningCache","propTypes","shim","propName","componentName","location","propFullName","secret","Error","getShim","isRequired","ReactPropTypes","array","bool","func","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","factoryWithThrowingShims","isUnknownObject","raw","PLAIN_OBJECT_STR","isEqual","left","right","leftArray","leftPlainObject","leftKeys","rightKeys","keySet","allKeys","l","r","every","usePrevious","ref","useRef","useEffect","current","validateStripe","maybeStripe","elements","createToken","createPaymentMethod","confirmCardPayment","parseStripeProp","isPromise","tag","stripePromise","stripe","ElementsContext","createContext","displayName","Elements","_ref","rawStripeProp","options","children","_final","isMounted","parsed","useMemo","_React$useState2","useState","ctx","setContext","prevStripe","prevOptions","console","warn","anyStripe","_registerWrapper","version","createElement","Provider","useElementsContextWithUseCase","useCaseMessage","useCase","concat","parseElementsContext","useContext","ElementsConsumer","_ref2","useCallbackReference","cb","extractUpdateableOptions","paymentRequest","noop","createElementComponent","type","isServer","str","charAt","toUpperCase","Element","id","className","_ref$options","_ref$onBlur","onBlur","_ref$onFocus","onFocus","_ref$onReady","onReady","_ref$onChange","onChange","_ref$onEscape","onEscape","_ref$onClick","onClick","elementRef","domNode","callOnReady","callOnBlur","callOnFocus","callOnClick","callOnChange","callOnEscape","useLayoutEffect","mount","on","updateableOptions","update","destroy","__elementType","window","AuBankAccountElement","CardElement","CardNumberElement","CardExpiryElement","CardCvcElement","FpxBankElement","IbanElement","IdealBankElement","P24BankElement","EpsBankElement","PaymentRequestButtonElement","AfterpayClearpayMessageElement","useElements","useStripe","factory","V3_URL","V3_URL_REGEX","EXISTING_SCRIPT_MESSAGE","initStripe","startTime","registerWrapper","stripePromise$1","params","Stripe","script","scripts","document","querySelectorAll","src","findScript","queryString","advancedFraudSignals","headOrBody","head","body","appendChild","injectScript","addEventListener","loadCalled","loadStripe","_len","_key","now","label","checked","aria-hidden","xmlns","viewBox","d","title","icons","paymentMethod","components","Label","PaymentMethodLabel","Icons","PaymentMethodIcons","text","align","getData","content","Content","desc","el","childNodes","classList","add","Description","payment_method","RadioControlAccordion","option","RadioControlOption","event","setValidationError","linkToken","setLinkToken","useCallback","url","getRoute","method","data","response","token","storeInCache","getFromCache","linkHandler","resolvePopup","openLinkPopup","open","Plaid","clientName","env","product","selectAccount","countryCodes","onSuccess","publicToken","metaData","onExit","getErrorMessage","error_message","onPaymentProcessing","responseTypes","unsubscribe","result","deleteFromCache","ensureSuccessResponse","meta","paymentMethodData","JSON","stringify","ensureErrorResponse","getSettings","ACHPaymentContent","eventRegistration","emitResponse","onSubmit","onCheckoutAfterProcessingWithError","ValidationInputError","validationError","useCreateLinkToken","useProcessCheckoutError","subscriber","useInitializePlaid","useProcessPayment","isTestMode","ACHTestModeCredentials","errorMessage","__","registerPaymentMethod","ariaLabel","canMakePayment","cartTotals","currency_code","PaymentMethod","savedTokenComponent","edit","placeOrderButtonLabel","supports","showSavedCards","showSaveOption","features","ApplePayContent","ApplePayButton","onClose","billing","shippingData","activePaymentMethod","noticeContexts","useStripeError","exportedValues","useExportedValues","useExpressBreakpointWidth","width","setPaymentMethod","useProcessPaymentIntent","useAfterProcessingPayment","messageContext","EXPRESS_PAYMENTS","usePaymentRequest","canPay","applePay","handleClick","show","style","ApplePayEdit","registerExpressPaymentMethod","currency","total_price","country","toLowerCase","total","amount","parseInt","Bootstrap","CardIcon","htmlFor","registerCreditCardForm","breakpoint","component","classes","focus","empty","invalid","eventChange","innerWidth","cardType","setCardType","elementOrder","container","setContainer","getCreditCardForm","CardForm","postalCodeEnabled","forEach","setElementOrder","includes","useBreakpointWidth","getCardIconSrc","icon","cloneElement","brand","complete","idx","nextElement","getElement","sprintf","SimpleForm","data-tid","cardOptions","postalCode","billingData","postcode","hidePostalCode","isFieldRequired","iconStyle","displaySaveCard","customerId","isUserLoggedIn","cartContainsSubscription","cartContainsPreOrder","CreditCardContent","setError","catch","CreditCardElement","savePaymentMethod","setSavePaymentMethod","getPaymentMethodArgs","elType","card","useSetupIntent","cartTotal","setupIntent","removeSetupIntent","Tag","CustomCardForm","StripeCardForm","SavePaymentMethod","state","hasError","errorInfo","setState","componentStack","Component","publishableKey","setErrorMessage","checkoutStatus","merchantInfo","merchantId","merchantName","buttonContainer","buttonType","usePaymentsClient","button","removeButton","append","parameters","allowedAuthMethods","allowedCardNetworks","assuranceDetailsRequired","apiVersion","apiVersionMinor","shippingRates","shippingAddress","processingCountry","totalPriceLabel","emailRequired","isEmpty","email","allowedPaymentMethods","tokenizationSpecification","gateway","BASE_PAYMENT_METHOD","shippingAddressRequired","needsShipping","transactionInfo","getTransactionInfo","callbackIntents","BASE_PAYMENT_REQUEST","billingAddressRequired","billingAddressParameters","format","phoneNumberRequired","phone","shippingOptionRequired","shippingOptionParameters","getShippingOptionParameters","shippingOptions","cartTotalItems","environment","paymentsClient","setPaymentsClient","setButton","currentBilling","currentShipping","addPaymentEvent","usePaymentEvents","setAddressData","paymentData","billingAddress","isAddressValid","phoneNumber","toCartAddress","parentElement","firstChild","removeChild","loadPaymentData","parse","tokenizationData","billing_details","getBillingDetailsFromAddress","StripeError","statusCode","log","createButton","paymentOptions","paymentDataCallbacks","onPaymentAuthorized","transactionState","onPaymentDataChanged","shipping","address","shippingOptionData","intermediateAddress","selectedRates","getSelectedShippingOption","addressEqual","getIntermediateAddress","shippingEqual","success","getPaymentRequestUpdate","reason","message","intent","setShippingAddress","setSelectedRates","google","payments","api","PaymentsClient","isReadyToPayRequest","isReadyToPay","GooglePayContent","useErrorMessage","GooglePayEdit","isCartPage","status","countryCode","currencyCode","code","totalPriceStatus","totalPrice","removeNumberPrecision","minorUnit","displayItems","getDisplayItems","newTransactionInfo","newShippingOptionParameters","unit","items","item","price","getShippingOptions","defaultSelectedOptionId","map","shift","shippingPackage","shipping_rates","rate","selected","getShippingOptionId","rate_id","rates","txt","innerHTML","formatPrice","description","first_name","split","join","last_name","pop","address1","address2","locality","administrativeArea","onCheckoutAfterProcessingWithSuccess","unsubscribeAfterProcessingWithSuccess","redirectUrl","handleCardAction","windowWidth","setWindowWith","getMaxWidth","maxWidth","setMaxWidth","clientWidth","remove","handleResize","removeEventListener","getElementById","parentNode","onShippingRateSuccess","onShippingRateFail","onShippingRateSelectSuccess","handler","setHandler","onShippingChanged","paymentEvents","setPaymentEvent","execute","removePaymentEvent","isSelectingRate","shippingRatesLoading","hasShippingRates","unsubscribeShippingRateSuccess","unsubscribeShippingRateSelectSuccess","unsubscribeShippingRateFail","hasInvalidAddress","setPaymentRequest","paymentRequestOptions","pending","requestPayerName","requestPayerEmail","requestPayerPhone","requestShipping","onShippingAddressChange","onShippingOptionChange","onPaymentMethodReceived","updatePaymentEvent","updateWith","shippingOption","paymentResponse","payerName","payerEmail","payerPhone","processingResponse","paymentDetails","stripeErrorMessage","ERROR","paymentType","currentPaymentMethodArgs","getCreatePaymentMethodArgs","getSuccessResponse","paymentMethodId","unsubscribeProcessingPayment","confirmCardSetup","client_secret","setSetupIntent","createSetupIntent","variablesHandler","isEligible","variables","setVariables","locale","AfterpayPaymentMethod","settings","cartNeedsShipping","requiredParams","LocalPaymentIntentContent","confirmationMethod","LocalPaymentSourceContent","currentBillingData","match","atob","decodeURIComponent","return_url","getSourceArgs","setSource","isValid","setIsValid","currentValues","getSourceArgsInternal","getDefaultSourceArgs","returnUrl","getSuccessData","sourceId","createSource","msg","categories","category","KlarnaPaymentCategory","Klarna","Payments","load","payment_method_category","abortController","AbortController","currentSourceArgs","oldSourceArgs","isLoading","setIsLoading","isCheckoutValid","getLineItems","quantity","source_order","klarna","purchase_country","custom_payment_methods","shipping_first_name","shipping_last_name","city","line1","address_1","line2","address_2","postal_code","compareSourceArgs","args2","newArgs","getArgs","args1","updateSource","updates","source_id","abort","signal","reduce","k","paymentCategory","authorize","approved","KlarnaContainer","KlarnaPaymentMethod","setSelected","getCategoriesFromSource","paymentMethodCategories","payment_method_categories","useCreateSource","init","client_token","KlarnaPaymentCategories","KlarnaLoader","callback","countries","LocalPaymentIntentMethod","LocalPaymentSourceMethod","LocalPaymentElementContainer","useValidateCheckout","useAfterProcessLocalPayment","PAYMENT","SepaPaymentMethod","mandate","notification_method","interval","sofort","WeChatComponent","WeChatPaymentMethod","deleteSourceFromStorage","QRCodeComponent","wechat","qr_code_url","height","colorDark","colorLight","correctLevel","QRCode","CorrectLevel","H","createSourceTimeoutId","clearTimeout","setTimeout","PaymentRequestContent","PaymentRequestButton","paymentRequestButton","PaymentRequestEdit","canvas","scale","devicePixelRatio","getContext","beginPath","arc","Math","PI","fillStyle","fill","handleSuccessResult","unsubscribeOnCheckoutAfterProcessingWithSuccess","getSetting","account","messages","countryLocale","SHIPPING_OPTION_REGEX","routes","creditCardForms","localPaymentMethods","PAYMENT_REQUEST_ADDRESS_MAPPINGS","recipient","addressLine","region","stripeAccount","route","SUCCESS","statusMessage","exclude","fields","getLocaleFields","entries","required","localeFields","default","field","packageIdx","filter","Boolean","syncPaymentIntentWithOrder","order_id","order_key","redirect","address_mappings","cartAddress","filterEmptyValues","cartKey","values","getCurrency","prefix","suffix","decimalSeparator","thousandSeparator","fractional","index","replace","substr","RegExp","sort","packageId","rateId","cartItems","pre_order","subscription","owner","mode","getCacheKey","exp","floor","getTime","sessionStorage","setItem","getItem","removeItem","page","hasOwn","classNames","argType","inner"],"mappings":";8FAUAA,EAAOC,QAVP,SAA2BC,EAAKC,IACnB,MAAPA,GAAe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,MAAOo3B,EAAOhR,EAAPgR,IACd,KAAI7D,KAAK8D,OAAM,IAAI5zB,MAAO6zB,UAAY,KAAQF,GAG1C,OAAOp3B,EAFPqW,EAAgB8gB,EAAYt3B,KAKtC,MAAOa,IAGb,OAAO,MAGJ,IAAM2V,EAAkB,SAACxW,GACxB,mBAAoB8P,QACpB4nB,eAAeG,WAAWP,EAAYt3B,K,iCAIpB,iBAA+C,UAAzC,IAAAg0B,YAAW,qBAAqB8D,M,iBAElC,iBAA+C,cAAzC,IAAA9D,YAAW,qBAAqB8D,O,aC5epE,OAOC,WACA,aAEA,IAAIC,EAAS,GAAGl1B,eAEhB,SAASm1B,IAGR,IAFA,IAAI7c,EAAU,GAELhc,EAAI,EAAGA,EAAIwB,UAAUzB,OAAQC,IAAK,CAC1C,IAAIc,EAAMU,UAAUxB,GACpB,GAAKc,EAAL,CAEA,IAAIg4B,SAAiBh4B,EAErB,GAAgB,WAAZg4B,GAAoC,WAAZA,EAC3B9c,EAAQzZ,KAAKzB,QACP,GAAIZ,MAAMC,QAAQW,IAAQA,EAAIf,OAAQ,CAC5C,IAAIg5B,EAAQF,EAAWp3B,MAAM,KAAMX,GAC/Bi4B,GACH/c,EAAQzZ,KAAKw2B,QAER,GAAgB,WAAZD,EACV,IAAK,IAAIj4B,KAAOC,EACX83B,EAAOj1B,KAAK7C,EAAKD,IAAQC,EAAID,IAChCmb,EAAQzZ,KAAK1B,IAMjB,OAAOmb,EAAQuM,KAAK,KAGgB5oB,EAAOC,SAC3Ci5B,EAAW1C,QAAU0C,EACrBl5B,EAAOC,QAAUi5B,QAKhB,KAFwB,EAAF,WACtB,OAAOA,GACP,QAFoB,OAEpB,aAxCH,I","file":"commons.js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;","function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;","var _typeof = require(\"@babel/runtime/helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :\n typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :\n (global = global || self, factory(global.ReactStripe = {}, global.React));\n}(this, (function (exports, React) { 'use strict';\n\n React = React && Object.prototype.hasOwnProperty.call(React, 'default') ? React['default'] : React;\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n /**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n var ReactPropTypesSecret_1 = ReactPropTypesSecret;\n\n function emptyFunction() {}\n\n function emptyFunctionWithReset() {}\n\n emptyFunctionWithReset.resetWarningCache = emptyFunction;\n\n var factoryWithThrowingShims = function () {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret_1) {\n // It is still safe when called from React.\n return;\n }\n\n var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');\n err.name = 'Invariant Violation';\n throw err;\n }\n shim.isRequired = shim;\n\n function getShim() {\n return shim;\n }\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n ReactPropTypes.PropTypes = ReactPropTypes;\n return ReactPropTypes;\n };\n\n var propTypes = createCommonjsModule(function (module) {\n /**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = factoryWithThrowingShims();\n }\n });\n\n var isUnknownObject = function isUnknownObject(raw) {\n return raw !== null && _typeof(raw) === 'object';\n };\n var isPromise = function isPromise(raw) {\n return isUnknownObject(raw) && typeof raw.then === 'function';\n }; // We are using types to enforce the `stripe` prop in this lib,\n // but in an untyped integration `stripe` could be anything, so we need\n // to do some sanity validation to prevent type errors.\n\n var isStripe = function isStripe(raw) {\n return isUnknownObject(raw) && typeof raw.elements === 'function' && typeof raw.createToken === 'function' && typeof raw.createPaymentMethod === 'function' && typeof raw.confirmCardPayment === 'function';\n };\n\n var PLAIN_OBJECT_STR = '[object Object]';\n var isEqual = function isEqual(left, right) {\n if (!isUnknownObject(left) || !isUnknownObject(right)) {\n return left === right;\n }\n\n var leftArray = Array.isArray(left);\n var rightArray = Array.isArray(right);\n if (leftArray !== rightArray) return false;\n var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR;\n var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR;\n if (leftPlainObject !== rightPlainObject) return false;\n if (!leftPlainObject && !leftArray) return false;\n var leftKeys = Object.keys(left);\n var rightKeys = Object.keys(right);\n if (leftKeys.length !== rightKeys.length) return false;\n var keySet = {};\n\n for (var i = 0; i < leftKeys.length; i += 1) {\n keySet[leftKeys[i]] = true;\n }\n\n for (var _i = 0; _i < rightKeys.length; _i += 1) {\n keySet[rightKeys[_i]] = true;\n }\n\n var allKeys = Object.keys(keySet);\n\n if (allKeys.length !== leftKeys.length) {\n return false;\n }\n\n var l = left;\n var r = right;\n\n var pred = function pred(key) {\n return isEqual(l[key], r[key]);\n };\n\n return allKeys.every(pred);\n };\n\n var usePrevious = function usePrevious(value) {\n var ref = React.useRef(value);\n React.useEffect(function () {\n ref.current = value;\n }, [value]);\n return ref.current;\n };\n\n var INVALID_STRIPE_ERROR = 'Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.'; // We are using types to enforce the `stripe` prop in this lib, but in a real\n // integration `stripe` could be anything, so we need to do some sanity\n // validation to prevent type errors.\n\n var validateStripe = function validateStripe(maybeStripe) {\n if (maybeStripe === null || isStripe(maybeStripe)) {\n return maybeStripe;\n }\n\n throw new Error(INVALID_STRIPE_ERROR);\n };\n\n var parseStripeProp = function parseStripeProp(raw) {\n if (isPromise(raw)) {\n return {\n tag: 'async',\n stripePromise: Promise.resolve(raw).then(validateStripe)\n };\n }\n\n var stripe = validateStripe(raw);\n\n if (stripe === null) {\n return {\n tag: 'empty'\n };\n }\n\n return {\n tag: 'sync',\n stripe: stripe\n };\n };\n\n var ElementsContext = /*#__PURE__*/React.createContext(null);\n ElementsContext.displayName = 'ElementsContext';\n var parseElementsContext = function parseElementsContext(ctx, useCase) {\n if (!ctx) {\n throw new Error(\"Could not find Elements context; You need to wrap the part of your app that \".concat(useCase, \" in an <Elements> provider.\"));\n }\n\n return ctx;\n };\n /**\n * The `Elements` provider allows you to use [Element components](https://stripe.com/docs/stripe-js/react#element-components) and access the [Stripe object](https://stripe.com/docs/js/initializing) in any nested component.\n * Render an `Elements` provider at the root of your React app so that it is available everywhere you need it.\n *\n * To use the `Elements` provider, call `loadStripe` from `@stripe/stripe-js` with your publishable key.\n * The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.\n * Pass the returned `Promise` to `Elements`.\n *\n * @docs https://stripe.com/docs/stripe-js/react#elements-provider\n */\n\n var Elements = function Elements(_ref) {\n var rawStripeProp = _ref.stripe,\n options = _ref.options,\n children = _ref.children;\n\n var _final = React.useRef(false);\n\n var isMounted = React.useRef(true);\n var parsed = React.useMemo(function () {\n return parseStripeProp(rawStripeProp);\n }, [rawStripeProp]);\n\n var _React$useState = React.useState(function () {\n return {\n stripe: null,\n elements: null\n };\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n ctx = _React$useState2[0],\n setContext = _React$useState2[1];\n\n var prevStripe = usePrevious(rawStripeProp);\n var prevOptions = usePrevious(options);\n\n if (prevStripe !== null) {\n if (prevStripe !== rawStripeProp) {\n console.warn('Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.');\n }\n\n if (!isEqual(options, prevOptions)) {\n console.warn('Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.');\n }\n }\n\n if (!_final.current) {\n if (parsed.tag === 'sync') {\n _final.current = true;\n setContext({\n stripe: parsed.stripe,\n elements: parsed.stripe.elements(options)\n });\n }\n\n if (parsed.tag === 'async') {\n _final.current = true;\n parsed.stripePromise.then(function (stripe) {\n if (stripe && isMounted.current) {\n // Only update Elements context if the component is still mounted\n // and stripe is not null. We allow stripe to be null to make\n // handling SSR easier.\n setContext({\n stripe: stripe,\n elements: stripe.elements(options)\n });\n }\n });\n }\n }\n\n React.useEffect(function () {\n return function () {\n isMounted.current = false;\n };\n }, []);\n React.useEffect(function () {\n var anyStripe = ctx.stripe;\n\n if (!anyStripe || !anyStripe._registerWrapper) {\n return;\n }\n\n anyStripe._registerWrapper({\n name: 'react-stripe-js',\n version: \"1.4.0\"\n });\n }, [ctx.stripe]);\n return /*#__PURE__*/React.createElement(ElementsContext.Provider, {\n value: ctx\n }, children);\n };\n Elements.propTypes = {\n stripe: propTypes.any,\n options: propTypes.object\n };\n var useElementsContextWithUseCase = function useElementsContextWithUseCase(useCaseMessage) {\n var ctx = React.useContext(ElementsContext);\n return parseElementsContext(ctx, useCaseMessage);\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#useelements-hook\n */\n\n var useElements = function useElements() {\n var _useElementsContextWi = useElementsContextWithUseCase('calls useElements()'),\n elements = _useElementsContextWi.elements;\n\n return elements;\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#usestripe-hook\n */\n\n var useStripe = function useStripe() {\n var _useElementsContextWi2 = useElementsContextWithUseCase('calls useStripe()'),\n stripe = _useElementsContextWi2.stripe;\n\n return stripe;\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#elements-consumer\n */\n\n var ElementsConsumer = function ElementsConsumer(_ref2) {\n var children = _ref2.children;\n var ctx = useElementsContextWithUseCase('mounts <ElementsConsumer>'); // Assert to satisfy the busted React.FC return type (it should be ReactNode)\n\n return children(ctx);\n };\n ElementsConsumer.propTypes = {\n children: propTypes.func.isRequired\n };\n\n var useCallbackReference = function useCallbackReference(cb) {\n var ref = React.useRef(cb);\n React.useEffect(function () {\n ref.current = cb;\n }, [cb]);\n return function () {\n if (ref.current) {\n ref.current.apply(ref, arguments);\n }\n };\n };\n\n var extractUpdateableOptions = function extractUpdateableOptions(options) {\n if (!isUnknownObject(options)) {\n return {};\n }\n\n var _ = options.paymentRequest,\n rest = _objectWithoutProperties(options, [\"paymentRequest\"]);\n\n return rest;\n };\n\n var noop = function noop() {};\n\n var capitalized = function capitalized(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n var createElementComponent = function createElementComponent(type, isServer) {\n var displayName = \"\".concat(capitalized(type), \"Element\");\n\n var ClientElement = function ClientElement(_ref) {\n var id = _ref.id,\n className = _ref.className,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n _ref$onBlur = _ref.onBlur,\n onBlur = _ref$onBlur === void 0 ? noop : _ref$onBlur,\n _ref$onFocus = _ref.onFocus,\n onFocus = _ref$onFocus === void 0 ? noop : _ref$onFocus,\n _ref$onReady = _ref.onReady,\n onReady = _ref$onReady === void 0 ? noop : _ref$onReady,\n _ref$onChange = _ref.onChange,\n onChange = _ref$onChange === void 0 ? noop : _ref$onChange,\n _ref$onEscape = _ref.onEscape,\n onEscape = _ref$onEscape === void 0 ? noop : _ref$onEscape,\n _ref$onClick = _ref.onClick,\n onClick = _ref$onClick === void 0 ? noop : _ref$onClick;\n\n var _useElementsContextWi = useElementsContextWithUseCase(\"mounts <\".concat(displayName, \">\")),\n elements = _useElementsContextWi.elements;\n\n var elementRef = React.useRef(null);\n var domNode = React.useRef(null);\n var callOnReady = useCallbackReference(onReady);\n var callOnBlur = useCallbackReference(onBlur);\n var callOnFocus = useCallbackReference(onFocus);\n var callOnClick = useCallbackReference(onClick);\n var callOnChange = useCallbackReference(onChange);\n var callOnEscape = useCallbackReference(onEscape);\n React.useLayoutEffect(function () {\n if (elementRef.current == null && elements && domNode.current != null) {\n var element = elements.create(type, options);\n elementRef.current = element;\n element.mount(domNode.current);\n element.on('ready', function () {\n return callOnReady(element);\n });\n element.on('change', callOnChange);\n element.on('blur', callOnBlur);\n element.on('focus', callOnFocus);\n element.on('escape', callOnEscape); // Users can pass an an onClick prop on any Element component\n // just as they could listen for the `click` event on any Element,\n // but only the PaymentRequestButton will actually trigger the event.\n\n element.on('click', callOnClick);\n }\n });\n var prevOptions = React.useRef(options);\n React.useEffect(function () {\n if (prevOptions.current && prevOptions.current.paymentRequest !== options.paymentRequest) {\n console.warn('Unsupported prop change: options.paymentRequest is not a customizable property.');\n }\n\n var updateableOptions = extractUpdateableOptions(options);\n\n if (Object.keys(updateableOptions).length !== 0 && !isEqual(updateableOptions, extractUpdateableOptions(prevOptions.current))) {\n if (elementRef.current) {\n elementRef.current.update(updateableOptions);\n prevOptions.current = options;\n }\n }\n }, [options]);\n React.useLayoutEffect(function () {\n return function () {\n if (elementRef.current) {\n elementRef.current.destroy();\n }\n };\n }, []);\n return /*#__PURE__*/React.createElement(\"div\", {\n id: id,\n className: className,\n ref: domNode\n });\n }; // Only render the Element wrapper in a server environment.\n\n\n var ServerElement = function ServerElement(props) {\n // Validate that we are in the right context by calling useElementsContextWithUseCase.\n useElementsContextWithUseCase(\"mounts <\".concat(displayName, \">\"));\n var id = props.id,\n className = props.className;\n return /*#__PURE__*/React.createElement(\"div\", {\n id: id,\n className: className\n });\n };\n\n var Element = isServer ? ServerElement : ClientElement;\n Element.propTypes = {\n id: propTypes.string,\n className: propTypes.string,\n onChange: propTypes.func,\n onBlur: propTypes.func,\n onFocus: propTypes.func,\n onReady: propTypes.func,\n onClick: propTypes.func,\n options: propTypes.object\n };\n Element.displayName = displayName;\n Element.__elementType = type;\n return Element;\n };\n\n var isServer = typeof window === 'undefined';\n /**\n * Requires beta access:\n * Contact [Stripe support](https://support.stripe.com/) for more information.\n *\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var AuBankAccountElement = createElementComponent('auBankAccount', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardElement = createElementComponent('card', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardNumberElement = createElementComponent('cardNumber', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardExpiryElement = createElementComponent('cardExpiry', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardCvcElement = createElementComponent('cardCvc', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var FpxBankElement = createElementComponent('fpxBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var IbanElement = createElementComponent('iban', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var IdealBankElement = createElementComponent('idealBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var P24BankElement = createElementComponent('p24Bank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var EpsBankElement = createElementComponent('epsBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var PaymentRequestButtonElement = createElementComponent('paymentRequestButton', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);\n\n exports.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;\n exports.AuBankAccountElement = AuBankAccountElement;\n exports.CardCvcElement = CardCvcElement;\n exports.CardElement = CardElement;\n exports.CardExpiryElement = CardExpiryElement;\n exports.CardNumberElement = CardNumberElement;\n exports.Elements = Elements;\n exports.ElementsConsumer = ElementsConsumer;\n exports.EpsBankElement = EpsBankElement;\n exports.FpxBankElement = FpxBankElement;\n exports.IbanElement = IbanElement;\n exports.IdealBankElement = IdealBankElement;\n exports.P24BankElement = P24BankElement;\n exports.PaymentRequestButtonElement = PaymentRequestButtonElement;\n exports.useElements = useElements;\n exports.useStripe = useStripe;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","var V3_URL = 'https://js.stripe.com/v3';\nvar V3_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/;\nvar EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';\nvar findScript = function findScript() {\n var scripts = document.querySelectorAll(\"script[src^=\\\"\".concat(V3_URL, \"\\\"]\"));\n\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n\n if (!V3_URL_REGEX.test(script.src)) {\n continue;\n }\n\n return script;\n }\n\n return null;\n};\n\nvar injectScript = function injectScript(params) {\n var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';\n var script = document.createElement('script');\n script.src = \"\".concat(V3_URL).concat(queryString);\n var headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');\n }\n\n headOrBody.appendChild(script);\n return script;\n};\n\nvar registerWrapper = function registerWrapper(stripe, startTime) {\n if (!stripe || !stripe._registerWrapper) {\n return;\n }\n\n stripe._registerWrapper({\n name: 'stripe-js',\n version: \"1.12.1\",\n startTime: startTime\n });\n};\n\nvar stripePromise = null;\nvar loadScript = function loadScript(params) {\n // Ensure that we only attempt to load Stripe.js at most once\n if (stripePromise !== null) {\n return stripePromise;\n }\n\n stripePromise = new Promise(function (resolve, reject) {\n if (typeof window === 'undefined') {\n // Resolve to null when imported server side. This makes the module\n // safe to import in an isomorphic code base.\n resolve(null);\n return;\n }\n\n if (window.Stripe && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n }\n\n if (window.Stripe) {\n resolve(window.Stripe);\n return;\n }\n\n try {\n var script = findScript();\n\n if (script && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n } else if (!script) {\n script = injectScript(params);\n }\n\n script.addEventListener('load', function () {\n if (window.Stripe) {\n resolve(window.Stripe);\n } else {\n reject(new Error('Stripe.js not available'));\n }\n });\n script.addEventListener('error', function () {\n reject(new Error('Failed to load Stripe.js'));\n });\n } catch (error) {\n reject(error);\n return;\n }\n });\n return stripePromise;\n};\nvar initStripe = function initStripe(maybeStripe, args, startTime) {\n if (maybeStripe === null) {\n return null;\n }\n\n var stripe = maybeStripe.apply(undefined, args);\n registerWrapper(stripe, startTime);\n return stripe;\n};\n\n// own script injection.\n\nvar stripePromise$1 = Promise.resolve().then(function () {\n return loadScript(null);\n});\nvar loadCalled = false;\nstripePromise$1[\"catch\"](function (err) {\n if (!loadCalled) {\n console.warn(err);\n }\n});\nvar loadStripe = function loadStripe() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n loadCalled = true;\n var startTime = Date.now();\n return stripePromise$1.then(function (maybeStripe) {\n return initStripe(maybeStripe, args, startTime);\n });\n};\n\nexport { loadStripe };\n","import classNames from 'classnames';\r\nimport './styles.scss';\r\n\r\nexport const SavePaymentMethod = ({label, onChange, checked}) => {\r\n return (\r\n <div className='wc-stripe-save-payment-method'>\r\n <label>\r\n <input type='checkbox' onChange={(e) => onChange(e.target.checked)}/>\r\n <svg\r\n className={classNames('wc-stripe-components-checkbox__mark', {checked: checked})}\r\n aria-hidden=\"true\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 20\">\r\n <path d=\"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z\"/>\r\n </svg>\r\n </label>\r\n <span>{label}</span>\r\n </div>\r\n )\r\n}","export * from './payment-method-label';\r\nexport * from './checkbox';\r\nexport * from './radio-option';\r\nexport * from './payment-method';","import './style.scss';\r\n\r\nexport const PaymentMethodLabel = ({title, icons, paymentMethod, ...props}) => {\r\n const {PaymentMethodLabel: Label, PaymentMethodIcons: Icons} = props.components;\r\n if (!Array.isArray(icons)) {\r\n icons = [icons];\r\n }\r\n return (\r\n <span className={`wc-stripe-label-container ${paymentMethod}`}>\r\n <Label text={title}/>\r\n <Icons icons={icons} align='left'/>\r\n </span>\r\n )\r\n}","import {useEffect, useRef} from '@wordpress/element';\r\n\r\nexport const PaymentMethod = ({getData, content, ...props}) => {\r\n const Content = content;\r\n const desc = getData('description');\r\n const el = useRef(null);\r\n useEffect(() => {\r\n if (el.current && el.current.childNodes.length == 0) {\r\n el.current.classList.add('no-content');\r\n }\r\n });\r\n return (\r\n <>\r\n {desc && <Description desc={desc} payment_method={getData('name')}/>}\r\n <div ref={el} className='wc-stripe-blocks-payment-method-content'>\r\n <Content {...{...props, getData}}/>\r\n </div>\r\n </>);\r\n}\r\n\r\nconst Description = ({desc, payment_method}) => {\r\n return (\r\n <div className={`wc-stripe-blocks-payment-method__desc ${payment_method}`}>\r\n <p>{desc}</p>\r\n </div>\r\n )\r\n}","import RadioControlOption from '../radio-option';\r\nimport classnames from 'classnames';\r\n\r\nexport const RadioControlAccordion = ({option, checked, onChange}) => {\r\n const {label, value} = option;\r\n return (\r\n <div className='wc-stripe-blocks-radio-accordion'>\r\n <RadioControlOption checked={checked} onChange={onChange} value={value} label={label}/>\r\n <div\r\n className={classnames('wc-stripe-blocks-radio-accordion__content', {\r\n 'wc-stripe-blocks-radio-accordion__content-visible': checked\r\n })}>\r\n {option.content}\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default RadioControlAccordion;","import classnames from 'classnames';\r\n\r\nexport const RadioControlOption = ({checked, onChange, value, label}) => {\r\n return (\r\n <label\r\n className={classnames('wc-stripe-blocks-radio-control__option', {\r\n 'wc-stripe-blocks-radio-control__option-checked': checked\r\n })}>\r\n <input\r\n className='wc-stripe-blocks-radio-control__input'\r\n type='radio'\r\n value={value}\r\n checked={checked}\r\n onChange={(event) => onChange(event.target.value)}/>\r\n <div className='wc-stripe-blocks-radio-control__label'>\r\n <span>{label}</span>\r\n </div>\r\n </label>\r\n )\r\n}\r\n\r\nexport default RadioControlOption;","export * from './use-create-link-token';\r\nexport * from './use-initialize-plaid';\r\nexport * from './use-process-payment';","import {useEffect, useState, useCallback} from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {getRoute, getFromCache, storeInCache} from '../../util';\r\n\r\nexport const useCreateLinkToken = (\r\n {\r\n setValidationError\r\n }) => {\r\n const [linkToken, setLinkToken] = useState(false);\r\n\r\n const createToken = useCallback(async () => {\r\n try {\r\n const response = await apiFetch({\r\n url: getRoute('create/linkToken'),\r\n method: 'POST',\r\n data: {}\r\n });\r\n if (response.token) {\r\n storeInCache('linkToken', response.token);\r\n setLinkToken(response.token);\r\n }\r\n } catch (err) {\r\n setValidationError(err);\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!linkToken) {\r\n const token = getFromCache('linkToken');\r\n if (token) {\r\n // cached token exist so use it\r\n setLinkToken(token);\r\n } else {\r\n // create the Plaid Link token\r\n createToken();\r\n }\r\n }\r\n }, [\r\n linkToken,\r\n setLinkToken\r\n ]);\r\n return linkToken;\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport Plaid from '@plaid';\r\nimport {getErrorMessage} from \"../../util\";\r\n\r\nexport const useInitializePlaid = (\r\n {\r\n getData,\r\n linkToken\r\n }) => {\r\n const linkHandler = useRef(null);\r\n const resolvePopup = useRef(null);\r\n const openLinkPopup = useCallback(() => new Promise((resolve, reject) => {\r\n resolvePopup.current = {resolve, reject};\r\n linkHandler.current.open();\r\n }), []);\r\n\r\n // if the token exists, initialize Plaid's link handler\r\n useEffect(() => {\r\n if (linkToken) {\r\n linkHandler.current = Plaid.create({\r\n clientName: getData('clientName'),\r\n env: getData('plaidEnvironment'),\r\n product: ['auth'],\r\n token: linkToken,\r\n selectAccount: true,\r\n countryCodes: ['US'],\r\n onSuccess: (publicToken, metaData) => {\r\n resolvePopup.current.resolve({publicToken, metaData});\r\n },\r\n onExit: (err) => {\r\n resolvePopup.current.reject(err ? getErrorMessage(err.error_message) : false);\r\n }\r\n });\r\n }\r\n }, [linkToken]);\r\n\r\n return openLinkPopup;\r\n}","import {useEffect, useCallback} from '@wordpress/element';\r\nimport {ensureSuccessResponse, ensureErrorResponse, deleteFromCache} from \"../../util\";\r\n\r\nexport const useProcessPayment = (\r\n {\r\n openLinkPopup,\r\n onPaymentProcessing,\r\n responseTypes,\r\n paymentMethod\r\n\r\n }) => {\r\n\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(async () => {\r\n try {\r\n // open the Plaid popup\r\n const result = await openLinkPopup();\r\n const {publicToken, metaData} = result;\r\n // remove the cached link token.\r\n deleteFromCache('linkToken');\r\n return ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${paymentMethod}_token_key`]: publicToken,\r\n [`${paymentMethod}_metadata`]: JSON.stringify(metaData)\r\n }\r\n }\r\n });\r\n } catch (err) {\r\n return ensureErrorResponse(responseTypes, err);\r\n }\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n onPaymentProcessing,\r\n responseTypes,\r\n openLinkPopup\r\n ]);\r\n}","import './styles.scss';\r\nimport './payment-method'","import {useState} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, isTestMode} from '../util';\r\nimport {PaymentMethodLabel, PaymentMethod} from '../../components/checkout';\r\nimport SavedCardComponent from '../saved-card-component';\r\nimport {useCreateLinkToken, useInitializePlaid, useProcessPayment} from './hooks';\r\nimport {useProcessCheckoutError} from \"../hooks\";\r\nimport {__} from '@wordpress/i18n';\r\n\r\nconst getData = getSettings('stripe_ach_data');\r\n\r\nconst ACHPaymentContent = (\r\n {\r\n getData,\r\n eventRegistration,\r\n components,\r\n emitResponse,\r\n onSubmit,\r\n ...props\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {ValidationInputError} = components;\r\n const [validationError, setValidationError] = useState(false);\r\n\r\n const linkToken = useCreateLinkToken({setValidationError});\r\n\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError\r\n });\r\n\r\n const openLinkPopup = useInitializePlaid({\r\n getData,\r\n linkToken,\r\n onSubmit\r\n });\r\n\r\n useProcessPayment({\r\n openLinkPopup,\r\n onPaymentProcessing,\r\n responseTypes,\r\n paymentMethod: getData('name')\r\n });\r\n return (\r\n <>\r\n {isTestMode && <ACHTestModeCredentials/>}\r\n {validationError && <ValidationInputError errorMessage={validationError}/>}\r\n </>\r\n )\r\n}\r\n\r\nconst ACHTestModeCredentials = () => {\r\n return (\r\n <div className='wc-stripe-blocks-ach__creds'>\r\n <label className='wc-stripe-blocks-ach__creds-label'>{__('Test Credentials', 'woo-stripe-payment')}</label>\r\n <div className='wc-stripe-blocks-ach__username'>\r\n <div>\r\n <strong>{__('username', 'woo-stripe-payment')}</strong>: user_good\r\n </div>\r\n <div>\r\n <strong>{__('password', 'woo-stripe-payment')}</strong>: pass_good\r\n </div>\r\n <div>\r\n <strong>{__('pin', 'woo-stripe-payment')}</strong>: credential_good\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\nregisterPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icons')}/>,\r\n ariaLabel: 'ACH Payment',\r\n canMakePayment: ({cartTotals}) => cartTotals.currency_code === 'USD',\r\n content: <PaymentMethod\r\n getData={getData}\r\n content={ACHPaymentContent}/>,\r\n savedTokenComponent: <SavedCardComponent getData={getData}/>,\r\n edit: <ACHPaymentContent getData={getData}/>,\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n})","import './style.scss';\r\n\r\nimport './payment-method';","import {useCallback} from '@wordpress/element';\r\nimport {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, canMakePayment} from \"../util\";\r\nimport {Elements, PaymentRequestButtonElement, useStripe} from \"@stripe/react-stripe-js\";\r\nimport ErrorBoundary from \"../error-boundary\";\r\nimport {\r\n usePaymentRequest,\r\n useProcessPaymentIntent,\r\n useExportedValues,\r\n useAfterProcessingPayment,\r\n useStripeError,\r\n useExpressBreakpointWidth\r\n} from '../hooks';\r\n\r\nconst getData = getSettings('stripe_applepay_data');\r\n\r\nconst ApplePayContent = (props) => {\r\n return (\r\n <ErrorBoundary>\r\n <div className='wc-stripe-apple-pay-container'>\r\n <Elements stripe={loadStripe}>\r\n <ApplePayButton {...props}/>\r\n </Elements>\r\n </div>\r\n </ErrorBoundary>\r\n );\r\n}\r\n\r\nconst ApplePayButton = (\r\n {\r\n getData,\r\n onClick,\r\n onClose,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n emitResponse,\r\n onSubmit,\r\n activePaymentMethod,\r\n ...props\r\n }) => {\r\n const {onPaymentProcessing} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const stripe = useStripe();\r\n const [error] = useStripeError();\r\n const canPay = (result) => result != null && result.applePay;\r\n const exportedValues = useExportedValues();\r\n useExpressBreakpointWidth({payment_method: getData('name'), width: 300});\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n exportedValues\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n messageContext: noticeContexts.EXPRESS_PAYMENTS\r\n });\r\n const {paymentRequest} = usePaymentRequest({\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n });\r\n\r\n const handleClick = useCallback(() => {\r\n if (paymentRequest) {\r\n onClick();\r\n paymentRequest.show();\r\n }\r\n }, [paymentRequest]);\r\n\r\n if (paymentRequest) {\r\n return (\r\n <button\r\n className={`apple-pay-button ${getData('buttonStyle')}`}\r\n style={{\r\n '-apple-pay-button-type': getData('buttonType')\r\n }}\r\n onClick={handleClick}/>\r\n\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst ApplePayEdit = ({getData, ...props}) => {\r\n return (\r\n <div className={'apple-pay-block-editor'}>\r\n <img src={getData('editorIcon')}/>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: ({cartTotals, ...props}) => {\r\n if (getData('isAdmin')) {\r\n return true;\r\n }\r\n const {currency_code: currency, total_price} = cartTotals;\r\n return canMakePayment({\r\n country: getData('countryCode'),\r\n currency: currency.toLowerCase(),\r\n total: {\r\n label: getData('totalLabel'),\r\n amount: parseInt(total_price)\r\n }\r\n }, (result) => result != null && result.applePay);\r\n },\r\n content: <ApplePayContent getData={getData}/>,\r\n edit: <ApplePayEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n})","import './style.scss';\r\nimport {registerCreditCardForm} from \"@paymentplugins/stripe/util\";\r\nimport {CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nconst Bootstrap = ({CardIcon, options, onChange}) => {\r\n return (\r\n <div className='wc-stripe-bootstrap-form'>\r\n <div className='row'>\r\n <div className='col-md-6 mb-3'>\r\n <CardNumberElement className='md-form md-outline stripe-input' options={options['cardNumber']}\r\n onChange={onChange(CardNumberElement)}/>\r\n <label htmlFor=\"stripe-card-number\">{__('Card Number', 'woo-stripe-payment')}</label>\r\n {CardIcon}\r\n </div>\r\n <div className='col-md-3 mb-3'>\r\n <CardExpiryElement className='md-form md-outline stripe-input' options={options['cardExpiry']}\r\n onChange={onChange(CardExpiryElement)}/>\r\n <label htmlFor=\"stripe-exp\">{__('Exp', 'woo-stripe-payment')}</label>\r\n </div>\r\n <div className='col-md-3 mb-3'>\r\n <CardCvcElement className=\"md-form md-outline stripe-input\" options={options['cardCvc']}\r\n onChange={onChange(CardCvcElement)}/>\r\n <label htmlFor=\"stripe-cvv\">{__('CVV', 'woo-stripe-payment')}</label>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterCreditCardForm({\r\n id: 'bootstrap',\r\n breakpoint: 475,\r\n component: <Bootstrap/>\r\n})","import {getCreditCardForm} from \"../../util\";\r\nimport {cloneElement, useRef, useCallback, useEffect, useState} from '@wordpress/element';\r\nimport {useElements, CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {sprintf, __} from '@wordpress/i18n';\r\nimport {useBreakpointWidth} from \"../../hooks\";\r\n\r\nconst classes = {\r\n focus: 'focused',\r\n empty: 'empty',\r\n invalid: 'invalid'\r\n}\r\n\r\nconst CustomCardForm = (\r\n {\r\n getData,\r\n onChange: eventChange,\r\n ValidationInputError\r\n }) => {\r\n const [windowSize, setWindowSize] = useState(window.innerWidth);\r\n const [cardType, setCardType] = useState('');\r\n const elementOrder = useRef([]);\r\n const [container, setContainer] = useState(null);\r\n const elements = useElements();\r\n const id = getData('customForm');\r\n const {component: CardForm, breakpoint = 475} = getCreditCardForm(id);\r\n const postalCodeEnabled = getData('postalCodeEnabled');\r\n const options = {};\r\n ['cardNumber', 'cardExpiry', 'cardCvc'].forEach(type => {\r\n options[type] = {\r\n classes,\r\n ...getData('cardOptions'),\r\n ...getData('customFieldOptions')[type],\r\n }\r\n });\r\n const onChange = (element) => {\r\n setElementOrder(element);\r\n return (event) => {\r\n eventChange(event);\r\n if (event.elementType === 'cardNumber') {\r\n if (event.brand === 'unknown') {\r\n setCardType('');\r\n } else {\r\n setCardType(event.brand);\r\n }\r\n }\r\n if (event.complete) {\r\n const idx = elementOrder.current.indexOf(element);\r\n if (elementOrder.current[idx + 1]) {\r\n const nextElement = elementOrder.current[idx + 1];\r\n elements.getElement(nextElement).focus();\r\n }\r\n }\r\n }\r\n }\r\n const setElementOrder = useCallback((element) => {\r\n if (!elementOrder.current.includes(element)) {\r\n elementOrder.current.push(element);\r\n }\r\n }, []);\r\n\r\n useBreakpointWidth({name: 'creditCardForm', width: breakpoint, node: container, className: 'small-form'});\r\n\r\n const getCardIconSrc = useCallback((type) => {\r\n for (let icon of getData('icons')) {\r\n if (icon.id === type) {\r\n return icon.src;\r\n }\r\n }\r\n return '';\r\n }, []);\r\n\r\n if (!CardForm) {\r\n return (\r\n <div className='wc-stripe-custom-form-error'>\r\n <p>{sprintf(__('%s is not a valid blocks Stripe custom form. Please choose another custom form option in the Credit Card Settings.', 'woo-stripe-payment'), getData('customFormLabels')[id])}</p>\r\n </div>\r\n )\r\n }\r\n return (\r\n <div className={`wc-stripe-custom-form ${id}`} ref={setContainer}>\r\n {cloneElement(CardForm, {\r\n postalCodeEnabled,\r\n options,\r\n onChange,\r\n CardIcon: <CardIcon type={cardType} src={getCardIconSrc(cardType)}/>\r\n })}\r\n </div>\r\n )\r\n\r\n}\r\n\r\nconst CardIcon = ({type, src}) => {\r\n if (type) {\r\n return <img className={`wc-stripe-card ${type}`} src={src}/>\r\n }\r\n return null;\r\n}\r\n\r\nexport default CustomCardForm;\r\n","import './style.scss';\r\nimport {registerCreditCardForm} from \"@paymentplugins/stripe/util\";\r\nimport {CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {__} from \"@wordpress/i18n\";\r\nimport {useEffect, useCallback, useRef} from '@wordpress/element';\r\n\r\nconst SimpleForm = ({CardIcon, options, onChange}) => {\r\n useEffect(() => {\r\n }, []);\r\n return (\r\n <div className='wc-stripe-simple-form'>\r\n <div className=\"row\">\r\n <div className=\"field\">\r\n <div className='field-item'>\r\n <CardNumberElement id=\"stripe-card-number\" className=\"input empty\"\r\n options={options['cardNumber']}\r\n onChange={onChange(CardNumberElement)}/>\r\n <label htmlFor=\"stripe-card-number\"\r\n data-tid=\"\">{__('Card Number', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n {CardIcon}\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"row\">\r\n <div className=\"field half-width\">\r\n <div className='field-item'>\r\n <CardExpiryElement id=\"stripe-exp\" className=\"input empty\" options={options['cardExpiry']}\r\n onChange={onChange(CardExpiryElement)}/>\r\n <label htmlFor=\"stripe-exp\"\r\n data-tid=\"\">{__('Expiration', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n </div>\r\n </div>\r\n <div className=\"field half-width cvc\">\r\n <div className='field-item'>\r\n <CardCvcElement id=\"stripe-cvv\" className=\"input empty\" options={options['cardCvc']}\r\n onChange={onChange(CardCvcElement)}/>\r\n <label htmlFor=\"stripe-cvv\"\r\n data-tid=\"\">{__('CVV', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterCreditCardForm({\r\n id: 'simple',\r\n component: <SimpleForm/>,\r\n breakpoint: 375\r\n})","import {CardElement} from \"@stripe/react-stripe-js\";\r\nimport {isFieldRequired} from \"../../util\";\r\nimport {useMemo} from '@wordpress/element';\r\n\r\nconst StripeCardForm = ({getData, billing, onChange}) => {\r\n const cardOptions = useMemo(() => {\r\n return {\r\n ...{\r\n value: {\r\n postalCode: billing?.billingData?.postcode\r\n },\r\n hidePostalCode: isFieldRequired('postcode'),\r\n iconStyle: 'default'\r\n }, ...getData('cardOptions')\r\n };\r\n }, [billing.billingData]);\r\n return (\r\n <div className='wc-stripe-inline-form'>\r\n <CardElement options={cardOptions} onChange={onChange}/>\r\n </div>\r\n )\r\n}\r\n\r\nexport default StripeCardForm;","import './style.scss';\r\n\r\nexport * from './payment-method';\r\n\r\nimport './components/bootstrap';\r\nimport './components/simple';\r\n","import {useEffect, useState, useCallback, useMemo} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {\r\n initStripe as loadStripe,\r\n getSettings,\r\n isUserLoggedIn,\r\n cartContainsSubscription,\r\n cartContainsPreOrder\r\n} from '../util';\r\nimport {Elements, CardElement, useStripe, useElements, CardNumberElement} from '@stripe/react-stripe-js';\r\nimport {PaymentMethodLabel, PaymentMethod, SavePaymentMethod} from '../../components/checkout';\r\nimport SavedCardComponent from '../saved-card-component';\r\nimport CustomCardForm from './components/custom-card-form';\r\nimport StripeCardForm from \"./components/stripe-card-form\";\r\nimport {\r\n useProcessPaymentIntent,\r\n useAfterProcessingPayment,\r\n useSetupIntent,\r\n useStripeError\r\n} from \"../hooks\";\r\n\r\nconst getData = getSettings('stripe_cc_data');\r\n\r\nconst displaySaveCard = (customerId) => {\r\n return isUserLoggedIn(customerId) && getData('saveCardEnabled') &&\r\n !cartContainsSubscription() && !cartContainsPreOrder()\r\n}\r\n\r\nconst CreditCardContent = (props) => {\r\n const [error, setError] = useState(false);\r\n useEffect(() => {\r\n loadStripe.catch(error => {\r\n setError(error);\r\n })\r\n }, [setError]);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <CreditCardElement {...props}/>\r\n </Elements>\r\n );\r\n};\r\n\r\nconst CreditCardElement = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n activePaymentMethod\r\n }) => {\r\n const [error, setError] = useStripeError();\r\n const [savePaymentMethod, setSavePaymentMethod] = useState(false);\r\n const onSavePaymentMethod = (checked) => setSavePaymentMethod(checked);\r\n const {onPaymentProcessing} = eventRegistration;\r\n const stripe = useStripe();\r\n const elements = useElements();\r\n const getPaymentMethodArgs = useCallback(() => {\r\n const elType = getData('customFormActive') ? CardNumberElement : CardElement;\r\n return {card: elements.getElement(elType)};\r\n }, [stripe, elements]);\r\n\r\n const {setupIntent, removeSetupIntent} = useSetupIntent({\r\n getData,\r\n cartTotal: billing.cartTotal,\r\n setError\r\n })\r\n\r\n useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n error,\r\n onPaymentProcessing,\r\n savePaymentMethod,\r\n setupIntent,\r\n removeSetupIntent,\r\n getPaymentMethodArgs,\r\n activePaymentMethod\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes: emitResponse.responseTypes,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n });\r\n\r\n const onChange = (event) => {\r\n if (event.error) {\r\n setError(event.error);\r\n } else {\r\n setError(false);\r\n }\r\n }\r\n const Tag = getData('customFormActive') ? CustomCardForm : StripeCardForm;\r\n return (\r\n <div className='wc-stripe-card-container'>\r\n <Tag {...{getData, billing, onChange}}/>\r\n {displaySaveCard(billing.customerId) &&\r\n <SavePaymentMethod label={getData('savePaymentMethodLabel')}\r\n onChange={onSavePaymentMethod}\r\n checked={savePaymentMethod}/>}\r\n </div>\r\n );\r\n}\r\n\r\nregisterPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icons')}/>,\r\n ariaLabel: 'Credit Cards',\r\n canMakePayment: () => loadStripe,\r\n content: <PaymentMethod content={CreditCardContent} getData={getData}/>,\r\n savedTokenComponent: <SavedCardComponent getData={getData}/>,\r\n edit: <PaymentMethod content={CreditCardContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n})","import {Component} from '@wordpress/element';\r\n\r\nclass ErrorBoundary extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {hasError: false, error: null, errorInfo: null};\r\n }\r\n\r\n componentDidCatch(error, errorInfo) {\r\n this.setState({\r\n hasError: true,\r\n error,\r\n errorInfo\r\n })\r\n }\r\n\r\n render() {\r\n if (this.state.hasError) {\r\n return (\r\n <>\r\n {this.state.error && <div className='wc-stripe-block-error'>{this.state.error.toString()}</div>}\r\n {this.state.errorInfo &&\r\n <div className='wc-stripe-block-error'>{this.state.errorInfo.componentStack}</div>}\r\n </>\r\n )\r\n }\r\n return this.props.children;\r\n }\r\n}\r\n\r\nexport default ErrorBoundary;","import {useRef, useEffect} from '@wordpress/element';\r\nimport {usePaymentsClient, usePaymentRequest} from './hooks';\r\nimport {\r\n useProcessPaymentIntent,\r\n useStripeError,\r\n useExportedValues,\r\n useExpressBreakpointWidth\r\n} from '../hooks';\r\nimport {getSettings} from '@paymentplugins/stripe/util';\r\n\r\nconst {publishableKey} = getSettings('stripeGeneralData')();\r\n\r\nconst GooglePayButton = (\r\n {\r\n getData,\r\n setErrorMessage,\r\n billing,\r\n shippingData,\r\n canMakePayment,\r\n checkoutStatus,\r\n eventRegistration,\r\n activePaymentMethod,\r\n onClick,\r\n onClose,\r\n ...props\r\n }) => {\r\n const merchantInfo = {\r\n merchantId: getData('merchantId'),\r\n merchantName: getData('merchantName')\r\n };\r\n const [error, setError] = useStripeError();\r\n const buttonContainer = useRef();\r\n const {onSubmit, emitResponse} = props;\r\n const {onPaymentProcessing} = eventRegistration;\r\n const exportedValues = useExportedValues();\r\n const width = getData('buttonStyle').buttonType === 'long' ? 390 : 300;\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n exportedValues,\r\n onSubmit,\r\n checkoutStatus,\r\n activePaymentMethod\r\n });\r\n\r\n const paymentRequest = usePaymentRequest({\r\n getData,\r\n publishableKey,\r\n merchantInfo,\r\n billing,\r\n shippingData\r\n })\r\n\r\n const {button, removeButton} = usePaymentsClient({\r\n merchantInfo,\r\n paymentRequest,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n canMakePayment,\r\n setErrorMessage,\r\n onSubmit,\r\n setPaymentMethod,\r\n exportedValues,\r\n onClick,\r\n onClose,\r\n getData\r\n });\r\n\r\n useExpressBreakpointWidth({payment_method: getData('name'), width});\r\n\r\n useEffect(() => {\r\n if (button) {\r\n // prevent button duplicates\r\n removeButton(buttonContainer.current);\r\n buttonContainer.current.append(button);\r\n }\r\n }, [button]);\r\n\r\n return (\r\n <div className='wc-stripe-gpay-button-container' ref={buttonContainer}></div>\r\n )\r\n}\r\n\r\nexport default GooglePayButton;","export const BASE_PAYMENT_METHOD = {\r\n type: 'CARD',\r\n parameters: {\r\n allowedAuthMethods: [\"PAN_ONLY\"],\r\n allowedCardNetworks: [\"AMEX\", \"DISCOVER\", \"INTERAC\", \"JCB\", \"MASTERCARD\", \"VISA\"],\r\n assuranceDetailsRequired: true\r\n }\r\n};\r\n\r\nexport const BASE_PAYMENT_REQUEST = {\r\n apiVersion: 2,\r\n apiVersionMinor: 0\r\n}","export * from './use-payments-client';\r\nexport * from './use-payment-request';\r\nexport * from './use-error-message';","import {useState} from '@wordpress/element';\r\n\r\nexport const useErrorMessage = () => {\r\n const [errorMessage, setErrorMessage] = useState(false);\r\n return {errorMessage, setErrorMessage};\r\n}","import {useState, useEffect, useMemo} from '@wordpress/element';\r\nimport {BASE_PAYMENT_REQUEST, BASE_PAYMENT_METHOD} from \"../constants\";\r\nimport {isEmpty, isFieldRequired} from \"../../util\";\r\nimport {getTransactionInfo, getShippingOptionParameters} from \"../util\";\r\n\r\nexport const usePaymentRequest = ({getData, publishableKey, merchantInfo, billing, shippingData}) => {\r\n const {billingData} = billing;\r\n const {shippingRates, shippingAddress} = shippingData;\r\n const {processingCountry, totalPriceLabel} = getData();\r\n\r\n const paymentRequest = useMemo(() => {\r\n let options = {\r\n ...{\r\n emailRequired: isEmpty(billingData.email),\r\n merchantInfo,\r\n allowedPaymentMethods: [{\r\n ...{\r\n type: 'CARD',\r\n tokenizationSpecification: {\r\n type: \"PAYMENT_GATEWAY\",\r\n parameters: {\r\n gateway: 'stripe',\r\n \"stripe:version\": \"2018-10-31\",\r\n \"stripe:publishableKey\": publishableKey\r\n }\r\n }\r\n }, ...BASE_PAYMENT_METHOD\r\n }],\r\n shippingAddressRequired: shippingData.needsShipping,\r\n transactionInfo: getTransactionInfo({\r\n billing,\r\n processingCountry,\r\n totalPriceLabel\r\n }),\r\n callbackIntents: ['PAYMENT_AUTHORIZATION']\r\n }, ...BASE_PAYMENT_REQUEST\r\n };\r\n options.allowedPaymentMethods[0].parameters.billingAddressRequired = true;\r\n options.allowedPaymentMethods[0].parameters.billingAddressParameters = {\r\n format: 'FULL',\r\n phoneNumberRequired: isFieldRequired('phone', billingData.country) && isEmpty(billingData.phone)\r\n };\r\n if (options.shippingAddressRequired) {\r\n options.callbackIntents = [...options.callbackIntents, ...['SHIPPING_ADDRESS', 'SHIPPING_OPTION']];\r\n options.shippingOptionRequired = true;\r\n const shippingOptionParameters = getShippingOptionParameters(shippingRates);\r\n if (shippingOptionParameters.shippingOptions.length > 0) {\r\n options = {...options, shippingOptionParameters};\r\n }\r\n }\r\n return options;\r\n }, [\r\n billing.cartTotal,\r\n billing.cartTotalItems,\r\n billingData,\r\n shippingData\r\n ]);\r\n return paymentRequest;\r\n}","import {useState, useEffect, useCallback, useMemo, useRef} from '@wordpress/element';\r\nimport isShallowEqual from \"@wordpress/is-shallow-equal\";\r\nimport {\r\n getErrorMessage,\r\n getSelectedShippingOption,\r\n getBillingDetailsFromAddress,\r\n isAddressValid,\r\n isEmpty,\r\n StripeError,\r\n getIntermediateAddress\r\n} from \"../../util\";\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {getPaymentRequestUpdate, toCartAddress} from \"../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\nimport {usePaymentEvents} from \"../../hooks\";\r\n\r\nexport const usePaymentsClient = (\r\n {\r\n merchantInfo,\r\n paymentRequest,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n canMakePayment,\r\n setErrorMessage,\r\n setPaymentMethod,\r\n exportedValues,\r\n onClick,\r\n onClose,\r\n getData\r\n }) => {\r\n const {environment} = getData();\r\n const [paymentsClient, setPaymentsClient] = useState();\r\n const [button, setButton] = useState(null);\r\n const currentBilling = useRef(billing);\r\n const currentShipping = useRef(shippingData);\r\n const stripe = useStripe();\r\n const {addPaymentEvent} = usePaymentEvents({\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n });\r\n useEffect(() => {\r\n currentBilling.current = billing;\r\n currentShipping.current = shippingData;\r\n });\r\n\r\n const setAddressData = useCallback((paymentData) => {\r\n if (paymentData?.paymentMethodData?.info?.billingAddress) {\r\n let billingAddress = paymentData.paymentMethodData.info.billingAddress;\r\n if (isAddressValid(currentBilling.current.billingData, ['phone', 'email']) && isEmpty(currentBilling.current.billingData?.phone)) {\r\n billingAddress = {phoneNumber: billingAddress.phoneNumber};\r\n }\r\n exportedValues.billingData = toCartAddress(billingAddress, {email: paymentData.email});\r\n }\r\n if (paymentData?.shippingAddress) {\r\n exportedValues.shippingAddress = toCartAddress(paymentData.shippingAddress);\r\n }\r\n }, [exportedValues, paymentRequest]);\r\n\r\n const removeButton = useCallback((parentElement) => {\r\n while (parentElement.firstChild) {\r\n parentElement.removeChild(parentElement.firstChild);\r\n }\r\n }, [button]);\r\n const handleClick = useCallback(async () => {\r\n onClick();\r\n try {\r\n let paymentData = await paymentsClient.loadPaymentData(paymentRequest);\r\n const {billingData} = currentBilling.current;\r\n\r\n // set the address data so it can be used during the checkout process\r\n setAddressData(paymentData);\r\n\r\n const data = JSON.parse(paymentData.paymentMethodData.tokenizationData.token);\r\n\r\n let result = await stripe.createPaymentMethod({\r\n type: 'card',\r\n card: {token: data.id},\r\n billing_details: getBillingDetailsFromAddress(billingData)\r\n });\r\n\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n\r\n setPaymentMethod(result.paymentMethod.id);\r\n } catch (err) {\r\n if (err?.statusCode === \"CANCELED\") {\r\n onClose();\r\n } else {\r\n console.log(getErrorMessage(err));\r\n setErrorMessage(getErrorMessage(err));\r\n }\r\n }\r\n }, [\r\n stripe,\r\n paymentsClient,\r\n onClick\r\n ]);\r\n\r\n const createButton = useCallback(async () => {\r\n try {\r\n if (paymentsClient && !button && stripe) {\r\n await canMakePayment;\r\n setButton(paymentsClient.createButton({\r\n onClick: handleClick,\r\n ...getData('buttonStyle')\r\n }));\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }, [\r\n stripe,\r\n button,\r\n paymentsClient\r\n ]);\r\n\r\n const paymentOptions = useMemo(() => {\r\n let options = {\r\n environment,\r\n merchantInfo,\r\n paymentDataCallbacks: {\r\n onPaymentAuthorized: () => Promise.resolve({transactionState: \"SUCCESS\"})\r\n }\r\n }\r\n if (paymentRequest.shippingAddressRequired) {\r\n options.paymentDataCallbacks.onPaymentDataChanged = (paymentData) => {\r\n return new Promise((resolve, reject) => {\r\n const shipping = currentShipping.current;\r\n const {shippingAddress: address, shippingOptionData} = paymentData;\r\n const intermediateAddress = toCartAddress(address);\r\n // pass the Promise resolve to a ref so it persists beyond the re-render\r\n const selectedRates = getSelectedShippingOption(shippingOptionData.id);\r\n const addressEqual = isShallowEqual(getIntermediateAddress(shipping.shippingAddress), intermediateAddress);\r\n const shippingEqual = isShallowEqual(shipping.selectedRates, {\r\n [selectedRates[1]]: selectedRates[0]\r\n });\r\n addPaymentEvent('onShippingChanged', (success, {billing, shipping}) => {\r\n if (success) {\r\n resolve(getPaymentRequestUpdate({\r\n billing,\r\n shippingData: {\r\n needsShipping: true,\r\n shippingRates: shipping.shippingRates\r\n },\r\n processingCountry: getData('processingCountry'),\r\n totalPriceLabel: getData('totalPriceLabel')\r\n }))\r\n } else {\r\n resolve({\r\n error: {\r\n reason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\r\n message: __('Your shipping address is not serviceable.', 'woo-stripe-payment'),\r\n intent: 'SHIPPING_ADDRESS'\r\n }\r\n });\r\n }\r\n }, addressEqual && shippingEqual);\r\n currentShipping.current.setShippingAddress({...currentShipping.current.shippingAddress, ...intermediateAddress});\r\n if (shippingOptionData.id !== 'shipping_option_unselected') {\r\n currentShipping.current.setSelectedRates(...selectedRates);\r\n }\r\n })\r\n }\r\n }\r\n return options;\r\n }, [paymentRequest]);\r\n\r\n useEffect(() => {\r\n setPaymentsClient(new google.payments.api.PaymentsClient(paymentOptions));\r\n }, [paymentOptions]);\r\n\r\n useEffect(() => {\r\n createButton();\r\n }, [createButton])\r\n\r\n return {\r\n button,\r\n removeButton\r\n };\r\n}","import './style.scss';\r\n\r\nexport * from './payment-method';","import {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, isCartPage} from '../util';\r\nimport {useErrorMessage} from \"./hooks\";\r\nimport GooglePayButton from './button';\r\nimport {BASE_PAYMENT_METHOD, BASE_PAYMENT_REQUEST} from './constants';\r\nimport google from '@googlepay';\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_googlepay_data');\r\n\r\nconst canMakePayment = (() => {\r\n const paymentsClient = new google.payments.api.PaymentsClient({\r\n environment: getData('environment'),\r\n merchantInfo: {\r\n merchantId: getData('merchantId'),\r\n merchantName: getData('merchantName')\r\n }\r\n });\r\n const isReadyToPayRequest = {...BASE_PAYMENT_REQUEST, allowedPaymentMethods: [BASE_PAYMENT_METHOD]};\r\n return paymentsClient.isReadyToPay(isReadyToPayRequest).then(() => {\r\n return true;\r\n }).catch(err => {\r\n console.log(err);\r\n return false;\r\n })\r\n})();\r\n\r\nconst GooglePayContent = ({getData, components, ...props}) => {\r\n const {ValidationInputError} = components;\r\n const {errorMessage, setErrorMessage} = useErrorMessage();\r\n return (\r\n <div className='wc-stripe-gpay-container'>\r\n <Elements stripe={loadStripe}>\r\n <GooglePayButton getData={getData}\r\n canMakePayment={canMakePayment}\r\n setErrorMessage={setErrorMessage}\r\n {...props}/>\r\n {errorMessage && <ValidationInputError errorMessage={errorMessage}/>}\r\n </Elements>\r\n </div>\r\n )\r\n}\r\n\r\nconst GooglePayEdit = ({getData, ...props}) => {\r\n const buttonType = getData('buttonStyle').buttonType;\r\n const src = getData('editorIcons')?.[buttonType] || 'long';\r\n return (\r\n <div className={`gpay-block-editor ${buttonType}`}>\r\n <img src={src}/>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: () => {\r\n if (getData('isAdmin')) {\r\n if (isCartPage()) {\r\n return getData('cartCheckoutEnabled');\r\n }\r\n return true;\r\n }\r\n if (isCartPage() && !getData('cartCheckoutEnabled')) {\r\n return false;\r\n }\r\n return loadStripe.then(stripe => {\r\n if (stripe.error) {\r\n return stripe;\r\n }\r\n return canMakePayment;\r\n });\r\n },\r\n content: <GooglePayContent getData={getData}/>,\r\n edit: <GooglePayEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n})","import {getShippingOptionId, removeNumberPrecision, toCartAddress as mapAddressToCartAddress} from \"../util\";\r\nimport {formatPrice} from '../util';\r\n\r\nconst ADDRESS_MAPPINGS = {\r\n name: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n countryCode: 'country',\r\n address1: 'address_1',\r\n address2: 'address_2',\r\n locality: 'city',\r\n administrativeArea: 'state',\r\n postalCode: 'postcode',\r\n email: 'email',\r\n phoneNumber: 'phone'\r\n}\r\n\r\nexport const getTransactionInfo = ({billing, processingCountry, totalPriceLabel}, status = 'ESTIMATED') => {\r\n const {cartTotal, cartTotalItems, currency} = billing;\r\n const transactionInfo = {\r\n countryCode: processingCountry,\r\n currencyCode: currency.code,\r\n totalPriceStatus: status,\r\n totalPrice: removeNumberPrecision(cartTotal.value, currency.minorUnit).toString(),\r\n displayItems: getDisplayItems(cartTotalItems, currency.minorUnit),\r\n totalPriceLabel\r\n }\r\n return transactionInfo;\r\n}\r\n\r\nexport const getPaymentRequestUpdate = ({billing, shippingData, processingCountry, totalPriceLabel}) => {\r\n const {needsShipping, shippingRates} = shippingData;\r\n let update = {\r\n newTransactionInfo: getTransactionInfo({\r\n billing, processingCountry, totalPriceLabel\r\n }, 'FINAL')\r\n }\r\n if (needsShipping) {\r\n update.newShippingOptionParameters = getShippingOptionParameters(shippingRates);\r\n }\r\n return update;\r\n}\r\n\r\n/**\r\n * Return an array of line item objects\r\n * @param cartTotalItems\r\n * @param unit\r\n * @returns {[]}\r\n */\r\nconst getDisplayItems = (cartTotalItems, unit = 2) => {\r\n let items = [];\r\n cartTotalItems.forEach(item => {\r\n /**\r\n * @todo when blocks provides the line item type, we can show\r\n * shipping when it's a $0. We currently filter because there's no\r\n * reason to show things like fees if they're $0 to keep the wallet clean.\r\n */\r\n if (0 < item.value) {\r\n items.push({\r\n label: item.label,\r\n type: 'LINE_ITEM',\r\n price: removeNumberPrecision(item.value, unit).toString()\r\n });\r\n }\r\n })\r\n return items;\r\n}\r\n\r\nexport const getShippingOptionParameters = (shippingRates) => {\r\n const shippingOptions = getShippingOptions(shippingRates);\r\n const shippingOptionIds = shippingOptions.map(option => option.id);\r\n let defaultSelectedOptionId = shippingOptionIds.slice(0, 1).shift();\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n shippingPackage.shipping_rates.forEach(rate => {\r\n if (rate.selected) {\r\n defaultSelectedOptionId = getShippingOptionId(idx, rate.rate_id);\r\n }\r\n });\r\n });\r\n return {\r\n shippingOptions,\r\n defaultSelectedOptionId,\r\n }\r\n}\r\n\r\n//id label description\r\nexport const getShippingOptions = (shippingRates) => {\r\n let options = [];\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n let rates = shippingPackage.shipping_rates.map(rate => {\r\n let txt = document.createElement('textarea');\r\n txt.innerHTML = rate.name;\r\n let price = formatPrice(rate.price, rate.currency_code);\r\n return {\r\n id: getShippingOptionId(idx, rate.rate_id),\r\n label: txt.value,\r\n description: `${price}`\r\n }\r\n });\r\n options = [...options, ...rates];\r\n });\r\n return options;\r\n}\r\n\r\nexport const toCartAddress = mapAddressToCartAddress(ADDRESS_MAPPINGS);\r\n","export * from './use-process-payment-intent';\r\nexport * from './use-after-process-payment';\r\nexport * from './use-setup-intent';\r\nexport * from './use-stripe-error';\r\nexport * from './use-exported-values';\r\nexport * from './use-payment-request';\r\nexport * from './use-payment-events';\r\nexport * from './use-breakpoint-width';\r\nexport * from './use-process-checkout-error'","import {useEffect} from '@wordpress/element'\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {handleCardAction} from \"../util\";\r\nimport {useProcessCheckoutError} from \"./use-process-checkout-error\";\r\n\r\nexport const useAfterProcessingPayment = (\r\n {\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n savePaymentMethod = false,\r\n messageContext = null\r\n }) => {\r\n const stripe = useStripe();\r\n const {onCheckoutAfterProcessingWithSuccess, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError,\r\n messageContext\r\n });\r\n useEffect(() => {\r\n let unsubscribeAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(async ({redirectUrl}) => {\r\n if (getData('name') === activePaymentMethod) {\r\n //check if response is in redirect. If so, open modal\r\n return await handleCardAction({\r\n redirectUrl,\r\n responseTypes,\r\n stripe,\r\n getData,\r\n savePaymentMethod\r\n });\r\n }\r\n return null;\r\n })\r\n return () => unsubscribeAfterProcessingWithSuccess()\r\n }, [\r\n stripe,\r\n responseTypes,\r\n onCheckoutAfterProcessingWithSuccess,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n ]);\r\n}","import {useState, useEffect, useCallback} from '@wordpress/element';\r\nimport {storeInCache, getFromCache} from \"../util\";\r\n\r\nexport const useBreakpointWidth = (\r\n {\r\n name,\r\n width,\r\n node,\r\n className\r\n }) => {\r\n const [windowWidth, setWindowWith] = useState(window.innerWidth);\r\n const getMaxWidth = useCallback((name) => {\r\n const maxWidth = getFromCache(name);\r\n return maxWidth ? parseInt(maxWidth) : 0;\r\n }, []);\r\n const setMaxWidth = useCallback((name, width) => storeInCache(name, width), []);\r\n\r\n useEffect(() => {\r\n const el = typeof node === 'function' ? node() : node;\r\n\r\n if (el) {\r\n const maxWidth = getMaxWidth(name);\r\n if (!maxWidth || width > maxWidth) {\r\n setMaxWidth(name, width);\r\n }\r\n if (el.clientWidth < width) {\r\n el.classList.add(className);\r\n } else {\r\n if (el.clientWidth > maxWidth) {\r\n el.classList.remove(className);\r\n }\r\n }\r\n }\r\n }, [windowWidth, node]);\r\n useEffect(() => {\r\n const handleResize = () => setWindowWith(window.innerWidth);\r\n window.addEventListener('resize', handleResize);\r\n return () => window.removeEventListener('resize', handleResize);\r\n });\r\n}\r\n\r\nexport const useExpressBreakpointWidth = (\r\n {\r\n payment_method,\r\n width\r\n }) => {\r\n const node = useCallback(() => {\r\n const el = document.getElementById(`express-payment-method-${payment_method}`);\r\n return el ? el.parentNode : null;\r\n }, []);\r\n useBreakpointWidth({\r\n name: 'expressMaxWidth',\r\n width,\r\n node,\r\n className: 'wc-stripe-express__sm'\r\n });\r\n\r\n}","import {useRef} from '@wordpress/element';\r\n\r\nexport const useExportedValues = () => {\r\n const exportedValues = useRef({});\r\n return exportedValues.current;\r\n}","import {useEffect, useCallback, useRef, useState} from '@wordpress/element';\r\nimport {hasShippingRates} from '../util';\r\n\r\nexport const usePaymentEvents = (\r\n {\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n }) => {\r\n const {onShippingRateSuccess, onShippingRateFail, onShippingRateSelectSuccess} = eventRegistration;\r\n const currentBilling = useRef(billing);\r\n const currentShipping = useRef(shippingData);\r\n const [handler, setHandler] = useState(null);\r\n const [paymentEvents, setPaymentEvent] = useState({\r\n onShippingChanged: false\r\n });\r\n const addPaymentEvent = useCallback((name, handler, execute = false) => {\r\n if (execute) {\r\n setHandler({[name]: handler});\r\n } else {\r\n setPaymentEvent({...paymentEvents, [name]: handler});\r\n }\r\n }, [paymentEvents, setPaymentEvent]);\r\n const removePaymentEvent = useCallback((name) => {\r\n if (paymentEvents[name]) {\r\n delete paymentEvents[name];\r\n setPaymentEvent(paymentEvents);\r\n }\r\n }, [paymentEvents]);\r\n\r\n const onShippingChanged = useCallback(() => {\r\n const shipping = currentShipping.current;\r\n const billing = currentBilling.current;\r\n if (paymentEvents.onShippingChanged && !shipping.isSelectingRate && !shipping.shippingRatesLoading) {\r\n const handler = paymentEvents.onShippingChanged;\r\n let success = true;\r\n if (!hasShippingRates(shipping.shippingRates)) {\r\n success = false;\r\n }\r\n handler(success, {\r\n billing,\r\n shipping\r\n });\r\n removePaymentEvent('onShippingChanged');\r\n }\r\n }, [paymentEvents, removePaymentEvent]);\r\n\r\n useEffect(() => {\r\n currentBilling.current = billing;\r\n currentShipping.current = shippingData;\r\n });\r\n\r\n useEffect(() => {\r\n if (handler) {\r\n if (handler.onShippingChanged) {\r\n handler.onShippingChanged(true, {\r\n billing: currentBilling.current,\r\n shipping: currentShipping.current\r\n })\r\n setHandler(null);\r\n }\r\n }\r\n }, [handler]);\r\n\r\n useEffect(() => {\r\n const unsubscribeShippingRateSuccess = onShippingRateSuccess(onShippingChanged);\r\n const unsubscribeShippingRateSelectSuccess = onShippingRateSelectSuccess(onShippingChanged);\r\n const unsubscribeShippingRateFail = onShippingRateFail(({hasInvalidAddress, hasError}) => {\r\n if (paymentEvents.onShippingChanged) {\r\n const handler = paymentEvents.onShippingChanged;\r\n handler(false);\r\n removePaymentEvent('onShippingChanged');\r\n }\r\n });\r\n\r\n return () => {\r\n unsubscribeShippingRateSuccess();\r\n unsubscribeShippingRateFail();\r\n unsubscribeShippingRateSelectSuccess();\r\n }\r\n }, [\r\n paymentEvents,\r\n onShippingRateSuccess,\r\n onShippingRateFail,\r\n onShippingRateSelectSuccess\r\n ]);\r\n\r\n return {addPaymentEvent, removePaymentEvent};\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport {usePaymentEvents} from './use-payment-events';\r\nimport {getIntermediateAddress} from '../util';\r\nimport isShallowEqual from '@wordpress/is-shallow-equal';\r\nimport {\r\n getDisplayItems,\r\n getShippingOptions,\r\n getSelectedShippingOption,\r\n isFieldRequired,\r\n toCartAddress as mapToCartAddress\r\n} from \"../util\";\r\n\r\nconst toCartAddress = mapToCartAddress();\r\n\r\nexport const usePaymentRequest = (\r\n {\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n }) => {\r\n const {addPaymentEvent} = usePaymentEvents({\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n });\r\n const {needsShipping, shippingRates} = shippingData;\r\n const {billingData, cartTotalItems, currency, cartTotal} = billing;\r\n const [paymentRequest, setPaymentRequest] = useState(null);\r\n const paymentRequestOptions = useRef({});\r\n const currentShipping = useRef(shippingData)\r\n const currentBilling = useRef(billing);\r\n\r\n useEffect(() => {\r\n currentShipping.current = shippingData;\r\n currentBilling.current = billing;\r\n }, [shippingData]);\r\n\r\n useEffect(() => {\r\n if (stripe) {\r\n const options = {\r\n country: getData('countryCode'),\r\n currency: currency?.code.toLowerCase(),\r\n total: {\r\n amount: cartTotal.value,\r\n label: cartTotal.label,\r\n pending: true\r\n },\r\n requestPayerName: true,\r\n requestPayerEmail: isFieldRequired('email', billingData.country),\r\n requestPayerPhone: isFieldRequired('phone', billingData.country),\r\n requestShipping: needsShipping,\r\n displayItems: getDisplayItems(cartTotalItems, currency)\r\n }\r\n if (options.requestShipping) {\r\n options.shippingOptions = getShippingOptions(shippingRates);\r\n }\r\n paymentRequestOptions.current = options;\r\n const paymentRequest = stripe.paymentRequest(paymentRequestOptions.current);\r\n paymentRequest.canMakePayment().then(result => {\r\n if (canPay(result)) {\r\n setPaymentRequest(paymentRequest);\r\n } else {\r\n setPaymentRequest(null);\r\n }\r\n });\r\n }\r\n }, [stripe, billingData, shippingRates, needsShipping]);\r\n\r\n useEffect(() => {\r\n if (paymentRequest) {\r\n if (paymentRequestOptions.current.requestShipping) {\r\n paymentRequest.on('shippingaddresschange', onShippingAddressChange);\r\n paymentRequest.on('shippingoptionchange', onShippingOptionChange);\r\n }\r\n paymentRequest.on('cancel', onClose);\r\n paymentRequest.on('paymentmethod', onPaymentMethodReceived);\r\n }\r\n }, [paymentRequest]);\r\n\r\n const updatePaymentEvent = useCallback((event) => (success, {billing, shipping}) => {\r\n const {cartTotal, cartTotalItems, currency} = billing;\r\n const {shippingRates} = shipping;\r\n if (success) {\r\n event.updateWith({\r\n status: 'success',\r\n total: {\r\n amount: cartTotal.value,\r\n label: cartTotal.label,\r\n pending: false\r\n },\r\n displayItems: getDisplayItems(cartTotalItems, currency),\r\n shippingOptions: getShippingOptions(shippingRates)\r\n });\r\n } else {\r\n event.updateWith({status: 'invalid_shipping_address'});\r\n }\r\n }, []);\r\n\r\n const onShippingAddressChange = useCallback(event => {\r\n const {shippingAddress} = event;\r\n const shipping = currentShipping.current;\r\n const intermediateAddress = toCartAddress(shippingAddress);\r\n shipping.setShippingAddress({...shipping.shippingAddress, ...intermediateAddress});\r\n const addressEqual = isShallowEqual(getIntermediateAddress(shipping.shippingAddress), intermediateAddress);\r\n addPaymentEvent('onShippingChanged', updatePaymentEvent(event), addressEqual);\r\n }, [addPaymentEvent]);\r\n\r\n const onShippingOptionChange = useCallback(event => {\r\n const {shippingOption} = event;\r\n const shipping = currentShipping.current;\r\n shipping.setSelectedRates(...getSelectedShippingOption(shippingOption.id));\r\n addPaymentEvent('onShippingChanged', updatePaymentEvent(event));\r\n }, [addPaymentEvent]);\r\n\r\n const onPaymentMethodReceived = useCallback((paymentResponse) => {\r\n const {paymentMethod, payerName = null, payerEmail = null, payerPhone = null} = paymentResponse;\r\n // set address data\r\n let billingData = {payerName, payerEmail, payerPhone};\r\n if (paymentMethod?.billing_details.address) {\r\n billingData = toCartAddress(paymentMethod.billing_details.address, billingData);\r\n }\r\n exportedValues.billingData = billingData;\r\n\r\n if (paymentResponse.shippingAddress) {\r\n exportedValues.shippingAddress = toCartAddress(paymentResponse.shippingAddress);\r\n }\r\n\r\n // set payment method\r\n setPaymentMethod(paymentMethod.id);\r\n paymentResponse.complete(\"success\");\r\n }, [setPaymentMethod]);\r\n\r\n return {paymentRequest};\r\n}","import {useEffect} from '@wordpress/element';\r\n\r\nexport const useProcessCheckoutError = (\r\n {\r\n responseTypes,\r\n subscriber,\r\n messageContext = null\r\n }) => {\r\n useEffect(() => {\r\n const unsubscribe = subscriber((data) => {\r\n if (data?.processingResponse.paymentDetails?.stripeErrorMessage) {\r\n return {\r\n type: responseTypes.ERROR,\r\n message: data.processingResponse.paymentDetails.stripeErrorMessage,\r\n messageContext\r\n };\r\n }\r\n return null;\r\n });\r\n return () => unsubscribe();\r\n }, [responseTypes, subscriber]);\r\n}","import {useEffect, useState, useCallback, useRef} from '@wordpress/element';\r\nimport {useStripe} from '@stripe/react-stripe-js';\r\nimport {\r\n ensureSuccessResponse,\r\n ensureErrorResponse,\r\n getBillingDetailsFromAddress,\r\n StripeError\r\n} from '../util';\r\n\r\nexport const useProcessPaymentIntent = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n paymentType = 'card',\r\n setupIntent = null,\r\n removeSetupIntent = null,\r\n savePaymentMethod = false,\r\n exportedValues = {},\r\n getPaymentMethodArgs = () => ({})\r\n }) => {\r\n const {billingData} = billing;\r\n const {shippingAddress} = shippingData;\r\n const {responseTypes} = emitResponse;\r\n const [paymentMethod, setPaymentMethod] = useState(null);\r\n const stripe = useStripe();\r\n const currentPaymentMethodArgs = useRef(getPaymentMethodArgs);\r\n\r\n useEffect(() => {\r\n currentPaymentMethodArgs.current = getPaymentMethodArgs;\r\n }, [getPaymentMethodArgs]);\r\n\r\n const getCreatePaymentMethodArgs = useCallback(() => {\r\n const args = {\r\n type: paymentType,\r\n billing_details: getBillingDetailsFromAddress(exportedValues?.billingData ? exportedValues.billingData : billingData)\r\n }\r\n return {...args, ...currentPaymentMethodArgs.current()};\r\n }, [billingData, paymentType, getPaymentMethodArgs]);\r\n\r\n const getSuccessResponse = useCallback((paymentMethodId, savePaymentMethod) => {\r\n const response = {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: paymentMethodId,\r\n [`${getData('name')}_save_source_key`]: savePaymentMethod\r\n }\r\n }\r\n }\r\n if (exportedValues?.billingData) {\r\n response.meta.billingData = exportedValues.billingData;\r\n }\r\n if (exportedValues?.shippingAddress) {\r\n response.meta.shippingData = {address: exportedValues.shippingAddress};\r\n }\r\n return response;\r\n }, [billingData, shippingAddress]);\r\n\r\n useEffect(() => {\r\n if (paymentMethod && typeof paymentMethod === 'string') {\r\n onSubmit();\r\n }\r\n }, [paymentMethod]);\r\n\r\n useEffect(() => {\r\n const unsubscribeProcessingPayment = onPaymentProcessing(async () => {\r\n if (activePaymentMethod !== getData('name')) {\r\n return null;\r\n }\r\n let [result, paymentMethodId] = [null, null];\r\n try {\r\n if (error) {\r\n throw new StripeError(error);\r\n }\r\n if (setupIntent) {\r\n result = await stripe.confirmCardSetup(setupIntent.client_secret, {\r\n payment_method: getCreatePaymentMethodArgs()\r\n });\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n paymentMethodId = result.setupIntent.payment_method;\r\n removeSetupIntent();\r\n } else {\r\n // payment method has already been created.\r\n if (paymentMethod) {\r\n paymentMethodId = paymentMethod;\r\n } else {\r\n //create the payment method\r\n result = await stripe.createPaymentMethod(getCreatePaymentMethodArgs());\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n paymentMethodId = result.paymentMethod.id;\r\n }\r\n }\r\n return ensureSuccessResponse(responseTypes, getSuccessResponse(paymentMethodId, savePaymentMethod));\r\n } catch (e) {\r\n console.log(e);\r\n setPaymentMethod(null);\r\n return ensureErrorResponse(responseTypes, e.error);\r\n }\r\n\r\n });\r\n return () => unsubscribeProcessingPayment();\r\n }, [\r\n paymentMethod,\r\n billingData,\r\n onPaymentProcessing,\r\n stripe,\r\n setupIntent,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n ]);\r\n return {setPaymentMethod};\r\n}","import {useEffect, useState, useCallback} from '@wordpress/element';\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\nimport {\r\n getSettings,\r\n getRoute,\r\n cartContainsPreOrder,\r\n cartContainsSubscription,\r\n getFromCache,\r\n storeInCache,\r\n deleteFromCache\r\n} from '../util';\r\n\r\nexport const useSetupIntent = (\r\n {\r\n cartTotal,\r\n setError\r\n }) => {\r\n const [setupIntent, setSetupIntent] = useState(getFromCache('setupIntent'));\r\n\r\n useEffect(() => {\r\n const createSetupIntent = async () => {\r\n if (setupIntent) {\r\n return;\r\n }\r\n // only create intent under certain conditions\r\n let result = await apiFetch({\r\n url: getRoute('create/setup_intent'),\r\n method: 'POST'\r\n });\r\n if (result.code) {\r\n setError(result.message);\r\n } else {\r\n storeInCache('setupIntent', result.intent);\r\n setSetupIntent(result.intent);\r\n }\r\n }\r\n if (cartContainsPreOrder() || (cartContainsSubscription() && cartTotal.value == 0)) {\r\n if (!setupIntent) {\r\n createSetupIntent();\r\n }\r\n } else {\r\n setSetupIntent(null);\r\n }\r\n }, [cartTotal.value]);\r\n const removeSetupIntent = useCallback(() => {\r\n deleteFromCache('setupIntent');\r\n }, [cartTotal.value]);\r\n return {setupIntent, removeSetupIntent};\r\n}","import {useState} from '@wordpress/element'\r\n\r\nexport const useStripeError = () => {\r\n const [error, setError] = useState(false);\r\n return [error, setError];\r\n}","import {useState, useEffect} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {AfterpayClearpayMessageElement, Elements} from \"@stripe/react-stripe-js\";\r\nimport {sprintf, __} from '@wordpress/i18n';\r\n\r\nconst getData = getSettings('stripe_afterpay_data');\r\nlet variablesHandler;\r\nconst setVariablesHandler = (handler) => {\r\n variablesHandler = handler;\r\n}\r\nconst PaymentMethodLabel = ({getData}) => {\r\n const [variables, setVariables] = useState({\r\n amount: getData('cartTotal'),\r\n currency: getData('currency'),\r\n isEligible: getData('msgOptions').isEligible\r\n });\r\n const options = {\r\n locale: 'auto'\r\n }\r\n if (variables.currency === 'GBP' && !['fr-FR', 'it-IT', 'es-ES'].includes(getData('locale'))) {\r\n options.locale = 'en-GB';\r\n }\r\n setVariablesHandler(setVariables);\r\n return (\r\n <Elements stripe={initStripe} options={options}>\r\n <div className='wc-stripe-blocks-afterpay__label'>\r\n <AfterpayClearpayMessageElement options={{\r\n ...getData('msgOptions'),\r\n ...{\r\n amount: variables.amount,\r\n currency: variables.currency,\r\n isEligible: variables.isEligible\r\n }\r\n }}/>\r\n </div>\r\n </Elements>\r\n );\r\n}\r\n\r\nconst AfterpayPaymentMethod = ({content, billing, shippingData, ...props}) => {\r\n const Content = content;\r\n const {cartTotal, currency} = billing;\r\n const {needsShipping} = shippingData\r\n useEffect(() => {\r\n variablesHandler({\r\n amount: cartTotal.value,\r\n currency: currency.code,\r\n isEligible: needsShipping\r\n });\r\n }, [\r\n cartTotal.value,\r\n currency.code,\r\n needsShipping\r\n ]);\r\n return (\r\n <>\r\n {needsShipping &&\r\n <div className='wc-stripe-blocks-payment-method-content'>\r\n <div className=\"wc-stripe-blocks-afterpay-offsite__container\">\r\n <div className=\"wc-stripe-blocks-afterpay__offsite\">\r\n <img src={getData('offSiteSrc')}/>\r\n <p>{sprintf(__('After clicking \"%s\", you will be redirected to Afterpay to complete your purchase securely.', 'woo-stripe-payment'), getData('placeOrderButtonLabel'))}</p>\r\n </div>\r\n </div>\r\n <Content {...{...props, billing, shippingData}}/>\r\n </div>}\r\n </>\r\n );\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n getData={getData}/>,\r\n ariaLabel: __('Afterpay', 'woo-stripe-payment'),\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData, ({settings, billingData, cartTotals, cartNeedsShipping}) => {\r\n const {country} = billingData;\r\n const {currency_code: currency} = cartTotals;\r\n const requiredParams = settings('requiredParams');\r\n const [countryCode] = requiredParams[currency];\r\n if (variablesHandler) {\r\n variablesHandler({\r\n amount: parseInt(cartTotals.total_price),\r\n currency,\r\n isEligible: cartNeedsShipping\r\n });\r\n }\r\n return country == countryCode;\r\n }),\r\n content: <AfterpayPaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmAfterpayClearpayPayment'}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel} from \"../../components/checkout/payment-method-label\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {PaymentMethod} from \"../../components/checkout\";\r\n\r\nconst getData = getSettings('stripe_alipay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Alipay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n edit: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_bancontact_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Bancontact',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n edit: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {AuBankAccountElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_becs_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'BECS',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmAuBecsDebitPayment'}\r\n component={AuBankAccountElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_eps_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'EPS',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {FpxBankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_fpx_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'FPX',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmIdealPayment'}\r\n component={FpxBankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_giropay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Giropay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_grabpay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'GrabPay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmGrabPayPayment'}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","export * from './use-after-process-local-payment';\r\nexport * from './use-validate-checkout';\r\nexport * from './use-create-source';","import {useEffect, useRef} from '@wordpress/element';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {ensureErrorResponse, getBillingDetailsFromAddress, StripeError} from \"../../util\";\r\n\r\nexport const useAfterProcessLocalPayment = (\r\n {\r\n getData,\r\n billingData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n confirmationMethod,\r\n getPaymentMethodArgs = () => ({})\r\n }\r\n) => {\r\n const stripe = useStripe();\r\n const {onCheckoutAfterProcessingWithSuccess, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const currentBillingData = useRef(billingData);\r\n const currentPaymentMethodArgs = useRef(getPaymentMethodArgs);\r\n useEffect(() => {\r\n currentBillingData.current = billingData;\r\n }, [billingData]);\r\n\r\n useEffect(() => {\r\n currentPaymentMethodArgs.current = getPaymentMethodArgs;\r\n }, [getPaymentMethodArgs]);\r\n\r\n useEffect(() => {\r\n const unsubscribeAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(async ({redirectUrl}) => {\r\n if (getData('name') === activePaymentMethod) {\r\n try {\r\n let match = redirectUrl.match(/#response=(.+)/);\r\n if (match) {\r\n let {client_secret, return_url, ...order} = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n let result = await stripe[confirmationMethod](client_secret, {\r\n payment_method: {\r\n billing_details: getBillingDetailsFromAddress(currentBillingData.current),\r\n ...currentPaymentMethodArgs.current()\r\n },\r\n return_url\r\n });\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n }\r\n } catch (e) {\r\n console.log(e);\r\n return ensureErrorResponse(responseTypes, e.error);\r\n }\r\n }\r\n })\r\n return () => unsubscribeAfterProcessingWithSuccess();\r\n }, [\r\n stripe,\r\n onCheckoutAfterProcessingWithSuccess,\r\n onCheckoutAfterProcessingWithError\r\n ]);\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport {\r\n getDefaultSourceArgs,\r\n ensureSuccessResponse,\r\n ensureErrorResponse,\r\n StripeError\r\n} from \"../../util\";\r\nimport {useStripe, useElements} from \"@stripe/react-stripe-js\";\r\nimport {__} from '@wordpress/i18n';\r\n\r\nexport const useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n shippingAddress,\r\n onPaymentProcessing,\r\n responseTypes,\r\n getSourceArgs = false,\r\n element = false\r\n }) => {\r\n const [source, setSource] = useState(false);\r\n const [isValid, setIsValid] = useState(false);\r\n const currentValues = useRef({\r\n billing,\r\n shippingAddress,\r\n });\r\n const stripe = useStripe();\r\n const elements = useElements();\r\n useEffect(() => {\r\n currentValues.current = {\r\n billing,\r\n shippingAddress\r\n }\r\n });\r\n\r\n const getSourceArgsInternal = useCallback(() => {\r\n const {billing} = currentValues.current;\r\n const {cartTotal, currency, billingData} = billing;\r\n let args = getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n });\r\n if (getSourceArgs) {\r\n args = getSourceArgs(args, {billingData});\r\n }\r\n return args;\r\n }, []);\r\n\r\n const getSuccessData = useCallback((sourceId) => {\r\n return {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: sourceId\r\n }\r\n }\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(async () => {\r\n if (source) {\r\n return ensureSuccessResponse(responseTypes, getSuccessData(source.id));\r\n }\r\n // create the source\r\n try {\r\n let result;\r\n if (element) {\r\n // validate the element\r\n if (!isValid) {\r\n throw __('Please enter your payment info before proceeding.', 'woo-stripe-payment');\r\n }\r\n result = await stripe.createSource(elements.getElement(element), getSourceArgsInternal());\r\n } else {\r\n result = await stripe.createSource(getSourceArgsInternal());\r\n }\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n setSource(result.source);\r\n return ensureSuccessResponse(responseTypes, getSuccessData(result.source.id));\r\n } catch (err) {\r\n console.log(err);\r\n return ensureErrorResponse(responseTypes, err.error || err);\r\n }\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source,\r\n onPaymentProcessing,\r\n stripe,\r\n responseTypes,\r\n element,\r\n isValid,\r\n setIsValid\r\n ]);\r\n return {setIsValid};\r\n}","import {useEffect, useRef, useState} from '@wordpress/element';\r\nimport {ensureErrorResponse} from \"../../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nexport const useValidateCheckout = (\r\n {\r\n subscriber,\r\n responseTypes,\r\n component = null,\r\n msg = __('Please enter your payment info before proceeding.', 'woo-stripe-payment')\r\n }) => {\r\n const [isValid, setIsValid] = useState(false);\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscriber(() => {\r\n if (component && !isValid) {\r\n return ensureErrorResponse(responseTypes, msg);\r\n }\r\n return true;\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n subscriber,\r\n isValid,\r\n setIsValid,\r\n responseTypes,\r\n component\r\n ]);\r\n return {isValid, setIsValid};\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {IdealBankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_ideal_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Ideal',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmIdealPayment'}\r\n component={IdealBankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import './klarna';\r\nimport './ideal';\r\nimport './p24';\r\nimport './bancontact';\r\nimport './giropay';\r\nimport './eps';\r\nimport './multibanco';\r\nimport './sepa';\r\nimport './sofort';\r\nimport './wechat';\r\nimport './fpx';\r\nimport './becs';\r\nimport './grabpay';\r\nimport './alipay'\r\nimport './afterpay';","import {useEffect} from '@wordpress/element';\r\nimport RadioControlAccordion from \"../../../components/checkout/radio-control-accordion\";\r\n\r\nexport const KlarnaPaymentCategories = ({categories, onChange, selected}) => {\r\n return (\r\n <div className={'wc-stripe-blocks-klarna-container'}>\r\n <ul>\r\n {categories.map(category => {\r\n return <KlarnaPaymentCategory\r\n key={category.type}\r\n category={category}\r\n onChange={onChange}\r\n selected={selected}/>\r\n })}\r\n </ul>\r\n </div>\r\n );\r\n}\r\n\r\nconst KlarnaPaymentCategory = ({category, selected, onChange}) => {\r\n const checked = category.type === selected;\r\n useEffect(() => {\r\n Klarna.Payments.load({\r\n container: `#klarna-category-${category.type}`,\r\n payment_method_category: category.type,\r\n //instance_id: `klarna-instance-${category.type}`\r\n });\r\n }, []);\r\n const option = {\r\n label: category.label,\r\n value: category.type,\r\n content: (<div id={`klarna-category-${category.type}`}></div>)\r\n }\r\n return (\r\n <li className='wc-stripe-blocks-klarna__category' key={category.type}>\r\n <RadioControlAccordion option={option} checked={checked} onChange={onChange}/>\r\n </li>\r\n )\r\n}","export * from './use-create-source';\r\nexport * from './use-process-payment';","import {useEffect, useState, useRef, useCallback} from '@wordpress/element';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {useStripeError} from \"../../../hooks\";\r\nimport {getDefaultSourceArgs, getRoute, isAddressValid, StripeError, storeInCache, getFromCache} from \"../../../util\";\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\n\r\nlet klarnaSource = {};\r\n\r\nexport const useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n }) => {\r\n const stripe = useStripe();\r\n const [error, setError] = useStripeError();\r\n const abortController = useRef(new AbortController());\r\n const currentSourceArgs = useRef({});\r\n const oldSourceArgs = useRef({});\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [source, setSource] = useState(false);\r\n const {billingData, cartTotal, cartTotalItems, currency} = billing;\r\n const isCheckoutValid = useCallback(({billingData, shippingData}) => {\r\n const {needsShipping, shippingAddress} = shippingData;\r\n if (isAddressValid(billingData)) {\r\n if (needsShipping) {\r\n return isAddressValid(shippingAddress);\r\n }\r\n return true;\r\n }\r\n return false;\r\n }, []);\r\n const getLineItems = useCallback((cartTotalItems, currency) => {\r\n const items = [];\r\n cartTotalItems.forEach(item => {\r\n items.push({\r\n amount: item.value,\r\n currency,\r\n description: item.label,\r\n quantity: 1\r\n });\r\n });\r\n return items;\r\n }, []);\r\n\r\n const getSourceArgs = useCallback(({cartTotal, cartTotalItems, billingData, currency, shippingData}) => {\r\n const {first_name, last_name, country} = billingData;\r\n const {needsShipping, shippingAddress} = shippingData;\r\n let args = getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n });\r\n args = {\r\n ...args, ...{\r\n source_order: {\r\n items: getLineItems(cartTotalItems, currency.code)\r\n },\r\n klarna: {\r\n locale: getData('locale'),\r\n product: 'payment',\r\n purchase_country: country,\r\n first_name,\r\n last_name\r\n }\r\n }\r\n }\r\n if (country == 'US') {\r\n args.klarna.custom_payment_methods = 'payin4,installments';\r\n }\r\n if (needsShipping) {\r\n args.klarna = {\r\n ...args.klarna, ...{\r\n shipping_first_name: shippingAddress.first_name,\r\n shipping_last_name: shippingAddress.last_name\r\n }\r\n }\r\n args.source_order.shipping = {\r\n address: {\r\n city: shippingAddress.city || '',\r\n country: shippingAddress.country || '',\r\n line1: shippingAddress.address_1 || '',\r\n line2: shippingAddress.address_2 || '',\r\n postal_code: shippingAddress.postcode || '',\r\n state: shippingAddress.state || ''\r\n }\r\n }\r\n }\r\n oldSourceArgs.current = currentSourceArgs.current;\r\n currentSourceArgs.current = args;\r\n return args;\r\n }, []);\r\n const filterUpdateSourceArgs = (args) => {\r\n return ['type', 'currency', 'statement_descriptor', 'redirect', 'klarna.product', 'klarna.locale', 'klarna.custom_payment_methods'].reduce((obj, k) => {\r\n if (k.indexOf('.') > -1) {\r\n let keys = k.split('.');\r\n let obj2 = keys.slice(0, keys.length - 1).reduce(function (obj, k) {\r\n return obj[k];\r\n }, obj);\r\n k = keys[keys.length - 1];\r\n delete obj2[k];\r\n return obj;\r\n }\r\n delete obj[k];\r\n return obj;\r\n }, args);\r\n }\r\n\r\n const compareSourceArgs = useCallback((args, args2) => {\r\n const getArgs = (args1, args2) => {\r\n const newArgs = {};\r\n for (let key of Object.keys(args1)) {\r\n if (typeof args1[key] === 'object' && !Array.isArray(args1[key])) {\r\n newArgs[key] = getArgs(args1[key], args2[key]);\r\n } else {\r\n newArgs[key] = args2[key];\r\n }\r\n }\r\n return newArgs;\r\n }\r\n const newArgs = getArgs(args, args2);\r\n return JSON.stringify(args) == JSON.stringify(newArgs);\r\n }, []);\r\n const createSource = useCallback(async (\r\n {\r\n billingData,\r\n shippingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency,\r\n }) => {\r\n let args = getSourceArgs({\r\n cartTotal,\r\n cartTotalItems,\r\n billingData,\r\n currency,\r\n shippingData\r\n });\r\n try {\r\n let result = await stripe.createSource(args);\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n storeInCache('klarna:source', {[currency.code]: {source: result.source, args: currentSourceArgs.current}});\r\n setSource(result.source);\r\n } catch (err) {\r\n console.log(err);\r\n setError(err.error);\r\n }\r\n }, [\r\n stripe,\r\n setSource\r\n ]);\r\n\r\n const updateSource = useCallback(async ({source, updates}) => {\r\n\r\n const data = {\r\n updates,\r\n source_id: source.id,\r\n client_secret: source.client_secret,\r\n payment_method: getData('name')\r\n };\r\n try {\r\n abortController.current.abort();\r\n abortController.current = new AbortController();\r\n let result = await apiFetch({\r\n url: getRoute('update/source'),\r\n method: 'POST',\r\n data,\r\n signal: abortController.current.signal\r\n });\r\n if (result.source) {\r\n storeInCache('klarna:source', {source, args: currentSourceArgs.current});\r\n setSource(source);\r\n }\r\n } catch (err) {\r\n console.log('update aborted');\r\n }\r\n }, [setSource]);\r\n\r\n // Create the source if the required data is available\r\n useEffect(() => {\r\n if (!source) {\r\n if (getFromCache('klarna:source')?.[currency.code]) {\r\n const {source, args} = getFromCache('klarna:source')[currency.code];\r\n currentSourceArgs.current = args;\r\n setSource(source);\r\n } else {\r\n if (stripe && isCheckoutValid({billingData, shippingData})) {\r\n setIsLoading(true);\r\n createSource({\r\n billingData,\r\n shippingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency\r\n }).then(() => setIsLoading(false));\r\n }\r\n }\r\n }\r\n }, [\r\n stripe,\r\n source?.id,\r\n createSource,\r\n billingData,\r\n cartTotal.value,\r\n shippingData,\r\n setIsLoading,\r\n cartTotalItems,\r\n currency.code\r\n ]);\r\n\r\n // update the source if data has changed and the source exists\r\n useEffect(() => {\r\n if (stripe && source) {\r\n // perform a comparison to see if the source needs to be updated\r\n const updates = filterUpdateSourceArgs(getSourceArgs({\r\n billingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency,\r\n shippingData\r\n }));\r\n if (!compareSourceArgs(updates, oldSourceArgs.current)) {\r\n updateSource({source, updates});\r\n }\r\n }\r\n }, [\r\n source?.id,\r\n billingData,\r\n cartTotal.value,\r\n cartTotalItems,\r\n shippingData,\r\n currency.code\r\n ]);\r\n\r\n return {source, setSource, isLoading};\r\n}","import {useEffect} from '@wordpress/element';\r\nimport {ensureErrorResponse, ensureSuccessResponse, deleteFromCache} from \"../../../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nexport const useProcessPayment = (\r\n {\r\n payment_method,\r\n source_id,\r\n paymentCategory,\r\n onPaymentProcessing,\r\n responseTypes\r\n }) => {\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(() => {\r\n return new Promise(resolve => {\r\n // authorize the Klarna payment\r\n Klarna.Payments.authorize({\r\n payment_method_category: paymentCategory\r\n }, (response) => {\r\n if (response.approved) {\r\n deleteFromCache('klarna:source');\r\n // add the source to the response\r\n resolve(ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${payment_method}_token_key`]: source_id\r\n }\r\n }\r\n }));\r\n } else {\r\n resolve(ensureErrorResponse(responseTypes, response.error || __('Your purchase is not approved.', 'woo-stripe-payment')));\r\n }\r\n });\r\n });\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source_id,\r\n paymentCategory,\r\n onPaymentProcessing\r\n ]\r\n );\r\n}","import {useEffect, useState} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {__} from '@wordpress/i18n';\r\nimport {useProcessCheckoutError} from '../../hooks';\r\nimport {\r\n getSettings,\r\n initStripe,\r\n} from \"../../util\";\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../../components/checkout\";\r\nimport {canMakePayment} from \"../local-payment-method\";\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\nimport {KlarnaPaymentCategories} from \"./categories\";\r\nimport {KlarnaLoader} from \"./loader\";\r\nimport {useCreateSource, useProcessPayment} from \"./hooks\";\r\nimport './styles.scss';\r\n\r\nconst getData = getSettings('stripe_klarna_data');\r\n\r\nconst KlarnaContainer = (props) => {\r\n return (\r\n <Elements stripe={initStripe}>\r\n <KlarnaPaymentMethod {...props}/>\r\n </Elements>\r\n );\r\n}\r\n\r\nconst KlarnaPaymentMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const [selected, setSelected] = useState('');\r\n const getCategoriesFromSource = (source) => {\r\n const paymentMethodCategories = source.klarna.payment_method_categories.split(',');\r\n const categories = [];\r\n for (let type of Object.keys(getData('categories'))) {\r\n if (paymentMethodCategories.includes(type)) {\r\n categories.push({type, label: getData('categories')[type]});\r\n }\r\n }\r\n return categories;\r\n }\r\n\r\n const {source, isLoading} = useCreateSource({\r\n getData,\r\n billing,\r\n shippingData\r\n });\r\n\r\n useProcessPayment({\r\n payment_method: getData('name'),\r\n source_id: source.id,\r\n paymentCategory: selected,\r\n onPaymentProcessing,\r\n responseTypes\r\n });\r\n\r\n useProcessCheckoutError({responseTypes, subscriber: onCheckoutAfterProcessingWithError});\r\n\r\n useEffect(() => {\r\n if (!selected && source) {\r\n const categories = getCategoriesFromSource(source);\r\n if (categories.length) {\r\n setSelected(categories.shift().type);\r\n }\r\n\r\n }\r\n }, [source]);\r\n\r\n if (source) {\r\n Klarna.Payments.init({\r\n client_token: source.klarna.client_token\r\n });\r\n const categories = getCategoriesFromSource(source);\r\n return (\r\n <KlarnaPaymentCategories\r\n categories={categories}\r\n selected={!selected && categories.length > 0 ? categories[0].type : selected}\r\n onChange={setSelected}/>\r\n )\r\n } else {\r\n if (isLoading) {\r\n return <KlarnaLoader/>\r\n }\r\n }\r\n return (\r\n <div className='wc-stripe-blocks-klarna__notice'>\r\n {__('Please fill out all required fields before paying with Klarna.', 'woo-stripe-payment')}\r\n </div>\r\n );\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Klarna',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData, ({settings, billingData, cartTotals}) => {\r\n const {country} = billingData;\r\n const {currency_code: currency} = cartTotals;\r\n const requiredParams = settings('requiredParams');\r\n return [currency] in requiredParams && requiredParams[currency].includes(country);\r\n }),\r\n content: <PaymentMethod\r\n getData={getData}\r\n content={KlarnaContainer}/>,\r\n edit: <PaymentMethod\r\n getData={getData}\r\n content={KlarnaContainer}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","export const KlarnaLoader = () => {\r\n return (\r\n <div className=\"wc-stripe-klarna-loader\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n )\r\n}","import {useCallback} from '@wordpress/element';\r\nimport {useElements, Elements} from \"@stripe/react-stripe-js\";\r\nimport {initStripe as loadStripe, cartContainsSubscription, cartContainsPreOrder} from '../util'\r\nimport {useAfterProcessLocalPayment, useValidateCheckout, useCreateSource} from \"./hooks\";\r\nimport {useProcessCheckoutError} from \"../hooks\";\r\n\r\n/**\r\n * Return true if the local payment method can be used.\r\n * @param settings\r\n * @returns {function({billingData: *, [p: string]: *}): *}\r\n */\r\nexport const canMakePayment = (settings, callback = false) => ({billingData, cartTotals, ...props}) => {\r\n const {currency_code} = cartTotals;\r\n const {country} = billingData;\r\n const countries = settings('countries');\r\n const type = settings('allowedCountries');\r\n const supports = settings('features');\r\n let canMakePayment = false;\r\n if (settings('isAdmin')) {\r\n canMakePayment = true;\r\n } else {\r\n // Check if there are any subscriptions or pre-orders in the cart.\r\n if (cartContainsSubscription() && !supports.includes('subscriptions')) {\r\n return false;\r\n } else if (cartContainsPreOrder() && !supports.includes('pre-orders')) {\r\n return false;\r\n }\r\n if (settings('currencies').includes(currency_code)) {\r\n if (type === 'all_except') {\r\n canMakePayment = !settings('exceptCountries').includes(country);\r\n } else if (type === 'specific') {\r\n canMakePayment = settings('specificCountries').includes(country);\r\n } else {\r\n canMakePayment = countries.length > 0 ? countries.includes(country) : true;\r\n }\r\n }\r\n if (callback && canMakePayment) {\r\n canMakePayment = callback({settings, billingData, cartTotals, ...props});\r\n }\r\n }\r\n return canMakePayment;\r\n}\r\n\r\nexport const LocalPaymentIntentContent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <LocalPaymentIntentMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nexport const LocalPaymentSourceContent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <LocalPaymentSourceMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nconst LocalPaymentSourceMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n getSourceArgs = false,\r\n element = false\r\n }) => {\r\n const {shippingAddress} = shippingData;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const onChange = (event) => {\r\n setIsValid(event.complete);\r\n }\r\n const {setIsValid} = useCreateSource({\r\n getData,\r\n billing,\r\n shippingAddress,\r\n onPaymentProcessing,\r\n responseTypes,\r\n getSourceArgs,\r\n element\r\n });\r\n\r\n if (element) {\r\n return (\r\n <LocalPaymentElementContainer\r\n name={getData('name')}\r\n options={getData('elementOptions')}\r\n onChange={onChange}\r\n element={element}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst LocalPaymentIntentMethod = (\r\n {\r\n getData,\r\n billing,\r\n emitResponse,\r\n eventRegistration,\r\n activePaymentMethod,\r\n confirmationMethod = null,\r\n component = null\r\n }) => {\r\n const elements = useElements();\r\n const {billingData} = billing;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const getPaymentMethodArgs = useCallback(() => {\r\n if (component) {\r\n return {\r\n [getData('paymentType')]: elements.getElement(component)\r\n }\r\n }\r\n return {};\r\n }, [elements]);\r\n const {setIsValid} = useValidateCheckout({\r\n subscriber: onPaymentProcessing,\r\n responseTypes,\r\n component\r\n }\r\n );\r\n\r\n useAfterProcessLocalPayment({\r\n getData,\r\n billingData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n confirmationMethod,\r\n getPaymentMethodArgs\r\n });\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError,\r\n messageContext: noticeContexts.PAYMENT\r\n });\r\n if (component) {\r\n const onChange = (event) => setIsValid(!event.empty)\r\n return (\r\n <LocalPaymentElementContainer\r\n name={getData('name')}\r\n options={getData('elementOptions')}\r\n onChange={onChange}\r\n element={component}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst LocalPaymentElementContainer = ({name, onChange, element, options}) => {\r\n const Tag = element;\r\n return (\r\n <div className={`wc-stripe-local-payment-container ${name} ${Tag.displayName}`}>\r\n <Tag options={options} onChange={onChange}/>\r\n </div>\r\n )\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_multibanco_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'MultiBanco',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {P24BankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_p24_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'P24',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmP24Payment'}\r\n component={P24BankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, cartContainsPreOrder, cartContainsSubscription} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {IbanElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_sepa_data');\r\n\r\nconst getSourceArgs = (args, {billingData}) => {\r\n args.mandate = {\r\n notification_method: billingData.email ? 'email' : 'manual',\r\n interval: cartContainsSubscription() || cartContainsPreOrder() ? 'scheduled' : 'one_time'\r\n }\r\n if (args.mandate.interval === 'scheduled') {\r\n delete args.amount;\r\n }\r\n return args;\r\n}\r\n\r\nconst LocalPaymentMethod = (PaymentMethod) => ({getData, ...props}) => {\r\n return (\r\n <>\r\n <PaymentMethod {...{...props, getData}}/>\r\n <div className={'wc-stripe-blocks-sepa__mandate'}>\r\n {getData('mandate')}\r\n </div>\r\n </>\r\n )\r\n}\r\n\r\nconst SepaPaymentMethod = LocalPaymentMethod(PaymentMethod);\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'SEPA',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <SepaPaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}\r\n element={IbanElement}\r\n getSourceArgs={getSourceArgs}/>,\r\n edit: <LocalPaymentSourceContent getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_sofort_data');\r\n\r\nconst getSourceArgs = (args, {billingData}) => {\r\n return {...args, sofort: {country: billingData.country}};\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Sofort',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}\r\n getSourceArgs={getSourceArgs}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {useEffect, useRef, useState, useCallback} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {\r\n getSettings,\r\n initStripe as loadStripe,\r\n getDefaultSourceArgs,\r\n isAddressValid,\r\n StripeError,\r\n isTestMode,\r\n ensureSuccessResponse,\r\n getErrorMessage,\r\n storeInCache,\r\n getFromCache,\r\n deleteFromCache\r\n} from \"../util\";\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\nimport {useValidateCheckout} from \"./hooks\";\r\nimport {__} from '@wordpress/i18n';\r\n//import QRCode from 'QRCode';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {useStripeError} from \"../hooks\";\r\n\r\nconst getData = getSettings('stripe_wechat_data');\r\n\r\nconst WeChatComponent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <WeChatPaymentMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nconst WeChatPaymentMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n components\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithSuccess} = eventRegistration;\r\n const {ValidationInputError} = components;\r\n const {isValid, setIsValid} = useValidateCheckout({\r\n subscriber: eventRegistration.onPaymentProcessing,\r\n responseTypes: emitResponse.responseTypes,\r\n msg: __('Please scan your QR code to continue with payment.', 'woo-stripe-payment')\r\n });\r\n\r\n const {source, error, deleteSourceFromStorage} = useCreateSource({\r\n getData,\r\n billing,\r\n responseTypes,\r\n subscriber: onPaymentProcessing\r\n })\r\n\r\n /**\r\n * delete the source from storage once payment is successful.\r\n * If test mode, redirect to the Stripe test url.\r\n * If live mode, redirect to the return Url.\r\n */\r\n useEffect(() => {\r\n const unsubscribe = onCheckoutAfterProcessingWithSuccess(() => {\r\n deleteSourceFromStorage();\r\n return ensureSuccessResponse(responseTypes);\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source,\r\n onCheckoutAfterProcessingWithSuccess,\r\n deleteSourceFromStorage\r\n ]);\r\n\r\n useEffect(() => {\r\n if (source) {\r\n setIsValid(true);\r\n }\r\n }, [source]);\r\n\r\n if (source) {\r\n return (\r\n <QRCodeComponent text={source.wechat.qr_code_url}/>\r\n );\r\n } else if (error) {\r\n return (\r\n <div className='wechat-validation-error'>\r\n <ValidationInputError errorMessage={getErrorMessage(error)}/>\r\n </div>\r\n );\r\n } else {\r\n // if billing address is not valid\r\n if (!isAddressValid(billing.billingData)) {\r\n return __('Please fill out all the required fields in order to complete the WeChat payment.', 'woo-stripe-payment');\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nconst QRCodeComponent = (\r\n {\r\n text,\r\n width = 128,\r\n height = 128,\r\n colorDark = '#424770',\r\n colorLight = '#f8fbfd',\r\n correctLevel = QRCode.CorrectLevel.H\r\n }) => {\r\n const el = useRef();\r\n useEffect(() => {\r\n new QRCode(el.current, {\r\n text,\r\n width,\r\n height,\r\n colorDark,\r\n colorLight,\r\n correctLevel\r\n })\r\n }, [el]);\r\n return (\r\n <>\r\n <div id='wc-stripe-block-qrcode' ref={el}></div>\r\n {isTestMode() && <p>\r\n {__('Test mode: Click the Place Order button to proceed.', 'woo-stripe-payment')}\r\n </p>}\r\n {!isTestMode() && <p>\r\n {__('Scan the QR code using your WeChat app. Once scanned click the Place Order button.', 'woo-stripe-payment')}\r\n </p>}\r\n </>\r\n )\r\n}\r\n\r\nconst useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n responseTypes,\r\n subscriber\r\n }) => {\r\n const stripe = useStripe();\r\n const [error, setError] = useStripeError();\r\n const [source, setSource] = useState(getFromCache('wechat:source'));\r\n const createSourceTimeoutId = useRef(null);\r\n const {cartTotal, billingData, currency} = billing;\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscriber(() => {\r\n return ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: source.id\r\n }\r\n }\r\n })\r\n });\r\n return () => unsubscribe();\r\n }, [source, subscriber]);\r\n\r\n const createSource = useCallback(async () => {\r\n // validate the billing fields. If valid, create the source.\r\n try {\r\n if (!error && isAddressValid(billingData)) {\r\n let result = await stripe.createSource(getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n }));\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n setSource(result.source);\r\n storeInCache('wechat:source', result.source);\r\n }\r\n } catch (err) {\r\n console.log('error: ', err);\r\n setError(err.error);\r\n }\r\n }, [\r\n stripe,\r\n source,\r\n cartTotal.value,\r\n billingData,\r\n currency,\r\n error\r\n ]);\r\n const deleteSourceFromStorage = useCallback(() => {\r\n deleteFromCache('wechat:source');\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (stripe && !source) {\r\n // if there is an existing request, cancel it.\r\n clearTimeout(createSourceTimeoutId.current);\r\n createSourceTimeoutId.current = setTimeout(createSource, 1000);\r\n }\r\n }, [\r\n stripe,\r\n source\r\n ]);\r\n\r\n return {source, setSource, error, deleteSourceFromStorage};\r\n}\r\n\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'WeChat',\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={WeChatComponent} getData={getData}/>,\r\n edit: <PaymentMethod content={WeChatComponent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import './style.scss';\r\n\r\nimport './payment-method';","import {useMemo, useEffect, useRef} from '@wordpress/element';\r\nimport {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, canMakePayment} from \"../util\";\r\nimport {useBreakpointWidth, useExpressBreakpointWidth} from '../hooks';\r\nimport {Elements, PaymentRequestButtonElement, useStripe} from \"@stripe/react-stripe-js\";\r\nimport {\r\n usePaymentRequest,\r\n useProcessPaymentIntent,\r\n useExportedValues,\r\n useAfterProcessingPayment,\r\n useStripeError\r\n} from '../hooks';\r\n\r\nconst getData = getSettings('stripe_payment_request_data');\r\n\r\nconst PaymentRequestContent = (props) => {\r\n return (\r\n <div className='wc-stripe-payment-request-container'>\r\n <Elements stripe={loadStripe}>\r\n <PaymentRequestButton {...props}/>\r\n </Elements>\r\n </div>\r\n );\r\n}\r\n\r\nconst PaymentRequestButton = (\r\n {\r\n getData,\r\n onClick,\r\n onClose,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n emitResponse,\r\n onSubmit,\r\n activePaymentMethod,\r\n ...props\r\n }) => {\r\n const {onPaymentProcessing} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const stripe = useStripe();\r\n const [error] = useStripeError();\r\n const canPay = (result) => result != null && !result.applePay;\r\n const exportedValues = useExportedValues();\r\n useExpressBreakpointWidth({payment_method: getData('name'), width: 300});\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n exportedValues\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n messageContext: noticeContexts.EXPRESS_PAYMENTS\r\n });\r\n const {paymentRequest} = usePaymentRequest({\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n });\r\n\r\n const options = useMemo(() => {\r\n return {\r\n paymentRequest,\r\n style: {\r\n paymentRequestButton: getData('paymentRequestButton')\r\n }\r\n }\r\n }, [paymentRequest]);\r\n\r\n if (paymentRequest) {\r\n return (\r\n <PaymentRequestButtonElement options={options} onClick={onClick}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst PaymentRequestEdit = ({getData, ...props}) => {\r\n const canvas = useRef();\r\n useEffect(() => {\r\n const scale = window.devicePixelRatio;\r\n canvas.current.width = 20 * scale;\r\n canvas.current.height = 20 * scale;\r\n let ctx = canvas.current.getContext('2d');\r\n ctx.scale(scale, scale);\r\n ctx.beginPath();\r\n ctx.arc(10, 10, 10, 0, 2 * Math.PI);\r\n ctx.fillStyle = '#986fff';\r\n ctx.fill();\r\n });\r\n return (\r\n <div className='payment-request-block-editor'>\r\n <div className={'icon-container'}>\r\n <span>Buy now</span>\r\n <canvas className='PaymentRequestButton-icon' ref={canvas}/>\r\n <i className={'payment-request-arrow'}></i>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: ({cartTotals}) => {\r\n if (getData('isAdmin')) {\r\n return true;\r\n }\r\n const {currency_code: currency, total_price} = cartTotals;\r\n return canMakePayment({\r\n country: getData('countryCode'),\r\n currency: currency.toLowerCase(),\r\n total: {\r\n label: getData('totalLabel'),\r\n amount: parseInt(total_price)\r\n }\r\n }, (result) => result != null && !result.applePay);\r\n },\r\n content: <PaymentRequestContent getData={getData}/>,\r\n edit: <PaymentRequestEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n});","import {useEffect, useCallback} from '@wordpress/element';\r\nimport {initStripe as loadStripe, getSettings, handleCardAction} from '@paymentplugins/stripe/util';\r\n\r\nconst SavedCardComponent = (\r\n {\r\n eventRegistration,\r\n emitResponse,\r\n getData\r\n }) => {\r\n const {onCheckoutAfterProcessingWithSuccess} = eventRegistration;\r\n const {responseTypes} = emitResponse;\r\n const handleSuccessResult = useCallback(async ({redirectUrl}) => {\r\n const stripe = await loadStripe;\r\n return await handleCardAction({redirectUrl, getData, stripe, responseTypes});\r\n }, [onCheckoutAfterProcessingWithSuccess]);\r\n\r\n useEffect(() => {\r\n const unsubscribeOnCheckoutAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(handleSuccessResult);\r\n return () => unsubscribeOnCheckoutAfterProcessingWithSuccess();\r\n }, [\r\n onCheckoutAfterProcessingWithSuccess\r\n ]);\r\n return null;\r\n}\r\n\r\nexport default SavedCardComponent;\r\n","import {loadStripe} from '@stripe/stripe-js';\r\nimport {getSetting} from '@woocommerce/settings'\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\nimport {getCurrency, formatPrice as wcFormatPrice} from '@woocommerce/price-format';\r\n\r\nconst {publishableKey, account} = getSetting('stripeGeneralData');\r\nconst messages = getSetting('stripeErrorMessages');\r\nconst countryLocale = getSetting('countryLocale', {});\r\n\r\nconst SHIPPING_OPTION_REGEX = /^([\\w]+)\\:(.+)$/;\r\n\r\nconst routes = getSetting('stripeGeneralData').routes;\r\n\r\nconst creditCardForms = {};\r\n\r\nconst localPaymentMethods = [];\r\n\r\nconst CACHE_PREFIX = 'stripe:';\r\n\r\nconst PAYMENT_REQUEST_ADDRESS_MAPPINGS = {\r\n recipient: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n payerName: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n country: 'country',\r\n addressLine: (address, value) => {\r\n if (value[0]) {\r\n address.address_1 = value[0];\r\n }\r\n if (value[1]) {\r\n address.address_2 = value[1];\r\n }\r\n return address;\r\n },\r\n line1: 'address_1',\r\n line2: 'address_2',\r\n city: 'city',\r\n region: 'state',\r\n postalCode: 'postcode',\r\n postal_code: 'postcode',\r\n payerEmail: 'email',\r\n payerPhone: 'phone'\r\n}\r\n\r\nexport const initStripe = new Promise((resolve, reject) => {\r\n loadStripe(publishableKey, (() => account ? {stripeAccount: account} : {})()).then(stripe => {\r\n resolve(stripe);\r\n }).catch(err => {\r\n resolve({error: err});\r\n });\r\n});\r\n\r\nexport const registerCreditCardForm = ({id, ...props}) => {\r\n creditCardForms[id] = props;\r\n}\r\n\r\nexport const getCreditCardForm = (id) => {\r\n return creditCardForms[id];\r\n}\r\n\r\nexport const getRoute = (route) => {\r\n return routes?.[route] ? routes[route] : console.log(`${route} is not a valid route`);\r\n}\r\n\r\nexport const ensureSuccessResponse = (responseTypes, data = {}) => {\r\n return {type: responseTypes.SUCCESS, ...data};\r\n}\r\n\r\n/**\r\n * Returns a formatted error object used by observers\r\n * @param responseTypes\r\n * @param error\r\n * @returns {{type: *, message: *}}\r\n */\r\nexport const ensureErrorResponse = (responseTypes, error) => {\r\n return {type: responseTypes.ERROR, message: getErrorMessage(error)}\r\n};\r\n\r\n/**\r\n * Return a customized error message.\r\n * @param error\r\n */\r\nexport const getErrorMessage = (error) => {\r\n if (typeof error == 'string') {\r\n return error;\r\n }\r\n if (error?.code && messages?.[error.code]) {\r\n return messages[error.code];\r\n }\r\n if (error?.statusCode) {\r\n return messages?.[error.statusCode] ? messages[error.statusCode] : error.statusMessage;\r\n }\r\n return error.message;\r\n}\r\n\r\n/**\r\n * Return a Stripe formatted billing_details object from a WC address\r\n * @param billingAddress\r\n */\r\nexport const getBillingDetailsFromAddress = (billingAddress) => {\r\n let billing_details = {\r\n name: `${billingAddress.first_name} ${billingAddress.last_name}`,\r\n address: {\r\n city: billingAddress.city || '',\r\n country: billingAddress.country || '',\r\n line1: billingAddress.address_1 || '',\r\n line2: billingAddress.address_2 || '',\r\n postal_code: billingAddress.postcode || '',\r\n state: billingAddress.state || ''\r\n }\r\n }\r\n if (billingAddress?.phone) {\r\n billing_details.phone = billingAddress.phone;\r\n }\r\n if (billingAddress?.email) {\r\n billing_details.email = billingAddress.email;\r\n }\r\n return billing_details;\r\n}\r\n\r\nexport const getSettings = (name) => (key) => {\r\n if (key) {\r\n return getSetting(name)[key];\r\n }\r\n return getSetting(name);\r\n}\r\n\r\nexport class StripeError extends Error {\r\n constructor(error) {\r\n super(error.message);\r\n this.error = error;\r\n }\r\n}\r\n\r\n/**\r\n * Returns true if the provided value is empty.\r\n * @param value\r\n * @returns {boolean}\r\n */\r\nexport const isEmpty = (value) => {\r\n if (typeof value === 'string') {\r\n return value.length == 0 || value == '';\r\n }\r\n if (Array.isArray(value)) {\r\n return array.length == 0;\r\n }\r\n if (typeof value === 'object') {\r\n return Object.keys(value).length == 0;\r\n }\r\n if (typeof value === 'undefined') {\r\n return true;\r\n }\r\n return true;\r\n}\r\n\r\nexport const removeNumberPrecision = (value, unit) => {\r\n return value / 10 ** unit;\r\n}\r\n\r\n/**\r\n *\r\n * @param address\r\n * @param country\r\n */\r\nexport const isAddressValid = (address, exclude = []) => {\r\n const fields = getLocaleFields(address.country);\r\n for (const [key, value] of Object.entries(address)) {\r\n if (!exclude.includes(key) && fields?.[key] && fields[key].required) {\r\n if (isEmpty(value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\n\r\nexport const getLocaleFields = (country) => {\r\n let localeFields = {...countryLocale.default};\r\n if (country && countryLocale?.[country]) {\r\n localeFields = Object.entries(countryLocale[country]).reduce((locale, [key, value]) => {\r\n locale[key] = {...locale[key], ...value}\r\n return locale;\r\n }, localeFields);\r\n ['phone', 'email'].forEach(key => {\r\n let node = document.getElementById(key);\r\n if (node) {\r\n localeFields[key] = {required: node.required};\r\n }\r\n });\r\n }\r\n return localeFields;\r\n}\r\n\r\n/**\r\n * Return true if the field is required by the cart\r\n * @param field\r\n * @param country\r\n * @returns {boolean|*}\r\n */\r\nexport const isFieldRequired = (field, country = false) => {\r\n const fields = getLocaleFields(country);\r\n return [field] in fields && fields[field].required;\r\n}\r\n\r\nexport const getSelectedShippingOption = (id) => {\r\n const result = id.match(SHIPPING_OPTION_REGEX);\r\n if (result) {\r\n const {1: packageIdx, 2: rate} = result;\r\n return [rate, packageIdx];\r\n }\r\n return [];\r\n}\r\n\r\nexport const hasShippingRates = (shippingRates) => {\r\n return shippingRates.map(rate => {\r\n return rate.shipping_rates.length > 0;\r\n }).filter(Boolean).length > 0;\r\n}\r\n\r\n/**\r\n * Return true if the customer is logged in.\r\n * @param customerId\r\n * @returns {boolean}\r\n */\r\nexport const isUserLoggedIn = (customerId) => {\r\n return customerId > 0;\r\n}\r\n\r\nconst syncPaymentIntentWithOrder = async (order_id, client_secret) => {\r\n try {\r\n await apiFetch({\r\n url: routes['sync/intent'],\r\n method: 'POST',\r\n data: {order_id, client_secret}\r\n })\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nexport const handleCardAction = async (\r\n {\r\n redirectUrl,\r\n responseTypes,\r\n stripe,\r\n getData,\r\n savePaymentMethod = false\r\n }) => {\r\n try {\r\n let match = redirectUrl.match(/#response=(.+)/)\r\n if (match) {\r\n let {client_secret, order_id, order_key} = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n let result = await stripe.handleCardAction(client_secret);\r\n if (result.error) {\r\n syncPaymentIntentWithOrder(order_id, client_secret);\r\n return ensureErrorResponse(responseTypes, result.error);\r\n }\r\n // success so finish processing order then redirect to thank you page\r\n let data = {order_id, order_key, [`${getData('name')}_save_source_key`]: savePaymentMethod};\r\n let response = await apiFetch({\r\n url: getRoute('process/payment'),\r\n method: 'POST',\r\n data\r\n })\r\n if (response.messages) {\r\n return ensureErrorResponse(responseTypes, response.messages);\r\n }\r\n return ensureSuccessResponse(responseTypes, {\r\n redirectUrl: response.redirect\r\n });\r\n } else {\r\n return ensureSuccessResponse(responseTypes);\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n return ensureErrorResponse(responseTypes, err);\r\n }\r\n}\r\n\r\n/**\r\n * Convert a payment wallet address to a WC cart address.\r\n * @param address_mappings\r\n * @returns {function(*, *=): {}}\r\n */\r\nexport const toCartAddress = (address_mappings = PAYMENT_REQUEST_ADDRESS_MAPPINGS) => (address, args = {}) => {\r\n const cartAddress = {};\r\n address = {...address, ...filterEmptyValues(args)};\r\n for (let [key, cartKey] of Object.entries(address_mappings)) {\r\n if (address?.[key]) {\r\n if (typeof cartKey === 'function') {\r\n cartKey(cartAddress, address[key]);\r\n } else {\r\n cartAddress[cartKey] = address[key];\r\n }\r\n }\r\n }\r\n return cartAddress;\r\n}\r\n\r\n/**\r\n * Given a WC formatted address, return only the intermediate address values\r\n * @param address\r\n * @param fields\r\n */\r\nexport const getIntermediateAddress = (address, fields = ['city', 'postcode', 'state', 'country']) => {\r\n const intermediateAddress = {};\r\n for (let key of fields) {\r\n intermediateAddress[key] = address[key];\r\n }\r\n return intermediateAddress;\r\n}\r\n\r\n/**\r\n *\r\n * @param values\r\n * @returns {{}|{[p: string]: *}}\r\n */\r\nexport const filterEmptyValues = (values) => {\r\n return Object.keys(values).filter(key => Boolean(values[key])).reduce((obj, key) => ({\r\n ...obj,\r\n [key]: values[key]\r\n }), {});\r\n}\r\n\r\nexport const formatPrice = (price, currencyCode) => {\r\n const {prefix, suffix, decimalSeparator, minorUnit, thousandSeparator} = getCurrency(currencyCode);\r\n if (price == '' || price === undefined) {\r\n return price;\r\n }\r\n\r\n price = typeof price === 'string' ? parseInt(price, 10) : price;\r\n price = price / 10 ** minorUnit;\r\n price = price.toString().replace('.', decimalSeparator);\r\n let fractional = '';\r\n const index = price.indexOf(decimalSeparator);\r\n if (index < 0) {\r\n price += `${decimalSeparator}${new Array(minorUnit + 1).join('0')}`;\r\n } else {\r\n const fractional = price.substr(index + 1);\r\n if (fractional.length < minorUnit) {\r\n price += new Array(minorUnit - fractional.length + 1).join('0');\r\n }\r\n }\r\n\r\n // separate out price and decimals so thousands separator can be added.\r\n ({1: price, 2: fractional} = price.match(new RegExp(`(\\\\d+)\\\\${decimalSeparator}(\\\\d+)`)));\r\n price = price.replace(new RegExp(`\\\\B(?=(\\\\d{3})+(?!\\\\d))`, 'g'), `${thousandSeparator}`);\r\n price = price + decimalSeparator + fractional;\r\n price = prefix + price + suffix;\r\n return price;\r\n}\r\n\r\nexport const getShippingOptions = (shippingRates) => {\r\n let options = [];\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n // sort by selected rate\r\n shippingPackage.shipping_rates.sort((rate) => {\r\n return rate.selected ? -1 : 1;\r\n });\r\n let rates = shippingPackage.shipping_rates.map(rate => {\r\n let txt = document.createElement('textarea');\r\n txt.innerHTML = rate.name;\r\n let price = formatPrice(rate.price, rate.currency_code);\r\n return {\r\n id: getShippingOptionId(idx, rate.rate_id),\r\n label: txt.value,\r\n //detail: `${price}`,\r\n amount: parseInt(rate.price, 10)\r\n }\r\n });\r\n options = [...options, ...rates];\r\n });\r\n return options;\r\n}\r\n\r\nexport const getShippingOptionId = (packageId, rateId) => `${packageId}:${rateId}`\r\n\r\nexport const getDisplayItems = (cartItems, {minorUnit}) => {\r\n let items = [];\r\n cartItems.forEach(item => {\r\n if (0 < item.value) {\r\n items.push({\r\n label: item.label,\r\n pending: false,\r\n amount: item.value\r\n });\r\n }\r\n })\r\n return items;\r\n}\r\n\r\nconst canPay = {};\r\n\r\nexport const canMakePayment = ({country, currency, total}, callback) => {\r\n return new Promise((resolve, reject) => {\r\n const key = [country, currency, total.amount].reduce((key, value) => `${key}-${value}`);\r\n if (!currency) {\r\n return resolve(false);\r\n }\r\n if (key in canPay) {\r\n return resolve(canPay[key]);\r\n }\r\n return initStripe.then(stripe => {\r\n if (stripe.error) {\r\n return reject(stripe.error);\r\n }\r\n const request = stripe.paymentRequest({\r\n country,\r\n currency,\r\n total\r\n });\r\n request.canMakePayment().then(result => {\r\n canPay[key] = callback(result);\r\n return resolve(canPay[key]);\r\n });\r\n }).catch(reject);\r\n });\r\n};\r\n\r\nexport const registerLocalPaymentMethod = (paymentMethod) => {\r\n localPaymentMethods.push(paymentMethod);\r\n}\r\n\r\nexport const getLocalPaymentMethods = () => localPaymentMethods;\r\n\r\nexport const cartContainsPreOrder = () => {\r\n const data = getSetting('stripePaymentData');\r\n return data && data.pre_order;\r\n}\r\n\r\nexport const cartContainsSubscription = () => {\r\n const data = getSetting('stripePaymentData');\r\n return data && data.subscription;\r\n}\r\n\r\nexport const getDefaultSourceArgs = ({type, amount, billingData, currency, returnUrl}) => {\r\n return {\r\n type,\r\n amount,\r\n currency,\r\n owner: getBillingDetailsFromAddress(billingData),\r\n redirect: {\r\n return_url: returnUrl\r\n }\r\n }\r\n}\r\n\r\nexport const isTestMode = () => {\r\n return getSetting('stripeGeneralData').mode === 'test';\r\n}\r\n\r\nconst getCacheKey = (key) => `${CACHE_PREFIX}${key}`;\r\n\r\nexport const storeInCache = (key, value) => {\r\n const exp = Math.floor(new Date().getTime() / 1000) + (60 * 15);\r\n if ('sessionStorage' in window) {\r\n sessionStorage.setItem(getCacheKey(key), JSON.stringify({value, exp}));\r\n }\r\n}\r\n\r\nexport const getFromCache = (key) => {\r\n if ('sessionStorage' in window) {\r\n try {\r\n const item = JSON.parse(sessionStorage.getItem(getCacheKey(key)));\r\n if (item) {\r\n const {value, exp} = item;\r\n if (Math.floor(new Date().getTime() / 1000) > exp) {\r\n deleteFromCache(getCacheKey(key));\r\n } else {\r\n return value;\r\n }\r\n }\r\n } catch (err) {\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport const deleteFromCache = (key) => {\r\n if ('sessionStorage' in window) {\r\n sessionStorage.removeItem(getCacheKey(key));\r\n }\r\n}\r\n\r\nexport const isCartPage = () => getSetting('stripeGeneralData').page === 'cart';\r\n\r\nexport const isCheckoutPage = () => getSetting('stripeGeneralData').page === 'checkout';","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayLikeToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayWithHoles.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/construct.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/createClass.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/extends.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/getPrototypeOf.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/inherits.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/isNativeFunction.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/iterableToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/nonIterableRest.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/nonIterableSpread.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutProperties.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/slicedToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/toConsumableArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/typeof.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/wrapNativeSuper.js","webpack://wc_stripe.[name]/./node_modules/@stripe/react-stripe-js/dist/react-stripe.umd.js","webpack://wc_stripe.[name]/./node_modules/@stripe/stripe-js/dist/stripe.esm.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/checkbox/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/payment-method-label/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/payment-method/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/radio-control-accordion/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/components/checkout/radio-option/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-create-link-token.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-initialize-plaid.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/hooks/use-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/ach/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/applepay/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/applepay/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/bootstrap/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/custom-card-form.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/simple/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/components/stripe-card-form.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/credit-card/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/error-boundary.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/button.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/constants.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-error-message.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payment-request.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/hooks/use-payments-client.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/googlepay/util.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-after-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-breakpoint-width.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-exported-values.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-payment-events.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-payment-request.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-process-checkout-error.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-process-payment-intent.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-setup-intent.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/hooks/use-stripe-error.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/afterpay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/alipay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/bancontact.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/becs.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/eps.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/fpx.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/giropay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/grabpay.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-after-process-local-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-create-source.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/hooks/use-validate-checkout.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/ideal.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/categories.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-create-source.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/hooks/use-process-payment.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/klarna/loader.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/local-payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/multibanco.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/p24.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/sepa.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/sofort.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/local-payment/wechat.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/payment-request/index.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/payment-request/payment-method.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/saved-card-component.js","webpack://wc_stripe.[name]/./packages/blocks/assets/js/payment-methods/util.js","webpack://wc_stripe.[name]/./node_modules/classnames/index.js"],"names":["module","exports","arr","len","length","i","arr2","Array","isArray","arrayLikeToArray","self","ReferenceError","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","fn","this","args","arguments","apply","err","undefined","instance","Constructor","TypeError","setPrototypeOf","isNativeReflectConstruct","_construct","Parent","Class","Reflect","construct","a","push","Function","bind","prototype","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","protoProps","staticProps","obj","_extends","assign","source","hasOwnProperty","call","_getPrototypeOf","o","getPrototypeOf","__proto__","subClass","superClass","create","constructor","__esModule","toString","indexOf","sham","Proxy","Date","e","iter","Symbol","iterator","from","_arr","_n","_d","_e","_s","_i","next","objectWithoutPropertiesLoose","excluded","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","sourceKeys","keys","_typeof","assertThisInitialized","_setPrototypeOf","p","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","arrayWithoutHoles","iterableToArray","nonIterableSpread","minLen","n","slice","name","test","isNativeFunction","_wrapNativeSuper","_cache","Map","has","get","set","Wrapper","React","_objectWithoutProperties","_objectWithoutPropertiesLoose","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_arrayLikeToArray","_unsupportedIterableToArray","_nonIterableRest","emptyFunction","emptyFunctionWithReset","resetWarningCache","propTypes","shim","propName","componentName","location","propFullName","secret","Error","getShim","isRequired","ReactPropTypes","array","bool","func","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","factoryWithThrowingShims","isUnknownObject","raw","PLAIN_OBJECT_STR","isEqual","left","right","leftArray","leftPlainObject","leftKeys","rightKeys","keySet","allKeys","l","r","every","usePrevious","ref","useRef","useEffect","current","validateStripe","maybeStripe","elements","createToken","createPaymentMethod","confirmCardPayment","parseStripeProp","isPromise","tag","stripePromise","stripe","ElementsContext","createContext","displayName","Elements","_ref","rawStripeProp","options","children","_final","isMounted","parsed","useMemo","_React$useState2","useState","ctx","setContext","prevStripe","prevOptions","console","warn","anyStripe","_registerWrapper","version","createElement","Provider","useElementsContextWithUseCase","useCaseMessage","useCase","concat","parseElementsContext","useContext","ElementsConsumer","_ref2","useCallbackReference","cb","extractUpdateableOptions","paymentRequest","noop","createElementComponent","type","isServer","str","charAt","toUpperCase","Element","id","className","_ref$options","_ref$onBlur","onBlur","_ref$onFocus","onFocus","_ref$onReady","onReady","_ref$onChange","onChange","_ref$onEscape","onEscape","_ref$onClick","onClick","elementRef","domNode","callOnReady","callOnBlur","callOnFocus","callOnClick","callOnChange","callOnEscape","useLayoutEffect","mount","on","updateableOptions","update","destroy","__elementType","window","AuBankAccountElement","CardElement","CardNumberElement","CardExpiryElement","CardCvcElement","FpxBankElement","IbanElement","IdealBankElement","P24BankElement","EpsBankElement","PaymentRequestButtonElement","AfterpayClearpayMessageElement","useElements","useStripe","factory","V3_URL","V3_URL_REGEX","EXISTING_SCRIPT_MESSAGE","initStripe","startTime","registerWrapper","stripePromise$1","params","Stripe","script","scripts","document","querySelectorAll","src","findScript","queryString","advancedFraudSignals","headOrBody","head","body","appendChild","injectScript","addEventListener","loadCalled","loadStripe","_len","_key","now","label","checked","aria-hidden","xmlns","viewBox","d","title","icons","paymentMethod","components","Label","PaymentMethodLabel","Icons","PaymentMethodIcons","text","align","getData","content","Content","desc","el","childNodes","classList","add","Description","payment_method","RadioControlAccordion","option","RadioControlOption","event","setValidationError","linkToken","setLinkToken","useCallback","url","getRoute","method","data","response","token","storeInCache","getFromCache","linkHandler","resolvePopup","openLinkPopup","open","Plaid","clientName","env","product","selectAccount","countryCodes","onSuccess","publicToken","metaData","onExit","getErrorMessage","error_message","onPaymentProcessing","responseTypes","unsubscribe","result","deleteFromCache","ensureSuccessResponse","meta","paymentMethodData","JSON","stringify","ensureErrorResponse","getSettings","ACHPaymentContent","eventRegistration","emitResponse","onSubmit","onCheckoutAfterProcessingWithError","ValidationInputError","validationError","useCreateLinkToken","useProcessCheckoutError","subscriber","useInitializePlaid","useProcessPayment","isTestMode","ACHTestModeCredentials","errorMessage","__","registerPaymentMethod","ariaLabel","canMakePayment","cartTotals","currency_code","PaymentMethod","savedTokenComponent","edit","placeOrderButtonLabel","supports","showSavedCards","showSaveOption","features","ApplePayContent","ApplePayButton","onClose","billing","shippingData","activePaymentMethod","noticeContexts","useStripeError","exportedValues","useExportedValues","useExpressBreakpointWidth","width","setPaymentMethod","useProcessPaymentIntent","useAfterProcessingPayment","messageContext","EXPRESS_PAYMENTS","usePaymentRequest","canPay","applePay","handleClick","show","style","ApplePayEdit","registerExpressPaymentMethod","currency","total_price","country","toLowerCase","total","amount","parseInt","Bootstrap","CardIcon","htmlFor","registerCreditCardForm","breakpoint","component","classes","focus","empty","invalid","eventChange","innerWidth","cardType","setCardType","elementOrder","container","setContainer","getCreditCardForm","CardForm","postalCodeEnabled","forEach","setElementOrder","includes","useBreakpointWidth","getCardIconSrc","icon","cloneElement","brand","complete","idx","nextElement","getElement","sprintf","SimpleForm","data-tid","cardOptions","postalCode","billingData","postcode","hidePostalCode","isFieldRequired","iconStyle","displaySaveCard","customerId","isUserLoggedIn","cartContainsSubscription","cartContainsPreOrder","CreditCardContent","setError","catch","CreditCardElement","savePaymentMethod","setSavePaymentMethod","getPaymentMethodArgs","elType","card","useSetupIntent","cartTotal","setupIntent","removeSetupIntent","Tag","CustomCardForm","StripeCardForm","SavePaymentMethod","state","hasError","errorInfo","setState","componentStack","Component","publishableKey","setErrorMessage","checkoutStatus","merchantInfo","merchantId","merchantName","buttonContainer","buttonType","usePaymentsClient","button","removeButton","append","parameters","allowedAuthMethods","allowedCardNetworks","assuranceDetailsRequired","apiVersion","apiVersionMinor","shippingRates","processingCountry","totalPriceLabel","emailRequired","isEmpty","email","allowedPaymentMethods","tokenizationSpecification","gateway","BASE_PAYMENT_METHOD","shippingAddressRequired","needsShipping","transactionInfo","getTransactionInfo","callbackIntents","BASE_PAYMENT_REQUEST","billingAddressRequired","billingAddressParameters","format","phoneNumberRequired","phone","shippingOptionRequired","shippingOptionParameters","getShippingOptionParameters","shippingOptions","cartTotalItems","environment","paymentsClient","setPaymentsClient","setButton","currentBilling","currentShipping","addPaymentEvent","usePaymentEvents","setAddressData","paymentData","billingAddress","isAddressValid","phoneNumber","toCartAddress","shippingAddress","parentElement","firstChild","removeChild","loadPaymentData","parse","tokenizationData","billing_details","getBillingDetailsFromAddress","StripeError","statusCode","log","createButton","paymentOptions","paymentDataCallbacks","onPaymentAuthorized","transactionState","onPaymentDataChanged","shipping","address","shippingOptionData","intermediateAddress","selectedRates","getSelectedShippingOption","addressEqual","getIntermediateAddress","shippingEqual","success","getPaymentRequestUpdate","reason","message","intent","setShippingAddress","setSelectedRates","google","payments","api","PaymentsClient","isReadyToPayRequest","isReadyToPay","GooglePayContent","useErrorMessage","GooglePayEdit","isCartPage","getSetting","status","countryCode","currencyCode","code","totalPriceStatus","totalPrice","removeNumberPrecision","minorUnit","displayItems","getDisplayItems","newTransactionInfo","newShippingOptionParameters","unit","items","item","price","getShippingOptions","defaultSelectedOptionId","map","shift","shippingPackage","shipping_rates","rate","selected","getShippingOptionId","rate_id","rates","txt","innerHTML","formatPrice","description","first_name","split","join","last_name","pop","address1","address2","locality","administrativeArea","onCheckoutAfterProcessingWithSuccess","unsubscribeAfterProcessingWithSuccess","redirectUrl","handleCardAction","windowWidth","setWindowWith","getMaxWidth","maxWidth","setMaxWidth","clientWidth","remove","handleResize","removeEventListener","getElementById","parentNode","onShippingRateSuccess","onShippingRateFail","onShippingRateSelectSuccess","handler","setHandler","onShippingChanged","paymentEvents","setPaymentEvent","execute","removePaymentEvent","isSelectingRate","shippingRatesLoading","hasShippingRates","unsubscribeShippingRateSuccess","unsubscribeShippingRateSelectSuccess","unsubscribeShippingRateFail","hasInvalidAddress","setPaymentRequest","paymentRequestOptions","pending","requestPayerName","requestPayerEmail","requestPayerPhone","requestShipping","onShippingAddressChange","onShippingOptionChange","onPaymentMethodReceived","updatePaymentEvent","updateWith","shippingOption","paymentResponse","payerName","payerEmail","payerPhone","processingResponse","paymentDetails","stripeErrorMessage","ERROR","paymentType","currentPaymentMethodArgs","getCreatePaymentMethodArgs","getSuccessResponse","paymentMethodId","unsubscribeProcessingPayment","confirmCardSetup","client_secret","setSetupIntent","createSetupIntent","variablesHandler","isEligible","variables","setVariables","locale","AfterpayPaymentMethod","settings","cartNeedsShipping","requiredParams","LocalPaymentIntentContent","confirmationMethod","LocalPaymentSourceContent","currentBillingData","match","atob","decodeURIComponent","return_url","getSourceArgs","setSource","isValid","setIsValid","currentValues","getSourceArgsInternal","getDefaultSourceArgs","returnUrl","getSuccessData","sourceId","createSource","msg","categories","category","KlarnaPaymentCategory","Klarna","Payments","load","payment_method_category","abortController","AbortController","currentSourceArgs","oldSourceArgs","isLoading","setIsLoading","isCheckoutValid","getLineItems","quantity","source_order","klarna","purchase_country","custom_payment_methods","shipping_first_name","shipping_last_name","city","line1","address_1","line2","address_2","postal_code","compareSourceArgs","args2","newArgs","getArgs","args1","updateSource","updates","source_id","abort","signal","reduce","k","paymentCategory","authorize","approved","KlarnaContainer","KlarnaPaymentMethod","setSelected","klarnaInitialized","setKlarnaInitialized","getCategoriesFromSource","paymentMethodCategories","payment_method_categories","useCreateSource","init","client_token","KlarnaPaymentCategories","KlarnaLoader","callback","countries","LocalPaymentIntentMethod","LocalPaymentSourceMethod","LocalPaymentElementContainer","useValidateCheckout","useAfterProcessLocalPayment","PAYMENT","SepaPaymentMethod","mandate","notification_method","interval","sofort","WeChatComponent","WeChatPaymentMethod","deleteSourceFromStorage","QRCodeComponent","wechat","qr_code_url","height","colorDark","colorLight","correctLevel","QRCode","CorrectLevel","H","createSourceTimeoutId","clearTimeout","setTimeout","PaymentRequestContent","PaymentRequestButton","paymentRequestButton","PaymentRequestEdit","canvas","scale","devicePixelRatio","getContext","beginPath","arc","Math","PI","fillStyle","fill","handleSuccessResult","unsubscribeOnCheckoutAfterProcessingWithSuccess","account","messages","countryLocale","SHIPPING_OPTION_REGEX","routes","creditCardForms","localPaymentMethods","PAYMENT_REQUEST_ADDRESS_MAPPINGS","recipient","addressLine","region","stripeAccount","route","SUCCESS","statusMessage","exclude","fields","getLocaleFields","entries","required","localeFields","default","field","packageIdx","filter","Boolean","syncPaymentIntentWithOrder","order_id","order_key","redirect","address_mappings","cartAddress","filterEmptyValues","cartKey","values","getCurrency","prefix","suffix","decimalSeparator","thousandSeparator","fractional","index","replace","substr","RegExp","sort","packageId","rateId","cartItems","pre_order","subscription","owner","mode","getCacheKey","exp","floor","getTime","sessionStorage","setItem","getItem","removeItem","ver1","ver2","compare","page","hasOwn","classNames","argType","inner"],"mappings":";8FAUAA,EAAOC,QAVP,SAA2BC,EAAKC,IACnB,MAAPA,GAAeA,EAAMD,EAAIE,UAAQD,EAAMD,EAAIE,QAE/C,IAAK,IAAIC,EAAI,EAAGC,EAAO,IAAIC,MAAMJ,GAAME,EAAIF,EAAKE,IAC9CC,EAAKD,GAAKH,EAAIG,GAGhB,OAAOC,I,SCHTN,EAAOC,QAJP,SAAyBC,GACvB,GAAIK,MAAMC,QAAQN,GAAM,OAAOA,I,eCDjC,IAAIO,EAAmB,EAAQ,MAM/BT,EAAOC,QAJP,SAA4BC,GAC1B,GAAIK,MAAMC,QAAQN,GAAM,OAAOO,EAAiBP,K,SCKlDF,EAAOC,QARP,SAAgCS,GAC9B,QAAa,IAATA,EAC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K7C,EAAKD,IAAQC,EAAID,IAChCmb,EAAQzZ,KAAK1B,IAMjB,OAAOmb,EAAQwM,KAAK,KAGgB7oB,EAAOC,SAC3Cs5B,EAAW7C,QAAU6C,EACrBv5B,EAAOC,QAAUs5B,QAKhB,KAFwB,EAAF,WACtB,OAAOA,GACP,QAFoB,OAEpB,aAxCH,I","file":"commons.js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;","function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;","var _typeof = require(\"@babel/runtime/helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :\n typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :\n (global = global || self, factory(global.ReactStripe = {}, global.React));\n}(this, (function (exports, React) { 'use strict';\n\n React = React && Object.prototype.hasOwnProperty.call(React, 'default') ? React['default'] : React;\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n /**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n var ReactPropTypesSecret_1 = ReactPropTypesSecret;\n\n function emptyFunction() {}\n\n function emptyFunctionWithReset() {}\n\n emptyFunctionWithReset.resetWarningCache = emptyFunction;\n\n var factoryWithThrowingShims = function () {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret_1) {\n // It is still safe when called from React.\n return;\n }\n\n var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');\n err.name = 'Invariant Violation';\n throw err;\n }\n shim.isRequired = shim;\n\n function getShim() {\n return shim;\n }\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n ReactPropTypes.PropTypes = ReactPropTypes;\n return ReactPropTypes;\n };\n\n var propTypes = createCommonjsModule(function (module) {\n /**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = factoryWithThrowingShims();\n }\n });\n\n var isUnknownObject = function isUnknownObject(raw) {\n return raw !== null && _typeof(raw) === 'object';\n };\n var isPromise = function isPromise(raw) {\n return isUnknownObject(raw) && typeof raw.then === 'function';\n }; // We are using types to enforce the `stripe` prop in this lib,\n // but in an untyped integration `stripe` could be anything, so we need\n // to do some sanity validation to prevent type errors.\n\n var isStripe = function isStripe(raw) {\n return isUnknownObject(raw) && typeof raw.elements === 'function' && typeof raw.createToken === 'function' && typeof raw.createPaymentMethod === 'function' && typeof raw.confirmCardPayment === 'function';\n };\n\n var PLAIN_OBJECT_STR = '[object Object]';\n var isEqual = function isEqual(left, right) {\n if (!isUnknownObject(left) || !isUnknownObject(right)) {\n return left === right;\n }\n\n var leftArray = Array.isArray(left);\n var rightArray = Array.isArray(right);\n if (leftArray !== rightArray) return false;\n var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR;\n var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR;\n if (leftPlainObject !== rightPlainObject) return false;\n if (!leftPlainObject && !leftArray) return false;\n var leftKeys = Object.keys(left);\n var rightKeys = Object.keys(right);\n if (leftKeys.length !== rightKeys.length) return false;\n var keySet = {};\n\n for (var i = 0; i < leftKeys.length; i += 1) {\n keySet[leftKeys[i]] = true;\n }\n\n for (var _i = 0; _i < rightKeys.length; _i += 1) {\n keySet[rightKeys[_i]] = true;\n }\n\n var allKeys = Object.keys(keySet);\n\n if (allKeys.length !== leftKeys.length) {\n return false;\n }\n\n var l = left;\n var r = right;\n\n var pred = function pred(key) {\n return isEqual(l[key], r[key]);\n };\n\n return allKeys.every(pred);\n };\n\n var usePrevious = function usePrevious(value) {\n var ref = React.useRef(value);\n React.useEffect(function () {\n ref.current = value;\n }, [value]);\n return ref.current;\n };\n\n var INVALID_STRIPE_ERROR = 'Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.'; // We are using types to enforce the `stripe` prop in this lib, but in a real\n // integration `stripe` could be anything, so we need to do some sanity\n // validation to prevent type errors.\n\n var validateStripe = function validateStripe(maybeStripe) {\n if (maybeStripe === null || isStripe(maybeStripe)) {\n return maybeStripe;\n }\n\n throw new Error(INVALID_STRIPE_ERROR);\n };\n\n var parseStripeProp = function parseStripeProp(raw) {\n if (isPromise(raw)) {\n return {\n tag: 'async',\n stripePromise: Promise.resolve(raw).then(validateStripe)\n };\n }\n\n var stripe = validateStripe(raw);\n\n if (stripe === null) {\n return {\n tag: 'empty'\n };\n }\n\n return {\n tag: 'sync',\n stripe: stripe\n };\n };\n\n var ElementsContext = /*#__PURE__*/React.createContext(null);\n ElementsContext.displayName = 'ElementsContext';\n var parseElementsContext = function parseElementsContext(ctx, useCase) {\n if (!ctx) {\n throw new Error(\"Could not find Elements context; You need to wrap the part of your app that \".concat(useCase, \" in an <Elements> provider.\"));\n }\n\n return ctx;\n };\n /**\n * The `Elements` provider allows you to use [Element components](https://stripe.com/docs/stripe-js/react#element-components) and access the [Stripe object](https://stripe.com/docs/js/initializing) in any nested component.\n * Render an `Elements` provider at the root of your React app so that it is available everywhere you need it.\n *\n * To use the `Elements` provider, call `loadStripe` from `@stripe/stripe-js` with your publishable key.\n * The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.\n * Pass the returned `Promise` to `Elements`.\n *\n * @docs https://stripe.com/docs/stripe-js/react#elements-provider\n */\n\n var Elements = function Elements(_ref) {\n var rawStripeProp = _ref.stripe,\n options = _ref.options,\n children = _ref.children;\n\n var _final = React.useRef(false);\n\n var isMounted = React.useRef(true);\n var parsed = React.useMemo(function () {\n return parseStripeProp(rawStripeProp);\n }, [rawStripeProp]);\n\n var _React$useState = React.useState(function () {\n return {\n stripe: null,\n elements: null\n };\n }),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n ctx = _React$useState2[0],\n setContext = _React$useState2[1];\n\n var prevStripe = usePrevious(rawStripeProp);\n var prevOptions = usePrevious(options);\n\n if (prevStripe !== null) {\n if (prevStripe !== rawStripeProp) {\n console.warn('Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.');\n }\n\n if (!isEqual(options, prevOptions)) {\n console.warn('Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.');\n }\n }\n\n if (!_final.current) {\n if (parsed.tag === 'sync') {\n _final.current = true;\n setContext({\n stripe: parsed.stripe,\n elements: parsed.stripe.elements(options)\n });\n }\n\n if (parsed.tag === 'async') {\n _final.current = true;\n parsed.stripePromise.then(function (stripe) {\n if (stripe && isMounted.current) {\n // Only update Elements context if the component is still mounted\n // and stripe is not null. We allow stripe to be null to make\n // handling SSR easier.\n setContext({\n stripe: stripe,\n elements: stripe.elements(options)\n });\n }\n });\n }\n }\n\n React.useEffect(function () {\n return function () {\n isMounted.current = false;\n };\n }, []);\n React.useEffect(function () {\n var anyStripe = ctx.stripe;\n\n if (!anyStripe || !anyStripe._registerWrapper) {\n return;\n }\n\n anyStripe._registerWrapper({\n name: 'react-stripe-js',\n version: \"1.4.0\"\n });\n }, [ctx.stripe]);\n return /*#__PURE__*/React.createElement(ElementsContext.Provider, {\n value: ctx\n }, children);\n };\n Elements.propTypes = {\n stripe: propTypes.any,\n options: propTypes.object\n };\n var useElementsContextWithUseCase = function useElementsContextWithUseCase(useCaseMessage) {\n var ctx = React.useContext(ElementsContext);\n return parseElementsContext(ctx, useCaseMessage);\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#useelements-hook\n */\n\n var useElements = function useElements() {\n var _useElementsContextWi = useElementsContextWithUseCase('calls useElements()'),\n elements = _useElementsContextWi.elements;\n\n return elements;\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#usestripe-hook\n */\n\n var useStripe = function useStripe() {\n var _useElementsContextWi2 = useElementsContextWithUseCase('calls useStripe()'),\n stripe = _useElementsContextWi2.stripe;\n\n return stripe;\n };\n /**\n * @docs https://stripe.com/docs/stripe-js/react#elements-consumer\n */\n\n var ElementsConsumer = function ElementsConsumer(_ref2) {\n var children = _ref2.children;\n var ctx = useElementsContextWithUseCase('mounts <ElementsConsumer>'); // Assert to satisfy the busted React.FC return type (it should be ReactNode)\n\n return children(ctx);\n };\n ElementsConsumer.propTypes = {\n children: propTypes.func.isRequired\n };\n\n var useCallbackReference = function useCallbackReference(cb) {\n var ref = React.useRef(cb);\n React.useEffect(function () {\n ref.current = cb;\n }, [cb]);\n return function () {\n if (ref.current) {\n ref.current.apply(ref, arguments);\n }\n };\n };\n\n var extractUpdateableOptions = function extractUpdateableOptions(options) {\n if (!isUnknownObject(options)) {\n return {};\n }\n\n var _ = options.paymentRequest,\n rest = _objectWithoutProperties(options, [\"paymentRequest\"]);\n\n return rest;\n };\n\n var noop = function noop() {};\n\n var capitalized = function capitalized(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n var createElementComponent = function createElementComponent(type, isServer) {\n var displayName = \"\".concat(capitalized(type), \"Element\");\n\n var ClientElement = function ClientElement(_ref) {\n var id = _ref.id,\n className = _ref.className,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n _ref$onBlur = _ref.onBlur,\n onBlur = _ref$onBlur === void 0 ? noop : _ref$onBlur,\n _ref$onFocus = _ref.onFocus,\n onFocus = _ref$onFocus === void 0 ? noop : _ref$onFocus,\n _ref$onReady = _ref.onReady,\n onReady = _ref$onReady === void 0 ? noop : _ref$onReady,\n _ref$onChange = _ref.onChange,\n onChange = _ref$onChange === void 0 ? noop : _ref$onChange,\n _ref$onEscape = _ref.onEscape,\n onEscape = _ref$onEscape === void 0 ? noop : _ref$onEscape,\n _ref$onClick = _ref.onClick,\n onClick = _ref$onClick === void 0 ? noop : _ref$onClick;\n\n var _useElementsContextWi = useElementsContextWithUseCase(\"mounts <\".concat(displayName, \">\")),\n elements = _useElementsContextWi.elements;\n\n var elementRef = React.useRef(null);\n var domNode = React.useRef(null);\n var callOnReady = useCallbackReference(onReady);\n var callOnBlur = useCallbackReference(onBlur);\n var callOnFocus = useCallbackReference(onFocus);\n var callOnClick = useCallbackReference(onClick);\n var callOnChange = useCallbackReference(onChange);\n var callOnEscape = useCallbackReference(onEscape);\n React.useLayoutEffect(function () {\n if (elementRef.current == null && elements && domNode.current != null) {\n var element = elements.create(type, options);\n elementRef.current = element;\n element.mount(domNode.current);\n element.on('ready', function () {\n return callOnReady(element);\n });\n element.on('change', callOnChange);\n element.on('blur', callOnBlur);\n element.on('focus', callOnFocus);\n element.on('escape', callOnEscape); // Users can pass an an onClick prop on any Element component\n // just as they could listen for the `click` event on any Element,\n // but only the PaymentRequestButton will actually trigger the event.\n\n element.on('click', callOnClick);\n }\n });\n var prevOptions = React.useRef(options);\n React.useEffect(function () {\n if (prevOptions.current && prevOptions.current.paymentRequest !== options.paymentRequest) {\n console.warn('Unsupported prop change: options.paymentRequest is not a customizable property.');\n }\n\n var updateableOptions = extractUpdateableOptions(options);\n\n if (Object.keys(updateableOptions).length !== 0 && !isEqual(updateableOptions, extractUpdateableOptions(prevOptions.current))) {\n if (elementRef.current) {\n elementRef.current.update(updateableOptions);\n prevOptions.current = options;\n }\n }\n }, [options]);\n React.useLayoutEffect(function () {\n return function () {\n if (elementRef.current) {\n elementRef.current.destroy();\n }\n };\n }, []);\n return /*#__PURE__*/React.createElement(\"div\", {\n id: id,\n className: className,\n ref: domNode\n });\n }; // Only render the Element wrapper in a server environment.\n\n\n var ServerElement = function ServerElement(props) {\n // Validate that we are in the right context by calling useElementsContextWithUseCase.\n useElementsContextWithUseCase(\"mounts <\".concat(displayName, \">\"));\n var id = props.id,\n className = props.className;\n return /*#__PURE__*/React.createElement(\"div\", {\n id: id,\n className: className\n });\n };\n\n var Element = isServer ? ServerElement : ClientElement;\n Element.propTypes = {\n id: propTypes.string,\n className: propTypes.string,\n onChange: propTypes.func,\n onBlur: propTypes.func,\n onFocus: propTypes.func,\n onReady: propTypes.func,\n onClick: propTypes.func,\n options: propTypes.object\n };\n Element.displayName = displayName;\n Element.__elementType = type;\n return Element;\n };\n\n var isServer = typeof window === 'undefined';\n /**\n * Requires beta access:\n * Contact [Stripe support](https://support.stripe.com/) for more information.\n *\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var AuBankAccountElement = createElementComponent('auBankAccount', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardElement = createElementComponent('card', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardNumberElement = createElementComponent('cardNumber', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardExpiryElement = createElementComponent('cardExpiry', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var CardCvcElement = createElementComponent('cardCvc', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var FpxBankElement = createElementComponent('fpxBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var IbanElement = createElementComponent('iban', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var IdealBankElement = createElementComponent('idealBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var P24BankElement = createElementComponent('p24Bank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var EpsBankElement = createElementComponent('epsBank', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var PaymentRequestButtonElement = createElementComponent('paymentRequestButton', isServer);\n /**\n * @docs https://stripe.com/docs/stripe-js/react#element-components\n */\n\n var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);\n\n exports.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;\n exports.AuBankAccountElement = AuBankAccountElement;\n exports.CardCvcElement = CardCvcElement;\n exports.CardElement = CardElement;\n exports.CardExpiryElement = CardExpiryElement;\n exports.CardNumberElement = CardNumberElement;\n exports.Elements = Elements;\n exports.ElementsConsumer = ElementsConsumer;\n exports.EpsBankElement = EpsBankElement;\n exports.FpxBankElement = FpxBankElement;\n exports.IbanElement = IbanElement;\n exports.IdealBankElement = IdealBankElement;\n exports.P24BankElement = P24BankElement;\n exports.PaymentRequestButtonElement = PaymentRequestButtonElement;\n exports.useElements = useElements;\n exports.useStripe = useStripe;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","var V3_URL = 'https://js.stripe.com/v3';\nvar V3_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/;\nvar EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';\nvar findScript = function findScript() {\n var scripts = document.querySelectorAll(\"script[src^=\\\"\".concat(V3_URL, \"\\\"]\"));\n\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n\n if (!V3_URL_REGEX.test(script.src)) {\n continue;\n }\n\n return script;\n }\n\n return null;\n};\n\nvar injectScript = function injectScript(params) {\n var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';\n var script = document.createElement('script');\n script.src = \"\".concat(V3_URL).concat(queryString);\n var headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');\n }\n\n headOrBody.appendChild(script);\n return script;\n};\n\nvar registerWrapper = function registerWrapper(stripe, startTime) {\n if (!stripe || !stripe._registerWrapper) {\n return;\n }\n\n stripe._registerWrapper({\n name: 'stripe-js',\n version: \"1.12.1\",\n startTime: startTime\n });\n};\n\nvar stripePromise = null;\nvar loadScript = function loadScript(params) {\n // Ensure that we only attempt to load Stripe.js at most once\n if (stripePromise !== null) {\n return stripePromise;\n }\n\n stripePromise = new Promise(function (resolve, reject) {\n if (typeof window === 'undefined') {\n // Resolve to null when imported server side. This makes the module\n // safe to import in an isomorphic code base.\n resolve(null);\n return;\n }\n\n if (window.Stripe && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n }\n\n if (window.Stripe) {\n resolve(window.Stripe);\n return;\n }\n\n try {\n var script = findScript();\n\n if (script && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n } else if (!script) {\n script = injectScript(params);\n }\n\n script.addEventListener('load', function () {\n if (window.Stripe) {\n resolve(window.Stripe);\n } else {\n reject(new Error('Stripe.js not available'));\n }\n });\n script.addEventListener('error', function () {\n reject(new Error('Failed to load Stripe.js'));\n });\n } catch (error) {\n reject(error);\n return;\n }\n });\n return stripePromise;\n};\nvar initStripe = function initStripe(maybeStripe, args, startTime) {\n if (maybeStripe === null) {\n return null;\n }\n\n var stripe = maybeStripe.apply(undefined, args);\n registerWrapper(stripe, startTime);\n return stripe;\n};\n\n// own script injection.\n\nvar stripePromise$1 = Promise.resolve().then(function () {\n return loadScript(null);\n});\nvar loadCalled = false;\nstripePromise$1[\"catch\"](function (err) {\n if (!loadCalled) {\n console.warn(err);\n }\n});\nvar loadStripe = function loadStripe() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n loadCalled = true;\n var startTime = Date.now();\n return stripePromise$1.then(function (maybeStripe) {\n return initStripe(maybeStripe, args, startTime);\n });\n};\n\nexport { loadStripe };\n","import classNames from 'classnames';\r\nimport './styles.scss';\r\n\r\nexport const SavePaymentMethod = ({label, onChange, checked}) => {\r\n return (\r\n <div className='wc-stripe-save-payment-method'>\r\n <label>\r\n <input type='checkbox' onChange={(e) => onChange(e.target.checked)}/>\r\n <svg\r\n className={classNames('wc-stripe-components-checkbox__mark', {checked: checked})}\r\n aria-hidden=\"true\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 20\">\r\n <path d=\"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z\"/>\r\n </svg>\r\n </label>\r\n <span>{label}</span>\r\n </div>\r\n )\r\n}","export * from './payment-method-label';\r\nexport * from './checkbox';\r\nexport * from './radio-option';\r\nexport * from './payment-method';","import './style.scss';\r\n\r\nexport const PaymentMethodLabel = ({title, icons, paymentMethod, ...props}) => {\r\n const {PaymentMethodLabel: Label, PaymentMethodIcons: Icons} = props.components;\r\n if (!Array.isArray(icons)) {\r\n icons = [icons];\r\n }\r\n return (\r\n <span className={`wc-stripe-label-container ${paymentMethod}`}>\r\n <Label text={title}/>\r\n <Icons icons={icons} align='left'/>\r\n </span>\r\n )\r\n}","import {useEffect, useRef} from '@wordpress/element';\r\n\r\nexport const PaymentMethod = ({getData, content, ...props}) => {\r\n const Content = content;\r\n const desc = getData('description');\r\n const el = useRef(null);\r\n useEffect(() => {\r\n if (el.current && el.current.childNodes.length == 0) {\r\n el.current.classList.add('no-content');\r\n }\r\n });\r\n return (\r\n <>\r\n {desc && <Description desc={desc} payment_method={getData('name')}/>}\r\n <div ref={el} className='wc-stripe-blocks-payment-method-content'>\r\n <Content {...{...props, getData}}/>\r\n </div>\r\n </>);\r\n}\r\n\r\nconst Description = ({desc, payment_method}) => {\r\n return (\r\n <div className={`wc-stripe-blocks-payment-method__desc ${payment_method}`}>\r\n <p>{desc}</p>\r\n </div>\r\n )\r\n}","import RadioControlOption from '../radio-option';\r\nimport classnames from 'classnames';\r\n\r\nexport const RadioControlAccordion = ({option, checked, onChange}) => {\r\n const {label, value} = option;\r\n return (\r\n <div className='wc-stripe-blocks-radio-accordion'>\r\n <RadioControlOption checked={checked} onChange={onChange} value={value} label={label}/>\r\n <div\r\n className={classnames('wc-stripe-blocks-radio-accordion__content', {\r\n 'wc-stripe-blocks-radio-accordion__content-visible': checked\r\n })}>\r\n {option.content}\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default RadioControlAccordion;","import classnames from 'classnames';\r\n\r\nexport const RadioControlOption = ({checked, onChange, value, label}) => {\r\n return (\r\n <label\r\n className={classnames('wc-stripe-blocks-radio-control__option', {\r\n 'wc-stripe-blocks-radio-control__option-checked': checked\r\n })}>\r\n <input\r\n className='wc-stripe-blocks-radio-control__input'\r\n type='radio'\r\n value={value}\r\n checked={checked}\r\n onChange={(event) => onChange(event.target.value)}/>\r\n <div className='wc-stripe-blocks-radio-control__label'>\r\n <span>{label}</span>\r\n </div>\r\n </label>\r\n )\r\n}\r\n\r\nexport default RadioControlOption;","export * from './use-create-link-token';\r\nexport * from './use-initialize-plaid';\r\nexport * from './use-process-payment';","import {useEffect, useState, useCallback} from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {getRoute, getFromCache, storeInCache} from '../../util';\r\n\r\nexport const useCreateLinkToken = (\r\n {\r\n setValidationError\r\n }) => {\r\n const [linkToken, setLinkToken] = useState(false);\r\n\r\n const createToken = useCallback(async () => {\r\n try {\r\n const response = await apiFetch({\r\n url: getRoute('create/linkToken'),\r\n method: 'POST',\r\n data: {}\r\n });\r\n if (response.token) {\r\n storeInCache('linkToken', response.token);\r\n setLinkToken(response.token);\r\n }\r\n } catch (err) {\r\n setValidationError(err);\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!linkToken) {\r\n const token = getFromCache('linkToken');\r\n if (token) {\r\n // cached token exist so use it\r\n setLinkToken(token);\r\n } else {\r\n // create the Plaid Link token\r\n createToken();\r\n }\r\n }\r\n }, [\r\n linkToken,\r\n setLinkToken\r\n ]);\r\n return linkToken;\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport Plaid from '@plaid';\r\nimport {getErrorMessage} from \"../../util\";\r\n\r\nexport const useInitializePlaid = (\r\n {\r\n getData,\r\n linkToken\r\n }) => {\r\n const linkHandler = useRef(null);\r\n const resolvePopup = useRef(null);\r\n const openLinkPopup = useCallback(() => new Promise((resolve, reject) => {\r\n resolvePopup.current = {resolve, reject};\r\n linkHandler.current.open();\r\n }), []);\r\n\r\n // if the token exists, initialize Plaid's link handler\r\n useEffect(() => {\r\n if (linkToken) {\r\n linkHandler.current = Plaid.create({\r\n clientName: getData('clientName'),\r\n env: getData('plaidEnvironment'),\r\n product: ['auth'],\r\n token: linkToken,\r\n selectAccount: true,\r\n countryCodes: ['US'],\r\n onSuccess: (publicToken, metaData) => {\r\n resolvePopup.current.resolve({publicToken, metaData});\r\n },\r\n onExit: (err) => {\r\n resolvePopup.current.reject(err ? getErrorMessage(err.error_message) : false);\r\n }\r\n });\r\n }\r\n }, [linkToken]);\r\n\r\n return openLinkPopup;\r\n}","import {useEffect, useCallback} from '@wordpress/element';\r\nimport {ensureSuccessResponse, ensureErrorResponse, deleteFromCache} from \"../../util\";\r\n\r\nexport const useProcessPayment = (\r\n {\r\n openLinkPopup,\r\n onPaymentProcessing,\r\n responseTypes,\r\n paymentMethod\r\n\r\n }) => {\r\n\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(async () => {\r\n try {\r\n // open the Plaid popup\r\n const result = await openLinkPopup();\r\n const {publicToken, metaData} = result;\r\n // remove the cached link token.\r\n deleteFromCache('linkToken');\r\n return ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${paymentMethod}_token_key`]: publicToken,\r\n [`${paymentMethod}_metadata`]: JSON.stringify(metaData)\r\n }\r\n }\r\n });\r\n } catch (err) {\r\n return ensureErrorResponse(responseTypes, err);\r\n }\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n onPaymentProcessing,\r\n responseTypes,\r\n openLinkPopup\r\n ]);\r\n}","import './styles.scss';\r\nimport './payment-method'","import {useState} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, isTestMode} from '../util';\r\nimport {PaymentMethodLabel, PaymentMethod} from '../../components/checkout';\r\nimport SavedCardComponent from '../saved-card-component';\r\nimport {useCreateLinkToken, useInitializePlaid, useProcessPayment} from './hooks';\r\nimport {useProcessCheckoutError} from \"../hooks\";\r\nimport {__} from '@wordpress/i18n';\r\n\r\nconst getData = getSettings('stripe_ach_data');\r\n\r\nconst ACHPaymentContent = (\r\n {\r\n getData,\r\n eventRegistration,\r\n components,\r\n emitResponse,\r\n onSubmit,\r\n ...props\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {ValidationInputError} = components;\r\n const [validationError, setValidationError] = useState(false);\r\n\r\n const linkToken = useCreateLinkToken({setValidationError});\r\n\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError\r\n });\r\n\r\n const openLinkPopup = useInitializePlaid({\r\n getData,\r\n linkToken,\r\n onSubmit\r\n });\r\n\r\n useProcessPayment({\r\n openLinkPopup,\r\n onPaymentProcessing,\r\n responseTypes,\r\n paymentMethod: getData('name')\r\n });\r\n return (\r\n <>\r\n {isTestMode && <ACHTestModeCredentials/>}\r\n {validationError && <ValidationInputError errorMessage={validationError}/>}\r\n </>\r\n )\r\n}\r\n\r\nconst ACHTestModeCredentials = () => {\r\n return (\r\n <div className='wc-stripe-blocks-ach__creds'>\r\n <label className='wc-stripe-blocks-ach__creds-label'>{__('Test Credentials', 'woo-stripe-payment')}</label>\r\n <div className='wc-stripe-blocks-ach__username'>\r\n <div>\r\n <strong>{__('username', 'woo-stripe-payment')}</strong>: user_good\r\n </div>\r\n <div>\r\n <strong>{__('password', 'woo-stripe-payment')}</strong>: pass_good\r\n </div>\r\n <div>\r\n <strong>{__('pin', 'woo-stripe-payment')}</strong>: credential_good\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\nregisterPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icons')}/>,\r\n ariaLabel: 'ACH Payment',\r\n canMakePayment: ({cartTotals}) => cartTotals.currency_code === 'USD',\r\n content: <PaymentMethod\r\n getData={getData}\r\n content={ACHPaymentContent}/>,\r\n savedTokenComponent: <SavedCardComponent getData={getData}/>,\r\n edit: <ACHPaymentContent getData={getData}/>,\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n})","import './style.scss';\r\n\r\nimport './payment-method';","import {useCallback} from '@wordpress/element';\r\nimport {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, canMakePayment} from \"../util\";\r\nimport {Elements, PaymentRequestButtonElement, useStripe} from \"@stripe/react-stripe-js\";\r\nimport ErrorBoundary from \"../error-boundary\";\r\nimport {\r\n usePaymentRequest,\r\n useProcessPaymentIntent,\r\n useExportedValues,\r\n useAfterProcessingPayment,\r\n useStripeError,\r\n useExpressBreakpointWidth\r\n} from '../hooks';\r\n\r\nconst getData = getSettings('stripe_applepay_data');\r\n\r\nconst ApplePayContent = (props) => {\r\n return (\r\n <ErrorBoundary>\r\n <div className='wc-stripe-apple-pay-container'>\r\n <Elements stripe={loadStripe}>\r\n <ApplePayButton {...props}/>\r\n </Elements>\r\n </div>\r\n </ErrorBoundary>\r\n );\r\n}\r\n\r\nconst ApplePayButton = (\r\n {\r\n getData,\r\n onClick,\r\n onClose,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n emitResponse,\r\n onSubmit,\r\n activePaymentMethod,\r\n ...props\r\n }) => {\r\n const {onPaymentProcessing} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const stripe = useStripe();\r\n const [error] = useStripeError();\r\n const canPay = (result) => result != null && result.applePay;\r\n const exportedValues = useExportedValues();\r\n useExpressBreakpointWidth({payment_method: getData('name'), width: 300});\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n exportedValues\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n messageContext: noticeContexts.EXPRESS_PAYMENTS\r\n });\r\n const {paymentRequest} = usePaymentRequest({\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n });\r\n\r\n const handleClick = useCallback(() => {\r\n if (paymentRequest) {\r\n onClick();\r\n paymentRequest.show();\r\n }\r\n }, [paymentRequest]);\r\n\r\n if (paymentRequest) {\r\n return (\r\n <button\r\n className={`apple-pay-button ${getData('buttonStyle')}`}\r\n style={{\r\n '-apple-pay-button-type': getData('buttonType')\r\n }}\r\n onClick={handleClick}/>\r\n\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst ApplePayEdit = ({getData, ...props}) => {\r\n return (\r\n <div className={'apple-pay-block-editor'}>\r\n <img src={getData('editorIcon')}/>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: ({cartTotals, ...props}) => {\r\n if (getData('isAdmin')) {\r\n return true;\r\n }\r\n const {currency_code: currency, total_price} = cartTotals;\r\n return canMakePayment({\r\n country: getData('countryCode'),\r\n currency: currency.toLowerCase(),\r\n total: {\r\n label: getData('totalLabel'),\r\n amount: parseInt(total_price)\r\n }\r\n }, (result) => result != null && result.applePay);\r\n },\r\n content: <ApplePayContent getData={getData}/>,\r\n edit: <ApplePayEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n})","import './style.scss';\r\nimport {registerCreditCardForm} from \"@paymentplugins/stripe/util\";\r\nimport {CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nconst Bootstrap = ({CardIcon, options, onChange}) => {\r\n return (\r\n <div className='wc-stripe-bootstrap-form'>\r\n <div className='row'>\r\n <div className='col-md-6 mb-3'>\r\n <CardNumberElement className='md-form md-outline stripe-input' options={options['cardNumber']}\r\n onChange={onChange(CardNumberElement)}/>\r\n <label htmlFor=\"stripe-card-number\">{__('Card Number', 'woo-stripe-payment')}</label>\r\n {CardIcon}\r\n </div>\r\n <div className='col-md-3 mb-3'>\r\n <CardExpiryElement className='md-form md-outline stripe-input' options={options['cardExpiry']}\r\n onChange={onChange(CardExpiryElement)}/>\r\n <label htmlFor=\"stripe-exp\">{__('Exp', 'woo-stripe-payment')}</label>\r\n </div>\r\n <div className='col-md-3 mb-3'>\r\n <CardCvcElement className=\"md-form md-outline stripe-input\" options={options['cardCvc']}\r\n onChange={onChange(CardCvcElement)}/>\r\n <label htmlFor=\"stripe-cvv\">{__('CVV', 'woo-stripe-payment')}</label>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterCreditCardForm({\r\n id: 'bootstrap',\r\n breakpoint: 475,\r\n component: <Bootstrap/>\r\n})","import {getCreditCardForm} from \"../../util\";\r\nimport {cloneElement, useRef, useCallback, useEffect, useState} from '@wordpress/element';\r\nimport {useElements, CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {sprintf, __} from '@wordpress/i18n';\r\nimport {useBreakpointWidth} from \"../../hooks\";\r\n\r\nconst classes = {\r\n focus: 'focused',\r\n empty: 'empty',\r\n invalid: 'invalid'\r\n}\r\n\r\nconst CustomCardForm = (\r\n {\r\n getData,\r\n onChange: eventChange,\r\n ValidationInputError\r\n }) => {\r\n const [windowSize, setWindowSize] = useState(window.innerWidth);\r\n const [cardType, setCardType] = useState('');\r\n const elementOrder = useRef([]);\r\n const [container, setContainer] = useState(null);\r\n const elements = useElements();\r\n const id = getData('customForm');\r\n const {component: CardForm, breakpoint = 475} = getCreditCardForm(id);\r\n const postalCodeEnabled = getData('postalCodeEnabled');\r\n const options = {};\r\n ['cardNumber', 'cardExpiry', 'cardCvc'].forEach(type => {\r\n options[type] = {\r\n classes,\r\n ...getData('cardOptions'),\r\n ...getData('customFieldOptions')[type],\r\n }\r\n });\r\n const onChange = (element) => {\r\n setElementOrder(element);\r\n return (event) => {\r\n eventChange(event);\r\n if (event.elementType === 'cardNumber') {\r\n if (event.brand === 'unknown') {\r\n setCardType('');\r\n } else {\r\n setCardType(event.brand);\r\n }\r\n }\r\n if (event.complete) {\r\n const idx = elementOrder.current.indexOf(element);\r\n if (elementOrder.current[idx + 1]) {\r\n const nextElement = elementOrder.current[idx + 1];\r\n elements.getElement(nextElement).focus();\r\n }\r\n }\r\n }\r\n }\r\n const setElementOrder = useCallback((element) => {\r\n if (!elementOrder.current.includes(element)) {\r\n elementOrder.current.push(element);\r\n }\r\n }, []);\r\n\r\n useBreakpointWidth({name: 'creditCardForm', width: breakpoint, node: container, className: 'small-form'});\r\n\r\n const getCardIconSrc = useCallback((type) => {\r\n for (let icon of getData('icons')) {\r\n if (icon.id === type) {\r\n return icon.src;\r\n }\r\n }\r\n return '';\r\n }, []);\r\n\r\n if (!CardForm) {\r\n return (\r\n <div className='wc-stripe-custom-form-error'>\r\n <p>{sprintf(__('%s is not a valid blocks Stripe custom form. Please choose another custom form option in the Credit Card Settings.', 'woo-stripe-payment'), getData('customFormLabels')[id])}</p>\r\n </div>\r\n )\r\n }\r\n return (\r\n <div className={`wc-stripe-custom-form ${id}`} ref={setContainer}>\r\n {cloneElement(CardForm, {\r\n postalCodeEnabled,\r\n options,\r\n onChange,\r\n CardIcon: <CardIcon type={cardType} src={getCardIconSrc(cardType)}/>\r\n })}\r\n </div>\r\n )\r\n\r\n}\r\n\r\nconst CardIcon = ({type, src}) => {\r\n if (type) {\r\n return <img className={`wc-stripe-card ${type}`} src={src}/>\r\n }\r\n return null;\r\n}\r\n\r\nexport default CustomCardForm;\r\n","import './style.scss';\r\nimport {registerCreditCardForm} from \"@paymentplugins/stripe/util\";\r\nimport {CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';\r\nimport {__} from \"@wordpress/i18n\";\r\nimport {useEffect, useCallback, useRef} from '@wordpress/element';\r\n\r\nconst SimpleForm = ({CardIcon, options, onChange}) => {\r\n useEffect(() => {\r\n }, []);\r\n return (\r\n <div className='wc-stripe-simple-form'>\r\n <div className=\"row\">\r\n <div className=\"field\">\r\n <div className='field-item'>\r\n <CardNumberElement id=\"stripe-card-number\" className=\"input empty\"\r\n options={options['cardNumber']}\r\n onChange={onChange(CardNumberElement)}/>\r\n <label htmlFor=\"stripe-card-number\"\r\n data-tid=\"\">{__('Card Number', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n {CardIcon}\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"row\">\r\n <div className=\"field half-width\">\r\n <div className='field-item'>\r\n <CardExpiryElement id=\"stripe-exp\" className=\"input empty\" options={options['cardExpiry']}\r\n onChange={onChange(CardExpiryElement)}/>\r\n <label htmlFor=\"stripe-exp\"\r\n data-tid=\"\">{__('Expiration', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n </div>\r\n </div>\r\n <div className=\"field half-width cvc\">\r\n <div className='field-item'>\r\n <CardCvcElement id=\"stripe-cvv\" className=\"input empty\" options={options['cardCvc']}\r\n onChange={onChange(CardCvcElement)}/>\r\n <label htmlFor=\"stripe-cvv\"\r\n data-tid=\"\">{__('CVV', 'woo-stripe-payment')}</label>\r\n <div className=\"baseline\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterCreditCardForm({\r\n id: 'simple',\r\n component: <SimpleForm/>,\r\n breakpoint: 375\r\n})","import {CardElement} from \"@stripe/react-stripe-js\";\r\nimport {isFieldRequired} from \"../../util\";\r\nimport {useMemo} from '@wordpress/element';\r\n\r\nconst StripeCardForm = ({getData, billing, onChange}) => {\r\n const cardOptions = useMemo(() => {\r\n return {\r\n ...{\r\n value: {\r\n postalCode: billing?.billingData?.postcode\r\n },\r\n hidePostalCode: isFieldRequired('postcode'),\r\n iconStyle: 'default'\r\n }, ...getData('cardOptions')\r\n };\r\n }, [billing.billingData]);\r\n return (\r\n <div className='wc-stripe-inline-form'>\r\n <CardElement options={cardOptions} onChange={onChange}/>\r\n </div>\r\n )\r\n}\r\n\r\nexport default StripeCardForm;","import './style.scss';\r\n\r\nexport * from './payment-method';\r\n\r\nimport './components/bootstrap';\r\nimport './components/simple';\r\n","import {useEffect, useState, useCallback, useMemo} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {\r\n initStripe as loadStripe,\r\n getSettings,\r\n isUserLoggedIn,\r\n cartContainsSubscription,\r\n cartContainsPreOrder\r\n} from '../util';\r\nimport {Elements, CardElement, useStripe, useElements, CardNumberElement} from '@stripe/react-stripe-js';\r\nimport {PaymentMethodLabel, PaymentMethod, SavePaymentMethod} from '../../components/checkout';\r\nimport SavedCardComponent from '../saved-card-component';\r\nimport CustomCardForm from './components/custom-card-form';\r\nimport StripeCardForm from \"./components/stripe-card-form\";\r\nimport {\r\n useProcessPaymentIntent,\r\n useAfterProcessingPayment,\r\n useSetupIntent,\r\n useStripeError\r\n} from \"../hooks\";\r\n\r\nconst getData = getSettings('stripe_cc_data');\r\n\r\nconst displaySaveCard = (customerId) => {\r\n return isUserLoggedIn(customerId) && getData('saveCardEnabled') &&\r\n !cartContainsSubscription() && !cartContainsPreOrder()\r\n}\r\n\r\nconst CreditCardContent = (props) => {\r\n const [error, setError] = useState(false);\r\n useEffect(() => {\r\n loadStripe.catch(error => {\r\n setError(error);\r\n })\r\n }, [setError]);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <CreditCardElement {...props}/>\r\n </Elements>\r\n );\r\n};\r\n\r\nconst CreditCardElement = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n activePaymentMethod\r\n }) => {\r\n const [error, setError] = useStripeError();\r\n const [savePaymentMethod, setSavePaymentMethod] = useState(false);\r\n const onSavePaymentMethod = (checked) => setSavePaymentMethod(checked);\r\n const {onPaymentProcessing} = eventRegistration;\r\n const stripe = useStripe();\r\n const elements = useElements();\r\n const getPaymentMethodArgs = useCallback(() => {\r\n const elType = getData('customFormActive') ? CardNumberElement : CardElement;\r\n return {card: elements.getElement(elType)};\r\n }, [stripe, elements]);\r\n\r\n const {setupIntent, removeSetupIntent} = useSetupIntent({\r\n getData,\r\n cartTotal: billing.cartTotal,\r\n setError\r\n })\r\n\r\n useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n error,\r\n onPaymentProcessing,\r\n savePaymentMethod,\r\n setupIntent,\r\n removeSetupIntent,\r\n getPaymentMethodArgs,\r\n activePaymentMethod\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes: emitResponse.responseTypes,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n });\r\n\r\n const onChange = (event) => {\r\n if (event.error) {\r\n setError(event.error);\r\n } else {\r\n setError(false);\r\n }\r\n }\r\n const Tag = getData('customFormActive') ? CustomCardForm : StripeCardForm;\r\n return (\r\n <div className='wc-stripe-card-container'>\r\n <Tag {...{getData, billing, onChange}}/>\r\n {displaySaveCard(billing.customerId) &&\r\n <SavePaymentMethod label={getData('savePaymentMethodLabel')}\r\n onChange={onSavePaymentMethod}\r\n checked={savePaymentMethod}/>}\r\n </div>\r\n );\r\n}\r\n\r\nregisterPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icons')}/>,\r\n ariaLabel: 'Credit Cards',\r\n canMakePayment: () => loadStripe,\r\n content: <PaymentMethod content={CreditCardContent} getData={getData}/>,\r\n savedTokenComponent: <SavedCardComponent getData={getData}/>,\r\n edit: <PaymentMethod content={CreditCardContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n})","import {Component} from '@wordpress/element';\r\n\r\nclass ErrorBoundary extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {hasError: false, error: null, errorInfo: null};\r\n }\r\n\r\n componentDidCatch(error, errorInfo) {\r\n this.setState({\r\n hasError: true,\r\n error,\r\n errorInfo\r\n })\r\n }\r\n\r\n render() {\r\n if (this.state.hasError) {\r\n return (\r\n <>\r\n {this.state.error && <div className='wc-stripe-block-error'>{this.state.error.toString()}</div>}\r\n {this.state.errorInfo &&\r\n <div className='wc-stripe-block-error'>{this.state.errorInfo.componentStack}</div>}\r\n </>\r\n )\r\n }\r\n return this.props.children;\r\n }\r\n}\r\n\r\nexport default ErrorBoundary;","import {useRef, useEffect} from '@wordpress/element';\r\nimport {usePaymentsClient, usePaymentRequest} from './hooks';\r\nimport {\r\n useProcessPaymentIntent,\r\n useStripeError,\r\n useExportedValues,\r\n useExpressBreakpointWidth\r\n} from '../hooks';\r\nimport {getSettings} from '@paymentplugins/stripe/util';\r\n\r\nconst {publishableKey} = getSettings('stripeGeneralData')();\r\n\r\nconst GooglePayButton = (\r\n {\r\n getData,\r\n setErrorMessage,\r\n billing,\r\n shippingData,\r\n canMakePayment,\r\n checkoutStatus,\r\n eventRegistration,\r\n activePaymentMethod,\r\n onClick,\r\n onClose,\r\n ...props\r\n }) => {\r\n const merchantInfo = {\r\n merchantId: getData('merchantId'),\r\n merchantName: getData('merchantName')\r\n };\r\n const [error, setError] = useStripeError();\r\n const buttonContainer = useRef();\r\n const {onSubmit, emitResponse} = props;\r\n const {onPaymentProcessing} = eventRegistration;\r\n const exportedValues = useExportedValues();\r\n const width = getData('buttonStyle').buttonType === 'long' ? 390 : 300;\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n exportedValues,\r\n onSubmit,\r\n checkoutStatus,\r\n activePaymentMethod\r\n });\r\n\r\n const paymentRequest = usePaymentRequest({\r\n getData,\r\n publishableKey,\r\n merchantInfo,\r\n billing,\r\n shippingData\r\n })\r\n\r\n const {button, removeButton} = usePaymentsClient({\r\n merchantInfo,\r\n paymentRequest,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n canMakePayment,\r\n setErrorMessage,\r\n onSubmit,\r\n setPaymentMethod,\r\n exportedValues,\r\n onClick,\r\n onClose,\r\n getData\r\n });\r\n\r\n useExpressBreakpointWidth({payment_method: getData('name'), width});\r\n\r\n useEffect(() => {\r\n if (button) {\r\n // prevent button duplicates\r\n removeButton(buttonContainer.current);\r\n buttonContainer.current.append(button);\r\n }\r\n }, [button]);\r\n\r\n return (\r\n <div className='wc-stripe-gpay-button-container' ref={buttonContainer}></div>\r\n )\r\n}\r\n\r\nexport default GooglePayButton;","export const BASE_PAYMENT_METHOD = {\r\n type: 'CARD',\r\n parameters: {\r\n allowedAuthMethods: [\"PAN_ONLY\"],\r\n allowedCardNetworks: [\"AMEX\", \"DISCOVER\", \"INTERAC\", \"JCB\", \"MASTERCARD\", \"VISA\"],\r\n assuranceDetailsRequired: true\r\n }\r\n};\r\n\r\nexport const BASE_PAYMENT_REQUEST = {\r\n apiVersion: 2,\r\n apiVersionMinor: 0\r\n}","export * from './use-payments-client';\r\nexport * from './use-payment-request';\r\nexport * from './use-error-message';","import {useState} from '@wordpress/element';\r\n\r\nexport const useErrorMessage = () => {\r\n const [errorMessage, setErrorMessage] = useState(false);\r\n return {errorMessage, setErrorMessage};\r\n}","import {useState, useEffect, useMemo} from '@wordpress/element';\r\nimport {BASE_PAYMENT_REQUEST, BASE_PAYMENT_METHOD} from \"../constants\";\r\nimport {isEmpty, isFieldRequired} from \"../../util\";\r\nimport {getTransactionInfo, getShippingOptionParameters} from \"../util\";\r\n\r\nexport const usePaymentRequest = ({getData, publishableKey, merchantInfo, billing, shippingData}) => {\r\n const {billingData} = billing;\r\n const {shippingRates} = shippingData;\r\n const {processingCountry, totalPriceLabel} = getData();\r\n\r\n const paymentRequest = useMemo(() => {\r\n let options = {\r\n ...{\r\n emailRequired: isEmpty(billingData.email),\r\n merchantInfo,\r\n allowedPaymentMethods: [{\r\n ...{\r\n type: 'CARD',\r\n tokenizationSpecification: {\r\n type: \"PAYMENT_GATEWAY\",\r\n parameters: {\r\n gateway: 'stripe',\r\n \"stripe:version\": \"2018-10-31\",\r\n \"stripe:publishableKey\": publishableKey\r\n }\r\n }\r\n }, ...BASE_PAYMENT_METHOD\r\n }],\r\n shippingAddressRequired: shippingData.needsShipping,\r\n transactionInfo: getTransactionInfo({\r\n billing,\r\n processingCountry,\r\n totalPriceLabel\r\n }),\r\n callbackIntents: ['PAYMENT_AUTHORIZATION']\r\n }, ...BASE_PAYMENT_REQUEST\r\n };\r\n options.allowedPaymentMethods[0].parameters.billingAddressRequired = true;\r\n options.allowedPaymentMethods[0].parameters.billingAddressParameters = {\r\n format: 'FULL',\r\n phoneNumberRequired: isFieldRequired('phone', billingData.country) && isEmpty(billingData.phone)\r\n };\r\n if (options.shippingAddressRequired) {\r\n options.callbackIntents = [...options.callbackIntents, ...['SHIPPING_ADDRESS', 'SHIPPING_OPTION']];\r\n options.shippingOptionRequired = true;\r\n const shippingOptionParameters = getShippingOptionParameters(shippingRates);\r\n if (shippingOptionParameters.shippingOptions.length > 0) {\r\n options = {...options, shippingOptionParameters};\r\n }\r\n }\r\n return options;\r\n }, [\r\n billing.cartTotal,\r\n billing.cartTotalItems,\r\n billingData,\r\n shippingData\r\n ]);\r\n return paymentRequest;\r\n}","import {useState, useEffect, useCallback, useMemo, useRef} from '@wordpress/element';\r\nimport isShallowEqual from \"@wordpress/is-shallow-equal\";\r\nimport {\r\n getErrorMessage,\r\n getSelectedShippingOption,\r\n getBillingDetailsFromAddress,\r\n isAddressValid,\r\n isEmpty,\r\n StripeError,\r\n getIntermediateAddress\r\n} from \"../../util\";\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {getPaymentRequestUpdate, toCartAddress} from \"../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\nimport {usePaymentEvents} from \"../../hooks\";\r\n\r\nexport const usePaymentsClient = (\r\n {\r\n merchantInfo,\r\n paymentRequest,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n canMakePayment,\r\n setErrorMessage,\r\n setPaymentMethod,\r\n exportedValues,\r\n onClick,\r\n onClose,\r\n getData\r\n }) => {\r\n const {environment} = getData();\r\n const [paymentsClient, setPaymentsClient] = useState();\r\n const [button, setButton] = useState(null);\r\n const currentBilling = useRef(billing);\r\n const currentShipping = useRef(shippingData);\r\n const stripe = useStripe();\r\n const {addPaymentEvent} = usePaymentEvents({\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n });\r\n useEffect(() => {\r\n currentBilling.current = billing;\r\n currentShipping.current = shippingData;\r\n });\r\n\r\n const setAddressData = useCallback((paymentData) => {\r\n if (paymentData?.paymentMethodData?.info?.billingAddress) {\r\n let billingAddress = paymentData.paymentMethodData.info.billingAddress;\r\n if (isAddressValid(currentBilling.current.billingData, ['phone', 'email']) && isEmpty(currentBilling.current.billingData?.phone)) {\r\n billingAddress = {phoneNumber: billingAddress.phoneNumber};\r\n }\r\n exportedValues.billingData = currentBilling.current.billingData = toCartAddress(billingAddress, {email: paymentData.email});\r\n }\r\n if (paymentData?.shippingAddress) {\r\n exportedValues.shippingAddress = toCartAddress(paymentData.shippingAddress);\r\n }\r\n }, [exportedValues, paymentRequest]);\r\n\r\n const removeButton = useCallback((parentElement) => {\r\n while (parentElement.firstChild) {\r\n parentElement.removeChild(parentElement.firstChild);\r\n }\r\n }, [button]);\r\n const handleClick = useCallback(async () => {\r\n onClick();\r\n try {\r\n let paymentData = await paymentsClient.loadPaymentData(paymentRequest);\r\n\r\n // set the address data so it can be used during the checkout process\r\n setAddressData(paymentData);\r\n\r\n const data = JSON.parse(paymentData.paymentMethodData.tokenizationData.token);\r\n\r\n let result = await stripe.createPaymentMethod({\r\n type: 'card',\r\n card: {token: data.id},\r\n billing_details: getBillingDetailsFromAddress(currentBilling.current.billingData)\r\n });\r\n\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n\r\n setPaymentMethod(result.paymentMethod.id);\r\n } catch (err) {\r\n if (err?.statusCode === \"CANCELED\") {\r\n onClose();\r\n } else {\r\n console.log(getErrorMessage(err));\r\n setErrorMessage(getErrorMessage(err));\r\n }\r\n }\r\n }, [\r\n stripe,\r\n paymentsClient,\r\n onClick\r\n ]);\r\n\r\n const createButton = useCallback(async () => {\r\n try {\r\n if (paymentsClient && !button && stripe) {\r\n await canMakePayment;\r\n setButton(paymentsClient.createButton({\r\n onClick: handleClick,\r\n ...getData('buttonStyle')\r\n }));\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }, [\r\n stripe,\r\n button,\r\n paymentsClient\r\n ]);\r\n\r\n const paymentOptions = useMemo(() => {\r\n let options = {\r\n environment,\r\n merchantInfo,\r\n paymentDataCallbacks: {\r\n onPaymentAuthorized: () => Promise.resolve({transactionState: \"SUCCESS\"})\r\n }\r\n }\r\n if (paymentRequest.shippingAddressRequired) {\r\n options.paymentDataCallbacks.onPaymentDataChanged = (paymentData) => {\r\n return new Promise((resolve, reject) => {\r\n const shipping = currentShipping.current;\r\n const {shippingAddress: address, shippingOptionData} = paymentData;\r\n const intermediateAddress = toCartAddress(address);\r\n // pass the Promise resolve to a ref so it persists beyond the re-render\r\n const selectedRates = getSelectedShippingOption(shippingOptionData.id);\r\n const addressEqual = isShallowEqual(getIntermediateAddress(shipping.shippingAddress), intermediateAddress);\r\n const shippingEqual = isShallowEqual(shipping.selectedRates, {\r\n [selectedRates[1]]: selectedRates[0]\r\n });\r\n addPaymentEvent('onShippingChanged', (success, {billing, shipping}) => {\r\n if (success) {\r\n resolve(getPaymentRequestUpdate({\r\n billing,\r\n shippingData: {\r\n needsShipping: true,\r\n shippingRates: shipping.shippingRates\r\n },\r\n processingCountry: getData('processingCountry'),\r\n totalPriceLabel: getData('totalPriceLabel')\r\n }))\r\n } else {\r\n resolve({\r\n error: {\r\n reason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\r\n message: __('Your shipping address is not serviceable.', 'woo-stripe-payment'),\r\n intent: 'SHIPPING_ADDRESS'\r\n }\r\n });\r\n }\r\n }, addressEqual && shippingEqual);\r\n currentShipping.current.setShippingAddress({...currentShipping.current.shippingAddress, ...intermediateAddress});\r\n if (shippingOptionData.id !== 'shipping_option_unselected') {\r\n currentShipping.current.setSelectedRates(...selectedRates);\r\n }\r\n })\r\n }\r\n }\r\n return options;\r\n }, [paymentRequest]);\r\n\r\n useEffect(() => {\r\n setPaymentsClient(new google.payments.api.PaymentsClient(paymentOptions));\r\n }, [paymentOptions]);\r\n\r\n useEffect(() => {\r\n createButton();\r\n }, [createButton])\r\n\r\n return {\r\n button,\r\n removeButton\r\n };\r\n}","import './style.scss';\r\n\r\nexport * from './payment-method';","import {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, isCartPage} from '../util';\r\nimport {useErrorMessage} from \"./hooks\";\r\nimport GooglePayButton from './button';\r\nimport {BASE_PAYMENT_METHOD, BASE_PAYMENT_REQUEST} from './constants';\r\nimport google from '@googlepay';\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_googlepay_data');\r\n\r\nconst canMakePayment = (() => {\r\n const paymentsClient = new google.payments.api.PaymentsClient({\r\n environment: getData('environment'),\r\n merchantInfo: {\r\n merchantId: getData('merchantId'),\r\n merchantName: getData('merchantName')\r\n }\r\n });\r\n const isReadyToPayRequest = {...BASE_PAYMENT_REQUEST, allowedPaymentMethods: [BASE_PAYMENT_METHOD]};\r\n return paymentsClient.isReadyToPay(isReadyToPayRequest).then(() => {\r\n return true;\r\n }).catch(err => {\r\n console.log(err);\r\n return false;\r\n })\r\n})();\r\n\r\nconst GooglePayContent = ({getData, components, ...props}) => {\r\n const {ValidationInputError} = components;\r\n const {errorMessage, setErrorMessage} = useErrorMessage();\r\n return (\r\n <div className='wc-stripe-gpay-container'>\r\n <Elements stripe={loadStripe}>\r\n <GooglePayButton getData={getData}\r\n canMakePayment={canMakePayment}\r\n setErrorMessage={setErrorMessage}\r\n {...props}/>\r\n {errorMessage && <ValidationInputError errorMessage={errorMessage}/>}\r\n </Elements>\r\n </div>\r\n )\r\n}\r\n\r\nconst GooglePayEdit = ({getData, ...props}) => {\r\n const buttonType = getData('buttonStyle').buttonType;\r\n const src = getData('editorIcons')?.[buttonType] || 'long';\r\n return (\r\n <div className={`gpay-block-editor ${buttonType}`}>\r\n <img src={src}/>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: () => {\r\n if (getData('isAdmin')) {\r\n if (isCartPage()) {\r\n return getData('cartCheckoutEnabled');\r\n }\r\n return true;\r\n }\r\n if (isCartPage() && !getData('cartCheckoutEnabled')) {\r\n return false;\r\n }\r\n return loadStripe.then(stripe => {\r\n if (stripe.error) {\r\n return stripe;\r\n }\r\n return canMakePayment;\r\n });\r\n },\r\n content: <GooglePayContent getData={getData}/>,\r\n edit: <GooglePayEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n})","import {getShippingOptionId, removeNumberPrecision, toCartAddress as mapAddressToCartAddress} from \"../util\";\r\nimport {formatPrice} from '../util';\r\nimport {getSetting} from '@woocommerce/settings'\r\n\r\nconst generalData = getSetting('stripeGeneralData');\r\n\r\nconst ADDRESS_MAPPINGS = {\r\n name: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n countryCode: 'country',\r\n address1: 'address_1',\r\n address2: 'address_2',\r\n locality: 'city',\r\n administrativeArea: 'state',\r\n postalCode: 'postcode',\r\n email: 'email',\r\n phoneNumber: 'phone'\r\n}\r\n\r\nexport const getTransactionInfo = ({billing, processingCountry, totalPriceLabel}, status = 'ESTIMATED') => {\r\n const {cartTotal, cartTotalItems, currency} = billing;\r\n const transactionInfo = {\r\n countryCode: processingCountry,\r\n currencyCode: currency.code,\r\n totalPriceStatus: status,\r\n totalPrice: removeNumberPrecision(cartTotal.value, currency.minorUnit).toString(),\r\n displayItems: getDisplayItems(cartTotalItems, currency.minorUnit),\r\n totalPriceLabel\r\n }\r\n return transactionInfo;\r\n}\r\n\r\nexport const getPaymentRequestUpdate = ({billing, shippingData, processingCountry, totalPriceLabel}) => {\r\n const {needsShipping, shippingRates} = shippingData;\r\n let update = {\r\n newTransactionInfo: getTransactionInfo({\r\n billing, processingCountry, totalPriceLabel\r\n }, 'FINAL')\r\n }\r\n if (needsShipping) {\r\n update.newShippingOptionParameters = getShippingOptionParameters(shippingRates);\r\n }\r\n return update;\r\n}\r\n\r\n/**\r\n * Return an array of line item objects\r\n * @param cartTotalItems\r\n * @param unit\r\n * @returns {[]}\r\n */\r\nconst getDisplayItems = (cartTotalItems, unit = 2) => {\r\n let items = [];\r\n const keys = ['total_tax', 'total_shipping'];\r\n cartTotalItems.forEach(item => {\r\n if (0 < item.value || (item.key && keys.includes(item.key))) {\r\n items.push({\r\n label: item.label,\r\n type: 'LINE_ITEM',\r\n price: removeNumberPrecision(item.value, unit).toString()\r\n });\r\n }\r\n })\r\n return items;\r\n}\r\n\r\nexport const getShippingOptionParameters = (shippingRates) => {\r\n const shippingOptions = getShippingOptions(shippingRates);\r\n const shippingOptionIds = shippingOptions.map(option => option.id);\r\n let defaultSelectedOptionId = shippingOptionIds.slice(0, 1).shift();\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n shippingPackage.shipping_rates.forEach(rate => {\r\n if (rate.selected) {\r\n defaultSelectedOptionId = getShippingOptionId(idx, rate.rate_id);\r\n }\r\n });\r\n });\r\n return {\r\n shippingOptions,\r\n defaultSelectedOptionId,\r\n }\r\n}\r\n\r\n//id label description\r\nexport const getShippingOptions = (shippingRates) => {\r\n let options = [];\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n let rates = shippingPackage.shipping_rates.map(rate => {\r\n let txt = document.createElement('textarea');\r\n txt.innerHTML = rate.name;\r\n let price = formatPrice(rate.price, rate.currency_code);\r\n return {\r\n id: getShippingOptionId(idx, rate.rate_id),\r\n label: txt.value,\r\n description: `${price}`\r\n }\r\n });\r\n options = [...options, ...rates];\r\n });\r\n return options;\r\n}\r\n\r\nexport const toCartAddress = mapAddressToCartAddress(ADDRESS_MAPPINGS);\r\n","export * from './use-process-payment-intent';\r\nexport * from './use-after-process-payment';\r\nexport * from './use-setup-intent';\r\nexport * from './use-stripe-error';\r\nexport * from './use-exported-values';\r\nexport * from './use-payment-request';\r\nexport * from './use-payment-events';\r\nexport * from './use-breakpoint-width';\r\nexport * from './use-process-checkout-error'","import {useEffect} from '@wordpress/element'\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {handleCardAction} from \"../util\";\r\nimport {useProcessCheckoutError} from \"./use-process-checkout-error\";\r\n\r\nexport const useAfterProcessingPayment = (\r\n {\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n savePaymentMethod = false,\r\n messageContext = null\r\n }) => {\r\n const stripe = useStripe();\r\n const {onCheckoutAfterProcessingWithSuccess, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError,\r\n messageContext\r\n });\r\n useEffect(() => {\r\n let unsubscribeAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(async ({redirectUrl}) => {\r\n if (getData('name') === activePaymentMethod) {\r\n //check if response is in redirect. If so, open modal\r\n return await handleCardAction({\r\n redirectUrl,\r\n responseTypes,\r\n stripe,\r\n getData,\r\n savePaymentMethod\r\n });\r\n }\r\n return null;\r\n })\r\n return () => unsubscribeAfterProcessingWithSuccess()\r\n }, [\r\n stripe,\r\n responseTypes,\r\n onCheckoutAfterProcessingWithSuccess,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n ]);\r\n}","import {useState, useEffect, useCallback} from '@wordpress/element';\r\nimport {storeInCache, getFromCache} from \"../util\";\r\n\r\nexport const useBreakpointWidth = (\r\n {\r\n name,\r\n width,\r\n node,\r\n className\r\n }) => {\r\n const [windowWidth, setWindowWith] = useState(window.innerWidth);\r\n const getMaxWidth = useCallback((name) => {\r\n const maxWidth = getFromCache(name);\r\n return maxWidth ? parseInt(maxWidth) : 0;\r\n }, []);\r\n const setMaxWidth = useCallback((name, width) => storeInCache(name, width), []);\r\n\r\n useEffect(() => {\r\n const el = typeof node === 'function' ? node() : node;\r\n\r\n if (el) {\r\n const maxWidth = getMaxWidth(name);\r\n if (!maxWidth || width > maxWidth) {\r\n setMaxWidth(name, width);\r\n }\r\n if (el.clientWidth < width) {\r\n el.classList.add(className);\r\n } else {\r\n if (el.clientWidth > maxWidth) {\r\n el.classList.remove(className);\r\n }\r\n }\r\n }\r\n }, [windowWidth, node]);\r\n useEffect(() => {\r\n const handleResize = () => setWindowWith(window.innerWidth);\r\n window.addEventListener('resize', handleResize);\r\n return () => window.removeEventListener('resize', handleResize);\r\n });\r\n}\r\n\r\nexport const useExpressBreakpointWidth = (\r\n {\r\n payment_method,\r\n width\r\n }) => {\r\n const node = useCallback(() => {\r\n const el = document.getElementById(`express-payment-method-${payment_method}`);\r\n return el ? el.parentNode : null;\r\n }, []);\r\n useBreakpointWidth({\r\n name: 'expressMaxWidth',\r\n width,\r\n node,\r\n className: 'wc-stripe-express__sm'\r\n });\r\n\r\n}","import {useRef} from '@wordpress/element';\r\n\r\nexport const useExportedValues = () => {\r\n const exportedValues = useRef({});\r\n return exportedValues.current;\r\n}","import {useEffect, useCallback, useRef, useState} from '@wordpress/element';\r\nimport {hasShippingRates} from '../util';\r\n\r\nexport const usePaymentEvents = (\r\n {\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n }) => {\r\n const {onShippingRateSuccess, onShippingRateFail, onShippingRateSelectSuccess} = eventRegistration;\r\n const currentBilling = useRef(billing);\r\n const currentShipping = useRef(shippingData);\r\n const [handler, setHandler] = useState(null);\r\n const [paymentEvents, setPaymentEvent] = useState({\r\n onShippingChanged: false\r\n });\r\n const addPaymentEvent = useCallback((name, handler, execute = false) => {\r\n if (execute) {\r\n setHandler({[name]: handler});\r\n } else {\r\n setPaymentEvent({...paymentEvents, [name]: handler});\r\n }\r\n }, [paymentEvents, setPaymentEvent]);\r\n const removePaymentEvent = useCallback((name) => {\r\n if (paymentEvents[name]) {\r\n delete paymentEvents[name];\r\n setPaymentEvent(paymentEvents);\r\n }\r\n }, [paymentEvents]);\r\n\r\n const onShippingChanged = useCallback(() => {\r\n const shipping = currentShipping.current;\r\n const billing = currentBilling.current;\r\n if (paymentEvents.onShippingChanged && !shipping.isSelectingRate && !shipping.shippingRatesLoading) {\r\n const handler = paymentEvents.onShippingChanged;\r\n let success = true;\r\n if (!hasShippingRates(shipping.shippingRates)) {\r\n success = false;\r\n }\r\n handler(success, {\r\n billing,\r\n shipping\r\n });\r\n removePaymentEvent('onShippingChanged');\r\n }\r\n }, [paymentEvents, removePaymentEvent]);\r\n\r\n useEffect(() => {\r\n currentBilling.current = billing;\r\n currentShipping.current = shippingData;\r\n });\r\n\r\n useEffect(() => {\r\n if (handler) {\r\n if (handler.onShippingChanged) {\r\n handler.onShippingChanged(true, {\r\n billing: currentBilling.current,\r\n shipping: currentShipping.current\r\n })\r\n setHandler(null);\r\n }\r\n }\r\n }, [handler]);\r\n\r\n useEffect(() => {\r\n const unsubscribeShippingRateSuccess = onShippingRateSuccess(onShippingChanged);\r\n const unsubscribeShippingRateSelectSuccess = onShippingRateSelectSuccess(onShippingChanged);\r\n const unsubscribeShippingRateFail = onShippingRateFail(({hasInvalidAddress, hasError}) => {\r\n if (paymentEvents.onShippingChanged) {\r\n const handler = paymentEvents.onShippingChanged;\r\n handler(false);\r\n removePaymentEvent('onShippingChanged');\r\n }\r\n });\r\n\r\n return () => {\r\n unsubscribeShippingRateSuccess();\r\n unsubscribeShippingRateFail();\r\n unsubscribeShippingRateSelectSuccess();\r\n }\r\n }, [\r\n paymentEvents,\r\n onShippingRateSuccess,\r\n onShippingRateFail,\r\n onShippingRateSelectSuccess\r\n ]);\r\n\r\n return {addPaymentEvent, removePaymentEvent};\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport {usePaymentEvents} from './use-payment-events';\r\nimport {getIntermediateAddress} from '../util';\r\nimport isShallowEqual from '@wordpress/is-shallow-equal';\r\nimport {\r\n getDisplayItems,\r\n getShippingOptions,\r\n getSelectedShippingOption,\r\n isFieldRequired,\r\n toCartAddress as mapToCartAddress\r\n} from \"../util\";\r\n\r\nconst toCartAddress = mapToCartAddress();\r\n\r\nexport const usePaymentRequest = (\r\n {\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n }) => {\r\n const {addPaymentEvent} = usePaymentEvents({\r\n billing,\r\n shippingData,\r\n eventRegistration\r\n });\r\n const {needsShipping, shippingRates} = shippingData;\r\n const {billingData, cartTotalItems, currency, cartTotal} = billing;\r\n const [paymentRequest, setPaymentRequest] = useState(null);\r\n const paymentRequestOptions = useRef({});\r\n const currentShipping = useRef(shippingData)\r\n const currentBilling = useRef(billing);\r\n\r\n useEffect(() => {\r\n currentShipping.current = shippingData;\r\n currentBilling.current = billing;\r\n }, [shippingData]);\r\n\r\n useEffect(() => {\r\n if (stripe) {\r\n const options = {\r\n country: getData('countryCode'),\r\n currency: currency?.code.toLowerCase(),\r\n total: {\r\n amount: cartTotal.value,\r\n label: cartTotal.label,\r\n pending: true\r\n },\r\n requestPayerName: true,\r\n requestPayerEmail: isFieldRequired('email', billingData.country),\r\n requestPayerPhone: isFieldRequired('phone', billingData.country),\r\n requestShipping: needsShipping,\r\n displayItems: getDisplayItems(cartTotalItems, currency)\r\n }\r\n if (options.requestShipping) {\r\n options.shippingOptions = getShippingOptions(shippingRates);\r\n }\r\n paymentRequestOptions.current = options;\r\n const paymentRequest = stripe.paymentRequest(paymentRequestOptions.current);\r\n paymentRequest.canMakePayment().then(result => {\r\n if (canPay(result)) {\r\n setPaymentRequest(paymentRequest);\r\n } else {\r\n setPaymentRequest(null);\r\n }\r\n });\r\n }\r\n }, [stripe, billingData, shippingRates, needsShipping]);\r\n\r\n useEffect(() => {\r\n if (paymentRequest) {\r\n if (paymentRequestOptions.current.requestShipping) {\r\n paymentRequest.on('shippingaddresschange', onShippingAddressChange);\r\n paymentRequest.on('shippingoptionchange', onShippingOptionChange);\r\n }\r\n paymentRequest.on('cancel', onClose);\r\n paymentRequest.on('paymentmethod', onPaymentMethodReceived);\r\n }\r\n }, [paymentRequest]);\r\n\r\n const updatePaymentEvent = useCallback((event) => (success, {billing, shipping}) => {\r\n const {cartTotal, cartTotalItems, currency} = billing;\r\n const {shippingRates} = shipping;\r\n if (success) {\r\n event.updateWith({\r\n status: 'success',\r\n total: {\r\n amount: cartTotal.value,\r\n label: cartTotal.label,\r\n pending: false\r\n },\r\n displayItems: getDisplayItems(cartTotalItems, currency),\r\n shippingOptions: getShippingOptions(shippingRates)\r\n });\r\n } else {\r\n event.updateWith({status: 'invalid_shipping_address'});\r\n }\r\n }, []);\r\n\r\n const onShippingAddressChange = useCallback(event => {\r\n const {shippingAddress} = event;\r\n const shipping = currentShipping.current;\r\n const intermediateAddress = toCartAddress(shippingAddress);\r\n shipping.setShippingAddress({...shipping.shippingAddress, ...intermediateAddress});\r\n const addressEqual = isShallowEqual(getIntermediateAddress(shipping.shippingAddress), intermediateAddress);\r\n addPaymentEvent('onShippingChanged', updatePaymentEvent(event), addressEqual);\r\n }, [addPaymentEvent]);\r\n\r\n const onShippingOptionChange = useCallback(event => {\r\n const {shippingOption} = event;\r\n const shipping = currentShipping.current;\r\n shipping.setSelectedRates(...getSelectedShippingOption(shippingOption.id));\r\n addPaymentEvent('onShippingChanged', updatePaymentEvent(event));\r\n }, [addPaymentEvent]);\r\n\r\n const onPaymentMethodReceived = useCallback((paymentResponse) => {\r\n const {paymentMethod, payerName = null, payerEmail = null, payerPhone = null} = paymentResponse;\r\n // set address data\r\n let billingData = {payerName, payerEmail, payerPhone};\r\n if (paymentMethod?.billing_details.address) {\r\n billingData = toCartAddress(paymentMethod.billing_details.address, billingData);\r\n }\r\n exportedValues.billingData = billingData;\r\n\r\n if (paymentResponse.shippingAddress) {\r\n exportedValues.shippingAddress = toCartAddress(paymentResponse.shippingAddress);\r\n }\r\n\r\n // set payment method\r\n setPaymentMethod(paymentMethod.id);\r\n paymentResponse.complete(\"success\");\r\n }, [setPaymentMethod]);\r\n\r\n return {paymentRequest};\r\n}","import {useEffect} from '@wordpress/element';\r\n\r\nexport const useProcessCheckoutError = (\r\n {\r\n responseTypes,\r\n subscriber,\r\n messageContext = null\r\n }) => {\r\n useEffect(() => {\r\n const unsubscribe = subscriber((data) => {\r\n if (data?.processingResponse.paymentDetails?.stripeErrorMessage) {\r\n return {\r\n type: responseTypes.ERROR,\r\n message: data.processingResponse.paymentDetails.stripeErrorMessage,\r\n messageContext\r\n };\r\n }\r\n return null;\r\n });\r\n return () => unsubscribe();\r\n }, [responseTypes, subscriber]);\r\n}","import {useEffect, useState, useCallback, useRef} from '@wordpress/element';\r\nimport {useStripe} from '@stripe/react-stripe-js';\r\nimport {\r\n ensureSuccessResponse,\r\n ensureErrorResponse,\r\n getBillingDetailsFromAddress,\r\n StripeError\r\n} from '../util';\r\n\r\nexport const useProcessPaymentIntent = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n paymentType = 'card',\r\n setupIntent = null,\r\n removeSetupIntent = null,\r\n savePaymentMethod = false,\r\n exportedValues = {},\r\n getPaymentMethodArgs = () => ({})\r\n }) => {\r\n const {billingData} = billing;\r\n const {shippingAddress} = shippingData;\r\n const {responseTypes} = emitResponse;\r\n const [paymentMethod, setPaymentMethod] = useState(null);\r\n const stripe = useStripe();\r\n const currentPaymentMethodArgs = useRef(getPaymentMethodArgs);\r\n\r\n useEffect(() => {\r\n currentPaymentMethodArgs.current = getPaymentMethodArgs;\r\n }, [getPaymentMethodArgs]);\r\n\r\n const getCreatePaymentMethodArgs = useCallback(() => {\r\n const args = {\r\n type: paymentType,\r\n billing_details: getBillingDetailsFromAddress(exportedValues?.billingData ? exportedValues.billingData : billingData)\r\n }\r\n return {...args, ...currentPaymentMethodArgs.current()};\r\n }, [billingData, paymentType, getPaymentMethodArgs]);\r\n\r\n const getSuccessResponse = useCallback((paymentMethodId, savePaymentMethod) => {\r\n const response = {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: paymentMethodId,\r\n [`${getData('name')}_save_source_key`]: savePaymentMethod\r\n }\r\n }\r\n }\r\n if (exportedValues?.billingData) {\r\n response.meta.billingData = exportedValues.billingData;\r\n }\r\n if (exportedValues?.shippingAddress) {\r\n response.meta.shippingData = {address: exportedValues.shippingAddress};\r\n }\r\n return response;\r\n }, [billingData, shippingAddress]);\r\n\r\n useEffect(() => {\r\n if (paymentMethod && typeof paymentMethod === 'string') {\r\n onSubmit();\r\n }\r\n }, [paymentMethod]);\r\n\r\n useEffect(() => {\r\n const unsubscribeProcessingPayment = onPaymentProcessing(async () => {\r\n if (activePaymentMethod !== getData('name')) {\r\n return null;\r\n }\r\n let [result, paymentMethodId] = [null, null];\r\n try {\r\n if (error) {\r\n throw new StripeError(error);\r\n }\r\n if (setupIntent) {\r\n result = await stripe.confirmCardSetup(setupIntent.client_secret, {\r\n payment_method: getCreatePaymentMethodArgs()\r\n });\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n paymentMethodId = result.setupIntent.payment_method;\r\n removeSetupIntent();\r\n } else {\r\n // payment method has already been created.\r\n if (paymentMethod) {\r\n paymentMethodId = paymentMethod;\r\n } else {\r\n //create the payment method\r\n result = await stripe.createPaymentMethod(getCreatePaymentMethodArgs());\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n paymentMethodId = result.paymentMethod.id;\r\n }\r\n }\r\n return ensureSuccessResponse(responseTypes, getSuccessResponse(paymentMethodId, savePaymentMethod));\r\n } catch (e) {\r\n console.log(e);\r\n setPaymentMethod(null);\r\n return ensureErrorResponse(responseTypes, e.error);\r\n }\r\n\r\n });\r\n return () => unsubscribeProcessingPayment();\r\n }, [\r\n paymentMethod,\r\n billingData,\r\n onPaymentProcessing,\r\n stripe,\r\n setupIntent,\r\n activePaymentMethod,\r\n savePaymentMethod\r\n ]);\r\n return {setPaymentMethod};\r\n}","import {useEffect, useState, useCallback} from '@wordpress/element';\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\nimport {\r\n getSettings,\r\n getRoute,\r\n cartContainsPreOrder,\r\n cartContainsSubscription,\r\n getFromCache,\r\n storeInCache,\r\n deleteFromCache\r\n} from '../util';\r\n\r\nexport const useSetupIntent = (\r\n {\r\n cartTotal,\r\n setError\r\n }) => {\r\n const [setupIntent, setSetupIntent] = useState(getFromCache('setupIntent'));\r\n\r\n useEffect(() => {\r\n const createSetupIntent = async () => {\r\n if (setupIntent) {\r\n return;\r\n }\r\n // only create intent under certain conditions\r\n let result = await apiFetch({\r\n url: getRoute('create/setup_intent'),\r\n method: 'POST'\r\n });\r\n if (result.code) {\r\n setError(result.message);\r\n } else {\r\n storeInCache('setupIntent', result.intent);\r\n setSetupIntent(result.intent);\r\n }\r\n }\r\n if (cartContainsPreOrder() || (cartContainsSubscription() && cartTotal.value == 0)) {\r\n if (!setupIntent) {\r\n createSetupIntent();\r\n }\r\n } else {\r\n setSetupIntent(null);\r\n }\r\n }, [cartTotal.value]);\r\n const removeSetupIntent = useCallback(() => {\r\n deleteFromCache('setupIntent');\r\n }, [cartTotal.value]);\r\n return {setupIntent, removeSetupIntent};\r\n}","import {useState} from '@wordpress/element'\r\n\r\nexport const useStripeError = () => {\r\n const [error, setError] = useState(false);\r\n return [error, setError];\r\n}","import {useState, useEffect} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {AfterpayClearpayMessageElement, Elements} from \"@stripe/react-stripe-js\";\r\nimport {sprintf, __} from '@wordpress/i18n';\r\n\r\nconst getData = getSettings('stripe_afterpay_data');\r\nlet variablesHandler;\r\nconst setVariablesHandler = (handler) => {\r\n variablesHandler = handler;\r\n}\r\nconst PaymentMethodLabel = ({getData}) => {\r\n const [variables, setVariables] = useState({\r\n amount: getData('cartTotal'),\r\n currency: getData('currency'),\r\n isEligible: getData('msgOptions').isEligible\r\n });\r\n const options = {\r\n locale: 'auto'\r\n }\r\n if (variables.currency === 'GBP' && !['fr-FR', 'it-IT', 'es-ES'].includes(getData('locale'))) {\r\n options.locale = 'en-GB';\r\n }\r\n setVariablesHandler(setVariables);\r\n return (\r\n <Elements stripe={initStripe} options={options}>\r\n <div className='wc-stripe-blocks-afterpay__label'>\r\n <AfterpayClearpayMessageElement options={{\r\n ...getData('msgOptions'),\r\n ...{\r\n amount: variables.amount,\r\n currency: variables.currency,\r\n isEligible: variables.isEligible\r\n }\r\n }}/>\r\n </div>\r\n </Elements>\r\n );\r\n}\r\n\r\nconst AfterpayPaymentMethod = ({content, billing, shippingData, ...props}) => {\r\n const Content = content;\r\n const {cartTotal, currency} = billing;\r\n const {needsShipping} = shippingData\r\n useEffect(() => {\r\n variablesHandler({\r\n amount: cartTotal.value,\r\n currency: currency.code,\r\n isEligible: needsShipping\r\n });\r\n }, [\r\n cartTotal.value,\r\n currency.code,\r\n needsShipping\r\n ]);\r\n return (\r\n <>\r\n {needsShipping &&\r\n <div className='wc-stripe-blocks-payment-method-content'>\r\n <div className=\"wc-stripe-blocks-afterpay-offsite__container\">\r\n <div className=\"wc-stripe-blocks-afterpay__offsite\">\r\n <img src={getData('offSiteSrc')}/>\r\n <p>{sprintf(__('After clicking \"%s\", you will be redirected to Afterpay to complete your purchase securely.', 'woo-stripe-payment'), getData('placeOrderButtonLabel'))}</p>\r\n </div>\r\n </div>\r\n <Content {...{...props, billing, shippingData}}/>\r\n </div>}\r\n </>\r\n );\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n getData={getData}/>,\r\n ariaLabel: __('Afterpay', 'woo-stripe-payment'),\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData, ({settings, billingData, cartTotals, cartNeedsShipping}) => {\r\n const {country} = billingData;\r\n const {currency_code: currency} = cartTotals;\r\n const requiredParams = settings('requiredParams');\r\n const [countryCode] = requiredParams[currency];\r\n if (variablesHandler) {\r\n variablesHandler({\r\n amount: parseInt(cartTotals.total_price),\r\n currency,\r\n isEligible: cartNeedsShipping\r\n });\r\n }\r\n return country == countryCode;\r\n }),\r\n content: <AfterpayPaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmAfterpayClearpayPayment'}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel} from \"../../components/checkout/payment-method-label\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {PaymentMethod} from \"../../components/checkout\";\r\n\r\nconst getData = getSettings('stripe_alipay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Alipay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n edit: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_bancontact_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Bancontact',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n edit: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {AuBankAccountElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_becs_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'BECS',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmAuBecsDebitPayment'}\r\n component={AuBankAccountElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_eps_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'EPS',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {FpxBankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_fpx_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'FPX',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmIdealPayment'}\r\n component={FpxBankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_giropay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Giropay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_grabpay_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'GrabPay',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmGrabPayPayment'}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","export * from './use-after-process-local-payment';\r\nexport * from './use-validate-checkout';\r\nexport * from './use-create-source';","import {useEffect, useRef} from '@wordpress/element';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {ensureErrorResponse, getBillingDetailsFromAddress, StripeError} from \"../../util\";\r\n\r\nexport const useAfterProcessLocalPayment = (\r\n {\r\n getData,\r\n billingData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n confirmationMethod,\r\n getPaymentMethodArgs = () => ({})\r\n }\r\n) => {\r\n const stripe = useStripe();\r\n const {onCheckoutAfterProcessingWithSuccess, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const currentBillingData = useRef(billingData);\r\n const currentPaymentMethodArgs = useRef(getPaymentMethodArgs);\r\n useEffect(() => {\r\n currentBillingData.current = billingData;\r\n }, [billingData]);\r\n\r\n useEffect(() => {\r\n currentPaymentMethodArgs.current = getPaymentMethodArgs;\r\n }, [getPaymentMethodArgs]);\r\n\r\n useEffect(() => {\r\n const unsubscribeAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(async ({redirectUrl}) => {\r\n if (getData('name') === activePaymentMethod) {\r\n try {\r\n let match = redirectUrl.match(/#response=(.+)/);\r\n if (match) {\r\n let {client_secret, return_url, ...order} = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n let result = await stripe[confirmationMethod](client_secret, {\r\n payment_method: {\r\n billing_details: getBillingDetailsFromAddress(currentBillingData.current),\r\n ...currentPaymentMethodArgs.current()\r\n },\r\n return_url\r\n });\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n }\r\n } catch (e) {\r\n console.log(e);\r\n return ensureErrorResponse(responseTypes, e.error);\r\n }\r\n }\r\n })\r\n return () => unsubscribeAfterProcessingWithSuccess();\r\n }, [\r\n stripe,\r\n onCheckoutAfterProcessingWithSuccess,\r\n onCheckoutAfterProcessingWithError\r\n ]);\r\n}","import {useState, useEffect, useRef, useCallback} from '@wordpress/element';\r\nimport {\r\n getDefaultSourceArgs,\r\n ensureSuccessResponse,\r\n ensureErrorResponse,\r\n StripeError\r\n} from \"../../util\";\r\nimport {useStripe, useElements} from \"@stripe/react-stripe-js\";\r\nimport {__} from '@wordpress/i18n';\r\n\r\nexport const useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n shippingAddress,\r\n onPaymentProcessing,\r\n responseTypes,\r\n getSourceArgs = false,\r\n element = false\r\n }) => {\r\n const [source, setSource] = useState(false);\r\n const [isValid, setIsValid] = useState(false);\r\n const currentValues = useRef({\r\n billing,\r\n shippingAddress,\r\n });\r\n const stripe = useStripe();\r\n const elements = useElements();\r\n useEffect(() => {\r\n currentValues.current = {\r\n billing,\r\n shippingAddress\r\n }\r\n });\r\n\r\n const getSourceArgsInternal = useCallback(() => {\r\n const {billing} = currentValues.current;\r\n const {cartTotal, currency, billingData} = billing;\r\n let args = getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n });\r\n if (getSourceArgs) {\r\n args = getSourceArgs(args, {billingData});\r\n }\r\n return args;\r\n }, []);\r\n\r\n const getSuccessData = useCallback((sourceId) => {\r\n return {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: sourceId\r\n }\r\n }\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(async () => {\r\n if (source) {\r\n return ensureSuccessResponse(responseTypes, getSuccessData(source.id));\r\n }\r\n // create the source\r\n try {\r\n let result;\r\n if (element) {\r\n // validate the element\r\n if (!isValid) {\r\n throw __('Please enter your payment info before proceeding.', 'woo-stripe-payment');\r\n }\r\n result = await stripe.createSource(elements.getElement(element), getSourceArgsInternal());\r\n } else {\r\n result = await stripe.createSource(getSourceArgsInternal());\r\n }\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n setSource(result.source);\r\n return ensureSuccessResponse(responseTypes, getSuccessData(result.source.id));\r\n } catch (err) {\r\n console.log(err);\r\n return ensureErrorResponse(responseTypes, err.error || err);\r\n }\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source,\r\n onPaymentProcessing,\r\n stripe,\r\n responseTypes,\r\n element,\r\n isValid,\r\n setIsValid\r\n ]);\r\n return {setIsValid};\r\n}","import {useEffect, useRef, useState} from '@wordpress/element';\r\nimport {ensureErrorResponse} from \"../../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nexport const useValidateCheckout = (\r\n {\r\n subscriber,\r\n responseTypes,\r\n component = null,\r\n msg = __('Please enter your payment info before proceeding.', 'woo-stripe-payment')\r\n }) => {\r\n const [isValid, setIsValid] = useState(false);\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscriber(() => {\r\n if (component && !isValid) {\r\n return ensureErrorResponse(responseTypes, msg);\r\n }\r\n return true;\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n subscriber,\r\n isValid,\r\n setIsValid,\r\n responseTypes,\r\n component\r\n ]);\r\n return {isValid, setIsValid};\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {IdealBankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_ideal_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Ideal',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmIdealPayment'}\r\n component={IdealBankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import './klarna';\r\nimport './ideal';\r\nimport './p24';\r\nimport './bancontact';\r\nimport './giropay';\r\nimport './eps';\r\nimport './multibanco';\r\nimport './sepa';\r\nimport './sofort';\r\nimport './wechat';\r\nimport './fpx';\r\nimport './becs';\r\nimport './grabpay';\r\nimport './alipay'\r\nimport './afterpay';","import {useEffect} from '@wordpress/element';\r\nimport RadioControlAccordion from \"../../../components/checkout/radio-control-accordion\";\r\n\r\nexport const KlarnaPaymentCategories = ({source, categories, onChange, selected}) => {\r\n return (\r\n <div className={'wc-stripe-blocks-klarna-container'}>\r\n <ul>\r\n {categories.map(category => {\r\n return <KlarnaPaymentCategory\r\n source={source}\r\n key={category.type}\r\n category={category}\r\n onChange={onChange}\r\n selected={selected}/>\r\n })}\r\n </ul>\r\n </div>\r\n );\r\n}\r\n\r\nconst KlarnaPaymentCategory = ({source, category, selected, onChange}) => {\r\n const checked = category.type === selected;\r\n useEffect(() => {\r\n Klarna.Payments.load({\r\n container: `#klarna-category-${category.type}`,\r\n payment_method_category: category.type\r\n });\r\n }, [source]);\r\n const option = {\r\n label: category.label,\r\n value: category.type,\r\n content: (<div id={`klarna-category-${category.type}`}></div>)\r\n }\r\n return (\r\n <li className='wc-stripe-blocks-klarna__category' key={category.type}>\r\n <RadioControlAccordion option={option} checked={checked} onChange={onChange}/>\r\n </li>\r\n )\r\n}","export * from './use-create-source';\r\nexport * from './use-process-payment';","import {useEffect, useState, useRef, useCallback} from '@wordpress/element';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {useStripeError} from \"../../../hooks\";\r\nimport {getDefaultSourceArgs, getRoute, isAddressValid, StripeError, storeInCache, getFromCache} from \"../../../util\";\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\n\r\nexport const useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n }) => {\r\n const stripe = useStripe();\r\n const [error, setError] = useStripeError();\r\n const abortController = useRef(new AbortController());\r\n const currentSourceArgs = useRef({});\r\n const oldSourceArgs = useRef({});\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [source, setSource] = useState(false);\r\n const {billingData, cartTotal, cartTotalItems, currency} = billing;\r\n const isCheckoutValid = useCallback(({billingData, shippingData}) => {\r\n const {needsShipping, shippingAddress} = shippingData;\r\n if (isAddressValid(billingData)) {\r\n if (needsShipping) {\r\n return isAddressValid(shippingAddress);\r\n }\r\n return true;\r\n }\r\n return false;\r\n }, []);\r\n const getLineItems = useCallback((cartTotalItems, currency) => {\r\n const items = [];\r\n cartTotalItems.forEach(item => {\r\n items.push({\r\n amount: item.value,\r\n currency,\r\n description: item.label,\r\n quantity: 1\r\n });\r\n });\r\n return items;\r\n }, []);\r\n\r\n const getSourceArgs = useCallback(({cartTotal, cartTotalItems, billingData, currency, shippingData}) => {\r\n const {first_name, last_name, country} = billingData;\r\n const {needsShipping, shippingAddress} = shippingData;\r\n let args = getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n });\r\n args = {\r\n ...args, ...{\r\n source_order: {\r\n items: getLineItems(cartTotalItems, currency.code)\r\n },\r\n klarna: {\r\n locale: getData('locale'),\r\n product: 'payment',\r\n purchase_country: country,\r\n first_name,\r\n last_name\r\n }\r\n }\r\n }\r\n if (country == 'US') {\r\n args.klarna.custom_payment_methods = 'payin4,installments';\r\n }\r\n if (needsShipping) {\r\n args.klarna = {\r\n ...args.klarna, ...{\r\n shipping_first_name: shippingAddress.first_name,\r\n shipping_last_name: shippingAddress.last_name\r\n }\r\n }\r\n args.source_order.shipping = {\r\n address: {\r\n city: shippingAddress.city || '',\r\n country: shippingAddress.country || '',\r\n line1: shippingAddress.address_1 || '',\r\n line2: shippingAddress.address_2 || '',\r\n postal_code: shippingAddress.postcode || '',\r\n state: shippingAddress.state || ''\r\n }\r\n }\r\n }\r\n oldSourceArgs.current = currentSourceArgs.current;\r\n currentSourceArgs.current = args;\r\n return args;\r\n }, []);\r\n const filterUpdateSourceArgs = (args) => {\r\n return ['type', 'currency', 'statement_descriptor', 'redirect', 'klarna.product', 'klarna.locale', 'klarna.custom_payment_methods'].reduce((obj, k) => {\r\n if (k.indexOf('.') > -1) {\r\n let keys = k.split('.');\r\n let obj2 = keys.slice(0, keys.length - 1).reduce((obj, k) => {\r\n return obj[k];\r\n }, obj);\r\n k = keys[keys.length - 1];\r\n delete obj2[k];\r\n return obj;\r\n }\r\n delete obj[k];\r\n return obj;\r\n }, args);\r\n }\r\n\r\n const compareSourceArgs = useCallback((args, args2) => {\r\n const getArgs = (args1, args2, key = false) => {\r\n let newArgs = {};\r\n if (args1 && typeof args1 === 'object' && !Array.isArray(args1)) {\r\n for (let key of Object.keys(args1)) {\r\n if (typeof args1[key] === 'object' && !Array.isArray(args1[key])) {\r\n newArgs[key] = getArgs(args1[key], args2[key]);\r\n } else {\r\n newArgs[key] = args2[key];\r\n }\r\n }\r\n } else {\r\n newArgs = args1;\r\n }\r\n\r\n return newArgs;\r\n }\r\n const newArgs = getArgs(args, args2);\r\n return JSON.stringify(args) == JSON.stringify(newArgs);\r\n }, []);\r\n const createSource = useCallback(async (\r\n {\r\n billingData,\r\n shippingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency,\r\n }) => {\r\n let args = getSourceArgs({\r\n cartTotal,\r\n cartTotalItems,\r\n billingData,\r\n currency,\r\n shippingData\r\n });\r\n try {\r\n let result = await stripe.createSource(args);\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n storeInCache('klarna:source', {[currency.code]: {source: result.source, args: currentSourceArgs.current}});\r\n setSource(result.source);\r\n } catch (err) {\r\n console.log(err);\r\n setError(err.error);\r\n }\r\n }, [\r\n stripe,\r\n setSource\r\n ]);\r\n\r\n const updateSource = useCallback(async ({source, updates, currency}) => {\r\n\r\n const data = {\r\n updates,\r\n source_id: source.id,\r\n client_secret: source.client_secret,\r\n payment_method: getData('name')\r\n };\r\n try {\r\n abortController.current.abort();\r\n abortController.current = new AbortController();\r\n let result = await apiFetch({\r\n url: getRoute('update/source'),\r\n method: 'POST',\r\n data,\r\n signal: abortController.current.signal\r\n });\r\n if (result.source) {\r\n storeInCache('klarna:source', {[currency]: {source, args: currentSourceArgs.current}});\r\n setSource(result.source);\r\n }\r\n } catch (err) {\r\n console.log('update aborted');\r\n }\r\n }, [setSource]);\r\n\r\n // Create the source if the required data is available\r\n useEffect(() => {\r\n if (!source) {\r\n if (getFromCache('klarna:source')?.[currency.code]) {\r\n const {source, args} = getFromCache('klarna:source')[currency.code];\r\n currentSourceArgs.current = args;\r\n setSource(source);\r\n } else {\r\n if (stripe && isCheckoutValid({billingData, shippingData})) {\r\n setIsLoading(true);\r\n createSource({\r\n billingData,\r\n shippingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency\r\n }).then(() => setIsLoading(false));\r\n }\r\n }\r\n }\r\n }, [\r\n stripe,\r\n source?.id,\r\n createSource,\r\n billingData,\r\n cartTotal.value,\r\n shippingData,\r\n setIsLoading,\r\n cartTotalItems,\r\n currency.code\r\n ]);\r\n\r\n // update the source if data has changed and the source exists\r\n useEffect(() => {\r\n if (stripe && source) {\r\n // perform a comparison to see if the source needs to be updated\r\n const updates = filterUpdateSourceArgs(getSourceArgs({\r\n billingData,\r\n cartTotal,\r\n cartTotalItems,\r\n currency,\r\n shippingData\r\n }));\r\n if (!compareSourceArgs(updates, oldSourceArgs.current)) {\r\n updateSource({source, updates, currency: currency.code});\r\n }\r\n }\r\n }, [\r\n source?.id,\r\n billingData,\r\n cartTotal.value,\r\n cartTotalItems,\r\n shippingData,\r\n currency.code\r\n ]);\r\n\r\n return {source, setSource, isLoading};\r\n}","import {useEffect} from '@wordpress/element';\r\nimport {ensureErrorResponse, ensureSuccessResponse, deleteFromCache} from \"../../../util\";\r\nimport {__} from \"@wordpress/i18n\";\r\n\r\nexport const useProcessPayment = (\r\n {\r\n payment_method,\r\n source_id,\r\n paymentCategory,\r\n onPaymentProcessing,\r\n responseTypes\r\n }) => {\r\n useEffect(() => {\r\n const unsubscribe = onPaymentProcessing(() => {\r\n return new Promise(resolve => {\r\n // authorize the Klarna payment\r\n Klarna.Payments.authorize({\r\n payment_method_category: paymentCategory\r\n }, (response) => {\r\n if (response.approved) {\r\n deleteFromCache('klarna:source');\r\n // add the source to the response\r\n resolve(ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${payment_method}_token_key`]: source_id\r\n }\r\n }\r\n }));\r\n } else {\r\n resolve(ensureErrorResponse(responseTypes, response.error || __('Your purchase is not approved.', 'woo-stripe-payment')));\r\n }\r\n });\r\n });\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source_id,\r\n paymentCategory,\r\n onPaymentProcessing\r\n ]\r\n );\r\n}","import {useEffect, useState} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {__} from '@wordpress/i18n';\r\nimport {useProcessCheckoutError} from '../../hooks';\r\nimport {\r\n getSettings,\r\n initStripe,\r\n} from \"../../util\";\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../../components/checkout\";\r\nimport {canMakePayment} from \"../local-payment-method\";\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\nimport {KlarnaPaymentCategories} from \"./categories\";\r\nimport {KlarnaLoader} from \"./loader\";\r\nimport {useCreateSource, useProcessPayment} from \"./hooks\";\r\nimport './styles.scss';\r\n\r\nconst getData = getSettings('stripe_klarna_data');\r\n\r\nconst KlarnaContainer = (props) => {\r\n return (\r\n <Elements stripe={initStripe}>\r\n <KlarnaPaymentMethod {...props}/>\r\n </Elements>\r\n );\r\n}\r\n\r\nconst KlarnaPaymentMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const [selected, setSelected] = useState('');\r\n const [klarnaInitialized, setKlarnaInitialized] = useState(false);\r\n const getCategoriesFromSource = (source) => {\r\n const paymentMethodCategories = source.klarna.payment_method_categories.split(',');\r\n const categories = [];\r\n for (let type of Object.keys(getData('categories'))) {\r\n if (paymentMethodCategories.includes(type)) {\r\n categories.push({type, label: getData('categories')[type]});\r\n }\r\n }\r\n return categories;\r\n }\r\n\r\n const {source, isLoading} = useCreateSource({\r\n getData,\r\n billing,\r\n shippingData\r\n });\r\n\r\n useProcessPayment({\r\n payment_method: getData('name'),\r\n source_id: source.id,\r\n paymentCategory: selected,\r\n onPaymentProcessing,\r\n responseTypes\r\n });\r\n\r\n useProcessCheckoutError({responseTypes, subscriber: onCheckoutAfterProcessingWithError});\r\n\r\n useEffect(() => {\r\n if (!selected && source) {\r\n const categories = getCategoriesFromSource(source);\r\n if (categories.length) {\r\n setSelected(categories.shift().type);\r\n }\r\n\r\n }\r\n }, [source]);\r\n\r\n useEffect(() => {\r\n if (source) {\r\n Klarna.Payments.init({\r\n client_token: source.klarna.client_token\r\n });\r\n setKlarnaInitialized(true);\r\n }\r\n }, [source?.id]);\r\n\r\n if (source && klarnaInitialized) {\r\n const categories = getCategoriesFromSource(source);\r\n return (\r\n <KlarnaPaymentCategories\r\n source={source}\r\n categories={categories}\r\n selected={!selected && categories.length > 0 ? categories[0].type : selected}\r\n onChange={setSelected}/>\r\n )\r\n } else {\r\n if (isLoading) {\r\n return <KlarnaLoader/>\r\n }\r\n }\r\n return (\r\n <div className='wc-stripe-blocks-klarna__notice'>\r\n {__('Please fill out all required fields before paying with Klarna.', 'woo-stripe-payment')}\r\n </div>\r\n );\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Klarna',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData, ({settings, billingData, cartTotals}) => {\r\n const {country} = billingData;\r\n const {currency_code: currency} = cartTotals;\r\n const requiredParams = settings('requiredParams');\r\n return [currency] in requiredParams && requiredParams[currency].includes(country);\r\n }),\r\n content: <PaymentMethod\r\n getData={getData}\r\n content={KlarnaContainer}/>,\r\n edit: <PaymentMethod\r\n getData={getData}\r\n content={KlarnaContainer}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","export const KlarnaLoader = () => {\r\n return (\r\n <div className=\"wc-stripe-klarna-loader\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n )\r\n}","import {useCallback} from '@wordpress/element';\r\nimport {useElements, Elements} from \"@stripe/react-stripe-js\";\r\nimport {initStripe as loadStripe, cartContainsSubscription, cartContainsPreOrder} from '../util'\r\nimport {useAfterProcessLocalPayment, useValidateCheckout, useCreateSource} from \"./hooks\";\r\nimport {useProcessCheckoutError} from \"../hooks\";\r\n\r\n/**\r\n * Return true if the local payment method can be used.\r\n * @param settings\r\n * @returns {function({billingData: *, [p: string]: *}): *}\r\n */\r\nexport const canMakePayment = (settings, callback = false) => ({billingData, cartTotals, ...props}) => {\r\n const {currency_code} = cartTotals;\r\n const {country} = billingData;\r\n const countries = settings('countries');\r\n const type = settings('allowedCountries');\r\n const supports = settings('features');\r\n let canMakePayment = false;\r\n if (settings('isAdmin')) {\r\n canMakePayment = true;\r\n } else {\r\n // Check if there are any subscriptions or pre-orders in the cart.\r\n if (cartContainsSubscription() && !supports.includes('subscriptions')) {\r\n return false;\r\n } else if (cartContainsPreOrder() && !supports.includes('pre-orders')) {\r\n return false;\r\n }\r\n if (settings('currencies').includes(currency_code)) {\r\n if (type === 'all_except') {\r\n canMakePayment = !settings('exceptCountries').includes(country);\r\n } else if (type === 'specific') {\r\n canMakePayment = settings('specificCountries').includes(country);\r\n } else {\r\n canMakePayment = countries.length > 0 ? countries.includes(country) : true;\r\n }\r\n }\r\n if (callback && canMakePayment) {\r\n canMakePayment = callback({settings, billingData, cartTotals, ...props});\r\n }\r\n }\r\n return canMakePayment;\r\n}\r\n\r\nexport const LocalPaymentIntentContent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <LocalPaymentIntentMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nexport const LocalPaymentSourceContent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <LocalPaymentSourceMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nconst LocalPaymentSourceMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n getSourceArgs = false,\r\n element = false\r\n }) => {\r\n const {shippingAddress} = shippingData;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const onChange = (event) => {\r\n setIsValid(event.complete);\r\n }\r\n const {setIsValid} = useCreateSource({\r\n getData,\r\n billing,\r\n shippingAddress,\r\n onPaymentProcessing,\r\n responseTypes,\r\n getSourceArgs,\r\n element\r\n });\r\n\r\n if (element) {\r\n return (\r\n <LocalPaymentElementContainer\r\n name={getData('name')}\r\n options={getData('elementOptions')}\r\n onChange={onChange}\r\n element={element}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst LocalPaymentIntentMethod = (\r\n {\r\n getData,\r\n billing,\r\n emitResponse,\r\n eventRegistration,\r\n activePaymentMethod,\r\n confirmationMethod = null,\r\n component = null\r\n }) => {\r\n const elements = useElements();\r\n const {billingData} = billing;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithError} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const getPaymentMethodArgs = useCallback(() => {\r\n if (component) {\r\n return {\r\n [getData('paymentType')]: elements.getElement(component)\r\n }\r\n }\r\n return {};\r\n }, [elements]);\r\n const {setIsValid} = useValidateCheckout({\r\n subscriber: onPaymentProcessing,\r\n responseTypes,\r\n component\r\n }\r\n );\r\n\r\n useAfterProcessLocalPayment({\r\n getData,\r\n billingData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n confirmationMethod,\r\n getPaymentMethodArgs\r\n });\r\n useProcessCheckoutError({\r\n responseTypes,\r\n subscriber: onCheckoutAfterProcessingWithError,\r\n messageContext: noticeContexts.PAYMENT\r\n });\r\n if (component) {\r\n const onChange = (event) => setIsValid(!event.empty)\r\n return (\r\n <LocalPaymentElementContainer\r\n name={getData('name')}\r\n options={getData('elementOptions')}\r\n onChange={onChange}\r\n element={component}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst LocalPaymentElementContainer = ({name, onChange, element, options}) => {\r\n const Tag = element;\r\n return (\r\n <div className={`wc-stripe-local-payment-container ${name} ${Tag.displayName}`}>\r\n <Tag options={options} onChange={onChange}/>\r\n </div>\r\n )\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_multibanco_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'MultiBanco',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentIntentContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {P24BankElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_p24_data');\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'P24',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentIntentContent}\r\n getData={getData}\r\n confirmationMethod={'confirmP24Payment'}\r\n component={P24BankElement}/>,\r\n edit: <PaymentMethod content={LocalPaymentIntentContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, cartContainsPreOrder, cartContainsSubscription} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {IbanElement} from \"@stripe/react-stripe-js\";\r\n\r\nconst getData = getSettings('stripe_sepa_data');\r\n\r\nconst getSourceArgs = (args, {billingData}) => {\r\n args.mandate = {\r\n notification_method: billingData.email ? 'email' : 'manual',\r\n interval: cartContainsSubscription() || cartContainsPreOrder() ? 'scheduled' : 'one_time'\r\n }\r\n if (args.mandate.interval === 'scheduled') {\r\n delete args.amount;\r\n }\r\n return args;\r\n}\r\n\r\nconst LocalPaymentMethod = (PaymentMethod) => ({getData, ...props}) => {\r\n return (\r\n <>\r\n <PaymentMethod {...{...props, getData}}/>\r\n <div className={'wc-stripe-blocks-sepa__mandate'}>\r\n {getData('mandate')}\r\n </div>\r\n </>\r\n )\r\n}\r\n\r\nconst SepaPaymentMethod = LocalPaymentMethod(PaymentMethod);\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'SEPA',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <SepaPaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}\r\n element={IbanElement}\r\n getSourceArgs={getSourceArgs}/>,\r\n edit: <LocalPaymentSourceContent getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}","import {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings} from \"../util\";\r\nimport {LocalPaymentSourceContent} from './local-payment-method';\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\n\r\nconst getData = getSettings('stripe_sofort_data');\r\n\r\nconst getSourceArgs = (args, {billingData}) => {\r\n return {...args, sofort: {country: billingData.country}};\r\n}\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'Sofort',\r\n placeOrderButtonLabel: getData('placeOrderButtonLabel'),\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod\r\n content={LocalPaymentSourceContent}\r\n getData={getData}\r\n getSourceArgs={getSourceArgs}/>,\r\n edit: <PaymentMethod content={LocalPaymentSourceContent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import {useEffect, useRef, useState, useCallback} from '@wordpress/element';\r\nimport {registerPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {\r\n getSettings,\r\n initStripe as loadStripe,\r\n getDefaultSourceArgs,\r\n isAddressValid,\r\n StripeError,\r\n isTestMode,\r\n ensureSuccessResponse,\r\n getErrorMessage,\r\n storeInCache,\r\n getFromCache,\r\n deleteFromCache\r\n} from \"../util\";\r\nimport {PaymentMethodLabel, PaymentMethod} from \"../../components/checkout\";\r\nimport {canMakePayment} from \"./local-payment-method\";\r\nimport {Elements} from \"@stripe/react-stripe-js\";\r\nimport {useValidateCheckout} from \"./hooks\";\r\nimport {__} from '@wordpress/i18n';\r\n//import QRCode from 'QRCode';\r\nimport {useStripe} from \"@stripe/react-stripe-js\";\r\nimport {useStripeError} from \"../hooks\";\r\n\r\nconst getData = getSettings('stripe_wechat_data');\r\n\r\nconst WeChatComponent = (props) => {\r\n return (\r\n <Elements stripe={loadStripe}>\r\n <WeChatPaymentMethod {...props}/>\r\n </Elements>\r\n )\r\n}\r\n\r\nconst WeChatPaymentMethod = (\r\n {\r\n getData,\r\n billing,\r\n shippingData,\r\n emitResponse,\r\n eventRegistration,\r\n components\r\n }) => {\r\n const {responseTypes} = emitResponse;\r\n const {onPaymentProcessing, onCheckoutAfterProcessingWithSuccess} = eventRegistration;\r\n const {ValidationInputError} = components;\r\n const {isValid, setIsValid} = useValidateCheckout({\r\n subscriber: eventRegistration.onPaymentProcessing,\r\n responseTypes: emitResponse.responseTypes,\r\n msg: __('Please scan your QR code to continue with payment.', 'woo-stripe-payment')\r\n });\r\n\r\n const {source, error, deleteSourceFromStorage} = useCreateSource({\r\n getData,\r\n billing,\r\n responseTypes,\r\n subscriber: onPaymentProcessing\r\n })\r\n\r\n /**\r\n * delete the source from storage once payment is successful.\r\n * If test mode, redirect to the Stripe test url.\r\n * If live mode, redirect to the return Url.\r\n */\r\n useEffect(() => {\r\n const unsubscribe = onCheckoutAfterProcessingWithSuccess(() => {\r\n deleteSourceFromStorage();\r\n return ensureSuccessResponse(responseTypes);\r\n });\r\n return () => unsubscribe();\r\n }, [\r\n source,\r\n onCheckoutAfterProcessingWithSuccess,\r\n deleteSourceFromStorage\r\n ]);\r\n\r\n useEffect(() => {\r\n if (source) {\r\n setIsValid(true);\r\n }\r\n }, [source]);\r\n\r\n if (source) {\r\n return (\r\n <QRCodeComponent text={source.wechat.qr_code_url}/>\r\n );\r\n } else if (error) {\r\n return (\r\n <div className='wechat-validation-error'>\r\n <ValidationInputError errorMessage={getErrorMessage(error)}/>\r\n </div>\r\n );\r\n } else {\r\n // if billing address is not valid\r\n if (!isAddressValid(billing.billingData)) {\r\n return __('Please fill out all the required fields in order to complete the WeChat payment.', 'woo-stripe-payment');\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nconst QRCodeComponent = (\r\n {\r\n text,\r\n width = 128,\r\n height = 128,\r\n colorDark = '#424770',\r\n colorLight = '#f8fbfd',\r\n correctLevel = QRCode.CorrectLevel.H\r\n }) => {\r\n const el = useRef();\r\n useEffect(() => {\r\n new QRCode(el.current, {\r\n text,\r\n width,\r\n height,\r\n colorDark,\r\n colorLight,\r\n correctLevel\r\n })\r\n }, [el]);\r\n return (\r\n <>\r\n <div id='wc-stripe-block-qrcode' ref={el}></div>\r\n {isTestMode() && <p>\r\n {__('Test mode: Click the Place Order button to proceed.', 'woo-stripe-payment')}\r\n </p>}\r\n {!isTestMode() && <p>\r\n {__('Scan the QR code using your WeChat app. Once scanned click the Place Order button.', 'woo-stripe-payment')}\r\n </p>}\r\n </>\r\n )\r\n}\r\n\r\nconst useCreateSource = (\r\n {\r\n getData,\r\n billing,\r\n responseTypes,\r\n subscriber\r\n }) => {\r\n const stripe = useStripe();\r\n const [error, setError] = useStripeError();\r\n const [source, setSource] = useState(getFromCache('wechat:source'));\r\n const createSourceTimeoutId = useRef(null);\r\n const {cartTotal, billingData, currency} = billing;\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscriber(() => {\r\n return ensureSuccessResponse(responseTypes, {\r\n meta: {\r\n paymentMethodData: {\r\n [`${getData('name')}_token_key`]: source.id\r\n }\r\n }\r\n })\r\n });\r\n return () => unsubscribe();\r\n }, [source, subscriber]);\r\n\r\n const createSource = useCallback(async () => {\r\n // validate the billing fields. If valid, create the source.\r\n try {\r\n if (!error && isAddressValid(billingData)) {\r\n let result = await stripe.createSource(getDefaultSourceArgs({\r\n type: getData('paymentType'),\r\n amount: cartTotal.value,\r\n billingData,\r\n currency: currency.code,\r\n returnUrl: getData('returnUrl')\r\n }));\r\n if (result.error) {\r\n throw new StripeError(result.error);\r\n }\r\n setSource(result.source);\r\n storeInCache('wechat:source', result.source);\r\n }\r\n } catch (err) {\r\n console.log('error: ', err);\r\n setError(err.error);\r\n }\r\n }, [\r\n stripe,\r\n source,\r\n cartTotal.value,\r\n billingData,\r\n currency,\r\n error\r\n ]);\r\n const deleteSourceFromStorage = useCallback(() => {\r\n deleteFromCache('wechat:source');\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (stripe && !source) {\r\n // if there is an existing request, cancel it.\r\n clearTimeout(createSourceTimeoutId.current);\r\n createSourceTimeoutId.current = setTimeout(createSource, 1000);\r\n }\r\n }, [\r\n stripe,\r\n source\r\n ]);\r\n\r\n return {source, setSource, error, deleteSourceFromStorage};\r\n}\r\n\r\n\r\nif (getData()) {\r\n registerPaymentMethod({\r\n name: getData('name'),\r\n label: <PaymentMethodLabel\r\n title={getData('title')}\r\n paymentMethod={getData('name')}\r\n icons={getData('icon')}/>,\r\n ariaLabel: 'WeChat',\r\n canMakePayment: canMakePayment(getData),\r\n content: <PaymentMethod content={WeChatComponent} getData={getData}/>,\r\n edit: <PaymentMethod content={WeChatComponent} getData={getData}/>,\r\n supports: {\r\n showSavedCards: false,\r\n showSaveOption: false,\r\n features: getData('features')\r\n }\r\n })\r\n}\r\n","import './style.scss';\r\n\r\nimport './payment-method';","import {useMemo, useEffect, useRef} from '@wordpress/element';\r\nimport {registerExpressPaymentMethod} from '@woocommerce/blocks-registry';\r\nimport {getSettings, initStripe as loadStripe, canMakePayment} from \"../util\";\r\nimport {useBreakpointWidth, useExpressBreakpointWidth} from '../hooks';\r\nimport {Elements, PaymentRequestButtonElement, useStripe} from \"@stripe/react-stripe-js\";\r\nimport {\r\n usePaymentRequest,\r\n useProcessPaymentIntent,\r\n useExportedValues,\r\n useAfterProcessingPayment,\r\n useStripeError\r\n} from '../hooks';\r\n\r\nconst getData = getSettings('stripe_payment_request_data');\r\n\r\nconst PaymentRequestContent = (props) => {\r\n return (\r\n <div className='wc-stripe-payment-request-container'>\r\n <Elements stripe={loadStripe}>\r\n <PaymentRequestButton {...props}/>\r\n </Elements>\r\n </div>\r\n );\r\n}\r\n\r\nconst PaymentRequestButton = (\r\n {\r\n getData,\r\n onClick,\r\n onClose,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n emitResponse,\r\n onSubmit,\r\n activePaymentMethod,\r\n ...props\r\n }) => {\r\n const {onPaymentProcessing} = eventRegistration;\r\n const {responseTypes, noticeContexts} = emitResponse;\r\n const stripe = useStripe();\r\n const [error] = useStripeError();\r\n const canPay = (result) => result != null && !result.applePay;\r\n const exportedValues = useExportedValues();\r\n useExpressBreakpointWidth({payment_method: getData('name'), width: 300});\r\n const {setPaymentMethod} = useProcessPaymentIntent({\r\n getData,\r\n billing,\r\n shippingData,\r\n onPaymentProcessing,\r\n emitResponse,\r\n error,\r\n onSubmit,\r\n activePaymentMethod,\r\n exportedValues\r\n });\r\n useAfterProcessingPayment({\r\n getData,\r\n eventRegistration,\r\n responseTypes,\r\n activePaymentMethod,\r\n messageContext: noticeContexts.EXPRESS_PAYMENTS\r\n });\r\n const {paymentRequest} = usePaymentRequest({\r\n getData,\r\n onClose,\r\n stripe,\r\n billing,\r\n shippingData,\r\n eventRegistration,\r\n setPaymentMethod,\r\n exportedValues,\r\n canPay\r\n });\r\n\r\n const options = useMemo(() => {\r\n return {\r\n paymentRequest,\r\n style: {\r\n paymentRequestButton: getData('paymentRequestButton')\r\n }\r\n }\r\n }, [paymentRequest]);\r\n\r\n if (paymentRequest) {\r\n return (\r\n <PaymentRequestButtonElement options={options} onClick={onClick}/>\r\n )\r\n }\r\n return null;\r\n}\r\n\r\nconst PaymentRequestEdit = ({getData, ...props}) => {\r\n const canvas = useRef();\r\n useEffect(() => {\r\n const scale = window.devicePixelRatio;\r\n canvas.current.width = 20 * scale;\r\n canvas.current.height = 20 * scale;\r\n let ctx = canvas.current.getContext('2d');\r\n ctx.scale(scale, scale);\r\n ctx.beginPath();\r\n ctx.arc(10, 10, 10, 0, 2 * Math.PI);\r\n ctx.fillStyle = '#986fff';\r\n ctx.fill();\r\n });\r\n return (\r\n <div className='payment-request-block-editor'>\r\n <div className={'icon-container'}>\r\n <span>Buy now</span>\r\n <canvas className='PaymentRequestButton-icon' ref={canvas}/>\r\n <i className={'payment-request-arrow'}></i>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nregisterExpressPaymentMethod({\r\n name: getData('name'),\r\n canMakePayment: ({cartTotals}) => {\r\n if (getData('isAdmin')) {\r\n return true;\r\n }\r\n const {currency_code: currency, total_price} = cartTotals;\r\n return canMakePayment({\r\n country: getData('countryCode'),\r\n currency: currency.toLowerCase(),\r\n total: {\r\n label: getData('totalLabel'),\r\n amount: parseInt(total_price)\r\n }\r\n }, (result) => result != null && !result.applePay);\r\n },\r\n content: <PaymentRequestContent getData={getData}/>,\r\n edit: <PaymentRequestEdit getData={getData}/>,\r\n supports: {\r\n showSavedCards: getData('showSavedCards'),\r\n showSaveOption: getData('showSaveOption'),\r\n features: getData('features')\r\n }\r\n});","import {useEffect, useCallback} from '@wordpress/element';\r\nimport {initStripe as loadStripe, getSettings, handleCardAction} from '@paymentplugins/stripe/util';\r\n\r\nconst SavedCardComponent = (\r\n {\r\n eventRegistration,\r\n emitResponse,\r\n getData\r\n }) => {\r\n const {onCheckoutAfterProcessingWithSuccess} = eventRegistration;\r\n const {responseTypes} = emitResponse;\r\n const handleSuccessResult = useCallback(async ({redirectUrl}) => {\r\n const stripe = await loadStripe;\r\n return await handleCardAction({redirectUrl, getData, stripe, responseTypes});\r\n }, [onCheckoutAfterProcessingWithSuccess]);\r\n\r\n useEffect(() => {\r\n const unsubscribeOnCheckoutAfterProcessingWithSuccess = onCheckoutAfterProcessingWithSuccess(handleSuccessResult);\r\n return () => unsubscribeOnCheckoutAfterProcessingWithSuccess();\r\n }, [\r\n onCheckoutAfterProcessingWithSuccess\r\n ]);\r\n return null;\r\n}\r\n\r\nexport default SavedCardComponent;\r\n","import {loadStripe} from '@stripe/stripe-js';\r\nimport {getSetting} from '@woocommerce/settings'\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\nimport {getCurrency, formatPrice as wcFormatPrice} from '@woocommerce/price-format';\r\n\r\nconst {publishableKey, account} = getSetting('stripeGeneralData');\r\nconst messages = getSetting('stripeErrorMessages');\r\nconst countryLocale = getSetting('countryLocale', {});\r\n\r\nconst SHIPPING_OPTION_REGEX = /^([\\w]+)\\:(.+)$/;\r\n\r\nconst routes = getSetting('stripeGeneralData').routes;\r\n\r\nconst creditCardForms = {};\r\n\r\nconst localPaymentMethods = [];\r\n\r\nconst CACHE_PREFIX = 'stripe:';\r\n\r\nconst PAYMENT_REQUEST_ADDRESS_MAPPINGS = {\r\n recipient: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n payerName: (address, name) => {\r\n address.first_name = name.split(' ').slice(0, -1).join(' ');\r\n address.last_name = name.split(' ').pop();\r\n return address;\r\n },\r\n country: 'country',\r\n addressLine: (address, value) => {\r\n if (value[0]) {\r\n address.address_1 = value[0];\r\n }\r\n if (value[1]) {\r\n address.address_2 = value[1];\r\n }\r\n return address;\r\n },\r\n line1: 'address_1',\r\n line2: 'address_2',\r\n city: 'city',\r\n region: 'state',\r\n postalCode: 'postcode',\r\n postal_code: 'postcode',\r\n payerEmail: 'email',\r\n payerPhone: 'phone'\r\n}\r\n\r\nexport const initStripe = new Promise((resolve, reject) => {\r\n loadStripe(publishableKey, (() => account ? {stripeAccount: account} : {})()).then(stripe => {\r\n resolve(stripe);\r\n }).catch(err => {\r\n resolve({error: err});\r\n });\r\n});\r\n\r\nexport const registerCreditCardForm = ({id, ...props}) => {\r\n creditCardForms[id] = props;\r\n}\r\n\r\nexport const getCreditCardForm = (id) => {\r\n return creditCardForms[id];\r\n}\r\n\r\nexport const getRoute = (route) => {\r\n return routes?.[route] ? routes[route] : console.log(`${route} is not a valid route`);\r\n}\r\n\r\nexport const ensureSuccessResponse = (responseTypes, data = {}) => {\r\n return {type: responseTypes.SUCCESS, ...data};\r\n}\r\n\r\n/**\r\n * Returns a formatted error object used by observers\r\n * @param responseTypes\r\n * @param error\r\n * @returns {{type: *, message: *}}\r\n */\r\nexport const ensureErrorResponse = (responseTypes, error) => {\r\n return {type: responseTypes.ERROR, message: getErrorMessage(error)}\r\n};\r\n\r\n/**\r\n * Return a customized error message.\r\n * @param error\r\n */\r\nexport const getErrorMessage = (error) => {\r\n if (typeof error == 'string') {\r\n return error;\r\n }\r\n if (error?.code && messages?.[error.code]) {\r\n return messages[error.code];\r\n }\r\n if (error?.statusCode) {\r\n return messages?.[error.statusCode] ? messages[error.statusCode] : error.statusMessage;\r\n }\r\n return error.message;\r\n}\r\n\r\n/**\r\n * Return a Stripe formatted billing_details object from a WC address\r\n * @param billingAddress\r\n */\r\nexport const getBillingDetailsFromAddress = (billingAddress) => {\r\n let billing_details = {\r\n name: `${billingAddress.first_name} ${billingAddress.last_name}`,\r\n address: {\r\n city: billingAddress.city || null,\r\n country: billingAddress.country || null,\r\n line1: billingAddress.address_1 || null,\r\n line2: billingAddress.address_2 || null,\r\n postal_code: billingAddress.postcode || null,\r\n state: billingAddress.state || null\r\n }\r\n }\r\n if (billingAddress?.phone) {\r\n billing_details.phone = billingAddress.phone;\r\n }\r\n if (billingAddress?.email) {\r\n billing_details.email = billingAddress.email;\r\n }\r\n return billing_details;\r\n}\r\n\r\nexport const getSettings = (name) => (key) => {\r\n if (key) {\r\n return getSetting(name)[key];\r\n }\r\n return getSetting(name);\r\n}\r\n\r\nexport class StripeError extends Error {\r\n constructor(error) {\r\n super(error.message);\r\n this.error = error;\r\n }\r\n}\r\n\r\n/**\r\n * Returns true if the provided value is empty.\r\n * @param value\r\n * @returns {boolean}\r\n */\r\nexport const isEmpty = (value) => {\r\n if (typeof value === 'string') {\r\n return value.length == 0 || value == '';\r\n }\r\n if (Array.isArray(value)) {\r\n return array.length == 0;\r\n }\r\n if (typeof value === 'object') {\r\n return Object.keys(value).length == 0;\r\n }\r\n if (typeof value === 'undefined') {\r\n return true;\r\n }\r\n return true;\r\n}\r\n\r\nexport const removeNumberPrecision = (value, unit) => {\r\n return value / 10 ** unit;\r\n}\r\n\r\n/**\r\n *\r\n * @param address\r\n * @param country\r\n */\r\nexport const isAddressValid = (address, exclude = []) => {\r\n const fields = getLocaleFields(address.country);\r\n for (const [key, value] of Object.entries(address)) {\r\n if (!exclude.includes(key) && fields?.[key] && fields[key].required) {\r\n if (isEmpty(value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\n\r\nexport const getLocaleFields = (country) => {\r\n let localeFields = {...countryLocale.default};\r\n if (country && countryLocale?.[country]) {\r\n localeFields = Object.entries(countryLocale[country]).reduce((locale, [key, value]) => {\r\n locale[key] = {...locale[key], ...value}\r\n return locale;\r\n }, localeFields);\r\n ['phone', 'email'].forEach(key => {\r\n let node = document.getElementById(key);\r\n if (node) {\r\n localeFields[key] = {required: node.required};\r\n }\r\n });\r\n }\r\n return localeFields;\r\n}\r\n\r\n/**\r\n * Return true if the field is required by the cart\r\n * @param field\r\n * @param country\r\n * @returns {boolean|*}\r\n */\r\nexport const isFieldRequired = (field, country = false) => {\r\n const fields = getLocaleFields(country);\r\n return [field] in fields && fields[field].required;\r\n}\r\n\r\nexport const getSelectedShippingOption = (id) => {\r\n const result = id.match(SHIPPING_OPTION_REGEX);\r\n if (result) {\r\n const {1: packageIdx, 2: rate} = result;\r\n return [rate, packageIdx];\r\n }\r\n return [];\r\n}\r\n\r\nexport const hasShippingRates = (shippingRates) => {\r\n return shippingRates.map(rate => {\r\n return rate.shipping_rates.length > 0;\r\n }).filter(Boolean).length > 0;\r\n}\r\n\r\n/**\r\n * Return true if the customer is logged in.\r\n * @param customerId\r\n * @returns {boolean}\r\n */\r\nexport const isUserLoggedIn = (customerId) => {\r\n return customerId > 0;\r\n}\r\n\r\nconst syncPaymentIntentWithOrder = async (order_id, client_secret) => {\r\n try {\r\n await apiFetch({\r\n url: routes['sync/intent'],\r\n method: 'POST',\r\n data: {order_id, client_secret}\r\n })\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nexport const handleCardAction = async (\r\n {\r\n redirectUrl,\r\n responseTypes,\r\n stripe,\r\n getData,\r\n savePaymentMethod = false\r\n }) => {\r\n try {\r\n let match = redirectUrl.match(/#response=(.+)/)\r\n if (match) {\r\n let {client_secret, order_id, order_key} = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n let result = await stripe.handleCardAction(client_secret);\r\n if (result.error) {\r\n syncPaymentIntentWithOrder(order_id, client_secret);\r\n return ensureErrorResponse(responseTypes, result.error);\r\n }\r\n // success so finish processing order then redirect to thank you page\r\n let data = {order_id, order_key, [`${getData('name')}_save_source_key`]: savePaymentMethod};\r\n let response = await apiFetch({\r\n url: getRoute('process/payment'),\r\n method: 'POST',\r\n data\r\n })\r\n if (response.messages) {\r\n return ensureErrorResponse(responseTypes, response.messages);\r\n }\r\n return ensureSuccessResponse(responseTypes, {\r\n redirectUrl: response.redirect\r\n });\r\n } else {\r\n return ensureSuccessResponse(responseTypes);\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n return ensureErrorResponse(responseTypes, err);\r\n }\r\n}\r\n\r\n/**\r\n * Convert a payment wallet address to a WC cart address.\r\n * @param address_mappings\r\n * @returns {function(*, *=): {}}\r\n */\r\nexport const toCartAddress = (address_mappings = PAYMENT_REQUEST_ADDRESS_MAPPINGS) => (address, args = {}) => {\r\n const cartAddress = {};\r\n address = {...address, ...filterEmptyValues(args)};\r\n for (let [key, cartKey] of Object.entries(address_mappings)) {\r\n if (address?.[key]) {\r\n if (typeof cartKey === 'function') {\r\n cartKey(cartAddress, address[key]);\r\n } else {\r\n cartAddress[cartKey] = address[key];\r\n }\r\n }\r\n }\r\n return cartAddress;\r\n}\r\n\r\n/**\r\n * Given a WC formatted address, return only the intermediate address values\r\n * @param address\r\n * @param fields\r\n */\r\nexport const getIntermediateAddress = (address, fields = ['city', 'postcode', 'state', 'country']) => {\r\n const intermediateAddress = {};\r\n for (let key of fields) {\r\n intermediateAddress[key] = address[key];\r\n }\r\n return intermediateAddress;\r\n}\r\n\r\n/**\r\n *\r\n * @param values\r\n * @returns {{}|{[p: string]: *}}\r\n */\r\nexport const filterEmptyValues = (values) => {\r\n return Object.keys(values).filter(key => Boolean(values[key])).reduce((obj, key) => ({\r\n ...obj,\r\n [key]: values[key]\r\n }), {});\r\n}\r\n\r\nexport const formatPrice = (price, currencyCode) => {\r\n const {prefix, suffix, decimalSeparator, minorUnit, thousandSeparator} = getCurrency(currencyCode);\r\n if (price == '' || price === undefined) {\r\n return price;\r\n }\r\n\r\n price = typeof price === 'string' ? parseInt(price, 10) : price;\r\n price = price / 10 ** minorUnit;\r\n price = price.toString().replace('.', decimalSeparator);\r\n let fractional = '';\r\n const index = price.indexOf(decimalSeparator);\r\n if (index < 0) {\r\n price += `${decimalSeparator}${new Array(minorUnit + 1).join('0')}`;\r\n } else {\r\n const fractional = price.substr(index + 1);\r\n if (fractional.length < minorUnit) {\r\n price += new Array(minorUnit - fractional.length + 1).join('0');\r\n }\r\n }\r\n\r\n // separate out price and decimals so thousands separator can be added.\r\n ({1: price, 2: fractional} = price.match(new RegExp(`(\\\\d+)\\\\${decimalSeparator}(\\\\d+)`)));\r\n price = price.replace(new RegExp(`\\\\B(?=(\\\\d{3})+(?!\\\\d))`, 'g'), `${thousandSeparator}`);\r\n price = price + decimalSeparator + fractional;\r\n price = prefix + price + suffix;\r\n return price;\r\n}\r\n\r\nexport const getShippingOptions = (shippingRates) => {\r\n let options = [];\r\n shippingRates.forEach((shippingPackage, idx) => {\r\n // sort by selected rate\r\n shippingPackage.shipping_rates.sort((rate) => {\r\n return rate.selected ? -1 : 1;\r\n });\r\n let rates = shippingPackage.shipping_rates.map(rate => {\r\n let txt = document.createElement('textarea');\r\n txt.innerHTML = rate.name;\r\n let price = formatPrice(rate.price, rate.currency_code);\r\n return {\r\n id: getShippingOptionId(idx, rate.rate_id),\r\n label: txt.value,\r\n //detail: `${price}`,\r\n amount: parseInt(rate.price, 10)\r\n }\r\n });\r\n options = [...options, ...rates];\r\n });\r\n return options;\r\n}\r\n\r\nexport const getShippingOptionId = (packageId, rateId) => `${packageId}:${rateId}`\r\n\r\nexport const getDisplayItems = (cartItems, {minorUnit}) => {\r\n let items = [];\r\n const keys = ['total_tax', 'total_shipping'];\r\n cartItems.forEach(item => {\r\n if (0 < item.value || (item.key && keys.includes(item.key))) {\r\n items.push({\r\n label: item.label,\r\n pending: false,\r\n amount: item.value\r\n });\r\n }\r\n })\r\n return items;\r\n}\r\n\r\nconst canPay = {};\r\n\r\nexport const canMakePayment = ({country, currency, total}, callback) => {\r\n return new Promise((resolve, reject) => {\r\n const key = [country, currency, total.amount].reduce((key, value) => `${key}-${value}`);\r\n if (!currency) {\r\n return resolve(false);\r\n }\r\n if (key in canPay) {\r\n return resolve(canPay[key]);\r\n }\r\n return initStripe.then(stripe => {\r\n if (stripe.error) {\r\n return reject(stripe.error);\r\n }\r\n const request = stripe.paymentRequest({\r\n country,\r\n currency,\r\n total\r\n });\r\n request.canMakePayment().then(result => {\r\n canPay[key] = callback(result);\r\n return resolve(canPay[key]);\r\n });\r\n }).catch(reject);\r\n });\r\n};\r\n\r\nexport const registerLocalPaymentMethod = (paymentMethod) => {\r\n localPaymentMethods.push(paymentMethod);\r\n}\r\n\r\nexport const getLocalPaymentMethods = () => localPaymentMethods;\r\n\r\nexport const cartContainsPreOrder = () => {\r\n const data = getSetting('stripePaymentData');\r\n return data && data.pre_order;\r\n}\r\n\r\nexport const cartContainsSubscription = () => {\r\n const data = getSetting('stripePaymentData');\r\n return data && data.subscription;\r\n}\r\n\r\nexport const getDefaultSourceArgs = ({type, amount, billingData, currency, returnUrl}) => {\r\n return {\r\n type,\r\n amount,\r\n currency,\r\n owner: getBillingDetailsFromAddress(billingData),\r\n redirect: {\r\n return_url: returnUrl\r\n }\r\n }\r\n}\r\n\r\nexport const isTestMode = () => {\r\n return getSetting('stripeGeneralData').mode === 'test';\r\n}\r\n\r\nconst getCacheKey = (key) => `${CACHE_PREFIX}${key}`;\r\n\r\nexport const storeInCache = (key, value) => {\r\n const exp = Math.floor(new Date().getTime() / 1000) + (60 * 15);\r\n if ('sessionStorage' in window) {\r\n sessionStorage.setItem(getCacheKey(key), JSON.stringify({value, exp}));\r\n }\r\n}\r\n\r\nexport const getFromCache = (key) => {\r\n if ('sessionStorage' in window) {\r\n try {\r\n const item = JSON.parse(sessionStorage.getItem(getCacheKey(key)));\r\n if (item) {\r\n const {value, exp} = item;\r\n if (Math.floor(new Date().getTime() / 1000) > exp) {\r\n deleteFromCache(getCacheKey(key));\r\n } else {\r\n return value;\r\n }\r\n }\r\n } catch (err) {\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport const deleteFromCache = (key) => {\r\n if ('sessionStorage' in window) {\r\n sessionStorage.removeItem(getCacheKey(key));\r\n }\r\n}\r\n\r\nexport const versionCompare = (ver1, ver2, compare) => {\r\n switch (compare) {\r\n case '<':\r\n return ver1 < ver2;\r\n case '>':\r\n return ver1 > ver2;\r\n case '<=':\r\n return ver1 <= ver2;\r\n case '>=':\r\n return ver1 >= ver2;\r\n case '=':\r\n return ver1 == ver2;\r\n }\r\n return false;\r\n}\r\n\r\nexport const isCartPage = () => getSetting('stripeGeneralData').page === 'cart';\r\n\r\nexport const isCheckoutPage = () => getSetting('stripeGeneralData').page === 'checkout';","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"sourceRoot":""}
packages/blocks/src/Payments/PaymentsApi.php CHANGED
@@ -198,7 +198,7 @@ class PaymentsApi {
198
  'publishableKey' => wc_stripe_get_publishable_key(),
199
  'account' => wc_stripe_get_account_id(),
200
  'version' => $this->config->get_version(),
201
- 'mode' => wc_stripe_mode(),
202
  'routes' => array(
203
  'process/payment' => \WC_Stripe_Rest_API::get_endpoint( stripe_wc()->rest_api->checkout->rest_uri( 'checkout/payment' ) ),
204
  'create/setup_intent' => \WC_Stripe_Rest_API::get_endpoint( stripe_wc()->rest_api->payment_intent->rest_uri( 'setup-intent' ) ),
198
  'publishableKey' => wc_stripe_get_publishable_key(),
199
  'account' => wc_stripe_get_account_id(),
200
  'version' => $this->config->get_version(),
201
+ 'blocksVersion' => \Automattic\WooCommerce\Blocks\Package::get_version(),
202
  'routes' => array(
203
  'process/payment' => \WC_Stripe_Rest_API::get_endpoint( stripe_wc()->rest_api->checkout->rest_uri( 'checkout/payment' ) ),
204
  'create/setup_intent' => \WC_Stripe_Rest_API::get_endpoint( stripe_wc()->rest_api->payment_intent->rest_uri( 'setup-intent' ) ),
packages/cartflows/assets/js/index.js ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import $ from 'jquery';
2
+ import {loadStripe} from '@stripe/stripe-js';
3
+ import apiFetch from "@wordpress/api-fetch";
4
+
5
+ const data = cartflows_offer.stripeData;
6
+ const getStripe = new Promise(resolve => {
7
+ loadStripe(data.key, (() => data.accountId ? {stripeAccount: data.accountId} : {})()).then(stripe => {
8
+ resolve(stripe);
9
+ }).catch(error => {
10
+ resolve(false);
11
+ })
12
+ });
13
+
14
+ let currentButton;
15
+
16
+ const initialize = () => {
17
+ window.addEventListener('hashchange', handleHashChange);
18
+ $(document.body).on('click', 'a[href*="wcf-up-offer"], a[href*="wcf-down-offer"]', handleButtonClick);
19
+ }
20
+
21
+ const handleButtonClick = (e) => {
22
+ currentButton = $(e.currentTarget);
23
+ }
24
+
25
+ const handleHashChange = async (e) => {
26
+ var match = e.newURL.match(/response=(.*)/);
27
+ if (match) {
28
+ try {
29
+ var obj = JSON.parse(window.atob(decodeURIComponent(match[1])));
30
+ if (obj && obj.hasOwnProperty('client_secret')) {
31
+ history.pushState({}, '', window.location.pathname + window.location.search);
32
+ handleCardAction(obj);
33
+ }
34
+ } catch (err) {
35
+
36
+ }
37
+ }
38
+ return true;
39
+ }
40
+
41
+ const handleCardAction = async ({client_secret, ...props}) => {
42
+ const stripe = await getStripe;
43
+ stripe.handleCardAction(client_secret).then(result => {
44
+ if (result.error) {
45
+ $('body').trigger('wcf-update-msg', [result.error.message, 'wcf-payment-error']);
46
+ setTimeout(() => {
47
+ $(document.body).trigger('wcf-hide-loader')
48
+ $(document.body).trigger('wcf-update-msg', [data.msg, 'wcf-payment-success']);
49
+ }, data.timeout);
50
+ syncPaymentIntent({client_secret, ...props});
51
+ } else {
52
+ triggerOfferClick();
53
+ }
54
+ })
55
+ }
56
+
57
+ const triggerOfferClick = () => {
58
+ currentButton.click();
59
+ }
60
+
61
+ const syncPaymentIntent = (data) => {
62
+ return new Promise((resolve, reject) => {
63
+ apiFetch({
64
+ path: '/wc-stripe/v1/cartflows/payment-intent',
65
+ method: 'POST',
66
+ data
67
+ }).then(response => {
68
+ }).catch(err => {
69
+ });
70
+ });
71
+ }
72
+
73
+ initialize();
packages/cartflows/build/wc-stripe-cartflows.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('jquery', 'wp-api-fetch', 'wp-polyfill'), 'version' => 'a1d618d2586c932c20af4c57c1213946');
packages/cartflows/build/wc-stripe-cartflows.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ (()=>{var e={926:e=>{function t(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var c=e.apply(r,n);function a(e){t(c,o,i,a,u,"next",e)}function u(e){t(c,o,i,a,u,"throw",e)}a(void 0)}))}}},713:e=>{e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},479:(e,t,r)=>{var n=r(316);e.exports=function(e,t){if(null==e)return{};var r,o,i=n(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}},316:e=>{e.exports=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}},465:(e,t,r)=>{"use strict";r.r(t),r.d(t,{loadStripe:()=>f});var n="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",c=null,a=function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.12.1",startTime:t})}(n,r),n},u=Promise.resolve().then((function(){return e=null,null!==c?c:c=new Promise((function(t,r){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{var c=function(){for(var e=document.querySelectorAll('script[src^="'.concat(n,'"]')),t=0;t<e.length;t++){var r=e[t];if(o.test(r.src))return r}return null}();c&&e?console.warn(i):c||(c=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(n).concat(t);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(r),r}(e)),c.addEventListener("load",(function(){window.Stripe?t(window.Stripe):r(new Error("Stripe.js not available"))})),c.addEventListener("error",(function(){r(new Error("Failed to load Stripe.js"))}))}catch(e){return void r(e)}else t(null)}));var e})),s=!1;u.catch((function(e){s||console.warn(e)}));var f=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s=!0;var n=Date.now();return u.then((function(e){return a(e,t,n)}))}},609:e=>{"use strict";e.exports=window.jQuery},15:e=>{"use strict";e.exports=window.regeneratorRuntime},606:e=>{"use strict";e.exports=window.wp.apiFetch}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e=r(318),t=e(r(713)),n=e(r(479)),o=e(r(15)),i=e(r(926)),c=e(r(609)),a=r(465),u=e(r(606));function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?s(Object(n),!0).forEach((function(r){(0,t.default)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l,d=cartflows_offer.stripeData,p=new Promise((function(e){(0,a.loadStripe)(d.key,d.accountId?{stripeAccount:d.accountId}:{}).then((function(t){e(t)})).catch((function(t){e(!1)}))})),w=function(){var e=(0,i.default)(o.default.mark((function e(t){var r,n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.newURL.match(/response=(.*)/))try{(n=JSON.parse(window.atob(decodeURIComponent(r[1]))))&&n.hasOwnProperty("client_secret")&&(history.pushState({},"",window.location.pathname+window.location.search),v(n))}catch(e){}return e.abrupt("return",!0);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=(0,i.default)(o.default.mark((function e(t){var r,i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.client_secret,i=(0,n.default)(t,["client_secret"]),e.next=3,p;case 3:e.sent.handleCardAction(r).then((function(e){e.error?((0,c.default)("body").trigger("wcf-update-msg",[e.error.message,"wcf-payment-error"]),setTimeout((function(){(0,c.default)(document.body).trigger("wcf-hide-loader"),(0,c.default)(document.body).trigger("wcf-update-msg",[d.msg,"wcf-payment-success"])}),d.timeout),h(f({client_secret:r},i))):y()}));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){l.click()},h=function(e){return new Promise((function(t,r){(0,u.default)({path:"/wc-stripe/v1/cartflows/payment-intent",method:"POST",data:e}).then((function(e){})).catch((function(e){}))}))};window.addEventListener("hashchange",w),(0,c.default)(document.body).on("click",'a[href*="wcf-up-offer"], a[href*="wcf-down-offer"]',(function(e){l=(0,c.default)(e.currentTarget)}))})(),(this.wc_stripe=this.wc_stripe||{})["wc-stripe-cartflows"]={}})();
2
+ //# sourceMappingURL=wc-stripe-cartflows.js.map
packages/cartflows/build/wc-stripe-cartflows.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutProperties.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack://wc_stripe.[name]/./node_modules/@stripe/stripe-js/dist/stripe.esm.js","webpack://wc_stripe.[name]/external \"jQuery\"","webpack://wc_stripe.[name]/external \"regeneratorRuntime\"","webpack://wc_stripe.[name]/external [\"wp\",\"apiFetch\"]","webpack://wc_stripe.[name]/webpack/bootstrap","webpack://wc_stripe.[name]/webpack/runtime/define property getters","webpack://wc_stripe.[name]/webpack/runtime/hasOwnProperty shorthand","webpack://wc_stripe.[name]/webpack/runtime/make namespace object","webpack://wc_stripe.[name]/./packages/cartflows/assets/js/index.js"],"names":["asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","module","exports","fn","self","this","args","arguments","apply","err","undefined","obj","Object","defineProperty","enumerable","configurable","writable","__esModule","objectWithoutPropertiesLoose","source","excluded","i","target","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","V3_URL","V3_URL_REGEX","EXISTING_SCRIPT_MESSAGE","stripePromise","initStripe","maybeStripe","startTime","stripe","_registerWrapper","name","version","registerWrapper","stripePromise$1","params","window","Stripe","console","warn","script","scripts","document","querySelectorAll","concat","test","src","findScript","queryString","advancedFraudSignals","createElement","headOrBody","head","body","Error","appendChild","injectScript","addEventListener","loadCalled","loadStripe","_len","Array","_key","Date","now","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","d","definition","o","get","prop","hasOwnProperty","r","Symbol","toStringTag","currentButton","data","cartflows_offer","stripeData","getStripe","accountId","stripeAccount","catch","handleHashChange","e","match","newURL","JSON","parse","atob","decodeURIComponent","history","pushState","location","pathname","search","handleCardAction","client_secret","props","result","trigger","message","setTimeout","msg","timeout","syncPaymentIntent","triggerOfferClick","click","path","method","response","on","currentTarget"],"mappings":"qBAAA,SAASA,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQC,EAAKC,GACpE,IACE,IAAIC,EAAOP,EAAIK,GAAKC,GAChBE,EAAQD,EAAKC,MACjB,MAAOC,GAEP,YADAP,EAAOO,GAILF,EAAKG,KACPT,EAAQO,GAERG,QAAQV,QAAQO,GAAOI,KAAKT,EAAOC,GAwBvCS,EAAOC,QApBP,SAA2BC,GACzB,OAAO,WACL,IAAIC,EAAOC,KACPC,EAAOC,UACX,OAAO,IAAIR,SAAQ,SAAUV,EAASC,GACpC,IAAIF,EAAMe,EAAGK,MAAMJ,EAAME,GAEzB,SAASf,EAAMK,GACbT,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,OAAQI,GAGlE,SAASJ,EAAOiB,GACdtB,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,QAASiB,GAGnElB,OAAMmB,S,QChBZT,EAAOC,QAfP,SAAyBS,EAAKlB,EAAKG,GAYjC,OAXIH,KAAOkB,EACTC,OAAOC,eAA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gB,+CAAG,WAAOC,GAAP,+EAErB,GADIC,EAAQD,EAAEE,OAAOD,MAAM,iBAEvB,KACQvF,EAAMyF,KAAKC,MAAMvD,OAAOwD,KAAKC,mBAAmBL,EAAM,QAC/CvF,EAAIyE,eAAe,mBAC1BoB,QAAQC,UAAU,GAAI,GAAI3D,OAAO4D,SAASC,SAAW7D,OAAO4D,SAASE,QACrEC,EAAiBlG,IAEvB,MAAOF,IATQ,0BAad,GAbc,2CAAH,sDAgBhBoG,EAAgB,+CAAG,oGAAQC,EAAR,EAAQA,cAAkBC,GAA1B,2CACAnB,EADA,cAEdiB,iBAAiBC,GAAe9G,MAAK,SAAAgH,GACpCA,EAAOnH,QACP,aAAE,QAAQoH,QAAQ,iBAAkB,CAACD,EAAOnH,MAAMqH,QAAS,sBAC3DC,YAAW,YACP,aAAE/D,SAASW,MAAMkD,QAAQ,oBACzB,aAAE7D,SAASW,MAAMkD,QAAQ,iBAAkB,CAACxB,EAAK2B,IAAK,0BACvD3B,EAAK4B,SACRC,EAAkB,EAAD,CAAER,iBAAkBC,KAErCQ,OAXa,2CAAH,sDAgBhBA,EAAoB,WACtB/B,EAAcgC,SAGZF,EAAoB,SAAC7B,GACvB,OAAO,IAAI1F,SAAQ,SAACV,EAASC,IACzB,aAAS,CACLmI,KAAM,yCACNC,OAAQ,OACRjC,SACDzF,MAAK,SAAA2H,OACL5B,OAAM,SAAAtF,WAnDbqC,OAAOqB,iBAAiB,aAAc6B,IACtC,aAAE5C,SAASW,MAAM6D,GAAG,QAAS,sDAGP,SAAC3B,GACvBT,GAAgB,aAAES,EAAE4B,mB","file":"wc-stripe-cartflows.js","sourcesContent":["function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;","var V3_URL = 'https://js.stripe.com/v3';\nvar V3_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/;\nvar EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';\nvar findScript = function findScript() {\n var scripts = document.querySelectorAll(\"script[src^=\\\"\".concat(V3_URL, \"\\\"]\"));\n\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n\n if (!V3_URL_REGEX.test(script.src)) {\n continue;\n }\n\n return script;\n }\n\n return null;\n};\n\nvar injectScript = function injectScript(params) {\n var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';\n var script = document.createElement('script');\n script.src = \"\".concat(V3_URL).concat(queryString);\n var headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');\n }\n\n headOrBody.appendChild(script);\n return script;\n};\n\nvar registerWrapper = function registerWrapper(stripe, startTime) {\n if (!stripe || !stripe._registerWrapper) {\n return;\n }\n\n stripe._registerWrapper({\n name: 'stripe-js',\n version: \"1.12.1\",\n startTime: startTime\n });\n};\n\nvar stripePromise = null;\nvar loadScript = function loadScript(params) {\n // Ensure that we only attempt to load Stripe.js at most once\n if (stripePromise !== null) {\n return stripePromise;\n }\n\n stripePromise = new Promise(function (resolve, reject) {\n if (typeof window === 'undefined') {\n // Resolve to null when imported server side. This makes the module\n // safe to import in an isomorphic code base.\n resolve(null);\n return;\n }\n\n if (window.Stripe && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n }\n\n if (window.Stripe) {\n resolve(window.Stripe);\n return;\n }\n\n try {\n var script = findScript();\n\n if (script && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n } else if (!script) {\n script = injectScript(params);\n }\n\n script.addEventListener('load', function () {\n if (window.Stripe) {\n resolve(window.Stripe);\n } else {\n reject(new Error('Stripe.js not available'));\n }\n });\n script.addEventListener('error', function () {\n reject(new Error('Failed to load Stripe.js'));\n });\n } catch (error) {\n reject(error);\n return;\n }\n });\n return stripePromise;\n};\nvar initStripe = function initStripe(maybeStripe, args, startTime) {\n if (maybeStripe === null) {\n return null;\n }\n\n var stripe = maybeStripe.apply(undefined, args);\n registerWrapper(stripe, startTime);\n return stripe;\n};\n\n// own script injection.\n\nvar stripePromise$1 = Promise.resolve().then(function () {\n return loadScript(null);\n});\nvar loadCalled = false;\nstripePromise$1[\"catch\"](function (err) {\n if (!loadCalled) {\n console.warn(err);\n }\n});\nvar loadStripe = function loadStripe() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n loadCalled = true;\n var startTime = Date.now();\n return stripePromise$1.then(function (maybeStripe) {\n return initStripe(maybeStripe, args, startTime);\n });\n};\n\nexport { loadStripe };\n","module.exports = window[\"jQuery\"];","module.exports = window[\"regeneratorRuntime\"];","module.exports = window[\"wp\"][\"apiFetch\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import $ from 'jquery';\r\nimport {loadStripe} from '@stripe/stripe-js';\r\nimport apiFetch from \"@wordpress/api-fetch\";\r\n\r\nconst data = cartflows_offer.stripeData;\r\nconst getStripe = new Promise(resolve => {\r\n loadStripe(data.key, (() => data.accountId ? {stripeAccount: data.accountId} : {})()).then(stripe => {\r\n resolve(stripe);\r\n }).catch(error => {\r\n resolve(false);\r\n })\r\n});\r\n\r\nlet currentButton;\r\n\r\nconst initialize = () => {\r\n window.addEventListener('hashchange', handleHashChange);\r\n $(document.body).on('click', 'a[href*=\"wcf-up-offer\"], a[href*=\"wcf-down-offer\"]', handleButtonClick);\r\n}\r\n\r\nconst handleButtonClick = (e) => {\r\n currentButton = $(e.currentTarget);\r\n}\r\n\r\nconst handleHashChange = async (e) => {\r\n var match = e.newURL.match(/response=(.*)/);\r\n if (match) {\r\n try {\r\n var obj = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n if (obj && obj.hasOwnProperty('client_secret')) {\r\n history.pushState({}, '', window.location.pathname + window.location.search);\r\n handleCardAction(obj);\r\n }\r\n } catch (err) {\r\n\r\n }\r\n }\r\n return true;\r\n}\r\n\r\nconst handleCardAction = async ({client_secret, ...props}) => {\r\n const stripe = await getStripe;\r\n stripe.handleCardAction(client_secret).then(result => {\r\n if (result.error) {\r\n $('body').trigger('wcf-update-msg', [result.error.message, 'wcf-payment-error']);\r\n setTimeout(() => {\r\n $(document.body).trigger('wcf-hide-loader')\r\n $(document.body).trigger('wcf-update-msg', [data.msg, 'wcf-payment-success']);\r\n }, data.timeout);\r\n syncPaymentIntent({client_secret, ...props});\r\n } else {\r\n triggerOfferClick();\r\n }\r\n })\r\n}\r\n\r\nconst triggerOfferClick = () => {\r\n currentButton.click();\r\n}\r\n\r\nconst syncPaymentIntent = (data) => {\r\n return new Promise((resolve, reject) => {\r\n apiFetch({\r\n path: '/wc-stripe/v1/cartflows/payment-intent',\r\n method: 'POST',\r\n data\r\n }).then(response => {\r\n }).catch(err => {\r\n });\r\n });\r\n}\r\n\r\ninitialize();"],"sourceRoot":""}
packages/cartflows/src/Constants.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe;
5
+
6
+
7
+ class Constants {
8
+
9
+ const CARTFLOWS_PAYMENT_INTENT_ID = '_cartflows_payment_intent_';
10
+ }
packages/cartflows/src/Main.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe;
5
+
6
+
7
+ class Main {
8
+
9
+ public static function init() {
10
+ if ( self::cartflows_enabled() ) {
11
+ new PaymentsApi();
12
+ new RoutesApi();
13
+ }
14
+ }
15
+
16
+ public static function cartflows_enabled() {
17
+ return defined( 'CARTFLOWS_FILE' );
18
+ }
19
+ }
packages/cartflows/src/PaymentGateways/BasePaymentGateway.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe\PaymentGateways;
5
+
6
+
7
+ use PaymentPlugins\CartFlows\Stripe\Constants;
8
+
9
+ /**
10
+ * Class BasePaymentGateway
11
+ * @package PaymentPlugins\CartFlows\Stripe\PaymentGateways
12
+ */
13
+ class BasePaymentGateway {
14
+
15
+ protected $name;
16
+
17
+ protected $supports_api_refund = true;
18
+
19
+ /**
20
+ * @var \WC_Stripe_Payment
21
+ */
22
+ protected $payment_client;
23
+
24
+ /**
25
+ * @var \WC_Payment_Gateway_Stripe
26
+ */
27
+ protected $payment_method;
28
+
29
+ public function __construct() {
30
+
31
+ }
32
+
33
+ public static function get_instance() {
34
+ return new static();
35
+ }
36
+
37
+ public function is_api_refund() {
38
+ return $this->supports_api_refund;
39
+ }
40
+
41
+ public function init_payment_client( $payment_method ) {
42
+ $this->payment_method = WC()->payment_gateways()->payment_gateways()[ $payment_method ];
43
+ $this->payment_client = \WC_Stripe_Payment_Factory::load( 'payment_intent', $this->payment_method, \WC_Stripe_Gateway::load() );
44
+ }
45
+
46
+ /**
47
+ * @param \WC_Order $order
48
+ * @param array $product
49
+ */
50
+ public function process_offer_payment( \WC_Order $order, array $product ) {
51
+ $this->init_payment_client( $order->get_payment_method() );
52
+
53
+ $this->payment_method->set_payment_method_token( $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN ) );
54
+
55
+ if ( ( $payment_intent = $order->get_meta( Constants::CARTFLOWS_PAYMENT_INTENT_ID . $product['step_id'] ) ) ) {
56
+ $intent = $this->payment_client->get_gateway()->paymentIntents->retrieve( $payment_intent );
57
+ } else {
58
+ $intent = $this->create_payment_intent( $order, $product );
59
+ }
60
+
61
+ if ( is_wp_error( $intent ) ) {
62
+ return false;
63
+ }
64
+
65
+ $order->update_meta_data( Constants::CARTFLOWS_PAYMENT_INTENT_ID . $product['step_id'], $intent->id );
66
+ $order->save();
67
+
68
+ // check if intent needs confirmation
69
+ if ( $intent->status === \WC_Stripe_Constants::REQUIRES_CONFIRMATION ) {
70
+ $intent = $this->payment_client->get_gateway()->paymentIntents->confirm( $intent->id );
71
+ if ( is_wp_error( $intent ) ) {
72
+ return false;
73
+ }
74
+ }
75
+
76
+ if ( $intent->status === \WC_Stripe_Constants::REQUIRES_ACTION ) {
77
+ // send json response so Stripe can handle 3DS
78
+ return wp_send_json( array(
79
+ 'status' => 'success',
80
+ 'redirect' => $this->payment_method->get_payment_intent_checkout_url( $intent, $order )
81
+ ) );
82
+ }
83
+
84
+ if ( in_array( $intent->status, array( \WC_Stripe_Constants::SUCCEEDED, \WC_Stripe_Constants::REQUIRES_CAPTURE ) ) ) {
85
+ $order->update_meta_data( 'cartflows_offer_txn_resp_' . $product['step_id'], $intent->charges->data[0]->id );
86
+ $order->save();
87
+
88
+ return true;
89
+ }
90
+
91
+ }
92
+
93
+ /**
94
+ * @param \WC_Order $order
95
+ * @param array $product_data
96
+ */
97
+ private function create_payment_intent( $order, $product_data ) {
98
+ $args = array(
99
+ 'amount' => wc_stripe_add_number_precision( $product_data['price'], $order->get_currency() ),
100
+ 'currency' => $order->get_currency(),
101
+ 'description' => sprintf( __( '%1$s - Order %2$s - One Time offer', 'cartflows-pro' ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), $order->get_order_number() ),
102
+ 'payment_method' => $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN ),
103
+ 'confirmation_method' => $this->payment_method->get_confirmation_method( $order ),
104
+ 'capture_method' => $this->payment_method->get_option( 'charge_type' ) === 'capture' ? 'automatic' : 'manual',
105
+ 'confirm' => false,
106
+ 'payment_method_types' => array( $this->payment_method->get_payment_method_type() ),
107
+ 'customer' => wc_stripe_get_customer_id( $order->get_customer_id() )
108
+ );
109
+ $this->payment_client->add_order_shipping_address( $args, $order );
110
+ $this->payment_client->add_order_metadata( $args, $order );
111
+
112
+ $args = apply_filters( 'wc_stripe_payment_intent_args', $args, $order, $this->payment_client );
113
+
114
+ return $this->payment_client->get_gateway()->paymentIntents->create( $args );
115
+ }
116
+
117
+ /**
118
+ * @param \WC_Order $order
119
+ * @param array $offer_data
120
+ */
121
+ public function process_offer_refund( \WC_Order $order, array $offer_data ) {
122
+ $this->init_payment_client( $order->get_payment_method() );
123
+ $mode = wc_stripe_order_mode( $order );
124
+ $refund = $this->payment_client->get_gateway()->refunds->mode( $mode )->create( array(
125
+ 'charge' => $offer_data['transaction_id'],
126
+ 'amount' => wc_stripe_add_number_precision( $offer_data['refund_amount'], $order->get_currency() ),
127
+ 'metadata' => array(
128
+ 'order_id' => $order->get_id(),
129
+ 'created_via' => 'woocommerce'
130
+ )
131
+ ) );
132
+ if ( is_wp_error( $refund ) ) {
133
+ return false;
134
+ }
135
+
136
+ return $refund->id;
137
+ }
138
+ }
packages/cartflows/src/PaymentsApi.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe;
5
+
6
+
7
+ class PaymentsApi {
8
+
9
+ public function __construct() {
10
+ add_filter( 'cartflows_offer_supported_payment_gateways', array( $this, 'add_payment_gateways' ) );
11
+ add_filter( 'cartflows_offer_supported_payment_gateway_slugs', array( $this, 'add_payment_gateway_slugs' ) );
12
+ add_filter( 'wc_stripe_force_save_payment_method', array( $this, 'maybe_force_save_payment_method' ), 10, 3 );
13
+ add_filter( 'cartflows_offer_js_localize', array( $this, 'enqueue_scripts' ) );
14
+ }
15
+
16
+ public static function add_payment_gateways( $supported_gateways ) {
17
+ $ids = array( 'stripe_cc', 'stripe_googlepay', 'stripe_applepay', 'stripe_payment_request' );
18
+ foreach ( $ids as $id ) {
19
+ $supported_gateways[ $id ] = array(
20
+ 'path' => dirname( __FILE__ ) . '/PaymentGateways/BasePaymentGateway.php',
21
+ 'class' => '\PaymentPlugins\CartFlows\Stripe\PaymentGateways\BasePaymentGateway'
22
+ );
23
+ }
24
+
25
+ return $supported_gateways;
26
+ }
27
+
28
+ public function add_payment_gateway_slugs( $gateways ) {
29
+ // check if scripts are being enqueued because for some reason the cartflows code
30
+ // also uses filter cartflows_offer_supported_payment_gateway_slugs to determine if
31
+ // the offer should be skipped
32
+ if ( doing_action( 'wp_enqueue_scripts' ) ) {
33
+ return $gateways;
34
+ }
35
+ $gateways[] = 'stripe_cc';
36
+
37
+ return $gateways;
38
+ }
39
+
40
+ /**
41
+ * @param $bool
42
+ * @param $order
43
+ * @param $payment_method
44
+ *
45
+ * @return bool
46
+ */
47
+ public function maybe_force_save_payment_method( bool $bool, \WC_Order $order, \WC_Payment_Gateway_Stripe $payment_method ) {
48
+ // validate that next step is an offer
49
+ $checkout_id = wcf()->utils->get_checkout_id_from_post_data();
50
+ $flow_id = wcf()->utils->get_flow_id_from_post_data();
51
+ if ( $checkout_id && $flow_id ) {
52
+ $wcf_step_obj = wcf_pro_get_step( $checkout_id );
53
+ $next_step_id = $wcf_step_obj->get_next_step_id();
54
+ $wcf_next_step_obj = wcf_pro_get_step( $next_step_id );
55
+ if ( $next_step_id && $wcf_next_step_obj->is_offer_page() && ! $payment_method->use_saved_source() ) {
56
+ $bool = true;
57
+ }
58
+ }
59
+
60
+ return $bool;
61
+ }
62
+
63
+ /**
64
+ * @param array $localize
65
+ */
66
+ public function enqueue_scripts( $localize ) {
67
+ if ( $localize['payment_method'] === 'stripe_cc' ) {
68
+ $localize['stripeData'] = array(
69
+ 'key' => wc_stripe_get_publishable_key(),
70
+ 'accountId' => wc_stripe_get_account_id(),
71
+ 'version' => stripe_wc()->version(),
72
+ 'mode' => wc_stripe_mode(),
73
+ 'msg' => __( 'Processing Order...', 'cartflows-pro' ),
74
+ 'timeout' => 3000,
75
+ 'routes' => array(
76
+ 'syncPaymentIntent' => \WC_Stripe_Rest_API::get_endpoint( stripe_wc()->rest_api->payment_intent->rest_uri( 'sync-payment-intent' ) )
77
+ )
78
+ );
79
+ // enqueue cartflows script
80
+ $assets_url = plugin_dir_url( __DIR__ ) . 'build/';
81
+ $assets = require_once dirname( __DIR__ ) . '/build/wc-stripe-cartflows.asset.php';
82
+ wp_enqueue_script( 'wc-stripe-cartflows', $assets_url . 'wc-stripe-cartflows.js', $assets['dependencies'], stripe_wc()->version(), true );
83
+ }
84
+
85
+ return $localize;
86
+ }
87
+ }
packages/cartflows/src/Routes/AbstractRoute.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe\Routes;
5
+
6
+
7
+ abstract class AbstractRoute {
8
+
9
+ protected $namespace = 'wc-stripe/v1/cartflows';
10
+
11
+ /**
12
+ * @var \WC_Stripe_Gateway
13
+ */
14
+ protected $client;
15
+
16
+ /**
17
+ * AbstractRoute constructor.
18
+ *
19
+ * @param \WC_Stripe_Gateway $client
20
+ */
21
+ public function __construct( \WC_Stripe_Gateway $client ) {
22
+ $this->client = $client;
23
+ }
24
+
25
+ public function get_namespace() {
26
+ return $this->namespace;
27
+ }
28
+
29
+ public abstract function get_route_args();
30
+
31
+ public abstract function get_path();
32
+
33
+ public function handle_request( \WP_REST_Request $request ) {
34
+ $method = strtolower( 'handle_' . $request->get_method() . '_request' );
35
+
36
+ if ( method_exists( $this, $method ) ) {
37
+ try {
38
+ $result = $this->{$method}( $request );
39
+
40
+ return rest_ensure_response( $result );
41
+ } catch ( \Exception $e ) {
42
+ return new \WP_Error( 'wc-stripe-cartflow-error', $e->getMessage(), array(
43
+ 'status' => 200
44
+ ) );
45
+ }
46
+ }
47
+ }
48
+ }
packages/cartflows/src/Routes/PaymentIntentRoute.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe\Routes;
5
+
6
+
7
+ use PaymentPlugins\CartFlows\Stripe\Constants;
8
+
9
+ class PaymentIntentRoute extends AbstractRoute {
10
+
11
+ public function get_route_args() {
12
+ return array(
13
+ array(
14
+ 'methods' => \WP_REST_Server::EDITABLE,
15
+ 'callback' => array( $this, 'handle_request' ),
16
+ 'permission_callback' => '__return_true',
17
+ 'args' => array(
18
+ 'client_secret' => array(
19
+ 'type' => 'string',
20
+ 'required' => true
21
+ ),
22
+ 'order_id' => array(
23
+ 'type' => 'integer',
24
+ 'required' => true
25
+ )
26
+ )
27
+ )
28
+ );
29
+ }
30
+
31
+ public function get_path() {
32
+ return 'payment-intent';
33
+ }
34
+
35
+ public function handle_post_request( $request ) {
36
+ $order = wc_get_order( absint( $request['order_id'] ) );
37
+ if ( ! $order ) {
38
+ throw new \Exception( __( 'Invalid order id provided', 'woo-stripe-payment' ) );
39
+ }
40
+
41
+ $payment_intent = $this->client->paymentIntents->retrieve( $order->get_meta( Constants::CARTFLOWS_PAYMENT_INTENT_ID ) );
42
+ if ( is_wp_error( $payment_intent ) ) {
43
+ throw new \Exception( 'Invalid payment intent.' );
44
+ }
45
+
46
+ if ( ! hash_equals( $request['client_secret'], $payment_intent->client_secret ) ) {
47
+ throw new \Exception( __( 'You are not authorized to update this order.', 'woo-stripe-payment' ) );
48
+ }
49
+
50
+ if ( $payment_intent->status === \WC_Stripe_Constants::REQUIRES_PAYMENT_METHOD ) {
51
+ $payment_intent = $this->client->paymentIntents->update( $payment_intent->id, array(
52
+ 'payment_method' => $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN )
53
+ ) );
54
+ if ( is_wp_error( $payment_intent ) ) {
55
+ throw new \Exception( 'Update of payment intent failed.' );
56
+ }
57
+ }
58
+
59
+ return array( 'success' => true );
60
+
61
+ }
62
+ }
packages/cartflows/src/RoutesApi.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\CartFlows\Stripe;
5
+
6
+
7
+ use PaymentPlugins\CartFlows\Stripe\Routes\PaymentIntentRoute;
8
+
9
+ class RoutesApi {
10
+
11
+ private $routes = array();
12
+
13
+ public function __construct() {
14
+ $this->initialize();
15
+ add_action( 'rest_api_init', array( $this, 'add_rest_routes' ) );
16
+ }
17
+
18
+ private function initialize() {
19
+ $this->routes = array(
20
+ 'paymentIntent' => new PaymentIntentRoute( \WC_Stripe_Gateway::load() )
21
+ );
22
+ }
23
+
24
+ public function add_rest_routes() {
25
+ foreach ( $this->routes as $route ) {
26
+ register_rest_route( $route->get_namespace(), $route->get_path(), $route->get_route_args() );
27
+ }
28
+ }
29
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofo
4
  Requires at least: 3.0.1
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
- Stable tag: 3.3.2
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -60,6 +60,10 @@ If you're site is not loading over https, then Stripe won't render the Payment R
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
 
 
 
 
63
  = 3.3.2 =
64
  * Added - Render Clearpay logo when billing country is GB or currency is GBP
65
  * Updated - GPay buttonSizeMode set to fill
4
  Requires at least: 3.0.1
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
+ Stable tag: 3.3.3
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
63
+ = 3.3.3 =
64
+ * Added - [Cartflows](https://wordpress.org/plugins/cartflows/) support added for Credit Cards, Apple Pay, and Google Pay
65
+ * Fixed - Klarna order status remaining as pending in some scenarios and checkout page would not redirect to thank you page
66
+ * Fixed - Klarna [WooCommerce Blocks](https://wordpress.org/plugins/woo-gutenberg-products-block/) object comparison error
67
  = 3.3.2 =
68
  * Added - Render Clearpay logo when billing country is GB or currency is GBP
69
  * Updated - GPay buttonSizeMode set to fill
stripe-payments.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
- * Version: 3.3.2
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.7
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 5.3
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
@@ -28,6 +28,6 @@ define( 'WC_STRIPE_PLUGIN_FILE_PATH', plugin_dir_path( __FILE__ ) );
28
  define( 'WC_STRIPE_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
29
  define( 'WC_STRIPE_PLUGIN_NAME', plugin_basename( __FILE__ ) );
30
 
 
31
  // include main plugin file.
32
- require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-stripe.php' );
33
- require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'vendor/autoload.php' );
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
+ * Version: 3.3.3
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.7
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 5.4
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
28
  define( 'WC_STRIPE_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
29
  define( 'WC_STRIPE_PLUGIN_NAME', plugin_basename( __FILE__ ) );
30
 
31
+ require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'vendor/autoload.php' );
32
  // include main plugin file.
33
+ require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-stripe.php' );
 
vendor/composer/autoload_psr4.php CHANGED
@@ -7,5 +7,6 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  'Stripe\\' => array($vendorDir . '/stripe/stripe-php/lib'),
 
10
  'PaymentPlugins\\Blocks\\Stripe\\' => array($baseDir . '/packages/blocks/src'),
11
  );
7
 
8
  return array(
9
  'Stripe\\' => array($vendorDir . '/stripe/stripe-php/lib'),
10
+ 'PaymentPlugins\\CartFlows\\Stripe\\' => array($baseDir . '/packages/cartflows/src'),
11
  'PaymentPlugins\\Blocks\\Stripe\\' => array($baseDir . '/packages/blocks/src'),
12
  );
vendor/composer/autoload_static.php CHANGED
@@ -13,6 +13,7 @@ class ComposerStaticInit5768cfd8cdeac9b8b5d68cdcb14472ce
13
  ),
14
  'P' =>
15
  array (
 
16
  'PaymentPlugins\\Blocks\\Stripe\\' => 29,
17
  ),
18
  );
@@ -22,6 +23,10 @@ class ComposerStaticInit5768cfd8cdeac9b8b5d68cdcb14472ce
22
  array (
23
  0 => __DIR__ . '/..' . '/stripe/stripe-php/lib',
24
  ),
 
 
 
 
25
  'PaymentPlugins\\Blocks\\Stripe\\' =>
26
  array (
27
  0 => __DIR__ . '/../..' . '/packages/blocks/src',
13
  ),
14
  'P' =>
15
  array (
16
+ 'PaymentPlugins\\CartFlows\\Stripe\\' => 32,
17
  'PaymentPlugins\\Blocks\\Stripe\\' => 29,
18
  ),
19
  );
23
  array (
24
  0 => __DIR__ . '/..' . '/stripe/stripe-php/lib',
25
  ),
26
+ 'PaymentPlugins\\CartFlows\\Stripe\\' =>
27
+ array (
28
+ 0 => __DIR__ . '/../..' . '/packages/cartflows/src',
29
+ ),
30
  'PaymentPlugins\\Blocks\\Stripe\\' =>
31
  array (
32
  0 => __DIR__ . '/../..' . '/packages/blocks/src',