@magicfeedback/popup-sdk 1.17.2 → 1.18.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 +10 -1
- package/dist/assets/assets/style.css +59 -1
- package/dist/{chunk-VHTN5UXD.mjs → chunk-7ZVOPIWE.mjs} +98 -2
- package/dist/chunk-7ZVOPIWE.mjs.map +1 -0
- package/dist/{chunk-AFRHPS3K.mjs → chunk-DNBFTJCA.mjs} +98 -2
- package/dist/chunk-DNBFTJCA.mjs.map +1 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +307 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -8
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +7 -1
- package/dist/react-native.d.ts +7 -1
- package/dist/react-native.js +137 -10
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +29 -8
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-L2Q3KJAZ.mjs → renderPopup-B6VIV4VS.mjs} +12 -6
- package/dist/renderPopup-B6VIV4VS.mjs.map +1 -0
- package/dist/{renderPopup-PQWJSBOY.mjs → renderPopup-BKZPAZZG.mjs} +183 -123
- package/dist/renderPopup-BKZPAZZG.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-AFRHPS3K.mjs.map +0 -1
- package/dist/chunk-VHTN5UXD.mjs.map +0 -1
- package/dist/renderPopup-L2Q3KJAZ.mjs.map +0 -1
- package/dist/renderPopup-PQWJSBOY.mjs.map +0 -1
package/dist/react-native.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
REVEAL_TIMEOUT_MS,
|
|
7
7
|
RTL_LOCALES,
|
|
8
8
|
STORAGE_KEYS,
|
|
9
|
+
SUBMIT_ERROR_JS,
|
|
9
10
|
TrackingManager,
|
|
10
11
|
__require,
|
|
11
12
|
buildFontFaceCss,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
sdkWarn,
|
|
19
20
|
setLogger,
|
|
20
21
|
style_default
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7ZVOPIWE.mjs";
|
|
22
23
|
|
|
23
24
|
// src/react-native/index.tsx
|
|
24
25
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
@@ -256,7 +257,7 @@ function trimmedOrNull(value) {
|
|
|
256
257
|
}
|
|
257
258
|
function buildSurveyHtml(opts) {
|
|
258
259
|
const env = opts.env === "development" ? "dev" : "prod";
|
|
259
|
-
const version = opts.version ?? "2.2.
|
|
260
|
+
const version = opts.version ?? "2.2.37";
|
|
260
261
|
const cdn = `https://cdn.jsdelivr.net/npm/@magicfeedback/native@${version}/dist/magicfeedback-sdk.browser.js`;
|
|
261
262
|
const sid = jsonForScript(opts.surveyId);
|
|
262
263
|
const pid = jsonForScript(opts.productId);
|
|
@@ -428,6 +429,7 @@ ${customCss}
|
|
|
428
429
|
(function(){
|
|
429
430
|
function emit(s){ try{ if(window.ReactNativeWebView){ window.ReactNativeWebView.postMessage(s); } }catch(e){} }
|
|
430
431
|
function emitJSON(n,p){ try{ emit(JSON.stringify({name:n,payload:p||{}})); }catch(e){} }
|
|
432
|
+
var ddLastReportedError=null;
|
|
431
433
|
window.DeepdotsClose = function(){ emitJSON('popup_close'); };
|
|
432
434
|
var chromeOn=${chrome ? "true" : "false"};
|
|
433
435
|
|
|
@@ -608,6 +610,7 @@ ${customCss}
|
|
|
608
610
|
|
|
609
611
|
${PRIMARY_COLOR_JS}
|
|
610
612
|
${BUSY_JS}
|
|
613
|
+
${SUBMIT_ERROR_JS}
|
|
611
614
|
${REVEAL_JS}
|
|
612
615
|
// Foco en la primera pregunta si es de escribir. Al navegar lo pone @magicfeedback/native
|
|
613
616
|
// (autofocus:'navigation'); la apertura la decide el popup, que es quien sabe cu\xE1ndo se revela.
|
|
@@ -759,10 +762,10 @@ ${REVEAL_JS}
|
|
|
759
762
|
emitJSON('before_submit');
|
|
760
763
|
},
|
|
761
764
|
afterSubmitEvent:function(p){
|
|
762
|
-
|
|
763
|
-
if(error){
|
|
765
|
+
if(p && p.error){
|
|
764
766
|
setLoading(false);
|
|
765
|
-
|
|
767
|
+
var ddErr=ddClassifySubmitError(p.error);
|
|
768
|
+
if(ddErr.reason==='required'){
|
|
766
769
|
// La p\xE1gina no ha cambiado: el estado de navegaci\xF3n se queda como estaba.
|
|
767
770
|
errorHint.textContent=DD_LABELS_ACTIVE.errorRequired;
|
|
768
771
|
errorHint.style.display='block';
|
|
@@ -771,6 +774,11 @@ ${REVEAL_JS}
|
|
|
771
774
|
}
|
|
772
775
|
errorHint.textContent=DD_LABELS_ACTIVE.errorSubmit;
|
|
773
776
|
errorHint.style.display='block';
|
|
777
|
+
// Un solo aviso por fallo: native repite el mismo objeto al cerrar el survey.
|
|
778
|
+
if(p.error!==ddLastReportedError){
|
|
779
|
+
ddLastReportedError=p.error;
|
|
780
|
+
emitJSON('survey_error', ddErr);
|
|
781
|
+
}
|
|
774
782
|
return;
|
|
775
783
|
}
|
|
776
784
|
errorHint.style.display='none';
|
|
@@ -893,8 +901,9 @@ var ReactNativePopupRenderer = class {
|
|
|
893
901
|
const surveyId = this.currentSurveyId;
|
|
894
902
|
if (!surveyId || !this.emitFn) return;
|
|
895
903
|
let name;
|
|
904
|
+
let payload;
|
|
896
905
|
try {
|
|
897
|
-
name = JSON.parse(raw)
|
|
906
|
+
({ name, payload } = JSON.parse(raw));
|
|
898
907
|
} catch {
|
|
899
908
|
name = raw;
|
|
900
909
|
}
|
|
@@ -915,6 +924,9 @@ var ReactNativePopupRenderer = class {
|
|
|
915
924
|
case "survey_completed":
|
|
916
925
|
this.emitFn("survey_completed", surveyId);
|
|
917
926
|
break;
|
|
927
|
+
case "survey_error":
|
|
928
|
+
this.emitFn("survey_error", surveyId, { reason: payload?.reason, message: payload?.message });
|
|
929
|
+
break;
|
|
918
930
|
case "popup_close":
|
|
919
931
|
this.onCloseFn?.();
|
|
920
932
|
break;
|
|
@@ -932,7 +944,7 @@ function createReactNativeRenderer() {
|
|
|
932
944
|
}
|
|
933
945
|
|
|
934
946
|
// src/ui/preload.ts
|
|
935
|
-
var defaultLoader = () => import("./renderPopup-
|
|
947
|
+
var defaultLoader = () => import("./renderPopup-B6VIV4VS.mjs");
|
|
936
948
|
var pending = null;
|
|
937
949
|
function preloadRenderPopup(loader = defaultLoader) {
|
|
938
950
|
if (pending) return pending;
|
|
@@ -1005,7 +1017,7 @@ var BrowserPopupRenderer = class {
|
|
|
1005
1017
|
if (!this.container) return;
|
|
1006
1018
|
this.visible = true;
|
|
1007
1019
|
const container = this.container;
|
|
1008
|
-
void import("./renderPopup-
|
|
1020
|
+
void import("./renderPopup-B6VIV4VS.mjs").then(
|
|
1009
1021
|
({ renderPopup }) => {
|
|
1010
1022
|
renderPopup(container, surveyId, productId, actions, emit, onClose, env, userId, style, sessionId, miniService, analyticsFeedbackSessionId, options);
|
|
1011
1023
|
},
|
|
@@ -3369,6 +3381,15 @@ var DeepdotsPopups = class {
|
|
|
3369
3381
|
emitEvent(type, surveyId, data) {
|
|
3370
3382
|
const event = { type, surveyId, timestamp: Date.now(), data };
|
|
3371
3383
|
this.log("Event emitted", event);
|
|
3384
|
+
if (type === "survey_error") {
|
|
3385
|
+
const popupId = data?.popupId || this.surveyToPopupId.get(surveyId);
|
|
3386
|
+
this.track("deepdots_survey_error", {
|
|
3387
|
+
survey_id: surveyId,
|
|
3388
|
+
...popupId ? { popup_id: popupId } : {},
|
|
3389
|
+
reason: data?.reason,
|
|
3390
|
+
message: data?.message
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3372
3393
|
const isPartialClick = type === "popup_clicked" && data?.action === "partial";
|
|
3373
3394
|
if (isPartialClick) {
|
|
3374
3395
|
this.markSurveyProgress(surveyId, "PARTIAL");
|