@reactionary/feeds 0.10.56 → 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 +25 -7
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -37333,6 +37333,7 @@ var init_product_search_model = __esm({
37333
37333
  name: string2(),
37334
37334
  slug: string2(),
37335
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." }),
37336
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." })
37337
37338
  });
37338
37339
  ProductSearchResultFacetValueSchema = looseObject({
@@ -71636,11 +71637,13 @@ var init_product_recommendations_capability2 = __esm({
71636
71637
  };
71637
71638
  }
71638
71639
  parseSearchResultItem(body) {
71640
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
71639
71641
  const product = {
71640
71642
  identifier: { key: body.objectID },
71641
71643
  name: body.name || body.objectID,
71642
71644
  slug: body.slug || body.objectID,
71643
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body)),
71645
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
71646
+ variants,
71644
71647
  complianceData: this.parseComplianceData(body)
71645
71648
  };
71646
71649
  return product;
@@ -71729,14 +71732,16 @@ var init_product_search_factory2 = __esm({
71729
71732
  return data.complianceData ?? ProductSearchResultItemComplianceDataSchema.parse({});
71730
71733
  }
71731
71734
  parseSingle(body) {
71735
+ const variants = [...body.variants || []].map(
71736
+ (variant) => this.parseVariant(variant, body)
71737
+ );
71732
71738
  return {
71733
71739
  identifier: { key: body.objectID },
71734
71740
  name: body.name || body.objectID,
71735
71741
  slug: body.slug || body.objectID,
71736
71742
  complianceData: this.parseComplianceData(body),
71737
- variants: [...body.variants || []].map(
71738
- (variant) => this.parseVariant(variant, body)
71739
- )
71743
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
71744
+ variants
71740
71745
  };
71741
71746
  }
71742
71747
  parseVariant(variant, product) {
@@ -71926,7 +71931,7 @@ var init_configuration_schema = __esm({
71926
71931
  apiKey: string2(),
71927
71932
  indexName: string2(),
71928
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." }),
71929
- 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 })
71930
71935
  });
71931
71936
  }
71932
71937
  });
@@ -113852,6 +113857,7 @@ var init_product_associations_factory2 = __esm({
113852
113857
  identifier: { key: data.id },
113853
113858
  name: data.name[localeStr] || data.id,
113854
113859
  slug: data.slug?.[localeStr] || data.id,
113860
+ canAddToCartDirectly: variants.length === 1,
113855
113861
  variants,
113856
113862
  complianceData: this.buildProductComplianceData(data)
113857
113863
  };
@@ -114243,6 +114249,7 @@ var init_product_search_factory3 = __esm({
114243
114249
  name,
114244
114250
  slug,
114245
114251
  complianceData: this.parseComplianceData(data),
114252
+ canAddToCartDirectly: variants.length === 1,
114246
114253
  variants
114247
114254
  };
114248
114255
  return result;
@@ -121533,6 +121540,7 @@ var init_product_search_capability4 = __esm({
121533
121540
  },
121534
121541
  name: productGenerator.commerce.productName(),
121535
121542
  slug: productGenerator.lorem.slug(),
121543
+ canAddToCartDirectly: true,
121536
121544
  variants: [
121537
121545
  {
121538
121546
  variant: {
@@ -122989,6 +122997,7 @@ var init_product_associations_capability3 = __esm({
122989
122997
  identifier: { key },
122990
122998
  name: `Fake ${type} ${i3 + 1} for ${baseProductKey}`,
122991
122999
  slug: key,
123000
+ canAddToCartDirectly: true,
122992
123001
  variants: [{
122993
123002
  variant: { sku: `${key}-variant` },
122994
123003
  image: {
@@ -126450,6 +126459,7 @@ function buildProductSearchResultItem(config3, product) {
126450
126459
  identifier: { key: getProductKey(product) },
126451
126460
  name: product.name || product.sku,
126452
126461
  slug: getCustomAttribute(product, "url_key") ?? getCustomAttribute(product, "url_path") ?? "",
126462
+ canAddToCartDirectly: variants.length === 1,
126453
126463
  variants,
126454
126464
  complianceData: buildProductComplianceData(product)
126455
126465
  };
@@ -127891,6 +127901,7 @@ var init_product_search_factory5 = __esm({
127891
127901
  identifier,
127892
127902
  name,
127893
127903
  slug,
127904
+ canAddToCartDirectly: variants.length === 1,
127894
127905
  variants,
127895
127906
  complianceData: this.parseComplianceData(product)
127896
127907
  };
@@ -161581,6 +161592,7 @@ var init_product_recommendations_capability4 = __esm({
161581
161592
  identifier,
161582
161593
  name,
161583
161594
  slug,
161595
+ canAddToCartDirectly: (_body.variants?.length ?? 0) === 1,
161584
161596
  variants,
161585
161597
  complianceData: this.buildProductComplianceData(_body)
161586
161598
  };
@@ -163757,6 +163769,7 @@ var init_product_associations_factory5 = __esm({
163757
163769
  identifier,
163758
163770
  name,
163759
163771
  slug,
163772
+ canAddToCartDirectly: (data.product.variants?.length ?? 0) === 1,
163760
163773
  variants,
163761
163774
  complianceData: this.parseComplianceData(data.product)
163762
163775
  };
@@ -163834,6 +163847,7 @@ var init_product_search_factory6 = __esm({
163834
163847
  name,
163835
163848
  slug,
163836
163849
  complianceData,
163850
+ canAddToCartDirectly: (data.variants?.length ?? 0) === 1,
163837
163851
  variants
163838
163852
  };
163839
163853
  return result;
@@ -165702,12 +165716,14 @@ var init_product_search_capability7 = __esm({
165702
165716
  return data.complianceData ?? ProductSearchResultItemComplianceDataSchema.parse({});
165703
165717
  }
165704
165718
  parseSingle(body) {
165719
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
165705
165720
  const product = {
165706
165721
  identifier: { key: body.objectID },
165707
165722
  name: body.name || body.objectID,
165708
165723
  slug: body.slug || body.objectID,
165709
165724
  complianceData: this.parseComplianceData(body),
165710
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body))
165725
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
165726
+ variants
165711
165727
  };
165712
165728
  return product;
165713
165729
  }
@@ -165877,11 +165893,13 @@ var init_product_recommendations_capability5 = __esm({
165877
165893
  }));
165878
165894
  }
165879
165895
  parseSearchResultItem(body) {
165896
+ const variants = [...body.variants || []].map((variant) => this.parseVariant(variant, body));
165880
165897
  const product = {
165881
165898
  identifier: { key: body.objectID },
165882
165899
  name: body.name || body.objectID,
165883
165900
  slug: body.slug || body.objectID,
165884
- variants: [...body.variants || []].map((variant) => this.parseVariant(variant, body)),
165901
+ canAddToCartDirectly: body.canAddToCartDirectly ?? variants.length === 1,
165902
+ variants,
165885
165903
  complianceData: this.parseComplianceData(body)
165886
165904
  };
165887
165905
  return product;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/feeds",
3
- "version": "0.10.56",
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.56",
16
- "@reactionary/commercetools": "0.10.56",
17
- "@reactionary/core": "0.10.56",
18
- "@reactionary/fake": "0.10.56",
19
- "@reactionary/magento": "0.10.56",
20
- "@reactionary/medusa": "0.10.56",
21
- "@reactionary/meilisearch": "0.10.56",
22
- "@reactionary/unomi": "0.10.56",
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",