@reactionary/medusa 0.10.43 → 0.10.45
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/capabilities/product-recommendations.capability.js +1 -1
- package/factories/product-associations/product-associations.factory.js +1 -1
- package/factories/product-search/product-search.factory.js +1 -1
- package/package.json +2 -2
- package/src/utils/medusa-helpers.d.ts +8 -2
- package/utils/medusa-helpers.js +2 -2
|
@@ -105,7 +105,7 @@ class MedusaProductRecommendationsCapability extends ProductRecommendationsCapab
|
|
|
105
105
|
}
|
|
106
106
|
parseVariant(variant, product) {
|
|
107
107
|
const img = ImageSchema.parse({
|
|
108
|
-
sourceUrl: product.images?.[0]
|
|
108
|
+
sourceUrl: product.images?.[0]?.url ?? "",
|
|
109
109
|
altText: product.title || void 0
|
|
110
110
|
});
|
|
111
111
|
return ProductSearchResultItemVariantSchema.parse({
|
|
@@ -37,7 +37,7 @@ class MedusaProductAssociationsFactory {
|
|
|
37
37
|
}
|
|
38
38
|
parseVariant(_context, variant, product) {
|
|
39
39
|
const img = ImageSchema.parse({
|
|
40
|
-
sourceUrl: product.images?.[0]
|
|
40
|
+
sourceUrl: product.images?.[0]?.url ?? "",
|
|
41
41
|
altText: product.title || void 0
|
|
42
42
|
});
|
|
43
43
|
return ProductSearchResultItemVariantSchema.parse({
|
|
@@ -51,7 +51,7 @@ class MedusaProductSearchFactory {
|
|
|
51
51
|
}
|
|
52
52
|
parseVariant(_context, variant, product) {
|
|
53
53
|
const img = ImageSchema.parse({
|
|
54
|
-
sourceUrl: product.images?.[0]
|
|
54
|
+
sourceUrl: product.images?.[0]?.url ?? "",
|
|
55
55
|
altText: product.title || void 0
|
|
56
56
|
});
|
|
57
57
|
return ProductSearchResultItemVariantSchema.parse({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.45",
|
|
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.45",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { StoreCart
|
|
1
|
+
import type { StoreCart } from '@medusajs/types';
|
|
2
2
|
import type { CostBreakDown, Currency } from '@reactionary/core';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of StoreCart/StoreOrder fields parseMedusaCostBreakdown reads.
|
|
5
|
+
* Narrowed (rather than StoreCart | StoreOrder) so tests can build a minimal,
|
|
6
|
+
* fully-typed fixture without casting.
|
|
7
|
+
*/
|
|
8
|
+
export type MedusaCostBreakdownSource = Pick<StoreCart, 'total' | 'subtotal' | 'item_subtotal' | 'shipping_total' | 'tax_total' | 'discount_total' | 'currency_code'>;
|
|
3
9
|
/**
|
|
4
10
|
* Parses cost breakdown from Medusa StoreCart
|
|
5
11
|
*/
|
|
6
|
-
export declare function parseMedusaCostBreakdown(remote:
|
|
12
|
+
export declare function parseMedusaCostBreakdown(remote: MedusaCostBreakdownSource): CostBreakDown;
|
|
7
13
|
/**
|
|
8
14
|
* Parses item price structure from Medusa line item
|
|
9
15
|
*/
|
package/utils/medusa-helpers.js
CHANGED
|
@@ -5,7 +5,7 @@ function parseMedusaCostBreakdown(remote) {
|
|
|
5
5
|
const shippingTotal = remote.shipping_total || 0;
|
|
6
6
|
const taxTotal = remote.tax_total || 0;
|
|
7
7
|
const discountTotal = remote.discount_total || 0;
|
|
8
|
-
const
|
|
8
|
+
const itemSubtotal = remote.item_subtotal || 0;
|
|
9
9
|
const currency = (remote.currency_code || "EUR").toUpperCase();
|
|
10
10
|
return {
|
|
11
11
|
totalTax: {
|
|
@@ -25,7 +25,7 @@ function parseMedusaCostBreakdown(remote) {
|
|
|
25
25
|
currency
|
|
26
26
|
},
|
|
27
27
|
totalProductPrice: {
|
|
28
|
-
value:
|
|
28
|
+
value: itemSubtotal,
|
|
29
29
|
currency
|
|
30
30
|
},
|
|
31
31
|
grandTotal: {
|