Skip to content

Commit 9b32bda

Browse files
committed
Adds source tracking to upgrade commands for promos and walkthrough
1 parent 0368aea commit 9b32bda

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

src/commands/walkthroughs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class WalkthroughPlusUpgradeCommand extends GlCommandBase {
7979
name: 'plus/upgrade',
8080
command: command,
8181
});
82-
executeCommand(command);
82+
executeCommand(command, { source: 'walkthrough' });
8383
}
8484
}
8585

src/webviews/apps/home/components/promo-banner.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ export class GlPromoBanner extends LitElement {
4646
}
4747

4848
return html`
49-
<gl-promo .promo=${this.promo} class="promo-banner promo-banner--eyebrow" id="promo" type="link"></gl-promo>
49+
<gl-promo
50+
.promo=${this.promo}
51+
source="home"
52+
class="promo-banner promo-banner--eyebrow"
53+
id="promo"
54+
type="link"
55+
></gl-promo>
5056
`;
5157
}
5258
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,6 @@ export class GLAccountChip extends LitElement {
523523
}
524524

525525
private renderPromo(promo: Promo | undefined) {
526-
return html`<gl-promo .promo=${promo}></gl-promo>`;
526+
return html`<gl-promo .promo=${promo} source="account"></gl-promo>`;
527527
}
528528
}

src/webviews/apps/plus/shared/components/feature-gate-plus-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export class GlFeatureGatePlusState extends LitElement {
324324
}
325325

326326
private renderPromo(promo: Promo | undefined) {
327-
return html`<gl-promo .promo=${promo}></gl-promo>`;
327+
return html`<gl-promo .promo=${promo} .source=${this.source}></gl-promo>`;
328328
}
329329
}
330330

src/webviews/apps/shared/components/feature-badge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export class GlFeatureBadge extends LitElement {
345345
}
346346

347347
private renderPromo(promo: Promo | undefined) {
348-
return html`<gl-promo .promo=${promo}></gl-promo>`;
348+
return html`<gl-promo .promo=${promo} .source=${this.source}></gl-promo>`;
349349
}
350350
}
351351

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ export class GlPromo extends LitElement {
5151
@property({ type: Object })
5252
promo: Promo | undefined;
5353

54+
@property({ type: String })
55+
source?: string;
56+
5457
@property({ reflect: true, type: String })
5558
type: 'link' | 'info' = 'info';
5659

@@ -59,17 +62,21 @@ export class GlPromo extends LitElement {
5962
return this.promo != null;
6063
}
6164

62-
override render() {
65+
private get commandUrl() {
66+
const command = this.promo?.command?.command ?? 'command:gitlens.plus.upgrade';
67+
if (this.source == null) return command;
68+
69+
return `${command}?${encodeURIComponent(JSON.stringify({ source: this.source }))}`;
70+
}
71+
72+
override render(): unknown {
6373
if (!this.promo) return;
6474

6575
const promoHtml = this.renderPromo(this.promo);
6676
if (!promoHtml) return;
6777

6878
if (this.type === 'link') {
69-
return html`<a
70-
class="link"
71-
href="${this.promo.command?.command ?? 'command:gitlens.plus.upgrade'}"
72-
title="${ifDefined(this.promo.command?.tooltip)}"
79+
return html`<a class="link" href="${this.commandUrl}" title="${ifDefined(this.promo.command?.tooltip)}"
7380
>${promoHtml}</a
7481
>`;
7582
}

0 commit comments

Comments
 (0)