@fayz-ai/plugin-financial 0.26.3 → 0.27.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,21 @@
1
+ import React from 'react';
2
+ import type { StatementSyncStatus } from '@fayz-ai/financial/data/sync-status';
3
+ type Translate = (key: string, params?: Record<string, string | number>) => string;
4
+ export interface SyncStatusLine {
5
+ text: string;
6
+ tone: 'muted' | 'warning' | 'error';
7
+ /** The full reason, for the hint — the inline text is truncated. */
8
+ detail?: string;
9
+ }
10
+ /** "agora", "há 3 min", "há 2 h", "há 4 dias", then the date itself. */
11
+ export declare function relativeSince(iso: string, t: Translate, now?: number): string;
12
+ /** What the line beside the button says. Null when there is nothing to report on. */
13
+ export declare function syncStatusLine(status: StatementSyncStatus | null, syncing: boolean, t: Translate, now?: number): SyncStatusLine | null;
14
+ export declare function StatementSyncControl({ status, syncing, onSync, t }: {
15
+ status: StatementSyncStatus | null;
16
+ syncing: boolean;
17
+ onSync: () => Promise<void>;
18
+ t: Translate;
19
+ }): React.JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=StatementSyncControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatementSyncControl.d.ts","sourceRoot":"","sources":["../../src/components/StatementSyncControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAY9E,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAA;AAElF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,SAAa,GAAG,MAAM,CASjF;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,mBAAmB,GAAG,IAAI,EAClC,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,SAAS,EACZ,GAAG,SAAa,GACf,cAAc,GAAG,IAAI,CAcvB;AAQD,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;IACnE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,EAAE,SAAS,CAAA;CACb,qBA+BA"}
@@ -1 +1 @@
1
- {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/data/registries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,eAAe,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AA8a9C;mEACmE;AACnE,eAAO,MAAM,sBAAsB,oCAAoB,CAAA;AAEvD,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAsGlD,CAAA"}
1
+ {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/data/registries.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,eAAe,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAsf9C;mEACmE;AACnE,eAAO,MAAM,sBAAsB,oCAAoB,CAAA;AAEvD,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAuGlD,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { renderCardChip, BankPicker, PaymentModal, InvoiceFormView, InvoiceDetailView, renderAccountAvatar, ACCOUNTS_ROUTE } from './chunk-K37Q7SKX.js';
2
- export { FINANCIAL_INVOICE_ZONES } from './chunk-K37Q7SKX.js';
1
+ import { renderCardChip, BankPicker, PaymentModal, InvoiceFormView, InvoiceDetailView, renderAccountAvatar, ACCOUNTS_ROUTE } from './chunk-IQHWMVUM.js';
2
+ export { FINANCIAL_INVOICE_ZONES } from './chunk-IQHWMVUM.js';
3
3
  import './chunk-7VKJLBYY.js';
4
4
  import { FINANCIAL_MODULE_DEFAULTS } from './chunk-POYZFEAN.js';
5
5
  import { FinancialContextProvider, useFinancialProvider, formatCurrency, useFinancialConfig, useFinancialStore } from './chunk-CNXAVGSW.js';
@@ -12,7 +12,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
12
  import { createSafeFinancialProvider, createFinancialStore } from '@fayz-ai/financial/store';
13
13
  export { createSafeFinancialProvider } from '@fayz-ai/financial/store';
14
14
  import { FINANCIAL_ZONES } from '@fayz-ai/financial/views/zones';
15
- import { fayzConnectorOAuth, defineSettingsTab, RightRailPage, useConnectors, useConnectorsPanelAvailable, SettingsForm, ConnectorMark, StateChip, ConnectorDetail, openConnectorsPanel, createCrudPage, PluginSettingsPanel, useTenantPluginSettings, usePermissionOptional } from '@fayz-ai/admin';
15
+ import { addAllProductsToPriceTable, fayzConnectorOAuth, defineSettingsTab, RightRailPage, useConnectors, useConnectorsPanelAvailable, SettingsForm, ConnectorMark, StateChip, ConnectorDetail, openConnectorsPanel, createCrudPage, PluginSettingsPanel, useTenantPluginSettings, usePermissionOptional } from '@fayz-ai/admin';
16
16
  import { invoiceOpensForEditing } from '@fayz-ai/financial/domain/invoice';
17
17
  import { T } from '@fayz-ai/financial/data/tables';
18
18
  import { buildChartTree, rootIds, searchVisibleIds, isGroupNode, descendantIds, accountLabel, suggestNextCode, childIds } from '@fayz-ai/financial/domain/chart-of-accounts';
@@ -842,6 +842,11 @@ var en = {
842
842
  "financial.invoiceForm.searchMinChars": "Type at least 2 characters to search.",
843
843
  "financial.invoiceForm.searchUnit": "Search unit...",
844
844
  "financial.invoiceForm.selectInstallments": "Select installment count above",
845
+ "financial.invoiceForm.priceTable": "Price table",
846
+ "financial.invoiceForm.priceTableNone": "No table (base prices)",
847
+ "financial.invoiceForm.priceTableHint": "Items are searched in this table and come in at its price.",
848
+ "financial.invoiceForm.priceTableRepriced": "{{count}} item(s) repriced from {{table}}.",
849
+ "financial.invoiceForm.priceTableMissing": "{{count}} item(s) are not in {{table}} and kept their price.",
845
850
  "financial.invoiceForm.selectContactFirst": "Select who will pay or receive before adding items.",
846
851
  "financial.invoiceForm.selectItemType": "Select item type:",
847
852
  "financial.invoiceForm.selectUnit": "Select unit",
@@ -965,6 +970,18 @@ var en = {
965
970
  "financial.reconciliation.syncImported": "{{count}} new line(s) from the bank",
966
971
  "financial.reconciliation.syncNothingNew": "The bank has nothing new",
967
972
  "financial.reconciliation.syncFailed": "Could not fetch the bank statement",
973
+ "financial.reconciliation.batchClassify": "Classify in bulk",
974
+ "financial.reconciliation.syncStatusSyncing": "Syncing\u2026",
975
+ "financial.reconciliation.syncStatusOk": "Synced {{when}}",
976
+ "financial.reconciliation.syncStatusNever": "Not synced yet",
977
+ "financial.reconciliation.syncStatusPending": "Waiting for the bank to release the statement",
978
+ "financial.reconciliation.syncStatusRevoked": "Bank authorization expired",
979
+ "financial.reconciliation.syncStatusError": "Sync failed: {{reason}}",
980
+ "financial.reconciliation.syncStatusErrorUnknown": "the bank did not answer",
981
+ "financial.reconciliation.syncWhenNow": "just now",
982
+ "financial.reconciliation.syncWhenMinutes": "{{count}} min ago",
983
+ "financial.reconciliation.syncWhenHours": "{{count}} h ago",
984
+ "financial.reconciliation.syncWhenDays": "{{count}} day(s) ago",
968
985
  "financial.reconciliation.group.today": "Today",
969
986
  "financial.reconciliation.group.yesterday": "Yesterday",
970
987
  "financial.reconciliation.group.thisWeek": "This week",
@@ -1847,6 +1864,11 @@ var ptBR = {
1847
1864
  "financial.invoiceForm.searchMinChars": "Digite pelo menos 2 caracteres para buscar.",
1848
1865
  "financial.invoiceForm.searchUnit": "Buscar unidade...",
1849
1866
  "financial.invoiceForm.selectInstallments": "Selecione a quantidade de parcelas acima",
1867
+ "financial.invoiceForm.priceTable": "Tabela de pre\xE7o",
1868
+ "financial.invoiceForm.priceTableNone": "Sem tabela (pre\xE7o base)",
1869
+ "financial.invoiceForm.priceTableHint": "Os itens s\xE3o buscados nesta tabela e entram com o pre\xE7o dela.",
1870
+ "financial.invoiceForm.priceTableRepriced": "{{count}} item(ns) agora com o pre\xE7o da tabela {{table}}.",
1871
+ "financial.invoiceForm.priceTableMissing": "{{count}} item(ns) n\xE3o est\xE3o na tabela {{table}} e mantiveram o pre\xE7o.",
1850
1872
  "financial.invoiceForm.selectContactFirst": "Selecione primeiro quem vai pagar ou receber para adicionar itens.",
1851
1873
  "financial.invoiceForm.selectItemType": "Selecione o tipo do item:",
1852
1874
  "financial.invoiceForm.selectUnit": "Selecionar unidade",
@@ -1970,6 +1992,18 @@ var ptBR = {
1970
1992
  "financial.reconciliation.syncImported": "{{count}} lan\xE7amento(s) novo(s) do banco",
1971
1993
  "financial.reconciliation.syncNothingNew": "O banco n\xE3o tem lan\xE7amento novo",
1972
1994
  "financial.reconciliation.syncFailed": "N\xE3o foi poss\xEDvel buscar o extrato do banco",
1995
+ "financial.reconciliation.batchClassify": "Classificar em lote",
1996
+ "financial.reconciliation.syncStatusSyncing": "Sincronizando\u2026",
1997
+ "financial.reconciliation.syncStatusOk": "Sincronizado {{when}}",
1998
+ "financial.reconciliation.syncStatusNever": "Ainda n\xE3o sincronizado",
1999
+ "financial.reconciliation.syncStatusPending": "Aguardando o banco liberar o extrato",
2000
+ "financial.reconciliation.syncStatusRevoked": "Autoriza\xE7\xE3o do banco expirou",
2001
+ "financial.reconciliation.syncStatusError": "Falha ao sincronizar: {{reason}}",
2002
+ "financial.reconciliation.syncStatusErrorUnknown": "o banco n\xE3o respondeu",
2003
+ "financial.reconciliation.syncWhenNow": "agora",
2004
+ "financial.reconciliation.syncWhenMinutes": "h\xE1 {{count}} min",
2005
+ "financial.reconciliation.syncWhenHours": "h\xE1 {{count}} h",
2006
+ "financial.reconciliation.syncWhenDays": "h\xE1 {{count}} dia(s)",
1973
2007
  "financial.reconciliation.group.today": "Hoje",
1974
2008
  "financial.reconciliation.group.yesterday": "Ontem",
1975
2009
  "financial.reconciliation.group.thisWeek": "Esta semana",
@@ -3852,19 +3886,115 @@ var commissionRuleEntity = {
3852
3886
  ],
3853
3887
  data: { table: T.commissionRules, tenantScoped: true }
3854
3888
  };
3889
+ var priceTableItemEntity = {
3890
+ name: tl("Item", "Item"),
3891
+ namePlural: tl("Items", "Itens da tabela"),
3892
+ icon: "Package",
3893
+ displayField: "productId",
3894
+ defaultSort: "createdAt",
3895
+ fields: [
3896
+ {
3897
+ key: "productId",
3898
+ label: tl("Item", "Item"),
3899
+ type: "relation",
3900
+ required: true,
3901
+ showInTable: true,
3902
+ relation: { table: "products", labelField: "name", priceField: "price", filter: { is_active: true } }
3903
+ },
3904
+ // Picking the item fills its base price; the table price is then typed over it.
3905
+ {
3906
+ key: "price",
3907
+ label: tl("Table price", "Pre\xE7o na tabela"),
3908
+ type: "currency",
3909
+ required: true,
3910
+ defaultValue: 0,
3911
+ showInTable: true,
3912
+ fillFrom: { field: "productId", source: "price" }
3913
+ },
3914
+ { key: "minQty", label: tl("From qty", "A partir de (qtd)"), type: "number", min: 1, defaultValue: 1, showInTable: true }
3915
+ ],
3916
+ data: { table: "price_table_items", tenantScoped: true }
3917
+ };
3855
3918
  var priceTableEntity = {
3856
- name: "Price Table",
3857
- namePlural: "Price Tables",
3919
+ name: tl("Price Table", "Tabela de pre\xE7o"),
3920
+ namePlural: tl("Price Tables", "Tabelas de pre\xE7o"),
3858
3921
  icon: "Tag",
3859
- displayField: "description",
3860
- defaultSort: "createdAt",
3861
- defaultSortDir: "desc",
3922
+ displayField: "name",
3923
+ defaultSort: "name",
3924
+ formColumns: 2,
3925
+ facets: [activeFacet({ active: "Ativas", inactive: "Inativas", all: "Todas" })],
3926
+ fieldGroups: [
3927
+ { id: "identity", label: tl("Identification", "Identifica\xE7\xE3o"), columns: 2 },
3928
+ {
3929
+ id: "rules",
3930
+ label: tl("What it sells", "O que ela vende"),
3931
+ columns: 2,
3932
+ description: tl(
3933
+ "Picked on a receivable after the customer: the item search then shows this table's items at this table's price.",
3934
+ "Escolhida no lan\xE7amento, depois do cliente: a busca de itens passa a mostrar os itens desta tabela, com o pre\xE7o dela."
3935
+ )
3936
+ },
3937
+ { ...RECORD_GROUP }
3938
+ ],
3862
3939
  fields: [
3863
- { key: "description", label: tl("Description", "Descri\xE7\xE3o"), type: "text", required: true, showInTable: true, group: "identity" },
3864
- { key: "type", label: tl("Type", "Tipo"), type: "select", options: ["sale", "cost"], required: true, showInTable: true, defaultValue: "sale", group: "identity" },
3865
- { key: "validFrom", label: tl("Valid From", "V\xE1lida desde"), type: "date", showInTable: true, group: "identity" },
3866
- { key: "validUntil", label: tl("Valid Until", "V\xE1lida at\xE9"), type: "date", showInTable: true, group: "identity" },
3867
- ...recordRailFields({ tagsTable: "price_tables", activeLabel: "Ativa", unit: true })
3940
+ { key: "name", label: tl("Name", "Nome"), type: "text", required: true, showInTable: true, searchable: true, group: "identity" },
3941
+ { key: "description", label: tl("Description", "Descri\xE7\xE3o"), type: "textarea", showInTable: false, group: "identity" },
3942
+ { key: "validFrom", label: tl("Valid from", "V\xE1lida desde"), type: "date", showInTable: true, group: "identity" },
3943
+ { key: "validTo", label: tl("Valid until", "V\xE1lida at\xE9"), type: "date", showInTable: true, group: "identity" },
3944
+ {
3945
+ key: "itemsOnly",
3946
+ label: tl("Sells only the items listed below", "Vende s\xF3 os itens listados abaixo"),
3947
+ type: "boolean",
3948
+ defaultValue: true,
3949
+ showInTable: false,
3950
+ group: "rules",
3951
+ hint: tl(
3952
+ "Off: every for-sale item is offered, at the price below when listed and at the base price (\xB1 the adjustment) otherwise.",
3953
+ "Desligado: todo item \xE0 venda aparece, com o pre\xE7o abaixo quando listado e o pre\xE7o base (\xB1 o ajuste) quando n\xE3o."
3954
+ )
3955
+ },
3956
+ {
3957
+ key: "adjustmentPercent",
3958
+ label: tl("Adjustment on base price (%)", "Ajuste sobre o pre\xE7o base (%)"),
3959
+ type: "number",
3960
+ showInTable: false,
3961
+ group: "rules",
3962
+ hint: tl("For items not listed. \u221210 = 10% off, 15 = 15% more.", "Para itens n\xE3o listados. \u221210 = 10% de desconto, 15 = 15% a mais.")
3963
+ },
3964
+ {
3965
+ key: "isDefault",
3966
+ label: tl("House default", "Tabela padr\xE3o da casa"),
3967
+ type: "boolean",
3968
+ defaultValue: false,
3969
+ showInTable: true,
3970
+ group: "rules",
3971
+ hint: tl("Pre-picked when the customer has no table of their own.", "J\xE1 vem escolhida quando o cliente n\xE3o tem tabela pr\xF3pria.")
3972
+ },
3973
+ { key: "currency", label: tl("Currency", "Moeda"), type: "text", defaultValue: "BRL", showInTable: false, showInForm: false, group: "rules" },
3974
+ ...recordRailFields({ tagsTable: "price_tables", activeLabel: tl("Active", "Ativa"), unit: true })
3975
+ ],
3976
+ relatedSections: [
3977
+ {
3978
+ id: "price-table-items",
3979
+ entity: priceTableItemEntity,
3980
+ foreignKey: "priceTableId",
3981
+ icon: "ListChecks",
3982
+ display: "grid",
3983
+ pageSize: 1e3,
3984
+ emptyHint: tl(
3985
+ "No item yet. Add them one by one, or add every for-sale product at its base price and adjust.",
3986
+ "Nenhum item ainda. Adicione um a um, ou adicione todos os produtos \xE0 venda pelo pre\xE7o base e ajuste."
3987
+ ),
3988
+ actions: [{
3989
+ id: "add-all-products",
3990
+ label: tl("Add all products", "Adicionar todos os produtos"),
3991
+ icon: "ListPlus",
3992
+ run: async (tableId) => {
3993
+ const added = await addAllProductsToPriceTable(tableId, ["good"]);
3994
+ return added > 0 ? tl(`${added} product(s) added at the base price.`, `${added} produto(s) adicionado(s) pelo pre\xE7o base.`) : tl("Every for-sale product is already in this table.", "Todos os produtos \xE0 venda j\xE1 est\xE3o nesta tabela.");
3995
+ }
3996
+ }]
3997
+ }
3868
3998
  ],
3869
3999
  data: { table: "price_tables", tenantScoped: true }
3870
4000
  };
@@ -3944,7 +4074,8 @@ var financialRegistries = [
3944
4074
  id: "price-tables",
3945
4075
  entity: priceTableEntity,
3946
4076
  icon: "Tag",
3947
- description: "Price tables for sale and cost pricing",
4077
+ description: "Sale price tables (restaurant, resale, retail\u2026), picked on a receivable after the customer",
4078
+ agentHint: "Sale price TABLES: a named set of item prices picked on a receivable. Not a product price and not a discount reason.",
3948
4079
  display: "table"
3949
4080
  },
3950
4081
  {
@@ -5655,7 +5786,7 @@ function createFinancialPlugin(options) {
5655
5786
  locales: financialLocales
5656
5787
  };
5657
5788
  }
5658
- var FinancialPage = React5__default.lazy(() => import('./FinancialPage-7SQNQEY2.js').then((m) => ({ default: m.FinancialPage })));
5789
+ var FinancialPage = React5__default.lazy(() => import('./FinancialPage-HIVSEGJE.js').then((m) => ({ default: m.FinancialPage })));
5659
5790
  var FinancialGeneralSettings = lazyComponent(() => import('./FinancialGeneralSettings-WXJOCJPZ.js').then((m) => m.FinancialGeneralSettings));
5660
5791
  var CommissionRulesView = lazyComponent(() => import('./CommissionRulesView-2RW4ZCDT.js').then((m) => m.CommissionRulesView));
5661
5792
  var PersonStatementWidget = lazyComponent(() => import('./PersonStatementWidget-ULXXXYZ4.js').then((m) => m.PersonStatementWidget));