@neowhale/storefront 0.2.13 → 0.2.19

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.
Files changed (35) hide show
  1. package/dist/chunk-7KXJLHGA.cjs +160 -0
  2. package/dist/chunk-7KXJLHGA.cjs.map +1 -0
  3. package/dist/{chunk-3VKRKDPL.cjs → chunk-CQCCXDUS.cjs} +52 -11
  4. package/dist/chunk-CQCCXDUS.cjs.map +1 -0
  5. package/dist/chunk-PXS2DPVL.js +158 -0
  6. package/dist/chunk-PXS2DPVL.js.map +1 -0
  7. package/dist/{chunk-M2MR6C55.js → chunk-XHWAUMWS.js} +52 -11
  8. package/dist/chunk-XHWAUMWS.js.map +1 -0
  9. package/dist/{client-Ca8Otk-R.d.cts → client-D1XVKpFt.d.cts} +76 -4
  10. package/dist/{client-Ca8Otk-R.d.ts → client-D1XVKpFt.d.ts} +76 -4
  11. package/dist/index.cjs +5 -5
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +2 -2
  15. package/dist/next/index.cjs +7 -6
  16. package/dist/next/index.cjs.map +1 -1
  17. package/dist/next/index.d.cts +1 -1
  18. package/dist/next/index.d.ts +1 -1
  19. package/dist/next/index.js +5 -4
  20. package/dist/next/index.js.map +1 -1
  21. package/dist/{pixel-manager-CIZKghfx.d.ts → pixel-manager-C6PAp7vQ.d.ts} +1 -1
  22. package/dist/{pixel-manager-CIR16DXY.d.cts → pixel-manager-DZwpn_x2.d.cts} +1 -1
  23. package/dist/react/index.cjs +1270 -37
  24. package/dist/react/index.cjs.map +1 -1
  25. package/dist/react/index.d.cts +53 -7
  26. package/dist/react/index.d.ts +53 -7
  27. package/dist/react/index.js +1264 -36
  28. package/dist/react/index.js.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunk-3VKRKDPL.cjs.map +0 -1
  31. package/dist/chunk-BTGOSNMP.cjs +0 -95
  32. package/dist/chunk-BTGOSNMP.cjs.map +0 -1
  33. package/dist/chunk-M2MR6C55.js.map +0 -1
  34. package/dist/chunk-NLH3W6JA.js +0 -93
  35. package/dist/chunk-NLH3W6JA.js.map +0 -1
@@ -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, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-Ca8Otk-R.cjs';
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-D1XVKpFt.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-CIR16DXY.cjs';
8
+ import { P as PixelManager } from '../pixel-manager-DZwpn_x2.cjs';
9
9
 
10
10
  interface WhaleProviderProps extends WhaleStorefrontConfig {
11
11
  children: ReactNode;
@@ -42,7 +42,7 @@ interface CartActions {
42
42
  checkout: (customerEmail?: string, payment?: PaymentData) => Promise<Order>;
43
43
  }
44
44
  type CartStore = ReturnType<typeof createCartStore>;
45
- declare function createCartStore(client: WhaleClient, storagePrefix: string, onAddToCart?: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void, onRemoveFromCart?: (productId: string, productName: string) => void): Omit<zustand.StoreApi<CartState & CartActions>, "setState" | "persist"> & {
45
+ declare function createCartStore(client: WhaleClient, storagePrefix: string, onAddToCart?: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void, onRemoveFromCart?: (productId: string, productName: string) => void, onCartChange?: (cartId: string, total: number, itemCount: number) => void): Omit<zustand.StoreApi<CartState & CartActions>, "setState" | "persist"> & {
46
46
  setState(partial: (CartState & CartActions) | Partial<CartState & CartActions> | ((state: CartState & CartActions) => (CartState & CartActions) | Partial<CartState & CartActions>), replace?: false | undefined): unknown;
47
47
  setState(state: (CartState & CartActions) | ((state: CartState & CartActions) => CartState & CartActions), replace: true): unknown;
48
48
  persist: {
@@ -71,6 +71,12 @@ interface AuthState {
71
71
  interface AuthActions {
72
72
  sendOTP: (email: string) => Promise<boolean>;
73
73
  verifyOTP: (email: string, code: string) => Promise<boolean>;
74
+ updateProfile: (data: {
75
+ first_name: string;
76
+ last_name: string;
77
+ phone?: string;
78
+ date_of_birth?: string;
79
+ }) => Promise<void>;
74
80
  restoreSession: () => Promise<void>;
75
81
  isSessionValid: () => boolean;
76
82
  logout: () => void;
@@ -177,6 +183,12 @@ declare function useAuth(): {
177
183
  isAuthenticated: boolean;
178
184
  sendCode: (email: string) => Promise<boolean>;
179
185
  verifyCode: (email: string, code: string) => Promise<boolean>;
186
+ updateProfile: (data: {
187
+ first_name: string;
188
+ last_name: string;
189
+ phone?: string;
190
+ date_of_birth?: string;
191
+ }) => Promise<void>;
180
192
  restoreSession: () => Promise<void>;
181
193
  logout: () => void;
182
194
  fetchCustomer: (id: string) => Promise<void>;
@@ -213,6 +225,8 @@ declare function useAnalytics(): {
213
225
  trackAddToCart: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void;
214
226
  trackRemoveFromCart: (productId: string, productName: string) => void;
215
227
  linkCustomer: (customerId: string) => Promise<void>;
228
+ updateSessionCart: (cartId: string, cartTotal: number, cartItemCount: number) => Promise<void>;
229
+ updateSessionOrder: (orderId: string) => Promise<void>;
216
230
  getOrCreateSession: () => Promise<string>;
217
231
  /** Whether tracking is globally enabled for this storefront */
218
232
  trackingEnabled: boolean;
@@ -355,15 +369,39 @@ declare function useShipping(): {
355
369
  }) => Promise<ShippingRate[]>;
356
370
  };
357
371
 
358
- declare function useCoupons(): {
359
- validation: CouponValidation | null;
372
+ declare function useDeals(): {
373
+ validation: DealValidation | null;
360
374
  loading: boolean;
361
375
  error: Error | null;
362
- validate: (code: string, cartId?: string) => Promise<CouponValidation>;
376
+ validate: (code: string, cartId?: string) => Promise<DealValidation>;
363
377
  apply: (cartId: string, code: string) => Promise<Cart>;
364
378
  remove: (cartId: string) => Promise<Cart>;
365
379
  clear: () => void;
366
380
  };
381
+ /** @deprecated Use useDeals instead */
382
+ declare const useCoupons: typeof useDeals;
383
+
384
+ declare function useReferral(): {
385
+ status: ReferralStatus | null;
386
+ loading: boolean;
387
+ error: Error | null;
388
+ enroll: () => Promise<ReferralEnrollment>;
389
+ refresh: () => Promise<void>;
390
+ share: () => Promise<void>;
391
+ attributeReferral: (code: string) => Promise<{
392
+ success: boolean;
393
+ affiliate_id?: string;
394
+ error?: string;
395
+ }>;
396
+ referralCode: string | null;
397
+ shareUrl: string | null;
398
+ isEnrolled: boolean;
399
+ referredBy: {
400
+ affiliate_id: string;
401
+ referral_code: string;
402
+ referrer_name: string;
403
+ } | null;
404
+ };
367
405
 
368
406
  interface QRLandingPageProps {
369
407
  code: string;
@@ -449,4 +487,12 @@ interface PixelInitializerProps {
449
487
  */
450
488
  declare function PixelInitializer({ onReady, onTheme }: PixelInitializerProps): null;
451
489
 
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 };
490
+ declare function BehavioralTrackerComponent({ pathname }: {
491
+ pathname: string | null;
492
+ }): null;
493
+
494
+ declare function FingerprintCollector(): null;
495
+
496
+ declare function SessionRecorderComponent(): null;
497
+
498
+ export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, BehavioralTrackerComponent, type CartActions, CartInitializer, type CartState, type CartStore, FingerprintCollector, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, SectionRenderer, type SectionTheme, SessionRecorderComponent, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useDeals, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReferral, 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, i as LandingSection, Q as QRLandingData, h as LandingPageRenderData } from '../client-Ca8Otk-R.js';
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-D1XVKpFt.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-CIZKghfx.js';
8
+ import { P as PixelManager } from '../pixel-manager-C6PAp7vQ.js';
9
9
 
10
10
  interface WhaleProviderProps extends WhaleStorefrontConfig {
11
11
  children: ReactNode;
@@ -42,7 +42,7 @@ interface CartActions {
42
42
  checkout: (customerEmail?: string, payment?: PaymentData) => Promise<Order>;
43
43
  }
44
44
  type CartStore = ReturnType<typeof createCartStore>;
45
- declare function createCartStore(client: WhaleClient, storagePrefix: string, onAddToCart?: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void, onRemoveFromCart?: (productId: string, productName: string) => void): Omit<zustand.StoreApi<CartState & CartActions>, "setState" | "persist"> & {
45
+ declare function createCartStore(client: WhaleClient, storagePrefix: string, onAddToCart?: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void, onRemoveFromCart?: (productId: string, productName: string) => void, onCartChange?: (cartId: string, total: number, itemCount: number) => void): Omit<zustand.StoreApi<CartState & CartActions>, "setState" | "persist"> & {
46
46
  setState(partial: (CartState & CartActions) | Partial<CartState & CartActions> | ((state: CartState & CartActions) => (CartState & CartActions) | Partial<CartState & CartActions>), replace?: false | undefined): unknown;
47
47
  setState(state: (CartState & CartActions) | ((state: CartState & CartActions) => CartState & CartActions), replace: true): unknown;
48
48
  persist: {
@@ -71,6 +71,12 @@ interface AuthState {
71
71
  interface AuthActions {
72
72
  sendOTP: (email: string) => Promise<boolean>;
73
73
  verifyOTP: (email: string, code: string) => Promise<boolean>;
74
+ updateProfile: (data: {
75
+ first_name: string;
76
+ last_name: string;
77
+ phone?: string;
78
+ date_of_birth?: string;
79
+ }) => Promise<void>;
74
80
  restoreSession: () => Promise<void>;
75
81
  isSessionValid: () => boolean;
76
82
  logout: () => void;
@@ -177,6 +183,12 @@ declare function useAuth(): {
177
183
  isAuthenticated: boolean;
178
184
  sendCode: (email: string) => Promise<boolean>;
179
185
  verifyCode: (email: string, code: string) => Promise<boolean>;
186
+ updateProfile: (data: {
187
+ first_name: string;
188
+ last_name: string;
189
+ phone?: string;
190
+ date_of_birth?: string;
191
+ }) => Promise<void>;
180
192
  restoreSession: () => Promise<void>;
181
193
  logout: () => void;
182
194
  fetchCustomer: (id: string) => Promise<void>;
@@ -213,6 +225,8 @@ declare function useAnalytics(): {
213
225
  trackAddToCart: (productId: string, productName: string, quantity: number, price: number, tier?: string) => void;
214
226
  trackRemoveFromCart: (productId: string, productName: string) => void;
215
227
  linkCustomer: (customerId: string) => Promise<void>;
228
+ updateSessionCart: (cartId: string, cartTotal: number, cartItemCount: number) => Promise<void>;
229
+ updateSessionOrder: (orderId: string) => Promise<void>;
216
230
  getOrCreateSession: () => Promise<string>;
217
231
  /** Whether tracking is globally enabled for this storefront */
218
232
  trackingEnabled: boolean;
@@ -355,15 +369,39 @@ declare function useShipping(): {
355
369
  }) => Promise<ShippingRate[]>;
356
370
  };
357
371
 
358
- declare function useCoupons(): {
359
- validation: CouponValidation | null;
372
+ declare function useDeals(): {
373
+ validation: DealValidation | null;
360
374
  loading: boolean;
361
375
  error: Error | null;
362
- validate: (code: string, cartId?: string) => Promise<CouponValidation>;
376
+ validate: (code: string, cartId?: string) => Promise<DealValidation>;
363
377
  apply: (cartId: string, code: string) => Promise<Cart>;
364
378
  remove: (cartId: string) => Promise<Cart>;
365
379
  clear: () => void;
366
380
  };
381
+ /** @deprecated Use useDeals instead */
382
+ declare const useCoupons: typeof useDeals;
383
+
384
+ declare function useReferral(): {
385
+ status: ReferralStatus | null;
386
+ loading: boolean;
387
+ error: Error | null;
388
+ enroll: () => Promise<ReferralEnrollment>;
389
+ refresh: () => Promise<void>;
390
+ share: () => Promise<void>;
391
+ attributeReferral: (code: string) => Promise<{
392
+ success: boolean;
393
+ affiliate_id?: string;
394
+ error?: string;
395
+ }>;
396
+ referralCode: string | null;
397
+ shareUrl: string | null;
398
+ isEnrolled: boolean;
399
+ referredBy: {
400
+ affiliate_id: string;
401
+ referral_code: string;
402
+ referrer_name: string;
403
+ } | null;
404
+ };
367
405
 
368
406
  interface QRLandingPageProps {
369
407
  code: string;
@@ -449,4 +487,12 @@ interface PixelInitializerProps {
449
487
  */
450
488
  declare function PixelInitializer({ onReady, onTheme }: PixelInitializerProps): null;
451
489
 
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 };
490
+ declare function BehavioralTrackerComponent({ pathname }: {
491
+ pathname: string | null;
492
+ }): null;
493
+
494
+ declare function FingerprintCollector(): null;
495
+
496
+ declare function SessionRecorderComponent(): null;
497
+
498
+ export { AnalyticsTracker, type AuthActions, AuthInitializer, type AuthState, type AuthStore, BehavioralTrackerComponent, type CartActions, CartInitializer, type CartState, type CartStore, FingerprintCollector, LandingPage, type LandingPageProps, PixelInitializer, QRLandingPage, type QRLandingPageProps, type SearchParams, SectionRenderer, type SectionTheme, SessionRecorderComponent, WhaleContext, type WhaleContextValue, WhaleProvider, type WhaleProviderProps, useAnalytics, useAuth, useCart, useCartItemCount, useCartTotal, useCategories, useCheckout, useCoupons, useCustomerAnalytics, useCustomerOrders, useDeals, useLocations, useLoyalty, useProduct, useProducts, useRecommendations, useReferral, useReviews, useSearch, useShipping, useWhaleClient, useWishlist };