@magicfeedback/popup-sdk 1.1.3 → 1.1.5
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/assets/assets/style.css +10 -1
- package/dist/{chunk-6WTOQGET.mjs → chunk-7TOLYAFL.mjs} +35 -2
- package/dist/chunk-7TOLYAFL.mjs.map +1 -0
- package/dist/{chunk-IOAZQPZE.mjs → chunk-LSTKGFU7.mjs} +35 -2
- package/dist/chunk-LSTKGFU7.mjs.map +1 -0
- package/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +98 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -8
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +34 -1
- package/dist/react-native.d.ts +34 -1
- package/dist/react-native.js +97 -6
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +33 -8
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-YLFRGPQN.mjs → renderPopup-MES7IINW.mjs} +34 -3
- package/dist/renderPopup-MES7IINW.mjs.map +1 -0
- package/dist/{renderPopup-KBDWWSUU.mjs → renderPopup-YNH2TD3B.mjs} +34 -3
- package/dist/renderPopup-YNH2TD3B.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-6WTOQGET.mjs.map +0 -1
- package/dist/chunk-IOAZQPZE.mjs.map +0 -1
- package/dist/renderPopup-KBDWWSUU.mjs.map +0 -1
- package/dist/renderPopup-YLFRGPQN.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
InMemoryStorage,
|
|
3
3
|
STORAGE_KEYS,
|
|
4
4
|
TrackingManager,
|
|
5
|
+
buildFontFaceCss,
|
|
6
|
+
buildFontFamilyValue,
|
|
5
7
|
buildSurveyIdentity,
|
|
6
8
|
createDefaultStorage
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7TOLYAFL.mjs";
|
|
8
10
|
|
|
9
11
|
// src/types/index.ts
|
|
10
12
|
var POPUP_TRIGGER_CONDITION_STATUSES = [
|
|
@@ -199,10 +201,12 @@ function buildSurveyHtml(opts) {
|
|
|
199
201
|
const pid = JSON.stringify(opts.productId);
|
|
200
202
|
const profileJson = JSON.stringify(opts.profile ?? []);
|
|
201
203
|
const metaJson = JSON.stringify(opts.metadata ?? []);
|
|
204
|
+
const fontFaceCss = opts.font ? buildFontFaceCss(opts.font.family, opts.font.url) : "";
|
|
205
|
+
const fontFamilyValue = opts.font ? buildFontFamilyValue(opts.font.family) : "-apple-system,system-ui,sans-serif";
|
|
202
206
|
return `<!DOCTYPE html><html><head>
|
|
203
207
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
204
208
|
<meta name="color-scheme" content="light"/>
|
|
205
|
-
<style
|
|
209
|
+
<style>${fontFaceCss}html,body{margin:0;padding:0;background:transparent;font-family:${fontFamilyValue}}#mf{width:100%;box-sizing:border-box}#mf *{max-width:100%;box-sizing:border-box}</style>
|
|
206
210
|
</head><body>
|
|
207
211
|
<div id="mf"></div>
|
|
208
212
|
<script>
|
|
@@ -253,13 +257,13 @@ var ReactNativePopupRenderer = class {
|
|
|
253
257
|
}
|
|
254
258
|
init() {
|
|
255
259
|
}
|
|
256
|
-
show(surveyId, productId, _actions, emit, onClose, env = "production", userId,
|
|
260
|
+
show(surveyId, productId, _actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId) {
|
|
257
261
|
this.emitFn = emit;
|
|
258
262
|
this.onCloseFn = onClose;
|
|
259
263
|
this.currentSurveyId = surveyId;
|
|
260
264
|
this.partialEmitted = false;
|
|
261
265
|
const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null, analyticsFeedbackSessionId ?? null);
|
|
262
|
-
const html = buildSurveyHtml({ surveyId, productId, env, profile, metadata });
|
|
266
|
+
const html = buildSurveyHtml({ surveyId, productId, env, profile, metadata, font: style?.font });
|
|
263
267
|
if (this.options.onShow) {
|
|
264
268
|
this.options.onShow({ surveyId, productId, html });
|
|
265
269
|
} else {
|
|
@@ -355,7 +359,7 @@ var BrowserPopupRenderer = class {
|
|
|
355
359
|
if (!this.container) return;
|
|
356
360
|
this.visible = true;
|
|
357
361
|
const container = this.container;
|
|
358
|
-
void import("./renderPopup-
|
|
362
|
+
void import("./renderPopup-MES7IINW.mjs").then(({ renderPopup }) => {
|
|
359
363
|
renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId);
|
|
360
364
|
});
|
|
361
365
|
}
|
|
@@ -921,11 +925,27 @@ var CrashReporter = class {
|
|
|
921
925
|
}
|
|
922
926
|
};
|
|
923
927
|
|
|
928
|
+
// src/analytics/messaging.ts
|
|
929
|
+
function buildMessageParams(stage, o) {
|
|
930
|
+
const p = {
|
|
931
|
+
stage,
|
|
932
|
+
message_id: o.id,
|
|
933
|
+
message_title: o.title,
|
|
934
|
+
channel: o.channel
|
|
935
|
+
};
|
|
936
|
+
if (o.campaign) p.campaign = o.campaign;
|
|
937
|
+
if (o.value !== void 0) p.value = o.value;
|
|
938
|
+
if (o.currency) p.currency = o.currency;
|
|
939
|
+
return { ...p, ...o.params ?? {} };
|
|
940
|
+
}
|
|
941
|
+
|
|
924
942
|
// src/core/deepdots-popups.ts
|
|
925
943
|
var EXIT_QUEUE_STORAGE_KEY = "__deepdots_exit_popup_queue__";
|
|
926
944
|
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
927
945
|
var ANALYTICS_MAX_BATCH_SIZE = 20;
|
|
928
946
|
var ANALYTICS_FLUSH_INTERVAL_MS = 3e4;
|
|
947
|
+
var RESERVED_EVENT_PREFIX = "deepdots_";
|
|
948
|
+
var CUSTOM_EVENT_PREFIX = "deepdots_event_";
|
|
929
949
|
var DeepdotsPopups = class {
|
|
930
950
|
constructor() {
|
|
931
951
|
this.config = null;
|
|
@@ -1078,8 +1098,9 @@ var DeepdotsPopups = class {
|
|
|
1078
1098
|
/** Registra un evento de analítica (modelo GA: nombre + params). No-op si tracking off. */
|
|
1079
1099
|
track(name, params) {
|
|
1080
1100
|
if (!this.tracking?.isTrackingEnabled()) return;
|
|
1081
|
-
|
|
1082
|
-
this.
|
|
1101
|
+
const eventName = name.startsWith(RESERVED_EVENT_PREFIX) ? name : `${CUSTOM_EVENT_PREFIX}${name}`;
|
|
1102
|
+
this.analytics?.track(eventName, params);
|
|
1103
|
+
this.log("analytics \xB7 track:", eventName, params ?? {});
|
|
1083
1104
|
}
|
|
1084
1105
|
/** User attributes para breakdowns (registration_status, pass_type, sector, pass_status…). */
|
|
1085
1106
|
setUserAttributes(attributes) {
|
|
@@ -1131,6 +1152,10 @@ var DeepdotsPopups = class {
|
|
|
1131
1152
|
trackFunnelStep(funnel, step, taskId, params) {
|
|
1132
1153
|
this.track("deepdots_funnel_step", { funnel, step, task_id: taskId, ...params ?? {} });
|
|
1133
1154
|
}
|
|
1155
|
+
/** Messaging (#18–22): registra una etapa del funnel de una notificación (push/in-app). No-op si tracking off. */
|
|
1156
|
+
trackMessage(stage, options) {
|
|
1157
|
+
this.track("deepdots_message", buildMessageParams(stage, options));
|
|
1158
|
+
}
|
|
1134
1159
|
/**
|
|
1135
1160
|
* Navegación MANUAL (entornos sin History API, p. ej. React Native con React Navigation).
|
|
1136
1161
|
* El host la llama en cada cambio de pantalla; emite `page_view` al salir de la anterior.
|
|
@@ -1655,7 +1680,7 @@ var DeepdotsPopups = class {
|
|
|
1655
1680
|
}
|
|
1656
1681
|
if (!this.popupContainer) return;
|
|
1657
1682
|
const container = this.popupContainer;
|
|
1658
|
-
void import("./renderPopup-
|
|
1683
|
+
void import("./renderPopup-MES7IINW.mjs").then(({ renderPopup }) => {
|
|
1659
1684
|
renderPopup(
|
|
1660
1685
|
container,
|
|
1661
1686
|
surveyId,
|
|
@@ -1884,6 +1909,7 @@ export {
|
|
|
1884
1909
|
POPUP_TRIGGER_CONDITION_STATUSES,
|
|
1885
1910
|
ReactNativePopupRenderer,
|
|
1886
1911
|
buildAnalyticsFeedbackBody,
|
|
1912
|
+
buildMessageParams,
|
|
1887
1913
|
buildSurveyHtml,
|
|
1888
1914
|
collectRnDevice,
|
|
1889
1915
|
crashRecordToParams,
|