| @@ -3,9 +3,8 @@ | ||
| 3 | 3 | namespace Elementor\Core\Common\Modules\EventsManager; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 6 | use Elementor\Core\Common\Modules\Connect\Apps\Base_App; |
| 7 | -use Elementor\Core\Common\Modules\Connect\Apps\Common_App; | |
| 8 | 7 | use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 9 | 8 | use Elementor\Includes\EditorAssetsAPI; |
| 10 | 9 | use Elementor\Utils; |
| 11 | 10 | use Elementor\Plugin; |
| @@ -17,9 +16,9 @@ | ||
| 17 | 16 | |
| 18 | 17 | class Module extends BaseModule { |
| 19 | 18 | |
| 20 | 19 | const EXPERIMENT_NAME = 'editor_events'; |
| 21 | - const DEFAULT_SESSION_RECORDING_PERCENT = 0; | |
| 20 | + | |
| 22 | 21 | const REMOTE_MIXPANEL_CONFIG_URL = 'https://assets.elementor.com/mixpanel/v1/mixpanel.json'; |
| 23 | 22 | |
| 24 | 23 | public function get_name() { |
| 25 | 24 | return 'events-manager'; |
| @@ -31,26 +30,18 @@ | ||
| 31 | 30 | ! Tracker::has_terms_changed( '2025-07-07' ) && |
| 32 | 31 | Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ); |
| 33 | 32 | |
| 34 | 33 | $is_flags_enabled = false; |
| 35 | - $session_recording_percent = self::DEFAULT_SESSION_RECORDING_PERCENT; | |
| 36 | - $debug = ( defined( 'ELEMENTOR_EDITOR_EVENTS_DEBUG' ) && ELEMENTOR_EDITOR_EVENTS_DEBUG ) ?? false; | |
| 37 | 34 | |
| 38 | 35 | if ( $can_send_events ) { |
| 39 | 36 | $mixpanel_config = self::get_remote_mixpanel_config(); |
| 40 | - $has_config = EditorAssetsAPI::has_valid_nested_array( $mixpanel_config, [ 0 ] ); | |
| 41 | - | |
| 42 | - if ( $has_config ) { | |
| 43 | - $is_flags_enabled = (bool) ( $mixpanel_config[0]['flags'] ?? false ); | |
| 44 | - | |
| 45 | - $session_replays = $mixpanel_config[0]['sessionReplays'] ?? []; | |
| 46 | - $session_recording_percent = $session_replays['recordSessionsPercent'] ?? null; | |
| 47 | - } | |
| 37 | + $is_flags_enabled = EditorAssetsAPI::has_valid_nested_array( $mixpanel_config, [ 0 ] ) | |
| 38 | + ? (bool) ( $mixpanel_config[0]['flags'] ?? false ) | |
| 39 | + : false; | |
| 48 | 40 | } |
| 49 | 41 | |
| 50 | 42 | $settings = [ |
| 51 | 43 | 'can_send_events' => $can_send_events, |
| 52 | - 'debug' => $debug, | |
| 53 | 44 | 'elementor_version' => ELEMENTOR_VERSION, |
| 54 | 45 | 'site_url' => hash( 'sha256', get_site_url() ), |
| 55 | 46 | 'wp_version' => get_bloginfo( 'version' ), |
| 56 | 47 | 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ), |
| @@ -59,10 +50,8 @@ | ||
| 59 | 50 | 'subscription_id' => self::get_subscription_id(), |
| 60 | 51 | 'subscription' => self::get_subscription(), |
| 61 | 52 | 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN, |
| 62 | 53 | 'flags_enabled' => $is_flags_enabled, |
| 63 | - 'user_id' => self::get_user_id(), | |
| 64 | - 'session_recording_percent' => $session_recording_percent, | |
| 65 | 54 | ]; |
| 66 | 55 | |
| 67 | 56 | return $settings; |
| 68 | 57 | } |
| @@ -108,15 +97,6 @@ | ||
| 108 | 97 | EditorAssetsAPI::ASSETS_DATA_KEY => 'mixpanel', |
| 109 | 98 | ] ); |
| 110 | 99 | |
| 111 | 100 | return $editor_assets_api->get_assets_data(); |
| 112 | - } | |
| 113 | - private static function get_user_id() { | |
| 114 | - $user_common_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY ); | |
| 115 | - | |
| 116 | - if ( ! is_array( $user_common_data ) ) { | |
| 117 | - return null; | |
| 118 | - } | |
| 119 | - | |
| 120 | - return Common_App::get_connect_user_id_from_access_token( $user_common_data['access_token'] ?? null ); | |
| 121 | 101 | } |
| 122 | 102 | } |