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

🪟 🔧 ☁️ Check email verification status for free connector enrollment #21514

Conversation

ambirdsall
Copy link
Contributor

@ambirdsall ambirdsall commented Jan 18, 2023

What

A few improvements to the frontend for free connector enrollment:

  • passes emailVerified and sendEmailVerification into EnrollmentModalContent as props (via useAuthService(), which can't be called within the modal content component itself but can be from the useShowEnrollmentModal hook)
  • if and only if the user hasn't verified their email:
    • conditionally renders a new callout with a link to resend the email verification
    • disables the CTA
  • minor refactors to the useFreeConnectorProgram hook
    • extracts the experiment flag check into the hook, making it a single source of truth to override or update
    • rename the function to match its filename

Screenshot of the modal for a user with unvalidated email:
fcp-email-unverified-modal

Okay, but why is CreditsPage/components/EmailVerificationHint.tsx in this PR

Right, that. That component was the only place in the app that used the sendEmailVerification function from useAuthService. It also added a bunch of error handling that we'll want every time we use this API, so before I used sendEmailVerification in the FCP enrollment modal, I extracted the error handling into useAuthService itself, so we would get it "for free". As of now, the error handling strategy is hardcoded in the hook; if the need for context-dependent error handling arises, we will have to rewrite sendEmailVerification to return some well-typed error object instead of handling errors right inside the function. But I'm not sure we're gonna need it.

Recommended reading order

There are three pairs of files whose changes are linked; you can read them in either order, but should probably consider them together.

  1. useShowEnrollmentModal.tsx / EnrollmentModal.tsx
  2. useFreeConnectorProgram.ts / ConnectionPageTitle.tsx
  3. EmailVerificationHint.tsx / AuthService.tsx
  4. the rest

@octavia-squidington-iv octavia-squidington-iv added the area/frontend Related to the Airbyte webapp label Jan 18, 2023
@ambirdsall ambirdsall temporarily deployed to more-secrets January 18, 2023 08:45 — with GitHub Actions Inactive
@ambirdsall ambirdsall temporarily deployed to more-secrets January 18, 2023 08:46 — with GitHub Actions Inactive
@ambirdsall ambirdsall force-pushed the alex/check-email-verification-status-for-free-connector-enrollment branch from 3088df7 to 97a8387 Compare January 18, 2023 08:49
@ambirdsall ambirdsall marked this pull request as ready for review January 18, 2023 08:49
@github-actions
Copy link
Contributor

github-actions bot commented Jan 18, 2023

[note from Alex] ignore this bot: it's talking about an unrelated file that got pulled in from latest master (and then rebased out again straightaway to keep the diff clean)

Airbyte Code Coverage

File Coverage [45.16%]
EnvConfigs.java 45.16%
Total Project Coverage 26.63% 🍏

Base automatically changed from teal/inline-alert-ab-connectors to master January 18, 2023 17:45
Copy link
Contributor

@teallarson teallarson left a comment

Choose a reason for hiding this comment

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

Could use a rebase to remove changes from the inline banner.

Other than that, one comment and one question but looks pretty much good to go.

@ambirdsall ambirdsall force-pushed the alex/check-email-verification-status-for-free-connector-enrollment branch 3 times, most recently from bfae290 to b6a4950 Compare January 18, 2023 19:39
@@ -745,12 +745,5 @@

"jobs.noAttemptsFailure": "Failed to start job.",

"cloudApi.loginCallbackUrlError": "There was an error connecting to the developer portal. Please try again.",

"freeConnectorProgram.enrollmentModal.title": "Free connector program",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are not being deleted, just moved to the cloud-specific locale file

@ambirdsall ambirdsall force-pushed the alex/check-email-verification-status-for-free-connector-enrollment branch from b6a4950 to 6797b89 Compare January 18, 2023 20:32
@teallarson teallarson self-requested a review January 19, 2023 17:10
Copy link
Contributor

@teallarson teallarson left a comment

Choose a reason for hiding this comment

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

Nice!

Some thoughts I had trying it out:

  • Could use a success message on send ("verification email sent!" or something along the lines)
  • I have to refresh the page after verifying to remove the warning

@ambirdsall
Copy link
Contributor Author

@tealjulia there's a slack discussion on the confirmation feedback; definitely going to be added, though I might hold that for a follow-up for easier reviewing.

The other issue, "have to refresh the page after verifying to remove the warning", would have to be solved by polling AuthService outside of the modal and re-triggering it if the value changes. Definitely possible, but might be enough of a headache to accept the need to refresh (at least for the time being).

@teallarson
Copy link
Contributor

teallarson commented Jan 19, 2023

The other issue, "have to refresh the page after verifying to remove the warning", would have to be solved by polling AuthService outside of the modal and re-triggering it if the value changes. Definitely possible, but might be enough of a headache to accept the need to refresh (at least for the time being).

Reasonable! I wouldn't say it's blocking. Possibly a related solution to https://github.com/airbytehq/airbyte-cloud/issues/3992 (redirecting when a user logs out or in in a separate tab)

@ambirdsall ambirdsall force-pushed the alex/check-email-verification-status-for-free-connector-enrollment branch from 6815c14 to abb7abd Compare January 19, 2023 17:58
@ambirdsall ambirdsall force-pushed the alex/check-email-verification-status-for-free-connector-enrollment branch from abb7abd to f766423 Compare January 19, 2023 18:15
@ambirdsall ambirdsall requested a review from teallarson January 19, 2023 19:48
@ambirdsall ambirdsall merged commit 934ecfa into master Jan 19, 2023
@ambirdsall ambirdsall deleted the alex/check-email-verification-status-for-free-connector-enrollment branch January 19, 2023 19:50
etsybaev pushed a commit that referenced this pull request Jan 19, 2023
…21514)

* check email verification status for real

* Extract email verification error handling to hook

* Move enrollmentModal's text copy to cloud locale

* Make FCP enrollment modal aware of email verification status

* Clean up useFreeConnectorProgram

- rename the function to match its filename
- check the experiment within the hook, not at every call site

* Update FCP modal for users with unverified emails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants