From c089b49b38a8bd93ccbcb9448da53ef42f89b354 Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Tue, 13 Oct 2020 13:05:06 +1300 Subject: [PATCH] Navigation: Prep feature flags and option (https://github.com/woocommerce/woocommerce-admin/pull/5292) * add feature flag * hydrate options on embedded screens * is_feature_enabled * feature class * feedback * better name * fix --- .../woocommerce-admin/client/layout/index.js | 28 +++++++----- plugins/woocommerce-admin/config/core.json | 3 +- .../woocommerce-admin/config/development.json | 3 +- plugins/woocommerce-admin/config/plugin.json | 3 +- .../src/Features/Navigation.php | 45 +++++++++++++++++++ 5 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 plugins/woocommerce-admin/src/Features/Navigation.php diff --git a/plugins/woocommerce-admin/client/layout/index.js b/plugins/woocommerce-admin/client/layout/index.js index e36c09b33b4..fb7acdbb198 100644 --- a/plugins/woocommerce-admin/client/layout/index.js +++ b/plugins/woocommerce-admin/client/layout/index.js @@ -222,15 +222,19 @@ export const PageLayout = compose( : identity )( _PageLayout ); -export class EmbedLayout extends Component { - render() { - return ( - - ); - } -} +const _EmbedLayout = () => ( + +); + +export const EmbedLayout = compose( + window.wcSettings.preloadOptions + ? withOptionsHydration( { + ...window.wcSettings.preloadOptions, + } ) + : identity +)( _EmbedLayout ); diff --git a/plugins/woocommerce-admin/config/core.json b/plugins/woocommerce-admin/config/core.json index c083ae1eeef..7327492be58 100644 --- a/plugins/woocommerce-admin/config/core.json +++ b/plugins/woocommerce-admin/config/core.json @@ -13,6 +13,7 @@ "store-alerts": true, "minified-js": false, "wcpay": true, - "mobile-app-banner": true + "mobile-app-banner": true, + "navigation": false } } diff --git a/plugins/woocommerce-admin/config/development.json b/plugins/woocommerce-admin/config/development.json index 725b7594a80..8ae6e110b4a 100644 --- a/plugins/woocommerce-admin/config/development.json +++ b/plugins/woocommerce-admin/config/development.json @@ -13,6 +13,7 @@ "store-alerts": true, "minified-js": true, "wcpay": true, - "mobile-app-banner": true + "mobile-app-banner": true, + "navigation": true } } diff --git a/plugins/woocommerce-admin/config/plugin.json b/plugins/woocommerce-admin/config/plugin.json index 37b1729f07f..38a95129c19 100644 --- a/plugins/woocommerce-admin/config/plugin.json +++ b/plugins/woocommerce-admin/config/plugin.json @@ -13,6 +13,7 @@ "store-alerts": true, "minified-js": true, "wcpay": true, - "mobile-app-banner": true + "mobile-app-banner": true, + "navigation": false } } diff --git a/plugins/woocommerce-admin/src/Features/Navigation.php b/plugins/woocommerce-admin/src/Features/Navigation.php new file mode 100644 index 00000000000..faa3e35bece --- /dev/null +++ b/plugins/woocommerce-admin/src/Features/Navigation.php @@ -0,0 +1,45 @@ +