Skip to content

Commit f39d358

Browse files
committed
Adds help center URL fallback for disabled walkthroughs
1 parent f893820 commit f39d358

15 files changed

+203
-97
lines changed

docs/telemetry-events.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,8 @@ or
23012301
23022302
```typescript
23032303
{
2304-
'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'
2304+
'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',
2305+
'usingFallbackUrl': boolean
23052306
}
23062307
```
23072308

src/commands/quickCommand.steps.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ import { first, map } from '../system/iterable';
110110
import { Logger } from '../system/logger';
111111
import { getSettledValue } from '../system/promise';
112112
import { pad, pluralize, truncate } from '../system/string';
113-
import { isWalkthroughSupported } from '../telemetry/walkthroughStateProvider';
114113
import type { ViewsWithRepositoryFolders } from '../views/viewBase';
115114
import type {
116115
AsyncStepResultGenerator,
@@ -2688,23 +2687,21 @@ export async function* ensureAccessStep<
26882687

26892688
switch (feature) {
26902689
case 'launchpad':
2691-
if (isWalkthroughSupported()) {
2692-
directives.splice(
2693-
0,
2694-
0,
2695-
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
2696-
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
2697-
detail: 'Click to learn more about Launchpad',
2698-
iconPath: new ThemeIcon('rocket'),
2699-
onDidSelect: () =>
2700-
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
2701-
step: 'accelerate-pr-reviews',
2702-
source: { source: 'launchpad', detail: 'info' },
2703-
}),
2704-
}),
2705-
createQuickPickSeparator(),
2706-
);
2707-
}
2690+
directives.splice(
2691+
0,
2692+
0,
2693+
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
2694+
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
2695+
detail: 'Click to learn more about Launchpad',
2696+
iconPath: new ThemeIcon('rocket'),
2697+
onDidSelect: () =>
2698+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
2699+
step: 'accelerate-pr-reviews',
2700+
source: { source: 'launchpad', detail: 'info' },
2701+
}),
2702+
}),
2703+
createQuickPickSeparator(),
2704+
);
27082705
break;
27092706
case 'startWork':
27102707
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

@@ -963,6 +963,7 @@ interface UsageTrackEvent {
963963

964964
interface WalkthroughEvent {
965965
step?: WalkthroughSteps;
966+
usingFallbackUrl?: boolean;
966967
}
967968

968969
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: WalkthroughContextKeys[] = [
11+
'gettingStarted',
12+
'homeView',
13+
'visualizeCodeHistory',
14+
'prReviews',
15+
'streamlineCollaboration',
16+
'integrations',
17+
'aiFeatures',
18+
];

src/container.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { log } from './system/decorators/log';
5959
import { Logger } from './system/logger';
6060
import { TelemetryService } from './telemetry/telemetry';
6161
import { UsageTracker } from './telemetry/usageTracker';
62-
import { isWalkthroughSupported, WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
62+
import { WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
6363
import { GitTerminalLinkProvider } from './terminal/linkProvider';
6464
import { GitDocumentTracker } from './trackers/documentTracker';
6565
import { LineTracker } from './trackers/lineTracker';
@@ -205,9 +205,7 @@ export class Container {
205205
);
206206
this._disposables.push((this._uri = new UriService(this)));
207207
this._disposables.push((this._subscription = new SubscriptionService(this, this._connection, previousVersion)));
208-
if (isWalkthroughSupported()) {
209-
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
210-
}
208+
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
211209
this._disposables.push((this._organizations = new OrganizationService(this, this._connection)));
212210

213211
this._disposables.push((this._git = new GitProviderService(this)));
@@ -715,8 +713,8 @@ export class Container {
715713
return this._usage;
716714
}
717715

718-
private readonly _walkthrough: WalkthroughStateProvider | undefined;
719-
get walkthrough(): WalkthroughStateProvider | undefined {
716+
private readonly _walkthrough: WalkthroughStateProvider;
717+
get walkthrough(): WalkthroughStateProvider {
720718
return this._walkthrough;
721719
}
722720

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 {
@@ -1176,22 +1175,21 @@ export class LaunchpadCommand extends QuickCommand<State> {
11761175
context: Context,
11771176
): AsyncStepResultGenerator<{ connected: boolean | IntegrationIds; resume: () => void | undefined }> {
11781177
const hasConnectedIntegration = some(context.connectedIntegrations.values(), c => c);
1179-
const confirmations: (QuickPickItemOfT<IntegrationIds> | DirectiveQuickPickItem)[] =
1180-
!hasConnectedIntegration && isWalkthroughSupported()
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-
: [];
1178+
const confirmations: (QuickPickItemOfT<IntegrationIds> | DirectiveQuickPickItem)[] = !hasConnectedIntegration
1179+
? [
1180+
createDirectiveQuickPickItem(Directive.Cancel, undefined, {
1181+
label: 'Launchpad prioritizes your pull requests to keep you focused and your team unblocked',
1182+
detail: 'Click to learn more about Launchpad',
1183+
iconPath: new ThemeIcon('rocket'),
1184+
onDidSelect: () =>
1185+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
1186+
step: 'accelerate-pr-reviews',
1187+
source: { source: 'launchpad', detail: 'info' },
1188+
}),
1189+
}),
1190+
createQuickPickSeparator(),
1191+
]
1192+
: [];
11951193

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

0 commit comments

Comments
 (0)