@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.js
CHANGED
|
@@ -6889,7 +6889,7 @@ function createFeedbackSink(options) {
|
|
|
6889
6889
|
|
|
6890
6890
|
// src/tracking/navigation-observer.ts
|
|
6891
6891
|
var UUID_PREFIX = /^[0-9a-f]{8}-[0-9a-f]{4}-/i;
|
|
6892
|
-
function
|
|
6892
|
+
function screenPath(href) {
|
|
6893
6893
|
let pathAndHash;
|
|
6894
6894
|
try {
|
|
6895
6895
|
const u = new URL(href, "http://deepdots.local");
|
|
@@ -6897,7 +6897,10 @@ function normalizeScreen(href) {
|
|
|
6897
6897
|
} catch {
|
|
6898
6898
|
pathAndHash = href;
|
|
6899
6899
|
}
|
|
6900
|
-
|
|
6900
|
+
return pathAndHash.replace(/\?[^#]*/g, "") || "/";
|
|
6901
|
+
}
|
|
6902
|
+
function normalizeScreen(href) {
|
|
6903
|
+
const pathAndHash = screenPath(href);
|
|
6901
6904
|
const collapsed = pathAndHash.split("/").map((seg) => /^[0-9]+$/.test(seg) || UUID_PREFIX.test(seg) ? ":id" : seg).join("/");
|
|
6902
6905
|
return collapsed || "/";
|
|
6903
6906
|
}
|
|
@@ -6905,6 +6908,7 @@ var NavigationObserver = class {
|
|
|
6905
6908
|
constructor(options = {}) {
|
|
6906
6909
|
this.listeners = /* @__PURE__ */ new Set();
|
|
6907
6910
|
this.currentScreen = null;
|
|
6911
|
+
this.currentPath = null;
|
|
6908
6912
|
this.entryAt = 0;
|
|
6909
6913
|
this.installed = false;
|
|
6910
6914
|
this.domHandlers = [];
|
|
@@ -6916,20 +6920,23 @@ var NavigationObserver = class {
|
|
|
6916
6920
|
/** Fija la pantalla inicial (sin emitir visita; su duración se cierra al salir). */
|
|
6917
6921
|
begin(href) {
|
|
6918
6922
|
this.currentScreen = normalizeScreen(href);
|
|
6923
|
+
this.currentPath = screenPath(href);
|
|
6919
6924
|
this.entryAt = this.now();
|
|
6920
6925
|
}
|
|
6921
6926
|
/** Navega a una pantalla nueva: cierra la anterior (emite visita) y abre la nueva. */
|
|
6922
6927
|
visit(href) {
|
|
6923
|
-
const
|
|
6924
|
-
if (
|
|
6928
|
+
const nextPath = screenPath(href);
|
|
6929
|
+
if (this.currentScreen != null && nextPath === this.currentPath) return;
|
|
6925
6930
|
this.closeCurrent();
|
|
6926
|
-
this.currentScreen =
|
|
6931
|
+
this.currentScreen = normalizeScreen(href);
|
|
6932
|
+
this.currentPath = nextPath;
|
|
6927
6933
|
this.entryAt = this.now();
|
|
6928
6934
|
}
|
|
6929
6935
|
/** Cierra la pantalla actual emitiendo su visita (p. ej. al cerrar la app/pestaña). */
|
|
6930
6936
|
stop() {
|
|
6931
6937
|
this.closeCurrent();
|
|
6932
6938
|
this.currentScreen = null;
|
|
6939
|
+
this.currentPath = null;
|
|
6933
6940
|
}
|
|
6934
6941
|
/**
|
|
6935
6942
|
* Olvida la pantalla actual SIN emitir su visita. Para una sesión que el backend ya dio
|
|
@@ -6938,6 +6945,7 @@ var NavigationObserver = class {
|
|
|
6938
6945
|
*/
|
|
6939
6946
|
discard() {
|
|
6940
6947
|
this.currentScreen = null;
|
|
6948
|
+
this.currentPath = null;
|
|
6941
6949
|
}
|
|
6942
6950
|
/**
|
|
6943
6951
|
* Retoma el seguimiento en la pantalla actual tras un `stop()`, cuando se abre una sesión
|
|
@@ -6953,6 +6961,7 @@ var NavigationObserver = class {
|
|
|
6953
6961
|
const exit = this.now();
|
|
6954
6962
|
const visit = {
|
|
6955
6963
|
screen: this.currentScreen,
|
|
6964
|
+
path: this.currentPath ?? this.currentScreen,
|
|
6956
6965
|
entry: this.entryAt,
|
|
6957
6966
|
exit,
|
|
6958
6967
|
durationSeconds: Math.max(0, Math.round((exit - this.entryAt) / 1e3))
|
|
@@ -7645,7 +7654,9 @@ var DeepdotsPopups = class {
|
|
|
7645
7654
|
this.geoWanted = this.geoEnabled && !!config.analytics;
|
|
7646
7655
|
this.resolveGeo();
|
|
7647
7656
|
this.navObserver = new NavigationObserver();
|
|
7648
|
-
this.navObserver.onVisit(
|
|
7657
|
+
this.navObserver.onVisit(
|
|
7658
|
+
(v) => this.track("deepdots_page_view", { screen: v.screen, path: v.path, duration_seconds: v.durationSeconds })
|
|
7659
|
+
);
|
|
7649
7660
|
this.navObserver.install();
|
|
7650
7661
|
this.engagement = new EngagementTracker();
|
|
7651
7662
|
this.setupAnalyticsFlush();
|