Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adds student plan #4564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
axosoft-ramint wants to merge 3 commits into main
base: main
Choose a base branch
Loading
from chore/student-plan
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ThirdPartyNotices.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This project incorporates components from the projects listed below.
20. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
21. iconv-lite version 0.6.3 (https://github.com/ashtuchkin/iconv-lite)
22. lit version 3.3.1 (https://github.com/lit/lit)
23. marked version 16.2.0 (https://github.com/markedjs/marked)
23. marked version 16.1.2 (https://github.com/markedjs/marked)
24. microsoft/vscode (https://github.com/microsoft/vscode)
25. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
26. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)
Expand Down
16 changes: 8 additions & 8 deletions docs/telemetry-events.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
'global.subscription.actual.bundle': boolean,
'global.subscription.actual.cancelled': boolean,
'global.subscription.actual.expiresOn': string,
'global.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'global.subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'global.subscription.actual.nextTrialOptInDate': string,
'global.subscription.actual.organizationId': string,
'global.subscription.actual.startedOn': string,
'global.subscription.actual.trialReactivationCount': number,
'global.subscription.effective.bundle': boolean,
'global.subscription.effective.cancelled': boolean,
'global.subscription.effective.expiresOn': string,
'global.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'global.subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'global.subscription.effective.nextTrialOptInDate': string,
'global.subscription.effective.organizationId': string,
'global.subscription.effective.startedOn': string,
Expand Down Expand Up @@ -3049,15 +3049,15 @@ void
'subscription.actual.bundle': boolean,
'subscription.actual.cancelled': boolean,
'subscription.actual.expiresOn': string,
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.actual.nextTrialOptInDate': string,
'subscription.actual.organizationId': string,
'subscription.actual.startedOn': string,
'subscription.actual.trialReactivationCount': number,
'subscription.effective.bundle': boolean,
'subscription.effective.cancelled': boolean,
'subscription.effective.expiresOn': string,
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.effective.nextTrialOptInDate': string,
'subscription.effective.organizationId': string,
'subscription.effective.startedOn': string,
Expand Down Expand Up @@ -3136,31 +3136,31 @@ or
'previous.subscription.actual.bundle': boolean,
'previous.subscription.actual.cancelled': boolean,
'previous.subscription.actual.expiresOn': string,
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'previous.subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'previous.subscription.actual.nextTrialOptInDate': string,
'previous.subscription.actual.organizationId': string,
'previous.subscription.actual.startedOn': string,
'previous.subscription.actual.trialReactivationCount': number,
'previous.subscription.effective.bundle': boolean,
'previous.subscription.effective.cancelled': boolean,
'previous.subscription.effective.expiresOn': string,
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'previous.subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'previous.subscription.effective.nextTrialOptInDate': string,
'previous.subscription.effective.organizationId': string,
'previous.subscription.effective.startedOn': string,
'previous.subscription.effective.trialReactivationCount': number,
'subscription.actual.bundle': boolean,
'subscription.actual.cancelled': boolean,
'subscription.actual.expiresOn': string,
'subscription.actual.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.actual.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.actual.nextTrialOptInDate': string,
'subscription.actual.organizationId': string,
'subscription.actual.startedOn': string,
'subscription.actual.trialReactivationCount': number,
'subscription.effective.bundle': boolean,
'subscription.effective.cancelled': boolean,
'subscription.effective.expiresOn': string,
'subscription.effective.id': 'community' | 'community-with-account' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.effective.id': 'community' | 'community-with-account' | 'student' | 'pro' | 'advanced' | 'teams' | 'enterprise',
'subscription.effective.nextTrialOptInDate': string,
'subscription.effective.organizationId': string,
'subscription.effective.startedOn': string,
Expand Down
18 changes: 16 additions & 2 deletions src/plus/gk/__debug__accountDebug.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type SimulateQuickPickItem = QuickPickItemOfT<
state: SubscriptionState.Trial;
reactivatedTrial?: boolean;
expiredPaid?: never;
planId?: Extract<'advanced', SubscriptionPlanIds>;
planId?: Extract<'advanced' | 'student', SubscriptionPlanIds>;
featurePreviews?: never;
}
| {
Expand Down Expand Up @@ -160,6 +160,12 @@ class AccountDebug {
reactivatedTrial: true,
},
},
{
label: 'Pro Trial (Student)',
description: 'Student trial (student plan), account',
iconPath: new ThemeIcon('blank'),
item: { state: SubscriptionState.Trial, planId: 'student' },
},
{
label: 'Pro Trial (Expired)',
description: 'Community, account',
Expand All @@ -173,6 +179,12 @@ class AccountDebug {
item: { state: SubscriptionState.TrialReactivationEligible },
},
createQuickPickSeparator('Paid'),
{
label: 'Student',
description: 'Student plan, account',
iconPath: new ThemeIcon('blank'),
item: { state: SubscriptionState.Paid, planId: 'student' },
},
{
label: 'Pro',
description: 'Pro, account',
Expand Down Expand Up @@ -337,7 +349,9 @@ class AccountDebug {
? 'gitkraken_v1-teams'
: planId === 'advanced'
? 'gitkraken_v1-advanced'
: 'gitkraken_v1-pro',
: planId === 'student'
? 'gitkraken_v1-edu'
: 'gitkraken_v1-pro',
{
organizationId: activeOrganizationId,
trial: { reactivatedTrial: reactivatedTrial },
Expand Down
5 changes: 5 additions & 0 deletions src/plus/gk/models/checkin.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,32 @@ export interface GKLicense {
readonly organizationId: string | undefined;
readonly reactivationCount?: number;
readonly nextOptInDate?: string;
readonly hasPaymentSource?: boolean;
}

export type GKLicenseType =
| 'gitlens-edu'
| 'gitlens-pro'
| 'gitlens-advanced'
| 'gitlens-teams'
| 'gitlens-hosted-enterprise'
| 'gitlens-self-hosted-enterprise'
| 'gitlens-standalone-enterprise'
| 'bundle-edu'
| 'bundle-pro'
| 'bundle-advanced'
| 'bundle-teams'
| 'bundle-hosted-enterprise'
| 'bundle-self-hosted-enterprise'
| 'bundle-standalone-enterprise'
| 'gitkraken_v1-edu'
| 'gitkraken_v1-pro'
| 'gitkraken_v1-advanced'
| 'gitkraken_v1-teams'
| 'gitkraken_v1-hosted-enterprise'
| 'gitkraken_v1-self-hosted-enterprise'
| 'gitkraken_v1-standalone-enterprise'
| 'gitkraken-v1-edu'
| 'gitkraken-v1-pro'
| 'gitkraken-v1-advanced'
| 'gitkraken-v1-teams'
Expand Down
1 change: 1 addition & 0 deletions src/plus/gk/models/subscription.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Organization } from './organization';
export type SubscriptionPlanIds =
| 'community'
| 'community-with-account'
| 'student'
| 'pro'
| 'advanced'
| 'teams' /* the old name for Business; do not change */
Expand Down
18 changes: 18 additions & 0 deletions src/plus/gk/utils/checkin.utils.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export function getSubscriptionFromCheckIn(
paidLicenses = paidLicenses.filter(
license => license[1].latestStatus !== 'expired' && license[1].latestStatus !== 'cancelled',
);

// if there are any paid licenses with status of in_trial, move them to effectiveLicenses
for (let i = 0; i < paidLicenses.length; i++) {
const [, license] = paidLicenses[i];
if (
(license.latestStatus === 'in_trial' || license.latestStatus === 'trial') &&
license.hasPaymentSource !== true
) {
effectiveLicenses.push(paidLicenses.splice(i, 1)[0]);
i--;
}
}

if (paidLicenses.length > 1) {
paidLicenses.sort(
(a, b) =>
Expand Down Expand Up @@ -152,6 +165,11 @@ export function getSubscriptionFromCheckIn(
}
function convertLicenseTypeToPlanId(licenseType: GKLicenseType): SubscriptionPlanIds {
switch (licenseType) {
case 'gitlens-edu':
case 'bundle-edu':
case 'gitkraken_v1-edu':
case 'gitkraken-v1-edu':
return 'student';
case 'gitlens-pro':
case 'bundle-pro':
case 'gitkraken_v1-pro':
Expand Down
20 changes: 14 additions & 6 deletions src/plus/gk/utils/subscription.utils.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import type {
const orderedPlans: SubscriptionPlanIds[] = [
'community',
'community-with-account',
'student',
'pro',
'advanced',
'teams',
'enterprise',
];
const orderedPaidPlans: PaidSubscriptionPlanIds[] = ['pro', 'advanced', 'teams', 'enterprise'];
const orderedPaidPlans: PaidSubscriptionPlanIds[] = ['student', 'pro', 'advanced', 'teams', 'enterprise'];
export const SubscriptionUpdatedUriPathPrefix = 'did-update-subscription';
export const AiAllAccessOptInPathPrefix = 'ai-all-access-opt-in';

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

return SubscriptionState.TrialExpired;
}

case 'student':
case 'pro':
case 'advanced':
case 'teams':
Expand All @@ -72,6 +73,7 @@ export function computeSubscriptionState(subscription: Optional<Subscription, 's
return SubscriptionState.TrialExpired;
}

case 'student':
case 'pro':
case 'advanced':
case 'teams':
Expand Down Expand Up @@ -113,8 +115,10 @@ export function getSubscriptionPlan(
/** Gets the plan name for the given plan id */
export function getSubscriptionPlanName(
id: SubscriptionPlanIds,
): 'Community' | 'Pro' | 'Advanced' | 'Business' | 'Enterprise' {
): 'Community' | 'Student' | 'Pro' | 'Advanced' | 'Business' | 'Enterprise' {
switch (id) {
case 'student':
return 'Student';
case 'pro':
return 'Pro';
case 'advanced':
Expand All @@ -133,8 +137,12 @@ export function getSubscriptionPlanOrder(id: SubscriptionPlanIds | undefined): n
}

/** Only for gk.dev `planType` query param */
export function getSubscriptionPlanType(id: SubscriptionPlanIds): 'PRO' | 'ADVANCED' | 'BUSINESS' | 'ENTERPRISE' {
export function getSubscriptionPlanType(
id: SubscriptionPlanIds,
): 'STUDENT' | 'PRO' | 'ADVANCED' | 'BUSINESS' | 'ENTERPRISE' {
switch (id) {
case 'student':
return 'STUDENT';
case 'advanced':
return 'ADVANCED';
case 'teams':
Expand All @@ -155,12 +163,12 @@ export function getSubscriptionProductPlanName(id: SubscriptionPlanIds): string
export function getSubscriptionProductPlanNameFromState(
state: SubscriptionState,
planId?: SubscriptionPlanIds,
_effectivePlanId?: SubscriptionPlanIds,
effectivePlanId?: SubscriptionPlanIds,
): string {
switch (state) {
case SubscriptionState.Community:
case SubscriptionState.Trial:
return `${getSubscriptionProductPlanName('pro')} Trial`;
return `${effectivePlanId === 'student' ? getSubscriptionProductPlanName('student') : getSubscriptionProductPlanName('pro')} Trial`;
// return `${getSubscriptionProductPlanName(
// _effectivePlanId != null &&
// compareSubscriptionPlans(_effectivePlanId, planId ?? 'pro') > 0
Expand Down
6 changes: 3 additions & 3 deletions src/webviews/apps/plus/shared/components/account-chip.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class GlAccountChip extends LitElement {

private get planTier() {
if (isSubscriptionTrial(this.subscription)) {
return 'Pro Trial';
return this.subscription.plan.effective.id === 'student' ? 'Student' : 'Pro Trial';
}

return getSubscriptionPlanName(this.planId);
Expand Down Expand Up @@ -507,8 +507,8 @@ export class GlAccountChip extends LitElement {
<p>
You have
<strong>${days < 1 ? '<1 day' : pluralize('day', days, { infix: ' more ' })} left</strong>
in your Pro trial. Once your trial ends, you will only be able to use Pro features on
publicly-hosted repos.
in your ${this.planTier === 'Student' ? 'Student' : 'Pro'} trial. Once your trial ends, you will
only be able to use Pro features on publicly-hosted repos.
</p>
<button-container layout="editor">
<gl-button
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /