Browse Source

Fixes worktrees gate messaging

Aligns with other gate messaging states
  Simplifies context keys for premium
Fixes purchase link to point to account site
Polishes other gate messaging
main
Eric Amodio 2 years ago
parent
commit
1bca4b7b0b
7 changed files with 40 additions and 48 deletions
  1. +18
    -23
      package.json
  2. +2
    -4
      src/constants.ts
  3. +16
    -15
      src/premium/subscription/subscriptionService.ts
  4. +1
    -1
      src/webviews/apps/home/partials/state.free-preview-expired.html
  5. +0
    -1
      src/webviews/apps/home/partials/state.verify-email.html
  6. +1
    -1
      src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html
  7. +2
    -3
      src/webviews/apps/premium/timeline/partials/state.verify-email.html

+ 18
- 23
package.json View File

@ -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": {

+ 2
- 4
src/constants.ts View File

@ -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 {

+ 16
- 15
src/premium/subscription/subscriptionService.ts View File

@ -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> {
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 {

+ 1
- 1
src/webviews/apps/home/partials/state.free-preview-expired.html View File

@ -12,7 +12,7 @@
>, a commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with an
account.
</p>
<p>Create a free account to continue trialing premium features for all code for an additional 7 days.</p>
<p>Create a free account to continue trialing premium features for all repos for an additional 7 days.</p>
<vscode-button data-action="command:gitlens.premium.learn">Learn about premium features</vscode-button>
<vscode-button data-action="command:gitlens.premium.loginOrSignUp">Create a free account</vscode-button>
<span class="button-subaction"

+ 0
- 1
src/webviews/apps/home/partials/state.verify-email.html View File

@ -6,6 +6,5 @@
>Resend verification email</vscode-button
>
<vscode-button data-action="command:gitlens.premium.validate">Refresh verification status</vscode-button>
<p>All non-premium features will continue to be free without an account.</p>
</section>
</template>

+ 1
- 1
src/webviews/apps/premium/timeline/partials/state.free-preview-expired.html View File

@ -7,7 +7,7 @@
<p data-visible="private">
The Visual File History is a premium feature, which requires at least a Pro subscription for private repos.
</p>
<p>Create a free account to continue trialing premium features for all code for an additional 7 days.</p>
<p>Create a free account to continue trialing premium features for all repos for an additional 7 days.</p>
<vscode-button data-action="command:gitlens.premium.learn">Learn about premium features</vscode-button>
<vscode-button data-action="command:gitlens.premium.loginOrSignUp">Create a free account</vscode-button>
<span class="button-subaction"

+ 2
- 3
src/webviews/apps/premium/timeline/partials/state.verify-email.html View File

@ -1,11 +1,10 @@
<template id="state:verify-email">
<section>
<!-- <h3>Please verify your email</h3> -->
<p>To continue using premium GitLens features, please verify the email for the account you created.</p>
<h3>Please verify your email</h3>
<p>To use the Visual File History premium feature, please verify the email for the account you created.</p>
<vscode-button data-action="command:gitlens.premium.resendVerification"
>Resend verification email</vscode-button
>
<vscode-button data-action="command:gitlens.premium.validate">Refresh verification status</vscode-button>
<p>All non-premium features will continue to be free without an account.</p>
</section>
</template>

Loading…
Cancel
Save