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