create-brainerce-store 1.33.2 → 1.34.2
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 +2 -2
- package/package.json +1 -1
- package/templates/nextjs/base/.env.local.ejs +4 -1
- package/templates/nextjs/base/scripts/fetch-store-info.mjs +10 -4
- package/templates/nextjs/base/src/app/api/auth/me/route.ts +4 -1
- package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +4 -1
- package/templates/nextjs/base/src/app/contact/page.tsx +528 -528
- package/templates/nextjs/base/src/app/products/[slug]/product-client-section.tsx +66 -1
- package/templates/nextjs/base/src/components/cart/cart-bundle-offer.tsx +60 -195
- package/templates/nextjs/base/src/components/products/allergen-chips.tsx +78 -0
- package/templates/nextjs/base/src/components/products/modifier-group-selector.tsx +242 -0
- package/templates/nextjs/base/src/lib/auth.ts +6 -1
- package/templates/nextjs/base/src/lib/brainerce.ts.ejs +8 -3
- package/templates/nextjs/base/src/lib/safe-redirect.ts +38 -60
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.34.2",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
|
@@ -153,7 +153,7 @@ var ALLOWED_PACKAGE_MANAGERS = [
|
|
|
153
153
|
"bun"
|
|
154
154
|
];
|
|
155
155
|
var BRAINERCE_RUNTIME_DEPS = Object.freeze({
|
|
156
|
-
brainerce: "^1.
|
|
156
|
+
brainerce: "^1.23.0",
|
|
157
157
|
"isomorphic-dompurify": "^3.8.0"
|
|
158
158
|
});
|
|
159
159
|
|
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
# Brainerce
|
|
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.
|
|
2
5
|
NEXT_PUBLIC_BRAINERCE_CONNECTION_ID=<%= connectionId %>
|
|
3
6
|
|
|
4
7
|
# Store info (pre-fetched during setup to avoid flash on first load)
|
|
@@ -14,7 +14,7 @@ const envPath = join(process.cwd(), '.env.local');
|
|
|
14
14
|
|
|
15
15
|
if (!existsSync(envPath)) {
|
|
16
16
|
console.error(
|
|
17
|
-
'❌ .env.local not found. Create it first with
|
|
17
|
+
'❌ .env.local not found. Create it first with NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID set.'
|
|
18
18
|
);
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
@@ -34,18 +34,24 @@ function setVar(content, key, value) {
|
|
|
34
34
|
return content.trimEnd() + `\n${key}=${value}\n`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// Read either env var name. The new one is preferred; the old one is a soft
|
|
38
|
+
// alias kept for backwards compatibility — the SDK accepts both.
|
|
39
|
+
const connectionId =
|
|
40
|
+
getVar(envContent, 'NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID') ||
|
|
41
|
+
getVar(envContent, 'NEXT_PUBLIC_BRAINERCE_CONNECTION_ID');
|
|
38
42
|
const apiUrl = (getVar(envContent, 'BRAINERCE_API_URL') || 'https://api.brainerce.com').replace(
|
|
39
43
|
/\/$/,
|
|
40
44
|
''
|
|
41
45
|
);
|
|
42
46
|
|
|
43
47
|
if (!connectionId) {
|
|
44
|
-
console.error(
|
|
48
|
+
console.error(
|
|
49
|
+
'❌ NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID is not set in .env.local'
|
|
50
|
+
);
|
|
45
51
|
process.exit(1);
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
console.log(`Fetching store info for
|
|
54
|
+
console.log(`Fetching store info for sales channel: ${connectionId} ...`);
|
|
49
55
|
|
|
50
56
|
let storeInfo;
|
|
51
57
|
try {
|
|
@@ -6,7 +6,10 @@ const BACKEND_URL = (process.env.BRAINERCE_API_URL || 'https://api.brainerce.com
|
|
|
6
6
|
''
|
|
7
7
|
);
|
|
8
8
|
|
|
9
|
-
const CONNECTION_ID =
|
|
9
|
+
const CONNECTION_ID =
|
|
10
|
+
process.env.NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID ||
|
|
11
|
+
process.env.NEXT_PUBLIC_BRAINERCE_CONNECTION_ID ||
|
|
12
|
+
'';
|
|
10
13
|
|
|
11
14
|
const TOKEN_COOKIE = 'brainerce_customer_token';
|
|
12
15
|
const LOGGED_IN_COOKIE = 'brainerce_logged_in';
|
|
@@ -8,7 +8,10 @@ const BACKEND_URL = (process.env.BRAINERCE_API_URL || 'https://api.brainerce.com
|
|
|
8
8
|
''
|
|
9
9
|
);
|
|
10
10
|
|
|
11
|
-
const CONNECTION_ID =
|
|
11
|
+
const CONNECTION_ID =
|
|
12
|
+
process.env.NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID ||
|
|
13
|
+
process.env.NEXT_PUBLIC_BRAINERCE_CONNECTION_ID ||
|
|
14
|
+
'';
|
|
12
15
|
|
|
13
16
|
const RESET_TOKEN_COOKIE = 'brainerce_reset_token';
|
|
14
17
|
|