-
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
Scaffold (logic for) new AdSense setup account components #4759
Comments
IB ✔️ |
QA: ❗@eugene-manuilov Just a note. The AC mentions that
|
@asvinb Yes, i decided to use simplified properties for now instead of passing whole account and site objects to the component. If we see that we need more account/site data, we will update the component when we will be implementing it. |
QA: ✔️ |
Following the scaffolded main components for the enhanced AdSense setup flow from #4758, this issue is about scaffolding the next "hierarchical" level of components, around the more specific state of an (already created/selected) account.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
assets/js/modules/adsense/components/setup/v2/
:SetupAccountNoClient
SetupAccountCreateSite
SetupAccountPendingTasks
SetupAccountSite
, with two required props:account
(account API object, including our tweaks to e.g. include _id, similar to how theSetupAccount
component from Scaffold (logic for) new AdSense setup main components #4758 has it)site
(site API object)SetupAccount
component introduced in Scaffold (logic for) new AdSense setup main components #4758 should be implemented with logic as follows (replacing the dummy content that is currently in there):getClientID
selector).getClients
andgetCurrentSite
selectors of the module.AFC
in the list of clients from the API, it should return theSetupAccountNoClient
component.null
, NOTundefined
), it should return theSetupAccountCreateSite
component.pendingTasks
list on the givenaccount
prop is not empty, it should return theSetupAccountPendingTasks
component.SetupAccountSite
component, passing the two props to it.useEffect
hooks should be added:useEffect
to conditionally set theclientID
setting on-the-fly should be added:clientID
is set yet.clientID
.useEffect
to conditionally set theaccountStatus
setting on-the-fly should be added:ACCOUNT_STATUS_NO_CLIENT
.pendingTasks
is not empty, it should be set toACCOUNT_STATUS_PENDING_TASKS
.ACCOUNT_STATUS_APPROVED
.useEffect
to conditionally set thesiteStatus
setting on-the-fly should be added:SITE_STATUS_NONE
.SITE_STATUS_NEEDS_ATTENTION
(for now).SetupMain
component introduced in Scaffold (logic for) new AdSense setup main components #4758:useEffect
to update theaccountStatus
setting on-the-fly, the entire condition for setting it toACCOUNT_STATUS_NO_CLIENT
should be removed, as that was just temporary and is now surpassed by the above logic inSetupAccount
.SetupAccountNoClient
should be scaffolded to simply return an untranslated string (e.g. in a div)TODO: UI for lack of AFC client in account {accountID}
(using the_id
from theaccount
prop).SetupAccountCreateSite
should be scaffolded to simply return an untranslated string (e.g. in a div)TODO: UI to create a new site in account {accountID}
(using the_id
from theaccount
prop).SetupAccountPendingTasks
should be scaffolded to simply return an untranslated string (e.g. in a div)TODO: UI for pending tasks in account {accountID}
(using the_id
from theaccount
prop).SetupAccountSite
should be scaffolded to simply return an untranslated string (e.g. in a div)TODO: UI to proceed with next steps for account {accountID} and site {domain}
(using the_id
from theaccount
prop anddomain
fromsite
prop).SetupMain
in the above four alternate variants should be added.SetupAccount
that was added as part of Scaffold (logic for) new AdSense setup main components #4758.SetupMain
.Implementation Brief
assets/js/modules/adsense/components/setup/v2/
which export a functional component having the same filename.SetupAccountNoClient
SetupAccountCreateSite
SetupAccountPendingTasks
SetupAccountSite
assets/js/modules/adsense/components/setup/v2/SetupAccount
,clientID
via thegetClientID
selector.clients
via thegetClients
selector.currentSite
via thegetCurrentSite
selector.SetupAccountNoClient
if there is no client of typeAFC
in the list ofclients
. This is done by checking ifclient.productCode === 'AFC'
.SetupAccountCreateSite
ifcurrentSite
isnull
(notundefined
).SetupAccountPendingTasks
if thependingTasks
list on the givenaccount
prop is not empty.SetupAccountSite
by default, proxying theaccount
prop and thesite
prop, withcurrentSite
as value.useEffect
to conditionally set theclientID
(via dispatching thesetClientID
action) setting on-the-fly should be added,AFC
client inclients
andclientID
is not set.AFC
client inclients
but it is not the currently setclientID
.useEffect
to conditionally set theaccountStatus
(via dispatching thesetAccountStatus
action) setting on-the-fly should be added,AFC
client inclients
, it should be set toACCOUNT_STATUS_NO_CLIENT
.account
'spendingTasks
is not empty, it should be set toACCOUNT_STATUS_PENDING_TASKS
.ACCOUNT_STATUS_APPROVED
.assets/js/modules/adsense/util/status.js
.useEffect
to conditionally set thesiteStatus
(via dispatching thesetSiteStatus
action) setting on-the-fly should be added:currentSite
isnull
, it should be set toSITE_STATUS_NONE
.SITE_STATUS_NEEDS_ATTENTION
.assets/js/modules/adsense/components/setup/v2/SetupMain
,useEffect
to update theaccountStatus
setting on-the-fly, the entire condition for setting it toACCOUNT_STATUS_NO_CLIENT
should be removed. Refer to AC for more details to as why.assets/js/modules/adsense/components/setup/v2/SetupMain.stories.js
to include stories for the above variants whereSetupAccountNoClient
,SetupAccountCreateSite
,SetupAccountPendingTasks
andSetupAccountSite
are rendered.Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: