Skip to content

Conversation

sf-shikhar-prasoon
Copy link
Contributor

@sf-shikhar-prasoon sf-shikhar-prasoon commented Aug 4, 2025

Description

Adding a foundation for bonus product selection functionality with proper modal management and integration with the existing add-to-cart flow.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • Created a new bonus product modal system with context provider, modal component, and custom hook
  • Added tests coverage for the bonus product modal functionality
  • Enhanced the add-to-cart modal to integrate with bonus products by:
    • Fetching and displaying promotion details
    • Adding a "Select Bonus Products" button that opens the bonus modal
    • Passing relevant data between modals
  • Updated app layout to include the new bonus product modal provider
Screen.Recording.2025-08-04.at.9.19.18.AM.mov

How to Test-Drive This PR

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@sf-shikhar-prasoon sf-shikhar-prasoon added ready for review PR is ready to be reviewed skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated and removed ready for review PR is ready to be reviewed labels Aug 4, 2025
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Aug 4, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@sf-shikhar-prasoon sf-shikhar-prasoon marked this pull request as ready for review August 4, 2025 14:15
@sf-shikhar-prasoon sf-shikhar-prasoon requested a review from a team as a code owner August 4, 2025 14:15
@sf-shikhar-prasoon sf-shikhar-prasoon requested a review from a team August 4, 2025 14:16
@sf-shikhar-prasoon sf-shikhar-prasoon added ready for review PR is ready to be reviewed and removed ready for review PR is ready to be reviewed labels Aug 4, 2025
@sf-shikhar-prasoon sf-shikhar-prasoon added the ready for review PR is ready to be reviewed label Aug 4, 2025
@sf-cboscenco
Copy link
Contributor

For clarity can we rename the use-bonus-product-modal to use-bonus-product-selection-modal (also in other places where we use BonusProductModal=>BonusProductSelectionModal).

Copy link
Contributor

@sf-kyle-wright sf-kyle-wright left a comment

Choose a reason for hiding this comment

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

LSTM

</Button>
{bonusDiscountLineItems &&
bonusDiscountLineItems.length > 0 && (
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we refactor this button into a new SelectBonusProductsButton component?

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be preferable

return null
}

// todo: this component will be replaced in the next work item. The component will display bonus products available for selection.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still accurate correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's being removed in the next PR where I've added the products. It's in draft PR state and I shared it on Friday.
I think we should leave this comment here in this PR. And when the next one is merged it'll be removed with that.


const {pathname} = useLocation()
useEffect(() => {
if (state.isOpen) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This modal state logic could probably be extracted into a reusable hook?

<Dialog.Backdrop />
<Dialog.Positioner>
<Dialog.Content>
<Dialog.Body bgColor="white" padding="8">
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer p={8} for consistency and token usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you mean padding={8}?
I see that in the code. But no p={8}

@kevinxh
Copy link
Contributor

kevinxh commented Aug 12, 2025

I'm curious did you encounter there any ux / accessibility issues with modal nested inside another modal? when you click the outside area, does both modal gets closed? This is an interesting UX pattern that we don't have a precedence.

…168138/add-new-modal/main

merge conflict in packages/template-chakra-storefront/src/hooks/index.js where the recently added line "export {useManualBonusProducts} from './use-manual-bonus-products'" was not being used as the file doesn't exist. I removed it
@sf-shikhar-prasoon sf-shikhar-prasoon force-pushed the t/cc-sharks/W-19168138/add-new-modal/main branch from c5b280a to 407faa9 Compare August 14, 2025 17:30
@sf-shikhar-prasoon
Copy link
Contributor Author

Screenshot 2025-08-15 at 1 24 10 PM These PR checks are not failing due to the changes in this PR 1. The same tests are failing in a test PR i made with just one comment change https://github.com//pull/3105 2. The 2nd last commit had no test failures. The last commit was only a merge back into this branch

These tests are failing from some changes already in the feature branch

@sf-shikhar-prasoon sf-shikhar-prasoon merged commit 17a7bf6 into feature/manual-bonus-products-v4 Aug 15, 2025
13 of 63 checks passed
@sf-shikhar-prasoon sf-shikhar-prasoon deleted the t/cc-sharks/W-19168138/add-new-modal/main branch August 15, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review PR is ready to be reviewed skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants