-
-
Notifications
You must be signed in to change notification settings - Fork 120
Make USC framework agnostic with redux #177
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
Conversation
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.
It looks pretty good so far.
A few notes on the core
implementation:
It looks like we're missing some things that we have in the current react-based implementation. Here are all the methods/actions we do and don't have.
-
addItem
-
incrementItem
-
decrementItem
-
setItemQuantity
-
updateQuantity
-
loadCart
-
redirectToCheckout
-
checkoutSingleItem
-
handleCartClick
-
handleCartHover
-
handleCloseCart
I think we also need to add the formattedTotalPrice
getter.
Other stuff
All of the exported values will need type definitions (I'll leave it up to you if you just want to switch it to TypeScript or write .d.ts
files) but we can wait to add those until everything is finalized. And, we'll need to change the React implementation we have to use the Redux store, it'll act as a sort of wrapper around it so that the React API for this library stays similar.
Also, we can probably move the util.js
file and stuff it has into the core/
directory. Serverless function stuff could have its own serverless/
directory if we wanted.
Co-authored-by: Chris Brown <chris_brown@hey.com>
@ChrisBrownie55 I just updated all the tests, it's a little messy and there's prob some stuff that could be done better, but for the most part, actions and reducers have tests that I think are pretty solid. I think I'm gonna start writing tests for the Entry classes as well unless you think that might be redundant. |
@dayhaysoos Yeah, that might be a bit redundant. We should already have complete test coverage for the |
… into nick/typedefs
(feat): add gatsby-plugin for v3
… into nick/typedefs
added type defs
remove unnecessary async/await Co-authored-by: Andria Brown <chris_brown@hey.com>
Hey @andria-dev, I just wanted to bring to your attention that I merged this branch into dev (not sure if I should have done that or not tbh). Should we continue pushing to this one or should merge the new changes to dev and close this PR? Also, I like your new name! |
Hi @dayhaysoos, thanks for letting me know, we can merge these into the dev branch. We should probably set up a PR for the dev branch to be merged into the main branch eventually though. Thank you! 😊 |
Update React tests
Closing this as everything has been moved into |
This is a very rough start to getting redux into use-shopping-cart.
We're calling the redux part of this the
core
of the lib.Some major changes I've been making:
Entry Class
use-shopping-cart has an
Entry
class that is important to making sure thecartDetails
is always formatted properly. From the Entry class, we use functions likecreateEntry
,updateEntry
,removeEntry
.I'm copying this class and those functions to the
core
directory, however, I'm changing the arguments to accept an object rather than a bunch of arguments. It's much easier to manage/digest this way imoMajor API changes
options
Object that will take optionalcount
,price_metadata
,product_metadata
To Do
I'm hoping to get lots of feedback on this about anything 🙏