@jetshop/template-trend 5.14.0 → 5.15.0-alpha.184e18a2
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/package.json +5 -5
- package/src/components/CategoryPage/ProductCard.js +1 -0
- package/src/components/CategoryPage/ProductGridFragment.gql +1 -0
- package/src/components/Layout/Header/ChannelSelector/ChannelSelector.js +36 -40
- package/src/components/Layout/Header/ChannelSelector/ChannelSelectorModal.js +10 -3
- package/src/components/Layout/Header/ChannelSelector/Selector.js +5 -1
- package/src/components/Layout/Header/MobileMenu.js +1 -1
- package/src/components/Layout/Header/RecommendedChannel/ChannelBanner.js +8 -3
- package/src/components/Layout/Header/RecommendedChannel/RecommendedChannelSelector.js +1 -8
- package/src/components/ProductList/AddToCart.js +5 -1
- package/src/components/ProductList/Favourites.js +1 -1
- package/src/components/ProductList/ProductLists.gql +1 -0
- package/src/components/ProductPage/AddToCart/AddToCartForm.js +10 -6
- package/src/components/ProductPage/ProductPageFragment.gql +1 -0
- package/src/shop.config.js +1 -1
- package/translations/sv.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetshop/template-trend",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0-alpha.184e18a2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "react-scripts build",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@jetshop/core": "^5.
|
|
48
|
+
"@jetshop/core": "^5.15.0-alpha.184e18a2",
|
|
49
49
|
"@jetshop/flight-shortcodes": "^2.0.10",
|
|
50
|
-
"@jetshop/intl": "^5.
|
|
51
|
-
"@jetshop/react-scripts": "^5.
|
|
52
|
-
"@jetshop/ui": "^5.
|
|
50
|
+
"@jetshop/intl": "^5.15.0-alpha.184e18a2",
|
|
51
|
+
"@jetshop/react-scripts": "^5.15.0-alpha.184e18a2",
|
|
52
|
+
"@jetshop/ui": "^5.15.0-alpha.184e18a2",
|
|
53
53
|
"@react-google-maps/api": "~1.7.0",
|
|
54
54
|
"prop-types": "^15.6.2",
|
|
55
55
|
"react": "^16.9.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ChannelContext from '@jetshop/core/components/ChannelContext';
|
|
2
2
|
import { FlyoutTarget, FlyoutTrigger } from '@jetshop/ui/Modal/Flyout';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
4
|
import Selector from './Selector';
|
|
5
5
|
import { styled } from 'linaria/react';
|
|
6
6
|
|
|
@@ -17,44 +17,40 @@ const CountryFlag = styled('img')`
|
|
|
17
17
|
margin-right: 5px;
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</button>
|
|
41
|
-
)}
|
|
42
|
-
</FlyoutTrigger>
|
|
43
|
-
<FlyoutTarget id="channel-selector">
|
|
44
|
-
{({ isOpen, hideTarget }) => (
|
|
45
|
-
<Flyout>
|
|
46
|
-
<Selector
|
|
47
|
-
channels={channels}
|
|
48
|
-
hideTarget={hideTarget}
|
|
49
|
-
selectedChannel={selectedChannel}
|
|
50
|
-
updateChannel={updateChannel}
|
|
51
|
-
/>
|
|
52
|
-
</Flyout>
|
|
53
|
-
)}
|
|
54
|
-
</FlyoutTarget>
|
|
55
|
-
</Fragment>
|
|
20
|
+
export default function HeaderChannelSelector() {
|
|
21
|
+
const { selectedChannel, channels, updateChannel, selectedChannelGroup } =
|
|
22
|
+
useContext(ChannelContext);
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<FlyoutTrigger id="channel-selector">
|
|
26
|
+
{({ showTarget, hideTarget, isOpen }) => (
|
|
27
|
+
<button
|
|
28
|
+
data-testid="channel-selector-button"
|
|
29
|
+
onClick={isOpen ? hideTarget : showTarget}
|
|
30
|
+
style={{ background: 'transparent' }}
|
|
31
|
+
>
|
|
32
|
+
<CountryFlag
|
|
33
|
+
src={`https://countryflags.jetshop.io/${selectedChannel.country.code}/flat/32.png`}
|
|
34
|
+
alt="Country Flag"
|
|
35
|
+
width="16"
|
|
36
|
+
height="12"
|
|
37
|
+
/>
|
|
38
|
+
{selectedChannel.country.name}
|
|
39
|
+
</button>
|
|
56
40
|
)}
|
|
57
|
-
</
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
</FlyoutTrigger>
|
|
42
|
+
<FlyoutTarget id="channel-selector">
|
|
43
|
+
{({ isOpen, hideTarget }) => (
|
|
44
|
+
<Flyout>
|
|
45
|
+
<Selector
|
|
46
|
+
channels={selectedChannelGroup || channels}
|
|
47
|
+
hideTarget={hideTarget}
|
|
48
|
+
selectedChannel={selectedChannel}
|
|
49
|
+
updateChannel={updateChannel}
|
|
50
|
+
/>
|
|
51
|
+
</Flyout>
|
|
52
|
+
)}
|
|
53
|
+
</FlyoutTarget>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
60
56
|
}
|
|
@@ -20,20 +20,21 @@ const modalStyles = css`
|
|
|
20
20
|
right: 0;
|
|
21
21
|
top: 0;
|
|
22
22
|
bottom: 0;
|
|
23
|
+
position: fixed;
|
|
23
24
|
background: white;
|
|
24
25
|
padding: 1rem;
|
|
25
26
|
outline: none;
|
|
26
27
|
`;
|
|
27
28
|
|
|
28
29
|
const ChannelSelectorModal = props => {
|
|
29
|
-
const { selectedChannel, channels, updateChannel } =
|
|
30
|
+
const { selectedChannel, channels, updateChannel, selectedChannelGroup } =
|
|
30
31
|
useContext(ChannelContext);
|
|
31
32
|
return (
|
|
32
33
|
<ModalTrigger
|
|
33
34
|
modalStyles={modalStyles}
|
|
34
35
|
target={props => (
|
|
35
36
|
<Selector
|
|
36
|
-
channels={channels}
|
|
37
|
+
channels={selectedChannelGroup || channels}
|
|
37
38
|
selectedChannel={selectedChannel}
|
|
38
39
|
updateChannel={updateChannel}
|
|
39
40
|
type={LargeSelector}
|
|
@@ -42,7 +43,13 @@ const ChannelSelectorModal = props => {
|
|
|
42
43
|
)}
|
|
43
44
|
>
|
|
44
45
|
{({ showTarget }) => (
|
|
45
|
-
<Button
|
|
46
|
+
<Button
|
|
47
|
+
onClick={() => {
|
|
48
|
+
props.hideMobileMenu();
|
|
49
|
+
showTarget();
|
|
50
|
+
}}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
46
53
|
<img
|
|
47
54
|
src={`https://countryflags.jetshop.io/${selectedChannel.country.code}/flat/32.png`}
|
|
48
55
|
alt="Country Flag"
|
|
@@ -83,6 +83,11 @@ const StyledTitle = styled(Title)`
|
|
|
83
83
|
padding: 2px 0 16px;
|
|
84
84
|
margin-bottom: 4px;
|
|
85
85
|
font-size: 14px;
|
|
86
|
+
${theme.below.lg} {
|
|
87
|
+
&& {
|
|
88
|
+
padding-bottom: 0.5rem;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
86
91
|
`;
|
|
87
92
|
|
|
88
93
|
const actions = css`
|
|
@@ -113,7 +118,6 @@ const Selector = ({
|
|
|
113
118
|
channels={channels}
|
|
114
119
|
initialChannel={selectedChannel}
|
|
115
120
|
render={({
|
|
116
|
-
channels,
|
|
117
121
|
currencyItems,
|
|
118
122
|
languageItems,
|
|
119
123
|
selectedChannel,
|
|
@@ -193,8 +193,13 @@ const Flyout = ({ children }) => (
|
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
const ChannelBanner = () => {
|
|
196
|
-
const {
|
|
197
|
-
|
|
196
|
+
const {
|
|
197
|
+
channels,
|
|
198
|
+
recommendedChannel,
|
|
199
|
+
selectedChannel,
|
|
200
|
+
updateChannel,
|
|
201
|
+
selectedChannelGroup
|
|
202
|
+
} = useContext(ChannelContext);
|
|
198
203
|
|
|
199
204
|
const { bannerIsOpen, hideTheBanner } = useChannelBanner();
|
|
200
205
|
|
|
@@ -247,7 +252,7 @@ const ChannelBanner = () => {
|
|
|
247
252
|
{({ isOpen, hideTarget }) => (
|
|
248
253
|
<Flyout>
|
|
249
254
|
<Selector
|
|
250
|
-
channels={channels}
|
|
255
|
+
channels={selectedChannelGroup || channels}
|
|
251
256
|
selectedChannel={selectedChannel}
|
|
252
257
|
updateChannel={updateChannel}
|
|
253
258
|
hideTarget={hideTarget}
|
|
@@ -114,13 +114,7 @@ const StyledCancelButton = styled(CancelButton)`
|
|
|
114
114
|
border: 1px solid #e1e1e1;
|
|
115
115
|
`;
|
|
116
116
|
|
|
117
|
-
const Selector = ({
|
|
118
|
-
channels,
|
|
119
|
-
selectedChannel,
|
|
120
|
-
updateChannel,
|
|
121
|
-
setOpenBanner,
|
|
122
|
-
hideTarget
|
|
123
|
-
}) => {
|
|
117
|
+
const Selector = ({ channels, selectedChannel, updateChannel, hideTarget }) => {
|
|
124
118
|
const [countries] = useState(flattenCountries(channels));
|
|
125
119
|
|
|
126
120
|
return (
|
|
@@ -128,7 +122,6 @@ const Selector = ({
|
|
|
128
122
|
channels={channels}
|
|
129
123
|
initialChannel={selectedChannel}
|
|
130
124
|
render={({
|
|
131
|
-
channels,
|
|
132
125
|
currencyItems,
|
|
133
126
|
languageItems,
|
|
134
127
|
selectedChannel,
|
|
@@ -58,7 +58,11 @@ export function AddToCart({ product }) {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<button
|
|
61
|
+
<button
|
|
62
|
+
className={addButton}
|
|
63
|
+
onClick={() => add()}
|
|
64
|
+
disabled={product.hidePrice}
|
|
65
|
+
>
|
|
62
66
|
{t('Add to cart')}
|
|
63
67
|
</button>
|
|
64
68
|
);
|
|
@@ -125,7 +125,7 @@ function getItemsForAddToCart(products) {
|
|
|
125
125
|
// to be the variant rather than the base product
|
|
126
126
|
return products
|
|
127
127
|
.filter(product => {
|
|
128
|
-
return product.validation.status === 'valid';
|
|
128
|
+
return product.validation.status === 'valid' && !product.hidePrice;
|
|
129
129
|
})
|
|
130
130
|
.map(product => ({
|
|
131
131
|
...product,
|
|
@@ -65,9 +65,10 @@ function AddToCartForm({
|
|
|
65
65
|
const configurationContext = useContext(ProductConfigurationContext);
|
|
66
66
|
const price = useDynamicPrice(product, variant);
|
|
67
67
|
const stockStatus = useStockStatus(variant || product);
|
|
68
|
+
|
|
68
69
|
const outOfStockNotify = stockStatus.status === 'notifyWhenBack';
|
|
69
70
|
const { validation: variantValidation, missingOptions } = variantHandler;
|
|
70
|
-
const { hasVariants } = product;
|
|
71
|
+
const { hasVariants, hidePrice } = product;
|
|
71
72
|
const { validationMessage, enableValidation } = useProductValidationMessage({
|
|
72
73
|
missingOptions,
|
|
73
74
|
variantValidation,
|
|
@@ -134,6 +135,7 @@ function AddToCartForm({
|
|
|
134
135
|
product={product}
|
|
135
136
|
/>
|
|
136
137
|
<Price
|
|
138
|
+
hidePrice={product.hidePrice}
|
|
137
139
|
{...price}
|
|
138
140
|
css={{
|
|
139
141
|
marginBottom: '24px',
|
|
@@ -141,10 +143,12 @@ function AddToCartForm({
|
|
|
141
143
|
configurationContext && configurationContext.loading ? 0.3 : 1
|
|
142
144
|
}}
|
|
143
145
|
/>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
{!hidePrice && (
|
|
147
|
+
<PriceHistoryWrapper
|
|
148
|
+
articleNumber={product.articleNumber}
|
|
149
|
+
variant={variant}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
148
152
|
|
|
149
153
|
<Campaigns
|
|
150
154
|
campaigns={product.campaigns}
|
|
@@ -170,7 +174,7 @@ function AddToCartForm({
|
|
|
170
174
|
status={stockStatus.status}
|
|
171
175
|
text={stockStatus.text}
|
|
172
176
|
/>
|
|
173
|
-
{!outOfStockNotify && (
|
|
177
|
+
{!outOfStockNotify && !hidePrice && (
|
|
174
178
|
<QuantityAddToCartWrapper>
|
|
175
179
|
<InputWithLabel
|
|
176
180
|
disableValidation
|
package/src/shop.config.js
CHANGED
|
@@ -45,7 +45,7 @@ const config = {
|
|
|
45
45
|
options: {}
|
|
46
46
|
},
|
|
47
47
|
channelOverrides: {},
|
|
48
|
-
disableGeoRedirect: true,
|
|
48
|
+
disableGeoRedirect: process.env.REACT_APP_DISABLE_GEOREDIRECT || true,
|
|
49
49
|
singleDomainMode:
|
|
50
50
|
typeof process.env.REACT_APP_SINGLE_DOMAIN_MODE === 'undefined'
|
|
51
51
|
? true
|
package/translations/sv.json
CHANGED
|
@@ -776,8 +776,8 @@
|
|
|
776
776
|
"getting_the_last_days_days_price_changes_bedecd5": {
|
|
777
777
|
"message": "Hämtar de senaste { days } dagarnas prisändringar..."
|
|
778
778
|
},
|
|
779
|
-
"
|
|
780
|
-
"message": "Hittade inte några prisförändringar senaste { days } dagarna"
|
|
779
|
+
"the_price_has_not_changed_in_the_last_days_days_7f5c65f8": {
|
|
780
|
+
"message": "Hittade inte några prisförändringar de senaste { days } dagarna"
|
|
781
781
|
},
|
|
782
782
|
"view_price_history_8078c9af": {
|
|
783
783
|
"message": "Visa prishistorik"
|