var SpaStorageKeyEnum;
(function (SpaStorageKeyEnum) {
    SpaStorageKeyEnum["afterSignIn"] = "afterSignIn";
    SpaStorageKeyEnum["brand"] = "brand";
    SpaStorageKeyEnum["channelType"] = "channelType";
    SpaStorageKeyEnum["channelSettings"] = "companySettings";
    SpaStorageKeyEnum["token"] = "token";
    SpaStorageKeyEnum["updateInProgress"] = "updateInProgress";
    SpaStorageKeyEnum["release"] = "release";
    SpaStorageKeyEnum["patch"] = "patch";
})(SpaStorageKeyEnum || (SpaStorageKeyEnum = {}));
;

class SpaStorage {
    static get channelId() {
        return `${this.getSetting(SpaStorageKeyEnum.brand)?.toUpperCase()}_${this.getSetting(SpaStorageKeyEnum.channelType)?.toUpperCase()}`;
    }
    static clearSetting(key) {
        localStorage.removeItem(key);
    }
    static getSetting(key) {
        return localStorage.getItem(key);
    }
    static setSetting(key, settingValue) {
        localStorage.setItem(key, settingValue);
    }
    static getChannelSetting(key) {
        let storageObj;
        const storageObjStr = localStorage.getItem(SpaStorageKeyEnum.channelSettings);
        if (storageObjStr) {
            storageObj = JSON.parse(storageObjStr);
            if (!storageObj[this.channelId]) {
                return undefined;
            }
            return storageObj[this.channelId][key];
        }
        else {
            return undefined;
        }
    }
    static setChannelSetting(key, settingValue) {
        const companySettings = this.getSetting(SpaStorageKeyEnum.channelSettings);
        let storageObj;
        if (companySettings) {
            storageObj = JSON.parse(companySettings);
        }
        else {
            storageObj = {};
        }
        if (!storageObj[this.channelId]) {
            storageObj[this.channelId] = {};
        }
        storageObj[this.channelId][key] = settingValue;
        this.setSetting(SpaStorageKeyEnum.channelSettings, JSON.stringify(storageObj));
    }
}

/**
 * Generated bundle index. Do not edit.
 */

export { SpaStorage, SpaStorageKeyEnum };
//# sourceMappingURL=softpak-ng-components-spa-storage.mjs.map
