@magicfeedback/popup-sdk 1.1.4 → 1.1.6

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,13 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __toESM,
4
- buildSurveyIdentity
5
- } from "./chunk-6WTOQGET.mjs";
4
+ buildFontFaceCss,
5
+ buildFontFamilyValue,
6
+ buildSurveyIdentity,
7
+ sdkError,
8
+ sdkLog,
9
+ sdkWarn
10
+ } from "./chunk-XOTM5CHX.mjs";
6
11
 
7
12
  // node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
8
13
  var require_magicfeedback_sdk_browser = __commonJS({
@@ -2073,13 +2078,22 @@ var style_default = `.magicfeedback-container {
2073
2078
  padding: 0;
2074
2079
  font-weight: 900;
2075
2080
  color: #222;
2076
- font-family: 'Montserrat';
2081
+ font-family: var(--deepdots-font, 'Montserrat');
2077
2082
  font-size: 18px;
2078
2083
  text-transform: uppercase;
2079
2084
  text-align: center;
2080
2085
  margin-bottom: 40px;
2081
2086
  }
2082
2087
 
2088
+ /* Los controles de formulario no heredan font-family por defecto: cuando hay
2089
+ fuente custom (clase deepdots-has-font), los forzamos a usar la del contenedor. */
2090
+ .deepdots-popup.deepdots-has-font button,
2091
+ .deepdots-popup.deepdots-has-font input,
2092
+ .deepdots-popup.deepdots-has-font textarea,
2093
+ .deepdots-popup.deepdots-has-font select {
2094
+ font-family: var(--deepdots-font, inherit);
2095
+ }
2096
+
2083
2097
  .deepdots-popup h6 {
2084
2098
  margin-bottom: 1rem;
2085
2099
  }
@@ -2846,6 +2860,18 @@ function ensureResponsiveStyles(_popup) {
2846
2860
  `;
2847
2861
  document.head.appendChild(style);
2848
2862
  }
2863
+ function ensureFontFace(family, url) {
2864
+ const css = buildFontFaceCss(family, url);
2865
+ if (!css) return;
2866
+ const STYLE_ID = "deepdots-font-face";
2867
+ let el = document.getElementById(STYLE_ID);
2868
+ if (!el) {
2869
+ el = document.createElement("style");
2870
+ el.id = STYLE_ID;
2871
+ document.head.appendChild(el);
2872
+ }
2873
+ if (el.textContent !== css) el.textContent = css;
2874
+ }
2849
2875
  async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId) {
2850
2876
  let surveyCompletedEmitted = false;
2851
2877
  let stylesInjected = false;
@@ -2881,6 +2907,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
2881
2907
  width: 90%;
2882
2908
  min-height: 200px;
2883
2909
  `;
2910
+ const font = style?.font;
2911
+ if (font?.family) {
2912
+ const familyValue = buildFontFamilyValue(font.family);
2913
+ popup.style.fontFamily = familyValue;
2914
+ popup.style.setProperty("--deepdots-font", familyValue);
2915
+ popup.classList.add("deepdots-has-font");
2916
+ if (font.url) ensureFontFace(font.family, font.url);
2917
+ }
2884
2918
  const header = document.createElement("div");
2885
2919
  header.className = "deepdots-popup-header";
2886
2920
  header.style.cssText = "display:flex; justify-content:flex-end; align-items:center; width:100%;";
@@ -3147,7 +3181,7 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3147
3181
  let formInstance = null;
3148
3182
  try {
3149
3183
  if (!import_native.default || typeof import_native.default.form !== "function") {
3150
- console.warn("[MagicFeedback] form() no disponible. Fallback manual.");
3184
+ sdkWarn("[MagicFeedback] form() no disponible. Fallback manual.");
3151
3185
  setLoading(false);
3152
3186
  return;
3153
3187
  }
@@ -3234,7 +3268,7 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3234
3268
  }
3235
3269
  }
3236
3270
  if (s.startMessage && s.startMessage !== "") {
3237
- console.log(s.startMessage);
3271
+ sdkLog(s.startMessage);
3238
3272
  updateButtons("start");
3239
3273
  } else {
3240
3274
  updateButtons("in_progress_first");
@@ -3289,15 +3323,15 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3289
3323
  }
3290
3324
  };
3291
3325
  formInstance.generate(formDivId, generateOptions).catch((err) => {
3292
- console.error("[MagicFeedback] Error generating form:", err);
3326
+ sdkError("[MagicFeedback] Error generating form:", err);
3293
3327
  setLoading(false);
3294
3328
  });
3295
3329
  } catch (e) {
3296
- console.error("[MagicFeedback] Exception initializing form:", e);
3330
+ sdkError("[MagicFeedback] Exception initializing form:", e);
3297
3331
  setLoading(false);
3298
3332
  }
3299
3333
  }
3300
3334
  export {
3301
3335
  renderPopup
3302
3336
  };
3303
- //# sourceMappingURL=renderPopup-YLFRGPQN.mjs.map
3337
+ //# sourceMappingURL=renderPopup-EZKDMLVZ.mjs.map