@neowhale/storefront 0.2.43 → 0.2.45

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.
@@ -559,30 +559,41 @@ var WhaleStorefront = (function (exports) {
559
559
  if (images.length === 0) return null;
560
560
  c.overlay_opacity ?? 0.45;
561
561
  const count = Math.min(images.length, 5);
562
+ const imgStyle = {
563
+ width: "100%",
564
+ height: "100%",
565
+ objectFit: "cover",
566
+ objectPosition: "center top",
567
+ display: "block"
568
+ };
562
569
  return /* @__PURE__ */ jsx("div", { style: { width: "100%", overflow: "hidden", position: "relative" }, children: [
563
570
  /* @__PURE__ */ jsx("div", { style: {
564
571
  display: "grid",
565
- gridTemplateColumns: count >= 4 ? "repeat(4, 1fr)" : "repeat(2, 1fr)",
566
- gridTemplateRows: count >= 4 ? "minmax(0, 28vh) minmax(0, 28vh)" : "minmax(0, 50vh)",
567
- gap: "2px"
568
- }, children: images.slice(0, count).map((img, i) => /* @__PURE__ */ jsx("div", { style: {
569
- gridColumn: i === 0 && count >= 4 ? "span 2" : void 0,
570
- gridRow: i === 0 && count >= 4 ? "span 2" : void 0,
571
- overflow: "hidden",
572
- background: theme.surface
573
- }, children: /* @__PURE__ */ jsx(
574
- "img",
575
- {
576
- src: img.url,
577
- alt: img.alt || "",
578
- loading: i < 3 ? "eager" : "lazy",
579
- style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
580
- }
581
- ) }, i)) }),
572
+ gridTemplateColumns: count >= 3 ? "3fr 2fr" : "1fr",
573
+ gridTemplateRows: count >= 3 ? "1fr 1fr" : "auto",
574
+ gap: "2px",
575
+ height: "100vh",
576
+ maxHeight: "900px"
577
+ }, children: [
578
+ count > 0 && /* @__PURE__ */ jsx("div", { style: {
579
+ gridRow: count >= 3 ? "1 / -1" : void 0,
580
+ overflow: "hidden",
581
+ background: theme.surface
582
+ }, children: /* @__PURE__ */ jsx("img", { src: images[0].url, alt: images[0].alt || "", loading: "eager", style: imgStyle }) }),
583
+ count >= 2 && /* @__PURE__ */ jsx("div", { style: { overflow: "hidden", background: theme.surface }, children: /* @__PURE__ */ jsx("img", { src: images[1].url, alt: images[1].alt || "", loading: "eager", style: imgStyle }) }),
584
+ count >= 3 && /* @__PURE__ */ jsx("div", { style: {
585
+ overflow: "hidden",
586
+ background: theme.surface,
587
+ ...count >= 4 ? { display: "grid", gridTemplateColumns: count >= 5 ? "1fr 1fr" : count >= 4 ? "1fr 1fr" : "1fr", gap: "2px" } : {}
588
+ }, children: count < 4 ? /* @__PURE__ */ jsx("img", { src: images[2].url, alt: images[2].alt || "", loading: "lazy", style: imgStyle }) : /* @__PURE__ */ jsx(Fragment2, { children: [
589
+ /* @__PURE__ */ jsx("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx("img", { src: images[2].url, alt: images[2].alt || "", loading: "lazy", style: imgStyle }) }),
590
+ count >= 4 && /* @__PURE__ */ jsx("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx("img", { src: images[3].url, alt: images[3].alt || "", loading: "lazy", style: imgStyle }) })
591
+ ] }) })
592
+ ] }),
582
593
  /* @__PURE__ */ jsx("div", { style: {
583
594
  position: "absolute",
584
595
  inset: 0,
585
- background: "linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 40%, transparent 60%)",
596
+ background: "linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.15) 35%, transparent 55%)",
586
597
  pointerEvents: "none"
587
598
  } }),
588
599
  /* @__PURE__ */ jsx("div", { style: {
@@ -1041,6 +1052,302 @@ var WhaleStorefront = (function (exports) {
1041
1052
  ] }) });
1042
1053
  }
1043
1054
 
1055
+ // src/react/components/sections/conversion-sections.tsx
1056
+ function TestimonialsSection({ section, theme }) {
1057
+ const c = section.content;
1058
+ const layout = section.config?.layout || "grid";
1059
+ const reviews = c.reviews || [];
1060
+ if (reviews.length === 0) return null;
1061
+ const overallRating = c.rating ?? 5;
1062
+ const reviewCount = c.review_count ?? reviews.length;
1063
+ return /* @__PURE__ */ jsx("div", { style: { padding: "3rem 1.5rem", maxWidth: 640, margin: "0 auto" }, children: [
1064
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: "2rem" }, children: [
1065
+ c.heading && /* @__PURE__ */ jsx("h2", { style: {
1066
+ fontSize: "clamp(1.25rem, 4vw, 1.75rem)",
1067
+ fontWeight: 300,
1068
+ fontFamily: theme.fontDisplay || "inherit",
1069
+ margin: "0 0 0.75rem",
1070
+ lineHeight: 1.2,
1071
+ letterSpacing: "-0.02em",
1072
+ color: theme.fg
1073
+ }, children: /* @__PURE__ */ jsx(AnimatedText, { text: c.heading }) }),
1074
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "0.5rem", marginBottom: "0.25rem" }, children: [
1075
+ /* @__PURE__ */ jsx(Stars, { rating: overallRating, color: theme.accent, size: 18 }),
1076
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "1.1rem", fontWeight: 500, color: theme.fg }, children: /* @__PURE__ */ jsx(AnimatedText, { text: overallRating.toFixed(1) }) })
1077
+ ] }),
1078
+ c.subtitle ? /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: theme.muted, margin: 0, letterSpacing: "0.1em", textTransform: "uppercase" }, children: c.subtitle }) : /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: theme.muted, margin: 0, letterSpacing: "0.1em", textTransform: "uppercase" }, children: [
1079
+ "from ",
1080
+ /* @__PURE__ */ jsx(AnimatedText, { text: String(reviewCount) }),
1081
+ " reviews"
1082
+ ] })
1083
+ ] }),
1084
+ /* @__PURE__ */ jsx("div", { style: {
1085
+ display: "grid",
1086
+ gridTemplateColumns: layout === "list" ? "1fr" : `repeat(${Math.min(reviews.length, 2)}, 1fr)`,
1087
+ gap: "0.75rem"
1088
+ }, children: reviews.map((review, i) => /* @__PURE__ */ jsx("div", { style: {
1089
+ background: theme.surface,
1090
+ border: `1px solid ${theme.fg}08`,
1091
+ padding: "1.25rem"
1092
+ }, children: [
1093
+ /* @__PURE__ */ jsx(Stars, { rating: review.rating ?? 5, color: theme.accent, size: 14 }),
1094
+ /* @__PURE__ */ jsx("p", { style: {
1095
+ fontSize: "0.88rem",
1096
+ color: `${theme.fg}CC`,
1097
+ margin: "0.75rem 0",
1098
+ lineHeight: 1.6,
1099
+ fontWeight: 300,
1100
+ fontStyle: "italic"
1101
+ }, children: [
1102
+ '"',
1103
+ review.text,
1104
+ '"'
1105
+ ] }),
1106
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "baseline", gap: "0.375rem" }, children: [
1107
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.8rem", fontWeight: 500, color: theme.fg }, children: review.name }),
1108
+ review.location && /* @__PURE__ */ jsx("span", { style: { fontSize: "0.7rem", color: theme.muted }, children: review.location })
1109
+ ] })
1110
+ ] }, i)) })
1111
+ ] });
1112
+ }
1113
+ function Stars({ rating, color, size }) {
1114
+ return /* @__PURE__ */ jsx("span", { style: { display: "inline-flex", gap: "1px" }, children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx(
1115
+ "svg",
1116
+ {
1117
+ width: size,
1118
+ height: size,
1119
+ viewBox: "0 0 20 20",
1120
+ fill: n <= Math.round(rating) ? color : "none",
1121
+ stroke: color,
1122
+ strokeWidth: 1.5,
1123
+ children: /* @__PURE__ */ jsx("path", { d: "M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.5L10 14.26 5.06 16.7l.94-5.5-4-3.9 5.53-.8z" })
1124
+ },
1125
+ n
1126
+ )) });
1127
+ }
1128
+ function ValueStackSection({ section, theme }) {
1129
+ const c = section.content;
1130
+ const items = c.items || [];
1131
+ if (items.length === 0) return null;
1132
+ return /* @__PURE__ */ jsx("div", { style: { padding: "3rem 1.5rem", maxWidth: 520, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}08`, padding: "clamp(1.5rem, 5vw, 2.5rem)" }, children: [
1133
+ c.heading && /* @__PURE__ */ jsx("h2", { style: {
1134
+ fontSize: "clamp(1.25rem, 4vw, 1.5rem)",
1135
+ fontWeight: 300,
1136
+ fontFamily: theme.fontDisplay || "inherit",
1137
+ margin: "0 0 0.25rem",
1138
+ lineHeight: 1.2,
1139
+ letterSpacing: "-0.02em",
1140
+ color: theme.fg,
1141
+ textAlign: "center"
1142
+ }, children: c.heading }),
1143
+ c.subtitle && /* @__PURE__ */ jsx("p", { style: {
1144
+ fontSize: "0.8rem",
1145
+ color: theme.accent,
1146
+ margin: "0 0 1.5rem",
1147
+ letterSpacing: "0.15em",
1148
+ textTransform: "uppercase",
1149
+ textAlign: "center"
1150
+ }, children: c.subtitle }),
1151
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.625rem" }, children: items.map((item, i) => /* @__PURE__ */ jsx("div", { style: {
1152
+ display: "flex",
1153
+ alignItems: "flex-start",
1154
+ gap: "0.75rem",
1155
+ padding: "0.5rem 0",
1156
+ borderBottom: i < items.length - 1 ? `1px solid ${theme.fg}08` : void 0
1157
+ }, children: [
1158
+ /* @__PURE__ */ jsx("span", { style: { color: theme.accent, fontSize: "1rem", lineHeight: 1, flexShrink: 0, marginTop: "0.1rem" }, children: "\u2713" }),
1159
+ /* @__PURE__ */ jsx("span", { style: { flex: 1, fontSize: "0.9rem", color: `${theme.fg}CC`, fontWeight: 300, lineHeight: 1.5 }, children: item.text }),
1160
+ item.value && /* @__PURE__ */ jsx("span", { style: {
1161
+ fontSize: "0.8rem",
1162
+ color: theme.muted,
1163
+ fontWeight: 400,
1164
+ textDecoration: "line-through",
1165
+ flexShrink: 0
1166
+ }, children: item.value })
1167
+ ] }, i)) }),
1168
+ (c.total_value || c.offer_label) && /* @__PURE__ */ jsx("div", { style: {
1169
+ marginTop: "1.5rem",
1170
+ padding: "1rem",
1171
+ background: `${theme.accent}0A`,
1172
+ border: `1px dashed ${theme.accent}30`,
1173
+ textAlign: "center"
1174
+ }, children: [
1175
+ c.total_value && /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: theme.muted, marginBottom: "0.25rem", letterSpacing: "0.1em", textTransform: "uppercase" }, children: [
1176
+ "Total value: ",
1177
+ /* @__PURE__ */ jsx("span", { style: { textDecoration: "line-through" }, children: c.total_value })
1178
+ ] }),
1179
+ /* @__PURE__ */ jsx("div", { style: {
1180
+ fontSize: "clamp(1.25rem, 4vw, 1.5rem)",
1181
+ fontWeight: 500,
1182
+ fontFamily: theme.fontDisplay || "inherit",
1183
+ color: theme.accent
1184
+ }, children: c.offer_label || "Free" })
1185
+ ] })
1186
+ ] }) });
1187
+ }
1188
+ function FAQSection({ section, theme }) {
1189
+ const c = section.content;
1190
+ const items = c.items || [];
1191
+ if (items.length === 0) return null;
1192
+ return /* @__PURE__ */ jsx("div", { style: { padding: "2.5rem 1.5rem", maxWidth: 580, margin: "0 auto" }, children: [
1193
+ c.heading && /* @__PURE__ */ jsx("h2", { style: {
1194
+ fontSize: 11,
1195
+ fontWeight: 500,
1196
+ textTransform: "uppercase",
1197
+ letterSpacing: "0.25em",
1198
+ color: `${theme.fg}40`,
1199
+ margin: "0 0 1.25rem",
1200
+ textAlign: "center"
1201
+ }, children: c.heading }),
1202
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 0 }, children: items.map((item, i) => /* @__PURE__ */ jsx(FAQItem, { question: item.question, answer: item.answer, theme }, i)) })
1203
+ ] });
1204
+ }
1205
+ function FAQItem({ question, answer, theme }) {
1206
+ const [open, setOpen] = useState(false);
1207
+ return /* @__PURE__ */ jsx("div", { style: { borderBottom: `1px solid ${theme.fg}0A` }, children: [
1208
+ /* @__PURE__ */ jsx(
1209
+ "button",
1210
+ {
1211
+ onClick: () => setOpen(!open),
1212
+ style: {
1213
+ width: "100%",
1214
+ display: "flex",
1215
+ justifyContent: "space-between",
1216
+ alignItems: "center",
1217
+ padding: "1rem 0",
1218
+ background: "none",
1219
+ border: "none",
1220
+ cursor: "pointer",
1221
+ color: theme.fg,
1222
+ fontFamily: "inherit",
1223
+ textAlign: "left"
1224
+ },
1225
+ children: [
1226
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.9rem", fontWeight: 400, lineHeight: 1.4 }, children: question }),
1227
+ /* @__PURE__ */ jsx("span", { style: {
1228
+ fontSize: "1.25rem",
1229
+ fontWeight: 200,
1230
+ color: theme.muted,
1231
+ transition: "transform 0.2s",
1232
+ transform: open ? "rotate(45deg)" : "none",
1233
+ flexShrink: 0,
1234
+ marginLeft: "1rem"
1235
+ }, children: "+" })
1236
+ ]
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ jsx("div", { style: {
1240
+ maxHeight: open ? "20rem" : 0,
1241
+ overflow: "hidden",
1242
+ transition: "max-height 0.3s ease"
1243
+ }, children: /* @__PURE__ */ jsx("p", { style: {
1244
+ fontSize: "0.85rem",
1245
+ color: `${theme.fg}88`,
1246
+ lineHeight: 1.7,
1247
+ fontWeight: 300,
1248
+ margin: 0,
1249
+ padding: "0 0 1rem"
1250
+ }, children: answer }) })
1251
+ ] });
1252
+ }
1253
+ function TrustBadgesSection({ section, theme }) {
1254
+ const c = section.content;
1255
+ const badges = c.badges || [];
1256
+ if (badges.length === 0) return null;
1257
+ return /* @__PURE__ */ jsx("div", { style: {
1258
+ padding: "1.25rem 1.5rem",
1259
+ borderTop: `1px solid ${theme.fg}08`,
1260
+ borderBottom: `1px solid ${theme.fg}08`
1261
+ }, children: /* @__PURE__ */ jsx("div", { style: {
1262
+ display: "flex",
1263
+ justifyContent: "center",
1264
+ alignItems: "center",
1265
+ gap: "clamp(1rem, 4vw, 2.5rem)",
1266
+ flexWrap: "wrap"
1267
+ }, children: badges.map((badge, i) => /* @__PURE__ */ jsx("div", { style: {
1268
+ display: "flex",
1269
+ alignItems: "center",
1270
+ gap: "0.375rem"
1271
+ }, children: [
1272
+ badge.icon && /* @__PURE__ */ jsx("span", { style: { fontSize: "0.9rem" }, children: badge.icon }),
1273
+ /* @__PURE__ */ jsx("span", { style: {
1274
+ fontSize: "0.7rem",
1275
+ fontWeight: 500,
1276
+ textTransform: "uppercase",
1277
+ letterSpacing: "0.15em",
1278
+ color: theme.muted
1279
+ }, children: badge.label })
1280
+ ] }, i)) }) });
1281
+ }
1282
+ function CountdownSection({ section, theme }) {
1283
+ const c = section.content;
1284
+ const endDate = c.end_date ? new Date(c.end_date) : null;
1285
+ const [remaining, setRemaining] = useState(null);
1286
+ const [expired, setExpired] = useState(false);
1287
+ useEffect(() => {
1288
+ if (!endDate) return;
1289
+ function tick() {
1290
+ const diff = endDate.getTime() - Date.now();
1291
+ if (diff <= 0) {
1292
+ setExpired(true);
1293
+ return;
1294
+ }
1295
+ setRemaining({
1296
+ d: Math.floor(diff / 864e5),
1297
+ h: Math.floor(diff % 864e5 / 36e5),
1298
+ m: Math.floor(diff % 36e5 / 6e4),
1299
+ s: Math.floor(diff % 6e4 / 1e3)
1300
+ });
1301
+ }
1302
+ tick();
1303
+ const id = setInterval(tick, 1e3);
1304
+ return () => clearInterval(id);
1305
+ }, [endDate?.getTime()]);
1306
+ if (!endDate) return null;
1307
+ if (expired) {
1308
+ return c.expired_text ? /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", textAlign: "center" }, children: /* @__PURE__ */ jsx("p", { style: { fontSize: "0.85rem", color: theme.muted, margin: 0 }, children: c.expired_text }) }) : null;
1309
+ }
1310
+ if (!remaining) return null;
1311
+ const units = [
1312
+ { label: "Days", value: remaining.d },
1313
+ { label: "Hours", value: remaining.h },
1314
+ { label: "Min", value: remaining.m },
1315
+ { label: "Sec", value: remaining.s }
1316
+ ];
1317
+ return /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", maxWidth: 480, margin: "0 auto", textAlign: "center" }, children: [
1318
+ c.heading && /* @__PURE__ */ jsx("p", { style: {
1319
+ fontSize: "0.8rem",
1320
+ color: theme.accent,
1321
+ margin: "0 0 1rem",
1322
+ letterSpacing: "0.15em",
1323
+ textTransform: "uppercase"
1324
+ }, children: c.heading }),
1325
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "center", gap: "0.5rem" }, children: units.map((u) => /* @__PURE__ */ jsx("div", { style: {
1326
+ minWidth: "clamp(3.5rem, 12vw, 4.5rem)",
1327
+ padding: "0.75rem 0.25rem",
1328
+ background: theme.surface,
1329
+ border: `1px solid ${theme.fg}08`
1330
+ }, children: [
1331
+ /* @__PURE__ */ jsx("div", { style: {
1332
+ fontFamily: theme.fontDisplay || "inherit",
1333
+ fontSize: "clamp(1.5rem, 5vw, 2rem)",
1334
+ fontWeight: 300,
1335
+ lineHeight: 1,
1336
+ color: theme.fg,
1337
+ fontVariantNumeric: "tabular-nums"
1338
+ }, children: String(u.value).padStart(2, "0") }),
1339
+ /* @__PURE__ */ jsx("div", { style: {
1340
+ fontSize: "0.6rem",
1341
+ fontWeight: 500,
1342
+ textTransform: "uppercase",
1343
+ letterSpacing: "0.2em",
1344
+ color: theme.muted,
1345
+ marginTop: "0.375rem"
1346
+ }, children: u.label })
1347
+ ] }, u.label)) })
1348
+ ] });
1349
+ }
1350
+
1044
1351
  // src/react/components/section-renderer.tsx
1045
1352
  function SectionRenderer({
1046
1353
  section,
@@ -1076,6 +1383,16 @@ var WhaleStorefront = (function (exports) {
1076
1383
  return /* @__PURE__ */ jsx(SocialLinksSection, { section, theme });
1077
1384
  case "lead_capture":
1078
1385
  return /* @__PURE__ */ jsx(LeadCaptureSection, { section, data, theme, onEvent });
1386
+ case "testimonials":
1387
+ return /* @__PURE__ */ jsx(TestimonialsSection, { section, theme });
1388
+ case "value_stack":
1389
+ return /* @__PURE__ */ jsx(ValueStackSection, { section, theme });
1390
+ case "faq":
1391
+ return /* @__PURE__ */ jsx(FAQSection, { section, theme });
1392
+ case "trust_badges":
1393
+ return /* @__PURE__ */ jsx(TrustBadgesSection, { section, theme });
1394
+ case "countdown":
1395
+ return /* @__PURE__ */ jsx(CountdownSection, { section, theme });
1079
1396
  case "divider":
1080
1397
  return /* @__PURE__ */ jsx(DividerSection, { theme });
1081
1398
  default:
@@ -0,0 +1,117 @@
1
+ import { F as WhaleStorefrontConfig, W as WhaleClient, r as Product } from '../client-D7_7p7ja.cjs';
2
+ import { NextRequest, NextResponse } from 'next/server';
3
+
4
+ /**
5
+ * Security headers for Next.js storefronts.
6
+ */
7
+ declare const securityHeaders: {
8
+ key: string;
9
+ value: string;
10
+ }[];
11
+ /**
12
+ * Returns a Next.js `headers()` config with security headers applied to all routes.
13
+ * Use in next.config.ts:
14
+ *
15
+ * ```ts
16
+ * import { withSecurityHeaders } from '@neowhale/storefront/next'
17
+ * export default { headers: withSecurityHeaders() }
18
+ * ```
19
+ */
20
+ declare function withSecurityHeaders(extra?: {
21
+ key: string;
22
+ value: string;
23
+ }[]): () => Promise<{
24
+ source: string;
25
+ headers: {
26
+ key: string;
27
+ value: string;
28
+ }[];
29
+ }[]>;
30
+
31
+ /**
32
+ * Gateway rewrite rule for Next.js.
33
+ * Proxies client-side /api/gw/* requests to whale-gateway to avoid CORS.
34
+ *
35
+ * Usage in next.config.ts:
36
+ * ```ts
37
+ * import { whaleGatewayRewrite } from '@neowhale/storefront/next'
38
+ * export default {
39
+ * async rewrites() {
40
+ * return [whaleGatewayRewrite()]
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ declare function whaleGatewayRewrite(gatewayUrl?: string, proxyPath?: string): {
46
+ source: string;
47
+ destination: string;
48
+ };
49
+
50
+ /**
51
+ * Creates a server-side WhaleClient.
52
+ * Reads from env vars by default — override with explicit config.
53
+ */
54
+ declare function createServerClient(config?: Partial<WhaleStorefrontConfig>): WhaleClient;
55
+ /**
56
+ * Server-side: fetch all published products with ISR caching.
57
+ * Drop-in replacement for Flora's `getAllProducts()`.
58
+ */
59
+ declare function getAllProducts(options?: {
60
+ /** Revalidate interval in seconds. Defaults to 60. */
61
+ revalidate?: number;
62
+ /** Filter function to exclude products (e.g. hidden categories, out of stock) */
63
+ filter?: (product: Product) => boolean;
64
+ /** Override client config */
65
+ client?: WhaleClient;
66
+ }): Promise<Product[]>;
67
+
68
+ interface ImageLoaderParams {
69
+ src: string;
70
+ width: number;
71
+ quality?: number;
72
+ }
73
+ /**
74
+ * Creates a Next.js custom image loader that proxies Supabase images through gateway.
75
+ *
76
+ * Usage in a loader file (e.g. src/lib/image-loader.ts):
77
+ * ```ts
78
+ * import { createImageLoader } from '@neowhale/storefront/next'
79
+ * export default createImageLoader({
80
+ * storeId: process.env.NEXT_PUBLIC_STORE_ID!,
81
+ * gatewayUrl: 'https://whale-gateway.fly.dev',
82
+ * supabaseHost: 'your-project.supabase.co',
83
+ * signingSecret: process.env.NEXT_PUBLIC_MEDIA_SIGNING_SECRET!,
84
+ * })
85
+ * ```
86
+ */
87
+ declare function createImageLoader(config: {
88
+ storeId: string;
89
+ gatewayUrl: string;
90
+ supabaseHost: string;
91
+ signingSecret: string;
92
+ }): (params: ImageLoaderParams) => string;
93
+
94
+ /**
95
+ * Creates a Next.js middleware that protects routes requiring authentication.
96
+ *
97
+ * Checks for a session token cookie or localStorage indicator.
98
+ * Since middleware runs on the edge and can't access localStorage,
99
+ * this checks for a cookie-based token instead.
100
+ *
101
+ * Usage in middleware.ts:
102
+ * ```ts
103
+ * import { createAuthMiddleware } from '@neowhale/storefront/next'
104
+ * export const middleware = createAuthMiddleware({
105
+ * protectedPaths: ['/account'],
106
+ * loginPath: '/account',
107
+ * })
108
+ * export const config = { matcher: ['/account/:path*'] }
109
+ * ```
110
+ */
111
+ declare function createAuthMiddleware(options: {
112
+ protectedPaths: string[];
113
+ loginPath: string;
114
+ cookieName?: string;
115
+ }): (request: NextRequest) => NextResponse<unknown>;
116
+
117
+ export { createAuthMiddleware, createImageLoader, createServerClient, getAllProducts, securityHeaders, whaleGatewayRewrite, withSecurityHeaders };
@@ -0,0 +1,117 @@
1
+ import { F as WhaleStorefrontConfig, W as WhaleClient, r as Product } from '../client-D7_7p7ja.js';
2
+ import { NextRequest, NextResponse } from 'next/server';
3
+
4
+ /**
5
+ * Security headers for Next.js storefronts.
6
+ */
7
+ declare const securityHeaders: {
8
+ key: string;
9
+ value: string;
10
+ }[];
11
+ /**
12
+ * Returns a Next.js `headers()` config with security headers applied to all routes.
13
+ * Use in next.config.ts:
14
+ *
15
+ * ```ts
16
+ * import { withSecurityHeaders } from '@neowhale/storefront/next'
17
+ * export default { headers: withSecurityHeaders() }
18
+ * ```
19
+ */
20
+ declare function withSecurityHeaders(extra?: {
21
+ key: string;
22
+ value: string;
23
+ }[]): () => Promise<{
24
+ source: string;
25
+ headers: {
26
+ key: string;
27
+ value: string;
28
+ }[];
29
+ }[]>;
30
+
31
+ /**
32
+ * Gateway rewrite rule for Next.js.
33
+ * Proxies client-side /api/gw/* requests to whale-gateway to avoid CORS.
34
+ *
35
+ * Usage in next.config.ts:
36
+ * ```ts
37
+ * import { whaleGatewayRewrite } from '@neowhale/storefront/next'
38
+ * export default {
39
+ * async rewrites() {
40
+ * return [whaleGatewayRewrite()]
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ declare function whaleGatewayRewrite(gatewayUrl?: string, proxyPath?: string): {
46
+ source: string;
47
+ destination: string;
48
+ };
49
+
50
+ /**
51
+ * Creates a server-side WhaleClient.
52
+ * Reads from env vars by default — override with explicit config.
53
+ */
54
+ declare function createServerClient(config?: Partial<WhaleStorefrontConfig>): WhaleClient;
55
+ /**
56
+ * Server-side: fetch all published products with ISR caching.
57
+ * Drop-in replacement for Flora's `getAllProducts()`.
58
+ */
59
+ declare function getAllProducts(options?: {
60
+ /** Revalidate interval in seconds. Defaults to 60. */
61
+ revalidate?: number;
62
+ /** Filter function to exclude products (e.g. hidden categories, out of stock) */
63
+ filter?: (product: Product) => boolean;
64
+ /** Override client config */
65
+ client?: WhaleClient;
66
+ }): Promise<Product[]>;
67
+
68
+ interface ImageLoaderParams {
69
+ src: string;
70
+ width: number;
71
+ quality?: number;
72
+ }
73
+ /**
74
+ * Creates a Next.js custom image loader that proxies Supabase images through gateway.
75
+ *
76
+ * Usage in a loader file (e.g. src/lib/image-loader.ts):
77
+ * ```ts
78
+ * import { createImageLoader } from '@neowhale/storefront/next'
79
+ * export default createImageLoader({
80
+ * storeId: process.env.NEXT_PUBLIC_STORE_ID!,
81
+ * gatewayUrl: 'https://whale-gateway.fly.dev',
82
+ * supabaseHost: 'your-project.supabase.co',
83
+ * signingSecret: process.env.NEXT_PUBLIC_MEDIA_SIGNING_SECRET!,
84
+ * })
85
+ * ```
86
+ */
87
+ declare function createImageLoader(config: {
88
+ storeId: string;
89
+ gatewayUrl: string;
90
+ supabaseHost: string;
91
+ signingSecret: string;
92
+ }): (params: ImageLoaderParams) => string;
93
+
94
+ /**
95
+ * Creates a Next.js middleware that protects routes requiring authentication.
96
+ *
97
+ * Checks for a session token cookie or localStorage indicator.
98
+ * Since middleware runs on the edge and can't access localStorage,
99
+ * this checks for a cookie-based token instead.
100
+ *
101
+ * Usage in middleware.ts:
102
+ * ```ts
103
+ * import { createAuthMiddleware } from '@neowhale/storefront/next'
104
+ * export const middleware = createAuthMiddleware({
105
+ * protectedPaths: ['/account'],
106
+ * loginPath: '/account',
107
+ * })
108
+ * export const config = { matcher: ['/account/:path*'] }
109
+ * ```
110
+ */
111
+ declare function createAuthMiddleware(options: {
112
+ protectedPaths: string[];
113
+ loginPath: string;
114
+ cookieName?: string;
115
+ }): (request: NextRequest) => NextResponse<unknown>;
116
+
117
+ export { createAuthMiddleware, createImageLoader, createServerClient, getAllProducts, securityHeaders, whaleGatewayRewrite, withSecurityHeaders };
@@ -0,0 +1,10 @@
1
+ import { p as PixelConfig } from './client-D7_7p7ja.cjs';
2
+
3
+ declare class PixelManager {
4
+ private providers;
5
+ constructor(configs: PixelConfig[]);
6
+ initialize(): Promise<void>;
7
+ track(event: string, params?: Record<string, unknown>): void;
8
+ }
9
+
10
+ export { PixelManager as P };
@@ -0,0 +1,10 @@
1
+ import { p as PixelConfig } from './client-D7_7p7ja.js';
2
+
3
+ declare class PixelManager {
4
+ private providers;
5
+ constructor(configs: PixelConfig[]);
6
+ initialize(): Promise<void>;
7
+ track(event: string, params?: Record<string, unknown>): void;
8
+ }
9
+
10
+ export { PixelManager as P };