@neowhale/storefront 0.2.31 → 0.2.33
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/{chunk-WNZOA4FB.js → chunk-2XODSXJT.js} +2 -2
- package/dist/{chunk-WNZOA4FB.js.map → chunk-2XODSXJT.js.map} +1 -1
- package/dist/{chunk-V5KCIYKG.cjs → chunk-HSGM4XMK.cjs} +2 -2
- package/dist/{chunk-V5KCIYKG.cjs.map → chunk-HSGM4XMK.cjs.map} +1 -1
- package/dist/{client-CwCSPAHp.d.cts → client-CUKv5fMM.d.cts} +2 -0
- package/dist/{client-CwCSPAHp.d.ts → client-CUKv5fMM.d.ts} +2 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/next/index.cjs +4 -4
- package/dist/next/index.d.cts +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +1 -1
- package/dist/{pixel-manager-LiLpBmPy.d.ts → pixel-manager-DsrUxlIB.d.ts} +1 -1
- package/dist/{pixel-manager-ti1xc1eC.d.cts → pixel-manager-oZStK6GU.d.cts} +1 -1
- package/dist/react/index.cjs +23 -7
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +19 -3
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.d.cts
CHANGED
package/dist/next/index.d.ts
CHANGED
package/dist/next/index.js
CHANGED
package/dist/react/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkUW2U5BRY_cjs = require('../chunk-UW2U5BRY.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkHSGM4XMK_cjs = require('../chunk-HSGM4XMK.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var navigation = require('next/navigation');
|
|
7
7
|
var vanilla = require('zustand/vanilla');
|
|
@@ -1068,7 +1068,7 @@ function BehavioralTrackerComponent({ pathname }) {
|
|
|
1068
1068
|
const baseUrl = config.proxyPath;
|
|
1069
1069
|
const endpoint = `${baseUrl}/v1/stores/${config.storeId}/storefront/behavioral`;
|
|
1070
1070
|
const sendBatch = async (batch) => {
|
|
1071
|
-
await
|
|
1071
|
+
await chunkHSGM4XMK_cjs.resilientSend(endpoint, batch, {
|
|
1072
1072
|
"Content-Type": "application/json",
|
|
1073
1073
|
"x-api-key": config.apiKey
|
|
1074
1074
|
});
|
|
@@ -1254,7 +1254,7 @@ function FingerprintCollector() {
|
|
|
1254
1254
|
collectFingerprint().then(async (fp) => {
|
|
1255
1255
|
const baseUrl = config.proxyPath;
|
|
1256
1256
|
const url = `${baseUrl}/v1/stores/${config.storeId}/storefront/fingerprints`;
|
|
1257
|
-
await
|
|
1257
|
+
await chunkHSGM4XMK_cjs.resilientSend(url, fp, {
|
|
1258
1258
|
"Content-Type": "application/json",
|
|
1259
1259
|
"x-api-key": config.apiKey
|
|
1260
1260
|
}).catch(() => {
|
|
@@ -1635,7 +1635,7 @@ function SessionRecorderComponent() {
|
|
|
1635
1635
|
const sid = sessionId;
|
|
1636
1636
|
const recorder = new SessionRecorder({
|
|
1637
1637
|
sendChunk: async (events, sequence) => {
|
|
1638
|
-
await
|
|
1638
|
+
await chunkHSGM4XMK_cjs.resilientSend(url, {
|
|
1639
1639
|
session_id: sid,
|
|
1640
1640
|
visitor_id: visitorId,
|
|
1641
1641
|
events,
|
|
@@ -1714,7 +1714,7 @@ function WhaleProvider({
|
|
|
1714
1714
|
trackingEnabled: trackingEnabled ?? envBool("NEXT_PUBLIC_TRACKING_ENABLED") ?? true,
|
|
1715
1715
|
recordingRate: recordingRate ?? envNumber("NEXT_PUBLIC_RECORDING_RATE") ?? 0.1
|
|
1716
1716
|
};
|
|
1717
|
-
const client = new
|
|
1717
|
+
const client = new chunkHSGM4XMK_cjs.WhaleClient({
|
|
1718
1718
|
storeId,
|
|
1719
1719
|
apiKey,
|
|
1720
1720
|
gatewayUrl: resolvedConfig.gatewayUrl,
|
|
@@ -1868,6 +1868,7 @@ function useCustomerAnalytics() {
|
|
|
1868
1868
|
function useCheckout() {
|
|
1869
1869
|
const ctx = react.useContext(WhaleContext);
|
|
1870
1870
|
if (!ctx) throw new Error("useCheckout must be used within <WhaleProvider>");
|
|
1871
|
+
const { visitorId, getOrCreateSession: getAnalyticsSession } = useAnalytics();
|
|
1871
1872
|
const [session, setSession] = react.useState(null);
|
|
1872
1873
|
const [loading, setLoading] = react.useState(false);
|
|
1873
1874
|
const [error, setError] = react.useState(null);
|
|
@@ -1875,7 +1876,12 @@ function useCheckout() {
|
|
|
1875
1876
|
setLoading(true);
|
|
1876
1877
|
setError(null);
|
|
1877
1878
|
try {
|
|
1878
|
-
const
|
|
1879
|
+
const analyticsSessionId = await getAnalyticsSession().catch(() => void 0);
|
|
1880
|
+
const data = await ctx.client.createCheckoutSession({
|
|
1881
|
+
...params,
|
|
1882
|
+
visitor_id: visitorId,
|
|
1883
|
+
session_id: analyticsSessionId?.startsWith("local-") ? void 0 : analyticsSessionId
|
|
1884
|
+
});
|
|
1879
1885
|
setSession(data);
|
|
1880
1886
|
return data;
|
|
1881
1887
|
} catch (err) {
|
|
@@ -3523,6 +3529,15 @@ function LandingPage({
|
|
|
3523
3529
|
if (!data) return null;
|
|
3524
3530
|
return /* @__PURE__ */ jsxRuntime.jsx(PageLayout, { data, gatewayUrl, renderSection, onEvent, analyticsContext });
|
|
3525
3531
|
}
|
|
3532
|
+
function isSectionVisible(section, urlParams) {
|
|
3533
|
+
const vis = section.config?.visibility;
|
|
3534
|
+
if (!vis?.params) return true;
|
|
3535
|
+
for (const [key, allowed] of Object.entries(vis.params)) {
|
|
3536
|
+
const val = urlParams.get(key);
|
|
3537
|
+
if (!val || !allowed.includes(val)) return false;
|
|
3538
|
+
}
|
|
3539
|
+
return true;
|
|
3540
|
+
}
|
|
3526
3541
|
function PageLayout({
|
|
3527
3542
|
data,
|
|
3528
3543
|
gatewayUrl,
|
|
@@ -3542,7 +3557,8 @@ function PageLayout({
|
|
|
3542
3557
|
};
|
|
3543
3558
|
const fontFamily = lp.font_family || theme.fontDisplay || "system-ui, -apple-system, sans-serif";
|
|
3544
3559
|
const logoUrl = store?.logo_url;
|
|
3545
|
-
const
|
|
3560
|
+
const urlParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3561
|
+
const sorted = [...lp.sections].sort((a, b) => a.order - b.order).filter((s) => isSectionVisible(s, urlParams));
|
|
3546
3562
|
const sectionData = { ...data, gatewayUrl, landing_page: { slug: lp.slug }, analyticsContext };
|
|
3547
3563
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minHeight: "100dvh", background: theme.bg, color: theme.fg, fontFamily }, children: [
|
|
3548
3564
|
lp.custom_css && /* @__PURE__ */ jsxRuntime.jsx("style", { children: lp.custom_css }),
|