@fayz-ai/plugin-fiscal-br 0.15.10 → 0.15.12
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.
- package/dist/InboundNotesPage-IEPEEOY2.js +7 -0
- package/dist/{InboundNotesPage-XZZOCYPW.js.map → InboundNotesPage-IEPEEOY2.js.map} +1 -1
- package/dist/NoteReconcileView-3MFYJZME.js +6 -0
- package/dist/{NoteReconcileView-37NQJQLA.js.map → NoteReconcileView-3MFYJZME.js.map} +1 -1
- package/dist/{chunk-TM6XEFDW.js → chunk-GXI2FGDQ.js} +53 -58
- package/dist/chunk-GXI2FGDQ.js.map +1 -0
- package/dist/{chunk-7QDRUE3Z.js → chunk-VMZN3UYW.js} +3 -3
- package/dist/{chunk-7QDRUE3Z.js.map → chunk-VMZN3UYW.js.map} +1 -1
- package/dist/data/inbox.d.ts +1 -10
- package/dist/data/inbox.d.ts.map +1 -1
- package/dist/data/instalments.d.ts +31 -0
- package/dist/data/instalments.d.ts.map +1 -0
- package/dist/index.js +8 -8
- package/dist/views/NoteReconcileView.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/InboundNotesPage-XZZOCYPW.js +0 -6
- package/dist/NoteReconcileView-37NQJQLA.js +0 -5
- package/dist/chunk-TM6XEFDW.js.map +0 -1
- package/functions/fiscalbr-payment-extract/index.ts +0 -138
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { InboundNotesPage, makeInboundNotesRoute } from './chunk-VMZN3UYW.js';
|
|
2
|
+
import './chunk-GXI2FGDQ.js';
|
|
3
|
+
import './chunk-5LI2FDOM.js';
|
|
4
|
+
import './chunk-2GHTB3Z2.js';
|
|
5
|
+
import './chunk-DHCCZXUM.js';
|
|
6
|
+
//# sourceMappingURL=InboundNotesPage-IEPEEOY2.js.map
|
|
7
|
+
//# sourceMappingURL=InboundNotesPage-IEPEEOY2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"InboundNotesPage-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"InboundNotesPage-IEPEEOY2.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"NoteReconcileView-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"NoteReconcileView-3MFYJZME.js"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { packagingCount } from './chunk-5LI2FDOM.js';
|
|
2
|
+
import { request } from './chunk-2GHTB3Z2.js';
|
|
2
3
|
import { summarizeOccurrence, receivedStockQty, hasShortage, shortageQty, shortageReasonKey, shortageValue, receivedQty, SHORTAGE_REASONS, parseQty } from './chunk-DHCCZXUM.js';
|
|
3
4
|
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
4
5
|
import { KeyRound, Loader2, Download, ChevronDown, FileCode2, FileText, RefreshCw, UserPlus, Gift, AlertTriangle, ChevronRight, Check, Trash2, Plus, Image, UploadCloud, Paperclip, ScanLine, X } from 'lucide-react';
|
|
@@ -807,45 +808,18 @@ async function extractPaymentCode(file) {
|
|
|
807
808
|
reader.onerror = () => reject(reader.error);
|
|
808
809
|
reader.readAsDataURL(file);
|
|
809
810
|
});
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
try {
|
|
816
|
-
body = await error?.context?.json?.();
|
|
817
|
-
} catch {
|
|
818
|
-
}
|
|
819
|
-
throw new Error(body?.error || error.message || "Falha ao ler o boleto.");
|
|
820
|
-
}
|
|
811
|
+
const data = await request(
|
|
812
|
+
"POST",
|
|
813
|
+
"/v1/ai/payment-extract",
|
|
814
|
+
{ name: file.name, mime: file.type, base64 }
|
|
815
|
+
);
|
|
821
816
|
if (!data?.ok || data.kind === "none" || !data.code) return null;
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
amount: parsed?.amount ?? (typeof data.amount === "number" ? data.amount : null),
|
|
829
|
-
dueDate: parsed?.dueDate ?? (data.due_date ?? null)
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
return { kind: "pix", code, amount: typeof data.amount === "number" ? data.amount : null, dueDate: data.due_date ?? null };
|
|
833
|
-
}
|
|
834
|
-
function parseBoleto(raw) {
|
|
835
|
-
const d = raw.replace(/\D/g, "");
|
|
836
|
-
if (d.startsWith("8")) return null;
|
|
837
|
-
let barcode;
|
|
838
|
-
if (d.length === 44) barcode = d;
|
|
839
|
-
else if (d.length === 47) barcode = d.slice(0, 4) + d[32] + d.slice(33, 47) + d.slice(4, 9) + d.slice(10, 20) + d.slice(21, 31);
|
|
840
|
-
else return null;
|
|
841
|
-
const factor = Number(barcode.slice(5, 9));
|
|
842
|
-
const cents = Number(barcode.slice(9, 19));
|
|
843
|
-
let dueDate = null;
|
|
844
|
-
if (factor > 0) {
|
|
845
|
-
const base = factor >= 1e3 && Date.now() >= Date.UTC(2025, 1, 22) ? Date.UTC(2025, 1, 22) - 1e3 * 864e5 : Date.UTC(1997, 9, 7);
|
|
846
|
-
dueDate = new Date(base + factor * 864e5).toISOString().slice(0, 10);
|
|
847
|
-
}
|
|
848
|
-
return { amount: cents > 0 ? cents / 100 : null, dueDate };
|
|
817
|
+
return {
|
|
818
|
+
kind: data.kind === "pix" ? "pix" : "barcode",
|
|
819
|
+
code: String(data.code),
|
|
820
|
+
amount: typeof data.amount === "number" ? data.amount : null,
|
|
821
|
+
dueDate: data.due_date ?? null
|
|
822
|
+
};
|
|
849
823
|
}
|
|
850
824
|
var STALE_AFTER_MS = 24 * 60 * 60 * 1e3;
|
|
851
825
|
function expiryFromError(error) {
|
|
@@ -1084,6 +1058,41 @@ function NoteAttachmentsCard({ noteId, invoiceId, readOnly, instalments, onInsta
|
|
|
1084
1058
|
)) })
|
|
1085
1059
|
] });
|
|
1086
1060
|
}
|
|
1061
|
+
|
|
1062
|
+
// src/data/instalments.ts
|
|
1063
|
+
function instalmentsOf(detail) {
|
|
1064
|
+
if (detail.instalments.length > 0) {
|
|
1065
|
+
return detail.instalments.map((d) => ({
|
|
1066
|
+
index: d.index,
|
|
1067
|
+
number: d.number,
|
|
1068
|
+
dueDate: d.dueDate,
|
|
1069
|
+
amount: d.amount,
|
|
1070
|
+
paymentType: d.paymentType,
|
|
1071
|
+
barcode: d.barcode,
|
|
1072
|
+
pixKey: d.pixKey
|
|
1073
|
+
}));
|
|
1074
|
+
}
|
|
1075
|
+
const owed = detail.declaredPayments.filter((p) => p.code !== "90" && p.value > 0);
|
|
1076
|
+
const sum = owed.reduce((acc, p) => acc + p.value, 0);
|
|
1077
|
+
if (owed.length === 0 || Math.abs(sum - detail.total) > 0.01) return [];
|
|
1078
|
+
return owed.map((p, i) => ({
|
|
1079
|
+
index: i + 1,
|
|
1080
|
+
number: null,
|
|
1081
|
+
dueDate: null,
|
|
1082
|
+
amount: p.value,
|
|
1083
|
+
paymentType: p.code === "17" ? "pix" : "boleto"
|
|
1084
|
+
}));
|
|
1085
|
+
}
|
|
1086
|
+
function nextInstalment(prev, note) {
|
|
1087
|
+
const scheduled = prev.reduce((acc, p) => acc + (Number(p.amount) || 0), 0);
|
|
1088
|
+
return {
|
|
1089
|
+
index: prev.length + 1,
|
|
1090
|
+
number: null,
|
|
1091
|
+
dueDate: note.issueDate ? note.issueDate.slice(0, 10) : null,
|
|
1092
|
+
amount: Math.max(Math.round((note.total - scheduled) * 100) / 100, 0),
|
|
1093
|
+
paymentType: "boleto"
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1087
1096
|
var formatCnpj = (d) => `${d.slice(0, 2)}.${d.slice(2, 5)}.${d.slice(5, 8)}/${d.slice(8, 12)}-${d.slice(12)}`;
|
|
1088
1097
|
var groupKey = (digits) => digits.replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
1089
1098
|
function PullByKeyDialog({ open, onOpenChange, unitId, initialKey, onPulled }) {
|
|
@@ -1369,15 +1378,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1369
1378
|
setChecked(Object.fromEntries(detail.items.filter((i) => i.reconciled).map((i) => [i.id, true])));
|
|
1370
1379
|
const pending = detail.items.find((i) => !i.reconciled);
|
|
1371
1380
|
setOpenIds(pending ? [pending.id] : []);
|
|
1372
|
-
setInstalments(detail
|
|
1373
|
-
index: d.index,
|
|
1374
|
-
number: d.number,
|
|
1375
|
-
dueDate: d.dueDate,
|
|
1376
|
-
amount: d.amount,
|
|
1377
|
-
paymentType: d.paymentType,
|
|
1378
|
-
barcode: d.barcode,
|
|
1379
|
-
pixKey: d.pixKey
|
|
1380
|
-
})));
|
|
1381
|
+
setInstalments(instalmentsOf(detail));
|
|
1381
1382
|
setDefaultAccount(detail.defaultChartAccountId);
|
|
1382
1383
|
setLocation(detail.defaultLocationId ?? l[0]?.id ?? null);
|
|
1383
1384
|
}
|
|
@@ -2376,20 +2377,14 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2376
2377
|
variant: "outline",
|
|
2377
2378
|
size: "sm",
|
|
2378
2379
|
className: "mt-3",
|
|
2379
|
-
onClick: () => setInstalments((prev) => [...prev,
|
|
2380
|
-
index: prev.length + 1,
|
|
2381
|
-
number: null,
|
|
2382
|
-
dueDate: note.issueDate,
|
|
2383
|
-
amount: 0,
|
|
2384
|
-
paymentType: "boleto"
|
|
2385
|
-
}]),
|
|
2380
|
+
onClick: () => setInstalments((prev) => [...prev, nextInstalment(prev, note)]),
|
|
2386
2381
|
children: [
|
|
2387
2382
|
/* @__PURE__ */ jsx(Plus, { className: "mr-1.5 h-4 w-4" }),
|
|
2388
2383
|
"Adicionar parcela"
|
|
2389
2384
|
]
|
|
2390
2385
|
}
|
|
2391
2386
|
),
|
|
2392
|
-
Math.abs(instalmentSum - note.total) > 0.01 && /* @__PURE__ */ jsx(Hint, { className: "mt-3", children: /* @__PURE__ */ jsxs("span", { children: [
|
|
2387
|
+
instalments.length > 0 && Math.abs(instalmentSum - note.total) > 0.01 && /* @__PURE__ */ jsx(Hint, { className: "mt-3", children: /* @__PURE__ */ jsxs("span", { children: [
|
|
2393
2388
|
/* @__PURE__ */ jsx(AlertTriangle, { className: "mr-1 inline h-3.5 w-3.5", "aria-hidden": true }),
|
|
2394
2389
|
"A nota diz ",
|
|
2395
2390
|
money2(note.total),
|
|
@@ -2457,6 +2452,6 @@ function Field({ label, value, mono, small }) {
|
|
|
2457
2452
|
] });
|
|
2458
2453
|
}
|
|
2459
2454
|
|
|
2460
|
-
export { NfeParseError, NoteReconcileView, PullByKeyDialog, PullByKeyError, STOCK_BEARING_ENTRY_TYPES, acceptNote, addNoteAttachment, extractPaymentCode, fillInboxLines, findInboxNoteByNumber, findInboxNoteByOperation, getInboxIntakeHealth, getInboxNote, getInboxNotePdf, getInboxNoteXml, getNotePayable, healInboxNote, isStockBearing, linkInboxSupplier, listChartAccountNodes, listChartAccounts, listInboxNotes, listMeasurementUnits, listNoteAttachments, listProductStockUnits, listProductsByIds, listStockLocations, listSupplierMap, moveNoteAttachmentsToInvoice, onlyDigits,
|
|
2461
|
-
//# sourceMappingURL=chunk-
|
|
2462
|
-
//# sourceMappingURL=chunk-
|
|
2455
|
+
export { NfeParseError, NoteReconcileView, PullByKeyDialog, PullByKeyError, STOCK_BEARING_ENTRY_TYPES, acceptNote, addNoteAttachment, extractPaymentCode, fillInboxLines, findInboxNoteByNumber, findInboxNoteByOperation, getInboxIntakeHealth, getInboxNote, getInboxNotePdf, getInboxNoteXml, getNotePayable, healInboxNote, isStockBearing, linkInboxSupplier, listChartAccountNodes, listChartAccounts, listInboxNotes, listMeasurementUnits, listNoteAttachments, listProductStockUnits, listProductsByIds, listStockLocations, listSupplierMap, moveNoteAttachmentsToInvoice, onlyDigits, parseNfeXml, paymentLabel, paymentTypeFromCode, pullNoteByKey, rejectNote, removeNoteAttachment, saveNoteDecision, searchProducts, stageNoteFromXml, suggestNoteItems, syncNewNotes, toStagePayload };
|
|
2456
|
+
//# sourceMappingURL=chunk-GXI2FGDQ.js.map
|
|
2457
|
+
//# sourceMappingURL=chunk-GXI2FGDQ.js.map
|