@faststore/core 2.2.78 → 3.0.1

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/Xf_-r26LvSZnfqjpm_a71/_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 +37 -42
  141. package/.turbo/turbo-lint.log +0 -3
  142. package/.turbo/turbo-test.log +9 -9
  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 +2 -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/JJRI44e-3F3WVhD-DxmO2/_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/{JJRI44e-3F3WVhD-DxmO2 → Xf_-r26LvSZnfqjpm_a71}/_ssgManifest.js +0 -0
  252. package/@generated/{graphql/schema.graphql → schema.graphql} +508 -508
@@ -0,0 +1 @@
1
+ export * from './gql'
@@ -0,0 +1,13 @@
1
+ {
2
+ "4b33c5c07f440dc7489e55619dc2211a13786e72": "fragment ServerCollectionPage on Query { collection(slug: $slug) { id } } query ServerCollectionPageQuery($slug: String!) { collection(slug: $slug) { breadcrumbList { itemListElement { item name position } } meta { selectedFacets { key value } } seo { description title } } ...ServerCollectionPage }",
3
+ "bf778aa3411fa194094d24f73250124d60496121": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ProductDetailsFragment_product on StoreProduct { brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } fragment ServerProduct on Query { product(locator: $locator) { id: productID } } query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { brand { name } breadcrumbList { itemListElement { item name position } } description gtin image { alternateName url } isVariantOf { productGroupID } name offers { highPrice lowPrice offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }",
4
+ "87e1ba227013cb087bcbb35584c1b0b7cdf612ef": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice price quantity seller { identifier } } fragment CartMessage on StoreCartMessage { status text } fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { messages { ...CartMessage } order { acceptedOffer { ...CartItem } orderNumber } } }",
5
+ "feb7005103a859e2bc8cf2360d568806fd88deba": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } }",
6
+ "b854e384d076dc482f0afe016b604d527f2562a3": "fragment ClientManyProducts on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment ProductSummary_product on StoreProduct { brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } query ClientManyProductsQuery($after: String, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { edges { node { ...ProductSummary_product } } pageInfo { totalCount } } } ...ClientManyProducts }",
7
+ "6d9e14e3ac08a539b7df06ad644b7f34527d9493": "fragment ClientProductGallery on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment Filter_facets on StoreFacet { ... on StoreFacetBoolean { __typename key label values { label quantity selected value } } ... on StoreFacetRange { __typename key label max { absolute selected } min { absolute selected } } } fragment SearchEvent_metadata on SearchMetadata { isTermMisspelled logicalOperator } query ClientProductGalleryQuery($after: String!, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { facets { ...Filter_facets } metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } } ...ClientProductGallery }",
8
+ "e535e4897bf98968b8ce0a59af64212c4a746e6f": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ClientProduct on Query { product(locator: $locator) { id: productID } } fragment ProductDetailsFragment_product on StoreProduct { brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } query ClientProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { ...ProductDetailsFragment_product } ...ClientProduct }",
9
+ "31f2520a6ab19cf0773667e14b382c27abf5e485": "fragment ClientSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } fragment ProductSummary_product on StoreProduct { brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } fragment SearchEvent_metadata on SearchMetadata { isTermMisspelled logicalOperator } query ClientSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } suggestions { products { ...ProductSummary_product } terms { value } } } ...ClientSearchSuggestions }",
10
+ "e2385b0f11726d0068f96548f57a8dd441c064e3": "fragment ClientTopSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } query ClientTopSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } ...ClientTopSearchSuggestions }",
11
+ "5696202828f9275216a445e316ebf516f168c506": "mutation ValidateSession($search: String!, $session: IStoreSession!) { validateSession(session: $session, search: $search) { addressType channel country currency { code symbol } deliveryMode { deliveryChannel deliveryMethod deliveryWindow { endDate startDate } } geoCoordinates { latitude longitude } locale person { email familyName givenName id } postalCode } }",
12
+ "d6667f1de2a26b94b9b55f4b25d7d823f82635a0": "fragment ClientShippingSimulation on Query { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city } } } query ClientShippingSimulationQuery($country: String!, $items: [IShippingItem!]!, $postalCode: String!) { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city neighborhood state } logisticsInfo { slas { availableDeliveryWindows { endDateUtc listPrice price startDateUtc } carrier localizedEstimates price shippingEstimate } } } ...ClientShippingSimulation }"
13
+ }
package/api/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { gql } from '@faststore/graphql-utils'
1
+ export { gql } from '../@generated'
2
2
  export type {
3
3
  StoreAggregateOfferRoot,
4
4
  StorePropertyValueRoot,
@@ -207,5 +207,23 @@
207
207
  ]
208
208
  }
209
209
  ]
210
+ },
211
+ {
212
+ "id": "login",
213
+ "name": "Login",
214
+ "configurationSchemaSets": [],
215
+ "isSingleton": true
216
+ },
217
+ {
218
+ "id": "500",
219
+ "name": "Error 500",
220
+ "configurationSchemaSets": [],
221
+ "isSingleton": true
222
+ },
223
+ {
224
+ "id": "404",
225
+ "name": "Error 404",
226
+ "configurationSchemaSets": [],
227
+ "isSingleton": true
210
228
  }
211
229
  ]
@@ -1949,5 +1949,78 @@
1949
1949
  }
1950
1950
  }
1951
1951
  }
1952
+ },
1953
+ {
1954
+ "name": "EmptyState",
1955
+ "schema": {
1956
+ "title": "Empty State",
1957
+ "type": "object",
1958
+ "description": "Empty State configuration",
1959
+ "properties": {
1960
+ "title": {
1961
+ "title": "Title",
1962
+ "type": "string"
1963
+ },
1964
+ "titleIcon": {
1965
+ "title": "Title Icon",
1966
+ "type": "object",
1967
+ "properties": {
1968
+ "icon": {
1969
+ "title": "Icon",
1970
+ "type": "string",
1971
+ "enumNames": ["CircleWavy Warning"],
1972
+ "enum": ["CircleWavyWarning"]
1973
+ },
1974
+ "alt": {
1975
+ "title": "Alternative Label",
1976
+ "type": "string"
1977
+ }
1978
+ }
1979
+ },
1980
+ "subtitle": {
1981
+ "title": "Subtitle",
1982
+ "type": "string"
1983
+ },
1984
+ "showLoader": {
1985
+ "type": "boolean",
1986
+ "title": "Show loader?",
1987
+ "default": false
1988
+ },
1989
+ "errorState": {
1990
+ "title": "Error state used for shown errorId and fromUrl properties in 500 and 404 pages",
1991
+ "type": "object",
1992
+ "properties": {
1993
+ "errorId": {
1994
+ "title": "errorId used in 500 and 404 pages",
1995
+ "type": "object",
1996
+ "properties": {
1997
+ "show": {
1998
+ "type": "boolean",
1999
+ "title": "Show errorId in the end of message?"
2000
+ },
2001
+ "description": {
2002
+ "type": "string",
2003
+ "title": "Description shown before the errorId"
2004
+ }
2005
+ }
2006
+ },
2007
+ "fromUrl": {
2008
+ "title": "fromUrl used in 500 and 404 pages",
2009
+ "type": "object",
2010
+ "properties": {
2011
+ "show": {
2012
+ "type": "boolean",
2013
+ "title": "Show fromUrl in the end of message?"
2014
+ },
2015
+ "description": {
2016
+ "type": "string",
2017
+ "title": "Description shown before the fromUrl"
2018
+ }
2019
+ }
2020
+ }
2021
+ }
2022
+ }
2023
+ }
2024
+ }
1952
2025
  }
1953
2026
  ]
package/codegen.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { type CodegenConfig } from '@graphql-codegen/cli'
2
+ import { Kind, type DocumentNode } from 'graphql'
3
+
4
+ /* Extracts operationName from queries. Example: ServerProductQuery */
5
+ const getOperationName = (document: DocumentNode) => {
6
+ for (const definition of document.definitions) {
7
+ if (
8
+ definition.kind === Kind.OPERATION_DEFINITION &&
9
+ typeof definition.name?.value === 'string'
10
+ ) {
11
+ return definition.name.value
12
+ }
13
+ }
14
+
15
+ return 'UnknownOperation'
16
+ }
17
+
18
+ const config: CodegenConfig = {
19
+ overwrite: true,
20
+ errorsOnly: true,
21
+ schema: './@generated/schema.graphql',
22
+ documents: ['./src/**/*.{ts,tsx}'],
23
+ generates: {
24
+ './@generated/': {
25
+ preset: 'client',
26
+ config: {
27
+ /** Not all of these properties are supported by the preset, but it reflects our previous config when we used typescript plugins directly */
28
+ preResolveTypes: true,
29
+ avoidOptionals: true,
30
+ enumsAsTypes: true,
31
+ skipTypeNameForRoot: true,
32
+ skipTypename: true,
33
+ allowEnumStringTypes: false,
34
+ flattenGeneratedTypes: true,
35
+ namingConvention: 'change-case-all#pascalCase',
36
+ exportFragmentSpreadSubTypes: true,
37
+ /** Removes useless AST definitions from documents */
38
+ documentMode: 'string',
39
+ },
40
+ presetConfig: {
41
+ // Disabled fragment masking - it wasn't being used by us. This can be reviewed in the future
42
+ fragmentMasking: false,
43
+ // Recognizes the gql(`query { ... }`) calls and generates the types for them
44
+ gqlTagName: 'gql',
45
+ onExecutableDocumentNode: (document: DocumentNode) => ({
46
+ // This makes sure that the operation name is always present in the __meta__ field of each query
47
+ // This helps us to identify the query in the persisted documents and to debug errors in the client
48
+ operationName: getOperationName(document),
49
+ }),
50
+ persistedDocuments: {
51
+ // Keeps document simple, including only necessary properties as '__meta__' and its properties
52
+ mode: 'replaceDocumentWithHash',
53
+ // replaces operation['__meta__']['hash'] with operation['__meta__']['operationHash']
54
+ hashPropertyName: 'operationHash',
55
+ },
56
+ },
57
+ },
58
+ },
59
+ }
60
+
61
+ export default config
package/index.ts CHANGED
@@ -24,6 +24,7 @@ export { default as AlertSection } from './src/components/sections/Alert'
24
24
  export { default as BannerTextSection } from './src/components/sections/BannerText'
25
25
  export { default as BreadcrumbSection } from './src/components/sections/Breadcrumb'
26
26
  export { default as CrossSellingShelfSection } from './src/components/sections/CrossSellingShelf'
27
+ export { default as EmptyState } from './src/components/sections/EmptyState'
27
28
  export { default as HeroSection } from './src/components/sections/Hero'
28
29
  export { default as NavbarSection } from './src/components/sections/Navbar'
29
30
  export { default as NewsletterSection } from './src/components/sections/Newsletter'
package/jest.config.js CHANGED
@@ -1,6 +1,14 @@
1
+ const { pathsToModuleNameMapper } = require('ts-jest')
2
+ const { compilerOptions } = require('./tsconfig')
3
+
1
4
  /** @type {import('ts-jest').JestConfigWithTsJest} */
2
5
  module.exports = {
3
6
  preset: 'ts-jest',
4
7
  testPathIgnorePatterns: ['/node_modules/', 'cypress/'],
5
- modulePaths: ['<rootDir>/test'],
8
+
9
+ /** Support importing from src/ or @generated/ folders (TS path imports) */
10
+ modulePaths: [compilerOptions.baseUrl], // <-- This will be set to 'baseUrl' value
11
+ moduleNameMapper: pathsToModuleNameMapper(
12
+ compilerOptions.paths /*, { prefix: '<rootDir>/' } */
13
+ ),
6
14
  }
package/next.config.js CHANGED
@@ -7,6 +7,8 @@ const storeConfig = require('./faststore.config')
7
7
  * */
8
8
  const nextConfig = {
9
9
  /* config options here */
10
+ /* Replaces terser by swc for minifying. It's the default in NextJS 13 */
11
+ swcMinify: true,
10
12
  images: {
11
13
  domains: [`${storeConfig.api.storeId}.vtexassets.com`],
12
14
  deviceSizes: [360, 540, 768, 1280, 1440],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.2.78",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -11,6 +11,7 @@
11
11
  "scripts": {
12
12
  "generate:schema": "tsx src/server/generator/generateGraphQLSchemaFile.ts",
13
13
  "generate:codegen": "graphql-codegen",
14
+ "generate:copy-back": "copyfiles \"@generated/**/*\" $DESTINATION",
14
15
  "generate": "faststore generate-graphql -c",
15
16
  "build": "yarn partytown & yarn generate && next build",
16
17
  "dev": "yarn partytown & yarn generate && next dev",
@@ -37,29 +38,32 @@
37
38
  "@envelop/graphql-jit": "^1.1.1",
38
39
  "@envelop/parser-cache": "^2.2.0",
39
40
  "@envelop/validation-cache": "^2.2.0",
40
- "@faststore/api": "^2.2.78",
41
- "@faststore/components": "^2.2.78",
42
- "@faststore/graphql-utils": "^2.2.78",
43
- "@faststore/sdk": "^2.2.78",
44
- "@faststore/ui": "^2.2.78",
41
+ "@faststore/api": "^3.0.1",
42
+ "@faststore/components": "^3.0.1",
43
+ "@faststore/graphql-utils": "^3.0.1",
44
+ "@faststore/sdk": "^3.0.1",
45
+ "@faststore/ui": "^3.0.1",
45
46
  "@graphql-codegen/cli": "^3.3.1",
47
+ "@graphql-codegen/client-preset": "^4.1.0",
46
48
  "@graphql-codegen/typescript": "^3.0.4",
47
49
  "@graphql-codegen/typescript-operations": "^3.0.4",
48
50
  "@graphql-tools/load-files": "^7.0.0",
49
51
  "@graphql-tools/merge": "^9.0.0",
50
52
  "@graphql-tools/utils": "^9.2.1",
53
+ "@graphql-typed-document-node/core": "^3.2.0",
51
54
  "@types/react": "^18.2.42",
52
55
  "@vtex/client-cms": "^0.2.12",
53
56
  "@vtex/prettier-config": "1.0.0",
54
57
  "autoprefixer": "^10.4.0",
55
58
  "chalk": "^5.2.0",
59
+ "copyfiles": "^2.4.1",
56
60
  "css-loader": "^6.7.1",
57
61
  "deepmerge": "^4.3.1",
58
62
  "draftjs-to-html": "^0.9.1",
59
63
  "graphql": "^15.0.0",
60
64
  "include-media": "^1.4.10",
61
65
  "msw": "^0.43.1",
62
- "next": "^12.3.1",
66
+ "next": "^13.5.6",
63
67
  "next-seo": "^6.4.0",
64
68
  "nextjs-progressbar": "^0.0.14",
65
69
  "postcss": "^8.4.4",
@@ -78,8 +82,8 @@
78
82
  "devDependencies": {
79
83
  "@cypress/code-coverage": "^3.12.1",
80
84
  "@envelop/testing": "^6.0.0",
81
- "@faststore/cli": "^2.2.78",
82
- "@faststore/eslint-config": "^2.2.78",
85
+ "@faststore/cli": "^3.0.1",
86
+ "@faststore/eslint-config": "^3.0.1",
83
87
  "@faststore/lighthouse": "^1.12.32",
84
88
  "@lhci/cli": "^0.9.0",
85
89
  "@testing-library/cypress": "^10.0.1",
@@ -123,5 +127,5 @@
123
127
  "node": "18.19.0",
124
128
  "yarn": "1.19.1"
125
129
  },
126
- "gitHead": "3c62fe1c0b2432c97a93a2be93f4c761d0ed546c"
130
+ "gitHead": "b4ce87c7fbac57cb20d34acb44806bb48c22f864"
127
131
  }
@@ -1,4 +1,3 @@
1
- import { gql } from '@faststore/graphql-utils'
2
1
  import {
3
2
  ProductCard as UIProductCard,
4
3
  ProductCardContent as UIProductCardContent,
@@ -6,8 +5,9 @@ import {
6
5
  } from '@faststore/ui'
7
6
  import { memo, useMemo } from 'react'
8
7
 
8
+ import { gql } from '@generated'
9
9
  import type { ProductSummary_ProductFragment } from '@generated/graphql'
10
- import { ImageProps } from 'next/future/image'
10
+ import { ImageProps } from 'next/image'
11
11
  import NextLink from 'next/link'
12
12
  import { Image } from 'src/components/ui/Image'
13
13
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
@@ -125,7 +125,7 @@ function ProductCard({
125
125
  )
126
126
  }
127
127
 
128
- export const fragment = gql`
128
+ export const fragment = gql(`
129
129
  fragment ProductSummary_product on StoreProduct {
130
130
  id: productID
131
131
  slug
@@ -163,6 +163,6 @@ export const fragment = gql`
163
163
  }
164
164
  }
165
165
  }
166
- `
166
+ `)
167
167
 
168
168
  export default memo(ProductCard)
@@ -1,7 +1,8 @@
1
- import { gql } from '@faststore/graphql-utils'
2
1
  import { useUI } from '@faststore/ui'
3
2
  import type { Filter_FacetsFragment } from '@generated/graphql'
4
3
  import { Suspense } from 'react'
4
+
5
+ import { gql } from '@generated'
5
6
  import { ProductGalleryProps } from 'src/components/ui/ProductGallery/ProductGallery'
6
7
  import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
7
8
  import { useFilter } from 'src/sdk/search/useFilter'
@@ -62,7 +63,7 @@ function Filter({
62
63
  )
63
64
  }
64
65
 
65
- export const fragment = gql`
66
+ export const fragment = gql(`
66
67
  fragment Filter_facets on StoreFacet {
67
68
  ... on StoreFacetRange {
68
69
  key
@@ -93,6 +94,6 @@ export const fragment = gql`
93
94
  __typename
94
95
  }
95
96
  }
96
- `
97
+ `)
97
98
 
98
99
  export default Filter
@@ -0,0 +1,5 @@
1
+ import { EmptyState as UIEmptyState } from '@faststore/ui'
2
+
3
+ export const EmptyStateDefaultComponents = {
4
+ EmptyState: UIEmptyState,
5
+ } as const
@@ -1,33 +1,116 @@
1
- import { ReactNode } from 'react'
2
1
  import type { PropsWithChildren } from 'react'
2
+ import { useRouter } from 'next/router'
3
+
4
+ import { Icon as UIIcon, Loader as UILoader } from '@faststore/ui'
5
+
6
+ import { useOverrideComponents } from '../../../sdk/overrides/OverrideContext'
3
7
 
4
8
  import Section from '../Section'
9
+
5
10
  import styles from './section.module.scss'
6
11
 
7
- import { EmptyState as EmptyStateWrapper } from 'src/components/sections/EmptyState/Overrides'
12
+ import { EmptyStateDefaultComponents } from './DefaultComponents'
13
+ import { getOverridableSection } from '../../../sdk/overrides/getOverriddenSection'
8
14
 
9
15
  export interface EmptyStateProps {
16
+ /**
17
+ * Title for the `EmptyState` component.
18
+ */
10
19
  title: string
11
- titleIcon?: ReactNode
20
+ /**
21
+ * A React component that will be rendered as an icon.
22
+ */
23
+ titleIcon?: {
24
+ icon: string
25
+ alt: string
26
+ }
27
+ /**
28
+ * Subtitle for the `EmptyState` component.
29
+ */
30
+ subtitle?: string
31
+ /**
32
+ * Boolean that makes the loader be shown.
33
+ */
34
+ showLoader?: boolean
35
+ /**
36
+ * Object that manages the error state descriptions.
37
+ */
38
+ errorState?: {
39
+ errorId?: {
40
+ show?: boolean
41
+ description?: string
42
+ }
43
+ fromUrl?: {
44
+ show?: boolean
45
+ description?: string
46
+ }
47
+ }
48
+ }
49
+
50
+ const useErrorState = () => {
51
+ const router = useRouter()
52
+ const {
53
+ query: { errorId, fromUrl },
54
+ pathname,
55
+ asPath,
56
+ } = router
57
+
58
+ return {
59
+ errorId,
60
+ fromUrl: fromUrl ?? asPath ?? pathname,
61
+ }
12
62
  }
13
63
 
14
64
  function EmptyState({
15
- title = EmptyStateWrapper.props.title,
16
- titleIcon = EmptyStateWrapper.props.titleIcon,
65
+ title,
66
+ titleIcon,
17
67
  children,
68
+ subtitle,
69
+ errorState,
70
+ showLoader = false,
18
71
  }: PropsWithChildren<EmptyStateProps>) {
72
+ const { EmptyState: EmptyStateWrapper } =
73
+ useOverrideComponents<'EmptyState'>()
74
+ const { errorId, fromUrl } = useErrorState()
75
+
76
+ const icon = !!titleIcon?.icon ? (
77
+ <UIIcon
78
+ name={titleIcon?.icon}
79
+ aria-label={titleIcon?.alt}
80
+ width={56}
81
+ height={56}
82
+ weight="thin"
83
+ />
84
+ ) : (
85
+ EmptyStateWrapper.props.titleIcon
86
+ )
87
+
19
88
  return (
20
89
  <Section className={`${styles.section} section-empty-state`}>
21
90
  <EmptyStateWrapper.Component
22
91
  bkgColor="light"
23
92
  {...EmptyStateWrapper.props}
24
- title={title}
25
- titleIcon={titleIcon}
93
+ title={title ?? EmptyStateWrapper.props.title}
94
+ titleIcon={icon}
26
95
  >
96
+ {!!subtitle && <h2>{subtitle}</h2>}
97
+ {!!errorState?.errorId?.show && (
98
+ <p>{`${errorState?.errorId?.description} ${errorId}`}</p>
99
+ )}
100
+ {!!errorState?.fromUrl?.show && (
101
+ <p>{`${errorState?.fromUrl?.description} ${fromUrl}`}</p>
102
+ )}
103
+ {showLoader && <UILoader />}
27
104
  {children}
28
105
  </EmptyStateWrapper.Component>
29
106
  </Section>
30
107
  )
31
108
  }
32
109
 
33
- export default EmptyState
110
+ const OverridableEmptyState = getOverridableSection<typeof EmptyState>(
111
+ 'EmptyState',
112
+ EmptyState,
113
+ EmptyStateDefaultComponents
114
+ )
115
+
116
+ export default OverridableEmptyState
@@ -0,0 +1,15 @@
1
+ import { override } from 'src/customizations/src/components/overrides/EmptyState'
2
+ import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
3
+
4
+ import type { SectionOverrideDefinitionV1 } from 'src/typings/overridesDefinition'
5
+ import EmptyState from './EmptyState'
6
+
7
+ /**
8
+ * This component exists to support overrides 1.0
9
+ *
10
+ * This allows users to override the default EmptyState section present in the Headless CMS
11
+ */
12
+ export const OverriddenDefaultEmptyState = getOverriddenSection({
13
+ ...(override as SectionOverrideDefinitionV1<'EmptyState'>),
14
+ Section: EmptyState,
15
+ })
@@ -1,12 +1,12 @@
1
1
  import { useEffect, useState, useMemo } from 'react'
2
2
 
3
- import { gql } from '@faststore/graphql-utils'
4
3
  import type { CurrencyCode, ViewItemEvent } from '@faststore/sdk'
5
4
  import { sendAnalyticsEvent } from '@faststore/sdk'
6
5
 
7
- import type { AnalyticsItem } from '../../../sdk/analytics/types'
8
- import { useFormattedPrice } from '../../../sdk/product/useFormattedPrice'
9
- import { useSession } from '../../../sdk/session'
6
+ import { gql } from '@generated'
7
+ import type { AnalyticsItem } from 'src/sdk/analytics/types'
8
+ import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
9
+ import { useSession } from 'src/sdk/session'
10
10
 
11
11
  import Section from '../Section'
12
12
  import ProductDescription from '../../../components/ui/ProductDescription'
@@ -238,7 +238,7 @@ function ProductDetails({
238
238
  )
239
239
  }
240
240
 
241
- export const fragment = gql`
241
+ export const fragment = gql(`
242
242
  fragment ProductDetailsFragment_product on StoreProduct {
243
243
  id: productID
244
244
  sku
@@ -280,7 +280,7 @@ export const fragment = gql`
280
280
  # Contains necessary info to add this item to cart
281
281
  ...CartProductItem
282
282
  }
283
- `
283
+ `)
284
284
 
285
285
  const OverridableProductDetails = getOverridableSection<typeof ProductDetails>(
286
286
  'ProductDetails',
@@ -1,6 +1,6 @@
1
1
  import { memo } from 'react'
2
2
 
3
- import NextImage, { ImageProps as NextImageProps } from 'next/future/image'
3
+ import NextImage, { ImageProps as NextImageProps } from 'next/image'
4
4
  import loader from './loader'
5
5
 
6
6
  export type ImageProps = NextImageProps
@@ -1,6 +1,6 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientManyProducts on Query {
5
5
  search(
6
6
  first: $first
@@ -16,4 +16,4 @@ export const fragment = gql`
16
16
  }
17
17
  }
18
18
  }
19
- `
19
+ `)
@@ -1,9 +1,9 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientProduct on Query {
5
5
  product(locator: $locator) {
6
6
  id: productID
7
7
  }
8
8
  }
9
- `
9
+ `)
@@ -1,6 +1,6 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientProductGallery on Query {
5
5
  search(
6
6
  first: $first
@@ -16,4 +16,4 @@ export const fragment = gql`
16
16
  }
17
17
  }
18
18
  }
19
- `
19
+ `)
@@ -1,6 +1,6 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientSearchSuggestions on Query {
5
5
  search(first: 5, term: $term, selectedFacets: $selectedFacets) {
6
6
  suggestions {
@@ -10,4 +10,4 @@ export const fragment = gql`
10
10
  }
11
11
  }
12
12
  }
13
- `
13
+ `)
@@ -1,6 +1,6 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientShippingSimulation on Query {
5
5
  shipping(items: $items, postalCode: $postalCode, country: $country) {
6
6
  address {
@@ -8,4 +8,4 @@ export const fragment = gql`
8
8
  }
9
9
  }
10
10
  }
11
- `
11
+ `)
@@ -1,6 +1,6 @@
1
- import { gql } from '@faststore/graphql-utils'
1
+ import { gql } from '@generated'
2
2
 
3
- export const fragment = gql`
3
+ export const fragment = gql(`
4
4
  fragment ClientTopSearchSuggestions on Query {
5
5
  search(first: 5, term: $term, selectedFacets: $selectedFacets) {
6
6
  suggestions {
@@ -10,4 +10,4 @@ export const fragment = gql`
10
10
  }
11
11
  }
12
12
  }
13
- `
13
+ `)