@faststore/core 2.2.78 → 3.0.0
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/.babelrc.js +12 -0
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +89 -89
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -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/images-manifest.json +1 -1
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.js +1 -0
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +17 -17
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/119.js +1 -0
- package/.next/server/chunks/12.js +1 -0
- package/.next/server/chunks/187.js +1 -0
- package/.next/server/chunks/202.js +1 -0
- package/.next/server/chunks/24.js +1 -0
- package/.next/server/chunks/242.js +1 -0
- package/.next/server/chunks/247.js +1 -0
- package/.next/server/chunks/344.js +1 -0
- package/.next/server/chunks/404.js +1 -434
- package/.next/server/chunks/414.js +1 -0
- package/.next/server/chunks/484.js +1 -0
- package/.next/server/chunks/493.js +1 -0
- package/.next/server/chunks/498.js +1 -0
- package/.next/server/chunks/540.js +1 -0
- package/.next/server/chunks/57.js +1 -434
- package/.next/server/chunks/624.js +1 -0
- package/.next/server/chunks/640.js +6 -0
- package/.next/server/chunks/646.js +279 -0
- package/.next/server/chunks/659.js +9 -0
- package/.next/server/chunks/679.js +1 -0
- package/.next/server/chunks/693.js +1 -58
- package/.next/server/chunks/694.js +1 -0
- package/.next/server/chunks/779.js +1 -58
- package/.next/server/chunks/82.js +8 -0
- package/.next/server/chunks/857.js +1 -0
- package/.next/server/chunks/859.js +4 -957
- package/.next/server/chunks/881.js +1 -0
- package/.next/server/chunks/917.js +1 -0
- package/.next/server/chunks/936.js +1 -0
- package/.next/server/chunks/96.js +1 -0
- package/.next/server/chunks/997.js +1 -0
- package/.next/server/functions-config-manifest.json +1 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.js +1 -391
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js +1 -395
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1071
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +1 -2315
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js +1 -301
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +1 -363
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -164
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account.js +1 -370
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +1 -3085
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js +1 -31
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js +1 -31
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js +1 -137
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js +1 -370
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/404.json +1 -1
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/500.json +1 -1
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/login.json +1 -1
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +4 -4
- package/.next/server/pages/en-US.json +1 -1
- package/.next/server/pages/index.js +1 -439
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js +1 -382
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -554
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +1 -18
- package/.next/server/webpack-api-runtime.js +1 -229
- package/.next/server/webpack-runtime.js +1 -229
- package/.next/static/HohWS5v_0biRSlLJu0K2W/_buildManifest.js +1 -0
- package/.next/static/chunks/104-d42a7ff6c8b8dd89.js +1 -0
- package/.next/static/chunks/161-b39fe2f79ff7bc85.js +1 -0
- package/.next/static/chunks/202.c7d8a71173edecfb.js +1 -0
- package/.next/static/chunks/217.01bc0ad07edd6f1b.js +1 -0
- package/.next/static/chunks/247.52b3924429a474c6.js +1 -0
- package/.next/static/chunks/484.b82b73b1d8c37e02.js +1 -0
- package/.next/static/chunks/540.6c62d2536d42a1e0.js +1 -0
- package/.next/static/chunks/575-853fb8b1ba4ce8c4.js +14 -0
- package/.next/static/chunks/624.d3de62b4562a33f3.js +1 -0
- package/.next/static/chunks/629-b7b5ef6f15ecba9d.js +1 -0
- package/.next/static/chunks/65.da22595d53beae76.js +1 -0
- package/.next/static/chunks/758.b53ee01b506973e0.js +1 -0
- package/.next/static/chunks/857.d2299cfe995af21d.js +1 -0
- package/.next/static/chunks/framework-8e279965036b6169.js +33 -0
- package/.next/static/chunks/main-6f63f6746cc029db.js +1 -0
- package/.next/static/chunks/pages/404-1334d11ab8467b3d.js +1 -0
- package/.next/static/chunks/pages/500-449c5bd51f98423f.js +1 -0
- package/.next/static/chunks/pages/[...slug]-7c8ec664c28eca52.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-a4f7d7c00fdf4157.js +1 -0
- package/.next/static/chunks/pages/_app-6516d0c2c7e0e686.js +68 -0
- package/.next/static/chunks/pages/_error-fbf331a03642b495.js +1 -0
- package/.next/static/chunks/pages/account-dbc5c028225cd1ac.js +1 -0
- package/.next/static/chunks/pages/checkout-29ae2c37eaf172e1.js +1 -0
- package/.next/static/chunks/pages/index-00798cca3b47590d.js +1 -0
- package/.next/static/chunks/pages/login-c4d2c856008df5ac.js +1 -0
- package/.next/static/chunks/pages/s-dacaed02ad104d73.js +1 -0
- package/.next/static/chunks/webpack-1c08d77cfe1b8585.js +1 -0
- package/.next/static/css/{021de9c7b050d301.css → 0d45c82d8887a269.css} +1 -1
- package/.next/static/css/{e772e7786bb4dee9.css → 211c7542af66d8b4.css} +1 -1
- package/.next/static/css/{df588bb98c0b0ca6.css → 2980acad3f8e1028.css} +1 -1
- package/.next/static/css/{510895065f32ed2f.css → 4c4d90eb8cb1d2b7.css} +1 -1
- package/.next/static/css/{938781cdc945862e.css → 821a5219786be653.css} +1 -1
- package/.next/static/css/{def381bf7c69fa2e.css → 96e3fddf695d6aa9.css} +1 -1
- package/.next/static/css/{6a7fdc5a21fbead5.css → b9d9ba1b04f3160d.css} +1 -1
- package/.next/static/css/{9558da13053ac066.css → cff9aafa16fccc9c.css} +1 -1
- package/.next/static/css/{7e897ebb936fac09.css → d586715f4f707df4.css} +1 -1
- package/.next/static/css/{cb7d1fcea42fab9c.css → e32410b31c666cb2.css} +1 -1
- package/.next/trace +91 -82
- package/.turbo/turbo-build.log +37 -42
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-test.log +10 -10
- package/@generated/gql.ts +196 -0
- package/@generated/{graphql/index.ts → graphql.ts} +718 -252
- package/@generated/index.ts +1 -0
- package/@generated/persisted-documents.json +13 -0
- package/api/index.ts +1 -1
- package/cms/faststore/content-types.json +18 -0
- package/cms/faststore/sections.json +73 -0
- package/codegen.ts +61 -0
- package/index.ts +1 -0
- package/jest.config.js +9 -1
- package/next.config.js +2 -0
- package/package.json +14 -10
- package/src/components/product/ProductCard/ProductCard.tsx +4 -4
- package/src/components/search/Filter/Filter.tsx +4 -3
- package/src/components/sections/EmptyState/DefaultComponents.ts +5 -0
- package/src/components/sections/EmptyState/EmptyState.tsx +91 -8
- package/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts +15 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +6 -6
- package/src/components/ui/Image/Image.tsx +1 -1
- package/src/customizations/src/fragments/ClientManyProducts.ts +3 -3
- package/src/customizations/src/fragments/ClientProduct.ts +3 -3
- package/src/customizations/src/fragments/ClientProductGallery.ts +3 -3
- package/src/customizations/src/fragments/ClientSearchSuggestions.ts +3 -3
- package/src/customizations/src/fragments/ClientShippingSimulation.ts +3 -3
- package/src/customizations/src/fragments/ClientTopSearchSuggestions.ts +3 -3
- package/src/customizations/src/fragments/ServerCollectionPage.ts +3 -3
- package/src/customizations/src/fragments/ServerProduct.ts +3 -3
- package/src/pages/404.tsx +32 -30
- package/src/pages/500.tsx +32 -34
- package/src/pages/[...slug].tsx +4 -4
- package/src/pages/[slug]/p.tsx +7 -7
- package/src/pages/api/graphql.ts +10 -4
- package/src/pages/login.tsx +31 -8
- package/src/sdk/cart/index.ts +3 -3
- package/src/sdk/graphql/prefetchQuery.ts +4 -3
- package/src/sdk/graphql/request.ts +67 -8
- package/src/sdk/graphql/useLazyQuery.ts +4 -3
- package/src/sdk/graphql/useQuery.ts +7 -3
- package/src/sdk/newsletter/useNewsletter.ts +4 -4
- package/src/sdk/product/usePageProductsQuery.ts +3 -3
- package/src/sdk/product/useProductGalleryQuery.ts +10 -8
- package/src/sdk/product/useProductQuery.ts +3 -3
- package/src/sdk/product/useProductsPrefetch.ts +5 -3
- package/src/sdk/product/useProductsQuery.ts +3 -4
- package/src/sdk/search/useSuggestions.ts +3 -3
- package/src/sdk/search/useTopSearch.ts +3 -4
- package/src/sdk/session/index.ts +4 -4
- package/src/sdk/shipping/index.ts +3 -3
- package/src/server/generator/schema.ts +1 -1
- package/src/server/index.ts +11 -6
- package/src/typings/overrides.ts +3 -2
- package/test/server/index.test.ts +6 -1
- package/.babelrc +0 -4
- package/.next/cache/next-server.js.nft.json +0 -1
- package/.next/server/chunks/117.js +0 -427
- package/.next/server/chunks/177.js +0 -125
- package/.next/server/chunks/183.js +0 -122
- package/.next/server/chunks/184.js +0 -61
- package/.next/server/chunks/289.js +0 -243
- package/.next/server/chunks/312.js +0 -676
- package/.next/server/chunks/350.js +0 -2898
- package/.next/server/chunks/386.js +0 -200
- package/.next/server/chunks/574.js +0 -145
- package/.next/server/chunks/576.js +0 -122
- package/.next/server/chunks/585.js +0 -639
- package/.next/server/chunks/632.js +0 -514
- package/.next/server/chunks/661.js +0 -1451
- package/.next/server/chunks/676.js +0 -32
- package/.next/server/chunks/719.js +0 -84
- package/.next/server/chunks/74.js +0 -4152
- package/.next/server/chunks/825.js +0 -4074
- package/.next/server/chunks/854.js +0 -72
- package/.next/server/chunks/863.js +0 -111
- package/.next/server/chunks/898.js +0 -711
- package/.next/server/chunks/903.js +0 -1926
- package/.next/server/chunks/98.js +0 -163
- package/.next/server/chunks/988.js +0 -211
- package/.next/static/JJRI44e-3F3WVhD-DxmO2/_buildManifest.js +0 -1
- package/.next/static/chunks/223-cb77217cce52d45c.js +0 -1
- package/.next/static/chunks/251.11f5198fc8bef3a4.js +0 -1
- package/.next/static/chunks/386.d01e0db26c523f0f.js +0 -1
- package/.next/static/chunks/397-0d3aada1012cd78b.js +0 -1
- package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
- package/.next/static/chunks/585.6561778b7763b79e.js +0 -1
- package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
- package/.next/static/chunks/675-479a97aecebead97.js +0 -1
- package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
- package/.next/static/chunks/800.5d92de2974baf641.js +0 -1
- package/.next/static/chunks/881-57643fb90f59e576.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-e4e873ee741162eb.js +0 -1
- package/.next/static/chunks/pages/404-e106cb9a78182f5f.js +0 -1
- package/.next/static/chunks/pages/500-d28aa4a8ce88bddd.js +0 -1
- package/.next/static/chunks/pages/[...slug]-c4abcc133f85d9d0.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-4a75b11857b82b5c.js +0 -1
- package/.next/static/chunks/pages/_app-30b9666307e4b3b1.js +0 -1
- package/.next/static/chunks/pages/_error-319451dea77827a6.js +0 -1
- package/.next/static/chunks/pages/account-bf9c88a9cac80d8a.js +0 -1
- package/.next/static/chunks/pages/checkout-6ca76c1e88a28ac4.js +0 -1
- package/.next/static/chunks/pages/index-629ba146ae5f0ecf.js +0 -1
- package/.next/static/chunks/pages/login-d2af0de13ea75848.js +0 -1
- package/.next/static/chunks/pages/s-d729254b91430d1c.js +0 -1
- package/.next/static/chunks/webpack-54ce04ec11860b0b.js +0 -1
- package/@generated/graphql/persisted.json +0 -13
- package/codegen.yml +0 -23
- package/src/components/sections/EmptyState/Overrides.tsx +0 -14
- package/.next/static/{JJRI44e-3F3WVhD-DxmO2 → HohWS5v_0biRSlLJu0K2W}/_ssgManifest.js +0 -0
- package/@generated/{graphql/schema.graphql → schema.graphql} +508 -508
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sendAnalyticsEvent } from '@faststore/sdk'
|
|
2
|
-
import { gql } from '@faststore/graphql-utils'
|
|
3
2
|
|
|
3
|
+
import { gql } from '@generated'
|
|
4
4
|
import { useQuery } from 'src/sdk/graphql/useQuery'
|
|
5
5
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
6
6
|
import { useSession } from 'src/sdk/session'
|
|
@@ -14,13 +14,10 @@ import type { IntelligentSearchQueryEvent } from 'src/sdk/analytics/types'
|
|
|
14
14
|
/**
|
|
15
15
|
* This query is run on the browser and contains
|
|
16
16
|
* the current search state of the user
|
|
17
|
+
*
|
|
18
|
+
* The query definition has to stay on top, or else it fails
|
|
17
19
|
*/
|
|
18
|
-
export const query = gql`
|
|
19
|
-
fragment SearchEvent_metadata on SearchMetadata {
|
|
20
|
-
isTermMisspelled
|
|
21
|
-
logicalOperator
|
|
22
|
-
}
|
|
23
|
-
|
|
20
|
+
export const query = gql(`
|
|
24
21
|
query ClientProductGalleryQuery(
|
|
25
22
|
$first: Int!
|
|
26
23
|
$after: String!
|
|
@@ -49,7 +46,12 @@ export const query = gql`
|
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
|
-
|
|
49
|
+
|
|
50
|
+
fragment SearchEvent_metadata on SearchMetadata {
|
|
51
|
+
isTermMisspelled
|
|
52
|
+
logicalOperator
|
|
53
|
+
}
|
|
54
|
+
`)
|
|
53
55
|
|
|
54
56
|
export const useProductGalleryQuery = ({
|
|
55
57
|
term,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { gql } from '@faststore/graphql-utils'
|
|
2
1
|
import { useMemo } from 'react'
|
|
3
2
|
|
|
3
|
+
import { gql } from '@generated'
|
|
4
4
|
import type {
|
|
5
5
|
ClientProductQueryQuery,
|
|
6
6
|
ClientProductQueryQueryVariables,
|
|
@@ -9,14 +9,14 @@ import type {
|
|
|
9
9
|
import { useQuery } from '../graphql/useQuery'
|
|
10
10
|
import { useSession } from '../session'
|
|
11
11
|
|
|
12
|
-
const query = gql`
|
|
12
|
+
const query = gql(`
|
|
13
13
|
query ClientProductQuery($locator: [IStoreSelectedFacet!]!) {
|
|
14
14
|
...ClientProduct
|
|
15
15
|
product(locator: $locator) {
|
|
16
16
|
...ProductDetailsFragment_product
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`
|
|
19
|
+
`)
|
|
20
20
|
|
|
21
21
|
export const useProductQuery = <T extends ClientProductQueryQuery>(
|
|
22
22
|
productID: string,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { gql } from '@faststore/graphql-utils'
|
|
2
1
|
import { useSearch } from '@faststore/sdk'
|
|
2
|
+
|
|
3
|
+
import { gql } from '@generated'
|
|
3
4
|
import { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
4
5
|
import { useEffect, useCallback } from 'react'
|
|
6
|
+
|
|
5
7
|
import type { QueryOptions } from '../graphql/useQuery'
|
|
6
8
|
import { useSWRConfig } from 'swr'
|
|
7
9
|
import { prefetchQuery } from '../graphql/prefetchQuery'
|
|
8
10
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
9
11
|
|
|
10
|
-
export const query = gql`
|
|
12
|
+
export const query = gql(`
|
|
11
13
|
query ClientManyProductsQuery(
|
|
12
14
|
$first: Int!
|
|
13
15
|
$after: String
|
|
@@ -35,7 +37,7 @@ export const query = gql`
|
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
`
|
|
40
|
+
`)
|
|
39
41
|
|
|
40
42
|
export const useProductsQueryPrefetch = (
|
|
41
43
|
variables: ClientManyProductsQueryQueryVariables,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { gql } from '@
|
|
2
|
-
|
|
1
|
+
import { gql } from '@generated'
|
|
3
2
|
import type {
|
|
4
3
|
ClientManyProductsQueryQuery,
|
|
5
4
|
ClientManyProductsQueryQueryVariables,
|
|
@@ -9,7 +8,7 @@ import type { QueryOptions } from '../graphql/useQuery'
|
|
|
9
8
|
import { useQuery } from '../graphql/useQuery'
|
|
10
9
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
11
10
|
|
|
12
|
-
export const query = gql`
|
|
11
|
+
export const query = gql(`
|
|
13
12
|
query ClientManyProductsQuery(
|
|
14
13
|
$first: Int!
|
|
15
14
|
$after: String
|
|
@@ -37,7 +36,7 @@ export const query = gql`
|
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
`
|
|
39
|
+
`)
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* Use this hook for fetching a list of products, like shelves and tiles
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
2
|
|
|
3
3
|
import { sendAnalyticsEvent } from '@faststore/sdk'
|
|
4
|
-
import { gql } from '@faststore/graphql-utils'
|
|
5
4
|
import { useQuery } from 'src/sdk/graphql/useQuery'
|
|
6
5
|
|
|
6
|
+
import { gql } from '@generated'
|
|
7
7
|
import type {
|
|
8
8
|
ClientSearchSuggestionsQueryQuery as Query,
|
|
9
9
|
ClientSearchSuggestionsQueryQueryVariables as Variables,
|
|
@@ -12,7 +12,7 @@ import type { IntelligentSearchQueryEvent } from '../analytics/types'
|
|
|
12
12
|
|
|
13
13
|
import { useSession } from '../session'
|
|
14
14
|
|
|
15
|
-
const query = gql`
|
|
15
|
+
const query = gql(`
|
|
16
16
|
query ClientSearchSuggestionsQuery(
|
|
17
17
|
$term: String!
|
|
18
18
|
$selectedFacets: [IStoreSelectedFacet!]
|
|
@@ -37,7 +37,7 @@ const query = gql`
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
`
|
|
40
|
+
`)
|
|
41
41
|
|
|
42
42
|
function useSuggestions(term: string) {
|
|
43
43
|
const { channel, locale } = useSession()
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { gql } from '@faststore/graphql-utils'
|
|
2
|
-
|
|
3
1
|
import { useQuery } from 'src/sdk/graphql/useQuery'
|
|
2
|
+
import { gql } from '@generated'
|
|
4
3
|
import type {
|
|
5
4
|
ClientSearchSuggestionsQueryQuery as Query,
|
|
6
5
|
ClientSearchSuggestionsQueryQueryVariables as Variables,
|
|
@@ -8,7 +7,7 @@ import type {
|
|
|
8
7
|
|
|
9
8
|
import { useSession } from '../session'
|
|
10
9
|
|
|
11
|
-
const query = gql`
|
|
10
|
+
const query = gql(`
|
|
12
11
|
query ClientTopSearchSuggestionsQuery(
|
|
13
12
|
$term: String!
|
|
14
13
|
$selectedFacets: [IStoreSelectedFacet!]
|
|
@@ -22,7 +21,7 @@ const query = gql`
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
`
|
|
24
|
+
`)
|
|
26
25
|
|
|
27
26
|
function useTopSearch() {
|
|
28
27
|
const { channel, locale } = useSession()
|
package/src/sdk/session/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { gql } from '@faststore/graphql-utils'
|
|
2
1
|
import type { Session } from '@faststore/sdk'
|
|
3
2
|
import { createSessionStore } from '@faststore/sdk'
|
|
4
3
|
import { useMemo } from 'react'
|
|
5
4
|
|
|
5
|
+
import { gql } from '@generated'
|
|
6
6
|
import type {
|
|
7
7
|
ValidateSessionMutation,
|
|
8
8
|
ValidateSessionMutationVariables,
|
|
9
|
-
} from '
|
|
9
|
+
} from '@generated/graphql'
|
|
10
10
|
import storeConfig from '../../../faststore.config'
|
|
11
11
|
import { cartStore } from '../cart'
|
|
12
12
|
import { request } from '../graphql/request'
|
|
13
13
|
import { createValidationStore, useStore } from '../useStore'
|
|
14
14
|
|
|
15
|
-
export const mutation = gql`
|
|
15
|
+
export const mutation = gql(`
|
|
16
16
|
mutation ValidateSession($session: IStoreSession!, $search: String!) {
|
|
17
17
|
validateSession(session: $session, search: $search) {
|
|
18
18
|
locale
|
|
@@ -44,7 +44,7 @@ export const mutation = gql`
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`
|
|
47
|
+
`)
|
|
48
48
|
|
|
49
49
|
export const validateSession = async (session: Session) => {
|
|
50
50
|
const data = await request<
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IShippingItem } from '@faststore/api'
|
|
2
|
-
import { gql } from '@faststore/graphql-utils'
|
|
3
2
|
|
|
3
|
+
import { gql } from '@generated'
|
|
4
4
|
import type {
|
|
5
5
|
ClientShippingSimulationQueryQuery as Query,
|
|
6
6
|
ClientShippingSimulationQueryQueryVariables as Variables,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
|
|
9
9
|
import { request } from '../graphql/request'
|
|
10
10
|
|
|
11
|
-
const query = gql`
|
|
11
|
+
const query = gql(`
|
|
12
12
|
query ClientShippingSimulationQuery(
|
|
13
13
|
$postalCode: String!
|
|
14
14
|
$country: String!
|
|
@@ -37,7 +37,7 @@ const query = gql`
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
`
|
|
40
|
+
`)
|
|
41
41
|
|
|
42
42
|
export type ShippingQueryData = {
|
|
43
43
|
items: IShippingItem[]
|
|
@@ -70,7 +70,7 @@ export const getMergedSchema = (): GraphQLSchema =>
|
|
|
70
70
|
export function writeGraphqlSchemaFile(apiSchema: GraphQLSchema) {
|
|
71
71
|
try {
|
|
72
72
|
writeFileSync(
|
|
73
|
-
path.join(process.cwd(), '@generated', '
|
|
73
|
+
path.join(process.cwd(), '@generated', 'schema.graphql'),
|
|
74
74
|
printSchemaWithDirectives(apiSchema)
|
|
75
75
|
)
|
|
76
76
|
|
package/src/server/index.ts
CHANGED
|
@@ -21,15 +21,16 @@ import { makeExecutableSchema } from '@graphql-tools/schema'
|
|
|
21
21
|
import { loadFilesSync } from '@graphql-tools/load-files'
|
|
22
22
|
import type { TypeSource } from '@graphql-tools/utils'
|
|
23
23
|
|
|
24
|
-
import persisted from '
|
|
24
|
+
import persisted from '@generated/persisted-documents.json'
|
|
25
25
|
|
|
26
26
|
import vtexExtensionsResolvers from '../customizations/src/graphql/vtex/resolvers'
|
|
27
27
|
import thirdPartyResolvers from '../customizations/src/graphql/thirdParty/resolvers'
|
|
28
28
|
|
|
29
29
|
import { apiOptions } from './options'
|
|
30
|
+
import { TypedDocumentString } from '@generated/graphql'
|
|
30
31
|
|
|
31
32
|
interface ExecuteOptions<V = Record<string, unknown>> {
|
|
32
|
-
|
|
33
|
+
operation: Pick<TypedDocumentString<any, any>, '__meta__'>
|
|
33
34
|
variables: V
|
|
34
35
|
query?: string | null
|
|
35
36
|
}
|
|
@@ -49,7 +50,7 @@ const formatError: FormatErrorHandler = (err) => {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
function loadGeneratedSchema(): TypeSource {
|
|
52
|
-
return loadFilesSync(path.join(process.cwd(), '@generated'
|
|
53
|
+
return loadFilesSync(path.join(process.cwd(), '@generated'), {
|
|
53
54
|
extensions: ['graphql'],
|
|
54
55
|
})
|
|
55
56
|
}
|
|
@@ -89,11 +90,15 @@ export const execute = async <V extends Maybe<{ [key: string]: unknown }>, D>(
|
|
|
89
90
|
cookies: Map<string, Record<string, string>> | null
|
|
90
91
|
}
|
|
91
92
|
}> => {
|
|
92
|
-
const {
|
|
93
|
-
const
|
|
93
|
+
const { operation, variables, query: maybeQuery } = options
|
|
94
|
+
const { operationHash, operationName } = operation['__meta__']
|
|
95
|
+
|
|
96
|
+
const query = maybeQuery ?? persistedQueries.get(operationHash)
|
|
94
97
|
|
|
95
98
|
if (query == null) {
|
|
96
|
-
throw new Error(
|
|
99
|
+
throw new Error(
|
|
100
|
+
`No query found for operationName ${operationName} and operationHash ${operationHash}`
|
|
101
|
+
)
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
const enveloped = await envelopPromise
|
package/src/typings/overrides.ts
CHANGED
|
@@ -49,6 +49,7 @@ import Alert from '../components/sections/Alert'
|
|
|
49
49
|
import Breadcrumb from '../components/sections/Breadcrumb'
|
|
50
50
|
import BannerText from '../components/sections/BannerText'
|
|
51
51
|
import CrossSellingShelf from '../components/sections/CrossSellingShelf'
|
|
52
|
+
import EmptyState from '../components/sections/EmptyState'
|
|
52
53
|
import Hero from '../components/sections/Hero'
|
|
53
54
|
import ProductShelf from '../components/sections/ProductShelf'
|
|
54
55
|
import ProductDetails from '../components/sections/ProductDetails'
|
|
@@ -137,7 +138,7 @@ export type SectionsOverrides = {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
EmptyState: {
|
|
140
|
-
Section:
|
|
141
|
+
Section: typeof EmptyState
|
|
141
142
|
components: {
|
|
142
143
|
EmptyState: ComponentOverrideDefinition<
|
|
143
144
|
PropsWithChildren<EmptyStateProps>,
|
|
@@ -154,7 +155,7 @@ export type SectionsOverrides = {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
Navbar: {
|
|
157
|
-
Section: typeof Navbar
|
|
158
|
+
Section: typeof Navbar
|
|
158
159
|
components: {
|
|
159
160
|
Navbar: ComponentOverrideDefinition<NavbarProps, NavbarProps>
|
|
160
161
|
NavbarLinks: ComponentOverrideDefinition<
|
|
@@ -138,7 +138,12 @@ describe('FastStore GraphQL Layer', () => {
|
|
|
138
138
|
it('should handle options and execute', async () => {
|
|
139
139
|
const result = await execute({
|
|
140
140
|
variables: { slug: storeConfig.cypress.pages.collection.slice(1) },
|
|
141
|
-
|
|
141
|
+
operation: {
|
|
142
|
+
__meta__: {
|
|
143
|
+
operationName: 'ServerCollectionPageQuery',
|
|
144
|
+
operationHash: '4b33c5c07f440dc7489e55619dc2211a13786e72',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
142
147
|
})
|
|
143
148
|
expect(result.data).toBeDefined()
|
|
144
149
|
})
|
package/.babelrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":1,"cacheKey":"11c6821dd3328014cb60963fdb04fe2fb22b03d8cf2a4edce16a375d2a682d96","files":["../node_modules/next/dist/server/next-server.js","../node_modules/next/package.json","../node_modules/next/dist/server/node-polyfill-fetch.js","../node_modules/next/dist/server/node-polyfill-web-streams.js","../node_modules/next/dist/server/request-meta.js","../node_modules/next/dist/server/server-route-utils.js","../node_modules/next/dist/server/serve-static.js","../node_modules/next/dist/server/render.js","../node_modules/next/dist/server/app-render.js","../node_modules/next/dist/server/base-server.js","../node_modules/next/dist/server/require.js","../node_modules/next/dist/server/load-components.js","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/server/utils.js","../node_modules/next/dist/server/image-optimizer.js","../node_modules/next/dist/server/lib/recursive-readdir-sync.js","../node_modules/next/dist/server/base-http/node.js","../node_modules/next/dist/server/api-utils/node.js","../node_modules/next/dist/lib/is-error.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/shared/lib/utils.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/shared/lib/router/utils/path-match.js","../node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js","../node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js","../node_modules/next/dist/shared/lib/router/utils/parse-url.js","../node_modules/next/dist/build/output/log.js","../node_modules/next/dist/build/webpack/require-hook.js","../node_modules/next/dist/shared/lib/page-path/denormalize-page-path.js","../node_modules/next/dist/shared/lib/page-path/normalize-page-path.js","../node_modules/next/dist/shared/lib/router/utils/relativize-url.js","../node_modules/next/dist/shared/lib/router/utils/prepare-destination.js","../node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js","../node_modules/next/dist/shared/lib/router/utils/route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/querystring.js","../node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js","../node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js","../node_modules/next/dist/build/webpack/loaders/next-serverless-loader/utils.js","../node_modules/next/dist/shared/lib/router/utils/route-regex.js","../node_modules/next/dist/shared/lib/router/utils/app-paths.js","../node_modules/next/dist/server/send-payload/index.js","../node_modules/next/dist/server/api-utils/index.js","../node_modules/next/dist/server/response-cache/index.js","../node_modules/next/dist/server/web/sandbox/index.js","../node_modules/next/dist/server/lib/incremental-cache/index.js","../node_modules/next/dist/shared/lib/router/utils/index.js","../node_modules/next/dist/lib/redirect-status.js","../node_modules/next/dist/lib/constants.js","../node_modules/next/dist/lib/is-serializable-props.js","../node_modules/next/dist/shared/lib/amp-mode.js","../node_modules/next/dist/shared/lib/amp-context.js","../node_modules/next/dist/shared/lib/head.js","../node_modules/next/dist/shared/lib/head-manager-context.js","../node_modules/next/dist/shared/lib/loadable.js","../node_modules/next/dist/shared/lib/loadable-context.js","../node_modules/next/dist/shared/lib/router-context.js","../node_modules/next/dist/shared/lib/router/utils/is-dynamic.js","../node_modules/next/dist/shared/lib/html-context.js","../node_modules/next/dist/server/render-result.js","../node_modules/next/dist/server/node-web-streams-helper.js","../node_modules/next/dist/shared/lib/image-config-context.js","../node_modules/next/dist/server/internal-utils.js","../node_modules/next/dist/server/post-process.js","../node_modules/next/dist/server/htmlescape.js","../node_modules/next/dist/shared/lib/flush-effects.js","../node_modules/next/dist/lib/interop-default.js","../node_modules/next/dist/server/lib/mock-request.js","../node_modules/next/dist/shared/lib/match-remote-pattern.js","../node_modules/next/dist/shared/lib/image-blur-svg.js","../node_modules/next/dist/shared/lib/is-plain-object.js","../node_modules/next/dist/server/lib/squoosh/main.js","../node_modules/next/dist/server/base-http/index.js","../node_modules/next/dist/server/crypto-utils.js","../node_modules/next/dist/server/lib/etag.js","../node_modules/next/dist/client/components/match-segments.js","../node_modules/next/dist/client/components/hooks-server-context.js","../node_modules/next/dist/client/components/hooks-server.js","../node_modules/next/dist/lib/chalk.js","../node_modules/next/dist/shared/lib/runtime-config.js","../node_modules/next/dist/server/router.js","../node_modules/next/dist/server/send-payload/revalidate-headers.js","../node_modules/next/dist/shared/lib/router/utils/is-bot.js","../node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js","../node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js","../node_modules/next/dist/shared/lib/i18n/get-locale-redirect.js","../node_modules/next/dist/shared/lib/get-hostname.js","../node_modules/next/dist/shared/lib/page-path/normalize-path-sep.js","../node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js","../node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js","../node_modules/next/dist/shared/lib/escape-regexp.js","../node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js","../node_modules/next/dist/server/accept-header.js","../node_modules/next/dist/shared/lib/i18n/detect-locale-cookie.js","../node_modules/next/dist/server/response-cache/types.js","../node_modules/next/dist/server/web/sandbox/sandbox.js","../node_modules/next/dist/server/web/sandbox/context.js","../node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js","../node_modules/next/dist/lib/non-nullable.js","../node_modules/next/dist/server/optimize-amp.js","../node_modules/next/dist/server/font-utils.js","../node_modules/next/dist/shared/lib/isomorphic/path.js","../node_modules/next/dist/shared/lib/router/utils/sorted-routes.js","../node_modules/next/dist/shared/lib/side-effect.js","../node_modules/next/dist/shared/lib/image-config.js","../node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js","../node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js","../node_modules/next/dist/compiled/react-server-dom-webpack/package.json","../node_modules/next/dist/lib/web/chalk.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/streams.js","../node_modules/next/dist/shared/lib/router/utils/format-url.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/package.json","../node_modules/next/dist/compiled/@next/react-dev-overlay/dist/middleware.js","../node_modules/next/dist/server/google-font-metrics.json","../node_modules/styled-jsx/package.json","../node_modules/next/dist/shared/lib/router/utils/parse-path.js","../node_modules/next/dist/compiled/react-server-dom-webpack/index.js","../node_modules/next/dist/compiled/node-fetch/package.json","../node_modules/next/dist/compiled/node-fetch/index.js","../node_modules/next/dist/compiled/get-orientation/package.json","../node_modules/next/dist/compiled/get-orientation/index.js","../node_modules/next/dist/compiled/image-size/package.json","../node_modules/next/dist/compiled/image-size/index.js","../node_modules/next/dist/compiled/is-animated/package.json","../node_modules/next/dist/compiled/is-animated/index.js","../node_modules/next/dist/compiled/content-disposition/package.json","../node_modules/next/dist/compiled/content-disposition/index.js","../node_modules/next/dist/compiled/chalk/package.json","../node_modules/next/dist/compiled/chalk/index.js","../node_modules/next/dist/compiled/compression/package.json","../node_modules/next/dist/compiled/compression/index.js","../node_modules/next/dist/compiled/http-proxy/package.json","../node_modules/next/dist/compiled/http-proxy/index.js","../node_modules/next/dist/compiled/send/package.json","../node_modules/next/dist/compiled/send/index.js","../node_modules/next/dist/compiled/strip-ansi/package.json","../node_modules/next/dist/compiled/strip-ansi/index.js","../node_modules/next/dist/compiled/@next/react-dev-overlay/package.json","../node_modules/next/dist/compiled/react-is/package.json","../node_modules/next/dist/compiled/react-is/index.js","../node_modules/@next/env/package.json","../node_modules/@next/env/dist/index.js","../node_modules/next/dist/lib/pick.js","../node_modules/next/dist/server/web/sandbox/fetch-inline-assets.js","../node_modules/styled-jsx/index.js","../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js","../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js","../node_modules/next/dist/compiled/@hapi/accept/package.json","../node_modules/next/dist/compiled/@hapi/accept/index.js","../node_modules/next/dist/compiled/bytes/package.json","../node_modules/next/dist/compiled/bytes/index.js","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/content-type/package.json","../node_modules/next/dist/compiled/content-type/index.js","../node_modules/next/dist/compiled/raw-body/package.json","../node_modules/next/dist/compiled/raw-body/index.js","../node_modules/next/dist/compiled/cookie/package.json","../node_modules/next/dist/compiled/cookie/index.js","../node_modules/@swc/helpers/lib/_async_to_generator.js","../node_modules/@swc/helpers/lib/_extends.js","../node_modules/@swc/helpers/lib/_interop_require_default.js","../node_modules/@swc/helpers/lib/_interop_require_wildcard.js","../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js","../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js","../node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js","../node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js","../node_modules/next/dist/shared/lib/router/utils/add-locale.js","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/path-to-regexp/index.js","../node_modules/next/dist/compiled/fresh/package.json","../node_modules/next/dist/compiled/fresh/index.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.production.min.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.development.js","../node_modules/next/dist/compiled/node-html-parser/package.json","../node_modules/next/dist/compiled/node-html-parser/index.js","../node_modules/next/dist/compiled/micromatch/package.json","../node_modules/next/dist/compiled/micromatch/index.js","../node_modules/styled-jsx/dist/index/index.js","../node_modules/next/dist/compiled/jest-worker/package.json","../node_modules/next/dist/compiled/jest-worker/index.js","../node_modules/next/dist/compiled/edge-runtime/package.json","../node_modules/next/dist/compiled/edge-runtime/index.js","../node_modules/next/dist/compiled/lru-cache/package.json","../node_modules/next/dist/compiled/lru-cache/index.js","../node_modules/next/dist/compiled/path-browserify/package.json","../node_modules/next/dist/compiled/path-browserify/index.js","../node_modules/next/dist/compiled/debug/package.json","../node_modules/next/dist/compiled/debug/index.js","../node_modules/next/dist/compiled/semver/package.json","../node_modules/next/dist/compiled/semver/index.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/encoding.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/console.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/abort-controller.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/url.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/blob.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/cache.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/fetch.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/crypto.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/events.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/structured-clone.js"]}
|