create-brainerce-store 1.5.2 → 1.5.4
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.
- package/dist/index.js +1 -1
- package/messages/en.json +2 -0
- package/messages/he.json +2 -0
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/checkout/page.tsx +38 -10
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-brainerce-store",
|
|
34
|
-
version: "1.5.
|
|
34
|
+
version: "1.5.4",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
package/messages/en.json
CHANGED
package/messages/he.json
CHANGED
package/package.json
CHANGED
|
@@ -556,8 +556,8 @@ function CheckoutContent() {
|
|
|
556
556
|
)
|
|
557
557
|
)}
|
|
558
558
|
|
|
559
|
-
{/* Coupon input */}
|
|
560
|
-
{cart && (
|
|
559
|
+
{/* Coupon input — show from shipping/pickup step onwards */}
|
|
560
|
+
{cart && (step === 'shipping' || step === 'pickup' || step === 'payment') && (
|
|
561
561
|
<div className="border-border border-t pt-4">
|
|
562
562
|
<CouponInput cart={cart} onUpdate={handleCouponUpdate} />
|
|
563
563
|
</div>
|
|
@@ -573,14 +573,42 @@ function CheckoutContent() {
|
|
|
573
573
|
</span>
|
|
574
574
|
</div>
|
|
575
575
|
|
|
576
|
-
{
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
576
|
+
{(() => {
|
|
577
|
+
const totalDiscount = parseFloat(checkout.discountAmount);
|
|
578
|
+
const ruleAmt = parseFloat(checkout.ruleDiscountAmount || '0');
|
|
579
|
+
const couponAmt = totalDiscount - ruleAmt;
|
|
580
|
+
if (totalDiscount <= 0) return null;
|
|
581
|
+
return (
|
|
582
|
+
<>
|
|
583
|
+
{ruleAmt > 0 && (
|
|
584
|
+
<div className="flex items-center justify-between">
|
|
585
|
+
<span className="text-muted-foreground">{tc('generalDiscount')}</span>
|
|
586
|
+
<span className="text-destructive">
|
|
587
|
+
-{formatPrice(ruleAmt, { currency }) as string}
|
|
588
|
+
</span>
|
|
589
|
+
</div>
|
|
590
|
+
)}
|
|
591
|
+
{checkout.couponCode && couponAmt > 0 && (
|
|
592
|
+
<div className="flex items-center justify-between">
|
|
593
|
+
<span className="text-muted-foreground">
|
|
594
|
+
{tc('couponDiscount')} ({checkout.couponCode})
|
|
595
|
+
</span>
|
|
596
|
+
<span className="text-destructive">
|
|
597
|
+
-{formatPrice(couponAmt, { currency }) as string}
|
|
598
|
+
</span>
|
|
599
|
+
</div>
|
|
600
|
+
)}
|
|
601
|
+
{!checkout.couponCode && ruleAmt <= 0 && (
|
|
602
|
+
<div className="flex items-center justify-between">
|
|
603
|
+
<span className="text-muted-foreground">{tc('discount')}</span>
|
|
604
|
+
<span className="text-destructive">
|
|
605
|
+
-{formatPrice(totalDiscount, { currency }) as string}
|
|
606
|
+
</span>
|
|
607
|
+
</div>
|
|
608
|
+
)}
|
|
609
|
+
</>
|
|
610
|
+
);
|
|
611
|
+
})()}
|
|
584
612
|
|
|
585
613
|
{(parseFloat(checkout.shippingAmount) > 0 ||
|
|
586
614
|
checkout.deliveryType === 'pickup') && (
|