@magicfeedback/popup-sdk 1.18.0 → 1.20.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 (55) hide show
  1. package/MagicfeedbackPopupSdk.podspec +18 -0
  2. package/README.md +23 -0
  3. package/dist/2.2.38-CCK7SF4A.mjs +2343 -0
  4. package/dist/2.2.38-CCK7SF4A.mjs.map +1 -0
  5. package/dist/2.2.38-LGZRM7GX.mjs +2343 -0
  6. package/dist/2.2.38-LGZRM7GX.mjs.map +1 -0
  7. package/dist/2.2.39-BJJ3YRJ4.mjs +2344 -0
  8. package/dist/2.2.39-BJJ3YRJ4.mjs.map +1 -0
  9. package/dist/2.2.39-HPNDYUPP.mjs +2344 -0
  10. package/dist/2.2.39-HPNDYUPP.mjs.map +1 -0
  11. package/dist/assets/assets/style.css +107 -1
  12. package/dist/assets/assets/survey-css/2.2.38.css +2335 -0
  13. package/dist/assets/assets/survey-css/2.2.39.css +2336 -0
  14. package/dist/chunk-3QS3WKRC.mjs +31 -0
  15. package/dist/chunk-3QS3WKRC.mjs.map +1 -0
  16. package/dist/chunk-BJTO5JO5.mjs +11 -0
  17. package/dist/chunk-BJTO5JO5.mjs.map +1 -0
  18. package/dist/{chunk-DNBFTJCA.mjs → chunk-FROREHRG.mjs} +516 -52
  19. package/dist/chunk-FROREHRG.mjs.map +1 -0
  20. package/dist/{chunk-7ZVOPIWE.mjs → chunk-OPR5I7WO.mjs} +557 -11
  21. package/dist/chunk-OPR5I7WO.mjs.map +1 -0
  22. package/dist/chunk-ZJ5HG3QF.mjs +3357 -0
  23. package/dist/chunk-ZJ5HG3QF.mjs.map +1 -0
  24. package/dist/index.d.mts +217 -9
  25. package/dist/index.d.ts +217 -9
  26. package/dist/index.js +7253 -1519
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +389 -49
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/index.native.d.mts +1681 -0
  31. package/dist/index.native.d.ts +1681 -0
  32. package/dist/index.native.js +15972 -0
  33. package/dist/index.native.js.map +1 -0
  34. package/dist/index.native.mjs +4011 -0
  35. package/dist/index.native.mjs.map +1 -0
  36. package/dist/react-native.d.mts +113 -7
  37. package/dist/react-native.d.ts +113 -7
  38. package/dist/react-native.js +5846 -162
  39. package/dist/react-native.js.map +1 -1
  40. package/dist/react-native.mjs +396 -51
  41. package/dist/react-native.mjs.map +1 -1
  42. package/dist/{renderPopup-B6VIV4VS.mjs → renderPopup-I6CPIR75.mjs} +133 -6
  43. package/dist/renderPopup-I6CPIR75.mjs.map +1 -0
  44. package/dist/renderPopup-RUY3OBYV.mjs +3847 -0
  45. package/dist/renderPopup-RUY3OBYV.mjs.map +1 -0
  46. package/dist/renderPopup-XNVNP2ZU.mjs +3847 -0
  47. package/dist/renderPopup-XNVNP2ZU.mjs.map +1 -0
  48. package/ios/DeepdotsBackgroundTask.m +71 -0
  49. package/package.json +14 -5
  50. package/react-native.config.js +9 -0
  51. package/dist/chunk-7ZVOPIWE.mjs.map +0 -1
  52. package/dist/chunk-DNBFTJCA.mjs.map +0 -1
  53. package/dist/renderPopup-B6VIV4VS.mjs.map +0 -1
  54. package/dist/renderPopup-BKZPAZZG.mjs +0 -3682
  55. package/dist/renderPopup-BKZPAZZG.mjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,3 +1,36 @@
1
+ /**
2
+ * Tiempo de ejecución en segundo plano para los envíos de analytics (DD-55).
3
+ *
4
+ * En iOS la app se suspende pocos segundos después de pasar a background. Si el POST con el
5
+ * cierre de la sesión sigue en vuelo, no termina hasta que el usuario vuelve a abrir la app
6
+ * (medido en producción con React Native, nov 2026: una de cada tres sesiones iOS se cerraba tarde o nunca, frente
7
+ * a ~2 % en Android). iOS concede más tiempo si la app lo pide (`beginBackgroundTask`), pero
8
+ * eso es una API nativa: el SDK es JS puro, así que el host le pasa una función que la abre.
9
+ *
10
+ * Contrato (igual que `beginBackgroundTask` del SDK nativo): `begin(name)` abre una tarea y
11
+ * devuelve la función que la cierra. Puede llamarse varias veces a la vez.
12
+ */
13
+ type BackgroundTaskRunner = (name: string) => () => void;
14
+ /**
15
+ * Techo de una tarea abierta por el SDK. iOS da ~30 s; el POST ya se da por fallido a los
16
+ * 20 s (`POST_TIMEOUT_MS`), así que esto solo cubre un `end` que no llegue nunca.
17
+ */
18
+ declare const BACKGROUND_TASK_MAX_MS = 25000;
19
+ /** Forma mínima de `react-native-background-timer` (`BackgroundTimer` por defecto). */
20
+ interface BackgroundTimerLike {
21
+ start(delay?: number): unknown;
22
+ stop(): unknown;
23
+ }
24
+ /**
25
+ * Adaptador sobre `react-native-background-timer`. En iOS su `start()` abre UNA background
26
+ * task (`beginBackgroundTaskWithName`, y cierra la anterior) y `stop()` la cierra, así que aquí
27
+ * se cuentan las tareas abiertas: `start` con la primera y `stop` cuando se cierra la última.
28
+ *
29
+ * Úsalo solo en iOS: en Android `start()` toma un wakelock (permiso `WAKE_LOCK`) que no hace
30
+ * falta, porque Android no suspende la app al pasar a background.
31
+ */
32
+ declare function backgroundTimerTask(timer: BackgroundTimerLike): BackgroundTaskRunner;
33
+
1
34
  /**
2
35
  * Identidad + sesión para el tracking de navegación (Fase 1).
3
36
  * Implementa el "Contrato común Web+KMP".
@@ -81,6 +114,8 @@ interface AnalyticsEnvelope {
81
114
  sessionId: string | null;
82
115
  context: {
83
116
  platform: string;
117
+ /** SDK que produce la analítica, `<plataforma>@<versión>` (`deepdots_sdk`). */
118
+ sdk?: string;
84
119
  language?: string;
85
120
  /** Info de dispositivo (Technology #11–13). */
86
121
  device?: DeviceInfo;
@@ -130,7 +165,7 @@ type AnalyticsSink = (payload: AnalyticsEnvelope, meta?: AnalyticsFlushMeta) =>
130
165
  * `feedback.finished` se queda siempre en `false` (no es la señal de cierre acordada).
131
166
  *
132
167
  * Encoding:
133
- * - todo va en `feedback.metadata`: contexto (user_id, session_id, platform…) + eventos
168
+ * - todo va en `feedback.metadata`: contexto (user_id, session_id, platform, sdk…) + eventos
134
169
  * - cada entrada usa `value: string[]` (array de un elemento)
135
170
  * - eventos: {key: nombre_evento, value: [JSON(timestamp + params)]}
136
171
  * - identidad (user_id) → `profile` como `external-user-id`
@@ -205,6 +240,12 @@ interface FeedbackSinkOptions {
205
240
  storage?: KeyValueStorage;
206
241
  /** Reloj inyectable (tests). */
207
242
  now?: () => number;
243
+ /**
244
+ * Abre una background task nativa mientras dura cada envío (iOS: `beginBackgroundTask`), para
245
+ * que el POST de cierre termine aunque la app pase a background. Sin él, iOS suele suspender
246
+ * la app con el POST en vuelo y el cierre llega al volver a abrirla (ver `background-task.ts`).
247
+ */
248
+ backgroundTask?: BackgroundTaskRunner;
208
249
  /** Callback invocado cuando la API acepta el primer lote de una sesión (registro abierto). */
209
250
  onSessionId?: (id: string) => void;
210
251
  /** Callback invocado al cerrar la sesión (`completed:true`): el sessionId cacheado se olvida. */
@@ -239,10 +280,6 @@ interface FeedbackSinkOptions {
239
280
  */
240
281
  declare function createFeedbackSink(options: FeedbackSinkOptions): AnalyticsSink;
241
282
 
242
- /**
243
- * Configuration options for initializing the DeepdotsPopups SDK
244
- */
245
-
246
283
  /**
247
284
  * Custom logger to receive the SDK's debug output instead of the console.
248
285
  * Only `log` is required; `warn`/`error`/`info` fall back to `log` when omitted.
@@ -267,6 +304,17 @@ interface FeedbackSession {
267
304
  sessionId: string;
268
305
  status: 'open' | 'closed';
269
306
  }
307
+ /** Signals the SDK detects on its own (see `DeepdotsInitParams.autoTrack`). */
308
+ interface AutoTrackOptions {
309
+ /** React Native: listen to `AppState` for session start/end. Default `true`. */
310
+ lifecycle?: boolean;
311
+ /**
312
+ * Uncaught errors: `window` `error`/`unhandledrejection` (web), `ErrorUtils` and promise
313
+ * rejections without `catch` under Hermes (React Native). Default `true`. Handlers installed
314
+ * by other tools (Sentry, Crashlytics) keep receiving everything.
315
+ */
316
+ errors?: boolean;
317
+ }
270
318
  interface DeepdotsInitParams {
271
319
  /** API key for authentication */
272
320
  apiKey?: string;
@@ -296,6 +344,24 @@ interface DeepdotsInitParams {
296
344
  language?: string;
297
345
  /** Injectable device info (RN: from react-native-device-info). If missing, it is derived from the browser. */
298
346
  device?: DeviceInfo;
347
+ /**
348
+ * React Native (iOS): opens a native background task while each analytics request is in
349
+ * flight, so the session's closing request finishes after the app goes to background
350
+ * instead of when the user opens the app again. `begin(name)` starts the task and returns
351
+ * the function that ends it (iOS `beginBackgroundTask` / `endBackgroundTask`). The SDK ends
352
+ * it when the request settles, or after 25 s. Use `backgroundTimerTask(BackgroundTimer)`
353
+ * for `react-native-background-timer`, iOS only. Without it, nothing changes: a closing
354
+ * request that does not finish is stored and sent on the next launch.
355
+ */
356
+ backgroundTask?: BackgroundTaskRunner;
357
+ /**
358
+ * What the SDK detects on its own. Everything is on by default; set a signal to `false` to
359
+ * turn it off. `lifecycle` (React Native): the SDK listens to `AppState` itself
360
+ * (`active` → session start, `inactive` → send pending data, `background` → session end), so
361
+ * the host does not need to call `onForeground` / `onInactive` / `onBackground`. Calling them
362
+ * as well is harmless: nothing is sent twice.
363
+ */
364
+ autoTrack?: AutoTrackOptions;
299
365
  /**
300
366
  * Analytics channel keys (`POST /sdk/feedback`). If provided, analytics is SENT
301
367
  * to the configured integration; if missing, it stays in dry-run mode: nothing is sent, and the payload is only
@@ -379,6 +445,11 @@ interface TriggerConfig {
379
445
  surveyId: string;
380
446
  /** Optional popup definition id (used to disambiguate repeated survey ids) */
381
447
  popupId?: string;
448
+ /**
449
+ * Seconds to wait once the trigger fires before showing the popup ("Delay" in the Admin).
450
+ * For `exit` it is the wait on the next route. 0 or missing = at once.
451
+ */
452
+ delaySeconds?: number;
382
453
  }
383
454
  /**
384
455
  * Event types emitted by the SDK
@@ -445,6 +516,11 @@ interface PopupTriggerCondition {
445
516
  interface PopupTrigger {
446
517
  type: PopupTriggerType;
447
518
  value: number | string;
519
+ /**
520
+ * "Delay (seconds)" in the Admin: wait this long after the trigger fires before showing the
521
+ * popup. 0 or missing = at once. For `exit` the Admin stores the delay here and `value` is 0.
522
+ */
523
+ delaySeconds?: number;
448
524
  }
449
525
  /** Accept action (open survey) */
450
526
  interface PopupActionAccept {
@@ -518,6 +594,21 @@ interface PopupDefinition {
518
594
  productId: string;
519
595
  style?: PopupStyle;
520
596
  segments?: PopupSegments;
597
+ /**
598
+ * Versión del survey asignada en el Admin (latest o fijada) y su survey SDK (DD-70). La manda
599
+ * la API desde DD-70; con APIs anteriores falta y se usa el survey SDK empaquetado.
600
+ */
601
+ surveyFrontend?: PopupSurveyFrontend | null;
602
+ }
603
+ /** `surveyFrontend` de `GET /sdk/{publicKey}/popups` (DD-70). */
604
+ interface PopupSurveyFrontend {
605
+ /** Versión de MagicSurvey resuelta (X.Y.Z). */
606
+ version?: string;
607
+ /** "latest" o la X.Y.Z fijada. */
608
+ preference?: string;
609
+ status?: string;
610
+ /** `@magicfeedback/native` con el que se construyó esa versión; null si no se conoce. */
611
+ sdkVersion?: string | null;
521
612
  }
522
613
 
523
614
  /**
@@ -546,6 +637,13 @@ interface PopupRenderOptions {
546
637
  * la hoja del survey. No aplica a React Native (el survey vive en su propio WebView).
547
638
  */
548
639
  cspNonce?: string;
640
+ /**
641
+ * `surveyFrontend.sdkVersion` del popup (DD-70): versión de `@magicfeedback/native` asignada
642
+ * al survey en el Admin. Se usa si está en el rango soportado y carga; si no, la empaquetada.
643
+ */
644
+ surveySdkVersion?: string | null;
645
+ /** `init({debug})`, para el log de la versión de survey SDK elegida. */
646
+ debug?: boolean;
549
647
  }
550
648
  interface PopupRenderer {
551
649
  /** Preparar recursos si aplica */
@@ -670,6 +768,10 @@ interface ReactNativeErrorUtils {
670
768
  getGlobalHandler?(): ((error: unknown, isFatal?: boolean) => void) | undefined;
671
769
  setGlobalHandler(handler: (error: unknown, isFatal?: boolean) => void): void;
672
770
  }
771
+ /** Fuente de promesas rechazadas sin `catch` (en RN, el hub del tracker de Hermes). */
772
+ interface UnhandledRejectionSource {
773
+ addUnhandledListener(listener: (error: unknown) => void): () => void;
774
+ }
673
775
  interface CrashReporterOptions {
674
776
  storage: KeyValueStorage;
675
777
  /** Emite un evento deepdots_app_crash AHORA (app viva). */
@@ -691,6 +793,8 @@ declare class CrashReporter {
691
793
  private windowInstalled;
692
794
  /** ErrorUtils ya enganchados: engancharlos dos veces capturaría cada error dos veces. */
693
795
  private hookedErrorUtils;
796
+ /** Fuentes de rejections ya enganchadas (idempotente, como ErrorUtils). */
797
+ private hookedRejections;
694
798
  constructor(options: CrashReporterOptions);
695
799
  private isEnabled;
696
800
  /** Construye un CrashRecord capturando contexto en el momento del crash. */
@@ -707,6 +811,12 @@ declare class CrashReporter {
707
811
  install(): void;
708
812
  /** Engancha `global.ErrorUtils` de RN (no hay `window`): persiste y encadena al handler previo. Idempotente por instancia de ErrorUtils. */
709
813
  installReactNative(errorUtils: ReactNativeErrorUtils): void;
814
+ /**
815
+ * Promesas rechazadas sin `catch` en React Native: como el `unhandledrejection` de web, se
816
+ * persisten y se reenvían en el arranque siguiente. La fuente encadena al tracker del host.
817
+ * Idempotente por fuente.
818
+ */
819
+ installPromiseRejections(source: UnhandledRejectionSource): void;
710
820
  /** @internal Test seam: ejercita el camino de persistencia (window handlers no son testeables en vitest). */
711
821
  _persistForTest(error: unknown): void;
712
822
  }
@@ -797,6 +907,10 @@ declare class DeepdotsPopups {
797
907
  private lastShown;
798
908
  private surveyToPopupId;
799
909
  private deferredExitTimers;
910
+ /** Popups esperando su `delaySeconds` (uno por popup). */
911
+ private delayedPopups;
912
+ /** Última pantalla de `setScreen` (React Native). */
913
+ private currentScreen;
800
914
  private baseUrl;
801
915
  private env;
802
916
  /** Si el SDK pinta el "modal" del popup (RN). Default true; false = el host lo envuelve. */
@@ -842,6 +956,10 @@ declare class DeepdotsPopups {
842
956
  private lastEngagementAt;
843
957
  /** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
844
958
  private hiddenAt;
959
+ /** `init({ autoTrack: { errors } })`: captura automática de errores. Activa por defecto. */
960
+ private autoTrackErrors;
961
+ /** Suscripción automática a AppState (React Native, `autoTrack.lifecycle`). */
962
+ private appStateSubscription;
845
963
  /**
846
964
  * Sesión suspendida por un `pagehide` (ms epoch y `deepdots_user_id`); null si no hay.
847
965
  * `openSession` la reanuda si sigue a tiempo (ver ANALYTICS_RESUME_WINDOW_MS).
@@ -948,6 +1066,22 @@ declare class DeepdotsPopups {
948
1066
  * Es la única señal disponible en móvil: el kill de la app (swipe) NO da callback.
949
1067
  */
950
1068
  onBackground(): void;
1069
+ /**
1070
+ * App a `inactive` (RN, iOS: centro de control, llamada, app switcher, y SIEMPRE justo antes
1071
+ * de `background`). NO cierra la sesión (es transitorio), pero envía lo acumulado con un
1072
+ * `user_engagement` que lleva la pantalla en curso, como web al ocultar la pestaña: si el
1073
+ * lote de cierre de `background` no llega a salir (iOS suspende la app), el backend ya
1074
+ * tiene el tiempo activo y la última pantalla. El contador sigue en marcha.
1075
+ */
1076
+ onInactive(): void;
1077
+ /**
1078
+ * Ciclo de vida automático en React Native (contrato de detección automática): el SDK escucha
1079
+ * AppState él mismo, así que el host no tiene que llamar a `onForeground`/`onInactive`/
1080
+ * `onBackground`. Si el host los llama además (integraciones anteriores), no se duplica nada:
1081
+ * abrir o cerrar una sesión ya abierta o cerrada no hace nada, y el engagement se consume.
1082
+ * `autoTrack.lifecycle: false` lo apaga.
1083
+ */
1084
+ private installAutoLifecycle;
951
1085
  /**
952
1086
  * Cierre EXPLÍCITO de la sesión por parte del host (logout, fin de flujo…): emite
953
1087
  * `session_end` y envía el último lote con `completed:true`.
@@ -958,6 +1092,13 @@ declare class DeepdotsPopups {
958
1092
  * anterior (`session_end` con `reason: 'user_change'` + `completed:true`), cambia la
959
1093
  * identidad y abre una sesión nueva. Sin `userId` vuelve al id anónimo del SDK.
960
1094
  *
1095
+ * Anónimo → identificado (la app arranca sin `userId` y lo pone al hacer login) es la MISMA
1096
+ * persona, no otra: el `session_start` de la sesión nueva lleva `identified: true`,
1097
+ * `previous_user_id` (el id anónimo) y `previous_session_id` (el registro que se acaba de
1098
+ * cerrar), para que el backend una las dos sin adivinar; y el estado de popups (mostrados,
1099
+ * respondidos, protecciones de mensajes) se conserva. Sin esto, cada persona que se registra
1100
+ * contaba dos veces: una que "abandona" en el login y otra registrada nueva.
1101
+ *
961
1102
  * Equivale a llamar a `init()` otra vez con otro `userId`.
962
1103
  */
963
1104
  setUserId(userId?: string): void;
@@ -1067,11 +1208,28 @@ declare class DeepdotsPopups {
1067
1208
  configureTriggers(triggers: TriggerConfig[]): void;
1068
1209
  /** Deriva triggers desde las definiciones de popup */
1069
1210
  private configureTriggersFromDefinitions;
1070
- /** Lógica para evaluar condiciones antes de mostrar una encuesta */
1071
- triggerSurvey(surveyId: string, popupId?: string): void;
1211
+ /**
1212
+ * Lógica para evaluar condiciones antes de mostrar una encuesta. `options.delaySeconds`
1213
+ * (lo pasan los triggers time/scroll/click con el "Delay" del Admin) espera ese tiempo y
1214
+ * vuelve a evaluar antes de mostrar; sin él, al momento como siempre.
1215
+ */
1216
+ triggerSurvey(surveyId: string, popupId?: string, options?: {
1217
+ delaySeconds?: number;
1218
+ }): void;
1072
1219
  /** Trigger popups configured with trigger.type = 'event' and matching trigger.value */
1073
1220
  triggerEvent(eventName: string): void;
1074
1221
  private evaluateEvent;
1222
+ /**
1223
+ * Muestra `def` ya, o tras su "Delay (seconds)" del Admin. Mientras espera:
1224
+ * - el mismo popup no se programa dos veces (el primer vencimiento manda);
1225
+ * - cambiar de ruta/pantalla o pasar a background lo cancela;
1226
+ * y al vencer se vuelve a evaluar todo (segmentos, idioma, cooldowns) como un disparo nuevo.
1227
+ * Si entonces hay otro popup abierto, `showDefinition` lo salta sin efectos, igual que hoy.
1228
+ */
1229
+ private showAfterDelay;
1230
+ private showDelayedPopup;
1231
+ private cancelDelayedPopups;
1232
+ private currentHref;
1075
1233
  /**
1076
1234
  * Guarda `trigger` si las definiciones aún no han llegado. Devuelve `true` si lo guardó (el
1077
1235
  * llamador no debe evaluarlo ahora) y `false` si no hay carga en vuelo (se evalúa ya, como
@@ -1282,6 +1440,11 @@ interface BuildSurveyHtmlOptions {
1282
1440
  env?: string;
1283
1441
  profile?: IdentityAnswer[];
1284
1442
  metadata?: IdentityAnswer[];
1443
+ /**
1444
+ * Versión de `@magicfeedback/native` a cargar (DD-70: la asignada al survey ya elegida con
1445
+ * `chooseSurveySdkVersion`). Por defecto la empaquetada. Con otra, el HTML trae su hoja
1446
+ * vendorizada y su JS; si cualquiera falla, la hoja y la JS empaquetadas.
1447
+ */
1285
1448
  version?: string;
1286
1449
  font?: PopupFont;
1287
1450
  theme?: 'light' | 'dark';
@@ -1352,7 +1515,7 @@ declare const REVEAL_TIMEOUT_MS = 1200;
1352
1515
  * resolución, para que las tres rutas (popup DOM web, WebView de RN y Compose) digan lo mismo.
1353
1516
  */
1354
1517
  /** Locales con traducción propia. Cualquier otro idioma cae a `en`. */
1355
- type PopupLocale = 'en' | 'es' | 'da' | 'no' | 'sv' | 'fi' | 'de' | 'fr' | 'pt' | 'ar' | 'bn' | 'zh-CN';
1518
+ type PopupLocale = 'en' | 'es' | 'da' | 'no' | 'sv' | 'fi' | 'de' | 'fr' | 'pt' | 'ar' | 'bn' | 'zh-CN' | 'bg' | 'cs' | 'el' | 'et' | 'ga' | 'hr' | 'hu' | 'it' | 'lt' | 'lv' | 'mt' | 'nl' | 'pl' | 'ro' | 'sk' | 'sl' | 'ca';
1356
1519
  interface PopupLabels {
1357
1520
  /** Acción principal: enviar la respuesta. */
1358
1521
  accept: string;
@@ -1376,6 +1539,8 @@ interface PopupLabels {
1376
1539
  loadingAria: string;
1377
1540
  /** Aviso al intentar avanzar con una pregunta obligatoria sin responder. */
1378
1541
  errorRequired: string;
1542
+ /** Aviso al intentar avanzar con un email que no es una dirección válida (`INVALID_EMAIL`). */
1543
+ errorInvalidEmail: string;
1379
1544
  /** Aviso cuando el envío falla. */
1380
1545
  errorSubmit: string;
1381
1546
  /** Aviso cuando el survey no ha podido cargar (el popup solo ofrece cerrarlo). */
@@ -1458,6 +1623,11 @@ interface ReactNativeSetupDeps {
1458
1623
  renderer?: PopupRenderer;
1459
1624
  /** `global.ErrorUtils` de RN (para capturar errores JS no manejados). Default: `globalThis.ErrorUtils`. */
1460
1625
  errorUtils?: ReactNativeErrorUtils | null;
1626
+ /**
1627
+ * Background task nativa para los envíos (iOS, DD-55). Si `config.backgroundTask` viene, gana
1628
+ * ese. Para `react-native-background-timer`: `backgroundTimerTask(BackgroundTimer)`.
1629
+ */
1630
+ backgroundTask?: BackgroundTaskRunner | null;
1461
1631
  }
1462
1632
  /** Adaptador KeyValueStorage (síncrono) sobre una instancia de MMKV. */
1463
1633
  declare function mmkvStorage(mmkv: MmkvLike): KeyValueStorage;
@@ -1470,4 +1640,42 @@ declare function collectRnDevice(d: DeviceInfoLike): DeviceInfo;
1470
1640
  */
1471
1641
  declare function setupReactNative(sdk: DeepdotsPopups, config: DeepdotsInitParams, deps?: ReactNativeSetupDeps): () => void;
1472
1642
 
1473
- export { type AnalyticsFeedbackBody, type AnalyticsKeys, type AppStateLike, BrowserPopupRenderer, type BuildBodyOptions, type ContactAttributeValue, type ContactAttributes, type ContactBody, ContactManager, type CrashRecord, CrashReporter, type CrashSeverity, type DeepdotsConfig, type DeepdotsEvent, type DeepdotsEventType, type DeepdotsInitParams, type DeepdotsLogger, DeepdotsPopups, type DeviceInfo, type DeviceInfoLike, type DeviceSnapshot, type EventListener, type FeedbackKV, type FeedbackSession, InMemoryStorage, type KeyValueStorage, LABELS, MAX_TRACKED_MESSAGES, MESSAGE_CHANNELS, type MessageChannel, MessageGuard, type MessageGuardVerdict, type MessageRejectionReason, type MessageStage, type MmkvLike, NATIVE_READY_GRACE_MS, NoopPopupRenderer, POPUP_TRIGGER_CONDITION_STATUSES, type PopupDefinition, type PopupLabels, type PopupLocale, type PopupRenderer, type PopupTrigger, type PopupTriggerCondition, type PopupTriggerConditionStatus, REVEAL_TIMEOUT_MS, RTL_LOCALES, type ReactNativeErrorUtils, ReactNativePopupRenderer, type ReactNativeRendererOptions, type ReactNativeSetupDeps, type ReactNativeSurveyPayload, type ReportErrorOptions, type ResolvedActionLabels, SUPPORTED_LANGUAGES, type SessionEndReason, type SessionStartReason, type TrackMessageOptions, type TriggerConfig, buildAnalyticsFeedbackBody, buildMessageParams, buildSurveyHtml, collectRnDevice, crashRecordToParams, createDefaultRenderer, createFeedbackSink, directionFor, getLabels, isRtlLanguage, mmkvStorage, resolveActionLabels, resolveLocale, setupReactNative };
1643
+ /**
1644
+ * Lo que el SDK necesita de React Native para detectar solo el ciclo de vida y el tiempo de
1645
+ * background (DD-55, contrato de detección automática). El core no importa `react-native` (se
1646
+ * usa también en web): lo registra la entrada de React Native del paquete
1647
+ * (`src/index.native.ts`, que Metro elige por la condición `react-native`) y el Provider.
1648
+ */
1649
+
1650
+ /** Opciones de `HermesInternal.enablePromiseRejectionTracker` (las mismas que `promise/rejection-tracking`). */
1651
+ interface RejectionTrackingOptions {
1652
+ allRejections?: boolean;
1653
+ onUnhandled?: (id: number, error: unknown) => void;
1654
+ onHandled?: (id: number, error?: unknown) => void;
1655
+ }
1656
+ /** Lo que el SDK necesita de `global.HermesInternal`. */
1657
+ interface HermesRejectionTrackerLike {
1658
+ enablePromiseRejectionTracker?: (options?: RejectionTrackingOptions) => void;
1659
+ }
1660
+ interface PromiseRejectionHub {
1661
+ /** Avisa de cada promesa rechazada sin `catch`. Devuelve la función que lo quita. */
1662
+ addUnhandledListener(listener: (error: unknown) => void): () => void;
1663
+ }
1664
+ /**
1665
+ * Promesas rechazadas sin `catch` en React Native (contrato de detección automática, paso 2).
1666
+ *
1667
+ * Hermes solo admite UN tracker (`enablePromiseRejectionTracker` sustituye al anterior) y no deja
1668
+ * leer el que hay. Para no quitarle las rejections a Sentry/Crashlytics, la entrada de React
1669
+ * Native envuelve la función al importarse el paquete, que es antes de que el código de la app
1670
+ * llame a `Sentry.init()` (los imports se evalúan primero): lo que instale después cualquiera se
1671
+ * compone con lo nuestro en vez de sustituirlo. Antes del import solo lo pudo instalar React
1672
+ * Native, y solo en desarrollo (el aviso "Possible unhandled promise rejection"), que se mantiene
1673
+ * con `dev`. Mientras el SDK no se engancha, la función envuelta pasa todo tal cual a Hermes.
1674
+ *
1675
+ * Devuelve null sin Hermes o sin el tracker (JSC): el SDK sigue sin capturarlas, como antes.
1676
+ */
1677
+ declare function createHermesRejectionHub(hermes: HermesRejectionTrackerLike | null | undefined, options: {
1678
+ dev: boolean;
1679
+ }): PromiseRejectionHub | null;
1680
+
1681
+ export { type AnalyticsFeedbackBody, type AnalyticsKeys, type AppStateLike, type AutoTrackOptions, BACKGROUND_TASK_MAX_MS, type BackgroundTaskRunner, type BackgroundTimerLike, BrowserPopupRenderer, type BuildBodyOptions, type ContactAttributeValue, type ContactAttributes, type ContactBody, ContactManager, type CrashRecord, CrashReporter, type CrashSeverity, type DeepdotsConfig, type DeepdotsEvent, type DeepdotsEventType, type DeepdotsInitParams, type DeepdotsLogger, DeepdotsPopups, type DeviceInfo, type DeviceInfoLike, type DeviceSnapshot, type EventListener, type FeedbackKV, type FeedbackSession, type HermesRejectionTrackerLike, InMemoryStorage, type KeyValueStorage, LABELS, MAX_TRACKED_MESSAGES, MESSAGE_CHANNELS, type MessageChannel, MessageGuard, type MessageGuardVerdict, type MessageRejectionReason, type MessageStage, type MmkvLike, NATIVE_READY_GRACE_MS, NoopPopupRenderer, POPUP_TRIGGER_CONDITION_STATUSES, type PopupDefinition, type PopupLabels, type PopupLocale, type PopupRenderer, type PopupTrigger, type PopupTriggerCondition, type PopupTriggerConditionStatus, type PromiseRejectionHub, REVEAL_TIMEOUT_MS, RTL_LOCALES, type ReactNativeErrorUtils, ReactNativePopupRenderer, type ReactNativeRendererOptions, type ReactNativeSetupDeps, type ReactNativeSurveyPayload, type RejectionTrackingOptions, type ReportErrorOptions, type ResolvedActionLabels, SUPPORTED_LANGUAGES, type SessionEndReason, type SessionStartReason, type TrackMessageOptions, type TriggerConfig, backgroundTimerTask, buildAnalyticsFeedbackBody, buildMessageParams, buildSurveyHtml, collectRnDevice, crashRecordToParams, createDefaultRenderer, createFeedbackSink, createHermesRejectionHub, directionFor, getLabels, isRtlLanguage, mmkvStorage, resolveActionLabels, resolveLocale, setupReactNative };