@jetshop/template-trend 5.8.4 → 5.11.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/.linaria-cache/packages/template-trend/src/components/Layout/Header/ChannelSelector/ChannelSelector.linaria.css +1 -1
- package/.linaria-cache/packages/template-trend/src/components/SearchPage/CategoryList.linaria.css +7 -0
- package/.linaria-cache/packages/template-trend/src/components/StartPage/CategoryList.linaria.css +6 -6
- package/.linaria-cache/packages/template-trend/src/components/StartPage/StartPage.linaria.css +0 -1
- package/.linaria-cache/packages/ui/ChannelSelector/Region.linaria.css +3 -0
- package/README.md +118 -1944
- package/cypress/integration/essentials.spec.js +50 -0
- package/package.json +5 -5
- package/schema.graphql +1 -0
- package/src/components/Auth/ForgotPassword.js +3 -8
- package/src/components/Auth/README.md +5 -0
- package/src/components/Cart/CartButton.js +40 -44
- package/src/components/Cart/CartFlyout.js +8 -5
- package/src/components/Cart/CartItem.js +12 -15
- package/src/components/Cart/{addMultipleToCart.gql → queries/addMultipleToCart.gql} +1 -1
- package/src/components/Cart/{addToCart.gql → queries/addToCart.gql} +1 -1
- package/src/components/Cart/{CartFragment.gql → queries/cartFragment.gql} +9 -0
- package/src/components/Cart/{CartQuery.gql → queries/cartQuery.gql} +1 -1
- package/src/components/Cart/{decrementQuantity.gql → queries/decrementQuantity.gql} +1 -1
- package/src/components/Cart/{incrementQuantity.gql → queries/incrementQuantity.gql} +1 -1
- package/src/components/Cart/{removeFromCart.gql → queries/removeFromCart.gql} +1 -1
- package/src/components/CategoryPage/CategoryPage.js +1 -0
- package/src/components/CategoryPage/Filters/ListFilters.js +1 -2
- package/src/components/CategoryPage/ProductCard.js +2 -0
- package/src/components/CategoryPage/ProductGrid.js +5 -0
- package/src/components/CategoryPage/ProductGridFragment.gql +8 -0
- package/src/components/CategoryPage/ProductGridWindow.js +19 -12
- package/src/components/CategoryPage/README.md +11 -0
- package/src/components/CategoryPage/WindowedCategoryPage.js +6 -5
- package/src/components/Forms/Input.js +3 -6
- package/src/components/Layout/Header/ChannelSelector/ChannelSelector.js +3 -0
- package/src/components/Layout/Header/ChannelSelector/ChannelSelectorModal.js +4 -3
- package/src/components/Layout/Header/ChannelSelector/Selector.js +2 -0
- package/src/components/Layout/Header/RecommendedChannel/RecommendedChannelSelector.js +3 -1
- package/src/components/Layout/Header/TopNav.js +13 -11
- package/src/components/LogOut.loadable.js +10 -0
- package/src/components/MyPages/MyPagesSidebar.js +0 -1
- package/src/components/PreviewRoute.loadable.js +10 -0
- package/src/components/ProductList/AddToCart.js +8 -5
- package/src/components/ProductList/Favourite.js +2 -2
- package/src/components/ProductList/FavouriteCount.js +2 -2
- package/src/components/ProductList/Favourites.js +17 -12
- package/src/components/ProductList/Lister.js +44 -0
- package/src/components/ProductList/Product.js +5 -4
- package/src/components/ProductList/ProductLists.gql +8 -5
- package/src/components/ProductList/SelectVariant.js +6 -10
- package/src/components/ProductList/productListQueries.js +5 -0
- package/src/components/ProductPage/AddToCart/AddToCartForm.js +19 -18
- package/src/components/ProductPage/AddToCart/ProductToast.js +7 -4
- package/src/components/ProductPage/PackageProduct/PackageProduct.js +8 -6
- package/src/components/ProductPage/VariantSelector.js +1 -1
- package/src/components/{StartPage → SearchPage}/CategoryList.js +6 -4
- package/src/components/SearchPage/EmptySearchResults.js +1 -1
- package/src/components/Shop.js +52 -76
- package/src/components/StartPage/Content/Row.js +0 -37
- package/src/components/StartPage/Content/StartPageHero.js +9 -1
- package/src/components/StartPage/StartPage.js +0 -13
- package/src/components/StartPage/StartPageProductGridFragment.gql +8 -0
- package/cypress/constants.js +0 -5
- package/cypress/integration/addToCart/addToCart.spec.js +0 -27
- package/cypress/integration/addToCart/disabledVariations.spec.js +0 -17
- package/cypress/integration/addToCart/newslettersubscriber.spec.js +0 -24
- package/cypress/integration/addToCart/notifyWhenBackInStock.spec.js +0 -20
- package/cypress/integration/addToCart/productConfigurations.spec.js +0 -35
- package/cypress/integration/addToCart/productVariations.spec.js +0 -42
- package/cypress/integration/addToCart/sizePriceChange.spec.js +0 -20
- package/cypress/integration/analytics/gtag.spec.js +0 -90
- package/cypress/integration/analytics/releware.spec.js +0 -95
- package/cypress/integration/auth/login.spec.js +0 -18
- package/cypress/integration/auth/signup.spec.js +0 -98
- package/cypress/integration/category_page_spec.js +0 -73
- package/cypress/integration/filters.spec.js +0 -103
- package/cypress/integration/getbyarticlenumber.spec.js +0 -28
- package/cypress/integration/packages.spec.js +0 -85
- package/cypress/integration/prefetch_headers_spec.js +0 -26
- package/cypress/integration/product_browsing_spec.js +0 -17
- package/cypress/integration/search/autocomplete.spec.js +0 -28
- package/cypress/integration/search/search_page.spec.js +0 -39
- package/cypress/integration/ssr/categorySSR.js +0 -9
- package/cypress/integration/ssr/productSSR.js +0 -9
- package/cypress/integration/ssr/startPageSSR.js +0 -5
- package/cypress/integration/start_page_spec.js +0 -5
- package/cypress/integration/stores_page.spec.js +0 -5
- package/src/components/StartPage/Campaign.js +0 -162
- package/src/components/StartPage/CampaignHeader.js +0 -101
- package/src/components/StartPage/ExtraDetails.js +0 -72
- package/src/components/StartPage/Readme.md +0 -88
- package/src/components/StartPage/campaign.json +0 -20
- package/src/components/StartPage/campaignHeader.json +0 -5
- package/src/components/StartPage/categoryList.json +0 -65
- package/src/components/StartPage/extraDetails.json +0 -6
- package/src/components/StartPage/title.json +0 -3
|
@@ -47,14 +47,16 @@ const List = styled('ul')`
|
|
|
47
47
|
}
|
|
48
48
|
`;
|
|
49
49
|
|
|
50
|
-
export default ({ children, searchOpen, left, ...rest })
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
export default function TopNav({ children, searchOpen, left, ...rest }) {
|
|
51
|
+
return (
|
|
52
|
+
<List
|
|
53
|
+
className={cx(left ? 'left' : null, searchOpen && 'searchOpen')}
|
|
54
|
+
{...rest}
|
|
55
|
+
>
|
|
56
|
+
{React.Children.map(
|
|
57
|
+
children,
|
|
58
|
+
item => item && <li className="top-nav-list-item">{item}</li>
|
|
59
|
+
)}
|
|
60
|
+
</List>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { css } from 'linaria';
|
|
1
3
|
import { useMutation } from '@apollo/react-hooks';
|
|
4
|
+
|
|
5
|
+
import t from '@jetshop/intl';
|
|
2
6
|
import { CartIdContext } from '@jetshop/core/components/Cart/CartIdContext';
|
|
3
7
|
import { addToCartSuccess } from '@jetshop/core/components/Mutation/AddToCart/addToCartUtils';
|
|
4
|
-
import t from '@jetshop/intl';
|
|
5
|
-
import React, { useContext } from 'react';
|
|
6
|
-
import { css } from 'linaria';
|
|
7
|
-
import { addToCart } from '../Cart/addToCart.gql';
|
|
8
|
-
import ProductToastWrapper from '../ProductPage/AddToCart/ProductToast';
|
|
9
8
|
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
10
9
|
|
|
10
|
+
import ProductToastWrapper from '../ProductPage/AddToCart/ProductToast';
|
|
11
|
+
|
|
12
|
+
import { addToCart } from '../Cart/queries/addToCart.gql';
|
|
13
|
+
|
|
11
14
|
const addButton = css`
|
|
12
15
|
background: white;
|
|
13
16
|
border: 0.75px solid #bfbdbd;
|
|
@@ -14,13 +14,13 @@ const favourite = css`
|
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
|
-
export function Favourite({ product, variant, ...rest }) {
|
|
17
|
+
export function Favourite({ product, variant, listId, ...rest }) {
|
|
18
18
|
const articleNumber = product.articleNumber;
|
|
19
19
|
|
|
20
20
|
const selectedVariation = product.variant || variant;
|
|
21
21
|
const variantArticleNumber = selectedVariation?.articleNumber;
|
|
22
22
|
|
|
23
|
-
const { toggle, inList } = useProductList();
|
|
23
|
+
const { toggle, inList } = useProductList(listId);
|
|
24
24
|
|
|
25
25
|
function toggleWithoutBubble(e) {
|
|
26
26
|
e.preventDefault();
|
|
@@ -5,8 +5,8 @@ import { Link } from 'react-router-dom';
|
|
|
5
5
|
import { ReactComponent as HeartSVG } from '../../svg/Heart.svg';
|
|
6
6
|
import Badge from '../ui/Badge';
|
|
7
7
|
|
|
8
|
-
export function FavouriteCount({ className }) {
|
|
9
|
-
const { count } = useProductList();
|
|
8
|
+
export function FavouriteCount({ className, listId }) {
|
|
9
|
+
const { count } = useProductList(listId);
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<Link to="/favourites" className={className}>
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { css, cx } from 'linaria';
|
|
3
|
+
|
|
1
4
|
import {
|
|
2
5
|
useProductList,
|
|
3
6
|
useProductListItems
|
|
4
7
|
} from '@jetshop/core/hooks/ProductList';
|
|
5
8
|
import { useAddMultipleToCart } from '@jetshop/core/hooks/useAddMultipleToCart';
|
|
6
9
|
import t from '@jetshop/intl';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { ReactComponent as
|
|
10
|
-
import addMultipleToCartMutation from '../Cart/addMultipleToCart.gql';
|
|
11
|
-
import cartQuery from '../Cart/CartQuery.gql';
|
|
10
|
+
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
11
|
+
|
|
12
|
+
import { ReactComponent as CartIcon } from '../../svg/Cart.svg';
|
|
12
13
|
import MaxWidth from '../Layout/MaxWidth';
|
|
13
14
|
import { theme } from '../Theme';
|
|
14
15
|
import Button from '../ui/Button';
|
|
15
16
|
import { Product } from './Product';
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
import addMultipleToCartMutation from '../Cart/queries/addMultipleToCart.gql';
|
|
19
|
+
import cartQuery from '../Cart/queries/cartQuery.gql';
|
|
17
20
|
|
|
18
21
|
export function Favourites() {
|
|
19
|
-
const
|
|
22
|
+
const listId = null;
|
|
23
|
+
|
|
24
|
+
const { products, loading } = useProductListItems(listId);
|
|
20
25
|
const [trigger] = useNotification();
|
|
21
26
|
|
|
22
27
|
const validItems = getItemsForAddToCart(products);
|
|
@@ -32,7 +37,7 @@ export function Favourites() {
|
|
|
32
37
|
onCompleted: () => {
|
|
33
38
|
trigger(
|
|
34
39
|
<AddAllSuccessToast>
|
|
35
|
-
<
|
|
40
|
+
<CartIcon />
|
|
36
41
|
{t(
|
|
37
42
|
'{productCount, plural, =1 {# product added to the cart.} other {# products added to the cart.}}',
|
|
38
43
|
{ productCount: validItemCount }
|
|
@@ -73,7 +78,7 @@ export function Favourites() {
|
|
|
73
78
|
key={product.variant?.articleNumber || product.articleNumber}
|
|
74
79
|
data-valid={product.validation.status}
|
|
75
80
|
>
|
|
76
|
-
<Product product={product} />
|
|
81
|
+
<Product listId={listId} product={product} />
|
|
77
82
|
</li>
|
|
78
83
|
);
|
|
79
84
|
})}
|
|
@@ -96,7 +101,7 @@ export function Favourites() {
|
|
|
96
101
|
)
|
|
97
102
|
: t('No valid items to add to cart')}
|
|
98
103
|
</Button>
|
|
99
|
-
<ClearList>{t('Clear list')}</ClearList>
|
|
104
|
+
<ClearList listId={listId}>{t('Clear list')}</ClearList>
|
|
100
105
|
</div>
|
|
101
106
|
</MaxWidth>
|
|
102
107
|
);
|
|
@@ -106,8 +111,8 @@ function AddAllSuccessToast({ children }) {
|
|
|
106
111
|
return <div className={addAllToastStyles}>{children}</div>;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
function ClearList({ children }) {
|
|
110
|
-
const { clear } = useProductList();
|
|
114
|
+
function ClearList({ children, listId }) {
|
|
115
|
+
const { clear } = useProductList(listId);
|
|
111
116
|
return (
|
|
112
117
|
<Button secondary onClick={clear}>
|
|
113
118
|
{children}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* TODO This is temporary, delete before merging
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { ProductListContext } from '@jetshop/core/hooks/ProductList/ProductListContext';
|
|
8
|
+
import { Link } from 'react-router-dom';
|
|
9
|
+
import useAuth from '@jetshop/core/components/AuthContext/useAuth';
|
|
10
|
+
|
|
11
|
+
export default function Lister() {
|
|
12
|
+
const { state, createList, deleteList } = useContext(ProductListContext);
|
|
13
|
+
const { loggedIn } = useAuth();
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<h2>Product lists</h2>
|
|
17
|
+
{loggedIn ? (
|
|
18
|
+
<button onClick={() => createList('BOOM')}>
|
|
19
|
+
Create a list a new list called BOOM
|
|
20
|
+
</button>
|
|
21
|
+
) : (
|
|
22
|
+
<></>
|
|
23
|
+
)}
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
|
|
27
|
+
<ul>
|
|
28
|
+
{Array.from(state.lists.entries()).map(([listId, obj]) => (
|
|
29
|
+
<li key={listId} style={{ padding: '0.5em' }}>
|
|
30
|
+
<Link to={`/favourites/${listId || ''}`}>
|
|
31
|
+
{listId === null ? 'Default list' : obj.name}
|
|
32
|
+
</Link>
|
|
33
|
+
{listId === null ? (
|
|
34
|
+
<></>
|
|
35
|
+
) : (
|
|
36
|
+
<button onClick={() => deleteList(listId)}>DELETE</button>
|
|
37
|
+
)}
|
|
38
|
+
</li>
|
|
39
|
+
))}
|
|
40
|
+
</ul>
|
|
41
|
+
<hr />
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -7,7 +7,7 @@ import { SelectVariant } from './SelectVariant';
|
|
|
7
7
|
import { ReactComponent as TrashSVG } from '../../svg/trash.svg';
|
|
8
8
|
import { useProductList } from '@jetshop/core/hooks/ProductList';
|
|
9
9
|
|
|
10
|
-
export function Product({ product, loading, children }) {
|
|
10
|
+
export function Product({ product, loading, children, listId }) {
|
|
11
11
|
// Use the variant's image for display
|
|
12
12
|
const productForDisplay = { ...product };
|
|
13
13
|
if (product.isVariant && product.variant.images) {
|
|
@@ -19,7 +19,7 @@ export function Product({ product, loading, children }) {
|
|
|
19
19
|
<ProductCard product={productForDisplay} as="div">
|
|
20
20
|
{product.hasVariants && (
|
|
21
21
|
<div className="select-variant">
|
|
22
|
-
<SelectVariant product={product} />
|
|
22
|
+
<SelectVariant listId={listId} product={product} />
|
|
23
23
|
</div>
|
|
24
24
|
)}
|
|
25
25
|
{product.validation.status === 'valid' ? (
|
|
@@ -28,6 +28,7 @@ export function Product({ product, loading, children }) {
|
|
|
28
28
|
<InvalidProduct validation={product.validation} />
|
|
29
29
|
)}
|
|
30
30
|
<RemoveFromList
|
|
31
|
+
listId={listId}
|
|
31
32
|
articleNumber={product.articleNumber}
|
|
32
33
|
variant={product.variant}
|
|
33
34
|
/>
|
|
@@ -36,8 +37,8 @@ export function Product({ product, loading, children }) {
|
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function RemoveFromList({ children, articleNumber, variant }) {
|
|
40
|
-
const { remove } = useProductList();
|
|
40
|
+
function RemoveFromList({ children, articleNumber, variant, listId }) {
|
|
41
|
+
const { remove } = useProductList(listId);
|
|
41
42
|
const variantArticleNumber = variant?.articleNumber;
|
|
42
43
|
return (
|
|
43
44
|
<button
|
|
@@ -12,8 +12,8 @@ query ProductsFromProductList($articleNumbers: [String]) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
## query
|
|
15
|
-
query ProductList {
|
|
16
|
-
customerProductList {
|
|
15
|
+
query ProductList($id: ID) {
|
|
16
|
+
customerProductList(id: $id) {
|
|
17
17
|
...ProductListFragment
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -27,7 +27,7 @@ mutation AddToProductList($id: ID, $items: [AddToCustomerProductListInput!]!) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
## remove
|
|
30
|
+
## remove article from product list
|
|
31
31
|
mutation RemoveFromProductList($id: ID, $articleNumbers: [String!]) {
|
|
32
32
|
removeFromCustomerProductList(id: $id, articleNumbers: $articleNumbers) {
|
|
33
33
|
customerProductList {
|
|
@@ -54,9 +54,12 @@ mutation MergeProductLists($id: ID, $items: [AddToCustomerProductListInput!]!) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
### Fragments ###
|
|
58
|
-
|
|
59
57
|
fragment MinimalProductListDetail on CustomerProductList {
|
|
58
|
+
id
|
|
59
|
+
name
|
|
60
|
+
# TODO
|
|
61
|
+
# typeId {...}
|
|
62
|
+
# description
|
|
60
63
|
items {
|
|
61
64
|
variant {
|
|
62
65
|
articleNumber
|
|
@@ -10,18 +10,14 @@ import {
|
|
|
10
10
|
import { ReactComponent as Check } from '@jetshop/ui/svg/Check.svg';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
-
export function SelectVariant({ product }) {
|
|
14
|
-
const { update } = useProductList();
|
|
13
|
+
export function SelectVariant({ product, listId }) {
|
|
14
|
+
const { update } = useProductList(listId);
|
|
15
15
|
const initialVariant = product.variant;
|
|
16
16
|
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
validateSelection
|
|
22
|
-
} = useProductVariants(product, {
|
|
23
|
-
initialVariant
|
|
24
|
-
});
|
|
17
|
+
const { selectedVariant, selectValue, getSelectedValue, validateSelection } =
|
|
18
|
+
useProductVariants(product, {
|
|
19
|
+
initialVariant
|
|
20
|
+
});
|
|
25
21
|
|
|
26
22
|
React.useEffect(() => {
|
|
27
23
|
// When a variant is selected, call the update function from useProductList to update the list
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import queries from '@jetshop/core/data/queries/ProductLists.gql';
|
|
2
|
+
import mutations from '@jetshop/core/data/mutations/productListMutations.gql';
|
|
1
3
|
import * as ProductListQueries from './ProductLists.gql';
|
|
2
4
|
|
|
3
5
|
export const productListQueries = {
|
|
6
|
+
createList: mutations.CreateProductList,
|
|
7
|
+
deleteList: mutations.DeleteProductList,
|
|
8
|
+
all: queries.ProductLists,
|
|
4
9
|
query: ProductListQueries.ProductList,
|
|
5
10
|
productsQuery: ProductListQueries.ProductsFromProductList,
|
|
6
11
|
add: ProductListQueries.AddToProductList,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { styled } from 'linaria/react';
|
|
3
|
+
import { css, cx } from 'linaria';
|
|
4
|
+
import { Form } from 'formik';
|
|
5
|
+
|
|
1
6
|
import AddToCartFormik from '@jetshop/core/cart/AddToCartFormik';
|
|
2
7
|
import ProductConfigurationContext from '@jetshop/core/components/ProductConfigurationProvider/ProductConfigurationContext';
|
|
3
8
|
import { useDynamicPrice } from '@jetshop/core/hooks/useDynamicPrice';
|
|
4
9
|
import t from '@jetshop/intl';
|
|
5
10
|
import { Price } from '@jetshop/ui/Price';
|
|
6
11
|
import { useStockStatus } from '@jetshop/ui/Stock/StockStatusContainer';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { css, cx } from 'linaria';
|
|
11
|
-
import addToCartMutation from '../../Cart/addToCart.gql';
|
|
12
|
-
import CartQuery from '../../Cart/CartQuery.gql';
|
|
12
|
+
import { PreOrderDateSelector } from '@jetshop/ui/PreOrderDateSelector';
|
|
13
|
+
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
14
|
+
|
|
13
15
|
import InputWithLabel from '../../Forms/Input';
|
|
14
16
|
import Button from '../../ui/Button';
|
|
15
17
|
import { IncludedInPackages } from '../PackageProduct/IncludedInPackages';
|
|
@@ -19,11 +21,12 @@ import StockStatusIndicator from '../StockStatus/StockStatusIndicator';
|
|
|
19
21
|
import { useProductValidationMessage } from '../useProductValidationMessage';
|
|
20
22
|
import { VariantSelector, dropdownStyles } from '../VariantSelector';
|
|
21
23
|
import { theme } from '../../Theme';
|
|
22
|
-
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
23
24
|
import ProductToastWrapper from './ProductToast';
|
|
24
25
|
import { ConfigurationSelector } from '../ConfigurationSelector';
|
|
25
26
|
import WarehouseStock from '../StockStatus/WarehouseStock';
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
import addToCartMutation from '../../Cart/queries/addToCart.gql';
|
|
29
|
+
import CartQuery from '../../Cart/queries/cartQuery.gql';
|
|
27
30
|
|
|
28
31
|
const StyledForm = styled(Form)`
|
|
29
32
|
display: flex;
|
|
@@ -56,7 +59,7 @@ function AddToCartForm({
|
|
|
56
59
|
product,
|
|
57
60
|
variant,
|
|
58
61
|
getMissingOptions,
|
|
59
|
-
variantHandler
|
|
62
|
+
variantHandler
|
|
60
63
|
}) {
|
|
61
64
|
const configurationContext = useContext(ProductConfigurationContext);
|
|
62
65
|
const price = useDynamicPrice(product, variant);
|
|
@@ -68,7 +71,7 @@ function AddToCartForm({
|
|
|
68
71
|
missingOptions,
|
|
69
72
|
variantValidation,
|
|
70
73
|
hasVariants,
|
|
71
|
-
stockStatus
|
|
74
|
+
stockStatus
|
|
72
75
|
});
|
|
73
76
|
const [trigger, dismiss] = useNotification();
|
|
74
77
|
|
|
@@ -82,12 +85,12 @@ function AddToCartForm({
|
|
|
82
85
|
/>,
|
|
83
86
|
{
|
|
84
87
|
id: mutationId,
|
|
85
|
-
type: 'add-to-cart'
|
|
88
|
+
type: 'add-to-cart'
|
|
86
89
|
}
|
|
87
90
|
);
|
|
88
91
|
};
|
|
89
92
|
const onAddToCartError = () => {
|
|
90
|
-
return ({
|
|
93
|
+
return ({ mutationId, quantity, price, error }) => {
|
|
91
94
|
dismiss(mutationId);
|
|
92
95
|
|
|
93
96
|
trigger(
|
|
@@ -99,7 +102,7 @@ function AddToCartForm({
|
|
|
99
102
|
error={error}
|
|
100
103
|
/>,
|
|
101
104
|
{
|
|
102
|
-
type: 'add-to-cart'
|
|
105
|
+
type: 'add-to-cart'
|
|
103
106
|
}
|
|
104
107
|
);
|
|
105
108
|
};
|
|
@@ -136,9 +139,7 @@ function AddToCartForm({
|
|
|
136
139
|
css={{
|
|
137
140
|
marginBottom: '24px',
|
|
138
141
|
opacity:
|
|
139
|
-
configurationContext && configurationContext.loading
|
|
140
|
-
? 0.3
|
|
141
|
-
: 1,
|
|
142
|
+
configurationContext && configurationContext.loading ? 0.3 : 1
|
|
142
143
|
}}
|
|
143
144
|
/>
|
|
144
145
|
|
|
@@ -151,7 +152,7 @@ function AddToCartForm({
|
|
|
151
152
|
|
|
152
153
|
<StyledForm>
|
|
153
154
|
{product.customerComments &&
|
|
154
|
-
product.customerComments.map(
|
|
155
|
+
product.customerComments.map(comment => (
|
|
155
156
|
<InputWithLabel
|
|
156
157
|
wrapperClassName="customer-comment-input-wrapper"
|
|
157
158
|
className="customer-comment-input"
|
|
@@ -184,7 +185,7 @@ function AddToCartForm({
|
|
|
184
185
|
style={{
|
|
185
186
|
opacity: !!validationMessage ? 0.7 : 1,
|
|
186
187
|
cursor: !!validationMessage ? 'not-allowed' : 'pointer',
|
|
187
|
-
width: '100%'
|
|
188
|
+
width: '100%'
|
|
188
189
|
}}
|
|
189
190
|
>
|
|
190
191
|
{validationMessage ? validationMessage : t('Add to cart')}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from 'linaria/react';
|
|
3
|
+
|
|
1
4
|
import { useTracker } from '@jetshop/core/analytics/Analytics';
|
|
2
5
|
import { trackCartCheckoutEvent } from '@jetshop/core/analytics/tracking';
|
|
3
6
|
import ChannelContext from '@jetshop/core/components/ChannelContext';
|
|
@@ -5,11 +8,11 @@ import CartProvider from '@jetshop/core/components/Query/CartProvider';
|
|
|
5
8
|
import t from '@jetshop/intl';
|
|
6
9
|
import Image from '@jetshop/ui/Image/Image';
|
|
7
10
|
import { Price } from '@jetshop/ui/Price';
|
|
11
|
+
|
|
12
|
+
import { baseStyles } from '../../ui/Button';
|
|
8
13
|
import { theme } from '../../Theme';
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import { TrendLink, baseStyles } from '../../ui/Button';
|
|
12
|
-
import cartQuery from '../../Cart/CartQuery.gql';
|
|
14
|
+
|
|
15
|
+
import cartQuery from '../../Cart/queries/cartQuery.gql';
|
|
13
16
|
|
|
14
17
|
const Container = styled('aside')`
|
|
15
18
|
${theme.above.sm} {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { usePackageProduct } from '@jetshop/core/hooks/PackageProducts';
|
|
2
|
-
import { useIntl } from '@jetshop/intl';
|
|
3
|
-
import { Price } from '@jetshop/ui/Price';
|
|
4
1
|
import React, { useEffect, useRef } from 'react';
|
|
5
2
|
import { styled } from 'linaria/react';
|
|
6
3
|
import { css } from 'linaria';
|
|
7
|
-
|
|
8
|
-
import
|
|
4
|
+
|
|
5
|
+
import { usePackageProduct } from '@jetshop/core/hooks/PackageProducts';
|
|
6
|
+
import { useIntl } from '@jetshop/intl';
|
|
7
|
+
import { Price } from '@jetshop/ui/Price';
|
|
8
|
+
import { useNotification } from '@jetshop/core/components/Notifications';
|
|
9
9
|
import { ReactComponent as Cart } from '../../../svg/Cart.svg';
|
|
10
10
|
import {
|
|
11
11
|
default as Button,
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
import { PackageProductItem } from './PackageProductItem';
|
|
15
15
|
import packageProductQuery from './PackageProductQuery.gql';
|
|
16
16
|
import { theme } from '../../Theme';
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
import addMultipleToCartMutation from '../../Cart/queries/addMultipleToCart.gql';
|
|
19
|
+
import cartQuery from '../../Cart/queries/cartQuery.gql';
|
|
18
20
|
|
|
19
21
|
const PackageProductWrapper = styled('div')`
|
|
20
22
|
padding: 12px;
|
|
@@ -159,7 +159,7 @@ function DropdownVariantSelect({
|
|
|
159
159
|
<DropdownMenuItem
|
|
160
160
|
data-testid={value + option.name}
|
|
161
161
|
key={value + option.name}
|
|
162
|
-
disabled={doNotDisable && validation === 'invalid'}
|
|
162
|
+
disabled={!doNotDisable && validation === 'invalid'}
|
|
163
163
|
onSelect={({ setIsOpen }) => {
|
|
164
164
|
selectValue(value, option);
|
|
165
165
|
setIsOpen(false);
|
|
@@ -3,7 +3,7 @@ import { styled } from 'linaria/react';
|
|
|
3
3
|
import CategoryLink from '@jetshop/ui/CategoryLink';
|
|
4
4
|
import Image from '@jetshop/ui/Image';
|
|
5
5
|
import { theme } from '../Theme';
|
|
6
|
-
import
|
|
6
|
+
import MaxWidth from '../Layout/MaxWidth';
|
|
7
7
|
|
|
8
8
|
const ScrollWrapper = styled('div')`
|
|
9
9
|
margin: 0 -1.5rem;
|
|
@@ -112,7 +112,9 @@ const CategoriesHeader = styled('h3')`
|
|
|
112
112
|
}
|
|
113
113
|
`;
|
|
114
114
|
|
|
115
|
-
const CategoryListWrapper = styled('div')
|
|
115
|
+
const CategoryListWrapper = styled('div')`
|
|
116
|
+
padding: 1rem 0;
|
|
117
|
+
`;
|
|
116
118
|
|
|
117
119
|
const Category = ({ category }) => {
|
|
118
120
|
const categoryImageUrl = category?.images?.[0]?.url;
|
|
@@ -135,7 +137,7 @@ const Category = ({ category }) => {
|
|
|
135
137
|
};
|
|
136
138
|
const CategoryList = ({ title, categories, className = '' }) => {
|
|
137
139
|
return (
|
|
138
|
-
<
|
|
140
|
+
<MaxWidth className={className}>
|
|
139
141
|
<CategoryListWrapper>
|
|
140
142
|
<CategoriesHeader>{title}</CategoriesHeader>
|
|
141
143
|
<ScrollWrapper>
|
|
@@ -146,7 +148,7 @@ const CategoryList = ({ title, categories, className = '' }) => {
|
|
|
146
148
|
</CategoriesWrapper>
|
|
147
149
|
</ScrollWrapper>
|
|
148
150
|
</CategoryListWrapper>
|
|
149
|
-
</
|
|
151
|
+
</MaxWidth>
|
|
150
152
|
);
|
|
151
153
|
};
|
|
152
154
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from '@jetshop/intl';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Query } from 'react-apollo';
|
|
4
|
-
import CategoryList from '
|
|
4
|
+
import CategoryList from './CategoryList';
|
|
5
5
|
import { Header, Matches } from './SearchPage';
|
|
6
6
|
import SearchTerm from './SearchTerm';
|
|
7
7
|
import EmptySearchCategoriesQuery from './EmptySearchCategoriesQuery.gql';
|