Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit d366189

Browse files
author
Tomasz Kostuch
authored
Merge pull request #4649 from DivanteLtd/hotfix/v1.12.2
Release/v1.12.2
2 parents 0e59beb + ca90b04 commit d366189

File tree

28 files changed

+172
-75
lines changed

28 files changed

+172
-75
lines changed

.github/workflows/deploy-storefrontcloud.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
node-version: "10.x"
2121
- name: Create config file
2222
run: |
23-
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"index":"vue_storefront_magento_1"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true}}' > config/local-cloud-demo.json
24-
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"index":"vue_storefront_magento_1"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true}}' > config/local-cloud-next.json
25-
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://test.storefrontcloud.io"},"elasticsearch":{"index":"vue_storefront_magento_1"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true}}' > config/local-cloud-test.json
23+
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://demo.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://demo.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://demo.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://demo.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://demo.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://demo.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://demo.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://demo.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://demo.storefrontcloud.io/api/order"},"users":{"endpoint":"https://demo.storefrontcloud.io/api/user","history_endpoint":"https://demo.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://demo.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://demo.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://demo.storefrontcloud.io/api/user/login","create_endpoint":"https://demo.storefrontcloud.io/api/user/create","me_endpoint":"https://demo.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://demo.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://demo.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://demo.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://demo.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://demo.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://demo.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-demo.json
24+
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://demo.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://demo.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://demo.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://demo.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://demo.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://demo.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://demo.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://demo.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://demo.storefrontcloud.io/api/order"},"users":{"endpoint":"https://demo.storefrontcloud.io/api/user","history_endpoint":"https://demo.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://demo.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://demo.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://demo.storefrontcloud.io/api/user/login","create_endpoint":"https://demo.storefrontcloud.io/api/user/create","me_endpoint":"https://demo.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://demo.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://demo.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://demo.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://demo.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://demo.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://demo.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-next.json
25+
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://test.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://test.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://test.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://test.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://test.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://test.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://test.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://test.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://test.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://test.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://test.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://test.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://test.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://test.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://test.storefrontcloud.io/api/order"},"users":{"endpoint":"https://test.storefrontcloud.io/api/user","history_endpoint":"https://test.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://test.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://test.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://test.storefrontcloud.io/api/user/login","create_endpoint":"https://test.storefrontcloud.io/api/user/create","me_endpoint":"https://test.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://test.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://test.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://test.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://test.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://test.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://test.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-test.json
2626
- name: Build and publish docker image
2727
uses: elgohr/Publish-Docker-Github-Action@master
2828
with:

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.12.2] - 2020.07.28
9+
10+
### Added
11+
12+
- **IMPORTANT** for security reasons we added new config `users.allowModification`.
13+
This can help to dissallow modifying fields that shouldn't be changed by user.
14+
- Add helmet - enabled by default, you can pass configuration by adding `config.server.helmet.config`.
15+
More info about helmet configuration https://helmetjs.github.io/docs/
16+
- Add config `users.tokenInHeader` which allows to send token in header instead in query. Require to set on true same config in vsf-api.
17+
- Make calculation of bundled products price by options optional - @cewald (#4556)
18+
19+
### Fixed
20+
21+
- remove deprecated value from attributesListQuery query - @gibkigonzo (#4572)
22+
- Fixed dutch translations - @1070rik (#4587)
23+
- localForage memory overload fixed. `localForage.preserveCollections` keeps names of collections to be preserved from being cleared. - @prakowski
24+
- Fixed bug in `restoreQuantity` - getItem never returns cart item - @gibkigonzo (#4619)
25+
- Separate variant in findProductOption to get parent sku - @gibkigonzo (#4641)
26+
- Fix wrong value in Cache-Control header for max-age - boehsermoe (#4657)
27+
28+
### Changed / Improved
29+
830
## [1.12.1] - 2020.06.22
931

1032
### Added

config/default.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"trace": {
6767
"enabled": false,
6868
"config": {}
69+
},
70+
"helmet": {
71+
"enabled": true
6972
}
7073
},
7174
"initialResources": [
@@ -615,6 +618,7 @@
615618
"clearPricesBeforePlatformSync": false,
616619
"waitForPlatformSync": false,
617620
"setupVariantByAttributeCode": true,
621+
"calculateBundlePriceByOptions": true,
618622
"endpoint": "/api/product",
619623
"defaultFilters": [
620624
"color",
@@ -701,7 +705,11 @@
701705
"syncTasks": "LOCALSTORAGE",
702706
"ordersHistory": "LOCALSTORAGE",
703707
"checkout": "LOCALSTORAGE"
704-
}
708+
},
709+
"preserveCollections": [
710+
"cart",
711+
"user"
712+
]
705713
},
706714
"reviews": {
707715
"create_endpoint": "/api/review/create"
@@ -717,7 +725,9 @@
717725
"login_endpoint": "/api/user/login",
718726
"create_endpoint": "/api/user/create",
719727
"me_endpoint": "/api/user/me?token={{token}}",
720-
"refresh_endpoint": "/api/user/refresh"
728+
"refresh_endpoint": "/api/user/refresh",
729+
"allowModification": ["firstname", "lastname", "email", "addresses"],
730+
"tokenInHeader": false
721731
},
722732
"stock": {
723733
"synchronize": true,

core/data-resolver/ProductService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,18 @@ const getProductRenderList = async ({
104104
url = `${url}&userGroupId=${userGroupId}`
105105
}
106106

107-
if (token) {
107+
if (token && !config.users.tokenInHeader) {
108108
url = `${url}&token=${token}`
109109
}
110110

111111
try {
112112
const task = await TaskQueue.execute({ url, // sync the cart
113113
payload: {
114114
method: 'GET',
115-
headers: { 'Content-Type': 'application/json' },
115+
headers: {
116+
'Content-Type': 'application/json',
117+
...(token && config.users.tokenInHeader ? { authorization: `Bearer ${token}` } : {})
118+
},
116119
mode: 'cors'
117120
},
118121
callback_event: 'prices-after-sync'

core/i18n/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue-storefront/i18n",
3-
"version": "1.12.1",
3+
"version": "1.12.2",
44
"description": "Vue Storefront i18n",
55
"license": "MIT",
66
"main": "index.ts",

core/i18n/resource/i18n/nl-NL.csv

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
is out of stock!, is niet in voorraad!
2-
"Adding a review ...","Adding a review ..."
3-
"Are you sure you would like to remove this item from the shopping cart?","Weet u zeker dat u dit artikel uit uw mandje wilt verwijderen?"
4-
"Only {maxQuantity} products of this type are available!","Only {maxQuantity} products of this type are available!"
1+
is out of stock!, is niet op voorraad!
2+
"Adding a review ...","Review aan het aanmaken ..."
3+
"Are you sure you would like to remove this item from the shopping cart?","Weet u zeker dat u dit artikel uit uw winkelwagen wilt verwijderen?"
4+
"Only {maxQuantity} products of this type are available!","Er zijn {maxQuantity} producten van dit type op voorraad!"
55
"Product price is unknown, product cannot be added to the cart!",Productprijs onbekend. Dit product kan niet worden toegevoegd aan de winkelwagen!
6-
"Product quantity has been updated!","Producthoeveelheid is bijgewerkt!"
6+
"Product quantity has been updated!","Producthoeveelheid is aangepast!"
77
"Shopping cart is empty. Please add some products before entering Checkout",Uw winkelwagen is leeg. Voeg producten toe voordat u gaat afrekenen
8-
"Stock check in progress, please wait while available stock quantities are checked","Voorraadcontrole bezig. Een moment gedult alstublieft, we checken op dit moment de voorraden"
8+
"Stock check in progress, please wait while available stock quantities are checked","Voorraadcontrole bezig. Een moment geduld alstublieft, we checken op dit moment de voorraden"
99
"Thumbnail","Thumbnail"
1010
"Unhandled error, wrong response format!","Unhandled error, wrong response format!"
1111
"You need to be logged in to see this page","U moet ingelogd zijn om deze pagina te bekijken"
1212
"You submitted your review for moderation.","You submitted your review for moderation."
1313
404 Page Not Found,404 Pagina niet gevonden
14-
Account data has successfully been updated,Account gegevens succesvol geupdatet.
14+
Account data has successfully been updated,Account gegevens succesvol geüpdatet.
1515
Checkout,Afrekenen
1616
Compare Products,Producten vergelijken
1717
Error with response - bad content-type!,Error with response - bad content-type!
@@ -24,7 +24,7 @@ My Account,Mijn Account
2424
Newsletter preferences have successfully been updated,Uw nieuwsbrief voorkeur is gewijzigd.
2525
No products synchronized for this category. Please come back while online!,Er zijn geen producten gesynchroniseerd in deze categorie. Kom alstublieft terug terwijl u online bent.
2626
No such configuration for the product. Please do choose another combination of attributes.,De gekozen productconfiguratie bestaat niet. Kies een andere combinatie.
27-
Out of stock!,Niet in voorraad!
27+
Out of stock!,Niet op voorraad!
2828
Please fix the validation errors,Corrigeer de validatiefouten
2929
Product has been added to the cart!,Product is toegevoegd aan de winkelwagen!
3030
Product {productName} has been added to the compare!,Product {productName} is toegevoegd aan de vergelijking!
@@ -41,4 +41,4 @@ There is no Internet connection. You can still place your order. We will notify
4141
This feature is not implemented yet! Please take a look at https://github.com/DivanteLtd/vue-storefront/issues for our Roadmap!,"Helaas, deze feature is nog niet geimplementeerd. Kijk op https://github.com/DivanteLtd/vue-storefront/issues om de roadmap te zien."
4242
Type what you are looking for...,Waar bent u naar op zoek?
4343
You are logged in!,U bent ingelogd!
44-
You're logged out,Je bent uitgelogd
44+
You're logged out,U bent uitgelogd

core/lib/storage-manager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ const StorageManager = {
5959
} else {
6060
return this.storageMap[collectionName]
6161
}
62+
},
63+
clear (): Promise<void[]> {
64+
const promiseArray = Object.keys(this.storageMap).map((collectionName) => {
65+
return (config.localForage.preserveCollections || []).every(collectionToKeep => collectionName !== collectionToKeep) && this.storageMap[collectionName].clear().then(() => {
66+
Logger.warn(`storeManager cleared: ${collectionName}`, `storeManager cleared: ${collectionName}`, `storeManager cleared: ${collectionName}`)()
67+
})
68+
})
69+
return Promise.all(promiseArray)
6270
}
6371
}
6472

core/lib/store/storage.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as localForage from 'localforage'
22
import { Logger } from '@vue-storefront/core/lib/logger'
33
import { isServer } from '@vue-storefront/core/helpers'
44
import cloneDeep from 'lodash-es/cloneDeep'
5+
import { StorageManager } from '@vue-storefront/core/lib/storage-manager'
56

67
const CACHE_TIMEOUT = 800
78
const CACHE_TIMEOUT_ITERATE = 2000
@@ -334,16 +335,23 @@ class LocalForageCacheDriver {
334335
})
335336
} else {
336337
let isResolved = false
337-
const promise = this._localForageCollection.ready().then(() => this._localForageCollection.setItem(key, copiedValue).then(result => {
338-
if (isCallbackCallable) {
339-
callback(null, result)
340-
}
341-
isResolved = true
342-
}).catch(err => {
343-
isResolved = true
344-
this._lastError = err
345-
throw err
346-
}))
338+
const handleSetItem = () => this._localForageCollection.setItem(key, copiedValue)
339+
.then(result => {
340+
if (isCallbackCallable) {
341+
callback(null, result)
342+
}
343+
isResolved = true
344+
})
345+
.catch(async err => {
346+
if (err.name === 'QuotaExceededError' || err.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
347+
await StorageManager.clear()
348+
handleSetItem()
349+
}
350+
isResolved = true
351+
this._lastError = err
352+
throw err
353+
})
354+
const promise = this._localForageCollection.ready().then(handleSetItem)
347355
clearTimeout(this._cacheTimeouts.iterate)
348356
this._cacheTimeouts.setItem = setTimeout(() => {
349357
if (!isResolved) { // this is cache time out check

0 commit comments

Comments
 (0)