@magicfeedback/popup-sdk 1.3.0 → 1.5.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/dist/index.d.ts CHANGED
@@ -256,6 +256,29 @@ interface DeepdotsInitParams {
256
256
  * `setContactAttributes` after init (sends only when values changed from the last sync).
257
257
  */
258
258
  contactAttributes?: Record<string, string | number | boolean>;
259
+ /**
260
+ * Whether the SDK renders the popup "modal" (card + backdrop + positioning) around the survey.
261
+ * Default `true`. Only affects React Native (the survey WebView HTML); the web DOM popup is
262
+ * unaffected. With `false` the survey is delivered transparent and edge-to-edge so the host
263
+ * mounts its own Modal/container and controls the styling — avoids the "double modal" when the
264
+ * host already wraps the WebView. The survey stays fully functional (bridge, form, nav buttons,
265
+ * close). Ver `ReactNativePopupRenderer`.
266
+ */
267
+ renderChrome?: boolean;
268
+ /**
269
+ * Barra de progreso ("Question X of Y" + barra) en la cabecera del popup. Si se omite,
270
+ * manda el `showProgressBar` que la plataforma configura en el estilo del survey; `true` o
271
+ * `false` lo fuerzan desde el host. Solo se pinta con más de una página, fuera de la
272
+ * pantalla de inicio y antes de completar, igual que en la web de surveys.
273
+ */
274
+ showProgressBar?: boolean;
275
+ /**
276
+ * CSS propio del host, inyectado como último bloque de estilos del popup: gana en cascada
277
+ * sobre el del SDK y sobre el de `@magicfeedback/native` sin tener que tocar ninguno. Es la
278
+ * vía para reestilar el área de preguntas (enunciados, opciones, escalas) por integración,
279
+ * en vez de cambiar los defaults que comparten todos los clientes.
280
+ */
281
+ surveyCss?: string;
259
282
  }
260
283
  interface DeepdotsConfig {
261
284
  /** API key for authentication */
@@ -384,11 +407,26 @@ interface PopupDefinition {
384
407
  segments?: PopupSegments;
385
408
  }
386
409
 
410
+ /**
411
+ * Ajustes de presentación que no vienen del estilo del popup. Van agrupados para no seguir
412
+ * alargando la lista posicional de `show`, que ya arrastra doce parámetros.
413
+ */
414
+ interface PopupRenderOptions {
415
+ /**
416
+ * Título de la cabecera: el `title` de la definición del popup, tal cual llega de la API.
417
+ * Varía por popup y vacío es un valor válido (la cabecera se queda solo con la X).
418
+ */
419
+ title?: string;
420
+ /** Barra de progreso: `undefined` deja decidir a la plataforma, `true`/`false` la fuerzan. */
421
+ showProgressBar?: boolean;
422
+ /** CSS del host, inyectado el último: gana sobre el del SDK y el de `@magicfeedback/native`. */
423
+ surveyCss?: string;
424
+ }
387
425
  interface PopupRenderer {
388
426
  /** Preparar recursos si aplica */
389
427
  init?(): void;
390
428
  /** Mostrar popup */
391
- show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: (type: DeepdotsEventType, surveyId: string, data?: Record<string, unknown>) => void, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string): void;
429
+ show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: (type: DeepdotsEventType, surveyId: string, data?: Record<string, unknown>) => void, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string, renderChrome?: boolean, options?: PopupRenderOptions): void;
392
430
  /** Ocultar popup */
393
431
  hide(): void;
394
432
  }
@@ -402,7 +440,8 @@ declare class BrowserPopupRenderer implements PopupRenderer {
402
440
  private container;
403
441
  private visible;
404
442
  init(): void;
405
- show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: (type: DeepdotsEventType, surveyId: string, data?: Record<string, unknown>) => void, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string): void;
443
+ show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: (type: DeepdotsEventType, surveyId: string, data?: Record<string, unknown>) => void, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string, _renderChrome?: boolean, // solo aplica a RN (WebView); el popup DOM web siempre lleva su chrome
444
+ options?: PopupRenderOptions): void;
406
445
  hide(): void;
407
446
  }
408
447
  /** Factoría para obtener renderer por defecto */
@@ -602,6 +641,12 @@ declare class DeepdotsPopups {
602
641
  private deferredExitTimers;
603
642
  private baseUrl;
604
643
  private env;
644
+ /** Si el SDK pinta el "modal" del popup (RN). Default true; false = el host lo envuelve. */
645
+ private renderChrome;
646
+ /** Barra de progreso. undefined = la decide la plataforma (style.showProgressBar). */
647
+ private showProgressBar;
648
+ /** CSS del host inyectado al final de los estilos del popup. */
649
+ private surveyCss;
605
650
  /** Identidad + sesión (Fase 1 tracking). Null hasta init(). */
606
651
  private tracking;
607
652
  /** Capa de analytics (canal separado del feedback). Null hasta init(). */
@@ -673,6 +718,15 @@ declare class DeepdotsPopups {
673
718
  trackFindabilityFriction(frictionTopic: string, params?: Record<string, unknown>): void;
674
719
  /** Funnel: un paso del embudo, correlacionado por `taskId`. El backend reconstruye conversión/drop-off/tiempo. */
675
720
  trackFunnelStep(funnel: string, step: string, taskId: string, params?: Record<string, unknown>): void;
721
+ /**
722
+ * Product Effectiveness: una interacción significativa del usuario (`interaction_type` es la
723
+ * dimensión de agrupación, p. ej. `get_help`, `homepage`, `contact_support`).
724
+ *
725
+ * Existe como evento RESERVADO para que la convención no la invente cada host: un `track()`
726
+ * custom acaba como `deepdots_event_…` y no lo cuenta la analítica de effectiveness.
727
+ * Un `interactionType` vacío se descarta con warning (no aporta dato agrupable).
728
+ */
729
+ trackMeaningfulInteraction(interactionType: string, params?: Record<string, unknown>): void;
676
730
  /**
677
731
  * Messaging (#18–22): registra una etapa del funnel de una notificación (push/in-app).
678
732
  * No-op si tracking off. El evento se descarta (con warning) si el `channel` no es válido,
@@ -847,7 +901,7 @@ declare class ReactNativePopupRenderer implements PopupRenderer {
847
901
  private partialEmitted;
848
902
  constructor(options?: ReactNativeRendererOptions);
849
903
  init(): void;
850
- show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: EmitFn, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string): void;
904
+ show(surveyId: string, productId: string, actions: PopupActions | undefined, emit: EmitFn, onClose: () => void, env?: string, userId?: string, style?: PopupStyle, sessionId?: string, miniService?: string, analyticsFeedbackSessionId?: string, renderChrome?: boolean, options?: PopupRenderOptions): void;
851
905
  hide(): void;
852
906
  /**
853
907
  * El host la conecta al `onMessage` del WebView. Traduce los mensajes del survey a
@@ -880,6 +934,31 @@ interface BuildSurveyHtmlOptions {
880
934
  theme?: 'light' | 'dark';
881
935
  position?: 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
882
936
  actions?: PopupActions;
937
+ /**
938
+ * Renderiza el "modal" del popup (tarjeta con fondo/sombra/bordes + overlay + posicionamiento).
939
+ * Default `true`. Con `false` el HTML es transparente y llena el contenedor: el host monta su
940
+ * propio Modal/tarjeta y controla el estilo. El survey sigue siendo funcional (bridge, form,
941
+ * botones y botón de cerrar). Pensado para React Native cuando el host gestiona el contenedor.
942
+ */
943
+ chrome?: boolean;
944
+ /**
945
+ * Título de la cabecera, a la izquierda del botón de cerrar. Es el `title` de la definición
946
+ * del popup (`GET /sdk/{publicKey}/popups`), así que cambia de un popup a otro. Vacío es un
947
+ * valor legítimo: la cabecera se queda solo con la X. NO cae al título del survey.
948
+ */
949
+ title?: string;
950
+ /**
951
+ * Barra de progreso ("Question X of Y" + barra) bajo la cabecera. `undefined` respeta el
952
+ * `showProgressBar` que configure la plataforma en el estilo del survey; `true`/`false` lo
953
+ * fuerzan desde el host. Solo se pinta con más de una página y fuera de la pantalla de inicio.
954
+ */
955
+ showProgressBar?: boolean;
956
+ /**
957
+ * CSS del host, inyectado como último bloque de estilos: gana en cascada sobre el del SDK
958
+ * y sobre el de `@magicfeedback/native` sin tener que tocar ninguno de los dos. Es la vía
959
+ * para reestilar el área de preguntas (enunciados, opciones, escalas) por integración.
960
+ */
961
+ surveyCss?: string;
883
962
  }
884
963
  declare function buildSurveyHtml(opts: BuildSurveyHtmlOptions): string;
885
964