@magicfeedback/popup-sdk 1.13.0 → 1.15.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.
@@ -18,7 +18,7 @@ import {
18
18
  sdkWarn,
19
19
  setLogger,
20
20
  style_default
21
- } from "./chunk-TSORXOQG.mjs";
21
+ } from "./chunk-GUJSOVS6.mjs";
22
22
 
23
23
  // src/react-native/index.tsx
24
24
  import { createContext, useContext, useEffect, useRef, useState } from "react";
@@ -256,7 +256,7 @@ function trimmedOrNull(value) {
256
256
  }
257
257
  function buildSurveyHtml(opts) {
258
258
  const env = opts.env === "development" ? "dev" : "prod";
259
- const version = opts.version ?? "2.2.31";
259
+ const version = opts.version ?? "2.2.33";
260
260
  const cdn = `https://cdn.jsdelivr.net/npm/@magicfeedback/native@${version}/dist/magicfeedback-sdk.browser.js`;
261
261
  const sid = jsonForScript(opts.surveyId);
262
262
  const pid = jsonForScript(opts.productId);
@@ -895,7 +895,7 @@ function createReactNativeRenderer() {
895
895
  }
896
896
 
897
897
  // src/ui/preload.ts
898
- var defaultLoader = () => import("./renderPopup-JF6IB6HL.mjs");
898
+ var defaultLoader = () => import("./renderPopup-RWSU5Y2H.mjs");
899
899
  var pending = null;
900
900
  function preloadRenderPopup(loader = defaultLoader) {
901
901
  if (pending) return pending;
@@ -968,7 +968,7 @@ var BrowserPopupRenderer = class {
968
968
  if (!this.container) return;
969
969
  this.visible = true;
970
970
  const container = this.container;
971
- void import("./renderPopup-JF6IB6HL.mjs").then(({ renderPopup }) => {
971
+ void import("./renderPopup-RWSU5Y2H.mjs").then(({ renderPopup }) => {
972
972
  renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
973
973
  });
974
974
  }
@@ -2004,8 +2004,6 @@ var DeepdotsPopups = class {
2004
2004
  this.renderer = createDefaultRenderer();
2005
2005
  /** Logger para el output de debug. Default `console`; el host puede inyectar el suyo en init(). */
2006
2006
  this.logger = console;
2007
- this.popupContainer = null;
2008
- // deprecated: mantenido para compatibilidad interna
2009
2007
  this.popupDefinitions = [];
2010
2008
  this.popupsLoaded = false;
2011
2009
  /**
@@ -2036,6 +2034,7 @@ var DeepdotsPopups = class {
2036
2034
  this.showProgressBar = void 0;
2037
2035
  /** CSS del host inyectado al final de los estilos del popup. */
2038
2036
  this.surveyCss = void 0;
2037
+ this.cspNonce = void 0;
2039
2038
  /** Identidad + sesión (Fase 1 tracking). Null hasta init(). */
2040
2039
  this.tracking = null;
2041
2040
  /** Capa de analytics (canal separado del feedback). Null hasta init(). */
@@ -2108,6 +2107,7 @@ var DeepdotsPopups = class {
2108
2107
  this.renderChrome = config.renderChrome ?? true;
2109
2108
  this.showProgressBar = config.showProgressBar;
2110
2109
  this.surveyCss = config.surveyCss;
2110
+ this.cspNonce = config.cspNonce;
2111
2111
  this.onFeedbackSession = config.onFeedbackSession;
2112
2112
  this.config = {
2113
2113
  apiKey: config.apiKey || void 0,
@@ -2208,7 +2208,6 @@ var DeepdotsPopups = class {
2208
2208
  this.initialized = true;
2209
2209
  this.log("SDK initialized", this.config);
2210
2210
  if (this.renderer.init) this.renderer.init();
2211
- this.setupPopupContainer();
2212
2211
  this.awaitingPopups = Boolean(this.config.apiKey && this.baseUrl);
2213
2212
  this.fetchPopupsFromServer().then((defs) => {
2214
2213
  if (!defs) this.dropPendingTriggers();
@@ -3179,27 +3178,6 @@ var DeepdotsPopups = class {
3179
3178
  listeners.delete(listener);
3180
3179
  }
3181
3180
  }
3182
- /** Setup popup container element */
3183
- setupPopupContainer() {
3184
- if (typeof document === "undefined") {
3185
- return;
3186
- }
3187
- this.popupContainer = document.createElement("div");
3188
- this.popupContainer.id = "deepdots-popup-container";
3189
- this.popupContainer.style.cssText = `
3190
- position: fixed;
3191
- top: 0;
3192
- left: 0;
3193
- width: 100%;
3194
- height: 100%;
3195
- display: none;
3196
- z-index: 999999;
3197
- background: rgba(0, 0, 0, 0.5);
3198
- justify-content: center;
3199
- align-items: center;
3200
- `;
3201
- document.body.appendChild(this.popupContainer);
3202
- }
3203
3181
  /** Render the popup UI */
3204
3182
  renderPopup(surveyId, productId, actions, style, title) {
3205
3183
  const userId = this.tracking?.getUserId() ?? this.config?.userId;
@@ -3207,54 +3185,25 @@ var DeepdotsPopups = class {
3207
3185
  const miniService = this.analytics?.getMiniService() ?? void 0;
3208
3186
  const analyticsFeedbackSessionId = this.analyticsFeedbackSessionId;
3209
3187
  this.log("tracking \xB7 survey identity \u2192", { userId: userId ?? null, sessionId: sessionId ?? null, miniService: miniService ?? null, analyticsFeedbackSessionId: analyticsFeedbackSessionId ?? null });
3210
- if (this.renderer) {
3211
- this.renderer.show(
3212
- surveyId,
3213
- productId,
3214
- actions,
3215
- (type, id, payload) => this.emitEvent(type, id, payload),
3216
- () => this.hidePopup(),
3217
- this.env,
3218
- userId,
3219
- style,
3220
- sessionId,
3221
- miniService,
3222
- analyticsFeedbackSessionId,
3223
- this.renderChrome,
3224
- { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language }
3225
- );
3226
- return;
3227
- }
3228
- if (!this.popupContainer) return;
3229
- const container = this.popupContainer;
3230
- void import("./renderPopup-JF6IB6HL.mjs").then(({ renderPopup }) => {
3231
- renderPopup(
3232
- container,
3233
- surveyId,
3234
- productId,
3235
- actions,
3236
- (type, id, payload) => this.emitEvent(type, id, payload),
3237
- () => this.hidePopup(),
3238
- this.env,
3239
- userId,
3240
- style,
3241
- sessionId,
3242
- miniService,
3243
- analyticsFeedbackSessionId,
3244
- { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language }
3245
- );
3246
- });
3188
+ this.renderer.show(
3189
+ surveyId,
3190
+ productId,
3191
+ actions,
3192
+ (type, id, payload) => this.emitEvent(type, id, payload),
3193
+ () => this.hidePopup(),
3194
+ this.env,
3195
+ userId,
3196
+ style,
3197
+ sessionId,
3198
+ miniService,
3199
+ analyticsFeedbackSessionId,
3200
+ this.renderChrome,
3201
+ { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language, cspNonce: this.cspNonce }
3202
+ );
3247
3203
  }
3248
3204
  /** Hide the popup */
3249
3205
  hidePopup() {
3250
- if (this.renderer) {
3251
- this.renderer.hide();
3252
- return;
3253
- }
3254
- if (this.popupContainer) {
3255
- this.popupContainer.style.display = "none";
3256
- this.popupContainer.innerHTML = "";
3257
- }
3206
+ this.renderer.hide();
3258
3207
  }
3259
3208
  /** Emit an event */
3260
3209
  emitEvent(type, surveyId, data) {