@nextlytics/core 0.5.1 → 0.6.0-canary.113

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/server.js CHANGED
@@ -227,7 +227,9 @@ function Nextlytics(userConfig) {
227
227
  collectedAt: (/* @__PURE__ */ new Date()).toISOString(),
228
228
  anonymousUserId,
229
229
  serverContext,
230
- userContext,
230
+ // An explicit per-event user (e.g. an email recipient resolved from a
231
+ // link) overrides the request-derived one from callbacks.getUser.
232
+ userContext: opts?.user ?? userContext,
231
233
  properties: { ...propsFromCallback, ...opts?.props }
232
234
  };
233
235
  const { completion } = dispatchEventInternal(event, ctx);
package/dist/types.d.ts CHANGED
@@ -231,6 +231,10 @@ type NextlyticsServerSide = {
231
231
  /** Send custom event from a server component, server action, or API route */
232
232
  sendEvent: (eventName: string, opts?: {
233
233
  props?: Record<string, unknown>;
234
+ /** Identify the event's user explicitly. Overrides callbacks.getUser for
235
+ * this event — e.g. an email recipient resolved from a link, where the
236
+ * request has no session to derive identity from. */
237
+ user?: UserContext;
234
238
  }) => Promise<{
235
239
  ok: boolean;
236
240
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextlytics/core",
3
- "version": "0.5.1",
3
+ "version": "0.6.0-canary.113",
4
4
  "description": "Analytics library for Next.js",
5
5
  "license": "MIT",
6
6
  "repository": {