Skip to content

Commit bb8d140

Browse files
committed
Updates promos
1 parent 9fd45fc commit bb8d140

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19048,6 +19048,16 @@
1904819048
"contents": "Save more than 55% during our GitLens 16 sale!",
1904919049
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gitlens16 && gitlens:views:scm:grouped:view == launchpad"
1905019050
},
19051+
{
19052+
"view": "gitlens.views.launchpad",
19053+
"contents": "Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!",
19054+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == cybersale24"
19055+
},
19056+
{
19057+
"view": "gitlens.views.scm.grouped",
19058+
"contents": "Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!",
19059+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == cybersale24 && gitlens:views:scm:grouped:view == launchpad"
19060+
},
1905119061
{
1905219062
"view": "gitlens.views.launchpad",
1905319063
"contents": "Your Pro trial has ended. Please upgrade for full access to Launchpad and other Pro features.",
@@ -19166,6 +19176,16 @@
1916619176
"contents": "Save more than 55% during our GitLens 16 sale!",
1916719177
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == gitlens16 && gitlens:views:scm:grouped:view == worktrees"
1916819178
},
19179+
{
19180+
"view": "gitlens.views.worktrees",
19181+
"contents": "Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!",
19182+
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == cybersale24"
19183+
},
19184+
{
19185+
"view": "gitlens.views.scm.grouped",
19186+
"contents": "Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!",
19187+
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == cybersale24 && gitlens:views:scm:grouped:view == worktrees"
19188+
},
1916919189
{
1917019190
"view": "gitlens.views.worktrees",
1917119191
"contents": "Your Pro trial has ended. Please upgrade for full access to Worktrees and other Pro features.",

src/constants.subscription.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const proFeaturePreviewUsageDurationInDays = 1;
33
export const proPreviewLengthInDays = 0;
44
export const proTrialLengthInDays = 14;
55

6-
export type PromoKeys = 'gitlens16' | 'pro50';
6+
export type PromoKeys = 'cybersale24' | 'gitlens16' | 'pro50';
77

88
export const enum SubscriptionPlanId {
99
Community = 'community',

src/plus/gk/account/promos.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,32 @@ const promos: Promo[] = [
3131
SubscriptionState.ProTrialExpired,
3232
SubscriptionState.ProTrialReactivationEligible,
3333
],
34-
startsOn: new Date('2024-11-11T06:59:00.000Z').getTime(),
34+
startsOn: new Date('2024-12-11T06:59:00.000Z').getTime(),
3535
expiresOn: new Date('2024-11-24T06:59:00.000Z').getTime(),
3636
command: { tooltip: 'Save more than 55% during our GitLens 16 sale!' },
3737
locations: ['account', 'badge', 'gate'],
3838
quickpick: {
3939
detail: '$(star-full) Save more than 55% during our GitLens 16 sale!',
4040
},
4141
},
42+
{
43+
key: 'cybersale24',
44+
code: 'CYBERSALE24',
45+
states: [
46+
SubscriptionState.Community,
47+
SubscriptionState.ProPreview,
48+
SubscriptionState.ProPreviewExpired,
49+
SubscriptionState.ProTrial,
50+
SubscriptionState.ProTrialExpired,
51+
SubscriptionState.ProTrialReactivationEligible,
52+
],
53+
startsOn: new Date('2024-11-02T06:59:00.000Z').getTime(),
54+
expiresOn: new Date('2024-12-06T06:59:00.000Z').getTime(),
55+
command: { tooltip: 'Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!' },
56+
quickpick: {
57+
detail: '$(star-full) Cyber Sale: Save up to 85% on GitLens Pro — our best deal of the year!',
58+
},
59+
},
4260
{
4361
key: 'pro50',
4462
states: [

src/system/function.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,6 @@ export function throttle<T extends (...args: any[]) => ReturnType<T>>(fn: T, del
256256
}, delay);
257257
};
258258
}
259+
260+
//** Used to cause compile errors for exhaustive type checking */
261+
export function typeCheck<T>(value: T): asserts value is T {}

src/webviews/apps/shared/components/promo.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { css, html, LitElement, nothing } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
33
import { ifDefined } from 'lit/directives/if-defined.js';
44
import type { Promo } from '../../../../plus/gk/account/promos';
5+
import { typeCheck } from '../../../../system/function';
56

67
@customElement('gl-promo')
78
export class GlPromo extends LitElement {
@@ -77,17 +78,27 @@ export class GlPromo extends LitElement {
7778
}
7879

7980
private renderPromo(promo: Promo) {
80-
// NOTE: Don't add a default case or return at the end, so that if we add a new promo the build will break without handling it
8181
switch (promo.key) {
82-
case 'pro50':
82+
case 'cybersale24':
8383
return html`<span class="content${this.type === 'link' ? nothing : ' muted'}"
84-
><b>Save 33% or more</b> on your 1st seat of Pro</span
84+
>Cyber Sale: <b>Save up to 85%</b> on GitLens Pro — our best deal of the year!</span
8585
>`;
8686

8787
case 'gitlens16':
8888
return html`<span class="content${this.type === 'link' ? nothing : ' muted'}"
8989
><b>Save more than 55%</b> during our GitLens 16 sale!</span
9090
>`;
91+
92+
case 'pro50':
93+
return html`<span class="content${this.type === 'link' ? nothing : ' muted'}"
94+
><b>Save 33% or more</b> on your 1st seat of Pro</span
95+
>`;
96+
97+
default: {
98+
debugger;
99+
typeCheck<never>(promo.key);
100+
return nothing;
101+
}
91102
}
92103
}
93104
}

0 commit comments

Comments
 (0)