create-brainerce-store 1.74.0 → 1.76.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 +44 -7
- package/messages/en.json +10 -1
- package/messages/he.json +10 -1
- package/package.json +4 -2
- package/templates/nextjs/base/.env.local.ejs +62 -52
- package/templates/nextjs/base/AGENTS.md.ejs +189 -161
- package/templates/nextjs/base/CLAUDE.md.ejs +200 -172
- package/templates/nextjs/base/src/app/order-confirmation/page.tsx +37 -0
- package/templates/nextjs/base/src/app/page.tsx +75 -65
- package/templates/nextjs/base/src/app/register/page.tsx +74 -67
- package/templates/nextjs/base/src/components/account/loyalty-panel.tsx +79 -7
- package/templates/nextjs/base/src/components/account/order-history.tsx +34 -0
- package/templates/nextjs/base/src/components/auth/register-form.tsx +358 -326
- package/templates/nextjs/base/src/components/referral/referral-greeting.tsx +120 -0
- package/templates/nextjs/base/src/core/lib/auth.ts +162 -155
- package/templates/nextjs/base/src/core/lib/referral.ts +95 -0
- package/templates/nextjs/base/src/ui/product/product-card.tsx +5 -0
- package/templates/nextjs/designs/atelier/ui/product/product-card.tsx +5 -0
- package/templates/nextjs/ui-canvas/layout/header-search.tsx +222 -0
- package/templates/nextjs/ui-canvas/layout/site-header.tsx.ejs +6 -0
- package/templates/nextjs/ui-canvas/product/product-card.tsx +5 -0
- package/templates/nextjs/ui-canvas/product/product-client-section.tsx +382 -375
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.76.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"
|
|
@@ -47,7 +47,9 @@ var require_package = __commonJS({
|
|
|
47
47
|
dev: "tsup --watch",
|
|
48
48
|
clean: "rimraf dist",
|
|
49
49
|
release: "pnpm build && node ../../scripts/publish-workspace-package.js .",
|
|
50
|
-
|
|
50
|
+
"check:template-parity": "node scripts/check-template-parity.js",
|
|
51
|
+
"check:sdk-published": "node scripts/check-sdk-published.js",
|
|
52
|
+
prepublishOnly: "node scripts/check-template-parity.js && node scripts/check-sdk-published.js && node ../../scripts/check-publishable.js ./package.json"
|
|
51
53
|
},
|
|
52
54
|
dependencies: {
|
|
53
55
|
chalk: "^4.1.2",
|
|
@@ -264,11 +266,46 @@ var BRAINERCE_RUNTIME_DEPS = Object.freeze({
|
|
|
264
266
|
// top level instead of per card. Typing the prop as `CheckoutTender[]` does
|
|
265
267
|
// not compile against `checkout.tenders`.)
|
|
266
268
|
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
// 2.
|
|
271
|
-
|
|
269
|
+
// 2.1.0 was published on 2026-09-03 and the tarball was checked for the
|
|
270
|
+
// methods the template calls, so this range is satisfiable.
|
|
271
|
+
//
|
|
272
|
+
// 2.2.0 completes the gift-card surface. `Order.tenders` records how an order
|
|
273
|
+
// was actually paid, so an order that a gift card covered in part no longer
|
|
274
|
+
// reads as underpaid in the scaffolded order history and confirmation page,
|
|
275
|
+
// and the admin gift-card methods (issue/list/adjust/reissue) round out the
|
|
276
|
+
// v1 API. Nothing under `src/ui/` calls the admin half and nothing should:
|
|
277
|
+
// issuing mints stored value and needs an admin key, which a storefront must
|
|
278
|
+
// never hold. The floor moved to ^2.2.0 for the `tenders` field alone.
|
|
279
|
+
//
|
|
280
|
+
// ⛔ THE RELEASE ORDER RULE WAS BROKEN AT THIS BUMP. Do not cite 2.2.0 as
|
|
281
|
+
// precedent that the rule holds. The registry timestamps say the opposite:
|
|
282
|
+
//
|
|
283
|
+
// create-brainerce-store@1.75.0 2026-09-05T17:52:59.904Z
|
|
284
|
+
// brainerce@2.2.0 2026-09-05T17:53:37.083Z (38s later)
|
|
285
|
+
//
|
|
286
|
+
// For 38 seconds `npx create-brainerce-store` produced a project whose
|
|
287
|
+
// install died on an unsatisfiable ^2.2.0. It self-healed, which is exactly
|
|
288
|
+
// why it went unnoticed. The rule is no longer enforced by this comment:
|
|
289
|
+
// `create-brainerce-store/scripts/check-sdk-published.js` reads this floor,
|
|
290
|
+
// asks the npm registry directly whether that exact version exists, and fails
|
|
291
|
+
// `prepublishOnly` when it does not. Run it yourself with
|
|
292
|
+
// `pnpm --filter create-brainerce-store check:sdk-published`.
|
|
293
|
+
//
|
|
294
|
+
// ⛔ Do not verify a release with `npm view`. In this environment it serves a
|
|
295
|
+
// stale cache and has reported live packages as unpublished.
|
|
296
|
+
//
|
|
297
|
+
// 2.3.0 takes the customer auth token out of every `localStorage` example in
|
|
298
|
+
// the published README, which is the copy an agent building against this
|
|
299
|
+
// starter reads. It also turns thirteen methods that returned 404 into a
|
|
300
|
+
// throw that names the alternative, and adds `Idempotency-Key` to the
|
|
301
|
+
// gift-card writes. It also adds `pendingPoints`, `pendingPointsConfirmAt`
|
|
302
|
+
// and `program.pendingDays` to `LoyaltyStatus` — and THAT the templates do
|
|
303
|
+
// need: the scaffolded rewards panel reads all three to tell a shopper who
|
|
304
|
+
// just ordered that their points are on the way instead of showing them a
|
|
305
|
+
// bare 0, so an older SDK fails type-check at scaffold time. This floor is
|
|
306
|
+
// load-bearing now; it is no longer only about provably getting the
|
|
307
|
+
// corrected README.
|
|
308
|
+
brainerce: "^2.3.0",
|
|
272
309
|
"isomorphic-dompurify": "^3.8.0"
|
|
273
310
|
});
|
|
274
311
|
|
package/messages/en.json
CHANGED
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"monthNovember": "November",
|
|
63
63
|
"monthDecember": "December",
|
|
64
64
|
"giftCard": "Gift card",
|
|
65
|
-
"amountDue": "Amount due"
|
|
65
|
+
"amountDue": "Amount due",
|
|
66
|
+
"amountCharged": "Amount charged"
|
|
66
67
|
},
|
|
67
68
|
"nav": {
|
|
68
69
|
"products": "Products",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"joinSubtitle": "Join us to start shopping",
|
|
348
349
|
"creatingAccount": "Creating account...",
|
|
349
350
|
"createAccount": "Create Account",
|
|
351
|
+
"referralApplied": "Your friend's invitation is applied. Your welcome gift lands with this account.",
|
|
350
352
|
"alreadyHaveAccount": "Already have an account?",
|
|
351
353
|
"email": "Email",
|
|
352
354
|
"emailPlaceholder": "you@example.com",
|
|
@@ -564,8 +566,15 @@
|
|
|
564
566
|
},
|
|
565
567
|
"loyalty": {
|
|
566
568
|
"title": "Rewards",
|
|
569
|
+
"widgetTitle": "Your rewards",
|
|
570
|
+
"referralGreeting": "{name} sent you a gift",
|
|
571
|
+
"referralGreetingAnonymous": "A friend sent you a gift",
|
|
572
|
+
"referralReward": "Your welcome gift: {reward}",
|
|
573
|
+
"referralCta": "Create your account to claim it",
|
|
567
574
|
"pointsFallback": "points",
|
|
568
575
|
"readyToSpend": "Ready to spend. Points from a recent order become available after they clear.",
|
|
576
|
+
"pending": "{points} {pointsName} from a recent order are still clearing.",
|
|
577
|
+
"pendingWithDate": "{points} {pointsName} from a recent order become available on {date}.",
|
|
569
578
|
"earningPaused": "The rewards programme is paused, so orders are not earning right now. Points you already have can still be spent.",
|
|
570
579
|
"toNextTierPoints": "{amount} {pointsName} to {tier}",
|
|
571
580
|
"toNextTierSpend": "{amount} more spent to reach {tier}",
|
package/messages/he.json
CHANGED
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"monthNovember": "נובמבר",
|
|
63
63
|
"monthDecember": "דצמבר",
|
|
64
64
|
"giftCard": "כרטיס מתנה",
|
|
65
|
-
"amountDue": "לתשלום"
|
|
65
|
+
"amountDue": "לתשלום",
|
|
66
|
+
"amountCharged": "חויב בפועל"
|
|
66
67
|
},
|
|
67
68
|
"nav": {
|
|
68
69
|
"products": "מוצרים",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"joinSubtitle": "הצטרפו אלינו והתחילו לקנות",
|
|
348
349
|
"creatingAccount": "יוצר חשבון...",
|
|
349
350
|
"createAccount": "צור חשבון",
|
|
351
|
+
"referralApplied": "ההזמנה מהחבר שלכם נקלטה. מתנת ההצטרפות תחכה לכם בחשבון הזה.",
|
|
350
352
|
"alreadyHaveAccount": "כבר יש לכם חשבון?",
|
|
351
353
|
"email": "אימייל",
|
|
352
354
|
"emailPlaceholder": "you@example.com",
|
|
@@ -564,8 +566,15 @@
|
|
|
564
566
|
},
|
|
565
567
|
"loyalty": {
|
|
566
568
|
"title": "מועדון הטבות",
|
|
569
|
+
"widgetTitle": "ההטבות שלך",
|
|
570
|
+
"referralGreeting": "{name} שלח/ה לכם מתנה",
|
|
571
|
+
"referralGreetingAnonymous": "חבר שלח לכם מתנה",
|
|
572
|
+
"referralReward": "מתנת ההצטרפות שלכם: {reward}",
|
|
573
|
+
"referralCta": "פתחו חשבון כדי לממש",
|
|
567
574
|
"pointsFallback": "נקודות",
|
|
568
575
|
"readyToSpend": "זמינות למימוש. נקודות מהזמנה אחרונה יהפכו לזמינות לאחר תקופת המתנה.",
|
|
576
|
+
"pending": "{points} {pointsName} מהזמנה אחרונה עדיין בתקופת המתנה.",
|
|
577
|
+
"pendingWithDate": "{points} {pointsName} מהזמנה אחרונה יהפכו לזמינות ב-{date}.",
|
|
569
578
|
"earningPaused": "תוכנית ההטבות מושהית, ולכן הזמנות לא צוברות נקודות כרגע. את הנקודות שכבר צברת ניתן לממש.",
|
|
570
579
|
"toNextTierPoints": "{amount} {pointsName} עד {tier}",
|
|
571
580
|
"toNextTierSpend": "עוד {amount} בקניות כדי להגיע ל-{tier}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-brainerce-store",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.76.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"
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"dev": "tsup --watch",
|
|
17
17
|
"clean": "rimraf dist",
|
|
18
18
|
"release": "pnpm build && node ../../scripts/publish-workspace-package.js .",
|
|
19
|
-
"
|
|
19
|
+
"check:template-parity": "node scripts/check-template-parity.js",
|
|
20
|
+
"check:sdk-published": "node scripts/check-sdk-published.js",
|
|
21
|
+
"prepublishOnly": "node scripts/check-template-parity.js && node scripts/check-sdk-published.js && node ../../scripts/check-publishable.js ./package.json"
|
|
20
22
|
},
|
|
21
23
|
"dependencies": {
|
|
22
24
|
"chalk": "^4.1.2",
|
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
# Brainerce Sales Channel — preferred env var name.
|
|
2
|
-
NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID=<%= connectionId %>
|
|
3
|
-
# Legacy alias kept for backwards compatibility — both are accepted by the SDK.
|
|
4
|
-
# @deprecated will be removed when SDK 2.0 ships.
|
|
5
|
-
NEXT_PUBLIC_BRAINERCE_CONNECTION_ID=<%= connectionId %>
|
|
6
|
-
|
|
7
|
-
# Store info (pre-fetched during setup to avoid flash on first load)
|
|
8
|
-
NEXT_PUBLIC_STORE_NAME=<%- storeNameEnv %>
|
|
9
|
-
NEXT_PUBLIC_STORE_CURRENCY=<%- currencyEnv %>
|
|
10
|
-
|
|
11
|
-
# Backend API URL (server-side only — used by BFF proxy and SSR, never exposed to browser)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
1
|
+
# Brainerce Sales Channel — preferred env var name.
|
|
2
|
+
NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID=<%= connectionId %>
|
|
3
|
+
# Legacy alias kept for backwards compatibility — both are accepted by the SDK.
|
|
4
|
+
# @deprecated will be removed when SDK 2.0 ships.
|
|
5
|
+
NEXT_PUBLIC_BRAINERCE_CONNECTION_ID=<%= connectionId %>
|
|
6
|
+
|
|
7
|
+
# Store info (pre-fetched during setup to avoid flash on first load)
|
|
8
|
+
NEXT_PUBLIC_STORE_NAME=<%- storeNameEnv %>
|
|
9
|
+
NEXT_PUBLIC_STORE_CURRENCY=<%- currencyEnv %>
|
|
10
|
+
|
|
11
|
+
# Backend API URL (server-side only — used by BFF proxy and SSR, never exposed to browser)
|
|
12
|
+
#
|
|
13
|
+
# ⛔ There is no API key here, and there must never be one. This storefront runs
|
|
14
|
+
# entirely on the PUBLIC sales channel credentials above. An admin key
|
|
15
|
+
# (brainerce_*) in a browser-reachable app is readable by anyone who opens
|
|
16
|
+
# devtools, and it is full write access to the live store. In particular, never
|
|
17
|
+
# give this project the `gift_cards:issue` scope: it mints stored value.
|
|
18
|
+
# Redeeming a card from the storefront needs no key at all (applyGiftCard /
|
|
19
|
+
# removeGiftCard / checkGiftCardBalance); issuing one is a dashboard action, or
|
|
20
|
+
# server-side on infrastructure the merchant controls.
|
|
21
|
+
BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
22
|
+
|
|
23
|
+
# Public API origin for the AI chat widget (public, unauthenticated endpoints only).
|
|
24
|
+
# The widget streams chat directly from the browser, so this one IS public.
|
|
25
|
+
NEXT_PUBLIC_BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
26
|
+
|
|
27
|
+
# Public site URL — canonical tags, sitemap.xml, robots.txt, JSON-LD, and the
|
|
28
|
+
# Origin header the Brainerce backend checks against your sales channel's
|
|
29
|
+
# configured domain.
|
|
30
|
+
#
|
|
31
|
+
# Intentionally unset. Nothing at setup time knows where this store will be
|
|
32
|
+
# served from, so the storefront resolves its own origin at runtime: hosting
|
|
33
|
+
# platform variables first (Vercel / Netlify / Render / Railway / Cloudflare
|
|
34
|
+
# Pages), then the incoming request's forwarded host. It is correct in local
|
|
35
|
+
# development and on any host, with nothing set here.
|
|
36
|
+
#
|
|
37
|
+
# ⛔ Do not write a placeholder address into this variable. A wrong absolute
|
|
38
|
+
# URL is indistinguishable from a right one to a search crawler, so a guess
|
|
39
|
+
# here is worse than leaving it empty. Either set your real domain or nothing.
|
|
40
|
+
#
|
|
41
|
+
# Once you have that domain, set it — an explicit value is the only source a
|
|
42
|
+
# request header cannot forge, and it keeps canonical URLs stable across
|
|
43
|
+
# preview deployments:
|
|
44
|
+
#
|
|
45
|
+
# SITE_URL=https://shop.example.com
|
|
46
|
+
#
|
|
47
|
+
# Set it in your hosting provider's environment variables, not in this file:
|
|
48
|
+
# .env.local is gitignored and never travels with a deploy.
|
|
49
|
+
# `NEXT_PUBLIC_SITE_URL` is still read as a backwards-compatible alias.
|
|
50
|
+
#
|
|
51
|
+
# On some hosts SITE_URL is NOT optional. Platforms whose proxy forwards
|
|
52
|
+
# requests to the app as `Host: localhost:<port>` (OpenAI Sites /
|
|
53
|
+
# *.chatgpt.site, among others) hide the real hostname from the server, so
|
|
54
|
+
# nothing can be resolved from the request. Set SITE_URL there, or server-side
|
|
55
|
+
# API calls send `Origin: http://localhost:3000` and a sales channel with a
|
|
56
|
+
# configured Domain rejects them with 403.
|
|
57
|
+
|
|
58
|
+
# Optional: floating WhatsApp contact button. Nothing shipped reads this today,
|
|
59
|
+
# including the `atelier` design. It is a naming convention for a button you
|
|
60
|
+
# build. Digits only, international format without "+"
|
|
61
|
+
# (e.g. 14155550123). Leave unset to hide the button.
|
|
62
|
+
# NEXT_PUBLIC_WHATSAPP_PHONE=
|