@acmekit/js-sdk 2.13.2 → 2.13.3

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 (297) hide show
  1. package/dist/admin/index.d.ts +2 -177
  2. package/dist/admin/index.d.ts.map +1 -1
  3. package/dist/admin/index.js +3 -76
  4. package/dist/admin/index.js.map +1 -1
  5. package/dist/esm/admin/index.d.ts +2 -177
  6. package/dist/esm/admin/index.d.ts.map +1 -1
  7. package/dist/esm/admin/index.js +3 -73
  8. package/dist/esm/admin/index.js.map +1 -1
  9. package/dist/esm/store/index.d.ts +5 -1193
  10. package/dist/esm/store/index.d.ts.map +1 -1
  11. package/dist/esm/store/index.js +6 -1418
  12. package/dist/esm/store/index.js.map +1 -1
  13. package/dist/store/index.d.ts +5 -1193
  14. package/dist/store/index.d.ts.map +1 -1
  15. package/dist/store/index.js +6 -1408
  16. package/dist/store/index.js.map +1 -1
  17. package/package.json +2 -2
  18. package/dist/admin/campaign.d.ts +0 -164
  19. package/dist/admin/campaign.d.ts.map +0 -1
  20. package/dist/admin/campaign.js +0 -196
  21. package/dist/admin/campaign.js.map +0 -1
  22. package/dist/admin/claim.d.ts +0 -558
  23. package/dist/admin/claim.d.ts.map +0 -1
  24. package/dist/admin/claim.js +0 -693
  25. package/dist/admin/claim.js.map +0 -1
  26. package/dist/admin/currency.d.ts +0 -95
  27. package/dist/admin/currency.d.ts.map +0 -1
  28. package/dist/admin/currency.js +0 -104
  29. package/dist/admin/currency.js.map +0 -1
  30. package/dist/admin/draft-order.d.ts +0 -430
  31. package/dist/admin/draft-order.d.ts.map +0 -1
  32. package/dist/admin/draft-order.js +0 -547
  33. package/dist/admin/draft-order.js.map +0 -1
  34. package/dist/admin/exchange.d.ts +0 -487
  35. package/dist/admin/exchange.d.ts.map +0 -1
  36. package/dist/admin/exchange.js +0 -602
  37. package/dist/admin/exchange.js.map +0 -1
  38. package/dist/admin/fulfillment-provider.d.ts +0 -78
  39. package/dist/admin/fulfillment-provider.d.ts.map +0 -1
  40. package/dist/admin/fulfillment-provider.js +0 -88
  41. package/dist/admin/fulfillment-provider.js.map +0 -1
  42. package/dist/admin/fulfillment-set.d.ts +0 -141
  43. package/dist/admin/fulfillment-set.d.ts.map +0 -1
  44. package/dist/admin/fulfillment-set.js +0 -170
  45. package/dist/admin/fulfillment-set.js.map +0 -1
  46. package/dist/admin/fulfillment.d.ts +0 -91
  47. package/dist/admin/fulfillment.d.ts.map +0 -1
  48. package/dist/admin/fulfillment.js +0 -111
  49. package/dist/admin/fulfillment.js.map +0 -1
  50. package/dist/admin/inventory-item.d.ts +0 -320
  51. package/dist/admin/inventory-item.d.ts.map +0 -1
  52. package/dist/admin/inventory-item.js +0 -384
  53. package/dist/admin/inventory-item.js.map +0 -1
  54. package/dist/admin/order-edit.d.ts +0 -189
  55. package/dist/admin/order-edit.d.ts.map +0 -1
  56. package/dist/admin/order-edit.js +0 -240
  57. package/dist/admin/order-edit.js.map +0 -1
  58. package/dist/admin/order.d.ts +0 -452
  59. package/dist/admin/order.d.ts.map +0 -1
  60. package/dist/admin/order.js +0 -560
  61. package/dist/admin/order.js.map +0 -1
  62. package/dist/admin/payment-collection.d.ts +0 -72
  63. package/dist/admin/payment-collection.d.ts.map +0 -1
  64. package/dist/admin/payment-collection.js +0 -90
  65. package/dist/admin/payment-collection.js.map +0 -1
  66. package/dist/admin/payment.d.ts +0 -180
  67. package/dist/admin/payment.d.ts.map +0 -1
  68. package/dist/admin/payment.js +0 -208
  69. package/dist/admin/payment.js.map +0 -1
  70. package/dist/admin/price-list.d.ts +0 -234
  71. package/dist/admin/price-list.d.ts.map +0 -1
  72. package/dist/admin/price-list.js +0 -284
  73. package/dist/admin/price-list.js.map +0 -1
  74. package/dist/admin/price-preference.d.ts +0 -152
  75. package/dist/admin/price-preference.d.ts.map +0 -1
  76. package/dist/admin/price-preference.js +0 -182
  77. package/dist/admin/price-preference.js.map +0 -1
  78. package/dist/admin/product-category.d.ts +0 -170
  79. package/dist/admin/product-category.d.ts.map +0 -1
  80. package/dist/admin/product-category.js +0 -205
  81. package/dist/admin/product-category.js.map +0 -1
  82. package/dist/admin/product-collection.d.ts +0 -169
  83. package/dist/admin/product-collection.d.ts.map +0 -1
  84. package/dist/admin/product-collection.js +0 -203
  85. package/dist/admin/product-collection.js.map +0 -1
  86. package/dist/admin/product-tag.d.ts +0 -149
  87. package/dist/admin/product-tag.d.ts.map +0 -1
  88. package/dist/admin/product-tag.js +0 -177
  89. package/dist/admin/product-tag.js.map +0 -1
  90. package/dist/admin/product-type.d.ts +0 -150
  91. package/dist/admin/product-type.d.ts.map +0 -1
  92. package/dist/admin/product-type.js +0 -178
  93. package/dist/admin/product-type.js.map +0 -1
  94. package/dist/admin/product-variant.d.ts +0 -62
  95. package/dist/admin/product-variant.d.ts.map +0 -1
  96. package/dist/admin/product-variant.js +0 -66
  97. package/dist/admin/product-variant.js.map +0 -1
  98. package/dist/admin/product.d.ts +0 -740
  99. package/dist/admin/product.d.ts.map +0 -1
  100. package/dist/admin/product.js +0 -948
  101. package/dist/admin/product.js.map +0 -1
  102. package/dist/admin/promotion.d.ts +0 -310
  103. package/dist/admin/promotion.d.ts.map +0 -1
  104. package/dist/admin/promotion.js +0 -374
  105. package/dist/admin/promotion.js.map +0 -1
  106. package/dist/admin/refund-reasons.d.ts +0 -163
  107. package/dist/admin/refund-reasons.d.ts.map +0 -1
  108. package/dist/admin/refund-reasons.js +0 -192
  109. package/dist/admin/refund-reasons.js.map +0 -1
  110. package/dist/admin/region.d.ts +0 -152
  111. package/dist/admin/region.d.ts.map +0 -1
  112. package/dist/admin/region.js +0 -180
  113. package/dist/admin/region.js.map +0 -1
  114. package/dist/admin/reservation.d.ts +0 -154
  115. package/dist/admin/reservation.d.ts.map +0 -1
  116. package/dist/admin/reservation.js +0 -182
  117. package/dist/admin/reservation.js.map +0 -1
  118. package/dist/admin/return-reason.d.ts +0 -154
  119. package/dist/admin/return-reason.d.ts.map +0 -1
  120. package/dist/admin/return-reason.js +0 -183
  121. package/dist/admin/return-reason.js.map +0 -1
  122. package/dist/admin/return.d.ts +0 -558
  123. package/dist/admin/return.d.ts.map +0 -1
  124. package/dist/admin/return.js +0 -700
  125. package/dist/admin/return.js.map +0 -1
  126. package/dist/admin/sales-channel.d.ts +0 -196
  127. package/dist/admin/sales-channel.d.ts.map +0 -1
  128. package/dist/admin/sales-channel.js +0 -238
  129. package/dist/admin/sales-channel.js.map +0 -1
  130. package/dist/admin/shipping-option-type.d.ts +0 -152
  131. package/dist/admin/shipping-option-type.d.ts.map +0 -1
  132. package/dist/admin/shipping-option-type.js +0 -180
  133. package/dist/admin/shipping-option-type.js.map +0 -1
  134. package/dist/admin/shipping-option.d.ts +0 -171
  135. package/dist/admin/shipping-option.d.ts.map +0 -1
  136. package/dist/admin/shipping-option.js +0 -207
  137. package/dist/admin/shipping-option.js.map +0 -1
  138. package/dist/admin/shipping-profile.d.ts +0 -151
  139. package/dist/admin/shipping-profile.d.ts.map +0 -1
  140. package/dist/admin/shipping-profile.js +0 -181
  141. package/dist/admin/shipping-profile.js.map +0 -1
  142. package/dist/admin/stock-location.d.ts +0 -212
  143. package/dist/admin/stock-location.d.ts.map +0 -1
  144. package/dist/admin/stock-location.js +0 -260
  145. package/dist/admin/stock-location.js.map +0 -1
  146. package/dist/admin/tax-provider.d.ts +0 -64
  147. package/dist/admin/tax-provider.d.ts.map +0 -1
  148. package/dist/admin/tax-provider.js +0 -70
  149. package/dist/admin/tax-provider.js.map +0 -1
  150. package/dist/admin/tax-rate.d.ts +0 -155
  151. package/dist/admin/tax-rate.d.ts.map +0 -1
  152. package/dist/admin/tax-rate.js +0 -186
  153. package/dist/admin/tax-rate.js.map +0 -1
  154. package/dist/admin/tax-region.d.ts +0 -165
  155. package/dist/admin/tax-region.d.ts.map +0 -1
  156. package/dist/admin/tax-region.js +0 -196
  157. package/dist/admin/tax-region.js.map +0 -1
  158. package/dist/esm/admin/campaign.d.ts +0 -164
  159. package/dist/esm/admin/campaign.d.ts.map +0 -1
  160. package/dist/esm/admin/campaign.js +0 -213
  161. package/dist/esm/admin/campaign.js.map +0 -1
  162. package/dist/esm/admin/claim.d.ts +0 -558
  163. package/dist/esm/admin/claim.d.ts.map +0 -1
  164. package/dist/esm/admin/claim.js +0 -740
  165. package/dist/esm/admin/claim.js.map +0 -1
  166. package/dist/esm/admin/currency.d.ts +0 -95
  167. package/dist/esm/admin/currency.d.ts.map +0 -1
  168. package/dist/esm/admin/currency.js +0 -113
  169. package/dist/esm/admin/currency.js.map +0 -1
  170. package/dist/esm/admin/draft-order.d.ts +0 -430
  171. package/dist/esm/admin/draft-order.d.ts.map +0 -1
  172. package/dist/esm/admin/draft-order.js +0 -594
  173. package/dist/esm/admin/draft-order.js.map +0 -1
  174. package/dist/esm/admin/exchange.d.ts +0 -487
  175. package/dist/esm/admin/exchange.d.ts.map +0 -1
  176. package/dist/esm/admin/exchange.js +0 -643
  177. package/dist/esm/admin/exchange.js.map +0 -1
  178. package/dist/esm/admin/fulfillment-provider.d.ts +0 -78
  179. package/dist/esm/admin/fulfillment-provider.d.ts.map +0 -1
  180. package/dist/esm/admin/fulfillment-provider.js +0 -97
  181. package/dist/esm/admin/fulfillment-provider.js.map +0 -1
  182. package/dist/esm/admin/fulfillment-set.d.ts +0 -141
  183. package/dist/esm/admin/fulfillment-set.d.ts.map +0 -1
  184. package/dist/esm/admin/fulfillment-set.js +0 -185
  185. package/dist/esm/admin/fulfillment-set.js.map +0 -1
  186. package/dist/esm/admin/fulfillment.d.ts +0 -91
  187. package/dist/esm/admin/fulfillment.d.ts.map +0 -1
  188. package/dist/esm/admin/fulfillment.js +0 -122
  189. package/dist/esm/admin/fulfillment.js.map +0 -1
  190. package/dist/esm/admin/inventory-item.d.ts +0 -320
  191. package/dist/esm/admin/inventory-item.d.ts.map +0 -1
  192. package/dist/esm/admin/inventory-item.js +0 -411
  193. package/dist/esm/admin/inventory-item.js.map +0 -1
  194. package/dist/esm/admin/order-edit.d.ts +0 -189
  195. package/dist/esm/admin/order-edit.d.ts.map +0 -1
  196. package/dist/esm/admin/order-edit.js +0 -261
  197. package/dist/esm/admin/order-edit.js.map +0 -1
  198. package/dist/esm/admin/order.d.ts +0 -452
  199. package/dist/esm/admin/order.d.ts.map +0 -1
  200. package/dist/esm/admin/order.js +0 -603
  201. package/dist/esm/admin/order.js.map +0 -1
  202. package/dist/esm/admin/payment-collection.d.ts +0 -72
  203. package/dist/esm/admin/payment-collection.d.ts.map +0 -1
  204. package/dist/esm/admin/payment-collection.js +0 -101
  205. package/dist/esm/admin/payment-collection.js.map +0 -1
  206. package/dist/esm/admin/payment.d.ts +0 -180
  207. package/dist/esm/admin/payment.d.ts.map +0 -1
  208. package/dist/esm/admin/payment.js +0 -223
  209. package/dist/esm/admin/payment.js.map +0 -1
  210. package/dist/esm/admin/price-list.d.ts +0 -234
  211. package/dist/esm/admin/price-list.d.ts.map +0 -1
  212. package/dist/esm/admin/price-list.js +0 -305
  213. package/dist/esm/admin/price-list.js.map +0 -1
  214. package/dist/esm/admin/price-preference.d.ts +0 -152
  215. package/dist/esm/admin/price-preference.d.ts.map +0 -1
  216. package/dist/esm/admin/price-preference.js +0 -197
  217. package/dist/esm/admin/price-preference.js.map +0 -1
  218. package/dist/esm/admin/product-category.d.ts +0 -170
  219. package/dist/esm/admin/product-category.d.ts.map +0 -1
  220. package/dist/esm/admin/product-category.js +0 -222
  221. package/dist/esm/admin/product-category.js.map +0 -1
  222. package/dist/esm/admin/product-collection.d.ts +0 -169
  223. package/dist/esm/admin/product-collection.d.ts.map +0 -1
  224. package/dist/esm/admin/product-collection.js +0 -220
  225. package/dist/esm/admin/product-collection.js.map +0 -1
  226. package/dist/esm/admin/product-tag.d.ts +0 -149
  227. package/dist/esm/admin/product-tag.d.ts.map +0 -1
  228. package/dist/esm/admin/product-tag.js +0 -192
  229. package/dist/esm/admin/product-tag.js.map +0 -1
  230. package/dist/esm/admin/product-type.d.ts +0 -150
  231. package/dist/esm/admin/product-type.d.ts.map +0 -1
  232. package/dist/esm/admin/product-type.js +0 -193
  233. package/dist/esm/admin/product-type.js.map +0 -1
  234. package/dist/esm/admin/product-variant.d.ts +0 -62
  235. package/dist/esm/admin/product-variant.d.ts.map +0 -1
  236. package/dist/esm/admin/product-variant.js +0 -73
  237. package/dist/esm/admin/product-variant.js.map +0 -1
  238. package/dist/esm/admin/product.d.ts +0 -740
  239. package/dist/esm/admin/product.d.ts.map +0 -1
  240. package/dist/esm/admin/product.js +0 -995
  241. package/dist/esm/admin/product.js.map +0 -1
  242. package/dist/esm/admin/promotion.d.ts +0 -310
  243. package/dist/esm/admin/promotion.d.ts.map +0 -1
  244. package/dist/esm/admin/promotion.js +0 -401
  245. package/dist/esm/admin/promotion.js.map +0 -1
  246. package/dist/esm/admin/refund-reasons.d.ts +0 -163
  247. package/dist/esm/admin/refund-reasons.d.ts.map +0 -1
  248. package/dist/esm/admin/refund-reasons.js +0 -207
  249. package/dist/esm/admin/refund-reasons.js.map +0 -1
  250. package/dist/esm/admin/region.d.ts +0 -152
  251. package/dist/esm/admin/region.d.ts.map +0 -1
  252. package/dist/esm/admin/region.js +0 -195
  253. package/dist/esm/admin/region.js.map +0 -1
  254. package/dist/esm/admin/reservation.d.ts +0 -154
  255. package/dist/esm/admin/reservation.d.ts.map +0 -1
  256. package/dist/esm/admin/reservation.js +0 -199
  257. package/dist/esm/admin/reservation.js.map +0 -1
  258. package/dist/esm/admin/return-reason.d.ts +0 -154
  259. package/dist/esm/admin/return-reason.d.ts.map +0 -1
  260. package/dist/esm/admin/return-reason.js +0 -198
  261. package/dist/esm/admin/return-reason.js.map +0 -1
  262. package/dist/esm/admin/return.d.ts +0 -558
  263. package/dist/esm/admin/return.d.ts.map +0 -1
  264. package/dist/esm/admin/return.js +0 -749
  265. package/dist/esm/admin/return.js.map +0 -1
  266. package/dist/esm/admin/sales-channel.d.ts +0 -196
  267. package/dist/esm/admin/sales-channel.d.ts.map +0 -1
  268. package/dist/esm/admin/sales-channel.js +0 -257
  269. package/dist/esm/admin/sales-channel.js.map +0 -1
  270. package/dist/esm/admin/shipping-option-type.d.ts +0 -152
  271. package/dist/esm/admin/shipping-option-type.d.ts.map +0 -1
  272. package/dist/esm/admin/shipping-option-type.js +0 -195
  273. package/dist/esm/admin/shipping-option-type.js.map +0 -1
  274. package/dist/esm/admin/shipping-option.d.ts +0 -171
  275. package/dist/esm/admin/shipping-option.d.ts.map +0 -1
  276. package/dist/esm/admin/shipping-option.js +0 -224
  277. package/dist/esm/admin/shipping-option.js.map +0 -1
  278. package/dist/esm/admin/shipping-profile.d.ts +0 -151
  279. package/dist/esm/admin/shipping-profile.d.ts.map +0 -1
  280. package/dist/esm/admin/shipping-profile.js +0 -196
  281. package/dist/esm/admin/shipping-profile.js.map +0 -1
  282. package/dist/esm/admin/stock-location.d.ts +0 -212
  283. package/dist/esm/admin/stock-location.d.ts.map +0 -1
  284. package/dist/esm/admin/stock-location.js +0 -281
  285. package/dist/esm/admin/stock-location.js.map +0 -1
  286. package/dist/esm/admin/tax-provider.d.ts +0 -64
  287. package/dist/esm/admin/tax-provider.d.ts.map +0 -1
  288. package/dist/esm/admin/tax-provider.js +0 -77
  289. package/dist/esm/admin/tax-provider.js.map +0 -1
  290. package/dist/esm/admin/tax-rate.d.ts +0 -155
  291. package/dist/esm/admin/tax-rate.d.ts.map +0 -1
  292. package/dist/esm/admin/tax-rate.js +0 -201
  293. package/dist/esm/admin/tax-rate.js.map +0 -1
  294. package/dist/esm/admin/tax-region.d.ts +0 -165
  295. package/dist/esm/admin/tax-region.d.ts.map +0 -1
  296. package/dist/esm/admin/tax-region.js +0 -211
  297. package/dist/esm/admin/tax-region.js.map +0 -1
@@ -1,1425 +1,13 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
1
+ /**
2
+ * Store API client. Commerce storefront routes (cart, orders, products, etc.) have been removed.
3
+ * Kernel store API (e.g. customers/me, locales) can be extended here when needed.
4
+ */
10
5
  export class Store {
11
6
  /**
12
7
  * @ignore
13
8
  */
14
- constructor(client) {
15
- /**
16
- * @tags region
17
- */
18
- this.region = {
19
- /**
20
- * This method retrieves the paginated list of regions in the store. It sends a request to the
21
- * [List Regions API route](https://docs.acmekit.com/api/store#regions_getregions).
22
- *
23
- * Related guide: [How to list regions in a storefront](https://docs.acmekit.com/resources/storefront-development/regions/list).
24
- *
25
- * @param query - Filters and pagination configurations.
26
- * @param headers - Headers to pass in the request
27
- * @returns The paginated list of regions.
28
- *
29
- * @example
30
- * To retrieve the list of regions:
31
- *
32
- * ```ts
33
- * sdk.store.region.list()
34
- * .then(({ regions, count, limit, offset }) => {
35
- * console.log(regions)
36
- * })
37
- * ```
38
- *
39
- * To configure the pagination, pass the `limit` and `offset` query parameters.
40
- *
41
- * For example, to retrieve only 10 items and skip 10 items:
42
- *
43
- * ```ts
44
- * sdk.store.region.list({
45
- * limit: 10,
46
- * offset: 10
47
- * })
48
- * .then(({ regions, count, limit, offset }) => {
49
- * console.log(regions)
50
- * })
51
- * ```
52
- *
53
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
54
- * in each region:
55
- *
56
- * ```ts
57
- * sdk.store.region.list({
58
- * fields: "id,*countries"
59
- * })
60
- * .then(({ regions, count, limit, offset }) => {
61
- * console.log(regions)
62
- * })
63
- * ```
64
- *
65
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
66
- */
67
- list: (query, headers) => __awaiter(this, void 0, void 0, function* () {
68
- return this.client.fetch(`/store/regions`, {
69
- query,
70
- headers,
71
- });
72
- }),
73
- /**
74
- * This method retrieves a region by its ID. It sends a request to the [Get Region](https://docs.acmekit.com/api/store#regions_getregionsid)
75
- * API route.
76
- *
77
- * Related guide: [Store and retrieve regions in a storefront](https://docs.acmekit.com/resources/storefront-development/regions/store-retrieve-region).
78
- *
79
- * @param id - The region's ID.
80
- * @param query - Configure the fields to retrieve in the region.
81
- * @param headers - Headers to pass in the request
82
- * @returns The region.
83
- *
84
- * @example
85
- * To retrieve a region by its ID:
86
- *
87
- * ```ts
88
- * sdk.store.region.retrieve("reg_123")
89
- * .then(({ region }) => {
90
- * console.log(region)
91
- * })
92
- * ```
93
- *
94
- * To specify the fields and relations to retrieve:
95
- *
96
- * ```ts
97
- * sdk.store.region.retrieve(
98
- * "reg_123",
99
- * {
100
- * fields: "id,*countries"
101
- * }
102
- * )
103
- * .then(({ region }) => {
104
- * console.log(region)
105
- * })
106
- * ```
107
- *
108
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
109
- */
110
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
111
- return this.client.fetch(`/store/regions/${id}`, {
112
- query,
113
- headers,
114
- });
115
- }),
116
- };
117
- /**
118
- * @tags product
119
- */
120
- this.collection = {
121
- /**
122
- * This method retrieves a paginated list of product collections. It sends a request to the
123
- * [List Collections](https://docs.acmekit.com/api/store#collections_getcollections) API route.
124
- *
125
- * Related guide: [How to retrieve collections in a storefront](https://docs.acmekit.com/resources/storefront-development/products/collections/list).
126
- *
127
- * @param query - Filters and pagination configurations.
128
- * @param headers - Headers to pass in the request
129
- * @returns The paginated list of collections.
130
- *
131
- * @example
132
- * To retrieve the list of collections:
133
- *
134
- * ```ts
135
- * sdk.store.collection.list()
136
- * .then(({ collections, count, limit, offset }) => {
137
- * console.log(collections)
138
- * })
139
- * ```
140
- *
141
- * To configure the pagination, pass the `limit` and `offset` query parameters.
142
- *
143
- * For example, to retrieve only 10 items and skip 10 items:
144
- *
145
- * ```ts
146
- * sdk.store.collection.list({
147
- * limit: 10,
148
- * offset: 10
149
- * })
150
- * .then(({ collections, count, limit, offset }) => {
151
- * console.log(collections)
152
- * })
153
- * ```
154
- *
155
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
156
- * in each collection:
157
- *
158
- * ```ts
159
- * sdk.store.collection.list({
160
- * fields: "id,handle"
161
- * })
162
- * .then(({ collections, count, limit, offset }) => {
163
- * console.log(collections)
164
- * })
165
- * ```
166
- *
167
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
168
- */
169
- list: (query, headers) => __awaiter(this, void 0, void 0, function* () {
170
- return this.client.fetch(`/store/collections`, {
171
- query,
172
- headers,
173
- });
174
- }),
175
- /**
176
- * This method retrieves a collection by its ID. It sends a request to the [Get Collection](https://docs.acmekit.com/api/store#collections_getcollectionsid)
177
- * API route.
178
- *
179
- * Related guide: [How to retrieve a collection in a storefront](https://docs.acmekit.com/resources/storefront-development/products/collections/retrieve).
180
- *
181
- * @param id - The ID of the collection to retrieve.
182
- * @param query - Configure the fields to retrieve in the collection.
183
- * @param headers - Headers to pass in the request
184
- * @returns The collection.
185
- *
186
- * @example
187
- * To retrieve a collection by its ID:
188
- *
189
- * ```ts
190
- * sdk.store.collection.retrieve("pcol_123")
191
- * .then(({ collection }) => {
192
- * console.log(collection)
193
- * })
194
- * ```
195
- *
196
- * To specify the fields and relations to retrieve:
197
- *
198
- * ```ts
199
- * sdk.store.collection.retrieve("pcol_123", {
200
- * fields: "id,handle"
201
- * })
202
- * .then(({ collection }) => {
203
- * console.log(collection)
204
- * })
205
- * ```
206
- *
207
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
208
- */
209
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
210
- return this.client.fetch(`/store/collections/${id}`, {
211
- query,
212
- headers,
213
- });
214
- }),
215
- };
216
- /**
217
- * @tags product
218
- */
219
- this.category = {
220
- /**
221
- * This method retrieves a paginated list of product categories. It sends a request to the
222
- * [List Categories](https://docs.acmekit.com/api/store#product-categories_getproductcategories) API route.
223
- *
224
- * Related guide: [How to retrieve list of categories in the storefront](https://docs.acmekit.com/resources/storefront-development/products/categories/list).
225
- *
226
- * @param query - Filters and pagination configurations.
227
- * @param headers - Headers to pass in the request.
228
- * @returns The paginated list of categories.
229
- *
230
- * @example
231
- * To retrieve the list of categories:
232
- *
233
- * ```ts
234
- * sdk.store.category.list()
235
- * .then(({ product_categories, count, offset, limit }) => {
236
- * console.log(product_categories)
237
- * })
238
- * ```
239
- *
240
- * To configure the pagination, pass the `limit` and `offset` query parameters.
241
- *
242
- * For example, to retrieve only 10 items and skip 10 items:
243
- *
244
- * ```ts
245
- * sdk.store.category.list({
246
- * limit: 10,
247
- * offset: 10
248
- * })
249
- * .then(({ product_categories, count, offset, limit }) => {
250
- * console.log(product_categories)
251
- * })
252
- * ```
253
- *
254
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
255
- * in each category:
256
- *
257
- * ```ts
258
- * sdk.store.category.list({
259
- * fields: "id,*parent_category"
260
- * })
261
- * .then(({ product_categories, count, offset, limit }) => {
262
- * console.log(product_categories)
263
- * })
264
- * ```
265
- *
266
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
267
- */
268
- list: (query, headers) => __awaiter(this, void 0, void 0, function* () {
269
- return this.client.fetch(`/store/product-categories`, {
270
- query,
271
- headers,
272
- });
273
- }),
274
- /**
275
- * This method retrieves a category by its ID. It sends a request to the
276
- * [Retrieve Product Category](https://docs.acmekit.com/api/store#product-categories_getproductcategoriesid).
277
- *
278
- * Related guide: [How to retrieve a category in the storefront](https://docs.acmekit.com/resources/storefront-development/products/categories/retrieve).
279
- *
280
- * @param id - The ID of the category to retrieve.
281
- * @param query - Configure the fields to retrieve in the category.
282
- * @param headers - Headers to pass in the request
283
- * @returns The category.
284
- *
285
- * @example
286
- * To retrieve a category by its ID:
287
- *
288
- * ```ts
289
- * sdk.store.category.retrieve("pcat_123")
290
- * .then(({ product_category }) => {
291
- * console.log(product_category)
292
- * })
293
- * ```
294
- *
295
- * To specify the fields and relations to retrieve:
296
- *
297
- * ```ts
298
- * sdk.store.category.retrieve("pcat_123", {
299
- * fields: "id,*parent_category"
300
- * })
301
- * .then(({ product_category }) => {
302
- * console.log(product_category)
303
- * })
304
- * ```
305
- *
306
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
307
- */
308
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
309
- return this.client.fetch(`/store/product-categories/${id}`, {
310
- query,
311
- headers,
312
- });
313
- }),
314
- };
315
- /**
316
- * @tags product
317
- */
318
- this.product = {
319
- /**
320
- * This method retrieves a list of products. It sends a request to the
321
- * [List Products API route](https://docs.acmekit.com/api/store#products_getproducts).
322
- *
323
- * Related guides:
324
- *
325
- * - [How to list products in a storefront](https://docs.acmekit.com/resources/storefront-development/products/list).
326
- * - [How to retrieve a product variant's prices in the storefront](https://docs.acmekit.com/resources/storefront-development/products/price)
327
- *
328
- * @param query - Filters and pagination configurations.
329
- * @param headers - Headers to pass in the request.
330
- * @returns The paginated list of products.
331
- *
332
- * @example
333
- * To retrieve the list of products:
334
- *
335
- * ```ts
336
- * sdk.store.product.list()
337
- * .then(({ products, count, offset, limit }) => {
338
- * console.log(products)
339
- * })
340
- * ```
341
- *
342
- * To configure the pagination, pass the `limit` and `offset` query parameters.
343
- *
344
- * For example, to retrieve only 10 items and skip 10 items:
345
- *
346
- * ```ts
347
- * sdk.store.product.list({
348
- * limit: 10,
349
- * offset: 10
350
- * })
351
- * .then(({ products, count, offset, limit }) => {
352
- * console.log(products)
353
- * })
354
- * ```
355
- *
356
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
357
- * in each product:
358
- *
359
- * ```ts
360
- * sdk.store.product.list({
361
- * fields: "id,*collection"
362
- * })
363
- * .then(({ products, count, offset, limit }) => {
364
- * console.log(products)
365
- * })
366
- * ```
367
- *
368
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
369
- */
370
- list: (query, headers) => __awaiter(this, void 0, void 0, function* () {
371
- return this.client.fetch(`/store/products`, {
372
- query,
373
- headers,
374
- });
375
- }),
376
- /**
377
- * This method is used to retrieve a product by its ID. It sends a request to the
378
- * [Get Product](https://docs.acmekit.com/api/store#products_getproductsid) API route.
379
- *
380
- * Related guides:
381
- *
382
- * - [How to retrieve a product in the storefront](https://docs.acmekit.com/resources/storefront-development/products/retrieve).
383
- * - [How to retrieve a product variant's prices in the storefront](https://docs.acmekit.com/resources/storefront-development/products/price)
384
- *
385
- * @param id - The product's ID.
386
- * @param query - Configure the fields to retrieve in the product.
387
- * @param headers - Headers to pass in the request
388
- * @returns The product.
389
- *
390
- * @example
391
- * To retrieve a product by its ID:
392
- *
393
- * ```ts
394
- * sdk.store.product.retrieve("prod_123")
395
- * .then(({ product }) => {
396
- * console.log(product)
397
- * })
398
- * ```
399
- *
400
- * To specify the fields and relations to retrieve:
401
- *
402
- * ```ts
403
- * sdk.store.product.retrieve("prod_123", {
404
- * fields: "id,*collection"
405
- * })
406
- * .then(({ product }) => {
407
- * console.log(product)
408
- * })
409
- * ```
410
- *
411
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
412
- */
413
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
414
- return this.client.fetch(`/store/products/${id}`, {
415
- query,
416
- headers,
417
- });
418
- }),
419
- };
420
- /**
421
- * Related guides: [How to implement carts in the storefront](https://docs.acmekit.com/resources/storefront-development/cart).
422
- *
423
- * @tags cart
424
- */
425
- this.cart = {
426
- /**
427
- * This method creates a cart. It sends a request to the [Create Cart](https://docs.acmekit.com/api/store#carts_postcarts)
428
- * API route.
429
- *
430
- * Related guide: [How to create a cart in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/create).
431
- *
432
- * @param body - The details of the cart to create.
433
- * @param query - Configure the fields to retrieve in the cart.
434
- * @param headers - Headers to pass in the request.
435
- * @returns The created cart.
436
- *
437
- * @example
438
- * sdk.store.cart.create({
439
- * region_id: "reg_123"
440
- * })
441
- * .then(({ cart }) => {
442
- * console.log(cart)
443
- * })
444
- */
445
- create: (body, query, headers) => __awaiter(this, void 0, void 0, function* () {
446
- return this.client.fetch(`/store/carts`, {
447
- method: "POST",
448
- headers,
449
- body,
450
- query,
451
- });
452
- }),
453
- /**
454
- * This method updates a cart. It sends a request to the
455
- * [Update Cart](https://docs.acmekit.com/api/store#carts_postcartsid) API route.
456
- *
457
- * Related guide: [How to update a cart in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/update).
458
- *
459
- * @param id - The cart's ID.
460
- * @param body - The data to update in the cart.
461
- * @param query - Configure the fields to retrieve in the cart.
462
- * @param headers - Headers to pass in the request.
463
- * @returns The updated cart.
464
- *
465
- * @example
466
- * sdk.store.cart.update("cart_123", {
467
- * region_id: "reg_123"
468
- * })
469
- * .then(({ cart }) => {
470
- * console.log(cart)
471
- * })
472
- */
473
- update: (id, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
474
- return this.client.fetch(`/store/carts/${id}`, {
475
- method: "POST",
476
- headers,
477
- body,
478
- query,
479
- });
480
- }),
481
- /**
482
- * This method retrieves a cart by its ID. It sends a request to the
483
- * [Get Cart](https://docs.acmekit.com/api/store#carts_getcartsid) API route.
484
- *
485
- * Related guide: [How to retrieve a cart in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/retrieve).
486
- *
487
- * @param id - The cart's ID.
488
- * @param query - Configure the fields to retrieve in the cart.
489
- * @param headers - Headers to pass in the request.
490
- * @returns The cart's details.
491
- *
492
- * @example
493
- * To retrieve a cart by its ID:
494
- *
495
- * ```ts
496
- * sdk.store.cart.retrieve("cart_123")
497
- * .then(({ cart }) => {
498
- * console.log(cart)
499
- * })
500
- * ```
501
- *
502
- * To specify the fields and relations to retrieve:
503
- *
504
- * ```ts
505
- * sdk.store.cart.retrieve("cart_123", {
506
- * fields: "id,*items"
507
- * })
508
- * .then(({ cart }) => {
509
- * console.log(cart)
510
- * })
511
- * ```
512
- *
513
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
514
- */
515
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
516
- return this.client.fetch(`/store/carts/${id}`, {
517
- headers,
518
- query,
519
- });
520
- }),
521
- /**
522
- * This methods adds a product variant to the cart as a line item. It sends a request to the
523
- * [Add Line Item](https://docs.acmekit.com/api/store#carts_postcartsidlineitems) API route.
524
- *
525
- * Related guide: [How to manage a cart's line items in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/manage-items).
526
- *
527
- * @param cartId - The cart's ID.
528
- * @param body - The details of the item to add.
529
- * @param query - Configure the fields to retrieve in the cart.
530
- * @param headers - Headers to pass in the request.
531
- * @returns The cart's details.
532
- *
533
- * @example
534
- * sdk.store.cart.createLineItem("cart_123", {
535
- * variant_id: "variant_123",
536
- * quantity: 1
537
- * })
538
- * .then(({ cart }) => {
539
- * console.log(cart)
540
- * })
541
- */
542
- createLineItem: (cartId, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
543
- return this.client.fetch(`/store/carts/${cartId}/line-items`, {
544
- method: "POST",
545
- headers,
546
- body,
547
- query,
548
- });
549
- }),
550
- /**
551
- * This method updates a line item in a cart. It sends a request to the
552
- * [Update Line Item](https://docs.acmekit.com/api/store#carts_postcartsidlineitemsline_id) API route.
553
- *
554
- * Related guide: [How to manage a cart's line items in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/manage-items).
555
- *
556
- * @param cartId - The cart's ID.
557
- * @param lineItemId - The line item's ID.
558
- * @param body - The data to update.
559
- * @param query - Configure the fields to retrieve in the cart.
560
- * @param headers - Headers to pass in the request.
561
- * @returns The cart's details.
562
- *
563
- * @example
564
- * sdk.store.cart.updateLineItem(
565
- * "cart_123",
566
- * "li_123",
567
- * {
568
- * quantity: 1
569
- * }
570
- * )
571
- * .then(({ cart }) => {
572
- * console.log(cart)
573
- * })
574
- */
575
- updateLineItem: (cartId, lineItemId, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
576
- return this.client.fetch(`/store/carts/${cartId}/line-items/${lineItemId}`, {
577
- method: "POST",
578
- headers,
579
- body,
580
- query,
581
- });
582
- }),
583
- /**
584
- * This method deletes a line item from a cart. It sends a request to the
585
- * [Remove Line Item](https://docs.acmekit.com/api/store#carts_deletecartsidlineitemsline_id) API route.
586
- *
587
- * Related guide: [How to manage a cart's line items in the storefront](https://docs.acmekit.com/resources/storefront-development/cart/manage-items).
588
- *
589
- * @param cartId - The cart's ID.
590
- * @param lineItemId - The item's ID.
591
- * @param query - Configure the fields to retrieve in the cart.
592
- * @param headers - Headers to pass in the request.
593
- * @returns The deletion's details.
594
- *
595
- * @example
596
- * sdk.store.cart.deleteLineItem(
597
- * "cart_123",
598
- * "li_123"
599
- * )
600
- * .then(({ deleted, parent: cart }) => {
601
- * console.log(deleted, cart)
602
- * })
603
- */
604
- deleteLineItem: (cartId, lineItemId, query, headers) => __awaiter(this, void 0, void 0, function* () {
605
- return this.client.fetch(`/store/carts/${cartId}/line-items/${lineItemId}`, {
606
- method: "DELETE",
607
- query,
608
- headers,
609
- });
610
- }),
611
- /**
612
- * This method adds a shipping method to a cart. It sends a request to
613
- * the [Add Shipping Method](https://docs.acmekit.com/api/store#carts_postcartsidshippingmethods) API routes.
614
- *
615
- * Related guide: [Implement shipping step during checkout](https://docs.acmekit.com/resources/storefront-development/checkout/shipping).
616
- *
617
- * @param cartId - The cart's ID.
618
- * @param body - The shipping method's details.
619
- * @param query - Configure the fields to retrieve in the cart.
620
- * @param headers - Headers to pass in the request.
621
- * @returns The cart's details.
622
- *
623
- * @example
624
- * sdk.store.cart.addShippingMethod("cart_123", {
625
- * option_id: "so_123",
626
- * data: {
627
- * // custom data for fulfillment provider.
628
- * }
629
- * })
630
- * .then(({ cart }) => {
631
- * console.log(cart)
632
- * })
633
- */
634
- addShippingMethod: (cartId, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
635
- return this.client.fetch(`/store/carts/${cartId}/shipping-methods`, {
636
- method: "POST",
637
- headers,
638
- body,
639
- query,
640
- });
641
- }),
642
- /**
643
- * This method completes a cart and places the order. It's the last step of the checkout flow.
644
- * The method sends a request to the [Complete Cart](https://docs.acmekit.com/api/store#carts_postcartsidcomplete)
645
- * API route.
646
- *
647
- * Related guide: [Learn how to complete cart in checkout flow](https://docs.acmekit.com/resources/storefront-development/checkout/complete-cart).
648
- *
649
- * @param cartId - The cart's ID.
650
- * @param query - Configure the fields to retrieve in the created order.
651
- * @param headers - Headers to pass in the request.
652
- * @returns The order's details, if it was placed successfully. Otherwise, the cart is returned with an error.
653
- *
654
- * @example
655
- * sdk.store.cart.complete("cart_123")
656
- * .then((data) => {
657
- * if(data.type === "cart") {
658
- * // an error occurred
659
- * console.log(data.error, data.cart)
660
- * } else {
661
- * // order placed successfully
662
- * console.log(data.order)
663
- * }
664
- * })
665
- */
666
- complete: (cartId, query, headers) => __awaiter(this, void 0, void 0, function* () {
667
- return this.client.fetch(`/store/carts/${cartId}/complete`, {
668
- method: "POST",
669
- headers,
670
- query,
671
- });
672
- }),
673
- /**
674
- * This method updates the customer of a cart.
675
- *
676
- * @param id - The cart's ID.
677
- * @param query - Configure the fields to retrieve in the cart.
678
- * @param headers - Headers to pass in the request.
679
- * @returns The updated cart.
680
- *
681
- * @example
682
- * // TODO must be authenticated as the customer to set the cart's customer
683
- * sdk.store.cart.transferCart("cart_123")
684
- * .then(({ cart }) => {
685
- * console.log(cart)
686
- * })
687
- */
688
- transferCart: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
689
- return this.client.fetch(`/store/carts/${id}/customer`, {
690
- method: "POST",
691
- headers,
692
- query,
693
- });
694
- }),
695
- };
696
- /**
697
- * @tags fulfillment
698
- */
699
- this.fulfillment = {
700
- /**
701
- * This method retrieves the list of shipping options for a cart. It sends a request to
702
- * the [List Shipping Options](https://docs.acmekit.com/api/store#shipping-options_getshippingoptions)
703
- * API route.
704
- *
705
- * Related guide: [Implement shipping step during checkout](https://docs.acmekit.com/resources/storefront-development/checkout/shipping).
706
- *
707
- * @param query - The cart's details along with configurations of the fields to retrieve in the options.
708
- * @param headers - Headers to pass in the request.
709
- * @returns The shipping options that can be used for the cart.
710
- *
711
- * @example
712
- * sdk.store.fulfillment.listCartOptions({
713
- * cart_id: "cart_123"
714
- * })
715
- * .then(({ shipping_options }) => {
716
- * console.log(shipping_options)
717
- * })
718
- */
719
- listCartOptions: (query, headers) => __awaiter(this, void 0, void 0, function* () {
720
- return this.client.fetch(`/store/shipping-options`, {
721
- headers,
722
- query,
723
- });
724
- }),
725
- /**
726
- * This method calculates the price of a shipping option in a cart, which is useful during checkout.
727
- * It sends a request to the [Calculate Shipping Option Price](https://docs.acmekit.com/api/store#shipping-options_postshippingoptionsidcalculate)
728
- * API route.
729
- *
730
- * @param id - The shipping option's ID.
731
- * @param body - The price calculation's details.
732
- * @param query - Configure the fields to retrieve in the shipping option.
733
- * @param headers - Headers to pass in the request.
734
- * @returns The shipping option's details.
735
- *
736
- * @example
737
- * sdk.store.fulfillment.calculate("so_123", {
738
- * cart_id: "cart_123"
739
- * })
740
- * .then(({ shipping_option }) => {
741
- * console.log(shipping_option)
742
- * })
743
- */
744
- calculate: (id, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
745
- return yield this.client.fetch(`/store/shipping-options/${id}/calculate`, {
746
- method: "POST",
747
- headers,
748
- body,
749
- query,
750
- });
751
- }),
752
- };
753
- /**
754
- * @tags payment
755
- */
756
- this.payment = {
757
- /**
758
- * This method retrieves the payment providers available in a region, which is useful during checkout.
759
- * It sends a request to the [List Payment Providers](https://docs.acmekit.com/api/store#payment-providers_getpaymentproviders)
760
- * API route.
761
- *
762
- * Related guide: [Implement payment step during checkout](https://docs.acmekit.com/resources/storefront-development/checkout/payment).
763
- *
764
- * @param query - The filters to apply on the retrieved providers, along with configurations of the
765
- * fields to retrieve in the options.
766
- * @param headers - Headers to pass in the request.
767
- * @returns The list of payment providers.
768
- *
769
- * @example
770
- * To retrieve the list of payment providers for a region:
771
- *
772
- * ```ts
773
- * sdk.store.payment.listPaymentProviders({
774
- * region_id: "reg_123"
775
- * })
776
- * .then(({ payment_providers, count, offset, limit }) => {
777
- * console.log(payment_providers)
778
- * })
779
- * ```
780
- *
781
- * To configure the pagination, pass the `limit` and `offset` query parameters.
782
- *
783
- * For example, to retrieve only 10 items and skip 10 items:
784
- *
785
- * ```ts
786
- * sdk.store.payment.listPaymentProviders({
787
- * region_id: "reg_123",
788
- * limit: 10,
789
- * offset: 10
790
- * })
791
- * .then(({ payment_providers, count, offset, limit }) => {
792
- * console.log(payment_providers)
793
- * })
794
- * ```
795
- *
796
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
797
- * in each provider:
798
- *
799
- * ```ts
800
- * sdk.store.payment.listPaymentProviders({
801
- * region_id: "reg_123",
802
- * limit: 10,
803
- * offset: 10,
804
- * fields: "id"
805
- * })
806
- * .then(({ payment_providers, count, offset, limit }) => {
807
- * console.log(payment_providers)
808
- * })
809
- * ```
810
- *
811
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
812
- */
813
- listPaymentProviders: (query, headers) => __awaiter(this, void 0, void 0, function* () {
814
- return this.client.fetch(`/store/payment-providers`, {
815
- headers,
816
- query,
817
- });
818
- }),
819
- /**
820
- * This method creates a payment session of a cart's payment collection, selecting a payment provider.
821
- * It sends a request to the [Initialize Payment Session](https://docs.acmekit.com/api/store#payment-collections_postpaymentcollectionsidpaymentsessions)
822
- * API route.
823
- *
824
- * If the cart doesn't have a payment collection, a payment collection is created for the cart by
825
- * sending a request to the [Create Payment Collection](https://docs.acmekit.com/api/store#payment-collections_postpaymentcollections)
826
- * API route.
827
- *
828
- * Related guide: [Implement payment step during checkout](https://docs.acmekit.com/resources/storefront-development/checkout/payment).
829
- *
830
- * @param cart - The cart's details.
831
- * @param body - The payment session's details.
832
- * @param query - Configure the fields to retrieve in the payment collection.
833
- * @param headers - Headers to pass in the request.
834
- * @returns The payment collection's details.
835
- *
836
- * @example
837
- * sdk.store.payment.initiatePaymentSession(
838
- * cart, // assuming you already have the cart object.
839
- * {
840
- * provider_id: "pp_stripe_stripe",
841
- * data: {
842
- * // any data relevant for the provider.
843
- * }
844
- * }
845
- * )
846
- * .then(({ payment_collection }) => {
847
- * console.log(payment_collection)
848
- * })
849
- */
850
- initiatePaymentSession: (cart, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
851
- var _a;
852
- let paymentCollectionId = (_a = cart.payment_collection) === null || _a === void 0 ? void 0 : _a.id;
853
- if (!paymentCollectionId) {
854
- const collectionBody = {
855
- cart_id: cart.id,
856
- };
857
- paymentCollectionId = (yield this.client.fetch(`/store/payment-collections`, {
858
- method: "POST",
859
- headers,
860
- body: collectionBody,
861
- })).payment_collection.id;
862
- }
863
- return this.client.fetch(`/store/payment-collections/${paymentCollectionId}/payment-sessions`, {
864
- method: "POST",
865
- headers,
866
- body,
867
- query,
868
- });
869
- }),
870
- };
871
- /**
872
- * @tags order
873
- */
874
- this.order = {
875
- /**
876
- * This method retrieves a paginated list of orders matching the specified filters. It
877
- * sends a request to the [List Orders](https://docs.acmekit.com/api/store#orders_getorders)
878
- * API route.
879
- *
880
- * @param query - Configure the fields to retrieve in the orders.
881
- * @param headers - Headers to pass in the request.
882
- * @returns The paginated list of orders.
883
- *
884
- * @example
885
- * To retrieve the list of orders:
886
- *
887
- * ```ts
888
- * // TODO must be authenticated as the customer to list their orders
889
- * sdk.store.order.list()
890
- * .then(({ orders, count, offset, limit }) => {
891
- * console.log(orders)
892
- * })
893
- * ```
894
- *
895
- * To configure the pagination, pass the `limit` and `offset` query parameters.
896
- *
897
- * For example, to retrieve only 10 items and skip 10 items:
898
- *
899
- * ```ts
900
- * // TODO must be authenticated as the customer to list their orders
901
- * sdk.store.order.list({
902
- * limit: 10,
903
- * offset: 10
904
- * })
905
- * .then(({ orders, count, offset, limit }) => {
906
- * console.log(orders)
907
- * })
908
- * ```
909
- *
910
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
911
- * in each order:
912
- *
913
- * ```ts
914
- * // TODO must be authenticated as the customer to list their orders
915
- * sdk.store.order.list({
916
- * fields: "id,*items"
917
- * })
918
- * .then(({ orders, count, offset, limit }) => {
919
- * console.log(orders)
920
- * })
921
- * ```
922
- *
923
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
924
- */
925
- list: (query, headers) => __awaiter(this, void 0, void 0, function* () {
926
- return this.client.fetch(`/store/orders`, {
927
- query,
928
- headers,
929
- });
930
- }),
931
- /**
932
- * This method retrieves an order by its ID. It sends a request to the
933
- * [Get Order](https://docs.acmekit.com/api/store#orders_getordersid) API route.
934
- *
935
- * @param id - The order's ID.
936
- * @param query - Configure the fields to retrieve in the order.
937
- * @param headers - Headers to pass in the request.
938
- * @returns The order's details.
939
- *
940
- * @example
941
- * To retrieve an order by its ID:
942
- *
943
- * ```ts
944
- * sdk.store.order.retrieve("order_123")
945
- * .then(({ order }) => {
946
- * console.log(order)
947
- * })
948
- * ```
949
- *
950
- * To specify the fields and relations to retrieve:
951
- *
952
- * ```ts
953
- * sdk.store.order.retrieve("order_123", {
954
- * fields: "id,*items"
955
- * })
956
- * .then(({ order }) => {
957
- * console.log(order)
958
- * })
959
- * ```
960
- *
961
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
962
- */
963
- retrieve: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
964
- return this.client.fetch(`/store/orders/${id}`, {
965
- headers,
966
- query,
967
- });
968
- }),
969
- /**
970
- * This method requests a order transfer from a guest account to the current, logged in customer account.
971
- *
972
- * Customer requesting the transfer must be logged in.
973
- *
974
- * @param body - The transfer's details.
975
- * @param query - Configure the fields to retrieve in the order.
976
- * @param headers - Headers to pass in the request.
977
- * @returns The order details.
978
- *
979
- * @example
980
- * // TODO must be authenticated as the customer to request the order transfer
981
- * sdk.store.order.requestTransfer(
982
- * "order_123",
983
- * {
984
- * description: "I want to transfer this order to my friend."
985
- * },
986
- * {},
987
- * {
988
- * Authorization: `Bearer ${token}`
989
- * }
990
- * )
991
- * .then(({ order }) => {
992
- * console.log(order)
993
- * })
994
- */
995
- requestTransfer: (id, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
996
- return this.client.fetch(`/store/orders/${id}/transfer/request`, {
997
- method: "POST",
998
- headers,
999
- body,
1000
- query,
1001
- });
1002
- }),
1003
- /**
1004
- * This method cancels an order transfer request.
1005
- *
1006
- * Customer requesting the transfer must be logged in.
1007
- *
1008
- * @param id - The order's ID.
1009
- * @param query - Configure the fields to retrieve in the order.
1010
- * @param headers - Headers to pass in the request.
1011
- * @returns The order details.
1012
- *
1013
- * @example
1014
- * // TODO must be authenticated as the customer to cancel the order transfer
1015
- * sdk.store.order.cancelTransfer(
1016
- * "order_123",
1017
- * {},
1018
- * {
1019
- * Authorization: `Bearer ${token}`
1020
- * }
1021
- * )
1022
- * .then(({ order }) => {
1023
- * console.log(order)
1024
- * })
1025
- */
1026
- cancelTransfer: (id, query, headers) => __awaiter(this, void 0, void 0, function* () {
1027
- return this.client.fetch(`/store/orders/${id}/transfer/cancel`, {
1028
- method: "POST",
1029
- headers,
1030
- query,
1031
- });
1032
- }),
1033
- /**
1034
- * The method called for the original owner to accept the order transfer to a new owner.
1035
- *
1036
- * @param id - The order's ID.
1037
- * @param body - The payload containing the transfer token.
1038
- * @param query - Configure the fields to retrieve in the order.
1039
- * @param headers - Headers to pass in the request.
1040
- * @returns The order details.
1041
- *
1042
- * @example
1043
- * sdk.store.order.acceptTransfer(
1044
- * "order_123",
1045
- * {
1046
- * token: "transfer_token"
1047
- * },
1048
- * {
1049
- * Authorization: `Bearer ${token}`
1050
- * }
1051
- * )
1052
- * .then(({ order }) => {
1053
- * console.log(order)
1054
- * })
1055
- */
1056
- acceptTransfer: (id, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1057
- return this.client.fetch(`/store/orders/${id}/transfer/accept`, {
1058
- method: "POST",
1059
- headers,
1060
- body,
1061
- query,
1062
- });
1063
- }),
1064
- /**
1065
- * The method called for the original owner to decline the order transfer to a new owner.
1066
- *
1067
- * @param id - The order's ID.
1068
- * @param body - The payload containing the transfer token.
1069
- * @param query - Configure the fields to retrieve in the order.
1070
- * @param headers - Headers to pass in the request.
1071
- * @returns The order details.
1072
- *
1073
- * @example
1074
- * sdk.store.order.declineTransfer(
1075
- * "order_123",
1076
- * {
1077
- * token: "transfer_token"
1078
- * },
1079
- * {
1080
- * Authorization: `Bearer ${token}`
1081
- * }
1082
- * )
1083
- * .then(({ order }) => {
1084
- * console.log(order)
1085
- * })
1086
- */
1087
- declineTransfer: (id, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1088
- return this.client.fetch(`/store/orders/${id}/transfer/decline`, {
1089
- method: "POST",
1090
- headers,
1091
- body,
1092
- query,
1093
- });
1094
- }),
1095
- };
1096
- /**
1097
- * @tags customer
1098
- */
1099
- this.customer = {
1100
- /**
1101
- * This method registers a customer. It sends a request to the [Register Customer](https://docs.acmekit.com/api/store#customers_postcustomers)
1102
- * API route.
1103
- *
1104
- * You must use the {@link Auth.register} method first to retrieve a registration token. Then, pass that
1105
- * registration token in the `headers` parameter of this method as an authorization bearer header.
1106
- *
1107
- * Related guide: [How to register customer in storefront](https://docs.acmekit.com/resources/storefront-development/customers/register)
1108
- *
1109
- * @param body - The customer's details.
1110
- * @param query - Configure the fields to retrieve in the customer.
1111
- * @param headers - Headers to pass in the request. This is where you include the authorization JWT registration token.
1112
- * @returns The customer's details.
1113
- *
1114
- * @example
1115
- * const token = await sdk.auth.register("customer", "emailpass", {
1116
- * "email": "customer@gmail.com",
1117
- * "password": "supersecret"
1118
- * })
1119
- *
1120
- * sdk.store.customer.create(
1121
- * {
1122
- * "email": "customer@gmail.com"
1123
- * },
1124
- * {},
1125
- * {
1126
- * Authorization: `Bearer ${token}`
1127
- * }
1128
- * )
1129
- * .then(({ customer }) => {
1130
- * console.log(customer)
1131
- * })
1132
- */
1133
- create: (body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1134
- return this.client.fetch(`/store/customers`, {
1135
- method: "POST",
1136
- headers,
1137
- body,
1138
- query,
1139
- });
1140
- }),
1141
- /**
1142
- * This method updates the logged-in customer's details. The customer must be logged in
1143
- * first with the {@link Auth.login} method.
1144
- *
1145
- * It sends a request to the
1146
- * [Update Customer](https://docs.acmekit.com/api/store#customers_postcustomersme) API route.
1147
- *
1148
- * Related guide: [How to edit customer's profile in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/profile).
1149
- *
1150
- * @param body - The customer's details to update.
1151
- * @param query - Configure the fields to retrieve in the customer.
1152
- * @param headers - Headers to pass in the request.
1153
- * @returns The customer's details.
1154
- *
1155
- * @example
1156
- * // TODO must be authenticated as the customer to update their details
1157
- * sdk.store.customer.update({
1158
- * first_name: "John"
1159
- * })
1160
- * .then(({ customer }) => {
1161
- * console.log(customer)
1162
- * })
1163
- */
1164
- update: (body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1165
- return this.client.fetch(`/store/customers/me`, {
1166
- method: "POST",
1167
- headers,
1168
- body,
1169
- query,
1170
- });
1171
- }),
1172
- /**
1173
- * This method retrieves the logged-in customer's details. The customer must be logged in
1174
- * first with the {@link Auth.login} method.
1175
- *
1176
- * It sends a request to the [Get Logged-In Customer](https://docs.acmekit.com/api/store#customers_getcustomersme)
1177
- * API route.
1178
- *
1179
- * @param query - Configure the fields to retrieve in the customer.
1180
- * @param headers - Headers to pass in the request.
1181
- * @returns The customer's details.
1182
- *
1183
- * @example
1184
- * // TODO must be authenticated as the customer to retrieve their details
1185
- * sdk.store.customer.retrieve()
1186
- * .then(({ customer }) => {
1187
- * console.log(customer)
1188
- * })
1189
- */
1190
- retrieve: (query, headers) => __awaiter(this, void 0, void 0, function* () {
1191
- return this.client.fetch(`/store/customers/me`, {
1192
- query,
1193
- headers,
1194
- });
1195
- }),
1196
- /**
1197
- * This method creates an address for the logged-in customer. The customer must be logged in
1198
- * first with the {@link Auth.login} method.
1199
- *
1200
- * It sends a request to the [Create Address](https://docs.acmekit.com/api/store#customers_postcustomersmeaddresses)
1201
- * API route.
1202
- *
1203
- * Related guides: [How to manage customer's addresses in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/addresses)
1204
- *
1205
- * @param body - The address's details.
1206
- * @param query - Configure the fields to retrieve in the customer.
1207
- * @param headers - Headers to pass in the request.
1208
- * @returns The customer's details.
1209
- *
1210
- * @example
1211
- * // TODO must be authenticated as the customer to create an address
1212
- * sdk.store.customer.createAddress({
1213
- * country_code: "us"
1214
- * })
1215
- * .then(({ customer }) => {
1216
- * console.log(customer)
1217
- * })
1218
- */
1219
- createAddress: (body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1220
- return this.client.fetch(`/store/customers/me/addresses`, {
1221
- method: "POST",
1222
- headers,
1223
- body,
1224
- query,
1225
- });
1226
- }),
1227
- /**
1228
- * This method updates the address of the logged-in customer. The customer must be logged in
1229
- * first with the {@link Auth.login} method.
1230
- *
1231
- * It sends a request to the [Update Address](https://docs.acmekit.com/api/store#customers_postcustomersmeaddressesaddress_id)
1232
- * API route.
1233
- *
1234
- * Related guides: [How to manage customer's addresses in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/addresses)
1235
- *
1236
- * @param addressId - The ID of the address to update.
1237
- * @param body - The details to update in the address.
1238
- * @param query - Configure the fields to retrieve in the customer.
1239
- * @param headers - Headers to pass in the request.
1240
- * @returns The customer's details.
1241
- *
1242
- * @example
1243
- * // TODO must be authenticated as the customer to update their address
1244
- * sdk.store.customer.updateAddress(
1245
- * "caddr_123",
1246
- * {
1247
- * country_code: "us"
1248
- * }
1249
- * )
1250
- * .then(({ customer }) => {
1251
- * console.log(customer)
1252
- * })
1253
- */
1254
- updateAddress: (addressId, body, query, headers) => __awaiter(this, void 0, void 0, function* () {
1255
- return this.client.fetch(`/store/customers/me/addresses/${addressId}`, {
1256
- method: "POST",
1257
- headers,
1258
- body,
1259
- query,
1260
- });
1261
- }),
1262
- /**
1263
- * This method retrieves the logged-in customer's address. The customer must be logged in
1264
- * first with the {@link Auth.login} method.
1265
- *
1266
- * It sends a request to the [List Customer's Address](https://docs.acmekit.com/api/store#customers_getcustomersmeaddresses)
1267
- * API route.
1268
- *
1269
- * Related guides: [How to manage customer's addresses in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/addresses)
1270
- *
1271
- * @param query - Configure the fields to retrieve in the addresses.
1272
- * @param headers - Headers to pass in the request.
1273
- * @returns The paginated list of addresses.
1274
- *
1275
- * @example
1276
- * To retrieve the list of addresses:
1277
- *
1278
- * ```ts
1279
- * // TODO must be authenticated as the customer to list their addresses
1280
- * sdk.store.customer.listAddress()
1281
- * .then(({ addresses, count, offset, limit }) => {
1282
- * console.log(addresses)
1283
- * })
1284
- * ```
1285
- *
1286
- * To configure the pagination, pass the `limit` and `offset` query parameters.
1287
- *
1288
- * For example, to retrieve only 10 items and skip 10 items:
1289
- *
1290
- * ```ts
1291
- * // TODO must be authenticated as the customer to list their addresses
1292
- * sdk.store.customer.listAddress({
1293
- * limit: 10,
1294
- * offset: 10
1295
- * })
1296
- * .then(({ addresses, count, offset, limit }) => {
1297
- * console.log(addresses)
1298
- * })
1299
- * ```
1300
- *
1301
- * Using the `fields` query parameter, you can specify the fields and relations to retrieve
1302
- * in each address:
1303
- *
1304
- * ```ts
1305
- * // TODO must be authenticated as the customer to list their addresses
1306
- * sdk.store.customer.listAddress({
1307
- * fields: "id,country_code"
1308
- * })
1309
- * .then(({ addresses, count, offset, limit }) => {
1310
- * console.log(addresses)
1311
- * })
1312
- * ```
1313
- *
1314
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
1315
- */
1316
- listAddress: (query, headers) => __awaiter(this, void 0, void 0, function* () {
1317
- return this.client.fetch(`/store/customers/me/addresses`, {
1318
- query,
1319
- headers,
1320
- });
1321
- }),
1322
- /**
1323
- * This method retrieves an address of the logged-in customer. The customer must be logged in
1324
- * first with the {@link Auth.login} method.
1325
- *
1326
- * It sends a request to the [Get Address](https://docs.acmekit.com/api/store#customers_getcustomersmeaddressesaddress_id)
1327
- * API route.
1328
- *
1329
- * Related guides: [How to manage customer's addresses in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/addresses)
1330
- *
1331
- * @param addressId - The address's ID.
1332
- * @param query - Configure the fields to retrieve in the address.
1333
- * @param headers - Headers to pass in the request.
1334
- * @returns The address's details.
1335
- *
1336
- * @example
1337
- * To retrieve an address by its ID:
1338
- *
1339
- * ```ts
1340
- * // TODO must be authenticated as the customer to retrieve their address
1341
- * sdk.store.customer.retrieveAddress(
1342
- * "caddr_123"
1343
- * )
1344
- * .then(({ address }) => {
1345
- * console.log(address)
1346
- * })
1347
- * ```
1348
- *
1349
- * To specify the fields and relations to retrieve:
1350
- *
1351
- * ```ts
1352
- * // TODO must be authenticated as the customer to retrieve their address
1353
- * sdk.store.customer.retrieveAddress(
1354
- * "caddr_123",
1355
- * {
1356
- * fields: "id,country_code"
1357
- * }
1358
- * )
1359
- * .then(({ address }) => {
1360
- * console.log(address)
1361
- * })
1362
- * ```
1363
- *
1364
- * Learn more about the `fields` property in the [API reference](https://docs.acmekit.com/api/store#select-fields-and-relations).
1365
- */
1366
- retrieveAddress: (addressId, query, headers) => __awaiter(this, void 0, void 0, function* () {
1367
- return this.client.fetch(`/store/customers/me/addresses/${addressId}`, {
1368
- query,
1369
- headers,
1370
- });
1371
- }),
1372
- /**
1373
- * This method deletes an address of the logged-in customer. The customer must be logged in
1374
- * first with the {@link Auth.login} method.
1375
- *
1376
- * It sends a request to the [Remove Address](https://docs.acmekit.com/api/store#customers_deletecustomersmeaddressesaddress_id)
1377
- * API route.
1378
- *
1379
- * Related guides: [How to manage customer's addresses in the storefront](https://docs.acmekit.com/resources/storefront-development/customers/addresses)
1380
- *
1381
- * @param addressId - The address's ID.
1382
- * @param headers - Headers to pass in the request.
1383
- * @returns The deletion's details.
1384
- *
1385
- * @example
1386
- * // TODO must be authenticated as the customer to delete their address
1387
- * sdk.store.customer.deleteAddress("caddr_123")
1388
- * .then(({ deleted, parent: customer }) => {
1389
- * console.log(customer)
1390
- * })
1391
- */
1392
- deleteAddress: (addressId, headers) => __awaiter(this, void 0, void 0, function* () {
1393
- return this.client.fetch(`/store/customers/me/addresses/${addressId}`, {
1394
- method: "DELETE",
1395
- headers,
1396
- });
1397
- }),
1398
- };
1399
- /**
1400
- * @tags locale
1401
- */
1402
- this.locale = {
1403
- /**
1404
- * This method retrieves the list of supported locales in the store. It sends a request to the
1405
- * [List Locales](https://docs.acmekit.com/api/store#locales_getlocales) API route.
1406
- *
1407
- * @param headers - Headers to pass in the request.
1408
- * @returns The list of supported locales.
1409
- *
1410
- * @example
1411
- * sdk.store.locale.list()
1412
- * .then(({ locales }) => {
1413
- * console.log(locales)
1414
- * })
1415
- */
1416
- list: (headers) => __awaiter(this, void 0, void 0, function* () {
1417
- return this.client.fetch(`/store/locales`, {
1418
- headers,
1419
- });
1420
- }),
1421
- };
1422
- this.client = client;
9
+ constructor(_client) {
10
+ // Store API (commerce) removed; client kept for future storefront endpoints
1423
11
  }
1424
12
  }
1425
13
  //# sourceMappingURL=index.js.map