@credithub/harlan-components 1.118.1 → 1.119.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.
|
@@ -103,20 +103,21 @@ export var useInstrumento = function (_a) {
|
|
|
103
103
|
});
|
|
104
104
|
}); }, [client, cpfCnpj, nmChave]);
|
|
105
105
|
var handleDescobertaAutomatica = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
-
var res, error_2;
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
var res, error_2, errorMessage, isSolicitacaoEmProcessamento;
|
|
107
|
+
var _a;
|
|
108
|
+
return __generator(this, function (_b) {
|
|
109
|
+
switch (_b.label) {
|
|
109
110
|
case 0:
|
|
110
111
|
setIsProcessandoDescoberta(true);
|
|
111
|
-
|
|
112
|
+
_b.label = 1;
|
|
112
113
|
case 1:
|
|
113
|
-
|
|
114
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
114
115
|
return [4 /*yield*/, sendInstrumentoDiscoveryEmail(client, {
|
|
115
116
|
documento: cpfCnpj,
|
|
116
117
|
nm_chave: nmChave
|
|
117
118
|
})];
|
|
118
119
|
case 2:
|
|
119
|
-
res =
|
|
120
|
+
res = _b.sent();
|
|
120
121
|
setEmailTitle('Solicitação enviada');
|
|
121
122
|
setEmailMessage((res === null || res === void 0 ? void 0 : res.message) ||
|
|
122
123
|
'Pedido registrado.\n\nAgora é só aguardar: vamos tentar obter o instrumento e enviar por e-mail. Isso pode levar alguns minutos.\n\nQuando possível, também vamos identificar o credor (quem protestou).');
|
|
@@ -124,7 +125,18 @@ export var useInstrumento = function (_a) {
|
|
|
124
125
|
setIsEmailModalOpen(true);
|
|
125
126
|
return [3 /*break*/, 5];
|
|
126
127
|
case 3:
|
|
127
|
-
error_2 =
|
|
128
|
+
error_2 = _b.sent();
|
|
129
|
+
errorMessage = String((_a = error_2 === null || error_2 === void 0 ? void 0 : error_2.message) !== null && _a !== void 0 ? _a : error_2);
|
|
130
|
+
isSolicitacaoEmProcessamento = errorMessage
|
|
131
|
+
.toLocaleLowerCase()
|
|
132
|
+
.includes('já existe um processamento para este instrumento');
|
|
133
|
+
if (isSolicitacaoEmProcessamento) {
|
|
134
|
+
setEmailTitle('Solicitação em processamento');
|
|
135
|
+
setEmailMessage('Já existe uma solicitação em processamento para este instrumento.\n\nAguarde alguns instantes e tente novamente. Se preferir, aguarde o e-mail com o instrumento assim que estiver disponível.');
|
|
136
|
+
setIsSuccess(false);
|
|
137
|
+
setIsEmailModalOpen(true);
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
}
|
|
128
140
|
setEmailTitle('Erro na solicitação');
|
|
129
141
|
setEmailMessage('Não foi possível iniciar a solicitação por e-mail agora. Tente novamente em instantes.');
|
|
130
142
|
setIsSuccess(false);
|