@loamly/tracker 2.0.1 → 2.0.2
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/index.cjs +37 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +37 -2
- package/dist/index.mjs.map +1 -1
- package/dist/loamly.iife.global.js +37 -2
- package/dist/loamly.iife.global.js.map +1 -1
- package/dist/loamly.iife.min.global.js +1 -1
- package/dist/loamly.iife.min.global.js.map +1 -1
- package/package.json +11 -9
- package/src/config.ts +1 -1
- package/src/core.ts +52 -1
- package/LICENSE +0 -23
package/dist/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
36
36
|
// src/config.ts
|
|
37
|
-
var VERSION = "2.0.
|
|
37
|
+
var VERSION = "2.0.2";
|
|
38
38
|
var DEFAULT_CONFIG = {
|
|
39
39
|
apiHost: "https://app.loamly.ai",
|
|
40
40
|
endpoints: {
|
|
@@ -1852,6 +1852,7 @@ function init(userConfig = {}) {
|
|
|
1852
1852
|
});
|
|
1853
1853
|
spaRouter.start();
|
|
1854
1854
|
setupUnloadHandlers();
|
|
1855
|
+
reportHealth("initialized");
|
|
1855
1856
|
log("Initialization complete");
|
|
1856
1857
|
}
|
|
1857
1858
|
function setupAdvancedBehavioralTracking() {
|
|
@@ -2197,6 +2198,39 @@ function getAgenticResult() {
|
|
|
2197
2198
|
function isTrackerInitialized() {
|
|
2198
2199
|
return initialized;
|
|
2199
2200
|
}
|
|
2201
|
+
function reportHealth(status, errorMessage) {
|
|
2202
|
+
if (!config.apiKey) return;
|
|
2203
|
+
try {
|
|
2204
|
+
const healthData = {
|
|
2205
|
+
workspace_id: config.apiKey,
|
|
2206
|
+
status,
|
|
2207
|
+
error_message: errorMessage || null,
|
|
2208
|
+
version: VERSION,
|
|
2209
|
+
url: typeof window !== "undefined" ? window.location.href : null,
|
|
2210
|
+
user_agent: typeof navigator !== "undefined" ? navigator.userAgent : null,
|
|
2211
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2212
|
+
features: {
|
|
2213
|
+
scroll_tracker: !!scrollTracker,
|
|
2214
|
+
time_tracker: !!timeTracker,
|
|
2215
|
+
form_tracker: !!formTracker,
|
|
2216
|
+
spa_router: !!spaRouter,
|
|
2217
|
+
behavioral_ml: !!behavioralClassifier,
|
|
2218
|
+
focus_blur: !!focusBlurAnalyzer,
|
|
2219
|
+
agentic: !!agenticAnalyzer,
|
|
2220
|
+
ping_service: !!pingService,
|
|
2221
|
+
event_queue: !!eventQueue
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
safeFetch(endpoint(DEFAULT_CONFIG.endpoints.health), {
|
|
2225
|
+
method: "POST",
|
|
2226
|
+
headers: { "Content-Type": "application/json" },
|
|
2227
|
+
body: JSON.stringify(healthData)
|
|
2228
|
+
}).catch(() => {
|
|
2229
|
+
});
|
|
2230
|
+
log("Health reported:", status);
|
|
2231
|
+
} catch {
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2200
2234
|
function reset() {
|
|
2201
2235
|
log("Resetting tracker");
|
|
2202
2236
|
pingService?.stop();
|
|
@@ -2246,7 +2280,8 @@ var loamly = {
|
|
|
2246
2280
|
getAgentic: getAgenticResult,
|
|
2247
2281
|
isInitialized: isTrackerInitialized,
|
|
2248
2282
|
reset,
|
|
2249
|
-
debug: setDebug
|
|
2283
|
+
debug: setDebug,
|
|
2284
|
+
reportHealth
|
|
2250
2285
|
};
|
|
2251
2286
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2252
2287
|
0 && (module.exports = {
|