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

adding autoedits onboarding setup for dotcom users #6463

Open
wants to merge 7 commits into
base: hitesh/make-autoedits-reactive
Choose a base branch
from

Conversation

hitesh-1997
Copy link
Contributor

@hitesh-1997 hitesh-1997 commented Dec 26, 2024

  1. The PR adds onboarding workflow for the auto-edits feature.
  2. We first check if the user is eligible for the auto-edits feature based on the conditions:
  • User needs to be in vscode editor.
  • If dotcom authenticated, only pro users allowed.
  • User has to be in the backend feature flag.
  1. If the user is eligible to try auto-edits, we show a pop up to the user (max 3 times). Clicking on the pop-up enables auto-edits for the user.

@aramaraju Does the conditions above looks okay to you ?

auto-edits.onboarding.mp4

Test plan

CI

@hitesh-1997 hitesh-1997 force-pushed the hitesh/autoedit-onboarding-setup branch from 742874b to ab9ec69 Compare December 27, 2024 11:39
@hitesh-1997 hitesh-1997 force-pushed the hitesh/autoedit-onboarding-setup branch 2 times, most recently from b08f12a to 81b0302 Compare January 6, 2025 15:24
@hitesh-1997 hitesh-1997 changed the base branch from main to hitesh/make-autoedits-reactive January 6, 2025 15:25
@hitesh-1997 hitesh-1997 force-pushed the hitesh/make-autoedits-reactive branch from 2018bc0 to 0f22a0e Compare January 6, 2025 21:39
@hitesh-1997 hitesh-1997 force-pushed the hitesh/autoedit-onboarding-setup branch from ab63f60 to 0fb8d6d Compare January 6, 2025 21:40
@hitesh-1997 hitesh-1997 marked this pull request as ready for review January 6, 2025 22:12
Comment on lines +52 to +56
!isUserEligibleForAutoeditsFeature(
autoeditsFeatureFlagEnabled,
authStatus,
userProductSubscription
)
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this check one level higher to the registerAutoEdits function in main.ts. If a user is not eligible, we should not attempt to call the createAutoEditsProvider function.

Copy link
Contributor Author

@hitesh-1997 hitesh-1997 Jan 7, 2025

Choose a reason for hiding this comment

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

any specific reason why main.ts could be better here ?
I liked it here since that puts all the logic for creating/decide if not to create provider in a single place. Also, if the logic becomes more complex (such as the proposal to show pop-up to the non eligible users ) we want to add condition under the if, so we can do this in the same file.

Do you think it would be okay to just keep it here ?

Copy link
Member

Choose a reason for hiding this comment

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

I assumed we still have a check for the feature flag at the top level, but now I see that we moved all conditions into one place. That was the primary purpose of this suggestion 👍

)
) {
throw new Error(
'User is not eligible for auto-edits. Can not initialize auto-edits provider.'
Copy link
Member

Choose a reason for hiding this comment

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

It would be helpful for debugging if we named the reason here or at least logged it to the output channel. That way, when users come to us with questions about this error, we can triage it faster.

Comment on lines +74 to +76
private async getAutoEditsOnboardingNotificationCount(): Promise<number> {
return await localStorage.getAutoEditsOnboardingNotificationCount()
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: no need to await in cases where we only need to return a promise

Suggested change
private async getAutoEditsOnboardingNotificationCount(): Promise<number> {
return await localStorage.getAutoEditsOnboardingNotificationCount()
}
private getAutoEditsOnboardingNotificationCount(): Promise<number> {
return localStorage.getAutoEditsOnboardingNotificationCount()
}


private async isUserEligibleForAutoeditsOnboarding(): Promise<boolean> {
const authStatus = currentAuthStatus()
const productSubsubscription = await currentUserProductSubscription()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const productSubsubscription = await currentUserProductSubscription()
const productSubscription = await currentUserProductSubscription()

export function isUserEligibleForAutoeditsFeature(
autoeditsFeatureFlagEnabled: boolean,
authStatus: AuthStatus,
productSubsubscription: UserProductSubscription | null
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
productSubsubscription: UserProductSubscription | null
productSubscription: UserProductSubscription | null


private async isAutoeditsNotificationsUnderLimit(): Promise<boolean> {
const count = await this.getAutoEditsOnboardingNotificationCount()
return count < this.MAX_AUTO_EDITS_ONBOARDING_NOTIFICATIONS
Copy link
Member

Choose a reason for hiding this comment

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

If we decide to show it multiple times, we should add a progressive timeout between prompts to avoid coming across as spammy.

@hitesh-1997 hitesh-1997 mentioned this pull request Jan 7, 2025
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.

2 participants