From 12e8a54ed6a70ea0be0eb590b7a6b1663308f52e Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Mon, 22 Jul 2019 15:42:57 +0530 Subject: [PATCH] PP EC Buttons Disappearing from Cart when interacting upsell products, PFW-427 --- assets/js/angelleye-in-context-checkout.js | 2 +- assets/js/angelleye-in-context-checkout.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/angelleye-in-context-checkout.js b/assets/js/angelleye-in-context-checkout.js index 9e6e80465..6d8e06937 100644 --- a/assets/js/angelleye-in-context-checkout.js +++ b/assets/js/angelleye-in-context-checkout.js @@ -500,7 +500,7 @@ jQuery(function ($) { }; } - $(document.body).on('updated_shipping_method wc_fragments_refreshed updated_checkout updated_wc_div updated_cart_totals wc_fragments_loaded', function (event) { + $(document.body).on('cart_totals_refreshed updated_shipping_method wc_fragments_refreshed updated_checkout updated_wc_div updated_cart_totals wc_fragments_loaded', function (event) { display_smart_button_on_cart_checkout(); }); if(angelleye_in_content_param.checkout_page_disable_smart_button === "no") { diff --git a/assets/js/angelleye-in-context-checkout.min.js b/assets/js/angelleye-in-context-checkout.min.js index f25ec33de..00ca0ae42 100644 --- a/assets/js/angelleye-in-context-checkout.min.js +++ b/assets/js/angelleye-in-context-checkout.min.js @@ -1 +1 @@ -jQuery(function(e){if("undefined"==typeof angelleye_in_content_param)return!1;function n(){var n=angelleye_in_content_param.disallowed_funding_methods;return null===n&&(n=[]),!(e.inArray("card",n)>-1)}function t(){e(".angelleye_button_single").length>0&&(e(".angelleye_button_single").empty(),window.paypalCheckoutReady=function(){allowed_funding_methods_single_array=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),disallowed_funding_methods_single_array=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&disallowed_funding_methods_single_array.push("credit");var t=function(){var n=e(".variations_form").find(".variations select"),t={},a=0,_=0;return n.each(function(){var n=e(this).data("attribute_name")||e(this).attr("name"),o=e(this).val()||"";o.length>0&&_++,a++,t[n]=o}),{count:a,chosenCount:_,data:t}};angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},"horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),e(".angelleye_button_single").empty(),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:allowed_funding_methods_single_array,disallowed:disallowed_funding_methods_single_array},payment:function(n,a){var _,o={nonce:angelleye_in_content_param.generate_cart_nonce,qty:e(".quantity .qty").val(),attributes:e(".variations_form").length?JSON.stringify(t().data):[],is_cc:"",product_id:e("input[name=add-to-cart]").val(),variation_id:e("input[name=variation_id]").val(),request_from:"JSv4",express_checkout:"true"};return _=angelleye_in_content_param.add_to_cart_ajaxurl,e("#wc-paypal_express-new-payment-method").is(":checked")&&(_+="&ec_save_to_account=true"),paypal.request.post(_,o).then(function(e){return paypal.request.post(e.url,{request_from:"JSv4"}).then(function(e){return e.token})})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"button_click"})},onError:function(n,t){console.log("err"),e(".angelleye_button_single").length&&(window.location.href=angelleye_in_content_param.cancel_page)}},".angelleye_button_single")})}function a(){window.paypalCheckoutReady=function(){var t,a=[],_=[];"yes"==angelleye_in_content_param.is_checkout&&"yes"==angelleye_in_content_param.is_display_on_checkout&&a.push(".angelleye_smart_button_checkout_top"),"yes"==angelleye_in_content_param.is_cart&&("both"==angelleye_in_content_param.cart_button_possition?a.push(".angelleye_smart_button_top",".angelleye_smart_button_bottom"):"bottom"==angelleye_in_content_param.cart_button_possition?a.push(".angelleye_smart_button_bottom"):"top"==angelleye_in_content_param.cart_button_possition&&a.push(".angelleye_smart_button_top")),_=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){if(e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&("horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")?n+="&ec_save_to_account=true":e("#wc-paypal_express-new-payment-method_bottom").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a)),"angelleye_smart_button_checkout_top"===a)return!1})}}function _(){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_mini"),_=e.parseJSON(angelleye_in_content_param.mini_cart_disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.mini_cart_allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.mini_cart_button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.mini_cart_button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&(angelleye_cart_style_object.size="responsive","horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a))})}}function o(){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_wsc"),_=e.parseJSON(angelleye_in_content_param.wsc_cart_disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.wsc_cart_allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.wsc_cart_button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.wsc_cart_button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&(angelleye_cart_style_object.size="responsive","horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a))})}}if(a(),_(),t(),o(),e(document.body).on("updated_shipping_method wc_fragments_refreshed updated_checkout updated_wc_div updated_cart_totals wc_fragments_loaded",function(e){a()}),"no"===angelleye_in_content_param.checkout_page_disable_smart_button&&e(document.body).on("updated_shipping_method wc_fragments_refreshed updated_checkout",function(t){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_checkout_bottom"),_=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){if(e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&("horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n=e(a).closest("form").add(e(' ').attr("value","JSv4")).add(e(' ').attr("value","yes")).serialize();return paypal.request({method:"post",url:angelleye_in_content_param.set_express_checkout,body:n}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a)),"angelleye_smart_button_checkout_bottom"===a)return!1})}}),e(document.body).on("wc_fragments_loaded wc_fragments_refreshed",function(){var n=e(".angelleye_smart_button_mini");n.length&&(n.empty(),_());var a=e(".angelleye_button_single");a.length&&(a.empty(),t());var l=e(".angelleye_smart_button_wsc");l.length&&(l.empty(),o())}),"no"===angelleye_in_content_param.checkout_page_disable_smart_button){function l(){var n=e("#payment_method_paypal_express").is(":checked");e('input[name="wc-paypal_express-payment-token"]:checked').length>0?n&&e('input[name="wc-paypal_express-payment-token"]').length&&"new"===e('input[name="wc-paypal_express-payment-token"]:checked').val()?(e("#place_order").hide(),e(".angelleye_smart_button_checkout_bottom").show()):n&&e('input[name="wc-paypal_express-payment-token"]').length&&"new"!==e('input[name="wc-paypal_express-payment-token"]:checked').val()?(e("#place_order").show(),e(".angelleye_smart_button_checkout_bottom").hide()):n?(e(".angelleye_smart_button_checkout_bottom").show(),e("#place_order").hide()):(e(".angelleye_smart_button_checkout_bottom").hide(),e("#place_order").show()):n?(e(".angelleye_smart_button_checkout_bottom").show(),e("#place_order").hide()):(e(".angelleye_smart_button_checkout_bottom").hide(),e("#place_order").show())}e(document.body).on("updated_checkout wc-credit-card-form-init update_checkout",function(e){l()}),e("form.checkout").on("click",'input[name="payment_method"]',function(){l()}),e("form.checkout").on("click",'input[name="wc-paypal_express-payment-token"]',function(){"new"===e(this).val()?(e("#place_order").hide(),e(".angelleye_smart_button_checkout_bottom").show()):"new"!==e(this).val()&&(e("#place_order").show(),e(".angelleye_smart_button_checkout_bottom").hide())})}}); \ No newline at end of file +jQuery(function(e){if("undefined"==typeof angelleye_in_content_param)return!1;function n(){var n=angelleye_in_content_param.disallowed_funding_methods;return null===n&&(n=[]),!(e.inArray("card",n)>-1)}function t(){e(".angelleye_button_single").length>0&&(e(".angelleye_button_single").empty(),window.paypalCheckoutReady=function(){allowed_funding_methods_single_array=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),disallowed_funding_methods_single_array=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&disallowed_funding_methods_single_array.push("credit");var t=function(){var n=e(".variations_form").find(".variations select"),t={},a=0,_=0;return n.each(function(){var n=e(this).data("attribute_name")||e(this).attr("name"),o=e(this).val()||"";o.length>0&&_++,a++,t[n]=o}),{count:a,chosenCount:_,data:t}};angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},"horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),e(".angelleye_button_single").empty(),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:allowed_funding_methods_single_array,disallowed:disallowed_funding_methods_single_array},payment:function(n,a){var _,o={nonce:angelleye_in_content_param.generate_cart_nonce,qty:e(".quantity .qty").val(),attributes:e(".variations_form").length?JSON.stringify(t().data):[],is_cc:"",product_id:e("input[name=add-to-cart]").val(),variation_id:e("input[name=variation_id]").val(),request_from:"JSv4",express_checkout:"true"};return _=angelleye_in_content_param.add_to_cart_ajaxurl,e("#wc-paypal_express-new-payment-method").is(":checked")&&(_+="&ec_save_to_account=true"),paypal.request.post(_,o).then(function(e){return paypal.request.post(e.url,{request_from:"JSv4"}).then(function(e){return e.token})})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"button_click"})},onError:function(n,t){console.log("err"),e(".angelleye_button_single").length&&(window.location.href=angelleye_in_content_param.cancel_page)}},".angelleye_button_single")})}function a(){window.paypalCheckoutReady=function(){var t,a=[],_=[];"yes"==angelleye_in_content_param.is_checkout&&"yes"==angelleye_in_content_param.is_display_on_checkout&&a.push(".angelleye_smart_button_checkout_top"),"yes"==angelleye_in_content_param.is_cart&&("both"==angelleye_in_content_param.cart_button_possition?a.push(".angelleye_smart_button_top",".angelleye_smart_button_bottom"):"bottom"==angelleye_in_content_param.cart_button_possition?a.push(".angelleye_smart_button_bottom"):"top"==angelleye_in_content_param.cart_button_possition&&a.push(".angelleye_smart_button_top")),_=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){if(e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&("horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")?n+="&ec_save_to_account=true":e("#wc-paypal_express-new-payment-method_bottom").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a)),"angelleye_smart_button_checkout_top"===a)return!1})}}function _(){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_mini"),_=e.parseJSON(angelleye_in_content_param.mini_cart_disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.mini_cart_allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.mini_cart_button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.mini_cart_button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&(angelleye_cart_style_object.size="responsive","horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a))})}}function o(){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_wsc"),_=e.parseJSON(angelleye_in_content_param.wsc_cart_disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.wsc_cart_allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.wsc_cart_button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.wsc_cart_button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&(angelleye_cart_style_object.size="responsive","horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n;return n=angelleye_in_content_param.set_express_checkout,e("#wc-paypal_express-new-payment-method").is(":checked")&&(n+="&ec_save_to_account=true"),paypal.request.post(n,{request_from:"JSv4"}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a))})}}if(a(),_(),t(),o(),e(document.body).on("cart_totals_refreshed updated_shipping_method wc_fragments_refreshed updated_checkout updated_wc_div updated_cart_totals wc_fragments_loaded",function(e){a()}),"no"===angelleye_in_content_param.checkout_page_disable_smart_button&&e(document.body).on("updated_shipping_method wc_fragments_refreshed updated_checkout",function(t){window.paypalCheckoutReady=function(){var t,a=[],_=[];a.push(".angelleye_smart_button_checkout_bottom"),_=e.parseJSON(angelleye_in_content_param.disallowed_funding_methods),t=e.parseJSON(angelleye_in_content_param.allowed_funding_methods),"no"==angelleye_in_content_param.is_paypal_credit_enable&&_.push("credit"),angelleye_cart_style_object={size:angelleye_in_content_param.button_size,color:angelleye_in_content_param.button_color,shape:angelleye_in_content_param.button_shape,label:angelleye_in_content_param.button_label,layout:angelleye_in_content_param.button_layout,tagline:"true"===angelleye_in_content_param.button_tagline},a.forEach(function(a){if(e(a).html(""),_=e.grep(_,function(e){return"venmo"!==e}),a.length>0&&e(a).length>0&&("horizontal"===angelleye_in_content_param.button_layout&&!0===n()&&"credit"!==angelleye_in_content_param.button_label&&"true"===angelleye_in_content_param.button_fundingicons&&(angelleye_cart_style_object.fundingicons="true"===angelleye_in_content_param.button_fundingicons),paypal.Button.render({env:angelleye_in_content_param.environment,style:angelleye_cart_style_object,locale:angelleye_in_content_param.locale,commit:"false"!==angelleye_in_content_param.zcommit,funding:{allowed:t,disallowed:_},payment:function(){var n=e(a).closest("form").add(e(' ').attr("value","JSv4")).add(e(' ').attr("value","yes")).serialize();return paypal.request({method:"post",url:angelleye_in_content_param.set_express_checkout,body:n}).then(function(e){return e.token})},onAuthorize:function(e,n){var t={paymentToken:e.paymentToken,payerID:e.payerID,token:e.paymentToken,request_from:"JSv4"};paypal.request.post(e.returnUrl,t).then(function(t){e.returnUrl=t.url,n.redirect()})},onCancel:function(e,n){window.location.href=angelleye_in_content_param.cancel_page},onClick:function(){"yes"===angelleye_in_content_param.enable_google_analytics_click&&"undefined"!=typeof ga&&e.isFunction(ga)&&ga("send",{hitType:"event",eventCategory:"Checkout",eventAction:"paypal_button_click"})},onError:function(e,n){window.location.href=angelleye_in_content_param.cancel_page}},a)),"angelleye_smart_button_checkout_bottom"===a)return!1})}}),e(document.body).on("wc_fragments_loaded wc_fragments_refreshed",function(){var n=e(".angelleye_smart_button_mini");n.length&&(n.empty(),_());var a=e(".angelleye_button_single");a.length&&(a.empty(),t());var l=e(".angelleye_smart_button_wsc");l.length&&(l.empty(),o())}),"no"===angelleye_in_content_param.checkout_page_disable_smart_button){function l(){var n=e("#payment_method_paypal_express").is(":checked");e('input[name="wc-paypal_express-payment-token"]:checked').length>0?n&&e('input[name="wc-paypal_express-payment-token"]').length&&"new"===e('input[name="wc-paypal_express-payment-token"]:checked').val()?(e("#place_order").hide(),e(".angelleye_smart_button_checkout_bottom").show()):n&&e('input[name="wc-paypal_express-payment-token"]').length&&"new"!==e('input[name="wc-paypal_express-payment-token"]:checked').val()?(e("#place_order").show(),e(".angelleye_smart_button_checkout_bottom").hide()):n?(e(".angelleye_smart_button_checkout_bottom").show(),e("#place_order").hide()):(e(".angelleye_smart_button_checkout_bottom").hide(),e("#place_order").show()):n?(e(".angelleye_smart_button_checkout_bottom").show(),e("#place_order").hide()):(e(".angelleye_smart_button_checkout_bottom").hide(),e("#place_order").show())}e(document.body).on("updated_checkout wc-credit-card-form-init update_checkout",function(e){l()}),e("form.checkout").on("click",'input[name="payment_method"]',function(){l()}),e("form.checkout").on("click",'input[name="wc-paypal_express-payment-token"]',function(){"new"===e(this).val()?(e("#place_order").hide(),e(".angelleye_smart_button_checkout_bottom").show()):"new"!==e(this).val()&&(e("#place_order").show(),e(".angelleye_smart_button_checkout_bottom").hide())})}}); \ No newline at end of file