ce-storefront 0.12.5 → 0.13.1

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 (305) hide show
  1. package/docs/sdks/auth/README.md +20 -13
  2. package/docs/sdks/carts/README.md +8 -3
  3. package/docs/sdks/catalog/README.md +6 -3
  4. package/docs/sdks/common/README.md +6 -3
  5. package/docs/sdks/customers/README.md +12 -6
  6. package/docs/sdks/orders/README.md +6 -3
  7. package/docs/sdks/shipping/README.md +15 -6
  8. package/esm/funcs/authGenerateOtp.d.ts +2 -1
  9. package/esm/funcs/authGenerateOtp.d.ts.map +1 -1
  10. package/esm/funcs/authGenerateOtp.js +8 -2
  11. package/esm/funcs/authGenerateOtp.js.map +1 -1
  12. package/esm/funcs/authGetAnonymousToken.js +2 -0
  13. package/esm/funcs/authGetAnonymousToken.js.map +1 -1
  14. package/esm/funcs/authGetUserDetail.js +2 -0
  15. package/esm/funcs/authGetUserDetail.js.map +1 -1
  16. package/esm/funcs/authLoginWithEmail.js +2 -0
  17. package/esm/funcs/authLoginWithEmail.js.map +1 -1
  18. package/esm/funcs/authLoginWithPhone.js +2 -0
  19. package/esm/funcs/authLoginWithPhone.js.map +1 -1
  20. package/esm/funcs/authLoginWithWhatsapp.d.ts +2 -1
  21. package/esm/funcs/authLoginWithWhatsapp.d.ts.map +1 -1
  22. package/esm/funcs/authLoginWithWhatsapp.js +8 -2
  23. package/esm/funcs/authLoginWithWhatsapp.js.map +1 -1
  24. package/esm/funcs/authLogout.d.ts +2 -1
  25. package/esm/funcs/authLogout.d.ts.map +1 -1
  26. package/esm/funcs/authLogout.js +8 -2
  27. package/esm/funcs/authLogout.js.map +1 -1
  28. package/esm/funcs/authRefreshToken.js +2 -0
  29. package/esm/funcs/authRefreshToken.js.map +1 -1
  30. package/esm/funcs/authUpdateUser.js +2 -0
  31. package/esm/funcs/authUpdateUser.js.map +1 -1
  32. package/esm/funcs/authVerifyOtp.js +2 -0
  33. package/esm/funcs/authVerifyOtp.js.map +1 -1
  34. package/esm/funcs/cartsAddShippingMethod.js +2 -0
  35. package/esm/funcs/cartsAddShippingMethod.js.map +1 -1
  36. package/esm/funcs/cartsApplyCoupon.js +2 -0
  37. package/esm/funcs/cartsApplyCoupon.js.map +1 -1
  38. package/esm/funcs/cartsCreateCart.d.ts +2 -1
  39. package/esm/funcs/cartsCreateCart.d.ts.map +1 -1
  40. package/esm/funcs/cartsCreateCart.js +8 -2
  41. package/esm/funcs/cartsCreateCart.js.map +1 -1
  42. package/esm/funcs/cartsCreateCartAddress.js +2 -0
  43. package/esm/funcs/cartsCreateCartAddress.js.map +1 -1
  44. package/esm/funcs/cartsDeleteCart.js +2 -0
  45. package/esm/funcs/cartsDeleteCart.js.map +1 -1
  46. package/esm/funcs/cartsGetCart.js +2 -0
  47. package/esm/funcs/cartsGetCart.js.map +1 -1
  48. package/esm/funcs/cartsGetUserCart.js +2 -0
  49. package/esm/funcs/cartsGetUserCart.js.map +1 -1
  50. package/esm/funcs/cartsRedeemLoyaltyPoints.js +2 -0
  51. package/esm/funcs/cartsRedeemLoyaltyPoints.js.map +1 -1
  52. package/esm/funcs/cartsRemoveCoupon.js +2 -0
  53. package/esm/funcs/cartsRemoveCoupon.js.map +1 -1
  54. package/esm/funcs/cartsRemoveLoyaltyPoints.js +2 -0
  55. package/esm/funcs/cartsRemoveLoyaltyPoints.js.map +1 -1
  56. package/esm/funcs/cartsRemoveUserCart.js +2 -0
  57. package/esm/funcs/cartsRemoveUserCart.js.map +1 -1
  58. package/esm/funcs/cartsUpdateCart.js +2 -0
  59. package/esm/funcs/cartsUpdateCart.js.map +1 -1
  60. package/esm/funcs/catalogGetProductDetail.js +2 -0
  61. package/esm/funcs/catalogGetProductDetail.js.map +1 -1
  62. package/esm/funcs/catalogGetVariantDetail.js +2 -0
  63. package/esm/funcs/catalogGetVariantDetail.js.map +1 -1
  64. package/esm/funcs/catalogListCategories.d.ts +2 -1
  65. package/esm/funcs/catalogListCategories.d.ts.map +1 -1
  66. package/esm/funcs/catalogListCategories.js +8 -2
  67. package/esm/funcs/catalogListCategories.js.map +1 -1
  68. package/esm/funcs/catalogListCrosssellProducts.js +2 -0
  69. package/esm/funcs/catalogListCrosssellProducts.js.map +1 -1
  70. package/esm/funcs/catalogListProductReviews.js +2 -0
  71. package/esm/funcs/catalogListProductReviews.js.map +1 -1
  72. package/esm/funcs/catalogListProductVariants.js +2 -0
  73. package/esm/funcs/catalogListProductVariants.js.map +1 -1
  74. package/esm/funcs/catalogListProducts.js +2 -0
  75. package/esm/funcs/catalogListProducts.js.map +1 -1
  76. package/esm/funcs/catalogListSimilarProducts.js +2 -0
  77. package/esm/funcs/catalogListSimilarProducts.js.map +1 -1
  78. package/esm/funcs/catalogListSkus.js +2 -0
  79. package/esm/funcs/catalogListSkus.js.map +1 -1
  80. package/esm/funcs/catalogListUpsellProducts.js +2 -0
  81. package/esm/funcs/catalogListUpsellProducts.js.map +1 -1
  82. package/esm/funcs/catalogSearchProducts.js +2 -0
  83. package/esm/funcs/catalogSearchProducts.js.map +1 -1
  84. package/esm/funcs/commonListCountryPincodes.d.ts +2 -1
  85. package/esm/funcs/commonListCountryPincodes.d.ts.map +1 -1
  86. package/esm/funcs/commonListCountryPincodes.js +8 -2
  87. package/esm/funcs/commonListCountryPincodes.js.map +1 -1
  88. package/esm/funcs/customersCreateAddress.js +2 -0
  89. package/esm/funcs/customersCreateAddress.js.map +1 -1
  90. package/esm/funcs/customersDeleteAddress.js +2 -0
  91. package/esm/funcs/customersDeleteAddress.js.map +1 -1
  92. package/esm/funcs/customersGetAddressDetail.js +2 -0
  93. package/esm/funcs/customersGetAddressDetail.js.map +1 -1
  94. package/esm/funcs/customersGetLoyaltyDetails.js +2 -0
  95. package/esm/funcs/customersGetLoyaltyDetails.js.map +1 -1
  96. package/esm/funcs/customersListAddresses.d.ts +2 -1
  97. package/esm/funcs/customersListAddresses.d.ts.map +1 -1
  98. package/esm/funcs/customersListAddresses.js +8 -2
  99. package/esm/funcs/customersListAddresses.js.map +1 -1
  100. package/esm/funcs/customersListUserReviews.d.ts +2 -1
  101. package/esm/funcs/customersListUserReviews.d.ts.map +1 -1
  102. package/esm/funcs/customersListUserReviews.js +8 -2
  103. package/esm/funcs/customersListUserReviews.js.map +1 -1
  104. package/esm/funcs/customersUpdateAddressDetail.js +2 -0
  105. package/esm/funcs/customersUpdateAddressDetail.js.map +1 -1
  106. package/esm/funcs/ordersCancelOrder.js +2 -0
  107. package/esm/funcs/ordersCancelOrder.js.map +1 -1
  108. package/esm/funcs/ordersCreateOrder.js +2 -0
  109. package/esm/funcs/ordersCreateOrder.js.map +1 -1
  110. package/esm/funcs/ordersGetOrderDetail.js +2 -0
  111. package/esm/funcs/ordersGetOrderDetail.js.map +1 -1
  112. package/esm/funcs/ordersGetPaymentStatus.d.ts +2 -1
  113. package/esm/funcs/ordersGetPaymentStatus.d.ts.map +1 -1
  114. package/esm/funcs/ordersGetPaymentStatus.js +8 -2
  115. package/esm/funcs/ordersGetPaymentStatus.js.map +1 -1
  116. package/esm/funcs/ordersListOrderShipments.js +2 -0
  117. package/esm/funcs/ordersListOrderShipments.js.map +1 -1
  118. package/esm/funcs/ordersListOrders.js +2 -0
  119. package/esm/funcs/ordersListOrders.js.map +1 -1
  120. package/esm/funcs/ordersRetryOrderPayment.js +2 -0
  121. package/esm/funcs/ordersRetryOrderPayment.js.map +1 -1
  122. package/esm/funcs/shippingShippingMethods.d.ts +3 -1
  123. package/esm/funcs/shippingShippingMethods.d.ts.map +1 -1
  124. package/esm/funcs/shippingShippingMethods.js +11 -6
  125. package/esm/funcs/shippingShippingMethods.js.map +1 -1
  126. package/esm/hooks/types.d.ts +2 -0
  127. package/esm/hooks/types.d.ts.map +1 -1
  128. package/esm/lib/config.d.ts +7 -3
  129. package/esm/lib/config.d.ts.map +1 -1
  130. package/esm/lib/config.js +3 -3
  131. package/esm/lib/config.js.map +1 -1
  132. package/esm/lib/sdks.d.ts +1 -0
  133. package/esm/lib/sdks.d.ts.map +1 -1
  134. package/esm/lib/sdks.js +3 -3
  135. package/esm/lib/sdks.js.map +1 -1
  136. package/esm/models/components/appliedcoupon.d.ts +85 -0
  137. package/esm/models/components/appliedcoupon.d.ts.map +1 -0
  138. package/esm/models/components/appliedcoupon.js +87 -0
  139. package/esm/models/components/appliedcoupon.js.map +1 -0
  140. package/esm/models/components/appliedpromotion.d.ts +83 -0
  141. package/esm/models/components/appliedpromotion.d.ts.map +1 -0
  142. package/esm/models/components/appliedpromotion.js +90 -0
  143. package/esm/models/components/appliedpromotion.js.map +1 -0
  144. package/esm/models/components/cart.d.ts +6 -153
  145. package/esm/models/components/cart.d.ts.map +1 -1
  146. package/esm/models/components/cart.js +6 -161
  147. package/esm/models/components/cart.js.map +1 -1
  148. package/esm/models/components/discountbasedpromotion.d.ts +31 -0
  149. package/esm/models/components/discountbasedpromotion.d.ts.map +1 -1
  150. package/esm/models/components/discountbasedpromotion.js +21 -0
  151. package/esm/models/components/discountbasedpromotion.js.map +1 -1
  152. package/esm/models/components/fixedpricepromotion.d.ts +34 -2
  153. package/esm/models/components/fixedpricepromotion.d.ts.map +1 -1
  154. package/esm/models/components/fixedpricepromotion.js +23 -2
  155. package/esm/models/components/fixedpricepromotion.js.map +1 -1
  156. package/esm/models/components/freegoodspromotion.d.ts +32 -0
  157. package/esm/models/components/freegoodspromotion.d.ts.map +1 -1
  158. package/esm/models/components/freegoodspromotion.js +21 -0
  159. package/esm/models/components/freegoodspromotion.js.map +1 -1
  160. package/esm/models/components/generateotpwithemail.d.ts +65 -0
  161. package/esm/models/components/generateotpwithemail.d.ts.map +1 -0
  162. package/esm/models/components/generateotpwithemail.js +65 -0
  163. package/esm/models/components/generateotpwithemail.js.map +1 -0
  164. package/esm/models/components/generateotpwithphone.d.ts +98 -0
  165. package/esm/models/components/generateotpwithphone.d.ts.map +1 -0
  166. package/esm/models/components/generateotpwithphone.js +90 -0
  167. package/esm/models/components/generateotpwithphone.js.map +1 -0
  168. package/esm/models/components/index.d.ts +4 -0
  169. package/esm/models/components/index.d.ts.map +1 -1
  170. package/esm/models/components/index.js +4 -0
  171. package/esm/models/components/index.js.map +1 -1
  172. package/esm/models/components/item.d.ts +8 -0
  173. package/esm/models/components/item.d.ts.map +1 -1
  174. package/esm/models/components/item.js +5 -0
  175. package/esm/models/components/item.js.map +1 -1
  176. package/esm/models/components/order.d.ts +6 -181
  177. package/esm/models/components/order.d.ts.map +1 -1
  178. package/esm/models/components/order.js +6 -185
  179. package/esm/models/components/order.js.map +1 -1
  180. package/esm/models/components/orderdetail.d.ts +6 -181
  181. package/esm/models/components/orderdetail.d.ts.map +1 -1
  182. package/esm/models/components/orderdetail.js +6 -185
  183. package/esm/models/components/orderdetail.js.map +1 -1
  184. package/esm/models/components/product.d.ts +5 -0
  185. package/esm/models/components/product.d.ts.map +1 -1
  186. package/esm/models/components/product.js +2 -0
  187. package/esm/models/components/product.js.map +1 -1
  188. package/esm/models/components/productbundleitem.d.ts +8 -0
  189. package/esm/models/components/productbundleitem.d.ts.map +1 -1
  190. package/esm/models/components/productbundleitem.js +5 -0
  191. package/esm/models/components/productbundleitem.js.map +1 -1
  192. package/esm/models/components/productdetail.d.ts +5 -0
  193. package/esm/models/components/productdetail.d.ts.map +1 -1
  194. package/esm/models/components/productdetail.js +2 -0
  195. package/esm/models/components/productdetail.js.map +1 -1
  196. package/esm/models/components/productpromotion.d.ts +2 -14
  197. package/esm/models/components/productpromotion.d.ts.map +1 -1
  198. package/esm/models/components/productshipping.d.ts +8 -16
  199. package/esm/models/components/productshipping.d.ts.map +1 -1
  200. package/esm/models/components/productshipping.js +12 -28
  201. package/esm/models/components/productshipping.js.map +1 -1
  202. package/esm/models/components/variant.d.ts +5 -0
  203. package/esm/models/components/variant.d.ts.map +1 -1
  204. package/esm/models/components/variant.js +2 -0
  205. package/esm/models/components/variant.js.map +1 -1
  206. package/esm/models/components/variantdetail.d.ts +5 -0
  207. package/esm/models/components/variantdetail.d.ts.map +1 -1
  208. package/esm/models/components/variantdetail.js +2 -0
  209. package/esm/models/components/variantdetail.js.map +1 -1
  210. package/esm/models/components/volumebasedpromotion.d.ts +34 -2
  211. package/esm/models/components/volumebasedpromotion.d.ts.map +1 -1
  212. package/esm/models/components/volumebasedpromotion.js +23 -2
  213. package/esm/models/components/volumebasedpromotion.js.map +1 -1
  214. package/esm/models/operations/generateotp.d.ts +3 -104
  215. package/esm/models/operations/generateotp.d.ts.map +1 -1
  216. package/esm/models/operations/generateotp.js +9 -72
  217. package/esm/models/operations/generateotp.js.map +1 -1
  218. package/esm/models/operations/getshippingmethods.d.ts +0 -21
  219. package/esm/models/operations/getshippingmethods.d.ts.map +1 -1
  220. package/esm/models/operations/getshippingmethods.js +0 -21
  221. package/esm/models/operations/getshippingmethods.js.map +1 -1
  222. package/esm/models/operations/updateshippingmethod.d.ts +9 -33
  223. package/esm/models/operations/updateshippingmethod.d.ts.map +1 -1
  224. package/esm/models/operations/updateshippingmethod.js +6 -27
  225. package/esm/models/operations/updateshippingmethod.js.map +1 -1
  226. package/esm/sdk/shipping.d.ts +2 -1
  227. package/esm/sdk/shipping.d.ts.map +1 -1
  228. package/esm/sdk/shipping.js.map +1 -1
  229. package/jsr.json +1 -1
  230. package/package.json +1 -1
  231. package/src/funcs/authGenerateOtp.ts +17 -2
  232. package/src/funcs/authGetAnonymousToken.ts +2 -0
  233. package/src/funcs/authGetUserDetail.ts +2 -0
  234. package/src/funcs/authLoginWithEmail.ts +2 -0
  235. package/src/funcs/authLoginWithPhone.ts +2 -0
  236. package/src/funcs/authLoginWithWhatsapp.ts +17 -2
  237. package/src/funcs/authLogout.ts +21 -2
  238. package/src/funcs/authRefreshToken.ts +2 -0
  239. package/src/funcs/authUpdateUser.ts +2 -0
  240. package/src/funcs/authVerifyOtp.ts +2 -0
  241. package/src/funcs/cartsAddShippingMethod.ts +2 -0
  242. package/src/funcs/cartsApplyCoupon.ts +2 -0
  243. package/src/funcs/cartsCreateCart.ts +21 -2
  244. package/src/funcs/cartsCreateCartAddress.ts +2 -0
  245. package/src/funcs/cartsDeleteCart.ts +2 -0
  246. package/src/funcs/cartsGetCart.ts +2 -0
  247. package/src/funcs/cartsGetUserCart.ts +2 -0
  248. package/src/funcs/cartsRedeemLoyaltyPoints.ts +2 -0
  249. package/src/funcs/cartsRemoveCoupon.ts +2 -0
  250. package/src/funcs/cartsRemoveLoyaltyPoints.ts +2 -0
  251. package/src/funcs/cartsRemoveUserCart.ts +2 -0
  252. package/src/funcs/cartsUpdateCart.ts +2 -0
  253. package/src/funcs/catalogGetProductDetail.ts +2 -0
  254. package/src/funcs/catalogGetVariantDetail.ts +2 -0
  255. package/src/funcs/catalogListCategories.ts +21 -2
  256. package/src/funcs/catalogListCrosssellProducts.ts +2 -0
  257. package/src/funcs/catalogListProductReviews.ts +2 -0
  258. package/src/funcs/catalogListProductVariants.ts +2 -0
  259. package/src/funcs/catalogListProducts.ts +2 -0
  260. package/src/funcs/catalogListSimilarProducts.ts +2 -0
  261. package/src/funcs/catalogListSkus.ts +2 -0
  262. package/src/funcs/catalogListUpsellProducts.ts +2 -0
  263. package/src/funcs/catalogSearchProducts.ts +2 -0
  264. package/src/funcs/commonListCountryPincodes.ts +21 -2
  265. package/src/funcs/customersCreateAddress.ts +2 -0
  266. package/src/funcs/customersDeleteAddress.ts +2 -0
  267. package/src/funcs/customersGetAddressDetail.ts +2 -0
  268. package/src/funcs/customersGetLoyaltyDetails.ts +2 -0
  269. package/src/funcs/customersListAddresses.ts +21 -2
  270. package/src/funcs/customersListUserReviews.ts +21 -2
  271. package/src/funcs/customersUpdateAddressDetail.ts +2 -0
  272. package/src/funcs/ordersCancelOrder.ts +2 -0
  273. package/src/funcs/ordersCreateOrder.ts +2 -0
  274. package/src/funcs/ordersGetOrderDetail.ts +2 -0
  275. package/src/funcs/ordersGetPaymentStatus.ts +21 -2
  276. package/src/funcs/ordersListOrderShipments.ts +2 -0
  277. package/src/funcs/ordersListOrders.ts +2 -0
  278. package/src/funcs/ordersRetryOrderPayment.ts +2 -0
  279. package/src/funcs/shippingShippingMethods.ts +26 -10
  280. package/src/hooks/types.ts +2 -0
  281. package/src/lib/config.ts +7 -3
  282. package/src/lib/sdks.ts +10 -4
  283. package/src/models/components/appliedcoupon.ts +139 -0
  284. package/src/models/components/appliedpromotion.ts +155 -0
  285. package/src/models/components/cart.ts +20 -265
  286. package/src/models/components/discountbasedpromotion.ts +30 -1
  287. package/src/models/components/fixedpricepromotion.ts +36 -4
  288. package/src/models/components/freegoodspromotion.ts +33 -1
  289. package/src/models/components/generateotpwithemail.ts +115 -0
  290. package/src/models/components/generateotpwithphone.ts +148 -0
  291. package/src/models/components/index.ts +4 -0
  292. package/src/models/components/item.ts +17 -0
  293. package/src/models/components/order.ts +20 -310
  294. package/src/models/components/orderdetail.ts +20 -319
  295. package/src/models/components/product.ts +7 -0
  296. package/src/models/components/productbundleitem.ts +17 -0
  297. package/src/models/components/productdetail.ts +7 -0
  298. package/src/models/components/productshipping.ts +20 -44
  299. package/src/models/components/variant.ts +7 -0
  300. package/src/models/components/variantdetail.ts +7 -0
  301. package/src/models/components/volumebasedpromotion.ts +37 -4
  302. package/src/models/operations/generateotp.ts +15 -118
  303. package/src/models/operations/getshippingmethods.ts +0 -54
  304. package/src/models/operations/updateshippingmethod.ts +15 -69
  305. package/src/sdk/shipping.ts +2 -1
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export const CouponType = {
13
+ Discount: "discount",
14
+ FreeGoods: "free-goods",
15
+ FixedPrice: "fixed-price",
16
+ FreeShipping: "free-shipping",
17
+ BuyXGetY: "buy-x-get-y",
18
+ VolumeBased: "volume-based",
19
+ AcceleratedRewards: "accelerated-rewards",
20
+ } as const;
21
+ export type CouponType = ClosedEnum<typeof CouponType>;
22
+
23
+ /**
24
+ * Details about an active coupon applied to a cart/order
25
+ */
26
+ export type AppliedCoupon = {
27
+ couponId: string;
28
+ couponType: CouponType;
29
+ savings: number;
30
+ productId: string | null;
31
+ variantId: string | null;
32
+ productName: string | null;
33
+ variantName: string | null;
34
+ };
35
+
36
+ /** @internal */
37
+ export const CouponType$inboundSchema: z.ZodNativeEnum<typeof CouponType> = z
38
+ .nativeEnum(CouponType);
39
+
40
+ /** @internal */
41
+ export const CouponType$outboundSchema: z.ZodNativeEnum<typeof CouponType> =
42
+ CouponType$inboundSchema;
43
+
44
+ /**
45
+ * @internal
46
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
47
+ */
48
+ export namespace CouponType$ {
49
+ /** @deprecated use `CouponType$inboundSchema` instead. */
50
+ export const inboundSchema = CouponType$inboundSchema;
51
+ /** @deprecated use `CouponType$outboundSchema` instead. */
52
+ export const outboundSchema = CouponType$outboundSchema;
53
+ }
54
+
55
+ /** @internal */
56
+ export const AppliedCoupon$inboundSchema: z.ZodType<
57
+ AppliedCoupon,
58
+ z.ZodTypeDef,
59
+ unknown
60
+ > = z.object({
61
+ coupon_id: z.string(),
62
+ coupon_type: CouponType$inboundSchema,
63
+ savings: z.number(),
64
+ product_id: z.nullable(z.string()),
65
+ variant_id: z.nullable(z.string()),
66
+ product_name: z.nullable(z.string()),
67
+ variant_name: z.nullable(z.string()),
68
+ }).transform((v) => {
69
+ return remap$(v, {
70
+ "coupon_id": "couponId",
71
+ "coupon_type": "couponType",
72
+ "product_id": "productId",
73
+ "variant_id": "variantId",
74
+ "product_name": "productName",
75
+ "variant_name": "variantName",
76
+ });
77
+ });
78
+
79
+ /** @internal */
80
+ export type AppliedCoupon$Outbound = {
81
+ coupon_id: string;
82
+ coupon_type: string;
83
+ savings: number;
84
+ product_id: string | null;
85
+ variant_id: string | null;
86
+ product_name: string | null;
87
+ variant_name: string | null;
88
+ };
89
+
90
+ /** @internal */
91
+ export const AppliedCoupon$outboundSchema: z.ZodType<
92
+ AppliedCoupon$Outbound,
93
+ z.ZodTypeDef,
94
+ AppliedCoupon
95
+ > = z.object({
96
+ couponId: z.string(),
97
+ couponType: CouponType$outboundSchema,
98
+ savings: z.number(),
99
+ productId: z.nullable(z.string()),
100
+ variantId: z.nullable(z.string()),
101
+ productName: z.nullable(z.string()),
102
+ variantName: z.nullable(z.string()),
103
+ }).transform((v) => {
104
+ return remap$(v, {
105
+ couponId: "coupon_id",
106
+ couponType: "coupon_type",
107
+ productId: "product_id",
108
+ variantId: "variant_id",
109
+ productName: "product_name",
110
+ variantName: "variant_name",
111
+ });
112
+ });
113
+
114
+ /**
115
+ * @internal
116
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
117
+ */
118
+ export namespace AppliedCoupon$ {
119
+ /** @deprecated use `AppliedCoupon$inboundSchema` instead. */
120
+ export const inboundSchema = AppliedCoupon$inboundSchema;
121
+ /** @deprecated use `AppliedCoupon$outboundSchema` instead. */
122
+ export const outboundSchema = AppliedCoupon$outboundSchema;
123
+ /** @deprecated use `AppliedCoupon$Outbound` instead. */
124
+ export type Outbound = AppliedCoupon$Outbound;
125
+ }
126
+
127
+ export function appliedCouponToJSON(appliedCoupon: AppliedCoupon): string {
128
+ return JSON.stringify(AppliedCoupon$outboundSchema.parse(appliedCoupon));
129
+ }
130
+
131
+ export function appliedCouponFromJSON(
132
+ jsonString: string,
133
+ ): SafeParseResult<AppliedCoupon, SDKValidationError> {
134
+ return safeParse(
135
+ jsonString,
136
+ (x) => AppliedCoupon$inboundSchema.parse(JSON.parse(x)),
137
+ `Failed to parse 'AppliedCoupon' from JSON`,
138
+ );
139
+ }
@@ -0,0 +1,155 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export const AppliedPromotionPromotionType = {
13
+ Discount: "discount",
14
+ FreeGoods: "free-goods",
15
+ FreeShipping: "free-shipping",
16
+ BuyXGetY: "buy-x-get-y",
17
+ VolumeBased: "volume-based",
18
+ } as const;
19
+ export type AppliedPromotionPromotionType = ClosedEnum<
20
+ typeof AppliedPromotionPromotionType
21
+ >;
22
+
23
+ /**
24
+ * Details about an active promotion applied to a cart/order
25
+ */
26
+ export type AppliedPromotion = {
27
+ promotionId: string;
28
+ promotionType: AppliedPromotionPromotionType;
29
+ savings: number;
30
+ productId: string | null;
31
+ variantId: string | null;
32
+ productName: string | null;
33
+ variantName: string | null;
34
+ appliedSequence: number;
35
+ scope: string;
36
+ };
37
+
38
+ /** @internal */
39
+ export const AppliedPromotionPromotionType$inboundSchema: z.ZodNativeEnum<
40
+ typeof AppliedPromotionPromotionType
41
+ > = z.nativeEnum(AppliedPromotionPromotionType);
42
+
43
+ /** @internal */
44
+ export const AppliedPromotionPromotionType$outboundSchema: z.ZodNativeEnum<
45
+ typeof AppliedPromotionPromotionType
46
+ > = AppliedPromotionPromotionType$inboundSchema;
47
+
48
+ /**
49
+ * @internal
50
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
51
+ */
52
+ export namespace AppliedPromotionPromotionType$ {
53
+ /** @deprecated use `AppliedPromotionPromotionType$inboundSchema` instead. */
54
+ export const inboundSchema = AppliedPromotionPromotionType$inboundSchema;
55
+ /** @deprecated use `AppliedPromotionPromotionType$outboundSchema` instead. */
56
+ export const outboundSchema = AppliedPromotionPromotionType$outboundSchema;
57
+ }
58
+
59
+ /** @internal */
60
+ export const AppliedPromotion$inboundSchema: z.ZodType<
61
+ AppliedPromotion,
62
+ z.ZodTypeDef,
63
+ unknown
64
+ > = z.object({
65
+ promotion_id: z.string(),
66
+ promotion_type: AppliedPromotionPromotionType$inboundSchema,
67
+ savings: z.number(),
68
+ product_id: z.nullable(z.string()),
69
+ variant_id: z.nullable(z.string()),
70
+ product_name: z.nullable(z.string()),
71
+ variant_name: z.nullable(z.string()),
72
+ applied_sequence: z.number(),
73
+ scope: z.string(),
74
+ }).transform((v) => {
75
+ return remap$(v, {
76
+ "promotion_id": "promotionId",
77
+ "promotion_type": "promotionType",
78
+ "product_id": "productId",
79
+ "variant_id": "variantId",
80
+ "product_name": "productName",
81
+ "variant_name": "variantName",
82
+ "applied_sequence": "appliedSequence",
83
+ });
84
+ });
85
+
86
+ /** @internal */
87
+ export type AppliedPromotion$Outbound = {
88
+ promotion_id: string;
89
+ promotion_type: string;
90
+ savings: number;
91
+ product_id: string | null;
92
+ variant_id: string | null;
93
+ product_name: string | null;
94
+ variant_name: string | null;
95
+ applied_sequence: number;
96
+ scope: string;
97
+ };
98
+
99
+ /** @internal */
100
+ export const AppliedPromotion$outboundSchema: z.ZodType<
101
+ AppliedPromotion$Outbound,
102
+ z.ZodTypeDef,
103
+ AppliedPromotion
104
+ > = z.object({
105
+ promotionId: z.string(),
106
+ promotionType: AppliedPromotionPromotionType$outboundSchema,
107
+ savings: z.number(),
108
+ productId: z.nullable(z.string()),
109
+ variantId: z.nullable(z.string()),
110
+ productName: z.nullable(z.string()),
111
+ variantName: z.nullable(z.string()),
112
+ appliedSequence: z.number(),
113
+ scope: z.string(),
114
+ }).transform((v) => {
115
+ return remap$(v, {
116
+ promotionId: "promotion_id",
117
+ promotionType: "promotion_type",
118
+ productId: "product_id",
119
+ variantId: "variant_id",
120
+ productName: "product_name",
121
+ variantName: "variant_name",
122
+ appliedSequence: "applied_sequence",
123
+ });
124
+ });
125
+
126
+ /**
127
+ * @internal
128
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
129
+ */
130
+ export namespace AppliedPromotion$ {
131
+ /** @deprecated use `AppliedPromotion$inboundSchema` instead. */
132
+ export const inboundSchema = AppliedPromotion$inboundSchema;
133
+ /** @deprecated use `AppliedPromotion$outboundSchema` instead. */
134
+ export const outboundSchema = AppliedPromotion$outboundSchema;
135
+ /** @deprecated use `AppliedPromotion$Outbound` instead. */
136
+ export type Outbound = AppliedPromotion$Outbound;
137
+ }
138
+
139
+ export function appliedPromotionToJSON(
140
+ appliedPromotion: AppliedPromotion,
141
+ ): string {
142
+ return JSON.stringify(
143
+ AppliedPromotion$outboundSchema.parse(appliedPromotion),
144
+ );
145
+ }
146
+
147
+ export function appliedPromotionFromJSON(
148
+ jsonString: string,
149
+ ): SafeParseResult<AppliedPromotion, SDKValidationError> {
150
+ return safeParse(
151
+ jsonString,
152
+ (x) => AppliedPromotion$inboundSchema.parse(JSON.parse(x)),
153
+ `Failed to parse 'AppliedPromotion' from JSON`,
154
+ );
155
+ }
@@ -5,9 +5,20 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
- import { ClosedEnum } from "../../types/enums.js";
9
8
  import { Result as SafeParseResult } from "../../types/fp.js";
10
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ AppliedCoupon,
12
+ AppliedCoupon$inboundSchema,
13
+ AppliedCoupon$Outbound,
14
+ AppliedCoupon$outboundSchema,
15
+ } from "./appliedcoupon.js";
16
+ import {
17
+ AppliedPromotion,
18
+ AppliedPromotion$inboundSchema,
19
+ AppliedPromotion$Outbound,
20
+ AppliedPromotion$outboundSchema,
21
+ } from "./appliedpromotion.js";
11
22
  import {
12
23
  CartItem,
13
24
  CartItem$inboundSchema,
@@ -27,46 +38,6 @@ import {
27
38
  CustomerAddress$outboundSchema,
28
39
  } from "./customeraddress.js";
29
40
 
30
- export const PromotionType = {
31
- Discount: "discount",
32
- FreeGoods: "free-goods",
33
- FreeShipping: "free-shipping",
34
- BuyXGetY: "buy-x-get-y",
35
- VolumeBased: "volume-based",
36
- } as const;
37
- export type PromotionType = ClosedEnum<typeof PromotionType>;
38
-
39
- export type AppliedPromotions = {
40
- promotionId: string;
41
- promotionType: PromotionType;
42
- savings: number;
43
- productId: string | null;
44
- productName: string | null;
45
- variantId: string | null;
46
- variantName: string | null;
47
- };
48
-
49
- export const CouponType = {
50
- Discount: "discount",
51
- FreeGoods: "free-goods",
52
- FixedPrice: "fixed-price",
53
- FreeShipping: "free-shipping",
54
- BuyXGetY: "buy-x-get-y",
55
- VolumeBased: "volume-based",
56
- AcceleratedRewards: "accelerated-rewards",
57
- } as const;
58
- export type CouponType = ClosedEnum<typeof CouponType>;
59
-
60
- export type AppliedCoupons = {
61
- couponId: string;
62
- couponType: CouponType;
63
- savings: number;
64
- productId: string | null;
65
- productName: string | null;
66
- variantId: string | null;
67
- variantName: string | null;
68
- };
69
-
70
41
  /**
71
42
  * This cart model is structured to capture a wide range of details, facilitating accurate representation and management of user shopping carts in an e-commerce platform.
72
43
  */
@@ -205,233 +176,17 @@ export type Cart = {
205
176
  /**
206
177
  * Information about the promotional offers that have been applied to the cart.
207
178
  */
208
- appliedPromotions: Array<AppliedPromotions>;
179
+ appliedPromotions: Array<AppliedPromotion>;
209
180
  /**
210
181
  * This key provides details about the savings in cart after coupon have been applied to the cart.
211
182
  */
212
- appliedCoupons: Array<AppliedCoupons>;
183
+ appliedCoupons: Array<AppliedCoupon>;
213
184
  promotionSavings: number;
214
185
  couponSavings: number;
215
186
  otherSavings: number;
216
187
  totalSavings: number;
217
188
  };
218
189
 
219
- /** @internal */
220
- export const PromotionType$inboundSchema: z.ZodNativeEnum<
221
- typeof PromotionType
222
- > = z.nativeEnum(PromotionType);
223
-
224
- /** @internal */
225
- export const PromotionType$outboundSchema: z.ZodNativeEnum<
226
- typeof PromotionType
227
- > = PromotionType$inboundSchema;
228
-
229
- /**
230
- * @internal
231
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
232
- */
233
- export namespace PromotionType$ {
234
- /** @deprecated use `PromotionType$inboundSchema` instead. */
235
- export const inboundSchema = PromotionType$inboundSchema;
236
- /** @deprecated use `PromotionType$outboundSchema` instead. */
237
- export const outboundSchema = PromotionType$outboundSchema;
238
- }
239
-
240
- /** @internal */
241
- export const AppliedPromotions$inboundSchema: z.ZodType<
242
- AppliedPromotions,
243
- z.ZodTypeDef,
244
- unknown
245
- > = z.object({
246
- promotion_id: z.string(),
247
- promotion_type: PromotionType$inboundSchema,
248
- savings: z.number(),
249
- product_id: z.nullable(z.string()),
250
- product_name: z.nullable(z.string()),
251
- variant_id: z.nullable(z.string()),
252
- variant_name: z.nullable(z.string()),
253
- }).transform((v) => {
254
- return remap$(v, {
255
- "promotion_id": "promotionId",
256
- "promotion_type": "promotionType",
257
- "product_id": "productId",
258
- "product_name": "productName",
259
- "variant_id": "variantId",
260
- "variant_name": "variantName",
261
- });
262
- });
263
-
264
- /** @internal */
265
- export type AppliedPromotions$Outbound = {
266
- promotion_id: string;
267
- promotion_type: string;
268
- savings: number;
269
- product_id: string | null;
270
- product_name: string | null;
271
- variant_id: string | null;
272
- variant_name: string | null;
273
- };
274
-
275
- /** @internal */
276
- export const AppliedPromotions$outboundSchema: z.ZodType<
277
- AppliedPromotions$Outbound,
278
- z.ZodTypeDef,
279
- AppliedPromotions
280
- > = z.object({
281
- promotionId: z.string(),
282
- promotionType: PromotionType$outboundSchema,
283
- savings: z.number(),
284
- productId: z.nullable(z.string()),
285
- productName: z.nullable(z.string()),
286
- variantId: z.nullable(z.string()),
287
- variantName: z.nullable(z.string()),
288
- }).transform((v) => {
289
- return remap$(v, {
290
- promotionId: "promotion_id",
291
- promotionType: "promotion_type",
292
- productId: "product_id",
293
- productName: "product_name",
294
- variantId: "variant_id",
295
- variantName: "variant_name",
296
- });
297
- });
298
-
299
- /**
300
- * @internal
301
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
302
- */
303
- export namespace AppliedPromotions$ {
304
- /** @deprecated use `AppliedPromotions$inboundSchema` instead. */
305
- export const inboundSchema = AppliedPromotions$inboundSchema;
306
- /** @deprecated use `AppliedPromotions$outboundSchema` instead. */
307
- export const outboundSchema = AppliedPromotions$outboundSchema;
308
- /** @deprecated use `AppliedPromotions$Outbound` instead. */
309
- export type Outbound = AppliedPromotions$Outbound;
310
- }
311
-
312
- export function appliedPromotionsToJSON(
313
- appliedPromotions: AppliedPromotions,
314
- ): string {
315
- return JSON.stringify(
316
- AppliedPromotions$outboundSchema.parse(appliedPromotions),
317
- );
318
- }
319
-
320
- export function appliedPromotionsFromJSON(
321
- jsonString: string,
322
- ): SafeParseResult<AppliedPromotions, SDKValidationError> {
323
- return safeParse(
324
- jsonString,
325
- (x) => AppliedPromotions$inboundSchema.parse(JSON.parse(x)),
326
- `Failed to parse 'AppliedPromotions' from JSON`,
327
- );
328
- }
329
-
330
- /** @internal */
331
- export const CouponType$inboundSchema: z.ZodNativeEnum<typeof CouponType> = z
332
- .nativeEnum(CouponType);
333
-
334
- /** @internal */
335
- export const CouponType$outboundSchema: z.ZodNativeEnum<typeof CouponType> =
336
- CouponType$inboundSchema;
337
-
338
- /**
339
- * @internal
340
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
341
- */
342
- export namespace CouponType$ {
343
- /** @deprecated use `CouponType$inboundSchema` instead. */
344
- export const inboundSchema = CouponType$inboundSchema;
345
- /** @deprecated use `CouponType$outboundSchema` instead. */
346
- export const outboundSchema = CouponType$outboundSchema;
347
- }
348
-
349
- /** @internal */
350
- export const AppliedCoupons$inboundSchema: z.ZodType<
351
- AppliedCoupons,
352
- z.ZodTypeDef,
353
- unknown
354
- > = z.object({
355
- coupon_id: z.string(),
356
- coupon_type: CouponType$inboundSchema,
357
- savings: z.number(),
358
- product_id: z.nullable(z.string()),
359
- product_name: z.nullable(z.string()),
360
- variant_id: z.nullable(z.string()),
361
- variant_name: z.nullable(z.string()),
362
- }).transform((v) => {
363
- return remap$(v, {
364
- "coupon_id": "couponId",
365
- "coupon_type": "couponType",
366
- "product_id": "productId",
367
- "product_name": "productName",
368
- "variant_id": "variantId",
369
- "variant_name": "variantName",
370
- });
371
- });
372
-
373
- /** @internal */
374
- export type AppliedCoupons$Outbound = {
375
- coupon_id: string;
376
- coupon_type: string;
377
- savings: number;
378
- product_id: string | null;
379
- product_name: string | null;
380
- variant_id: string | null;
381
- variant_name: string | null;
382
- };
383
-
384
- /** @internal */
385
- export const AppliedCoupons$outboundSchema: z.ZodType<
386
- AppliedCoupons$Outbound,
387
- z.ZodTypeDef,
388
- AppliedCoupons
389
- > = z.object({
390
- couponId: z.string(),
391
- couponType: CouponType$outboundSchema,
392
- savings: z.number(),
393
- productId: z.nullable(z.string()),
394
- productName: z.nullable(z.string()),
395
- variantId: z.nullable(z.string()),
396
- variantName: z.nullable(z.string()),
397
- }).transform((v) => {
398
- return remap$(v, {
399
- couponId: "coupon_id",
400
- couponType: "coupon_type",
401
- productId: "product_id",
402
- productName: "product_name",
403
- variantId: "variant_id",
404
- variantName: "variant_name",
405
- });
406
- });
407
-
408
- /**
409
- * @internal
410
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
411
- */
412
- export namespace AppliedCoupons$ {
413
- /** @deprecated use `AppliedCoupons$inboundSchema` instead. */
414
- export const inboundSchema = AppliedCoupons$inboundSchema;
415
- /** @deprecated use `AppliedCoupons$outboundSchema` instead. */
416
- export const outboundSchema = AppliedCoupons$outboundSchema;
417
- /** @deprecated use `AppliedCoupons$Outbound` instead. */
418
- export type Outbound = AppliedCoupons$Outbound;
419
- }
420
-
421
- export function appliedCouponsToJSON(appliedCoupons: AppliedCoupons): string {
422
- return JSON.stringify(AppliedCoupons$outboundSchema.parse(appliedCoupons));
423
- }
424
-
425
- export function appliedCouponsFromJSON(
426
- jsonString: string,
427
- ): SafeParseResult<AppliedCoupons, SDKValidationError> {
428
- return safeParse(
429
- jsonString,
430
- (x) => AppliedCoupons$inboundSchema.parse(JSON.parse(x)),
431
- `Failed to parse 'AppliedCoupons' from JSON`,
432
- );
433
- }
434
-
435
190
  /** @internal */
436
191
  export const Cart$inboundSchema: z.ZodType<Cart, z.ZodTypeDef, unknown> = z
437
192
  .object({
@@ -476,8 +231,8 @@ export const Cart$inboundSchema: z.ZodType<Cart, z.ZodTypeDef, unknown> = z
476
231
  expires_at: z.nullable(
477
232
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
478
233
  ),
479
- applied_promotions: z.array(z.lazy(() => AppliedPromotions$inboundSchema)),
480
- applied_coupons: z.array(z.lazy(() => AppliedCoupons$inboundSchema)),
234
+ applied_promotions: z.array(AppliedPromotion$inboundSchema),
235
+ applied_coupons: z.array(AppliedCoupon$inboundSchema),
481
236
  promotion_savings: z.number(),
482
237
  coupon_savings: z.number(),
483
238
  other_savings: z.number(),
@@ -568,8 +323,8 @@ export type Cart$Outbound = {
568
323
  currency: Currency$Outbound;
569
324
  metadata: { [k: string]: string } | null;
570
325
  expires_at: string | null;
571
- applied_promotions: Array<AppliedPromotions$Outbound>;
572
- applied_coupons: Array<AppliedCoupons$Outbound>;
326
+ applied_promotions: Array<AppliedPromotion$Outbound>;
327
+ applied_coupons: Array<AppliedCoupon$Outbound>;
573
328
  promotion_savings: number;
574
329
  coupon_savings: number;
575
330
  other_savings: number;
@@ -618,8 +373,8 @@ export const Cart$outboundSchema: z.ZodType<Cart$Outbound, z.ZodTypeDef, Cart> =
618
373
  currency: Currency$outboundSchema,
619
374
  metadata: z.nullable(z.record(z.string())),
620
375
  expiresAt: z.nullable(z.date().transform(v => v.toISOString())),
621
- appliedPromotions: z.array(z.lazy(() => AppliedPromotions$outboundSchema)),
622
- appliedCoupons: z.array(z.lazy(() => AppliedCoupons$outboundSchema)),
376
+ appliedPromotions: z.array(AppliedPromotion$outboundSchema),
377
+ appliedCoupons: z.array(AppliedCoupon$outboundSchema),
623
378
  promotionSavings: z.number(),
624
379
  couponSavings: z.number(),
625
380
  otherSavings: z.number(),
@@ -9,6 +9,14 @@ import { ClosedEnum } from "../../types/enums.js";
9
9
  import { Result as SafeParseResult } from "../../types/fp.js";
10
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
11
 
12
+ export const PromotionType = {
13
+ Discount: "discount",
14
+ VolumeBased: "volume-based",
15
+ FixedPrice: "fixed-price",
16
+ FreeGoods: "free-goods",
17
+ } as const;
18
+ export type PromotionType = ClosedEnum<typeof PromotionType>;
19
+
12
20
  export const DiscountType = {
13
21
  Percentage: "percentage",
14
22
  FixedAmount: "fixed-amount",
@@ -28,6 +36,27 @@ export type DiscountBasedPromotion = {
28
36
  discountFixedAmount?: number | undefined;
29
37
  };
30
38
 
39
+ /** @internal */
40
+ export const PromotionType$inboundSchema: z.ZodNativeEnum<
41
+ typeof PromotionType
42
+ > = z.nativeEnum(PromotionType);
43
+
44
+ /** @internal */
45
+ export const PromotionType$outboundSchema: z.ZodNativeEnum<
46
+ typeof PromotionType
47
+ > = PromotionType$inboundSchema;
48
+
49
+ /**
50
+ * @internal
51
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
52
+ */
53
+ export namespace PromotionType$ {
54
+ /** @deprecated use `PromotionType$inboundSchema` instead. */
55
+ export const inboundSchema = PromotionType$inboundSchema;
56
+ /** @deprecated use `PromotionType$outboundSchema` instead. */
57
+ export const outboundSchema = PromotionType$outboundSchema;
58
+ }
59
+
31
60
  /** @internal */
32
61
  export const DiscountType$inboundSchema: z.ZodNativeEnum<typeof DiscountType> =
33
62
  z.nativeEnum(DiscountType);
@@ -80,7 +109,7 @@ export const DiscountBasedPromotion$outboundSchema: z.ZodType<
80
109
  z.ZodTypeDef,
81
110
  DiscountBasedPromotion
82
111
  > = z.object({
83
- promotionType: z.literal("discount").default("discount" as const),
112
+ promotionType: z.literal("discount").default("discount"),
84
113
  discountType: DiscountType$outboundSchema,
85
114
  discountPercent: z.number().optional(),
86
115
  discountFixedAmount: z.number().int().optional(),