@faststore/core 0.2.1 → 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,13 @@ 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
+
8
15
  ### [0.2.1](https://github.com/vtex-sites/nextjs.store/compare/0.2.0...0.2.1) (2022-10-28)
9
16
 
10
17
 
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -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')