shoal-web-sdk 1.0.145 → 1.0.146
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.
- package/dist/sdk/billing/@tanstack/react-query.gen.d.ts +5 -1
- package/dist/sdk/billing/@tanstack/react-query.gen.js +17 -1
- package/dist/sdk/billing/sdk.gen.d.ts +5 -1
- package/dist/sdk/billing/sdk.gen.js +15 -0
- package/dist/sdk/billing/types.gen.d.ts +51 -0
- package/dist/sdk/billing/zod.gen.d.ts +16 -0
- package/dist/sdk/billing/zod.gen.js +14 -0
- package/dist/tanstack-codegen/generated/billing.d.ts +9 -1
- package/dist/tanstack-codegen/generated/billing.js +20 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import { type Options } from '../sdk.gen';
|
|
3
|
-
import type { CancelSubscriptionData, CancelSubscriptionError, CreateCouponData, CreateCouponError, CreateCouponResponse, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, CreateSubscriptionResponse, DeleteCouponData, DeleteCouponError, DeleteCouponResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCouponData, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, RedeemCouponData, RedeemCouponError, RedeemCouponResponse, UpdateBillingAddressData, UpdateBillingAddressError, UpdateBillingAddressResponse, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
3
|
+
import type { CancelSubscriptionData, CancelSubscriptionError, CreateCouponData, CreateCouponError, CreateCouponResponse, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, CreateSubscriptionResponse, DeleteCouponData, DeleteCouponError, DeleteCouponResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, EmailCouponData, EmailCouponError, EmailCouponResponse, GetCouponData, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, RedeemCouponData, RedeemCouponError, RedeemCouponResponse, UpdateBillingAddressData, UpdateBillingAddressError, UpdateBillingAddressResponse, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -171,6 +171,10 @@ export declare const createCouponMutation: (options?: Partial<Options<CreateCoup
|
|
|
171
171
|
* Deletes an unredeemed coupon. Requires a platform48.com email.
|
|
172
172
|
*/
|
|
173
173
|
export declare const deleteCouponMutation: (options?: Partial<Options<DeleteCouponData>>) => UseMutationOptions<DeleteCouponResponse, DeleteCouponError, Options<DeleteCouponData>>;
|
|
174
|
+
/**
|
|
175
|
+
* Emails an unredeemed coupon to the owners and admins of its organisation. Requires a platform48.com email.
|
|
176
|
+
*/
|
|
177
|
+
export declare const emailCouponMutation: (options?: Partial<Options<EmailCouponData>>) => UseMutationOptions<EmailCouponResponse, EmailCouponError, Options<EmailCouponData>>;
|
|
174
178
|
export declare const getInvoicesQueryKey: (options: Options<GetInvoicesData>) => [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
175
179
|
_id: string;
|
|
176
180
|
_infinite?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
import { client } from '../client.gen';
|
|
4
|
-
import { cancelSubscription, createCoupon, createSetupIntent, createSubscription, deleteCoupon, deletePaymentMethod, getCoupon, getCustomer, getInvoices, getPlans, getUsage, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, redeemCoupon, updateBillingAddress, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
4
|
+
import { cancelSubscription, createCoupon, createSetupIntent, createSubscription, deleteCoupon, deletePaymentMethod, emailCoupon, getCoupon, getCustomer, getInvoices, getPlans, getUsage, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, redeemCoupon, updateBillingAddress, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
5
5
|
const createQueryKey = (id, options, infinite, tags) => {
|
|
6
6
|
const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
|
|
7
7
|
if (infinite) {
|
|
@@ -269,6 +269,22 @@ export const deleteCouponMutation = (options) => {
|
|
|
269
269
|
};
|
|
270
270
|
return mutationOptions;
|
|
271
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* Emails an unredeemed coupon to the owners and admins of its organisation. Requires a platform48.com email.
|
|
274
|
+
*/
|
|
275
|
+
export const emailCouponMutation = (options) => {
|
|
276
|
+
const mutationOptions = {
|
|
277
|
+
mutationFn: async (fnOptions) => {
|
|
278
|
+
const { data } = await emailCoupon({
|
|
279
|
+
...options,
|
|
280
|
+
...fnOptions,
|
|
281
|
+
throwOnError: true
|
|
282
|
+
});
|
|
283
|
+
return data;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
return mutationOptions;
|
|
287
|
+
};
|
|
272
288
|
export const getInvoicesQueryKey = (options) => createQueryKey('getInvoices', options);
|
|
273
289
|
/**
|
|
274
290
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type { CancelSubscriptionData, CancelSubscriptionErrors, CancelSubscriptionResponses, CreateCouponData, CreateCouponErrors, CreateCouponResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSubscriptionData, CreateSubscriptionErrors, CreateSubscriptionResponses, DeleteCouponData, DeleteCouponErrors, DeleteCouponResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCouponData, GetCouponErrors, GetCouponResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, GetUsageData, GetUsageErrors, GetUsageResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, RedeemCouponData, RedeemCouponErrors, RedeemCouponResponses, UpdateBillingAddressData, UpdateBillingAddressErrors, UpdateBillingAddressResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
2
|
+
import type { CancelSubscriptionData, CancelSubscriptionErrors, CancelSubscriptionResponses, CreateCouponData, CreateCouponErrors, CreateCouponResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSubscriptionData, CreateSubscriptionErrors, CreateSubscriptionResponses, DeleteCouponData, DeleteCouponErrors, DeleteCouponResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, EmailCouponData, EmailCouponErrors, EmailCouponResponses, GetCouponData, GetCouponErrors, GetCouponResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, GetUsageData, GetUsageErrors, GetUsageResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, RedeemCouponData, RedeemCouponErrors, RedeemCouponResponses, UpdateBillingAddressData, UpdateBillingAddressErrors, UpdateBillingAddressResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -80,6 +80,10 @@ export declare const createCoupon: <ThrowOnError extends boolean = false>(option
|
|
|
80
80
|
* Deletes an unredeemed coupon. Requires a platform48.com email.
|
|
81
81
|
*/
|
|
82
82
|
export declare const deleteCoupon: <ThrowOnError extends boolean = false>(options: Options<DeleteCouponData, ThrowOnError>) => import("./client").RequestResult<DeleteCouponResponses, DeleteCouponErrors, ThrowOnError, "fields">;
|
|
83
|
+
/**
|
|
84
|
+
* Emails an unredeemed coupon to the owners and admins of its organisation. Requires a platform48.com email.
|
|
85
|
+
*/
|
|
86
|
+
export declare const emailCoupon: <ThrowOnError extends boolean = false>(options: Options<EmailCouponData, ThrowOnError>) => import("./client").RequestResult<EmailCouponResponses, EmailCouponErrors, ThrowOnError, "fields">;
|
|
83
87
|
/**
|
|
84
88
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
85
89
|
*/
|
|
@@ -237,6 +237,21 @@ export const deleteCoupon = (options) => {
|
|
|
237
237
|
...options
|
|
238
238
|
});
|
|
239
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Emails an unredeemed coupon to the owners and admins of its organisation. Requires a platform48.com email.
|
|
242
|
+
*/
|
|
243
|
+
export const emailCoupon = (options) => {
|
|
244
|
+
return (options.client ?? client).post({
|
|
245
|
+
security: [
|
|
246
|
+
{
|
|
247
|
+
scheme: 'bearer',
|
|
248
|
+
type: 'http'
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
url: '/api/v1/admin/coupon/{code}/email',
|
|
252
|
+
...options
|
|
253
|
+
});
|
|
254
|
+
};
|
|
240
255
|
/**
|
|
241
256
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
242
257
|
*/
|
|
@@ -108,6 +108,12 @@ export type AdminCoupon = Coupon & {
|
|
|
108
108
|
*/
|
|
109
109
|
org: string;
|
|
110
110
|
};
|
|
111
|
+
export type CouponEmailResult = {
|
|
112
|
+
/**
|
|
113
|
+
* Email addresses the coupon was sent to.
|
|
114
|
+
*/
|
|
115
|
+
recipients: Array<string>;
|
|
116
|
+
};
|
|
111
117
|
export type CreateCoupon = {
|
|
112
118
|
/**
|
|
113
119
|
* Kinde organisation id.
|
|
@@ -889,6 +895,51 @@ export type DeleteCouponResponses = {
|
|
|
889
895
|
204: void;
|
|
890
896
|
};
|
|
891
897
|
export type DeleteCouponResponse = DeleteCouponResponses[keyof DeleteCouponResponses];
|
|
898
|
+
export type EmailCouponData = {
|
|
899
|
+
body?: never;
|
|
900
|
+
path: {
|
|
901
|
+
/**
|
|
902
|
+
* A coupon code.
|
|
903
|
+
*/
|
|
904
|
+
code: string;
|
|
905
|
+
};
|
|
906
|
+
query?: never;
|
|
907
|
+
url: '/api/v1/admin/coupon/{code}/email';
|
|
908
|
+
};
|
|
909
|
+
export type EmailCouponErrors = {
|
|
910
|
+
/**
|
|
911
|
+
* Unauthorised user
|
|
912
|
+
*/
|
|
913
|
+
401: _Error;
|
|
914
|
+
/**
|
|
915
|
+
* Requires a platform48.com email
|
|
916
|
+
*/
|
|
917
|
+
403: _Error;
|
|
918
|
+
/**
|
|
919
|
+
* Coupon not found
|
|
920
|
+
*/
|
|
921
|
+
404: _Error;
|
|
922
|
+
/**
|
|
923
|
+
* Coupon already redeemed, or the organisation has no owners or admins to email
|
|
924
|
+
*/
|
|
925
|
+
409: _Error;
|
|
926
|
+
/**
|
|
927
|
+
* Coupon has expired
|
|
928
|
+
*/
|
|
929
|
+
422: _Error;
|
|
930
|
+
/**
|
|
931
|
+
* Unexpected error.
|
|
932
|
+
*/
|
|
933
|
+
500: _Error;
|
|
934
|
+
};
|
|
935
|
+
export type EmailCouponError = EmailCouponErrors[keyof EmailCouponErrors];
|
|
936
|
+
export type EmailCouponResponses = {
|
|
937
|
+
/**
|
|
938
|
+
* The coupon was emailed
|
|
939
|
+
*/
|
|
940
|
+
200: CouponEmailResult;
|
|
941
|
+
};
|
|
942
|
+
export type EmailCouponResponse = EmailCouponResponses[keyof EmailCouponResponses];
|
|
892
943
|
export type GetInvoicesData = {
|
|
893
944
|
body?: never;
|
|
894
945
|
path: {
|
|
@@ -2096,6 +2096,9 @@ export declare const zAdminCoupon: z.ZodIntersection<z.ZodObject<{
|
|
|
2096
2096
|
}, z.core.$strip>, z.ZodObject<{
|
|
2097
2097
|
org: z.ZodString;
|
|
2098
2098
|
}, z.core.$strip>>;
|
|
2099
|
+
export declare const zCouponEmailResult: z.ZodObject<{
|
|
2100
|
+
recipients: z.ZodArray<z.ZodString>;
|
|
2101
|
+
}, z.core.$strip>;
|
|
2099
2102
|
export declare const zCreateCoupon: z.ZodObject<{
|
|
2100
2103
|
org: z.ZodString;
|
|
2101
2104
|
plan: z.ZodOptional<z.ZodEnum<{
|
|
@@ -8369,6 +8372,19 @@ export declare const zDeleteCouponData: z.ZodObject<{
|
|
|
8369
8372
|
* Coupon deleted
|
|
8370
8373
|
*/
|
|
8371
8374
|
export declare const zDeleteCouponResponse: z.ZodVoid;
|
|
8375
|
+
export declare const zEmailCouponData: z.ZodObject<{
|
|
8376
|
+
body: z.ZodOptional<z.ZodNever>;
|
|
8377
|
+
path: z.ZodObject<{
|
|
8378
|
+
code: z.ZodString;
|
|
8379
|
+
}, z.core.$strip>;
|
|
8380
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
8381
|
+
}, z.core.$strip>;
|
|
8382
|
+
/**
|
|
8383
|
+
* The coupon was emailed
|
|
8384
|
+
*/
|
|
8385
|
+
export declare const zEmailCouponResponse: z.ZodObject<{
|
|
8386
|
+
recipients: z.ZodArray<z.ZodString>;
|
|
8387
|
+
}, z.core.$strip>;
|
|
8372
8388
|
export declare const zGetInvoicesData: z.ZodObject<{
|
|
8373
8389
|
body: z.ZodOptional<z.ZodNever>;
|
|
8374
8390
|
path: z.ZodObject<{
|
|
@@ -129,6 +129,9 @@ export const zCoupon = z.object({
|
|
|
129
129
|
export const zAdminCoupon = zCoupon.and(z.object({
|
|
130
130
|
org: z.string()
|
|
131
131
|
}));
|
|
132
|
+
export const zCouponEmailResult = z.object({
|
|
133
|
+
recipients: z.array(z.string())
|
|
134
|
+
});
|
|
132
135
|
export const zCreateCoupon = z.object({
|
|
133
136
|
org: z.string(),
|
|
134
137
|
plan: z.optional(zCouponPlan),
|
|
@@ -491,6 +494,17 @@ export const zDeleteCouponData = z.object({
|
|
|
491
494
|
* Coupon deleted
|
|
492
495
|
*/
|
|
493
496
|
export const zDeleteCouponResponse = z.void();
|
|
497
|
+
export const zEmailCouponData = z.object({
|
|
498
|
+
body: z.optional(z.never()),
|
|
499
|
+
path: z.object({
|
|
500
|
+
code: z.string()
|
|
501
|
+
}),
|
|
502
|
+
query: z.optional(z.never())
|
|
503
|
+
});
|
|
504
|
+
/**
|
|
505
|
+
* The coupon was emailed
|
|
506
|
+
*/
|
|
507
|
+
export const zEmailCouponResponse = zCouponEmailResult;
|
|
494
508
|
export const zGetInvoicesData = z.object({
|
|
495
509
|
body: z.optional(z.never()),
|
|
496
510
|
path: z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetCustomerData, GetUsageData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CancelSubscriptionData, CancelSubscriptionResponses, CreateSubscriptionData, CreateSubscriptionResponses, UpdateBillingAddressData, UpdateBillingAddressResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetCouponData, RedeemCouponData, RedeemCouponResponses, CreateCouponData, CreateCouponResponses, DeleteCouponData, DeleteCouponResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
3
|
+
import { GetCustomerData, GetUsageData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CancelSubscriptionData, CancelSubscriptionResponses, CreateSubscriptionData, CreateSubscriptionResponses, UpdateBillingAddressData, UpdateBillingAddressResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetCouponData, RedeemCouponData, RedeemCouponResponses, CreateCouponData, CreateCouponResponses, DeleteCouponData, DeleteCouponResponses, EmailCouponData, EmailCouponResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
4
4
|
export declare const useGetCustomer: (options: Omit<GetCustomerData, "url"> & {
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}) => {
|
|
@@ -909,6 +909,14 @@ export declare const useDeleteCoupon: (config?: {
|
|
|
909
909
|
data: void | undefined;
|
|
910
910
|
headers: Record<string, string>;
|
|
911
911
|
}, unknown, Omit<DeleteCouponData, "url">, unknown>;
|
|
912
|
+
export declare const useEmailCoupon: (config?: {
|
|
913
|
+
onSuccess?: (data: GetSuccessResponse<EmailCouponResponses>, headers: Record<string, string>) => void;
|
|
914
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
915
|
+
retry?: boolean;
|
|
916
|
+
}) => import("@tanstack/react-query").UseMutationResult<{
|
|
917
|
+
data: import("../../sdk/billing/types.gen").CouponEmailResult | undefined;
|
|
918
|
+
headers: Record<string, string>;
|
|
919
|
+
}, unknown, Omit<EmailCouponData, "url">, unknown>;
|
|
912
920
|
export declare const useGetInvoices: (options: Omit<GetInvoicesData, "url"> & {
|
|
913
921
|
enabled?: boolean;
|
|
914
922
|
}) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { isPromise, headersToObject } from "../util";
|
|
4
4
|
import { useToken } from "../../provider/token-provider";
|
|
5
|
-
import { getCustomer, getUsage, getPlans, updatePlan, cancelSubscription, createSubscription, updateBillingAddress, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getCoupon, redeemCoupon, createCoupon, deleteCoupon, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
5
|
+
import { getCustomer, getUsage, getPlans, updatePlan, cancelSubscription, createSubscription, updateBillingAddress, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getCoupon, redeemCoupon, createCoupon, deleteCoupon, emailCoupon, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
6
6
|
export const useGetCustomer = (options) => {
|
|
7
7
|
const token = useToken();
|
|
8
8
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -281,6 +281,25 @@ export const useDeleteCoupon = (config) => {
|
|
|
281
281
|
retry: config?.retry
|
|
282
282
|
});
|
|
283
283
|
};
|
|
284
|
+
export const useEmailCoupon = (config) => {
|
|
285
|
+
const token = useToken();
|
|
286
|
+
const queryClient = useQueryClient();
|
|
287
|
+
const opts = { throwOnError: true, url: "/api/v1/admin/coupon/{code}/email" };
|
|
288
|
+
const funcer = async (options) => {
|
|
289
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
290
|
+
const res = await emailCoupon({ ...opts, ...options, auth });
|
|
291
|
+
return { data: res.data, headers: headersToObject(res.response.headers) };
|
|
292
|
+
};
|
|
293
|
+
return useMutation({
|
|
294
|
+
mutationFn: funcer,
|
|
295
|
+
onSuccess: (res, options, c, ctx) => {
|
|
296
|
+
queryClient.invalidateQueries({ queryKey: ["api", "v1", "admin", "coupon", options?.path?.code, "email"] });
|
|
297
|
+
config?.onSuccess && config.onSuccess(res.data, res.headers);
|
|
298
|
+
},
|
|
299
|
+
onError: config?.onError,
|
|
300
|
+
retry: config?.retry
|
|
301
|
+
});
|
|
302
|
+
};
|
|
284
303
|
export const useGetInvoices = (options) => {
|
|
285
304
|
const token = useToken();
|
|
286
305
|
let { enabled, ...rest } = options || { enabled: true };
|