Skip to content

Commit

Permalink
Merge branch 'develop' into Bugfix/2364
Browse files Browse the repository at this point in the history
  • Loading branch information
patzick committed Feb 22, 2019
2 parents 6a81be5 + 2626f9e commit 9cf3586
Show file tree
Hide file tree
Showing 88 changed files with 441 additions and 155 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved docs at contributing.md and configuration.md (spelling etc.) - @ruthgeridema (#2421, #2422, #2423, #2425, #2426)
- Fixed design issue of Country label on Edge 17 & Firefox - @ananth-iyer (#2390,#2399)
- Country field is filled by first counry from the list in cart in paymen section - @RakowskiPrzemyslaw (#2428)
- Added video support in Product Gallery component. - @rain2o (#2433)
- Improved product quantity change component in product and cart - @patzick (#2398, #2437)
- Updated to Vue 2.6.6 - @filrak (#2456)
- Null sidebar menu data on static page fixed - @filrak (#2456)
- Fix cannot edit previous steps in checkout - @filrak (#2457)
- Fixed route guard ssr problem - @vue-kacper (#2364)
- Fix links in footer to static pages bug - @filrak (#2464)
- Improve images loading on category page, corrected alt view and blinking problem - @patzick (#2465)
- Improve tsconfig for better IDE paths support - @patzick, @filrak (#2474)
- fix breadcrumbs changing too early - @filrak (#2469)
- add cart count config, allows you to display the item count instead of a sum of the item quantities - @pauluse (#2483)
- improved product gallery load view, shows correct image on reload - @patzick (#2481, #2382)

### Deprecated / Removed
- `@vue-storefront/store` package deprecated - @filrak

## [1.8.2] - 2019.02.11
- Fixed docker-compose configuration for network_mode and TS build config - @lukeromanowicz (#2415)
Expand Down
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
"setConfigurableProductOptions": true,
"askBeforeRemoveProduct": true,
"displayItemDiscounts": true,
"minicartCountType": "quantities",
"create_endpoint": "http://localhost:8080/api/cart/create?token={{token}}",
"updateitem_endpoint": "http://localhost:8080/api/cart/update?token={{token}}&cartId={{cartId}}",
"deleteitem_endpoint": "http://localhost:8080/api/cart/delete?token={{token}}&cartId={{cartId}}",
Expand Down
2 changes: 1 addition & 1 deletion core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import * as corePlugins from '@vue-storefront/core/compatibility/plugins'

import { once } from '@vue-storefront/core/helpers'
import { takeOverConsole } from '@vue-storefront/core/helpers/log'
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'

import { enabledModules } from './modules-entry'

Expand Down
2 changes: 1 addition & 1 deletion core/build/webpack.base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
'theme/resource': themeResources,

// Backward compatible
'@vue-storefront/store/lib/multistore' : path.resolve(__dirname, '../lib/multistore.ts'),
'@vue-storefront/core/store/lib/multistore' : path.resolve(__dirname, '../lib/multistore.ts'),
}
},
module: {
Expand Down
4 changes: 2 additions & 2 deletions core/client-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import union from 'lodash-es/union'

import { createApp } from '@vue-storefront/core/app'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus/index'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'

import buildTimeConfig from 'config'
import { execute } from '@vue-storefront/core/lib/sync/task'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'
import i18n from '@vue-storefront/i18n'
import { prepareStoreView, storeCodeFromRoute, currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
import { onNetworkStatusChange } from '@vue-storefront/core/modules/offline-order/helpers/onNetworkStatusChange'
Expand Down
2 changes: 1 addition & 1 deletion core/compatibility/components/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
},
activeRoute: {
type: String,
required: true
default: ''
}
}
}
2 changes: 1 addition & 1 deletion core/compatibility/components/blocks/Microcart/Product.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { MicrocartProduct } from '@vue-storefront/core/modules/cart/components/Product.ts'
import i18n from '@vue-storefront/i18n'

Expand Down
2 changes: 1 addition & 1 deletion core/compatibility/plugins/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'
const config = store.state.config
// deprecated, use vuex store instead
const ConfigPlugin = {
Expand Down
2 changes: 1 addition & 1 deletion core/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import { remove as removeAccents } from 'remove-accents'
import { Logger } from '@vue-storefront/core/lib/logger'
Expand Down
4 changes: 2 additions & 2 deletions core/helpers/initCacheStorage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'

/** Inits cache storage for given module. By default via local storage */
export function initCacheStorage(key, localised = true) {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Module } from 'vuex'
import { RouteConfig, NavigationGuard } from 'vue-router'
import Vue from 'vue'
import merge from 'lodash-es/merge'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { Logger } from '@vue-storefront/core/lib/logger'
import { setupMultistoreRoutes } from '..//multistore'
import { router } from '@vue-storefront/core/app'
Expand Down
10 changes: 6 additions & 4 deletions core/lib/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import Vue from 'vue'

import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { sha3_224 } from 'js-sha3'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { getSearchAdapter } from './search/adapter/searchAdapterFactory'
import { SearchRequest } from '@vue-storefront/core/types/search/SearchRequest'
import { SearchResponse } from '@vue-storefront/core/types/search/SearchResponse'
import { Logger } from '@vue-storefront/core/lib/logger'

// TODO - use one from helpers instead
export function isOnline () : boolean {
Expand Down Expand Up @@ -61,7 +62,8 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
res.noresults = false
res.offline = !isOnline() // TODO: refactor it to checking ES heartbit
resolve(res)
console.debug('Result from cache for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('Result from cache for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()

servedFromCache = true
}
}).catch((err) => {
Expand All @@ -87,7 +89,7 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
if (res) { // otherwise it can be just a offline mode
cache.setItem(cacheKey, res, null, rootStore.state.config.elasticsearch.disableLocalStorageQueriesCache).catch((err) => { console.error('Cannot store cache for ' + cacheKey + ', ' + err) })
if (!servedFromCache) { // if navigator onLine == false means ES is unreachable and probably this will return false; sometimes returned false faster than indexedDb cache returns result ...
console.debug('Result from ES for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('Result from ES for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()
res.cache = false
res.noresults = false
res.offline = false
Expand All @@ -96,7 +98,7 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
}
}).catch(err => {
if (!servedFromCache) {
console.debug('No results and offline ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('No results and offline ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()
const res = {
items: [],
total: 0,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/api/elasticsearch/mapping.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'

export default function getMapping (attribute, entityType = 'products') {
let mapping = [
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/api/searchAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import map from 'lodash-es/map'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { prepareElasticsearchQueryBody } from './elasticsearchQuery'
import fetch from 'isomorphic-fetch'
import { slugify } from '@vue-storefront/core/helpers'
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/graphql/processor/processType.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SearchResponse } from '@vue-storefront/core/types/search/SearchResponse'
import map from 'lodash-es/map'
import { slugify } from '@vue-storefront/core/helpers'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'

export function processESResponseType (resp, start, size): SearchResponse {
const response = {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/graphql/searchAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { prepareQueryVars } from './gqlQuery'
import { currentStoreView, prepareStoreView } from '../../../multistore'
import fetch from 'isomorphic-fetch'
Expand Down
4 changes: 2 additions & 2 deletions core/lib/sync/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

import Vue from 'vue'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { Logger } from '@vue-storefront/core/lib/logger'
import { execute as taskExecute, _prepareTask } from './task'
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'
import { currentStoreView } from '../multistore'

/** Syncs given task. If user is offline requiest will be sent to the server after restored connection */
Expand Down
6 changes: 3 additions & 3 deletions core/lib/sync/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import isUndefined from 'lodash-es/isUndefined'
import toString from 'lodash-es/toString'
import fetch from 'isomorphic-fetch'
import * as localForage from 'localforage'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { adjustMultistoreApiUrl, currentStoreView } from '@vue-storefront/core/lib/multistore'
import Task from '@vue-storefront/core/lib/sync/types/Task'
import { Logger } from '@vue-storefront/core/lib/logger'
import { TaskQueue } from '@vue-storefront/core/lib/sync'
import * as entities from '@vue-storefront/store/lib/entities'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import * as entities from '@vue-storefront/core/store/lib/entities'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'

const AUTO_REFRESH_MAX_ATTEMPTS = 20

Expand Down
2 changes: 1 addition & 1 deletion core/modules/breadcrumbs/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'

// Duplicate of breadCrumbRoutes, to repalce it soon.
/** Parse category path for product/category */
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration({ Vue, config, store, isServer }) {
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Vue from 'vue'
import { ActionTree } from 'vuex'
import * as types from './mutation-types'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import i18n from '@vue-storefront/i18n'
import { sha3_224 } from 'js-sha3'
import { currentStoreView, localizedRoute} from '@vue-storefront/core/lib/multistore'
Expand Down
6 changes: 5 additions & 1 deletion core/modules/cart/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ const getters: GetterTree<CartState, RootState> = {
return totalsArray
}
},
totalQuantity (state) {
totalQuantity (state, getters, rootStore) {
if (rootStore.config.cart.minicartCountType === 'items') {
return state.cartItems.length
}

return sumBy(state.cartItems, (p) => {
return p.qty
})
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/store/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'vue'
import { MutationTree } from 'vuex'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import * as types from './mutation-types'
import CartState from '../types/CartState'

Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/components/ProductBundleOption.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'

export const ProductBundleOption = {
name: 'ProductBundleOption',
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/components/ProductBundleOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mapMutations } from 'vuex'
import * as types from '../store/product/mutation-types'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import i18n from '@vue-storefront/i18n'
import { Logger } from '@vue-storefront/core/lib/logger'

Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/components/ProductCustomOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mapMutations } from 'vuex'
import * as types from '../store/product/mutation-types'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import i18n from '@vue-storefront/i18n'
import { Logger } from '@vue-storefront/core/lib/logger'

Expand Down
49 changes: 49 additions & 0 deletions core/modules/catalog/components/ProductVideo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export const ProductVideo = {
name: 'ProductVideo',
props: {
url: {
type: String,
required: true
},
id: {
type: String,
required: true
},
type: {
type: String,
required: true
},
index: {
type: Number,
required: false,
default: 0
}
},
data () {
return {
videoStarted: false,
iframeLoaded: false
}
},
methods: {
initVideo () {
this.videoStarted = true
this.$emit('video-started', this.index)
},
iframeIsLoaded () {
this.iframeLoaded = true
}
},
computed: {
embedUrl () {
switch (this.type) {
case "youtube":
return `https://www.youtube.com/embed/${this.id}?autoplay=1`
case "vimeo":
return `https://player.vimeo.com/video/${this.id}?autoplay=1`
default:
return
}
}
}
}
29 changes: 15 additions & 14 deletions core/modules/catalog/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import rootStore from '@vue-storefront/store'
import rootStore from '@vue-storefront/core/store'
import { calculateProductTax } from '../helpers/tax'
import flattenDeep from 'lodash-es/flattenDeep'
import omit from 'lodash-es/omit'
Expand Down Expand Up @@ -529,18 +529,19 @@ export function configureProductAsync (context, { product, configuration, select
*/

export function getMediaGallery (product) {
let mediaGallery = []
if (product.media_gallery) {
for (let mediaItem of product.media_gallery) {
if (mediaItem.image) {
mediaGallery.push({
'src': getThumbnailPath(mediaItem.image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height),
'loading': getThumbnailPath(product.image, 310, 300)
})
}
}
}
return mediaGallery
let mediaGallery = []
if (product.media_gallery) {
for (let mediaItem of product.media_gallery) {
if (mediaItem.image) {
mediaGallery.push({
'src': getThumbnailPath(mediaItem.image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height),
'loading': getThumbnailPath(mediaItem.image, 310, 300),
'video': mediaItem.vid
})
}
}
}
return mediaGallery
}

/**
Expand All @@ -559,7 +560,7 @@ export function configurableChildrenImages(product) {
if (groupedByAttribute[confChild][0].image) {
configurableChildrenImages.push({
'src': getThumbnailPath(groupedByAttribute[confChild][0].image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height),
'loading': getThumbnailPath(product.image, 310, 300),
'loading': getThumbnailPath(groupedByAttribute[confChild][0].image, 310, 300),
'id': confChild
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import UniversalStorage from '@vue-storefront/core/store/lib/storage'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration({ Vue, config, store, isServer }) {
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/queries/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'

export function prepareQuery ({queryText = '', filters = [], queryConfig = ''}) {
let query = new SearchQuery()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/queries/related.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'

export function prepareRelatedQuery (key, sku) {
let relatedProductsQuery = new SearchQuery()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/queries/searchPanel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import store from '@vue-storefront/store'
import store from '@vue-storefront/core/store'

export function prepareQuickSearchQuery (queryText) {
let searchQuery = new SearchQuery()
Expand Down
Loading

0 comments on commit 9cf3586

Please sign in to comment.