@spaceinvoices/react-ui 0.4.1 → 0.4.3
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/cli/dist/index.js +1 -1
- package/package.json +1 -1
- package/registry.json +25 -0
- package/src/components/advance-invoices/advance-invoices.hooks.ts +32 -2
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +109 -4
- package/src/components/advance-invoices/create/locales/de.ts +2 -0
- package/src/components/advance-invoices/create/locales/es.ts +2 -0
- package/src/components/advance-invoices/create/locales/fr.ts +2 -0
- package/src/components/advance-invoices/create/locales/hr.ts +2 -0
- package/src/components/advance-invoices/create/locales/it.ts +2 -0
- package/src/components/advance-invoices/create/locales/nl.ts +2 -0
- package/src/components/advance-invoices/create/locales/pl.ts +2 -0
- package/src/components/advance-invoices/create/locales/pt.ts +2 -0
- package/src/components/advance-invoices/create/locales/sl.ts +2 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +17 -0
- package/src/components/advance-invoices/list/list-row-actions.tsx +3 -6
- package/src/components/advance-invoices/list/list-table.tsx +105 -2
- package/src/components/advance-invoices/list/locales/de.ts +4 -0
- package/src/components/advance-invoices/list/locales/en.ts +4 -0
- package/src/components/advance-invoices/list/locales/es.ts +4 -0
- package/src/components/advance-invoices/list/locales/fr.ts +4 -0
- package/src/components/advance-invoices/list/locales/hr.ts +4 -0
- package/src/components/advance-invoices/list/locales/it.ts +4 -0
- package/src/components/advance-invoices/list/locales/nl.ts +4 -0
- package/src/components/advance-invoices/list/locales/pl.ts +4 -0
- package/src/components/advance-invoices/list/locales/pt.ts +4 -0
- package/src/components/advance-invoices/list/locales/sl.ts +4 -0
- package/src/components/credit-notes/create/create-credit-note-form.tsx +177 -6
- package/src/components/credit-notes/create/locales/de.ts +8 -0
- package/src/components/credit-notes/create/locales/es.ts +8 -0
- package/src/components/credit-notes/create/locales/fr.ts +7 -0
- package/src/components/credit-notes/create/locales/hr.ts +7 -0
- package/src/components/credit-notes/create/locales/it.ts +9 -0
- package/src/components/credit-notes/create/locales/nl.ts +7 -0
- package/src/components/credit-notes/create/locales/pl.ts +7 -0
- package/src/components/credit-notes/create/locales/pt.ts +7 -0
- package/src/components/credit-notes/create/locales/sl.ts +7 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +30 -0
- package/src/components/credit-notes/list/list-row-actions.tsx +3 -6
- package/src/components/credit-notes/list/list-table.tsx +79 -8
- package/src/components/credit-notes/list/locales/de.ts +4 -1
- package/src/components/credit-notes/list/locales/en.ts +5 -0
- package/src/components/credit-notes/list/locales/es.ts +4 -1
- package/src/components/credit-notes/list/locales/fr.ts +4 -1
- package/src/components/credit-notes/list/locales/hr.ts +4 -1
- package/src/components/credit-notes/list/locales/it.ts +4 -1
- package/src/components/credit-notes/list/locales/nl.ts +4 -1
- package/src/components/credit-notes/list/locales/pl.ts +4 -1
- package/src/components/credit-notes/list/locales/pt.ts +4 -1
- package/src/components/credit-notes/list/locales/sl.ts +4 -1
- package/src/components/customers/create-customer-form/create-customer-form.tsx +0 -1
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +2 -2
- package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +3 -3
- package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +1 -1
- package/src/components/dashboard/shared/use-revenue-data.ts +4 -4
- package/src/components/dashboard/shared/use-stats-counts.ts +4 -4
- package/src/components/dashboard/shared/use-stats-query.ts +1 -1
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +2 -2
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +1 -1
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +332 -0
- package/src/components/delivery-notes/create/locales/de.ts +50 -0
- package/src/components/delivery-notes/create/locales/es.ts +49 -0
- package/src/components/delivery-notes/create/locales/fr.ts +50 -0
- package/src/components/delivery-notes/create/locales/hr.ts +49 -0
- package/src/components/delivery-notes/create/locales/it.ts +49 -0
- package/src/components/delivery-notes/create/locales/nl.ts +50 -0
- package/src/components/delivery-notes/create/locales/pl.ts +49 -0
- package/src/components/delivery-notes/create/locales/pt.ts +50 -0
- package/src/components/delivery-notes/create/locales/sl.ts +49 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +38 -0
- package/src/components/delivery-notes/create/use-delivery-note-customer-form.ts +1 -0
- package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -0
- package/src/components/delivery-notes/list/index.ts +3 -0
- package/src/components/delivery-notes/list/list-row-actions.tsx +103 -0
- package/src/components/delivery-notes/list/list-table.tsx +214 -0
- package/src/components/delivery-notes/list/locales/de.ts +9 -0
- package/src/components/delivery-notes/list/locales/en.ts +11 -0
- package/src/components/delivery-notes/list/locales/es.ts +9 -0
- package/src/components/delivery-notes/list/locales/fr.ts +9 -0
- package/src/components/delivery-notes/list/locales/hr.ts +9 -0
- package/src/components/delivery-notes/list/locales/it.ts +9 -0
- package/src/components/delivery-notes/list/locales/nl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pt.ts +9 -0
- package/src/components/delivery-notes/list/locales/sl.ts +9 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +63 -0
- package/src/components/documents/create/document-details-section.tsx +103 -33
- package/src/components/documents/create/live-preview.tsx +37 -10
- package/src/components/documents/create/mark-as-paid-section.tsx +11 -2
- package/src/components/documents/create/prepare-document-submission.ts +1 -1
- package/src/components/documents/documents.hooks.ts +2 -1
- package/src/components/documents/shared/document-preview-display.tsx +12 -5
- package/src/components/documents/types.ts +10 -1
- package/src/components/documents/view/document-actions-bar.tsx +30 -0
- package/src/components/documents/view/document-details-card.tsx +3 -3
- package/src/components/documents/view/document-payments-list.tsx +3 -3
- package/src/components/documents/view/document-relations-list.tsx +105 -0
- package/src/components/documents/view/locales/de.ts +26 -0
- package/src/components/documents/view/locales/es.ts +26 -0
- package/src/components/documents/view/locales/fr.ts +26 -0
- package/src/components/documents/view/locales/hr.ts +26 -0
- package/src/components/documents/view/locales/it.ts +26 -0
- package/src/components/documents/view/locales/nl.ts +26 -0
- package/src/components/documents/view/locales/pl.ts +26 -0
- package/src/components/documents/view/locales/pt.ts +26 -0
- package/src/components/documents/view/locales/sl.ts +26 -0
- package/src/components/documents/view/use-document-download.ts +5 -3
- package/src/components/entities/create-entity-form.tsx +1 -1
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +2 -3
- package/src/components/entities/entity-settings-form/locales/es.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +2 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +2 -0
- package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +109 -0
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +377 -35
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +106 -20
- package/src/components/entities/fina-settings-form/index.ts +1 -0
- package/src/components/entities/fina-settings-form/locales/de.ts +54 -34
- package/src/components/entities/fina-settings-form/locales/en.ts +51 -34
- package/src/components/entities/fina-settings-form/locales/es.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/fr.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/hr.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/it.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/nl.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/pl.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/pt.ts +50 -34
- package/src/components/entities/fina-settings-form/locales/sl.ts +50 -34
- package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +18 -0
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +64 -89
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +51 -323
- package/src/components/entities/furs-settings-form/furs-operator-required-dialog.tsx +106 -0
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +33 -10
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +12 -11
- package/src/components/entities/furs-settings-form/index.ts +1 -0
- package/src/components/entities/furs-settings-form/locales/de.ts +27 -3
- package/src/components/entities/furs-settings-form/locales/en.ts +17 -3
- package/src/components/entities/furs-settings-form/locales/es.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/fr.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/hr.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/it.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/nl.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/pl.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/pt.ts +26 -3
- package/src/components/entities/furs-settings-form/locales/sl.ts +16 -3
- package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +22 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +26 -5
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +14 -2
- package/src/components/entities/settings/tax-rules-settings-form.tsx +4 -4
- package/src/components/estimates/list/list-row-actions.tsx +3 -7
- package/src/components/estimates/list/list-table.tsx +35 -2
- package/src/components/estimates/list/locales/de.ts +3 -0
- package/src/components/estimates/list/locales/en.ts +3 -0
- package/src/components/estimates/list/locales/es.ts +3 -0
- package/src/components/estimates/list/locales/fr.ts +3 -0
- package/src/components/estimates/list/locales/hr.ts +3 -0
- package/src/components/estimates/list/locales/it.ts +3 -0
- package/src/components/estimates/list/locales/nl.ts +3 -0
- package/src/components/estimates/list/locales/pl.ts +3 -0
- package/src/components/estimates/list/locales/pt.ts +3 -0
- package/src/components/estimates/list/locales/sl.ts +3 -0
- package/src/components/export/document-export-form.tsx +34 -34
- package/src/components/invoices/create/create-invoice-form.tsx +107 -5
- package/src/components/invoices/create/prepare-invoice-submission.ts +17 -0
- package/src/components/invoices/invoices-furs.hooks.ts +24 -9
- package/src/components/invoices/invoices.hooks.ts +32 -2
- package/src/components/invoices/list/list-row-actions.tsx +26 -11
- package/src/components/invoices/list/list-table.tsx +121 -5
- package/src/components/invoices/list/locales/de.ts +5 -0
- package/src/components/invoices/list/locales/en.ts +5 -0
- package/src/components/invoices/list/locales/es.ts +5 -0
- package/src/components/invoices/list/locales/fr.ts +5 -0
- package/src/components/invoices/list/locales/hr.ts +5 -0
- package/src/components/invoices/list/locales/it.ts +5 -0
- package/src/components/invoices/list/locales/nl.ts +5 -0
- package/src/components/invoices/list/locales/pl.ts +5 -0
- package/src/components/invoices/list/locales/pt.ts +5 -0
- package/src/components/invoices/list/locales/sl.ts +5 -0
- package/src/components/invoices/view/fiscalization-status-card.tsx +4 -1
- package/src/components/items/item-list-table/item-list-row-actions.tsx +5 -8
- package/src/components/items/item-list-table/item-list-row.tsx +5 -3
- package/src/components/items/item-list-table/item-list-table.tsx +5 -1
- package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +418 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/de.ts +45 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/es.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fr.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/it.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nl.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pl.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pt.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +44 -0
- package/src/components/recurring-invoices/index.ts +3 -0
- package/src/components/recurring-invoices/list/index.ts +2 -0
- package/src/components/recurring-invoices/list/list-row-actions.tsx +139 -0
- package/src/components/recurring-invoices/list/list-table.tsx +179 -0
- package/src/components/recurring-invoices/list/locales/de.ts +27 -0
- package/src/components/recurring-invoices/list/locales/en.ts +5 -0
- package/src/components/recurring-invoices/list/locales/es.ts +27 -0
- package/src/components/recurring-invoices/list/locales/fr.ts +27 -0
- package/src/components/recurring-invoices/list/locales/hr.ts +27 -0
- package/src/components/recurring-invoices/list/locales/it.ts +27 -0
- package/src/components/recurring-invoices/list/locales/nl.ts +27 -0
- package/src/components/recurring-invoices/list/locales/pl.ts +27 -0
- package/src/components/recurring-invoices/list/locales/pt.ts +27 -0
- package/src/components/recurring-invoices/list/locales/sl.ts +27 -0
- package/src/components/recurring-invoices/recurring-invoices.hooks.ts +28 -0
- package/src/components/table/data-table.tsx +122 -5
- package/src/components/table/selection-toolbar.tsx +36 -0
- package/src/components/tax-reports/kir-export-form.tsx +75 -55
- package/src/components/taxes/tax-list-table/tax-list-row-actions.tsx +3 -6
- package/src/components/taxes/tax-list-table/tax-list-row.tsx +3 -2
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +5 -1
- package/src/components/ui/checkbox.tsx +5 -5
- package/src/generate-schemas.ts +45 -18
- package/src/generated/schemas/authorizeshopify_body.ts +22 -0
- package/src/generated/schemas/creditnote.ts +0 -2
- package/src/generated/schemas/deliverynote.ts +134 -0
- package/src/generated/schemas/entity.ts +5 -1
- package/src/generated/schemas/index.ts +42 -28
- package/src/generated/schemas/order.ts +129 -0
- package/src/generated/schemas/orderintegration.ts +51 -0
- package/src/generated/schemas/payment.ts +24 -2
- package/src/generated/schemas/recurringinvoice.ts +61 -0
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +108 -140
- package/src/generated/schemas/rendercreditnotepreview_body.ts +109 -141
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +185 -0
- package/src/generated/schemas/renderestimatepreview_body.ts +79 -82
- package/src/generated/schemas/renderinvoicepreview_body.ts +109 -141
- package/src/generated/schemas/startpdfexport_body.ts +18 -2
- package/src/generated/schemas/userfinasettings.ts +19 -0
- package/src/generated/schemas/webhook.ts +54 -0
- package/src/hooks/use-duplicate-document.ts +11 -3
- package/src/hooks/use-next-document-number.ts +2 -2
- package/src/lib/furs-error-utils.ts +36 -0
- package/src/lib/schemas/advance-invoice.ts +3 -3
- package/src/lib/schemas/credit-note.ts +3 -3
- package/src/lib/schemas/estimate.ts +3 -3
- package/src/lib/schemas/invoice.ts +3 -3
- package/src/providers/sdk-provider.tsx +5 -7
- package/src/providers/white-label-provider.tsx +3 -0
|
@@ -9,12 +9,28 @@ import { z } from 'zod';
|
|
|
9
9
|
// Schemas for startpdfexport_body endpoints
|
|
10
10
|
|
|
11
11
|
// Dependency schema for startpdfexport_body
|
|
12
|
-
const
|
|
12
|
+
const PdfExportByDocumentIds = z
|
|
13
13
|
.object({
|
|
14
|
-
type: z.enum(["invoice", "estimate", "credit_note"]),
|
|
14
|
+
type: z.enum(["invoice", "estimate", "credit_note", "advance_invoice"]),
|
|
15
|
+
document_ids: z.array(z.string()).min(1),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// Dependency schema for startpdfexport_body
|
|
21
|
+
const PdfExportByDateRange = z
|
|
22
|
+
.object({
|
|
23
|
+
type: z.enum(["invoice", "estimate", "credit_note", "advance_invoice"]),
|
|
15
24
|
date_from: z.string().optional(),
|
|
16
25
|
date_to: z.string().optional(),
|
|
17
26
|
})
|
|
18
27
|
.passthrough();
|
|
19
28
|
|
|
20
29
|
|
|
30
|
+
// Dependency schema for startpdfexport_body
|
|
31
|
+
const startPdfExport_Body = z.union([
|
|
32
|
+
PdfExportByDocumentIds,
|
|
33
|
+
PdfExportByDateRange,
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for userfinasettings endpoints
|
|
10
|
+
|
|
11
|
+
// Schema for update userfinasettings operation
|
|
12
|
+
const updateUserFinaSettingsSchemaDefinition = z
|
|
13
|
+
.object({ operator_oib: z.string(), operator_label: z.string() })
|
|
14
|
+
.partial();
|
|
15
|
+
|
|
16
|
+
// Type for update userfinasettings operation
|
|
17
|
+
export type UpdateUserFinaSettingsSchema = z.infer<typeof updateUserFinaSettingsSchemaDefinition>;
|
|
18
|
+
|
|
19
|
+
export const updateUserFinaSettingsSchema = updateUserFinaSettingsSchemaDefinition;
|
|
@@ -43,6 +43,7 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
43
43
|
"estimate.restored",
|
|
44
44
|
"credit_note.created",
|
|
45
45
|
"credit_note.issued",
|
|
46
|
+
"credit_note.voided",
|
|
46
47
|
"credit_note.deleted",
|
|
47
48
|
"credit_note.restored",
|
|
48
49
|
"advance_invoice.created",
|
|
@@ -59,9 +60,35 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
59
60
|
"tax.deleted",
|
|
60
61
|
"tax.restored",
|
|
61
62
|
"tax.permanently_deleted",
|
|
63
|
+
"recurring_invoice.created",
|
|
64
|
+
"recurring_invoice.updated",
|
|
65
|
+
"recurring_invoice.deleted",
|
|
66
|
+
"recurring_invoice.restored",
|
|
67
|
+
"recurring_invoice.permanently_deleted",
|
|
68
|
+
"recurring_invoice.paused",
|
|
69
|
+
"recurring_invoice.resumed",
|
|
70
|
+
"recurring_invoice.invoice_generated",
|
|
71
|
+
"recurring_invoice.generation_failed",
|
|
72
|
+
"recurring_invoice.completed",
|
|
62
73
|
"stripe_app.connected",
|
|
63
74
|
"stripe_app.disconnected",
|
|
64
75
|
"stripe_app.settings_updated",
|
|
76
|
+
"order.created",
|
|
77
|
+
"order.updated",
|
|
78
|
+
"order.deleted",
|
|
79
|
+
"order.restored",
|
|
80
|
+
"order.permanently_deleted",
|
|
81
|
+
"order.processed",
|
|
82
|
+
"order.cancelled",
|
|
83
|
+
"order.failed",
|
|
84
|
+
"order_integration.created",
|
|
85
|
+
"order_integration.updated",
|
|
86
|
+
"order_integration.deleted",
|
|
87
|
+
"delivery_note.created",
|
|
88
|
+
"delivery_note.sent",
|
|
89
|
+
"delivery_note.cancelled",
|
|
90
|
+
"delivery_note.deleted",
|
|
91
|
+
"delivery_note.restored",
|
|
65
92
|
])
|
|
66
93
|
)
|
|
67
94
|
.min(1),
|
|
@@ -109,6 +136,7 @@ const updateWebhookSchemaDefinition = z
|
|
|
109
136
|
"estimate.restored",
|
|
110
137
|
"credit_note.created",
|
|
111
138
|
"credit_note.issued",
|
|
139
|
+
"credit_note.voided",
|
|
112
140
|
"credit_note.deleted",
|
|
113
141
|
"credit_note.restored",
|
|
114
142
|
"advance_invoice.created",
|
|
@@ -125,9 +153,35 @@ const updateWebhookSchemaDefinition = z
|
|
|
125
153
|
"tax.deleted",
|
|
126
154
|
"tax.restored",
|
|
127
155
|
"tax.permanently_deleted",
|
|
156
|
+
"recurring_invoice.created",
|
|
157
|
+
"recurring_invoice.updated",
|
|
158
|
+
"recurring_invoice.deleted",
|
|
159
|
+
"recurring_invoice.restored",
|
|
160
|
+
"recurring_invoice.permanently_deleted",
|
|
161
|
+
"recurring_invoice.paused",
|
|
162
|
+
"recurring_invoice.resumed",
|
|
163
|
+
"recurring_invoice.invoice_generated",
|
|
164
|
+
"recurring_invoice.generation_failed",
|
|
165
|
+
"recurring_invoice.completed",
|
|
128
166
|
"stripe_app.connected",
|
|
129
167
|
"stripe_app.disconnected",
|
|
130
168
|
"stripe_app.settings_updated",
|
|
169
|
+
"order.created",
|
|
170
|
+
"order.updated",
|
|
171
|
+
"order.deleted",
|
|
172
|
+
"order.restored",
|
|
173
|
+
"order.permanently_deleted",
|
|
174
|
+
"order.processed",
|
|
175
|
+
"order.cancelled",
|
|
176
|
+
"order.failed",
|
|
177
|
+
"order_integration.created",
|
|
178
|
+
"order_integration.updated",
|
|
179
|
+
"order_integration.deleted",
|
|
180
|
+
"delivery_note.created",
|
|
181
|
+
"delivery_note.sent",
|
|
182
|
+
"delivery_note.cancelled",
|
|
183
|
+
"delivery_note.deleted",
|
|
184
|
+
"delivery_note.restored",
|
|
131
185
|
])
|
|
132
186
|
)
|
|
133
187
|
.min(1),
|
|
@@ -2,9 +2,11 @@ import type {
|
|
|
2
2
|
AdvanceInvoice,
|
|
3
3
|
CreateAdvanceInvoiceRequest,
|
|
4
4
|
CreateCreditNoteRequest,
|
|
5
|
+
CreateDeliveryNoteRequest,
|
|
5
6
|
CreateEstimateRequest,
|
|
6
7
|
CreateInvoiceRequest,
|
|
7
8
|
CreditNote,
|
|
9
|
+
DeliveryNote,
|
|
8
10
|
Estimate,
|
|
9
11
|
Invoice,
|
|
10
12
|
} from "@spaceinvoices/js-sdk";
|
|
@@ -13,13 +15,14 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
13
15
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
14
16
|
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
15
17
|
|
|
16
|
-
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice";
|
|
17
|
-
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice;
|
|
18
|
+
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
19
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
18
20
|
type CreateRequest =
|
|
19
21
|
| CreateInvoiceRequest
|
|
20
22
|
| CreateEstimateRequest
|
|
21
23
|
| CreateCreditNoteRequest
|
|
22
|
-
| CreateAdvanceInvoiceRequest
|
|
24
|
+
| CreateAdvanceInvoiceRequest
|
|
25
|
+
| CreateDeliveryNoteRequest;
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* Get document type from ID prefix
|
|
@@ -29,6 +32,7 @@ export function getDocumentTypeFromId(id: string): DocumentType | null {
|
|
|
29
32
|
if (id.startsWith("est_")) return "estimate";
|
|
30
33
|
if (id.startsWith("cn_")) return "credit_note";
|
|
31
34
|
if (id.startsWith("adv_")) return "advance_invoice";
|
|
35
|
+
if (id.startsWith("dn_")) return "delivery_note";
|
|
32
36
|
return null;
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -45,6 +49,8 @@ export function getAllowedDuplicateTargets(sourceType: DocumentType): DocumentTy
|
|
|
45
49
|
return ["credit_note"];
|
|
46
50
|
case "advance_invoice":
|
|
47
51
|
return ["advance_invoice", "invoice"];
|
|
52
|
+
case "delivery_note":
|
|
53
|
+
return ["delivery_note"];
|
|
48
54
|
default:
|
|
49
55
|
return [];
|
|
50
56
|
}
|
|
@@ -170,6 +176,8 @@ export function useDuplicateDocument({
|
|
|
170
176
|
source = await sdk.estimates.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
171
177
|
} else if (sourceType === "advance_invoice") {
|
|
172
178
|
source = await sdk.advanceInvoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
179
|
+
} else if (sourceType === "delivery_note") {
|
|
180
|
+
source = await sdk.deliveryNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
173
181
|
} else {
|
|
174
182
|
// Credit note
|
|
175
183
|
source = await sdk.creditNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
@@ -4,7 +4,7 @@ import { useSDK } from "@/ui/providers/sdk-provider";
|
|
|
4
4
|
|
|
5
5
|
export const NEXT_DOCUMENT_NUMBER_CACHE_KEY = "next-document-number";
|
|
6
6
|
|
|
7
|
-
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice";
|
|
7
|
+
export type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
8
8
|
|
|
9
9
|
/** Response type for next document number preview */
|
|
10
10
|
export type NextDocumentNumberResponse = {
|
|
@@ -43,7 +43,7 @@ export function useNextDocumentNumber(
|
|
|
43
43
|
queryFn: async () => {
|
|
44
44
|
const response = await sdk.documents.getNextNumber(
|
|
45
45
|
{
|
|
46
|
-
type,
|
|
46
|
+
type: type as "invoice",
|
|
47
47
|
business_premise_name: options?.businessPremiseName,
|
|
48
48
|
electronic_device_name: options?.electronicDeviceName,
|
|
49
49
|
},
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect if an error is a FURS operator settings validation error (422).
|
|
3
|
+
* The API returns a ZodError with paths like ["furs", "operator_tax_number"]
|
|
4
|
+
* when operator settings are missing during document creation.
|
|
5
|
+
*/
|
|
6
|
+
export function isFursOperatorError(error: unknown): boolean {
|
|
7
|
+
const data = (error as any)?.data;
|
|
8
|
+
if (!data?.cause?.issues) return false;
|
|
9
|
+
return data.cause.issues.some(
|
|
10
|
+
(issue: any) =>
|
|
11
|
+
issue.path?.[0] === "furs" && (issue.path?.[1] === "operator_tax_number" || issue.path?.[1] === "operator_label"),
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Detect if an error is a FINA operator settings error.
|
|
17
|
+
* CIS requires OibOper (minOccurs="1" in FiskalizacijaSchema.xsd).
|
|
18
|
+
* Checks for Zod validation errors with paths like ["fina", "operator_oib"]
|
|
19
|
+
* or CIS XML validation errors mentioning OibOper.
|
|
20
|
+
*/
|
|
21
|
+
export function isFinaOperatorError(error: unknown): boolean {
|
|
22
|
+
const data = (error as any)?.data;
|
|
23
|
+
// Check for Zod-style validation error
|
|
24
|
+
if (data?.cause?.issues) {
|
|
25
|
+
return data.cause.issues.some(
|
|
26
|
+
(issue: any) =>
|
|
27
|
+
issue.path?.[0] === "fina" && (issue.path?.[1] === "operator_oib" || issue.path?.[1] === "operator_label"),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
// Check for CIS error message mentioning OibOper
|
|
31
|
+
const message = data?.message || (error as any)?.message || "";
|
|
32
|
+
if (typeof message === "string" && message.includes("OibOper")) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Requires: ./shared.ts
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { CreateAdvanceInvoice } from "@spaceinvoices/js-sdk";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { customerSchema, lineItemSchema, transformItemsForApi } from "./shared";
|
|
9
9
|
|
|
@@ -35,9 +35,9 @@ export const advanceInvoiceFormSchema = z.object({
|
|
|
35
35
|
export type AdvanceInvoiceFormValues = z.infer<typeof advanceInvoiceFormSchema>;
|
|
36
36
|
|
|
37
37
|
/** Convert form values to API request */
|
|
38
|
-
export function toCreateAdvanceInvoiceRequest(values: AdvanceInvoiceFormValues):
|
|
38
|
+
export function toCreateAdvanceInvoiceRequest(values: AdvanceInvoiceFormValues): CreateAdvanceInvoice {
|
|
39
39
|
return {
|
|
40
40
|
...values,
|
|
41
41
|
items: transformItemsForApi(values.items ?? []),
|
|
42
|
-
} as
|
|
42
|
+
} as CreateAdvanceInvoice;
|
|
43
43
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Requires: ./shared.ts
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { CreateCreditNote } from "@spaceinvoices/js-sdk";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { customerSchema, lineItemSchema, transformItemsForApi } from "./shared";
|
|
9
9
|
|
|
@@ -24,9 +24,9 @@ export const creditNoteFormSchema = z.object({
|
|
|
24
24
|
export type CreditNoteFormValues = z.infer<typeof creditNoteFormSchema>;
|
|
25
25
|
|
|
26
26
|
/** Convert form values to API request */
|
|
27
|
-
export function toCreateCreditNoteRequest(values: CreditNoteFormValues):
|
|
27
|
+
export function toCreateCreditNoteRequest(values: CreditNoteFormValues): CreateCreditNote {
|
|
28
28
|
return {
|
|
29
29
|
...values,
|
|
30
30
|
items: transformItemsForApi(values.items ?? []),
|
|
31
|
-
} as
|
|
31
|
+
} as CreateCreditNote;
|
|
32
32
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Requires: ./shared.ts
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { CreateEstimate } from "@spaceinvoices/js-sdk";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { customerSchema, lineItemSchema, transformItemsForApi } from "./shared";
|
|
9
9
|
|
|
@@ -23,9 +23,9 @@ export const estimateFormSchema = z.object({
|
|
|
23
23
|
export type EstimateFormValues = z.infer<typeof estimateFormSchema>;
|
|
24
24
|
|
|
25
25
|
/** Convert form values to API request */
|
|
26
|
-
export function toCreateEstimateRequest(values: EstimateFormValues):
|
|
26
|
+
export function toCreateEstimateRequest(values: EstimateFormValues): CreateEstimate {
|
|
27
27
|
return {
|
|
28
28
|
...values,
|
|
29
29
|
items: transformItemsForApi(values.items ?? []),
|
|
30
|
-
} as
|
|
30
|
+
} as CreateEstimate;
|
|
31
31
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Requires: ./shared.ts
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { CreateInvoice } from "@spaceinvoices/js-sdk";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { customerSchema, lineItemSchema, transformItemsForApi } from "./shared";
|
|
9
9
|
|
|
@@ -35,9 +35,9 @@ export const invoiceFormSchema = z.object({
|
|
|
35
35
|
export type InvoiceFormValues = z.infer<typeof invoiceFormSchema>;
|
|
36
36
|
|
|
37
37
|
/** Convert form values to API request */
|
|
38
|
-
export function toCreateInvoiceRequest(values: InvoiceFormValues):
|
|
38
|
+
export function toCreateInvoiceRequest(values: InvoiceFormValues): CreateInvoice {
|
|
39
39
|
return {
|
|
40
40
|
...values,
|
|
41
41
|
items: transformItemsForApi(values.items ?? []),
|
|
42
|
-
} as
|
|
42
|
+
} as CreateInvoice;
|
|
43
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SDK from "@spaceinvoices/js-sdk";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
4
4
|
|
|
5
5
|
import { AUTH_COOKIES } from "@/ui/lib/auth";
|
|
6
6
|
import { flushCookies, getCookie } from "@/ui/lib/browser-cookies";
|
|
@@ -59,7 +59,7 @@ export function SDKProvider({
|
|
|
59
59
|
/**
|
|
60
60
|
* Initialize the SDK with the current auth token
|
|
61
61
|
*/
|
|
62
|
-
const initializeSDK = async () => {
|
|
62
|
+
const initializeSDK = useCallback(async () => {
|
|
63
63
|
setIsLoading(true);
|
|
64
64
|
setError(null);
|
|
65
65
|
|
|
@@ -92,17 +92,15 @@ export function SDKProvider({
|
|
|
92
92
|
} finally {
|
|
93
93
|
setIsLoading(false);
|
|
94
94
|
}
|
|
95
|
-
};
|
|
95
|
+
}, [onUnauthorized]);
|
|
96
96
|
|
|
97
97
|
// Initialize SDK on component mount
|
|
98
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: initializeSDK is intentionally omitted - should only run once on mount
|
|
99
98
|
useEffect(() => {
|
|
100
99
|
initializeSDK();
|
|
101
|
-
}, []);
|
|
100
|
+
}, [initializeSDK]);
|
|
102
101
|
|
|
103
102
|
// IMPORTANT: useMemo must be called BEFORE any conditional returns
|
|
104
103
|
// to satisfy React's Rules of Hooks
|
|
105
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: initializeSDK is stable (doesn't change) and including it would cause unnecessary re-renders
|
|
106
104
|
const value = useMemo(
|
|
107
105
|
() => ({
|
|
108
106
|
sdk: sdk as SDK, // Will be non-null when children render (checked below)
|
|
@@ -111,7 +109,7 @@ export function SDKProvider({
|
|
|
111
109
|
error,
|
|
112
110
|
reinitialize: initializeSDK,
|
|
113
111
|
}),
|
|
114
|
-
[sdk, isInitialized, isLoading, error
|
|
112
|
+
[sdk, isInitialized, isLoading, error, initializeSDK],
|
|
115
113
|
);
|
|
116
114
|
|
|
117
115
|
// Render appropriate UI based on SDK state
|
|
@@ -5,6 +5,7 @@ export type WhiteLabelConfig = {
|
|
|
5
5
|
slug: string;
|
|
6
6
|
name: string;
|
|
7
7
|
hiddenFeatures: string[]; // Features hidden from UI (still available via API)
|
|
8
|
+
halAppId: string | null; // Hal app ID for chat widget (null = no Hal integration)
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
// Default config until API responds (Space Invoices = all features visible)
|
|
@@ -12,6 +13,7 @@ const DEFAULT_CONFIG: WhiteLabelConfig = {
|
|
|
12
13
|
slug: "space-invoices",
|
|
13
14
|
name: "Space Invoices",
|
|
14
15
|
hiddenFeatures: [],
|
|
16
|
+
halAppId: null,
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
type WhiteLabelContextType = WhiteLabelConfig & {
|
|
@@ -50,6 +52,7 @@ export function WhiteLabelProvider({ children, apiBaseUrl = "" }: WhiteLabelProv
|
|
|
50
52
|
slug: data.slug,
|
|
51
53
|
name: data.name,
|
|
52
54
|
hiddenFeatures: data.hidden_features,
|
|
55
|
+
halAppId: data.hal_app_id ?? null,
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
} catch {
|