-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move on-demand onboarding state synchronization to server side #9363
Labels
Module: RRM
Reader Revenue Manager module related issues
P1
Medium priority
Team M
Issues for Squad 2
Type: Enhancement
Improvement of an existing feature
Comments
nfmohit
added
P1
Medium priority
Type: Enhancement
Improvement of an existing feature
Team M
Issues for Squad 2
Module: RRM
Reader Revenue Manager module related issues
labels
Sep 16, 2024
6 tasks
AC ✅ |
IB ✅, thanks @techanvil! Just a note that I made an edit to correct the selector name from |
That's spot on @nfmohit, thanks for fixing the typo! |
19 tasks
QA Update ✅
Settings screen Recording.1623.mp4Main dashboard Recording.1624.mp4Edit case Recording.1625.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Module: RRM
Reader Revenue Manager module related issues
P1
Medium priority
Team M
Issues for Squad 2
Type: Enhancement
Improvement of an existing feature
Feature Description
As pointed out here, we should look into moving the on-demand synchronization of publication onboarding state from the client-side to the server for a better UX, like we did for the periodic synchronization.
Ideally, we should add a
POST:sync-publication-onboarding-state
endpoint so we handle the sync on the backend, and then callfetchGetSettings()
after this to update the saved settings state.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
Server side
POST:sync-publication-onboarding-state
endpoint as a new datapoint in theReader_Revenue_Manager
class:$publicationID
and$publicationOnboardingState
parameters to be passed in$data
. We need to pass these in, rather than simply use the current values in settings, because the client may be requesting a sync for an unsaved setting in the case where a new publication has been selected from the dropdown.$publications
via a call to$this->get_data( 'publications' )
.$publication
in the list where$publication->getPublicationId()
matches$publicationID
.$publication
is not found, return aWP_Error
with a message that the publication was not found.$newOnboardingState
from$publication->getOnboardingState()
.$newOnboardingState
is already$publicationOnboardingState
, return an empty object, indicating that the state has not changed.$settings
from$this->get_settings()->get()
.$publicationID
parameter matches$settings['publicationID']
, indicating that we are syncing the currently saved publication:publicationOnboardingState => $newOnboardingState
into$settings
.Client side
publications
datastore:fetchGetSyncPublicationOnboardingStateStore
store withbaseName: getSyncPublicationOnboardingState
viacreateFetchStore()
that calls the newPOST:sync-publication-onboarding-state
endpoint.publicationOnboardingState
is set in the response:settings.publicationOnboardingState
in state.savedSettings.publicationOnboardingState
ifisSavedSetting
istrue
.*syncPublicationOnboardingState()
action:resetPublications()
to the call that retrievescurrentOnboardingState
with a call toreturn yield fetchGetSyncPublicationOnboardingStateStore.actions.fetchGetSyncPublicationOnboardingState()
;return
statements withreturn {}
to ensure an object is always returned from the action.syncPublication()
callback in theRRMSetupSuccessSubtleNotification
component:syncPublicationOnboardingState()
, retrievecurrentOnboardingState
via thegetPublicationOnboardingState()
selector.syncPublicationOnboardingState()
to retrieve the result, which is of the shape{ response, error }
.response?.publicationOnboardingState
is truthy, execute the following block of code which can be moved fromsyncPublicationOnboardingState()
. The value ofresponse.publicationOnboardingState
should be used fornewOnboardingState
:site-kit-wp/assets/js/modules/reader-revenue-manager/datastore/publications.js
Lines 125 to 139 in d17f5bd
Test Coverage
syncPublicationOnboardingState()
action andRRMSetupSuccessSubtleNotification
component.QA Brief
On Site Kit Dashboard
Make sure you have at least one publication setup in RRM publication center with the status
ONBOARDING_COMPLETE
.In tester plugin,
RRM > Force Reader Revenue Manager publication onboarding state
, set it toONBOARDING_ACTION_REQUIRED
.Enable RRM feature and module. Make sure publications are setup for the site and they are available in settings screen.
Select the publication with
complete
state in publication center and complete the setup. This will setup the publication state asONBOARDING_ACTION_REQUIRED
in database.Visit the Site Kit dashboard. You will be able to see the publication onboarding state notification with the
Complete publication setup
CTA.Click on CTA which will open the publisher center. Stay on that page (away from Site Kit dashboard tab) for more than 15 seconds.
Return to the tab, ensure that notification has been changed to setup success notification and the Publication Approved Overlay notification is also visible.
On Settings Screen
Make sure you have at least one publication setup in RRM publication center with the status
ONBOARDING_COMPLETE
.In tester plugin,
RRM > Force Reader Revenue Manager publication onboarding state
, set it toONBOARDING_ACTION_REQUIRED
.Enable RRM feature and module. Make sure publications are setup for the site and they are available in settings screen.
Select the publication with
complete
state in publication center.You will be able to see the publication onboarding state notification with the
Complete publication setup
CTA on settings screen.Click on CTA which will open the publisher center. Stay on that page (away from Site Kit dashboard tab) for more than 15 seconds.
Return to the tab on settings edit screen, the publication onboarding state notification should disappear.
Changelog entry
The text was updated successfully, but these errors were encountered: