@neowhale/storefront 0.2.11 → 0.2.13

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.
@@ -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 { D 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, F as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, e as CouponValidation, C as Cart, Q as QRLandingData, i as LandingSection, h as LandingPageRenderData } from '../client-KHvDGThs.cjs';
4
+ import { D 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, F as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, e as CouponValidation, C as Cart, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-Ca8Otk-R.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-CQaginxZ.cjs';
8
+ import { P as PixelManager } from '../pixel-manager-CIR16DXY.cjs';
9
9
 
10
10
  interface WhaleProviderProps extends WhaleStorefrontConfig {
11
11
  children: ReactNode;
@@ -368,43 +368,51 @@ declare function useCoupons(): {
368
368
  interface QRLandingPageProps {
369
369
  code: string;
370
370
  gatewayUrl?: string;
371
- renderProduct?: (data: QRLandingData) => React.ReactNode;
372
- renderCOA?: (data: QRLandingData) => React.ReactNode;
373
- renderPage?: (data: QRLandingData) => React.ReactNode;
371
+ /** Override rendering for any section type */
372
+ renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
374
373
  onDataLoaded?: (data: QRLandingData) => void;
375
374
  onError?: (error: Error) => void;
376
375
  }
377
- declare function QRLandingPage({ code, gatewayUrl, renderProduct, renderCOA, renderPage, onDataLoaded, onError, }: QRLandingPageProps): react_jsx_runtime.JSX.Element | null;
376
+ declare function QRLandingPage({ code, gatewayUrl, renderSection, onDataLoaded, onError, }: QRLandingPageProps): react_jsx_runtime.JSX.Element | null;
378
377
 
379
378
  interface LandingPageProps {
380
- /** Landing page slug */
381
379
  slug: string;
382
- /** Gateway URL — defaults to https://whale-gateway.fly.dev */
383
380
  gatewayUrl?: string;
384
- /**
385
- * Override rendering for any section type.
386
- * Return the custom element, or call defaultRenderer() for the built-in output.
387
- */
388
381
  renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
389
- /** Called when data is loaded */
390
382
  onDataLoaded?: (data: LandingPageRenderData) => void;
391
- /** Called on error */
392
383
  onError?: (error: Error) => void;
393
384
  }
394
- /**
395
- * LandingPage — drop-in component that renders a configurable landing page
396
- * fetched from the gateway's public endpoint.
397
- *
398
- * Usage:
399
- * ```tsx
400
- * import { LandingPage } from '@neowhale/storefront/react'
401
- * export default function Page({ params }: { params: { slug: string } }) {
402
- * return <LandingPage slug={params.slug} />
403
- * }
404
- * ```
405
- */
406
385
  declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
407
386
 
387
+ interface SectionTheme {
388
+ bg: string;
389
+ fg: string;
390
+ accent: string;
391
+ surface: string;
392
+ muted: string;
393
+ fontDisplay?: string;
394
+ fontBody?: string;
395
+ }
396
+ interface SectionData {
397
+ store?: {
398
+ name?: string | null;
399
+ logo_url?: string | null;
400
+ tagline?: string | null;
401
+ theme?: Record<string, unknown> | null;
402
+ } | null;
403
+ product?: Record<string, unknown> | null;
404
+ coa?: {
405
+ url: string;
406
+ viewer_url?: string | null;
407
+ document_name: string;
408
+ } | null;
409
+ }
410
+ declare function SectionRenderer({ section, data, theme, }: {
411
+ section: LandingSection;
412
+ data: SectionData;
413
+ theme: SectionTheme;
414
+ }): react_jsx_runtime.JSX.Element;
415
+
408
416
  /**
409
417
  * Auto-tracks page views on pathname change and links customer sessions.
410
418
  * Rendered internally by WhaleProvider — storefronts don't need to add this manually.
@@ -441,4 +449,4 @@ interface PixelInitializerProps {
441
449
  */
442
450
  declare function PixelInitializer({ onReady, onTheme }: PixelInitializerProps): null;
443
451
 
444
- export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, type CartActions, CartInitializer, type CartState, type CartStore, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReviews, useSearch, useShipping, useWhaleClient, useWishlist };
452
+ export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, type CartActions, CartInitializer, type CartState, type CartStore, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, SectionRenderer, type SectionTheme, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReviews, useSearch, useShipping, useWhaleClient, useWishlist };
@@ -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 { D 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, F as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, e as CouponValidation, C as Cart, Q as QRLandingData, i as LandingSection, h as LandingPageRenderData } from '../client-KHvDGThs.js';
4
+ import { D 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, F as WishlistItem, R as Recommendation, k as Location, x as ShippingMethod, y as ShippingRate, e as CouponValidation, C as Cart, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-Ca8Otk-R.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-Djp4Mh9L.js';
8
+ import { P as PixelManager } from '../pixel-manager-CIZKghfx.js';
9
9
 
10
10
  interface WhaleProviderProps extends WhaleStorefrontConfig {
11
11
  children: ReactNode;
@@ -368,43 +368,51 @@ declare function useCoupons(): {
368
368
  interface QRLandingPageProps {
369
369
  code: string;
370
370
  gatewayUrl?: string;
371
- renderProduct?: (data: QRLandingData) => React.ReactNode;
372
- renderCOA?: (data: QRLandingData) => React.ReactNode;
373
- renderPage?: (data: QRLandingData) => React.ReactNode;
371
+ /** Override rendering for any section type */
372
+ renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
374
373
  onDataLoaded?: (data: QRLandingData) => void;
375
374
  onError?: (error: Error) => void;
376
375
  }
377
- declare function QRLandingPage({ code, gatewayUrl, renderProduct, renderCOA, renderPage, onDataLoaded, onError, }: QRLandingPageProps): react_jsx_runtime.JSX.Element | null;
376
+ declare function QRLandingPage({ code, gatewayUrl, renderSection, onDataLoaded, onError, }: QRLandingPageProps): react_jsx_runtime.JSX.Element | null;
378
377
 
379
378
  interface LandingPageProps {
380
- /** Landing page slug */
381
379
  slug: string;
382
- /** Gateway URL — defaults to https://whale-gateway.fly.dev */
383
380
  gatewayUrl?: string;
384
- /**
385
- * Override rendering for any section type.
386
- * Return the custom element, or call defaultRenderer() for the built-in output.
387
- */
388
381
  renderSection?: (section: LandingSection, defaultRenderer: () => React.ReactNode) => React.ReactNode;
389
- /** Called when data is loaded */
390
382
  onDataLoaded?: (data: LandingPageRenderData) => void;
391
- /** Called on error */
392
383
  onError?: (error: Error) => void;
393
384
  }
394
- /**
395
- * LandingPage — drop-in component that renders a configurable landing page
396
- * fetched from the gateway's public endpoint.
397
- *
398
- * Usage:
399
- * ```tsx
400
- * import { LandingPage } from '@neowhale/storefront/react'
401
- * export default function Page({ params }: { params: { slug: string } }) {
402
- * return <LandingPage slug={params.slug} />
403
- * }
404
- * ```
405
- */
406
385
  declare function LandingPage({ slug, gatewayUrl, renderSection, onDataLoaded, onError, }: LandingPageProps): react_jsx_runtime.JSX.Element | null;
407
386
 
387
+ interface SectionTheme {
388
+ bg: string;
389
+ fg: string;
390
+ accent: string;
391
+ surface: string;
392
+ muted: string;
393
+ fontDisplay?: string;
394
+ fontBody?: string;
395
+ }
396
+ interface SectionData {
397
+ store?: {
398
+ name?: string | null;
399
+ logo_url?: string | null;
400
+ tagline?: string | null;
401
+ theme?: Record<string, unknown> | null;
402
+ } | null;
403
+ product?: Record<string, unknown> | null;
404
+ coa?: {
405
+ url: string;
406
+ viewer_url?: string | null;
407
+ document_name: string;
408
+ } | null;
409
+ }
410
+ declare function SectionRenderer({ section, data, theme, }: {
411
+ section: LandingSection;
412
+ data: SectionData;
413
+ theme: SectionTheme;
414
+ }): react_jsx_runtime.JSX.Element;
415
+
408
416
  /**
409
417
  * Auto-tracks page views on pathname change and links customer sessions.
410
418
  * Rendered internally by WhaleProvider — storefronts don't need to add this manually.
@@ -441,4 +449,4 @@ interface PixelInitializerProps {
441
449
  */
442
450
  declare function PixelInitializer({ onReady, onTheme }: PixelInitializerProps): null;
443
451
 
444
- export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, type CartActions, CartInitializer, type CartState, type CartStore, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReviews, useSearch, useShipping, useWhaleClient, useWishlist };
452
+ export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, type CartActions, CartInitializer, type CartState, type CartStore, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, SectionRenderer, type SectionTheme, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReviews, useSearch, useShipping, useWhaleClient, useWishlist };