@reactionary/medusa 0.10.20 → 0.10.22
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.
|
@@ -125,7 +125,26 @@ class MedusaCheckoutCapability extends CheckoutCapability {
|
|
|
125
125
|
this.getAvailableShippingMethodsPayload(payload)
|
|
126
126
|
);
|
|
127
127
|
const shippingMethods = [];
|
|
128
|
+
if (debug.enabled) {
|
|
129
|
+
debug(
|
|
130
|
+
`Found ${shippingMethodResponse.shipping_options.length} shipping methods for checkout with key: ${payload.checkout.key}`,
|
|
131
|
+
shippingMethodResponse.shipping_options
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const calculatedPricesPromises = shippingMethodResponse.shipping_options.filter((x) => x.price_type === "calculated" && !x.calculated_price).map(async (sm) => {
|
|
135
|
+
const updatedSM = await client.store.fulfillment.calculate(sm.id, {
|
|
136
|
+
cart_id: payload.checkout.key
|
|
137
|
+
});
|
|
138
|
+
sm.calculated_price = updatedSM.shipping_option.calculated_price;
|
|
139
|
+
});
|
|
140
|
+
if (calculatedPricesPromises.length > 0) {
|
|
141
|
+
await Promise.all(calculatedPricesPromises);
|
|
142
|
+
}
|
|
128
143
|
for (const sm of shippingMethodResponse.shipping_options) {
|
|
144
|
+
if (!sm.calculated_price || !sm.calculated_price.calculated_amount && !sm.calculated_price.original_amount) {
|
|
145
|
+
console.warn(`Skipping shipping method ${sm.name}/${sm.provider.id} because it has no calculated price for checkout ${payload.checkout.key}`);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
129
148
|
shippingMethods.push(this.factory.parseShippingMethod(this.context, sm));
|
|
130
149
|
}
|
|
131
150
|
if (debug.enabled) {
|
package/core/client.js
CHANGED
|
@@ -9,7 +9,7 @@ import createDebug from "debug";
|
|
|
9
9
|
import {
|
|
10
10
|
MedusaSessionSchema
|
|
11
11
|
} from "../index.js";
|
|
12
|
-
const debug = createDebug("reactionary:medusa");
|
|
12
|
+
const debug = createDebug("reactionary:medusa:client");
|
|
13
13
|
const SESSION_KEY = "MEDUSA_PROVIDER";
|
|
14
14
|
class RequestContextTokenStore {
|
|
15
15
|
constructor(context, keyPrefix = "__x") {
|
|
@@ -75,7 +75,7 @@ class MedusaAdminAPI {
|
|
|
75
75
|
this.client = new Medusa({
|
|
76
76
|
baseUrl: this.config.apiUrl,
|
|
77
77
|
apiKey: this.config.adminApiKey,
|
|
78
|
-
debug:
|
|
78
|
+
debug: debug.enabled,
|
|
79
79
|
globalHeaders: {
|
|
80
80
|
"x-medusa-locale": this.context.languageContext.locale
|
|
81
81
|
}
|
|
@@ -214,7 +214,7 @@ class MedusaAPI {
|
|
|
214
214
|
const authenticatedClient = new Medusa({
|
|
215
215
|
baseUrl: this.config.apiUrl,
|
|
216
216
|
publishableKey: this.config.publishable_key,
|
|
217
|
-
debug:
|
|
217
|
+
debug: debug.enabled,
|
|
218
218
|
globalHeaders: {
|
|
219
219
|
"x-medusa-locale": this.context.languageContext.locale
|
|
220
220
|
},
|
|
@@ -190,7 +190,7 @@ class MedusaCheckoutFactory {
|
|
|
190
190
|
description: data.type.description || "",
|
|
191
191
|
price: MonetaryAmountSchema.parse({
|
|
192
192
|
value: data.calculated_price.calculated_amount || 0,
|
|
193
|
-
currency: data.calculated_price.currency_code?.toUpperCase()
|
|
193
|
+
currency: data.calculated_price.currency_code?.toUpperCase() || _context.languageContext.currencyCode
|
|
194
194
|
}),
|
|
195
195
|
deliveryTime: ""
|
|
196
196
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@medusajs/js-sdk": "^2.13.3",
|
|
13
|
-
"@reactionary/core": "0.10.
|
|
13
|
+
"@reactionary/core": "0.10.22",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|