@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.cjs.development.js +4 -12
- 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 +4 -12
- package/dist/api.esm.js.map +1 -1
- package/dist/platforms/vtex/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/index.ts +1 -2
- package/src/platforms/vtex/resolvers/searchResult.ts +8 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"@envelop/core": "^1 || ^2",
|
|
54
54
|
"graphql": "^15.6.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "121360b0bdbc8eac7c71d660e3e6b3604bda7703"
|
|
57
57
|
}
|
|
@@ -42,7 +42,7 @@ interface FeatureFlags {
|
|
|
42
42
|
enableOrderFormSync?: boolean
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export interface Context
|
|
45
|
+
export interface Context {
|
|
46
46
|
clients: Clients
|
|
47
47
|
loaders: Loaders
|
|
48
48
|
/**
|
|
@@ -99,7 +99,6 @@ export const getContextFactory =
|
|
|
99
99
|
}
|
|
100
100
|
ctx.clients = getClients(options, ctx)
|
|
101
101
|
ctx.loaders = getLoaders(options, ctx)
|
|
102
|
-
ctx.hideUnavailableItems = options.hideUnavailableItems
|
|
103
102
|
|
|
104
103
|
return ctx
|
|
105
104
|
}
|
|
@@ -54,12 +54,14 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
|
|
|
54
54
|
products: skus,
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
products: async ({ productSearchPromise }, _
|
|
57
|
+
products: async ({ productSearchPromise }, _) => {
|
|
58
58
|
const productSearchResult = await productSearchPromise
|
|
59
59
|
|
|
60
60
|
const skus = productSearchResult.products
|
|
61
61
|
.map((product) => {
|
|
62
|
-
const
|
|
62
|
+
const maybeSku = product.items.find((item) =>
|
|
63
|
+
item.sellers.some((item) => inStock(item.commertialOffer))
|
|
64
|
+
)
|
|
63
65
|
|
|
64
66
|
return maybeSku && enhanceSku(maybeSku, product)
|
|
65
67
|
})
|
|
@@ -73,18 +75,10 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
|
|
|
73
75
|
endCursor: productSearchResult.recordsFiltered.toString(),
|
|
74
76
|
totalCount: productSearchResult.recordsFiltered,
|
|
75
77
|
},
|
|
76
|
-
edges: skus
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} else {
|
|
81
|
-
return true
|
|
82
|
-
}
|
|
83
|
-
}) // TODO: remove this filter when the IS returns correctly with hideUnavailableItems
|
|
84
|
-
.map((sku, index) => ({
|
|
85
|
-
node: sku,
|
|
86
|
-
cursor: index.toString(),
|
|
87
|
-
})),
|
|
78
|
+
edges: skus.map((sku, index) => ({
|
|
79
|
+
node: sku,
|
|
80
|
+
cursor: index.toString(),
|
|
81
|
+
})),
|
|
88
82
|
}
|
|
89
83
|
},
|
|
90
84
|
facets: async ({ searchArgs }, _, ctx) => {
|