@senior-agronegocio/angular-components 0.0.71-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.
@@ -1818,8 +1818,8 @@ var AgroFormValidator = /** @class */ (function () {
1818
1818
  * Validator de CNPJ (Cadastro Nacional da Pessoa Jurídica).
1819
1819
  * @returns
1820
1820
  */
1821
- AgroFormValidator.prototype.CNPJValidator = function () {
1822
- return function (control) {
1821
+ AgroFormValidator.CNPJValidator = function () {
1822
+ var cnpjVal = function (control) {
1823
1823
  var _a;
1824
1824
  var value = (_a = control.value) === null || _a === void 0 ? void 0 : _a.replace(/\D/g, '');
1825
1825
  if (!value || value.length !== 14) {
@@ -1850,13 +1850,14 @@ var AgroFormValidator = /** @class */ (function () {
1850
1850
  }
1851
1851
  return null; // válido
1852
1852
  };
1853
+ return cnpjVal;
1853
1854
  };
1854
1855
  /**
1855
1856
  * Valida se a placa do veículo é válida.
1856
1857
  * @returns
1857
1858
  */
1858
- AgroFormValidator.prototype.licensePlateValidator = function () {
1859
- return function (control) {
1859
+ AgroFormValidator.licensePlateValidator = function () {
1860
+ var licensePlateVal = function (control) {
1860
1861
  var value = (control.value || '').toUpperCase().trim().replace(/-/g, '');
1861
1862
  if (!value) {
1862
1863
  return null; // Campo vazio não é responsabilidade desse validador
@@ -1865,6 +1866,7 @@ var AgroFormValidator = /** @class */ (function () {
1865
1866
  AGRO_REGEX.isOldLicensePlate.test(value);
1866
1867
  return isValid ? null : { licensePlateInvalid: true };
1867
1868
  };
1869
+ return licensePlateVal;
1868
1870
  };
1869
1871
  return AgroFormValidator;
1870
1872
  }());
@@ -1889,13 +1891,25 @@ var AgroCookieUtils = /** @class */ (function () {
1889
1891
  if (parseURIString) {
1890
1892
  cookieString = decodeURIComponent(cookieString);
1891
1893
  }
1894
+ if (AgroCookieUtils.isStringAnObject(cookieString)) {
1895
+ return JSON.parse(cookieString);
1896
+ }
1892
1897
  cookieString.split(';').forEach(function (cookie) {
1893
1898
  var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
1894
1899
  cookieObject[key] = value;
1895
1900
  });
1896
1901
  return cookieObject;
1897
1902
  };
1898
- 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) {
1899
1913
  var date = new Date();
1900
1914
  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
1901
1915
  var expires = 'expires=' + date.toUTCString();