diff --git a/modules/settings/assets/js/components/my-account-menu/index.js b/modules/settings/assets/js/components/my-account-menu/index.js index 0995398..d6425ca 100644 --- a/modules/settings/assets/js/components/my-account-menu/index.js +++ b/modules/settings/assets/js/components/my-account-menu/index.js @@ -18,11 +18,12 @@ import { CreditCardIcon, UserArrowIcon } from '@ea11y/icons'; import { __ } from '@wordpress/i18n'; const MyAccountMenu = () => { - const { openSidebar } = useSettings(); + const { openSidebar, planData } = useSettings(); const accountMenuState = usePopupState({ variant: 'popover', popupId: 'myAccountMenu', }); + console.log(planData); return ( <> @@ -68,7 +69,7 @@ const MyAccountMenu = () => { Jack Baueuer - jack@bauer.com + {planData?.user?.email} diff --git a/modules/settings/assets/js/hooks/use-settings.js b/modules/settings/assets/js/hooks/use-settings.js index 2f21c42..1e079b9 100644 --- a/modules/settings/assets/js/hooks/use-settings.js +++ b/modules/settings/assets/js/hooks/use-settings.js @@ -36,6 +36,8 @@ export const SettingsProvider = ({ children }) => { }, }); + const [planData, setPlanData] = useState(null); + // Track settings changes to enable/disable Save Changes button const [hasChanges, setHasChanges] = useState(false); const [hideMinimumOptionAlert, setHideMinimumOptionAlert] = useState(false); @@ -99,6 +101,8 @@ export const SettingsProvider = ({ children }) => { setIconDesign, hasChanges, setHasChanges, + planData, + setPlanData, }} > {children} diff --git a/modules/settings/module.php b/modules/settings/module.php index 4a68ace..3ff7e79 100644 --- a/modules/settings/module.php +++ b/modules/settings/module.php @@ -180,6 +180,15 @@ public function register_settings(): void { ], ] ], + 'plan_data' => [ + 'type' => 'object', + 'show_in_rest' => [ + 'schema' => [ + 'type' => 'object', + 'additionalProperties' => true + ], + ] + ], 'close_post_connect_modal' => [ 'type' => 'boolean', ],