Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/gsw/initial_setup/index.cmb.min.js

define("app/services/setupService",["angular","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService","cjt/services/whm/nvDataService"],(function(e,t){"use strict";e.module("whm.initialSetup.setupService",["cjt2.services.api","cjt2.services.whm.nvdata"]).factory("setupService",["$q","APIService","nvDataService",function(i,r,n){var a=function(){this.apiService=new r};return e.extend(a.prototype,{isEligibleForTrial:!1,recordAcceptance:function(){var e=new t.Class;return e.initialize("","accept_eula"),this.apiService.deferred(e).promise},setEmail:function(i){if(!e.isString(i))throw new TypeError("Developer Error: Them email argument must be a string");var r=new t.Class;return r.initialize("","update_contact_email"),r.addArgument("contact_email",i),this.apiService.deferred(r).promise},setNameservers:function(i){if(!e.isArray(i))throw new TypeError("Developer Error: The nameservers argument must be an array");var r=new t.Class;return r.initialize("","update_nameservers_config"),["nameserver","nameserver2"].forEach((function(e,t){r.addArgument(e,i[t])})),this.apiService.deferred(r).promise},saveErrors:function(t){if(!e.isArray(t))throw new TypeError("Developer Error: The errorKeys argument must be an array");if(!t.length)return i.resolve();var r={};return t.forEach((function(e){r[e="isa:"+e+"_save_error"]=1})),n.setObject(r)},initialWebsiteRequested:function(){var e=new t.Class;return e.initialize("","initialwebsite_requested"),this.apiService.deferred(e).promise},initialWebsite:function(){var e=new t.Class;return e.initialize("","initialwebsite_create"),this.apiService.deferred(e).promise}}),new a}])})),define("app/views/infoController",["angular","cjt/util/locale","ngSanitize","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/validator/domain-validators","cjt/validator/email-validator","app/services/setupService"],(function(e,t){"use strict";function i(e,i,r,n,a,o){this.PAGE=e,this.$location=i,this.setupService=r,this.$scope=n,this.$window=a,this.$q=o,e.has_accepted_legal_agreements||i.path("/legal"),(e.has_completed_initial_setup||e.is_dnsonly)&&this.exit(),this.email=e.email,this.nameservers=e.nameservers&&e.nameservers.slice()||[],this.finishButtonText=t.maketext("Finish"),e.has_license||this.setupService.isEligibleForTrial||(this.finishButtonText=t.maketext("Next"))}function r(e){e.$validate?(e.$setDirty(),e.$validate()):Object.keys(e).forEach((function(t){"$"!==t[0]&&r(e[t])}))}function n(e){return e||""}return i.$inject=["PAGE","$location","setupService","$scope","$window","$q"],i.prototype.submit=function(){var e=this;if(!e.isSubmitting)if(e.$scope.infoForm.$invalid)r(e.$scope.infoForm);else{e.isSubmitting=!0;var t=n(e.PAGE.email)!==n(e.email),i=e.nameservers.some((function(t,i){return n(t)!==n(e.PAGE.nameservers[i])}));if(t||i){var a=e.$q.resolve(),o=[];t&&(a=a.then((function(){return e.setupService.setEmail(e.email)})).catch((function(e){o.push("contact_email")}))),i&&(a=a.then((function(){return e.setupService.setNameservers(e.nameservers)})).catch((function(e){o.push("nameservers")}))),a.then((function(){if(o.length)return e.setupService.saveErrors(o)})).finally((function(){e.exit()}))}else e.exit()}},i.prototype.resetNsInput=function(e){this.nameservers[e]=this.PAGE.nameservers[e]},i.prototype.resetTitleText=function(e){return t.maketext("Reset to the original value: [_1]",this.PAGE.nameservers[e])},i.prototype.shouldDisableReset=function(e){return n(this.PAGE.nameservers[e])===n(this.nameservers[e])},i.prototype.exit=function(){this.PAGE.requested_initial_website?this.$location.path("/initial-website"):this.$window.location.href="../initial_setup_wizard1_do"},e.module("whm.initialSetup.infoController",["ngSanitize","cjt2.validate","cjt2.directives.validationContainer","cjt2.directives.validationItem","whm.initialSetup.setupService"]).controller("infoController",i),i})),define("shared/js/license_purchase/services/storeService",["angular","lodash","cjt/util/locale","cjt/util/parse","cjt/io/api","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService"],(function(e,t,i,r,n,a){"use strict";var o="",s={json:!0},c=e.module("whm.storeService",["cjt2.services.api"]);function l(n,c){var l,u=function(){this.accessToken=""};return u.prototype=new c,e.extend(u.prototype,{isEligibleForTrial:function(e){if(e=e||{},l&&!e.noCache)return l;var t=new a.Class;return t.initialize(o,"is_eligible_for_trial"),l=this.deferred(t).promise.then((function(e){return e&&e.data&&e.data.hasOwnProperty("is_eligible")?r.parsePerlBoolean(e.data.is_eligible):n.reject(i.maketext("The system failed to parse the response from the API: [_1]","is_eligible_for_trial"))}))},getLoginURL:function(e){var t=this;return this._getLoginURL(e).catch((function(i){return t._getLoginURL.cache.delete(e),n.reject(i)}))},_getLoginURL:t.memoize((function(e){var t=new a.Class;return t.initialize(o,"get_login_url"),t.addArgument("provider","cPStore"),t.addArgument("url_after_login",e),this.deferred(t).promise})),validateLoginToken:function(e,t){var i=new a.Class;return i.initialize(o,"validate_login_token"),i.addArgument("provider","cPStore"),i.addArgument("url_after_login",t),i.addArgument("login_token",e),this.deferred(i).promise},getAccessToken:function(e,t){return this.validateLoginToken(e,t).then((function(e){var t=e&&e.data&&e.data[0]&&e.data[0].access_token;return t||n.reject("The system failed to authenticate. Please try again")}))},generateLicenseOrder:function(e,t,i){var r=new a.Class;return r.initialize(o,"purchase_a_license"),r.addArgument("provider","cPStore"),r.addArgument("login_token",e),r.addArgument("url_after_checkout",t),i&&r.addArgument("upgrade","1"),this.deferred(r).promise},acquireTrialLicense:function(e){var t={provider:"cPStore",login_token:e.token,checkout_args:{}};e.sendVerification&&(t.checkout_args.send_verification=1),e.verificationCode&&(t.checkout_args.verification_code=e.verificationCode);var i=new a.Class;return i.initialize(o,"purchase_a_trial",t,null,s),this.deferred(i,this._getTransformAPIFailureOverride()).promise},sendVerificationCode:function(e){var t=this;return this.acquireTrialLicense({token:e,sendVerification:!0}).then((function(){return n.reject({serverIsLicensed:!0})})).catch((function(e){return e.type===t._verificationSentErrorCode?e.email:n.reject(e)}))},_verificationSentErrorCode:"X::EmailNotVerified::EmailSent",updateLicense:function(){var e=new a.Class;return e.initialize(o,"run_cpkeyclt"),e.addArgument("force","1"),this.deferred(e).promise},_getTransformAPIFailureOverride:function(){var e=this;return{transformAPIFailure:function(t){if(!t)return{};var i=t.data&&t.data.type;return{isVerificationFailure:i&&e._isVerificationFailure(i),type:i,email:t.data&&t.data.detail&&t.data.detail.data&&t.data.detail.data.email,message:t.error}}}},_verificationFailureRegex:/^X::EmailNotVerified/,_isVerificationFailure:function(e){return this._verificationFailureRegex.test(e)}}),new u}return l.$inject=["$q","APIService"],c.factory("storeService",l)})),define("app/views/introController",["angular","cjt/util/locale","ngSanitize","cjt/directives/disableAnimations","shared/js/license_purchase/services/storeService"],(function(e,t){"use strict";function i(e,t,i){this.PAGE=e,this.$timeout=t,this.isDone=!1,t(this.checkExpiration.bind(this)),i.isEligibleForTrial()}return i.$inject=["PAGE","$timeout","storeService"],i.prototype.checkExpiration=function(){var e=this,t=this.msUntilExpiration();e.isDone=t<0,e.isDone||e.$timeout((function(){e.isDone=!0}),t)},i.prototype.msUntilExpiration=function(){return this.PAGE.introEndTime-Date.now()},i.prototype.skip=function(){this.isDone=!0},e.module("whm.initialSetup.introController",["ngSanitize","cjt2.directives.disableAnimations","whm.storeService"]).controller("introController",i),i})),define("app/views/legalController",["angular","cjt/util/locale","ngSanitize","cjt/directives/actionButtonDirective","cjt/services/alertService","app/services/setupService","shared/js/license_purchase/services/storeService"],(function(e,t){"use strict";function i(e,t,i,r,n,a,o,s){this.PAGE=e,this.agreements=e.agreements,this.$anchorScroll=t,this.$location=i,this.$timeout=r,this.setupService=n,this.alertService=o,this.$window=s,this.storeService=a,e.has_accepted_legal_agreements?this.continueToNextStep():this.setTopButtonMargin()}return i.$inject=["PAGE","$anchorScroll","$location","$timeout","setupService","storeService","alertService","$window"],i.prototype.setTopButtonMargin=function(){this.$timeout((function(){var t=e.element(".panel-body").get(0),i=e.element("#top-link").get(0);if(t&&i){var r=t.offsetWidth-t.clientWidth;i.style.opacity=1,r&&(i.style.marginLeft=r+"px",i.style.marginRight=r+"px")}}),1500)},i.prototype.print=function(){window.print()},i.prototype.scrollTo=function(e){this.$location.hash(e),this.$anchorScroll()},i.prototype.acceptAll=function(){var e=this;return e.isAccepting=!0,e.alertService.clear(),this.setupService.recordAcceptance().then((function(){e.PAGE.has_accepted_legal_agreements=!0,e.continueToNextStep()})).catch((function(i){e.alertService.add({type:"danger",id:"eula-api-error-alert",message:t.maketext("The system could not process your agreement: [_1]",i),replace:!0})})).finally((function(){e.isAccepting=!1}))},i.prototype.continueToNextStep=function(){var e=this;e.PAGE.has_license?e.PAGE.has_completed_initial_setup||0!==e.PAGE.is_dnsonly?e.$window.location.href="../initial_setup_wizard1_do":e.$location.path("/info"):e.storeService.isEligibleForTrial().then((function(t){t?(e.setupService.isEligibleForTrial=!0,e.$location.path("/trial-activation/login")):e.PAGE.has_completed_initial_setup||0!==e.PAGE.is_dnsonly?e.$window.location.href="../initial_setup_wizard1_do":(e.setupService.isEligibleForTrial=!1,e.$location.path("/info"))}),(function(){e.PAGE.has_completed_initial_setup||0!==e.PAGE.is_dnsonly?e.$window.location.href="../initial_setup_wizard1_do":(e.setupService.isEligibleForTrial=!1,e.$location.path("/info"))}))},e.module("whm.initialSetup.legalController",["ngSanitize","cjt2.directives.actionButton","cjt2.services.alert","whm.initialSetup.setupService","whm.storeService"]).controller("legalController",i),i})),define("app/views/createAccountController",["angular","cjt/util/locale","app/services/setupService"],(function(e,t){"use strict";function i(e,t,i,r,n,a){this.PAGE=e,this.$location=t,this.setupService=i,this.$scope=r,this.$window=n,this.$q=a,e.has_accepted_legal_agreements||t.path("/legal"),(e.has_completed_initial_setup||e.is_dnsonly||!e.requested_initial_website)&&this.exit()}return i.$inject=["PAGE","$location","setupService","$scope","$window","$q"],i.prototype.create=function(){var e=this;if(!e.isSubmitting){if(e.PAGE.requested_initial_website){e.isSubmitting=!0;var t=[];return e.setupService.initialWebsite(e.email).catch((function(e){t.push("initial_website")})).then((function(){if(t.length)return e.setupService.saveErrors(t)})).finally((function(){e.exit()}))}e.exit()}},i.prototype.exit=function(){this.$window.location.href="../initial_setup_wizard1_do"},i.prototype.requested=function(){return this.PAGE.requested_initial_website},e.module("whm.initialSetup.createAccountController",["whm.initialSetup.setupService"]).controller("createAccountController",i),i})),define("app/views/trialLicenseActivationController",["angular","cjt/util/locale","app/services/setupService","shared/js/license_purchase/services/storeService","cjt/services/alertService","cjt/directives/actionButtonDirective","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective"],(function(e,t){"use strict";function i(e,t,i,r,n,a,o,s,c,l){if(this.PAGE=e,this.$location=t,this.setupService=i,this.storeService=r,this.alertService=n,this.$scope=a,this.$window=o,this.$q=s,this.$timeout=c,this.$routeParams=l,e.has_accepted_legal_agreements||t.path("/legal"),e.has_license)e.has_completed_initial_setup||0!==e.is_dnsonly?o.location.href="../initial_setup_wizard1_do":t.path("/info");else{var u=["login","activation","activation-status","email-verification"],p=u[0];l.nextStep&&-1!==u.indexOf(l.nextStep)&&(p=l.nextStep),this.$scope.currentStep=p,this.$scope.onActivationStatusView="activation-status"===this.$scope.currentStep,this.startTrialActivationProcess(),this.redirectToServerSetup=function(){t.path("/info")};var v=t.search();v&&v.code||this.prefetchLoginUrl()}}return i.prototype.prefetchLoginUrl=function(){var e=this.getReturnURL("activation");this.storeService.getLoginURL(e)},i.prototype.getReturnURL=function(e){var t=this,i=t.$location.search(),r=t.PAGE.baseURL+t.PAGE.pageURL+"/trial-activation/"+e;return i&&i.debug&&(r+="?debug=1"),r},i.prototype.storeLoginRedirect=function(){var e=this,i=e.getReturnURL("activation");return e.alertService.clear(),e.storeService.getLoginURL(i).then((function(t){t.data&&t.data.length&&(e.$window.location.href=t.data[0])}),(function(i){e.alertService.add({type:"danger",id:"getLoginURL-api-error-alert",message:t.maketext("The system could not log in to the cPanel Store: [_1]",i),replace:!0})}))},i.prototype.startTrialActivationProcess=function(){var e=this,i=e.authenticationCode=e.$location.search().code,r=e.$routeParams.nextStep;if(e.activationInProgress=!0,e.emailAddress=e.$routeParams.everythingelse,i&&"activation"===r)return function(e){var i=e.authenticationCode,r=e.getReturnURL("activation");return e.storeService.getAccessToken(i,r).then((function(t){return e.storeService.accessToken=t,t})).catch((function(){e.activationInProgress=!1,e.alertService.add({type:"danger",id:"getAccessToken-api-error-alert",message:t.maketext("The system failed to authenticate. Please try again"),replace:!0}),e.$location.path("/trial-activation/login")}))}(e).then((function(i){if(i)return e.storeService.acquireTrialLicense({token:i,sendVerification:!0}).then((function(){return e.storeService.updateLicense().then((function(t){e.$location.path("/trial-activation/activation-status/")}),(function(i){e.activationInProgress=!1,e.alertService.add({type:"danger",id:"updateLicense-api-error-alert",message:t.maketext("The system failed to update the license on your cPanel [output,amp] WHM server. [output,url,_1,Fix License File Errors]","../../scripts10/license_error"),replace:!0})}))}),(function(i){e.activationInProgress=!1,i.isVerificationFailure?e.$location.path("/trial-activation/email-verification/"+i.email):e.alertService.add({type:"danger",id:"purchase_a_trial-api-error-alert",message:t.maketext("The system could not activate the trial license."),replace:!0})}))}),(function(i){e.activationInProgress=!1,e.alertService.add({type:"danger",id:"validateLoginToken-api-error-alert",message:t.maketext("The system failed to authenticate. Please try again"),replace:!0}),e.$location.path("/trial-activation/login")}));"activation-status"===r||"email-verification"===r||e.$location.path("/trial-activation/login")},i.prototype.verifyEmail=function(e){var i=this;if(!e.$invalid){var r=i.verificationCode,n=i.storeService.accessToken;return i.verificationInProgress=!0,i.alertService.clear(),i.storeService.acquireTrialLicense({token:n,verificationCode:r}).then((function(){return i.storeService.updateLicense().then((function(e){i.alertService.clear(),i.$location.path("/trial-activation/activation-status/")}),(function(e){i.activationInProgress=!1,i.alertService.add({type:"danger",id:"updateLicense-api-error-alert",message:t.maketext("The system failed to update the license on your cPanel [output,amp] WHM server. [output,url,_1,Fix License File Errors]","../../scripts10/license_error"),replace:!0})}))}),(function(e){i.activationInProgress=!1,e.isVerificationFailure?i.alertService.add({type:"danger",id:"verify-email-api-error-alert",message:t.maketext("The verification code was incorrect. Please try again."),replace:!0}):i.alertService.add({type:"danger",id:"purchase_a_trial-api-error-alert",message:t.maketext("The system could not activate the trial license."),replace:!0})})).finally((function(){i.verificationInProgress=!1}))}},i.prototype.resendCode=function(){var e=this,i=e.storeService.accessToken;return e.alertService.clear(),this.storeService.sendVerificationCode(i).then((function(i){e.alertService.add({type:"success",id:"resend-verification-api-success-alert",message:t.maketext("A new verification code has been sent to [_1].",i),replace:!0})})).catch((function(i){if(i.serverIsLicensed)return e.$location.path("/trial-activation/activation-status/"),e.activationInProgress=!1,void e.alertService.add({type:"success",id:"resend-verification-api-error-alert",message:t.maketext("The system determined that your server is already licensed."),replace:!0});e.alertService.add({type:"danger",id:"resend-verification-api-error-alert",message:t.maketext("The system failed to send a new verification code to [_1].",i.email),replace:!0})}))},i.$inject=["PAGE","$location","setupService","storeService","alertService","$scope","$window","$q","$timeout","$routeParams"],e.module("whm.initialSetup.trialActivationController",["ngSanitize","whm.initialSetup.setupService","whm.storeService","cjt2.services.alert"]).controller("trialActivationController",i),i})),define("app/index",["angular","cjt/modules","ngRoute","ngSanitize"],(function(e,t){"use strict";return function(){require(["cjt/bootstrap","cjt/directives/alertList","app/views/infoController","app/views/introController","app/views/legalController","app/views/createAccountController","app/views/trialLicenseActivationController"],(function(t){var i=e.module("whm.initialSetup",["cjt2.config.whm.configProvider","ngRoute","cjt2.directives.alertList","whm.initialSetup.infoController","whm.initialSetup.introController","whm.initialSetup.legalController","whm.initialSetup.createAccountController","whm.initialSetup.trialActivationController"]);i.config(["$routeProvider",function(e){e.when("/legal",{controller:"legalController",controllerAs:"vm",templateUrl:"gsw/initial_setup/views/legalView.ptt"}),e.when("/trial-activation/:nextStep?/:everythingelse?",{controller:"trialActivationController",controllerAs:"vm",templateUrl:"gsw/initial_setup/views/trialLicenseActivationView.ptt"}),e.when("/info",{controller:"infoController",controllerAs:"vm",templateUrl:"gsw/initial_setup/views/infoView.ptt"}),e.when("/initial-website",{controller:"createAccountController",controllerAs:"vm",templateUrl:"gsw/initial_setup/views/createAccountView.ptt"}),e.otherwise({redirectTo:"/legal/"})}]),i.value("PAGE",window.PAGE),t("#content","whm.initialSetup")}))}}));
Back to Directory File Manager