@medusajs/js-sdk 3.0.0-preview-20250211091350 → 3.0.0-preview-20250406164537

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 (229) hide show
  1. package/dist/admin/campaign.d.ts +9 -0
  2. package/dist/admin/campaign.d.ts.map +1 -1
  3. package/dist/admin/campaign.js +9 -0
  4. package/dist/admin/campaign.js.map +1 -1
  5. package/dist/admin/customer.d.ts +95 -0
  6. package/dist/admin/customer.d.ts.map +1 -1
  7. package/dist/admin/customer.js +120 -0
  8. package/dist/admin/customer.js.map +1 -1
  9. package/dist/admin/draft-order.d.ts +427 -0
  10. package/dist/admin/draft-order.d.ts.map +1 -0
  11. package/dist/admin/draft-order.js +534 -0
  12. package/dist/admin/draft-order.js.map +1 -0
  13. package/dist/admin/fulfillment-provider.d.ts +7 -1
  14. package/dist/admin/fulfillment-provider.d.ts.map +1 -1
  15. package/dist/admin/fulfillment-provider.js +7 -1
  16. package/dist/admin/fulfillment-provider.js.map +1 -1
  17. package/dist/admin/fulfillment.js +1 -1
  18. package/dist/admin/fulfillment.js.map +1 -1
  19. package/dist/admin/index.d.ts +10 -0
  20. package/dist/admin/index.d.ts.map +1 -1
  21. package/dist/admin/index.js +4 -0
  22. package/dist/admin/index.js.map +1 -1
  23. package/dist/admin/order.d.ts +2 -1
  24. package/dist/admin/order.d.ts.map +1 -1
  25. package/dist/admin/order.js +8 -0
  26. package/dist/admin/order.js.map +1 -1
  27. package/dist/admin/plugin.d.ts +9 -0
  28. package/dist/admin/plugin.d.ts.map +1 -0
  29. package/dist/admin/plugin.js +16 -0
  30. package/dist/admin/plugin.js.map +1 -0
  31. package/dist/admin/product-collection.d.ts +1 -1
  32. package/dist/admin/product-collection.js +1 -1
  33. package/dist/admin/product.d.ts +3 -2
  34. package/dist/admin/product.d.ts.map +1 -1
  35. package/dist/admin/product.js +3 -2
  36. package/dist/admin/product.js.map +1 -1
  37. package/dist/admin/promotion.d.ts +285 -1
  38. package/dist/admin/promotion.d.ts.map +1 -1
  39. package/dist/admin/promotion.js +284 -0
  40. package/dist/admin/promotion.js.map +1 -1
  41. package/dist/admin/refund-reasons.d.ts +48 -0
  42. package/dist/admin/refund-reasons.d.ts.map +1 -1
  43. package/dist/admin/refund-reasons.js +48 -0
  44. package/dist/admin/refund-reasons.js.map +1 -1
  45. package/dist/admin/region.d.ts +137 -12
  46. package/dist/admin/region.d.ts.map +1 -1
  47. package/dist/admin/region.js +133 -0
  48. package/dist/admin/region.js.map +1 -1
  49. package/dist/admin/reservation.d.ts +134 -0
  50. package/dist/admin/reservation.d.ts.map +1 -1
  51. package/dist/admin/reservation.js +134 -0
  52. package/dist/admin/reservation.js.map +1 -1
  53. package/dist/admin/return-reason.d.ts +135 -0
  54. package/dist/admin/return-reason.d.ts.map +1 -1
  55. package/dist/admin/return-reason.js +135 -0
  56. package/dist/admin/return-reason.js.map +1 -1
  57. package/dist/admin/return.d.ts +523 -1
  58. package/dist/admin/return.d.ts.map +1 -1
  59. package/dist/admin/return.js +522 -0
  60. package/dist/admin/return.js.map +1 -1
  61. package/dist/admin/sales-channel.d.ts +176 -1
  62. package/dist/admin/sales-channel.d.ts.map +1 -1
  63. package/dist/admin/sales-channel.js +175 -0
  64. package/dist/admin/sales-channel.js.map +1 -1
  65. package/dist/admin/shipping-option.d.ts +151 -0
  66. package/dist/admin/shipping-option.d.ts.map +1 -1
  67. package/dist/admin/shipping-option.js +151 -0
  68. package/dist/admin/shipping-option.js.map +1 -1
  69. package/dist/admin/shipping-profile.d.ts +132 -0
  70. package/dist/admin/shipping-profile.d.ts.map +1 -1
  71. package/dist/admin/shipping-profile.js +132 -0
  72. package/dist/admin/shipping-profile.js.map +1 -1
  73. package/dist/admin/stock-location.d.ts +190 -0
  74. package/dist/admin/stock-location.d.ts.map +1 -1
  75. package/dist/admin/stock-location.js +190 -0
  76. package/dist/admin/stock-location.js.map +1 -1
  77. package/dist/admin/store.d.ts +99 -0
  78. package/dist/admin/store.d.ts.map +1 -1
  79. package/dist/admin/store.js +99 -0
  80. package/dist/admin/store.js.map +1 -1
  81. package/dist/admin/tax-rate.d.ts +136 -0
  82. package/dist/admin/tax-rate.d.ts.map +1 -1
  83. package/dist/admin/tax-rate.js +136 -0
  84. package/dist/admin/tax-rate.js.map +1 -1
  85. package/dist/admin/tax-region.d.ts +125 -0
  86. package/dist/admin/tax-region.d.ts.map +1 -1
  87. package/dist/admin/tax-region.js +125 -1
  88. package/dist/admin/tax-region.js.map +1 -1
  89. package/dist/admin/upload.d.ts +65 -6
  90. package/dist/admin/upload.d.ts.map +1 -1
  91. package/dist/admin/upload.js +63 -1
  92. package/dist/admin/upload.js.map +1 -1
  93. package/dist/admin/user.d.ts +147 -0
  94. package/dist/admin/user.d.ts.map +1 -1
  95. package/dist/admin/user.js +147 -0
  96. package/dist/admin/user.js.map +1 -1
  97. package/dist/admin/workflow-execution.d.ts +62 -0
  98. package/dist/admin/workflow-execution.d.ts.map +1 -1
  99. package/dist/admin/workflow-execution.js +62 -0
  100. package/dist/admin/workflow-execution.js.map +1 -1
  101. package/dist/auth/index.d.ts +88 -24
  102. package/dist/auth/index.d.ts.map +1 -1
  103. package/dist/auth/index.js +89 -24
  104. package/dist/auth/index.js.map +1 -1
  105. package/dist/client.d.ts +9 -8
  106. package/dist/client.d.ts.map +1 -1
  107. package/dist/client.js +67 -48
  108. package/dist/client.js.map +1 -1
  109. package/dist/esm/admin/campaign.d.ts +9 -0
  110. package/dist/esm/admin/campaign.d.ts.map +1 -1
  111. package/dist/esm/admin/campaign.js +9 -0
  112. package/dist/esm/admin/campaign.js.map +1 -1
  113. package/dist/esm/admin/customer.d.ts +95 -0
  114. package/dist/esm/admin/customer.d.ts.map +1 -1
  115. package/dist/esm/admin/customer.js +130 -0
  116. package/dist/esm/admin/customer.js.map +1 -1
  117. package/dist/esm/admin/draft-order.d.ts +427 -0
  118. package/dist/esm/admin/draft-order.d.ts.map +1 -0
  119. package/dist/esm/admin/draft-order.js +577 -0
  120. package/dist/esm/admin/draft-order.js.map +1 -0
  121. package/dist/esm/admin/fulfillment-provider.d.ts +7 -1
  122. package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
  123. package/dist/esm/admin/fulfillment-provider.js +7 -1
  124. package/dist/esm/admin/fulfillment-provider.js.map +1 -1
  125. package/dist/esm/admin/fulfillment.js +1 -1
  126. package/dist/esm/admin/fulfillment.js.map +1 -1
  127. package/dist/esm/admin/index.d.ts +10 -0
  128. package/dist/esm/admin/index.d.ts.map +1 -1
  129. package/dist/esm/admin/index.js +4 -0
  130. package/dist/esm/admin/index.js.map +1 -1
  131. package/dist/esm/admin/order.d.ts +2 -1
  132. package/dist/esm/admin/order.d.ts.map +1 -1
  133. package/dist/esm/admin/order.js +10 -0
  134. package/dist/esm/admin/order.js.map +1 -1
  135. package/dist/esm/admin/plugin.d.ts +9 -0
  136. package/dist/esm/admin/plugin.d.ts.map +1 -0
  137. package/dist/esm/admin/plugin.js +23 -0
  138. package/dist/esm/admin/plugin.js.map +1 -0
  139. package/dist/esm/admin/product-collection.d.ts +1 -1
  140. package/dist/esm/admin/product-collection.js +1 -1
  141. package/dist/esm/admin/product.d.ts +3 -2
  142. package/dist/esm/admin/product.d.ts.map +1 -1
  143. package/dist/esm/admin/product.js +3 -2
  144. package/dist/esm/admin/product.js.map +1 -1
  145. package/dist/esm/admin/promotion.d.ts +285 -1
  146. package/dist/esm/admin/promotion.d.ts.map +1 -1
  147. package/dist/esm/admin/promotion.js +284 -0
  148. package/dist/esm/admin/promotion.js.map +1 -1
  149. package/dist/esm/admin/refund-reasons.d.ts +48 -0
  150. package/dist/esm/admin/refund-reasons.d.ts.map +1 -1
  151. package/dist/esm/admin/refund-reasons.js +48 -0
  152. package/dist/esm/admin/refund-reasons.js.map +1 -1
  153. package/dist/esm/admin/region.d.ts +137 -12
  154. package/dist/esm/admin/region.d.ts.map +1 -1
  155. package/dist/esm/admin/region.js +133 -0
  156. package/dist/esm/admin/region.js.map +1 -1
  157. package/dist/esm/admin/reservation.d.ts +134 -0
  158. package/dist/esm/admin/reservation.d.ts.map +1 -1
  159. package/dist/esm/admin/reservation.js +134 -0
  160. package/dist/esm/admin/reservation.js.map +1 -1
  161. package/dist/esm/admin/return-reason.d.ts +135 -0
  162. package/dist/esm/admin/return-reason.d.ts.map +1 -1
  163. package/dist/esm/admin/return-reason.js +135 -0
  164. package/dist/esm/admin/return-reason.js.map +1 -1
  165. package/dist/esm/admin/return.d.ts +523 -1
  166. package/dist/esm/admin/return.d.ts.map +1 -1
  167. package/dist/esm/admin/return.js +522 -0
  168. package/dist/esm/admin/return.js.map +1 -1
  169. package/dist/esm/admin/sales-channel.d.ts +176 -1
  170. package/dist/esm/admin/sales-channel.d.ts.map +1 -1
  171. package/dist/esm/admin/sales-channel.js +175 -0
  172. package/dist/esm/admin/sales-channel.js.map +1 -1
  173. package/dist/esm/admin/shipping-option.d.ts +151 -0
  174. package/dist/esm/admin/shipping-option.d.ts.map +1 -1
  175. package/dist/esm/admin/shipping-option.js +151 -0
  176. package/dist/esm/admin/shipping-option.js.map +1 -1
  177. package/dist/esm/admin/shipping-profile.d.ts +132 -0
  178. package/dist/esm/admin/shipping-profile.d.ts.map +1 -1
  179. package/dist/esm/admin/shipping-profile.js +132 -0
  180. package/dist/esm/admin/shipping-profile.js.map +1 -1
  181. package/dist/esm/admin/stock-location.d.ts +190 -0
  182. package/dist/esm/admin/stock-location.d.ts.map +1 -1
  183. package/dist/esm/admin/stock-location.js +190 -0
  184. package/dist/esm/admin/stock-location.js.map +1 -1
  185. package/dist/esm/admin/store.d.ts +99 -0
  186. package/dist/esm/admin/store.d.ts.map +1 -1
  187. package/dist/esm/admin/store.js +99 -0
  188. package/dist/esm/admin/store.js.map +1 -1
  189. package/dist/esm/admin/tax-rate.d.ts +136 -0
  190. package/dist/esm/admin/tax-rate.d.ts.map +1 -1
  191. package/dist/esm/admin/tax-rate.js +136 -0
  192. package/dist/esm/admin/tax-rate.js.map +1 -1
  193. package/dist/esm/admin/tax-region.d.ts +125 -0
  194. package/dist/esm/admin/tax-region.d.ts.map +1 -1
  195. package/dist/esm/admin/tax-region.js +125 -1
  196. package/dist/esm/admin/tax-region.js.map +1 -1
  197. package/dist/esm/admin/upload.d.ts +65 -6
  198. package/dist/esm/admin/upload.d.ts.map +1 -1
  199. package/dist/esm/admin/upload.js +63 -1
  200. package/dist/esm/admin/upload.js.map +1 -1
  201. package/dist/esm/admin/user.d.ts +147 -0
  202. package/dist/esm/admin/user.d.ts.map +1 -1
  203. package/dist/esm/admin/user.js +147 -0
  204. package/dist/esm/admin/user.js.map +1 -1
  205. package/dist/esm/admin/workflow-execution.d.ts +62 -0
  206. package/dist/esm/admin/workflow-execution.d.ts.map +1 -1
  207. package/dist/esm/admin/workflow-execution.js +62 -0
  208. package/dist/esm/admin/workflow-execution.js.map +1 -1
  209. package/dist/esm/auth/index.d.ts +88 -24
  210. package/dist/esm/auth/index.d.ts.map +1 -1
  211. package/dist/esm/auth/index.js +89 -24
  212. package/dist/esm/auth/index.js.map +1 -1
  213. package/dist/esm/client.d.ts +9 -8
  214. package/dist/esm/client.d.ts.map +1 -1
  215. package/dist/esm/client.js +97 -63
  216. package/dist/esm/client.js.map +1 -1
  217. package/dist/esm/store/index.d.ts +19 -0
  218. package/dist/esm/store/index.d.ts.map +1 -1
  219. package/dist/esm/store/index.js +19 -0
  220. package/dist/esm/store/index.js.map +1 -1
  221. package/dist/esm/types.d.ts +8 -1
  222. package/dist/esm/types.d.ts.map +1 -1
  223. package/dist/store/index.d.ts +19 -0
  224. package/dist/store/index.d.ts.map +1 -1
  225. package/dist/store/index.js +19 -0
  226. package/dist/store/index.js.map +1 -1
  227. package/dist/types.d.ts +8 -1
  228. package/dist/types.d.ts.map +1 -1
  229. package/package.json +3 -3
@@ -8,18 +8,119 @@ class Promotion {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method retrieves a promotion by its ID. It sends a request to the
13
+ * [Retrieve Promotion](https://docs.medusajs.com/api/admin#promotions_getpromotionsid)
14
+ * API route.
15
+ *
16
+ * @param id - The promotion's ID.
17
+ * @param query - Configure the fields to retrieve in the promotion.
18
+ * @param headers - Headers to pass in the request.
19
+ * @returns The promotion's details.
20
+ *
21
+ * @example
22
+ * To retrieve a promotion by its ID:
23
+ *
24
+ * ```ts
25
+ * sdk.admin.promotion.retrieve("promo_123")
26
+ * .then(({ promotion }) => {
27
+ * console.log(promotion)
28
+ * })
29
+ * ```
30
+ *
31
+ * To specify the fields and relations to retrieve:
32
+ *
33
+ * ```ts
34
+ * sdk.admin.promotion.retrieve("promo_123", {
35
+ * fields: "id,*application_method"
36
+ * })
37
+ * .then(({ promotion }) => {
38
+ * console.log(promotion)
39
+ * })
40
+ * ```
41
+ *
42
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
43
+ */
11
44
  async retrieve(id, query, headers) {
12
45
  return await this.client.fetch(`/admin/promotions/${id}`, {
13
46
  headers,
14
47
  query,
15
48
  });
16
49
  }
50
+ /**
51
+ * This method retrieves a list of promotions. It sends a request to the
52
+ * [List Promotions](https://docs.medusajs.com/api/admin#promotions_getpromotions)
53
+ * API route.
54
+ *
55
+ * @param query - Filters and pagination configurations.
56
+ * @param headers - Headers to pass in the request.
57
+ * @returns The list of promotions.
58
+ *
59
+ * @example
60
+ * To retrieve the list of promotions:
61
+ *
62
+ * ```ts
63
+ * sdk.admin.promotion.list()
64
+ * .then(({ promotions, count, limit, offset }) => {
65
+ * console.log(promotions)
66
+ * })
67
+ * ```
68
+ *
69
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
70
+ *
71
+ * For example, to retrieve only 10 items and skip 10 items:
72
+ *
73
+ * ```ts
74
+ * sdk.admin.promotion.list({
75
+ * limit: 10,
76
+ * offset: 10
77
+ * })
78
+ * .then(({ promotions, count, limit, offset }) => {
79
+ * console.log(promotions)
80
+ * })
81
+ * ```
82
+ *
83
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
84
+ * in each promotion:
85
+ *
86
+ * ```ts
87
+ * sdk.admin.promotion.list({
88
+ * fields: "id,*application_method"
89
+ * })
90
+ * .then(({ promotions, count, limit, offset }) => {
91
+ * console.log(promotions)
92
+ * })
93
+ * ```
94
+ *
95
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
96
+ */
17
97
  async list(query, headers) {
18
98
  return await this.client.fetch(`/admin/promotions`, {
19
99
  headers,
20
100
  query,
21
101
  });
22
102
  }
103
+ /**
104
+ * This method creates a new promotion. It sends a request to the
105
+ * [Create Promotion](https://docs.medusajs.com/api/admin#promotions_postpromotions)
106
+ * API route.
107
+ *
108
+ * @param payload - The promotion to create.
109
+ * @param headers - Headers to pass in the request.
110
+ * @returns The promotion's details.
111
+ *
112
+ * @example
113
+ * sdk.admin.promotion.create({
114
+ * name: "My Promotion",
115
+ * description: "This is a test promotion",
116
+ * code: "PROMO123",
117
+ * starts_at: "2021-01-01",
118
+ * ends_at: "2021-01-01",
119
+ * })
120
+ * .then(({ promotion }) => {
121
+ * console.log(promotion)
122
+ * })
123
+ */
23
124
  async create(payload, headers) {
24
125
  return await this.client.fetch(`/admin/promotions`, {
25
126
  method: "POST",
@@ -27,6 +128,24 @@ class Promotion {
27
128
  body: payload,
28
129
  });
29
130
  }
131
+ /**
132
+ * This method updates a promotion. It sends a request to the
133
+ * [Update Promotion](https://docs.medusajs.com/api/admin#promotions_postpromotionsid)
134
+ * API route.
135
+ *
136
+ * @param id - The promotion's ID.
137
+ * @param payload - The details to update in the promotion.
138
+ * @param headers - Headers to pass in the request.
139
+ * @returns The promotion's details.
140
+ *
141
+ * @example
142
+ * sdk.admin.promotion.update("promo_123", {
143
+ * code: "PROMO123",
144
+ * })
145
+ * .then(({ promotion }) => {
146
+ * console.log(promotion)
147
+ * })
148
+ */
30
149
  async update(id, payload, headers) {
31
150
  return await this.client.fetch(`/admin/promotions/${id}`, {
32
151
  method: "POST",
@@ -34,12 +153,59 @@ class Promotion {
34
153
  body: payload,
35
154
  });
36
155
  }
156
+ /**
157
+ * This method deletes a promotion. It sends a request to the
158
+ * [Delete Promotion](https://docs.medusajs.com/api/admin#promotions_deletepromotionsid)
159
+ * API route.
160
+ *
161
+ * @param id - The promotion's ID.
162
+ * @param headers - Headers to pass in the request.
163
+ * @returns The deleted promotion's details.
164
+ *
165
+ * @example
166
+ * sdk.admin.promotion.delete("promo_123")
167
+ * .then(({ promotion }) => {
168
+ * console.log(promotion)
169
+ * })
170
+ */
37
171
  async delete(id, headers) {
38
172
  return await this.client.fetch(`/admin/promotions/${id}`, {
39
173
  method: "DELETE",
40
174
  headers,
41
175
  });
42
176
  }
177
+ /**
178
+ * This method creates and adds rules to a promotion. It can be the promotion's rules,
179
+ * or its application method's buy or target rules. That depends on the rule type
180
+ * you specify as a parameter.
181
+ *
182
+ * - If you set the `ruleType` to `rules`, the method sends a request to the
183
+ * [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
184
+ * - If you set the `ruleType` to `buy-rules`, the method sends a request to the
185
+ * [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
186
+ * - If you set the `ruleType` to `target-rules`, the method sends a request to the
187
+ * [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
188
+ *
189
+ * @param id - The promotion's ID.
190
+ * @param ruleType - The type of rules to create.
191
+ * @param payload - The rules to create.
192
+ * @param headers - Headers to pass in the request.
193
+ * @returns The promotion's details.
194
+ *
195
+ * @example
196
+ * sdk.admin.promotion.addRules("promo_123", "rules", {
197
+ * rules: [
198
+ * {
199
+ * operator: "eq",
200
+ * attribute: "product_id",
201
+ * values: ["prod_123"]
202
+ * }
203
+ * ]
204
+ * })
205
+ * .then(({ promotion }) => {
206
+ * console.log(promotion)
207
+ * })
208
+ */
43
209
  async addRules(id, ruleType, payload, headers) {
44
210
  return await this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
45
211
  method: "POST",
@@ -47,6 +213,37 @@ class Promotion {
47
213
  body: { create: payload.rules },
48
214
  });
49
215
  }
216
+ /**
217
+ * This method updates the rules of a promotion. It can be the promotion's rules,
218
+ * or its application method's buy or target rules. That depends on the rule type
219
+ * you specify as a parameter.
220
+ *
221
+ * - If you set the `ruleType` to `rules`, the method sends a request to the
222
+ * [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
223
+ * - If you set the `ruleType` to `buy-rules`, the method sends a request to the
224
+ * [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
225
+ * - If you set the `ruleType` to `target-rules`, the method sends a request to the
226
+ * [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
227
+ *
228
+ * @param id - The promotion's ID.
229
+ * @param ruleType - The type of rules to update.
230
+ * @param payload - The rules to update.
231
+ * @param headers - Headers to pass in the request.
232
+ * @returns The promotion's details.
233
+ *
234
+ * @example
235
+ * sdk.admin.promotion.updateRules("promo_123", "rules", {
236
+ * rules: [
237
+ * {
238
+ * id: "rule_123",
239
+ * operator: "ne",
240
+ * }
241
+ * ]
242
+ * })
243
+ * .then(({ promotion }) => {
244
+ * console.log(promotion)
245
+ * })
246
+ */
50
247
  async updateRules(id, ruleType, payload, headers) {
51
248
  return await this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
52
249
  method: "POST",
@@ -54,6 +251,32 @@ class Promotion {
54
251
  body: { update: payload.rules },
55
252
  });
56
253
  }
254
+ /**
255
+ * This method removes rules from a promotion. It can be the promotion's rules,
256
+ * or its application method's buy or target rules. That depends on the rule type
257
+ * you specify as a parameter.
258
+ *
259
+ * - If you set the `ruleType` to `rules`, the method sends a request to the
260
+ * [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
261
+ * - If you set the `ruleType` to `buy-rules`, the method sends a request to the
262
+ * [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
263
+ * - If you set the `ruleType` to `target-rules`, the method sends a request to the
264
+ * [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
265
+ *
266
+ * @param id - The promotion's ID.
267
+ * @param ruleType - The type of rules to remove.
268
+ * @param payload - The rules to remove.
269
+ * @param headers - Headers to pass in the request.
270
+ * @returns The promotion's details.
271
+ *
272
+ * @example
273
+ * sdk.admin.promotion.removeRules("promo_123", "rules", {
274
+ * rule_ids: ["rule_123"]
275
+ * })
276
+ * .then(({ promotion }) => {
277
+ * console.log(promotion)
278
+ * })
279
+ */
57
280
  async removeRules(id, ruleType, payload, headers) {
58
281
  return await this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
59
282
  method: "POST",
@@ -61,6 +284,26 @@ class Promotion {
61
284
  body: { delete: payload.rule_ids },
62
285
  });
63
286
  }
287
+ /**
288
+ * This method retrieves the rules of a promotion. It can be the promotion's rules,
289
+ * or its application method's buy or target rules. That depends on the rule type
290
+ * you specify as a parameter.
291
+ *
292
+ * This method sends a request to the
293
+ * [List Rules of a Promotion API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsidrule_type)
294
+ *
295
+ * @param id - The promotion's ID.
296
+ * @param ruleType - The type of rules to retrieve. Can be `rules`, `buy-rules`, or `target-rules`.
297
+ * @param query - Configure the fields to retrieve in the rules.
298
+ * @param headers - Headers to pass in the request.
299
+ * @returns The promotion's rules.
300
+ *
301
+ * @example
302
+ * sdk.admin.promotion.listRules("promo_123", "rules")
303
+ * .then(({ rules }) => {
304
+ * console.log(rules)
305
+ * })
306
+ */
64
307
  async listRules(id, ruleType, query, headers) {
65
308
  // eslint-disable-next-line max-len
66
309
  return await this.client.fetch(`/admin/promotions/${id}/${ruleType}`, {
@@ -68,6 +311,27 @@ class Promotion {
68
311
  query,
69
312
  });
70
313
  }
314
+ /**
315
+ * Retrieve a list of potential rule attributes for the promotion and application method types specified in the query parameters. Only the attributes of the rule type specified in the path parameter are retrieved:
316
+ *
317
+ * - If `rule_type` is `rules`, the attributes of the promotion's type are retrieved.
318
+ * - If `rule_type` is `target-rules`, the target rules' attributes of the application method's type are retrieved.
319
+ * - If `rule_type` is `buy-rules`, the buy rules' attributes of the application method's type are retrieved.
320
+ *
321
+ * This method sends a request to the
322
+ * [List Rule Attribute Options API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsruleattributeoptionsrule_type)
323
+ *
324
+ * @param ruleType - The type of rules to retrieve the attributes for. Can be `rules`, `buy-rules`, or `target-rules`.
325
+ * @param promotionType - The type of promotion to retrieve the attributes for. It can be `standard` or `buyget`.
326
+ * @param headers - Headers to pass in the request.
327
+ * @returns The list of rule attributes.
328
+ *
329
+ * @example
330
+ * sdk.admin.promotion.listRuleAttributes("rules", "standard")
331
+ * .then(({ attributes }) => {
332
+ * console.log(attributes)
333
+ * })
334
+ */
71
335
  async listRuleAttributes(ruleType, promotionType, headers) {
72
336
  // eslint-disable-next-line max-len
73
337
  return await this.client.fetch(`/admin/promotions/rule-attribute-options/${ruleType}`, {
@@ -75,6 +339,26 @@ class Promotion {
75
339
  query: { promotion_type: promotionType },
76
340
  });
77
341
  }
342
+ /**
343
+ * Retrieve all potential values for promotion rules and target and buy rules based on the specified rule attribute and type.
344
+ * For example, if you provide the ID of the `currency_code` rule attribute, and set `rule_type` to rules,
345
+ * a list of currencies are retrieved in label-value pairs.
346
+ *
347
+ * This method sends a request to the
348
+ * [List Rule Values API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsrulevalueoptionsrule_typerule_attribute_id)
349
+ *
350
+ * @param ruleType - The type of rules to retrieve the values for. Can be `rules`, `buy-rules`, or `target-rules`.
351
+ * @param ruleValue - The ID of the rule attribute to retrieve the values for.
352
+ * @param query - Configure the fields to retrieve in the rule values.
353
+ * @param headers - Headers to pass in the request.
354
+ * @returns The list of rule values.
355
+ *
356
+ * @example
357
+ * sdk.admin.promotion.listRuleValues("rules", "attr_123")
358
+ * .then(({ values }) => {
359
+ * console.log(values)
360
+ * })
361
+ */
78
362
  async listRuleValues(ruleType, ruleValue, query, headers) {
79
363
  return await this.client.fetch(`/admin/promotions/rule-value-options/${ruleType}/${ruleValue}`, {
80
364
  headers,
@@ -1 +1 @@
1
- {"version":3,"file":"promotion.js","sourceRoot":"","sources":["../../src/admin/promotion.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAKpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAyC,EACzC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,qBAAqB,EAAE,EAAE,EACzB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EACnB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,OAAuC,EACvC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EACnB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI,EAAE,OAAO;SACd,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,OAAuC,EACvC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,qBAAqB,EAAE,EAAE,EACzB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI,EAAE,OAAO;SACd,CACF,CAAA;IACH,CAAC;IAED,KA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I,QAAQ,EAAE,EACrC;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,QAAgB,EAChB,aAAsB,EACtB,OAAuB;QAEvB,mCAAmC;QACnC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4CAA4C,QAAQ,EAAE,EACtD;YACE,OAAO;YACP,KAAK,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE;SACzC,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,KAAmD,EACnD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wCAAwC,QAAQ,IAAI,SAAS,EAAE,EAC/D;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AA3KD,8BA2KC"}
1
+ {"version":3,"file":"promotion.js","sourceRoot":"","sources":["../../src/admin/promotion.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAKpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAyC,EACzC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,qBAAqB,EAAE,EAAE,EACzB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,IAAI,CACR,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EACnB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;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E,EAC/D;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAvcD,8BAucC"}
@@ -10,6 +10,54 @@ export declare class RefundReason {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a list of refund reasons. It sends a request to the
15
+ * [List Refund Reasons](https://docs.medusajs.com/api/admin#refund-reasons_getrefundreasons)
16
+ * API route.
17
+ *
18
+ * @param query - Filters and pagination configurations.
19
+ * @param headers - Headers to pass in the request.
20
+ * @returns The paginated list of refund reasons.
21
+ *
22
+ * @example
23
+ * To retrieve the list of refund reasons:
24
+ *
25
+ * ```ts
26
+ * sdk.admin.refundReason.list()
27
+ * .then(({ refund_reasons, count, limit, offset }) => {
28
+ * console.log(refund_reasons)
29
+ * })
30
+ * ```
31
+ *
32
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
33
+ *
34
+ * For example, to retrieve only 10 items and skip 10 items:
35
+ *
36
+ * ```ts
37
+ * sdk.admin.refundReason.list({
38
+ * limit: 10,
39
+ * offset: 10
40
+ * })
41
+ * .then(({ refund_reasons, count, limit, offset }) => {
42
+ * console.log(refund_reasons)
43
+ * })
44
+ * ```
45
+ *
46
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
47
+ * in each refund reason:
48
+ *
49
+ * ```ts
50
+ * sdk.admin.refundReason.list({
51
+ * fields: "id,name"
52
+ * })
53
+ * .then(({ refund_reasons, count, limit, offset }) => {
54
+ * console.log(refund_reasons)
55
+ * })
56
+ * ```
57
+ *
58
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
59
+ *
60
+ */
13
61
  list(query?: HttpTypes.RefundReasonFilters, headers?: ClientHeaders): Promise<HttpTypes.RefundReasonsResponse>;
14
62
  }
15
63
  //# sourceMappingURL=refund-reasons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refund-reasons.d.ts","sourceRoot":"","sources":["../../src/admin/refund-reasons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;CAS1E"}
1
+ {"version":3,"file":"refund-reasons.d.ts","sourceRoot":"","sources":["../../src/admin/refund-reasons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;IACG,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;CAS1E"}
@@ -8,6 +8,54 @@ class RefundReason {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method retrieves a list of refund reasons. It sends a request to the
13
+ * [List Refund Reasons](https://docs.medusajs.com/api/admin#refund-reasons_getrefundreasons)
14
+ * API route.
15
+ *
16
+ * @param query - Filters and pagination configurations.
17
+ * @param headers - Headers to pass in the request.
18
+ * @returns The paginated list of refund reasons.
19
+ *
20
+ * @example
21
+ * To retrieve the list of refund reasons:
22
+ *
23
+ * ```ts
24
+ * sdk.admin.refundReason.list()
25
+ * .then(({ refund_reasons, count, limit, offset }) => {
26
+ * console.log(refund_reasons)
27
+ * })
28
+ * ```
29
+ *
30
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
31
+ *
32
+ * For example, to retrieve only 10 items and skip 10 items:
33
+ *
34
+ * ```ts
35
+ * sdk.admin.refundReason.list({
36
+ * limit: 10,
37
+ * offset: 10
38
+ * })
39
+ * .then(({ refund_reasons, count, limit, offset }) => {
40
+ * console.log(refund_reasons)
41
+ * })
42
+ * ```
43
+ *
44
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
45
+ * in each refund reason:
46
+ *
47
+ * ```ts
48
+ * sdk.admin.refundReason.list({
49
+ * fields: "id,name"
50
+ * })
51
+ * .then(({ refund_reasons, count, limit, offset }) => {
52
+ * console.log(refund_reasons)
53
+ * })
54
+ * ```
55
+ *
56
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
57
+ *
58
+ */
11
59
  async list(query, headers) {
12
60
  return await this.client.fetch(`/admin/refund-reasons`, {
13
61
  query,
@@ -1 +1 @@
1
- {"version":3,"file":"refund-reasons.js","sourceRoot":"","sources":["../../src/admin/refund-reasons.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,uBAAuB,EACvB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AArBD,oCAqBC"}
1
+ {"version":3,"file":"refund-reasons.js","sourceRoot":"","sources":["../../src/admin/refund-reasons.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;IACH,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,uBAAuB,EACvB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AArED,oCAqEC"}
@@ -10,18 +10,143 @@ export declare class Region {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
- create(body: HttpTypes.AdminCreateRegion, query?: SelectParams, headers?: ClientHeaders): Promise<{
14
- region: HttpTypes.AdminRegion;
15
- }>;
16
- update(id: string, body: HttpTypes.AdminUpdateRegion, query?: SelectParams, headers?: ClientHeaders): Promise<{
17
- region: HttpTypes.AdminRegion;
18
- }>;
19
- list(queryParams?: FindParams & HttpTypes.AdminRegionFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<{
20
- regions: HttpTypes.AdminRegion[];
21
- }>>;
22
- retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<{
23
- region: HttpTypes.AdminRegion;
24
- }>;
13
+ /**
14
+ * This method creates a new region. It sends a request to the
15
+ * [Create Region](https://docs.medusajs.com/api/admin#regions_postregions)
16
+ * API route.
17
+ *
18
+ * @param body - The details of the region to create.
19
+ * @param query - Configure the fields and relations to retrieve in the region.
20
+ * @param headers - Headers to pass in the request.
21
+ * @returns The created region's details.
22
+ *
23
+ * @example
24
+ * sdk.admin.region.create({
25
+ * name: "United States",
26
+ * currency_code: "usd",
27
+ * })
28
+ * .then(({ region }) => {
29
+ * console.log(region)
30
+ * })
31
+ */
32
+ create(body: HttpTypes.AdminCreateRegion, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminRegionResponse>;
33
+ /**
34
+ * This method updates a region. It sends a request to the
35
+ * [Update Region](https://docs.medusajs.com/api/admin#regions_postregionsid)
36
+ * API route.
37
+ *
38
+ * @param id - The ID of the region to update.
39
+ * @param body - The details of the region to update.
40
+ * @param query - Configure the fields and relations to retrieve in the region.
41
+ * @param headers - Headers to pass in the request.
42
+ * @returns The updated region's details.
43
+ *
44
+ * @example
45
+ * sdk.admin.region.update("region_123", {
46
+ * name: "United States",
47
+ * })
48
+ * .then(({ region }) => {
49
+ * console.log(region)
50
+ * })
51
+ */
52
+ update(id: string, body: HttpTypes.AdminUpdateRegion, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminRegionResponse>;
53
+ /**
54
+ * This method retrieves a list of regions. It sends a request to the
55
+ * [List Regions](https://docs.medusajs.com/api/admin#regions_getregions)
56
+ * API route.
57
+ *
58
+ * @param queryParams - Filters and pagination configurations.
59
+ * @param headers - Headers to pass in the request.
60
+ * @returns The paginated list of regions.
61
+ *
62
+ * @example
63
+ * To retrieve the list of regions:
64
+ *
65
+ * ```ts
66
+ * sdk.admin.region.list()
67
+ * .then(({ regions, count, limit, offset }) => {
68
+ * console.log(regions)
69
+ * })
70
+ * ```
71
+ *
72
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
73
+ *
74
+ * For example, to retrieve only 10 items and skip 10 items:
75
+ *
76
+ * ```ts
77
+ * sdk.admin.region.list({
78
+ * limit: 10,
79
+ * offset: 10
80
+ * })
81
+ * .then(({ regions, count, limit, offset }) => {
82
+ * console.log(regions)
83
+ * })
84
+ * ```
85
+ *
86
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
87
+ * in each region:
88
+ *
89
+ * ```ts
90
+ * sdk.admin.region.list({
91
+ * fields: "id,*countries"
92
+ * })
93
+ * .then(({ regions, count, limit, offset }) => {
94
+ * console.log(regions)
95
+ * })
96
+ * ```
97
+ *
98
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
99
+ */
100
+ list(queryParams?: FindParams & HttpTypes.AdminRegionFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminRegionListResponse>;
101
+ /**
102
+ * This method retrieves a region by ID. It sends a request to the
103
+ * [Get Region](https://docs.medusajs.com/api/admin#regions_getregionsid)
104
+ * API route.
105
+ *
106
+ * @param id - The ID of the region to retrieve.
107
+ * @param query - Configure the fields and relations to retrieve in the region.
108
+ * @param headers - Headers to pass in the request.
109
+ * @returns The region's details.
110
+ *
111
+ * @example
112
+ * To retrieve a region by its ID:
113
+ *
114
+ * ```ts
115
+ * sdk.admin.region.retrieve("region_123")
116
+ * .then(({ region }) => {
117
+ * console.log(region)
118
+ * })
119
+ * ```
120
+ *
121
+ * To specify the fields and relations to retrieve:
122
+ *
123
+ * ```ts
124
+ * sdk.admin.region.retrieve("region_123", {
125
+ * fields: "id,*countries"
126
+ * })
127
+ * .then(({ region }) => {
128
+ * console.log(region)
129
+ * })
130
+ * ```
131
+ *
132
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
133
+ */
134
+ retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminRegionResponse>;
135
+ /**
136
+ * This method deletes a region by ID. It sends a request to the
137
+ * [Delete Region](https://docs.medusajs.com/api/admin#regions_deleteregionsid)
138
+ * API route.
139
+ *
140
+ * @param id - The ID of the region to delete.
141
+ * @param headers - Headers to pass in the request.
142
+ * @returns The deletion's details.
143
+ *
144
+ * @example
145
+ * sdk.admin.region.delete("region_123")
146
+ * .then(({ deleted }) => {
147
+ * console.log(deleted)
148
+ * })
149
+ */
25
150
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminRegionDeleteResponse>;
26
151
  }
27
152
  //# sourceMappingURL=region.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../../src/admin/region.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,MAAM;IACjB;;OAEG;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