@faststore/core 2.2.0-alpha.6 → 2.2.0-alpha.8
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +10 -10
- package/@generated/graphql/index.ts +9 -9
- package/@generated/graphql/persisted.json +2 -2
- package/package.json +2 -2
- package/src/components/product/ProductGrid/ProductGrid.tsx +2 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +3 -2
- package/src/customizations/fragments/{ClientProducts.ts → ClientManyProducts.ts} +1 -1
- package/src/customizations/fragments/{ServerProductPage.ts → ServerProduct.ts} +1 -1
- package/src/pages/[slug]/p.tsx +6 -7
- package/src/sdk/overrides/PageProvider.tsx +9 -5
- package/src/sdk/product/useLocalizedVariables.ts +2 -2
- package/src/sdk/product/usePageProductsQuery.ts +8 -8
- package/src/sdk/product/useProductsPrefetch.ts +4 -4
- package/src/sdk/product/useProductsQuery.ts +7 -7
- package/.next/BUILD_ID +0 -1
- package/.next/build-manifest.json +0 -128
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1gneedd +0 -1
- package/.next/cache/next-server.js.nft.json +0 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/export-marker.json +0 -1
- package/.next/images-manifest.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -1
- package/.next/react-loadable-manifest.json +0 -47
- package/.next/required-server-files.json +0 -1
- package/.next/routes-manifest.json +0 -1
- package/.next/server/chunks/117.js +0 -430
- package/.next/server/chunks/177.js +0 -120
- package/.next/server/chunks/183.js +0 -95
- package/.next/server/chunks/184.js +0 -61
- package/.next/server/chunks/289.js +0 -240
- package/.next/server/chunks/312.js +0 -677
- package/.next/server/chunks/350.js +0 -200
- package/.next/server/chunks/37.js +0 -610
- package/.next/server/chunks/386.js +0 -200
- package/.next/server/chunks/387.js +0 -550
- package/.next/server/chunks/52.js +0 -4007
- package/.next/server/chunks/53.js +0 -61
- package/.next/server/chunks/574.js +0 -145
- package/.next/server/chunks/576.js +0 -95
- package/.next/server/chunks/585.js +0 -640
- package/.next/server/chunks/676.js +0 -32
- package/.next/server/chunks/692.js +0 -111
- package/.next/server/chunks/693.js +0 -58
- package/.next/server/chunks/732.js +0 -1845
- package/.next/server/chunks/74.js +0 -3963
- package/.next/server/chunks/779.js +0 -58
- package/.next/server/chunks/817.js +0 -4007
- package/.next/server/chunks/825.js +0 -4039
- package/.next/server/chunks/854.js +0 -72
- package/.next/server/chunks/859.js +0 -959
- package/.next/server/chunks/897.js +0 -1289
- package/.next/server/chunks/98.js +0 -163
- package/.next/server/chunks/988.js +0 -211
- package/.next/server/chunks/font-manifest.json +0 -1
- package/.next/server/font-manifest.json +0 -1
- package/.next/server/middleware-build-manifest.js +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/.next/server/pages/404.js +0 -386
- package/.next/server/pages/404.js.nft.json +0 -1
- package/.next/server/pages/500.js +0 -388
- package/.next/server/pages/500.js.nft.json +0 -1
- package/.next/server/pages/[...slug].js +0 -1076
- package/.next/server/pages/[...slug].js.nft.json +0 -1
- package/.next/server/pages/[slug]/p.js +0 -2271
- package/.next/server/pages/[slug]/p.js.nft.json +0 -1
- package/.next/server/pages/_app.js +0 -279
- package/.next/server/pages/_app.js.nft.json +0 -1
- package/.next/server/pages/_document.js +0 -358
- package/.next/server/pages/_document.js.nft.json +0 -1
- package/.next/server/pages/_error.js +0 -164
- package/.next/server/pages/_error.js.nft.json +0 -1
- package/.next/server/pages/account.js +0 -363
- package/.next/server/pages/account.js.nft.json +0 -1
- package/.next/server/pages/api/graphql.js +0 -450
- package/.next/server/pages/api/graphql.js.nft.json +0 -1
- package/.next/server/pages/api/health/live.js +0 -31
- package/.next/server/pages/api/health/live.js.nft.json +0 -1
- package/.next/server/pages/api/health/ready.js +0 -31
- package/.next/server/pages/api/health/ready.js.nft.json +0 -1
- package/.next/server/pages/api/preview.js +0 -130
- package/.next/server/pages/api/preview.js.nft.json +0 -1
- package/.next/server/pages/checkout.js +0 -363
- package/.next/server/pages/checkout.js.nft.json +0 -1
- package/.next/server/pages/en-US/404.html +0 -81
- package/.next/server/pages/en-US/404.json +0 -1
- package/.next/server/pages/en-US/500.html +0 -81
- package/.next/server/pages/en-US/500.json +0 -1
- package/.next/server/pages/en-US/account.html +0 -81
- package/.next/server/pages/en-US/account.json +0 -1
- package/.next/server/pages/en-US/checkout.html +0 -81
- package/.next/server/pages/en-US/checkout.json +0 -1
- package/.next/server/pages/en-US/login.html +0 -81
- package/.next/server/pages/en-US/login.json +0 -1
- package/.next/server/pages/en-US/s.html +0 -81
- package/.next/server/pages/en-US/s.json +0 -1
- package/.next/server/pages/en-US.html +0 -90
- package/.next/server/pages/en-US.json +0 -1
- package/.next/server/pages/index.js +0 -432
- package/.next/server/pages/index.js.nft.json +0 -1
- package/.next/server/pages/login.js +0 -368
- package/.next/server/pages/login.js.nft.json +0 -1
- package/.next/server/pages/s.js +0 -548
- package/.next/server/pages/s.js.nft.json +0 -1
- package/.next/server/pages-manifest.json +0 -18
- package/.next/server/webpack-api-runtime.js +0 -229
- package/.next/server/webpack-runtime.js +0 -229
- package/.next/static/chunks/251.47f06fb688ea42d1.js +0 -1
- package/.next/static/chunks/383-f5039943ae2a4372.js +0 -1
- package/.next/static/chunks/386.d01e0db26c523f0f.js +0 -1
- package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
- package/.next/static/chunks/585.3350efefe61c9461.js +0 -1
- package/.next/static/chunks/635-666ee2cad2925bb7.js +0 -1
- package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
- package/.next/static/chunks/721-717d8a2486b7d30e.js +0 -1
- package/.next/static/chunks/722-686f01490d4d2176.js +0 -1
- package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
- package/.next/static/chunks/783-ded9d8cda0d5c8d9.js +0 -1
- package/.next/static/chunks/800.851af48fe2ab4a4c.js +0 -1
- package/.next/static/chunks/98.40c7e17d9de4eb8f.js +0 -1
- package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
- package/.next/static/chunks/main-fd466221927468fd.js +0 -1
- package/.next/static/chunks/pages/404-6c674028b2f80cbb.js +0 -1
- package/.next/static/chunks/pages/500-ff55de77265a7e43.js +0 -1
- package/.next/static/chunks/pages/[...slug]-7f8dc13cc9542463.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-1cec94f3f7583058.js +0 -1
- package/.next/static/chunks/pages/_app-7db7de3d205714be.js +0 -1
- package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
- package/.next/static/chunks/pages/account-b06035cba2c99604.js +0 -1
- package/.next/static/chunks/pages/checkout-f0c3e8d691cb8a54.js +0 -1
- package/.next/static/chunks/pages/index-a141c747fcc197a1.js +0 -1
- package/.next/static/chunks/pages/login-4e0e6cab7a07f1f3.js +0 -1
- package/.next/static/chunks/pages/s-823f8e1cabbf63b3.js +0 -1
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
- package/.next/static/chunks/webpack-bed5a9784a3af4e8.js +0 -1
- package/.next/static/css/1b48021b9c503e72.css +0 -1
- package/.next/static/css/527e334fa69cf40a.css +0 -1
- package/.next/static/css/6a7fdc5a21fbead5.css +0 -1
- package/.next/static/css/6e1a7434f061d0ef.css +0 -1
- package/.next/static/css/723835bce380750d.css +0 -1
- package/.next/static/css/8f93a4630936c20b.css +0 -1
- package/.next/static/css/9e76fef1c9ca89af.css +0 -1
- package/.next/static/css/a2eefb25a4608343.css +0 -1
- package/.next/static/css/cb7d1fcea42fab9c.css +0 -1
- package/.next/static/css/df588bb98c0b0ca6.css +0 -1
- package/.next/static/css/fd27ecc37832aa54.css +0 -1
- package/.next/static/h5IF1CNB8dJwLG9OAuMOX/_buildManifest.js +0 -1
- package/.next/static/h5IF1CNB8dJwLG9OAuMOX/_ssgManifest.js +0 -1
- package/.next/trace +0 -77
- package/public/~partytown/debug/partytown-atomics.js +0 -556
- package/public/~partytown/debug/partytown-media.js +0 -374
- package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
- package/public/~partytown/debug/partytown-sw.js +0 -59
- package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
- package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
- package/public/~partytown/debug/partytown.js +0 -72
- package/public/~partytown/partytown-atomics.js +0 -2
- package/public/~partytown/partytown-media.js +0 -2
- package/public/~partytown/partytown-sw.js +0 -2
- package/public/~partytown/partytown.js +0 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
$ yarn partytown & yarn generate && next build
|
|
2
2
|
$ partytown copylib ./public/~partytown
|
|
3
|
-
$ faststore generate-graphql -c
|
|
4
3
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
4
|
+
$ faststore generate-graphql -c
|
|
5
5
|
success - GraphQL schema, types, and optimizations successfully generated 🎉
|
|
6
6
|
warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
|
|
7
7
|
Attention: Next.js now collects completely anonymous telemetry regarding usage.
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
$ tsdx test
|
|
2
2
|
ts-jest[versions] (WARN) Version 29.1.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
3
3
|
ts-jest[versions] (WARN) Version 4.9.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.4.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
4
|
-
PASS test/server/index.test.ts (
|
|
4
|
+
PASS test/server/index.test.ts (8.171s)
|
|
5
5
|
FastStore GraphQL Layer
|
|
6
6
|
@faststore/api
|
|
7
|
-
✓ should return a valid GraphQL schema (
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
9
|
-
✓ should return a valid GraphQL schema contain all expected queries (
|
|
10
|
-
✓ should return a valid GraphQL schema contain all expected mutations
|
|
7
|
+
✓ should return a valid GraphQL schema (7ms)
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected types (10ms)
|
|
9
|
+
✓ should return a valid GraphQL schema contain all expected queries (2ms)
|
|
10
|
+
✓ should return a valid GraphQL schema contain all expected mutations
|
|
11
11
|
VTEX API Extension
|
|
12
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
12
|
+
✓ getTypeDefsFromFolder function should return an Array (8ms)
|
|
13
13
|
Third Party API Extension
|
|
14
14
|
✓ getTypeDefsFromFolder function should return an Array (5ms)
|
|
15
15
|
Final Schema after merging
|
|
16
|
-
✓ should return a valid merged GraphQL schema (
|
|
16
|
+
✓ should return a valid merged GraphQL schema (32ms)
|
|
17
17
|
Envelop
|
|
18
|
-
✓ should exist with its plugins (
|
|
19
|
-
✓ should handle options and execute (
|
|
18
|
+
✓ should exist with its plugins (33ms)
|
|
19
|
+
✓ should handle options and execute (269ms)
|
|
20
20
|
|
|
21
21
|
Test Suites: 1 passed, 1 total
|
|
22
22
|
Tests: 9 passed, 9 total
|
|
23
23
|
Snapshots: 0 total
|
|
24
|
-
Time:
|
|
24
|
+
Time: 8.848s
|
|
25
25
|
Ran all test suites.
|
|
@@ -1150,19 +1150,19 @@ export type ProductDetailsFragment_ProductFragment = {
|
|
|
1150
1150
|
}>
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
export type
|
|
1154
|
-
|
|
1155
|
-
export type ClientProductGalleryFragment = {
|
|
1153
|
+
export type ClientManyProductsFragment = {
|
|
1156
1154
|
search: { products: { pageInfo: { totalCount: number } } }
|
|
1157
1155
|
}
|
|
1158
1156
|
|
|
1159
|
-
export type
|
|
1157
|
+
export type ClientProductFragment = { product: { id: string } }
|
|
1158
|
+
|
|
1159
|
+
export type ClientProductGalleryFragment = {
|
|
1160
1160
|
search: { products: { pageInfo: { totalCount: number } } }
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
1163
|
export type ServerCollectionPageFragment = { collection: { id: string } }
|
|
1164
1164
|
|
|
1165
|
-
export type
|
|
1165
|
+
export type ServerProductFragment = { product: { id: string } }
|
|
1166
1166
|
|
|
1167
1167
|
export type ServerCollectionPageQueryQueryVariables = Exact<{
|
|
1168
1168
|
slug: Scalars['String']
|
|
@@ -1179,11 +1179,11 @@ export type ServerCollectionPageQueryQuery = {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
|
-
export type
|
|
1182
|
+
export type ServerProductQueryQueryVariables = Exact<{
|
|
1183
1183
|
locator: Array<IStoreSelectedFacet> | IStoreSelectedFacet
|
|
1184
1184
|
}>
|
|
1185
1185
|
|
|
1186
|
-
export type
|
|
1186
|
+
export type ServerProductQueryQuery = {
|
|
1187
1187
|
product: {
|
|
1188
1188
|
sku: string
|
|
1189
1189
|
gtin: string
|
|
@@ -1333,7 +1333,7 @@ export type SubscribeToNewsletterMutation = {
|
|
|
1333
1333
|
subscribeToNewsletter: { id: string } | null
|
|
1334
1334
|
}
|
|
1335
1335
|
|
|
1336
|
-
export type
|
|
1336
|
+
export type ClientManyProductsQueryQueryVariables = Exact<{
|
|
1337
1337
|
first: Scalars['Int']
|
|
1338
1338
|
after: InputMaybe<Scalars['String']>
|
|
1339
1339
|
sort: StoreSort
|
|
@@ -1341,7 +1341,7 @@ export type ClientProductsQueryQueryVariables = Exact<{
|
|
|
1341
1341
|
selectedFacets: Array<IStoreSelectedFacet> | IStoreSelectedFacet
|
|
1342
1342
|
}>
|
|
1343
1343
|
|
|
1344
|
-
export type
|
|
1344
|
+
export type ClientManyProductsQueryQuery = {
|
|
1345
1345
|
search: {
|
|
1346
1346
|
products: {
|
|
1347
1347
|
pageInfo: { totalCount: number }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"ServerCollectionPageQuery": "query ServerCollectionPageQuery($slug: String!) {\n collection(slug: $slug) {\n id\n seo {\n title\n description\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n meta {\n selectedFacets {\n key\n value\n }\n }\n }\n}\n",
|
|
3
|
-
"
|
|
3
|
+
"ServerProductQuery": "query ServerProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n seo {\n title\n description\n canonical\n }\n brand {\n name\n }\n sku\n gtin\n name\n description\n releaseDate\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n highPrice\n priceCurrency\n offers {\n availability\n price\n priceValidUntil\n priceCurrency\n itemCondition\n seller {\n identifier\n }\n listPrice\n }\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
|
|
4
4
|
"ValidateCartMutation": "mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n sku\n name\n image {\n url\n alternateName\n }\n brand {\n name\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n gtin\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n }\n }\n messages {\n text\n status\n }\n }\n}\n",
|
|
5
5
|
"SubscribeToNewsletter": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n}\n",
|
|
6
|
-
"
|
|
6
|
+
"ClientManyProductsQuery": "query ClientManyProductsQuery($first: Int!, $after: String, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n edges {\n node {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n }\n}\n",
|
|
7
7
|
"ClientProductGalleryQuery": "query ClientProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n }\n facets {\n ... on StoreFacetRange {\n key\n label\n min {\n selected\n absolute\n }\n max {\n selected\n absolute\n }\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n __typename\n }\n }\n metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n",
|
|
8
8
|
"ClientProductQuery": "query ClientProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n sku\n name\n gtin\n description\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n image {\n url\n alternateName\n }\n brand {\n name\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
|
|
9
9
|
"SearchSuggestionsQuery": "query SearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n products {\n pageInfo {\n totalCount\n }\n }\n metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"browserslist": "supports es6-module and not dead",
|
|
6
6
|
"exports": {
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"msw": {
|
|
130
130
|
"workerDirectory": "public"
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "a1d5951123d0b6018c7d6e07e610e35ea8cdd7a1"
|
|
133
133
|
}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ProductGrid as UIProductGrid,
|
|
3
3
|
ProductGridItem as UIProductGridItem,
|
|
4
4
|
} from '@faststore/ui'
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClientManyProductsQueryQuery } from '@generated/graphql'
|
|
6
6
|
import ProductGridSkeleton from 'src/components/skeletons/ProductGridSkeleton'
|
|
7
7
|
|
|
8
8
|
import { ProductCardProps } from '../ProductCard'
|
|
@@ -14,7 +14,7 @@ interface Props {
|
|
|
14
14
|
/**
|
|
15
15
|
* Products listed on the grid.
|
|
16
16
|
*/
|
|
17
|
-
products:
|
|
17
|
+
products: ClientManyProductsQueryQuery['search']['products']['edges']
|
|
18
18
|
page: number
|
|
19
19
|
/**
|
|
20
20
|
* Quantity of products listed.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react'
|
|
2
2
|
import { useInView } from 'react-intersection-observer'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
5
5
|
import ProductCard from 'src/components/product/ProductCard'
|
|
6
6
|
import ProductTilesSkeleton from 'src/components/skeletons/ProductTilesSkeleton'
|
|
7
7
|
import Tiles, { Tile } from 'src/components/ui/Tiles'
|
|
@@ -12,7 +12,8 @@ import Section from '../Section'
|
|
|
12
12
|
|
|
13
13
|
import styles from './section.module.scss'
|
|
14
14
|
|
|
15
|
-
interface ProductTilesProps
|
|
15
|
+
interface ProductTilesProps
|
|
16
|
+
extends Partial<ClientManyProductsQueryQueryVariables> {
|
|
16
17
|
title: string
|
|
17
18
|
}
|
|
18
19
|
|
package/src/pages/[slug]/p.tsx
CHANGED
|
@@ -7,9 +7,8 @@ import type { ComponentType } from 'react'
|
|
|
7
7
|
import deepmerge from 'deepmerge'
|
|
8
8
|
|
|
9
9
|
import type {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ServerProductPageQueryQueryVariables,
|
|
10
|
+
ServerProductQueryQuery,
|
|
11
|
+
ServerProductQueryQueryVariables,
|
|
13
12
|
} from '@generated/graphql'
|
|
14
13
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
15
14
|
import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNewsletter'
|
|
@@ -44,7 +43,7 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
type Props = PDPContentType & {
|
|
47
|
-
data:
|
|
46
|
+
data: ServerProductQueryQuery
|
|
48
47
|
globalSections: GlobalSectionsData
|
|
49
48
|
meta: {
|
|
50
49
|
title: string
|
|
@@ -134,8 +133,8 @@ function Page({ data: server, sections, globalSections, offers, meta }: Props) {
|
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
const query = gql`
|
|
137
|
-
query
|
|
138
|
-
...
|
|
136
|
+
query ServerProductQuery($locator: [IStoreSelectedFacet!]!) {
|
|
137
|
+
...ServerProduct
|
|
139
138
|
product(locator: $locator) {
|
|
140
139
|
id: productID
|
|
141
140
|
|
|
@@ -200,7 +199,7 @@ export const getStaticProps: GetStaticProps<
|
|
|
200
199
|
> = async ({ params, previewData }) => {
|
|
201
200
|
const slug = params?.slug ?? ''
|
|
202
201
|
const [searchResult, cmsPage, globalSections] = await Promise.all([
|
|
203
|
-
execute<
|
|
202
|
+
execute<ServerProductQueryQueryVariables, ServerProductQueryQuery>({
|
|
204
203
|
variables: { locator: [{ key: 'slug', value: slug }] },
|
|
205
204
|
operationName: query,
|
|
206
205
|
}),
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientProductGalleryQueryQuery,
|
|
3
3
|
ClientProductQueryQuery,
|
|
4
|
-
|
|
4
|
+
ClientManyProductsQueryQuery,
|
|
5
5
|
ServerCollectionPageQueryQuery,
|
|
6
|
-
|
|
6
|
+
ServerProductQueryQuery,
|
|
7
7
|
} from '@generated/graphql'
|
|
8
8
|
import type { PropsWithChildren } from 'react'
|
|
9
9
|
import { createContext, useContext, useMemo } from 'react'
|
|
10
10
|
import { SearchPageContextType } from 'src/pages/s'
|
|
11
11
|
|
|
12
12
|
export interface PDPContext {
|
|
13
|
-
data?:
|
|
13
|
+
data?: ServerProductQueryQuery &
|
|
14
14
|
ClientProductQueryQuery['product'] & { isValidating?: boolean }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface PLPContext {
|
|
18
18
|
data?: ServerCollectionPageQueryQuery &
|
|
19
|
-
ClientProductGalleryQueryQuery & {
|
|
19
|
+
ClientProductGalleryQueryQuery & {
|
|
20
|
+
pages: ClientManyProductsQueryQuery[]
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface SearchPageContext {
|
|
23
25
|
data?: SearchPageContextType &
|
|
24
|
-
ClientProductGalleryQueryQuery & {
|
|
26
|
+
ClientProductGalleryQueryQuery & {
|
|
27
|
+
pages: ClientManyProductsQueryQuery[]
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export const isPDP = (x: any): x is PDPContext =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
3
3
|
import { useSession } from '../session'
|
|
4
4
|
import { ITEMS_PER_SECTION } from 'src/constants'
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export const useLocalizedVariables = ({
|
|
|
12
12
|
sort,
|
|
13
13
|
term,
|
|
14
14
|
selectedFacets,
|
|
15
|
-
}: Partial<
|
|
15
|
+
}: Partial<ClientManyProductsQueryQueryVariables>) => {
|
|
16
16
|
const { channel, locale } = useSession()
|
|
17
17
|
|
|
18
18
|
return useMemo(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { gql } from '@faststore/graphql-utils'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
ClientManyProductsQueryQuery,
|
|
5
|
+
ClientManyProductsQueryQueryVariables,
|
|
6
6
|
} from '@generated/graphql'
|
|
7
7
|
import {
|
|
8
8
|
useEffect,
|
|
@@ -31,14 +31,14 @@ export const useGalleryPage = (page: number) => {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const query = gql`
|
|
34
|
-
query
|
|
34
|
+
query ClientManyProductsQuery(
|
|
35
35
|
$first: Int!
|
|
36
36
|
$after: String
|
|
37
37
|
$sort: StoreSort!
|
|
38
38
|
$term: String!
|
|
39
39
|
$selectedFacets: [IStoreSelectedFacet!]!
|
|
40
40
|
) {
|
|
41
|
-
...
|
|
41
|
+
...ClientManyProducts
|
|
42
42
|
search(
|
|
43
43
|
first: $first
|
|
44
44
|
after: $after
|
|
@@ -66,9 +66,9 @@ const getKey = (object: any) => JSON.stringify(object)
|
|
|
66
66
|
* Use this hook for managed pages state and creating useGalleryPage hook that will be used for fetching a list of products per pages in PLP or Search
|
|
67
67
|
*/
|
|
68
68
|
export const useCreateUseGalleryPage = () => {
|
|
69
|
-
const [pages, setPages] = useState<
|
|
69
|
+
const [pages, setPages] = useState<ClientManyProductsQueryQuery[]>([])
|
|
70
70
|
// We create pagesRef as a mirror of the pages state so we don't have to add pages as a dependency of the useGalleryPage hook
|
|
71
|
-
const pagesRef = useRef<
|
|
71
|
+
const pagesRef = useRef<ClientManyProductsQueryQuery[]>([])
|
|
72
72
|
const pagesCache = useRef<string[]>([])
|
|
73
73
|
|
|
74
74
|
const useGalleryPage = useCallback(function useGalleryPage(page: number) {
|
|
@@ -89,8 +89,8 @@ export const useCreateUseGalleryPage = () => {
|
|
|
89
89
|
pagesCache.current[page] === getKey(localizedVariables)
|
|
90
90
|
|
|
91
91
|
const { data } = useQuery<
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
ClientManyProductsQueryQuery,
|
|
93
|
+
ClientManyProductsQueryQueryVariables
|
|
94
94
|
>(query, localizedVariables, {
|
|
95
95
|
fallbackData: null,
|
|
96
96
|
suspense: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gql } from '@faststore/graphql-utils'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
|
-
import {
|
|
3
|
+
import { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
4
4
|
import { useEffect, useCallback } from 'react'
|
|
5
5
|
import type { QueryOptions } from '../graphql/useQuery'
|
|
6
6
|
import { useSWRConfig } from 'swr'
|
|
@@ -8,14 +8,14 @@ import { prefetchQuery } from '../graphql/prefetchQuery'
|
|
|
8
8
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
9
9
|
|
|
10
10
|
export const query = gql`
|
|
11
|
-
query
|
|
11
|
+
query ClientManyProductsQuery(
|
|
12
12
|
$first: Int!
|
|
13
13
|
$after: String
|
|
14
14
|
$sort: StoreSort!
|
|
15
15
|
$term: String!
|
|
16
16
|
$selectedFacets: [IStoreSelectedFacet!]!
|
|
17
17
|
) {
|
|
18
|
-
...
|
|
18
|
+
...ClientManyProducts
|
|
19
19
|
search(
|
|
20
20
|
first: $first
|
|
21
21
|
after: $after
|
|
@@ -38,7 +38,7 @@ export const query = gql`
|
|
|
38
38
|
`
|
|
39
39
|
|
|
40
40
|
export const useProductsQueryPrefetch = (
|
|
41
|
-
variables:
|
|
41
|
+
variables: ClientManyProductsQueryQueryVariables,
|
|
42
42
|
options?: QueryOptions
|
|
43
43
|
) => {
|
|
44
44
|
const localizedVariables = useLocalizedVariables(variables)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { gql } from '@faststore/graphql-utils'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
ClientManyProductsQueryQuery,
|
|
5
|
+
ClientManyProductsQueryQueryVariables,
|
|
6
6
|
} from '@generated/graphql'
|
|
7
7
|
|
|
8
8
|
import type { QueryOptions } from '../graphql/useQuery'
|
|
@@ -10,14 +10,14 @@ import { useQuery } from '../graphql/useQuery'
|
|
|
10
10
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
11
11
|
|
|
12
12
|
export const query = gql`
|
|
13
|
-
query
|
|
13
|
+
query ClientManyProductsQuery(
|
|
14
14
|
$first: Int!
|
|
15
15
|
$after: String
|
|
16
16
|
$sort: StoreSort!
|
|
17
17
|
$term: String!
|
|
18
18
|
$selectedFacets: [IStoreSelectedFacet!]!
|
|
19
19
|
) {
|
|
20
|
-
...
|
|
20
|
+
...ClientManyProducts
|
|
21
21
|
search(
|
|
22
22
|
first: $first
|
|
23
23
|
after: $after
|
|
@@ -43,14 +43,14 @@ export const query = gql`
|
|
|
43
43
|
* Use this hook for fetching a list of products, like shelves and tiles
|
|
44
44
|
*/
|
|
45
45
|
export const useProductsQuery = (
|
|
46
|
-
variables: Partial<
|
|
46
|
+
variables: Partial<ClientManyProductsQueryQueryVariables>,
|
|
47
47
|
options?: QueryOptions
|
|
48
48
|
) => {
|
|
49
49
|
const localizedVariables = useLocalizedVariables(variables)
|
|
50
50
|
|
|
51
51
|
const { data } = useQuery<
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
ClientManyProductsQueryQuery,
|
|
53
|
+
ClientManyProductsQueryQueryVariables
|
|
54
54
|
>(query, localizedVariables, {
|
|
55
55
|
fallbackData: null,
|
|
56
56
|
suspense: true,
|
package/.next/BUILD_ID
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
h5IF1CNB8dJwLG9OAuMOX
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"polyfillFiles": [
|
|
3
|
-
"static/chunks/polyfills-c67a75d1b6f99dc8.js"
|
|
4
|
-
],
|
|
5
|
-
"devFiles": [],
|
|
6
|
-
"ampDevFiles": [],
|
|
7
|
-
"lowPriorityFiles": [
|
|
8
|
-
"static/h5IF1CNB8dJwLG9OAuMOX/_buildManifest.js",
|
|
9
|
-
"static/h5IF1CNB8dJwLG9OAuMOX/_ssgManifest.js"
|
|
10
|
-
],
|
|
11
|
-
"rootMainFiles": [],
|
|
12
|
-
"pages": {
|
|
13
|
-
"/": [
|
|
14
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
15
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
16
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
17
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
18
|
-
"static/css/8f93a4630936c20b.css",
|
|
19
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
20
|
-
"static/css/fd27ecc37832aa54.css",
|
|
21
|
-
"static/chunks/721-717d8a2486b7d30e.js",
|
|
22
|
-
"static/css/a2eefb25a4608343.css",
|
|
23
|
-
"static/chunks/pages/index-a141c747fcc197a1.js"
|
|
24
|
-
],
|
|
25
|
-
"/404": [
|
|
26
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
27
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
28
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
29
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
30
|
-
"static/css/8f93a4630936c20b.css",
|
|
31
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
32
|
-
"static/css/df588bb98c0b0ca6.css",
|
|
33
|
-
"static/chunks/pages/404-6c674028b2f80cbb.js"
|
|
34
|
-
],
|
|
35
|
-
"/500": [
|
|
36
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
37
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
38
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
39
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
40
|
-
"static/css/8f93a4630936c20b.css",
|
|
41
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
42
|
-
"static/css/df588bb98c0b0ca6.css",
|
|
43
|
-
"static/chunks/pages/500-ff55de77265a7e43.js"
|
|
44
|
-
],
|
|
45
|
-
"/[...slug]": [
|
|
46
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
47
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
48
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
49
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
50
|
-
"static/chunks/635-666ee2cad2925bb7.js",
|
|
51
|
-
"static/css/8f93a4630936c20b.css",
|
|
52
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
53
|
-
"static/css/fd27ecc37832aa54.css",
|
|
54
|
-
"static/chunks/721-717d8a2486b7d30e.js",
|
|
55
|
-
"static/css/723835bce380750d.css",
|
|
56
|
-
"static/chunks/722-686f01490d4d2176.js",
|
|
57
|
-
"static/css/a2eefb25a4608343.css",
|
|
58
|
-
"static/css/527e334fa69cf40a.css",
|
|
59
|
-
"static/chunks/pages/[...slug]-7f8dc13cc9542463.js"
|
|
60
|
-
],
|
|
61
|
-
"/[slug]/p": [
|
|
62
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
63
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
64
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
65
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
66
|
-
"static/chunks/635-666ee2cad2925bb7.js",
|
|
67
|
-
"static/css/8f93a4630936c20b.css",
|
|
68
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
69
|
-
"static/css/fd27ecc37832aa54.css",
|
|
70
|
-
"static/chunks/721-717d8a2486b7d30e.js",
|
|
71
|
-
"static/css/1b48021b9c503e72.css",
|
|
72
|
-
"static/chunks/pages/[slug]/p-1cec94f3f7583058.js"
|
|
73
|
-
],
|
|
74
|
-
"/_app": [
|
|
75
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
76
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
77
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
78
|
-
"static/css/9e76fef1c9ca89af.css",
|
|
79
|
-
"static/chunks/pages/_app-7db7de3d205714be.js"
|
|
80
|
-
],
|
|
81
|
-
"/_error": [
|
|
82
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
83
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
84
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
85
|
-
"static/chunks/pages/_error-a7a0c1d9bfbb4f38.js"
|
|
86
|
-
],
|
|
87
|
-
"/account": [
|
|
88
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
89
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
90
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
91
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
92
|
-
"static/css/8f93a4630936c20b.css",
|
|
93
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
94
|
-
"static/chunks/pages/account-b06035cba2c99604.js"
|
|
95
|
-
],
|
|
96
|
-
"/checkout": [
|
|
97
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
98
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
99
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
100
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
101
|
-
"static/css/8f93a4630936c20b.css",
|
|
102
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
103
|
-
"static/chunks/pages/checkout-f0c3e8d691cb8a54.js"
|
|
104
|
-
],
|
|
105
|
-
"/login": [
|
|
106
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
107
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
108
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
109
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
110
|
-
"static/css/8f93a4630936c20b.css",
|
|
111
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
112
|
-
"static/css/df588bb98c0b0ca6.css",
|
|
113
|
-
"static/chunks/pages/login-4e0e6cab7a07f1f3.js"
|
|
114
|
-
],
|
|
115
|
-
"/s": [
|
|
116
|
-
"static/chunks/webpack-bed5a9784a3af4e8.js",
|
|
117
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
118
|
-
"static/chunks/main-fd466221927468fd.js",
|
|
119
|
-
"static/chunks/783-ded9d8cda0d5c8d9.js",
|
|
120
|
-
"static/css/8f93a4630936c20b.css",
|
|
121
|
-
"static/chunks/383-f5039943ae2a4372.js",
|
|
122
|
-
"static/css/723835bce380750d.css",
|
|
123
|
-
"static/chunks/722-686f01490d4d2176.js",
|
|
124
|
-
"static/chunks/pages/s-823f8e1cabbf63b3.js"
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
"ampFirstPages": []
|
|
128
|
-
}
|