@faststore/api 1.12.44 → 1.12.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/dist/api.esm.js CHANGED
@@ -18,7 +18,7 @@ import { trace, context, SpanKind } from '@opentelemetry/api';
18
18
  import { SeverityNumber } from '@opentelemetry/api-logs';
19
19
 
20
20
  var name = "@faststore/api";
21
- var version = "1.12.43";
21
+ var version = "1.12.44";
22
22
  var license = "MIT";
23
23
  var main = "dist/index.js";
24
24
  var typings = "dist/index.d.ts";
@@ -2166,10 +2166,10 @@ const StoreSearchResult = {
2166
2166
  },
2167
2167
  products: async ({
2168
2168
  productSearchPromise
2169
- }, _, ctx) => {
2169
+ }, _) => {
2170
2170
  const productSearchResult = await productSearchPromise;
2171
2171
  const skus = productSearchResult.products.map(product => {
2172
- const [maybeSku] = product.items;
2172
+ const maybeSku = product.items.find(item => item.sellers.some(item => inStock(item.commertialOffer)));
2173
2173
  return maybeSku && enhanceSku(maybeSku, product);
2174
2174
  }).filter(sku => !!sku);
2175
2175
  return {
@@ -2180,14 +2180,7 @@ const StoreSearchResult = {
2180
2180
  endCursor: productSearchResult.recordsFiltered.toString(),
2181
2181
  totalCount: productSearchResult.recordsFiltered
2182
2182
  },
2183
- edges: skus.filter(sku => {
2184
- if (ctx.hideUnavailableItems) {
2185
- return sku.sellers.some(item => inStock(item.commertialOffer));
2186
- } else {
2187
- return true;
2188
- }
2189
- }) // TODO: remove this filter when the IS returns correctly with hideUnavailableItems
2190
- .map((sku, index) => ({
2183
+ edges: skus.map((sku, index) => ({
2191
2184
  node: sku,
2192
2185
  cursor: index.toString()
2193
2186
  }))
@@ -2509,7 +2502,6 @@ const getContextFactory = options => ctx => {
2509
2502
  };
2510
2503
  ctx.clients = getClients(options, ctx);
2511
2504
  ctx.loaders = getLoaders(options, ctx);
2512
- ctx.hideUnavailableItems = options.hideUnavailableItems;
2513
2505
  return ctx;
2514
2506
  };
2515
2507
  const getResolvers = _ => Resolvers;