-
Notifications
You must be signed in to change notification settings - Fork 15
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
Cart and order data persistence on the server side #21
Cart and order data persistence on the server side #21
Conversation
Someone is attempting to deploy a commit to the Composable Development Team on Vercel. A member of the Team first needs to authorize it. |
hello @marcin-slezak, thank you for your contribution to Composable UI! We'll review this and let you know if we have any questions before merging. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@marcin-slezak I was able to successfully deploy on Netlify, see deployment https://composable-ui-voucherify.netlify.app/ Can you please try setting the PNPM_FLAGS = --shamefully-hoist This variable gets set automatically through our 1 click deploy to Netlify link, however maybe we need to update the docs to surface this when doing a manual deploy to Netlify from a forked repository. Please let me know if this resolves the Netlify issue. |
- better files naming - comment about the persistence limitation in serverless environment
|
Name | Link |
---|---|
🔨 Latest commit | d1cadf3 |
@dannytlake Thank you for your suggestion about PNPM_FLAGS! I successfully deployed on Netlify using your advice (https://calm-otter-6d91de.netlify.app/). I can confirm that storage-mock works the same way as on Vercel. I also applied the suggested changes. |
Background
Voucherify is a Promotion Engine which allows marketing teams to run digital promotions like coupons, gift cards, referrals, bundles and loyalty. As the headless commerce solution and Mach Alliance member, we want to integrate Composable UI with Voucherify to help our community better understand how to build promotion features efficiently in the composable commerce storefront.
I appreciate your effort to build and share the Composable UI accelerator. I really enjoy working on this application; it's flexible and well-designed. Still, I encountered a problem which I need to solve first before I will be able to continue building this integration (as a part of another future PR).
Problem
To show a little more advanced digital promotion scenarios in the storefront, we need functionality that allows users to add more than one product to the cart in Composable UI. Unfortunately, currently as the user :
Venture Daypack
product) after refreshing the page in the browser,The reason for this behaviour is an example
commerce-generic
service that manages the cart and orders data without any data persistence on the server side. Because ofcommerce-generic
implementation simplification, this service can not keep consistent responses in a series ofcreateCart
,addCartItem
,updateCartItem
, andgetCart
requests.Solution
We have prepared a Pull Request to Composable UI repository, where we have improved
commerce-generic
service by adding cart and order data file-based persistence, so it allows users to manage products in the cart more freely.Summary of the changes:
node-persist
package, which provides a minimalistic API to persist data in JSON files and reduce code complexity,/tmp
folder. From our experience, this lasts long enough (10+ minutes) to keep a nice user experience.next-runtime
library: Linkcommerce-generic
service, except:cartId
param to thecreateOrder
requestcomposable-ui/src/utils/__mocks__/api.ts
- we have added missing mocked data fixing testsrc/components/__tests__/home-page.test.tsx
, which fails onmain
branchHere is a video that shows the difference in behaviour. On the left side, we have changes from this PR; on the right side application before changes:
Screen.Recording.2023-10-27.at.10.42.29.mov