"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setIsSelf = exports.setIsPrimaryBrand = exports.setIsLoaderVisible = exports.setHasMultipleBrands = exports.setCorpBrandCode = exports.setAccessToken = exports.removeIsSelf = exports.removeIsPrimaryBrand = exports.removeHasMultipleBrands = exports.removeCorpBrandCode = exports.removeAccessToken = exports.getIsSelf = exports.getIsPrimaryBrand = exports.getIsLoaderVisible = exports.getHasMultipleBrands = exports.getCorpBrandCode = exports.getAccessToken = void 0;
const hasMultipleBrandsKey = "hmb";
const isPrimaryBrandKey = "ipb";
const isSelfKey = "islf";
const corpBrandCodeKey = "cbc";
const getAccessToken = () => {
  return sessionStorage.getItem("token");
};
exports.getAccessToken = getAccessToken;
const setAccessToken = AccessToken => {
  sessionStorage.setItem("token", AccessToken);
};
exports.setAccessToken = setAccessToken;
const removeAccessToken = () => {
  //sessionStorage.removeItem("token");
  sessionStorage.setItem("token", null);
};
exports.removeAccessToken = removeAccessToken;
const setHasMultipleBrands = value => {
  var _value, _value2;
  sessionStorage.removeItem(hasMultipleBrandsKey);
  value = value === undefined || value === null || ((_value = value) === null || _value === void 0 ? void 0 : _value.length) === 0 ? "0" : (_value2 = value) === null || _value2 === void 0 ? void 0 : _value2.toString();
  sessionStorage.setItem(hasMultipleBrandsKey, value);
};
exports.setHasMultipleBrands = setHasMultipleBrands;
const setIsSelf = value => {
  var _value3, _value4;
  sessionStorage.removeItem(isSelfKey);
  value = value === undefined || value === null || ((_value3 = value) === null || _value3 === void 0 ? void 0 : _value3.length) === 0 ? "1" : (_value4 = value) === null || _value4 === void 0 ? void 0 : _value4.toString();
  sessionStorage.setItem(isSelfKey, value);
};
exports.setIsSelf = setIsSelf;
const setCorpBrandCode = value => {
  var _value5, _value6;
  sessionStorage.removeItem(corpBrandCodeKey);
  value = value === undefined || value === null || ((_value5 = value) === null || _value5 === void 0 ? void 0 : _value5.length) === 0 ? "" : (_value6 = value) === null || _value6 === void 0 ? void 0 : _value6.toString();
  sessionStorage.setItem(corpBrandCodeKey, value);
};
exports.setCorpBrandCode = setCorpBrandCode;
const getHasMultipleBrands = () => {
  let value = sessionStorage.getItem(hasMultipleBrandsKey);
  if (value === null || value === undefined) {
    return false;
  }
  if ((value === null || value === void 0 ? void 0 : value.toString()) === "1") {
    return true;
  }
  return false;
};
exports.getHasMultipleBrands = getHasMultipleBrands;
const setIsPrimaryBrand = value => {
  var _value7, _value8;
  sessionStorage.removeItem(isPrimaryBrandKey);
  value = value === undefined || value === null || ((_value7 = value) === null || _value7 === void 0 ? void 0 : _value7.length) === 0 ? "0" : (_value8 = value) === null || _value8 === void 0 ? void 0 : _value8.toString();
  sessionStorage.setItem(isPrimaryBrandKey, value);
};
exports.setIsPrimaryBrand = setIsPrimaryBrand;
const getIsPrimaryBrand = () => {
  let value = sessionStorage.getItem(isPrimaryBrandKey);
  if (value === null || value === undefined) {
    return false;
  }
  if ((value === null || value === void 0 ? void 0 : value.toString()) === "1") {
    return true;
  }
  return false;
};
exports.getIsPrimaryBrand = getIsPrimaryBrand;
const getIsSelf = () => {
  let value = sessionStorage.getItem(isSelfKey);
  if (value === null || value === undefined) {
    return true;
  }
  if ((value === null || value === void 0 ? void 0 : value.toString()) === "0") {
    return false;
  }
  return true;
};
exports.getIsSelf = getIsSelf;
const getCorpBrandCode = () => {
  let value = sessionStorage.getItem(corpBrandCodeKey);
  if (value === null || value === undefined) {
    return "";
  }
  return value === null || value === void 0 ? void 0 : value.toString();
};
exports.getCorpBrandCode = getCorpBrandCode;
const removeHasMultipleBrands = () => {
  sessionStorage.removeItem(hasMultipleBrandsKey);
};
exports.removeHasMultipleBrands = removeHasMultipleBrands;
const removeIsPrimaryBrand = () => {
  sessionStorage.removeItem(isPrimaryBrandKey);
};
exports.removeIsPrimaryBrand = removeIsPrimaryBrand;
const removeIsSelf = () => {
  sessionStorage.removeItem(isSelfKey);
};
exports.removeIsSelf = removeIsSelf;
const removeCorpBrandCode = () => {
  sessionStorage.removeItem(corpBrandCodeKey);
};
exports.removeCorpBrandCode = removeCorpBrandCode;
const getIsLoaderVisible = () => {
  let v = sessionStorage.getItem("showLoader");
  if (v === null || v === undefined) {
    return false;
  }
  if (v.length && v.length === 0) {
    return false;
  }
  if (v.toString().toUpperCase() === "TRUE") {
    return true;
  }
  return false;
};
exports.getIsLoaderVisible = getIsLoaderVisible;
const setIsLoaderVisible = value => {
  sessionStorage.setItem("showLoader", value);
};
exports.setIsLoaderVisible = setIsLoaderVisible;