@codesinger0/shared-components 1.1.97 → 1.1.99
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.
|
@@ -78,7 +78,7 @@ const SmallItemCard = ({
|
|
|
78
78
|
|
|
79
79
|
{/* Discount Badge */}
|
|
80
80
|
{hasDiscount && (
|
|
81
|
-
<div className="absolute top-2 left-2
|
|
81
|
+
<div className="absolute top-2 left-2 text-white px-2 py-1 rounded-full text-xs font-bold shadow-lg discount-badge">
|
|
82
82
|
-{discountPercentage}%
|
|
83
83
|
</div>
|
|
84
84
|
)}
|
|
@@ -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('');
|
|
@@ -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">
|
|
@@ -26,4 +26,9 @@
|
|
|
26
26
|
background: color-mix(in srgb, var(--card-bg) 55%, transparent);
|
|
27
27
|
box-shadow: 0 12px 40px 0 color-mix(in srgb, var(--primary) 30%, transparent);
|
|
28
28
|
transform: translateY(-2px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Discount Badge */
|
|
32
|
+
.discount-badge {
|
|
33
|
+
background-color: var(--discount-color, #ef4444); /* Falls back to Tailwind's red-500 (#ef4444) */
|
|
29
34
|
}
|