@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.cjs
CHANGED
|
@@ -1299,18 +1299,18 @@ 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
|
|
1313
|
-
const tiers =
|
|
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);
|
|
1312
|
+
const rawPricing = product?.pricing_data;
|
|
1313
|
+
const tiers = (Array.isArray(rawPricing) ? rawPricing : rawPricing?.tiers ?? []).sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0));
|
|
1314
1314
|
const lowestPrice = tiers.length > 0 ? Math.min(...tiers.map((t) => t.default_price)) : null;
|
|
1315
1315
|
const handleCOAClick = react.useCallback(() => {
|
|
1316
1316
|
if (coa) setShowCOA(true);
|
|
@@ -1674,6 +1674,15 @@ function COAModal({ coa, theme, onClose }) {
|
|
|
1674
1674
|
/* @__PURE__ */ jsxRuntime.jsx("iframe", { src: coa.url, style: { flex: 1, border: "none", background: "#fff" }, title: "Lab Results" })
|
|
1675
1675
|
] });
|
|
1676
1676
|
}
|
|
1677
|
+
function toNum(v) {
|
|
1678
|
+
if (v === "" || v == null) return null;
|
|
1679
|
+
const n = Number(v);
|
|
1680
|
+
return Number.isFinite(n) ? n : null;
|
|
1681
|
+
}
|
|
1682
|
+
function toStr(v) {
|
|
1683
|
+
if (v == null || v === "") return null;
|
|
1684
|
+
return String(v);
|
|
1685
|
+
}
|
|
1677
1686
|
function strainBadgeColor(strain) {
|
|
1678
1687
|
const s = strain.toLowerCase();
|
|
1679
1688
|
if (s === "sativa") return "#22c55e";
|