Skip to content

Commit

Permalink
Stats Admin: site plan and products (#31663)
Browse files Browse the repository at this point in the history
* [not verified] support plan and products for odyssey

* [not verified] changelog

* fix up project versions
  • Loading branch information
kangzj authored Jul 4, 2023
1 parent d4b9a58 commit 591e06f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
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.

0 comments on commit 591e06f

Please sign in to comment.