Skip to content

feat(blocks.product-list): Refactor product mapping and add product list block for CMS#347

Closed
CarlosGTI001 wants to merge 1 commit intoo2sdev:mainfrom
CarlosGTI001:main
Closed

feat(blocks.product-list): Refactor product mapping and add product list block for CMS#347
CarlosGTI001 wants to merge 1 commit intoo2sdev:mainfrom
CarlosGTI001:main

Conversation

@CarlosGTI001
Copy link
Copy Markdown

@CarlosGTI001 CarlosGTI001 commented Nov 11, 2025

Based on the description you provided, here are the answers to your questions:

  • What does this PR do?

    • Consolidates product mock data into a single array for easier management.
    • Enhances the product model with additional fields such as availability, stock, and rating.
    • Implements filtering and sorting functionalities for product lists.
    • Adds a new product list block mapper for CMS with localization support for availability and filter
      options.
    • Introduces methods for matching products based on price, tags, availability, and search criteria.
    • It's a bugfix (according to the checked box).
  • Related Ticket(s)

    • Notion Ticket (no specific link or ID provided).
  • Key Changes

    • How does the code change address the issue? The description does not detail how the specific 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.
    • What side effects does this change have? The description does not mention any side effects. To
      determine this, it would be necessary to analyze the implemented code.
  • How to test

    • The description does not include detailed instructions on how to set up or test the changes. For this,
      I would need access to the code and the development environment.
  • Media (Loom or gif)

    • No media has been inserted.

- 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.
@marcinkrasowski marcinkrasowski self-requested a review November 12, 2025 07:23
@marcinkrasowski
Copy link
Copy Markdown
Collaborator

marcinkrasowski commented Nov 12, 2025

@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:
As an additional requirement, please provide a short feedback on your experiences with working with this framework - how easy or difficult it was to get started (including starting the project, getting around the monorepo or readings our docs) and to make the required changes.

Copy link
Copy Markdown
Collaborator

@marcinkrasowski marcinkrasowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +110 to +113
{ 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' },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here the types don't match, please make sure they are correct

Image


const sanitizeFilters = (nextFilters: FilterState): FilterState => ({
...nextFilters,
availability: sanitizeMultiValue(nextFilters.availability),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here there is also some problem with correct typings

Image

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';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change the scope from @dxp to @o2s, there was a mistake in the generator that that has a pending fix

@marcinkrasowski marcinkrasowski changed the title feat: Refactor product mapping and add product list block for CMS feat(bocks.product-list): Refactor product mapping and add product list block for CMS Nov 14, 2025
@marcinkrasowski marcinkrasowski changed the title feat(bocks.product-list): Refactor product mapping and add product list block for CMS feat(blocks.product-list): Refactor product mapping and add product list block for CMS Nov 17, 2025
@marcinkrasowski
Copy link
Copy Markdown
Collaborator

@CarlosGTI001 closed in favor of #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants