@neowhale/storefront 0.2.21 → 0.2.26
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 +68 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +68 -4
- package/dist/react/index.js.map +1 -1
- package/package.json +2 -2
package/dist/react/index.js
CHANGED
|
@@ -2781,6 +2781,7 @@ function LeadCaptureSection({ section, data, theme }) {
|
|
|
2781
2781
|
const c = section.content;
|
|
2782
2782
|
const [firstName, setFirstName] = useState("");
|
|
2783
2783
|
const [email, setEmail] = useState("");
|
|
2784
|
+
const [newsletterOptIn, setNewsletterOptIn] = useState(false);
|
|
2784
2785
|
const [status, setStatus] = useState("idle");
|
|
2785
2786
|
const [errorMsg, setErrorMsg] = useState("");
|
|
2786
2787
|
const gatewayUrl = c.gateway_url || data.gatewayUrl || "https://whale-gateway.fly.dev";
|
|
@@ -2800,7 +2801,11 @@ function LeadCaptureSection({ section, data, theme }) {
|
|
|
2800
2801
|
first_name: firstName || void 0,
|
|
2801
2802
|
source: c.source || "landing_page",
|
|
2802
2803
|
landing_page_slug: slug || void 0,
|
|
2803
|
-
tags:
|
|
2804
|
+
tags: (() => {
|
|
2805
|
+
const t = [...c.tags || []];
|
|
2806
|
+
if (newsletterOptIn) t.push(c.newsletter_tag || "newsletter-subscriber");
|
|
2807
|
+
return t.length > 0 ? t : void 0;
|
|
2808
|
+
})()
|
|
2804
2809
|
})
|
|
2805
2810
|
});
|
|
2806
2811
|
if (!res.ok) {
|
|
@@ -2910,6 +2915,33 @@ function LeadCaptureSection({ section, data, theme }) {
|
|
|
2910
2915
|
}
|
|
2911
2916
|
)
|
|
2912
2917
|
] }),
|
|
2918
|
+
c.show_newsletter_opt_in !== false && /* @__PURE__ */ jsxs("label", { style: {
|
|
2919
|
+
display: "flex",
|
|
2920
|
+
alignItems: "center",
|
|
2921
|
+
gap: "0.5rem",
|
|
2922
|
+
cursor: "pointer",
|
|
2923
|
+
fontSize: "0.8rem",
|
|
2924
|
+
color: `${theme.fg}90`,
|
|
2925
|
+
fontWeight: 300,
|
|
2926
|
+
lineHeight: 1.4
|
|
2927
|
+
}, children: [
|
|
2928
|
+
/* @__PURE__ */ jsx(
|
|
2929
|
+
"input",
|
|
2930
|
+
{
|
|
2931
|
+
type: "checkbox",
|
|
2932
|
+
checked: newsletterOptIn,
|
|
2933
|
+
onChange: (e) => setNewsletterOptIn(e.target.checked),
|
|
2934
|
+
style: {
|
|
2935
|
+
width: 16,
|
|
2936
|
+
height: 16,
|
|
2937
|
+
accentColor: theme.accent,
|
|
2938
|
+
cursor: "pointer",
|
|
2939
|
+
flexShrink: 0
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
),
|
|
2943
|
+
c.newsletter_label || "Also sign me up for the newsletter \u2014 new drops, deals, and company news."
|
|
2944
|
+
] }),
|
|
2913
2945
|
status === "error" && errorMsg && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "#e55", margin: 0, fontWeight: 400 }, children: errorMsg }),
|
|
2914
2946
|
/* @__PURE__ */ jsxs(
|
|
2915
2947
|
"button",
|
|
@@ -3147,13 +3179,24 @@ function buildDefaultSections(data) {
|
|
|
3147
3179
|
config: { align: "center" }
|
|
3148
3180
|
});
|
|
3149
3181
|
}
|
|
3182
|
+
const totalMg = toNum(cf?.total_mg_per_package ?? cf?.total_mg);
|
|
3183
|
+
const mgPerPiece = toNum(cf?.mg_per_piece);
|
|
3184
|
+
const piecesPerPkg = toNum(cf?.pieces_per_package);
|
|
3185
|
+
const isEdible = totalMg != null || mgPerPiece != null || piecesPerPkg != null;
|
|
3150
3186
|
const thca = toNum(cf?.thca_percentage);
|
|
3151
3187
|
const thc = toNum(cf?.d9_percentage);
|
|
3152
3188
|
const cbd = toNum(cf?.cbd_total);
|
|
3153
3189
|
const stats = [];
|
|
3154
|
-
if (
|
|
3155
|
-
|
|
3156
|
-
|
|
3190
|
+
if (isEdible) {
|
|
3191
|
+
if (totalMg != null) stats.push({ label: "Total MG", value: `${fmtMg(totalMg)}` });
|
|
3192
|
+
if (mgPerPiece != null) stats.push({ label: "Per Piece", value: `${fmtMg(mgPerPiece)}mg` });
|
|
3193
|
+
if (piecesPerPkg != null) stats.push({ label: "Pieces", value: `${piecesPerPkg}` });
|
|
3194
|
+
if (thc != null) stats.push({ label: "\u03949 THC", value: `${thc.toFixed(thc >= 1 ? 1 : 2)}%` });
|
|
3195
|
+
} else {
|
|
3196
|
+
if (thca != null) stats.push({ label: "THCa", value: `${thca.toFixed(thca >= 1 ? 1 : 2)}%` });
|
|
3197
|
+
if (thc != null) stats.push({ label: "\u03949 THC", value: `${thc.toFixed(thc >= 1 ? 1 : 2)}%` });
|
|
3198
|
+
if (cbd != null) stats.push({ label: "CBD", value: `${cbd.toFixed(cbd >= 1 ? 1 : 2)}%` });
|
|
3199
|
+
}
|
|
3157
3200
|
if (stats.length > 0) {
|
|
3158
3201
|
sections.push({
|
|
3159
3202
|
id: "auto-stats",
|
|
@@ -3162,6 +3205,24 @@ function buildDefaultSections(data) {
|
|
|
3162
3205
|
content: { stats }
|
|
3163
3206
|
});
|
|
3164
3207
|
}
|
|
3208
|
+
if (isEdible) {
|
|
3209
|
+
const servingDetails = [];
|
|
3210
|
+
const servingSize = toStr(cf?.serving_size);
|
|
3211
|
+
const ingredients = toStr(cf?.ingredients);
|
|
3212
|
+
const allergens = toStr(cf?.allergens);
|
|
3213
|
+
if (servingSize) servingDetails.push({ label: "Serving Size", value: servingSize });
|
|
3214
|
+
if (ingredients) servingDetails.push({ label: "Ingredients", value: ingredients });
|
|
3215
|
+
if (allergens) servingDetails.push({ label: "Allergens", value: allergens });
|
|
3216
|
+
if (servingDetails.length > 0) {
|
|
3217
|
+
sections.push({
|
|
3218
|
+
id: "auto-serving",
|
|
3219
|
+
type: "stats",
|
|
3220
|
+
order: order++,
|
|
3221
|
+
content: { stats: servingDetails },
|
|
3222
|
+
config: { layout: "list" }
|
|
3223
|
+
});
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3165
3226
|
const profileDetails = [];
|
|
3166
3227
|
const genetics = toStr(cf?.genetics);
|
|
3167
3228
|
const terpenes = toStr(cf?.terpenes);
|
|
@@ -3233,6 +3294,9 @@ function toNum(v) {
|
|
|
3233
3294
|
const n = Number(v);
|
|
3234
3295
|
return Number.isFinite(n) ? n : null;
|
|
3235
3296
|
}
|
|
3297
|
+
function fmtMg(mg) {
|
|
3298
|
+
return mg === Math.floor(mg) ? `${mg}mg` : `${mg.toFixed(1)}mg`;
|
|
3299
|
+
}
|
|
3236
3300
|
function toStr(v) {
|
|
3237
3301
|
if (v == null || v === "") return null;
|
|
3238
3302
|
return String(v);
|