File tree Expand file tree Collapse file tree 7 files changed +112
-605
lines changed
venia-ui/lib/RootComponents/Category Expand file tree Collapse file tree 7 files changed +112
-605
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ exports[`useCategoryContent tests handles no data prop 1`] = `
4
4
Object {
5
5
" availableSortMethods" : null ,
6
6
" categoryDescription" : " Jewelry category" ,
7
+ " categoryDisplayMode" : undefined ,
7
8
" categoryName" : " Jewelry" ,
9
+ " cmsBlockContent" : undefined ,
8
10
" filterOptions" : undefined ,
9
11
" filters" : null ,
10
12
" items" : Array [
@@ -33,7 +35,9 @@ Object {
33
35
},
34
36
],
35
37
" categoryDescription" : " Jewelry category" ,
38
+ " categoryDisplayMode" : undefined ,
36
39
" categoryName" : " Jewelry" ,
40
+ " cmsBlockContent" : undefined ,
37
41
" filterOptions" : undefined ,
38
42
" filters" : Array [
39
43
Object {
Original file line number Diff line number Diff line change 1
1
import { gql } from '@apollo/client' ;
2
2
3
3
export const GET_PRODUCT_FILTERS_BY_CATEGORY = gql `
4
- query getProductFiltersByCategory($filters: ProductAttributeFilterInput!) {
4
+ query getProductFiltersByCategories(
5
+ $filters: ProductAttributeFilterInput!
6
+ ) {
5
7
products(filter: $filters) {
6
8
aggregations {
7
9
label
@@ -27,13 +29,17 @@ export const GET_CATEGORY_CONTENT = gql`
27
29
description
28
30
url_key
29
31
url_path
32
+ display_mode
33
+ cms_block {
34
+ content
35
+ }
30
36
}
31
37
}
32
38
}
33
39
` ;
34
40
35
41
export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql `
36
- query getCategoryAvailableSortMethods (
42
+ query getCategoriesAvailableSortMethods (
37
43
$categoryIdFilter: FilterEqualTypeInput!
38
44
) {
39
45
products(filter: { category_uid: $categoryIdFilter }) {
Original file line number Diff line number Diff line change @@ -196,6 +196,14 @@ export const useCategoryContent = props => {
196
196
const availableSortMethods = sortData
197
197
? sortData . products . sort_fields . options
198
198
: 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 ;
199
207
200
208
useEffect ( ( ) => {
201
209
if ( ! categoryLoading && categoryData ?. categories . items . length > 0 ) {
@@ -220,6 +228,8 @@ export const useCategoryContent = props => {
220
228
setFilterOptions,
221
229
items,
222
230
totalCount,
223
- totalPagesFromData
231
+ totalPagesFromData,
232
+ categoryDisplayMode,
233
+ cmsBlockContent
224
234
} ;
225
235
} ;
Original file line number Diff line number Diff line change @@ -81,28 +81,39 @@ export const useWishlistItem = props => {
81
81
selectedConfigurableOptions . length &&
82
82
selectedConfigurableOptions . length === configurableOptions . length
83
83
) {
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 => {
87
86
const {
88
87
id : attributeId ,
89
88
value_id : selectedValueId
90
89
} = selectedOption ;
91
90
const configurableOption = configurableOptions . find (
92
91
option => option . attribute_id_v2 === attributeId
93
92
) ;
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 ) ;
102
109
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
+ }
106
117
}
107
118
108
119
return item ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
3
3
const webpack = require ( 'webpack' ) ;
4
4
const fs = require ( 'fs' ) ;
5
5
const { promisify } = require ( 'util' ) ;
6
+ const path = require ( 'path' ) ;
6
7
7
8
const {
8
9
getMediaURL,
@@ -72,6 +73,20 @@ module.exports = async env => {
72
73
( { store_code } ) => store_code === process . env . STORE_VIEW_CODE
73
74
) ;
74
75
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
+
75
90
global . MAGENTO_MEDIA_BACKEND_URL = mediaUrl ;
76
91
global . LOCALE = storeConfigData . locale . replace ( '_' , '-' ) ;
77
92
global . AVAILABLE_STORE_VIEWS = availableStores ;
You can’t perform that action at this time.
0 commit comments