Skip to content

Commit

Permalink
Merge pull request #2299 from DivanteLtd/hotfix/v1.7.2
Browse files Browse the repository at this point in the history
Hotfix/v1.7.2
  • Loading branch information
pkarw committed Jan 28, 2019
2 parents 29c0953 + fb0e89a commit 5d380d4
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 45 deletions.
109 changes: 77 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,89 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [1.7.2] - 2019.01.28
### Fixed
- clear search filters on mobile - @patzick (#2282)
- SSR problem on checkout page on reload - @vue-kacper (#2220)
- Improved offline mode handlers - @pkarw (#2217)
- url_key adjustment after m2vs fix - @pkarw (#2215)
- Service worker removed from dev mode because of the side effects - @pkarw
- `networkFirst` first caching strategy for /api/catalog - @pkarw
- Special price dates checking - backport of @igloczek's (#2245)
- SSR detection in components - @patzick (#2173)

### Changed
- IndexedDb changed to LocalStorage + ServiceWorker native caching (#2112)
- compress banner images - @patzick (#2280)
- Dynamic attributes loader (#2137)
- Dynamic categories prefetching (#2076)
- New payment's module architecture (#2135)
- Support regional characters in urls - Backport of @aekal's (#2243)

### Added
- Translations of banners - @patzick (#2276)
- Banners title background on mobile - @patzick (#2272)
- New main site look - @patzick (#2266)

## [1.7.1] - 2019.01.15
### Fixed
- Corrected scrolled sidebar menu position

## [1.7.0] - 2019.01.15
### Added
- Dynamic categories prefetching — @pkarw #2100
- Per-route codesplitting for SSR pages — @patzick #2068
- async/await support — @patzick #2092
- IndexedDB replacement and new caching mechanism — @pkarw #2112
- Web Share module — @filrak #2143
- Backward compatibility option for dynamic attribute loader — @pkarw #2137
- Japanese translation — @moksahero #2150
- Dutch translation — @StefGeraets #2163
- Using meta_title and meta_description fields from Magento on product/category page — @qiqqq #2158
- Color mapping feature — @pkarw #2175
- Out of the box GZIP compression and sourcemap removal in prod mode — @patzick #2186

### Changed / Improved
- Invalidate output cache using POST - @Cyclonecode #2084
- NGNIX installation improvements for docs — @janmyszkier #2080
- HTML semantics improvements — @patzick #2094
- Lazy loading of non-critical third party libs and vendor optimization — @patzick @filrak @qiqqq
- Extra NL translation keys — @nlekv #2104
- Optimization for the number of attributes to be stored in Vuex store — @pkarw #1654
- Service Worker registration from any route — @patzick #2070
- Production setup docs improvements — @janmyszkier #2126
- Various changes and additions to our docs by @NataliaTepluhina
- Payment docs update — @pkarw #2135
- Added bash command for collecting i18n phrases to docs — @qbo-tech #2149
- SEO and scrolling performance fixes — @filrak #2066
- Established Vuex naming conventions. TLDR - we strongly recommend to use vuex getters instead of mapping state itself (#2069)
- IndexedDb changed to LocalStorage + ServiceWorker native caching (#2112)

## [1.6.0] - 2018.12.05
### Fixed
- Fix Notification.vue compiling issue on prod - @ladrua #2079
- Fix wishlist toggle bug — @shkodasv #2086
- findConfigurableChildAsync — fix checking stock for configurable child — @afirlejczyk #2097
- Fix cart synchronization — @valeriish #2106
- Fix hydration issue for lazy loaded chunks — @patzick #2115
- Clear missing fields after user logout — @sniffy1988 #2117
- Fix AMP naming ( ^^ ) for docs -@pgol #2118
- Fix Cart Configurable Item pulled from Magento — @valeriish #2119
- Fix product configuration after cart items server pull — @valeriish #2122
- Fix gallery switching when entering product — @vue-kacper #2123
- Fix multiple placing order invocation after changing payment methods — @patzick #2133
- Remove extra space after every comma for non-(multi)select product attributes — @patzick #2133
- Fix side-menu scrolling — @patzick #2140
- Fix back button not properly working from a configurable product page — @qiqqq #2151
- Fix submenu not visible on a deeper level — @patzick #2152
- vue-carousel removed from homepage - @patzick #2153 #2154
- Use localized routes for redirects to home page and account page — @grimasod #2157
- ProductLinks fixed in Related products component — @pkarw #2168
- Fix Cart Configurable Item pulled from Magento loaded as Simple — @pkarw @valeriish #2169 #2181

### Depreciated
- extendStore depreciation - @filrak #2143
- ValidationError class depreciation - @filrak #2143

## [1.6.0] - 2018.12.05
### Added
- Lazy loading for SSR and non-SSR routes
- app splitted into modules
Expand All @@ -24,10 +96,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- There is new config option `config.orders.directBackendSync` that changes the behavior of placing an order. Please do read [more on this change](https://github.com/DivanteLtd/vue-storefront/commit/e73f2ca19a5d33a39f8b0fd6346543eced24167e) and [more on vue-storefront-api change](https://github.com/DivanteLtd/vue-storefront-api/commit/80c497f72362c72983db4fdcac14c8ba6f8729a8)
- ProductSlider, ProductLinks, ProductListing moved to theme.
- ProductSlider, ProductLinks, ProductListing moved to theme.
- Many theme-related logic moved to theme (+ deleted empty core components just with `name`)
- Components required for backward compatibility moved to `compatibility` folder. For all this files you just need to add `compatibility` after `core` in import path to make them work like before.
- Better Vuex extensibility with modules
- Better Vuex extensibility with modules
- VSModule `store` object changed to fulfil need of multiple vuex modules (see modules docs)
- UI Store logic for Microcart moved to cart module
- Extensions are now depreciated, theme-level extensions removed and src-level extension to be depreciated in 1.7
Expand Down Expand Up @@ -288,30 +360,3 @@ Please keep an eye on the **[UPGRADE NOTES](https://github.com/DivanteLtd/vue-st
## [0.2.0-alpha.0] - 2017-11-15
### Fixed
- Lazy loaded blocks size fixed


[Unreleased]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.5...HEAD

[1.0.5]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.4...v1.0.5

[1.0.4]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.3...v1.0.4

[1.0.3]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.2...v1.0.3

[1.0.2]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.1...v1.0.2

[1.0.1]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.0...v1.0.1

[1.0.0]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.0-rc.3...v1.0.0

[1.0.0-rc.3]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.0-rc.2...v1.0.0-rc.3

[1.0.0-rc.2]: https://github.com/DivanteLtd/vue-storefront/compare/v1.0.0-rc.0...v1.0.0-rc.2

[1.0.0-rc.0]: https://github.com/DivanteLtd/vue-storefront/compare/v0.4.0...v1.0.0-rc.0

[0.4.0]: https://github.com/DivanteLtd/vue-storefront/compare/v0.3.0...v0.4.0

[0.3.0]: https://github.com/DivanteLtd/vue-storefront/compare/v0.2.1-alpha.0...v0.0.3

[0.2.1-alpha.0]: https://github.com/DivanteLtd/vue-storefront/compare/v0.2.0-alpha.0...v0.2.1-alpha.0
3 changes: 2 additions & 1 deletion core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Store } from 'vuex'
import RootState from '@vue-storefront/store/types/RootState'
import Vue from 'vue'
import buildTimeConfig from 'config'
import { isServer } from '@vue-storefront/core/helpers'

// Plugins
import i18n from '@vue-storefront/i18n'
Expand Down Expand Up @@ -119,7 +120,7 @@ const createApp = async (ssrContext, config): Promise<{app: Vue, router: VueRou
const app = new Vue(vueOptions)

const appContext = {
isServer: typeof window !== 'undefined',
isServer,
ssrContext
}

Expand Down
8 changes: 7 additions & 1 deletion core/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import rootStore from '@vue-storefront/store'
import SearchQuery from '@vue-storefront/store/lib/search/searchQuery'
import { remove as removeAccents } from 'remove-accents'

/**
* Create slugify -> "create-slugify" permalink of text
* @param {String} text
*/
export function slugify (text) {
return text.toString().toLowerCase()
// remove regional characters
text = removeAccents(text)

return text
.toString()
.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w-]+/g, '') // Remove all non-word chars
Expand Down
4 changes: 3 additions & 1 deletion core/helpers/log.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { isServer } from '@vue-storefront/core/helpers'

/**
* @param {string} level available options: 'no-console', 'only-errors', 'all'
*/
export function takeOverConsole (level = 'no-console') {
const console = typeof window !== 'undefined' ? window.console : global.console
const console = !isServer ? window.console : global.console
if (!console) return

function intercept (method) {
Expand Down
8 changes: 5 additions & 3 deletions core/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isServer } from '@vue-storefront/core/helpers'

/** VS message logger. By default works only on dev mode */
const Logger = {
/**
Expand All @@ -9,7 +11,7 @@ const Logger = {
* @param context meaningful data related to this message
*/
info : function (message: string, tag: string = null, context: any = null) : () => void {
if (typeof window !== 'undefined') {
if (!isServer) {
if (tag) {
let msg ='%cVSF%c %c' + tag +'%c ' + message
return console.log.bind(window.console, '%cVSF%c %c' + tag +'%c ' + message, bgColorStyle('green'), 'color: inherit', bgColorStyle('gray'), 'font-weight: bold', { context });
Expand All @@ -29,7 +31,7 @@ const Logger = {
* @param context meaningful data related to this message
*/
warn: function (message: string, tag: string = null, context: any = null) : () => void {
if (typeof window !== 'undefined') {
if (!isServer) {
if (tag) {
return console.warn.bind(window.console, '%cVSF%c %c' + tag +'%c ' + message, bgColorStyle('orange'), 'color: inherit', bgColorStyle('gray'), 'font-weight: bold', { context });
} else {
Expand All @@ -48,7 +50,7 @@ const Logger = {
* @param context meaningful data related to this message
*/
error: function (message: string, tag: string = null, context: any = null) : () => void {
if (typeof window !== 'undefined') {
if (!isServer) {
if (tag) {
return console.error.bind(window.console, '%cVSF%c %c' + tag +'%c ' + message, bgColorStyle('red'), 'color: inherit', bgColorStyle('gray'), 'font-weight: bold', { context });
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import rootStore from '@vue-storefront/store'
import { Logger } from '@vue-storefront/core/lib/logger'
import { setupMultistoreRoutes } from '@vue-storefront/store/lib/multistore'
import { router } from '@vue-storefront/core/app'
import { isServer } from '@vue-storefront/core/helpers'

export interface VueStorefrontModuleConfig {
key: string;
Expand Down Expand Up @@ -85,7 +86,6 @@ export class VueStorefrontModule {
}

if (isUnique) {
const isServer = typeof window === undefined
if (this._c.beforeRegistration) this._c.beforeRegistration(Vue, rootStore.state.config, rootStore, isServer)
if (this._c.store) VueStorefrontModule._extendStore(rootStore, this._c.store.modules, this._c.store.plugin)
if (this._c.router) VueStorefrontModule._extendRouter(router, this._c.router.routes, this._c.router.beforeEach, this._c.router.afterEach)
Expand Down
22 changes: 20 additions & 2 deletions core/modules/catalog/helpers/tax.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
function isSpecialPriceActive(fromDate, toDate) {
const now = new Date()
fromDate = new Date(fromDate) || false
toDate = new Date(toDate) || false

if (fromDate && toDate) {
return fromDate < now && toDate > now
}

if (fromDate && !toDate) {
return fromDate < now
}

if (!fromDate && toDate) {
return toDate > now
}
}

export function updateProductPrices (product, rate, sourcePriceInclTax = false) {
const rateFactor = parseFloat(rate.rate) / 100
product.price = parseFloat(product.price)
Expand All @@ -22,7 +40,7 @@ export function updateProductPrices (product, rate, sourcePriceInclTax = false)
product.specialPriceInclTax = specialPriceExclTax + product.specialPriceTax

if (product.special_price && (product.special_price < product.price)) {
if ((product.special_to_date && new Date(product.special_to_date) < new Date()) || (product.special_from_date && new Date(product.special_from_date) > new Date())) {
if (!isSpecialPriceActive(product.special_from_date, product.special_to_date)) {
product.special_price = 0 // out of the dates period
} else {
product.originalPrice = priceExclTax
Expand Down Expand Up @@ -67,7 +85,7 @@ export function updateProductPrices (product, rate, sourcePriceInclTax = false)
configurableChild.specialPriceInclTax = specialPriceExclTax + configurableChild.specialPriceTax

if (configurableChild.special_price && (configurableChild.special_price < configurableChild.price)) {
if ((configurableChild.special_to_date && new Date(configurableChild.special_to_date) < new Date()) || (configurableChild.special_from_date && new Date(configurableChild.special_from_date) > new Date())) {
if (!isSpecialPriceActive(configurableChild.special_from_date, configurableChild.special_to_date)) {
configurableChild.special_price = 0 // out of the dates period
} else {
configurableChild.originalPrice = priceExclTax
Expand Down
4 changes: 3 additions & 1 deletion core/modules/social-share/components/WebShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>

<script>
import { isServer } from '@vue-storefront/core/helpers'
export default {
name: 'WebShare',
props: {
Expand All @@ -25,7 +27,7 @@ export default {
},
computed: {
isSupported () {
return typeof window !== 'undefined' && navigator.share
return !isServer && navigator.share
}
},
methods: {
Expand Down
1 change: 1 addition & 0 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"lodash-es": "^4.17.10",
"lru-cache": "^4.0.1",
"redis-tag-cache": "^1.2.1",
"remove-accents": "^0.4.2",
"vue": "^2.5.17",
"vue-carousel": "^0.6.9",
"vue-i18n": "^8.0.0",
Expand Down
5 changes: 3 additions & 2 deletions core/pages/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import VueOfflineMixin from 'vue-offline/mixin'

import Composite from '@vue-storefront/core/mixins/composite'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { isServer } from '@vue-storefront/core/helpers'

export default {
name: 'Checkout',
Expand Down Expand Up @@ -218,7 +219,7 @@ export default {
return isValid
},
activateHashSection () {
if (typeof window !== 'undefined') {
if (!isServer) {
var urlStep = window.location.hash.replace('#', '')
if (this.activeSection.hasOwnProperty(urlStep) && this.activeSection[urlStep] === false) {
this.activateSection(urlStep)
Expand All @@ -237,7 +238,7 @@ export default {
this.activeSection[section] = false
}
this.activeSection[sectionToActivate] = true
if (typeof window !== 'undefined') window.location.href = window.location.origin + window.location.pathname + '#' + sectionToActivate
if (!isServer) window.location.href = window.location.origin + window.location.pathname + '#' + sectionToActivate
},
// This method checks if there exists a mapping of chosen payment method to one of Magento's payment methods.
getPaymentMethod () {
Expand Down
4 changes: 3 additions & 1 deletion src/themes/default/mixins/currentPage/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isServer } from '@vue-storefront/core/helpers'

export default {
data () {
return {
Expand Down Expand Up @@ -34,7 +36,7 @@ export default {
},
// Check if history is empty
isHistoryEmpty () {
if (typeof window !== 'undefined') {
if (!isServer) {
return window.history.length <= 1
}

Expand Down
1 change: 1 addition & 0 deletions storefront-ui
Submodule storefront-ui added at 57c41a
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8804,6 +8804,11 @@ relateurl@0.2.x:
version "0.2.7"
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"

remove-accents@^0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/remove-accents/-/remove-accents-0.4.2.tgz#0a43d3aaae1e80db919e07ae254b285d9e1c7bb5"
integrity sha1-CkPTqq4egNuRngeuJUsoXZ4ce7U=

remove-array-items@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/remove-array-items/-/remove-array-items-1.1.0.tgz#e3d4aaba795a412479ea89408dee345387da7d3b"
Expand Down

0 comments on commit 5d380d4

Please sign in to comment.