Skip to content

Commit 8bdb909

Browse files
committed
Merge remote-tracking branch 'origin/develop' into PWA-3430
2 parents 60fd2b3 + 9f8ccd2 commit 8bdb909

File tree

7 files changed

+112
-605
lines changed

7 files changed

+112
-605
lines changed

packages/peregrine/lib/talons/RootComponents/Category/__tests__/__snapshots__/useCategoryContent.spec.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ exports[`useCategoryContent tests handles no data prop 1`] = `
44
Object {
55
"availableSortMethods": null,
66
"categoryDescription": "Jewelry category",
7+
"categoryDisplayMode": undefined,
78
"categoryName": "Jewelry",
9+
"cmsBlockContent": undefined,
810
"filterOptions": undefined,
911
"filters": null,
1012
"items": Array [
@@ -33,7 +35,9 @@ Object {
3335
},
3436
],
3537
"categoryDescription": "Jewelry category",
38+
"categoryDisplayMode": undefined,
3639
"categoryName": "Jewelry",
40+
"cmsBlockContent": undefined,
3741
"filterOptions": undefined,
3842
"filters": Array [
3943
Object {

packages/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { gql } from '@apollo/client';
22

33
export const GET_PRODUCT_FILTERS_BY_CATEGORY = gql`
4-
query getProductFiltersByCategory($filters: ProductAttributeFilterInput!) {
4+
query getProductFiltersByCategories(
5+
$filters: ProductAttributeFilterInput!
6+
) {
57
products(filter: $filters) {
68
aggregations {
79
label
@@ -27,13 +29,17 @@ export const GET_CATEGORY_CONTENT = gql`
2729
description
2830
url_key
2931
url_path
32+
display_mode
33+
cms_block {
34+
content
35+
}
3036
}
3137
}
3238
}
3339
`;
3440

3541
export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql`
36-
query getCategoryAvailableSortMethods(
42+
query getCategoriesAvailableSortMethods(
3743
$categoryIdFilter: FilterEqualTypeInput!
3844
) {
3945
products(filter: { category_uid: $categoryIdFilter }) {

packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ export const useCategoryContent = props => {
196196
const availableSortMethods = sortData
197197
? sortData.products.sort_fields.options
198198
: null;
199+
const categoryDisplayMode =
200+
categoryData && categoryData.categories.items.length
201+
? categoryData.categories.items[0].display_mode
202+
: null;
203+
const cmsBlockContent =
204+
categoryData && categoryData.categories.items.length
205+
? categoryData.categories.items[0].cms_block?.content
206+
: null;
199207

200208
useEffect(() => {
201209
if (!categoryLoading && categoryData?.categories.items.length > 0) {
@@ -220,6 +228,8 @@ export const useCategoryContent = props => {
220228
setFilterOptions,
221229
items,
222230
totalCount,
223-
totalPagesFromData
231+
totalPagesFromData,
232+
categoryDisplayMode,
233+
cmsBlockContent
224234
};
225235
};

packages/peregrine/lib/talons/WishlistPage/useWishlistItem.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,39 @@ export const useWishlistItem = props => {
8181
selectedConfigurableOptions.length &&
8282
selectedConfigurableOptions.length === configurableOptions.length
8383
) {
84-
const selectedOptionsArray = selectedConfigurableOptions.map(
85-
selectedOption => {
86-
// TODO: Use configurable_product_option_uid for ConfigurableWishlistItem when available in 2.4.5
84+
const selectedOptionsArray = selectedConfigurableOptions
85+
.map(selectedOption => {
8786
const {
8887
id: attributeId,
8988
value_id: selectedValueId
9089
} = selectedOption;
9190
const configurableOption = configurableOptions.find(
9291
option => option.attribute_id_v2 === attributeId
9392
);
94-
const configurableOptionValue = configurableOption.values.find(
95-
optionValue =>
96-
optionValue.value_index === selectedValueId
97-
);
98-
99-
return configurableOptionValue.uid;
100-
}
101-
);
93+
if (configurableOption) {
94+
const configurableOptionValue = configurableOption.values.find(
95+
optionValue =>
96+
optionValue.value_index === selectedValueId
97+
);
98+
99+
if (
100+
configurableOptionValue &&
101+
configurableOptionValue.uid
102+
) {
103+
return configurableOptionValue.uid;
104+
}
105+
}
106+
return null;
107+
})
108+
.filter(uid => uid !== null);
102109

103-
Object.assign(item, {
104-
selected_options: selectedOptionsArray
105-
});
110+
if (selectedOptionsArray.length > 0) {
111+
Object.assign(item, {
112+
selected_options: selectedOptionsArray
113+
});
114+
} else {
115+
return null;
116+
}
106117
}
107118

108119
return item;

packages/venia-concept/webpack.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
33
const webpack = require('webpack');
44
const fs = require('fs');
55
const { promisify } = require('util');
6+
const path = require('path');
67

78
const {
89
getMediaURL,
@@ -72,6 +73,20 @@ module.exports = async env => {
7273
({ store_code }) => store_code === process.env.STORE_VIEW_CODE
7374
);
7475

76+
/**
77+
* Here we check the STORE_VIEW_CODE for multistore setup and generate
78+
* the index.html content to have the store code in script url
79+
* and placed the assets in storeview specific folder inside dist
80+
*/
81+
if (process.env.USE_STORE_CODE_IN_URL && process.env.STORE_VIEW_CODE) {
82+
const storeViewCode = process.env.STORE_VIEW_CODE;
83+
config.output = {
84+
...config.output,
85+
publicPath: `/${storeViewCode}/`,
86+
path: path.resolve(__dirname, 'dist', storeViewCode)
87+
};
88+
}
89+
7590
global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl;
7691
global.LOCALE = storeConfigData.locale.replace('_', '-');
7792
global.AVAILABLE_STORE_VIEWS = availableStores;

0 commit comments

Comments
 (0)