shoal-web-sdk 1.0.119 → 1.0.121

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 { CancelSubscriptionData, CancelSubscriptionError, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
3
+ import type { CancelSubscriptionData, CancelSubscriptionError, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, CreateSubscriptionResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, 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;
@@ -106,10 +106,10 @@ export declare const cancelSubscriptionMutation: (options?: Partial<Options<Canc
106
106
  /**
107
107
  * Starts a new subscription for a customer who no longer has one.
108
108
  *
109
- * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
109
+ * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer and never grants a trial period. The subscription is created incomplete: its first invoice is returned as a PaymentIntent client secret for the caller to confirm in the browser, and the subscription only becomes active once that payment succeeds.
110
110
  *
111
111
  */
112
- export declare const createSubscriptionMutation: (options?: Partial<Options<CreateSubscriptionData>>) => UseMutationOptions<unknown, CreateSubscriptionError, Options<CreateSubscriptionData>>;
112
+ export declare const createSubscriptionMutation: (options?: Partial<Options<CreateSubscriptionData>>) => UseMutationOptions<CreateSubscriptionResponse, CreateSubscriptionError, Options<CreateSubscriptionData>>;
113
113
  /**
114
114
  * Creates a Stripe SetupIntent.
115
115
  *
@@ -118,7 +118,7 @@ export const cancelSubscriptionMutation = (options) => {
118
118
  /**
119
119
  * Starts a new subscription for a customer who no longer has one.
120
120
  *
121
- * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
121
+ * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer and never grants a trial period. The subscription is created incomplete: its first invoice is returned as a PaymentIntent client secret for the caller to confirm in the browser, and the subscription only becomes active once that payment succeeds.
122
122
  *
123
123
  */
124
124
  export const createSubscriptionMutation = (options) => {
@@ -39,7 +39,7 @@ export declare const cancelSubscription: <ThrowOnError extends boolean = false>(
39
39
  /**
40
40
  * Starts a new subscription for a customer who no longer has one.
41
41
  *
42
- * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
42
+ * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer and never grants a trial period. The subscription is created incomplete: its first invoice is returned as a PaymentIntent client secret for the caller to confirm in the browser, and the subscription only becomes active once that payment succeeds.
43
43
  *
44
44
  */
45
45
  export declare const createSubscription: <ThrowOnError extends boolean = false>(options: Options<CreateSubscriptionData, ThrowOnError>) => import("./client").RequestResult<CreateSubscriptionResponses, CreateSubscriptionErrors, ThrowOnError, "fields">;
@@ -85,7 +85,7 @@ export const cancelSubscription = (options) => {
85
85
  /**
86
86
  * Starts a new subscription for a customer who no longer has one.
87
87
  *
88
- * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
88
+ * Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer and never grants a trial period. The subscription is created incomplete: its first invoice is returned as a PaymentIntent client secret for the caller to confirm in the browser, and the subscription only becomes active once that payment succeeds.
89
89
  *
90
90
  */
91
91
  export const createSubscription = (options) => {
@@ -99,6 +99,15 @@ export type CreateSubscriptionRequest = {
99
99
  export type SetupIntentResponse = {
100
100
  readonly clientSecret: string;
101
101
  };
102
+ export type SubscriptionResponse = {
103
+ readonly subscriptionId: string;
104
+ readonly status: string;
105
+ /**
106
+ * Client secret of the PaymentIntent for the subscription's first invoice. Present while the subscription is incomplete and the payment still has to be confirmed in the browser; absent when nothing is due.
107
+ *
108
+ */
109
+ readonly clientSecret?: string;
110
+ };
102
111
  export type InvoiceResponse = {
103
112
  readonly id: string;
104
113
  readonly number?: string;
@@ -466,8 +475,9 @@ export type CreateSubscriptionResponses = {
466
475
  /**
467
476
  * The subscription was created
468
477
  */
469
- 201: unknown;
478
+ 201: SubscriptionResponse;
470
479
  };
480
+ export type CreateSubscriptionResponse = CreateSubscriptionResponses[keyof CreateSubscriptionResponses];
471
481
  export type CreateSetupIntentData = {
472
482
  body?: never;
473
483
  path: {
@@ -1962,6 +1962,11 @@ export declare const zCreateSubscriptionRequest: z.ZodObject<{
1962
1962
  export declare const zSetupIntentResponse: z.ZodObject<{
1963
1963
  clientSecret: z.ZodReadonly<z.ZodString>;
1964
1964
  }, z.core.$strip>;
1965
+ export declare const zSubscriptionResponse: z.ZodObject<{
1966
+ subscriptionId: z.ZodReadonly<z.ZodString>;
1967
+ status: z.ZodReadonly<z.ZodString>;
1968
+ clientSecret: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
1969
+ }, z.core.$strip>;
1965
1970
  export declare const zInvoiceResponse: z.ZodObject<{
1966
1971
  id: z.ZodReadonly<z.ZodString>;
1967
1972
  number: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
@@ -6542,6 +6547,14 @@ export declare const zCreateSubscriptionData: z.ZodObject<{
6542
6547
  }, z.core.$strip>;
6543
6548
  query: z.ZodOptional<z.ZodNever>;
6544
6549
  }, z.core.$strip>;
6550
+ /**
6551
+ * The subscription was created
6552
+ */
6553
+ export declare const zCreateSubscriptionResponse: z.ZodObject<{
6554
+ subscriptionId: z.ZodReadonly<z.ZodString>;
6555
+ status: z.ZodReadonly<z.ZodString>;
6556
+ clientSecret: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
6557
+ }, z.core.$strip>;
6545
6558
  export declare const zCreateSetupIntentData: z.ZodObject<{
6546
6559
  body: z.ZodOptional<z.ZodNever>;
6547
6560
  path: z.ZodObject<{
@@ -124,6 +124,11 @@ export const zCreateSubscriptionRequest = z.object({
124
124
  export const zSetupIntentResponse = z.object({
125
125
  clientSecret: z.string().readonly()
126
126
  });
127
+ export const zSubscriptionResponse = z.object({
128
+ subscriptionId: z.string().readonly(),
129
+ status: z.string().readonly(),
130
+ clientSecret: z.optional(z.string().readonly())
131
+ });
127
132
  export const zInvoiceResponse = z.object({
128
133
  id: z.string().readonly(),
129
134
  number: z.optional(z.string().readonly()),
@@ -340,6 +345,10 @@ export const zCreateSubscriptionData = z.object({
340
345
  }),
341
346
  query: z.optional(z.never())
342
347
  });
348
+ /**
349
+ * The subscription was created
350
+ */
351
+ export const zCreateSubscriptionResponse = zSubscriptionResponse;
343
352
  export const zCreateSetupIntentData = z.object({
344
353
  body: z.optional(z.never()),
345
354
  path: z.object({
@@ -84,7 +84,7 @@ export type SecretValue = {
84
84
  value: string;
85
85
  version: string;
86
86
  };
87
- export type ErrorCode = 'UNKNOWN_ERROR' | 'AUTHORISATION_ERROR' | 'CONTENT_NOT_FOUND' | 'INVALID_PAGINATION' | 'INVALID_REQUEST_BODY' | 'INVALID_PATH_PARAM' | 'MISSING_CONTEXT_VALUE' | 'CONSTRAINT_ERROR' | 'PROJECT_CREATION_ERROR' | 'INVALID_QUERY_PARAM' | 'EXPIRED' | 'IDENTITY_NOT_FOUND' | 'NODE_TYPE_DISABLED';
87
+ export type ErrorCode = 'UNKNOWN_ERROR' | 'AUTHORISATION_ERROR' | 'CONTENT_NOT_FOUND' | 'INVALID_PAGINATION' | 'INVALID_REQUEST_BODY' | 'INVALID_PATH_PARAM' | 'MISSING_CONTEXT_VALUE' | 'CONSTRAINT_ERROR' | 'PROJECT_CREATION_ERROR' | 'INVALID_QUERY_PARAM' | 'EXPIRED' | 'IDENTITY_NOT_FOUND' | 'NODE_TYPE_DISABLED' | 'NOT_ALLOWED';
88
88
  export type ErrorResponse = {
89
89
  message: string;
90
90
  internalCode: ErrorCode;
@@ -105,6 +105,7 @@ export declare const zErrorCode: z.ZodEnum<{
105
105
  EXPIRED: "EXPIRED";
106
106
  IDENTITY_NOT_FOUND: "IDENTITY_NOT_FOUND";
107
107
  NODE_TYPE_DISABLED: "NODE_TYPE_DISABLED";
108
+ NOT_ALLOWED: "NOT_ALLOWED";
108
109
  }>;
109
110
  export declare const zErrorResponse: z.ZodObject<{
110
111
  message: z.ZodString;
@@ -122,6 +123,7 @@ export declare const zErrorResponse: z.ZodObject<{
122
123
  EXPIRED: "EXPIRED";
123
124
  IDENTITY_NOT_FOUND: "IDENTITY_NOT_FOUND";
124
125
  NODE_TYPE_DISABLED: "NODE_TYPE_DISABLED";
126
+ NOT_ALLOWED: "NOT_ALLOWED";
125
127
  }>;
126
128
  }, z.core.$strip>;
127
129
  export declare const zNeonOrganization: z.ZodObject<{
@@ -97,7 +97,8 @@ export const zErrorCode = z.enum([
97
97
  'INVALID_QUERY_PARAM',
98
98
  'EXPIRED',
99
99
  'IDENTITY_NOT_FOUND',
100
- 'NODE_TYPE_DISABLED'
100
+ 'NODE_TYPE_DISABLED',
101
+ 'NOT_ALLOWED'
101
102
  ]);
102
103
  export const zErrorResponse = z.object({
103
104
  message: z.string(),
@@ -643,7 +643,7 @@ export declare const useCreateSubscription: (config?: {
643
643
  onError?: Parameters<typeof useMutation>["0"]["onError"];
644
644
  retry?: boolean;
645
645
  }) => import("@tanstack/react-query").UseMutationResult<{
646
- data: unknown;
646
+ data: import("../../sdk/billing/types.gen").SubscriptionResponse | undefined;
647
647
  headers: Record<string, string>;
648
648
  }, unknown, Omit<CreateSubscriptionData, "url">, unknown>;
649
649
  export declare const useCreateSetupIntent: (config?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "1.0.119",
3
+ "version": "1.0.121",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",