@neowhale/storefront 0.2.30 → 0.2.31
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 +18 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +7 -1
- package/dist/react/index.d.ts +7 -1
- package/dist/react/index.js +18 -6
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -555,7 +555,9 @@ function useAnalytics() {
|
|
|
555
555
|
/** Whether tracking is globally enabled for this storefront */
|
|
556
556
|
trackingEnabled,
|
|
557
557
|
/** Configured recording sample rate (0–1) for behavioral session replays */
|
|
558
|
-
recordingRate: config.recordingRate
|
|
558
|
+
recordingRate: config.recordingRate,
|
|
559
|
+
/** Stable visitor ID for cross-session attribution */
|
|
560
|
+
visitorId: getVisitorId(config.storagePrefix)
|
|
559
561
|
};
|
|
560
562
|
}
|
|
561
563
|
function useAuth() {
|
|
@@ -2902,6 +2904,8 @@ function LeadCaptureSection({ section, data, theme, onEvent }) {
|
|
|
2902
2904
|
if (!email || !storeId) return;
|
|
2903
2905
|
setStatus("loading");
|
|
2904
2906
|
setErrorMsg("");
|
|
2907
|
+
const urlParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : null;
|
|
2908
|
+
const analyticsData = data.analyticsContext;
|
|
2905
2909
|
try {
|
|
2906
2910
|
const res = await fetch(`${gatewayUrl}/v1/stores/${storeId}/storefront/leads`, {
|
|
2907
2911
|
method: "POST",
|
|
@@ -2916,7 +2920,13 @@ function LeadCaptureSection({ section, data, theme, onEvent }) {
|
|
|
2916
2920
|
const t = [...c.tags || []];
|
|
2917
2921
|
if (newsletterOptIn) t.push(c.newsletter_tag || "newsletter-subscriber");
|
|
2918
2922
|
return t.length > 0 ? t : void 0;
|
|
2919
|
-
})()
|
|
2923
|
+
})(),
|
|
2924
|
+
visitor_id: analyticsData?.visitorId || void 0,
|
|
2925
|
+
session_id: analyticsData?.sessionId || void 0,
|
|
2926
|
+
utm_source: urlParams?.get("utm_source") || void 0,
|
|
2927
|
+
utm_medium: urlParams?.get("utm_medium") || void 0,
|
|
2928
|
+
utm_campaign: urlParams?.get("utm_campaign") || void 0,
|
|
2929
|
+
utm_content: urlParams?.get("utm_content") || void 0
|
|
2920
2930
|
})
|
|
2921
2931
|
});
|
|
2922
2932
|
if (!res.ok) {
|
|
@@ -3462,7 +3472,8 @@ function LandingPage({
|
|
|
3462
3472
|
renderSection,
|
|
3463
3473
|
onDataLoaded,
|
|
3464
3474
|
onError,
|
|
3465
|
-
onEvent
|
|
3475
|
+
onEvent,
|
|
3476
|
+
analyticsContext
|
|
3466
3477
|
}) {
|
|
3467
3478
|
const [state, setState] = react.useState("loading");
|
|
3468
3479
|
const [data, setData] = react.useState(null);
|
|
@@ -3510,13 +3521,14 @@ function LandingPage({
|
|
|
3510
3521
|
if (state === "expired") return /* @__PURE__ */ jsxRuntime.jsx(DefaultExpired2, {});
|
|
3511
3522
|
if (state === "error") return /* @__PURE__ */ jsxRuntime.jsx(DefaultError2, { message: errorMsg });
|
|
3512
3523
|
if (!data) return null;
|
|
3513
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PageLayout, { data, gatewayUrl, renderSection, onEvent });
|
|
3524
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PageLayout, { data, gatewayUrl, renderSection, onEvent, analyticsContext });
|
|
3514
3525
|
}
|
|
3515
3526
|
function PageLayout({
|
|
3516
3527
|
data,
|
|
3517
3528
|
gatewayUrl,
|
|
3518
3529
|
renderSection,
|
|
3519
|
-
onEvent
|
|
3530
|
+
onEvent,
|
|
3531
|
+
analyticsContext
|
|
3520
3532
|
}) {
|
|
3521
3533
|
const { landing_page: lp, store } = data;
|
|
3522
3534
|
const theme = {
|
|
@@ -3531,7 +3543,7 @@ function PageLayout({
|
|
|
3531
3543
|
const fontFamily = lp.font_family || theme.fontDisplay || "system-ui, -apple-system, sans-serif";
|
|
3532
3544
|
const logoUrl = store?.logo_url;
|
|
3533
3545
|
const sorted = [...lp.sections].sort((a, b) => a.order - b.order);
|
|
3534
|
-
const sectionData = { ...data, gatewayUrl, landing_page: { slug: lp.slug } };
|
|
3546
|
+
const sectionData = { ...data, gatewayUrl, landing_page: { slug: lp.slug }, analyticsContext };
|
|
3535
3547
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minHeight: "100dvh", background: theme.bg, color: theme.fg, fontFamily }, children: [
|
|
3536
3548
|
lp.custom_css && /* @__PURE__ */ jsxRuntime.jsx("style", { children: lp.custom_css }),
|
|
3537
3549
|
logoUrl && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "1.5rem", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoUrl, alt: store?.name || "Store", style: { height: 40, objectFit: "contain" } }) }),
|