waveterm/frontend/util/endpoints.ts
Copilot 95a97ca932
Add Onboarding Flows to Preview Server (#2960)
`FilesPage` was previously previewed through a special path because
`EditBashrcCommand` (Monaco via `CodeEditor`) threw in preview mode.
With preview/global handling now fixed, preview can run the real Files
onboarding flow end-to-end without command overrides.

- **Files preview now uses the real FilesPage path**
  - `OnboardingPreview` renders `FilesPage` directly.
- Removed preview-only command injection/override behavior for Files
onboarding.

- **Reverted FilesPage customization**
  - Dropped optional command renderer plumbing added for preview.
  - Restored FilesPage to its original internal command rotation:
    `EditBashrcCommand -> ViewShortcutsCommand -> ViewLogoCommand`.

- **Result**
  - No Files-specific preview fork remains.
  - Preview and production use the same FilesPage command lifecycle.

```tsx
const commands = [
    (onComplete: () => void) => <EditBashrcCommand onComplete={onComplete} />,
    (onComplete: () => void) => <ViewShortcutsCommand isMac={isMac} onComplete={onComplete} />,
    (onComplete: () => void) => <ViewLogoCommand onComplete={onComplete} />,
];
```

<screenshot>

![Onboarding FilesPage preview using default
commands](https://github.com/user-attachments/assets/c5baf015-6204-41da-b72b-408ef137f32b)

</screenshot>

<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/wavetermdev/waveterm/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2026-03-02 11:06:01 -08:00

19 lines
634 B
TypeScript

// Copyright 2026, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { isPreviewWindow } from "@/app/store/windowtype";
import { getEnv } from "./getenv";
import { lazy } from "./util";
export const WebServerEndpointVarName = "WAVE_SERVER_WEB_ENDPOINT";
export const WSServerEndpointVarName = "WAVE_SERVER_WS_ENDPOINT";
export const getWebServerEndpoint = lazy(() => {
if (isPreviewWindow()) return null;
return `http://${getEnv(WebServerEndpointVarName)}`;
});
export const getWSServerEndpoint = lazy(() => {
if (isPreviewWindow()) return null;
return `ws://${getEnv(WSServerEndpointVarName)}`;
});