@spaceinvoices/react-ui 0.4.0 → 0.4.2
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 +23 -27
- 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 +45 -2
- package/src/components/advance-invoices/list/locales/de.ts +3 -0
- package/src/components/advance-invoices/list/locales/en.ts +3 -0
- package/src/components/advance-invoices/list/locales/es.ts +3 -0
- package/src/components/advance-invoices/list/locales/fr.ts +3 -0
- package/src/components/advance-invoices/list/locales/hr.ts +3 -0
- package/src/components/advance-invoices/list/locales/it.ts +3 -0
- package/src/components/advance-invoices/list/locales/nl.ts +3 -0
- package/src/components/advance-invoices/list/locales/pl.ts +3 -0
- package/src/components/advance-invoices/list/locales/pt.ts +3 -0
- package/src/components/advance-invoices/list/locales/sl.ts +3 -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 +45 -2
- package/src/components/credit-notes/list/locales/de.ts +3 -0
- package/src/components/credit-notes/list/locales/en.ts +3 -0
- package/src/components/credit-notes/list/locales/es.ts +3 -0
- package/src/components/credit-notes/list/locales/fr.ts +3 -0
- package/src/components/credit-notes/list/locales/hr.ts +3 -0
- package/src/components/credit-notes/list/locales/it.ts +3 -0
- package/src/components/credit-notes/list/locales/nl.ts +3 -0
- package/src/components/credit-notes/list/locales/pl.ts +3 -0
- package/src/components/credit-notes/list/locales/pt.ts +3 -0
- package/src/components/credit-notes/list/locales/sl.ts +3 -0
- package/src/components/customers/create-customer-form/create-customer-form.tsx +0 -1
- package/src/components/documents/create/document-details-section.tsx +67 -1
- package/src/components/documents/create/mark-as-paid-section.tsx +11 -2
- package/src/components/documents/view/document-actions-bar.tsx +30 -0
- package/src/components/documents/view/locales/de.ts +5 -0
- package/src/components/documents/view/locales/es.ts +5 -0
- package/src/components/documents/view/locales/fr.ts +5 -0
- package/src/components/documents/view/locales/hr.ts +5 -0
- package/src/components/documents/view/locales/it.ts +5 -0
- package/src/components/documents/view/locales/nl.ts +5 -0
- package/src/components/documents/view/locales/pl.ts +5 -0
- package/src/components/documents/view/locales/pt.ts +5 -0
- package/src/components/documents/view/locales/sl.ts +5 -0
- 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 +365 -35
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +101 -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 +24 -10
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +5 -9
- 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 +15 -2
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +1 -0
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +58 -34
- 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.hooks.ts +32 -2
- package/src/components/invoices/list/list-row-actions.tsx +23 -8
- package/src/components/invoices/list/list-table.tsx +53 -2
- package/src/components/invoices/list/locales/de.ts +4 -0
- package/src/components/invoices/list/locales/en.ts +4 -0
- package/src/components/invoices/list/locales/es.ts +4 -0
- package/src/components/invoices/list/locales/fr.ts +4 -0
- package/src/components/invoices/list/locales/hr.ts +4 -0
- package/src/components/invoices/list/locales/it.ts +4 -0
- package/src/components/invoices/list/locales/nl.ts +4 -0
- package/src/components/invoices/list/locales/pl.ts +4 -0
- package/src/components/invoices/list/locales/pt.ts +4 -0
- package/src/components/invoices/list/locales/sl.ts +4 -0
- package/src/components/invoices/view/fiscalization-status-card.tsx +4 -1
- package/src/components/items/item-list-table/item-list-row-actions.tsx +3 -7
- package/src/components/items/item-list-table/item-list-row.tsx +3 -2
- 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 +46 -7
- package/src/generated/schemas/advanceinvoice.ts +79 -187
- package/src/generated/schemas/authorizeshopify_body.ts +22 -0
- package/src/generated/schemas/creditnote.ts +60 -88
- package/src/generated/schemas/customadvanceinvoice.ts +70 -97
- package/src/generated/schemas/customcreditnote.ts +70 -97
- package/src/generated/schemas/customestimate.ts +68 -97
- package/src/generated/schemas/custominvoice.ts +70 -97
- package/src/generated/schemas/entity.ts +1 -1
- package/src/generated/schemas/estimate.ts +67 -172
- package/src/generated/schemas/index.ts +39 -28
- package/src/generated/schemas/invoice.ts +79 -187
- package/src/generated/schemas/order.ts +127 -0
- package/src/generated/schemas/orderintegration.ts +51 -0
- package/src/generated/schemas/payment.ts +2 -0
- package/src/generated/schemas/recurringinvoice.ts +61 -0
- package/src/generated/schemas/registerfursrealestatepremise_body.ts +11 -7
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +140 -269
- package/src/generated/schemas/rendercreditnotepreview_body.ts +141 -270
- package/src/generated/schemas/renderestimatepreview_body.ts +112 -212
- package/src/generated/schemas/renderinvoicepreview_body.ts +141 -270
- package/src/generated/schemas/webhook.ts +42 -0
- 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/white-label-provider.tsx +3 -0
|
@@ -9,177 +9,86 @@ import { z } from 'zod';
|
|
|
9
9
|
// Schemas for renderinvoicepreview_body endpoints
|
|
10
10
|
|
|
11
11
|
// Dependency schema for renderinvoicepreview_body
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.string()
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
name: z.union([z.string(), z.null()]),
|
|
28
|
-
email: z.union([z.string(), z.null()]),
|
|
29
|
-
address: z.union([z.string(), z.null()]),
|
|
30
|
-
address_2: z.union([z.string(), z.null()]),
|
|
31
|
-
post_code: z.union([z.string(), z.null()]),
|
|
32
|
-
city: z.union([z.string(), z.null()]),
|
|
33
|
-
state: z.union([z.string(), z.null()]),
|
|
34
|
-
country: z.union([z.string(), z.null()]),
|
|
35
|
-
country_code: z.union([z.string(), z.null()]),
|
|
36
|
-
tax_number: z.union([z.string(), z.null()]),
|
|
37
|
-
tax_number_2: z.union([z.string(), z.null()]),
|
|
38
|
-
company_number: z.union([z.string(), z.null()]),
|
|
39
|
-
bank_account: z.union([
|
|
40
|
-
z
|
|
41
|
-
.object({
|
|
42
|
-
type: z
|
|
43
|
-
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
44
|
-
.default("iban"),
|
|
45
|
-
name: z.string(),
|
|
46
|
-
bank_name: z.string(),
|
|
47
|
-
iban: z.string(),
|
|
48
|
-
account_number: z.string(),
|
|
49
|
-
bic: z.string(),
|
|
50
|
-
routing_number: z.string(),
|
|
51
|
-
sort_code: z.string(),
|
|
52
|
-
})
|
|
53
|
-
.partial()
|
|
54
|
-
.passthrough(),
|
|
55
|
-
z.null(),
|
|
56
|
-
]),
|
|
57
|
-
})
|
|
58
|
-
.partial()
|
|
59
|
-
.passthrough()
|
|
60
|
-
.optional(),
|
|
61
|
-
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
62
|
-
customer: z
|
|
63
|
-
.union([
|
|
12
|
+
const DocumentEntity = z
|
|
13
|
+
.object({
|
|
14
|
+
name: z.union([z.string(), z.null()]),
|
|
15
|
+
email: z.union([z.string(), z.null()]),
|
|
16
|
+
address: z.union([z.string(), z.null()]),
|
|
17
|
+
address_2: z.union([z.string(), z.null()]),
|
|
18
|
+
post_code: z.union([z.string(), z.null()]),
|
|
19
|
+
city: z.union([z.string(), z.null()]),
|
|
20
|
+
state: z.union([z.string(), z.null()]),
|
|
21
|
+
country: z.union([z.string(), z.null()]),
|
|
22
|
+
country_code: z.union([z.string(), z.null()]),
|
|
23
|
+
tax_number: z.union([z.string(), z.null()]),
|
|
24
|
+
tax_number_2: z.union([z.string(), z.null()]),
|
|
25
|
+
company_number: z.union([z.string(), z.null()]),
|
|
26
|
+
bank_account: z.union([
|
|
64
27
|
z
|
|
65
28
|
.object({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
tax_number_2: z.union([z.string(), z.null()]),
|
|
77
|
-
company_number: z.union([z.string(), z.null()]),
|
|
78
|
-
bank_account: z.union([
|
|
79
|
-
z
|
|
80
|
-
.object({
|
|
81
|
-
type: z
|
|
82
|
-
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
83
|
-
.default("iban"),
|
|
84
|
-
name: z.string(),
|
|
85
|
-
bank_name: z.string(),
|
|
86
|
-
iban: z.string(),
|
|
87
|
-
account_number: z.string(),
|
|
88
|
-
bic: z.string(),
|
|
89
|
-
routing_number: z.string(),
|
|
90
|
-
sort_code: z.string(),
|
|
91
|
-
})
|
|
92
|
-
.partial()
|
|
93
|
-
.passthrough(),
|
|
94
|
-
z.null(),
|
|
95
|
-
]),
|
|
96
|
-
save_customer: z.boolean().default(true),
|
|
29
|
+
type: z
|
|
30
|
+
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
31
|
+
.default("iban"),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
bank_name: z.string(),
|
|
34
|
+
iban: z.string(),
|
|
35
|
+
account_number: z.string(),
|
|
36
|
+
bic: z.string(),
|
|
37
|
+
routing_number: z.string(),
|
|
38
|
+
sort_code: z.string(),
|
|
97
39
|
})
|
|
98
40
|
.partial()
|
|
99
41
|
.passthrough(),
|
|
100
42
|
z.null(),
|
|
101
|
-
])
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
.union([
|
|
151
|
-
z
|
|
152
|
-
.object({
|
|
153
|
-
premise_id: z
|
|
154
|
-
.string()
|
|
155
|
-
.min(1)
|
|
156
|
-
.max(20)
|
|
157
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
158
|
-
device_id: z
|
|
159
|
-
.string()
|
|
160
|
-
.min(1)
|
|
161
|
-
.max(20)
|
|
162
|
-
.regex(/^\d{1,20}$/),
|
|
163
|
-
operator_oib: z.string().min(11).max(11),
|
|
164
|
-
is_end_consumer: z.boolean(),
|
|
165
|
-
payment_type: z.enum([
|
|
166
|
-
"cash",
|
|
167
|
-
"card",
|
|
168
|
-
"online",
|
|
169
|
-
"bank_transfer",
|
|
170
|
-
"paypal",
|
|
171
|
-
"crypto",
|
|
172
|
-
"coupon",
|
|
173
|
-
"other",
|
|
174
|
-
]),
|
|
175
|
-
subsequent_submit: z.boolean(),
|
|
176
|
-
})
|
|
177
|
-
.partial(),
|
|
178
|
-
z.null(),
|
|
179
|
-
])
|
|
180
|
-
.optional(),
|
|
181
|
-
expected_total_with_tax: z.number().gt(0).optional(),
|
|
182
|
-
});
|
|
43
|
+
]),
|
|
44
|
+
})
|
|
45
|
+
.partial()
|
|
46
|
+
.passthrough();
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// Dependency schema for renderinvoicepreview_body
|
|
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 renderinvoicepreview_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
|
+
]);
|
|
183
92
|
|
|
184
93
|
|
|
185
94
|
// Dependency schema for renderinvoicepreview_body
|
|
@@ -189,84 +98,9 @@ const PartialInvoicePreview = z.object({
|
|
|
189
98
|
.string()
|
|
190
99
|
.regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
|
|
191
100
|
.optional(),
|
|
192
|
-
issuer:
|
|
193
|
-
.object({
|
|
194
|
-
name: z.union([z.string(), z.null()]),
|
|
195
|
-
email: z.union([z.string(), z.null()]),
|
|
196
|
-
address: z.union([z.string(), z.null()]),
|
|
197
|
-
address_2: z.union([z.string(), z.null()]),
|
|
198
|
-
post_code: z.union([z.string(), z.null()]),
|
|
199
|
-
city: z.union([z.string(), z.null()]),
|
|
200
|
-
state: z.union([z.string(), z.null()]),
|
|
201
|
-
country: z.union([z.string(), z.null()]),
|
|
202
|
-
country_code: z.union([z.string(), z.null()]),
|
|
203
|
-
tax_number: z.union([z.string(), z.null()]),
|
|
204
|
-
tax_number_2: z.union([z.string(), z.null()]),
|
|
205
|
-
company_number: z.union([z.string(), z.null()]),
|
|
206
|
-
bank_account: z.union([
|
|
207
|
-
z
|
|
208
|
-
.object({
|
|
209
|
-
type: z
|
|
210
|
-
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
211
|
-
.default("iban"),
|
|
212
|
-
name: z.string(),
|
|
213
|
-
bank_name: z.string(),
|
|
214
|
-
iban: z.string(),
|
|
215
|
-
account_number: z.string(),
|
|
216
|
-
bic: z.string(),
|
|
217
|
-
routing_number: z.string(),
|
|
218
|
-
sort_code: z.string(),
|
|
219
|
-
})
|
|
220
|
-
.partial()
|
|
221
|
-
.passthrough(),
|
|
222
|
-
z.null(),
|
|
223
|
-
]),
|
|
224
|
-
})
|
|
225
|
-
.partial()
|
|
226
|
-
.passthrough()
|
|
227
|
-
.optional(),
|
|
101
|
+
issuer: DocumentEntity.optional(),
|
|
228
102
|
customer_id: z.union([z.string(), z.null()]).optional(),
|
|
229
|
-
customer:
|
|
230
|
-
.union([
|
|
231
|
-
z
|
|
232
|
-
.object({
|
|
233
|
-
name: z.union([z.string(), z.null()]),
|
|
234
|
-
email: z.union([z.string(), z.null()]),
|
|
235
|
-
address: z.union([z.string(), z.null()]),
|
|
236
|
-
address_2: z.union([z.string(), z.null()]),
|
|
237
|
-
post_code: z.union([z.string(), z.null()]),
|
|
238
|
-
city: z.union([z.string(), z.null()]),
|
|
239
|
-
state: z.union([z.string(), z.null()]),
|
|
240
|
-
country: z.union([z.string(), z.null()]),
|
|
241
|
-
country_code: z.union([z.string(), z.null()]),
|
|
242
|
-
tax_number: z.union([z.string(), z.null()]),
|
|
243
|
-
tax_number_2: z.union([z.string(), z.null()]),
|
|
244
|
-
company_number: z.union([z.string(), z.null()]),
|
|
245
|
-
bank_account: z.union([
|
|
246
|
-
z
|
|
247
|
-
.object({
|
|
248
|
-
type: z
|
|
249
|
-
.enum(["iban", "us_domestic", "uk_domestic", "other"])
|
|
250
|
-
.default("iban"),
|
|
251
|
-
name: z.string(),
|
|
252
|
-
bank_name: z.string(),
|
|
253
|
-
iban: z.string(),
|
|
254
|
-
account_number: z.string(),
|
|
255
|
-
bic: z.string(),
|
|
256
|
-
routing_number: z.string(),
|
|
257
|
-
sort_code: z.string(),
|
|
258
|
-
})
|
|
259
|
-
.partial()
|
|
260
|
-
.passthrough(),
|
|
261
|
-
z.null(),
|
|
262
|
-
]),
|
|
263
|
-
save_customer: z.boolean().default(true),
|
|
264
|
-
})
|
|
265
|
-
.partial()
|
|
266
|
-
.passthrough(),
|
|
267
|
-
z.null(),
|
|
268
|
-
])
|
|
269
|
-
.optional(),
|
|
103
|
+
customer: CreateDocumentCustomer.optional(),
|
|
270
104
|
note: z.union([z.string(), z.null()]).optional(),
|
|
271
105
|
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
272
106
|
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
@@ -296,38 +130,75 @@ const PartialInvoicePreview = z.object({
|
|
|
296
130
|
.passthrough()
|
|
297
131
|
)
|
|
298
132
|
.min(1),
|
|
299
|
-
fina:
|
|
133
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
134
|
+
expected_total_with_tax: z.number().gt(0).optional(),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// Dependency schema for renderinvoicepreview_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 renderinvoicepreview_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 renderinvoicepreview_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
|
+
metadata: z
|
|
300
168
|
.union([
|
|
301
|
-
z
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
.regex(/^[0-9a-zA-Z]{1,20}$/),
|
|
308
|
-
device_id: z
|
|
309
|
-
.string()
|
|
310
|
-
.min(1)
|
|
311
|
-
.max(20)
|
|
312
|
-
.regex(/^\d{1,20}$/),
|
|
313
|
-
operator_oib: z.string().min(11).max(11),
|
|
314
|
-
is_end_consumer: z.boolean(),
|
|
315
|
-
payment_type: z.enum([
|
|
316
|
-
"cash",
|
|
317
|
-
"card",
|
|
318
|
-
"online",
|
|
319
|
-
"bank_transfer",
|
|
320
|
-
"paypal",
|
|
321
|
-
"crypto",
|
|
322
|
-
"coupon",
|
|
323
|
-
"other",
|
|
324
|
-
]),
|
|
325
|
-
subsequent_submit: z.boolean(),
|
|
326
|
-
})
|
|
327
|
-
.partial(),
|
|
169
|
+
z.string(),
|
|
170
|
+
z.number(),
|
|
171
|
+
z.boolean(),
|
|
172
|
+
z.null(),
|
|
173
|
+
z.object({}).partial().passthrough(),
|
|
174
|
+
z.array(z.unknown()),
|
|
328
175
|
z.null(),
|
|
329
176
|
])
|
|
330
177
|
.optional(),
|
|
178
|
+
item_id: z.string().optional(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
// Dependency schema for renderinvoicepreview_body
|
|
183
|
+
const CompleteInvoicePreview = 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
|
+
payment_terms: z.union([z.string(), z.null()]).optional(),
|
|
194
|
+
tax_clause: z.union([z.string(), z.null()]).optional(),
|
|
195
|
+
currency_code: z.string().max(3).optional(),
|
|
196
|
+
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
197
|
+
date_due: z.union([z.string(), z.null()]).optional(),
|
|
198
|
+
date_service: z.union([z.string(), z.null()]).optional(),
|
|
199
|
+
date_service_to: z.union([z.string(), z.null()]).optional(),
|
|
200
|
+
items: z.array(CreateDocumentItem).min(1),
|
|
201
|
+
fina: CreateFinaInvoiceData.optional(),
|
|
331
202
|
expected_total_with_tax: z.number().gt(0).optional(),
|
|
332
203
|
});
|
|
333
204
|
|
|
@@ -59,9 +59,30 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
59
59
|
"tax.deleted",
|
|
60
60
|
"tax.restored",
|
|
61
61
|
"tax.permanently_deleted",
|
|
62
|
+
"recurring_invoice.created",
|
|
63
|
+
"recurring_invoice.updated",
|
|
64
|
+
"recurring_invoice.deleted",
|
|
65
|
+
"recurring_invoice.restored",
|
|
66
|
+
"recurring_invoice.permanently_deleted",
|
|
67
|
+
"recurring_invoice.paused",
|
|
68
|
+
"recurring_invoice.resumed",
|
|
69
|
+
"recurring_invoice.invoice_generated",
|
|
70
|
+
"recurring_invoice.generation_failed",
|
|
71
|
+
"recurring_invoice.completed",
|
|
62
72
|
"stripe_app.connected",
|
|
63
73
|
"stripe_app.disconnected",
|
|
64
74
|
"stripe_app.settings_updated",
|
|
75
|
+
"order.created",
|
|
76
|
+
"order.updated",
|
|
77
|
+
"order.deleted",
|
|
78
|
+
"order.restored",
|
|
79
|
+
"order.permanently_deleted",
|
|
80
|
+
"order.processed",
|
|
81
|
+
"order.cancelled",
|
|
82
|
+
"order.failed",
|
|
83
|
+
"order_integration.created",
|
|
84
|
+
"order_integration.updated",
|
|
85
|
+
"order_integration.deleted",
|
|
65
86
|
])
|
|
66
87
|
)
|
|
67
88
|
.min(1),
|
|
@@ -125,9 +146,30 @@ const updateWebhookSchemaDefinition = z
|
|
|
125
146
|
"tax.deleted",
|
|
126
147
|
"tax.restored",
|
|
127
148
|
"tax.permanently_deleted",
|
|
149
|
+
"recurring_invoice.created",
|
|
150
|
+
"recurring_invoice.updated",
|
|
151
|
+
"recurring_invoice.deleted",
|
|
152
|
+
"recurring_invoice.restored",
|
|
153
|
+
"recurring_invoice.permanently_deleted",
|
|
154
|
+
"recurring_invoice.paused",
|
|
155
|
+
"recurring_invoice.resumed",
|
|
156
|
+
"recurring_invoice.invoice_generated",
|
|
157
|
+
"recurring_invoice.generation_failed",
|
|
158
|
+
"recurring_invoice.completed",
|
|
128
159
|
"stripe_app.connected",
|
|
129
160
|
"stripe_app.disconnected",
|
|
130
161
|
"stripe_app.settings_updated",
|
|
162
|
+
"order.created",
|
|
163
|
+
"order.updated",
|
|
164
|
+
"order.deleted",
|
|
165
|
+
"order.restored",
|
|
166
|
+
"order.permanently_deleted",
|
|
167
|
+
"order.processed",
|
|
168
|
+
"order.cancelled",
|
|
169
|
+
"order.failed",
|
|
170
|
+
"order_integration.created",
|
|
171
|
+
"order_integration.updated",
|
|
172
|
+
"order_integration.deleted",
|
|
131
173
|
])
|
|
132
174
|
)
|
|
133
175
|
.min(1),
|
|
@@ -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
|
}
|
|
@@ -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 {
|