@faststore/core 0.3.16 → 2.0.65-alpha.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/.storybook/storybook.css +1 -0
- package/.turbo/turbo-build.log +50 -0
- package/.turbo/turbo-lint.log +2 -0
- package/@generated/graphql/index.ts +27 -3
- package/@generated/graphql/persisted.json +1 -1
- package/CHANGELOG.md +127 -169
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +4 -4
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +9 -9
- package/package.json +9 -10
- package/src/Layout.tsx +7 -2
- package/src/components/cart/CartItem/CartItem.tsx +30 -71
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +13 -17
- package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
- package/src/components/common/Alert/Alert.tsx +6 -22
- package/src/components/common/Footer/Footer.stories.mdx +1 -1
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/FooterLinks.tsx +16 -12
- package/src/components/common/Footer/footer.module.scss +2 -28
- package/src/components/common/Footer/index.ts +1 -0
- package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +1 -1
- package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
- package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
- package/src/components/common/Toast/Toast.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +44 -59
- package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
- package/src/components/regionalization/Regionalization.stories.mdx +24 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
- package/src/components/search/Filter/Facets.stories.mdx +10 -10
- package/src/components/search/Filter/Facets.tsx +69 -61
- package/src/components/search/Filter/Filter.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.tsx +1 -1
- package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
- package/src/components/search/Filter/FilterSlider.tsx +2 -2
- package/src/components/search/Filter/facets.module.scss +16 -16
- package/src/components/search/Search.stories.mdx +28 -24
- package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
- package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
- package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
- package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
- package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
- package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
- package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
- package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
- package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
- package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
- package/src/components/ui/Gift/Gift.tsx +18 -27
- package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
- package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
- package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
- package/src/components/ui/Tiles/tiles.module.scss +11 -13
- package/src/components/ui/Toast/Toast.stories.mdx +1 -1
- package/src/components/ui/Toast/Toast.tsx +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/sdk/cart/index.ts +5 -0
- package/src/sdk/cart/useBuyButton.ts +1 -1
- package/src/sdk/cart/useCartToggleButton.ts +1 -1
- package/src/styles/vendors/include-media.scss +1 -1
- package/tsconfig.json +4 -6
- package/.eslintrc.json +0 -3
- package/.github/CODEOWNERS +0 -2
- package/.github/workflows/release.yml +0 -42
- package/.release-it.json +0 -32
- package/src/components/cart/CartItem/cart-item.module.scss +0 -68
- package/src/components/product/ProductCard/product-card.module.scss +0 -254
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
- package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
- package/src/components/skeletons/Shimmer/index.ts +0 -1
- package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
- package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
- package/src/components/skeletons/Skeleton/index.ts +0 -1
- package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
- package/src/components/skeletons/Skeletons.stories.mdx +0 -177
- package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
- package/src/components/ui/Accordion/Accordion.tsx +0 -39
- package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
- package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
- package/src/components/ui/Accordion/accordion.module.scss +0 -65
- package/src/components/ui/Accordion/index.ts +0 -2
- package/src/components/ui/Alert/Alert.stories.mdx +0 -164
- package/src/components/ui/Alert/Alert.tsx +0 -81
- package/src/components/ui/Alert/alert.module.scss +0 -93
- package/src/components/ui/Alert/index.ts +0 -1
- package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
- package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
- package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
- package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
- package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
- package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
- package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
- package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
- package/src/components/ui/Dropdown/index.ts +0 -4
- package/src/components/ui/Gift/Gift.stories.mdx +0 -99
- package/src/components/ui/Gift/gift.module.scss +0 -94
- package/src/components/ui/Modal/Modal.stories.mdx +0 -144
- package/src/components/ui/Modal/Modal.tsx +0 -43
- package/src/components/ui/Modal/index.ts +0 -1
- package/src/components/ui/Modal/modal.module.scss +0 -46
- package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
- package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
- package/src/components/ui/PriceRange/index.ts +0 -1
- package/src/components/ui/PriceRange/price-range.module.scss +0 -176
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
- package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
- package/src/components/ui/ProductTitle/index.ts +0 -1
- package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
- package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
- package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
- package/src/components/ui/QuantitySelector/index.ts +0 -1
- package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ As of Sep, 2022, this starter is still far from covering most basic cases found
|
|
|
63
63
|
Navigate into your new site’s directory and start it up.
|
|
64
64
|
|
|
65
65
|
```shell
|
|
66
|
-
yarn
|
|
66
|
+
yarn dev
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
4. **Open the source code and start editing!**
|
|
@@ -382,7 +382,7 @@ We use [graphql-codegen](https://www.graphql-code-generator.com/) to pre-process
|
|
|
382
382
|
This means we can statically analyse your code in search of bugs and secure your graphql server before each deploy. If, however you need to change any GraphQL Fragment, Query or Mutation, you will need to regenerate the whole thing. To do this, open your terminal and type
|
|
383
383
|
|
|
384
384
|
```sh
|
|
385
|
-
$ yarn
|
|
385
|
+
$ yarn dev
|
|
386
386
|
```
|
|
387
387
|
|
|
388
388
|
Now, after the nextjs development server is up and running, open another terminal and run
|
|
@@ -104,7 +104,7 @@ describe('add_to_cart event', () => {
|
|
|
104
104
|
testAddToCartEvent({ skuId, numberOfEvents: 1 })
|
|
105
105
|
|
|
106
106
|
cy.get(
|
|
107
|
-
'[data-testid=cart-item] [data-testid=
|
|
107
|
+
'[data-testid=fs-cart-item] [data-testid=fs-quantity-selector-right-button]'
|
|
108
108
|
)
|
|
109
109
|
.click()
|
|
110
110
|
.then(() => {
|
|
@@ -193,7 +193,7 @@ describe('remove_from_cart event', () => {
|
|
|
193
193
|
cy.itemsInCart(0)
|
|
194
194
|
|
|
195
195
|
// Add item to cart
|
|
196
|
-
cy.get('[data-testid=
|
|
196
|
+
cy.get('[data-testid=fs-quantity-selector-right-button]')
|
|
197
197
|
.click()
|
|
198
198
|
.then(() => {
|
|
199
199
|
cy.getById('buy-button')
|
|
@@ -209,7 +209,7 @@ describe('remove_from_cart event', () => {
|
|
|
209
209
|
|
|
210
210
|
// Remove the added item
|
|
211
211
|
cy.get(
|
|
212
|
-
'[data-testid=cart-item] [data-testid=
|
|
212
|
+
'[data-testid=fs-cart-item] [data-testid=fs-quantity-selector-left-button]'
|
|
213
213
|
)
|
|
214
214
|
.click()
|
|
215
215
|
.then(() => {
|
|
@@ -254,7 +254,7 @@ describe('select_item event', () => {
|
|
|
254
254
|
|
|
255
255
|
let skuId
|
|
256
256
|
|
|
257
|
-
cy.getById('
|
|
257
|
+
cy.getById('fs-product-card').first().click()
|
|
258
258
|
cy.getById('buy-button')
|
|
259
259
|
.should('be.visible')
|
|
260
260
|
.scrollIntoView({ duration: 500 })
|
|
@@ -67,7 +67,7 @@ describe('On product description pages', () => {
|
|
|
67
67
|
.should('be.visible')
|
|
68
68
|
.should('be.enabled')
|
|
69
69
|
|
|
70
|
-
cy.getById('cart-item').should(($item) => {
|
|
70
|
+
cy.getById('fs-cart-item').should(($item) => {
|
|
71
71
|
expect($item.attr('data-sku')).to.eq(skuId)
|
|
72
72
|
expect($item.attr('data-seller')).to.eq(sellerId)
|
|
73
73
|
})
|
|
@@ -93,7 +93,7 @@ describe('On product description pages', () => {
|
|
|
93
93
|
cy.itemsInCart(1)
|
|
94
94
|
|
|
95
95
|
cy.getById('remove-from-cart-button').click()
|
|
96
|
-
cy.getById('cart-item').should('not.exist')
|
|
96
|
+
cy.getById('fs-cart-item').should('not.exist')
|
|
97
97
|
cy.getById('checkout-button').should('not.exist')
|
|
98
98
|
|
|
99
99
|
cy.itemsInCart(0)
|
|
@@ -23,7 +23,7 @@ describe('Search page Filters and Sorting options', () => {
|
|
|
23
23
|
cy.getById('open-filter-button')
|
|
24
24
|
.click()
|
|
25
25
|
.get(
|
|
26
|
-
`[data-testid=mobile-store-filter-accordion
|
|
26
|
+
`[data-testid=mobile-store-filter-accordion][data-type=StoreFacetBoolean]>[data-testid=mobile-store-filter-accordion-button]`
|
|
27
27
|
)
|
|
28
28
|
.first()
|
|
29
29
|
.click()
|
|
@@ -117,7 +117,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
117
117
|
cy.waitForHydration()
|
|
118
118
|
|
|
119
119
|
cy.getById('product-gallery').within(() => {
|
|
120
|
-
cy.getById('
|
|
120
|
+
cy.getById('fs-product-card')
|
|
121
121
|
.should('exist')
|
|
122
122
|
.should('have.length.gt', 0)
|
|
123
123
|
.then(($links) => {
|
|
@@ -127,7 +127,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
127
127
|
.should('exist')
|
|
128
128
|
.click()
|
|
129
129
|
.then(() => {
|
|
130
|
-
cy.getById('
|
|
130
|
+
cy.getById('fs-product-card')
|
|
131
131
|
.should('have.length.gte', before)
|
|
132
132
|
.then(($products) => {
|
|
133
133
|
const after = $products.length
|
|
@@ -143,7 +143,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
143
143
|
cy.visit(pages.collection, options)
|
|
144
144
|
cy.waitForHydration()
|
|
145
145
|
|
|
146
|
-
cy.get('[data-testid=product-gallery] [data-testid=
|
|
146
|
+
cy.get('[data-testid=product-gallery] [data-testid=fs-product-card]')
|
|
147
147
|
.should('exist')
|
|
148
148
|
.should('have.length.gt', 0)
|
|
149
149
|
.then(($links) => {
|
|
@@ -154,12 +154,12 @@ describe('Infinite Scroll pagination', () => {
|
|
|
154
154
|
.should('exist')
|
|
155
155
|
.click()
|
|
156
156
|
// Go up the page
|
|
157
|
-
.get('[data-testid=product-gallery] [data-testid=
|
|
157
|
+
.get('[data-testid=product-gallery] [data-testid=fs-product-card]')
|
|
158
158
|
.first()
|
|
159
159
|
.scrollIntoView({ duration: 1000 })
|
|
160
160
|
|
|
161
161
|
// Go down the page
|
|
162
|
-
.get('[data-testid=product-gallery] [data-testid=
|
|
162
|
+
.get('[data-testid=product-gallery] [data-testid=fs-product-card]')
|
|
163
163
|
.last()
|
|
164
164
|
.scrollIntoView({ duration: 1000 })
|
|
165
165
|
.then(() => {
|
|
@@ -170,7 +170,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
170
170
|
let skuIdBeforeNavigate
|
|
171
171
|
|
|
172
172
|
cy.get(
|
|
173
|
-
'[data-testid=product-gallery] [data-testid=
|
|
173
|
+
'[data-testid=product-gallery] [data-testid=fs-product-card]'
|
|
174
174
|
)
|
|
175
175
|
// Number of products after showMore is clicked should be higher
|
|
176
176
|
.should('have.length.gte', before)
|
|
@@ -188,7 +188,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
188
188
|
.then(() => {
|
|
189
189
|
cy.go('back')
|
|
190
190
|
.get(
|
|
191
|
-
'[data-testid=product-gallery] [data-testid=
|
|
191
|
+
'[data-testid=product-gallery] [data-testid=fs-product-card]'
|
|
192
192
|
)
|
|
193
193
|
.last()
|
|
194
194
|
.then(($card) => {
|
|
@@ -215,7 +215,7 @@ describe('Infinite Scroll pagination', () => {
|
|
|
215
215
|
.location('search')
|
|
216
216
|
.should('match', /page=0$/)
|
|
217
217
|
|
|
218
|
-
cy.get('[data-testid=product-gallery] [data-testid=
|
|
218
|
+
cy.get('[data-testid=product-gallery] [data-testid=fs-product-card]')
|
|
219
219
|
.last()
|
|
220
220
|
.scrollIntoView({ duration: 1000 })
|
|
221
221
|
.location('search')
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.65-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"browserslist": "supports es6-module and not dead",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"generate": "graphql-codegen",
|
|
8
8
|
"build": "yarn partytown && next build",
|
|
9
|
-
"
|
|
9
|
+
"dev": "yarn partytown && next dev",
|
|
10
10
|
"clean": "rm -r .next",
|
|
11
11
|
"serve": "next start",
|
|
12
12
|
"test": "cypress open",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"postinstall": "node postinstall.js && (is-ci || husky install) || echo Skipped postinstall step for @faststore/core",
|
|
19
19
|
"partytown": "partytown copylib ./public/~partytown",
|
|
20
20
|
"storybook": "start-storybook --docs -p 6006",
|
|
21
|
-
"build-storybook": "build-storybook"
|
|
22
|
-
"release": "release-it --ci"
|
|
21
|
+
"build-storybook": "build-storybook"
|
|
23
22
|
},
|
|
24
23
|
"engines": {
|
|
25
24
|
"node": ">=14"
|
|
@@ -31,10 +30,10 @@
|
|
|
31
30
|
"@envelop/parser-cache": "^2.2.0",
|
|
32
31
|
"@envelop/validation-cache": "^2.2.0",
|
|
33
32
|
"@faststore/api": "^2.0.3-alpha.0",
|
|
34
|
-
"@faststore/components": "2.0.
|
|
33
|
+
"@faststore/components": "^2.0.65-alpha.0",
|
|
35
34
|
"@faststore/graphql-utils": "^2.0.3-alpha.0",
|
|
36
35
|
"@faststore/sdk": "^2.0.3-alpha.0",
|
|
37
|
-
"@faststore/ui": "2.0.
|
|
36
|
+
"@faststore/ui": "^2.0.65-alpha.0",
|
|
38
37
|
"@types/react": "^18.0.14",
|
|
39
38
|
"@vtex/client-cms": "^0.2.12",
|
|
40
39
|
"autoprefixer": "^10.4.0",
|
|
@@ -59,6 +58,7 @@
|
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
60
|
"@cypress/code-coverage": "^3.9.10",
|
|
61
|
+
"@faststore/eslint-config": "*",
|
|
62
62
|
"@faststore/lighthouse": "^1.12.32",
|
|
63
63
|
"@graphql-codegen/cli": "^2.6.2",
|
|
64
64
|
"@graphql-codegen/typescript": "^2.5.1",
|
|
@@ -80,14 +80,12 @@
|
|
|
80
80
|
"cypress-axe": "^0.13.0",
|
|
81
81
|
"cypress-wait-until": "^1.7.2",
|
|
82
82
|
"dotenv": "^8.2.0",
|
|
83
|
-
"eslint": "^
|
|
84
|
-
"eslint-config-next": "^13.0.7",
|
|
83
|
+
"eslint": "^7.32.0",
|
|
85
84
|
"husky": "^5.2.0",
|
|
86
85
|
"is-ci": "^3.0.0",
|
|
87
86
|
"lint-staged": "^10.5.4",
|
|
88
87
|
"msw-storybook-addon": "^1.6.3",
|
|
89
88
|
"prettier": "^2.2.0",
|
|
90
|
-
"release-it": "^15.2.0",
|
|
91
89
|
"stylelint": "^14.6.0",
|
|
92
90
|
"stylelint-config-recess-order": "^3.0.0",
|
|
93
91
|
"stylelint-config-standard": "^24.0.0",
|
|
@@ -109,5 +107,6 @@
|
|
|
109
107
|
},
|
|
110
108
|
"msw": {
|
|
111
109
|
"workerDirectory": "public"
|
|
112
|
-
}
|
|
110
|
+
},
|
|
111
|
+
"gitHead": "05c8f7f46e876406fcae355dbeff243bbf2e1e25"
|
|
113
112
|
}
|
package/src/Layout.tsx
CHANGED
|
@@ -6,7 +6,8 @@ import Footer from 'src/components/common/Footer'
|
|
|
6
6
|
import Navbar from 'src/components/common/Navbar'
|
|
7
7
|
import Toast from 'src/components/common/Toast'
|
|
8
8
|
import RegionalizationBar from 'src/components/regionalization/RegionalizationBar'
|
|
9
|
-
import
|
|
9
|
+
import Icon from 'src/components/ui/Icon'
|
|
10
|
+
import { useUI } from '@faststore/ui'
|
|
10
11
|
|
|
11
12
|
const CartSidebar = lazy(() => import('src/components/cart/CartSidebar'))
|
|
12
13
|
const RegionModal = lazy(
|
|
@@ -18,7 +19,11 @@ function Layout({ children }: PropsWithChildren) {
|
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
21
|
<>
|
|
21
|
-
<Alert
|
|
22
|
+
<Alert
|
|
23
|
+
icon={<Icon name="Bell" />}
|
|
24
|
+
link={{ children: 'Buy now', href: '/office', target: '_self' }}
|
|
25
|
+
dismissible
|
|
26
|
+
>
|
|
22
27
|
Get 10% off today: <span>NEW10</span>
|
|
23
28
|
</Alert>
|
|
24
29
|
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { sendAnalyticsEvent } from '@faststore/sdk'
|
|
2
2
|
import {
|
|
3
3
|
CartItem as UICartItem,
|
|
4
|
-
CartItemActions as UICartItemActions,
|
|
5
|
-
CartItemSummary as UICartItemSummary,
|
|
6
|
-
CartItemTitle as UICartItemTitle,
|
|
7
|
-
CartItemPrices as UICartItemPrices,
|
|
8
|
-
CartItemContent as UICartItemContent,
|
|
9
4
|
CartItemImage as UICartItemImage,
|
|
10
|
-
|
|
5
|
+
CartItemSummary as UICartItemSummary,
|
|
11
6
|
} from '@faststore/ui'
|
|
12
7
|
import { useCallback, useMemo } from 'react'
|
|
13
8
|
import type {
|
|
@@ -16,19 +11,14 @@ import type {
|
|
|
16
11
|
RemoveFromCartEvent,
|
|
17
12
|
} from '@faststore/sdk'
|
|
18
13
|
|
|
19
|
-
import Icon from 'src/components/ui/Icon'
|
|
20
14
|
import { Image } from 'src/components/ui/Image'
|
|
21
|
-
import Price from 'src/components/ui/Price'
|
|
22
|
-
import QuantitySelector from 'src/components/ui/QuantitySelector'
|
|
23
15
|
import { cartStore } from 'src/sdk/cart'
|
|
24
|
-
import { useRemoveButton } from 'src/sdk/cart/useRemoveButton'
|
|
25
16
|
import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
|
|
26
17
|
import { useSession } from 'src/sdk/session'
|
|
18
|
+
import { useRemoveButton } from 'src/sdk/cart/useRemoveButton'
|
|
27
19
|
import type { CartItem as ICartItem } from 'src/sdk/cart'
|
|
28
20
|
import type { AnalyticsItem } from 'src/sdk/analytics/types'
|
|
29
21
|
|
|
30
|
-
import styles from './cart-item.module.scss'
|
|
31
|
-
|
|
32
22
|
function useCartItemEvent() {
|
|
33
23
|
const {
|
|
34
24
|
currency: { code },
|
|
@@ -72,10 +62,9 @@ function useCartItemEvent() {
|
|
|
72
62
|
|
|
73
63
|
interface Props {
|
|
74
64
|
item: ICartItem
|
|
75
|
-
gift?: boolean
|
|
76
65
|
}
|
|
77
66
|
|
|
78
|
-
function CartItem({ item
|
|
67
|
+
function CartItem({ item }: Props) {
|
|
79
68
|
const btnProps = useRemoveButton(item)
|
|
80
69
|
|
|
81
70
|
const { sendCartItemEvent } = useCartItemEvent()
|
|
@@ -89,68 +78,38 @@ function CartItem({ item, gift = false }: Props) {
|
|
|
89
78
|
[item, sendCartItemEvent]
|
|
90
79
|
)
|
|
91
80
|
|
|
81
|
+
const skuActiveVariants =
|
|
82
|
+
item.itemOffered.isVariantOf.skuVariants.activeVariations
|
|
83
|
+
const activeVariations = Object.keys(skuActiveVariants).map((key) => ({
|
|
84
|
+
label: key,
|
|
85
|
+
option: skuActiveVariants[key],
|
|
86
|
+
}))
|
|
87
|
+
|
|
92
88
|
return (
|
|
93
89
|
<UICartItem
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
price={{
|
|
91
|
+
value: item.price,
|
|
92
|
+
listPrice: item.listPrice,
|
|
93
|
+
formatter: useFormattedPrice,
|
|
94
|
+
}}
|
|
95
|
+
quantity={item.quantity}
|
|
96
|
+
onQuantityChange={onQuantityChange}
|
|
97
|
+
removeBtnProps={btnProps}
|
|
96
98
|
data-sku={item.itemOffered.sku}
|
|
97
99
|
data-seller={item.seller.identifier}
|
|
98
100
|
>
|
|
99
|
-
<
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</UICartItemTitle>
|
|
112
|
-
{!gift && (
|
|
113
|
-
<UICartItemPrices>
|
|
114
|
-
<Price
|
|
115
|
-
value={item.listPrice}
|
|
116
|
-
formatter={useFormattedPrice}
|
|
117
|
-
testId="list-price"
|
|
118
|
-
data-value={item.listPrice}
|
|
119
|
-
variant="listing"
|
|
120
|
-
classes="text__legend"
|
|
121
|
-
SRText="Original price:"
|
|
122
|
-
/>
|
|
123
|
-
<Price
|
|
124
|
-
value={item.price}
|
|
125
|
-
formatter={useFormattedPrice}
|
|
126
|
-
testId="price"
|
|
127
|
-
data-value={item.price}
|
|
128
|
-
variant="spot"
|
|
129
|
-
classes="text__title-subsection"
|
|
130
|
-
SRText="Price:"
|
|
131
|
-
/>
|
|
132
|
-
</UICartItemPrices>
|
|
133
|
-
)}
|
|
134
|
-
</UICartItemSummary>
|
|
135
|
-
</UICartItemContent>
|
|
136
|
-
|
|
137
|
-
{!gift && (
|
|
138
|
-
<UICartItemActions>
|
|
139
|
-
<UIButton
|
|
140
|
-
icon={<Icon name="XCircle" width={18} height={18} />}
|
|
141
|
-
iconPosition="left"
|
|
142
|
-
variant="tertiary"
|
|
143
|
-
{...btnProps}
|
|
144
|
-
>
|
|
145
|
-
Remove
|
|
146
|
-
</UIButton>
|
|
147
|
-
<QuantitySelector
|
|
148
|
-
min={1}
|
|
149
|
-
initial={item.quantity}
|
|
150
|
-
onChange={onQuantityChange}
|
|
151
|
-
/>
|
|
152
|
-
</UICartItemActions>
|
|
153
|
-
)}
|
|
101
|
+
<UICartItemImage>
|
|
102
|
+
<Image
|
|
103
|
+
src={item.itemOffered.image[0].url}
|
|
104
|
+
alt={item.itemOffered.image[0].alternateName}
|
|
105
|
+
width={56}
|
|
106
|
+
height={56}
|
|
107
|
+
/>
|
|
108
|
+
</UICartItemImage>
|
|
109
|
+
<UICartItemSummary
|
|
110
|
+
title={item.itemOffered.isVariantOf.name}
|
|
111
|
+
activeVariations={activeVariations}
|
|
112
|
+
/>
|
|
154
113
|
</UICartItem>
|
|
155
114
|
)
|
|
156
115
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
2
|
|
|
3
|
-
import UIProvider,
|
|
3
|
+
import { UIProvider, useUI } from '@faststore/ui'
|
|
4
4
|
import { useCart } from 'src/sdk/cart'
|
|
5
5
|
|
|
6
6
|
import CartToggle from 'src/components/cart/CartToggle'
|
|
@@ -4,20 +4,22 @@ import {
|
|
|
4
4
|
IconButton as UIIconButton,
|
|
5
5
|
Button as UIButton,
|
|
6
6
|
Badge as UIBadge,
|
|
7
|
+
Alert as UIAlert,
|
|
7
8
|
} from '@faststore/ui'
|
|
9
|
+
|
|
8
10
|
import { useEffect } from 'react'
|
|
9
11
|
import type { ViewCartEvent, CurrencyCode } from '@faststore/sdk'
|
|
10
12
|
|
|
11
|
-
import Alert from 'src/components/ui/Alert'
|
|
12
13
|
import Icon from 'src/components/ui/Icon'
|
|
13
14
|
import SlideOver from 'src/components/ui/SlideOver'
|
|
14
15
|
import { useCart } from 'src/sdk/cart'
|
|
15
16
|
import { useCheckoutButton } from 'src/sdk/cart/useCheckoutButton'
|
|
16
17
|
import { useSession } from 'src/sdk/session'
|
|
17
|
-
import { useUI } from '
|
|
18
|
-
import { useFadeEffect } from '
|
|
18
|
+
import { useUI } from '@faststore/ui'
|
|
19
|
+
import { useFadeEffect } from '@faststore/ui'
|
|
19
20
|
|
|
20
21
|
import CartItem from '../CartItem'
|
|
22
|
+
import Gift from '../../ui/Gift'
|
|
21
23
|
import EmptyCart from '../EmptyCart'
|
|
22
24
|
import OrderSummary from '../OrderSummary'
|
|
23
25
|
import styles from './cart-sidebar.module.scss'
|
|
@@ -81,9 +83,9 @@ function CartSidebar() {
|
|
|
81
83
|
onClick={fadeOut}
|
|
82
84
|
/>
|
|
83
85
|
</header>
|
|
84
|
-
<
|
|
86
|
+
<UIAlert icon={<Icon name="Truck" />}>
|
|
85
87
|
Free shipping starts at $300
|
|
86
|
-
</
|
|
88
|
+
</UIAlert>
|
|
87
89
|
|
|
88
90
|
{isEmpty ? (
|
|
89
91
|
<EmptyCart onDismiss={fadeOut} />
|
|
@@ -95,22 +97,16 @@ function CartSidebar() {
|
|
|
95
97
|
<CartItem item={item} />
|
|
96
98
|
</li>
|
|
97
99
|
))}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{gifts.length > 0 && (
|
|
101
|
-
<>
|
|
102
|
-
<Alert icon={<Icon name="Gift" width={24} height={24} />}>
|
|
103
|
-
Gifts
|
|
104
|
-
</Alert>
|
|
105
|
-
<UIList data-fs-cart-sidebar-list>
|
|
100
|
+
{gifts.length > 0 && (
|
|
101
|
+
<>
|
|
106
102
|
{gifts.map((item) => (
|
|
107
103
|
<li key={item.id}>
|
|
108
|
-
<
|
|
104
|
+
<Gift item={item} />
|
|
109
105
|
</li>
|
|
110
106
|
))}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
</UIList>
|
|
114
110
|
|
|
115
111
|
<footer data-fs-cart-sidebar-footer>
|
|
116
112
|
<OrderSummary
|
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react'
|
|
2
2
|
import type { ReactNode, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
|
-
import UIAlert from '
|
|
4
|
+
import { Alert as UIAlert, AlertProps } from '@faststore/ui'
|
|
5
5
|
import { mark } from 'src/sdk/tests/mark'
|
|
6
|
-
import Icon from 'src/components/ui/Icon'
|
|
7
6
|
|
|
8
|
-
interface Props {
|
|
9
|
-
icon: string
|
|
7
|
+
interface Props extends AlertProps {
|
|
10
8
|
/**
|
|
11
9
|
* For CMS integration purposes, should be used to pass content through it
|
|
12
10
|
* instead pass through children
|
|
13
11
|
*/
|
|
14
12
|
content?: ReactNode
|
|
15
|
-
link?: {
|
|
16
|
-
to: string
|
|
17
|
-
text: string
|
|
18
|
-
}
|
|
19
|
-
dismissible: boolean
|
|
20
13
|
}
|
|
21
|
-
function Alert({
|
|
22
|
-
icon,
|
|
23
|
-
content,
|
|
24
|
-
link,
|
|
25
|
-
dismissible = false,
|
|
26
|
-
children,
|
|
27
|
-
}: PropsWithChildren<Props>) {
|
|
14
|
+
function Alert(args: PropsWithChildren<Props>) {
|
|
28
15
|
const [displayAlert, setDisplayAlert] = useState(true)
|
|
29
16
|
|
|
30
17
|
const onAlertClose = useCallback(
|
|
@@ -36,13 +23,10 @@ function Alert({
|
|
|
36
23
|
return null
|
|
37
24
|
}
|
|
38
25
|
|
|
26
|
+
const { content, children, ...otherProps } = args
|
|
27
|
+
|
|
39
28
|
return (
|
|
40
|
-
<UIAlert
|
|
41
|
-
icon={<Icon name={icon} width={24} height={24} />}
|
|
42
|
-
dismissible={dismissible}
|
|
43
|
-
onClose={onAlertClose}
|
|
44
|
-
link={link}
|
|
45
|
-
>
|
|
29
|
+
<UIAlert onClose={onAlertClose} {...otherProps}>
|
|
46
30
|
{content ?? children}
|
|
47
31
|
</UIAlert>
|
|
48
32
|
)
|
|
@@ -35,7 +35,7 @@ The `Footer` is the final section of every page and has all the meaningful links
|
|
|
35
35
|
|
|
36
36
|
## Overview
|
|
37
37
|
|
|
38
|
-
Footer section is made with `FooterLinks`, [Incentives](?path=/docs/organisms-incentives--incentives), [Links](?path=/docs/atoms-link--default),
|
|
38
|
+
Footer section is made with `FooterLinks`, [Incentives](?path=/docs/organisms-incentives--incentives), [Links](?path=/docs/atoms-link--default), Accordion, and [PaymentMethods](https://www.faststore.dev/reference/ui/molecules/PaymentMethods) (from FastStore UI).
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
List as UIList,
|
|
3
3
|
PaymentMethods as UIPaymentMethods,
|
|
4
|
-
SROnly as UISROnly,
|
|
5
4
|
} from '@faststore/ui'
|
|
6
5
|
|
|
7
6
|
import Logo from 'src/components/ui/Logo'
|
|
@@ -12,6 +11,7 @@ import { mark } from 'src/sdk/tests/mark'
|
|
|
12
11
|
|
|
13
12
|
import styles from './footer.module.scss'
|
|
14
13
|
import FooterLinks from './FooterLinks'
|
|
14
|
+
import FooterFlags from './FooterFlags'
|
|
15
15
|
|
|
16
16
|
type FooterProps = {
|
|
17
17
|
/**
|
|
@@ -107,43 +107,10 @@ export function Footer({
|
|
|
107
107
|
<Logo />
|
|
108
108
|
|
|
109
109
|
{sectionPaymentMethods && (
|
|
110
|
-
<UIPaymentMethods
|
|
111
|
-
<p
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<Icon width="34px" height="24px" name="Visa" />
|
|
115
|
-
<UISROnly text="Visa" />
|
|
116
|
-
</li>
|
|
117
|
-
<li>
|
|
118
|
-
<Icon width="34px" height="24px" name="Diners" />
|
|
119
|
-
<UISROnly text="Diners Club" />
|
|
120
|
-
</li>
|
|
121
|
-
<li>
|
|
122
|
-
<Icon width="34px" height="24px" name="Mastercard" />
|
|
123
|
-
<UISROnly text="Mastercard" />
|
|
124
|
-
</li>
|
|
125
|
-
<li>
|
|
126
|
-
<Icon width="34px" height="24px" name="EloCard" />
|
|
127
|
-
<UISROnly text="Elo Card" />
|
|
128
|
-
</li>
|
|
129
|
-
<li>
|
|
130
|
-
<Icon width="34px" height="24px" name="PayPal" />
|
|
131
|
-
<UISROnly text="PayPal" />
|
|
132
|
-
</li>
|
|
133
|
-
<li>
|
|
134
|
-
<Icon width="34px" height="24px" name="Stripe" />
|
|
135
|
-
<UISROnly text="Stripe" />
|
|
136
|
-
</li>
|
|
137
|
-
<li>
|
|
138
|
-
<Icon width="34px" height="24px" name="GooglePay" />
|
|
139
|
-
<UISROnly text="Google Pay" />
|
|
140
|
-
</li>
|
|
141
|
-
<li>
|
|
142
|
-
<Icon width="34px" height="24px" name="ApplePay" />
|
|
143
|
-
<UISROnly text="Apple Pay" />
|
|
144
|
-
</li>
|
|
145
|
-
</UIList>
|
|
146
|
-
</UIPaymentMethods>
|
|
110
|
+
<UIPaymentMethods
|
|
111
|
+
title={<p>Payment Methods</p>}
|
|
112
|
+
flagList={FooterFlags}
|
|
113
|
+
/>
|
|
147
114
|
)}
|
|
148
115
|
|
|
149
116
|
<div data-fs-footer-copyright className="text__legend">
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Visa,
|
|
3
|
+
Diners,
|
|
4
|
+
Mastercard,
|
|
5
|
+
EloCard,
|
|
6
|
+
PayPal,
|
|
7
|
+
Stripe,
|
|
8
|
+
GooglePay,
|
|
9
|
+
ApplePay,
|
|
10
|
+
} from '@faststore/components'
|
|
11
|
+
|
|
12
|
+
const FooterFlags = [
|
|
13
|
+
{ image: <Visa />, text: 'Visa' },
|
|
14
|
+
{ image: <Diners />, text: 'Diners Club' },
|
|
15
|
+
{ image: <Mastercard />, text: 'Mastercard' },
|
|
16
|
+
{ image: <EloCard />, text: 'Elo Card' },
|
|
17
|
+
{ image: <PayPal />, text: 'PayPal' },
|
|
18
|
+
{ image: <Stripe />, text: 'Stripe' },
|
|
19
|
+
{ image: <GooglePay />, text: 'GooglePay' },
|
|
20
|
+
{ image: <ApplePay />, text: 'ApplePay' },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
export default FooterFlags
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
List as UIList,
|
|
4
|
+
Accordion as UIAccordion,
|
|
5
|
+
AccordionItem as UIAccordionItem,
|
|
6
|
+
AccordionButton as UIAccordionButton,
|
|
7
|
+
AccordionPanel as UIAccordionPanel,
|
|
8
|
+
} from '@faststore/ui'
|
|
3
9
|
|
|
4
10
|
import Link from 'src/components/ui/Link'
|
|
5
|
-
import Accordion, { AccordionItem } from 'src/components/ui/Accordion'
|
|
6
11
|
|
|
7
12
|
import styles from './footer.module.scss'
|
|
8
13
|
|
|
@@ -125,17 +130,16 @@ function FooterLinks() {
|
|
|
125
130
|
return (
|
|
126
131
|
<section className={styles.fsFooter} data-fs-footer-links>
|
|
127
132
|
<div className="display-mobile">
|
|
128
|
-
<
|
|
129
|
-
{links.map((section
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
</AccordionItem>
|
|
133
|
+
<UIAccordion indices={indicesExpanded} onChange={onChange}>
|
|
134
|
+
{links.map((section) => (
|
|
135
|
+
<UIAccordionItem key={section.title}>
|
|
136
|
+
<UIAccordionButton>{section.title}</UIAccordionButton>
|
|
137
|
+
<UIAccordionPanel>
|
|
138
|
+
<LinksList items={section.items} />
|
|
139
|
+
</UIAccordionPanel>
|
|
140
|
+
</UIAccordionItem>
|
|
137
141
|
))}
|
|
138
|
-
</
|
|
142
|
+
</UIAccordion>
|
|
139
143
|
</div>
|
|
140
144
|
|
|
141
145
|
<div className="hidden-mobile">
|