@neowhale/storefront 0.2.27 → 0.2.28
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-VAA2KKCH.cjs → chunk-V5KCIYKG.cjs} +2 -2
- package/dist/chunk-V5KCIYKG.cjs.map +1 -0
- package/dist/{chunk-3Q7CPJBA.js → chunk-WNZOA4FB.js} +2 -2
- package/dist/chunk-WNZOA4FB.js.map +1 -0
- package/dist/{client-BSO263Uv.d.cts → client-BWUWE_7m.d.cts} +12 -0
- package/dist/{client-BSO263Uv.d.ts → client-BWUWE_7m.d.ts} +12 -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-DJ9m2FaQ.d.cts → pixel-manager-BRPU9JKk.d.cts} +1 -1
- package/dist/{pixel-manager-BcL95odX.d.ts → pixel-manager-CJaD49Xb.d.ts} +1 -1
- package/dist/react/index.cjs +44 -5
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +6 -2
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +40 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3Q7CPJBA.js.map +0 -1
- package/dist/chunk-VAA2KKCH.cjs.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-BWUWE_7m.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-BRPU9JKk.cjs';
|
|
9
9
|
|
|
10
10
|
interface WhaleProviderProps extends WhaleStorefrontConfig {
|
|
11
11
|
children: ReactNode;
|
|
@@ -228,6 +228,10 @@ declare function useAnalytics(): {
|
|
|
228
228
|
updateSessionCart: (cartId: string, cartTotal: number, cartItemCount: number) => Promise<void>;
|
|
229
229
|
updateSessionOrder: (orderId: string) => Promise<void>;
|
|
230
230
|
getOrCreateSession: () => Promise<string>;
|
|
231
|
+
captureGeolocation: (options?: {
|
|
232
|
+
timeout?: number;
|
|
233
|
+
enableHighAccuracy?: boolean;
|
|
234
|
+
}) => Promise<GeolocationPosition | null>;
|
|
231
235
|
/** Whether tracking is globally enabled for this storefront */
|
|
232
236
|
trackingEnabled: boolean;
|
|
233
237
|
/** Configured recording sample rate (0–1) for behavioral session replays */
|
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-BWUWE_7m.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-CJaD49Xb.js';
|
|
9
9
|
|
|
10
10
|
interface WhaleProviderProps extends WhaleStorefrontConfig {
|
|
11
11
|
children: ReactNode;
|
|
@@ -228,6 +228,10 @@ declare function useAnalytics(): {
|
|
|
228
228
|
updateSessionCart: (cartId: string, cartTotal: number, cartItemCount: number) => Promise<void>;
|
|
229
229
|
updateSessionOrder: (orderId: string) => Promise<void>;
|
|
230
230
|
getOrCreateSession: () => Promise<string>;
|
|
231
|
+
captureGeolocation: (options?: {
|
|
232
|
+
timeout?: number;
|
|
233
|
+
enableHighAccuracy?: boolean;
|
|
234
|
+
}) => Promise<GeolocationPosition | null>;
|
|
231
235
|
/** Whether tracking is globally enabled for this storefront */
|
|
232
236
|
trackingEnabled: boolean;
|
|
233
237
|
/** Configured recording sample rate (0–1) for behavioral session replays */
|
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PixelManager } from '../chunk-PXS2DPVL.js';
|
|
2
|
-
import { resilientSend, WhaleClient } from '../chunk-
|
|
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';
|
|
5
5
|
import { createStore } from 'zustand/vanilla';
|
|
@@ -497,6 +497,44 @@ function useAnalytics() {
|
|
|
497
497
|
},
|
|
498
498
|
[track]
|
|
499
499
|
);
|
|
500
|
+
const captureGeolocation = useCallback(
|
|
501
|
+
async (options) => {
|
|
502
|
+
if (!trackingEnabled) return null;
|
|
503
|
+
if (typeof navigator === "undefined" || !navigator.geolocation) return null;
|
|
504
|
+
try {
|
|
505
|
+
const position = await new Promise((resolve, reject) => {
|
|
506
|
+
navigator.geolocation.getCurrentPosition(resolve, reject, {
|
|
507
|
+
timeout: options?.timeout ?? 1e4,
|
|
508
|
+
enableHighAccuracy: options?.enableHighAccuracy ?? true
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
const { latitude, longitude, accuracy } = position.coords;
|
|
512
|
+
const sessionId = await getOrCreateSession();
|
|
513
|
+
if (sessionId && !sessionId.startsWith("local-")) {
|
|
514
|
+
await client.updateSession(sessionId, {
|
|
515
|
+
latitude,
|
|
516
|
+
longitude,
|
|
517
|
+
geolocation_source: "browser_gps",
|
|
518
|
+
geolocation_accuracy: accuracy
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
track("location_granted", {
|
|
522
|
+
accuracy,
|
|
523
|
+
trigger: "sdk",
|
|
524
|
+
device_type: detectDevice()
|
|
525
|
+
});
|
|
526
|
+
return position;
|
|
527
|
+
} catch (error) {
|
|
528
|
+
track("location_denied", {
|
|
529
|
+
error: error instanceof Error ? error.message : "unknown",
|
|
530
|
+
trigger: "sdk",
|
|
531
|
+
device_type: detectDevice()
|
|
532
|
+
});
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
[client, getOrCreateSession, track, trackingEnabled]
|
|
537
|
+
);
|
|
500
538
|
return {
|
|
501
539
|
track,
|
|
502
540
|
trackPageView,
|
|
@@ -511,6 +549,7 @@ function useAnalytics() {
|
|
|
511
549
|
updateSessionCart,
|
|
512
550
|
updateSessionOrder,
|
|
513
551
|
getOrCreateSession,
|
|
552
|
+
captureGeolocation,
|
|
514
553
|
/** Whether tracking is globally enabled for this storefront */
|
|
515
554
|
trackingEnabled,
|
|
516
555
|
/** Configured recording sample rate (0–1) for behavioral session replays */
|