Open History to see the last commit
1import { DeviceHostsSettings } from "./DeviceHostsSettings";
2/**
3 * Integrations settings - preferences for surfaces T3 Code embeds rather than
4 * owns. Browser is the first section: the defaults a preview tab opens at,
5 * applied to both hand-opened tabs and agent `preview_open` calls that don't
6 * state their own size.
7 *
8 * @module IntegrationsSettings
9 */
10import {
11 BrowserImportFailureReason,
12 BROWSER_PROFILE_MAX_COUNT,
13 type BrowserLinkTarget,
14 type BrowserProfile,
15 type EnvironmentId,
16 type SshDeviceHostConfig,
17 BROWSER_PROFILE_NAME_MAX_LENGTH,
18 BROWSER_RECORDING_FRAME_RATES,
19 DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW,
20 DEFAULT_BROWSER_PROFILE_ID,
21 DEFAULT_BROWSER_LINK_TARGET,
22 DEFAULT_BROWSER_RECORDING_FRAME_RATE,
23 DEFAULT_BROWSER_VIEWPORT,
24 DEFAULT_PREVIEW_APPEARANCE,
25 DEFAULT_PREVIEW_ZOOM_FACTOR,
26 FILL_PREVIEW_VIEWPORT,
27 PREVIEW_VIEWPORT_MAX_AREA,
28 PREVIEW_VIEWPORT_MAX_DIMENSION,
29 PREVIEW_VIEWPORT_MIN_DIMENSION,
30 PREVIEW_ZOOM_LEVELS,
31 findBrowserProfile,
32 isBuiltInBrowserProfileId,
33 resolveBrowserProfiles,
34 type BrowserImportSource,
35 type PreviewAppearancePreference,
36 type PreviewViewportSetting,
37} from "@t3tools/contracts";
38import { PREVIEW_VIEWPORT_PRESETS } from "@t3tools/shared/previewViewport";
39import { MoreVertical, Plus as PlusIcon } from "lucide-react";
40import { useCallback, useRef, useState } from "react";
41
42import { ScreenRotationIcon } from "~/browser/ScreenRotationIcon";
43import { AnimatedHeight } from "~/components/AnimatedHeight";
44import { resolveEnvironmentOptionLabel } from "~/components/BranchToolbar.logic";
45import { previewBridge } from "~/components/preview/previewBridge";
46import { cn, randomUUID } from "~/lib/utils";
47import { useEnvironments, usePrimaryEnvironment } from "~/state/environments";
48import { deviceEnvironment, useDeviceState } from "~/state/device";
49import { useAtomCommand } from "~/state/use-atom-command";
50import {
51 AgentDeviceSetupStatus,
52 DeviceHubSetupStatus,
53 PlatformStatus,
54 platformSetupStatus,
55 deviceHubDescription,
56 agentDeviceDescription,
57} from "~/components/device/DeviceSetup";
58import { isElectron } from "../../env";
59
60import { Badge } from "../ui/badge";
61import {
62 Menu,
63 MenuGroup,
64 MenuGroupLabel,
65 MenuItem,
66 MenuPopup,
67 MenuSeparator,
68 MenuTrigger,
69} from "../ui/menu";
70import { readLocalApi } from "~/localApi";
71
72import { toastManager } from "../ui/toast";
73import {
74 AlertDialog,
75 AlertDialogClose,
76 AlertDialogDescription,
77 AlertDialogFooter,
78 AlertDialogHeader,
79 AlertDialogPopup,
80 AlertDialogTitle,
81} from "../ui/alert-dialog";
82import { Button } from "../ui/button";
83import { DraftInput } from "../ui/draft-input";
84import { NumberField, NumberFieldGroup, NumberFieldInput } from "../ui/number-field";
85import {
86 Select,
87 SelectGroup,
88 SelectGroupLabel,
89 SelectItem,
90 SelectPopup,
91 SelectTrigger,
92 SelectValue,
93} from "../ui/select";
94import { Switch } from "../ui/switch";
95import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
96import {
97 getClientSettings,
98 persistClientSettingsUpdate,
99 useClientSettings,
100 useClientSettingsHydrated,
101 useUpdatePrimarySettings,
102} from "~/hooks/useSettings";
103
104import {
105 SettingsUnavailableGroup,
106 SettingResetButton,
107 SettingsPageContainer,
108 SettingsRow,
109 SettingsSection,
110} from "./settingsLayout";
111import { searchableSetting } from "./settingsSearch";
112import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
113import { useSettingsScope } from "./SettingsScopeContext";
114import { BrowserImportWizard, type WizardTarget } from "./BrowserImportWizard";
115import type { ImportOutcome } from "./browserImportWizard.logic";
116
117const FILL_VALUE = "fill";
118const RESPONSIVE_VALUE = "responsive";
119
120type BrowserProfileDataBridge = Pick<
121 NonNullable<typeof previewBridge>,
122 "clearCookies" | "clearCache"
123>;
124
125export async function clearBrowserProfileData(
126 bridge: BrowserProfileDataBridge | null,
127 environmentIds: ReadonlyArray<EnvironmentId>,
128 profileId: string,
129): Promise<void> {
130 if (bridge === null || environmentIds.length === 0) {
131 throw new Error("Browser profile data is not available to clear.");
132 }
133 await Promise.all(
134 environmentIds.flatMap((environmentId) => [
135 bridge.clearCookies(environmentId, profileId),
136 bridge.clearCache(environmentId, profileId),
137 ]),
138 );
139}
140
141export function browserProfileRemovalAvailable(
142 bridgeAvailable: boolean,
143 environmentsReady: boolean,
144 environmentCount: number,
145): boolean {
146 return bridgeAvailable && environmentsReady && environmentCount > 0;
147}
148
149/**
150 * The size a "Responsive" default falls back to when the user switches away
151 * from Fill and hasn't typed dimensions yet. Fill has no dimensions to carry
152 * over, so the picker needs something concrete to seed the inputs with.
153 */
154const RESPONSIVE_SEED_SIZE = { width: 1280, height: 800 } as const;
155
156const NO_GROUPING: Intl.NumberFormatOptions = { useGrouping: false };
157
158const APPEARANCE_LABELS: Readonly<Record<PreviewAppearancePreference, string>> = {
159 system: "System",
160 light: "Light",
161 dark: "Dark",
162};
163
164const zoomLabel = (zoomFactor: number) => `${Math.round(zoomFactor * 100)}%`;
165
166/**
167 * IPC flattens the failure to its message, so the reason token travels inside
168 * it. Anything unrecognised reads as a plain read failure rather than leaking
169 * the raw message into a toast.
170 */
171/** Thrown from the post-import settings updater when the cap was hit meanwhile. */
172class ProfileLimitReachedError extends Error {
173 constructor() {
174 super("Browser profile limit reached.");
175 this.name = "ProfileLimitReachedError";
176 }
177}
178
179export const importFailureReason = (cause: unknown): BrowserImportFailureReason => {
180 const message = String((cause as { message?: unknown } | undefined)?.message ?? "");
181 return (
182 BrowserImportFailureReason.literals.find((reason) => message.includes(`failed: ${reason}.`)) ??
183 "readFailed"
184 );
185};
186
187const viewportSelectValue = (viewport: PreviewViewportSetting): string => {
188 if (viewport._tag === "fill") return FILL_VALUE;
189 if (
190 viewport._tag === "preset" &&
191 PREVIEW_VIEWPORT_PRESETS.some((preset) => preset.id === viewport.presetId)
192 ) {
193 return viewport.presetId;
194 }
195 return RESPONSIVE_VALUE;
196};
197
198/**
199 * The trigger renders this rather than a bare `SelectValue`, which would fall
200 * back to printing the raw stored value ("fill") because the options are built
201 * inline instead of from an `items` map.
202 */
203const viewportSelectLabel = (viewport: PreviewViewportSetting): string => {
204 const value = viewportSelectValue(viewport);
205 if (value === FILL_VALUE) return "Fill panel";
206 if (value === RESPONSIVE_VALUE) return "Responsive";
207 return PREVIEW_VIEWPORT_PRESETS.find((preset) => preset.id === value)?.label ?? "Responsive";
208};
209
210const isValidDimension = (value: number) =>
211 Number.isInteger(value) &&
212 value >= PREVIEW_VIEWPORT_MIN_DIMENSION &&
213 value <= PREVIEW_VIEWPORT_MAX_DIMENSION;
214
215/**
216 * A sized viewport with width and height swapped. Presets keep their identity
217 * through a rotation — `resolvePreviewViewport` already stores rotated presets
218 * as the preset id plus swapped dimensions — so a rotated iPad is still an
219 * iPad, not an anonymous custom size.
220 */
221const rotateViewport = (
222 viewport: Exclude<PreviewViewportSetting, { readonly _tag: "fill" }>,
223): PreviewViewportSetting => ({
224 ...viewport,
225 width: viewport.height,
226 height: viewport.width,
227});
228
229function BrowserViewportSetting({ disabled }: { readonly disabled: boolean }) {
230 const viewport = useClientSettings((settings) => settings.browserDefaultViewport);
231 const updateSettings = useUpdatePrimarySettings();
232
233 const sized = viewport._tag === "fill" ? null : viewport;
234 const presentedSize = {
235 width: sized?.width ?? RESPONSIVE_SEED_SIZE.width,
236 height: sized?.height ?? RESPONSIVE_SEED_SIZE.height,
237 };
238
239 const selectViewport = (value: string | null) => {
240 if (value === FILL_VALUE) {
241 updateSettings({ browserDefaultViewport: FILL_PREVIEW_VIEWPORT });
242 return;
243 }
244 if (value === RESPONSIVE_VALUE) {
245 updateSettings({
246 browserDefaultViewport: {
247 _tag: "freeform",
248 width: sized?.width ?? RESPONSIVE_SEED_SIZE.width,
249 height: sized?.height ?? RESPONSIVE_SEED_SIZE.height,
250 },
251 });
252 return;
253 }
254 const preset = PREVIEW_VIEWPORT_PRESETS.find((candidate) => candidate.id === value);
255 if (!preset) return;
256 updateSettings({
257 browserDefaultViewport: {
258 _tag: "preset",
259 width: preset.width,
260 height: preset.height,
261 presetId: preset.id,
262 },
263 });
264 };
265
266 // Committed on blur rather than per keystroke: typing "2560" passes through
267 // "256", which is a legal dimension, so an onValueChange handler would
268 // persist that intermediate size and churn the settings file on every key.
269 const commitDimension = (axis: "width" | "height", value: number | null) => {
270 if (value === null || !isValidDimension(value)) return;
271 const next = { ...presentedSize, [axis]: value };
272 if (next.width * next.height > PREVIEW_VIEWPORT_MAX_AREA) return;
273 if (sized && next.width === sized.width && next.height === sized.height) return;
274 // Typing a size means the preset no longer describes it.
275 updateSettings({ browserDefaultViewport: { _tag: "freeform", ...next } });
276 };
277
278 return (
279 <SettingsRow
280 {...searchableSetting("browser-default-viewport")}
281 description="Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar."
282 resetAction={
283 !disabled && viewport._tag !== DEFAULT_BROWSER_VIEWPORT._tag ? (
284 <SettingResetButton
285 label="default browser viewport"
286 onClick={() => updateSettings({ browserDefaultViewport: DEFAULT_BROWSER_VIEWPORT })}
287 />
288 ) : null
289 }
290 control={
291 <div className="flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto">
292 <Select
293 value={viewportSelectValue(viewport)}
294 onValueChange={selectViewport}
295 disabled={disabled}
296 >
297 <SelectTrigger
298 size="sm"
299 className="w-full min-w-0 sm:w-44"
300 aria-label="Default browser viewport"
301 >
302 <SelectValue>{viewportSelectLabel(viewport)}</SelectValue>
303 </SelectTrigger>
304 <SelectPopup align="end" alignItemWithTrigger={false} className="min-w-64">
305 <SelectItem value={FILL_VALUE}>Fill panel</SelectItem>
306 <SelectItem value={RESPONSIVE_VALUE}>Responsive</SelectItem>
307 <SelectGroup>
308 <SelectGroupLabel>Standard</SelectGroupLabel>
309 {PREVIEW_VIEWPORT_PRESETS.map((preset) => (
310 <SelectItem key={preset.id} value={preset.id}>
311 <span className="flex w-full items-center justify-between gap-5">
312 <span>{preset.label}</span>
313 <span className="text-xs tabular-nums text-muted-foreground">
314 {preset.detail}
315 </span>
316 </span>
317 </SelectItem>
318 ))}
319 </SelectGroup>
320 </SelectPopup>
321 </Select>
322
323 {sized ? (
324 <div className="flex min-w-0 items-center gap-1">
325 <NumberField
326 value={presentedSize.width}
327 min={PREVIEW_VIEWPORT_MIN_DIMENSION}
328 max={PREVIEW_VIEWPORT_MAX_DIMENSION}
329 disabled={disabled}
330 // Pixel counts read as raw numbers; grouping would show "1,024".
331 format={NO_GROUPING}
332 size="sm"
333 className="w-20"
334 onValueCommitted={(value) => commitDimension("width", value)}
335 >
336 <NumberFieldGroup>
337 <NumberFieldInput aria-label="Default viewport width" />
338 </NumberFieldGroup>
339 </NumberField>
340 <span className="text-xs text-muted-foreground">×</span>
341 <NumberField
342 value={presentedSize.height}
343 min={PREVIEW_VIEWPORT_MIN_DIMENSION}
344 max={PREVIEW_VIEWPORT_MAX_DIMENSION}
345 disabled={disabled}
346 format={NO_GROUPING}
347 size="sm"
348 className="w-20"
349 onValueCommitted={(value) => commitDimension("height", value)}
350 >
351 <NumberFieldGroup>
352 <NumberFieldInput aria-label="Default viewport height" />
353 </NumberFieldGroup>
354 </NumberField>
355 <Tooltip>
356 <TooltipTrigger
357 render={
358 <Button
359 size="icon-sm"
360 variant="ghost-muted"
361 disabled={disabled}
362 aria-label={`Rotate to ${
363 presentedSize.height >= presentedSize.width ? "landscape" : "portrait"
364 }`}
365 onClick={() =>
366 updateSettings({ browserDefaultViewport: rotateViewport(sized) })
367 }
368 >
369 <ScreenRotationIcon />
370 </Button>
371 }
372 />
373 <TooltipPopup side="top">Rotate</TooltipPopup>
374 </Tooltip>
375 </div>
376 ) : null}
377 </div>
378 }
379 />
380 );
381}
382
383function BrowserZoomSetting({ disabled }: { readonly disabled: boolean }) {
384 const zoomFactor = useClientSettings((settings) => settings.browserDefaultZoomFactor);
385 const updateSettings = useUpdatePrimarySettings();
386
387 return (
388 <SettingsRow
389 {...searchableSetting("browser-default-zoom")}
390 description="Page zoom applied to new browser tabs."
391 resetAction={
392 !disabled && zoomFactor !== DEFAULT_PREVIEW_ZOOM_FACTOR ? (
393 <SettingResetButton
394 label="default browser zoom"
395 onClick={() =>
396 updateSettings({ browserDefaultZoomFactor: DEFAULT_PREVIEW_ZOOM_FACTOR })
397 }
398 />
399 ) : null
400 }
401 control={
402 <Select
403 disabled={disabled}
404 value={String(zoomFactor)}
405 onValueChange={(value) => {
406 const next = PREVIEW_ZOOM_LEVELS.find((level) => String(level) === value);
407 if (next !== undefined) updateSettings({ browserDefaultZoomFactor: next });
408 }}
409 >
410 <SelectTrigger size="sm" className="w-full sm:w-40" aria-label="Default browser zoom">
411 <SelectValue>{zoomLabel(zoomFactor)}</SelectValue>
412 </SelectTrigger>
413 <SelectPopup align="end" alignItemWithTrigger={false}>
414 {PREVIEW_ZOOM_LEVELS.map((level) => (
415 <SelectItem hideIndicator key={level} value={String(level)}>
416 {zoomLabel(level)}
417 </SelectItem>
418 ))}
419 </SelectPopup>
420 </Select>
421 }
422 />
423 );
424}
425
426function BrowserAppearanceSetting({ disabled }: { readonly disabled: boolean }) {
427 const appearance = useClientSettings((settings) => settings.browserDefaultAppearance);
428 const updateSettings = useUpdatePrimarySettings();
429
430 return (
431 <SettingsRow
432 {...searchableSetting("browser-default-appearance")}
433 description="The color scheme pages are told to prefer. System follows your OS setting."
434 resetAction={
435 !disabled && appearance !== DEFAULT_PREVIEW_APPEARANCE ? (
436 <SettingResetButton
437 label="default browser appearance"
438 onClick={() => updateSettings({ browserDefaultAppearance: DEFAULT_PREVIEW_APPEARANCE })}
439 />
440 ) : null
441 }
442 control={
443 <Select
444 disabled={disabled}
445 value={appearance}
446 onValueChange={(value) => {
447 if (value === "system" || value === "light" || value === "dark") {
448 updateSettings({ browserDefaultAppearance: value });
449 }
450 }}
451 >
452 <SelectTrigger
453 size="sm"
454 className="w-full sm:w-40"
455 aria-label="Default browser appearance"
456 >
457 <SelectValue>{APPEARANCE_LABELS[appearance]}</SelectValue>
458 </SelectTrigger>
459 <SelectPopup align="end" alignItemWithTrigger={false}>
460 {Object.entries(APPEARANCE_LABELS).map(([value, label]) => (
461 <SelectItem hideIndicator key={value} value={value}>
462 {label}
463 </SelectItem>
464 ))}
465 </SelectPopup>
466 </Select>
467 }
468 />
469 );
470}
471
472function BrowserRecordingFrameRateSetting({ disabled }: { readonly disabled: boolean }) {
473 const frameRate = useClientSettings((settings) => settings.browserRecordingFrameRate);
474 const updateSettings = useUpdatePrimarySettings();
475
476 return (
477 <SettingsRow
478 {...searchableSetting("browser-recording-frame-rate")}
479 description="Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother."
480 resetAction={
481 !disabled && frameRate !== DEFAULT_BROWSER_RECORDING_FRAME_RATE ? (
482 <SettingResetButton
483 label="browser recording frame rate"
484 onClick={() =>
485 updateSettings({ browserRecordingFrameRate: DEFAULT_BROWSER_RECORDING_FRAME_RATE })
486 }
487 />
488 ) : null
489 }
490 control={
491 <Select
492 disabled={disabled}
493 value={String(frameRate)}
494 onValueChange={(value) => {
495 const next = BROWSER_RECORDING_FRAME_RATES.find((rate) => String(rate) === value);
496 if (next !== undefined) {
497 updateSettings({ browserRecordingFrameRate: next });
498 }
499 }}
500 >
501 <SelectTrigger
502 size="sm"
503 className="w-full sm:w-40"
504 aria-label="Browser recording frame rate"
505 >
506 <SelectValue>{frameRate} fps</SelectValue>
507 </SelectTrigger>
508 <SelectPopup align="end" alignItemWithTrigger={false}>
509 {BROWSER_RECORDING_FRAME_RATES.map((rate) => (
510 <SelectItem hideIndicator key={rate} value={String(rate)}>
511 {rate} fps
512 </SelectItem>
513 ))}
514 </SelectPopup>
515 </Select>
516 }
517 />
518 );
519}
520
521const LINK_TARGET_LABELS: Readonly<Record<BrowserLinkTarget, string>> = {
522 system: "Your default browser",
523 app: "T3 Code",
524};
525
526function BrowserLinkTargetSetting({ disabled }: { readonly disabled: boolean }) {
527 const linkTarget = useClientSettings((settings) => settings.browserLinkTarget);
528 const updateSettings = useUpdatePrimarySettings();
529
530 return (
531 <SettingsRow
532 {...searchableSetting("browser-link-target")}
533 description="Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way."
534 resetAction={
535 !disabled && linkTarget !== DEFAULT_BROWSER_LINK_TARGET ? (
536 <SettingResetButton
537 label="link target"
538 onClick={() => updateSettings({ browserLinkTarget: DEFAULT_BROWSER_LINK_TARGET })}
539 />
540 ) : null
541 }
542 control={
543 <Select
544 disabled={disabled}
545 value={linkTarget}
546 onValueChange={(value) => {
547 if (value === "system" || value === "app") {
548 updateSettings({ browserLinkTarget: value });
549 }
550 }}
551 >
552 <SelectTrigger size="sm" className="w-full sm:w-40" aria-label="Open links in">
553 <SelectValue>{LINK_TARGET_LABELS[linkTarget]}</SelectValue>
554 </SelectTrigger>
555 <SelectPopup align="end" alignItemWithTrigger={false}>
556 {(Object.keys(LINK_TARGET_LABELS) as ReadonlyArray<BrowserLinkTarget>).map((target) => (
557 <SelectItem hideIndicator key={target} value={target}>
558 {LINK_TARGET_LABELS[target]}
559 </SelectItem>
560 ))}
561 </SelectPopup>
562 </Select>
563 }
564 />
565 );
566}
567
568/**
569 * Device support installs helper processes and hosts on one machine, so it
570 * follows the environment crumb. With several environments selected it shows
571 * the representative, named in the section title.
572 */
573function DeviceIntegrationSettings() {
574 const { scope, environment: selected, connectedEnvironments } = useSettingsScope();
575 const connected = selected?.connection.phase === "connected" && selected.serverConfig !== null;
576 const environmentId = connected ? selected.environmentId : null;
577 const aggregate = scope.environmentIds.length !== 1 && connectedEnvironments.length > 1;
578
579 return (
580 <SettingsSection
581 id="devices"
582 title={aggregate && selected ? `Devices · ${selected.label}` : "Devices"}
583 >
584 <DeviceIntegrationControls
585 key={selected?.environmentId ?? "none"}
586 environmentId={environmentId}
587 hosts={selected?.serverConfig?.settings.deviceHosts ?? []}
588 enabled={selected?.serverConfig?.settings.enableDeviceSupport ?? false}
589 agentAccessEnabled={selected?.serverConfig?.settings.enableAgentDeviceAccess ?? false}
590 />
591 </SettingsSection>
592 );
593}
594
595function DeviceIntegrationControls({
596 environmentId,
597 hosts,
598 enabled,
599 agentAccessEnabled,
600}: {
601 environmentId: EnvironmentId | null;
602 hosts: ReadonlyArray<SshDeviceHostConfig>;
603 enabled: boolean;
604 agentAccessEnabled: boolean;
605}) {
606 const { state, loaded } = useDeviceState(environmentId);
607 const configure = useAtomCommand(deviceEnvironment.configure);
608 const list = useAtomCommand(deviceEnvironment.list, { reportFailure: false });
609 const [pending, setPending] = useState<"hub" | "check" | "agent" | null>(null);
610 const busy = state.hostStatus === "installing" || state.hostStatus === "starting";
611 const [platformsRevealed, setPlatformsRevealed] = useState(false);
612 // Keep diagnostics visible through subsequent agent setup and refresh phases.
613 if (platformsRevealed && !enabled) setPlatformsRevealed(false);
614 if (enabled && !platformsRevealed && state.hostStatus === "ready" && pending !== "hub") {
615 setPlatformsRevealed(true);
616 }
617
618 const update = async (
619 kind: NonNullable<typeof pending>,
620 input: { enabled?: boolean; agentAccessEnabled?: boolean },
621 ) => {
622 if (!environmentId) return;
623 setPending(kind);
624 try {
625 const result = await configure({ environmentId, input });
626 if (result._tag === "Success" && input.enabled === true && !state.onboardingCompleted) {
627 await configure({ environmentId, input: { onboardingCompleted: true } });
628 }
629 } finally {
630 setPending(null);
631 }
632 };
633
634 return (
635 <>
636 <SettingsRow
637 {...searchableSetting("device-hub")}
638 description={deviceHubDescription}
639 control={
640 <>
641 {pending === "hub" ? <DeviceHubSetupStatus state={state} pending compact /> : null}
642 <Switch
643 checked={enabled}
644 disabled={!loaded || !environmentId || busy || pending !== null}
645 aria-label="Device hub"
646 onCheckedChange={(checked) =>
647 void update("hub", {
648 enabled: Boolean(checked),
649 ...(checked ? {} : { agentAccessEnabled: false }),
650 })
651 }
652 />
653 </>
654 }
655 />
656 <AnimatedHeight>
657 {platformsRevealed ? (
658 <SettingsRow
659 {...searchableSetting("device-platform-support")}
660 status={
661 <div className="flex flex-wrap gap-x-5 gap-y-2">
662 <PlatformStatus compact platform="iOS" status={platformSetupStatus(state, "ios")} />
663 <PlatformStatus
664 compact
665 platform="Android"
666 status={platformSetupStatus(state, "android")}
667 />
668 </div>
669 }
670 control={
671 <Button
672 size="sm"
673 variant="outline"
674 disabled={!environmentId || !enabled || busy || pending !== null}
675 onClick={() => {
676 if (!environmentId) return;
677 setPending("check");
678 void list({ environmentId, input: {} }).finally(() => setPending(null));
679 }}
680 >
681 {pending === "check" ? "Checking…" : "Refresh"}
682 </Button>
683 }
684 />
685 ) : null}
686 </AnimatedHeight>
687 <SettingsRow
688 {...searchableSetting("agent-device-access")}
689 description={agentDeviceDescription}
690 control={
691 <>
692 {pending === "agent" ? <AgentDeviceSetupStatus state={state} pending compact /> : null}
693 <Switch
694 checked={agentAccessEnabled}
695 disabled={!loaded || !environmentId || !enabled || busy || pending !== null}
696 aria-label="Agent device access"
697 onCheckedChange={(checked) =>
698 void update("agent", { agentAccessEnabled: Boolean(checked) })
699 }
700 />
701 </>
702 }
703 />
704 {state.hostStatus === "failed" && state.hostStatusDetail ? (
705 <p role="alert" className="px-4 py-3 text-xs text-destructive">
706 {state.hostStatusDetail}
707 </p>
708 ) : null}
709 <DeviceHostsSettings environmentId={environmentId} hosts={hosts} />
710 </>
711 );
712}
713
714function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled: boolean }) {
715 const autoShow = useClientSettings((settings) => settings.browserAutoShowFloatingPreview);
716 const updateSettings = useUpdatePrimarySettings();
717
718 return (
719 <SettingsRow
720 {...searchableSetting("browser-auto-show-floating-preview")}
721 description="Show the floating preview when an agent opens a browser or device unless the agent says otherwise."
722 resetAction={
723 !disabled && autoShow !== DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW ? (
724 <SettingResetButton
725 label="auto-show floating preview"
726 onClick={() =>
727 updateSettings({
728 browserAutoShowFloatingPreview: DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW,
729 })
730 }
731 />
732 ) : null
733 }
734 control={
735 <Switch
736 disabled={disabled}
737 checked={autoShow}
738 onCheckedChange={(checked) =>
739 updateSettings({ browserAutoShowFloatingPreview: Boolean(checked) })
740 }
741 aria-label="Auto-show floating preview"
742 />
743 }
744 />
745 );
746}
747
748/**
749 * Profile list, its header menu, and the import flow.
750 *
751 * One menu creates profiles and imports into them, because the two are the
752 * same decision from the user's side: "I want a profile that has my Helium
753 * logins in it". Import targets include "New profile" so that case does not
754 * require creating one first and then finding a second control.
755 *
756 * Built-ins render without a rename field: they are synthesized rather than
757 * stored, so there is nothing to rename and removing them would strand every
758 * tab that opened under them.
759 *
760 * Sources are listed lazily on open: detection touches the other browser's
761 * files, and the answer changes while the app is running (quitting the browser
762 * clears `browserRunning`), so a value cached at mount would go stale.
763 */
764function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) {
765 const userProfiles = useClientSettings((settings) => settings.browserProfiles);
766 const defaultProfileId = useClientSettings((settings) => settings.browserDefaultProfileId);
767 const settingsHydrated = useClientSettingsHydrated();
768 const updateSettings = useUpdatePrimarySettings();
769 const { environments, isReady: environmentsReady } = useEnvironments();
770 const primaryEnvironment = usePrimaryEnvironment();
771 const [sources, setSources] = useState<ReadonlyArray<BrowserImportSource> | null>(null);
772 const [importSession, setImportSession] = useState<{
773 readonly source: BrowserImportSource;
774 readonly environmentId: EnvironmentId;
775 readonly environmentName: string;
776 } | null>(null);
777 const [profilePendingRemoval, setProfilePendingRemoval] = useState<BrowserProfile | null>(null);
778 const [profileRemovalError, setProfileRemovalError] = useState<string | null>(null);
779 const [profileRemovalInFlight, setProfileRemovalInFlight] = useState(false);
780 const removalAvailable = browserProfileRemovalAvailable(
781 previewBridge !== null,
782 environmentsReady,
783 environments.length,
784 );
785 const importInFlightRef = useRef(false);
786 const [importInFlight, setImportInFlight] = useState(false);
787 const profileWritesDisabled = disabled || !settingsHydrated;
788
789 const profiles = resolveBrowserProfiles(userProfiles);
790 // Incognito is deliberately not a row — it holds nothing to manage — so the
791 // default has to resolve against the list that renders. A stored
792 // `browserDefaultProfileId` of "incognito" would otherwise leave the section
793 // with no Default badge at all.
794 const listedProfiles = profiles.filter((profile) => profile.kind !== "incognito");
795 const resolvedDefaultId =
796 findBrowserProfile(listedProfiles, defaultProfileId)?.id ?? DEFAULT_BROWSER_PROFILE_ID;
797
798 const createProfile = (baseName: string) => {
799 if (!settingsHydrated || importInFlightRef.current) return undefined;
800 const currentProfiles = getClientSettings().browserProfiles;
801 // Checked against the live settings, not the rendered list: two clicks
802 // before a re-render would otherwise both pass the disabled control.
803 if (currentProfiles.length >= BROWSER_PROFILE_MAX_COUNT) return undefined;
804 const resolvedProfiles = resolveBrowserProfiles(currentProfiles);
805 const taken = new Set(resolvedProfiles.map((profile) => profile.name));
806 let name = baseName;
807 for (let index = 2; taken.has(name); index += 1) name = `${baseName} ${index}`;
808 const profile = { id: `profile-${randomUUID()}`, name, kind: "persistent" as const };
809 updateSettings({ browserProfiles: [...currentProfiles, profile] });
810 return profile;
811 };
812
813 const renameProfile = (id: string, next: string) => {
814 if (!settingsHydrated || importInFlightRef.current) return;
815 const name = next.trim().slice(0, BROWSER_PROFILE_NAME_MAX_LENGTH);
816 if (name === "") return;
817 const currentProfiles = getClientSettings().browserProfiles;
818 updateSettings({
819 browserProfiles: currentProfiles.map((profile) =>
820 profile.id === id ? { ...profile, name } : profile,
821 ),
822 });
823 };
824
825 const clearProfileData = (id: string, name: string) => {
826 if (!settingsHydrated || importInFlightRef.current) return;
827 if (!previewBridge || !environmentsReady || environments.length === 0) {
828 toastManager.add({
829 type: "error",
830 title: `Could not clear ${name}'s data`,
831 description: "You're not connected to a server yet.",
832 });
833 return;
834 }
835 void clearBrowserProfileData(
836 previewBridge,
837 environments.map((environment) => environment.environmentId),
838 id,
839 )
840 .then(() => {
841 toastManager.add({ type: "success", title: `Cleared ${name}'s cookies and cache` });
842 })
843 .catch(() => {
844 toastManager.add({ type: "error", title: `Could not clear ${name}'s data` });
845 });
846 };
847
848 const removeProfile = async (id: string) => {
849 if (!settingsHydrated || importInFlightRef.current) return;
850 if (!removalAvailable) {
851 setProfileRemovalError("Connect to an environment before removing this profile.");
852 return;
853 }
854 setProfileRemovalError(null);
855 setProfileRemovalInFlight(true);
856 // Drop the partition's data too, otherwise a removed profile's cookies
857 // stay on disk with nothing in the UI pointing at them.
858 try {
859 await clearBrowserProfileData(
860 previewBridge,
861 environmentsReady ? environments.map((environment) => environment.environmentId) : [],
862 id,
863 );
864 } catch {
865 setProfileRemovalError("Profile data could not be deleted. Try again.");
866 setProfileRemovalInFlight(false);
867 return;
868 }
869 const currentSettings = getClientSettings();
870 updateSettings({
871 browserProfiles: currentSettings.browserProfiles.filter((profile) => profile.id !== id),
872 // Reassign the default rather than leaving it pointing at nothing.
873 ...(currentSettings.browserDefaultProfileId === id
874 ? { browserDefaultProfileId: DEFAULT_BROWSER_PROFILE_ID }
875 : {}),
876 });
877 setProfileRemovalInFlight(false);
878 setProfilePendingRemoval(null);
879 };
880
881 // A browser that is not on this machine is left out rather than listed as a
882 // dead row: there is nothing to act on, and the menu is a list of things you
883 // can import from. An unsupported one is left out for the same reason — the
884 // blocked wizard step can't be fixed from here. Every other unavailable
885 // reason stays, since each names a step the user can take.
886 const importableSources = (sources ?? []).filter(
887 (source) =>
888 source.unavailable !== "notInstalled" && source.unavailable !== "unsupportedPlatform",
889 );
890
891 // Refreshed without blanking the last result: the menu shows the cached list
892 // straight away so it doesn't reflow on open, and the source list is stable
893 // (names only) since choosing what to import happens in the wizard, not here.
894 const loadSources = useCallback(() => {
895 if (!previewBridge) return;
896 void previewBridge
897 .listBrowserImportSources()
898 .then(setSources)
899 .catch(() => setSources((previous) => previous ?? []));
900 }, []);
901
902 // Runs one import for the wizard. A new profile is registered only once the
903 // import succeeds — the cookies land in its partition first — so a blocked
904 // attempt never leaves an empty profile behind.
905 const runWizardImport = async (
906 source: BrowserImportSource,
907 environmentId: EnvironmentId,
908 input: { readonly sourceProfileDirectory: string; readonly target: WizardTarget },
909 ): Promise<ImportOutcome> => {
910 if (!previewBridge) return { kind: "blocked", reason: "sessionUnavailable" };
911 if (!settingsHydrated) return { kind: "blocked", reason: "sessionUnavailable" };
912 if (
913 input.target.kind === "existing" &&
914 !resolveBrowserProfiles(getClientSettings().browserProfiles).some(
915 (profile) => profile.id === input.target.profileId,
916 )
917 ) {
918 return { kind: "blocked", reason: "readFailed" };
919 }
920 if (importInFlightRef.current) return { kind: "blocked", reason: "readFailed" };
921 importInFlightRef.current = true;
922 setImportInFlight(true);
923 try {
924 const result = await previewBridge.importBrowserCookies({
925 environmentId,
926 sourceId: source.id,
927 sourceProfileDirectory: input.sourceProfileDirectory,
928 targetProfileId: input.target.profileId,
929 });
930 if (
931 input.target.kind === "existing" &&
932 !resolveBrowserProfiles(getClientSettings().browserProfiles).some(
933 (profile) => profile.id === input.target.profileId,
934 )
935 ) {
936 return { kind: "blocked", reason: "readFailed" };
937 }
938 let targetName: string;
939 if (input.target.kind === "new") {
940 // Registered only when something actually came over: an import that
941 // found no cookies should not leave a new, empty profile behind.
942 if (result.imported > 0) {
943 try {
944 const persisted = await persistClientSettingsUpdate((current) => {
945 const existing = current.browserProfiles.find(
946 (profile) => profile.id === input.target.profileId,
947 );
948 if (existing) return current;
949 // The wizard refuses a new target at the cap, but the cap can be
950 // reached while the import runs; the updater sees the newest
951 // settings, so this is the check that holds.
952 if (current.browserProfiles.length >= BROWSER_PROFILE_MAX_COUNT) {
953 throw new ProfileLimitReachedError();
954 }
955 const taken = new Set(
956 resolveBrowserProfiles(current.browserProfiles).map((profile) => profile.name),
957 );
958 let name = source.name;
959 for (let index = 2; taken.has(name); index += 1) name = `${source.name} ${index}`;
960 return {
961 ...current,
962 browserProfiles: [
963 ...current.browserProfiles,
964 { id: input.target.profileId, name, kind: "persistent" as const },
965 ],
966 };
967 });
968 targetName =
969 persisted.browserProfiles.find((profile) => profile.id === input.target.profileId)
970 ?.name ?? source.name;
971 } catch (cause) {
972 // This target id belongs only to the attempted new profile. Clear
973 // its partition so a failed registration cannot strand imported
974 // cookies behind a profile that disappears on restart.
975 await clearBrowserProfileData(
976 previewBridge,
977 [environmentId],
978 input.target.profileId,
979 ).catch(() => undefined);
980 // Not a read failure: the cookies came over and were cleared again
981 // because the profile could not be kept. Name that, in the same
982 // token form `importFailureReason` recovers from a bridge error.
983 const reason =
984 cause instanceof ProfileLimitReachedError ? "profileLimitReached" : "profileNotSaved";
985 throw new Error(`Importing cookies from ${source.id} failed: ${reason}.`, { cause });
986 }
987 } else {
988 targetName = source.name;
989 }
990 } else {
991 targetName = input.target.name;
992 }
993 return {
994 kind: "imported",
995 imported: result.imported,
996 skipped: result.skipped,
997 skippedDomains: result.skippedDomains,
998 targetName,
999 };
1000 } catch (cause) {
1001 return { kind: "blocked", reason: importFailureReason(cause) };
1002 } finally {
1003 importInFlightRef.current = false;
1004 setImportInFlight(false);
1005 }
1006 };
1007
1008 // Re-checks a source's availability after the user quits the browser, and
1009 // keeps the cached list in step so the menu reflects it too.
1010 const refreshImportSource = async (
1011 sourceId: BrowserImportSource["id"],
1012 ): Promise<BrowserImportSource | undefined> => {
1013 if (!previewBridge) return undefined;
1014 try {
1015 const latest = await previewBridge.listBrowserImportSources();
1016 setSources(latest);
1017 return latest.find((source) => source.id === sourceId);
1018 } catch {
1019 return undefined;
1020 }
1021 };
1022
1023 const atProfileLimit = userProfiles.length >= BROWSER_PROFILE_MAX_COUNT;
1024
1025 return (
1026 <SettingsRow
1027 {...searchableSetting("browser-profiles")}
1028 description="Profiles separate cookies and logins. Incognito data is cleared when the app closes."
1029 control={
1030 <Menu onOpenChange={(open) => open && loadSources()}>
1031 <MenuTrigger
1032 render={
1033 <Button
1034 size="sm"
1035 variant="outline"
1036 disabled={profileWritesDisabled || importInFlight}
1037 />
1038 }
1039 >
1040 <PlusIcon />
1041 Add profile
1042 </MenuTrigger>
1043 <MenuPopup align="end" className="min-w-56">
1044 <MenuItem
1045 disabled={!settingsHydrated || atProfileLimit}
1046 onClick={() => createProfile("New profile")}
1047 >
1048 Blank profile
1049 </MenuItem>
1050 {atProfileLimit ? (
1051 <MenuItem disabled>You’ve reached the profile limit</MenuItem>
1052 ) : null}
1053 <MenuSeparator />
1054 <MenuGroup>
1055 <MenuGroupLabel>Import from</MenuGroupLabel>
1056 {sources === null ? (
1057 <MenuItem disabled>Looking for browsers…</MenuItem>
1058 ) : importableSources.length === 0 ? (
1059 <MenuItem disabled>No supported browsers found</MenuItem>
1060 ) : (
1061 // Every source is a plain row — running, needs-permission and
1062 // ready all look the same here. The wizard picks up whatever
1063 // state the source is in and walks the user forward from there.
1064 <>
1065 {importableSources.map((source) => (
1066 <MenuItem
1067 key={source.id}
1068 disabled={!settingsHydrated || primaryEnvironment == null}
1069 onClick={() => {
1070 if (!settingsHydrated || primaryEnvironment == null) return;
1071 setImportSession({
1072 source,
1073 environmentId: primaryEnvironment.environmentId,
1074 environmentName: resolveEnvironmentOptionLabel({
1075 isPrimary: true,
1076 environmentId: primaryEnvironment.environmentId,
1077 runtimeLabel: primaryEnvironment.label,
1078 }),
1079 });
1080 }}
1081 >
1082 {source.name}
1083 </MenuItem>
1084 ))}
1085 {primaryEnvironment == null ? (
1086 <MenuItem disabled>Connect to an environment to import cookies</MenuItem>
1087 ) : null}
1088 </>
1089 )}
1090 </MenuGroup>
1091 </MenuPopup>
1092 </Menu>
1093 }
1094 >
1095 {/*
1096 The bordered container groups rows unambiguously at any width, and
1097 carries the bottom spacing `SettingsRow` leaves to its children
1098 (`pt-3 pb-1`).
1099 */}
1100 <div className="mt-2 mb-2 overflow-hidden rounded-lg border border-border/60">
1101 {listedProfiles.map((profile, index) => {
1102 const builtIn = isBuiltInBrowserProfileId(profile.id);
1103 const isDefault = profile.id === resolvedDefaultId;
1104 return (
1105 <div
1106 key={profile.id}
1107 className={cn(
1108 "flex items-center gap-3 px-3 py-2",
1109 index > 0 && "border-t border-border/60",
1110 )}
1111 >
1112 <span className="flex min-w-0 flex-1 items-center gap-2">
1113 {builtIn ? (
1114 // Dimmed here rather than on the table: a wrapper-level dim
1115 // stacks with the rename field's and the row menu button's
1116 // own, landing them near 0.41 while every other disabled
1117 // control in the block sits at 0.64.
1118 <span
1119 className={cn(
1120 "truncate text-sm text-foreground",
1121 profileWritesDisabled && "opacity-64",
1122 )}
1123 >
1124 {profile.name}
1125 </span>
1126 ) : (
1127 <DraftInput
1128 nativeInput
1129 size="sm"
1130 className="w-full max-w-56"
1131 aria-label={`Rename ${profile.name}`}
1132 disabled={profileWritesDisabled || importInFlight}
1133 maxLength={BROWSER_PROFILE_NAME_MAX_LENGTH}
1134 value={profile.name}
1135 onCommit={(next) => renameProfile(profile.id, next)}
1136 />
1137 )}
1138 {/*
1139 Dimmed with the rest of the row: a `Badge` has no disabled
1140 treatment of its own, so a solid `bg-primary` pill would
1141 otherwise sit at full strength beside a name, rename field
1142 and menu button that are all at 0.64.
1143 */}
1144 {isDefault ? (
1145 <Badge className={cn(profileWritesDisabled && "opacity-64")}>Default</Badge>
1146 ) : null}
1147 </span>
1148 <Menu>
1149 <MenuTrigger
1150 render={
1151 <Button
1152 size="icon-xs"
1153 variant="ghost-muted"
1154 disabled={profileWritesDisabled || importInFlight}
1155 aria-label={`${profile.name} options`}
1156 />
1157 }
1158 >
1159 <MoreVertical />
1160 </MenuTrigger>
1161 <MenuPopup align="end" className="min-w-44">
1162 <MenuItem
1163 disabled={!settingsHydrated || isDefault}
1164 onClick={() => {
1165 if (settingsHydrated) {
1166 updateSettings({ browserDefaultProfileId: profile.id });
1167 }
1168 }}
1169 >
1170 Set as default
1171 </MenuItem>
1172 <MenuItem
1173 disabled={!settingsHydrated || !removalAvailable}
1174 onClick={() => clearProfileData(profile.id, profile.name)}
1175 >
1176 Clear cookies and cache
1177 </MenuItem>
1178 {builtIn ? null : (
1179 <MenuItem
1180 variant="destructive"
1181 disabled={!settingsHydrated || !removalAvailable}
1182 onClick={() => {
1183 if (settingsHydrated) setProfilePendingRemoval(profile);
1184 }}
1185 >
1186 Remove profile and data
1187 </MenuItem>
1188 )}
1189 {!removalAvailable ? (
1190 <>
1191 <MenuSeparator />
1192 <MenuItem disabled>
1193 {environmentsReady
1194 ? "Connect to an environment to clear profile data"
1195 : "Checking environments…"}
1196 </MenuItem>
1197 </>
1198 ) : null}
1199 </MenuPopup>
1200 </Menu>
1201 </div>
1202 );
1203 })}
1204 </div>
1205 <AlertDialog
1206 open={profilePendingRemoval !== null}
1207 onOpenChange={(open) => {
1208 if (!open && !profileRemovalInFlight) {
1209 setProfilePendingRemoval(null);
1210 setProfileRemovalError(null);
1211 }
1212 }}
1213 >
1214 <AlertDialogPopup>
1215 <AlertDialogHeader>
1216 <AlertDialogTitle>Remove “{profilePendingRemoval?.name}”?</AlertDialogTitle>
1217 <AlertDialogDescription>
1218 Its cookies and logins are deleted. Tabs already open in this profile stay open until
1219 you close them.
1220 </AlertDialogDescription>
1221 {profileRemovalError ? (
1222 <p aria-live="polite" className="text-sm text-destructive">
1223 {profileRemovalError}
1224 </p>
1225 ) : null}
1226 {!removalAvailable ? (
1227 <p className="text-sm text-muted-foreground">
1228 Connect to an environment to remove this profile and its data.
1229 </p>
1230 ) : null}
1231 </AlertDialogHeader>
1232 <AlertDialogFooter>
1233 <AlertDialogClose
1234 disabled={profileRemovalInFlight}
1235 render={<Button variant="outline" disabled={profileRemovalInFlight} />}
1236 >
1237 Cancel
1238 </AlertDialogClose>
1239 <Button
1240 variant="destructive"
1241 disabled={profileRemovalInFlight || !settingsHydrated || !removalAvailable}
1242 onClick={() => {
1243 if (profilePendingRemoval && settingsHydrated && removalAvailable) {
1244 void removeProfile(profilePendingRemoval.id);
1245 }
1246 }}
1247 >
1248 {profileRemovalInFlight ? "Removing…" : "Remove profile"}
1249 </Button>
1250 </AlertDialogFooter>
1251 </AlertDialogPopup>
1252 </AlertDialog>
1253 {importSession ? (
1254 <BrowserImportWizard
1255 source={importSession.source}
1256 destinationEnvironmentName={importSession.environmentName}
1257 targetProfiles={listedProfiles.map((profile) => ({ id: profile.id, name: profile.name }))}
1258 canCreateProfile={settingsHydrated && !atProfileLimit}
1259 onImport={(input) =>
1260 runWizardImport(importSession.source, importSession.environmentId, input)
1261 }
1262 onRefreshSource={() => refreshImportSource(importSession.source.id)}
1263 onCheckFullDiskAccess={
1264 window.desktopBridge?.checkSystemPermission
1265 ? () => window.desktopBridge!.checkSystemPermission!("full-disk-access")
1266 : undefined
1267 }
1268 onOpenFullDiskAccessSettings={async () => {
1269 // Rejects outside the desktop shell (and on shells that predate the
1270 // method), so the one toast covers every way the link can fail.
1271 await readLocalApi()
1272 ?.shell.openSystemSettings("full-disk-access")
1273 .catch(() => {
1274 toastManager.add({
1275 type: "error",
1276 title: "Could not open System Settings",
1277 description: "Open Privacy & Security → Full Disk Access manually.",
1278 });
1279 });
1280 }}
1281 onClose={() => setImportSession(null)}
1282 />
1283 ) : null}
1284 </SettingsRow>
1285 );
1286}
1287
1288export function IntegrationsSettingsPanel() {
1289 // Client-local preview defaults are editable only where the preview exists.
1290 const previewDefaultsDisabled = !isElectron;
1291 const previewDefaults = (
1292 <>
1293 <BrowserProfilesSetting disabled={previewDefaultsDisabled} />
1294 <BrowserViewportSetting disabled={previewDefaultsDisabled} />
1295 <BrowserZoomSetting disabled={previewDefaultsDisabled} />
1296 <BrowserAppearanceSetting disabled={previewDefaultsDisabled} />
1297 <BrowserRecordingFrameRateSetting disabled={previewDefaultsDisabled} />
1298 <BrowserLinkTargetSetting disabled={previewDefaultsDisabled} />
1299 <BrowserAutoShowFloatingPreviewSetting disabled={previewDefaultsDisabled} />
1300 </>
1301 );
1302
1303 return (
1304 <SettingsPageContainer>
1305 {/* Server-authoritative agent access is scoped by the header selection;
1306 the preview defaults below are device-local and ignore it. */}
1307 <ProjectDefaultsSettings category="integrations" />
1308 <SettingsSection id="browser" title="Browser">
1309 {previewDefaultsDisabled ? (
1310 <SettingsUnavailableGroup message="Only available in the desktop app.">
1311 {previewDefaults}
1312 </SettingsUnavailableGroup>
1313 ) : (
1314 previewDefaults
1315 )}
1316 </SettingsSection>
1317 <DeviceIntegrationSettings />
1318 </SettingsPageContainer>
1319 );
1320}