@neowhale/storefront 0.2.9 → 0.2.10
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 +21 -12
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +21 -12
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1297,18 +1297,18 @@ 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
|
|
1301
|
-
const thc = cf?.d9_percentage
|
|
1302
|
-
const cbd = cf?.cbd_total
|
|
1303
|
-
const strainType = cf?.strain_type
|
|
1304
|
-
const batchNumber = cf?.batch_number
|
|
1305
|
-
const dateTested = cf?.date_tested
|
|
1306
|
-
const terpenes = cf?.terpenes
|
|
1307
|
-
const effects = cf?.effects
|
|
1308
|
-
const genetics = cf?.genetics
|
|
1309
|
-
const tagline = cf?.tagline
|
|
1310
|
-
const
|
|
1311
|
-
const tiers =
|
|
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);
|
|
1310
|
+
const rawPricing = product?.pricing_data;
|
|
1311
|
+
const tiers = (Array.isArray(rawPricing) ? rawPricing : rawPricing?.tiers ?? []).sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0));
|
|
1312
1312
|
const lowestPrice = tiers.length > 0 ? Math.min(...tiers.map((t) => t.default_price)) : null;
|
|
1313
1313
|
const handleCOAClick = useCallback(() => {
|
|
1314
1314
|
if (coa) setShowCOA(true);
|
|
@@ -1672,6 +1672,15 @@ function COAModal({ coa, theme, onClose }) {
|
|
|
1672
1672
|
/* @__PURE__ */ jsx("iframe", { src: coa.url, style: { flex: 1, border: "none", background: "#fff" }, title: "Lab Results" })
|
|
1673
1673
|
] });
|
|
1674
1674
|
}
|
|
1675
|
+
function toNum(v) {
|
|
1676
|
+
if (v === "" || v == null) return null;
|
|
1677
|
+
const n = Number(v);
|
|
1678
|
+
return Number.isFinite(n) ? n : null;
|
|
1679
|
+
}
|
|
1680
|
+
function toStr(v) {
|
|
1681
|
+
if (v == null || v === "") return null;
|
|
1682
|
+
return String(v);
|
|
1683
|
+
}
|
|
1675
1684
|
function strainBadgeColor(strain) {
|
|
1676
1685
|
const s = strain.toLowerCase();
|
|
1677
1686
|
if (s === "sativa") return "#22c55e";
|