@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.
@@ -1994,8 +1994,8 @@
1994
1994
  * Validator de CNPJ (Cadastro Nacional da Pessoa Jurídica).
1995
1995
  * @returns
1996
1996
  */
1997
- AgroFormValidator.prototype.CNPJValidator = function () {
1998
- return function (control) {
1997
+ AgroFormValidator.CNPJValidator = function () {
1998
+ var cnpjVal = function (control) {
1999
1999
  var _a;
2000
2000
  var value = (_a = control.value) === null || _a === void 0 ? void 0 : _a.replace(/\D/g, '');
2001
2001
  if (!value || value.length !== 14) {
@@ -2026,13 +2026,14 @@
2026
2026
  }
2027
2027
  return null; // válido
2028
2028
  };
2029
+ return cnpjVal;
2029
2030
  };
2030
2031
  /**
2031
2032
  * Valida se a placa do veículo é válida.
2032
2033
  * @returns
2033
2034
  */
2034
- AgroFormValidator.prototype.licensePlateValidator = function () {
2035
- return function (control) {
2035
+ AgroFormValidator.licensePlateValidator = function () {
2036
+ var licensePlateVal = function (control) {
2036
2037
  var value = (control.value || '').toUpperCase().trim().replace(/-/g, '');
2037
2038
  if (!value) {
2038
2039
  return null; // Campo vazio não é responsabilidade desse validador
@@ -2041,6 +2042,7 @@
2041
2042
  AGRO_REGEX.isOldLicensePlate.test(value);
2042
2043
  return isValid ? null : { licensePlateInvalid: true };
2043
2044
  };
2045
+ return licensePlateVal;
2044
2046
  };
2045
2047
  return AgroFormValidator;
2046
2048
  }());
@@ -2065,13 +2067,25 @@
2065
2067
  if (parseURIString) {
2066
2068
  cookieString = decodeURIComponent(cookieString);
2067
2069
  }
2070
+ if (AgroCookieUtils.isStringAnObject(cookieString)) {
2071
+ return JSON.parse(cookieString);
2072
+ }
2068
2073
  cookieString.split(';').forEach(function (cookie) {
2069
2074
  var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
2070
2075
  cookieObject[key] = value;
2071
2076
  });
2072
2077
  return cookieObject;
2073
2078
  };
2074
- 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) {
2075
2089
  var date = new Date();
2076
2090
  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
2077
2091
  var expires = 'expires=' + date.toUTCString();