Skip to content
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

Domain: Refactor to use a common domain selection view #22254

Merged

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Dec 19, 2023

Fixes #22246

Recently we created a new modern domain selection for Site Creation flow, but we continued using the previously created domain selection in all the other flows. The views not only differ in UI but also in how many domains we fetch and how we sort them.

The goal of this PR is to have a single implementation of domain selection for all the flows.

Solution

I first identified different entry points and their requirements:

Name Domain selection Flow
Free to Paid Dashboard Card Paid domains with free for the first year note Card -> Domains -> Plans -> Checkout
Register Dashboard Card Paid domains with free for the first year note Card -> Domains -> Registration form
All Domains Paid domains with free for the first year note and transfer domain note Me -> All Domains -> + -> Domains -> Just buy a domain -> Checkout / Me -> All Domains -> + -> Domains -> Existing WordPress.com site -> Choose Site -> Plans -> Checkout
Site Domains Paid domains with site redirect note Dashboard -> More -> Domains -> Search for a domain -> Domains -> Checkout

Then turnedWebAddressWizardContent into DomainSelectionViewController and started moving functionality one by one from RegisterDomainSuggestionsViewController to DomainSelectionViewController so it would support all the cases for the site creation as well as all the previous functionality. I didn't want to change anything outside domain selection view controllers and keep everything else working in same way.

In the end DomainSelectionViewController grew and now includes the business logic within it. One step I haven't done is move away switch statements into different configuration files using composition. For now, I feel it's more convenient having all the logic in one place.

Testing

  • Test existing entry points to open a new domain selection flow
  • Confirm that previously created flows continue to be working as before
Domain.Selection.flow.mov

Regression Notes

  1. Potential unintended areas of impact

Breaking domain selection in all the previous flows.

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing

  1. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

Dashboard Card is used instead
Support all the previous tracking events for an older VC and new track events for new VC. It preserves the previous behavior.
All the functionality is now part of DomainSelectionViewController
@@ -97,12 +115,46 @@ final class WebAddressWizardContent: CollapsableHeaderViewController {
}
}

// MARK: - Transfer Footer Views
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

self?.displayActionableNotice(title: Strings.errorTitle, actionTitle: Strings.errorDismiss)
}

switch domainSelectionType {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

@@ -715,3 +844,198 @@ extension WebAddressWizardContent: UITableViewDelegate {
performSearchIfNeeded(query: retryQuery)
}
}

// MARK: - Transfer Footer Setup
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

// MARK: - Support

private extension DomainSelectionViewController {
func includeSupportButtonIfNeeded() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

// MARK: - Routing

private extension DomainSelectionViewController {
private func pushRegisterDomainDetailsViewController() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

}
}

func track(_ event: WPAnalyticsEvent, properties: [AnyHashable: Any] = [:], blog: Blog? = nil) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from RegisterDomainSuggestionsViewController

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 19, 2023

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr22254-1b8ecaf
Version23.9
Bundle IDorg.wordpress.alpha
Commit1b8ecaf
App Center BuildWPiOS - One-Offs #8209
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 19, 2023

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr22254-1b8ecaf
Version23.9
Bundle IDcom.jetpack.alpha
Commit1b8ecaf
App Center Buildjetpack-installable-builds #7232
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@staskus staskus marked this pull request as ready for review December 19, 2023 14:23
@staskus staskus requested a review from guarani December 19, 2023 14:23
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 19, 2023

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@staskus staskus added this to the 24.0 milestone Dec 19, 2023
DomainSelectionViewController UI supports both configurations even if feature flag is disabled. It's no longer needed.
@staskus staskus requested a review from a team as a code owner December 19, 2023 17:29
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @staskus, thanks for tackling this refactor! 🏅 I took a first pass at reviewing and focused on testing today without looking much at the code. I split testing into two scenarios:

  • user on the Free plan
  • user on paid annual plans who already have a domain

I haven't tested users on the Free plan who already have a domain, users on paid plans who haven't claimed their free domain for a year yet, or users on monthly paid plans (and so are not eligible for a free domain). I also haven't finished a checkout to actually confirm the whole flow yet.


Free plan scenarios

I created a new account and a new site

  • Site creation with free WP.com subdomain

I tested these flows up until the checkout:

  • Free to Paid Dashboard Card
  • Register Dashboard Card
  • All Domains (Just buy a domain)
  • All Domains (Existing WP.com site)
  • Site Domains

Register Dashboard Card

Is this referring to this dashboard card (pcdRpT-21K-p2) we implemented to sell domains without a plan? If so, since it was removed in #21597, so I'm not sure why it's in the list of entry points (but I might be misunderstanding this).

[not a blocker, possibly out of scope] Users in the Dashboard -> More -> Domains flow are offered a domain for their existing site in this scenario. Should we only offer domains with a paid plan purchase? The user has a site, so matching the above "Existing WordPress.com site" where a domain is offered with a plan (which brings benefits to their site) seems intuitive.


Paid plan scenarios

Note that here the user has a paid domain, so additional domains are either re-directs or not associated with any site.

I tested these flows up until the checkout:

  • Free to Paid Dashboard Card (not applicable)
  • Register Dashboard Card (not sure if applicable; see above)
  • All Domains (Just buy a domain): The checkout screen shows an odd error message: "I tried and failed to create products from signup"
  • All Domains (Existing WP.com site): The checkout screen re-directs to the WP.com login screen
  • Site Domains: The checkout screen opens briefly and closes

@staskus
Copy link
Contributor Author

staskus commented Dec 21, 2023

Thanks for the review!

Register Dashboard Card

I meant this card, sorry for not clarifying. It's shown when the user has a plan but hasn't claimed the domain.

image

All Domains (Just buy a domain): The checkout screen shows an odd error message: "I tried and failed to create products from signup"
All Domains (Existing WP.com site): The checkout screen re-directs to the WP.com login screen
Site Domains: The checkout screen opens briefly and closes

Mmm.. Strange. It works for me. Were you proxied?

This refactoring only tackles the domain selection view. I didn't change any other flows so it shouldn't be affected.

Users in the Dashboard -> More -> Domains flow are offered a domain for their existing site in this scenario. Should we only offer domains with a paid plan purchase? The user has a site, so matching the above "Existing WordPress.com site" where a domain is offered with a plan (which brings benefits to their site) seems intuitive.

If I understand the question correctly, this is what we're doing with #22261 project. Offering domains with a paid plan purchase, not only domains with redirects?

@staskus
Copy link
Contributor Author

staskus commented Dec 21, 2023

I haven't tested users on the Free plan who already have a domain, users on paid plans who haven't claimed their free domain for a year yet, or users on monthly paid plans (and so are not eligible for a free domain)

Free plan who already have a domain

Simulator.Screen.Recording.-.iPhone.15.Plus.-.2023-12-21.at.11.00.38.mp4

As I understand one of your previous questions was regarding this flow, when the user already has a domain. I agree we should always offer a chance to purchase a plan for such a user. This refactor is not changing any behavior previously developed. And #22261 is adding another entry point.

Users on paid plans who haven't claimed their free domain for a year yet

Simulator.Screen.Recording.-.iPhone.15.-.2023-12-21.at.11.14.41.mp4
claim.your.free.domain.mp4

I also noticed that "All Domains" flow is underdeveloped for this case, however, it's not related to any changes we're making at the moment:
#22267

Users on monthly paid plans (and so are not eligible for a free domain)

Thanks, I never tested this flow before now. For such users, we don't show any cards, because they have a plan but are not eligible for domains as you say.

I wonder if there's a way for us to prompt such users to switch from month plan to year plan and get a free domain 🤔

Simulator.Screen.Recording.-.iPhone.15.-.2023-12-21.at.13.10.46.mp4

@staskus
Copy link
Contributor Author

staskus commented Dec 21, 2023

I fixed additional cases I caught now when testing. Not directly related to changes I made in this PR but necessary to make flows work better:

  • Present domain flow modally from Registration Card (to be consistent with all the other flows) 354b030
  • Push checkout instead of presenting it, otherwise "success view" does not appear in some flows (1b8ecaf)
  • After I merged with trunk, colors stopped working in Domains view. Now they have to be accessed through Design System (f8a7c31)

@wpmobilebot
Copy link
Contributor

3 Warnings
⚠️ View files have been modified, but no screenshot is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ This PR is assigned to the milestone 24.0. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@staskus
Copy link
Contributor Author

staskus commented Dec 21, 2023

@guarani, yes the plugins flow is as you described. It works.

Simulator.Screen.Recording.-.iPhone.15.-.2023-12-21.at.17.17.10.mp4

@guarani guarani self-requested a review December 22, 2023 00:29
@guarani
Copy link
Contributor

guarani commented Dec 22, 2023

Thanks for the replies @staskus! It seems to be working as expected. I reviewed the code as best I could, the changes are pretty big, so I tried to track most flows through the code instead of looking at all the changes one by one.

Register Dashboard Card

I meant this card, sorry for not clarifying. It's shown when the user has a plan but hasn't claimed the domain.

It makes total sense now. I'd forgotten about that card! I tested the flow to the "Register domain" screen, and it worked as expected.

If I understand the question correctly, this is what we're doing with #22261 project. Offering domains with a paid plan purchase, not only domains with redirects?

You're right, I got mixed up there.

All Domains

  • "Just buy a domain" flow
  • "Existing WordPress.com site" flow

Site Domains

This is working as expected.

Other scenarios

Mmm.. Strange. It works for me. Were you proxied?

I probably was proxied, but I re-tested proxied and un-proxied today, and it works now. I don't know what the issue was.

I wonder if there's a way for us to prompt such users to switch from month plan to year plan and get a free domain 🤔

I think this should be possible and upgrade credit will be applied, so perhaps we only would need to add the prompt. It's not in scope here, though.

@staskus staskus merged commit 7720c9e into trunk Dec 22, 2023
23 checks passed
@staskus staskus deleted the task/replace-outdated-domain-selection-with-new-domain-selection branch December 22, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Domain Selection: Refactor to use a common domain selection view
3 participants