@magicfeedback/popup-sdk 1.19.0 → 1.21.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.
Files changed (34) hide show
  1. package/dist/{chunk-EW2ARDEY.mjs → chunk-BWYWXAIQ.mjs} +23 -3
  2. package/dist/chunk-BWYWXAIQ.mjs.map +1 -0
  3. package/dist/{chunk-7ZQOAKXR.mjs → chunk-H434NTBB.mjs} +26 -4
  4. package/dist/chunk-H434NTBB.mjs.map +1 -0
  5. package/dist/{chunk-XOEEBDBJ.mjs → chunk-UBUY6G6Z.mjs} +26 -4
  6. package/dist/chunk-UBUY6G6Z.mjs.map +1 -0
  7. package/dist/index.d.mts +105 -10
  8. package/dist/index.d.ts +105 -10
  9. package/dist/index.js +186 -37
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +163 -36
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/index.native.d.mts +105 -10
  14. package/dist/index.native.d.ts +105 -10
  15. package/dist/index.native.js +204 -42
  16. package/dist/index.native.js.map +1 -1
  17. package/dist/index.native.mjs +181 -41
  18. package/dist/index.native.mjs.map +1 -1
  19. package/dist/react-native.d.mts +47 -8
  20. package/dist/react-native.d.ts +47 -8
  21. package/dist/react-native.js +200 -41
  22. package/dist/react-native.js.map +1 -1
  23. package/dist/react-native.mjs +180 -41
  24. package/dist/react-native.mjs.map +1 -1
  25. package/dist/{renderPopup-2Y4QMWR7.mjs → renderPopup-HNSFPFVT.mjs} +2 -2
  26. package/dist/{renderPopup-ZHTRMFO2.mjs → renderPopup-VXKWSZ4E.mjs} +2 -2
  27. package/dist/{renderPopup-YDJUON42.mjs → renderPopup-WNF67H5T.mjs} +2 -2
  28. package/package.json +1 -1
  29. package/dist/chunk-7ZQOAKXR.mjs.map +0 -1
  30. package/dist/chunk-EW2ARDEY.mjs.map +0 -1
  31. package/dist/chunk-XOEEBDBJ.mjs.map +0 -1
  32. /package/dist/{renderPopup-2Y4QMWR7.mjs.map → renderPopup-HNSFPFVT.mjs.map} +0 -0
  33. /package/dist/{renderPopup-ZHTRMFO2.mjs.map → renderPopup-VXKWSZ4E.mjs.map} +0 -0
  34. /package/dist/{renderPopup-YDJUON42.mjs.map → renderPopup-WNF67H5T.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  style_default,
30
30
  surveySdkCssUrls,
31
31
  surveySdkUrls
32
- } from "./chunk-XOEEBDBJ.mjs";
32
+ } from "./chunk-UBUY6G6Z.mjs";
33
33
  import "./chunk-3QS3WKRC.mjs";
34
34
 
35
35
  // src/types/index.ts
@@ -997,7 +997,7 @@ function logRnSurveySdkChoice(choice, debug) {
997
997
  }
998
998
 
999
999
  // src/ui/preload.ts
1000
- var defaultLoader = () => import("./renderPopup-2Y4QMWR7.mjs");
1000
+ var defaultLoader = () => import("./renderPopup-HNSFPFVT.mjs");
1001
1001
  var pending = null;
1002
1002
  function preloadRenderPopup(loader = defaultLoader) {
1003
1003
  if (pending) return pending;
@@ -1070,7 +1070,7 @@ var BrowserPopupRenderer = class {
1070
1070
  if (!this.container) return;
1071
1071
  this.visible = true;
1072
1072
  const container = this.container;
1073
- void import("./renderPopup-2Y4QMWR7.mjs").then(
1073
+ void import("./renderPopup-HNSFPFVT.mjs").then(
1074
1074
  ({ renderPopup }) => {
1075
1075
  renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
1076
1076
  },
@@ -1550,9 +1550,11 @@ function createFeedbackSink(options) {
1550
1550
  const body = buildAnalyticsFeedbackBody(envelope, options.keys, feedbackSessionId, { sessionEnd });
1551
1551
  options.log?.("[DeepdotsAnalytics] POST /sdk/feedback \u2192", body);
1552
1552
  const batch = { body, at: now() };
1553
- if (sessionEnd) {
1554
- feedbackSessionId = void 0;
1555
- options.onSessionReset?.();
1553
+ if (sessionEnd || meta?.persist) {
1554
+ if (sessionEnd) {
1555
+ feedbackSessionId = void 0;
1556
+ options.onSessionReset?.();
1557
+ }
1556
1558
  addPending(batch);
1557
1559
  await drain();
1558
1560
  return;
@@ -1981,6 +1983,8 @@ var CrashReporter = class {
1981
1983
  this.windowInstalled = false;
1982
1984
  /** ErrorUtils ya enganchados: engancharlos dos veces capturaría cada error dos veces. */
1983
1985
  this.hookedErrorUtils = /* @__PURE__ */ new Set();
1986
+ /** Fuentes de rejections ya enganchadas (idempotente, como ErrorUtils). */
1987
+ this.hookedRejections = /* @__PURE__ */ new Set();
1984
1988
  this.options = options;
1985
1989
  this.now = options.now ?? (() => Date.now());
1986
1990
  }
@@ -2080,6 +2084,18 @@ var CrashReporter = class {
2080
2084
  previous?.(error, isFatal);
2081
2085
  });
2082
2086
  }
2087
+ /**
2088
+ * Promesas rechazadas sin `catch` en React Native: como el `unhandledrejection` de web, se
2089
+ * persisten y se reenvían en el arranque siguiente. La fuente encadena al tracker del host.
2090
+ * Idempotente por fuente.
2091
+ */
2092
+ installPromiseRejections(source) {
2093
+ if (this.hookedRejections.has(source)) return;
2094
+ this.hookedRejections.add(source);
2095
+ source.addUnhandledListener((error) => {
2096
+ if (this.isEnabled()) this.captureUnhandled(error ?? "unhandledrejection");
2097
+ });
2098
+ }
2083
2099
  /** @internal Test seam: ejercita el camino de persistencia (window handlers no son testeables en vitest). */
2084
2100
  _persistForTest(error) {
2085
2101
  this.captureUnhandled(error);
@@ -2181,6 +2197,51 @@ function resolveBackgroundTask(explicit, platform) {
2181
2197
  }
2182
2198
  return void 0;
2183
2199
  }
2200
+ var DEFAULT_REJECTION_WHITELIST = [ReferenceError, TypeError, RangeError];
2201
+ function createHermesRejectionHub(hermes, options) {
2202
+ if (!hermes || typeof hermes.enablePromiseRejectionTracker !== "function") return null;
2203
+ const original = hermes.enablePromiseRejectionTracker.bind(hermes);
2204
+ const listeners = /* @__PURE__ */ new Set();
2205
+ let hostOptions = null;
2206
+ let active = false;
2207
+ const forwardsToHost = (error) => !!hostOptions?.onUnhandled && (hostOptions.allRejections === true || DEFAULT_REJECTION_WHITELIST.some((type) => error instanceof type));
2208
+ const apply = () => {
2209
+ original({
2210
+ allRejections: true,
2211
+ onUnhandled: (id, error) => {
2212
+ listeners.forEach((listener) => {
2213
+ try {
2214
+ listener(error);
2215
+ } catch {
2216
+ }
2217
+ });
2218
+ if (hostOptions?.onUnhandled) {
2219
+ if (forwardsToHost(error)) hostOptions.onUnhandled(id, error);
2220
+ } else if (options.dev) {
2221
+ console.warn(`Possible unhandled promise rejection (id: ${id}):`, error);
2222
+ }
2223
+ },
2224
+ onHandled: (id, error) => hostOptions?.onHandled?.(id, error)
2225
+ });
2226
+ };
2227
+ hermes.enablePromiseRejectionTracker = (next) => {
2228
+ hostOptions = next ?? null;
2229
+ if (active) apply();
2230
+ else original(next);
2231
+ };
2232
+ return {
2233
+ addUnhandledListener(listener) {
2234
+ listeners.add(listener);
2235
+ if (!active) {
2236
+ active = true;
2237
+ apply();
2238
+ }
2239
+ return () => {
2240
+ listeners.delete(listener);
2241
+ };
2242
+ }
2243
+ };
2244
+ }
2184
2245
 
2185
2246
  // src/analytics/messaging.ts
2186
2247
  var MESSAGE_CHANNELS = ["push", "in_app"];
@@ -2258,6 +2319,7 @@ var ANALYTICS_SESSION_TIMEOUT_MS = 30 * 6e4;
2258
2319
  var ANALYTICS_SERVER_IDLE_MS = 60 * 6e4;
2259
2320
  var ANALYTICS_SESSION_DISCARD_MS = ANALYTICS_SERVER_IDLE_MS - 10 * 6e4;
2260
2321
  var ANALYTICS_RESUME_WINDOW_MS = 6e4;
2322
+ var ANALYTICS_BACKGROUND_RESUME_WINDOW_MS = 5 * 6e4;
2261
2323
  var RESERVED_EVENT_PREFIX = "deepdots_";
2262
2324
  var CUSTOM_EVENT_PREFIX = "deepdots_event_";
2263
2325
  var MAX_PENDING_TRIGGERS = 20;
@@ -2345,6 +2407,8 @@ var DeepdotsPopups = class {
2345
2407
  this.lastEngagementAt = 0;
2346
2408
  /** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
2347
2409
  this.hiddenAt = null;
2410
+ /** `init({ autoTrack: { errors } })`: captura automática de errores. Activa por defecto. */
2411
+ this.autoTrackErrors = true;
2348
2412
  /** Suscripción automática a AppState (React Native, `autoTrack.lifecycle`). */
2349
2413
  this.appStateSubscription = void 0;
2350
2414
  /**
@@ -2391,6 +2455,7 @@ var DeepdotsPopups = class {
2391
2455
  this.surveyCss = config.surveyCss;
2392
2456
  this.cspNonce = config.cspNonce;
2393
2457
  this.onFeedbackSession = config.onFeedbackSession;
2458
+ this.autoTrackErrors = config.autoTrack?.errors !== false;
2394
2459
  this.config = {
2395
2460
  apiKey: config.apiKey || void 0,
2396
2461
  debug: config.debug || false,
@@ -2422,7 +2487,7 @@ var DeepdotsPopups = class {
2422
2487
  const resumable = this.readResumableSession();
2423
2488
  if (resumable) {
2424
2489
  this.analyticsFeedbackSessionId = resumable.sessionId;
2425
- this.suspended = { at: resumable.at, userId: resumable.userId };
2490
+ this.suspended = { at: resumable.at, userId: resumable.userId, windowMs: ANALYTICS_RESUME_WINDOW_MS };
2426
2491
  }
2427
2492
  const analyticsSink = config.analytics ? createFeedbackSink({
2428
2493
  baseUrl: this.baseUrl,
@@ -2589,11 +2654,14 @@ var DeepdotsPopups = class {
2589
2654
  */
2590
2655
  installCrashHandlers() {
2591
2656
  if (!this.crashReporter || !this.tracking?.isTrackingEnabled()) return;
2592
- this.crashReporter.install();
2593
- const errorUtils = this.rnErrorUtils ?? globalThis.ErrorUtils;
2657
+ const auto = this.autoTrackErrors;
2658
+ if (auto) this.crashReporter.install();
2659
+ const errorUtils = this.rnErrorUtils ?? (auto ? globalThis.ErrorUtils : void 0);
2594
2660
  if (errorUtils && typeof errorUtils.setGlobalHandler === "function") {
2595
2661
  this.crashReporter.installReactNative(errorUtils);
2596
2662
  }
2663
+ const rejections = auto ? getReactNativePlatform()?.promiseRejections : null;
2664
+ if (rejections) this.crashReporter.installPromiseRejections(rejections);
2597
2665
  }
2598
2666
  /**
2599
2667
  * Info interna del usuario que solo conoce el host (idioma, edad, plan…), persistida en el
@@ -2678,21 +2746,28 @@ var DeepdotsPopups = class {
2678
2746
  this.navObserver.visit(name);
2679
2747
  }
2680
2748
  }
2681
- /** App a foreground (RN: AppState 'active'): reanuda el engagement time y abre sesión nueva. */
2749
+ /**
2750
+ * App a foreground (RN: AppState 'active'): reanuda el engagement time. Si la app estuvo en
2751
+ * background menos de ANALYTICS_BACKGROUND_RESUME_WINDOW_MS sigue en la misma sesión
2752
+ * (`deepdots_session_resume`); si no, abre una nueva (`session_start` `foreground`).
2753
+ */
2682
2754
  onForeground() {
2683
2755
  this.engagement?.resume();
2684
2756
  this.openSession("foreground");
2685
2757
  }
2686
2758
  /**
2687
- * App a background (RN: AppState 'background'): FIN DE SESIÓN. Cierra pantalla actual
2688
- * (page_view), mini-services (mini_service_exit), emite engagement + `session_end` y
2689
- * envía el último lote con `completed:true`.
2690
- *
2691
- * Es la única señal disponible en móvil: el kill de la app (swipe) NO da callback.
2759
+ * App a background (RN: AppState 'background'): SUSPENDE la sesión. Cierra la pantalla
2760
+ * actual (page_view), los mini-services (mini_service_exit) y envía lo acumulado con un
2761
+ * `deepdots_session_suspend` (`reason: background`) y SIN `completed`:
2762
+ * - si la app vuelve dentro de ANALYTICS_BACKGROUND_RESUME_WINDOW_MS, `onForeground` sigue
2763
+ * en el mismo registro;
2764
+ * - si no vuelve (o la matan: el swipe NO da callback), el backend la cierra pasados unos
2765
+ * minutos con un `session_end` `background` a la hora de la suspensión.
2766
+ * Si aún no se conoce el registro (el primer POST sigue en vuelo), FIN DE SESIÓN como antes.
2692
2767
  */
2693
2768
  onBackground() {
2694
2769
  this.cancelDelayedPopups("app to background");
2695
- this.closeSession("background");
2770
+ if (!this.suspendSession("background")) this.closeSession("background");
2696
2771
  this.engagement?.pause();
2697
2772
  }
2698
2773
  /**
@@ -2739,11 +2814,24 @@ var DeepdotsPopups = class {
2739
2814
  * anterior (`session_end` con `reason: 'user_change'` + `completed:true`), cambia la
2740
2815
  * identidad y abre una sesión nueva. Sin `userId` vuelve al id anónimo del SDK.
2741
2816
  *
2817
+ * Anónimo → identificado (la app arranca sin `userId` y lo pone al hacer login) es la MISMA
2818
+ * persona, no otra: el `session_start` de la sesión nueva lleva `identified: true`,
2819
+ * `previous_user_id` (el id anónimo) y `previous_session_id` (el registro que se acaba de
2820
+ * cerrar), para que el backend una las dos sin adivinar; y el estado de popups (mostrados,
2821
+ * respondidos, protecciones de mensajes) se conserva. Sin esto, cada persona que se registra
2822
+ * contaba dos veces: una que "abandona" en el login y otra registrada nueva.
2823
+ *
2742
2824
  * Equivale a llamar a `init()` otra vez con otro `userId`.
2743
2825
  */
2744
2826
  setUserId(userId) {
2745
2827
  const next = userId || void 0;
2746
2828
  if (!this.initialized || !this.config || next === this.config.userId) return;
2829
+ const identifying = !this.config.userId && !!next;
2830
+ const previous = identifying ? {
2831
+ identified: true,
2832
+ previous_user_id: this.tracking?.getUserId() ?? void 0,
2833
+ previous_session_id: this.analyticsFeedbackSessionId
2834
+ } : void 0;
2747
2835
  this.closeSession("user_change");
2748
2836
  const enabled = this.tracking?.isTrackingEnabled() ?? true;
2749
2837
  const storage = this.storage ?? createDefaultStorage();
@@ -2756,13 +2844,18 @@ var DeepdotsPopups = class {
2756
2844
  post: (body) => this.postContact(body)
2757
2845
  }) : null;
2758
2846
  this.analytics?.resetUserScope();
2759
- this.messageGuard.reset();
2760
- this.lastShown.clear();
2761
- this.surveyProgress.clear();
2762
- this.answeredSurveys.clear();
2763
- clearPopupState(storage);
2764
- this.log("tracking \xB7 user_change \xB7 user_id:", this.tracking.getUserId());
2765
- this.openSession("user_change");
2847
+ if (!identifying) {
2848
+ this.messageGuard.reset();
2849
+ this.lastShown.clear();
2850
+ this.surveyProgress.clear();
2851
+ this.answeredSurveys.clear();
2852
+ clearPopupState(storage);
2853
+ }
2854
+ this.log(
2855
+ identifying ? "tracking \xB7 user identified \xB7 user_id:" : "tracking \xB7 user_change \xB7 user_id:",
2856
+ this.tracking.getUserId()
2857
+ );
2858
+ this.openSession("user_change", previous);
2766
2859
  }
2767
2860
  /**
2768
2861
  * Cierra la sesión actual: vuelca todo lo que quedaba abierto y envía el último lote
@@ -2798,14 +2891,14 @@ var DeepdotsPopups = class {
2798
2891
  * - `bfcache_restore`: vuelta desde la bfcache fuera de la ventana de reanudación.
2799
2892
  * Si hay una sesión suspendida a tiempo emite `deepdots_session_resume` en su lugar, sin reason.
2800
2893
  */
2801
- openSession(reason) {
2894
+ openSession(reason, extra) {
2802
2895
  if (this.sessionOpen) return;
2803
2896
  if (!this.tracking?.isTrackingEnabled()) return;
2804
2897
  const suspendedMs = this.takeSuspendedSession();
2805
2898
  this.sessionOpen = true;
2806
2899
  this.lastEngagementAt = Date.now();
2807
2900
  if (suspendedMs === null) {
2808
- this.track("deepdots_session_start", { reason });
2901
+ this.track("deepdots_session_start", { reason, ...extra });
2809
2902
  } else {
2810
2903
  this.track("deepdots_session_resume", { suspended_ms: suspendedMs });
2811
2904
  this.log("tracking \xB7 session resumed after", suspendedMs, "ms:", this.analyticsFeedbackSessionId);
@@ -2899,27 +2992,37 @@ var DeepdotsPopups = class {
2899
2992
  * - si la página vuelve a cargar en esta pestaña, `init()` sigue en el mismo registro;
2900
2993
  * - si la pestaña se cerró, el backend lo cierra a los pocos minutos sin otro lote.
2901
2994
  *
2995
+ * En React Native (`background`) la suspensión vive en memoria: la app sigue viva en
2996
+ * background y, si el SO la mata, el arranque siguiente es otra sesión (`cold_start`).
2997
+ *
2902
2998
  * Devuelve false cuando no se puede suspender — aún no se conoce el registro (el primer
2903
- * POST sigue en vuelo) o no hay `sessionStorage` — y entonces el caller cierra como antes.
2999
+ * POST sigue en vuelo) o, en web, no hay `sessionStorage` — y entonces el caller cierra
3000
+ * como antes.
2904
3001
  */
2905
- suspendSession() {
3002
+ suspendSession(reason) {
2906
3003
  if (!this.sessionOpen || !this.tracking?.isTrackingEnabled()) return false;
2907
3004
  const sessionId = this.analyticsFeedbackSessionId;
2908
3005
  const integration = this.analyticsIntegration;
2909
- const storage = getSessionStorage();
2910
- if (!sessionId || !integration || !storage) return false;
3006
+ if (!sessionId || !integration) return false;
2911
3007
  const at = Date.now();
2912
3008
  const userId = this.tracking.getUserId();
2913
- if (!writeSuspendedSession(storage, { sessionId, integration, userId, at })) return false;
3009
+ if (reason === "page_hide") {
3010
+ const storage = getSessionStorage();
3011
+ if (!storage || !writeSuspendedSession(storage, { sessionId, integration, userId, at })) return false;
3012
+ }
2914
3013
  this.sessionOpen = false;
2915
- this.suspended = { at, userId };
3014
+ this.suspended = {
3015
+ at,
3016
+ userId,
3017
+ windowMs: reason === "page_hide" ? ANALYTICS_RESUME_WINDOW_MS : ANALYTICS_BACKGROUND_RESUME_WINDOW_MS
3018
+ };
2916
3019
  this.navObserver?.stop();
2917
3020
  this.navStarted = false;
2918
3021
  this.analytics?.exitAllMiniServices();
2919
3022
  this.flushEngagement();
2920
3023
  this.engagement?.pause();
2921
- this.track("deepdots_session_suspend", { reason: "page_hide" });
2922
- this.flushAnalytics({ final: true });
3024
+ this.track("deepdots_session_suspend", { reason });
3025
+ this.flushAnalytics(reason === "page_hide" ? { final: true } : { persist: true });
2923
3026
  this.log("tracking \xB7 session suspended:", sessionId);
2924
3027
  return true;
2925
3028
  }
@@ -2941,7 +3044,8 @@ var DeepdotsPopups = class {
2941
3044
  }
2942
3045
  /**
2943
3046
  * Consume la sesión suspendida al abrir: los ms que estuvo suspendida si se puede seguir en
2944
- * ella (mismo usuario, dentro de ANALYTICS_RESUME_WINDOW_MS); null si no había o ya no toca.
3047
+ * ella (mismo usuario, dentro de su ventana: ANALYTICS_RESUME_WINDOW_MS tras un `pagehide`,
3048
+ * ANALYTICS_BACKGROUND_RESUME_WINDOW_MS tras un background); null si no había o ya no toca.
2945
3049
  * En ese caso se olvida su registro sin enviar nada: lo cierra el backend, y la sesión que
2946
3050
  * se abre ahora va a uno nuevo.
2947
3051
  */
@@ -2952,7 +3056,7 @@ var DeepdotsPopups = class {
2952
3056
  const storage = getSessionStorage();
2953
3057
  if (storage) clearSuspendedSession(storage);
2954
3058
  const suspendedMs = Math.max(0, Date.now() - suspended.at);
2955
- if (this.analyticsFeedbackSessionId && suspendedMs <= ANALYTICS_RESUME_WINDOW_MS && suspended.userId === (this.tracking?.getUserId() ?? null)) {
3059
+ if (this.analyticsFeedbackSessionId && suspendedMs <= suspended.windowMs && suspended.userId === (this.tracking?.getUserId() ?? null)) {
2956
3060
  return suspendedMs;
2957
3061
  }
2958
3062
  this.analytics?.discardSession(this.analyticsIdentity());
@@ -2960,6 +3064,27 @@ var DeepdotsPopups = class {
2960
3064
  this.tracking?.setSessionId(null);
2961
3065
  return null;
2962
3066
  }
3067
+ /**
3068
+ * `pagehide` de una pestaña que llevaba oculta más de ANALYTICS_SESSION_TIMEOUT_MS: la
3069
+ * misma regla que `onDocumentVisible`. Suspenderla mandaba un lote más al registro viejo
3070
+ * (page_view + session_suspend) aunque el backend ya lo hubiera cerrado por inactividad:
3071
+ * el backend lo volvía a montar y las acciones de FEEDBACK_DONE (el aviso de Slack de
3072
+ * #platform-visitors) salían otra vez, horas después. Pasó con una pestaña oculta 7 h.
3073
+ * - Oculta menos de ANALYTICS_SESSION_DISCARD_MS: se cierra con `idle_timeout`.
3074
+ * - Más: el backend ya la cerró → se descarta sin enviar nada.
3075
+ * Devuelve false si la pestaña no llevaba tanto oculta (el caller suspende como siempre).
3076
+ */
3077
+ closeStaleHiddenSession() {
3078
+ if (!this.sessionOpen || this.hiddenAt === null) return false;
3079
+ const hiddenFor = Date.now() - this.hiddenAt;
3080
+ if (hiddenFor < ANALYTICS_SESSION_TIMEOUT_MS) return false;
3081
+ if (hiddenFor < ANALYTICS_SESSION_DISCARD_MS) {
3082
+ this.closeSession("idle_timeout");
3083
+ } else {
3084
+ this.discardSession();
3085
+ }
3086
+ return true;
3087
+ }
2963
3088
  /** Olvida la sesión abierta sin enviar nada (ver onDocumentVisible). */
2964
3089
  discardSession() {
2965
3090
  this.sessionOpen = false;
@@ -3008,7 +3133,8 @@ var DeepdotsPopups = class {
3008
3133
  if (typeof document === "undefined" || typeof window === "undefined") return;
3009
3134
  window.addEventListener("pagehide", () => {
3010
3135
  clearInterval(this.analyticsFlushTimer);
3011
- if (!this.suspendSession()) this.closeSession("page_hide");
3136
+ if (this.closeStaleHiddenSession()) return;
3137
+ if (!this.suspendSession("page_hide")) this.closeSession("page_hide");
3012
3138
  });
3013
3139
  window.addEventListener("pageshow", (event) => {
3014
3140
  if (!event.persisted) return;
@@ -3890,6 +4016,7 @@ export {
3890
4016
  crashRecordToParams,
3891
4017
  createDefaultRenderer,
3892
4018
  createFeedbackSink,
4019
+ createHermesRejectionHub,
3893
4020
  directionFor,
3894
4021
  getLabels,
3895
4022
  isRtlLanguage,