@medusajs/js-sdk 3.0.0-preview-20250211091350 → 3.0.0-preview-20250406180144
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.
- package/dist/admin/campaign.d.ts +9 -0
- package/dist/admin/campaign.d.ts.map +1 -1
- package/dist/admin/campaign.js +9 -0
- package/dist/admin/campaign.js.map +1 -1
- package/dist/admin/customer.d.ts +95 -0
- package/dist/admin/customer.d.ts.map +1 -1
- package/dist/admin/customer.js +120 -0
- package/dist/admin/customer.js.map +1 -1
- package/dist/admin/draft-order.d.ts +427 -0
- package/dist/admin/draft-order.d.ts.map +1 -0
- package/dist/admin/draft-order.js +534 -0
- package/dist/admin/draft-order.js.map +1 -0
- package/dist/admin/fulfillment-provider.d.ts +7 -1
- package/dist/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/admin/fulfillment-provider.js +7 -1
- package/dist/admin/fulfillment-provider.js.map +1 -1
- package/dist/admin/fulfillment.js +1 -1
- package/dist/admin/fulfillment.js.map +1 -1
- package/dist/admin/index.d.ts +10 -0
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/order.d.ts +2 -1
- package/dist/admin/order.d.ts.map +1 -1
- package/dist/admin/order.js +8 -0
- package/dist/admin/order.js.map +1 -1
- package/dist/admin/plugin.d.ts +9 -0
- package/dist/admin/plugin.d.ts.map +1 -0
- package/dist/admin/plugin.js +16 -0
- package/dist/admin/plugin.js.map +1 -0
- package/dist/admin/product-collection.d.ts +1 -1
- package/dist/admin/product-collection.js +1 -1
- package/dist/admin/product.d.ts +3 -2
- package/dist/admin/product.d.ts.map +1 -1
- package/dist/admin/product.js +3 -2
- package/dist/admin/product.js.map +1 -1
- package/dist/admin/promotion.d.ts +285 -1
- package/dist/admin/promotion.d.ts.map +1 -1
- package/dist/admin/promotion.js +284 -0
- package/dist/admin/promotion.js.map +1 -1
- package/dist/admin/refund-reasons.d.ts +48 -0
- package/dist/admin/refund-reasons.d.ts.map +1 -1
- package/dist/admin/refund-reasons.js +48 -0
- package/dist/admin/refund-reasons.js.map +1 -1
- package/dist/admin/region.d.ts +137 -12
- package/dist/admin/region.d.ts.map +1 -1
- package/dist/admin/region.js +133 -0
- package/dist/admin/region.js.map +1 -1
- package/dist/admin/reservation.d.ts +134 -0
- package/dist/admin/reservation.d.ts.map +1 -1
- package/dist/admin/reservation.js +134 -0
- package/dist/admin/reservation.js.map +1 -1
- package/dist/admin/return-reason.d.ts +135 -0
- package/dist/admin/return-reason.d.ts.map +1 -1
- package/dist/admin/return-reason.js +135 -0
- package/dist/admin/return-reason.js.map +1 -1
- package/dist/admin/return.d.ts +523 -1
- package/dist/admin/return.d.ts.map +1 -1
- package/dist/admin/return.js +522 -0
- package/dist/admin/return.js.map +1 -1
- package/dist/admin/sales-channel.d.ts +176 -1
- package/dist/admin/sales-channel.d.ts.map +1 -1
- package/dist/admin/sales-channel.js +175 -0
- package/dist/admin/sales-channel.js.map +1 -1
- package/dist/admin/shipping-option.d.ts +151 -0
- package/dist/admin/shipping-option.d.ts.map +1 -1
- package/dist/admin/shipping-option.js +151 -0
- package/dist/admin/shipping-option.js.map +1 -1
- package/dist/admin/shipping-profile.d.ts +132 -0
- package/dist/admin/shipping-profile.d.ts.map +1 -1
- package/dist/admin/shipping-profile.js +132 -0
- package/dist/admin/shipping-profile.js.map +1 -1
- package/dist/admin/stock-location.d.ts +190 -0
- package/dist/admin/stock-location.d.ts.map +1 -1
- package/dist/admin/stock-location.js +190 -0
- package/dist/admin/stock-location.js.map +1 -1
- package/dist/admin/store.d.ts +99 -0
- package/dist/admin/store.d.ts.map +1 -1
- package/dist/admin/store.js +99 -0
- package/dist/admin/store.js.map +1 -1
- package/dist/admin/tax-rate.d.ts +136 -0
- package/dist/admin/tax-rate.d.ts.map +1 -1
- package/dist/admin/tax-rate.js +136 -0
- package/dist/admin/tax-rate.js.map +1 -1
- package/dist/admin/tax-region.d.ts +125 -0
- package/dist/admin/tax-region.d.ts.map +1 -1
- package/dist/admin/tax-region.js +125 -1
- package/dist/admin/tax-region.js.map +1 -1
- package/dist/admin/upload.d.ts +65 -6
- package/dist/admin/upload.d.ts.map +1 -1
- package/dist/admin/upload.js +63 -1
- package/dist/admin/upload.js.map +1 -1
- package/dist/admin/user.d.ts +147 -0
- package/dist/admin/user.d.ts.map +1 -1
- package/dist/admin/user.js +147 -0
- package/dist/admin/user.js.map +1 -1
- package/dist/admin/workflow-execution.d.ts +62 -0
- package/dist/admin/workflow-execution.d.ts.map +1 -1
- package/dist/admin/workflow-execution.js +62 -0
- package/dist/admin/workflow-execution.js.map +1 -1
- package/dist/auth/index.d.ts +88 -24
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +89 -24
- package/dist/auth/index.js.map +1 -1
- package/dist/client.d.ts +9 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +67 -48
- package/dist/client.js.map +1 -1
- package/dist/esm/admin/campaign.d.ts +9 -0
- package/dist/esm/admin/campaign.d.ts.map +1 -1
- package/dist/esm/admin/campaign.js +9 -0
- package/dist/esm/admin/campaign.js.map +1 -1
- package/dist/esm/admin/customer.d.ts +95 -0
- package/dist/esm/admin/customer.d.ts.map +1 -1
- package/dist/esm/admin/customer.js +130 -0
- package/dist/esm/admin/customer.js.map +1 -1
- package/dist/esm/admin/draft-order.d.ts +427 -0
- package/dist/esm/admin/draft-order.d.ts.map +1 -0
- package/dist/esm/admin/draft-order.js +577 -0
- package/dist/esm/admin/draft-order.js.map +1 -0
- package/dist/esm/admin/fulfillment-provider.d.ts +7 -1
- package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment-provider.js +7 -1
- package/dist/esm/admin/fulfillment-provider.js.map +1 -1
- package/dist/esm/admin/fulfillment.js +1 -1
- package/dist/esm/admin/fulfillment.js.map +1 -1
- package/dist/esm/admin/index.d.ts +10 -0
- package/dist/esm/admin/index.d.ts.map +1 -1
- package/dist/esm/admin/index.js +4 -0
- package/dist/esm/admin/index.js.map +1 -1
- package/dist/esm/admin/order.d.ts +2 -1
- package/dist/esm/admin/order.d.ts.map +1 -1
- package/dist/esm/admin/order.js +10 -0
- package/dist/esm/admin/order.js.map +1 -1
- package/dist/esm/admin/plugin.d.ts +9 -0
- package/dist/esm/admin/plugin.d.ts.map +1 -0
- package/dist/esm/admin/plugin.js +23 -0
- package/dist/esm/admin/plugin.js.map +1 -0
- package/dist/esm/admin/product-collection.d.ts +1 -1
- package/dist/esm/admin/product-collection.js +1 -1
- package/dist/esm/admin/product.d.ts +3 -2
- package/dist/esm/admin/product.d.ts.map +1 -1
- package/dist/esm/admin/product.js +3 -2
- package/dist/esm/admin/product.js.map +1 -1
- package/dist/esm/admin/promotion.d.ts +285 -1
- package/dist/esm/admin/promotion.d.ts.map +1 -1
- package/dist/esm/admin/promotion.js +284 -0
- package/dist/esm/admin/promotion.js.map +1 -1
- package/dist/esm/admin/refund-reasons.d.ts +48 -0
- package/dist/esm/admin/refund-reasons.d.ts.map +1 -1
- package/dist/esm/admin/refund-reasons.js +48 -0
- package/dist/esm/admin/refund-reasons.js.map +1 -1
- package/dist/esm/admin/region.d.ts +137 -12
- package/dist/esm/admin/region.d.ts.map +1 -1
- package/dist/esm/admin/region.js +133 -0
- package/dist/esm/admin/region.js.map +1 -1
- package/dist/esm/admin/reservation.d.ts +134 -0
- package/dist/esm/admin/reservation.d.ts.map +1 -1
- package/dist/esm/admin/reservation.js +134 -0
- package/dist/esm/admin/reservation.js.map +1 -1
- package/dist/esm/admin/return-reason.d.ts +135 -0
- package/dist/esm/admin/return-reason.d.ts.map +1 -1
- package/dist/esm/admin/return-reason.js +135 -0
- package/dist/esm/admin/return-reason.js.map +1 -1
- package/dist/esm/admin/return.d.ts +523 -1
- package/dist/esm/admin/return.d.ts.map +1 -1
- package/dist/esm/admin/return.js +522 -0
- package/dist/esm/admin/return.js.map +1 -1
- package/dist/esm/admin/sales-channel.d.ts +176 -1
- package/dist/esm/admin/sales-channel.d.ts.map +1 -1
- package/dist/esm/admin/sales-channel.js +175 -0
- package/dist/esm/admin/sales-channel.js.map +1 -1
- package/dist/esm/admin/shipping-option.d.ts +151 -0
- package/dist/esm/admin/shipping-option.d.ts.map +1 -1
- package/dist/esm/admin/shipping-option.js +151 -0
- package/dist/esm/admin/shipping-option.js.map +1 -1
- package/dist/esm/admin/shipping-profile.d.ts +132 -0
- package/dist/esm/admin/shipping-profile.d.ts.map +1 -1
- package/dist/esm/admin/shipping-profile.js +132 -0
- package/dist/esm/admin/shipping-profile.js.map +1 -1
- package/dist/esm/admin/stock-location.d.ts +190 -0
- package/dist/esm/admin/stock-location.d.ts.map +1 -1
- package/dist/esm/admin/stock-location.js +190 -0
- package/dist/esm/admin/stock-location.js.map +1 -1
- package/dist/esm/admin/store.d.ts +99 -0
- package/dist/esm/admin/store.d.ts.map +1 -1
- package/dist/esm/admin/store.js +99 -0
- package/dist/esm/admin/store.js.map +1 -1
- package/dist/esm/admin/tax-rate.d.ts +136 -0
- package/dist/esm/admin/tax-rate.d.ts.map +1 -1
- package/dist/esm/admin/tax-rate.js +136 -0
- package/dist/esm/admin/tax-rate.js.map +1 -1
- package/dist/esm/admin/tax-region.d.ts +125 -0
- package/dist/esm/admin/tax-region.d.ts.map +1 -1
- package/dist/esm/admin/tax-region.js +125 -1
- package/dist/esm/admin/tax-region.js.map +1 -1
- package/dist/esm/admin/upload.d.ts +65 -6
- package/dist/esm/admin/upload.d.ts.map +1 -1
- package/dist/esm/admin/upload.js +63 -1
- package/dist/esm/admin/upload.js.map +1 -1
- package/dist/esm/admin/user.d.ts +147 -0
- package/dist/esm/admin/user.d.ts.map +1 -1
- package/dist/esm/admin/user.js +147 -0
- package/dist/esm/admin/user.js.map +1 -1
- package/dist/esm/admin/workflow-execution.d.ts +62 -0
- package/dist/esm/admin/workflow-execution.d.ts.map +1 -1
- package/dist/esm/admin/workflow-execution.js +62 -0
- package/dist/esm/admin/workflow-execution.js.map +1 -1
- package/dist/esm/auth/index.d.ts +88 -24
- package/dist/esm/auth/index.d.ts.map +1 -1
- package/dist/esm/auth/index.js +89 -24
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/client.d.ts +9 -8
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +97 -63
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/store/index.d.ts +19 -0
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/index.js +19 -0
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/types.d.ts +8 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +19 -0
- package/dist/store/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
@@ -14,6 +14,39 @@ export class Promotion {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a promotion by its ID. It sends a request to the
|
19
|
+
* [Retrieve Promotion](https://docs.medusajs.com/api/admin#promotions_getpromotionsid)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param id - The promotion's ID.
|
23
|
+
* @param query - Configure the fields to retrieve in the promotion.
|
24
|
+
* @param headers - Headers to pass in the request.
|
25
|
+
* @returns The promotion's details.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* To retrieve a promotion by its ID:
|
29
|
+
*
|
30
|
+
* ```ts
|
31
|
+
* sdk.admin.promotion.retrieve("promo_123")
|
32
|
+
* .then(({ promotion }) => {
|
33
|
+
* console.log(promotion)
|
34
|
+
* })
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
* To specify the fields and relations to retrieve:
|
38
|
+
*
|
39
|
+
* ```ts
|
40
|
+
* sdk.admin.promotion.retrieve("promo_123", {
|
41
|
+
* fields: "id,*application_method"
|
42
|
+
* })
|
43
|
+
* .then(({ promotion }) => {
|
44
|
+
* console.log(promotion)
|
45
|
+
* })
|
46
|
+
* ```
|
47
|
+
*
|
48
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
49
|
+
*/
|
17
50
|
retrieve(id, query, headers) {
|
18
51
|
return __awaiter(this, void 0, void 0, function* () {
|
19
52
|
return yield this.client.fetch(`/admin/promotions/${id}`, {
|
@@ -22,6 +55,53 @@ export class Promotion {
|
|
22
55
|
});
|
23
56
|
});
|
24
57
|
}
|
58
|
+
/**
|
59
|
+
* This method retrieves a list of promotions. It sends a request to the
|
60
|
+
* [List Promotions](https://docs.medusajs.com/api/admin#promotions_getpromotions)
|
61
|
+
* API route.
|
62
|
+
*
|
63
|
+
* @param query - Filters and pagination configurations.
|
64
|
+
* @param headers - Headers to pass in the request.
|
65
|
+
* @returns The list of promotions.
|
66
|
+
*
|
67
|
+
* @example
|
68
|
+
* To retrieve the list of promotions:
|
69
|
+
*
|
70
|
+
* ```ts
|
71
|
+
* sdk.admin.promotion.list()
|
72
|
+
* .then(({ promotions, count, limit, offset }) => {
|
73
|
+
* console.log(promotions)
|
74
|
+
* })
|
75
|
+
* ```
|
76
|
+
*
|
77
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
78
|
+
*
|
79
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
80
|
+
*
|
81
|
+
* ```ts
|
82
|
+
* sdk.admin.promotion.list({
|
83
|
+
* limit: 10,
|
84
|
+
* offset: 10
|
85
|
+
* })
|
86
|
+
* .then(({ promotions, count, limit, offset }) => {
|
87
|
+
* console.log(promotions)
|
88
|
+
* })
|
89
|
+
* ```
|
90
|
+
*
|
91
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
92
|
+
* in each promotion:
|
93
|
+
*
|
94
|
+
* ```ts
|
95
|
+
* sdk.admin.promotion.list({
|
96
|
+
* fields: "id,*application_method"
|
97
|
+
* })
|
98
|
+
* .then(({ promotions, count, limit, offset }) => {
|
99
|
+
* console.log(promotions)
|
100
|
+
* })
|
101
|
+
* ```
|
102
|
+
*
|
103
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
104
|
+
*/
|
25
105
|
list(query, headers) {
|
26
106
|
return __awaiter(this, void 0, void 0, function* () {
|
27
107
|
return yield this.client.fetch(`/admin/promotions`, {
|
@@ -30,6 +110,27 @@ export class Promotion {
|
|
30
110
|
});
|
31
111
|
});
|
32
112
|
}
|
113
|
+
/**
|
114
|
+
* This method creates a new promotion. It sends a request to the
|
115
|
+
* [Create Promotion](https://docs.medusajs.com/api/admin#promotions_postpromotions)
|
116
|
+
* API route.
|
117
|
+
*
|
118
|
+
* @param payload - The promotion to create.
|
119
|
+
* @param headers - Headers to pass in the request.
|
120
|
+
* @returns The promotion's details.
|
121
|
+
*
|
122
|
+
* @example
|
123
|
+
* sdk.admin.promotion.create({
|
124
|
+
* name: "My Promotion",
|
125
|
+
* description: "This is a test promotion",
|
126
|
+
* code: "PROMO123",
|
127
|
+
* starts_at: "2021-01-01",
|
128
|
+
* ends_at: "2021-01-01",
|
129
|
+
* })
|
130
|
+
* .then(({ promotion }) => {
|
131
|
+
* console.log(promotion)
|
132
|
+
* })
|
133
|
+
*/
|
33
134
|
create(payload, headers) {
|
34
135
|
return __awaiter(this, void 0, void 0, function* () {
|
35
136
|
return yield this.client.fetch(`/admin/promotions`, {
|
@@ -39,6 +140,24 @@ export class Promotion {
|
|
39
140
|
});
|
40
141
|
});
|
41
142
|
}
|
143
|
+
/**
|
144
|
+
* This method updates a promotion. It sends a request to the
|
145
|
+
* [Update Promotion](https://docs.medusajs.com/api/admin#promotions_postpromotionsid)
|
146
|
+
* API route.
|
147
|
+
*
|
148
|
+
* @param id - The promotion's ID.
|
149
|
+
* @param payload - The details to update in the promotion.
|
150
|
+
* @param headers - Headers to pass in the request.
|
151
|
+
* @returns The promotion's details.
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* sdk.admin.promotion.update("promo_123", {
|
155
|
+
* code: "PROMO123",
|
156
|
+
* })
|
157
|
+
* .then(({ promotion }) => {
|
158
|
+
* console.log(promotion)
|
159
|
+
* })
|
160
|
+
*/
|
42
161
|
update(id, payload, headers) {
|
43
162
|
return __awaiter(this, void 0, void 0, function* () {
|
44
163
|
return yield this.client.fetch(`/admin/promotions/${id}`, {
|
@@ -48,6 +167,21 @@ export class Promotion {
|
|
48
167
|
});
|
49
168
|
});
|
50
169
|
}
|
170
|
+
/**
|
171
|
+
* This method deletes a promotion. It sends a request to the
|
172
|
+
* [Delete Promotion](https://docs.medusajs.com/api/admin#promotions_deletepromotionsid)
|
173
|
+
* API route.
|
174
|
+
*
|
175
|
+
* @param id - The promotion's ID.
|
176
|
+
* @param headers - Headers to pass in the request.
|
177
|
+
* @returns The deleted promotion's details.
|
178
|
+
*
|
179
|
+
* @example
|
180
|
+
* sdk.admin.promotion.delete("promo_123")
|
181
|
+
* .then(({ promotion }) => {
|
182
|
+
* console.log(promotion)
|
183
|
+
* })
|
184
|
+
*/
|
51
185
|
delete(id, headers) {
|
52
186
|
return __awaiter(this, void 0, void 0, function* () {
|
53
187
|
return yield this.client.fetch(`/admin/promotions/${id}`, {
|
@@ -56,6 +190,38 @@ export class Promotion {
|
|
56
190
|
});
|
57
191
|
});
|
58
192
|
}
|
193
|
+
/**
|
194
|
+
* This method creates and adds rules to a promotion. It can be the promotion's rules,
|
195
|
+
* or its application method's buy or target rules. That depends on the rule type
|
196
|
+
* you specify as a parameter.
|
197
|
+
*
|
198
|
+
* - If you set the `ruleType` to `rules`, the method sends a request to the
|
199
|
+
* [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
|
200
|
+
* - If you set the `ruleType` to `buy-rules`, the method sends a request to the
|
201
|
+
* [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
|
202
|
+
* - If you set the `ruleType` to `target-rules`, the method sends a request to the
|
203
|
+
* [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
|
204
|
+
*
|
205
|
+
* @param id - The promotion's ID.
|
206
|
+
* @param ruleType - The type of rules to create.
|
207
|
+
* @param payload - The rules to create.
|
208
|
+
* @param headers - Headers to pass in the request.
|
209
|
+
* @returns The promotion's details.
|
210
|
+
*
|
211
|
+
* @example
|
212
|
+
* sdk.admin.promotion.addRules("promo_123", "rules", {
|
213
|
+
* rules: [
|
214
|
+
* {
|
215
|
+
* operator: "eq",
|
216
|
+
* attribute: "product_id",
|
217
|
+
* values: ["prod_123"]
|
218
|
+
* }
|
219
|
+
* ]
|
220
|
+
* })
|
221
|
+
* .then(({ promotion }) => {
|
222
|
+
* console.log(promotion)
|
223
|
+
* })
|
224
|
+
*/
|
59
225
|
addRules(id, ruleType, payload, headers) {
|
60
226
|
return __awaiter(this, void 0, void 0, function* () {
|
61
227
|
return yield this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
|
@@ -65,6 +231,37 @@ export class Promotion {
|
|
65
231
|
});
|
66
232
|
});
|
67
233
|
}
|
234
|
+
/**
|
235
|
+
* This method updates the rules of a promotion. It can be the promotion's rules,
|
236
|
+
* or its application method's buy or target rules. That depends on the rule type
|
237
|
+
* you specify as a parameter.
|
238
|
+
*
|
239
|
+
* - If you set the `ruleType` to `rules`, the method sends a request to the
|
240
|
+
* [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
|
241
|
+
* - If you set the `ruleType` to `buy-rules`, the method sends a request to the
|
242
|
+
* [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
|
243
|
+
* - If you set the `ruleType` to `target-rules`, the method sends a request to the
|
244
|
+
* [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
|
245
|
+
*
|
246
|
+
* @param id - The promotion's ID.
|
247
|
+
* @param ruleType - The type of rules to update.
|
248
|
+
* @param payload - The rules to update.
|
249
|
+
* @param headers - Headers to pass in the request.
|
250
|
+
* @returns The promotion's details.
|
251
|
+
*
|
252
|
+
* @example
|
253
|
+
* sdk.admin.promotion.updateRules("promo_123", "rules", {
|
254
|
+
* rules: [
|
255
|
+
* {
|
256
|
+
* id: "rule_123",
|
257
|
+
* operator: "ne",
|
258
|
+
* }
|
259
|
+
* ]
|
260
|
+
* })
|
261
|
+
* .then(({ promotion }) => {
|
262
|
+
* console.log(promotion)
|
263
|
+
* })
|
264
|
+
*/
|
68
265
|
updateRules(id, ruleType, payload, headers) {
|
69
266
|
return __awaiter(this, void 0, void 0, function* () {
|
70
267
|
return yield this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
|
@@ -74,6 +271,32 @@ export class Promotion {
|
|
74
271
|
});
|
75
272
|
});
|
76
273
|
}
|
274
|
+
/**
|
275
|
+
* This method removes rules from a promotion. It can be the promotion's rules,
|
276
|
+
* or its application method's buy or target rules. That depends on the rule type
|
277
|
+
* you specify as a parameter.
|
278
|
+
*
|
279
|
+
* - If you set the `ruleType` to `rules`, the method sends a request to the
|
280
|
+
* [Manage Promotion's Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidrulesbatch).
|
281
|
+
* - If you set the `ruleType` to `buy-rules`, the method sends a request to the
|
282
|
+
* [Manage Promotion's Buy Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidbuyrulesbatch).
|
283
|
+
* - If you set the `ruleType` to `target-rules`, the method sends a request to the
|
284
|
+
* [Manage Promotion's Target Rules API Route](https://docs.medusajs.com/api/admin#promotions_postpromotionsidtargetrulesbatch).
|
285
|
+
*
|
286
|
+
* @param id - The promotion's ID.
|
287
|
+
* @param ruleType - The type of rules to remove.
|
288
|
+
* @param payload - The rules to remove.
|
289
|
+
* @param headers - Headers to pass in the request.
|
290
|
+
* @returns The promotion's details.
|
291
|
+
*
|
292
|
+
* @example
|
293
|
+
* sdk.admin.promotion.removeRules("promo_123", "rules", {
|
294
|
+
* rule_ids: ["rule_123"]
|
295
|
+
* })
|
296
|
+
* .then(({ promotion }) => {
|
297
|
+
* console.log(promotion)
|
298
|
+
* })
|
299
|
+
*/
|
77
300
|
removeRules(id, ruleType, payload, headers) {
|
78
301
|
return __awaiter(this, void 0, void 0, function* () {
|
79
302
|
return yield this.client.fetch(`/admin/promotions/${id}/${ruleType}/batch`, {
|
@@ -83,6 +306,26 @@ export class Promotion {
|
|
83
306
|
});
|
84
307
|
});
|
85
308
|
}
|
309
|
+
/**
|
310
|
+
* This method retrieves the rules of a promotion. It can be the promotion's rules,
|
311
|
+
* or its application method's buy or target rules. That depends on the rule type
|
312
|
+
* you specify as a parameter.
|
313
|
+
*
|
314
|
+
* This method sends a request to the
|
315
|
+
* [List Rules of a Promotion API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsidrule_type)
|
316
|
+
*
|
317
|
+
* @param id - The promotion's ID.
|
318
|
+
* @param ruleType - The type of rules to retrieve. Can be `rules`, `buy-rules`, or `target-rules`.
|
319
|
+
* @param query - Configure the fields to retrieve in the rules.
|
320
|
+
* @param headers - Headers to pass in the request.
|
321
|
+
* @returns The promotion's rules.
|
322
|
+
*
|
323
|
+
* @example
|
324
|
+
* sdk.admin.promotion.listRules("promo_123", "rules")
|
325
|
+
* .then(({ rules }) => {
|
326
|
+
* console.log(rules)
|
327
|
+
* })
|
328
|
+
*/
|
86
329
|
listRules(id, ruleType, query, headers) {
|
87
330
|
return __awaiter(this, void 0, void 0, function* () {
|
88
331
|
// eslint-disable-next-line max-len
|
@@ -92,6 +335,27 @@ export class Promotion {
|
|
92
335
|
});
|
93
336
|
});
|
94
337
|
}
|
338
|
+
/**
|
339
|
+
* 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:
|
340
|
+
*
|
341
|
+
* - If `rule_type` is `rules`, the attributes of the promotion's type are retrieved.
|
342
|
+
* - If `rule_type` is `target-rules`, the target rules' attributes of the application method's type are retrieved.
|
343
|
+
* - If `rule_type` is `buy-rules`, the buy rules' attributes of the application method's type are retrieved.
|
344
|
+
*
|
345
|
+
* This method sends a request to the
|
346
|
+
* [List Rule Attribute Options API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsruleattributeoptionsrule_type)
|
347
|
+
*
|
348
|
+
* @param ruleType - The type of rules to retrieve the attributes for. Can be `rules`, `buy-rules`, or `target-rules`.
|
349
|
+
* @param promotionType - The type of promotion to retrieve the attributes for. It can be `standard` or `buyget`.
|
350
|
+
* @param headers - Headers to pass in the request.
|
351
|
+
* @returns The list of rule attributes.
|
352
|
+
*
|
353
|
+
* @example
|
354
|
+
* sdk.admin.promotion.listRuleAttributes("rules", "standard")
|
355
|
+
* .then(({ attributes }) => {
|
356
|
+
* console.log(attributes)
|
357
|
+
* })
|
358
|
+
*/
|
95
359
|
listRuleAttributes(ruleType, promotionType, headers) {
|
96
360
|
return __awaiter(this, void 0, void 0, function* () {
|
97
361
|
// eslint-disable-next-line max-len
|
@@ -101,6 +365,26 @@ export class Promotion {
|
|
101
365
|
});
|
102
366
|
});
|
103
367
|
}
|
368
|
+
/**
|
369
|
+
* Retrieve all potential values for promotion rules and target and buy rules based on the specified rule attribute and type.
|
370
|
+
* For example, if you provide the ID of the `currency_code` rule attribute, and set `rule_type` to rules,
|
371
|
+
* a list of currencies are retrieved in label-value pairs.
|
372
|
+
*
|
373
|
+
* This method sends a request to the
|
374
|
+
* [List Rule Values API Route](https://docs.medusajs.com/api/admin#promotions_getpromotionsrulevalueoptionsrule_typerule_attribute_id)
|
375
|
+
*
|
376
|
+
* @param ruleType - The type of rules to retrieve the values for. Can be `rules`, `buy-rules`, or `target-rules`.
|
377
|
+
* @param ruleValue - The ID of the rule attribute to retrieve the values for.
|
378
|
+
* @param query - Configure the fields to retrieve in the rule values.
|
379
|
+
* @param headers - Headers to pass in the request.
|
380
|
+
* @returns The list of rule values.
|
381
|
+
*
|
382
|
+
* @example
|
383
|
+
* sdk.admin.promotion.listRuleValues("rules", "attr_123")
|
384
|
+
* .then(({ values }) => {
|
385
|
+
* console.log(values)
|
386
|
+
* })
|
387
|
+
*/
|
104
388
|
listRuleValues(ruleType, ruleValue, query, headers) {
|
105
389
|
return __awaiter(this, void 0, void 0, function* () {
|
106
390
|
return yield this.client.fetch(`/admin/promotions/rule-value-options/${ruleType}/${ruleValue}`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"promotion.js","sourceRoot":"","sources":["../../../src/admin/promotion.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,SAAS;IAKpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"promotion.js","sourceRoot":"","sources":["../../../src/admin/promotion.ts"],"names":[],"mappings":"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"}
|
@@ -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;
|
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"}
|
@@ -14,6 +14,54 @@ export class RefundReason {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a list of refund reasons. It sends a request to the
|
19
|
+
* [List Refund Reasons](https://docs.medusajs.com/api/admin#refund-reasons_getrefundreasons)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param query - Filters and pagination configurations.
|
23
|
+
* @param headers - Headers to pass in the request.
|
24
|
+
* @returns The paginated list of refund reasons.
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* To retrieve the list of refund reasons:
|
28
|
+
*
|
29
|
+
* ```ts
|
30
|
+
* sdk.admin.refundReason.list()
|
31
|
+
* .then(({ refund_reasons, count, limit, offset }) => {
|
32
|
+
* console.log(refund_reasons)
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
37
|
+
*
|
38
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
39
|
+
*
|
40
|
+
* ```ts
|
41
|
+
* sdk.admin.refundReason.list({
|
42
|
+
* limit: 10,
|
43
|
+
* offset: 10
|
44
|
+
* })
|
45
|
+
* .then(({ refund_reasons, count, limit, offset }) => {
|
46
|
+
* console.log(refund_reasons)
|
47
|
+
* })
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
51
|
+
* in each refund reason:
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* sdk.admin.refundReason.list({
|
55
|
+
* fields: "id,name"
|
56
|
+
* })
|
57
|
+
* .then(({ refund_reasons, count, limit, offset }) => {
|
58
|
+
* console.log(refund_reasons)
|
59
|
+
* })
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
63
|
+
*
|
64
|
+
*/
|
17
65
|
list(query, headers) {
|
18
66
|
return __awaiter(this, void 0, void 0, function* () {
|
19
67
|
return yield this.client.fetch(`/admin/refund-reasons`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refund-reasons.js","sourceRoot":"","sources":["../../../src/admin/refund-reasons.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"refund-reasons.js","sourceRoot":"","sources":["../../../src/admin/refund-reasons.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;IACG,IAAI,CAAC,KAAqC,EAAE,OAAuB;;YACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,uBAAuB,EACvB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|
@@ -10,18 +10,143 @@ export declare class Region {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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,
|
1
|
+
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../../../src/admin/region.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,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;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,iBAAiB,EACjC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,iBAAiB,EACjC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,kBAAkB,EACvD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
|