Skip to content

Commit 5a02d44

Browse files
authored
Merge pull request #3727 from DivanteLtd/hotfix/v1.10.4
Hotfix/v1.10.4
2 parents 220a247 + cf0e8a5 commit 5a02d44

File tree

57 files changed

+389
-228
lines changed

Some content is hidden

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

57 files changed

+389
-228
lines changed

CHANGELOG.md

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

7+
## [1.10.4] - 18.10.2019
8+
9+
### Fixed
10+
- Added try/catch for fetching single product in cart synchronization - @gibkigonzo (#3632)
11+
- Removed infinite loop when changing checkbox in shipping details - @gibkigonzo (#3656)
12+
- Remove modifying config by reference in multistore - @gibkigonzo (#3617)
13+
- Fix displaying same country twice in the in the country switcher - @andrzejewsky (#3587)
14+
- Remove race condition while loading locale messages - @gibkigonzo (#3602)
15+
- Fixed special price that can break when you change pages (browser navigation for/back) or just go from category to product page - @resubaka (#3638)
16+
- Change sku to string when checking products equality - @gibkigonzo (#3606)
17+
- Fixed problem with losing browser history - @andrzejewsky (#3642)
18+
- Fixed resolving store code on SSR - @andrzejewsky (#3576)
19+
- Fixed styles for original price on Wishlist sidebar - @przspa (#3392)
20+
- Added debounce for updating quantity method in the cart - @andrzejewsky (#3191)
21+
- Improved scrolling in Safari on iOS devices (sidebars) - @phoenixdev-kl (#3551)
22+
- Improved cookie and offline badges (z-index, overflow) - @phoenixdev-kl (#3552)
23+
- Added config to set Cache-Control header for static assets based on mime type - @phoenix-bjoern (#3268)
24+
- Added catching of errors when ES is down - @qiqqq
25+
- `localizedRoute()` doesn't return urlDispatcher routes anymore. Use localizedDispatcherRoute instead - @lukeromanowicz (#3548)
26+
- Fixed hash in dynamically resolved urls causing resolving issues - @lukeromanowicz (#3515)
27+
- `localizedRoute()` now supports path (and prefers over fullPath) in LocalizedRoute objects - @lukeromanowicz (#3515)
28+
- Decreased the `localStorage` quota usage + error handling by introducing new config variables: `config.products.disablePersistentProductsCache` to not store products by SKU (by default it's on). Products are cached in ServiceWorker cache anyway so the `product/list` will populate the in-memory cache (`cache.setItem(..., memoryOnly = true)`); `config.seo.disableUrlRoutesPersistentCache` - to not store the url mappings; they're stored in in-memory cache anyway so no additional requests will be made to the backend for url mapping; however it might cause some issues with url routing in the offline mode (when the offline mode PWA installed on homescreen got reloaded, the in-memory cache will be cleared so there won't potentially be the url mappings; however the same like with `product/list` the ServiceWorker cache SHOULD populate url mappings anyway); `config.syncTasks.disablePersistentTaskQueue` to not store the network requests queue in service worker. Currently only the stock-check and user-data changes were using this queue. The only downside it introuces can be related to the offline mode and these tasks will not be re-executed after connectivity established, but just in a case when the page got reloaded while offline (yeah it might happen using ServiceWorker; `syncTasks` can't be re-populated in cache from SW) - @pkarw (#2985)
29+
- Fixed evaluate detailsLink in the cookie notification - @benjick (#3689)
30+
31+
## Added
32+
- Added german translations - @schwerdt-ke (3076)
33+
734
## [1.10.3] - 2019.09.18
835

936
### Fixed

config/default.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
}
2121
},
2222
"seo": {
23-
"useUrlDispatcher": true
23+
"useUrlDispatcher": true,
24+
"disableUrlRoutesPersistentCache": true
2425
},
2526
"console": {
2627
"showErrorOnProduction" : false,
@@ -46,7 +47,7 @@
4647
"csrTimeout": 5000,
4748
"ssrTimeout": 1000,
4849
"queryMethod": "GET",
49-
"disableLocalStorageQueriesCache": true,
50+
"disablePersistentQueriesCache": true,
5051
"searchScoring": {
5152
"attributes": {
5253
"attribute_code": {
@@ -262,6 +263,7 @@
262263
"applycoupon_endpoint": "/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"
263264
},
264265
"products": {
266+
"disablePersistentProductsCache": true,
265267
"useMagentoUrlKeys": true,
266268
"setFirstVarianAsDefaultInURL": false,
267269
"configurableChildrenStockPrefetchStatic": false,
@@ -340,7 +342,6 @@
340342
"wishlist": "LOCALSTORAGE",
341343
"categories": "LOCALSTORAGE",
342344
"attributes": "LOCALSTORAGE",
343-
"products": "INDEXEDDB",
344345
"elasticCache": "LOCALSTORAGE",
345346
"claims": "LOCALSTORAGE",
346347
"syncTasks": "LOCALSTORAGE",
@@ -396,6 +397,9 @@
396397
}
397398
]
398399
},
400+
"syncTasks": {
401+
"disablePersistentTaskQueue": true
402+
},
399403
"i18n": {
400404
"defaultCountry": "US",
401405
"defaultLanguage": "EN",
@@ -409,6 +413,11 @@
409413
"fullLanguageName": "English",
410414
"bundleAllStoreviewLanguages": true
411415
},
416+
"expireHeaders": {
417+
"default": "30d",
418+
"application/json": "24h",
419+
"image/png": "7d"
420+
},
412421
"newsletter": {
413422
"endpoint": "/api/ext/mailchimp-subscribe/subscribe"
414423
},

core/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const createApp = async (ssrContext, config, storeCode = null): Promise<{app: Vu
7070
store.state.__DEMO_MODE__ = (config.demomode === true)
7171
if (ssrContext) Vue.prototype.$ssrRequestContext = ssrContext
7272
if (!store.state.config) store.state.config = globalConfig // @deprecated - we should avoid the `config`
73-
const storeView = prepareStoreView(storeCode) // prepare the default storeView
73+
const storeView = await prepareStoreView(storeCode) // prepare the default storeView
7474
store.state.storeView = storeView
7575

7676
// to depreciate in near future

core/client-entry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { createApp } from '@vue-storefront/core/app'
55
import rootStore from '@vue-storefront/core/store'
66
import { registerSyncTaskProcessor } from '@vue-storefront/core/lib/sync/task'
77
import i18n from '@vue-storefront/i18n'
8-
import { prepareStoreView, storeCodeFromRoute, currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
8+
import storeCodeFromRoute from '@vue-storefront/core/lib/storeCodeFromRoute'
9+
import { prepareStoreView, currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
910
import { onNetworkStatusChange } from '@vue-storefront/core/modules/offline-order/helpers/onNetworkStatusChange'
1011
import '@vue-storefront/core/service-worker/registration' // register the service worker
1112
import { AsyncDataLoader } from './lib/async-data-loader'

core/compatibility/components/blocks/Microcart/Product.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { MicrocartProduct } from '@vue-storefront/core/modules/cart/components/Product.ts'
22
import i18n from '@vue-storefront/i18n'
3+
import debounce from 'lodash-es/debounce'
34
import config from 'config'
45

56
export default {
@@ -12,11 +13,13 @@ export default {
1213
// deprecated, will be moved to theme or removed in the near future #1742
1314
this.$bus.$on('cart-after-itemchanged', this.onProductChanged)
1415
this.$bus.$on('notification-after-itemremoved', this.onProductRemoved)
16+
this.updateQuantity = debounce(this.updateQuantity, 5000)
1517
},
1618
beforeDestroy () {
1719
// deprecated, will be moved to theme or removed in the near future #1742
1820
this.$bus.$off('cart-after-itemchanged', this.onProductChanged)
1921
this.$bus.$off('notification-after-itemremoved', this.onProductRemoved)
22+
this.updateQuantity.cancel()
2023
},
2124
methods: {
2225
removeItem () {

core/helpers/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,13 @@ export const onlineHelper = Vue.observable({
165165
isOnline: isServer || navigator.onLine
166166
})
167167

168+
export const routerHelper = Vue.observable({
169+
popStateDetected: false
170+
})
171+
168172
!isServer && window.addEventListener('online', () => { onlineHelper.isOnline = true })
169173
!isServer && window.addEventListener('offline', () => { onlineHelper.isOnline = false })
174+
!isServer && window.addEventListener('popstate', () => { routerHelper.popStateDetected = true })
170175

171176
export const processURLAddress = (url: string = '') => {
172177
if (url.startsWith('/')) return `${config.api.url}${url}`

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.10.3",
3+
"version": "1.10.4",
44
"description": "Vue Storefront i18n",
55
"license": "MIT",
66
"main": "index.ts",

core/i18n/resource/i18n/de-DE.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
"Out of stock!","Nicht auf Lager!"
55
" is out of the stock!"," ist nicht auf Lager!"
66
"Some of the ordered products are not available!","Einige der bestellten Produkte sind nicht auf Lager!"
7+
"Please wait ...","Bitte warten ..."
78
"Stock check in progress, please wait while available stock quantities are checked","Bestandskontrolle läuft. Bitte warte einen Moment bis die verfügbare Bestandsmenge geprüft worden ist"
89
"There is no Internet connection. You can still place your order. We will notify you if any of ordered products is not available because we cannot check it right now.","Es besteht aktuell keine Verbindung zum Internet. Du kannst deine Bestellung dennoch aufgeben. Falls eines der bestellten Produkte bei Wiederaufbau der Verbindung nicht mehr verfügbar sein sollte, werden wir dich umgehend benachrichtigen."
910
"No such configuration for the product. Please do choose another combination of attributes.","Diese Konfiguration ist für dieses Produkt nicht möglich. Bitte wähle eine andere Kombination von Eigenschaften."
1011
"The system is not sure about the stock quantity (volatile). Product has been added to the cart for pre-reservation.","Das System konnte den genauen Lagerbestand nicht ermitteln, da dieser sehr volatil ist. Das Produkt wurde zur Vorreservierung in den Warenkorb gelegt."
1112
"This feature is not implemented yet! Please take a look at https://github.com/DivanteLtd/vue-storefront/issues for our Roadmap!","Diese Funktion wurde noch nicht implementiert. Für weitere Details schau dir bitte auf https://github.com/DivanteLtd/vue-storefront/issues unsere Roadmap an!"
1213
"The product is out of stock and cannot be added to the cart!","Das Produkt ist nicht auf Lager und kann daher nicht zum Warenkorb hinzugefügt werden!"
1314
"Product has been added to the cart!","Produkt wurde zum Warenkorb hinzugefügt!"
15+
"Product quantity has been updated!","Die Anzahl wurde upgedated!"
1416
"Internal validation error. Please check if all required fields are filled in. Please contact us on {email}","Interner Validierungsfehler. Bitte überprüfe, ob alle erforderlichen Felder ausgefüllt sind. Bei Problemen kontaktiere uns bitte über {email}"
1517
"Address provided in checkout contains invalid data. Please check if all required fields are filled in and also contact us on {email} to resolve this issue for future. Your order has been canceled.","Die angegebene Adresse ist nicht gültig. Bitte überprüfe, ob alle notwenigen Felder ausgefüllt sind und kontaktiere uns per {email} um den Fehler für die Zukunft zu beheben. Deine Bestellung wurde abgebrochen."
1618
"Product {productName} has been added to the compare!","Das Produkt {productName} wurde zur Vergleichsliste hinzugefügt!"
@@ -71,3 +73,5 @@
7173
"You need to be logged in to see this page","Sie müssen angemeldet sein, um diese Seite anzuzeigen"
7274
"Quantity must be above 0","Die Menge muss größer als 0 sein"
7375
"Error: Error while adding products","Error: Fehler beim hinzufügen der Produkte"
76+
"Unexpected authorization error. Check your Network conection.","Unerwarteter Fehler bei der Authentifizierung. Bitte überprüfen Sie Ihre Internetverbindung."
77+
"Columns","Spalten"

core/i18n/resource/i18n/jp-JP.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
"We will send you the invoice to given e-mail address","頂いたメールアドレスに請求書を送ります"
155155
"Wishlist","お気に入りリスト"
156156
"You are offline","オフラインです"
157-
"You are offline, some of the functionalities are limited","現在オフラインですので、使えない機能があります"
158157
"You can also use","またこれらを使うことができます"
159158
"You can log to your account using e-mail and password defined earlier. On your account you can <b>edit your profile data,</b> check <b>history of transactions,</b> edit <b>subscription to newsletter.</b>","登録されたメールアドレスとパスワードを使ってログインできます。アカウント内では<b>プロフィール</b>の編集<b>注文の履歴</b>の確認<b>ニュースレター</b>への購読が行えます。"
160159
"You have been successfully subscribed to our newsletter!","ニュースレターへの購読が完了しました!"

core/lib/multistore.ts

Lines changed: 30 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,19 @@ import queryString from 'query-string'
66
import { RouterManager } from '@vue-storefront/core/lib/router-manager'
77
import VueRouter, { RouteConfig, RawLocation } from 'vue-router'
88
import config from 'config'
9-
10-
export interface LocalizedRoute {
11-
path?: string,
12-
name?: string,
13-
hash?: string,
14-
params?: object,
15-
fullPath?: string,
16-
host?: string
17-
}
18-
19-
export interface StoreView {
20-
storeCode: string,
21-
disabled?: boolean,
22-
storeId: any,
23-
name?: string,
24-
url?: string,
25-
elasticsearch: {
26-
host: string,
27-
index: string
28-
},
29-
tax: {
30-
sourcePriceIncludesTax: boolean,
31-
defaultCountry: string,
32-
defaultRegion: null | string,
33-
calculateServerSide: boolean
34-
},
35-
i18n: {
36-
fullCountryName: string,
37-
fullLanguageName: string,
38-
defaultLanguage: string,
39-
defaultCountry: string,
40-
defaultLocale: string,
41-
currencyCode: string,
42-
currencySign: string,
43-
dateFormat: string
44-
}
45-
}
9+
import { LocalizedRoute, StoreView } from './types'
10+
import storeCodeFromRoute from './storeCodeFromRoute'
4611

4712
export function currentStoreView (): StoreView {
4813
// TODO: Change to getter all along our code
4914
return rootStore.state.storeView
5015
}
5116

52-
export function prepareStoreView (storeCode: string): StoreView {
17+
export async function prepareStoreView (storeCode: string): Promise<StoreView> {
5318
let storeView = { // current, default store
54-
tax: config.tax,
55-
i18n: config.i18n,
56-
elasticsearch: config.elasticsearch,
19+
tax: Object.assign({}, config.tax),
20+
i18n: Object.assign({}, config.i18n),
21+
elasticsearch: Object.assign({}, config.elasticsearch),
5722
storeCode: '',
5823
storeId: config.defaultStoreCode && config.defaultStoreCode !== '' ? config.storeViews[config.defaultStoreCode].storeId : 1
5924
}
@@ -69,7 +34,7 @@ export function prepareStoreView (storeCode: string): StoreView {
6934
}
7035
if (storeViewHasChanged) {
7136
rootStore.state.storeView = storeView
72-
loadLanguageAsync(storeView.i18n.defaultLocale)
37+
await loadLanguageAsync(storeView.i18n.defaultLocale)
7338
}
7439
if (storeViewHasChanged || Vue.prototype.$db.currentStoreCode !== storeCode) {
7540
if (typeof Vue.prototype.$db === 'undefined') {
@@ -81,46 +46,6 @@ export function prepareStoreView (storeCode: string): StoreView {
8146
return storeView
8247
}
8348

84-
export function storeCodeFromRoute (matchedRouteOrUrl: LocalizedRoute | RawLocation | string): string {
85-
if (matchedRouteOrUrl) {
86-
for (let storeCode of config.storeViews.mapStoreUrlsFor) {
87-
const store = config.storeViews[storeCode]
88-
89-
// handle resolving by path
90-
const matchingPath = typeof matchedRouteOrUrl === 'object' ? matchedRouteOrUrl.path : matchedRouteOrUrl
91-
let normalizedPath = matchingPath // assume that matching string is a path
92-
if (matchingPath.length > 0 && matchingPath[0] !== '/') {
93-
normalizedPath = '/' + matchingPath
94-
}
95-
96-
if (normalizedPath.startsWith(`${store.url}/`) || normalizedPath === store.url) {
97-
return storeCode
98-
}
99-
100-
// handle resolving by domain+path
101-
let url = ''
102-
103-
if (typeof matchedRouteOrUrl === 'object') {
104-
if (matchedRouteOrUrl['host']) {
105-
url = matchedRouteOrUrl['host'] + normalizedPath
106-
} else {
107-
return '' // this route does not have url so there is nothing to do here
108-
}
109-
} else {
110-
url = matchedRouteOrUrl as string
111-
}
112-
113-
if (url.startsWith(`${store.url}/`) || url === store.url) {
114-
return storeCode
115-
}
116-
}
117-
118-
return ''
119-
} else {
120-
return ''
121-
}
122-
}
123-
12449
export function removeStoreCodeFromRoute (matchedRouteOrUrl: LocalizedRoute | string): LocalizedRoute | string {
12550
const storeCodeInRoute = storeCodeFromRoute(matchedRouteOrUrl)
12651
if (storeCodeInRoute !== '') {
@@ -141,22 +66,29 @@ export function adjustMultistoreApiUrl (url: string): string {
14166
}
14267

14368
export function localizedDispatcherRoute (routeObj: LocalizedRoute | string, storeCode: string): LocalizedRoute | string {
144-
if (!storeCode) {
145-
storeCode = currentStoreView().storeCode
69+
const { storeCode: currentStoreCode, appendStoreCode } = currentStoreView()
70+
if (!storeCode || !config.storeViews[storeCode]) {
71+
storeCode = currentStoreCode
14672
}
147-
const appendStoreCodePrefix = config.storeViews[storeCode] ? config.storeViews[storeCode].appendStoreCode : false
73+
const appendStoreCodePrefix = storeCode && appendStoreCode
14874

14975
if (typeof routeObj === 'string') {
15076
if (routeObj[0] !== '/') routeObj = `/${routeObj}`
15177
return appendStoreCodePrefix ? `/${storeCode}${routeObj}` : routeObj
15278
}
15379

154-
if (routeObj && routeObj.fullPath) { // case of using dispatcher
155-
const routeCodePrefix = config.defaultStoreCode !== storeCode && appendStoreCodePrefix ? `/${storeCode}` : ''
156-
const qrStr = queryString.stringify(routeObj.params)
80+
if (routeObj) {
81+
if ((routeObj as LocalizedRoute).fullPath && !(routeObj as LocalizedRoute).path) { // support both path and fullPath
82+
routeObj['path'] = (routeObj as LocalizedRoute).fullPath
83+
}
84+
85+
if (routeObj.path) { // case of using dispatcher
86+
const routeCodePrefix = appendStoreCodePrefix ? `/${storeCode}` : ''
87+
const qrStr = queryString.stringify(routeObj.params);
15788

158-
const normalizedPath = routeObj.fullPath[0] !== '/' ? `/${routeObj.fullPath}` : routeObj.fullPath
159-
return `${routeCodePrefix}${normalizedPath}${qrStr ? `?${qrStr}` : ''}`
89+
const normalizedPath = routeObj.path[0] !== '/' ? `/${routeObj.path}` : routeObj.path
90+
return `${routeCodePrefix}${normalizedPath}${qrStr ? `?${qrStr}` : ''}`
91+
}
16092
}
16193

16294
return routeObj
@@ -166,8 +98,14 @@ export function localizedRoute (routeObj: LocalizedRoute | string | RouteConfig
16698
if (!storeCode) {
16799
storeCode = currentStoreView().storeCode
168100
}
169-
if (routeObj && (routeObj as LocalizedRoute).fullPath && config.seo.useUrlDispatcher) {
170-
return localizedDispatcherRoute(Object.assign({}, routeObj, { params: null }) as LocalizedRoute, storeCode)
101+
if (!routeObj) {
102+
return routeObj
103+
}
104+
105+
if ((typeof routeObj === 'object') && (routeObj as LocalizedRoute)) {
106+
if ((routeObj as LocalizedRoute).fullPath && !(routeObj as LocalizedRoute).path) { // support both path and fullPath
107+
routeObj['path'] = (routeObj as LocalizedRoute).fullPath
108+
}
171109
}
172110

173111
if (storeCode && routeObj && config.defaultStoreCode !== storeCode && config.storeViews[storeCode].appendStoreCode) {

0 commit comments

Comments
 (0)