@neowhale/storefront 0.2.28 → 0.2.29
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-PXS2DPVL.js → chunk-MZO7BCGU.js} +8 -4
- package/dist/chunk-MZO7BCGU.js.map +1 -0
- package/dist/{chunk-7KXJLHGA.cjs → chunk-UW2U5BRY.cjs} +8 -4
- package/dist/chunk-UW2U5BRY.cjs.map +1 -0
- package/dist/{client-BWUWE_7m.d.cts → client-CwCSPAHp.d.cts} +1 -1
- package/dist/{client-BWUWE_7m.d.ts → client-CwCSPAHp.d.ts} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/next/index.d.cts +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/{pixel-manager-CJaD49Xb.d.ts → pixel-manager-LiLpBmPy.d.ts} +1 -1
- package/dist/{pixel-manager-BRPU9JKk.d.cts → pixel-manager-ti1xc1eC.d.cts} +1 -1
- package/dist/react/index.cjs +26 -16
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +6 -4
- package/dist/react/index.d.ts +6 -4
- package/dist/react/index.js +25 -15
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7KXJLHGA.cjs.map +0 -1
- package/dist/chunk-PXS2DPVL.js.map +0 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
import { F as WhaleStorefrontConfig, r as Product, P as PaymentData, O as Order, a as CartItem, T as TaxBreakdown, W as WhaleClient, f as Customer, E as EventType, g as CustomerAnalytics, d as CheckoutSession, A as Address, b as Category, c as CategoryTreeNode, l as LoyaltyAccount, m as LoyaltyReward, n as LoyaltyTransaction, v as Review, w as ReviewSummary, G as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, D as DealValidation, C as Cart, H as ReferralStatus, I as ReferralEnrollment, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-
|
|
4
|
+
import { F as WhaleStorefrontConfig, r as Product, P as PaymentData, O as Order, a as CartItem, T as TaxBreakdown, W as WhaleClient, f as Customer, E as EventType, g as CustomerAnalytics, d as CheckoutSession, A as Address, b as Category, c as CategoryTreeNode, l as LoyaltyAccount, m as LoyaltyReward, n as LoyaltyTransaction, v as Review, w as ReviewSummary, G as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, D as DealValidation, C as Cart, H as ReferralStatus, I as ReferralEnrollment, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-CwCSPAHp.cjs';
|
|
5
5
|
import { ThemeTokens } from '@neowhale/ui';
|
|
6
6
|
import * as zustand_middleware from 'zustand/middleware';
|
|
7
7
|
import * as zustand from 'zustand';
|
|
8
|
-
import { P as PixelManager } from '../pixel-manager-
|
|
8
|
+
import { P as PixelManager } from '../pixel-manager-ti1xc1eC.cjs';
|
|
9
9
|
|
|
10
10
|
interface WhaleProviderProps extends WhaleStorefrontConfig {
|
|
11
11
|
children: ReactNode;
|
|
@@ -429,8 +429,9 @@ interface LandingPageProps {
|
|
|
429
429
|
renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
|
|
430
430
|
onDataLoaded?: (data: LandingPageRenderData) => void;
|
|
431
431
|
onError?: (error: Error) => void;
|
|
432
|
+
onEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
432
433
|
}
|
|
433
|
-
declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
|
|
434
|
+
declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, onEvent, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
|
|
434
435
|
|
|
435
436
|
interface SectionTheme {
|
|
436
437
|
bg: string;
|
|
@@ -464,11 +465,12 @@ interface SectionData {
|
|
|
464
465
|
slug?: string;
|
|
465
466
|
} | null;
|
|
466
467
|
}
|
|
467
|
-
declare function SectionRenderer({ section, data, theme, tracking, }: {
|
|
468
|
+
declare function SectionRenderer({ section, data, theme, tracking, onEvent, }: {
|
|
468
469
|
section: LandingSection;
|
|
469
470
|
data: SectionData;
|
|
470
471
|
theme: SectionTheme;
|
|
471
472
|
tracking?: ClickTrackingContext;
|
|
473
|
+
onEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
472
474
|
}): react_jsx_runtime.JSX.Element;
|
|
473
475
|
|
|
474
476
|
/**
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
import { F as WhaleStorefrontConfig, r as Product, P as PaymentData, O as Order, a as CartItem, T as TaxBreakdown, W as WhaleClient, f as Customer, E as EventType, g as CustomerAnalytics, d as CheckoutSession, A as Address, b as Category, c as CategoryTreeNode, l as LoyaltyAccount, m as LoyaltyReward, n as LoyaltyTransaction, v as Review, w as ReviewSummary, G as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, D as DealValidation, C as Cart, H as ReferralStatus, I as ReferralEnrollment, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-
|
|
4
|
+
import { F as WhaleStorefrontConfig, r as Product, P as PaymentData, O as Order, a as CartItem, T as TaxBreakdown, W as WhaleClient, f as Customer, E as EventType, g as CustomerAnalytics, d as CheckoutSession, A as Address, b as Category, c as CategoryTreeNode, l as LoyaltyAccount, m as LoyaltyReward, n as LoyaltyTransaction, v as Review, w as ReviewSummary, G as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, D as DealValidation, C as Cart, H as ReferralStatus, I as ReferralEnrollment, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-CwCSPAHp.js';
|
|
5
5
|
import { ThemeTokens } from '@neowhale/ui';
|
|
6
6
|
import * as zustand_middleware from 'zustand/middleware';
|
|
7
7
|
import * as zustand from 'zustand';
|
|
8
|
-
import { P as PixelManager } from '../pixel-manager-
|
|
8
|
+
import { P as PixelManager } from '../pixel-manager-LiLpBmPy.js';
|
|
9
9
|
|
|
10
10
|
interface WhaleProviderProps extends WhaleStorefrontConfig {
|
|
11
11
|
children: ReactNode;
|
|
@@ -429,8 +429,9 @@ interface LandingPageProps {
|
|
|
429
429
|
renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
|
|
430
430
|
onDataLoaded?: (data: LandingPageRenderData) => void;
|
|
431
431
|
onError?: (error: Error) => void;
|
|
432
|
+
onEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
432
433
|
}
|
|
433
|
-
declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
|
|
434
|
+
declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, onEvent, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
|
|
434
435
|
|
|
435
436
|
interface SectionTheme {
|
|
436
437
|
bg: string;
|
|
@@ -464,11 +465,12 @@ interface SectionData {
|
|
|
464
465
|
slug?: string;
|
|
465
466
|
} | null;
|
|
466
467
|
}
|
|
467
|
-
declare function SectionRenderer({ section, data, theme, tracking, }: {
|
|
468
|
+
declare function SectionRenderer({ section, data, theme, tracking, onEvent, }: {
|
|
468
469
|
section: LandingSection;
|
|
469
470
|
data: SectionData;
|
|
470
471
|
theme: SectionTheme;
|
|
471
472
|
tracking?: ClickTrackingContext;
|
|
473
|
+
onEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
472
474
|
}): react_jsx_runtime.JSX.Element;
|
|
473
475
|
|
|
474
476
|
/**
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PixelManager } from '../chunk-
|
|
1
|
+
import { PixelManager } from '../chunk-MZO7BCGU.js';
|
|
2
2
|
import { resilientSend, WhaleClient } from '../chunk-WNZOA4FB.js';
|
|
3
3
|
import { createContext, useContext, useRef, useCallback, useEffect, useState, useMemo } from 'react';
|
|
4
4
|
import { usePathname } from 'next/navigation';
|
|
@@ -2466,13 +2466,14 @@ function SectionRenderer({
|
|
|
2466
2466
|
section,
|
|
2467
2467
|
data,
|
|
2468
2468
|
theme,
|
|
2469
|
-
tracking
|
|
2469
|
+
tracking,
|
|
2470
|
+
onEvent
|
|
2470
2471
|
}) {
|
|
2471
2472
|
const [showCOA, setShowCOA] = useState(false);
|
|
2472
2473
|
const el = (() => {
|
|
2473
2474
|
switch (section.type) {
|
|
2474
2475
|
case "hero":
|
|
2475
|
-
return /* @__PURE__ */ jsx(HeroSection, { section, theme, tracking });
|
|
2476
|
+
return /* @__PURE__ */ jsx(HeroSection, { section, theme, tracking, onEvent });
|
|
2476
2477
|
case "text":
|
|
2477
2478
|
return /* @__PURE__ */ jsx(TextSection, { section, theme });
|
|
2478
2479
|
case "image":
|
|
@@ -2482,7 +2483,7 @@ function SectionRenderer({
|
|
|
2482
2483
|
case "gallery":
|
|
2483
2484
|
return /* @__PURE__ */ jsx(GallerySection, { section, theme });
|
|
2484
2485
|
case "cta":
|
|
2485
|
-
return /* @__PURE__ */ jsx(CTASection, { section, theme, tracking });
|
|
2486
|
+
return /* @__PURE__ */ jsx(CTASection, { section, theme, tracking, onEvent });
|
|
2486
2487
|
case "stats":
|
|
2487
2488
|
return /* @__PURE__ */ jsx(StatsSection, { section, theme });
|
|
2488
2489
|
case "product_card":
|
|
@@ -2492,7 +2493,7 @@ function SectionRenderer({
|
|
|
2492
2493
|
case "social_links":
|
|
2493
2494
|
return /* @__PURE__ */ jsx(SocialLinksSection, { section, theme });
|
|
2494
2495
|
case "lead_capture":
|
|
2495
|
-
return /* @__PURE__ */ jsx(LeadCaptureSection, { section, data, theme });
|
|
2496
|
+
return /* @__PURE__ */ jsx(LeadCaptureSection, { section, data, theme, onEvent });
|
|
2496
2497
|
case "divider":
|
|
2497
2498
|
return /* @__PURE__ */ jsx(DividerSection, { theme });
|
|
2498
2499
|
default:
|
|
@@ -2504,7 +2505,7 @@ function SectionRenderer({
|
|
|
2504
2505
|
showCOA && data?.coa && /* @__PURE__ */ jsx(COAModal, { coa: data.coa, theme, onClose: () => setShowCOA(false) })
|
|
2505
2506
|
] });
|
|
2506
2507
|
}
|
|
2507
|
-
function HeroSection({ section, theme, tracking }) {
|
|
2508
|
+
function HeroSection({ section, theme, tracking, onEvent }) {
|
|
2508
2509
|
const { title, subtitle, background_image, cta_text, cta_url } = section.content;
|
|
2509
2510
|
return /* @__PURE__ */ jsxs(
|
|
2510
2511
|
"div",
|
|
@@ -2546,7 +2547,10 @@ function HeroSection({ section, theme, tracking }) {
|
|
|
2546
2547
|
"a",
|
|
2547
2548
|
{
|
|
2548
2549
|
href: cta_url,
|
|
2549
|
-
onClick: () =>
|
|
2550
|
+
onClick: () => {
|
|
2551
|
+
trackClick(tracking, cta_text, cta_url);
|
|
2552
|
+
onEvent?.("cta_click", { label: cta_text, url: cta_url });
|
|
2553
|
+
},
|
|
2550
2554
|
style: {
|
|
2551
2555
|
display: "inline-block",
|
|
2552
2556
|
padding: "0.875rem 2rem",
|
|
@@ -2632,7 +2636,7 @@ function GallerySection({ section, theme }) {
|
|
|
2632
2636
|
}
|
|
2633
2637
|
) }, i)) }) });
|
|
2634
2638
|
}
|
|
2635
|
-
function CTASection({ section, theme, tracking }) {
|
|
2639
|
+
function CTASection({ section, theme, tracking, onEvent }) {
|
|
2636
2640
|
const { title, subtitle, buttons } = section.content;
|
|
2637
2641
|
if (!buttons || buttons.length === 0) return null;
|
|
2638
2642
|
return /* @__PURE__ */ jsxs("div", { style: { padding: "2rem 1.5rem", maxWidth: 480, margin: "0 auto", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
|
|
@@ -2661,7 +2665,10 @@ function CTASection({ section, theme, tracking }) {
|
|
|
2661
2665
|
"a",
|
|
2662
2666
|
{
|
|
2663
2667
|
href: btn.url,
|
|
2664
|
-
onClick: () =>
|
|
2668
|
+
onClick: () => {
|
|
2669
|
+
trackClick(tracking, btn.text, btn.url, i);
|
|
2670
|
+
onEvent?.("cta_click", { label: btn.text, url: btn.url });
|
|
2671
|
+
},
|
|
2665
2672
|
style: {
|
|
2666
2673
|
display: "block",
|
|
2667
2674
|
width: "100%",
|
|
@@ -2816,7 +2823,7 @@ function COAViewerSection({
|
|
|
2816
2823
|
onShowCOA();
|
|
2817
2824
|
}, style: buttonStyle, children: buttonLabel }) });
|
|
2818
2825
|
}
|
|
2819
|
-
function LeadCaptureSection({ section, data, theme }) {
|
|
2826
|
+
function LeadCaptureSection({ section, data, theme, onEvent }) {
|
|
2820
2827
|
const c = section.content;
|
|
2821
2828
|
const [firstName, setFirstName] = useState("");
|
|
2822
2829
|
const [email, setEmail] = useState("");
|
|
@@ -2853,6 +2860,7 @@ function LeadCaptureSection({ section, data, theme }) {
|
|
|
2853
2860
|
throw new Error(body?.error?.message || "Something went wrong. Please try again.");
|
|
2854
2861
|
}
|
|
2855
2862
|
setStatus("success");
|
|
2863
|
+
onEvent?.("lead", { email, first_name: firstName || void 0, source: c.source || "landing_page", landing_page_slug: slug || void 0 });
|
|
2856
2864
|
} catch (err) {
|
|
2857
2865
|
setErrorMsg(err instanceof Error ? err.message : "Something went wrong. Please try again.");
|
|
2858
2866
|
setStatus("error");
|
|
@@ -3389,7 +3397,8 @@ function LandingPage({
|
|
|
3389
3397
|
gatewayUrl = "https://whale-gateway.fly.dev",
|
|
3390
3398
|
renderSection,
|
|
3391
3399
|
onDataLoaded,
|
|
3392
|
-
onError
|
|
3400
|
+
onError,
|
|
3401
|
+
onEvent
|
|
3393
3402
|
}) {
|
|
3394
3403
|
const [state, setState] = useState("loading");
|
|
3395
3404
|
const [data, setData] = useState(null);
|
|
@@ -3437,12 +3446,13 @@ function LandingPage({
|
|
|
3437
3446
|
if (state === "expired") return /* @__PURE__ */ jsx(DefaultExpired2, {});
|
|
3438
3447
|
if (state === "error") return /* @__PURE__ */ jsx(DefaultError2, { message: errorMsg });
|
|
3439
3448
|
if (!data) return null;
|
|
3440
|
-
return /* @__PURE__ */ jsx(PageLayout, { data, gatewayUrl, renderSection });
|
|
3449
|
+
return /* @__PURE__ */ jsx(PageLayout, { data, gatewayUrl, renderSection, onEvent });
|
|
3441
3450
|
}
|
|
3442
3451
|
function PageLayout({
|
|
3443
3452
|
data,
|
|
3444
3453
|
gatewayUrl,
|
|
3445
|
-
renderSection
|
|
3454
|
+
renderSection,
|
|
3455
|
+
onEvent
|
|
3446
3456
|
}) {
|
|
3447
3457
|
const { landing_page: lp, store } = data;
|
|
3448
3458
|
const theme = {
|
|
@@ -3462,11 +3472,11 @@ function PageLayout({
|
|
|
3462
3472
|
lp.custom_css && /* @__PURE__ */ jsx("style", { children: lp.custom_css }),
|
|
3463
3473
|
logoUrl && /* @__PURE__ */ jsx("div", { style: { padding: "1.5rem", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: store?.name || "Store", style: { height: 40, objectFit: "contain" } }) }),
|
|
3464
3474
|
sorted.map((section) => {
|
|
3465
|
-
const defaultRenderer = () => /* @__PURE__ */ jsx(SectionRenderer, { section, data: sectionData, theme }, section.id);
|
|
3475
|
+
const defaultRenderer = () => /* @__PURE__ */ jsx(SectionRenderer, { section, data: sectionData, theme, onEvent }, section.id);
|
|
3466
3476
|
if (renderSection) {
|
|
3467
3477
|
return /* @__PURE__ */ jsx("div", { children: renderSection(section, defaultRenderer) }, section.id);
|
|
3468
3478
|
}
|
|
3469
|
-
return /* @__PURE__ */ jsx(SectionRenderer, { section, data: sectionData, theme }, section.id);
|
|
3479
|
+
return /* @__PURE__ */ jsx(SectionRenderer, { section, data: sectionData, theme, onEvent }, section.id);
|
|
3470
3480
|
}),
|
|
3471
3481
|
store?.name && /* @__PURE__ */ jsx("div", { style: { padding: "2rem 1.5rem", borderTop: `1px solid ${theme.surface}`, textAlign: "center" }, children: /* @__PURE__ */ jsxs("p", { style: { fontSize: "0.75rem", color: theme.muted, margin: 0 }, children: [
|
|
3472
3482
|
"Powered by ",
|