qumra-engine 2.0.115 → 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.
@@ -390,16 +390,30 @@ exports.default = new (class SeoExtension {
390
390
 
391
391
  <script>
392
392
  window.addEventListener("message", (event) => {
393
- // يفضل تتحقق من الـ origin لو عايز أمان أكتر
393
+ // لو عايز تتحقق من الـ origin:
394
394
  // if (event.origin !== "https://dashboard.qumra.cloud") return;
395
395
 
396
396
  const data = event.data;
397
397
 
398
398
  if (data?.type === "reRender") {
399
399
  console.log("📩 تم استقبال رسالة إعادة الرندر:", data);
400
- // هنا تقدر تنفذ أي كود لإعادة الرندر أو تحديث الصفحة
401
- // مثلا:
402
- // location.reload();
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
+ }
403
417
  } else {
404
418
  console.log("📩 رسالة وصلت:", data);
405
419
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.115",
3
+ "version": "2.0.116",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {