@faststore/api 1.8.51 → 1.9.4
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 +30 -0
- package/dist/api.cjs.development.js +6 -9
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +6 -9
- package/dist/api.esm.js.map +1 -1
- package/dist/platforms/vtex/clients/search/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/clients/search/index.ts +2 -2
- package/src/platforms/vtex/resolvers/aggregateOffer.ts +5 -4
- package/src/platforms/vtex/utils/productStock.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"graphql": "^15.6.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "830f839f0d3ca50c1d54c8c1efa8d8aecef3db92"
|
|
48
48
|
}
|
|
@@ -25,7 +25,7 @@ export interface SearchArgs {
|
|
|
25
25
|
type: 'product_search' | 'facets'
|
|
26
26
|
sort?: Sort
|
|
27
27
|
selectedFacets?: SelectedFacet[]
|
|
28
|
-
fuzzy?: '0' | '1'
|
|
28
|
+
fuzzy?: '0' | '1' | 'auto'
|
|
29
29
|
hideUnavailableItems?: boolean
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -97,7 +97,7 @@ export const IntelligentSearch = (
|
|
|
97
97
|
sort = '',
|
|
98
98
|
selectedFacets = [],
|
|
99
99
|
type,
|
|
100
|
-
fuzzy = '
|
|
100
|
+
fuzzy = 'auto',
|
|
101
101
|
}: SearchArgs): Promise<T> => {
|
|
102
102
|
const params = new URLSearchParams({
|
|
103
103
|
page: (page + 1).toString(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inStock } from '../utils/productStock'
|
|
1
|
+
import { inStock, price } from '../utils/productStock'
|
|
2
2
|
import type { StoreProduct } from './product'
|
|
3
3
|
import type { PromiseType } from '../../../typings'
|
|
4
4
|
import type { Resolver } from '..'
|
|
@@ -10,13 +10,14 @@ export const StoreAggregateOffer: Record<string, Resolver<Root>> & {
|
|
|
10
10
|
} = {
|
|
11
11
|
highPrice: (offers) => {
|
|
12
12
|
const availableOffers = offers.filter(inStock)
|
|
13
|
+
const highOffer = availableOffers[availableOffers.length - 1]
|
|
13
14
|
|
|
14
|
-
return
|
|
15
|
+
return highOffer != null ? price(highOffer) : 0
|
|
15
16
|
},
|
|
16
17
|
lowPrice: (offers) => {
|
|
17
|
-
const
|
|
18
|
+
const [lowOffer] = offers.filter(inStock)
|
|
18
19
|
|
|
19
|
-
return
|
|
20
|
+
return lowOffer ? price(lowOffer) : 0
|
|
20
21
|
},
|
|
21
22
|
offerCount: (offers) => offers.length,
|
|
22
23
|
priceCurrency: () => '',
|
|
@@ -10,7 +10,7 @@ export const sellingPrice = (offer: CommertialOffer) => offer.Price ?? 0
|
|
|
10
10
|
export const availability = (available: boolean) =>
|
|
11
11
|
available ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock'
|
|
12
12
|
|
|
13
|
-
// Smallest Available
|
|
13
|
+
// Smallest Available Spot Price First
|
|
14
14
|
export const bestOfferFirst = (
|
|
15
15
|
a: Pick<CommertialOffer, 'AvailableQuantity' | 'spotPrice'>,
|
|
16
16
|
b: Pick<CommertialOffer, 'AvailableQuantity' | 'spotPrice'>
|