Skip to content

Commit beda0e0

Browse files
committed
Add new Paid Expired state to detect when a license has expired
1 parent d640245 commit beda0e0

File tree

9 files changed

+64
-0
lines changed

9 files changed

+64
-0
lines changed

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17880,6 +17880,15 @@
1788017880
},
1788117881
"when": "gitlens:plus:state == 6"
1788217882
},
17883+
{
17884+
"id": "pro-expired-reactivate",
17885+
"title": "Reactivate Pro Power-up",
17886+
"description": "Reactivate your Pro account and experience all the new [Pro features](https://gitkraken.com/gitlens/pro-features?utm_source=gitlens-extension&utm_medium=in-app-links) and the full [GitKraken DevEx platform](https://gitkraken.com/devex?utm_source=gitlens-extension&utm_medium=in-app-links).\n\n[Reactivate Pro](command:gitlens.plus.upgrade?%7B%22source%22%3A%22walkthrough%22%7D)\n\n**Pro Features**\n$(gitlens-graph)  [Commit Graph](command:gitlens.openWalkthrough?%7B%22step%22%3A%22visualize%22,%22source%22%3A%22walkthrough%22%7D) — visualize your repository and keep track of all work in progress\n$(rocket)  [Launchpad](command:gitlens.openWalkthrough?%7B%22step%22%3A%22launchpad%22,%22source%22%3A%22walkthrough%22%7D) — stay focused and keep your team unblocked\n$(gitlens-code-suggestion)  [Code Suggest](command:gitlens.openWalkthrough?%7B%22step%22%3A%22code-collab%22,%22source%22%3A%22walkthrough%22%7D) — free your code reviews from unnecessary restrictions\n$(gitlens-cloud-patch)  [Cloud Patches](command:gitlens.openWalkthrough?%7B%22step%22%3A%22code-collab%22,%22source%22%3A%22walkthrough%22%7D) — easily and securely share code with your teammates\n$(gitlens-worktrees-view)  **Worktrees** — work on multiple branches simultaneously\n$(gitlens-workspaces-view)  **Workspaces** — group and manage multiple repositories together\n$(graph-scatter)  [Visual File History](command:gitlens.openWalkthrough?%7B%22step%22%3A%22visualize%22,%22source%22%3A%22walkthrough%22%7D) — visualize the evolution of a file and quickly identify when the most impactful changes were made and by whom",
17887+
"media": {
17888+
"markdown": "walkthroughs/welcome/pro-reactivate.md"
17889+
},
17890+
"when": "gitlens:plus:state == 6"
17891+
},
1788317892
{
1788417893
"id": "visualize",
1788517894
"title": "Visualize with Commit Graph & Visual File History",

src/constants.telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ export type TelemetryEvents = {
381381
| 'pro-trial'
382382
| 'pro-upgrade'
383383
| 'pro-reactivate'
384+
| 'pro-expired-reactivate'
384385
| 'pro-paid'
385386
| 'visualize'
386387
| 'launchpad'

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export type WalkthroughSteps =
179179
| 'pro-trial'
180180
| 'pro-upgrade'
181181
| 'pro-reactivate'
182+
| 'pro-expired-reactivate'
182183
| 'pro-paid'
183184
| 'visualize'
184185
| 'launchpad'

src/plus/gk/account/promos.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const promos: Promo[] = [
2121
SubscriptionState.FreePlusInTrial,
2222
SubscriptionState.FreePlusTrialExpired,
2323
SubscriptionState.FreePlusTrialReactivationEligible,
24+
SubscriptionState.PaidExpired,
2425
],
2526
expiresOn: new Date('2024-09-10T06:59:00.000Z').getTime(),
2627
commandTooltip: 'Sale: Save up to 80% on GitLens Pro - lowest price of the year!',

src/plus/gk/account/subscription.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export const enum SubscriptionState {
7575
FreePlusTrialReactivationEligible = 5,
7676
/** Indicates a Paid user */
7777
Paid = 6,
78+
/** Indicates a Paid user whose subscription has expired */
79+
PaidExpired = 7,
7880
}
7981

8082
export function getSubscriptionStateString(state: SubscriptionState | undefined): string {
@@ -95,6 +97,8 @@ export function getSubscriptionStateString(state: SubscriptionState | undefined)
9597
return 'trial-reactivation-eligible';
9698
case SubscriptionState.Paid:
9799
return 'paid';
100+
case SubscriptionState.PaidExpired:
101+
return 'paid-expired';
98102
default:
99103
return 'unknown';
100104
}
@@ -125,6 +129,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
125129
case SubscriptionPlanId.Pro:
126130
case SubscriptionPlanId.Teams:
127131
case SubscriptionPlanId.Enterprise:
132+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
133+
return SubscriptionState.PaidExpired;
134+
}
135+
128136
return SubscriptionState.Paid;
129137
}
130138
}
@@ -148,6 +156,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
148156

149157
case SubscriptionPlanId.Teams:
150158
case SubscriptionPlanId.Enterprise:
159+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
160+
return SubscriptionState.PaidExpired;
161+
}
162+
151163
return SubscriptionState.Paid;
152164
}
153165
}

src/plus/gk/account/subscriptionService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ export class SubscriptionService implements Disposable {
258258
step: 'pro-paid',
259259
});
260260
break;
261+
case SubscriptionState.PaidExpired:
262+
void executeCommand<OpenWalkthroughCommandArgs>(Commands.OpenWalkthrough, {
263+
...source,
264+
step: 'pro-expired-reactivate',
265+
});
266+
break;
261267
}
262268
}
263269

src/webviews/apps/plus/account/components/account-content.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,20 @@ export class AccountContent extends LitElement {
271271
</p>
272272
`;
273273

274+
case SubscriptionState.PaidExpired:
275+
return html`
276+
<p>
277+
Your ${getSubscriptionPlanName(this.planId)} plan has ended. Reactivate your
278+
${getSubscriptionPlanName(this.planId)} account and experience all the new
279+
<a href="${urls.proFeatures}">Pro features</a> and the full
280+
<a href="${urls.platform}">GitKraken DevEx platform</a>
281+
</p>
282+
<button-container>
283+
<gl-button full href="command:gitlens.plus.upgrade">Upgrade to Pro</gl-button>
284+
</button-container>
285+
${this.renderPromo(promo)} ${this.renderIncludesDevEx()}
286+
`;
287+
274288
case SubscriptionState.VerificationRequired:
275289
return html`
276290
<p>You must verify your email before you can access Pro features.</p>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ export class GlFeatureGatePlusState extends LitElement {
164164
features.
165165
</p>`;
166166

167+
case SubscriptionState.PaidExpired:
168+
return html` <gl-button
169+
appearance="${appearance}"
170+
href="${generateCommandLink(Commands.PlusUpgrade, this.source)}"
171+
>Upgrade to Pro</gl-button
172+
>
173+
${this.renderPromo(promo)}
174+
<p>
175+
Your Pro license has ended. Please upgrade for full access to
176+
${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} and other ` : ''}Pro
177+
features.
178+
</p>`;
179+
167180
case SubscriptionState.FreePlusTrialReactivationEligible:
168181
return html`
169182
<gl-button

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ export class GlFeatureBadge extends LitElement {
269269
${this.renderUpgradeActions(html`<p>Please upgrade for full access to Pro features:</p>`)}`;
270270
break;
271271

272+
case SubscriptionState.PaidExpired:
273+
content = html`<p>
274+
Your Pro license as ended. You can now only use Pro features on publicly-hosted repos.
275+
</p>
276+
${this.renderUpgradeActions(html`<p>Please upgrade for full access to Pro features:</p>`)}`;
277+
break;
278+
272279
case SubscriptionState.FreePlusTrialReactivationEligible:
273280
content = html`<p>
274281
Reactivate your Pro trial and experience all the new Pro features — free for another 7 days!

0 commit comments

Comments
 (0)