site-kit-wp
site-kit-wp copied to clipboard
Show modal before disabling Email reporting in admin settings
Feature Description
Secondary CTA cancel closes modal, leaving settings unchanged, and Disable - primary CTA disables the settings and closes the modal
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When Email reporting is enabled in Settings, clicking the enable/disable toggle opens a confirmation modal before disabling.
- Modal title shows: “Are you sure you want to disable email reports?”
- Modal content: “Disabling email reports will pause sending email reports for all subscribed users. You can manage your subscription in your email report settings.”
- Clicking on the
email report settingslink opens Email Reporting side panel - Learn more link TBD
- Clicking on the
- Modal actions:
Cancel(secondary) closes the modal and leaves the setting enabledDisable(primary) closes the modal and disables email reporting (saving the change).
- When Email reporting is currently disabled, toggling it on behaves as before (enables immediately, no modal)
- Modal should match design and copy from Figma design
Implementation Brief
- Update
assets/js/components/settings/SettingsEmailReporting.js:- Add local state to control a disable confirmation modal.
- In the toggle handler (
handleToggle), ifisEnabledistrueopen the modal instead of immediately toggling; iffalse, keep existing enable flow. - Conditionally render a
ModalDialogwith the title, description, and button labels as specified in AC (unless changed in Figma, then use updated content);- Use
dangerprop for the disable action. - Use
createInterpolateElementwithLink(or equivalent) so the "email report settings" text setsUSER_SETTINGS_SELECTION_PANEL_OPENED_KEYto open the side panel.
- Use
- On "Disable," call
setEmailReportingEnabled( false ), thensaveEmailReportingSettings(), then close the modal - On "Cancel," just close and leave the toggle state unchanged.
- Add
assets/sass/components/settings/_googlesitekit-settings-email-reporting-modal.scssfor any styling updates if needed
Test Coverage
- Extend
assets/js/components/settings/SettingsEmailReporting.test.jsto cover:- When enabled and toggle clicked, modal appears; cancel leaves enabled.
- When enabled and confirm disable clicked,
setEmailReportingEnabled(false)andsaveEmailReportingSettingsare called, and the modal closes. - "email report settings" link triggers opening the side panel (UI key/query arg is set).