Skip to content

Commit ef82083

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

File tree

8 files changed

+48
-0
lines changed

8 files changed

+48
-0
lines changed

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17809,6 +17809,15 @@
1780917809
},
1781017810
"when": "gitlens:plus:state == 6"
1781117811
},
17812+
{
17813+
"id": "pro-expired-reactivate",
17814+
"title": "Reactivate Pro Power-up",
17815+
"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",
17816+
"media": {
17817+
"markdown": "walkthroughs/welcome/pro-reactivate.md"
17818+
},
17819+
"when": "gitlens:plus:state == 6"
17820+
},
1781217821
{
1781317822
"id": "visualize",
1781417823
"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
@@ -329,6 +329,7 @@ export type TelemetryEvents = {
329329
| 'pro-trial'
330330
| 'pro-upgrade'
331331
| 'pro-reactivate'
332+
| 'pro-expired-reactivate'
332333
| 'pro-paid'
333334
| 'visualize'
334335
| '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
@@ -24,6 +24,7 @@ const promos: Promo[] = [
2424
SubscriptionState.FreePlusInTrial,
2525
SubscriptionState.FreePlusTrialExpired,
2626
SubscriptionState.FreePlusTrialReactivationEligible,
27+
SubscriptionState.PaidExpired,
2728
],
2829
expiresOn: new Date('2024-09-27T06:59:00.000Z').getTime(),
2930
commandTooltip: 'Launchpad Sale: Save 75% or more on GitLens Pro',

src/plus/gk/account/subscription.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export function getSubscriptionStateString(state: SubscriptionState | undefined)
6767
return 'trial-reactivation-eligible';
6868
case SubscriptionState.Paid:
6969
return 'paid';
70+
case SubscriptionState.PaidExpired:
71+
return 'paid-expired';
7072
default:
7173
return 'unknown';
7274
}
@@ -97,6 +99,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
9799
case SubscriptionPlanId.Pro:
98100
case SubscriptionPlanId.Teams:
99101
case SubscriptionPlanId.Enterprise:
102+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
103+
return SubscriptionState.PaidExpired;
104+
}
105+
100106
return SubscriptionState.Paid;
101107
}
102108
}
@@ -120,6 +126,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
120126

121127
case SubscriptionPlanId.Teams:
122128
case SubscriptionPlanId.Enterprise:
129+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
130+
return SubscriptionState.PaidExpired;
131+
}
132+
123133
return SubscriptionState.Paid;
124134
}
125135
}

src/plus/gk/account/subscriptionService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ export class SubscriptionService implements Disposable {
256256
step: 'pro-paid',
257257
});
258258
break;
259+
case SubscriptionState.PaidExpired:
260+
void executeCommand<OpenWalkthroughCommandArgs>(Commands.OpenWalkthrough, {
261+
...source,
262+
step: 'pro-expired-reactivate',
263+
});
264+
break;
259265
}
260266
}
261267

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
@@ -268,6 +268,13 @@ export class GlFeatureBadge extends LitElement {
268268
${this.renderUpgradeActions(html`<p>Please upgrade for full access to Pro features:</p>`)}`;
269269
break;
270270

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

0 commit comments

Comments
 (0)