Viewing File: /usr/local/cpanel/base/frontend/jupiter/security/tls_wizard/services/VirtualHost.min.js

define(["angular","lodash","app/services/HasIdVerMix"],(function(t,i,e){"use strict";var s;try{s=t.module("App")}catch(i){s=t.module("App",[])}s.factory("VirtualHost",["HasIdVerMix",function(e){function s(i){var e=this;e.display_name="",e.domains=[],e.selected_domains=[],e.filtered_domains={},e.show_wildcards=!0,e.show_domains=!0,e.display_meta={items_per_page:10,current_page:1},e.displayed_domains=[],e.selected_product=null,e.calculated_price=null,e.is_ssl=0,e.product_price=0,e.product_wildcard_price=0,e.added_to_cart=!1,e.current_step="domains",t.extend(e,i)}return t.extend(s.prototype,e),t.extend(s.prototype,{get_display_name:function(){return this.display_name},reset:function(){this.current_step="domains",this.set_product(null),this.set_product_price(0),this.calculated_price=null,this.selected_product=null,t.forEach(this.domains,(function(t){t.selected=!1})),this.get_selected_domains()},get_step:function(){return this.current_step},go_step:function(t){return this.current_step=t,this.current_step},get_price:function(){var t=this.get_selected_domains(),i=t.filter((function(t){return!!t.is_wildcard}));return this.calculated_price=this.product_price*(t.length-i.length)+i.length*this.product_wildcard_price,this.calculated_price},set_product_price:function(t,i){this.product_price=t||0,this.product_wildcard_price=i||0},get_price_string:function(){return"$"+this.get_price().toFixed(2)+" USD"},get_product:function(){return this.selected_product},set_product:function(t){this.selected_product=t},get_domains:function(){return this.domains},set_displayed_domains:function(t){this.displayed_domains=t},get_filtered_domains:function(){var i,e=this.get_domains();if(this.show_wildcards&&this.show_domains)i="all";else if(this.show_wildcards)i="wildcards";else{if(!this.show_domains)return[];i="domains"}if(this.filtered_domains[i])return this.filtered_domains[i];this.filtered_domains[i]=[];var s=this;return t.forEach(e,(function(t){return!(!s.show_wildcards&&t.is_wildcard)&&(!(!s.show_domains&&!t.is_wildcard)&&void s.filtered_domains[i].push(t))})),this.filtered_domains[i]},get_domain_count:function(t){return t?this.domains.length:this.domains.length/2},get_displayed_domains:function(){this.displayed_domains=[];var t=this.get_filtered_domains();this.display_meta.start=this.display_meta.items_per_page*(this.display_meta.current_page-1),this.display_meta.limit=Math.min(t.length,this.display_meta.start+this.display_meta.items_per_page);for(var i=this.display_meta.start;i<this.display_meta.limit;i++)t[i].is_wildcard||this.displayed_domains.push(t[i]);return this.displayed_domains},add_domain:function(t){if(!this.get_domain_by_domain(t.domain)){t.resolved=-1,t.resolving=!1;var i=this.domains.length;return this.domains.push(t),i}},get_domain_by_domain:function(i){var e;return t.forEach(this.domains,(function(t){t.domain===i&&(e=t)})),e},remove_domain:function(t){t.selected=0,this.get_selected_domains()},remove_all_domains:function(){for(var t=0;t<this.domains.length;t++)this.remove_domain(this.domains[t])},is_ready:function(){return 0!==this.get_domains().length&&!!this.get_product()},toJSON:function(){var t={};return t.display_name=this.display_name,t.selected_domains=this.selected_domains,t.selected_product=this.selected_product,t.calculated_price=this.calculated_price,t.product_price=this.product_price,t.domains=this.get_domains(),t.identity_verification=this.get_identity_verification(),t},get_selected_domains:function(){var t=i.filter(this.get_domains(),"selected");return this.selected_domains=t,t},has_selected_domains:function(){return i.some(this.get_domains(),"selected")}}),s}])}));
Back to Directory File Manager