qumra-engine 2.0.114 → 2.0.116
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.
|
@@ -386,6 +386,43 @@ exports.default = new (class SeoExtension {
|
|
|
386
386
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
387
387
|
});
|
|
388
388
|
</script>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<script>
|
|
392
|
+
window.addEventListener("message", (event) => {
|
|
393
|
+
// لو عايز تتحقق من الـ origin:
|
|
394
|
+
// if (event.origin !== "https://dashboard.qumra.cloud") return;
|
|
395
|
+
|
|
396
|
+
const data = event.data;
|
|
397
|
+
|
|
398
|
+
if (data?.type === "reRender") {
|
|
399
|
+
console.log("📩 تم استقبال رسالة إعادة الرندر:", data);
|
|
400
|
+
|
|
401
|
+
const { html, widgetId } = data.data || {};
|
|
402
|
+
|
|
403
|
+
if (!widgetId || !html) {
|
|
404
|
+
console.warn("⚠️ لا يوجد widgetId أو html في الرسالة");
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// البحث عن الويدجت المطلوب
|
|
409
|
+
const widgetEl = document.querySelector(\`[widget-id="\${widgetId}"]\`);
|
|
410
|
+
|
|
411
|
+
if (widgetEl) {
|
|
412
|
+
widgetEl.innerHTML = html;
|
|
413
|
+
console.log(\`✅ تم تحديث محتوى الويدجت \${widgetId}\`);
|
|
414
|
+
} else {
|
|
415
|
+
console.warn(\`⚠️ لم يتم العثور على عنصر يحتوي على widget-id="\${widgetId}"\`);
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
console.log("📩 رسالة وصلت:", data);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
</script>
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
389
426
|
`;
|
|
390
427
|
}
|
|
391
428
|
return new nunjucks_1.runtime.SafeString(scripts);
|
|
@@ -26,6 +26,9 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
26
26
|
if (req.query?.themeVersion) {
|
|
27
27
|
params.set("themeVersion", String(req.query.themeVersion));
|
|
28
28
|
}
|
|
29
|
+
if (req.query?.widget) {
|
|
30
|
+
params.set("widgetId", String(req.query.widget));
|
|
31
|
+
}
|
|
29
32
|
if (req.query?.previewCategory) {
|
|
30
33
|
params.set("previewCategory", String(req.query.previewCategory));
|
|
31
34
|
}
|
|
@@ -38,6 +41,9 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
38
41
|
if (res.locals.preview && res.locals.themeWidget) {
|
|
39
42
|
api = `${res.locals.renderApi}/render/preview-widget${themePath}`;
|
|
40
43
|
}
|
|
44
|
+
else if (req.query?.widget && req.query?.jsonPreview) {
|
|
45
|
+
api = `${res.locals.renderApi}/render/rerender-widget${themePath}`;
|
|
46
|
+
}
|
|
41
47
|
else {
|
|
42
48
|
api = true
|
|
43
49
|
? `${res.locals.renderApi}/render${themePath}`
|
|
@@ -53,7 +59,7 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
53
59
|
Authorization,
|
|
54
60
|
qdid: qdid,
|
|
55
61
|
"client-ip": res.locals.clientIp || "",
|
|
56
|
-
|
|
62
|
+
market: res.locals.market || "",
|
|
57
63
|
},
|
|
58
64
|
})
|
|
59
65
|
.then((engineResponse) => {
|