diff --git a/chatwoot/README.md b/chatwoot/README.md new file mode 100644 index 00000000..9e65b38c --- /dev/null +++ b/chatwoot/README.md @@ -0,0 +1,12 @@ +# Chatwoot Widget (by Boy132) + +Adds a Chatwoot live chat widget to all panels for real-time customer support. + +## Features + +- Chatwoot live chat integration +- Configurable through plugin settings + +## Credits + +Original Tawk.to widget by Boy132. Edited by Philip E to work with Chatwoot. diff --git a/chatwoot/config/chatwoot.php b/chatwoot/config/chatwoot.php new file mode 100644 index 00000000..9995ac01 --- /dev/null +++ b/chatwoot/config/chatwoot.php @@ -0,0 +1,6 @@ + env('CHATWOOT_BASE_URL'), + 'website_token' => env('CHATWOOT_WEBSITE_TOKEN'), +]; diff --git a/chatwoot/plugin.json b/chatwoot/plugin.json new file mode 100644 index 00000000..fbaae987 --- /dev/null +++ b/chatwoot/plugin.json @@ -0,0 +1,15 @@ +{ + "id": "chatwoot", + "name": "Chatwoot", + "author": "Boy132 (edited by Philip E)", + "version": "1.0.0", + "description": "Adds a Chatwoot widget to all panels", + "category": "plugin", + "url": "https://github.com/pelican-dev/plugins/tree/main/chatwoot", + "update_url": null, + "namespace": "Boy132\\Chatwoot", + "class": "ChatwootPlugin", + "panels": null, + "panel_version": null, + "composer_packages": null +} \ No newline at end of file diff --git a/chatwoot/src/ChatwootPlugin.php b/chatwoot/src/ChatwootPlugin.php new file mode 100644 index 00000000..8779314a --- /dev/null +++ b/chatwoot/src/ChatwootPlugin.php @@ -0,0 +1,47 @@ +label('Base URL') + ->required() + ->default(fn () => config('chatwoot.base_url')), + TextInput::make('website_token') + ->label('Website Token') + ->required() + ->default(fn () => config('chatwoot.website_token')), + ]; + } + + public function saveSettings(array $data): void { + $this->writeToEnvironment([ + 'CHATWOOT_BASE_URL' => $data['base_url'], + 'CHATWOOT_WEBSITE_TOKEN' => $data['website_token'], + ]); + + Notification::make() + ->title('Settings saved') + ->success() + ->send(); + } +} diff --git a/chatwoot/src/Providers/ChatwootPluginProvider.php b/chatwoot/src/Providers/ChatwootPluginProvider.php new file mode 100644 index 00000000..8102b8af --- /dev/null +++ b/chatwoot/src/Providers/ChatwootPluginProvider.php @@ -0,0 +1,44 @@ + Blade::render(<<<'HTML' + + + + HTML, [ + 'baseUrl' => $baseUrl, + 'websiteToken' => $websiteToken, + ]) + ); + } + } +}