@jetshop/template-trend 5.13.2 → 5.13.3-beta.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.
@@ -3,7 +3,7 @@
3
3
  .ProductImageWrapper_p1i58doo{width:5rem;margin-right:1rem;}
4
4
  .ProductCheckoutContainer_pjx0jqi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;height:100%;width:100%;}.ProductCheckoutContainer_pjx0jqi a{-webkit-text-decoration:none;text-decoration:none;}.ProductCheckoutContainer_pjx0jqi a:hover{opacity:0.8;-webkit-text-decoration:none;text-decoration:none;color:white;}
5
5
  .Product_p3e3eyv{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;margin:16px;}
6
- .ProductDetails_p41hym0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;color:black;}
6
+ .ProductDetails_p41hym0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;color:black;}.ProductDetails_p41hym0 .price,.ProductDetails_p41hym0 .new-price{margin-top:0.75rem;}.ProductDetails_p41hym0 .old-price{margin-top:0.25rem;}.ProductDetails_p41hym0 .new-price{color:#EB0000;}
7
7
  .Header_hrfqnnj{font-size:16px;margin-bottom:8px;}
8
8
  .ProductName_p1jc6jl9{font-size:12px;}
9
9
  .Error_ednkb9d{color:red;margin-top:8px;font-size:12px;}
@@ -0,0 +1 @@
1
+ .Wrapper_wr5mleq{--innerFontSize:0.85rem;position:relative;}.Wrapper_wr5mleq .label{font-size:0.75rem;cursor:pointer;background:transparent;}.Wrapper_wr5mleq .price-table{position:absolute;padding:0.35rem 0.9rem;background:white;border:1px solid #e5e5e5;max-height:30rem;overflow:scroll;z-index:2;min-width:14rem;max-width:18rem;}.Wrapper_wr5mleq .price-table .label{font-size:var(--innerFontSize);}.Wrapper_wr5mleq .price-table li{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}.Wrapper_wr5mleq .price-table li .timestamp{font-size:var(--innerFontSize);}.Wrapper_wr5mleq .price-table li [data-flight-price=''] > .price{font-size:var(--innerFontSize);font-weight:normal;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/template-trend",
3
- "version": "5.13.2",
3
+ "version": "5.13.3-beta.0",
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.13.2",
48
+ "@jetshop/core": "^5.13.3-beta.0",
49
49
  "@jetshop/flight-shortcodes": "^2.0.10",
50
50
  "@jetshop/intl": "^5.13.2",
51
51
  "@jetshop/react-scripts": "^5.13.2",
52
- "@jetshop/ui": "^5.13.2",
52
+ "@jetshop/ui": "^5.13.3-beta.0",
53
53
  "@react-google-maps/api": "~1.7.0",
54
54
  "prop-types": "^15.6.2",
55
55
  "react": "^16.9.0",
@@ -21,7 +21,12 @@ export default class HeaderChannelSelector extends Component {
21
21
  render() {
22
22
  return (
23
23
  <ChannelContext.Consumer>
24
- {({ channels, selectedChannel, updateChannel }) => (
24
+ {({
25
+ channels,
26
+ selectedChannel,
27
+ updateChannel,
28
+ selectedChannelGroup
29
+ }) => (
25
30
  <Fragment>
26
31
  <FlyoutTrigger id="channel-selector">
27
32
  {({ showTarget, hideTarget, isOpen }) => (
@@ -44,7 +49,7 @@ export default class HeaderChannelSelector extends Component {
44
49
  {({ isOpen, hideTarget }) => (
45
50
  <Flyout>
46
51
  <Selector
47
- channels={channels}
52
+ channels={selectedChannelGroup || channels}
48
53
  hideTarget={hideTarget}
49
54
  selectedChannel={selectedChannel}
50
55
  updateChannel={updateChannel}
@@ -26,15 +26,14 @@ const modalStyles = css`
26
26
  `;
27
27
 
28
28
  const ChannelSelectorModal = props => {
29
- const { selectedChannel, channels, updateChannel } =
29
+ const { selectedChannel, channels, updateChannel, selectedChannelGroup } =
30
30
  useContext(ChannelContext);
31
-
32
31
  return (
33
32
  <ModalTrigger
34
33
  modalStyles={modalStyles}
35
34
  target={props => (
36
35
  <Selector
37
- channels={channels}
36
+ channels={selectedChannelGroup || channels}
38
37
  selectedChannel={selectedChannel}
39
38
  updateChannel={updateChannel}
40
39
  type={LargeSelector}
@@ -193,12 +193,8 @@ const Flyout = ({ children }) => (
193
193
  );
194
194
 
195
195
  const ChannelBanner = () => {
196
- const {
197
- channels,
198
- recommendedChannel,
199
- selectedChannel,
200
- updateChannel
201
- } = useContext(ChannelContext);
196
+ const { channels, recommendedChannel, selectedChannel, updateChannel } =
197
+ useContext(ChannelContext);
202
198
 
203
199
  const { bannerIsOpen, hideTheBanner } = useChannelBanner();
204
200
 
@@ -27,6 +27,7 @@ import WarehouseStock from '../StockStatus/WarehouseStock';
27
27
 
28
28
  import addToCartMutation from '../../Cart/queries/addToCart.gql';
29
29
  import CartQuery from '../../Cart/queries/cartQuery.gql';
30
+ import { PriceHistoryWrapper } from '../PriceHistory';
30
31
 
31
32
  const StyledForm = styled(Form)`
32
33
  display: flex;
@@ -140,6 +141,10 @@ function AddToCartForm({
140
141
  configurationContext && configurationContext.loading ? 0.3 : 1
141
142
  }}
142
143
  />
144
+ <PriceHistoryWrapper
145
+ articleNumber={product.articleNumber}
146
+ variant={variant}
147
+ />
143
148
 
144
149
  <Campaigns
145
150
  campaigns={product.campaigns}
@@ -67,6 +67,19 @@ const ProductDetails = styled('div')`
67
67
  flex-direction: column;
68
68
  flex-grow: 1;
69
69
  color: black;
70
+
71
+ .price,
72
+ .new-price {
73
+ margin-top: 0.75rem;
74
+ }
75
+
76
+ .old-price {
77
+ margin-top: 0.25rem;
78
+ }
79
+
80
+ .new-price {
81
+ color: ${theme.colors.red};
82
+ }
70
83
  `;
71
84
 
72
85
  const Header = styled('h3')`
@@ -0,0 +1,147 @@
1
+ import t from '@jetshop/intl';
2
+ import React, { useContext } from 'react';
3
+ import { useQuery } from '@apollo/react-hooks';
4
+ import PriceHistoryQuery from './PriceHistoryQuery.gql';
5
+ import { styled } from 'linaria/react';
6
+ import { Price } from '@jetshop/ui/Price';
7
+
8
+ import { FlyoutTrigger } from '@jetshop/ui/Modal/Flyout';
9
+ import { FlyoutTarget } from '@jetshop/ui/Modal/Flyout';
10
+ import ChannelContext from '@jetshop/core/components/ChannelContext/ChannelContext';
11
+
12
+ const Wrapper = styled.div`
13
+ --innerFontSize: 0.85rem;
14
+ position: relative;
15
+
16
+ .label {
17
+ font-size: 0.75rem;
18
+ cursor: pointer;
19
+ background: transparent;
20
+ }
21
+
22
+ .price-table {
23
+ position: absolute;
24
+ padding: 0.35rem 0.9rem;
25
+ background: white;
26
+ border: 1px solid #e5e5e5;
27
+ max-height: 30rem;
28
+ overflow: scroll;
29
+ z-index: 2;
30
+ min-width: 14rem;
31
+ max-width: 18rem;
32
+
33
+ .label {
34
+ font-size: var(--innerFontSize);
35
+ }
36
+
37
+ li {
38
+ display: flex;
39
+ justify-content: space-between;
40
+
41
+ .timestamp {
42
+ font-size: var(--innerFontSize);
43
+ }
44
+
45
+ [data-flight-price=''] {
46
+ > .price {
47
+ font-size: var(--innerFontSize);
48
+ font-weight: normal;
49
+ }
50
+ }
51
+ }
52
+ }
53
+ `;
54
+
55
+ export function PriceHistoryWrapper(props) {
56
+ return (
57
+ <Wrapper>
58
+ <FlyoutTrigger
59
+ id="price-history-flyout"
60
+ coverStyles={{ zIndex: 0, background: 'transparent' }}
61
+ >
62
+ {({ isOpen, hideTarget, showTarget }) => (
63
+ <button
64
+ onClick={() => {
65
+ if (isOpen) {
66
+ hideTarget();
67
+ } else {
68
+ showTarget();
69
+ }
70
+ }}
71
+ className="label"
72
+ >
73
+ {t('View price history')}
74
+ </button>
75
+ )}
76
+ </FlyoutTrigger>
77
+ <FlyoutTarget id="price-history-flyout">
78
+ {() => <PriceHistory {...props} />}
79
+ </FlyoutTarget>
80
+ </Wrapper>
81
+ );
82
+ }
83
+
84
+ const days = 30;
85
+ function PriceHistory({ articleNumber, variant }) {
86
+ const { error, loading, data } = useQuery(PriceHistoryQuery, {
87
+ variables: { articleNumber, days },
88
+ errorPolicy: 'all',
89
+ skip: !articleNumber
90
+ });
91
+
92
+ if (loading || error) {
93
+ return (
94
+ <div className="price-table">
95
+ {loading && (
96
+ <span className="label">
97
+ {t('Getting the last { days } days price changes...', {
98
+ days
99
+ })}
100
+ </span>
101
+ )}
102
+ {error && <span className="label">{t('Something went wrong')}</span>}
103
+ </div>
104
+ );
105
+ }
106
+
107
+ const { product } = data;
108
+
109
+ if (!variant) {
110
+ return <Table history={product.history} days={days} />;
111
+ }
112
+
113
+ const selectedVariant = product.variants.values.find(
114
+ value => value.articleNumber === variant.articleNumber
115
+ );
116
+
117
+ return <Table history={selectedVariant.history} days={days} />;
118
+ }
119
+
120
+ const Table = ({ history, days }) => {
121
+ const { selectedChannel } = useContext(ChannelContext);
122
+
123
+ if (history?.length === 0) {
124
+ return (
125
+ <div className="price-table">
126
+ <span>{t('No recent price changes the last { days }', { days })}</span>
127
+ </div>
128
+ );
129
+ }
130
+
131
+ return (
132
+ <div className="price-table">
133
+ <ul>
134
+ {history.previousPrice.map(({ timestamp, price }) => (
135
+ <li key={timestamp}>
136
+ <span className="timestamp">
137
+ {new Date(timestamp).toLocaleDateString([
138
+ selectedChannel.language.culture
139
+ ])}
140
+ </span>
141
+ <Price price={price} as="span" />
142
+ </li>
143
+ ))}
144
+ </ul>
145
+ </div>
146
+ );
147
+ };
@@ -0,0 +1,32 @@
1
+ query ProductPriceHistory($articleNumber: String!, $days: Int!) {
2
+ product(articleNumber: $articleNumber) {
3
+ id
4
+ articleNumber
5
+ history(days: $days) {
6
+ previousPrice {
7
+ timestamp
8
+ price {
9
+ incVat
10
+ exVat
11
+ vat
12
+ }
13
+ }
14
+ }
15
+
16
+ variants {
17
+ values {
18
+ articleNumber
19
+ history(days: $days) {
20
+ previousPrice {
21
+ timestamp
22
+ price {
23
+ incVat
24
+ vat
25
+ exVat
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
@@ -14,7 +14,7 @@ import ContentPage from './components/ContentPage/ContentPage.loadable';
14
14
  const config = {
15
15
  theme,
16
16
  apolloConfig: {
17
- shopid: process.env.REACT_APP_SHOP_ID || 'demostore',
17
+ shopid: process.env.REACT_APP_SHOP_ID || 'kalaskungen',
18
18
  graphQLURI:
19
19
  process.env.REACT_APP_GRAPHQL_URI || 'https://storeapi.jetshop.io/',
20
20
  token:
@@ -46,10 +46,7 @@ const config = {
46
46
  },
47
47
  channelOverrides: {},
48
48
  disableGeoRedirect: true,
49
- singleDomainMode:
50
- typeof process.env.REACT_APP_SINGLE_DOMAIN_MODE === 'undefined'
51
- ? true
52
- : process.env.REACT_APP_SINGLE_DOMAIN_MODE, // default to true if this env var is not set
49
+ singleDomainMode: false,
53
50
  schemaExtensions: [],
54
51
  preserveRedirect: true,
55
52
  structuredData: {
@@ -197,6 +197,9 @@
197
197
  "free_shipping_and_return_355b42d1": {
198
198
  "message": "Free shipping and return"
199
199
  },
200
+ "getting_the_last_days_days_price_changes_bedecd5": {
201
+ "message": "Getting the last { days } days price changes..."
202
+ },
200
203
  "go_to_country_517a8515": {
201
204
  "message": "Go to { country }"
202
205
  },
@@ -338,6 +341,9 @@
338
341
  "no_orders_found_ed613bce": {
339
342
  "message": "No orders found"
340
343
  },
344
+ "no_recent_price_changes_the_last_days_61d42dda": {
345
+ "message": "No recent price changes the last { days }"
346
+ },
341
347
  "no_results_for_term_7528ef47": {
342
348
  "message": "No results for <Term />"
343
349
  },
@@ -683,6 +689,9 @@
683
689
  "view_password_ec63cb11": {
684
690
  "message": "View password"
685
691
  },
692
+ "view_price_history_8078c9af": {
693
+ "message": "View price history"
694
+ },
686
695
  "visit_product_page_to_add_54331147": {
687
696
  "message": "Visit product page to add"
688
697
  },
@@ -772,5 +772,14 @@
772
772
  },
773
773
  "email_address_is_required_24d62494": {
774
774
  "message": "E-postadress är obligatoriskt."
775
+ },
776
+ "getting_the_last_days_days_price_changes_bedecd5": {
777
+ "message": "Hämtar de senaste { days } dagarnas prisändringar..."
778
+ },
779
+ "no_recent_price_changes_the_last_days_61d42dda": {
780
+ "message": "Hittade inte några prisförändringar senaste { days } dagarna"
781
+ },
782
+ "view_price_history_8078c9af": {
783
+ "message": "Visa prishistorik"
775
784
  }
776
785
  }
@@ -1,7 +0,0 @@
1
- .ScrollWrapper_s140peh{margin:0 -1.5rem;padding:0 1.5rem 3rem;}@media (max-width:49.99rem){.ScrollWrapper_s140peh{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;}}@media (max-width:39.99rem){.ScrollWrapper_s140peh{margin:0 0;padding:0 1rem 3rem;}}
2
- .CategoriesWrapper_c1o22ktz{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin-right:-0.5rem;margin-left:-0.5rem;}.CategoriesWrapper_c1o22ktz:hover > a > div{opacity:0.8;}@media (max-width:49.99rem){.CategoriesWrapper_c1o22ktz > a{-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;width:160px;}}
3
- .CategoryCard_c11pqhux{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-pack:stretch;-webkit-justify-content:stretch;-ms-flex-pack:stretch;justify-content:stretch;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;background:#ffffff;box-shadow:4px 8px 32px rgba(0,0,0,0.1);-webkit-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out;width:100%;height:100%;position:relative;}
4
- .CardPaddingWrapper_c1l548id{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-pack:stretch;-webkit-justify-content:stretch;-ms-flex-pack:stretch;justify-content:stretch;width:50%;padding-left:0.5rem;padding-right:0.5rem;max-width:16rem;-webkit-text-decoration:none;text-decoration:none;}@media (min-width:50rem){.CardPaddingWrapper_c1l548id{width:33.33333333333333%;}}@media (min-width:64rem){.CardPaddingWrapper_c1l548id{width:20%;}}.CardPaddingWrapper_c1l548id:hover > div,.CardPaddingWrapper_c1l548id:focus > div,.CardPaddingWrapper_c1l548id:active > div{opacity:1 !important;box-shadow:4px 8px 32px rgba(0,0,0,0.1), 4px 8px 40px rgba(0,0,0,0.1);-webkit-transform:translate(0,-2px);-ms-transform:translate(0,-2px);transform:translate(0,-2px);-webkit-transition-duration:100ms;transition-duration:100ms;z-index:2;}
5
- .CategoryName_cmpnef6{text-align:center;font-weight:bold;font-size:16px;text-transform:uppercase;color:#000;-webkit-text-decoration:none;text-decoration:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:3rem;}@media (min-width:50rem){.CategoryName_cmpnef6{height:5rem;}}
6
- .CategoriesHeader_cmtbqnf{margin-bottom:1rem;font-size:24px;}@media (max-width:39.99rem){.CategoriesHeader_cmtbqnf{font-size:18px;margin-left:1rem;}}
7
-
@@ -1 +0,0 @@
1
- .preventBodyScrollStyle_p1lthaoa{overflow:hidden;}
@@ -1,11 +0,0 @@
1
- {
2
- "configurations": [
3
- {
4
- "type": "node-terminal",
5
- "name": "Run Script: start",
6
- "request": "launch",
7
- "command": "yarn run start",
8
- "cwd": "${workspaceFolder}"
9
- }
10
- ]
11
- }