chargebee 3.34.0 → 3.36.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.
Files changed (198) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/cjs/environment.js +1 -1
  3. package/cjs/resources/api_endpoints.js +230 -2
  4. package/cjs/resources/webhook/eventType.js +25 -1
  5. package/cjs/schema/addon.schema.js +221 -40
  6. package/cjs/schema/alert.schema.js +17 -2
  7. package/cjs/schema/alert_status.schema.js +6 -1
  8. package/cjs/schema/attached_item.schema.js +101 -26
  9. package/cjs/schema/business_entity.schema.js +43 -6
  10. package/cjs/schema/business_rule.schema.js +2 -2
  11. package/cjs/schema/business_ruleset.schema.js +2 -2
  12. package/cjs/schema/collections_payment_promise.schema.js +43 -0
  13. package/cjs/schema/comment.schema.js +17 -4
  14. package/cjs/schema/coupon.schema.js +218 -37
  15. package/cjs/schema/coupon_code.schema.js +36 -6
  16. package/cjs/schema/coupon_set.schema.js +108 -27
  17. package/cjs/schema/credit_note.schema.js +497 -105
  18. package/cjs/schema/credit_unit.schema.js +12 -2
  19. package/cjs/schema/customer.schema.js +212 -62
  20. package/cjs/schema/differential_price.schema.js +100 -12
  21. package/cjs/schema/dispute.schema.js +125 -33
  22. package/cjs/schema/einvoice.schema.js +27 -6
  23. package/cjs/schema/email_log.schema.js +15 -4
  24. package/cjs/schema/entitlement.schema.js +35 -6
  25. package/cjs/schema/entitlement_override.schema.js +17 -1
  26. package/cjs/schema/estimate.schema.js +585 -40
  27. package/cjs/schema/event.schema.js +1334 -585
  28. package/cjs/schema/export.schema.js +4459 -1412
  29. package/cjs/schema/feature.schema.js +73 -11
  30. package/cjs/schema/gateway_request_log.schema.js +309 -0
  31. package/cjs/schema/gateway_webhook_log.schema.js +257 -0
  32. package/cjs/schema/gift.schema.js +51 -5
  33. package/cjs/schema/grant_block.schema.js +45 -12
  34. package/cjs/schema/hosted_page.schema.js +564 -68
  35. package/cjs/schema/index.js +6 -0
  36. package/cjs/schema/invoice.schema.js +843 -123
  37. package/cjs/schema/item.schema.js +151 -28
  38. package/cjs/schema/item_entitlement.schema.js +23 -2
  39. package/cjs/schema/item_family.schema.js +29 -8
  40. package/cjs/schema/item_price.schema.js +263 -48
  41. package/cjs/schema/ledger_account_balance.schema.js +11 -2
  42. package/cjs/schema/ledger_operation.schema.js +44 -17
  43. package/cjs/schema/metered_feature.schema.js +10 -1
  44. package/cjs/schema/omnichannel_one_time_order.schema.js +42 -4
  45. package/cjs/schema/omnichannel_subscription.schema.js +146 -32
  46. package/cjs/schema/order.schema.js +233 -61
  47. package/cjs/schema/organization_detail.schema.js +36 -0
  48. package/cjs/schema/payment_schedule.schema.js +39 -8
  49. package/cjs/schema/payment_schedule_scheme.schema.js +37 -7
  50. package/cjs/schema/payment_source.schema.js +375 -148
  51. package/cjs/schema/payment_voucher.schema.js +33 -5
  52. package/cjs/schema/plan.schema.js +345 -57
  53. package/cjs/schema/price_ramp.schema.js +153 -0
  54. package/cjs/schema/price_variant.schema.js +88 -18
  55. package/cjs/schema/pricing_page_session.schema.js +36 -2
  56. package/cjs/schema/promotional_credit.schema.js +27 -6
  57. package/cjs/schema/purchase.schema.js +210 -12
  58. package/cjs/schema/quote.schema.js +907 -87
  59. package/cjs/schema/quote_entitlement.schema.js +6 -2
  60. package/cjs/schema/ramp.schema.js +242 -24
  61. package/cjs/schema/retry_segment.schema.js +12 -0
  62. package/cjs/schema/site_migration_detail.schema.js +50 -16
  63. package/cjs/schema/subscription.schema.js +1002 -173
  64. package/cjs/schema/subscription_entitlement.schema.js +9 -1
  65. package/cjs/schema/transaction.schema.js +780 -342
  66. package/cjs/schema/unbilled_charge.schema.js +141 -13
  67. package/cjs/schema/usage.schema.js +59 -11
  68. package/cjs/schema/usage_event.schema.js +13 -1
  69. package/cjs/schema/usage_summary.schema.js +1 -0
  70. package/cjs/schema/virtual_bank_account.schema.js +42 -10
  71. package/cjs/schema/webhook_endpoint.schema.js +50 -2
  72. package/esm/environment.js +1 -1
  73. package/esm/resources/api_endpoints.js +230 -2
  74. package/esm/resources/webhook/eventType.js +25 -1
  75. package/esm/schema/addon.schema.js +221 -40
  76. package/esm/schema/alert.schema.js +17 -2
  77. package/esm/schema/alert_status.schema.js +6 -1
  78. package/esm/schema/attached_item.schema.js +101 -26
  79. package/esm/schema/business_entity.schema.js +42 -5
  80. package/esm/schema/business_rule.schema.js +2 -2
  81. package/esm/schema/business_ruleset.schema.js +2 -2
  82. package/esm/schema/collections_payment_promise.schema.js +40 -0
  83. package/esm/schema/comment.schema.js +17 -4
  84. package/esm/schema/coupon.schema.js +218 -37
  85. package/esm/schema/coupon_code.schema.js +36 -6
  86. package/esm/schema/coupon_set.schema.js +108 -27
  87. package/esm/schema/credit_note.schema.js +497 -105
  88. package/esm/schema/credit_unit.schema.js +12 -2
  89. package/esm/schema/customer.schema.js +212 -62
  90. package/esm/schema/differential_price.schema.js +100 -12
  91. package/esm/schema/dispute.schema.js +125 -33
  92. package/esm/schema/einvoice.schema.js +27 -6
  93. package/esm/schema/email_log.schema.js +15 -4
  94. package/esm/schema/entitlement.schema.js +35 -6
  95. package/esm/schema/entitlement_override.schema.js +17 -1
  96. package/esm/schema/estimate.schema.js +585 -40
  97. package/esm/schema/event.schema.js +1334 -585
  98. package/esm/schema/export.schema.js +4459 -1412
  99. package/esm/schema/feature.schema.js +73 -11
  100. package/esm/schema/gateway_request_log.schema.js +306 -0
  101. package/esm/schema/gateway_webhook_log.schema.js +254 -0
  102. package/esm/schema/gift.schema.js +51 -5
  103. package/esm/schema/grant_block.schema.js +45 -12
  104. package/esm/schema/hosted_page.schema.js +564 -68
  105. package/esm/schema/index.js +6 -0
  106. package/esm/schema/invoice.schema.js +842 -122
  107. package/esm/schema/item.schema.js +151 -28
  108. package/esm/schema/item_entitlement.schema.js +23 -2
  109. package/esm/schema/item_family.schema.js +29 -8
  110. package/esm/schema/item_price.schema.js +263 -48
  111. package/esm/schema/ledger_account_balance.schema.js +10 -1
  112. package/esm/schema/ledger_operation.schema.js +44 -17
  113. package/esm/schema/metered_feature.schema.js +10 -1
  114. package/esm/schema/omnichannel_one_time_order.schema.js +42 -4
  115. package/esm/schema/omnichannel_subscription.schema.js +146 -32
  116. package/esm/schema/order.schema.js +233 -61
  117. package/esm/schema/organization_detail.schema.js +33 -0
  118. package/esm/schema/payment_schedule.schema.js +39 -8
  119. package/esm/schema/payment_schedule_scheme.schema.js +37 -7
  120. package/esm/schema/payment_source.schema.js +375 -148
  121. package/esm/schema/payment_voucher.schema.js +33 -5
  122. package/esm/schema/plan.schema.js +345 -57
  123. package/esm/schema/price_ramp.schema.js +150 -0
  124. package/esm/schema/price_variant.schema.js +88 -18
  125. package/esm/schema/pricing_page_session.schema.js +36 -2
  126. package/esm/schema/promotional_credit.schema.js +27 -6
  127. package/esm/schema/purchase.schema.js +210 -12
  128. package/esm/schema/quote.schema.js +907 -87
  129. package/esm/schema/quote_entitlement.schema.js +6 -2
  130. package/esm/schema/ramp.schema.js +242 -24
  131. package/esm/schema/retry_segment.schema.js +9 -0
  132. package/esm/schema/site_migration_detail.schema.js +50 -16
  133. package/esm/schema/subscription.schema.js +1002 -173
  134. package/esm/schema/subscription_entitlement.schema.js +9 -1
  135. package/esm/schema/transaction.schema.js +780 -342
  136. package/esm/schema/unbilled_charge.schema.js +141 -13
  137. package/esm/schema/usage.schema.js +59 -11
  138. package/esm/schema/usage_event.schema.js +13 -1
  139. package/esm/schema/usage_summary.schema.js +1 -0
  140. package/esm/schema/virtual_bank_account.schema.js +42 -10
  141. package/esm/schema/webhook_endpoint.schema.js +50 -2
  142. package/package.json +1 -1
  143. package/types/core.d.ts +63 -74
  144. package/types/index.d.ts +29 -1
  145. package/types/resources/BillingLineItem.d.ts +10 -0
  146. package/types/resources/BillingMetadata.d.ts +9 -0
  147. package/types/resources/BusinessEntity.d.ts +52 -0
  148. package/types/resources/Citation.d.ts +13 -0
  149. package/types/resources/CollectionsDispute.d.ts +24 -0
  150. package/types/resources/CollectionsPaymentPromise.d.ts +93 -0
  151. package/types/resources/CollectionsReminderSequence.d.ts +35 -0
  152. package/types/resources/Comment.d.ts +2 -1
  153. package/types/resources/Content.d.ts +23 -1
  154. package/types/resources/CreditNote.d.ts +1 -0
  155. package/types/resources/CustomData.d.ts +14 -0
  156. package/types/resources/Discount.d.ts +1 -0
  157. package/types/resources/DraftEstimate.d.ts +13 -0
  158. package/types/resources/DraftRequest.d.ts +45 -0
  159. package/types/resources/EmailAttachment.d.ts +16 -0
  160. package/types/resources/EmailConversation.d.ts +18 -0
  161. package/types/resources/EmailLog.d.ts +1 -0
  162. package/types/resources/EmailMessage.d.ts +40 -0
  163. package/types/resources/Estimate.d.ts +3 -0
  164. package/types/resources/Event.d.ts +25 -1
  165. package/types/resources/Execution.d.ts +12 -0
  166. package/types/resources/GatewayPaymentMethodToken.d.ts +2 -2
  167. package/types/resources/GatewayRequestLog.d.ts +82 -0
  168. package/types/resources/GatewayWebhookLog.d.ts +74 -0
  169. package/types/resources/GrantBlock.d.ts +5 -0
  170. package/types/resources/GroupByAttribute.d.ts +15 -0
  171. package/types/resources/GroupByRecommendation.d.ts +10 -0
  172. package/types/resources/HostedPage.d.ts +18 -0
  173. package/types/resources/Invoice.d.ts +19 -0
  174. package/types/resources/ItemPrice.d.ts +1 -0
  175. package/types/resources/LedgerAccountBalance.d.ts +19 -0
  176. package/types/resources/Meter.d.ts +1 -0
  177. package/types/resources/MeteredFeature.d.ts +1 -0
  178. package/types/resources/OmnichannelOneTimeOrder.d.ts +5 -1
  179. package/types/resources/OmnichannelSubscription.d.ts +6 -1
  180. package/types/resources/OmnichannelSubscriptionItem.d.ts +4 -1
  181. package/types/resources/OrganizationDetail.d.ts +84 -0
  182. package/types/resources/PaymentSchedule.d.ts +1 -1
  183. package/types/resources/PaymentScheduleEstimate.d.ts +1 -1
  184. package/types/resources/PaymentSource.d.ts +19 -0
  185. package/types/resources/PreferenceVariant.d.ts +10 -0
  186. package/types/resources/PriceRamp.d.ts +113 -0
  187. package/types/resources/PrivateNote.d.ts +18 -0
  188. package/types/resources/Purchase.d.ts +6 -0
  189. package/types/resources/Ramp.d.ts +6 -0
  190. package/types/resources/RampInterval.d.ts +12 -0
  191. package/types/resources/RecordedPurchase.d.ts +5 -1
  192. package/types/resources/RetrySegment.d.ts +36 -0
  193. package/types/resources/Subscription.d.ts +3 -0
  194. package/types/resources/Transaction.d.ts +4 -0
  195. package/types/resources/Usage.d.ts +7 -0
  196. package/types/resources/UsageSummary.d.ts +2 -0
  197. package/types/resources/WebhookEvent.d.ts +159 -5
  198. package/types/resources/AppliedBusinessRule.d.ts +0 -15
@@ -6,6 +6,9 @@ import { z } from 'zod';
6
6
  const CreatePaymentVoucherVoucherPaymentSourceSchema = z.object({
7
7
  voucher_type: z.enum(['boleto']),
8
8
  });
9
+ const CreatePaymentVoucherInvoiceAllocationsItemSchema = z.object({
10
+ invoice_id: z.string().max(50),
11
+ });
9
12
  const CreatePaymentVoucherInvoiceAllocationsSchema = z.object({
10
13
  invoice_id: z.array(z.string().max(50).optional()),
11
14
  });
@@ -13,15 +16,30 @@ const CreatePaymentVoucherBodySchema = z.looseObject({
13
16
  customer_id: z.string().max(50),
14
17
  payment_source_id: z.string().max(40).optional(),
15
18
  voucher_payment_source: CreatePaymentVoucherVoucherPaymentSourceSchema.optional(),
16
- invoice_allocations: CreatePaymentVoucherInvoiceAllocationsSchema.optional(),
19
+ invoice_allocations: z
20
+ .union([
21
+ z.array(CreatePaymentVoucherInvoiceAllocationsItemSchema.optional()),
22
+ CreatePaymentVoucherInvoiceAllocationsSchema,
23
+ ])
24
+ .optional(),
17
25
  });
18
26
  export { CreatePaymentVoucherBodySchema };
19
27
  //PaymentVoucher.payment_vouchersForInvoice
20
28
  const PaymentVouchersforinvoicePaymentVoucherStatusSchema = z.object({
21
29
  is: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
22
30
  is_not: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
23
- in: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
24
- not_in: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
31
+ in: z
32
+ .union([
33
+ z.array(z.enum(['active', 'consumed', 'expired', 'failure']).optional()),
34
+ z.enum(['active', 'consumed', 'expired', 'failure']),
35
+ ])
36
+ .optional(),
37
+ not_in: z
38
+ .union([
39
+ z.array(z.enum(['active', 'consumed', 'expired', 'failure']).optional()),
40
+ z.enum(['active', 'consumed', 'expired', 'failure']),
41
+ ])
42
+ .optional(),
25
43
  });
26
44
  const PaymentVouchersforinvoicePaymentVoucherSortBySchema = z.looseObject({
27
45
  asc: z.enum(['date', 'updated_at']).optional(),
@@ -38,8 +56,18 @@ export { PaymentVouchersforinvoicePaymentVoucherBodySchema };
38
56
  const PaymentVouchersforcustomerPaymentVoucherStatusSchema = z.object({
39
57
  is: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
40
58
  is_not: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
41
- in: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
42
- not_in: z.enum(['active', 'consumed', 'expired', 'failure']).optional(),
59
+ in: z
60
+ .union([
61
+ z.array(z.enum(['active', 'consumed', 'expired', 'failure']).optional()),
62
+ z.enum(['active', 'consumed', 'expired', 'failure']),
63
+ ])
64
+ .optional(),
65
+ not_in: z
66
+ .union([
67
+ z.array(z.enum(['active', 'consumed', 'expired', 'failure']).optional()),
68
+ z.enum(['active', 'consumed', 'expired', 'failure']),
69
+ ])
70
+ .optional(),
43
71
  });
44
72
  const PaymentVouchersforcustomerPaymentVoucherSortBySchema = z.looseObject({
45
73
  asc: z.enum(['date', 'updated_at']).optional(),
@@ -4,6 +4,14 @@
4
4
  import { z } from 'zod';
5
5
  //Plan.create
6
6
  const CreatePlanMetaDataSchema = z.looseObject({});
7
+ const CreatePlanTiersItemSchema = z.object({
8
+ starting_unit: z.number().int().min(1).optional(),
9
+ ending_unit: z.number().int().optional(),
10
+ price: z.number().int().min(0).optional(),
11
+ starting_unit_in_decimal: z.string().max(33).optional(),
12
+ ending_unit_in_decimal: z.string().max(33).optional(),
13
+ price_in_decimal: z.string().max(39).optional(),
14
+ });
7
15
  const CreatePlanTiersSchema = z.object({
8
16
  starting_unit: z.array(z.number().int().min(1).optional()).optional(),
9
17
  ending_unit: z.array(z.number().int().optional()).optional(),
@@ -12,14 +20,37 @@ const CreatePlanTiersSchema = z.object({
12
20
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
13
21
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
14
22
  });
23
+ const CreatePlanTaxProvidersFieldsItemSchema = z.object({
24
+ provider_name: z.string().max(50),
25
+ field_id: z.string().max(50),
26
+ field_value: z.string().max(50),
27
+ });
15
28
  const CreatePlanTaxProvidersFieldsSchema = z.object({
16
29
  provider_name: z.array(z.string().max(50).optional()),
17
30
  field_id: z.array(z.string().max(50).optional()),
18
31
  field_value: z.array(z.string().max(50).optional()),
19
32
  });
33
+ const CreatePlanApplicableAddonsItemSchema = z.object({
34
+ id: z.string().max(100).optional(),
35
+ });
20
36
  const CreatePlanApplicableAddonsSchema = z.object({
21
37
  id: z.array(z.string().max(100).optional()).optional(),
22
38
  });
39
+ const CreatePlanEventBasedAddonsItemSchema = z.object({
40
+ id: z.string().max(100).optional(),
41
+ quantity: z.number().int().min(1).optional(),
42
+ quantity_in_decimal: z.string().max(33).optional(),
43
+ on_event: z
44
+ .enum([
45
+ 'subscription_creation',
46
+ 'subscription_trial_start',
47
+ 'plan_activation',
48
+ 'subscription_activation',
49
+ 'contract_termination',
50
+ ])
51
+ .optional(),
52
+ charge_once: z.boolean().default(true).optional(),
53
+ });
23
54
  const CreatePlanEventBasedAddonsSchema = z.object({
24
55
  id: z.array(z.string().max(100).optional()).optional(),
25
56
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -37,6 +68,13 @@ const CreatePlanEventBasedAddonsSchema = z.object({
37
68
  .optional(),
38
69
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
39
70
  });
71
+ const CreatePlanAttachedAddonsItemSchema = z.object({
72
+ id: z.string().max(100).optional(),
73
+ quantity: z.number().int().min(1).optional(),
74
+ quantity_in_decimal: z.string().max(33).optional(),
75
+ billing_cycles: z.number().int().min(1).optional(),
76
+ type: z.enum(['recommended', 'mandatory']).optional(),
77
+ });
40
78
  const CreatePlanAttachedAddonsSchema = z.object({
41
79
  id: z.array(z.string().max(100).optional()).optional(),
42
80
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -102,15 +140,48 @@ const CreatePlanBodySchema = z.looseObject({
102
140
  giftable: z.boolean().default(false).optional(),
103
141
  status: z.enum(['active', 'archived']).optional(),
104
142
  claim_url: z.string().max(500).optional(),
105
- tiers: CreatePlanTiersSchema.optional(),
106
- tax_providers_fields: CreatePlanTaxProvidersFieldsSchema.optional(),
107
- applicable_addons: CreatePlanApplicableAddonsSchema.optional(),
108
- event_based_addons: CreatePlanEventBasedAddonsSchema.optional(),
109
- attached_addons: CreatePlanAttachedAddonsSchema.optional(),
143
+ tiers: z
144
+ .union([
145
+ z.array(CreatePlanTiersItemSchema.optional()),
146
+ CreatePlanTiersSchema,
147
+ ])
148
+ .optional(),
149
+ tax_providers_fields: z
150
+ .union([
151
+ z.array(CreatePlanTaxProvidersFieldsItemSchema.optional()),
152
+ CreatePlanTaxProvidersFieldsSchema,
153
+ ])
154
+ .optional(),
155
+ applicable_addons: z
156
+ .union([
157
+ z.array(CreatePlanApplicableAddonsItemSchema.optional()),
158
+ CreatePlanApplicableAddonsSchema,
159
+ ])
160
+ .optional(),
161
+ event_based_addons: z
162
+ .union([
163
+ z.array(CreatePlanEventBasedAddonsItemSchema.optional()),
164
+ CreatePlanEventBasedAddonsSchema,
165
+ ])
166
+ .optional(),
167
+ attached_addons: z
168
+ .union([
169
+ z.array(CreatePlanAttachedAddonsItemSchema.optional()),
170
+ CreatePlanAttachedAddonsSchema,
171
+ ])
172
+ .optional(),
110
173
  });
111
174
  export { CreatePlanBodySchema };
112
175
  //Plan.update
113
176
  const UpdatePlanMetaDataSchema = z.looseObject({});
177
+ const UpdatePlanTiersItemSchema = z.object({
178
+ starting_unit: z.number().int().min(1).optional(),
179
+ ending_unit: z.number().int().optional(),
180
+ price: z.number().int().min(0).optional(),
181
+ starting_unit_in_decimal: z.string().max(33).optional(),
182
+ ending_unit_in_decimal: z.string().max(33).optional(),
183
+ price_in_decimal: z.string().max(39).optional(),
184
+ });
114
185
  const UpdatePlanTiersSchema = z.object({
115
186
  starting_unit: z.array(z.number().int().min(1).optional()).optional(),
116
187
  ending_unit: z.array(z.number().int().optional()).optional(),
@@ -119,14 +190,37 @@ const UpdatePlanTiersSchema = z.object({
119
190
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
120
191
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
121
192
  });
193
+ const UpdatePlanTaxProvidersFieldsItemSchema = z.object({
194
+ provider_name: z.string().max(50),
195
+ field_id: z.string().max(50),
196
+ field_value: z.string().max(50),
197
+ });
122
198
  const UpdatePlanTaxProvidersFieldsSchema = z.object({
123
199
  provider_name: z.array(z.string().max(50).optional()),
124
200
  field_id: z.array(z.string().max(50).optional()),
125
201
  field_value: z.array(z.string().max(50).optional()),
126
202
  });
203
+ const UpdatePlanApplicableAddonsItemSchema = z.object({
204
+ id: z.string().max(100).optional(),
205
+ });
127
206
  const UpdatePlanApplicableAddonsSchema = z.object({
128
207
  id: z.array(z.string().max(100).optional()).optional(),
129
208
  });
209
+ const UpdatePlanEventBasedAddonsItemSchema = z.object({
210
+ id: z.string().max(100).optional(),
211
+ quantity: z.number().int().min(1).optional(),
212
+ quantity_in_decimal: z.string().max(33).optional(),
213
+ on_event: z
214
+ .enum([
215
+ 'subscription_creation',
216
+ 'subscription_trial_start',
217
+ 'plan_activation',
218
+ 'subscription_activation',
219
+ 'contract_termination',
220
+ ])
221
+ .optional(),
222
+ charge_once: z.boolean().default(true).optional(),
223
+ });
130
224
  const UpdatePlanEventBasedAddonsSchema = z.object({
131
225
  id: z.array(z.string().max(100).optional()).optional(),
132
226
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -144,6 +238,13 @@ const UpdatePlanEventBasedAddonsSchema = z.object({
144
238
  .optional(),
145
239
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
146
240
  });
241
+ const UpdatePlanAttachedAddonsItemSchema = z.object({
242
+ id: z.string().max(100).optional(),
243
+ quantity: z.number().int().min(1).optional(),
244
+ quantity_in_decimal: z.string().max(33).optional(),
245
+ billing_cycles: z.number().int().min(1).optional(),
246
+ type: z.enum(['recommended', 'mandatory']).optional(),
247
+ });
147
248
  const UpdatePlanAttachedAddonsSchema = z.object({
148
249
  id: z.array(z.string().max(100).optional()).optional(),
149
250
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -205,11 +306,36 @@ const UpdatePlanBodySchema = z.looseObject({
205
306
  meta_data: UpdatePlanMetaDataSchema.optional(),
206
307
  show_description_in_invoices: z.boolean().default(false).optional(),
207
308
  show_description_in_quotes: z.boolean().default(false).optional(),
208
- tiers: UpdatePlanTiersSchema.optional(),
209
- tax_providers_fields: UpdatePlanTaxProvidersFieldsSchema.optional(),
210
- applicable_addons: UpdatePlanApplicableAddonsSchema.optional(),
211
- event_based_addons: UpdatePlanEventBasedAddonsSchema.optional(),
212
- attached_addons: UpdatePlanAttachedAddonsSchema.optional(),
309
+ tiers: z
310
+ .union([
311
+ z.array(UpdatePlanTiersItemSchema.optional()),
312
+ UpdatePlanTiersSchema,
313
+ ])
314
+ .optional(),
315
+ tax_providers_fields: z
316
+ .union([
317
+ z.array(UpdatePlanTaxProvidersFieldsItemSchema.optional()),
318
+ UpdatePlanTaxProvidersFieldsSchema,
319
+ ])
320
+ .optional(),
321
+ applicable_addons: z
322
+ .union([
323
+ z.array(UpdatePlanApplicableAddonsItemSchema.optional()),
324
+ UpdatePlanApplicableAddonsSchema,
325
+ ])
326
+ .optional(),
327
+ event_based_addons: z
328
+ .union([
329
+ z.array(UpdatePlanEventBasedAddonsItemSchema.optional()),
330
+ UpdatePlanEventBasedAddonsSchema,
331
+ ])
332
+ .optional(),
333
+ attached_addons: z
334
+ .union([
335
+ z.array(UpdatePlanAttachedAddonsItemSchema.optional()),
336
+ UpdatePlanAttachedAddonsSchema,
337
+ ])
338
+ .optional(),
213
339
  });
214
340
  export { UpdatePlanBodySchema };
215
341
  //Plan.list
@@ -217,64 +343,165 @@ const ListPlanIdSchema = z.object({
217
343
  is: z.string().min(1).optional(),
218
344
  is_not: z.string().min(1).optional(),
219
345
  starts_with: z.string().min(1).optional(),
220
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
221
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
346
+ in: z
347
+ .union([
348
+ z.array(z.string().optional()),
349
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
350
+ ])
351
+ .optional(),
352
+ not_in: z
353
+ .union([
354
+ z.array(z.string().optional()),
355
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
356
+ ])
357
+ .optional(),
222
358
  });
223
359
  const ListPlanNameSchema = z.object({
224
360
  is: z.string().min(1).optional(),
225
361
  is_not: z.string().min(1).optional(),
226
362
  starts_with: z.string().min(1).optional(),
227
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
228
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
363
+ in: z
364
+ .union([
365
+ z.array(z.string().optional()),
366
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
367
+ ])
368
+ .optional(),
369
+ not_in: z
370
+ .union([
371
+ z.array(z.string().optional()),
372
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
373
+ ])
374
+ .optional(),
229
375
  });
230
376
  const ListPlanPriceSchema = z.object({
231
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
232
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
233
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
234
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
235
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
236
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
237
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
377
+ is: z
378
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
379
+ .optional(),
380
+ is_not: z
381
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
382
+ .optional(),
383
+ lt: z
384
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
385
+ .optional(),
386
+ lte: z
387
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
388
+ .optional(),
389
+ gt: z
390
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
391
+ .optional(),
392
+ gte: z
393
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
394
+ .optional(),
395
+ between: z
396
+ .union([
397
+ z.array(z.number().int().optional()).min(2).max(2),
398
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
399
+ ])
400
+ .optional(),
238
401
  });
239
402
  const ListPlanPeriodSchema = z.object({
240
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
241
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
242
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
243
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
244
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
245
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
246
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
403
+ is: z
404
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
405
+ .optional(),
406
+ is_not: z
407
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
408
+ .optional(),
409
+ lt: z
410
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
411
+ .optional(),
412
+ lte: z
413
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
414
+ .optional(),
415
+ gt: z
416
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
417
+ .optional(),
418
+ gte: z
419
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
420
+ .optional(),
421
+ between: z
422
+ .union([
423
+ z.array(z.number().int().optional()).min(2).max(2),
424
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
425
+ ])
426
+ .optional(),
247
427
  });
248
428
  const ListPlanPeriodUnitSchema = z.object({
249
429
  is: z.enum(['day', 'week', 'month', 'year']).optional(),
250
430
  is_not: z.enum(['day', 'week', 'month', 'year']).optional(),
251
- in: z.enum(['day', 'week', 'month', 'year']).optional(),
252
- not_in: z.enum(['day', 'week', 'month', 'year']).optional(),
431
+ in: z
432
+ .union([
433
+ z.array(z.enum(['day', 'week', 'month', 'year']).optional()),
434
+ z.enum(['day', 'week', 'month', 'year']),
435
+ ])
436
+ .optional(),
437
+ not_in: z
438
+ .union([
439
+ z.array(z.enum(['day', 'week', 'month', 'year']).optional()),
440
+ z.enum(['day', 'week', 'month', 'year']),
441
+ ])
442
+ .optional(),
253
443
  });
254
444
  const ListPlanTrialPeriodSchema = z.object({
255
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
256
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
257
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
258
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
259
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
260
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
261
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
262
- is_present: z.enum(['true', 'false']).optional(),
445
+ is: z
446
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
447
+ .optional(),
448
+ is_not: z
449
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
450
+ .optional(),
451
+ lt: z
452
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
453
+ .optional(),
454
+ lte: z
455
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
456
+ .optional(),
457
+ gt: z
458
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
459
+ .optional(),
460
+ gte: z
461
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
462
+ .optional(),
463
+ between: z
464
+ .union([
465
+ z.array(z.number().int().optional()).min(2).max(2),
466
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
467
+ ])
468
+ .optional(),
469
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
263
470
  });
264
471
  const ListPlanTrialPeriodUnitSchema = z.object({
265
472
  is: z.enum(['day', 'month']).optional(),
266
473
  is_not: z.enum(['day', 'month']).optional(),
267
- in: z.enum(['day', 'month']).optional(),
268
- not_in: z.enum(['day', 'month']).optional(),
474
+ in: z
475
+ .union([
476
+ z.array(z.enum(['day', 'month']).optional()),
477
+ z.enum(['day', 'month']),
478
+ ])
479
+ .optional(),
480
+ not_in: z
481
+ .union([
482
+ z.array(z.enum(['day', 'month']).optional()),
483
+ z.enum(['day', 'month']),
484
+ ])
485
+ .optional(),
269
486
  });
270
487
  const ListPlanAddonApplicabilitySchema = z.object({
271
488
  is: z.enum(['all', 'restricted']).optional(),
272
489
  is_not: z.enum(['all', 'restricted']).optional(),
273
- in: z.enum(['all', 'restricted']).optional(),
274
- not_in: z.enum(['all', 'restricted']).optional(),
490
+ in: z
491
+ .union([
492
+ z.array(z.enum(['all', 'restricted']).optional()),
493
+ z.enum(['all', 'restricted']),
494
+ ])
495
+ .optional(),
496
+ not_in: z
497
+ .union([
498
+ z.array(z.enum(['all', 'restricted']).optional()),
499
+ z.enum(['all', 'restricted']),
500
+ ])
501
+ .optional(),
275
502
  });
276
503
  const ListPlanGiftableSchema = z.object({
277
- is: z.enum(['true', 'false']).optional(),
504
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
278
505
  });
279
506
  const ListPlanChargeModelSchema = z.object({
280
507
  is: z
@@ -284,10 +511,20 @@ const ListPlanChargeModelSchema = z.object({
284
511
  .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
285
512
  .optional(),
286
513
  in: z
287
- .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
514
+ .union([
515
+ z.array(z
516
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
517
+ .optional()),
518
+ z.enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep']),
519
+ ])
288
520
  .optional(),
289
521
  not_in: z
290
- .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
522
+ .union([
523
+ z.array(z
524
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
525
+ .optional()),
526
+ z.enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep']),
527
+ ])
291
528
  .optional(),
292
529
  });
293
530
  const ListPlanPricingModelSchema = z.object({
@@ -298,36 +535,87 @@ const ListPlanPricingModelSchema = z.object({
298
535
  .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
299
536
  .optional(),
300
537
  in: z
301
- .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
538
+ .union([
539
+ z.array(z
540
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
541
+ .optional()),
542
+ z.enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep']),
543
+ ])
302
544
  .optional(),
303
545
  not_in: z
304
- .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
546
+ .union([
547
+ z.array(z
548
+ .enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'])
549
+ .optional()),
550
+ z.enum(['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep']),
551
+ ])
305
552
  .optional(),
306
553
  });
307
554
  const ListPlanStatusSchema = z.object({
308
555
  is: z.enum(['active', 'archived', 'deleted']).optional(),
309
556
  is_not: z.enum(['active', 'archived', 'deleted']).optional(),
310
- in: z.enum(['active', 'archived', 'deleted']).optional(),
311
- not_in: z.enum(['active', 'archived', 'deleted']).optional(),
557
+ in: z
558
+ .union([
559
+ z.array(z.enum(['active', 'archived', 'deleted']).optional()),
560
+ z.enum(['active', 'archived', 'deleted']),
561
+ ])
562
+ .optional(),
563
+ not_in: z
564
+ .union([
565
+ z.array(z.enum(['active', 'archived', 'deleted']).optional()),
566
+ z.enum(['active', 'archived', 'deleted']),
567
+ ])
568
+ .optional(),
312
569
  });
313
570
  const ListPlanUpdatedAtSchema = z.object({
314
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
315
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
316
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
317
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
571
+ after: z
572
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
573
+ .optional(),
574
+ before: z
575
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
576
+ .optional(),
577
+ on: z
578
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
579
+ .optional(),
580
+ between: z
581
+ .union([
582
+ z.array(z.number().int().optional()).min(2).max(2),
583
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
584
+ ])
585
+ .optional(),
318
586
  });
319
587
  const ListPlanCurrencyCodeSchema = z.object({
320
588
  is: z.string().min(1).optional(),
321
589
  is_not: z.string().min(1).optional(),
322
590
  starts_with: z.string().min(1).optional(),
323
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
324
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
591
+ in: z
592
+ .union([
593
+ z.array(z.string().optional()),
594
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
595
+ ])
596
+ .optional(),
597
+ not_in: z
598
+ .union([
599
+ z.array(z.string().optional()),
600
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
601
+ ])
602
+ .optional(),
325
603
  });
326
604
  const ListPlanChannelSchema = z.object({
327
605
  is: z.enum(['web', 'app_store', 'play_store']).optional(),
328
606
  is_not: z.enum(['web', 'app_store', 'play_store']).optional(),
329
- in: z.enum(['web', 'app_store', 'play_store']).optional(),
330
- not_in: z.enum(['web', 'app_store', 'play_store']).optional(),
607
+ in: z
608
+ .union([
609
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
610
+ z.enum(['web', 'app_store', 'play_store']),
611
+ ])
612
+ .optional(),
613
+ not_in: z
614
+ .union([
615
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
616
+ z.enum(['web', 'app_store', 'play_store']),
617
+ ])
618
+ .optional(),
331
619
  });
332
620
  const ListPlanBodySchema = z.looseObject({
333
621
  limit: z.number().int().min(1).max(100).optional(),