@nexushub/client 0.3.1 → 0.3.2

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/index.d.cts CHANGED
@@ -210,19 +210,27 @@ declare class ContentEngine {
210
210
  private cleanup;
211
211
  }
212
212
 
213
- /**
214
- * NexusHub Analytics Engine
215
- * Orchestrates automatic event capture, performance monitoring, and user tracking.
216
- */
217
213
  declare class AnalyticsEngine {
218
214
  private tracker;
219
215
  private cleanupFns;
220
216
  private isInitialized;
217
+ private maxScrollDepth;
218
+ private scrollThresholdsFired;
219
+ private scrollTimer?;
221
220
  constructor(config: NexusConfig);
222
221
  start(): void;
223
222
  private lastPath;
224
223
  pageView(customReferrer?: string): void;
225
224
  private setupShareTracking;
225
+ private setupScrollTracking;
226
+ private clickBuffer;
227
+ private setupClickTracking;
228
+ private setupFormTracking;
229
+ private setupOutboundTracking;
230
+ private setupVideoTracking;
231
+ private setupErrorTracking;
232
+ private setupRouteTracking;
233
+ private isInitializedByReactProvider;
226
234
  identify(userId: string, traits?: Record<string, any>): Promise<boolean>;
227
235
  group(groupId: string, traits?: Record<string, any>): Promise<boolean>;
228
236
  alias(newId: string): Promise<boolean>;
@@ -231,19 +239,18 @@ declare class AnalyticsEngine {
231
239
  trackPurchase(orderData: {
232
240
  orderId: string;
233
241
  total: number;
242
+ revenue?: number;
234
243
  currency?: string;
235
244
  products: Array<{
236
245
  id: string;
246
+ name: string;
237
247
  price: number;
238
248
  quantity: number;
249
+ sku?: string;
239
250
  }>;
240
251
  }): void;
241
252
  trackError(error: Error, context?: Record<string, any>): void;
242
253
  private sendIdentityRequest;
243
- private setupClickTracking;
244
- private setupFormTracking;
245
- private setupRouteTracking;
246
- private isInitializedByReactProvider;
247
254
  getSessionId(): string;
248
255
  stop(isFinalShutdown?: boolean): void;
249
256
  }
@@ -273,33 +280,32 @@ declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
273
280
 
274
281
  interface NexusProviderProps {
275
282
  children: React.ReactNode;
276
- /**
277
- * Optional project ID override.
278
- * Overrides the NEXT_PUBLIC_NEXUS_ID environment variable.
279
- */
280
283
  projectId?: string;
281
- /**
282
- * Set true to disable analytics (e.g. for GDPR opt-out).
283
- */
284
284
  disableAnalytics?: boolean;
285
+ hasConsent?: boolean;
286
+ enableLiveFeed?: boolean;
287
+ onLiveEvent?: (event: LiveAnalyticsEvent) => void;
285
288
  }
286
- /**
287
- * NexusHub Provider.
288
- * Manages the Analytics lifecycle, automates page view tracking on route
289
- * changes, and exposes the NexusClient singleton via React Context.
290
- *
291
- * Usage in app/layout.tsx:
292
- *
293
- * <NexusProvider projectId="your_id">
294
- * {children}
295
- * </NexusProvider>
296
- *
297
- * No manual <Suspense> wrapper needed — the provider handles it internally.
298
- */
299
- declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
300
- /**
301
- * Access the raw NexusClient instance from any component inside the provider.
302
- */
289
+ interface LiveAnalyticsEvent {
290
+ eventType: string;
291
+ projectId: string;
292
+ sessionId: string;
293
+ visitorId: string;
294
+ userId?: string;
295
+ data: {
296
+ event_id: string;
297
+ event_name?: string;
298
+ url: string;
299
+ timestamp: string;
300
+ geo?: Record<string, any>;
301
+ device?: Record<string, any>;
302
+ performance?: Record<string, any>;
303
+ ecommerce?: Record<string, any>;
304
+ };
305
+ timestamp: string;
306
+ sequence: number;
307
+ }
308
+ declare const NexusProvider: ({ children, projectId, disableAnalytics, hasConsent, enableLiveFeed, onLiveEvent, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
303
309
  declare const useNexus: () => NexusClient;
304
310
 
305
311
  interface SiteUser {
package/dist/index.d.ts CHANGED
@@ -210,19 +210,27 @@ declare class ContentEngine {
210
210
  private cleanup;
211
211
  }
212
212
 
213
- /**
214
- * NexusHub Analytics Engine
215
- * Orchestrates automatic event capture, performance monitoring, and user tracking.
216
- */
217
213
  declare class AnalyticsEngine {
218
214
  private tracker;
219
215
  private cleanupFns;
220
216
  private isInitialized;
217
+ private maxScrollDepth;
218
+ private scrollThresholdsFired;
219
+ private scrollTimer?;
221
220
  constructor(config: NexusConfig);
222
221
  start(): void;
223
222
  private lastPath;
224
223
  pageView(customReferrer?: string): void;
225
224
  private setupShareTracking;
225
+ private setupScrollTracking;
226
+ private clickBuffer;
227
+ private setupClickTracking;
228
+ private setupFormTracking;
229
+ private setupOutboundTracking;
230
+ private setupVideoTracking;
231
+ private setupErrorTracking;
232
+ private setupRouteTracking;
233
+ private isInitializedByReactProvider;
226
234
  identify(userId: string, traits?: Record<string, any>): Promise<boolean>;
227
235
  group(groupId: string, traits?: Record<string, any>): Promise<boolean>;
228
236
  alias(newId: string): Promise<boolean>;
@@ -231,19 +239,18 @@ declare class AnalyticsEngine {
231
239
  trackPurchase(orderData: {
232
240
  orderId: string;
233
241
  total: number;
242
+ revenue?: number;
234
243
  currency?: string;
235
244
  products: Array<{
236
245
  id: string;
246
+ name: string;
237
247
  price: number;
238
248
  quantity: number;
249
+ sku?: string;
239
250
  }>;
240
251
  }): void;
241
252
  trackError(error: Error, context?: Record<string, any>): void;
242
253
  private sendIdentityRequest;
243
- private setupClickTracking;
244
- private setupFormTracking;
245
- private setupRouteTracking;
246
- private isInitializedByReactProvider;
247
254
  getSessionId(): string;
248
255
  stop(isFinalShutdown?: boolean): void;
249
256
  }
@@ -273,33 +280,32 @@ declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
273
280
 
274
281
  interface NexusProviderProps {
275
282
  children: React.ReactNode;
276
- /**
277
- * Optional project ID override.
278
- * Overrides the NEXT_PUBLIC_NEXUS_ID environment variable.
279
- */
280
283
  projectId?: string;
281
- /**
282
- * Set true to disable analytics (e.g. for GDPR opt-out).
283
- */
284
284
  disableAnalytics?: boolean;
285
+ hasConsent?: boolean;
286
+ enableLiveFeed?: boolean;
287
+ onLiveEvent?: (event: LiveAnalyticsEvent) => void;
285
288
  }
286
- /**
287
- * NexusHub Provider.
288
- * Manages the Analytics lifecycle, automates page view tracking on route
289
- * changes, and exposes the NexusClient singleton via React Context.
290
- *
291
- * Usage in app/layout.tsx:
292
- *
293
- * <NexusProvider projectId="your_id">
294
- * {children}
295
- * </NexusProvider>
296
- *
297
- * No manual <Suspense> wrapper needed — the provider handles it internally.
298
- */
299
- declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
300
- /**
301
- * Access the raw NexusClient instance from any component inside the provider.
302
- */
289
+ interface LiveAnalyticsEvent {
290
+ eventType: string;
291
+ projectId: string;
292
+ sessionId: string;
293
+ visitorId: string;
294
+ userId?: string;
295
+ data: {
296
+ event_id: string;
297
+ event_name?: string;
298
+ url: string;
299
+ timestamp: string;
300
+ geo?: Record<string, any>;
301
+ device?: Record<string, any>;
302
+ performance?: Record<string, any>;
303
+ ecommerce?: Record<string, any>;
304
+ };
305
+ timestamp: string;
306
+ sequence: number;
307
+ }
308
+ declare const NexusProvider: ({ children, projectId, disableAnalytics, hasConsent, enableLiveFeed, onLiveEvent, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
303
309
  declare const useNexus: () => NexusClient;
304
310
 
305
311
  interface SiteUser {