Browse Source

Refines subscription & gated feature language

main
Eric Amodio 1 year ago
parent
commit
4698005ad2
12 changed files with 48 additions and 60 deletions
  1. +10
    -9
      package.json
  2. +3
    -2
      src/commands/quickCommand.steps.ts
  3. +6
    -6
      src/git/remotes/richRemoteProvider.ts
  4. +9
    -9
      src/plus/subscription/subscriptionService.ts
  5. +4
    -0
      src/plus/webviews/graph/graphWebview.ts
  6. +1
    -0
      src/plus/webviews/timeline/timelineWebview.ts
  7. +6
    -6
      src/quickpicks/items/directive.ts
  8. +2
    -2
      src/views/commitsView.ts
  9. +2
    -21
      src/views/worktreesView.ts
  10. +3
    -3
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  11. +1
    -1
      src/webviews/apps/settings/partials/commit-graph.html
  12. +1
    -1
      src/webviews/apps/settings/partials/views.worktrees.html

+ 10
- 9
package.json View File

@ -3937,7 +3937,7 @@
"gitlens.plusFeatures.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to hide or show GitLens+ features that are not accessible given the opened repositories and current subscription",
"markdownDescription": "Specifies whether to hide or show features that require a trial or subscription and are not accessible given the opened repositories and current trial or subscription",
"scope": "window",
"order": 60
},
@ -4508,17 +4508,17 @@
},
{
"command": "gitlens.plus.startPreviewTrial",
"title": "Try GitLens+ Features Now",
"title": "Start Free Pro Trial",
"category": "GitLens+"
},
{
"command": "gitlens.plus.manage",
"title": "Manage Your GitLens+ Account...",
"title": "Manage Your Account...",
"category": "GitLens+"
},
{
"command": "gitlens.plus.purchase",
"title": "Upgrade to GitLens Pro...",
"title": "Upgrade to Pro...",
"category": "GitLens+"
},
{
@ -13641,7 +13641,8 @@
},
{
"view": "gitlens.views.worktrees",
"contents": "Worktrees, a [✨ GitLens+ feature](command:gitlens.plus.learn \"Learn more about GitLens+ features\"), help you multitask by minimizing the context switching between branches, allowing you to easily work on different branches of a repository simultaneously.\n\nYou can create multiple working trees, each of which can be opened in individual windows or all together in a single workspace."
"contents": "Worktrees help you multitask by minimizing the context switching between branches, allowing you to easily work on different branches of a repository simultaneously.\n\nYou can create multiple working trees, each of which can be opened in individual windows or all together in a single workspace.",
"when": "!gitlens:plus:required || gitlens:plus:state == 0"
},
{
"view": "gitlens.views.worktrees",
@ -13650,22 +13651,22 @@
},
{
"view": "gitlens.views.worktrees",
"contents": "Please verify your email\n\nTo use Worktrees, please verify your email address.\n\n[Resend verification email](command:gitlens.plus.resendVerification)\n\n[Refresh verification status](command:gitlens.plus.validate)",
"contents": "You must verify your email before you can continue.\n\n[Resend verification email](command:gitlens.plus.resendVerification)\n\n[Refresh verification status](command:gitlens.plus.validate)",
"when": "gitlens:plus:state == -1"
},
{
"view": "gitlens.views.worktrees",
"contents": "[Try worktrees on private repos](command:gitlens.plus.startPreviewTrial)\n\nTo use worktrees and other [GitLens+ features](command:gitlens.plus.learn) on private repos, start a free trial of GitLens Pro, without an account, or [sign in](command:gitlens.plus.loginOrSignUp).",
"contents": "[Start Free Pro Trial](command:gitlens.plus.startPreviewTrial)\n\nInstantly start a free 3-day Pro trial, or [sign in](command:gitlens.plus.loginOrSignUp).\n✨ A trial or subscription is required to use this on privately hosted repos.",
"when": "gitlens:plus:required && gitlens:plus:state == 0"
},
{
"view": "gitlens.views.worktrees",
"contents": "[Extend Pro Trial](command:gitlens.plus.loginOrSignUp)\n\nYour free 3-day GitLens Pro trial has ended, extend your trial to get an additional 7-days of worktrees and other [GitLens+ features](command:gitlens.plus.learn) on private repos.",
"contents": "Your free 3-day Pro trial has ended, extend your free trial to get an additional 7-days, or [sign in](command:gitlens.plus.loginOrSignUp).\n\n[Extend Free Pro Trial](command:gitlens.plus.loginOrSignUp)\n✨ A trial or subscription is required to use this on privately hosted repos.",
"when": "gitlens:plus:required && gitlens:plus:state == 2"
},
{
"view": "gitlens.views.worktrees",
"contents": "[Upgrade to Pro](command:gitlens.plus.purchase)\n\nYour GitLens Pro trial has ended, please upgrade to GitLens Pro to continue to use worktrees and other [GitLens+ features](command:gitlens.plus.learn) on private repos.",
"contents": "Your Pro trial has ended, please upgrade to continue to use this on privately hosted repos.\n\n[Upgrade to Pro](command:gitlens.plus.purchase)\n✨ A subscription is required to use this on privately hosted repos.",
"when": "gitlens:plus:required && gitlens:plus:state == 4"
}
],

+ 3
- 2
src/commands/quickCommand.steps.ts View File

@ -2421,12 +2421,13 @@ export async function* ensureAccessStep<
let placeholder: string;
if (access.subscription.current.account?.verified === false) {
directives.push(createDirectiveQuickPickItem(Directive.RequiresVerification, true));
placeholder = 'You must verify your email address before you can continue';
placeholder = 'You must verify your email before you can continue';
} else {
if (access.subscription.required == null) return undefined;
placeholder = 'You need GitLens Pro to access GitLens+ features on this repo';
placeholder = '✨ Requires a trial or subscription for use on privately hosted repos';
if (isSubscriptionPaidPlan(access.subscription.required) && access.subscription.current.account != null) {
placeholder = '✨ Requires a subscription for use on privately hosted repos';
directives.push(createDirectiveQuickPickItem(Directive.RequiresPaidSubscription, true));
} else if (
access.subscription.current.account == null &&

+ 6
- 6
src/git/remotes/richRemoteProvider.ts View File

@ -517,7 +517,7 @@ export async function ensurePaidPlan(providerName: string, container: Container)
const resend = { title: 'Resend Verification' };
const cancel = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showWarningMessage(
`${title}\n\nYou must verify your email address before you can continue.`,
`${title}\n\nYou must verify your email before you can continue.`,
{ modal: true },
resend,
cancel,
@ -536,10 +536,10 @@ export async function ensurePaidPlan(providerName: string, container: Container)
if (isSubscriptionPaidPlan(plan)) break;
if (subscription.account == null && !isSubscriptionPreviewTrialExpired(subscription)) {
const startTrial = { title: 'Start a GitLens Pro Trial' };
const startTrial = { title: 'Start Free Pro Trial' };
const cancel = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showWarningMessage(
`${title}\n\nDo you want to also try GitLens+ features on private repos, free for 3 days?`,
`${title}\n\nDo you want to also try GitLens+ features on privately hosted repos, free for 3 days?`,
{ modal: true },
startTrial,
cancel,
@ -550,10 +550,10 @@ export async function ensurePaidPlan(providerName: string, container: Container)
void container.subscription.startPreviewTrial();
break;
} else if (subscription.account == null) {
const signIn = { title: 'Extend Your GitLens Pro Trial' };
const signIn = { title: 'Extend Free Pro Trial' };
const cancel = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showWarningMessage(
`${title}\n\nDo you want to continue to use GitLens+ features on private repos, free for an additional 7-days?`,
`${title}\n\nDo you want to continue to use GitLens+ features on privately hosted repos, free for an additional 7-days?`,
{ modal: true },
signIn,
cancel,
@ -568,7 +568,7 @@ export async function ensurePaidPlan(providerName: string, container: Container)
const upgrade = { title: 'Upgrade to Pro' };
const cancel = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showWarningMessage(
`${title}\n\nDo you want to continue to use GitLens+ features on private repos?`,
`${title}\n\nDo you want to continue to use GitLens+ features on privately hosted repos?`,
{ modal: true },
upgrade,
cancel,

+ 9
- 9
src/plus/subscription/subscriptionService.ts View File

@ -253,7 +253,7 @@ export class SubscriptionService implements Disposable {
const confirm: MessageItem = { title: 'Resend Verification', isCloseAffordance: true };
const cancel: MessageItem = { title: 'Cancel' };
const result = await window.showInformationMessage(
`Before you can access ${effective.name}, you must verify your email address.`,
`You must verify your email before you can access ${effective.name}.`,
confirm,
cancel,
);
@ -269,7 +269,7 @@ export class SubscriptionService implements Disposable {
const result = await window.showInformationMessage(
`Welcome to ${
effective.name
} (Trial). You now have additional access to GitLens+ features on private repos for ${pluralize(
} (Trial). You now have additional access to GitLens+ features on privately hosted repos for ${pluralize(
'more day',
remaining ?? 0,
)}.`,
@ -283,7 +283,7 @@ export class SubscriptionService implements Disposable {
}
} else if (isSubscriptionPaid(this._subscription)) {
void window.showInformationMessage(
`Welcome to ${actual.name}. You now have additional access to GitLens+ features on private repos.`,
`Welcome to ${actual.name}. You now have additional access to GitLens+ features on privately hosted repos.`,
'OK',
);
} else {
@ -454,7 +454,7 @@ export class SubscriptionService implements Disposable {
const confirm: MessageItem = { title: 'Extend Your Trial', isCloseAffordance: true };
const cancel: MessageItem = { title: 'Cancel' };
const result = await window.showInformationMessage(
'Your 3-day trial has ended.\nExtend your GitLens Pro trial to continue to use GitLens+ features on private repos, free for an additional 7-days.',
'Your free 3-day trial has ended, extend your free trial to get an additional 7-days.\n\n✨ A trial or subscription is required to use GitLens+ features on privately hosted repos.',
{ modal: true },
confirm,
cancel,
@ -500,7 +500,7 @@ export class SubscriptionService implements Disposable {
const confirm: MessageItem = { title: 'OK', isCloseAffordance: true };
const learn: MessageItem = { title: 'Learn More' };
const result = await window.showInformationMessage(
`You have started a ${days}-day GitLens Pro trial of GitLens+ features on private repos.`,
`You have started a free ${days}-day Pro trial of GitLens+ features on privately hosted repos.`,
{ modal: true },
confirm,
learn,
@ -1046,8 +1046,8 @@ export class SubscriptionService implements Disposable {
);
this._statusBarSubscription.tooltip = new MarkdownString(
trial
? `**Please verify your email**\n\nBefore you can start your **${effective.name}** trial, please verify your email address.\n\nClick for details`
: `**Please verify your email**\n\nBefore you can also use GitLens+ features on private repos, please verify your email address.\n\nClick for details`,
? `**Please verify your email**\n\nYou must verify your email before you can start your **${effective.name}** trial.\n\nClick for details`
: `**Please verify your email**\n\nYou must verify your email before you can also use GitLens+ features on privately hosted repos.\n\nClick for details`,
true,
);
} else {
@ -1055,9 +1055,9 @@ export class SubscriptionService implements Disposable {
this._statusBarSubscription.text = `${effective.name} (Trial)`;
this._statusBarSubscription.tooltip = new MarkdownString(
`You have ${pluralize('day', remaining ?? 0)} left in your **${
`You have ${pluralize('day', remaining ?? 0)} left in your free **${
effective.name
}** trial, which gives you additional access to GitLens+ features on private repos.\n\nClick for details`,
}** trial, which gives you additional access to GitLens+ features on privately hosted repos.\n\nClick for details`,
true,
);
}

+ 4
- 0
src/plus/webviews/graph/graphWebview.ts View File

@ -245,6 +245,10 @@ export class GraphWebviewProvider implements WebviewProvider {
this._theme = window.activeColorTheme;
this.ensureRepositorySubscriptions();
if (this.host.isView()) {
this.host.description = '✨';
}
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
this.container.subscription.onDidChange(this.onSubscriptionChanged, this),

+ 1
- 0
src/plus/webviews/timeline/timelineWebview.ts View File

@ -65,6 +65,7 @@ export class TimelineWebviewProvider implements WebviewProvider {
this.container.git.onDidChangeRepository(this.onRepositoryChanged, this),
);
} else {
this.host.description = '✨';
this._disposable = Disposable.from(
this.container.subscription.onDidChange(this.onSubscriptionChanged, this),
this.container.git.onDidChangeRepository(this.onRepositoryChanged, this),

+ 6
- 6
src/quickpicks/items/directive.ts View File

@ -43,20 +43,20 @@ export function createDirectiveQuickPickItem(
label = 'Try again';
break;
case Directive.StartPreviewTrial:
label = 'Start a GitLens Pro Trial';
detail = 'Try GitLens+ features on private repos, free for 3 days, without an account';
label = 'Start Free Pro Trial';
detail = 'Instantly start a free 3-day Pro trial to use this on privately hosted repos';
break;
case Directive.ExtendTrial:
label = 'Extend Your GitLens Pro Trial';
detail = 'To continue to use GitLens+ features on private repos, free for an additional 7-days';
label = 'Extend Free Pro Trial';
detail = 'Continue to use this on privately hosted repos, free for an additional 7-days';
break;
case Directive.RequiresVerification:
label = 'Resend Verification Email';
detail = 'You must verify your email address before you can continue';
detail = 'You must verify your email before you can continue';
break;
case Directive.RequiresPaidSubscription:
label = 'Upgrade to Pro';
detail = 'To use GitLens+ features on private repos';
detail = 'A subscription is required to use this on privately hosted repos';
break;
}
}

+ 2
- 2
src/views/commitsView.ts View File

@ -147,8 +147,8 @@ export class CommitsViewNode extends RepositoriesSubscribeableNode
this.view,
this,
{ command: Commands.ShowGraph, title: 'Show Commit Graph' },
'Visualize commits on the Commit Graph',
'✨ GitLens+ feature',
'Visualize commits on the Commit Graph',
undefined,
'Visualize commits on the Commit Graph ✨',
new ThemeIcon('gitlens-graph'),
)

+ 2
- 21
src/views/worktreesView.ts View File

@ -11,11 +11,10 @@ import type { RepositoryChangeEvent } from '../git/models/repository';
import { RepositoryChange, RepositoryChangeComparisonMode } from '../git/models/repository';
import type { GitWorktree } from '../git/models/worktree';
import { ensurePlusFeaturesEnabled } from '../plus/subscription/utils';
import { getSubscriptionTimeRemaining, SubscriptionState } from '../subscription';
import { SubscriptionState } from '../subscription';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { gate } from '../system/decorators/gate';
import { pluralize } from '../system/string';
import { RepositoryNode } from './nodes/repositoryNode';
import type { ViewNode } from './nodes/viewNode';
import { RepositoriesSubscribeableNode, RepositoryFolderNode } from './nodes/viewNode';
@ -148,25 +147,7 @@ export class WorktreesView extends ViewBase
private async updateDescription() {
const subscription = await this.container.subscription.getSubscription();
switch (subscription.state) {
case SubscriptionState.Free:
case SubscriptionState.FreePreviewTrialExpired:
case SubscriptionState.FreePlusTrialExpired:
this.description = '✨ GitLens+ feature';
break;
case SubscriptionState.FreeInPreviewTrial:
case SubscriptionState.FreePlusInTrial: {
const days = getSubscriptionTimeRemaining(subscription, 'days')!;
this.description = `✨ GitLens Pro (Trial), ${days < 1 ? '<1 day' : pluralize('day', days)} left`;
break;
}
case SubscriptionState.VerificationRequired:
this.description = `${subscription.plan.effective.name} (Unverified)`;
break;
case SubscriptionState.Paid:
this.description = undefined;
}
this.description = subscription.state === SubscriptionState.Paid ? undefined : '✨';
}
protected getRoot() {

+ 3
- 3
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -1024,10 +1024,10 @@ export function GraphWrapper({
</span>
<PopOver placement="top end" className="badge-popover">
{isPro
? 'You have access to all GitLens and GitLens+ features on any repo.'
: 'You have access to GitLens+ features on local & public repos, and all other GitLens features on any repo.'}
? 'You have access to all GitLens features on any repo.'
: 'You have access to features on local & public repos, and all other GitLens features on any repo.'}
<br />
<br /> indicates GitLens+ features
<br /> indicates a subscription is required to use this feature on privately hosted repos.
</PopOver>
</span>
);

+ 1
- 1
src/webviews/apps/settings/partials/commit-graph.html View File

@ -1,7 +1,7 @@
<section id="commit-graph" class="section--settings section--collapsible">
<div class="section__header">
<h2>
<span title="GitLens+ feature"></span> Commit Graph
<span title="Requires a trial or subscription for use on privately hosted repos"></span> Commit Graph
<a
class="link__learn-more"
title="Learn more"

+ 1
- 1
src/webviews/apps/settings/partials/views.worktrees.html View File

@ -1,7 +1,7 @@
<section id="worktrees-view" class="section--settings section--collapsible">
<div class="section__header">
<h2>
<span title="GitLens+ feature"></span> Worktrees view
<span title="Requires a trial or subscription for use on privately hosted repos"></span> Worktrees view
<a
class="link__learn-more"
title="Learn more"

Loading…
Cancel
Save