@faststore/core 2.0.166-alpha.0 → 2.0.169-alpha.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 (191) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/CHANGELOG.md +12 -0
  3. package/cms/faststore/sections.json +131 -0
  4. package/next.config.js +3 -0
  5. package/package.json +4 -4
  6. package/src/Layout.tsx +1 -18
  7. package/src/components/cart/CartSidebar/section.module.scss +0 -3
  8. package/src/components/cms/GlobalSections.tsx +6 -5
  9. package/src/components/common/Alert/section.module.scss +0 -3
  10. package/src/components/common/Toast/section.module.scss +0 -3
  11. package/src/components/region/RegionBar/RegionBar.tsx +35 -3
  12. package/src/components/region/RegionModal/RegionModal.tsx +81 -19
  13. package/src/components/region/RegionModal/section.module.scss +0 -3
  14. package/src/components/search/Filter/section.module.scss +0 -3
  15. package/src/components/sections/BannerNewsletter/section.module.scss +0 -3
  16. package/src/components/sections/BannerText/section.module.scss +0 -3
  17. package/src/components/sections/Breadcrumb/section.module.scss +0 -3
  18. package/src/components/sections/EmptyState/section.module.scss +0 -3
  19. package/src/components/sections/Footer/section.module.scss +0 -3
  20. package/src/components/sections/Hero/section.module.scss +0 -3
  21. package/src/components/sections/Incentives/section.module.scss +0 -3
  22. package/src/components/sections/Navbar/section.module.scss +0 -3
  23. package/src/components/sections/Newsletter/section.module.scss +0 -3
  24. package/src/components/sections/ProductDetails/section.module.scss +0 -3
  25. package/src/components/sections/ProductGallery/section.module.scss +0 -3
  26. package/src/components/sections/ProductShelf/section.module.scss +0 -3
  27. package/src/components/sections/ProductTiles/section.module.scss +0 -3
  28. package/src/components/sections/RegionBar/RegionBar.tsx +41 -0
  29. package/src/components/{common → sections}/RegionBar/section.module.scss +0 -3
  30. package/src/components/sections/ScrollToTopButton/section.module.scss +0 -3
  31. package/src/components/sections/Section/section.scss +0 -2
  32. package/src/styles/themes/custom-theme.scss +0 -2
  33. package/src/styles/themes/midnight.scss +0 -2
  34. package/src/styles/themes/soft-blue.scss +0 -2
  35. package/stylelint.config.js +1 -1
  36. package/.next/BUILD_ID +0 -1
  37. package/.next/build-manifest.json +0 -123
  38. package/.next/cache/.tsbuildinfo +0 -1
  39. package/.next/cache/config.json +0 -7
  40. package/.next/cache/eslint/.cache_1gneedd +0 -1
  41. package/.next/cache/next-server.js.nft.json +0 -1
  42. package/.next/cache/webpack/client-production/0.pack +0 -0
  43. package/.next/cache/webpack/client-production/index.pack +0 -0
  44. package/.next/cache/webpack/server-production/0.pack +0 -0
  45. package/.next/cache/webpack/server-production/index.pack +0 -0
  46. package/.next/export-marker.json +0 -1
  47. package/.next/images-manifest.json +0 -1
  48. package/.next/next-server.js.nft.json +0 -1
  49. package/.next/package.json +0 -1
  50. package/.next/prerender-manifest.json +0 -1
  51. package/.next/react-loadable-manifest.json +0 -45
  52. package/.next/required-server-files.json +0 -1
  53. package/.next/routes-manifest.json +0 -1
  54. package/.next/server/chunks/123.js +0 -58
  55. package/.next/server/chunks/143.js +0 -106
  56. package/.next/server/chunks/183.js +0 -90
  57. package/.next/server/chunks/205.js +0 -692
  58. package/.next/server/chunks/247.js +0 -61
  59. package/.next/server/chunks/280.js +0 -324
  60. package/.next/server/chunks/287.js +0 -58
  61. package/.next/server/chunks/289.js +0 -229
  62. package/.next/server/chunks/312.js +0 -697
  63. package/.next/server/chunks/336.js +0 -821
  64. package/.next/server/chunks/350.js +0 -143
  65. package/.next/server/chunks/368.js +0 -253
  66. package/.next/server/chunks/487.js +0 -9142
  67. package/.next/server/chunks/502.js +0 -626
  68. package/.next/server/chunks/576.js +0 -90
  69. package/.next/server/chunks/597.js +0 -169
  70. package/.next/server/chunks/650.js +0 -9142
  71. package/.next/server/chunks/676.js +0 -32
  72. package/.next/server/chunks/701.js +0 -87
  73. package/.next/server/chunks/74.js +0 -2951
  74. package/.next/server/chunks/82.js +0 -371
  75. package/.next/server/chunks/825.js +0 -4039
  76. package/.next/server/chunks/854.js +0 -72
  77. package/.next/server/chunks/859.js +0 -959
  78. package/.next/server/chunks/874.js +0 -487
  79. package/.next/server/chunks/886.js +0 -120
  80. package/.next/server/chunks/907.js +0 -1803
  81. package/.next/server/chunks/970.js +0 -200
  82. package/.next/server/chunks/98.js +0 -124
  83. package/.next/server/chunks/font-manifest.json +0 -1
  84. package/.next/server/font-manifest.json +0 -1
  85. package/.next/server/middleware-build-manifest.js +0 -1
  86. package/.next/server/middleware-manifest.json +0 -6
  87. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  88. package/.next/server/pages/404.js +0 -393
  89. package/.next/server/pages/404.js.nft.json +0 -1
  90. package/.next/server/pages/500.js +0 -395
  91. package/.next/server/pages/500.js.nft.json +0 -1
  92. package/.next/server/pages/[...slug].js +0 -786
  93. package/.next/server/pages/[...slug].js.nft.json +0 -1
  94. package/.next/server/pages/[slug]/p.js +0 -2532
  95. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  96. package/.next/server/pages/_app.js +0 -323
  97. package/.next/server/pages/_app.js.nft.json +0 -1
  98. package/.next/server/pages/_document.js +0 -304
  99. package/.next/server/pages/_document.js.nft.json +0 -1
  100. package/.next/server/pages/_error.js +0 -164
  101. package/.next/server/pages/_error.js.nft.json +0 -1
  102. package/.next/server/pages/account.js +0 -370
  103. package/.next/server/pages/account.js.nft.json +0 -1
  104. package/.next/server/pages/api/graphql.js +0 -365
  105. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  106. package/.next/server/pages/api/preview.js +0 -119
  107. package/.next/server/pages/api/preview.js.nft.json +0 -1
  108. package/.next/server/pages/checkout.js +0 -370
  109. package/.next/server/pages/checkout.js.nft.json +0 -1
  110. package/.next/server/pages/en-US/404.html +0 -81
  111. package/.next/server/pages/en-US/404.json +0 -1
  112. package/.next/server/pages/en-US/500.html +0 -81
  113. package/.next/server/pages/en-US/500.json +0 -1
  114. package/.next/server/pages/en-US/account.html +0 -81
  115. package/.next/server/pages/en-US/account.json +0 -1
  116. package/.next/server/pages/en-US/checkout.html +0 -81
  117. package/.next/server/pages/en-US/checkout.json +0 -1
  118. package/.next/server/pages/en-US/login.html +0 -81
  119. package/.next/server/pages/en-US/login.json +0 -1
  120. package/.next/server/pages/en-US/s.html +0 -81
  121. package/.next/server/pages/en-US/s.json +0 -1
  122. package/.next/server/pages/en-US.html +0 -81
  123. package/.next/server/pages/en-US.json +0 -1
  124. package/.next/server/pages/index.js +0 -966
  125. package/.next/server/pages/index.js.nft.json +0 -1
  126. package/.next/server/pages/login.js +0 -375
  127. package/.next/server/pages/login.js.nft.json +0 -1
  128. package/.next/server/pages/s.js +0 -473
  129. package/.next/server/pages/s.js.nft.json +0 -1
  130. package/.next/server/pages-manifest.json +0 -16
  131. package/.next/server/webpack-api-runtime.js +0 -229
  132. package/.next/server/webpack-runtime.js +0 -229
  133. package/.next/static/V9ehyEgCMbu0LEDWsRhj5/_buildManifest.js +0 -1
  134. package/.next/static/V9ehyEgCMbu0LEDWsRhj5/_ssgManifest.js +0 -1
  135. package/.next/static/chunks/0-82274e07cb857231.js +0 -1
  136. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  137. package/.next/static/chunks/226.b57e10ad9932f88c.js +0 -1
  138. package/.next/static/chunks/240-8e66b2892f9d8c40.js +0 -1
  139. package/.next/static/chunks/377-a2ea7cc68eb5f626.js +0 -1
  140. package/.next/static/chunks/460-910c8076569320d3.js +0 -1
  141. package/.next/static/chunks/495.0ecd099878b2a36d.js +0 -1
  142. package/.next/static/chunks/502.ec90d1859d393d34.js +0 -1
  143. package/.next/static/chunks/597.331d43f9ddefb6ad.js +0 -1
  144. package/.next/static/chunks/64.ebbe1d2b40f980c7.js +0 -1
  145. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  146. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  147. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  148. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  149. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  150. package/.next/static/chunks/pages/404-51ec6bdbfb779d04.js +0 -1
  151. package/.next/static/chunks/pages/500-2326a336f08c29f7.js +0 -1
  152. package/.next/static/chunks/pages/[...slug]-98f2ea72ad0aa938.js +0 -1
  153. package/.next/static/chunks/pages/[slug]/p-fdd59650ea60aef9.js +0 -1
  154. package/.next/static/chunks/pages/_app-ed042290aee646cb.js +0 -1
  155. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  156. package/.next/static/chunks/pages/account-a27dac55934a8c58.js +0 -1
  157. package/.next/static/chunks/pages/checkout-f75cc5c4859916ba.js +0 -1
  158. package/.next/static/chunks/pages/index-e7b12b548c44b1c5.js +0 -1
  159. package/.next/static/chunks/pages/login-cdb531ad10c8993c.js +0 -1
  160. package/.next/static/chunks/pages/s-62ae2cb782518452.js +0 -1
  161. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  162. package/.next/static/chunks/webpack-c22f5b0626028f1b.js +0 -1
  163. package/.next/static/css/13a4da555ff5e3be.css +0 -1
  164. package/.next/static/css/287f5ba239375052.css +0 -1
  165. package/.next/static/css/2e00f7ba49c754b3.css +0 -1
  166. package/.next/static/css/47d82dcec9a7dbc2.css +0 -1
  167. package/.next/static/css/6e41f1b6078c14c1.css +0 -1
  168. package/.next/static/css/7d822a137c54a781.css +0 -1
  169. package/.next/static/css/87c68d702d4c704e.css +0 -1
  170. package/.next/static/css/c6f97f692b2efad9.css +0 -1
  171. package/.next/static/css/d4a0d9df8c6df555.css +0 -1
  172. package/.next/static/css/e02cdad8fc000339.css +0 -1
  173. package/.next/trace +0 -70
  174. package/public/~partytown/debug/partytown-atomics.js +0 -556
  175. package/public/~partytown/debug/partytown-media.js +0 -374
  176. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  177. package/public/~partytown/debug/partytown-sw.js +0 -59
  178. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  179. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  180. package/public/~partytown/debug/partytown.js +0 -72
  181. package/public/~partytown/partytown-atomics.js +0 -2
  182. package/public/~partytown/partytown-media.js +0 -2
  183. package/public/~partytown/partytown-sw.js +0 -2
  184. package/public/~partytown/partytown.js +0 -2
  185. package/src/components/common/RegionBar/RegionBar.tsx +0 -17
  186. package/src/styles/global/utilities.scss +0 -76
  187. package/src/styles/scaffold.scss +0 -7
  188. package/src/styles/vendors/include-media.scss +0 -4
  189. package/src/styles/vendors/include-media_overwrite.scss +0 -9
  190. package/src/styles/vendors/modern-normalize.css +0 -270
  191. /package/src/components/{common → sections}/RegionBar/index.ts +0 -0
@@ -24,7 +24,7 @@ info - Finalizing page optimization...
24
24
  Route (pages) Size First Load JS
25
25
  ┌ ● / 3.1 kB 125 kB
26
26
  ├ └ css/13a4da555ff5e3be.css 7.19 kB
27
- ├ /_app 0 B 77.9 kB
27
+ ├ /_app 0 B 77.8 kB
28
28
  ├ ● /[...slug] 10.1 kB 133 kB
29
29
  ├ └ css/6e41f1b6078c14c1.css 7.9 kB
30
30
  ├ ● /[slug]/p 11.7 kB 134 kB
@@ -32,17 +32,17 @@ Route (pages) Size First Load JS
32
32
  ├ ○ /404 1.09 kB 113 kB
33
33
  ├ ● /500 1.11 kB 113 kB
34
34
  ├ ● /account 669 B 112 kB
35
- ├ λ /api/graphql 0 B 77.9 kB
36
- ├ λ /api/preview 0 B 77.9 kB
35
+ ├ λ /api/graphql 0 B 77.8 kB
36
+ ├ λ /api/preview 0 B 77.8 kB
37
37
  ├ ● /checkout 657 B 112 kB
38
38
  ├ ● /login 1.01 kB 113 kB
39
39
  └ ● /s 1.11 kB 124 kB
40
- + First Load JS shared by all 80.7 kB
40
+ + First Load JS shared by all 80.6 kB
41
41
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
42
42
  ├ chunks/main-fd466221927468fd.js 23.9 kB
43
- ├ chunks/pages/_app-ed042290aee646cb.js 6.46 kB
44
- ├ chunks/webpack-c22f5b0626028f1b.js 2.22 kB
45
- └ css/47d82dcec9a7dbc2.css 2.78 kB
43
+ ├ chunks/pages/_app-79d333aa6001a806.js 6.38 kB
44
+ ├ chunks/webpack-d62f6560695a4b1b.js 2.21 kB
45
+ └ css/e2dad288b79896b9.css 2.78 kB
46
46
 
47
47
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
48
48
  ○ (Static) automatically rendered as static HTML (uses no initial props)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.169-alpha.0](https://github.com/vtex/faststore/compare/v2.0.168-alpha.0...v2.0.169-alpha.0) (2023-05-29)
7
+
8
+ ### Chores
9
+
10
+ - Removes imports utilities styles from core package + enable system fonts ([#1792](https://github.com/vtex/faststore/issues/1792)) ([19de095](https://github.com/vtex/faststore/commit/19de095e0e47548386afb06ef057798ca54f6294))
11
+
12
+ ## [2.0.168-alpha.0](https://github.com/vtex/faststore/compare/v2.0.167-alpha.0...v2.0.168-alpha.0) (2023-05-29)
13
+
14
+ ### Features
15
+
16
+ - Adds `RegionBar` and `RegionModal` Sections ([#1798](https://github.com/vtex/faststore/issues/1798)) ([627fa25](https://github.com/vtex/faststore/commit/627fa25832a7a41a1feebe07bef43b67e5edf13a))
17
+
6
18
  ## [2.0.166-alpha.0](https://github.com/vtex/faststore/compare/v2.0.165-alpha.0...v2.0.166-alpha.0) (2023-05-29)
7
19
 
8
20
  ### Features
@@ -1517,5 +1517,136 @@
1517
1517
  }
1518
1518
  }
1519
1519
  }
1520
+ },
1521
+ {
1522
+ "name": "RegionBar",
1523
+ "schema": {
1524
+ "title": "Region Bar",
1525
+ "type": "object",
1526
+ "description": "Region Bar configuration",
1527
+ "required": ["label"],
1528
+ "properties": {
1529
+ "icon": {
1530
+ "title": "Location Icon",
1531
+ "type": "object",
1532
+ "properties": {
1533
+ "icon": {
1534
+ "title": "Icon",
1535
+ "type": "string",
1536
+ "enumNames": ["Map Pin"],
1537
+ "enum": ["MapPin"],
1538
+ "default": "MapPin"
1539
+ },
1540
+ "alt": {
1541
+ "title": "Alternative Label",
1542
+ "type": "string",
1543
+ "default": "Map Pin icon"
1544
+ }
1545
+ }
1546
+ },
1547
+ "label": {
1548
+ "title": "Location label",
1549
+ "type": "string",
1550
+ "default": "Set your location"
1551
+ },
1552
+ "editLabel": {
1553
+ "title": "Location edit label",
1554
+ "type": "string",
1555
+ "default": "Edit"
1556
+ },
1557
+ "buttonIcon": {
1558
+ "title": "Button Icon",
1559
+ "type": "object",
1560
+ "properties": {
1561
+ "icon": {
1562
+ "title": "Icon",
1563
+ "type": "string",
1564
+ "enumNames": ["Caret Right"],
1565
+ "enum": ["CaretRight"],
1566
+ "default": "CaretRight"
1567
+ },
1568
+ "alt": {
1569
+ "title": "Alternative Label",
1570
+ "type": "string",
1571
+ "default": "Caret Right icon"
1572
+ }
1573
+ }
1574
+ }
1575
+ }
1576
+ }
1577
+ },
1578
+ {
1579
+ "name": "RegionModal",
1580
+ "schema": {
1581
+ "title": "Region Modal",
1582
+ "type": "object",
1583
+ "description": "Region Modal configuration",
1584
+ "properties": {
1585
+ "title": {
1586
+ "title": "Title",
1587
+ "type": "string",
1588
+ "default": "Set your location"
1589
+ },
1590
+ "description": {
1591
+ "title": "Description",
1592
+ "type": "string",
1593
+ "default": "Prices, offers and availability may vary according to your location."
1594
+ },
1595
+ "closeButtonAriaLabel": {
1596
+ "title": "Close modal aria-label",
1597
+ "type": "string",
1598
+ "default": "Close Region Modal"
1599
+ },
1600
+ "inputField": {
1601
+ "title": "Input Field",
1602
+ "type": "object",
1603
+ "properties": {
1604
+ "label": {
1605
+ "title": "Input field label",
1606
+ "type": "string",
1607
+ "default": "Postal Code"
1608
+ },
1609
+ "errorMessage": {
1610
+ "title": "Input field error message",
1611
+ "type": "string",
1612
+ "default": "You entered an invalid Postal Code"
1613
+ }
1614
+ }
1615
+ },
1616
+ "idkPostalCodeLink": {
1617
+ "title": "I don't know my postal code link",
1618
+ "type": "object",
1619
+ "properties": {
1620
+ "text": {
1621
+ "type": "string",
1622
+ "title": "Link Text",
1623
+ "default": "I don't know my Postal Code"
1624
+ },
1625
+ "to": {
1626
+ "type": "string",
1627
+ "title": "Action link"
1628
+ },
1629
+ "icon": {
1630
+ "title": "Icon",
1631
+ "type": "object",
1632
+ "properties": {
1633
+ "icon": {
1634
+ "title": "Icon",
1635
+ "type": "string",
1636
+ "enumNames": ["Arrow Square Out"],
1637
+ "enum": ["ArrowSquareOut"],
1638
+ "default": "ArrowSquareOut"
1639
+ },
1640
+ "alt": {
1641
+ "title": "Alternative Label",
1642
+ "type": "string",
1643
+ "default": "Arrow Square Out icon"
1644
+ }
1645
+ }
1646
+ }
1647
+ }
1648
+ }
1649
+ }
1650
+ }
1520
1651
  }
1521
1652
  ]
package/next.config.js CHANGED
@@ -15,6 +15,9 @@ const nextConfig = {
15
15
  locales: ['en-US'],
16
16
  defaultLocale: 'en-US',
17
17
  },
18
+ sassOptions: {
19
+ additionalData: `@import "@faststore/ui/src/styles/base/utilities.scss";`,
20
+ },
18
21
  webpack: (config, { isServer, dev }) => {
19
22
  // https://github.com/vercel/next.js/discussions/11267#discussioncomment-2479112
20
23
  // camel-case style names from css modules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.166-alpha.0",
3
+ "version": "2.0.169-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,10 +30,10 @@
30
30
  "@envelop/parser-cache": "^2.2.0",
31
31
  "@envelop/validation-cache": "^2.2.0",
32
32
  "@faststore/api": "^2.0.165-alpha.0",
33
- "@faststore/components": "^2.0.160-alpha.0",
33
+ "@faststore/components": "^2.0.168-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.162-alpha.0",
36
- "@faststore/ui": "^2.0.160-alpha.0",
36
+ "@faststore/ui": "^2.0.169-alpha.0",
37
37
  "@types/react": "^18.0.14",
38
38
  "@vtex/client-cms": "^0.2.12",
39
39
  "autoprefixer": "^10.4.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "54464ea6828b2ff30b96e80c32ef0f1df66b995d"
111
+ "gitHead": "243d208d99b39628236e7e86491b22621d54127e"
112
112
  }
package/src/Layout.tsx CHANGED
@@ -1,24 +1,7 @@
1
1
  import type { PropsWithChildren } from 'react'
2
- import { lazy, Suspense } from 'react'
3
-
4
- import { useUI } from '@faststore/ui'
5
-
6
- const RegionModal = lazy(() => import('src/components/region/RegionModal'))
7
2
 
8
3
  function Layout({ children }: PropsWithChildren) {
9
- const { modal: displayModal } = useUI()
10
-
11
- return (
12
- <>
13
- {children}
14
-
15
- {displayModal && (
16
- <Suspense fallback={null}>
17
- <RegionModal />
18
- </Suspense>
19
- )}
20
- </>
21
- )
4
+ return <>{children}</>
22
5
  }
23
6
 
24
7
  export default Layout
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Overlay/styles.scss";
@@ -4,13 +4,15 @@ import { PropsWithChildren, lazy } from 'react'
4
4
  import CUSTOM_COMPONENTS from 'src/customizations/components'
5
5
  import { PageContentType, getPage } from 'src/server/cms'
6
6
 
7
- import RegionBar from 'src/components/common/RegionBar'
8
7
  import Toast from 'src/components/common/Toast'
9
8
  import RenderSections from './RenderSections'
10
9
 
11
10
  import Alert from 'src/components/sections/Alert'
12
11
  import Footer from 'src/components/sections/Footer'
13
12
  import Navbar from 'src/components/sections/Navbar'
13
+ import RegionBar from 'src/components/sections/RegionBar'
14
+
15
+ const RegionModal = lazy(() => import('src/components/region/RegionModal'))
14
16
  const CartSidebar = lazy(() => import('src/components/cart/CartSidebar'))
15
17
 
16
18
  export const GLOBAL_SECTIONS_CONTENT_TYPE = 'globalSections'
@@ -23,6 +25,8 @@ export type GlobalSectionsData = {
23
25
  const COMPONENTS: Record<string, ComponentType<any>> = {
24
26
  Alert,
25
27
  Navbar,
28
+ RegionBar,
29
+ RegionModal,
26
30
  CartSidebar,
27
31
  Footer,
28
32
  ...CUSTOM_COMPONENTS,
@@ -36,10 +40,7 @@ function GlobalSections({
36
40
  <RenderSections components={COMPONENTS} {...otherProps}>
37
41
  <Toast />
38
42
 
39
- <main>
40
- <RegionBar className="display-mobile" />
41
- {children}
42
- </main>
43
+ <main>{children}</main>
43
44
  </RenderSections>
44
45
  )
45
46
  }
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/molecules/Toast/styles.scss";
@@ -1,9 +1,39 @@
1
- import { RegionBar as UIRegionBar } from '@faststore/ui'
1
+ import type { RegionBarProps as UIRegionBarProps } from '@faststore/ui'
2
+ import { Icon, RegionBar as UIRegionBar } from '@faststore/ui'
2
3
 
3
- import { useSession } from 'src/sdk/session'
4
4
  import { useUI } from '@faststore/ui'
5
+ import { useSession } from 'src/sdk/session'
6
+
7
+ export interface RegionBarProps {
8
+ /**
9
+ * A React component that will be rendered as an icon.
10
+ */
11
+ icon?: {
12
+ icon: string
13
+ alt: string
14
+ }
15
+ /**
16
+ * Specifies a label for the location text.
17
+ */
18
+ label: UIRegionBarProps['label']
19
+ /**
20
+ * Specifies a label for the edit text.
21
+ */
22
+ editLabel?: UIRegionBarProps['editLabel']
23
+ /**
24
+ * A React component that will be rendered as an icon.
25
+ */
26
+ buttonIcon?: {
27
+ icon: string
28
+ alt: string
29
+ }
30
+ }
5
31
 
6
- function RegionBar({ ...otherProps }) {
32
+ function RegionBar({
33
+ icon: { icon: locationIcon, alt: locationIconAlt },
34
+ buttonIcon: { icon: buttonIcon, alt: buttonIconAlt },
35
+ ...otherProps
36
+ }: RegionBarProps) {
7
37
  const { openModal } = useUI()
8
38
  const { postalCode } = useSession()
9
39
 
@@ -11,6 +41,8 @@ function RegionBar({ ...otherProps }) {
11
41
  <UIRegionBar
12
42
  onButtonClick={openModal}
13
43
  postalCode={postalCode}
44
+ icon={<Icon name={locationIcon} aria-label={locationIconAlt} />}
45
+ buttonIcon={<Icon name={buttonIcon} aria-label={buttonIconAlt} />}
14
46
  {...otherProps}
15
47
  />
16
48
  )
@@ -1,15 +1,49 @@
1
- import { RegionModal as UIRegionModal } from '@faststore/ui'
2
- import { useRef, useState } from 'react'
1
+ import {
2
+ Icon,
3
+ RegionModal as UIRegionModal,
4
+ RegionModalProps as UIRegionModalProps,
5
+ useUI,
6
+ } from '@faststore/ui'
7
+ import { Suspense, useRef, useState } from 'react'
3
8
 
4
9
  import { sessionStore, useSession, validateSession } from 'src/sdk/session'
5
10
 
6
11
  import styles from './section.module.scss'
7
12
 
8
- function RegionModal() {
13
+ interface RegionModalProps {
14
+ title?: UIRegionModalProps['title']
15
+ description?: UIRegionModalProps['description']
16
+ closeButtonAriaLabel?: UIRegionModalProps['closeButtonAriaLabel']
17
+ inputField?: {
18
+ label?: UIRegionModalProps['inputLabel']
19
+ errorMessage?: UIRegionModalProps['errorMessage']
20
+ }
21
+ idkPostalCodeLink?: {
22
+ text?: string
23
+ to?: string
24
+ icon?: {
25
+ icon: string
26
+ alt: string
27
+ }
28
+ }
29
+ }
30
+
31
+ function RegionModal({
32
+ title,
33
+ description,
34
+ closeButtonAriaLabel,
35
+ inputField: { label: inputFieldLabel, errorMessage: inputFieldErrorMessage },
36
+ idkPostalCodeLink: {
37
+ text: idkPostalCodeLinkText,
38
+ to: idkPostalCodeLinkTo,
39
+ icon: { icon: idkPostalCodeLinkIcon, alt: idkPostalCodeLinkIconAlt },
40
+ },
41
+ }: RegionModalProps) {
9
42
  const inputRef = useRef<HTMLInputElement>(null)
10
43
  const { isValidating, ...session } = useSession()
11
44
  const [errorMessage, setErrorMessage] = useState<string>('')
12
45
  const [input, setInput] = useState<string>('')
46
+ const { modal: displayModal } = useUI()
13
47
 
14
48
  const handleSubmit = async () => {
15
49
  const postalCode = inputRef.current?.value
@@ -30,26 +64,54 @@ function RegionModal() {
30
64
 
31
65
  sessionStore.set(validatedSession ?? newSession)
32
66
  } catch (error) {
33
- setErrorMessage('You entered an invalid Postal Code')
67
+ setErrorMessage(inputFieldErrorMessage)
34
68
  }
35
69
  }
36
70
 
71
+ const idkPostalCodeLinkProps: UIRegionModalProps['idkPostalCodeLinkProps'] = {
72
+ href: idkPostalCodeLinkTo ?? '#',
73
+ children: (
74
+ <>
75
+ {idkPostalCodeLinkText}
76
+ {!!idkPostalCodeLinkIcon ?? (
77
+ <Icon
78
+ name={idkPostalCodeLinkIcon}
79
+ aria-label={idkPostalCodeLinkIconAlt}
80
+ width={20}
81
+ height={20}
82
+ />
83
+ )}
84
+ </>
85
+ ),
86
+ }
87
+
37
88
  return (
38
- <UIRegionModal
39
- overlayProps={{
40
- className: `section ${styles.section} section-region-modal`,
41
- }}
42
- inputRef={inputRef}
43
- inputValue={input}
44
- errorMessage={errorMessage}
45
- onInput={(e) => {
46
- errorMessage !== '' && setErrorMessage('')
47
- setInput(e.currentTarget.value)
48
- }}
49
- onSubmit={handleSubmit}
50
- fadeOutOnSubmit={true}
51
- onClear={() => setInput('')}
52
- />
89
+ <>
90
+ {displayModal && (
91
+ <Suspense fallback={null}>
92
+ <UIRegionModal
93
+ title={title}
94
+ description={description}
95
+ overlayProps={{
96
+ className: `section ${styles.section} section-region-modal`,
97
+ }}
98
+ closeButtonAriaLabel={closeButtonAriaLabel}
99
+ inputRef={inputRef}
100
+ inputValue={input}
101
+ inputLabel={inputFieldLabel}
102
+ errorMessage={errorMessage}
103
+ idkPostalCodeLinkProps={idkPostalCodeLinkProps}
104
+ onInput={(e) => {
105
+ errorMessage !== '' && setErrorMessage('')
106
+ setInput(e.currentTarget.value)
107
+ }}
108
+ onSubmit={handleSubmit}
109
+ fadeOutOnSubmit={true}
110
+ onClear={() => setInput('')}
111
+ />
112
+ </Suspense>
113
+ )}
114
+ </>
53
115
  )
54
116
  }
55
117
 
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Input/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Badge/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
3
  @import "@faststore/ui/src/components/molecules/LinkButton/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Button/styles";
6
3
  @import "@faststore/ui/src/components/molecules/LinkButton/styles";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Link/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Loader/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Link/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/organisms/Hero/styles.scss";
6
3
  @import "@faststore/ui/src/components/molecules/LinkButton/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/List/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Badge/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  margin-top: 0;
6
3
 
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Badge/styles.scss";
6
3
  @import "@faststore/ui/src/components/atoms/Button/styles.scss";
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  [data-fs-product-shelf-skeleton] {
6
3
  --fs-carousel-item-width-tablet : 14.2rem;
@@ -1,6 +1,3 @@
1
- /* stylelint-disable no-invalid-position-at-import-rule */
2
- @import "@faststore/ui/src/styles/base/utilities.scss";
3
-
4
1
  .section {
5
2
  @import "@faststore/ui/src/components/atoms/Badge/styles";
6
3
  @import "@faststore/ui/src/components/atoms/Button/styles";
@@ -0,0 +1,41 @@
1
+ import RegionBar, {
2
+ RegionBarProps,
3
+ } from 'src/components/region/RegionBar/RegionBar'
4
+ import Section from 'src/components/sections/Section/Section'
5
+ import styles from './section.module.scss'
6
+
7
+ type RegionBarSectionProps = {
8
+ /**
9
+ * className forwarded to the section.
10
+ */
11
+ className?: string
12
+ /**
13
+ * A React component that will be rendered as an icon.
14
+ */
15
+ icon: RegionBarProps['icon']
16
+ /**
17
+ * Specifies a label for the location text.
18
+ */
19
+ label: RegionBarProps['label']
20
+ /**
21
+ * Specifies a label for the edit text.
22
+ */
23
+ editLabel?: RegionBarProps['editLabel']
24
+ /**
25
+ * A React component that will be rendered as an icon.
26
+ */
27
+ buttonIcon?: RegionBarProps['buttonIcon']
28
+ }
29
+
30
+ function RegionBarSection({
31
+ className = 'display-mobile',
32
+ ...otherProps
33
+ }: RegionBarSectionProps) {
34
+ return (
35
+ <Section className={`${styles.section} section-region-bar ${className}`}>
36
+ <RegionBar {...otherProps} />
37
+ </Section>
38
+ )
39
+ }
40
+
41
+ export default RegionBarSection