-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CIF-1473: Support Bundle Products: option selection #378
Conversation
- Added graphql query - Modified product HTL template - Added new translations - Created inputs matching graphql options response - Added validation for required options - Added validation for quantity change
Codecov Report
@@ Coverage Diff @@
## master #378 +/- ##
============================================
+ Coverage 85.09% 88.57% +3.47%
Complexity 924 924
============================================
Files 172 83 -89
Lines 4174 3046 -1128
Branches 659 290 -369
============================================
- Hits 3552 2698 -854
+ Misses 485 211 -274
Partials 137 137
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rethink, how you use CSS in this component. Yes it makes sense to use the classes from the server-side components, but on the other hand, it messes with the customisation patterns of the React components. @dplaton wdyt?
react-components/src/components/BundleProductOptions/bundleProductOptions.js
Outdated
Show resolved
Hide resolved
</div> | ||
</section> | ||
<section className="productFullDetail__cartActions productFullDetail__section"> | ||
<button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler on the add to cart button via https://github.com/adobe/aem-core-cif-components/blob/master/ui.apps/src/main/content/jcr_root/apps/core/cif/components/commerce/product/v1/product/clientlib/js/addToCart.js is only done once for when the whole document is loaded. Since this component starts with an initial bundleState = null
, the button is not rendered and the event handler should not be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the intention is to not use the default event handler for adding to cart since a bundle requires a different mutation.
I can modify the classes to avoid any confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but that would mean copying the CSS rules from productFullDetail__cartActions
to another class and use that one instead in this button. not sure it's worth it
I'm fine with the whole code (I have more or less the same comments as @herzog31), but I have a problem with the whole approach: all our "React Core Components" are standalone. They do share context, but you can use the shopping cart without the authentication part, and you can use the whole My Account suite of components without the Shopping Cart. However, this feature is tied to a Product component. Even more, this component doesn't even share state with the other components, it's just used for a specific flavor of a product component. With this in mind, I'm really wondering if we should even have this component as part of the React Core Components project. I can think of two other options: 1/ Have it as a React component, but part of |
I agree that having this one functionality as part of
I think I can just create a React app as part of the Product
Having this implemented as plain Javascript can be hard to do and maintain, the main issue being the HTML rendering (which can easily become spaghetti code). |
IMO having yet another React project in our repos is overkill. I'm completely fine with having this feature as part of the |
That's a good idea since the client libraries already get built with Webpack, so no need to create another React project. The only downside is that you'd have to re-write your tests.
That's my thinking as well, @herzog31, hence the idea above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like so see some tests for all the onX
methods of the input fields (checkbox, multiselect, radio etc).
Description
ProductOptionsBundle react component will be mounted in a placeholder div element that is present for bundle products.
Initially displays a Customize button. Once the button is pressed, it performs a graphQL query to fetch the bundle options and renders it accordingly.
The add to cart is not implemented as there's a separate issue for it.
Related Issue
CIF-1473
Motivation and Context
Support Bundle Products
How Has This Been Tested?
Unit tests; manually
Screenshots (if appropriate):
Types of changes
Checklist: