@faststore/core 2.0.165-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 (166) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +12 -0
  3. package/cms/faststore/sections.json +226 -0
  4. package/package.json +3 -3
  5. package/src/Layout.tsx +1 -25
  6. package/src/components/cart/CartSidebar/CartSidebar.tsx +97 -54
  7. package/src/components/cms/GlobalSections.tsx +11 -9
  8. package/src/components/region/RegionBar/RegionBar.tsx +35 -3
  9. package/src/components/region/RegionModal/RegionModal.tsx +81 -19
  10. package/src/components/sections/RegionBar/RegionBar.tsx +41 -0
  11. package/.next/BUILD_ID +0 -1
  12. package/.next/build-manifest.json +0 -132
  13. package/.next/cache/.tsbuildinfo +0 -1
  14. package/.next/cache/config.json +0 -7
  15. package/.next/cache/eslint/.cache_1gneedd +0 -1
  16. package/.next/cache/next-server.js.nft.json +0 -1
  17. package/.next/cache/webpack/client-production/0.pack +0 -0
  18. package/.next/cache/webpack/client-production/index.pack +0 -0
  19. package/.next/cache/webpack/server-production/0.pack +0 -0
  20. package/.next/cache/webpack/server-production/index.pack +0 -0
  21. package/.next/export-marker.json +0 -1
  22. package/.next/images-manifest.json +0 -1
  23. package/.next/next-server.js.nft.json +0 -1
  24. package/.next/package.json +0 -1
  25. package/.next/prerender-manifest.json +0 -1
  26. package/.next/react-loadable-manifest.json +0 -48
  27. package/.next/required-server-files.json +0 -1
  28. package/.next/routes-manifest.json +0 -1
  29. package/.next/server/chunks/123.js +0 -58
  30. package/.next/server/chunks/143.js +0 -106
  31. package/.next/server/chunks/183.js +0 -90
  32. package/.next/server/chunks/205.js +0 -692
  33. package/.next/server/chunks/247.js +0 -61
  34. package/.next/server/chunks/280.js +0 -324
  35. package/.next/server/chunks/287.js +0 -58
  36. package/.next/server/chunks/289.js +0 -229
  37. package/.next/server/chunks/312.js +0 -697
  38. package/.next/server/chunks/336.js +0 -821
  39. package/.next/server/chunks/350.js +0 -143
  40. package/.next/server/chunks/368.js +0 -253
  41. package/.next/server/chunks/487.js +0 -9142
  42. package/.next/server/chunks/502.js +0 -600
  43. package/.next/server/chunks/576.js +0 -90
  44. package/.next/server/chunks/597.js +0 -169
  45. package/.next/server/chunks/608.js +0 -644
  46. package/.next/server/chunks/644.js +0 -235
  47. package/.next/server/chunks/650.js +0 -9142
  48. package/.next/server/chunks/664.js +0 -3401
  49. package/.next/server/chunks/676.js +0 -32
  50. package/.next/server/chunks/701.js +0 -87
  51. package/.next/server/chunks/74.js +0 -2710
  52. package/.next/server/chunks/82.js +0 -371
  53. package/.next/server/chunks/854.js +0 -72
  54. package/.next/server/chunks/859.js +0 -959
  55. package/.next/server/chunks/874.js +0 -487
  56. package/.next/server/chunks/886.js +0 -120
  57. package/.next/server/chunks/907.js +0 -1803
  58. package/.next/server/chunks/970.js +0 -200
  59. package/.next/server/chunks/98.js +0 -124
  60. package/.next/server/chunks/font-manifest.json +0 -1
  61. package/.next/server/font-manifest.json +0 -1
  62. package/.next/server/middleware-build-manifest.js +0 -1
  63. package/.next/server/middleware-manifest.json +0 -6
  64. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  65. package/.next/server/pages/404.js +0 -393
  66. package/.next/server/pages/404.js.nft.json +0 -1
  67. package/.next/server/pages/500.js +0 -395
  68. package/.next/server/pages/500.js.nft.json +0 -1
  69. package/.next/server/pages/[...slug].js +0 -786
  70. package/.next/server/pages/[...slug].js.nft.json +0 -1
  71. package/.next/server/pages/[slug]/p.js +0 -2532
  72. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  73. package/.next/server/pages/_app.js +0 -368
  74. package/.next/server/pages/_app.js.nft.json +0 -1
  75. package/.next/server/pages/_document.js +0 -304
  76. package/.next/server/pages/_document.js.nft.json +0 -1
  77. package/.next/server/pages/_error.js +0 -164
  78. package/.next/server/pages/_error.js.nft.json +0 -1
  79. package/.next/server/pages/account.js +0 -370
  80. package/.next/server/pages/account.js.nft.json +0 -1
  81. package/.next/server/pages/api/graphql.js +0 -365
  82. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  83. package/.next/server/pages/api/preview.js +0 -119
  84. package/.next/server/pages/api/preview.js.nft.json +0 -1
  85. package/.next/server/pages/checkout.js +0 -370
  86. package/.next/server/pages/checkout.js.nft.json +0 -1
  87. package/.next/server/pages/en-US/404.html +0 -81
  88. package/.next/server/pages/en-US/404.json +0 -1
  89. package/.next/server/pages/en-US/500.html +0 -81
  90. package/.next/server/pages/en-US/500.json +0 -1
  91. package/.next/server/pages/en-US/account.html +0 -81
  92. package/.next/server/pages/en-US/account.json +0 -1
  93. package/.next/server/pages/en-US/checkout.html +0 -81
  94. package/.next/server/pages/en-US/checkout.json +0 -1
  95. package/.next/server/pages/en-US/login.html +0 -81
  96. package/.next/server/pages/en-US/login.json +0 -1
  97. package/.next/server/pages/en-US/s.html +0 -81
  98. package/.next/server/pages/en-US/s.json +0 -1
  99. package/.next/server/pages/en-US.html +0 -81
  100. package/.next/server/pages/en-US.json +0 -1
  101. package/.next/server/pages/index.js +0 -966
  102. package/.next/server/pages/index.js.nft.json +0 -1
  103. package/.next/server/pages/login.js +0 -375
  104. package/.next/server/pages/login.js.nft.json +0 -1
  105. package/.next/server/pages/s.js +0 -473
  106. package/.next/server/pages/s.js.nft.json +0 -1
  107. package/.next/server/pages-manifest.json +0 -16
  108. package/.next/server/webpack-api-runtime.js +0 -229
  109. package/.next/server/webpack-runtime.js +0 -229
  110. package/.next/static/chunks/0-82274e07cb857231.js +0 -1
  111. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  112. package/.next/static/chunks/226.b57e10ad9932f88c.js +0 -1
  113. package/.next/static/chunks/240-8e66b2892f9d8c40.js +0 -1
  114. package/.next/static/chunks/336.0846f48eccce57e4.js +0 -1
  115. package/.next/static/chunks/377-891ff95d759cb061.js +0 -1
  116. package/.next/static/chunks/391-47b923ef44945418.js +0 -1
  117. package/.next/static/chunks/495.0ecd099878b2a36d.js +0 -1
  118. package/.next/static/chunks/502.eeca300cb9a355fb.js +0 -1
  119. package/.next/static/chunks/545-1d3d08edfd2ee4c6.js +0 -1
  120. package/.next/static/chunks/597.57a8984b6a1071ae.js +0 -1
  121. package/.next/static/chunks/64.ebbe1d2b40f980c7.js +0 -1
  122. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  123. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  124. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  125. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  126. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  127. package/.next/static/chunks/pages/404-459452495a0df278.js +0 -1
  128. package/.next/static/chunks/pages/500-008e30c48eceebed.js +0 -1
  129. package/.next/static/chunks/pages/[...slug]-e9d8386ff5e56d85.js +0 -1
  130. package/.next/static/chunks/pages/[slug]/p-8346514a688bf869.js +0 -1
  131. package/.next/static/chunks/pages/_app-78846ca9151cf266.js +0 -1
  132. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  133. package/.next/static/chunks/pages/account-46263f0c100c3eae.js +0 -1
  134. package/.next/static/chunks/pages/checkout-20bb3710b24df3b6.js +0 -1
  135. package/.next/static/chunks/pages/index-2006be8f08ad057f.js +0 -1
  136. package/.next/static/chunks/pages/login-f9d316d261fcc062.js +0 -1
  137. package/.next/static/chunks/pages/s-1cbe740b5b781d28.js +0 -1
  138. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  139. package/.next/static/chunks/webpack-e9bf82a67cc08d0f.js +0 -1
  140. package/.next/static/css/13a4da555ff5e3be.css +0 -1
  141. package/.next/static/css/287f5ba239375052.css +0 -1
  142. package/.next/static/css/28d7d73e13e2bc1d.css +0 -1
  143. package/.next/static/css/2e00f7ba49c754b3.css +0 -1
  144. package/.next/static/css/47d82dcec9a7dbc2.css +0 -1
  145. package/.next/static/css/6e41f1b6078c14c1.css +0 -1
  146. package/.next/static/css/7d822a137c54a781.css +0 -1
  147. package/.next/static/css/c6f97f692b2efad9.css +0 -1
  148. package/.next/static/css/d4a0d9df8c6df555.css +0 -1
  149. package/.next/static/css/e02cdad8fc000339.css +0 -1
  150. package/.next/static/zYvKRrlOU3r6IZCy0a0eY/_buildManifest.js +0 -1
  151. package/.next/static/zYvKRrlOU3r6IZCy0a0eY/_ssgManifest.js +0 -1
  152. package/.next/trace +0 -70
  153. package/public/~partytown/debug/partytown-atomics.js +0 -556
  154. package/public/~partytown/debug/partytown-media.js +0 -374
  155. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  156. package/public/~partytown/debug/partytown-sw.js +0 -59
  157. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  158. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  159. package/public/~partytown/debug/partytown.js +0 -72
  160. package/public/~partytown/partytown-atomics.js +0 -2
  161. package/public/~partytown/partytown-media.js +0 -2
  162. package/public/~partytown/partytown-sw.js +0 -2
  163. package/public/~partytown/partytown.js +0 -2
  164. package/src/components/common/RegionBar/RegionBar.tsx +0 -17
  165. /package/src/components/{common → sections}/RegionBar/index.ts +0 -0
  166. /package/src/components/{common → sections}/RegionBar/section.module.scss +0 -0
@@ -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
- zYvKRrlOU3r6IZCy0a0eY
@@ -1,132 +0,0 @@
1
- {
2
- "polyfillFiles": [
3
- "static/chunks/polyfills-c67a75d1b6f99dc8.js"
4
- ],
5
- "devFiles": [],
6
- "ampDevFiles": [],
7
- "lowPriorityFiles": [
8
- "static/zYvKRrlOU3r6IZCy0a0eY/_buildManifest.js",
9
- "static/zYvKRrlOU3r6IZCy0a0eY/_ssgManifest.js"
10
- ],
11
- "rootMainFiles": [],
12
- "pages": {
13
- "/": [
14
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
15
- "static/chunks/framework-dfd14d7ce6600b03.js",
16
- "static/chunks/main-fd466221927468fd.js",
17
- "static/chunks/391-47b923ef44945418.js",
18
- "static/chunks/545-1d3d08edfd2ee4c6.js",
19
- "static/css/28d7d73e13e2bc1d.css",
20
- "static/chunks/377-891ff95d759cb061.js",
21
- "static/css/287f5ba239375052.css",
22
- "static/chunks/240-8e66b2892f9d8c40.js",
23
- "static/css/13a4da555ff5e3be.css",
24
- "static/chunks/pages/index-2006be8f08ad057f.js"
25
- ],
26
- "/404": [
27
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
28
- "static/chunks/framework-dfd14d7ce6600b03.js",
29
- "static/chunks/main-fd466221927468fd.js",
30
- "static/chunks/391-47b923ef44945418.js",
31
- "static/chunks/545-1d3d08edfd2ee4c6.js",
32
- "static/css/28d7d73e13e2bc1d.css",
33
- "static/chunks/377-891ff95d759cb061.js",
34
- "static/css/e02cdad8fc000339.css",
35
- "static/chunks/pages/404-459452495a0df278.js"
36
- ],
37
- "/500": [
38
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
39
- "static/chunks/framework-dfd14d7ce6600b03.js",
40
- "static/chunks/main-fd466221927468fd.js",
41
- "static/chunks/391-47b923ef44945418.js",
42
- "static/chunks/545-1d3d08edfd2ee4c6.js",
43
- "static/css/28d7d73e13e2bc1d.css",
44
- "static/chunks/377-891ff95d759cb061.js",
45
- "static/css/e02cdad8fc000339.css",
46
- "static/chunks/pages/500-008e30c48eceebed.js"
47
- ],
48
- "/[...slug]": [
49
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
50
- "static/chunks/framework-dfd14d7ce6600b03.js",
51
- "static/chunks/main-fd466221927468fd.js",
52
- "static/chunks/391-47b923ef44945418.js",
53
- "static/chunks/545-1d3d08edfd2ee4c6.js",
54
- "static/css/28d7d73e13e2bc1d.css",
55
- "static/chunks/377-891ff95d759cb061.js",
56
- "static/css/d4a0d9df8c6df555.css",
57
- "static/chunks/0-82274e07cb857231.js",
58
- "static/css/6e41f1b6078c14c1.css",
59
- "static/chunks/pages/[...slug]-e9d8386ff5e56d85.js"
60
- ],
61
- "/[slug]/p": [
62
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
63
- "static/chunks/framework-dfd14d7ce6600b03.js",
64
- "static/chunks/main-fd466221927468fd.js",
65
- "static/chunks/391-47b923ef44945418.js",
66
- "static/chunks/545-1d3d08edfd2ee4c6.js",
67
- "static/css/28d7d73e13e2bc1d.css",
68
- "static/chunks/377-891ff95d759cb061.js",
69
- "static/css/287f5ba239375052.css",
70
- "static/chunks/240-8e66b2892f9d8c40.js",
71
- "static/css/c6f97f692b2efad9.css",
72
- "static/chunks/pages/[slug]/p-8346514a688bf869.js"
73
- ],
74
- "/_app": [
75
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
76
- "static/chunks/framework-dfd14d7ce6600b03.js",
77
- "static/chunks/main-fd466221927468fd.js",
78
- "static/css/47d82dcec9a7dbc2.css",
79
- "static/chunks/pages/_app-78846ca9151cf266.js"
80
- ],
81
- "/_error": [
82
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
83
- "static/chunks/framework-dfd14d7ce6600b03.js",
84
- "static/chunks/main-fd466221927468fd.js",
85
- "static/chunks/pages/_error-a7a0c1d9bfbb4f38.js"
86
- ],
87
- "/account": [
88
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
89
- "static/chunks/framework-dfd14d7ce6600b03.js",
90
- "static/chunks/main-fd466221927468fd.js",
91
- "static/chunks/391-47b923ef44945418.js",
92
- "static/chunks/545-1d3d08edfd2ee4c6.js",
93
- "static/css/28d7d73e13e2bc1d.css",
94
- "static/chunks/377-891ff95d759cb061.js",
95
- "static/chunks/pages/account-46263f0c100c3eae.js"
96
- ],
97
- "/checkout": [
98
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
99
- "static/chunks/framework-dfd14d7ce6600b03.js",
100
- "static/chunks/main-fd466221927468fd.js",
101
- "static/chunks/391-47b923ef44945418.js",
102
- "static/chunks/545-1d3d08edfd2ee4c6.js",
103
- "static/css/28d7d73e13e2bc1d.css",
104
- "static/chunks/377-891ff95d759cb061.js",
105
- "static/chunks/pages/checkout-20bb3710b24df3b6.js"
106
- ],
107
- "/login": [
108
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
109
- "static/chunks/framework-dfd14d7ce6600b03.js",
110
- "static/chunks/main-fd466221927468fd.js",
111
- "static/chunks/391-47b923ef44945418.js",
112
- "static/chunks/545-1d3d08edfd2ee4c6.js",
113
- "static/css/28d7d73e13e2bc1d.css",
114
- "static/chunks/377-891ff95d759cb061.js",
115
- "static/css/e02cdad8fc000339.css",
116
- "static/chunks/pages/login-f9d316d261fcc062.js"
117
- ],
118
- "/s": [
119
- "static/chunks/webpack-e9bf82a67cc08d0f.js",
120
- "static/chunks/framework-dfd14d7ce6600b03.js",
121
- "static/chunks/main-fd466221927468fd.js",
122
- "static/chunks/391-47b923ef44945418.js",
123
- "static/chunks/545-1d3d08edfd2ee4c6.js",
124
- "static/css/28d7d73e13e2bc1d.css",
125
- "static/chunks/377-891ff95d759cb061.js",
126
- "static/css/d4a0d9df8c6df555.css",
127
- "static/chunks/0-82274e07cb857231.js",
128
- "static/chunks/pages/s-1cbe740b5b781d28.js"
129
- ]
130
- },
131
- "ampFirstPages": []
132
- }