@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
@@ -4,40 +4,51 @@
4
4
  * @generated
5
5
  */
6
6
 
7
- export * from './invoice';
8
- export * from './custominvoice';
9
- export * from './renderinvoicepreview_body';
10
- export * from './estimate';
11
- export * from './customestimate';
12
- export * from './renderestimatepreview_body';
13
- export * from './customcreditnote';
14
- export * from './creditnote';
15
- export * from './rendercreditnotepreview_body';
7
+ export * from './acceptentityinvitation_body';
8
+ export * from './addentityuser_body';
16
9
  export * from './advanceinvoice';
10
+ export * from './authorizeshopify_body';
11
+ export * from './creditnote';
17
12
  export * from './customadvanceinvoice';
18
- export * from './renderadvanceinvoicepreview_body';
19
- export * from './senddocument_body';
20
- export * from './addentityuser_body';
21
- export * from './entityuserrole';
22
- export * from './acceptentityinvitation_body';
13
+ export * from './customcreditnote';
14
+ export * from './customer';
15
+ export * from './customestimate';
16
+ export * from './custominvoice';
23
17
  export * from './entity';
24
- export * from './startpdfexport_body';
18
+ export * from './entityuserrole';
19
+ export * from './estimate';
20
+ export * from './finasettings';
21
+ export * from './furssettings';
22
+ export * from './invoice';
25
23
  export * from './item';
24
+ export * from './me';
25
+ export * from './order';
26
+ export * from './orderintegration';
26
27
  export * from './payment';
28
+ export * from './previewadvanceinvoice_body';
29
+ export * from './previewestimate_body';
30
+ export * from './recurringinvoice';
31
+ export * from './registerfinamovablepremise_body';
32
+ export * from './registerfinarealestatepremise_body';
33
+ export * from './registerfursmovablepremise_body';
34
+ export * from './registerfursrealestatepremise_body';
35
+ export * from './renderadvanceinvoicepreview_body';
36
+ export * from './rendercreditnotepreview_body';
37
+ export * from './renderdocument_body';
38
+ export * from './renderestimatepreview_body';
39
+ export * from './renderinvoicepreview_body';
40
+ export * from './senddocument_body';
41
+ export * from './sendemail_body';
42
+ export * from './startpdfexport_body';
43
+ export * from './stripeappconnect_body';
44
+ export * from './stripeappcreateinvoice_body';
45
+ export * from './stripeappupdatesettings_body';
27
46
  export * from './tax';
28
47
  export * from './uploadfile_body';
29
- export * from './me';
48
+ export * from './uploadfurscertificate_body';
30
49
  export * from './userfurssettings';
31
- export * from './customer';
32
- export * from './sendemail_body';
33
50
  export * from './webhook';
34
- export * from './furssettings';
35
- export * from './uploadfurscertificate_body';
36
- export * from './registerfursrealestatepremise_body';
37
- export * from './registerfursmovablepremise_body';
38
- export * from './finasettings';
39
- export * from './registerfinarealestatepremise_body';
40
- export * from './registerfinamovablepremise_body';
41
- export * from './stripeappconnect_body';
42
- export * from './stripeappupdatesettings_body';
43
- export * from './stripeappcreateinvoice_body';
51
+
52
+ // Re-export invoice create schema as credit note create schema (same body structure)
53
+ // Placed here (after invoice is exported) to avoid circular dependency issues
54
+ export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';
@@ -8,6 +8,17 @@ import { z } from 'zod';
8
8
 
9
9
  // Schemas for invoice endpoints
10
10
 
11
+ // Dependency schema for invoice
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 invoice
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 invoice
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 invoice
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 invoice operation
19
80
  const createInvoiceSchemaDefinition = z.object({
20
81
  is_draft: z.boolean().optional(),
@@ -22,84 +83,17 @@ const createInvoiceSchemaDefinition = 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
  payment_terms: z.union([z.string(), z.null()]).optional(),
105
99
  tax_clause: z.union([z.string(), z.null()]).optional(),
@@ -117,19 +111,7 @@ const createInvoiceSchemaDefinition = z.object({
117
111
  gross_price: z.number().optional(),
118
112
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
119
113
  unit: z.union([z.string(), z.null()]).optional(),
120
- taxes: z
121
- .array(
122
- z
123
- .object({
124
- rate: z.number(),
125
- tax_id: z.string(),
126
- classification: z.string(),
127
- reverse_charge: z.boolean(),
128
- amount: z.number(),
129
- })
130
- .partial()
131
- )
132
- .optional(),
114
+ taxes: z.array(DocumentItemTax).optional(),
133
115
  discounts: z.array(LineDiscount).max(5).optional(),
134
116
  metadata: z
135
117
  .union([
@@ -147,21 +129,7 @@ const createInvoiceSchemaDefinition = z.object({
147
129
  )
148
130
  .min(1),
149
131
  linked_documents: z.array(z.string().min(1)).optional(),
150
- payments: z
151
- .union([
152
- z.array(
153
- z.object({
154
- amount: z.number().gt(0).optional(),
155
- type: z.string().max(20),
156
- date: z.string().optional(),
157
- reference: z.union([z.string(), z.null()]).optional(),
158
- note: z.union([z.string(), z.null()]).optional(),
159
- metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
160
- })
161
- ),
162
- z.null(),
163
- ])
164
- .optional(),
132
+ payments: z.union([z.array(CreateDocumentPayment), z.null()]).optional(),
165
133
  furs: z
166
134
  .union([
167
135
  z
@@ -230,81 +198,17 @@ const updateInvoiceSchemaDefinition = z
230
198
  date: z
231
199
  .string()
232
200
  .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/),
233
- issuer: z
234
- .object({
235
- name: z.union([z.string(), z.null()]),
236
- email: z.union([z.string(), z.null()]),
237
- address: z.union([z.string(), z.null()]),
238
- address_2: z.union([z.string(), z.null()]),
239
- post_code: z.union([z.string(), z.null()]),
240
- city: z.union([z.string(), z.null()]),
241
- state: z.union([z.string(), z.null()]),
242
- country: z.union([z.string(), z.null()]),
243
- country_code: z.union([z.string(), z.null()]),
244
- tax_number: z.union([z.string(), z.null()]),
245
- tax_number_2: z.union([z.string(), z.null()]),
246
- company_number: z.union([z.string(), z.null()]),
247
- bank_account: z.union([
248
- z
249
- .object({
250
- type: z
251
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
252
- .default("iban"),
253
- name: z.string(),
254
- bank_name: z.string(),
255
- iban: z.string(),
256
- account_number: z.string(),
257
- bic: z.string(),
258
- routing_number: z.string(),
259
- sort_code: z.string(),
260
- })
261
- .partial()
262
- .passthrough(),
263
- z.null(),
264
- ]),
265
- })
266
- .partial()
267
- .passthrough(),
201
+ issuer: DocumentEntity.and(z.unknown()),
268
202
  customer_id: z.union([z.string(), z.null()]),
269
- customer: z.union([
270
- z
271
- .object({
272
- name: z.union([z.string(), z.null()]),
273
- email: z.union([z.string(), z.null()]),
274
- address: z.union([z.string(), z.null()]),
275
- address_2: z.union([z.string(), z.null()]),
276
- post_code: z.union([z.string(), z.null()]),
277
- city: z.union([z.string(), z.null()]),
278
- state: z.union([z.string(), z.null()]),
279
- country: z.union([z.string(), z.null()]),
280
- country_code: z.union([z.string(), z.null()]),
281
- tax_number: z.union([z.string(), z.null()]),
282
- tax_number_2: z.union([z.string(), z.null()]),
283
- company_number: z.union([z.string(), z.null()]),
284
- bank_account: z.union([
285
- z
286
- .object({
287
- type: z
288
- .enum(["iban", "us_domestic", "uk_domestic", "other"])
289
- .default("iban"),
290
- name: z.string(),
291
- bank_name: z.string(),
292
- iban: z.string(),
293
- account_number: z.string(),
294
- bic: z.string(),
295
- routing_number: z.string(),
296
- sort_code: z.string(),
297
- })
298
- .partial()
299
- .passthrough(),
300
- z.null(),
301
- ]),
302
- save_customer: z.boolean().default(true),
303
- })
304
- .partial()
305
- .passthrough(),
306
- z.null(),
307
- ]),
203
+ customer: DocumentEntity.and(
204
+ z.union([
205
+ z
206
+ .object({ save_customer: z.boolean().default(true) })
207
+ .partial()
208
+ .passthrough(),
209
+ z.null(),
210
+ ])
211
+ ),
308
212
  items: z
309
213
  .array(
310
214
  z.object({
@@ -314,19 +218,7 @@ const updateInvoiceSchemaDefinition = z
314
218
  gross_price: z.number().optional(),
315
219
  quantity: z.number().gte(-140737488355328).lte(140737488355327),
316
220
  unit: z.union([z.string(), z.null()]).optional(),
317
- taxes: z
318
- .array(
319
- z
320
- .object({
321
- rate: z.number(),
322
- tax_id: z.string(),
323
- classification: z.string(),
324
- reverse_charge: z.boolean(),
325
- amount: z.number(),
326
- })
327
- .partial()
328
- )
329
- .optional(),
221
+ taxes: z.array(DocumentItemTax).optional(),
330
222
  discounts: z.array(LineDiscount).max(5).optional(),
331
223
  metadata: z
332
224
  .union([
@@ -0,0 +1,127 @@
1
+ /**
2
+ * This file was automatically generated using 'bun generate-schemas'.
3
+ * Do not edit this file manually. To update, run the generator again.
4
+ * @generated
5
+ */
6
+
7
+ import { z } from 'zod';
8
+
9
+ // Schemas for order endpoints
10
+
11
+ // Dependency schema for order
12
+ const OrderCustomer = z.union([
13
+ z
14
+ .object({
15
+ phone: z.string(),
16
+ company_name: z.string(),
17
+ tax_number: z.string(),
18
+ company_number: z.string(),
19
+ is_business: z.boolean(),
20
+ notes: z.string(),
21
+ })
22
+ .partial()
23
+ .passthrough(),
24
+ z.null(),
25
+ ]);
26
+
27
+
28
+ // Dependency schema for order
29
+ const OrderAddress = z.union([
30
+ z
31
+ .object({
32
+ address: z.string(),
33
+ address_2: z.string(),
34
+ city: z.string(),
35
+ state: z.string(),
36
+ post_code: z.string(),
37
+ country: z.string(),
38
+ country_code: z.string(),
39
+ })
40
+ .partial()
41
+ .passthrough(),
42
+ z.null(),
43
+ ]);
44
+
45
+
46
+ // Dependency schema for order
47
+ const OrderItem = z
48
+ .object({
49
+ name: z.string(),
50
+ quantity: z.number(),
51
+ price: z.number(),
52
+ gross_price: z.number().optional(),
53
+ total: z.number(),
54
+ total_with_tax: z.number(),
55
+ tax_rate: z.number().optional(),
56
+ sku: z.string().optional(),
57
+ source_id: z.string().optional(),
58
+ discount: z.number().optional(),
59
+ unit: z.string().optional(),
60
+ })
61
+ .passthrough();
62
+
63
+
64
+ // Schema for create order operation
65
+ const createOrderSchemaDefinition = z.object({
66
+ order_integration_id: z.string().max(36),
67
+ source: z.string().max(50),
68
+ source_id: z.string().max(255),
69
+ source_order_number: z.union([z.string(), z.null()]).optional(),
70
+ customer_name: z.union([z.string(), z.null()]).optional(),
71
+ customer_email: z.union([z.string(), z.null()]).optional(),
72
+ customer: OrderCustomer.optional(),
73
+ billing_address: OrderAddress.optional(),
74
+ shipping_address: OrderAddress.optional(),
75
+ currency_code: z.string().max(3),
76
+ total: z.number().gte(-140737488355328).lte(140737488355327),
77
+ total_with_tax: z.number().gte(-140737488355328).lte(140737488355327),
78
+ total_discount: z
79
+ .number()
80
+ .gte(-140737488355328)
81
+ .lte(140737488355327)
82
+ .optional(),
83
+ total_shipping: z
84
+ .number()
85
+ .gte(-140737488355328)
86
+ .lte(140737488355327)
87
+ .optional(),
88
+ items: z.array(OrderItem).min(1),
89
+ payment_status: z.string().max(30).optional(),
90
+ payment_method: z.union([z.string(), z.null()]).optional(),
91
+ payment_gateway: z.union([z.string(), z.null()]).optional(),
92
+ ordered_at: z.union([z.string(), z.null()]).optional(),
93
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
94
+ });
95
+
96
+ // Type for create order operation
97
+ export type CreateOrderSchema = z.infer<typeof createOrderSchemaDefinition>;
98
+
99
+
100
+ // Schema for update order operation
101
+ const updateOrderSchemaDefinition = z
102
+ .object({
103
+ source_order_number: z.union([z.string(), z.null()]),
104
+ customer_name: z.union([z.string(), z.null()]),
105
+ customer_email: z.union([z.string(), z.null()]),
106
+ customer: OrderCustomer,
107
+ billing_address: OrderAddress,
108
+ shipping_address: OrderAddress,
109
+ currency_code: z.string().max(3),
110
+ total: z.number().gte(-140737488355328).lte(140737488355327),
111
+ total_with_tax: z.number().gte(-140737488355328).lte(140737488355327),
112
+ total_discount: z.number().gte(-140737488355328).lte(140737488355327),
113
+ total_shipping: z.number().gte(-140737488355328).lte(140737488355327),
114
+ items: z.array(OrderItem).min(1),
115
+ payment_status: z.string().max(30),
116
+ payment_method: z.union([z.string(), z.null()]),
117
+ payment_gateway: z.union([z.string(), z.null()]),
118
+ ordered_at: z.union([z.string(), z.null()]),
119
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]),
120
+ })
121
+ .partial();
122
+
123
+ // Type for update order operation
124
+ export type UpdateOrderSchema = z.infer<typeof updateOrderSchemaDefinition>;
125
+
126
+ export const createOrderSchema = createOrderSchemaDefinition;
127
+ export const updateOrderSchema = updateOrderSchemaDefinition;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This file was automatically generated using 'bun generate-schemas'.
3
+ * Do not edit this file manually. To update, run the generator again.
4
+ * @generated
5
+ */
6
+
7
+ import { z } from 'zod';
8
+
9
+ // Schemas for orderintegration endpoints
10
+
11
+ // Schema for create orderintegration operation
12
+ const createOrderIntegrationSchemaDefinition = z.object({
13
+ name: z.string().min(1),
14
+ source: z
15
+ .enum(["shopify", "woocommerce", "manual"])
16
+ .optional()
17
+ .default("manual"),
18
+ auto_process: z.boolean().optional(),
19
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
20
+ });
21
+
22
+ // Type for create orderintegration operation
23
+ export type CreateOrderIntegrationSchema = z.infer<typeof createOrderIntegrationSchemaDefinition>;
24
+
25
+
26
+ // Schema for update orderintegration operation
27
+ const updateOrderIntegrationSchemaDefinition = z
28
+ .object({
29
+ name: z.string().min(1),
30
+ auto_process: z.boolean(),
31
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]),
32
+ is_active: z.boolean(),
33
+ auto_process_on: z.enum(["created", "paid", "fulfilled"]),
34
+ default_payment_type: z.string(),
35
+ send_invoice_email: z.boolean(),
36
+ send_estimate_email: z.boolean(),
37
+ issue_invoice_for_bank: z.boolean(),
38
+ issue_invoice_on_complete: z.boolean(),
39
+ auto_process_delay_seconds: z.number().int().gte(0),
40
+ auto_reissue_on_update: z.boolean(),
41
+ locale: z.string().max(10),
42
+ business_premise_id: z.string().max(36),
43
+ electronic_device_id: z.string().max(36),
44
+ })
45
+ .partial();
46
+
47
+ // Type for update orderintegration operation
48
+ export type UpdateOrderIntegrationSchema = z.infer<typeof updateOrderIntegrationSchemaDefinition>;
49
+
50
+ export const createOrderIntegrationSchema = createOrderIntegrationSchemaDefinition;
51
+ export const updateOrderIntegrationSchema = updateOrderIntegrationSchemaDefinition;
@@ -16,6 +16,7 @@ const createPaymentSchemaDefinition = z.object({
16
16
  amount: z.number().gt(0),
17
17
  type: z.string().max(20),
18
18
  date: z.string().optional(),
19
+ tag: z.union([z.string(), z.null()]).optional(),
19
20
  reference: z.union([z.string(), z.null()]).optional(),
20
21
  note: z.union([z.string(), z.null()]).optional(),
21
22
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
@@ -31,6 +32,7 @@ const updatePaymentSchemaDefinition = z
31
32
  amount: z.number().gt(0),
32
33
  type: z.string().max(20),
33
34
  date: z.string(),
35
+ tag: z.union([z.string(), z.null()]),
34
36
  reference: z.union([z.string(), z.null()]),
35
37
  note: z.union([z.string(), z.null()]),
36
38
  metadata: z.union([z.record(z.string(), z.any()), z.null()]),
@@ -0,0 +1,61 @@
1
+ /**
2
+ * This file was automatically generated using 'bun generate-schemas'.
3
+ * Do not edit this file manually. To update, run the generator again.
4
+ * @generated
5
+ */
6
+
7
+ import { z } from 'zod';
8
+
9
+ // Schemas for recurringinvoice endpoints
10
+
11
+ // Schema for create recurringinvoice operation
12
+ const createRecurringInvoiceSchemaDefinition = z.object({
13
+ document_id: z.string().max(36),
14
+ name: z.string().min(1),
15
+ frequency: z.enum(["daily", "weekly", "monthly", "yearly"]),
16
+ interval: z.number().int().gte(-2147483648).lte(2147483647).optional(),
17
+ day_of_week: z.union([z.number(), z.null()]).optional(),
18
+ day_of_month: z.union([z.number(), z.null()]).optional(),
19
+ month_of_year: z.union([z.number(), z.null()]).optional(),
20
+ start_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
21
+ end_date: z
22
+ .string()
23
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
24
+ .optional(),
25
+ auto_send: z.boolean().optional(),
26
+ create_as_draft: z.boolean().optional(),
27
+ send_to: z.union([z.string(), z.null()]).optional(),
28
+ payment_terms_days: z.union([z.number(), z.null()]).optional(),
29
+ notify_owner: z.boolean().optional(),
30
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
31
+ });
32
+
33
+ // Type for create recurringinvoice operation
34
+ export type CreateRecurringInvoiceSchema = z.infer<typeof createRecurringInvoiceSchemaDefinition>;
35
+
36
+
37
+ // Schema for update recurringinvoice operation
38
+ const updateRecurringInvoiceSchemaDefinition = z
39
+ .object({
40
+ name: z.string().max(255),
41
+ frequency: z.enum(["daily", "weekly", "monthly", "yearly"]),
42
+ interval: z.number().int().gte(-2147483648).lte(2147483647),
43
+ day_of_week: z.union([z.number(), z.null()]),
44
+ day_of_month: z.union([z.number(), z.null()]),
45
+ month_of_year: z.union([z.number(), z.null()]),
46
+ start_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
47
+ end_date: z.union([z.string(), z.null()]),
48
+ auto_send: z.boolean(),
49
+ create_as_draft: z.boolean(),
50
+ send_to: z.union([z.string(), z.null()]),
51
+ payment_terms_days: z.union([z.number(), z.null()]),
52
+ notify_owner: z.boolean(),
53
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]),
54
+ })
55
+ .partial();
56
+
57
+ // Type for update recurringinvoice operation
58
+ export type UpdateRecurringInvoiceSchema = z.infer<typeof updateRecurringInvoiceSchemaDefinition>;
59
+
60
+ export const createRecurringInvoiceSchema = createRecurringInvoiceSchemaDefinition;
61
+ export const updateRecurringInvoiceSchema = updateRecurringInvoiceSchemaDefinition;
@@ -14,14 +14,18 @@ const registerFursRealEstatePremiseSchemaDefinition = z.object({
14
14
  real_estate: z
15
15
  .object({
16
16
  cadastral_number: z.string().min(1).regex(/^\d+$/),
17
- building_number: z.union([z.string(), z.null()]).optional(),
18
- building_section: z.union([z.string(), z.null()]).optional(),
19
- community: z.string().min(1),
20
- city: z.union([z.string(), z.null()]).optional(),
21
- street: z.union([z.string(), z.null()]).optional(),
22
- house_number: z.union([z.string(), z.null()]).optional(),
17
+ building_number: z.string().min(1).regex(/^\d+$/),
18
+ building_section: z.string().min(1).regex(/^\d+$/),
19
+ street: z.string().min(1).max(100),
20
+ house_number: z.string().min(1).max(10),
23
21
  house_number_additional: z.union([z.string(), z.null()]).optional(),
24
- postal_code: z.union([z.string(), z.null()]).optional(),
22
+ community: z.string().min(1).max(100),
23
+ city: z.string().min(1).max(100),
24
+ postal_code: z
25
+ .string()
26
+ .min(4)
27
+ .max(4)
28
+ .regex(/^\d{4}$/),
25
29
  })
26
30
  .passthrough(),
27
31
  });