-
Notifications
You must be signed in to change notification settings - Fork 297
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
Creation of <WooCommerceRedirectModal>
Modal Component
#10172
Comments
Noting that the triggering specific issue at #10178 was closed out in favor of this issue which also outlines trigger rules. |
@zutigrm LGTM, moving to IB and assigning myself |
Thanks @10upsimon I have simplified and expanded the IB to cover the interruption of the setup and modal inclusion, with few other tweaks |
Thanks both, I have a few questions/concerns about the suggested approach.
The name of this action is a bit ambiguous considering it is an action that seems to be intended for the purpose of interrupting/preventing activation. As behavior we want to be defined at the module level, I'd suggest we follow a similar pattern to
I'd like to find a different place to include this if possible as it seems a bit too module-specific to bake into a core component like I'll think about this a bit more and discuss with @10upsimon later today to have this ready for tomorrow. |
@zutigrm IB ✅ , moving to EB! |
QA Update ⚠I have 2 observations (albeit quite minor) and a clarification: ITEM 1: ITEM 2: However, in our implementation, it's 28+5 = 33px: ITEM 3: CLARIFICATION |
Thanks @kelvinballoo
Correct, buttons in all modals are
It didn't make sense to override global actions wrapper that generates margin of
Not testable in the storybook, this will be verified in other issues that implement the modal |
QA Update ✅Thanks for the update @zutigrm . This is verified good in that case and good for approval. Verified on the visual aspect solely, as per QAB:
|
Feature Description
The WooCommerce redirect modal component is the core element within the WooCommerce redirect epic, and is the only user facing element that will give users the option of using (or continuing to use) Google for WooCommerce or to proceed with Site Kit for Ads module and potentially Ads account and campaign creation.
Said modal will present itself in 3 possible scenarios that a user may find themselves in when opting to proceed with Ads module set up in Site Kit:
Scenario 01 - WooCommerce is installed and active, but Google for WooCommerce is not
The modal will give the user the option using Google for WooCommerce, with a primary CTA link navigating to the WordPress dashboard plugin directory page, pre-filtered so that Google for WooCommerce is first in the list.
Scenario 02 - WooCommerce & Google for WooCommerce are installed and active, but no Ads account is linked
The same modal as in the prior scenario will be used, with the exception that the primary cta link will instead navigate to the Google for WooCommerce merchant dashboard page, from where the user may begin Ads account setup via Google for WooCommerce.
Scenario 03 - WooCommerce & Google for WooCommerce are installed and active, and an Ads account linked to Google for WooCommerce is detected
The user is made aware that an existing account via Google for WooCommerce is detected, giving them the option to continue with said existing account (linking to the Google for WooCommerce merchant overview dashboard) or continue to create an account via Site Kit.
Modal Components/Elements
Each variation of the modal, and thus the modal component overall, will consist of the following elements:
Modal Dismissal
All instances of the modal, regardless of the scenario at hand, should be deemed "dismissed" if either the primary or secondary CTA's are clicked. Dismissals should be valid for the duration of the users session, and make use of
api/cache
logic currently in the codebase.For a more detailed breakdown of the modal, please see the WooCommerce Redirect Modal Component (UI) section of the design doc.
Figma designs can be found here.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
WooCommerceRedirectModal
is created matching the Figma designsSaid modal should be triggered when setup Ads module is triggered - currently from setup CTA #10175 and within the new Ads setup screen (see Updates to the Ads Module<SetupMainPAX>
Component to Accommodate New Layout #10193 ) - when one of the following conditions are fulfilled:external
icon, it indicates that it takes you to the external service outside the Site Kit)Ads setup flow should be fully interrupted, so module does not enter theactive
stateContinue with Site Kit
in both cases continues with the Ads module setup flowImplementation Brief
Update
assets/js/googlesitekit/datastore/site/cache.js
getCacheItem
, that will act as a wrapper for retrieving the value usinggetItem
from theassets/js/googlesitekit/api/cache.js
Add
assets/js/modules/ads/components/woocommerce/WooCommerceRedirectModal.js
dialogActive
- Bool, controls the visible state of the dialogonDismiss
- Func, optional, accepts a callback function for when the modal is dismissed<Dialog>
,<DialogTitle>
,<DialogContent>
, and<DialogFooter>
components as per other implementations of modals in the codebase and content matching the referenced Figma designs. You may use the modal atassets/js/components/KeyMetrics/ConfirmSitePurposeChangeModal.js
as an example.dialogActive
prop to theopen
prop of the<Dialog>
componentonDismiss
prop to theonClose
prop of the<Dialog>
componentonClose
callback function that should dispatchsetCacheItem
action fromCORE_SITE
datastore, you can usewc-redirect-modal
for key. Use0
forttl
option, so value is preserved in the local storage until session is cleared.onDismiss
callback passed as a prop, if presentnavigateToGoogleForWooCommerce()
, this callback function should:getGoogleForWooCommerceRedirectURI
selector fromCORE_SITE
datastore. For navigating, usenavigateTo
action fromCORE_LOCATION
store.onClose
callbackuseActivateModuleCallback
hook (pass the module slug parameter -ads
)onClose
callback<DialogFooter>
component, add two button components:<Button>
component with proptertiary
, labeled "Continue with Site Kit"onSecondaryCTAClickCallback
callback function as theonClick
prop value<SpinnerButton>
component labelledUse Google for WooCommerce
navigateToGoogleForWooCommerce
callback functionisNavigating
selector fromCORE_LOCATION
store in primary button callback, to flag that the navigating is happening, and pass the value to theisSaving
proponClose
callback to theonClose
prop to theDialog
componentInassets/js/modules/ads/components/setup/SetupMainPAX.js
Render theWooCommerceRedirectModal
withinLayout
wrapper component, and use thedialogActive
prop to trigger the modal when:shouldShowWooCommerceRedirectModal
selector added in Create New Ads Module Datastore Partial for Plugin Detection Selectors #10170 istrue
ANDwc-redirect-modal
cache key (usegetCacheItem
selector fromCORE_SITE
datastore), is empty/not setTest Coverage
QA Brief
?path=/story/modules-ads-woocommerceredirectmodal--default
is resembling the one in Figma (link referenced in the AC)Changelog entry
WooCommerceRedirectModal
component.The text was updated successfully, but these errors were encountered: