@senior-agronegocio/angular-components 0.0.72-origination → 0.0.73-origination

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2067,13 +2067,25 @@
2067
2067
  if (parseURIString) {
2068
2068
  cookieString = decodeURIComponent(cookieString);
2069
2069
  }
2070
+ if (AgroCookieUtils.isStringAnObject(cookieString)) {
2071
+ return JSON.parse(cookieString);
2072
+ }
2070
2073
  cookieString.split(';').forEach(function (cookie) {
2071
2074
  var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
2072
2075
  cookieObject[key] = value;
2073
2076
  });
2074
2077
  return cookieObject;
2075
2078
  };
2076
- AgroCookieUtils.prototype.setCookie = function (name, value, days) {
2079
+ AgroCookieUtils.isStringAnObject = function (str) {
2080
+ try {
2081
+ var parsed = JSON.parse(str);
2082
+ return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed);
2083
+ }
2084
+ catch (e) {
2085
+ return false;
2086
+ }
2087
+ };
2088
+ AgroCookieUtils.setCookie = function (name, value, days) {
2077
2089
  var date = new Date();
2078
2090
  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
2079
2091
  var expires = 'expires=' + date.toUTCString();