Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/gsw/initial_setup/views/introController.js

/*
 * views/introController.js                           Copyright 2022 cPanel, L.L.C.
 *                                                           All rights reserved.
 * copyright@cpanel.net                                         http://cpanel.net
 * This code is subject to the cPanel license. Unauthorized copying is prohibited
 */

/* eslint-env amd */

define([
    "angular",
    "cjt/util/locale",
    "ngSanitize",
    "cjt/directives/disableAnimations",
    "shared/js/license_purchase/services/storeService",
], function(angular, LOCALE) {

    "use strict";

    function IntroController(PAGE, $timeout, storeService) {
        this.PAGE = PAGE;
        this.$timeout = $timeout;

        this.isDone = false;

        $timeout(this.checkExpiration.bind(this));

        storeService.isEligibleForTrial();
    }

    IntroController.$inject = [
        "PAGE",
        "$timeout",
        "storeService"
    ];

    IntroController.prototype.checkExpiration = function() {
        var self = this;

        var msUntilExpiration = this.msUntilExpiration();
        self.isDone = msUntilExpiration < 0;

        if (!self.isDone) {

            // We need to wait some more
            self.$timeout(function() {
                self.isDone = true;
            }, msUntilExpiration);
        }
    };

    IntroController.prototype.msUntilExpiration = function() {
        var self = this;
        return self.PAGE.introEndTime - Date.now();
    };

    IntroController.prototype.skip = function() {
        this.isDone = true;
    };

    angular
        .module("whm.initialSetup.introController", [
            "ngSanitize",
            "cjt2.directives.disableAnimations",
            "whm.storeService"
        ])
        .controller("introController", IntroController);

    return IntroController;

});
Back to Directory File Manager