@faststore/core 2.2.48 → 2.2.50
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 +13 -13
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- 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/next-server.js.nft.json +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/350.js +138 -37
- package/.next/server/chunks/585.js +3 -4
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +157 -39
- package/.next/server/pages/checkout.js.nft.json +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/account.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/index.js.nft.json +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +3 -3
- package/.next/static/chunks/{585.4c5d40fc6a72a611.js → 585.2d70151d75fdf960.js} +1 -1
- package/.next/static/chunks/{webpack-181f40c3719492e1.js → webpack-86d49ac4b093b8cf.js} +1 -1
- package/.next/trace +80 -80
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-test.log +11 -11
- package/package.json +3 -3
- package/src/pages/api/graphql.ts +29 -2
- package/src/sdk/cart/useCheckoutButton.ts +3 -3
- package/src/server/index.ts +4 -1
- /package/.next/static/{SC1Gn_fnUQSpOMSvXEqFi → 2x1XIwoqXcK0trpOG0glK}/_buildManifest.js +0 -0
- /package/.next/static/{SC1Gn_fnUQSpOMSvXEqFi → 2x1XIwoqXcK0trpOG0glK}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ yarn partytown & yarn generate && next build
|
|
2
|
-
$ faststore generate-graphql -c
|
|
3
2
|
$ partytown copylib ./public/~partytown
|
|
3
|
+
$ faststore generate-graphql -c
|
|
4
4
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
5
5
|
success - GraphQL schema, types, and optimizations successfully generated 🎉
|
|
6
6
|
warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
|
|
@@ -58,7 +58,7 @@ Route (pages) Size First Load JS
|
|
|
58
58
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
59
59
|
├ chunks/main-e4e873ee741162eb.js 24.2 kB
|
|
60
60
|
├ chunks/pages/_app-30b9666307e4b3b1.js 12.1 kB
|
|
61
|
-
├ chunks/webpack-
|
|
61
|
+
├ chunks/webpack-86d49ac4b093b8cf.js 2.27 kB
|
|
62
62
|
└ css/5d1f64b61ea581f4.css 3.05 kB
|
|
63
63
|
|
|
64
64
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
$ jest
|
|
2
|
-
PASS test/server/index.test.ts (21.
|
|
2
|
+
PASS test/server/index.test.ts (21.286 s)
|
|
3
3
|
FastStore GraphQL Layer
|
|
4
4
|
@faststore/api
|
|
5
|
-
✓ should return a valid GraphQL schema (
|
|
6
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
7
|
-
✓ should return a valid GraphQL schema contain all expected queries (
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected mutations
|
|
5
|
+
✓ should return a valid GraphQL schema (9 ms)
|
|
6
|
+
✓ should return a valid GraphQL schema contain all expected types (13 ms)
|
|
7
|
+
✓ should return a valid GraphQL schema contain all expected queries (1 ms)
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected mutations (1 ms)
|
|
9
9
|
VTEX API Extension
|
|
10
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
10
|
+
✓ getTypeDefsFromFolder function should return an Array (10 ms)
|
|
11
11
|
Third Party API Extension
|
|
12
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
12
|
+
✓ getTypeDefsFromFolder function should return an Array (18 ms)
|
|
13
13
|
Final Schema after merging
|
|
14
|
-
✓ should return a valid merged GraphQL schema (
|
|
14
|
+
✓ should return a valid merged GraphQL schema (45 ms)
|
|
15
15
|
Envelop
|
|
16
|
-
✓ should exist with its plugins (
|
|
17
|
-
✓ should handle options and execute (
|
|
16
|
+
✓ should exist with its plugins (44 ms)
|
|
17
|
+
✓ should handle options and execute (530 ms)
|
|
18
18
|
|
|
19
19
|
Test Suites: 1 passed, 1 total
|
|
20
20
|
Tests: 9 passed, 9 total
|
|
21
21
|
Snapshots: 0 total
|
|
22
|
-
Time: 21.
|
|
22
|
+
Time: 21.468 s
|
|
23
23
|
Ran all test suites.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.50",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@envelop/graphql-jit": "^1.1.1",
|
|
38
38
|
"@envelop/parser-cache": "^2.2.0",
|
|
39
39
|
"@envelop/validation-cache": "^2.2.0",
|
|
40
|
-
"@faststore/api": "^2.2.
|
|
40
|
+
"@faststore/api": "^2.2.50",
|
|
41
41
|
"@faststore/components": "^2.2.45",
|
|
42
42
|
"@faststore/graphql-utils": "^2.2.45",
|
|
43
43
|
"@faststore/sdk": "^2.2.45",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"node": "18.19.0",
|
|
124
124
|
"yarn": "1.19.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "d89ce02086b19706719b595fcb6efd68cbc430ca"
|
|
127
127
|
}
|
package/src/pages/api/graphql.ts
CHANGED
|
@@ -3,6 +3,25 @@ import type { NextApiHandler, NextApiRequest } from 'next'
|
|
|
3
3
|
|
|
4
4
|
import { execute } from '../../server'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* This function replaces the setCookie domain so that we can use localhost in dev environment.
|
|
8
|
+
*
|
|
9
|
+
* @param request NextApiRequest
|
|
10
|
+
* @param setCookie setCookie string that comes from FastStore API
|
|
11
|
+
* @returns setCookie string with it domains replace
|
|
12
|
+
*/
|
|
13
|
+
const replaceSetCookieDomain = (request: NextApiRequest, setCookie: string) => {
|
|
14
|
+
const MATCH_DOMAIN_REGEXP = /(?:^|;\s*)(?:domain=)([^;]+)/i
|
|
15
|
+
const faststoreAPIHostname = new URL(`https://${request.headers.host}`)
|
|
16
|
+
.hostname
|
|
17
|
+
|
|
18
|
+
// Replaces original cookie domain for FastStore API's domain hostname
|
|
19
|
+
return setCookie.replace(
|
|
20
|
+
MATCH_DOMAIN_REGEXP,
|
|
21
|
+
`; domain=${faststoreAPIHostname}`
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
6
25
|
const parseRequest = (request: NextApiRequest) => {
|
|
7
26
|
const { operationName, variables, query } =
|
|
8
27
|
request.method === 'POST'
|
|
@@ -59,8 +78,16 @@ const handler: NextApiHandler = async (request, response) => {
|
|
|
59
78
|
? stringifyCacheControl(extensions.cacheControl)
|
|
60
79
|
: 'no-cache, no-store'
|
|
61
80
|
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
const setCookieValues = Array.from(extensions.cookies.values())
|
|
82
|
+
if (setCookieValues.length > 0 && !hasErrors) {
|
|
83
|
+
response.setHeader(
|
|
84
|
+
'set-cookie',
|
|
85
|
+
setCookieValues.map(({ setCookie }) =>
|
|
86
|
+
process.env.NODE_ENV !== 'production'
|
|
87
|
+
? replaceSetCookieDomain(request, setCookie)
|
|
88
|
+
: setCookie
|
|
89
|
+
)
|
|
90
|
+
)
|
|
64
91
|
}
|
|
65
92
|
|
|
66
93
|
response.setHeader('cache-control', cacheControl)
|
|
@@ -2,13 +2,13 @@ import storeConfig from '../../../faststore.config'
|
|
|
2
2
|
import { useCart } from './index'
|
|
3
3
|
|
|
4
4
|
export const useCheckoutButton = () => {
|
|
5
|
-
const { isValidating
|
|
5
|
+
const { isValidating } = useCart()
|
|
6
6
|
|
|
7
7
|
const onClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
8
8
|
e.preventDefault()
|
|
9
9
|
|
|
10
|
-
if (!isValidating
|
|
11
|
-
window.location.href = `${storeConfig.checkoutUrl}
|
|
10
|
+
if (!isValidating) {
|
|
11
|
+
window.location.href = `${storeConfig.checkoutUrl}`
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
package/src/server/index.ts
CHANGED
|
@@ -84,7 +84,10 @@ export const execute = async <V extends Maybe<{ [key: string]: unknown }>, D>(
|
|
|
84
84
|
): Promise<{
|
|
85
85
|
data: D
|
|
86
86
|
errors: unknown[]
|
|
87
|
-
extensions: {
|
|
87
|
+
extensions: {
|
|
88
|
+
cacheControl?: CacheControl
|
|
89
|
+
cookies: Map<string, Record<string, string>> | null
|
|
90
|
+
}
|
|
88
91
|
}> => {
|
|
89
92
|
const { operationName, variables, query: maybeQuery } = options
|
|
90
93
|
const query = maybeQuery ?? persistedQueries.get(operationName)
|
|
File without changes
|
|
File without changes
|