@nexly/core 0.3.0 → 0.5.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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @nexly/core
2
2
 
3
- Framework-agnostic **Nexly** browser ingest SDK: `Nexly` client, `sendBeacon` helpers, browser context, optional engagement listeners.
3
+ JavaScript SDK for browser-side event ingestion with Nexly. No UI framework required.
4
4
 
5
- For **React**, use **`@nexly/react-web`** (`NexlyProvider` with optional `autoPageView` / `autoEngagement`, `useNexlyClient`).
5
+ For React apps, add **@nexly/react-web**. For Next.js App Router, use **@nexly/next**.
6
6
 
7
7
  ## Install
8
8
 
@@ -21,11 +21,11 @@ nexly.pageview()
21
21
  nexly.event({ name: 'click', type: 'engagement', data: { id: 'x' } })
22
22
  ```
23
23
 
24
- `options` matches the `NexlyInit` type (your host app builds this object).
24
+ Constructor options use the `NexlyInit` type from the published typings.
25
25
 
26
26
  ## API
27
27
 
28
- Published **`.d.ts`** declarations list exports and types (`Nexly`, `sendBeaconCollect`, `collectBrowserMeta`, `startEngagementTracking`, and related).
28
+ The package ships `.d.ts` files; use your editor or `node_modules` typings for the full export list.
29
29
 
30
30
  ## License
31
31
 
package/dist/nexly.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /** Options for {@link Nexly}. `key` is the ingest API token (sent as `api_token` on the wire). */
2
2
  export type NexlyInit = {
3
- collectUrl: string;
3
+ /** Override the ingest endpoint. Defaults to the Nexly production gateway. */
4
+ collectUrl?: string;
4
5
  appId: string;
5
6
  key: string;
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"nexly.d.ts","sourceRoot":"","sources":["../src/nexly.ts"],"names":[],"mappings":"AAIA,kGAAkG;AAClG,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAA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AAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;gBAER,IAAI,EAAE,SAAS;IAM3B,OAAO,KAAK,WAAW,GAMtB;IAED,OAAO,CAAC,cAAc;IAOtB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IActC;;OAEG;IACH,eAAe,IAAI,MAAM,IAAI;CAG9B"}
package/dist/nexly.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { collectBrowserMeta } from './browser-meta.js';
2
2
  import { sendBeaconCollect } from './collect.js';
3
3
  import { getDefaultPathname, sendPageViewBeacon, startEngagementTracking } from './events/index.js';
4
+ const DEFAULT_COLLECT_URL = 'https://gate.nexly.to/v1/collect';
4
5
  /**
5
6
  * High-level browser client: page views, custom events, optional engagement auto-tracking.
6
7
  */
@@ -9,7 +10,7 @@ export class Nexly {
9
10
  appId;
10
11
  key;
11
12
  constructor(init) {
12
- this.collectUrl = init.collectUrl.trim();
13
+ this.collectUrl = (init.collectUrl ?? DEFAULT_COLLECT_URL).trim();
13
14
  this.appId = init.appId.trim();
14
15
  this.key = init.key.trim();
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexly/core",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Nexly browser ingest core (sendBeacon, Nexly client, context, engagement)",
5
5
  "license": "MIT",
6
6
  "keywords": [