|
1 | 1 | import type { WalkthroughSteps } from '../constants';
|
2 | 2 | import { urls } from '../constants';
|
3 | 3 | import type { GlCommands } from '../constants.commands';
|
4 |
| -import type { Source, Sources } from '../constants.telemetry'; |
| 4 | +import type { Source, Sources, TelemetryEvents } from '../constants.telemetry'; |
5 | 5 | import type { Container } from '../container';
|
6 | 6 | import type { SubscriptionUpgradeCommandArgs } from '../plus/gk/models/subscription';
|
7 | 7 | import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
|
8 | 8 | import { command, executeCommand, executeCoreCommand } from '../system/-webview/command';
|
9 | 9 | import { openWalkthrough as openWalkthroughCore } from '../system/-webview/vscode';
|
10 | 10 | import { openUrl } from '../system/-webview/vscode/uris';
|
| 11 | +import { isWalkthroughSupported } from '../telemetry/walkthroughStateProvider'; |
11 | 12 | import type { ConnectCloudIntegrationsCommandArgs } from './cloudIntegrations';
|
12 | 13 | import { GlCommandBase } from './commandBase';
|
13 | 14 | import type { WorktreeGitCommandArgs } from './git/worktree';
|
@@ -42,9 +43,34 @@ export class OpenWalkthroughCommand extends GlCommandBase {
|
42 | 43 | }
|
43 | 44 | }
|
44 | 45 |
|
| 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 | + |
45 | 58 | function openWalkthrough(container: Container, args?: OpenWalkthroughCommandArgs) {
|
| 59 | + const walkthroughSupported = isWalkthroughSupported(); |
46 | 60 | 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; |
48 | 74 | }
|
49 | 75 |
|
50 | 76 | void openWalkthroughCore(container.context.extension.id, 'welcome', args?.step, false);
|
|
0 commit comments