@nexushub/client 0.2.6 → 0.2.8
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.cjs +143 -143
- package/dist/index.d.cts +29 -22
- package/dist/index.d.ts +29 -22
- package/dist/index.js +133 -133
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -222,23 +222,9 @@ declare class AnalyticsEngine {
|
|
|
222
222
|
start(): void;
|
|
223
223
|
pageView(): void;
|
|
224
224
|
private setupShareTracking;
|
|
225
|
-
/**
|
|
226
|
-
* 1. IDENTIFY: Link anonymous session to a User ID
|
|
227
|
-
*/
|
|
228
225
|
identify(userId: string, traits?: Record<string, any>): Promise<boolean>;
|
|
229
|
-
/**
|
|
230
|
-
* 2. GROUP: Link the current user to a Company/Organization (B2B)
|
|
231
|
-
* Required for the /api/group Rust route.
|
|
232
|
-
*/
|
|
233
226
|
group(groupId: string, traits?: Record<string, any>): Promise<boolean>;
|
|
234
|
-
/**
|
|
235
|
-
* 3. ALIAS: Merge two identities (e.g. "Guest_123" -> "User_99")
|
|
236
|
-
* Required for the /api/alias Rust route.
|
|
237
|
-
*/
|
|
238
227
|
alias(newId: string): Promise<boolean>;
|
|
239
|
-
/**
|
|
240
|
-
* 4. RESET: Clear local data and (optionally) request GDPR scrub
|
|
241
|
-
*/
|
|
242
228
|
reset(performGdprScrub?: boolean): void;
|
|
243
229
|
track(eventName: string, properties?: Record<string, any>): void;
|
|
244
230
|
trackPurchase(orderData: {
|
|
@@ -265,8 +251,20 @@ declare class NexusClient {
|
|
|
265
251
|
content: ContentEngine;
|
|
266
252
|
analytics?: AnalyticsEngine;
|
|
267
253
|
constructor(config?: Partial<NexusConfig>);
|
|
254
|
+
/**
|
|
255
|
+
* Helper alias for cleaner content fetching.
|
|
256
|
+
*/
|
|
268
257
|
getPage<T = any>(slug: string, options?: any): Promise<T>;
|
|
258
|
+
/**
|
|
259
|
+
* Returns a readonly snapshot of the current config.
|
|
260
|
+
*/
|
|
269
261
|
getConfig(): Readonly<NexusConfig>;
|
|
262
|
+
/**
|
|
263
|
+
* Updates specific config fields at runtime.
|
|
264
|
+
* Replaces the previous pattern of `(nexus as any).config.projectId = x`
|
|
265
|
+
* which bypassed TypeScript and mutated internal state unsafely.
|
|
266
|
+
*/
|
|
267
|
+
updateConfig(updates: Partial<NexusConfig>): void;
|
|
270
268
|
}
|
|
271
269
|
declare const nexus: NexusClient;
|
|
272
270
|
declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
|
|
@@ -275,23 +273,32 @@ interface NexusProviderProps {
|
|
|
275
273
|
children: React.ReactNode;
|
|
276
274
|
/**
|
|
277
275
|
* Optional project ID override.
|
|
278
|
-
*
|
|
276
|
+
* Overrides the NEXT_PUBLIC_NEXUS_ID environment variable.
|
|
279
277
|
*/
|
|
280
278
|
projectId?: string;
|
|
281
279
|
/**
|
|
282
|
-
*
|
|
280
|
+
* Set true to disable analytics (e.g. for GDPR opt-out).
|
|
283
281
|
*/
|
|
284
282
|
disableAnalytics?: boolean;
|
|
285
283
|
}
|
|
286
284
|
/**
|
|
287
|
-
*
|
|
285
|
+
* NexusHub Provider.
|
|
286
|
+
* Manages the Analytics lifecycle, automates page view tracking on route
|
|
287
|
+
* changes, and exposes the NexusClient singleton via React Context.
|
|
288
288
|
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
289
|
+
* Usage in app/layout.tsx:
|
|
290
|
+
*
|
|
291
|
+
* <NexusProvider projectId="your_id">
|
|
292
|
+
* {children}
|
|
293
|
+
* </NexusProvider>
|
|
294
|
+
*
|
|
295
|
+
* No manual <Suspense> wrapper needed — the provider handles it internally.
|
|
293
296
|
*/
|
|
294
297
|
declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
|
|
298
|
+
/**
|
|
299
|
+
* Access the raw NexusClient instance from any component inside the provider.
|
|
300
|
+
*/
|
|
301
|
+
declare const useNexus: () => NexusClient;
|
|
295
302
|
|
|
296
303
|
interface SiteUser {
|
|
297
304
|
id: string;
|
|
@@ -420,4 +427,4 @@ declare class LocalCacheProxy implements ILocalCache {
|
|
|
420
427
|
|
|
421
428
|
declare const VERSION = "0.0.1";
|
|
422
429
|
|
|
423
|
-
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, LocalCacheProxy as LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
|
|
430
|
+
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, LocalCacheProxy as LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type NexusProviderProps, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexus, useNexusAuth, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -222,23 +222,9 @@ declare class AnalyticsEngine {
|
|
|
222
222
|
start(): void;
|
|
223
223
|
pageView(): void;
|
|
224
224
|
private setupShareTracking;
|
|
225
|
-
/**
|
|
226
|
-
* 1. IDENTIFY: Link anonymous session to a User ID
|
|
227
|
-
*/
|
|
228
225
|
identify(userId: string, traits?: Record<string, any>): Promise<boolean>;
|
|
229
|
-
/**
|
|
230
|
-
* 2. GROUP: Link the current user to a Company/Organization (B2B)
|
|
231
|
-
* Required for the /api/group Rust route.
|
|
232
|
-
*/
|
|
233
226
|
group(groupId: string, traits?: Record<string, any>): Promise<boolean>;
|
|
234
|
-
/**
|
|
235
|
-
* 3. ALIAS: Merge two identities (e.g. "Guest_123" -> "User_99")
|
|
236
|
-
* Required for the /api/alias Rust route.
|
|
237
|
-
*/
|
|
238
227
|
alias(newId: string): Promise<boolean>;
|
|
239
|
-
/**
|
|
240
|
-
* 4. RESET: Clear local data and (optionally) request GDPR scrub
|
|
241
|
-
*/
|
|
242
228
|
reset(performGdprScrub?: boolean): void;
|
|
243
229
|
track(eventName: string, properties?: Record<string, any>): void;
|
|
244
230
|
trackPurchase(orderData: {
|
|
@@ -265,8 +251,20 @@ declare class NexusClient {
|
|
|
265
251
|
content: ContentEngine;
|
|
266
252
|
analytics?: AnalyticsEngine;
|
|
267
253
|
constructor(config?: Partial<NexusConfig>);
|
|
254
|
+
/**
|
|
255
|
+
* Helper alias for cleaner content fetching.
|
|
256
|
+
*/
|
|
268
257
|
getPage<T = any>(slug: string, options?: any): Promise<T>;
|
|
258
|
+
/**
|
|
259
|
+
* Returns a readonly snapshot of the current config.
|
|
260
|
+
*/
|
|
269
261
|
getConfig(): Readonly<NexusConfig>;
|
|
262
|
+
/**
|
|
263
|
+
* Updates specific config fields at runtime.
|
|
264
|
+
* Replaces the previous pattern of `(nexus as any).config.projectId = x`
|
|
265
|
+
* which bypassed TypeScript and mutated internal state unsafely.
|
|
266
|
+
*/
|
|
267
|
+
updateConfig(updates: Partial<NexusConfig>): void;
|
|
270
268
|
}
|
|
271
269
|
declare const nexus: NexusClient;
|
|
272
270
|
declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
|
|
@@ -275,23 +273,32 @@ interface NexusProviderProps {
|
|
|
275
273
|
children: React.ReactNode;
|
|
276
274
|
/**
|
|
277
275
|
* Optional project ID override.
|
|
278
|
-
*
|
|
276
|
+
* Overrides the NEXT_PUBLIC_NEXUS_ID environment variable.
|
|
279
277
|
*/
|
|
280
278
|
projectId?: string;
|
|
281
279
|
/**
|
|
282
|
-
*
|
|
280
|
+
* Set true to disable analytics (e.g. for GDPR opt-out).
|
|
283
281
|
*/
|
|
284
282
|
disableAnalytics?: boolean;
|
|
285
283
|
}
|
|
286
284
|
/**
|
|
287
|
-
*
|
|
285
|
+
* NexusHub Provider.
|
|
286
|
+
* Manages the Analytics lifecycle, automates page view tracking on route
|
|
287
|
+
* changes, and exposes the NexusClient singleton via React Context.
|
|
288
288
|
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
289
|
+
* Usage in app/layout.tsx:
|
|
290
|
+
*
|
|
291
|
+
* <NexusProvider projectId="your_id">
|
|
292
|
+
* {children}
|
|
293
|
+
* </NexusProvider>
|
|
294
|
+
*
|
|
295
|
+
* No manual <Suspense> wrapper needed — the provider handles it internally.
|
|
293
296
|
*/
|
|
294
297
|
declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
|
|
298
|
+
/**
|
|
299
|
+
* Access the raw NexusClient instance from any component inside the provider.
|
|
300
|
+
*/
|
|
301
|
+
declare const useNexus: () => NexusClient;
|
|
295
302
|
|
|
296
303
|
interface SiteUser {
|
|
297
304
|
id: string;
|
|
@@ -420,4 +427,4 @@ declare class LocalCacheProxy implements ILocalCache {
|
|
|
420
427
|
|
|
421
428
|
declare const VERSION = "0.0.1";
|
|
422
429
|
|
|
423
|
-
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, LocalCacheProxy as LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
|
|
430
|
+
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, LocalCacheProxy as LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type NexusProviderProps, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexus, useNexusAuth, validateConfig };
|