Skip to content

Commit 2d1a88f

Browse files
committed
Merge branch 'cart-basic' into development
2 parents 3d455eb + af18075 commit 2d1a88f

58 files changed

Lines changed: 5030 additions & 2669 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ VUE_APP_CT_API_HOST=https://api.commercetools.co
4444

4545
This will set up the necessary environment variables required to run SUNRISE. Feel free to choose any other approach that best suits your needs.
4646

47+
## Development tips
48+
49+
### Add any queried fields to the mutation
50+
When executing a mutation (e.g. to update the active cart), we receive as a response the updated resource, which Apollo then uses to update the cached data in Apollo store. It is thanks to this cache that all components are able to display the same information, even after mutations.
51+
52+
But when we under-fetch in the mutation and fail to update some cached fields we are displaying in a component, this component will not be updated at all with any new data. To avoid that, make sure to add any field you are querying in the mutation. The update mutations are found in the methods `updateMyCart` and `updateMyCustomer`.
53+
54+
Related issue: https://github.com/apollographql/apollo-client/issues/3267
55+
4756

4857
## Run tests
4958
The project has unit and end-to-end tests covering each functionality. Unit tests will run out of the box, but end-to-end tests require some further configuration, explained in the section below.

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
transform: {
99
'^.+\\.vue$': 'vue-jest',
1010
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
11+
'\\.(gql|graphql)$': 'jest-transform-graphql',
1112
'^.+\\.jsx?$': 'babel-jest',
1213
},
1314
moduleNameMapper: {

package-lock.json

Lines changed: 1922 additions & 1466 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
"dependencies": {
1313
"@commercetools/sdk-auth": "^1.5.0",
1414
"apollo-cache-inmemory": "^1.3.5",
15-
"apollo-client": "^2.4.2",
15+
"apollo-client": "^2.4.12",
1616
"apollo-link-context": "^1.0.8",
1717
"babel-loader": "^8.0.2",
1818
"graphql-tag": "^2.9.0",
19+
"lodash.debounce": "^4.0.8",
1920
"register-service-worker": "^1.0.0",
2021
"vue": "^2.5.17",
2122
"vue-apollo": "^3.0.0-beta.25",
2223
"vue-cli-plugin-apollo": "^0.17.2",
23-
"vue-clickaway": "^2.2.2",
2424
"vue-i18n": "^8.4.0",
25+
"vue-perfect-scrollbar": "^0.1.0",
2526
"vue-product-zoomer": "^2.0.11",
2627
"vue-router": "^3.0.1",
2728
"vuelidate": "^0.7.4",
@@ -30,13 +31,13 @@
3031
"devDependencies": {
3132
"@cypress/webpack-preprocessor": "^4.0.2",
3233
"@kazupon/vue-i18n-loader": "^0.3.0",
33-
"@vue/cli-plugin-babel": "^3.0.3",
34-
"@vue/cli-plugin-e2e-cypress": "^3.0.3",
35-
"@vue/cli-plugin-eslint": "^3.0.3",
36-
"@vue/cli-plugin-pwa": "^3.0.3",
37-
"@vue/cli-plugin-unit-jest": "^3.0.3",
38-
"@vue/cli-service": "^3.0.3",
39-
"@vue/eslint-config-airbnb": "^3.0.3",
34+
"@vue/cli-plugin-babel": "^3.4.0",
35+
"@vue/cli-plugin-e2e-cypress": "^3.4.0",
36+
"@vue/cli-plugin-eslint": "^3.4.0",
37+
"@vue/cli-plugin-pwa": "^3.4.0",
38+
"@vue/cli-plugin-unit-jest": "^3.4.0",
39+
"@vue/cli-service": "^3.4.0",
40+
"@vue/eslint-config-airbnb": "^4.0.0",
4041
"@vue/test-utils": "^1.0.0-beta.24",
4142
"babel-core": "7.0.0-bridge.0",
4243
"babel-jest": "^23.4.2",
@@ -45,6 +46,7 @@
4546
"jest-fetch-mock": "^1.6.6",
4647
"jest-junit": "^5.1.0",
4748
"jest-localstorage-mock": "^2.2.0",
49+
"jest-transform-graphql": "^2.1.0",
4850
"lint-staged": "^7.2.2",
4951
"mocha": "^5.2.0",
5052
"mocha-junit-reporter": "^1.18.0",

public/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script>
3232
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
3333
<script src="https://cdn.jsdelivr.net/jquery.slick/1.5.8/slick.min.js"></script>
34-
<script src="https://cdn.jsdelivr.net/jquery.mcustomscrollbar/3.0.6/jquery.mCustomScrollbar.concat.min.js"></script>
3534
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.8.0/jquery.selectBoxIt.min.js"></script>
3635
<script src="<%= BASE_URL %>js/animatedModal.min.js"></script>
3736
<script src="<%= BASE_URL %>js/main.js"></script>

public/js/main.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ sizeGuideTable.prototype = {
5656

5757
$(document).ready(() => {
5858
$(window).load(() => {
59+
// Custom scrollbar no longer exists as a dependency, but this functionality is not yet implemented
60+
// It's commented out until the functionality is implemented, to keep it as a reference
5961
// makes the scrollbar's design the same in all browsers
60-
$('.nav-minicart ul, .order-summary-items').mCustomScrollbar({
61-
theme: 'dark',
62-
scrollInertia: 50,
63-
});
64-
65-
$('.store-location-wrapper > .addresses').mCustomScrollbar({
66-
theme: 'dark-thin',
67-
scrollInertia: 50,
68-
});
62+
// $('.order-summary-items').mCustomScrollbar({
63+
// theme: 'dark',
64+
// scrollInertia: 50,
65+
// });
66+
//
67+
// $('.store-location-wrapper > .addresses').mCustomScrollbar({
68+
// theme: 'dark-thin',
69+
// scrollInertia: 50,
70+
// });
6971
});
7072

7173
// "Select" elements becomes customized
@@ -75,19 +77,6 @@ $(document).ready(() => {
7577
$('.search-toggle').click(() => {
7678
$('.search-box').slideToggle();
7779
});
78-
79-
// Your bag dropdown
80-
$('.link-your-bag').click(() => {
81-
$('.nav-minicart').slideToggle();
82-
});
83-
84-
// Closing dropdown on click outside of it
85-
$('html').click(() => {
86-
$('.nav-minicart').hide();
87-
});
88-
$('.list-item-bag, .nav-minicart').click((event) => {
89-
event.stopPropagation();
90-
});
9180
});
9281

9382
// Toggling plus and minus icons for mobile navigation menu

src/assets/img/loading.svg

Lines changed: 17 additions & 0 deletions
Loading

src/assets/scss/_add-to-bag-btn.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111
}
1212
.bag-thumb {
13-
height: 25px;
14-
margin: 0.5em 0.9em 0.7em 0;
13+
height: 20px;
14+
margin-right: 0.6em;
1515
}

src/assets/scss/_general.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ button {
192192
}
193193

194194
.fade-enter-active, .fade-leave-active {
195-
transition: opacity .5s;
195+
transition: all .5s;
196196
}
197197
.fade-enter, .fade-leave-to {
198198
opacity: 0;

src/assets/scss/_my-account-personal-details.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,6 @@
188188
}
189189
}
190190
.personal-details-edit-btn {
191-
.update-btn {
192-
text-transform: uppercase;
193-
background: $my-sin;
194-
padding: 10px 20px;
195-
font-weight: bold;
196-
letter-spacing: 1px;
197-
margin-right: 15px;
198-
font-size: 16px;
199-
&:hover {
200-
background: lighten($my-sin, 5%);
201-
}
202-
@media screen and (max-width: 767px) {
203-
margin-bottom: 10px;
204-
}
205-
}
206191
.cancel-btn {
207192
border: 2px solid $silver-chalice;
208193
color: $silver-chalice;

0 commit comments

Comments
 (0)