Skip to content

Commit 3d14a2c

Browse files
committed
deprecate current 3 day preview trial & add feature preview trial
1 parent 0ba8828 commit 3d14a2c

File tree

9 files changed

+58
-22
lines changed

9 files changed

+58
-22
lines changed

package.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5733,11 +5733,6 @@
57335733
"title": "Sign Up for GitKraken...",
57345734
"category": "GitLens"
57355735
},
5736-
{
5737-
"command": "gitlens.plus.startPreviewTrial",
5738-
"title": "Preview Pro",
5739-
"category": "GitLens"
5740-
},
57415736
{
57425737
"command": "gitlens.plus.reactivateProTrial",
57435738
"title": "Reactivate Pro Trial",
@@ -10220,10 +10215,6 @@
1022010215
"command": "gitlens.plus.signUp",
1022110216
"when": "!gitlens:plus"
1022210217
},
10223-
{
10224-
"command": "gitlens.plus.startPreviewTrial",
10225-
"when": "!gitlens:plus"
10226-
},
1022710218
{
1022810219
"command": "gitlens.plus.reactivateProTrial",
1022910220
"when": "gitlens:plus:state == 5"
@@ -19372,7 +19363,7 @@
1937219363
},
1937319364
{
1937419365
"view": "gitlens.views.worktrees",
19375-
"contents": "[Continue](command:gitlens.plus.startPreviewTrial?%7B%22source%22%3A%22worktrees%22%7D)\n\nContinuing gives you 3 days to preview Worktrees and other local Pro features for 3 days. [Start 7-day Pro trial](command:gitlens.plus.signUp?%7B%22source%22%3A%22worktrees%22%7D) or [sign in](command:gitlens.plus.login?%7B%22source%22%3A%22worktrees%22%7D) for full access to Pro features.",
19366+
"contents": "[Start 7-day Pro trial](command:gitlens.plus.signUp?%7B%22source%22%3A%22worktrees%22%7D) or [sign in](command:gitlens.plus.login?%7B%22source%22%3A%22worktrees%22%7D) for full access to Pro features.",
1937619367
"when": "gitlens:plus:required && gitlens:plus:state == 0"
1937719368
},
1937819369
{

src/commands/quickCommand.steps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import type { GitWorktree, WorktreeQuickPickItem } from '../git/models/worktree'
4444
import { createWorktreeQuickPickItem, getWorktreesByBranch, sortWorktrees } from '../git/models/worktree';
4545
import { remoteUrlRegex } from '../git/parsers/remoteParser';
4646
import { getApplicablePromo } from '../plus/gk/account/promos';
47-
import { isSubscriptionPaidPlan, isSubscriptionPreviewTrialExpired } from '../plus/gk/account/subscription';
47+
import { isSubscriptionPaidPlan } from '../plus/gk/account/subscription';
4848
import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
4949
import {
5050
CommitApplyFileChangesCommandQuickPickItem,
@@ -2645,7 +2645,7 @@ export async function* ensureAccessStep<
26452645
createQuickPickSeparator(),
26462646
createDirectiveQuickPickItem(Directive.Cancel),
26472647
);
2648-
} else if (
2648+
} /*else if (
26492649
access.subscription.current.account == null &&
26502650
!isSubscriptionPreviewTrialExpired(access.subscription.current)
26512651
) {
@@ -2654,7 +2654,7 @@ export async function* ensureAccessStep<
26542654
createQuickPickSeparator(),
26552655
createDirectiveQuickPickItem(Directive.Cancel),
26562656
);
2657-
} else {
2657+
}*/ else {
26582658
directives.push(
26592659
createDirectiveQuickPickItem(Directive.StartProTrial, true),
26602660
createDirectiveQuickPickItem(Directive.SignIn),

src/commands/quickWizard.base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ export abstract class QuickWizardCommandBase extends Command {
704704
return;
705705
}
706706

707+
/*
707708
case Directive.StartPreview:
708709
await Container.instance.subscription.startPreviewTrial({
709710
source: 'quick-wizard',
@@ -714,7 +715,7 @@ export abstract class QuickWizardCommandBase extends Command {
714715
});
715716
resolve(await rootStep.command?.retry());
716717
return;
717-
718+
*/
718719
case Directive.RequiresVerification: {
719720
const result = await Container.instance.subscription.resendVerification({
720721
source: 'quick-wizard',

src/constants.commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const enum Commands {
150150
PlusShowPlans = 'gitlens.plus.showPlans',
151151
PlusSignUp = 'gitlens.plus.signUp',
152152
PlusStartPreviewTrial = 'gitlens.plus.startPreviewTrial',
153+
PlusStartFeaturePreviewTrial = 'gitlens.plus.startFeaturePreviewTrial',
153154
PlusUpgrade = 'gitlens.plus.upgrade',
154155
PlusValidate = 'gitlens.plus.validate',
155156
PlusSimulateSubscription = 'gitlens.plus.simulateSubscription',

src/plus/gk/account/subscriptionService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ export class SubscriptionService implements Disposable {
242242
registerCommand(Commands.PlusManage, (src?: Source) => this.manage(src)),
243243
registerCommand(Commands.PlusShowPlans, (src?: Source) => this.showPlans(src)),
244244
registerCommand(Commands.PlusStartPreviewTrial, (src?: Source) => this.startPreviewTrial(src)),
245+
registerCommand(Commands.PlusStartFeaturePreviewTrial, (src?: Source) =>
246+
this.startFeaturePreviewTrial(src),
247+
),
245248
registerCommand(Commands.PlusReactivateProTrial, (src?: Source) => this.reactivateProTrial(src)),
246249
registerCommand(Commands.PlusResendVerification, (src?: Source) => this.resendVerification(src)),
247250
registerCommand(Commands.PlusUpgrade, (src?: Source) => this.upgrade(src)),
@@ -727,6 +730,10 @@ export class SubscriptionService implements Disposable {
727730
}, 1);
728731
}
729732

733+
@gate(() => '')
734+
@log()
735+
async startFeaturePreviewTrial(_: Source | undefined): Promise<void> {}
736+
730737
@log()
731738
async upgrade(source: Source | undefined): Promise<void> {
732739
const scope = getLogScope();

src/plus/utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { proTrialLengthInDays } from '../constants.subscription';
55
import type { Source } from '../constants.telemetry';
66
import type { Container } from '../container';
77
import { openUrl } from '../system/vscode/utils';
8-
import { isSubscriptionPaidPlan, isSubscriptionPreviewTrialExpired } from './gk/account/subscription';
8+
import { isSubscriptionPaidPlan } from './gk/account/subscription';
99

1010
export async function ensurePaidPlan(
1111
container: Container,
1212
title: string,
1313
source: Source,
14-
options?: { allowPreview?: boolean },
14+
_?: { allowPreview?: boolean },
1515
): Promise<boolean> {
1616
while (true) {
1717
const subscription = await container.subscription.getSubscription();
@@ -37,7 +37,7 @@ export async function ensurePaidPlan(
3737
const plan = subscription.plan.effective.id;
3838
if (isSubscriptionPaidPlan(plan)) break;
3939

40-
if (options?.allowPreview && subscription.account == null && !isSubscriptionPreviewTrialExpired(subscription)) {
40+
/*if (options?.allowPreview && subscription.account == null && !isSubscriptionPreviewTrialExpired(subscription)) {
4141
const startTrial = { title: 'Continue' };
4242
const cancel = { title: 'Cancel', isCloseAffordance: true };
4343
const result = await window.showWarningMessage(
@@ -51,7 +51,8 @@ export async function ensurePaidPlan(
5151
5252
void container.subscription.startPreviewTrial(source);
5353
break;
54-
} else if (subscription.account == null) {
54+
} else */
55+
if (subscription.account == null) {
5556
const signUp = { title: 'Start Pro Trial' };
5657
const signIn = { title: 'Sign In' };
5758
const cancel = { title: 'Cancel', isCloseAffordance: true };

src/webviews/apps/plus/graph/GraphWrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ export function GraphWrapper({
15301530
</header>
15311531
<GlFeatureGate
15321532
className="graph-app__gate"
1533+
allowFeaturePreviewTrial={true}
15331534
appearance="alert"
15341535
featureWithArticleIfNeeded="the Commit Graph"
15351536
source={{ source: 'graph', detail: 'gate' }}

src/webviews/apps/plus/shared/components/feature-gate-plus-state.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css, html, LitElement, nothing } from 'lit';
22
import { customElement, property, query } from 'lit/decorators.js';
33
import { Commands } from '../../../../../constants.commands';
4-
import { proTrialLengthInDays, SubscriptionState } from '../../../../../constants.subscription';
4+
import { proPreviewLengthInDays, proTrialLengthInDays, SubscriptionState } from '../../../../../constants.subscription';
55
import type { Source } from '../../../../../constants.telemetry';
66
import type { Promo } from '../../../../../plus/gk/account/promos';
77
import { getApplicablePromo } from '../../../../../plus/gk/account/promos';
@@ -69,6 +69,9 @@ export class GlFeatureGatePlusState extends LitElement {
6969
@query('gl-button')
7070
private readonly button!: GlButton;
7171

72+
@property({ type: Boolean })
73+
allowFeaturePreviewTrial?: boolean;
74+
7275
@property({ type: String })
7376
appearance?: 'alert' | 'welcome';
7477

@@ -96,6 +99,8 @@ export class GlFeatureGatePlusState extends LitElement {
9699
this.hidden = false;
97100
const appearance = (this.appearance ?? 'alert') === 'alert' ? 'alert' : nothing;
98101
const promo = this.state ? getApplicablePromo(this.state, 'gate') : undefined;
102+
const consumedDays = 0;
103+
//this.container.storage.get(`plus:featurePreviewTrial:${this.source?.source}:consumedDays`) ?? 0;
99104

100105
switch (this.state) {
101106
case SubscriptionState.VerificationRequired:
@@ -118,15 +123,40 @@ export class GlFeatureGatePlusState extends LitElement {
118123
`;
119124

120125
case SubscriptionState.Community:
126+
if (this.allowFeaturePreviewTrial) {
127+
return html`
128+
<gl-button
129+
appearance="${appearance}"
130+
href="${generateCommandLink(Commands.PlusStartFeaturePreviewTrial, this.source)}"
131+
>Continue</gl-button
132+
>
133+
<p>
134+
Continuing gives you ${proPreviewLengthInDays - consumedDays}
135+
day${proPreviewLengthInDays - consumedDays !== 1 ? 's' : ''} to preview
136+
${this.featureWithArticleIfNeeded
137+
? `${this.featureWithArticleIfNeeded} and other `
138+
: ''}local
139+
Pro features.<br />
140+
${appearance !== 'alert' ? html`<br />` : ''} For full access to Pro features
141+
<a href="${generateCommandLink(Commands.PlusSignUp, this.source)}"
142+
>start your free ${proTrialLengthInDays}-day Pro trial</a
143+
>
144+
or
145+
<a href="${generateCommandLink(Commands.PlusLogin, this.source)}" title="Sign In">sign in</a
146+
>.
147+
</p>
148+
`;
149+
}
150+
121151
return html`
122152
<gl-button
123153
appearance="${appearance}"
124-
href="${generateCommandLink(Commands.PlusStartPreviewTrial, this.source)}"
154+
href="${generateCommandLink(Commands.PlusSignUp, this.source)}"
125155
>Continue</gl-button
126156
>
127157
<p>
128-
Continuing gives you 3 days to preview
129-
${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} and other ` : ''}local
158+
Continuing gives you ${proTrialLengthInDays} days to preview
159+
${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} and other ` : ''}local
130160
Pro features.<br />
131161
${appearance !== 'alert' ? html`<br />` : ''} For full access to Pro features
132162
<a href="${generateCommandLink(Commands.PlusSignUp, this.source)}"

src/webviews/apps/shared/components/feature-gate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export class GlFeatureGate extends LitElement {
9090
}
9191
`;
9292

93+
@property({ type: Boolean })
94+
allowFeaturePreviewTrial?: boolean;
95+
9396
@property({ reflect: true })
9497
appearance?: 'alert' | 'welcome';
9598

@@ -126,6 +129,7 @@ export class GlFeatureGate extends LitElement {
126129
.featureWithArticleIfNeeded=${this.featureWithArticleIfNeeded}
127130
.source=${this.source}
128131
.state=${this.state}
132+
.allowFeaturePreviewTrial=${this.allowFeaturePreviewTrial}
129133
></gl-feature-gate-plus-state>
130134
</section>
131135
`;

0 commit comments

Comments
 (0)