@faststore/core 3.0.152 → 3.0.154

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 (232) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +82 -88
  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/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/.next/next-minimal-server.js.nft.json +1 -1
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.js +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/react-loadable-manifest.json +214 -48
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/1844.js +1 -1
  17. package/.next/server/chunks/319.js +1 -0
  18. package/.next/server/chunks/3199.js +1 -0
  19. package/.next/server/chunks/4350.js +1 -0
  20. package/.next/server/chunks/5156.js +1 -0
  21. package/.next/server/chunks/5380.js +1 -0
  22. package/.next/server/chunks/5476.js +1 -0
  23. package/.next/server/chunks/5671.js +1 -1
  24. package/.next/server/chunks/5754.js +9 -0
  25. package/.next/server/chunks/6414.js +1 -0
  26. package/.next/server/chunks/8096.js +1 -1
  27. package/.next/server/chunks/8419.js +1 -0
  28. package/.next/server/chunks/8640.js +1 -0
  29. package/.next/server/chunks/8737.js +1 -0
  30. package/.next/server/chunks/9088.js +1 -1
  31. package/.next/server/chunks/9369.js +1 -0
  32. package/.next/server/chunks/9572.js +307 -0
  33. package/.next/server/chunks/983.js +1 -0
  34. package/.next/server/chunks/ScrollToTopButton.js +1 -0
  35. package/.next/server/chunks/UIBannerText.js +1 -1
  36. package/.next/server/middleware-build-manifest.js +1 -1
  37. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  38. package/.next/server/pages/404.js +1 -1
  39. package/.next/server/pages/404.js.nft.json +1 -1
  40. package/.next/server/pages/500.js +1 -1
  41. package/.next/server/pages/500.js.nft.json +1 -1
  42. package/.next/server/pages/[...slug].js +1 -1
  43. package/.next/server/pages/[...slug].js.nft.json +1 -1
  44. package/.next/server/pages/[slug]/p.js +1 -1
  45. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  46. package/.next/server/pages/_app.js.nft.json +1 -1
  47. package/.next/server/pages/_document.js.nft.json +1 -1
  48. package/.next/server/pages/_error.js.nft.json +1 -1
  49. package/.next/server/pages/account.js +1 -1
  50. package/.next/server/pages/account.js.nft.json +1 -1
  51. package/.next/server/pages/api/graphql.js +1 -1
  52. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  53. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  54. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  55. package/.next/server/pages/api/preview.js +1 -1
  56. package/.next/server/pages/api/preview.js.nft.json +1 -1
  57. package/.next/server/pages/checkout.js +1 -1
  58. package/.next/server/pages/checkout.js.nft.json +1 -1
  59. package/.next/server/pages/en-US/404.html +1 -1
  60. package/.next/server/pages/en-US/404.json +1 -1
  61. package/.next/server/pages/en-US/500.html +1 -1
  62. package/.next/server/pages/en-US/500.json +1 -1
  63. package/.next/server/pages/en-US/account.html +1 -1
  64. package/.next/server/pages/en-US/account.json +1 -1
  65. package/.next/server/pages/en-US/checkout.html +1 -1
  66. package/.next/server/pages/en-US/checkout.json +1 -1
  67. package/.next/server/pages/en-US/login.html +1 -1
  68. package/.next/server/pages/en-US/login.json +1 -1
  69. package/.next/server/pages/en-US/s.html +1 -1
  70. package/.next/server/pages/en-US/s.json +1 -1
  71. package/.next/server/pages/en-US.html +2 -11
  72. package/.next/server/pages/en-US.json +1 -1
  73. package/.next/server/pages/index.js +1 -1
  74. package/.next/server/pages/index.js.nft.json +1 -1
  75. package/.next/server/pages/login.js +1 -1
  76. package/.next/server/pages/login.js.nft.json +1 -1
  77. package/.next/server/pages/s.js +1 -1
  78. package/.next/server/pages/s.js.nft.json +1 -1
  79. package/.next/server/pages-manifest.json +1 -1
  80. package/.next/server/webpack-runtime.js +1 -1
  81. package/.next/static/SfomoT7cCMNxtcr8yWFzF/_buildManifest.js +1 -0
  82. package/.next/static/chunks/1153.d7522522b6c917ed.js +1 -0
  83. package/.next/static/chunks/1550-f05e702b3204bd0a.js +1 -0
  84. package/.next/static/chunks/1552.a7758d4b2464351a.js +1 -0
  85. package/.next/static/chunks/1770.b0a7b096fe1d1bb2.js +1 -0
  86. package/.next/static/chunks/1774.85dc251aa39a517b.js +1 -0
  87. package/.next/static/chunks/2032.0826fda8cd80138d.js +1 -0
  88. package/.next/static/chunks/2388.908db499afc2082a.js +1 -0
  89. package/.next/static/chunks/2552.b245748eb0e40257.js +1 -0
  90. package/.next/static/chunks/3202.2bdeba847ce9ecd4.js +1 -0
  91. package/.next/static/chunks/3523.9c4d94172a1336ac.js +1 -0
  92. package/.next/static/chunks/3666.107f6d709e2d3b2c.js +1 -0
  93. package/.next/static/chunks/459-e4b75fb35a56e812.js +1 -0
  94. package/.next/static/chunks/5156.fe20405ee7a0d2d5.js +1 -0
  95. package/.next/static/chunks/5217.350e250227ef3657.js +1 -0
  96. package/.next/static/chunks/5380.955177408ea25915.js +1 -0
  97. package/.next/static/chunks/5484.50796e8843ec9dad.js +1 -0
  98. package/.next/static/chunks/5810.470a769e37e4b13b.js +1 -0
  99. package/.next/static/chunks/5997.8b2a914748263bb7.js +1 -0
  100. package/.next/static/chunks/6379-1578190b254c09a6.js +1 -0
  101. package/.next/static/chunks/6941-6223429b182b7109.js +33 -0
  102. package/.next/static/chunks/6999-7b2e114edc42cc1c.js +1 -0
  103. package/.next/static/chunks/7195.fb3e46b248b339d1.js +1 -0
  104. package/.next/static/chunks/8501.c65e0e689232daaf.js +1 -0
  105. package/.next/static/chunks/8857.0ff8f6604fb061a8.js +1 -0
  106. package/.next/static/chunks/9463.6f5675e44c925bfc.js +1 -0
  107. package/.next/static/chunks/983.3808cb829b3a4ec9.js +1 -0
  108. package/.next/static/chunks/BannerNewsletter.0b61ee5e562a55e0.js +1 -0
  109. package/.next/static/chunks/BannerText.a10d4f428fc5cd97.js +1 -0
  110. package/.next/static/chunks/ButtonSignIn.530066e6a0aaaa4b.js +1 -0
  111. package/.next/static/chunks/CartItem.64f56e23e94f577b.js +1 -0
  112. package/.next/static/chunks/CartSidebar.dfa8017080b88d46.js +1 -0
  113. package/.next/static/chunks/EmptyCart.335d05fe570a1b28.js +1 -0
  114. package/.next/static/chunks/Footer.c0816f0c74d7e24b.js +1 -0
  115. package/.next/static/chunks/Gift.a189921eb7c7a1a8.js +1 -0
  116. package/.next/static/chunks/Newsletter.7a07fe93f98e2922.js +1 -0
  117. package/.next/static/chunks/OrderSummary.2b7aae72c78d68ae.js +1 -0
  118. package/.next/static/chunks/ProductShelf.44b90c6f4e1c13d6.js +1 -0
  119. package/.next/static/chunks/ProductTiles.b3c7bd3a52226529.js +1 -0
  120. package/.next/static/chunks/RegionModal.23513fc5245a511f.js +1 -0
  121. package/.next/static/chunks/ScrollToTopButton.1fd39c18569afe69.js +1 -0
  122. package/.next/static/chunks/Toast.8635143b7896eb54.js +1 -0
  123. package/.next/static/chunks/UIBannerText.ac22c6843ac720b8.js +1 -0
  124. package/.next/static/chunks/UIButton.c6beeae8a8d0d6f3.js +1 -0
  125. package/.next/static/chunks/UIToast.a3b2b8fb137a7e55.js +1 -0
  126. package/.next/static/chunks/{framework-8e279965036b6169.js → framework-12a146e94cfcf7c4.js} +2 -2
  127. package/.next/static/chunks/main-209ac4974b020af1.js +1 -0
  128. package/.next/static/chunks/pages/404-358f6795222bf991.js +1 -0
  129. package/.next/static/chunks/pages/500-7adc48c3231ccee1.js +1 -0
  130. package/.next/static/chunks/pages/[...slug]-dcd9dbc989fa6d96.js +1 -0
  131. package/.next/static/chunks/pages/[slug]/p-eee2b539c749f442.js +1 -0
  132. package/.next/static/chunks/pages/_app-e419b2062065ccf0.js +1 -0
  133. package/.next/static/chunks/pages/_error-85cabf0d7a5ea2f2.js +1 -0
  134. package/.next/static/chunks/pages/account-9db0ef5c4174c7dd.js +1 -0
  135. package/.next/static/chunks/pages/checkout-abaa6374ae946641.js +1 -0
  136. package/.next/static/chunks/pages/index-8c1d9f19fd83e58b.js +1 -0
  137. package/.next/static/chunks/pages/login-8d2eb8db226d6363.js +1 -0
  138. package/.next/static/chunks/pages/s-67ecf818f7c63b16.js +1 -0
  139. package/.next/static/chunks/webpack-909c48392196dcdf.js +1 -0
  140. package/.next/static/css/083dc2a5b0de2439.css +1 -0
  141. package/.next/static/css/18e4be87b97035da.css +1 -0
  142. package/.next/static/css/210f14f5aba4cccd.css +1 -0
  143. package/.next/static/css/22fa0a502d499a62.css +1 -0
  144. package/.next/static/css/326d9de401ed8b48.css +1 -0
  145. package/.next/static/css/339c61e31dc962ed.css +1 -0
  146. package/.next/static/css/5273202f7c5e5ec1.css +1 -0
  147. package/.next/static/css/865e30903caadb79.css +1 -0
  148. package/.next/static/css/{e47f1a002bdcf76f.css → 936c65069d608087.css} +1 -1
  149. package/.next/static/css/93d239c461485bdf.css +1 -0
  150. package/.next/static/css/9718991cd57978e9.css +1 -0
  151. package/.next/static/css/b1806cbafd0c1f81.css +1 -0
  152. package/.next/static/css/bd9313ce4313a00a.css +1 -0
  153. package/.next/static/css/cba7600898edb684.css +1 -0
  154. package/.next/trace +97 -98
  155. package/.turbo/turbo-build.log +23 -23
  156. package/.turbo/turbo-lint.log +1 -1
  157. package/.turbo/turbo-test.log +5 -5
  158. package/package.json +2 -2
  159. package/src/components/cms/GlobalSections.tsx +0 -37
  160. package/src/components/cms/RenderSections.tsx +25 -17
  161. package/src/components/cms/home/Components.ts +7 -3
  162. package/src/components/cms/plp/Components.ts +59 -0
  163. package/src/components/cms/search/Components.ts +68 -0
  164. package/src/components/sections/ProductShelf/DefaultComponents.ts +17 -3
  165. package/src/components/templates/LandingPage/LandingPage.tsx +9 -1
  166. package/src/components/templates/ProductListingPage/ProductListing.tsx +25 -31
  167. package/src/components/templates/ProductListingPage/ProductListingPage.tsx +7 -1
  168. package/src/components/templates/SearchPage/SearchPage.tsx +13 -30
  169. package/src/components/templates/SearchPage/SearchWrapper.tsx +3 -0
  170. package/src/components/ui/ProductShelf/ProductShelf.tsx +7 -1
  171. package/src/pages/404.tsx +11 -5
  172. package/src/pages/500.tsx +11 -5
  173. package/src/pages/[...slug].tsx +31 -12
  174. package/src/pages/[slug]/p.tsx +10 -4
  175. package/src/pages/account.tsx +20 -8
  176. package/src/pages/api/preview.ts +33 -11
  177. package/src/pages/checkout.tsx +21 -7
  178. package/src/pages/index.tsx +9 -23
  179. package/src/pages/login.tsx +14 -8
  180. package/src/pages/s.tsx +34 -35
  181. package/.next/server/chunks/1972.js +0 -1
  182. package/.next/server/chunks/350.js +0 -1
  183. package/.next/server/chunks/5070.js +0 -1
  184. package/.next/server/chunks/5771.js +0 -1
  185. package/.next/server/chunks/6153.js +0 -1
  186. package/.next/server/chunks/6604.js +0 -9
  187. package/.next/server/chunks/9646.js +0 -307
  188. package/.next/static/03UTa7YuWpYhZyEUa_cAu/_buildManifest.js +0 -1
  189. package/.next/static/chunks/135.e5b151734fa29f99.js +0 -1
  190. package/.next/static/chunks/153.70d524f369fef82b.js +0 -1
  191. package/.next/static/chunks/16.f4ecc14d79dc118b.js +0 -1
  192. package/.next/static/chunks/195.5f46b2d90f69ddfc.js +0 -1
  193. package/.next/static/chunks/202.2a784500752e6a56.js +0 -1
  194. package/.next/static/chunks/217.01bc0ad07edd6f1b.js +0 -1
  195. package/.next/static/chunks/343.d1c1e47ba6dfb4d9.js +0 -1
  196. package/.next/static/chunks/388.0b1a49b31ff12af9.js +0 -1
  197. package/.next/static/chunks/484.755bc4e4fb57ebb9.js +0 -1
  198. package/.next/static/chunks/523.fe333b7a44e82888.js +0 -1
  199. package/.next/static/chunks/568.50cb2fbb158c2a19.js +0 -1
  200. package/.next/static/chunks/617.0a2a7e39a7f3d4cc.js +0 -1
  201. package/.next/static/chunks/707-6818d9951a83f35f.js +0 -1
  202. package/.next/static/chunks/721-4610a9b937a1b5e9.js +0 -1
  203. package/.next/static/chunks/844.dd528a0bb7646dd6.js +0 -1
  204. package/.next/static/chunks/857.d2299cfe995af21d.js +0 -1
  205. package/.next/static/chunks/941-cee2b9776c3d2607.js +0 -33
  206. package/.next/static/chunks/973-d39dc88330d50aca.js +0 -1
  207. package/.next/static/chunks/ButtonSignIn.7c4c1355603b23bb.js +0 -1
  208. package/.next/static/chunks/CartItem.1b93d9b5f36a1120.js +0 -1
  209. package/.next/static/chunks/EmptyCart.a48b5bfb30ee09f0.js +0 -1
  210. package/.next/static/chunks/Gift.9a645d71d393dd98.js +0 -1
  211. package/.next/static/chunks/OrderSummary.637b2fff8f2574e1.js +0 -1
  212. package/.next/static/chunks/Toast.41ed93193046b5a5.js +0 -1
  213. package/.next/static/chunks/UIBannerText.4e11acdb3624808c.js +0 -1
  214. package/.next/static/chunks/UIToast.a17cb67e284572a7.js +0 -1
  215. package/.next/static/chunks/main-029f1328cfee9686.js +0 -1
  216. package/.next/static/chunks/pages/404-8428a5072b126db7.js +0 -1
  217. package/.next/static/chunks/pages/500-0f7529c8c8b90253.js +0 -1
  218. package/.next/static/chunks/pages/[...slug]-0db45ebf94081661.js +0 -1
  219. package/.next/static/chunks/pages/[slug]/p-1433a856605b917b.js +0 -1
  220. package/.next/static/chunks/pages/_app-cb1c3a94f987c5c8.js +0 -1
  221. package/.next/static/chunks/pages/_error-fbf331a03642b495.js +0 -1
  222. package/.next/static/chunks/pages/account-c0db07a5e90d1ee0.js +0 -1
  223. package/.next/static/chunks/pages/checkout-a751fc8e1dcb5285.js +0 -1
  224. package/.next/static/chunks/pages/index-a4ffe552b1b4a4a6.js +0 -1
  225. package/.next/static/chunks/pages/login-93bbc8089da5ce4a.js +0 -1
  226. package/.next/static/chunks/pages/s-7ad120ac3e73cbea.js +0 -1
  227. package/.next/static/chunks/webpack-ab89187244c136e9.js +0 -1
  228. package/.next/static/css/16d438c29387e6ad.css +0 -1
  229. package/.next/static/css/1ad39dcb52269ada.css +0 -1
  230. package/.next/static/css/9b6bba2472d272ec.css +0 -1
  231. package/.next/static/css/e8d8f9a77767c4b3.css +0 -1
  232. /package/.next/static/{03UTa7YuWpYhZyEUa_cAu → SfomoT7cCMNxtcr8yWFzF}/_ssgManifest.js +0 -0
@@ -46,32 +46,32 @@ Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Cont
46
46
  Collecting build traces ...
47
47
 
48
48
  Route (pages) Size First Load JS
49
- ┌ ● / 1.23 kB 139 kB
50
- ├ └ css/197e314c5a03eabd.css 740 B
51
- ├ /_app 0 B 91 kB
52
- ├ ● /[...slug] 2.79 kB 153 kB
53
- css/e47f1a002bdcf76f.css 2.38 kB
54
- /[slug]/p 12.3 kB 150 kB
55
- ├ └ css/9b6bba2472d272ec.css 10.5 kB
56
- ├ ○ /404 1.45 kB 122 kB
57
- ├ ● /500 1.45 kB 122 kB
58
- ├ ● /account 678 B 121 kB
59
- ├ λ /api/graphql 0 B 91 kB
60
- ├ λ /api/health/live 0 B 91 kB
61
- ├ λ /api/health/ready 0 B 91 kB
62
- ├ λ /api/preview 0 B 91 kB
63
- ├ ● /checkout 660 B 121 kB
64
- ├ ● /login 1.56 kB 122 kB
65
- └ ● /s 2.23 kB 152 kB
66
- + First Load JS shared by all 94.1 kB
67
- ├ chunks/framework-8e279965036b6169.js 45.4 kB
68
- ├ chunks/main-029f1328cfee9686.js 33.1 kB
69
- ├ chunks/pages/_app-cb1c3a94f987c5c8.js 9.87 kB
70
- ├ chunks/webpack-ab89187244c136e9.js 2.74 kB
49
+ ┌ ● / 3.2 kB 121 kB
50
+ ├ └ css/b1806cbafd0c1f81.css 3.06 kB
51
+ ├ /_app 0 B 91.7 kB
52
+ ├ ● /[...slug] 2 kB 137 kB
53
+ /[slug]/p 30.2 kB 148 kB
54
+ css/bd9313ce4313a00a.css 11.1 kB
55
+ ├ └ css/9718991cd57978e9.css 14.8 kB
56
+ ├ ○ /404 1.46 kB 120 kB
57
+ ├ ● /500 1.46 kB 120 kB
58
+ ├ ● /account 712 B 119 kB
59
+ ├ λ /api/graphql 0 B 91.7 kB
60
+ ├ λ /api/health/live 0 B 91.7 kB
61
+ ├ λ /api/health/ready 0 B 91.7 kB
62
+ ├ λ /api/preview 0 B 91.7 kB
63
+ ├ ● /checkout 694 B 119 kB
64
+ ├ ● /login 1.57 kB 120 kB
65
+ └ ● /s 2.44 kB 137 kB
66
+ + First Load JS shared by all 94.7 kB
67
+ ├ chunks/framework-12a146e94cfcf7c4.js 45.4 kB
68
+ ├ chunks/main-209ac4974b020af1.js 33.1 kB
69
+ ├ chunks/pages/_app-e419b2062065ccf0.js 9.87 kB
70
+ ├ chunks/webpack-909c48392196dcdf.js 3.36 kB
71
71
  └ css/ee0556daedda6306.css 3.07 kB
72
72
 
73
73
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
74
74
  ○ (Static) automatically rendered as static HTML (uses no initial props)
75
75
  ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
76
76
 
77
- Done in 71.36s.
77
+ Done in 72.68s.
@@ -1,4 +1,4 @@
1
1
  yarn run v1.22.22
2
2
  $ next lint
3
3
  ✔ No ESLint warnings or errors
4
- Done in 6.03s.
4
+ Done in 5.97s.
@@ -1,12 +1,12 @@
1
1
  yarn run v1.22.22
2
2
  $ jest
3
- PASS test/utils/multipleTemplates.test.ts (34.286 s)
4
- PASS test/server/cms/index.test.ts (34.42 s)
5
- PASS test/server/index.test.ts (38.295 s)
3
+ PASS test/server/cms/index.test.ts (34.73 s)
4
+ PASS test/utils/multipleTemplates.test.ts (35.126 s)
5
+ PASS test/server/index.test.ts (38.729 s)
6
6
 
7
7
  Test Suites: 3 passed, 3 total
8
8
  Tests: 19 passed, 19 total
9
9
  Snapshots: 0 total
10
- Time: 39.241 s
10
+ Time: 39.901 s
11
11
  Ran all test suites.
12
- Done in 40.61s.
12
+ Done in 41.34s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.0.152",
3
+ "version": "3.0.154",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -128,5 +128,5 @@
128
128
  "node": "18.19.0",
129
129
  "yarn": "1.19.1"
130
130
  },
131
- "gitHead": "98f762825022beee952d25f893b012f35f335cb0"
131
+ "gitHead": "1a368785a4a5b20300f346bfad13435a2395b6f8"
132
132
  }
@@ -1,50 +1,13 @@
1
1
  import { Locator, Section } from '@vtex/client-cms'
2
2
  import storeConfig from 'discovery.config'
3
- import type { ComponentType } from 'react'
4
- import { PropsWithChildren } from 'react'
5
- import CUSTOM_COMPONENTS from 'src/customizations/src/components'
6
3
  import { PageContentType, getPage } from 'src/server/cms'
7
4
 
8
- import RenderSections from './RenderSections'
9
-
10
- import { OverriddenDefaultAlert as Alert } from 'src/components/sections/Alert/OverriddenDefaultAlert'
11
- import Footer from 'src/components/sections/Footer'
12
- import { OverriddenDefaultNavbar as Navbar } from 'src/components/sections/Navbar/OverriddenDefaultNavbar'
13
- import { OverriddenDefaultRegionBar as RegionBar } from 'src/components/sections/RegionBar/OverriddenDefaultRegionBar'
14
-
15
- import CartSidebar from 'src/components/cart/CartSidebar'
16
- import RegionModal from 'src/components/region/RegionModal'
17
-
18
5
  export const GLOBAL_SECTIONS_CONTENT_TYPE = 'globalSections'
19
6
 
20
7
  export type GlobalSectionsData = {
21
8
  sections: Section[]
22
9
  }
23
10
 
24
- /* A list of components that can be used in the CMS. */
25
- const COMPONENTS: Record<string, ComponentType<any>> = {
26
- Alert,
27
- Navbar,
28
- RegionBar,
29
- RegionModal,
30
- CartSidebar,
31
- Footer,
32
- ...CUSTOM_COMPONENTS,
33
- }
34
-
35
- function GlobalSections({
36
- children,
37
- ...otherProps
38
- }: PropsWithChildren<GlobalSectionsData>) {
39
- return (
40
- <RenderSections components={COMPONENTS} {...otherProps}>
41
- <main>{children}</main>
42
- </RenderSections>
43
- )
44
- }
45
-
46
- export default GlobalSections
47
-
48
11
  export const getGlobalSectionsData = async (
49
12
  previewData: Locator
50
13
  ): Promise<GlobalSectionsData> => {
@@ -10,12 +10,14 @@ import { Section } from '@vtex/client-cms'
10
10
  import dynamic from 'next/dynamic'
11
11
  import SectionBoundary from './SectionBoundary'
12
12
  import ViewportObserver from './ViewportObserver'
13
+ import COMPONENTS from './global/Components'
13
14
 
14
15
  import { useUI } from '@faststore/ui'
15
16
 
16
17
  interface Props {
17
- components: Record<string, ComponentType<any>>
18
- sections: Array<{ name: string; data: any }>
18
+ components?: Record<string, ComponentType<any>>
19
+ globalSections?: Array<{ name: string; data: any }>
20
+ sections?: Array<{ name: string; data: any }>
19
21
  }
20
22
 
21
23
  const SECTIONS_OUT_OF_VIEWPORT = ['CartSidebar', 'RegionModal']
@@ -45,7 +47,6 @@ const useDividedSections = (sections: Section[]) => {
45
47
  * 2. Checking the UI context for Sections that are not in the viewport, such as the CartSidebar and RegionModal.
46
48
  *
47
49
  * @param sectionName
48
- * @returns
49
50
  */
50
51
  export const LazyLoadingSection = ({
51
52
  sectionName,
@@ -60,11 +61,8 @@ export const LazyLoadingSection = ({
60
61
  const shouldLoad =
61
62
  (sectionName === 'CartSidebar' && displayCart) ||
62
63
  (sectionName === 'RegionModal' && displayModal)
63
- if (!shouldLoad) {
64
- return null
65
- }
66
64
 
67
- return children
65
+ return shouldLoad ? <>{children}</> : null
68
66
  }
69
67
  return (
70
68
  <ViewportObserver sectionName={sectionName}>{children}</ViewportObserver>
@@ -74,7 +72,7 @@ export const LazyLoadingSection = ({
74
72
  const RenderSectionsBase = ({ sections = [], components }: Props) => {
75
73
  return (
76
74
  <>
77
- {sections.map(({ name, data }, index) => {
75
+ {sections.map(({ name, data = {} }, index) => {
78
76
  const Component = components[name]
79
77
 
80
78
  if (!Component) {
@@ -88,7 +86,9 @@ const RenderSectionsBase = ({ sections = [], components }: Props) => {
88
86
 
89
87
  return (
90
88
  <SectionBoundary key={`cms-section-${name}-${index}`} name={name}>
91
- <Component {...data} />
89
+ <LazyLoadingSection sectionName={name}>
90
+ <Component {...data} />
91
+ </LazyLoadingSection>
92
92
  </SectionBoundary>
93
93
  )
94
94
  })}
@@ -98,21 +98,29 @@ const RenderSectionsBase = ({ sections = [], components }: Props) => {
98
98
 
99
99
  function RenderSections({
100
100
  children,
101
+ globalSections,
101
102
  sections,
102
- ...otherProps
103
+ components = COMPONENTS,
103
104
  }: PropsWithChildren<Props>) {
104
- const { hasChildren, firstSections, lastSections } =
105
- useDividedSections(sections)
105
+ const { firstSections, lastSections } = useDividedSections(
106
+ globalSections ?? sections
107
+ )
106
108
 
107
109
  return (
108
110
  <>
109
- <RenderSectionsBase sections={firstSections} {...otherProps} />
110
-
111
- <Toast />
111
+ {firstSections && (
112
+ <RenderSectionsBase sections={firstSections} components={components} />
113
+ )}
114
+ {sections && sections.length > 0 && (
115
+ <RenderSectionsBase sections={sections} components={components} />
116
+ )}
112
117
  {children}
118
+ <LazyLoadingSection sectionName="Toast">
119
+ <Toast />
120
+ </LazyLoadingSection>
113
121
 
114
- {hasChildren && (
115
- <RenderSectionsBase sections={lastSections} {...otherProps} />
122
+ {lastSections && (
123
+ <RenderSectionsBase sections={lastSections} components={components} />
116
124
  )}
117
125
  </>
118
126
  )
@@ -11,21 +11,21 @@ const BannerText = dynamic(
11
11
  () =>
12
12
  import(
13
13
  /* webpackChunkName: "BannerText" */ 'src/components/sections/BannerText/OverriddenDefaultBannerText'
14
- ).then((mod) => ({ default: mod.OverriddenDefaultBannerText })),
14
+ ).then((mod) => mod.OverriddenDefaultBannerText),
15
15
  { ssr: false }
16
16
  )
17
17
  const Newsletter = dynamic(
18
18
  () =>
19
19
  import(
20
20
  /* webpackChunkName: "Newsletter" */ 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
21
- ).then((mod) => ({ default: mod.OverriddenDefaultNewsletter })),
21
+ ).then((mod) => mod.OverriddenDefaultNewsletter),
22
22
  { ssr: false }
23
23
  )
24
24
  const ProductShelf = dynamic(
25
25
  () =>
26
26
  import(
27
27
  /* webpackChunkName: "ProductShelf" */ 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
28
- ).then((mod) => ({ default: mod.OverriddenDefaultProductShelf })),
28
+ ).then((mod) => mod.OverriddenDefaultProductShelf),
29
29
  { ssr: false }
30
30
  )
31
31
  const ProductTiles = dynamic(
@@ -36,6 +36,10 @@ const ProductTiles = dynamic(
36
36
  { ssr: false }
37
37
  )
38
38
 
39
+ /**
40
+ * Sections: Components imported from each store's custom components and '../components/sections' only.
41
+ * Do not import or render components from any other folder in here.
42
+ */
39
43
  const COMPONENTS: Record<string, ComponentType<any>> = {
40
44
  ...GLOBAL_COMPONENTS,
41
45
  Hero,
@@ -0,0 +1,59 @@
1
+ import dynamic from 'next/dynamic'
2
+ import { ComponentType } from 'react'
3
+
4
+ import { OverriddenDefaultBreadcrumb as Breadcrumb } from 'src/components/sections/Breadcrumb/OverriddenDefaultBreadcrumb'
5
+ import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
6
+ import { OverriddenDefaultProductGallery as ProductGallery } from 'src/components/sections/ProductGallery/OverriddenDefaultProductGallery'
7
+ import CUSTOM_COMPONENTS from 'src/customizations/src/components'
8
+ import { default as GLOBAL_COMPONENTS } from '../global/Components'
9
+
10
+ const BannerText = dynamic(
11
+ () =>
12
+ import(
13
+ /* webpackChunkName: "BannerText" */
14
+ 'src/components/sections/BannerText/OverriddenDefaultBannerText'
15
+ ).then((mod) => mod.OverriddenDefaultBannerText),
16
+ { ssr: false }
17
+ )
18
+ const Newsletter = dynamic(
19
+ () =>
20
+ import(
21
+ /* webpackChunkName: "Newsletter" */
22
+ 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
23
+ ).then((mod) => mod.OverriddenDefaultNewsletter),
24
+ { ssr: false }
25
+ )
26
+ const ProductShelf = dynamic(
27
+ () =>
28
+ import(
29
+ /* webpackChunkName: "ProductShelf" */
30
+ 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
31
+ ).then((mod) => mod.OverriddenDefaultProductShelf),
32
+ { ssr: false }
33
+ )
34
+ const ProductTiles = dynamic(
35
+ () =>
36
+ import(
37
+ /* webpackChunkName: "ProductTiles" */
38
+ 'src/components/sections/ProductTiles'
39
+ ),
40
+ { ssr: false }
41
+ )
42
+
43
+ /**
44
+ * Sections: Components imported from each store's custom components and '../components/sections' only.
45
+ * Do not import or render components from any other folder in here.
46
+ */
47
+ const COMPONENTS: Record<string, ComponentType<any>> = {
48
+ ...GLOBAL_COMPONENTS,
49
+ Breadcrumb,
50
+ Hero,
51
+ ProductGallery,
52
+ BannerText,
53
+ Newsletter,
54
+ ProductShelf,
55
+ ProductTiles,
56
+ ...CUSTOM_COMPONENTS,
57
+ }
58
+
59
+ export default COMPONENTS
@@ -0,0 +1,68 @@
1
+ import dynamic from 'next/dynamic'
2
+ import { ComponentType } from 'react'
3
+
4
+ import { OverriddenDefaultBreadcrumb as Breadcrumb } from 'src/components/sections/Breadcrumb/OverriddenDefaultBreadcrumb'
5
+ import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
6
+ import { OverriddenDefaultProductGallery as ProductGallery } from 'src/components/sections/ProductGallery/OverriddenDefaultProductGallery'
7
+ import CUSTOM_COMPONENTS from 'src/customizations/src/components'
8
+ import { default as GLOBAL_COMPONENTS } from '../global/Components'
9
+
10
+ const BannerText = dynamic(
11
+ () =>
12
+ import(
13
+ /* webpackChunkName: "BannerText" */
14
+ 'src/components/sections/BannerText/OverriddenDefaultBannerText'
15
+ ).then((mod) => mod.OverriddenDefaultBannerText),
16
+ { ssr: false }
17
+ )
18
+ const BannerNewsletter = dynamic(
19
+ () =>
20
+ import(
21
+ /* webpackChunkName: "BannerNewsletter" */
22
+ 'src/components/sections/BannerNewsletter/BannerNewsletter'
23
+ ),
24
+ { ssr: false }
25
+ )
26
+ const Newsletter = dynamic(
27
+ () =>
28
+ import(
29
+ /* webpackChunkName: "Newsletter" */
30
+ 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
31
+ ).then((mod) => mod.OverriddenDefaultNewsletter),
32
+ { ssr: false }
33
+ )
34
+ const ProductShelf = dynamic(
35
+ () =>
36
+ import(
37
+ /* webpackChunkName: "ProductShelf" */
38
+ 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
39
+ ).then((mod) => mod.OverriddenDefaultProductShelf),
40
+ { ssr: false }
41
+ )
42
+ const ProductTiles = dynamic(
43
+ () =>
44
+ import(
45
+ /* webpackChunkName: "ProductTiles" */
46
+ 'src/components/sections/ProductTiles'
47
+ ),
48
+ { ssr: false }
49
+ )
50
+
51
+ /**
52
+ * Sections: Components imported from each store's custom components and '../components/sections' only.
53
+ * Do not import or render components from any other folder in here.
54
+ */
55
+ const COMPONENTS: Record<string, ComponentType<any>> = {
56
+ ...GLOBAL_COMPONENTS,
57
+ Breadcrumb,
58
+ Hero,
59
+ ProductGallery,
60
+ BannerText,
61
+ BannerNewsletter,
62
+ Newsletter,
63
+ ProductShelf,
64
+ ProductTiles,
65
+ ...CUSTOM_COMPONENTS,
66
+ }
67
+
68
+ export default COMPONENTS
@@ -1,6 +1,20 @@
1
- import { ProductShelf as UIProductShelf } from '@faststore/ui'
2
- import ProductCard from 'src/components/product/ProductCard'
3
- import Carousel from 'src/components/ui/Carousel'
1
+ import dynamic from 'next/dynamic'
2
+ const UIProductShelf = dynamic(() =>
3
+ /* webpackChunkName: "UIProductShelf" */
4
+ import('@faststore/ui').then((mod) => mod.ProductShelf)
5
+ )
6
+
7
+ const Carousel = dynamic(
8
+ () =>
9
+ /* webpackChunkName: "Carousel" */
10
+ import('src/components/ui/Carousel')
11
+ )
12
+
13
+ const ProductCard = dynamic(
14
+ () =>
15
+ /* webpackChunkName: "ProductCard" */
16
+ import('src/components/product/ProductCard')
17
+ )
4
18
 
5
19
  export const ProductShelfDefaultComponents = {
6
20
  ProductShelf: UIProductShelf,
@@ -12,6 +12,7 @@ import { OverriddenDefaultNewsletter as Newsletter } from 'src/components/sectio
12
12
  import { OverriddenDefaultProductShelf as ProductShelf } from 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
13
13
  import ProductTiles from 'src/components/sections/ProductTiles'
14
14
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
15
+ import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
15
16
  import MissingContentError from 'src/sdk/error/MissingContentError/MissingContentError'
16
17
  import PageProvider from 'src/sdk/overrides/PageProvider'
17
18
  import type { PageContentType } from 'src/server/cms'
@@ -21,6 +22,7 @@ import storeConfig from 'discovery.config'
21
22
 
22
23
  /* A list of components that can be used in the CMS. */
23
24
  const COMPONENTS: Record<string, ComponentType<any>> = {
25
+ ...GLOBAL_COMPONENTS,
24
26
  Hero,
25
27
  BannerText,
26
28
  BannerNewsletter,
@@ -36,12 +38,14 @@ export type LandingPageProps = {
36
38
  page: PageContentType
37
39
  slug?: string
38
40
  serverData?: unknown
41
+ globalSections?: Array<{ name: string; data: any }>
39
42
  }
40
43
 
41
44
  export default function LandingPage({
42
45
  page: { sections, settings },
43
46
  slug,
44
47
  serverData,
48
+ globalSections,
45
49
  }: LandingPageProps) {
46
50
  const context = {
47
51
  data: serverData,
@@ -87,7 +91,11 @@ export default function LandingPage({
87
91
  (not the HTML tag) before rendering it here.
88
92
  */}
89
93
  <PageProvider context={context}>
90
- <RenderSections sections={sections} components={COMPONENTS} />
94
+ <RenderSections
95
+ sections={sections}
96
+ globalSections={globalSections}
97
+ components={COMPONENTS}
98
+ />
91
99
  </PageProvider>
92
100
  </>
93
101
  )
@@ -1,20 +1,14 @@
1
1
  import { useSearch } from '@faststore/sdk'
2
2
  import type { ServerCollectionPageQueryQuery } from '@generated/graphql'
3
3
  import deepmerge from 'deepmerge'
4
- import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNewsletter'
5
- import { OverriddenDefaultBannerText as BannerText } from 'src/components/sections/BannerText/OverriddenDefaultBannerText'
6
- import { OverriddenDefaultBreadcrumb as Breadcrumb } from 'src/components/sections/Breadcrumb/OverriddenDefaultBreadcrumb'
7
- import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
8
- import { OverriddenDefaultNewsletter as Newsletter } from 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
9
- import { OverriddenDefaultProductGallery as ProductGallery } from 'src/components/sections/ProductGallery/OverriddenDefaultProductGallery'
10
- import { OverriddenDefaultProductShelf as ProductShelf } from 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
11
- import ProductTiles from 'src/components/sections/ProductTiles'
12
- import ScrollToTopButton from 'src/components/sections/ScrollToTopButton'
13
4
  import { ITEMS_PER_PAGE } from 'src/constants'
14
5
 
15
- import type { ComponentType } from 'react'
16
- import RenderSections from 'src/components/cms/RenderSections'
17
- import CUSTOM_COMPONENTS from 'src/customizations/src/components'
6
+ import dynamic from 'next/dynamic'
7
+ import COMPONENTS from 'src/components/cms/plp/Components'
8
+
9
+ import RenderSections, {
10
+ LazyLoadingSection,
11
+ } from 'src/components/cms/RenderSections'
18
12
  import { PLPContentType } from 'src/server/cms/plp'
19
13
 
20
14
  import PageProvider, { PLPContext } from 'src/sdk/overrides/PageProvider'
@@ -24,25 +18,18 @@ import {
24
18
  } from 'src/sdk/product/usePageProductsQuery'
25
19
  import { useProductGalleryQuery } from 'src/sdk/product/useProductGalleryQuery'
26
20
 
21
+ const ScrollToTopButton = dynamic(
22
+ () =>
23
+ import(
24
+ /* webpackChunkName: "ScrollToTopButton" */
25
+ 'src/components/sections/ScrollToTopButton'
26
+ )
27
+ )
28
+
27
29
  export type ProductListingPageProps = {
28
30
  data: ServerCollectionPageQueryQuery
29
31
  page: PLPContentType
30
- }
31
-
32
- /**
33
- * Sections: Components imported from each store's custom components and '../components/sections' only.
34
- * Do not import or render components from any other folder in here.
35
- */
36
- const COMPONENTS: Record<string, ComponentType<any>> = {
37
- Breadcrumb,
38
- BannerText,
39
- BannerNewsletter,
40
- Hero,
41
- Newsletter,
42
- ProductGallery,
43
- ProductShelf,
44
- ProductTiles,
45
- ...CUSTOM_COMPONENTS,
32
+ globalSections?: Array<{ name: string; data: any }>
46
33
  }
47
34
 
48
35
  // Array merging strategy from deepmerge that makes client arrays overwrite server array
@@ -52,6 +39,7 @@ const overwriteMerge = (_: any[], sourceArray: any[]) => sourceArray
52
39
  export default function ProductListing({
53
40
  page: { sections, settings },
54
41
  data: server,
42
+ globalSections,
55
43
  }: ProductListingPageProps) {
56
44
  const {
57
45
  state: { sort, term, selectedFacets },
@@ -93,11 +81,17 @@ export default function ProductListing({
93
81
  */}
94
82
  <PageProvider context={context}>
95
83
  <UseGalleryPageContext.Provider value={useGalleryPage}>
96
- <RenderSections sections={sections} components={COMPONENTS} />
84
+ <RenderSections
85
+ sections={sections}
86
+ globalSections={globalSections}
87
+ components={COMPONENTS}
88
+ >
89
+ <LazyLoadingSection sectionName="ScrollToTopButton">
90
+ <ScrollToTopButton />
91
+ </LazyLoadingSection>
92
+ </RenderSections>
97
93
  </UseGalleryPageContext.Provider>
98
94
  </PageProvider>
99
-
100
- <ScrollToTopButton />
101
95
  </>
102
96
  )
103
97
  }
@@ -20,6 +20,7 @@ import ProductListing from './ProductListing'
20
20
  export type ProductListingPageProps = {
21
21
  data: ServerCollectionPageQueryQuery
22
22
  page: PLPContentType
23
+ globalSections?: Array<{ name: string; data: any }>
23
24
  }
24
25
 
25
26
  type UseSearchParams = {
@@ -56,6 +57,7 @@ const useSearchParams = ({
56
57
  export default function ProductListingPage({
57
58
  page: plpContentType,
58
59
  data: server,
60
+ globalSections,
59
61
  }: ProductListingPageProps) {
60
62
  const { settings } = plpContentType
61
63
  const collection = server.collection
@@ -94,7 +96,11 @@ export default function ProductListingPage({
94
96
  itemListElements={collection?.breadcrumbList.itemListElement ?? []}
95
97
  />
96
98
 
97
- <ProductListing page={plpContentType} data={server} />
99
+ <ProductListing
100
+ globalSections={globalSections}
101
+ page={plpContentType}
102
+ data={server}
103
+ />
98
104
  </SearchProvider>
99
105
  )
100
106
  }
@@ -1,15 +1,6 @@
1
- import type { ComponentType } from 'react'
2
-
1
+ import type { ClientProductGalleryQueryQuery as ClientProductGalleryQuery } from '@generated/graphql'
3
2
  import RenderSections from 'src/components/cms/RenderSections'
4
- import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNewsletter'
5
- import { OverriddenDefaultBannerText as BannerText } from 'src/components/sections/BannerText/OverriddenDefaultBannerText'
6
- import { OverriddenDefaultBreadcrumb as Breadcrumb } from 'src/components/sections/Breadcrumb/OverriddenDefaultBreadcrumb'
7
- import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
8
- import { OverriddenDefaultNewsletter as Newsletter } from 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
9
- import { OverriddenDefaultProductGallery as ProductGallery } from 'src/components/sections/ProductGallery/OverriddenDefaultProductGallery'
10
- import { OverriddenDefaultProductShelf as ProductShelf } from 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
11
- import ProductTiles from 'src/components/sections/ProductTiles'
12
- import CUSTOM_COMPONENTS from 'src/customizations/src/components'
3
+ import COMPONENTS from 'src/components/cms/search/Components'
13
4
  import { SearchPageContextType } from 'src/pages/s'
14
5
  import PageProvider, { SearchPageContext } from 'src/sdk/overrides/PageProvider'
15
6
  import {
@@ -17,30 +8,18 @@ import {
17
8
  UseGalleryPageContext,
18
9
  } from 'src/sdk/product/usePageProductsQuery'
19
10
  import { SearchContentType } from 'src/server/cms'
20
- import type { ClientProductGalleryQueryQuery as ClientProductGalleryQuery } from '@generated/graphql'
21
-
22
- /**
23
- * Sections: Components imported from each store's custom components and '../components/sections' only.
24
- * Do not import or render components from any other folder in here.
25
- */
26
- const COMPONENTS: Record<string, ComponentType<any>> = {
27
- Breadcrumb,
28
- BannerText,
29
- BannerNewsletter,
30
- Newsletter,
31
- Hero,
32
- ProductGallery,
33
- ProductShelf,
34
- ProductTiles,
35
- ...CUSTOM_COMPONENTS,
36
- }
37
11
 
38
12
  export type SearchPageProps = {
39
13
  data: SearchPageContextType & ClientProductGalleryQuery
40
14
  page: SearchContentType
15
+ globalSections?: Array<{ name: string; data: any }>
41
16
  }
42
17
 
43
- function SearchPage({ page: { sections }, data: serverData }: SearchPageProps) {
18
+ function SearchPage({
19
+ page: { sections },
20
+ data: serverData,
21
+ globalSections,
22
+ }: SearchPageProps) {
44
23
  const { pages, useGalleryPage } = useCreateUseGalleryPage()
45
24
 
46
25
  const context = {
@@ -65,7 +44,11 @@ function SearchPage({ page: { sections }, data: serverData }: SearchPageProps) {
65
44
  */}
66
45
  <PageProvider context={context}>
67
46
  <UseGalleryPageContext.Provider value={useGalleryPage}>
68
- <RenderSections sections={sections} components={COMPONENTS} />
47
+ <RenderSections
48
+ sections={sections}
49
+ globalSections={globalSections}
50
+ components={COMPONENTS}
51
+ />
69
52
  </UseGalleryPageContext.Provider>
70
53
  </PageProvider>
71
54
  </>