autumn-js 1.2.21 → 1.2.23

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.
Files changed (117) hide show
  1. package/dist/backend/adapters/express.js +181 -46
  2. package/dist/backend/adapters/express.mjs +9 -9
  3. package/dist/backend/adapters/fetch.js +181 -46
  4. package/dist/backend/adapters/fetch.mjs +9 -9
  5. package/dist/backend/adapters/hono.js +181 -46
  6. package/dist/backend/adapters/hono.mjs +9 -9
  7. package/dist/backend/adapters/index.js +181 -46
  8. package/dist/backend/adapters/index.mjs +12 -12
  9. package/dist/backend/adapters/next.js +181 -46
  10. package/dist/backend/adapters/next.mjs +9 -9
  11. package/dist/backend/{chunk-K2JSUNJX.mjs → chunk-7TQNAVUG.mjs} +1 -1
  12. package/dist/backend/{chunk-TGR2RWLO.mjs → chunk-K2ODGGAT.mjs} +1 -1
  13. package/dist/backend/{chunk-73KXFYFC.mjs → chunk-RKIVVLR3.mjs} +5 -5
  14. package/dist/backend/{chunk-GKYVE5XN.mjs → chunk-T4ZAR3BE.mjs} +143 -31
  15. package/dist/backend/{chunk-5JNYI5HM.mjs → chunk-UFAAJ5IV.mjs} +1 -1
  16. package/dist/backend/{chunk-NSHGFU5H.mjs → chunk-VHEQZSCT.mjs} +38 -15
  17. package/dist/backend/{chunk-H6KJYTJY.mjs → chunk-W5UYBM7S.mjs} +7 -7
  18. package/dist/backend/{chunk-NNIHXZQM.mjs → chunk-ZE23DYSY.mjs} +1 -1
  19. package/dist/backend/core/handlers/coreHandler.d.mts +1 -1
  20. package/dist/backend/core/handlers/coreHandler.d.ts +1 -1
  21. package/dist/backend/core/handlers/coreHandler.js +181 -46
  22. package/dist/backend/core/handlers/coreHandler.mjs +7 -7
  23. package/dist/backend/core/handlers/executeRoute.d.mts +1 -1
  24. package/dist/backend/core/handlers/executeRoute.d.ts +1 -1
  25. package/dist/backend/core/handlers/executeRoute.mjs +4 -4
  26. package/dist/backend/core/handlers/handleRouteByName.js +181 -46
  27. package/dist/backend/core/handlers/handleRouteByName.mjs +7 -7
  28. package/dist/backend/core/handlers/index.d.mts +1 -1
  29. package/dist/backend/core/handlers/index.d.ts +1 -1
  30. package/dist/backend/core/handlers/index.js +181 -46
  31. package/dist/backend/core/handlers/index.mjs +10 -10
  32. package/dist/backend/core/index.d.mts +1 -1
  33. package/dist/backend/core/index.d.ts +1 -1
  34. package/dist/backend/core/index.js +181 -46
  35. package/dist/backend/core/index.mjs +10 -10
  36. package/dist/backend/core/routes/index.d.mts +1 -1
  37. package/dist/backend/core/routes/index.d.ts +1 -1
  38. package/dist/backend/core/routes/index.js +38 -15
  39. package/dist/backend/core/routes/index.mjs +2 -2
  40. package/dist/backend/core/routes/routeBuilder.d.mts +1 -1
  41. package/dist/backend/core/routes/routeBuilder.d.ts +1 -1
  42. package/dist/backend/core/routes/routeConfigs.d.mts +1 -1
  43. package/dist/backend/core/routes/routeConfigs.d.ts +1 -1
  44. package/dist/backend/core/routes/routeConfigs.js +38 -15
  45. package/dist/backend/core/routes/routeConfigs.mjs +2 -2
  46. package/dist/backend/core/types/handlerTypes.d.mts +1 -1
  47. package/dist/backend/core/types/handlerTypes.d.ts +1 -1
  48. package/dist/backend/core/types/index.d.mts +1 -1
  49. package/dist/backend/core/types/index.d.ts +1 -1
  50. package/dist/backend/core/types/routeTypes.d.mts +1 -1
  51. package/dist/backend/core/types/routeTypes.d.ts +1 -1
  52. package/dist/backend/core/utils/index.mjs +3 -3
  53. package/dist/backend/index.d.mts +2 -2
  54. package/dist/backend/index.d.ts +2 -2
  55. package/dist/backend/index.js +181 -46
  56. package/dist/backend/index.mjs +10 -10
  57. package/dist/backend/{routeTypes-DZFxBYSb.d.mts → routeTypes-BBNqffnK.d.mts} +200 -2
  58. package/dist/backend/{routeTypes-B-Bkse9m.d.ts → routeTypes-D5CxGaFb.d.ts} +200 -2
  59. package/dist/better-auth/{chunk-X6KOCWP3.mjs → chunk-3NU5LQBR.mjs} +38 -15
  60. package/dist/better-auth/{chunk-R35KMMJZ.mjs → chunk-GPZQFANN.mjs} +1 -1
  61. package/dist/better-auth/{chunk-4OLXYKUC.mjs → chunk-VMKPVSFP.mjs} +144 -32
  62. package/dist/better-auth/index.js +181 -46
  63. package/dist/better-auth/index.mjs +3 -3
  64. package/dist/better-auth/utils/createAutumnEndpoint.js +38 -15
  65. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  66. package/dist/better-auth/utils/handleBetterAuthRoute.js +181 -46
  67. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  68. package/dist/better-auth/utils/index.js +181 -46
  69. package/dist/better-auth/utils/index.mjs +3 -3
  70. package/dist/react/AutumnContext.d.mts +3 -3
  71. package/dist/react/AutumnContext.d.ts +3 -3
  72. package/dist/react/client/AutumnClient.d.mts +3 -3
  73. package/dist/react/client/AutumnClient.d.ts +3 -3
  74. package/dist/react/client/IAutumnClient.d.mts +12 -3
  75. package/dist/react/client/IAutumnClient.d.ts +12 -3
  76. package/dist/react/client/index.d.mts +3 -3
  77. package/dist/react/client/index.d.ts +3 -3
  78. package/dist/react/{customer-DjlCjlmM.d.mts → customer-BTYGVzNm.d.mts} +1 -1
  79. package/dist/react/{customer-CzMuZp8W.d.ts → customer-zogPdrbc.d.ts} +1 -1
  80. package/dist/react/hooks/index.d.mts +3 -3
  81. package/dist/react/hooks/index.d.ts +3 -3
  82. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
  83. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
  84. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
  85. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
  86. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
  87. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
  88. package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
  89. package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
  90. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
  91. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
  92. package/dist/react/hooks/internal/useCustomerActions.d.mts +3 -3
  93. package/dist/react/hooks/internal/useCustomerActions.d.ts +3 -3
  94. package/dist/react/hooks/useAggregateEvents.d.mts +2 -2
  95. package/dist/react/hooks/useAggregateEvents.d.ts +2 -2
  96. package/dist/react/hooks/useCustomer.d.mts +3 -3
  97. package/dist/react/hooks/useCustomer.d.ts +3 -3
  98. package/dist/react/hooks/useEntity.d.mts +2 -2
  99. package/dist/react/hooks/useEntity.d.ts +2 -2
  100. package/dist/react/hooks/useListEvents.d.mts +2 -2
  101. package/dist/react/hooks/useListEvents.d.ts +2 -2
  102. package/dist/react/hooks/useListPlans.d.mts +2 -2
  103. package/dist/react/hooks/useListPlans.d.ts +2 -2
  104. package/dist/react/hooks/useReferrals.d.mts +2 -2
  105. package/dist/react/hooks/useReferrals.d.ts +2 -2
  106. package/dist/react/index.d.mts +3 -3
  107. package/dist/react/index.d.ts +3 -3
  108. package/dist/react/{params-BUQLwLrI.d.mts → params-BWA6FFXs.d.ts} +125 -2
  109. package/dist/react/{params-dYykqsvL.d.ts → params-Es9pSv7h.d.mts} +125 -2
  110. package/dist/react/{plan-DSTBzzTY.d.mts → plan-DYHM9lBi.d.mts} +9 -0
  111. package/dist/react/{plan-DSTBzzTY.d.ts → plan-DYHM9lBi.d.ts} +9 -0
  112. package/dist/sdk/index.d.mts +244 -5
  113. package/dist/sdk/index.d.ts +244 -5
  114. package/dist/sdk/index.js +175 -31
  115. package/dist/sdk/index.mjs +144 -32
  116. package/package.json +1 -1
  117. package/dist/backend/{chunk-S5HPMJ4U.mjs → chunk-55C2WWXQ.mjs} +3 -3
@@ -1,27 +1,27 @@
1
1
  import "./chunk-WYDGEDEU.mjs";
2
2
  import "./chunk-VXND2UDT.mjs";
3
- import "./chunk-73KXFYFC.mjs";
3
+ import "./chunk-RKIVVLR3.mjs";
4
4
  import {
5
5
  createCoreHandler
6
- } from "./chunk-H6KJYTJY.mjs";
6
+ } from "./chunk-W5UYBM7S.mjs";
7
+ import "./chunk-T4ZAR3BE.mjs";
8
+ import "./chunk-55C2WWXQ.mjs";
9
+ import "./chunk-TBQ27LIK.mjs";
10
+ import "./chunk-J44WR3QZ.mjs";
7
11
  import "./chunk-TSF4YCUO.mjs";
8
12
  import {
9
13
  buildRouter
10
14
  } from "./chunk-UAR3TMWI.mjs";
11
- import "./chunk-GKYVE5XN.mjs";
12
15
  import {
13
16
  routeConfigs
14
- } from "./chunk-NSHGFU5H.mjs";
15
- import "./chunk-S5HPMJ4U.mjs";
17
+ } from "./chunk-VHEQZSCT.mjs";
16
18
  import "./chunk-OTXV5FY7.mjs";
17
- import {
18
- sanitizeBody
19
- } from "./chunk-Z6QP3YEA.mjs";
20
19
  import {
21
20
  secretKeyCheck
22
21
  } from "./chunk-VZIMT7AO.mjs";
23
- import "./chunk-TBQ27LIK.mjs";
24
- import "./chunk-J44WR3QZ.mjs";
22
+ import {
23
+ sanitizeBody
24
+ } from "./chunk-Z6QP3YEA.mjs";
25
25
  import {
26
26
  backendError,
27
27
  backendSuccess,
@@ -172,7 +172,7 @@ type EventsAggregateParams = {
172
172
  */
173
173
  featureId: string | Array<string>;
174
174
  /**
175
- * Property to group events by (e.g. "properties.region"), or "$customer_id" / "$entity_id" to group by those columns
175
+ * Property to group events by (e.g. "properties.region"), or "$customer_id" / "$entity_id" / "$plan_id" to group by those columns
176
176
  */
177
177
  groupBy?: string | undefined;
178
178
  /**
@@ -760,6 +760,17 @@ declare const AttachDurationType: {
760
760
  * Unit of time for the trial ('day', 'month', 'year').
761
761
  */
762
762
  type AttachDurationType = ClosedEnum<typeof AttachDurationType>;
763
+ /**
764
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
765
+ */
766
+ declare const AttachOnEnd: {
767
+ readonly Bill: "bill";
768
+ readonly Revert: "revert";
769
+ };
770
+ /**
771
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
772
+ */
773
+ type AttachOnEnd = ClosedEnum<typeof AttachOnEnd>;
763
774
  /**
764
775
  * Free trial configuration for a plan.
765
776
  */
@@ -776,6 +787,10 @@ type AttachFreeTrialParams = {
776
787
  * If true, payment method required to start trial. Customer is charged after trial ends.
777
788
  */
778
789
  cardRequired?: boolean | undefined;
790
+ /**
791
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
792
+ */
793
+ onEnd?: AttachOnEnd | undefined;
779
794
  };
780
795
  /**
781
796
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -1845,6 +1860,17 @@ declare const BillingUpdateDurationType: {
1845
1860
  * Unit of time for the trial ('day', 'month', 'year').
1846
1861
  */
1847
1862
  type BillingUpdateDurationType = ClosedEnum<typeof BillingUpdateDurationType>;
1863
+ /**
1864
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
1865
+ */
1866
+ declare const BillingUpdateOnEnd: {
1867
+ readonly Bill: "bill";
1868
+ readonly Revert: "revert";
1869
+ };
1870
+ /**
1871
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
1872
+ */
1873
+ type BillingUpdateOnEnd = ClosedEnum<typeof BillingUpdateOnEnd>;
1848
1874
  /**
1849
1875
  * Free trial configuration for a plan.
1850
1876
  */
@@ -1861,6 +1887,10 @@ type BillingUpdateFreeTrialParams = {
1861
1887
  * If true, payment method required to start trial. Customer is charged after trial ends.
1862
1888
  */
1863
1889
  cardRequired?: boolean | undefined;
1890
+ /**
1891
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
1892
+ */
1893
+ onEnd?: BillingUpdateOnEnd | undefined;
1864
1894
  };
1865
1895
  /**
1866
1896
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -2422,6 +2452,11 @@ declare const FreeTrialDuration2: {
2422
2452
  * The duration type of the free trial
2423
2453
  */
2424
2454
  type FreeTrialDuration2 = OpenEnum<typeof FreeTrialDuration2>;
2455
+ declare const CheckOnEnd2: {
2456
+ readonly Bill: "bill";
2457
+ readonly Revert: "revert";
2458
+ };
2459
+ type CheckOnEnd2 = OpenEnum<typeof CheckOnEnd2>;
2425
2460
  type CheckFreeTrial2 = {
2426
2461
  /**
2427
2462
  * The duration type of the free trial
@@ -2439,6 +2474,10 @@ type CheckFreeTrial2 = {
2439
2474
  * Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file.
2440
2475
  */
2441
2476
  cardRequired: boolean;
2477
+ /**
2478
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
2479
+ */
2480
+ onEnd?: CheckOnEnd2 | null | undefined;
2442
2481
  /**
2443
2482
  * Used in customer context. Whether the free trial is available for the customer if they were to attach the product.
2444
2483
  */
@@ -2878,6 +2917,11 @@ declare const FreeTrialDuration1: {
2878
2917
  * The duration type of the free trial
2879
2918
  */
2880
2919
  type FreeTrialDuration1 = OpenEnum<typeof FreeTrialDuration1>;
2920
+ declare const CheckOnEnd1: {
2921
+ readonly Bill: "bill";
2922
+ readonly Revert: "revert";
2923
+ };
2924
+ type CheckOnEnd1 = OpenEnum<typeof CheckOnEnd1>;
2881
2925
  type CheckFreeTrial1 = {
2882
2926
  /**
2883
2927
  * The duration type of the free trial
@@ -2895,6 +2939,10 @@ type CheckFreeTrial1 = {
2895
2939
  * Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file.
2896
2940
  */
2897
2941
  cardRequired: boolean;
2942
+ /**
2943
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
2944
+ */
2945
+ onEnd?: CheckOnEnd1 | null | undefined;
2898
2946
  /**
2899
2947
  * Used in customer context. Whether the free trial is available for the customer if they were to attach the product.
2900
2948
  */
@@ -3639,6 +3687,11 @@ declare const PlanDurationType: {
3639
3687
  * Unit of time for the trial duration ('day', 'month', 'year').
3640
3688
  */
3641
3689
  type PlanDurationType = OpenEnum<typeof PlanDurationType>;
3690
+ declare const OnEnd: {
3691
+ readonly Bill: "bill";
3692
+ readonly Revert: "revert";
3693
+ };
3694
+ type OnEnd = OpenEnum<typeof OnEnd>;
3642
3695
  /**
3643
3696
  * Free trial configuration. If set, new customers can try this plan before being charged.
3644
3697
  */
@@ -3655,6 +3708,10 @@ type FreeTrial = {
3655
3708
  * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
3656
3709
  */
3657
3710
  cardRequired: boolean;
3711
+ /**
3712
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
3713
+ */
3714
+ onEnd?: OnEnd | null | undefined;
3658
3715
  };
3659
3716
  /**
3660
3717
  * Environment this plan belongs to ('sandbox' or 'live').
@@ -4619,6 +4676,17 @@ declare const CreatePlanDurationTypeRequest: {
4619
4676
  * Unit of time for the trial ('day', 'month', 'year').
4620
4677
  */
4621
4678
  type CreatePlanDurationTypeRequest = ClosedEnum<typeof CreatePlanDurationTypeRequest>;
4679
+ /**
4680
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
4681
+ */
4682
+ declare const CreatePlanOnEndRequest: {
4683
+ readonly Bill: "bill";
4684
+ readonly Revert: "revert";
4685
+ };
4686
+ /**
4687
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
4688
+ */
4689
+ type CreatePlanOnEndRequest = ClosedEnum<typeof CreatePlanOnEndRequest>;
4622
4690
  /**
4623
4691
  * Free trial configuration. Customers can try this plan before being charged.
4624
4692
  */
@@ -4635,6 +4703,10 @@ type FreeTrialRequest = {
4635
4703
  * If true, payment method required to start trial. Customer is charged after trial ends.
4636
4704
  */
4637
4705
  cardRequired?: boolean | undefined;
4706
+ /**
4707
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
4708
+ */
4709
+ onEnd?: CreatePlanOnEndRequest | undefined;
4638
4710
  };
4639
4711
  /**
4640
4712
  * Miscellaneous plan-level configuration flags.
@@ -4978,6 +5050,11 @@ declare const CreatePlanDurationTypeResponse: {
4978
5050
  * Unit of time for the trial duration ('day', 'month', 'year').
4979
5051
  */
4980
5052
  type CreatePlanDurationTypeResponse = OpenEnum<typeof CreatePlanDurationTypeResponse>;
5053
+ declare const CreatePlanOnEndResponse: {
5054
+ readonly Bill: "bill";
5055
+ readonly Revert: "revert";
5056
+ };
5057
+ type CreatePlanOnEndResponse = OpenEnum<typeof CreatePlanOnEndResponse>;
4981
5058
  /**
4982
5059
  * Free trial configuration. If set, new customers can try this plan before being charged.
4983
5060
  */
@@ -4994,6 +5071,10 @@ type CreatePlanFreeTrialResponse = {
4994
5071
  * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
4995
5072
  */
4996
5073
  cardRequired: boolean;
5074
+ /**
5075
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5076
+ */
5077
+ onEnd?: CreatePlanOnEndResponse | null | undefined;
4997
5078
  };
4998
5079
  /**
4999
5080
  * Environment this plan belongs to ('sandbox' or 'live').
@@ -7931,6 +8012,11 @@ declare const GetPlanDurationType: {
7931
8012
  * Unit of time for the trial duration ('day', 'month', 'year').
7932
8013
  */
7933
8014
  type GetPlanDurationType = OpenEnum<typeof GetPlanDurationType>;
8015
+ declare const GetPlanOnEnd: {
8016
+ readonly Bill: "bill";
8017
+ readonly Revert: "revert";
8018
+ };
8019
+ type GetPlanOnEnd = OpenEnum<typeof GetPlanOnEnd>;
7934
8020
  /**
7935
8021
  * Free trial configuration. If set, new customers can try this plan before being charged.
7936
8022
  */
@@ -7947,6 +8033,10 @@ type GetPlanFreeTrial = {
7947
8033
  * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
7948
8034
  */
7949
8035
  cardRequired: boolean;
8036
+ /**
8037
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
8038
+ */
8039
+ onEnd?: GetPlanOnEnd | null | undefined;
7950
8040
  };
7951
8041
  /**
7952
8042
  * Environment this plan belongs to ('sandbox' or 'live').
@@ -9648,6 +9738,11 @@ declare const ListPlansDurationType: {
9648
9738
  * Unit of time for the trial duration ('day', 'month', 'year').
9649
9739
  */
9650
9740
  type ListPlansDurationType = OpenEnum<typeof ListPlansDurationType>;
9741
+ declare const ListPlansOnEnd: {
9742
+ readonly Bill: "bill";
9743
+ readonly Revert: "revert";
9744
+ };
9745
+ type ListPlansOnEnd = OpenEnum<typeof ListPlansOnEnd>;
9651
9746
  /**
9652
9747
  * Free trial configuration. If set, new customers can try this plan before being charged.
9653
9748
  */
@@ -9664,6 +9759,10 @@ type ListPlansFreeTrial = {
9664
9759
  * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
9665
9760
  */
9666
9761
  cardRequired: boolean;
9762
+ /**
9763
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
9764
+ */
9765
+ onEnd?: ListPlansOnEnd | null | undefined;
9667
9766
  };
9668
9767
  /**
9669
9768
  * Environment this plan belongs to ('sandbox' or 'live').
@@ -10107,6 +10206,17 @@ declare const MultiAttachDurationType: {
10107
10206
  * Unit of time for the trial ('day', 'month', 'year').
10108
10207
  */
10109
10208
  type MultiAttachDurationType = ClosedEnum<typeof MultiAttachDurationType>;
10209
+ /**
10210
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
10211
+ */
10212
+ declare const MultiAttachOnEnd: {
10213
+ readonly Bill: "bill";
10214
+ readonly Revert: "revert";
10215
+ };
10216
+ /**
10217
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
10218
+ */
10219
+ type MultiAttachOnEnd = ClosedEnum<typeof MultiAttachOnEnd>;
10110
10220
  /**
10111
10221
  * Free trial configuration for a plan.
10112
10222
  */
@@ -10123,6 +10233,10 @@ type MultiAttachFreeTrialParams = {
10123
10233
  * If true, payment method required to start trial. Customer is charged after trial ends.
10124
10234
  */
10125
10235
  cardRequired?: boolean | undefined;
10236
+ /**
10237
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
10238
+ */
10239
+ onEnd?: MultiAttachOnEnd | undefined;
10126
10240
  };
10127
10241
  /**
10128
10242
  * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.
@@ -10929,6 +11043,17 @@ declare const PreviewAttachDurationType: {
10929
11043
  * Unit of time for the trial ('day', 'month', 'year').
10930
11044
  */
10931
11045
  type PreviewAttachDurationType = ClosedEnum<typeof PreviewAttachDurationType>;
11046
+ /**
11047
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11048
+ */
11049
+ declare const PreviewAttachOnEnd: {
11050
+ readonly Bill: "bill";
11051
+ readonly Revert: "revert";
11052
+ };
11053
+ /**
11054
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11055
+ */
11056
+ type PreviewAttachOnEnd = ClosedEnum<typeof PreviewAttachOnEnd>;
10932
11057
  /**
10933
11058
  * Free trial configuration for a plan.
10934
11059
  */
@@ -10945,6 +11070,10 @@ type PreviewAttachFreeTrialParams = {
10945
11070
  * If true, payment method required to start trial. Customer is charged after trial ends.
10946
11071
  */
10947
11072
  cardRequired?: boolean | undefined;
11073
+ /**
11074
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11075
+ */
11076
+ onEnd?: PreviewAttachOnEnd | undefined;
10948
11077
  };
10949
11078
  /**
10950
11079
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -11824,6 +11953,17 @@ declare const PreviewMultiAttachDurationType: {
11824
11953
  * Unit of time for the trial ('day', 'month', 'year').
11825
11954
  */
11826
11955
  type PreviewMultiAttachDurationType = ClosedEnum<typeof PreviewMultiAttachDurationType>;
11956
+ /**
11957
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11958
+ */
11959
+ declare const PreviewMultiAttachOnEnd: {
11960
+ readonly Bill: "bill";
11961
+ readonly Revert: "revert";
11962
+ };
11963
+ /**
11964
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11965
+ */
11966
+ type PreviewMultiAttachOnEnd = ClosedEnum<typeof PreviewMultiAttachOnEnd>;
11827
11967
  /**
11828
11968
  * Free trial configuration for a plan.
11829
11969
  */
@@ -11840,6 +11980,10 @@ type PreviewMultiAttachFreeTrialParams = {
11840
11980
  * If true, payment method required to start trial. Customer is charged after trial ends.
11841
11981
  */
11842
11982
  cardRequired?: boolean | undefined;
11983
+ /**
11984
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
11985
+ */
11986
+ onEnd?: PreviewMultiAttachOnEnd | undefined;
11843
11987
  };
11844
11988
  /**
11845
11989
  * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.
@@ -12887,6 +13031,17 @@ declare const PreviewUpdateDurationType: {
12887
13031
  * Unit of time for the trial ('day', 'month', 'year').
12888
13032
  */
12889
13033
  type PreviewUpdateDurationType = ClosedEnum<typeof PreviewUpdateDurationType>;
13034
+ /**
13035
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
13036
+ */
13037
+ declare const PreviewUpdateOnEnd: {
13038
+ readonly Bill: "bill";
13039
+ readonly Revert: "revert";
13040
+ };
13041
+ /**
13042
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
13043
+ */
13044
+ type PreviewUpdateOnEnd = ClosedEnum<typeof PreviewUpdateOnEnd>;
12890
13045
  /**
12891
13046
  * Free trial configuration for a plan.
12892
13047
  */
@@ -12903,6 +13058,10 @@ type PreviewUpdateFreeTrialParams = {
12903
13058
  * If true, payment method required to start trial. Customer is charged after trial ends.
12904
13059
  */
12905
13060
  cardRequired?: boolean | undefined;
13061
+ /**
13062
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
13063
+ */
13064
+ onEnd?: PreviewUpdateOnEnd | undefined;
12906
13065
  };
12907
13066
  /**
12908
13067
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -13954,6 +14113,17 @@ declare const SetupPaymentDurationType: {
13954
14113
  * Unit of time for the trial ('day', 'month', 'year').
13955
14114
  */
13956
14115
  type SetupPaymentDurationType = ClosedEnum<typeof SetupPaymentDurationType>;
14116
+ /**
14117
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
14118
+ */
14119
+ declare const SetupPaymentOnEnd: {
14120
+ readonly Bill: "bill";
14121
+ readonly Revert: "revert";
14122
+ };
14123
+ /**
14124
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
14125
+ */
14126
+ type SetupPaymentOnEnd = ClosedEnum<typeof SetupPaymentOnEnd>;
13957
14127
  /**
13958
14128
  * Free trial configuration for a plan.
13959
14129
  */
@@ -13970,6 +14140,10 @@ type SetupPaymentFreeTrialParams = {
13970
14140
  * If true, payment method required to start trial. Customer is charged after trial ends.
13971
14141
  */
13972
14142
  cardRequired?: boolean | undefined;
14143
+ /**
14144
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
14145
+ */
14146
+ onEnd?: SetupPaymentOnEnd | undefined;
13973
14147
  };
13974
14148
  /**
13975
14149
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -15944,6 +16118,17 @@ declare const UpdatePlanDurationTypeRequest: {
15944
16118
  * Unit of time for the trial ('day', 'month', 'year').
15945
16119
  */
15946
16120
  type UpdatePlanDurationTypeRequest = ClosedEnum<typeof UpdatePlanDurationTypeRequest>;
16121
+ /**
16122
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
16123
+ */
16124
+ declare const UpdatePlanOnEndRequest: {
16125
+ readonly Bill: "bill";
16126
+ readonly Revert: "revert";
16127
+ };
16128
+ /**
16129
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
16130
+ */
16131
+ type UpdatePlanOnEndRequest = ClosedEnum<typeof UpdatePlanOnEndRequest>;
15947
16132
  /**
15948
16133
  * Free trial configuration for a plan.
15949
16134
  */
@@ -15960,6 +16145,10 @@ type UpdatePlanFreeTrialParams = {
15960
16145
  * If true, payment method required to start trial. Customer is charged after trial ends.
15961
16146
  */
15962
16147
  cardRequired?: boolean | undefined;
16148
+ /**
16149
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
16150
+ */
16151
+ onEnd?: UpdatePlanOnEndRequest | undefined;
15963
16152
  };
15964
16153
  /**
15965
16154
  * Miscellaneous plan-level configuration flags.
@@ -16306,6 +16495,11 @@ declare const UpdatePlanDurationTypeResponse: {
16306
16495
  * Unit of time for the trial duration ('day', 'month', 'year').
16307
16496
  */
16308
16497
  type UpdatePlanDurationTypeResponse = OpenEnum<typeof UpdatePlanDurationTypeResponse>;
16498
+ declare const UpdatePlanOnEndResponse: {
16499
+ readonly Bill: "bill";
16500
+ readonly Revert: "revert";
16501
+ };
16502
+ type UpdatePlanOnEndResponse = OpenEnum<typeof UpdatePlanOnEndResponse>;
16309
16503
  /**
16310
16504
  * Free trial configuration. If set, new customers can try this plan before being charged.
16311
16505
  */
@@ -16322,6 +16516,10 @@ type UpdatePlanFreeTrial = {
16322
16516
  * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
16323
16517
  */
16324
16518
  cardRequired: boolean;
16519
+ /**
16520
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
16521
+ */
16522
+ onEnd?: UpdatePlanOnEndResponse | null | undefined;
16325
16523
  };
16326
16524
  /**
16327
16525
  * Environment this plan belongs to ('sandbox' or 'live').
@@ -16707,7 +16905,7 @@ declare class Billing extends ClientSDK {
16707
16905
  * @example
16708
16906
  * ```typescript
16709
16907
  * // Schedule a transition from a trial plan to a paid plan
16710
- * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778684108513,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779893708513,"plans":[{"planId":"pro_plan"}]}] });
16908
+ * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778871536585,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780081136585,"plans":[{"planId":"pro_plan"}]}] });
16711
16909
  * ```
16712
16910
  *
16713
16911
  * @param customerId - The ID of the customer to create the schedule for.