@faststore/core 2.2.0-alpha.9 → 2.2.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.
- package/.turbo/turbo-build.log +14 -11
- package/.turbo/turbo-lint.log +2 -4
- package/.turbo/turbo-test.log +9 -9
- package/cms/faststore/sections.json +8 -8
- package/next.config.js +4 -0
- package/package.json +9 -9
- package/src/components/sections/CrossSellingShelf/CrossSellingShelf.tsx +3 -3
- package/src/components/ui/ProductDescription/ProductDescription.tsx +6 -1
- package/src/components/ui/ProductShelf/ProductShelf.tsx +3 -2
- package/src/experimental/index.ts +2 -24
- package/src/sdk/shipping/useShippingSimulation.ts +5 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -3,6 +3,9 @@ $ partytown copylib ./public/~partytown
|
|
|
3
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
|
+
warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
|
|
7
|
+
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
|
|
8
|
+
|
|
6
9
|
warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
|
|
7
10
|
Attention: Next.js now collects completely anonymous telemetry regarding usage.
|
|
8
11
|
This information is used to shape Next.js' roadmap and prioritize features.
|
|
@@ -24,27 +27,27 @@ info - Finalizing page optimization...
|
|
|
24
27
|
|
|
25
28
|
Route (pages) Size First Load JS
|
|
26
29
|
┌ ● / 8.27 kB 126 kB
|
|
27
|
-
├ /_app 0 B
|
|
30
|
+
├ /_app 0 B 78.1 kB
|
|
28
31
|
├ ● /[...slug] 4.29 kB 139 kB
|
|
29
32
|
├ └ css/527e334fa69cf40a.css 1.85 kB
|
|
30
33
|
├ ● /[slug]/p 11 kB 135 kB
|
|
31
|
-
├ └ css/
|
|
34
|
+
├ └ css/9f79fa103f49bca1.css 11.5 kB
|
|
32
35
|
├ ○ /404 1.19 kB 110 kB
|
|
33
36
|
├ ● /500 1.21 kB 110 kB
|
|
34
37
|
├ ● /account 668 B 110 kB
|
|
35
|
-
├ λ /api/graphql 0 B
|
|
36
|
-
├ λ /api/health/live 0 B
|
|
37
|
-
├ λ /api/health/ready 0 B
|
|
38
|
-
├ λ /api/preview 0 B
|
|
38
|
+
├ λ /api/graphql 0 B 78.1 kB
|
|
39
|
+
├ λ /api/health/live 0 B 78.1 kB
|
|
40
|
+
├ λ /api/health/ready 0 B 78.1 kB
|
|
41
|
+
├ λ /api/preview 0 B 78.1 kB
|
|
39
42
|
├ ● /checkout 655 B 110 kB
|
|
40
43
|
├ ● /login 1.09 kB 110 kB
|
|
41
|
-
└ ● /s 4.57 kB
|
|
42
|
-
+ First Load JS shared by all 81 kB
|
|
44
|
+
└ ● /s 4.57 kB 125 kB
|
|
45
|
+
+ First Load JS shared by all 81.2 kB
|
|
43
46
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
44
|
-
├ chunks/main-
|
|
47
|
+
├ chunks/main-e4e873ee741162eb.js 24.1 kB
|
|
45
48
|
├ chunks/pages/_app-7db7de3d205714be.js 6.45 kB
|
|
46
|
-
├ chunks/webpack-
|
|
47
|
-
└ css/
|
|
49
|
+
├ chunks/webpack-4bb3d8db2d6302ef.js 2.25 kB
|
|
50
|
+
└ css/5d1f64b61ea581f4.css 3.06 kB
|
|
48
51
|
|
|
49
52
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
|
50
53
|
○ (Static) automatically rendered as static HTML (uses no initial props)
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
$ next lint
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
|
|
5
|
-
https://nextjs.org/telemetry
|
|
2
|
+
warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
|
|
3
|
+
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
|
|
6
4
|
|
|
7
5
|
✔ No ESLint warnings or errors
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
$ tsdx test
|
|
2
2
|
ts-jest[versions] (WARN) Version 29.1.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
3
3
|
ts-jest[versions] (WARN) Version 4.9.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.4.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
4
|
-
PASS test/server/index.test.ts (
|
|
4
|
+
PASS test/server/index.test.ts (8.223s)
|
|
5
5
|
FastStore GraphQL Layer
|
|
6
6
|
@faststore/api
|
|
7
|
-
✓ should return a valid GraphQL schema (
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
9
|
-
✓ should return a valid GraphQL schema contain all expected queries (
|
|
7
|
+
✓ should return a valid GraphQL schema (6ms)
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected types (5ms)
|
|
9
|
+
✓ should return a valid GraphQL schema contain all expected queries (1ms)
|
|
10
10
|
✓ should return a valid GraphQL schema contain all expected mutations
|
|
11
11
|
VTEX API Extension
|
|
12
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
12
|
+
✓ getTypeDefsFromFolder function should return an Array (6ms)
|
|
13
13
|
Third Party API Extension
|
|
14
14
|
✓ getTypeDefsFromFolder function should return an Array (6ms)
|
|
15
15
|
Final Schema after merging
|
|
16
|
-
✓ should return a valid merged GraphQL schema (
|
|
16
|
+
✓ should return a valid merged GraphQL schema (39ms)
|
|
17
17
|
Envelop
|
|
18
|
-
✓ should exist with its plugins (
|
|
19
|
-
✓ should handle options and execute (
|
|
18
|
+
✓ should exist with its plugins (33ms)
|
|
19
|
+
✓ should handle options and execute (88ms)
|
|
20
20
|
|
|
21
21
|
Test Suites: 1 passed, 1 total
|
|
22
22
|
Tests: 9 passed, 9 total
|
|
23
23
|
Snapshots: 0 total
|
|
24
|
-
Time:
|
|
24
|
+
Time: 8.873s
|
|
25
25
|
Ran all test suites.
|
|
@@ -830,17 +830,17 @@
|
|
|
830
830
|
"title": "Product Shelf",
|
|
831
831
|
"description": "Add custom shelves to your store",
|
|
832
832
|
"type": "object",
|
|
833
|
-
"required": ["title", "
|
|
833
|
+
"required": ["title", "numberOfItems", "after", "sort"],
|
|
834
834
|
"properties": {
|
|
835
835
|
"title": {
|
|
836
836
|
"type": "string",
|
|
837
837
|
"title": "Title"
|
|
838
838
|
},
|
|
839
|
-
"
|
|
839
|
+
"numberOfItems": {
|
|
840
840
|
"type": "integer",
|
|
841
|
-
"title": "
|
|
841
|
+
"title": "Total number of items",
|
|
842
842
|
"default": 5,
|
|
843
|
-
"description": "
|
|
843
|
+
"description": "Total number of items. The quantity may be smaller if the query returns fewer products."
|
|
844
844
|
},
|
|
845
845
|
"after": {
|
|
846
846
|
"type": "integer",
|
|
@@ -925,17 +925,17 @@
|
|
|
925
925
|
"title": "Cross Selling Shelf",
|
|
926
926
|
"description": "Add cross selling product data to your users",
|
|
927
927
|
"type": "object",
|
|
928
|
-
"required": ["title", "
|
|
928
|
+
"required": ["title", "numberOfItems", "kind"],
|
|
929
929
|
"properties": {
|
|
930
930
|
"title": {
|
|
931
931
|
"title": "Title",
|
|
932
932
|
"type": "string"
|
|
933
933
|
},
|
|
934
|
-
"
|
|
935
|
-
"title": "
|
|
934
|
+
"numberOfItems": {
|
|
935
|
+
"title": "Total number of items",
|
|
936
936
|
"type": "integer",
|
|
937
937
|
"default": 5,
|
|
938
|
-
"description": "
|
|
938
|
+
"description": "Total number of items. The quantity may be smaller if the query returns fewer products."
|
|
939
939
|
},
|
|
940
940
|
"kind": {
|
|
941
941
|
"title": "Kind",
|
package/next.config.js
CHANGED
|
@@ -18,6 +18,10 @@ const nextConfig = {
|
|
|
18
18
|
sassOptions: {
|
|
19
19
|
additionalData: `@import "src/customizations/styles/custom-mixins.scss";`,
|
|
20
20
|
},
|
|
21
|
+
// TODO: We won't need to enable this experimental feature when migrating to Next.js 13
|
|
22
|
+
experimental: {
|
|
23
|
+
scrollRestoration: true,
|
|
24
|
+
},
|
|
21
25
|
webpack: (config, { isServer, dev }) => {
|
|
22
26
|
// https://github.com/vercel/next.js/discussions/11267#discussioncomment-2479112
|
|
23
27
|
// camel-case style names from css modules
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"browserslist": "supports es6-module and not dead",
|
|
6
6
|
"exports": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@envelop/graphql-jit": "^1.1.1",
|
|
39
39
|
"@envelop/parser-cache": "^2.2.0",
|
|
40
40
|
"@envelop/validation-cache": "^2.2.0",
|
|
41
|
-
"@faststore/api": "^2.2.0
|
|
42
|
-
"@faststore/components": "^2.2.0
|
|
43
|
-
"@faststore/graphql-utils": "^2.2.0
|
|
44
|
-
"@faststore/sdk": "^2.2.0
|
|
45
|
-
"@faststore/ui": "^2.2.0
|
|
41
|
+
"@faststore/api": "^2.2.0",
|
|
42
|
+
"@faststore/components": "^2.2.0",
|
|
43
|
+
"@faststore/graphql-utils": "^2.2.0",
|
|
44
|
+
"@faststore/sdk": "^2.2.0",
|
|
45
|
+
"@faststore/ui": "^2.2.0",
|
|
46
46
|
"@graphql-codegen/cli": "^3.3.1",
|
|
47
47
|
"@graphql-codegen/typescript": "^3.0.4",
|
|
48
48
|
"@graphql-codegen/typescript-operations": "^3.0.4",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@cypress/code-coverage": "^3.12.1",
|
|
82
82
|
"@envelop/testing": "^6.0.0",
|
|
83
|
-
"@faststore/cli": "^2.2.0
|
|
84
|
-
"@faststore/eslint-config": "^2.2.0
|
|
83
|
+
"@faststore/cli": "^2.2.0",
|
|
84
|
+
"@faststore/eslint-config": "^2.2.0",
|
|
85
85
|
"@faststore/lighthouse": "^1.12.32",
|
|
86
86
|
"@lhci/cli": "^0.9.0",
|
|
87
87
|
"@storybook/addon-a11y": "^6.5.9",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"msw": {
|
|
130
130
|
"workerDirectory": "public"
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "d79a95a1c4cf1e59eb699418419027b8647c45f1"
|
|
133
133
|
}
|
|
@@ -7,12 +7,12 @@ import styles from '../ProductShelf/section.module.scss'
|
|
|
7
7
|
import Section from '../Section'
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
|
-
|
|
10
|
+
numberOfItems: number
|
|
11
11
|
title: string
|
|
12
12
|
kind: 'buy' | 'view'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const CrossSellingShelf = ({
|
|
15
|
+
const CrossSellingShelf = ({ numberOfItems, title, kind }: Props) => {
|
|
16
16
|
const { ref, inView } = useInView()
|
|
17
17
|
const context = usePDP()
|
|
18
18
|
const productGroupID = context?.data?.product?.isVariantOf?.productGroupID
|
|
@@ -29,7 +29,7 @@ const CrossSellingShelf = ({ items: first, title, kind }: Props) => {
|
|
|
29
29
|
>
|
|
30
30
|
<UIProductShelf
|
|
31
31
|
inView={inView}
|
|
32
|
-
|
|
32
|
+
numberOfItems={numberOfItems}
|
|
33
33
|
title={title}
|
|
34
34
|
selectedFacets={selectedFacets}
|
|
35
35
|
/>
|
|
@@ -77,7 +77,12 @@ function ProductDescription({
|
|
|
77
77
|
>
|
|
78
78
|
<UIAccordionButton>{title}</UIAccordionButton>
|
|
79
79
|
<UIAccordionPanel>
|
|
80
|
-
<
|
|
80
|
+
<div
|
|
81
|
+
// Applies display: contents through FastStore UI
|
|
82
|
+
data-fs-product-details-description-content
|
|
83
|
+
// The content is already sanitized by FastStore API
|
|
84
|
+
dangerouslySetInnerHTML={{ __html: content }}
|
|
85
|
+
/>
|
|
81
86
|
</UIAccordionPanel>
|
|
82
87
|
</UIAccordionItem>
|
|
83
88
|
))}
|
|
@@ -23,7 +23,7 @@ type Sort =
|
|
|
23
23
|
|
|
24
24
|
export type ProductShelfProps = {
|
|
25
25
|
title: string
|
|
26
|
-
|
|
26
|
+
numberOfItems?: number
|
|
27
27
|
after?: string
|
|
28
28
|
sort?: Sort
|
|
29
29
|
term?: string
|
|
@@ -45,12 +45,13 @@ function ProductShelf({
|
|
|
45
45
|
bordered = ProductCard.props.bordered,
|
|
46
46
|
showDiscountBadge = ProductCard.props.showDiscountBadge,
|
|
47
47
|
} = {},
|
|
48
|
+
numberOfItems,
|
|
48
49
|
...otherProps
|
|
49
50
|
}: ProductShelfProps) {
|
|
50
51
|
const titleId = textToKebabCase(title)
|
|
51
52
|
const id = useId()
|
|
52
53
|
const viewedOnce = useRef(false)
|
|
53
|
-
const data = useProductsQuery(otherProps)
|
|
54
|
+
const data = useProductsQuery({ first: numberOfItems, ...otherProps })
|
|
54
55
|
const products = data?.search?.products
|
|
55
56
|
const productEdges = products?.edges ?? []
|
|
56
57
|
const aspectRatio = 1
|
|
@@ -1,58 +1,36 @@
|
|
|
1
|
+
// SDK
|
|
1
2
|
export {
|
|
2
3
|
useSession as useSession_unstable,
|
|
3
4
|
sessionStore as sessionStore_unstable,
|
|
4
5
|
validateSession as validateSession_unstable,
|
|
5
6
|
} from '../../src/sdk/session'
|
|
6
|
-
|
|
7
7
|
export {
|
|
8
8
|
useCart as useCart_unstable,
|
|
9
9
|
cartStore as cartStore_unstable,
|
|
10
10
|
} from '../../src/sdk/cart'
|
|
11
|
-
|
|
12
11
|
export type { CartItem, Cart } from '../../src/sdk/cart'
|
|
13
|
-
|
|
14
12
|
export { useBuyButton as useBuyButton_unstable } from '../../src/sdk/cart/useBuyButton'
|
|
15
|
-
|
|
16
13
|
export { useCartToggleButton as useCartToggleButton_unstable } from '../../src/sdk/cart/useCartToggleButton'
|
|
17
|
-
|
|
18
14
|
export { useCheckoutButton as useCheckoutButton_unstable } from '../../src/sdk/cart/useCheckoutButton'
|
|
19
|
-
|
|
20
15
|
export { useRemoveButton as useRemoveButton_unstable } from '../../src/sdk/cart/useRemoveButton'
|
|
21
|
-
|
|
22
16
|
export { useQuery as useQuery_unstable } from '../../src/sdk/graphql/useQuery'
|
|
23
|
-
|
|
24
17
|
export { useLazyQuery as useLazyQuery_unstable } from '../../src/sdk/graphql/useLazyQuery'
|
|
25
|
-
|
|
26
18
|
export { useNewsletter as useNewsletter_unstable } from '../../src/sdk/newsletter/useNewsletter'
|
|
27
|
-
|
|
28
19
|
export { useDiscountPercent as useDiscountPercent_unstable } from '../../src/sdk/product/useDiscountPercent'
|
|
29
|
-
|
|
30
20
|
export { useFormattedPrice as useFormattedPrice_unstable } from '../../src/sdk/product/useFormattedPrice'
|
|
31
|
-
|
|
32
21
|
export { useLocalizedVariables as useLocalizedVariables_unstable } from '../../src/sdk/product/useLocalizedVariables'
|
|
33
|
-
|
|
34
22
|
export { useProductGalleryQuery as useProductGalleryQuery_unstable } from '../../src/sdk/product/useProductGalleryQuery'
|
|
35
|
-
|
|
36
23
|
export { useProductLink as useProductLink_unstable } from '../../src/sdk/product/useProductLink'
|
|
37
|
-
|
|
38
24
|
export { useProductQuery as useProductQuery_unstable } from '../../src/sdk/product/useProductQuery'
|
|
39
|
-
|
|
40
25
|
export { useProductsPrefetch as useProductsPrefetch_unstable } from '../../src/sdk/product/useProductsPrefetch'
|
|
41
|
-
|
|
42
26
|
export { default as useSearchHistory_unstable } from '../../src/sdk/search/useSearchHistory'
|
|
43
|
-
|
|
44
27
|
export { default as useSuggestions_unstable } from '../../src/sdk/search/useSuggestions'
|
|
45
|
-
|
|
46
28
|
export { default as useTopSearch_unstable } from '../../src/sdk/search/useTopSearch'
|
|
47
|
-
|
|
48
29
|
export { useFilter as useFilter_unstable } from '../../src/sdk/search/useFilter'
|
|
49
|
-
|
|
50
30
|
export { useDelayedFacets as useDelayedFacets_unstable } from '../../src/sdk/search/useDelayedFacets'
|
|
51
|
-
|
|
52
31
|
export { useDelayedPagination as useDelayedPagination_unstable } from '../../src/sdk/search/useDelayedPagination'
|
|
53
|
-
|
|
54
32
|
export { getShippingSimulation as getShippingSimulation_unstable } from '../../src/sdk/shipping'
|
|
55
|
-
|
|
56
33
|
export { useShippingSimulation as useShippingSimulation_unstable } from '../../src/sdk/shipping/useShippingSimulation'
|
|
57
34
|
|
|
35
|
+
// Components
|
|
58
36
|
export { Image as Image_unstable } from '../../src/components/ui/Image'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChangeEvent } from 'react'
|
|
2
|
-
import { useCallback, useEffect, useReducer } from 'react'
|
|
2
|
+
import { useCallback, useEffect, useReducer, useRef } from 'react'
|
|
3
3
|
import { ClientShippingSimulationQueryQuery } from '@generated/graphql'
|
|
4
4
|
import getShippingSimulation from '.'
|
|
5
5
|
import { useSession } from '../session'
|
|
@@ -108,9 +108,11 @@ export const useShippingSimulation = (shippingItem: ProductShippingInfo) => {
|
|
|
108
108
|
|
|
109
109
|
const { country, postalCode: sessionPostalCode } = useSession()
|
|
110
110
|
const { postalCode: shippingPostalCode } = input
|
|
111
|
+
const shippingPostalCodeRef = useRef(shippingPostalCode)
|
|
111
112
|
|
|
112
113
|
useEffect(() => {
|
|
113
|
-
|
|
114
|
+
const shouldFetch = sessionPostalCode && !shippingPostalCodeRef.current
|
|
115
|
+
if (!shouldFetch) {
|
|
114
116
|
return
|
|
115
117
|
}
|
|
116
118
|
|
|
@@ -137,7 +139,7 @@ export const useShippingSimulation = (shippingItem: ProductShippingInfo) => {
|
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
fetchShipping()
|
|
140
|
-
}, [country, sessionPostalCode, shippingItem
|
|
142
|
+
}, [country, sessionPostalCode, shippingItem])
|
|
141
143
|
|
|
142
144
|
const handleSubmit = useCallback(async () => {
|
|
143
145
|
try {
|