@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
@@ -9,147 +9,53 @@ import { z } from 'zod';
9
9
  // Schemas for renderestimatepreview_body endpoints
10
10
 
11
11
  // Dependency schema for renderestimatepreview_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 renderestimatepreview_body
19
- const CompleteEstimatePreview = z.object({
20
- is_draft: z.boolean().optional(),
21
- date: z
22
- .string()
23
- .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
24
- .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(),
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
- 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),
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
- .optional(),
103
- note: z.union([z.string(), z.null()]).optional(),
104
- payment_terms: z.union([z.string(), z.null()]).optional(),
105
- tax_clause: z.union([z.string(), z.null()]).optional(),
106
- currency_code: z.string().max(3).optional(),
107
- metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
108
- date_valid_till: z.union([z.string(), z.null()]).optional(),
109
- title_type: z.union([z.enum(["estimate", "quote"]), z.null()]).optional(),
110
- date_due: z.union([z.string(), z.null()]).optional(),
111
- date_service: z.union([z.string(), z.null()]).optional(),
112
- date_service_to: z.union([z.string(), z.null()]).optional(),
113
- items: z
114
- .array(
115
- z.object({
116
- name: z.string().min(1).optional(),
117
- description: z.union([z.string(), z.null()]).optional(),
118
- price: z.number().optional(),
119
- gross_price: z.number().optional(),
120
- quantity: z.number().gte(-140737488355328).lte(140737488355327),
121
- unit: z.union([z.string(), z.null()]).optional(),
122
- taxes: z
123
- .array(
124
- z
125
- .object({
126
- rate: z.number(),
127
- tax_id: z.string(),
128
- classification: z.string(),
129
- reverse_charge: z.boolean(),
130
- amount: z.number(),
131
- })
132
- .partial()
133
- )
134
- .optional(),
135
- discounts: z.array(LineDiscount).max(5).optional(),
136
- metadata: z
137
- .union([
138
- z.string(),
139
- z.number(),
140
- z.boolean(),
141
- z.null(),
142
- z.object({}).partial().passthrough(),
143
- z.array(z.unknown()),
144
- z.null(),
145
- ])
146
- .optional(),
147
- item_id: z.string().optional(),
148
- })
149
- )
150
- .min(1),
151
- expected_total_with_tax: z.number().gt(0).optional(),
152
- });
43
+ ]),
44
+ })
45
+ .partial()
46
+ .passthrough();
47
+
48
+
49
+ // Dependency schema for renderestimatepreview_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
+ );
153
59
 
154
60
 
155
61
  // Dependency schema for renderestimatepreview_body
@@ -159,84 +65,9 @@ const PartialEstimatePreview = z.object({
159
65
  .string()
160
66
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
161
67
  .optional(),
162
- issuer: z
163
- .object({
164
- name: z.union([z.string(), z.null()]),
165
- email: z.union([z.string(), z.null()]),
166
- address: z.union([z.string(), z.null()]),
167
- address_2: z.union([z.string(), z.null()]),
168
- post_code: z.union([z.string(), z.null()]),
169
- city: z.union([z.string(), z.null()]),
170
- state: z.union([z.string(), z.null()]),
171
- country: z.union([z.string(), z.null()]),
172
- country_code: z.union([z.string(), z.null()]),
173
- tax_number: z.union([z.string(), z.null()]),
174
- tax_number_2: z.union([z.string(), z.null()]),
175
- company_number: z.union([z.string(), z.null()]),
176
- bank_account: z.union([
177
- z
178
- .object({
179
- type: z
180
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
181
- .default("iban"),
182
- name: z.string(),
183
- bank_name: z.string(),
184
- iban: z.string(),
185
- account_number: z.string(),
186
- bic: z.string(),
187
- routing_number: z.string(),
188
- sort_code: z.string(),
189
- })
190
- .partial()
191
- .passthrough(),
192
- z.null(),
193
- ]),
194
- })
195
- .partial()
196
- .passthrough()
197
- .optional(),
68
+ issuer: DocumentEntity.optional(),
198
69
  customer_id: z.union([z.string(), z.null()]).optional(),
199
- customer: z
200
- .union([
201
- z
202
- .object({
203
- name: z.union([z.string(), z.null()]),
204
- email: z.union([z.string(), z.null()]),
205
- address: z.union([z.string(), z.null()]),
206
- address_2: z.union([z.string(), z.null()]),
207
- post_code: z.union([z.string(), z.null()]),
208
- city: z.union([z.string(), z.null()]),
209
- state: z.union([z.string(), z.null()]),
210
- country: z.union([z.string(), z.null()]),
211
- country_code: z.union([z.string(), z.null()]),
212
- tax_number: z.union([z.string(), z.null()]),
213
- tax_number_2: z.union([z.string(), z.null()]),
214
- company_number: z.union([z.string(), z.null()]),
215
- bank_account: z.union([
216
- z
217
- .object({
218
- type: z
219
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
220
- .default("iban"),
221
- name: z.string(),
222
- bank_name: z.string(),
223
- iban: z.string(),
224
- account_number: z.string(),
225
- bic: z.string(),
226
- routing_number: z.string(),
227
- sort_code: z.string(),
228
- })
229
- .partial()
230
- .passthrough(),
231
- z.null(),
232
- ]),
233
- save_customer: z.boolean().default(true),
234
- })
235
- .partial()
236
- .passthrough(),
237
- z.null(),
238
- ])
239
- .optional(),
70
+ customer: CreateDocumentCustomer.optional(),
240
71
  note: z.union([z.string(), z.null()]).optional(),
241
72
  payment_terms: z.union([z.string(), z.null()]).optional(),
242
73
  tax_clause: z.union([z.string(), z.null()]).optional(),
@@ -272,6 +103,75 @@ const PartialEstimatePreview = z.object({
272
103
  });
273
104
 
274
105
 
106
+ // Dependency schema for renderestimatepreview_body
107
+ const DocumentItemTax = z
108
+ .object({
109
+ rate: z.number(),
110
+ tax_id: z.string(),
111
+ classification: z.string(),
112
+ reverse_charge: z.boolean(),
113
+ amount: z.number(),
114
+ })
115
+ .partial();
116
+
117
+
118
+ // Dependency schema for renderestimatepreview_body
119
+ const LineDiscount = z.object({
120
+ value: z.number().gte(0),
121
+ type: z.enum(["percent", "amount"]).optional().default("percent"),
122
+ });
123
+
124
+
125
+ // Dependency schema for renderestimatepreview_body
126
+ const CreateDocumentItem = z.object({
127
+ name: z.string().min(1).optional(),
128
+ description: z.union([z.string(), z.null()]).optional(),
129
+ price: z.number().optional(),
130
+ gross_price: z.number().optional(),
131
+ quantity: z.number().gte(-140737488355328).lte(140737488355327),
132
+ unit: z.union([z.string(), z.null()]).optional(),
133
+ taxes: z.array(DocumentItemTax).optional(),
134
+ discounts: z.array(LineDiscount).max(5).optional(),
135
+ metadata: z
136
+ .union([
137
+ z.string(),
138
+ z.number(),
139
+ z.boolean(),
140
+ z.null(),
141
+ z.object({}).partial().passthrough(),
142
+ z.array(z.unknown()),
143
+ z.null(),
144
+ ])
145
+ .optional(),
146
+ item_id: z.string().optional(),
147
+ });
148
+
149
+
150
+ // Dependency schema for renderestimatepreview_body
151
+ const CompleteEstimatePreview = z.object({
152
+ is_draft: z.boolean().optional(),
153
+ date: z
154
+ .string()
155
+ .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
156
+ .optional(),
157
+ issuer: DocumentEntity.optional(),
158
+ customer_id: z.union([z.string(), z.null()]).optional(),
159
+ customer: CreateDocumentCustomer.optional(),
160
+ note: z.union([z.string(), z.null()]).optional(),
161
+ payment_terms: z.union([z.string(), z.null()]).optional(),
162
+ tax_clause: z.union([z.string(), z.null()]).optional(),
163
+ currency_code: z.string().max(3).optional(),
164
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
165
+ date_valid_till: z.union([z.string(), z.null()]).optional(),
166
+ title_type: z.union([z.enum(["estimate", "quote"]), z.null()]).optional(),
167
+ date_due: z.union([z.string(), z.null()]).optional(),
168
+ date_service: z.union([z.string(), z.null()]).optional(),
169
+ date_service_to: z.union([z.string(), z.null()]).optional(),
170
+ items: z.array(CreateDocumentItem).min(1),
171
+ expected_total_with_tax: z.number().gt(0).optional(),
172
+ });
173
+
174
+
275
175
  // Schema for render estimatepreview operation
276
176
  const renderEstimatePreviewSchemaDefinition = z.union([
277
177
  PartialEstimatePreview,