@faststore/api 1.9.1 → 1.9.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.9.3](https://github.com/vtex/faststore/compare/v1.9.2...v1.9.3) (2022-06-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Spot pricing sort for lowPrice/highPrice ([#1350](https://github.com/vtex/faststore/issues/1350)) ([6836c6f](https://github.com/vtex/faststore/commit/6836c6f36a14e22eed3564e48a3eae63997b85b8))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 1.9.1 (2022-06-09)
7
18
 
8
19
  **Note:** Version bump only for package @faststore/api
@@ -457,7 +457,7 @@ const sellingPrice = offer => {
457
457
 
458
458
  return (_offer$Price = offer.Price) != null ? _offer$Price : 0;
459
459
  };
460
- const availability = available => available ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock'; // Smallest Available Selling Price First
460
+ const availability = available => available ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock'; // Smallest Available Spot Price First
461
461
 
462
462
  const bestOfferFirst = (a, b) => {
463
463
  if (inStock(a) && !inStock(b)) {
@@ -474,16 +474,13 @@ const inStockOrderFormItem = itemAvailability => itemAvailability === 'available
474
474
 
475
475
  const StoreAggregateOffer = {
476
476
  highPrice: offers => {
477
- var _availableOffers$Pric, _availableOffers;
478
-
479
477
  const availableOffers = offers.filter(inStock);
480
- return (_availableOffers$Pric = (_availableOffers = availableOffers[availableOffers.length - 1]) == null ? void 0 : _availableOffers.Price) != null ? _availableOffers$Pric : 0;
478
+ const highOffer = availableOffers[availableOffers.length - 1];
479
+ return highOffer != null ? price(highOffer) : 0;
481
480
  },
482
481
  lowPrice: offers => {
483
- var _availableOffers$0$Pr, _availableOffers$;
484
-
485
- const availableOffers = offers.filter(inStock);
486
- return (_availableOffers$0$Pr = (_availableOffers$ = availableOffers[0]) == null ? void 0 : _availableOffers$.Price) != null ? _availableOffers$0$Pr : 0;
482
+ const [lowOffer] = offers.filter(inStock);
483
+ return lowOffer ? price(lowOffer) : 0;
487
484
  },
488
485
  offerCount: offers => offers.length,
489
486
  priceCurrency: () => '',