@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.
Files changed (200) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/registry.json +23 -27
  4. package/src/components/advance-invoices/advance-invoices.hooks.ts +32 -2
  5. package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +109 -4
  6. package/src/components/advance-invoices/create/locales/de.ts +2 -0
  7. package/src/components/advance-invoices/create/locales/es.ts +2 -0
  8. package/src/components/advance-invoices/create/locales/fr.ts +2 -0
  9. package/src/components/advance-invoices/create/locales/hr.ts +2 -0
  10. package/src/components/advance-invoices/create/locales/it.ts +2 -0
  11. package/src/components/advance-invoices/create/locales/nl.ts +2 -0
  12. package/src/components/advance-invoices/create/locales/pl.ts +2 -0
  13. package/src/components/advance-invoices/create/locales/pt.ts +2 -0
  14. package/src/components/advance-invoices/create/locales/sl.ts +2 -0
  15. package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +17 -0
  16. package/src/components/advance-invoices/list/list-row-actions.tsx +3 -6
  17. package/src/components/advance-invoices/list/list-table.tsx +45 -2
  18. package/src/components/advance-invoices/list/locales/de.ts +3 -0
  19. package/src/components/advance-invoices/list/locales/en.ts +3 -0
  20. package/src/components/advance-invoices/list/locales/es.ts +3 -0
  21. package/src/components/advance-invoices/list/locales/fr.ts +3 -0
  22. package/src/components/advance-invoices/list/locales/hr.ts +3 -0
  23. package/src/components/advance-invoices/list/locales/it.ts +3 -0
  24. package/src/components/advance-invoices/list/locales/nl.ts +3 -0
  25. package/src/components/advance-invoices/list/locales/pl.ts +3 -0
  26. package/src/components/advance-invoices/list/locales/pt.ts +3 -0
  27. package/src/components/advance-invoices/list/locales/sl.ts +3 -0
  28. package/src/components/credit-notes/create/create-credit-note-form.tsx +177 -6
  29. package/src/components/credit-notes/create/locales/de.ts +8 -0
  30. package/src/components/credit-notes/create/locales/es.ts +8 -0
  31. package/src/components/credit-notes/create/locales/fr.ts +7 -0
  32. package/src/components/credit-notes/create/locales/hr.ts +7 -0
  33. package/src/components/credit-notes/create/locales/it.ts +9 -0
  34. package/src/components/credit-notes/create/locales/nl.ts +7 -0
  35. package/src/components/credit-notes/create/locales/pl.ts +7 -0
  36. package/src/components/credit-notes/create/locales/pt.ts +7 -0
  37. package/src/components/credit-notes/create/locales/sl.ts +7 -0
  38. package/src/components/credit-notes/credit-notes.hooks.ts +30 -0
  39. package/src/components/credit-notes/list/list-row-actions.tsx +3 -6
  40. package/src/components/credit-notes/list/list-table.tsx +45 -2
  41. package/src/components/credit-notes/list/locales/de.ts +3 -0
  42. package/src/components/credit-notes/list/locales/en.ts +3 -0
  43. package/src/components/credit-notes/list/locales/es.ts +3 -0
  44. package/src/components/credit-notes/list/locales/fr.ts +3 -0
  45. package/src/components/credit-notes/list/locales/hr.ts +3 -0
  46. package/src/components/credit-notes/list/locales/it.ts +3 -0
  47. package/src/components/credit-notes/list/locales/nl.ts +3 -0
  48. package/src/components/credit-notes/list/locales/pl.ts +3 -0
  49. package/src/components/credit-notes/list/locales/pt.ts +3 -0
  50. package/src/components/credit-notes/list/locales/sl.ts +3 -0
  51. package/src/components/customers/create-customer-form/create-customer-form.tsx +0 -1
  52. package/src/components/documents/create/document-details-section.tsx +67 -1
  53. package/src/components/documents/create/mark-as-paid-section.tsx +11 -2
  54. package/src/components/documents/view/document-actions-bar.tsx +30 -0
  55. package/src/components/documents/view/locales/de.ts +5 -0
  56. package/src/components/documents/view/locales/es.ts +5 -0
  57. package/src/components/documents/view/locales/fr.ts +5 -0
  58. package/src/components/documents/view/locales/hr.ts +5 -0
  59. package/src/components/documents/view/locales/it.ts +5 -0
  60. package/src/components/documents/view/locales/nl.ts +5 -0
  61. package/src/components/documents/view/locales/pl.ts +5 -0
  62. package/src/components/documents/view/locales/pt.ts +5 -0
  63. package/src/components/documents/view/locales/sl.ts +5 -0
  64. package/src/components/entities/create-entity-form.tsx +1 -1
  65. package/src/components/entities/entity-settings-form/entity-settings-form.tsx +2 -3
  66. package/src/components/entities/entity-settings-form/locales/es.ts +2 -0
  67. package/src/components/entities/entity-settings-form/locales/fr.ts +2 -0
  68. package/src/components/entities/entity-settings-form/locales/hr.ts +2 -0
  69. package/src/components/entities/entity-settings-form/locales/it.ts +2 -0
  70. package/src/components/entities/entity-settings-form/locales/nl.ts +2 -0
  71. package/src/components/entities/entity-settings-form/locales/pl.ts +2 -0
  72. package/src/components/entities/entity-settings-form/locales/pt.ts +2 -0
  73. package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +109 -0
  74. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +365 -35
  75. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +101 -20
  76. package/src/components/entities/fina-settings-form/index.ts +1 -0
  77. package/src/components/entities/fina-settings-form/locales/de.ts +54 -34
  78. package/src/components/entities/fina-settings-form/locales/en.ts +51 -34
  79. package/src/components/entities/fina-settings-form/locales/es.ts +50 -34
  80. package/src/components/entities/fina-settings-form/locales/fr.ts +50 -34
  81. package/src/components/entities/fina-settings-form/locales/hr.ts +50 -34
  82. package/src/components/entities/fina-settings-form/locales/it.ts +50 -34
  83. package/src/components/entities/fina-settings-form/locales/nl.ts +50 -34
  84. package/src/components/entities/fina-settings-form/locales/pl.ts +50 -34
  85. package/src/components/entities/fina-settings-form/locales/pt.ts +50 -34
  86. package/src/components/entities/fina-settings-form/locales/sl.ts +50 -34
  87. package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +18 -0
  88. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +64 -89
  89. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +51 -323
  90. package/src/components/entities/furs-settings-form/furs-operator-required-dialog.tsx +106 -0
  91. package/src/components/entities/furs-settings-form/furs-settings-form.tsx +24 -10
  92. package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +5 -9
  93. package/src/components/entities/furs-settings-form/index.ts +1 -0
  94. package/src/components/entities/furs-settings-form/locales/de.ts +27 -3
  95. package/src/components/entities/furs-settings-form/locales/en.ts +17 -3
  96. package/src/components/entities/furs-settings-form/locales/es.ts +26 -3
  97. package/src/components/entities/furs-settings-form/locales/fr.ts +26 -3
  98. package/src/components/entities/furs-settings-form/locales/hr.ts +26 -3
  99. package/src/components/entities/furs-settings-form/locales/it.ts +26 -3
  100. package/src/components/entities/furs-settings-form/locales/nl.ts +26 -3
  101. package/src/components/entities/furs-settings-form/locales/pl.ts +26 -3
  102. package/src/components/entities/furs-settings-form/locales/pt.ts +26 -3
  103. package/src/components/entities/furs-settings-form/locales/sl.ts +16 -3
  104. package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +22 -0
  105. package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +15 -2
  106. package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +1 -0
  107. package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +58 -34
  108. package/src/components/entities/settings/tax-rules-settings-form.tsx +4 -4
  109. package/src/components/estimates/list/list-row-actions.tsx +3 -7
  110. package/src/components/estimates/list/list-table.tsx +35 -2
  111. package/src/components/estimates/list/locales/de.ts +3 -0
  112. package/src/components/estimates/list/locales/en.ts +3 -0
  113. package/src/components/estimates/list/locales/es.ts +3 -0
  114. package/src/components/estimates/list/locales/fr.ts +3 -0
  115. package/src/components/estimates/list/locales/hr.ts +3 -0
  116. package/src/components/estimates/list/locales/it.ts +3 -0
  117. package/src/components/estimates/list/locales/nl.ts +3 -0
  118. package/src/components/estimates/list/locales/pl.ts +3 -0
  119. package/src/components/estimates/list/locales/pt.ts +3 -0
  120. package/src/components/estimates/list/locales/sl.ts +3 -0
  121. package/src/components/export/document-export-form.tsx +34 -34
  122. package/src/components/invoices/create/create-invoice-form.tsx +107 -5
  123. package/src/components/invoices/create/prepare-invoice-submission.ts +17 -0
  124. package/src/components/invoices/invoices.hooks.ts +32 -2
  125. package/src/components/invoices/list/list-row-actions.tsx +23 -8
  126. package/src/components/invoices/list/list-table.tsx +53 -2
  127. package/src/components/invoices/list/locales/de.ts +4 -0
  128. package/src/components/invoices/list/locales/en.ts +4 -0
  129. package/src/components/invoices/list/locales/es.ts +4 -0
  130. package/src/components/invoices/list/locales/fr.ts +4 -0
  131. package/src/components/invoices/list/locales/hr.ts +4 -0
  132. package/src/components/invoices/list/locales/it.ts +4 -0
  133. package/src/components/invoices/list/locales/nl.ts +4 -0
  134. package/src/components/invoices/list/locales/pl.ts +4 -0
  135. package/src/components/invoices/list/locales/pt.ts +4 -0
  136. package/src/components/invoices/list/locales/sl.ts +4 -0
  137. package/src/components/invoices/view/fiscalization-status-card.tsx +4 -1
  138. package/src/components/items/item-list-table/item-list-row-actions.tsx +3 -7
  139. package/src/components/items/item-list-table/item-list-row.tsx +3 -2
  140. package/src/components/items/item-list-table/item-list-table.tsx +5 -1
  141. package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +418 -0
  142. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/de.ts +45 -0
  143. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/es.ts +44 -0
  144. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fr.ts +44 -0
  145. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +44 -0
  146. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/it.ts +44 -0
  147. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nl.ts +44 -0
  148. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pl.ts +44 -0
  149. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pt.ts +44 -0
  150. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +44 -0
  151. package/src/components/recurring-invoices/index.ts +3 -0
  152. package/src/components/recurring-invoices/list/index.ts +2 -0
  153. package/src/components/recurring-invoices/list/list-row-actions.tsx +139 -0
  154. package/src/components/recurring-invoices/list/list-table.tsx +179 -0
  155. package/src/components/recurring-invoices/list/locales/de.ts +27 -0
  156. package/src/components/recurring-invoices/list/locales/en.ts +5 -0
  157. package/src/components/recurring-invoices/list/locales/es.ts +27 -0
  158. package/src/components/recurring-invoices/list/locales/fr.ts +27 -0
  159. package/src/components/recurring-invoices/list/locales/hr.ts +27 -0
  160. package/src/components/recurring-invoices/list/locales/it.ts +27 -0
  161. package/src/components/recurring-invoices/list/locales/nl.ts +27 -0
  162. package/src/components/recurring-invoices/list/locales/pl.ts +27 -0
  163. package/src/components/recurring-invoices/list/locales/pt.ts +27 -0
  164. package/src/components/recurring-invoices/list/locales/sl.ts +27 -0
  165. package/src/components/recurring-invoices/recurring-invoices.hooks.ts +28 -0
  166. package/src/components/table/data-table.tsx +122 -5
  167. package/src/components/table/selection-toolbar.tsx +36 -0
  168. package/src/components/tax-reports/kir-export-form.tsx +75 -55
  169. package/src/components/taxes/tax-list-table/tax-list-row-actions.tsx +3 -6
  170. package/src/components/taxes/tax-list-table/tax-list-row.tsx +3 -2
  171. package/src/components/taxes/tax-list-table/tax-list-table.tsx +5 -1
  172. package/src/components/ui/checkbox.tsx +5 -5
  173. package/src/generate-schemas.ts +46 -7
  174. package/src/generated/schemas/advanceinvoice.ts +79 -187
  175. package/src/generated/schemas/authorizeshopify_body.ts +22 -0
  176. package/src/generated/schemas/creditnote.ts +60 -88
  177. package/src/generated/schemas/customadvanceinvoice.ts +70 -97
  178. package/src/generated/schemas/customcreditnote.ts +70 -97
  179. package/src/generated/schemas/customestimate.ts +68 -97
  180. package/src/generated/schemas/custominvoice.ts +70 -97
  181. package/src/generated/schemas/entity.ts +1 -1
  182. package/src/generated/schemas/estimate.ts +67 -172
  183. package/src/generated/schemas/index.ts +39 -28
  184. package/src/generated/schemas/invoice.ts +79 -187
  185. package/src/generated/schemas/order.ts +127 -0
  186. package/src/generated/schemas/orderintegration.ts +51 -0
  187. package/src/generated/schemas/payment.ts +2 -0
  188. package/src/generated/schemas/recurringinvoice.ts +61 -0
  189. package/src/generated/schemas/registerfursrealestatepremise_body.ts +11 -7
  190. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +140 -269
  191. package/src/generated/schemas/rendercreditnotepreview_body.ts +141 -270
  192. package/src/generated/schemas/renderestimatepreview_body.ts +112 -212
  193. package/src/generated/schemas/renderinvoicepreview_body.ts +141 -270
  194. package/src/generated/schemas/webhook.ts +42 -0
  195. package/src/lib/furs-error-utils.ts +36 -0
  196. package/src/lib/schemas/advance-invoice.ts +3 -3
  197. package/src/lib/schemas/credit-note.ts +3 -3
  198. package/src/lib/schemas/estimate.ts +3 -3
  199. package/src/lib/schemas/invoice.ts +3 -3
  200. package/src/providers/white-label-provider.tsx +3 -0
@@ -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([
@@ -155,5 +129,3 @@ export type UpdateCreditNoteSchema = z.infer<typeof updateCreditNoteSchemaDefini
155
129
 
156
130
  export const updateCreditNoteSchema = updateCreditNoteSchemaDefinition;
157
131
 
158
- // Re-export invoice create schema as credit note create schema (same body structure)
159
- export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';
@@ -15,6 +15,18 @@ const LineDiscount = z.object({
15
15
  });
16
16
 
17
17
 
18
+ // Dependency schema for customadvanceinvoice
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
+
18
30
  // Dependency schema for customadvanceinvoice
19
31
  const FinaFiscalizationResponse = z.union([
20
32
  z
@@ -35,6 +47,8 @@ const FinaFiscalizationResponse = z.union([
35
47
  numbering_sequence: z.string().optional(),
36
48
  payload: z.object({}).partial().passthrough(),
37
49
  subsequent_submit: z.boolean().optional(),
50
+ issuer_oib: z.string().optional(),
51
+ operator_label: z.string().optional(),
38
52
  })
39
53
  .passthrough()
40
54
  .optional(),
@@ -62,6 +76,55 @@ const EslogData = z.union([
62
76
  ]);
63
77
 
64
78
 
79
+ // Dependency schema for customadvanceinvoice
80
+ const DocumentSummaryTax = z
81
+ .object({
82
+ rate: z.number(),
83
+ base: z.number(),
84
+ amount: z.number(),
85
+ reverse_charge: z.boolean().optional(),
86
+ })
87
+ .passthrough();
88
+
89
+
90
+ // Dependency schema for customadvanceinvoice
91
+ const DocumentEntity = z
92
+ .object({
93
+ name: z.union([z.string(), z.null()]),
94
+ email: z.union([z.string(), z.null()]),
95
+ address: z.union([z.string(), z.null()]),
96
+ address_2: z.union([z.string(), z.null()]),
97
+ post_code: z.union([z.string(), z.null()]),
98
+ city: z.union([z.string(), z.null()]),
99
+ state: z.union([z.string(), z.null()]),
100
+ country: z.union([z.string(), z.null()]),
101
+ country_code: z.union([z.string(), z.null()]),
102
+ tax_number: z.union([z.string(), z.null()]),
103
+ tax_number_2: z.union([z.string(), z.null()]),
104
+ company_number: z.union([z.string(), z.null()]),
105
+ bank_account: z.union([
106
+ z
107
+ .object({
108
+ type: z
109
+ .enum(["iban", "us_domestic", "uk_domestic", "other"])
110
+ .default("iban"),
111
+ name: z.string(),
112
+ bank_name: z.string(),
113
+ iban: z.string(),
114
+ account_number: z.string(),
115
+ bic: z.string(),
116
+ routing_number: z.string(),
117
+ sort_code: z.string(),
118
+ })
119
+ .partial()
120
+ .passthrough(),
121
+ z.null(),
122
+ ]),
123
+ })
124
+ .partial()
125
+ .passthrough();
126
+
127
+
65
128
  // Schema for create customadvanceinvoice operation
66
129
  const createCustomAdvanceInvoiceSchemaDefinition = z.object({
67
130
  is_draft: z.boolean().optional(),
@@ -69,100 +132,22 @@ const createCustomAdvanceInvoiceSchemaDefinition = z.object({
69
132
  .string()
70
133
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
71
134
  .optional(),
72
- issuer: z
73
- .object({
74
- name: z.union([z.string(), z.null()]),
75
- email: z.union([z.string(), z.null()]),
76
- address: z.union([z.string(), z.null()]),
77
- address_2: z.union([z.string(), z.null()]),
78
- post_code: z.union([z.string(), z.null()]),
79
- city: z.union([z.string(), z.null()]),
80
- state: z.union([z.string(), z.null()]),
81
- country: z.union([z.string(), z.null()]),
82
- country_code: z.union([z.string(), z.null()]),
83
- tax_number: z.union([z.string(), z.null()]),
84
- tax_number_2: z.union([z.string(), z.null()]),
85
- company_number: z.union([z.string(), z.null()]),
86
- bank_account: z.union([
87
- z
88
- .object({
89
- type: z
90
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
91
- .default("iban"),
92
- name: z.string(),
93
- bank_name: z.string(),
94
- iban: z.string(),
95
- account_number: z.string(),
96
- bic: z.string(),
97
- routing_number: z.string(),
98
- sort_code: z.string(),
99
- })
100
- .partial()
101
- .passthrough(),
102
- z.null(),
103
- ]),
104
- })
105
- .partial()
106
- .passthrough()
107
- .optional(),
135
+ issuer: DocumentEntity.optional(),
108
136
  customer_id: z.union([z.string(), z.null()]).optional(),
109
- customer: z
110
- .union([
137
+ customer: DocumentEntity.and(
138
+ z.union([
111
139
  z
112
- .object({
113
- name: z.union([z.string(), z.null()]),
114
- email: z.union([z.string(), z.null()]),
115
- address: z.union([z.string(), z.null()]),
116
- address_2: z.union([z.string(), z.null()]),
117
- post_code: z.union([z.string(), z.null()]),
118
- city: z.union([z.string(), z.null()]),
119
- state: z.union([z.string(), z.null()]),
120
- country: z.union([z.string(), z.null()]),
121
- country_code: z.union([z.string(), z.null()]),
122
- tax_number: z.union([z.string(), z.null()]),
123
- tax_number_2: z.union([z.string(), z.null()]),
124
- company_number: z.union([z.string(), z.null()]),
125
- bank_account: z.union([
126
- z
127
- .object({
128
- type: z
129
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
130
- .default("iban"),
131
- name: z.string(),
132
- bank_name: z.string(),
133
- iban: z.string(),
134
- account_number: z.string(),
135
- bic: z.string(),
136
- routing_number: z.string(),
137
- sort_code: z.string(),
138
- })
139
- .partial()
140
- .passthrough(),
141
- z.null(),
142
- ]),
143
- save_customer: z.boolean().default(true),
144
- })
140
+ .object({ save_customer: z.boolean().default(true) })
145
141
  .partial()
146
142
  .passthrough(),
147
143
  z.null(),
148
144
  ])
149
- .optional(),
145
+ ).optional(),
150
146
  note: z.union([z.string(), z.null()]).optional(),
151
147
  tax_clause: z.union([z.string(), z.null()]).optional(),
152
148
  total: z.number(),
153
149
  total_with_tax: z.number(),
154
- taxes: z
155
- .array(
156
- z
157
- .object({
158
- rate: z.number(),
159
- base: z.number(),
160
- amount: z.number(),
161
- reverse_charge: z.boolean().optional(),
162
- })
163
- .passthrough()
164
- )
165
- .optional(),
150
+ taxes: z.array(DocumentSummaryTax).optional(),
166
151
  currency_code: z.string().max(3).optional(),
167
152
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
168
153
  eslog: EslogData.optional(),
@@ -179,19 +164,7 @@ const createCustomAdvanceInvoiceSchemaDefinition = z.object({
179
164
  gross_price: z.number().optional(),
180
165
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
181
166
  unit: z.union([z.string(), z.null()]).optional(),
182
- taxes: z
183
- .array(
184
- z
185
- .object({
186
- rate: z.number(),
187
- tax_id: z.string(),
188
- classification: z.string(),
189
- reverse_charge: z.boolean(),
190
- amount: z.number(),
191
- })
192
- .partial()
193
- )
194
- .optional(),
167
+ taxes: z.array(DocumentItemTax).optional(),
195
168
  discounts: z.array(LineDiscount).max(5).optional(),
196
169
  total: z.number(),
197
170
  total_with_tax: z.number(),
@@ -15,6 +15,18 @@ const LineDiscount = z.object({
15
15
  });
16
16
 
17
17
 
18
+ // Dependency schema for customcreditnote
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
+
18
30
  // Dependency schema for customcreditnote
19
31
  const FinaFiscalizationResponse = z.union([
20
32
  z
@@ -35,6 +47,8 @@ const FinaFiscalizationResponse = z.union([
35
47
  numbering_sequence: z.string().optional(),
36
48
  payload: z.object({}).partial().passthrough(),
37
49
  subsequent_submit: z.boolean().optional(),
50
+ issuer_oib: z.string().optional(),
51
+ operator_label: z.string().optional(),
38
52
  })
39
53
  .passthrough()
40
54
  .optional(),
@@ -44,6 +58,55 @@ const FinaFiscalizationResponse = z.union([
44
58
  ]);
45
59
 
46
60
 
61
+ // Dependency schema for customcreditnote
62
+ const DocumentSummaryTax = z
63
+ .object({
64
+ rate: z.number(),
65
+ base: z.number(),
66
+ amount: z.number(),
67
+ reverse_charge: z.boolean().optional(),
68
+ })
69
+ .passthrough();
70
+
71
+
72
+ // Dependency schema for customcreditnote
73
+ const DocumentEntity = z
74
+ .object({
75
+ name: z.union([z.string(), z.null()]),
76
+ email: z.union([z.string(), z.null()]),
77
+ address: z.union([z.string(), z.null()]),
78
+ address_2: z.union([z.string(), z.null()]),
79
+ post_code: z.union([z.string(), z.null()]),
80
+ city: z.union([z.string(), z.null()]),
81
+ state: z.union([z.string(), z.null()]),
82
+ country: z.union([z.string(), z.null()]),
83
+ country_code: z.union([z.string(), z.null()]),
84
+ tax_number: z.union([z.string(), z.null()]),
85
+ tax_number_2: z.union([z.string(), z.null()]),
86
+ company_number: z.union([z.string(), z.null()]),
87
+ bank_account: z.union([
88
+ z
89
+ .object({
90
+ type: z
91
+ .enum(["iban", "us_domestic", "uk_domestic", "other"])
92
+ .default("iban"),
93
+ name: z.string(),
94
+ bank_name: z.string(),
95
+ iban: z.string(),
96
+ account_number: z.string(),
97
+ bic: z.string(),
98
+ routing_number: z.string(),
99
+ sort_code: z.string(),
100
+ })
101
+ .partial()
102
+ .passthrough(),
103
+ z.null(),
104
+ ]),
105
+ })
106
+ .partial()
107
+ .passthrough();
108
+
109
+
47
110
  // Schema for create customcreditnote operation
48
111
  const createCustomCreditNoteSchemaDefinition = z.object({
49
112
  is_draft: z.boolean().optional(),
@@ -51,101 +114,23 @@ const createCustomCreditNoteSchemaDefinition = z.object({
51
114
  .string()
52
115
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
53
116
  .optional(),
54
- issuer: z
55
- .object({
56
- name: z.union([z.string(), z.null()]),
57
- email: z.union([z.string(), z.null()]),
58
- address: z.union([z.string(), z.null()]),
59
- address_2: z.union([z.string(), z.null()]),
60
- post_code: z.union([z.string(), z.null()]),
61
- city: z.union([z.string(), z.null()]),
62
- state: z.union([z.string(), z.null()]),
63
- country: z.union([z.string(), z.null()]),
64
- country_code: z.union([z.string(), z.null()]),
65
- tax_number: z.union([z.string(), z.null()]),
66
- tax_number_2: z.union([z.string(), z.null()]),
67
- company_number: z.union([z.string(), z.null()]),
68
- bank_account: z.union([
69
- z
70
- .object({
71
- type: z
72
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
73
- .default("iban"),
74
- name: z.string(),
75
- bank_name: z.string(),
76
- iban: z.string(),
77
- account_number: z.string(),
78
- bic: z.string(),
79
- routing_number: z.string(),
80
- sort_code: z.string(),
81
- })
82
- .partial()
83
- .passthrough(),
84
- z.null(),
85
- ]),
86
- })
87
- .partial()
88
- .passthrough()
89
- .optional(),
117
+ issuer: DocumentEntity.optional(),
90
118
  customer_id: z.union([z.string(), z.null()]).optional(),
91
- customer: z
92
- .union([
119
+ customer: DocumentEntity.and(
120
+ z.union([
93
121
  z
94
- .object({
95
- name: z.union([z.string(), z.null()]),
96
- email: z.union([z.string(), z.null()]),
97
- address: z.union([z.string(), z.null()]),
98
- address_2: z.union([z.string(), z.null()]),
99
- post_code: z.union([z.string(), z.null()]),
100
- city: z.union([z.string(), z.null()]),
101
- state: z.union([z.string(), z.null()]),
102
- country: z.union([z.string(), z.null()]),
103
- country_code: z.union([z.string(), z.null()]),
104
- tax_number: z.union([z.string(), z.null()]),
105
- tax_number_2: z.union([z.string(), z.null()]),
106
- company_number: z.union([z.string(), z.null()]),
107
- bank_account: z.union([
108
- z
109
- .object({
110
- type: z
111
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
112
- .default("iban"),
113
- name: z.string(),
114
- bank_name: z.string(),
115
- iban: z.string(),
116
- account_number: z.string(),
117
- bic: z.string(),
118
- routing_number: z.string(),
119
- sort_code: z.string(),
120
- })
121
- .partial()
122
- .passthrough(),
123
- z.null(),
124
- ]),
125
- save_customer: z.boolean().default(true),
126
- })
122
+ .object({ save_customer: z.boolean().default(true) })
127
123
  .partial()
128
124
  .passthrough(),
129
125
  z.null(),
130
126
  ])
131
- .optional(),
127
+ ).optional(),
132
128
  note: z.union([z.string(), z.null()]).optional(),
133
129
  payment_terms: z.union([z.string(), z.null()]).optional(),
134
130
  tax_clause: z.union([z.string(), z.null()]).optional(),
135
131
  total: z.number(),
136
132
  total_with_tax: z.number(),
137
- taxes: z
138
- .array(
139
- z
140
- .object({
141
- rate: z.number(),
142
- base: z.number(),
143
- amount: z.number(),
144
- reverse_charge: z.boolean().optional(),
145
- })
146
- .passthrough()
147
- )
148
- .optional(),
133
+ taxes: z.array(DocumentSummaryTax).optional(),
149
134
  currency_code: z.string().max(3).optional(),
150
135
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
151
136
  fina: FinaFiscalizationResponse.optional(),
@@ -161,19 +146,7 @@ const createCustomCreditNoteSchemaDefinition = z.object({
161
146
  gross_price: z.number().optional(),
162
147
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
163
148
  unit: z.union([z.string(), z.null()]).optional(),
164
- taxes: z
165
- .array(
166
- z
167
- .object({
168
- rate: z.number(),
169
- tax_id: z.string(),
170
- classification: z.string(),
171
- reverse_charge: z.boolean(),
172
- amount: z.number(),
173
- })
174
- .partial()
175
- )
176
- .optional(),
149
+ taxes: z.array(DocumentItemTax).optional(),
177
150
  discounts: z.array(LineDiscount).max(5).optional(),
178
151
  total: z.number(),
179
152
  total_with_tax: z.number(),