@magicfeedback/popup-sdk 1.1.3 → 1.1.5

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.
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __toESM,
4
+ buildFontFaceCss,
5
+ buildFontFamilyValue,
4
6
  buildSurveyIdentity
5
- } from "./chunk-6WTOQGET.mjs";
7
+ } from "./chunk-7TOLYAFL.mjs";
6
8
 
7
9
  // node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
8
10
  var require_magicfeedback_sdk_browser = __commonJS({
@@ -2073,13 +2075,22 @@ var style_default = `.magicfeedback-container {
2073
2075
  padding: 0;
2074
2076
  font-weight: 900;
2075
2077
  color: #222;
2076
- font-family: 'Montserrat';
2078
+ font-family: var(--deepdots-font, 'Montserrat');
2077
2079
  font-size: 18px;
2078
2080
  text-transform: uppercase;
2079
2081
  text-align: center;
2080
2082
  margin-bottom: 40px;
2081
2083
  }
2082
2084
 
2085
+ /* Los controles de formulario no heredan font-family por defecto: cuando hay
2086
+ fuente custom (clase deepdots-has-font), los forzamos a usar la del contenedor. */
2087
+ .deepdots-popup.deepdots-has-font button,
2088
+ .deepdots-popup.deepdots-has-font input,
2089
+ .deepdots-popup.deepdots-has-font textarea,
2090
+ .deepdots-popup.deepdots-has-font select {
2091
+ font-family: var(--deepdots-font, inherit);
2092
+ }
2093
+
2083
2094
  .deepdots-popup h6 {
2084
2095
  margin-bottom: 1rem;
2085
2096
  }
@@ -2846,6 +2857,18 @@ function ensureResponsiveStyles(_popup) {
2846
2857
  `;
2847
2858
  document.head.appendChild(style);
2848
2859
  }
2860
+ function ensureFontFace(family, url) {
2861
+ const css = buildFontFaceCss(family, url);
2862
+ if (!css) return;
2863
+ const STYLE_ID = "deepdots-font-face";
2864
+ let el = document.getElementById(STYLE_ID);
2865
+ if (!el) {
2866
+ el = document.createElement("style");
2867
+ el.id = STYLE_ID;
2868
+ document.head.appendChild(el);
2869
+ }
2870
+ if (el.textContent !== css) el.textContent = css;
2871
+ }
2849
2872
  async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId) {
2850
2873
  let surveyCompletedEmitted = false;
2851
2874
  let stylesInjected = false;
@@ -2881,6 +2904,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
2881
2904
  width: 90%;
2882
2905
  min-height: 200px;
2883
2906
  `;
2907
+ const font = style?.font;
2908
+ if (font?.family) {
2909
+ const familyValue = buildFontFamilyValue(font.family);
2910
+ popup.style.fontFamily = familyValue;
2911
+ popup.style.setProperty("--deepdots-font", familyValue);
2912
+ popup.classList.add("deepdots-has-font");
2913
+ if (font.url) ensureFontFace(font.family, font.url);
2914
+ }
2884
2915
  const header = document.createElement("div");
2885
2916
  header.className = "deepdots-popup-header";
2886
2917
  header.style.cssText = "display:flex; justify-content:flex-end; align-items:center; width:100%;";
@@ -3300,4 +3331,4 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3300
3331
  export {
3301
3332
  renderPopup
3302
3333
  };
3303
- //# sourceMappingURL=renderPopup-YLFRGPQN.mjs.map
3334
+ //# sourceMappingURL=renderPopup-MES7IINW.mjs.map