diff --git a/package.json b/package.json index 42e022f..1bf787d 100644 --- a/package.json +++ b/package.json @@ -3601,7 +3601,7 @@ }, { "command": "gitlens.premium.login", - "title": "Login...", + "title": "Sign In...", "category": "GitLens Premium" }, { @@ -3611,7 +3611,7 @@ }, { "command": "gitlens.premium.signUp", - "title": "Create Free Account...", + "title": "Create a Free Account...", "category": "GitLens Premium" }, { @@ -3621,12 +3621,12 @@ }, { "command": "gitlens.premium.startPreviewTrial", - "title": "Try Premium Features...", + "title": "Try Premium Features Now", "category": "GitLens Premium" }, { "command": "gitlens.premium.purchase", - "title": "Unlock Premium Features for Private Repos...", + "title": "Purchase a Plan...", "category": "GitLens Premium" }, { @@ -5955,7 +5955,7 @@ }, { "command": "gitlens.premium.purchase", - "when": "!gitlens:premium:paid" + "when": "gitlens:premium:required == paid" }, { "command": "gitlens.premium.reset", @@ -10645,43 +10645,38 @@ }, { "view": "gitlens.views.worktrees", - "contents": "To use premium GitLens features, please verify the email for the account you created.\n\n[Resend verification email](command:gitlens.premium.resendVerification)\n\n[Refresh verification status](command:gitlens.premium.validate)", - "when": "gitlens:premium:requiresVerification" - }, - { - "view": "gitlens.views.worktrees", "contents": "[Create Worktree...](command:gitlens.views.createWorktree)", - "when": "gitlens:premium || gitlens:premium:trial && !gitlens:premium:required && !gitlens:premium:requiresVerification" + "when": "gitlens:premium:allowed" }, { "view": "gitlens.views.worktrees", - "contents": "Worktrees are a premium feature, which require a free account for public repos.\n\nYou can try these premium features for free, without an account, for 3 days. All non-premium features will continue to be free without an account.", - "when": "!gitlens:premium:trial && gitlens:premium:required == free+ && !gitlens:premium:requiresVerification" + "contents": "Please verify your email\n\nTo use the Worktrees premium feature, please verify the email for the account you created.\n\n[Resend verification email](command:gitlens.premium.resendVerification)\n\n[Refresh verification status](command:gitlens.premium.validate)", + "when": "gitlens:premium:state == -1" }, { "view": "gitlens.views.worktrees", - "contents": "Worktrees are a premium feature, which require at least a Pro subscription for private repos.", - "when": "!gitlens:premium:trial && gitlens:premium:required == paid && !gitlens:premium:requiresVerification" + "contents": "Worktrees are a premium feature, which requires a free account for public repos.", + "when": "gitlens:premium:state != -1 && gitlens:premium:required == free+" }, { "view": "gitlens.views.worktrees", - "contents": "[Learn about premium features](command:gitlens.premium.learn)", - "when": "!gitlens:premium:paid && gitlens:premium:required && !gitlens:premium:requiresVerification" + "contents": "Worktrees are a premium feature, which requires at least a Pro subscription for private repos.", + "when": "gitlens:premium:state != -1 && gitlens:premium:required == paid" }, { "view": "gitlens.views.worktrees", - "contents": "[Try premium features now](command:gitlens.premium.startPreviewTrial)", - "when": "!gitlens:premium && !gitlens:premium:trial && !gitlens:premium:previewTrial:expired" + "contents": "[Learn about premium features](command:gitlens.premium.learn)\n\n[Try premium features now](command:gitlens.premium.startPreviewTrial)\n\n[Create a free account](command:gitlens.premium.loginOrSignUp)\n\nHave an existing account? [Sign in](command:gitlens.premium.loginOrSignUp)\n\n[View paid plans](command:gitlens.premium.showPlans)", + "when": "gitlens:premium:state == 0" }, { "view": "gitlens.views.worktrees", - "contents": "[Create a free account](command:gitlens.premium.loginOrSignUp)\n\nHave an existing account? [Sign in](command:gitlens.premium.loginOrSignUp)", - "when": "!gitlens:premium && gitlens:premium:required && !gitlens:premium:requiresVerification" + "contents": "Create a free account to continue trialing premium features for all repos for an additional 7 days.\n\n[Learn about premium features](command:gitlens.premium.learn)\n\n[Create a free account](command:gitlens.premium.loginOrSignUp)\n\nHave an existing account? [Sign in](command:gitlens.premium.loginOrSignUp)\n\n[Purchase a plan](command:gitlens.premium.purchase)", + "when": "gitlens:premium:state == 2" }, { "view": "gitlens.views.worktrees", - "contents": "[Upgrade your account](command:gitlens.premium.purchase)", - "when": "gitlens:premium && gitlens:premium:required == paid && !gitlens:premium:requiresVerification" + "contents": "[Learn about premium features](command:gitlens.premium.learn)\n\n[Purchase a plan](command:gitlens.premium.purchase)", + "when": "gitlens:premium:state == 4" } ], "views": { diff --git a/src/constants.ts b/src/constants.ts index fbcbfce..346d213 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -257,11 +257,9 @@ export const enum ContextKeys { Vsls = 'gitlens:vsls', Premium = 'gitlens:premium', - PremiumPaid = 'gitlens:premium:paid', + PremiumAllowed = 'gitlens:premium:allowed', PremiumRequired = 'gitlens:premium:required', - PremiumRequiresVerification = 'gitlens:premium:requiresVerification', - PremiumTrial = 'gitlens:premium:trial', - PremiumPreviewTrialExpired = 'gitlens:premium:previewTrial:expired', + PremiumState = 'gitlens:premium:state', } export const enum CoreCommands { diff --git a/src/premium/subscription/subscriptionService.ts b/src/premium/subscription/subscriptionService.ts index c30b331..2d135ee 100644 --- a/src/premium/subscription/subscriptionService.ts +++ b/src/premium/subscription/subscriptionService.ts @@ -31,7 +31,6 @@ import { getTimeRemaining, isSubscriptionExpired, isSubscriptionPaidPlan, - isSubscriptionPreviewTrialExpired, isSubscriptionTrial, Subscription, SubscriptionPlanId, @@ -256,7 +255,13 @@ export class SubscriptionService implements Disposable { @log() async purchase(): Promise { - void this.showPlans(); + if (this._subscription.account == null) { + void this.showPlans(); + } else { + void env.openExternal( + Uri.joinPath(this.baseAccountUri, 'create-organization').with({ query: 'product=gitlens' }), + ); + } await this.showHomeView(); } @@ -647,26 +652,22 @@ export class SubscriptionService implements Disposable { queueMicrotask(async () => { const { allowed, subscription } = await this.container.git.access(); - void setContext( - ContextKeys.PremiumRequired, - allowed - ? false - : subscription.required != null && isSubscriptionPaidPlan(subscription.required) - ? 'paid' - : 'free+', - ); + const required = allowed + ? false + : subscription.required != null && isSubscriptionPaidPlan(subscription.required) + ? 'paid' + : 'free+'; + void setContext(ContextKeys.PremiumAllowed, allowed); + void setContext(ContextKeys.PremiumRequired, required); }); const { - account, plan: { actual }, + state, } = this._subscription; void setContext(ContextKeys.Premium, actual.id != SubscriptionPlanId.Free ? actual.id : undefined); - void setContext(ContextKeys.PremiumPaid, isSubscriptionPaidPlan(actual.id)); - void setContext(ContextKeys.PremiumRequiresVerification, account?.verified === false); - void setContext(ContextKeys.PremiumTrial, isSubscriptionTrial(this._subscription)); - void setContext(ContextKeys.PremiumPreviewTrialExpired, isSubscriptionPreviewTrialExpired(this._subscription)); + void setContext(ContextKeys.PremiumState, state); } private updateStatusBar(pending: boolean = false): void { diff --git a/src/webviews/apps/home/partials/state.free-preview-expired.html b/src/webviews/apps/home/partials/state.free-preview-expired.html index 554cd80..60bdb91 100644 --- a/src/webviews/apps/home/partials/state.free-preview-expired.html +++ b/src/webviews/apps/home/partials/state.free-preview-expired.html @@ -12,7 +12,7 @@ >, a commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with an account.

-

Create a free account to continue trialing premium features for all code for an additional 7 days.

+

Create a free account to continue trialing premium features for all repos for an additional 7 days.

Learn about premium features Create a free account Resend verification email Refresh verification status -

All non-premium features will continue to be free without an account.

diff --git a/src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html b/src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html index 54251be..45a4660 100644 --- a/src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html +++ b/src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html @@ -7,7 +7,7 @@

The Visual File History is a premium feature, which requires at least a Pro subscription for private repos.

-

Create a free account to continue trialing premium features for all code for an additional 7 days.

+

Create a free account to continue trialing premium features for all repos for an additional 7 days.

Learn about premium features Create a free account
- -

To continue using premium GitLens features, please verify the email for the account you created.

+

Please verify your email

+

To use the Visual File History premium feature, please verify the email for the account you created.

Resend verification email Refresh verification status -

All non-premium features will continue to be free without an account.