Skip to content

Commit dfbbcf6

Browse files
Updates subscriptions
- Adds Advanced tier -Improves default subscription Updates trial subscriptions
1 parent 850dfb7 commit dfbbcf6

File tree

11 files changed

+100
-33
lines changed

11 files changed

+100
-33
lines changed

LICENSE.plus

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ with, the GitKraken End User License Agreement, available at
1313
https://gitkraken.com/eula (the "EULA"), or other agreement governing the
1414
use of the Software, as agreed by you and GitKraken, and otherwise have a valid
1515
subscription for the correct number of user seats for the applicable version of
16-
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Teams, and GitLens+
17-
Enterprise). Subject to the foregoing sentence, you are free to modify this
18-
Software and publish patches to the Software. You agree that GitKraken and/or
16+
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Advanced, GitLens+ Teams,
17+
and GitLens+ Enterprise). Subject to the foregoing sentence, you are free to modify
18+
this Software and publish patches to the Software. You agree that GitKraken and/or
1919
its licensors (as applicable) retain all right, title and interest in and to all
2020
such modifications and/or patches, and all such modifications and/or patches may
2121
only be used, copied, modified, displayed, distributed, or otherwise exploited

docs/telemetry-events.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
'global.subscription.actual.bundle': boolean,
5151
'global.subscription.actual.cancelled': boolean,
5252
'global.subscription.actual.expiresOn': string,
53-
'global.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
53+
'global.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
5454
'global.subscription.actual.nextTrialOptInDate': string,
5555
'global.subscription.actual.organizationId': string,
5656
'global.subscription.actual.startedOn': string,
5757
'global.subscription.actual.trialReactivationCount': number,
5858
'global.subscription.effective.bundle': boolean,
5959
'global.subscription.effective.cancelled': boolean,
6060
'global.subscription.effective.expiresOn': string,
61-
'global.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
61+
'global.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
6262
'global.subscription.effective.nextTrialOptInDate': string,
6363
'global.subscription.effective.organizationId': string,
6464
'global.subscription.effective.startedOn': string,
@@ -1771,15 +1771,15 @@ void
17711771
'subscription.actual.bundle': boolean,
17721772
'subscription.actual.cancelled': boolean,
17731773
'subscription.actual.expiresOn': string,
1774-
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1774+
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
17751775
'subscription.actual.nextTrialOptInDate': string,
17761776
'subscription.actual.organizationId': string,
17771777
'subscription.actual.startedOn': string,
17781778
'subscription.actual.trialReactivationCount': number,
17791779
'subscription.effective.bundle': boolean,
17801780
'subscription.effective.cancelled': boolean,
17811781
'subscription.effective.expiresOn': string,
1782-
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1782+
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
17831783
'subscription.effective.nextTrialOptInDate': string,
17841784
'subscription.effective.organizationId': string,
17851785
'subscription.effective.startedOn': string,
@@ -1860,15 +1860,15 @@ or
18601860
'previous.subscription.actual.bundle': boolean,
18611861
'previous.subscription.actual.cancelled': boolean,
18621862
'previous.subscription.actual.expiresOn': string,
1863-
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1863+
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
18641864
'previous.subscription.actual.nextTrialOptInDate': string,
18651865
'previous.subscription.actual.organizationId': string,
18661866
'previous.subscription.actual.startedOn': string,
18671867
'previous.subscription.actual.trialReactivationCount': number,
18681868
'previous.subscription.effective.bundle': boolean,
18691869
'previous.subscription.effective.cancelled': boolean,
18701870
'previous.subscription.effective.expiresOn': string,
1871-
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1871+
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
18721872
'previous.subscription.effective.nextTrialOptInDate': string,
18731873
'previous.subscription.effective.organizationId': string,
18741874
'previous.subscription.effective.startedOn': string,
@@ -1878,15 +1878,15 @@ or
18781878
'subscription.actual.bundle': boolean,
18791879
'subscription.actual.cancelled': boolean,
18801880
'subscription.actual.expiresOn': string,
1881-
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1881+
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
18821882
'subscription.actual.nextTrialOptInDate': string,
18831883
'subscription.actual.organizationId': string,
18841884
'subscription.actual.startedOn': string,
18851885
'subscription.actual.trialReactivationCount': number,
18861886
'subscription.effective.bundle': boolean,
18871887
'subscription.effective.cancelled': boolean,
18881888
'subscription.effective.expiresOn': string,
1889-
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'teams' | 'enterprise',
1889+
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
18901890
'subscription.effective.nextTrialOptInDate': string,
18911891
'subscription.effective.organizationId': string,
18921892
'subscription.effective.startedOn': string,

src/constants.storage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,25 @@ export interface StoredGKLicense {
184184

185185
export type StoredGKLicenseType =
186186
| 'gitlens-pro'
187+
| 'gitlens-advanced'
187188
| 'gitlens-teams'
188189
| 'gitlens-hosted-enterprise'
189190
| 'gitlens-self-hosted-enterprise'
190191
| 'gitlens-standalone-enterprise'
191192
| 'bundle-pro'
193+
| 'bundle-advanced'
192194
| 'bundle-teams'
193195
| 'bundle-hosted-enterprise'
194196
| 'bundle-self-hosted-enterprise'
195197
| 'bundle-standalone-enterprise'
196198
| 'gitkraken_v1-pro'
199+
| 'gitkraken_v1-advanced'
197200
| 'gitkraken_v1-teams'
198201
| 'gitkraken_v1-hosted-enterprise'
199202
| 'gitkraken_v1-self-hosted-enterprise'
200203
| 'gitkraken_v1-standalone-enterprise'
201204
| 'gitkraken-v1-pro'
205+
| 'gitkraken-v1-advanced'
202206
| 'gitkraken-v1-teams'
203207
| 'gitkraken-v1-hosted-enterprise'
204208
| 'gitkraken-v1-self-hosted-enterprise'

src/constants.subscription.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const enum SubscriptionPlanId {
77
Community = 'community',
88
CommunityWithAccount = 'community-with-account',
99
Pro = 'pro',
10+
Advanced = 'advanced',
1011
Teams = 'teams',
1112
Enterprise = 'enterprise',
1213
}

src/plus/LICENSE.plus

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ with, the GitKraken End User License Agreement, available at
1313
https://gitkraken.com/eula (the "EULA"), or other agreement governing the
1414
use of the Software, as agreed by you and GitKraken, and otherwise have a valid
1515
subscription for the correct number of user seats for the applicable version of
16-
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Teams, and GitLens+
17-
Enterprise). Subject to the foregoing sentence, you are free to modify this
18-
Software and publish patches to the Software. You agree that GitKraken and/or
16+
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Advanced, GitLens+ Teams,
17+
and GitLens+ Enterprise). Subject to the foregoing sentence, you are free to modify
18+
this Software and publish patches to the Software. You agree that GitKraken and/or
1919
its licensors (as applicable) retain all right, title and interest in and to all
2020
such modifications and/or patches, and all such modifications and/or patches may
2121
only be used, copied, modified, displayed, distributed, or otherwise exploited

src/plus/gk/__debug__accountDebug.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ type SimulateQuickPickItem = QuickPickItemOfT<
5656
state: SubscriptionState.ProTrial;
5757
reactivatedTrial?: boolean;
5858
expiredPaid?: never;
59-
planId?: never;
59+
planId?: SubscriptionPlanId.Advanced;
6060
featurePreviews?: never;
6161
}
6262
| {
6363
state: SubscriptionState.Paid;
6464
reactivatedTrial?: never;
6565
expiredPaid?: boolean;
66-
planId?: SubscriptionPlanId.Pro | SubscriptionPlanId.Teams | SubscriptionPlanId.Enterprise;
66+
planId?:
67+
| SubscriptionPlanId.Pro
68+
| SubscriptionPlanId.Teams
69+
| SubscriptionPlanId.Advanced
70+
| SubscriptionPlanId.Enterprise;
6771
featurePreviews?: never;
6872
}
6973
>;
@@ -149,6 +153,22 @@ class AccountDebug {
149153
reactivatedTrial: true,
150154
},
151155
},
156+
{
157+
label: 'Pro Trial (Advanced)',
158+
description: 'Advanced, account',
159+
iconPath: new ThemeIcon('blank'),
160+
item: { state: SubscriptionState.ProTrial, planId: SubscriptionPlanId.Advanced },
161+
},
162+
{
163+
label: 'Pro Trial (Advanced Reactivated)',
164+
description: 'Advanced, account',
165+
iconPath: new ThemeIcon('blank'),
166+
item: {
167+
state: SubscriptionState.ProTrial,
168+
planId: SubscriptionPlanId.Advanced,
169+
reactivatedTrial: true,
170+
},
171+
},
152172
{
153173
label: 'Pro Trial (Expired)',
154174
description: 'Community, account',
@@ -168,6 +188,12 @@ class AccountDebug {
168188
iconPath: new ThemeIcon('blank'),
169189
item: { state: SubscriptionState.Paid, planId: SubscriptionPlanId.Pro },
170190
},
191+
{
192+
label: 'Advanced',
193+
description: 'Advanced, account',
194+
iconPath: new ThemeIcon('blank'),
195+
item: { state: SubscriptionState.Paid, planId: SubscriptionPlanId.Advanced },
196+
},
171197
{
172198
label: 'Teams',
173199
description: 'Teams, account',
@@ -326,7 +352,9 @@ class AccountDebug {
326352
? 'gitkraken_v1-hosted-enterprise'
327353
: planId === 'teams'
328354
? 'gitkraken_v1-teams'
329-
: 'gitkraken_v1-pro',
355+
: planId === 'advanced'
356+
? 'gitkraken_v1-advanced'
357+
: 'gitkraken_v1-pro',
330358
{
331359
organizationId: activeOrganizationId,
332360
trial: { reactivatedTrial: reactivatedTrial },

src/plus/gk/models/checkin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,25 @@ export interface GKLicense {
2929

3030
export type GKLicenseType =
3131
| 'gitlens-pro'
32+
| 'gitlens-advanced'
3233
| 'gitlens-teams'
3334
| 'gitlens-hosted-enterprise'
3435
| 'gitlens-self-hosted-enterprise'
3536
| 'gitlens-standalone-enterprise'
3637
| 'bundle-pro'
38+
| 'bundle-advanced'
3739
| 'bundle-teams'
3840
| 'bundle-hosted-enterprise'
3941
| 'bundle-self-hosted-enterprise'
4042
| 'bundle-standalone-enterprise'
4143
| 'gitkraken_v1-pro'
44+
| 'gitkraken_v1-advanced'
4245
| 'gitkraken_v1-teams'
4346
| 'gitkraken_v1-hosted-enterprise'
4447
| 'gitkraken_v1-self-hosted-enterprise'
4548
| 'gitkraken_v1-standalone-enterprise'
4649
| 'gitkraken-v1-pro'
50+
| 'gitkraken-v1-advanced'
4751
| 'gitkraken-v1-teams'
4852
| 'gitkraken-v1-hosted-enterprise'
4953
| 'gitkraken-v1-self-hosted-enterprise'

src/plus/gk/utils/checkin.utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ function convertLicenseTypeToPlanId(licenseType: GKLicenseType): SubscriptionPla
163163
case 'gitkraken_v1-teams':
164164
case 'gitkraken-v1-teams':
165165
return SubscriptionPlanId.Teams;
166+
case 'gitlens-advanced':
167+
case 'bundle-advanced':
168+
case 'gitkraken_v1-advanced':
169+
case 'gitkraken-v1-advanced':
170+
return SubscriptionPlanId.Advanced;
166171
case 'gitlens-hosted-enterprise':
167172
case 'gitlens-self-hosted-enterprise':
168173
case 'gitlens-standalone-enterprise':
@@ -177,12 +182,13 @@ function convertLicenseTypeToPlanId(licenseType: GKLicenseType): SubscriptionPla
177182
case 'gitkraken-v1-standalone-enterprise':
178183
return SubscriptionPlanId.Enterprise;
179184
default:
180-
return SubscriptionPlanId.CommunityWithAccount;
185+
return SubscriptionPlanId.Pro;
181186
}
182187
}
183188
function isBundleLicenseType(licenseType: GKLicenseType): boolean {
184189
switch (licenseType) {
185190
case 'bundle-pro':
191+
case 'bundle-advanced':
186192
case 'bundle-teams':
187193
case 'bundle-hosted-enterprise':
188194
case 'bundle-self-hosted-enterprise':

src/plus/gk/utils/subscription.utils.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ import type { PaidSubscriptionPlans, Subscription, SubscriptionPlan } from '../m
55

66
export const SubscriptionUpdatedUriPathPrefix = 'did-update-subscription';
77

8-
export function getSubscriptionStateName(state: SubscriptionState, planId?: SubscriptionPlanId): string {
8+
export function getSubscriptionStateName(
9+
state: SubscriptionState,
10+
planId?: SubscriptionPlanId,
11+
effectivePlanId?: SubscriptionPlanId,
12+
): string {
913
switch (state) {
1014
case SubscriptionState.Community:
1115
case SubscriptionState.ProPreviewExpired:
1216
return getSubscriptionPlanName(SubscriptionPlanId.Community);
1317
case SubscriptionState.ProPreview:
1418
return `${getSubscriptionPlanName(SubscriptionPlanId.Pro)} (Preview)`;
1519
case SubscriptionState.ProTrial:
16-
return `${getSubscriptionPlanName(SubscriptionPlanId.Pro)} (Trial)`;
20+
return `${getSubscriptionPlanName(SubscriptionPlanId.Pro)} (${
21+
effectivePlanId != null &&
22+
getSubscriptionPlanPriority(effectivePlanId) > getSubscriptionPlanPriority(SubscriptionPlanId.Pro)
23+
? `${getSubscriptionPlanTier(effectivePlanId)} `
24+
: ''
25+
}Trial)`;
1726
case SubscriptionState.ProTrialExpired:
1827
return getSubscriptionPlanName(SubscriptionPlanId.CommunityWithAccount);
1928
case SubscriptionState.ProTrialReactivationEligible:
@@ -57,8 +66,11 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
5766

5867
if (account?.verified === false) return SubscriptionState.VerificationRequired;
5968

60-
if (actual.id === effective.id) {
61-
switch (effective.id) {
69+
if (
70+
actual.id === effective.id ||
71+
getSubscriptionPlanPriority(actual.id) > getSubscriptionPlanPriority(effective.id)
72+
) {
73+
switch (actual.id === effective.id ? effective.id : actual.id) {
6274
case SubscriptionPlanId.Community:
6375
return preview == null ? SubscriptionState.Community : SubscriptionState.ProPreviewExpired;
6476

@@ -71,12 +83,17 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
7183
}
7284

7385
case SubscriptionPlanId.Pro:
86+
case SubscriptionPlanId.Advanced:
7487
case SubscriptionPlanId.Teams:
7588
case SubscriptionPlanId.Enterprise:
7689
return SubscriptionState.Paid;
7790
}
7891
}
7992

93+
// If you have a paid license, any trial license higher tier than your paid license is considered paid
94+
if (getSubscriptionPlanPriority(actual.id) > getSubscriptionPlanPriority(SubscriptionPlanId.CommunityWithAccount)) {
95+
return SubscriptionState.Paid;
96+
}
8097
switch (effective.id) {
8198
case SubscriptionPlanId.Community:
8299
return preview == null ? SubscriptionState.Community : SubscriptionState.ProPreview;
@@ -90,13 +107,12 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
90107
}
91108

92109
case SubscriptionPlanId.Pro:
110+
case SubscriptionPlanId.Advanced:
111+
case SubscriptionPlanId.Teams:
112+
case SubscriptionPlanId.Enterprise:
93113
return actual.id === SubscriptionPlanId.Community
94114
? SubscriptionState.ProPreview
95115
: SubscriptionState.ProTrial;
96-
97-
case SubscriptionPlanId.Teams:
98-
case SubscriptionPlanId.Enterprise:
99-
return SubscriptionState.Paid;
100116
}
101117
}
102118

@@ -127,12 +143,16 @@ export function getSubscriptionPlanName(id: SubscriptionPlanId): string {
127143
return `GitLens ${getSubscriptionPlanTier(id)}`;
128144
}
129145

130-
export function getSubscriptionPlanTier(id: SubscriptionPlanId): 'Community' | 'Pro' | 'Teams' | 'Enterprise' {
146+
export function getSubscriptionPlanTier(
147+
id: SubscriptionPlanId,
148+
): 'Community' | 'Pro' | 'Advanced' | 'Teams' | 'Enterprise' {
131149
switch (id) {
132150
case SubscriptionPlanId.CommunityWithAccount:
133151
return 'Community';
134152
case SubscriptionPlanId.Pro:
135153
return 'Pro';
154+
case SubscriptionPlanId.Advanced:
155+
return 'Advanced';
136156
case SubscriptionPlanId.Teams:
137157
return 'Teams';
138158
case SubscriptionPlanId.Enterprise:
@@ -147,8 +167,9 @@ const plansPriority = new Map<SubscriptionPlanId | undefined, number>([
147167
[SubscriptionPlanId.Community, 0],
148168
[SubscriptionPlanId.CommunityWithAccount, 1],
149169
[SubscriptionPlanId.Pro, 2],
150-
[SubscriptionPlanId.Teams, 3],
151-
[SubscriptionPlanId.Enterprise, 4],
170+
[SubscriptionPlanId.Advanced, 3],
171+
[SubscriptionPlanId.Teams, 4],
172+
[SubscriptionPlanId.Enterprise, 5],
152173
]);
153174

154175
export function getSubscriptionPlanPriority(id: SubscriptionPlanId | undefined): number {

src/webviews/apps/plus/LICENSE.plus

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ with, the GitKraken End User License Agreement, available at
1313
https://gitkraken.com/eula (the "EULA"), or other agreement governing the
1414
use of the Software, as agreed by you and GitKraken, and otherwise have a valid
1515
subscription for the correct number of user seats for the applicable version of
16-
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Teams, and GitLens+
17-
Enterprise). Subject to the foregoing sentence, you are free to modify this
18-
Software and publish patches to the Software. You agree that GitKraken and/or
16+
the Software (e.g., GitLens+, GitLens+ Pro, GitLens+ Advanced, GitLens+ Teams,
17+
and GitLens+ Enterprise). Subject to the foregoing sentence, you are free to modify
18+
this Software and publish patches to the Software. You agree that GitKraken and/or
1919
its licensors (as applicable) retain all right, title and interest in and to all
2020
such modifications and/or patches, and all such modifications and/or patches may
2121
only be used, copied, modified, displayed, distributed, or otherwise exploited

0 commit comments

Comments
 (0)