@magicfeedback/popup-sdk 1.14.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.
package/dist/index.mjs CHANGED
@@ -893,7 +893,7 @@ function createReactNativeRenderer() {
893
893
  }
894
894
 
895
895
  // src/ui/preload.ts
896
- var defaultLoader = () => import("./renderPopup-Z6TENBP6.mjs");
896
+ var defaultLoader = () => import("./renderPopup-CHWH3KHR.mjs");
897
897
  var pending = null;
898
898
  function preloadRenderPopup(loader = defaultLoader) {
899
899
  if (pending) return pending;
@@ -966,7 +966,7 @@ var BrowserPopupRenderer = class {
966
966
  if (!this.container) return;
967
967
  this.visible = true;
968
968
  const container = this.container;
969
- void import("./renderPopup-Z6TENBP6.mjs").then(({ renderPopup }) => {
969
+ void import("./renderPopup-CHWH3KHR.mjs").then(({ renderPopup }) => {
970
970
  renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
971
971
  });
972
972
  }
@@ -2002,8 +2002,6 @@ var DeepdotsPopups = class {
2002
2002
  this.renderer = createDefaultRenderer();
2003
2003
  /** Logger para el output de debug. Default `console`; el host puede inyectar el suyo en init(). */
2004
2004
  this.logger = console;
2005
- this.popupContainer = null;
2006
- // deprecated: mantenido para compatibilidad interna
2007
2005
  this.popupDefinitions = [];
2008
2006
  this.popupsLoaded = false;
2009
2007
  /**
@@ -2034,6 +2032,7 @@ var DeepdotsPopups = class {
2034
2032
  this.showProgressBar = void 0;
2035
2033
  /** CSS del host inyectado al final de los estilos del popup. */
2036
2034
  this.surveyCss = void 0;
2035
+ this.cspNonce = void 0;
2037
2036
  /** Identidad + sesión (Fase 1 tracking). Null hasta init(). */
2038
2037
  this.tracking = null;
2039
2038
  /** Capa de analytics (canal separado del feedback). Null hasta init(). */
@@ -2106,6 +2105,7 @@ var DeepdotsPopups = class {
2106
2105
  this.renderChrome = config.renderChrome ?? true;
2107
2106
  this.showProgressBar = config.showProgressBar;
2108
2107
  this.surveyCss = config.surveyCss;
2108
+ this.cspNonce = config.cspNonce;
2109
2109
  this.onFeedbackSession = config.onFeedbackSession;
2110
2110
  this.config = {
2111
2111
  apiKey: config.apiKey || void 0,
@@ -2206,7 +2206,6 @@ var DeepdotsPopups = class {
2206
2206
  this.initialized = true;
2207
2207
  this.log("SDK initialized", this.config);
2208
2208
  if (this.renderer.init) this.renderer.init();
2209
- this.setupPopupContainer();
2210
2209
  this.awaitingPopups = Boolean(this.config.apiKey && this.baseUrl);
2211
2210
  this.fetchPopupsFromServer().then((defs) => {
2212
2211
  if (!defs) this.dropPendingTriggers();
@@ -3177,27 +3176,6 @@ var DeepdotsPopups = class {
3177
3176
  listeners.delete(listener);
3178
3177
  }
3179
3178
  }
3180
- /** Setup popup container element */
3181
- setupPopupContainer() {
3182
- if (typeof document === "undefined") {
3183
- return;
3184
- }
3185
- this.popupContainer = document.createElement("div");
3186
- this.popupContainer.id = "deepdots-popup-container";
3187
- this.popupContainer.style.cssText = `
3188
- position: fixed;
3189
- top: 0;
3190
- left: 0;
3191
- width: 100%;
3192
- height: 100%;
3193
- display: none;
3194
- z-index: 999999;
3195
- background: rgba(0, 0, 0, 0.5);
3196
- justify-content: center;
3197
- align-items: center;
3198
- `;
3199
- document.body.appendChild(this.popupContainer);
3200
- }
3201
3179
  /** Render the popup UI */
3202
3180
  renderPopup(surveyId, productId, actions, style, title) {
3203
3181
  const userId = this.tracking?.getUserId() ?? this.config?.userId;
@@ -3205,54 +3183,25 @@ var DeepdotsPopups = class {
3205
3183
  const miniService = this.analytics?.getMiniService() ?? void 0;
3206
3184
  const analyticsFeedbackSessionId = this.analyticsFeedbackSessionId;
3207
3185
  this.log("tracking \xB7 survey identity \u2192", { userId: userId ?? null, sessionId: sessionId ?? null, miniService: miniService ?? null, analyticsFeedbackSessionId: analyticsFeedbackSessionId ?? null });
3208
- if (this.renderer) {
3209
- this.renderer.show(
3210
- surveyId,
3211
- productId,
3212
- actions,
3213
- (type, id, payload) => this.emitEvent(type, id, payload),
3214
- () => this.hidePopup(),
3215
- this.env,
3216
- userId,
3217
- style,
3218
- sessionId,
3219
- miniService,
3220
- analyticsFeedbackSessionId,
3221
- this.renderChrome,
3222
- { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language }
3223
- );
3224
- return;
3225
- }
3226
- if (!this.popupContainer) return;
3227
- const container = this.popupContainer;
3228
- void import("./renderPopup-Z6TENBP6.mjs").then(({ renderPopup }) => {
3229
- renderPopup(
3230
- container,
3231
- surveyId,
3232
- productId,
3233
- actions,
3234
- (type, id, payload) => this.emitEvent(type, id, payload),
3235
- () => this.hidePopup(),
3236
- this.env,
3237
- userId,
3238
- style,
3239
- sessionId,
3240
- miniService,
3241
- analyticsFeedbackSessionId,
3242
- { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language }
3243
- );
3244
- });
3186
+ this.renderer.show(
3187
+ surveyId,
3188
+ productId,
3189
+ actions,
3190
+ (type, id, payload) => this.emitEvent(type, id, payload),
3191
+ () => this.hidePopup(),
3192
+ this.env,
3193
+ userId,
3194
+ style,
3195
+ sessionId,
3196
+ miniService,
3197
+ analyticsFeedbackSessionId,
3198
+ this.renderChrome,
3199
+ { title, showProgressBar: this.showProgressBar, surveyCss: this.surveyCss, language: this.language, cspNonce: this.cspNonce }
3200
+ );
3245
3201
  }
3246
3202
  /** Hide the popup */
3247
3203
  hidePopup() {
3248
- if (this.renderer) {
3249
- this.renderer.hide();
3250
- return;
3251
- }
3252
- if (this.popupContainer) {
3253
- this.popupContainer.style.display = "none";
3254
- this.popupContainer.innerHTML = "";
3255
- }
3204
+ this.renderer.hide();
3256
3205
  }
3257
3206
  /** Emit an event */
3258
3207
  emitEvent(type, surveyId, data) {