@fayz-ai/plugin-financial 0.29.5 → 0.29.7

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,4 @@
1
+ export { CashRegistersView } from './chunk-G3BID4RP.js';
2
+ import './chunk-CNXAVGSW.js';
3
+ //# sourceMappingURL=CashRegistersView-5U252GGF.js.map
4
+ //# sourceMappingURL=CashRegistersView-5U252GGF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"CashRegistersView-2G7DTIAA.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"CashRegistersView-5U252GGF.js"}
@@ -2,7 +2,7 @@ import { InvoiceFormView, InvoiceDetailView, marcarItemParaAbrir, AccountIcon, c
2
2
  import { chartTreeProps, chartAccountWithDescendants, chartRowsFor } from './chunk-XGBGRXZ3.js';
3
3
  import { startReceiptCapture, RECEIVABLE_RECEIPT_INSTRUCTIONS, RECEIPT_INSTRUCTIONS, createReceiptTools } from './chunk-7VKJLBYY.js';
4
4
  import { FINANCIAL_MODULE_DEFAULTS, FinancialGeneralSettings } from './chunk-POYZFEAN.js';
5
- import { CashRegistersView } from './chunk-MGDAJLUQ.js';
5
+ import { CashRegistersView } from './chunk-G3BID4RP.js';
6
6
  import { formatCurrency, FinancialContextProvider, useFinancialConfig, useFinancialStore, useFinancialProvider } from './chunk-CNXAVGSW.js';
7
7
  import * as React15 from 'react';
8
8
  import React15__default, { memo, useState, useMemo, useCallback, useEffect, useRef } from 'react';
@@ -4674,6 +4674,8 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4674
4674
  const [accounts, setAccounts] = useState([]);
4675
4675
  const [decisions, setDecisions] = useState({});
4676
4676
  const [open, setOpen] = useState(/* @__PURE__ */ new Set());
4677
+ const [shown, setShown] = useState(GROUP_BATCH);
4678
+ const showMore = useCallback(() => setShown((n) => n + GROUP_BATCH), []);
4677
4679
  const [running, setRunning] = useState(null);
4678
4680
  useEffect(() => {
4679
4681
  let alive = true;
@@ -4769,7 +4771,7 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4769
4771
  " ",
4770
4772
  /* @__PURE__ */ jsx("button", { type: "button", className: "underline", onClick: () => adminNavigateTo("/settings/financial/chart-of-accounts"), children: "Abrir o plano de contas" })
4771
4773
  ] }),
4772
- groups.map((g) => decisions[g.key] && /* @__PURE__ */ jsx(
4774
+ groups.slice(0, shown).map((g) => decisions[g.key] && /* @__PURE__ */ jsx(
4773
4775
  GroupRow,
4774
4776
  {
4775
4777
  g,
@@ -4782,7 +4784,8 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4782
4784
  onToggle: toggle
4783
4785
  },
4784
4786
  g.key
4785
- ))
4787
+ )),
4788
+ shown < groups.length && /* @__PURE__ */ jsx(MoreOnView, { onView: showMore }, shown)
4786
4789
  ] }),
4787
4790
  running && /* @__PURE__ */ jsxs("div", { className: "space-y-3 py-2", children: [
4788
4791
  /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
@@ -4817,91 +4820,108 @@ function LazySelect({ value, onChange, placeholder, options }) {
4817
4820
  /* @__PURE__ */ jsx(SelectContent, { children: shown.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
4818
4821
  ] });
4819
4822
  }
4823
+ var GROUP_BATCH = 40;
4824
+ function MoreOnView({ onView }) {
4825
+ const ref = React15__default.useRef(null);
4826
+ useEffect(() => {
4827
+ const el = ref.current;
4828
+ if (!el || typeof IntersectionObserver === "undefined") {
4829
+ onView();
4830
+ return;
4831
+ }
4832
+ const io = new IntersectionObserver((entries) => {
4833
+ if (entries.some((e) => e.isIntersecting)) {
4834
+ io.disconnect();
4835
+ onView();
4836
+ }
4837
+ }, { rootMargin: "600px 0px" });
4838
+ io.observe(el);
4839
+ return () => io.disconnect();
4840
+ }, [onView]);
4841
+ return /* @__PURE__ */ jsx("div", { ref, "aria-hidden": true, className: "h-px" });
4842
+ }
4820
4843
  var GroupRow = memo(function GroupRow2({ g, d, expanded, chart, compare, accounts, onSet, onToggle }) {
4821
4844
  const count = g.lines.length - d.excluded.size;
4822
- return (
4823
- // content-visibility: rows scrolled out of view skip layout and paint.
4824
- /* @__PURE__ */ jsxs("div", { className: "rounded-md border p-3", style: { contentVisibility: "auto", containIntrinsicSize: "auto 7rem" }, "data-testid": "batch-group", children: [
4825
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
4826
- /* @__PURE__ */ jsx("button", { type: "button", className: "text-muted-foreground", "aria-label": expanded ? "Recolher" : "Ver linhas", onClick: () => onToggle(g.key), children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }),
4827
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.label }),
4828
- /* @__PURE__ */ jsx(Badge, { variant: "outline", className: g.direction === "credit" ? "text-emerald-700" : "text-destructive", children: g.direction === "credit" ? "Entrada" : "Sa\xEDda" }),
4829
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4830
- count,
4831
- " ",
4832
- count === 1 ? "linha" : "linhas"
4833
- ] }),
4834
- /* @__PURE__ */ jsx("span", { className: "w-28 text-right text-sm font-semibold", children: formatCurrency(g.total) })
4845
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-md border p-3", "data-testid": "batch-group", children: [
4846
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
4847
+ /* @__PURE__ */ jsx("button", { type: "button", className: "text-muted-foreground", "aria-label": expanded ? "Recolher" : "Ver linhas", onClick: () => onToggle(g.key), children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }),
4848
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.label }),
4849
+ /* @__PURE__ */ jsx(Badge, { variant: "outline", className: g.direction === "credit" ? "text-emerald-700" : "text-destructive", children: g.direction === "credit" ? "Entrada" : "Sa\xEDda" }),
4850
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4851
+ count,
4852
+ " ",
4853
+ count === 1 ? "linha" : "linhas"
4835
4854
  ] }),
4836
- g.document && /* @__PURE__ */ jsxs("p", { className: "ml-6 text-xs text-muted-foreground", children: [
4837
- "Documento ",
4838
- g.document
4855
+ /* @__PURE__ */ jsx("span", { className: "w-28 text-right text-sm font-semibold", children: formatCurrency(g.total) })
4856
+ ] }),
4857
+ g.document && /* @__PURE__ */ jsxs("p", { className: "ml-6 text-xs text-muted-foreground", children: [
4858
+ "Documento ",
4859
+ g.document
4860
+ ] }),
4861
+ /* @__PURE__ */ jsxs("div", { className: "ml-6 mt-2 grid gap-2 sm:grid-cols-[180px_1fr_1fr]", children: [
4862
+ /* @__PURE__ */ jsxs(Select, { value: d.action, onValueChange: (v) => onSet(g.key, { action: v }), children: [
4863
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
4864
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
4865
+ /* @__PURE__ */ jsx(SelectItem, { value: "skip", children: "Deixar para depois" }),
4866
+ /* @__PURE__ */ jsx(SelectItem, { value: "bill", children: g.direction === "credit" ? "Lan\xE7ar como conta a receber" : "Lan\xE7ar como conta a pagar" }),
4867
+ /* @__PURE__ */ jsx(SelectItem, { value: "transfer", children: "Transfer\xEAncia entre contas" })
4868
+ ] })
4839
4869
  ] }),
4840
- /* @__PURE__ */ jsxs("div", { className: "ml-6 mt-2 grid gap-2 sm:grid-cols-[180px_1fr_1fr]", children: [
4841
- /* @__PURE__ */ jsxs(Select, { value: d.action, onValueChange: (v) => onSet(g.key, { action: v }), children: [
4842
- /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
4843
- /* @__PURE__ */ jsxs(SelectContent, { children: [
4844
- /* @__PURE__ */ jsx(SelectItem, { value: "skip", children: "Deixar para depois" }),
4845
- /* @__PURE__ */ jsx(SelectItem, { value: "bill", children: g.direction === "credit" ? "Lan\xE7ar como conta a receber" : "Lan\xE7ar como conta a pagar" }),
4846
- /* @__PURE__ */ jsx(SelectItem, { value: "transfer", children: "Transfer\xEAncia entre contas" })
4847
- ] })
4848
- ] }),
4849
- d.action === "bill" && /* @__PURE__ */ jsxs(Fragment, { children: [
4850
- /* @__PURE__ */ jsx(
4851
- TreeSelect,
4852
- {
4853
- ...chartTreeProps,
4854
- compare,
4855
- variant: "field",
4856
- leafOnly: true,
4857
- nodes: chart,
4858
- value: d.accountId,
4859
- onChange: (v) => onSet(g.key, { accountId: v }),
4860
- placeholder: "Conta do plano",
4861
- searchPlaceholder: "Buscar conta\u2026",
4862
- noResultsLabel: "Nenhuma conta encontrada"
4863
- }
4864
- ),
4865
- /* @__PURE__ */ jsx(
4866
- Input,
4867
- {
4868
- placeholder: g.direction === "credit" ? "Cliente ou de quem veio (opcional)" : "Fornecedor (opcional)",
4869
- value: d.contactName,
4870
- onChange: (e) => onSet(g.key, { contactName: e.target.value })
4871
- }
4872
- )
4873
- ] }),
4874
- d.action === "transfer" && /* @__PURE__ */ jsx(
4875
- LazySelect,
4870
+ d.action === "bill" && /* @__PURE__ */ jsxs(Fragment, { children: [
4871
+ /* @__PURE__ */ jsx(
4872
+ TreeSelect,
4876
4873
  {
4877
- value: d.counterAccountId,
4878
- onChange: (v) => onSet(g.key, { counterAccountId: v }),
4879
- placeholder: accounts.length ? "A outra conta" : "Nenhuma outra conta cadastrada",
4880
- options: accounts
4874
+ ...chartTreeProps,
4875
+ compare,
4876
+ variant: "field",
4877
+ leafOnly: true,
4878
+ nodes: chart,
4879
+ value: d.accountId,
4880
+ onChange: (v) => onSet(g.key, { accountId: v }),
4881
+ placeholder: "Conta do plano",
4882
+ searchPlaceholder: "Buscar conta\u2026",
4883
+ noResultsLabel: "Nenhuma conta encontrada"
4881
4884
  }
4882
- )
4883
- ] }),
4884
- expanded && /* @__PURE__ */ jsx("ul", { className: "ml-6 mt-2 max-h-56 space-y-1 overflow-y-auto text-xs", children: g.lines.map((l) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
4885
+ ),
4885
4886
  /* @__PURE__ */ jsx(
4886
- "input",
4887
+ Input,
4887
4888
  {
4888
- type: "checkbox",
4889
- checked: !d.excluded.has(l.id),
4890
- "aria-label": "Incluir esta linha",
4891
- onChange: (e) => {
4892
- const n = new Set(d.excluded);
4893
- if (e.target.checked) n.delete(l.id);
4894
- else n.add(l.id);
4895
- onSet(g.key, { excluded: n });
4896
- }
4889
+ placeholder: g.direction === "credit" ? "Cliente ou de quem veio (opcional)" : "Fornecedor (opcional)",
4890
+ value: d.contactName,
4891
+ onChange: (e) => onSet(g.key, { contactName: e.target.value })
4897
4892
  }
4898
- ),
4899
- /* @__PURE__ */ jsx("span", { className: "w-20 text-muted-foreground", children: (/* @__PURE__ */ new Date(l.date + "T12:00:00")).toLocaleDateString("pt-BR") }),
4900
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: l.description }),
4901
- /* @__PURE__ */ jsx("span", { className: "w-24 text-right", children: formatCurrency(l.amount) })
4902
- ] }, l.id)) })
4903
- ] })
4904
- );
4893
+ )
4894
+ ] }),
4895
+ d.action === "transfer" && /* @__PURE__ */ jsx(
4896
+ LazySelect,
4897
+ {
4898
+ value: d.counterAccountId,
4899
+ onChange: (v) => onSet(g.key, { counterAccountId: v }),
4900
+ placeholder: accounts.length ? "A outra conta" : "Nenhuma outra conta cadastrada",
4901
+ options: accounts
4902
+ }
4903
+ )
4904
+ ] }),
4905
+ expanded && /* @__PURE__ */ jsx("ul", { className: "ml-6 mt-2 max-h-56 space-y-1 overflow-y-auto text-xs", children: g.lines.map((l) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
4906
+ /* @__PURE__ */ jsx(
4907
+ "input",
4908
+ {
4909
+ type: "checkbox",
4910
+ checked: !d.excluded.has(l.id),
4911
+ "aria-label": "Incluir esta linha",
4912
+ onChange: (e) => {
4913
+ const n = new Set(d.excluded);
4914
+ if (e.target.checked) n.delete(l.id);
4915
+ else n.add(l.id);
4916
+ onSet(g.key, { excluded: n });
4917
+ }
4918
+ }
4919
+ ),
4920
+ /* @__PURE__ */ jsx("span", { className: "w-20 text-muted-foreground", children: (/* @__PURE__ */ new Date(l.date + "T12:00:00")).toLocaleDateString("pt-BR") }),
4921
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: l.description }),
4922
+ /* @__PURE__ */ jsx("span", { className: "w-24 text-right", children: formatCurrency(l.amount) })
4923
+ ] }, l.id)) })
4924
+ ] });
4905
4925
  });
4906
4926
  function relativeSince(iso, t, now = Date.now()) {
4907
4927
  const minutes = Math.floor((now - Date.parse(iso)) / 6e4);
@@ -5451,11 +5471,15 @@ function ReconciliationView() {
5451
5471
  disabled: loading
5452
5472
  }
5453
5473
  ) }),
5454
- applied.accountId && result && total > 0 && /* @__PURE__ */ jsx(Hint, { label: t("financial.reconciliation.pageTotalsHint"), children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-3", children: [
5474
+ applied.accountId && result && total > 0 && (result.totals ? /* @__PURE__ */ jsx(Hint, { label: t("financial.reconciliation.totalsHint"), children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-3", children: [
5475
+ /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.totalCredits"), value: fmt(result.totals.credits), tone: "in" }),
5476
+ /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.totalDebits"), value: fmt(result.totals.debits), tone: "out" }),
5477
+ /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.totalBalance"), value: fmt(result.totals.balance) })
5478
+ ] }) }) : /* @__PURE__ */ jsx(Hint, { label: t("financial.reconciliation.pageTotalsHint"), children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-3", children: [
5455
5479
  /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.pageCredits"), value: fmt(result.pageCredits), tone: "in" }),
5456
5480
  /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.pageDebits"), value: fmt(result.pageDebits), tone: "out" }),
5457
5481
  /* @__PURE__ */ jsx(TotalStat, { label: t("financial.reconciliation.pageBalance"), value: fmt(result.pageBalance) })
5458
- ] }) }),
5482
+ ] }) })),
5459
5483
  flow && /* @__PURE__ */ jsx(
5460
5484
  ReconcileFlow,
5461
5485
  {
@@ -5534,12 +5558,15 @@ function StatementCard({
5534
5558
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
5535
5559
  /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold tabular-nums", children: line.date ? shortDate3(line.date) : "\u2014" }),
5536
5560
  /* @__PURE__ */ jsx("span", { className: `rounded border px-1.5 py-px text-[11px] font-medium ${isCredit ? "border-success/60 text-success" : "border-destructive/60 text-destructive"}`, children: isCredit ? t("financial.reconciliation.credit") : t("financial.reconciliation.debit") }),
5537
- /* @__PURE__ */ jsx("span", { className: "truncate text-base font-semibold", children: line.description || line.counterpartyName || line.externalId }),
5561
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col", children: [
5562
+ /* @__PURE__ */ jsx("span", { className: "truncate text-base font-semibold", children: line.counterpartyName || line.description || line.externalId }),
5563
+ line.counterpartyName && line.description && line.counterpartyName !== line.description && /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: line.description })
5564
+ ] }),
5538
5565
  conciliada && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded bg-success/10 px-1.5 py-0.5 text-[11px] font-medium text-success", children: [
5539
5566
  /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }),
5540
5567
  t("financial.reconciliation.reconciled")
5541
5568
  ] }),
5542
- conciliada && line.matchedCounterpartyName && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
5569
+ conciliada && line.matchedCounterpartyName && line.matchedCounterpartyName !== line.counterpartyName && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
5543
5570
  isCredit ? t("financial.reconciliation.payerLabel") : t("financial.reconciliation.supplierLabel"),
5544
5571
  " ",
5545
5572
  /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: line.matchedCounterpartyName })
@@ -6635,5 +6662,5 @@ function FinancialPage({ config: appConfig, provider, store, registries }) {
6635
6662
  }
6636
6663
 
6637
6664
  export { FinancialPage };
6638
- //# sourceMappingURL=FinancialPage-S2EBQVIA.js.map
6639
- //# sourceMappingURL=FinancialPage-S2EBQVIA.js.map
6665
+ //# sourceMappingURL=FinancialPage-YJUM62B7.js.map
6666
+ //# sourceMappingURL=FinancialPage-YJUM62B7.js.map