@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/react-native.mjs
CHANGED
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
STORAGE_KEYS,
|
|
3
3
|
TrackingManager,
|
|
4
4
|
__require,
|
|
5
|
+
buildFontFaceCss,
|
|
6
|
+
buildFontFamilyValue,
|
|
5
7
|
buildSurveyIdentity,
|
|
6
8
|
createDefaultStorage
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LSTKGFU7.mjs";
|
|
8
10
|
|
|
9
11
|
// src/react-native/index.tsx
|
|
10
12
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
@@ -204,10 +206,12 @@ function buildSurveyHtml(opts) {
|
|
|
204
206
|
const pid = JSON.stringify(opts.productId);
|
|
205
207
|
const profileJson = JSON.stringify(opts.profile ?? []);
|
|
206
208
|
const metaJson = JSON.stringify(opts.metadata ?? []);
|
|
209
|
+
const fontFaceCss = opts.font ? buildFontFaceCss(opts.font.family, opts.font.url) : "";
|
|
210
|
+
const fontFamilyValue = opts.font ? buildFontFamilyValue(opts.font.family) : "-apple-system,system-ui,sans-serif";
|
|
207
211
|
return `<!DOCTYPE html><html><head>
|
|
208
212
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
209
213
|
<meta name="color-scheme" content="light"/>
|
|
210
|
-
<style
|
|
214
|
+
<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>
|
|
211
215
|
</head><body>
|
|
212
216
|
<div id="mf"></div>
|
|
213
217
|
<script>
|
|
@@ -258,13 +262,13 @@ var ReactNativePopupRenderer = class {
|
|
|
258
262
|
}
|
|
259
263
|
init() {
|
|
260
264
|
}
|
|
261
|
-
show(surveyId, productId, _actions, emit, onClose, env = "production", userId,
|
|
265
|
+
show(surveyId, productId, _actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId) {
|
|
262
266
|
this.emitFn = emit;
|
|
263
267
|
this.onCloseFn = onClose;
|
|
264
268
|
this.currentSurveyId = surveyId;
|
|
265
269
|
this.partialEmitted = false;
|
|
266
270
|
const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null, analyticsFeedbackSessionId ?? null);
|
|
267
|
-
const html = buildSurveyHtml({ surveyId, productId, env, profile, metadata });
|
|
271
|
+
const html = buildSurveyHtml({ surveyId, productId, env, profile, metadata, font: style?.font });
|
|
268
272
|
if (this.options.onShow) {
|
|
269
273
|
this.options.onShow({ surveyId, productId, html });
|
|
270
274
|
} else {
|
|
@@ -360,7 +364,7 @@ var BrowserPopupRenderer = class {
|
|
|
360
364
|
if (!this.container) return;
|
|
361
365
|
this.visible = true;
|
|
362
366
|
const container = this.container;
|
|
363
|
-
void import("./renderPopup-
|
|
367
|
+
void import("./renderPopup-YNH2TD3B.mjs").then(({ renderPopup }) => {
|
|
364
368
|
renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId);
|
|
365
369
|
});
|
|
366
370
|
}
|
|
@@ -926,11 +930,27 @@ var CrashReporter = class {
|
|
|
926
930
|
}
|
|
927
931
|
};
|
|
928
932
|
|
|
933
|
+
// src/analytics/messaging.ts
|
|
934
|
+
function buildMessageParams(stage, o) {
|
|
935
|
+
const p = {
|
|
936
|
+
stage,
|
|
937
|
+
message_id: o.id,
|
|
938
|
+
message_title: o.title,
|
|
939
|
+
channel: o.channel
|
|
940
|
+
};
|
|
941
|
+
if (o.campaign) p.campaign = o.campaign;
|
|
942
|
+
if (o.value !== void 0) p.value = o.value;
|
|
943
|
+
if (o.currency) p.currency = o.currency;
|
|
944
|
+
return { ...p, ...o.params ?? {} };
|
|
945
|
+
}
|
|
946
|
+
|
|
929
947
|
// src/core/deepdots-popups.ts
|
|
930
948
|
var EXIT_QUEUE_STORAGE_KEY = "__deepdots_exit_popup_queue__";
|
|
931
949
|
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
932
950
|
var ANALYTICS_MAX_BATCH_SIZE = 20;
|
|
933
951
|
var ANALYTICS_FLUSH_INTERVAL_MS = 3e4;
|
|
952
|
+
var RESERVED_EVENT_PREFIX = "deepdots_";
|
|
953
|
+
var CUSTOM_EVENT_PREFIX = "deepdots_event_";
|
|
934
954
|
var DeepdotsPopups = class {
|
|
935
955
|
constructor() {
|
|
936
956
|
this.config = null;
|
|
@@ -1083,8 +1103,9 @@ var DeepdotsPopups = class {
|
|
|
1083
1103
|
/** Registra un evento de analítica (modelo GA: nombre + params). No-op si tracking off. */
|
|
1084
1104
|
track(name, params) {
|
|
1085
1105
|
if (!this.tracking?.isTrackingEnabled()) return;
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1106
|
+
const eventName = name.startsWith(RESERVED_EVENT_PREFIX) ? name : `${CUSTOM_EVENT_PREFIX}${name}`;
|
|
1107
|
+
this.analytics?.track(eventName, params);
|
|
1108
|
+
this.log("analytics \xB7 track:", eventName, params ?? {});
|
|
1088
1109
|
}
|
|
1089
1110
|
/** User attributes para breakdowns (registration_status, pass_type, sector, pass_status…). */
|
|
1090
1111
|
setUserAttributes(attributes) {
|
|
@@ -1136,6 +1157,10 @@ var DeepdotsPopups = class {
|
|
|
1136
1157
|
trackFunnelStep(funnel, step, taskId, params) {
|
|
1137
1158
|
this.track("deepdots_funnel_step", { funnel, step, task_id: taskId, ...params ?? {} });
|
|
1138
1159
|
}
|
|
1160
|
+
/** Messaging (#18–22): registra una etapa del funnel de una notificación (push/in-app). No-op si tracking off. */
|
|
1161
|
+
trackMessage(stage, options) {
|
|
1162
|
+
this.track("deepdots_message", buildMessageParams(stage, options));
|
|
1163
|
+
}
|
|
1139
1164
|
/**
|
|
1140
1165
|
* Navegación MANUAL (entornos sin History API, p. ej. React Native con React Navigation).
|
|
1141
1166
|
* El host la llama en cada cambio de pantalla; emite `page_view` al salir de la anterior.
|
|
@@ -1660,7 +1685,7 @@ var DeepdotsPopups = class {
|
|
|
1660
1685
|
}
|
|
1661
1686
|
if (!this.popupContainer) return;
|
|
1662
1687
|
const container = this.popupContainer;
|
|
1663
|
-
void import("./renderPopup-
|
|
1688
|
+
void import("./renderPopup-YNH2TD3B.mjs").then(({ renderPopup }) => {
|
|
1664
1689
|
renderPopup(
|
|
1665
1690
|
container,
|
|
1666
1691
|
surveyId,
|