| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 6 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 7 | 7 | use Elementor\Core\Common\Modules\Connect\Apps\Library; |
| 8 | 8 | use Elementor\Core\Files\Uploads_Manager; |
| 9 | -use Elementor\Includes\EditorAssetsAPI; | |
| 10 | 9 | use Elementor\Plugin; |
| 11 | 10 | use Elementor\Utils; |
| 12 | 11 | use Plugin_Upgrader; |
| 13 | 12 | |
| @@ -26,16 +25,8 @@ | ||
| 26 | 25 | |
| 27 | 26 | const VERSION = '1.0.0'; |
| 28 | 27 | const ONBOARDING_OPTION = 'elementor_onboarded'; |
| 29 | 28 | |
| 30 | - const EXPERIMENT_EMPHASIZE_CONNECT_BENEFITS = 'emphasizeConnectBenefits101'; | |
| 31 | - const EXPERIMENT_OFFER_THEME_CHOICES_HELLO_BIZ = 'offerThemeChoicesHelloBiz201'; | |
| 32 | - const EXPERIMENT_EMPHASIZE_THEME_VALUE_AUDIENCE_202 = 'emphasizeThemeValueAudience202'; | |
| 33 | - const EXPERIMENT_UPDATE_COPY_VISUALS = 'updateCopyVisuals401'; | |
| 34 | - const EXPERIMENT_REDUCE_HIERARCHY_BLANK_OPTION = 'reduceHierarchyBlankOption402'; | |
| 35 | - | |
| 36 | - private ?API $editor_assets_api = null; | |
| 37 | - | |
| 38 | 29 | /** |
| 39 | 30 | * Get name. |
| 40 | 31 | * |
| 41 | 32 | * @since 3.6.0 |
| @@ -46,44 +37,8 @@ | ||
| 46 | 37 | public function get_name() { |
| 47 | 38 | return 'onboarding'; |
| 48 | 39 | } |
| 49 | 40 | |
| 50 | - private function is_experiment_enabled( string $experiment_key ) { | |
| 51 | - $editor_assets_api = $this->get_editor_assets_api(); | |
| 52 | - | |
| 53 | - if ( null === $editor_assets_api ) { | |
| 54 | - return false; | |
| 55 | - } | |
| 56 | - | |
| 57 | - return $editor_assets_api->is_experiment_enabled( $experiment_key ); | |
| 58 | - } | |
| 59 | - | |
| 60 | - private function is_hello_theme_activated(): bool { | |
| 61 | - $current_theme = get_option( 'template' ); | |
| 62 | - $hello_theme_variants = [ 'hello-elementor', 'hello-biz', 'hello-commerce', 'hello-theme' ]; | |
| 63 | - | |
| 64 | - return in_array( $current_theme, $hello_theme_variants, true ); | |
| 65 | - } | |
| 66 | - | |
| 67 | - private function get_editor_assets_api(): ?API { | |
| 68 | - if ( null !== $this->editor_assets_api ) { | |
| 69 | - return $this->editor_assets_api; | |
| 70 | - } | |
| 71 | - | |
| 72 | - $editor_assets_api_instance = new EditorAssetsAPI( $this->get_editor_assets_api_config() ); | |
| 73 | - $this->editor_assets_api = new API( $editor_assets_api_instance ); | |
| 74 | - | |
| 75 | - return $this->editor_assets_api; | |
| 76 | - } | |
| 77 | - | |
| 78 | - private function get_editor_assets_api_config(): array { | |
| 79 | - return [ | |
| 80 | - EditorAssetsAPI::ASSETS_DATA_URL => 'https://assets.elementor.com/ab-testing/v1/ab-testing.json', | |
| 81 | - EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_ab_testing_data', | |
| 82 | - EditorAssetsAPI::ASSETS_DATA_KEY => 'ab-testing', | |
| 83 | - ]; | |
| 84 | - } | |
| 85 | - | |
| 86 | 41 | /** |
| 87 | 42 | * Set Onboarding Settings |
| 88 | 43 | * |
| 89 | 44 | * Creates an array of module settings that is localized into the JS App config. |
| @@ -112,9 +67,8 @@ | ||
| 112 | 67 | $hello_theme_errors = is_object( $hello_theme->errors() ) ? $hello_theme->errors()->errors : []; |
| 113 | 68 | |
| 114 | 69 | /** @var Library $library */ |
| 115 | 70 | $library = Plugin::$instance->common->get_component( 'connect' )->get_app( 'library' ); |
| 116 | - $is_editor_one_active = Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ); | |
| 117 | 71 | |
| 118 | 72 | Plugin::$instance->app->set_settings( 'onboarding', [ |
| 119 | 73 | 'eventPlacement' => 'Onboarding wizard', |
| 120 | 74 | 'onboardingAlreadyRan' => get_option( self::ONBOARDING_OPTION ), |
| @@ -121,23 +75,15 @@ | ||
| 121 | 75 | 'onboardingVersion' => self::VERSION, |
| 122 | 76 | 'isLibraryConnected' => $library->is_connected(), |
| 123 | 77 | // Used to check if the Hello Elementor theme is installed but not activated. |
| 124 | 78 | 'helloInstalled' => empty( $hello_theme_errors['theme_not_found'] ), |
| 125 | - 'helloActivated' => $this->is_hello_theme_activated(), | |
| 79 | + 'helloActivated' => 'hello-elementor' === get_option( 'template' ), | |
| 126 | 80 | // The "Use Hello theme on my site" checkbox should be checked by default only if this condition is met. |
| 127 | 81 | 'helloOptOut' => count( $pages_and_posts->posts ) < 5, |
| 128 | 82 | 'siteName' => esc_html( $site_name ), |
| 129 | 83 | 'isUnfilteredFilesEnabled' => Uploads_Manager::are_unfiltered_uploads_enabled(), |
| 130 | - 'isEditorOneActive' => $is_editor_one_active, | |
| 131 | 84 | 'urls' => [ |
| 132 | - 'kitLibrary' => Plugin::$instance->app->get_base_url() . '&source=onboarding#/kit-library?order[direction]=desc&order[by]=featuredIndex', | |
| 133 | - 'sitePlanner' => add_query_arg( [ | |
| 134 | - 'type' => 'editor', | |
| 135 | - 'siteUrl' => esc_url( home_url() ), | |
| 136 | - 'siteName' => esc_html( $site_name ), | |
| 137 | - 'siteDescription' => esc_html( get_bloginfo( 'description' ) ), | |
| 138 | - 'siteLanguage' => get_locale(), | |
| 139 | - ], 'https://planner.elementor.com/onboarding.html' ), | |
| 85 | + 'kitLibrary' => Plugin::$instance->app->get_base_url() . '#/kit-library?order[direction]=desc&order[by]=featuredIndex', | |
| 140 | 86 | 'createNewPage' => Plugin::$instance->documents->get_create_new_post_url(), |
| 141 | 87 | 'connect' => $library->get_admin_url( 'authorize', [ |
| 142 | 88 | 'utm_source' => 'onboarding-wizard', |
| 143 | 89 | 'utm_campaign' => 'connect-account', |
| @@ -167,22 +113,8 @@ | ||
| 167 | 113 | 'downloadPro' => '?utm_source=onboarding-wizard&utm_campaign=my-account-subscriptions&utm_medium=wp-dash&utm_content=import-pro-plugin&utm_term=' . self::VERSION, |
| 168 | 114 | ], |
| 169 | 115 | 'nonce' => wp_create_nonce( 'onboarding' ), |
| 170 | 116 | 'experiment' => true, |
| 171 | - 'isExperiment101Enabled' => $this->is_experiment_enabled( self::EXPERIMENT_EMPHASIZE_CONNECT_BENEFITS ), | |
| 172 | - 'isExperiment201Enabled' => $this->is_experiment_enabled( self::EXPERIMENT_OFFER_THEME_CHOICES_HELLO_BIZ ), | |
| 173 | - 'isExperiment202Enabled' => $this->is_experiment_enabled( self::EXPERIMENT_EMPHASIZE_THEME_VALUE_AUDIENCE_202 ), | |
| 174 | - 'isExperiment401Enabled' => $this->is_experiment_enabled( self::EXPERIMENT_UPDATE_COPY_VISUALS ), | |
| 175 | - 'isExperiment402Enabled' => $this->is_experiment_enabled( self::EXPERIMENT_REDUCE_HIERARCHY_BLANK_OPTION ), | |
| 176 | - 'experimentNames' => [ | |
| 177 | - '101' => self::EXPERIMENT_EMPHASIZE_CONNECT_BENEFITS, | |
| 178 | - '201' => self::EXPERIMENT_OFFER_THEME_CHOICES_HELLO_BIZ, | |
| 179 | - '202' => self::EXPERIMENT_EMPHASIZE_THEME_VALUE_AUDIENCE_202, | |
| 180 | - '401' => self::EXPERIMENT_UPDATE_COPY_VISUALS, | |
| 181 | - '402' => self::EXPERIMENT_REDUCE_HIERARCHY_BLANK_OPTION, | |
| 182 | - ], | |
| 183 | - 'pageSubheading' => $is_editor_one_active ? __( 'Choose the capabilities you need to bring your vision to life', 'elementor' ) : __( 'Which Elementor Pro features do you need to bring your creative vision to life?', 'elementor' ), | |
| 184 | - 'pageHeading' => $is_editor_one_active ? __( ' Elevate your website with additional features.', 'elementor' ) : __( 'Elevate your website with additional Pro features.', 'elementor' ), | |
| 185 | 117 | ] ); |
| 186 | 118 | } |
| 187 | 119 | |
| 188 | 120 | /** |
| @@ -385,11 +317,9 @@ | ||
| 385 | 317 | if ( ! current_user_can( 'switch_themes' ) ) { |
| 386 | 318 | return $this->get_permission_error_response(); |
| 387 | 319 | } |
| 388 | 320 | |
| 389 | - $theme_slug = 'hello-elementor'; | |
| 390 | - | |
| 391 | - switch_theme( $theme_slug ); | |
| 321 | + switch_theme( 'hello-elementor' ); | |
| 392 | 322 | |
| 393 | 323 | return [ |
| 394 | 324 | 'status' => 'success', |
| 395 | 325 | 'payload' => [ |