diff --git a/contributions.json b/contributions.json index 58f7743429d4a..ae6ea35155f72 100644 --- a/contributions.json +++ b/contributions.json @@ -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" diff --git a/docs/telemetry-events.md b/docs/telemetry-events.md index 9a7b3b7e8b5ce..b536e39b3e8b2 100644 --- a/docs/telemetry-events.md +++ b/docs/telemetry-events.md @@ -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' } ``` diff --git a/package.json b/package.json index 7f6cf34fce215..fd620c5fb894c 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/src/constants.commands.generated.ts b/src/constants.commands.generated.ts index 1e4bc0735171d..315108f8d2f64 100644 --- a/src/constants.commands.generated.ts +++ b/src/constants.commands.generated.ts @@ -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' diff --git a/src/constants.telemetry.ts b/src/constants.telemetry.ts index 73744716e88b1..d1383a97cd09e 100644 --- a/src/constants.telemetry.ts +++ b/src/constants.telemetry.ts @@ -816,6 +816,7 @@ type SubscriptionActionEventData = | 'sign-out' | 'manage' | 'reactivate' + | 'refer-friend' | 'resend-verification' | 'pricing' | 'start-preview-trial'; diff --git a/src/plus/gk/subscriptionService.ts b/src/plus/gk/subscriptionService.ts index 19a374db0d0c8..cf63ba81fcafd 100644 --- a/src/plus/gk/subscriptionService.ts +++ b/src/plus/gk/subscriptionService.ts @@ -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)), @@ -726,6 +727,15 @@ export class SubscriptionService implements Disposable { } } + @log() + async referFriend(source: Source | undefined): Promise { + 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 { diff --git a/src/webviews/apps/plus/shared/components/account-chip.ts b/src/webviews/apps/plus/shared/components/account-chip.ts index 72e3690c950cc..1dca290d54643 100644 --- a/src/webviews/apps/plus/shared/components/account-chip.ts +++ b/src/webviews/apps/plus/shared/components/account-chip.ts @@ -406,7 +406,9 @@ export class GLAccountChip extends LitElement { private renderAccountState() { switch (this.subscriptionState) { case SubscriptionState.Paid: - return html` `; + return html` `; case SubscriptionState.VerificationRequired: return html``; } @@ -473,7 +475,7 @@ export class GLAccountChip extends LitElement { >Upgrade to Pro - ${this.renderPromo()} ${this.renderIncludesDevEx()} + ${this.renderPromo()} ${this.renderIncludesDevEx()} ${this.renderReferFriend()} `; case SubscriptionState.ProTrialReactivationEligible: @@ -492,6 +494,7 @@ export class GLAccountChip extends LitElement { >Reactivate GitLens Pro Trial + ${this.renderReferFriend()} `; default: @@ -528,6 +531,18 @@ export class GLAccountChip extends LitElement { return html`

Includes access to GitKraken's DevEx platform

`; } + private renderReferFriend() { + return html`

+ Refer a friend + — give 50% off and get up to $20 +

`; + } + private renderPromo() { return html`