@neowhale/storefront 0.2.38 → 0.2.40

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.
@@ -556,7 +556,24 @@ var WhaleStorefront = (function (exports) {
556
556
  function GallerySection({ section, theme }) {
557
557
  const { images } = section.content;
558
558
  const columns = section.config?.columns || 3;
559
+ const layout = section.config?.layout || "grid";
559
560
  if (!images || images.length === 0) return null;
561
+ if (layout === "collage") {
562
+ return /* @__PURE__ */ jsx("div", { style: { padding: "0.375rem", maxWidth: 900, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.375rem" }, children: images.map((img, i) => /* @__PURE__ */ jsx("div", { style: {
563
+ gridColumn: i === 0 ? "1 / -1" : void 0,
564
+ aspectRatio: i === 0 ? "16/9" : i % 3 === 0 ? "3/4" : "1",
565
+ overflow: "hidden",
566
+ background: theme.surface
567
+ }, children: /* @__PURE__ */ jsx(
568
+ "img",
569
+ {
570
+ src: img.url,
571
+ alt: img.alt || "",
572
+ loading: i < 2 ? "eager" : "lazy",
573
+ style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
574
+ }
575
+ ) }, i)) }) });
576
+ }
560
577
  return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 800, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(${columns}, 1fr)`, gap: "0.5rem" }, children: images.map((img, i) => /* @__PURE__ */ jsx("div", { style: { aspectRatio: "1", overflow: "hidden", background: theme.surface }, children: /* @__PURE__ */ jsx("img", { src: img.url, alt: img.alt || "", style: { width: "100%", height: "100%", objectFit: "cover", display: "block" } }) }, i)) }) });
561
578
  }
562
579
  function SocialLinksSection({ section, theme }) {
@@ -784,6 +801,7 @@ var WhaleStorefront = (function (exports) {
784
801
  const [newsletterOptIn, setNewsletterOptIn] = useState(false);
785
802
  const [status, setStatus] = useState("idle");
786
803
  const [errorMsg, setErrorMsg] = useState("");
804
+ const [serverMessage, setServerMessage] = useState(null);
787
805
  const gatewayUrl = c.gateway_url || data.gatewayUrl || "https://whale-gateway.fly.dev";
788
806
  const storeId = c.store_id || data.store?.id;
789
807
  const slug = c.landing_page_slug || data.landing_page?.slug;
@@ -822,8 +840,15 @@ var WhaleStorefront = (function (exports) {
822
840
  })
823
841
  });
824
842
  if (!res.ok) {
825
- const body = await res.json().catch(() => ({}));
826
- throw new Error(body?.error?.message || "Something went wrong. Please try again.");
843
+ const body2 = await res.json().catch(() => ({}));
844
+ throw new Error(body2?.error?.message || "Something went wrong. Please try again.");
845
+ }
846
+ const body = await res.json().catch(() => ({}));
847
+ if (body.is_new === false) {
848
+ setServerMessage({
849
+ heading: "welcome back!",
850
+ message: body.message || "your rewards are already loaded."
851
+ });
827
852
  }
828
853
  setStatus("success");
829
854
  onEvent?.("lead", { email, first_name: firstName || void 0, source: c.source || "landing_page", landing_page_slug: slug || void 0 });
@@ -846,7 +871,7 @@ var WhaleStorefront = (function (exports) {
846
871
  fontFamily: "inherit",
847
872
  transition: "border-color 0.2s"
848
873
  };
849
- if (status === "success") return /* @__PURE__ */ jsx(SuccessState, { theme, heading: successHeading, message: successMessage, couponCode: c.coupon_code });
874
+ if (status === "success") return /* @__PURE__ */ jsx(SuccessState, { theme, heading: serverMessage?.heading || successHeading, message: serverMessage?.message || successMessage, couponCode: c.coupon_code });
850
875
  return /* @__PURE__ */ jsx("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: [
851
876
  /* @__PURE__ */ jsx("style", { children: `@keyframes lc-spin { to { transform: rotate(360deg) } }` }),
852
877
  /* @__PURE__ */ jsx("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)" }, children: [
@@ -2300,7 +2300,24 @@ function VideoSection({ section, theme }) {
2300
2300
  function GallerySection({ section, theme }) {
2301
2301
  const { images } = section.content;
2302
2302
  const columns = section.config?.columns || 3;
2303
+ const layout = section.config?.layout || "grid";
2303
2304
  if (!images || images.length === 0) return null;
2305
+ if (layout === "collage") {
2306
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "0.375rem", maxWidth: 900, margin: "0 auto" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.375rem" }, children: images.map((img, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
2307
+ gridColumn: i === 0 ? "1 / -1" : void 0,
2308
+ aspectRatio: i === 0 ? "16/9" : i % 3 === 0 ? "3/4" : "1",
2309
+ overflow: "hidden",
2310
+ background: theme.surface
2311
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(
2312
+ "img",
2313
+ {
2314
+ src: img.url,
2315
+ alt: img.alt || "",
2316
+ loading: i < 2 ? "eager" : "lazy",
2317
+ style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
2318
+ }
2319
+ ) }, i)) }) });
2320
+ }
2304
2321
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "1.5rem", maxWidth: 800, margin: "0 auto" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(${columns}, 1fr)`, gap: "0.5rem" }, children: images.map((img, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { aspectRatio: "1", overflow: "hidden", background: theme.surface }, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: img.url, alt: img.alt || "", style: { width: "100%", height: "100%", objectFit: "cover", display: "block" } }) }, i)) }) });
2305
2322
  }
2306
2323
  function SocialLinksSection({ section, theme }) {
@@ -2524,6 +2541,7 @@ function LeadCaptureSection({ section, data, theme, onEvent }) {
2524
2541
  const [newsletterOptIn, setNewsletterOptIn] = react.useState(false);
2525
2542
  const [status, setStatus] = react.useState("idle");
2526
2543
  const [errorMsg, setErrorMsg] = react.useState("");
2544
+ const [serverMessage, setServerMessage] = react.useState(null);
2527
2545
  const gatewayUrl = c.gateway_url || data.gatewayUrl || "https://whale-gateway.fly.dev";
2528
2546
  const storeId = c.store_id || data.store?.id;
2529
2547
  const slug = c.landing_page_slug || data.landing_page?.slug;
@@ -2562,8 +2580,15 @@ function LeadCaptureSection({ section, data, theme, onEvent }) {
2562
2580
  })
2563
2581
  });
2564
2582
  if (!res.ok) {
2565
- const body = await res.json().catch(() => ({}));
2566
- throw new Error(body?.error?.message || "Something went wrong. Please try again.");
2583
+ const body2 = await res.json().catch(() => ({}));
2584
+ throw new Error(body2?.error?.message || "Something went wrong. Please try again.");
2585
+ }
2586
+ const body = await res.json().catch(() => ({}));
2587
+ if (body.is_new === false) {
2588
+ setServerMessage({
2589
+ heading: "welcome back!",
2590
+ message: body.message || "your rewards are already loaded."
2591
+ });
2567
2592
  }
2568
2593
  setStatus("success");
2569
2594
  onEvent?.("lead", { email, first_name: firstName || void 0, source: c.source || "landing_page", landing_page_slug: slug || void 0 });
@@ -2586,7 +2611,7 @@ function LeadCaptureSection({ section, data, theme, onEvent }) {
2586
2611
  fontFamily: "inherit",
2587
2612
  transition: "border-color 0.2s"
2588
2613
  };
2589
- if (status === "success") return /* @__PURE__ */ jsxRuntime.jsx(SuccessState, { theme, heading: successHeading, message: successMessage, couponCode: c.coupon_code });
2614
+ if (status === "success") return /* @__PURE__ */ jsxRuntime.jsx(SuccessState, { theme, heading: serverMessage?.heading || successHeading, message: serverMessage?.message || successMessage, couponCode: c.coupon_code });
2590
2615
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: [
2591
2616
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `@keyframes lc-spin { to { transform: rotate(360deg) } }` }),
2592
2617
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)" }, children: [