create-brainerce-store 1.5.3 → 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 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.3",
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
@@ -12,6 +12,8 @@
12
12
  "total": "Total",
13
13
  "subtotal": "Subtotal",
14
14
  "discount": "Discount",
15
+ "generalDiscount": "General Discount",
16
+ "couponDiscount": "Coupon",
15
17
  "shipping": "Shipping",
16
18
  "pickup": "Pickup",
17
19
  "tax": "Tax",
package/messages/he.json CHANGED
@@ -12,6 +12,8 @@
12
12
  "total": "סה\"כ",
13
13
  "subtotal": "סיכום ביניים",
14
14
  "discount": "הנחה",
15
+ "generalDiscount": "הנחה כללית",
16
+ "couponDiscount": "קופון",
15
17
  "shipping": "משלוח",
16
18
  "pickup": "איסוף",
17
19
  "tax": "מע\"מ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -573,14 +573,42 @@ function CheckoutContent() {
573
573
  </span>
574
574
  </div>
575
575
 
576
- {parseFloat(checkout.discountAmount) > 0 && (
577
- <div className="flex items-center justify-between">
578
- <span className="text-muted-foreground">{tc('discount')}</span>
579
- <span className="text-destructive">
580
- -{formatPrice(parseFloat(checkout.discountAmount), { currency }) as string}
581
- </span>
582
- </div>
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') && (