@senior-agronegocio/angular-components 0.0.72-origination → 0.0.74-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();
@@ -2624,7 +2636,7 @@
2624
2636
  var _a;
2625
2637
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2626
2638
  if (cookie) {
2627
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.fullName;
2639
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.fullName;
2628
2640
  if (str) {
2629
2641
  return str;
2630
2642
  }
@@ -2640,7 +2652,7 @@
2640
2652
  var _a;
2641
2653
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2642
2654
  if (cookie) {
2643
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.email;
2655
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.email;
2644
2656
  if (str) {
2645
2657
  return str;
2646
2658
  }
@@ -2656,7 +2668,7 @@
2656
2668
  AgroPlatformUtils.getBaseURL = function () {
2657
2669
  var cookie = AgroCookieUtils.getCookie('com.senior.base.url');
2658
2670
  if (cookie) {
2659
- return cookie;
2671
+ return decodeURIComponent(cookie);
2660
2672
  }
2661
2673
  throw new Error('Cookie: "com.senior.base.url" não encontrado.');
2662
2674
  };
@@ -2668,7 +2680,7 @@
2668
2680
  AgroPlatformUtils.getServicesURL = function () {
2669
2681
  var cookie = AgroCookieUtils.getCookie('com.senior.services.url');
2670
2682
  if (AgroStringUtils.isNotEmpty(cookie)) {
2671
- return cookie;
2683
+ return decodeURIComponent(cookie);
2672
2684
  }
2673
2685
  throw new Error('Cookie: "com.senior.services.url" não encontrado.');
2674
2686
  };
@@ -2680,7 +2692,7 @@
2680
2692
  var _a;
2681
2693
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2682
2694
  if (cookie) {
2683
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.accessToken;
2695
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.access_token;
2684
2696
  if (str) {
2685
2697
  return str;
2686
2698
  }