chargebee 3.26.0 → 3.28.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 (172) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +131 -0
  3. package/cjs/RequestWrapper.js +130 -12
  4. package/cjs/chargebee.cjs.js +5 -0
  5. package/cjs/chargebee.cjs.worker.js +2 -0
  6. package/cjs/chargebeeZodValidationError.js +18 -0
  7. package/cjs/createChargebee.js +23 -2
  8. package/cjs/environment.js +1 -1
  9. package/cjs/schema/addon.schema.js +269 -0
  10. package/cjs/schema/address.schema.js +35 -0
  11. package/cjs/schema/alert.schema.js +74 -0
  12. package/cjs/schema/alert_status.schema.js +31 -0
  13. package/cjs/schema/attached_item.schema.js +144 -0
  14. package/cjs/schema/business_entity.schema.js +46 -0
  15. package/cjs/schema/card.schema.js +165 -0
  16. package/cjs/schema/comment.schema.js +69 -0
  17. package/cjs/schema/coupon.schema.js +323 -0
  18. package/cjs/schema/coupon_code.schema.js +49 -0
  19. package/cjs/schema/coupon_set.schema.js +88 -0
  20. package/cjs/schema/credit_note.schema.js +502 -0
  21. package/cjs/schema/currency.schema.js +32 -0
  22. package/cjs/schema/customer.schema.js +1201 -0
  23. package/cjs/schema/customer_entitlement.schema.js +14 -0
  24. package/cjs/schema/differential_price.schema.js +106 -0
  25. package/cjs/schema/entitlement.schema.js +54 -0
  26. package/cjs/schema/entitlement_override.schema.js +35 -0
  27. package/cjs/schema/estimate.schema.js +1535 -0
  28. package/cjs/schema/event.schema.js +1060 -0
  29. package/cjs/schema/export.schema.js +3385 -0
  30. package/cjs/schema/feature.schema.js +78 -0
  31. package/cjs/schema/gift.schema.js +293 -0
  32. package/cjs/schema/grant_block.schema.js +47 -0
  33. package/cjs/schema/hosted_page.schema.js +1777 -0
  34. package/cjs/schema/in_app_subscription.schema.js +68 -0
  35. package/cjs/schema/index.js +88 -0
  36. package/cjs/schema/invoice.schema.js +1685 -0
  37. package/cjs/schema/item.schema.js +195 -0
  38. package/cjs/schema/item_entitlement.schema.js +45 -0
  39. package/cjs/schema/item_family.schema.js +57 -0
  40. package/cjs/schema/item_price.schema.js +335 -0
  41. package/cjs/schema/ledger_account_balance.schema.js +21 -0
  42. package/cjs/schema/ledger_operation.schema.js +104 -0
  43. package/cjs/schema/meter.schema.js +13 -0
  44. package/cjs/schema/metered_feature.schema.js +20 -0
  45. package/cjs/schema/non_subscription.schema.js +28 -0
  46. package/cjs/schema/offer_event.schema.js +13 -0
  47. package/cjs/schema/offer_fulfillment.schema.js +20 -0
  48. package/cjs/schema/omnichannel_one_time_order.schema.js +26 -0
  49. package/cjs/schema/omnichannel_subscription.schema.js +122 -0
  50. package/cjs/schema/omnichannel_subscription_item.schema.js +13 -0
  51. package/cjs/schema/order.schema.js +441 -0
  52. package/cjs/schema/payment_intent.schema.js +127 -0
  53. package/cjs/schema/payment_schedule_scheme.schema.js +20 -0
  54. package/cjs/schema/payment_source.schema.js +630 -0
  55. package/cjs/schema/payment_voucher.schema.js +57 -0
  56. package/cjs/schema/personalized_offer.schema.js +28 -0
  57. package/cjs/schema/plan.schema.js +363 -0
  58. package/cjs/schema/portal_session.schema.js +22 -0
  59. package/cjs/schema/price_variant.schema.js +93 -0
  60. package/cjs/schema/pricing_page_session.schema.js +135 -0
  61. package/cjs/schema/promotional_credit.schema.js +78 -0
  62. package/cjs/schema/promotional_grant.schema.js +17 -0
  63. package/cjs/schema/purchase.schema.js +277 -0
  64. package/cjs/schema/quote.schema.js +1667 -0
  65. package/cjs/schema/ramp.schema.js +245 -0
  66. package/cjs/schema/recorded_purchase.schema.js +32 -0
  67. package/cjs/schema/resource_migration.schema.js +14 -0
  68. package/cjs/schema/site_migration_detail.schema.js +81 -0
  69. package/cjs/schema/subscription.schema.js +3344 -0
  70. package/cjs/schema/subscription_entitlement.schema.js +25 -0
  71. package/cjs/schema/time_machine.schema.js +17 -0
  72. package/cjs/schema/transaction.schema.js +744 -0
  73. package/cjs/schema/unbilled_charge.schema.js +139 -0
  74. package/cjs/schema/usage.schema.js +93 -0
  75. package/cjs/schema/usage_charge.schema.js +17 -0
  76. package/cjs/schema/usage_event.schema.js +28 -0
  77. package/cjs/schema/usage_file.schema.js +13 -0
  78. package/cjs/schema/usage_summary.schema.js +17 -0
  79. package/cjs/schema/virtual_bank_account.schema.js +71 -0
  80. package/cjs/schema/webhook_endpoint.schema.js +508 -0
  81. package/cjs/telemetry/TelemetryAdapter.js +145 -0
  82. package/cjs/telemetry/index.js +28 -0
  83. package/cjs/telemetry/otel.js +66 -0
  84. package/cjs/telemetry/types.js +47 -0
  85. package/cjs/validationLoader.js +59 -0
  86. package/esm/RequestWrapper.js +130 -12
  87. package/esm/chargebee.esm.js +3 -0
  88. package/esm/chargebee.esm.worker.js +1 -0
  89. package/esm/chargebeeZodValidationError.js +14 -0
  90. package/esm/createChargebee.js +23 -2
  91. package/esm/environment.js +1 -1
  92. package/esm/schema/addon.schema.js +266 -0
  93. package/esm/schema/address.schema.js +32 -0
  94. package/esm/schema/alert.schema.js +71 -0
  95. package/esm/schema/alert_status.schema.js +28 -0
  96. package/esm/schema/attached_item.schema.js +141 -0
  97. package/esm/schema/business_entity.schema.js +43 -0
  98. package/esm/schema/card.schema.js +162 -0
  99. package/esm/schema/comment.schema.js +66 -0
  100. package/esm/schema/coupon.schema.js +320 -0
  101. package/esm/schema/coupon_code.schema.js +46 -0
  102. package/esm/schema/coupon_set.schema.js +85 -0
  103. package/esm/schema/credit_note.schema.js +499 -0
  104. package/esm/schema/currency.schema.js +29 -0
  105. package/esm/schema/customer.schema.js +1198 -0
  106. package/esm/schema/customer_entitlement.schema.js +11 -0
  107. package/esm/schema/differential_price.schema.js +103 -0
  108. package/esm/schema/entitlement.schema.js +51 -0
  109. package/esm/schema/entitlement_override.schema.js +32 -0
  110. package/esm/schema/estimate.schema.js +1532 -0
  111. package/esm/schema/event.schema.js +1057 -0
  112. package/esm/schema/export.schema.js +3382 -0
  113. package/esm/schema/feature.schema.js +75 -0
  114. package/esm/schema/gift.schema.js +290 -0
  115. package/esm/schema/grant_block.schema.js +44 -0
  116. package/esm/schema/hosted_page.schema.js +1774 -0
  117. package/esm/schema/in_app_subscription.schema.js +65 -0
  118. package/esm/schema/index.js +72 -0
  119. package/esm/schema/invoice.schema.js +1682 -0
  120. package/esm/schema/item.schema.js +192 -0
  121. package/esm/schema/item_entitlement.schema.js +42 -0
  122. package/esm/schema/item_family.schema.js +54 -0
  123. package/esm/schema/item_price.schema.js +332 -0
  124. package/esm/schema/ledger_account_balance.schema.js +18 -0
  125. package/esm/schema/ledger_operation.schema.js +101 -0
  126. package/esm/schema/meter.schema.js +10 -0
  127. package/esm/schema/metered_feature.schema.js +17 -0
  128. package/esm/schema/non_subscription.schema.js +25 -0
  129. package/esm/schema/offer_event.schema.js +10 -0
  130. package/esm/schema/offer_fulfillment.schema.js +17 -0
  131. package/esm/schema/omnichannel_one_time_order.schema.js +23 -0
  132. package/esm/schema/omnichannel_subscription.schema.js +119 -0
  133. package/esm/schema/omnichannel_subscription_item.schema.js +10 -0
  134. package/esm/schema/order.schema.js +438 -0
  135. package/esm/schema/payment_intent.schema.js +124 -0
  136. package/esm/schema/payment_schedule_scheme.schema.js +17 -0
  137. package/esm/schema/payment_source.schema.js +627 -0
  138. package/esm/schema/payment_voucher.schema.js +54 -0
  139. package/esm/schema/personalized_offer.schema.js +25 -0
  140. package/esm/schema/plan.schema.js +360 -0
  141. package/esm/schema/portal_session.schema.js +19 -0
  142. package/esm/schema/price_variant.schema.js +90 -0
  143. package/esm/schema/pricing_page_session.schema.js +132 -0
  144. package/esm/schema/promotional_credit.schema.js +75 -0
  145. package/esm/schema/promotional_grant.schema.js +14 -0
  146. package/esm/schema/purchase.schema.js +274 -0
  147. package/esm/schema/quote.schema.js +1664 -0
  148. package/esm/schema/ramp.schema.js +242 -0
  149. package/esm/schema/recorded_purchase.schema.js +29 -0
  150. package/esm/schema/resource_migration.schema.js +11 -0
  151. package/esm/schema/site_migration_detail.schema.js +78 -0
  152. package/esm/schema/subscription.schema.js +3341 -0
  153. package/esm/schema/subscription_entitlement.schema.js +22 -0
  154. package/esm/schema/time_machine.schema.js +14 -0
  155. package/esm/schema/transaction.schema.js +741 -0
  156. package/esm/schema/unbilled_charge.schema.js +136 -0
  157. package/esm/schema/usage.schema.js +90 -0
  158. package/esm/schema/usage_charge.schema.js +14 -0
  159. package/esm/schema/usage_event.schema.js +25 -0
  160. package/esm/schema/usage_file.schema.js +10 -0
  161. package/esm/schema/usage_summary.schema.js +14 -0
  162. package/esm/schema/virtual_bank_account.schema.js +68 -0
  163. package/esm/schema/webhook_endpoint.schema.js +505 -0
  164. package/esm/telemetry/TelemetryAdapter.js +132 -0
  165. package/esm/telemetry/index.js +8 -0
  166. package/esm/telemetry/otel.js +62 -0
  167. package/esm/telemetry/types.js +44 -0
  168. package/esm/validationLoader.js +56 -0
  169. package/package.json +43 -24
  170. package/types/core.d.ts +2 -0
  171. package/types/index.d.ts +85 -0
  172. package/types/telemetry/otel.d.ts +22 -0
@@ -0,0 +1,75 @@
1
+ // Generated Zod schemas: PromotionalCredit
2
+ // Actions: add, deduct, set, list
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //PromotionalCredit.add
6
+ const AddPromotionalCreditBodySchema = z.looseObject({
7
+ customer_id: z.string().max(50),
8
+ amount: z.number().int().min(0).optional(),
9
+ amount_in_decimal: z.string().max(33).optional(),
10
+ currency_code: z.string().max(3).optional(),
11
+ description: z.string().max(250),
12
+ credit_type: z
13
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
14
+ .optional(),
15
+ reference: z.string().max(500).optional(),
16
+ });
17
+ export { AddPromotionalCreditBodySchema };
18
+ //PromotionalCredit.deduct
19
+ const DeductPromotionalCreditBodySchema = z.looseObject({
20
+ customer_id: z.string().max(50),
21
+ amount: z.number().int().min(0).optional(),
22
+ amount_in_decimal: z.string().max(33).optional(),
23
+ currency_code: z.string().max(3).optional(),
24
+ description: z.string().max(250),
25
+ credit_type: z
26
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
27
+ .optional(),
28
+ reference: z.string().max(500).optional(),
29
+ });
30
+ export { DeductPromotionalCreditBodySchema };
31
+ //PromotionalCredit.set
32
+ const SetPromotionalCreditBodySchema = z.looseObject({
33
+ customer_id: z.string().max(50),
34
+ amount: z.number().int().min(0).optional(),
35
+ amount_in_decimal: z.string().max(33).optional(),
36
+ currency_code: z.string().max(3).optional(),
37
+ description: z.string().max(250),
38
+ credit_type: z
39
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
40
+ .optional(),
41
+ reference: z.string().max(500).optional(),
42
+ });
43
+ export { SetPromotionalCreditBodySchema };
44
+ //PromotionalCredit.list
45
+ const ListPromotionalCreditIdSchema = z.object({
46
+ is: z.string().min(1).optional(),
47
+ is_not: z.string().min(1).optional(),
48
+ starts_with: z.string().min(1).optional(),
49
+ });
50
+ const ListPromotionalCreditCreatedAtSchema = z.object({
51
+ after: z.string().regex(RegExp('^\\d{10}$')).optional(),
52
+ before: z.string().regex(RegExp('^\\d{10}$')).optional(),
53
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
54
+ between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
55
+ });
56
+ const ListPromotionalCreditTypeSchema = z.object({
57
+ is: z.enum(['increment', 'decrement']).optional(),
58
+ is_not: z.enum(['increment', 'decrement']).optional(),
59
+ in: z.enum(['increment', 'decrement']).optional(),
60
+ not_in: z.enum(['increment', 'decrement']).optional(),
61
+ });
62
+ const ListPromotionalCreditCustomerIdSchema = z.object({
63
+ is: z.string().min(1).optional(),
64
+ is_not: z.string().min(1).optional(),
65
+ starts_with: z.string().min(1).optional(),
66
+ });
67
+ const ListPromotionalCreditBodySchema = z.looseObject({
68
+ limit: z.number().int().min(1).max(100).optional(),
69
+ offset: z.string().max(1000).optional(),
70
+ id: ListPromotionalCreditIdSchema.optional(),
71
+ created_at: ListPromotionalCreditCreatedAtSchema.optional(),
72
+ type: ListPromotionalCreditTypeSchema.optional(),
73
+ customer_id: ListPromotionalCreditCustomerIdSchema.optional(),
74
+ });
75
+ export { ListPromotionalCreditBodySchema };
@@ -0,0 +1,14 @@
1
+ // Generated Zod schemas: PromotionalGrant
2
+ // Actions: promotionalGrants
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //PromotionalGrant.promotionalGrants
6
+ const PromotionalGrantsPromotionalGrantMetadataSchema = z.looseObject({});
7
+ const PromotionalGrantsPromotionalGrantBodySchema = z.looseObject({
8
+ subscription_id: z.string().max(50),
9
+ unit_id: z.string().max(50),
10
+ amount: z.string().max(36),
11
+ expires_at: z.number().int(),
12
+ metadata: PromotionalGrantsPromotionalGrantMetadataSchema.optional(),
13
+ });
14
+ export { PromotionalGrantsPromotionalGrantBodySchema };
@@ -0,0 +1,274 @@
1
+ // Generated Zod schemas: Purchase
2
+ // Actions: create, estimate
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //Purchase.create
6
+ const CreatePurchaseInvoiceInfoSchema = z.object({
7
+ po_number: z.string().max(100).optional(),
8
+ notes: z.string().max(2000).optional(),
9
+ });
10
+ const CreatePurchasePaymentScheduleSchema = z.object({
11
+ scheme_id: z.string().max(40).optional(),
12
+ amount: z.number().int().min(0).optional(),
13
+ });
14
+ const CreatePurchaseStatementDescriptorSchema = z.object({
15
+ descriptor: z.string().max(65000).optional(),
16
+ });
17
+ const CreatePurchaseAdditionalInformationSchema = z.looseObject({});
18
+ const CreatePurchasePaymentIntentSchema = z.object({
19
+ id: z.string().max(150).optional(),
20
+ gateway_account_id: z.string().max(50).optional(),
21
+ gw_token: z.string().max(65000).optional(),
22
+ payment_method_type: z
23
+ .enum([
24
+ 'card',
25
+ 'ideal',
26
+ 'sofort',
27
+ 'bancontact',
28
+ 'google_pay',
29
+ 'dotpay',
30
+ 'giropay',
31
+ 'apple_pay',
32
+ 'upi',
33
+ 'netbanking_emandates',
34
+ 'paypal_express_checkout',
35
+ 'direct_debit',
36
+ 'boleto',
37
+ 'venmo',
38
+ 'amazon_payments',
39
+ 'pay_to',
40
+ 'faster_payments',
41
+ 'sepa_instant_transfer',
42
+ 'klarna_pay_now',
43
+ 'online_banking_poland',
44
+ 'payconiq_by_bancontact',
45
+ 'electronic_payment_standard',
46
+ 'kbc_payment_button',
47
+ 'pay_by_bank',
48
+ 'trustly',
49
+ 'stablecoin',
50
+ 'kakao_pay',
51
+ 'naver_pay',
52
+ 'revolut_pay',
53
+ 'cash_app_pay',
54
+ 'wechat_pay',
55
+ 'alipay',
56
+ 'twint',
57
+ 'go_pay',
58
+ 'grab_pay',
59
+ 'pay_co',
60
+ 'after_pay',
61
+ 'swish',
62
+ 'payme',
63
+ 'pix',
64
+ 'klarna',
65
+ 'alipay_hk',
66
+ 'paypay',
67
+ 'gcash',
68
+ 'south_korean_cards',
69
+ ])
70
+ .optional(),
71
+ reference_id: z.string().max(65000).optional(),
72
+ gw_payment_method_id: z.string().max(65000).optional(),
73
+ additional_information: CreatePurchaseAdditionalInformationSchema.optional(),
74
+ });
75
+ const CreatePurchasePurchaseItemsSchema = z.object({
76
+ index: z.array(z.number().int().min(0).optional()),
77
+ item_price_id: z.array(z.string().max(100).optional()),
78
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
79
+ unit_amount: z.array(z.number().int().min(0).optional()).optional(),
80
+ unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
81
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
82
+ });
83
+ const CreatePurchaseItemTiersSchema = z.object({
84
+ index: z.array(z.number().int().min(0).optional()),
85
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
86
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
87
+ ending_unit: z.array(z.number().int().optional()).optional(),
88
+ price: z.array(z.number().int().min(0).optional()).optional(),
89
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
90
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
91
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
92
+ });
93
+ const CreatePurchaseShippingAddressesSchema = z.object({
94
+ first_name: z.array(z.string().max(150).optional()).optional(),
95
+ last_name: z.array(z.string().max(150).optional()).optional(),
96
+ email: z.array(z.string().email().max(70).optional()).optional(),
97
+ company: z.array(z.string().max(250).optional()).optional(),
98
+ phone: z.array(z.string().max(50).optional()).optional(),
99
+ line1: z.array(z.string().max(150).optional()).optional(),
100
+ line2: z.array(z.string().max(150).optional()).optional(),
101
+ line3: z.array(z.string().max(150).optional()).optional(),
102
+ city: z.array(z.string().max(50).optional()).optional(),
103
+ state: z.array(z.string().max(50).optional()).optional(),
104
+ state_code: z.array(z.string().max(50).optional()).optional(),
105
+ country: z.array(z.string().max(50).optional()).optional(),
106
+ zip: z.array(z.string().max(20).optional()).optional(),
107
+ validation_status: z
108
+ .array(z
109
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
110
+ .optional())
111
+ .optional(),
112
+ });
113
+ const CreatePurchaseDiscountsSchema = z.object({
114
+ index: z.array(z.number().int().min(0).optional()).optional(),
115
+ coupon_id: z.array(z.string().max(100).optional()).optional(),
116
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
117
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
118
+ amount: z.array(z.number().int().min(0).optional()).optional(),
119
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
120
+ });
121
+ const CreatePurchaseMetaDataItemSchema = z.looseObject({});
122
+ const CreatePurchaseSubscriptionInfoSchema = z.object({
123
+ index: z.array(z.number().int().min(0).optional()),
124
+ subscription_id: z.array(z.string().max(50).optional()).optional(),
125
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
126
+ contract_term_billing_cycle_on_renewal: z
127
+ .array(z.number().int().min(1).max(100).optional())
128
+ .optional(),
129
+ meta_data: z.array(CreatePurchaseMetaDataItemSchema.optional()).optional(),
130
+ });
131
+ const CreatePurchaseContractTermsSchema = z.object({
132
+ index: z.array(z.number().int().min(0).optional()),
133
+ action_at_term_end: z
134
+ .array(z.enum(['renew', 'evergreen', 'cancel', 'renew_once']).optional())
135
+ .optional(),
136
+ cancellation_cutoff_period: z.array(z.number().int().optional()).optional(),
137
+ });
138
+ const CreatePurchaseBodySchema = z.looseObject({
139
+ customer_id: z.string().max(50),
140
+ payment_source_id: z.string().max(40).optional(),
141
+ replace_primary_payment_source: z.boolean().default(true).optional(),
142
+ invoice_info: CreatePurchaseInvoiceInfoSchema.optional(),
143
+ payment_schedule: CreatePurchasePaymentScheduleSchema.optional(),
144
+ statement_descriptor: CreatePurchaseStatementDescriptorSchema.optional(),
145
+ payment_intent: CreatePurchasePaymentIntentSchema.optional(),
146
+ purchase_items: CreatePurchasePurchaseItemsSchema.optional(),
147
+ item_tiers: CreatePurchaseItemTiersSchema.optional(),
148
+ shipping_addresses: CreatePurchaseShippingAddressesSchema.optional(),
149
+ discounts: CreatePurchaseDiscountsSchema.optional(),
150
+ subscription_info: CreatePurchaseSubscriptionInfoSchema.optional(),
151
+ contract_terms: CreatePurchaseContractTermsSchema.optional(),
152
+ });
153
+ export { CreatePurchaseBodySchema };
154
+ //Purchase.estimate
155
+ const EstimatePurchaseCustomerSchema = z.object({
156
+ vat_number: z.string().max(20).optional(),
157
+ vat_number_prefix: z.string().max(10).optional(),
158
+ registered_for_gst: z.boolean().optional(),
159
+ taxability: z.enum(['taxable', 'exempt']).optional(),
160
+ entity_code: z
161
+ .enum([
162
+ 'a',
163
+ 'b',
164
+ 'c',
165
+ 'd',
166
+ 'e',
167
+ 'f',
168
+ 'g',
169
+ 'h',
170
+ 'i',
171
+ 'j',
172
+ 'k',
173
+ 'l',
174
+ 'm',
175
+ 'n',
176
+ 'p',
177
+ 'q',
178
+ 'r',
179
+ 'med1',
180
+ 'med2',
181
+ ])
182
+ .optional(),
183
+ exempt_number: z.string().max(100).optional(),
184
+ exemption_details: z.array(z.string().optional()).optional(),
185
+ customer_type: z
186
+ .enum(['residential', 'business', 'senior_citizen', 'industrial'])
187
+ .optional(),
188
+ });
189
+ const EstimatePurchaseBillingAddressSchema = z.object({
190
+ line1: z.string().max(150).optional(),
191
+ line2: z.string().max(150).optional(),
192
+ line3: z.string().max(150).optional(),
193
+ city: z.string().max(50).optional(),
194
+ state_code: z.string().max(50).optional(),
195
+ zip: z.string().max(20).optional(),
196
+ country: z.string().max(50).optional(),
197
+ validation_status: z
198
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
199
+ .optional(),
200
+ });
201
+ const EstimatePurchasePurchaseItemsSchema = z.object({
202
+ index: z.array(z.number().int().min(0).optional()),
203
+ item_price_id: z.array(z.string().max(100).optional()),
204
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
205
+ unit_amount: z.array(z.number().int().min(0).optional()).optional(),
206
+ unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
207
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
208
+ });
209
+ const EstimatePurchaseItemTiersSchema = z.object({
210
+ index: z.array(z.number().int().min(0).optional()),
211
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
212
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
213
+ ending_unit: z.array(z.number().int().optional()).optional(),
214
+ price: z.array(z.number().int().min(0).optional()).optional(),
215
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
216
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
217
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
218
+ });
219
+ const EstimatePurchaseShippingAddressesSchema = z.object({
220
+ first_name: z.array(z.string().max(150).optional()).optional(),
221
+ last_name: z.array(z.string().max(150).optional()).optional(),
222
+ email: z.array(z.string().email().max(70).optional()).optional(),
223
+ company: z.array(z.string().max(250).optional()).optional(),
224
+ phone: z.array(z.string().max(50).optional()).optional(),
225
+ line1: z.array(z.string().max(150).optional()).optional(),
226
+ line2: z.array(z.string().max(150).optional()).optional(),
227
+ line3: z.array(z.string().max(150).optional()).optional(),
228
+ city: z.array(z.string().max(50).optional()).optional(),
229
+ state: z.array(z.string().max(50).optional()).optional(),
230
+ state_code: z.array(z.string().max(50).optional()).optional(),
231
+ country: z.array(z.string().max(50).optional()).optional(),
232
+ zip: z.array(z.string().max(20).optional()).optional(),
233
+ validation_status: z
234
+ .array(z
235
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
236
+ .optional())
237
+ .optional(),
238
+ });
239
+ const EstimatePurchaseDiscountsSchema = z.object({
240
+ index: z.array(z.number().int().min(0).optional()).optional(),
241
+ coupon_id: z.array(z.string().max(100).optional()).optional(),
242
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
243
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
244
+ amount: z.array(z.number().int().min(0).optional()).optional(),
245
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
246
+ });
247
+ const EstimatePurchaseSubscriptionInfoSchema = z.object({
248
+ index: z.array(z.number().int().min(0).optional()),
249
+ subscription_id: z.array(z.string().max(50).optional()).optional(),
250
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
251
+ contract_term_billing_cycle_on_renewal: z
252
+ .array(z.number().int().min(1).max(100).optional())
253
+ .optional(),
254
+ });
255
+ const EstimatePurchaseContractTermsSchema = z.object({
256
+ index: z.array(z.number().int().min(0).optional()),
257
+ action_at_term_end: z
258
+ .array(z.enum(['renew', 'evergreen', 'cancel', 'renew_once']).optional())
259
+ .optional(),
260
+ cancellation_cutoff_period: z.array(z.number().int().optional()).optional(),
261
+ });
262
+ const EstimatePurchaseBodySchema = z.looseObject({
263
+ client_profile_id: z.string().max(50).optional(),
264
+ customer_id: z.string().max(50).optional(),
265
+ customer: EstimatePurchaseCustomerSchema.optional(),
266
+ billing_address: EstimatePurchaseBillingAddressSchema.optional(),
267
+ purchase_items: EstimatePurchasePurchaseItemsSchema.optional(),
268
+ item_tiers: EstimatePurchaseItemTiersSchema.optional(),
269
+ shipping_addresses: EstimatePurchaseShippingAddressesSchema.optional(),
270
+ discounts: EstimatePurchaseDiscountsSchema.optional(),
271
+ subscription_info: EstimatePurchaseSubscriptionInfoSchema.optional(),
272
+ contract_terms: EstimatePurchaseContractTermsSchema.optional(),
273
+ });
274
+ export { EstimatePurchaseBodySchema };