@faststore/core 2.0.166-alpha.0 → 2.0.168-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 (161) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +6 -0
  3. package/cms/faststore/sections.json +131 -0
  4. package/package.json +3 -3
  5. package/src/Layout.tsx +1 -18
  6. package/src/components/cms/GlobalSections.tsx +6 -5
  7. package/src/components/region/RegionBar/RegionBar.tsx +35 -3
  8. package/src/components/region/RegionModal/RegionModal.tsx +81 -19
  9. package/src/components/sections/RegionBar/RegionBar.tsx +41 -0
  10. package/.next/BUILD_ID +0 -1
  11. package/.next/build-manifest.json +0 -123
  12. package/.next/cache/.tsbuildinfo +0 -1
  13. package/.next/cache/config.json +0 -7
  14. package/.next/cache/eslint/.cache_1gneedd +0 -1
  15. package/.next/cache/next-server.js.nft.json +0 -1
  16. package/.next/cache/webpack/client-production/0.pack +0 -0
  17. package/.next/cache/webpack/client-production/index.pack +0 -0
  18. package/.next/cache/webpack/server-production/0.pack +0 -0
  19. package/.next/cache/webpack/server-production/index.pack +0 -0
  20. package/.next/export-marker.json +0 -1
  21. package/.next/images-manifest.json +0 -1
  22. package/.next/next-server.js.nft.json +0 -1
  23. package/.next/package.json +0 -1
  24. package/.next/prerender-manifest.json +0 -1
  25. package/.next/react-loadable-manifest.json +0 -45
  26. package/.next/required-server-files.json +0 -1
  27. package/.next/routes-manifest.json +0 -1
  28. package/.next/server/chunks/123.js +0 -58
  29. package/.next/server/chunks/143.js +0 -106
  30. package/.next/server/chunks/183.js +0 -90
  31. package/.next/server/chunks/205.js +0 -692
  32. package/.next/server/chunks/247.js +0 -61
  33. package/.next/server/chunks/280.js +0 -324
  34. package/.next/server/chunks/287.js +0 -58
  35. package/.next/server/chunks/289.js +0 -229
  36. package/.next/server/chunks/312.js +0 -697
  37. package/.next/server/chunks/336.js +0 -821
  38. package/.next/server/chunks/350.js +0 -143
  39. package/.next/server/chunks/368.js +0 -253
  40. package/.next/server/chunks/487.js +0 -9142
  41. package/.next/server/chunks/502.js +0 -626
  42. package/.next/server/chunks/576.js +0 -90
  43. package/.next/server/chunks/597.js +0 -169
  44. package/.next/server/chunks/650.js +0 -9142
  45. package/.next/server/chunks/676.js +0 -32
  46. package/.next/server/chunks/701.js +0 -87
  47. package/.next/server/chunks/74.js +0 -2951
  48. package/.next/server/chunks/82.js +0 -371
  49. package/.next/server/chunks/825.js +0 -4039
  50. package/.next/server/chunks/854.js +0 -72
  51. package/.next/server/chunks/859.js +0 -959
  52. package/.next/server/chunks/874.js +0 -487
  53. package/.next/server/chunks/886.js +0 -120
  54. package/.next/server/chunks/907.js +0 -1803
  55. package/.next/server/chunks/970.js +0 -200
  56. package/.next/server/chunks/98.js +0 -124
  57. package/.next/server/chunks/font-manifest.json +0 -1
  58. package/.next/server/font-manifest.json +0 -1
  59. package/.next/server/middleware-build-manifest.js +0 -1
  60. package/.next/server/middleware-manifest.json +0 -6
  61. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  62. package/.next/server/pages/404.js +0 -393
  63. package/.next/server/pages/404.js.nft.json +0 -1
  64. package/.next/server/pages/500.js +0 -395
  65. package/.next/server/pages/500.js.nft.json +0 -1
  66. package/.next/server/pages/[...slug].js +0 -786
  67. package/.next/server/pages/[...slug].js.nft.json +0 -1
  68. package/.next/server/pages/[slug]/p.js +0 -2532
  69. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  70. package/.next/server/pages/_app.js +0 -323
  71. package/.next/server/pages/_app.js.nft.json +0 -1
  72. package/.next/server/pages/_document.js +0 -304
  73. package/.next/server/pages/_document.js.nft.json +0 -1
  74. package/.next/server/pages/_error.js +0 -164
  75. package/.next/server/pages/_error.js.nft.json +0 -1
  76. package/.next/server/pages/account.js +0 -370
  77. package/.next/server/pages/account.js.nft.json +0 -1
  78. package/.next/server/pages/api/graphql.js +0 -365
  79. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  80. package/.next/server/pages/api/preview.js +0 -119
  81. package/.next/server/pages/api/preview.js.nft.json +0 -1
  82. package/.next/server/pages/checkout.js +0 -370
  83. package/.next/server/pages/checkout.js.nft.json +0 -1
  84. package/.next/server/pages/en-US/404.html +0 -81
  85. package/.next/server/pages/en-US/404.json +0 -1
  86. package/.next/server/pages/en-US/500.html +0 -81
  87. package/.next/server/pages/en-US/500.json +0 -1
  88. package/.next/server/pages/en-US/account.html +0 -81
  89. package/.next/server/pages/en-US/account.json +0 -1
  90. package/.next/server/pages/en-US/checkout.html +0 -81
  91. package/.next/server/pages/en-US/checkout.json +0 -1
  92. package/.next/server/pages/en-US/login.html +0 -81
  93. package/.next/server/pages/en-US/login.json +0 -1
  94. package/.next/server/pages/en-US/s.html +0 -81
  95. package/.next/server/pages/en-US/s.json +0 -1
  96. package/.next/server/pages/en-US.html +0 -81
  97. package/.next/server/pages/en-US.json +0 -1
  98. package/.next/server/pages/index.js +0 -966
  99. package/.next/server/pages/index.js.nft.json +0 -1
  100. package/.next/server/pages/login.js +0 -375
  101. package/.next/server/pages/login.js.nft.json +0 -1
  102. package/.next/server/pages/s.js +0 -473
  103. package/.next/server/pages/s.js.nft.json +0 -1
  104. package/.next/server/pages-manifest.json +0 -16
  105. package/.next/server/webpack-api-runtime.js +0 -229
  106. package/.next/server/webpack-runtime.js +0 -229
  107. package/.next/static/V9ehyEgCMbu0LEDWsRhj5/_buildManifest.js +0 -1
  108. package/.next/static/V9ehyEgCMbu0LEDWsRhj5/_ssgManifest.js +0 -1
  109. package/.next/static/chunks/0-82274e07cb857231.js +0 -1
  110. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  111. package/.next/static/chunks/226.b57e10ad9932f88c.js +0 -1
  112. package/.next/static/chunks/240-8e66b2892f9d8c40.js +0 -1
  113. package/.next/static/chunks/377-a2ea7cc68eb5f626.js +0 -1
  114. package/.next/static/chunks/460-910c8076569320d3.js +0 -1
  115. package/.next/static/chunks/495.0ecd099878b2a36d.js +0 -1
  116. package/.next/static/chunks/502.ec90d1859d393d34.js +0 -1
  117. package/.next/static/chunks/597.331d43f9ddefb6ad.js +0 -1
  118. package/.next/static/chunks/64.ebbe1d2b40f980c7.js +0 -1
  119. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  120. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  121. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  122. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  123. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  124. package/.next/static/chunks/pages/404-51ec6bdbfb779d04.js +0 -1
  125. package/.next/static/chunks/pages/500-2326a336f08c29f7.js +0 -1
  126. package/.next/static/chunks/pages/[...slug]-98f2ea72ad0aa938.js +0 -1
  127. package/.next/static/chunks/pages/[slug]/p-fdd59650ea60aef9.js +0 -1
  128. package/.next/static/chunks/pages/_app-ed042290aee646cb.js +0 -1
  129. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  130. package/.next/static/chunks/pages/account-a27dac55934a8c58.js +0 -1
  131. package/.next/static/chunks/pages/checkout-f75cc5c4859916ba.js +0 -1
  132. package/.next/static/chunks/pages/index-e7b12b548c44b1c5.js +0 -1
  133. package/.next/static/chunks/pages/login-cdb531ad10c8993c.js +0 -1
  134. package/.next/static/chunks/pages/s-62ae2cb782518452.js +0 -1
  135. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  136. package/.next/static/chunks/webpack-c22f5b0626028f1b.js +0 -1
  137. package/.next/static/css/13a4da555ff5e3be.css +0 -1
  138. package/.next/static/css/287f5ba239375052.css +0 -1
  139. package/.next/static/css/2e00f7ba49c754b3.css +0 -1
  140. package/.next/static/css/47d82dcec9a7dbc2.css +0 -1
  141. package/.next/static/css/6e41f1b6078c14c1.css +0 -1
  142. package/.next/static/css/7d822a137c54a781.css +0 -1
  143. package/.next/static/css/87c68d702d4c704e.css +0 -1
  144. package/.next/static/css/c6f97f692b2efad9.css +0 -1
  145. package/.next/static/css/d4a0d9df8c6df555.css +0 -1
  146. package/.next/static/css/e02cdad8fc000339.css +0 -1
  147. package/.next/trace +0 -70
  148. package/public/~partytown/debug/partytown-atomics.js +0 -556
  149. package/public/~partytown/debug/partytown-media.js +0 -374
  150. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  151. package/public/~partytown/debug/partytown-sw.js +0 -59
  152. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  153. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  154. package/public/~partytown/debug/partytown.js +0 -72
  155. package/public/~partytown/partytown-atomics.js +0 -2
  156. package/public/~partytown/partytown-media.js +0 -2
  157. package/public/~partytown/partytown-sw.js +0 -2
  158. package/public/~partytown/partytown.js +0 -2
  159. package/src/components/common/RegionBar/RegionBar.tsx +0 -17
  160. /package/src/components/{common → sections}/RegionBar/index.ts +0 -0
  161. /package/src/components/{common → sections}/RegionBar/section.module.scss +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,16 +32,16 @@ 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
43
+ ├ chunks/pages/_app-79d333aa6001a806.js 6.38 kB
44
+ ├ chunks/webpack-79982595c94ff0e7.js 2.21 kB
45
45
  └ css/47d82dcec9a7dbc2.css 2.78 kB
46
46
 
47
47
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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.168-alpha.0](https://github.com/vtex/faststore/compare/v2.0.167-alpha.0...v2.0.168-alpha.0) (2023-05-29)
7
+
8
+ ### Features
9
+
10
+ - Adds `RegionBar` and `RegionModal` Sections ([#1798](https://github.com/vtex/faststore/issues/1798)) ([627fa25](https://github.com/vtex/faststore/commit/627fa25832a7a41a1feebe07bef43b67e5edf13a))
11
+
6
12
  ## [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
13
 
8
14
  ### 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/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.168-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
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
36
  "@faststore/ui": "^2.0.160-alpha.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "54464ea6828b2ff30b96e80c32ef0f1df66b995d"
111
+ "gitHead": "83716a775545aa6ed10a478113408de4a094f792"
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
@@ -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,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
 
@@ -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
package/.next/BUILD_ID DELETED
@@ -1 +0,0 @@
1
- V9ehyEgCMbu0LEDWsRhj5
@@ -1,123 +0,0 @@
1
- {
2
- "polyfillFiles": [
3
- "static/chunks/polyfills-c67a75d1b6f99dc8.js"
4
- ],
5
- "devFiles": [],
6
- "ampDevFiles": [],
7
- "lowPriorityFiles": [
8
- "static/V9ehyEgCMbu0LEDWsRhj5/_buildManifest.js",
9
- "static/V9ehyEgCMbu0LEDWsRhj5/_ssgManifest.js"
10
- ],
11
- "rootMainFiles": [],
12
- "pages": {
13
- "/": [
14
- "static/chunks/webpack-c22f5b0626028f1b.js",
15
- "static/chunks/framework-dfd14d7ce6600b03.js",
16
- "static/chunks/main-fd466221927468fd.js",
17
- "static/chunks/460-910c8076569320d3.js",
18
- "static/css/87c68d702d4c704e.css",
19
- "static/chunks/377-a2ea7cc68eb5f626.js",
20
- "static/css/287f5ba239375052.css",
21
- "static/chunks/240-8e66b2892f9d8c40.js",
22
- "static/css/13a4da555ff5e3be.css",
23
- "static/chunks/pages/index-e7b12b548c44b1c5.js"
24
- ],
25
- "/404": [
26
- "static/chunks/webpack-c22f5b0626028f1b.js",
27
- "static/chunks/framework-dfd14d7ce6600b03.js",
28
- "static/chunks/main-fd466221927468fd.js",
29
- "static/chunks/460-910c8076569320d3.js",
30
- "static/css/87c68d702d4c704e.css",
31
- "static/chunks/377-a2ea7cc68eb5f626.js",
32
- "static/css/e02cdad8fc000339.css",
33
- "static/chunks/pages/404-51ec6bdbfb779d04.js"
34
- ],
35
- "/500": [
36
- "static/chunks/webpack-c22f5b0626028f1b.js",
37
- "static/chunks/framework-dfd14d7ce6600b03.js",
38
- "static/chunks/main-fd466221927468fd.js",
39
- "static/chunks/460-910c8076569320d3.js",
40
- "static/css/87c68d702d4c704e.css",
41
- "static/chunks/377-a2ea7cc68eb5f626.js",
42
- "static/css/e02cdad8fc000339.css",
43
- "static/chunks/pages/500-2326a336f08c29f7.js"
44
- ],
45
- "/[...slug]": [
46
- "static/chunks/webpack-c22f5b0626028f1b.js",
47
- "static/chunks/framework-dfd14d7ce6600b03.js",
48
- "static/chunks/main-fd466221927468fd.js",
49
- "static/chunks/460-910c8076569320d3.js",
50
- "static/css/87c68d702d4c704e.css",
51
- "static/chunks/377-a2ea7cc68eb5f626.js",
52
- "static/css/d4a0d9df8c6df555.css",
53
- "static/chunks/0-82274e07cb857231.js",
54
- "static/css/6e41f1b6078c14c1.css",
55
- "static/chunks/pages/[...slug]-98f2ea72ad0aa938.js"
56
- ],
57
- "/[slug]/p": [
58
- "static/chunks/webpack-c22f5b0626028f1b.js",
59
- "static/chunks/framework-dfd14d7ce6600b03.js",
60
- "static/chunks/main-fd466221927468fd.js",
61
- "static/chunks/460-910c8076569320d3.js",
62
- "static/css/87c68d702d4c704e.css",
63
- "static/chunks/377-a2ea7cc68eb5f626.js",
64
- "static/css/287f5ba239375052.css",
65
- "static/chunks/240-8e66b2892f9d8c40.js",
66
- "static/css/c6f97f692b2efad9.css",
67
- "static/chunks/pages/[slug]/p-fdd59650ea60aef9.js"
68
- ],
69
- "/_app": [
70
- "static/chunks/webpack-c22f5b0626028f1b.js",
71
- "static/chunks/framework-dfd14d7ce6600b03.js",
72
- "static/chunks/main-fd466221927468fd.js",
73
- "static/css/47d82dcec9a7dbc2.css",
74
- "static/chunks/pages/_app-ed042290aee646cb.js"
75
- ],
76
- "/_error": [
77
- "static/chunks/webpack-c22f5b0626028f1b.js",
78
- "static/chunks/framework-dfd14d7ce6600b03.js",
79
- "static/chunks/main-fd466221927468fd.js",
80
- "static/chunks/pages/_error-a7a0c1d9bfbb4f38.js"
81
- ],
82
- "/account": [
83
- "static/chunks/webpack-c22f5b0626028f1b.js",
84
- "static/chunks/framework-dfd14d7ce6600b03.js",
85
- "static/chunks/main-fd466221927468fd.js",
86
- "static/chunks/460-910c8076569320d3.js",
87
- "static/css/87c68d702d4c704e.css",
88
- "static/chunks/377-a2ea7cc68eb5f626.js",
89
- "static/chunks/pages/account-a27dac55934a8c58.js"
90
- ],
91
- "/checkout": [
92
- "static/chunks/webpack-c22f5b0626028f1b.js",
93
- "static/chunks/framework-dfd14d7ce6600b03.js",
94
- "static/chunks/main-fd466221927468fd.js",
95
- "static/chunks/460-910c8076569320d3.js",
96
- "static/css/87c68d702d4c704e.css",
97
- "static/chunks/377-a2ea7cc68eb5f626.js",
98
- "static/chunks/pages/checkout-f75cc5c4859916ba.js"
99
- ],
100
- "/login": [
101
- "static/chunks/webpack-c22f5b0626028f1b.js",
102
- "static/chunks/framework-dfd14d7ce6600b03.js",
103
- "static/chunks/main-fd466221927468fd.js",
104
- "static/chunks/460-910c8076569320d3.js",
105
- "static/css/87c68d702d4c704e.css",
106
- "static/chunks/377-a2ea7cc68eb5f626.js",
107
- "static/css/e02cdad8fc000339.css",
108
- "static/chunks/pages/login-cdb531ad10c8993c.js"
109
- ],
110
- "/s": [
111
- "static/chunks/webpack-c22f5b0626028f1b.js",
112
- "static/chunks/framework-dfd14d7ce6600b03.js",
113
- "static/chunks/main-fd466221927468fd.js",
114
- "static/chunks/460-910c8076569320d3.js",
115
- "static/css/87c68d702d4c704e.css",
116
- "static/chunks/377-a2ea7cc68eb5f626.js",
117
- "static/css/d4a0d9df8c6df555.css",
118
- "static/chunks/0-82274e07cb857231.js",
119
- "static/chunks/pages/s-62ae2cb782518452.js"
120
- ]
121
- },
122
- "ampFirstPages": []
123
- }