@neowhale/storefront 0.2.9 → 0.2.11

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.
@@ -1297,19 +1297,16 @@ function ProductLanding({
1297
1297
  const ctaUrl = lp.cta_url || qr.destination_url;
1298
1298
  const categoryName = product?.category_name ?? null;
1299
1299
  const cf = product?.custom_fields;
1300
- const thca = cf?.thca_percentage ?? null;
1301
- const thc = cf?.d9_percentage ?? null;
1302
- const cbd = cf?.cbd_total ?? null;
1303
- const strainType = cf?.strain_type ?? null;
1304
- const batchNumber = cf?.batch_number ?? null;
1305
- const dateTested = cf?.date_tested ?? null;
1306
- const terpenes = cf?.terpenes ?? null;
1307
- const effects = cf?.effects ?? null;
1308
- const genetics = cf?.genetics ?? null;
1309
- const tagline = cf?.tagline ?? null;
1310
- const pricingData = product?.pricing_data;
1311
- const tiers = pricingData?.tiers?.sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0)) ?? [];
1312
- const lowestPrice = tiers.length > 0 ? Math.min(...tiers.map((t) => t.default_price)) : null;
1300
+ const thca = toNum(cf?.thca_percentage);
1301
+ const thc = toNum(cf?.d9_percentage);
1302
+ const cbd = toNum(cf?.cbd_total);
1303
+ const strainType = toStr(cf?.strain_type);
1304
+ const batchNumber = toStr(cf?.batch_number);
1305
+ const dateTested = toStr(cf?.date_tested);
1306
+ const terpenes = toStr(cf?.terpenes);
1307
+ const effects = toStr(cf?.effects);
1308
+ const genetics = toStr(cf?.genetics);
1309
+ const tagline = toStr(cf?.tagline);
1313
1310
  const handleCOAClick = useCallback(() => {
1314
1311
  if (coa) setShowCOA(true);
1315
1312
  }, [coa]);
@@ -1412,16 +1409,6 @@ function ProductLanding({
1412
1409
  color: `${theme.fg}80`,
1413
1410
  margin: "0.5rem 0 0"
1414
1411
  }, children: tagline }),
1415
- lowestPrice != null && /* @__PURE__ */ jsxs("p", { style: {
1416
- fontFamily: theme.fontDisplay,
1417
- fontSize: "1.5rem",
1418
- fontWeight: 300,
1419
- margin: "0.75rem 0 0"
1420
- }, children: [
1421
- "$",
1422
- lowestPrice.toFixed(2),
1423
- tiers.length > 1 && /* @__PURE__ */ jsx("span", { style: { fontSize: "0.8rem", color: `${theme.fg}50`, marginLeft: "0.5rem", fontWeight: 400 }, children: "and up" })
1424
- ] }),
1425
1412
  renderProduct ? renderProduct(data) : null,
1426
1413
  (thca != null || thc != null || cbd != null) && /* @__PURE__ */ jsxs("div", { style: {
1427
1414
  marginTop: "1.75rem",
@@ -1433,22 +1420,6 @@ function ProductLanding({
1433
1420
  thc != null && /* @__PURE__ */ jsx(CannabinoidStat, { label: "\u03949 THC", value: thc, theme, showBorder: cbd != null }),
1434
1421
  cbd != null && /* @__PURE__ */ jsx(CannabinoidStat, { label: "CBD", value: cbd, theme, showBorder: false })
1435
1422
  ] }),
1436
- tiers.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginTop: "1.5rem" }, children: [
1437
- /* @__PURE__ */ jsx("p", { style: { ...labelStyle, marginBottom: "0.75rem" }, children: "Pricing" }),
1438
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 1 }, children: tiers.map((tier) => /* @__PURE__ */ jsxs("div", { style: {
1439
- flex: "1 1 0",
1440
- minWidth: 90,
1441
- padding: "0.75rem 0.5rem",
1442
- background: theme.surfaceLight,
1443
- textAlign: "center"
1444
- }, children: [
1445
- /* @__PURE__ */ jsxs("div", { style: { fontSize: "1rem", fontWeight: 300, fontFamily: theme.fontDisplay }, children: [
1446
- "$",
1447
- tier.default_price.toFixed(2)
1448
- ] }),
1449
- /* @__PURE__ */ jsx("div", { style: { fontSize: 10, color: `${theme.fg}60`, letterSpacing: "0.1em", textTransform: "uppercase", marginTop: 2 }, children: tier.label })
1450
- ] }, tier.id)) })
1451
- ] }),
1452
1423
  (genetics || terpenes || effects || batchNumber || dateTested) && /* @__PURE__ */ jsxs("div", { style: { marginTop: "1.75rem" }, children: [
1453
1424
  /* @__PURE__ */ jsx("p", { style: { ...labelStyle, marginBottom: "0.75rem" }, children: "Details" }),
1454
1425
  /* @__PURE__ */ jsxs("div", { children: [
@@ -1672,6 +1643,15 @@ function COAModal({ coa, theme, onClose }) {
1672
1643
  /* @__PURE__ */ jsx("iframe", { src: coa.url, style: { flex: 1, border: "none", background: "#fff" }, title: "Lab Results" })
1673
1644
  ] });
1674
1645
  }
1646
+ function toNum(v) {
1647
+ if (v === "" || v == null) return null;
1648
+ const n = Number(v);
1649
+ return Number.isFinite(n) ? n : null;
1650
+ }
1651
+ function toStr(v) {
1652
+ if (v == null || v === "") return null;
1653
+ return String(v);
1654
+ }
1675
1655
  function strainBadgeColor(strain) {
1676
1656
  const s = strain.toLowerCase();
1677
1657
  if (s === "sativa") return "#22c55e";