ce-storefront 0.12.5 → 0.13.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 (248) 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/generateotpwithemail.d.ts +65 -0
  149. package/esm/models/components/generateotpwithemail.d.ts.map +1 -0
  150. package/esm/models/components/generateotpwithemail.js +65 -0
  151. package/esm/models/components/generateotpwithemail.js.map +1 -0
  152. package/esm/models/components/generateotpwithphone.d.ts +98 -0
  153. package/esm/models/components/generateotpwithphone.d.ts.map +1 -0
  154. package/esm/models/components/generateotpwithphone.js +90 -0
  155. package/esm/models/components/generateotpwithphone.js.map +1 -0
  156. package/esm/models/components/index.d.ts +4 -0
  157. package/esm/models/components/index.d.ts.map +1 -1
  158. package/esm/models/components/index.js +4 -0
  159. package/esm/models/components/index.js.map +1 -1
  160. package/esm/models/components/order.d.ts +6 -181
  161. package/esm/models/components/order.d.ts.map +1 -1
  162. package/esm/models/components/order.js +6 -185
  163. package/esm/models/components/order.js.map +1 -1
  164. package/esm/models/components/orderdetail.d.ts +6 -181
  165. package/esm/models/components/orderdetail.d.ts.map +1 -1
  166. package/esm/models/components/orderdetail.js +6 -185
  167. package/esm/models/components/orderdetail.js.map +1 -1
  168. package/esm/models/operations/generateotp.d.ts +3 -104
  169. package/esm/models/operations/generateotp.d.ts.map +1 -1
  170. package/esm/models/operations/generateotp.js +9 -72
  171. package/esm/models/operations/generateotp.js.map +1 -1
  172. package/esm/models/operations/getshippingmethods.d.ts +0 -21
  173. package/esm/models/operations/getshippingmethods.d.ts.map +1 -1
  174. package/esm/models/operations/getshippingmethods.js +0 -21
  175. package/esm/models/operations/getshippingmethods.js.map +1 -1
  176. package/esm/models/operations/updateshippingmethod.d.ts +9 -33
  177. package/esm/models/operations/updateshippingmethod.d.ts.map +1 -1
  178. package/esm/models/operations/updateshippingmethod.js +6 -27
  179. package/esm/models/operations/updateshippingmethod.js.map +1 -1
  180. package/esm/sdk/shipping.d.ts +2 -1
  181. package/esm/sdk/shipping.d.ts.map +1 -1
  182. package/esm/sdk/shipping.js.map +1 -1
  183. package/jsr.json +1 -1
  184. package/package.json +1 -1
  185. package/src/funcs/authGenerateOtp.ts +17 -2
  186. package/src/funcs/authGetAnonymousToken.ts +2 -0
  187. package/src/funcs/authGetUserDetail.ts +2 -0
  188. package/src/funcs/authLoginWithEmail.ts +2 -0
  189. package/src/funcs/authLoginWithPhone.ts +2 -0
  190. package/src/funcs/authLoginWithWhatsapp.ts +17 -2
  191. package/src/funcs/authLogout.ts +21 -2
  192. package/src/funcs/authRefreshToken.ts +2 -0
  193. package/src/funcs/authUpdateUser.ts +2 -0
  194. package/src/funcs/authVerifyOtp.ts +2 -0
  195. package/src/funcs/cartsAddShippingMethod.ts +2 -0
  196. package/src/funcs/cartsApplyCoupon.ts +2 -0
  197. package/src/funcs/cartsCreateCart.ts +21 -2
  198. package/src/funcs/cartsCreateCartAddress.ts +2 -0
  199. package/src/funcs/cartsDeleteCart.ts +2 -0
  200. package/src/funcs/cartsGetCart.ts +2 -0
  201. package/src/funcs/cartsGetUserCart.ts +2 -0
  202. package/src/funcs/cartsRedeemLoyaltyPoints.ts +2 -0
  203. package/src/funcs/cartsRemoveCoupon.ts +2 -0
  204. package/src/funcs/cartsRemoveLoyaltyPoints.ts +2 -0
  205. package/src/funcs/cartsRemoveUserCart.ts +2 -0
  206. package/src/funcs/cartsUpdateCart.ts +2 -0
  207. package/src/funcs/catalogGetProductDetail.ts +2 -0
  208. package/src/funcs/catalogGetVariantDetail.ts +2 -0
  209. package/src/funcs/catalogListCategories.ts +21 -2
  210. package/src/funcs/catalogListCrosssellProducts.ts +2 -0
  211. package/src/funcs/catalogListProductReviews.ts +2 -0
  212. package/src/funcs/catalogListProductVariants.ts +2 -0
  213. package/src/funcs/catalogListProducts.ts +2 -0
  214. package/src/funcs/catalogListSimilarProducts.ts +2 -0
  215. package/src/funcs/catalogListSkus.ts +2 -0
  216. package/src/funcs/catalogListUpsellProducts.ts +2 -0
  217. package/src/funcs/catalogSearchProducts.ts +2 -0
  218. package/src/funcs/commonListCountryPincodes.ts +21 -2
  219. package/src/funcs/customersCreateAddress.ts +2 -0
  220. package/src/funcs/customersDeleteAddress.ts +2 -0
  221. package/src/funcs/customersGetAddressDetail.ts +2 -0
  222. package/src/funcs/customersGetLoyaltyDetails.ts +2 -0
  223. package/src/funcs/customersListAddresses.ts +21 -2
  224. package/src/funcs/customersListUserReviews.ts +21 -2
  225. package/src/funcs/customersUpdateAddressDetail.ts +2 -0
  226. package/src/funcs/ordersCancelOrder.ts +2 -0
  227. package/src/funcs/ordersCreateOrder.ts +2 -0
  228. package/src/funcs/ordersGetOrderDetail.ts +2 -0
  229. package/src/funcs/ordersGetPaymentStatus.ts +21 -2
  230. package/src/funcs/ordersListOrderShipments.ts +2 -0
  231. package/src/funcs/ordersListOrders.ts +2 -0
  232. package/src/funcs/ordersRetryOrderPayment.ts +2 -0
  233. package/src/funcs/shippingShippingMethods.ts +26 -10
  234. package/src/hooks/types.ts +2 -0
  235. package/src/lib/config.ts +7 -3
  236. package/src/lib/sdks.ts +10 -4
  237. package/src/models/components/appliedcoupon.ts +139 -0
  238. package/src/models/components/appliedpromotion.ts +153 -0
  239. package/src/models/components/cart.ts +20 -265
  240. package/src/models/components/generateotpwithemail.ts +115 -0
  241. package/src/models/components/generateotpwithphone.ts +148 -0
  242. package/src/models/components/index.ts +4 -0
  243. package/src/models/components/order.ts +20 -310
  244. package/src/models/components/orderdetail.ts +20 -319
  245. package/src/models/operations/generateotp.ts +15 -118
  246. package/src/models/operations/getshippingmethods.ts +0 -54
  247. package/src/models/operations/updateshippingmethod.ts +15 -69
  248. 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,153 @@
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 PromotionType = {
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 PromotionType = ClosedEnum<typeof PromotionType>;
20
+
21
+ /**
22
+ * Details about an active promotion applied to a cart/order
23
+ */
24
+ export type AppliedPromotion = {
25
+ promotionId: string;
26
+ promotionType: PromotionType;
27
+ savings: number;
28
+ productId: string | null;
29
+ variantId: string | null;
30
+ productName: string | null;
31
+ variantName: string | null;
32
+ appliedSequence: number;
33
+ scope: string;
34
+ };
35
+
36
+ /** @internal */
37
+ export const PromotionType$inboundSchema: z.ZodNativeEnum<
38
+ typeof PromotionType
39
+ > = z.nativeEnum(PromotionType);
40
+
41
+ /** @internal */
42
+ export const PromotionType$outboundSchema: z.ZodNativeEnum<
43
+ typeof PromotionType
44
+ > = PromotionType$inboundSchema;
45
+
46
+ /**
47
+ * @internal
48
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
49
+ */
50
+ export namespace PromotionType$ {
51
+ /** @deprecated use `PromotionType$inboundSchema` instead. */
52
+ export const inboundSchema = PromotionType$inboundSchema;
53
+ /** @deprecated use `PromotionType$outboundSchema` instead. */
54
+ export const outboundSchema = PromotionType$outboundSchema;
55
+ }
56
+
57
+ /** @internal */
58
+ export const AppliedPromotion$inboundSchema: z.ZodType<
59
+ AppliedPromotion,
60
+ z.ZodTypeDef,
61
+ unknown
62
+ > = z.object({
63
+ promotion_id: z.string(),
64
+ promotion_type: PromotionType$inboundSchema,
65
+ savings: z.number(),
66
+ product_id: z.nullable(z.string()),
67
+ variant_id: z.nullable(z.string()),
68
+ product_name: z.nullable(z.string()),
69
+ variant_name: z.nullable(z.string()),
70
+ applied_sequence: z.number(),
71
+ scope: z.string(),
72
+ }).transform((v) => {
73
+ return remap$(v, {
74
+ "promotion_id": "promotionId",
75
+ "promotion_type": "promotionType",
76
+ "product_id": "productId",
77
+ "variant_id": "variantId",
78
+ "product_name": "productName",
79
+ "variant_name": "variantName",
80
+ "applied_sequence": "appliedSequence",
81
+ });
82
+ });
83
+
84
+ /** @internal */
85
+ export type AppliedPromotion$Outbound = {
86
+ promotion_id: string;
87
+ promotion_type: string;
88
+ savings: number;
89
+ product_id: string | null;
90
+ variant_id: string | null;
91
+ product_name: string | null;
92
+ variant_name: string | null;
93
+ applied_sequence: number;
94
+ scope: string;
95
+ };
96
+
97
+ /** @internal */
98
+ export const AppliedPromotion$outboundSchema: z.ZodType<
99
+ AppliedPromotion$Outbound,
100
+ z.ZodTypeDef,
101
+ AppliedPromotion
102
+ > = z.object({
103
+ promotionId: z.string(),
104
+ promotionType: PromotionType$outboundSchema,
105
+ savings: z.number(),
106
+ productId: z.nullable(z.string()),
107
+ variantId: z.nullable(z.string()),
108
+ productName: z.nullable(z.string()),
109
+ variantName: z.nullable(z.string()),
110
+ appliedSequence: z.number(),
111
+ scope: z.string(),
112
+ }).transform((v) => {
113
+ return remap$(v, {
114
+ promotionId: "promotion_id",
115
+ promotionType: "promotion_type",
116
+ productId: "product_id",
117
+ variantId: "variant_id",
118
+ productName: "product_name",
119
+ variantName: "variant_name",
120
+ appliedSequence: "applied_sequence",
121
+ });
122
+ });
123
+
124
+ /**
125
+ * @internal
126
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
127
+ */
128
+ export namespace AppliedPromotion$ {
129
+ /** @deprecated use `AppliedPromotion$inboundSchema` instead. */
130
+ export const inboundSchema = AppliedPromotion$inboundSchema;
131
+ /** @deprecated use `AppliedPromotion$outboundSchema` instead. */
132
+ export const outboundSchema = AppliedPromotion$outboundSchema;
133
+ /** @deprecated use `AppliedPromotion$Outbound` instead. */
134
+ export type Outbound = AppliedPromotion$Outbound;
135
+ }
136
+
137
+ export function appliedPromotionToJSON(
138
+ appliedPromotion: AppliedPromotion,
139
+ ): string {
140
+ return JSON.stringify(
141
+ AppliedPromotion$outboundSchema.parse(appliedPromotion),
142
+ );
143
+ }
144
+
145
+ export function appliedPromotionFromJSON(
146
+ jsonString: string,
147
+ ): SafeParseResult<AppliedPromotion, SDKValidationError> {
148
+ return safeParse(
149
+ jsonString,
150
+ (x) => AppliedPromotion$inboundSchema.parse(JSON.parse(x)),
151
+ `Failed to parse 'AppliedPromotion' from JSON`,
152
+ );
153
+ }
@@ -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(),