autumn-js 1.2.11 → 1.2.13

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 (159) hide show
  1. package/dist/backend/adapters/express.js +143 -4
  2. package/dist/backend/adapters/express.mjs +8 -8
  3. package/dist/backend/adapters/fetch.js +143 -4
  4. package/dist/backend/adapters/fetch.mjs +8 -8
  5. package/dist/backend/adapters/hono.js +143 -4
  6. package/dist/backend/adapters/hono.mjs +8 -8
  7. package/dist/backend/adapters/index.js +143 -4
  8. package/dist/backend/adapters/index.mjs +11 -11
  9. package/dist/backend/adapters/next.js +143 -4
  10. package/dist/backend/adapters/next.mjs +8 -8
  11. package/dist/backend/{chunk-WMGBAAJK.mjs → chunk-7BVATYGA.mjs} +1 -1
  12. package/dist/backend/{chunk-4RBWBJIF.mjs → chunk-DNNJOZAT.mjs} +1 -1
  13. package/dist/backend/{chunk-SKWVW2EN.mjs → chunk-EJGHP7KT.mjs} +5 -5
  14. package/dist/backend/{chunk-FPZHAFCV.mjs → chunk-MANTLPDT.mjs} +24 -0
  15. package/dist/backend/{chunk-JEVAYQ65.mjs → chunk-OUDB34Y7.mjs} +1 -1
  16. package/dist/backend/{chunk-MBL56SEJ.mjs → chunk-RPH5L44S.mjs} +1 -1
  17. package/dist/backend/{chunk-AY6OV7CM.mjs → chunk-T42RZEUZ.mjs} +119 -4
  18. package/dist/backend/{chunk-JMDETKOQ.mjs → chunk-YSQQKZBU.mjs} +7 -7
  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 +143 -4
  22. package/dist/backend/core/handlers/coreHandler.mjs +6 -6
  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 +3 -3
  26. package/dist/backend/core/handlers/handleRouteByName.js +143 -4
  27. package/dist/backend/core/handlers/handleRouteByName.mjs +6 -6
  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 +143 -4
  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 +143 -4
  35. package/dist/backend/core/index.mjs +7 -7
  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 +24 -0
  39. package/dist/backend/core/routes/index.mjs +1 -1
  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 +24 -0
  45. package/dist/backend/core/routes/routeConfigs.mjs +1 -1
  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/index.d.mts +2 -2
  53. package/dist/backend/index.d.ts +2 -2
  54. package/dist/backend/index.js +143 -4
  55. package/dist/backend/index.mjs +7 -7
  56. package/dist/backend/{routeTypes-D7ANq7kY.d.ts → routeTypes-B94_Mq2J.d.ts} +129 -0
  57. package/dist/backend/{routeTypes-CQWFgZk4.d.mts → routeTypes-DVwngaBn.d.mts} +129 -0
  58. package/dist/better-auth/{chunk-3GVPOBXE.mjs → chunk-4OWECHZC.mjs} +1 -1
  59. package/dist/better-auth/{chunk-WEDJRTA3.mjs → chunk-JIFD4TSN.mjs} +24 -0
  60. package/dist/better-auth/{chunk-XH3WDFWS.mjs → chunk-ZZGFPTHO.mjs} +120 -5
  61. package/dist/better-auth/client.d.mts +3 -7
  62. package/dist/better-auth/client.d.ts +3 -7
  63. package/dist/better-auth/createAutumnEndpoint-CvXRCg-M.d.mts +43 -0
  64. package/dist/better-auth/createAutumnEndpoint-CvXRCg-M.d.ts +43 -0
  65. package/dist/better-auth/index.d.mts +3 -7
  66. package/dist/better-auth/index.d.ts +3 -7
  67. package/dist/better-auth/index.js +143 -4
  68. package/dist/better-auth/index.mjs +3 -3
  69. package/dist/better-auth/utils/createAutumnEndpoint.d.mts +3 -7
  70. package/dist/better-auth/utils/createAutumnEndpoint.d.ts +3 -7
  71. package/dist/better-auth/utils/createAutumnEndpoint.js +24 -0
  72. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  73. package/dist/better-auth/utils/handleBetterAuthRoute.d.mts +3 -7
  74. package/dist/better-auth/utils/handleBetterAuthRoute.d.ts +3 -7
  75. package/dist/better-auth/utils/handleBetterAuthRoute.js +143 -4
  76. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  77. package/dist/better-auth/utils/index.d.mts +3 -8
  78. package/dist/better-auth/utils/index.d.ts +3 -8
  79. package/dist/better-auth/utils/index.js +143 -4
  80. package/dist/better-auth/utils/index.mjs +3 -3
  81. package/dist/react/AutumnContext.d.mts +3 -3
  82. package/dist/react/AutumnContext.d.ts +3 -3
  83. package/dist/react/AutumnProvider.js +15 -15
  84. package/dist/react/AutumnProvider.mjs +2 -2
  85. package/dist/react/{chunk-26CKSAPZ.mjs → chunk-7IDH4OMG.mjs} +1 -1
  86. package/dist/react/{chunk-HSQUB3BZ.mjs → chunk-BDG6JHEW.mjs} +1 -1
  87. package/dist/react/{chunk-KB72KQKN.mjs → chunk-DEZBJQEG.mjs} +1 -1
  88. package/dist/react/{chunk-XJZH5NMZ.mjs → chunk-E5ZHOMZ4.mjs} +23 -23
  89. package/dist/react/{chunk-OXQG65ZT.mjs → chunk-FWWIAOPU.mjs} +1 -1
  90. package/dist/react/{chunk-ZGPE4R6H.mjs → chunk-HVBDZARN.mjs} +2 -2
  91. package/dist/react/{chunk-MC2YYATT.mjs → chunk-J6SLKTKE.mjs} +1 -1
  92. package/dist/react/{chunk-CHU7CIWP.mjs → chunk-NSFHAUTD.mjs} +1 -1
  93. package/dist/react/{chunk-G7FTQLT7.mjs → chunk-YQFYWH7J.mjs} +1 -1
  94. package/dist/react/client/AutumnClient.d.mts +3 -3
  95. package/dist/react/client/AutumnClient.d.ts +3 -3
  96. package/dist/react/client/IAutumnClient.d.mts +16 -3
  97. package/dist/react/client/IAutumnClient.d.ts +16 -3
  98. package/dist/react/client/index.d.mts +3 -3
  99. package/dist/react/client/index.d.ts +3 -3
  100. package/dist/react/{customer-CbcVyRCQ.d.ts → customer-CaGJEN5J.d.ts} +1 -1
  101. package/dist/react/{customer-BYYt9N1h.d.mts → customer-DB8vL_m7.d.mts} +1 -1
  102. package/dist/react/hooks/index.d.mts +3 -3
  103. package/dist/react/hooks/index.d.ts +3 -3
  104. package/dist/react/hooks/index.js +16 -16
  105. package/dist/react/hooks/index.mjs +8 -8
  106. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
  107. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
  108. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
  109. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
  110. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
  111. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
  112. package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
  113. package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
  114. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
  115. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
  116. package/dist/react/hooks/internal/useCustomerActions.d.mts +3 -3
  117. package/dist/react/hooks/internal/useCustomerActions.d.ts +3 -3
  118. package/dist/react/hooks/internal/useCustomerActions.js +1 -1
  119. package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
  120. package/dist/react/hooks/useAggregateEvents.d.mts +2 -2
  121. package/dist/react/hooks/useAggregateEvents.d.ts +2 -2
  122. package/dist/react/hooks/useAggregateEvents.js +16 -16
  123. package/dist/react/hooks/useAggregateEvents.mjs +2 -2
  124. package/dist/react/hooks/useCustomer.d.mts +3 -3
  125. package/dist/react/hooks/useCustomer.d.ts +3 -3
  126. package/dist/react/hooks/useCustomer.js +16 -16
  127. package/dist/react/hooks/useCustomer.mjs +3 -3
  128. package/dist/react/hooks/useEntity.d.mts +2 -2
  129. package/dist/react/hooks/useEntity.d.ts +2 -2
  130. package/dist/react/hooks/useEntity.js +16 -16
  131. package/dist/react/hooks/useEntity.mjs +2 -2
  132. package/dist/react/hooks/useListEvents.d.mts +2 -2
  133. package/dist/react/hooks/useListEvents.d.ts +2 -2
  134. package/dist/react/hooks/useListEvents.js +16 -16
  135. package/dist/react/hooks/useListEvents.mjs +2 -2
  136. package/dist/react/hooks/useListPlans.d.mts +2 -2
  137. package/dist/react/hooks/useListPlans.d.ts +2 -2
  138. package/dist/react/hooks/useListPlans.js +16 -16
  139. package/dist/react/hooks/useListPlans.mjs +2 -2
  140. package/dist/react/hooks/useReferrals.d.mts +2 -2
  141. package/dist/react/hooks/useReferrals.d.ts +2 -2
  142. package/dist/react/hooks/useReferrals.js +16 -16
  143. package/dist/react/hooks/useReferrals.mjs +2 -2
  144. package/dist/react/index.d.mts +3 -3
  145. package/dist/react/index.d.ts +3 -3
  146. package/dist/react/index.js +22 -22
  147. package/dist/react/index.mjs +9 -9
  148. package/dist/react/{params-5jUgYeHh.d.mts → params-B5l9vHfZ.d.ts} +35 -1
  149. package/dist/react/{params-g4jEwMY7.d.ts → params-BVglT8vT.d.mts} +35 -1
  150. package/dist/react/{plan-CqxFGNk2.d.mts → plan-DSTBzzTY.d.mts} +13 -0
  151. package/dist/react/{plan-CqxFGNk2.d.ts → plan-DSTBzzTY.d.ts} +13 -0
  152. package/dist/sdk/index.d.mts +179 -1
  153. package/dist/sdk/index.d.ts +179 -1
  154. package/dist/sdk/index.js +196 -4
  155. package/dist/sdk/index.mjs +179 -5
  156. package/package.json +1 -1
  157. package/dist/better-auth/createAutumnEndpoint-D9Plymvy.d.mts +0 -309
  158. package/dist/better-auth/createAutumnEndpoint-D9Plymvy.d.ts +0 -309
  159. package/dist/backend/{chunk-55C2WWXQ.mjs → chunk-S5HPMJ4U.mjs} +3 -3
package/dist/sdk/index.js CHANGED
@@ -2427,6 +2427,25 @@ function billingUpdateInvoiceModeToJSON(billingUpdateInvoiceMode) {
2427
2427
  }
2428
2428
  var BillingUpdateProrationBehavior$outboundSchema = z39__namespace.enum(BillingUpdateProrationBehavior);
2429
2429
  var BillingUpdateRedirectMode$outboundSchema = z39__namespace.enum(BillingUpdateRedirectMode);
2430
+ var BillingUpdateAttachDiscount$outboundSchema = z39__namespace.pipe(
2431
+ z39__namespace.object({
2432
+ rewardId: z39__namespace.optional(z39__namespace.string()),
2433
+ promotionCode: z39__namespace.optional(z39__namespace.string())
2434
+ }),
2435
+ z39__namespace.transform((v) => {
2436
+ return remap(v, {
2437
+ rewardId: "reward_id",
2438
+ promotionCode: "promotion_code"
2439
+ });
2440
+ })
2441
+ );
2442
+ function billingUpdateAttachDiscountToJSON(billingUpdateAttachDiscount) {
2443
+ return JSON.stringify(
2444
+ BillingUpdateAttachDiscount$outboundSchema.parse(
2445
+ billingUpdateAttachDiscount
2446
+ )
2447
+ );
2448
+ }
2430
2449
  var BillingUpdateCancelAction$outboundSchema = z39__namespace.enum(BillingUpdateCancelAction);
2431
2450
  var BillingUpdateRecalculateBalances$outboundSchema = z39__namespace.object({
2432
2451
  enabled: z39__namespace.boolean()
@@ -2459,6 +2478,9 @@ var UpdateSubscriptionParams$outboundSchema = z39__namespace.pipe(
2459
2478
  "if_required"
2460
2479
  ),
2461
2480
  subscriptionId: z39__namespace.optional(z39__namespace.string()),
2481
+ discounts: z39__namespace.optional(
2482
+ z39__namespace.array(z39__namespace.lazy(() => BillingUpdateAttachDiscount$outboundSchema))
2483
+ ),
2462
2484
  cancelAction: z39__namespace.optional(BillingUpdateCancelAction$outboundSchema),
2463
2485
  billingCycleAnchor: z39__namespace.optional(z39__namespace.literal("now")),
2464
2486
  noBillingChanges: z39__namespace.optional(z39__namespace.boolean()),
@@ -3576,6 +3598,23 @@ function freeTrialFromJSON(jsonString) {
3576
3598
  );
3577
3599
  }
3578
3600
  var PlanEnv$inboundSchema = inboundSchema(PlanEnv);
3601
+ var PlanConfig$inboundSchema = z39__namespace.pipe(
3602
+ z39__namespace.object({
3603
+ ignore_past_due: z39__namespace._default(boolean2(), false)
3604
+ }),
3605
+ z39__namespace.transform((v) => {
3606
+ return remap(v, {
3607
+ "ignore_past_due": "ignorePastDue"
3608
+ });
3609
+ })
3610
+ );
3611
+ function planConfigFromJSON(jsonString) {
3612
+ return safeParse(
3613
+ jsonString,
3614
+ (x) => PlanConfig$inboundSchema.parse(JSON.parse(x)),
3615
+ `Failed to parse 'PlanConfig' from JSON`
3616
+ );
3617
+ }
3579
3618
  var PlanStatus$inboundSchema = inboundSchema(PlanStatus);
3580
3619
  var AttachAction$inboundSchema = inboundSchema(AttachAction);
3581
3620
  var CustomerEligibility$inboundSchema = z39__namespace.pipe(
@@ -3616,6 +3655,7 @@ var Plan$inboundSchema = z39__namespace.pipe(
3616
3655
  env: PlanEnv$inboundSchema,
3617
3656
  archived: boolean2(),
3618
3657
  base_variant_id: nullable(string4()),
3658
+ config: z39__namespace.lazy(() => PlanConfig$inboundSchema),
3619
3659
  customer_eligibility: optional2(z39__namespace.lazy(
3620
3660
  () => CustomerEligibility$inboundSchema
3621
3661
  ))
@@ -4495,6 +4535,21 @@ function freeTrialRequestToJSON(freeTrialRequest) {
4495
4535
  FreeTrialRequest$outboundSchema.parse(freeTrialRequest)
4496
4536
  );
4497
4537
  }
4538
+ var CreatePlanConfigRequest$outboundSchema = z39__namespace.pipe(
4539
+ z39__namespace.object({
4540
+ ignorePastDue: z39__namespace._default(z39__namespace.boolean(), false)
4541
+ }),
4542
+ z39__namespace.transform((v) => {
4543
+ return remap(v, {
4544
+ ignorePastDue: "ignore_past_due"
4545
+ });
4546
+ })
4547
+ );
4548
+ function createPlanConfigRequestToJSON(createPlanConfigRequest) {
4549
+ return JSON.stringify(
4550
+ CreatePlanConfigRequest$outboundSchema.parse(createPlanConfigRequest)
4551
+ );
4552
+ }
4498
4553
  var CreatePlanParams$outboundSchema = z39__namespace.pipe(
4499
4554
  z39__namespace.object({
4500
4555
  planId: z39__namespace.string(),
@@ -4505,7 +4560,8 @@ var CreatePlanParams$outboundSchema = z39__namespace.pipe(
4505
4560
  autoEnable: z39__namespace._default(z39__namespace.boolean(), false),
4506
4561
  price: z39__namespace.optional(z39__namespace.lazy(() => CreatePlanPriceRequest$outboundSchema)),
4507
4562
  items: z39__namespace.optional(z39__namespace.array(z39__namespace.lazy(() => CreatePlanPlanItem$outboundSchema))),
4508
- freeTrial: z39__namespace.optional(z39__namespace.lazy(() => FreeTrialRequest$outboundSchema))
4563
+ freeTrial: z39__namespace.optional(z39__namespace.lazy(() => FreeTrialRequest$outboundSchema)),
4564
+ config: z39__namespace.optional(z39__namespace.lazy(() => CreatePlanConfigRequest$outboundSchema))
4509
4565
  }),
4510
4566
  z39__namespace.transform((v) => {
4511
4567
  return remap(v, {
@@ -4761,6 +4817,23 @@ function createPlanFreeTrialResponseFromJSON(jsonString) {
4761
4817
  );
4762
4818
  }
4763
4819
  var CreatePlanEnv$inboundSchema = inboundSchema(CreatePlanEnv);
4820
+ var CreatePlanConfigResponse$inboundSchema = z39__namespace.pipe(
4821
+ z39__namespace.object({
4822
+ ignore_past_due: z39__namespace._default(boolean2(), false)
4823
+ }),
4824
+ z39__namespace.transform((v) => {
4825
+ return remap(v, {
4826
+ "ignore_past_due": "ignorePastDue"
4827
+ });
4828
+ })
4829
+ );
4830
+ function createPlanConfigResponseFromJSON(jsonString) {
4831
+ return safeParse(
4832
+ jsonString,
4833
+ (x) => CreatePlanConfigResponse$inboundSchema.parse(JSON.parse(x)),
4834
+ `Failed to parse 'CreatePlanConfigResponse' from JSON`
4835
+ );
4836
+ }
4764
4837
  var CreatePlanStatus$inboundSchema = inboundSchema(CreatePlanStatus);
4765
4838
  var CreatePlanAttachAction$inboundSchema = inboundSchema(CreatePlanAttachAction);
4766
4839
  var CreatePlanCustomerEligibility$inboundSchema = z39__namespace.pipe(
@@ -4803,6 +4876,7 @@ var CreatePlanResponse$inboundSchema = z39__namespace.pipe(
4803
4876
  env: CreatePlanEnv$inboundSchema,
4804
4877
  archived: boolean2(),
4805
4878
  base_variant_id: nullable(string4()),
4879
+ config: z39__namespace.lazy(() => CreatePlanConfigResponse$inboundSchema),
4806
4880
  customer_eligibility: optional2(
4807
4881
  z39__namespace.lazy(() => CreatePlanCustomerEligibility$inboundSchema)
4808
4882
  )
@@ -6502,6 +6576,23 @@ function getPlanFreeTrialFromJSON(jsonString) {
6502
6576
  );
6503
6577
  }
6504
6578
  var GetPlanEnv$inboundSchema = inboundSchema(GetPlanEnv);
6579
+ var GetPlanConfig$inboundSchema = z39__namespace.pipe(
6580
+ z39__namespace.object({
6581
+ ignore_past_due: z39__namespace._default(boolean2(), false)
6582
+ }),
6583
+ z39__namespace.transform((v) => {
6584
+ return remap(v, {
6585
+ "ignore_past_due": "ignorePastDue"
6586
+ });
6587
+ })
6588
+ );
6589
+ function getPlanConfigFromJSON(jsonString) {
6590
+ return safeParse(
6591
+ jsonString,
6592
+ (x) => GetPlanConfig$inboundSchema.parse(JSON.parse(x)),
6593
+ `Failed to parse 'GetPlanConfig' from JSON`
6594
+ );
6595
+ }
6505
6596
  var GetPlanStatus$inboundSchema = inboundSchema(GetPlanStatus);
6506
6597
  var GetPlanAttachAction$inboundSchema = inboundSchema(GetPlanAttachAction);
6507
6598
  var GetPlanCustomerEligibility$inboundSchema = z39__namespace.pipe(
@@ -6542,6 +6633,7 @@ var GetPlanResponse$inboundSchema = z39__namespace.pipe(
6542
6633
  env: GetPlanEnv$inboundSchema,
6543
6634
  archived: boolean2(),
6544
6635
  base_variant_id: nullable(string4()),
6636
+ config: z39__namespace.lazy(() => GetPlanConfig$inboundSchema),
6545
6637
  customer_eligibility: optional2(
6546
6638
  z39__namespace.lazy(() => GetPlanCustomerEligibility$inboundSchema)
6547
6639
  )
@@ -7519,6 +7611,23 @@ function listPlansFreeTrialFromJSON(jsonString) {
7519
7611
  );
7520
7612
  }
7521
7613
  var ListPlansEnv$inboundSchema = inboundSchema(ListPlansEnv);
7614
+ var ListPlansConfig$inboundSchema = z39__namespace.pipe(
7615
+ z39__namespace.object({
7616
+ ignore_past_due: z39__namespace._default(boolean2(), false)
7617
+ }),
7618
+ z39__namespace.transform((v) => {
7619
+ return remap(v, {
7620
+ "ignore_past_due": "ignorePastDue"
7621
+ });
7622
+ })
7623
+ );
7624
+ function listPlansConfigFromJSON(jsonString) {
7625
+ return safeParse(
7626
+ jsonString,
7627
+ (x) => ListPlansConfig$inboundSchema.parse(JSON.parse(x)),
7628
+ `Failed to parse 'ListPlansConfig' from JSON`
7629
+ );
7630
+ }
7522
7631
  var ListPlansStatus$inboundSchema = inboundSchema(ListPlansStatus);
7523
7632
  var ListPlansAttachAction$inboundSchema = inboundSchema(ListPlansAttachAction);
7524
7633
  var ListPlansCustomerEligibility$inboundSchema = z39__namespace.pipe(
@@ -7559,6 +7668,7 @@ var ListPlansList$inboundSchema = z39__namespace.pipe(
7559
7668
  env: ListPlansEnv$inboundSchema,
7560
7669
  archived: boolean2(),
7561
7670
  base_variant_id: nullable(string4()),
7671
+ config: z39__namespace.lazy(() => ListPlansConfig$inboundSchema),
7562
7672
  customer_eligibility: optional2(
7563
7673
  z39__namespace.lazy(() => ListPlansCustomerEligibility$inboundSchema)
7564
7674
  )
@@ -10056,6 +10166,25 @@ function previewUpdateInvoiceModeToJSON(previewUpdateInvoiceMode) {
10056
10166
  }
10057
10167
  var PreviewUpdateProrationBehavior$outboundSchema = z39__namespace.enum(PreviewUpdateProrationBehavior);
10058
10168
  var PreviewUpdateRedirectMode$outboundSchema = z39__namespace.enum(PreviewUpdateRedirectMode);
10169
+ var PreviewUpdateAttachDiscount$outboundSchema = z39__namespace.pipe(
10170
+ z39__namespace.object({
10171
+ rewardId: z39__namespace.optional(z39__namespace.string()),
10172
+ promotionCode: z39__namespace.optional(z39__namespace.string())
10173
+ }),
10174
+ z39__namespace.transform((v) => {
10175
+ return remap(v, {
10176
+ rewardId: "reward_id",
10177
+ promotionCode: "promotion_code"
10178
+ });
10179
+ })
10180
+ );
10181
+ function previewUpdateAttachDiscountToJSON(previewUpdateAttachDiscount) {
10182
+ return JSON.stringify(
10183
+ PreviewUpdateAttachDiscount$outboundSchema.parse(
10184
+ previewUpdateAttachDiscount
10185
+ )
10186
+ );
10187
+ }
10059
10188
  var PreviewUpdateCancelAction$outboundSchema = z39__namespace.enum(PreviewUpdateCancelAction);
10060
10189
  var PreviewUpdateRecalculateBalances$outboundSchema = z39__namespace.object({
10061
10190
  enabled: z39__namespace.boolean()
@@ -10088,6 +10217,9 @@ var PreviewUpdateParams$outboundSchema = z39__namespace.pipe(
10088
10217
  "if_required"
10089
10218
  ),
10090
10219
  subscriptionId: z39__namespace.optional(z39__namespace.string()),
10220
+ discounts: z39__namespace.optional(
10221
+ z39__namespace.array(z39__namespace.lazy(() => PreviewUpdateAttachDiscount$outboundSchema))
10222
+ ),
10091
10223
  cancelAction: z39__namespace.optional(PreviewUpdateCancelAction$outboundSchema),
10092
10224
  billingCycleAnchor: z39__namespace.optional(z39__namespace.literal("now")),
10093
10225
  noBillingChanges: z39__namespace.optional(z39__namespace.boolean()),
@@ -12419,6 +12551,21 @@ function updatePlanFreeTrialParamsToJSON(updatePlanFreeTrialParams) {
12419
12551
  UpdatePlanFreeTrialParams$outboundSchema.parse(updatePlanFreeTrialParams)
12420
12552
  );
12421
12553
  }
12554
+ var UpdatePlanConfigRequest$outboundSchema = z39__namespace.pipe(
12555
+ z39__namespace.object({
12556
+ ignorePastDue: z39__namespace._default(z39__namespace.boolean(), false)
12557
+ }),
12558
+ z39__namespace.transform((v) => {
12559
+ return remap(v, {
12560
+ ignorePastDue: "ignore_past_due"
12561
+ });
12562
+ })
12563
+ );
12564
+ function updatePlanConfigRequestToJSON(updatePlanConfigRequest) {
12565
+ return JSON.stringify(
12566
+ UpdatePlanConfigRequest$outboundSchema.parse(updatePlanConfigRequest)
12567
+ );
12568
+ }
12422
12569
  var UpdatePlanParams$outboundSchema = z39__namespace.pipe(
12423
12570
  z39__namespace.object({
12424
12571
  planId: z39__namespace.string(),
@@ -12434,6 +12581,7 @@ var UpdatePlanParams$outboundSchema = z39__namespace.pipe(
12434
12581
  freeTrial: z39__namespace.optional(
12435
12582
  z39__namespace.nullable(z39__namespace.lazy(() => UpdatePlanFreeTrialParams$outboundSchema))
12436
12583
  ),
12584
+ config: z39__namespace.optional(z39__namespace.lazy(() => UpdatePlanConfigRequest$outboundSchema)),
12437
12585
  version: z39__namespace.optional(z39__namespace.number()),
12438
12586
  archived: z39__namespace._default(z39__namespace.boolean(), false),
12439
12587
  newPlanId: z39__namespace.optional(z39__namespace.string())
@@ -12693,6 +12841,23 @@ function updatePlanFreeTrialFromJSON(jsonString) {
12693
12841
  );
12694
12842
  }
12695
12843
  var UpdatePlanEnv$inboundSchema = inboundSchema(UpdatePlanEnv);
12844
+ var UpdatePlanConfigResponse$inboundSchema = z39__namespace.pipe(
12845
+ z39__namespace.object({
12846
+ ignore_past_due: z39__namespace._default(boolean2(), false)
12847
+ }),
12848
+ z39__namespace.transform((v) => {
12849
+ return remap(v, {
12850
+ "ignore_past_due": "ignorePastDue"
12851
+ });
12852
+ })
12853
+ );
12854
+ function updatePlanConfigResponseFromJSON(jsonString) {
12855
+ return safeParse(
12856
+ jsonString,
12857
+ (x) => UpdatePlanConfigResponse$inboundSchema.parse(JSON.parse(x)),
12858
+ `Failed to parse 'UpdatePlanConfigResponse' from JSON`
12859
+ );
12860
+ }
12696
12861
  var UpdatePlanStatus$inboundSchema = inboundSchema(UpdatePlanStatus);
12697
12862
  var UpdatePlanAttachAction$inboundSchema = inboundSchema(UpdatePlanAttachAction);
12698
12863
  var UpdatePlanCustomerEligibility$inboundSchema = z39__namespace.pipe(
@@ -12733,6 +12898,7 @@ var UpdatePlanResponse$inboundSchema = z39__namespace.pipe(
12733
12898
  env: UpdatePlanEnv$inboundSchema,
12734
12899
  archived: boolean2(),
12735
12900
  base_variant_id: nullable(string4()),
12901
+ config: z39__namespace.lazy(() => UpdatePlanConfigResponse$inboundSchema),
12736
12902
  customer_eligibility: optional2(
12737
12903
  z39__namespace.lazy(() => UpdatePlanCustomerEligibility$inboundSchema)
12738
12904
  )
@@ -13001,10 +13167,14 @@ var FailOpenHook = class {
13001
13167
  fetcher: async (input, init) => {
13002
13168
  try {
13003
13169
  return init == null ? await fetch(input) : await fetch(input, init);
13004
- } catch {
13170
+ } catch (error) {
13171
+ console.log(error);
13172
+ console.log(
13173
+ `Network failed to reach Autumn: ${error}. Returning 555 Network Error.`
13174
+ );
13005
13175
  return new Response(null, {
13006
- status: 503,
13007
- statusText: "Autumn Unreachable"
13176
+ status: 555,
13177
+ statusText: "Network Error"
13008
13178
  });
13009
13179
  }
13010
13180
  }
@@ -14696,6 +14866,7 @@ var Billing = class extends ClientSDK {
14696
14866
  * @param prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
14697
14867
  * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional)
14698
14868
  * @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (optional)
14869
+ * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional)
14699
14870
  * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional)
14700
14871
  * @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
14701
14872
  * @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
@@ -14731,6 +14902,7 @@ var Billing = class extends ClientSDK {
14731
14902
  * @param prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
14732
14903
  * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional)
14733
14904
  * @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (optional)
14905
+ * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional)
14734
14906
  * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional)
14735
14907
  * @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
14736
14908
  * @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
@@ -16675,6 +16847,7 @@ var Plans = class extends ClientSDK {
16675
16847
  * @param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional)
16676
16848
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
16677
16849
  * @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional)
16850
+ * @param config - Miscellaneous plan-level configuration flags. (optional)
16678
16851
  *
16679
16852
  * @returns The created plan object.
16680
16853
  */
@@ -16780,6 +16953,7 @@ var Plans = class extends ClientSDK {
16780
16953
  * @param price - The price of the plan. Set to null to remove the base price. (optional)
16781
16954
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
16782
16955
  * @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional)
16956
+ * @param config - Miscellaneous plan-level configuration flags. (optional)
16783
16957
  * @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional)
16784
16958
  *
16785
16959
  * @returns The updated plan object.
@@ -17248,6 +17422,7 @@ exports.BalanceTierBehavior = BalanceTierBehavior;
17248
17422
  exports.BalanceTierBehavior$inboundSchema = BalanceTierBehavior$inboundSchema;
17249
17423
  exports.BalanceType = BalanceType;
17250
17424
  exports.BalanceType$inboundSchema = BalanceType$inboundSchema;
17425
+ exports.BillingUpdateAttachDiscount$outboundSchema = BillingUpdateAttachDiscount$outboundSchema;
17251
17426
  exports.BillingUpdateBasePrice$outboundSchema = BillingUpdateBasePrice$outboundSchema;
17252
17427
  exports.BillingUpdateBillingMethod = BillingUpdateBillingMethod;
17253
17428
  exports.BillingUpdateBillingMethod$outboundSchema = BillingUpdateBillingMethod$outboundSchema;
@@ -17366,6 +17541,8 @@ exports.CreatePlanBillingMethodRequest = CreatePlanBillingMethodRequest;
17366
17541
  exports.CreatePlanBillingMethodRequest$outboundSchema = CreatePlanBillingMethodRequest$outboundSchema;
17367
17542
  exports.CreatePlanBillingMethodResponse = CreatePlanBillingMethodResponse;
17368
17543
  exports.CreatePlanBillingMethodResponse$inboundSchema = CreatePlanBillingMethodResponse$inboundSchema;
17544
+ exports.CreatePlanConfigRequest$outboundSchema = CreatePlanConfigRequest$outboundSchema;
17545
+ exports.CreatePlanConfigResponse$inboundSchema = CreatePlanConfigResponse$inboundSchema;
17369
17546
  exports.CreatePlanCreditSchema$inboundSchema = CreatePlanCreditSchema$inboundSchema;
17370
17547
  exports.CreatePlanCustomerEligibility$inboundSchema = CreatePlanCustomerEligibility$inboundSchema;
17371
17548
  exports.CreatePlanDurationTypeRequest = CreatePlanDurationTypeRequest;
@@ -17536,6 +17713,7 @@ exports.GetPlanAttachAction = GetPlanAttachAction;
17536
17713
  exports.GetPlanAttachAction$inboundSchema = GetPlanAttachAction$inboundSchema;
17537
17714
  exports.GetPlanBillingMethod = GetPlanBillingMethod;
17538
17715
  exports.GetPlanBillingMethod$inboundSchema = GetPlanBillingMethod$inboundSchema;
17716
+ exports.GetPlanConfig$inboundSchema = GetPlanConfig$inboundSchema;
17539
17717
  exports.GetPlanCreditSchema$inboundSchema = GetPlanCreditSchema$inboundSchema;
17540
17718
  exports.GetPlanCustomerEligibility$inboundSchema = GetPlanCustomerEligibility$inboundSchema;
17541
17719
  exports.GetPlanDurationType = GetPlanDurationType;
@@ -17619,6 +17797,7 @@ exports.ListPlansAttachAction = ListPlansAttachAction;
17619
17797
  exports.ListPlansAttachAction$inboundSchema = ListPlansAttachAction$inboundSchema;
17620
17798
  exports.ListPlansBillingMethod = ListPlansBillingMethod;
17621
17799
  exports.ListPlansBillingMethod$inboundSchema = ListPlansBillingMethod$inboundSchema;
17800
+ exports.ListPlansConfig$inboundSchema = ListPlansConfig$inboundSchema;
17622
17801
  exports.ListPlansCreditSchema$inboundSchema = ListPlansCreditSchema$inboundSchema;
17623
17802
  exports.ListPlansCustomerEligibility$inboundSchema = ListPlansCustomerEligibility$inboundSchema;
17624
17803
  exports.ListPlansDurationType = ListPlansDurationType;
@@ -17704,6 +17883,7 @@ exports.OpenCustomerPortalResponse$inboundSchema = OpenCustomerPortalResponse$in
17704
17883
  exports.Plan$inboundSchema = Plan$inboundSchema;
17705
17884
  exports.PlanBillingMethod = PlanBillingMethod;
17706
17885
  exports.PlanBillingMethod$inboundSchema = PlanBillingMethod$inboundSchema;
17886
+ exports.PlanConfig$inboundSchema = PlanConfig$inboundSchema;
17707
17887
  exports.PlanCreditSchema$inboundSchema = PlanCreditSchema$inboundSchema;
17708
17888
  exports.PlanDurationType = PlanDurationType;
17709
17889
  exports.PlanDurationType$inboundSchema = PlanDurationType$inboundSchema;
@@ -17845,6 +18025,7 @@ exports.PreviewMultiAttachTo$outboundSchema = PreviewMultiAttachTo$outboundSchem
17845
18025
  exports.PreviewMultiAttachUsageAlert$outboundSchema = PreviewMultiAttachUsageAlert$outboundSchema;
17846
18026
  exports.PreviewMultiAttachUsageLineItem$inboundSchema = PreviewMultiAttachUsageLineItem$inboundSchema;
17847
18027
  exports.PreviewMultiAttachUsageLineItemPeriod$inboundSchema = PreviewMultiAttachUsageLineItemPeriod$inboundSchema;
18028
+ exports.PreviewUpdateAttachDiscount$outboundSchema = PreviewUpdateAttachDiscount$outboundSchema;
17848
18029
  exports.PreviewUpdateBasePrice$outboundSchema = PreviewUpdateBasePrice$outboundSchema;
17849
18030
  exports.PreviewUpdateBillingMethod = PreviewUpdateBillingMethod;
17850
18031
  exports.PreviewUpdateBillingMethod$outboundSchema = PreviewUpdateBillingMethod$outboundSchema;
@@ -18055,6 +18236,8 @@ exports.UpdatePlanBillingMethodRequest = UpdatePlanBillingMethodRequest;
18055
18236
  exports.UpdatePlanBillingMethodRequest$outboundSchema = UpdatePlanBillingMethodRequest$outboundSchema;
18056
18237
  exports.UpdatePlanBillingMethodResponse = UpdatePlanBillingMethodResponse;
18057
18238
  exports.UpdatePlanBillingMethodResponse$inboundSchema = UpdatePlanBillingMethodResponse$inboundSchema;
18239
+ exports.UpdatePlanConfigRequest$outboundSchema = UpdatePlanConfigRequest$outboundSchema;
18240
+ exports.UpdatePlanConfigResponse$inboundSchema = UpdatePlanConfigResponse$inboundSchema;
18058
18241
  exports.UpdatePlanCreditSchema$inboundSchema = UpdatePlanCreditSchema$inboundSchema;
18059
18242
  exports.UpdatePlanCustomerEligibility$inboundSchema = UpdatePlanCustomerEligibility$inboundSchema;
18060
18243
  exports.UpdatePlanDurationTypeRequest = UpdatePlanDurationTypeRequest;
@@ -18145,6 +18328,7 @@ exports.balanceFromJSON = balanceFromJSON;
18145
18328
  exports.balancePriceFromJSON = balancePriceFromJSON;
18146
18329
  exports.balanceResetFromJSON = balanceResetFromJSON;
18147
18330
  exports.balanceRolloverFromJSON = balanceRolloverFromJSON;
18331
+ exports.billingUpdateAttachDiscountToJSON = billingUpdateAttachDiscountToJSON;
18148
18332
  exports.billingUpdateBasePriceToJSON = billingUpdateBasePriceToJSON;
18149
18333
  exports.billingUpdateCustomizeToJSON = billingUpdateCustomizeToJSON;
18150
18334
  exports.billingUpdateFeatureQuantityToJSON = billingUpdateFeatureQuantityToJSON;
@@ -18198,6 +18382,8 @@ exports.createFeatureDisplayRequestToJSON = createFeatureDisplayRequestToJSON;
18198
18382
  exports.createFeatureDisplayResponseFromJSON = createFeatureDisplayResponseFromJSON;
18199
18383
  exports.createFeatureParamsToJSON = createFeatureParamsToJSON;
18200
18384
  exports.createFeatureResponseFromJSON = createFeatureResponseFromJSON;
18385
+ exports.createPlanConfigRequestToJSON = createPlanConfigRequestToJSON;
18386
+ exports.createPlanConfigResponseFromJSON = createPlanConfigResponseFromJSON;
18201
18387
  exports.createPlanCreditSchemaFromJSON = createPlanCreditSchemaFromJSON;
18202
18388
  exports.createPlanCustomerEligibilityFromJSON = createPlanCustomerEligibilityFromJSON;
18203
18389
  exports.createPlanFeatureDisplayFromJSON = createPlanFeatureDisplayFromJSON;
@@ -18290,6 +18476,7 @@ exports.getOrCreateCustomerParamsToJSON = getOrCreateCustomerParamsToJSON;
18290
18476
  exports.getOrCreateCustomerPurchaseLimitToJSON = getOrCreateCustomerPurchaseLimitToJSON;
18291
18477
  exports.getOrCreateCustomerSpendLimitToJSON = getOrCreateCustomerSpendLimitToJSON;
18292
18478
  exports.getOrCreateCustomerUsageAlertToJSON = getOrCreateCustomerUsageAlertToJSON;
18479
+ exports.getPlanConfigFromJSON = getPlanConfigFromJSON;
18293
18480
  exports.getPlanCreditSchemaFromJSON = getPlanCreditSchemaFromJSON;
18294
18481
  exports.getPlanCustomerEligibilityFromJSON = getPlanCustomerEligibilityFromJSON;
18295
18482
  exports.getPlanFeatureDisplayFromJSON = getPlanFeatureDisplayFromJSON;
@@ -18334,6 +18521,7 @@ exports.listFeaturesDisplayFromJSON = listFeaturesDisplayFromJSON;
18334
18521
  exports.listFeaturesListFromJSON = listFeaturesListFromJSON;
18335
18522
  exports.listFeaturesRequestToJSON = listFeaturesRequestToJSON;
18336
18523
  exports.listFeaturesResponseFromJSON = listFeaturesResponseFromJSON;
18524
+ exports.listPlansConfigFromJSON = listPlansConfigFromJSON;
18337
18525
  exports.listPlansCreditSchemaFromJSON = listPlansCreditSchemaFromJSON;
18338
18526
  exports.listPlansCustomerEligibilityFromJSON = listPlansCustomerEligibilityFromJSON;
18339
18527
  exports.listPlansFeatureDisplayFromJSON = listPlansFeatureDisplayFromJSON;
@@ -18374,6 +18562,7 @@ exports.multiAttachToToJSON = multiAttachToToJSON;
18374
18562
  exports.multiAttachUsageAlertToJSON = multiAttachUsageAlertToJSON;
18375
18563
  exports.openCustomerPortalParamsToJSON = openCustomerPortalParamsToJSON;
18376
18564
  exports.openCustomerPortalResponseFromJSON = openCustomerPortalResponseFromJSON;
18565
+ exports.planConfigFromJSON = planConfigFromJSON;
18377
18566
  exports.planCreditSchemaFromJSON = planCreditSchemaFromJSON;
18378
18567
  exports.planFeatureDisplayFromJSON = planFeatureDisplayFromJSON;
18379
18568
  exports.planFeatureFromJSON = planFeatureFromJSON;
@@ -18450,6 +18639,7 @@ exports.previewMultiAttachToToJSON = previewMultiAttachToToJSON;
18450
18639
  exports.previewMultiAttachUsageAlertToJSON = previewMultiAttachUsageAlertToJSON;
18451
18640
  exports.previewMultiAttachUsageLineItemFromJSON = previewMultiAttachUsageLineItemFromJSON;
18452
18641
  exports.previewMultiAttachUsageLineItemPeriodFromJSON = previewMultiAttachUsageLineItemPeriodFromJSON;
18642
+ exports.previewUpdateAttachDiscountToJSON = previewUpdateAttachDiscountToJSON;
18453
18643
  exports.previewUpdateBasePriceToJSON = previewUpdateBasePriceToJSON;
18454
18644
  exports.previewUpdateCustomizeToJSON = previewUpdateCustomizeToJSON;
18455
18645
  exports.previewUpdateDiscountFromJSON = previewUpdateDiscountFromJSON;
@@ -18561,6 +18751,8 @@ exports.updateFeatureDisplayResponseFromJSON = updateFeatureDisplayResponseFromJ
18561
18751
  exports.updateFeatureParamsToJSON = updateFeatureParamsToJSON;
18562
18752
  exports.updateFeatureResponseFromJSON = updateFeatureResponseFromJSON;
18563
18753
  exports.updatePlanBasePriceToJSON = updatePlanBasePriceToJSON;
18754
+ exports.updatePlanConfigRequestToJSON = updatePlanConfigRequestToJSON;
18755
+ exports.updatePlanConfigResponseFromJSON = updatePlanConfigResponseFromJSON;
18564
18756
  exports.updatePlanCreditSchemaFromJSON = updatePlanCreditSchemaFromJSON;
18565
18757
  exports.updatePlanCustomerEligibilityFromJSON = updatePlanCustomerEligibilityFromJSON;
18566
18758
  exports.updatePlanFeatureDisplayFromJSON = updatePlanFeatureDisplayFromJSON;