From a4b9e069d7f7e450bbfbf08b0c79d9286d6ba766 Mon Sep 17 00:00:00 2001 From: Damian Kaczmarczyk Date: Fri, 9 Apr 2021 10:49:44 +0200 Subject: [PATCH] Fix SpreeBraintreeVzero loading issues --- .../spree/frontend/spree_braintree_vzero.js | 4 +- .../braintree_vzero/_paypal_checkout.html.erb | 20 +- .../braintree_vzero/_three_d_secure.html.erb | 432 +++++++++--------- 3 files changed, 240 insertions(+), 216 deletions(-) diff --git a/app/assets/javascripts/spree/frontend/spree_braintree_vzero.js b/app/assets/javascripts/spree/frontend/spree_braintree_vzero.js index 1e3bd980..d827ae41 100644 --- a/app/assets/javascripts/spree/frontend/spree_braintree_vzero.js +++ b/app/assets/javascripts/spree/frontend/spree_braintree_vzero.js @@ -46,7 +46,8 @@ SpreeBraintreeVzero = { } } -$(document).ready(function() { +$(document).ready(function () { + var event = new Event('spreebraintree:ready'); paymentMethods = $('div[data-hook="checkout_payment_step"] input[type="radio"]').click(function (e) { SpreeBraintreeVzero.setSaveAndContinueVisibility(); }); @@ -65,4 +66,5 @@ $(document).ready(function() { SpreeBraintreeVzero.addDeviceData(); }); SpreeBraintreeVzero.setSaveAndContinueVisibility(); + window.dispatchEvent(event); }) diff --git a/app/views/spree/braintree_vzero/_paypal_checkout.html.erb b/app/views/spree/braintree_vzero/_paypal_checkout.html.erb index b3621fb7..780e8fd5 100644 --- a/app/views/spree/braintree_vzero/_paypal_checkout.html.erb +++ b/app/views/spree/braintree_vzero/_paypal_checkout.html.erb @@ -9,7 +9,7 @@ <% end %> diff --git a/app/views/spree/checkout/payment/braintree_vzero/_three_d_secure.html.erb b/app/views/spree/checkout/payment/braintree_vzero/_three_d_secure.html.erb index 4f05923a..3cacffb7 100644 --- a/app/views/spree/checkout/payment/braintree_vzero/_three_d_secure.html.erb +++ b/app/views/spree/checkout/payment/braintree_vzero/_three_d_secure.html.erb @@ -1,252 +1,258 @@