Skip to content

Commit

Permalink
Updates promos
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Jan 20, 2025
1 parent 6c3356a commit 1ac7c8b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 102 deletions.
32 changes: 8 additions & 24 deletions contributions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12658,12 +12658,8 @@
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"contents": "Your Pro trial has ended. Please upgrade for full access to Launchpad and other Pro features.",
Expand Down Expand Up @@ -12765,12 +12761,8 @@
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"contents": "Your Pro trial has ended. Please upgrade for full access to Launchpad and other Pro features.",
Expand Down Expand Up @@ -12817,12 +12809,8 @@
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"contents": "Your Pro trial has ended. Please upgrade for full access to Worktrees and other Pro features.",
Expand Down Expand Up @@ -12951,12 +12939,8 @@
"when": "gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"contents": "Your Pro trial has ended. Please upgrade for full access to Worktrees and other Pro features.",
Expand Down
36 changes: 8 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19504,13 +19504,8 @@
},
{
"view": "gitlens.views.launchpad",
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"view": "gitlens.views.launchpad",
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"view": "gitlens.views.launchpad",
Expand Down Expand Up @@ -19564,13 +19559,8 @@
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"view": "gitlens.views.scm.grouped",
Expand Down Expand Up @@ -19629,13 +19619,8 @@
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"view": "gitlens.views.scm.grouped",
Expand Down Expand Up @@ -19717,13 +19702,8 @@
},
{
"view": "gitlens.views.worktrees",
"contents": "Save 33% or more on your 1st seat of Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
},
{
"view": "gitlens.views.worktrees",
"contents": "Get the gift of a better DevEx in 2025! Save up to 80% now",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gkholiday"
"contents": "Save 55% or more on your 1st seat of Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
"view": "gitlens.views.worktrees",
Expand Down
3 changes: 2 additions & 1 deletion src/constants.context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Uri } from 'vscode';
import type { AnnotationStatus, Keys } from './constants';
import type { PromoKeys, SubscriptionPlanId, SubscriptionState } from './constants.subscription';
import type { PromoKeys } from './constants.promos';
import type { SubscriptionPlanId, SubscriptionState } from './constants.subscription';
import type { CustomEditorTypes, GroupableTreeViewTypes, WebviewTypes, WebviewViewTypes } from './constants.views';
import type { WalkthroughContextKeys } from './telemetry/walkthroughStateProvider';

Expand Down
24 changes: 24 additions & 0 deletions src/constants.promos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { SubscriptionState } from './constants.subscription';
import type { Promo } from './plus/gk/models/promo';

export type PromoKeys = 'pro50';

// Must be ordered by applicable order
export const promos: Promo[] = [
{
key: 'pro50',
states: [
SubscriptionState.Community,
SubscriptionState.ProPreview,
SubscriptionState.ProPreviewExpired,
SubscriptionState.ProTrial,
SubscriptionState.ProTrialExpired,
SubscriptionState.ProTrialReactivationEligible,
],
command: { tooltip: 'Save 55% or more on your 1st seat of Pro.' },
locations: ['account', 'badge', 'gate'],
quickpick: {
detail: '$(star-full) Save 55% or more on your 1st seat of Pro',
},
},
];
2 changes: 0 additions & 2 deletions src/constants.subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ export const proFeaturePreviewUsageDurationInDays = 1;
export const proPreviewLengthInDays = 0;
export const proTrialLengthInDays = 14;

export type PromoKeys = 'gkholiday' | 'pro50';

export const enum SubscriptionPlanId {
Community = 'community',
CommunityWithAccount = 'community-with-account',
Expand Down
3 changes: 2 additions & 1 deletion src/plus/gk/models/promo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { PromoKeys, SubscriptionState } from '../../../constants.subscription';
import type { PromoKeys } from '../../../constants.promos';
import type { SubscriptionState } from '../../../constants.subscription';

export type PromoLocation = 'account' | 'badge' | 'gate' | 'home';

Expand Down
42 changes: 2 additions & 40 deletions src/plus/gk/utils/promo.utils.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,7 @@
import type { PromoKeys } from '../../../constants.subscription';
import { SubscriptionState } from '../../../constants.subscription';
import type { PromoKeys } from '../../../constants.promos';
import { promos } from '../../../constants.promos';
import type { Promo, PromoLocation } from '../models/promo';

// Must be ordered by applicable order
const promos: Promo[] = [
{
key: 'gkholiday',
code: 'GKHOLIDAY',
states: [
SubscriptionState.Community,
SubscriptionState.ProPreview,
SubscriptionState.ProPreviewExpired,
SubscriptionState.ProTrial,
SubscriptionState.ProTrialExpired,
SubscriptionState.ProTrialReactivationEligible,
],
startsOn: new Date('2024-12-09T06:59:00.000Z').getTime(),
expiresOn: new Date('2025-01-07T06:59:00.000Z').getTime(),
command: { tooltip: 'Get the gift of a better DevEx in 2025! Save up to 80% now' },
quickpick: {
detail: '$(star-full) Get the gift of a better DevEx in 2025! Save up to 80% now',
},
},
{
key: 'pro50',
states: [
SubscriptionState.Community,
SubscriptionState.ProPreview,
SubscriptionState.ProPreviewExpired,
SubscriptionState.ProTrial,
SubscriptionState.ProTrialExpired,
SubscriptionState.ProTrialReactivationEligible,
],
command: { tooltip: 'Save 33% or more on your 1st seat of Pro.' },
locations: ['account', 'badge', 'gate'],
quickpick: {
detail: '$(star-full) Save 33% or more on your 1st seat of Pro',
},
},
];

export function getApplicablePromo(
state: number | undefined,
location?: PromoLocation,
Expand Down
7 changes: 1 addition & 6 deletions src/webviews/apps/shared/components/promo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,9 @@ export class GlPromo extends LitElement {

private renderPromo(promo: Promo) {
switch (promo.key) {
case 'gkholiday':
return html`<span class="content${this.type === 'link' ? nothing : ' muted'}"
>Get the gift of a better DevEx in 2025! <b>Save up to 80% now</b></span
>`;

case 'pro50':
return html`<span class="content${this.type === 'link' ? nothing : ' muted'}"
><b>Save 33% or more</b> on your 1st seat of Pro</span
><b>Save 55% or more</b> on your 1st seat of Pro</span
>`;

default: {
Expand Down

0 comments on commit 1ac7c8b

Please sign in to comment.