Add all files

This commit is contained in:
root
2025-11-30 11:57:22 +01:00
parent 2ee51cac4f
commit 044271db3d
1476 changed files with 142544 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -0,0 +1,98 @@
<?php
namespace Paymenter\Extensions\Others\JivoChat;
use App\Classes\Extension\Extension;
class JivoChat extends Extension
{
public function getName(): string
{
return 'JivoChat Live Chat';
}
public function getDescription(): string
{
return 'Integrates JivoChat live chat widget into your site for real-time customer support.';
}
public function getVersion(): string
{
return '1.0';
}
public function getAuthor(): string
{
return 'QKingsoftware';
}
public function getConfig($values = []): array
{
return [
[
'name' => 'widget_id',
'type' => 'text',
'label' => 'JivoChat Widget ID',
'description' => 'Your JivoChat Widget ID (found in JivoChat settings).',
'required' => true,
'value' => $values['widget_id'] ?? '',
],
[
'name' => 'show_on_admin',
'type' => 'checkbox',
'label' => 'Show on Admin Panel',
'description' => 'Enable JivoChat widget on admin panel pages.',
'required' => false,
'value' => $values['show_on_admin'] ?? false,
],
];
}
public function boot(): void
{
if (!request()->isMethod('GET')) {
return;
}
// I dont like it on admin but it's your preference.....
if (request()->is('admin*') && !$this->config('show_on_admin', false)) {
return;
}
$this->injectJivoChat();
}
private function injectJivoChat(): void
{
if (!function_exists('app') || !app()->bound('view')) return;
echo $this->getJivoChatScript();
}
private function getJivoChatScript(): string
{
static $injected = false;
if ($injected) return '';
$injected = true;
$widgetId = $this->config('widget_id', '');
if (empty($widgetId)) {
return "<!-- JivoChat widget ID not configured -->";
}
return <<<HTML
<!-- JivoChat Itself -->
<script src="//code.jivo.ru/widget/$widgetId" async></script>
HTML;
}
public function enabled(): void {}
public function disabled(): void {}
public function updated(): void {}
public function install(): void
{
// Nothing
}
}