| @@ -46,13 +46,8 @@ | ||
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | $currentUser = wp_get_current_user(); |
| 49 | 49 | |
| 50 | - // get subscription activation status | |
| 51 | - $activationStatus = \Depicter::options()->get('subscription_status', 'not-activated'); | |
| 52 | - $activationError = \Depicter::options()->get('activation_error_message', ''); | |
| 53 | - $activationStatus = ( 'activated' !== $activationStatus ) && ! empty( $activationError ) ? 'error': $activationStatus; | |
| 54 | - | |
| 55 | 50 | // Add Environment variables |
| 56 | 51 | wp_add_inline_script( 'depicter-editor-vendors', 'window.depicterEnv = '. JSON::encode( |
| 57 | 52 | [ |
| 58 | 53 | 'wpVersion' => $wp_version, |
| @@ -57,10 +52,11 @@ | ||
| 57 | 52 | [ |
| 58 | 53 | 'wpVersion' => $wp_version, |
| 59 | 54 | "scriptsPath" => \Depicter::core()->assets()->getUrl(). '/resources/scripts/editor/', |
| 60 | 55 | 'pluginAPI' => admin_url( 'admin-ajax.php' ), |
| 61 | - 'clientKey' => \Depicter::options()->get( 'client_key', 'anon' ), | |
| 56 | + 'clientKey' => \Depicter::auth()->getClientKey(), | |
| 62 | 57 | 'csrfToken' => \Depicter::csrf()->getToken( CSRF::EDITOR_ACTION ), |
| 58 | + 'wpHomepage' => home_url(), | |
| 63 | 59 | 'updateInfo' => [ |
| 64 | 60 | 'from' => \Depicter::options()->get('version_previous') ?: null, |
| 65 | 61 | 'to' => \Depicter::options()->get('version') |
| 66 | 62 | ], |
| @@ -68,16 +64,16 @@ | ||
| 68 | 64 | "wpRestAPI" => Escape::url( get_rest_url() ), |
| 69 | 65 | "dashboardURL"=> Escape::url( menu_page_url('depicter-dashboard', false) ), |
| 70 | 66 | "documentId" => Data::cast( Sanitize::key( $_GET['document'] ), 'int' ), |
| 71 | 67 | 'user' => [ |
| 72 | - 'tier' => \Depicter::options()->get('user_tier', 'free-user') ?: 'free-user', | |
| 68 | + 'tier' => \Depicter::auth()->getTier(), | |
| 73 | 69 | 'name' => Escape::html( $currentUser->display_name ), |
| 74 | 70 | 'email' => Escape::html( $currentUser->user_email ), |
| 75 | 71 | 'joinedNewsletter' => !! \Depicter::options()->get('has_subscribed') |
| 76 | 72 | ], |
| 77 | 73 | 'activation' => [ |
| 78 | - 'status' => $activationStatus, | |
| 79 | - 'errorMessage' => $activationError, | |
| 74 | + 'status' => \Depicter::auth()->getActivationStatus(), | |
| 75 | + 'errorMessage' => \Depicter::options()->get('activation_error_message', ''), | |
| 80 | 76 | 'expiresAt' => \Depicter::options()->get('subscription_expires_at' , ''), |
| 81 | 77 | 'isNew' => isset( $_GET['depicter_upgraded'] ) |
| 82 | 78 | ], |
| 83 | 79 | 'integrations' => [ |