@voyantjs/finance-react 0.2.0

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 (61) hide show
  1. package/dist/client.d.ts +14 -0
  2. package/dist/client.d.ts.map +1 -0
  3. package/dist/client.js +59 -0
  4. package/dist/hooks/index.d.ts +14 -0
  5. package/dist/hooks/index.d.ts.map +1 -0
  6. package/dist/hooks/index.js +13 -0
  7. package/dist/hooks/use-invoice-credit-note-mutation.d.ts +38 -0
  8. package/dist/hooks/use-invoice-credit-note-mutation.d.ts.map +1 -0
  9. package/dist/hooks/use-invoice-credit-note-mutation.js +35 -0
  10. package/dist/hooks/use-invoice-credit-notes.d.ts +17 -0
  11. package/dist/hooks/use-invoice-credit-notes.d.ts.map +1 -0
  12. package/dist/hooks/use-invoice-credit-notes.js +12 -0
  13. package/dist/hooks/use-invoice-line-item-mutation.d.ts +40 -0
  14. package/dist/hooks/use-invoice-line-item-mutation.d.ts.map +1 -0
  15. package/dist/hooks/use-invoice-line-item-mutation.js +42 -0
  16. package/dist/hooks/use-invoice-line-items.d.ts +17 -0
  17. package/dist/hooks/use-invoice-line-items.d.ts.map +1 -0
  18. package/dist/hooks/use-invoice-line-items.js +12 -0
  19. package/dist/hooks/use-invoice-mutation.d.ts +65 -0
  20. package/dist/hooks/use-invoice-mutation.d.ts.map +1 -0
  21. package/dist/hooks/use-invoice-mutation.js +44 -0
  22. package/dist/hooks/use-invoice-note-mutation.d.ts +11 -0
  23. package/dist/hooks/use-invoice-note-mutation.d.ts.map +1 -0
  24. package/dist/hooks/use-invoice-note-mutation.js +23 -0
  25. package/dist/hooks/use-invoice-notes.d.ts +13 -0
  26. package/dist/hooks/use-invoice-notes.d.ts.map +1 -0
  27. package/dist/hooks/use-invoice-notes.js +12 -0
  28. package/dist/hooks/use-invoice-payment-mutation.d.ts +22 -0
  29. package/dist/hooks/use-invoice-payment-mutation.d.ts.map +1 -0
  30. package/dist/hooks/use-invoice-payment-mutation.js +24 -0
  31. package/dist/hooks/use-invoice-payments.d.ts +18 -0
  32. package/dist/hooks/use-invoice-payments.d.ts.map +1 -0
  33. package/dist/hooks/use-invoice-payments.js +12 -0
  34. package/dist/hooks/use-invoice.d.ts +25 -0
  35. package/dist/hooks/use-invoice.d.ts.map +1 -0
  36. package/dist/hooks/use-invoice.js +12 -0
  37. package/dist/hooks/use-invoices.d.ts +29 -0
  38. package/dist/hooks/use-invoices.d.ts.map +1 -0
  39. package/dist/hooks/use-invoices.js +12 -0
  40. package/dist/hooks/use-supplier-payment-mutation.d.ts +44 -0
  41. package/dist/hooks/use-supplier-payment-mutation.d.ts.map +1 -0
  42. package/dist/hooks/use-supplier-payment-mutation.js +33 -0
  43. package/dist/hooks/use-supplier-payments.d.ts +23 -0
  44. package/dist/hooks/use-supplier-payments.d.ts.map +1 -0
  45. package/dist/hooks/use-supplier-payments.js +12 -0
  46. package/dist/index.d.ts +7 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +6 -0
  49. package/dist/provider.d.ts +2 -0
  50. package/dist/provider.d.ts.map +1 -0
  51. package/dist/provider.js +1 -0
  52. package/dist/query-keys.d.ts +22 -0
  53. package/dist/query-keys.d.ts.map +1 -0
  54. package/dist/query-keys.js +12 -0
  55. package/dist/query-options.d.ts +485 -0
  56. package/dist/query-options.d.ts.map +1 -0
  57. package/dist/query-options.js +92 -0
  58. package/dist/schemas.d.ts +276 -0
  59. package/dist/schemas.d.ts.map +1 -0
  60. package/dist/schemas.js +100 -0
  61. package/package.json +79 -0
@@ -0,0 +1,485 @@
1
+ import { type FetchWithValidationOptions } from "./client.js";
2
+ import type { UseInvoiceOptions } from "./hooks/use-invoice.js";
3
+ import type { UseInvoiceCreditNotesOptions } from "./hooks/use-invoice-credit-notes.js";
4
+ import type { UseInvoiceLineItemsOptions } from "./hooks/use-invoice-line-items.js";
5
+ import type { UseInvoiceNotesOptions } from "./hooks/use-invoice-notes.js";
6
+ import type { UseInvoicePaymentsOptions } from "./hooks/use-invoice-payments.js";
7
+ import type { UseInvoicesOptions } from "./hooks/use-invoices.js";
8
+ import type { UseSupplierPaymentsOptions } from "./hooks/use-supplier-payments.js";
9
+ export declare function getInvoicesQueryOptions(client: FetchWithValidationOptions, options?: UseInvoicesOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
10
+ data: {
11
+ id: string;
12
+ invoiceNumber: string;
13
+ bookingId: string;
14
+ personId: string | null;
15
+ organizationId: string | null;
16
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
17
+ currency: string;
18
+ subtotalCents: number;
19
+ taxCents: number;
20
+ totalCents: number;
21
+ paidCents: number;
22
+ balanceDueCents: number;
23
+ issueDate: string;
24
+ dueDate: string;
25
+ notes: string | null;
26
+ createdAt: string;
27
+ updatedAt: string;
28
+ }[];
29
+ total: number;
30
+ limit: number;
31
+ offset: number;
32
+ }, Error, {
33
+ data: {
34
+ id: string;
35
+ invoiceNumber: string;
36
+ bookingId: string;
37
+ personId: string | null;
38
+ organizationId: string | null;
39
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
40
+ currency: string;
41
+ subtotalCents: number;
42
+ taxCents: number;
43
+ totalCents: number;
44
+ paidCents: number;
45
+ balanceDueCents: number;
46
+ issueDate: string;
47
+ dueDate: string;
48
+ notes: string | null;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ }[];
52
+ total: number;
53
+ limit: number;
54
+ offset: number;
55
+ }, readonly ["voyant", "finance", "invoices", "list", import("./query-keys.js").FinanceInvoiceListFilters]>, "queryFn"> & {
56
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
57
+ data: {
58
+ id: string;
59
+ invoiceNumber: string;
60
+ bookingId: string;
61
+ personId: string | null;
62
+ organizationId: string | null;
63
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
64
+ currency: string;
65
+ subtotalCents: number;
66
+ taxCents: number;
67
+ totalCents: number;
68
+ paidCents: number;
69
+ balanceDueCents: number;
70
+ issueDate: string;
71
+ dueDate: string;
72
+ notes: string | null;
73
+ createdAt: string;
74
+ updatedAt: string;
75
+ }[];
76
+ total: number;
77
+ limit: number;
78
+ offset: number;
79
+ }, readonly ["voyant", "finance", "invoices", "list", import("./query-keys.js").FinanceInvoiceListFilters], never> | undefined;
80
+ } & {
81
+ queryKey: readonly ["voyant", "finance", "invoices", "list", import("./query-keys.js").FinanceInvoiceListFilters] & {
82
+ [dataTagSymbol]: {
83
+ data: {
84
+ id: string;
85
+ invoiceNumber: string;
86
+ bookingId: string;
87
+ personId: string | null;
88
+ organizationId: string | null;
89
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
90
+ currency: string;
91
+ subtotalCents: number;
92
+ taxCents: number;
93
+ totalCents: number;
94
+ paidCents: number;
95
+ balanceDueCents: number;
96
+ issueDate: string;
97
+ dueDate: string;
98
+ notes: string | null;
99
+ createdAt: string;
100
+ updatedAt: string;
101
+ }[];
102
+ total: number;
103
+ limit: number;
104
+ offset: number;
105
+ };
106
+ [dataTagErrorSymbol]: Error;
107
+ };
108
+ };
109
+ export declare function getSupplierPaymentsQueryOptions(client: FetchWithValidationOptions, options?: UseSupplierPaymentsOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
110
+ data: {
111
+ id: string;
112
+ bookingId: string;
113
+ supplierId: string | null;
114
+ amountCents: number;
115
+ currency: string;
116
+ paymentMethod: string;
117
+ status: "pending" | "completed" | "failed" | "refunded";
118
+ referenceNumber: string | null;
119
+ paymentDate: string;
120
+ createdAt: string;
121
+ notes?: string | null | undefined;
122
+ }[];
123
+ total: number;
124
+ limit: number;
125
+ offset: number;
126
+ }, Error, {
127
+ data: {
128
+ id: string;
129
+ bookingId: string;
130
+ supplierId: string | null;
131
+ amountCents: number;
132
+ currency: string;
133
+ paymentMethod: string;
134
+ status: "pending" | "completed" | "failed" | "refunded";
135
+ referenceNumber: string | null;
136
+ paymentDate: string;
137
+ createdAt: string;
138
+ notes?: string | null | undefined;
139
+ }[];
140
+ total: number;
141
+ limit: number;
142
+ offset: number;
143
+ }, readonly ["voyant", "finance", "supplier-payments", "list", import("./query-keys.js").FinanceSupplierPaymentListFilters]>, "queryFn"> & {
144
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
145
+ data: {
146
+ id: string;
147
+ bookingId: string;
148
+ supplierId: string | null;
149
+ amountCents: number;
150
+ currency: string;
151
+ paymentMethod: string;
152
+ status: "pending" | "completed" | "failed" | "refunded";
153
+ referenceNumber: string | null;
154
+ paymentDate: string;
155
+ createdAt: string;
156
+ notes?: string | null | undefined;
157
+ }[];
158
+ total: number;
159
+ limit: number;
160
+ offset: number;
161
+ }, readonly ["voyant", "finance", "supplier-payments", "list", import("./query-keys.js").FinanceSupplierPaymentListFilters], never> | undefined;
162
+ } & {
163
+ queryKey: readonly ["voyant", "finance", "supplier-payments", "list", import("./query-keys.js").FinanceSupplierPaymentListFilters] & {
164
+ [dataTagSymbol]: {
165
+ data: {
166
+ id: string;
167
+ bookingId: string;
168
+ supplierId: string | null;
169
+ amountCents: number;
170
+ currency: string;
171
+ paymentMethod: string;
172
+ status: "pending" | "completed" | "failed" | "refunded";
173
+ referenceNumber: string | null;
174
+ paymentDate: string;
175
+ createdAt: string;
176
+ notes?: string | null | undefined;
177
+ }[];
178
+ total: number;
179
+ limit: number;
180
+ offset: number;
181
+ };
182
+ [dataTagErrorSymbol]: Error;
183
+ };
184
+ };
185
+ export declare function getInvoiceQueryOptions(client: FetchWithValidationOptions, id: string | null | undefined, options?: UseInvoiceOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
186
+ data: {
187
+ id: string;
188
+ invoiceNumber: string;
189
+ bookingId: string;
190
+ personId: string | null;
191
+ organizationId: string | null;
192
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
193
+ currency: string;
194
+ subtotalCents: number;
195
+ taxCents: number;
196
+ totalCents: number;
197
+ paidCents: number;
198
+ balanceDueCents: number;
199
+ issueDate: string;
200
+ dueDate: string;
201
+ notes: string | null;
202
+ createdAt: string;
203
+ updatedAt: string;
204
+ };
205
+ }, Error, {
206
+ data: {
207
+ id: string;
208
+ invoiceNumber: string;
209
+ bookingId: string;
210
+ personId: string | null;
211
+ organizationId: string | null;
212
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
213
+ currency: string;
214
+ subtotalCents: number;
215
+ taxCents: number;
216
+ totalCents: number;
217
+ paidCents: number;
218
+ balanceDueCents: number;
219
+ issueDate: string;
220
+ dueDate: string;
221
+ notes: string | null;
222
+ createdAt: string;
223
+ updatedAt: string;
224
+ };
225
+ }, readonly ["voyant", "finance", "invoices", "detail", string]>, "queryFn"> & {
226
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
227
+ data: {
228
+ id: string;
229
+ invoiceNumber: string;
230
+ bookingId: string;
231
+ personId: string | null;
232
+ organizationId: string | null;
233
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
234
+ currency: string;
235
+ subtotalCents: number;
236
+ taxCents: number;
237
+ totalCents: number;
238
+ paidCents: number;
239
+ balanceDueCents: number;
240
+ issueDate: string;
241
+ dueDate: string;
242
+ notes: string | null;
243
+ createdAt: string;
244
+ updatedAt: string;
245
+ };
246
+ }, readonly ["voyant", "finance", "invoices", "detail", string], never> | undefined;
247
+ } & {
248
+ queryKey: readonly ["voyant", "finance", "invoices", "detail", string] & {
249
+ [dataTagSymbol]: {
250
+ data: {
251
+ id: string;
252
+ invoiceNumber: string;
253
+ bookingId: string;
254
+ personId: string | null;
255
+ organizationId: string | null;
256
+ status: "draft" | "void" | "sent" | "partially_paid" | "paid" | "overdue";
257
+ currency: string;
258
+ subtotalCents: number;
259
+ taxCents: number;
260
+ totalCents: number;
261
+ paidCents: number;
262
+ balanceDueCents: number;
263
+ issueDate: string;
264
+ dueDate: string;
265
+ notes: string | null;
266
+ createdAt: string;
267
+ updatedAt: string;
268
+ };
269
+ };
270
+ [dataTagErrorSymbol]: Error;
271
+ };
272
+ };
273
+ export declare function getInvoiceLineItemsQueryOptions(client: FetchWithValidationOptions, invoiceId: string | null | undefined, options?: UseInvoiceLineItemsOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
274
+ data: {
275
+ id: string;
276
+ invoiceId: string;
277
+ description: string;
278
+ quantity: number;
279
+ unitPriceCents: number;
280
+ totalCents: number;
281
+ taxRate: number | null;
282
+ sortOrder: number;
283
+ createdAt: string;
284
+ }[];
285
+ }, Error, {
286
+ data: {
287
+ id: string;
288
+ invoiceId: string;
289
+ description: string;
290
+ quantity: number;
291
+ unitPriceCents: number;
292
+ totalCents: number;
293
+ taxRate: number | null;
294
+ sortOrder: number;
295
+ createdAt: string;
296
+ }[];
297
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "line-items"]>, "queryFn"> & {
298
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
299
+ data: {
300
+ id: string;
301
+ invoiceId: string;
302
+ description: string;
303
+ quantity: number;
304
+ unitPriceCents: number;
305
+ totalCents: number;
306
+ taxRate: number | null;
307
+ sortOrder: number;
308
+ createdAt: string;
309
+ }[];
310
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "line-items"], never> | undefined;
311
+ } & {
312
+ queryKey: readonly ["voyant", "finance", "invoices", "detail", string, "line-items"] & {
313
+ [dataTagSymbol]: {
314
+ data: {
315
+ id: string;
316
+ invoiceId: string;
317
+ description: string;
318
+ quantity: number;
319
+ unitPriceCents: number;
320
+ totalCents: number;
321
+ taxRate: number | null;
322
+ sortOrder: number;
323
+ createdAt: string;
324
+ }[];
325
+ };
326
+ [dataTagErrorSymbol]: Error;
327
+ };
328
+ };
329
+ export declare function getInvoicePaymentsQueryOptions(client: FetchWithValidationOptions, invoiceId: string | null | undefined, options?: UseInvoicePaymentsOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
330
+ data: {
331
+ id: string;
332
+ invoiceId: string;
333
+ amountCents: number;
334
+ currency: string;
335
+ paymentMethod: string;
336
+ status: "pending" | "completed" | "failed" | "refunded";
337
+ referenceNumber: string | null;
338
+ paymentDate: string;
339
+ notes: string | null;
340
+ createdAt: string;
341
+ }[];
342
+ }, Error, {
343
+ data: {
344
+ id: string;
345
+ invoiceId: string;
346
+ amountCents: number;
347
+ currency: string;
348
+ paymentMethod: string;
349
+ status: "pending" | "completed" | "failed" | "refunded";
350
+ referenceNumber: string | null;
351
+ paymentDate: string;
352
+ notes: string | null;
353
+ createdAt: string;
354
+ }[];
355
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "payments"]>, "queryFn"> & {
356
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
357
+ data: {
358
+ id: string;
359
+ invoiceId: string;
360
+ amountCents: number;
361
+ currency: string;
362
+ paymentMethod: string;
363
+ status: "pending" | "completed" | "failed" | "refunded";
364
+ referenceNumber: string | null;
365
+ paymentDate: string;
366
+ notes: string | null;
367
+ createdAt: string;
368
+ }[];
369
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "payments"], never> | undefined;
370
+ } & {
371
+ queryKey: readonly ["voyant", "finance", "invoices", "detail", string, "payments"] & {
372
+ [dataTagSymbol]: {
373
+ data: {
374
+ id: string;
375
+ invoiceId: string;
376
+ amountCents: number;
377
+ currency: string;
378
+ paymentMethod: string;
379
+ status: "pending" | "completed" | "failed" | "refunded";
380
+ referenceNumber: string | null;
381
+ paymentDate: string;
382
+ notes: string | null;
383
+ createdAt: string;
384
+ }[];
385
+ };
386
+ [dataTagErrorSymbol]: Error;
387
+ };
388
+ };
389
+ export declare function getInvoiceCreditNotesQueryOptions(client: FetchWithValidationOptions, invoiceId: string | null | undefined, options?: UseInvoiceCreditNotesOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
390
+ data: {
391
+ id: string;
392
+ creditNoteNumber: string;
393
+ invoiceId: string;
394
+ status: "draft" | "issued" | "applied";
395
+ amountCents: number;
396
+ currency: string;
397
+ reason: string;
398
+ notes: string | null;
399
+ createdAt: string;
400
+ }[];
401
+ }, Error, {
402
+ data: {
403
+ id: string;
404
+ creditNoteNumber: string;
405
+ invoiceId: string;
406
+ status: "draft" | "issued" | "applied";
407
+ amountCents: number;
408
+ currency: string;
409
+ reason: string;
410
+ notes: string | null;
411
+ createdAt: string;
412
+ }[];
413
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "credit-notes"]>, "queryFn"> & {
414
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
415
+ data: {
416
+ id: string;
417
+ creditNoteNumber: string;
418
+ invoiceId: string;
419
+ status: "draft" | "issued" | "applied";
420
+ amountCents: number;
421
+ currency: string;
422
+ reason: string;
423
+ notes: string | null;
424
+ createdAt: string;
425
+ }[];
426
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "credit-notes"], never> | undefined;
427
+ } & {
428
+ queryKey: readonly ["voyant", "finance", "invoices", "detail", string, "credit-notes"] & {
429
+ [dataTagSymbol]: {
430
+ data: {
431
+ id: string;
432
+ creditNoteNumber: string;
433
+ invoiceId: string;
434
+ status: "draft" | "issued" | "applied";
435
+ amountCents: number;
436
+ currency: string;
437
+ reason: string;
438
+ notes: string | null;
439
+ createdAt: string;
440
+ }[];
441
+ };
442
+ [dataTagErrorSymbol]: Error;
443
+ };
444
+ };
445
+ export declare function getInvoiceNotesQueryOptions(client: FetchWithValidationOptions, invoiceId: string | null | undefined, options?: UseInvoiceNotesOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
446
+ data: {
447
+ id: string;
448
+ invoiceId: string;
449
+ authorId: string;
450
+ content: string;
451
+ createdAt: string;
452
+ }[];
453
+ }, Error, {
454
+ data: {
455
+ id: string;
456
+ invoiceId: string;
457
+ authorId: string;
458
+ content: string;
459
+ createdAt: string;
460
+ }[];
461
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "notes"]>, "queryFn"> & {
462
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
463
+ data: {
464
+ id: string;
465
+ invoiceId: string;
466
+ authorId: string;
467
+ content: string;
468
+ createdAt: string;
469
+ }[];
470
+ }, readonly ["voyant", "finance", "invoices", "detail", string, "notes"], never> | undefined;
471
+ } & {
472
+ queryKey: readonly ["voyant", "finance", "invoices", "detail", string, "notes"] & {
473
+ [dataTagSymbol]: {
474
+ data: {
475
+ id: string;
476
+ invoiceId: string;
477
+ authorId: string;
478
+ content: string;
479
+ createdAt: string;
480
+ }[];
481
+ };
482
+ [dataTagErrorSymbol]: Error;
483
+ };
484
+ };
485
+ //# sourceMappingURL=query-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAYlF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBjC;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBzC;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,EAClC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWhC;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezC;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,yBAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAexC;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,4BAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe3C;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAerC"}
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { queryOptions } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "./client.js";
4
+ import { financeQueryKeys } from "./query-keys.js";
5
+ import { invoiceCreditNotesResponse, invoiceLineItemsResponse, invoiceListResponse, invoiceNotesResponse, invoicePaymentsResponse, invoiceSingleResponse, supplierPaymentListResponse, } from "./schemas.js";
6
+ export function getInvoicesQueryOptions(client, options = {}) {
7
+ const { enabled: _enabled = true, ...filters } = options;
8
+ return queryOptions({
9
+ queryKey: financeQueryKeys.invoicesList(filters),
10
+ queryFn: () => {
11
+ const params = new URLSearchParams();
12
+ if (filters.search)
13
+ params.set("search", filters.search);
14
+ if (filters.limit !== undefined)
15
+ params.set("limit", String(filters.limit));
16
+ if (filters.offset !== undefined)
17
+ params.set("offset", String(filters.offset));
18
+ const qs = params.toString();
19
+ return fetchWithValidation(`/v1/finance/invoices${qs ? `?${qs}` : ""}`, invoiceListResponse, client);
20
+ },
21
+ });
22
+ }
23
+ export function getSupplierPaymentsQueryOptions(client, options = {}) {
24
+ const { enabled: _enabled = true, ...filters } = options;
25
+ return queryOptions({
26
+ queryKey: financeQueryKeys.supplierPaymentsList(filters),
27
+ queryFn: () => {
28
+ const params = new URLSearchParams();
29
+ if (filters.limit !== undefined)
30
+ params.set("limit", String(filters.limit));
31
+ if (filters.offset !== undefined)
32
+ params.set("offset", String(filters.offset));
33
+ const qs = params.toString();
34
+ return fetchWithValidation(`/v1/finance/supplier-payments${qs ? `?${qs}` : ""}`, supplierPaymentListResponse, client);
35
+ },
36
+ });
37
+ }
38
+ export function getInvoiceQueryOptions(client, id, options = {}) {
39
+ const { enabled: _enabled = true } = options;
40
+ return queryOptions({
41
+ queryKey: financeQueryKeys.invoice(id ?? ""),
42
+ queryFn: async () => {
43
+ if (!id)
44
+ throw new Error("getInvoiceQueryOptions requires an id");
45
+ return fetchWithValidation(`/v1/finance/invoices/${id}`, invoiceSingleResponse, client);
46
+ },
47
+ });
48
+ }
49
+ export function getInvoiceLineItemsQueryOptions(client, invoiceId, options = {}) {
50
+ const { enabled: _enabled = true } = options;
51
+ return queryOptions({
52
+ queryKey: financeQueryKeys.lineItems(invoiceId ?? ""),
53
+ queryFn: async () => {
54
+ if (!invoiceId)
55
+ throw new Error("getInvoiceLineItemsQueryOptions requires an invoiceId");
56
+ return fetchWithValidation(`/v1/finance/invoices/${invoiceId}/line-items`, invoiceLineItemsResponse, client);
57
+ },
58
+ });
59
+ }
60
+ export function getInvoicePaymentsQueryOptions(client, invoiceId, options = {}) {
61
+ const { enabled: _enabled = true } = options;
62
+ return queryOptions({
63
+ queryKey: financeQueryKeys.payments(invoiceId ?? ""),
64
+ queryFn: async () => {
65
+ if (!invoiceId)
66
+ throw new Error("getInvoicePaymentsQueryOptions requires an invoiceId");
67
+ return fetchWithValidation(`/v1/finance/invoices/${invoiceId}/payments`, invoicePaymentsResponse, client);
68
+ },
69
+ });
70
+ }
71
+ export function getInvoiceCreditNotesQueryOptions(client, invoiceId, options = {}) {
72
+ const { enabled: _enabled = true } = options;
73
+ return queryOptions({
74
+ queryKey: financeQueryKeys.creditNotes(invoiceId ?? ""),
75
+ queryFn: async () => {
76
+ if (!invoiceId)
77
+ throw new Error("getInvoiceCreditNotesQueryOptions requires an invoiceId");
78
+ return fetchWithValidation(`/v1/finance/invoices/${invoiceId}/credit-notes`, invoiceCreditNotesResponse, client);
79
+ },
80
+ });
81
+ }
82
+ export function getInvoiceNotesQueryOptions(client, invoiceId, options = {}) {
83
+ const { enabled: _enabled = true } = options;
84
+ return queryOptions({
85
+ queryKey: financeQueryKeys.notes(invoiceId ?? ""),
86
+ queryFn: async () => {
87
+ if (!invoiceId)
88
+ throw new Error("getInvoiceNotesQueryOptions requires an invoiceId");
89
+ return fetchWithValidation(`/v1/finance/invoices/${invoiceId}/notes`, invoiceNotesResponse, client);
90
+ },
91
+ });
92
+ }