@faststore/core 3.54.0 → 3.55.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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +21 -21
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/948.js +2 -2
- package/.next/server/chunks/9563.js +1 -1
- package/.next/server/functions-config-manifest.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/account/orders/[id].js +1 -1
- package/.next/server/pages/account/orders.js +1 -1
- package/.next/server/pages/api/graphql.js +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{1552.2705dd1ff3aee879.js → 1552.8751332da83cadc5.js} +1 -1
- package/.next/static/chunks/{webpack-987a16947917790e.js → webpack-2804c9decdb79470.js} +1 -1
- package/.next/trace +128 -128
- package/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/pages/account/orders/[id].tsx +4 -5
- package/src/pages/account/orders/index.tsx +5 -1
- package/src/server/index.ts +1 -1
- package/src/utils/utilities.ts +24 -0
- /package/.next/static/{LTAs1lUSVtxbUNuFJ8vEZ → 3UM6VWLsjyPxTaOKwoL0m}/_buildManifest.js +0 -0
- /package/.next/static/{LTAs1lUSVtxbUNuFJ8vEZ → 3UM6VWLsjyPxTaOKwoL0m}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@3.
|
|
2
|
+
> @faststore/core@3.54.0 prebuild /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> na run partytown && na run generate
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@3.
|
|
6
|
+
> @faststore/core@3.54.0 partytown /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> partytown copylib ./public/~partytown
|
|
8
8
|
|
|
9
9
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
10
10
|
|
|
11
|
-
> @faststore/core@3.
|
|
11
|
+
> @faststore/core@3.54.0 generate /home/runner/work/faststore/faststore/packages/core
|
|
12
12
|
> na run generate:schema && na run generate:codegen && na run format:generated
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
> @faststore/core@3.
|
|
15
|
+
> @faststore/core@3.54.0 generate:schema /home/runner/work/faststore/faststore/packages/core
|
|
16
16
|
> tsx src/server/generator/generateGraphQLSchemaFile.ts
|
|
17
17
|
|
|
18
18
|
Schema GraphQL file generated successfully
|
|
19
19
|
|
|
20
|
-
> @faststore/core@3.
|
|
20
|
+
> @faststore/core@3.54.0 generate:codegen /home/runner/work/faststore/faststore/packages/core
|
|
21
21
|
> graphql-codegen
|
|
22
22
|
|
|
23
23
|
[STARTED] Parse Configuration
|
|
@@ -37,11 +37,11 @@ Running lifecycle hook "afterStart" scripts...
|
|
|
37
37
|
[CLI] Loading Documents
|
|
38
38
|
[CLI] Generating output
|
|
39
39
|
|
|
40
|
-
> @faststore/core@3.
|
|
40
|
+
> @faststore/core@3.54.0 format:generated /home/runner/work/faststore/faststore/packages/core
|
|
41
41
|
> prettier --write "@generated/**/*.{ts,js,tsx,jsx,json}" --loglevel error
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
> @faststore/core@3.
|
|
44
|
+
> @faststore/core@3.54.0 build /home/runner/work/faststore/faststore/packages/core
|
|
45
45
|
> next build
|
|
46
46
|
|
|
47
47
|
⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
|
|
@@ -59,8 +59,8 @@ https://nextjs.org/telemetry
|
|
|
59
59
|
Collecting page data ...
|
|
60
60
|
Generating static pages (0/6) ...
|
|
61
61
|
|
|
62
62
|
Generating static pages (1/6)
|
|
63
|
-
|
|
64
63
|
Generating static pages (2/6)
|
|
65
64
|
Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Content documentation at https://developers.vtex.com/docs/guides/faststore/dynamic-content-overview for mapping the page and the corresponding data-fetching function.
|
|
65
|
+
|
|
66
66
|
Generating static pages (2/6)
|
|
67
67
|
|
|
68
68
|
Generating static pages (4/6)
|
|
69
69
|
|
|
70
70
|
✓ Generating static pages (6/6)
|
|
71
71
|
Finalizing page optimization ...
|
|
@@ -101,7 +101,7 @@ Route (pages) Size First Load JS
|
|
|
101
101
|
├ chunks/framework-807b0f81cbc129f0.js 45.4 kB
|
|
102
102
|
├ chunks/main-f658704b53a96ab1.js 33.1 kB
|
|
103
103
|
├ chunks/pages/_app-eb6edb0ba4b4be67.js 16.3 kB
|
|
104
|
-
├ chunks/webpack-
|
|
104
|
+
├ chunks/webpack-2804c9decdb79470.js 3.7 kB
|
|
105
105
|
└ css/0a57ee6c7a57788c.css 3.49 kB
|
|
106
106
|
|
|
107
107
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@3.
|
|
2
|
+
> @faststore/core@3.54.0 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> jest
|
|
4
4
|
|
|
5
|
-
PASS test/
|
|
6
|
-
PASS test/
|
|
5
|
+
PASS test/utils/multipleTemplates.test.ts (24.569 s)
|
|
6
|
+
PASS test/server/cms/global.test.ts (24.682 s)
|
|
7
7
|
PASS test/server/cms/index.test.ts
|
|
8
|
-
PASS test/server/index.test.ts (
|
|
8
|
+
PASS test/server/index.test.ts (28.918 s)
|
|
9
9
|
|
|
10
10
|
Test Suites: 4 passed, 4 total
|
|
11
11
|
Tests: 22 passed, 22 total
|
|
12
12
|
Snapshots: 0 total
|
|
13
|
-
Time:
|
|
13
|
+
Time: 29.882 s
|
|
14
14
|
Ran all test suites.
|
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
|
+
# [3.55.0](https://github.com/vtex/faststore/compare/v3.54.0...v3.55.0) (2025-06-18)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- extract error status handling and improve error messages ([#2903](https://github.com/vtex/faststore/issues/2903)) ([26c1eea](https://github.com/vtex/faststore/commit/26c1eea2278ce2364d8bcc45bf8d261e97cb3fa8))
|
|
11
|
+
|
|
6
12
|
# [3.54.0](https://github.com/vtex/faststore/compare/v3.53.0...v3.54.0) (2025-06-17)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.55.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"ts-jest": "29.1.1",
|
|
106
106
|
"typescript": "5.3.2"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "a1fc3b88afe7cd6ab9f0b1c81d3f834d47d80a9b"
|
|
109
109
|
}
|
|
@@ -20,6 +20,7 @@ import { default as BeforeSection } from 'src/customizations/src/myAccount/exten
|
|
|
20
20
|
import { execute } from 'src/server'
|
|
21
21
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
22
22
|
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
23
|
+
import { extractStatusFromError } from 'src/utils/utilities'
|
|
23
24
|
|
|
24
25
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
25
26
|
...GLOBAL_COMPONENTS,
|
|
@@ -245,14 +246,12 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
245
246
|
])
|
|
246
247
|
|
|
247
248
|
if (orderDetails.errors) {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const destination: string =
|
|
251
|
-
statusCode === 403 ? '/account/403' : '/account/404'
|
|
249
|
+
const status = extractStatusFromError(orderDetails.errors[0])
|
|
250
|
+
const isForbidden = status === 403 || status === 401
|
|
252
251
|
|
|
253
252
|
return {
|
|
254
253
|
redirect: {
|
|
255
|
-
destination,
|
|
254
|
+
destination: isForbidden ? '/account/403' : '/account/404',
|
|
256
255
|
permanent: false,
|
|
257
256
|
},
|
|
258
257
|
}
|
|
@@ -23,6 +23,7 @@ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
|
23
23
|
import { groupOrderStatusByLabel } from 'src/utils/userOrderStatus'
|
|
24
24
|
|
|
25
25
|
import { MyAccountListOrders } from 'src/components/account/orders/MyAccountListOrders'
|
|
26
|
+
import { extractStatusFromError } from 'src/utils/utilities'
|
|
26
27
|
|
|
27
28
|
/* A list of components that can be used in the CMS. */
|
|
28
29
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
@@ -190,9 +191,12 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
190
191
|
])
|
|
191
192
|
|
|
192
193
|
if (listOrders.errors) {
|
|
194
|
+
const status = extractStatusFromError(listOrders.errors[0])
|
|
195
|
+
const isForbidden = status === 403 || status === 401
|
|
196
|
+
|
|
193
197
|
return {
|
|
194
198
|
redirect: {
|
|
195
|
-
destination: '/account/404',
|
|
199
|
+
destination: isForbidden ? '/account/403' : '/account/404',
|
|
196
200
|
permanent: false,
|
|
197
201
|
},
|
|
198
202
|
}
|
package/src/server/index.ts
CHANGED
package/src/utils/utilities.ts
CHANGED
|
@@ -51,3 +51,27 @@ export function camelCaseToTitle(str: string): string {
|
|
|
51
51
|
const withSpaces = str.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
52
52
|
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1)
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
export function extractStatusFromError(error: any): number | undefined {
|
|
56
|
+
if (!error?.message) return undefined
|
|
57
|
+
|
|
58
|
+
const match = error.message.match(/{.*}$/)
|
|
59
|
+
if (!match) return undefined
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const parsed = JSON.parse(match[0])
|
|
63
|
+
|
|
64
|
+
if (parsed.status) {
|
|
65
|
+
return parsed.status
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (parsed.message) {
|
|
69
|
+
const inner = JSON.parse(parsed.message)
|
|
70
|
+
return inner.status
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
console.error('Failed to parse error message:', match[0])
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return undefined
|
|
77
|
+
}
|
|
File without changes
|
|
File without changes
|