@reactionary/medusa 0.10.55 → 0.10.57
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 -0
- package/factories/product/product.factory.js +3 -0
- package/factories/product-associations/product-associations.factory.js +1 -0
- package/factories/product-search/product-search.factory.js +1 -0
- package/package.json +2 -2
- package/src/capabilities/product-recommendations.capability.d.ts +1 -0
- package/utils/product-compliance.js +15 -0
|
@@ -134,7 +134,10 @@ class MedusaProductFactory {
|
|
|
134
134
|
ce_marking: shared.ce_marking,
|
|
135
135
|
weee_symbol: shared.weee_symbol,
|
|
136
136
|
energy_class: shared.energy_class,
|
|
137
|
+
energy_class_range: shared.energy_class_range,
|
|
137
138
|
garan_duration: shared.garan_duration,
|
|
139
|
+
eprel_registration_number: shared.eprel_registration_number,
|
|
140
|
+
eprel_product_group: shared.eprel_product_group,
|
|
138
141
|
safety_warnings: safeStringConvert(body.metadata?.["compliance_data_safety_warnings"]),
|
|
139
142
|
composition: safeStringConvert(body.metadata?.["compliance_data_composition"]),
|
|
140
143
|
additional_disclosures: safeStringConvert(body.metadata?.["compliance_data_additional_disclosures"]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.57",
|
|
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.57",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|
|
@@ -35,6 +35,7 @@ export declare class MedusaProductRecommendationsCapability extends ProductRecom
|
|
|
35
35
|
};
|
|
36
36
|
name: string;
|
|
37
37
|
slug: string;
|
|
38
|
+
canAddToCartDirectly: boolean;
|
|
38
39
|
variants: ProductSearchResultItemVariant[];
|
|
39
40
|
complianceData: ProductSearchResultItemComplianceData;
|
|
40
41
|
};
|
|
@@ -2,6 +2,18 @@ import {
|
|
|
2
2
|
ProductSearchResultItemComplianceDataSchema
|
|
3
3
|
} from "@reactionary/core";
|
|
4
4
|
import { safeBoolConvert, safeStringConvert } from "./medusa-helpers.js";
|
|
5
|
+
function parseEnergyClassRange(value) {
|
|
6
|
+
const text = safeStringConvert(value)?.trim();
|
|
7
|
+
return text && /^[A-Za-z0-9+\-–_ ]{1,20}$/.test(text) ? text : void 0;
|
|
8
|
+
}
|
|
9
|
+
function parseEprelRegistrationNumber(value) {
|
|
10
|
+
const text = safeStringConvert(value)?.trim();
|
|
11
|
+
return text && /^\d{1,19}$/.test(text) ? text : void 0;
|
|
12
|
+
}
|
|
13
|
+
function parseEprelProductGroup(value) {
|
|
14
|
+
const text = safeStringConvert(value)?.trim().toLowerCase();
|
|
15
|
+
return text && /^[a-z0-9]{1,64}$/.test(text) ? text : void 0;
|
|
16
|
+
}
|
|
5
17
|
function parseProductSearchComplianceData(product) {
|
|
6
18
|
if (!product.metadata) {
|
|
7
19
|
return ProductSearchResultItemComplianceDataSchema.parse({});
|
|
@@ -12,7 +24,10 @@ function parseProductSearchComplianceData(product) {
|
|
|
12
24
|
ce_marking: safeBoolConvert(metadata["compliance_data_ce_marking"]),
|
|
13
25
|
weee_symbol: safeBoolConvert(metadata["compliance_data_weee_symbol"]),
|
|
14
26
|
energy_class: safeStringConvert(metadata["compliance_data_energy_class"]),
|
|
27
|
+
energy_class_range: parseEnergyClassRange(metadata["compliance_data_energy_class_range"]),
|
|
15
28
|
garan_duration: duration === void 0 || !Number.isFinite(Number(duration)) ? void 0 : Number(duration),
|
|
29
|
+
eprel_registration_number: parseEprelRegistrationNumber(metadata["compliance_data_eprel_registration_number"]),
|
|
30
|
+
eprel_product_group: parseEprelProductGroup(metadata["compliance_data_eprel_product_group"]),
|
|
16
31
|
is_organic: safeBoolConvert(metadata["compliance_data_organic_is_organic"]),
|
|
17
32
|
organic_certification_type: safeStringConvert(metadata["compliance_data_organic_certification_type"])
|
|
18
33
|
});
|