Skip to content

Commit 6043a35

Browse files
committed
Adds help center URL fallback for disabled walkthroughs
1 parent 98f1bb1 commit 6043a35

15 files changed

+191
-97
lines changed

docs/telemetry-events.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3335,7 +3335,8 @@ or
33353335
33363336
```typescript
33373337
{
3338-
'step': 'welcome-in-trial' | 'welcome-paid' | 'welcome-in-trial-expired-eligible' | 'welcome-in-trial-expired' | 'get-started-community' | 'visualize-code-history' | 'accelerate-pr-reviews' | 'streamline-collaboration' | 'improve-workflows-with-integrations'
3338+
'step': 'welcome-in-trial' | 'welcome-paid' | 'welcome-in-trial-expired-eligible' | 'welcome-in-trial-expired' | 'get-started-community' | 'visualize-code-history' | 'accelerate-pr-reviews' | 'streamline-collaboration' | 'improve-workflows-with-integrations',
3339+
'usingFallbackUrl': boolean
33393340
}
33403341
```
33413342

src/commands/quickCommand.steps.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ import { first, map } from '../system/iterable';
118118
import { Logger } from '../system/logger';
119119
import { getSettledValue } from '../system/promise';
120120
import { pad, pluralize, truncate } from '../system/string';
121-
import { isWalkthroughSupported } from '../telemetry/walkthroughStateProvider';
122121
import type { ViewsWithRepositoryFolders } from '../views/viewBase';
123122
import type {
124123
AsyncStepResultGenerator,
@@ -2712,23 +2711,21 @@ export async function* ensureAccessStep<
27122711

27132712
switch (feature) {
27142713
case 'launchpad':
2715-
if (isWalkthroughSupported()) {
2716-
directives.splice(
2717-
0,
2718-
0,
2719-
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
2720-
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
2721-
detail: 'Click to learn more about Launchpad',
2722-
iconPath: new ThemeIcon('rocket'),
2723-
onDidSelect: () =>
2724-
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
2725-
step: 'accelerate-pr-reviews',
2726-
source: { source: 'launchpad', detail: 'info' },
2727-
}),
2728-
}),
2729-
createQuickPickSeparator(),
2730-
);
2731-
}
2714+
directives.splice(
2715+
0,
2716+
0,
2717+
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
2718+
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
2719+
detail: 'Click to learn more about Launchpad',
2720+
iconPath: new ThemeIcon('rocket'),
2721+
onDidSelect: () =>
2722+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
2723+
step: 'accelerate-pr-reviews',
2724+
source: { source: 'launchpad', detail: 'info' },
2725+
}),
2726+
}),
2727+
createQuickPickSeparator(),
2728+
);
27322729
break;
27332730
case 'startWork':
27342731
directives.splice(

src/commands/walkthroughs.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { WalkthroughSteps } from '../constants';
22
import { urls } from '../constants';
33
import type { GlCommands } from '../constants.commands';
4-
import type { Source, Sources } from '../constants.telemetry';
4+
import type { Source, Sources, TelemetryEvents } from '../constants.telemetry';
55
import type { Container } from '../container';
66
import type { SubscriptionUpgradeCommandArgs } from '../plus/gk/models/subscription';
77
import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
88
import { command, executeCommand, executeCoreCommand } from '../system/-webview/command';
99
import { openWalkthrough as openWalkthroughCore } from '../system/-webview/vscode';
1010
import { openUrl } from '../system/-webview/vscode/uris';
11+
import { isWalkthroughSupported } from '../telemetry/walkthroughStateProvider';
1112
import type { ConnectCloudIntegrationsCommandArgs } from './cloudIntegrations';
1213
import { GlCommandBase } from './commandBase';
1314
import type { WorktreeGitCommandArgs } from './git/worktree';
@@ -42,9 +43,33 @@ export class OpenWalkthroughCommand extends GlCommandBase {
4243
}
4344
}
4445

46+
const helpCenterWalkthroughUrls = new Map<WalkthroughSteps | 'default', string>([
47+
['default', urls.getStarted],
48+
['welcome-in-trial', urls.welcomeInTrial],
49+
['welcome-paid', urls.welcomePaid],
50+
['welcome-in-trial-expired-eligible', urls.welcomeTrialReactivationEligible],
51+
['welcome-in-trial-expired', urls.welcomeTrialExpired],
52+
['get-started-community', urls.getStarted],
53+
['visualize-code-history', urls.interactiveCodeHistory],
54+
['accelerate-pr-reviews', urls.acceleratePrReviews],
55+
['streamline-collaboration', urls.streamlineCollaboration],
56+
['improve-workflows-with-integrations', urls.startIntegrations],
57+
]);
58+
4559
function openWalkthrough(container: Container, args?: OpenWalkthroughCommandArgs) {
60+
const walkthroughSupported = isWalkthroughSupported();
4661
if (container.telemetry.enabled) {
47-
container.telemetry.sendEvent('walkthrough', { step: args?.step }, args?.source);
62+
const walkthroughEvent: TelemetryEvents['walkthrough'] = { step: args?.step };
63+
if (!walkthroughSupported) {
64+
walkthroughEvent.usingFallbackUrl = true;
65+
}
66+
container.telemetry.sendEvent('walkthrough', walkthroughEvent, args?.source);
67+
}
68+
69+
if (!walkthroughSupported) {
70+
const url = helpCenterWalkthroughUrls.get(args?.step ?? 'default')!;
71+
void openUrl(url);
72+
return;
4873
}
4974

5075
void openWalkthroughCore(container.context.extension.id, 'welcome', args?.step, false);

src/constants.context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import type { Uri } from 'vscode';
22
import type { AnnotationStatus, Keys } from './constants';
33
import type { SubscriptionState } from './constants.subscription';
44
import type { CustomEditorTypes, GroupableTreeViewTypes, WebviewTypes, WebviewViewTypes } from './constants.views';
5+
import type { WalkthroughContextKeys } from './constants.walkthroughs';
56
import type { Features } from './features';
67
import type { OrgAIProviders } from './plus/gk/models/organization';
78
import type { PromoKeys } from './plus/gk/models/promo';
89
import type { SubscriptionPlanIds } from './plus/gk/models/subscription';
9-
import type { WalkthroughContextKeys } from './telemetry/walkthroughStateProvider';
1010

1111
export type ContextKeys = {
1212
'gitlens:debugging': boolean;

src/constants.telemetry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import type { GlCommands, GlCommandsDeprecated } from './constants.commands';
55
import type { IntegrationIds, SupportedCloudIntegrationIds } from './constants.integrations';
66
import type { SubscriptionState } from './constants.subscription';
77
import type { CustomEditorTypes, TreeViewTypes, WebviewTypes, WebviewViewTypes } from './constants.views';
8+
import type { WalkthroughContextKeys } from './constants.walkthroughs';
89
import type { FeaturePreviews, FeaturePreviewStatus } from './features';
910
import type { GitContributionTiers } from './git/models/contributor';
1011
import type { AIActionType } from './plus/ai/models/model';
1112
import type { Subscription, SubscriptionAccount, SubscriptionStateString } from './plus/gk/models/subscription';
1213
import type { Flatten } from './system/object';
13-
import type { WalkthroughContextKeys } from './telemetry/walkthroughStateProvider';
1414
import type { GraphColumnConfig } from './webviews/plus/graph/protocol';
1515
import type { TimelinePeriod, TimelineScopeType, TimelineSliceBy } from './webviews/plus/timeline/protocol';
1616

@@ -1079,6 +1079,7 @@ interface UsageTrackEvent {
10791079

10801080
interface WalkthroughEvent {
10811081
step?: WalkthroughSteps;
1082+
usingFallbackUrl?: boolean;
10821083
}
10831084

10841085
type WalkthroughActionNames =

src/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ export const urls = Object.freeze({
188188
startIntegrations: `https://help.gitkraken.com/gitlens/gitlens-start-here/?${utm}#improve-workflows-with-integrations`,
189189
streamlineCollaboration: `https://help.gitkraken.com/gitlens/gitlens-start-here/?${utm}#streamline-collaboration`,
190190
aiFeatures: `https://help.gitkraken.com/gitlens/gl-gk-ai/?${utm}`,
191+
192+
getStarted: `https://help.gitkraken.com/gitlens/gitlens-home/?${utm}`,
193+
welcomeInTrial: `https://help.gitkraken.com/gitlens/gitlens-home/?${utm}`,
194+
welcomePaid: `https://help.gitkraken.com/gitlens/gitlens-home/?${utm}`,
195+
welcomeTrialExpired: `https://help.gitkraken.com/gitlens/gitlens-community-vs-gitlens-pro/?${utm}`,
196+
welcomeTrialReactivationEligible: `https://help.gitkraken.com/gitlens/gitlens-community-vs-gitlens-pro/?${utm}`,
191197
});
192198

193199
export type WalkthroughSteps =

src/constants.walkthroughs.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export type WalkthroughContextKeys =
2+
| 'gettingStarted'
3+
| 'homeView'
4+
| 'visualizeCodeHistory'
5+
| 'prReviews'
6+
| 'streamlineCollaboration'
7+
| 'integrations'
8+
| 'aiFeatures';
9+
10+
export const walkthroughProgressSteps: Record<WalkthroughContextKeys, string> = {
11+
gettingStarted: 'Getting Started',
12+
homeView: 'Home View',
13+
visualizeCodeHistory: 'Visualize Code History',
14+
prReviews: 'PR Reviews',
15+
streamlineCollaboration: 'Streamline Collaboration',
16+
integrations: 'Integrations',
17+
aiFeatures: 'AI Features',
18+
};

src/container.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import { Logger } from './system/logger';
6060
import { AIFeedbackProvider } from './telemetry/aiFeedbackProvider';
6161
import { TelemetryService } from './telemetry/telemetry';
6262
import { UsageTracker } from './telemetry/usageTracker';
63-
import { isWalkthroughSupported, WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
63+
import { WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
6464
import { GitTerminalLinkProvider } from './terminal/linkProvider';
6565
import { GitDocumentTracker } from './trackers/documentTracker';
6666
import { LineTracker } from './trackers/lineTracker';
@@ -207,9 +207,7 @@ export class Container {
207207
);
208208
this._disposables.push((this._uri = new UriService(this)));
209209
this._disposables.push((this._subscription = new SubscriptionService(this, this._connection, previousVersion)));
210-
if (isWalkthroughSupported()) {
211-
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
212-
}
210+
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
213211
this._disposables.push((this._organizations = new OrganizationService(this, this._connection)));
214212

215213
this._disposables.push((this._git = new GitProviderService(this)));
@@ -729,8 +727,8 @@ export class Container {
729727
return this._usage;
730728
}
731729

732-
private readonly _walkthrough: WalkthroughStateProvider | undefined;
733-
get walkthrough(): WalkthroughStateProvider | undefined {
730+
private readonly _walkthrough: WalkthroughStateProvider;
731+
get walkthrough(): WalkthroughStateProvider {
734732
return this._walkthrough;
735733
}
736734

src/plus/gk/subscriptionService.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ import { flatten } from '../../system/object';
6262
import { pauseOnCancelOrTimeout } from '../../system/promise';
6363
import { pluralize } from '../../system/string';
6464
import { createDisposable } from '../../system/unifiedDisposable';
65-
import { isWalkthroughSupported } from '../../telemetry/walkthroughStateProvider';
6665
import { LoginUriPathPrefix } from './authenticationConnection';
6766
import { authenticationProviderScopes } from './authenticationProvider';
6867
import type { GKCheckInResponse } from './models/checkin';
@@ -486,13 +485,13 @@ export class SubscriptionService implements Disposable {
486485
void this.resendVerification(source);
487486
}
488487
} else if (isSubscriptionPaid(this._subscription)) {
489-
const learn: MessageItem | undefined = isWalkthroughSupported() ? { title: 'Learn More' } : undefined;
488+
const learn: MessageItem = { title: 'Learn More' };
490489
const confirm: MessageItem = { title: 'Continue', isCloseAffordance: true };
491490
const result = await window.showInformationMessage(
492491
`You are now on ${actual.name} and have full access to all GitLens Pro features.`,
493492
{ modal: true },
494493
confirm,
495-
...(learn ? [learn] : []),
494+
learn,
496495
);
497496

498497
if (result === learn) {
@@ -501,7 +500,7 @@ export class SubscriptionService implements Disposable {
501500
} else if (isSubscriptionTrial(this._subscription)) {
502501
const days = getSubscriptionTimeRemaining(this._subscription, 'days') ?? 0;
503502

504-
const learn: MessageItem | undefined = isWalkthroughSupported() ? { title: 'Learn More' } : undefined;
503+
const learn: MessageItem = { title: 'Learn More' };
505504
const confirm: MessageItem = { title: 'Continue', isCloseAffordance: true };
506505
const result = await window.showInformationMessage(
507506
`Welcome to your ${effective.name} Trial.\n\nYou now have full access to all GitLens Pro features for ${
@@ -512,17 +511,15 @@ export class SubscriptionService implements Disposable {
512511
detail: 'Your trial also includes access to the GitKraken DevEx platform, unleashing powerful Git visualization & productivity capabilities everywhere you work: IDE, desktop, browser, and terminal.',
513512
},
514513
confirm,
515-
...(learn ? [learn] : []),
514+
learn,
516515
);
517516

518517
if (result === learn) {
519518
void this.learnAboutPro({ source: 'prompt', detail: { action: 'trial-started' } }, source);
520519
}
521520
} else {
522521
const upgrade: MessageItem = { title: 'Upgrade to Pro' };
523-
const learn: MessageItem | undefined = isWalkthroughSupported()
524-
? { title: 'Community vs. Pro' }
525-
: undefined;
522+
const learn: MessageItem = { title: 'Community vs. Pro' };
526523
const confirm: MessageItem = { title: 'Continue', isCloseAffordance: true };
527524
const result = await window.showInformationMessage(
528525
`You are now on ${actual.name}.`,
@@ -531,7 +528,7 @@ export class SubscriptionService implements Disposable {
531528
detail: 'You only have access to Pro features on publicly-hosted repos. For full access to all Pro features, please upgrade to GitLens Pro.',
532529
},
533530
upgrade,
534-
...(learn ? [learn] : []),
531+
learn,
535532
confirm,
536533
);
537534

src/plus/launchpad/launchpad.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import { getScopedCounter } from '../../system/counter';
5353
import { fromNow } from '../../system/date';
5454
import { some } from '../../system/iterable';
5555
import { interpolate, pluralize } from '../../system/string';
56-
import { isWalkthroughSupported } from '../../telemetry/walkthroughStateProvider';
5756
import { ProviderBuildStatusState, ProviderPullRequestReviewState } from '../integrations/providers/models';
5857
import type { LaunchpadCategorizedResult, LaunchpadItem } from './launchpadProvider';
5958
import {
@@ -1178,22 +1177,21 @@ export class LaunchpadCommand extends QuickCommand<State> {
11781177
context: Context,
11791178
): AsyncStepResultGenerator<{ connected: boolean | IntegrationIds; resume: () => void | undefined }> {
11801179
const hasConnectedIntegration = some(context.connectedIntegrations.values(), c => c);
1181-
const confirmations: (QuickPickItemOfT<IntegrationIds> | DirectiveQuickPickItem)[] =
1182-
!hasConnectedIntegration && isWalkthroughSupported()
1183-
? [
1184-
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
1185-
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
1186-
detail: 'Click to learn more about Launchpad',
1187-
iconPath: new ThemeIcon('rocket'),
1188-
onDidSelect: () =>
1189-
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
1190-
step: 'accelerate-pr-reviews',
1191-
source: { source: 'launchpad', detail: 'info' },
1192-
}),
1193-
}),
1194-
createQuickPickSeparator(),
1195-
]
1196-
: [];
1180+
const confirmations: (QuickPickItemOfT<IntegrationIds> | DirectiveQuickPickItem)[] = !hasConnectedIntegration
1181+
? [
1182+
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
1183+
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
1184+
detail: 'Click to learn more about Launchpad',
1185+
iconPath: new ThemeIcon('rocket'),
1186+
onDidSelect: () =>
1187+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
1188+
step: 'accelerate-pr-reviews',
1189+
source: { source: 'launchpad', detail: 'info' },
1190+
}),
1191+
}),
1192+
createQuickPickSeparator(),
1193+
]
1194+
: [];
11971195

11981196
for (const integration of supportedLaunchpadIntegrations) {
11991197
if (context.connectedIntegrations.get(integration)) {
@@ -1253,7 +1251,7 @@ export class LaunchpadCommand extends QuickCommand<State> {
12531251
const step = this.createConfirmStep(
12541252
`${this.title} \u00a0\u2022\u00a0 Connect an ${hasConnectedIntegration ? 'Additional ' : ''}Integration`,
12551253
[
1256-
...(hasConnectedIntegration || !isWalkthroughSupported()
1254+
...(hasConnectedIntegration
12571255
? []
12581256
: [
12591257
createDirectiveQuickPickItem(Directive.Cancel, undefined, {

0 commit comments

Comments
 (0)