@nexly/core 0.16.2 → 0.17.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
@@ -18,7 +18,7 @@ import { Nexly } from '@nexly/core'
18
18
  const nexly = new Nexly(options)
19
19
 
20
20
  nexly.pageview()
21
- nexly.event({ name: 'click', type: 'engagement', data: { id: 'x' } })
21
+ nexly.event({ name: 'signup_clicked', type: 'custom', cdata: { plan: 'pro' } })
22
22
  ```
23
23
 
24
24
  Constructor options use the `NexlyInit` type from the published typings.
@@ -22,20 +22,17 @@ export type NexlyEventType = 'pageview' | 'engagement' | 'custom' | 'navigation'
22
22
  export type NexlyEventInput = {
23
23
  name: string;
24
24
  type: NexlyEventType | string;
25
- /**
26
- * SDK-emitted built-in event payload. For built-in event types
27
- * (`engagement`, `lifecycle`, `pageview`, `navigation`) the server
28
- * validates this against a per-event-type allowlist. For
29
- * `type: 'custom'` events, user-defined payload belongs in
30
- * {@link cdata} instead — `data` is reserved for SDK metrics.
31
- */
32
- data?: Record<string, unknown>;
33
25
  /**
34
26
  * User-defined custom analytics payload. Top-level scalar map
35
27
  * (`string` / `number` / `boolean`). Server validates against the
36
28
  * per-app `Custom data` registry; unapproved keys are discovered
37
29
  * but not stored. Use {@link NexlyBase.customEvent} for the
38
30
  * ergonomic per-event API.
31
+ *
32
+ * This is the only slot for application payload. The SDK-emitted
33
+ * built-in `data` vocabulary (engagement metrics, lifecycle pings)
34
+ * is populated internally by the auto-tracking listeners and is not
35
+ * settable from application code.
39
36
  */
40
37
  cdata?: CData;
41
38
  /** Merged on top of default platform context (see {@link NexlyBase.collectEventContext}). */
@@ -88,9 +85,10 @@ export declare abstract class NexlyBase {
88
85
  pageview(path?: string): boolean;
89
86
  /**
90
87
  * Sends a generic event. The unstructured `context` is merged on top
91
- * of the default platform context; `data` carries SDK-internal
92
- * payload (or user payload for legacy callers; new code should
93
- * prefer {@link customEvent} for custom analytics).
88
+ * of the default platform context; application payload travels in
89
+ * `cdata`. The built-in `data` vocabulary is owned by the SDK's
90
+ * auto-tracking and is always sent empty from this entry point —
91
+ * prefer {@link customEvent} for the ergonomic custom-analytics API.
94
92
  */
95
93
  event(input: NexlyEventInput): boolean;
96
94
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"nexly-base.d.ts","sourceRoot":"","sources":["../src/nexly-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAA;AAIrB,eAAO,MAAM,mBAAmB,qCAAqC,CAAA;AAErE,sGAAsG;AACtG,MAAM,MAAM,SAAS,GAAG;IACtB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAA;AAEhF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,GAAG,MAAM,CAAA;IAC7B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,8BAAsB,SAAS;IAC7B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAyB;IAEjD,iFAAiF;IACjF,MAAM,CAAC,WAAW,IAAI,SAAS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IAAI,EAAE,SAAS;IASrC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAEhC;IAED,SAAS,KAAK,WAAW,IAAI,iBAAiB,CAE7C;IAED,kFAAkF;IAClF,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;IAEvE,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEjE,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnE,kDAAkD;IAClD,QAAQ,CAAC,cAAc,IAAI,MAAM;IAEjC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO;IAWhC;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAatC;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO;IAapF,OAAO,CAAC,QAAQ;CA8BjB"}
@@ -66,9 +66,10 @@ export class NexlyBase {
66
66
  }
67
67
  /**
68
68
  * Sends a generic event. The unstructured `context` is merged on top
69
- * of the default platform context; `data` carries SDK-internal
70
- * payload (or user payload for legacy callers; new code should
71
- * prefer {@link customEvent} for custom analytics).
69
+ * of the default platform context; application payload travels in
70
+ * `cdata`. The built-in `data` vocabulary is owned by the SDK's
71
+ * auto-tracking and is always sent empty from this entry point —
72
+ * prefer {@link customEvent} for the ergonomic custom-analytics API.
72
73
  */
73
74
  event(input) {
74
75
  if (this.disabled)
@@ -79,7 +80,7 @@ export class NexlyBase {
79
80
  eventName: input.name,
80
81
  eventType: input.type,
81
82
  context,
82
- data: input.data ?? {},
83
+ data: {},
83
84
  cdata: input.cdata,
84
85
  });
85
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexly/core",
3
- "version": "0.16.2",
3
+ "version": "0.17.0",
4
4
  "description": "Nexly ingest core (platform-agnostic): types, payload builder, abstract NexlyBase client",
5
5
  "license": "MIT",
6
6
  "keywords": [