OwlCyberSecurity - MANAGER
Edit File: pricing-modal.min.js
(a=>{a(".imagify-badge").addClass("imagify-badge-checked"),a(".imagify-toggle-label").eq(0).css("color","#c8ced5"),a(".imagify-toggle-label").eq(1).css("color","#3b3f4a"),a("#imagify-toggle-plan").change(function(){var i=a(this).is(":checked");a(".imagify-toggle-label").eq(0).css("color",i?"#c8ced5":"#3b3f4a"),a(".imagify-toggle-label").eq(1).css("color",i?"#3b3f4a":"#c8ced5"),a(".imagify-badge").toggleClass("imagify-badge-checked",i),a("#imagify_all_plan_view").toggleClass("imagify-year-selected",i).toggleClass("imagify-month-selected",!i),a(".imagify-arrow-container img").eq(0).toggle(!i),a(".imagify-arrow-container img").eq(1).toggle(i)})})(jQuery,(document,window)),((g,i,b)=>{var w={};g("#imagify-pricing-modal").length&&(w={$modal:g("#imagify-pricing-modal"),$plansView:g("#imagify-plans-selection-view"),$paymentView:g("#imagify-payment-process-view").hide(),$successView:g("#imagify-success-view").hide(),speedFadeIn:300,getHtmlPrice:function(i,a){var e,n;return a=a||null,"object"!=typeof i?((i=(i+="").split("."))[1]=1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2),n='<span class="imagify-price-big">'+i[0]+"</span> ",n+('<span class="imagify-price-mini">.'+i[1])+"</span>"):(e=i.monthly+"",i=i.yearly+"",e="0"===e?["0","00"]:e.split("."),i="0"===i?["0","00"]:i.split("."),(n=(n=(n=(n='<span class="imagify-switch-my">')+'<span aria-hidden="'+("monthly"===a?"false":"true")+'" class="imagify-monthly"><span class="imagify-price-big">'+e[0]+"</span> ")+'<span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+"</span></span> ")+'<span aria-hidden="'+("yearly"===a?"false":"true")+'" class="imagify-yearly"><span class="imagify-price-big">'+i[0]+"</span> ")+'<span class="imagify-price-mini">.'+(1===i[1].length?i[1]+"0":(""+i[1]).substring(0,2))+"</span></span></span>")},getHtmlDiscountPrice:function(i,a){var e="";return a=a||null,e="object"==typeof i?(e=(e=(e+='<span class="imagify-price-discount"><span class="imagify-price-discount-dollar">$</span><span class="imagify-switch-my">')+'<span aria-hidden="'+("monthly"===a?"false":"true")+'" class="imagify-monthly"><span class="imagify-price-discount-number">'+(i.monthly+"")+"</span>")+'</span><span aria-hidden="'+("yearly"===a?"false":"true")+'" class="imagify-yearly">')+'<span class="imagify-price-discount-number">'+(i.yearly+"")+"</span></span></span></span>":(e+='<span class="imagify-price-discount"><span class="imagify-price-discount-dollar">$</span>')+'<span class="imagify-price-discount-number">'+(i+="")+"</span></span>"},populateOffer:function(i,a,e,n){var t,s=b.imagify_discount_datas,o=a.additional_gb,l=a.annual_cost,m=a.id,c=a.label,r=a.monthly_cost,f=a.quota,g=a.cost,a=a.label.replace(/_.*$/,""),y=-1===f?"Unlimited":1e3<=f?f/1e3+" GB":f+" MB",d="monthly"===e?{monthly:r,yearly:Math.round(l/12*100)/100}:g,p=d,u=[],h="",v="",u=w.getPromoAppliesTo(s);return s.is_active&&"percentage"===s.coupon_type&&"monthly"===e&&0<r&&(u.includes(c)||"all"===u[0])&&(t=(100-s.coupon_value)/100,d="monthly"===e?{monthly:r*t,yearly:Math.round(l*t/12*100)/100}:g*t),void 0!==n&&(i.addClass("imagify-"+e+"-"+c+n),i.addClass("imagify-"+e+"-"+c+n)),i.find(".imagify-label-plans").text(a),i.find(".imagify-offer-size").text(y),i.find(".imagify-number-block").html(w.getHtmlPrice(d,"monthly")),v="Unlimited"==y?(h="quota",i.addClass("imagify-best-value"),"No additional cost"):(h="/month","$"+o+" per additional Gb"),i.find(".imagify-offer-by").text(h),i.find(".imagify-price-block").prev(".imagify-price-discount").remove(),s.is_active&&"percentage"===s.coupon_type&&"monthly"===e&&0<r&&(u.includes(c)||"all"===u[0])&&i.find(".imagify-price-block").before(w.getHtmlDiscountPrice(p,"monthly")),i.find(".imagify-approx-nb").text(5*f),"monthly"===e&&i.find(".imagify-price-add-data").text(v),l=i.find(".imagify-payment-btn-select-plan").length?i.find(".imagify-payment-btn-select-plan"):i,g="monthly"===e?'{"'+c+'":{"id":'+m+',"name":"'+y+'","label":"'+c+'","data":'+f+',"dataf":"'+y+'","imgs":'+5*f+',"prices":{"monthly":'+d.monthly+',"yearly":'+d.yearly+',"add":'+o+"}}}":'{"ot'+c+'":{"id":'+m+',"name":"'+y+'","label":"'+c+'","data":'+f+',"dataf":"'+y+'","imgs":'+5*f+',"price":'+d+"}}",l.attr("data-offer",g),i},getPricing:function(i){var i=i.data("nonce"),a={action:"imagify_get_prices",imagifynonce:i},e={action:"imagify_get_discount",imagifynonce:i};w.$modal.find(".imagify-modal-loader").hide().show(),w.$modal.addClass("imagify-modal-loading"),g.post(ajaxurl,a,function(f){f.success&&g.post(ajaxurl,e,function(i){var a,e,n,t,s,o,l="";if(i.success){if(s=f.data,a=i.data,e={mo:[]},i=g("#imagify-offer-monthly-template"),n=i.html(),t=g(".imagify-estimation-block"),g.each(s.monthlies,function(i,a){(void 0===a.active||void 0!==a.active&&!0===a.active)&&"starter"!==a.label&&e.mo.push(a)}),t.removeClass("imagify-analyzing"),g(".imagify-offer-selected").removeClass("imagify-offer-selected").find(".imagify-checkbox").prop("checked",!1),null===e.mo)(s=g(".imagify-pre-checkout-offers")).hide().attr("aria-hidden",!0),s.closest(".imagify-modal-views").find(".imagify-popin-message").remove(),s.after('<div class="imagify-popin-message imagify-error"><p>'+imagifyPricingModal.labels.errorPriceAPI+"</p></div>");else{if((b.imagify_discount_datas=a).is_active){if(a.applies_to instanceof Array){for(var m=[],c=[],r=0;r<a.applies_to.length;r++)c.push(a.applies_to[r].plan_name);c.forEach(function(i){m.includes(i)||m.push(i)}),m=m.join(", ")}else m=a.applies_to;t=g(".imagify-modal-promotion"),s=a.date_end.split("T")[0],o=a.coupon_value,o="percentage"===a.coupon_type?o+"%":"$"+o,t.addClass("active").attr("aria-hidden","false"),t.find(".imagify-promotion-number").text(o),t.find(".imagify-promotion-plan-name").text(m),t.find(".imagify-promotion-date").text(s)}0===e.mo.length?(g(".imagify-pre-checkout-offers .imagify-offer-monthly").remove(),g(".imagify-tabs").remove(),g(".imagify-pricing-tab-monthly").remove()):(e.mo=e.mo.reverse(),g.each(e.mo,function(i,a){var e=g(n).clone();e=w.populateOffer(e,a,"monthly",""),l+=e[0].outerHTML}),setTimeout(function(){g(".imagify-best-value").prepend('<div class="imagify-ribbon"><span>Best Value!</span></div>')},100)),i.parent().find(".imagify-offer-line")&&i.parent().find(".imagify-offer-line").remove(),i.before(l)}w.$modal.find(".imagify-modal-loader").fadeOut(300),w.$modal.removeClass("imagify-modal-loading")}})})},getPeriod:function(){return g("#imagify_all_plan_view").hasClass("imagify-month-selected")?"monthly":"yearly"},switchToView:function(i,a){var e=i.attr("id"),n=w.$modal.children(".imagify-modal-content");i.siblings(".imagify-modal-views").hide().attr("aria-hidden","true"),a&&a.tab&&i.find('a[href="#'+a.tab+'"]').trigger("click.imagify"),"imagify-payment-process-view"===e?n.addClass("imagify-iframe-viewing"):n.removeClass("imagify-iframe-viewing"),"imagify-success-view"===e?(n.addClass("imagify-success-viewing"),w.$modal.attr("aria-labelledby","imagify-success-view")):(n.removeClass("imagify-success-viewing"),w.$modal.removeAttr("aria-labelledby")),i.fadeIn(w.speedFadeIn).attr("aria-hidden","false")},iframeSetSrc:function(i){var a=g("#imagify-payment-iframe"),e=a.attr("src"),n=a.data("src");"string"==typeof i&&""!==e?(e=e.replace("monthly"===i?"yearly":"monthly",i),a.attr("src",e)):"object"==typeof i&&(i.period?(e="yearly"===i.period?i.plan_id:0,n=n+0+"/"+("monthly"===i.period?i.plan_id:0)+"/"+e+"/none/",console.log(n),i=a.remove().attr("src",n),w.$paymentView.html(i)):b.imagify.info("No period defined"))},paymentClose:function(){g(".imagify-iframe-viewing .close-btn").trigger("click.imagify"),g(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing")},paymentBack:function(){w.switchToView(w.$plansView)},paymentSuccess:function(){w.switchToView(w.$successView)},checkPluginMessage:function(i){var a=i.origin||i.originalEvent.origin;if(imagifyPricingModal.imagify_app_domain===a)switch(i.data){case"cancel":w.paymentClose();break;case"back":w.paymentBack();break;case"success":w.paymentSuccess()}},getPromoAppliesTo:function(i){var a=[];if(i.applies_to instanceof Array){for(var e=[],n=0;n<i.applies_to.length;n++)e.push(i.applies_to[n].plan_name);e.forEach(function(i){a.includes(i)||a.push(i)})}else a=[i.applies_to];return a}},g(".imagify-get-pricing-modal").on("click.imagify-ajax",function(){w.getPricing(g(this))}),g(document).on("click",".imagify-admin-bar-upgrade-plan",function(){w.getPricing(g(this))}),g(i).on("modalClosed.imagify",".imagify-payment-modal",function(){g(this).find(".imagify-modal-content").removeClass("imagify-success-viewing imagify-iframe-viewing"),setTimeout(function(){g(".imagify-modal-views").hide(),g("#imagify-plans-selection-view").show()},300),setTimeout(function(){g(".imagify-payment-modal").find(".imagify-modal-content").scrollTop(0)},400)}),w.$modal.on("click.imagify",".imagify-payment-btn-select-plan",function(i){i.preventDefault(),i={},imagifyPricingModal.userDataCache&&g.post(ajaxurl,{action:imagifyPricingModal.userDataCache.deleteAction,_wpnonce:imagifyPricingModal.userDataCache.deleteNonce}),w.switchToView(w.$paymentView),i.plan_id=Object.values(JSON.parse(g(this).attr("data-offer")))[0].id,i.period=w.getPeriod(),w.iframeSetSrc(i)}),b.addEventListener("message",w.checkPluginMessage,!0))})(jQuery,document,window);