@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.
@@ -342,6 +342,12 @@ interface PopupRenderer {
342
342
  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;
343
343
  /** Ocultar popup */
344
344
  hide(): void;
345
+ /**
346
+ * ¿Hay un popup a la vista ahora mismo? Opcional. Con él, el core no da por mostrado un popup
347
+ * que el renderer no va a pintar (porque ya hay otro abierto): ni `popup_shown`, ni SHOWED, ni
348
+ * cooldown gastado. Sin él (renderers del host, RN), el core se comporta como siempre.
349
+ */
350
+ isShowing?(): boolean;
345
351
  }
346
352
 
347
353
  /** Valor de un atributo de contact (info interna del usuario que solo conoce el host). */
@@ -342,6 +342,12 @@ interface PopupRenderer {
342
342
  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;
343
343
  /** Ocultar popup */
344
344
  hide(): void;
345
+ /**
346
+ * ¿Hay un popup a la vista ahora mismo? Opcional. Con él, el core no da por mostrado un popup
347
+ * que el renderer no va a pintar (porque ya hay otro abierto): ni `popup_shown`, ni SHOWED, ni
348
+ * cooldown gastado. Sin él (renderers del host, RN), el core se comporta como siempre.
349
+ */
350
+ isShowing?(): boolean;
345
351
  }
346
352
 
347
353
  /** Valor de un atributo de contact (info interna del usuario que solo conoce el host). */
@@ -2930,12 +2930,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
2930
2930
  "top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
2931
2931
  };
2932
2932
  const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
2933
+ const passThrough = pos.background === "transparent";
2933
2934
  const popup = document.createElement("div");
2934
2935
  popup.id = "dd-popup";
2935
2936
  popup.className = "deepdots-popup";
2936
2937
  popup.setAttribute("dir", direction);
2937
2938
  popup.style.cssText = `
2938
2939
  position: relative;
2940
+ pointer-events: auto;
2939
2941
  display: flex;
2940
2942
  flex-direction: column;
2941
2943
  justify-content: flex-start;
@@ -3381,7 +3383,7 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3381
3383
  }
3382
3384
  if (!container.contains(popup)) return;
3383
3385
  container.style.visibility = "visible";
3384
- container.style.pointerEvents = "";
3386
+ container.style.pointerEvents = passThrough ? "none" : "";
3385
3387
  autofocusOnOpen();
3386
3388
  }
3387
3389
  function revealWhenPainted2() {
@@ -4528,6 +4530,7 @@ function schedulePreloadRenderPopup(loader) {
4528
4530
  }
4529
4531
 
4530
4532
  // src/platform/renderer.ts
4533
+ init_logger();
4531
4534
  var NoopPopupRenderer = class {
4532
4535
  show() {
4533
4536
  }
@@ -4574,9 +4577,18 @@ var BrowserPopupRenderer = class {
4574
4577
  if (!this.container) return;
4575
4578
  this.visible = true;
4576
4579
  const container = this.container;
4577
- void Promise.resolve().then(() => (init_renderPopup(), renderPopup_exports)).then(({ renderPopup: renderPopup2 }) => {
4578
- renderPopup2(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
4579
- });
4580
+ void Promise.resolve().then(() => (init_renderPopup(), renderPopup_exports)).then(
4581
+ ({ renderPopup: renderPopup2 }) => {
4582
+ renderPopup2(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
4583
+ },
4584
+ (error) => {
4585
+ this.visible = false;
4586
+ sdkWarn("[Deepdots] popup renderer failed to load:", error);
4587
+ }
4588
+ );
4589
+ }
4590
+ isShowing() {
4591
+ return this.visible;
4580
4592
  }
4581
4593
  hide() {
4582
4594
  this.visible = false;
@@ -6526,6 +6538,10 @@ var DeepdotsPopups = class {
6526
6538
  });
6527
6539
  }
6528
6540
  showDefinition(def) {
6541
+ if (this.renderer.isShowing?.()) {
6542
+ this.debug("Popup skipped: another popup is already open", def.id);
6543
+ return;
6544
+ }
6529
6545
  this.log("Showing popup (definition)", def);
6530
6546
  this.surveyToPopupId.set(def.surveyId, def.id);
6531
6547
  this.lastShown.set(def.id, Date.now());