@spaceinvoices/react-ui 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/registry.json +0 -230
  4. package/src/components/advance-invoices/advance-invoices.hooks.ts +2 -2
  5. package/src/components/documents/documents.hooks.ts +5 -48
  6. package/src/components/documents/shared/document-preview-display.tsx +12 -1
  7. package/src/components/documents/view/document-actions-bar.tsx +20 -12
  8. package/src/components/documents/view/document-activities-list.tsx +166 -0
  9. package/src/components/documents/view/document-details-card.tsx +6 -6
  10. package/src/components/documents/view/index.ts +1 -0
  11. package/src/components/documents/view/locales/de.ts +32 -0
  12. package/src/components/documents/view/locales/es.ts +32 -0
  13. package/src/components/documents/view/locales/fr.ts +32 -0
  14. package/src/components/documents/view/locales/hr.ts +32 -0
  15. package/src/components/documents/view/locales/it.ts +32 -0
  16. package/src/components/documents/view/locales/nl.ts +32 -0
  17. package/src/components/documents/view/locales/pl.ts +32 -0
  18. package/src/components/documents/view/locales/pt.ts +32 -0
  19. package/src/components/documents/view/locales/sl.ts +32 -0
  20. package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
  21. package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
  22. package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
  23. package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
  24. package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
  25. package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
  26. package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
  27. package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
  28. package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
  29. package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
  30. package/src/components/entities/furs-settings-form/furs-settings-form.tsx +15 -7
  31. package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +1 -1
  32. package/src/components/entities/furs-settings-form/locales/de.ts +2 -0
  33. package/src/components/entities/furs-settings-form/locales/en.ts +12 -0
  34. package/src/components/entities/furs-settings-form/locales/es.ts +2 -0
  35. package/src/components/entities/furs-settings-form/locales/fr.ts +2 -0
  36. package/src/components/entities/furs-settings-form/locales/hr.ts +2 -0
  37. package/src/components/entities/furs-settings-form/locales/it.ts +2 -0
  38. package/src/components/entities/furs-settings-form/locales/nl.ts +2 -0
  39. package/src/components/entities/furs-settings-form/locales/pl.ts +2 -0
  40. package/src/components/entities/furs-settings-form/locales/pt.ts +2 -0
  41. package/src/components/entities/furs-settings-form/locales/sl.ts +14 -0
  42. package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +121 -1
  43. package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +1 -0
  44. package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +44 -32
  45. package/src/components/invoices/index.ts +1 -1
  46. package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +2 -2
  47. package/src/components/invoices/view/fiscalization-status-card.tsx +121 -0
  48. package/src/generate-schemas.ts +13 -1
  49. package/src/generated/schemas/advanceinvoice.ts +79 -187
  50. package/src/generated/schemas/creditnote.ts +63 -86
  51. package/src/generated/schemas/customadvanceinvoice.ts +70 -97
  52. package/src/generated/schemas/customcreditnote.ts +70 -97
  53. package/src/generated/schemas/customestimate.ts +68 -97
  54. package/src/generated/schemas/custominvoice.ts +70 -97
  55. package/src/generated/schemas/estimate.ts +67 -172
  56. package/src/generated/schemas/invoice.ts +79 -187
  57. package/src/generated/schemas/registerfursrealestatepremise_body.ts +11 -7
  58. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +61 -157
  59. package/src/generated/schemas/rendercreditnotepreview_body.ts +61 -157
  60. package/src/generated/schemas/renderestimatepreview_body.ts +61 -157
  61. package/src/generated/schemas/renderinvoicepreview_body.ts +61 -157
  62. package/src/hooks/use-duplicate-document.ts +19 -11
  63. package/src/providers/entities-provider.tsx +21 -0
  64. package/src/components/invoices/view/fina-info-display.tsx +0 -196
  65. package/src/components/invoices/view/furs-info-display.tsx +0 -213
@@ -8,6 +8,17 @@ import { z } from 'zod';
8
8
 
9
9
  // Schemas for advanceinvoice endpoints
10
10
 
11
+ // Dependency schema for advanceinvoice
12
+ const CreateDocumentPayment = z.object({
13
+ amount: z.number().gt(0).optional(),
14
+ type: z.string().max(20),
15
+ date: z.string().optional(),
16
+ reference: z.union([z.string(), z.null()]).optional(),
17
+ note: z.union([z.string(), z.null()]).optional(),
18
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
19
+ });
20
+
21
+
11
22
  // Dependency schema for advanceinvoice
12
23
  const LineDiscount = z.object({
13
24
  value: z.number().gte(0),
@@ -15,6 +26,56 @@ const LineDiscount = z.object({
15
26
  });
16
27
 
17
28
 
29
+ // Dependency schema for advanceinvoice
30
+ const DocumentItemTax = z
31
+ .object({
32
+ rate: z.number(),
33
+ tax_id: z.string(),
34
+ classification: z.string(),
35
+ reverse_charge: z.boolean(),
36
+ amount: z.number(),
37
+ })
38
+ .partial();
39
+
40
+
41
+ // Dependency schema for advanceinvoice
42
+ const DocumentEntity = z
43
+ .object({
44
+ name: z.union([z.string(), z.null()]),
45
+ email: z.union([z.string(), z.null()]),
46
+ address: z.union([z.string(), z.null()]),
47
+ address_2: z.union([z.string(), z.null()]),
48
+ post_code: z.union([z.string(), z.null()]),
49
+ city: z.union([z.string(), z.null()]),
50
+ state: z.union([z.string(), z.null()]),
51
+ country: z.union([z.string(), z.null()]),
52
+ country_code: z.union([z.string(), z.null()]),
53
+ tax_number: z.union([z.string(), z.null()]),
54
+ tax_number_2: z.union([z.string(), z.null()]),
55
+ company_number: z.union([z.string(), z.null()]),
56
+ bank_account: z.union([
57
+ z
58
+ .object({
59
+ type: z
60
+ .enum(["iban", "us_domestic", "uk_domestic", "other"])
61
+ .default("iban"),
62
+ name: z.string(),
63
+ bank_name: z.string(),
64
+ iban: z.string(),
65
+ account_number: z.string(),
66
+ bic: z.string(),
67
+ routing_number: z.string(),
68
+ sort_code: z.string(),
69
+ })
70
+ .partial()
71
+ .passthrough(),
72
+ z.null(),
73
+ ]),
74
+ })
75
+ .partial()
76
+ .passthrough();
77
+
78
+
18
79
  // Schema for create advanceinvoice operation
19
80
  const createAdvanceInvoiceSchemaDefinition = z.object({
20
81
  is_draft: z.boolean().optional(),
@@ -22,84 +83,17 @@ const createAdvanceInvoiceSchemaDefinition = z.object({
22
83
  .string()
23
84
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
24
85
  .optional(),
25
- issuer: z
26
- .object({
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(),
86
+ issuer: DocumentEntity.optional(),
61
87
  customer_id: z.union([z.string(), z.null()]).optional(),
62
- customer: z
63
- .union([
88
+ customer: DocumentEntity.and(
89
+ z.union([
64
90
  z
65
- .object({
66
- name: z.union([z.string(), z.null()]),
67
- email: z.union([z.string(), z.null()]),
68
- address: z.union([z.string(), z.null()]),
69
- address_2: z.union([z.string(), z.null()]),
70
- post_code: z.union([z.string(), z.null()]),
71
- city: z.union([z.string(), z.null()]),
72
- state: z.union([z.string(), z.null()]),
73
- country: z.union([z.string(), z.null()]),
74
- country_code: z.union([z.string(), z.null()]),
75
- tax_number: z.union([z.string(), z.null()]),
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),
97
- })
91
+ .object({ save_customer: z.boolean().default(true) })
98
92
  .partial()
99
93
  .passthrough(),
100
94
  z.null(),
101
95
  ])
102
- .optional(),
96
+ ).optional(),
103
97
  note: z.union([z.string(), z.null()]).optional(),
104
98
  tax_clause: z.union([z.string(), z.null()]).optional(),
105
99
  currency_code: z.string().max(3).optional(),
@@ -116,19 +110,7 @@ const createAdvanceInvoiceSchemaDefinition = z.object({
116
110
  gross_price: z.number().optional(),
117
111
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
118
112
  unit: z.union([z.string(), z.null()]).optional(),
119
- taxes: z
120
- .array(
121
- z
122
- .object({
123
- rate: z.number(),
124
- tax_id: z.string(),
125
- classification: z.string(),
126
- reverse_charge: z.boolean(),
127
- amount: z.number(),
128
- })
129
- .partial()
130
- )
131
- .optional(),
113
+ taxes: z.array(DocumentItemTax).optional(),
132
114
  discounts: z.array(LineDiscount).max(5).optional(),
133
115
  metadata: z
134
116
  .union([
@@ -146,21 +128,7 @@ const createAdvanceInvoiceSchemaDefinition = z.object({
146
128
  )
147
129
  .min(1),
148
130
  linked_documents: z.array(z.string().min(1)).optional(),
149
- payments: z
150
- .union([
151
- z.array(
152
- z.object({
153
- amount: z.number().gt(0).optional(),
154
- type: z.string().max(20),
155
- date: z.string().optional(),
156
- reference: z.union([z.string(), z.null()]).optional(),
157
- note: z.union([z.string(), z.null()]).optional(),
158
- metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
159
- })
160
- ),
161
- z.null(),
162
- ])
163
- .optional(),
131
+ payments: z.union([z.array(CreateDocumentPayment), z.null()]).optional(),
164
132
  furs: z
165
133
  .union([
166
134
  z
@@ -220,81 +188,17 @@ const updateAdvanceInvoiceSchemaDefinition = z
220
188
  date: z
221
189
  .string()
222
190
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/),
223
- issuer: z
224
- .object({
225
- name: z.union([z.string(), z.null()]),
226
- email: z.union([z.string(), z.null()]),
227
- address: z.union([z.string(), z.null()]),
228
- address_2: z.union([z.string(), z.null()]),
229
- post_code: z.union([z.string(), z.null()]),
230
- city: z.union([z.string(), z.null()]),
231
- state: z.union([z.string(), z.null()]),
232
- country: z.union([z.string(), z.null()]),
233
- country_code: z.union([z.string(), z.null()]),
234
- tax_number: z.union([z.string(), z.null()]),
235
- tax_number_2: z.union([z.string(), z.null()]),
236
- company_number: z.union([z.string(), z.null()]),
237
- bank_account: z.union([
238
- z
239
- .object({
240
- type: z
241
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
242
- .default("iban"),
243
- name: z.string(),
244
- bank_name: z.string(),
245
- iban: z.string(),
246
- account_number: z.string(),
247
- bic: z.string(),
248
- routing_number: z.string(),
249
- sort_code: z.string(),
250
- })
251
- .partial()
252
- .passthrough(),
253
- z.null(),
254
- ]),
255
- })
256
- .partial()
257
- .passthrough(),
191
+ issuer: DocumentEntity.and(z.unknown()),
258
192
  customer_id: z.union([z.string(), z.null()]),
259
- customer: z.union([
260
- z
261
- .object({
262
- name: z.union([z.string(), z.null()]),
263
- email: z.union([z.string(), z.null()]),
264
- address: z.union([z.string(), z.null()]),
265
- address_2: z.union([z.string(), z.null()]),
266
- post_code: z.union([z.string(), z.null()]),
267
- city: z.union([z.string(), z.null()]),
268
- state: z.union([z.string(), z.null()]),
269
- country: z.union([z.string(), z.null()]),
270
- country_code: z.union([z.string(), z.null()]),
271
- tax_number: z.union([z.string(), z.null()]),
272
- tax_number_2: z.union([z.string(), z.null()]),
273
- company_number: z.union([z.string(), z.null()]),
274
- bank_account: z.union([
275
- z
276
- .object({
277
- type: z
278
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
279
- .default("iban"),
280
- name: z.string(),
281
- bank_name: z.string(),
282
- iban: z.string(),
283
- account_number: z.string(),
284
- bic: z.string(),
285
- routing_number: z.string(),
286
- sort_code: z.string(),
287
- })
288
- .partial()
289
- .passthrough(),
290
- z.null(),
291
- ]),
292
- save_customer: z.boolean().default(true),
293
- })
294
- .partial()
295
- .passthrough(),
296
- z.null(),
297
- ]),
193
+ customer: DocumentEntity.and(
194
+ z.union([
195
+ z
196
+ .object({ save_customer: z.boolean().default(true) })
197
+ .partial()
198
+ .passthrough(),
199
+ z.null(),
200
+ ])
201
+ ),
298
202
  items: z
299
203
  .array(
300
204
  z.object({
@@ -304,19 +208,7 @@ const updateAdvanceInvoiceSchemaDefinition = z
304
208
  gross_price: z.number().optional(),
305
209
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
306
210
  unit: z.union([z.string(), z.null()]).optional(),
307
- taxes: z
308
- .array(
309
- z
310
- .object({
311
- rate: z.number(),
312
- tax_id: z.string(),
313
- classification: z.string(),
314
- reverse_charge: z.boolean(),
315
- amount: z.number(),
316
- })
317
- .partial()
318
- )
319
- .optional(),
211
+ taxes: z.array(DocumentItemTax).optional(),
320
212
  discounts: z.array(LineDiscount).max(5).optional(),
321
213
  metadata: z
322
214
  .union([
@@ -15,87 +15,73 @@ const LineDiscount = z.object({
15
15
  });
16
16
 
17
17
 
18
- // Schema for update creditnote operation
19
- const updateCreditNoteSchemaDefinition = z
18
+ // Dependency schema for creditnote
19
+ const DocumentItemTax = z
20
20
  .object({
21
- date: z
22
- .string()
23
- .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/),
24
- issuer: z
25
- .object({
26
- name: z.union([z.string(), z.null()]),
27
- email: z.union([z.string(), z.null()]),
28
- address: z.union([z.string(), z.null()]),
29
- address_2: z.union([z.string(), z.null()]),
30
- post_code: z.union([z.string(), z.null()]),
31
- city: z.union([z.string(), z.null()]),
32
- state: z.union([z.string(), z.null()]),
33
- country: z.union([z.string(), z.null()]),
34
- country_code: z.union([z.string(), z.null()]),
35
- tax_number: z.union([z.string(), z.null()]),
36
- tax_number_2: z.union([z.string(), z.null()]),
37
- company_number: z.union([z.string(), z.null()]),
38
- bank_account: z.union([
39
- z
40
- .object({
41
- type: z
42
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
43
- .default("iban"),
44
- name: z.string(),
45
- bank_name: z.string(),
46
- iban: z.string(),
47
- account_number: z.string(),
48
- bic: z.string(),
49
- routing_number: z.string(),
50
- sort_code: z.string(),
51
- })
52
- .partial()
53
- .passthrough(),
54
- z.null(),
55
- ]),
56
- })
57
- .partial()
58
- .passthrough(),
59
- customer_id: z.union([z.string(), z.null()]),
60
- customer: z.union([
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
+ // Dependency schema for creditnote
31
+ const DocumentEntity = z
32
+ .object({
33
+ name: z.union([z.string(), z.null()]),
34
+ email: z.union([z.string(), z.null()]),
35
+ address: z.union([z.string(), z.null()]),
36
+ address_2: z.union([z.string(), z.null()]),
37
+ post_code: z.union([z.string(), z.null()]),
38
+ city: z.union([z.string(), z.null()]),
39
+ state: z.union([z.string(), z.null()]),
40
+ country: z.union([z.string(), z.null()]),
41
+ country_code: z.union([z.string(), z.null()]),
42
+ tax_number: z.union([z.string(), z.null()]),
43
+ tax_number_2: z.union([z.string(), z.null()]),
44
+ company_number: z.union([z.string(), z.null()]),
45
+ bank_account: z.union([
61
46
  z
62
47
  .object({
63
- name: z.union([z.string(), z.null()]),
64
- email: z.union([z.string(), z.null()]),
65
- address: z.union([z.string(), z.null()]),
66
- address_2: z.union([z.string(), z.null()]),
67
- post_code: z.union([z.string(), z.null()]),
68
- city: z.union([z.string(), z.null()]),
69
- state: z.union([z.string(), z.null()]),
70
- country: z.union([z.string(), z.null()]),
71
- country_code: z.union([z.string(), z.null()]),
72
- tax_number: z.union([z.string(), z.null()]),
73
- tax_number_2: z.union([z.string(), z.null()]),
74
- company_number: z.union([z.string(), z.null()]),
75
- bank_account: z.union([
76
- z
77
- .object({
78
- type: z
79
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
80
- .default("iban"),
81
- name: z.string(),
82
- bank_name: z.string(),
83
- iban: z.string(),
84
- account_number: z.string(),
85
- bic: z.string(),
86
- routing_number: z.string(),
87
- sort_code: z.string(),
88
- })
89
- .partial()
90
- .passthrough(),
91
- z.null(),
92
- ]),
93
- save_customer: z.boolean().default(true),
48
+ type: z
49
+ .enum(["iban", "us_domestic", "uk_domestic", "other"])
50
+ .default("iban"),
51
+ name: z.string(),
52
+ bank_name: z.string(),
53
+ iban: z.string(),
54
+ account_number: z.string(),
55
+ bic: z.string(),
56
+ routing_number: z.string(),
57
+ sort_code: z.string(),
94
58
  })
95
59
  .partial()
96
60
  .passthrough(),
97
61
  z.null(),
98
62
  ]),
63
+ })
64
+ .partial()
65
+ .passthrough();
66
+
67
+
68
+ // Schema for update creditnote operation
69
+ const updateCreditNoteSchemaDefinition = z
70
+ .object({
71
+ date: z
72
+ .string()
73
+ .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/),
74
+ issuer: DocumentEntity.and(z.unknown()),
75
+ customer_id: z.union([z.string(), z.null()]),
76
+ customer: DocumentEntity.and(
77
+ z.union([
78
+ z
79
+ .object({ save_customer: z.boolean().default(true) })
80
+ .partial()
81
+ .passthrough(),
82
+ z.null(),
83
+ ])
84
+ ),
99
85
  items: z
100
86
  .array(
101
87
  z.object({
@@ -105,19 +91,7 @@ const updateCreditNoteSchemaDefinition = z
105
91
  gross_price: z.number().optional(),
106
92
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
107
93
  unit: z.union([z.string(), z.null()]).optional(),
108
- taxes: z
109
- .array(
110
- z
111
- .object({
112
- rate: z.number(),
113
- tax_id: z.string(),
114
- classification: z.string(),
115
- reverse_charge: z.boolean(),
116
- amount: z.number(),
117
- })
118
- .partial()
119
- )
120
- .optional(),
94
+ taxes: z.array(DocumentItemTax).optional(),
121
95
  discounts: z.array(LineDiscount).max(5).optional(),
122
96
  metadata: z
123
97
  .union([
@@ -154,3 +128,6 @@ const updateCreditNoteSchemaDefinition = z
154
128
  export type UpdateCreditNoteSchema = z.infer<typeof updateCreditNoteSchemaDefinition>;
155
129
 
156
130
  export const updateCreditNoteSchema = updateCreditNoteSchemaDefinition;
131
+
132
+ // Re-export invoice create schema as credit note create schema (same body structure)
133
+ export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';