create-brainerce-store 1.49.0 → 1.50.1
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 +1 -0
- package/messages/he.json +1 -0
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/layout.tsx.ejs +22 -0
- package/templates/nextjs/base/src/components/account/order-history.tsx +11 -2
- package/templates/nextjs/base/src/components/content/site-header.tsx.ejs +10 -0
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.
|
|
34
|
+
version: "1.50.1",
|
|
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
|
@@ -86,6 +86,17 @@ export default async function RootLayout({
|
|
|
86
86
|
.replace(/&/g, '\\u0026'),
|
|
87
87
|
}}
|
|
88
88
|
/>
|
|
89
|
+
{/* Brainerce cookieless traffic analytics — auto-tracks pageviews +
|
|
90
|
+
SPA route changes. Cookieless (no consent banner needed); the
|
|
91
|
+
merchant can toggle it per sales channel in the dashboard. */}
|
|
92
|
+
<script
|
|
93
|
+
defer
|
|
94
|
+
src={`${process.env.NEXT_PUBLIC_BRAINERCE_API_URL || 'https://api.brainerce.com'}/t.js`}
|
|
95
|
+
data-channel={
|
|
96
|
+
process.env.NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID || '<%= connectionId %>'
|
|
97
|
+
}
|
|
98
|
+
nonce={nonce}
|
|
99
|
+
/>
|
|
89
100
|
</head>
|
|
90
101
|
<body className={font.className}>
|
|
91
102
|
<StoreProvider locale={locale} initialStoreInfo={storeInfo}>
|
|
@@ -181,6 +192,17 @@ export default async function RootLayout({
|
|
|
181
192
|
.replace(/&/g, '\\u0026'),
|
|
182
193
|
}}
|
|
183
194
|
/>
|
|
195
|
+
{/* Brainerce cookieless traffic analytics — auto-tracks pageviews +
|
|
196
|
+
SPA route changes. Cookieless (no consent banner needed); the
|
|
197
|
+
merchant can toggle it per sales channel in the dashboard. */}
|
|
198
|
+
<script
|
|
199
|
+
defer
|
|
200
|
+
src={`${process.env.NEXT_PUBLIC_BRAINERCE_API_URL || 'https://api.brainerce.com'}/t.js`}
|
|
201
|
+
data-channel={
|
|
202
|
+
process.env.NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID || '<%= connectionId %>'
|
|
203
|
+
}
|
|
204
|
+
nonce={nonce}
|
|
205
|
+
/>
|
|
184
206
|
</head>
|
|
185
207
|
<body className={font.className}>
|
|
186
208
|
<StoreProvider initialStoreInfo={storeInfo}>
|
|
@@ -291,7 +291,16 @@ function OrderFinancialSummary({ order, currency }: { order: Order; currency: st
|
|
|
291
291
|
const ruleAmt = order.ruleDiscountAmount ? parseFloat(order.ruleDiscountAmount) : 0;
|
|
292
292
|
const couponAmt = order.couponDiscount ? parseFloat(order.couponDiscount) : 0;
|
|
293
293
|
const shipping = order.shippingAmount ? parseFloat(order.shippingAmount) : 0;
|
|
294
|
-
|
|
294
|
+
// Inclusive (VAT) orders persist taxAmount=0; the real VAT lives on the
|
|
295
|
+
// breakdown. Surface whichever is present (mirror of TaxDisplay).
|
|
296
|
+
const explicitTax = order.taxAmount ? parseFloat(order.taxAmount) : 0;
|
|
297
|
+
const taxIncluded = !!order.taxBreakdown?.pricesIncludeTax;
|
|
298
|
+
const tax =
|
|
299
|
+
explicitTax > 0
|
|
300
|
+
? explicitTax
|
|
301
|
+
: typeof order.taxBreakdown?.totalTax === 'number'
|
|
302
|
+
? order.taxBreakdown.totalTax
|
|
303
|
+
: 0;
|
|
295
304
|
const rules = order.appliedDiscounts;
|
|
296
305
|
|
|
297
306
|
const hasBreakdown = subtotal !== null && subtotal > 0;
|
|
@@ -352,7 +361,7 @@ function OrderFinancialSummary({ order, currency }: { order: Order; currency: st
|
|
|
352
361
|
|
|
353
362
|
{tax > 0 && (
|
|
354
363
|
<div className="flex items-center justify-between">
|
|
355
|
-
<span className="text-muted-foreground">{tc('tax')}</span>
|
|
364
|
+
<span className="text-muted-foreground">{taxIncluded ? tc('taxIncl') : tc('tax')}</span>
|
|
356
365
|
<span className="text-foreground">{formatPrice(tax, { currency }) as string}</span>
|
|
357
366
|
</div>
|
|
358
367
|
)}
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
import * as React from 'react';
|
|
19
19
|
import type { Content } from 'brainerce';
|
|
20
20
|
import { HeaderAccount } from './header-account';
|
|
21
|
+
<% if (i18nEnabled) { %>
|
|
22
|
+
import { LanguageSwitcher } from '@/components/layout/language-switcher';
|
|
23
|
+
<% } %>
|
|
21
24
|
|
|
22
25
|
interface SiteHeaderProps {
|
|
23
26
|
/** Pre-fetched header payload (server-side). `null` triggers static fallback. */
|
|
@@ -79,6 +82,9 @@ export function SiteHeader({ header, storeName }: SiteHeaderProps) {
|
|
|
79
82
|
{brandLabel}
|
|
80
83
|
</a>
|
|
81
84
|
<div className="flex items-center gap-2">
|
|
85
|
+
<% if (i18nEnabled) { %>
|
|
86
|
+
<LanguageSwitcher />
|
|
87
|
+
<% } %>
|
|
82
88
|
<HeaderAccount />
|
|
83
89
|
<a
|
|
84
90
|
href="/cart"
|
|
@@ -133,6 +139,10 @@ export function SiteHeader({ header, storeName }: SiteHeaderProps) {
|
|
|
133
139
|
</a>
|
|
134
140
|
) : null}
|
|
135
141
|
|
|
142
|
+
<% if (i18nEnabled) { %>
|
|
143
|
+
<LanguageSwitcher />
|
|
144
|
+
<% } %>
|
|
145
|
+
|
|
136
146
|
<HeaderAccount />
|
|
137
147
|
|
|
138
148
|
<a
|