@faststore/core 2.1.38 → 2.1.39

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 (32) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/next-server.js.nft.json +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/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/routes-manifest.json +1 -1
  14. package/.next/server/chunks/350.js +1 -1
  15. package/.next/server/middleware-build-manifest.js +1 -1
  16. package/.next/server/pages/[slug]/p.js +46 -17
  17. package/.next/server/pages/api/graphql.js +1 -1
  18. package/.next/server/pages/en-US/404.html +2 -2
  19. package/.next/server/pages/en-US/500.html +2 -2
  20. package/.next/server/pages/en-US/account.html +2 -2
  21. package/.next/server/pages/en-US/checkout.html +2 -2
  22. package/.next/server/pages/en-US/login.html +2 -2
  23. package/.next/server/pages/en-US/s.html +2 -2
  24. package/.next/server/pages/en-US.html +2 -2
  25. package/.next/server/pages-manifest.json +3 -3
  26. package/.next/static/{OxGIJPGNOTL0f1MehwB7N → AZ5H7_jKsFGK4P5JiXSwz}/_buildManifest.js +1 -1
  27. package/.next/static/chunks/pages/[slug]/{p-c1f2b05344981f12.js → p-44e66d729b2413fb.js} +1 -1
  28. package/.next/trace +80 -80
  29. package/.turbo/turbo-build.log +1 -1
  30. package/package.json +2 -2
  31. package/src/pages/[slug]/p.tsx +36 -17
  32. /package/.next/static/{OxGIJPGNOTL0f1MehwB7N → AZ5H7_jKsFGK4P5JiXSwz}/_ssgManifest.js +0 -0
@@ -25,7 +25,7 @@ Route (pages) Size First Load JS
25
25
  ├ /_app 0 B 77.9 kB
26
26
  ├ ● /[...slug] 4.06 kB 208 kB
27
27
  ├ └ css/d67fbe2a613293c1.css 1.84 kB
28
- ├ ● /[slug]/p 10.9 kB 205 kB
28
+ ├ ● /[slug]/p 10.8 kB 205 kB
29
29
  ├ └ css/5972921daee792bb.css 11.3 kB
30
30
  ├ ○ /404 1.19 kB 114 kB
31
31
  ├ ● /500 1.21 kB 114 kB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.1.38",
3
+ "version": "2.1.39",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -110,5 +110,5 @@
110
110
  "msw": {
111
111
  "workerDirectory": "public"
112
112
  },
113
- "gitHead": "cd01b62a902d6458d6d27e7e622b4a5465dd8c91"
113
+ "gitHead": "b65cdc0aa4eecc84dbf87bfc78776b4672928ba1"
114
114
  }
@@ -42,27 +42,28 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
42
42
  type Props = ServerProductPageQueryQuery &
43
43
  PDPContentType & {
44
44
  globalSections: GlobalSectionsData
45
+ meta: {
46
+ title: string
47
+ description: string
48
+ canonical: string
49
+ }
45
50
  }
46
51
 
47
- function Page({ product, sections, globalSections }: Props) {
52
+ function Page({ product, sections, globalSections, offers, meta }: Props) {
48
53
  const { currency } = useSession()
49
- const { seo } = product
50
- const title = seo.title || storeConfig.seo.title
51
- const description = seo.description || storeConfig.seo.description
52
- const canonical = `${storeConfig.storeUrl}${seo.canonical}`
53
54
 
54
55
  return (
55
56
  <GlobalSections {...globalSections}>
56
57
  {/* SEO */}
57
58
  <NextSeo
58
- title={title}
59
- description={description}
60
- canonical={canonical}
59
+ title={meta.title}
60
+ description={meta.description}
61
+ canonical={meta.canonical}
61
62
  openGraph={{
62
63
  type: 'og:product',
63
- url: canonical,
64
- title,
65
- description,
64
+ url: meta.canonical,
65
+ title: meta.title,
66
+ description: meta.description,
66
67
  images: product.image.map((img) => ({
67
68
  url: img.url,
68
69
  alt: img.alternateName,
@@ -90,12 +91,7 @@ function Page({ product, sections, globalSections }: Props) {
90
91
  gtin={product.gtin}
91
92
  releaseDate={product.releaseDate}
92
93
  images={product.image.map((img) => img.url)} // Somehow, Google does not understand this valid Schema.org schema, so we need to do conversions
93
- offersType="AggregateOffer"
94
- offers={{
95
- ...product.offers,
96
- ...product.offers.offers[0],
97
- url: canonical,
98
- }}
94
+ offers={offers}
99
95
  />
100
96
 
101
97
  {/*
@@ -209,10 +205,33 @@ export const getStaticProps: GetStaticProps<
209
205
  throw errors[0]
210
206
  }
211
207
 
208
+ const { seo } = data.product
209
+ const title = seo.title || storeConfig.seo.title
210
+ const description = seo.description || storeConfig.seo.description
211
+ const canonical = `${storeConfig.storeUrl}${seo.canonical}`
212
+
213
+ const meta = { title, description, canonical }
214
+
215
+ let offer = {}
216
+
217
+ if (data.product.offers.offers.length > 0) {
218
+ const { listPrice, ...offerData } = data.product.offers.offers[0]
219
+
220
+ offer = offerData
221
+ }
222
+
223
+ const offers = {
224
+ ...offer,
225
+ priceCurrency: data.product.offers.priceCurrency,
226
+ url: canonical,
227
+ }
228
+
212
229
  return {
213
230
  props: {
214
231
  ...data,
215
232
  ...cmsPage,
233
+ meta,
234
+ offers,
216
235
  globalSections,
217
236
  },
218
237
  }