@faststore/core 0.2.0 → 0.2.2

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog),
6
6
  and this project adheres to [Calendar Versioning](https://calver.org/).
7
7
 
8
+ ### [0.2.2](https://github.com/vtex-sites/nextjs.store/compare/0.2.1...0.2.2) (2022-10-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Setting postal code a 2nd time doesn't work ([#291](https://github.com/vtex-sites/nextjs.store/issues/291)) ([bc7e834](https://github.com/vtex-sites/nextjs.store/commit/bc7e8344305dc3f9a00a58da6913e6694630aba1))
14
+
15
+ ### [0.2.1](https://github.com/vtex-sites/nextjs.store/compare/0.2.0...0.2.1) (2022-10-28)
16
+
17
+
18
+ ### Chores
19
+
20
+ * make store extendable ([#293](https://github.com/vtex-sites/nextjs.store/issues/293)) ([f8c3632](https://github.com/vtex-sites/nextjs.store/commit/f8c3632740d263c8d435033678ed1591f23f0359))
21
+
8
22
  ## [0.2.0](https://github.com/vtex-sites/nextjs.store/compare/0.1.1...0.2.0) (2022-10-25)
9
23
 
10
24
 
package/README.md CHANGED
@@ -434,4 +434,4 @@ export const onRenderBody = ({ setHeadComponents }) => {
434
434
  }
435
435
  ```
436
436
 
437
- For more information about integrating third-party scripts: [Partytown Wiki](https://github.com/BuilderIO/partytown/wiki)
437
+ For more information about integrating third-party scripts: [Partytown Wiki](https://github.com/BuilderIO/partytown/wiki).
package/bun.lockb CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint --ext js,ts,jsx,tsx .",
16
16
  "stylelint": "stylelint \"**/*.scss\"",
17
17
  "stylelint:fix": "stylelint \"**/*.scss\" --fix",
18
- "postinstall": "is-ci || husky install",
18
+ "postinstall": "node postinstall.js && (is-ci || husky install) || echo Skipped postinstall step for @faststore/core",
19
19
  "partytown": "partytown copylib ./public/~partytown",
20
20
  "storybook": "start-storybook --docs -p 6006",
21
21
  "build-storybook": "build-storybook",
package/postinstall.js ADDED
@@ -0,0 +1,6 @@
1
+ if (
2
+ process.cwd().includes('node_modules') ||
3
+ process.cwd().includes('.faststore')
4
+ ) {
5
+ process.exitCode = 1
6
+ }
@@ -14,24 +14,24 @@ function RegionInput({ closeModal }: Props) {
14
14
  const [input, setInput] = useState<string>('')
15
15
 
16
16
  const handleSubmit = async () => {
17
- const value = inputRef.current?.value
17
+ const postalCode = inputRef.current?.value
18
18
 
19
- if (typeof value !== 'string') {
19
+ if (typeof postalCode !== 'string') {
20
20
  return
21
21
  }
22
22
 
23
23
  setErrorMessage('')
24
24
 
25
25
  try {
26
- const newSession = await validateSession({
26
+ const newSession = {
27
27
  ...session,
28
- postalCode: value,
29
- })
30
-
31
- if (newSession) {
32
- sessionStore.set(newSession)
28
+ postalCode,
33
29
  }
34
30
 
31
+ const validatedSession = await validateSession(newSession)
32
+
33
+ sessionStore.set(validatedSession ?? newSession)
34
+
35
35
  closeModal()
36
36
  } catch (error) {
37
37
  setErrorMessage('You entered an invalid Postal Code')
@@ -0,0 +1 @@
1
+ export default {}
@@ -0,0 +1,3 @@
1
+ // ----------------------------------------------------------
2
+ // Stores' custom themes will override this file
3
+ // ----------------------------------------------------------
@@ -14,6 +14,7 @@ import { mark } from 'src/sdk/tests/mark'
14
14
  import { execute } from 'src/server'
15
15
  import { getPage } from 'src/server/cms'
16
16
  import type { PDPContentType } from 'src/server/cms'
17
+ import CUSTOM_SECTIONS from 'src/customizations'
17
18
  import type {
18
19
  ServerProductPageQueryQuery,
19
20
  ServerProductPageQueryQueryVariables,
@@ -22,13 +23,14 @@ import type {
22
23
  import storeConfig from '../../../store.config'
23
24
 
24
25
  /**
25
- * Sections: Components imported from '../components/sections' only.
26
+ * Sections: Components imported from each store's custom components and '../components/sections' only.
26
27
  * Do not import or render components from any other folder in here.
27
28
  */
28
29
  const COMPONENTS: Record<string, ComponentType<any>> = {
29
30
  ProductDetails,
30
31
  BannerNewsletter,
31
32
  CrossSellingShelf,
33
+ ...CUSTOM_SECTIONS,
32
34
  }
33
35
 
34
36
  type Props = ServerProductPageQueryQuery & PDPContentType
@@ -4,8 +4,7 @@ import '../styles/global/typography.scss'
4
4
  import '../styles/global/layout.scss'
5
5
  import '../styles/global/components.scss'
6
6
 
7
- // Replace this with your theme style file
8
- import '../styles/themes/custom-theme.scss'
7
+ import '../customizations/themes/index.scss'
9
8
 
10
9
  import NextNProgress from 'nextjs-progressbar'
11
10
  import type { AppProps } from 'next/app'
@@ -2,7 +2,6 @@ import { Head, Html, Main, NextScript } from 'next/document'
2
2
 
3
3
  import WebFonts from 'src/fonts/WebFonts'
4
4
  import ThirdPartyScripts from 'src/components/ThirdPartyScripts'
5
- import storeConfig from 'store.config'
6
5
 
7
6
  function Document() {
8
7
  return (
@@ -11,7 +10,7 @@ function Document() {
11
10
  {!process.env.DISABLE_3P_SCRIPTS && <ThirdPartyScripts />}
12
11
  <WebFonts />
13
12
  </Head>
14
- <body className={storeConfig.theme}>
13
+ <body className="theme">
15
14
  <Main />
16
15
  <NextScript />
17
16
  </body>
@@ -13,11 +13,12 @@ import ProductTiles from 'src/components/sections/ProductTiles'
13
13
  import { mark } from 'src/sdk/tests/mark'
14
14
  import { getPage } from 'src/server/cms'
15
15
  import type { PageContentType } from 'src/server/cms'
16
+ import CUSTOM_SECTIONS from 'src/customizations'
16
17
 
17
18
  import storeConfig from '../../store.config'
18
19
 
19
20
  /**
20
- * Sections: Components imported from '../components/sections' only.
21
+ * Sections: Components imported from each store's custom components and '../components/sections'.
21
22
  * Do not import or render components from any other folder in here.
22
23
  */
23
24
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -27,6 +28,7 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
27
28
  ProductShelf,
28
29
  ProductTiles,
29
30
  Newsletter,
31
+ ...CUSTOM_SECTIONS,
30
32
  }
31
33
 
32
34
  type Props = PageContentType