Open techanvil opened 5 months ago
Looks like this is also blocked by a tile like #8136 being implemented, because adding a relatively concrete IB here isn't possible until those components are implemented so we know where they'll go. I looked through all of the issues to see if anything was moved along enough to add a good IB here but not yet, so I've added #8136 as another blocker to making the IB 🤔
Hey @benbowler, while reviewing the IB here I've realised I left an important detail out of the AC.
The "New" badges should only appear for audiences which have been created subsequent to the initial setup for the current user.
The implication is we should expire the corresponding "New" badge items for the list of audiences in configuredAudiences
once they have been successfully saved in the enableAudienceGroup()
action
It further implies we should do the same thing once configuredAudiences
has been saved as part of the setup for a secondary user. This is being specced in https://github.com/google/site-kit-wp/issues/8130, as a result I've added that issue as a dependency for this one.
Apologies for the lack of clarity in the AC. I've amended it accordingly - please take a look.
Further to the above, here are a couple of additional points for this IB:
displayName
as the display name is mutable.
- [ ] Also, prevent the badge from being rendered if the the title is either of the pre-defined audiences "All visitors" or "Returning visitors" using simple string comparison.
audience-selector-new-audience-expirable-new-badge-${slug}
which contains "new" twice, the repetition of which feels somewhat redundant, how about audience-selection-panel-expirable-new-badge-${slug}
?Thanks @benbowler. The IB LGTM :white_check_mark:
Please note, I made a small tweak to remove the reference to enableAudienceGroup()
for the secondary users aspect, as I don't think we will end up using this action for secondary users, rather we'll extract part of it to a new action and use that.
Feature Description
Add the "New" badge to new audiences in the Selection Panel.
See selection panel, audience creation > "New" badges", and "New" badges in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
Note: This should make use of the "expirable items" API introduced via #8168.
assets/js/components/SelectionPanel/SelectionPanelItem.js
:hasExpirableItem
selector, passing theaudience-selection-panel-expirable-new-badge-${slug}
as the expirable item slug.isExpirableItemActive
selector, passing theaudience-selection-panel-expirable-new-badge-${slug}
as the expirable item slug.NewBadge
component in the widget header if the badge has not been seen by the user before, or it has not yet expired.useEffect
in this component which calls thesetExpirableItemTimers
action, only if the user has never seen New badge before, and the title is not either of the pre-defined audiences , with the following object:Importing
WEEK_IN_SECONDS
fromassets/js/util/index.js
assets/js/modules/analytics-4/datastore/audiences.js
, once theconfiguredAudiences
are successfully saved, dispatch ansetExpirableItemTimers
action for everyconfiguredAudiences
using the slug, and passing a value of 0, which will expire these items immediately. This prevents new badges from being shown for all audiences immediately after user setup.configuredAudiences
is saved for the secondary user setup.Test Coverage
QA Brief
Changelog entry