@faststore/core 3.54.0 → 3.55.1

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 (40) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +21 -21
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/webpack/client-production/0.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/server-production/0.pack +0 -0
  8. package/.next/cache/webpack/server-production/index.pack +0 -0
  9. package/.next/prerender-manifest.js +1 -1
  10. package/.next/prerender-manifest.json +1 -1
  11. package/.next/react-loadable-manifest.json +1 -1
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/948.js +2 -2
  14. package/.next/server/chunks/9563.js +2 -2
  15. package/.next/server/functions-config-manifest.json +1 -1
  16. package/.next/server/middleware-build-manifest.js +1 -1
  17. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  18. package/.next/server/pages/account/orders/[id].js +1 -1
  19. package/.next/server/pages/account/orders.js +1 -1
  20. package/.next/server/pages/api/graphql.js +2 -2
  21. package/.next/server/pages/en-US/404.html +2 -2
  22. package/.next/server/pages/en-US/500.html +2 -2
  23. package/.next/server/pages/en-US/checkout.html +2 -2
  24. package/.next/server/pages/en-US/login.html +2 -2
  25. package/.next/server/pages/en-US/s.html +2 -2
  26. package/.next/server/pages/en-US.html +2 -2
  27. package/.next/server/pages-manifest.json +1 -1
  28. package/.next/static/chunks/{1552.2705dd1ff3aee879.js → 1552.8751332da83cadc5.js} +1 -1
  29. package/.next/static/chunks/{webpack-987a16947917790e.js → webpack-2804c9decdb79470.js} +1 -1
  30. package/.next/trace +128 -128
  31. package/.turbo/turbo-build.log +9 -9
  32. package/.turbo/turbo-test.log +6 -5
  33. package/CHANGELOG.md +10 -0
  34. package/package.json +3 -3
  35. package/src/pages/account/orders/[id].tsx +4 -5
  36. package/src/pages/account/orders/index.tsx +5 -1
  37. package/src/server/index.ts +1 -1
  38. package/src/utils/utilities.ts +24 -0
  39. /package/.next/static/{LTAs1lUSVtxbUNuFJ8vEZ → eR4-YJI-39OcYKLt6rn9K}/_buildManifest.js +0 -0
  40. /package/.next/static/{LTAs1lUSVtxbUNuFJ8vEZ → eR4-YJI-39OcYKLt6rn9K}/_ssgManifest.js +0 -0
@@ -1,23 +1,23 @@
1
1
 
2
- > @faststore/core@3.53.0 prebuild /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.55.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.53.0 partytown /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@3.55.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.53.0 generate /home/runner/work/faststore/faststore/packages/core
11
+ > @faststore/core@3.55.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.53.0 generate:schema /home/runner/work/faststore/faststore/packages/core
15
+ > @faststore/core@3.55.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.53.0 generate:codegen /home/runner/work/faststore/faststore/packages/core
20
+ > @faststore/core@3.55.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.53.0 format:generated /home/runner/work/faststore/faststore/packages/core
40
+ > @faststore/core@3.55.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.53.0 build /home/runner/work/faststore/faststore/packages/core
44
+ > @faststore/core@3.55.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-987a16947917790e.js 3.7 kB
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)
@@ -1,14 +1,15 @@
1
1
 
2
- > @faststore/core@3.53.0 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.55.0 test /home/runner/work/faststore/faststore/packages/core
3
3
  > jest
4
4
 
5
- PASS test/server/cms/global.test.ts (23.762 s)
6
- PASS test/utils/multipleTemplates.test.ts (24.336 s)
5
+ PASS test/server/cms/global.test.ts (25.256 s)
6
+ PASS test/utils/multipleTemplates.test.ts (26.551 s)
7
7
  PASS test/server/cms/index.test.ts
8
- PASS test/server/index.test.ts (29.264 s)
8
+ PASS test/server/index.test.ts (30.761 s)
9
+ A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
9
10
 
10
11
  Test Suites: 4 passed, 4 total
11
12
  Tests: 22 passed, 22 total
12
13
  Snapshots: 0 total
13
- Time: 30.472 s
14
+ Time: 32.191 s
14
15
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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.1](https://github.com/vtex/faststore/compare/v3.55.0...v3.55.1) (2025-06-18)
7
+
8
+ **Note:** Version bump only for package @faststore/core
9
+
10
+ # [3.55.0](https://github.com/vtex/faststore/compare/v3.54.0...v3.55.0) (2025-06-18)
11
+
12
+ ### Features
13
+
14
+ - extract error status handling and improve error messages ([#2903](https://github.com/vtex/faststore/issues/2903)) ([26c1eea](https://github.com/vtex/faststore/commit/26c1eea2278ce2364d8bcc45bf8d261e97cb3fa8))
15
+
6
16
  # [3.54.0](https://github.com/vtex/faststore/compare/v3.53.0...v3.54.0) (2025-06-17)
7
17
 
8
18
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.54.0",
3
+ "version": "3.55.1",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -44,7 +44,7 @@
44
44
  "@envelop/graphql-jit": "^8.0.3",
45
45
  "@envelop/parser-cache": "^6.0.2",
46
46
  "@envelop/validation-cache": "^6.0.2",
47
- "@faststore/api": "^3.54.0",
47
+ "@faststore/api": "^3.55.1",
48
48
  "@faststore/graphql-utils": "^3.50.3",
49
49
  "@faststore/lighthouse": "^3.50.3",
50
50
  "@faststore/sdk": "^3.50.3",
@@ -105,5 +105,5 @@
105
105
  "ts-jest": "29.1.1",
106
106
  "typescript": "5.3.2"
107
107
  },
108
- "gitHead": "278751e5994148f1b5e4ae94031f98b72b05a6be"
108
+ "gitHead": "7dff220d4440a5b13ba2a11386a159775db10193"
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 statusCode: number = (orderDetails.errors[0] as any)?.extensions
249
- ?.status
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
  }
@@ -48,7 +48,7 @@ const customFormatError: MaskError = (err) => {
48
48
 
49
49
  console.error(err)
50
50
 
51
- return new GraphQLError('Sorry, something went wrong.')
51
+ return new GraphQLError(`Sorry, something went wrong. ${err}`)
52
52
  }
53
53
 
54
54
  function loadGeneratedSchema(): TypeSource {
@@ -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
+ }