Skip to content

Commit 87048b3

Browse files
committed
Add new Paid Expired state to detect when a license has expired
1 parent 6bec708 commit 87048b3

File tree

8 files changed

+50
-0
lines changed

8 files changed

+50
-0
lines changed

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17839,6 +17839,15 @@
1783917839
},
1784017840
"when": "gitlens:plus:state == 6"
1784117841
},
17842+
{
17843+
"id": "pro-expired-reactivate",
17844+
"title": "Reactivate Pro Power-up",
17845+
"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",
17846+
"media": {
17847+
"markdown": "walkthroughs/welcome/pro-reactivate.md"
17848+
},
17849+
"when": "gitlens:plus:state == 6"
17850+
},
1784217851
{
1784317852
"id": "visualize",
1784417853
"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
@@ -336,6 +336,7 @@ export type TelemetryEvents = {
336336
| 'pro-trial'
337337
| 'pro-upgrade'
338338
| 'pro-reactivate'
339+
| 'pro-expired-reactivate'
339340
| 'pro-paid'
340341
| 'visualize'
341342
| '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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const promos: Promo[] = [
2424
SubscriptionState.ProTrial,
2525
SubscriptionState.ProTrialExpired,
2626
SubscriptionState.ProTrialReactivationEligible,
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',
@@ -38,6 +39,7 @@ const promos: Promo[] = [
3839
SubscriptionState.ProTrial,
3940
SubscriptionState.ProTrialExpired,
4041
SubscriptionState.ProTrialReactivationEligible,
42+
SubscriptionState.PaidExpired,
4143
],
4244
startsOn: new Date('2024-09-27T06:59:00.000Z').getTime(),
4345
expiresOn: new Date('2024-10-14T06:59:00.000Z').getTime(),
@@ -52,6 +54,7 @@ const promos: Promo[] = [
5254
SubscriptionState.ProTrial,
5355
SubscriptionState.ProTrialExpired,
5456
SubscriptionState.ProTrialReactivationEligible,
57+
SubscriptionState.PaidExpired,
5558
],
5659
commandTooltip: 'Limited-Time Sale: Save 33% or more on your 1st seat of Pro. See your special price',
5760
},

src/plus/gk/account/subscription.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export function getSubscriptionStateString(state: SubscriptionState | undefined)
9393
return 'trial-reactivation-eligible';
9494
case SubscriptionState.Paid:
9595
return 'paid';
96+
case SubscriptionState.PaidExpired:
97+
return 'paid-expired';
9698
default:
9799
return 'unknown';
98100
}
@@ -123,6 +125,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
123125
case SubscriptionPlanId.Pro:
124126
case SubscriptionPlanId.Teams:
125127
case SubscriptionPlanId.Enterprise:
128+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
129+
return SubscriptionState.PaidExpired;
130+
}
131+
126132
return SubscriptionState.Paid;
127133
}
128134
}
@@ -146,6 +152,10 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
146152

147153
case SubscriptionPlanId.Teams:
148154
case SubscriptionPlanId.Enterprise:
155+
if (effective.expiresOn != null && new Date(effective.expiresOn) < new Date()) {
156+
return SubscriptionState.PaidExpired;
157+
}
158+
149159
return SubscriptionState.Paid;
150160
}
151161
}

src/plus/gk/account/subscriptionService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ export class SubscriptionService implements Disposable {
311311
step: 'pro-paid',
312312
});
313313
break;
314+
case SubscriptionState.PaidExpired:
315+
void executeCommand<OpenWalkthroughCommandArgs>(Commands.OpenWalkthrough, {
316+
...source,
317+
step: 'pro-expired-reactivate',
318+
});
319+
break;
314320
}
315321
}
316322

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
@@ -165,6 +165,19 @@ export class GlFeatureGatePlusState extends LitElement {
165165
features.
166166
</p>`;
167167

168+
case SubscriptionState.PaidExpired:
169+
return html` <gl-button
170+
appearance="${appearance}"
171+
href="${generateCommandLink(Commands.PlusUpgrade, this.source)}"
172+
>Upgrade to Pro</gl-button
173+
>
174+
${this.renderPromo(promo)}
175+
<p>
176+
Your Pro license has ended. Please upgrade for full access to
177+
${this.featureWithArticleIfNeeded ? `${this.featureWithArticleIfNeeded} and other ` : ''}Pro
178+
features.
179+
</p>`;
180+
168181
case SubscriptionState.ProTrialReactivationEligible:
169182
return html`
170183
<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.ProTrialReactivationEligible:
272279
content = html`<p>
273280
Reactivate your Pro trial and experience all the new Pro features — free for another

0 commit comments

Comments
 (0)