@magicfeedback/popup-sdk 1.18.0 → 1.19.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.
- package/MagicfeedbackPopupSdk.podspec +18 -0
- package/README.md +23 -0
- package/dist/2.2.38-CCK7SF4A.mjs +2343 -0
- package/dist/2.2.38-CCK7SF4A.mjs.map +1 -0
- package/dist/2.2.38-LGZRM7GX.mjs +2343 -0
- package/dist/2.2.38-LGZRM7GX.mjs.map +1 -0
- package/dist/2.2.39-BJJ3YRJ4.mjs +2344 -0
- package/dist/2.2.39-BJJ3YRJ4.mjs.map +1 -0
- package/dist/2.2.39-HPNDYUPP.mjs +2344 -0
- package/dist/2.2.39-HPNDYUPP.mjs.map +1 -0
- package/dist/assets/assets/style.css +107 -1
- package/dist/assets/assets/survey-css/2.2.38.css +2335 -0
- package/dist/assets/assets/survey-css/2.2.39.css +2336 -0
- package/dist/chunk-3QS3WKRC.mjs +31 -0
- package/dist/chunk-3QS3WKRC.mjs.map +1 -0
- package/dist/chunk-7ZQOAKXR.mjs +3335 -0
- package/dist/chunk-7ZQOAKXR.mjs.map +1 -0
- package/dist/chunk-BJTO5JO5.mjs +11 -0
- package/dist/chunk-BJTO5JO5.mjs.map +1 -0
- package/dist/{chunk-DNBFTJCA.mjs → chunk-EW2ARDEY.mjs} +496 -52
- package/dist/chunk-EW2ARDEY.mjs.map +1 -0
- package/dist/{chunk-7ZVOPIWE.mjs → chunk-XOEEBDBJ.mjs} +535 -11
- package/dist/chunk-XOEEBDBJ.mjs.map +1 -0
- package/dist/index.d.mts +152 -9
- package/dist/index.d.ts +152 -9
- package/dist/index.js +7139 -1511
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +294 -38
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.mts +1616 -0
- package/dist/index.native.d.ts +1616 -0
- package/dist/index.native.js +15853 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.native.mjs +3914 -0
- package/dist/index.native.mjs.map +1 -0
- package/dist/react-native.d.mts +98 -7
- package/dist/react-native.d.ts +98 -7
- package/dist/react-native.js +5725 -157
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +289 -40
- package/dist/react-native.mjs.map +1 -1
- package/dist/renderPopup-2Y4QMWR7.mjs +3847 -0
- package/dist/renderPopup-2Y4QMWR7.mjs.map +1 -0
- package/dist/renderPopup-YDJUON42.mjs +3847 -0
- package/dist/renderPopup-YDJUON42.mjs.map +1 -0
- package/dist/{renderPopup-B6VIV4VS.mjs → renderPopup-ZHTRMFO2.mjs} +133 -6
- package/dist/renderPopup-ZHTRMFO2.mjs.map +1 -0
- package/ios/DeepdotsBackgroundTask.m +71 -0
- package/package.json +14 -5
- package/react-native.config.js +9 -0
- package/dist/chunk-7ZVOPIWE.mjs.map +0 -1
- package/dist/chunk-DNBFTJCA.mjs.map +0 -1
- package/dist/renderPopup-B6VIV4VS.mjs.map +0 -1
- package/dist/renderPopup-BKZPAZZG.mjs +0 -3682
- package/dist/renderPopup-BKZPAZZG.mjs.map +0 -1
package/dist/react-native.d.mts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Tiempo de ejecución en segundo plano para los envíos de analytics (DD-55).
|
|
5
|
+
*
|
|
6
|
+
* En iOS la app se suspende pocos segundos después de pasar a background. Si el POST con el
|
|
7
|
+
* cierre de la sesión sigue en vuelo, no termina hasta que el usuario vuelve a abrir la app
|
|
8
|
+
* (medido en producción con React Native, nov 2026: una de cada tres sesiones iOS se cerraba tarde o nunca, frente
|
|
9
|
+
* a ~2 % en Android). iOS concede más tiempo si la app lo pide (`beginBackgroundTask`), pero
|
|
10
|
+
* eso es una API nativa: el SDK es JS puro, así que el host le pasa una función que la abre.
|
|
11
|
+
*
|
|
12
|
+
* Contrato (igual que `beginBackgroundTask` del SDK nativo): `begin(name)` abre una tarea y
|
|
13
|
+
* devuelve la función que la cierra. Puede llamarse varias veces a la vez.
|
|
14
|
+
*/
|
|
15
|
+
type BackgroundTaskRunner = (name: string) => () => void;
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* Identidad + sesión para el tracking de navegación (Fase 1).
|
|
5
19
|
* Implementa el "Contrato común Web+KMP".
|
|
@@ -71,6 +85,8 @@ interface AnalyticsEnvelope {
|
|
|
71
85
|
sessionId: string | null;
|
|
72
86
|
context: {
|
|
73
87
|
platform: string;
|
|
88
|
+
/** SDK que produce la analítica, `<plataforma>@<versión>` (`deepdots_sdk`). */
|
|
89
|
+
sdk?: string;
|
|
74
90
|
language?: string;
|
|
75
91
|
/** Info de dispositivo (Technology #11–13). */
|
|
76
92
|
device?: DeviceInfo;
|
|
@@ -93,7 +109,7 @@ interface AnalyticsEnvelope {
|
|
|
93
109
|
* `feedback.finished` se queda siempre en `false` (no es la señal de cierre acordada).
|
|
94
110
|
*
|
|
95
111
|
* Encoding:
|
|
96
|
-
* - todo va en `feedback.metadata`: contexto (user_id, session_id, platform…) + eventos
|
|
112
|
+
* - todo va en `feedback.metadata`: contexto (user_id, session_id, platform, sdk…) + eventos
|
|
97
113
|
* - cada entrada usa `value: string[]` (array de un elemento)
|
|
98
114
|
* - eventos: {key: nombre_evento, value: [JSON(timestamp + params)]}
|
|
99
115
|
* - identidad (user_id) → `profile` como `external-user-id`
|
|
@@ -107,10 +123,6 @@ interface AnalyticsKeys {
|
|
|
107
123
|
integration: string;
|
|
108
124
|
}
|
|
109
125
|
|
|
110
|
-
/**
|
|
111
|
-
* Configuration options for initializing the DeepdotsPopups SDK
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
126
|
/**
|
|
115
127
|
* Custom logger to receive the SDK's debug output instead of the console.
|
|
116
128
|
* Only `log` is required; `warn`/`error`/`info` fall back to `log` when omitted.
|
|
@@ -135,6 +147,11 @@ interface FeedbackSession {
|
|
|
135
147
|
sessionId: string;
|
|
136
148
|
status: 'open' | 'closed';
|
|
137
149
|
}
|
|
150
|
+
/** Signals the SDK detects on its own (see `DeepdotsInitParams.autoTrack`). */
|
|
151
|
+
interface AutoTrackOptions {
|
|
152
|
+
/** React Native: listen to `AppState` for session start/end. Default `true`. */
|
|
153
|
+
lifecycle?: boolean;
|
|
154
|
+
}
|
|
138
155
|
interface DeepdotsInitParams {
|
|
139
156
|
/** API key for authentication */
|
|
140
157
|
apiKey?: string;
|
|
@@ -164,6 +181,24 @@ interface DeepdotsInitParams {
|
|
|
164
181
|
language?: string;
|
|
165
182
|
/** Injectable device info (RN: from react-native-device-info). If missing, it is derived from the browser. */
|
|
166
183
|
device?: DeviceInfo;
|
|
184
|
+
/**
|
|
185
|
+
* React Native (iOS): opens a native background task while each analytics request is in
|
|
186
|
+
* flight, so the session's closing request finishes after the app goes to background
|
|
187
|
+
* instead of when the user opens the app again. `begin(name)` starts the task and returns
|
|
188
|
+
* the function that ends it (iOS `beginBackgroundTask` / `endBackgroundTask`). The SDK ends
|
|
189
|
+
* it when the request settles, or after 25 s. Use `backgroundTimerTask(BackgroundTimer)`
|
|
190
|
+
* for `react-native-background-timer`, iOS only. Without it, nothing changes: a closing
|
|
191
|
+
* request that does not finish is stored and sent on the next launch.
|
|
192
|
+
*/
|
|
193
|
+
backgroundTask?: BackgroundTaskRunner;
|
|
194
|
+
/**
|
|
195
|
+
* What the SDK detects on its own. Everything is on by default; set a signal to `false` to
|
|
196
|
+
* turn it off. `lifecycle` (React Native): the SDK listens to `AppState` itself
|
|
197
|
+
* (`active` → session start, `inactive` → send pending data, `background` → session end), so
|
|
198
|
+
* the host does not need to call `onForeground` / `onInactive` / `onBackground`. Calling them
|
|
199
|
+
* as well is harmless: nothing is sent twice.
|
|
200
|
+
*/
|
|
201
|
+
autoTrack?: AutoTrackOptions;
|
|
167
202
|
/**
|
|
168
203
|
* Analytics channel keys (`POST /sdk/feedback`). If provided, analytics is SENT
|
|
169
204
|
* to the configured integration; if missing, it stays in dry-run mode: nothing is sent, and the payload is only
|
|
@@ -239,6 +274,11 @@ interface TriggerConfig {
|
|
|
239
274
|
surveyId: string;
|
|
240
275
|
/** Optional popup definition id (used to disambiguate repeated survey ids) */
|
|
241
276
|
popupId?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Seconds to wait once the trigger fires before showing the popup ("Delay" in the Admin).
|
|
279
|
+
* For `exit` it is the wait on the next route. 0 or missing = at once.
|
|
280
|
+
*/
|
|
281
|
+
delaySeconds?: number;
|
|
242
282
|
}
|
|
243
283
|
/**
|
|
244
284
|
* Event types emitted by the SDK
|
|
@@ -335,6 +375,13 @@ interface PopupRenderOptions {
|
|
|
335
375
|
* la hoja del survey. No aplica a React Native (el survey vive en su propio WebView).
|
|
336
376
|
*/
|
|
337
377
|
cspNonce?: string;
|
|
378
|
+
/**
|
|
379
|
+
* `surveyFrontend.sdkVersion` del popup (DD-70): versión de `@magicfeedback/native` asignada
|
|
380
|
+
* al survey en el Admin. Se usa si está en el rango soportado y carga; si no, la empaquetada.
|
|
381
|
+
*/
|
|
382
|
+
surveySdkVersion?: string | null;
|
|
383
|
+
/** `init({debug})`, para el log de la versión de survey SDK elegida. */
|
|
384
|
+
debug?: boolean;
|
|
338
385
|
}
|
|
339
386
|
interface PopupRenderer {
|
|
340
387
|
/** Preparar recursos si aplica */
|
|
@@ -436,6 +483,10 @@ declare class DeepdotsPopups {
|
|
|
436
483
|
private lastShown;
|
|
437
484
|
private surveyToPopupId;
|
|
438
485
|
private deferredExitTimers;
|
|
486
|
+
/** Popups esperando su `delaySeconds` (uno por popup). */
|
|
487
|
+
private delayedPopups;
|
|
488
|
+
/** Última pantalla de `setScreen` (React Native). */
|
|
489
|
+
private currentScreen;
|
|
439
490
|
private baseUrl;
|
|
440
491
|
private env;
|
|
441
492
|
/** Si el SDK pinta el "modal" del popup (RN). Default true; false = el host lo envuelve. */
|
|
@@ -481,6 +532,8 @@ declare class DeepdotsPopups {
|
|
|
481
532
|
private lastEngagementAt;
|
|
482
533
|
/** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
|
|
483
534
|
private hiddenAt;
|
|
535
|
+
/** Suscripción automática a AppState (React Native, `autoTrack.lifecycle`). */
|
|
536
|
+
private appStateSubscription;
|
|
484
537
|
/**
|
|
485
538
|
* Sesión suspendida por un `pagehide` (ms epoch y `deepdots_user_id`); null si no hay.
|
|
486
539
|
* `openSession` la reanuda si sigue a tiempo (ver ANALYTICS_RESUME_WINDOW_MS).
|
|
@@ -587,6 +640,22 @@ declare class DeepdotsPopups {
|
|
|
587
640
|
* Es la única señal disponible en móvil: el kill de la app (swipe) NO da callback.
|
|
588
641
|
*/
|
|
589
642
|
onBackground(): void;
|
|
643
|
+
/**
|
|
644
|
+
* App a `inactive` (RN, iOS: centro de control, llamada, app switcher, y SIEMPRE justo antes
|
|
645
|
+
* de `background`). NO cierra la sesión (es transitorio), pero envía lo acumulado con un
|
|
646
|
+
* `user_engagement` que lleva la pantalla en curso, como web al ocultar la pestaña: si el
|
|
647
|
+
* lote de cierre de `background` no llega a salir (iOS suspende la app), el backend ya
|
|
648
|
+
* tiene el tiempo activo y la última pantalla. El contador sigue en marcha.
|
|
649
|
+
*/
|
|
650
|
+
onInactive(): void;
|
|
651
|
+
/**
|
|
652
|
+
* Ciclo de vida automático en React Native (contrato de detección automática): el SDK escucha
|
|
653
|
+
* AppState él mismo, así que el host no tiene que llamar a `onForeground`/`onInactive`/
|
|
654
|
+
* `onBackground`. Si el host los llama además (integraciones anteriores), no se duplica nada:
|
|
655
|
+
* abrir o cerrar una sesión ya abierta o cerrada no hace nada, y el engagement se consume.
|
|
656
|
+
* `autoTrack.lifecycle: false` lo apaga.
|
|
657
|
+
*/
|
|
658
|
+
private installAutoLifecycle;
|
|
590
659
|
/**
|
|
591
660
|
* Cierre EXPLÍCITO de la sesión por parte del host (logout, fin de flujo…): emite
|
|
592
661
|
* `session_end` y envía el último lote con `completed:true`.
|
|
@@ -706,11 +775,28 @@ declare class DeepdotsPopups {
|
|
|
706
775
|
configureTriggers(triggers: TriggerConfig[]): void;
|
|
707
776
|
/** Deriva triggers desde las definiciones de popup */
|
|
708
777
|
private configureTriggersFromDefinitions;
|
|
709
|
-
/**
|
|
710
|
-
|
|
778
|
+
/**
|
|
779
|
+
* Lógica para evaluar condiciones antes de mostrar una encuesta. `options.delaySeconds`
|
|
780
|
+
* (lo pasan los triggers time/scroll/click con el "Delay" del Admin) espera ese tiempo y
|
|
781
|
+
* vuelve a evaluar antes de mostrar; sin él, al momento como siempre.
|
|
782
|
+
*/
|
|
783
|
+
triggerSurvey(surveyId: string, popupId?: string, options?: {
|
|
784
|
+
delaySeconds?: number;
|
|
785
|
+
}): void;
|
|
711
786
|
/** Trigger popups configured with trigger.type = 'event' and matching trigger.value */
|
|
712
787
|
triggerEvent(eventName: string): void;
|
|
713
788
|
private evaluateEvent;
|
|
789
|
+
/**
|
|
790
|
+
* Muestra `def` ya, o tras su "Delay (seconds)" del Admin. Mientras espera:
|
|
791
|
+
* - el mismo popup no se programa dos veces (el primer vencimiento manda);
|
|
792
|
+
* - cambiar de ruta/pantalla o pasar a background lo cancela;
|
|
793
|
+
* y al vencer se vuelve a evaluar todo (segmentos, idioma, cooldowns) como un disparo nuevo.
|
|
794
|
+
* Si entonces hay otro popup abierto, `showDefinition` lo salta sin efectos, igual que hoy.
|
|
795
|
+
*/
|
|
796
|
+
private showAfterDelay;
|
|
797
|
+
private showDelayedPopup;
|
|
798
|
+
private cancelDelayedPopups;
|
|
799
|
+
private currentHref;
|
|
714
800
|
/**
|
|
715
801
|
* Guarda `trigger` si las definiciones aún no han llegado. Devuelve `true` si lo guardó (el
|
|
716
802
|
* llamador no debe evaluarlo ahora) y `false` si no hay carga en vuelo (se evalúa ya, como
|
|
@@ -851,6 +937,11 @@ interface ReactNativeSetupDeps {
|
|
|
851
937
|
renderer?: PopupRenderer;
|
|
852
938
|
/** `global.ErrorUtils` de RN (para capturar errores JS no manejados). Default: `globalThis.ErrorUtils`. */
|
|
853
939
|
errorUtils?: ReactNativeErrorUtils | null;
|
|
940
|
+
/**
|
|
941
|
+
* Background task nativa para los envíos (iOS, DD-55). Si `config.backgroundTask` viene, gana
|
|
942
|
+
* ese. Para `react-native-background-timer`: `backgroundTimerTask(BackgroundTimer)`.
|
|
943
|
+
*/
|
|
944
|
+
backgroundTask?: BackgroundTaskRunner | null;
|
|
854
945
|
}
|
|
855
946
|
/**
|
|
856
947
|
* Configura el SDK para React Native en una sola llamada: storage persistente (MMKV),
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Tiempo de ejecución en segundo plano para los envíos de analytics (DD-55).
|
|
5
|
+
*
|
|
6
|
+
* En iOS la app se suspende pocos segundos después de pasar a background. Si el POST con el
|
|
7
|
+
* cierre de la sesión sigue en vuelo, no termina hasta que el usuario vuelve a abrir la app
|
|
8
|
+
* (medido en producción con React Native, nov 2026: una de cada tres sesiones iOS se cerraba tarde o nunca, frente
|
|
9
|
+
* a ~2 % en Android). iOS concede más tiempo si la app lo pide (`beginBackgroundTask`), pero
|
|
10
|
+
* eso es una API nativa: el SDK es JS puro, así que el host le pasa una función que la abre.
|
|
11
|
+
*
|
|
12
|
+
* Contrato (igual que `beginBackgroundTask` del SDK nativo): `begin(name)` abre una tarea y
|
|
13
|
+
* devuelve la función que la cierra. Puede llamarse varias veces a la vez.
|
|
14
|
+
*/
|
|
15
|
+
type BackgroundTaskRunner = (name: string) => () => void;
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* Identidad + sesión para el tracking de navegación (Fase 1).
|
|
5
19
|
* Implementa el "Contrato común Web+KMP".
|
|
@@ -71,6 +85,8 @@ interface AnalyticsEnvelope {
|
|
|
71
85
|
sessionId: string | null;
|
|
72
86
|
context: {
|
|
73
87
|
platform: string;
|
|
88
|
+
/** SDK que produce la analítica, `<plataforma>@<versión>` (`deepdots_sdk`). */
|
|
89
|
+
sdk?: string;
|
|
74
90
|
language?: string;
|
|
75
91
|
/** Info de dispositivo (Technology #11–13). */
|
|
76
92
|
device?: DeviceInfo;
|
|
@@ -93,7 +109,7 @@ interface AnalyticsEnvelope {
|
|
|
93
109
|
* `feedback.finished` se queda siempre en `false` (no es la señal de cierre acordada).
|
|
94
110
|
*
|
|
95
111
|
* Encoding:
|
|
96
|
-
* - todo va en `feedback.metadata`: contexto (user_id, session_id, platform…) + eventos
|
|
112
|
+
* - todo va en `feedback.metadata`: contexto (user_id, session_id, platform, sdk…) + eventos
|
|
97
113
|
* - cada entrada usa `value: string[]` (array de un elemento)
|
|
98
114
|
* - eventos: {key: nombre_evento, value: [JSON(timestamp + params)]}
|
|
99
115
|
* - identidad (user_id) → `profile` como `external-user-id`
|
|
@@ -107,10 +123,6 @@ interface AnalyticsKeys {
|
|
|
107
123
|
integration: string;
|
|
108
124
|
}
|
|
109
125
|
|
|
110
|
-
/**
|
|
111
|
-
* Configuration options for initializing the DeepdotsPopups SDK
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
126
|
/**
|
|
115
127
|
* Custom logger to receive the SDK's debug output instead of the console.
|
|
116
128
|
* Only `log` is required; `warn`/`error`/`info` fall back to `log` when omitted.
|
|
@@ -135,6 +147,11 @@ interface FeedbackSession {
|
|
|
135
147
|
sessionId: string;
|
|
136
148
|
status: 'open' | 'closed';
|
|
137
149
|
}
|
|
150
|
+
/** Signals the SDK detects on its own (see `DeepdotsInitParams.autoTrack`). */
|
|
151
|
+
interface AutoTrackOptions {
|
|
152
|
+
/** React Native: listen to `AppState` for session start/end. Default `true`. */
|
|
153
|
+
lifecycle?: boolean;
|
|
154
|
+
}
|
|
138
155
|
interface DeepdotsInitParams {
|
|
139
156
|
/** API key for authentication */
|
|
140
157
|
apiKey?: string;
|
|
@@ -164,6 +181,24 @@ interface DeepdotsInitParams {
|
|
|
164
181
|
language?: string;
|
|
165
182
|
/** Injectable device info (RN: from react-native-device-info). If missing, it is derived from the browser. */
|
|
166
183
|
device?: DeviceInfo;
|
|
184
|
+
/**
|
|
185
|
+
* React Native (iOS): opens a native background task while each analytics request is in
|
|
186
|
+
* flight, so the session's closing request finishes after the app goes to background
|
|
187
|
+
* instead of when the user opens the app again. `begin(name)` starts the task and returns
|
|
188
|
+
* the function that ends it (iOS `beginBackgroundTask` / `endBackgroundTask`). The SDK ends
|
|
189
|
+
* it when the request settles, or after 25 s. Use `backgroundTimerTask(BackgroundTimer)`
|
|
190
|
+
* for `react-native-background-timer`, iOS only. Without it, nothing changes: a closing
|
|
191
|
+
* request that does not finish is stored and sent on the next launch.
|
|
192
|
+
*/
|
|
193
|
+
backgroundTask?: BackgroundTaskRunner;
|
|
194
|
+
/**
|
|
195
|
+
* What the SDK detects on its own. Everything is on by default; set a signal to `false` to
|
|
196
|
+
* turn it off. `lifecycle` (React Native): the SDK listens to `AppState` itself
|
|
197
|
+
* (`active` → session start, `inactive` → send pending data, `background` → session end), so
|
|
198
|
+
* the host does not need to call `onForeground` / `onInactive` / `onBackground`. Calling them
|
|
199
|
+
* as well is harmless: nothing is sent twice.
|
|
200
|
+
*/
|
|
201
|
+
autoTrack?: AutoTrackOptions;
|
|
167
202
|
/**
|
|
168
203
|
* Analytics channel keys (`POST /sdk/feedback`). If provided, analytics is SENT
|
|
169
204
|
* to the configured integration; if missing, it stays in dry-run mode: nothing is sent, and the payload is only
|
|
@@ -239,6 +274,11 @@ interface TriggerConfig {
|
|
|
239
274
|
surveyId: string;
|
|
240
275
|
/** Optional popup definition id (used to disambiguate repeated survey ids) */
|
|
241
276
|
popupId?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Seconds to wait once the trigger fires before showing the popup ("Delay" in the Admin).
|
|
279
|
+
* For `exit` it is the wait on the next route. 0 or missing = at once.
|
|
280
|
+
*/
|
|
281
|
+
delaySeconds?: number;
|
|
242
282
|
}
|
|
243
283
|
/**
|
|
244
284
|
* Event types emitted by the SDK
|
|
@@ -335,6 +375,13 @@ interface PopupRenderOptions {
|
|
|
335
375
|
* la hoja del survey. No aplica a React Native (el survey vive en su propio WebView).
|
|
336
376
|
*/
|
|
337
377
|
cspNonce?: string;
|
|
378
|
+
/**
|
|
379
|
+
* `surveyFrontend.sdkVersion` del popup (DD-70): versión de `@magicfeedback/native` asignada
|
|
380
|
+
* al survey en el Admin. Se usa si está en el rango soportado y carga; si no, la empaquetada.
|
|
381
|
+
*/
|
|
382
|
+
surveySdkVersion?: string | null;
|
|
383
|
+
/** `init({debug})`, para el log de la versión de survey SDK elegida. */
|
|
384
|
+
debug?: boolean;
|
|
338
385
|
}
|
|
339
386
|
interface PopupRenderer {
|
|
340
387
|
/** Preparar recursos si aplica */
|
|
@@ -436,6 +483,10 @@ declare class DeepdotsPopups {
|
|
|
436
483
|
private lastShown;
|
|
437
484
|
private surveyToPopupId;
|
|
438
485
|
private deferredExitTimers;
|
|
486
|
+
/** Popups esperando su `delaySeconds` (uno por popup). */
|
|
487
|
+
private delayedPopups;
|
|
488
|
+
/** Última pantalla de `setScreen` (React Native). */
|
|
489
|
+
private currentScreen;
|
|
439
490
|
private baseUrl;
|
|
440
491
|
private env;
|
|
441
492
|
/** Si el SDK pinta el "modal" del popup (RN). Default true; false = el host lo envuelve. */
|
|
@@ -481,6 +532,8 @@ declare class DeepdotsPopups {
|
|
|
481
532
|
private lastEngagementAt;
|
|
482
533
|
/** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
|
|
483
534
|
private hiddenAt;
|
|
535
|
+
/** Suscripción automática a AppState (React Native, `autoTrack.lifecycle`). */
|
|
536
|
+
private appStateSubscription;
|
|
484
537
|
/**
|
|
485
538
|
* Sesión suspendida por un `pagehide` (ms epoch y `deepdots_user_id`); null si no hay.
|
|
486
539
|
* `openSession` la reanuda si sigue a tiempo (ver ANALYTICS_RESUME_WINDOW_MS).
|
|
@@ -587,6 +640,22 @@ declare class DeepdotsPopups {
|
|
|
587
640
|
* Es la única señal disponible en móvil: el kill de la app (swipe) NO da callback.
|
|
588
641
|
*/
|
|
589
642
|
onBackground(): void;
|
|
643
|
+
/**
|
|
644
|
+
* App a `inactive` (RN, iOS: centro de control, llamada, app switcher, y SIEMPRE justo antes
|
|
645
|
+
* de `background`). NO cierra la sesión (es transitorio), pero envía lo acumulado con un
|
|
646
|
+
* `user_engagement` que lleva la pantalla en curso, como web al ocultar la pestaña: si el
|
|
647
|
+
* lote de cierre de `background` no llega a salir (iOS suspende la app), el backend ya
|
|
648
|
+
* tiene el tiempo activo y la última pantalla. El contador sigue en marcha.
|
|
649
|
+
*/
|
|
650
|
+
onInactive(): void;
|
|
651
|
+
/**
|
|
652
|
+
* Ciclo de vida automático en React Native (contrato de detección automática): el SDK escucha
|
|
653
|
+
* AppState él mismo, así que el host no tiene que llamar a `onForeground`/`onInactive`/
|
|
654
|
+
* `onBackground`. Si el host los llama además (integraciones anteriores), no se duplica nada:
|
|
655
|
+
* abrir o cerrar una sesión ya abierta o cerrada no hace nada, y el engagement se consume.
|
|
656
|
+
* `autoTrack.lifecycle: false` lo apaga.
|
|
657
|
+
*/
|
|
658
|
+
private installAutoLifecycle;
|
|
590
659
|
/**
|
|
591
660
|
* Cierre EXPLÍCITO de la sesión por parte del host (logout, fin de flujo…): emite
|
|
592
661
|
* `session_end` y envía el último lote con `completed:true`.
|
|
@@ -706,11 +775,28 @@ declare class DeepdotsPopups {
|
|
|
706
775
|
configureTriggers(triggers: TriggerConfig[]): void;
|
|
707
776
|
/** Deriva triggers desde las definiciones de popup */
|
|
708
777
|
private configureTriggersFromDefinitions;
|
|
709
|
-
/**
|
|
710
|
-
|
|
778
|
+
/**
|
|
779
|
+
* Lógica para evaluar condiciones antes de mostrar una encuesta. `options.delaySeconds`
|
|
780
|
+
* (lo pasan los triggers time/scroll/click con el "Delay" del Admin) espera ese tiempo y
|
|
781
|
+
* vuelve a evaluar antes de mostrar; sin él, al momento como siempre.
|
|
782
|
+
*/
|
|
783
|
+
triggerSurvey(surveyId: string, popupId?: string, options?: {
|
|
784
|
+
delaySeconds?: number;
|
|
785
|
+
}): void;
|
|
711
786
|
/** Trigger popups configured with trigger.type = 'event' and matching trigger.value */
|
|
712
787
|
triggerEvent(eventName: string): void;
|
|
713
788
|
private evaluateEvent;
|
|
789
|
+
/**
|
|
790
|
+
* Muestra `def` ya, o tras su "Delay (seconds)" del Admin. Mientras espera:
|
|
791
|
+
* - el mismo popup no se programa dos veces (el primer vencimiento manda);
|
|
792
|
+
* - cambiar de ruta/pantalla o pasar a background lo cancela;
|
|
793
|
+
* y al vencer se vuelve a evaluar todo (segmentos, idioma, cooldowns) como un disparo nuevo.
|
|
794
|
+
* Si entonces hay otro popup abierto, `showDefinition` lo salta sin efectos, igual que hoy.
|
|
795
|
+
*/
|
|
796
|
+
private showAfterDelay;
|
|
797
|
+
private showDelayedPopup;
|
|
798
|
+
private cancelDelayedPopups;
|
|
799
|
+
private currentHref;
|
|
714
800
|
/**
|
|
715
801
|
* Guarda `trigger` si las definiciones aún no han llegado. Devuelve `true` si lo guardó (el
|
|
716
802
|
* llamador no debe evaluarlo ahora) y `false` si no hay carga en vuelo (se evalúa ya, como
|
|
@@ -851,6 +937,11 @@ interface ReactNativeSetupDeps {
|
|
|
851
937
|
renderer?: PopupRenderer;
|
|
852
938
|
/** `global.ErrorUtils` de RN (para capturar errores JS no manejados). Default: `globalThis.ErrorUtils`. */
|
|
853
939
|
errorUtils?: ReactNativeErrorUtils | null;
|
|
940
|
+
/**
|
|
941
|
+
* Background task nativa para los envíos (iOS, DD-55). Si `config.backgroundTask` viene, gana
|
|
942
|
+
* ese. Para `react-native-background-timer`: `backgroundTimerTask(BackgroundTimer)`.
|
|
943
|
+
*/
|
|
944
|
+
backgroundTask?: BackgroundTaskRunner | null;
|
|
854
945
|
}
|
|
855
946
|
/**
|
|
856
947
|
* Configura el SDK para React Native en una sola llamada: storage persistente (MMKV),
|