create-brainerce-store 1.77.0 → 1.78.0

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.77.0",
34
+ version: "1.78.0",
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
@@ -11,7 +11,6 @@
11
11
  "no": "No",
12
12
  "total": "Total",
13
13
  "subtotal": "Subtotal",
14
- "subtotalExclTax": "Subtotal (excl. tax)",
15
14
  "discount": "Discount",
16
15
  "generalDiscount": "General Discount",
17
16
  "couponDiscount": "Coupon",
package/messages/he.json CHANGED
@@ -11,7 +11,6 @@
11
11
  "no": "לא",
12
12
  "total": "סה\"כ",
13
13
  "subtotal": "סיכום ביניים",
14
- "subtotalExclTax": "סיכום ביניים (לפני מע\"מ)",
15
14
  "discount": "הנחה",
16
15
  "generalDiscount": "הנחה כללית",
17
16
  "couponDiscount": "קופון",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.77.0",
3
+ "version": "1.78.0",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -1068,36 +1068,31 @@ function CheckoutContent() {
1068
1068
  {/* Totals */}
1069
1069
  {checkout &&
1070
1070
  (() => {
1071
- // When the store prices include tax (VAT-style), the on-row
1072
- // `checkout.subtotal` is GROSS it already contains the tax.
1073
- // Show the net (tax-excluded) value here, then a separate VAT
1074
- // line below, so the customer sees the breakdown the merchant
1075
- // asked for. Falls back to the raw subtotal when no breakdown
1076
- // is available yet (e.g. shipping address not entered).
1077
- const isInclusive = checkout.taxBreakdown?.pricesIncludeTax === true;
1078
- // `taxBreakdown.subtotal` is the NET of every taxed line, and
1079
- // shipping is one of those lines — so it already contains the
1080
- // shipping net. Rendering it and then adding `shippingAmount`
1081
- // below counts shipping twice: a real checkout read
1082
- // 54.06 + 9.99 + 7.93 = 71.98 beside a 61.99 total, three rows
1083
- // that visibly refuse to add up next to the figure being charged.
1071
+ // Every row in this column is GROSS, and the tax row below is
1072
+ // informational. That is how a VAT receipt reads, it is what
1073
+ // `TaxDisplay` already says on its own line ("VAT 18% included"),
1074
+ // and it is exactly what the order-history summary renders one
1075
+ // convention across all three, so a shopper who compares the
1076
+ // checkout against the order they later open sees the same
1077
+ // arithmetic twice.
1084
1078
  //
1085
- // Subtract the shipping net back out so the column reconciles.
1086
- // The shipping row keeps showing the GROSS amount, which is what
1087
- // a shopper recognises from the rate they picked.
1088
- // `shippingNet` comes from the server, never from
1089
- // `shippingAmount` minus a guess: subtracting the GROSS is only
1090
- // correct when shipping is untaxed, and a store that taxes
1091
- // shipping would silently show a short subtotal.
1092
- const shippingNet =
1093
- typeof checkout.taxBreakdown?.shippingNet === 'number'
1094
- ? checkout.taxBreakdown.shippingNet
1095
- : parseFloat(checkout.shippingAmount) || 0;
1096
- const displayedSubtotal =
1097
- isInclusive && typeof checkout.taxBreakdown?.subtotal === 'number'
1098
- ? checkout.taxBreakdown.subtotal - shippingNet
1099
- : parseFloat(checkout.subtotal);
1100
- const subtotalLabel = isInclusive ? tc('subtotalExclTax') : tc('subtotal');
1079
+ // This deliberately drops an earlier attempt to show a NET
1080
+ // subtotal for inclusive stores. Two things were wrong with it.
1081
+ // It read `taxBreakdown.subtotal`, which is the net of every
1082
+ // TAXED LINE shipping included and then added
1083
+ // `shippingAmount` below, counting shipping twice: a real
1084
+ // checkout printed 54.06 + 9.99 + 7.93 beside a 61.99 total.
1085
+ // And a net subtotal cannot coexist with a tax row labelled
1086
+ // "included": either the shopper adds the tax, contradicting the
1087
+ // label, or they do not, and the column falls short of the total
1088
+ // by the whole VAT. Subtracting the shipping net back out fixes
1089
+ // the arithmetic and leaves the contradiction, so the row that
1090
+ // has to go is the special case itself.
1091
+ //
1092
+ // Gross + gross = total, with the VAT stated beneath it:
1093
+ // 52.00 + 9.99 = 61.99, "VAT 18% included 7.93".
1094
+ const displayedSubtotal = parseFloat(checkout.subtotal);
1095
+ const subtotalLabel = tc('subtotal');
1101
1096
  return (
1102
1097
  <div className="border-border space-y-2 border-t pt-4 text-sm">
1103
1098
  <div className="flex items-center justify-between">