@voyantjs/finance-react 0.6.9 → 0.8.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.
@@ -20,4 +20,7 @@ export * from "./use-public-payment-session-mutation.js";
20
20
  export * from "./use-public-voucher-validation-mutation.js";
21
21
  export * from "./use-supplier-payment-mutation.js";
22
22
  export * from "./use-supplier-payments.js";
23
+ export * from "./use-voucher.js";
24
+ export * from "./use-voucher-mutation.js";
25
+ export * from "./use-vouchers.js";
23
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA;AACrD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mCAAmC,CAAA;AACjD,cAAc,yCAAyC,CAAA;AACvD,cAAc,kCAAkC,CAAA;AAChD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0CAA0C,CAAA;AACxD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA;AACrD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mCAAmC,CAAA;AACjD,cAAc,yCAAyC,CAAA;AACvD,cAAc,kCAAkC,CAAA;AAChD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0CAA0C,CAAA;AACxD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA"}
@@ -20,3 +20,6 @@ export * from "./use-public-payment-session-mutation.js";
20
20
  export * from "./use-public-voucher-validation-mutation.js";
21
21
  export * from "./use-supplier-payment-mutation.js";
22
22
  export * from "./use-supplier-payments.js";
23
+ export * from "./use-voucher.js";
24
+ export * from "./use-voucher-mutation.js";
25
+ export * from "./use-vouchers.js";
@@ -1,11 +1,11 @@
1
1
  export declare function usePublicVoucherValidationMutation(): import("@tanstack/react-query").UseMutationResult<{
2
2
  data: {
3
3
  valid: boolean;
4
- reason: "expired" | "inactive" | "not_found" | "not_started" | "booking_mismatch" | "currency_mismatch" | "insufficient_balance" | null;
4
+ reason: "expired" | "inactive" | "insufficient_balance" | "not_found" | "not_started" | "booking_mismatch" | "currency_mismatch" | null;
5
5
  voucher: {
6
6
  id: string;
7
7
  code: string;
8
- label: string;
8
+ label: string | null;
9
9
  provider: string | null;
10
10
  currency: string | null;
11
11
  amountCents: number | null;
@@ -0,0 +1,105 @@
1
+ import { type VoucherRecord } from "../schemas.js";
2
+ export interface IssueVoucherInput {
3
+ code?: string | null;
4
+ currency: string;
5
+ amountCents: number;
6
+ issuedToPersonId?: string | null;
7
+ issuedToOrganizationId?: string | null;
8
+ sourceType: "refund" | "cancellation_credit" | "gift" | "manual" | "promo";
9
+ sourceBookingId?: string | null;
10
+ sourcePaymentId?: string | null;
11
+ expiresAt?: string | null;
12
+ notes?: string | null;
13
+ }
14
+ export interface UpdateVoucherInput {
15
+ status?: VoucherRecord["status"];
16
+ expiresAt?: string | null;
17
+ notes?: string | null;
18
+ issuedToPersonId?: string | null;
19
+ issuedToOrganizationId?: string | null;
20
+ }
21
+ export interface RedeemVoucherInput {
22
+ bookingId: string;
23
+ amountCents: number;
24
+ paymentId?: string | null;
25
+ }
26
+ /**
27
+ * Voucher mutations: issue a new voucher, update metadata (status / expiry /
28
+ * notes / assignment — NOT balance), or redeem against a booking. The redeem
29
+ * mutation is the only path that decrements `remainingAmountCents`; the
30
+ * server runs it transactionally with a redemption row.
31
+ */
32
+ export declare function useVoucherMutation(): {
33
+ issue: import("@tanstack/react-query").UseMutationResult<{
34
+ id: string;
35
+ code: string;
36
+ status: "void" | "expired" | "active" | "redeemed";
37
+ currency: string;
38
+ initialAmountCents: number;
39
+ remainingAmountCents: number;
40
+ issuedToPersonId: string | null;
41
+ issuedToOrganizationId: string | null;
42
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
43
+ sourceBookingId: string | null;
44
+ sourcePaymentId: string | null;
45
+ expiresAt: Date | null;
46
+ notes: string | null;
47
+ issuedByUserId: string | null;
48
+ createdAt: Date;
49
+ updatedAt: Date;
50
+ }, Error, IssueVoucherInput, unknown>;
51
+ update: import("@tanstack/react-query").UseMutationResult<{
52
+ id: string;
53
+ code: string;
54
+ status: "void" | "expired" | "active" | "redeemed";
55
+ currency: string;
56
+ initialAmountCents: number;
57
+ remainingAmountCents: number;
58
+ issuedToPersonId: string | null;
59
+ issuedToOrganizationId: string | null;
60
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
61
+ sourceBookingId: string | null;
62
+ sourcePaymentId: string | null;
63
+ expiresAt: Date | null;
64
+ notes: string | null;
65
+ issuedByUserId: string | null;
66
+ createdAt: Date;
67
+ updatedAt: Date;
68
+ }, Error, {
69
+ id: string;
70
+ input: UpdateVoucherInput;
71
+ }, unknown>;
72
+ redeem: import("@tanstack/react-query").UseMutationResult<{
73
+ voucher: {
74
+ id: string;
75
+ code: string;
76
+ status: "void" | "expired" | "active" | "redeemed";
77
+ currency: string;
78
+ initialAmountCents: number;
79
+ remainingAmountCents: number;
80
+ issuedToPersonId: string | null;
81
+ issuedToOrganizationId: string | null;
82
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
83
+ sourceBookingId: string | null;
84
+ sourcePaymentId: string | null;
85
+ expiresAt: Date | null;
86
+ notes: string | null;
87
+ issuedByUserId: string | null;
88
+ createdAt: Date;
89
+ updatedAt: Date;
90
+ };
91
+ redemption: {
92
+ id: string;
93
+ voucherId: string;
94
+ bookingId: string;
95
+ paymentId: string | null;
96
+ amountCents: number;
97
+ createdByUserId: string | null;
98
+ createdAt: Date;
99
+ } | null;
100
+ }, Error, {
101
+ id: string;
102
+ input: RedeemVoucherInput;
103
+ }, unknown>;
104
+ };
105
+ //# sourceMappingURL=use-voucher-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-voucher-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-voucher-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,eAAe,CAAA;AAEtB,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,UAAU,EAAE,QAAQ,GAAG,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC1E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAwBU,MAAM;eAAS,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoBnE,MAAM;eACH,kBAAkB;;EAmB9B"}
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantFinanceContext } from "../provider.js";
5
+ import { financeQueryKeys } from "../query-keys.js";
6
+ import { voucherRedemptionResponse, voucherSingleResponse, } from "../schemas.js";
7
+ /**
8
+ * Voucher mutations: issue a new voucher, update metadata (status / expiry /
9
+ * notes / assignment — NOT balance), or redeem against a booking. The redeem
10
+ * mutation is the only path that decrements `remainingAmountCents`; the
11
+ * server runs it transactionally with a redemption row.
12
+ */
13
+ export function useVoucherMutation() {
14
+ const { baseUrl, fetcher } = useVoyantFinanceContext();
15
+ const queryClient = useQueryClient();
16
+ const invalidateLists = () => queryClient.invalidateQueries({ queryKey: financeQueryKeys.vouchers() });
17
+ const issue = useMutation({
18
+ mutationFn: async (input) => {
19
+ const { data } = await fetchWithValidation("/v1/finance/vouchers", voucherSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
20
+ return data;
21
+ },
22
+ onSuccess: (data) => {
23
+ invalidateLists();
24
+ queryClient.setQueryData(financeQueryKeys.voucher(data.id), { data });
25
+ },
26
+ });
27
+ const update = useMutation({
28
+ mutationFn: async ({ id, input }) => {
29
+ const { data } = await fetchWithValidation(`/v1/finance/vouchers/${id}`, voucherSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
30
+ return data;
31
+ },
32
+ onSuccess: (data) => {
33
+ invalidateLists();
34
+ queryClient.setQueryData(financeQueryKeys.voucher(data.id), { data });
35
+ },
36
+ });
37
+ const redeem = useMutation({
38
+ mutationFn: async ({ id, input, }) => {
39
+ const { data } = await fetchWithValidation(`/v1/finance/vouchers/${id}/redeem`, voucherRedemptionResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
40
+ return data;
41
+ },
42
+ onSuccess: (result) => {
43
+ invalidateLists();
44
+ // Invalidate the detail entry — the redemption row should show up in
45
+ // the next `useVoucher` read.
46
+ void queryClient.invalidateQueries({ queryKey: financeQueryKeys.voucher(result.voucher.id) });
47
+ },
48
+ });
49
+ return { issue, update, redeem };
50
+ }
@@ -0,0 +1,38 @@
1
+ export interface UseVoucherOptions {
2
+ enabled?: boolean;
3
+ }
4
+ /**
5
+ * Single voucher + redemption history. The response envelope attaches the
6
+ * full `redemptions[]` list so the operator detail view can render the audit
7
+ * trail in one request.
8
+ */
9
+ export declare function useVoucher(id: string | null | undefined, options?: UseVoucherOptions): import("@tanstack/react-query").UseQueryResult<{
10
+ data: {
11
+ id: string;
12
+ code: string;
13
+ status: "void" | "expired" | "active" | "redeemed";
14
+ currency: string;
15
+ initialAmountCents: number;
16
+ remainingAmountCents: number;
17
+ issuedToPersonId: string | null;
18
+ issuedToOrganizationId: string | null;
19
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
20
+ sourceBookingId: string | null;
21
+ sourcePaymentId: string | null;
22
+ expiresAt: Date | null;
23
+ notes: string | null;
24
+ issuedByUserId: string | null;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ redemptions: {
28
+ id: string;
29
+ voucherId: string;
30
+ bookingId: string;
31
+ paymentId: string | null;
32
+ amountCents: number;
33
+ createdByUserId: string | null;
34
+ createdAt: Date;
35
+ }[];
36
+ };
37
+ }, Error>;
38
+ //# sourceMappingURL=use-voucher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-voucher.d.ts","sourceRoot":"","sources":["../../src/hooks/use-voucher.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQxF"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantFinanceContext } from "../provider.js";
4
+ import { getVoucherQueryOptions } from "../query-options.js";
5
+ /**
6
+ * Single voucher + redemption history. The response envelope attaches the
7
+ * full `redemptions[]` list so the operator detail view can render the audit
8
+ * trail in one request.
9
+ */
10
+ export function useVoucher(id, options = {}) {
11
+ const { baseUrl, fetcher } = useVoyantFinanceContext();
12
+ const { enabled = true } = options;
13
+ return useQuery({
14
+ ...getVoucherQueryOptions({ baseUrl, fetcher }, id),
15
+ enabled: enabled && Boolean(id),
16
+ });
17
+ }
@@ -0,0 +1,34 @@
1
+ import type { FinanceVoucherListFilters } from "../query-keys.js";
2
+ export interface UseVouchersOptions extends FinanceVoucherListFilters {
3
+ enabled?: boolean;
4
+ }
5
+ /**
6
+ * Admin voucher list. Filters by status, person/org assignment, free-text
7
+ * search over code/notes, and `hasBalance` (remaining > 0). Use
8
+ * `hasBalance: true` for the voucher picker in booking-create flows — a
9
+ * voucher with zero balance is a historical record, not spendable credit.
10
+ */
11
+ export declare function useVouchers(options?: UseVouchersOptions): import("@tanstack/react-query").UseQueryResult<{
12
+ data: {
13
+ id: string;
14
+ code: string;
15
+ status: "void" | "expired" | "active" | "redeemed";
16
+ currency: string;
17
+ initialAmountCents: number;
18
+ remainingAmountCents: number;
19
+ issuedToPersonId: string | null;
20
+ issuedToOrganizationId: string | null;
21
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
22
+ sourceBookingId: string | null;
23
+ sourcePaymentId: string | null;
24
+ expiresAt: Date | null;
25
+ notes: string | null;
26
+ issuedByUserId: string | null;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ }[];
30
+ total: number;
31
+ limit: number;
32
+ offset: number;
33
+ }, Error>;
34
+ //# sourceMappingURL=use-vouchers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-vouchers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-vouchers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAGjE,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;UAQ3D"}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantFinanceContext } from "../provider.js";
4
+ import { getVouchersQueryOptions } from "../query-options.js";
5
+ /**
6
+ * Admin voucher list. Filters by status, person/org assignment, free-text
7
+ * search over code/notes, and `hasBalance` (remaining > 0). Use
8
+ * `hasBalance: true` for the voucher picker in booking-create flows — a
9
+ * voucher with zero balance is a historical record, not spendable credit.
10
+ */
11
+ export function useVouchers(options = {}) {
12
+ const { baseUrl, fetcher } = useVoyantFinanceContext();
13
+ const { enabled = true, ...filters } = options;
14
+ return useQuery({
15
+ ...getVouchersQueryOptions({ baseUrl, fetcher }, filters),
16
+ enabled,
17
+ });
18
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,6 @@ export * from "./hooks/index.js";
3
3
  export { getPublicBookingDocuments, getPublicBookingPaymentOptions, getPublicBookingPayments, getPublicFinanceDocumentByReference, getPublicPaymentSession, startPublicBookingGuaranteePaymentSession, startPublicBookingSchedulePaymentSession, validatePublicVoucher, } from "./operations.js";
4
4
  export { useVoyantFinanceContext, type VoyantFinanceContextValue, VoyantFinanceProvider, type VoyantFinanceProviderProps, } from "./provider.js";
5
5
  export { financeQueryKeys } from "./query-keys.js";
6
- export { getBookingGuaranteesQueryOptions, getBookingPaymentSchedulesQueryOptions, getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, getInvoicesQueryOptions, getPublicBookingDocumentsQueryOptions, getPublicBookingPaymentOptionsQueryOptions, getPublicBookingPaymentsQueryOptions, getPublicFinanceDocumentByReferenceQueryOptions, getPublicPaymentSessionQueryOptions, getSupplierPaymentsQueryOptions, } from "./query-options.js";
6
+ export { getBookingGuaranteesQueryOptions, getBookingPaymentSchedulesQueryOptions, getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, getInvoicesQueryOptions, getPublicBookingDocumentsQueryOptions, getPublicBookingPaymentOptionsQueryOptions, getPublicBookingPaymentsQueryOptions, getPublicFinanceDocumentByReferenceQueryOptions, getPublicPaymentSessionQueryOptions, getSupplierPaymentsQueryOptions, getVoucherQueryOptions, getVouchersQueryOptions, } from "./query-options.js";
7
7
  export * from "./schemas.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,wBAAwB,EACxB,mCAAmC,EACnC,uBAAuB,EACvB,yCAAyC,EACzC,wCAAwC,EACxC,qBAAqB,GACtB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EACL,gCAAgC,EAChC,sCAAsC,EACtC,iCAAiC,EACjC,+BAA+B,EAC/B,2BAA2B,EAC3B,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,qCAAqC,EACrC,0CAA0C,EAC1C,oCAAoC,EACpC,+CAA+C,EAC/C,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,wBAAwB,EACxB,mCAAmC,EACnC,uBAAuB,EACvB,yCAAyC,EACzC,wCAAwC,EACxC,qBAAqB,GACtB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EACL,gCAAgC,EAChC,sCAAsC,EACtC,iCAAiC,EACjC,+BAA+B,EAC/B,2BAA2B,EAC3B,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,qCAAqC,EACrC,0CAA0C,EAC1C,oCAAoC,EACpC,+CAA+C,EAC/C,mCAAmC,EACnC,+BAA+B,EAC/B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -3,5 +3,5 @@ export * from "./hooks/index.js";
3
3
  export { getPublicBookingDocuments, getPublicBookingPaymentOptions, getPublicBookingPayments, getPublicFinanceDocumentByReference, getPublicPaymentSession, startPublicBookingGuaranteePaymentSession, startPublicBookingSchedulePaymentSession, validatePublicVoucher, } from "./operations.js";
4
4
  export { useVoyantFinanceContext, VoyantFinanceProvider, } from "./provider.js";
5
5
  export { financeQueryKeys } from "./query-keys.js";
6
- export { getBookingGuaranteesQueryOptions, getBookingPaymentSchedulesQueryOptions, getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, getInvoicesQueryOptions, getPublicBookingDocumentsQueryOptions, getPublicBookingPaymentOptionsQueryOptions, getPublicBookingPaymentsQueryOptions, getPublicFinanceDocumentByReferenceQueryOptions, getPublicPaymentSessionQueryOptions, getSupplierPaymentsQueryOptions, } from "./query-options.js";
6
+ export { getBookingGuaranteesQueryOptions, getBookingPaymentSchedulesQueryOptions, getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, getInvoicesQueryOptions, getPublicBookingDocumentsQueryOptions, getPublicBookingPaymentOptionsQueryOptions, getPublicBookingPaymentsQueryOptions, getPublicFinanceDocumentByReferenceQueryOptions, getPublicPaymentSessionQueryOptions, getSupplierPaymentsQueryOptions, getVoucherQueryOptions, getVouchersQueryOptions, } from "./query-options.js";
7
7
  export * from "./schemas.js";
@@ -204,11 +204,11 @@ export declare function startPublicBookingGuaranteePaymentSession(client: FetchW
204
204
  export declare function validatePublicVoucher(client: FetchWithValidationOptions, input: PublicValidateVoucherInput): Promise<{
205
205
  data: {
206
206
  valid: boolean;
207
- reason: "expired" | "inactive" | "not_found" | "not_started" | "booking_mismatch" | "currency_mismatch" | "insufficient_balance" | null;
207
+ reason: "expired" | "inactive" | "insufficient_balance" | "not_found" | "not_started" | "booking_mismatch" | "currency_mismatch" | null;
208
208
  voucher: {
209
209
  id: string;
210
210
  code: string;
211
- label: string;
211
+ label: string | null;
212
212
  provider: string | null;
213
213
  currency: string | null;
214
214
  amountCents: number | null;
@@ -7,6 +7,15 @@ export interface FinanceSupplierPaymentListFilters {
7
7
  limit?: number | undefined;
8
8
  offset?: number | undefined;
9
9
  }
10
+ export interface FinanceVoucherListFilters {
11
+ status?: string | undefined;
12
+ issuedToPersonId?: string | undefined;
13
+ issuedToOrganizationId?: string | undefined;
14
+ search?: string | undefined;
15
+ hasBalance?: boolean | undefined;
16
+ limit?: number | undefined;
17
+ offset?: number | undefined;
18
+ }
10
19
  export interface PublicBookingPaymentOptionsFilters {
11
20
  personId?: string | undefined;
12
21
  organizationId?: string | undefined;
@@ -37,5 +46,8 @@ export declare const financeQueryKeys: {
37
46
  readonly publicBookingPaymentOptions: (bookingId: string, filters: PublicBookingPaymentOptionsFilters) => readonly ["voyant", "finance", "public-checkout", "booking-payment-options", string, PublicBookingPaymentOptionsFilters];
38
47
  readonly publicPaymentSession: (sessionId: string) => readonly ["voyant", "finance", "public-checkout", "payment-session", string];
39
48
  readonly publicVoucherValidation: () => readonly ["voyant", "finance", "public-checkout", "voucher-validation"];
49
+ readonly vouchers: () => readonly ["voyant", "finance", "vouchers"];
50
+ readonly vouchersList: (filters: FinanceVoucherListFilters) => readonly ["voyant", "finance", "vouchers", "list", FinanceVoucherListFilters];
51
+ readonly voucher: (id: string) => readonly ["voyant", "finance", "vouchers", "detail", string];
40
52
  };
41
53
  //# sourceMappingURL=query-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC;AAED,MAAM,WAAW,kCAAkC;IACjD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,gBAAgB;;;qCAIH,yBAAyB;2BAEnC,MAAM;oCACG,MAAM;mCACP,MAAM;sCACH,MAAM;gCAEZ,MAAM;kDAEY,MAAM;4CAEZ,MAAM;;6CAIL,iCAAiC;;oDAI1B,kCAAkC;iDAErC,MAAM;gDAEP,MAAM;sDAEA,MAAM,WAAW,kCAAkC;+CAE1D,MAAM;;CAIhC,CAAA"}
1
+ {"version":3,"file":"query-keys.d.ts","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L,iCAAiC;;oDAI1B,kCAAkC;iDAErC,MAAM;gDAEP,MAAM;sDAEA,MAAM,WAAW,kCAAkC;+CAE1D,MAAM;;;qCAMhB,yBAAyB;2BAEnC,MAAM;CACZ,CAAA"}
@@ -18,4 +18,7 @@ export const financeQueryKeys = {
18
18
  publicBookingPaymentOptions: (bookingId, filters) => [...financeQueryKeys.publicCheckout(), "booking-payment-options", bookingId, filters],
19
19
  publicPaymentSession: (sessionId) => [...financeQueryKeys.publicCheckout(), "payment-session", sessionId],
20
20
  publicVoucherValidation: () => [...financeQueryKeys.publicCheckout(), "voucher-validation"],
21
+ vouchers: () => [...financeQueryKeys.all, "vouchers"],
22
+ vouchersList: (filters) => [...financeQueryKeys.vouchers(), "list", filters],
23
+ voucher: (id) => [...financeQueryKeys.vouchers(), "detail", id],
21
24
  };
@@ -13,6 +13,8 @@ import type { UsePublicBookingPaymentsOptions } from "./hooks/use-public-booking
13
13
  import type { UsePublicFinanceDocumentByReferenceOptions } from "./hooks/use-public-finance-document-by-reference.js";
14
14
  import type { UsePublicPaymentSessionOptions } from "./hooks/use-public-payment-session.js";
15
15
  import type { UseSupplierPaymentsOptions } from "./hooks/use-supplier-payments.js";
16
+ import type { UseVoucherOptions } from "./hooks/use-voucher.js";
17
+ import type { UseVouchersOptions } from "./hooks/use-vouchers.js";
16
18
  export declare function getBookingPaymentSchedulesQueryOptions(client: FetchWithValidationOptions, bookingId: string | null | undefined, options?: UseBookingPaymentSchedulesOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
17
19
  data: {
18
20
  id: string;
@@ -1205,4 +1207,220 @@ export declare function getPublicPaymentSessionQueryOptions(client: FetchWithVal
1205
1207
  [dataTagErrorSymbol]: Error;
1206
1208
  };
1207
1209
  };
1210
+ export declare function getVouchersQueryOptions(client: FetchWithValidationOptions, options?: UseVouchersOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
1211
+ data: {
1212
+ id: string;
1213
+ code: string;
1214
+ status: "void" | "expired" | "active" | "redeemed";
1215
+ currency: string;
1216
+ initialAmountCents: number;
1217
+ remainingAmountCents: number;
1218
+ issuedToPersonId: string | null;
1219
+ issuedToOrganizationId: string | null;
1220
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1221
+ sourceBookingId: string | null;
1222
+ sourcePaymentId: string | null;
1223
+ expiresAt: Date | null;
1224
+ notes: string | null;
1225
+ issuedByUserId: string | null;
1226
+ createdAt: Date;
1227
+ updatedAt: Date;
1228
+ }[];
1229
+ total: number;
1230
+ limit: number;
1231
+ offset: number;
1232
+ }, Error, {
1233
+ data: {
1234
+ id: string;
1235
+ code: string;
1236
+ status: "void" | "expired" | "active" | "redeemed";
1237
+ currency: string;
1238
+ initialAmountCents: number;
1239
+ remainingAmountCents: number;
1240
+ issuedToPersonId: string | null;
1241
+ issuedToOrganizationId: string | null;
1242
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1243
+ sourceBookingId: string | null;
1244
+ sourcePaymentId: string | null;
1245
+ expiresAt: Date | null;
1246
+ notes: string | null;
1247
+ issuedByUserId: string | null;
1248
+ createdAt: Date;
1249
+ updatedAt: Date;
1250
+ }[];
1251
+ total: number;
1252
+ limit: number;
1253
+ offset: number;
1254
+ }, readonly ["voyant", "finance", "vouchers", "list", import("./query-keys.js").FinanceVoucherListFilters]>, "queryFn"> & {
1255
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
1256
+ data: {
1257
+ id: string;
1258
+ code: string;
1259
+ status: "void" | "expired" | "active" | "redeemed";
1260
+ currency: string;
1261
+ initialAmountCents: number;
1262
+ remainingAmountCents: number;
1263
+ issuedToPersonId: string | null;
1264
+ issuedToOrganizationId: string | null;
1265
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1266
+ sourceBookingId: string | null;
1267
+ sourcePaymentId: string | null;
1268
+ expiresAt: Date | null;
1269
+ notes: string | null;
1270
+ issuedByUserId: string | null;
1271
+ createdAt: Date;
1272
+ updatedAt: Date;
1273
+ }[];
1274
+ total: number;
1275
+ limit: number;
1276
+ offset: number;
1277
+ }, readonly ["voyant", "finance", "vouchers", "list", import("./query-keys.js").FinanceVoucherListFilters], never> | undefined;
1278
+ } & {
1279
+ queryKey: readonly ["voyant", "finance", "vouchers", "list", import("./query-keys.js").FinanceVoucherListFilters] & {
1280
+ [dataTagSymbol]: {
1281
+ data: {
1282
+ id: string;
1283
+ code: string;
1284
+ status: "void" | "expired" | "active" | "redeemed";
1285
+ currency: string;
1286
+ initialAmountCents: number;
1287
+ remainingAmountCents: number;
1288
+ issuedToPersonId: string | null;
1289
+ issuedToOrganizationId: string | null;
1290
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1291
+ sourceBookingId: string | null;
1292
+ sourcePaymentId: string | null;
1293
+ expiresAt: Date | null;
1294
+ notes: string | null;
1295
+ issuedByUserId: string | null;
1296
+ createdAt: Date;
1297
+ updatedAt: Date;
1298
+ }[];
1299
+ total: number;
1300
+ limit: number;
1301
+ offset: number;
1302
+ };
1303
+ [dataTagErrorSymbol]: Error;
1304
+ };
1305
+ };
1306
+ export declare function getVoucherQueryOptions(client: FetchWithValidationOptions, id: string | null | undefined, options?: UseVoucherOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
1307
+ data: {
1308
+ id: string;
1309
+ code: string;
1310
+ status: "void" | "expired" | "active" | "redeemed";
1311
+ currency: string;
1312
+ initialAmountCents: number;
1313
+ remainingAmountCents: number;
1314
+ issuedToPersonId: string | null;
1315
+ issuedToOrganizationId: string | null;
1316
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1317
+ sourceBookingId: string | null;
1318
+ sourcePaymentId: string | null;
1319
+ expiresAt: Date | null;
1320
+ notes: string | null;
1321
+ issuedByUserId: string | null;
1322
+ createdAt: Date;
1323
+ updatedAt: Date;
1324
+ redemptions: {
1325
+ id: string;
1326
+ voucherId: string;
1327
+ bookingId: string;
1328
+ paymentId: string | null;
1329
+ amountCents: number;
1330
+ createdByUserId: string | null;
1331
+ createdAt: Date;
1332
+ }[];
1333
+ };
1334
+ }, Error, {
1335
+ data: {
1336
+ id: string;
1337
+ code: string;
1338
+ status: "void" | "expired" | "active" | "redeemed";
1339
+ currency: string;
1340
+ initialAmountCents: number;
1341
+ remainingAmountCents: number;
1342
+ issuedToPersonId: string | null;
1343
+ issuedToOrganizationId: string | null;
1344
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1345
+ sourceBookingId: string | null;
1346
+ sourcePaymentId: string | null;
1347
+ expiresAt: Date | null;
1348
+ notes: string | null;
1349
+ issuedByUserId: string | null;
1350
+ createdAt: Date;
1351
+ updatedAt: Date;
1352
+ redemptions: {
1353
+ id: string;
1354
+ voucherId: string;
1355
+ bookingId: string;
1356
+ paymentId: string | null;
1357
+ amountCents: number;
1358
+ createdByUserId: string | null;
1359
+ createdAt: Date;
1360
+ }[];
1361
+ };
1362
+ }, readonly ["voyant", "finance", "vouchers", "detail", string]>, "queryFn"> & {
1363
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
1364
+ data: {
1365
+ id: string;
1366
+ code: string;
1367
+ status: "void" | "expired" | "active" | "redeemed";
1368
+ currency: string;
1369
+ initialAmountCents: number;
1370
+ remainingAmountCents: number;
1371
+ issuedToPersonId: string | null;
1372
+ issuedToOrganizationId: string | null;
1373
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1374
+ sourceBookingId: string | null;
1375
+ sourcePaymentId: string | null;
1376
+ expiresAt: Date | null;
1377
+ notes: string | null;
1378
+ issuedByUserId: string | null;
1379
+ createdAt: Date;
1380
+ updatedAt: Date;
1381
+ redemptions: {
1382
+ id: string;
1383
+ voucherId: string;
1384
+ bookingId: string;
1385
+ paymentId: string | null;
1386
+ amountCents: number;
1387
+ createdByUserId: string | null;
1388
+ createdAt: Date;
1389
+ }[];
1390
+ };
1391
+ }, readonly ["voyant", "finance", "vouchers", "detail", string], never> | undefined;
1392
+ } & {
1393
+ queryKey: readonly ["voyant", "finance", "vouchers", "detail", string] & {
1394
+ [dataTagSymbol]: {
1395
+ data: {
1396
+ id: string;
1397
+ code: string;
1398
+ status: "void" | "expired" | "active" | "redeemed";
1399
+ currency: string;
1400
+ initialAmountCents: number;
1401
+ remainingAmountCents: number;
1402
+ issuedToPersonId: string | null;
1403
+ issuedToOrganizationId: string | null;
1404
+ sourceType: "manual" | "refund" | "cancellation_credit" | "gift" | "promo";
1405
+ sourceBookingId: string | null;
1406
+ sourcePaymentId: string | null;
1407
+ expiresAt: Date | null;
1408
+ notes: string | null;
1409
+ issuedByUserId: string | null;
1410
+ createdAt: Date;
1411
+ updatedAt: Date;
1412
+ redemptions: {
1413
+ id: string;
1414
+ voucherId: string;
1415
+ bookingId: string;
1416
+ paymentId: string | null;
1417
+ amountCents: number;
1418
+ createdByUserId: string | null;
1419
+ createdAt: Date;
1420
+ }[];
1421
+ };
1422
+ };
1423
+ [dataTagErrorSymbol]: Error;
1424
+ };
1425
+ };
1208
1426
  //# sourceMappingURL=query-options.d.ts.map
@@ -1 +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,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,0CAA0C,CAAA;AACjG,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,EA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EACpC,OAAO,GAAE,+BAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9C;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc7C;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BjC;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,EAClC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWhC"}
@@ -3,7 +3,7 @@ import { queryOptions } from "@tanstack/react-query";
3
3
  import { fetchWithValidation } from "./client.js";
4
4
  import { getPublicBookingDocuments, getPublicBookingPaymentOptions, getPublicBookingPayments, getPublicFinanceDocumentByReference, getPublicPaymentSession, } from "./operations.js";
5
5
  import { financeQueryKeys } from "./query-keys.js";
6
- import { bookingGuaranteesResponse, bookingPaymentSchedulesResponse, invoiceCreditNotesResponse, invoiceLineItemsResponse, invoiceListResponse, invoiceNotesResponse, invoicePaymentsResponse, invoiceSingleResponse, supplierPaymentListResponse, } from "./schemas.js";
6
+ import { bookingGuaranteesResponse, bookingPaymentSchedulesResponse, invoiceCreditNotesResponse, invoiceLineItemsResponse, invoiceListResponse, invoiceNotesResponse, invoicePaymentsResponse, invoiceSingleResponse, supplierPaymentListResponse, voucherDetailResponse, voucherListResponse, } from "./schemas.js";
7
7
  export function getBookingPaymentSchedulesQueryOptions(client, bookingId, options = {}) {
8
8
  const { enabled: _enabled = true } = options;
9
9
  return queryOptions({
@@ -165,3 +165,40 @@ export function getPublicPaymentSessionQueryOptions(client, sessionId, options =
165
165
  },
166
166
  });
167
167
  }
168
+ export function getVouchersQueryOptions(client, options = {}) {
169
+ const { enabled: _enabled = true, ...filters } = options;
170
+ return queryOptions({
171
+ queryKey: financeQueryKeys.vouchersList(filters),
172
+ queryFn: () => {
173
+ const params = new URLSearchParams();
174
+ if (filters.status)
175
+ params.set("status", filters.status);
176
+ if (filters.issuedToPersonId)
177
+ params.set("issuedToPersonId", filters.issuedToPersonId);
178
+ if (filters.issuedToOrganizationId) {
179
+ params.set("issuedToOrganizationId", filters.issuedToOrganizationId);
180
+ }
181
+ if (filters.search)
182
+ params.set("search", filters.search);
183
+ if (filters.hasBalance !== undefined)
184
+ params.set("hasBalance", String(filters.hasBalance));
185
+ if (filters.limit !== undefined)
186
+ params.set("limit", String(filters.limit));
187
+ if (filters.offset !== undefined)
188
+ params.set("offset", String(filters.offset));
189
+ const qs = params.toString();
190
+ return fetchWithValidation(`/v1/finance/vouchers${qs ? `?${qs}` : ""}`, voucherListResponse, client);
191
+ },
192
+ });
193
+ }
194
+ export function getVoucherQueryOptions(client, id, options = {}) {
195
+ const { enabled: _enabled = true } = options;
196
+ return queryOptions({
197
+ queryKey: financeQueryKeys.voucher(id ?? ""),
198
+ queryFn: async () => {
199
+ if (!id)
200
+ throw new Error("getVoucherQueryOptions requires an id");
201
+ return fetchWithValidation(`/v1/finance/vouchers/${id}`, voucherDetailResponse, client);
202
+ },
203
+ });
204
+ }
package/dist/schemas.d.ts CHANGED
@@ -697,16 +697,16 @@ export declare const publicVoucherValidationResponse: z.ZodObject<{
697
697
  reason: z.ZodNullable<z.ZodEnum<{
698
698
  expired: "expired";
699
699
  inactive: "inactive";
700
+ insufficient_balance: "insufficient_balance";
700
701
  not_found: "not_found";
701
702
  not_started: "not_started";
702
703
  booking_mismatch: "booking_mismatch";
703
704
  currency_mismatch: "currency_mismatch";
704
- insufficient_balance: "insufficient_balance";
705
705
  }>>;
706
706
  voucher: z.ZodNullable<z.ZodObject<{
707
707
  id: z.ZodString;
708
708
  code: z.ZodString;
709
- label: z.ZodString;
709
+ label: z.ZodNullable<z.ZodString>;
710
710
  provider: z.ZodNullable<z.ZodString>;
711
711
  currency: z.ZodNullable<z.ZodString>;
712
712
  amountCents: z.ZodNullable<z.ZodNumber>;
@@ -726,4 +726,285 @@ export type PublicPaymentSessionRecord = z.infer<typeof publicPaymentSessionSche
726
726
  export type PublicStartPaymentSessionInput = z.input<typeof publicStartPaymentSessionSchema>;
727
727
  export type PublicValidateVoucherInput = z.input<typeof publicValidateVoucherSchema>;
728
728
  export type PublicVoucherValidationRecord = z.infer<typeof publicVoucherValidationSchema>;
729
+ export declare const voucherStatusSchema: z.ZodEnum<{
730
+ void: "void";
731
+ expired: "expired";
732
+ active: "active";
733
+ redeemed: "redeemed";
734
+ }>;
735
+ export declare const voucherSourceTypeSchema: z.ZodEnum<{
736
+ manual: "manual";
737
+ refund: "refund";
738
+ cancellation_credit: "cancellation_credit";
739
+ gift: "gift";
740
+ promo: "promo";
741
+ }>;
742
+ export declare const voucherRecordSchema: z.ZodObject<{
743
+ id: z.ZodString;
744
+ code: z.ZodString;
745
+ status: z.ZodEnum<{
746
+ void: "void";
747
+ expired: "expired";
748
+ active: "active";
749
+ redeemed: "redeemed";
750
+ }>;
751
+ currency: z.ZodString;
752
+ initialAmountCents: z.ZodNumber;
753
+ remainingAmountCents: z.ZodNumber;
754
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
755
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
756
+ sourceType: z.ZodEnum<{
757
+ manual: "manual";
758
+ refund: "refund";
759
+ cancellation_credit: "cancellation_credit";
760
+ gift: "gift";
761
+ promo: "promo";
762
+ }>;
763
+ sourceBookingId: z.ZodNullable<z.ZodString>;
764
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
765
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
766
+ notes: z.ZodNullable<z.ZodString>;
767
+ issuedByUserId: z.ZodNullable<z.ZodString>;
768
+ createdAt: z.ZodCoercedDate<unknown>;
769
+ updatedAt: z.ZodCoercedDate<unknown>;
770
+ }, z.core.$strip>;
771
+ export type VoucherRecord = z.infer<typeof voucherRecordSchema>;
772
+ export declare const voucherRedemptionRecordSchema: z.ZodObject<{
773
+ id: z.ZodString;
774
+ voucherId: z.ZodString;
775
+ bookingId: z.ZodString;
776
+ paymentId: z.ZodNullable<z.ZodString>;
777
+ amountCents: z.ZodNumber;
778
+ createdByUserId: z.ZodNullable<z.ZodString>;
779
+ createdAt: z.ZodCoercedDate<unknown>;
780
+ }, z.core.$strip>;
781
+ export type VoucherRedemptionRecord = z.infer<typeof voucherRedemptionRecordSchema>;
782
+ export declare const voucherDetailSchema: z.ZodObject<{
783
+ id: z.ZodString;
784
+ code: z.ZodString;
785
+ status: z.ZodEnum<{
786
+ void: "void";
787
+ expired: "expired";
788
+ active: "active";
789
+ redeemed: "redeemed";
790
+ }>;
791
+ currency: z.ZodString;
792
+ initialAmountCents: z.ZodNumber;
793
+ remainingAmountCents: z.ZodNumber;
794
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
795
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
796
+ sourceType: z.ZodEnum<{
797
+ manual: "manual";
798
+ refund: "refund";
799
+ cancellation_credit: "cancellation_credit";
800
+ gift: "gift";
801
+ promo: "promo";
802
+ }>;
803
+ sourceBookingId: z.ZodNullable<z.ZodString>;
804
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
805
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
806
+ notes: z.ZodNullable<z.ZodString>;
807
+ issuedByUserId: z.ZodNullable<z.ZodString>;
808
+ createdAt: z.ZodCoercedDate<unknown>;
809
+ updatedAt: z.ZodCoercedDate<unknown>;
810
+ redemptions: z.ZodArray<z.ZodObject<{
811
+ id: z.ZodString;
812
+ voucherId: z.ZodString;
813
+ bookingId: z.ZodString;
814
+ paymentId: z.ZodNullable<z.ZodString>;
815
+ amountCents: z.ZodNumber;
816
+ createdByUserId: z.ZodNullable<z.ZodString>;
817
+ createdAt: z.ZodCoercedDate<unknown>;
818
+ }, z.core.$strip>>;
819
+ }, z.core.$strip>;
820
+ export type VoucherDetailRecord = z.infer<typeof voucherDetailSchema>;
821
+ /** Result envelope for `POST /v1/finance/vouchers/:id/redeem`. */
822
+ export declare const voucherRedemptionResultSchema: z.ZodObject<{
823
+ voucher: z.ZodObject<{
824
+ id: z.ZodString;
825
+ code: z.ZodString;
826
+ status: z.ZodEnum<{
827
+ void: "void";
828
+ expired: "expired";
829
+ active: "active";
830
+ redeemed: "redeemed";
831
+ }>;
832
+ currency: z.ZodString;
833
+ initialAmountCents: z.ZodNumber;
834
+ remainingAmountCents: z.ZodNumber;
835
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
836
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
837
+ sourceType: z.ZodEnum<{
838
+ manual: "manual";
839
+ refund: "refund";
840
+ cancellation_credit: "cancellation_credit";
841
+ gift: "gift";
842
+ promo: "promo";
843
+ }>;
844
+ sourceBookingId: z.ZodNullable<z.ZodString>;
845
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
846
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
847
+ notes: z.ZodNullable<z.ZodString>;
848
+ issuedByUserId: z.ZodNullable<z.ZodString>;
849
+ createdAt: z.ZodCoercedDate<unknown>;
850
+ updatedAt: z.ZodCoercedDate<unknown>;
851
+ }, z.core.$strip>;
852
+ redemption: z.ZodNullable<z.ZodObject<{
853
+ id: z.ZodString;
854
+ voucherId: z.ZodString;
855
+ bookingId: z.ZodString;
856
+ paymentId: z.ZodNullable<z.ZodString>;
857
+ amountCents: z.ZodNumber;
858
+ createdByUserId: z.ZodNullable<z.ZodString>;
859
+ createdAt: z.ZodCoercedDate<unknown>;
860
+ }, z.core.$strip>>;
861
+ }, z.core.$strip>;
862
+ export type VoucherRedemptionResult = z.infer<typeof voucherRedemptionResultSchema>;
863
+ export declare const voucherListResponse: z.ZodObject<{
864
+ data: z.ZodArray<z.ZodObject<{
865
+ id: z.ZodString;
866
+ code: z.ZodString;
867
+ status: z.ZodEnum<{
868
+ void: "void";
869
+ expired: "expired";
870
+ active: "active";
871
+ redeemed: "redeemed";
872
+ }>;
873
+ currency: z.ZodString;
874
+ initialAmountCents: z.ZodNumber;
875
+ remainingAmountCents: z.ZodNumber;
876
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
877
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
878
+ sourceType: z.ZodEnum<{
879
+ manual: "manual";
880
+ refund: "refund";
881
+ cancellation_credit: "cancellation_credit";
882
+ gift: "gift";
883
+ promo: "promo";
884
+ }>;
885
+ sourceBookingId: z.ZodNullable<z.ZodString>;
886
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
887
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
888
+ notes: z.ZodNullable<z.ZodString>;
889
+ issuedByUserId: z.ZodNullable<z.ZodString>;
890
+ createdAt: z.ZodCoercedDate<unknown>;
891
+ updatedAt: z.ZodCoercedDate<unknown>;
892
+ }, z.core.$strip>>;
893
+ total: z.ZodNumber;
894
+ limit: z.ZodNumber;
895
+ offset: z.ZodNumber;
896
+ }, z.core.$strip>;
897
+ export declare const voucherDetailResponse: z.ZodObject<{
898
+ data: z.ZodObject<{
899
+ id: z.ZodString;
900
+ code: z.ZodString;
901
+ status: z.ZodEnum<{
902
+ void: "void";
903
+ expired: "expired";
904
+ active: "active";
905
+ redeemed: "redeemed";
906
+ }>;
907
+ currency: z.ZodString;
908
+ initialAmountCents: z.ZodNumber;
909
+ remainingAmountCents: z.ZodNumber;
910
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
911
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
912
+ sourceType: z.ZodEnum<{
913
+ manual: "manual";
914
+ refund: "refund";
915
+ cancellation_credit: "cancellation_credit";
916
+ gift: "gift";
917
+ promo: "promo";
918
+ }>;
919
+ sourceBookingId: z.ZodNullable<z.ZodString>;
920
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
921
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
922
+ notes: z.ZodNullable<z.ZodString>;
923
+ issuedByUserId: z.ZodNullable<z.ZodString>;
924
+ createdAt: z.ZodCoercedDate<unknown>;
925
+ updatedAt: z.ZodCoercedDate<unknown>;
926
+ redemptions: z.ZodArray<z.ZodObject<{
927
+ id: z.ZodString;
928
+ voucherId: z.ZodString;
929
+ bookingId: z.ZodString;
930
+ paymentId: z.ZodNullable<z.ZodString>;
931
+ amountCents: z.ZodNumber;
932
+ createdByUserId: z.ZodNullable<z.ZodString>;
933
+ createdAt: z.ZodCoercedDate<unknown>;
934
+ }, z.core.$strip>>;
935
+ }, z.core.$strip>;
936
+ }, z.core.$strip>;
937
+ export declare const voucherSingleResponse: z.ZodObject<{
938
+ data: z.ZodObject<{
939
+ id: z.ZodString;
940
+ code: z.ZodString;
941
+ status: z.ZodEnum<{
942
+ void: "void";
943
+ expired: "expired";
944
+ active: "active";
945
+ redeemed: "redeemed";
946
+ }>;
947
+ currency: z.ZodString;
948
+ initialAmountCents: z.ZodNumber;
949
+ remainingAmountCents: z.ZodNumber;
950
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
951
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
952
+ sourceType: z.ZodEnum<{
953
+ manual: "manual";
954
+ refund: "refund";
955
+ cancellation_credit: "cancellation_credit";
956
+ gift: "gift";
957
+ promo: "promo";
958
+ }>;
959
+ sourceBookingId: z.ZodNullable<z.ZodString>;
960
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
961
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
962
+ notes: z.ZodNullable<z.ZodString>;
963
+ issuedByUserId: z.ZodNullable<z.ZodString>;
964
+ createdAt: z.ZodCoercedDate<unknown>;
965
+ updatedAt: z.ZodCoercedDate<unknown>;
966
+ }, z.core.$strip>;
967
+ }, z.core.$strip>;
968
+ export declare const voucherRedemptionResponse: z.ZodObject<{
969
+ data: z.ZodObject<{
970
+ voucher: z.ZodObject<{
971
+ id: z.ZodString;
972
+ code: z.ZodString;
973
+ status: z.ZodEnum<{
974
+ void: "void";
975
+ expired: "expired";
976
+ active: "active";
977
+ redeemed: "redeemed";
978
+ }>;
979
+ currency: z.ZodString;
980
+ initialAmountCents: z.ZodNumber;
981
+ remainingAmountCents: z.ZodNumber;
982
+ issuedToPersonId: z.ZodNullable<z.ZodString>;
983
+ issuedToOrganizationId: z.ZodNullable<z.ZodString>;
984
+ sourceType: z.ZodEnum<{
985
+ manual: "manual";
986
+ refund: "refund";
987
+ cancellation_credit: "cancellation_credit";
988
+ gift: "gift";
989
+ promo: "promo";
990
+ }>;
991
+ sourceBookingId: z.ZodNullable<z.ZodString>;
992
+ sourcePaymentId: z.ZodNullable<z.ZodString>;
993
+ expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
994
+ notes: z.ZodNullable<z.ZodString>;
995
+ issuedByUserId: z.ZodNullable<z.ZodString>;
996
+ createdAt: z.ZodCoercedDate<unknown>;
997
+ updatedAt: z.ZodCoercedDate<unknown>;
998
+ }, z.core.$strip>;
999
+ redemption: z.ZodNullable<z.ZodObject<{
1000
+ id: z.ZodString;
1001
+ voucherId: z.ZodString;
1002
+ bookingId: z.ZodString;
1003
+ paymentId: z.ZodNullable<z.ZodString>;
1004
+ amountCents: z.ZodNumber;
1005
+ createdByUserId: z.ZodNullable<z.ZodString>;
1006
+ createdAt: z.ZodCoercedDate<unknown>;
1007
+ }, z.core.$strip>>;
1008
+ }, z.core.$strip>;
1009
+ }, z.core.$strip>;
729
1010
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;;;;iBAM7D,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;iBAA6B,CAAA;AAC3F,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;iBAAsC,CAAA;AACnG,eAAO,MAAM,eAAe;;iBAAqC,CAAA;AAEjE,eAAO,MAAM,mBAAmB;;;;;;;EAO9B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;EAAyD,CAAA;AACzF,eAAO,MAAM,sBAAsB;;;;EAAyC,CAAA;AAE5E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAU/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAA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,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AACxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AACxE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgD,CAAA"}
package/dist/schemas.js CHANGED
@@ -172,3 +172,51 @@ export const publicFinanceDocumentLookupResponse = singleEnvelope(publicFinanceD
172
172
  export const publicBookingFinancePaymentsResponse = singleEnvelope(publicBookingFinancePaymentsSchema);
173
173
  export const publicPaymentSessionResponse = singleEnvelope(publicPaymentSessionSchema);
174
174
  export const publicVoucherValidationResponse = singleEnvelope(publicVoucherValidationSchema);
175
+ // ---------- admin vouchers ----------
176
+ export const voucherStatusSchema = z.enum(["active", "redeemed", "expired", "void"]);
177
+ export const voucherSourceTypeSchema = z.enum([
178
+ "refund",
179
+ "cancellation_credit",
180
+ "gift",
181
+ "manual",
182
+ "promo",
183
+ ]);
184
+ export const voucherRecordSchema = z.object({
185
+ id: z.string(),
186
+ code: z.string(),
187
+ status: voucherStatusSchema,
188
+ currency: z.string(),
189
+ initialAmountCents: z.number().int(),
190
+ remainingAmountCents: z.number().int(),
191
+ issuedToPersonId: z.string().nullable(),
192
+ issuedToOrganizationId: z.string().nullable(),
193
+ sourceType: voucherSourceTypeSchema,
194
+ sourceBookingId: z.string().nullable(),
195
+ sourcePaymentId: z.string().nullable(),
196
+ expiresAt: z.coerce.date().nullable(),
197
+ notes: z.string().nullable(),
198
+ issuedByUserId: z.string().nullable(),
199
+ createdAt: z.coerce.date(),
200
+ updatedAt: z.coerce.date(),
201
+ });
202
+ export const voucherRedemptionRecordSchema = z.object({
203
+ id: z.string(),
204
+ voucherId: z.string(),
205
+ bookingId: z.string(),
206
+ paymentId: z.string().nullable(),
207
+ amountCents: z.number().int(),
208
+ createdByUserId: z.string().nullable(),
209
+ createdAt: z.coerce.date(),
210
+ });
211
+ export const voucherDetailSchema = voucherRecordSchema.extend({
212
+ redemptions: z.array(voucherRedemptionRecordSchema),
213
+ });
214
+ /** Result envelope for `POST /v1/finance/vouchers/:id/redeem`. */
215
+ export const voucherRedemptionResultSchema = z.object({
216
+ voucher: voucherRecordSchema,
217
+ redemption: voucherRedemptionRecordSchema.nullable(),
218
+ });
219
+ export const voucherListResponse = paginatedEnvelope(voucherRecordSchema);
220
+ export const voucherDetailResponse = singleEnvelope(voucherDetailSchema);
221
+ export const voucherSingleResponse = singleEnvelope(voucherRecordSchema);
222
+ export const voucherRedemptionResponse = singleEnvelope(voucherRedemptionResultSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/finance-react",
3
- "version": "0.6.9",
3
+ "version": "0.8.0",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "react": "^19.0.0",
36
36
  "react-dom": "^19.0.0",
37
37
  "zod": "^4.0.0",
38
- "@voyantjs/finance": "0.6.9"
38
+ "@voyantjs/finance": "0.8.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@tanstack/react-query": "^5.96.2",
@@ -46,12 +46,12 @@
46
46
  "typescript": "^6.0.2",
47
47
  "vitest": "^4.1.2",
48
48
  "zod": "^4.3.6",
49
- "@voyantjs/finance": "0.6.9",
50
- "@voyantjs/react": "0.6.9",
49
+ "@voyantjs/finance": "0.8.0",
50
+ "@voyantjs/react": "0.8.0",
51
51
  "@voyantjs/voyant-typescript-config": "0.1.0"
52
52
  },
53
53
  "dependencies": {
54
- "@voyantjs/react": "0.6.9"
54
+ "@voyantjs/react": "0.8.0"
55
55
  },
56
56
  "files": [
57
57
  "dist"