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

Refactor `CoreSiteBannerNotifications` to use the new Notifications datastore

Open zutigrm opened this issue 1 year ago • 4 comments

Feature Description

This issue should refactor CoreSiteBannerNotifications so that it uses the new datastore infrastructure to register and queue the notification. It should also incorporate a new "layout".


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The CoreSiteBannerNotifications component should be refactored so that it is registered and rendered (queued) using the new core/notifications datastore.
  • This notification component should not be called directly (i.e. in BannerNotifications) but only via the generic getQueuedNotifications selector.
  • The refactored component should not contain any business logic that hides it / prevents it from rendering. This logic should be contained in a callback function defined during registration.
  • The component should not use the bloated BannerNotification component. Instead, it should be rendered using the new Notification component wrapper and a simpler "layout" component that solely encapsulates its structure and design.

Implementation Brief

  • [ ]

Test Coverage

QA Brief

Changelog entry

zutigrm avatar Sep 04 '24 12:09 zutigrm

AC ✔️

eugene-manuilov avatar Sep 09 '24 13:09 eugene-manuilov

Morning @jimmymadon looking at the purpose of the CoreSiteBannerNotifications component, I have a few questions as it's not a standard notification.

It is related to the core/site notifications store assets/js/googlesitekit/data/create-notifications-store.js. I looked into this store and I can't see any calls to addNotification in the code base any more.

Should we consider removing this legacy store and components as part of this ticket?

benbowler avatar Oct 24 '24 09:10 benbowler

CC @eugene-manuilov @aaemnnosttv, do you agree we can remove the legacy assets/js/googlesitekit/data/create-notifications-store.js createNotificationsStore as the core of this ticket or are there other elements of the app that I missed that require this infrastructure?

benbowler avatar Oct 24 '24 09:10 benbowler

Looking at the IB for #9300, the AdSense module implements the module level notification store to handle AdSense notifications in the AdSenseAlerts component. This means that createNotification store cannot immediately be removed without refactoring this and other uses of the notification store within modules.

benbowler avatar Oct 24 '24 10:10 benbowler

Removing my assignment incase anyone else want to take up this discussions while I'm out but there are some outstanding questions to get this implemented.

benbowler avatar Nov 05 '24 07:11 benbowler

Having discussed this and #9300 with @aaemnnosttv, we decided to hold off on these issues to prevent "nested" queues of notifications. This is because these notification components call a getNotifications selector which fetches one or more notifications and maps through them to render them. We might be better off creating these as "on-demand" notifications and so, we will wait till #9453 is completed first before we amend the AC/IB here.

jimmymadon avatar Mar 12 '25 14:03 jimmymadon

Estimate here is high because it will involve test removal and triggering server notifications for testing/QA. The engineering effort involved is likely a bit closer to a 7. 🤔

tofumatt avatar Jun 12 '25 03:06 tofumatt

@tofumatt, let's be more specific as to what we need to do in IB. Which core notifications should be added and where exactly? Please, update IB to have enough details to understand how we need to implement this ticket.

eugene-manuilov avatar Jun 12 '25 12:06 eugene-manuilov

@eugene-manuilov The core notifications that will be registered aren't specific, since they're server notifications that are sent from the service.

I've updated the IB, but we're essentially changing the creation of notification components from notifications.map to using registerNotification.

But you're right we'll want to create a ServerNotification component I didn't mention, so I've added that to the IB 👍🏻

tofumatt avatar Jun 12 '25 13:06 tofumatt

Thanks, @tofumatt. IB ✔

eugene-manuilov avatar Jun 16 '25 14:06 eugene-manuilov

QA Update ❌

  • Tested on dev environment.
  • Verified and compared notification behaviour and design with latest environment.

@tofumatt

Issue > On the dev environment, an additional margin is being applied to the notice title. As a result, unnecessary extra space is appearing above and below the title.

Latest

Image

Dev -

Image

mohitwp avatar Jul 08 '25 07:07 mohitwp

The margins there aren't additional, they seem to be standard margins set in our styles, but the top margins do seem a bit much. I've adjusted them to look a bit less awkward re: top margins. But the bottom ones should remain:

Image

tofumatt avatar Jul 08 '25 15:07 tofumatt

QA Update ✅

  • Tested on dev environment.
  • Verified and compared notification behaviour and design with latest environment.
  • Verified that notification getting dismiss when we click on the CTA's.
  • Verified that Confirm and dismiss notification GA4 events are getting track when we click on the CTA's.
  • Verified that above reported issue is resolved now.
Image

https://github.com/user-attachments/assets/90fd666f-c8bc-4bc1-b091-ec33450e9f82

mohitwp avatar Jul 09 '25 02:07 mohitwp