@spaceinvoices/react-ui 0.4.6 → 0.4.8

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.
Files changed (100) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +60 -44
  4. package/src/components/advance-invoices/create/locales/de.ts +2 -1
  5. package/src/components/advance-invoices/create/locales/es.ts +2 -1
  6. package/src/components/advance-invoices/create/locales/fr.ts +2 -1
  7. package/src/components/advance-invoices/create/locales/hr.ts +2 -1
  8. package/src/components/advance-invoices/create/locales/it.ts +2 -1
  9. package/src/components/advance-invoices/create/locales/nl.ts +2 -1
  10. package/src/components/advance-invoices/create/locales/pl.ts +2 -1
  11. package/src/components/advance-invoices/create/locales/pt.ts +2 -1
  12. package/src/components/advance-invoices/create/locales/sl.ts +2 -1
  13. package/src/components/credit-notes/create/create-credit-note-form.tsx +52 -42
  14. package/src/components/credit-notes/create/locales/de.ts +2 -1
  15. package/src/components/credit-notes/create/locales/es.ts +2 -1
  16. package/src/components/credit-notes/create/locales/fr.ts +2 -1
  17. package/src/components/credit-notes/create/locales/hr.ts +2 -1
  18. package/src/components/credit-notes/create/locales/it.ts +2 -1
  19. package/src/components/credit-notes/create/locales/nl.ts +2 -1
  20. package/src/components/credit-notes/create/locales/pl.ts +2 -1
  21. package/src/components/credit-notes/create/locales/pt.ts +2 -1
  22. package/src/components/credit-notes/create/locales/sl.ts +2 -1
  23. package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +48 -92
  24. package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +48 -82
  25. package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +22 -31
  26. package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +33 -48
  27. package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +56 -76
  28. package/src/components/dashboard/shared/index.ts +1 -1
  29. package/src/components/dashboard/shared/use-revenue-data.ts +106 -182
  30. package/src/components/dashboard/shared/use-stats-counts.ts +18 -68
  31. package/src/components/dashboard/shared/use-stats-query.ts +35 -5
  32. package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +57 -75
  33. package/src/components/dashboard/top-customers-chart/use-top-customers.ts +38 -49
  34. package/src/components/delivery-notes/create/create-delivery-note-form.tsx +3 -2
  35. package/src/components/delivery-notes/create/locales/de.ts +2 -1
  36. package/src/components/delivery-notes/create/locales/es.ts +2 -1
  37. package/src/components/delivery-notes/create/locales/fr.ts +2 -1
  38. package/src/components/delivery-notes/create/locales/hr.ts +2 -1
  39. package/src/components/delivery-notes/create/locales/it.ts +2 -1
  40. package/src/components/delivery-notes/create/locales/nl.ts +2 -1
  41. package/src/components/delivery-notes/create/locales/pl.ts +2 -1
  42. package/src/components/delivery-notes/create/locales/pt.ts +2 -1
  43. package/src/components/delivery-notes/create/locales/sl.ts +2 -1
  44. package/src/components/documents/create/document-details-section.tsx +6 -4
  45. package/src/components/documents/create/document-recipient-section.tsx +30 -1
  46. package/src/components/documents/create/live-preview.tsx +15 -28
  47. package/src/components/documents/create/prepare-document-submission.ts +1 -0
  48. package/src/components/documents/create/use-document-customer-form.ts +4 -0
  49. package/src/components/documents/shared/document-preview-skeleton.tsx +63 -0
  50. package/src/components/documents/shared/index.ts +1 -0
  51. package/src/components/documents/view/document-actions-bar.tsx +29 -7
  52. package/src/components/entities/entity-settings-form/locales/de.ts +6 -3
  53. package/src/components/entities/entity-settings-form/locales/es.ts +6 -3
  54. package/src/components/entities/entity-settings-form/locales/fr.ts +6 -3
  55. package/src/components/entities/entity-settings-form/locales/hr.ts +4 -2
  56. package/src/components/entities/entity-settings-form/locales/it.ts +6 -3
  57. package/src/components/entities/entity-settings-form/locales/nl.ts +6 -3
  58. package/src/components/entities/entity-settings-form/locales/pl.ts +6 -2
  59. package/src/components/entities/entity-settings-form/locales/pt.ts +6 -3
  60. package/src/components/entities/entity-settings-form/locales/sl.ts +4 -2
  61. package/src/components/entities/settings/tax-rules-settings-form.tsx +31 -13
  62. package/src/components/estimates/create/create-estimate-form.tsx +3 -2
  63. package/src/components/estimates/create/locales/de.ts +2 -1
  64. package/src/components/estimates/create/locales/es.ts +2 -1
  65. package/src/components/estimates/create/locales/fr.ts +2 -1
  66. package/src/components/estimates/create/locales/hr.ts +2 -1
  67. package/src/components/estimates/create/locales/it.ts +2 -1
  68. package/src/components/estimates/create/locales/nl.ts +2 -1
  69. package/src/components/estimates/create/locales/pl.ts +2 -1
  70. package/src/components/estimates/create/locales/pt.ts +2 -1
  71. package/src/components/estimates/create/locales/sl.ts +2 -1
  72. package/src/components/invoices/create/create-invoice-form.tsx +134 -62
  73. package/src/components/invoices/create/locales/de.ts +8 -1
  74. package/src/components/invoices/create/locales/es.ts +8 -1
  75. package/src/components/invoices/create/locales/fr.ts +8 -1
  76. package/src/components/invoices/create/locales/hr.ts +8 -1
  77. package/src/components/invoices/create/locales/it.ts +8 -1
  78. package/src/components/invoices/create/locales/nl.ts +8 -1
  79. package/src/components/invoices/create/locales/pl.ts +8 -1
  80. package/src/components/invoices/create/locales/pt.ts +8 -1
  81. package/src/components/invoices/create/locales/sl.ts +8 -1
  82. package/src/components/invoices/invoices.hooks.ts +1 -1
  83. package/src/components/ui/progress.tsx +27 -0
  84. package/src/generate-schemas.ts +15 -2
  85. package/src/generated/schemas/advanceinvoice.ts +2 -0
  86. package/src/generated/schemas/creditnote.ts +2 -0
  87. package/src/generated/schemas/customer.ts +2 -0
  88. package/src/generated/schemas/deliverynote.ts +2 -0
  89. package/src/generated/schemas/entity.ts +10 -0
  90. package/src/generated/schemas/estimate.ts +2 -0
  91. package/src/generated/schemas/finasettings.ts +4 -3
  92. package/src/generated/schemas/invoice.ts +2 -0
  93. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +16 -10
  94. package/src/generated/schemas/rendercreditnotepreview_body.ts +16 -10
  95. package/src/generated/schemas/renderdeliverynotepreview_body.ts +14 -7
  96. package/src/generated/schemas/renderestimatepreview_body.ts +14 -7
  97. package/src/generated/schemas/renderinvoicepreview_body.ts +16 -10
  98. package/src/generated/schemas/startpdfexport_body.ts +12 -17
  99. package/src/hooks/use-transaction-type-check.ts +152 -0
  100. package/src/hooks/use-vies-check.ts +7 -131
@@ -131,7 +131,8 @@ export default {
131
131
  Domestic: "Nacional",
132
132
  "EU B2B": "EU B2B",
133
133
  "EU B2C": "EU B2C",
134
- Export: "Exportación",
134
+ "3W B2B": "3W B2B",
135
+ "3W B2C": "3W B2C",
135
136
  "Determining transaction type...": "Determinando tipo de transacción...",
136
137
  "This invoice will not be fiscalized (non-domestic transaction)":
137
138
  "Esta factura no será fiscalizada (transacción no nacional)",
@@ -139,4 +140,10 @@ export default {
139
140
  "Add tax clause...": "Agregar cláusula fiscal...",
140
141
  Footer: "Pie de página",
141
142
  "Add document footer...": "Añadir pie de página del documento...",
143
+ // Croatian domestic invoice validation
144
+ "End consumer": "Consumidor final",
145
+ "Domestic B2B invoicing in Croatia is not supported":
146
+ "La facturación B2B doméstica en Croacia no está soportada. Croacia requiere conformidad con Fiskalizacija 2.0 para facturación B2B.",
147
+ "FINA fiscalization must be enabled for domestic invoices":
148
+ "La fiscalización FINA debe estar habilitada para facturas domésticas. Habilítela en la configuración de la entidad.",
142
149
  } as const;
@@ -133,7 +133,8 @@ export default {
133
133
  Domestic: "Nationale",
134
134
  "EU B2B": "EU B2B",
135
135
  "EU B2C": "EU B2C",
136
- Export: "Exportation",
136
+ "3W B2B": "3W B2B",
137
+ "3W B2C": "3W B2C",
137
138
  "Determining transaction type...": "Détermination du type de transaction...",
138
139
  "This invoice will not be fiscalized (non-domestic transaction)":
139
140
  "Cette facture ne sera pas fiscalisée (transaction non nationale)",
@@ -141,4 +142,10 @@ export default {
141
142
  "Add tax clause...": "Ajouter une clause fiscale...",
142
143
  Footer: "Pied de page",
143
144
  "Add document footer...": "Ajouter un pied de page...",
145
+ // Croatian domestic invoice validation
146
+ "End consumer": "Consommateur final",
147
+ "Domestic B2B invoicing in Croatia is not supported":
148
+ "La facturation B2B domestique en Croatie n'est pas prise en charge. La Croatie exige la conformité à Fiskalizacija 2.0 pour la facturation B2B.",
149
+ "FINA fiscalization must be enabled for domestic invoices":
150
+ "La fiscalisation FINA doit être activée pour les factures domestiques. Activez-la dans les paramètres de l'entité.",
144
151
  } as const;
@@ -130,7 +130,8 @@ export default {
130
130
  Domestic: "Domaća",
131
131
  "EU B2B": "EU B2B",
132
132
  "EU B2C": "EU B2C",
133
- Export: "Izvoz",
133
+ "3W B2B": "3W B2B",
134
+ "3W B2C": "3W B2C",
134
135
  "Determining transaction type...": "Određivanje vrste transakcije...",
135
136
  "This invoice will not be fiscalized (non-domestic transaction)":
136
137
  "Ovaj račun neće biti fiskaliziran (nedomaća transakcija)",
@@ -138,4 +139,10 @@ export default {
138
139
  "Add tax clause...": "Dodajte poreznu klauzulu...",
139
140
  Footer: "Podnožje",
140
141
  "Add document footer...": "Dodajte podnožje dokumenta...",
142
+ // Croatian domestic invoice validation
143
+ "End consumer": "Krajnji potrošač",
144
+ "Domestic B2B invoicing in Croatia is not supported":
145
+ "Domaće B2B fakturiranje u Hrvatskoj nije podržano. Hrvatska zahtijeva usklađenost s Fiskalizacijom 2.0 za B2B fakturiranje.",
146
+ "FINA fiscalization must be enabled for domestic invoices":
147
+ "FINA fiskalizacija mora biti omogućena za domaće račune. Omogućite je u postavkama tvrtke.",
141
148
  } as const;
@@ -133,7 +133,8 @@ export default {
133
133
  Domestic: "Nazionale",
134
134
  "EU B2B": "EU B2B",
135
135
  "EU B2C": "EU B2C",
136
- Export: "Esportazione",
136
+ "3W B2B": "3W B2B",
137
+ "3W B2C": "3W B2C",
137
138
  "Determining transaction type...": "Determinazione tipo di transazione...",
138
139
  "This invoice will not be fiscalized (non-domestic transaction)":
139
140
  "Questa fattura non sarà fiscalizzata (transazione non nazionale)",
@@ -141,4 +142,10 @@ export default {
141
142
  "Add tax clause...": "Aggiungi clausola fiscale...",
142
143
  Footer: "Piè di pagina",
143
144
  "Add document footer...": "Aggiungi piè di pagina del documento...",
145
+ // Croatian domestic invoice validation
146
+ "End consumer": "Consumatore finale",
147
+ "Domestic B2B invoicing in Croatia is not supported":
148
+ "La fatturazione B2B domestica in Croazia non è supportata. La Croazia richiede la conformità a Fiskalizacija 2.0 per la fatturazione B2B.",
149
+ "FINA fiscalization must be enabled for domestic invoices":
150
+ "La fiscalizzazione FINA deve essere abilitata per le fatture domestiche. Abilitarla nelle impostazioni dell'entità.",
144
151
  } as const;
@@ -132,7 +132,8 @@ export default {
132
132
  Domestic: "Binnenland",
133
133
  "EU B2B": "EU B2B",
134
134
  "EU B2C": "EU B2C",
135
- Export: "Export",
135
+ "3W B2B": "3W B2B",
136
+ "3W B2C": "3W B2C",
136
137
  "Determining transaction type...": "Transactietype bepalen...",
137
138
  "This invoice will not be fiscalized (non-domestic transaction)":
138
139
  "Deze factuur wordt niet gefiscaliseerd (niet-binnenlandse transactie)",
@@ -140,4 +141,10 @@ export default {
140
141
  "Add tax clause...": "Belastingclausule toevoegen...",
141
142
  Footer: "Voettekst",
142
143
  "Add document footer...": "Documentvoettekst toevoegen...",
144
+ // Croatian domestic invoice validation
145
+ "End consumer": "Eindconsument",
146
+ "Domestic B2B invoicing in Croatia is not supported":
147
+ "Binnenlandse B2B-facturering in Kroatië wordt niet ondersteund. Kroatië vereist naleving van Fiskalizacija 2.0 voor B2B-facturering.",
148
+ "FINA fiscalization must be enabled for domestic invoices":
149
+ "FINA-fiscalisering moet zijn ingeschakeld voor binnenlandse facturen. Schakel deze in via de bedrijfsinstellingen.",
143
150
  } as const;
@@ -131,7 +131,8 @@ export default {
131
131
  Domestic: "Krajowa",
132
132
  "EU B2B": "EU B2B",
133
133
  "EU B2C": "EU B2C",
134
- Export: "Eksport",
134
+ "3W B2B": "3W B2B",
135
+ "3W B2C": "3W B2C",
135
136
  "Determining transaction type...": "Określanie typu transakcji...",
136
137
  "This invoice will not be fiscalized (non-domestic transaction)":
137
138
  "Ta faktura nie będzie fiskalizowana (transakcja niekrajowa)",
@@ -139,4 +140,10 @@ export default {
139
140
  "Add tax clause...": "Dodaj klauzulę podatkową...",
140
141
  Footer: "Stopka",
141
142
  "Add document footer...": "Dodaj stopkę dokumentu...",
143
+ // Croatian domestic invoice validation
144
+ "End consumer": "Konsument końcowy",
145
+ "Domestic B2B invoicing in Croatia is not supported":
146
+ "Krajowe fakturowanie B2B w Chorwacji nie jest obsługiwane. Chorwacja wymaga zgodności z Fiskalizacija 2.0 dla fakturowania B2B.",
147
+ "FINA fiscalization must be enabled for domestic invoices":
148
+ "Fiskalizacja FINA musi być włączona dla faktur krajowych. Włącz ją w ustawieniach podmiotu.",
142
149
  } as const;
@@ -132,7 +132,8 @@ export default {
132
132
  Domestic: "Nacional",
133
133
  "EU B2B": "EU B2B",
134
134
  "EU B2C": "EU B2C",
135
- Export: "Exportação",
135
+ "3W B2B": "3W B2B",
136
+ "3W B2C": "3W B2C",
136
137
  "Determining transaction type...": "Determinando tipo de transação...",
137
138
  "This invoice will not be fiscalized (non-domestic transaction)":
138
139
  "Esta fatura não será fiscalizada (transação não nacional)",
@@ -140,4 +141,10 @@ export default {
140
141
  "Add tax clause...": "Adicionar cláusula fiscal...",
141
142
  Footer: "Rodapé",
142
143
  "Add document footer...": "Adicionar rodapé do documento...",
144
+ // Croatian domestic invoice validation
145
+ "End consumer": "Consumidor final",
146
+ "Domestic B2B invoicing in Croatia is not supported":
147
+ "A faturação B2B doméstica na Croácia não é suportada. A Croácia exige conformidade com Fiskalizacija 2.0 para faturação B2B.",
148
+ "FINA fiscalization must be enabled for domestic invoices":
149
+ "A fiscalização FINA deve estar ativada para faturas domésticas. Ative-a nas configurações da entidade.",
143
150
  } as const;
@@ -141,7 +141,8 @@ export default {
141
141
  Domestic: "Domača",
142
142
  "EU B2B": "EU B2B",
143
143
  "EU B2C": "EU B2C",
144
- Export: "Izvoz",
144
+ "3W B2B": "3W B2B",
145
+ "3W B2C": "3W B2C",
145
146
  "Determining transaction type...": "Določanje vrste transakcije...",
146
147
  "This invoice will not be fiscalized (non-domestic transaction)":
147
148
  "Ta račun ne bo fiskaliziran (nedomača transakcija)",
@@ -149,4 +150,10 @@ export default {
149
150
  "Add tax clause...": "Dodajte davčno klavzulo...",
150
151
  Footer: "Noga dokumenta",
151
152
  "Add document footer...": "Dodajte nogo dokumenta...",
153
+ // Croatian domestic invoice validation
154
+ "End consumer": "Končni potrošnik",
155
+ "Domestic B2B invoicing in Croatia is not supported":
156
+ "Domače B2B fakturiranje na Hrvaškem ni podprto. Hrvška zahteva skladnost s Fiskalizacijo 2.0 za B2B fakturiranje.",
157
+ "FINA fiscalization must be enabled for domestic invoices":
158
+ "FINA fiskalizacija mora biti omogočena za domače račune. Omogočite jo v nastavitvah podjetja.",
152
159
  } as const;
@@ -66,7 +66,7 @@ export function useNextInvoiceNumber(
66
66
  return response as NextInvoiceNumberResponse;
67
67
  },
68
68
  enabled: options?.enabled !== false && !!entityId && !!sdk?.documents,
69
- staleTime: 5000, // 5 seconds - short to catch concurrent creates
69
+ staleTime: 0, // Always refetch when form opens or params change
70
70
  });
71
71
  }
72
72
 
@@ -0,0 +1,27 @@
1
+ import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
2
+
3
+ import { cn } from "@/ui/lib/utils"
4
+
5
+ function Progress({
6
+ value,
7
+ className,
8
+ ...props
9
+ }: ProgressPrimitive.Root.Props & { className?: string }) {
10
+ return (
11
+ <ProgressPrimitive.Root
12
+ data-slot="progress"
13
+ value={value}
14
+ className={cn("relative w-full overflow-hidden rounded-full bg-primary/20", className)}
15
+ {...props}
16
+ >
17
+ <ProgressPrimitive.Track>
18
+ <ProgressPrimitive.Indicator
19
+ className="h-full bg-primary transition-all duration-500 ease-in-out"
20
+ style={{ width: `${value ?? 0}%` }}
21
+ />
22
+ </ProgressPrimitive.Track>
23
+ </ProgressPrimitive.Root>
24
+ )
25
+ }
26
+
27
+ export { Progress }
@@ -26,9 +26,21 @@ async function main() {
26
26
  await fs.mkdir(SCHEMAS_DIR, { recursive: true });
27
27
  await fs.mkdir(GENERATED_DIR, { recursive: true });
28
28
 
29
- // Generate initial schemas with openapi-zod-client
29
+ // Fetch OpenAPI spec from running API and generate schemas
30
+ const API_URL = "http://localhost:3000/openapi.json";
31
+ const openApiPath = path.resolve(GENERATED_DIR, "openapi.json");
32
+
33
+ try {
34
+ const res = await fetch(API_URL);
35
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
36
+ await fs.writeFile(openApiPath, await res.text());
37
+ console.log(`Fetched OpenAPI spec from ${API_URL}`);
38
+ } catch (_error) {
39
+ console.error(`Failed to fetch OpenAPI spec from ${API_URL}. Is the API running?`);
40
+ process.exit(1);
41
+ }
42
+
30
43
  try {
31
- const openApiPath = path.resolve(__dirname, "../../../apps/api/openapi.json");
32
44
  execSync(
33
45
  `bunx openapi-zod-client ${openApiPath} ` +
34
46
  "--output " +
@@ -299,6 +311,7 @@ export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema
299
311
 
300
312
  // Clean up temporary files
301
313
  await fs.unlink(`${GENERATED_DIR}/schemas.ts`);
314
+ await fs.unlink(`${GENERATED_DIR}/openapi.json`);
302
315
  }
303
316
 
304
317
  main().catch(console.error);
@@ -97,6 +97,8 @@ const createAdvanceInvoiceSchemaDefinition = z.object({
97
97
  note: z.union([z.string(), z.null()]).optional(),
98
98
  tax_clause: z.union([z.string(), z.null()]).optional(),
99
99
  footer: z.union([z.string(), z.null()]).optional(),
100
+ signature: z.union([z.string(), z.null()]).optional(),
101
+ reference: z.union([z.string(), z.null()]).optional(),
100
102
  currency_code: z.string().max(3).optional(),
101
103
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
102
104
  date_due: z.union([z.string(), z.null()]).optional(),
@@ -111,6 +111,8 @@ const updateCreditNoteSchemaDefinition = z
111
111
  .min(1),
112
112
  note: z.union([z.string(), z.null()]),
113
113
  footer: z.union([z.string(), z.null()]),
114
+ signature: z.union([z.string(), z.null()]),
115
+ reference: z.union([z.string(), z.null()]),
114
116
  payment_terms: z.union([z.string(), z.null()]),
115
117
  currency_code: z.string(),
116
118
  metadata: z.union([z.object({}).partial().passthrough(), z.null()]),
@@ -22,6 +22,7 @@ const createCustomerSchemaDefinition = z.object({
22
22
  company_number: z.union([z.string(), z.null()]).optional(),
23
23
  email: z.union([z.string(), z.null()]).optional(),
24
24
  is_tax_subject: z.boolean().optional(),
25
+ is_end_consumer: z.union([z.boolean(), z.null()]).optional(),
25
26
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
26
27
  });
27
28
 
@@ -44,6 +45,7 @@ const updateCustomerSchemaDefinition = z
44
45
  company_number: z.union([z.string(), z.null()]),
45
46
  email: z.union([z.string(), z.null()]),
46
47
  is_tax_subject: z.boolean(),
48
+ is_end_consumer: z.union([z.boolean(), z.null()]),
47
49
  metadata: z.union([z.record(z.string(), z.any()), z.null()]),
48
50
  })
49
51
  .partial();
@@ -85,6 +85,8 @@ const createDeliveryNoteSchemaDefinition = z.object({
85
85
  payment_terms: z.union([z.string(), z.null()]).optional(),
86
86
  tax_clause: z.union([z.string(), z.null()]).optional(),
87
87
  footer: z.union([z.string(), z.null()]).optional(),
88
+ signature: z.union([z.string(), z.null()]).optional(),
89
+ reference: z.union([z.string(), z.null()]).optional(),
88
90
  currency_code: z.string().max(3).optional(),
89
91
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
90
92
  hide_prices: z.boolean().optional(),
@@ -70,6 +70,7 @@ const createEntitySchemaDefinition = z.object({
70
70
  default_credit_note_note: z.union([z.string(), z.null()]),
71
71
  default_credit_note_payment_terms: z.union([z.string(), z.null()]),
72
72
  document_footer: z.union([z.string(), z.null()]),
73
+ default_document_signature: z.union([z.string(), z.null()]),
73
74
  furs: z.union([
74
75
  z
75
76
  .object({
@@ -78,6 +79,7 @@ const createEntitySchemaDefinition = z.object({
78
79
  operator_tax_number: z.string(),
79
80
  operator_label: z.string(),
80
81
  foreign_operator: z.boolean(),
82
+ environment: z.enum(["test", "production"]),
81
83
  })
82
84
  .partial()
83
85
  .passthrough(),
@@ -91,6 +93,7 @@ const createEntitySchemaDefinition = z.object({
91
93
  operator_label: z.string(),
92
94
  u_sust_pdv: z.boolean().default(true),
93
95
  numbering_sequence: z.enum(["N", "P"]).default("P"),
96
+ unified_numbering: z.union([z.boolean(), z.null()]),
94
97
  certificate_expiry: z.string(),
95
98
  })
96
99
  .partial()
@@ -144,6 +147,8 @@ const createEntitySchemaDefinition = z.object({
144
147
  domestic: z.union([z.string(), z.null()]),
145
148
  intra_eu_b2b: z.union([z.string(), z.null()]),
146
149
  intra_eu_b2c: z.union([z.string(), z.null()]),
150
+ "3w_b2b": z.union([z.string(), z.null()]),
151
+ "3w_b2c": z.union([z.string(), z.null()]),
147
152
  export: z.union([z.string(), z.null()]),
148
153
  })
149
154
  .partial()
@@ -221,6 +226,7 @@ const patchEntitySchemaDefinition = z
221
226
  default_credit_note_note: z.union([z.string(), z.null()]),
222
227
  default_credit_note_payment_terms: z.union([z.string(), z.null()]),
223
228
  document_footer: z.union([z.string(), z.null()]),
229
+ default_document_signature: z.union([z.string(), z.null()]),
224
230
  furs: z.union([
225
231
  z
226
232
  .object({
@@ -229,6 +235,7 @@ const patchEntitySchemaDefinition = z
229
235
  operator_tax_number: z.string(),
230
236
  operator_label: z.string(),
231
237
  foreign_operator: z.boolean(),
238
+ environment: z.enum(["test", "production"]),
232
239
  })
233
240
  .partial()
234
241
  .passthrough(),
@@ -242,6 +249,7 @@ const patchEntitySchemaDefinition = z
242
249
  operator_label: z.string(),
243
250
  u_sust_pdv: z.boolean().default(true),
244
251
  numbering_sequence: z.enum(["N", "P"]).default("P"),
252
+ unified_numbering: z.union([z.boolean(), z.null()]),
245
253
  certificate_expiry: z.string(),
246
254
  })
247
255
  .partial()
@@ -295,6 +303,8 @@ const patchEntitySchemaDefinition = z
295
303
  domestic: z.union([z.string(), z.null()]),
296
304
  intra_eu_b2b: z.union([z.string(), z.null()]),
297
305
  intra_eu_b2c: z.union([z.string(), z.null()]),
306
+ "3w_b2b": z.union([z.string(), z.null()]),
307
+ "3w_b2c": z.union([z.string(), z.null()]),
298
308
  export: z.union([z.string(), z.null()]),
299
309
  })
300
310
  .partial()
@@ -87,6 +87,8 @@ const createEstimateSchemaDefinition = z.object({
87
87
  payment_terms: z.union([z.string(), z.null()]).optional(),
88
88
  tax_clause: z.union([z.string(), z.null()]).optional(),
89
89
  footer: z.union([z.string(), z.null()]).optional(),
90
+ signature: z.union([z.string(), z.null()]).optional(),
91
+ reference: z.union([z.string(), z.null()]).optional(),
90
92
  currency_code: z.string().max(3).optional(),
91
93
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
92
94
  date_valid_till: z.union([z.string(), z.null()]).optional(),
@@ -11,11 +11,12 @@ import { z } from 'zod';
11
11
  // Schema for update finasettings operation
12
12
  const updateFinaSettingsSchemaDefinition = z
13
13
  .object({
14
- enabled: z.boolean(),
14
+ enabled: z.boolean().default(false),
15
15
  operator_oib: z.string().min(11).max(11),
16
16
  operator_label: z.string(),
17
- u_sust_pdv: z.boolean(),
18
- numbering_sequence: z.enum(["N", "P"]),
17
+ u_sust_pdv: z.boolean().default(true),
18
+ numbering_sequence: z.enum(["N", "P"]).default("P"),
19
+ unified_numbering: z.union([z.boolean(), z.null()]),
19
20
  })
20
21
  .partial();
21
22
 
@@ -98,6 +98,8 @@ const createInvoiceSchemaDefinition = z.object({
98
98
  payment_terms: z.union([z.string(), z.null()]).optional(),
99
99
  tax_clause: z.union([z.string(), z.null()]).optional(),
100
100
  footer: z.union([z.string(), z.null()]).optional(),
101
+ signature: z.union([z.string(), z.null()]).optional(),
102
+ reference: z.union([z.string(), z.null()]).optional(),
101
103
  currency_code: z.string().max(3).optional(),
102
104
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
103
105
  date_due: z.union([z.string(), z.null()]).optional(),
@@ -23,6 +23,7 @@ const DocumentEntity = z
23
23
  tax_number: z.union([z.string(), z.null()]),
24
24
  tax_number_2: z.union([z.string(), z.null()]),
25
25
  company_number: z.union([z.string(), z.null()]),
26
+ is_end_consumer: z.union([z.boolean(), z.null()]),
26
27
  bank_account: z.union([
27
28
  z
28
29
  .object({
@@ -62,18 +63,17 @@ const CreateDocumentCustomer = DocumentEntity.and(
62
63
  const CreateFinaInvoiceData = z.union([
63
64
  z
64
65
  .object({
65
- premise_id: z
66
+ business_premise_name: z
66
67
  .string()
67
68
  .min(1)
68
69
  .max(20)
69
70
  .regex(/^[0-9a-zA-Z]{1,20}$/),
70
- device_id: z
71
+ electronic_device_name: z
71
72
  .string()
72
73
  .min(1)
73
74
  .max(20)
74
75
  .regex(/^\d{1,20}$/),
75
76
  operator_oib: z.string().min(11).max(11),
76
- is_end_consumer: z.boolean(),
77
77
  payment_type: z.enum([
78
78
  "cash",
79
79
  "card",
@@ -103,8 +103,11 @@ const PartialAdvanceInvoicePreview = z.object({
103
103
  customer: CreateDocumentCustomer.optional(),
104
104
  note: z.union([z.string(), z.null()]).optional(),
105
105
  tax_clause: z.union([z.string(), z.null()]).optional(),
106
+ footer: z.union([z.string(), z.null()]).optional(),
107
+ signature: z.union([z.string(), z.null()]).optional(),
106
108
  currency_code: z.string().max(3).optional(),
107
109
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
110
+ reference: z.union([z.string(), z.null()]).optional(),
108
111
  date_due: z.union([z.string(), z.null()]).optional(),
109
112
  date_service: z.union([z.string(), z.null()]).optional(),
110
113
  date_service_to: z.union([z.string(), z.null()]).optional(),
@@ -139,10 +142,10 @@ const PartialAdvanceInvoicePreview = z.object({
139
142
  const DocumentItemTax = z
140
143
  .object({
141
144
  rate: z.number(),
142
- tax_id: z.string(),
143
- classification: z.string(),
144
- reverse_charge: z.boolean(),
145
- amount: z.number(),
145
+ tax_id: z.union([z.string(), z.null()]),
146
+ classification: z.union([z.string(), z.null()]),
147
+ reverse_charge: z.union([z.boolean(), z.null()]),
148
+ amount: z.union([z.number(), z.null()]),
146
149
  })
147
150
  .partial();
148
151
 
@@ -157,16 +160,16 @@ const LineDiscount = z.object({
157
160
  // Dependency schema for renderadvanceinvoicepreview_body
158
161
  const CreateDocumentItem = z
159
162
  .object({
160
- type: z.literal("separator"),
163
+ type: z.union([z.literal("separator"), z.null()]),
161
164
  name: z.string().min(1),
162
165
  description: z.union([z.string(), z.null()]),
163
166
  price: z.number(),
164
- gross_price: z.number(),
167
+ gross_price: z.union([z.number(), z.null()]),
165
168
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
166
169
  unit: z.union([z.string(), z.null()]),
167
170
  taxes: z.array(DocumentItemTax),
168
171
  discounts: z.array(LineDiscount).max(5),
169
- item_id: z.string(),
172
+ item_id: z.union([z.string(), z.null()]),
170
173
  metadata: z.union([z.record(z.string(), z.any()), z.null()]),
171
174
  save_item: z.boolean().default(true),
172
175
  })
@@ -185,8 +188,11 @@ const CompleteAdvanceInvoicePreview = z.object({
185
188
  customer: CreateDocumentCustomer.optional(),
186
189
  note: z.union([z.string(), z.null()]).optional(),
187
190
  tax_clause: z.union([z.string(), z.null()]).optional(),
191
+ footer: z.union([z.string(), z.null()]).optional(),
192
+ signature: z.union([z.string(), z.null()]).optional(),
188
193
  currency_code: z.string().max(3).optional(),
189
194
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
195
+ reference: z.union([z.string(), z.null()]).optional(),
190
196
  date_due: z.union([z.string(), z.null()]).optional(),
191
197
  date_service: z.union([z.string(), z.null()]).optional(),
192
198
  date_service_to: z.union([z.string(), z.null()]).optional(),
@@ -23,6 +23,7 @@ const DocumentEntity = z
23
23
  tax_number: z.union([z.string(), z.null()]),
24
24
  tax_number_2: z.union([z.string(), z.null()]),
25
25
  company_number: z.union([z.string(), z.null()]),
26
+ is_end_consumer: z.union([z.boolean(), z.null()]),
26
27
  bank_account: z.union([
27
28
  z
28
29
  .object({
@@ -62,18 +63,17 @@ const CreateDocumentCustomer = DocumentEntity.and(
62
63
  const CreateFinaInvoiceData = z.union([
63
64
  z
64
65
  .object({
65
- premise_id: z
66
+ business_premise_name: z
66
67
  .string()
67
68
  .min(1)
68
69
  .max(20)
69
70
  .regex(/^[0-9a-zA-Z]{1,20}$/),
70
- device_id: z
71
+ electronic_device_name: z
71
72
  .string()
72
73
  .min(1)
73
74
  .max(20)
74
75
  .regex(/^\d{1,20}$/),
75
76
  operator_oib: z.string().min(11).max(11),
76
- is_end_consumer: z.boolean(),
77
77
  payment_type: z.enum([
78
78
  "cash",
79
79
  "card",
@@ -104,8 +104,11 @@ const PartialCreditNotePreview = z.object({
104
104
  note: z.union([z.string(), z.null()]).optional(),
105
105
  payment_terms: z.union([z.string(), z.null()]).optional(),
106
106
  tax_clause: z.union([z.string(), z.null()]).optional(),
107
+ footer: z.union([z.string(), z.null()]).optional(),
108
+ signature: z.union([z.string(), z.null()]).optional(),
107
109
  currency_code: z.string().max(3).optional(),
108
110
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
111
+ reference: z.union([z.string(), z.null()]).optional(),
109
112
  date_due: z.union([z.string(), z.null()]).optional(),
110
113
  date_service: z.union([z.string(), z.null()]).optional(),
111
114
  date_service_to: z.union([z.string(), z.null()]).optional(),
@@ -140,10 +143,10 @@ const PartialCreditNotePreview = z.object({
140
143
  const DocumentItemTax = z
141
144
  .object({
142
145
  rate: z.number(),
143
- tax_id: z.string(),
144
- classification: z.string(),
145
- reverse_charge: z.boolean(),
146
- amount: z.number(),
146
+ tax_id: z.union([z.string(), z.null()]),
147
+ classification: z.union([z.string(), z.null()]),
148
+ reverse_charge: z.union([z.boolean(), z.null()]),
149
+ amount: z.union([z.number(), z.null()]),
147
150
  })
148
151
  .partial();
149
152
 
@@ -158,16 +161,16 @@ const LineDiscount = z.object({
158
161
  // Dependency schema for rendercreditnotepreview_body
159
162
  const CreateDocumentItem = z
160
163
  .object({
161
- type: z.literal("separator"),
164
+ type: z.union([z.literal("separator"), z.null()]),
162
165
  name: z.string().min(1),
163
166
  description: z.union([z.string(), z.null()]),
164
167
  price: z.number(),
165
- gross_price: z.number(),
168
+ gross_price: z.union([z.number(), z.null()]),
166
169
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
167
170
  unit: z.union([z.string(), z.null()]),
168
171
  taxes: z.array(DocumentItemTax),
169
172
  discounts: z.array(LineDiscount).max(5),
170
- item_id: z.string(),
173
+ item_id: z.union([z.string(), z.null()]),
171
174
  metadata: z.union([z.record(z.string(), z.any()), z.null()]),
172
175
  save_item: z.boolean().default(true),
173
176
  })
@@ -187,8 +190,11 @@ const CompleteCreditNotePreview = z.object({
187
190
  note: z.union([z.string(), z.null()]).optional(),
188
191
  payment_terms: z.union([z.string(), z.null()]).optional(),
189
192
  tax_clause: z.union([z.string(), z.null()]).optional(),
193
+ footer: z.union([z.string(), z.null()]).optional(),
194
+ signature: z.union([z.string(), z.null()]).optional(),
190
195
  currency_code: z.string().max(3).optional(),
191
196
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
197
+ reference: z.union([z.string(), z.null()]).optional(),
192
198
  date_due: z.union([z.string(), z.null()]).optional(),
193
199
  date_service: z.union([z.string(), z.null()]).optional(),
194
200
  date_service_to: z.union([z.string(), z.null()]).optional(),
@@ -23,6 +23,7 @@ const DocumentEntity = z
23
23
  tax_number: z.union([z.string(), z.null()]),
24
24
  tax_number_2: z.union([z.string(), z.null()]),
25
25
  company_number: z.union([z.string(), z.null()]),
26
+ is_end_consumer: z.union([z.boolean(), z.null()]),
26
27
  bank_account: z.union([
27
28
  z
28
29
  .object({
@@ -71,8 +72,11 @@ const PartialDeliveryNotePreview = z.object({
71
72
  note: z.union([z.string(), z.null()]).optional(),
72
73
  payment_terms: z.union([z.string(), z.null()]).optional(),
73
74
  tax_clause: z.union([z.string(), z.null()]).optional(),
75
+ footer: z.union([z.string(), z.null()]).optional(),
76
+ signature: z.union([z.string(), z.null()]).optional(),
74
77
  currency_code: z.string().max(3).optional(),
75
78
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
79
+ reference: z.union([z.string(), z.null()]).optional(),
76
80
  hide_prices: z.boolean().optional(),
77
81
  date_due: z.union([z.string(), z.null()]).optional(),
78
82
  date_service: z.union([z.string(), z.null()]).optional(),
@@ -108,10 +112,10 @@ const PartialDeliveryNotePreview = z.object({
108
112
  const DocumentItemTax = z
109
113
  .object({
110
114
  rate: z.number(),
111
- tax_id: z.string(),
112
- classification: z.string(),
113
- reverse_charge: z.boolean(),
114
- amount: z.number(),
115
+ tax_id: z.union([z.string(), z.null()]),
116
+ classification: z.union([z.string(), z.null()]),
117
+ reverse_charge: z.union([z.boolean(), z.null()]),
118
+ amount: z.union([z.number(), z.null()]),
115
119
  })
116
120
  .partial();
117
121
 
@@ -126,16 +130,16 @@ const LineDiscount = z.object({
126
130
  // Dependency schema for renderdeliverynotepreview_body
127
131
  const CreateDocumentItem = z
128
132
  .object({
129
- type: z.literal("separator"),
133
+ type: z.union([z.literal("separator"), z.null()]),
130
134
  name: z.string().min(1),
131
135
  description: z.union([z.string(), z.null()]),
132
136
  price: z.number(),
133
- gross_price: z.number(),
137
+ gross_price: z.union([z.number(), z.null()]),
134
138
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
135
139
  unit: z.union([z.string(), z.null()]),
136
140
  taxes: z.array(DocumentItemTax),
137
141
  discounts: z.array(LineDiscount).max(5),
138
- item_id: z.string(),
142
+ item_id: z.union([z.string(), z.null()]),
139
143
  metadata: z.union([z.record(z.string(), z.any()), z.null()]),
140
144
  save_item: z.boolean().default(true),
141
145
  })
@@ -155,8 +159,11 @@ const CompleteDeliveryNotePreview = z.object({
155
159
  note: z.union([z.string(), z.null()]).optional(),
156
160
  payment_terms: z.union([z.string(), z.null()]).optional(),
157
161
  tax_clause: z.union([z.string(), z.null()]).optional(),
162
+ footer: z.union([z.string(), z.null()]).optional(),
163
+ signature: z.union([z.string(), z.null()]).optional(),
158
164
  currency_code: z.string().max(3).optional(),
159
165
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
166
+ reference: z.union([z.string(), z.null()]).optional(),
160
167
  hide_prices: z.boolean().optional(),
161
168
  date_due: z.union([z.string(), z.null()]).optional(),
162
169
  date_service: z.union([z.string(), z.null()]).optional(),