@jetshop/template-trend 5.14.0-alpha.49df897e → 5.14.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/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 -45
- package/src/components/Layout/Header/ChannelSelector/ChannelSelectorModal.js +8 -1
- 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/PriceHistory.js +4 -2
- package/src/components/ProductPage/ProductPageFragment.gql +1 -0
- package/translations/default.json +3 -3
- package/translations/en.json +3 -0
- 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.14.
|
|
3
|
+
"version": "5.14.1",
|
|
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.14.
|
|
48
|
+
"@jetshop/core": "^5.14.1",
|
|
49
49
|
"@jetshop/flight-shortcodes": "^2.0.10",
|
|
50
|
-
"@jetshop/intl": "^5.14.
|
|
51
|
-
"@jetshop/react-scripts": "^5.14.
|
|
52
|
-
"@jetshop/ui": "^5.14.
|
|
50
|
+
"@jetshop/intl": "^5.14.1",
|
|
51
|
+
"@jetshop/react-scripts": "^5.14.1",
|
|
52
|
+
"@jetshop/ui": "^5.14.1",
|
|
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,49 +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
|
-
alt="Country Flag"
|
|
41
|
-
width="16"
|
|
42
|
-
height="12"
|
|
43
|
-
/>
|
|
44
|
-
{selectedChannel.country.name}
|
|
45
|
-
</button>
|
|
46
|
-
)}
|
|
47
|
-
</FlyoutTrigger>
|
|
48
|
-
<FlyoutTarget id="channel-selector">
|
|
49
|
-
{({ isOpen, hideTarget }) => (
|
|
50
|
-
<Flyout>
|
|
51
|
-
<Selector
|
|
52
|
-
channels={selectedChannelGroup || channels}
|
|
53
|
-
hideTarget={hideTarget}
|
|
54
|
-
selectedChannel={selectedChannel}
|
|
55
|
-
updateChannel={updateChannel}
|
|
56
|
-
/>
|
|
57
|
-
</Flyout>
|
|
58
|
-
)}
|
|
59
|
-
</FlyoutTarget>
|
|
60
|
-
</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>
|
|
61
40
|
)}
|
|
62
|
-
</
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
);
|
|
65
56
|
}
|
|
@@ -20,6 +20,7 @@ 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;
|
|
@@ -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
|
|
@@ -120,10 +120,12 @@ function PriceHistory({ articleNumber, variant }) {
|
|
|
120
120
|
const Table = ({ history, days }) => {
|
|
121
121
|
const { selectedChannel } = useContext(ChannelContext);
|
|
122
122
|
|
|
123
|
-
if (history?.length === 0) {
|
|
123
|
+
if (history?.previousPrice?.length === 0) {
|
|
124
124
|
return (
|
|
125
125
|
<div className="price-table">
|
|
126
|
-
<span
|
|
126
|
+
<span className="label">
|
|
127
|
+
{t('The price has not changed in the last { days } days', { days })}
|
|
128
|
+
</span>
|
|
127
129
|
</div>
|
|
128
130
|
);
|
|
129
131
|
}
|
|
@@ -341,9 +341,6 @@
|
|
|
341
341
|
"no_orders_found_ed613bce": {
|
|
342
342
|
"message": "No orders found"
|
|
343
343
|
},
|
|
344
|
-
"no_recent_price_changes_the_last_days_61d42dda": {
|
|
345
|
-
"message": "No recent price changes the last { days }"
|
|
346
|
-
},
|
|
347
344
|
"no_results_for_term_7528ef47": {
|
|
348
345
|
"message": "No results for <Term />"
|
|
349
346
|
},
|
|
@@ -614,6 +611,9 @@
|
|
|
614
611
|
"the_form_could_not_be_submitted_please_try_again_l_9a8b7579": {
|
|
615
612
|
"message": "The form could not be submitted. Please try again later."
|
|
616
613
|
},
|
|
614
|
+
"the_price_has_not_changed_in_the_last_days_days_7f5c65f8": {
|
|
615
|
+
"message": "The price has not changed in the last { days } days"
|
|
616
|
+
},
|
|
617
617
|
"there_are_no_products_in_your_saved_items_list_2870abb5": {
|
|
618
618
|
"message": "There are no products in your saved items list."
|
|
619
619
|
},
|
package/translations/en.json
CHANGED
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"
|