@nexly/core 0.6.0 → 0.7.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/events/engagement.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/nexly.d.ts +3 -1
- package/dist/nexly.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -103,7 +103,7 @@ export function startEngagementTracking(creds) {
|
|
|
103
103
|
flushScrollDepth();
|
|
104
104
|
const secs = Math.round(accumulatedVisibleMs / 1000);
|
|
105
105
|
if (secs > 0) {
|
|
106
|
-
sendEngagement(creds, 'visibility_change', '
|
|
106
|
+
sendEngagement(creds, 'visibility_change', 'engagement', { visible_seconds: secs, state: 'hidden' });
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
@@ -118,7 +118,7 @@ export function startEngagementTracking(creds) {
|
|
|
118
118
|
}
|
|
119
119
|
flushScrollDepth();
|
|
120
120
|
const secs = Math.round(accumulatedVisibleMs / 1000);
|
|
121
|
-
sendEngagement(creds, 'visibility_change', '
|
|
121
|
+
sendEngagement(creds, 'visibility_change', 'engagement', { visible_seconds: secs, state: 'unload' });
|
|
122
122
|
}
|
|
123
123
|
window.addEventListener('beforeunload', onBeforeUnload, { signal });
|
|
124
124
|
// ---- heartbeat ----
|
|
@@ -127,7 +127,7 @@ export function startEngagementTracking(creds) {
|
|
|
127
127
|
if (document.visibilityState !== 'visible')
|
|
128
128
|
return;
|
|
129
129
|
const elapsed = Math.round((Date.now() - startTime) / 1000);
|
|
130
|
-
sendEngagement(creds, 'heartbeat', '
|
|
130
|
+
sendEngagement(creds, 'heartbeat', 'engagement', { elapsed_seconds: elapsed });
|
|
131
131
|
}
|
|
132
132
|
const heartbeatId = setInterval(sendHeartbeat, HEARTBEAT_INTERVAL_MS);
|
|
133
133
|
// ---- cleanup ----
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser event ingest client (public API).
|
|
3
3
|
*/
|
|
4
|
-
export { Nexly, type NexlyEventInput, type NexlyInit } from './nexly.js';
|
|
4
|
+
export { Nexly, type NexlyEventInput, type NexlyEventType, type NexlyInit } from './nexly.js';
|
|
5
5
|
export { collectBrowserMeta } from './browser-meta.js';
|
|
6
6
|
export { getSessionId, getVisitorId } from './session.js';
|
|
7
7
|
export { buildCollectPayload, sendBeaconCollect, type CollectCredentials, type IngestCredentials, type SendBeaconCollectInput, type TrackEventInput, } from './collect.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/nexly.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export type NexlyInit = {
|
|
|
5
5
|
appId: string;
|
|
6
6
|
key: string;
|
|
7
7
|
};
|
|
8
|
+
/** Allowed event types. The backend rejects any other value. */
|
|
9
|
+
export type NexlyEventType = 'pageview' | 'engagement' | 'custom';
|
|
8
10
|
export type NexlyEventInput = {
|
|
9
11
|
name: string;
|
|
10
|
-
type:
|
|
12
|
+
type: NexlyEventType;
|
|
11
13
|
data?: Record<string, unknown>;
|
|
12
14
|
/** Merged on top of default browser context (see {@link collectBrowserMeta}) and current `path`. */
|
|
13
15
|
context?: Record<string, unknown>;
|
package/dist/nexly.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexly.d.ts","sourceRoot":"","sources":["../src/nexly.ts"],"names":[],"mappings":"AAMA,kGAAkG;AAClG,MAAM,MAAM,SAAS,GAAG;IACtB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"nexly.d.ts","sourceRoot":"","sources":["../src/nexly.ts"],"names":[],"mappings":"AAMA,kGAAkG;AAClG,MAAM,MAAM,SAAS,GAAG;IACtB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAA;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,oGAAoG;IACpG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAED;;GAEG;AACH,qBAAa,KA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