qumra-engine 2.0.115 → 2.0.117
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.
|
@@ -390,16 +390,31 @@ exports.default = new (class SeoExtension {
|
|
|
390
390
|
|
|
391
391
|
<script>
|
|
392
392
|
window.addEventListener("message", (event) => {
|
|
393
|
-
//
|
|
393
|
+
// لو عايز تتحقق من الـ origin:
|
|
394
394
|
// if (event.origin !== "https://dashboard.qumra.cloud") return;
|
|
395
395
|
|
|
396
396
|
const data = event.data;
|
|
397
|
+
console.log("🚀 ~ run ~ data:", data)
|
|
397
398
|
|
|
398
399
|
if (data?.type === "reRender") {
|
|
399
400
|
console.log("📩 تم استقبال رسالة إعادة الرندر:", data);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
|
|
402
|
+
const { html, widgetId } = data.data || {};
|
|
403
|
+
|
|
404
|
+
if (!widgetId || !html) {
|
|
405
|
+
console.warn("⚠️ لا يوجد widgetId أو html في الرسالة");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// البحث عن الويدجت المطلوب
|
|
410
|
+
const widgetEl = document.querySelector(\`[widget-id="\${widgetId}"]\`);
|
|
411
|
+
|
|
412
|
+
if (widgetEl) {
|
|
413
|
+
widgetEl.innerHTML = html;
|
|
414
|
+
console.log(\`✅ تم تحديث محتوى الويدجت \${widgetId}\`);
|
|
415
|
+
} else {
|
|
416
|
+
console.warn(\`⚠️ لم يتم العثور على عنصر يحتوي على widget-id="\${widgetId}"\`);
|
|
417
|
+
}
|
|
403
418
|
} else {
|
|
404
419
|
console.log("📩 رسالة وصلت:", data);
|
|
405
420
|
}
|