@nextlytics/core 0.5.1-canary.110 → 0.5.1-canary.111
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 +3 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
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
|
-
|
|
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
|
}>;
|