Open nfmohit opened 1 month ago
Note: Added a new point in the ACs:
- This change in the view component should be permanent, i.e. once the user is shown the
<PublicationCreate>
component, they shouldn't be shown the content below even though Site Kit detects that publications exist later. This is crucial to ensure that the two steps in the<PublicationCreate>
component that appear based on the availability of publications function correctly. This can be done by using a new form key in thecore/forms
data store.
Back to IB again.
Excellent IB, thanks @ankitrox ! Please take a look at my comments below:
- Add constant
READER_REVENUE_MANAGER_FORM
with valuereaderRevenueManagerFormData
inassets/js/modules/reader-revenue-manager/datastore/constants.js
.
READER_REVENUE_MANAGER_SETUP_FORM
.
- If there are no publications available, set the form value using
setValues
function fromcore/forms
store. Pass form name asREADER_REVENUE_MANAGER_FORM
and value as an object as following{ publicationCreateRendered: true }
Let's change the object key to be something more meaningful, such as showPublicationCreateForm
which is added as the value for a new constant SHOW_PUBLICATION_CREATE_FORM
in assets/js/modules/reader-revenue-manager/datastore/constants.js
.
- If there are no publications available assign
PublicationCreate
component toviewComponent
.
Instead of using the number of publications to show PublicationCreate
, let's simplify this and only rely on the CORE_FORM
datastore value, i.e. "_Assign PublicationCreate
component to viewComponent
if SHOW_PUBLICATION_CREATE_FORM
value is true
_".
- Display the "Create Publication" CTA should use
Button
component with href prop passed to it. The link should be be passed usinggetServiceURL
selector
The "Create publication" CTA inside PublicationCreate
will be added as part of #8836, we do not need to include it here.
However, the PublicationCreate
component will need an onCompleteSetup
prop (see the IB for #8836), which is a callback that should dispatch the submitChanges
action and call the finishSetup
function.
If there are publications available, but value of
publicationCreateRendered
is true inCORE_FORMS
store forREADER_REVENUE_MANAGER_FORM
form name, assignPublicationCreate
component toviewComponent
. This will be useful to display the second step ofPublicationCreate
component.
- [ ] Clicking on the
Complete setup
should call thesaveSettings
on RRM module store and call thefinishSetup
function.
This bit is not necessary, as mentioned above, we should always render PublicationCreate
when SHOW_PUBLICATION_CREATE_FORM
value is true
.
- Make use
findMatchedPublication
action to find the suitable publication in case there is no publication ID available already and multiple publications are available. If the publication is returned by the action, set it usingsetPublicationID
action so thatPublicationSelect
component can retrieve it and display it as selected one.
Let's also set the publicationOnboardingState
and publicationOnboardingStateLastSyncedAtMs
module settings similar to PublicationSelect
.
- Clicking on the
Complete setup
should call thesaveSettings
on RRM module store and call thefinishSetup
function.
In order to save settings in the setup/settings screens, we should ideally use the submitChanges
action, which checks if any changes have been actually made first.
Please let me know if you have any questions on the above, thank you!
Thanks for reviewing the IB @nfmohit and your valuable feedback.
I've made the changes as per the suggestions. Over to you for re-review.
Thanks again!
Thank you for the iteration here, @ankitrox ! This looks good to me. Note: I've removed the requirement to set publicationOnboardingStateLastSyncedAtMs
as it will be set anyway almost immediately as part of maybeSyncPublicationOnboardingState
action.
IB ✅
Feature Description
The Reader Revenue Manager module setup flow has different states based on the number of publications the user has. This issue should handle setting the module setup screen and placeholder components for each state.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
<PublicationCreate>
component being added as part of #8836).<PublicationCreate>
component, they shouldn't be shown the content below even though Site Kit detects that publications exist later. This is crucial to ensure that the two steps in the<PublicationCreate>
component that appear based on the availability of publications function correctly. This can be done by using a new form key in thecore/forms
data store.<PublicationSelect>
component being added as part of #8837).findMatchedPublication()
action being added as part of #8795).<PublicationOnboardingStateNotice>
component being added as part of #8838).Implementation Brief
READER_REVENUE_MANAGER_SETUP_FORM
with valuereaderRevenueManagerSetupFormData
inassets/js/modules/reader-revenue-manager/datastore/constants.js
.SHOW_PUBLICATION_CREATE_FORM
with valueshowPublicationCreateForm
inassets/js/modules/reader-revenue-manager/datastore/constants.js
.assets/js/modules/reader-revenue-manager/components/setup/SetupMain.js
finishSetup
prop which is a function.useSelect
hook andgetPublications
selector from RRM store.getPublications
selector is not resolved yet, display theProgressBar
component.setValues
function fromcore/forms
store. Pass form name asREADER_REVENUE_MANAGER_SETUP_FORM
and value as an object as followinglet
variableviewComponent
which will hold the component that needs to be displayed.PublicationCreate
component toviewComponent
if value ofSHOW_PUBLICATION_CREATE_FORM
istrue
. "Create Publication" CTA would be displayed as part of #8836, theonCompleteSetup
for the CTA should be passed which should dispatch thesubmitChanges
action and call thefinishSetup
function.PublicationCreate
component will render the next step as mentioned below.PublicationSelect
component. Wrap the text and dropdown component in a div with class namegooglesitekit-settings-module__fields-group
. Refer this component from ads module for similar structure, just replaceTextField
withPublicationSelect
component.PublicationSelect
component. UsegetServiceURL
selector added in #8848 to get the link to publication center which will get opened in a new tab.findMatchedPublication
action to find the suitable publication in case there is no publication ID available already and multiple publications are available. If the publication is returned by the action, set publication ID, onboarding state and sync timestamp usingsetPublicationID
andsetPublicationOnboardingState
actions respectively, so thatPublicationSelect
component can retrieve it and display it as selected one.Complete setup
should dispatchsubmitChanges
on RRM module store and call thefinishSetup
function.Test Coverage
QA Brief
Changelog entry