ce-storefront 0.5.0 → 0.5.2

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 (144) hide show
  1. package/README.md +12 -11
  2. package/docs/sdks/carts/README.md +480 -5
  3. package/docs/sdks/customers/README.md +4 -0
  4. package/esm/funcs/cartsApplyCoupon.d.ts +16 -0
  5. package/esm/funcs/cartsApplyCoupon.d.ts.map +1 -0
  6. package/esm/funcs/{checkoutApplyCoupon.js → cartsApplyCoupon.js} +12 -6
  7. package/esm/funcs/cartsApplyCoupon.js.map +1 -0
  8. package/esm/funcs/{checkoutCreateCheckoutAddress.d.ts → cartsCreateCartAddress.d.ts} +2 -2
  9. package/esm/funcs/cartsCreateCartAddress.d.ts.map +1 -0
  10. package/esm/funcs/{checkoutCreateCheckoutAddress.js → cartsCreateCartAddress.js} +16 -12
  11. package/esm/funcs/cartsCreateCartAddress.js.map +1 -0
  12. package/esm/funcs/cartsDeleteCart.js +2 -2
  13. package/esm/funcs/cartsDeleteCart.js.map +1 -1
  14. package/esm/funcs/cartsGetCart.d.ts +1 -1
  15. package/esm/funcs/cartsGetCart.js +3 -3
  16. package/esm/funcs/cartsGetCart.js.map +1 -1
  17. package/esm/funcs/cartsGetUserCart.d.ts +16 -0
  18. package/esm/funcs/cartsGetUserCart.d.ts.map +1 -0
  19. package/esm/funcs/cartsGetUserCart.js +85 -0
  20. package/esm/funcs/cartsGetUserCart.js.map +1 -0
  21. package/esm/funcs/{checkoutRemoveCoupon.d.ts → cartsRemoveCoupon.d.ts} +2 -2
  22. package/esm/funcs/cartsRemoveCoupon.d.ts.map +1 -0
  23. package/esm/funcs/{checkoutRemoveCoupon.js → cartsRemoveCoupon.js} +12 -7
  24. package/esm/funcs/{checkoutRemoveCoupon.js.map → cartsRemoveCoupon.js.map} +1 -1
  25. package/esm/funcs/{checkoutApplyCoupon.d.ts → cartsRemoveUserCart.d.ts} +4 -4
  26. package/esm/funcs/{checkoutApplyCoupon.d.ts.map → cartsRemoveUserCart.d.ts.map} +1 -1
  27. package/esm/funcs/cartsRemoveUserCart.js +85 -0
  28. package/esm/funcs/cartsRemoveUserCart.js.map +1 -0
  29. package/esm/lib/config.d.ts +3 -3
  30. package/esm/lib/config.js +3 -3
  31. package/esm/models/components/cart.d.ts +4 -4
  32. package/esm/models/components/cart.d.ts.map +1 -1
  33. package/esm/models/components/cart.js +4 -4
  34. package/esm/models/components/cart.js.map +1 -1
  35. package/esm/models/components/cartitem.d.ts +0 -5
  36. package/esm/models/components/cartitem.d.ts.map +1 -1
  37. package/esm/models/components/cartitem.js +0 -2
  38. package/esm/models/components/cartitem.js.map +1 -1
  39. package/esm/models/components/customeraddress.d.ts +7 -4
  40. package/esm/models/components/customeraddress.d.ts.map +1 -1
  41. package/esm/models/components/customeraddress.js +4 -4
  42. package/esm/models/components/customeraddress.js.map +1 -1
  43. package/esm/models/components/customeraddressinput.d.ts +7 -2
  44. package/esm/models/components/customeraddressinput.d.ts.map +1 -1
  45. package/esm/models/components/customeraddressinput.js +4 -2
  46. package/esm/models/components/customeraddressinput.js.map +1 -1
  47. package/esm/models/operations/applycoupon.d.ts +30 -2
  48. package/esm/models/operations/applycoupon.d.ts.map +1 -1
  49. package/esm/models/operations/applycoupon.js +35 -4
  50. package/esm/models/operations/applycoupon.js.map +1 -1
  51. package/esm/models/operations/createaddress.d.ts +7 -2
  52. package/esm/models/operations/createaddress.d.ts.map +1 -1
  53. package/esm/models/operations/createaddress.js +4 -2
  54. package/esm/models/operations/createaddress.js.map +1 -1
  55. package/esm/models/operations/createcartaddress.d.ts +183 -0
  56. package/esm/models/operations/createcartaddress.d.ts.map +1 -0
  57. package/esm/models/operations/createcartaddress.js +214 -0
  58. package/esm/models/operations/createcartaddress.js.map +1 -0
  59. package/esm/models/operations/deletecart.d.ts +3 -3
  60. package/esm/models/operations/deletecart.d.ts.map +1 -1
  61. package/esm/models/operations/deletecart.js +2 -11
  62. package/esm/models/operations/deletecart.js.map +1 -1
  63. package/esm/models/operations/deleteusercart.d.ts +63 -0
  64. package/esm/models/operations/deleteusercart.d.ts.map +1 -0
  65. package/esm/models/operations/deleteusercart.js +77 -0
  66. package/esm/models/operations/deleteusercart.js.map +1 -0
  67. package/esm/models/operations/getaddressdetail.d.ts +7 -4
  68. package/esm/models/operations/getaddressdetail.d.ts.map +1 -1
  69. package/esm/models/operations/getaddressdetail.js +4 -4
  70. package/esm/models/operations/getaddressdetail.js.map +1 -1
  71. package/esm/models/operations/getcart.d.ts +3 -3
  72. package/esm/models/operations/getcart.d.ts.map +1 -1
  73. package/esm/models/operations/getcart.js +2 -11
  74. package/esm/models/operations/getcart.js.map +1 -1
  75. package/esm/models/operations/getusercart.d.ts +94 -0
  76. package/esm/models/operations/getusercart.d.ts.map +1 -0
  77. package/esm/models/operations/getusercart.js +105 -0
  78. package/esm/models/operations/getusercart.js.map +1 -0
  79. package/esm/models/operations/index.d.ts +3 -1
  80. package/esm/models/operations/index.d.ts.map +1 -1
  81. package/esm/models/operations/index.js +3 -1
  82. package/esm/models/operations/index.js.map +1 -1
  83. package/esm/models/operations/listaddresses.d.ts +7 -4
  84. package/esm/models/operations/listaddresses.d.ts.map +1 -1
  85. package/esm/models/operations/listaddresses.js +4 -4
  86. package/esm/models/operations/listaddresses.js.map +1 -1
  87. package/esm/models/operations/removecoupon.d.ts +18 -17
  88. package/esm/models/operations/removecoupon.d.ts.map +1 -1
  89. package/esm/models/operations/removecoupon.js +15 -28
  90. package/esm/models/operations/removecoupon.js.map +1 -1
  91. package/esm/models/operations/updateaddressdetail.d.ts +7 -2
  92. package/esm/models/operations/updateaddressdetail.d.ts.map +1 -1
  93. package/esm/models/operations/updateaddressdetail.js +4 -2
  94. package/esm/models/operations/updateaddressdetail.js.map +1 -1
  95. package/esm/sdk/carts.d.ts +36 -1
  96. package/esm/sdk/carts.d.ts.map +1 -1
  97. package/esm/sdk/carts.js +51 -1
  98. package/esm/sdk/carts.js.map +1 -1
  99. package/esm/sdk/sdk.d.ts +0 -3
  100. package/esm/sdk/sdk.d.ts.map +1 -1
  101. package/esm/sdk/sdk.js +0 -4
  102. package/esm/sdk/sdk.js.map +1 -1
  103. package/jsr.json +1 -1
  104. package/package.json +1 -1
  105. package/src/funcs/{checkoutApplyCoupon.ts → cartsApplyCoupon.ts} +13 -6
  106. package/src/funcs/{checkoutCreateCheckoutAddress.ts → cartsCreateCartAddress.ts} +19 -15
  107. package/src/funcs/cartsDeleteCart.ts +2 -2
  108. package/src/funcs/cartsGetCart.ts +3 -3
  109. package/src/funcs/cartsGetUserCart.ts +149 -0
  110. package/src/funcs/{checkoutRemoveCoupon.ts → cartsRemoveCoupon.ts} +13 -7
  111. package/src/funcs/cartsRemoveUserCart.ts +149 -0
  112. package/src/lib/config.ts +3 -3
  113. package/src/models/components/cart.ts +9 -9
  114. package/src/models/components/cartitem.ts +0 -7
  115. package/src/models/components/customeraddress.ts +11 -8
  116. package/src/models/components/customeraddressinput.ts +11 -4
  117. package/src/models/operations/applycoupon.ts +73 -6
  118. package/src/models/operations/createaddress.ts +11 -4
  119. package/src/models/operations/{createcheckoutaddress.ts → createcartaddress.ts} +152 -85
  120. package/src/models/operations/deletecart.ts +5 -14
  121. package/src/models/operations/deleteusercart.ts +154 -0
  122. package/src/models/operations/getaddressdetail.ts +11 -8
  123. package/src/models/operations/getcart.ts +5 -14
  124. package/src/models/operations/getusercart.ts +220 -0
  125. package/src/models/operations/index.ts +3 -1
  126. package/src/models/operations/listaddresses.ts +11 -8
  127. package/src/models/operations/removecoupon.ts +28 -40
  128. package/src/models/operations/updateaddressdetail.ts +11 -4
  129. package/src/sdk/carts.ts +91 -1
  130. package/src/sdk/sdk.ts +0 -6
  131. package/docs/sdks/checkout/README.md +0 -310
  132. package/esm/funcs/checkoutApplyCoupon.js.map +0 -1
  133. package/esm/funcs/checkoutCreateCheckoutAddress.d.ts.map +0 -1
  134. package/esm/funcs/checkoutCreateCheckoutAddress.js.map +0 -1
  135. package/esm/funcs/checkoutRemoveCoupon.d.ts.map +0 -1
  136. package/esm/models/operations/createcheckoutaddress.d.ts +0 -154
  137. package/esm/models/operations/createcheckoutaddress.d.ts.map +0 -1
  138. package/esm/models/operations/createcheckoutaddress.js +0 -181
  139. package/esm/models/operations/createcheckoutaddress.js.map +0 -1
  140. package/esm/sdk/checkout.d.ts +0 -26
  141. package/esm/sdk/checkout.d.ts.map +0 -1
  142. package/esm/sdk/checkout.js +0 -38
  143. package/esm/sdk/checkout.js.map +0 -1
  144. package/src/sdk/checkout.ts +0 -63
@@ -24,8 +24,12 @@ export const UpdateAddressDetailServerList = [
24
24
  * payload for address update
25
25
  */
26
26
  export type UpdateAddressDetailRequestBody = {
27
+ /**
28
+ * null value for guest checkout.
29
+ */
30
+ id: string | null;
27
31
  firstName: string;
28
- lastName: string;
32
+ lastName: string | null;
29
33
  /**
30
34
  * Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.
31
35
  *
@@ -90,8 +94,9 @@ export const UpdateAddressDetailRequestBody$inboundSchema: z.ZodType<
90
94
  z.ZodTypeDef,
91
95
  unknown
92
96
  > = z.object({
97
+ id: z.nullable(z.string()),
93
98
  first_name: z.string(),
94
- last_name: z.string(),
99
+ last_name: z.nullable(z.string()),
95
100
  country_code: z.string(),
96
101
  phone: z.string(),
97
102
  email: z.string(),
@@ -122,8 +127,9 @@ export const UpdateAddressDetailRequestBody$inboundSchema: z.ZodType<
122
127
 
123
128
  /** @internal */
124
129
  export type UpdateAddressDetailRequestBody$Outbound = {
130
+ id: string | null;
125
131
  first_name: string;
126
- last_name: string;
132
+ last_name: string | null;
127
133
  country_code: string;
128
134
  phone: string;
129
135
  email: string;
@@ -146,8 +152,9 @@ export const UpdateAddressDetailRequestBody$outboundSchema: z.ZodType<
146
152
  z.ZodTypeDef,
147
153
  UpdateAddressDetailRequestBody
148
154
  > = z.object({
155
+ id: z.nullable(z.string()),
149
156
  firstName: z.string(),
150
- lastName: z.string(),
157
+ lastName: z.nullable(z.string()),
151
158
  countryCode: z.string(),
152
159
  phone: z.string(),
153
160
  email: z.string(),
package/src/sdk/carts.ts CHANGED
@@ -2,9 +2,14 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { cartsApplyCoupon } from "../funcs/cartsApplyCoupon.js";
5
6
  import { cartsCreateCart } from "../funcs/cartsCreateCart.js";
7
+ import { cartsCreateCartAddress } from "../funcs/cartsCreateCartAddress.js";
6
8
  import { cartsDeleteCart } from "../funcs/cartsDeleteCart.js";
7
9
  import { cartsGetCart } from "../funcs/cartsGetCart.js";
10
+ import { cartsGetUserCart } from "../funcs/cartsGetUserCart.js";
11
+ import { cartsRemoveCoupon } from "../funcs/cartsRemoveCoupon.js";
12
+ import { cartsRemoveUserCart } from "../funcs/cartsRemoveUserCart.js";
8
13
  import { cartsUpdateCart } from "../funcs/cartsUpdateCart.js";
9
14
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
10
15
  import * as operations from "../models/operations/index.js";
@@ -29,7 +34,7 @@ export class Carts extends ClientSDK {
29
34
  }
30
35
 
31
36
  /**
32
- * Retrieve cart details
37
+ * Retrieve cart detail
33
38
  *
34
39
  * @remarks
35
40
  * Retrieve cart detail
@@ -62,6 +67,40 @@ export class Carts extends ClientSDK {
62
67
  ));
63
68
  }
64
69
 
70
+ /**
71
+ * Retrieve cart using user id
72
+ *
73
+ * @remarks
74
+ * Retrieve cart detail using user id
75
+ */
76
+ async getUserCart(
77
+ request: operations.GetUserCartRequest,
78
+ options?: RequestOptions,
79
+ ): Promise<operations.GetUserCartResponseBody> {
80
+ return unwrapAsync(cartsGetUserCart(
81
+ this,
82
+ request,
83
+ options,
84
+ ));
85
+ }
86
+
87
+ /**
88
+ * Delete cart using user id
89
+ *
90
+ * @remarks
91
+ * delete all items from the cart using user id.
92
+ */
93
+ async removeUserCart(
94
+ request: operations.DeleteUserCartRequest,
95
+ options?: RequestOptions,
96
+ ): Promise<operations.DeleteUserCartResponseBody> {
97
+ return unwrapAsync(cartsRemoveUserCart(
98
+ this,
99
+ request,
100
+ options,
101
+ ));
102
+ }
103
+
65
104
  /**
66
105
  * Add/delete cart item
67
106
  *
@@ -78,4 +117,55 @@ export class Carts extends ClientSDK {
78
117
  options,
79
118
  ));
80
119
  }
120
+
121
+ /**
122
+ * Update cart address
123
+ *
124
+ * @remarks
125
+ * Update billing and shipping address
126
+ */
127
+ async createCartAddress(
128
+ request: operations.CreateCartAddressRequest,
129
+ options?: RequestOptions,
130
+ ): Promise<operations.CreateCartAddressResponseBody> {
131
+ return unwrapAsync(cartsCreateCartAddress(
132
+ this,
133
+ request,
134
+ options,
135
+ ));
136
+ }
137
+
138
+ /**
139
+ * Apply coupon
140
+ *
141
+ * @remarks
142
+ * Apply coupon
143
+ */
144
+ async applyCoupon(
145
+ request: operations.ApplyCouponRequest,
146
+ options?: RequestOptions,
147
+ ): Promise<operations.ApplyCouponResponseBody> {
148
+ return unwrapAsync(cartsApplyCoupon(
149
+ this,
150
+ request,
151
+ options,
152
+ ));
153
+ }
154
+
155
+ /**
156
+ * Remove coupon
157
+ *
158
+ * @remarks
159
+ * remove coupon from cart
160
+ */
161
+ async removeCoupon(
162
+ request: operations.RemoveCouponRequest,
163
+ options?: RequestOptions,
164
+ ): Promise<operations.RemoveCouponResponseBody> {
165
+ return unwrapAsync(cartsRemoveCoupon(
166
+ this,
167
+ request,
168
+ options,
169
+ ));
170
+ }
81
171
  }
package/src/sdk/sdk.ts CHANGED
@@ -7,7 +7,6 @@ import { Auth } from "./auth.js";
7
7
  import { Campaigns } from "./campaigns.js";
8
8
  import { Carts } from "./carts.js";
9
9
  import { Catalog } from "./catalog.js";
10
- import { Checkout } from "./checkout.js";
11
10
  import { Common } from "./common.js";
12
11
  import { Customers } from "./customers.js";
13
12
  import { Orders } from "./orders.js";
@@ -24,11 +23,6 @@ export class CeStorefront extends ClientSDK {
24
23
  return (this._carts ??= new Carts(this._options));
25
24
  }
26
25
 
27
- private _checkout?: Checkout;
28
- get checkout(): Checkout {
29
- return (this._checkout ??= new Checkout(this._options));
30
- }
31
-
32
26
  private _customers?: Customers;
33
27
  get customers(): Customers {
34
28
  return (this._customers ??= new Customers(this._options));
@@ -1,310 +0,0 @@
1
- # Checkout
2
- (*checkout*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [createCheckoutAddress](#createcheckoutaddress) - Update cart address
9
- * [applyCoupon](#applycoupon) - Apply coupon
10
- * [removeCoupon](#removecoupon) - Remove coupon
11
-
12
- ## createCheckoutAddress
13
-
14
- Update billing and shipping address
15
-
16
- ### Example Usage
17
-
18
- ```typescript
19
- import { CeStorefront } from "ce-storefront";
20
-
21
- const ceStorefront = new CeStorefront({
22
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
23
- });
24
-
25
- async function run() {
26
- const result = await ceStorefront.checkout.createCheckoutAddress({
27
- cartId: "<id>",
28
- billingAddress: {
29
- firstName: "Pasquale",
30
- lastName: "Fadel",
31
- countryCode: "ST",
32
- phone: "845-901-2987 x42469",
33
- email: "Kenya.Kuhlman@gmail.com",
34
- addressLine1: "48039 Sydnie Forge",
35
- addressLine2: "-",
36
- landmark: "<value>",
37
- pincode: "<value>",
38
- city: "North Davonte",
39
- state: "Maryland",
40
- taxIdentificationNumber: "GB123456789",
41
- businessName: "<value>",
42
- },
43
- shippingAddress: {
44
- firstName: "Bonita",
45
- lastName: "Stracke",
46
- countryCode: "PL",
47
- phone: "740.937.5175",
48
- email: "Dewayne_Walter@gmail.com",
49
- addressLine1: "409 Bath Street",
50
- addressLine2: "-",
51
- landmark: "<value>",
52
- pincode: "<value>",
53
- city: "Fort Donnieside",
54
- state: "Colorado",
55
- taxIdentificationNumber: "IN27AAEPM0111C1ZQ",
56
- businessName: "<value>",
57
- },
58
- });
59
-
60
- // Handle the result
61
- console.log(result);
62
- }
63
-
64
- run();
65
- ```
66
-
67
- ### Standalone function
68
-
69
- The standalone function version of this method:
70
-
71
- ```typescript
72
- import { CeStorefrontCore } from "ce-storefront/core.js";
73
- import { checkoutCreateCheckoutAddress } from "ce-storefront/funcs/checkoutCreateCheckoutAddress.js";
74
-
75
- // Use `CeStorefrontCore` for best tree-shaking performance.
76
- // You can create one instance of it to use across an application.
77
- const ceStorefront = new CeStorefrontCore({
78
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
79
- });
80
-
81
- async function run() {
82
- const res = await checkoutCreateCheckoutAddress(ceStorefront, {
83
- cartId: "<id>",
84
- billingAddress: {
85
- firstName: "Louie",
86
- lastName: "Walter",
87
- countryCode: "HR",
88
- phone: "322.312.5640 x6288",
89
- email: "Alexandro.Collins13@hotmail.com",
90
- addressLine1: "160 Schimmel Course",
91
- addressLine2: "-",
92
- landmark: "<value>",
93
- pincode: "<value>",
94
- city: "O'Connerport",
95
- state: "Arkansas",
96
- taxIdentificationNumber: "123456789",
97
- businessName: "<value>",
98
- },
99
- shippingAddress: {
100
- firstName: "Ardella",
101
- lastName: "Witting",
102
- countryCode: "PE",
103
- phone: "1-582-626-3699 x2999",
104
- email: "Georgette21@gmail.com",
105
- addressLine1: "70233 Steuber Shore",
106
- addressLine2: "-",
107
- landmark: "<value>",
108
- pincode: "<value>",
109
- city: "Lake Stefanfield",
110
- state: "Oregon",
111
- taxIdentificationNumber: "IN27AAEPM0111C1ZQ",
112
- businessName: "<value>",
113
- },
114
- });
115
-
116
- if (!res.ok) {
117
- throw res.error;
118
- }
119
-
120
- const { value: result } = res;
121
-
122
- // Handle the result
123
- console.log(result);
124
- }
125
-
126
- run();
127
- ```
128
-
129
- ### Parameters
130
-
131
- | Parameter | Type | Required | Description |
132
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
133
- | `request` | [operations.CreateCheckoutAddressRequestBody](../../models/operations/createcheckoutaddressrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
134
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
135
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
136
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
137
- | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
138
-
139
- ### Response
140
-
141
- **Promise\<[operations.CreateCheckoutAddressResponseBody](../../models/operations/createcheckoutaddressresponsebody.md)\>**
142
-
143
- ### Errors
144
-
145
- | Error Type | Status Code | Content Type |
146
- | ------------------- | ------------------- | ------------------- |
147
- | errors.BadRequest | 400 | application/json |
148
- | errors.Unauthorized | 401 | application/json |
149
- | errors.NotFound | 404 | application/json |
150
- | errors.CeError | 4XX, 5XX | \*/\* |
151
-
152
- ## applyCoupon
153
-
154
- Apply coupon
155
-
156
- ### Example Usage
157
-
158
- ```typescript
159
- import { CeStorefront } from "ce-storefront";
160
-
161
- const ceStorefront = new CeStorefront({
162
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
163
- });
164
-
165
- async function run() {
166
- const result = await ceStorefront.checkout.applyCoupon({
167
- cartId: "01F3Z7KG06J4ACWH1C4926KJEB",
168
- couponCode: "FLAT100OFF",
169
- });
170
-
171
- // Handle the result
172
- console.log(result);
173
- }
174
-
175
- run();
176
- ```
177
-
178
- ### Standalone function
179
-
180
- The standalone function version of this method:
181
-
182
- ```typescript
183
- import { CeStorefrontCore } from "ce-storefront/core.js";
184
- import { checkoutApplyCoupon } from "ce-storefront/funcs/checkoutApplyCoupon.js";
185
-
186
- // Use `CeStorefrontCore` for best tree-shaking performance.
187
- // You can create one instance of it to use across an application.
188
- const ceStorefront = new CeStorefrontCore({
189
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
190
- });
191
-
192
- async function run() {
193
- const res = await checkoutApplyCoupon(ceStorefront, {
194
- cartId: "01F3Z7KG06J4ACWH1C4926KJEB",
195
- couponCode: "FLAT100OFF",
196
- });
197
-
198
- if (!res.ok) {
199
- throw res.error;
200
- }
201
-
202
- const { value: result } = res;
203
-
204
- // Handle the result
205
- console.log(result);
206
- }
207
-
208
- run();
209
- ```
210
-
211
- ### Parameters
212
-
213
- | Parameter | Type | Required | Description |
214
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
215
- | `request` | [operations.ApplyCouponRequestBody](../../models/operations/applycouponrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
216
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
217
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
218
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
219
- | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
220
-
221
- ### Response
222
-
223
- **Promise\<[operations.ApplyCouponResponseBody](../../models/operations/applycouponresponsebody.md)\>**
224
-
225
- ### Errors
226
-
227
- | Error Type | Status Code | Content Type |
228
- | ------------------- | ------------------- | ------------------- |
229
- | errors.BadRequest | 400 | application/json |
230
- | errors.Unauthorized | 401 | application/json |
231
- | errors.CeError | 4XX, 5XX | \*/\* |
232
-
233
- ## removeCoupon
234
-
235
- remove coupon from cart
236
-
237
- ### Example Usage
238
-
239
- ```typescript
240
- import { CeStorefront } from "ce-storefront";
241
-
242
- const ceStorefront = new CeStorefront({
243
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
244
- });
245
-
246
- async function run() {
247
- const result = await ceStorefront.checkout.removeCoupon({
248
- cartId: "01F3Z7KG06J4ACWH1C4926KJEB",
249
- });
250
-
251
- // Handle the result
252
- console.log(result);
253
- }
254
-
255
- run();
256
- ```
257
-
258
- ### Standalone function
259
-
260
- The standalone function version of this method:
261
-
262
- ```typescript
263
- import { CeStorefrontCore } from "ce-storefront/core.js";
264
- import { checkoutRemoveCoupon } from "ce-storefront/funcs/checkoutRemoveCoupon.js";
265
-
266
- // Use `CeStorefrontCore` for best tree-shaking performance.
267
- // You can create one instance of it to use across an application.
268
- const ceStorefront = new CeStorefrontCore({
269
- authorization: "<YOUR_BEARER_TOKEN_HERE>",
270
- });
271
-
272
- async function run() {
273
- const res = await checkoutRemoveCoupon(ceStorefront, {
274
- cartId: "01F3Z7KG06J4ACWH1C4926KJEB",
275
- });
276
-
277
- if (!res.ok) {
278
- throw res.error;
279
- }
280
-
281
- const { value: result } = res;
282
-
283
- // Handle the result
284
- console.log(result);
285
- }
286
-
287
- run();
288
- ```
289
-
290
- ### Parameters
291
-
292
- | Parameter | Type | Required | Description |
293
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
294
- | `request` | [operations.RemoveCouponRequestBody](../../models/operations/removecouponrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
295
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
296
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
297
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
298
- | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
299
-
300
- ### Response
301
-
302
- **Promise\<[operations.RemoveCouponResponseBody](../../models/operations/removecouponresponsebody.md)\>**
303
-
304
- ### Errors
305
-
306
- | Error Type | Status Code | Content Type |
307
- | ------------------- | ------------------- | ------------------- |
308
- | errors.BadRequest | 400 | application/json |
309
- | errors.Unauthorized | 401 | application/json |
310
- | errors.CeError | 4XX, 5XX | \*/\* |
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkoutApplyCoupon.js","sourceRoot":"","sources":["../../src/funcs/checkoutApplyCoupon.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAwB,EACxB,OAA0C,EAC1C,OAAwB;IAexB,MAAM,MAAM,GAAG,SAAS,CACtB,OAAO,EACP,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,qCAAqC,CAAC,KAAK,CAAC,KAAK,CAAC,EACxE,yBAAyB,CAC1B,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,K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EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkoutCreateCheckoutAddress.d.ts","sourceRoot":"","sources":["../../src/funcs/checkoutCreateCheckoutAddress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,UAAU,CAAC,gCAAgC,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,iCAAiC,EAC1C,MAAM,CAAC,UAAU,GACjB,MAAM,CAAC,YAAY,GACnB,MAAM,CAAC,QAAQ,GACf,OAAO,GACP,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAkGA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkoutCreateCheckoutAddress.js","sourceRoot":"","sources":["../../src/funcs/checkoutCreateCheckoutAddress.ts"],"names":[],"mappings":"AAA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