Simplify Connect onboarding to sign-in only

- Remove device publishing flow from onboarding
- Add per-account "Don't show this again" opt-out
- Update mobile and web copy to T3 Connect
This commit is contained in:
Julius Marminge committed 2026-07-07 11:07:31 -07:00
1 parent 53ab016efd
commit 4f648f1e11
20 files changed
+300 -682

No files matched your search

+2 -2
View File
@@ -18,7 +18,7 @@ import { ArchivedThreadsRouteScreen } from "./features/archive/ArchivedThreadsRo
import { useAgentNotificationNavigation } from "./features/agent-awareness/notificationNavigation";
import { ClerkSettingsSheetDetentProvider } from "./features/cloud/ClerkSettingsSheetDetent";
import { ConnectOnboardingRouteScreen } from "./features/cloud/ConnectOnboardingRouteScreen";
import { useConnectOnboardingNavigation } from "./features/cloud/connectOnboarding";
import { useConnectOnboardingNavigation } from "./features/cloud/connectOnboardingNavigation";
import { ThreadFilesTreeScreen, ThreadFileScreen } from "./features/files/ThreadFilesRouteScreen";
import { AdaptiveWorkspaceLayout } from "./features/layout/AdaptiveWorkspaceLayout";
import { HardwareKeyboardCommandProvider } from "./features/keyboard/HardwareKeyboardCommandProvider";
@@ -423,7 +423,7 @@ export const RootStack = createNativeStackNavigator({
options: {
gestureEnabled: true,
presentation: "formSheet",
sheetAllowedDetents: [0.75, 0.95],
sheetAllowedDetents: [0.6, 0.95],
sheetGrabberVisible: true,
},
}),
+2 -2
View File
@@ -92,7 +92,7 @@ const capabilitiesLayer = Layer.succeedContext(
if (session === null) {
return yield* new ConnectionBlockedError({
reason: "authentication",
detail: "Sign in to T3 Cloud to connect this environment.",
detail: "Sign in to T3 Connect to connect this environment.",
});
}
const token = yield* session.readClerkToken().pipe(
@@ -107,7 +107,7 @@ const capabilitiesLayer = Layer.succeedContext(
if (token === null) {
return yield* new ConnectionBlockedError({
reason: "authentication",
detail: "The T3 Cloud session is unavailable.",
detail: "The T3 Connect session is unavailable.",
});
}
return token;
@@ -18,7 +18,7 @@ import {
setAgentAwarenessRelayTokenProvider,
unregisterAgentAwarenessDeviceForCurrentUser,
} from "../agent-awareness/remoteRegistration";
import { requestConnectOnboardingIfNeeded } from "./connectOnboarding";
import { requestConnectOnboarding } from "./connectOnboarding";
import { resolveCloudPublicConfig, resolveRelayClerkTokenOptions } from "./publicConfig";
function resetManagedRelayTokenCache() {
@@ -68,14 +68,12 @@ function CloudAuthBridge(props: { readonly children: ReactNode }) {
const nextAccount = isSignedIn && userId ? userId : null;
observedAccountRef.current = nextAccount;
// A sign-in that completed during this session (a cold start observes
// Every sign-in that completes during this session (a cold start observes
// undefined → account and must not re-prompt) requests the T3 Connect
// onboarding sheet once per account.
// onboarding sheet — sign-out clears the connected environments, so each
// new session starts with no devices to reach.
if (previousObservedAccount === null && nextAccount !== null) {
void (async () => {
const result = await settlePromise(() => requestConnectOnboardingIfNeeded(nextAccount));
reportAtomCommandResult(result, { label: "connect onboarding request" });
})();
requestConnectOnboarding(nextAccount);
}
const queueAccountCleanup = (
@@ -39,7 +39,7 @@ export function CloudWaitlistEnrollment(props: { readonly onSignIn: () => void }
You are on the waitlist
</Text>
<Text className="text-center font-sans text-base text-foreground-secondary">
We will email you when your T3 Cloud access is ready.
We will email you when your T3 Connect access is ready.
</Text>
<SignInAction onPress={props.onSignIn} />
</View>
@@ -1,67 +1,23 @@
import { useAuth } from "@clerk/expo";
import { useNavigation } from "@react-navigation/native";
import * as Effect from "effect/Effect";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
import { useCallback } from "react";
import { Pressable, ScrollView, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import {
isAtomCommandInterrupted,
reportAtomCommandResult,
settleAsyncResult,
settlePromise,
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
import { reportAtomCommandResult, settlePromise } from "@t3tools/client-runtime/state/runtime";
import { AppText as Text } from "../../components/AppText";
import type { SavedRemoteConnection } from "../../lib/connection";
import { cn } from "../../lib/cn";
import { runtime } from "../../lib/runtime";
import { useThemeColor } from "../../lib/useThemeColor";
import {
useRemoteConnections,
useSavedRemoteConnections,
} from "../../state/use-remote-environment-registry";
import { useRemoteConnections } from "../../state/use-remote-environment-registry";
import { CloudEnvironmentRows } from "../connection/CloudEnvironmentRows";
import { splitEnvironmentSections } from "../connection/environmentSections";
import { SettingsSection } from "../settings/components/SettingsSection";
import { SettingsSwitchRow } from "../settings/components/SettingsSwitchRow";
import { markConnectOnboardingCompleted } from "./connectOnboarding";
import {
getEnvironmentConnectPublishState,
linkEnvironmentToCloud,
setEnvironmentPublishAgentActivity,
} from "./linkEnvironment";
import { refreshManagedRelayEnvironments } from "./managedRelayState";
import { hasCloudPublicConfig, resolveRelayClerkTokenOptions } from "./publicConfig";
type PublishTargetPhase = "checking" | "ready" | "published" | "unauthorized" | "error";
interface PublishTarget {
readonly connection: SavedRemoteConnection;
readonly phase: PublishTargetPhase;
readonly linked: boolean;
readonly managedTunnelActive: boolean;
readonly publishAgentActivity: boolean;
readonly error: string | null;
}
function pendingPublishTarget(connection: SavedRemoteConnection): PublishTarget {
return {
connection,
phase: "checking",
linked: false,
managedTunnelActive: false,
publishAgentActivity: false,
error: null,
};
}
import { optOutOfConnectOnboarding } from "./connectOnboardingOptOut";
import { hasCloudPublicConfig } from "./publicConfig";
/**
* Post-sign-in onboarding sheet for T3 Connect. Offers to publish this
* device's locally paired environments (managed tunnel + agent activity, both
* defaulting on) when the paired session is authorized, then lists the
* account's T3 Connect environments so every device can be connected right
* away. Dismissing the sheet counts as completion — it never nags twice.
* Post-sign-in onboarding sheet for T3 Connect. Mobile never publishes
* environments itself — it consumes ones published elsewhere — so this simply
* surfaces the account's T3 Connect environments right after sign-in so every
* device can be connected in one go. It shows on every sign-in: sign-out
* clears the connected environments, so each new session starts from zero.
*/
export function ConnectOnboardingRouteScreen() {
return hasCloudPublicConfig() ? <ConfiguredConnectOnboardingRouteScreen /> : null;
@@ -70,195 +26,26 @@ export function ConnectOnboardingRouteScreen() {
function ConfiguredConnectOnboardingRouteScreen() {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const { getToken, isSignedIn, userId } = useAuth({ treatPendingAsSignedOut: false });
const { isLoadingSavedConnection, savedConnectionsById } = useSavedRemoteConnections();
const { isSignedIn, userId } = useAuth({ treatPendingAsSignedOut: false });
const { connectedEnvironments, onReconnectEnvironment } = useRemoteConnections();
const { connectedCloudEnvironments } = splitEnvironmentSections({
connectedEnvironments,
cloudEnvironments: null,
});
// Dismissing the sheet (swipe, Skip, or Done) counts as completion.
const completionPersistedRef = useRef(false);
const persistCompletion = useCallback(() => {
if (completionPersistedRef.current || !userId) {
return;
}
completionPersistedRef.current = true;
void (async () => {
const result = await settlePromise(() => markConnectOnboardingCompleted(userId));
reportAtomCommandResult(result, { label: "connect onboarding completion" });
})();
}, [userId]);
useEffect(
() => navigation.addListener("beforeRemove", persistCompletion),
[navigation, persistCompletion],
);
const handleDone = useCallback(() => {
persistCompletion();
navigation.goBack();
}, [navigation, persistCompletion]);
}, [navigation]);
const bearerConnections = useMemo(
() =>
Object.values(savedConnectionsById).filter((connection) => connection.bearerToken !== null),
[savedConnectionsById],
);
const [targets, setTargets] = useState<ReadonlyArray<PublishTarget> | null>(null);
const [publishEnvironment, setPublishEnvironment] = useState(true);
const [publishAgentActivity, setPublishAgentActivity] = useState(true);
const [isApplying, setIsApplying] = useState(false);
const loadPublishTargets = useCallback(
async (connections: ReadonlyArray<SavedRemoteConnection>) => {
if (connections.length === 0) {
setTargets([]);
return;
}
setTargets(connections.map(pendingPublishTarget));
const result = await settleAsyncResult(() =>
runtime.runPromiseExit(
Effect.forEach(
connections,
(connection) =>
getEnvironmentConnectPublishState({ connection }).pipe(
Effect.match({
onFailure: (error): PublishTarget => ({
...pendingPublishTarget(connection),
phase: "error",
error: error.message,
}),
onSuccess: (state): PublishTarget => ({
connection,
phase:
state.canPublish === false
? "unauthorized"
: state.linked && state.managedTunnelActive && state.publishAgentActivity
? "published"
: "ready",
linked: state.linked,
managedTunnelActive: state.managedTunnelActive,
publishAgentActivity: state.publishAgentActivity,
error: null,
}),
}),
),
{ concurrency: "unbounded" },
),
),
);
if (result._tag === "Failure") {
if (isAtomCommandInterrupted(result)) {
return;
}
const error = squashAtomCommandFailure(result);
const message =
error instanceof Error ? error.message : "Could not check the environment link state.";
setTargets(
connections.map((connection) => ({
...pendingPublishTarget(connection),
phase: "error" as const,
error: message,
})),
);
return;
}
setTargets(result.value);
},
[],
);
// Check authorization + link state once the locally saved connections are
// ready. Loaded once per mount: reconnect churn in the registry must not
// flip the section back to "checking" mid-interaction.
const loadedRef = useRef(false);
useEffect(() => {
if (isLoadingSavedConnection || loadedRef.current) {
return;
const handleDontShowAgain = useCallback(() => {
if (userId) {
void (async () => {
const result = await settlePromise(() => optOutOfConnectOnboarding(userId));
reportAtomCommandResult(result, { label: "connect onboarding opt-out" });
})();
}
loadedRef.current = true;
void loadPublishTargets(bearerConnections);
}, [bearerConnections, isLoadingSavedConnection, loadPublishTargets]);
const publishableTargets = useMemo(
() => (targets ?? []).filter((target) => target.phase === "ready"),
[targets],
);
const targetConnections = useMemo(
() => (targets ?? []).map((target) => target.connection),
[targets],
);
const handlePublish = useCallback(async () => {
const applicable = publishableTargets;
if (applicable.length === 0 || (!publishEnvironment && !publishAgentActivity)) {
return;
}
setIsApplying(true);
const tokenResult = await settlePromise(() => getToken(resolveRelayClerkTokenOptions()));
const clerkToken = tokenResult._tag === "Success" ? tokenResult.value : null;
if (clerkToken === null) {
setIsApplying(false);
const error = tokenResult._tag === "Failure" ? squashAtomCommandFailure(tokenResult) : null;
Alert.alert(
"Publishing unavailable",
error instanceof Error ? error.message : "Sign in to publish environments over T3 Connect.",
);
return;
}
const failures: Array<string> = [];
await Promise.all(
applicable.map(async (target) => {
// Onboarding only ever enables: it links when something is missing and
// never tears down an existing link or clears a preference.
const needsLink = publishEnvironment
? !target.linked || !target.managedTunnelActive
: !target.linked && publishAgentActivity;
const applyEffect = Effect.gen(function* () {
if (needsLink) {
yield* linkEnvironmentToCloud({
connection: target.connection,
clerkToken,
mode: publishEnvironment ? "managed" : "publish_only",
});
}
if (publishAgentActivity && !target.publishAgentActivity) {
yield* setEnvironmentPublishAgentActivity({
connection: target.connection,
publishAgentActivity: true,
});
}
});
const result = await settleAsyncResult(() => runtime.runPromiseExit(applyEffect));
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
const error = squashAtomCommandFailure(result);
failures.push(
`${target.connection.environmentLabel}: ${
error instanceof Error ? error.message : "Publishing failed."
}`,
);
}
}),
);
refreshManagedRelayEnvironments();
await loadPublishTargets(targetConnections);
setIsApplying(false);
if (failures.length > 0) {
Alert.alert("Couldn't publish every environment", failures.join("\n\n"));
}
}, [
getToken,
loadPublishTargets,
publishAgentActivity,
publishEnvironment,
publishableTargets,
targetConnections,
]);
navigation.goBack();
}, [navigation, userId]);
return (
<View collapsable={false} className="flex-1 bg-sheet">
@@ -286,38 +73,15 @@ function ConfiguredConnectOnboardingRouteScreen() {
</Pressable>
</View>
<Text className="text-sm leading-normal text-foreground-muted">
{
"Mesh your devices together — publish this device's environments and connect the rest, all in one place."
}
Environments published from your other devices are ready to connect here.
</Text>
</View>
{isSignedIn ? (
<>
<PublishSection
targets={targets}
publishEnvironment={publishEnvironment}
publishAgentActivity={publishAgentActivity}
isApplying={isApplying}
onPublishEnvironmentChange={setPublishEnvironment}
onPublishAgentActivityChange={setPublishAgentActivity}
onPublish={() => void handlePublish()}
onRetry={() => void loadPublishTargets(targetConnections)}
/>
<View className="gap-2">
<Text className="px-2 text-sm font-t3-medium text-foreground-muted">
Connect your environments
</Text>
<Text className="px-2 text-sm leading-normal text-foreground-muted">
Environments published from your other devices are ready to connect here.
</Text>
<CloudEnvironmentRows
connectedCloudEnvironments={connectedCloudEnvironments}
onReconnectEnvironment={onReconnectEnvironment}
/>
</View>
</>
<CloudEnvironmentRows
connectedCloudEnvironments={connectedCloudEnvironments}
onReconnectEnvironment={onReconnectEnvironment}
/>
) : (
<View collapsable={false} className="rounded-[24px] bg-card p-5">
<Text className="text-sm leading-normal text-foreground-muted">
@@ -326,185 +90,26 @@ function ConfiguredConnectOnboardingRouteScreen() {
</View>
)}
<Pressable
accessibilityRole="button"
onPress={handleDone}
className="min-h-[48px] items-center justify-center rounded-[18px] bg-card active:opacity-70"
>
<Text className="text-base font-t3-bold text-foreground">Done</Text>
</Pressable>
<View className="gap-3">
<Pressable
accessibilityRole="button"
onPress={handleDone}
className="min-h-[48px] items-center justify-center rounded-[18px] bg-card active:opacity-70"
>
<Text className="text-base font-t3-bold text-foreground">Done</Text>
</Pressable>
{userId ? (
<Pressable
accessibilityRole="button"
hitSlop={8}
onPress={handleDontShowAgain}
className="items-center py-1 active:opacity-70"
>
<Text className="text-xs text-foreground-muted">{"Don't show this again"}</Text>
</Pressable>
) : null}
</View>
</ScrollView>
</View>
);
}
function PublishSection(props: {
readonly targets: ReadonlyArray<PublishTarget> | null;
readonly publishEnvironment: boolean;
readonly publishAgentActivity: boolean;
readonly isApplying: boolean;
readonly onPublishEnvironmentChange: (enabled: boolean) => void;
readonly onPublishAgentActivityChange: (enabled: boolean) => void;
readonly onPublish: () => void;
readonly onRetry: () => void;
}) {
const iconColor = useThemeColor("--color-icon");
const primaryForeground = useThemeColor("--color-primary-foreground");
const targets = props.targets;
const isChecking = targets === null || targets.some((target) => target.phase === "checking");
const publishableTargets = (targets ?? []).filter((target) => target.phase === "ready");
const publishedTargets = (targets ?? []).filter((target) => target.phase === "published");
const hasRetryableErrors = (targets ?? []).some((target) => target.phase === "error");
const canPublish =
publishableTargets.length > 0 &&
(props.publishEnvironment || props.publishAgentActivity) &&
!props.isApplying;
if (targets !== null && targets.length === 0) {
return (
<View className="gap-2">
<Text className="px-2 text-sm font-t3-medium text-foreground-muted">
Publish this device
</Text>
<View collapsable={false} className="rounded-[24px] bg-card p-5">
<Text className="text-sm leading-normal text-foreground-muted">
{
"No locally paired environments on this device yet. Pair an environment first and it can be published to your other devices from Settings."
}
</Text>
</View>
</View>
);
}
if (isChecking) {
return (
<View className="gap-2">
<Text className="px-2 text-sm font-t3-medium text-foreground-muted">
Publish this device
</Text>
<View collapsable={false} className="items-center gap-3 rounded-[24px] bg-card p-6">
<ActivityIndicator color={iconColor} />
<Text className="text-center text-sm leading-normal text-foreground-muted">
Checking which environments can publish.
</Text>
</View>
</View>
);
}
return (
<View className="gap-3">
<SettingsSection title="Publish this device">
{publishableTargets.length > 0 ? (
<>
<SettingsSwitchRow
icon="antenna.radiowaves.left.and.right"
label="Publish environment"
disabled={props.isApplying}
value={props.publishEnvironment}
onValueChange={props.onPublishEnvironmentChange}
/>
<SettingsSwitchRow
icon="bolt.circle"
label="Publish agent activity"
disabled={props.isApplying}
value={props.publishAgentActivity}
onValueChange={props.onPublishAgentActivityChange}
/>
</>
) : publishedTargets.length > 0 ? (
<View className="p-4">
<Text className="text-sm leading-normal text-foreground-muted">
{"This device's environments already publish over T3 Connect."}
</Text>
</View>
) : (
<View className="p-4">
<Text className="text-sm leading-normal text-foreground-muted">
{
"This device's paired sessions aren't authorized to publish. Pair again with an administrative link to enable publishing."
}
</Text>
</View>
)}
</SettingsSection>
{publishableTargets.length > 0 ? (
<Text className="px-2 text-sm leading-normal text-foreground-muted">
Make the environments paired with this device available to your other devices, and send
agent activity for notifications and Live Activities.
</Text>
) : null}
{targets.map((target) => (
<PublishTargetStatusRow key={target.connection.environmentId} target={target} />
))}
{publishableTargets.length > 0 ? (
<Pressable
accessibilityRole="button"
disabled={!canPublish}
onPress={props.onPublish}
className={cn(
"min-h-[48px] flex-row items-center justify-center gap-2 rounded-[18px] bg-primary px-5 active:opacity-70",
!canPublish && "opacity-50",
)}
>
{props.isApplying ? <ActivityIndicator color={primaryForeground} size="small" /> : null}
<Text className="text-base font-t3-bold text-primary-foreground">
{props.isApplying
? "Publishing..."
: `Publish ${publishableTargets.length === 1 ? "environment" : `${publishableTargets.length} environments`}`}
</Text>
</Pressable>
) : null}
{hasRetryableErrors ? (
<Pressable
accessibilityRole="button"
disabled={props.isApplying}
onPress={props.onRetry}
className="self-start rounded-full bg-subtle px-3.5 py-2 active:opacity-70 disabled:opacity-50"
>
<Text className="text-xs font-t3-bold text-foreground">Check again</Text>
</Pressable>
) : null}
</View>
);
}
function publishTargetStatusText(target: PublishTarget): string {
switch (target.phase) {
case "checking":
return "Checking...";
case "published":
return "Already publishing";
case "ready":
return target.linked ? "Partially published — ready to update" : "Ready to publish";
case "unauthorized":
return "This device's session is not authorized to publish";
case "error":
return target.error ?? "Could not check the environment";
}
}
function PublishTargetStatusRow(props: { readonly target: PublishTarget }) {
const isError = props.target.phase === "error";
return (
<View className="flex-row items-baseline gap-2 px-2">
<Text className="min-w-0 flex-shrink text-xs font-t3-bold text-foreground" numberOfLines={1}>
{props.target.connection.environmentLabel}
</Text>
<Text
className={cn(
"min-w-0 flex-1 text-xs",
isError ? "text-rose-500 dark:text-rose-400" : "text-foreground-muted",
)}
numberOfLines={3}
>
{publishTargetStatusText(props.target)}
</Text>
</View>
);
}
@@ -1,68 +1,24 @@
import { useAtomValue } from "@effect/atom-react";
import { useNavigation } from "@react-navigation/native";
import { Atom } from "effect/unstable/reactivity";
import { useEffect } from "react";
import { loadPreferences, savePreferencesPatch } from "../../lib/storage";
import { appAtomRegistry } from "../../state/atom-registry";
// Signals RootStackLayout (inside the navigation tree) that an in-session
// sign-in just completed for an account that has not seen the T3 Connect
// onboarding sheet yet. Holds the account id so a sign-out between the request
// and the navigation cannot present the sheet for the wrong account.
const connectOnboardingRequestAtom = Atom.make<string | null>(null).pipe(
// sign-in just completed. Holds the account id so a sign-out between the
// request and the navigation cannot present the sheet for the wrong account.
export const connectOnboardingRequestAtom = Atom.make<string | null>(null).pipe(
Atom.keepAlive,
Atom.withLabel("mobile:connect-onboarding-request"),
);
/**
* Requests the onboarding sheet for the given account unless it already
* completed (or skipped) onboarding on this device.
* Requests the onboarding sheet for the given account. Sign-out clears the
* connected environments, so onboarding runs on every in-session sign-in —
* each new session starts with no connected devices.
*/
export async function requestConnectOnboardingIfNeeded(accountId: string): Promise<void> {
const preferences = await loadPreferences();
if (preferences.connectOnboardingCompletedAccounts?.includes(accountId)) {
return;
}
export function requestConnectOnboarding(accountId: string): void {
appAtomRegistry.set(connectOnboardingRequestAtom, accountId);
}
export function clearConnectOnboardingRequest(): void {
appAtomRegistry.set(connectOnboardingRequestAtom, null);
}
/** Persists that the account saw the sheet, so it never nags twice. */
export async function markConnectOnboardingCompleted(accountId: string): Promise<void> {
const preferences = await loadPreferences();
const completed = preferences.connectOnboardingCompletedAccounts ?? [];
if (completed.includes(accountId)) {
return;
}
await savePreferencesPatch({ connectOnboardingCompletedAccounts: [...completed, accountId] });
}
// Sign-in happens inside the Settings sheet; give its detent/session-state
// transitions a beat to settle before presenting another formSheet on top.
const PRESENT_ONBOARDING_DELAY_MS = 600;
/**
* Consumes the onboarding request inside the navigation tree (RootStackLayout)
* and presents the onboarding formSheet.
*/
export function useConnectOnboardingNavigation(): void {
const navigation = useNavigation();
const requestedAccountId = useAtomValue(connectOnboardingRequestAtom);
useEffect(() => {
if (requestedAccountId === null) {
return;
}
const timer = setTimeout(() => {
clearConnectOnboardingRequest();
navigation.navigate("ConnectOnboarding");
}, PRESENT_ONBOARDING_DELAY_MS);
return () => {
clearTimeout(timer);
};
}, [navigation, requestedAccountId]);
}
@@ -0,0 +1,45 @@
import { useAtomValue } from "@effect/atom-react";
import { useNavigation } from "@react-navigation/native";
import { useEffect } from "react";
import { clearConnectOnboardingRequest, connectOnboardingRequestAtom } from "./connectOnboarding";
import { isConnectOnboardingOptedOut } from "./connectOnboardingOptOut";
// Sign-in happens inside the Settings sheet; give its detent/session-state
// transitions a beat to settle before presenting another formSheet on top.
const PRESENT_ONBOARDING_DELAY_MS = 600;
/**
* Consumes the onboarding request inside the navigation tree (RootStackLayout)
* and presents the onboarding formSheet. Lives apart from connectOnboarding.ts
* so non-navigation consumers (CloudAuthProvider) do not pull
* @react-navigation into their module graph.
*/
export function useConnectOnboardingNavigation(): void {
const navigation = useNavigation();
const requestedAccountId = useAtomValue(connectOnboardingRequestAtom);
useEffect(() => {
if (requestedAccountId === null) {
return;
}
let cancelled = false;
const timer = setTimeout(() => {
void (async () => {
// A failed preference read prefers showing the sheet.
const optedOut = await isConnectOnboardingOptedOut(requestedAccountId).catch(() => false);
if (cancelled) {
return;
}
clearConnectOnboardingRequest();
if (!optedOut) {
navigation.navigate("ConnectOnboarding");
}
})();
}, PRESENT_ONBOARDING_DELAY_MS);
return () => {
cancelled = true;
clearTimeout(timer);
};
}, [navigation, requestedAccountId]);
}
@@ -0,0 +1,21 @@
import { loadPreferences, savePreferencesPatch } from "../../lib/storage";
// Lives apart from connectOnboarding.ts so CloudAuthProvider (which imports
// the request signal) never pulls lib/storage — expo-secure-store — into its
// module graph; that breaks CloudAuthProvider.test.ts suite loading.
/** Whether the account chose "Don't show this again". */
export async function isConnectOnboardingOptedOut(accountId: string): Promise<boolean> {
const preferences = await loadPreferences();
return preferences.connectOnboardingOptOutAccounts?.includes(accountId) ?? false;
}
/** Persists "Don't show this again" for the account. */
export async function optOutOfConnectOnboarding(accountId: string): Promise<void> {
const preferences = await loadPreferences();
const optedOut = preferences.connectOnboardingOptOutAccounts ?? [];
if (optedOut.includes(accountId)) {
return;
}
await savePreferencesPatch({ connectOnboardingOptOutAccounts: [...optedOut, accountId] });
}
@@ -3,7 +3,6 @@ import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
import { HttpClient } from "effect/unstable/http";
import {
AuthRelayWriteScope,
EnvironmentCloudEndpointUnavailableError,
EnvironmentHttpBadRequestError,
EnvironmentHttpConflictError,
@@ -77,13 +76,6 @@ const isEnvironmentCloudApiError = Schema.is(
const MANAGED_ENDPOINT_PROVIDER_KIND =
"cloudflare_tunnel" satisfies RelayManagedEndpointProviderKind;
// "publish_only" links the environment to the relay for agent-activity
// publishing alone: no managed tunnel is provisioned (mirrors the web client's
// CloudLinkMode).
export type CloudLinkMode = "managed" | "publish_only";
const PUBLISH_ONLY_PROVIDER_KIND = "manual" satisfies RelayManagedEndpointProviderKind;
function cloudEnvironmentLinkError(message: string) {
return (cause: unknown) => {
const environmentError = findEnvironmentCloudApiError(cause);
@@ -267,7 +259,6 @@ function ensureConnectEndpointMatchesEnvironment(input: {
export function linkEnvironmentToCloud(input: {
readonly connection: SavedRemoteConnection;
readonly clerkToken: string;
readonly mode?: CloudLinkMode;
}): Effect.Effect<
void,
CloudEnvironmentLinkError,
@@ -280,10 +271,6 @@ export function linkEnvironmentToCloud(input: {
});
}
const localBearerToken = input.connection.bearerToken;
const managedTunnelsEnabled = (input.mode ?? "managed") === "managed";
const providerKind = managedTunnelsEnabled
? MANAGED_ENDPOINT_PROVIDER_KIND
: PUBLISH_ONLY_PROVIDER_KIND;
const relayUrl = yield* requireRelayUrl();
const relayClient = yield* ManagedRelay.ManagedRelayClient;
const deviceId = yield* Effect.tryPromise({
@@ -301,7 +288,7 @@ export function linkEnvironmentToCloud(input: {
payload: {
notificationsEnabled: true,
liveActivitiesEnabled,
managedTunnelsEnabled,
managedTunnelsEnabled: true,
},
})
.pipe(
@@ -319,7 +306,7 @@ export function linkEnvironmentToCloud(input: {
endpoint: {
httpBaseUrl: input.connection.httpBaseUrl,
wsBaseUrl: input.connection.wsBaseUrl,
providerKind,
providerKind: MANAGED_ENDPOINT_PROVIDER_KIND,
},
origin: endpointOrigin(input.connection.httpBaseUrl),
},
@@ -333,7 +320,7 @@ export function linkEnvironmentToCloud(input: {
proof,
notificationsEnabled: true,
liveActivitiesEnabled,
managedTunnelsEnabled,
managedTunnelsEnabled: true,
},
})
.pipe(
@@ -341,7 +328,7 @@ export function linkEnvironmentToCloud(input: {
);
yield* ensureLinkedEnvironmentMatches({
expectedEnvironmentId: input.connection.environmentId,
expectedProviderKind: providerKind,
expectedProviderKind: MANAGED_ENDPOINT_PROVIDER_KIND,
link,
});
@@ -363,91 +350,6 @@ export function linkEnvironmentToCloud(input: {
});
}
function requireBearerToken(
connection: SavedRemoteConnection,
): Effect.Effect<string, CloudEnvironmentLinkError> {
return connection.bearerToken
? Effect.succeed(connection.bearerToken)
: Effect.fail(
new CloudEnvironmentLinkError({
message: "Only a locally paired bearer connection can publish over T3 Connect.",
}),
);
}
export interface EnvironmentConnectPublishState {
/**
* Whether the connection's session holds relay:write. `null` when the
* environment did not report session scopes (older servers) — callers should
* attempt publishing and surface the server's denial.
*/
readonly canPublish: boolean | null;
readonly linked: boolean;
readonly managedTunnelActive: boolean;
readonly publishAgentActivity: boolean;
}
/**
* Reads the environment-side publish authorization (session scopes) and relay
* link state for a locally paired bearer connection.
*/
export function getEnvironmentConnectPublishState(input: {
readonly connection: SavedRemoteConnection;
}): Effect.Effect<
EnvironmentConnectPublishState,
CloudEnvironmentLinkError,
HttpClient.HttpClient
> {
return Effect.gen(function* () {
const localBearerToken = yield* requireBearerToken(input.connection);
const environmentClient = yield* makeEnvironmentHttpApiClient(input.connection.httpBaseUrl);
const headers = { authorization: `Bearer ${localBearerToken}` };
const session = yield* environmentClient.auth
.session({ headers })
.pipe(Effect.mapError(cloudEnvironmentLinkError("Could not read the environment session.")));
const linkState = yield* environmentClient.connect
.linkState({ headers })
.pipe(
Effect.mapError(cloudEnvironmentLinkError("Could not read the environment link state.")),
);
return {
canPublish: !session.authenticated
? false
: session.scopes === undefined
? null
: session.scopes.includes(AuthRelayWriteScope),
linked: linkState.linked,
managedTunnelActive: linkState.managedTunnelActive ?? linkState.linked,
publishAgentActivity: linkState.publishAgentActivity,
};
});
}
/**
* Sets the environment-server-side "publish agent activity" preference. The
* link flow does not touch this secret, so clients opting into activity
* publishing must call it explicitly.
*/
export function setEnvironmentPublishAgentActivity(input: {
readonly connection: SavedRemoteConnection;
readonly publishAgentActivity: boolean;
}): Effect.Effect<void, CloudEnvironmentLinkError, HttpClient.HttpClient> {
return Effect.gen(function* () {
const localBearerToken = yield* requireBearerToken(input.connection);
const environmentClient = yield* makeEnvironmentHttpApiClient(input.connection.httpBaseUrl);
yield* environmentClient.connect
.preferences({
headers: { authorization: `Bearer ${localBearerToken}` },
payload: { publishAgentActivity: input.publishAgentActivity },
})
.pipe(
Effect.mapError(
cloudEnvironmentLinkError("Could not update the environment publish preference."),
),
);
});
}
export function listCloudEnvironments(input: {
readonly clerkToken: string;
}): Effect.Effect<
@@ -25,7 +25,7 @@ import { ConnectionStatusDot } from "./ConnectionStatusDot";
import { type RelayEnvironmentView, useConnectionController } from "./useConnectionController";
/**
* "T3 Cloud" section: every environment published to the signed-in account,
* "T3 Connect" section: every environment published to the signed-in account,
* with connect switches, availability status, refresh, and loading/error
* states. Shared between the Settings environments screen and the T3 Connect
* onboarding sheet.
@@ -61,7 +61,7 @@ export function CloudEnvironmentRows(props: {
return (
<View collapsable={false} className="mt-5 gap-3">
<View className="flex-row items-center justify-between px-1">
<Text className="text-sm font-t3-bold uppercase text-foreground-muted">T3 Cloud</Text>
<Text className="text-sm font-t3-bold uppercase text-foreground-muted">T3 Connect</Text>
<Pressable
accessibilityRole="button"
disabled={controller.relayDiscovery.isRefreshing}
@@ -112,7 +112,7 @@ export function CloudEnvironmentRows(props: {
) : controller.relayDiscovery.error ? (
<View collapsable={false} className="gap-3 rounded-[24px] bg-card p-5">
<Text className="text-base font-t3-bold text-foreground">
Could not load T3 Cloud environments
Could not load T3 Connect environments
</Text>
<Text className="text-sm text-foreground-muted">{controller.relayDiscovery.error}</Text>
{controller.relayDiscovery.errorTraceId ? (
@@ -135,7 +135,7 @@ export function ConnectionEnvironmentRow(props: {
>
{props.environment.isRelayManaged ? (
<Text className="text-sm text-foreground-muted">
Managed by T3 Cloud. Tunnel details update automatically.
Managed by T3 Connect. Tunnel details update automatically.
</Text>
) : (
<>
@@ -35,7 +35,7 @@ function cloudEnvironment(environmentId: string): RelayClientEnvironmentRecord {
}
describe("mobile environment settings sections", () => {
it("keeps saved relay-managed connections under T3 Cloud", () => {
it("keeps saved relay-managed connections under T3 Connect", () => {
const local = connectedEnvironment({
environmentId: "environment-local",
isRelayManaged: false,
@@ -240,8 +240,8 @@ function ConfiguredSettingsRouteScreen() {
const promptSignIn = useCallback(() => {
Alert.alert(
"Request T3 Cloud access",
"Live Activity updates require approved T3 Cloud access so relay can deliver updates to this device.",
"Request T3 Connect access",
"Live Activity updates require approved T3 Connect access so relay can deliver updates to this device.",
[
{ text: "Cancel", style: "cancel" },
{
+7 -8
View File
@@ -69,8 +69,8 @@ export interface Preferences {
/** Code/diff font size override; null/absent means derived from baseFontSize. */
readonly codeFontSize?: number | null;
readonly codeWordBreak?: boolean;
/** Cloud account ids that already saw the T3 Connect onboarding sheet. */
readonly connectOnboardingCompletedAccounts?: ReadonlyArray<string>;
/** Cloud account ids that opted out of the T3 Connect onboarding sheet. */
readonly connectOnboardingOptOutAccounts?: ReadonlyArray<string>;
}
async function readStorageItem(key: MobileStorageKeyValue): Promise<string | null> {
@@ -169,7 +169,7 @@ export async function loadPreferences(): Promise<Preferences> {
markdownFontSize?: number;
codeFontSize?: number | null;
codeWordBreak?: boolean;
connectOnboardingCompletedAccounts?: ReadonlyArray<string>;
connectOnboardingOptOutAccounts?: ReadonlyArray<string>;
} = {};
if (typeof parsed.liveActivitiesEnabled === "boolean") {
@@ -190,11 +190,10 @@ export async function loadPreferences(): Promise<Preferences> {
if (typeof parsed.codeWordBreak === "boolean") {
preferences.codeWordBreak = parsed.codeWordBreak;
}
if (Array.isArray(parsed.connectOnboardingCompletedAccounts)) {
preferences.connectOnboardingCompletedAccounts =
parsed.connectOnboardingCompletedAccounts.filter(
(account): account is string => typeof account === "string",
);
if (Array.isArray(parsed.connectOnboardingOptOutAccounts)) {
preferences.connectOnboardingOptOutAccounts = parsed.connectOnboardingOptOutAccounts.filter(
(account): account is string => typeof account === "string",
);
}
return preferences;
+9 -9
View File
@@ -1,18 +1,18 @@
import * as Schema from "effect/Schema";
/**
* Tracks which T3 Connect accounts have completed (or dismissed) the
* post-sign-in onboarding wizard, so it is shown at most once per account per
* browser.
* Accounts that opted out of the post-sign-in T3 Connect onboarding wizard
* ("Don't show this again"). The wizard otherwise shows on every sign-in,
* since sign-out clears the connected environments.
*/
export const CONNECT_ONBOARDING_STORAGE_KEY = "t3code:connect-onboarding:v1";
export const CONNECT_ONBOARDING_OPT_OUT_STORAGE_KEY = "t3code:connect-onboarding-opt-out:v1";
export const ConnectOnboardingStateSchema = Schema.Struct({
completedAccounts: Schema.Array(Schema.String),
export const ConnectOnboardingOptOutSchema = Schema.Struct({
optOutAccounts: Schema.Array(Schema.String),
});
export type ConnectOnboardingState = typeof ConnectOnboardingStateSchema.Type;
export type ConnectOnboardingOptOutState = typeof ConnectOnboardingOptOutSchema.Type;
export const EMPTY_CONNECT_ONBOARDING_STATE: ConnectOnboardingState = {
completedAccounts: [],
export const EMPTY_CONNECT_ONBOARDING_OPT_OUT_STATE: ConnectOnboardingOptOutState = {
optOutAccounts: [],
};
@@ -4,9 +4,9 @@ import { CheckIcon } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import {
CONNECT_ONBOARDING_STORAGE_KEY,
ConnectOnboardingStateSchema,
EMPTY_CONNECT_ONBOARDING_STATE,
CONNECT_ONBOARDING_OPT_OUT_STORAGE_KEY,
ConnectOnboardingOptOutSchema,
EMPTY_CONNECT_ONBOARDING_OPT_OUT_STATE,
} from "~/cloud/connectOnboarding";
import { hasCloudPublicConfig } from "~/cloud/publicConfig";
import { useCloudLinkController } from "~/cloud/useCloudLinkController";
@@ -16,6 +16,7 @@ import { cn } from "~/lib/utils";
import { useEnvironments, usePrimaryEnvironment } from "~/state/environments";
import { CloudEnvironmentConnectRows } from "./CloudEnvironmentConnectList";
import { Button } from "../ui/button";
import { Checkbox } from "../ui/checkbox";
import {
Dialog,
DialogDescription,
@@ -29,12 +30,13 @@ import { Switch } from "../ui/switch";
import { toastManager } from "../ui/toast";
/**
* Post-sign-in onboarding wizard for T3 Connect. Opens once per account (per
* browser) after the user is signed in: first prompts to publish this
* Post-sign-in onboarding wizard for T3 Connect. Opens on every in-session
* sign-in — sign-out removes the connected relay environments, so each new
* session starts with no devices to reach. It first prompts to publish this
* environment (managed tunnel + agent activity, both defaulting on) when the
* current session is authorized to manage the relay link, then lists the
* account's T3 Connect environments so every device can be connected right
* away. Dismissing the dialog counts as completion — it never nags twice.
* away. A cold load with a restored session does not count as a sign-in.
*/
export function ConnectOnboardingDialog() {
if (!hasCloudPublicConfig()) return null;
@@ -46,10 +48,10 @@ type OnboardingStep = "publish" | "devices";
function ConfiguredConnectOnboardingDialog() {
const { isLoaded, isSignedIn, userId } = useAuth();
const [onboardingState, setOnboardingState] = useLocalStorage(
CONNECT_ONBOARDING_STORAGE_KEY,
EMPTY_CONNECT_ONBOARDING_STATE,
ConnectOnboardingStateSchema,
const [optOutState, setOptOutState] = useLocalStorage(
CONNECT_ONBOARDING_OPT_OUT_STORAGE_KEY,
EMPTY_CONNECT_ONBOARDING_OPT_OUT_STATE,
ConnectOnboardingOptOutSchema,
);
const desktopBridge = window.desktopBridge;
@@ -75,34 +77,54 @@ function ConfiguredConnectOnboardingDialog() {
? ["publish", "devices"]
: ["devices"];
const [requestedAccount, setRequestedAccount] = useState<string | null>(null);
const [openForAccount, setOpenForAccount] = useState<string | null>(null);
const [step, setStep] = useState<OnboardingStep>("devices");
const [exposeEnvironment, setExposeEnvironment] = useState(true);
const [publishAgentActivity, setPublishAgentActivity] = useState(true);
const [dontShowAgain, setDontShowAgain] = useState(false);
const [isApplying, setIsApplying] = useState(false);
const prefilledFromLinkStateRef = useRef(false);
const observedAccountRef = useRef<string | null | undefined>(undefined);
const completedAccounts = onboardingState.completedAccounts;
const optOutAccounts = optOutState.optOutAccounts;
// Every sign-in that completes during this session requests the wizard. A
// cold load observes undefined → account and must not re-prompt — only a
// null → account transition is a sign-in.
useEffect(() => {
if (!isLoaded || !isSignedIn || !userId) return;
if (openForAccount !== null) return;
if (completedAccounts.includes(userId)) return;
if (!isLoaded) return;
const previousAccount = observedAccountRef.current;
const nextAccount = isSignedIn && userId ? userId : null;
observedAccountRef.current = nextAccount;
if (previousAccount === null && nextAccount !== null) {
setRequestedAccount(nextAccount);
}
}, [isLoaded, isSignedIn, userId]);
// Open once the session scopes resolve so the step set is stable. Accounts
// that chose "Don't show this again" are skipped.
useEffect(() => {
if (requestedAccount === null || openForAccount !== null) return;
if (optOutAccounts.includes(requestedAccount)) {
setRequestedAccount(null);
return;
}
if (!sessionScopesKnown) return;
setRequestedAccount(null);
prefilledFromLinkStateRef.current = false;
setExposeEnvironment(true);
setPublishAgentActivity(true);
setDontShowAgain(false);
setStep(canManageRelay && controller.linkState.target !== null ? "publish" : "devices");
setOpenForAccount(userId);
setOpenForAccount(requestedAccount);
}, [
canManageRelay,
completedAccounts,
controller.linkState.target,
isLoaded,
isSignedIn,
openForAccount,
optOutAccounts,
requestedAccount,
sessionScopesKnown,
userId,
]);
// Signing out (or switching accounts) mid-wizard invalidates everything the
@@ -111,7 +133,10 @@ function ConfiguredConnectOnboardingDialog() {
if (openForAccount !== null && (!isSignedIn || userId !== openForAccount)) {
setOpenForAccount(null);
}
}, [isSignedIn, openForAccount, userId]);
if (requestedAccount !== null && (!isSignedIn || userId !== requestedAccount)) {
setRequestedAccount(null);
}
}, [isSignedIn, openForAccount, requestedAccount, userId]);
// Toggles default on, but an environment that is already linked should show
// its actual configuration instead of silently proposing to rewrite it.
@@ -130,12 +155,13 @@ function ConfiguredConnectOnboardingDialog() {
const complete = () => {
const account = openForAccount;
setOpenForAccount(null);
if (!account) return;
setOnboardingState((state) =>
state.completedAccounts.includes(account)
? state
: { completedAccounts: [...state.completedAccounts, account] },
);
if (account !== null && dontShowAgain) {
setOptOutState((state) =>
state.optOutAccounts.includes(account)
? state
: { optOutAccounts: [...state.optOutAccounts, account] },
);
}
};
const applyPublishSelection = async () => {
@@ -194,22 +220,33 @@ function ConfiguredConnectOnboardingDialog() {
<DevicesStep />
)}
</DialogPanel>
<DialogFooter variant="bare">
{step === "publish" ? (
<>
<Button variant="ghost" disabled={isApplying} onClick={() => setStep("devices")}>
Not now
</Button>
<Button
disabled={isApplying || (controller.linkState.isPending && linkStateData === null)}
onClick={() => void applyPublishSelection()}
>
{isApplying ? "Enabling…" : "Continue"}
</Button>
</>
) : (
<Button onClick={complete}>Done</Button>
)}
<DialogFooter variant="bare" className="sm:justify-between">
<label className="flex cursor-pointer items-center gap-2 self-start text-xs text-muted-foreground sm:self-center">
<Checkbox
checked={dontShowAgain}
onCheckedChange={(checked) => setDontShowAgain(checked === true)}
/>
Don&apos;t show this again
</label>
<div className="flex flex-col-reverse gap-2 sm:flex-row">
{step === "publish" ? (
<>
<Button variant="ghost" disabled={isApplying} onClick={() => setStep("devices")}>
Not now
</Button>
<Button
disabled={
isApplying || (controller.linkState.isPending && linkStateData === null)
}
onClick={() => void applyPublishSelection()}
>
{isApplying ? "Enabling…" : "Continue"}
</Button>
</>
) : (
<Button onClick={complete}>Done</Button>
)}
</div>
</DialogFooter>
</DialogPopup>
</Dialog>
+2 -2
View File
@@ -182,7 +182,7 @@ const capabilitiesLayer = Layer.effectContext(
if (session === null) {
return yield* new ConnectionBlockedError({
reason: "authentication",
detail: "Sign in to T3 Cloud to connect this environment.",
detail: "Sign in to T3 Connect to connect this environment.",
});
}
const token = yield* session.readClerkToken().pipe(
@@ -197,7 +197,7 @@ const capabilitiesLayer = Layer.effectContext(
if (token === null) {
return yield* new ConnectionBlockedError({
reason: "authentication",
detail: "The T3 Cloud session is unavailable.",
detail: "The T3 Connect session is unavailable.",
});
}
return token;
@@ -342,6 +342,55 @@ describe("RelayEnvironmentDiscovery", () => {
}),
);
it.effect("refreshes proactively when credentials change before any manual refresh", () =>
Effect.gen(function* () {
const harness = yield* makeHarness();
yield* Effect.gen(function* () {
const discovery = yield* RelayEnvironmentDiscovery.RelayEnvironmentDiscovery;
const requests = yield* Ref.get(harness.statusRequests);
for (const environment of environments) {
yield* Deferred.succeed(
requests.get(environment.environmentId)!,
status(environment, "online"),
);
}
// Let the scoped wakeup subscription start before emitting, mirroring
// a real sign-in which always happens long after service start.
yield* Effect.yieldNow;
// Sign-in activates the session and emits credentials-changed; the
// list must populate without any screen having asked for a refresh.
yield* harness.wake("credentials-changed");
const populated = yield* SubscriptionRef.changes(discovery.state).pipe(
Stream.filter(
(state) => state.environments.size === environments.length && !state.refreshing,
),
Stream.runHead,
Effect.map(Option.getOrThrow),
);
expect(Option.isNone(populated.error)).toBe(true);
expect(yield* Ref.get(harness.listCalls)).toBe(1);
}).pipe(Effect.provide(harness.layer), Effect.scoped);
}),
);
it.effect("settles to a clean empty state when refreshed while signed out", () =>
Effect.gen(function* () {
const harness = yield* makeHarness();
yield* Effect.gen(function* () {
const discovery = yield* RelayEnvironmentDiscovery.RelayEnvironmentDiscovery;
yield* Ref.set(harness.clerkToken, null);
yield* discovery.refresh;
const state = yield* SubscriptionRef.get(discovery.state);
expect(state.environments.size).toBe(0);
expect(state.refreshing).toBe(false);
expect(Option.isNone(state.error)).toBe(true);
}).pipe(Effect.provide(harness.layer));
}),
);
it.effect("does not republish stale rows after sign-out invalidates an in-flight refresh", () =>
Effect.gen(function* () {
const harness = yield* makeHarness();
+11 -5
View File
@@ -279,10 +279,15 @@ export const make = Effect.fn("RelayEnvironmentDiscovery.make")(function* () {
if ((yield* Ref.get(accountGeneration)) !== generation) {
return;
}
// Signed out is the idle state, not a failure: the proactive
// refresh on credentials-changed also runs on sign-out and must
// settle back to a clean empty list.
const signedOut =
error._tag === "ConnectionBlockedError" && error.reason === "authentication";
yield* SubscriptionRef.update(state, (current) => ({
...current,
refreshing: false,
error: Option.some(error),
error: signedOut ? Option.none() : Option.some(error),
}));
}),
),
@@ -311,11 +316,12 @@ export const make = Effect.fn("RelayEnvironmentDiscovery.make")(function* () {
yield* Ref.update(accountGeneration, (current) => current + 1);
yield* Ref.set(activeAccountId, Option.none());
yield* Ref.set(offlineReportFingerprints, new Map());
const shouldRefresh = yield* Ref.get(hasRefreshed);
yield* SubscriptionRef.set(state, EMPTY_RELAY_ENVIRONMENT_DISCOVERY_STATE);
if (shouldRefresh) {
yield* refresh.pipe(Effect.forkScoped);
}
// Refresh proactively — this wakeup fires when a session activates
// (sign-in or cold start), and the list should be populated before
// any screen asks for it. A signed-out refresh settles back to the
// clean empty state.
yield* refresh.pipe(Effect.forkScoped);
})
: Effect.void,
),
@@ -123,7 +123,7 @@ export function createManagedRelaySession(input: ManagedRelaySessionInput): Mana
try: () => readCachedClerkToken(nowMillis),
catch: (cause) =>
new ManagedRelaySessionError({
message: "Could not obtain the T3 Cloud session token.",
message: "Could not obtain the T3 Connect session token.",
cause,
}),
});
@@ -181,7 +181,7 @@ function readSessionClerkToken(
? Effect.succeed(token)
: Effect.fail(
new ManagedRelaySessionError({
message: "The T3 Cloud session token is unavailable.",
message: "The T3 Connect session token is unavailable.",
}),
),
),
@@ -226,7 +226,7 @@ function requireClerkToken(
if (!session || session.accountId !== accountId) {
return Effect.fail(
new ManagedRelaySessionError({
message: "Sign in to T3 Cloud before loading relay data.",
message: "Sign in to T3 Connect before loading relay data.",
}),
);
}
@@ -296,7 +296,7 @@ export function readManagedRelaySnapshotState<A>(
let errorTraceId: string | null = null;
if (result._tag === "Failure") {
const cause = Cause.squash(result.cause);
error = cause instanceof Error ? cause.message : "Could not load T3 Cloud data.";
error = cause instanceof Error ? cause.message : "Could not load T3 Connect data.";
errorTraceId = findErrorTraceId(cause);
}
return {