@magicfeedback/popup-sdk 1.10.0 → 1.12.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/README.md +23 -1
- package/dist/index.d.mts +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +253 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -20
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +61 -3
- package/dist/react-native.d.ts +61 -3
- package/dist/react-native.js +254 -23
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +236 -20
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-WLOFOCDR.mjs → renderPopup-JF6IB6HL.mjs} +22 -7
- package/dist/renderPopup-JF6IB6HL.mjs.map +1 -0
- package/dist/{renderPopup-424HR5LF.mjs → renderPopup-KSZJ5AN4.mjs} +22 -7
- package/dist/renderPopup-KSZJ5AN4.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/renderPopup-424HR5LF.mjs.map +0 -1
- package/dist/renderPopup-WLOFOCDR.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -215,6 +215,26 @@ const renderer = new ReactNativePopupRenderer({
|
|
|
215
215
|
`onReady` is optional: a host that opens its container on `onShow` still never shows the spinner,
|
|
216
216
|
because the HTML reveals itself; the container just appears a few hundred ms before the card.
|
|
217
217
|
|
|
218
|
+
### Focus on text questions
|
|
219
|
+
|
|
220
|
+
When the first question of a page is a text field (text, long text, email or number), the cursor
|
|
221
|
+
is placed in it so the user can start typing:
|
|
222
|
+
|
|
223
|
+
- **When the popup opens:** only on devices with a mouse or trackpad (`pointer: fine`). On touch
|
|
224
|
+
devices it does nothing, so the keyboard never pops up over a popup the user has not touched.
|
|
225
|
+
- **After Start, Next or Back:** on every device, since the user has just tapped.
|
|
226
|
+
|
|
227
|
+
Only the first question counts: if the page starts with a rating and the text field comes after
|
|
228
|
+
it, nothing is focused. The focus is never taken away from a field of the host page.
|
|
229
|
+
|
|
230
|
+
The focus itself comes from `@magicfeedback/native` (its `autofocus` option, which the popup sets
|
|
231
|
+
to `'navigation'`, and `focusFirstQuestion()` when the popup is revealed). Versions of
|
|
232
|
+
`@magicfeedback/native` without that option simply ignore it.
|
|
233
|
+
|
|
234
|
+
In React Native on iOS, the WebView ignores focus set from JavaScript unless the keyboard is
|
|
235
|
+
allowed to open without a direct tap. `DeepdotsProvider` already does this; if you mount the
|
|
236
|
+
WebView yourself, add `keyboardDisplayRequiresUserAction={false}` to it.
|
|
237
|
+
|
|
218
238
|
### `autoLaunch()`
|
|
219
239
|
|
|
220
240
|
Starts the triggers derived from the popup definitions loaded during `init()`.
|
|
@@ -237,6 +257,8 @@ Example:
|
|
|
237
257
|
popups.triggerEvent('search');
|
|
238
258
|
```
|
|
239
259
|
|
|
260
|
+
It can be called right after `init()`: if the popup definitions are still loading, the event is kept and evaluated as soon as they arrive (the same applies to `triggerSurvey`).
|
|
261
|
+
|
|
240
262
|
### `triggerSurvey(surveyId, popupId?)`
|
|
241
263
|
|
|
242
264
|
Opens a specific survey directly, bypassing trigger evaluation.
|
|
@@ -500,7 +522,7 @@ interface DeepdotsEvent {
|
|
|
500
522
|
- `action`
|
|
501
523
|
- `userId`
|
|
502
524
|
|
|
503
|
-
`popup_clicked`
|
|
525
|
+
`popup_clicked` means the user did something in the popup. On the web, `data.action` is one of `start_survey`, `manual_send`, `back`, `complete`, `close_icon`, or `partial` (the user answered a page and moved on; this one also marks the popup as `PARTIAL` in the backend). Loading the survey, the start of a submit, and validation or submit errors are not interactions and do not emit it. In React Native the bridge emits it once per popup, with `action: 'partial'`, on the first real interaction (sending an answer or going back).
|
|
504
526
|
|
|
505
527
|
## Important Behavior Notes
|
|
506
528
|
|
package/dist/index.d.mts
CHANGED
|
@@ -188,6 +188,11 @@ interface FeedbackSinkOptions {
|
|
|
188
188
|
* romper a quien lo pase.
|
|
189
189
|
*/
|
|
190
190
|
sendBeaconImpl?: (url: string, body: Blob | string) => boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Registro en el que seguir desde el primer lote: el de una sesión suspendida por un
|
|
193
|
+
* `pagehide` y reanudada tras recargar la página (ver `suspended-session.ts`).
|
|
194
|
+
*/
|
|
195
|
+
initialSessionId?: string;
|
|
191
196
|
/** Callback invocado cuando el backend devuelve un nuevo sessionId (primer POST). */
|
|
192
197
|
onSessionId?: (id: string) => void;
|
|
193
198
|
/** Callback invocado al cerrar la sesión (`completed:true`): el sessionId cacheado se olvida. */
|
|
@@ -378,6 +383,23 @@ type EventListener = (event: DeepdotsEvent) => void;
|
|
|
378
383
|
* anterior se cierra y se abre otra, como hace GA con su timeout de sesión.
|
|
379
384
|
*/
|
|
380
385
|
type SessionEndReason = 'page_hide' | 'background' | 'user_change' | 'tracking_disabled' | 'manual' | 'idle_timeout';
|
|
386
|
+
/**
|
|
387
|
+
* Motivo del `deepdots_session_start` (param `reason`): por qué EMPIEZA la sesión. Permite a
|
|
388
|
+
* analytics separar una carga/arranque real de una vuelta desde background ("Started here").
|
|
389
|
+
* Mismos valores que el SDK nativo donde el significado coincide:
|
|
390
|
+
* - `cold_start`: `init()` (carga de la página / arranque de la app RN) sin sesión suspendida
|
|
391
|
+
* que reanudar. Una recarga en menos de 1 min no emite `session_start` sino
|
|
392
|
+
* `deepdots_session_resume`.
|
|
393
|
+
* - `foreground`: `onForeground()` (RN, AppState 'active') tras un cierre (`onBackground()`
|
|
394
|
+
* o `endSession()`). Con la sesión abierta no emite nada.
|
|
395
|
+
* - `tracking_enabled`: `setTrackingEnabled(true)` (consentimiento concedido).
|
|
396
|
+
* - `user_change`: `setUserId()` o un `init()` con otro `userId`, tras cerrar la del anterior.
|
|
397
|
+
* - `idle_timeout`: la pestaña vuelve a verse tras más de 30 min oculta (web): la sesión
|
|
398
|
+
* anterior se cerró (o se descartó) y empieza otra.
|
|
399
|
+
* - `bfcache_restore`: la página vuelve de la bfcache (botón atrás, `pageshow` con
|
|
400
|
+
* `persisted`) fuera de la ventana de reanudación (web).
|
|
401
|
+
*/
|
|
402
|
+
type SessionStartReason = 'cold_start' | 'foreground' | 'tracking_enabled' | 'user_change' | 'idle_timeout' | 'bfcache_restore';
|
|
381
403
|
/** Trigger type used by remote popup definitions */
|
|
382
404
|
type PopupTriggerType = 'time_on_page' | 'scroll' | 'exit' | 'click' | 'event';
|
|
383
405
|
type PopupTriggerConditionStatus = 'SHOWED' | 'PARTIAL' | 'COMPLETED';
|
|
@@ -708,6 +730,14 @@ declare class DeepdotsPopups {
|
|
|
708
730
|
private popupContainer;
|
|
709
731
|
private popupDefinitions;
|
|
710
732
|
private popupsLoaded;
|
|
733
|
+
/**
|
|
734
|
+
* `true` mientras el `GET /sdk/{apiKey}/popups` de `init()` está en vuelo. En esa ventana los
|
|
735
|
+
* disparos del host (`triggerEvent`, `triggerSurvey`) no tienen contra qué evaluarse, así que
|
|
736
|
+
* se guardan en `pendingTriggers` y se reproducen al cargar. Click, scroll, time y exit no
|
|
737
|
+
* hacen falta: son listeners que `autoLaunch` instala ya con las definiciones cargadas.
|
|
738
|
+
*/
|
|
739
|
+
private awaitingPopups;
|
|
740
|
+
private pendingTriggers;
|
|
711
741
|
private pendingAutoLaunch;
|
|
712
742
|
private answeredSurveys;
|
|
713
743
|
private surveyProgress;
|
|
@@ -756,6 +786,13 @@ declare class DeepdotsPopups {
|
|
|
756
786
|
private lastEngagementAt;
|
|
757
787
|
/** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
|
|
758
788
|
private hiddenAt;
|
|
789
|
+
/**
|
|
790
|
+
* Sesión suspendida por un `pagehide` (ms epoch y `deepdots_user_id`); null si no hay.
|
|
791
|
+
* `openSession` la reanuda si sigue a tiempo (ver ANALYTICS_RESUME_WINDOW_MS).
|
|
792
|
+
*/
|
|
793
|
+
private suspended;
|
|
794
|
+
/** Integración de analytics del init: la sesión suspendida solo la hereda la misma. */
|
|
795
|
+
private analyticsIntegration;
|
|
759
796
|
/**
|
|
760
797
|
* Idioma resuelto en init() (explícito > navigator.language > Intl). Única fuente de
|
|
761
798
|
* verdad para el context de analytics Y para la segmentación por idioma de los popups.
|
|
@@ -868,8 +905,15 @@ declare class DeepdotsPopups {
|
|
|
868
905
|
*/
|
|
869
906
|
private closeSession;
|
|
870
907
|
/**
|
|
871
|
-
* Abre sesión (`session_start`) si no hay una abierta y el tracking está activo. Idempotente
|
|
872
|
-
*
|
|
908
|
+
* Abre sesión (`session_start`) si no hay una abierta y el tracking está activo. Idempotente.
|
|
909
|
+
* El `reason` dice por qué empieza (ver `SessionStartReason`):
|
|
910
|
+
* - `cold_start`: init() (carga de la página / arranque de la app RN).
|
|
911
|
+
* - `foreground`: onForeground() tras un cierre (RN).
|
|
912
|
+
* - `tracking_enabled`: setTrackingEnabled(true).
|
|
913
|
+
* - `user_change`: setUserId() o init() con otro userId.
|
|
914
|
+
* - `idle_timeout`: la pestaña vuelve a verse tras más de 30 min oculta.
|
|
915
|
+
* - `bfcache_restore`: vuelta desde la bfcache fuera de la ventana de reanudación.
|
|
916
|
+
* Si hay una sesión suspendida a tiempo emite `deepdots_session_resume` en su lugar, sin reason.
|
|
873
917
|
*/
|
|
874
918
|
private openSession;
|
|
875
919
|
/** Web: si la pestaña se ve. Sin `document` (RN) manda AppState vía onForeground/onBackground. */
|
|
@@ -898,6 +942,31 @@ declare class DeepdotsPopups {
|
|
|
898
942
|
* - Más: ya la cerró el backend → se descarta sin enviar nada.
|
|
899
943
|
*/
|
|
900
944
|
private onDocumentVisible;
|
|
945
|
+
/**
|
|
946
|
+
* `pagehide` en web: SUSPENDE la sesión en vez de cerrarla, porque el navegador lo lanza
|
|
947
|
+
* igual al recargar que al cerrar la pestaña. Vuelca lo pendiente (page_view de la
|
|
948
|
+
* pantalla, mini-services, engagement) con un `deepdots_session_suspend` y SIN
|
|
949
|
+
* `completed`, y deja el registro en `sessionStorage` (ver `suspended-session.ts`):
|
|
950
|
+
* - si la página vuelve a cargar en esta pestaña, `init()` sigue en el mismo registro;
|
|
951
|
+
* - si la pestaña se cerró, el backend lo cierra a los pocos minutos sin otro lote.
|
|
952
|
+
*
|
|
953
|
+
* Devuelve false cuando no se puede suspender — aún no se conoce el registro (el primer
|
|
954
|
+
* POST sigue en vuelo) o no hay `sessionStorage` — y entonces el caller cierra como antes.
|
|
955
|
+
*/
|
|
956
|
+
private suspendSession;
|
|
957
|
+
/**
|
|
958
|
+
* Recoge la sesión que dejó suspendida la carga anterior de esta pestaña (ver
|
|
959
|
+
* `suspendSession`). Solo con analytics configurado y el tracking activo: sin ellos no hay
|
|
960
|
+
* registro en el que seguir.
|
|
961
|
+
*/
|
|
962
|
+
private readResumableSession;
|
|
963
|
+
/**
|
|
964
|
+
* Consume la sesión suspendida al abrir: los ms que estuvo suspendida si se puede seguir en
|
|
965
|
+
* ella (mismo usuario, dentro de ANALYTICS_RESUME_WINDOW_MS); null si no había o ya no toca.
|
|
966
|
+
* En ese caso se olvida su registro sin enviar nada: lo cierra el backend, y la sesión que
|
|
967
|
+
* se abre ahora va a uno nuevo.
|
|
968
|
+
*/
|
|
969
|
+
private takeSuspendedSession;
|
|
901
970
|
/** Olvida la sesión abierta sin enviar nada (ver onDocumentVisible). */
|
|
902
971
|
private discardSession;
|
|
903
972
|
/**
|
|
@@ -923,6 +992,17 @@ declare class DeepdotsPopups {
|
|
|
923
992
|
triggerSurvey(surveyId: string, popupId?: string): void;
|
|
924
993
|
/** Trigger popups configured with trigger.type = 'event' and matching trigger.value */
|
|
925
994
|
triggerEvent(eventName: string): void;
|
|
995
|
+
private evaluateEvent;
|
|
996
|
+
/**
|
|
997
|
+
* Guarda `trigger` si las definiciones aún no han llegado. Devuelve `true` si lo guardó (el
|
|
998
|
+
* llamador no debe evaluarlo ahora) y `false` si no hay carga en vuelo (se evalúa ya, como
|
|
999
|
+
* siempre: tras cargar, tras un fallo o sin apiKey).
|
|
1000
|
+
*/
|
|
1001
|
+
private bufferIfAwaitingPopups;
|
|
1002
|
+
/** La carga falló: sin definiciones no hay nada que reproducir, se descarta todo. */
|
|
1003
|
+
private dropPendingTriggers;
|
|
1004
|
+
/** Reproduce en orden por la evaluación normal (segmentos, cooldowns y condiciones de AHORA). */
|
|
1005
|
+
private replayPendingTriggers;
|
|
926
1006
|
private showDefinition;
|
|
927
1007
|
private shouldShow;
|
|
928
1008
|
private matchesSegmentsLang;
|
|
@@ -961,7 +1041,7 @@ declare class DeepdotsPopups {
|
|
|
961
1041
|
private removeDeferredExitPopup;
|
|
962
1042
|
private getDeferredExitQueue;
|
|
963
1043
|
private setDeferredExitQueue;
|
|
964
|
-
/** Fetch al servidor para obtener popups */
|
|
1044
|
+
/** Fetch al servidor para obtener popups. `null` si la carga falló (red, no-2xx, payload inválido). */
|
|
965
1045
|
private fetchPopupsFromServer;
|
|
966
1046
|
/** Envía los atributos de contact a la API (`POST /sdk/popups/contact`). */
|
|
967
1047
|
private postContact;
|
|
@@ -1306,4 +1386,4 @@ declare function collectRnDevice(d: DeviceInfoLike): DeviceInfo;
|
|
|
1306
1386
|
*/
|
|
1307
1387
|
declare function setupReactNative(sdk: DeepdotsPopups, config: DeepdotsInitParams, deps?: ReactNativeSetupDeps): () => void;
|
|
1308
1388
|
|
|
1309
|
-
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 TrackMessageOptions, type TriggerConfig, buildAnalyticsFeedbackBody, buildMessageParams, buildSurveyHtml, collectRnDevice, crashRecordToParams, createDefaultRenderer, createFeedbackSink, directionFor, getLabels, isRtlLanguage, mmkvStorage, resolveActionLabels, resolveLocale, setupReactNative };
|
|
1389
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -188,6 +188,11 @@ interface FeedbackSinkOptions {
|
|
|
188
188
|
* romper a quien lo pase.
|
|
189
189
|
*/
|
|
190
190
|
sendBeaconImpl?: (url: string, body: Blob | string) => boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Registro en el que seguir desde el primer lote: el de una sesión suspendida por un
|
|
193
|
+
* `pagehide` y reanudada tras recargar la página (ver `suspended-session.ts`).
|
|
194
|
+
*/
|
|
195
|
+
initialSessionId?: string;
|
|
191
196
|
/** Callback invocado cuando el backend devuelve un nuevo sessionId (primer POST). */
|
|
192
197
|
onSessionId?: (id: string) => void;
|
|
193
198
|
/** Callback invocado al cerrar la sesión (`completed:true`): el sessionId cacheado se olvida. */
|
|
@@ -378,6 +383,23 @@ type EventListener = (event: DeepdotsEvent) => void;
|
|
|
378
383
|
* anterior se cierra y se abre otra, como hace GA con su timeout de sesión.
|
|
379
384
|
*/
|
|
380
385
|
type SessionEndReason = 'page_hide' | 'background' | 'user_change' | 'tracking_disabled' | 'manual' | 'idle_timeout';
|
|
386
|
+
/**
|
|
387
|
+
* Motivo del `deepdots_session_start` (param `reason`): por qué EMPIEZA la sesión. Permite a
|
|
388
|
+
* analytics separar una carga/arranque real de una vuelta desde background ("Started here").
|
|
389
|
+
* Mismos valores que el SDK nativo donde el significado coincide:
|
|
390
|
+
* - `cold_start`: `init()` (carga de la página / arranque de la app RN) sin sesión suspendida
|
|
391
|
+
* que reanudar. Una recarga en menos de 1 min no emite `session_start` sino
|
|
392
|
+
* `deepdots_session_resume`.
|
|
393
|
+
* - `foreground`: `onForeground()` (RN, AppState 'active') tras un cierre (`onBackground()`
|
|
394
|
+
* o `endSession()`). Con la sesión abierta no emite nada.
|
|
395
|
+
* - `tracking_enabled`: `setTrackingEnabled(true)` (consentimiento concedido).
|
|
396
|
+
* - `user_change`: `setUserId()` o un `init()` con otro `userId`, tras cerrar la del anterior.
|
|
397
|
+
* - `idle_timeout`: la pestaña vuelve a verse tras más de 30 min oculta (web): la sesión
|
|
398
|
+
* anterior se cerró (o se descartó) y empieza otra.
|
|
399
|
+
* - `bfcache_restore`: la página vuelve de la bfcache (botón atrás, `pageshow` con
|
|
400
|
+
* `persisted`) fuera de la ventana de reanudación (web).
|
|
401
|
+
*/
|
|
402
|
+
type SessionStartReason = 'cold_start' | 'foreground' | 'tracking_enabled' | 'user_change' | 'idle_timeout' | 'bfcache_restore';
|
|
381
403
|
/** Trigger type used by remote popup definitions */
|
|
382
404
|
type PopupTriggerType = 'time_on_page' | 'scroll' | 'exit' | 'click' | 'event';
|
|
383
405
|
type PopupTriggerConditionStatus = 'SHOWED' | 'PARTIAL' | 'COMPLETED';
|
|
@@ -708,6 +730,14 @@ declare class DeepdotsPopups {
|
|
|
708
730
|
private popupContainer;
|
|
709
731
|
private popupDefinitions;
|
|
710
732
|
private popupsLoaded;
|
|
733
|
+
/**
|
|
734
|
+
* `true` mientras el `GET /sdk/{apiKey}/popups` de `init()` está en vuelo. En esa ventana los
|
|
735
|
+
* disparos del host (`triggerEvent`, `triggerSurvey`) no tienen contra qué evaluarse, así que
|
|
736
|
+
* se guardan en `pendingTriggers` y se reproducen al cargar. Click, scroll, time y exit no
|
|
737
|
+
* hacen falta: son listeners que `autoLaunch` instala ya con las definiciones cargadas.
|
|
738
|
+
*/
|
|
739
|
+
private awaitingPopups;
|
|
740
|
+
private pendingTriggers;
|
|
711
741
|
private pendingAutoLaunch;
|
|
712
742
|
private answeredSurveys;
|
|
713
743
|
private surveyProgress;
|
|
@@ -756,6 +786,13 @@ declare class DeepdotsPopups {
|
|
|
756
786
|
private lastEngagementAt;
|
|
757
787
|
/** Cuándo se ocultó la pestaña por última vez (ms epoch); null si está visible. */
|
|
758
788
|
private hiddenAt;
|
|
789
|
+
/**
|
|
790
|
+
* Sesión suspendida por un `pagehide` (ms epoch y `deepdots_user_id`); null si no hay.
|
|
791
|
+
* `openSession` la reanuda si sigue a tiempo (ver ANALYTICS_RESUME_WINDOW_MS).
|
|
792
|
+
*/
|
|
793
|
+
private suspended;
|
|
794
|
+
/** Integración de analytics del init: la sesión suspendida solo la hereda la misma. */
|
|
795
|
+
private analyticsIntegration;
|
|
759
796
|
/**
|
|
760
797
|
* Idioma resuelto en init() (explícito > navigator.language > Intl). Única fuente de
|
|
761
798
|
* verdad para el context de analytics Y para la segmentación por idioma de los popups.
|
|
@@ -868,8 +905,15 @@ declare class DeepdotsPopups {
|
|
|
868
905
|
*/
|
|
869
906
|
private closeSession;
|
|
870
907
|
/**
|
|
871
|
-
* Abre sesión (`session_start`) si no hay una abierta y el tracking está activo. Idempotente
|
|
872
|
-
*
|
|
908
|
+
* Abre sesión (`session_start`) si no hay una abierta y el tracking está activo. Idempotente.
|
|
909
|
+
* El `reason` dice por qué empieza (ver `SessionStartReason`):
|
|
910
|
+
* - `cold_start`: init() (carga de la página / arranque de la app RN).
|
|
911
|
+
* - `foreground`: onForeground() tras un cierre (RN).
|
|
912
|
+
* - `tracking_enabled`: setTrackingEnabled(true).
|
|
913
|
+
* - `user_change`: setUserId() o init() con otro userId.
|
|
914
|
+
* - `idle_timeout`: la pestaña vuelve a verse tras más de 30 min oculta.
|
|
915
|
+
* - `bfcache_restore`: vuelta desde la bfcache fuera de la ventana de reanudación.
|
|
916
|
+
* Si hay una sesión suspendida a tiempo emite `deepdots_session_resume` en su lugar, sin reason.
|
|
873
917
|
*/
|
|
874
918
|
private openSession;
|
|
875
919
|
/** Web: si la pestaña se ve. Sin `document` (RN) manda AppState vía onForeground/onBackground. */
|
|
@@ -898,6 +942,31 @@ declare class DeepdotsPopups {
|
|
|
898
942
|
* - Más: ya la cerró el backend → se descarta sin enviar nada.
|
|
899
943
|
*/
|
|
900
944
|
private onDocumentVisible;
|
|
945
|
+
/**
|
|
946
|
+
* `pagehide` en web: SUSPENDE la sesión en vez de cerrarla, porque el navegador lo lanza
|
|
947
|
+
* igual al recargar que al cerrar la pestaña. Vuelca lo pendiente (page_view de la
|
|
948
|
+
* pantalla, mini-services, engagement) con un `deepdots_session_suspend` y SIN
|
|
949
|
+
* `completed`, y deja el registro en `sessionStorage` (ver `suspended-session.ts`):
|
|
950
|
+
* - si la página vuelve a cargar en esta pestaña, `init()` sigue en el mismo registro;
|
|
951
|
+
* - si la pestaña se cerró, el backend lo cierra a los pocos minutos sin otro lote.
|
|
952
|
+
*
|
|
953
|
+
* Devuelve false cuando no se puede suspender — aún no se conoce el registro (el primer
|
|
954
|
+
* POST sigue en vuelo) o no hay `sessionStorage` — y entonces el caller cierra como antes.
|
|
955
|
+
*/
|
|
956
|
+
private suspendSession;
|
|
957
|
+
/**
|
|
958
|
+
* Recoge la sesión que dejó suspendida la carga anterior de esta pestaña (ver
|
|
959
|
+
* `suspendSession`). Solo con analytics configurado y el tracking activo: sin ellos no hay
|
|
960
|
+
* registro en el que seguir.
|
|
961
|
+
*/
|
|
962
|
+
private readResumableSession;
|
|
963
|
+
/**
|
|
964
|
+
* Consume la sesión suspendida al abrir: los ms que estuvo suspendida si se puede seguir en
|
|
965
|
+
* ella (mismo usuario, dentro de ANALYTICS_RESUME_WINDOW_MS); null si no había o ya no toca.
|
|
966
|
+
* En ese caso se olvida su registro sin enviar nada: lo cierra el backend, y la sesión que
|
|
967
|
+
* se abre ahora va a uno nuevo.
|
|
968
|
+
*/
|
|
969
|
+
private takeSuspendedSession;
|
|
901
970
|
/** Olvida la sesión abierta sin enviar nada (ver onDocumentVisible). */
|
|
902
971
|
private discardSession;
|
|
903
972
|
/**
|
|
@@ -923,6 +992,17 @@ declare class DeepdotsPopups {
|
|
|
923
992
|
triggerSurvey(surveyId: string, popupId?: string): void;
|
|
924
993
|
/** Trigger popups configured with trigger.type = 'event' and matching trigger.value */
|
|
925
994
|
triggerEvent(eventName: string): void;
|
|
995
|
+
private evaluateEvent;
|
|
996
|
+
/**
|
|
997
|
+
* Guarda `trigger` si las definiciones aún no han llegado. Devuelve `true` si lo guardó (el
|
|
998
|
+
* llamador no debe evaluarlo ahora) y `false` si no hay carga en vuelo (se evalúa ya, como
|
|
999
|
+
* siempre: tras cargar, tras un fallo o sin apiKey).
|
|
1000
|
+
*/
|
|
1001
|
+
private bufferIfAwaitingPopups;
|
|
1002
|
+
/** La carga falló: sin definiciones no hay nada que reproducir, se descarta todo. */
|
|
1003
|
+
private dropPendingTriggers;
|
|
1004
|
+
/** Reproduce en orden por la evaluación normal (segmentos, cooldowns y condiciones de AHORA). */
|
|
1005
|
+
private replayPendingTriggers;
|
|
926
1006
|
private showDefinition;
|
|
927
1007
|
private shouldShow;
|
|
928
1008
|
private matchesSegmentsLang;
|
|
@@ -961,7 +1041,7 @@ declare class DeepdotsPopups {
|
|
|
961
1041
|
private removeDeferredExitPopup;
|
|
962
1042
|
private getDeferredExitQueue;
|
|
963
1043
|
private setDeferredExitQueue;
|
|
964
|
-
/** Fetch al servidor para obtener popups */
|
|
1044
|
+
/** Fetch al servidor para obtener popups. `null` si la carga falló (red, no-2xx, payload inválido). */
|
|
965
1045
|
private fetchPopupsFromServer;
|
|
966
1046
|
/** Envía los atributos de contact a la API (`POST /sdk/popups/contact`). */
|
|
967
1047
|
private postContact;
|
|
@@ -1306,4 +1386,4 @@ declare function collectRnDevice(d: DeviceInfoLike): DeviceInfo;
|
|
|
1306
1386
|
*/
|
|
1307
1387
|
declare function setupReactNative(sdk: DeepdotsPopups, config: DeepdotsInitParams, deps?: ReactNativeSetupDeps): () => void;
|
|
1308
1388
|
|
|
1309
|
-
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 TrackMessageOptions, type TriggerConfig, buildAnalyticsFeedbackBody, buildMessageParams, buildSurveyHtml, collectRnDevice, crashRecordToParams, createDefaultRenderer, createFeedbackSink, directionFor, getLabels, isRtlLanguage, mmkvStorage, resolveActionLabels, resolveLocale, setupReactNative };
|
|
1389
|
+
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 };
|