create-brainerce-store 1.75.0 → 1.77.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 +42 -8
- package/messages/en.json +14 -1
- package/messages/he.json +14 -1
- package/package.json +3 -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/checkout/page.tsx +1272 -1179
- 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/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/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.77.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"
|
|
@@ -48,7 +48,8 @@ var require_package = __commonJS({
|
|
|
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
|
-
|
|
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"
|
|
52
53
|
},
|
|
53
54
|
dependencies: {
|
|
54
55
|
chalk: "^4.1.2",
|
|
@@ -266,12 +267,45 @@ var BRAINERCE_RUNTIME_DEPS = Object.freeze({
|
|
|
266
267
|
// not compile against `checkout.tenders`.)
|
|
267
268
|
//
|
|
268
269
|
// 2.1.0 was published on 2026-09-03 and the tarball was checked for the
|
|
269
|
-
// methods the template calls, so this range is satisfiable.
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
|
|
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.4.0",
|
|
275
309
|
"isomorphic-dompurify": "^3.8.0"
|
|
276
310
|
});
|
|
277
311
|
|
package/messages/en.json
CHANGED
|
@@ -296,7 +296,12 @@
|
|
|
296
296
|
"customFieldsTimeNoneLeft": "Every time on this date has already passed. Please pick a later date.",
|
|
297
297
|
"customFieldsTimeTo": "to",
|
|
298
298
|
"changeOptions": "Change options",
|
|
299
|
-
"surcharges": "Additional charges"
|
|
299
|
+
"surcharges": "Additional charges",
|
|
300
|
+
"fullyCovered": "Your gift cards cover this order",
|
|
301
|
+
"fullyCoveredHint": "Nothing left to pay. Place the order to finish.",
|
|
302
|
+
"placeOrder": "Place order",
|
|
303
|
+
"placing": "Placing order...",
|
|
304
|
+
"placeFailed": "We could not place the order. Please try again."
|
|
300
305
|
},
|
|
301
306
|
"checkoutForm": {
|
|
302
307
|
"email": "Email",
|
|
@@ -348,6 +353,7 @@
|
|
|
348
353
|
"joinSubtitle": "Join us to start shopping",
|
|
349
354
|
"creatingAccount": "Creating account...",
|
|
350
355
|
"createAccount": "Create Account",
|
|
356
|
+
"referralApplied": "Your friend's invitation is applied. Your welcome gift lands with this account.",
|
|
351
357
|
"alreadyHaveAccount": "Already have an account?",
|
|
352
358
|
"email": "Email",
|
|
353
359
|
"emailPlaceholder": "you@example.com",
|
|
@@ -565,8 +571,15 @@
|
|
|
565
571
|
},
|
|
566
572
|
"loyalty": {
|
|
567
573
|
"title": "Rewards",
|
|
574
|
+
"widgetTitle": "Your rewards",
|
|
575
|
+
"referralGreeting": "{name} sent you a gift",
|
|
576
|
+
"referralGreetingAnonymous": "A friend sent you a gift",
|
|
577
|
+
"referralReward": "Your welcome gift: {reward}",
|
|
578
|
+
"referralCta": "Create your account to claim it",
|
|
568
579
|
"pointsFallback": "points",
|
|
569
580
|
"readyToSpend": "Ready to spend. Points from a recent order become available after they clear.",
|
|
581
|
+
"pending": "{points} {pointsName} from a recent order are still clearing.",
|
|
582
|
+
"pendingWithDate": "{points} {pointsName} from a recent order become available on {date}.",
|
|
570
583
|
"earningPaused": "The rewards programme is paused, so orders are not earning right now. Points you already have can still be spent.",
|
|
571
584
|
"toNextTierPoints": "{amount} {pointsName} to {tier}",
|
|
572
585
|
"toNextTierSpend": "{amount} more spent to reach {tier}",
|
package/messages/he.json
CHANGED
|
@@ -296,7 +296,12 @@
|
|
|
296
296
|
"customFieldsTimeNoneLeft": "כל השעות בתאריך הזה כבר עברו. בחרו תאריך מאוחר יותר.",
|
|
297
297
|
"customFieldsTimeTo": "עד",
|
|
298
298
|
"changeOptions": "שנה אפשרויות",
|
|
299
|
-
"surcharges": "תוספות"
|
|
299
|
+
"surcharges": "תוספות",
|
|
300
|
+
"fullyCovered": "כרטיסי המתנה מכסים את ההזמנה",
|
|
301
|
+
"fullyCoveredHint": "לא נותר מה לשלם. השלימו את ההזמנה כדי לסיים.",
|
|
302
|
+
"placeOrder": "השלמת ההזמנה",
|
|
303
|
+
"placing": "משלים...",
|
|
304
|
+
"placeFailed": "לא הצלחנו להשלים את ההזמנה. נסו שוב."
|
|
300
305
|
},
|
|
301
306
|
"checkoutForm": {
|
|
302
307
|
"email": "אימייל",
|
|
@@ -348,6 +353,7 @@
|
|
|
348
353
|
"joinSubtitle": "הצטרפו אלינו והתחילו לקנות",
|
|
349
354
|
"creatingAccount": "יוצר חשבון...",
|
|
350
355
|
"createAccount": "צור חשבון",
|
|
356
|
+
"referralApplied": "ההזמנה מהחבר שלכם נקלטה. מתנת ההצטרפות תחכה לכם בחשבון הזה.",
|
|
351
357
|
"alreadyHaveAccount": "כבר יש לכם חשבון?",
|
|
352
358
|
"email": "אימייל",
|
|
353
359
|
"emailPlaceholder": "you@example.com",
|
|
@@ -565,8 +571,15 @@
|
|
|
565
571
|
},
|
|
566
572
|
"loyalty": {
|
|
567
573
|
"title": "מועדון הטבות",
|
|
574
|
+
"widgetTitle": "ההטבות שלך",
|
|
575
|
+
"referralGreeting": "{name} שלח/ה לכם מתנה",
|
|
576
|
+
"referralGreetingAnonymous": "חבר שלח לכם מתנה",
|
|
577
|
+
"referralReward": "מתנת ההצטרפות שלכם: {reward}",
|
|
578
|
+
"referralCta": "פתחו חשבון כדי לממש",
|
|
568
579
|
"pointsFallback": "נקודות",
|
|
569
580
|
"readyToSpend": "זמינות למימוש. נקודות מהזמנה אחרונה יהפכו לזמינות לאחר תקופת המתנה.",
|
|
581
|
+
"pending": "{points} {pointsName} מהזמנה אחרונה עדיין בתקופת המתנה.",
|
|
582
|
+
"pendingWithDate": "{points} {pointsName} מהזמנה אחרונה יהפכו לזמינות ב-{date}.",
|
|
570
583
|
"earningPaused": "תוכנית ההטבות מושהית, ולכן הזמנות לא צוברות נקודות כרגע. את הנקודות שכבר צברת ניתן לממש.",
|
|
571
584
|
"toNextTierPoints": "{amount} {pointsName} עד {tier}",
|
|
572
585
|
"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.77.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"
|
|
@@ -17,7 +17,8 @@
|
|
|
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
|
-
"
|
|
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"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
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=
|