[mirotalksfu] - make widget fully configurable via config.js and .env

هذا الالتزام موجود في:
Miroslav Pejic
2025-08-08 01:34:20 +02:00
الأصل 72fbecc8d0
التزام 1d88a19c03
10 ملفات معدلة مع 105 إضافات و9 حذوفات

عرض الملف

@@ -34,6 +34,28 @@ const guestJoinRoomButton = document.getElementById('guestJoinRoomButton');
// app/src/config.js - ui.brand
let BRAND = {
widget: {
enabled: false,
theme: 'dark',
widgetState: 'minimized',
widgetType: 'support',
supportWidget: {
position: 'top-right',
expertImages: [
'https://photo.cloudron.pocketsolution.net/uploads/original/95/7d/a5f7f7a2c89a5fee7affda5f013c.jpeg',
],
checkOnlineStatus: false,
isOnline: true,
customMessages: {
heading: 'Need Help?',
subheading: 'Get instant support from our expert team!',
connectText: 'connect in < 5 seconds',
onlineText: 'We are online',
offlineText: 'We are offline',
poweredBy: 'Powered by MiroTalk SFU',
},
},
},
app: {
language: 'en',
name: 'MiroTalk SFU',
@@ -76,7 +98,7 @@ let BRAND = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: '<strong>WebRTC SFU v1.9.24</strong>',
title: '<strong>WebRTC SFU v1.9.25</strong>',
html: `
<button
id="support-button"
@@ -119,6 +141,8 @@ async function initialize() {
customizeApp();
customizeWidget();
customizeWhoAreYou();
checkBrand();
@@ -193,6 +217,22 @@ function customizeApp() {
}
}
// WIDGET customize
function customizeWidget() {
if (BRAND.widget?.enabled) {
window.addEventListener('DOMContentLoaded', function () {
if (typeof MiroTalkWidget !== 'undefined') {
const domain = window.location.host;
const roomId = 'support-room';
const userName = 'guest-' + Math.floor(Math.random() * 10000);
new MiroTalkWidget(domain, roomId, userName, BRAND.widget);
} else {
console.error('MiroTalkWidget is not defined. Please check Widget.js loading.');
}
});
}
}
// SITE metadata
function customizeSite() {
if (title && BRAND.site?.title) {