feat(blocks.product-list): Refactor product mapping and add product list block for CMS#347
feat(blocks.product-list): Refactor product mapping and add product list block for CMS#347CarlosGTI001 wants to merge 1 commit intoo2sdev:mainfrom
Conversation
- Consolidated product mock data into a single array for easier management. - Enhanced product model with additional fields such as availability, stock, and rating. - Implemented filtering and sorting functionalities for product lists. - Added a new product list block mapper for CMS with localization support for availability and filter options. - Introduced methods for matching products based on price, tags, availability, and search criteria.
|
@CarlosGTI001 Hi, I will look over this PR, but in the meantime I'd like to also leave a feedback, I forgot to mention it in the ororignal issue. We are trying to use these bounties not only for developing new features, but also to see how other peaple find working with the framework, and are super interested in your opinion. Here is a footnote from the issue description that I usually add: |
marcinkrasowski
left a comment
There was a problem hiding this comment.
Just some initial issues - currently they prevent from starting the app so I'll wait until they are fixed with a more details code review.
You wrote that the description did not say how to test the changes, but there was "Test the Implementation part there - were you able to run the app at all despite these issues? Did you look in our docs how to run it and sign-in? Also, I actually forgot to mention it in the ticket, but we also have a Storybook integrated into o2s, and if it's not too much effort you could create a story for the block and test it there before testing it in the main app?
| } | ||
|
|
||
| getProductListBlock(options: CMS.Request.GetCmsEntryParams) { | ||
| const key = `product-list-component-${options.id}-${options.locale}`; |
There was a problem hiding this comment.
let's leave this part unimplemented so that we don't forget to extend the Strapi integration as well in the future; just throw
getProductListBlock(options: CMS.Request.GetCmsEntryParams): Observable<CMS.Model.ProductListBlock.ProductListBlock> {
throw new NotImplementedException();
}
from
import { NotImplementedException } from '@nestjs/common';
| @@ -0,0 +1,184 @@ | |||
| import { CMS } from '@o2s/framework/modules'; | |||
There was a problem hiding this comment.
after we specify the method as not implemented, we can get rid of this file completely - I'd like not to have mocked data in any real integrations
| { label: availabilityMap.IN_STOCK, value: 'IN_STOCK' }, | ||
| { label: availabilityMap.LOW_STOCK, value: 'LOW_STOCK' }, | ||
| { label: availabilityMap.OUT_OF_STOCK, value: 'OUT_OF_STOCK' }, | ||
| { label: availabilityMap.PREORDER, value: 'PREORDER' }, |
There was a problem hiding this comment.
I'm getting errors here since the abailibility map is a simple Record<string, string which means this value here might be undefined, see if you can type it more strictly as shown in https://stackoverflow.com/a/67089592/2231032 (we'd like to use Products.Model.ProductAvailability as key)
| offset, | ||
| locale, | ||
| }, | ||
| headers.authorization, |
There was a problem hiding this comment.
this shows as an error as packages/integrations/mocked/src/modules/products/products.service.ts does not have a second argument; so please add an optional one there authorization?: string (and it should be optional, as product list can very well be shown for not logged-in users as well)
| </Typography> | ||
| )} | ||
| {data.subtitle && ( | ||
| <Typography variant="muted"> |
There was a problem hiding this comment.
the Typography does not have a muted variant, please change it to a one that is supported
| description={product.shortDescription || product.description} | ||
| price={product.price} | ||
| image={product.image} | ||
| tags={product.tags} |
|
|
||
| const sanitizeFilters = (nextFilters: FilterState): FilterState => ({ | ||
| ...nextFilters, | ||
| availability: sanitizeMultiValue(nextFilters.availability), |
| import * as TicketList from '@o2s/blocks.ticket-list/api-harmonization'; | ||
| import * as TicketRecent from '@o2s/blocks.ticket-recent/api-harmonization'; | ||
| import * as UserAccount from '@o2s/blocks.user-account/api-harmonization'; | ||
| import * as ProductList from '@dxp/blocks.product-list/api-harmonization'; |
There was a problem hiding this comment.
please change the scope from @dxp to @o2s, there was a mistake in the generator that that has a pending fix
|
|
||
| import { configuration } from '@o2s/api-harmonization/config/configuration'; | ||
|
|
||
| import * as ProductList from '@dxp/blocks.product-list/api-harmonization'; |
There was a problem hiding this comment.
please change the scope from @dxp to @o2s, there was a mistake in the generator that that has a pending fix
|
@CarlosGTI001 closed in favor of #411 |


Based on the description you provided, here are the answers to your questions:
What does this PR do?
options.
Related Ticket(s)
Key Changes
address a particular issue, but rather lists the added functionalities. To answer this, I would need to
see the code and the context of the original problem.
determine this, it would be necessary to analyze the implemented code.
How to test
I would need access to the code and the development environment.
Media (Loom or gif)