From 7e076a599fceac0e18e748f81f255751734879f8 Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Mon, 16 Dec 2024 07:53:46 +0100 Subject: [PATCH] Closes #934 Incorrect display of infinite spelling on plan modal (#940) --- assets/js/pricing-modal.js | 2 +- assets/js/pricing-modal.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/pricing-modal.js b/assets/js/pricing-modal.js index 84c9a52d..80ac5978 100755 --- a/assets/js/pricing-modal.js +++ b/assets/js/pricing-modal.js @@ -162,7 +162,7 @@ mon = datas.monthly_cost, // 4.99 (monthly) quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime) cos = datas.cost, // 3.49 (onetime) - label = datas.label, + label = datas.label.replace(/_.*$/, ''), name = -1 === quo ? 'Unlimited' : (quo >= 1000 ? quo / 1000 + ' GB' : quo + ' MB'), pcs = 'monthly' === type ? {monthly: mon, yearly: Math.round(ann / 12 * 100) / 100} : cos, pcsd = pcs, // Used if discount is active. diff --git a/assets/js/pricing-modal.min.js b/assets/js/pricing-modal.min.js index 2339101c..39ecb227 100755 --- a/assets/js/pricing-modal.min.js +++ b/assets/js/pricing-modal.min.js @@ -1 +1 @@ -((t,i)=>{t(i).on("click.imagify",".imagify-tab",function(i){var a=t(this),e="imagify-current";i.preventDefault(),a.hasClass("imagify-current")||(i=a.find("a").attr("href")||"#"+a.find("a").attr("aria-controls"),a.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true"),t(i).fadeIn(275).attr("aria-hidden","false"),a.closest(".imagify-tabs").find(".imagify-tab").removeClass(e).attr("aria-selected","false"),a.addClass(e).attr("aria-selected","true"))}),t("#imagify-toggle-plan").change(function(){var i=t(this).is(":checked");t(".imagify-toggle-label").eq(0).css("color",i?"#c8ced5":"#3b3f4a"),t(".imagify-toggle-label").eq(1).css("color",i?"#3b3f4a":"#c8ced5"),t(".imagify-badge").toggleClass("imagify-badge-checked",i),t("#imagify_all_plan_view").toggleClass("imagify-year-selected",i).toggleClass("imagify-month-selected",!i),t(".imagify-arrow-container img").eq(0).toggle(!i),t(".imagify-arrow-container img").eq(1).toggle(i)})})(jQuery,document,window),((b,i,k)=>{var _={};b("#imagify-pricing-modal").length&&((_={$modal:b("#imagify-pricing-modal"),$checkboxes:b(".imagify-offer-line .imagify-checkbox"),$radios:b(".imagify-payment-modal .imagify-radio-line input"),$preView:b("#imagify-pre-checkout-view").hide(),$plansView:b("#imagify-plans-selection-view"),$paymentView:b("#imagify-payment-process-view").hide(),$successView:b("#imagify-success-view").hide(),$anotherBtn:b(".imagify-choose-another-plan"),speedFadeIn:300,getHtmlPrice:function(i,a){var e,t;return a=a||null,"object"!=typeof i?((i=(i+="").split("."))[1]=1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2),t=''+i[0]+" ",t+('.'+i[1])+""):(e=i.monthly+"",i=i.yearly+"",e="0"===e?["0","00"]:e.split("."),i="0"===i?["0","00"]:i.split("."),(t=(t=(t=(t='')+''+e[0]+" ")+'.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+" ")+''+i[0]+" ")+'.'+(1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2))+"")},getHtmlDiscountPrice:function(i,a){var e="";return a=a||null,e="object"==typeof i?(e=(e=(e+='$')+''+(i.monthly+"")+"")+'')+''+(i.yearly+"")+"":(e+='$')+''+(i+="")+""},populateOffer:function(i,a,e,t){var o,n=k.imagify_discount_datas,l=a.additional_gb,s=a.annual_cost,f=a.id,c=a.label,m=a.monthly_cost,r=a.quota,d=a.cost,a=a.label,g=-1===r?"Unlimited":1e3<=r?r/1e3+" GB":r+" MB",y="monthly"===e?{monthly:m,yearly:Math.round(s/12*100)/100}:d,p=y,u=[],h="",v="",u=_.getPromoAppliesTo(n);return n.is_active&&"percentage"===n.coupon_type&&"monthly"===e&&0

'+imagifyPricingModal.labels.errorPriceAPI+"

");else{if((k.imagify_discount_datas=a).is_active){if(a.applies_to instanceof Array){for(var d=[],g=[],y=0;yBest Value!')},100)),0===e.ot.length?(b(".imagify-pre-checkout-offers .imagify-offer-onetime").remove(),b(".imagify-tabs").remove(),b(".imagify-pricing-tab-onetime").remove()):b.each(e.ot,function(i,a){var e="";i===u.ot.index&&(i=b(".imagify-pre-checkout-offers .imagify-offer-onetime"),u.ot.selected&&(e=" imagify-offer-selected",i.addClass("imagify-offer-selected").find(".imagify-checkbox").prop("checked",!0)),_.populateOffer(i,a,"onetime")),i=b(n).clone(),i=_.populateOffer(i,a,"onetime",e),m+=i[0].outerHTML}),a&&(((p=_.getPromoAppliesTo(a)).includes(u.mo.plan_label)||p.includes(u.ot.plan_label)||"all"===p[0])&&b("#imagify-coupon-code").val(a.label),a.is_active)&&_.checkCoupon(),t.parent().find(".imagify-offer-line")&&t.parent().find(".imagify-offer-line").remove(),t.before(r),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(m)}_.$modal.find(".imagify-modal-loader").fadeOut(300),_.$modal.removeClass("imagify-modal-loading")}})}),_.populatePayBtn()})},getSuggestedOffers:function(i,e,t){var o,n,a,l,s,f,c=e.total+e.month,m={quota:0},r={mo:!1,ot:!1};return i.ot.length<0&&(a=i.ot[i.ot.length-1].id,l=i.ot[i.ot.length-1].label),i.ot.length<0&&(s=i.mo[i.mo.length-1].id,f=i.mo[i.mo.length-1].label),b.each(i.mo,function(i,a){return a.quota<0&&(n={index:i,selected:1,plan_id:a.id,plan_label:a.label}),a.quota>m.quota&&(m={index:i,selected:1,quota:a.quota,plan_id:a.id,plan_label:a.label}),0===a.monthly_cost&&0===a.annual_cost||a.quota<=0&&e.month>a.quota||e.total>a.quota||0<=a.quota&&e.montha.quota)&&(o=a,r.mo={index:i,selected:t>e.month&&t>e.total?0:1,plan_id:a.id,plan_label:a.label}),!0}),!1===r.mo&&(r.mo=void 0!==n?n:m),c-=i.mo[r.mo.index].quota,0!==i.ot.length&&(c<=0?(b.each(i.ot,function(i,a){return a.quota'+e.find(".imagify-price-by").text()+"",c=e.find(".imagify-price-discount").html(),m=e.find(".imagify-approx-nb").text(),r=e.find(".imagify-offer-size").text(),d=b("#imagify-coupon-code");i.preventDefault(),_.switchToView(_.$preView),l.find(".imagify-number-block").html(s+f),c?(l.find(".imagify-price-discount").length<=0&&l.find(".imagify-col-price").prepend(''),l.find(".imagify-price-discount").html(c),l.find(".imagify-price-discount").show()):l.find(".imagify-price-discount").hide(),l.find(".imagify-approx-nb").text(m),l.find(".imagify-offer-size").text(r),l.attr("data-offer",o),n||(l.find(".imagify-price-add-data").text(e.find(".imagify-price-add-data").text()),("monthly"===a?l.find("#imagify-subscription-monthly"):l.find("#imagify-subscription-yearly")).trigger("click.imagify"),l.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),(d=b("#imagify-coupon-code")).val(""),k.imagify_discount_datas&&((i=_.getPromoAppliesTo(k.imagify_discount_datas)).includes(t[Object.keys(t)[0]].label)||"all"===i[0])&&d.val(k.imagify_discount_datas.label),_.checkCoupon(),_.populatePayBtn()}),b("#imagify-modal-checkout-btn").on("click.imagify",function(i){var a,e;i.preventDefault(),b(this).hasClass("imagify-button-disabled")||(i=b(".imagify-offer-monthly"),a=b(".imagify-offer-onetime"),e={},i.hasClass("imagify-offer-selected")&&(e.monthly=JSON.parse(i.attr("data-offer"))),a.hasClass("imagify-offer-selected")&&(e.onetime=JSON.parse(a.attr("data-offer"))),imagifyPricingModal.userDataCache&&b.post(ajaxurl,{action:imagifyPricingModal.userDataCache.deleteAction,_wpnonce:imagifyPricingModal.userDataCache.deleteNonce}),_.switchToView(_.$paymentView),e.period=_.getPeriod(),_.iframeSetSrc(e))}),b(".imagify-back-to-plans").on("click.imagify",function(i){var a=b(this).closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime");i.preventDefault(),b(a?".imagify-offer-onetime":".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify")}),k.addEventListener("message",_.checkPluginMessage,!0))})(jQuery,document,window); \ No newline at end of file +((t,i)=>{t(i).on("click.imagify",".imagify-tab",function(i){var a=t(this),e="imagify-current";i.preventDefault(),a.hasClass("imagify-current")||(i=a.find("a").attr("href")||"#"+a.find("a").attr("aria-controls"),a.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true"),t(i).fadeIn(275).attr("aria-hidden","false"),a.closest(".imagify-tabs").find(".imagify-tab").removeClass(e).attr("aria-selected","false"),a.addClass(e).attr("aria-selected","true"))}),t("#imagify-toggle-plan").change(function(){var i=t(this).is(":checked");t(".imagify-toggle-label").eq(0).css("color",i?"#c8ced5":"#3b3f4a"),t(".imagify-toggle-label").eq(1).css("color",i?"#3b3f4a":"#c8ced5"),t(".imagify-badge").toggleClass("imagify-badge-checked",i),t("#imagify_all_plan_view").toggleClass("imagify-year-selected",i).toggleClass("imagify-month-selected",!i),t(".imagify-arrow-container img").eq(0).toggle(!i),t(".imagify-arrow-container img").eq(1).toggle(i)})})(jQuery,document,window),((b,i,k)=>{var _={};b("#imagify-pricing-modal").length&&((_={$modal:b("#imagify-pricing-modal"),$checkboxes:b(".imagify-offer-line .imagify-checkbox"),$radios:b(".imagify-payment-modal .imagify-radio-line input"),$preView:b("#imagify-pre-checkout-view").hide(),$plansView:b("#imagify-plans-selection-view"),$paymentView:b("#imagify-payment-process-view").hide(),$successView:b("#imagify-success-view").hide(),$anotherBtn:b(".imagify-choose-another-plan"),speedFadeIn:300,getHtmlPrice:function(i,a){var e,t;return a=a||null,"object"!=typeof i?((i=(i+="").split("."))[1]=1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2),t=''+i[0]+" ",t+('.'+i[1])+""):(e=i.monthly+"",i=i.yearly+"",e="0"===e?["0","00"]:e.split("."),i="0"===i?["0","00"]:i.split("."),(t=(t=(t=(t='')+''+e[0]+" ")+'.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+" ")+''+i[0]+" ")+'.'+(1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2))+"")},getHtmlDiscountPrice:function(i,a){var e="";return a=a||null,e="object"==typeof i?(e=(e=(e+='$')+''+(i.monthly+"")+"")+'')+''+(i.yearly+"")+"":(e+='$')+''+(i+="")+""},populateOffer:function(i,a,e,t){var o,n=k.imagify_discount_datas,l=a.additional_gb,s=a.annual_cost,f=a.id,c=a.label,m=a.monthly_cost,r=a.quota,d=a.cost,a=a.label.replace(/_.*$/,""),g=-1===r?"Unlimited":1e3<=r?r/1e3+" GB":r+" MB",y="monthly"===e?{monthly:m,yearly:Math.round(s/12*100)/100}:d,p=y,u=[],h="",v="",u=_.getPromoAppliesTo(n);return n.is_active&&"percentage"===n.coupon_type&&"monthly"===e&&0

'+imagifyPricingModal.labels.errorPriceAPI+"

");else{if((k.imagify_discount_datas=a).is_active){if(a.applies_to instanceof Array){for(var d=[],g=[],y=0;yBest Value!')},100)),0===e.ot.length?(b(".imagify-pre-checkout-offers .imagify-offer-onetime").remove(),b(".imagify-tabs").remove(),b(".imagify-pricing-tab-onetime").remove()):b.each(e.ot,function(i,a){var e="";i===u.ot.index&&(i=b(".imagify-pre-checkout-offers .imagify-offer-onetime"),u.ot.selected&&(e=" imagify-offer-selected",i.addClass("imagify-offer-selected").find(".imagify-checkbox").prop("checked",!0)),_.populateOffer(i,a,"onetime")),i=b(n).clone(),i=_.populateOffer(i,a,"onetime",e),m+=i[0].outerHTML}),a&&(((p=_.getPromoAppliesTo(a)).includes(u.mo.plan_label)||p.includes(u.ot.plan_label)||"all"===p[0])&&b("#imagify-coupon-code").val(a.label),a.is_active)&&_.checkCoupon(),t.parent().find(".imagify-offer-line")&&t.parent().find(".imagify-offer-line").remove(),t.before(r),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(m)}_.$modal.find(".imagify-modal-loader").fadeOut(300),_.$modal.removeClass("imagify-modal-loading")}})}),_.populatePayBtn()})},getSuggestedOffers:function(i,e,t){var o,n,a,l,s,f,c=e.total+e.month,m={quota:0},r={mo:!1,ot:!1};return i.ot.length<0&&(a=i.ot[i.ot.length-1].id,l=i.ot[i.ot.length-1].label),i.ot.length<0&&(s=i.mo[i.mo.length-1].id,f=i.mo[i.mo.length-1].label),b.each(i.mo,function(i,a){return a.quota<0&&(n={index:i,selected:1,plan_id:a.id,plan_label:a.label}),a.quota>m.quota&&(m={index:i,selected:1,quota:a.quota,plan_id:a.id,plan_label:a.label}),0===a.monthly_cost&&0===a.annual_cost||a.quota<=0&&e.month>a.quota||e.total>a.quota||0<=a.quota&&e.montha.quota)&&(o=a,r.mo={index:i,selected:t>e.month&&t>e.total?0:1,plan_id:a.id,plan_label:a.label}),!0}),!1===r.mo&&(r.mo=void 0!==n?n:m),c-=i.mo[r.mo.index].quota,0!==i.ot.length&&(c<=0?(b.each(i.ot,function(i,a){return a.quota'+e.find(".imagify-price-by").text()+"",c=e.find(".imagify-price-discount").html(),m=e.find(".imagify-approx-nb").text(),r=e.find(".imagify-offer-size").text(),d=b("#imagify-coupon-code");i.preventDefault(),_.switchToView(_.$preView),l.find(".imagify-number-block").html(s+f),c?(l.find(".imagify-price-discount").length<=0&&l.find(".imagify-col-price").prepend(''),l.find(".imagify-price-discount").html(c),l.find(".imagify-price-discount").show()):l.find(".imagify-price-discount").hide(),l.find(".imagify-approx-nb").text(m),l.find(".imagify-offer-size").text(r),l.attr("data-offer",o),n||(l.find(".imagify-price-add-data").text(e.find(".imagify-price-add-data").text()),("monthly"===a?l.find("#imagify-subscription-monthly"):l.find("#imagify-subscription-yearly")).trigger("click.imagify"),l.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),(d=b("#imagify-coupon-code")).val(""),k.imagify_discount_datas&&((i=_.getPromoAppliesTo(k.imagify_discount_datas)).includes(t[Object.keys(t)[0]].label)||"all"===i[0])&&d.val(k.imagify_discount_datas.label),_.checkCoupon(),_.populatePayBtn()}),b("#imagify-modal-checkout-btn").on("click.imagify",function(i){var a,e;i.preventDefault(),b(this).hasClass("imagify-button-disabled")||(i=b(".imagify-offer-monthly"),a=b(".imagify-offer-onetime"),e={},i.hasClass("imagify-offer-selected")&&(e.monthly=JSON.parse(i.attr("data-offer"))),a.hasClass("imagify-offer-selected")&&(e.onetime=JSON.parse(a.attr("data-offer"))),imagifyPricingModal.userDataCache&&b.post(ajaxurl,{action:imagifyPricingModal.userDataCache.deleteAction,_wpnonce:imagifyPricingModal.userDataCache.deleteNonce}),_.switchToView(_.$paymentView),e.period=_.getPeriod(),_.iframeSetSrc(e))}),b(".imagify-back-to-plans").on("click.imagify",function(i){var a=b(this).closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime");i.preventDefault(),b(a?".imagify-offer-onetime":".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify")}),k.addEventListener("message",_.checkPluginMessage,!0))})(jQuery,document,window); \ No newline at end of file