@zevcommerce/theme-starter 1.0.0 → 1.0.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.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1468 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1431 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/tsup.config.ts +1 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1431 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { defineTheme } from "@zevcommerce/theme-sdk";
|
|
3
|
+
|
|
4
|
+
// src/settings.ts
|
|
5
|
+
import { defineSettings } from "@zevcommerce/theme-sdk";
|
|
6
|
+
var settingsSchema = defineSettings([
|
|
7
|
+
// ============================================================
|
|
8
|
+
// BRAND
|
|
9
|
+
// ============================================================
|
|
10
|
+
{
|
|
11
|
+
name: "Brand",
|
|
12
|
+
icon: "palette",
|
|
13
|
+
settings: [
|
|
14
|
+
{ type: "color", id: "brand.primary", label: "Primary Color", default: "#2563EB" },
|
|
15
|
+
{ type: "color", id: "brand.background", label: "Background Color", default: "#ffffff" },
|
|
16
|
+
{ type: "color", id: "brand.text", label: "Text Color", default: "#374151" },
|
|
17
|
+
{ type: "color", id: "brand.accent", label: "Accent Color", default: "#F59E0B" },
|
|
18
|
+
{
|
|
19
|
+
type: "select",
|
|
20
|
+
id: "brand.font",
|
|
21
|
+
label: "Body Font",
|
|
22
|
+
default: "Inter",
|
|
23
|
+
options: [
|
|
24
|
+
{ value: "Inter", label: "Inter" },
|
|
25
|
+
{ value: "Roboto", label: "Roboto" },
|
|
26
|
+
{ value: "Open Sans", label: "Open Sans" },
|
|
27
|
+
{ value: "Poppins", label: "Poppins" },
|
|
28
|
+
{ value: "Lato", label: "Lato" }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
// ============================================================
|
|
34
|
+
// HEADER
|
|
35
|
+
// ============================================================
|
|
36
|
+
{
|
|
37
|
+
name: "Header",
|
|
38
|
+
icon: "layout",
|
|
39
|
+
settings: [
|
|
40
|
+
{ type: "image", id: "header.logo", label: "Logo Image" },
|
|
41
|
+
{ type: "range", id: "header.logoHeight", label: "Logo Height (px)", min: 20, max: 80, step: 4, default: 36 },
|
|
42
|
+
{ type: "checkbox", id: "header.sticky", label: "Sticky Header", default: true },
|
|
43
|
+
{ type: "checkbox", id: "header.showSearch", label: "Show Search Icon", default: true },
|
|
44
|
+
{ type: "text", id: "header.menuHandle", label: "Menu Handle", default: "main-menu" }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
// ============================================================
|
|
48
|
+
// HERO BANNER
|
|
49
|
+
// ============================================================
|
|
50
|
+
{
|
|
51
|
+
name: "Hero Banner",
|
|
52
|
+
icon: "image",
|
|
53
|
+
settings: [
|
|
54
|
+
{ type: "checkbox", id: "hero.enabled", label: "Show Hero", default: true },
|
|
55
|
+
{ type: "image", id: "hero.backgroundImage", label: "Background Image" },
|
|
56
|
+
{ type: "text", id: "hero.heading", label: "Heading", default: "Welcome to our store" },
|
|
57
|
+
{ type: "textarea", id: "hero.subheading", label: "Subheading", default: "Discover amazing products at great prices." },
|
|
58
|
+
{ type: "text", id: "hero.buttonText", label: "Button Text", default: "Shop Now" },
|
|
59
|
+
{ type: "text", id: "hero.buttonLink", label: "Button Link", default: "/collections/all" },
|
|
60
|
+
{ type: "range", id: "hero.overlayOpacity", label: "Overlay Opacity", min: 0, max: 100, step: 5, default: 50 },
|
|
61
|
+
{ type: "color", id: "hero.overlayColor", label: "Overlay Color", default: "#000000" },
|
|
62
|
+
{ type: "color", id: "hero.textColor", label: "Text Color", default: "#ffffff" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
// ============================================================
|
|
66
|
+
// PRODUCTS
|
|
67
|
+
// ============================================================
|
|
68
|
+
{
|
|
69
|
+
name: "Products",
|
|
70
|
+
icon: "shopping-bag",
|
|
71
|
+
settings: [
|
|
72
|
+
{ type: "checkbox", id: "products.enabled", label: "Show Featured Products", default: true },
|
|
73
|
+
{ type: "text", id: "products.heading", label: "Section Heading", default: "Featured Products" },
|
|
74
|
+
{ type: "collection_picker", id: "products.collection", label: "Collection", default: "all" },
|
|
75
|
+
{ type: "range", id: "products.limit", label: "Number of Products", min: 4, max: 24, step: 4, default: 8 },
|
|
76
|
+
{
|
|
77
|
+
type: "select",
|
|
78
|
+
id: "products.columns",
|
|
79
|
+
label: "Grid Columns (Desktop)",
|
|
80
|
+
default: "4",
|
|
81
|
+
options: [
|
|
82
|
+
{ value: "2", label: "2 Columns" },
|
|
83
|
+
{ value: "3", label: "3 Columns" },
|
|
84
|
+
{ value: "4", label: "4 Columns" }
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
// ============================================================
|
|
90
|
+
// CONTACT
|
|
91
|
+
// ============================================================
|
|
92
|
+
{
|
|
93
|
+
name: "Contact",
|
|
94
|
+
icon: "phone",
|
|
95
|
+
settings: [
|
|
96
|
+
{ type: "checkbox", id: "contact.enabled", label: "Show Contact Section", default: false },
|
|
97
|
+
{ type: "text", id: "contact.heading", label: "Section Heading", default: "Get in Touch" },
|
|
98
|
+
{ type: "checkbox", id: "contact.showPhone", label: "Show Phone", default: true },
|
|
99
|
+
{ type: "text", id: "contact.phone", label: "Phone Number", default: "" },
|
|
100
|
+
{ type: "checkbox", id: "contact.showEmail", label: "Show Email", default: true },
|
|
101
|
+
{ type: "text", id: "contact.email", label: "Email Address", default: "" },
|
|
102
|
+
{ type: "checkbox", id: "contact.showWhatsApp", label: "Show WhatsApp", default: false },
|
|
103
|
+
{ type: "text", id: "contact.whatsapp", label: "WhatsApp Number", default: "" },
|
|
104
|
+
{ type: "checkbox", id: "contact.showAddress", label: "Show Address", default: false },
|
|
105
|
+
{ type: "textarea", id: "contact.address", label: "Address", default: "" }
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
// ============================================================
|
|
109
|
+
// FOOTER
|
|
110
|
+
// ============================================================
|
|
111
|
+
{
|
|
112
|
+
name: "Footer",
|
|
113
|
+
icon: "align-bottom",
|
|
114
|
+
settings: [
|
|
115
|
+
{ type: "textarea", id: "footer.description", label: "Store Description", default: "" },
|
|
116
|
+
{ type: "text", id: "footer.menuHandle", label: "Footer Menu Handle", default: "footer" },
|
|
117
|
+
{ type: "text", id: "footer.copyright", label: "Copyright Text", default: "" },
|
|
118
|
+
{ type: "text", id: "footer.instagram", label: "Instagram URL", default: "" },
|
|
119
|
+
{ type: "text", id: "footer.facebook", label: "Facebook URL", default: "" },
|
|
120
|
+
{ type: "text", id: "footer.twitter", label: "Twitter / X URL", default: "" },
|
|
121
|
+
{ type: "text", id: "footer.tiktok", label: "TikTok URL", default: "" }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
// ============================================================
|
|
125
|
+
// ANNOUNCEMENT
|
|
126
|
+
// ============================================================
|
|
127
|
+
{
|
|
128
|
+
name: "Announcement",
|
|
129
|
+
icon: "megaphone",
|
|
130
|
+
settings: [
|
|
131
|
+
{ type: "checkbox", id: "announcement.enabled", label: "Show Announcement Bar", default: false },
|
|
132
|
+
{ type: "text", id: "announcement.text", label: "Announcement Text", default: "Free shipping on orders over $50!" },
|
|
133
|
+
{ type: "color", id: "announcement.backgroundColor", label: "Background Color", default: "#2563EB" },
|
|
134
|
+
{ type: "color", id: "announcement.textColor", label: "Text Color", default: "#ffffff" }
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
]);
|
|
138
|
+
|
|
139
|
+
// src/sections/Header.tsx
|
|
140
|
+
import { useState, useEffect, useRef } from "react";
|
|
141
|
+
import Link from "next/link";
|
|
142
|
+
import { useTheme, useCartStore, resolveMenuUrl, getStorePermalink, getProducts } from "@zevcommerce/storefront-api";
|
|
143
|
+
import { useRouter, useParams } from "next/navigation";
|
|
144
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
145
|
+
function Header() {
|
|
146
|
+
const { theme: theme2, storeConfig, menus } = useTheme();
|
|
147
|
+
const { openCart, items } = useCartStore();
|
|
148
|
+
const router = useRouter();
|
|
149
|
+
const params = useParams();
|
|
150
|
+
const header = theme2?.settings?.header;
|
|
151
|
+
const logoSrc = header?.logo || storeConfig?.storeLogo;
|
|
152
|
+
const logoHeight = header?.logoHeight || 36;
|
|
153
|
+
const sticky = header?.sticky !== false;
|
|
154
|
+
const showSearch = header?.showSearch !== false;
|
|
155
|
+
const menuHandle = header?.menuHandle || "main-menu";
|
|
156
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
157
|
+
const storeName = storeConfig?.name || "Store";
|
|
158
|
+
const availableMenus = Object.values(menus || {});
|
|
159
|
+
const defaultMenu = availableMenus.find((m) => m.isDefault);
|
|
160
|
+
const activeMenu = menuHandle && menus?.[menuHandle] || defaultMenu || availableMenus[0];
|
|
161
|
+
const menuItems = activeMenu?.items || [];
|
|
162
|
+
const [mobileOpen, setMobileOpen] = useState(false);
|
|
163
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
164
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
165
|
+
const [suggestions, setSuggestions] = useState([]);
|
|
166
|
+
const searchRef = useRef(null);
|
|
167
|
+
const cartCount = items.reduce((sum, item) => sum + item.quantity, 0);
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
document.body.style.overflow = mobileOpen || searchOpen ? "hidden" : "";
|
|
170
|
+
return () => {
|
|
171
|
+
document.body.style.overflow = "";
|
|
172
|
+
};
|
|
173
|
+
}, [mobileOpen, searchOpen]);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (searchOpen) searchRef.current?.focus();
|
|
176
|
+
}, [searchOpen]);
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
const handler = (e) => {
|
|
179
|
+
if (e.key === "Escape") {
|
|
180
|
+
setSearchOpen(false);
|
|
181
|
+
setMobileOpen(false);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
window.addEventListener("keydown", handler);
|
|
185
|
+
return () => window.removeEventListener("keydown", handler);
|
|
186
|
+
}, []);
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
const timer = setTimeout(async () => {
|
|
189
|
+
if (searchQuery.length > 2) {
|
|
190
|
+
try {
|
|
191
|
+
const { data } = await getProducts(domain, 1, 5, searchQuery);
|
|
192
|
+
setSuggestions(data);
|
|
193
|
+
} catch {
|
|
194
|
+
setSuggestions([]);
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
setSuggestions([]);
|
|
198
|
+
}
|
|
199
|
+
}, 300);
|
|
200
|
+
return () => clearTimeout(timer);
|
|
201
|
+
}, [searchQuery, domain]);
|
|
202
|
+
const handleSearch = (e) => {
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
if (!searchQuery.trim()) return;
|
|
205
|
+
router.push(getStorePermalink(domain, `/search?q=${encodeURIComponent(searchQuery)}`));
|
|
206
|
+
setSearchOpen(false);
|
|
207
|
+
setSearchQuery("");
|
|
208
|
+
setSuggestions([]);
|
|
209
|
+
};
|
|
210
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
"header",
|
|
213
|
+
{
|
|
214
|
+
style: {
|
|
215
|
+
backgroundColor: "var(--color-background)",
|
|
216
|
+
borderBottom: "1px solid #e5e7eb",
|
|
217
|
+
position: sticky ? "sticky" : "relative",
|
|
218
|
+
top: 0,
|
|
219
|
+
zIndex: 50
|
|
220
|
+
},
|
|
221
|
+
children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 sm:px-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-16", children: [
|
|
222
|
+
/* @__PURE__ */ jsx(Link, { href: getStorePermalink(domain, "/"), className: "flex-shrink-0", children: logoSrc ? /* @__PURE__ */ jsx(
|
|
223
|
+
"img",
|
|
224
|
+
{
|
|
225
|
+
src: logoSrc,
|
|
226
|
+
alt: storeName,
|
|
227
|
+
style: { height: `${logoHeight}px`, width: "auto", objectFit: "contain" }
|
|
228
|
+
}
|
|
229
|
+
) : /* @__PURE__ */ jsx(
|
|
230
|
+
"span",
|
|
231
|
+
{
|
|
232
|
+
className: "text-xl font-bold",
|
|
233
|
+
style: { color: "var(--color-text)" },
|
|
234
|
+
children: storeName
|
|
235
|
+
}
|
|
236
|
+
) }),
|
|
237
|
+
/* @__PURE__ */ jsx("nav", { className: "hidden md:flex items-center gap-6", children: menuItems.map((item) => /* @__PURE__ */ jsx(
|
|
238
|
+
Link,
|
|
239
|
+
{
|
|
240
|
+
href: resolveMenuUrl(item, domain),
|
|
241
|
+
className: "text-sm font-medium transition-colors hover:opacity-70",
|
|
242
|
+
style: { color: "var(--color-text)" },
|
|
243
|
+
children: item.title
|
|
244
|
+
},
|
|
245
|
+
item.id
|
|
246
|
+
)) }),
|
|
247
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
248
|
+
showSearch && /* @__PURE__ */ jsx(
|
|
249
|
+
"button",
|
|
250
|
+
{
|
|
251
|
+
onClick: () => setSearchOpen(true),
|
|
252
|
+
"aria-label": "Search",
|
|
253
|
+
className: "p-2 transition-opacity hover:opacity-70",
|
|
254
|
+
style: { color: "var(--color-text)" },
|
|
255
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
256
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
257
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
258
|
+
] })
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
/* @__PURE__ */ jsxs(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
onClick: openCart,
|
|
265
|
+
"aria-label": "Cart",
|
|
266
|
+
className: "relative p-2 transition-opacity hover:opacity-70",
|
|
267
|
+
style: { color: "var(--color-text)" },
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
270
|
+
/* @__PURE__ */ jsx("path", { d: "M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4z" }),
|
|
271
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
272
|
+
/* @__PURE__ */ jsx("path", { d: "M16 10a4 4 0 01-8 0" })
|
|
273
|
+
] }),
|
|
274
|
+
cartCount > 0 && /* @__PURE__ */ jsx(
|
|
275
|
+
"span",
|
|
276
|
+
{
|
|
277
|
+
className: "absolute -top-0.5 -right-0.5 text-[10px] font-bold min-w-[18px] h-[18px] flex items-center justify-center rounded-full px-1",
|
|
278
|
+
style: { backgroundColor: "var(--color-primary)", color: "#fff" },
|
|
279
|
+
children: cartCount
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ jsx(
|
|
286
|
+
"button",
|
|
287
|
+
{
|
|
288
|
+
onClick: () => setMobileOpen(true),
|
|
289
|
+
"aria-label": "Open menu",
|
|
290
|
+
className: "md:hidden p-2 transition-opacity hover:opacity-70",
|
|
291
|
+
style: { color: "var(--color-text)" },
|
|
292
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
293
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
294
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
|
|
295
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "18", x2: "21", y2: "18" })
|
|
296
|
+
] })
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
] })
|
|
300
|
+
] }) })
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
searchOpen && /* @__PURE__ */ jsx(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: "fixed inset-0 z-[200] flex items-start justify-center pt-24",
|
|
307
|
+
style: { backgroundColor: "rgba(0,0,0,0.6)" },
|
|
308
|
+
onClick: (e) => {
|
|
309
|
+
if (e.target === e.currentTarget) {
|
|
310
|
+
setSearchOpen(false);
|
|
311
|
+
setSuggestions([]);
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-lg mx-4 rounded-lg overflow-hidden", style: { backgroundColor: "var(--color-background)" }, children: [
|
|
315
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSearch, className: "flex items-center px-4 py-3 border-b", style: { borderColor: "#e5e7eb" }, children: [
|
|
316
|
+
/* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "mr-3 flex-shrink-0", style: { color: "var(--color-text)", opacity: 0.4 }, children: [
|
|
317
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
318
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ jsx(
|
|
321
|
+
"input",
|
|
322
|
+
{
|
|
323
|
+
ref: searchRef,
|
|
324
|
+
type: "text",
|
|
325
|
+
value: searchQuery,
|
|
326
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
327
|
+
placeholder: "Search products...",
|
|
328
|
+
className: "flex-1 text-sm outline-none bg-transparent",
|
|
329
|
+
style: { color: "var(--color-text)" }
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ jsx(
|
|
333
|
+
"button",
|
|
334
|
+
{
|
|
335
|
+
type: "button",
|
|
336
|
+
onClick: () => {
|
|
337
|
+
setSearchOpen(false);
|
|
338
|
+
setSuggestions([]);
|
|
339
|
+
setSearchQuery("");
|
|
340
|
+
},
|
|
341
|
+
className: "p-1 ml-2",
|
|
342
|
+
style: { color: "var(--color-text)", opacity: 0.4 },
|
|
343
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
344
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
345
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
346
|
+
] })
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
] }),
|
|
350
|
+
suggestions.length > 0 && /* @__PURE__ */ jsx("div", { className: "max-h-80 overflow-y-auto", children: suggestions.map((product) => /* @__PURE__ */ jsxs(
|
|
351
|
+
Link,
|
|
352
|
+
{
|
|
353
|
+
href: getStorePermalink(domain, `/products/${product.slug}`),
|
|
354
|
+
onClick: () => {
|
|
355
|
+
setSearchOpen(false);
|
|
356
|
+
setSuggestions([]);
|
|
357
|
+
setSearchQuery("");
|
|
358
|
+
},
|
|
359
|
+
className: "flex items-center gap-3 px-4 py-3 transition-colors hover:bg-gray-50",
|
|
360
|
+
children: [
|
|
361
|
+
product.media?.[0]?.url && /* @__PURE__ */ jsx("img", { src: product.media[0].url, alt: product.title, className: "w-10 h-10 object-cover rounded" }),
|
|
362
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", style: { color: "var(--color-text)" }, children: product.title }) })
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
product.id
|
|
366
|
+
)) })
|
|
367
|
+
] })
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
mobileOpen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[200] md:hidden", children: [
|
|
371
|
+
/* @__PURE__ */ jsx(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
className: "absolute inset-0",
|
|
375
|
+
style: { backgroundColor: "rgba(0,0,0,0.5)" },
|
|
376
|
+
onClick: () => setMobileOpen(false)
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ jsxs(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
className: "absolute left-0 top-0 bottom-0 w-[80%] max-w-[320px] flex flex-col",
|
|
383
|
+
style: { backgroundColor: "var(--color-background)" },
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-4 border-b", style: { borderColor: "#e5e7eb" }, children: [
|
|
386
|
+
/* @__PURE__ */ jsx(Link, { href: getStorePermalink(domain, "/"), onClick: () => setMobileOpen(false), children: logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: storeName, style: { height: "28px", width: "auto" } }) : /* @__PURE__ */ jsx("span", { className: "text-lg font-bold", style: { color: "var(--color-text)" }, children: storeName }) }),
|
|
387
|
+
/* @__PURE__ */ jsx(
|
|
388
|
+
"button",
|
|
389
|
+
{
|
|
390
|
+
onClick: () => setMobileOpen(false),
|
|
391
|
+
"aria-label": "Close menu",
|
|
392
|
+
className: "p-1",
|
|
393
|
+
style: { color: "var(--color-text)" },
|
|
394
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
395
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
396
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
397
|
+
] })
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ jsx("nav", { className: "flex-1 overflow-y-auto px-4 py-4", children: menuItems.map((item) => /* @__PURE__ */ jsx(
|
|
402
|
+
Link,
|
|
403
|
+
{
|
|
404
|
+
href: resolveMenuUrl(item, domain),
|
|
405
|
+
onClick: () => setMobileOpen(false),
|
|
406
|
+
className: "block py-3 text-sm font-medium border-b transition-opacity hover:opacity-70",
|
|
407
|
+
style: { color: "var(--color-text)", borderColor: "#f3f4f6" },
|
|
408
|
+
children: item.title
|
|
409
|
+
},
|
|
410
|
+
item.id
|
|
411
|
+
)) })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
] })
|
|
416
|
+
] });
|
|
417
|
+
}
|
|
418
|
+
var schema = {
|
|
419
|
+
type: "header",
|
|
420
|
+
name: "Header",
|
|
421
|
+
limit: 1,
|
|
422
|
+
settings: []
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// src/sections/Announcement.tsx
|
|
426
|
+
import { useTheme as useTheme2 } from "@zevcommerce/storefront-api";
|
|
427
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
428
|
+
function Announcement() {
|
|
429
|
+
const { theme: theme2 } = useTheme2();
|
|
430
|
+
const announcement = theme2?.settings?.announcement;
|
|
431
|
+
if (!announcement?.enabled) return null;
|
|
432
|
+
const text = announcement.text || "Free shipping on orders over $50!";
|
|
433
|
+
const backgroundColor = announcement.backgroundColor || "#2563EB";
|
|
434
|
+
const textColor = announcement.textColor || "#ffffff";
|
|
435
|
+
return /* @__PURE__ */ jsx2(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
className: "py-2.5 text-center",
|
|
439
|
+
style: { backgroundColor, color: textColor, fontFamily: "var(--font-body)" },
|
|
440
|
+
children: /* @__PURE__ */ jsx2("p", { className: "text-xs sm:text-sm font-medium px-4", children: text })
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
var schema2 = {
|
|
445
|
+
type: "announcement",
|
|
446
|
+
name: "Announcement Bar",
|
|
447
|
+
limit: 1,
|
|
448
|
+
settings: []
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// src/sections/Hero.tsx
|
|
452
|
+
import Link2 from "next/link";
|
|
453
|
+
import { useTheme as useTheme3, getStorePermalink as getStorePermalink2 } from "@zevcommerce/storefront-api";
|
|
454
|
+
import { useParams as useParams2 } from "next/navigation";
|
|
455
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
456
|
+
function Hero() {
|
|
457
|
+
const { theme: theme2, storeConfig } = useTheme3();
|
|
458
|
+
const params = useParams2();
|
|
459
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
460
|
+
const hero = theme2?.settings?.hero;
|
|
461
|
+
if (!hero?.enabled) return null;
|
|
462
|
+
const heading = hero.heading || "Welcome to our store";
|
|
463
|
+
const subheading = hero.subheading || "";
|
|
464
|
+
const buttonText = hero.buttonText || "Shop Now";
|
|
465
|
+
const buttonLink = hero.buttonLink || "/collections/all";
|
|
466
|
+
const overlayOpacity = (hero.overlayOpacity ?? 50) / 100;
|
|
467
|
+
const overlayColor = hero.overlayColor || "#000000";
|
|
468
|
+
const textColor = hero.textColor || "#ffffff";
|
|
469
|
+
const resolveImage = (img) => {
|
|
470
|
+
if (!img) return void 0;
|
|
471
|
+
if (typeof img === "string") return img;
|
|
472
|
+
if (typeof img === "object" && img.url) return img.url;
|
|
473
|
+
return void 0;
|
|
474
|
+
};
|
|
475
|
+
const bgImage = resolveImage(hero.backgroundImage);
|
|
476
|
+
return /* @__PURE__ */ jsxs2(
|
|
477
|
+
"section",
|
|
478
|
+
{
|
|
479
|
+
className: "relative flex items-center justify-center min-h-[60vh] md:min-h-[75vh]",
|
|
480
|
+
style: {
|
|
481
|
+
backgroundImage: bgImage ? `url("${bgImage}")` : void 0,
|
|
482
|
+
backgroundSize: "cover",
|
|
483
|
+
backgroundPosition: "center",
|
|
484
|
+
backgroundColor: !bgImage ? "#1f2937" : void 0
|
|
485
|
+
},
|
|
486
|
+
children: [
|
|
487
|
+
/* @__PURE__ */ jsx3(
|
|
488
|
+
"div",
|
|
489
|
+
{
|
|
490
|
+
className: "absolute inset-0",
|
|
491
|
+
style: { backgroundColor: overlayColor, opacity: overlayOpacity }
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative z-10 container mx-auto px-4 sm:px-6 py-16 text-center", children: [
|
|
495
|
+
/* @__PURE__ */ jsx3(
|
|
496
|
+
"h1",
|
|
497
|
+
{
|
|
498
|
+
className: "text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold mb-4 leading-tight",
|
|
499
|
+
style: { color: textColor },
|
|
500
|
+
children: heading
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
subheading && /* @__PURE__ */ jsx3(
|
|
504
|
+
"p",
|
|
505
|
+
{
|
|
506
|
+
className: "text-base sm:text-lg md:text-xl max-w-2xl mx-auto mb-8 opacity-90",
|
|
507
|
+
style: { color: textColor },
|
|
508
|
+
children: subheading
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
buttonText && /* @__PURE__ */ jsx3(
|
|
512
|
+
Link2,
|
|
513
|
+
{
|
|
514
|
+
href: getStorePermalink2(domain, buttonLink),
|
|
515
|
+
className: "btn-primary inline-flex items-center px-6 py-3 sm:px-8 sm:py-3.5 text-sm sm:text-base font-semibold rounded-lg transition-opacity hover:opacity-90",
|
|
516
|
+
style: { backgroundColor: "var(--color-primary)", color: "#ffffff" },
|
|
517
|
+
children: buttonText
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
var schema3 = {
|
|
526
|
+
type: "hero",
|
|
527
|
+
name: "Hero Banner",
|
|
528
|
+
limit: 1,
|
|
529
|
+
settings: []
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// src/sections/FeaturedProducts.tsx
|
|
533
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
534
|
+
import Link3 from "next/link";
|
|
535
|
+
import { useTheme as useTheme4, getCollection, ProductCard, getStorePermalink as getStorePermalink3 } from "@zevcommerce/storefront-api";
|
|
536
|
+
import { useParams as useParams3 } from "next/navigation";
|
|
537
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
538
|
+
function FeaturedProducts() {
|
|
539
|
+
const { theme: theme2, storeConfig } = useTheme4();
|
|
540
|
+
const params = useParams3();
|
|
541
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
542
|
+
const products_settings = theme2?.settings?.products;
|
|
543
|
+
if (!products_settings?.enabled) return null;
|
|
544
|
+
const heading = products_settings.heading || "Featured Products";
|
|
545
|
+
const collectionHandle = products_settings.collection || "all";
|
|
546
|
+
const limit = parseInt(products_settings.limit || "8");
|
|
547
|
+
const columns = parseInt(products_settings.columns || "4");
|
|
548
|
+
const [products, setProducts] = useState2([]);
|
|
549
|
+
const [loading, setLoading] = useState2(true);
|
|
550
|
+
useEffect2(() => {
|
|
551
|
+
async function fetchData() {
|
|
552
|
+
if (!domain || !collectionHandle) {
|
|
553
|
+
setLoading(false);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
setLoading(true);
|
|
557
|
+
try {
|
|
558
|
+
const collection = await getCollection(domain, collectionHandle);
|
|
559
|
+
if (collection) {
|
|
560
|
+
const productList = collection.products?.map((p) => p.product || p) || [];
|
|
561
|
+
setProducts(productList.slice(0, limit));
|
|
562
|
+
}
|
|
563
|
+
} catch (error) {
|
|
564
|
+
if (error?.response?.status !== 404) {
|
|
565
|
+
console.error("Error fetching products:", error);
|
|
566
|
+
}
|
|
567
|
+
} finally {
|
|
568
|
+
setLoading(false);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
fetchData();
|
|
572
|
+
}, [domain, collectionHandle, limit]);
|
|
573
|
+
const gridColsMap = {
|
|
574
|
+
2: "sm:grid-cols-2",
|
|
575
|
+
3: "sm:grid-cols-2 lg:grid-cols-3",
|
|
576
|
+
4: "sm:grid-cols-2 lg:grid-cols-4"
|
|
577
|
+
};
|
|
578
|
+
const gridColsClass = gridColsMap[columns] || "sm:grid-cols-2 lg:grid-cols-4";
|
|
579
|
+
if (loading) {
|
|
580
|
+
return /* @__PURE__ */ jsx4("section", { className: "py-12 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsx4("div", { className: "container mx-auto px-4 sm:px-6", children: /* @__PURE__ */ jsxs3("div", { className: "animate-pulse", children: [
|
|
581
|
+
/* @__PURE__ */ jsx4("div", { className: "h-8 w-48 mb-8 rounded", style: { backgroundColor: "#e5e7eb" } }),
|
|
582
|
+
/* @__PURE__ */ jsx4("div", { className: `grid grid-cols-2 ${gridColsClass} gap-4 sm:gap-6`, children: [...Array(columns)].map((_, i) => /* @__PURE__ */ jsx4("div", { className: "aspect-[3/4] rounded-lg", style: { backgroundColor: "#e5e7eb" } }, i)) })
|
|
583
|
+
] }) }) });
|
|
584
|
+
}
|
|
585
|
+
if (products.length === 0) return null;
|
|
586
|
+
return /* @__PURE__ */ jsx4("section", { className: "py-12 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs3("div", { className: "container mx-auto px-4 sm:px-6", children: [
|
|
587
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between mb-8", children: [
|
|
588
|
+
/* @__PURE__ */ jsx4(
|
|
589
|
+
"h2",
|
|
590
|
+
{
|
|
591
|
+
className: "text-2xl md:text-3xl font-bold",
|
|
592
|
+
style: { color: "var(--color-text)" },
|
|
593
|
+
children: heading
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
/* @__PURE__ */ jsx4(
|
|
597
|
+
Link3,
|
|
598
|
+
{
|
|
599
|
+
href: getStorePermalink3(domain, `/collections/${collectionHandle}`),
|
|
600
|
+
className: "text-sm font-medium transition-opacity hover:opacity-70",
|
|
601
|
+
style: { color: "var(--color-primary)" },
|
|
602
|
+
children: "View All"
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
] }),
|
|
606
|
+
/* @__PURE__ */ jsx4("div", { className: `grid grid-cols-2 ${gridColsClass} gap-4 sm:gap-6`, children: products.map((product) => /* @__PURE__ */ jsx4(
|
|
607
|
+
ProductCard,
|
|
608
|
+
{
|
|
609
|
+
product,
|
|
610
|
+
domain
|
|
611
|
+
},
|
|
612
|
+
product.id
|
|
613
|
+
)) })
|
|
614
|
+
] }) });
|
|
615
|
+
}
|
|
616
|
+
var schema4 = {
|
|
617
|
+
type: "featured-products",
|
|
618
|
+
name: "Featured Products",
|
|
619
|
+
limit: 1,
|
|
620
|
+
settings: []
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// src/sections/ContactInfo.tsx
|
|
624
|
+
import { useTheme as useTheme5 } from "@zevcommerce/storefront-api";
|
|
625
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
626
|
+
function ContactInfo() {
|
|
627
|
+
const { theme: theme2 } = useTheme5();
|
|
628
|
+
const contact = theme2?.settings?.contact;
|
|
629
|
+
if (!contact?.enabled) return null;
|
|
630
|
+
const heading = contact.heading || "Get in Touch";
|
|
631
|
+
const showPhone = contact.showPhone && contact.phone;
|
|
632
|
+
const showEmail = contact.showEmail && contact.email;
|
|
633
|
+
const showWhatsApp = contact.showWhatsApp && contact.whatsapp;
|
|
634
|
+
const showAddress = contact.showAddress && contact.address;
|
|
635
|
+
const hasItems = showPhone || showEmail || showWhatsApp || showAddress;
|
|
636
|
+
if (!hasItems) return null;
|
|
637
|
+
const cards = [];
|
|
638
|
+
if (showPhone) {
|
|
639
|
+
cards.push({
|
|
640
|
+
icon: /* @__PURE__ */ jsx5("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx5("path", { d: "M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z" }) }),
|
|
641
|
+
label: "Phone",
|
|
642
|
+
value: contact.phone,
|
|
643
|
+
href: `tel:${contact.phone}`
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
if (showEmail) {
|
|
647
|
+
cards.push({
|
|
648
|
+
icon: /* @__PURE__ */ jsxs4("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
649
|
+
/* @__PURE__ */ jsx5("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }),
|
|
650
|
+
/* @__PURE__ */ jsx5("polyline", { points: "22,6 12,13 2,6" })
|
|
651
|
+
] }),
|
|
652
|
+
label: "Email",
|
|
653
|
+
value: contact.email,
|
|
654
|
+
href: `mailto:${contact.email}`
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
if (showWhatsApp) {
|
|
658
|
+
const waNumber = contact.whatsapp.replace(/[^0-9]/g, "");
|
|
659
|
+
cards.push({
|
|
660
|
+
icon: /* @__PURE__ */ jsx5("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx5("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z" }) }),
|
|
661
|
+
label: "WhatsApp",
|
|
662
|
+
value: contact.whatsapp,
|
|
663
|
+
href: `https://wa.me/${waNumber}`
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
if (showAddress) {
|
|
667
|
+
cards.push({
|
|
668
|
+
icon: /* @__PURE__ */ jsxs4("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
669
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z" }),
|
|
670
|
+
/* @__PURE__ */ jsx5("circle", { cx: "12", cy: "10", r: "3" })
|
|
671
|
+
] }),
|
|
672
|
+
label: "Address",
|
|
673
|
+
value: contact.address
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
return /* @__PURE__ */ jsx5("section", { className: "py-12 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs4("div", { className: "container mx-auto px-4 sm:px-6", children: [
|
|
677
|
+
/* @__PURE__ */ jsx5(
|
|
678
|
+
"h2",
|
|
679
|
+
{
|
|
680
|
+
className: "text-2xl md:text-3xl font-bold text-center mb-10",
|
|
681
|
+
style: { color: "var(--color-text)" },
|
|
682
|
+
children: heading
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
/* @__PURE__ */ jsx5("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 max-w-4xl mx-auto", children: cards.map((card, i) => {
|
|
686
|
+
const content = /* @__PURE__ */ jsxs4(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
className: "flex flex-col items-center text-center p-6 rounded-lg border transition-shadow hover:shadow-md",
|
|
690
|
+
style: { borderColor: "#e5e7eb" },
|
|
691
|
+
children: [
|
|
692
|
+
/* @__PURE__ */ jsx5(
|
|
693
|
+
"div",
|
|
694
|
+
{
|
|
695
|
+
className: "mb-3",
|
|
696
|
+
style: { color: "var(--color-primary)" },
|
|
697
|
+
children: card.icon
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-xs font-semibold uppercase tracking-wider mb-1", style: { color: "var(--color-text)", opacity: 0.5 }, children: card.label }),
|
|
701
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", style: { color: "var(--color-text)" }, children: card.value })
|
|
702
|
+
]
|
|
703
|
+
},
|
|
704
|
+
i
|
|
705
|
+
);
|
|
706
|
+
if (card.href) {
|
|
707
|
+
return /* @__PURE__ */ jsx5("a", { href: card.href, target: card.label === "WhatsApp" ? "_blank" : void 0, rel: "noopener noreferrer", children: content }, i);
|
|
708
|
+
}
|
|
709
|
+
return content;
|
|
710
|
+
}) })
|
|
711
|
+
] }) });
|
|
712
|
+
}
|
|
713
|
+
var schema5 = {
|
|
714
|
+
type: "contact-info",
|
|
715
|
+
name: "Contact Info",
|
|
716
|
+
limit: 1,
|
|
717
|
+
settings: []
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/sections/Footer.tsx
|
|
721
|
+
import Link4 from "next/link";
|
|
722
|
+
import { useTheme as useTheme6, resolveMenuUrl as resolveMenuUrl2, getStorePermalink as getStorePermalink4 } from "@zevcommerce/storefront-api";
|
|
723
|
+
import { useParams as useParams4 } from "next/navigation";
|
|
724
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
725
|
+
function Footer() {
|
|
726
|
+
const { theme: theme2, storeConfig, menus } = useTheme6();
|
|
727
|
+
const params = useParams4();
|
|
728
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
729
|
+
const footer = theme2?.settings?.footer;
|
|
730
|
+
const storeName = storeConfig?.name || "Store";
|
|
731
|
+
const logoSrc = storeConfig?.storeLogo;
|
|
732
|
+
const description = footer?.description || "";
|
|
733
|
+
const menuHandle = footer?.menuHandle || "footer";
|
|
734
|
+
const copyright = footer?.copyright || `${(/* @__PURE__ */ new Date()).getFullYear()} ${storeName}. All rights reserved.`;
|
|
735
|
+
const socialLinks = [];
|
|
736
|
+
if (footer?.instagram) {
|
|
737
|
+
socialLinks.push({
|
|
738
|
+
platform: "Instagram",
|
|
739
|
+
url: footer.instagram,
|
|
740
|
+
icon: /* @__PURE__ */ jsxs5("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
741
|
+
/* @__PURE__ */ jsx6("rect", { x: "2", y: "2", width: "20", height: "20", rx: "5", ry: "5" }),
|
|
742
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "4" }),
|
|
743
|
+
/* @__PURE__ */ jsx6("circle", { cx: "17.5", cy: "6.5", r: "0.5", fill: "currentColor" })
|
|
744
|
+
] })
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
if (footer?.facebook) {
|
|
748
|
+
socialLinks.push({
|
|
749
|
+
platform: "Facebook",
|
|
750
|
+
url: footer.facebook,
|
|
751
|
+
icon: /* @__PURE__ */ jsx6("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx6("path", { d: "M18 2h-3a5 5 0 00-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 011-1h3z" }) })
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
if (footer?.twitter) {
|
|
755
|
+
socialLinks.push({
|
|
756
|
+
platform: "Twitter",
|
|
757
|
+
url: footer.twitter,
|
|
758
|
+
icon: /* @__PURE__ */ jsx6("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx6("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) })
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
if (footer?.tiktok) {
|
|
762
|
+
socialLinks.push({
|
|
763
|
+
platform: "TikTok",
|
|
764
|
+
url: footer.tiktok,
|
|
765
|
+
icon: /* @__PURE__ */ jsx6("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx6("path", { d: "M19.59 6.69a4.83 4.83 0 01-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 01-2.88 2.5 2.89 2.89 0 01-2.89-2.89 2.89 2.89 0 012.89-2.89c.28 0 .54.04.79.1V9.01a6.33 6.33 0 00-.79-.05 6.34 6.34 0 00-6.34 6.34 6.34 6.34 0 006.34 6.34 6.34 6.34 0 006.33-6.34V9.04a8.28 8.28 0 004.84 1.55V7.14a4.85 4.85 0 01-1.07-.45z" }) })
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
const footerMenu = menus?.[menuHandle];
|
|
769
|
+
const menuItems = footerMenu?.items || [];
|
|
770
|
+
return /* @__PURE__ */ jsx6(
|
|
771
|
+
"footer",
|
|
772
|
+
{
|
|
773
|
+
className: "py-12 md:py-16 border-t",
|
|
774
|
+
style: { backgroundColor: "var(--color-background)", borderColor: "#e5e7eb" },
|
|
775
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "container mx-auto px-4 sm:px-6", children: [
|
|
776
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-10 md:gap-12", children: [
|
|
777
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
778
|
+
/* @__PURE__ */ jsx6(Link4, { href: getStorePermalink4(domain, "/"), className: "inline-block mb-4", children: logoSrc ? /* @__PURE__ */ jsx6("img", { src: logoSrc, alt: storeName, className: "h-8 w-auto object-contain" }) : /* @__PURE__ */ jsx6("span", { className: "text-lg font-bold", style: { color: "var(--color-text)" }, children: storeName }) }),
|
|
779
|
+
description && /* @__PURE__ */ jsx6("p", { className: "text-sm leading-relaxed max-w-xs", style: { color: "var(--color-text)", opacity: 0.6 }, children: description }),
|
|
780
|
+
socialLinks.length > 0 && /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-4 mt-5", children: socialLinks.map((link, i) => /* @__PURE__ */ jsx6(
|
|
781
|
+
"a",
|
|
782
|
+
{
|
|
783
|
+
href: link.url,
|
|
784
|
+
target: "_blank",
|
|
785
|
+
rel: "noopener noreferrer",
|
|
786
|
+
"aria-label": link.platform,
|
|
787
|
+
className: "transition-opacity hover:opacity-70",
|
|
788
|
+
style: { color: "var(--color-text)", opacity: 0.5 },
|
|
789
|
+
children: link.icon
|
|
790
|
+
},
|
|
791
|
+
i
|
|
792
|
+
)) })
|
|
793
|
+
] }),
|
|
794
|
+
menuItems.length > 0 && /* @__PURE__ */ jsxs5("div", { children: [
|
|
795
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-sm font-semibold uppercase tracking-wider mb-4", style: { color: "var(--color-text)" }, children: "Quick Links" }),
|
|
796
|
+
/* @__PURE__ */ jsx6("nav", { className: "flex flex-col gap-2.5", children: menuItems.map((item) => /* @__PURE__ */ jsx6(
|
|
797
|
+
Link4,
|
|
798
|
+
{
|
|
799
|
+
href: resolveMenuUrl2(item, domain),
|
|
800
|
+
className: "text-sm transition-opacity hover:opacity-70",
|
|
801
|
+
style: { color: "var(--color-text)", opacity: 0.6 },
|
|
802
|
+
children: item.title
|
|
803
|
+
},
|
|
804
|
+
item.id
|
|
805
|
+
)) })
|
|
806
|
+
] }),
|
|
807
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
808
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-sm font-semibold uppercase tracking-wider mb-4", style: { color: "var(--color-text)" }, children: "Store" }),
|
|
809
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2.5 text-sm", style: { color: "var(--color-text)", opacity: 0.6 }, children: [
|
|
810
|
+
storeConfig?.email && /* @__PURE__ */ jsx6("p", { children: storeConfig.email }),
|
|
811
|
+
storeConfig?.phone && /* @__PURE__ */ jsx6("p", { children: storeConfig.phone })
|
|
812
|
+
] })
|
|
813
|
+
] })
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ jsx6("div", { className: "mt-12 pt-8 border-t text-center", style: { borderColor: "#e5e7eb" }, children: /* @__PURE__ */ jsxs5("p", { className: "text-xs", style: { color: "var(--color-text)", opacity: 0.4 }, children: [
|
|
816
|
+
"\xA9 ",
|
|
817
|
+
copyright
|
|
818
|
+
] }) })
|
|
819
|
+
] })
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
var schema6 = {
|
|
824
|
+
type: "footer",
|
|
825
|
+
name: "Footer",
|
|
826
|
+
limit: 1,
|
|
827
|
+
settings: []
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// src/sections/ProductDetail.tsx
|
|
831
|
+
import { useState as useState3, useEffect as useEffect3 } from "react";
|
|
832
|
+
import Link5 from "next/link";
|
|
833
|
+
import { useTheme as useTheme7, useProduct, useCartStore as useCartStore2, getStorePermalink as getStorePermalink5 } from "@zevcommerce/storefront-api";
|
|
834
|
+
import { useParams as useParams5 } from "next/navigation";
|
|
835
|
+
|
|
836
|
+
// src/helpers/format-price.ts
|
|
837
|
+
var CURRENCY_LOCALES = {
|
|
838
|
+
USD: "en-US",
|
|
839
|
+
EUR: "de-DE",
|
|
840
|
+
GBP: "en-GB",
|
|
841
|
+
NGN: "en-NG",
|
|
842
|
+
GHS: "en-GH",
|
|
843
|
+
KES: "en-KE",
|
|
844
|
+
ZAR: "en-ZA",
|
|
845
|
+
CAD: "en-CA",
|
|
846
|
+
AUD: "en-AU",
|
|
847
|
+
JPY: "ja-JP",
|
|
848
|
+
INR: "en-IN",
|
|
849
|
+
BRL: "pt-BR",
|
|
850
|
+
MXN: "es-MX",
|
|
851
|
+
AED: "ar-AE",
|
|
852
|
+
SAR: "ar-SA",
|
|
853
|
+
XOF: "fr-SN",
|
|
854
|
+
XAF: "fr-CM",
|
|
855
|
+
TZS: "en-TZ",
|
|
856
|
+
UGX: "en-UG",
|
|
857
|
+
RWF: "en-RW"
|
|
858
|
+
};
|
|
859
|
+
function formatPrice(amount, currency = "NGN") {
|
|
860
|
+
const value = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
861
|
+
if (isNaN(value)) return `${currency} 0.00`;
|
|
862
|
+
const locale = CURRENCY_LOCALES[currency] || "en-US";
|
|
863
|
+
try {
|
|
864
|
+
return new Intl.NumberFormat(locale, {
|
|
865
|
+
style: "currency",
|
|
866
|
+
currency,
|
|
867
|
+
minimumFractionDigits: 2,
|
|
868
|
+
maximumFractionDigits: 2
|
|
869
|
+
}).format(value);
|
|
870
|
+
} catch {
|
|
871
|
+
return `${currency} ${value.toFixed(2)}`;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
// src/sections/ProductDetail.tsx
|
|
876
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
877
|
+
function ProductDetail() {
|
|
878
|
+
const { theme: theme2, storeConfig } = useTheme7();
|
|
879
|
+
const { product, selectedVariant, quantity, setQuantity, setSelectedVariant } = useProduct();
|
|
880
|
+
const { addItem, openCart } = useCartStore2();
|
|
881
|
+
const params = useParams5();
|
|
882
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
883
|
+
const currency = storeConfig?.currency || "NGN";
|
|
884
|
+
const [activeImageIndex, setActiveImageIndex] = useState3(0);
|
|
885
|
+
const [addedToCart, setAddedToCart] = useState3(false);
|
|
886
|
+
useEffect3(() => {
|
|
887
|
+
setActiveImageIndex(0);
|
|
888
|
+
setAddedToCart(false);
|
|
889
|
+
}, [product?.id]);
|
|
890
|
+
if (!product) {
|
|
891
|
+
return /* @__PURE__ */ jsx7("div", { className: "py-24 text-center", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsx7("p", { className: "text-sm", style: { color: "var(--color-text)", opacity: 0.5 }, children: "Product not found" }) });
|
|
892
|
+
}
|
|
893
|
+
const images = product.media || [];
|
|
894
|
+
const variants = product.variants || [];
|
|
895
|
+
const hasVariants = variants.length > 1;
|
|
896
|
+
const currentVariant = selectedVariant || variants[0];
|
|
897
|
+
const price = parseFloat(currentVariant?.price || product.price || "0");
|
|
898
|
+
const compareAtPrice = parseFloat(currentVariant?.compareAtPrice || product.compareAtPrice || "0");
|
|
899
|
+
const isOnSale = compareAtPrice > 0 && compareAtPrice > price;
|
|
900
|
+
const optionGroups = {};
|
|
901
|
+
variants.forEach((v) => {
|
|
902
|
+
(v.options || []).forEach((opt) => {
|
|
903
|
+
if (!optionGroups[opt.name]) optionGroups[opt.name] = [];
|
|
904
|
+
if (!optionGroups[opt.name].includes(opt.value)) {
|
|
905
|
+
optionGroups[opt.name].push(opt.value);
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
});
|
|
909
|
+
const handleAddToCart = () => {
|
|
910
|
+
if (!currentVariant) return;
|
|
911
|
+
addItem({
|
|
912
|
+
variantId: currentVariant.id,
|
|
913
|
+
productId: product.id,
|
|
914
|
+
title: product.title,
|
|
915
|
+
variantTitle: currentVariant.title || "",
|
|
916
|
+
price: currentVariant.price,
|
|
917
|
+
quantity,
|
|
918
|
+
image: images[0]?.url || "",
|
|
919
|
+
slug: product.slug
|
|
920
|
+
});
|
|
921
|
+
setAddedToCart(true);
|
|
922
|
+
openCart();
|
|
923
|
+
setTimeout(() => setAddedToCart(false), 2e3);
|
|
924
|
+
};
|
|
925
|
+
return /* @__PURE__ */ jsx7("section", { className: "py-8 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs6("div", { className: "container mx-auto px-4 sm:px-6 max-w-6xl", children: [
|
|
926
|
+
/* @__PURE__ */ jsxs6("nav", { className: "flex items-center gap-2 text-xs mb-8", style: { color: "var(--color-text)", opacity: 0.5 }, children: [
|
|
927
|
+
/* @__PURE__ */ jsx7(Link5, { href: getStorePermalink5(domain, "/"), className: "hover:opacity-70 transition-opacity", children: "Home" }),
|
|
928
|
+
/* @__PURE__ */ jsx7("span", { children: "/" }),
|
|
929
|
+
/* @__PURE__ */ jsx7(Link5, { href: getStorePermalink5(domain, "/collections/all"), className: "hover:opacity-70 transition-opacity", children: "Products" }),
|
|
930
|
+
/* @__PURE__ */ jsx7("span", { children: "/" }),
|
|
931
|
+
/* @__PURE__ */ jsx7("span", { style: { opacity: 1, color: "var(--color-text)" }, children: product.title })
|
|
932
|
+
] }),
|
|
933
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12", children: [
|
|
934
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
935
|
+
images.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "relative aspect-square mb-3 rounded-lg overflow-hidden", style: { backgroundColor: "#f3f4f6" }, children: [
|
|
936
|
+
/* @__PURE__ */ jsx7(
|
|
937
|
+
"img",
|
|
938
|
+
{
|
|
939
|
+
src: images[activeImageIndex]?.url,
|
|
940
|
+
alt: product.title,
|
|
941
|
+
className: "w-full h-full object-cover"
|
|
942
|
+
}
|
|
943
|
+
),
|
|
944
|
+
isOnSale && /* @__PURE__ */ jsx7(
|
|
945
|
+
"span",
|
|
946
|
+
{
|
|
947
|
+
className: "absolute top-3 left-3 text-xs font-semibold px-2.5 py-1 rounded",
|
|
948
|
+
style: { backgroundColor: "#ef4444", color: "#fff" },
|
|
949
|
+
children: "Sale"
|
|
950
|
+
}
|
|
951
|
+
)
|
|
952
|
+
] }),
|
|
953
|
+
images.length > 1 && /* @__PURE__ */ jsx7("div", { className: "flex gap-2 overflow-x-auto", children: images.map((img, i) => /* @__PURE__ */ jsx7(
|
|
954
|
+
"button",
|
|
955
|
+
{
|
|
956
|
+
onClick: () => setActiveImageIndex(i),
|
|
957
|
+
className: "flex-shrink-0 w-16 h-16 rounded overflow-hidden border-2 transition-colors",
|
|
958
|
+
style: {
|
|
959
|
+
borderColor: i === activeImageIndex ? "var(--color-primary)" : "transparent"
|
|
960
|
+
},
|
|
961
|
+
children: /* @__PURE__ */ jsx7("img", { src: img.url, alt: "", className: "w-full h-full object-cover" })
|
|
962
|
+
},
|
|
963
|
+
i
|
|
964
|
+
)) })
|
|
965
|
+
] }),
|
|
966
|
+
/* @__PURE__ */ jsxs6("div", { className: "lg:sticky lg:top-24 lg:self-start", children: [
|
|
967
|
+
product.vendor && /* @__PURE__ */ jsx7("p", { className: "text-xs font-medium uppercase tracking-wider mb-2", style: { color: "var(--color-primary)" }, children: product.vendor }),
|
|
968
|
+
/* @__PURE__ */ jsx7(
|
|
969
|
+
"h1",
|
|
970
|
+
{
|
|
971
|
+
className: "text-2xl md:text-3xl font-bold mb-3",
|
|
972
|
+
style: { color: "var(--color-text)" },
|
|
973
|
+
children: product.title
|
|
974
|
+
}
|
|
975
|
+
),
|
|
976
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 mb-6", children: [
|
|
977
|
+
/* @__PURE__ */ jsx7("span", { className: "text-xl font-bold", style: { color: "var(--color-text)" }, children: formatPrice(price, currency) }),
|
|
978
|
+
isOnSale && /* @__PURE__ */ jsx7("span", { className: "text-base line-through", style: { color: "var(--color-text)", opacity: 0.4 }, children: formatPrice(compareAtPrice, currency) })
|
|
979
|
+
] }),
|
|
980
|
+
hasVariants && Object.entries(optionGroups).map(([optionName, values]) => {
|
|
981
|
+
const currentValue = currentVariant?.options?.find((o) => o.name === optionName)?.value;
|
|
982
|
+
return /* @__PURE__ */ jsxs6("div", { className: "mb-5", children: [
|
|
983
|
+
/* @__PURE__ */ jsxs6("label", { className: "block text-sm font-medium mb-2", style: { color: "var(--color-text)" }, children: [
|
|
984
|
+
optionName,
|
|
985
|
+
": ",
|
|
986
|
+
/* @__PURE__ */ jsx7("span", { className: "font-normal", children: currentValue })
|
|
987
|
+
] }),
|
|
988
|
+
/* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-2", children: values.map((val) => {
|
|
989
|
+
const isSelected = currentValue === val;
|
|
990
|
+
return /* @__PURE__ */ jsx7(
|
|
991
|
+
"button",
|
|
992
|
+
{
|
|
993
|
+
onClick: () => {
|
|
994
|
+
const match = variants.find(
|
|
995
|
+
(v) => v.options?.some((o) => o.name === optionName && o.value === val)
|
|
996
|
+
);
|
|
997
|
+
if (match) setSelectedVariant(match);
|
|
998
|
+
},
|
|
999
|
+
className: "px-4 py-2 text-sm border rounded transition-colors",
|
|
1000
|
+
style: {
|
|
1001
|
+
backgroundColor: isSelected ? "var(--color-primary)" : "transparent",
|
|
1002
|
+
color: isSelected ? "#fff" : "var(--color-text)",
|
|
1003
|
+
borderColor: isSelected ? "var(--color-primary)" : "#d1d5db"
|
|
1004
|
+
},
|
|
1005
|
+
children: val
|
|
1006
|
+
},
|
|
1007
|
+
val
|
|
1008
|
+
);
|
|
1009
|
+
}) })
|
|
1010
|
+
] }, optionName);
|
|
1011
|
+
}),
|
|
1012
|
+
/* @__PURE__ */ jsxs6("div", { className: "mb-6", children: [
|
|
1013
|
+
/* @__PURE__ */ jsx7("label", { className: "block text-sm font-medium mb-2", style: { color: "var(--color-text)" }, children: "Quantity" }),
|
|
1014
|
+
/* @__PURE__ */ jsxs6("div", { className: "inline-flex items-center border rounded", style: { borderColor: "#d1d5db" }, children: [
|
|
1015
|
+
/* @__PURE__ */ jsx7(
|
|
1016
|
+
"button",
|
|
1017
|
+
{
|
|
1018
|
+
onClick: () => setQuantity(Math.max(1, quantity - 1)),
|
|
1019
|
+
className: "px-3 py-2 text-sm hover:bg-gray-50 transition-colors",
|
|
1020
|
+
style: { color: "var(--color-text)" },
|
|
1021
|
+
children: "-"
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ jsx7("span", { className: "px-4 py-2 text-sm font-medium", style: { color: "var(--color-text)" }, children: quantity }),
|
|
1025
|
+
/* @__PURE__ */ jsx7(
|
|
1026
|
+
"button",
|
|
1027
|
+
{
|
|
1028
|
+
onClick: () => setQuantity(quantity + 1),
|
|
1029
|
+
className: "px-3 py-2 text-sm hover:bg-gray-50 transition-colors",
|
|
1030
|
+
style: { color: "var(--color-text)" },
|
|
1031
|
+
children: "+"
|
|
1032
|
+
}
|
|
1033
|
+
)
|
|
1034
|
+
] })
|
|
1035
|
+
] }),
|
|
1036
|
+
/* @__PURE__ */ jsx7(
|
|
1037
|
+
"button",
|
|
1038
|
+
{
|
|
1039
|
+
onClick: handleAddToCart,
|
|
1040
|
+
className: "w-full py-3.5 text-sm font-semibold rounded-lg transition-opacity hover:opacity-90",
|
|
1041
|
+
style: { backgroundColor: "var(--color-primary)", color: "#fff" },
|
|
1042
|
+
children: addedToCart ? "Added!" : "Add to Cart"
|
|
1043
|
+
}
|
|
1044
|
+
),
|
|
1045
|
+
product.description && /* @__PURE__ */ jsxs6("div", { className: "mt-8 pt-8 border-t", style: { borderColor: "#e5e7eb" }, children: [
|
|
1046
|
+
/* @__PURE__ */ jsx7("h3", { className: "text-sm font-semibold mb-3", style: { color: "var(--color-text)" }, children: "Description" }),
|
|
1047
|
+
/* @__PURE__ */ jsx7(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
className: "text-sm leading-relaxed prose prose-sm max-w-none",
|
|
1051
|
+
style: { color: "var(--color-text)", opacity: 0.7 },
|
|
1052
|
+
dangerouslySetInnerHTML: { __html: product.description }
|
|
1053
|
+
}
|
|
1054
|
+
)
|
|
1055
|
+
] })
|
|
1056
|
+
] })
|
|
1057
|
+
] })
|
|
1058
|
+
] }) });
|
|
1059
|
+
}
|
|
1060
|
+
var schema7 = {
|
|
1061
|
+
type: "product-detail",
|
|
1062
|
+
name: "Product Detail",
|
|
1063
|
+
settings: [],
|
|
1064
|
+
disabled_on: { templates: ["*"] },
|
|
1065
|
+
enabled_on: { templates: ["product_detail"] }
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
// src/sections/ProductList.tsx
|
|
1069
|
+
import { useTheme as useTheme8, useCollection, ProductCard as ProductCard2 } from "@zevcommerce/storefront-api";
|
|
1070
|
+
import { useParams as useParams6 } from "next/navigation";
|
|
1071
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1072
|
+
function ProductList() {
|
|
1073
|
+
const { storeConfig } = useTheme8();
|
|
1074
|
+
const { collection } = useCollection();
|
|
1075
|
+
const params = useParams6();
|
|
1076
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
1077
|
+
if (!collection) {
|
|
1078
|
+
return /* @__PURE__ */ jsx8("div", { className: "py-24 text-center", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs7("div", { className: "animate-pulse flex flex-col items-center", children: [
|
|
1079
|
+
/* @__PURE__ */ jsx8("div", { className: "h-8 w-48 rounded mb-4", style: { backgroundColor: "#e5e7eb" } }),
|
|
1080
|
+
/* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-4 w-full max-w-6xl mx-auto px-4", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx8("div", { className: "aspect-[3/4] rounded-lg", style: { backgroundColor: "#e5e7eb" } }, i)) })
|
|
1081
|
+
] }) });
|
|
1082
|
+
}
|
|
1083
|
+
const products = collection.products?.map((p) => p.product || p) || [];
|
|
1084
|
+
return /* @__PURE__ */ jsx8("section", { className: "py-8 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs7("div", { className: "container mx-auto px-4 sm:px-6 max-w-6xl", children: [
|
|
1085
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-8 md:mb-10", children: [
|
|
1086
|
+
/* @__PURE__ */ jsx8(
|
|
1087
|
+
"h1",
|
|
1088
|
+
{
|
|
1089
|
+
className: "text-2xl md:text-3xl font-bold mb-2",
|
|
1090
|
+
style: { color: "var(--color-text)" },
|
|
1091
|
+
children: collection.title
|
|
1092
|
+
}
|
|
1093
|
+
),
|
|
1094
|
+
collection.description && /* @__PURE__ */ jsx8("p", { className: "text-sm max-w-2xl", style: { color: "var(--color-text)", opacity: 0.6 }, children: collection.description })
|
|
1095
|
+
] }),
|
|
1096
|
+
products.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6", children: products.map((product) => /* @__PURE__ */ jsx8(
|
|
1097
|
+
ProductCard2,
|
|
1098
|
+
{
|
|
1099
|
+
product,
|
|
1100
|
+
domain
|
|
1101
|
+
},
|
|
1102
|
+
product.id
|
|
1103
|
+
)) }) : /* @__PURE__ */ jsx8("div", { className: "py-16 text-center", children: /* @__PURE__ */ jsx8("p", { className: "text-sm", style: { color: "var(--color-text)", opacity: 0.5 }, children: "No products found in this collection." }) })
|
|
1104
|
+
] }) });
|
|
1105
|
+
}
|
|
1106
|
+
var schema8 = {
|
|
1107
|
+
type: "product-list",
|
|
1108
|
+
name: "Product List",
|
|
1109
|
+
settings: [],
|
|
1110
|
+
disabled_on: { templates: ["*"] },
|
|
1111
|
+
enabled_on: { templates: ["collection"] }
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// src/sections/CartSection.tsx
|
|
1115
|
+
import Link6 from "next/link";
|
|
1116
|
+
import { useTheme as useTheme9, useCartStore as useCartStore3, getStorePermalink as getStorePermalink6 } from "@zevcommerce/storefront-api";
|
|
1117
|
+
import { useParams as useParams7 } from "next/navigation";
|
|
1118
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1119
|
+
function CartSection() {
|
|
1120
|
+
const { storeConfig } = useTheme9();
|
|
1121
|
+
const { items, totalPrice, removeItem, updateQuantity } = useCartStore3();
|
|
1122
|
+
const params = useParams7();
|
|
1123
|
+
const domain = params?.domain || storeConfig?.handle || "";
|
|
1124
|
+
const currency = storeConfig?.currency || "NGN";
|
|
1125
|
+
const total = typeof totalPrice === "function" ? totalPrice() : totalPrice;
|
|
1126
|
+
if (items.length === 0) {
|
|
1127
|
+
return /* @__PURE__ */ jsx9("div", { className: "py-24 text-center", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs8("div", { className: "container mx-auto px-4 sm:px-6", children: [
|
|
1128
|
+
/* @__PURE__ */ jsx9(
|
|
1129
|
+
"div",
|
|
1130
|
+
{
|
|
1131
|
+
className: "w-16 h-16 mx-auto mb-6 rounded-full flex items-center justify-center",
|
|
1132
|
+
style: { backgroundColor: "#f3f4f6" },
|
|
1133
|
+
children: /* @__PURE__ */ jsxs8("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", style: { color: "var(--color-text)", opacity: 0.4 }, children: [
|
|
1134
|
+
/* @__PURE__ */ jsx9("path", { d: "M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4z" }),
|
|
1135
|
+
/* @__PURE__ */ jsx9("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
1136
|
+
/* @__PURE__ */ jsx9("path", { d: "M16 10a4 4 0 01-8 0" })
|
|
1137
|
+
] })
|
|
1138
|
+
}
|
|
1139
|
+
),
|
|
1140
|
+
/* @__PURE__ */ jsx9("h1", { className: "text-xl font-bold mb-2", style: { color: "var(--color-text)" }, children: "Your cart is empty" }),
|
|
1141
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm mb-6", style: { color: "var(--color-text)", opacity: 0.5 }, children: "Start browsing to add items to your cart." }),
|
|
1142
|
+
/* @__PURE__ */ jsx9(
|
|
1143
|
+
Link6,
|
|
1144
|
+
{
|
|
1145
|
+
href: getStorePermalink6(domain, "/collections/all"),
|
|
1146
|
+
className: "btn-primary",
|
|
1147
|
+
children: "Browse Products"
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1150
|
+
] }) });
|
|
1151
|
+
}
|
|
1152
|
+
return /* @__PURE__ */ jsx9("section", { className: "py-8 md:py-16", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsxs8("div", { className: "container mx-auto px-4 sm:px-6 max-w-4xl", children: [
|
|
1153
|
+
/* @__PURE__ */ jsxs8("h1", { className: "text-2xl md:text-3xl font-bold mb-8", style: { color: "var(--color-text)" }, children: [
|
|
1154
|
+
"Your Cart",
|
|
1155
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-base font-normal ml-2", style: { opacity: 0.5 }, children: [
|
|
1156
|
+
"(",
|
|
1157
|
+
items.length,
|
|
1158
|
+
" ",
|
|
1159
|
+
items.length === 1 ? "item" : "items",
|
|
1160
|
+
")"
|
|
1161
|
+
] })
|
|
1162
|
+
] }),
|
|
1163
|
+
/* @__PURE__ */ jsx9("div", { className: "divide-y", style: { borderColor: "#e5e7eb" }, children: items.map((item) => /* @__PURE__ */ jsxs8("div", { className: "flex gap-4 py-6", children: [
|
|
1164
|
+
item.image && /* @__PURE__ */ jsx9(
|
|
1165
|
+
Link6,
|
|
1166
|
+
{
|
|
1167
|
+
href: getStorePermalink6(domain, `/products/${item.slug}`),
|
|
1168
|
+
className: "flex-shrink-0",
|
|
1169
|
+
children: /* @__PURE__ */ jsx9(
|
|
1170
|
+
"img",
|
|
1171
|
+
{
|
|
1172
|
+
src: item.image,
|
|
1173
|
+
alt: item.title,
|
|
1174
|
+
className: "w-20 h-20 sm:w-24 sm:h-24 object-cover rounded-lg"
|
|
1175
|
+
}
|
|
1176
|
+
)
|
|
1177
|
+
}
|
|
1178
|
+
),
|
|
1179
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-1 min-w-0", children: [
|
|
1180
|
+
/* @__PURE__ */ jsx9(
|
|
1181
|
+
Link6,
|
|
1182
|
+
{
|
|
1183
|
+
href: getStorePermalink6(domain, `/products/${item.slug}`),
|
|
1184
|
+
className: "text-sm font-medium hover:opacity-70 transition-opacity",
|
|
1185
|
+
style: { color: "var(--color-text)" },
|
|
1186
|
+
children: item.title
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
item.variantTitle && /* @__PURE__ */ jsx9("p", { className: "text-xs mt-1", style: { color: "var(--color-text)", opacity: 0.5 }, children: item.variantTitle }),
|
|
1190
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm font-semibold mt-2", style: { color: "var(--color-text)" }, children: formatPrice(parseFloat(item.price) * item.quantity, currency) }),
|
|
1191
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 mt-3", children: [
|
|
1192
|
+
/* @__PURE__ */ jsxs8("div", { className: "inline-flex items-center border rounded text-sm", style: { borderColor: "#d1d5db" }, children: [
|
|
1193
|
+
/* @__PURE__ */ jsx9(
|
|
1194
|
+
"button",
|
|
1195
|
+
{
|
|
1196
|
+
onClick: () => updateQuantity(item.variantId, -1),
|
|
1197
|
+
className: "px-2.5 py-1 hover:bg-gray-50 transition-colors",
|
|
1198
|
+
style: { color: "var(--color-text)" },
|
|
1199
|
+
children: "-"
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
/* @__PURE__ */ jsx9("span", { className: "px-3 py-1", style: { color: "var(--color-text)" }, children: item.quantity }),
|
|
1203
|
+
/* @__PURE__ */ jsx9(
|
|
1204
|
+
"button",
|
|
1205
|
+
{
|
|
1206
|
+
onClick: () => updateQuantity(item.variantId, 1),
|
|
1207
|
+
className: "px-2.5 py-1 hover:bg-gray-50 transition-colors",
|
|
1208
|
+
style: { color: "var(--color-text)" },
|
|
1209
|
+
children: "+"
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
] }),
|
|
1213
|
+
/* @__PURE__ */ jsx9(
|
|
1214
|
+
"button",
|
|
1215
|
+
{
|
|
1216
|
+
onClick: () => removeItem(item.variantId),
|
|
1217
|
+
className: "text-xs font-medium transition-opacity hover:opacity-70",
|
|
1218
|
+
style: { color: "#ef4444" },
|
|
1219
|
+
children: "Remove"
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] })
|
|
1223
|
+
] })
|
|
1224
|
+
] }, item.variantId)) }),
|
|
1225
|
+
/* @__PURE__ */ jsxs8("div", { className: "mt-8 pt-6 border-t", style: { borderColor: "#e5e7eb" }, children: [
|
|
1226
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between mb-6", children: [
|
|
1227
|
+
/* @__PURE__ */ jsx9("span", { className: "text-base font-semibold", style: { color: "var(--color-text)" }, children: "Total" }),
|
|
1228
|
+
/* @__PURE__ */ jsx9("span", { className: "text-lg font-bold", style: { color: "var(--color-text)" }, children: formatPrice(total, currency) })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ jsx9(
|
|
1231
|
+
Link6,
|
|
1232
|
+
{
|
|
1233
|
+
href: getStorePermalink6(domain, "/checkout"),
|
|
1234
|
+
className: "btn-primary w-full text-center block py-3.5",
|
|
1235
|
+
children: "Proceed to Checkout"
|
|
1236
|
+
}
|
|
1237
|
+
)
|
|
1238
|
+
] })
|
|
1239
|
+
] }) });
|
|
1240
|
+
}
|
|
1241
|
+
var schema9 = {
|
|
1242
|
+
type: "cart-page",
|
|
1243
|
+
name: "Cart Page",
|
|
1244
|
+
settings: [],
|
|
1245
|
+
disabled_on: { templates: ["*"] },
|
|
1246
|
+
enabled_on: { templates: ["cart"] }
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
// src/sections/CheckoutSection.tsx
|
|
1250
|
+
import { CheckoutForm } from "@zevcommerce/storefront-api";
|
|
1251
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1252
|
+
function CheckoutSection() {
|
|
1253
|
+
return /* @__PURE__ */ jsx10("div", { className: "min-h-screen", style: { backgroundColor: "var(--color-background)" }, children: /* @__PURE__ */ jsx10("div", { className: "container mx-auto px-4 sm:px-6 py-8 md:py-16 max-w-4xl", children: /* @__PURE__ */ jsx10(CheckoutForm, {}) }) });
|
|
1254
|
+
}
|
|
1255
|
+
var schema10 = {
|
|
1256
|
+
type: "checkout-page",
|
|
1257
|
+
name: "Checkout Page",
|
|
1258
|
+
settings: [],
|
|
1259
|
+
disabled_on: { templates: ["*"] },
|
|
1260
|
+
enabled_on: { templates: ["checkout"] }
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// src/registry.ts
|
|
1264
|
+
var starterSectionRegistry = {
|
|
1265
|
+
"header": { component: Header, schema },
|
|
1266
|
+
"announcement": { component: Announcement, schema: schema2 },
|
|
1267
|
+
"hero": { component: Hero, schema: schema3 },
|
|
1268
|
+
"featured-products": { component: FeaturedProducts, schema: schema4 },
|
|
1269
|
+
"contact-info": { component: ContactInfo, schema: schema5 },
|
|
1270
|
+
"footer": { component: Footer, schema: schema6 },
|
|
1271
|
+
"product-detail": { component: ProductDetail, schema: schema7 },
|
|
1272
|
+
"product-list": { component: ProductList, schema: schema8 },
|
|
1273
|
+
"cart-page": { component: CartSection, schema: schema9 },
|
|
1274
|
+
"checkout-page": { component: CheckoutSection, schema: schema10 }
|
|
1275
|
+
};
|
|
1276
|
+
var starterBlockRegistry = {};
|
|
1277
|
+
|
|
1278
|
+
// src/preset.json
|
|
1279
|
+
var preset_default = {
|
|
1280
|
+
name: "Starter",
|
|
1281
|
+
settings: {
|
|
1282
|
+
brand: {
|
|
1283
|
+
primary: "#2563EB",
|
|
1284
|
+
background: "#ffffff",
|
|
1285
|
+
text: "#374151",
|
|
1286
|
+
accent: "#F59E0B",
|
|
1287
|
+
font: "Inter"
|
|
1288
|
+
},
|
|
1289
|
+
header: {
|
|
1290
|
+
logo: null,
|
|
1291
|
+
logoHeight: 36,
|
|
1292
|
+
sticky: true,
|
|
1293
|
+
showSearch: true,
|
|
1294
|
+
menuHandle: "main-menu"
|
|
1295
|
+
},
|
|
1296
|
+
hero: {
|
|
1297
|
+
enabled: true,
|
|
1298
|
+
backgroundImage: null,
|
|
1299
|
+
heading: "Welcome to our store",
|
|
1300
|
+
subheading: "Discover amazing products at great prices.",
|
|
1301
|
+
buttonText: "Shop Now",
|
|
1302
|
+
buttonLink: "/collections/all",
|
|
1303
|
+
overlayOpacity: 50,
|
|
1304
|
+
overlayColor: "#000000",
|
|
1305
|
+
textColor: "#ffffff"
|
|
1306
|
+
},
|
|
1307
|
+
products: {
|
|
1308
|
+
enabled: true,
|
|
1309
|
+
heading: "Featured Products",
|
|
1310
|
+
collection: "all",
|
|
1311
|
+
limit: 8,
|
|
1312
|
+
columns: "4"
|
|
1313
|
+
},
|
|
1314
|
+
contact: {
|
|
1315
|
+
enabled: false,
|
|
1316
|
+
heading: "Get in Touch",
|
|
1317
|
+
showPhone: true,
|
|
1318
|
+
phone: "",
|
|
1319
|
+
showEmail: true,
|
|
1320
|
+
email: "",
|
|
1321
|
+
showWhatsApp: false,
|
|
1322
|
+
whatsapp: "",
|
|
1323
|
+
showAddress: false,
|
|
1324
|
+
address: ""
|
|
1325
|
+
},
|
|
1326
|
+
footer: {
|
|
1327
|
+
description: "",
|
|
1328
|
+
menuHandle: "footer",
|
|
1329
|
+
copyright: "",
|
|
1330
|
+
instagram: "",
|
|
1331
|
+
facebook: "",
|
|
1332
|
+
twitter: "",
|
|
1333
|
+
tiktok: ""
|
|
1334
|
+
},
|
|
1335
|
+
announcement: {
|
|
1336
|
+
enabled: false,
|
|
1337
|
+
text: "Free shipping on orders over $50!",
|
|
1338
|
+
backgroundColor: "#2563EB",
|
|
1339
|
+
textColor: "#ffffff"
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
sections: {
|
|
1343
|
+
announcement_1: {
|
|
1344
|
+
type: "announcement",
|
|
1345
|
+
settings: {}
|
|
1346
|
+
},
|
|
1347
|
+
header_1: {
|
|
1348
|
+
type: "header",
|
|
1349
|
+
settings: {}
|
|
1350
|
+
},
|
|
1351
|
+
hero_1: {
|
|
1352
|
+
type: "hero",
|
|
1353
|
+
settings: {}
|
|
1354
|
+
},
|
|
1355
|
+
featured_products_1: {
|
|
1356
|
+
type: "featured-products",
|
|
1357
|
+
settings: {}
|
|
1358
|
+
},
|
|
1359
|
+
contact_info_1: {
|
|
1360
|
+
type: "contact-info",
|
|
1361
|
+
settings: {}
|
|
1362
|
+
},
|
|
1363
|
+
footer_1: {
|
|
1364
|
+
type: "footer",
|
|
1365
|
+
settings: {}
|
|
1366
|
+
},
|
|
1367
|
+
"main-product": {
|
|
1368
|
+
type: "product-detail",
|
|
1369
|
+
settings: {}
|
|
1370
|
+
},
|
|
1371
|
+
"main-collection": {
|
|
1372
|
+
type: "product-list",
|
|
1373
|
+
settings: {}
|
|
1374
|
+
},
|
|
1375
|
+
"main-cart": {
|
|
1376
|
+
type: "cart-page",
|
|
1377
|
+
settings: {}
|
|
1378
|
+
},
|
|
1379
|
+
"main-checkout": {
|
|
1380
|
+
type: "checkout-page",
|
|
1381
|
+
settings: {}
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
layout: {
|
|
1385
|
+
header: [
|
|
1386
|
+
"announcement_1",
|
|
1387
|
+
"header_1"
|
|
1388
|
+
],
|
|
1389
|
+
content: [
|
|
1390
|
+
"hero_1",
|
|
1391
|
+
"featured_products_1",
|
|
1392
|
+
"contact_info_1"
|
|
1393
|
+
],
|
|
1394
|
+
footer: [
|
|
1395
|
+
"footer_1"
|
|
1396
|
+
]
|
|
1397
|
+
},
|
|
1398
|
+
templates: {
|
|
1399
|
+
product_detail: { order: ["main-product"] },
|
|
1400
|
+
collection: { order: ["main-collection"] },
|
|
1401
|
+
cart: { order: ["main-cart"] },
|
|
1402
|
+
checkout: { order: ["main-checkout"] }
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
// src/index.ts
|
|
1407
|
+
var theme = defineTheme({
|
|
1408
|
+
handle: "starter",
|
|
1409
|
+
name: "Starter",
|
|
1410
|
+
version: "1.0.0",
|
|
1411
|
+
author: {
|
|
1412
|
+
name: "ZevCommerce",
|
|
1413
|
+
url: "https://zevcommerce.com"
|
|
1414
|
+
},
|
|
1415
|
+
description: "A simple, mobile-first theme for ZevCommerce \u2014 perfect for getting started quickly.",
|
|
1416
|
+
tags: ["simple", "mobile-first", "starter", "minimal", "responsive"],
|
|
1417
|
+
settingsSchema,
|
|
1418
|
+
defaultPreset: preset_default,
|
|
1419
|
+
registry: {
|
|
1420
|
+
sections: starterSectionRegistry,
|
|
1421
|
+
blocks: starterBlockRegistry
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
var index_default = theme;
|
|
1425
|
+
export {
|
|
1426
|
+
index_default as default,
|
|
1427
|
+
settingsSchema,
|
|
1428
|
+
starterBlockRegistry,
|
|
1429
|
+
starterSectionRegistry
|
|
1430
|
+
};
|
|
1431
|
+
//# sourceMappingURL=index.mjs.map
|