@outseta/react 0.4.46 → 0.5.0

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.46",
3
+ "version": "0.5.0",
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.52"
21
+ "@outseta/api-client": "0.4.0"
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 = (
@@ -2311,7 +2318,22 @@ export const useSubscriptionFirstTimeSubscriptionPreview = <TError = unknown,
2311
2318
  return useMutation(mutationOptions);
2312
2319
  }
2313
2320
  /**
2314
- * Returns an invoice object with information about the amount outstanding.
2321
+ * Returns the new subscription.
2322
+
2323
+ Outseta sets the subscription's dates itself, except ExpirationDate:
2324
+
2325
+ - RenewalDate is calculated from the plan's trial and the BillingRenewalTerm. A value you send is ignored.
2326
+ - EndDate is set by Outseta when the subscription ends. Don't send it: a subscription with an EndDate is
2327
+ rejected with "The renewal date has to be null if the end date is set."
2328
+ - ExpirationDate gives the subscription a fixed end. Outseta keeps the date you send, doesn't bill past it,
2329
+ and ends the subscription on that date, setting EndDate to it. A free plan with BillingRenewalTerm 1
2330
+ (monthly) renews monthly at no charge until then.
2331
+ - Without an ExpirationDate, the plan decides: its ExpirationDate if it has one, otherwise
2332
+ Plan.ExpiresAfterMonths. 0 means the plan never expires subscriptions; a value N above 0 gives an
2333
+ ExpirationDate of the start date plus the plan's trial days plus N months.
2334
+
2335
+ To set or remove the end date of a subscription that already exists, use
2336
+ PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2315
2337
  * @summary Add a subscription to an account for the first time.
2316
2338
  */
2317
2339
  export const subscriptionFirstTimeSubscription = (
@@ -2319,7 +2341,7 @@ export const subscriptionFirstTimeSubscription = (
2319
2341
  options?: SecondParameter<typeof customFetch>,) => {
2320
2342
 
2321
2343
 
2322
- return customFetch<Invoice>(
2344
+ return customFetch<Subscription>(
2323
2345
  {url: `/api/v1/billing/subscriptions/firsttimesubscription`, method: 'PUT',
2324
2346
  headers: {'Content-Type': 'application/json', },
2325
2347
  data: subscriptionFirstTimeSubscriptionBody
@@ -2443,7 +2465,23 @@ export const useSubscriptionChangeSubscriptionPreview = <TError = void,
2443
2465
  return useMutation(mutationOptions);
2444
2466
  }
2445
2467
  /**
2446
- * Returns an invoice object with information about the amount outstanding.
2468
+ * Returns the new subscription; its StartDate is when the change takes effect. When only add-ons
2469
+ change, returns the existing subscription.
2470
+
2471
+ A change of plan, BillingRenewalTerm or quantity ends the current subscription and creates a new
2472
+ subscription record. An upgrade starts immediately. Any other change, for example from one free plan
2473
+ to another at the same price, is scheduled for the current renewal date, unless the account is in a
2474
+ trial or you pass startImmediately=true.
2475
+
2476
+ The dates work as on PUT /api/v1/billing/subscriptions/firsttimesubscription: RenewalDate is
2477
+ calculated by Outseta, EndDate is set by Outseta when the subscription ends and can't be sent, and
2478
+ ExpirationDate gives the new subscription a fixed end. Without an ExpirationDate, the new subscription
2479
+ keeps the current one's expiration date when the plan stays the same; otherwise the plan's
2480
+ ExpirationDate or ExpiresAfterMonths applies.
2481
+
2482
+ A request with the same plan, BillingRenewalTerm and quantity only changes add-ons; it does not change
2483
+ the subscription's dates. To set or remove the end date of the current subscription, use
2484
+ PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2447
2485
  * @summary Change a subscription on an account.
2448
2486
  */
2449
2487
  export const subscriptionChangeSubscription = (
@@ -2579,6 +2617,9 @@ export function usePlanGetAllPlans<TData = Awaited<ReturnType<typeof planGetAllP
2579
2617
 
2580
2618
 
2581
2619
  /**
2620
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), plans are Stripe products
2621
+ and prices: use POST /billing/stripe/products and PUT /billing/stripe/products/{uid}. With
2622
+ Stripe Billing the request is rejected.
2582
2623
  * @summary Add a new plan.
2583
2624
  */
2584
2625
  export const planAddPlan = (
@@ -2711,6 +2752,9 @@ export function usePlanGetPlan<TData = Awaited<ReturnType<typeof planGetPlan>>,
2711
2752
 
2712
2753
 
2713
2754
  /**
2755
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), plans are Stripe products
2756
+ and prices: use POST /billing/stripe/products and PUT /billing/stripe/products/{uid}. With
2757
+ Stripe Billing the request is rejected.
2714
2758
  * @summary Update a plan.
2715
2759
  */
2716
2760
  export const planUpdatePlan = (
@@ -2980,6 +3024,9 @@ export function usePlanFamilyGetAllPlanFamilies<TData = Awaited<ReturnType<typeo
2980
3024
 
2981
3025
 
2982
3026
  /**
3027
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), use product families:
3028
+ POST /billing/stripe/product-families and PUT /billing/stripe/product-families/{productFamilyUid}.
3029
+ With Stripe Billing the request is rejected.
2983
3030
  * @summary Add a new plan family.
2984
3031
  */
2985
3032
  export const planFamilyAddPlanFamily = (
@@ -3112,6 +3159,9 @@ export function usePlanFamilyGetPlanFamily<TData = Awaited<ReturnType<typeof pla
3112
3159
 
3113
3160
 
3114
3161
  /**
3162
+ * Applies to Outseta billing (v2) only. With Stripe Billing (v3), use product families:
3163
+ POST /billing/stripe/product-families and PUT /billing/stripe/product-families/{productFamilyUid}.
3164
+ With Stripe Billing the request is rejected.
3115
3165
  * @summary Update a plan family.
3116
3166
  */
3117
3167
  export const planFamilyUpdatePlanFamily = (