@credithub/harlan-components 1.111.1 → 1.112.0

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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Heurística atual para inferir UF do protesto.
3
+ *
4
+ * Contexto: o payload de protestos (CENPROT) que consumimos hoje não expõe UF/cidade do cartório,
5
+ * então a única pista disponível na UI é a `nm_chave`.
6
+ *
7
+ * Na prática, a `nm_chave` costuma começar com o código IBGE da UF (ex: "35" = São Paulo).
8
+ * Quando o backend passar UF explicitamente, esta lógica deve ser substituída por um campo confiável.
9
+ */
10
+ var digitsOnly = function (value) { return (value ? value.replace(/\D+/g, '') : ''); };
11
+ export var isProtestoSPByNmChave = function (nmChave) {
12
+ var key = digitsOnly(nmChave);
13
+ if (!key)
14
+ return false;
15
+ // "35" é o código IBGE de São Paulo
16
+ return key.startsWith('35');
17
+ };