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