@shipeasy/sdk 2.3.0 → 2.4.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/client/index.js +17 -0
- package/dist/client/index.mjs +17 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -306,6 +306,23 @@ function installAutoGuardrails(buffer, userId, anonId, groups) {
|
|
|
306
306
|
} catch {
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
+
if (groups.engagement) {
|
|
310
|
+
try {
|
|
311
|
+
buffer.pushMetric("__auto_session_active", userId, anonId, { value: 1 });
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
let lastEmit = Date.now();
|
|
315
|
+
const SESSION_GAP_MS = 30 * 60 * 1e3;
|
|
316
|
+
document.addEventListener("visibilitychange", () => {
|
|
317
|
+
if (document.visibilityState !== "visible") return;
|
|
318
|
+
if (Date.now() - lastEmit < SESSION_GAP_MS) return;
|
|
319
|
+
try {
|
|
320
|
+
buffer.pushMetric("__auto_session_active", userId, anonId, { value: 1 });
|
|
321
|
+
lastEmit = Date.now();
|
|
322
|
+
} catch {
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
309
326
|
const needHide = groups.vitals || groups.engagement;
|
|
310
327
|
if (needHide) {
|
|
311
328
|
if (document.readyState === "complete") {
|
package/dist/client/index.mjs
CHANGED
|
@@ -263,6 +263,23 @@ function installAutoGuardrails(buffer, userId, anonId, groups) {
|
|
|
263
263
|
} catch {
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
+
if (groups.engagement) {
|
|
267
|
+
try {
|
|
268
|
+
buffer.pushMetric("__auto_session_active", userId, anonId, { value: 1 });
|
|
269
|
+
} catch {
|
|
270
|
+
}
|
|
271
|
+
let lastEmit = Date.now();
|
|
272
|
+
const SESSION_GAP_MS = 30 * 60 * 1e3;
|
|
273
|
+
document.addEventListener("visibilitychange", () => {
|
|
274
|
+
if (document.visibilityState !== "visible") return;
|
|
275
|
+
if (Date.now() - lastEmit < SESSION_GAP_MS) return;
|
|
276
|
+
try {
|
|
277
|
+
buffer.pushMetric("__auto_session_active", userId, anonId, { value: 1 });
|
|
278
|
+
lastEmit = Date.now();
|
|
279
|
+
} catch {
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
266
283
|
const needHide = groups.vitals || groups.engagement;
|
|
267
284
|
if (needHide) {
|
|
268
285
|
if (document.readyState === "complete") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipeasy/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Shipeasy SDK — feature gates, runtime configs, experiments, and metrics for the Shipeasy hosted service.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://shipeasy.ai",
|