@spaceinvoices/react-ui 0.4.1 → 0.4.3

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 (245) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/registry.json +25 -0
  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 +105 -2
  18. package/src/components/advance-invoices/list/locales/de.ts +4 -0
  19. package/src/components/advance-invoices/list/locales/en.ts +4 -0
  20. package/src/components/advance-invoices/list/locales/es.ts +4 -0
  21. package/src/components/advance-invoices/list/locales/fr.ts +4 -0
  22. package/src/components/advance-invoices/list/locales/hr.ts +4 -0
  23. package/src/components/advance-invoices/list/locales/it.ts +4 -0
  24. package/src/components/advance-invoices/list/locales/nl.ts +4 -0
  25. package/src/components/advance-invoices/list/locales/pl.ts +4 -0
  26. package/src/components/advance-invoices/list/locales/pt.ts +4 -0
  27. package/src/components/advance-invoices/list/locales/sl.ts +4 -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 +79 -8
  41. package/src/components/credit-notes/list/locales/de.ts +4 -1
  42. package/src/components/credit-notes/list/locales/en.ts +5 -0
  43. package/src/components/credit-notes/list/locales/es.ts +4 -1
  44. package/src/components/credit-notes/list/locales/fr.ts +4 -1
  45. package/src/components/credit-notes/list/locales/hr.ts +4 -1
  46. package/src/components/credit-notes/list/locales/it.ts +4 -1
  47. package/src/components/credit-notes/list/locales/nl.ts +4 -1
  48. package/src/components/credit-notes/list/locales/pl.ts +4 -1
  49. package/src/components/credit-notes/list/locales/pt.ts +4 -1
  50. package/src/components/credit-notes/list/locales/sl.ts +4 -1
  51. package/src/components/customers/create-customer-form/create-customer-form.tsx +0 -1
  52. package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +2 -2
  53. package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +3 -3
  54. package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +1 -1
  55. package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +1 -1
  56. package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +1 -1
  57. package/src/components/dashboard/shared/use-revenue-data.ts +4 -4
  58. package/src/components/dashboard/shared/use-stats-counts.ts +4 -4
  59. package/src/components/dashboard/shared/use-stats-query.ts +1 -1
  60. package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +2 -2
  61. package/src/components/dashboard/top-customers-chart/use-top-customers.ts +1 -1
  62. package/src/components/delivery-notes/create/create-delivery-note-form.tsx +332 -0
  63. package/src/components/delivery-notes/create/locales/de.ts +50 -0
  64. package/src/components/delivery-notes/create/locales/es.ts +49 -0
  65. package/src/components/delivery-notes/create/locales/fr.ts +50 -0
  66. package/src/components/delivery-notes/create/locales/hr.ts +49 -0
  67. package/src/components/delivery-notes/create/locales/it.ts +49 -0
  68. package/src/components/delivery-notes/create/locales/nl.ts +50 -0
  69. package/src/components/delivery-notes/create/locales/pl.ts +49 -0
  70. package/src/components/delivery-notes/create/locales/pt.ts +50 -0
  71. package/src/components/delivery-notes/create/locales/sl.ts +49 -0
  72. package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +38 -0
  73. package/src/components/delivery-notes/create/use-delivery-note-customer-form.ts +1 -0
  74. package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -0
  75. package/src/components/delivery-notes/list/index.ts +3 -0
  76. package/src/components/delivery-notes/list/list-row-actions.tsx +103 -0
  77. package/src/components/delivery-notes/list/list-table.tsx +214 -0
  78. package/src/components/delivery-notes/list/locales/de.ts +9 -0
  79. package/src/components/delivery-notes/list/locales/en.ts +11 -0
  80. package/src/components/delivery-notes/list/locales/es.ts +9 -0
  81. package/src/components/delivery-notes/list/locales/fr.ts +9 -0
  82. package/src/components/delivery-notes/list/locales/hr.ts +9 -0
  83. package/src/components/delivery-notes/list/locales/it.ts +9 -0
  84. package/src/components/delivery-notes/list/locales/nl.ts +9 -0
  85. package/src/components/delivery-notes/list/locales/pl.ts +9 -0
  86. package/src/components/delivery-notes/list/locales/pt.ts +9 -0
  87. package/src/components/delivery-notes/list/locales/sl.ts +9 -0
  88. package/src/components/delivery-notes/list/use-delivery-note-download.ts +63 -0
  89. package/src/components/documents/create/document-details-section.tsx +103 -33
  90. package/src/components/documents/create/live-preview.tsx +37 -10
  91. package/src/components/documents/create/mark-as-paid-section.tsx +11 -2
  92. package/src/components/documents/create/prepare-document-submission.ts +1 -1
  93. package/src/components/documents/documents.hooks.ts +2 -1
  94. package/src/components/documents/shared/document-preview-display.tsx +12 -5
  95. package/src/components/documents/types.ts +10 -1
  96. package/src/components/documents/view/document-actions-bar.tsx +30 -0
  97. package/src/components/documents/view/document-details-card.tsx +3 -3
  98. package/src/components/documents/view/document-payments-list.tsx +3 -3
  99. package/src/components/documents/view/document-relations-list.tsx +105 -0
  100. package/src/components/documents/view/locales/de.ts +26 -0
  101. package/src/components/documents/view/locales/es.ts +26 -0
  102. package/src/components/documents/view/locales/fr.ts +26 -0
  103. package/src/components/documents/view/locales/hr.ts +26 -0
  104. package/src/components/documents/view/locales/it.ts +26 -0
  105. package/src/components/documents/view/locales/nl.ts +26 -0
  106. package/src/components/documents/view/locales/pl.ts +26 -0
  107. package/src/components/documents/view/locales/pt.ts +26 -0
  108. package/src/components/documents/view/locales/sl.ts +26 -0
  109. package/src/components/documents/view/use-document-download.ts +5 -3
  110. package/src/components/entities/create-entity-form.tsx +1 -1
  111. package/src/components/entities/entity-settings-form/entity-settings-form.tsx +2 -3
  112. package/src/components/entities/entity-settings-form/locales/es.ts +2 -0
  113. package/src/components/entities/entity-settings-form/locales/fr.ts +2 -0
  114. package/src/components/entities/entity-settings-form/locales/hr.ts +2 -0
  115. package/src/components/entities/entity-settings-form/locales/it.ts +2 -0
  116. package/src/components/entities/entity-settings-form/locales/nl.ts +2 -0
  117. package/src/components/entities/entity-settings-form/locales/pl.ts +2 -0
  118. package/src/components/entities/entity-settings-form/locales/pt.ts +2 -0
  119. package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +109 -0
  120. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +377 -35
  121. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +106 -20
  122. package/src/components/entities/fina-settings-form/index.ts +1 -0
  123. package/src/components/entities/fina-settings-form/locales/de.ts +54 -34
  124. package/src/components/entities/fina-settings-form/locales/en.ts +51 -34
  125. package/src/components/entities/fina-settings-form/locales/es.ts +50 -34
  126. package/src/components/entities/fina-settings-form/locales/fr.ts +50 -34
  127. package/src/components/entities/fina-settings-form/locales/hr.ts +50 -34
  128. package/src/components/entities/fina-settings-form/locales/it.ts +50 -34
  129. package/src/components/entities/fina-settings-form/locales/nl.ts +50 -34
  130. package/src/components/entities/fina-settings-form/locales/pl.ts +50 -34
  131. package/src/components/entities/fina-settings-form/locales/pt.ts +50 -34
  132. package/src/components/entities/fina-settings-form/locales/sl.ts +50 -34
  133. package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +18 -0
  134. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +64 -89
  135. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +51 -323
  136. package/src/components/entities/furs-settings-form/furs-operator-required-dialog.tsx +106 -0
  137. package/src/components/entities/furs-settings-form/furs-settings-form.tsx +33 -10
  138. package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +12 -11
  139. package/src/components/entities/furs-settings-form/index.ts +1 -0
  140. package/src/components/entities/furs-settings-form/locales/de.ts +27 -3
  141. package/src/components/entities/furs-settings-form/locales/en.ts +17 -3
  142. package/src/components/entities/furs-settings-form/locales/es.ts +26 -3
  143. package/src/components/entities/furs-settings-form/locales/fr.ts +26 -3
  144. package/src/components/entities/furs-settings-form/locales/hr.ts +26 -3
  145. package/src/components/entities/furs-settings-form/locales/it.ts +26 -3
  146. package/src/components/entities/furs-settings-form/locales/nl.ts +26 -3
  147. package/src/components/entities/furs-settings-form/locales/pl.ts +26 -3
  148. package/src/components/entities/furs-settings-form/locales/pt.ts +26 -3
  149. package/src/components/entities/furs-settings-form/locales/sl.ts +16 -3
  150. package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +22 -0
  151. package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +26 -5
  152. package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +14 -2
  153. package/src/components/entities/settings/tax-rules-settings-form.tsx +4 -4
  154. package/src/components/estimates/list/list-row-actions.tsx +3 -7
  155. package/src/components/estimates/list/list-table.tsx +35 -2
  156. package/src/components/estimates/list/locales/de.ts +3 -0
  157. package/src/components/estimates/list/locales/en.ts +3 -0
  158. package/src/components/estimates/list/locales/es.ts +3 -0
  159. package/src/components/estimates/list/locales/fr.ts +3 -0
  160. package/src/components/estimates/list/locales/hr.ts +3 -0
  161. package/src/components/estimates/list/locales/it.ts +3 -0
  162. package/src/components/estimates/list/locales/nl.ts +3 -0
  163. package/src/components/estimates/list/locales/pl.ts +3 -0
  164. package/src/components/estimates/list/locales/pt.ts +3 -0
  165. package/src/components/estimates/list/locales/sl.ts +3 -0
  166. package/src/components/export/document-export-form.tsx +34 -34
  167. package/src/components/invoices/create/create-invoice-form.tsx +107 -5
  168. package/src/components/invoices/create/prepare-invoice-submission.ts +17 -0
  169. package/src/components/invoices/invoices-furs.hooks.ts +24 -9
  170. package/src/components/invoices/invoices.hooks.ts +32 -2
  171. package/src/components/invoices/list/list-row-actions.tsx +26 -11
  172. package/src/components/invoices/list/list-table.tsx +121 -5
  173. package/src/components/invoices/list/locales/de.ts +5 -0
  174. package/src/components/invoices/list/locales/en.ts +5 -0
  175. package/src/components/invoices/list/locales/es.ts +5 -0
  176. package/src/components/invoices/list/locales/fr.ts +5 -0
  177. package/src/components/invoices/list/locales/hr.ts +5 -0
  178. package/src/components/invoices/list/locales/it.ts +5 -0
  179. package/src/components/invoices/list/locales/nl.ts +5 -0
  180. package/src/components/invoices/list/locales/pl.ts +5 -0
  181. package/src/components/invoices/list/locales/pt.ts +5 -0
  182. package/src/components/invoices/list/locales/sl.ts +5 -0
  183. package/src/components/invoices/view/fiscalization-status-card.tsx +4 -1
  184. package/src/components/items/item-list-table/item-list-row-actions.tsx +5 -8
  185. package/src/components/items/item-list-table/item-list-row.tsx +5 -3
  186. package/src/components/items/item-list-table/item-list-table.tsx +5 -1
  187. package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +418 -0
  188. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/de.ts +45 -0
  189. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/es.ts +44 -0
  190. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fr.ts +44 -0
  191. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +44 -0
  192. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/it.ts +44 -0
  193. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nl.ts +44 -0
  194. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pl.ts +44 -0
  195. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pt.ts +44 -0
  196. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +44 -0
  197. package/src/components/recurring-invoices/index.ts +3 -0
  198. package/src/components/recurring-invoices/list/index.ts +2 -0
  199. package/src/components/recurring-invoices/list/list-row-actions.tsx +139 -0
  200. package/src/components/recurring-invoices/list/list-table.tsx +179 -0
  201. package/src/components/recurring-invoices/list/locales/de.ts +27 -0
  202. package/src/components/recurring-invoices/list/locales/en.ts +5 -0
  203. package/src/components/recurring-invoices/list/locales/es.ts +27 -0
  204. package/src/components/recurring-invoices/list/locales/fr.ts +27 -0
  205. package/src/components/recurring-invoices/list/locales/hr.ts +27 -0
  206. package/src/components/recurring-invoices/list/locales/it.ts +27 -0
  207. package/src/components/recurring-invoices/list/locales/nl.ts +27 -0
  208. package/src/components/recurring-invoices/list/locales/pl.ts +27 -0
  209. package/src/components/recurring-invoices/list/locales/pt.ts +27 -0
  210. package/src/components/recurring-invoices/list/locales/sl.ts +27 -0
  211. package/src/components/recurring-invoices/recurring-invoices.hooks.ts +28 -0
  212. package/src/components/table/data-table.tsx +122 -5
  213. package/src/components/table/selection-toolbar.tsx +36 -0
  214. package/src/components/tax-reports/kir-export-form.tsx +75 -55
  215. package/src/components/taxes/tax-list-table/tax-list-row-actions.tsx +3 -6
  216. package/src/components/taxes/tax-list-table/tax-list-row.tsx +3 -2
  217. package/src/components/taxes/tax-list-table/tax-list-table.tsx +5 -1
  218. package/src/components/ui/checkbox.tsx +5 -5
  219. package/src/generate-schemas.ts +45 -18
  220. package/src/generated/schemas/authorizeshopify_body.ts +22 -0
  221. package/src/generated/schemas/creditnote.ts +0 -2
  222. package/src/generated/schemas/deliverynote.ts +134 -0
  223. package/src/generated/schemas/entity.ts +5 -1
  224. package/src/generated/schemas/index.ts +42 -28
  225. package/src/generated/schemas/order.ts +129 -0
  226. package/src/generated/schemas/orderintegration.ts +51 -0
  227. package/src/generated/schemas/payment.ts +24 -2
  228. package/src/generated/schemas/recurringinvoice.ts +61 -0
  229. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +108 -140
  230. package/src/generated/schemas/rendercreditnotepreview_body.ts +109 -141
  231. package/src/generated/schemas/renderdeliverynotepreview_body.ts +185 -0
  232. package/src/generated/schemas/renderestimatepreview_body.ts +79 -82
  233. package/src/generated/schemas/renderinvoicepreview_body.ts +109 -141
  234. package/src/generated/schemas/startpdfexport_body.ts +18 -2
  235. package/src/generated/schemas/userfinasettings.ts +19 -0
  236. package/src/generated/schemas/webhook.ts +54 -0
  237. package/src/hooks/use-duplicate-document.ts +11 -3
  238. package/src/hooks/use-next-document-number.ts +2 -2
  239. package/src/lib/furs-error-utils.ts +36 -0
  240. package/src/lib/schemas/advance-invoice.ts +3 -3
  241. package/src/lib/schemas/credit-note.ts +3 -3
  242. package/src/lib/schemas/estimate.ts +3 -3
  243. package/src/lib/schemas/invoice.ts +3 -3
  244. package/src/providers/sdk-provider.tsx +5 -7
  245. package/src/providers/white-label-provider.tsx +3 -0
@@ -86,8 +86,12 @@ async function main() {
86
86
  for (const ref of constRefs) {
87
87
  const cleanRef = ref.replace(/\.(optional|nullable)\(\)/, "");
88
88
  // Check if it's actually a schema definition in the file
89
- // Handle both `const Foo = z.object(...)` and `const Foo = z\n .object(...)`
90
- if (fullContent.includes(`const ${cleanRef} = z.`) || fullContent.includes(`const ${cleanRef} = z\n`)) {
89
+ // Handle `const Foo = z.object(...)`, `const Foo = z\n .object(...)`,
90
+ // and `const Foo = OtherSchema.and(...)` (schema composition)
91
+ const isZodSchema =
92
+ fullContent.includes(`const ${cleanRef} = z.`) || fullContent.includes(`const ${cleanRef} = z\n`);
93
+ const isComposedSchema = new RegExp(`const ${cleanRef} = [A-Z][a-zA-Z0-9]+\\.`).test(fullContent);
94
+ if (isZodSchema || isComposedSchema) {
91
95
  dependencies.push(cleanRef);
92
96
  }
93
97
  }
@@ -134,14 +138,41 @@ async function main() {
134
138
  return groups;
135
139
  }, {});
136
140
 
141
+ // Topological sort: ensures each schema is defined after all schemas it depends on
142
+ function topologicalSort(names: string[], fullContent: string): string[] {
143
+ const visited = new Set<string>();
144
+ const result: string[] = [];
145
+
146
+ function visit(name: string) {
147
+ if (visited.has(name)) return;
148
+ visited.add(name);
149
+ // Visit dependencies first so they appear earlier in the output
150
+ const deps = findSchemaDependencies(name, fullContent);
151
+ for (const dep of deps) {
152
+ if (names.includes(dep)) {
153
+ visit(dep);
154
+ }
155
+ }
156
+ result.push(name);
157
+ }
158
+
159
+ for (const name of names) {
160
+ visit(name);
161
+ }
162
+ return result;
163
+ }
164
+
137
165
  // Create files for each group
138
166
  for (const [groupName, schemaNames] of Object.entries(schemasByGroup)) {
139
167
  // Separate dependencies from operation schemas
140
- const dependencies = schemaNames.filter((name) => !name.includes("_Body")).reverse();
168
+ const dependencies = schemaNames.filter((name) => !name.includes("_Body"));
141
169
  const operations = schemaNames.filter((name) => name.includes("_Body"));
142
170
 
171
+ // Topologically sort dependencies so each schema is defined after its own dependencies
172
+ const sortedDependencies = topologicalSort(dependencies, content);
173
+
143
174
  // Process dependencies first, then operations
144
- const orderedNames = [...dependencies, ...operations];
175
+ const orderedNames = [...sortedDependencies, ...operations];
145
176
 
146
177
  const schemas = orderedNames
147
178
  .map((schemaName) => {
@@ -245,27 +276,23 @@ ${exports}
245
276
  await fs.writeFile(path.join(SCHEMAS_DIR, `${groupName}.ts`), schemaContent);
246
277
  }
247
278
 
248
- // Add manual re-exports that can't be auto-generated
249
- // Credit note create uses the same body as invoice create
250
- const creditNoteFile = path.join(SCHEMAS_DIR, "creditnote.ts");
251
- const creditNoteContent = await fs.readFile(creditNoteFile, "utf-8");
252
- if (!creditNoteContent.includes("createCreditNoteSchema")) {
253
- await fs.appendFile(
254
- creditNoteFile,
255
- "\n// Re-export invoice create schema as credit note create schema (same body structure)\nexport { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';\n",
256
- );
257
- }
279
+ // Create index file - export ALL schema files (not just schemasByGroup)
280
+ const allSchemaFiles = (await fs.readdir(SCHEMAS_DIR))
281
+ .filter((f) => f.endsWith(".ts") && f !== "index.ts")
282
+ .map((f) => f.replace(".ts", ""))
283
+ .sort();
258
284
 
259
- // Create index file
260
285
  const indexContent = `/**
261
286
  * This file was automatically generated using 'bun generate-schemas'.
262
287
  * Do not edit this file manually. To update, run the generator again.
263
288
  * @generated
264
289
  */
265
290
 
266
- ${Object.keys(schemasByGroup)
267
- .map((groupName) => `export * from './${groupName}';`)
268
- .join("\n")}
291
+ ${allSchemaFiles.map((name) => `export * from './${name}';`).join("\n")}
292
+
293
+ // Re-export invoice create schema as credit note create schema (same body structure)
294
+ // Placed here (after invoice is exported) to avoid circular dependency issues
295
+ export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';
269
296
  `;
270
297
 
271
298
  await fs.writeFile(path.join(SCHEMAS_DIR, "index.ts"), indexContent);
@@ -0,0 +1,22 @@
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 authorizeshopify_body endpoints
10
+
11
+ // Dependency schema for authorizeshopify_body
12
+ const authorizeShopify_Body = z.object({
13
+ shop_domain: z.string().min(1),
14
+ name: z.string().optional(),
15
+ auto_process: z.boolean().optional(),
16
+ send_invoice_email: z.boolean().optional(),
17
+ issue_invoice_for_bank: z.boolean().optional(),
18
+ issue_invoice_on_complete: z.boolean().optional(),
19
+ auto_process_delay_seconds: z.number().int().gte(0).optional(),
20
+ });
21
+
22
+
@@ -129,5 +129,3 @@ export type UpdateCreditNoteSchema = z.infer<typeof updateCreditNoteSchemaDefini
129
129
 
130
130
  export const updateCreditNoteSchema = updateCreditNoteSchemaDefinition;
131
131
 
132
- // Re-export invoice create schema as credit note create schema (same body structure)
133
- export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Delivery note schema for form validation.
3
+ * Based on the estimate schema pattern, adapted for delivery notes.
4
+ * Delivery notes differ from estimates: no date_valid_till, no title_type, has hide_prices.
5
+ */
6
+
7
+ import { z } from 'zod';
8
+
9
+ // Dependency schema for delivery note
10
+ const LineDiscount = z.object({
11
+ value: z.number().gte(0),
12
+ type: z.enum(["percent", "amount"]).optional().default("percent"),
13
+ });
14
+
15
+
16
+ // Dependency schema for delivery note
17
+ const DocumentItemTax = z
18
+ .object({
19
+ rate: z.number(),
20
+ tax_id: z.string(),
21
+ classification: z.string(),
22
+ reverse_charge: z.boolean(),
23
+ amount: z.number(),
24
+ })
25
+ .partial();
26
+
27
+
28
+ // Dependency schema for delivery note
29
+ const DocumentEntity = z
30
+ .object({
31
+ name: z.union([z.string(), z.null()]),
32
+ email: z.union([z.string(), z.null()]),
33
+ address: z.union([z.string(), z.null()]),
34
+ address_2: z.union([z.string(), z.null()]),
35
+ post_code: z.union([z.string(), z.null()]),
36
+ city: z.union([z.string(), z.null()]),
37
+ state: z.union([z.string(), z.null()]),
38
+ country: z.union([z.string(), z.null()]),
39
+ country_code: z.union([z.string(), z.null()]),
40
+ tax_number: z.union([z.string(), z.null()]),
41
+ tax_number_2: z.union([z.string(), z.null()]),
42
+ company_number: z.union([z.string(), z.null()]),
43
+ bank_account: z.union([
44
+ z
45
+ .object({
46
+ type: z
47
+ .enum(["iban", "us_domestic", "uk_domestic", "other"])
48
+ .default("iban"),
49
+ name: z.string(),
50
+ bank_name: z.string(),
51
+ iban: z.string(),
52
+ account_number: z.string(),
53
+ bic: z.string(),
54
+ routing_number: z.string(),
55
+ sort_code: z.string(),
56
+ })
57
+ .partial()
58
+ .passthrough(),
59
+ z.null(),
60
+ ]),
61
+ })
62
+ .partial()
63
+ .passthrough();
64
+
65
+
66
+ // Schema for create delivery note operation
67
+ const createDeliveryNoteSchemaDefinition = z.object({
68
+ is_draft: z.boolean().optional(),
69
+ date: z
70
+ .string()
71
+ .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/)
72
+ .optional(),
73
+ issuer: DocumentEntity.optional(),
74
+ customer_id: z.union([z.string(), z.null()]).optional(),
75
+ customer: DocumentEntity.and(
76
+ z.union([
77
+ z
78
+ .object({ save_customer: z.boolean().default(true) })
79
+ .partial()
80
+ .passthrough(),
81
+ z.null(),
82
+ ])
83
+ ).optional(),
84
+ note: z.union([z.string(), z.null()]).optional(),
85
+ payment_terms: z.union([z.string(), z.null()]).optional(),
86
+ tax_clause: z.union([z.string(), z.null()]).optional(),
87
+ currency_code: z.string().max(3).optional(),
88
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
89
+ hide_prices: z.boolean().optional(),
90
+ date_due: z.union([z.string(), z.null()]).optional(),
91
+ date_service: z.union([z.string(), z.null()]).optional(),
92
+ date_service_to: z.union([z.string(), z.null()]).optional(),
93
+ items: z
94
+ .array(
95
+ z.object({
96
+ name: z.string().min(1).optional(),
97
+ description: z.union([z.string().max(4000, "Description must not exceed 4000 characters"), z.null()]).optional(),
98
+ price: z.number().optional(),
99
+ gross_price: z.number().optional(),
100
+ quantity: z.number().gte(-140737488355328).lte(140737488355327),
101
+ unit: z.union([z.string(), z.null()]).optional(),
102
+ taxes: z.array(DocumentItemTax).optional(),
103
+ discounts: z.array(LineDiscount).max(5).optional(),
104
+ metadata: z
105
+ .union([
106
+ z.string(),
107
+ z.number(),
108
+ z.boolean(),
109
+ z.null(),
110
+ z.object({}).partial().passthrough(),
111
+ z.array(z.unknown()),
112
+ z.null(),
113
+ ])
114
+ .optional(),
115
+ item_id: z.string().optional(),
116
+ })
117
+ )
118
+ .min(1),
119
+ eslog: z
120
+ .union([
121
+ z
122
+ .object({ validation_enabled: z.union([z.boolean(), z.null()]) })
123
+ .partial()
124
+ .passthrough(),
125
+ z.null(),
126
+ ])
127
+ .optional(),
128
+ expected_total_with_tax: z.number().gt(0).optional(),
129
+ });
130
+
131
+ // Type for create delivery note operation
132
+ export type CreateDeliveryNoteSchema = z.infer<typeof createDeliveryNoteSchemaDefinition>;
133
+
134
+ export const createDeliveryNoteSchema = createDeliveryNoteSchemaDefinition;
@@ -24,7 +24,7 @@ const createEntitySchemaDefinition = z.object({
24
24
  tax_number_2: z.union([z.string(), z.null()]).optional(),
25
25
  company_number: z.union([z.string(), z.null()]).optional(),
26
26
  email: z.union([z.string(), z.null()]).optional(),
27
- environment: z.string().max(20).optional(),
27
+ environment: z.enum(["live", "sandbox"]).optional(),
28
28
  is_tax_subject: z.boolean().optional(),
29
29
  is_enabled: z.boolean().optional(),
30
30
  settings: z
@@ -40,6 +40,7 @@ const createEntitySchemaDefinition = z.object({
40
40
  estimate: z.union([z.string(), z.null()]),
41
41
  credit_note: z.union([z.string(), z.null()]),
42
42
  advance_invoice: z.union([z.string(), z.null()]),
43
+ delivery_note: z.union([z.string(), z.null()]),
43
44
  })
44
45
  .partial()
45
46
  .passthrough(),
@@ -136,6 +137,7 @@ const createEntitySchemaDefinition = z.object({
136
137
  ]),
137
138
  bank_accounts: z.union([z.array(z.any()), z.null()]),
138
139
  eslog_validation_enabled: z.union([z.boolean(), z.null()]),
140
+ delivery_note_hide_prices: z.union([z.boolean(), z.null()]),
139
141
  tax_clause_defaults: z.union([
140
142
  z
141
143
  .object({
@@ -189,6 +191,7 @@ const patchEntitySchemaDefinition = z
189
191
  estimate: z.union([z.string(), z.null()]),
190
192
  credit_note: z.union([z.string(), z.null()]),
191
193
  advance_invoice: z.union([z.string(), z.null()]),
194
+ delivery_note: z.union([z.string(), z.null()]),
192
195
  })
193
196
  .partial()
194
197
  .passthrough(),
@@ -285,6 +288,7 @@ const patchEntitySchemaDefinition = z
285
288
  ]),
286
289
  bank_accounts: z.union([z.array(z.any()), z.null()]),
287
290
  eslog_validation_enabled: z.union([z.boolean(), z.null()]),
291
+ delivery_note_hide_prices: z.union([z.boolean(), z.null()]),
288
292
  tax_clause_defaults: z.union([
289
293
  z
290
294
  .object({
@@ -4,40 +4,54 @@
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 './deliverynote';
17
+ export * from './custominvoice';
23
18
  export * from './entity';
24
- export * from './startpdfexport_body';
19
+ export * from './entityuserrole';
20
+ export * from './estimate';
21
+ export * from './finasettings';
22
+ export * from './furssettings';
23
+ export * from './invoice';
25
24
  export * from './item';
25
+ export * from './me';
26
+ export * from './order';
27
+ export * from './orderintegration';
26
28
  export * from './payment';
29
+ export * from './previewadvanceinvoice_body';
30
+ export * from './previewestimate_body';
31
+ export * from './recurringinvoice';
32
+ export * from './registerfinamovablepremise_body';
33
+ export * from './registerfinarealestatepremise_body';
34
+ export * from './registerfursmovablepremise_body';
35
+ export * from './registerfursrealestatepremise_body';
36
+ export * from './renderadvanceinvoicepreview_body';
37
+ export * from './rendercreditnotepreview_body';
38
+ export * from './renderdeliverynotepreview_body';
39
+ export * from './renderdocument_body';
40
+ export * from './renderestimatepreview_body';
41
+ export * from './renderinvoicepreview_body';
42
+ export * from './senddocument_body';
43
+ export * from './sendemail_body';
44
+ export * from './startpdfexport_body';
45
+ export * from './stripeappconnect_body';
46
+ export * from './stripeappcreateinvoice_body';
47
+ export * from './stripeappupdatesettings_body';
27
48
  export * from './tax';
28
49
  export * from './uploadfile_body';
29
- export * from './me';
50
+ export * from './uploadfurscertificate_body';
51
+ export * from './userfinasettings';
30
52
  export * from './userfurssettings';
31
- export * from './customer';
32
- export * from './sendemail_body';
33
53
  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';
54
+
55
+ // Re-export invoice create schema as credit note create schema (same body structure)
56
+ // Placed here (after invoice is exported) to avoid circular dependency issues
57
+ export { createInvoiceSchema as createCreditNoteSchema, type CreateInvoiceSchema as CreateCreditNoteSchema } from './invoice';
@@ -0,0 +1,129 @@
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.enum(["shopify", "woocommerce", "manual"]),
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
90
+ .enum(["unpaid", "paid", "partially_paid", "refunded"])
91
+ .optional(),
92
+ payment_method: z.union([z.string(), z.null()]).optional(),
93
+ payment_gateway: z.union([z.string(), z.null()]).optional(),
94
+ ordered_at: z.union([z.string(), z.null()]).optional(),
95
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
96
+ });
97
+
98
+ // Type for create order operation
99
+ export type CreateOrderSchema = z.infer<typeof createOrderSchemaDefinition>;
100
+
101
+
102
+ // Schema for update order operation
103
+ const updateOrderSchemaDefinition = z
104
+ .object({
105
+ source_order_number: z.union([z.string(), z.null()]),
106
+ customer_name: z.union([z.string(), z.null()]),
107
+ customer_email: z.union([z.string(), z.null()]),
108
+ customer: OrderCustomer,
109
+ billing_address: OrderAddress,
110
+ shipping_address: OrderAddress,
111
+ currency_code: z.string().max(3),
112
+ total: z.number().gte(-140737488355328).lte(140737488355327),
113
+ total_with_tax: z.number().gte(-140737488355328).lte(140737488355327),
114
+ total_discount: z.number().gte(-140737488355328).lte(140737488355327),
115
+ total_shipping: z.number().gte(-140737488355328).lte(140737488355327),
116
+ items: z.array(OrderItem).min(1),
117
+ payment_status: z.enum(["unpaid", "paid", "partially_paid", "refunded"]),
118
+ payment_method: z.union([z.string(), z.null()]),
119
+ payment_gateway: z.union([z.string(), z.null()]),
120
+ ordered_at: z.union([z.string(), z.null()]),
121
+ metadata: z.union([z.record(z.string(), z.any()), z.null()]),
122
+ })
123
+ .partial();
124
+
125
+ // Type for update order operation
126
+ export type UpdateOrderSchema = z.infer<typeof updateOrderSchemaDefinition>;
127
+
128
+ export const createOrderSchema = createOrderSchemaDefinition;
129
+ 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;
@@ -14,8 +14,19 @@ const createPaymentSchemaDefinition = z.object({
14
14
  credit_note_id: z.union([z.string(), z.null()]).optional(),
15
15
  advance_invoice_id: z.union([z.string(), z.null()]).optional(),
16
16
  amount: z.number().gt(0),
17
- type: z.string().max(20),
17
+ type: z.enum([
18
+ "cash",
19
+ "bank_transfer",
20
+ "card",
21
+ "check",
22
+ "paypal",
23
+ "coupon",
24
+ "other",
25
+ "credit_note",
26
+ "advance",
27
+ ]),
18
28
  date: z.string().optional(),
29
+ tag: z.union([z.string(), z.null()]).optional(),
19
30
  reference: z.union([z.string(), z.null()]).optional(),
20
31
  note: z.union([z.string(), z.null()]).optional(),
21
32
  metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
@@ -29,8 +40,19 @@ export type CreatePaymentSchema = z.infer<typeof createPaymentSchemaDefinition>;
29
40
  const updatePaymentSchemaDefinition = z
30
41
  .object({
31
42
  amount: z.number().gt(0),
32
- type: z.string().max(20),
43
+ type: z.enum([
44
+ "cash",
45
+ "bank_transfer",
46
+ "card",
47
+ "check",
48
+ "paypal",
49
+ "coupon",
50
+ "other",
51
+ "credit_note",
52
+ "advance",
53
+ ]),
33
54
  date: z.string(),
55
+ tag: z.union([z.string(), z.null()]),
34
56
  reference: z.union([z.string(), z.null()]),
35
57
  note: z.union([z.string(), z.null()]),
36
58
  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;