@spaceinvoices/react-ui 0.4.1 → 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 (191) 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 +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/register-premise-dialog.tsx +14 -2
  107. package/src/components/entities/settings/tax-rules-settings-form.tsx +4 -4
  108. package/src/components/estimates/list/list-row-actions.tsx +3 -7
  109. package/src/components/estimates/list/list-table.tsx +35 -2
  110. package/src/components/estimates/list/locales/de.ts +3 -0
  111. package/src/components/estimates/list/locales/en.ts +3 -0
  112. package/src/components/estimates/list/locales/es.ts +3 -0
  113. package/src/components/estimates/list/locales/fr.ts +3 -0
  114. package/src/components/estimates/list/locales/hr.ts +3 -0
  115. package/src/components/estimates/list/locales/it.ts +3 -0
  116. package/src/components/estimates/list/locales/nl.ts +3 -0
  117. package/src/components/estimates/list/locales/pl.ts +3 -0
  118. package/src/components/estimates/list/locales/pt.ts +3 -0
  119. package/src/components/estimates/list/locales/sl.ts +3 -0
  120. package/src/components/export/document-export-form.tsx +34 -34
  121. package/src/components/invoices/create/create-invoice-form.tsx +107 -5
  122. package/src/components/invoices/create/prepare-invoice-submission.ts +17 -0
  123. package/src/components/invoices/invoices.hooks.ts +32 -2
  124. package/src/components/invoices/list/list-row-actions.tsx +23 -8
  125. package/src/components/invoices/list/list-table.tsx +53 -2
  126. package/src/components/invoices/list/locales/de.ts +4 -0
  127. package/src/components/invoices/list/locales/en.ts +4 -0
  128. package/src/components/invoices/list/locales/es.ts +4 -0
  129. package/src/components/invoices/list/locales/fr.ts +4 -0
  130. package/src/components/invoices/list/locales/hr.ts +4 -0
  131. package/src/components/invoices/list/locales/it.ts +4 -0
  132. package/src/components/invoices/list/locales/nl.ts +4 -0
  133. package/src/components/invoices/list/locales/pl.ts +4 -0
  134. package/src/components/invoices/list/locales/pt.ts +4 -0
  135. package/src/components/invoices/list/locales/sl.ts +4 -0
  136. package/src/components/invoices/view/fiscalization-status-card.tsx +4 -1
  137. package/src/components/items/item-list-table/item-list-row-actions.tsx +3 -7
  138. package/src/components/items/item-list-table/item-list-row.tsx +3 -2
  139. package/src/components/items/item-list-table/item-list-table.tsx +5 -1
  140. package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +418 -0
  141. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/de.ts +45 -0
  142. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/es.ts +44 -0
  143. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fr.ts +44 -0
  144. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +44 -0
  145. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/it.ts +44 -0
  146. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nl.ts +44 -0
  147. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pl.ts +44 -0
  148. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/pt.ts +44 -0
  149. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +44 -0
  150. package/src/components/recurring-invoices/index.ts +3 -0
  151. package/src/components/recurring-invoices/list/index.ts +2 -0
  152. package/src/components/recurring-invoices/list/list-row-actions.tsx +139 -0
  153. package/src/components/recurring-invoices/list/list-table.tsx +179 -0
  154. package/src/components/recurring-invoices/list/locales/de.ts +27 -0
  155. package/src/components/recurring-invoices/list/locales/en.ts +5 -0
  156. package/src/components/recurring-invoices/list/locales/es.ts +27 -0
  157. package/src/components/recurring-invoices/list/locales/fr.ts +27 -0
  158. package/src/components/recurring-invoices/list/locales/hr.ts +27 -0
  159. package/src/components/recurring-invoices/list/locales/it.ts +27 -0
  160. package/src/components/recurring-invoices/list/locales/nl.ts +27 -0
  161. package/src/components/recurring-invoices/list/locales/pl.ts +27 -0
  162. package/src/components/recurring-invoices/list/locales/pt.ts +27 -0
  163. package/src/components/recurring-invoices/list/locales/sl.ts +27 -0
  164. package/src/components/recurring-invoices/recurring-invoices.hooks.ts +28 -0
  165. package/src/components/table/data-table.tsx +122 -5
  166. package/src/components/table/selection-toolbar.tsx +36 -0
  167. package/src/components/tax-reports/kir-export-form.tsx +75 -55
  168. package/src/components/taxes/tax-list-table/tax-list-row-actions.tsx +3 -6
  169. package/src/components/taxes/tax-list-table/tax-list-row.tsx +3 -2
  170. package/src/components/taxes/tax-list-table/tax-list-table.tsx +5 -1
  171. package/src/components/ui/checkbox.tsx +5 -5
  172. package/src/generate-schemas.ts +45 -18
  173. package/src/generated/schemas/authorizeshopify_body.ts +22 -0
  174. package/src/generated/schemas/creditnote.ts +0 -2
  175. package/src/generated/schemas/entity.ts +1 -1
  176. package/src/generated/schemas/index.ts +39 -28
  177. package/src/generated/schemas/order.ts +127 -0
  178. package/src/generated/schemas/orderintegration.ts +51 -0
  179. package/src/generated/schemas/payment.ts +2 -0
  180. package/src/generated/schemas/recurringinvoice.ts +61 -0
  181. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +107 -140
  182. package/src/generated/schemas/rendercreditnotepreview_body.ts +108 -141
  183. package/src/generated/schemas/renderestimatepreview_body.ts +78 -82
  184. package/src/generated/schemas/renderinvoicepreview_body.ts +108 -141
  185. package/src/generated/schemas/webhook.ts +42 -0
  186. package/src/lib/furs-error-utils.ts +36 -0
  187. package/src/lib/schemas/advance-invoice.ts +3 -3
  188. package/src/lib/schemas/credit-note.ts +3 -3
  189. package/src/lib/schemas/estimate.ts +3 -3
  190. package/src/lib/schemas/invoice.ts +3 -3
  191. 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';
@@ -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
@@ -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';
@@ -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;