@magicfeedback/popup-sdk 1.1.5 → 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.
- package/dist/{chunk-LSTKGFU7.mjs → chunk-4UXOEIAB.mjs} +21 -2
- package/dist/chunk-4UXOEIAB.mjs.map +1 -0
- package/dist/{chunk-7TOLYAFL.mjs → chunk-XOTM5CHX.mjs} +21 -2
- package/dist/chunk-XOTM5CHX.mjs.map +1 -0
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +44 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -12
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +15 -0
- package/dist/react-native.d.ts +15 -0
- package/dist/react-native.js +44 -12
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +20 -12
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-MES7IINW.mjs → renderPopup-EZKDMLVZ.mjs} +10 -7
- package/dist/renderPopup-EZKDMLVZ.mjs.map +1 -0
- package/dist/{renderPopup-YNH2TD3B.mjs → renderPopup-PS3NJDUR.mjs} +10 -7
- package/dist/renderPopup-PS3NJDUR.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-7TOLYAFL.mjs.map +0 -1
- package/dist/chunk-LSTKGFU7.mjs.map +0 -1
- package/dist/renderPopup-MES7IINW.mjs.map +0 -1
- package/dist/renderPopup-YNH2TD3B.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
buildFontFaceCss,
|
|
6
6
|
buildFontFamilyValue,
|
|
7
7
|
buildSurveyIdentity,
|
|
8
|
-
createDefaultStorage
|
|
9
|
-
|
|
8
|
+
createDefaultStorage,
|
|
9
|
+
sdkWarn,
|
|
10
|
+
setLogger
|
|
11
|
+
} from "./chunk-XOTM5CHX.mjs";
|
|
10
12
|
|
|
11
13
|
// src/types/index.ts
|
|
12
14
|
var POPUP_TRIGGER_CONDITION_STATUSES = [
|
|
@@ -267,7 +269,7 @@ var ReactNativePopupRenderer = class {
|
|
|
267
269
|
if (this.options.onShow) {
|
|
268
270
|
this.options.onShow({ surveyId, productId, html });
|
|
269
271
|
} else {
|
|
270
|
-
|
|
272
|
+
sdkWarn(
|
|
271
273
|
"[Deepdots] ReactNativePopupRenderer sin onShow: pasa { onShow } a new ReactNativePopupRenderer({...}) para montar el WebView del survey."
|
|
272
274
|
);
|
|
273
275
|
}
|
|
@@ -359,7 +361,7 @@ var BrowserPopupRenderer = class {
|
|
|
359
361
|
if (!this.container) return;
|
|
360
362
|
this.visible = true;
|
|
361
363
|
const container = this.container;
|
|
362
|
-
void import("./renderPopup-
|
|
364
|
+
void import("./renderPopup-EZKDMLVZ.mjs").then(({ renderPopup }) => {
|
|
363
365
|
renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId);
|
|
364
366
|
});
|
|
365
367
|
}
|
|
@@ -381,12 +383,13 @@ function createDefaultRenderer() {
|
|
|
381
383
|
}
|
|
382
384
|
|
|
383
385
|
// src/analytics/analytics-manager.ts
|
|
384
|
-
|
|
385
|
-
|
|
386
|
+
function createDryRunSink(log = console.log) {
|
|
387
|
+
return (payload) => log(
|
|
386
388
|
"[DeepdotsAnalytics] (dry-run \xB7 NO enviado \xB7 sin init.analytics) POST /sdk/feedback \u2192",
|
|
387
389
|
JSON.stringify(payload, null, 2)
|
|
388
390
|
);
|
|
389
|
-
}
|
|
391
|
+
}
|
|
392
|
+
var dryRunSink = createDryRunSink();
|
|
390
393
|
var AnalyticsManager = class {
|
|
391
394
|
constructor(options = {}) {
|
|
392
395
|
this.events = [];
|
|
@@ -901,7 +904,7 @@ var CrashReporter = class {
|
|
|
901
904
|
}
|
|
902
905
|
/** Instala los handlers globales de errores no capturados (no-op sin `window`). */
|
|
903
906
|
install() {
|
|
904
|
-
if (typeof window === "undefined") return;
|
|
907
|
+
if (typeof window === "undefined" || typeof window.addEventListener !== "function") return;
|
|
905
908
|
window.addEventListener("error", (e) => {
|
|
906
909
|
if (!this.isEnabled()) return;
|
|
907
910
|
this.captureUnhandled(e.error ?? e.message ?? "error");
|
|
@@ -953,6 +956,8 @@ var DeepdotsPopups = class {
|
|
|
953
956
|
this.triggers = [];
|
|
954
957
|
this.initialized = false;
|
|
955
958
|
this.renderer = createDefaultRenderer();
|
|
959
|
+
/** Logger para el output de debug. Default `console`; el host puede inyectar el suyo en init(). */
|
|
960
|
+
this.logger = console;
|
|
956
961
|
this.popupContainer = null;
|
|
957
962
|
// deprecated: mantenido para compatibilidad interna
|
|
958
963
|
this.popupDefinitions = [];
|
|
@@ -988,6 +993,8 @@ var DeepdotsPopups = class {
|
|
|
988
993
|
}
|
|
989
994
|
/** Initialize the SDK with configuration */
|
|
990
995
|
init(config) {
|
|
996
|
+
this.logger = config.logger ?? console;
|
|
997
|
+
setLogger(this.logger);
|
|
991
998
|
if (this.initialized) {
|
|
992
999
|
this.log("SDK already initialized");
|
|
993
1000
|
return;
|
|
@@ -1027,7 +1034,7 @@ var DeepdotsPopups = class {
|
|
|
1027
1034
|
onSessionId: (id) => {
|
|
1028
1035
|
this.analyticsFeedbackSessionId = id;
|
|
1029
1036
|
}
|
|
1030
|
-
}) :
|
|
1037
|
+
}) : createDryRunSink((...a) => this.logger.log(...a));
|
|
1031
1038
|
const device = config.device ?? collectDeviceInfo(config.appVersion);
|
|
1032
1039
|
this.analytics = new AnalyticsManager({
|
|
1033
1040
|
sink: analyticsSink,
|
|
@@ -1680,7 +1687,7 @@ var DeepdotsPopups = class {
|
|
|
1680
1687
|
}
|
|
1681
1688
|
if (!this.popupContainer) return;
|
|
1682
1689
|
const container = this.popupContainer;
|
|
1683
|
-
void import("./renderPopup-
|
|
1690
|
+
void import("./renderPopup-EZKDMLVZ.mjs").then(({ renderPopup }) => {
|
|
1684
1691
|
renderPopup(
|
|
1685
1692
|
container,
|
|
1686
1693
|
surveyId,
|
|
@@ -1736,7 +1743,8 @@ var DeepdotsPopups = class {
|
|
|
1736
1743
|
try {
|
|
1737
1744
|
listener(event);
|
|
1738
1745
|
} catch (error) {
|
|
1739
|
-
|
|
1746
|
+
if (this.logger.error) this.logger.error("Error in event listener:", error);
|
|
1747
|
+
else this.logger.log("Error in event listener:", error);
|
|
1740
1748
|
}
|
|
1741
1749
|
});
|
|
1742
1750
|
}
|
|
@@ -1744,7 +1752,7 @@ var DeepdotsPopups = class {
|
|
|
1744
1752
|
/** Log debug messages */
|
|
1745
1753
|
log(...args) {
|
|
1746
1754
|
if (this.config?.debug) {
|
|
1747
|
-
|
|
1755
|
+
this.logger.log("[DeepdotsPopups]", ...args);
|
|
1748
1756
|
}
|
|
1749
1757
|
}
|
|
1750
1758
|
/** External debug method for triggers */
|