From afb6ea9607d77b1bc7ad90da5132d5edbf80ffaa Mon Sep 17 00:00:00 2001 From: cboscenco Date: Mon, 25 Aug 2025 09:02:55 -0700 Subject: [PATCH 01/12] Manual bonus products port from v4 --- .gitignore | 5 + .../app/components/_app/index.jsx | 57 +- .../bonus-product-view-modal/index.jsx | 244 +++++++ .../components/product-item-list/index.jsx | 8 +- .../app/components/product-item/index.jsx | 8 +- .../app/components/product-view/index.jsx | 21 +- .../select-bonus-products-button/index.jsx | 62 ++ .../app/hooks/use-add-to-cart-modal.js | 66 +- .../use-bonus-product-selection-modal.js | 422 ++++++++++++ .../app/hooks/use-bonus-product-view-modal.js | 20 + .../app/hooks/use-derived-product.js | 4 +- .../app/hooks/use-modal-state.js | 51 ++ .../app/pages/cart/index.jsx | 138 +++- ...oduct-list-with-grouped-bonus-products.jsx | 209 ++++++ .../partials/cart-secondary-button-group.jsx | 14 +- .../partials/select-bonus-products-card.jsx | 193 ++++++ .../static/translations/compiled/en-GB.json | 62 ++ .../static/translations/compiled/en-US.json | 62 ++ .../static/translations/compiled/en-XA.json | 118 ++++ .../components/project/add-to-cart-modal.js | 81 +++ .../components/project/product-view-modal.js | 49 ++ .../app/utils/bonus-product-utils.js | 602 ++++++++++++++++++ .../app/utils/bonus-product-utils.test.js | 562 ++++++++++++++++ .../config/default.js | 7 +- .../translations/en-GB.json | 21 + .../translations/en-US.json | 21 + 26 files changed, 3045 insertions(+), 62 deletions(-) create mode 100644 packages/template-retail-react-app/app/components/bonus-product-view-modal/index.jsx create mode 100644 packages/template-retail-react-app/app/components/select-bonus-products-button/index.jsx create mode 100644 packages/template-retail-react-app/app/hooks/use-bonus-product-selection-modal.js create mode 100644 packages/template-retail-react-app/app/hooks/use-bonus-product-view-modal.js create mode 100644 packages/template-retail-react-app/app/hooks/use-modal-state.js create mode 100644 packages/template-retail-react-app/app/pages/cart/partials/cart-product-list-with-grouped-bonus-products.jsx create mode 100644 packages/template-retail-react-app/app/pages/cart/partials/select-bonus-products-card.jsx create mode 100644 packages/template-retail-react-app/app/theme/components/project/add-to-cart-modal.js create mode 100644 packages/template-retail-react-app/app/theme/components/project/product-view-modal.js create mode 100644 packages/template-retail-react-app/app/utils/bonus-product-utils.js create mode 100644 packages/template-retail-react-app/app/utils/bonus-product-utils.test.js diff --git a/.gitignore b/.gitignore index 0b3080e087..e347b314e4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ lerna-debug.log /test-results/ /playwright-report/ /playwright/.cache/ + +# Build directories and distribution files +build/ +**/build/ +**/dist/ diff --git a/packages/template-retail-react-app/app/components/_app/index.jsx b/packages/template-retail-react-app/app/components/_app/index.jsx index c3cf7de680..05e8cb7d3d 100644 --- a/packages/template-retail-react-app/app/components/_app/index.jsx +++ b/packages/template-retail-react-app/app/components/_app/index.jsx @@ -57,6 +57,7 @@ import { useDntNotification } from '@salesforce/retail-react-app/app/hooks/use-dnt-notification' import {AddToCartModalProvider} from '@salesforce/retail-react-app/app/hooks/use-add-to-cart-modal' +import {BonusProductSelectionModalProvider} from '@salesforce/retail-react-app/app/hooks/use-bonus-product-selection-modal' import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' import {useCurrentCustomer} from '@salesforce/retail-react-app/app/hooks/use-current-customer' import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket' @@ -430,34 +431,36 @@ const App = (props) => { {!isOnline && } - - + - - {children} - - - - - - {!isCheckout ?