Skip to content

Adds the referral program #4175

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

Merged
merged 1 commit into from
Mar 27, 2025
Merged
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
4 changes: 4 additions & 0 deletions contributions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3427,6 +3427,10 @@
"label": "Reactivate Pro Trial",
"commandPalette": "gitlens:plus:state == 5"
},
"gitlens.plus.referFriend": {
"label": "Refer a friend",
"commandPalette": "gitlens:plus"
},
"gitlens.plus.refreshRepositoryAccess": {
"label": "Refresh Repository Access",
"commandPalette": "gitlens:enabled"
Expand Down
2 changes: 1 addition & 1 deletion docs/telemetry-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ void

```typescript
{
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'resend-verification' | 'pricing' | 'start-preview-trial'
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'refer-friend' | 'resend-verification' | 'pricing' | 'start-preview-trial'
}
```

Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7284,6 +7284,11 @@
"title": "Reactivate Pro Trial",
"category": "GitLens"
},
{
"command": "gitlens.plus.referFriend",
"title": "Refer a friend",
"category": "GitLens"
},
{
"command": "gitlens.plus.refreshRepositoryAccess",
"title": "Refresh Repository Access",
Expand Down Expand Up @@ -11302,6 +11307,10 @@
"command": "gitlens.plus.reactivateProTrial",
"when": "gitlens:plus:state == 5"
},
{
"command": "gitlens.plus.referFriend",
"when": "gitlens:plus"
},
{
"command": "gitlens.plus.refreshRepositoryAccess",
"when": "gitlens:enabled"
Expand Down
1 change: 1 addition & 0 deletions src/constants.commands.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ export type ContributedPaletteCommands =
| 'gitlens.plus.logout'
| 'gitlens.plus.manage'
| 'gitlens.plus.reactivateProTrial'
| 'gitlens.plus.referFriend'
| 'gitlens.plus.refreshRepositoryAccess'
| 'gitlens.plus.restore'
| 'gitlens.plus.signUp'
Expand Down
1 change: 1 addition & 0 deletions src/constants.telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ type SubscriptionActionEventData =
| 'sign-out'
| 'manage'
| 'reactivate'
| 'refer-friend'
| 'resend-verification'
| 'pricing'
| 'start-preview-trial';
Expand Down
10 changes: 10 additions & 0 deletions src/plus/gk/subscriptionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export class SubscriptionService implements Disposable {
registerCommand('gitlens.plus.login', (src?: Source) => this.loginOrSignUp(false, src)),
registerCommand('gitlens.plus.signUp', (src?: Source) => this.loginOrSignUp(true, src)),
registerCommand('gitlens.plus.logout', (src?: Source) => this.logout(src)),
registerCommand('gitlens.plus.referFriend', (src?: Source) => this.referFriend(src)),
registerCommand('gitlens.gk.switchOrganization', (src?: Source) => this.switchOrganization(src)),

registerCommand('gitlens.plus.manage', (src?: Source) => this.manage(src)),
Expand Down Expand Up @@ -726,6 +727,15 @@ export class SubscriptionService implements Disposable {
}
}

@log()
async referFriend(source: Source | undefined): Promise<void> {
if (this.container.telemetry.enabled) {
this.container.telemetry.sendEvent('subscription/action', { action: 'refer-friend' }, source);
}

await openUrl(this.container.urls.getGkDevUrl(undefined, 'referral_portal=true&source=gitlens'));
}

@gate(() => '')
@log()
async resendVerification(source: Source | undefined): Promise<boolean> {
Expand Down
21 changes: 18 additions & 3 deletions src/webviews/apps/plus/shared/components/account-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,9 @@ export class GLAccountChip extends LitElement {
private renderAccountState() {
switch (this.subscriptionState) {
case SubscriptionState.Paid:
return html`<div class="account-status">${this.renderIncludesDevEx()}</div> `;
return html`<div class="account-status">
${this.renderIncludesDevEx()} ${this.renderReferFriend()}
</div> `;

case SubscriptionState.VerificationRequired:
return html`<div class="account-status">
Expand Down Expand Up @@ -456,7 +458,7 @@ export class GLAccountChip extends LitElement {
>Upgrade to Pro</gl-button
>
</button-container>
${this.renderPromo()} ${this.renderIncludesDevEx()}
${this.renderPromo()} ${this.renderIncludesDevEx()} ${this.renderReferFriend()}
</div>`;
}

Expand All @@ -473,7 +475,7 @@ export class GLAccountChip extends LitElement {
>Upgrade to Pro</gl-button
>
</button-container>
${this.renderPromo()} ${this.renderIncludesDevEx()}
${this.renderPromo()} ${this.renderIncludesDevEx()} ${this.renderReferFriend()}
</div>`;

case SubscriptionState.ProTrialReactivationEligible:
Expand All @@ -492,6 +494,7 @@ export class GLAccountChip extends LitElement {
>Reactivate GitLens Pro Trial</gl-button
>
</button-container>
${this.renderReferFriend()}
</div>`;

default:
Expand Down Expand Up @@ -528,6 +531,18 @@ export class GLAccountChip extends LitElement {
return html`<p>Includes access to <a href="${urls.platform}">GitKraken's DevEx platform</a></p>`;
}

private renderReferFriend() {
return html`<p>
<a
href="${createCommandLink<Source>('gitlens.plus.referFriend', {
source: 'account',
})}"
>Refer a friend</a
>
&mdash; give 50% off and get up to $20
</p>`;
}

private renderPromo() {
return html`<gl-promo
.promoPromise=${this.promos.getApplicablePromo('account')}
Expand Down