@faststore/core 2.2.77 → 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.
Files changed (252) hide show
  1. package/.babelrc.js +12 -0
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/build-manifest.json +89 -89
  4. package/.next/cache/.tsbuildinfo +1 -1
  5. package/.next/cache/config.json +3 -3
  6. package/.next/cache/eslint/.cache_1gneedd +1 -1
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/images-manifest.json +1 -1
  12. package/.next/next-minimal-server.js.nft.json +1 -0
  13. package/.next/next-server.js.nft.json +1 -1
  14. package/.next/prerender-manifest.js +1 -0
  15. package/.next/prerender-manifest.json +1 -1
  16. package/.next/react-loadable-manifest.json +17 -17
  17. package/.next/required-server-files.json +1 -1
  18. package/.next/routes-manifest.json +1 -1
  19. package/.next/server/chunks/119.js +1 -0
  20. package/.next/server/chunks/12.js +1 -0
  21. package/.next/server/chunks/187.js +1 -0
  22. package/.next/server/chunks/202.js +1 -0
  23. package/.next/server/chunks/24.js +1 -0
  24. package/.next/server/chunks/242.js +1 -0
  25. package/.next/server/chunks/247.js +1 -0
  26. package/.next/server/chunks/344.js +1 -0
  27. package/.next/server/chunks/404.js +1 -434
  28. package/.next/server/chunks/414.js +1 -0
  29. package/.next/server/chunks/484.js +1 -0
  30. package/.next/server/chunks/493.js +1 -0
  31. package/.next/server/chunks/498.js +1 -0
  32. package/.next/server/chunks/540.js +1 -0
  33. package/.next/server/chunks/57.js +1 -434
  34. package/.next/server/chunks/624.js +1 -0
  35. package/.next/server/chunks/640.js +6 -0
  36. package/.next/server/chunks/646.js +279 -0
  37. package/.next/server/chunks/659.js +9 -0
  38. package/.next/server/chunks/679.js +1 -0
  39. package/.next/server/chunks/693.js +1 -58
  40. package/.next/server/chunks/694.js +1 -0
  41. package/.next/server/chunks/779.js +1 -58
  42. package/.next/server/chunks/82.js +8 -0
  43. package/.next/server/chunks/857.js +1 -0
  44. package/.next/server/chunks/859.js +4 -957
  45. package/.next/server/chunks/881.js +1 -0
  46. package/.next/server/chunks/917.js +1 -0
  47. package/.next/server/chunks/936.js +1 -0
  48. package/.next/server/chunks/96.js +1 -0
  49. package/.next/server/chunks/997.js +1 -0
  50. package/.next/server/functions-config-manifest.json +1 -0
  51. package/.next/server/middleware-build-manifest.js +1 -1
  52. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  53. package/.next/server/next-font-manifest.js +1 -0
  54. package/.next/server/next-font-manifest.json +1 -0
  55. package/.next/server/pages/404.js +1 -391
  56. package/.next/server/pages/404.js.nft.json +1 -1
  57. package/.next/server/pages/500.js +1 -395
  58. package/.next/server/pages/500.js.nft.json +1 -1
  59. package/.next/server/pages/[...slug].js +1 -1071
  60. package/.next/server/pages/[...slug].js.nft.json +1 -1
  61. package/.next/server/pages/[slug]/p.js +1 -2315
  62. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  63. package/.next/server/pages/_app.js +1 -301
  64. package/.next/server/pages/_app.js.nft.json +1 -1
  65. package/.next/server/pages/_document.js +1 -363
  66. package/.next/server/pages/_document.js.nft.json +1 -1
  67. package/.next/server/pages/_error.js +1 -164
  68. package/.next/server/pages/_error.js.nft.json +1 -1
  69. package/.next/server/pages/account.js +1 -370
  70. package/.next/server/pages/account.js.nft.json +1 -1
  71. package/.next/server/pages/api/graphql.js +1 -3085
  72. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  73. package/.next/server/pages/api/health/live.js +1 -31
  74. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  75. package/.next/server/pages/api/health/ready.js +1 -31
  76. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  77. package/.next/server/pages/api/preview.js +1 -137
  78. package/.next/server/pages/api/preview.js.nft.json +1 -1
  79. package/.next/server/pages/checkout.js +1 -370
  80. package/.next/server/pages/checkout.js.nft.json +1 -1
  81. package/.next/server/pages/en-US/404.html +2 -2
  82. package/.next/server/pages/en-US/404.json +1 -1
  83. package/.next/server/pages/en-US/500.html +2 -2
  84. package/.next/server/pages/en-US/500.json +1 -1
  85. package/.next/server/pages/en-US/account.html +2 -2
  86. package/.next/server/pages/en-US/checkout.html +2 -2
  87. package/.next/server/pages/en-US/login.html +2 -2
  88. package/.next/server/pages/en-US/login.json +1 -1
  89. package/.next/server/pages/en-US/s.html +2 -2
  90. package/.next/server/pages/en-US.html +4 -4
  91. package/.next/server/pages/en-US.json +1 -1
  92. package/.next/server/pages/index.js +1 -439
  93. package/.next/server/pages/index.js.nft.json +1 -1
  94. package/.next/server/pages/login.js +1 -382
  95. package/.next/server/pages/login.js.nft.json +1 -1
  96. package/.next/server/pages/s.js +1 -554
  97. package/.next/server/pages/s.js.nft.json +1 -1
  98. package/.next/server/pages-manifest.json +1 -18
  99. package/.next/server/webpack-api-runtime.js +1 -229
  100. package/.next/server/webpack-runtime.js +1 -229
  101. package/.next/static/HohWS5v_0biRSlLJu0K2W/_buildManifest.js +1 -0
  102. package/.next/static/chunks/104-d42a7ff6c8b8dd89.js +1 -0
  103. package/.next/static/chunks/161-b39fe2f79ff7bc85.js +1 -0
  104. package/.next/static/chunks/202.c7d8a71173edecfb.js +1 -0
  105. package/.next/static/chunks/217.01bc0ad07edd6f1b.js +1 -0
  106. package/.next/static/chunks/247.52b3924429a474c6.js +1 -0
  107. package/.next/static/chunks/484.b82b73b1d8c37e02.js +1 -0
  108. package/.next/static/chunks/540.6c62d2536d42a1e0.js +1 -0
  109. package/.next/static/chunks/575-853fb8b1ba4ce8c4.js +14 -0
  110. package/.next/static/chunks/624.d3de62b4562a33f3.js +1 -0
  111. package/.next/static/chunks/629-b7b5ef6f15ecba9d.js +1 -0
  112. package/.next/static/chunks/65.da22595d53beae76.js +1 -0
  113. package/.next/static/chunks/758.b53ee01b506973e0.js +1 -0
  114. package/.next/static/chunks/857.d2299cfe995af21d.js +1 -0
  115. package/.next/static/chunks/framework-8e279965036b6169.js +33 -0
  116. package/.next/static/chunks/main-6f63f6746cc029db.js +1 -0
  117. package/.next/static/chunks/pages/404-1334d11ab8467b3d.js +1 -0
  118. package/.next/static/chunks/pages/500-449c5bd51f98423f.js +1 -0
  119. package/.next/static/chunks/pages/[...slug]-7c8ec664c28eca52.js +1 -0
  120. package/.next/static/chunks/pages/[slug]/p-a4f7d7c00fdf4157.js +1 -0
  121. package/.next/static/chunks/pages/_app-6516d0c2c7e0e686.js +68 -0
  122. package/.next/static/chunks/pages/_error-fbf331a03642b495.js +1 -0
  123. package/.next/static/chunks/pages/account-dbc5c028225cd1ac.js +1 -0
  124. package/.next/static/chunks/pages/checkout-29ae2c37eaf172e1.js +1 -0
  125. package/.next/static/chunks/pages/index-00798cca3b47590d.js +1 -0
  126. package/.next/static/chunks/pages/login-c4d2c856008df5ac.js +1 -0
  127. package/.next/static/chunks/pages/s-dacaed02ad104d73.js +1 -0
  128. package/.next/static/chunks/webpack-1c08d77cfe1b8585.js +1 -0
  129. package/.next/static/css/{021de9c7b050d301.css → 0d45c82d8887a269.css} +1 -1
  130. package/.next/static/css/{e772e7786bb4dee9.css → 211c7542af66d8b4.css} +1 -1
  131. package/.next/static/css/{df588bb98c0b0ca6.css → 2980acad3f8e1028.css} +1 -1
  132. package/.next/static/css/{510895065f32ed2f.css → 4c4d90eb8cb1d2b7.css} +1 -1
  133. package/.next/static/css/{938781cdc945862e.css → 821a5219786be653.css} +1 -1
  134. package/.next/static/css/{def381bf7c69fa2e.css → 96e3fddf695d6aa9.css} +1 -1
  135. package/.next/static/css/{6a7fdc5a21fbead5.css → b9d9ba1b04f3160d.css} +1 -1
  136. package/.next/static/css/{9558da13053ac066.css → cff9aafa16fccc9c.css} +1 -1
  137. package/.next/static/css/{7e897ebb936fac09.css → d586715f4f707df4.css} +1 -1
  138. package/.next/static/css/{cb7d1fcea42fab9c.css → e32410b31c666cb2.css} +1 -1
  139. package/.next/trace +91 -82
  140. package/.turbo/turbo-build.log +36 -41
  141. package/.turbo/turbo-lint.log +0 -3
  142. package/.turbo/turbo-test.log +11 -11
  143. package/@generated/gql.ts +196 -0
  144. package/@generated/{graphql/index.ts → graphql.ts} +718 -252
  145. package/@generated/index.ts +1 -0
  146. package/@generated/persisted-documents.json +13 -0
  147. package/api/index.ts +1 -1
  148. package/cms/faststore/content-types.json +18 -0
  149. package/cms/faststore/sections.json +73 -0
  150. package/codegen.ts +61 -0
  151. package/index.ts +1 -0
  152. package/jest.config.js +9 -1
  153. package/next.config.js +5 -0
  154. package/package.json +14 -10
  155. package/src/components/product/ProductCard/ProductCard.tsx +4 -4
  156. package/src/components/search/Filter/Filter.tsx +4 -3
  157. package/src/components/sections/EmptyState/DefaultComponents.ts +5 -0
  158. package/src/components/sections/EmptyState/EmptyState.tsx +91 -8
  159. package/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts +15 -0
  160. package/src/components/sections/ProductDetails/ProductDetails.tsx +6 -6
  161. package/src/components/ui/Image/Image.tsx +1 -1
  162. package/src/customizations/src/fragments/ClientManyProducts.ts +3 -3
  163. package/src/customizations/src/fragments/ClientProduct.ts +3 -3
  164. package/src/customizations/src/fragments/ClientProductGallery.ts +3 -3
  165. package/src/customizations/src/fragments/ClientSearchSuggestions.ts +3 -3
  166. package/src/customizations/src/fragments/ClientShippingSimulation.ts +3 -3
  167. package/src/customizations/src/fragments/ClientTopSearchSuggestions.ts +3 -3
  168. package/src/customizations/src/fragments/ServerCollectionPage.ts +3 -3
  169. package/src/customizations/src/fragments/ServerProduct.ts +3 -3
  170. package/src/pages/404.tsx +32 -30
  171. package/src/pages/500.tsx +32 -34
  172. package/src/pages/[...slug].tsx +4 -4
  173. package/src/pages/[slug]/p.tsx +7 -7
  174. package/src/pages/api/graphql.ts +10 -4
  175. package/src/pages/login.tsx +31 -8
  176. package/src/sdk/cart/index.ts +3 -3
  177. package/src/sdk/graphql/prefetchQuery.ts +4 -3
  178. package/src/sdk/graphql/request.ts +67 -8
  179. package/src/sdk/graphql/useLazyQuery.ts +4 -3
  180. package/src/sdk/graphql/useQuery.ts +7 -3
  181. package/src/sdk/newsletter/useNewsletter.ts +4 -4
  182. package/src/sdk/product/usePageProductsQuery.ts +3 -3
  183. package/src/sdk/product/useProductGalleryQuery.ts +10 -8
  184. package/src/sdk/product/useProductQuery.ts +3 -3
  185. package/src/sdk/product/useProductsPrefetch.ts +5 -3
  186. package/src/sdk/product/useProductsQuery.ts +3 -4
  187. package/src/sdk/search/useSuggestions.ts +3 -3
  188. package/src/sdk/search/useTopSearch.ts +3 -4
  189. package/src/sdk/session/index.ts +4 -4
  190. package/src/sdk/shipping/index.ts +3 -3
  191. package/src/server/generator/schema.ts +1 -1
  192. package/src/server/index.ts +11 -6
  193. package/src/typings/overrides.ts +3 -2
  194. package/test/server/index.test.ts +6 -1
  195. package/.babelrc +0 -4
  196. package/.next/cache/next-server.js.nft.json +0 -1
  197. package/.next/server/chunks/117.js +0 -427
  198. package/.next/server/chunks/177.js +0 -125
  199. package/.next/server/chunks/183.js +0 -122
  200. package/.next/server/chunks/184.js +0 -61
  201. package/.next/server/chunks/289.js +0 -243
  202. package/.next/server/chunks/312.js +0 -676
  203. package/.next/server/chunks/350.js +0 -2898
  204. package/.next/server/chunks/386.js +0 -200
  205. package/.next/server/chunks/574.js +0 -145
  206. package/.next/server/chunks/576.js +0 -122
  207. package/.next/server/chunks/585.js +0 -639
  208. package/.next/server/chunks/632.js +0 -514
  209. package/.next/server/chunks/661.js +0 -1451
  210. package/.next/server/chunks/676.js +0 -32
  211. package/.next/server/chunks/719.js +0 -84
  212. package/.next/server/chunks/74.js +0 -4152
  213. package/.next/server/chunks/825.js +0 -4074
  214. package/.next/server/chunks/854.js +0 -72
  215. package/.next/server/chunks/863.js +0 -111
  216. package/.next/server/chunks/898.js +0 -711
  217. package/.next/server/chunks/903.js +0 -1926
  218. package/.next/server/chunks/98.js +0 -163
  219. package/.next/server/chunks/988.js +0 -211
  220. package/.next/static/RSHWlIOnC1jAGjYtzvUGP/_buildManifest.js +0 -1
  221. package/.next/static/chunks/223-cb77217cce52d45c.js +0 -1
  222. package/.next/static/chunks/251.11f5198fc8bef3a4.js +0 -1
  223. package/.next/static/chunks/386.d01e0db26c523f0f.js +0 -1
  224. package/.next/static/chunks/397-0d3aada1012cd78b.js +0 -1
  225. package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
  226. package/.next/static/chunks/585.6561778b7763b79e.js +0 -1
  227. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  228. package/.next/static/chunks/675-479a97aecebead97.js +0 -1
  229. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  230. package/.next/static/chunks/800.5d92de2974baf641.js +0 -1
  231. package/.next/static/chunks/881-57643fb90f59e576.js +0 -1
  232. package/.next/static/chunks/98.40c7e17d9de4eb8f.js +0 -1
  233. package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
  234. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  235. package/.next/static/chunks/main-e4e873ee741162eb.js +0 -1
  236. package/.next/static/chunks/pages/404-e106cb9a78182f5f.js +0 -1
  237. package/.next/static/chunks/pages/500-d28aa4a8ce88bddd.js +0 -1
  238. package/.next/static/chunks/pages/[...slug]-c4abcc133f85d9d0.js +0 -1
  239. package/.next/static/chunks/pages/[slug]/p-4a75b11857b82b5c.js +0 -1
  240. package/.next/static/chunks/pages/_app-30b9666307e4b3b1.js +0 -1
  241. package/.next/static/chunks/pages/_error-319451dea77827a6.js +0 -1
  242. package/.next/static/chunks/pages/account-bf9c88a9cac80d8a.js +0 -1
  243. package/.next/static/chunks/pages/checkout-6ca76c1e88a28ac4.js +0 -1
  244. package/.next/static/chunks/pages/index-629ba146ae5f0ecf.js +0 -1
  245. package/.next/static/chunks/pages/login-d2af0de13ea75848.js +0 -1
  246. package/.next/static/chunks/pages/s-d729254b91430d1c.js +0 -1
  247. package/.next/static/chunks/webpack-54ce04ec11860b0b.js +0 -1
  248. package/@generated/graphql/persisted.json +0 -13
  249. package/codegen.yml +0 -23
  250. package/src/components/sections/EmptyState/Overrides.tsx +0 -14
  251. package/.next/static/{RSHWlIOnC1jAGjYtzvUGP → HohWS5v_0biRSlLJu0K2W}/_ssgManifest.js +0 -0
  252. package/@generated/{graphql/schema.graphql → schema.graphql} +508 -508
@@ -1,5 +1,5 @@
1
- import { gql } from '@faststore/graphql-utils'
2
1
  import { useSearch } from '@faststore/sdk'
2
+ import { gql } from '@generated'
3
3
  import {
4
4
  ClientManyProductsQueryQuery,
5
5
  ClientManyProductsQueryQueryVariables,
@@ -30,7 +30,7 @@ export const useGalleryPage = (page: number) => {
30
30
  return useGalleryPageCallback(page)
31
31
  }
32
32
 
33
- export const query = gql`
33
+ export const query = gql(`
34
34
  query ClientManyProductsQuery(
35
35
  $first: Int!
36
36
  $after: String
@@ -58,7 +58,7 @@ export const query = gql`
58
58
  }
59
59
  }
60
60
  }
61
- `
61
+ `)
62
62
 
63
63
  const getKey = (object: any) => JSON.stringify(object)
64
64
 
@@ -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 '@faststore/graphql-utils'
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()
@@ -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 '../../../@generated/graphql/index'
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', 'graphql', 'schema.graphql'),
73
+ path.join(process.cwd(), '@generated', 'schema.graphql'),
74
74
  printSchemaWithDirectives(apiSchema)
75
75
  )
76
76
 
@@ -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 '../../@generated/graphql/persisted.json'
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
- operationName: string
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', 'graphql'), {
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 { operationName, variables, query: maybeQuery } = options
93
- const query = maybeQuery ?? persistedQueries.get(operationName)
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(`No query found for operationName: ${operationName}`)
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
@@ -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: never
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
- operationName: 'ServerCollectionPageQuery',
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,4 +0,0 @@
1
- {
2
- "presets": ["next/babel"],
3
- "plugins": ["@faststore/graphql-utils/babel"]
4
- }
@@ -1 +0,0 @@
1
- {"version":1,"cacheKey":"2b413164d25e94a4cfdc7a4ba202ff3912fb9774b94d177598853c8b07010d4a","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/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/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/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/console.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/encoding.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/fetch.js","../node_modules/next/dist/compiled/@edge-runtime/primitives/cache.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"]}