@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.
@@ -95,6 +95,7 @@ class MedusaProductRecommendationsCapability extends ProductRecommendationsCapab
95
95
  identifier,
96
96
  name,
97
97
  slug,
98
+ canAddToCartDirectly: (_body.variants?.length ?? 0) === 1,
98
99
  variants,
99
100
  complianceData: this.buildProductComplianceData(_body)
100
101
  };
@@ -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"]),
@@ -22,6 +22,7 @@ class MedusaProductAssociationsFactory {
22
22
  identifier,
23
23
  name,
24
24
  slug,
25
+ canAddToCartDirectly: (data.product.variants?.length ?? 0) === 1,
25
26
  variants,
26
27
  complianceData: this.parseComplianceData(data.product)
27
28
  };
@@ -45,6 +45,7 @@ class MedusaProductSearchFactory {
45
45
  name,
46
46
  slug,
47
47
  complianceData,
48
+ canAddToCartDirectly: (data.variants?.length ?? 0) === 1,
48
49
  variants
49
50
  };
50
51
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/medusa",
3
- "version": "0.10.55",
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.55",
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
  });