| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Announcements; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Base\App as BaseApp; |
| 6 | +use Elementor\Modules\Ai\Preferences; | |
| 6 | 7 | use Elementor\Modules\Announcements\Classes\Announcement; |
| 7 | 8 | use Elementor\Settings as ElementorSettings; |
| 8 | 9 | |
| 9 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -93,10 +94,42 @@ | ||
| 93 | 94 | */ |
| 94 | 95 | private function get_raw_announcements(): array { |
| 95 | 96 | $raw_announcements = []; |
| 96 | 97 | |
| 98 | + if ( Preferences::is_ai_enabled( get_current_user_id() ) ) { | |
| 99 | + $raw_announcements[] = $this->get_ai_announcement_data(); | |
| 100 | + } | |
| 101 | + | |
| 97 | 102 | // DO NOT USE THIS FILTER |
| 98 | 103 | return apply_filters( 'elementor/announcements/raw_announcements', $raw_announcements ); |
| 104 | + } | |
| 105 | + | |
| 106 | + private function get_ai_announcement_data(): array { | |
| 107 | + return [ | |
| 108 | + 'title' => __( 'Discover your new superpowers ', 'elementor' ), | |
| 109 | + 'description' => __( '<p>With AI for text, code, image generation and editing, you can bring your vision to life faster than ever. Start your free trial now - <b>no credit card required!</b></p>', 'elementor' ), | |
| 110 | + 'media' => [ | |
| 111 | + 'type' => 'image', | |
| 112 | + 'src' => ELEMENTOR_ASSETS_URL . 'images/announcement.png?' . ELEMENTOR_VERSION, | |
| 113 | + ], | |
| 114 | + 'cta' => [ | |
| 115 | + [ | |
| 116 | + 'label' => __( 'Let\'s do it', 'elementor' ), | |
| 117 | + 'variant' => 'primary', | |
| 118 | + 'target' => '_top', | |
| 119 | + 'url' => '#welcome-ai', | |
| 120 | + ], | |
| 121 | + [ | |
| 122 | + 'label' => __( 'Skip', 'elementor' ), | |
| 123 | + 'variant' => 'secondary', | |
| 124 | + ], | |
| 125 | + ], | |
| 126 | + 'triggers' => [ | |
| 127 | + [ | |
| 128 | + 'action' => 'aiStarted', | |
| 129 | + ], | |
| 130 | + ], | |
| 131 | + ]; | |
| 99 | 132 | } |
| 100 | 133 | |
| 101 | 134 | /** |
| 102 | 135 | * Retrieve all announcement objects. |