@outseta/react 0.4.47 → 0.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/react",
3
- "version": "0.4.47",
3
+ "version": "0.5.1",
4
4
  "description": "React hooks and components for the Outseta API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@outseta/api-client": "0.3.53"
21
+ "@outseta/api-client": "0.4.1"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^18.0.0 || ^19.0.0"
@@ -246,7 +246,11 @@ export function useDiscountCouponGetAllDiscountCoupons<TData = Awaited<ReturnTyp
246
246
 
247
247
 
248
248
  /**
249
- * Only one of AmountOff or PercentOff should be set.
249
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), use coupons and promotion
250
+ codes: POST /billing/stripe/coupons and POST /billing/stripe/promotion-codes. With Stripe
251
+ Billing the request is rejected.
252
+
253
+ Only one of AmountOff or PercentOff should be set.
250
254
  Duration values: 1 = Forever, 2 = Once, 3 = Repeating (DurationInMonths must be set).
251
255
  * @summary Add a new discount coupon.
252
256
  */
@@ -380,6 +384,9 @@ export function useDiscountCouponGetDiscountCoupon<TData = Awaited<ReturnType<ty
380
384
 
381
385
 
382
386
  /**
387
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), coupons are managed with
388
+ the /billing/stripe/coupons and /billing/stripe/promotion-codes endpoints. With Stripe
389
+ Billing the request is rejected.
383
390
  * @summary Update a discount coupon.
384
391
  */
385
392
  export const discountCouponUpdateDiscountCoupon = (
@@ -579,6 +586,7 @@ export function useDiscountCouponGetDiscountCouponRedemptions<TData = Awaited<Re
579
586
 
580
587
 
581
588
  /**
589
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
582
590
  * @summary Add a usage entry for an add-on that bills for usage at the end of the month.
583
591
  */
584
592
  export const usageAddUsage = (
@@ -917,6 +925,8 @@ export function useSubscriptionAddOnGetAllSubscriptionsAddOns<TData = Awaited<Re
917
925
 
918
926
 
919
927
  /**
928
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected;
929
+ use PUT /billing/stripe/subscriptions/{subscriptionUid}/change instead.
920
930
  * @summary Add an add-on to a subscription.
921
931
  */
922
932
  export const subscriptionAddOnAddSubscriptionAddOn = (
@@ -1116,7 +1126,9 @@ export const useSubscriptionAddOnAddSubscriptionAddOnPreview = <TError = void,
1116
1126
  return useMutation(mutationOptions);
1117
1127
  }
1118
1128
  /**
1119
- * When a subscription add-on is flagged, the next time the user authenticates the
1129
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
1130
+
1131
+ When a subscription add-on is flagged, the next time the user authenticates the
1120
1132
  authentication widget will prompt the user to change their add-on.
1121
1133
  * @summary Indicate that an upgrade of an add-on is required.
1122
1134
  */
@@ -1182,7 +1194,10 @@ export const useSubscriptionAddOnSetAddOnUpgradeRequired = <TError = void,
1182
1194
  return useMutation(mutationOptions);
1183
1195
  }
1184
1196
  /**
1185
- * Removes the add-on from the subscription going forward and returns the updated
1197
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected;
1198
+ use PUT /billing/stripe/subscriptions/{subscriptionUid}/change instead.
1199
+
1200
+ Removes the add-on from the subscription going forward and returns the updated
1186
1201
  subscription.
1187
1202
  * @summary End an add-on on a subscription.
1188
1203
  */
@@ -1245,6 +1260,7 @@ export const useSubscriptionAddOnEndSubscriptionAddOn = <TError = void,
1245
1260
  return useMutation(mutationOptions);
1246
1261
  }
1247
1262
  /**
1263
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
1248
1264
  * @summary Immediately ends an add-on.
1249
1265
  */
1250
1266
  export const subscriptionAddOnExpireSubscriptionAddOn = (
@@ -1379,6 +1395,8 @@ export function useInvoiceGetAllInvoices<TData = Awaited<ReturnType<typeof invoi
1379
1395
 
1380
1396
 
1381
1397
  /**
1398
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected;
1399
+ use POST /billing/stripe/invoices instead.
1382
1400
  * @summary Create an ad-hoc invoice for a given account.
1383
1401
  */
1384
1402
  export const invoiceAddInvoice = (
@@ -1511,7 +1529,9 @@ export function useInvoiceGetInvoice<TData = Awaited<ReturnType<typeof invoiceGe
1511
1529
 
1512
1530
 
1513
1531
  /**
1514
- * Only invoices created manually via the API or admin UI can be updated; invoices
1532
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
1533
+
1534
+ Only invoices created manually via the API or admin UI can be updated; invoices
1515
1535
  generated by a subscription's billing cycle are immutable and will return a
1516
1536
  validation error.
1517
1537
  * @summary Update an ad-hoc (manually created) invoice.
@@ -2047,6 +2067,7 @@ export const useSubscriptionDeleteSubscription = <TError = void,
2047
2067
  return useMutation(mutationOptions);
2048
2068
  }
2049
2069
  /**
2070
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
2050
2071
  * @summary Add a discount to a subscription.
2051
2072
  */
2052
2073
  export const subscriptionAddDiscountToSubscription = (
@@ -2175,7 +2196,9 @@ export const useSubscriptionExpireDiscountCouponSubscription = <TError = void,
2175
2196
  return useMutation(mutationOptions);
2176
2197
  }
2177
2198
  /**
2178
- * When a subscription is flagged, next time the user authenticates the authentication
2199
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected.
2200
+
2201
+ When a subscription is flagged, next time the user authenticates the authentication
2179
2202
  widget will prompt the user to change plan.
2180
2203
  * @summary Indicate that an upgrade of plan is required.
2181
2204
  */
@@ -2311,7 +2334,25 @@ export const useSubscriptionFirstTimeSubscriptionPreview = <TError = unknown,
2311
2334
  return useMutation(mutationOptions);
2312
2335
  }
2313
2336
  /**
2314
- * Returns an invoice object with information about the amount outstanding.
2337
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected;
2338
+ use POST /billing/stripe/subscriptions instead.
2339
+
2340
+ Returns the new subscription.
2341
+
2342
+ Outseta sets the subscription's dates itself, except ExpirationDate:
2343
+
2344
+ - RenewalDate is calculated from the plan's trial and the BillingRenewalTerm. A value you send is ignored.
2345
+ - EndDate is set by Outseta when the subscription ends. Don't send it: a subscription with an EndDate is
2346
+ rejected with "The renewal date has to be null if the end date is set."
2347
+ - ExpirationDate gives the subscription a fixed end. Outseta keeps the date you send, doesn't bill past it,
2348
+ and ends the subscription on that date, setting EndDate to it. A free plan with BillingRenewalTerm 1
2349
+ (monthly) renews monthly at no charge until then.
2350
+ - Without an ExpirationDate, the plan decides: its ExpirationDate if it has one, otherwise
2351
+ Plan.ExpiresAfterMonths. 0 means the plan never expires subscriptions; a value N above 0 gives an
2352
+ ExpirationDate of the start date plus the plan's trial days plus N months.
2353
+
2354
+ To set or remove the end date of a subscription that already exists, use
2355
+ PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2315
2356
  * @summary Add a subscription to an account for the first time.
2316
2357
  */
2317
2358
  export const subscriptionFirstTimeSubscription = (
@@ -2319,7 +2360,7 @@ export const subscriptionFirstTimeSubscription = (
2319
2360
  options?: SecondParameter<typeof customFetch>,) => {
2320
2361
 
2321
2362
 
2322
- return customFetch<Invoice>(
2363
+ return customFetch<Subscription>(
2323
2364
  {url: `/api/v1/billing/subscriptions/firsttimesubscription`, method: 'PUT',
2324
2365
  headers: {'Content-Type': 'application/json', },
2325
2366
  data: subscriptionFirstTimeSubscriptionBody
@@ -2443,7 +2484,26 @@ export const useSubscriptionChangeSubscriptionPreview = <TError = void,
2443
2484
  return useMutation(mutationOptions);
2444
2485
  }
2445
2486
  /**
2446
- * Returns an invoice object with information about the amount outstanding.
2487
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3) the request is rejected;
2488
+ use PUT /billing/stripe/subscriptions/{subscriptionUid}/change instead.
2489
+
2490
+ Returns the new subscription; its StartDate is when the change takes effect. When only add-ons
2491
+ change, returns the existing subscription.
2492
+
2493
+ A change of plan, BillingRenewalTerm or quantity ends the current subscription and creates a new
2494
+ subscription record. An upgrade starts immediately. Any other change, for example from one free plan
2495
+ to another at the same price, is scheduled for the current renewal date, unless the account is in a
2496
+ trial or you pass startImmediately=true.
2497
+
2498
+ The dates work as on PUT /api/v1/billing/subscriptions/firsttimesubscription: RenewalDate is
2499
+ calculated by Outseta, EndDate is set by Outseta when the subscription ends and can't be sent, and
2500
+ ExpirationDate gives the new subscription a fixed end. Without an ExpirationDate, the new subscription
2501
+ keeps the current one's expiration date when the plan stays the same; otherwise the plan's
2502
+ ExpirationDate or ExpiresAfterMonths applies.
2503
+
2504
+ A request with the same plan, BillingRenewalTerm and quantity only changes add-ons; it does not change
2505
+ the subscription's dates. To set or remove the end date of the current subscription, use
2506
+ PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2447
2507
  * @summary Change a subscription on an account.
2448
2508
  */
2449
2509
  export const subscriptionChangeSubscription = (
@@ -2579,6 +2639,9 @@ export function usePlanGetAllPlans<TData = Awaited<ReturnType<typeof planGetAllP
2579
2639
 
2580
2640
 
2581
2641
  /**
2642
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), plans are Stripe products
2643
+ and prices: use POST /billing/stripe/products and PUT /billing/stripe/products/{uid}. With
2644
+ Stripe Billing the request is rejected.
2582
2645
  * @summary Add a new plan.
2583
2646
  */
2584
2647
  export const planAddPlan = (
@@ -2711,6 +2774,9 @@ export function usePlanGetPlan<TData = Awaited<ReturnType<typeof planGetPlan>>,
2711
2774
 
2712
2775
 
2713
2776
  /**
2777
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), plans are Stripe products
2778
+ and prices: use POST /billing/stripe/products and PUT /billing/stripe/products/{uid}. With
2779
+ Stripe Billing the request is rejected.
2714
2780
  * @summary Update a plan.
2715
2781
  */
2716
2782
  export const planUpdatePlan = (
@@ -2980,6 +3046,9 @@ export function usePlanFamilyGetAllPlanFamilies<TData = Awaited<ReturnType<typeo
2980
3046
 
2981
3047
 
2982
3048
  /**
3049
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), use product families:
3050
+ POST /billing/stripe/product-families and PUT /billing/stripe/product-families/{productFamilyUid}.
3051
+ With Stripe Billing the request is rejected.
2983
3052
  * @summary Add a new plan family.
2984
3053
  */
2985
3054
  export const planFamilyAddPlanFamily = (
@@ -3112,6 +3181,9 @@ export function usePlanFamilyGetPlanFamily<TData = Awaited<ReturnType<typeof pla
3112
3181
 
3113
3182
 
3114
3183
  /**
3184
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), use product families:
3185
+ POST /billing/stripe/product-families and PUT /billing/stripe/product-families/{productFamilyUid}.
3186
+ With Stripe Billing the request is rejected.
3115
3187
  * @summary Update a plan family.
3116
3188
  */
3117
3189
  export const planFamilyUpdatePlanFamily = (