File size: 1,390 Bytes
78185c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

/**
 * Matomo - free/libre analytics platform
 *
 * @link    https://matomo.org
 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

declare(strict_types=1);

namespace Piwik\Plugins\BotTracking\Widgets;

use Piwik\Widget\Widget;
use Piwik\Widget\WidgetConfig;

class NoRecentRequests extends Widget
{
    public static function configure(WidgetConfig $config)
    {
        self::configureMessageWidget($config, 'BotTracking_AIChatbotsOverview', 'noRecentRequestsMessage');
    }

    /**
     * Shared config for the "no recent AI bot requests" message. It tops each AI Chatbots page as
     * its own widget; the showNoRecentRequestsMessage middleware hides it once recent requests exist.
     */
    public static function configureMessageWidget(WidgetConfig $config, string $subcategoryId, string $action): void
    {
        $config
            ->setName('BotTracking_NoRecentRequestsWidgetTitle')
            ->setCategoryId('General_AIAssistants')
            ->setSubcategoryId($subcategoryId)
            ->setModule('BotTracking')
            ->setAction($action)
            ->setClientSideComponent('BotTracking', 'NoRecentRequestsWidget')
            ->setMiddlewareParameters(['module' => 'BotTracking', 'action' => 'showNoRecentRequestsMessage'])
            ->setIsWide()
            ->setOrder(0)
            ->setIsNotWidgetizable();
    }
}