diff --git a/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.ini b/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.ini new file mode 100644 index 0000000..d388334 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.ini @@ -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." diff --git a/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.sys.ini b/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.sys.ini new file mode 100644 index 0000000..d388334 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/language/en-GB/plg_system_mokosuitesupport.sys.ini @@ -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." diff --git a/source/packages/plg_system_mokosuitesupport/mokosuitesupport.xml b/source/packages/plg_system_mokosuitesupport/mokosuitesupport.xml new file mode 100644 index 0000000..4288d06 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/mokosuitesupport.xml @@ -0,0 +1,49 @@ + + + System - MokoSuite Support + mokosuitesupport + Moko Consulting + 2026-06-22 + Copyright (C) 2026 Moko Consulting. All rights reserved. + GPL-3.0-or-later + hello@mokoconsulting.tech + https://mokoconsulting.tech + 01.00.00 + 8.3 + PLG_SYSTEM_MOKOSUITESUPPORT_DESC + Moko\Plugin\System\MokoSuiteSupport + + src + services + language + sql + + + en-GB/plg_system_mokosuitesupport.ini + en-GB/plg_system_mokosuitesupport.sys.ini + + sql/install.mysql.sql + sql/uninstall.mysql.sql + + +
+ + + + + + + + + + +
+
+ + + + +
+
+
+
diff --git a/source/packages/plg_system_mokosuitesupport/services/provider.php b/source/packages/plg_system_mokosuitesupport/services/provider.php new file mode 100644 index 0000000..9320b72 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/services/provider.php @@ -0,0 +1,27 @@ +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; + } + ); + } +}; diff --git a/source/packages/plg_system_mokosuitesupport/sql/install.mysql.sql b/source/packages/plg_system_mokosuitesupport/sql/install.mysql.sql new file mode 100644 index 0000000..eb7f40e --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/sql/install.mysql.sql @@ -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; diff --git a/source/packages/plg_system_mokosuitesupport/sql/uninstall.mysql.sql b/source/packages/plg_system_mokosuitesupport/sql/uninstall.mysql.sql new file mode 100644 index 0000000..5b334f4 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/sql/uninstall.mysql.sql @@ -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`; diff --git a/source/packages/plg_system_mokosuitesupport/src/Extension/Support.php b/source/packages/plg_system_mokosuitesupport/src/Extension/Support.php new file mode 100644 index 0000000..5c97678 --- /dev/null +++ b/source/packages/plg_system_mokosuitesupport/src/Extension/Support.php @@ -0,0 +1,31 @@ + '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 + } +}