Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats Admin: site plan and products #31663

Merged
merged 3 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Stats Admin: add plan and product for site
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"autotagger": true,
"mirror-repo": "Automattic/jetpack-stats-admin",
"branch-alias": {
"dev-trunk": "0.11.x-dev"
"dev-trunk": "0.12.x-dev"
},
"textdomain": "jetpack-stats-admin",
"version-constants": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-stats-admin",
"version": "0.11.0",
"version": "0.12.0-alpha",
"description": "Stats Dashboard",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/stats-admin/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Main {
/**
* Stats version.
*/
const VERSION = '0.11.0';
const VERSION = '0.12.0-alpha';

/**
* Singleton Main instance.
Expand Down
21 changes: 16 additions & 5 deletions projects/packages/stats-admin/src/class-odyssey-config-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public function get_js_config_data( $config_variable_name = 'configData', $confi
public function get_data() {
global $wp_version;

$blog_id = Jetpack_Options::get_option( 'id' );
$empty_object = json_decode( '{}' );
$host = new Host();
$blog_id = Jetpack_Options::get_option( 'id' );
$host = new Host();

return array(
'admin_page_base' => $this->get_admin_path(),
Expand Down Expand Up @@ -81,8 +80,8 @@ public function get_data() {
'jetpack' => true,
'visible' => true,
'capabilities' => $this->get_current_user_capabilities(),
'products' => array(),
'plan' => $empty_object, // we need this empty object, otherwise the front end would crash on insight page.
'products' => Jetpack_Plan::get_products(),
'plan' => $this->get_plan(),
'options' => array(
'wordads' => ( new Modules() )->is_active( 'wordads' ),
'admin_url' => admin_url(),
Expand Down Expand Up @@ -178,6 +177,18 @@ protected function get_plan_features() {
return $plan['features'];
}

/**
* Get the current plan.
*
* @return array
*/
protected function get_plan() {
$plan = Jetpack_Plan::get();
unset( $plan['features'] );
unset( $plan['supports'] );
return $plan;
}

/**
* Get the capabilities of the current user.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading