[mirotalk] - make widget fully configurable via config.js
This commit is contained in:
@@ -6,6 +6,28 @@ module.exports = {
|
||||
// Branding and customizations require a license: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
brand: {
|
||||
htmlInjection: true,
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
app: {
|
||||
language: 'en', // https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
|
||||
name: 'MiroTalk',
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ dependencies: {
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.5.52
|
||||
* @version 1.5.53
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.52",
|
||||
"version": "1.5.53",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.52",
|
||||
"version": "1.5.53",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@mattermost/client": "10.9.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.52",
|
||||
"version": "1.5.53",
|
||||
"description": "A free WebRTC browser-based video call",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
+39
-1
@@ -37,6 +37,28 @@ const footer = document.getElementById('footer');
|
||||
// Brand customizations...
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
app: {
|
||||
language: 'en',
|
||||
name: 'MiroTalk',
|
||||
@@ -73,7 +95,7 @@ let brand = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: 'WebRTC P2P v1.5.52',
|
||||
title: 'WebRTC P2P v1.5.53',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
@@ -111,6 +133,8 @@ async function initBrand() {
|
||||
await getBrand();
|
||||
|
||||
handleBrand();
|
||||
|
||||
handleWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,6 +213,20 @@ function handleBrand() {
|
||||
!brand.html.footer && elementDisplay(footer, false);
|
||||
}
|
||||
|
||||
// WIDGET customize
|
||||
function handleWidget() {
|
||||
if (brand.widget?.enabled) {
|
||||
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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Element display
|
||||
* @param {object} element
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.5.52
|
||||
* @version 1.5.53
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -11242,7 +11242,7 @@ function showAbout() {
|
||||
Swal.fire({
|
||||
background: swBg,
|
||||
position: 'center',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.52',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.53',
|
||||
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
|
||||
customClass: { image: 'img-about' },
|
||||
html: `
|
||||
|
||||
+5
-1
@@ -693,7 +693,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
position: autoInit.getAttribute('data-position') || MiroTalkWidget.DEFAULT_OPTIONS.supportWidget.position,
|
||||
checkOnline: autoInit.getAttribute('data-check-online') === 'true',
|
||||
expertImages: autoInit.getAttribute('data-expert-images')
|
||||
? autoInit.getAttribute('data-expert-images').split(',').map(url => url.trim()).filter(Boolean)
|
||||
? autoInit
|
||||
.getAttribute('data-expert-images')
|
||||
.split(',')
|
||||
.map((url) => url.trim())
|
||||
.filter(Boolean)
|
||||
: MiroTalkWidget.DEFAULT_OPTIONS.supportWidget.expertImages,
|
||||
customMessages: {
|
||||
heading:
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
<!-- sweetalert -->
|
||||
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.8"></script>
|
||||
|
||||
<!-- MiroTalk P2P Widget -->
|
||||
|
||||
<script defer src="../js/widget.js"></script>
|
||||
</head>
|
||||
<body class="has-animations">
|
||||
<div id="snow-container"></div>
|
||||
@@ -756,7 +760,6 @@
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script defer src="../js/utils.js"></script>
|
||||
<script defer src="../js/common.js"></script>
|
||||
<script defer src="../js/brand.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user