shoal-web-sdk 1.0.87 → 1.0.88

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.
@@ -1,6 +1,6 @@
1
1
  import { type UseMutationOptions } from '@tanstack/react-query';
2
2
  import { type Options } from '../sdk.gen';
3
- import type { CreateCustomerData, CreateCustomerError, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
3
+ import type { CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetInvoicesData, GetPlansData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, 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;
@@ -40,49 +40,6 @@ export declare const getPlansOptions: (options?: Options<GetPlansData>) => impor
40
40
  * Returns a list of available pricing plans.
41
41
  */
42
42
  export declare const updatePlanMutation: (options?: Partial<Options<UpdatePlanData>>) => UseMutationOptions<unknown, UpdatePlanError, Options<UpdatePlanData>>;
43
- export declare const getCustomerQueryKey: (options?: Options<GetCustomerData>) => [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
44
- _id: string;
45
- _infinite?: boolean;
46
- tags?: ReadonlyArray<string>;
47
- }];
48
- /**
49
- * Fetch all related customer information.
50
- *
51
- * Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
52
- * from the Stripe subscription rather than only the Account record — a customer can be grandfathered
53
- * onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
54
- * the source of truth for what's actually in effect.
55
- *
56
- */
57
- export declare const getCustomerOptions: (options?: Options<GetCustomerData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").CustomerResponse, Error, import("../types.gen").CustomerResponse, [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
58
- _id: string;
59
- _infinite?: boolean;
60
- tags?: ReadonlyArray<string>;
61
- }]>, "queryFn"> & {
62
- queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").CustomerResponse, [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
63
- _id: string;
64
- _infinite?: boolean;
65
- tags?: ReadonlyArray<string>;
66
- }], never> | undefined;
67
- } & {
68
- queryKey: [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
69
- _id: string;
70
- _infinite?: boolean;
71
- tags?: ReadonlyArray<string>;
72
- }] & {
73
- [dataTagSymbol]: import("../types.gen").CustomerResponse;
74
- [dataTagErrorSymbol]: Error;
75
- };
76
- };
77
- /**
78
- * Creates a stripe customer with a stripe subscription
79
- *
80
- * This instantiates an account record in our database with
81
- * the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
82
- * webhook is received.
83
- *
84
- */
85
- export declare const createCustomerMutation: (options?: Partial<Options<CreateCustomerData>>) => UseMutationOptions<unknown, CreateCustomerError, Options<CreateCustomerData>>;
86
43
  /**
87
44
  * Creates a Stripe SetupIntent.
88
45
  *
@@ -97,7 +54,7 @@ export declare const deletePaymentMethodMutation: (options?: Partial<Options<Del
97
54
  * Sets the customer's default payment method used for invoices.
98
55
  */
99
56
  export declare const updateDefaultPaymentMethodMutation: (options?: Partial<Options<UpdateDefaultPaymentMethodData>>) => UseMutationOptions<UpdateDefaultPaymentMethodResponse, UpdateDefaultPaymentMethodError, Options<UpdateDefaultPaymentMethodData>>;
100
- export declare const getInvoicesQueryKey: (options?: Options<GetInvoicesData>) => [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
57
+ export declare const getInvoicesQueryKey: (options: Options<GetInvoicesData>) => [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
101
58
  _id: string;
102
59
  _infinite?: boolean;
103
60
  tags?: ReadonlyArray<string>;
@@ -105,7 +62,7 @@ export declare const getInvoicesQueryKey: (options?: Options<GetInvoicesData>) =
105
62
  /**
106
63
  * Returns a page of the customer's invoices. This response is paginated.
107
64
  */
108
- export declare const getInvoicesOptions: (options?: Options<GetInvoicesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").InvoiceListResponse, Error, import("../types.gen").InvoiceListResponse, [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
65
+ export declare const getInvoicesOptions: (options: Options<GetInvoicesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").InvoiceListResponse, Error, import("../types.gen").InvoiceListResponse, [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
109
66
  _id: string;
110
67
  _infinite?: boolean;
111
68
  tags?: ReadonlyArray<string>;
@@ -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 { createCustomer, createSetupIntent, deletePaymentMethod, getCustomer, getInvoices, getPlans, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
4
+ import { createSetupIntent, deletePaymentMethod, getInvoices, getPlans, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, 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) {
@@ -60,51 +60,6 @@ export const updatePlanMutation = (options) => {
60
60
  };
61
61
  return mutationOptions;
62
62
  };
63
- export const getCustomerQueryKey = (options) => createQueryKey('getCustomer', options);
64
- /**
65
- * Fetch all related customer information.
66
- *
67
- * Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
68
- * from the Stripe subscription rather than only the Account record — a customer can be grandfathered
69
- * onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
70
- * the source of truth for what's actually in effect.
71
- *
72
- */
73
- export const getCustomerOptions = (options) => {
74
- return queryOptions({
75
- queryFn: async ({ queryKey, signal }) => {
76
- const { data } = await getCustomer({
77
- ...options,
78
- ...queryKey[0],
79
- signal,
80
- throwOnError: true
81
- });
82
- return data;
83
- },
84
- queryKey: getCustomerQueryKey(options)
85
- });
86
- };
87
- /**
88
- * Creates a stripe customer with a stripe subscription
89
- *
90
- * This instantiates an account record in our database with
91
- * the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
92
- * webhook is received.
93
- *
94
- */
95
- export const createCustomerMutation = (options) => {
96
- const mutationOptions = {
97
- mutationFn: async (fnOptions) => {
98
- const { data } = await createCustomer({
99
- ...options,
100
- ...fnOptions,
101
- throwOnError: true
102
- });
103
- return data;
104
- }
105
- };
106
- return mutationOptions;
107
- };
108
63
  /**
109
64
  * Creates a Stripe SetupIntent.
110
65
  *
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { CreateCustomerData, CreateCustomerErrors, CreateCustomerResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
2
+ import type { CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, 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
@@ -21,31 +21,12 @@ export declare const getPlans: <ThrowOnError extends boolean = false>(options?:
21
21
  * Returns a list of available pricing plans.
22
22
  */
23
23
  export declare const updatePlan: <ThrowOnError extends boolean = false>(options: Options<UpdatePlanData, ThrowOnError>) => import("./client").RequestResult<UpdatePlanResponses, UpdatePlanErrors, ThrowOnError, "fields">;
24
- /**
25
- * Fetch all related customer information.
26
- *
27
- * Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
28
- * from the Stripe subscription rather than only the Account record — a customer can be grandfathered
29
- * onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
30
- * the source of truth for what's actually in effect.
31
- *
32
- */
33
- export declare const getCustomer: <ThrowOnError extends boolean = false>(options?: Options<GetCustomerData, ThrowOnError>) => import("./client").RequestResult<GetCustomerResponses, GetCustomerErrors, ThrowOnError, "fields">;
34
- /**
35
- * Creates a stripe customer with a stripe subscription
36
- *
37
- * This instantiates an account record in our database with
38
- * the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
39
- * webhook is received.
40
- *
41
- */
42
- export declare const createCustomer: <ThrowOnError extends boolean = false>(options: Options<CreateCustomerData, ThrowOnError>) => import("./client").RequestResult<CreateCustomerResponses, CreateCustomerErrors, ThrowOnError, "fields">;
43
24
  /**
44
25
  * Creates a Stripe SetupIntent.
45
26
  *
46
27
  * Lets the client collect and tokenise a card without charging it.
47
28
  */
48
- export declare const createSetupIntent: <ThrowOnError extends boolean = false>(options?: Options<CreateSetupIntentData, ThrowOnError>) => import("./client").RequestResult<CreateSetupIntentResponses, CreateSetupIntentErrors, ThrowOnError, "fields">;
29
+ export declare const createSetupIntent: <ThrowOnError extends boolean = false>(options: Options<CreateSetupIntentData, ThrowOnError>) => import("./client").RequestResult<CreateSetupIntentResponses, CreateSetupIntentErrors, ThrowOnError, "fields">;
49
30
  /**
50
31
  * Detaches a payment method from the customer.
51
32
  */
@@ -57,7 +38,7 @@ export declare const updateDefaultPaymentMethod: <ThrowOnError extends boolean =
57
38
  /**
58
39
  * Returns a page of the customer's invoices. This response is paginated.
59
40
  */
60
- export declare const getInvoices: <ThrowOnError extends boolean = false>(options?: Options<GetInvoicesData, ThrowOnError>) => import("./client").RequestResult<GetInvoicesResponses, GetInvoicesErrors, ThrowOnError, "fields">;
41
+ export declare const getInvoices: <ThrowOnError extends boolean = false>(options: Options<GetInvoicesData, ThrowOnError>) => import("./client").RequestResult<GetInvoicesResponses, GetInvoicesErrors, ThrowOnError, "fields">;
61
42
  /**
62
43
  * Fetch all related customer information for a given org.
63
44
  */
@@ -26,52 +26,7 @@ export const updatePlan = (options) => {
26
26
  type: 'http'
27
27
  }
28
28
  ],
29
- url: '/api/v1/plan',
30
- ...options,
31
- headers: {
32
- 'Content-Type': 'application/json',
33
- ...options.headers
34
- }
35
- });
36
- };
37
- /**
38
- * Fetch all related customer information.
39
- *
40
- * Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
41
- * from the Stripe subscription rather than only the Account record — a customer can be grandfathered
42
- * onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
43
- * the source of truth for what's actually in effect.
44
- *
45
- */
46
- export const getCustomer = (options) => {
47
- return (options?.client ?? client).get({
48
- security: [
49
- {
50
- scheme: 'bearer',
51
- type: 'http'
52
- }
53
- ],
54
- url: '/api/v1/customer',
55
- ...options
56
- });
57
- };
58
- /**
59
- * Creates a stripe customer with a stripe subscription
60
- *
61
- * This instantiates an account record in our database with
62
- * the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
63
- * webhook is received.
64
- *
65
- */
66
- export const createCustomer = (options) => {
67
- return (options.client ?? client).post({
68
- security: [
69
- {
70
- scheme: 'bearer',
71
- type: 'http'
72
- }
73
- ],
74
- url: '/api/v1/customer',
29
+ url: '/api/v1/plan/{org}',
75
30
  ...options,
76
31
  headers: {
77
32
  'Content-Type': 'application/json',
@@ -85,14 +40,14 @@ export const createCustomer = (options) => {
85
40
  * Lets the client collect and tokenise a card without charging it.
86
41
  */
87
42
  export const createSetupIntent = (options) => {
88
- return (options?.client ?? client).post({
43
+ return (options.client ?? client).post({
89
44
  security: [
90
45
  {
91
46
  scheme: 'bearer',
92
47
  type: 'http'
93
48
  }
94
49
  ],
95
- url: '/api/v1/setup-intent',
50
+ url: '/api/v1/setup-intent/{org}',
96
51
  ...options
97
52
  });
98
53
  };
@@ -107,7 +62,7 @@ export const deletePaymentMethod = (options) => {
107
62
  type: 'http'
108
63
  }
109
64
  ],
110
- url: '/api/v1/payment-method/{id}',
65
+ url: '/api/v1/payment-method/{paymentID}',
111
66
  ...options
112
67
  });
113
68
  };
@@ -122,7 +77,7 @@ export const updateDefaultPaymentMethod = (options) => {
122
77
  type: 'http'
123
78
  }
124
79
  ],
125
- url: '/api/v1/payment-method/{id}',
80
+ url: '/api/v1/payment-method/{paymentID}',
126
81
  ...options
127
82
  });
128
83
  };
@@ -130,14 +85,14 @@ export const updateDefaultPaymentMethod = (options) => {
130
85
  * Returns a page of the customer's invoices. This response is paginated.
131
86
  */
132
87
  export const getInvoices = (options) => {
133
- return (options?.client ?? client).get({
88
+ return (options.client ?? client).get({
134
89
  security: [
135
90
  {
136
91
  scheme: 'bearer',
137
92
  type: 'http'
138
93
  }
139
94
  ],
140
- url: '/api/v1/invoices',
95
+ url: '/api/v1/invoices/{org}',
141
96
  ...options
142
97
  });
143
98
  };
@@ -164,7 +164,11 @@ export type CustomerResponseWritable = {
164
164
  currentPlan: CustomerPlanResponseWritable;
165
165
  };
166
166
  /**
167
- * Kinde Organisation ID
167
+ * Stripe payment method.
168
+ */
169
+ export type PaymentMethodId = string;
170
+ /**
171
+ * Kinde organisation id.
168
172
  */
169
173
  export type OrganisationId = string;
170
174
  export type GetPlansData = {
@@ -189,9 +193,14 @@ export type GetPlansResponses = {
189
193
  export type GetPlansResponse = GetPlansResponses[keyof GetPlansResponses];
190
194
  export type UpdatePlanData = {
191
195
  body: UpdatePlan;
192
- path?: never;
196
+ path: {
197
+ /**
198
+ * Kinde organisation id.
199
+ */
200
+ org: string;
201
+ };
193
202
  query?: never;
194
- url: '/api/v1/plan';
203
+ url: '/api/v1/plan/{org}';
195
204
  };
196
205
  export type UpdatePlanErrors = {
197
206
  /**
@@ -218,78 +227,16 @@ export type UpdatePlanResponses = {
218
227
  */
219
228
  202: unknown;
220
229
  };
221
- export type GetCustomerData = {
222
- body?: never;
223
- path?: never;
224
- query?: never;
225
- url: '/api/v1/customer';
226
- };
227
- export type GetCustomerErrors = {
228
- /**
229
- * Unauthorised user
230
- */
231
- 401: _Error;
232
- /**
233
- * Account or subscription not found
234
- */
235
- 404: _Error;
236
- /**
237
- * Account has no Stripe customer yet
238
- */
239
- 409: _Error;
240
- /**
241
- * Internal error (e.g. subscription references a plan key no longer in the catalog)
242
- */
243
- 500: _Error;
244
- };
245
- export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors];
246
- export type GetCustomerResponses = {
247
- /**
248
- * Customer billing state
249
- */
250
- 200: CustomerResponse;
251
- };
252
- export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses];
253
- export type CreateCustomerData = {
254
- body: CreateCustomerRequest;
255
- path?: never;
256
- query?: never;
257
- url: '/api/v1/customer';
258
- };
259
- export type CreateCustomerErrors = {
260
- /**
261
- * Invalid request body, or an invalid/unsupported plan or seat count for the plan.
262
- */
263
- 400: _Error;
264
- /**
265
- * Unreadable claims.
266
- */
267
- 403: _Error;
268
- /**
269
- * Account already exists.
270
- */
271
- 409: _Error;
272
- /**
273
- * Could not look up the organisation, register with Stripe, or create the Stripe subscription.
274
- */
275
- 422: _Error;
276
- /**
277
- * Unexpected error whilst persisting the account.
278
- */
279
- 500: _Error;
280
- };
281
- export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors];
282
- export type CreateCustomerResponses = {
283
- /**
284
- * Billing account created; awaiting the Stripe subscription webhook to become active.
285
- */
286
- 201: unknown;
287
- };
288
230
  export type CreateSetupIntentData = {
289
231
  body?: never;
290
- path?: never;
232
+ path: {
233
+ /**
234
+ * Kinde organisation id.
235
+ */
236
+ org: string;
237
+ };
291
238
  query?: never;
292
- url: '/api/v1/setup-intent';
239
+ url: '/api/v1/setup-intent/{org}';
293
240
  };
294
241
  export type CreateSetupIntentErrors = {
295
242
  /**
@@ -320,10 +267,13 @@ export type CreateSetupIntentResponse = CreateSetupIntentResponses[keyof CreateS
320
267
  export type DeletePaymentMethodData = {
321
268
  body?: never;
322
269
  path: {
323
- id: string;
270
+ /**
271
+ * Stripe payment method.
272
+ */
273
+ paymentID: string;
324
274
  };
325
275
  query?: never;
326
- url: '/api/v1/payment-method/{id}';
276
+ url: '/api/v1/payment-method/{paymentID}';
327
277
  };
328
278
  export type DeletePaymentMethodErrors = {
329
279
  /**
@@ -358,10 +308,13 @@ export type DeletePaymentMethodResponse = DeletePaymentMethodResponses[keyof Del
358
308
  export type UpdateDefaultPaymentMethodData = {
359
309
  body?: never;
360
310
  path: {
361
- id: string;
311
+ /**
312
+ * Stripe payment method.
313
+ */
314
+ paymentID: string;
362
315
  };
363
316
  query?: never;
364
- url: '/api/v1/payment-method/{id}';
317
+ url: '/api/v1/payment-method/{paymentID}';
365
318
  };
366
319
  export type UpdateDefaultPaymentMethodErrors = {
367
320
  /**
@@ -395,12 +348,17 @@ export type UpdateDefaultPaymentMethodResponses = {
395
348
  export type UpdateDefaultPaymentMethodResponse = UpdateDefaultPaymentMethodResponses[keyof UpdateDefaultPaymentMethodResponses];
396
349
  export type GetInvoicesData = {
397
350
  body?: never;
398
- path?: never;
351
+ path: {
352
+ /**
353
+ * Kinde organisation id.
354
+ */
355
+ org: string;
356
+ };
399
357
  query?: {
400
358
  limit?: number;
401
359
  starting_after?: string;
402
360
  };
403
- url: '/api/v1/invoices';
361
+ url: '/api/v1/invoices/{org}';
404
362
  };
405
363
  export type GetInvoicesErrors = {
406
364
  /**
@@ -436,7 +394,7 @@ export type M2mGetCustomerData = {
436
394
  body?: never;
437
395
  path: {
438
396
  /**
439
- * Kinde Organisation ID
397
+ * Kinde organisation id.
440
398
  */
441
399
  org: string;
442
400
  };
@@ -469,7 +427,7 @@ export type M2mCreateCustomerData = {
469
427
  body: CreateCustomerRequest;
470
428
  path: {
471
429
  /**
472
- * Kinde Organisation ID
430
+ * Kinde organisation id.
473
431
  */
474
432
  org: string;
475
433
  };
@@ -509,7 +467,7 @@ export type M2mUpdatePlanData = {
509
467
  body: UpdatePlan;
510
468
  path: {
511
469
  /**
512
- * Kinde Organisation ID
470
+ * Kinde organisation id.
513
471
  */
514
472
  org: string;
515
473
  };
@@ -693,7 +693,11 @@ export declare const zCustomerResponseWritable: z.ZodObject<{
693
693
  }, z.core.$strip>;
694
694
  }, z.core.$strip>;
695
695
  /**
696
- * Kinde Organisation ID
696
+ * Stripe payment method.
697
+ */
698
+ export declare const zPaymentMethodId: z.ZodString;
699
+ /**
700
+ * Kinde organisation id.
697
701
  */
698
702
  export declare const zOrganisationId: z.ZodString;
699
703
  export declare const zGetPlansData: z.ZodObject<{
@@ -816,191 +820,16 @@ export declare const zUpdatePlanData: z.ZodObject<{
816
820
  annual: "annual";
817
821
  }>;
818
822
  }, z.core.$strip>;
819
- path: z.ZodOptional<z.ZodNever>;
820
- query: z.ZodOptional<z.ZodNever>;
821
- }, z.core.$strip>;
822
- export declare const zGetCustomerData: z.ZodObject<{
823
- body: z.ZodOptional<z.ZodNever>;
824
- path: z.ZodOptional<z.ZodNever>;
825
- query: z.ZodOptional<z.ZodNever>;
826
- }, z.core.$strip>;
827
- /**
828
- * Customer billing state
829
- */
830
- export declare const zGetCustomerResponse: z.ZodObject<{
831
- currentPlan: z.ZodObject<{
832
- key: z.ZodReadonly<z.ZodString>;
833
- displayName: z.ZodReadonly<z.ZodString>;
834
- rank: z.ZodReadonly<z.ZodInt>;
835
- interval: z.ZodOptional<z.ZodEnum<{
836
- monthly: "monthly";
837
- annual: "annual";
838
- }>>;
839
- currency: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
840
- unitAmountCents: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
841
- features: z.ZodReadonly<z.ZodObject<{
842
- maximumSeats: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
843
- type: z.ZodLiteral<"limited">;
844
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
845
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
846
- displayName: z.ZodReadonly<z.ZodString>;
847
- }, z.core.$strip>, z.ZodObject<{
848
- type: z.ZodEnum<{
849
- limited: "limited";
850
- }>;
851
- value: z.ZodInt;
852
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
853
- type: z.ZodLiteral<"unlimited">;
854
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
855
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
856
- displayName: z.ZodReadonly<z.ZodString>;
857
- }, z.core.$strip>, z.ZodObject<{
858
- type: z.ZodEnum<{
859
- unlimited: "unlimited";
860
- }>;
861
- }, z.core.$strip>>>]>>;
862
- maximumProjects: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
863
- type: z.ZodLiteral<"limited">;
864
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
865
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
866
- displayName: z.ZodReadonly<z.ZodString>;
867
- }, z.core.$strip>, z.ZodObject<{
868
- type: z.ZodEnum<{
869
- limited: "limited";
870
- }>;
871
- value: z.ZodInt;
872
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
873
- type: z.ZodLiteral<"unlimited">;
874
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
875
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
876
- displayName: z.ZodReadonly<z.ZodString>;
877
- }, z.core.$strip>, z.ZodObject<{
878
- type: z.ZodEnum<{
879
- unlimited: "unlimited";
880
- }>;
881
- }, z.core.$strip>>>]>>;
882
- maximumEnvironments: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
883
- type: z.ZodLiteral<"limited">;
884
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
885
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
886
- displayName: z.ZodReadonly<z.ZodString>;
887
- }, z.core.$strip>, z.ZodObject<{
888
- type: z.ZodEnum<{
889
- limited: "limited";
890
- }>;
891
- value: z.ZodInt;
892
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
893
- type: z.ZodLiteral<"unlimited">;
894
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
895
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
896
- displayName: z.ZodReadonly<z.ZodString>;
897
- }, z.core.$strip>, z.ZodObject<{
898
- type: z.ZodEnum<{
899
- unlimited: "unlimited";
900
- }>;
901
- }, z.core.$strip>>>]>>;
902
- }, z.core.$strip>>;
903
- }, z.core.$strip>;
904
- pendingPlan: z.ZodOptional<z.ZodObject<{
905
- key: z.ZodReadonly<z.ZodString>;
906
- displayName: z.ZodReadonly<z.ZodString>;
907
- rank: z.ZodReadonly<z.ZodInt>;
908
- interval: z.ZodOptional<z.ZodEnum<{
909
- monthly: "monthly";
910
- annual: "annual";
911
- }>>;
912
- currency: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
913
- unitAmountCents: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
914
- features: z.ZodReadonly<z.ZodObject<{
915
- maximumSeats: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
916
- type: z.ZodLiteral<"limited">;
917
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
918
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
919
- displayName: z.ZodReadonly<z.ZodString>;
920
- }, z.core.$strip>, z.ZodObject<{
921
- type: z.ZodEnum<{
922
- limited: "limited";
923
- }>;
924
- value: z.ZodInt;
925
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
926
- type: z.ZodLiteral<"unlimited">;
927
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
928
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
929
- displayName: z.ZodReadonly<z.ZodString>;
930
- }, z.core.$strip>, z.ZodObject<{
931
- type: z.ZodEnum<{
932
- unlimited: "unlimited";
933
- }>;
934
- }, z.core.$strip>>>]>>;
935
- maximumProjects: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
936
- type: z.ZodLiteral<"limited">;
937
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
938
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
939
- displayName: z.ZodReadonly<z.ZodString>;
940
- }, z.core.$strip>, z.ZodObject<{
941
- type: z.ZodEnum<{
942
- limited: "limited";
943
- }>;
944
- value: z.ZodInt;
945
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
946
- type: z.ZodLiteral<"unlimited">;
947
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
948
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
949
- displayName: z.ZodReadonly<z.ZodString>;
950
- }, z.core.$strip>, z.ZodObject<{
951
- type: z.ZodEnum<{
952
- unlimited: "unlimited";
953
- }>;
954
- }, z.core.$strip>>>]>>;
955
- maximumEnvironments: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
956
- type: z.ZodLiteral<"limited">;
957
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
958
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
959
- displayName: z.ZodReadonly<z.ZodString>;
960
- }, z.core.$strip>, z.ZodObject<{
961
- type: z.ZodEnum<{
962
- limited: "limited";
963
- }>;
964
- value: z.ZodInt;
965
- }, z.core.$strip>>>, z.ZodIntersection<z.ZodObject<{
966
- type: z.ZodLiteral<"unlimited">;
967
- }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
968
- displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
969
- displayName: z.ZodReadonly<z.ZodString>;
970
- }, z.core.$strip>, z.ZodObject<{
971
- type: z.ZodEnum<{
972
- unlimited: "unlimited";
973
- }>;
974
- }, z.core.$strip>>>]>>;
975
- }, z.core.$strip>>;
976
- }, z.core.$strip>>;
977
- currentPeriodEnd: z.ZodReadonly<z.ZodInt>;
978
- scheduledChangeAt: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
979
- seats: z.ZodReadonly<z.ZodInt>;
980
- paymentMethods: z.ZodReadonly<z.ZodArray<z.ZodObject<{
981
- id: z.ZodReadonly<z.ZodString>;
982
- brand: z.ZodReadonly<z.ZodString>;
983
- last4: z.ZodReadonly<z.ZodString>;
984
- expMonth: z.ZodReadonly<z.ZodInt>;
985
- expYear: z.ZodReadonly<z.ZodInt>;
986
- isDefault: z.ZodReadonly<z.ZodBoolean>;
987
- }, z.core.$strip>>>;
988
- upcomingInvoiceTotalCents: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
989
- }, z.core.$strip>;
990
- export declare const zCreateCustomerData: z.ZodObject<{
991
- body: z.ZodObject<{
992
- plan: z.ZodString;
993
- billingInterval: z.ZodEnum<{
994
- monthly: "monthly";
995
- annual: "annual";
996
- }>;
823
+ path: z.ZodObject<{
824
+ org: z.ZodString;
997
825
  }, z.core.$strip>;
998
- path: z.ZodOptional<z.ZodNever>;
999
826
  query: z.ZodOptional<z.ZodNever>;
1000
827
  }, z.core.$strip>;
1001
828
  export declare const zCreateSetupIntentData: z.ZodObject<{
1002
829
  body: z.ZodOptional<z.ZodNever>;
1003
- path: z.ZodOptional<z.ZodNever>;
830
+ path: z.ZodObject<{
831
+ org: z.ZodString;
832
+ }, z.core.$strip>;
1004
833
  query: z.ZodOptional<z.ZodNever>;
1005
834
  }, z.core.$strip>;
1006
835
  /**
@@ -1012,7 +841,7 @@ export declare const zCreateSetupIntentResponse: z.ZodObject<{
1012
841
  export declare const zDeletePaymentMethodData: z.ZodObject<{
1013
842
  body: z.ZodOptional<z.ZodNever>;
1014
843
  path: z.ZodObject<{
1015
- id: z.ZodString;
844
+ paymentID: z.ZodString;
1016
845
  }, z.core.$strip>;
1017
846
  query: z.ZodOptional<z.ZodNever>;
1018
847
  }, z.core.$strip>;
@@ -1023,7 +852,7 @@ export declare const zDeletePaymentMethodResponse: z.ZodVoid;
1023
852
  export declare const zUpdateDefaultPaymentMethodData: z.ZodObject<{
1024
853
  body: z.ZodOptional<z.ZodNever>;
1025
854
  path: z.ZodObject<{
1026
- id: z.ZodString;
855
+ paymentID: z.ZodString;
1027
856
  }, z.core.$strip>;
1028
857
  query: z.ZodOptional<z.ZodNever>;
1029
858
  }, z.core.$strip>;
@@ -1033,7 +862,9 @@ export declare const zUpdateDefaultPaymentMethodData: z.ZodObject<{
1033
862
  export declare const zUpdateDefaultPaymentMethodResponse: z.ZodVoid;
1034
863
  export declare const zGetInvoicesData: z.ZodObject<{
1035
864
  body: z.ZodOptional<z.ZodNever>;
1036
- path: z.ZodOptional<z.ZodNever>;
865
+ path: z.ZodObject<{
866
+ org: z.ZodString;
867
+ }, z.core.$strip>;
1037
868
  query: z.ZodOptional<z.ZodObject<{
1038
869
  limit: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
1039
870
  starting_after: z.ZodOptional<z.ZodString>;
@@ -180,7 +180,11 @@ export const zCustomerResponseWritable = z.object({
180
180
  currentPlan: zCustomerPlanResponseWritable
181
181
  });
182
182
  /**
183
- * Kinde Organisation ID
183
+ * Stripe payment method.
184
+ */
185
+ export const zPaymentMethodId = z.string();
186
+ /**
187
+ * Kinde organisation id.
184
188
  */
185
189
  export const zOrganisationId = z.string();
186
190
  export const zGetPlansData = z.object({
@@ -194,26 +198,16 @@ export const zGetPlansData = z.object({
194
198
  export const zGetPlansResponse = zCatalogResponse;
195
199
  export const zUpdatePlanData = z.object({
196
200
  body: zUpdatePlan,
197
- path: z.optional(z.never()),
198
- query: z.optional(z.never())
199
- });
200
- export const zGetCustomerData = z.object({
201
- body: z.optional(z.never()),
202
- path: z.optional(z.never()),
203
- query: z.optional(z.never())
204
- });
205
- /**
206
- * Customer billing state
207
- */
208
- export const zGetCustomerResponse = zCustomerResponse;
209
- export const zCreateCustomerData = z.object({
210
- body: zCreateCustomerRequest,
211
- path: z.optional(z.never()),
201
+ path: z.object({
202
+ org: z.string()
203
+ }),
212
204
  query: z.optional(z.never())
213
205
  });
214
206
  export const zCreateSetupIntentData = z.object({
215
207
  body: z.optional(z.never()),
216
- path: z.optional(z.never()),
208
+ path: z.object({
209
+ org: z.string()
210
+ }),
217
211
  query: z.optional(z.never())
218
212
  });
219
213
  /**
@@ -223,7 +217,7 @@ export const zCreateSetupIntentResponse = zSetupIntentResponse;
223
217
  export const zDeletePaymentMethodData = z.object({
224
218
  body: z.optional(z.never()),
225
219
  path: z.object({
226
- id: z.string()
220
+ paymentID: z.string()
227
221
  }),
228
222
  query: z.optional(z.never())
229
223
  });
@@ -234,7 +228,7 @@ export const zDeletePaymentMethodResponse = z.void();
234
228
  export const zUpdateDefaultPaymentMethodData = z.object({
235
229
  body: z.optional(z.never()),
236
230
  path: z.object({
237
- id: z.string()
231
+ paymentID: z.string()
238
232
  }),
239
233
  query: z.optional(z.never())
240
234
  });
@@ -244,7 +238,9 @@ export const zUpdateDefaultPaymentMethodData = z.object({
244
238
  export const zUpdateDefaultPaymentMethodResponse = z.void();
245
239
  export const zGetInvoicesData = z.object({
246
240
  body: z.optional(z.never()),
247
- path: z.optional(z.never()),
241
+ path: z.object({
242
+ org: z.string()
243
+ }),
248
244
  query: z.optional(z.object({
249
245
  limit: z.optional(z.int().gte(1).lte(100)).default(10),
250
246
  starting_after: z.optional(z.string())
@@ -1,6 +1,6 @@
1
1
  import { useMutation } from "@tanstack/react-query";
2
2
  import { GetSuccessResponse } from "../util";
3
- import { GetPlansData, UpdatePlanData, UpdatePlanResponses, GetCustomerData, CreateCustomerData, CreateCustomerResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
3
+ import { GetPlansData, UpdatePlanData, UpdatePlanResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
4
4
  export declare const useGetPlans: (options?: Omit<GetPlansData, "url"> & {
5
5
  enabled?: boolean;
6
6
  }) => {
@@ -216,221 +216,6 @@ export declare const useUpdatePlan: (config?: {
216
216
  data: unknown;
217
217
  headers: Record<string, string>;
218
218
  }, unknown, Omit<UpdatePlanData, "url">, unknown>;
219
- export declare const useGetCustomer: (options?: Omit<GetCustomerData, "url"> & {
220
- enabled?: boolean;
221
- }) => {
222
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
223
- headers: Record<string, string> | undefined;
224
- error: Error;
225
- isError: true;
226
- isPending: false;
227
- isLoading: false;
228
- isLoadingError: false;
229
- isRefetchError: true;
230
- isSuccess: false;
231
- isPlaceholderData: false;
232
- status: "error";
233
- dataUpdatedAt: number;
234
- errorUpdatedAt: number;
235
- failureCount: number;
236
- failureReason: Error | null;
237
- errorUpdateCount: number;
238
- isFetched: boolean;
239
- isFetchedAfterMount: boolean;
240
- isFetching: boolean;
241
- isInitialLoading: boolean;
242
- isPaused: boolean;
243
- isRefetching: boolean;
244
- isStale: boolean;
245
- isEnabled: boolean;
246
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
247
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
248
- headers: Record<string, string>;
249
- } | undefined, Error>>;
250
- fetchStatus: import("@tanstack/react-query").FetchStatus;
251
- promise: Promise<{
252
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
253
- headers: Record<string, string>;
254
- } | undefined>;
255
- } | {
256
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
257
- headers: Record<string, string> | undefined;
258
- error: null;
259
- isError: false;
260
- isPending: false;
261
- isLoading: false;
262
- isLoadingError: false;
263
- isRefetchError: false;
264
- isSuccess: true;
265
- isPlaceholderData: false;
266
- status: "success";
267
- dataUpdatedAt: number;
268
- errorUpdatedAt: number;
269
- failureCount: number;
270
- failureReason: Error | null;
271
- errorUpdateCount: number;
272
- isFetched: boolean;
273
- isFetchedAfterMount: boolean;
274
- isFetching: boolean;
275
- isInitialLoading: boolean;
276
- isPaused: boolean;
277
- isRefetching: boolean;
278
- isStale: boolean;
279
- isEnabled: boolean;
280
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
281
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
282
- headers: Record<string, string>;
283
- } | undefined, Error>>;
284
- fetchStatus: import("@tanstack/react-query").FetchStatus;
285
- promise: Promise<{
286
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
287
- headers: Record<string, string>;
288
- } | undefined>;
289
- } | {
290
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
291
- headers: Record<string, string> | undefined;
292
- error: Error;
293
- isError: true;
294
- isPending: false;
295
- isLoading: false;
296
- isLoadingError: true;
297
- isRefetchError: false;
298
- isSuccess: false;
299
- isPlaceholderData: false;
300
- status: "error";
301
- dataUpdatedAt: number;
302
- errorUpdatedAt: number;
303
- failureCount: number;
304
- failureReason: Error | null;
305
- errorUpdateCount: number;
306
- isFetched: boolean;
307
- isFetchedAfterMount: boolean;
308
- isFetching: boolean;
309
- isInitialLoading: boolean;
310
- isPaused: boolean;
311
- isRefetching: boolean;
312
- isStale: boolean;
313
- isEnabled: boolean;
314
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
315
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
316
- headers: Record<string, string>;
317
- } | undefined, Error>>;
318
- fetchStatus: import("@tanstack/react-query").FetchStatus;
319
- promise: Promise<{
320
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
321
- headers: Record<string, string>;
322
- } | undefined>;
323
- } | {
324
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
325
- headers: Record<string, string> | undefined;
326
- error: null;
327
- isError: false;
328
- isPending: true;
329
- isLoading: true;
330
- isLoadingError: false;
331
- isRefetchError: false;
332
- isSuccess: false;
333
- isPlaceholderData: false;
334
- status: "pending";
335
- dataUpdatedAt: number;
336
- errorUpdatedAt: number;
337
- failureCount: number;
338
- failureReason: Error | null;
339
- errorUpdateCount: number;
340
- isFetched: boolean;
341
- isFetchedAfterMount: boolean;
342
- isFetching: boolean;
343
- isInitialLoading: boolean;
344
- isPaused: boolean;
345
- isRefetching: boolean;
346
- isStale: boolean;
347
- isEnabled: boolean;
348
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
349
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
350
- headers: Record<string, string>;
351
- } | undefined, Error>>;
352
- fetchStatus: import("@tanstack/react-query").FetchStatus;
353
- promise: Promise<{
354
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
355
- headers: Record<string, string>;
356
- } | undefined>;
357
- } | {
358
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
359
- headers: Record<string, string> | undefined;
360
- error: null;
361
- isError: false;
362
- isPending: true;
363
- isLoadingError: false;
364
- isRefetchError: false;
365
- isSuccess: false;
366
- isPlaceholderData: false;
367
- status: "pending";
368
- dataUpdatedAt: number;
369
- errorUpdatedAt: number;
370
- failureCount: number;
371
- failureReason: Error | null;
372
- errorUpdateCount: number;
373
- isFetched: boolean;
374
- isFetchedAfterMount: boolean;
375
- isFetching: boolean;
376
- isLoading: boolean;
377
- isInitialLoading: boolean;
378
- isPaused: boolean;
379
- isRefetching: boolean;
380
- isStale: boolean;
381
- isEnabled: boolean;
382
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
383
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
384
- headers: Record<string, string>;
385
- } | undefined, Error>>;
386
- fetchStatus: import("@tanstack/react-query").FetchStatus;
387
- promise: Promise<{
388
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
389
- headers: Record<string, string>;
390
- } | undefined>;
391
- } | {
392
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
393
- headers: Record<string, string> | undefined;
394
- isError: false;
395
- error: null;
396
- isPending: false;
397
- isLoading: false;
398
- isLoadingError: false;
399
- isRefetchError: false;
400
- isSuccess: true;
401
- isPlaceholderData: true;
402
- status: "success";
403
- dataUpdatedAt: number;
404
- errorUpdatedAt: number;
405
- failureCount: number;
406
- failureReason: Error | null;
407
- errorUpdateCount: number;
408
- isFetched: boolean;
409
- isFetchedAfterMount: boolean;
410
- isFetching: boolean;
411
- isInitialLoading: boolean;
412
- isPaused: boolean;
413
- isRefetching: boolean;
414
- isStale: boolean;
415
- isEnabled: boolean;
416
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
417
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
418
- headers: Record<string, string>;
419
- } | undefined, Error>>;
420
- fetchStatus: import("@tanstack/react-query").FetchStatus;
421
- promise: Promise<{
422
- data: import("../../sdk/billing/types.gen").CustomerResponse | undefined;
423
- headers: Record<string, string>;
424
- } | undefined>;
425
- };
426
- export declare const useCreateCustomer: (config?: {
427
- onSuccess?: (data: GetSuccessResponse<CreateCustomerResponses>, headers: Record<string, string>) => void;
428
- onError?: Parameters<typeof useMutation>["0"]["onError"];
429
- retry?: boolean;
430
- }) => import("@tanstack/react-query").UseMutationResult<{
431
- data: unknown;
432
- headers: Record<string, string>;
433
- }, unknown, Omit<CreateCustomerData, "url">, unknown>;
434
219
  export declare const useCreateSetupIntent: (config?: {
435
220
  onSuccess?: (data: GetSuccessResponse<CreateSetupIntentResponses>, headers: Record<string, string>) => void;
436
221
  onError?: Parameters<typeof useMutation>["0"]["onError"];
@@ -438,7 +223,7 @@ export declare const useCreateSetupIntent: (config?: {
438
223
  }) => import("@tanstack/react-query").UseMutationResult<{
439
224
  data: import("../../sdk/billing/types.gen").SetupIntentResponse | undefined;
440
225
  headers: Record<string, string>;
441
- }, unknown, Omit<CreateSetupIntentData, "url"> | undefined, unknown>;
226
+ }, unknown, Omit<CreateSetupIntentData, "url">, unknown>;
442
227
  export declare const useDeletePaymentMethod: (config?: {
443
228
  onSuccess?: (data: GetSuccessResponse<DeletePaymentMethodResponses>, headers: Record<string, string>) => void;
444
229
  onError?: Parameters<typeof useMutation>["0"]["onError"];
@@ -455,7 +240,7 @@ export declare const useUpdateDefaultPaymentMethod: (config?: {
455
240
  data: void | undefined;
456
241
  headers: Record<string, string>;
457
242
  }, unknown, Omit<UpdateDefaultPaymentMethodData, "url">, unknown>;
458
- export declare const useGetInvoices: (options?: Omit<GetInvoicesData, "url"> & {
243
+ export declare const useGetInvoices: (options: Omit<GetInvoicesData, "url"> & {
459
244
  enabled?: boolean;
460
245
  }) => {
461
246
  data: import("../../sdk/billing/types.gen").InvoiceListResponse | undefined;
@@ -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 { getPlans, updatePlan, getCustomer, createCustomer, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
5
+ import { getPlans, updatePlan, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
6
6
  export const useGetPlans = (options) => {
7
7
  const token = useToken();
8
8
  let { enabled, ...rest } = options || { enabled: true };
@@ -28,7 +28,7 @@ export const useGetPlans = (options) => {
28
28
  export const useUpdatePlan = (config) => {
29
29
  const token = useToken();
30
30
  const queryClient = useQueryClient();
31
- const opts = { throwOnError: true, url: "/api/v1/plan" };
31
+ const opts = { throwOnError: true, url: "/api/v1/plan/{org}" };
32
32
  const funcer = async (options) => {
33
33
  const auth = isPromise(token) ? (await token) || "" : token || "";
34
34
  const res = await updatePlan({ ...opts, ...options, auth });
@@ -37,48 +37,7 @@ export const useUpdatePlan = (config) => {
37
37
  return useMutation({
38
38
  mutationFn: funcer,
39
39
  onSuccess: (res, options, c, ctx) => {
40
- queryClient.invalidateQueries({ queryKey: ["api", "v1", "plan"] });
41
- config?.onSuccess && config.onSuccess(res.data, res.headers);
42
- },
43
- onError: config?.onError,
44
- retry: config?.retry
45
- });
46
- };
47
- export const useGetCustomer = (options) => {
48
- const token = useToken();
49
- let { enabled, ...rest } = options || { enabled: true };
50
- const opts = { throwOnError: true, url: "/api/v1/customer" };
51
- const funcer = async () => {
52
- const auth = isPromise(token) ? (await token) || "" : token || "";
53
- if (isPromise(token) && !token)
54
- return;
55
- const res = await getCustomer({ ...opts, ...rest, auth });
56
- return { data: res.data, headers: headersToObject(res.response.headers) };
57
- };
58
- if (!token)
59
- enabled = false;
60
- const query = useQuery({
61
- queryKey: ["api", "v1", "customer", options?.query ?? {}],
62
- queryFn: funcer,
63
- enabled,
64
- retry: false,
65
- staleTime: 600000
66
- });
67
- return { ...query, data: query.data?.data, headers: query.data?.headers };
68
- };
69
- export const useCreateCustomer = (config) => {
70
- const token = useToken();
71
- const queryClient = useQueryClient();
72
- const opts = { throwOnError: true, url: "/api/v1/customer" };
73
- const funcer = async (options) => {
74
- const auth = isPromise(token) ? (await token) || "" : token || "";
75
- const res = await createCustomer({ ...opts, ...options, auth });
76
- return { data: res.data, headers: headersToObject(res.response.headers) };
77
- };
78
- return useMutation({
79
- mutationFn: funcer,
80
- onSuccess: (res, options, c, ctx) => {
81
- queryClient.invalidateQueries({ queryKey: ["api", "v1", "customer"] });
40
+ queryClient.invalidateQueries({ queryKey: ["api", "v1", "plan", options?.path?.org] });
82
41
  config?.onSuccess && config.onSuccess(res.data, res.headers);
83
42
  },
84
43
  onError: config?.onError,
@@ -88,7 +47,7 @@ export const useCreateCustomer = (config) => {
88
47
  export const useCreateSetupIntent = (config) => {
89
48
  const token = useToken();
90
49
  const queryClient = useQueryClient();
91
- const opts = { throwOnError: true, url: "/api/v1/setup-intent" };
50
+ const opts = { throwOnError: true, url: "/api/v1/setup-intent/{org}" };
92
51
  const funcer = async (options) => {
93
52
  const auth = isPromise(token) ? (await token) || "" : token || "";
94
53
  const res = await createSetupIntent({ ...opts, ...options, auth });
@@ -97,7 +56,7 @@ export const useCreateSetupIntent = (config) => {
97
56
  return useMutation({
98
57
  mutationFn: funcer,
99
58
  onSuccess: (res, options, c, ctx) => {
100
- queryClient.invalidateQueries({ queryKey: ["api", "v1", "setup-intent"] });
59
+ queryClient.invalidateQueries({ queryKey: ["api", "v1", "setup-intent", options?.path?.org] });
101
60
  config?.onSuccess && config.onSuccess(res.data, res.headers);
102
61
  },
103
62
  onError: config?.onError,
@@ -107,7 +66,7 @@ export const useCreateSetupIntent = (config) => {
107
66
  export const useDeletePaymentMethod = (config) => {
108
67
  const token = useToken();
109
68
  const queryClient = useQueryClient();
110
- const opts = { throwOnError: true, url: "/api/v1/payment-method/{id}" };
69
+ const opts = { throwOnError: true, url: "/api/v1/payment-method/{paymentID}" };
111
70
  const funcer = async (options) => {
112
71
  const auth = isPromise(token) ? (await token) || "" : token || "";
113
72
  const res = await deletePaymentMethod({ ...opts, ...options, auth });
@@ -116,7 +75,7 @@ export const useDeletePaymentMethod = (config) => {
116
75
  return useMutation({
117
76
  mutationFn: funcer,
118
77
  onSuccess: (res, options, c, ctx) => {
119
- queryClient.invalidateQueries({ queryKey: ["api", "v1", "payment-method", options?.path?.id] });
78
+ queryClient.invalidateQueries({ queryKey: ["api", "v1", "payment-method", options?.path?.paymentID] });
120
79
  config?.onSuccess && config.onSuccess(res.data, res.headers);
121
80
  },
122
81
  onError: config?.onError,
@@ -126,7 +85,7 @@ export const useDeletePaymentMethod = (config) => {
126
85
  export const useUpdateDefaultPaymentMethod = (config) => {
127
86
  const token = useToken();
128
87
  const queryClient = useQueryClient();
129
- const opts = { throwOnError: true, url: "/api/v1/payment-method/{id}" };
88
+ const opts = { throwOnError: true, url: "/api/v1/payment-method/{paymentID}" };
130
89
  const funcer = async (options) => {
131
90
  const auth = isPromise(token) ? (await token) || "" : token || "";
132
91
  const res = await updateDefaultPaymentMethod({ ...opts, ...options, auth });
@@ -135,7 +94,7 @@ export const useUpdateDefaultPaymentMethod = (config) => {
135
94
  return useMutation({
136
95
  mutationFn: funcer,
137
96
  onSuccess: (res, options, c, ctx) => {
138
- queryClient.invalidateQueries({ queryKey: ["api", "v1", "payment-method", options?.path?.id] });
97
+ queryClient.invalidateQueries({ queryKey: ["api", "v1", "payment-method", options?.path?.paymentID] });
139
98
  config?.onSuccess && config.onSuccess(res.data, res.headers);
140
99
  },
141
100
  onError: config?.onError,
@@ -145,7 +104,7 @@ export const useUpdateDefaultPaymentMethod = (config) => {
145
104
  export const useGetInvoices = (options) => {
146
105
  const token = useToken();
147
106
  let { enabled, ...rest } = options || { enabled: true };
148
- const opts = { throwOnError: true, url: "/api/v1/invoices" };
107
+ const opts = { throwOnError: true, url: "/api/v1/invoices/{org}" };
149
108
  const funcer = async () => {
150
109
  const auth = isPromise(token) ? (await token) || "" : token || "";
151
110
  if (isPromise(token) && !token)
@@ -156,7 +115,7 @@ export const useGetInvoices = (options) => {
156
115
  if (!token)
157
116
  enabled = false;
158
117
  const query = useQuery({
159
- queryKey: ["api", "v1", "invoices", options?.query ?? {}],
118
+ queryKey: ["api", "v1", "invoices", options?.path?.org, options.query ?? {}],
160
119
  queryFn: funcer,
161
120
  enabled,
162
121
  retry: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "1.0.87",
3
+ "version": "1.0.88",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",