const licenseUIUtils = {

    updtTrialMenuAsync: async function updtTrialMenuAsync(auth0Client) {
        const logHdr = 'licenseUIUtils.updtTrialMenuAsync: ';
        log(logHdr + 'enter');

        const userAccount = await licenseUtils.getUserAccountAsync(auth0Client);
        // get the user account data

        if (userAccount === null) {
            // if we failed to get the user account data

            log(logHdr + 'userAccount is NULL.  this should NOT happen');
        }
        else {
            // if we got user account data

            const userStatus = userAccount.userStatus;
            // get the user's registration status
            // possible values:
            //  trial
            //  registered
            //  complimentary

            if (userStatus === 'trial') {
                // if the user is a trial user

                const trStartDateStr = userAccount.startDate;
                // get the date the user's trial started as a string

                const trStartDate = new Date(trStartDateStr);
                // convert the string to a date

                const today = new Date();
                // get the current UTC date and time

                const diffDays = licenseUtils.getDaysBetweenDates(trStartDate, today);
                // get the number of days since the start date

                var trialRem = (14 - diffDays);
                // how many days left in the 14 day trial period?

                if (trialRem < 0)
                    trialRem = 0;

                trialRem = Math.round(trialRem);

                var remMsg = '';

                if (trialRem < 1) {
                    // if the trial period has expired

                    remMsg = 'Trial Period Has Expired';
                }
                else {
                    // otherwise

                    remMsg = trialRem + ' Days Left in Trial Period';
                }

                $('#aDaysLeft').text(remMsg);
                // set the menu item text
            }
            else {
                // if the user is not a trial user

                $('#divTrial').hide();
                // hide the Trial menu
            }
        }

        log(logHdr + 'leave');
    }
};