@nexushub/client 0.2.7 → 0.2.9
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 +32 -10
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +33 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1897,6 +1897,12 @@ var nexus = new NexusClient();
|
|
|
1897
1897
|
var createNexusClient = (config) => new NexusClient(config);
|
|
1898
1898
|
|
|
1899
1899
|
// src/components/NexusProvider.tsx
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1900
1906
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
1901
1907
|
var _navigation = require('next/navigation');
|
|
1902
1908
|
|
|
@@ -2098,14 +2104,24 @@ async function parseError(res) {
|
|
|
2098
2104
|
// src/components/NexusProvider.tsx
|
|
2099
2105
|
|
|
2100
2106
|
var NexusContext = _react.createContext.call(void 0, nexus);
|
|
2107
|
+
function NexusAnalyticsTracker({
|
|
2108
|
+
disableAnalytics
|
|
2109
|
+
}) {
|
|
2110
|
+
const pathname = _navigation.usePathname.call(void 0, );
|
|
2111
|
+
const searchParams = _navigation.useSearchParams.call(void 0, );
|
|
2112
|
+
const searchParamsString = searchParams.toString();
|
|
2113
|
+
_react.useEffect.call(void 0, () => {
|
|
2114
|
+
if (nexus.analytics && !disableAnalytics) {
|
|
2115
|
+
nexus.analytics.pageView();
|
|
2116
|
+
}
|
|
2117
|
+
}, [pathname, searchParamsString, disableAnalytics]);
|
|
2118
|
+
return null;
|
|
2119
|
+
}
|
|
2101
2120
|
var NexusProvider = ({
|
|
2102
2121
|
children,
|
|
2103
2122
|
projectId,
|
|
2104
2123
|
disableAnalytics = false
|
|
2105
2124
|
}) => {
|
|
2106
|
-
const pathname = _navigation.usePathname.call(void 0, );
|
|
2107
|
-
const searchParams = _navigation.useSearchParams.call(void 0, );
|
|
2108
|
-
const searchParamsString = searchParams.toString();
|
|
2109
2125
|
const isInitialized = _react.useRef.call(void 0, false);
|
|
2110
2126
|
const config = _react.useMemo.call(void 0, () => {
|
|
2111
2127
|
if (projectId && nexus.getConfig().projectId !== projectId) {
|
|
@@ -2132,12 +2148,17 @@ var NexusProvider = ({
|
|
|
2132
2148
|
}
|
|
2133
2149
|
};
|
|
2134
2150
|
}, [disableAnalytics]);
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2151
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NexusContext.Provider, { value: nexus, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AuthProvider, { config, children: [
|
|
2152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NexusAnalyticsTracker, { disableAnalytics }) }),
|
|
2153
|
+
children
|
|
2154
|
+
] }) });
|
|
2155
|
+
};
|
|
2156
|
+
var useNexus = () => {
|
|
2157
|
+
const context = _react2.default.useContext(NexusContext);
|
|
2158
|
+
if (!context) {
|
|
2159
|
+
throw new Error("useNexus must be used within a NexusProvider");
|
|
2160
|
+
}
|
|
2161
|
+
return context;
|
|
2141
2162
|
};
|
|
2142
2163
|
|
|
2143
2164
|
// src/index.ts
|
|
@@ -2164,4 +2185,5 @@ var VERSION = "0.0.1";
|
|
|
2164
2185
|
|
|
2165
2186
|
|
|
2166
2187
|
|
|
2167
|
-
|
|
2188
|
+
|
|
2189
|
+
exports.AnalyticsEngine = AnalyticsEngine; exports.AuthProvider = AuthProvider; exports.BrowserCache = BrowserCache; exports.CacheTags = CacheTags; exports.ContentEngine = ContentEngine; exports.DEFAULT_ANALYTICS_URL = DEFAULT_ANALYTICS_URL; exports.DEFAULT_API_URL = DEFAULT_API_URL; exports.LOCAL_NEST_URL = LOCAL_NEST_URL; exports.LOCAL_RUST_URL = LOCAL_RUST_URL; exports.LocalCache = LocalCacheProxy; exports.MemoryCache = MemoryCache; exports.NexusClient = NexusClient; exports.NexusProvider = NexusProvider; exports.VERSION = VERSION; exports.createNexusClient = createNexusClient; exports.getEnvConfig = getEnvConfig; exports.getFullConfig = getFullConfig; exports.mergeConfigs = mergeConfigs; exports.nexus = nexus; exports.useNexus = useNexus; exports.useNexusAuth = useNexusAuth; exports.validateConfig = validateConfig;
|
package/dist/index.d.cts
CHANGED
|
@@ -285,8 +285,20 @@ interface NexusProviderProps {
|
|
|
285
285
|
* NexusHub Provider.
|
|
286
286
|
* Manages the Analytics lifecycle, automates page view tracking on route
|
|
287
287
|
* changes, and exposes the NexusClient singleton via React Context.
|
|
288
|
+
*
|
|
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.
|
|
288
296
|
*/
|
|
289
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;
|
|
290
302
|
|
|
291
303
|
interface SiteUser {
|
|
292
304
|
id: string;
|
|
@@ -415,4 +427,4 @@ declare class LocalCacheProxy implements ILocalCache {
|
|
|
415
427
|
|
|
416
428
|
declare const VERSION = "0.0.1";
|
|
417
429
|
|
|
418
|
-
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
|
@@ -285,8 +285,20 @@ interface NexusProviderProps {
|
|
|
285
285
|
* NexusHub Provider.
|
|
286
286
|
* Manages the Analytics lifecycle, automates page view tracking on route
|
|
287
287
|
* changes, and exposes the NexusClient singleton via React Context.
|
|
288
|
+
*
|
|
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.
|
|
288
296
|
*/
|
|
289
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;
|
|
290
302
|
|
|
291
303
|
interface SiteUser {
|
|
292
304
|
id: string;
|
|
@@ -415,4 +427,4 @@ declare class LocalCacheProxy implements ILocalCache {
|
|
|
415
427
|
|
|
416
428
|
declare const VERSION = "0.0.1";
|
|
417
429
|
|
|
418
|
-
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.js
CHANGED
|
@@ -1897,7 +1897,13 @@ var nexus = new NexusClient();
|
|
|
1897
1897
|
var createNexusClient = (config) => new NexusClient(config);
|
|
1898
1898
|
|
|
1899
1899
|
// src/components/NexusProvider.tsx
|
|
1900
|
-
import React2, {
|
|
1900
|
+
import React2, {
|
|
1901
|
+
createContext as createContext2,
|
|
1902
|
+
useEffect as useEffect2,
|
|
1903
|
+
useRef,
|
|
1904
|
+
useMemo,
|
|
1905
|
+
Suspense
|
|
1906
|
+
} from "react";
|
|
1901
1907
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
1902
1908
|
|
|
1903
1909
|
// src/auth/context.tsx
|
|
@@ -2096,16 +2102,26 @@ async function parseError(res) {
|
|
|
2096
2102
|
}
|
|
2097
2103
|
|
|
2098
2104
|
// src/components/NexusProvider.tsx
|
|
2099
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2105
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
2100
2106
|
var NexusContext = createContext2(nexus);
|
|
2107
|
+
function NexusAnalyticsTracker({
|
|
2108
|
+
disableAnalytics
|
|
2109
|
+
}) {
|
|
2110
|
+
const pathname = usePathname();
|
|
2111
|
+
const searchParams = useSearchParams();
|
|
2112
|
+
const searchParamsString = searchParams.toString();
|
|
2113
|
+
useEffect2(() => {
|
|
2114
|
+
if (nexus.analytics && !disableAnalytics) {
|
|
2115
|
+
nexus.analytics.pageView();
|
|
2116
|
+
}
|
|
2117
|
+
}, [pathname, searchParamsString, disableAnalytics]);
|
|
2118
|
+
return null;
|
|
2119
|
+
}
|
|
2101
2120
|
var NexusProvider = ({
|
|
2102
2121
|
children,
|
|
2103
2122
|
projectId,
|
|
2104
2123
|
disableAnalytics = false
|
|
2105
2124
|
}) => {
|
|
2106
|
-
const pathname = usePathname();
|
|
2107
|
-
const searchParams = useSearchParams();
|
|
2108
|
-
const searchParamsString = searchParams.toString();
|
|
2109
2125
|
const isInitialized = useRef(false);
|
|
2110
2126
|
const config = useMemo(() => {
|
|
2111
2127
|
if (projectId && nexus.getConfig().projectId !== projectId) {
|
|
@@ -2132,12 +2148,17 @@ var NexusProvider = ({
|
|
|
2132
2148
|
}
|
|
2133
2149
|
};
|
|
2134
2150
|
}, [disableAnalytics]);
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2151
|
+
return /* @__PURE__ */ jsx2(NexusContext.Provider, { value: nexus, children: /* @__PURE__ */ jsxs(AuthProvider, { config, children: [
|
|
2152
|
+
/* @__PURE__ */ jsx2(Suspense, { fallback: null, children: /* @__PURE__ */ jsx2(NexusAnalyticsTracker, { disableAnalytics }) }),
|
|
2153
|
+
children
|
|
2154
|
+
] }) });
|
|
2155
|
+
};
|
|
2156
|
+
var useNexus = () => {
|
|
2157
|
+
const context = React2.useContext(NexusContext);
|
|
2158
|
+
if (!context) {
|
|
2159
|
+
throw new Error("useNexus must be used within a NexusProvider");
|
|
2160
|
+
}
|
|
2161
|
+
return context;
|
|
2141
2162
|
};
|
|
2142
2163
|
|
|
2143
2164
|
// src/index.ts
|
|
@@ -2162,6 +2183,7 @@ export {
|
|
|
2162
2183
|
getFullConfig,
|
|
2163
2184
|
mergeConfigs,
|
|
2164
2185
|
nexus,
|
|
2186
|
+
useNexus,
|
|
2165
2187
|
useNexusAuth,
|
|
2166
2188
|
validateConfig
|
|
2167
2189
|
};
|