generated from MokoConsulting/Template-Joomla
feat: add Joomla scaffolding — plugin manifest, Extension class, services provider, SQL install/uninstall, language files
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
PLG_SYSTEM_MOKOSUITESUPPORT="System - MokoSuite Support"
|
||||
PLG_SYSTEM_MOKOSUITESUPPORT_DESC="Multi-channel customer support — website chat, Facebook Messenger, WhatsApp, unified agent inbox, CSAT."
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
PLG_SYSTEM_MOKOSUITESUPPORT="System - MokoSuite Support"
|
||||
PLG_SYSTEM_MOKOSUITESUPPORT_DESC="Multi-channel customer support — website chat, Facebook Messenger, WhatsApp, unified agent inbox, CSAT."
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" group="system" method="upgrade">
|
||||
<name>System - MokoSuite Support</name>
|
||||
<element>mokosuitesupport</element>
|
||||
<author>Moko Consulting</author>
|
||||
<creationDate>2026-06-22</creationDate>
|
||||
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||
<license>GPL-3.0-or-later</license>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||
<version>01.00.00</version>
|
||||
<php_minimum>8.3</php_minimum>
|
||||
<description>PLG_SYSTEM_MOKOSUITESUPPORT_DESC</description>
|
||||
<namespace path="src">Moko\Plugin\System\MokoSuiteSupport</namespace>
|
||||
<files>
|
||||
<folder>src</folder>
|
||||
<folder>services</folder>
|
||||
<folder>language</folder>
|
||||
<folder>sql</folder>
|
||||
</files>
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/plg_system_mokosuitesupport.ini</language>
|
||||
<language tag="en-GB">en-GB/plg_system_mokosuitesupport.sys.ini</language>
|
||||
</languages>
|
||||
<install><sql><file driver="mysql" charset="utf8">sql/install.mysql.sql</file></sql></install>
|
||||
<uninstall><sql><file driver="mysql" charset="utf8">sql/uninstall.mysql.sql</file></sql></uninstall>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="chat" label="Chat Widget">
|
||||
<field name="enable_chat_widget" type="radio" default="1" label="Enable Chat Widget" class="btn-group btn-group-yesno">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="chat_position" type="list" default="bottom-right" label="Widget Position">
|
||||
<option value="bottom-right">Bottom Right</option>
|
||||
<option value="bottom-left">Bottom Left</option>
|
||||
</field>
|
||||
<field name="chat_greeting" type="text" default="Hi! How can we help?" label="Greeting Message" />
|
||||
<field name="max_agent_conversations" type="number" default="5" label="Max Conversations per Agent" />
|
||||
</fieldset>
|
||||
<fieldset name="channels" label="Channels">
|
||||
<field name="fb_page_token" type="text" default="" label="Facebook Page Access Token" />
|
||||
<field name="fb_app_secret" type="text" default="" label="Facebook App Secret" />
|
||||
<field name="whatsapp_token" type="text" default="" label="WhatsApp Cloud API Token" />
|
||||
<field name="whatsapp_phone_id" type="text" default="" label="WhatsApp Phone Number ID" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Moko\Plugin\System\MokoSuiteSupport\Extension\Support;
|
||||
|
||||
return new class implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
$plugin = new Support($dispatcher, (array) PluginHelper::getPlugin('system', 'mokosuitesupport'));
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
--
|
||||
-- MokoSuite Support Tables
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesupport_conversations` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`channel` ENUM('website','facebook','whatsapp','instagram','email') NOT NULL DEFAULT 'website',
|
||||
`channel_id` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`contact_id` INT DEFAULT NULL,
|
||||
`visitor_name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`visitor_email` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`agent_id` INT DEFAULT NULL,
|
||||
`status` ENUM('open','assigned','waiting','closed') NOT NULL DEFAULT 'open',
|
||||
`csat_rating` TINYINT UNSIGNED DEFAULT NULL,
|
||||
`started_at` DATETIME NOT NULL,
|
||||
`last_message_at` DATETIME DEFAULT NULL,
|
||||
`closed_at` DATETIME DEFAULT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_channel` (`channel`, `channel_id`),
|
||||
KEY `idx_agent` (`agent_id`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_contact` (`contact_id`),
|
||||
KEY `idx_last_msg` (`last_message_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesupport_messages` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`conversation_id` INT UNSIGNED NOT NULL,
|
||||
`sender_type` ENUM('visitor','agent','system') NOT NULL,
|
||||
`sender_id` INT DEFAULT NULL,
|
||||
`body` TEXT NOT NULL,
|
||||
`attachments` JSON DEFAULT NULL,
|
||||
`read_at` DATETIME DEFAULT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_conversation` (`conversation_id`),
|
||||
KEY `idx_created` (`created`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesupport_agents` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user_id` INT NOT NULL,
|
||||
`display_name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`avatar_path` VARCHAR(500) NOT NULL DEFAULT '',
|
||||
`status` ENUM('online','away','offline') NOT NULL DEFAULT 'offline',
|
||||
`max_conversations` INT UNSIGNED NOT NULL DEFAULT 5,
|
||||
`active_count` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_user` (`user_id`),
|
||||
KEY `idx_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesupport_canned_responses` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`body` TEXT NOT NULL,
|
||||
`category` VARCHAR(100) NOT NULL DEFAULT '',
|
||||
`shortcut` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
`published` TINYINT NOT NULL DEFAULT 1,
|
||||
`ordering` INT NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_category` (`category`),
|
||||
KEY `idx_shortcut` (`shortcut`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
@@ -0,0 +1,8 @@
|
||||
--
|
||||
-- MokoSuite Support — Uninstall
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `#__mokosuitesupport_canned_responses`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesupport_agents`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesupport_messages`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesupport_conversations`;
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Moko\Plugin\System\MokoSuiteSupport\Extension;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
class Support extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onBeforeRender' => 'injectChatWidget',
|
||||
];
|
||||
}
|
||||
|
||||
public function injectChatWidget(): void
|
||||
{
|
||||
$app = $this->getApplication();
|
||||
|
||||
if (!$app->isClient('site') || !(int) $this->params->get('enable_chat_widget', 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Chat widget injection will be implemented when frontend assets are built
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user