@faststore/core 0.3.17 → 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 +116 -180
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +3 -3
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +8 -8
- package/package.json +8 -9
- package/src/Layout.tsx +1 -1
- 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 +9 -12
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- 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 +1 -1
- 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/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
- 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/Gift/Gift.tsx +12 -15
- 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 +3 -5
- 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/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/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/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
package/src/sdk/ui/Provider.tsx
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo, useReducer } from 'react'
|
|
2
|
-
import type { PropsWithChildren } from 'react'
|
|
3
|
-
|
|
4
|
-
interface Toast {
|
|
5
|
-
message: string
|
|
6
|
-
status: 'ERROR' | 'WARNING' | 'INFO'
|
|
7
|
-
title?: string
|
|
8
|
-
icon?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface State {
|
|
12
|
-
/** Cart sidebar */
|
|
13
|
-
cart: boolean
|
|
14
|
-
/** Region modal */
|
|
15
|
-
modal: boolean
|
|
16
|
-
/** Menu slider */
|
|
17
|
-
navbar: boolean
|
|
18
|
-
/** Search page filter slider */
|
|
19
|
-
filter: boolean
|
|
20
|
-
toasts: Toast[]
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type UIElement = 'navbar' | 'cart' | 'modal' | 'filter'
|
|
24
|
-
|
|
25
|
-
type Action =
|
|
26
|
-
| {
|
|
27
|
-
type: 'open'
|
|
28
|
-
payload: UIElement
|
|
29
|
-
}
|
|
30
|
-
| {
|
|
31
|
-
type: 'close'
|
|
32
|
-
payload: UIElement
|
|
33
|
-
}
|
|
34
|
-
| {
|
|
35
|
-
type: 'pushToast'
|
|
36
|
-
payload: Toast
|
|
37
|
-
}
|
|
38
|
-
| {
|
|
39
|
-
type: 'popToast'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const reducer = (state: State, action: Action): State => {
|
|
43
|
-
const { type } = action
|
|
44
|
-
|
|
45
|
-
switch (type) {
|
|
46
|
-
case 'open': {
|
|
47
|
-
const { payload } = action
|
|
48
|
-
|
|
49
|
-
document.body.classList.add('no-scroll')
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
...state,
|
|
53
|
-
[payload]: true,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
case 'close': {
|
|
58
|
-
const { payload } = action
|
|
59
|
-
|
|
60
|
-
document.body.classList.remove('no-scroll')
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
...state,
|
|
64
|
-
[payload]: false,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
case 'pushToast': {
|
|
69
|
-
return {
|
|
70
|
-
...state,
|
|
71
|
-
toasts: [...state.toasts, action.payload],
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
case 'popToast': {
|
|
76
|
-
return {
|
|
77
|
-
...state,
|
|
78
|
-
toasts: state.toasts.slice(1),
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
default:
|
|
83
|
-
throw new Error(`Action ${type} not implemented`)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const initializer = (): State => ({
|
|
88
|
-
cart: false,
|
|
89
|
-
modal: false,
|
|
90
|
-
navbar: false,
|
|
91
|
-
filter: false,
|
|
92
|
-
toasts: [],
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
interface Context extends State {
|
|
96
|
-
closeNavbar: () => void
|
|
97
|
-
openNavbar: () => void
|
|
98
|
-
closeFilter: () => void
|
|
99
|
-
openFilter: () => void
|
|
100
|
-
openCart: () => void
|
|
101
|
-
closeCart: () => void
|
|
102
|
-
openModal: () => void
|
|
103
|
-
closeModal: () => void
|
|
104
|
-
pushToast: (data: Toast) => void
|
|
105
|
-
popToast: () => void
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const UIContext = createContext<Context | undefined>(undefined)
|
|
109
|
-
|
|
110
|
-
function UIProvider({ children }: PropsWithChildren) {
|
|
111
|
-
const [ui, dispatch] = useReducer(reducer, undefined, initializer)
|
|
112
|
-
|
|
113
|
-
const callbacks = useMemo(
|
|
114
|
-
() => ({
|
|
115
|
-
openFilter: () => dispatch({ type: 'open', payload: 'filter' }),
|
|
116
|
-
closeFilter: () => dispatch({ type: 'close', payload: 'filter' }),
|
|
117
|
-
openNavbar: () => dispatch({ type: 'open', payload: 'navbar' }),
|
|
118
|
-
closeNavbar: () => dispatch({ type: 'close', payload: 'navbar' }),
|
|
119
|
-
openCart: () => dispatch({ type: 'open', payload: 'cart' }),
|
|
120
|
-
closeCart: () => dispatch({ type: 'close', payload: 'cart' }),
|
|
121
|
-
openModal: () => dispatch({ type: 'open', payload: 'modal' }),
|
|
122
|
-
closeModal: () => dispatch({ type: 'close', payload: 'modal' }),
|
|
123
|
-
pushToast: (toast: Toast) =>
|
|
124
|
-
dispatch({ type: 'pushToast', payload: toast }),
|
|
125
|
-
popToast: () => dispatch({ type: 'popToast' }),
|
|
126
|
-
}),
|
|
127
|
-
[]
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
const value = useMemo(
|
|
131
|
-
() => ({
|
|
132
|
-
...ui,
|
|
133
|
-
...callbacks,
|
|
134
|
-
}),
|
|
135
|
-
[callbacks, ui]
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
return <UIContext.Provider value={value}>{children}</UIContext.Provider>
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function useUI() {
|
|
142
|
-
const context = useContext(UIContext)
|
|
143
|
-
|
|
144
|
-
if (context === undefined) {
|
|
145
|
-
throw new Error('Missing UI context on React tree')
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return context
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export default UIProvider
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
export const useFadeEffect = () => {
|
|
4
|
-
const [fade, setFade] = useState<'in' | 'out'>('out')
|
|
5
|
-
const fadeOut = useCallback(() => setFade('out'), [])
|
|
6
|
-
const fadeIn = useCallback(() => setFade('in'), [])
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
fadeIn()
|
|
10
|
-
|
|
11
|
-
return () => {
|
|
12
|
-
fadeOut()
|
|
13
|
-
}
|
|
14
|
-
}, [fadeIn, fadeOut])
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
fade,
|
|
18
|
-
fadeIn,
|
|
19
|
-
fadeOut,
|
|
20
|
-
}
|
|
21
|
-
}
|