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`] = `
44Object {
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 {
Original file line number Diff line number Diff line change 11import { gql } from '@apollo/client' ;
22
33export 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
3541export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql `
36- query getCategoryAvailableSortMethods (
42+ query getCategoriesAvailableSortMethods (
3743 $categoryIdFilter: FilterEqualTypeInput!
3844 ) {
3945 products(filter: { category_uid: $categoryIdFilter }) {
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
33const webpack = require ( 'webpack' ) ;
44const fs = require ( 'fs' ) ;
55const { promisify } = require ( 'util' ) ;
6+ const path = require ( 'path' ) ;
67
78const {
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 ;
You can’t perform that action at this time.
0 commit comments