shoal-web-sdk 1.0.144 → 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/sdk/insights-engine/@tanstack/react-query.gen.d.ts +2 -2
- package/dist/sdk/insights-engine/@tanstack/react-query.gen.js +2 -2
- package/dist/sdk/insights-engine/sdk.gen.d.ts +1 -1
- package/dist/sdk/insights-engine/sdk.gen.js +1 -1
- package/dist/sdk/insights-engine/types.gen.d.ts +4 -0
- package/dist/sdk/insights-engine/zod.gen.d.ts +1 -0
- package/dist/sdk/insights-engine/zod.gen.js +1 -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({
|
|
@@ -114,7 +114,7 @@ export declare const listLiveRoutesQueryKey: (options?: Options<ListLiveRoutesDa
|
|
|
114
114
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
115
115
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
116
116
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
117
|
-
* to limit the list to one space.
|
|
117
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
118
118
|
*
|
|
119
119
|
*/
|
|
120
120
|
export declare const listLiveRoutesOptions: (options?: Options<ListLiveRoutesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").PaginatedLiveEnvironments, Error, import("../types.gen").PaginatedLiveEnvironments, [Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
@@ -144,7 +144,7 @@ export declare const listLiveRoutesInfiniteQueryKey: (options?: Options<ListLive
|
|
|
144
144
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
145
145
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
146
146
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
147
|
-
* to limit the list to one space.
|
|
147
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
148
148
|
*
|
|
149
149
|
*/
|
|
150
150
|
export declare const listLiveRoutesInfiniteOptions: (options?: Options<ListLiveRoutesData>) => import("@tanstack/react-query").UseInfiniteQueryOptions<import("../types.gen").PaginatedLiveEnvironments, import("../types.gen")._Error, InfiniteData<import("../types.gen").PaginatedLiveEnvironments, unknown>, QueryKey<Options<ListLiveRoutesData>>, number | Pick<Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
@@ -141,7 +141,7 @@ export const listLiveRoutesQueryKey = (options) => createQueryKey('listLiveRoute
|
|
|
141
141
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
142
142
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
143
143
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
144
|
-
* to limit the list to one space.
|
|
144
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
145
145
|
*
|
|
146
146
|
*/
|
|
147
147
|
export const listLiveRoutesOptions = (options) => {
|
|
@@ -165,7 +165,7 @@ export const listLiveRoutesInfiniteQueryKey = (options) => createQueryKey('listL
|
|
|
165
165
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
166
166
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
167
167
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
168
|
-
* to limit the list to one space.
|
|
168
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
169
169
|
*
|
|
170
170
|
*/
|
|
171
171
|
export const listLiveRoutesInfiniteOptions = (options) => {
|
|
@@ -37,7 +37,7 @@ export declare const getOverview: <ThrowOnError extends boolean = false>(options
|
|
|
37
37
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
38
38
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
39
39
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
40
|
-
* to limit the list to one space.
|
|
40
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
41
41
|
*
|
|
42
42
|
*/
|
|
43
43
|
export declare const listLiveRoutes: <ThrowOnError extends boolean = false>(options?: Options<ListLiveRoutesData, ThrowOnError>) => import("./client").RequestResult<ListLiveRoutesResponses, ListLiveRoutesErrors, ThrowOnError, "fields">;
|
|
@@ -46,7 +46,7 @@ export const getOverview = (options) => {
|
|
|
46
46
|
* Returns a page of environments, most recently deployed first, each with the proxy and VM
|
|
47
47
|
* subdomains and the route paths of its latest succeeded deployment. Environments that never
|
|
48
48
|
* deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
|
|
49
|
-
* to limit the list to one space.
|
|
49
|
+
* to limit the list to one space, and `search` to match a space by name or id.
|
|
50
50
|
*
|
|
51
51
|
*/
|
|
52
52
|
export const listLiveRoutes = (options) => {
|
|
@@ -797,6 +797,10 @@ export type ListLiveRoutesData = {
|
|
|
797
797
|
* An organisation id.
|
|
798
798
|
*/
|
|
799
799
|
org?: string;
|
|
800
|
+
/**
|
|
801
|
+
* Space separated terms that must all appear, case insensitively, in the item's names, emails or identifiers.
|
|
802
|
+
*/
|
|
803
|
+
search?: string;
|
|
800
804
|
/**
|
|
801
805
|
* 1-based page index.
|
|
802
806
|
*/
|
|
@@ -2287,6 +2287,7 @@ export declare const zListLiveRoutesData: z.ZodObject<{
|
|
|
2287
2287
|
path: z.ZodOptional<z.ZodNever>;
|
|
2288
2288
|
query: z.ZodOptional<z.ZodObject<{
|
|
2289
2289
|
org: z.ZodOptional<z.ZodString>;
|
|
2290
|
+
search: z.ZodOptional<z.ZodString>;
|
|
2290
2291
|
page: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
2291
2292
|
limit: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
2292
2293
|
}, z.core.$strip>>;
|
|
@@ -651,6 +651,7 @@ export const zListLiveRoutesData = z.object({
|
|
|
651
651
|
path: z.optional(z.never()),
|
|
652
652
|
query: z.optional(z.object({
|
|
653
653
|
org: z.optional(z.string()),
|
|
654
|
+
search: z.optional(z.string()),
|
|
654
655
|
page: z.optional(z.int()).default(1),
|
|
655
656
|
limit: z.optional(z.int()).default(25)
|
|
656
657
|
}))
|
|
@@ -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 };
|