| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Isolation\Elementor_Adapter; |
| 6 | 6 | use Elementor\Core\Isolation\Elementor_Adapter_Interface; |
| 7 | 7 | use Elementor\Core\Utils\Assets_Config_Provider; |
| 8 | +use Elementor\Modules\AtomicWidgets\OptIn\Opt_In as Atomic_Widgets_Opt_In; | |
| 8 | 9 | use Elementor\Modules\ElementorCounter\Module as Elementor_Counter; |
| 9 | 10 | use Elementor\Core\Upgrade\Manager as Upgrade_Manager; |
| 10 | 11 | use Elementor\Utils; |
| 11 | 12 | |
| @@ -22,8 +23,12 @@ | ||
| 22 | 23 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'maybe_enqueue_welcome_popover' ] ); |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | public function maybe_enqueue_welcome_popover(): void { |
| 27 | + if ( ! $this->was_opt_in_clicked() ) { | |
| 28 | + return; | |
| 29 | + } | |
| 30 | + | |
| 26 | 31 | if ( $this->is_first_or_second_editor_visit() ) { |
| 27 | 32 | return; |
| 28 | 33 | } |
| 29 | 34 | |
| @@ -38,8 +43,12 @@ | ||
| 38 | 43 | $this->register_package(); |
| 39 | 44 | wp_enqueue_script( 'elementor-v2-' . self::PACKAGE_NAME ); |
| 40 | 45 | wp_set_script_translations( 'elementor-v2-' . self::PACKAGE_NAME, 'elementor' ); |
| 41 | 46 | $this->set_welcome_popover_as_displayed(); |
| 47 | + } | |
| 48 | + | |
| 49 | + private function was_opt_in_clicked(): bool { | |
| 50 | + return (bool) get_option( Atomic_Widgets_Opt_In::OPT_IN_CLICKED_OPTION ); | |
| 42 | 51 | } |
| 43 | 52 | |
| 44 | 53 | private function is_first_or_second_editor_visit(): bool { |
| 45 | 54 | if ( ! $this->elementor_adapter ) { |