|
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,33 @@ export class OpenWalkthroughCommand extends GlCommandBase { |
42 | 43 | } |
43 | 44 | } |
44 | 45 |
|
| 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 | + |
45 | 59 | function openWalkthrough(container: Container, args?: OpenWalkthroughCommandArgs) { |
| 60 | + const walkthroughSupported = isWalkthroughSupported(); |
46 | 61 | 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; |
48 | 73 | } |
49 | 74 |
|
50 | 75 | void openWalkthroughCore(container.context.extension.id, 'welcome', args?.step, false); |
|
0 commit comments