@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.
- package/README.md +6 -1
- package/dist/assets/assets/style.css +1 -1
- package/dist/{chunk-GXEPYT33.mjs → chunk-C7VD3HY4.mjs} +2 -2
- package/dist/{chunk-GXEPYT33.mjs.map → chunk-C7VD3HY4.mjs.map} +1 -1
- package/dist/{chunk-TSORXOQG.mjs → chunk-GUJSOVS6.mjs} +2 -2
- package/dist/{chunk-TSORXOQG.mjs.map → chunk-GUJSOVS6.mjs.map} +1 -1
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +389 -355
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -73
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +16 -3
- package/dist/react-native.d.ts +16 -3
- package/dist/react-native.js +63 -124
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +22 -73
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-KSZJ5AN4.mjs → renderPopup-CHWH3KHR.mjs} +368 -283
- package/dist/renderPopup-CHWH3KHR.mjs.map +1 -0
- package/dist/{renderPopup-JF6IB6HL.mjs → renderPopup-RWSU5Y2H.mjs} +42 -52
- package/dist/renderPopup-RWSU5Y2H.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/renderPopup-JF6IB6HL.mjs.map +0 -1
- package/dist/renderPopup-KSZJ5AN4.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
sdkWarn,
|
|
22
22
|
setLogger,
|
|
23
23
|
style_default
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-C7VD3HY4.mjs";
|
|
25
25
|
|
|
26
26
|
// src/types/index.ts
|
|
27
27
|
var POPUP_TRIGGER_CONDITION_STATUSES = [
|
|
@@ -254,7 +254,7 @@ function trimmedOrNull(value) {
|
|
|
254
254
|
}
|
|
255
255
|
function buildSurveyHtml(opts) {
|
|
256
256
|
const env = opts.env === "development" ? "dev" : "prod";
|
|
257
|
-
const version = opts.version ?? "2.2.
|
|
257
|
+
const version = opts.version ?? "2.2.33";
|
|
258
258
|
const cdn = `https://cdn.jsdelivr.net/npm/@magicfeedback/native@${version}/dist/magicfeedback-sdk.browser.js`;
|
|
259
259
|
const sid = jsonForScript(opts.surveyId);
|
|
260
260
|
const pid = jsonForScript(opts.productId);
|
|
@@ -893,7 +893,7 @@ function createReactNativeRenderer() {
|
|
|
893
893
|
}
|
|
894
894
|
|
|
895
895
|
// src/ui/preload.ts
|
|
896
|
-
var defaultLoader = () => import("./renderPopup-
|
|
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-
|
|
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
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
);
|
|
3224
|
-
return;
|
|
3225
|
-
}
|
|
3226
|
-
if (!this.popupContainer) return;
|
|
3227
|
-
const container = this.popupContainer;
|
|
3228
|
-
void import("./renderPopup-KSZJ5AN4.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
|
-
|
|
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) {
|