@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
|
@@ -8,25 +8,6 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for renderadvanceinvoicepreview_body endpoints
|
|
10
10
|
|
|
11
|
-
// Dependency schema for renderadvanceinvoicepreview_body
|
|
12
|
-
const LineDiscount = z.object({
|
|
13
|
-
value: z.number().gte(0),
|
|
14
|
-
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Dependency schema for renderadvanceinvoicepreview_body
|
|
19
|
-
const DocumentItemTax = z
|
|
20
|
-
.object({
|
|
21
|
-
rate: z.number(),
|
|
22
|
-
tax_id: z.string(),
|
|
23
|
-
classification: z.string(),
|
|
24
|
-
reverse_charge: z.boolean(),
|
|
25
|
-
amount: z.number(),
|
|
26
|
-
})
|
|
27
|
-
.partial();
|
|
28
|
-
|
|
29
|
-
|
|
30
11
|
// Dependency schema for renderadvanceinvoicepreview_body
|
|
31
12
|
const DocumentEntity = z
|
|
32
13
|
.object({
|
|
@@ -66,90 +47,48 @@ const DocumentEntity = z
|
|
|
66
47
|
|
|
67
48
|
|
|
68
49
|
// Dependency schema for renderadvanceinvoicepreview_body
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
z.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
z.array(z.unknown()),
|
|
112
|
-
z.null(),
|
|
113
|
-
])
|
|
114
|
-
.optional(),
|
|
115
|
-
item_id: z.string().optional(),
|
|
116
|
-
})
|
|
117
|
-
)
|
|
118
|
-
.min(1),
|
|
119
|
-
fina: z
|
|
120
|
-
.union([
|
|
121
|
-
z
|
|
122
|
-
.object({
|
|
123
|
-
premise_id: z
|
|
124
|
-
.string()
|
|
125
|
-
.min(1)
|
|
126
|
-
.max(20)
|
|
127
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
128
|
-
device_id: z
|
|
129
|
-
.string()
|
|
130
|
-
.min(1)
|
|
131
|
-
.max(20)
|
|
132
|
-
.regex(/^\d{1,20}$/),
|
|
133
|
-
operator_oib: z.string().min(11).max(11),
|
|
134
|
-
is_end_consumer: z.boolean(),
|
|
135
|
-
payment_type: z.enum([
|
|
136
|
-
"cash",
|
|
137
|
-
"card",
|
|
138
|
-
"online",
|
|
139
|
-
"bank_transfer",
|
|
140
|
-
"paypal",
|
|
141
|
-
"crypto",
|
|
142
|
-
"coupon",
|
|
143
|
-
"other",
|
|
144
|
-
]),
|
|
145
|
-
subsequent_submit: z.boolean(),
|
|
146
|
-
})
|
|
147
|
-
.partial(),
|
|
148
|
-
z.null(),
|
|
149
|
-
])
|
|
150
|
-
.optional(),
|
|
151
|
-
expected_total_with_tax: z.number().gt(0).optional(),
|
|
152
|
-
});
|
|
50
|
+
const CreateDocumentCustomer = DocumentEntity.and(
|
|
51
|
+
z.union([
|
|
52
|
+
z
|
|
53
|
+
.object({ save_customer: z.boolean().default(true) })
|
|
54
|
+
.partial()
|
|
55
|
+
.passthrough(),
|
|
56
|
+
z.null(),
|
|
57
|
+
])
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// Dependency schema for renderadvanceinvoicepreview_body
|
|
62
|
+
const CreateFinaInvoiceData = z.union([
|
|
63
|
+
z
|
|
64
|
+
.object({
|
|
65
|
+
premise_id: z
|
|
66
|
+
.string()
|
|
67
|
+
.min(1)
|
|
68
|
+
.max(20)
|
|
69
|
+
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
70
|
+
device_id: z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1)
|
|
73
|
+
.max(20)
|
|
74
|
+
.regex(/^\d{1,20}$/),
|
|
75
|
+
operator_oib: z.string().min(11).max(11),
|
|
76
|
+
is_end_consumer: z.boolean(),
|
|
77
|
+
payment_type: z.enum([
|
|
78
|
+
"cash",
|
|
79
|
+
"card",
|
|
80
|
+
"online",
|
|
81
|
+
"bank_transfer",
|
|
82
|
+
"paypal",
|
|
83
|
+
"crypto",
|
|
84
|
+
"coupon",
|
|
85
|
+
"other",
|
|
86
|
+
]),
|
|
87
|
+
subsequent_submit: z.boolean(),
|
|
88
|
+
})
|
|
89
|
+
.partial(),
|
|
90
|
+
z.null(),
|
|
91
|
+
]);
|
|
153
92
|
|
|
154
93
|
|
|
155
94
|
// Dependency schema for renderadvanceinvoicepreview_body
|
|
@@ -161,15 +100,7 @@ const PartialAdvanceInvoicePreview = z.object({
|
|
|
161
100
|
.optional(),
|
|
162
101
|
issuer: DocumentEntity.optional(),
|
|
163
102
|
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
164
|
-
customer:
|
|
165
|
-
z.union([
|
|
166
|
-
z
|
|
167
|
-
.object({ save_customer: z.boolean().default(true) })
|
|
168
|
-
.partial()
|
|
169
|
-
.passthrough(),
|
|
170
|
-
z.null(),
|
|
171
|
-
])
|
|
172
|
-
).optional(),
|
|
103
|
+
customer: CreateDocumentCustomer.optional(),
|
|
173
104
|
note: z.union([z.string(), z.null()]).optional(),
|
|
174
105
|
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
175
106
|
currency_code: z.string().max(3).optional(),
|
|
@@ -198,38 +129,75 @@ const PartialAdvanceInvoicePreview = z.object({
|
|
|
198
129
|
.passthrough()
|
|
199
130
|
)
|
|
200
131
|
.min(1),
|
|
201
|
-
fina:
|
|
132
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
133
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// Dependency schema for renderadvanceinvoicepreview_body
|
|
138
|
+
const DocumentItemTax = z
|
|
139
|
+
.object({
|
|
140
|
+
rate: z.number(),
|
|
141
|
+
tax_id: z.string(),
|
|
142
|
+
classification: z.string(),
|
|
143
|
+
reverse_charge: z.boolean(),
|
|
144
|
+
amount: z.number(),
|
|
145
|
+
})
|
|
146
|
+
.partial();
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
// Dependency schema for renderadvanceinvoicepreview_body
|
|
150
|
+
const LineDiscount = z.object({
|
|
151
|
+
value: z.number().gte(0),
|
|
152
|
+
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// Dependency schema for renderadvanceinvoicepreview_body
|
|
157
|
+
const CreateDocumentItem = z.object({
|
|
158
|
+
name: z.string().min(1).optional(),
|
|
159
|
+
description: z.union([z.string(), z.null()]).optional(),
|
|
160
|
+
price: z.number().optional(),
|
|
161
|
+
gross_price: z.number().optional(),
|
|
162
|
+
quantity: z.number().gte(-140737488355328).lte(140737488355327),
|
|
163
|
+
unit: z.union([z.string(), z.null()]).optional(),
|
|
164
|
+
taxes: z.array(DocumentItemTax).optional(),
|
|
165
|
+
discounts: z.array(LineDiscount).max(5).optional(),
|
|
166
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
167
|
+
metadata: z
|
|
202
168
|
.union([
|
|
203
|
-
z
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
210
|
-
device_id: z
|
|
211
|
-
.string()
|
|
212
|
-
.min(1)
|
|
213
|
-
.max(20)
|
|
214
|
-
.regex(/^\d{1,20}$/),
|
|
215
|
-
operator_oib: z.string().min(11).max(11),
|
|
216
|
-
is_end_consumer: z.boolean(),
|
|
217
|
-
payment_type: z.enum([
|
|
218
|
-
"cash",
|
|
219
|
-
"card",
|
|
220
|
-
"online",
|
|
221
|
-
"bank_transfer",
|
|
222
|
-
"paypal",
|
|
223
|
-
"crypto",
|
|
224
|
-
"coupon",
|
|
225
|
-
"other",
|
|
226
|
-
]),
|
|
227
|
-
subsequent_submit: z.boolean(),
|
|
228
|
-
})
|
|
229
|
-
.partial(),
|
|
169
|
+
z.string(),
|
|
170
|
+
z.number(),
|
|
171
|
+
z.boolean(),
|
|
172
|
+
z.null(),
|
|
173
|
+
z.object({}).partial().passthrough(),
|
|
174
|
+
z.array(z.unknown()),
|
|
230
175
|
z.null(),
|
|
231
176
|
])
|
|
232
177
|
.optional(),
|
|
178
|
+
item_id: z.string().optional(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
// Dependency schema for renderadvanceinvoicepreview_body
|
|
183
|
+
const CompleteAdvanceInvoicePreview = z.object({
|
|
184
|
+
is_draft: z.boolean().optional(),
|
|
185
|
+
date: z
|
|
186
|
+
.string()
|
|
187
|
+
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
188
|
+
.optional(),
|
|
189
|
+
issuer: DocumentEntity.optional(),
|
|
190
|
+
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
191
|
+
customer: CreateDocumentCustomer.optional(),
|
|
192
|
+
note: z.union([z.string(), z.null()]).optional(),
|
|
193
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
194
|
+
currency_code: z.string().max(3).optional(),
|
|
195
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
196
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
197
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
198
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
199
|
+
items: z.array(CreateDocumentItem).min(1),
|
|
200
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
233
201
|
expected_total_with_tax: z.number().gt(0).optional(),
|
|
234
202
|
});
|
|
235
203
|
|
|
@@ -8,25 +8,6 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for rendercreditnotepreview_body endpoints
|
|
10
10
|
|
|
11
|
-
// Dependency schema for rendercreditnotepreview_body
|
|
12
|
-
const LineDiscount = z.object({
|
|
13
|
-
value: z.number().gte(0),
|
|
14
|
-
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Dependency schema for rendercreditnotepreview_body
|
|
19
|
-
const DocumentItemTax = z
|
|
20
|
-
.object({
|
|
21
|
-
rate: z.number(),
|
|
22
|
-
tax_id: z.string(),
|
|
23
|
-
classification: z.string(),
|
|
24
|
-
reverse_charge: z.boolean(),
|
|
25
|
-
amount: z.number(),
|
|
26
|
-
})
|
|
27
|
-
.partial();
|
|
28
|
-
|
|
29
|
-
|
|
30
11
|
// Dependency schema for rendercreditnotepreview_body
|
|
31
12
|
const DocumentEntity = z
|
|
32
13
|
.object({
|
|
@@ -66,91 +47,48 @@ const DocumentEntity = z
|
|
|
66
47
|
|
|
67
48
|
|
|
68
49
|
// Dependency schema for rendercreditnotepreview_body
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
z.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
z.object({}).partial().passthrough(),
|
|
112
|
-
z.array(z.unknown()),
|
|
113
|
-
z.null(),
|
|
114
|
-
])
|
|
115
|
-
.optional(),
|
|
116
|
-
item_id: z.string().optional(),
|
|
117
|
-
})
|
|
118
|
-
)
|
|
119
|
-
.min(1),
|
|
120
|
-
fina: z
|
|
121
|
-
.union([
|
|
122
|
-
z
|
|
123
|
-
.object({
|
|
124
|
-
premise_id: z
|
|
125
|
-
.string()
|
|
126
|
-
.min(1)
|
|
127
|
-
.max(20)
|
|
128
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
129
|
-
device_id: z
|
|
130
|
-
.string()
|
|
131
|
-
.min(1)
|
|
132
|
-
.max(20)
|
|
133
|
-
.regex(/^\d{1,20}$/),
|
|
134
|
-
operator_oib: z.string().min(11).max(11),
|
|
135
|
-
is_end_consumer: z.boolean(),
|
|
136
|
-
payment_type: z.enum([
|
|
137
|
-
"cash",
|
|
138
|
-
"card",
|
|
139
|
-
"online",
|
|
140
|
-
"bank_transfer",
|
|
141
|
-
"paypal",
|
|
142
|
-
"crypto",
|
|
143
|
-
"coupon",
|
|
144
|
-
"other",
|
|
145
|
-
]),
|
|
146
|
-
subsequent_submit: z.boolean(),
|
|
147
|
-
})
|
|
148
|
-
.partial(),
|
|
149
|
-
z.null(),
|
|
150
|
-
])
|
|
151
|
-
.optional(),
|
|
152
|
-
expected_total_with_tax: z.number().gt(0).optional(),
|
|
153
|
-
});
|
|
50
|
+
const CreateDocumentCustomer = DocumentEntity.and(
|
|
51
|
+
z.union([
|
|
52
|
+
z
|
|
53
|
+
.object({ save_customer: z.boolean().default(true) })
|
|
54
|
+
.partial()
|
|
55
|
+
.passthrough(),
|
|
56
|
+
z.null(),
|
|
57
|
+
])
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// Dependency schema for rendercreditnotepreview_body
|
|
62
|
+
const CreateFinaInvoiceData = z.union([
|
|
63
|
+
z
|
|
64
|
+
.object({
|
|
65
|
+
premise_id: z
|
|
66
|
+
.string()
|
|
67
|
+
.min(1)
|
|
68
|
+
.max(20)
|
|
69
|
+
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
70
|
+
device_id: z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1)
|
|
73
|
+
.max(20)
|
|
74
|
+
.regex(/^\d{1,20}$/),
|
|
75
|
+
operator_oib: z.string().min(11).max(11),
|
|
76
|
+
is_end_consumer: z.boolean(),
|
|
77
|
+
payment_type: z.enum([
|
|
78
|
+
"cash",
|
|
79
|
+
"card",
|
|
80
|
+
"online",
|
|
81
|
+
"bank_transfer",
|
|
82
|
+
"paypal",
|
|
83
|
+
"crypto",
|
|
84
|
+
"coupon",
|
|
85
|
+
"other",
|
|
86
|
+
]),
|
|
87
|
+
subsequent_submit: z.boolean(),
|
|
88
|
+
})
|
|
89
|
+
.partial(),
|
|
90
|
+
z.null(),
|
|
91
|
+
]);
|
|
154
92
|
|
|
155
93
|
|
|
156
94
|
// Dependency schema for rendercreditnotepreview_body
|
|
@@ -162,15 +100,7 @@ const PartialCreditNotePreview = z.object({
|
|
|
162
100
|
.optional(),
|
|
163
101
|
issuer: DocumentEntity.optional(),
|
|
164
102
|
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
165
|
-
customer:
|
|
166
|
-
z.union([
|
|
167
|
-
z
|
|
168
|
-
.object({ save_customer: z.boolean().default(true) })
|
|
169
|
-
.partial()
|
|
170
|
-
.passthrough(),
|
|
171
|
-
z.null(),
|
|
172
|
-
])
|
|
173
|
-
).optional(),
|
|
103
|
+
customer: CreateDocumentCustomer.optional(),
|
|
174
104
|
note: z.union([z.string(), z.null()]).optional(),
|
|
175
105
|
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
176
106
|
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
@@ -200,38 +130,76 @@ const PartialCreditNotePreview = z.object({
|
|
|
200
130
|
.passthrough()
|
|
201
131
|
)
|
|
202
132
|
.min(1),
|
|
203
|
-
fina:
|
|
133
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
134
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// Dependency schema for rendercreditnotepreview_body
|
|
139
|
+
const DocumentItemTax = z
|
|
140
|
+
.object({
|
|
141
|
+
rate: z.number(),
|
|
142
|
+
tax_id: z.string(),
|
|
143
|
+
classification: z.string(),
|
|
144
|
+
reverse_charge: z.boolean(),
|
|
145
|
+
amount: z.number(),
|
|
146
|
+
})
|
|
147
|
+
.partial();
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// Dependency schema for rendercreditnotepreview_body
|
|
151
|
+
const LineDiscount = z.object({
|
|
152
|
+
value: z.number().gte(0),
|
|
153
|
+
type: z.enum(["percent", "amount"]).optional().default("percent"),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
// Dependency schema for rendercreditnotepreview_body
|
|
158
|
+
const CreateDocumentItem = z.object({
|
|
159
|
+
name: z.string().min(1).optional(),
|
|
160
|
+
description: z.union([z.string(), z.null()]).optional(),
|
|
161
|
+
price: z.number().optional(),
|
|
162
|
+
gross_price: z.number().optional(),
|
|
163
|
+
quantity: z.number().gte(-140737488355328).lte(140737488355327),
|
|
164
|
+
unit: z.union([z.string(), z.null()]).optional(),
|
|
165
|
+
taxes: z.array(DocumentItemTax).optional(),
|
|
166
|
+
discounts: z.array(LineDiscount).max(5).optional(),
|
|
167
|
+
delivery_note_id: z.union([z.string(), z.null()]).optional(),
|
|
168
|
+
metadata: z
|
|
204
169
|
.union([
|
|
205
|
-
z
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
212
|
-
device_id: z
|
|
213
|
-
.string()
|
|
214
|
-
.min(1)
|
|
215
|
-
.max(20)
|
|
216
|
-
.regex(/^\d{1,20}$/),
|
|
217
|
-
operator_oib: z.string().min(11).max(11),
|
|
218
|
-
is_end_consumer: z.boolean(),
|
|
219
|
-
payment_type: z.enum([
|
|
220
|
-
"cash",
|
|
221
|
-
"card",
|
|
222
|
-
"online",
|
|
223
|
-
"bank_transfer",
|
|
224
|
-
"paypal",
|
|
225
|
-
"crypto",
|
|
226
|
-
"coupon",
|
|
227
|
-
"other",
|
|
228
|
-
]),
|
|
229
|
-
subsequent_submit: z.boolean(),
|
|
230
|
-
})
|
|
231
|
-
.partial(),
|
|
170
|
+
z.string(),
|
|
171
|
+
z.number(),
|
|
172
|
+
z.boolean(),
|
|
173
|
+
z.null(),
|
|
174
|
+
z.object({}).partial().passthrough(),
|
|
175
|
+
z.array(z.unknown()),
|
|
232
176
|
z.null(),
|
|
233
177
|
])
|
|
234
178
|
.optional(),
|
|
179
|
+
item_id: z.string().optional(),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
// Dependency schema for rendercreditnotepreview_body
|
|
184
|
+
const CompleteCreditNotePreview = z.object({
|
|
185
|
+
is_draft: z.boolean().optional(),
|
|
186
|
+
date: z
|
|
187
|
+
.string()
|
|
188
|
+
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
189
|
+
.optional(),
|
|
190
|
+
issuer: DocumentEntity.optional(),
|
|
191
|
+
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
192
|
+
customer: CreateDocumentCustomer.optional(),
|
|
193
|
+
note: z.union([z.string(), z.null()]).optional(),
|
|
194
|
+
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
195
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
196
|
+
currency_code: z.string().max(3).optional(),
|
|
197
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
198
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
199
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
200
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
201
|
+
items: z.array(CreateDocumentItem).min(1),
|
|
202
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
235
203
|
expected_total_with_tax: z.number().gt(0).optional(),
|
|
236
204
|
});
|
|
237
205
|
|