@codesinger0/shared-components 1.1.96 → 1.1.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,8 @@ const OrderForm = ({
44
44
  totalPrice,
45
45
  businessName,
46
46
  paymentLinkCreationURL,
47
- scrollContainerRef
47
+ scrollContainerRef,
48
+ clearCart // Function to clear cart after successful order
48
49
  }) => {
49
50
 
50
51
  const [nameError, setNameError] = useState('');
@@ -164,7 +165,7 @@ const OrderForm = ({
164
165
  'Content-Type': 'application/json'
165
166
  },
166
167
  body: JSON.stringify({
167
- businessName: 'confectioneryShop',
168
+ businessName,
168
169
  operation: 'createPaymentLink',
169
170
  customerName: orderData.customerName,
170
171
  customerPhone: orderData.customerPhone,
@@ -339,6 +340,13 @@ const OrderForm = ({
339
340
  // Component will re-render with updated user data
340
341
  };
341
342
 
343
+ const handlePaymentSuccess = () => {
344
+ // Clear cart after successful payment (only for cart purchases, not courses/workshops)
345
+ if (!isCoursePurchase && !isWorkshopPurchase && clearCart) {
346
+ clearCart();
347
+ }
348
+ };
349
+
342
350
  const handleSubmit = async (e) => {
343
351
  e.preventDefault();
344
352
  debugger
@@ -938,6 +946,7 @@ const OrderForm = ({
938
946
  orderId={createdOrderId}
939
947
  simpleOrderNumber={paymentData?.simpleOrderNumber}
940
948
  updateOrder={updateOrder}
949
+ onPaymentSuccess={handlePaymentSuccess}
941
950
  />
942
951
 
943
952
  <ClubPromoModal
@@ -13,7 +13,8 @@ const ShoppingCartModal = ({ CheckoutComponent }) => {
13
13
  isCartOpen, // context state
14
14
  closeCart, // context function that flips isCartOpen -> false
15
15
  updateQuantity,
16
- removeFromCart
16
+ removeFromCart,
17
+ clearCart // function to clear all cart items
17
18
  } = useCart();
18
19
 
19
20
  const orderFormScrollContainerRef = useRef(null);
@@ -106,6 +107,7 @@ const ShoppingCartModal = ({ CheckoutComponent }) => {
106
107
  cartItems={cartItems}
107
108
  totalPrice={totalPrice}
108
109
  scrollContainerRef={orderFormScrollContainerRef}
110
+ clearCart={clearCart}
109
111
  />
110
112
  ) : (
111
113
  <div className="p-6">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesinger0/shared-components",
3
- "version": "1.1.96",
3
+ "version": "1.1.98",
4
4
  "description": "Shared React components for customer projects",
5
5
  "main": "dist/index.js",
6
6
  "files": [