Skip to content

Commit 7c16226

Browse files
committed
Adds help center URL fallback for disabled walkthroughs
1 parent 9d2789f commit 7c16226

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

docs/telemetry-events.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,8 @@ or
22122212
22132213
```typescript
22142214
{
2215-
'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'
2215+
'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',
2216+
'usingFallbackUrl': boolean
22162217
}
22172218
```
22182219

src/commands/walkthroughs.ts

Lines changed: 28 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,34 @@ export class OpenWalkthroughCommand extends GlCommandBase {
4243
}
4344
}
4445

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

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

src/constants.telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ interface UsageTrackEvent {
924924

925925
interface WalkthroughEvent {
926926
step?: WalkthroughSteps;
927+
usingFallbackUrl?: boolean;
927928
}
928929

929930
type WalkthroughActionNames =

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ 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+
getStarted: `https://help.gitkraken.com/gitlens/gitlens-home/?${utm}`,
191192
});
192193

193194
export type WalkthroughSteps =

0 commit comments

Comments
 (0)