@magicfeedback/popup-sdk 1.8.4 → 1.8.5
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.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.js +17 -6
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +17 -6
- package/dist/react-native.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1291,7 +1291,7 @@ function createFeedbackSink(options) {
|
|
|
1291
1291
|
|
|
1292
1292
|
// src/tracking/navigation-observer.ts
|
|
1293
1293
|
var UUID_PREFIX = /^[0-9a-f]{8}-[0-9a-f]{4}-/i;
|
|
1294
|
-
function
|
|
1294
|
+
function screenPath(href) {
|
|
1295
1295
|
let pathAndHash;
|
|
1296
1296
|
try {
|
|
1297
1297
|
const u = new URL(href, "http://deepdots.local");
|
|
@@ -1299,7 +1299,10 @@ function normalizeScreen(href) {
|
|
|
1299
1299
|
} catch {
|
|
1300
1300
|
pathAndHash = href;
|
|
1301
1301
|
}
|
|
1302
|
-
|
|
1302
|
+
return pathAndHash.replace(/\?[^#]*/g, "") || "/";
|
|
1303
|
+
}
|
|
1304
|
+
function normalizeScreen(href) {
|
|
1305
|
+
const pathAndHash = screenPath(href);
|
|
1303
1306
|
const collapsed = pathAndHash.split("/").map((seg) => /^[0-9]+$/.test(seg) || UUID_PREFIX.test(seg) ? ":id" : seg).join("/");
|
|
1304
1307
|
return collapsed || "/";
|
|
1305
1308
|
}
|
|
@@ -1307,6 +1310,7 @@ var NavigationObserver = class {
|
|
|
1307
1310
|
constructor(options = {}) {
|
|
1308
1311
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1309
1312
|
this.currentScreen = null;
|
|
1313
|
+
this.currentPath = null;
|
|
1310
1314
|
this.entryAt = 0;
|
|
1311
1315
|
this.installed = false;
|
|
1312
1316
|
this.domHandlers = [];
|
|
@@ -1318,20 +1322,23 @@ var NavigationObserver = class {
|
|
|
1318
1322
|
/** Fija la pantalla inicial (sin emitir visita; su duración se cierra al salir). */
|
|
1319
1323
|
begin(href) {
|
|
1320
1324
|
this.currentScreen = normalizeScreen(href);
|
|
1325
|
+
this.currentPath = screenPath(href);
|
|
1321
1326
|
this.entryAt = this.now();
|
|
1322
1327
|
}
|
|
1323
1328
|
/** Navega a una pantalla nueva: cierra la anterior (emite visita) y abre la nueva. */
|
|
1324
1329
|
visit(href) {
|
|
1325
|
-
const
|
|
1326
|
-
if (
|
|
1330
|
+
const nextPath = screenPath(href);
|
|
1331
|
+
if (this.currentScreen != null && nextPath === this.currentPath) return;
|
|
1327
1332
|
this.closeCurrent();
|
|
1328
|
-
this.currentScreen =
|
|
1333
|
+
this.currentScreen = normalizeScreen(href);
|
|
1334
|
+
this.currentPath = nextPath;
|
|
1329
1335
|
this.entryAt = this.now();
|
|
1330
1336
|
}
|
|
1331
1337
|
/** Cierra la pantalla actual emitiendo su visita (p. ej. al cerrar la app/pestaña). */
|
|
1332
1338
|
stop() {
|
|
1333
1339
|
this.closeCurrent();
|
|
1334
1340
|
this.currentScreen = null;
|
|
1341
|
+
this.currentPath = null;
|
|
1335
1342
|
}
|
|
1336
1343
|
/**
|
|
1337
1344
|
* Olvida la pantalla actual SIN emitir su visita. Para una sesión que el backend ya dio
|
|
@@ -1340,6 +1347,7 @@ var NavigationObserver = class {
|
|
|
1340
1347
|
*/
|
|
1341
1348
|
discard() {
|
|
1342
1349
|
this.currentScreen = null;
|
|
1350
|
+
this.currentPath = null;
|
|
1343
1351
|
}
|
|
1344
1352
|
/**
|
|
1345
1353
|
* Retoma el seguimiento en la pantalla actual tras un `stop()`, cuando se abre una sesión
|
|
@@ -1355,6 +1363,7 @@ var NavigationObserver = class {
|
|
|
1355
1363
|
const exit = this.now();
|
|
1356
1364
|
const visit = {
|
|
1357
1365
|
screen: this.currentScreen,
|
|
1366
|
+
path: this.currentPath ?? this.currentScreen,
|
|
1358
1367
|
entry: this.entryAt,
|
|
1359
1368
|
exit,
|
|
1360
1369
|
durationSeconds: Math.max(0, Math.round((exit - this.entryAt) / 1e3))
|
|
@@ -2043,7 +2052,9 @@ var DeepdotsPopups = class {
|
|
|
2043
2052
|
this.geoWanted = this.geoEnabled && !!config.analytics;
|
|
2044
2053
|
this.resolveGeo();
|
|
2045
2054
|
this.navObserver = new NavigationObserver();
|
|
2046
|
-
this.navObserver.onVisit(
|
|
2055
|
+
this.navObserver.onVisit(
|
|
2056
|
+
(v) => this.track("deepdots_page_view", { screen: v.screen, path: v.path, duration_seconds: v.durationSeconds })
|
|
2057
|
+
);
|
|
2047
2058
|
this.navObserver.install();
|
|
2048
2059
|
this.engagement = new EngagementTracker();
|
|
2049
2060
|
this.setupAnalyticsFlush();
|