@magicfeedback/popup-sdk 1.17.1 → 1.17.2

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.mts CHANGED
@@ -553,6 +553,12 @@ interface PopupRenderer {
553
553
  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;
554
554
  /** Ocultar popup */
555
555
  hide(): void;
556
+ /**
557
+ * ¿Hay un popup a la vista ahora mismo? Opcional. Con él, el core no da por mostrado un popup
558
+ * que el renderer no va a pintar (porque ya hay otro abierto): ni `popup_shown`, ni SHOWED, ni
559
+ * cooldown gastado. Sin él (renderers del host, RN), el core se comporta como siempre.
560
+ */
561
+ isShowing?(): boolean;
556
562
  }
557
563
  /** Renderer que no hace nada (SSR / entornos sin DOM) */
558
564
  declare class NoopPopupRenderer implements PopupRenderer {
@@ -571,6 +577,7 @@ declare class BrowserPopupRenderer implements PopupRenderer {
571
577
  preload(): void;
572
578
  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
573
579
  options?: PopupRenderOptions): void;
580
+ isShowing(): boolean;
574
581
  hide(): void;
575
582
  }
576
583
  /** Factoría para obtener renderer por defecto */
package/dist/index.d.ts CHANGED
@@ -553,6 +553,12 @@ interface PopupRenderer {
553
553
  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;
554
554
  /** Ocultar popup */
555
555
  hide(): void;
556
+ /**
557
+ * ¿Hay un popup a la vista ahora mismo? Opcional. Con él, el core no da por mostrado un popup
558
+ * que el renderer no va a pintar (porque ya hay otro abierto): ni `popup_shown`, ni SHOWED, ni
559
+ * cooldown gastado. Sin él (renderers del host, RN), el core se comporta como siempre.
560
+ */
561
+ isShowing?(): boolean;
556
562
  }
557
563
  /** Renderer que no hace nada (SSR / entornos sin DOM) */
558
564
  declare class NoopPopupRenderer implements PopupRenderer {
@@ -571,6 +577,7 @@ declare class BrowserPopupRenderer implements PopupRenderer {
571
577
  preload(): void;
572
578
  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
573
579
  options?: PopupRenderOptions): void;
580
+ isShowing(): boolean;
574
581
  hide(): void;
575
582
  }
576
583
  /** Factoría para obtener renderer por defecto */
package/dist/index.js CHANGED
@@ -5762,12 +5762,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
5762
5762
  "top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
5763
5763
  };
5764
5764
  const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
5765
+ const passThrough = pos.background === "transparent";
5765
5766
  const popup = document.createElement("div");
5766
5767
  popup.id = "dd-popup";
5767
5768
  popup.className = "deepdots-popup";
5768
5769
  popup.setAttribute("dir", direction);
5769
5770
  popup.style.cssText = `
5770
5771
  position: relative;
5772
+ pointer-events: auto;
5771
5773
  display: flex;
5772
5774
  flex-direction: column;
5773
5775
  justify-content: flex-start;
@@ -6213,7 +6215,7 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
6213
6215
  }
6214
6216
  if (!container.contains(popup)) return;
6215
6217
  container.style.visibility = "visible";
6216
- container.style.pointerEvents = "";
6218
+ container.style.pointerEvents = passThrough ? "none" : "";
6217
6219
  autofocusOnOpen();
6218
6220
  }
6219
6221
  function revealWhenPainted2() {
@@ -7383,6 +7385,7 @@ function schedulePreloadRenderPopup(loader) {
7383
7385
  }
7384
7386
 
7385
7387
  // src/platform/renderer.ts
7388
+ init_logger();
7386
7389
  var NoopPopupRenderer = class {
7387
7390
  show() {
7388
7391
  }
@@ -7429,9 +7432,18 @@ var BrowserPopupRenderer = class {
7429
7432
  if (!this.container) return;
7430
7433
  this.visible = true;
7431
7434
  const container = this.container;
7432
- void Promise.resolve().then(() => (init_renderPopup(), renderPopup_exports)).then(({ renderPopup: renderPopup2 }) => {
7433
- renderPopup2(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
7434
- });
7435
+ void Promise.resolve().then(() => (init_renderPopup(), renderPopup_exports)).then(
7436
+ ({ renderPopup: renderPopup2 }) => {
7437
+ renderPopup2(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
7438
+ },
7439
+ (error) => {
7440
+ this.visible = false;
7441
+ sdkWarn("[Deepdots] popup renderer failed to load:", error);
7442
+ }
7443
+ );
7444
+ }
7445
+ isShowing() {
7446
+ return this.visible;
7435
7447
  }
7436
7448
  hide() {
7437
7449
  this.visible = false;
@@ -9381,6 +9393,10 @@ var DeepdotsPopups = class {
9381
9393
  });
9382
9394
  }
9383
9395
  showDefinition(def) {
9396
+ if (this.renderer.isShowing?.()) {
9397
+ this.debug("Popup skipped: another popup is already open", def.id);
9398
+ return;
9399
+ }
9384
9400
  this.log("Showing popup (definition)", def);
9385
9401
  this.surveyToPopupId.set(def.surveyId, def.id);
9386
9402
  this.lastShown.set(def.id, Date.now());