Skip to content

Commit 1e3b5b4

Browse files
committed
Adds referral program
1 parent fcc72fa commit 1e3b5b4

File tree

7 files changed

+44
-4
lines changed

7 files changed

+44
-4
lines changed

contributions.json

+4
Original file line numberDiff line numberDiff line change
@@ -3427,6 +3427,10 @@
34273427
"label": "Reactivate Pro Trial",
34283428
"commandPalette": "gitlens:plus:state == 5"
34293429
},
3430+
"gitlens.plus.referFriend": {
3431+
"label": "Refer a friend",
3432+
"commandPalette": "gitlens:plus"
3433+
},
34303434
"gitlens.plus.refreshRepositoryAccess": {
34313435
"label": "Refresh Repository Access",
34323436
"commandPalette": "gitlens:enabled"

docs/telemetry-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ void
18051805
18061806
```typescript
18071807
{
1808-
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'resend-verification' | 'pricing' | 'start-preview-trial'
1808+
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'refer-friend' | 'resend-verification' | 'pricing' | 'start-preview-trial'
18091809
}
18101810
```
18111811

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -7284,6 +7284,11 @@
72847284
"title": "Reactivate Pro Trial",
72857285
"category": "GitLens"
72867286
},
7287+
{
7288+
"command": "gitlens.plus.referFriend",
7289+
"title": "Refer a friend",
7290+
"category": "GitLens"
7291+
},
72877292
{
72887293
"command": "gitlens.plus.refreshRepositoryAccess",
72897294
"title": "Refresh Repository Access",
@@ -11302,6 +11307,10 @@
1130211307
"command": "gitlens.plus.reactivateProTrial",
1130311308
"when": "gitlens:plus:state == 5"
1130411309
},
11310+
{
11311+
"command": "gitlens.plus.referFriend",
11312+
"when": "gitlens:plus"
11313+
},
1130511314
{
1130611315
"command": "gitlens.plus.refreshRepositoryAccess",
1130711316
"when": "gitlens:enabled"

src/constants.commands.generated.ts

+1
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ export type ContributedPaletteCommands =
724724
| 'gitlens.plus.logout'
725725
| 'gitlens.plus.manage'
726726
| 'gitlens.plus.reactivateProTrial'
727+
| 'gitlens.plus.referFriend'
727728
| 'gitlens.plus.refreshRepositoryAccess'
728729
| 'gitlens.plus.restore'
729730
| 'gitlens.plus.signUp'

src/constants.telemetry.ts

+1
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ type SubscriptionActionEventData =
816816
| 'sign-out'
817817
| 'manage'
818818
| 'reactivate'
819+
| 'refer-friend'
819820
| 'resend-verification'
820821
| 'pricing'
821822
| 'start-preview-trial';

src/plus/gk/subscriptionService.ts

+10
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ export class SubscriptionService implements Disposable {
348348
registerCommand('gitlens.plus.login', (src?: Source) => this.loginOrSignUp(false, src)),
349349
registerCommand('gitlens.plus.signUp', (src?: Source) => this.loginOrSignUp(true, src)),
350350
registerCommand('gitlens.plus.logout', (src?: Source) => this.logout(src)),
351+
registerCommand('gitlens.plus.referFriend', (src?: Source) => this.referFriend(src)),
351352
registerCommand('gitlens.gk.switchOrganization', (src?: Source) => this.switchOrganization(src)),
352353

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

730+
@log()
731+
async referFriend(source: Source | undefined): Promise<void> {
732+
if (this.container.telemetry.enabled) {
733+
this.container.telemetry.sendEvent('subscription/action', { action: 'refer-friend' }, source);
734+
}
735+
736+
await openUrl(this.container.urls.getGkDevUrl(undefined, 'referral_portal=true&source=gitlens'));
737+
}
738+
729739
@gate(() => '')
730740
@log()
731741
async resendVerification(source: Source | undefined): Promise<boolean> {

src/webviews/apps/plus/shared/components/account-chip.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ export class GLAccountChip extends LitElement {
406406
private renderAccountState() {
407407
switch (this.subscriptionState) {
408408
case SubscriptionState.Paid:
409-
return html`<div class="account-status">${this.renderIncludesDevEx()}</div> `;
409+
return html`<div class="account-status">
410+
${this.renderIncludesDevEx()} ${this.renderReferFriend()}
411+
</div> `;
410412

411413
case SubscriptionState.VerificationRequired:
412414
return html`<div class="account-status">
@@ -456,7 +458,7 @@ export class GLAccountChip extends LitElement {
456458
>Upgrade to Pro</gl-button
457459
>
458460
</button-container>
459-
${this.renderPromo()} ${this.renderIncludesDevEx()}
461+
${this.renderPromo()} ${this.renderIncludesDevEx()} ${this.renderReferFriend()}
460462
</div>`;
461463
}
462464

@@ -473,7 +475,7 @@ export class GLAccountChip extends LitElement {
473475
>Upgrade to Pro</gl-button
474476
>
475477
</button-container>
476-
${this.renderPromo()} ${this.renderIncludesDevEx()}
478+
${this.renderPromo()} ${this.renderIncludesDevEx()} ${this.renderReferFriend()}
477479
</div>`;
478480

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

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

534+
private renderReferFriend() {
535+
return html`<p>
536+
<a
537+
href="${createCommandLink<Source>('gitlens.plus.referFriend', {
538+
source: 'account',
539+
})}"
540+
>Refer a friend</a
541+
>
542+
&mdash; give 50% off and get up to $20
543+
</p>`;
544+
}
545+
531546
private renderPromo() {
532547
return html`<gl-promo
533548
.promoPromise=${this.promos.getApplicablePromo('account')}

0 commit comments

Comments
 (0)