@nexly/react-web 0.10.0 → 0.12.0

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.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { NexlyProvider, useNexlyClient, type NexlyProviderProps } from './nexly-provider.js';
1
+ export { NexlyProvider, useNexlyClient, type NexlyProviderProps, _NexlyClientIdentityContext, } from './nexly-provider.js';
2
2
  export { Nexly } from '@nexly/web';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,KAAK,kBAAkB,EAEvB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
- export { NexlyProvider, useNexlyClient } from './nexly-provider.js';
1
+ export { NexlyProvider, useNexlyClient,
2
+ // eslint-disable-next-line @typescript-eslint/naming-convention
3
+ _NexlyClientIdentityContext, } from './nexly-provider.js';
2
4
  export { Nexly } from '@nexly/web';
@@ -1,23 +1,27 @@
1
+ import { NexlyClient } from '@nexly/core';
1
2
  import { Nexly } from '@nexly/web';
2
3
  import { type ReactNode } from 'react';
4
+ /**
5
+ * @internal
6
+ *
7
+ * Lets framework-level adapters (e.g. `@nexly/next`) override the `client`
8
+ * identifier that the nested `NexlyProvider` sends to the collector. Do not
9
+ * import this from application code — use the appropriate framework package.
10
+ */
11
+ export declare const _NexlyClientIdentityContext: import("react").Context<NexlyClient>;
3
12
  export type NexlyProviderProps = {
4
13
  /** Override the ingest endpoint. Defaults to the Nexly production gateway. */
5
14
  collectUrl?: string;
6
15
  appId: string;
7
16
  /** Ingest API token (maps to `key` on {@link Nexly}). Not named `key` — reserved in React. */
8
17
  ingestKey: string;
9
- /**
10
- * SDK identity sent as top-level `client` on the wire. Defaults to `'react'`
11
- * for this package; framework wrappers (e.g. `@nexly/next`) override it.
12
- */
13
- client?: string;
14
18
  /** When a client exists, send one pageview on mount. */
15
19
  autoPageView?: boolean;
16
20
  /** When true and a client exists, attach engagement listeners (scroll, click, visibility, …). Cleaned up on change/unmount. */
17
21
  autoEngagement?: boolean;
18
22
  children: ReactNode;
19
23
  };
20
- export declare function NexlyProvider({ collectUrl, appId, ingestKey, client: clientOverride, autoPageView, autoEngagement, children, }: NexlyProviderProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function NexlyProvider({ collectUrl, appId, ingestKey, autoPageView, autoEngagement, children, }: NexlyProviderProps): import("react/jsx-runtime").JSX.Element;
21
25
  /** Returns the configured {@link Nexly} client, or `null` if credentials are incomplete. Must be used under {@link NexlyProvider}. */
22
26
  export declare function useNexlyClient(): Nexly | null;
23
27
  //# sourceMappingURL=nexly-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nexly-provider.d.ts","sourceRoot":"","sources":["../src/nexly-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+HAA+H;IAC/H,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,KAAK,EACL,SAAS,EACT,MAAM,EAAE,cAAc,EACtB,YAAoB,EACpB,cAAsB,EACtB,QAAQ,GACT,EAAE,kBAAkB,2CA2BpB;AAED,sIAAsI;AACtI,wBAAgB,cAAc,IAAI,KAAK,GAAG,IAAI,CAE7C"}
1
+ {"version":3,"file":"nexly-provider.d.ts","sourceRoot":"","sources":["../src/nexly-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrF;;;;;;GAMG;AAEH,eAAO,MAAM,2BAA2B,sCAAgD,CAAA;AAExF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAA;IACjB,wDAAwD;IACxD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+HAA+H;IAC/H,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAoB,EACpB,cAAsB,EACtB,QAAQ,GACT,EAAE,kBAAkB,2CA2BpB;AAED,sIAAsI;AACtI,wBAAgB,cAAc,IAAI,KAAK,GAAG,IAAI,CAE7C"}
@@ -1,9 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { NexlyClient } from '@nexly/core';
2
3
  import { Nexly } from '@nexly/web';
3
4
  import { createContext, useContext, useEffect, useMemo } from 'react';
4
5
  const NexlyClientContext = createContext(null);
5
- export function NexlyProvider({ collectUrl, appId, ingestKey, client: clientOverride, autoPageView = false, autoEngagement = false, children, }) {
6
- const clientId = clientOverride ?? 'react';
6
+ /**
7
+ * @internal
8
+ *
9
+ * Lets framework-level adapters (e.g. `@nexly/next`) override the `client`
10
+ * identifier that the nested `NexlyProvider` sends to the collector. Do not
11
+ * import this from application code — use the appropriate framework package.
12
+ */
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+ export const _NexlyClientIdentityContext = createContext(NexlyClient.React);
15
+ export function NexlyProvider({ collectUrl, appId, ingestKey, autoPageView = false, autoEngagement = false, children, }) {
16
+ const clientId = useContext(_NexlyClientIdentityContext);
7
17
  const nexly = useMemo(() => {
8
18
  const id = (appId ?? '').trim();
9
19
  const k = (ingestKey ?? '').trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexly/react-web",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "React bindings for Nexly (@nexly/web): provider, client hook, engagement, optional auto pageview",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@nexly/web": "0.10.0"
42
+ "@nexly/web": "0.12.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "^19.2.14",