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

feat(pair/CAD): Implement signed-in '/connect_another_device' and '/pair' mods + redirects #17660

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

LZoog
Copy link
Contributor

@LZoog LZoog commented Sep 20, 2024

This PR is for FXA-10138, but someone else will need to pick it up since I will be in all-day workshops Mon-Wed next week. Please feel free to modify this PR description with the commit message and push over my changes.

This currently covers the first two bullet points in that ticket. See this note about the iPad comments here.

You'll need to run yarn firefox of course to look at these locally. You can modify the user agent in dev tools to see different views.

TODO:

  • 3rd bullet point. Look at Figma linked in the epic and pull the "Connecting your mobile device with your Mozilla account" piece of pair/unsupported into a partial, and conditionally display it if this.getUserAgent().isMobile() && this._isSignedIn()
  • 4th & 5th bullet points which sorta cover the same thing. I'm hoping there won't be any messiness with the web channel message bits since we can modify in that getSyncNavigate function when we send a message or not on the React side.
  • Unit tests & functional tests. We reference connect_another_device or the CAD header a lot in our functional tests after sync signin/signup.

@clouserw clouserw requested a review from a team September 20, 2024 23:26
@vbudhram vbudhram self-assigned this Sep 23, 2024
@vbudhram vbudhram marked this pull request as ready for review September 24, 2024 21:43
@vbudhram vbudhram requested a review from a team as a code owner September 24, 2024 21:43
@@ -148,7 +148,7 @@ test.describe('severity-1 #smoke', () => {
const code = await target.emailClient.getVerifyShortCode(email);
await confirmSignupCode.fillOutCodeForm(code);

await expect(page).toHaveURL(/connect_another_device/);
await expect(page).toHaveURL(/pair/);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't be surprised if some of the mobile-based tests fail since /pair will take mobile users to /pair/unsupported, if you're seeing that I'd just check for /pair/unsupported. Though, does pair/unsupported pass on this test since the URL contains /pair? 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we have functional tests for the pair flow so this is probably ok. I did see a bunch of unit test failures though.

!this.getUserAgent().isMobile()
) {
this.navigate('/pair');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there is one other case we want to account for here, and it's accessing "Connect another device" in the desktop browser menu after the user is signed in. The query params are connect_another_device?context=fx_desktop_v3&entrypoint=fxa_avatar_menu&service=sync... Maybe we just need something like this (we probably want a new constant since I don't see this one)?

if (this._isSignedIn() && !this.getUserAgent().isMobile() && (window.location.search === '' || this.getSearchParam('entrypoint') === 'fxa_avatar_menu'))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vbudhram Looking at Figma again, I actually think all we need to check here is if (this._isSignedIn() && !this.getUserAgent().isMobile()) and then redirect, and not bother with the parameters. We always want to take signed on desktop users here.

if (needsMobileConfirmed) {
GleanMetrics.cadFirefox.view();
} else {
GleanMetrics.cadFirefox.choiceView();
}

context.set({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to check for showSuccessMessage=true here like CAD and display the message now that users are being redirected here (this is from Figma):
image

On the bright side I tested with 2FA and I'm signed into Sync when redirected here as you said \o/

Copy link
Contributor

Choose a reason for hiding this comment

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

I added the header but was spending way to much time trying to get the checkmark styled correctly, will file a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vbudhram Sounds good, I think in that same ticket we should change this to not be a div instead of an h1 especially since there's an h1/h2 right after this.

sinon.stub(view, 'getSearchParam').callsFake(() => undefined);
assert.equal(view.showDownloadFirefoxQrCode(), false);
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So much code removal ❤️

@vbudhram vbudhram force-pushed the FXA-10138 branch 3 times, most recently from 38bb333 to 56738ab Compare September 25, 2024 03:53
@vbudhram
Copy link
Contributor

@LZoog I'm going to approve this since its built on top of your initial PR. If all looks good, I can merge.

Comment on lines 2 to 3
<p class="mt-4 text-base">Open Firefox on your computer, visit <b class="whitespace-nowrap">firefox.com/pair</b>, and
follow the on-screen instructions to connect your mobile device.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a translation tag?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes it does, I'll update.

Copy link
Contributor Author

@LZoog LZoog left a comment

Choose a reason for hiding this comment

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

@vbudhram This is looking great, there's two things that would be great to get in here to fully satisfy the ticket:

but consider this r+ because it's late and if we can land what we have here already in the tag I think it'll be a win and then we can prioritize these last fixes early next sprint.

if (needsMobileConfirmed) {
GleanMetrics.cadFirefox.view();
} else {
GleanMetrics.cadFirefox.choiceView();
}

context.set({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vbudhram Sounds good, I think in that same ticket we should change this to not be a div instead of an h1 especially since there's an h1/h2 right after this.

@vbudhram vbudhram merged commit 6d3edcf into main Sep 25, 2024
26 checks passed
@vbudhram vbudhram deleted the FXA-10138 branch September 25, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants