site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Show modal before disabling Email reporting in admin settings

Open benbowler opened this issue 1 month ago • 2 comments

Feature Description

Image

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 settings link opens Email Reporting side panel
      • Learn more link TBD
  • Modal actions:
    • Cancel (secondary) closes the modal and leaves the setting enabled
    • Disable (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), if isEnabled is true open the modal instead of immediately toggling; if false, keep existing enable flow.
    • Conditionally render a ModalDialog with the title, description, and button labels as specified in AC (unless changed in Figma, then use updated content);
      • Use danger prop for the disable action.
      • Use createInterpolateElement with Link (or equivalent) so the "email report settings" text sets USER_SETTINGS_SELECTION_PANEL_OPENED_KEY to open the side panel.
    • On "Disable," call setEmailReportingEnabled( false ), then saveEmailReportingSettings(), then close the modal
    • On "Cancel," just close and leave the toggle state unchanged.
  • Add assets/sass/components/settings/_googlesitekit-settings-email-reporting-modal.scss for any styling updates if needed

Test Coverage

  • Extend assets/js/components/settings/SettingsEmailReporting.test.js to cover:
    • When enabled and toggle clicked, modal appears; cancel leaves enabled.
    • When enabled and confirm disable clicked, setEmailReportingEnabled(false) and saveEmailReportingSettings are called, and the modal closes.
    • "email report settings" link triggers opening the side panel (UI key/query arg is set).

QA Brief

Changelog entry

benbowler avatar Nov 27 '25 16:11 benbowler