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

Commit

Permalink
Merge pull request #4465 from DivanteLtd/hotfix/v1.11.4
Browse files Browse the repository at this point in the history
Hotfix/v1.11.4
  • Loading branch information
Tomasz Kostuch authored May 26, 2020
2 parents 6cd57ab + daa61c0 commit 73de9f2
Show file tree
Hide file tree
Showing 61 changed files with 230 additions and 130 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy-storefrontcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: Create config file
run: |
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://demo.storefrontcloud.io"}}' > config/local-cloud-demo.json
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://demo.storefrontcloud.io"}}' > config/local-cloud-next.json
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true},"api":{"url":"https://test.storefrontcloud.io"}}' > config/local-cloud-test.json
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@ 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).

## [1.11.4] - 2020.05.26

### Added


### Changed / Improved

- use yarn in cli installer - @gibkigonzo (#4292)
- disable out of stock notification when config.stock.allowOutOfStockInCart is true - @gibigonzo (#4340)


### Fixed

- Use LRU as object contructor based on newest changes in module - @gibkigonzo (#4242)
- Fixed ESC button action (minicart, wishlist) - @mdanilowicz (#4393)
- Fixes problems related to tax calculation and price filter in multistore setup - @juho-jaakkola (#4376)
- Blank order details page - @mdanilowicz (#4382)
- upadate cart hash after sync with backend - @gibkigonzo (#4387)
- exit from errorHandler after redirection - @gibkigonzo (#4246)
- add redirection in component for simple product related to configurable product - @gibkigonzo (#4359)
- disable sending carrier_code or method_code for virtual products,
adjust vue-carousel and vuelidate to newest versions api,
add aplha validators for register fields - @gibkigonzo (#4455, #4461)

## [1.11.3] - 2020.04.27

### Changed / Improved
Expand Down
2 changes: 1 addition & 1 deletion core/compatibility/components/blocks/Wishlist/Wishlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
methods: {
// theme-specific
onEscapePress () {
this.closeWishlist()
this.$store.dispatch('ui/closeWishlist')
}
},
mixins: [ Wishlist, onEscapePress ]
Expand Down
2 changes: 1 addition & 1 deletion core/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/i18n",
"version": "1.11.3",
"version": "1.11.4",
"description": "Vue Storefront i18n",
"license": "MIT",
"main": "index.ts",
Expand Down
2 changes: 1 addition & 1 deletion core/lib/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Task from '@vue-storefront/core/lib/sync/types/Task'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { StorageManager } from '@vue-storefront/core/lib/storage-manager'

/** Syncs given task. If user is offline requiest will be sent to the server after restored connection */
/** Syncs given task. If user is offline request will be sent to the server after restored connection */
async function queue (task) {
const tasksCollection = StorageManager.get('syncTasks')
task = _prepareTask(task)
Expand Down
4 changes: 3 additions & 1 deletion core/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export interface StoreView {
index: string
},
tax: {
sourcePriceIncludesTax: boolean,
sourcePriceIncludesTax?: boolean,
finalPriceIncludesTax?: boolean,
deprecatedPriceFieldsSupport?: boolean,
defaultCountry: string,
defaultRegion: null | string,
calculateServerSide: boolean,
Expand Down
4 changes: 2 additions & 2 deletions core/modules/cart/helpers/createShippingInfoData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const createShippingInfoData = (methodsData) => ({
billingAddress: {
...(methodsData.billingAddress ? methodsData.billingAddress : {})
},
shippingCarrierCode: methodsData.carrier_code,
shippingMethodCode: methodsData.method_code
...(methodsData.carrier_code ? { shippingCarrierCode: methodsData.carrier_code } : {}),
...(methodsData.method_code ? { shippingMethodCode: methodsData.method_code } : {})
});

export default createShippingInfoData
4 changes: 2 additions & 2 deletions core/modules/cart/helpers/getProductConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const ATTRIBUTES = ['color', 'size']

const getProductConfiguration = (product: CartItem): ProductConfiguration => {
const options = getProductOptions(product)
const getAttributesFields = (attributeCode) =>
options[attributeCode].find(c => c.id === parseInt(product[attributeCode]))
const getAttributesFields = (attributeCode) =>
(options[attributeCode] || []).find(c => c.id === parseInt(product[attributeCode]))

if (!options) {
return null
Expand Down
3 changes: 2 additions & 1 deletion core/modules/cart/store/actions/itemActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
notifications
} from '@vue-storefront/core/modules/cart/helpers'
import { cartHooksExecutors } from './../../hooks'
import config from 'config'

const itemActions = {
async configureItem (context, { product, configuration }) {
Expand Down Expand Up @@ -62,7 +63,7 @@ const itemActions = {
if (errors.length === 0) {
const { status, onlineCheckTaskId } = await dispatch('checkProductStatus', { product })

if (status === 'volatile') {
if (status === 'volatile' && !config.stock.allowOutOfStockInCart) {
diffLog.pushNotification(notifications.unsafeQuantity())
}
if (status === 'out_of_stock') {
Expand Down
4 changes: 3 additions & 1 deletion core/modules/cart/store/actions/synchronizeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ const synchronizeActions = {

Logger.error(result, 'cart')
cartHooksExecutors.afterSync(result)
commit(types.CART_SET_ITEMS_HASH, getters.getCurrentCartHash)
return createDiffLog()
},
async stockSync ({ dispatch, commit }, stockTask) {
async stockSync ({ dispatch, commit, getters }, stockTask) {
const product = { sku: stockTask.product_sku }

const cartItem = await dispatch('getItem', { product })
Expand All @@ -102,6 +103,7 @@ const synchronizeActions = {
product: { info: { stock: i18n.t('In stock!') }, sku: stockTask.product_sku, is_in_stock: true }
})
EventBus.$emit('cart-after-itemchanged', { item: cartItem })
commit(types.CART_SET_ITEMS_HASH, getters.getCurrentCartHash)
}
}

Expand Down
13 changes: 13 additions & 0 deletions core/modules/cart/test/unit/helpers/createShippingInfoData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,17 @@ describe('Cart createShippingInfoData', () => {
shippingMethodCode: 'YY'
});
});

it('doesn\t add shippingCarrierCode or shippingMethodCode if missing carrier_code or method_code', async () => {
const methodsData = {
country: 'UK'
};
const shippingInfoData = createShippingInfoData(methodsData);
expect(shippingInfoData).toEqual({
billingAddress: {},
shippingAddress: {
countryId: 'UK'
}
});
});
});
6 changes: 5 additions & 1 deletion core/modules/cart/test/unit/store/synchronizeActions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ describe('Cart synchronizeActions', () => {
config.cart = {
synchronize: false
}
const contextMock = createContextMock();
const contextMock = createContextMock({
getters: {
getCurrentCartHash: 'zyx'
}
});

(contextMock.dispatch as jest.Mock).mockImplementationOnce(() => product)

Expand Down
6 changes: 3 additions & 3 deletions core/modules/catalog-next/store/category/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getFiltersFromQuery } from '../../helpers/filterHelpers'
import { Category } from '../../types/Category'
import { parseCategoryPath } from '@vue-storefront/core/modules/breadcrumbs/helpers'
import { _prepareCategoryPathIds, getSearchOptionsFromRouteParams } from '../../helpers/categoryHelpers';
import { removeStoreCodeFromRoute } from '@vue-storefront/core/lib/multistore'
import { currentStoreView, removeStoreCodeFromRoute } from '@vue-storefront/core/lib/multistore'
import cloneDeep from 'lodash-es/cloneDeep'

function mapCategoryProducts (productsFromState, productsData) {
Expand Down Expand Up @@ -77,8 +77,8 @@ const getters: GetterTree<CategoryState, RootState> = {
});
filters[attrToFilter] = filterOptions.sort(compareByLabel)
} else { // special case is range filter for prices
const storeView = rootState.storeView
const currencySign = storeView.i18n.currencySign
const currencySign = currentStoreView().i18n.currencySign

if (aggregations['agg_range_' + attrToFilter]) {
let index = 0
let count = aggregations['agg_range_' + attrToFilter].buckets.length
Expand Down
26 changes: 26 additions & 0 deletions core/modules/catalog/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { PRODUCT_SET_CURRENT_CONFIGURATION, PRODUCT_SET_CURRENT } from './store/product/mutation-types'
import omit from 'lodash-es/omit'
import config from 'config'
import { AsyncDataLoader } from '@vue-storefront/core/lib/async-data-loader';
import { currentStoreView } from '@vue-storefront/core/lib/multistore';
import { formatProductLink } from '@vue-storefront/core/modules/url/helpers';
import { Logger } from '@vue-storefront/core/lib/logger';
import { isServer } from '@vue-storefront/core/helpers';
import { router } from '@vue-storefront/core/app'

// Listeners moved from Product.js

Expand Down Expand Up @@ -110,3 +116,23 @@ export const onUserPricesRefreshed = async (store, router) => {
}, { root: true })
}
}

export const checkParentRedirection = (currentProduct, parentProduct) => {
if (parentProduct && parentProduct.id !== currentProduct.id && config.products.preventConfigurableChildrenDirectAccess) {
Logger.log('Redirecting to parent, configurable product', parentProduct.sku)()
parentProduct.parentSku = parentProduct.sku
parentProduct.sku = currentProduct.sku
const parentUrl = formatProductLink(parentProduct, currentStoreView().storeCode)
if (isServer) {
AsyncDataLoader.push({
execute: async ({ context }) => {
if (context && !context.url.includes(parentUrl)) {
context.server.response.redirect(301, parentUrl)
}
}
})
} else {
router.replace(parentUrl as string)
}
}
}
14 changes: 7 additions & 7 deletions core/modules/catalog/store/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { StorageManager } from '@vue-storefront/core/lib/storage-manager'
import { quickSearchByQuery } from '@vue-storefront/core/lib/search'
import { formatProductLink } from 'core/modules/url/helpers'
import { checkParentRedirection } from '@vue-storefront/core/modules/catalog/events'

const PRODUCT_REENTER_TIMEOUT = 20000

Expand Down Expand Up @@ -640,7 +641,12 @@ const actions: ActionTree<ProductState, RootState> = {
throw new Error(`Product query returned empty result product status = ${product.status}`)
}
if (product.visibility === 1) { // not visible individually (https://magento.stackexchange.com/questions/171584/magento-2-table-name-for-product-visibility)
throw new Error(`Product query returned empty result product visibility = ${product.visibility}`)
if (config.products.preventConfigurableChildrenDirectAccess) {
const parentProduct = await dispatch('findConfigurableParent', { product })
checkParentRedirection(product, parentProduct)
} else {
throw new Error(`Product query returned empty result product visibility = ${product.visibility}`)
}
}

await dispatch('loadProductAttributes', { product })
Expand All @@ -651,12 +657,6 @@ const actions: ActionTree<ProductState, RootState> = {
syncPromises.push(variantsFilter)
syncPromises.push(gallerySetup)
}
if (config.products.preventConfigurableChildrenDirectAccess) {
const parentChecker = dispatch('checkConfigurableParent', { product })
if (isServer) {
syncPromises.push(parentChecker)
}
}
await Promise.all(syncPromises)
await EventBus.$emitFilter('product-after-load', { store: rootStore, route: route })
return product
Expand Down
5 changes: 4 additions & 1 deletion core/modules/catalog/store/tax/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import config from 'config'
import { calculateProductTax } from '@vue-storefront/core/modules/catalog/helpers/taxCalc'
import { doPlatformPricesSync } from '@vue-storefront/core/modules/catalog/helpers'
import { catalogHooksExecutors } from './../../hooks'
import { currentStoreView } from '@vue-storefront/core/lib/multistore';

const actions: ActionTree<TaxState, RootState> = {
async list ({ state, commit, dispatch }, { entityType = 'taxrule' }) {
Expand Down Expand Up @@ -48,14 +49,16 @@ const actions: ActionTree<TaxState, RootState> = {
return doPlatformPricesSync(mutatedProducts)
}

let storeView = currentStoreView()

const tcs = await dispatch('list', {})
const {
defaultCountry,
defaultRegion,
sourcePriceIncludesTax,
finalPriceIncludesTax,
deprecatedPriceFieldsSupport
} = rootState.storeView.tax
} = storeView.tax

const recalculatedProducts = mutatedProducts.map(product =>
calculateProductTax({
Expand Down
3 changes: 2 additions & 1 deletion core/modules/catalog/store/tax/getters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GetterTree } from 'vuex'
import RootState from '@vue-storefront/core/types/RootState'
import TaxState from '../../types/TaxState'
import { currentStoreView } from '@vue-storefront/core/lib/multistore';

const getters: GetterTree<TaxState, RootState> = {
getRules: (state) => state.rules,
Expand All @@ -17,7 +18,7 @@ const getters: GetterTree<TaxState, RootState> = {
return currentUser.group_id
},
getIsUserGroupedTaxActive: (state, getters, rootState) => {
return typeof rootState.storeView.tax.userGroupId === 'number'
return typeof currentStoreView().tax.userGroupId === 'number'
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/core",
"version": "1.11.3",
"version": "1.11.4",
"description": "Vue Storefront Core",
"license": "MIT",
"main": "app.js",
Expand All @@ -16,7 +16,7 @@
"lean-he": "^2.0.0",
"localforage": "^1.7.2",
"lodash-es": "^4.17",
"lru-cache": "^4.0.1",
"lru-cache": "^5.1.1",
"query-string": "^6.2.0",
"redis-tag-cache": "^1.2.1",
"remove-accents": "^0.4.2",
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Manager extends installer.Manager {
*/
initStorefront () {
return this.storefront.goToDirectory()
.then(this.storefront.npmBuild.bind(this.storefront))
.then(this.storefront.depBuild.bind(this.storefront))
.then(this.storefront.runDevEnvironment.bind(this.storefront))
}

Expand Down
Loading

0 comments on commit 73de9f2

Please sign in to comment.