Skip to content

Commit 8495844

Browse files
Sets up student plan basics
1 parent 603eba6 commit 8495844

File tree

7 files changed

+57
-15
lines changed

7 files changed

+57
-15
lines changed

ThirdPartyNotices.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This project incorporates components from the projects listed below.
2525
20. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
2626
21. iconv-lite version 0.6.3 (https://github.com/ashtuchkin/iconv-lite)
2727
22. lit version 3.3.1 (https://github.com/lit/lit)
28-
23. marked version 16.2.0 (https://github.com/markedjs/marked)
28+
23. marked version 16.1.2 (https://github.com/markedjs/marked)
2929
24. microsoft/vscode (https://github.com/microsoft/vscode)
3030
25. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
3131
26. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)

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' | 'advanced' | 'teams' | 'enterprise',
53+
'global.subscription.actual.id': 'community' | 'community-with-account' | 'student' | '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' | 'advanced' | 'teams' | 'enterprise',
61+
'global.subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
6262
'global.subscription.effective.nextTrialOptInDate': string,
6363
'global.subscription.effective.organizationId': string,
6464
'global.subscription.effective.startedOn': string,
@@ -3049,15 +3049,15 @@ void
30493049
'subscription.actual.bundle': boolean,
30503050
'subscription.actual.cancelled': boolean,
30513051
'subscription.actual.expiresOn': string,
3052-
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3052+
'subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
30533053
'subscription.actual.nextTrialOptInDate': string,
30543054
'subscription.actual.organizationId': string,
30553055
'subscription.actual.startedOn': string,
30563056
'subscription.actual.trialReactivationCount': number,
30573057
'subscription.effective.bundle': boolean,
30583058
'subscription.effective.cancelled': boolean,
30593059
'subscription.effective.expiresOn': string,
3060-
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3060+
'subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
30613061
'subscription.effective.nextTrialOptInDate': string,
30623062
'subscription.effective.organizationId': string,
30633063
'subscription.effective.startedOn': string,
@@ -3136,31 +3136,31 @@ or
31363136
'previous.subscription.actual.bundle': boolean,
31373137
'previous.subscription.actual.cancelled': boolean,
31383138
'previous.subscription.actual.expiresOn': string,
3139-
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3139+
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
31403140
'previous.subscription.actual.nextTrialOptInDate': string,
31413141
'previous.subscription.actual.organizationId': string,
31423142
'previous.subscription.actual.startedOn': string,
31433143
'previous.subscription.actual.trialReactivationCount': number,
31443144
'previous.subscription.effective.bundle': boolean,
31453145
'previous.subscription.effective.cancelled': boolean,
31463146
'previous.subscription.effective.expiresOn': string,
3147-
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3147+
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
31483148
'previous.subscription.effective.nextTrialOptInDate': string,
31493149
'previous.subscription.effective.organizationId': string,
31503150
'previous.subscription.effective.startedOn': string,
31513151
'previous.subscription.effective.trialReactivationCount': number,
31523152
'subscription.actual.bundle': boolean,
31533153
'subscription.actual.cancelled': boolean,
31543154
'subscription.actual.expiresOn': string,
3155-
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3155+
'subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
31563156
'subscription.actual.nextTrialOptInDate': string,
31573157
'subscription.actual.organizationId': string,
31583158
'subscription.actual.startedOn': string,
31593159
'subscription.actual.trialReactivationCount': number,
31603160
'subscription.effective.bundle': boolean,
31613161
'subscription.effective.cancelled': boolean,
31623162
'subscription.effective.expiresOn': string,
3163-
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
3163+
'subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
31643164
'subscription.effective.nextTrialOptInDate': string,
31653165
'subscription.effective.organizationId': string,
31663166
'subscription.effective.startedOn': string,

src/plus/gk/__debug__accountDebug.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type SimulateQuickPickItem = QuickPickItemOfT<
5151
state: SubscriptionState.Trial;
5252
reactivatedTrial?: boolean;
5353
expiredPaid?: never;
54-
planId?: Extract<'advanced', SubscriptionPlanIds>;
54+
planId?: Extract<'advanced' | 'student', SubscriptionPlanIds>;
5555
featurePreviews?: never;
5656
}
5757
| {
@@ -160,6 +160,12 @@ class AccountDebug {
160160
reactivatedTrial: true,
161161
},
162162
},
163+
{
164+
label: 'Pro Trial (Student)',
165+
description: 'Student trial (student plan), account',
166+
iconPath: new ThemeIcon('blank'),
167+
item: { state: SubscriptionState.Trial, planId: 'student' },
168+
},
163169
{
164170
label: 'Pro Trial (Expired)',
165171
description: 'Community, account',
@@ -173,6 +179,12 @@ class AccountDebug {
173179
item: { state: SubscriptionState.TrialReactivationEligible },
174180
},
175181
createQuickPickSeparator('Paid'),
182+
{
183+
label: 'Student',
184+
description: 'Student plan, account',
185+
iconPath: new ThemeIcon('blank'),
186+
item: { state: SubscriptionState.Paid, planId: 'student' },
187+
},
176188
{
177189
label: 'Pro',
178190
description: 'Pro, account',
@@ -337,7 +349,9 @@ class AccountDebug {
337349
? 'gitkraken_v1-teams'
338350
: planId === 'advanced'
339351
? 'gitkraken_v1-advanced'
340-
: 'gitkraken_v1-pro',
352+
: planId === 'student'
353+
? 'gitkraken_v1-edu'
354+
: 'gitkraken_v1-pro',
341355
{
342356
organizationId: activeOrganizationId,
343357
trial: { reactivatedTrial: reactivatedTrial },

src/plus/gk/models/checkin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,28 @@ export interface GKLicense {
2828
}
2929

3030
export type GKLicenseType =
31+
| 'gitlens-edu'
3132
| 'gitlens-pro'
3233
| 'gitlens-advanced'
3334
| 'gitlens-teams'
3435
| 'gitlens-hosted-enterprise'
3536
| 'gitlens-self-hosted-enterprise'
3637
| 'gitlens-standalone-enterprise'
38+
| 'bundle-edu'
3739
| 'bundle-pro'
3840
| 'bundle-advanced'
3941
| 'bundle-teams'
4042
| 'bundle-hosted-enterprise'
4143
| 'bundle-self-hosted-enterprise'
4244
| 'bundle-standalone-enterprise'
45+
| 'gitkraken_v1-edu'
4346
| 'gitkraken_v1-pro'
4447
| 'gitkraken_v1-advanced'
4548
| 'gitkraken_v1-teams'
4649
| 'gitkraken_v1-hosted-enterprise'
4750
| 'gitkraken_v1-self-hosted-enterprise'
4851
| 'gitkraken_v1-standalone-enterprise'
52+
| 'gitkraken-v1-edu'
4953
| 'gitkraken-v1-pro'
5054
| 'gitkraken-v1-advanced'
5155
| 'gitkraken-v1-teams'

src/plus/gk/models/subscription.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Organization } from './organization';
55
export type SubscriptionPlanIds =
66
| 'community'
77
| 'community-with-account'
8+
| 'student'
89
| 'pro'
910
| 'advanced'
1011
| 'teams' /* the old name for Business; do not change */

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export function getSubscriptionFromCheckIn(
2121
paidLicenses = paidLicenses.filter(
2222
license => license[1].latestStatus !== 'expired' && license[1].latestStatus !== 'cancelled',
2323
);
24+
25+
// if there are any paid licenses with status of in_trial, move them to effectiveLicenses
26+
for (let i = 0; i < paidLicenses.length; i++) {
27+
const [, license] = paidLicenses[i];
28+
if (license.latestStatus === 'in_trial' || license.latestStatus === 'trial') {
29+
effectiveLicenses.push(paidLicenses.splice(i, 1)[0]);
30+
i--;
31+
}
32+
}
33+
2434
if (paidLicenses.length > 1) {
2535
paidLicenses.sort(
2636
(a, b) =>
@@ -152,6 +162,11 @@ export function getSubscriptionFromCheckIn(
152162
}
153163
function convertLicenseTypeToPlanId(licenseType: GKLicenseType): SubscriptionPlanIds {
154164
switch (licenseType) {
165+
case 'gitlens-edu':
166+
case 'bundle-edu':
167+
case 'gitkraken_v1-edu':
168+
case 'gitkraken-v1-edu':
169+
return 'student';
155170
case 'gitlens-pro':
156171
case 'bundle-pro':
157172
case 'gitkraken_v1-pro':

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import type {
1111
const orderedPlans: SubscriptionPlanIds[] = [
1212
'community',
1313
'community-with-account',
14+
'student',
1415
'pro',
1516
'advanced',
1617
'teams',
1718
'enterprise',
1819
];
19-
const orderedPaidPlans: PaidSubscriptionPlanIds[] = ['pro', 'advanced', 'teams', 'enterprise'];
20+
const orderedPaidPlans: PaidSubscriptionPlanIds[] = ['student', 'pro', 'advanced', 'teams', 'enterprise'];
2021
export const SubscriptionUpdatedUriPathPrefix = 'did-update-subscription';
2122
export const AiAllAccessOptInPathPrefix = 'ai-all-access-opt-in';
2223

@@ -47,7 +48,7 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
4748

4849
return SubscriptionState.TrialExpired;
4950
}
50-
51+
case 'student':
5152
case 'pro':
5253
case 'advanced':
5354
case 'teams':
@@ -72,6 +73,7 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
7273
return SubscriptionState.TrialExpired;
7374
}
7475

76+
case 'student':
7577
case 'pro':
7678
case 'advanced':
7779
case 'teams':
@@ -113,8 +115,10 @@ export function getSubscriptionPlan(
113115
/** Gets the plan name for the given plan id */
114116
export function getSubscriptionPlanName(
115117
id: SubscriptionPlanIds,
116-
): 'Community' | 'Pro' | 'Advanced' | 'Business' | 'Enterprise' {
118+
): 'Community' | 'Student' | 'Pro' | 'Advanced' | 'Business' | 'Enterprise' {
117119
switch (id) {
120+
case 'student':
121+
return 'Student';
118122
case 'pro':
119123
return 'Pro';
120124
case 'advanced':
@@ -133,8 +137,12 @@ export function getSubscriptionPlanOrder(id: SubscriptionPlanIds | undefined): n
133137
}
134138

135139
/** Only for gk.dev `planType` query param */
136-
export function getSubscriptionPlanType(id: SubscriptionPlanIds): 'PRO' | 'ADVANCED' | 'BUSINESS' | 'ENTERPRISE' {
140+
export function getSubscriptionPlanType(
141+
id: SubscriptionPlanIds,
142+
): 'STUDENT' | 'PRO' | 'ADVANCED' | 'BUSINESS' | 'ENTERPRISE' {
137143
switch (id) {
144+
case 'student':
145+
return 'STUDENT';
138146
case 'advanced':
139147
return 'ADVANCED';
140148
case 'teams':

0 commit comments

Comments
 (0)