@reactionary/feeds 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.
Files changed (2) hide show
  1. package/cli.cjs +49 -7
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -37222,6 +37222,9 @@ var init_product_model = __esm({
37222
37222
  weee_symbol: boolean2().default(false).meta({ description: "Indicates whether the WEEE symbol can be shown on the product" }),
37223
37223
  energy_class: string2().optional().meta({ description: "The energy class of the product, as required by EU regulations. A,B,C,D,E,F,G, etc" }),
37224
37224
  garan_duration: number2().optional().meta({ description: "The duration of the guarantee in months as by the EU Garan scheme. Only set if above 24." }),
37225
+ energy_class_range: string2().optional().meta({ description: 'The scale the energy class belongs to, e.g. "A-G", "A++-G" or "A+++-D". Needed to render the EU class arrow, because the same class letter is drawn differently on different scales.' }),
37226
+ eprel_registration_number: string2().optional().meta({ description: "The EPREL registration number of the product model (digits only, up to 19). Together with eprel_product_group it identifies the official EU energy label and class arrow." }),
37227
+ eprel_product_group: string2().optional().meta({ description: 'The EPREL product group URL code the model is registered under, e.g. "spaceheaters" or "localspaceheaters".' }),
37225
37228
  safety_warnings: string2().optional().meta({ description: "Any safety warnings associated with the product as required by EU regulations." }),
37226
37229
  composition: string2().optional().meta({ description: "The composition of the product as required by EU regulations." }),
37227
37230
  additional_disclosures: string2().optional().meta({ description: "Any additional disclosures associated with the product as required by EU regulations." }),
@@ -37314,6 +37317,9 @@ var init_product_search_model = __esm({
37314
37317
  weee_symbol: boolean2().default(false).meta({ description: "Indicates whether the WEEE symbol can be shown on the product" }),
37315
37318
  energy_class: string2().optional().meta({ description: "The energy class of the product, as required by EU regulations. A,B,C,D,E,F,G, etc" }),
37316
37319
  garan_duration: number2().optional().meta({ description: "The duration of the guarantee in months as by the EU Garan scheme. Only set if above 24." }),
37320
+ energy_class_range: string2().optional().meta({ description: 'The scale the energy class belongs to, e.g. "A-G", "A++-G" or "A+++-D". Needed to render the EU class arrow, because the same class letter is drawn differently on different scales.' }),
37321
+ eprel_registration_number: string2().optional().meta({ description: "The EPREL registration number of the product model (digits only, up to 19). Together with eprel_product_group it identifies the official EU energy label and class arrow." }),
37322
+ eprel_product_group: string2().optional().meta({ description: 'The EPREL product group URL code the model is registered under, e.g. "spaceheaters" or "localspaceheaters".' }),
37317
37323
  is_organic: boolean2().optional().meta({ description: "Indicates whether the product is organic" }),
37318
37324
  organic_certification_type: string2().optional().meta({ description: "The type of organic certification, e.g., EU_ORGANIC_LEAF, GOTS, ECOCERT." })
37319
37325
  });
@@ -37327,6 +37333,7 @@ var init_product_search_model = __esm({
37327
37333
  name: string2(),
37328
37334
  slug: string2(),
37329
37335
  complianceData: ProductSearchResultItemComplianceDataSchema.optional().meta({ description: "Compliance data for the product as required by EU regulations." }),
37336
+ canAddToCartDirectly: boolean2().default(false).meta({ description: "Whether the storefront may render an add-to-cart button for this product directly on a PLP. When false, the customer must always visit the PDP first, e.g. for regulatory reasons or as a business decision. Set by the indexer where the search provider supports it; otherwise providers default it to true only when the product has exactly one variant." }),
37330
37337
  variants: array(ProductSearchResultItemVariantSchema).meta({ description: "A list of variants associated with the product in the search results. If exactly one is present, you can use add-to-cart directly from PLP. If none are present, you must direct to PDP. If mulitple are present, and no options are set, you must direct to PDP. If multiple are present, and they have options, you can render swatches on PLP and allow customer to flip between variants." })
37331
37338
  });
37332
37339
  ProductSearchResultFacetValueSchema = looseObject({
@@ -71630,11 +71637,13 @@ var init_product_recommendations_capability2 = __esm({
71630
71637
  };
71631
71638
  }
71632
71639
  parseSearchResultItem(body) {
71640
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
71633
71641
  const product = {
71634
71642
  identifier: { key: body.objectID },
71635
71643
  name: body.name || body.objectID,
71636
71644
  slug: body.slug || body.objectID,
71637
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body)),
71645
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
71646
+ variants,
71638
71647
  complianceData: this.parseComplianceData(body)
71639
71648
  };
71640
71649
  return product;
@@ -71723,14 +71732,16 @@ var init_product_search_factory2 = __esm({
71723
71732
  return data.complianceData ?? ProductSearchResultItemComplianceDataSchema.parse({});
71724
71733
  }
71725
71734
  parseSingle(body) {
71735
+ const variants = [...body.variants || []].map(
71736
+ (variant) => this.parseVariant(variant, body)
71737
+ );
71726
71738
  return {
71727
71739
  identifier: { key: body.objectID },
71728
71740
  name: body.name || body.objectID,
71729
71741
  slug: body.slug || body.objectID,
71730
71742
  complianceData: this.parseComplianceData(body),
71731
- variants: [...body.variants || []].map(
71732
- (variant) => this.parseVariant(variant, body)
71733
- )
71743
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
71744
+ variants
71734
71745
  };
71735
71746
  }
71736
71747
  parseVariant(variant, product) {
@@ -71920,7 +71931,7 @@ var init_configuration_schema = __esm({
71920
71931
  apiKey: string2(),
71921
71932
  indexName: string2(),
71922
71933
  useRecommendationsForBots: boolean2().default(false).meta({ description: "Whether to use recommendations for bot traffic. By default, recommendations are not used for bots to save on API costs, but enabling this can provide a better experience for bot traffic such as search engine crawlers." }),
71923
- useBaseIndexNameForEnglishLocale: boolean2().default(true).meta({ description: "Deprecated. When possible, move to all indexes with locale suffix. Whether to use the base name for the English locale. By default, this is enabled.", deprecated: true })
71934
+ useBaseIndexNameForEnglishLocale: boolean2().default(false).meta({ description: "Deprecated. Whether to use the base index name, without locale suffix, for the English locale. By default, this is disabled and every locale, including English, uses an index with a locale suffix (e.g. products_en), which is what recalcitrant writes. Enable only for legacy setups with an unsuffixed English index.", deprecated: true })
71924
71935
  });
71925
71936
  }
71926
71937
  });
@@ -113846,6 +113857,7 @@ var init_product_associations_factory2 = __esm({
113846
113857
  identifier: { key: data.id },
113847
113858
  name: data.name[localeStr] || data.id,
113848
113859
  slug: data.slug?.[localeStr] || data.id,
113860
+ canAddToCartDirectly: variants.length === 1,
113849
113861
  variants,
113850
113862
  complianceData: this.buildProductComplianceData(data)
113851
113863
  };
@@ -114237,6 +114249,7 @@ var init_product_search_factory3 = __esm({
114237
114249
  name,
114238
114250
  slug,
114239
114251
  complianceData: this.parseComplianceData(data),
114252
+ canAddToCartDirectly: variants.length === 1,
114240
114253
  variants
114241
114254
  };
114242
114255
  return result;
@@ -121527,6 +121540,7 @@ var init_product_search_capability4 = __esm({
121527
121540
  },
121528
121541
  name: productGenerator.commerce.productName(),
121529
121542
  slug: productGenerator.lorem.slug(),
121543
+ canAddToCartDirectly: true,
121530
121544
  variants: [
121531
121545
  {
121532
121546
  variant: {
@@ -122983,6 +122997,7 @@ var init_product_associations_capability3 = __esm({
122983
122997
  identifier: { key },
122984
122998
  name: `Fake ${type} ${i3 + 1} for ${baseProductKey}`,
122985
122999
  slug: key,
123000
+ canAddToCartDirectly: true,
122986
123001
  variants: [{
122987
123002
  variant: { sku: `${key}-variant` },
122988
123003
  image: {
@@ -126444,6 +126459,7 @@ function buildProductSearchResultItem(config3, product) {
126444
126459
  identifier: { key: getProductKey(product) },
126445
126460
  name: product.name || product.sku,
126446
126461
  slug: getCustomAttribute(product, "url_key") ?? getCustomAttribute(product, "url_path") ?? "",
126462
+ canAddToCartDirectly: variants.length === 1,
126447
126463
  variants,
126448
126464
  complianceData: buildProductComplianceData(product)
126449
126465
  };
@@ -127885,6 +127901,7 @@ var init_product_search_factory5 = __esm({
127885
127901
  identifier,
127886
127902
  name,
127887
127903
  slug,
127904
+ canAddToCartDirectly: variants.length === 1,
127888
127905
  variants,
127889
127906
  complianceData: this.parseComplianceData(product)
127890
127907
  };
@@ -161442,6 +161459,18 @@ var init_product_search_capability6 = __esm({
161442
161459
  });
161443
161460
 
161444
161461
  // packages/medusa/src/utils/product-compliance.ts
161462
+ function parseEnergyClassRange(value) {
161463
+ const text2 = safeStringConvert(value)?.trim();
161464
+ return text2 && /^[A-Za-z0-9+\-–_ ]{1,20}$/.test(text2) ? text2 : void 0;
161465
+ }
161466
+ function parseEprelRegistrationNumber(value) {
161467
+ const text2 = safeStringConvert(value)?.trim();
161468
+ return text2 && /^\d{1,19}$/.test(text2) ? text2 : void 0;
161469
+ }
161470
+ function parseEprelProductGroup(value) {
161471
+ const text2 = safeStringConvert(value)?.trim().toLowerCase();
161472
+ return text2 && /^[a-z0-9]{1,64}$/.test(text2) ? text2 : void 0;
161473
+ }
161445
161474
  function parseProductSearchComplianceData(product) {
161446
161475
  if (!product.metadata) {
161447
161476
  return ProductSearchResultItemComplianceDataSchema.parse({});
@@ -161452,7 +161481,10 @@ function parseProductSearchComplianceData(product) {
161452
161481
  ce_marking: safeBoolConvert(metadata["compliance_data_ce_marking"]),
161453
161482
  weee_symbol: safeBoolConvert(metadata["compliance_data_weee_symbol"]),
161454
161483
  energy_class: safeStringConvert(metadata["compliance_data_energy_class"]),
161484
+ energy_class_range: parseEnergyClassRange(metadata["compliance_data_energy_class_range"]),
161455
161485
  garan_duration: duration3 === void 0 || !Number.isFinite(Number(duration3)) ? void 0 : Number(duration3),
161486
+ eprel_registration_number: parseEprelRegistrationNumber(metadata["compliance_data_eprel_registration_number"]),
161487
+ eprel_product_group: parseEprelProductGroup(metadata["compliance_data_eprel_product_group"]),
161456
161488
  is_organic: safeBoolConvert(metadata["compliance_data_organic_is_organic"]),
161457
161489
  organic_certification_type: safeStringConvert(metadata["compliance_data_organic_certification_type"])
161458
161490
  });
@@ -161560,6 +161592,7 @@ var init_product_recommendations_capability4 = __esm({
161560
161592
  identifier,
161561
161593
  name,
161562
161594
  slug,
161595
+ canAddToCartDirectly: (_body.variants?.length ?? 0) === 1,
161563
161596
  variants,
161564
161597
  complianceData: this.buildProductComplianceData(_body)
161565
161598
  };
@@ -163635,7 +163668,10 @@ var init_product_factory5 = __esm({
163635
163668
  ce_marking: shared.ce_marking,
163636
163669
  weee_symbol: shared.weee_symbol,
163637
163670
  energy_class: shared.energy_class,
163671
+ energy_class_range: shared.energy_class_range,
163638
163672
  garan_duration: shared.garan_duration,
163673
+ eprel_registration_number: shared.eprel_registration_number,
163674
+ eprel_product_group: shared.eprel_product_group,
163639
163675
  safety_warnings: safeStringConvert(body.metadata?.["compliance_data_safety_warnings"]),
163640
163676
  composition: safeStringConvert(body.metadata?.["compliance_data_composition"]),
163641
163677
  additional_disclosures: safeStringConvert(body.metadata?.["compliance_data_additional_disclosures"]),
@@ -163733,6 +163769,7 @@ var init_product_associations_factory5 = __esm({
163733
163769
  identifier,
163734
163770
  name,
163735
163771
  slug,
163772
+ canAddToCartDirectly: (data.product.variants?.length ?? 0) === 1,
163736
163773
  variants,
163737
163774
  complianceData: this.parseComplianceData(data.product)
163738
163775
  };
@@ -163810,6 +163847,7 @@ var init_product_search_factory6 = __esm({
163810
163847
  name,
163811
163848
  slug,
163812
163849
  complianceData,
163850
+ canAddToCartDirectly: (data.variants?.length ?? 0) === 1,
163813
163851
  variants
163814
163852
  };
163815
163853
  return result;
@@ -165678,12 +165716,14 @@ var init_product_search_capability7 = __esm({
165678
165716
  return data.complianceData ?? ProductSearchResultItemComplianceDataSchema.parse({});
165679
165717
  }
165680
165718
  parseSingle(body) {
165719
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
165681
165720
  const product = {
165682
165721
  identifier: { key: body.objectID },
165683
165722
  name: body.name || body.objectID,
165684
165723
  slug: body.slug || body.objectID,
165685
165724
  complianceData: this.parseComplianceData(body),
165686
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body))
165725
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
165726
+ variants
165687
165727
  };
165688
165728
  return product;
165689
165729
  }
@@ -165853,11 +165893,13 @@ var init_product_recommendations_capability5 = __esm({
165853
165893
  }));
165854
165894
  }
165855
165895
  parseSearchResultItem(body) {
165896
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
165856
165897
  const product = {
165857
165898
  identifier: { key: body.objectID },
165858
165899
  name: body.name || body.objectID,
165859
165900
  slug: body.slug || body.objectID,
165860
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body)),
165901
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
165902
+ variants,
165861
165903
  complianceData: this.parseComplianceData(body)
165862
165904
  };
165863
165905
  return product;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/feeds",
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",
@@ -12,14 +12,14 @@
12
12
  "url": "git+https://github.com/Solteq/reactionary.git"
13
13
  },
14
14
  "dependencies": {
15
- "@reactionary/algolia": "0.10.55",
16
- "@reactionary/commercetools": "0.10.55",
17
- "@reactionary/core": "0.10.55",
18
- "@reactionary/fake": "0.10.55",
19
- "@reactionary/magento": "0.10.55",
20
- "@reactionary/medusa": "0.10.55",
21
- "@reactionary/meilisearch": "0.10.55",
22
- "@reactionary/unomi": "0.10.55",
15
+ "@reactionary/algolia": "0.10.57",
16
+ "@reactionary/commercetools": "0.10.57",
17
+ "@reactionary/core": "0.10.57",
18
+ "@reactionary/fake": "0.10.57",
19
+ "@reactionary/magento": "0.10.57",
20
+ "@reactionary/medusa": "0.10.57",
21
+ "@reactionary/meilisearch": "0.10.57",
22
+ "@reactionary/unomi": "0.10.57",
23
23
  "commander": "^15.0.0",
24
24
  "dotenv": "^17.2.2",
25
25
  "sitemap": "^9.0.1",