@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.
@@ -1891,13 +1891,25 @@ var AgroCookieUtils = /** @class */ (function () {
1891
1891
  if (parseURIString) {
1892
1892
  cookieString = decodeURIComponent(cookieString);
1893
1893
  }
1894
+ if (AgroCookieUtils.isStringAnObject(cookieString)) {
1895
+ return JSON.parse(cookieString);
1896
+ }
1894
1897
  cookieString.split(';').forEach(function (cookie) {
1895
1898
  var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
1896
1899
  cookieObject[key] = value;
1897
1900
  });
1898
1901
  return cookieObject;
1899
1902
  };
1900
- AgroCookieUtils.prototype.setCookie = function (name, value, days) {
1903
+ AgroCookieUtils.isStringAnObject = function (str) {
1904
+ try {
1905
+ var parsed = JSON.parse(str);
1906
+ return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed);
1907
+ }
1908
+ catch (e) {
1909
+ return false;
1910
+ }
1911
+ };
1912
+ AgroCookieUtils.setCookie = function (name, value, days) {
1901
1913
  var date = new Date();
1902
1914
  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
1903
1915
  var expires = 'expires=' + date.toUTCString();
@@ -2448,7 +2460,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2448
2460
  var _a;
2449
2461
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2450
2462
  if (cookie) {
2451
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.fullName;
2463
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.fullName;
2452
2464
  if (str) {
2453
2465
  return str;
2454
2466
  }
@@ -2464,7 +2476,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2464
2476
  var _a;
2465
2477
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2466
2478
  if (cookie) {
2467
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.email;
2479
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.email;
2468
2480
  if (str) {
2469
2481
  return str;
2470
2482
  }
@@ -2480,7 +2492,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2480
2492
  AgroPlatformUtils.getBaseURL = function () {
2481
2493
  var cookie = AgroCookieUtils.getCookie('com.senior.base.url');
2482
2494
  if (cookie) {
2483
- return cookie;
2495
+ return decodeURIComponent(cookie);
2484
2496
  }
2485
2497
  throw new Error('Cookie: "com.senior.base.url" não encontrado.');
2486
2498
  };
@@ -2492,7 +2504,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2492
2504
  AgroPlatformUtils.getServicesURL = function () {
2493
2505
  var cookie = AgroCookieUtils.getCookie('com.senior.services.url');
2494
2506
  if (AgroStringUtils.isNotEmpty(cookie)) {
2495
- return cookie;
2507
+ return decodeURIComponent(cookie);
2496
2508
  }
2497
2509
  throw new Error('Cookie: "com.senior.services.url" não encontrado.');
2498
2510
  };
@@ -2504,7 +2516,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2504
2516
  var _a;
2505
2517
  var cookie = AgroCookieUtils.getCookie('com.senior.token');
2506
2518
  if (cookie) {
2507
- var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.accessToken;
2519
+ var str = (_a = AgroCookieUtils.parseCookieToObject(cookie, true)) === null || _a === void 0 ? void 0 : _a.access_token;
2508
2520
  if (str) {
2509
2521
  return str;
2510
2522
  }