@neowhale/storefront 0.2.36 → 0.2.37

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.
@@ -379,9 +379,13 @@ var WhaleStorefront = (function (exports) {
379
379
 
380
380
  // src/shims/jsx-runtime-global.ts
381
381
  var R2 = globalThis.React;
382
- var jsx = R2.createElement;
383
- var jsxs = R2.createElement;
384
- R2.createElement;
382
+ function jsx(type, props, key) {
383
+ const { children, ...rest } = props;
384
+ if (key !== void 0) rest.key = key;
385
+ if (children === void 0) return R2.createElement(type, rest);
386
+ if (Array.isArray(children)) return R2.createElement(type, rest, ...children);
387
+ return R2.createElement(type, rest, children);
388
+ }
385
389
  var Fragment2 = R2.Fragment;
386
390
 
387
391
  // src/react/components/sections/shared.tsx
@@ -446,7 +450,7 @@ var WhaleStorefront = (function (exports) {
446
450
  visible
447
451
  );
448
452
  const display = decimals > 0 ? (count / Math.pow(10, decimals)).toFixed(decimals) : hasCommas ? count.toLocaleString() : String(count);
449
- return /* @__PURE__ */ jsxs("span", { ref, children: [
453
+ return /* @__PURE__ */ jsx("span", { ref, children: [
450
454
  prefix,
451
455
  display,
452
456
  suffix
@@ -462,7 +466,7 @@ var WhaleStorefront = (function (exports) {
462
466
  // src/react/components/sections/content-sections.tsx
463
467
  function HeroSection({ section, theme, tracking, onEvent }) {
464
468
  const { title, subtitle, background_image, cta_text, cta_url } = section.content;
465
- return /* @__PURE__ */ jsxs("div", { style: {
469
+ return /* @__PURE__ */ jsx("div", { style: {
466
470
  position: "relative",
467
471
  minHeight: "60vh",
468
472
  display: "flex",
@@ -476,7 +480,7 @@ var WhaleStorefront = (function (exports) {
476
480
  backgroundPosition: "center"
477
481
  }, children: [
478
482
  background_image && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: "rgba(0,0,0,0.5)" } }),
479
- /* @__PURE__ */ jsxs("div", { style: { position: "relative", zIndex: 1, maxWidth: 640 }, children: [
483
+ /* @__PURE__ */ jsx("div", { style: { position: "relative", zIndex: 1, maxWidth: 640 }, children: [
480
484
  title && /* @__PURE__ */ jsx("h1", { style: {
481
485
  fontSize: "clamp(2rem, 8vw, 3rem)",
482
486
  fontWeight: 300,
@@ -522,7 +526,7 @@ var WhaleStorefront = (function (exports) {
522
526
  function TextSection({ section, theme }) {
523
527
  const { heading, body } = section.content;
524
528
  const align = section.config?.align || "left";
525
- return /* @__PURE__ */ jsxs("div", { style: { padding: "2rem 1.5rem", maxWidth: 640, margin: "0 auto", textAlign: align }, children: [
529
+ return /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", maxWidth: 640, margin: "0 auto", textAlign: align }, children: [
526
530
  heading && /* @__PURE__ */ jsx("h2", { style: {
527
531
  fontSize: 11,
528
532
  fontWeight: 500,
@@ -538,7 +542,7 @@ var WhaleStorefront = (function (exports) {
538
542
  const { url, alt, caption } = section.content;
539
543
  const contained = section.config?.contained !== false;
540
544
  if (!url) return null;
541
- return /* @__PURE__ */ jsxs("div", { style: { padding: contained ? "1.5rem" : 0, maxWidth: contained ? 640 : void 0, margin: contained ? "0 auto" : void 0 }, children: [
545
+ return /* @__PURE__ */ jsx("div", { style: { padding: contained ? "1.5rem" : 0, maxWidth: contained ? 640 : void 0, margin: contained ? "0 auto" : void 0 }, children: [
542
546
  /* @__PURE__ */ jsx("img", { src: url, alt: alt || "", style: { width: "100%", display: "block", objectFit: "cover" } }),
543
547
  caption && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: theme.muted, textAlign: "center", marginTop: "0.75rem" }, children: caption })
544
548
  ] });
@@ -585,7 +589,7 @@ var WhaleStorefront = (function (exports) {
585
589
  function CTASection({ section, theme, tracking, onEvent }) {
586
590
  const { title, subtitle, buttons } = section.content;
587
591
  if (!buttons || buttons.length === 0) return null;
588
- return /* @__PURE__ */ jsxs("div", { style: { padding: "2rem 1.5rem", maxWidth: 480, margin: "0 auto", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
592
+ return /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", maxWidth: 480, margin: "0 auto", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
589
593
  title && /* @__PURE__ */ jsx("h2", { style: {
590
594
  fontSize: "clamp(1.25rem, 4vw, 1.5rem)",
591
595
  fontWeight: 300,
@@ -642,8 +646,8 @@ var WhaleStorefront = (function (exports) {
642
646
  const layout = section.config?.layout;
643
647
  if (!stats || stats.length === 0) return null;
644
648
  if (layout === "list") {
645
- return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 640, margin: "0 auto" }, children: stats.map((stat, i) => /* @__PURE__ */ jsxs("div", { children: [
646
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", padding: "0.625rem 0" }, children: [
649
+ return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 640, margin: "0 auto" }, children: stats.map((stat, i) => /* @__PURE__ */ jsx("div", { children: [
650
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", padding: "0.625rem 0" }, children: [
647
651
  /* @__PURE__ */ jsx("span", { style: { fontSize: 12, textTransform: "uppercase", letterSpacing: "0.15em", color: `${theme.fg}66` }, children: stat.label }),
648
652
  /* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 300, color: `${theme.fg}CC` }, children: /* @__PURE__ */ jsx(AnimatedText, { text: stat.value }) })
649
653
  ] }),
@@ -651,7 +655,7 @@ var WhaleStorefront = (function (exports) {
651
655
  ] }, i)) });
652
656
  }
653
657
  const columns = Math.min(stats.length, 4);
654
- return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 640, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(${columns}, 1fr)`, border: `1px solid ${theme.fg}0F` }, children: stats.map((stat, i) => /* @__PURE__ */ jsxs("div", { style: {
658
+ return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 640, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(${columns}, 1fr)`, border: `1px solid ${theme.fg}0F` }, children: stats.map((stat, i) => /* @__PURE__ */ jsx("div", { style: {
655
659
  padding: "1.25rem 0.5rem",
656
660
  textAlign: "center",
657
661
  borderRight: i < stats.length - 1 ? `1px solid ${theme.fg}0F` : void 0
@@ -680,9 +684,9 @@ var WhaleStorefront = (function (exports) {
680
684
  const description = c.description || product?.description || "";
681
685
  const imageUrl = c.image_url || product?.featured_image || null;
682
686
  const url = c.url || null;
683
- return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 480, margin: "0 auto" }, children: /* @__PURE__ */ jsxs("div", { style: { background: theme.surface, overflow: "hidden" }, children: [
687
+ return /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", maxWidth: 480, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { background: theme.surface, overflow: "hidden" }, children: [
684
688
  imageUrl && /* @__PURE__ */ jsx("div", { style: { width: "100%", aspectRatio: "1", overflow: "hidden" }, children: /* @__PURE__ */ jsx("img", { src: imageUrl, alt: name, style: { width: "100%", height: "100%", objectFit: "cover", display: "block" } }) }),
685
- /* @__PURE__ */ jsxs("div", { style: { padding: "1.25rem" }, children: [
689
+ /* @__PURE__ */ jsx("div", { style: { padding: "1.25rem" }, children: [
686
690
  /* @__PURE__ */ jsx("h3", { style: { fontSize: "1.25rem", fontWeight: 600, margin: "0 0 0.5rem", color: theme.fg }, children: name }),
687
691
  description && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.9rem", color: theme.muted, margin: "0 0 1rem", lineHeight: 1.5 }, children: description }),
688
692
  url && /* @__PURE__ */ jsx(
@@ -750,8 +754,8 @@ var WhaleStorefront = (function (exports) {
750
754
  }, style: buttonStyle, children: buttonLabel }) });
751
755
  }
752
756
  function COAModal({ coa, theme, onClose }) {
753
- return /* @__PURE__ */ jsxs("div", { style: { position: "fixed", inset: 0, zIndex: 9999, background: "rgba(0,0,0,0.95)", display: "flex", flexDirection: "column" }, children: [
754
- /* @__PURE__ */ jsxs("div", { style: {
757
+ return /* @__PURE__ */ jsx("div", { style: { position: "fixed", inset: 0, zIndex: 9999, background: "rgba(0,0,0,0.95)", display: "flex", flexDirection: "column" }, children: [
758
+ /* @__PURE__ */ jsx("div", { style: {
755
759
  display: "flex",
756
760
  justifyContent: "space-between",
757
761
  alignItems: "center",
@@ -843,10 +847,10 @@ var WhaleStorefront = (function (exports) {
843
847
  transition: "border-color 0.2s"
844
848
  };
845
849
  if (status === "success") return /* @__PURE__ */ jsx(SuccessState, { theme, heading: successHeading, message: successMessage, couponCode: c.coupon_code });
846
- return /* @__PURE__ */ jsxs("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: [
850
+ return /* @__PURE__ */ jsx("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: [
847
851
  /* @__PURE__ */ jsx("style", { children: `@keyframes lc-spin { to { transform: rotate(360deg) } }` }),
848
- /* @__PURE__ */ jsxs("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)" }, children: [
849
- /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", marginBottom: "clamp(1.5rem, 4vw, 2rem)" }, children: [
852
+ /* @__PURE__ */ jsx("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)" }, children: [
853
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: "clamp(1.5rem, 4vw, 2rem)" }, children: [
850
854
  /* @__PURE__ */ jsx("h2", { style: {
851
855
  fontSize: "clamp(1.5rem, 5vw, 2.25rem)",
852
856
  fontWeight: 300,
@@ -865,12 +869,12 @@ var WhaleStorefront = (function (exports) {
865
869
  letterSpacing: "0.15em"
866
870
  }, children: subtitle })
867
871
  ] }),
868
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
869
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap" }, children: [
872
+ /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
873
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap" }, children: [
870
874
  /* @__PURE__ */ jsx("input", { type: "text", placeholder: "First name", value: firstName, onChange: (e) => setFirstName(e.target.value), style: inputStyle }),
871
875
  /* @__PURE__ */ jsx("input", { type: "email", placeholder: "Email address", value: email, onChange: (e) => setEmail(e.target.value), required: true, style: inputStyle })
872
876
  ] }),
873
- c.show_newsletter_opt_in !== false && /* @__PURE__ */ jsxs("label", { style: {
877
+ c.show_newsletter_opt_in !== false && /* @__PURE__ */ jsx("label", { style: {
874
878
  display: "flex",
875
879
  alignItems: "center",
876
880
  gap: "0.5rem",
@@ -892,7 +896,7 @@ var WhaleStorefront = (function (exports) {
892
896
  c.newsletter_label || "Also sign me up for the newsletter \u2014 new drops, deals, and company news."
893
897
  ] }),
894
898
  status === "error" && errorMsg && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "#e55", margin: 0, fontWeight: 400 }, children: errorMsg }),
895
- /* @__PURE__ */ jsxs("button", { type: "submit", disabled: status === "loading", style: {
899
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: status === "loading", style: {
896
900
  width: "100%",
897
901
  padding: "0.875rem",
898
902
  background: theme.fg,
@@ -927,7 +931,7 @@ var WhaleStorefront = (function (exports) {
927
931
  ] });
928
932
  }
929
933
  function SuccessState({ theme, heading, message, couponCode }) {
930
- return /* @__PURE__ */ jsx("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: /* @__PURE__ */ jsxs("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)", textAlign: "center" }, children: [
934
+ return /* @__PURE__ */ jsx("div", { style: { padding: "3.5rem 1.5rem", maxWidth: 560, margin: "0 auto" }, children: /* @__PURE__ */ jsx("div", { style: { background: theme.surface, border: `1px solid ${theme.fg}12`, padding: "clamp(2rem, 6vw, 3rem)", textAlign: "center" }, children: [
931
935
  /* @__PURE__ */ jsx("h2", { style: {
932
936
  fontSize: "clamp(1.5rem, 5vw, 2rem)",
933
937
  fontWeight: 300,
@@ -1007,7 +1011,7 @@ var WhaleStorefront = (function (exports) {
1007
1011
  obs.observe(el2);
1008
1012
  return () => obs.disconnect();
1009
1013
  }, [section.id, section.type, onEvent]);
1010
- return /* @__PURE__ */ jsxs("div", { ref: sectionRef, "data-section-id": section.id, "data-section-type": section.type, children: [
1014
+ return /* @__PURE__ */ jsx("div", { ref: sectionRef, "data-section-id": section.id, "data-section-type": section.type, children: [
1011
1015
  el,
1012
1016
  showCOA && data?.coa && /* @__PURE__ */ jsx(COAModal, { coa: data.coa, theme, onClose: () => setShowCOA(false) })
1013
1017
  ] });
@@ -1189,7 +1193,7 @@ var WhaleStorefront = (function (exports) {
1189
1193
  const urlParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
1190
1194
  const sorted = [...lp.sections].sort((a, b) => a.order - b.order).filter((s) => isSectionVisible(s, urlParams));
1191
1195
  const sectionData = { ...data, gatewayUrl, landing_page: { slug: lp.slug }, analyticsContext };
1192
- return /* @__PURE__ */ jsxs("div", { style: { minHeight: "100dvh", background: theme.bg, color: theme.fg, fontFamily }, children: [
1196
+ return /* @__PURE__ */ jsx("div", { style: { minHeight: "100dvh", background: theme.bg, color: theme.fg, fontFamily }, children: [
1193
1197
  lp.custom_css && /* @__PURE__ */ jsx("style", { children: lp.custom_css }),
1194
1198
  logoUrl && /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: store?.name || "Store", style: { height: 40, objectFit: "contain" } }) }),
1195
1199
  sorted.map((section) => {
@@ -1197,7 +1201,7 @@ var WhaleStorefront = (function (exports) {
1197
1201
  if (renderSection) return /* @__PURE__ */ jsx("div", { children: renderSection(section, defaultRenderer) }, section.id);
1198
1202
  return /* @__PURE__ */ jsx(SectionRenderer, { section, data: sectionData, theme, onEvent: handleEvent }, section.id);
1199
1203
  }),
1200
- store?.name && /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", borderTop: `1px solid ${theme.surface}`, textAlign: "center" }, children: /* @__PURE__ */ jsxs("p", { style: { fontSize: "0.75rem", color: theme.muted, margin: 0 }, children: [
1204
+ store?.name && /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", borderTop: `1px solid ${theme.surface}`, textAlign: "center" }, children: /* @__PURE__ */ jsx("p", { style: { fontSize: "0.75rem", color: theme.muted, margin: 0 }, children: [
1201
1205
  "Powered by ",
1202
1206
  store.name
1203
1207
  ] }) })
@@ -1225,8 +1229,8 @@ var WhaleStorefront = (function (exports) {
1225
1229
  padding: "2rem"
1226
1230
  };
1227
1231
  function StateScreen({ title, subtitle, loading }) {
1228
- return /* @__PURE__ */ jsx("div", { style: screenStyle, children: /* @__PURE__ */ jsxs("div", { children: [
1229
- loading && /* @__PURE__ */ jsxs(Fragment2, { children: [
1232
+ return /* @__PURE__ */ jsx("div", { style: screenStyle, children: /* @__PURE__ */ jsx("div", { children: [
1233
+ loading && /* @__PURE__ */ jsx(Fragment2, { children: [
1230
1234
  /* @__PURE__ */ jsx("div", { style: { width: 32, height: 32, border: "2px solid #333", borderTopColor: "#fafafa", borderRadius: "50%", animation: "spin 0.8s linear infinite", margin: "0 auto 1rem" } }),
1231
1235
  /* @__PURE__ */ jsx("style", { children: `@keyframes spin { to { transform: rotate(360deg) } }` })
1232
1236
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neowhale/storefront",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "React/Next.js SDK for WhaleTools storefronts — cart, auth, analytics, and more",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",